obsidian-pathfinder2e/.obsidian/plugins/obsidian-5e-statblocks/main.js

887 lines
1.5 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var Um=Object.create;var na=Object.defineProperty;var Vm=Object.getOwnPropertyDescriptor;var Ym=Object.getOwnPropertyNames;var Gm=Object.getPrototypeOf,Km=Object.prototype.hasOwnProperty;var Jm=(i,e,t)=>e in i?na(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var kr=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),eg=(i,e)=>{for(var t in e)na(i,t,{get:e[t],enumerable:!0})},_c=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ym(e))!Km.call(i,a)&&a!==t&&na(i,a,{get:()=>e[a],enumerable:!(n=Vm(e,a))||n.enumerable});return i};var It=(i,e,t)=>(t=i!=null?Um(Gm(i)):{},_c(e||!i||!i.__esModule?na(t,"default",{value:i,enumerable:!0}):t,i)),tg=i=>_c(na({},"__esModule",{value:!0}),i);var $e=(i,e,t)=>(Jm(i,typeof e!="symbol"?e+"":e,t),t),wr=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)};var te=(i,e,t)=>(wr(i,e,"read from private field"),t?t.call(i):e.get(i)),Ee=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},ei=(i,e,t,n)=>(wr(i,e,"write to private field"),n?n.call(i,t):e.set(i,t),t);var Qe=(i,e,t)=>(wr(i,e,"access private method"),t);var Sc=kr((Oc,_r)=>{(function(i){"use strict";var e=_(),t=O(),n=E(),a=S(),s={imagePlaceholder:void 0,cacheBust:!1},r={toSvg:o,toPng:c,toJpeg:d,toBlob:h,toPixelData:l,impl:{fontFaces:n,images:a,util:e,inliner:t,options:{}}};typeof _r<"u"?_r.exports=r:i.domtoimage=r;function o(v,x){return x=x||{},u(x),Promise.resolve(v).then(function(I){return m(I,x.filter,!0)}).then(p).then(y).then(P).then(function(I){return w(I,x.width||e.width(v),x.height||e.height(v))});function P(I){return x.bgcolor&&(I.style.backgroundColor=x.bgcolor),x.width&&(I.style.width=x.width+"px"),x.height&&(I.style.height=x.height+"px"),x.style&&Object.keys(x.style).forEach(function(R){I.style[R]=x.style[R]}),I}}function l(v,x){return f(v,x||{}).then(function(P){return P.getContext("2d").getImageData(0,0,e.width(v),e.height(v)).data})}function c(v,x){return f(v,x||{}).then(function(P){return P.toDataURL()})}function d(v,x){return x=x||{},f(v,x).then(function(P){return P.toDataURL("image/jpeg",x.quality||1)})}function h(v,x){return f(v,x||{}).then(e.canvasToBlob)}function u(v){typeof v.imagePlaceholder>"u"?r.impl.options.imagePlaceholder=s.imagePlaceholder:r.impl.options.imagePlaceholder=v.imagePlaceholder,typeof v.cacheBust>"u"?r.impl.options.cacheBust=s.cacheBust:r.impl.options.cacheBust=v.cacheBust}function f(v,x){return o(v,x).then(e.makeImage).then(e.delay(100)).then(function(I){var R=P(v);return R.getContext("2d").drawImage(I,0,0),R});function P(I){var R=document.createElement("canvas");if(R.width=x.width||e.width(I),R.height=x.height||e.height(I),x.bgcolor){var T=R.getContext("2d");T.fillStyle=x.bgcolor,T.fillRect(0,0,R.width,R.height)}return R}}function m(v,x,P){if(!P&&x&&!x(v))return Promise.resolve();return Promise.resolve(v).then(I).then(function($){return R(v,$,x)}).then(function($){return T(v,$)});function I($){return $ instanceof HTMLCanvasElement?e.makeImage($.toDataURL()):$.cloneNode(!1)}function R($,K,Z){var F=$.childNodes;if(F.length===0)return Promise.resolve(K);return V(K,e.asArray(F),Z).then(function(){return K});function V(B,Y,L){var ae=Promise.resolve();return Y.forEach(function(J){ae=ae.then(function(){return m(J,L)}).then(function(ue){ue&&B.appendChild(ue)})}),ae}}function T($,K){if(!(K instanceof Element))return K;return Promise.resolve().then(Z).then(F).then(V).then(B).then(function(){return K});function Z(){Y(window.getComputedStyle($),K.style);function Y(L,ae){L.cssText?ae.cssText=L.cssText:J(L,ae);function J(ue,X){e.asArray(ue).forEach(function(z){X.setProperty(z,ue.getPropertyValue(z),ue.getPropertyPriority(z))})}}}function F(){[":before",":after"].forEach(function(L){Y(L)});function Y(L){var ae=window.getComputedStyle($,L),J=ae.getPropertyValue("content");if(J===""||J==="none")return;var ue=e.uid();K.className=K.className+" "+ue;var X=document.createElement("style");X.appendChild(z(ue,L,ae)),K.appendChild(X);function z(ge,xe,Me){var et="."+ge+":"+xe,St=Me.cssText?kn(Me):wn(Me);return document.createTextNode(et+"{"+St+"}");function kn(Et){var Qt=Et.getPropertyValue("content");return Et.cssText+" content: "+Qt+";"}function wn(Et){return e.asArray(Et).map(Qt).join("; ")+";";function Qt(ft){return ft+": "+Et.getPropertyValue(ft)+(Et.getPropertyPriority(ft)?" !important":"")}}}}}function V(){$ instanceof HTMLTextAreaElement&&(K.innerHTML=$.value),$ instanceof HTMLInputElement&&K.setAttribute("value",$.value)}function B(){K instanceof SVGElement&&(K.setAttribute("xmlns","http://www.w3.org/2000/svg"),K instanceof SVGRectElement&&["width","height"].forEach(function(Y){var L=K.getAttribute(Y);L&&K.style.setProperty(Y,L)}))}}}function p(v){return n.resolveAll().then(function(x){var P=document.createElement("style");return v.appendChild(P),P.appendChild(document.createTextNode(x)),v})}function y(v){return a.inlineAll(v).then(function(){return v})}function w(v,x,P){return Promise.resolve(v).then(function(I){return I.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),new XMLSerializer().serializeToString(I)}).then(e.escapeXhtml).then(function(I){return'<foreignObject x="0" y="0" width="100%" height="100%">'+I+"</foreignObject>"}).then(function(I){return'<svg xmlns="http://www.w3.org/2000/svg" width="'+x+'" height="'+P+'">'+I+"</svg>"}).then(function(I){return"data:image/svg+xml;charset=utf-8,"+I})}function _(){return{escape:B,parseExtension:x,mimeType:P,dataAsUrl:V,isDataUrl:I,canvasToBlob:T,resolveUrl:$,getAndEncode:F,uid:K(),delay:Y,asArray:L,escapeXhtml:ae,makeImage:Z,width:J,height:ue};function v(){var z="application/font-woff",ge="image/jpeg";return{woff:z,woff2:z,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:ge,jpeg:ge,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"}}function x(z){var ge=/\.([^\.\/]*?)$/g.exec(z);return ge?ge[1]:""}function P(z){var ge=x(z).toLowerCase();return v()[ge]||""}function I(z){return z.search(/^(data:)/)!==-1}function R(z){return new Promise(function(ge){for(var xe=window.atob(z.toDataURL().split(",")[1]),Me=xe.length,et=new Uint8Array(Me),St=0;St<Me;St++)et[St]=xe.charCodeAt(St);ge(new Blob([et],{type:"image/png"}))})}function T(z){return z.toBlob?new Promise(function(ge){z.toBlob(ge)}):R(z)}function $(z,ge){var xe=document.implementation.createHTMLDocument(),Me=xe.createElement("base");xe.head.appendChild(Me);var et=xe.createElement("a");return xe.body.appendChild(et),Me.href=ge,et.href=z,et.href}function K(){var z=0;return function(){return"u"+ge()+z++;function ge(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)}}}function Z(z){return new Promise(function(ge,xe){var Me=new Image;Me.onload=function(){ge(Me)},Me.onerror=xe,Me.src=z})}function F(z){var ge=3e4;return r.impl.options.cacheBust&&(z+=(/\?/.test(z)?"&":"?")+new Date().getTime()),new Promise(function(xe){var Me=new XMLHttpRequest;Me.onreadystatechange=kn,Me.ontimeout=wn,Me.responseType="blob",Me.timeout=ge,Me.open("GET",z,!0),Me.send();var et;if(r.impl.options.imagePlaceholder){var St=r.impl.options.imagePlaceholder.split(/,/);St&&St[1]&&(et=St[1])}function kn(){if(Me.readyState===4){if(Me.status!==200){et?xe(et):Et("cannot fetch resource: "+z+", status: "+Me.status);return}var Qt=new FileReader;Qt.onloadend=function(){var ft=Qt.result.split(/,/)[1];xe(ft)},Qt.readAsDataURL(Me.response)}}function wn(){et?xe(et):Et("timeout of "+ge+"ms occured while fetching resource: "+z)}function Et(Qt){console.error(Qt),xe("")}})}function V(z,ge){return"data:"+ge+";base64,"+z}function B(z){return z.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1")}function Y(z){return function(ge){return new Promise(function(xe){setTimeout(function(){xe(ge)},z)})}}function L(z){for(var ge=[],xe=z.length,Me=0;Me<xe;Me++)ge.push(z[Me]);return ge}function ae(z){return z.replace(/#/g,"%23").replace(/\n/g,"%0A")}function J(z){var ge=X(z,"border-left-width"),xe=X(z,"border-right-width");return z.scrollWidth+ge+xe}function ue(z){var ge=X(z,"border-top-width"),xe=X(z,"border-bottom-width");return z.scrollHeight+ge+xe}function X(z,ge){var xe=window.getComputedStyle(z).getPropertyValue(ge);return parseFloat(xe.replace("px",""))}}function O(){var v=/url\(['"]?([^'"]+?)['"]?\)/g;return{inlineAll:R,shouldProcess:x,impl:{readUrls:P,inline:I}};function x(T){return T.search(v)!==-1}function P(T){for(var $=[],K;(K=v.exec(T))!==null;)$.push(K[1]);return $.filter(function(Z){return!e.isDataUrl(Z)})}function I(T,$,K,Z){return Promise.resolve($).then(function(V){return K?e.resolveUrl(V,K):V}).then(Z||e.getAndEncode).then(function(V){return e.dataAsUrl(V,e.mimeType($))}).then(function(V){return T.replace(F($),"$1"+V+"$3")});function F(V){return new RegExp(`(url\\(['"]?)(`+e.escape(V)+`)(['"]?\\))`,"g")}}function R(T,$,K){if(Z())return Promise.resolve(T);return Promise.resolve(T).then(P).then(function(F){var V=Promise.resolve(T);return F.forEach(function(B){V=V.then(function(Y){return I(Y,B,$,K)})}),V});function Z(){return!x(T)}}}function E(){return{resolveAll:v,impl:{readAll:x}};function v(){return x(document).then(function(P){return Promise.all(P.map(function(I){return I.resolve()}))}).then(function(P){return P.join(`
`)})}function x(){return Promise.resolve(e.asArray(document.styleSheets)).then(I).then(P).then(function(T){return T.map(R)});function P(T){return T.filter(function($){return $.type===CSSRule.FONT_FACE_RULE}).filter(function($){return t.shouldProcess($.style.getPropertyValue("src"))})}function I(T){var $=[];return T.forEach(function(K){try{e.asArray(K.cssRules||[]).forEach($.push.bind($))}catch(Z){console.log("Error while reading CSS rules from "+K.href,Z.toString())}}),$}function R(T){return{resolve:function(){var K=(T.parentStyleSheet||{}).href;return t.inlineAll(T.cssText,K)},src:function(){return T.style.getPropertyValue("src")}}}}}function S(){return{inlineAll:x,impl:{newImage:v}};function v(P){return{inline:I};function I(R){return e.isDataUrl(P.src)?Promise.resolve():Promise.resolve(P.src).then(R||e.getAndEncode).then(function(T){return e.dataAsUrl(T,e.mimeType(P.src))}).then(function(T){return new Promise(function($,K){P.onload=$,P.onerror=K,P.src=T})})}}function x(P){if(!(P instanceof Element))return Promise.resolve(P);return I(P).then(function(){return P instanceof HTMLImageElement?v(P).inline():Promise.all(e.asArray(P.childNodes).map(function(R){return x(R)}))});function I(R){var T=R.style.getPropertyValue("background");return T?t.inlineAll(T).then(function($){R.style.setProperty("background",$,R.style.getPropertyPriority("background"))}).then(function(){return R}):Promise.resolve(R)}}}})(Oc)});var mi=kr((Or,Sr)=>{(function(i,e){typeof Or=="object"&&typeof Sr<"u"?Sr.exports=e():typeof define=="function"&&define.amd?define(e):(i=typeof globalThis<"u"?globalThis:i||self,i["fast-copy"]=e())})(Or,function(){"use strict";var i=Function.prototype.toString,e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,s=Object.getOwnPropertySymbols,r=Object.getPrototypeOf,o=Object.prototype,l=o.hasOwnProperty,c=o.propertyIsEnumerable,d=typeof s=="function",h=typeof WeakMap=="function",u=function(){if(h)return function(){return new WeakMap};var S=function(){function v(){this._keys=[],this._values=[]}return v.prototype.has=function(x){return!!~this._keys.indexOf(x)},v.prototype.get=function(x){return this._values[this._keys.indexOf(x)]},v.prototype.set=function(x,P){this._keys.push(x),this._values.push(P)},v}();return function(){return new S}}(),f=function(S,v){var x=S.__proto__||r(S);if(!x)return e(null);var P=x.constructor;if(P===v.Object)return x===v.Object.prototype?{}:e(x);if(~i.call(P).indexOf("[native code]"))try{return new P}catch{}return e(x)},m=function(S,v,x,P){var I=f(S,v);P.set(S,I);for(var R in S)l.call(S,R)&&(I[R]=x(S[R],P));if(d)for(var T=s(S),$=0,K=T.length,Z=void 0;$<K;++$)Z=T[$],c.call(S,Z)&&(I[Z]=x(S[Z],P));return I},p=function(S,v,x,P){var I=f(S,v);P.set(S,I);for(var R=d?a(S).concat(s(S)):a(S),T=0,$=R.length,K=void 0,Z=void 0;T<$;++T)if(K=R[T],K!=="callee"&&K!=="caller")if(Z=n(S,K),Z){!Z.get&&!Z.set&&(Z.value=x(S[K],P));try{t(I,K,Z)}catch{I[K]=Z.value}}else I[K]=x(S[K],P);return I},y=function(S){var v="";return S.global&&(v+="g"),S.ignoreCase&&(v+="i"),S.multiline&&(v+="m"),S.unicode&&(v+="u"),S.sticky&&(v+="y"),v},w=Array.isArray,_=Object.getPrototypeOf,O=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:(console&&console.error&&console.error('Unable to locate global object, returning "this".'),this)}();function E(S,v){var x=!!(v&&v.isStrict),P=v&&v.realm||O,I=x?p:m,R=function(T,$){if(!T||typeof T!="object")return T;if($.has(T))return $.get(T);var K=T.__proto__||_(T),Z=K&&K.constructor;if(!Z||Z===P.Object)return I(T,P,R,$);var F;if(w(T)){if(x)return p(T,P,R,$);F=new Z,$.set(T,F);for(var V=0,B=T.length;V<B;++V)F[V]=R(T[V],$);return F}if(T instanceof P.Date)return new Z(T.getTime());if(T instanceof P.RegExp)return F=new Z(T.source,T.flags||y(T)),F.lastIndex=T.lastIndex,F;if(P.Map&&T instanceof P.Map)return F=new Z,$.set(T,F),T.forEach(function(Y,L){F.set(L,R(Y,$))}),F;if(P.Set&&T instanceof P.Set)return F=new Z,$.set(T,F),T.forEach(function(Y){F.add(R(Y,$))}),F;if(P.Blob&&T instanceof P.Blob)return T.slice(0,T.size,T.type);if(P.Buffer&&P.Buffer.isBuffer(T))return F=P.Buffer.allocUnsafe?P.Buffer.allocUnsafe(T.length):new Z(T.length),$.set(T,F),T.copy(F),F;if(P.ArrayBuffer){if(P.ArrayBuffer.isView(T))return F=new Z(T.buffer.slice(0)),$.set(T,F),F;if(T instanceof P.ArrayBuffer)return F=T.slice(0),$.set(T,F),F}return typeof T.then=="function"||T instanceof Error||P.WeakMap&&T instanceof P.WeakMap||P.WeakSet&&T instanceof P.WeakSet?T:I(T,P,R,$)};return R(S,u())}return E.default=E,E.strict=function(v,x){return E(v,{isStrict:!0,realm:x?x.realm:void 0})},E})});var Fs=kr((mS,ku)=>{"use strict";var cl=Object.defineProperty,h0=Object.getOwnPropertyDescriptor,d0=Object.getOwnPropertyNames,u0=Object.prototype.hasOwnProperty,f0=(i,e)=>{for(var t in e)cl(i,t,{get:e[t],enumerable:!0})},m0=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of d0(e))!u0.call(i,a)&&a!==t&&cl(i,a,{get:()=>e[a],enumerable:!(n=h0(e,a))||n.enumerable});return i},g0=i=>m0(cl({},"__esModule",{value:!0}),i),vu={};f0(vu,{FileInputSuggest:()=>b0,FolderInputSuggest:()=>p0,FuzzyInputSuggest:()=>hl,setNodeIcon:()=>k0});ku.exports=g0(vu);var ll=require("obsidian"),hl=class extends ll.AbstractInputSuggest{constructor(i,e,t){super(i,e.inputEl),this.items=t}getSuggestions(i){let e=(0,ll.prepareSimpleSearch)(i),t=[];for(let n of this.items){let a=e(this.getItemText(n));a&&t.push({item:n,match:a})}return t}renderSuggestion(i,e){e.addClass("mod-complex");let t=e.createDiv({cls:"suggestion-content"});if(!i?.item){t.setText("No match found"),t.parentElement?.addClass("is-selected");return}let n=t.createDiv("suggestion-title");this.renderTitle(n,i);let a=t.createDiv("suggestion-note");this.renderNote(a,i)}renderMatches(i,e,t,n){(0,ll.renderMatches)(i,e,t,n)}},bu=require("obsidian"),p0=class extends hl{getItemText(i){return i.path}renderNote(i,e){let{item:t,match:n}=e;(0,bu.renderMatches)(i,t.path,n.matches)}renderTitle(i,e){let{item:t,match:n}=e;(0,bu.renderMatches)(i,t.name,n.matches,t.path.length-t.name.length)}},yu=require("obsidian"),b0=class extends hl{getItemText(i){return i.path}renderNote(i,e){let{item:t,match:n}=e;(0,yu.renderMatches)(i,t.path,n.matches)}renderTitle(i,e){let{item:t,match:n}=e;(0,yu.renderMatches)(i,t.name,n.matches,t.path.length-t.name.length)}},y0=require("obsidian"),v0={"has-node-icon":"helpers_has-node-icon","x-small":"helpers_x-small",small:"helpers_small",medium:"helpers_medium",large:"helpers_large","x-large":"helpers_x-large"};function k0(i,e){i.addClass(v0["has-node-icon"]),(0,y0.setIcon)(i,e)}});var Rv={};eg(Rv,{DICE_ROLLER_SOURCE:()=>yn,default:()=>hr});module.exports=tg(Rv);var Zi=require("obsidian"),em=It(Sc());var wt=require("obsidian");var Kc=require("@codemirror/state"),Jc=require("@codemirror/view"),eh=It(mi());var Cn=require("@codemirror/commands");var Je=require("@lezer/common"),Cr=class i{constructor(e,t,n,a,s,r,o,l,c,d=0,h){this.p=e,this.stack=t,this.state=n,this.reducePos=a,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=l,this.curContext=c,this.lookAhead=d,this.parent=h}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let a=e.parser.context;return new i(e,[],t,n,n,0,[],0,a?new Ka(a,a.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,a=e&65535,{parser:s}=this.p,r=s.dynamicPrecedence(a);if(r&&(this.score+=r),n==0){this.pushState(s.getGoto(this.state,a,!0),this.reducePos),a<s.minRepeatTerm&&this.storeNode(a,this.reducePos,this.reducePos,4,!0),this.reduceContext(a,this.reducePos);return}let o=this.stack.length-(n-1)*3-(e&262144?6:0),l=o?this.stack[o-2]:this.p.ranges[0].from,c=this.reducePos-l;c>=2e3&&!(!((t=this.p.parser.nodeSet.types[a])===null||t===void 0)&&t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=c));let d=o?this.stack[o-1]:0,h=this.bufferBase+this.buffer.length-d;if(a<s.minRepeatTerm||e&131072){let u=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(a,l,u,h+4,!0)}if(e&262144)this.state=this.stack[o];else{let u=this.stack[o-3];this.state=s.getGoto(u,a,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(a,l)}storeNode(e,t,n,a=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let r=this,o=this.buffer.length;if(o==0&&r.parent&&(o=r.bufferBase-r.parent.bufferBase,r=r.parent),o>0&&r.buffer[o-4]==0&&r.buffer[o-1]>-1){if(t==n)return;if(r.buffer[o-2]>=t){r.buffer[o-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,t,n,a);else{let r=this.buffer.length;if(r>0&&this.buffer[r-4]!=0)for(;r>0&&this.buffer[r-2]>n;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,a>4&&(a-=4);this.buffer[r]=e,this.buffer[r+1]=t,this.buffer[r+2]=n,this.buffer[r+3]=a}}shift(e,t,n,a){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=a,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,a,4);else{let s=e,{parser:r}=this.p;(a>this.pos||t<=r.maxNode)&&(this.pos=a,r.stateFlag(s,1)||(this.reducePos=a)),this.pushState(s,n),this.shiftContext(t,n),t<=r.maxNode&&this.buffer.push(t,n,a,4)}}apply(e,t,n,a){e&65536?this.reduce(e):this.shift(e,t,n,a)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let a=this.pos;this.reducePos=this.pos=a+e.length,this.pushState(t,a),this.buffer.push(n,a,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),a=e.bufferBase+t;for(;e&&a==e.bufferBase;)e=e.parent;return new i(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,a,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Ar(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let a=[];for(let s=0,r;s<t.length;s+=2)(r=t[s+1])!=this.state&&this.p.parser.hasAction(r,e)&&a.push(t[s],r);if(this.stack.length<120)for(let s=0;a.length<8&&s<t.length;s+=2){let r=t[s+1];a.some((o,l)=>l&1&&o==r)||a.push(t[s],r)}t=a}let n=[];for(let a=0;a<t.length&&n.length<4;a+=2){let s=t[a+1];if(s==this.state)continue;let r=this.split();r.pushState(s,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(t[a],this.pos),r.reducePos=this.pos,r.score-=200,n.push(r)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,a=t&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],a,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;t=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(a,s)=>{if(!t.includes(a))return t.push(a),e.allActions(a,r=>{if(!(r&393216))if(r&65536){let o=(r>>19)-s;if(o>1){let l=r&65535,c=this.stack.length-o*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return o<<19|65536|l}}else{let o=n(r,s+1);if(o!=null)return o}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Ka(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},Ka=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},Ar=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let a=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=a}},Dr=class i{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new i(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new i(this.stack,this.pos,this.index)}};function aa(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let n=0,a=0;n<i.length;){let s=0;for(;;){let r=i.charCodeAt(n++),o=!1;if(r==126){s=65535;break}r>=92&&r--,r>=34&&r--;let l=r-32;if(l>=46&&(l-=46,o=!0),s+=l,o)break;s*=46}t?t[a++]=s:t=new e(s)}return t}var Sn=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},xc=new Sn,Pr=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=xc,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,a=this.rangeIndex,s=this.pos+e;for(;s<n.from;){if(!a)return null;let r=this.ranges[--a];s-=n.from-r.to,n=r}for(;t<0?s>n.to:s>=n.to;){if(a==this.ranges.length-1)return null;let r=this.ranges[++a];s+=r.from-n.to,n=r}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,a;if(t>=0&&t<this.chunk.length)n=this.pos+e,a=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(n=s,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)a=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let r=this.rangeIndex,o=this.range;for(;o.to<=n;)o=this.ranges[++r];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>o.to&&(this.chunk2=this.chunk2.slice(0,o.to-n)),a=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),a}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=xc,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let a of this.ranges){if(a.from>=t)break;a.to>e&&(n+=this.input.read(Math.max(a.from,e),Math.min(a.to,t)))}return n}},Ai=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Pc(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};Ai.prototype.contextual=Ai.prototype.fallback=Ai.prototype.extend=!1;var xn=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?aa(e):e}token(e,t){let n=e.pos,a=0;for(;;){let s=e.next<0,r=e.resolveOffset(1,1);if(Pc(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||a++,r==null)break;e.reset(r,e.token)}a&&(e.reset(n,e.token),e.acceptToken(this.elseToken,a))}};xn.prototype.contextual=Ai.prototype.fallback=Ai.prototype.extend=!1;var Tn=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function Pc(i,e,t,n,a,s){let r=0,o=1<<n,{dialect:l}=t.p.parser;e:for(;o&i[r];){let c=i[r+1];for(let f=r+3;f<c;f+=2)if((i[f+1]&o)>0){let m=i[f];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||ig(m,e.token.value,a,s))){e.acceptToken(m);break}}let d=e.next,h=0,u=i[r+2];if(e.next<0&&u>h&&i[c+u*3-3]==65535){r=i[c+u*3-1];continue e}for(;h<u;){let f=h+u>>1,m=c+f+(f<<1),p=i[m],y=i[m+1]||65536;if(d<p)u=f;else if(d>=y)h=f+1;else{r=i[m+2],e.advance();continue e}}break}}function Tc(i,e,t){for(let n=e,a;(a=i[n])!=65535;n++)if(a==t)return n-e;return-1}function ig(i,e,t,n){let a=Tc(t,n,e);return a<0||Tc(t,n,i)<a}var xt=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),xr=null;function Cc(i,e,t){let n=i.cursor(Je.IterMode.IncludeAnonymous);for(n.moveTo(e);;)if(!(t<0?n.childBefore(e):n.childAfter(e)))for(;;){if((t<0?n.to<e:n.from>e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(i.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:i.length}}var Mr=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Cc(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Cc(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],a=this.index[t];if(a==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=n.children[a],r=this.start[t]+n.positions[a];if(r>e)return this.nextStart=r,null;if(s instanceof Je.Tree){if(r==e){if(r<this.safeFrom)return null;let o=r+s.length;if(o<=this.safeTo){let l=s.prop(Je.NodeProp.lookAhead);if(!l||o+l<this.fragment.to)return s}}this.index[t]++,r+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[t]++,this.nextStart=r+s.length}}},Er=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Sn)}getActions(e){let t=0,n=null,{parser:a}=e.p,{tokenizers:s}=a,r=a.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<s.length;c++){if(!(1<<c&r))continue;let d=s[c],h=this.tokens[c];if(!(n&&!d.fallback)&&((d.contextual||h.start!=e.pos||h.mask!=r||h.context!=o)&&(this.updateCachedToken(h,d,e),h.mask=r,h.context=o),h.lookAhead>h.end+25&&(l=Math.max(h.lookAhead,l)),h.value!=0)){let u=t;if(h.extended>-1&&(t=this.addActions(e,h.extended,h.end,t)),t=this.addActions(e,h.value,h.end,t),!d.extend&&(n=h,t>u))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!n&&e.pos==this.stream.end&&(n=new Sn,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Sn,{pos:n,p:a}=e;return t.start=n,t.end=Math.min(n+1,a.stream.end),t.value=n==a.stream.end?a.parser.eofTerm:0,t}updateCachedToken(e,t,n){let a=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(a,e),n),e.value>-1){let{parser:s}=n.p;for(let r=0;r<s.specialized.length;r++)if(s.specialized[r]==e.value){let o=s.specializers[r](this.stream.read(e.start,e.end),n);if(o>=0&&n.p.parser.dialect.allows(o>>1)){o&1?e.extended=o>>1:e.value=o>>1;break}}}else e.value=0,e.end=this.stream.clipPos(a+1)}putAction(e,t,n,a){for(let s=0;s<a;s+=3)if(this.actions[s]==e)return a;return this.actions[a++]=e,this.actions[a++]=t,this.actions[a++]=n,a}addActions(e,t,n,a){let{state:s}=e,{parser:r}=e.p,{data:o}=r;for(let l=0;l<2;l++)for(let c=r.stateSlot(s,l?2:1);;c+=3){if(o[c]==65535)if(o[c+1]==1)c=gi(o,c+2);else{a==0&&o[c+1]==2&&(a=this.putAction(gi(o,c+2),t,n,a));break}o[c]==t&&(a=this.putAction(gi(o,c+1),t,n,a))}return a}},Qr=class{constructor(e,t,n,a){this.parser=e,this.input=t,this.ranges=a,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Pr(t,a),this.tokens=new Er(e,this.stream),this.topTerm=e.top[1];let{from:s}=a[0];this.stacks=[Cr.start(this,e.top[0],s)],this.fragments=n.length&&this.stream.end-s>e.bufferLength*4?new Mr(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],a,s;if(this.bigReductionCount>300&&e.length==1){let[r]=e;for(;r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<e.length;r++){let o=e[r];for(;;){if(this.tokens.mainToken=null,o.pos>t)n.push(o);else{if(this.advanceStack(o,n,e))continue;{a||(a=[],s=[]),a.push(o);let l=this.tokens.getMainToken(o);s.push(l.value,l.end)}}break}}if(!n.length){let r=a&&ng(a);if(r)return xt&&console.log("Finish with "+this.stackID(r)),this.stackToTree(r);if(this.parser.strict)throw xt&&a&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&a){let r=this.stoppedAt!=null&&a[0].pos>this.stoppedAt?a[0]:this.runRecovery(a,s,n);if(r)return xt&&console.log("Force-finish "+this.stackID(r)),this.stackToTree(r.forceAll())}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(n.length>r)for(n.sort((o,l)=>l.score-o.score);n.length>r;)n.pop();n.some(o=>o.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let r=0;r<n.length-1;r++){let o=n[r];for(let l=r+1;l<n.length;l++){let c=n[l];if(o.sameState(c)||o.buffer.length>500&&c.buffer.length>500)if((o.score-c.score||o.buffer.length-c.buffer.length)>0)n.splice(l--,1);else{n.splice(r--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let r=1;r<n.length;r++)n[r].pos<this.minStackPos&&(this.minStackPos=n[r].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let a=e.pos,{parser:s}=this,r=xt?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&a>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,d=c?e.curContext.hash:0;for(let h=this.fragments.nodeAt(a);h;){let u=this.parser.nodeSet.types[h.type.id]==h.type?s.getGoto(e.state,h.type.id):-1;if(u>-1&&h.length&&(!c||(h.prop(Je.NodeProp.contextHash)||0)==d))return e.useNode(h,u),xt&&console.log(r+this.stackID(e)+` (via reuse of ${s.getName(h.type.id)})`),!0;if(!(h instanceof Je.Tree)||h.children.length==0||h.positions[0]>0)break;let f=h.children[0];if(f instanceof Je.Tree&&h.positions[0]==0)h=f;else break}}let o=s.stateSlot(e.state,4);if(o>0)return e.reduce(o),xt&&console.log(r+this.stackID(e)+` (via always-reduce ${s.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let d=l[c++],h=l[c++],u=l[c++],f=c==l.length||!n,m=f?e:e.split(),p=this.tokens.mainToken;if(m.apply(d,h,p?p.start:m.pos,u),xt&&console.log(r+this.stackID(m)+` (via ${d&65536?`reduce of ${s.getName(d&65535)}`:"shift"} for ${s.getName(h)} @ ${a}${m==e?"":", split"})`),f)return!0;m.pos>a?t.push(m):n.push(m)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Ac(e,t),!0}}runRecovery(e,t,n){let a=null,s=!1;for(let r=0;r<e.length;r++){let o=e[r],l=t[r<<1],c=t[(r<<1)+1],d=xt?this.stackID(o)+" -> ":"";if(o.deadEnd&&(s||(s=!0,o.restart(),xt&&console.log(d+this.stackID(o)+" (restarted)"),this.advanceFully(o,n))))continue;let h=o.split(),u=d;for(let f=0;h.forceReduce()&&f<10&&(xt&&console.log(u+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));f++)xt&&(u=this.stackID(h)+" -> ");for(let f of o.recoverByInsert(l))xt&&console.log(d+this.stackID(f)+" (via recover-insert)"),this.advanceFully(f,n);this.stream.end>o.pos?(c==o.pos&&(c++,l=0),o.recoverByDelete(l,c),xt&&console.log(d+this.stackID(o)+` (via recover-delete ${this.parser.getName(l)})`),Ac(o,n)):(!a||a.score<o.score)&&(a=o)}return a}stackToTree(e){return e.close(),Je.Tree.build({buffer:Dr.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(xr||(xr=new WeakMap)).get(e);return t||xr.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function Ac(i,e){for(let t=0;t<e.length;t++){let n=e[t];if(n.pos==i.pos&&n.sameState(i)){e[t].score<i.score&&(e[t]=i);return}}e.push(i)}var Ir=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},Tr=i=>i,Ja=class{constructor(e){this.start=e.start,this.shift=e.shift||Tr,this.reduce=e.reduce||Tr,this.reuse=e.reuse||Tr,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},es=class i extends Je.Parser{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let o=0;o<e.repeatNodeCount;o++)t.push("");let n=Object.keys(e.topRules).map(o=>e.topRules[o][1]),a=[];for(let o=0;o<t.length;o++)a.push([]);function s(o,l,c){a[o].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let o of e.nodeProps){let l=o[0];typeof l=="string"&&(l=Je.NodeProp[l]);for(let c=1;c<o.length;){let d=o[c++];if(d>=0)s(d,l,o[c++]);else{let h=o[c+-d];for(let u=-d;u>0;u--)s(o[c++],l,h);c++}}}this.nodeSet=new Je.NodeSet(t.map((o,l)=>Je.NodeType.define({name:l>=this.minRepeatTerm?void 0:o,id:l,props:a[l],top:n.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Je.DefaultBufferLength;let r=aa(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let o=0;o<this.specializerSpecs.length;o++)this.specialized[o]=this.specializerSpecs[o].term;this.specializers=this.specializerSpecs.map(Dc),this.states=aa(e.states,Uint32Array),this.data=aa(e.stateData),this.goto=aa(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(o=>typeof o=="number"?new Ai(r,o):o),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let a=new Qr(this,e,t,n);for(let s of this.wrappers)a=s(a,e,t,n);return a}getGoto(e,t,n=!1){let a=this.goto;if(t>=a[0])return-1;for(let s=a[t+1];;){let r=a[s++],o=r&1,l=a[s++];if(o&&n)return l;for(let c=s+(r>>1);s<c;s++)if(a[s]==e)return l;if(o)return-1}}hasAction(e,t){let n=this.data;for(let a=0;a<2;a++)for(let s=this.stateSlot(e,a?2:1),r;;s+=3){if((r=n[s])==65535)if(n[s+1]==1)r=n[s=gi(n,s+2)];else{if(n[s+1]==2)return gi(n,s+2);break}if(r==t||r==0)return gi(n,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),a=n?t(n):void 0;for(let s=this.stateSlot(e,1);a==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=gi(this.data,s+2);else break;a=t(gi(this.data,s+1))}return a}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=gi(this.data,n+2);else break;if(!(this.data[n+2]&1)){let a=this.data[n+1];t.some((s,r)=>r&1&&s==a)||t.push(this.data[n],a)}}return t}configure(e){let t=Object.assign(Object.create(i.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let a=e.tokenizers.find(s=>s.from==n);return a?a.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,a)=>{let s=e.specializers.find(o=>o.from==n.external);if(!s)return n;let r=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[a]=Dc(r),r})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let s of e.split(" ")){let r=t.indexOf(s);r>=0&&(n[r]=!0)}let a=null;for(let s=0;s<t.length;s++)if(!n[s])for(let r=this.dialects[t[s]],o;(o=this.data[r++])!=65535;)(a||(a=new Uint8Array(this.maxTerm+1)))[o]=1;return new Ir(e,n,a)}static deserialize(e){return new i(e)}};function gi(i,e){return i[e]|i[e+1]<<16}function ng(i){let e=null;for(let t of i){let n=t.p.stoppedAt;(t.pos==t.p.stream.end||n!=null&&t.pos>n)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function Dc(i){if(i.external){let e=i.extend?1:0;return(t,n)=>i.external(t,n)<<1|e}return i.get}var le=require("@lezer/highlight"),Mc=302,Ec=1,ag=2,Qc=303,sg=305,rg=306,og=3,lg=4,cg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Rc=125,hg=59,Ic=47,dg=42,ug=43,fg=45,mg=new Ja({start:!1,shift(i,e){return e==og||e==lg||e==sg?i:e==rg},strict:!1}),gg=new Tn((i,e)=>{let{next:t}=i;(t==Rc||t==-1||e.context)&&e.canShift(Qc)&&i.acceptToken(Qc)},{contextual:!0,fallback:!0}),pg=new Tn((i,e)=>{let{next:t}=i,n;cg.indexOf(t)>-1||t==Ic&&((n=i.peek(1))==Ic||n==dg)||t!=Rc&&t!=hg&&t!=-1&&!e.context&&e.canShift(Mc)&&i.acceptToken(Mc)},{contextual:!0}),bg=new Tn((i,e)=>{let{next:t}=i;if((t==ug||t==fg)&&(i.advance(),t==i.next)){i.advance();let n=!e.context&&e.canShift(Ec);i.acceptToken(n?Ec:ag)}},{contextual:!0}),yg=(0,le.styleTags)({"get set async static":le.tags.modifier,"for while do if else switch try catch finally return throw break continue default case":le.tags.controlKeyword,"in of await yield void typeof delete instanceof":le.tags.operatorKeyword,"let var const function class extends":le.tags.definitionKeyword,"import export from":le.tags.moduleKeyword,"with debugger as new":le.tags.keyword,TemplateString:le.tags.special(le.tags.string),super:le.tags.atom,BooleanLiteral:le.tags.bool,this:le.tags.self,null:le.tags.null,Star:le.tags.modifier,VariableName:le.tags.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":le.tags.function(le.tags.variableName),VariableDefinition:le.tags.definition(le.tags.variableName),Label:le.tags.labelName,PropertyName:le.tags.propertyName,PrivatePropertyName:le.tags.special(le.tags.propertyName),"CallExpression/MemberExpression/PropertyName":le.tags.function(le.tags.propertyName),"FunctionDeclaration/VariableDefinition":le.tags.function(le.tags.definition(le.tags.variableName)),"ClassDeclaration/VariableDefinition":le.tags.definition(le.tags.className),PropertyDefinition:le.tags.definition(le.tags.propertyName),PrivatePropertyDefinition:le.tags.definition(le.tags.special(le.tags.propertyName)),UpdateOp:le.tags.updateOperator,LineComment:le.tags.lineComment,BlockComment:le.tags.blockComment,Number:le.tags.number,String:le.tags.string,Escape:le.tags.escape,ArithOp:le.tags.arithmeticOperator,LogicOp:le.tags.logicOperator,BitOp:le.tags.bitwiseOperator,CompareOp:le.tags.compareOperator,RegExp:le.tags.regexp,Equals:le.tags.definitionOperator,Arrow:le.tags.function(le.tags.punctuation),": Spread":le.tags.punctuation,"( )":le.tags.paren,"[ ]":le.tags.squareBracket,"{ }":le.tags.brace,"InterpolationStart InterpolationEnd":le.tags.special(le.tags.brace),".":le.tags.derefOperator,", ;":le.tags.separator,"@":le.tags.meta,TypeName:le.tags.typeName,TypeDefinition:le.tags.definition(le.tags.typeName),"type enum interface implements namespace module declare":le.tags.definitionKeyword,"abstract global Privacy readonly override":le.tags.modifier,"is keyof unique infer":le.tags.operatorKeyword,JSXAttributeValue:le.tags.attributeValue,JSXText:le.tags.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":le.tags.angleBracket,"JSXIdentifier JSXNameSpacedName":le.tags.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":le.tags.attributeName,"JSXBuiltin/JSXIdentifier":le.tags.standard(le.tags.tagName)}),vg={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:458,of:467,while:470,with:474,do:478,if:482,else:484,switch:488,case:494,try:500,catch:504,finally:508,return:512,throw:516,break:520,continue:524,debugger:528},kg={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},wg={__proto__:null,"<":137},Wc=es.deserialize({version:14,states:"$EnO`QUOOO%QQUOOO'TQWOOP(bOSOOO*pQ(CjO'#CfO*wOpO'#CgO+VO!bO'#CgO+eO07`O'#DZO-vQUO'#DaO.WQUO'#DlO%QQUO'#DvO0_QUO'#EOOOQ(CY'#EW'#EWO0uQSO'#ETOOQO'#I`'#I`O0}QSO'#GkOOQO'#Ei'#EiO1YQSO'#EhO1_QSO'#EhO3aQ(CjO'#JcO6QQ(CjO'#JdO6nQSO'#FWO6sQ#tO'#FoOOQ(CY'#F`'#F`O7OO&jO'#F`O7^Q,UO'#FvO8tQSO'#FuOOQ(CY'#Jd'#JdOOQ(CW'#Jc'#JcOOQQ'#J}'#J}O8yQSO'#IPO9OQ(C[O'#IQOOQQ'#JP'#JPOOQQ'#IU'#IUQ`QUOOO%QQUO'#DnO9WQUO'#DzO%QQUO'#D|O9_QSO'#GkO9dQ,UO'#ClO9rQSO'#EgO9}QSO'#ErO:SQ,UO'#F_O:qQSO'#GkO:vQSO'#GoO;RQSO'#GoO;aQSO'#GrO;aQSO'#GsO;aQSO'#GuO9_QSO'#GxO<QQSO'#G{O=cQSO'#CbO=sQSO'#HYO={QSO'#H`O={QSO'#HbO`QUO'#HdO={QSO'#HfO={QSO'#HiO>QQSO'#HoO>VQ(C]O'#HuO%QQUO'#HwO>bQ(C]O'#HyO>mQ(C]O'#H{O9OQ(C[O'#H}O>xQ(CjO'#CfO?zQWO'#DfQOQSOOO@bQSO'#EPO9dQ,UO'#EgO@mQSO'#EgO@xQ`O'#F_OOQQ'#Cd'#CdOOQ(CW'#Dk'#DkOOQ(CW'#Jg'#JgO%QQUO'#JgOBUQWO'#E`OOQ(CW'#E_'#E_OB`Q(C`O'#E`OBzQWO'#ESOOQO'#Jj'#JjOC`QWO'#ESOCmQWO'#E`ODTQWO'#EfODWQWO'#E`ODqQWO'#E`OAQQWO'#E`OBzQWO'#E`PEbO?MpO'#C`POOO)CDn)CDnOOOO'#IV'#IVOEmOpO,59ROOQ(CY,59R,59ROOOO'#IW'#IWOE{O!bO,59RO%QQUO'#D]OOOO'#IY'#IYOFZO07`O,59uOOQ(CY,59u,59uOFiQUO'#IZOF|QSO'#JeOIOQbO'#JeO+sQUO'#JeOIVQSO,59{OImQSO'#EiOIzQSO'#JrOJVQSO'#JqOJVQSO'#JqOJ_QSO,5;VOJdQSO'#JpOOQ(CY,5:W,5:WOJkQUO,5:WOLlQ(CjO,5:bOM]QSO,5:jOMbQSO'#JnON[Q(C[O'#JoO:vQSO'#JnONcQSO'#JnONkQSO,5;UONpQSO'#JnOOQ(CY'#Cf'#CfO%QQUO'#EOO! dQ`O,5:oOOQO'#Jk'#JkOOQO-E<^-E<^O9_QSO,5=VO! zQSO,5=VO!!PQUO,5;SO!$SQ,UO'#EdO!%gQSO,5;SO!'PQ,UO'#DpO!'WQUO'#DuO!'bQWO,5;]O!'jQWO,5;]O%QQUO,5;]OOQQ'#FO'#FOOOQQ'#FQ'#FQO%QQUO,5;^O%QQUO,5;^O%QQUO,5;^O%QQUO,5;^O%QQUO,5;^O%QQUO,5;^O%QQUO,5;^O%QQUO,5;^O%QQUO,5;^O%QQUO,5;^O%QQUO,5;^OOQQ'#FU'#FUO!'xQUO,5;oOOQ(CY,5;t,5;tOOQ(CY,5;u,5;uO!){QSO,5;uOOQ(CY,5;v,5;vO%QQUO'#IfO!*TQ(C[O,5<cO!$SQ,UO,5;^O!*rQ,UO,5;^O%QQUO,5;rO!*yQ#tO'#FeO!+vQ#tO'#JvO!+bQ#tO'#JvO!+}Q#tO'#JvOOQO'#Jv'#JvO!,cQ#tO,5;}OOOO,5<Z,5<ZO!,tQUO'#FqOOOO'#Ie'#IeO7OO&jO,5;zO!,{Q#tO'#FsOOQ(CY,5;z,5;zO!-lQ7[O'#CrOOQ(CY'#Cv'#CvO!.PQSO'#CvO!.UO07`O'#CzO!.rQ,UO,5<`O!.yQSO,5<bO!0`QMhO'#GQO!0mQSO'#GRO!0rQSO'#GRO!0wQMhO'#GVO!1vQWO'#GZO!2iQ7[O'#J^OOQ(CY'#J^'#J^O!2sQSO'#J]O!3RQSO'#J[O!3ZQSO'#CqOOQ(CY'#Ct'#CtOOQ(CY'#DO'#DOOOQ(CY'#DQ'#DQO0xQSO'#DSO!%lQ,UO'#FxO!%lQ,UO'#FzO!3cQSO'#F|O!3hQSO'#F}O!0rQSO'#GTO!%lQ,UO'#GYO!3mQSO'#EjO!4XQSO,5<aO`QUO,5>kOOQQ'#JX'#JXOOQQ,5>l,5>lOOQQ-E<S-E<SO!6WQ(CjO,5:YO!8tQ(CjO,5:fO%QQUO,5:fO!;_Q(CjO,5:hOOQ(CW'#Co'#CoO!<OQ,UO,5=VO!<^Q(C[O'#JYO8tQSO'#JYO!<oQ(C[O,59WO!<zQWO,59WO!=SQ,UO,59WO9dQ,UO,59WO!=_QSO,5;SO!=gQSO'#HXO!=xQSO'#KRO%QQUO,5;wO!>QQWO,5;yO!>VQSO,5=rO!>[QSO,5=rO!>aQSO,5=rO9OQ(C[O,5=rO!>oQSO'#EkO!?iQWO'#ElOOQ(CW'#Jp'#JpO!?pQ(C[O'#KOO9OQ(C[O,5=ZO;aQSO,5=aOOQO'#Cr'#CrO!?{QWO,5=^O!@TQ,UO,5=_O!@`QSO,5=aO!@eQ`O,5=dO>QQSO'#G}O9_QSO'#HPO!@mQSO'#HPO9dQ,UO'#HSO!@rQSO'#HSOOQQ,5=g,5=gO!@wQSO'#HTO!APQSO'#ClO!AUQSO,58|O!A`QSO,58|O!ChQUO,58|OOQQ,58|,58|O!CuQ(C[O,58|O%QQUO,58|O!DQQUO'#H[OOQQ'#H]'#H]OOQQ'#H^'#H^O`QUO,5=tO!DbQSO,5=tO`QUO,5=zO`QUO,5=|O!DgQSO,5>OO`QUO,5>QO!DlQSO,5>TO!DqQUO,5>ZOOQQ,5>a,5>aO%QQUO,5>aO9OQ(C[O,5>cOOQQ,5>e,5>eO!HxQSO,5>eOOQQ,5>g,5>gO!HxQSO,5>gOOQQ,5>i,5>iO!H}QWO'#DXO%QQUO'#JgO!IlQWO'#JgO!JZQWO'#DgO!JlQWO'#DgO!L}QUO'#DgO!MUQSO'#JfO!M^QSO,5:QO!McQSO'#EmO!MqQSO'#JsO!MyQSO,5;WO!NOQWO'#DgO!N]QWO'#EROOQ(CY,5:k,5:kO%QQUO,5:kO!NdQSO,5:kO>QQSO,5;RO!<zQWO,5;RO!=SQ,UO,5;RO9dQ,UO,5;RO!NlQSO,5@RO!NqQ!LQO,5:oO# wQ(C`O,5:zOBzQWO,5:nO#!cQWO,5:nO#!pQWO,5:zO##WQWO,5:zO##qQWO,5:zO#$bQWO,5:zOBzQWO,5:zO!<oQ(C[O,5:nOOQ(CW'#Ec'#EcOOQO,5:z,5:zO%QQUO,5:zO#%UQ(C[O,5:zO#%aQ(C[O,5:zO!<zQWO,5:nOOQO,5;Q,5;QO#%oQ(C[O,5:zPOOO'#IT'#ITP#&TO?MpO,58zPOOO,58z,58zOOOO-E<T-E<TOOQ(CY1G.m1G.mOOOO-E<U-E<UO#&`Q`O,59wOOOO-E<W-E<WOOQ(CY1G/a1G/aO#&eQbO,5>uO+sQUO,5>uOOQO,5>{,5>{O#&oQUO'#IZOOQO-E<X-E<XO#&|QSO,5@PO#'UQbO,5@PO#']QSO,5@]OOQ(CY1G/g1G/gO%QQUO,5@^O#'eQSO'#IaOOQO-E<_-E<_O#']QSO,5@]OOQ(CW1G0q1G0qOOQ(CY1G/r1G/rOOQ(CY1G0U1G0UO#'yQSO,5@YO:vQSO,5@YO#(RQSO,5@YO%QQUO,5@ZO#(aQ(C[O,5@ZO#(rQ(C[O,5@ZO#(yQSO'#IcO#'yQSO,5@YOOQ(CW1G0p1G0pO!'bQWO,5:qO!'mQWO,5:qOOQO,5:s,5:sO#)hQSO,5:sO#)pQ,UO1G2qO9_QSO1G2qOOQ(CY1G0n1G0nO#*OQ(CjO1G0nO#+TQ(ChO,5;OOOQ(CY'#GP'#GPO#+qQ(CjO'#J^O!!PQUO1G0nO#-yQ,UO'#JhO#.TQSO,5:[O#.YQbO'#JiO%QQUO'#JiO#.dQSO,5:aOOQ(CY'#DX'#DXOOQ(CY1G0w1G0wO%QQUO1G0wOOQ(CY1G1a1G1aO#.iQSO1G0wO#1QQ(CjO1G0xO#1XQ(CjO1G0xO#3rQ(CjO1G0xO#3yQ(CjO1G0xO#6TQ(CjO1G0xO#6kQ(CjO1G0xO#9eQ(CjO1G0xO#9lQ(CjO1G0xO#<VQ(CjO1G0xO#<^Q(CjO1G0xO#>UQ(CjO1G0xO#AUQ$IUO'#CfO#CSQ$IUO1G1ZO#EQQ$IUO'#JdO!*OQSO1G1aO#EeQ(CjO,5?QOOQ(CW-E<d-E<dO#FXQ(CjO1G0xOOQ(CY1G0x1G0xO#HdQ(CjO1G1^O#IWQ#tO,5<RO#I`Q#tO,5<SO#IhQ#tO'#FjO#JPQSO'#FiOOQO'#Jw'#JwOOQO'#Id'#IdO#JUQ#tO1G1iOOQ(CY1G1i1G1iOOOO1G1t1G1tO#JgQ$IUO'#JcO#JqQSO,5<]O!'xQUO,5<]OOOO-E<c-E<cOOQ(CY1G1f1G1fO#JvQWO'#JvOOQ(CY,5<_,5<_O#KOQWO,5<_OOQ(CY,59b,59bO!$SQ,UO'#C|OOOO'#IX'#IXO#KTO07`O,59fOOQ(CY,59f,59fO%QQUO1G1zO!3hQSO'#IhO#K`QSO,5<sOOQ(CY,5<p,5<pOOQO'#Gf'#GfO!%lQ,UO,5=POOQO'#Gh'#GhO!%lQ,UO,5=RO!$SQ,UO,5=TOOQO1G1|1G1|O#KnQ`O'#CoO#LRQ`O,5<lO#LYQSO'#JzO9_QSO'#JzO#LhQSO,5<nO!%lQ,UO,5<mO#LmQSO'#GSO#LxQSO,5<mO#L}Q`O'#GPO#M[Q`O'#J{O#MfQSO'#J{O!$SQ,UO'#J{O#MkQSO,5<qO#MpQWO'#G[O!1qQWO'#G[O#NRQSO'#G^O#NWQSO'#G`O!0rQSO'#GcO#N]Q(C[O'#IjO#NhQWO,5<uOOQ(CY,5<u,5<uO#NoQWO'#G[O#N}QWO'#G]O$ VQWO'#G]OOQ(CY,5=U,5=UO!%lQ,UO,5?wO!%lQ,UO,5?wO$ [QSO'#IkO$ gQSO,5?vO$ oQSO,59]O$!`Q,UO,59nOOQ(CY,59n,59nO$#RQ,UO,5<dO$#tQ,UO,5<fO?rQSO,5<hOOQ(CY,5<i,5<iO$$OQSO,5<oO$$TQ,UO,5<tO!!PQUO1G1{O$$eQSO1G1{OOQQ1G4V1G4VOOQ(CY1G/t1G/tO!){QSO1G/tO$&dQ(CjO1G0QOOQQ1G2q1G2qO!$SQ,UO1G2qO%QQUO1G2qO$'TQSO1G2qO$'`Q,UO'#EdOOQ(CW,5?t,5?tO$'jQ(C[O,5?tOOQQ1G.r1G.rO!<oQ(C[O1G.rO!<zQWO1G.rO!=SQ,UO1G.rO$'{QSO1G0nO$(QQSO'#CfO$(]QSO'#KSO$(eQSO,5=sO$(jQSO'#KSO$(oQSO'#KSO$(zQSO'#IsO$)YQSO,5@mO$)bQbO1G1cOOQ(CY1G1e1G1eO9_QSO1G3^O?rQSO1G3^O$)iQSO1G3^O$)nQSO1G3^OOQQ1G3^1G3^O:vQSO'#JqO:vQSO'#EmO%QQUO'#EmO:vQSO'#ImO$)sQ(C[O,5@jOOQQ1G2u1G2uO!@`QSO1G2{O!$SQ,UO1G2xO$*OQSO1G2xOOQQ1G2y1G2yO!$SQ,UO1G2yO$*TQSO1G2yO$*]QWO'#GwOOQQ1G2{1G2{O!1qQWO'#IoO!@eQ`O1G3OOOQQ1G3O1G3OOOQQ,5=i,5=iO$*eQ,UO,5=kO9_QSO,5=kO#NWQSO,5=nO8tQSO,5=nO!<zQWO,5=nO!=SQ,UO,5=nO9dQ,UO,5=nO$*sQSO'#KQO$+OQSO,5=oOOQQ1G.h1G.hO$+TQ(C[O1G.hO?rQSO1G.hO$+`QSO1G.hO9OQ(C[O1G.hO$+kQbO,5@oO$,OQSO,5@oO$,ZQUO,5=vO$,bQSO,5=vO:vQSO,5@oOOQQ1G3`1G3`O`QUO1G3`OOQQ1G3f1G3fOOQQ1G3h1G3hO={QSO1G3jO$,gQUO1G3lO$0hQUO'#HkOOQQ1G3o1G3oO$0uQSO'#HqO>QQSO'#HsOOQQ1G3u1G3uO$0}QUO1G3uO9OQ(C[O1G3{OOQQ1G3}1G3}OOQ(CW'#GW'#GWO9OQ(C[O1G4PO9OQ(C[O1G4RO$5RQSO,5@RO!'xQUO,5;XO:vQSO,5;XO>QQSO,5:RO!'xQUO,5:RO!<zQWO,5:RO$5WQ$IUO,5:ROOQO,5;X,5;XO$5bQWO'#I[O$5xQSO,5@QOOQ(CY1G/l1G/lO$6QQWO'#IbO$6[QSO,5@_OOQ(CW1G0r1G0rO!JlQWO,5:ROOQO'#I_'#I_O$6dQWO,5:mOOQ(CY,5:m,5:mO!NgQSO1G0VOOQ(CY1G0V1G0VO%QQUO1G0VOOQ(CY1G0m1G0mO>QQSO1G0mO!<zQWO1G0mO!=SQ,UO1G0mOOQ(CW1G5m1G5mO!<oQ(C[O1G0YOOQO1G0f1G0fO%QQUO1G0fO$6kQ(C[O1G0fO$6vQ(C[O1G0fO!<zQWO1G0YOBzQWO1G0YO$7UQ(C`O1G0fO$7pQWO1G0YOBzQWO1G0fO$7}QWO1G0fO$8eQWO1G0fO$9OQWO1G0fO$9oQ(C[O1G0fOOQO1G0Y1G0YO$:TQ(CjO1G0fPOOO-E<R-E<RPOOO1G.f1G.fOOOO1G/c1G/cO$:_Q`O,5<cO$:gQbO1G4aOOQO1G4g1G4gO%QQUO,5>uO$:qQSO1G5kO$:yQSO1G5wO$;RQbO1G5xO:vQSO,5>{O$;]QSO1G5tO$;]QSO1G5tO:vQSO1G5tO$;eQ(CjO1G5uO%QQUO1G5uO$;uQ(C[O1G5uO$<WQSO,5>}O:vQSO,5>}OOQO,5>},5>}O$<lQSO,5>}OOQO-E<a-E<aOOQO1G0]1G0]OOQO1G0_1G0_O!*OQSO1G0_OOQQ7+(]7+(]O!$SQ,UO7+(]O%QQUO7+(]O$<zQSO7+(]O$=VQ,UO7+(]O$=eQ(CjO,59nO$?mQ(CjO,5<dO$AxQ(CjO,5<fO$DTQ(CjO,5<tOOQ(CY7+&Y7+&YO$FfQ(CjO7+&YO$GYQ,UO'#I]O$GdQSO,5@SOOQ(CY1G/v1G/vO$GlQUO'#I^O$GyQSO,5@TO$HRQbO,5@TOOQ(CY1G/{1G/{O$H]QSO7+&cOOQ(CY7+&c7+&cO$HbQ$IUO,5:bO%QQUO7+&uO$HlQ$IUO,5:YO$HyQ$IUO,5:fO$ITQ$IUO,5:hOOQ(CY7+&{7+&{OOQO1G1m1G1mOOQO1G1n1G1nO$I_Q#tO,5<UO!'xQUO,5<TOOQO-E<b-E<bOOQ(CY7+'T7+'TOOOO7+'`7+'`OOOO1G1w1G1wO$IjQSO1G1wOOQ(CY1G1y1G1yO$IoQ`O,59hOOOO-E<V-E<VOOQ(CY1G/Q1G/QO$IvQ(CjO7+'fOOQ(CY,5?S,5?SO$JjQSO,5?SOOQ(CY1G2_1G2_P$JoQSO'#IhPOQ(CY-E<f-E<fO$KcQ,UO1G2kO$LUQ,UO1G2mO$L`Q`O1G2oOOQ(CY1G2W1G2WO$LgQSO'#IgO$LuQSO,5@fO$LuQSO,5@fO$L}QSO,5@fO$MYQSO,5@fOOQO1G2Y1G2YO$MhQ,UO1G2XO!%lQ,UO1G2XO$MxQMhO'#IiO$NYQSO,5@gO!$SQ,UO,5@gO$NbQ`O,5@gOOQ(CY1G2]1G2]OOQ(CW,5<v,5<vOOQ(CW,5<w,5<wO$NlQSO,5<wOBuQSO,5<wO!<zQWO,5<vOOQO'#G_'#G_O$NqQSO,5<xOOQ(CW,5<z,5<zO$NlQSO,5<}OOQO,5?U,5?UOOQO-E<h-E<hOOQ(CY1G2a1G2aO!1qQWO,5<vO$NyQSO,5<wO#NRQSO,5<xO!1qQWO,5<wO% UQ,UO1G5cO% `Q,UO1G5cOOQO,5?V,5?VOOQO-E<i-E<iOOQO1G.w1G.wO!>QQWO,59pO%QQUO,59pO% mQSO1G2SO!%lQ,UO1G2ZO% rQ(CjO7+'gOOQ(CY7+'g7+'gO!!PQUO7+'gOOQ(CY7+%`7+%`O%!fQ`O'#J|O!NgQSO7+(]O%!pQbO7+(]O$<}QSO7+(]O%!wQ(ChO'#CfO%#[Q(ChO,5<{O%#|QSO,5<{OOQ(CW1G5`1G5`OOQQ7+$^7+$^O!<oQ(C[O7+$^O!<zQWO7+$^O!!PQUO7+&YO%$RQSO'#IrO%$gQSO,5@nOOQO1G3_1G3_O9_QSO,5@nO%$gQSO,5@nO%$oQSO,5@nOOQO,5?_,5?_OOQO-E<q-E<qOOQ(CY7+&}7+&}O%$tQSO7+(xO9OQ(C[O7+(xO9_QSO7+(xO?rQSO7+(xO%$yQSO,5;XOOQ(CW,5?X,5?XOOQ(CW-E<k-E<kOOQQ7+(g7+(gO%%OQ(ChO7+(dO!$SQ,UO7+(dO%%YQ`O7+(eOOQQ7+(e7+(eO!$SQ,UO7+(eO%%aQSO'#KPO%%lQSO,5=cOOQO,5?Z,5?ZOOQO-E<m-E<mOOQQ7+(j7+(jO%&{QWO'#HQOOQQ1G3V1G3VO!$SQ,UO1G3VO%QQUO1G3VO%'SQSO1G3VO%'_Q,UO1G3VO9OQ(C[O1G3YO#NWQSO1G3YO8tQSO1G3YO!<zQWO1G3YO!=SQ,UO1G3YO%'mQSO'#IqO%'xQSO,5@lO%(QQWO,5@lOOQ(CW1G3Z1G3ZOOQQ7+$S7+$SO?rQSO7+$SO9OQ(C[O7+$SO%(]QSO7+$SO%QQUO1G6ZO%QQUO1G6[O%(bQUO1G3bO%(iQSO1G3bO%(nQUO1G3bO%(uQ(C[O1G6ZOOQQ7+(z7+(zO9OQ(C[O7+)UO`QUO7+)WOOQQ'#KV'#KVOOQQ'#It'#ItO%)PQUO,5>VOOQQ,5>V,5>VO%QQUO'#HlO%)^QSO'#HnOOQQ,5>],5>]O:vQSO,5>]OOQQ,5>_,5>_OOQQ7+)a7+)aOOQQ7+)g7+)gOOQQ7+)k7+)kOOQQ7+)m7+)mO%)cQWO1G5mO%)wQ$IUO1G0sO%*RQSO1G0sOOQO1G/m1G/mO%*^Q$IUO1G/mO>QQSO1G/mO!'xQUO'#DgOOQO,5>v,5>vOOQO-E<Y-E<YOOQO,5>|,5>|OOQO-E<`-E<`O!<zQWO1G/mOOQO-E<]-E<]OOQ(CY1G0X1G0XOOQ(CY7+%q7+%qO!NgQSO7+%qOOQ(CY7+&X7+&XO>QQSO7+&XO!<zQWO7+&XOOQO7+%t7+%tO$:TQ(CjO7+&QOOQO7+&Q7+&QO%QQUO7+&QO%*hQ(C[O7+&QO!<oQ(C[O7+%tO!<zQWO7+%tO%*sQ(C[O7+&QOBzQWO7+%tO%+RQ(C[O7+&QO%+gQ(C`O7+&QO%+qQWO7+%tOBzQWO7+&QO%,OQWO7+&QO%,fQWO7+&QO%-PQSO7++`O%-PQSO7++`O%-XQ(CjO7++aO%QQUO7++aOOQO1G4i1G4iO:vQSO1G4iO%-iQSO1G4iOOQO7+%y7+%yO!NgQSO<<KwO%!pQbO<<KwO%-wQSO<<KwOOQQ<<Kw<<KwO!$SQ,UO<<KwO%QQUO<<KwO%.PQSO<<KwO%.[Q(CjO1G2kO%0gQ(CjO1G2mO%2rQ(CjO1G2XO%5TQ,UO,5>wOOQO-E<Z-E<ZO%5_QbO,5>xO%QQUO,5>xOOQO-E<[-E<[O%5iQSO1G5oOOQ(CY<<I}<<I}O%5qQ$IUO1G0nO%7{Q$IUO1G0xO%8SQ$IUO1G0xO%:WQ$IUO1G0xO%:_Q$IUO1G0xO%<SQ$IUO1G0xO%<jQ$IUO1G0xO%>}Q$IUO1G0xO%?UQ$IUO1G0xO%AYQ$IUO1G0xO%AaQ$IUO1G0xO%CXQ$IUO1G0xO%ClQ(CjO<<JaO%DqQ$IUO1G0xO%FgQ$IUO'#J^O%HjQ$IUO1G1^O%HwQ$IUO1G0QO!'xQUO'#FlOOQO'#Jx'#JxOOQO1G1p1G1pO%IRQSO1G1oO%IWQ$IUO,5?QOOOO7+'c7+'cOOOO1G/S1G/SOOQ(CY1G4n1G4nO!%lQ,UO7+(ZO%IbQSO,5?RO9_QSO,5?ROOQO-E<e-E<eO%IpQSO1G6QO%IpQSO1G6QO%IxQSO1G6QO%JTQ,UO7+'sO%JeQ`O,5?TO%JoQSO,5?TO!$SQ,UO,5?TOOQO-E<g-E<gO%JtQ`O1G6RO%KOQSO1G6ROOQ(CW1G2c1G2cO$NlQSO1G2cOOQ(CW1G2b1G2bO%KWQSO1G2dO!$SQ,UO1G2dOOQ(CW1G2i1G2iO!<zQWO1G2bOBuQSO1G2cO%K]QSO1G2dO%KeQSO1G2cO!%lQ,UO7+*}OOQ(CY1G/[1G/[O%KpQSO1G/[OOQ(CY7+'n7+'nO%KuQ,UO7+'uO%LVQ(CjO<<KROOQ(CY<<KR<<KRO!$SQ,UO'#IlO%LyQSO,5@hO!$SQ,UO1G2gOOQQ<<Gx<<GxO!<oQ(C[O<<GxO%MRQ(CjO<<ItOOQ(CY<<It<<ItOOQO,5?^,5?^O%MuQSO,5?^O$(oQSO,5?^OOQO-E<p-E<pO%MzQSO1G6YO%MzQSO1G6YO9_QSO1G6YO?rQSO<<LdOOQQ<<Ld<<LdO%NSQSO<<LdO9OQ(C[O<<LdO%NXQSO1G0sOOQQ<<LO<<LOO%%OQ(ChO<<LOOOQQ<<LP<<LPO%%YQ`O<<LPO%N^QWO'#InO%NiQSO,5@kO!'xQUO,5@kOOQQ1G2}1G2}O%NqQ(C`O'#JgO& ]QUO'#JgO& dQWO'#E`O&!QQ(C[O'#E`OB`Q(C`O'#E`O(YQWO'#HROOQO'#Ip'#IpO9OQ(C[O'#IpO&!fQWO,5=lOOQQ,5=l,5=lO&#OQWO'#E`O& vQWO'#E`O&#VQWO'#E`O&#pQWO'#E`O& jQWO'#E`O&$aQWO'#HRO&$rQSO7+(qO&$wQSO7+(qOOQQ7+(q7+(qO!$SQ,UO7+(qO%QQUO7+(qO&%PQSO7+(qOOQQ7+(t7+(tO9OQ(C[O7+(tO#NWQSO7+(tO8tQSO7+(tO!<zQWO7+(tO&%[QSO,5?]OOQO-E<o-E<oOOQO'#HU'#HUO&%gQSO1G6WO9OQ(C[O<<GnOOQQ<<Gn<<GnO?rQSO<<GnO&%oQSO7++uO&%tQSO7++vOOQQ7+(|7+(|O&%yQSO7+(|O&&OQUO7+(|O&&VQSO7+(|O%QQUO7++uO%QQUO7++vOOQQ<<Lp<<LpOOQQ<<Lr<<LrOOQQ-E<r-E<rOOQQ1G3q1G3qO&&[QSO,5>WOOQQ,5>Y,5>YO&&aQSO1G3wO:vQSO7+&_O!'xQUO7+&_OOQO7+%X7+%XO&&fQ$IUO1G5xO>QQSO7+%XOOQ(CY<<I]<<I]OOQ(CY<<Is<<IsO>QQSO<<IsOOQO<<Il<<IlO$:TQ(CjO<<IlO%QQUO<<IlOOQO<<I`<<I`O!<oQ(C[O<<I`O&&pQ(C[O<<IlO!<zQWO<<I`O&&{Q(C[O<<IlOBzQWO<<I`O&'ZQ(C[O<<IlO&'oQ(C`O<<IlO&'yQWO<<I`OBzQWO<<IlO&(WQWO<<IlO&(nQSO<<NzO&(vQ(CjO<<N{OOQO7+*T7+*TO:vQSO7+*TOOQQANAcANAcO&)WQSOANAcO!$SQ,UOANAcO!NgQSOANAcO%!pQbOANAcO%QQUOANAcO&)`Q(CjO7+'sO&+qQ(CjO7+'uO&.SQbO1G4dO&.^Q$IUO7+&YO&.kQ$IUO,59nO&0nQ$IUO,5<dO&2qQ$IUO,5<fO&4tQ$IUO,5<tO&6jQ$IUO7+'fO&6wQ$IUO7+'gO&7UQSO,5<WOOQO7+'Z7+'ZO&7ZQ,UO<<KuOOQO1G4m1G4mO&7bQSO1G4mO&7mQSO1G4mO&7{QSO7++lO&7{QSO7++lO!$SQ,UO1G4oO&8TQ`O1G4oO&8_QSO7++mOOQ(CW7+'}7+'}O$NlQSO7+(OO&8gQ`O7+(OOOQ(CW7+'|7+'|O$NlQSO7+'}O&8nQSO7+(OO!$SQ,UO7+(OOBuQSO7+'}O&8sQ,UO<<NiOOQ(CY7+$v7+$vO&8}Q`O,5?WOOQO-E<j-E<jO&9XQ(ChO7+(ROOQQAN=dAN=dO9_QSO1G4xOOQO1G4x1G4xO&9iQSO1G4xO&9nQSO7++tO&9nQSO7++tO9OQ(C[OANBOO?rQSOANBOOOQQANBOANBOOOQQANAjANAjOOQQANAkANAkO&9vQSO,5?YOOQO-E<l-E<lO&:RQ$IUO1G6VO&:]Q(C[O,5=mO8tQSO,5=mO&<nQbO'#CfO&<xQWO,5:zO&=SQWO,5:zO&=aQWO,5:zO&=tQWO,5:zO!<zQWO,5=mOOQO,5?[,5?[OOQO-E<n-E<nOOQQ1G3W1G3WO& ]QUO,5<xO%NqQ(C`O,5=mO# wQ(C`O,5:zO(YQWO,5=mO&>[QWO,5=mO&>mQWO,5:zOOQQ<<L]<<L]O!$SQ,UO<<L]O&$rQSO<<L]O&?WQSO<<L]O%QQUO<<L]OOQQ<<L`<<L`O9OQ(C[O<<L`O#NWQSO<<L`O8tQSO<<L`O&?`QWO1G4wO&?kQSO7++rOOQQAN=YAN=YO9OQ(C[OAN=YOOQQ<= a<= aOOQQ<= b<= bOOQQ<<Lh<<LhO&?sQSO<<LhO&?xQUO<<LhO&@PQSO<= aO&@UQSO<= bOOQQ1G3r1G3rO>QQSO7+)cO&@ZQSO<<IyO&@fQ$IUO<<IyOOQO<<Hs<<HsOOQ(CYAN?_AN?_OOQOAN?WAN?WO$:TQ(CjOAN?WOOQOAN>zAN>zO%QQUOAN?WO!<oQ(C[OAN>zO&@pQ(C[OAN?WO!<zQWOAN>zO&@{Q(C[OAN?WOBzQWOAN>zO&AZQ(C[OAN?WO&AoQ(C`OAN?WO&AyQWOAN>zOBzQWOAN?WOOQO<<Mo<<MoOOQQG26}G26}O!$SQ,UOG26}O!NgQSOG26}O&BWQSOG26}O%!pQbOG26}O&B`Q$IUO<<JaO&BmQ$IUO1G2XO&DcQ$IUO1G2kO&FfQ$IUO1G2mO&HiQ$IUO<<KRO&HvQ$IUO<<ItOOQO1G1r1G1rO!%lQ,UOANAaOOQO7+*X7+*XO&ITQSO7+*XO&I`QSO<= WO&IhQ`O7+*ZOOQ(CW<<Kj<<KjO$NlQSO<<KjOOQ(CW<<Ki<<KiO&IrQ`O<<KjO$NlQSO<<KiOOQO7+*d7+*dO9_QSO7+*dO&IyQSO<= `OOQQG27jG27jO9OQ(C[OG27jO!'xQUO1G4tO&JRQSO7++qOOQO1G3X1G3XO9OQ(C[O1G3XO&:]Q(C[O1G3XO&JZQWO1G0fO&JeQWO1G0fO&JrQWO1G0fO8tQSO1G3XO!<zQWO1G3XO(YQWO1G3XO%NqQ(C`O1G3XO$7UQ(C`O1G0fO&KVQWO1G3XO&$rQSOANAwOOQQANAwANAwO!$SQ,UOANAwO&KhQSOANAwOOQQANAzANAzO9OQ(C[OANAzO#NWQSOANAzOOQO'#HV'#HVOOQO7+*c7+*cOOQQG22tG22tOOQQANBSANBSO&KpQSOANBSOOQQAND{AND{OOQQAND|AND|OOQQ<<L}<<L}O!'xQUOAN?eOOQOG24rG24rO$:TQ(CjOG24rOOQOG24fG24fO%QQUOG24rO!<oQ(C[OG24fO&KuQ(C[OG24rO!<zQWOG24fO&LQQ(C[OG24rOBzQWOG24fO&L`Q(C[OG24rO!NgQSOLD,iOOQQLD,iLD,iO!$SQ,UOLD,iO&LtQSOLD,iO&L|Q$IUO7+'sO&NrQ$IUO7+'uO'!hQ,UOG26{OOQO<<Ms<<MsOOQ(CWANAUANAUO$NlQSOANAUOOQ(CWANATANATOOQO<<NO<<NOOOQQLD-ULD-UO'!xQ$IUO7+*`OOQO7+(s7+(sO9OQ(C[O7+(sO'#SQWO7+&QO'#^QWO7+&QO&:]Q(C[O7+(sO8tQSO7+(sO!<zQWO7+(sO(YQWO7+(sOOQQG27cG27cO&$rQSOG27cO!$SQ,UOG27cOOQQG27fG27fO9OQ(C[OG27fOOQQG27nG27nO'#kQ$IUOG25POOQOLD*^LD*^O$:TQ(CjOLD*^OOQOLD*QLD*QO%QQUOLD*^O!<oQ(C[OLD*QO'#uQ(C[OLD*^O!<zQWOLD*QO'$QQ(C[OLD*^OOQQ!$(!T!$(!TO!NgQSO!$(!TO!$SQ,UO!$(!TO'$`Q(CjOG26{OOQ(CWG26pG26pOOQO<<L_<<L_O'&qQWO<<IlO9OQ(C[O<<L_O&:]Q(C[O<<L_O8tQSO<<L_O!<zQWO<<L_OOQQLD,}LD,}O&$rQSOLD,}OOQQLD-QLD-QOOQO!$'Mx!$'MxO$:TQ(CjO!$'MxOOQO!$'Ml!$'MlO%QQUO!$'MxO!<oQ(C[O!$'MlO'&{Q(C[O!$'MxOOQQ!)9Eo!)9EoO!NgQSO!)9EoOOQOANAyANAyO9OQ(C[OANAyO&:]Q(C[OANAyO8tQSOANAyOOQQ!$(!i!$(!iOOQO!)9Cd!)9CdO$:TQ(CjO!)9CdOOQO!)9CW!)9CWO%QQUO!)9CdOOQQ!.K;Z!.K;ZO''WQ$IUOG26{OOQOG27eG27eO9OQ(C[OG27eO&:]Q(C[OG27eOOQO!.K9O!.K9OO$:TQ(CjO!.K9OOOQOLD-PLD-PO9OQ(C[OLD-POOQO!4/.j!4/.jOOQO!$(!k!$(!kO!'xQUO'#DvO0uQSO'#ETO'(|QbO'#JcO!'xQUO'#DnO')TQUO'#DzO!'xQUO'#D|O')[QbO'#CfO'+rQbO'#CfO',SQUO,5;SO!'xQUO,5;^O!'xQUO,5;^O!'xQUO,5;^O!'xQUO,5;^O!'xQUO,5;^O!'xQUO,5;^O!'xQUO,5;^O!'xQUO,5;^O!'xQUO,5;^O!'xQUO,5;^O!'xQUO,5;^O!'xQUO'#IfO'.VQSO,5<cO'._Q,UO,5;^O'/rQ,UO,5;^O!'xQUO,5;rO0xQSO'#DSO0xQSO'#DSO!$SQ,UO'#FxO'._Q,UO'#FxO!$SQ,UO'#FzO'._Q,UO'#FzO!$SQ,UO'#GYO'._Q,UO'#GYO!'xQUO,5:fO!'xQUO,5@^O',SQUO1G0nO'/yQ$IUO'#CfO!'xQUO1G1zO!$SQ,UO,5=PO'._Q,UO,5=PO!$SQ,UO,5=RO'._Q,UO,5=RO!$SQ,UO,5<mO'._Q,UO,5<mO',SQUO1G1{O!'xQUO7+&uO!$SQ,UO1G2XO'._Q,UO1G2XO!$SQ,UO1G2ZO'._Q,UO1G2ZO',SQUO7+'gO',SQUO7+&YO!$SQ,UOANAaO'._Q,UOANAaO'0TQSO'#EhO'0YQSO'#EhO'0bQSO'#FWO'0gQSO'#ErO'0lQSO'#JrO'0wQSO'#JpO'1SQSO,5;SO'1XQ,UO,5<`O'1`QSO'#GRO'1eQSO'#GRO'1jQSO,5<aO'1rQSO,5;SO'1zQ$IUO1G1ZO'2RQSO,5<mO'2WQSO,5<mO'2]QSO,5<oO'2bQSO,5<oO'2gQSO1G1{O'2lQSO1G0nO'2qQ,UO<<KuO'2xQ,UO<<KuO7^Q,UO'#FvO8tQSO'#FuO@mQSO'#EgO!'xQUO,5;oO!0rQSO'#GRO!0rQSO'#GRO!0rQSO'#GTO!0rQSO'#GTO!%lQ,UO7+(ZO!%lQ,UO7+(ZO$L`Q`O1G2oO$L`Q`O1G2oO!$SQ,UO,5=TO!$SQ,UO,5=T",stateData:"'4R~O'mOS'nOSROS'oRQ~OPYOQYOV!TO^pOaxObwOikOkYOlkOmkOskOuYOwYO|WO!QkO!RkO!XXO!csO!hZO!kYO!lYO!mYO!otO!quO!tvO!x]O#p}O$QzO$UfO%`{O%b!OO%d|O%e|O%h!PO%j!QO%m!RO%n!RO%p!SO%}!UO&T!VO&V!WO&X!XO&Z!YO&^!ZO&d![O&j!]O&l!^O&n!_O&p!`O&r!aO'tSO'vTO'yUO(RVO(`[O(miO~OPYOQYOa!gOb!fOikOkYOlkOmkOskOuYOwYO|WO!QkO!RkO!X!cO!csO!hZO!kYO!lYO!mYO!otO!quO!t!eO$Q!hO$UfO't!bO'vTO'yUO(RVO(`[O(miO~O^!qOl!kO|!lO![!rO!]!pO!^!pO!x<XO!|!wO!}!vO#O!tO#P!uO#Q!sO#T!xO#U!xO'u!iO'vTO'yUO(U!jO(`!nO~O'o!yO~OPYXXYX^YXkYXyYXzYX|YX!VYX!eYX!fYX!hYX!lYX#XYX#dcX#gYX#hYX#iYX#jYX#kYX#lYX#mYX#nYX#oYX#qYX#sYX#uYX#vYX#{YX'kYX(RYX(aYX(hYX(iYX~O!a$zX~P(gO[!{O'v!}O'w!{O'x!}O~O[#OO'x!}O'y!}O'z#OO~Oq#QO!O#RO(S#RO(T#TO~OPYOQYOa!gOb!fOikOkYOlkOmkOskOuYOwYO|WO!QkO!RkO!X!cO!csO!hZO!kYO!lYO!mYO!otO!quO!t!eO$Q!hO$UfO't<^O'vTO'yUO(RVO(`[O(miO~O!U#XO!V#UO!S(XP!S(eP~P+sO!W#aO~P`OPYOQYOa!gOb!fOikOkYOlkOmkOskOuYOwYO|WO!QkO!RkO!X!cO!csO!hZO!kYO!lYO!mYO!otO!quO!t!eO$Q!hO$UfO'vTO'yUO(RVO(`[O(miO~O!U#gO!x]O#b#jO#c#gO't<_O!g(bP~P._O!h#lO't#kO~O!t#pO!x]O%`#qO~O#d#rO~O!a#sO#d#rO~OP$ZOX$bOk$OOy#wOz#xO|#yO!V$_O!e$QO!f#uO!h#vO!l$ZO#g#|O#h#}O#i#}O#j#}O#k$PO#l$QO#m$QO#n$aO#o$QO#q$RO#s$TO#u$VO#v$WO(RVO(a$XO(h#zO(i#{O~O^(VX'k(VX'i(VX!g(VX!S(VX!X(VX%a(VX!a(VX~P1gO#X$cO#{$cOP(WXX(WXk(WXy(WXz(WX|(WX!V(WX!e(WX!h(WX!l(WX#g(WX#h(WX#i(WX#j(WX#k(WX#l(WX#m(WX#n(WX#o(WX#q(WX#s(WX#u(WX#v(WX(R(WX(a(WX(h(WX(i(WX!X(WX%a(WX~O^(WX!f(WX'k(WX'i(WX!S(WX!g(WXo(WX!a(WX~P3}O#X$cO~O$W$eO$Y$dO$a$jO~O!X$kO$UfO$d$lO$f$nO~Oi%QOk$rOl$qOm$qOs%ROu%SOw%TO|$yO!X$zO!c%YO!h$vO#c%ZO$Q%WO$m%UO$o%VO$r%XO't$pO'vTO'yUO'}%PO(R$sOd(OP~O!h%[O~O!a%^O~O^%_O'k%_O~O'u!iO~P%QO't%fO~O!h%[O't%fO'u!iO'}%PO~Ob%mO!h%[O't%fO~O#o$QO~Oy%rO!X%oO!h%qO%b%uO't%fO'u!iO'vTO'yUO](uP~O!t#pO~O|%wO!X%xO't%fO~O|%wO!X%xO%j%|O't%fO~O't%}O~O#p}O%b!OO%d|O%e|O%h!PO%j!QO%m!RO%n!RO~Oa&WOb&VO!t&TO%`&UO%r&SO~P;fOa&ZObwO!X&YO!tvO!x]O#p}O%`{O%d|O%e|O%h!PO%j!QO%m!RO%n!RO%p!SO~O_&^O#X&aO%b&[O'u!iO~P<eO!h&bO!q&fO~O!h#lO~O!XXO~O^%_O'j&nO'k%_O~O^%_O'j&qO'k%_O~O^%_O'j&sO'k%_O~O'iYX!SYXoYX!gYX&RYX!XYX%aYX!aYX~P(gO!['QO!]&yO!^&yO'u!iO'vTO'yUO~Ol&wO|&vO!U&zO(U&uO!W(YP!W(gP~P?fOg'TO!X'RO't%fO~Ob'YO!h%[O't%fO~Oy%rO!h%qO~Ol!kO|!lO!['_O!]'^O!^'^O!}'bO#O'aO#P'aO#Q'`O#T'dO#U'dO'u!iO'vTO'yUO(U!jO(`!nO~O!x<XO!|'cO~PAQO^%_O!a#sO!h%[O!l'jO#X'hO'k%_O'}%PO(a'fO~Ol!kO|!lO'vTO'yUO(U!jO(`!nO~O!]'^O!^'^O'u!iO~PBzO!['_O!]'^O!^'^O#T'dO#U'dO'u!iO~PBzO!XXO!['_O!]'^O!^'^O#Q'`O#T'dO#U'dO'u!iO~PBzO!['_O!]'^O!^'^O#O'aO#P'aO#Q'`O#T'dO#U'dO'u!iO~PBzO'p'nO'q'nO'r'pO~O[!{O'v'rO'w!{O'x'rO~O[#OO'x'rO'y'rO'z#OO~Oq#QO!O#RO(S#RO(T'vO~O!U'xO!S&}X!S'TX!V&}X!V'TX~P+sO!V'zO!S(XX~OP$ZOX$bOk$OOy#wOz#xO|#yO!V'zO!e$QO!f#uO!h#vO!l$ZO#g#|O#h#}O#i#}O#j#}O#k$PO#l$QO#m$QO#n$aO#o$QO#q$RO#s$TO#u$VO#v$WO(RVO(a$XO(h#zO(i#{O~O!S(XX~PGUO!S(PO~O!S(dX!V(dX!a(dX!g(dX(a(dX~O#X(dX#d#]X!W(dX~PI[O#X(QO!S(fX!V(fX~O!V(RO!S(eX~O!S(UO~O#X$cO~PI[O!W(VO~P`Oy#wOz#xO|#yO!f#uO!h#vO(RVOP!jaX!jak!ja!V!ja!e!ja!l!ja#g!ja#h!ja#i!ja#j!ja#k!ja#l!ja#m!ja#n!ja#o!ja#q!ja#s!ja#u!ja#v!ja(a!ja(h!ja(i!ja~O^!ja'k!ja'i!ja!S!ja!g!jao!ja!X!ja%a!ja!a!ja~PJrO!g(WO~O|%wO!X%xO!x]O#b(ZO#c(YO't%fO~O!a#sO#X([O(a'fO!V(cX^(cX'k(cX~O!g(cX~PMvO!V(_O!g(bX~O!g(aO~O|%wO!X%xO#c(YO't%fO~Oy(bOz(cO!f#uO!h#vO!x!wa|!wa~O!t!wa%`!wa!X!wa#b!wa#c!wa't!wa~P! OO!t(gO~OPYOQYOa!gOb!fOikOkYOlkOmkOskOuYOwYO|WO!QkO!RkO!XXO!csO!hZO!kYO!lYO!mYO!otO!quO!t!eO$Q!hO$UfO't!bO'vTO'yUO(RVO(`[O(miO~Oi%QOk$rOl$qOm$qOs%ROu%SOw<qO|$yO!X$zO!c={O!h$vO#c<wO$Q%WO$m<sO$o<uO$r%XO't(kO'vTO'yUO'}%PO(R$sO~O#d(mO~Oi%QOk$rOl$qOm$qOs%ROu%SOw%TO|$yO!X$zO!c%YO!h$vO#c%ZO$Q%WO$m%UO$o%VO$r%XO't(kO'vTO'yUO'}%PO(R$sO~Od([P~P!%lO!U(qO!g(]P~P%QO(U(sO(`[O~O|(uO!h#vO(U(sO(`[O~OP<WOQ<WOa=wOb!fOikOk<WOlkOmkOskOu<WOw<WO|WO!QkO!RkO!X!cO!c<ZO!hZO!k<WO!l<WO!m<WO!o<[O!q<]O!t!eO$Q!hO$UfO't)TO'vTO'yUO(RVO(`[O(m=uO~Oz)WO!h#vO~O!V$_O^$ka'k$ka'i$ka!g$ka!S$ka!X$ka%a$ka!a$ka~O#p)[O~P!$SOy)_O!a)^O!X$XX$T$XX$W$XX$Y$XX$a$XX~O!a)^O!X(jX$T(jX$W(jX$Y(jX$a(jX~Oy)_O~P!+bOy)_O!X(jX$T(jX$W(jX$Y(jX$a(jX~O!X)aO$T)eO$W)`O$Y)`O$a)fO~O!U)iO~P!'xO$W$eO$Y$dO$a)mO~Og$sXy$sX|$sX!f$sX(h$sX(i$sX~OdfXd$sXgfX!VfX#XfX~P!-WOl)oO~Oq)pO(S)qO(T)sO~Og)|Oy)uO|)vO(h)xO(i)zO~Od)tO~P!.aOd)}O~Oi%QOk$rOl$qOm$qOs%ROu%SOw<qO|$yO!X$zO!c={O!h$vO#c<wO$Q%WO$m<sO$o<uO$r%XO'vTO'yUO'}%PO(R$sO~O!U*RO't*OO!g(nP~P!/OO#d*TO~O!h*UO~O!U*ZO't*WO!S(oP~P!/OOk*gO|*_O![*eO!]*^O!^*^O!h*UO#T*fO%W*aO'u!iO(U!jO~O!W*dO~P!1UO!f#uOg(QXy(QX|(QX(h(QX(i(QX!V(QX#X(QX~Od(QX#y(QX~P!1}Og*jO#X*iOd(PX!V(PX~O!V*kOd(OX~O't%}Od(OP~O!h*rO~O't(kO~O|%wO!U#gO!X%xO!x]O#b#jO#c#gO't%fO!g(bP~O!a#sO#d*vO~OP$ZOX$bOk$OOy#wOz#xO|#yO!e$QO!f#uO!h#vO!l$ZO#g#|O#h#}O#i#}O#j#}O#k$PO#l$QO#m$QO#n$aO#o$QO#q$RO#s$TO#u$VO#v$WO(RVO(a$XO(h#zO(i#{O~O^!ba!V!ba'k!ba'i!ba!S!ba!g!bao!ba!X!ba%a!ba!a!ba~P!4aOy#wOz#xO|#yO!f#uO!h#vO(RVOP!naX!nak!na!V!na!e!na!l!na#g!na#h!na#i!na#j!na#k!na#l!na#m!na#n!na#o!na#q!na#s!na#u!na#v!na(a!na(h!na(i!na~O^!na'k!na'i!na!S!na!g!nao!na!X!na%a!na!a!na~P!6zOy#wOz#xO|#yO!f#uO!h#vO(RVOP!paX!pak!pa!V!pa!e!pa!l!pa#g!pa#h!pa#i!pa#j!pa#k!pa#l!pa#m!pa#n!pa#o!pa#q!pa#s!pa#u!pa#v!pa(a!pa(h!pa(i!pa~O^!pa'k!pa'i!pa!S!pa!g!pao!pa!X!pa%a!pa!a!pa~P!9eOg+OO!X'RO%a*}O'}%PO~O!a+QO^'|X!X'|X'k'|X!V'|X~O^%_O!XXO'k%_O~O!h%[O'}%PO~O!h%[O't%fO'}%PO~O!a#sO#d(mO~O%b+^O't+YO'vTO'yUO!W(vP~O!V+_O](uX~O(U(sO~OX+cO~O]+dO~O!X%oO't%fO'u!iO](uP~O|%wO!U+hO!V(RO!X%xO't%fO!S(eP~Ol&}O|+jO!U+iO'vTO'yUO(U(sO~O!W(gP~P!?TO!V+kO^(rX'k(rX~O#X+oO'}%PO~Og+rO!X$zO'}%PO~O!X+tO~Oy+vO!XXO~O!t+{O~Ob,QO~O't#kO!W(tP~Ob%mO~O%b!OO't%}O~P<eOX,WO],VO~OPYOQYOaxObwOikOkYOlkOmkOskOuYOwYO|WO!QkO!RkO!csO!hZO!kYO!lYO!mYO!otO!quO!tvO!x]O$UfO%`{O'vTO'yUO(RVO(`[O(miO~O!X!cO$Q!hO't!bO~P!AhO],VO^%_O'k%_O~O^,[O#p,^O%d,^O%e,^O~P%QO!h&bO~O&T,cO~O!X,eO~O&f,gO&h,hOP&caQ&caV&ca^&caa&cab&cai&cak&cal&cam&cas&cau&caw&ca|&ca!Q&ca!R&ca!X&ca!c&ca!h&ca!k&ca!l&ca!m&ca!o&ca!q&ca!t&ca!x&ca#p&ca$Q&ca$U&ca%`&ca%b&ca%d&ca%e&ca%h&ca%j&ca%m&ca%n&ca%p&ca%}&ca&T&ca&V&ca&X&ca&Z&ca&^&ca&d&ca&j&ca&l&ca&n&ca&p&ca&r&ca'i&ca't&ca'v&ca'y&ca(R&ca(`&ca(m&ca!W&ca&[&ca_&ca&a&ca~O't,mO~O!V{X!V!_X!W{X!W!_X!a{X!a!_X!h!_X#X{X'}!_X~O!a,rO#X,qO!V#aX!V(ZX!W#aX!W(ZX!a(ZX!h(ZX'}(ZX~O!a,tO!h%[O'}%PO!V!ZX!W!ZX~Ol!kO|!lO'vTO'yUO(U!jO~OP<WOQ<WOa=wOb!fOikOk<WOlkOmkOskOu<WOw<WO|WO!QkO!RkO!X!cO!c<ZO!hZO!k<WO!l<WO!m<WO!o<[O!q<]O!t!eO$Q!hO$UfO'vTO'yUO(RVO(`[O(m=uO~O't<|O~P!J}O!V,xO!W(YX~O!W,zO~O!a,rO#X,qO!V#aX!W#aX~O!V,{O!W(gX~O!W,}O~O!]-OO!^-OO'u!iO~P!JlO!W-RO~P'TOg-UO!X'RO~O!S-ZO~Ol!wa![!wa!]!wa!^!wa!|!wa!}!wa#O!wa#P!wa#Q!wa#T!wa#U!wa'u!wa'v!wa'y!wa(U!wa(`!wa~P! OO^%_O!a#sO!h%[O!l-`O#X-^O'k%_O'}%PO(a'fO~O!]-bO!^-bO'u!iO~PBzO![-dO!]-bO!^-bO#T-eO#U-eO'u!iO~PBzO![-dO!]-bO!^-bO#Q-fO#T-eO#U-eO'u!iO~PBzO![-dO!]-bO!^-bO#O-gO#P-gO#Q-fO#T-eO#U-eO'u!iO~PBzO![-dO!]-bO!^-bO!}-hO#O-gO#P-gO#Q-fO#T-eO#U-eO'u!iO~PBzO^%_O#X-^O'k%_O~O^%_O!a#sO#X-^O'k%_O~O^%_O!a#sO!l-`O#X-^O'k%_O(a'fO~O'p'nO'q'nO'r-mO~Oo-nO~O!S&}a!V&}a~P!4aO!U-rO!S&}X!V&}X~P%QO!V'zO!S(Xa~O!S(Xa~PGUO!V(RO!S(ea~O|%wO!U-vO!X%xO't%fO!S'TX!V'TX~O!V(_O!g(ba~O|%wO!X%xO#c-yO't%fO~O#X-{O!V(ca!g(ca^(ca'k(ca~O!a#sO~P#(aO|%wO!U.OO!X%xO!x]O#b.QO#c.OO't%fO!V'VX!g'VX~Oz.UO!h#vO~Og.XO!X'RO%a.WO'}%PO~O^#[i!V#[i'k#[i'i#[i!S#[i!g#[io#[i!X#[i%a#[i!a#[i~P!4aOg>ROy)uO|)vO(h)xO(i)zO~O#d#Wa^#Wa#X#Wa'k#Wa!V#Wa!g#Wa!X#Wa!S#Wa~P#*rO#d(QXP(QXX(QX^(QXk(QXz(QX!e(QX!h(QX!l(QX#g(QX#h(QX#i(QX#j(QX#k(QX#l(QX#m(QX#n(QX#o(QX#q(QX#s(QX#u(QX#v(QX'k(QX(R(QX(a(QX!g(QX!S(QX'i(QXo(QX!X(QX%a(QX!a(QX~P!1}O!V.bOd([X~P!.aOd.dO~O!V.eO!g(]X~P!4aO!g.hO~O!S.jO~OP$ZOy#wOz#xO|#yO!f#uO!h#vO!l$ZO(RVOX#fi^#fik#fi!V#fi!e#fi#h#fi#i#fi#j#fi#k#fi#l#fi#m#fi#n#fi#o#fi#q#fi#s#fi#u#fi#v#fi'k#fi(a#fi(h#fi(i#fi'i#fi!S#fi!g#fio#fi!X#fi%a#fi!a#fi~O#g#fi~P#.nO#g#|O~P#.nOP$ZOy#wOz#xO|#yO!f#uO!h#vO!l$ZO#g#|O#h#}O#i#}O#j#}O(RVOX#fi^#fi!V#fi!e#fi#k#fi#l#fi#m#fi#n#fi#o#fi#q#fi#s#fi#u#fi#v#fi'k#fi(a#fi(h#fi(i#fi'i#fi!S#fi!g#fio#fi!X#fi%a#fi!a#fi~Ok#fi~P#1`Ok$OO~P#1`OP$ZOk$OOy#wOz#xO|#yO!f#uO!h#vO!l$ZO#g#|O#h#}O#i#}O#j#}O#k$PO(RVO^#fi!V#fi#q#fi#s#fi#u#fi#v#fi'k#fi(a#fi(h#fi(i#fi'i#fi!S#fi!g#fio#fi!X#fi%a#fi!a#fi~OX#fi!e#fi#l#fi#m#fi#n#fi#o#fi~P#4QOX$bO!e$QO#l$QO#m$QO#n$aO#o$QO~P#4QOP$ZOX$bOk$OOy#wOz#xO|#yO!e$QO!f#uO!h#vO!l$ZO#g#|O#h#}O#i#}O#j#}O#k$PO#l$QO#m$QO#n$aO#o$QO#q$RO(RVO^#fi!V#fi#s#fi#u#fi#v#fi'k#fi(a#fi(i#fi'i#fi!S#fi!g#fio#fi!X#fi%a#fi!a#fi~O(h#fi~P#7RO(h#zO~P#7ROP$ZOX$bOk$OOy#wOz#xO|#yO!e$QO!f#uO!h#vO!l$ZO#g#|O#h#}O#i#}O#j#}O#k$PO#l$QO#m$QO#n$aO#o$QO#q$RO#s$TO(RVO(h#zO^#fi!V#fi#u#fi#v#fi'k#fi(a#fi'i#fi!S#fi!g#fio#fi!X#fi%a#fi!a#fi~O(i#fi~P#9sO(i#{O~P#9sOP$ZOX$bOk$OOy#wOz#xO|#yO!e$QO!f#uO!h#vO!l$ZO#g#|O#h#}O#i#}O#j#}O#k$PO#l$QO#m$QO#n$aO#o$QO#q$RO#s$TO#u$VO(RVO(h#zO(i#{O~O^#fi!V#fi#v#fi'k#fi(a#fi'i#fi!S#fi!g#fio#fi!X#fi%a#fi!a#fi~P#<eOPYXXYXkYXyYXzYX|YX!eYX!fYX!hYX!lYX#XYX#dcX#gYX#hYX#iYX#jYX#kYX#lYX#mYX#nYX#oYX#qYX#sYX#uYX#vYX#{YX(RYX(aYX(hYX(iYX!VYX!WYX~O#yYX~P#?OOP$ZOX<oOk<cOy#wOz#xO|#yO!e<eO!f#uO!h#vO!l$ZO#g<aO#h<bO#i<bO#j<bO#k<dO#l<eO#m<eO#n<nO#o<eO#q<fO#s<hO#u<jO#v<kO(RVO(a$XO(h#zO(i#{O~O#y.lO~P#A]OP(WXX(WXk(WXy(WXz(WX|(WX!e(WX!f(WX!h(WX!l(WX#g(WX#h(WX#i(WX#j(WX#k(WX#l(WX#m(WX#n(WX#q(WX#s(WX#u(WX#v(WX(R(WX(a(WX(h(WX(i(WX!V(WX~O#X<pO#{<pO#o(WX#y(WX!W(WX~P#CZO^'Ya!V'Ya'k'Ya'i'Ya!g'Ya!S'Yao'Ya!X'Ya%a'Ya!a'Ya~P!4aOP#fiX#fi^#fik#fiz#fi!V#fi!e#fi!f#fi!h#fi!l#fi#g#fi#h#fi#i#fi#j#fi#k#fi#l#fi#m#fi#n#fi#o#fi#q#fi#s#fi#u#fi#v#fi'k#fi(R#fi(a#fi'i#fi!S#fi!g#fio#fi!X#fi%a#fi!a#fi~P#*rO^#zi!V#zi'k#zi'i#zi!S#zi!g#zio#zi!X#zi%a#zi!a#zi~P!4aO$W.qO$Y.qO~O$W.rO$Y.rO~O!a)^O#X.sO!X$^X$T$^X$W$^X$Y$^X$a$^X~O!U.tO~O!X)aO$T.vO$W)`O$Y)`O$a.wO~O!V<lO!W(VX~P#A]O!W.xO~O!a)^O$a(jX~O$a.zO~Oq)pO(S)qO(T.}O~Ol/QO!S/RO'vTO'yUO~O!VcX!acX!gcX!g$sX(acX~P!-WO!g/XO~P#*rO!V/YO!a#sO(a'fO!g(nX~O!g/_O~O!U*RO't%fO!g(nP~O#d/aO~O!S$sX!V$sX!a$zX~P!-WO!V/bO!S(oX~P#*rO!a/dO~O!S/fO~Ok/jO!a#sO!h%[O'}%PO(a'fO~O't/lO~O!a+QO~O^%_O!V/pO'k%_O~O!W/rO~P!1UO!]/sO!^/sO'u!iO(U!jO~O|/uO(U!jO~O#T/vO~O't%}Od'_X!V'_X~O!V*kOd(Oa~Od/{O~Oy/|Oz/|O|/}Ogva(hva(iva!Vva#Xva~Odva#yva~P$ tOy)uO|)vOg$la(h$la(i$la!V$la#X$la~Od$la#y$la~P$!jOy)uO|)vOg$na(h$na(i$na!V$na#X$na~Od$na#y$na~P$#]O#d0PO~Od$|a!V$|a#X$|a#y$|a~P!.aO#d0SO~Oy#wOz#xO|#yO!f#uO!h#vO(RVOP!niX!nik!ni!V!ni!e!ni!l!ni#g!ni#h!ni#i!ni#j!ni#k!ni#l!ni#m!ni#n!ni#o!ni#q!ni#s!ni#u!ni#v!ni(a!ni(h!ni(i!ni~O^!ni'k!ni'i!ni!S!ni!g!nio!ni!X!ni%a!ni!a!ni~P$$jOg.XO!X'RO%a.WO~Oi0ZO't0YO~P!/RO!a+QO^'|a!X'|a'k'|a!V'|a~O#d0aO~OXYX!VcX!WcX~O!V0bO!W(vX~O!W0dO~OX0eO~O't+YO'vTO'yUO~O!X%oO't%fO]'gX!V'gX~O!V+_O](ua~O!g0jO~P!4aOX0mO~O]0nO~O!V+kO^(ra'k(ra~O#X0tO~Og0wO!X$zO~O(U(sO!W(sP~Og1QO!X0}O%a1PO'}%PO~OX1[O!V1YO!W(tX~O!W1]O~O]1_O^%_O'k%_O~O't#kO'vTO'yUO~O#X$cO#o1bO#{$cO&R1cO^(WX~P#CZO#X$cO#o1bO&R1cO~O^1dO~P%QO^1fO~O&[1jOP&YiQ&YiV&Yi^&Yia&Yib&Yii&Yik&Yil&Yim&Yis&Yiu&Yiw&Yi|&Yi!Q&Yi!R&Yi!X&Yi!c&Yi!h&Yi!k&Yi!l&Yi!m&Yi!o&Yi!q&Yi!t&Yi!x&Yi#p&Yi$Q&Yi$U&Yi%`&Yi%b&Yi%d&Yi%e&Yi%h&Yi%j&Yi%m&Yi%n&Yi%p&Yi%}&Yi&T&Yi&V&Yi&X&Yi&Z&Yi&^&Yi&d&Yi&j&Yi&l&Yi&n&Yi&p&Yi&r&Yi'i&Yi't&Yi'v&Yi'y&Yi(R&Yi(`&Yi(m&Yi!W&Yi_&Yi&a&Yi~O_1pO!W1nO&a1oO~P`O!XXO!h1rO~O&h,hOP&ciQ&ciV&ci^&cia&cib&cii&cik&cil&cim&cis&ciu&ciw&ci|&ci!Q&ci!R&ci!X&ci!c&ci!h&ci!k&ci!l&ci!m&ci!o&ci!q&ci!t&ci!x&ci#p&ci$Q&ci$U&ci%`&ci%b&ci%d&ci%e&ci%h&ci%j&ci%m&ci%n&ci%p&ci%}&ci&T&ci&V&ci&X&ci&Z&ci&^&ci&d&ci&j&ci&l&ci&n&ci&p&ci&r&ci'i&ci't&ci'v&ci'y&ci(R&ci(`&ci(m&ci!W&ci&[&ci_&ci&a&ci~O!S1xO~O!V!Za!W!Za~P#A]Ol!kO|!lO!U2OO(U!jO!V'OX!W'OX~P?fO!V,xO!W(Ya~O!V'UX!W'UX~P!?TO!V,{O!W(ga~O!W2VO~P'TO^%_O#X2`O'k%_O~O^%_O!a#sO#X2`O'k%_O~O^%_O!a#sO!h%[O!l2dO#X2`O'k%_O'}%PO(a'fO~O!]2eO!^2eO'u!iO~PBzO![2hO!]2eO!^2eO#T2iO#U2iO'u!iO~PBzO![2hO!]2eO!^2eO#Q2jO#T2iO#U2iO'u!iO~PBzO![2hO!]2eO!^2eO#O2kO#P2kO#Q2jO#T2iO#U2iO'u!iO~PBzO^%_O!a#sO!l2dO#X2`O'k%_O(a'fO~O^%_O'k%_O~P!4aO!V$_Oo$ka~O!S&}i!V&}i~P!4aO!V'zO!S(Xi~O!V(RO!S(ei~O!S(fi!V(fi~P!4aO!V(_O!g(bi~O!V(ci!g(ci^(ci'k(ci~P!4aO#X2oO!V(ci!g(ci^(ci'k(ci~O|%wO!X%xO!x]O#b2rO#c2qO't%fO~O|%wO!X%xO#c2qO't%fO~Og2yO!X'RO%a2xO~Og2yO!X'RO%a2xO'}%PO~O#dvaPvaXva^vakva!eva!fva!hva!lva#gva#hva#iva#jva#kva#lva#mva#nva#ova#qva#sva#uva#vva'kva(Rva(ava!gva!Sva'ivaova!Xva%ava!ava~P$ tO#d$laP$laX$la^$lak$laz$la!e$la!f$la!h$la!l$la#g$la#h$la#i$la#j$la#k$la#l$la#m$la#n$la#o$la#q$la#s$la#u$la#v$la'k$la(R$la(a$la!g$la!S$la'i$lao$la!X$la%a$la!a$la~P$!jO#d$naP$naX$na^$nak$naz$na!e$na!f$na!h$na!l$na#g$na#h$na#i$na#j$na#k$na#l$na#m$na#n$na#o$na#q$na#s$na#u$na#v$na'k$na(R$na(a$na!g$na!S$na'i$nao$na!X$na%a$na!a$na~P$#]O#d$|aP$|aX$|a^$|ak$|az$|a!V$|a!e$|a!f$|a!h$|a!l$|a#g$|a#h$|a#i$|a#j$|a#k$|a#l$|a#m$|a#n$|a#o$|a#q$|a#s$|a#u$|a#v$|a'k$|a(R$|a(a$|a!g$|a!S$|a'i$|a#X$|ao$|a!X$|a%a$|a!a$|a~P#*rO^#[q!V#[q'k#[q'i#[q!S#[q!g#[qo#[q!X#[q%a#[q!a#[q~P!4aOd'PX!V'PX~P!%lO!V.bOd([a~O!U3RO!V'QX!g'QX~P%QO!V.eO!g(]a~O!V.eO!g(]a~P!4aO!S3UO~O#y!ja!W!ja~PJrO#y!ba!V!ba!W!ba~P#A]O#y!na!W!na~P!6zO#y!pa!W!pa~P!9eO!X3hO$UfO$_3iO~O!W3mO~Oo3nO~P#*rO^$hq!V$hq'k$hq'i$hq!S$hq!g$hqo$hq!X$hq%a$hq!a$hq~P!4aO!S3oO~Ol/QO'vTO'yUO~Oy)uO|)vO(i)zOg%Xi(h%Xi!V%Xi#X%Xi~Od%Xi#y%Xi~P$JzOy)uO|)vOg%Zi(h%Zi(i%Zi!V%Zi#X%Zi~Od%Zi#y%Zi~P$KmO(a$XO~P#*rO!U3rO't%fO!V'ZX!g'ZX~O!V/YO!g(na~O!V/YO!a#sO!g(na~O!V/YO!a#sO(a'fO!g(na~Od$ui!V$ui#X$ui#y$ui~P!.aO!U3zO't*WO!S']X!V']X~P!/OO!V/bO!S(oa~O!V/bO!S(oa~P#*rO!a#sO~O!a#sO#o4SO~Ok4VO!a#sO(a'fO~Od(Pi!V(Pi~P!.aO#X4YOd(Pi!V(Pi~P!.aO!g4]O~O^$iq!V$iq'k$iq'i$iq!S$iq!g$iqo$iq!X$iq%a$iq!a$iq~P!4aO!V4aO!X(pX~P#*rO!f#uO~P3}O^$sX!X$sX%UYX'k$sX!V$sX~P!-WO%U4cO^hXghXyhX|hX!XhX'khX(hhX(ihX!VhX~O%U4cO~O%b4jO't+YO'vTO'yUO!V'fX!W'fX~O!V0bO!W(va~OX4nO~O]4oO~O!S4sO~O^%_O'k%_O~P#*rO!X$zO~P#*rO!V4xO#X4zO!W(sX~O!W4{O~Ol!kO|4}O![5]O!]5RO!^5RO!x<XO!|5[O!}5ZO#O5YO#P5YO#Q5XO#T5WO#U!xO'u!iO'vTO'yUO(U!jO(`!nO~O!W5VO~P%%qOg5bO!X0}O%a5aO~Og5bO!X0}O%a5aO'}%PO~O't#kO!V'eX!W'eX~O!V1YO!W(ta~O'vTO'yUO(U5kO~O]5oO~O!g5rO~P%QO^5tO~O^5tO~P%QO#o5vO&R5wO~PMvO_1pO!W5{O&a1oO~P`O!a5}O~O!a6PO!V(Zi!W(Zi!a(Zi!h(Zi'}(Zi~O!V#ai!W#ai~P#A]O#X6QO!V#ai!W#ai~O!V!Zi!W!Zi~P#A]O^%_O#X6ZO'k%_O~O^%_O!a#sO#X6ZO'k%_O~O^%_O!a#sO!l6`O#X6ZO'k%_O(a'fO~O!h%[O'}%PO~P%+RO!]6aO!^6aO'u!iO~PBzO![6dO!]6aO!^6aO#T6eO#U6eO'u!iO~PBzO![6dO!]6aO!^6aO#Q6fO#T6eO#U6eO'u!iO~PBzO!V(_O!g(bq~O!V(cq!g(cq^(cq'k(cq~P!4aO|%wO!X%xO#c6jO't%fO~O!X'RO%a6mO~Og6pO!X'RO%a6mO~O#d%XiP%XiX%Xi^%Xik%Xiz%Xi!e%Xi!f%Xi!h%Xi!l%Xi#g%Xi#h%Xi#i%Xi#j%Xi#k%Xi#l%Xi#m%Xi#n%Xi#o%Xi#q%Xi#s%Xi#u%Xi#v%Xi'k%Xi(R%Xi(a%Xi!g%Xi!S%Xi'i%Xio%Xi!X%Xi%a%Xi!a%Xi~P$JzO#d%ZiP%ZiX%Zi^%Zik%Ziz%Zi!e%Zi!f%Zi!h%Zi!l%Zi#g%Zi#h%Zi#i%Zi#j%Zi#k%Zi#l%Zi#m%Zi#n%Zi#o%Zi#q%Zi#s%Zi#u%Zi#v%Zi'k%Zi(R%Zi(a%Zi!g%Zi!S%Zi'i%Zio%Zi!X%Zi%a%Zi!a%Zi~P$KmO#d$uiP$uiX$ui^$uik$uiz$ui!V$ui!e$ui!f$ui!h$ui!l$ui#g$ui#h$ui#i$ui#j$ui#k$ui#l$ui#m$ui#n$ui#o$ui#q$ui#s$ui#u$ui#v$ui'k$ui(R$ui(a$ui!g$ui!S$ui'i$ui#X$uio$ui!X$ui%a$ui!a$ui~P#*rOd'Pa!V'Pa~P!.aO!V'Qa!g'Qa~P!4aO!V.eO!g(]i~O#y#[i!V#[i!W#[i~P#A]OP$ZOy#wOz#xO|#yO!f#uO!h#vO!l$ZO(RVOX#fik#fi!e#fi#h#fi#i#fi#j#fi#k#fi#l#fi#m#fi#n#fi#o#fi#q#fi#s#fi#u#fi#v#fi#y#fi(a#fi(h#fi(i#fi!V#fi!W#fi~O#g#fi~P%6OO#g<aO~P%6OOP$ZOy#wOz#xO|#yO!f#uO!h#vO!l$ZO#g<aO#h<bO#i<bO#j<bO(RVOX#fi!e#fi#k#fi#l#fi#m#fi#n#fi#o#fi#q#fi#s#fi#u#fi#v#fi#y#fi(a#fi(h#fi(i#fi!V#fi!W#fi~Ok#fi~P%8ZOk<cO~P%8ZOP$ZOk<cOy#wOz#xO|#yO!f#uO!h#vO!l$ZO#g<aO#h<bO#i<bO#j<bO#k<dO(RVO#q#fi#s#fi#u#fi#v#fi#y#fi(a#fi(h#fi(i#fi!V#fi!W#fi~OX#fi!e#fi#l#fi#m#fi#n#fi#o#fi~P%:fOX<oO!e<eO#l<eO#m<eO#n<nO#o<eO~P%:fOP$ZOX<oOk<cOy#wOz#xO|#yO!e<eO!f#uO!h#vO!l$ZO#g<aO#h<bO#i<bO#j<bO#k<dO#l<eO#m<eO#n<nO#o<eO#q<fO(RVO#s#fi#u#fi#v#fi#y#fi(a#fi(i#fi!V#fi!W#fi~O(h#fi~P%=QO(h#zO~P%=QOP$ZOX<oOk<cOy#wOz#xO|#yO!e<eO!f#uO!h#vO!l$ZO#g<aO#h<bO#i<bO#j<bO#k<dO#l<eO#m<eO#n<nO#o<eO#q<fO#s<hO(RVO(h#zO#u#fi#v#fi#y#fi(a#fi!V#fi!W#fi~O(i#fi~P%?]O(i#{O~P%?]OP$ZOX<oOk<cOy#wOz#xO|#yO!e<eO!f#uO!h#vO!l$ZO#g<aO#h<bO#i<bO#j<bO#k<dO#l<eO#m<eO#n<nO#o<eO#q<fO#s<hO#u<jO(RVO(h#zO(i#{O~O#v#fi#y#fi(a#fi!V#fi!W#fi~P%AhO^#wy!V#wy'k#wy'i#wy!S#wy!g#wyo#wy!X#wy%a#wy!a#wy~P!4aOg>SOy)uO|)vO(h)xO(i)zO~OP#fiX#fik#fiz#fi!e#fi!f#fi!h#fi!l#fi#g#fi#h#fi#i#fi#j#fi#k#fi#l#fi#m#fi#n#fi#o#fi#q#fi#s#fi#u#fi#v#fi#y#fi(R#fi(a#fi!V#fi!W#fi~P%D`O!f#uOP(QXX(QXg(QXk(QXy(QXz(QX|(QX!e(QX!h(QX!l(QX#g(QX#h(QX#i(QX#j(QX#k(QX#l(QX#m(QX#n(QX#o(QX#q(QX#s(QX#u(QX#v(QX#y(QX(R(QX(a(QX(h(QX(i(QX!V(QX!W(QX~O#y#zi!V#zi!W#zi~P#A]O#y!ni!W!ni~P$$jO!W6|O~O!V'Ya!W'Ya~P#A]O!a#sO(a'fO!V'Za!g'Za~O!V/YO!g(ni~O!V/YO!a#sO!g(ni~Od$uq!V$uq#X$uq#y$uq~P!.aO!S']a!V']a~P#*rO!a7TO~O!V/bO!S(oi~P#*rO!V/bO!S(oi~O!S7XO~O!a#sO#o7^O~Ok7_O!a#sO(a'fO~O!S7aO~Od$wq!V$wq#X$wq#y$wq~P!.aO^$iy!V$iy'k$iy'i$iy!S$iy!g$iyo$iy!X$iy%a$iy!a$iy~P!4aO!V4aO!X(pa~O^#[y!V#[y'k#[y'i#[y!S#[y!g#[yo#[y!X#[y%a#[y!a#[y~P!4aOX7fO~O!V0bO!W(vi~O]7lO~O!a6PO~O(U(sO!V'bX!W'bX~O!V4xO!W(sa~O!h%[O'}%PO^(ZX!a(ZX!l(ZX#X(ZX'k(ZX(a(ZX~O't7uO~P._O!x<XO!|7yO!}7xO#O7wO#P7wO#Q7vO#T'dO#U'dO~PBzO^%_O!a#sO!l'jO#X'hO'k%_O(a'fO~O!W7}O~P%%qOl!kO'vTO'yUO(U!jO(`!nO~O|8OO~P&!mO![8SO!]8RO!^8RO#Q7vO#T'dO#U'dO'u!iO~PBzO![8SO!]8RO!^8RO#O8TO#P8TO#Q7vO#T'dO#U'dO'u!iO~PBzO!]8RO!^8RO'u!iO(U!jO(`!nO~O!X0}O~O!X0}O%a8VO~Og8YO!X0}O%a8VO~OX8_O!V'ea!W'ea~O!V1YO!W(ti~O!g8cO~O!g8dO~O!g8eO~O!g8eO~P%QO^8gO~O!a8jO~O!g8kO~O!V(fi!W(fi~P#A]O^%_O#X8sO'k%_O~O^%_O!a#sO#X8sO'k%_O~O^%_O!a#sO!l8wO#X8sO'k%_O(a'fO~O!h%[O'}%PO~P&'ZO!]8xO!^8xO'u!iO~PBzO![8{O!]8xO!^8xO#T8|O#U8|O'u!iO~PBzO!V(_O!g(by~O!V(cy!g(cy^(cy'k(cy~P!4aO!X'RO%a9PO~O#d$uqP$uqX$uq^$uqk$uqz$uq!V$uq!e$uq!f$uq!h$uq!l$uq#g$uq#h$uq#i$uq#j$uq#k$uq#l$uq#m$uq#n$uq#o$uq#q$uq#s$uq#u$uq#v$uq'k$uq(R$uq(a$uq!g$uq!S$uq'i$uq#X$uqo$uq!X$uq%a$uq!a$uq~P#*rO#d$wqP$wqX$wq^$wqk$wqz$wq!V$wq!e$wq!f$wq!h$wq!l$wq#g$wq#h$wq#i$wq#j$wq#k$wq#l$wq#m$wq#n$wq#o$wq#q$wq#s$wq#u$wq#v$wq'k$wq(R$wq(a$wq!g$wq!S$wq'i$wq#X$wqo$wq!X$wq%a$wq!a$wq~P#*rO!V'Qi!g'Qi~P!4aO#y#[q!V#[q!W#[q~P#A]Oy/|Oz/|O|/}OPvaXvagvakva!eva!fva!hva!lva#gva#hva#iva#jva#kva#lva#mva#nva#ova#qva#sva#uva#vva#yva(Rva(ava(hva(iva!Vva!Wva~Oy)uO|)vOP$laX$lag$lak$laz$la!e$la!f$la!h$la!l$la#g$la#h$la#i$la#j$la#k$la#l$la#m$la#n$la#o$la#q$la#s$la#u$la#v$la#y$la(R$la(a$la(h$la(i$la!V$la!W$la~Oy)uO|)vOP$naX$nag$nak$naz$na!e$na!f$na!h$na!l$na#g$na#h$na#i$na#j$na#k$na#l$na#m$na#n$na#o$na#q$na#s$na#u$na#v$na#y$na(R$na(a$na(h$na(i$na!V$na!W$na~OP$|aX$|ak$|az$|a!e$|a!f$|a!h$|a!l$|a#g$|a#h$|a#i$|a#j$|a#k$|a#l$|a#m$|a#n$|a#o$|a#q$|a#s$|a#u$|a#v$|a#y$|a(R$|a(a$|a!V$|a!W$|a~P%D`O#y$hq!V$hq!W$hq~P#A]O#y$iq!V$iq!W$iq~P#A]O!W9ZO~O#y9[O~P!.aO!a#sO!V'Zi!g'Zi~O!a#sO(a'fO!V'Zi!g'Zi~O!V/YO!g(nq~O!S']i!V']i~P#*rO!V/bO!S(oq~O!S9bO~P#*rO!S9bO~Od(Py!V(Py~P!.aO!V'`a!X'`a~P#*rO^%Tq!X%Tq'k%Tq!V%Tq~P#*rOX9gO~O!V0bO!W(vq~O#X9kO!V'ba!W'ba~O!V4xO!W(si~P#A]O^%_O!a+QO'k%_O~OPYXXYXkYXyYXzYX|YX!SYX!VYX!eYX!fYX!hYX!lYX#XYX#dcX#gYX#hYX#iYX#jYX#kYX#lYX#mYX#nYX#oYX#qYX#sYX#uYX#vYX#{YX(RYX(aYX(hYX(iYX~O!a%RX#o%RX~P&:hO#T-eO#U-eO~PBzO#Q9pO#T-eO#U-eO~PBzO#O9qO#P9qO#Q9pO#T-eO#U-eO~PBzO!}9rO#O9qO#P9qO#Q9pO#T-eO#U-eO~PBzO!]9uO!^9uO'u!iO(U!jO(`!nO~O![9xO!]9uO!^9uO#Q9pO#T-eO#U-eO'u!iO~PBzO!X0}O%a9{O~O'vTO'yUO(U:QO~O!V1YO!W(tq~O!g:TO~O!g:TO~P%QO!g:VO~O!g:WO~O#X:YO!V#ay!W#ay~O!V#ay!W#ay~P#A]O^%_O#X:^O'k%_O~O^%_O!a#sO#X:^O'k%_O~O^%_O!a#sO!l:bO#X:^O'k%_O(a'fO~O!h%[O'}%PO~P&AZO!]:cO!^:cO'u!iO~PBzO!X'RO%a:gO~O#y#wy!V#wy!W#wy~P#A]OP$uiX$uik$uiz$ui!e$ui!f$ui!h$ui!l$ui#g$ui#h$ui#i$ui#j$ui#k$ui#l$ui#m$ui#n$ui#o$ui#q$ui#s$ui#u$ui#v$ui#y$ui(R$ui(a$ui!V$ui!W$ui~P%D`Oy)uO|)vO(i)zOP%XiX%Xig%Xik%Xiz%Xi!e%Xi!f%Xi!h%Xi!l%Xi#g%Xi#h%Xi#i%Xi#j%Xi#k%Xi#l%Xi#m%Xi#n%Xi#o%Xi#q%Xi#s%Xi#u%Xi#v%Xi#y%Xi(R%Xi(a%Xi(h%Xi!V%Xi!W%Xi~Oy)uO|)vOP%ZiX%Zig%Zik%Ziz%Zi!e%Zi!f%Zi!h%Zi!l%Zi#g%Zi#h%Zi#i%Zi#j%Zi#k%Zi#l%Zi#m%Zi#n%Zi#o%Zi#q%Zi#s%Zi#u%Zi#v%Zi#y%Zi(R%Zi(a%Zi(h%Zi(i%Zi!V%Zi!W%Zi~O#y$iy!V$iy!W$iy~P#A]O#y#[y!V#[y!W#[y~P#A]O!a#sO!V'Zq!g'Zq~O!V/YO!g(ny~O!S']q!V']q~P#*rO!S:nO~P#*rO!V0bO!W(vy~O!V4xO!W(sq~O#T2iO#U2iO~PBzO#Q:uO#T2iO#U2iO~PBzO#O:vO#P:vO#Q:uO#T2iO#U2iO~PBzO!]:zO!^:zO'u!iO(U!jO(`!nO~O!X0}O%a:}O~O!g;QO~O^%_O#X;VO'k%_O~O^%_O!a#sO#X;VO'k%_O~O^%_O!a#sO!l;ZO#X;VO'k%_O(a'fO~O!X'RO%a;^O~OP$uqX$uqk$uqz$uq!e$uq!f$uq!h$uq!l$uq#g$uq#h$uq#i$uq#j$uq#k$uq#l$uq#m$uq#n$uq#o$uq#q$uq#s$uq#u$uq#v$uq#y$uq(R$uq(a$uq!V$uq!W$uq~P%D`OP$wqX$wqk$wqz$wq!e$wq!f$wq!h$wq!l$wq#g$wq#h$wq#i$wq#j$wq#k$wq#l$wq#m$wq#n$wq#o$wq#q$wq#s$wq#u$wq#v$wq#y$wq(R$wq(a$wq!V$wq!W$wq~P%D`Od%]!Z!V%]!Z#X%]!Z#y%]!Z~P!.aO!V'bq!W'bq~P#A]O#T6eO#U6eO~PBzO#Q;bO#T6eO#U6eO~PBzO!V#a!Z!W#a!Z~P#A]O^%_O#X;mO'k%_O~O^%_O!a#sO#X;mO'k%_O~O#d%]!ZP%]!ZX%]!Z^%]!Zk%]!Zz%]!Z!V%]!Z!e%]!Z!f%]!Z!h%]!Z!l%]!Z#g%]!Z#h%]!Z#i%]!Z#j%]!Z#k%]!Z#l%]!Z#m%]!Z#n%]!Z#o%]!Z#q%]!Z#s%]!Z#u%]!Z#v%]!Z'k%]!Z(R%]!Z(a%]!Z!g%]!Z!S%]!Z'i%]!Z#X%]!Zo%]!Z!X%]!Z%a%]!Z!a%]!Z~P#*rO#T8|O#U8|O~PBzO^%_O#X;zO'k%_O~OP%]!ZX%]!Zk%]!Zz%]!Z!e%]!Z!f%]!Z!h%]!Z!l%]!Z#g%]!Z#h%]!Z#i%]!Z#j%]!Z#k%]!Z#l%]!Z#m%]!Z#n%]!Z#o%]!Z#q%]!Z#s%]!Z#u%]!Z#v%]!Z#y%]!Z(R%]!Z(a%]!Z!V%]!Z!W%]!Z~P%D`Oo(VX~P1gO'u!iO~P!'xO!ScX!VcX#XcX~P&:hOPYXXYXkYXyYXzYX|YX!VYX!VcX!eYX!fYX!hYX!lYX#XYX#XcX#dcX#gYX#hYX#iYX#jYX#kYX#lYX#mYX#nYX#oYX#qYX#sYX#uYX#vYX#{YX(RYX(aYX(hYX(iYX~O!acX!gYX!gcX(acX~P')iOP<WOQ<WOa=wOb!fOikOk<WOlkOmkOskOu<WOw<WO|WO!QkO!RkO!XXO!c<ZO!hZO!k<WO!l<WO!m<WO!o<[O!q<]O!t!eO$Q!hO$UfO't)TO'vTO'yUO(RVO(`[O(m=uO~O!V<lO!W$ka~Oi%QOk$rOl$qOm$qOs%ROu%SOw<rO|$yO!X$zO!c=|O!h$vO#c<xO$Q%WO$m<tO$o<vO$r%XO't(kO'vTO'yUO'}%PO(R$sO~O#p)[O~P'._O!WYX!WcX~P')iO#d<`O~O!a#sO#d<`O~O#X<pO~O#o<eO~O#X<zO!V(fX!W(fX~O#X<pO!V(dX!W(dX~O#d<{O~Od<}O~P!.aO#d=SO~O#d=TO~O!a#sO#d=UO~O!a#sO#d<{O~O#y=VO~P#A]O#d=WO~O#d=XO~O#d=YO~O#d=ZO~O#d=[O~O#d=]O~O#y=^O~P!.aO#y=_O~P!.aO$U~!f!|!}#P#Q#T#b#c#n(m$m$o$r%U%`%a%b%h%j%m%n%p%r~'oR$U(m#h!R'm'u#il#g#jky'n(U'n't$W$Y$W~",goto:"$2w(zPPPP({P)OP)`P+j/pPPPP7RPP7hP=gAYPAmPAmPPPAmPC]PAmPAmPAmPCaPPCfPDPPH}PPPIRPPPPIRLUPPPL[NiPIRP!#SPPPP!%fIRPPPIRPIRP!'xIRP!+`!,b!,gP!-X!-]!-XPPPPP!0j!3SPP!3]!4kP!,bIRIR!8S!;`!@l!@l!DePPP!DlIRPPPPPPPPPPP!G{P!IbPPIR!JsPIRPIRIRIRIRPIR!LZPP# eP#$kP#$o#$y#$}#$}P# bP#%R#%RP#(XP#(]IRIR#(c#+hAmPAmPAmAmP#,rAmAm#.lAm#0yAm#2mAmAm#3Z#5V#5V#5Z#5c#5V#5kP#5VPAm#6gAm#7oAmAm7RPPP#8zPP#9d#9dP#9dP#9y#9dPP#:PP#9vP#9v#:c!3X#9v#:}#;T7O)O#;W)OP#;_#;_#;_P)OP)OP)OP)OPP)OP#;e#;hP#;h)OP#;lP#;oP)OP)OP)OP)OP)OP)O)OPP#;u#;{#<V#<]#<c#<i#<o#<}#=T#=Z#=e#=k#>g#>v#>|#?`#?f#?l#?z#@a#Aq#BP#BV#B]#Bc#Bi#Bs#By#CP#CZ#Cm#CsPPPPPPPPPP#CyPPPPPPP#Dm#I^P#J}#KU#K^PPPP$ h$$^$+P$+S$+V$-g$-j$-m$-tPP$-z$.O$.w$/w$/{$0aPP$0e$0k$0oP$0r$0v$0y$1o$2V$2[$2_$2b$2h$2k$2o$2sR!zRmpOXr!X#b%^&e&g&h&j,`,e1j1mU!pQ'R-QQ%dtQ%lwQ%szQ&]!TS&y!c,xQ'X!f^'^!m!r!s!t!u!v!wS*^$z*cQ+W%mQ+e%uQ,P&VQ-O'QQ-Y'YY-b'_'`'a'b'cQ/s*eQ1X,QW2e-d-f-g-hS5R0}5UU6a2h2j2kU8R5Y5Z5]S8x6d6fS9u8S8TQ:c8{Q:z9xR<y<[%SdOPWXYZrstu!X!^!l#Q#U#X#b#l#r#v#y#|#}$O$P$Q$R$S$T$U$V$W$_$c%^%d%q&^&a&e&g&h&j&n&v'T'h'x'z(Q([(m(q(u)t*v+j,[,`,e-U-^-r-{.e.l/}0S0a1Q1b1c1d1f1j1m1o2`2o3R4}5b5t5v5w6Z8O8Y8g8s:^;V;m;zS#n]<X!r)V$Y$k&z)i,q,t.t2O3h4z6Q9k:Y<W<Z<[<]<`<a<b<c<d<e<f<g<h<i<j<k<l<p<y<z<{<}=U=V=[=]=xQ*n%TQ+]%oQ,R&YQ,Y&bQ.[<qQ0W+OQ0[+QQ0g+^Q1a,WQ2u.XQ4i0bQ5i1YQ6o2yQ6u<rQ7h4jR9S6p'QkOPWXYZrstu!X!^!l#Q#U#X#b#l#r#v#y#|#}$O$P$Q$R$S$T$U$V$W$Y$_$c$k%^%d%q&^&a&b&e&g&h&j&n&v&z'T'h'x'z(Q([(m(q(u)i)t*v+O+j,[,`,e,q,t-U-^-r-{.X.e.l.t/}0S0a1Q1b1c1d1f1j1m1o2O2`2o2y3R3h4z4}5b5t5v5w6Q6Z6p8O8Y8g8s9k:Y:^;V;m;z<W<Z<[<]<`<a<b<c<d<e<f<g<h<i<j<k<l<p<y<z<{<}=U=V=[=]=x#n!kQ!m!p!r!s!t!u!v!w!x&y'Q'R'^'_'`'a'b'c'd,x-O-Q-b-d-e-f-g-h0}2e2h2i2j2k5O5U5W5X5Y5Z5[6a6d6e6f7v7w7x7y8T8x8{8|9p9q9r:c:u:v;b$Y$qi#s#u$a$b$v$y%U%V%Z)p)y){)|*T*Z*i*j*}+Q+o+r.W.b/a/b/d0P0t0w1P2x3p3z4S4Y4a4c5a6m7T7^8V9P9[9{:g:};^<n<o<s<t<u<v<w<x=O=P=Q=R=S=T=W=X=Y=Z=^=_=u=}>O>R>SQ%vzQ&w!cS&}%x,{Q+]%oS/Q)v/SQ0O*rQ0g+^Q0l+dQ1`,VQ1a,WQ4i0bQ4r0nQ5l1[Q5m1_Q7h4jQ7k4oQ8b5oQ9j7lR:R8_pmOXr!T!X#b%^&[&e&g&h&j,`,e1j1mR,T&^&z`OPXYrstux!X!^!g!l#Q#b#l#r#v#y#|#}$O$P$Q$R$S$T$U$V$W$Y$_$c$k%^%d%q&^&a&b&e&g&h&j&n&v'T'h'z(Q([(m(q(u)i)t*v+O+j,[,`,e,q,t-U-^-r-{.X.e.l.t/}0S0a1Q1b1c1d1f1j1m1o2O2`2o2y3R3h4z4}5b5t5v5w6Q6Z6p8O8Y8g8s9k:Y:^;V;m;z<W<Z<[<]<`<a<b<c<d<e<f<g<h<i<j<k<l<p<y<z<{<}=U=V=[=]=w=x[#ZWZ#U#X&z'xQ%gvQ%kwS%pz%u!U%y|}#e#g#j%[%w(R(Y(Z(_+h+i+k,^,r-v-y-}.O.Q1r2q2r6P6jQ&R!RQ'U!eQ'W!fQ(f#pS*Q$v*US+V%l%mQ+Z%oQ+z&TQ,O&VS-X'X'YQ.Z(gQ/^*RQ0`+WQ0f+^Q0h+_Q0k+cQ1S+{S1W,P,QQ2[-YQ3q/YQ4h0bQ4l0eQ4q0mQ5h1XQ7Q3rQ7g4jQ7j4nQ9f7fR:p9gv$xi#u%U%V%Z)y){*T*i*j.b/a0P3p4Y9[=u=}>O!d%iw!f!o%k%l%m&x'W'X'Y']'k*]+V+W,u-X-Y-a-c/k0`2T2[2c2g4U6_6c8v8z:a;YQ+P%gQ+p&OQ+s&PQ+}&VQ.Y(fQ1R+zU1V,O,P,QQ2z.ZQ5c1SS5g1W1XS7t4|5QQ8^5hU9s7z8P8QU:x9t9v9wQ;e:yQ;u;f!z=y#s$a$b$v$y)p)|*Z*}+Q+o+r.W/b/d0t0w1P2x3z4S4a4c5a6m7T7^8V9P9{:g:};^<s<u<w=O=Q=S=W=Y=^>R>Sg=z<n<o<t<v<x=P=R=T=X=Z=_W$}i%P*k=uS&O!O&[Q&P!PQ&Q!QR+n%|$Z$|i#s#u$a$b$v$y%U%V%Z)p)y){)|*T*Z*i*j*}+Q+o+r.W.b/a/b/d0P0t0w1P2x3p3z4S4Y4a4c5a6m7T7^8V9P9[9{:g:};^<n<o<s<t<u<v<w<x=O=P=Q=R=S=T=W=X=Y=Z=^=_=u=}>O>R>ST)q$s)rV*o%T<q<rU&}!c%x,{S(t#w#xQ+b%rS.S(b(cQ0x+tQ4Z/|R7p4x'QkOPWXYZrstu!X!^!l#Q#U#X#b#l#r#v#y#|#}$O$P$Q$R$S$T$U$V$W$Y$_$c$k%^%d%q&^&a&b&e&g&h&j&n&v&z'T'h'x'z(Q([(m(q(u)i)t*v+O+j,[,`,e,q,t-U-^-r-{.X.e.l.t/}0S0a1Q1b1c1d1f1j1m1o2O2`2o2y3R3h4z4}5b5t5v5w6Q6Z6p8O8Y8g8s9k:Y:^;V;m;z<W<Z<[<]<`<a<b<c<d<e<f<g<h<i<j<k<l<p<y<z<{<}=U=V=[=]=x$q$^c#W#c%b%c%e'w'}(i(p(x(y(z({(|(})O)P)Q)R)S)U)X)])g*{+a,v-k-p-u-z.a.g.k.m.n.o/O0Q1y1|2^2n3Q3V3W3X3Y3Z3[3]3^3_3`3a3b3c3f3g3l4_4f6S6Y6h6s6t6y6z7r8m8q9T9X9Y:[:r;R;T;k;x<R<Y=lT#RV#S'RkOPWXYZrstu!X!^!l#Q#U#X#b#l#r#v#y#|#}$O$P$Q$R$S$T$U$V$W$Y$_$c$k%^%d%q&^&a&b&e&g&h&j&n&v&z'T'h'x'z(Q([(m(q(u)i)t*v+O+j,[,`,e,q,t-U-^-r-{.X.e.l.t/}0S0a1Q1b1c1d1f1j1m1o2O2`2o2y3R3h4z4}5b5t5v5w6Q6Z6p8O8Y8g8s9k:Y:^;V;m;z<W<Z<[<]<`<a<b<c<d<e<f<g<h<i<j<k<l<p<y<z<{<}=U=V=[=]=xQ&{!cR2P,x#f!kQ!c!m!p!r!s!t!u!v!w!x&y'Q'R'^'_'`'a'b'c'd,x-O-Q-b-d-e-f-g-h2e2h2i2j2k5O5W5X5[6a6d6e6f7v7w7x7y8x8{8|9p9q9r:c:u:v;bS*]$z*cS/k*^*eQ/t*fQ0z+vQ4U/sQ4X/vS4|0}5US7z5R5]S8P5Y5ZS9t8R8SQ9v8TS:y9u9xR;f:zlpOXr!X#b%^&e&g&h&j,`,e1j1mQ&l![Q'l!tS(h#r<`Q+T%jQ+x&RQ+y&SQ-V'VQ-j'eS.`(m<{S0R*v=UQ0^+UQ0|+wQ1q,gQ1s,hQ1{,sQ2Y-WQ2]-[S4`0S=[Q4d0_S4g0a=]Q6R1}Q6V2ZQ6[2bQ7e4eQ8n6TQ8o6WQ8r6]Q:X8kQ:]8tQ;U:_Q;l;WR;y;n$l$]c#W#c%c%e'w'}(i(p(x(y(z({(|(})O)P)Q)R)S)U)X)])g*{+a,v-k-p-u-z.a.g.k.n.o/O0Q1y1|2^2n3Q3V3W3X3Y3Z3[3]3^3_3`3a3b3c3f3g3l4_4f6S6Y6h6s6t6y6z7r8m8q9T9X9Y:[:r;R;T;k;x<R<Y=lS(e#m'[U*h${(l3eS*z%b.mQ2v0WQ6l2uQ9R6oR:h9S$l$[c#W#c%c%e'w'}(i(p(x(y(z({(|(})O)P)Q)R)S)U)X)])g*{+a,v-k-p-u-z.a.g.k.n.o/O0Q1y1|2^2n3Q3V3W3X3Y3Z3[3]3^3_3`3a3b3c3f3g3l4_4f6S6Y6h6s6t6y6z7r8m8q9T9X9Y:[:r;R;T;k;x<R<Y=lS(d#m'[S(v#x$]S*y%b.mS.T(c(eQ.p)WQ0T*zR2s.U'QkOPWXYZrstu!X!^!l#Q#U#X#b#l#r#v#y#|#}$O$P$Q$R$S$T$U$V$W$Y$_$c$k%^%d%q&^&a&b&e&g&h&j&n&v&z'T'h'x'z(Q([(m(q(u)i)t*v+O+j,[,`,e,q,t-U-^-r-{.X.e.l.t/}0S0a1Q1b1c1d1f1j1m1o2O2`2o2y3R3h4z4}5b5t5v5w6Q6Z6p8O8Y8g8s9k:Y:^;V;m;z<W<Z<[<]<`<a<b<c<d<e<f<g<h<i<j<k<l<p<y<z<{<}=U=V=[=]=xS#n]<XQ&g!VQ&h!WQ&j!YQ&k!ZR1i,cQ'S!eQ*|%gQ-T'US.V(f+PQ2W-SW2w.Y.Z0V0XQ6U2XU6k2t2v2zS9O6l6nS:f9Q9RS;[:e:hQ;p;]R;{;qV!qQ'R-Q!_^OQXZ_r!T!X!m#b#e%[%^&[&^&e&g&h&j'R(_,`,e-Q-}0}1j1m5O5UT#n]<X%^yOPWXYZrstu!X!^!l#Q#U#X#b#l#r#v#y#|#}$O$P$Q$R$S$T$U$V$W$_$c%^%d%q&^&a&b&e&g&h&j&n&v'T'h'x'z(Q([(m(q(u)t*v+O+j,[,`,e-U-^-r-{.X.e.l/}0S0a1Q1b1c1d1f1j1m1o2`2o2y3R4}5b5t5v5w6Z6p8O8Y8g8s:^;V;m;zS(t#w#xS.S(b(c!s=c$Y$k&z)i,q,t.t2O3h4z6Q9k:Y<W<Z<[<]<`<a<b<c<d<e<f<g<h<i<j<k<l<p<y<z<{<}=U=V=[=]=xU!oQ'R-Q[']!m!s!t!u!v!wS'k!p!rY'm!x5O5W5X5[S-a'^'_W-c'`'a'b'cY-i'd7v7w7x7yS2c-b-dW2f-e9p9q9rU2g-f-g-hS5Q0}5US6_2e2hU6b2i:u:vS6c2j2kS7z5R5]S8Q5Y5ZS8v6a6dS8y6e;bQ8z6fS9t8R8SQ9w8TS:a8x8{Q:d8|S:y9u9xQ;Y:cR;f:zU!qQ'R-QT5S0}5UU'j!o5P5QS(^#f1gU-`']'m8QQ/]*QQ/i*]U2d-c-i9wQ3v/^S4P/j/tS6`2f2gQ7P3qS7[4V4XS8w6b6cQ9^7QQ9e7_S:b8y8zR;Z:dQ#tbU'i!o5P5QS(]#f1gQ*w%]Q+R%hQ+X%nW-_']'j'm8QQ-|(^Q/[*QQ/h*]Q/n*`Q0]+SQ1T+|W2a-`-c-i9wS3u/]/^S4O/i/tQ4R/mQ4T/oQ5e1UU6^2d2f2gQ7O3qQ7S3vS7W4P4XQ7]4WQ8[5fU8u6`6b6cS9]7P7QQ9a7XQ9c7[Q9n7sQ:O8]U:`8w8y8zQ:l9^Q:m9bQ:o9eQ:t9oQ;P:PS;X:b:dQ;`:nQ;c:wQ;o;ZQ;s;dQ<O;tQ<T<PQ=f=aQ=q=jR=r=k%^aOPWXYZrstu!X!^!l#Q#U#X#b#l#r#v#y#|#}$O$P$Q$R$S$T$U$V$W$_$c%^%d%q&^&a&b&e&g&h&j&n&v'T'h'x'z(Q([(m(q(u)t*v+O+j,[,`,e-U-^-r-{.X.e.l/}0S0a1Q1b1c1d1f1j1m1o2`2o2y3R4}5b5t5v5w6Z6p8O8Y8g8s:^;V;m;zS#tx!g!r=`$Y$k&z)i,q,t.t2O3h4z6Q9k:Y<W<Z<[<]<`<a<b<c<d<e<f<g<h<i<j<k<l<p<y<z<{<}=U=V=[=]=xR=f=w%^bOPWXYZrstu!X!^!l#Q#U#X#b#l#r#v#y#|#}$O$P$Q$R$S$T$U$V$W$_$c%^%d%q&^&a&b&e&g&h&j&n&v'T'h'x'z(Q([(m(q(u)t*v+O+j,[,`,e-U-^-r-{.X.e.l/}0S0a1Q1b1c1d1f1j1m1o2`2o2y3R4}5b5t5v5w6Z6p8O8Y8g8s:^;V;m;zQ%]j!d%hw!f!o%k%l%m&x'W'X'Y']'k*]+V+W,u-X-Y-a-c/k0`2T2[2c2g4U6_6c8v8z:a;YS%nx!gQ+S%iQ+|&VW1U+},O,P,QU5f1V1W1XS7s4|5QS8]5g5hW9o7t7z8P8QQ:P8^W:w9s9t9v9wS;d:x:yS;t;e;fQ<P;u!r=a$Y$k&z)i,q,t.t2O3h4z6Q9k:Y<W<Z<[<]<`<a<b<c<d<e<f<g<h<i<j<k<l<p<y<z<{<}=U=V=[=]=xQ=j=vR=k=w%QeOPXYrstu!X!^!l#Q#b#l#r#v#y#|#}$O$P$Q$R$S$T$U$V$W$_$c%^%d%q&^&a&e&g&h&j&n&v'T'h'z(Q([(m(q(u)t*v+O+j,[,`,e-U-^-r-{.X.e.l/}0S0a1Q1b1c1d1f1j1m1o2`2o2y3R4}5b5t5v5w6Z6p8O8Y8g8s:^;V;m;zY#`WZ#U#X'x!U%y|}#e#g#j%[%w(R(Y(Z(_+h+i+k,^,r-v-y-}.O.Q1r2q2r6P6jQ,Z&b!p=b$Y$k)i,q,t.t2O3h4z6Q9k:Y<W<Z<[<]<`<a<b<c<d<e<f<g<h<i<j<k<l<p<y<z<{<}=U=V=[=]=xR=e&zS'O!c%xR2R,{%SdOPWXYZrstu!X!^!l#Q#U#X#b#l#r#v#y#|#}$O$P$Q$R$S$T$U$V$W$_$c%^%d%q&^&a&e&g&h&j&n&v'T'h'x'z(Q([(m(q(u)t*v+j,[,`,e-U-^-r-{.e.l/}0S0a1Q1b1c1d1f1j1m1o2`2o3R4}5b5t5v5w6Z8O8Y8g8s:^;V;m;z!r)V$Y$k&z)i,q,t.t2O3h4z6Q9k:Y<W<Z<[<]<`<a<b<c<d<e<f<g<h<i<j<k<l<p<y<z<{<}=U=V=[=]=xQ,Y&bQ0W+OQ2u.XQ6o2yR9S6p!n$Sc#W%b'w'}(i(p)P)Q)R)S)X)]+a-k-p-u-z.a.g/O0Q2^2n3Q3c4_4f6Y6h6s8q:[;T;k;x<R<Y!T<g)U)g,v.m1y1|3V3_3`3a3b3f3l6S6t6y6z7r8m9T9X9Y:r;R=l!j$Uc#W%b'w'}(i(p)R)S)X)]+a-k-p-u-z.a.g/O0Q2^2n3Q3c4_4f6Y6h6s8q:[;T;k;x<R<Y!P<i)U)g,v.m1y1|3V3a3b3f3l6S6t6y6z7r8m9T9X9Y:r;R=l!f$Yc#W%b'w'}(i(p)X)]+a-k-p-u-z.a.g/O0Q2^2n3Q3c4_4f6Y6h6s8q:[;T;k;x<R<YQ3p/Wz=x)U)g,v.m1y1|3V3f3l6S6t6y6z7r8m9T9X9Y:r;R=lQ=}>PR>O>Q'QkOPWXYZrstu!X!^!l#Q#U#X#b#l#r#v#y#|#}$O$P$Q$R$S$T$U$V$W$Y$_$c$k%^%d%q&^&a&b&e&g&h&j&n&v&z'T'h'x'z(Q([(m(q(u)i)t*v+O+j,[,`,e,q,t-U-^-r-{.X.e.l.t/}0S0a1Q1b1c1d1f1j1m1o2O2`2o2y3R3h4z4}5b5t5v5w6Q6Z6p8O8Y8g8s9k:Y:^;V;m;z<W<Z<[<]<`<a<b<c<d<e<f<g<h<i<j<k<l<p<y<z<{<}=U=V=[=]=xS$lh$mR3i.s'XgOPWXYZhrstu!X!^!l#Q#U#X#b#l#r#v#y#|#}$O$P$Q$R$S$T$U$V$W$Y$_$c$k$m%^%d%q&^&a&b&e&g&h&j&n&v&z'T'h'x'z(Q([(m(q(u)i)t*v+O+j,[,`,e,q,t-U-^-r-{.X.e.l.s.t/}0S0a1Q1b1c1d1f1j1m1o2O2`2o2y3R3h4z4}5b5t5v5w6Q6Z6p8O8Y8g8s9k:Y:^;V;m;z<W<Z<[<]<`<a<b<c<d<e<f<g<h<i<j<k<l<p<y<z<{<}=U=V=[=]=xT$hf$nQ$ffS)`$i)dR)l$nT$gf$nT)b$i)d'XhOPWXYZhrstu!X!^!l#Q#U#X#b#l#r#v#y#|#}$O$P$Q$R$S$T$U$V$W$Y$_$c$k$m%^%d%q&^&a&b&e&g&h&j&n&v&z'T'h'x'z(Q([(m(q(u)i)t*v+O+j,[,`,e,q,t-U-^-r-{.X.e.l.s.t/}0S0a1Q1b1c1d1f1j1m1o2O2`2o2y3R3h4z4}5b5t5v5w6Q6Z6p8O8Y8g8s9k:Y:^;V;m;z<W<Z<[<]<`<a<b<c<d<e<f<g<h<i<j<k<l<p<y<z<{<}=U=V=[=]=xT$lh$mQ$ohR)k$m%^jOPWXYZrstu!X!^!l#Q#U#X#b#l#r#v#y#|#}$O$P$Q$R$S$T$U$V$W$_$c%^%d%q&^&a&b&e&g&h&j&n&v'T'h'x'z(Q([(m(q(u)t*v+O+j,[,`,e-U-^-r-{.X.e.l/}0S0a1Q1b1c1d1f1j1m1o2`2o2y3R4}5b5t5v5w6Z6p8O8Y8g8s:^;V;m;z!s=v$Y$k&z)i,q,t.t2O3h4z6Q9k:Y<W<Z<[<]<`<a<b<c<d<e<f<g<h<i<j<k<l<p<y<z<{<}=U=V=[=]=x#alOPXZr!X!^!l#Q#b#l#y$k%^&^&a&b&e&g&h&j&n&v'T(u)i+O+j,[,`,e-U.X.t/}1Q1b1c1d1f1j1m1o2y3h4}5b5t5v5w6p8O8Y8gv${i#u%U%V%Z)y){*T*i*j.b/a0P3p4Y9[=u=}>O!z(l#s$a$b$v$y)p)|*Z*}+Q+o+r.W/b/d0t0w1P2x3z4S4a4c5a6m7T7^8V9P9{:g:};^<s<u<w=O=Q=S=W=Y=^>R>SQ*s%XQ/P)ug3e<n<o<t<v<x=P=R=T=X=Z=_v$wi#u%U%V%Z)y){*T*i*j.b/a0P3p4Y9[=u=}>OQ*V$xS*`$z*cQ*t%YQ/o*a!z=h#s$a$b$v$y)p)|*Z*}+Q+o+r.W/b/d0t0w1P2x3z4S4a4c5a6m7T7^8V9P9{:g:};^<s<u<w=O=Q=S=W=Y=^>R>Sf=i<n<o<t<v<x=P=R=T=X=Z=_Q=m=yQ=n=zQ=o={R=p=|v${i#u%U%V%Z)y){*T*i*j.b/a0P3p4Y9[=u=}>O!z(l#s$a$b$v$y)p)|*Z*}+Q+o+r.W/b/d0t0w1P2x3z4S4a4c5a6m7T7^8V9P9{:g:};^<s<u<w=O=Q=S=W=Y=^>R>Sg3e<n<o<t<v<x=P=R=T=X=Z=_lnOXr!X#b%^&e&g&h&j,`,e1j1mQ*Y$yQ,n&qQ,o&sR3y/b$Y$|i#s#u$a$b$v$y%U%V%Z)p)y){)|*T*Z*i*j*}+Q+o+r.W.b/a/b/d0P0t0w1P2x3p3z4S4Y4a4c5a6m7T7^8V9P9[9{:g:};^<n<o<s<t<u<v<w<x=O=P=Q=R=S=T=W=X=Y=Z=^=_=u=}>O>R>SQ+q&PQ0v+sQ4v0uR7o4wT*b$z*cS*b$z*cT5T0}5US/m*_4}T4W/u8OQ+R%hQ/n*`Q0]+SQ1T+|Q5e1UQ8[5fQ9n7sQ:O8]Q:t9oQ;P:PQ;c:wQ;s;dQ<O;tR<T<Pn)y$t(n*u/`/w/x3O3w4^6}7`:k=g=s=t!W=O(j)Z*P*X._.{/W/e0U0s0u2}3x3|4u4w6q6r7U7Y7b7d9`9d;_>P>Q]=P3d6x9U:i:j;|p){$t(n*u/U/`/w/x3O3w4^6}7`:k=g=s=t!Y=Q(j)Z*P*X._.{/W/e0U0s0u2{2}3x3|4u4w6q6r7U7Y7b7d9`9d;_>P>Q_=R3d6x9U9V:i:j;|pmOXr!T!X#b%^&[&e&g&h&j,`,e1j1mQ&X!SR,[&bpmOXr!T!X#b%^&[&e&g&h&j,`,e1j1mR&X!SQ+u&QR0r+nqmOXr!T!X#b%^&[&e&g&h&j,`,e1j1mQ1O+zS5`1R1SU8U5^5_5cS9z8W8XS:{9y9|Q;g:|R;v;hQ&`!TR,U&[R5l1[S%pz%uR0h+_Q&e!UR,`&fR,f&kT1k,e1mR,j&lQ,i&lR1t,jQ'o!yR-l'oQrOQ#bXT%ar#bQ!|TR'q!|Q#PUR's#PQ)r$sR.|)rQ#SVR'u#SQ#VWU'{#V'|-sQ'|#WR-s'}Q,y&{R2Q,yQ.c(nR3P.cQ.f(pS3S.f3TR3T.gQ-Q'RR2U-Qr_OXr!T!X#b%^&[&^&e&g&h&j,`,e1j1mU!mQ'R-QS#eZ%[Y#o_!m#e-}5OQ-}(_T5O0}5US#]W%wU(S#](T-tQ(T#^R-t(OQ,|'OR2S,|Q(`#hQ-w(XW.R(`-w2l6gQ2l-xR6g2mQ)d$iR.u)dQ$mhR)j$mQ$`cU)Y$`-o<mQ-o<YR<m)gQ/Z*QW3s/Z3t7R9_U3t/[/]/^S7R3u3vR9_7S#m)w$t(j(n)Z*P*X*p*q*u.].^._.{/U/V/W/`/e/w/x0U0s0u2{2|2}3O3d3w3x3|4^4u4w6q6r6v6w6x6}7U7Y7`7b7d9U9V9W9`9d:i:j:k;_;|=g=s=t>P>QQ/c*XU3{/c3}7VQ3}/eR7V3|Q*c$zR/q*cQ*l%OR/z*lQ4b0UR7c4bQ+l%zR0q+lQ4y0xS7q4y9lR9l7rQ+w&RR0{+wQ5U0}R7|5UQ1Z,RS5j1Z8`R8`5lQ0c+ZW4k0c4m7i9hQ4m0fQ7i4lR9h7jQ+`%pR0i+`Q1m,eR5z1mWqOXr#bQ&i!XQ*x%^Q,_&eQ,a&gQ,b&hQ,d&jQ1h,`S1k,e1mR5y1jQ%`oQ&m!]Q&p!_Q&r!`Q&t!aU'g!o5P5QQ+T%jQ+g%vQ+m%{Q,T&`Q,l&oY-]']'i'j'm8QQ-j'eQ/p*bQ0^+US1^,U,XQ1u,kQ1v,nQ1w,oQ2]-[[2_-_-`-c-i-k9wQ4d0_Q4p0lQ4t0sQ5d1TQ5n1`Q5x1iY6X2^2a2d2f2gQ6[2bQ7e4eQ7m4rQ7n4uQ7{5TQ8Z5eQ8a5mY8p6Y6^6`6b6cQ8r6]Q9i7kQ9m7sQ9}8[Q:S8bY:Z8q8u8w8y8zQ:]8tQ:q9jS:s9n9oQ;O:OW;S:[:`:b:dQ;U:_S;a:t:wQ;i;PU;j;T;X;ZQ;l;WS;r;c;dS;w;k;oQ;y;nS;};s;tQ<Q;xS<S<O<PQ<U<RR<V<TQ%jwQ'V!fQ'e!oU+U%k%l%mQ,s&xU-W'W'X'YS-[']'kQ/g*]S0_+V+WQ1},uS2Z-X-YS2b-a-cQ4Q/kQ4e0`Q6T2TQ6W2[S6]2c2gQ7Z4US8t6_6cS:_8v8zQ;W:aR;n;YS$ui=uR*m%PU%Oi%P=uR/y*kQ$tiS(j#s+QQ(n#uS)Z$a$bQ*P$vQ*X$yQ*p%UQ*q%VQ*u%ZQ.]<sQ.^<uQ._<wQ.{)pQ/U)yQ/V){Q/W)|Q/`*TQ/e*ZQ/w*iQ/x*jh0U*}.W1P2x5a6m8V9P9{:g:};^Q0s+oQ0u+rQ2{=OQ2|=QQ2}=SQ3O.bS3d<n<oQ3w/aQ3x/bQ3|/dQ4^0PQ4u0tQ4w0wQ6q=WQ6r=YQ6v<tQ6w<vQ6x<xQ6}3pQ7U3zQ7Y4SQ7`4YQ7b4aQ7d4cQ9U=TQ9V=PQ9W=RQ9`7TQ9d7^Q:i=XQ:j=ZQ:k9[Q;_=^Q;|=_Q=g=uQ=s=}Q=t>OQ>P>RR>Q>SloOXr!X#b%^&e&g&h&j,`,e1j1mQ!dPS#dZ#lQ&o!^U'Z!l4}8OQ't#QQ(w#yQ)h$kS,X&^&aQ,]&bQ,k&nQ,p&vQ-S'TQ.i(uQ.y)iQ0X+OQ0o+jQ1e,[Q2X-UQ2v.XQ3k.tQ4[/}Q5_1QQ5p1bQ5q1cQ5s1dQ5u1fQ5|1oQ6l2yQ6{3hQ8X5bQ8f5tQ8h5vQ8i5wQ9R6pQ9|8YR:U8g#UcOPXZr!X!^!l#b#l#y%^&^&a&b&e&g&h&j&n&v'T(u+O+j,[,`,e-U.X/}1Q1b1c1d1f1j1m1o2y4}5b5t5v5w6p8O8Y8gQ#WWQ#cYQ%bsQ%ctQ%euS'w#U'zQ'}#XQ(i#rQ(p#vQ(x#|Q(y#}Q(z$OQ({$PQ(|$QQ(}$RQ)O$SQ)P$TQ)Q$UQ)R$VQ)S$WQ)U$YQ)X$_Q)]$cW)g$k)i.t3hQ*{%dQ+a%qS,v&z2OQ-k'hS-p'x-rQ-u(QQ-z([Q.a(mQ.g(qQ.k<WQ.m<ZQ.n<[Q.o<]Q/O)tQ0Q*vQ1y,qQ1|,tQ2^-^Q2n-{Q3Q.eQ3V<`Q3W<aQ3X<bQ3Y<cQ3Z<dQ3[<eQ3]<fQ3^<gQ3_<hQ3`<iQ3a<jQ3b<kQ3c.lQ3f<pQ3g<yQ3l<lQ4_0SQ4f0aQ6S<zQ6Y2`Q6h2oQ6s3RQ6t<{Q6y<}Q6z=UQ7r4zQ8m6QQ8q6ZQ9T=VQ9X=[Q9Y=]Q:[8sQ:r9kQ;R:YQ;T:^Q;k;VQ;x;mQ<R;zQ<Y#QR=l=xR#YWR&|!cU!oQ'R-QS&x!c,x[']!m!s!t!u!v!wS'k!p!r^'m!x5O5W5X5Y5Z5[S,u&y'QS-a'^'_W-c'`'a'b'c[-i'd7v7w7x7y8TQ2T-OS2c-b-dW2f-e9p9q9rU2g-f-g-hS5P0}5US6_2e2hU6b2i:u:vS6c2j2kS8v6a6dS8y6e;bQ8z6fS:a8x8{Q:d8|R;Y:cR(o#uR(r#vQ!dQT-P'R-QQ#m]R'[<XT#iZ%[S#hZ%[U%z|},^U(X#e#g#jS-x(Y(ZQ.P(_Q0p+kQ2m-yU2p-}.O.QS6i2q2rR8}6j`#[W#U#X%w'x(R+h-vt#fZ|}#e#g#j%[(Y(Z(_+k-y-}.O.Q2q2r6jQ1g,^Q1z,rQ6O1rQ8l6PT=d&z+iT#_W%wS#^W%wS'y#U(RS(O#X+hS,w&z+iT-q'x-vT'P!c%xQ$ifR)n$nT)c$i)dR3j.sT*S$v*UR*[$yQ0V*}Q2t.WQ5^1PQ6n2xQ8W5aQ9Q6mQ9y8VQ:e9PQ:|9{Q;]:gQ;h:}R;q;^lpOXr!X#b%^&e&g&h&j,`,e1j1mQ&_!TR,T&[V%{|},^R0y+tR,S&YQ%tzR+f%uR+[%oT&c!U&fT&d!U&fT1l,e1m",nodeNames:"\u26A0 ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody MethodDeclaration AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:363,context:mg,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,226,228,234,236,238,240,243,249,255,257,259,261,263,265,266,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"]],propSources:[yg],skippedNodes:[0,3,4,269],repeatNodeCount:32,tokenData:"$>y(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tu>PuvBavwDxwxGgxyMvyz! Qz{!![{|!%O|}!&]}!O!%O!O!P!'g!P!Q!1w!Q!R#0t!R![#3T![!]#@T!]!^#Aa!^!_#Bk!_!`#GS!`!a#In!a!b#N{!b!c$$z!c!}>P!}#O$&U#O#P$'`#P#Q$,w#Q#R$.R#R#S>P#S#T$/`#T#o$0j#o#p$4z#p#q$5p#q#r$7Q#r#s$8^#s$f%Z$f$g+g$g#BY>P#BY#BZ$9h#BZ$IS>P$IS$I_$9h$I_$I|>P$I|$I}$<s$I}$JO$<s$JO$JT>P$JT$JU$9h$JU$KV>P$KV$KW$9h$KW&FU>P&FU&FV$9h&FV;'S>P;'S;=`BZ<%l?HT>P?HT?HU$9h?HUO>P(n%d_$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$d&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$d&j'z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU'z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$d&j'wpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU'wpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX'wp'z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z(CS+rq$d&j'wp'z!b'm(;dOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z(CS.ST'x#S$d&j'n(;dO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c(CS.n_$d&j'wp'z!b'n(;dOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#`/x`$d&j!l$Ip'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S1V`#q$Id$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S2d_#q$Id$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$2b3l_'v$(n$d&j'z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k*r4r_$d&j'z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k)`5vX$d&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q)`6jT$_#t$d&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c#t6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y#t7bO$_#t#t7eP;=`<%l6y)`7kP;=`<%l5q*r7w]$_#t$d&j'z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}%W8uZ'z!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p%W9oU$_#t'z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}%W:UP;=`<%l8p*r:[P;=`<%l4k#%|:hg$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}st%Ztu<Puw%Zwx(rx!^%Z!^!_*g!_!c%Z!c!}<P!}#O%Z#O#P&c#P#R%Z#R#S<P#S#T%Z#T#o<P#o#p*g#p$g%Z$g;'S<P;'S;=`=y<%lO<P#%|<[i$d&j(`!L^'wp'z!bOY%ZYZ&cZr%Zrs&}st%Ztu<Puw%Zwx(rx!Q%Z!Q![<P![!^%Z!^!_*g!_!c%Z!c!}<P!}#O%Z#O#P&c#P#R%Z#R#S<P#S#T%Z#T#o<P#o#p*g#p$g%Z$g;'S<P;'S;=`=y<%lO<P#%|=|P;=`<%l<P(CS>`k$d&j'wp'z!b(U!LY't&;d$W#tOY%ZYZ&cZr%Zrs&}st%Ztu>Puw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![>P![!^%Z!^!_*g!_!c%Z!c!}>P!}#O%Z#O#P&c#P#R%Z#R#S>P#S#T%Z#T#o>P#o#p*g#p$g%Z$g;'S>P;'S;=`BZ<%lO>P+d@`k$d&j'wp'z!b$W#tOY%ZYZ&cZr%Zrs&}st%Ztu@Tuw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![@T![!^%Z!^!_*g!_!c%Z!c!}@T!}#O%Z#O#P&c#P#R%Z#R#S@T#S#T%Z#T#o@T#o#p*g#p$g%Z$g;'S@T;'S;=`BT<%lO@T+dBWP;=`<%l@T(CSB^P;=`<%l>P%#SBl`$d&j'wp'z!b#i$IdOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Cn!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#SCy_$d&j#{$Id'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%DfETa(i%<v$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sv%ZvwFYwx(rx!^%Z!^!_*g!_!`Cn!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#SFe`$d&j#u$Id'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Cn!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$2bGp_'y$)`$d&j'wpOYHoYZIuZrHorsIuswHowxKVx!^Ho!^!_LX!_#OHo#O#PIu#P#oHo#o#pLX#p;'SHo;'S;=`Mp<%lOHo*QHv_$d&j'wpOYHoYZIuZrHorsIuswHowxKVx!^Ho!^!_LX!_#OHo#O#PIu#P#oHo#o#pLX#p;'SHo;'S;=`Mp<%lOHo)`IzX$d&jOwIuwx6cx!^Iu!^!_Jg!_#oIu#o#pJg#p;'SIu;'S;=`KP<%lOIu#tJjTOwJgwx7]x;'SJg;'S;=`Jy<%lOJg#tJ|P;=`<%lJg)`KSP;=`<%lIu*QK`]$_#t$d&j'wpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(r$fL^Z'wpOYLXYZJgZrLXrsJgswLXwxMPx#OLX#O#PJg#P;'SLX;'S;=`Mj<%lOLX$fMWU$_#t'wpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)r$fMmP;=`<%lLX*QMsP;=`<%lHo(*QNR_!h(!b$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z!'l! ]_!gM|$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'+h!!ib$d&j'wp'z!b'u#)d#j$IdOY%ZYZ&cZr%Zrs&}sw%Zwx(rxz%Zz{!#q{!^%Z!^!_*g!_!`Cn!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S!#|`$d&j'wp'z!b#g$IdOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Cn!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&-O!%Z`$d&j'wp'z!bk&%`OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Cn!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&C[!&h_!V&;l$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(CS!'rc$d&j'wp'z!by'<nOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!O%Z!O!P!(}!P!Q%Z!Q![!+g![!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z!'d!)Wa$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!O%Z!O!P!*]!P!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z!'d!*h_!UMt$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l!+rg$d&j'wp'z!bl$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![!+g![!^%Z!^!_*g!_!g%Z!g!h!-Z!h#O%Z#O#P&c#P#R%Z#R#S!+g#S#X%Z#X#Y!-Z#Y#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l!-dg$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx{%Z{|!.{|}%Z}!O!.{!O!Q%Z!Q![!0a![!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S!0a#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l!/Uc$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![!0a![!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S!0a#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l!0lc$d&j'wp'z!bl$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![!0a![!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S!0a#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(CS!2Sf$d&j'wp'z!b#h$IdOY!3hYZ&cZr!3hrs!4{sw!3hwx!C}xz!3hz{#$s{!P!3h!P!Q#&Y!Q!^!3h!^!_!Mh!_!`#-x!`!a#/_!a!}!3h!}#O##[#O#P!<w#P#o!3h#o#p!Mh#p;'S!3h;'S;=`#$m<%lO!3h(r!3sb$d&j'wp'z!b!RSOY!3hYZ&cZr!3hrs!4{sw!3hwx!C}x!P!3h!P!Q!Kh!Q!^!3h!^!_!Mh!_!}!3h!}#O##[#O#P!<w#P#o!3h#o#p!Mh#p;'S!3h;'S;=`#$m<%lO!3h(Q!5U`$d&j'z!b!RSOY!4{YZ&cZw!4{wx!6Wx!P!4{!P!Q!=o!Q!^!4{!^!_!?g!_!}!4{!}#O!Bn#O#P!<w#P#o!4{#o#p!?g#p;'S!4{;'S;=`!Cw<%lO!4{&n!6_^$d&j!RSOY!6WYZ&cZ!P!6W!P!Q!7Z!Q!^!6W!^!_!8g!_!}!6W!}#O!;U#O#P!<w#P#o!6W#o#p!8g#p;'S!6W;'S;=`!=i<%lO!6W&n!7ba$d&j!RSO!^&c!_#Z&c#Z#[!7Z#[#]&c#]#^!7Z#^#a&c#a#b!7Z#b#g&c#g#h!7Z#h#i&c#i#j!7Z#j#m&c#m#n!7Z#n#o&c#p;'S&c;'S;=`&w<%lO&cS!8lX!RSOY!8gZ!P!8g!P!Q!9X!Q!}!8g!}#O!9p#O#P!:o#P;'S!8g;'S;=`!;O<%lO!8gS!9^U!RS#Z#[!9X#]#^!9X#a#b!9X#g#h!9X#i#j!9X#m#n!9XS!9sVOY!9pZ#O!9p#O#P!:Y#P#Q!8g#Q;'S!9p;'S;=`!:i<%lO!9pS!:]SOY!9pZ;'S!9p;'S;=`!:i<%lO!9pS!:lP;=`<%l!9pS!:rSOY!8gZ;'S!8g;'S;=`!;O<%lO!8gS!;RP;=`<%l!8g&n!;Z[$d&jOY!;UYZ&cZ!^!;U!^!_!9p!_#O!;U#O#P!<P#P#Q!6W#Q#o!;U#o#p!9p#p;'S!;U;'S;=`!<q<%lO!;U&n!<UX$d&jOY!;UYZ&cZ!^!;U!^!_!9p!_#o!;U#o#p!9p#p;'S!;U;'S;=`!<q<%lO!;U&n!<tP;=`<%l!;U&n!<|X$d&jOY!6WYZ&cZ!^!6W!^!_!8g!_#o!6W#o#p!8g#p;'S!6W;'S;=`!=i<%lO!6W&n!=lP;=`<%l!6W(Q!=xi$d&j'z!b!RSOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#Z&}#Z#[!=o#[#]&}#]#^!=o#^#a&}#a#b!=o#b#g&}#g#h!=o#h#i&}#i#j!=o#j#m&}#m#n!=o#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!f!?nZ'z!b!RSOY!?gZw!?gwx!8gx!P!?g!P!Q!@a!Q!}!?g!}#O!Ap#O#P!:o#P;'S!?g;'S;=`!Bh<%lO!?g!f!@hb'z!b!RSOY'}Zw'}x#O'}#P#Z'}#Z#[!@a#[#]'}#]#^!@a#^#a'}#a#b!@a#b#g'}#g#h!@a#h#i'}#i#j!@a#j#m'}#m#n!@a#n;'S'};'S;=`(f<%lO'}!f!AuX'z!bOY!ApZw!Apwx!9px#O!Ap#O#P!:Y#P#Q!?g#Q;'S!Ap;'S;=`!Bb<%lO!Ap!f!BeP;=`<%l!Ap!f!BkP;=`<%l!?g(Q!Bu^$d&j'z!bOY!BnYZ&cZw!Bnwx!;Ux!^!Bn!^!_!Ap!_#O!Bn#O#P!<P#P#Q!4{#Q#o!Bn#o#p!Ap#p;'S!Bn;'S;=`!Cq<%lO!Bn(Q!CtP;=`<%l!Bn(Q!CzP;=`<%l!4{'`!DW`$d&j'wp!RSOY!C}YZ&cZr!C}rs!6Ws!P!C}!P!Q!EY!Q!^!C}!^!_!GQ!_!}!C}!}#O!JX#O#P!<w#P#o!C}#o#p!GQ#p;'S!C};'S;=`!Kb<%lO!C}'`!Eci$d&j'wp!RSOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#Z(r#Z#[!EY#[#](r#]#^!EY#^#a(r#a#b!EY#b#g(r#g#h!EY#h#i(r#i#j!EY#j#m(r#m#n!EY#n#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rt!GXZ'wp!RSOY!GQZr!GQrs!8gs!P!GQ!P!Q!Gz!Q!}!GQ!}#O!IZ#O#P!:o#P;'S!GQ;'S;=`!JR<%lO!GQt!HRb'wp!RSOY)rZr)rs#O)r#P#Z)r#Z#[!Gz#[#])r#]#^!Gz#^#a)r#a#b!Gz#b#g)r#g#h!Gz#h#i)r#i#j!Gz#j#m)r#m#n!Gz#n;'S)r;'S;=`*Z<%lO)rt!I`X'wpOY!IZZr!IZrs!9ps#O!IZ#O#P!:Y#P#Q!GQ#Q;'S!IZ;'S;=`!I{<%lO!IZt!JOP;=`<%l!IZt!JUP;=`<%l!GQ'`!J`^$d&j'wpOY!JXYZ&cZr!JXrs!;Us!^!JX!^!_!IZ!_#O!JX#O#P!<P#P#Q!C}#Q#o!JX#o#p!IZ#p;'S!JX;'S;=`!K[<%lO!JX'`!K_P;=`<%l!JX'`!KeP;=`<%l!C}(r!Ksk$d&j'wp'z!b!RSOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#Z%Z#Z#[!Kh#[#]%Z#]#^!Kh#^#a%Z#a#b!Kh#b#g%Z#g#h!Kh#h#i%Z#i#j!Kh#j#m%Z#m#n!Kh#n#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z#W!Mq]'wp'z!b!RSOY!MhZr!Mhrs!?gsw!Mhwx!GQx!P!Mh!P!Q!Nj!Q!}!Mh!}#O#!U#O#P!:o#P;'S!Mh;'S;=`##U<%lO!Mh#W!Nse'wp'z!b!RSOY*gZr*grs'}sw*gwx)rx#O*g#P#Z*g#Z#[!Nj#[#]*g#]#^!Nj#^#a*g#a#b!Nj#b#g*g#g#h!Nj#h#i*g#i#j!Nj#j#m*g#m#n!Nj#n;'S*g;'S;=`+Z<%lO*g#W#!]Z'wp'z!bOY#!UZr#!Urs!Apsw#!Uwx!IZx#O#!U#O#P!:Y#P#Q!Mh#Q;'S#!U;'S;=`##O<%lO#!U#W##RP;=`<%l#!U#W##XP;=`<%l!Mh(r##e`$d&j'wp'z!bOY##[YZ&cZr##[rs!Bnsw##[wx!JXx!^##[!^!_#!U!_#O##[#O#P!<P#P#Q!3h#Q#o##[#o#p#!U#p;'S##[;'S;=`#$g<%lO##[(r#$jP;=`<%l##[(r#$pP;=`<%l!3h(CS#%Qb$d&j'wp'z!b'o(;d!RSOY!3hYZ&cZr!3hrs!4{sw!3hwx!C}x!P!3h!P!Q!Kh!Q!^!3h!^!_!Mh!_!}!3h!}#O##[#O#P!<w#P#o!3h#o#p!Mh#p;'S!3h;'S;=`#$m<%lO!3h(CS#&e_$d&j'wp'z!bR(;dOY#&YYZ&cZr#&Yrs#'dsw#&Ywx#*tx!^#&Y!^!_#,s!_#O#&Y#O#P#(f#P#o#&Y#o#p#,s#p;'S#&Y;'S;=`#-r<%lO#&Y(Bb#'m]$d&j'z!bR(;dOY#'dYZ&cZw#'dwx#(fx!^#'d!^!_#)w!_#O#'d#O#P#(f#P#o#'d#o#p#)w#p;'S#'d;'S;=`#*n<%lO#'d(AO#(mX$d&jR(;dOY#(fYZ&cZ!^#(f!^!_#)Y!_#o#(f#o#p#)Y#p;'S#(f;'S;=`#)q<%lO#(f(;d#)_SR(;dOY#)YZ;'S#)Y;'S;=`#)k<%lO#)Y(;d#)nP;=`<%l#)Y(AO#)tP;=`<%l#(f(<v#*OW'z!bR(;dOY#)wZw#)wwx#)Yx#O#)w#O#P#)Y#P;'S#)w;'S;=`#*h<%lO#)w(<v#*kP;=`<%l#)w(Bb#*qP;=`<%l#'d(Ap#*}]$d&j'wpR(;dOY#*tYZ&cZr#*trs#(fs!^#*t!^!_#+v!_#O#*t#O#P#(f#P#o#*t#o#p#+v#p;'S#*t;'S;=`#,m<%lO#*t(<U#+}W'wpR(;dOY#+vZr#+vrs#)Ys#O#+v#O#P#)Y#P;'S#+v;'S;=`#,g<%lO#+v(<U#,jP;=`<%l#+v(Ap#,pP;=`<%l#*t(=h#,|Y'wp'z!bR(;dOY#,sZr#,srs#)wsw#,swx#+vx#O#,s#O#P#)Y#P;'S#,s;'S;=`#-l<%lO#,s(=h#-oP;=`<%l#,s(CS#-uP;=`<%l#&Y%#W#.Vb$d&j#{$Id'wp'z!b!RSOY!3hYZ&cZr!3hrs!4{sw!3hwx!C}x!P!3h!P!Q!Kh!Q!^!3h!^!_!Mh!_!}!3h!}#O##[#O#P!<w#P#o!3h#o#p!Mh#p;'S!3h;'S;=`#$m<%lO!3h+h#/lb$T#t$d&j'wp'z!b!RSOY!3hYZ&cZr!3hrs!4{sw!3hwx!C}x!P!3h!P!Q!Kh!Q!^!3h!^!_!Mh!_!}!3h!}#O##[#O#P!<w#P#o!3h#o#p!Mh#p;'S!3h;'S;=`#$m<%lO!3h$/l#1Pp$d&j'wp'z!bl$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!O%Z!O!P!+g!P!Q%Z!Q![#3T![!^%Z!^!_*g!_!g%Z!g!h!-Z!h#O%Z#O#P&c#P#R%Z#R#S#3T#S#U%Z#U#V#6_#V#X%Z#X#Y!-Z#Y#b%Z#b#c#5T#c#d#9g#d#l%Z#l#m#<i#m#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#3`k$d&j'wp'z!bl$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!O%Z!O!P!+g!P!Q%Z!Q![#3T![!^%Z!^!_*g!_!g%Z!g!h!-Z!h#O%Z#O#P&c#P#R%Z#R#S#3T#S#X%Z#X#Y!-Z#Y#b%Z#b#c#5T#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#5`_$d&j'wp'z!bl$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#6hd$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#7v!R!S#7v!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#7v#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#8Rf$d&j'wp'z!bl$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#7v!R!S#7v!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#7v#S#b%Z#b#c#5T#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#9pc$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#:{!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#:{#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#;We$d&j'wp'z!bl$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#:{!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#:{#S#b%Z#b#c#5T#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#<rg$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#>Z![!^%Z!^!_*g!_!c%Z!c!i#>Z!i#O%Z#O#P&c#P#R%Z#R#S#>Z#S#T%Z#T#Z#>Z#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#>fi$d&j'wp'z!bl$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#>Z![!^%Z!^!_*g!_!c%Z!c!i#>Z!i#O%Z#O#P&c#P#R%Z#R#S#>Z#S#T%Z#T#Z#>Z#Z#b%Z#b#c#5T#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%Gh#@b_!a$b$d&j#y%<f'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)[#Al_^l$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(CS#Bz^'}!*v!e'.r'wp'z!b$U)d(mSOY*gZr*grs'}sw*gwx)rx!P*g!P!Q#Cv!Q!^*g!^!_#Dl!_!`#F^!`#O*g#P;'S*g;'S;=`+Z<%lO*g(n#DPX$f&j'wp'z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g$Kh#DuZ#k$Id'wp'z!bOY*gZr*grs'}sw*gwx)rx!_*g!_!`#Eh!`#O*g#P;'S*g;'S;=`+Z<%lO*g$Kh#EqX#{$Id'wp'z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g$Kh#FgX#l$Id'wp'z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g%Gh#G_a#X%?x$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`!a#Hd!a#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#W#Ho_#d$Ih$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%Gh#I}adBf#l$Id$a#|$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`#KS!`!a#L^!a#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S#K__#l$Id$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S#Lia#k$Id$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Cn!`!a#Mn!a#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S#My`#k$Id$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Cn!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'+h$ Wc(a$Ip$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!O%Z!O!P$!c!P!^%Z!^!_*g!_!a%Z!a!b$#m!b#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'+`$!n_z'#p$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S$#x`$d&j#v$Id'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Cn!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z#&^$%V_!x!Ln$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(@^$&a_|(8n$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(n$'eZ$d&jO!^$(W!^!_$(n!_#i$(W#i#j$(s#j#l$(W#l#m$*f#m#o$(W#o#p$(n#p;'S$(W;'S;=`$,q<%lO$(W(n$(_T[#S$d&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c#S$(sO[#S(n$(x[$d&jO!Q&c!Q![$)n![!^&c!_!c&c!c!i$)n!i#T&c#T#Z$)n#Z#o&c#o#p$,U#p;'S&c;'S;=`&w<%lO&c(n$)sZ$d&jO!Q&c!Q![$*f![!^&c!_!c&c!c!i$*f!i#T&c#T#Z$*f#Z#o&c#p;'S&c;'S;=`&w<%lO&c(n$*kZ$d&jO!Q&c!Q![$+^![!^&c!_!c&c!c!i$+^!i#T&c#T#Z$+^#Z#o&c#p;'S&c;'S;=`&w<%lO&c(n$+cZ$d&jO!Q&c!Q![$(W![!^&c!_!c&c!c!i$(W!i#T&c#T#Z$(W#Z#o&c#p;'S&c;'S;=`&w<%lO&c#S$,XR!Q![$,b!c!i$,b#T#Z$,b#S$,eS!Q![$,b!c!i$,b#T#Z$,b#q#r$(n(n$,tP;=`<%l$(W!'l$-S_!SM|$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S$.^`#s$Id$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Cn!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&,v$/k_$d&j'wp'z!b(R&%WOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(CS$0yk$d&j'wp'z!b(U!LY't&;d$Y#tOY%ZYZ&cZr%Zrs&}st%Ztu$0juw%Zwx(rx}%Z}!O$2n!O!Q%Z!Q![$0j![!^%Z!^!_*g!_!c%Z!c!}$0j!}#O%Z#O#P&c#P#R%Z#R#S$0j#S#T%Z#T#o$0j#o#p*g#p$g%Z$g;'S$0j;'S;=`$4t<%lO$0j+d$2yk$d&j'wp'z!b$Y#tOY%ZYZ&cZr%Zrs&}st%Ztu$2nuw%Zwx(rx}%Z}!O$2n!O!Q%Z!Q![$2n![!^%Z!^!_*g!_!c%Z!c!}$2n!}#O%Z#O#P&c#P#R%Z#R#S$2n#S#T%Z#T#o$2n#o#p*g#p$g%Z$g;'S$2n;'S;=`$4n<%lO$2n+d$4qP;=`<%l$2n(CS$4wP;=`<%l$0j!5p$5TX!X!3l'wp'z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g%Df$5{a(h%<v$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Cn!`#O%Z#O#P&c#P#o%Z#o#p*g#p#q$#m#q;'S%Z;'S;=`+a<%lO%Z%#`$7__!W$I`o`$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(r$8i_!mS$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(CS$9y|$d&j'wp'z!b'm(;d(U!LY't&;d$W#tOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}st%Ztu>Puw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![>P![!^%Z!^!_*g!_!c%Z!c!}>P!}#O%Z#O#P&c#P#R%Z#R#S>P#S#T%Z#T#o>P#o#p*g#p$f%Z$f$g+g$g#BY>P#BY#BZ$9h#BZ$IS>P$IS$I_$9h$I_$JT>P$JT$JU$9h$JU$KV>P$KV$KW$9h$KW&FU>P&FU&FV$9h&FV;'S>P;'S;=`BZ<%l?HT>P?HT?HU$9h?HUO>P(CS$=Uk$d&j'wp'z!b'n(;d(U!LY't&;d$W#tOY%ZYZ&cZr%Zrs&}st%Ztu>Puw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![>P![!^%Z!^!_*g!_!c%Z!c!}>P!}#O%Z#O#P&c#P#R%Z#R#S>P#S#T%Z#T#o>P#o#p*g#p$g%Z$g;'S>P;'S;=`BZ<%lO>P",tokenizers:[pg,bg,2,3,4,5,6,7,8,9,10,11,12,13,gg,new xn("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOq~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!O~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(T~~",141,326),new xn("j~RQYZXz{^~^O'q~~aP!P!Qd~iO'r~~",25,308)],topRules:{Script:[0,5],SingleExpression:[1,267],SingleClassItem:[2,268]},dialects:{jsx:13525,ts:13527},dynamicPrecedences:{76:1,78:1,163:1,191:1},specialized:[{term:312,get:i=>vg[i]||-1},{term:328,get:i=>kg[i]||-1},{term:67,get:i=>wg[i]||-1}],tokenPrec:13551});var Ue=require("@codemirror/language"),_g=require("@codemirror/state"),Og=require("@codemirror/view"),Rr=require("@codemirror/autocomplete"),Nc=require("@lezer/common");var Lc=Ue.LRLanguage.define({name:"javascript",parser:Wc.configure({props:[Ue.indentNodeProp.add({IfStatement:(0,Ue.continuedIndent)({except:/^\s*({|else\b)/}),TryStatement:(0,Ue.continuedIndent)({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Ue.flatIndent,SwitchBody:i=>{let e=i.textAfter,t=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return i.baseIndent+(t?0:n?1:2)*i.unit},Block:(0,Ue.delimitedIndent)({closing:"}"}),ArrowFunction:i=>i.baseIndent+i.unit,"TemplateString BlockComment":()=>null,"Statement Property":(0,Ue.continuedIndent)({except:/^{/}),JSXElement(i){let e=/^\s*<\//.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},JSXEscape(i){let e=/\s*\}/.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},"JSXOpenTag JSXSelfClosingTag"(i){return i.column(i.node.from)+i.unit}}),Ue.foldNodeProp.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Ue.foldInside,BlockComment(i){return{from:i.from+2,to:i.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}});var zv=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent);var Rt=require("@codemirror/language"),ti=require("@codemirror/view"),Di=require("@codemirror/autocomplete"),ts=require("@codemirror/search"),$c=require("@codemirror/lint"),Bc=()=>[Lc,(0,Rt.foldGutter)(),(0,ti.drawSelection)(),(0,ti.dropCursor)(),(0,Rt.indentOnInput)(),(0,Rt.syntaxHighlighting)(Rt.defaultHighlightStyle,{fallback:!0}),ti.EditorView.lineWrapping,(0,Rt.bracketMatching)(),(0,Di.closeBrackets)(),(0,Di.autocompletion)(),(0,ti.rectangularSelection)(),(0,ts.highlightSelectionMatches)(),ti.keymap.of([...Di.closeBracketsKeymap,...Cn.defaultKeymap,...ts.searchKeymap,...Cn.historyKeymap,Cn.indentWithTab,...Rt.foldKeymap,...Di.completionKeymap,...$c.lintKeymap])].filter(i=>i);var Hc=require("@codemirror/view"),Xv=require("@codemirror/state"),is=require("@codemirror/language"),He=require("@lezer/highlight"),Sg="#abb2bf",xg="#7d8799",Tg="#ffffff",Cg="#21252b",Wr="rgba(0, 0, 0, 0.5)",Ag="#292d3e",Nr="#353a42",Dg="rgba(128, 203, 196, 0.2)",zc="#ffcc00",Pg=Hc.EditorView.theme({"&":{color:"#ffffff",backgroundColor:Ag},".cm-content":{caretColor:zc},"&.cm-focused .cm-cursor":{borderLeftColor:zc},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Dg},".cm-panels":{backgroundColor:Cg,color:"#ffffff"},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:Wr},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847",outline:"1px solid #515a6b"},".cm-gutters":{background:"#292d3e",color:"#676e95",border:"none"},".cm-activeLineGutter":{backgroundColor:Wr},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Nr},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Nr,borderBottomColor:Nr},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Wr,color:Sg}}},{dark:!0}),Mg=is.HighlightStyle.define([{tag:He.tags.keyword,color:"#c792ea"},{tag:He.tags.operator,color:"#89ddff"},{tag:He.tags.special(He.tags.variableName),color:"#eeffff"},{tag:He.tags.typeName,color:"#f07178"},{tag:He.tags.atom,color:"#f78c6c"},{tag:He.tags.number,color:"#ff5370"},{tag:He.tags.definition(He.tags.variableName),color:"#82aaff"},{tag:He.tags.string,color:"#c3e88d"},{tag:He.tags.special(He.tags.string),color:"#f07178"},{tag:He.tags.comment,color:xg},{tag:He.tags.variableName,color:"#f07178"},{tag:He.tags.tagName,color:"#ff5370"},{tag:He.tags.bracket,color:"#a2a1a4"},{tag:He.tags.meta,color:"#ffcb6b"},{tag:He.tags.attributeName,color:"#c792ea"},{tag:He.tags.propertyName,color:"#c792ea"},{tag:He.tags.className,color:"#decb6b"},{tag:He.tags.invalid,color:Tg}]),Fc=[Pg,(0,is.syntaxHighlighting)(Mg)];var Gc=require("@codemirror/view"),Vv=require("@codemirror/state"),as=require("@codemirror/language"),fe=require("@lezer/highlight"),jc="#2e3440",Fr="#3b4252",Zc="#434c5e",ns="#4c566a";var Xc="#e5e9f0",Hr="#eceff4",Lr="#8fbcbb",qc="#88c0d0",Eg="#81a1c1",zt="#5e81ac",Qg="#bf616a",An="#d08770",$r="#ebcb8b",Uc="#a3be8c",Ig="#b48ead",Vc="#d30102",jr=Hr,Br=jr,Rg="#ffffff",zr=Fr,Wg=jr,Yc=Fr,Zr=Gc.EditorView.theme({"&":{color:jc,backgroundColor:Rg},".cm-content":{caretColor:Yc},".cm-cursor, .cm-dropCursor":{borderLeftColor:Yc},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Wg},".cm-panels":{backgroundColor:jr,color:ns},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:`1px solid ${ns}`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:Xc},".cm-activeLine":{backgroundColor:Br},".cm-selectionMatch":{backgroundColor:Xc},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{outline:`1px solid ${ns}`},"&.cm-focused .cm-matchingBracket":{backgroundColor:Hr},".cm-gutters":{backgroundColor:Hr,color:jc,border:"none"},".cm-activeLineGutter":{backgroundColor:Br},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:zr},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:zr,borderBottomColor:zr},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Br,color:ns}}},{dark:!1}),Ng=as.HighlightStyle.define([{tag:fe.tags.keyword,color:zt},{tag:[fe.tags.name,fe.tags.deleted,fe.tags.character,fe.tags.propertyName,fe.tags.macroName],color:An},{tag:[fe.tags.variableName],color:An},{tag:[fe.tags.function(fe.tags.variableName)],color:zt},{tag:[fe.tags.labelName],color:Eg},{tag:[fe.tags.color,fe.tags.constant(fe.tags.name),fe.tags.standard(fe.tags.name)],color:zt},{tag:[fe.tags.definition(fe.tags.name),fe.tags.separator],color:Uc},{tag:[fe.tags.brace],color:Lr},{tag:[fe.tags.annotation],color:Vc},{tag:[fe.tags.number,fe.tags.changed,fe.tags.annotation,fe.tags.modifier,fe.tags.self,fe.tags.namespace],color:qc},{tag:[fe.tags.typeName,fe.tags.className],color:$r},{tag:[fe.tags.operator,fe.tags.operatorKeyword],color:Uc},{tag:[fe.tags.tagName],color:Ig},{tag:[fe.tags.squareBracket],color:Qg},{tag:[fe.tags.angleBracket],color:An},{tag:[fe.tags.attributeName],color:$r},{tag:[fe.tags.regexp],color:zt},{tag:[fe.tags.quote],color:Fr},{tag:[fe.tags.string],color:An},{tag:fe.tags.link,color:Lr,textDecoration:"underline",textUnderlinePosition:"under"},{tag:[fe.tags.url,fe.tags.escape,fe.tags.special(fe.tags.string)],color:An},{tag:[fe.tags.meta],color:qc},{tag:[fe.tags.comment],color:Zc,fontStyle:"italic"},{tag:fe.tags.strong,fontWeight:"bold",color:zt},{tag:fe.tags.emphasis,fontStyle:"italic",color:zt},{tag:fe.tags.strikethrough,textDecoration:"line-through"},{tag:fe.tags.heading,fontWeight:"bold",color:zt},{tag:fe.tags.special(fe.tags.heading1),fontWeight:"bold",color:zt},{tag:fe.tags.heading1,fontWeight:"bold",color:zt},{tag:[fe.tags.heading2,fe.tags.heading3,fe.tags.heading4],fontWeight:"bold",color:zt},{tag:[fe.tags.heading5,fe.tags.heading6],color:zt},{tag:[fe.tags.atom,fe.tags.bool,fe.tags.special(fe.tags.variableName)],color:An},{tag:[fe.tags.processingInstruction,fe.tags.inserted],color:Lr},{tag:[fe.tags.contentSeparator],color:$r},{tag:fe.tags.invalid,color:Zc,borderBottom:`1px dotted ${Vc}`}]),Gv=[Zr,(0,as.syntaxHighlighting)(Ng)];function Ht(i,e,t="js"){let n=Bc();document.body.hasClass("theme-dark")?n.push(Fc):n.push(Zr);let a=[...n];e&&a.push(e);let s=new Jc.EditorView({state:Kc.EditorState.create({doc:i.value,extensions:a})});return i.parentNode.appendChild(s.dom),i.style.display="none",i.form&&i.form.addEventListener("submit",()=>{i.value=s.state.doc.toString()}),s}function ii(i){return i?i.toLowerCase().replace(/[^A-Za-z0-9\s_-]/g,"").replace(/\s+/g,"-"):""}function sa(i){return i[0].toUpperCase()+i.slice(1).toLowerCase()}function q(){return"xyxyxyxyxyxy".replace(/[xy]/g,function(i){let e=Math.random()*16|0;return(i=="x"?e:e&3|8).toString(16)})}function ye(i,e=0,t=" ",n=!0){let a=[];if(e==5||i==null)return"";if(typeof i=="string")return i;if(typeof i=="number")return`${i}`;if(Array.isArray(i))a.push(`${n?"(":""}${i.map(s=>ye(s,e++)).join(t)}${n?")":""}`);else if(typeof i=="object")for(let s of Object.values(i))a.push(ye(s,e++));return a.join(" ")}function Xr(i,e){if(!Array.isArray(i)&&typeof i!="string"||!Array.isArray(e)&&typeof e!="string")return e;let t=(0,eh.default)(i);if(Array.isArray(t)){if(Array.isArray(e))return[...t,...e];if(typeof e=="string")return t.push(e),t}else if(typeof t=="string")return`${t} ${ye(e)}`;return e}var Lg=[{type:"inline",id:q(),properties:[],hasRule:!0,nested:[{type:"group",id:q(),properties:["name","size","type","subtype","alignment"],nested:[{type:"inline",id:q(),properties:[],hasRule:!1,nested:[{type:"heading",id:q(),properties:["name"],conditioned:!0,size:1},{type:"inline",id:q(),properties:[],hasRule:!1,nested:[{type:"action",id:q(),icon:"sword",callback:"try { InitiativeTracker.newEncounter({roll: true, creatures: [monster]}); } catch(e) {}"},{type:"action",id:q(),icon:"plus-with-circle",callback:"try { InitiativeTracker.addCreatures([monster]); } catch(e) {}"}]}]},{type:"subheading",id:q(),properties:["size","type","subtype","alignment"],conditioned:!0,separator:", "}],conditioned:!0},{type:"image",id:q(),properties:["image"]}]},{type:"group",id:q(),properties:["ac","hp","speed"],nested:[{type:"property",id:q(),properties:["ac"],display:"Armor Class",conditioned:!0,callback:'const ac = [monster.ac];if ("ac_class" in monster) {ac.push(`(${monster.ac_class})`);}return ac.join(" ");'},{type:"property",id:q(),properties:["hp"],display:"Hit Points",dice:!0,diceProperty:"hit_dice",diceCallback:`if ("hit_dice" in monster) {
return [{ text: monster["hit_dice"] }];
} else {
return property;
}`,callback:`let str = [monster.hp];
if (monster.hit_dice?.length) {
str.push(\`(\${monster.hit_dice})\`);
}
return str.join(" ");`,conditioned:!0},{type:"property",id:q(),display:"Speed",properties:["speed"],conditioned:!0}],hasRule:!0,conditioned:!0},{type:"table",id:q(),properties:["stats"],headers:["Str","Dex","Con","Int","Wis","Cha"],calculate:!0,hasRule:!0,conditioned:!0},{type:"table",id:q(),properties:["fage_stats"],headers:["Accuracy","Communication","Constitution","Dexterity","Fighting","Intelligence","Perception","Strength","Willpower"],calculate:!1,hasRule:!0,conditioned:!0},{type:"group",id:q(),properties:["saves","skillsaves","damage_immunities","damage_resistances","damage_vulnerabilities","condition_immunities","cr","languages","senses"],nested:[{type:"saves",id:q(),display:"Saves",properties:["saves"],conditioned:!0},{type:"saves",id:q(),display:"Skills",properties:["skillsaves"],conditioned:!0},{type:"property",id:q(),display:"Damage Resistances",properties:["damage_resistances"],conditioned:!0},{type:"property",id:q(),display:"Damage Immunities",properties:["damage_immunities"],conditioned:!0},{type:"property",id:q(),display:"Condition Immunities",properties:["condition_immunities"],conditioned:!0},{type:"property",id:q(),display:"Damage Vulnerabilities",properties:["damage_vulnerabilities"],conditioned:!0},{type:"property",id:q(),display:"Senses",properties:["senses"],conditioned:!0},{type:"property",id:q(),display:"Languages",properties:["languages"],fallback:"-"},{type:"inline",id:q(),properties:[],conditioned:!0,nested:[{type:"property",id:q(),display:"Challenge",properties:["cr"],callback:`const CR = {
"0": {
cr: "0",
value: 0,
xp: 10
},
"1/8": {
cr: "1/8",
value: 0.125,
xp: 25
},
"1/4": {
cr: "1/4",
value: 0.25,
xp: 50
},
"1/2": {
cr: "1/2",
value: 0.5,
xp: 100
},
"0.125": {
cr: "1/8",
value: 0.125,
xp: 25
},
"0.25": {
cr: "1/4",
value: 0.25,
xp: 50
},
"0.5": {
cr: "1/2",
value: 0.5,
xp: 100
},
"1": {
cr: "1",
value: 1,
xp: 200
},
"2": {
cr: "2",
value: 2,
xp: 450
},
"3": {
cr: "3",
value: 3,
xp: 700
},
"4": {
cr: "4",
value: 4,
xp: 1100
},
"5": {
cr: "5",
value: 5,
xp: 1800
},
"6": {
cr: "6",
value: 6,
xp: 2300
},
"7": {
cr: "7",
value: 7,
xp: 2900
},
"8": {
cr: "8",
value: 8,
xp: 3900
},
"9": {
cr: "9",
value: 9,
xp: 5000
},
"10": {
cr: "10",
value: 10,
xp: 5900
},
"11": {
cr: "11",
value: 11,
xp: 7200
},
"12": {
cr: "12",
value: 12,
xp: 8400
},
"13": {
cr: "13",
value: 13,
xp: 10000
},
"14": {
cr: "14",
value: 14,
xp: 11500
},
"15": {
cr: "15",
value: 15,
xp: 13000
},
"16": {
cr: "16",
value: 16,
xp: 15000
},
"17": {
cr: "17",
value: 17,
xp: 18000
},
"18": {
cr: "18",
value: 18,
xp: 20000
},
"19": {
cr: "19",
value: 19,
xp: 22000
},
"20": {
cr: "20",
value: 20,
xp: 25000
},
"21": {
cr: "21",
value: 21,
xp: 33000
},
"22": {
cr: "22",
value: 22,
xp: 41000
},
"23": {
cr: "23",
value: 23,
xp: 50000
},
"24": {
cr: "24",
value: 24,
xp: 62000
},
"25": {
cr: "25",
value: 25,
xp: 75000
},
"26": {
cr: "26",
value: 26,
xp: 90000
},
"27": {
cr: "27",
value: 27,
xp: 105000
},
"28": {
cr: "28",
value: 28,
xp: 120000
},
"29": {
cr: "29",
value: 29,
xp: 135000
},
"30": {
cr: "30",
value: 30,
xp: 155000
}
};
if ("cr" in monster && monster.cr in CR) {
return \`\${CR[
monster.cr
].cr} (\${CR[
monster.cr
].xp.toLocaleString()} XP)\`;
}
return "";`},{type:"property",id:q(),display:"Proficiency Bonus",properties:["cr"],callback:`const CR = {
"0": {
cr: "0",
value: 0,
xp: 0
},
"1/8": {
cr: "1/8",
value: 0.125,
xp: 25
},
"1/4": {
cr: "1/4",
value: 0.25,
xp: 50
},
"1/2": {
cr: "1/2",
value: 0.5,
xp: 100
},
"0.125": {
cr: "1/8",
value: 0.125,
xp: 25
},
"0.25": {
cr: "1/4",
value: 0.25,
xp: 50
},
"0.5": {
cr: "1/2",
value: 0.5,
xp: 100
},
"1": {
cr: "1",
value: 1,
xp: 200
},
"2": {
cr: "2",
value: 2,
xp: 450
},
"3": {
cr: "3",
value: 3,
xp: 700
},
"4": {
cr: "4",
value: 4,
xp: 1100
},
"5": {
cr: "5",
value: 5,
xp: 1800
},
"6": {
cr: "6",
value: 6,
xp: 2300
},
"7": {
cr: "7",
value: 7,
xp: 2900
},
"8": {
cr: "8",
value: 8,
xp: 3900
},
"9": {
cr: "9",
value: 9,
xp: 5000
},
"10": {
cr: "10",
value: 10,
xp: 5900
},
"11": {
cr: "11",
value: 11,
xp: 7200
},
"12": {
cr: "12",
value: 12,
xp: 8400
},
"13": {
cr: "13",
value: 13,
xp: 10000
},
"14": {
cr: "14",
value: 14,
xp: 11500
},
"15": {
cr: "15",
value: 15,
xp: 13000
},
"16": {
cr: "16",
value: 16,
xp: 15000
},
"17": {
cr: "17",
value: 17,
xp: 18000
},
"18": {
cr: "18",
value: 18,
xp: 20000
},
"19": {
cr: "19",
value: 19,
xp: 22000
},
"20": {
cr: "20",
value: 20,
xp: 25000
},
"21": {
cr: "21",
value: 21,
xp: 33000
},
"22": {
cr: "22",
value: 22,
xp: 41000
},
"23": {
cr: "23",
value: 23,
xp: 50000
},
"24": {
cr: "24",
value: 24,
xp: 62000
},
"25": {
cr: "25",
value: 25,
xp: 75000
},
"26": {
cr: "26",
value: 26,
xp: 90000
},
"27": {
cr: "27",
value: 27,
xp: 105000
},
"28": {
cr: "28",
value: 28,
xp: 120000
},
"29": {
cr: "29",
value: 29,
xp: 135000
},
"30": {
cr: "30",
value: 30,
xp: 155000
}
};
if ("cr" in monster && monster.cr in CR) {
return \`+\${Math.max(
Math.floor(2 + ((CR[monster.cr]?.value ?? 0) - 1) / 4),
2
)}\`;
}
return "";`}]}],conditioned:!0,hasRule:!0},{type:"traits",id:q(),properties:["traits"],conditioned:!0,dice:!0},{type:"spells",id:q(),properties:["spells"],conditioned:!0,dice:!0},{type:"text",id:q(),properties:["spellsNotes"],conditioned:!0,text:null},{type:"traits",id:q(),properties:["actions"],heading:"Actions",conditioned:!0,dice:!0},{type:"traits",id:q(),properties:["bonus_actions"],heading:"Bonus Actions",conditioned:!0,dice:!0},{type:"group",id:q(),properties:["legendary_description","legendary_actions"],heading:"Legendary Actions",nested:[{type:"text",id:q(),properties:["legendary_description"],conditioned:!0,text:null},{type:"traits",id:q(),properties:["legendary_actions"],conditioned:!0,dice:!0}],conditioned:!0},{type:"group",id:q(),properties:["mythic_description","mythic_actions"],heading:"Mythic Actions",nested:[{type:"text",id:q(),properties:["mythic_description"],conditioned:!0,text:null},{type:"traits",id:q(),properties:["mythic_actions"],conditioned:!0,dice:!0}],conditioned:!0},{type:"traits",id:q(),properties:["reactions"],heading:"Reactions",conditioned:!0,dice:!0},{type:"traits",id:q(),properties:["lair_actions"],heading:"Lair Actions",conditioned:!0,dice:!0},{type:"traits",id:q(),properties:["regional_effects"],heading:"Regional Effects",conditioned:!0,dice:!0}],ni={blocks:Lg,id:"basic-5e-layout",name:"Basic 5e Layout",edited:!1,version:9};var ld=require("obsidian");function N(){}var ai=i=>i;function at(i,e){for(let t in e)i[t]=e[t];return i}function th(i){return!!i&&(typeof i=="object"||typeof i=="function")&&typeof i.then=="function"}function qr(i){return i()}function rs(){return Object.create(null)}function ce(i){i.forEach(qr)}function Ie(i){return typeof i=="function"}function j(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}var ss;function ih(i,e){return i===e?!0:(ss||(ss=document.createElement("a")),ss.href=e,i===ss.href)}function nh(i){return Object.keys(i).length===0}function Tt(i,...e){if(i==null){for(let n of e)n(void 0);return N}let t=i.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function Se(i,e,t){i.$$.on_destroy.push(Tt(e,t))}function st(i,e,t,n){if(i){let a=ah(i,e,t,n);return i[0](a)}}function ah(i,e,t,n){return i[1]&&n?at(t.ctx.slice(),i[1](n(e))):t.ctx}function rt(i,e,t,n){if(i[2]&&n){let a=i[2](n(t));if(e.dirty===void 0)return a;if(typeof a=="object"){let s=[],r=Math.max(e.dirty.length,a.length);for(let o=0;o<r;o+=1)s[o]=e.dirty[o]|a[o];return s}return e.dirty|a}return e.dirty}function ot(i,e,t,n,a,s){if(a){let r=ah(e,t,n,s);i.p(r,a)}}function lt(i){if(i.ctx.length>32){let e=[],t=i.ctx.length/32;for(let n=0;n<t;n++)e[n]=-1;return e}return-1}function Ft(i){let e={};for(let t in i)t[0]!=="$"&&(e[t]=i[t]);return e}function Pi(i){return i??""}function Te(i,e,t){return i.set(t),e}function ee(i){return i&&Ie(i.destroy)?i.destroy:N}var sh=typeof window<"u",Mi=sh?()=>window.performance.now():()=>Date.now(),ra=sh?i=>requestAnimationFrame(i):N;var Dn=new Set;function rh(i){Dn.forEach(e=>{e.c(i)||(Dn.delete(e),e.f())}),Dn.size!==0&&ra(rh)}function Vi(i){let e;return Dn.size===0&&ra(rh),{promise:new Promise(t=>{Dn.add(e={c:i,f:t})}),abort(){Dn.delete(e)}}}var oa=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;var os=class i{constructor(e){$e(this,"_listeners","WeakMap"in oa?new WeakMap:void 0);$e(this,"_observer");$e(this,"options");this.options=e}observe(e,t){return this._listeners.set(e,t),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){return this._observer??(this._observer=new ResizeObserver(e=>{for(let t of e)i.entries.set(t.target,t),this._listeners.get(t.target)?.(t)}))}};os.entries="WeakMap"in oa?new WeakMap:void 0;var oh=!1;function lh(){oh=!0}function ch(){oh=!1}function b(i,e){i.appendChild(e)}function re(i,e,t){let n=ls(i);if(!n.getElementById(e)){let a=k("style");a.id=e,a.textContent=t,dh(n,a)}}function ls(i){if(!i)return document;let e=i.getRootNode?i.getRootNode():i.ownerDocument;return e&&e.host?e:i.ownerDocument}function hh(i){let e=k("style");return e.textContent="/* empty */",dh(ls(i),e),e.sheet}function dh(i,e){return b(i.head||i,e),e.sheet}function D(i,e,t){i.insertBefore(e,t||null)}function A(i){i.parentNode&&i.parentNode.removeChild(i)}function Xe(i,e){for(let t=0;t<i.length;t+=1)i[t]&&i[t].d(e)}function k(i){return document.createElement(i)}function jt(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function me(i){return document.createTextNode(i)}function W(){return me(" ")}function Oe(){return me("")}function H(i,e,t,n){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t,n)}function Ur(i){return function(e){return e.preventDefault(),i.call(this,e)}}function si(i){return function(e){return e.stopPropagation(),i.call(this,e)}}function uh(i){return function(e){e.target===this&&i.call(this,e)}}function g(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function ri(i,e){for(let t in e)g(i,t,e[t])}function Yi(i){return i===""?null:+i}function fh(i){return Array.from(i.childNodes)}function we(i,e){e=""+e,i.data!==e&&(i.data=e)}function kt(i,e){i.value=e??""}function Be(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,n?"important":"")}function oe(i,e,t){i.classList.toggle(e,!!t)}function la(i,e,{bubbles:t=!1,cancelable:n=!1}={}){return new CustomEvent(i,{detail:e,bubbles:t,cancelable:n})}var pi=class{constructor(e=!1){$e(this,"is_svg",!1);$e(this,"e");$e(this,"n");$e(this,"t");$e(this,"a");this.is_svg=e,this.e=this.n=null}c(e){this.h(e)}m(e,t,n=null){this.e||(this.is_svg?this.e=jt(t.nodeName):this.e=k(t.nodeType===11?"TEMPLATE":t.nodeName),this.t=t.tagName!=="TEMPLATE"?t:t.content,this.c(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.nodeName==="TEMPLATE"?this.e.content.childNodes:this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)D(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(A)}};function mh(i){let e={};return i.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}function Vr(i,e){return new i(e)}var cs=new Map,hs=0;function Bg(i){let e=5381,t=i.length;for(;t--;)e=(e<<5)-e^i.charCodeAt(t);return e>>>0}function zg(i,e){let t={stylesheet:hh(e),rules:{}};return cs.set(i,t),t}function ca(i,e,t,n,a,s,r,o=0){let l=16.666/n,c=`{
`;for(let y=0;y<=1;y+=l){let w=e+(t-e)*s(y);c+=y*100+`%{${r(w,1-w)}}
`}let d=c+`100% {${r(t,1-t)}}
}`,h=`__svelte_${Bg(d)}_${o}`,u=ls(i),{stylesheet:f,rules:m}=cs.get(u)||zg(u,i);m[h]||(m[h]=!0,f.insertRule(`@keyframes ${h} ${d}`,f.cssRules.length));let p=i.style.animation||"";return i.style.animation=`${p?`${p}, `:""}${h} ${n}ms linear ${a}ms 1 both`,hs+=1,h}function ds(i,e){let t=(i.style.animation||"").split(", "),n=t.filter(e?s=>s.indexOf(e)<0:s=>s.indexOf("__svelte")===-1),a=t.length-n.length;a&&(i.style.animation=n.join(", "),hs-=a,hs||Hg())}function Hg(){ra(()=>{hs||(cs.forEach(i=>{let{ownerNode:e}=i.stylesheet;e&&A(e)}),cs.clear())})}function Ei(i,e,t,n){if(!e)return N;let a=i.getBoundingClientRect();if(e.left===a.left&&e.right===a.right&&e.top===a.top&&e.bottom===a.bottom)return N;let{delay:s=0,duration:r=300,easing:o=ai,start:l=Mi()+s,end:c=l+r,tick:d=N,css:h}=t(i,{from:e,to:a},n),u=!0,f=!1,m;function p(){h&&(m=ca(i,0,1,r,s,o,h)),s||(f=!0)}function y(){h&&ds(i,m),u=!1}return Vi(w=>{if(!f&&w>=l&&(f=!0),f&&w>=c&&(d(1,0),y()),!u)return!1;if(f){let _=w-l,O=0+1*o(_/r);d(O,1-O)}return!0}),p(),d(0,1),y}function Qi(i){let e=getComputedStyle(i);if(e.position!=="absolute"&&e.position!=="fixed"){let{width:t,height:n}=e,a=i.getBoundingClientRect();i.style.position="absolute",i.style.width=t,i.style.height=n,Fg(i,a)}}function Fg(i,e){let t=i.getBoundingClientRect();if(e.left!==t.left||e.top!==t.top){let n=getComputedStyle(i),a=n.transform==="none"?"":n.transform;i.style.transform=`${a} translate(${e.left-t.left}px, ${e.top-t.top}px)`}}var Ii;function Ct(i){Ii=i}function Ri(){if(!Ii)throw new Error("Function called outside component initialization");return Ii}function bi(i){Ri().$$.on_mount.push(i)}function yi(i){Ri().$$.on_destroy.push(i)}function Pe(){let i=Ri();return(e,t,{cancelable:n=!1}={})=>{let a=i.$$.callbacks[e];if(a){let s=la(e,t,{cancelable:n});return a.slice().forEach(r=>{r.call(i,s)}),!s.defaultPrevented}return!0}}function At(i,e){return Ri().$$.context.set(i,e),e}function Fe(i){return Ri().$$.context.get(i)}function Yr(){return Ri().$$.context}function je(i,e){let t=i.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}var Gi=[];var Re=[],Mn=[],Kr=[],gh=Promise.resolve(),Jr=!1;function eo(){Jr||(Jr=!0,gh.then(ha))}function us(){return eo(),gh}function Dt(i){Mn.push(i)}function Wt(i){Kr.push(i)}var Gr=new Set,Pn=0;function ha(){if(Pn!==0)return;let i=Ii;do{try{for(;Pn<Gi.length;){let e=Gi[Pn];Pn++,Ct(e),jg(e.$$)}}catch(e){throw Gi.length=0,Pn=0,e}for(Ct(null),Gi.length=0,Pn=0;Re.length;)Re.pop()();for(let e=0;e<Mn.length;e+=1){let t=Mn[e];Gr.has(t)||(Gr.add(t),t())}Mn.length=0}while(Gi.length);for(;Kr.length;)Kr.pop()();Jr=!1,Gr.clear(),Ct(i)}function jg(i){if(i.fragment!==null){i.update(),ce(i.before_update);let e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(Dt)}}function ph(i){let e=[],t=[];Mn.forEach(n=>i.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),Mn=e}var da;function Zg(){return da||(da=Promise.resolve(),da.then(()=>{da=null})),da}function to(i,e,t){i.dispatchEvent(la(`${e?"intro":"outro"}${t}`))}var fs=new Set,vi;function he(){vi={r:0,c:[],p:vi}}function de(){vi.r||ce(vi.c),vi=vi.p}function M(i,e){i&&i.i&&(fs.delete(i),i.i(e))}function Q(i,e,t,n){if(i&&i.o){if(fs.has(i))return;fs.add(i),vi.c.push(()=>{fs.delete(i),n&&(t&&i.d(1),n())}),i.o(e)}else n&&n()}var Xg={duration:0};function Ki(i,e,t,n){let s=e(i,t,{direction:"both"}),r=n?0:1,o=null,l=null,c=null,d;function h(){c&&ds(i,c)}function u(m,p){let y=m.b-r;return p*=Math.abs(y),{a:r,b:m.b,d:y,duration:p,start:m.start,end:m.start+p,group:m.group}}function f(m){let{delay:p=0,duration:y=300,easing:w=ai,tick:_=N,css:O}=s||Xg,E={start:Mi()+p,b:m};m||(E.group=vi,vi.r+=1),"inert"in i&&(m?d!==void 0&&(i.inert=d):(d=i.inert,i.inert=!0)),o||l?l=E:(O&&(h(),c=ca(i,r,m,y,p,w,O)),m&&_(0,1),o=u(E,y),Dt(()=>to(i,m,"start")),Vi(S=>{if(l&&S>l.start&&(o=u(l,y),l=null,to(i,o.b,"start"),O&&(h(),c=ca(i,r,o.b,o.duration,0,w,s.css))),o){if(S>=o.end)_(r=o.b,1-r),to(i,o.b,"end"),l||(o.b?h():--o.group.r||ce(o.group.c)),o=null;else if(S>=o.start){let v=S-o.start;r=o.a+o.d*w(v/o.duration),_(r,1-r)}}return!!(o||l)}))}return{run(m){Ie(s)?Zg().then(()=>{s=s({direction:m?"in":"out"}),f(m)}):f(m)},end(){h(),o=l=null}}}function bh(i,e){let t=e.token={};function n(a,s,r,o){if(e.token!==t)return;e.resolved=o;let l=e.ctx;r!==void 0&&(l=l.slice(),l[r]=o);let c=a&&(e.current=a)(l),d=!1;e.block&&(e.blocks?e.blocks.forEach((h,u)=>{u!==s&&h&&(he(),Q(h,1,1,()=>{e.blocks[u]===h&&(e.blocks[u]=null)}),de())}):e.block.d(1),c.c(),M(c,1),c.m(e.mount(),e.anchor),d=!0),e.block=c,e.blocks&&(e.blocks[s]=c),d&&ha()}if(th(i)){let a=Ri();if(i.then(s=>{Ct(a),n(e.then,1,e.value,s),Ct(null)},s=>{if(Ct(a),n(e.catch,2,e.error,s),Ct(null),!e.hasCatch)throw s}),e.current!==e.pending)return n(e.pending,0),!0}else{if(e.current!==e.then)return n(e.then,1,e.value,i),!0;e.resolved=i}}function yh(i,e,t){let n=e.slice(),{resolved:a}=i;i.current===i.then&&(n[i.value]=a),i.current===i.catch&&(n[i.error]=a),i.block.p(n,t)}function io(i,e){i.d(1),e.delete(i.key)}function Ji(i,e){Q(i,1,1,()=>{e.delete(i.key)})}function vh(i,e){i.f(),io(i,e)}function En(i,e){i.f(),Ji(i,e)}function gt(i,e,t,n,a,s,r,o,l,c,d,h){let u=i.length,f=s.length,m=u,p={};for(;m--;)p[i[m].key]=m;let y=[],w=new Map,_=new Map,O=[];for(m=f;m--;){let x=h(a,s,m),P=t(x),I=r.get(P);I?n&&O.push(()=>I.p(x,e)):(I=c(P,x),I.c()),w.set(P,y[m]=I),P in p&&_.set(P,Math.abs(m-p[P]))}let E=new Set,S=new Set;function v(x){M(x,1),x.m(o,d),r.set(x.key,x),d=x.first,f--}for(;u&&f;){let x=y[f-1],P=i[u-1],I=x.key,R=P.key;x===P?(d=x.first,u--,f--):w.has(R)?!r.has(I)||E.has(I)?v(x):S.has(R)?u--:_.get(I)>_.get(R)?(S.add(I),v(x)):(E.add(R),u--):(l(P,r),u--)}for(;u--;){let x=i[u];w.has(x.key)||l(x,r)}for(;f;)v(y[f-1]);return ce(O),y}function Wi(i,e){let t={},n={},a={$$scope:1},s=i.length;for(;s--;){let r=i[s],o=e[s];if(o){for(let l in r)l in o||(n[l]=1);for(let l in o)a[l]||(t[l]=o[l],a[l]=1);i[s]=o}else for(let l in r)a[l]=1}for(let r in n)r in t||(t[r]=void 0);return t}var qg=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],Ug=new Set([...qg]);function Nt(i,e,t){let n=i.$$.props[e];n!==void 0&&(i.$$.bound[n]=t,t(i.$$.ctx[n]))}function se(i){i&&i.c()}function ie(i,e,t){let{fragment:n,after_update:a}=i.$$;n&&n.m(e,t),Dt(()=>{let s=i.$$.on_mount.map(qr).filter(Ie);i.$$.on_destroy?i.$$.on_destroy.push(...s):ce(s),i.$$.on_mount=[]}),a.forEach(Dt)}function ne(i,e){let t=i.$$;t.fragment!==null&&(ph(t.after_update),ce(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Gg(i,e){i.$$.dirty[0]===-1&&(Gi.push(i),eo(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function G(i,e,t,n,a,s,r=null,o=[-1]){let l=Ii;Ct(i);let c=i.$$={fragment:null,ctx:[],props:s,update:N,not_equal:a,bound:rs(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(l?l.$$.context:[])),callbacks:rs(),dirty:o,skip_bound:!1,root:e.target||l.$$.root};r&&r(c.root);let d=!1;if(c.ctx=t?t(i,e.props||{},(h,u,...f)=>{let m=f.length?f[0]:u;return c.ctx&&a(c.ctx[h],c.ctx[h]=m)&&(!c.skip_bound&&c.bound[h]&&c.bound[h](m),d&&Gg(i,h)),u}):[],c.update(),d=!0,ce(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){lh();let h=fh(e.target);c.fragment&&c.fragment.l(h),h.forEach(A)}else c.fragment&&c.fragment.c();e.intro&&M(i.$$.fragment),ie(i,e.target,e.anchor),ch(),ha()}Ct(l)}var Kg;typeof HTMLElement=="function"&&(Kg=class extends HTMLElement{constructor(e,t,n){super();$e(this,"$$ctor");$e(this,"$$s");$e(this,"$$c");$e(this,"$$cn",!1);$e(this,"$$d",{});$e(this,"$$r",!1);$e(this,"$$p_d",{});$e(this,"$$l",{});$e(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=t,n&&this.attachShadow({mode:"open"})}addEventListener(e,t,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){let a=this.$$c.$on(e,t);this.$$l_u.set(t,a)}super.addEventListener(e,t,n)}removeEventListener(e,t,n){if(super.removeEventListener(e,t,n),this.$$c){let a=this.$$l_u.get(t);a&&(a(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(s){return()=>{let r;return{c:function(){r=k("slot"),s!=="default"&&g(r,"name",s)},m:function(c,d){D(c,r,d)},d:function(c){c&&A(r)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let t={},n=mh(this);for(let s of this.$$s)s in n&&(t[s]=[e(s)]);for(let s of this.attributes){let r=this.$$g_p(s.name);r in this.$$d||(this.$$d[r]=no(r,s.value,this.$$p_d,"toProp"))}for(let s in this.$$p_d)!(s in this.$$d)&&this[s]!==void 0&&(this.$$d[s]=this[s],delete this[s]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$scope:{ctx:[]}}});let a=()=>{this.$$r=!0;for(let s in this.$$p_d)if(this.$$d[s]=this.$$c.$$.ctx[this.$$c.$$.props[s]],this.$$p_d[s].reflect){let r=no(s,this.$$d[s],this.$$p_d,"toAttribute");r==null?this.removeAttribute(this.$$p_d[s].attribute||s):this.setAttribute(this.$$p_d[s].attribute||s,r)}this.$$r=!1};this.$$c.$$.after_update.push(a),a();for(let s in this.$$l)for(let r of this.$$l[s]){let o=this.$$c.$on(s,r);this.$$l_u.set(r,o)}this.$$l={}}}attributeChangedCallback(e,t,n){this.$$r||(e=this.$$g_p(e),this.$$d[e]=no(e,n,this.$$p_d,"toProp"),this.$$c?.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function no(i,e,t,n){let a=t[i]?.type;if(e=a==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!t[i])return e;if(n==="toAttribute")switch(a){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(a){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}var U=class{constructor(){$e(this,"$$");$e(this,"$$set")}$destroy(){ne(this,1),this.$destroy=N}$on(e,t){if(!Ie(t))return N;let n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{let a=n.indexOf(t);a!==-1&&n.splice(a,1)}}$set(e){this.$$set&&!nh(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};var Xt=require("obsidian");var Qn=[];function Jg(i,e){return{subscribe:Ne(i,e).subscribe}}function Ne(i,e=N){let t,n=new Set;function a(o){if(j(i,o)&&(i=o,t)){let l=!Qn.length;for(let c of n)c[1](),Qn.push(c,i);if(l){for(let c=0;c<Qn.length;c+=2)Qn[c][0](Qn[c+1]);Qn.length=0}}}function s(o){a(o(i))}function r(o,l=N){let c=[o,l];return n.add(c),n.size===1&&(t=e(a,s)||N),o(i),()=>{n.delete(c),n.size===0&&t&&(t(),t=null)}}return{set:a,update:s,subscribe:r}}function pt(i,e,t){let n=!Array.isArray(i),a=n?[i]:i;if(!a.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");let s=e.length<2;return Jg(t,(r,o)=>{let l=!1,c=[],d=0,h=N,u=()=>{if(d)return;h();let m=e(n?c[0]:c,r,o);s?r(m):h=Ie(m)?m:N},f=a.map((m,p)=>Tt(m,y=>{c[p]=y,d&=~(1<<p),l&&u()},()=>{d|=1<<p}));return l=!0,u(),function(){ce(f),h(),l=!1}})}function ep(i){re(i,"svelte-zyyfbl",`.bar.svelte-zyyfbl{height:5px;background:var(--active-bar-color);border:var(--active-bar-border-size) solid
var(--active-bar-border-color);z-index:1;width:auto}`)}function tp(i){let e;return{c(){e=k("div"),g(e,"class","bar svelte-zyyfbl")},m(t,n){D(t,e,n)},p:N,i:N,o:N,d(t){t&&A(e)}}}var ao=class extends U{constructor(e){super(),G(this,e,null,tp,j,{},ep)}},so=ao;var vs=require("obsidian");var In=require("obsidian");var ms="STATBLOCK-WIKI-LINK",ps=new RegExp(`<${ms}>([\\s\\S]+?)<${ms}>`),gs="STATBLOCK-MARKDOWN-LINK",bs=new RegExp(`<${gs}>([\\s\\S]+?)(?:\\|([\\s\\S]+?))?<${gs}>`),ro=/(<STATBLOCK-(?:WIKI|MARKDOWN)-LINK>[\s\S]+?<STATBLOCK-(?:WIKI|MARKDOWN)-LINK>)/,oi=class i{static isStatblockLink(e){return ro.test(e)}static replaceWikiLink(e){return`<${ms}>${e}<${ms}>`}static replaceMarkdownLink(e,t){return`<${gs}>${e}${t?"|"+t:""}<${gs}>`}static transformSource(e){return e.replace(/\[\[([\s\S]+?)\]\]/g,(t,n)=>i.replaceWikiLink(n)).replace(/\[([\s\S]*?)\]\(([\s\S]+?)\)/g,(t,n,a)=>i.replaceMarkdownLink(a,n))}static transformYamlSource(e){return i.transformSource(e)}static stringifyLinks(e){return e.replace(new RegExp(ps,"g"),(t,n)=>`[[${n}]]`).replace(new RegExp(bs,"g"),(t,n,a)=>`[${a||""}](${n})`)}};var ki,ua,lo,oo=class extends In.Component{constructor(){super(...arguments);Ee(this,ua);Ee(this,ki,new Map)}buildCache(){setTimeout(()=>{let t=this.metadataCache.getLinkSuggestions();for(let{alias:n,file:a}of t)n&&Qe(this,ua,lo).call(this,[n],a)},0)}getResolvedFile(t,n){t=t.trim();let a=te(this,ki).get(t)??te(this,ki).get(t.toLowerCase())??t;return{alias:te(this,ki).has(t)||te(this,ki).has(t.toLowerCase())?t:null,file:app.metadataCache.getFirstLinkpathDest(a,n)}}initialize(t){if(this.load(),this.metadataCache=t,t.initialized)this.buildCache();else{let n=app.metadataCache.on("resolved",()=>{this.buildCache(),this.metadataCache.offref(n)});this.registerEvent(n)}this.registerEvent(this.metadataCache.on("changed",n=>{let{frontmatter:a}=app.metadataCache.getFileCache(n)??{};if(!a)return;let s=(0,In.parseFrontMatterAliases)(a)??[];Qe(this,ua,lo).call(this,s,n)}))}linkify(t,n=""){let a=t.trim(),{file:s,alias:r}=this.getResolvedFile(a,n);return s!=null?t.replace(a,oi.replaceWikiLink(`${s.basename}${r?"|"+r:""}`)):t}linkifySpells(t,n=""){return t.replace(/(.+?)(\*?,|\*?$)/g,(a,s,r)=>`${this.linkify(s,n)}${r}`)}transformSource(t){return oi.transformSource(t)}transformYamlSource(t){return oi.transformYamlSource(t)}stringifyLinks(t){return oi.stringifyLinks(t)}splitByLinks(t,n,a){return ye(t).split(ro).filter(s=>s&&s.length).map(s=>{if(ps.test(s)){let r=s.match(ps)[1];return{isLink:a,text:`[[${(0,In.normalizePath)(r)}]]`}}if(bs.test(s)){let[r,o,l]=s.match(bs);return{isLink:a,text:`[${l||""}](${o})`}}return{isLink:!1,text:s}})}};ki=new WeakMap,ua=new WeakSet,lo=function(t,n){for(let a of t)te(this,ki).set(a,n.name),te(this,ki).set(a.toLowerCase(),n.name)};var ct=new oo;function kh(i,e,t){let n=new Map,a=new Map,s=i.diceParsing??ys();for(let o of s){n.set(o.id,new RegExp(o.regex));let l=`
let anon = (original, matches, monster) => {
${o.parser};
}
let result;
try {
result = anon(original, matches, monster);
} catch(e) {
console.error(e);
result = original;
} finally {
return result;
}
`,c=new Function("original","matches","monster",l);a.set(o.id,c)}for(let{id:o}of s){let l=n.get(o);e=e.replaceAll(new RegExp(l,"g"),c=>`<MATCHED_DICE><ID>${o}<ID>${c}<MATCHED_DICE>`)}let r=[];for(let o of e.split(/(<MATCHED_DICE>.+?<MATCHED_DICE>)/)){if(!/<MATCHED_DICE>.+?<MATCHED_DICE>/.test(o)){r.push(o);continue}let[,l,c]=o.match(/<MATCHED_DICE><ID>(.+?)<ID>(.+)<MATCHED_DICE>/)??[];if(!l||!c){r.push(o);continue}let d=n.get(l),h=a.get(l),u=c.match(d),f=h.call(void 0,c,u,t);!f||Array.isArray(f)&&!f.every(m=>typeof m=="string"||m?.text?.length)||!Array.isArray(f)&&typeof f=="object"&&!f.text?.length?r.push(c):Array.isArray(f)?r.push(...f):r.push(f)}return r}function ys(){return[{regex:/([\+\-])(\d+) to hit/.source,parser:`let [, sign, number] = matches;
let mult = 1;
if (sign === "-") {
mult = -1;
}
if (!isNaN(Number(number))) {
return {
text: \`1d20+\${mult * Number(number)}\`,
original
}
}`,id:q(),desc:"+10 to hit"},{regex:/(\d+)\s\((\d+d\d+(?:\s*[+\-]\s*\d+)?)\)/.source,parser:`let [, base, dice] = matches;
let text;
if (!isNaN(Number(base)) && dice) {
text = dice;
}
return { text, original: dice ?? original };`,id:q(),desc:"4 (1d6 + 1)"},{regex:/(.+) ([\+\-])(\d+)/.source,parser:`let [, save, sign, number] = matches;
let mult = 1;
if (sign === "-") {
mult = -1;
}
let text;
if (!isNaN(Number(number))) {
text = \`1d20+\${mult * Number(number)}\`;
original = \`\${save} \${sign}\${number}\`;
}
return { text, original };`,id:q(),desc:"+5"}]}function ip(i){re(i,"svelte-1c3hzq4",".statblock-markdown.svelte-1c3hzq4{display:inline}.statblock-markdown.svelte-1c3hzq4 p{display:inline}.statblock-markdown.svelte-1c3hzq4 p ~ p{display:inline-block}")}function np(i){let e,t,n,a;return{c(){e=k("div"),g(e,"class","statblock-markdown svelte-1c3hzq4")},m(s,r){D(s,e,r),n||(a=ee(t=i[1].call(null,e)),n=!0)},p:N,i:N,o:N,d(s){s&&A(e),n=!1,a()}}}function ap(i,e,t){let n,{property:a}=e;a=typeof a=="string"?ct.stringifyLinks(a):a;let s=Fe("context"),r=Fe("renderer"),o=Fe("item"),l=Fe("dice"),c=o.dice,d=Fe("monster");Se(i,d,y=>t(5,n=y));let h=n;d.subscribe(y=>h=y);let u=Fe("plugin"),f=Fe("layout"),m=[a];if(l&&c)if(o.diceProperty&&o.diceProperty in h&&typeof h[o.diceProperty]=="string")m=[{text:h[o.diceProperty]}];else{let y=kh(f,a,h);Array.isArray(y)?m=y:m=[y]}if(l&&o.diceCallback)try{let y=document.body.createEl("iframe"),w=y.contentWindow.Function,O=new w("monster","property",o.diceCallback).call(void 0,h,a)??a;document.body.removeChild(y),Array.isArray(O)?m=O:m=[O]}catch(y){new vs.Notice(`There was an error executing the provided dice callback for [${o.properties.join(", ")}]
${y.message}`),console.error(y)}a="";for(let y of m)if(l&&typeof y!="string"){let w,_=u.getRollerString(y.text);y.original?w=`${y.original} (\`dice: ${_}\`)`:w=`\`dice: ${_}\``,a+=w}else a+=y;let p=y=>{a==="-"&&t(2,a="\\-"),vs.MarkdownRenderer.render(u.app,a,y,s,r)};return i.$$set=y=>{"property"in y&&t(2,a=y.property)},[d,p,a]}var co=class extends U{constructor(e){super(),G(this,e,ap,np,j,{property:2},ip)}},wh=co;function sp(i){let e,t;return e=new wh({props:{property:i[0]}}),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},p(n,[a]){let s={};a&1&&(s.property=n[0]),e.$set(s)},i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function rp(i,e,t){let{property:n=""}=e;return i.$$set=a=>{"property"in a&&t(0,n=a.property)},[n]}var ho=class extends U{constructor(e){super(),G(this,e,rp,sp,j,{property:0})}},bt=ho;var Th=require("obsidian");function op(i){re(i,"svelte-1d2gp4n",".trait.svelte-1d2gp4n{font-family:var(--active-traits-font);color:var(--active-traits-font-color);font-size:var(--active-traits-font-size);font-weight:var(--active-traits-font-weight);font-style:var(--active-traits-font-style)}.trait-name.svelte-1d2gp4n{font-family:var(--active-traits-name-font);color:var(--active-traits-name-font-color);font-size:var(--active-traits-name-font-size);font-weight:var(--active-traits-name-font-weight);font-style:var(--active-traits-name-font-style)}.property-name.svelte-1d2gp4n{margin:0;margin-right:0.25em;display:inline}.statblock-nested-traits.svelte-1d2gp4n{margin-left:1rem}")}function _h(i,e,t){let n=i.slice();return n[7]=e[t],n}function Oh(i){let e,t,n;return t=new bt({props:{property:i[2]}}),{c(){e=k("div"),se(t.$$.fragment),g(e,"class","property-name trait-name svelte-1d2gp4n")},m(a,s){D(a,e,s),ie(t,e,null),n=!0},p(a,s){let r={};s&4&&(r.property=a[2]),t.$set(r)},i(a){n||(M(t.$$.fragment,a),n=!0)},o(a){Q(t.$$.fragment,a),n=!1},d(a){a&&A(e),ne(t)}}}function Sh(i){let e,t,n=i[1].traits,a=[];for(let r=0;r<n.length;r+=1)a[r]=xh(_h(i,n,r));let s=r=>Q(a[r],1,1,()=>{a[r]=null});return{c(){e=k("div");for(let r=0;r<a.length;r+=1)a[r].c();g(e,"class","statblock-nested-traits svelte-1d2gp4n")},m(r,o){D(r,e,o);for(let l=0;l<a.length;l+=1)a[l]&&a[l].m(e,null);t=!0},p(r,o){if(o&26){n=r[1].traits;let l;for(l=0;l<n.length;l+=1){let c=_h(r,n,l);a[l]?(a[l].p(c,o),M(a[l],1)):(a[l]=xh(c),a[l].c(),M(a[l],1),a[l].m(e,null))}for(he(),l=n.length;l<a.length;l+=1)s(l);de()}},i(r){if(!t){for(let o=0;o<n.length;o+=1)M(a[o]);t=!0}},o(r){a=a.filter(Boolean);for(let o=0;o<a.length;o+=1)Q(a[o]);t=!1},d(r){r&&A(e),Xe(a,r)}}}function xh(i){let e,t;return e=new ks({props:{name:i[7].name,desc:i[7].desc,property:i[3],item:i[4],nested:i[7]}}),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},p(n,a){let s={};a&2&&(s.name=n[7].name),a&2&&(s.desc=n[7].desc),a&8&&(s.property=n[3]),a&16&&(s.item=n[4]),a&2&&(s.nested=n[7]),e.$set(s)},i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function lp(i){let e,t,n,a,s,r,o=i[2]&&Oh(i);n=new bt({props:{property:i[0]}});let l=i[1]?.traits&&Sh(i);return{c(){e=k("div"),o&&o.c(),t=W(),se(n.$$.fragment),a=W(),l&&l.c(),g(e,"class",s="property "+i[5]+" trait svelte-1d2gp4n")},m(c,d){D(c,e,d),o&&o.m(e,null),b(e,t),ie(n,e,null),b(e,a),l&&l.m(e,null),r=!0},p(c,[d]){c[2]?o?(o.p(c,d),d&4&&M(o,1)):(o=Oh(c),o.c(),M(o,1),o.m(e,t)):o&&(he(),Q(o,1,1,()=>{o=null}),de());let h={};d&1&&(h.property=c[0]),n.$set(h),c[1]?.traits?l?(l.p(c,d),d&2&&M(l,1)):(l=Sh(c),l.c(),M(l,1),l.m(e,null)):l&&(he(),Q(l,1,1,()=>{l=null}),de()),(!r||d&32&&s!==(s="property "+c[5]+" trait svelte-1d2gp4n"))&&g(e,"class",s)},i(c){r||(M(o),M(n.$$.fragment,c),M(l),r=!0)},o(c){Q(o),Q(n.$$.fragment,c),Q(l),r=!1},d(c){c&&A(e),o&&o.d(),ne(n),l&&l.d()}}}function cp(i,e,t){let n,{trait:a}=e,{name:s}=e,{desc:r}=e,{property:o=""}=e,{item:l}=e,{monster:c}=e;if(l.callback)try{let d=document.body.createEl("iframe"),h=d.contentWindow.Function;r=new h("monster","property",l.callback).call(void 0,c,a)??r,document.body.removeChild(d)}catch(d){new Th.Notice(`There was an error executing the provided callback for [${l.properties.join(", ")}]
${d.message}`),console.error(d)}return i.$$set=d=>{"trait"in d&&t(1,a=d.trait),"name"in d&&t(2,s=d.name),"desc"in d&&t(0,r=d.desc),"property"in d&&t(3,o=d.property),"item"in d&&t(4,l=d.item),"monster"in d&&t(6,c=d.monster)},i.$$.update=()=>{i.$$.dirty&28&&t(5,n=l.doNotAddClass?[]:[ii(s),ii(o)].join(" "))},[r,a,s,o,l,n,c]}var ks=class extends U{constructor(e){super(),G(this,e,cp,lp,j,{trait:1,name:2,desc:0,property:3,item:4,monster:6},op)}},fa=ks;var ws=require("obsidian");function hp(i){re(i,"svelte-1lnliuc",".inline.svelte-1lnliuc{display:inline}")}function Ch(i,e,t){let n=i.slice();return n[6]=e[t],n}function dp(i){let e=i[6].text+"",t;return{c(){t=me(e)},m(n,a){D(n,t,a)},p:N,d(n){n&&A(t)}}}function up(i){let e,t,n={ctx:i,current:null,token:null,hasCatch:!1,pending:gp,then:mp,catch:fp,value:9};return bh(t=i[1](i[6].text),n),{c(){e=Oe(),n.block.c()},m(a,s){D(a,e,s),n.block.m(a,n.anchor=s),n.mount=()=>e.parentNode,n.anchor=e},p(a,s){i=a,yh(n,i,s)},d(a){a&&A(e),n.block.d(a),n.token=null,n=null}}}function fp(i){return{c:N,m:N,p:N,d:N}}function mp(i){let e,t=i[9]+"",n;return{c(){e=new pi(!1),n=Oe(),e.a=n},m(a,s){e.m(t,a,s),D(a,n,s)},p:N,d(a){a&&A(n),a&&e.d()}}}function gp(i){return{c:N,m:N,p:N,d:N}}function Ah(i){let e;function t(s,r){return s[6].isLink?up:dp}let a=t(i,-1)(i);return{c(){a.c(),e=Oe()},m(s,r){a.m(s,r),D(s,e,r)},p(s,r){a.p(s,r)},d(s){a.d(s),s&&A(e)}}}function pp(i){let e,t=i[0],n=[];for(let a=0;a<t.length;a+=1)n[a]=Ah(Ch(i,t,a));return{c(){e=k("div");for(let a=0;a<n.length;a+=1)n[a].c();g(e,"class","statblock-rendered-text-content inline svelte-1lnliuc")},m(a,s){D(a,e,s);for(let r=0;r<n.length;r+=1)n[r]&&n[r].m(e,null)},p(a,[s]){if(s&3){t=a[0];let r;for(r=0;r<t.length;r+=1){let o=Ch(a,t,r);n[r]?n[r].p(o,s):(n[r]=Ah(o),n[r].c(),n[r].m(e,null))}for(;r<n.length;r+=1)n[r].d(1);n.length=t.length}},i:N,o:N,d(a){a&&A(e),Xe(n,a)}}}function bp(i,e,t){let{textToRender:n}=e,a=Fe("tryToRenderLinks"),s=Fe("context"),r=new ws.Component,o=ct.splitByLinks(n,s,a),l=async c=>{let d=createDiv();return await ws.MarkdownRenderer.render(app,c,d,s,r),d.querySelector("a").outerHTML};return i.$$set=c=>{"textToRender"in c&&t(2,n=c.textToRender)},[o,l,n]}var uo=class extends U{constructor(e){super(),G(this,e,bp,pp,j,{textToRender:2},hp)}},Zt=uo;function yp(i){re(i,"svelte-14k5qsm",".flex-container.svelte-14k5qsm{display:flex;justify-content:space-between;align-items:center}.heading.svelte-14k5qsm{font-family:var(--active-heading-font);color:var(--active-heading-font-color);font-weight:var(--active-heading-font-weight);font-variant:var(--active-heading-font-variant);font-size:var(--active-heading-font-size);line-height:var(--active-heading-line-height);margin:0px;letter-spacing:1px;display:flex;justify-content:space-between;align-items:center}")}function Dh(i,e,t){let n=i.slice();return n[2]=e[t],n}function Ph(i){let e,t,n,a,s=[Sp,Op,_p,wp,kp,vp],r=[];function o(l,c){return!l[1].size||l[1].size==1?0:l[1].size==2?1:l[1].size==3?2:l[1].size==4?3:l[1].size==5?4:5}return e=o(i,-1),t=r[e]=s[e](i),{c(){t.c(),n=Oe()},m(l,c){r[e].m(l,c),D(l,n,c),a=!0},p(l,c){let d=e;e=o(l,c),e===d?r[e].p(l,c):(he(),Q(r[d],1,1,()=>{r[d]=null}),de(),t=r[e],t?t.p(l,c):(t=r[e]=s[e](l),t.c()),M(t,1),t.m(n.parentNode,n))},i(l){a||(M(t),a=!0)},o(l){Q(t),a=!1},d(l){r[e].d(l),l&&A(n)}}}function vp(i){let e,t,n,a,s;return t=new Zt({props:{textToRender:ye(i[0][i[2]])}}),{c(){e=k("h6"),se(t.$$.fragment),n=W(),g(e,"class",a="heading statblock-heading "+ye(i[2])+" svelte-14k5qsm")},m(r,o){D(r,e,o),ie(t,e,null),b(e,n),s=!0},p(r,o){let l={};o&3&&(l.textToRender=ye(r[0][r[2]])),t.$set(l),(!s||o&2&&a!==(a="heading statblock-heading "+ye(r[2])+" svelte-14k5qsm"))&&g(e,"class",a)},i(r){s||(M(t.$$.fragment,r),s=!0)},o(r){Q(t.$$.fragment,r),s=!1},d(r){r&&A(e),ne(t)}}}function kp(i){let e,t,n,a,s;return t=new Zt({props:{textToRender:ye(i[0][i[2]])}}),{c(){e=k("h5"),se(t.$$.fragment),n=W(),g(e,"class",a="heading statblock-heading "+ye(i[2])+" svelte-14k5qsm")},m(r,o){D(r,e,o),ie(t,e,null),b(e,n),s=!0},p(r,o){let l={};o&3&&(l.textToRender=ye(r[0][r[2]])),t.$set(l),(!s||o&2&&a!==(a="heading statblock-heading "+ye(r[2])+" svelte-14k5qsm"))&&g(e,"class",a)},i(r){s||(M(t.$$.fragment,r),s=!0)},o(r){Q(t.$$.fragment,r),s=!1},d(r){r&&A(e),ne(t)}}}function wp(i){let e,t,n,a,s;return t=new Zt({props:{textToRender:ye(i[0][i[2]])}}),{c(){e=k("h4"),se(t.$$.fragment),n=W(),g(e,"class",a="heading statblock-heading "+ye(i[2])+" svelte-14k5qsm")},m(r,o){D(r,e,o),ie(t,e,null),b(e,n),s=!0},p(r,o){let l={};o&3&&(l.textToRender=ye(r[0][r[2]])),t.$set(l),(!s||o&2&&a!==(a="heading statblock-heading "+ye(r[2])+" svelte-14k5qsm"))&&g(e,"class",a)},i(r){s||(M(t.$$.fragment,r),s=!0)},o(r){Q(t.$$.fragment,r),s=!1},d(r){r&&A(e),ne(t)}}}function _p(i){let e,t,n,a,s;return t=new Zt({props:{textToRender:ye(i[0][i[2]])}}),{c(){e=k("h3"),se(t.$$.fragment),n=W(),g(e,"class",a="heading statblock-heading "+ye(i[2])+" svelte-14k5qsm")},m(r,o){D(r,e,o),ie(t,e,null),b(e,n),s=!0},p(r,o){let l={};o&3&&(l.textToRender=ye(r[0][r[2]])),t.$set(l),(!s||o&2&&a!==(a="heading statblock-heading "+ye(r[2])+" svelte-14k5qsm"))&&g(e,"class",a)},i(r){s||(M(t.$$.fragment,r),s=!0)},o(r){Q(t.$$.fragment,r),s=!1},d(r){r&&A(e),ne(t)}}}function Op(i){let e,t,n,a,s;return t=new Zt({props:{textToRender:ye(i[0][i[2]])}}),{c(){e=k("h2"),se(t.$$.fragment),n=W(),g(e,"class",a="heading statblock-heading "+ye(i[2])+" svelte-14k5qsm")},m(r,o){D(r,e,o),ie(t,e,null),b(e,n),s=!0},p(r,o){let l={};o&3&&(l.textToRender=ye(r[0][r[2]])),t.$set(l),(!s||o&2&&a!==(a="heading statblock-heading "+ye(r[2])+" svelte-14k5qsm"))&&g(e,"class",a)},i(r){s||(M(t.$$.fragment,r),s=!0)},o(r){Q(t.$$.fragment,r),s=!1},d(r){r&&A(e),ne(t)}}}function Sp(i){let e,t,n,a,s;return t=new Zt({props:{textToRender:ye(i[0][i[2]])}}),{c(){e=k("h1"),se(t.$$.fragment),n=W(),g(e,"class",a="heading statblock-heading "+ye(i[2])+" svelte-14k5qsm")},m(r,o){D(r,e,o),ie(t,e,null),b(e,n),s=!0},p(r,o){let l={};o&3&&(l.textToRender=ye(r[0][r[2]])),t.$set(l),(!s||o&2&&a!==(a="heading statblock-heading "+ye(r[2])+" svelte-14k5qsm"))&&g(e,"class",a)},i(r){s||(M(t.$$.fragment,r),s=!0)},o(r){Q(t.$$.fragment,r),s=!1},d(r){r&&A(e),ne(t)}}}function Mh(i){let e,t,n=i[2]in i[0]&&Ph(i);return{c(){n&&n.c(),e=Oe()},m(a,s){n&&n.m(a,s),D(a,e,s),t=!0},p(a,s){a[2]in a[0]?n?(n.p(a,s),s&3&&M(n,1)):(n=Ph(a),n.c(),M(n,1),n.m(e.parentNode,e)):n&&(he(),Q(n,1,1,()=>{n=null}),de())},i(a){t||(M(n),t=!0)},o(a){Q(n),t=!1},d(a){n&&n.d(a),a&&A(e)}}}function xp(i){let e,t,n=i[1].properties,a=[];for(let r=0;r<n.length;r+=1)a[r]=Mh(Dh(i,n,r));let s=r=>Q(a[r],1,1,()=>{a[r]=null});return{c(){e=k("div");for(let r=0;r<a.length;r+=1)a[r].c();g(e,"class","flex-container svelte-14k5qsm")},m(r,o){D(r,e,o);for(let l=0;l<a.length;l+=1)a[l]&&a[l].m(e,null);t=!0},p(r,[o]){if(o&3){n=r[1].properties;let l;for(l=0;l<n.length;l+=1){let c=Dh(r,n,l);a[l]?(a[l].p(c,o),M(a[l],1)):(a[l]=Mh(c),a[l].c(),M(a[l],1),a[l].m(e,null))}for(he(),l=n.length;l<a.length;l+=1)s(l);de()}},i(r){if(!t){for(let o=0;o<n.length;o+=1)M(a[o]);t=!0}},o(r){a=a.filter(Boolean);for(let o=0;o<a.length;o+=1)Q(a[o]);t=!1},d(r){r&&A(e),Xe(a,r)}}}function Tp(i,e,t){let{monster:n}=e,{item:a}=e;return i.$$set=s=>{"monster"in s&&t(0,n=s.monster),"item"in s&&t(1,a=s.item)},[n,a]}var fo=class extends U{constructor(e){super(),G(this,e,Tp,xp,j,{monster:0,item:1},yp)}},Eh=fo;var Ih=require("obsidian");function Cp(i){re(i,"svelte-1rketb6",".line.svelte-1rketb6{line-height:var(--active-property-line-height);display:block;font-family:var(--active-property-font);color:var(--active-property-font-color);font-variant:var(--active-property-font-variant);font-size:var(--active-property-font-size);font-weight:var(--active-property-font-weight)}.property-name.svelte-1rketb6{margin:0;margin-right:0.25em;display:inline;font-family:var(--active-property-name-font);color:var(--active-property-name-font-color);font-variant:var(--active-property-name-font-variant);font-size:var(--active-property-name-font-size);font-weight:var(--active-property-name-font-weight)}")}function Qh(i){let e,t,n,a,s,r;return a=new bt({props:{property:i[1]}}),{c(){e=k("div"),t=k("span"),t.textContent=`${i[3]}`,n=W(),se(a.$$.fragment),g(t,"class","property-name svelte-1rketb6"),g(e,"class",s="line "+i[2]+" svelte-1rketb6")},m(o,l){D(o,e,l),b(e,t),b(e,n),ie(a,e,null),r=!0},p(o,l){let c={};l&2&&(c.property=o[1]),a.$set(c),(!r||l&4&&s!==(s="line "+o[2]+" svelte-1rketb6"))&&g(e,"class",s)},i(o){r||(M(a.$$.fragment,o),r=!0)},o(o){Q(a.$$.fragment,o),r=!1},d(o){o&&A(e),ne(a)}}}function Ap(i){let e,t,n=(!i[0].conditioned||i[0].conditioned&&`${i[1]}`.length)&&Qh(i);return{c(){n&&n.c(),e=Oe()},m(a,s){n&&n.m(a,s),D(a,e,s),t=!0},p(a,[s]){!a[0].conditioned||a[0].conditioned&&`${a[1]}`.length?n?(n.p(a,s),s&3&&M(n,1)):(n=Qh(a),n.c(),M(n,1),n.m(e.parentNode,e)):n&&(he(),Q(n,1,1,()=>{n=null}),de())},i(a){t||(M(n),t=!0)},o(a){Q(n),t=!1},d(a){n&&n.d(a),a&&A(e)}}}function Dp(i,e,t){let n,{monster:a}=e,{item:s}=e,r=ye(a[s.properties[0]]),o=s.display??s.properties[0];if(s.callback)try{let l=document.body.createEl("iframe"),c=l.contentWindow.Function;r=new c("monster",s.callback).call(void 0,a)??r,document.body.removeChild(l)}catch(l){new Ih.Notice(`There was an error executing the provided callback for [${s.properties.join(", ")}]
${l.message}`),console.error(l)}return!s.conditioned&&!`${r}`.length&&(r=s.fallback??"-"),i.$$set=l=>{"monster"in l&&t(4,a=l.monster),"item"in l&&t(0,s=l.item)},i.$$.update=()=>{i.$$.dirty&1&&t(2,n=s.doNotAddClass?"":ii(s.properties[0]))},[s,r,n,o,a]}var mo=class extends U{constructor(e){super(),G(this,e,Dp,Ap,j,{monster:4,item:0},Cp)}},Rh=mo;function Pp(i){re(i,"svelte-k72li0",`.tapered-rule.svelte-k72li0{width:auto;margin:0.5em 0;height:5px;background:-webkit-linear-gradient(
0deg,
var(--active-rule-color) 0%,
var(--active-rule-color) 50%,
var(--active-background-color) 95%,
var(--active-background-color) 100%
);clip-path:polygon(0 0, 0 100%, 95% 50%);-webkit-clip-path:polygon(0 0, 0 100%, 95% 50%)}`)}function Mp(i){let e;return{c(){e=k("div"),g(e,"class","tapered-rule svelte-k72li0")},m(t,n){D(t,e,n)},p:N,i:N,o:N,d(t){t&&A(e)}}}var go=class extends U{constructor(e){super(),G(this,e,null,Mp,j,{},Pp)}},_s=go;function Ep(i){re(i,"svelte-r9sicd",".line.svelte-r9sicd{line-height:var(--active-saves-line-height);display:block;color:var(--active-font-color)}.property-name.svelte-r9sicd{color:var(--active-property-name-font-color);margin:0;margin-right:0.25em;display:inline;font-weight:bold}.property-text.svelte-r9sicd{display:inline;margin:0}")}function Qp(i){let e,t,n,a=(i[0].display??sa(i[0].properties[0]))+"",s,r,o,l,c;return l=new bt({props:{render:i[0].markdown,property:i[1]}}),{c(){e=k("div"),t=k("div"),n=k("span"),s=me(a),r=W(),o=k("div"),se(l.$$.fragment),g(n,"class","property-name svelte-r9sicd"),g(o,"class","property-text svelte-r9sicd"),g(t,"class","line svelte-r9sicd"),g(e,"class","info")},m(d,h){D(d,e,h),b(e,t),b(t,n),b(n,s),b(t,r),b(t,o),ie(l,o,null),c=!0},p(d,[h]){(!c||h&1)&&a!==(a=(d[0].display??sa(d[0].properties[0]))+"")&&we(s,a);let u={};h&1&&(u.render=d[0].markdown),l.$set(u)},i(d){c||(M(l.$$.fragment,d),c=!0)},o(d){Q(l.$$.fragment,d),c=!1},d(d){d&&A(e),ne(l)}}}function Ip(i){return`${i>0?"+":""}${i}`}function Rp(i,e,t){let{monster:n}=e,{item:a}=e,s=n[a.properties[0]];Array.isArray(s)||(s=[]);let r=s.map(o=>{if(typeof o!="object"||o==null)return null;let l=Object.keys(o)[0];if(!l)return null;let c=Object.values(o)[0];return typeof c=="string"&&isNaN(Number(c))?`${sa(l)} ${c}`:!c||isNaN(Number(c))?null:`${sa(l)} ${Ip(c)}`}).filter(o=>o).join(", ");return i.$$set=o=>{"monster"in o&&t(2,n=o.monster),"item"in o&&t(0,a=o.item)},[a,r,n]}var po=class extends U{constructor(e){super(),G(this,e,Rp,Qp,j,{monster:2,item:0},Ep)}},Wh=po;function Wp(i){re(i,"svelte-1ascaxr",`.section-header.svelte-1ascaxr{border-bottom:var(--active-section-heading-border-size) solid
var(--active-section-heading-border-color);color:var(--active-section-heading-font-color);font-size:var(--active-section-heading-font-size);font-variant:var(--active-section-heading-font-variant);font-weight:var(--active-section-heading-font-weight);font-family:var(--active-section-heading-font);letter-spacing:1px;margin:0;margin-bottom:0.3em;break-inside:avoid-column;break-after:avoid-column}`)}function Nh(i){let e,t,n,a;return t=new Zt({props:{textToRender:i[0]}}),{c(){e=k("h3"),se(t.$$.fragment),g(e,"class",n="section-header "+i[1](i[0])+" svelte-1ascaxr")},m(s,r){D(s,e,r),ie(t,e,null),a=!0},p(s,r){let o={};r&1&&(o.textToRender=s[0]),t.$set(o),(!a||r&1&&n!==(n="section-header "+s[1](s[0])+" svelte-1ascaxr"))&&g(e,"class",n)},i(s){a||(M(t.$$.fragment,s),a=!0)},o(s){Q(t.$$.fragment,s),a=!1},d(s){s&&A(e),ne(t)}}}function Np(i){let e,t,n=i[0]&&i[0].length&&Nh(i);return{c(){n&&n.c(),e=Oe()},m(a,s){n&&n.m(a,s),D(a,e,s),t=!0},p(a,[s]){a[0]&&a[0].length?n?(n.p(a,s),s&1&&M(n,1)):(n=Nh(a),n.c(),M(n,1),n.m(e.parentNode,e)):n&&(he(),Q(n,1,1,()=>{n=null}),de())},i(a){t||(M(n),t=!0)},o(a){Q(n),t=!1},d(a){n&&n.d(a),a&&A(e)}}}function Lp(i,e,t){let{monster:n}=e,{item:a}=e,s;if(a.headingProp){if(a.heading in n){let o=ye(n[a.heading]);o.length&&(s=o)}}else a.heading?.length&&(s=a.heading);let r=o=>o.toLowerCase().replace(/[^A-Za-z0-9\s]/g,"").replace(/\s+/g,"-");return i.$$set=o=>{"monster"in o&&t(2,n=o.monster),"item"in o&&t(3,a=o.item)},[s,r,n,a]}var bo=class extends U{constructor(e){super(),G(this,e,Lp,Np,j,{monster:2,item:3},Wp)}},Rn=bo;function $p(i){re(i,"svelte-1fyuyh",".subheading.svelte-1fyuyh{font-weight:var(--active-subheading-font-weight);font-style:var(--active-subheading-font-style);font-size:var(--active-subheading-font-size);font-family:var(--active-subheading-font-family);color:var(--active-subheading-font-color);margin:0}")}function Bp(i){let e,t,n;return t=new Zt({props:{textToRender:i[1].join(i[0].separator)}}),{c(){e=k("div"),se(t.$$.fragment),g(e,"class","subheading svelte-1fyuyh")},m(a,s){D(a,e,s),ie(t,e,null),n=!0},p(a,s){let r={};s&1&&(r.textToRender=a[1].join(a[0].separator)),t.$set(r)},i(a){n||(M(t.$$.fragment,a),n=!0)},o(a){Q(t.$$.fragment,a),n=!1},d(a){a&&A(e),ne(t)}}}function zp(i){let e,t,n=i[1].length&&Bp(i);return{c(){n&&n.c(),e=Oe()},m(a,s){n&&n.m(a,s),D(a,e,s),t=!0},p(a,[s]){a[1].length&&n.p(a,s)},i(a){t||(M(n),t=!0)},o(a){Q(n),t=!1},d(a){n&&n.d(a),a&&A(e)}}}function Hp(i,e,t){let{monster:n}=e,{item:a}=e,s=[];for(let r of a.properties)r in n&&s.push(`${ye(n[r])}`);return i.$$set=r=>{"monster"in r&&t(2,n=r.monster),"item"in r&&t(0,a=r.item)},[a,s,n]}var yo=class extends U{constructor(e){super(),G(this,e,Hp,zp,j,{monster:2,item:0},$p)}},Lh=yo;function Fp(i){re(i,"svelte-gjlmp0",".statblock-table-header.svelte-gjlmp0{font-weight:var(--active-table-header-font-weight)}.statblock-table.svelte-gjlmp0{display:flex;justify-content:space-evenly;align-items:center;flex-wrap:wrap}.table-item.svelte-gjlmp0{display:flex;justify-content:center;align-items:center;flex-flow:column nowrap}")}function $h(i,e,t){let n=i.slice();return n[6]=e[t][0],n[1]=e[t][1],n}function Bh(i,e,t){let n=i.slice();return n[9]=e[t],n}function zh(i){let e,t=i[2](i[9])+"",n;return{c(){e=k("span"),n=me(t)},m(a,s){D(a,e,s),b(e,n)},p:N,d(a){a&&A(e)}}}function Hh(i){let e,t,n,a;t=new bt({props:{property:ye(i[9])}});let s=i[0].calculate&&zh(i);return{c(){e=k("span"),se(t.$$.fragment),n=W(),s&&s.c()},m(r,o){D(r,e,o),ie(t,e,null),b(e,n),s&&s.m(e,null),a=!0},p(r,o){r[0].calculate?s?s.p(r,o):(s=zh(r),s.c(),s.m(e,null)):s&&(s.d(1),s=null)},i(r){a||(M(t.$$.fragment,r),a=!0)},o(r){Q(t.$$.fragment,r),a=!1},d(r){r&&A(e),ne(t),s&&s.d()}}}function Fh(i){let e,t,n=i[4][i[6]]+"",a,s,r,o,l=i[1],c=[];for(let h=0;h<l.length;h+=1)c[h]=Hh(Bh(i,l,h));let d=h=>Q(c[h],1,1,()=>{c[h]=null});return{c(){e=k("div"),t=k("span"),a=me(n),s=W();for(let h=0;h<c.length;h+=1)c[h].c();r=W(),g(t,"class","statblock-table-header svelte-gjlmp0"),g(e,"class","table-item svelte-gjlmp0")},m(h,u){D(h,e,u),b(e,t),b(t,a),b(e,s);for(let f=0;f<c.length;f+=1)c[f]&&c[f].m(e,null);b(e,r),o=!0},p(h,u){if(u&29){l=h[1];let f;for(f=0;f<l.length;f+=1){let m=Bh(h,l,f);c[f]?(c[f].p(m,u),M(c[f],1)):(c[f]=Hh(m),c[f].c(),M(c[f],1),c[f].m(e,r))}for(he(),f=l.length;f<c.length;f+=1)d(f);de()}},i(h){if(!o){for(let u=0;u<l.length;u+=1)M(c[u]);o=!0}},o(h){c=c.filter(Boolean);for(let u=0;u<c.length;u+=1)Q(c[u]);o=!1},d(h){h&&A(e),Xe(c,h)}}}function jp(i){let e,t,n=[...i[3].entries()].slice(0,i[4].length),a=[];for(let r=0;r<n.length;r+=1)a[r]=Fh($h(i,n,r));let s=r=>Q(a[r],1,1,()=>{a[r]=null});return{c(){e=k("div");for(let r=0;r<a.length;r+=1)a[r].c();g(e,"class","statblock-table svelte-gjlmp0")},m(r,o){D(r,e,o);for(let l=0;l<a.length;l+=1)a[l]&&a[l].m(e,null);t=!0},p(r,[o]){if(o&29){n=[...r[3].entries()].slice(0,r[4].length);let l;for(l=0;l<n.length;l+=1){let c=$h(r,n,l);a[l]?(a[l].p(c,o),M(a[l],1)):(a[l]=Fh(c),a[l].c(),M(a[l],1),a[l].m(e,null))}for(he(),l=n.length;l<a.length;l+=1)s(l);de()}},i(r){if(!t){for(let o=0;o<n.length;o+=1)M(a[o]);t=!0}},o(r){a=a.filter(Boolean);for(let o=0;o<a.length;o+=1)Q(a[o]);t=!1},d(r){r&&A(e),Xe(a,r)}}}function Zp(i,e,t){let{monster:n}=e,{item:a}=e;function s(c){if(typeof c!="number")return"";let d;if(a.modifier==null||!a.modifier.length||a.modifier=="")d=Math.floor(((c??10)-10)/2);else{let h=a.modifier.contains("return")?a.modifier:`return ${a.modifier}`;d=new Function("stat","monster",h)(c,n)}return`(${d>=0?"+":"-"}${Math.abs(d)})`}let r=n[a.properties[0]];Array.isArray(r)||(r=[]);let o=new Map;for(let c=0;c<r.length;c++){let d=r[c];if(Array.isArray(d))for(let h=0;h<d.length;h++){let u=o.get(h)??[];u.push(d[h]),o.set(h,u)}else o.set(c,[d])}let l=a.headers??[...Array(r.length>0?r.length:1).keys()];return i.$$set=c=>{"monster"in c&&t(5,n=c.monster),"item"in c&&t(0,a=c.item)},[a,r,s,o,l,n]}var vo=class extends U{constructor(e){super(),G(this,e,Zp,jp,j,{monster:5,item:0},Fp)}},jh=vo;function Zh(i){let e,t,n,a,s=i[1].heading&&Xh(i);return n=new bt({props:{render:i[1].markdown,property:i[2]}}),{c(){s&&s.c(),e=W(),t=k("div"),se(n.$$.fragment),g(t,"class","line")},m(r,o){s&&s.m(r,o),D(r,e,o),D(r,t,o),ie(n,t,null),a=!0},p(r,o){r[1].heading?s?(s.p(r,o),o&2&&M(s,1)):(s=Xh(r),s.c(),M(s,1),s.m(e.parentNode,e)):s&&(he(),Q(s,1,1,()=>{s=null}),de());let l={};o&2&&(l.render=r[1].markdown),o&4&&(l.property=r[2]),n.$set(l)},i(r){a||(M(s),M(n.$$.fragment,r),a=!0)},o(r){Q(s),Q(n.$$.fragment,r),a=!1},d(r){s&&s.d(r),r&&A(e),r&&A(t),ne(n)}}}function Xh(i){let e,t;return e=new Rn({props:{item:i[1],monster:i[0]}}),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},p(n,a){let s={};a&2&&(s.item=n[1]),a&1&&(s.monster=n[0]),e.$set(s)},i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function Xp(i){let e,t,n=(!i[1].conditioned||i[1].conditioned&&`${i[2]}`.length)&&Zh(i);return{c(){n&&n.c(),e=Oe()},m(a,s){n&&n.m(a,s),D(a,e,s),t=!0},p(a,[s]){!a[1].conditioned||a[1].conditioned&&`${a[2]}`.length?n?(n.p(a,s),s&6&&M(n,1)):(n=Zh(a),n.c(),M(n,1),n.m(e.parentNode,e)):n&&(he(),Q(n,1,1,()=>{n=null}),de())},i(a){t||(M(n),t=!0)},o(a){Q(n),t=!1},d(a){n&&n.d(a),a&&A(e)}}}function qp(i,e,t){let{monster:n}=e,{item:a}=e,s=a.text&&a.text.length?a.text:ye(n[a.properties[0]]);return!a.conditioned&&!`${s}`.length&&(s=a.fallback??"-"),i.$$set=r=>{"monster"in r&&t(0,n=r.monster),"item"in r&&t(1,a=r.item)},[n,a,s]}var ko=class extends U{constructor(e){super(),G(this,e,qp,Xp,j,{monster:0,item:1})}},qh=ko;var Uh=require("obsidian");function Up(i){re(i,"svelte-q1pj66",`.image.svelte-q1pj66{width:var(--active-image-width);height:var(--active-image-height)}.image.pointer.svelte-q1pj66{cursor:pointer}img.svelte-q1pj66{object-fit:cover;width:100%;height:100%;border-radius:100%;border:var(--active-image-border-size) solid
var(--active-image-border-color);object-position:center}`)}function Vp(i){let e,t,n,a,s,r;return{c(){e=k("div"),t=k("img"),ih(t.src,n=i[2])||g(t,"src",n),g(t,"alt",a=i[0].name),g(t,"class","svelte-q1pj66"),g(e,"class","image svelte-q1pj66"),oe(e,"pointer",i[1]!=null)},m(o,l){D(o,e,l),b(e,t),s||(r=[H(e,"click",i[6]),H(e,"mouseenter",i[7])],s=!0)},p(o,l){l&1&&a!==(a=o[0].name)&&g(t,"alt",a),l&2&&oe(e,"pointer",o[1]!=null)},d(o){o&&A(e),s=!1,ce(r)}}}function Yp(i){let e,t=i[2]&&Vp(i);return{c(){t&&t.c(),e=Oe()},m(n,a){t&&t.m(n,a),D(n,e,a)},p(n,[a]){n[2]&&t.p(n,a)},i:N,o:N,d(n){t&&t.d(n),n&&A(e)}}}function Gp(i,e,t){let{monster:n}=e,{item:a}=e,s=Fe("plugin"),r=Fe("context"),o;function l(y){y=decodeURIComponent(y);let w;try{if(/https?:/.test(y)){let[_]=ct.stringifyLinks(y).split("|");w=_}else{let[_]=ct.stringifyLinks(y).replace(/(^\[\[|\]\]$)/g,"").split("|");if(t(1,o=s.app.metadataCache.getFirstLinkpathDest(_,r)),!o)throw new Error;w=s.app.vault.getResourcePath(o)}}catch{console.warn("No image could be loaded")}return w}let d=(()=>{if(a.properties.length&&a.properties.some(y=>y in n&&typeof n[y]=="string")){let y=a.properties.filter(_=>_ in n&&typeof n[_]=="string");y.length>1&&console.log("Fantasy Statblocks: Multiple image properties provided, using first.");let w=n[y[0]];return l(w)}})(),h=Uh.Platform.isMacOS?"Meta":"Control";function u(y){if(!o)return;s.app.workspace.getLeaf(y.getModifierState(h)?"window":"split").openFile(o)}function f(y){o&&s.app.workspace.trigger("hover-link",{event:y,source:s.manifest.id,hoverParent:s.app.workspace.getMostRecentLeaf(),targetEl:y.currentTarget,linktext:o.path})}let m=y=>u(y),p=y=>f(y);return i.$$set=y=>{"monster"in y&&t(0,n=y.monster),"item"in y&&t(5,a=y.item)},[n,o,d,u,f,a,m,p]}var wo=class extends U{constructor(e){super(),G(this,e,Gp,Yp,j,{monster:0,item:5},Up)}},Vh=wo;function Kp(i){re(i,"svelte-1674zvq",`details.svelte-1674zvq>summary.svelte-1674zvq.svelte-1674zvq.svelte-1674zvq{outline:none;display:block !important;list-style:none !important;list-style-type:none !important;min-height:1rem;border-top-left-radius:0.1rem;border-top-right-radius:0.1rem;cursor:pointer;position:relative;margin-bottom:1rem}details.svelte-1674zvq>summary.svelte-1674zvq.svelte-1674zvq.svelte-1674zvq::-webkit-details-marker,details.svelte-1674zvq>summary.svelte-1674zvq.svelte-1674zvq.svelte-1674zvq::marker{display:none !important}details.svelte-1674zvq>summary.svelte-1674zvq>.collapser.svelte-1674zvq.svelte-1674zvq{position:absolute;top:50%;right:8px;transform:translateY(-50%);content:""}details.svelte-1674zvq>summary.svelte-1674zvq>.collapser.svelte-1674zvq>.handle.svelte-1674zvq{transform:rotate(0deg);transition:transform 0.25s;background-color:currentColor;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;-webkit-mask-image:url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M8.59 16.58L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z'/></svg>");mask-image:url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M8.59 16.58L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z'/></svg>");width:20px;height:20px}details[open].svelte-1674zvq>summary.svelte-1674zvq>.collapser.svelte-1674zvq>.handle.svelte-1674zvq{transform:rotate(90deg)}`)}function Jp(i){let e,t,n=(i[0].heading??"")+"",a,s,r,o,l;return{c(){e=k("details"),t=k("summary"),a=me(n),s=W(),r=k("div"),r.innerHTML='<div class="handle svelte-1674zvq"></div>',g(r,"class","collapser svelte-1674zvq"),g(t,"class","svelte-1674zvq"),g(e,"class","svelte-1674zvq")},m(c,d){D(c,e,d),b(e,t),b(t,a),b(t,s),b(t,r),i[3](e),e.open=i[0].open,o||(l=H(e,"toggle",i[4]),o=!0)},p(c,[d]){d&1&&n!==(n=(c[0].heading??"")+"")&&we(a,n),d&1&&(e.open=c[0].open)},i:N,o:N,d(c){c&&A(e),i[3](null),o=!1,l()}}}function e1(i,e,t){let{block:n}=e,{elements:a}=e,s;bi(()=>{for(let l of a)s.append(l)});function r(l){Re[l?"unshift":"push"](()=>{s=l,t(1,s)})}function o(){n.open=this.open,t(0,n)}return i.$$set=l=>{"block"in l&&t(0,n=l.block),"elements"in l&&t(2,a=l.elements)},[n,s,a,r,o]}var _o=class extends U{constructor(e){super(),G(this,e,e1,Jp,j,{block:0,elements:2},Kp)}},Yh=_o;var lO=require("obsidian");function t1(i){let e,t,n,a;return{c(){e=k("div"),g(e,"class","statblock-javascript")},m(s,r){D(s,e,r),n||(a=ee(t=i[1].call(null,e)),n=!0)},p:N,i:N,o:N,d(s){s&&A(e),n=!1,a()}}}function i1(i,e,t){let n,{block:a}=e,s=Fe("monster");Se(i,s,c=>t(4,n=c));let r=n;s.subscribe(c=>r=c);let o=Fe("plugin"),l=c=>{if(a.code)try{let h=new Function("monster","property",a.code).call(void 0,r,o);h instanceof HTMLElement&&c.appendChild(h)}catch(d){console.error(d)}};return i.$$set=c=>{"block"in c&&t(2,a=c.block)},[s,l,a]}var Oo=class extends U{constructor(e){super(),G(this,e,i1,t1,j,{block:2})}},Gh=Oo;function n1(i){re(i,"svelte-420xq",`.statblock-content.svelte-420xq{font-family:var(--active-content-font);font-size:var(--active-content-font-size);color:var(--active-font-color);background-color:var(--active-background-color);padding:0.5em;border:var(--active-border-size) var(--active-border-color) solid;box-shadow:var(--active-box-shadow-x-offset)
var(--active-box-shadow-y-offset) var(--active-box-shadow-blur)
var(--active-box-shadow-color);margin-left:2px;margin-right:2px;display:flex;gap:1rem}.statblock-content.svelte-420xq>.column{width:var(--statblock-column-width)}@media screen and (max-width: 400px){.statblock-content.svelte-420xq>.column{width:75vw}}`)}function a1(i){let e,t;return{c(){e=k("div"),t=k("div"),g(t,"class","statblock-content svelte-420xq"),g(e,"class","statblock-content-container"),Be(e,"--statblock-column-width",i[0])},m(n,a){D(n,e,a),b(e,t),i[7](t)},p(n,[a]){a&1&&Be(e,"--statblock-column-width",n[0])},i:N,o:N,d(n){n&&A(e),i[7](null)}}}function s1(i,e,t){let n=Pe(),{columns:a=1}=e,{targets:s}=e,{columnWidth:r="400px"}=e,{heights:o=[]}=e,{split:l=1/0}=e,{classes:c}=e,d=l,h=m=>{m.empty();let p=[],y=document.body.createDiv({cls:"statblock-detached markdown-preview-view",attr:{style:`width: ${r}`}}),_=y.createDiv({cls:["statblock-detached","obsidian-statblock-plugin","statblock",...c]}).createDiv({cls:"statblock-content-container",attr:{style:`width: ${r}`}}).createDiv("statblock-content"),O=_.createDiv("column");p.push(O);for(let E=0;E<s.length;E++){let S=s[E],v=o.slice(E+1).reduce((x,P)=>x+P,0);p.length<a&&o[E]+O.scrollHeight>d&&v<O.scrollHeight&&(d=Math.max(d,O.scrollHeight),_.empty(),O=_.createDiv("column"),p.push(O)),O.appendChild(S),p.length<a&&O.scrollHeight>d&&(a<=2||p.length>1||v/((a-p.length-1)*O.scrollHeight)<1.5)&&(d=Math.max(d,O.scrollHeight),_.empty(),O=_.createDiv("column"),p.push(O))}for(let E of p)m.appendChild(E),E.querySelectorAll(".statblock-item-container:empty").forEach(S=>S.detach());y.detach()},u;bi(()=>{n("mounted"),u&&(h(u),n("built"))});function f(m){Re[m?"unshift":"push"](()=>{u=m,t(1,u)})}return i.$$set=m=>{"columns"in m&&t(2,a=m.columns),"targets"in m&&t(3,s=m.targets),"columnWidth"in m&&t(0,r=m.columnWidth),"heights"in m&&t(4,o=m.heights),"split"in m&&t(5,l=m.split),"classes"in m&&t(6,c=m.classes)},[r,u,a,s,o,l,c,f]}var So=class extends U{constructor(e){super(),G(this,e,s1,a1,j,{columns:2,targets:3,columnWidth:0,heights:4,split:5,classes:6},n1)}},xo=So;function r1(i){re(i,"svelte-1suaf4g","ul.spell-item.svelte-1suaf4g{margin:0}ul.spell-item.first.svelte-1suaf4g{margin-top:revert}ul.spell-item.last.svelte-1suaf4g{margin-bottom:revert}.spells.svelte-1suaf4g{font-style:italic}")}function o1(i){let e,t,n,a,s,r,o;return n=new bt({props:{property:`${i[0].level}:`}}),r=new bt({props:{property:i[0].spells}}),{c(){e=k("li"),t=k("span"),se(n.$$.fragment),a=W(),s=k("span"),se(r.$$.fragment),g(t,"class","spell-level"),g(s,"class","spells svelte-1suaf4g"),g(e,"class","spell-line")},m(l,c){D(l,e,c),b(e,t),ie(n,t,null),b(e,a),b(e,s),ie(r,s,null),o=!0},p(l,c){let d={};c&1&&(d.property=`${l[0].level}:`),n.$set(d);let h={};c&1&&(h.property=l[0].spells),r.$set(h)},i(l){o||(M(n.$$.fragment,l),M(r.$$.fragment,l),o=!0)},o(l){Q(n.$$.fragment,l),Q(r.$$.fragment,l),o=!1},d(l){l&&A(e),ne(n),ne(r)}}}function l1(i){let e,t,n;return t=new bt({props:{property:i[0].spells}}),{c(){e=k("span"),se(t.$$.fragment),g(e,"class","spell-line")},m(a,s){D(a,e,s),ie(t,e,null),n=!0},p(a,s){let r={};s&1&&(r.property=a[0].spells),t.$set(r)},i(a){n||(M(t.$$.fragment,a),n=!0)},o(a){Q(t.$$.fragment,a),n=!1},d(a){a&&A(e),ne(t)}}}function c1(i){let e,t,n,a,s=[l1,o1],r=[];function o(l,c){return l[0].level?1:0}return t=o(i,-1),n=r[t]=s[t](i),{c(){e=k("ul"),n.c(),g(e,"class","spell-item svelte-1suaf4g"),oe(e,"first",i[1]),oe(e,"last",i[2])},m(l,c){D(l,e,c),r[t].m(e,null),a=!0},p(l,[c]){let d=t;t=o(l,c),t===d?r[t].p(l,c):(he(),Q(r[d],1,1,()=>{r[d]=null}),de(),n=r[t],n?n.p(l,c):(n=r[t]=s[t](l),n.c()),M(n,1),n.m(e,null)),(!a||c&2)&&oe(e,"first",l[1]),(!a||c&4)&&oe(e,"last",l[2])},i(l){a||(M(n),a=!0)},o(l){Q(n),a=!1},d(l){l&&A(e),r[t].d()}}}function h1(i,e,t){let{spell:n}=e,{first:a=!1}=e,{last:s=!1}=e;return i.$$set=r=>{"spell"in r&&t(0,n=r.spell),"first"in r&&t(1,a=r.first),"last"in r&&t(2,s=r.last)},[n,a,s]}var To=class extends U{constructor(e){super(),G(this,e,h1,c1,j,{spell:0,first:1,last:2},r1)}},Kh=To;var ma=require("obsidian");function d1(i){let e,t,n,a;return{c(){e=k("div"),g(e,"class","action")},m(s,r){D(s,e,r),n||(a=ee(t=i[0].call(null,e)),n=!0)},p:N,i:N,o:N,d(s){s&&A(e),n=!1,a()}}}function u1(i,e,t){let{block:n}=e,{monster:a}=e,s=r=>{new ma.ExtraButtonComponent(r).setIcon(n.icon).onClick(()=>{if(n.callback?.trim()?.length)try{new Function("monster",n.callback).call(void 0,a)}catch(o){new ma.Notice(`There was an error executing the provided callback for the action block.
${o.message}`),console.error(o)}else if(n.action)try{app.commands.executeCommandById(n.action)}catch(o){new ma.Notice(`There was an error executing the command for the action block.
${o.message}`),console.error(o)}})};return i.$$set=r=>{"block"in r&&t(1,n=r.block),"monster"in r&&t(2,a=r.monster)},[s,n,a]}var Co=class extends U{constructor(e){super(),G(this,e,u1,d1,j,{block:1,monster:2})}},Jh=Co;function ed(i){let e,t;return e=new xo({props:{heights:i[7],targets:i[2],columns:i[1],columnWidth:i[3],split:i[5],classes:i[0]}}),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},p(n,a){let s={};a&2&&(s.columns=n[1]),a&8&&(s.columnWidth=n[3]),a&32&&(s.split=n[5]),a&1&&(s.classes=n[0]),e.$set(s)},i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function f1(i){let e,t,n=i[4]&&ed(i);return{c(){n&&n.c(),e=Oe()},m(a,s){n&&n.m(a,s),D(a,e,s),t=!0},p(a,[s]){a[4]?n?(n.p(a,s),s&16&&M(n,1)):(n=ed(a),n.c(),M(n,1),n.m(e.parentNode,e)):n&&(he(),Q(n,1,1,()=>{n=null}),de())},i(a){t||(M(n),t=!0)},o(a){Q(n),t=!1},d(a){n&&n.d(a),a&&A(e)}}}function m1(i,e,t){let n,a,s=Pe(),{statblock:r}=e,{ready:o}=e,{classes:l}=e,{layout:c}=e,{columns:d}=e,h=d,u=!1,f=[],{plugin:m}=e,p=Fe("monster");Se(i,p,T=>t(16,a=T));let y=a;p.subscribe(T=>t(14,y=T));let w=T=>/[^a-zA-Z0-9]$/.test(T)?T:`${T}:`,_=T=>T.conditioned==null||!T.conditioned?!0:"nested"in T?T.nested.some($=>_($)):T.type=="ifelse"||T.type=="javascript"||T.type=="layout"||!("properties"in T)||!T.properties.length?!0:T.properties.some($=>!!($ in y&&(Array.isArray(y[$])&&y[$].length||typeof y[$]=="string"&&y[$].length||typeof y[$]=="number"))),O=Yr(),E=(T,$={})=>$.container?$.container.createDiv(`statblock-item-container ${ii(T.type)}-container ${($.classes??[]).join(" ")}`):createDiv(`statblock-item-container ${ii(T.type)}-container ${($.classes??[]).join(" ")}`),S=(T,$={})=>{if(!_(T))return[];let{container:K,classes:Z}=$,F=[],V=E(T,{container:K,classes:Z});switch(O.set("item",T),F.push(V),T.type){case"group":{T.heading&&new Rn({target:V,props:{monster:y,item:T},context:O});for(let B of T.nested??[]){let Y=S(B,{container:V,classes:T.cls?[...Z??[],T.cls]:Z??[]});F.push(...Y)}break}case"action":{new Jh({target:V,props:{block:T,monster:y}});break}case"javascript":{new Gh({target:V,props:{block:T}});break}case"collapse":{let B=[];for(let Y of T.nested){let L=S(Y);B.push(...L)}new Yh({target:V,props:{block:T,elements:B}});break}case"heading":{let B=new Eh({target:V,props:{monster:y,item:T},context:O});B.$on("save",Y=>s("save",Y.detail)),B.$on("export",Y=>s("export",Y.detail));break}case"ifelse":{for(let B=0;B<T.conditions.length;B++){let{condition:Y,nested:L}=T.conditions[B],ae=document.body.createEl("iframe"),J=ae.contentWindow.Function,ue=!1;try{ue=new J("monster",Y).call(void 0,y)??!1}catch(X){console.error(X);continue}if(document.body.removeChild(ae),ue==!0||B==T.conditions.length-1&&!Y?.length){for(let X of L){let z=S(X,{container:V});F.push(...z)}break}}break}case"inline":{T.heading&&new Rn({target:V,props:{monster:y,item:T},context:O});let B=E(T,{container:V,classes:["statblock-item-inline",...T.cls?[...Z??[],T.cls]:Z??[]]});for(let Y of T.nested??[])S(Y,{container:B.createDiv(`statblock-inline-item ${ii(Y.type)}-container`)});F.push(B);break}case"image":{new Vh({target:V,props:{monster:y,item:T},context:O});break}case"layout":{let B=m.manager.getLayout(T.layout);B?.blocks?.length&&F.push(...S({type:"group",nested:B.blocks,id:T.layout,properties:null},{classes:[...Z??[],`${ii(B.name)}-nested`]}));break}case"property":{new Rh({target:V,props:{monster:y,item:T},context:O});break}case"saves":{new Wh({target:V,props:{monster:y,item:T},context:O});break}case"spells":{let B=y[T.properties[0]];if(!Array.isArray(B)||!B.length)return;let Y=B.reduce((L,ae)=>{if(typeof ae=="string"&&(ae.charAt(ae.length-1)==":"||!ae.includes(":"))){let X={header:w(ae),spells:[]};return L.push(X),L}let J=L[L.length-1],ue;if(typeof ae=="string")ue={spells:ct.linkifySpells(ae,O.get("context"))};else try{ue={level:Object.keys(ae).shift(),spells:ct.linkifySpells(ye(Object.values(ae).shift()),O.get("context"))}}catch{return L}if(J)J.spells.push(ue);else{let X={header:`${y.name} knows the following spells:`,spells:[ue]};L.push(X)}return L},[]);for(let L=0;L<Y.length;L++){let ae=Y[L];if(ae.header?.length){let J=new fa({target:createDiv(),props:{name:L==0?T.heading??"Spellcasting":"",property:T.properties[0],desc:ae.header,item:T,monster:y,trait:y[T.properties[0]]}});F.push(J.$$.root.firstElementChild)}for(let J=0;J<ae.spells.length;J++){let ue=ae.spells[J],X=new Kh({target:createDiv(),props:{spell:ue,first:J===0,last:J===ae.spells.length-1}});F.push(X.$$.root.firstElementChild)}}break}case"subheading":{new Lh({target:V,props:{monster:y,item:T},context:O});break}case"table":{new jh({target:V,props:{monster:y,item:T},context:O});break}case"text":{new qh({target:V,props:{monster:y,item:T}});break}case"traits":{let B=y[T.properties[0]];if(!Array.isArray(B)||!B.length)return[];let Y=E(T,{container:V});if(F.push(Y),T.heading&&new Rn({target:Y.createDiv("statblock-section-heading"),props:{monster:y,item:T},context:O}),T.subheadingText&&T.subheadingText.length){let L=Y.createDiv("statblock-item-container statblock-trait-prop");new fa({target:L,props:{name:"",desc:T.subheadingText.replace(/\{\{monster\}\}/g,y.name),property:"trait-subheading",item:T,monster:y,trait:y[T.properties[0]]},context:O}),F.push(L)}try{if(B.length>0){new fa({target:Y.createDiv("statblock-item-container statblock-trait-prop"),props:{name:B[0].name,desc:B[0].desc,property:T.properties[0],item:T,monster:y,trait:B[0]},context:O});for(let L=1;L<B.length;L++){let ae=B[L],J=(K||window).createDiv("statblock-item-container statblock-trait-prop");new fa({target:J,props:{name:ae.name,desc:ae.desc,property:T.properties[0],item:T,monster:y,trait:ae},context:O}),F.push(J)}}}catch{return[]}break}}if("hasRule"in T&&T.hasRule){let B=createDiv(["statblock-item-container rule-container",...Z??[]].join(" "));new _s({target:B}),F.push(B)}return F.filter(B=>B.hasChildNodes())};if(!f.length)for(let T of r){let $=S(T);$?.length&&f.push(...$)}let v="400px";y.columnWidth?(typeof y.columnWidth=="number"&&(v=`${y.columnWidth}px`),typeof y.columnWidth=="string"&&(v=y.columnWidth)):c.columnWidth&&(v=`${c.columnWidth}px`);let x=!1,P=[],I,R=()=>{let T=document.body.createDiv({cls:"statblock-detached markdown-preview-view",attr:{style:`width: ${v}`}});new xo({target:T.createDiv({cls:["obsidian-statblock-plugin","statblock",...l]}),props:{heights:P,targets:f,columns:1,columnWidth:v,classes:l}}).$on("built",()=>{let K=T.querySelector(".column");for(let Z of f)P.push(Z.scrollHeight);y.forceColumns?t(5,I=K.scrollHeight/h):y.columns&&y.columns>0?t(5,I=Math.max(K.scrollHeight/y.columns,K.scrollHeight/d)):t(5,I=Math.max(600,Math.min(K.scrollHeight/d,n))),T.empty(),T.detach(),t(4,x=!0)})};return i.$$set=T=>{"statblock"in T&&t(8,r=T.statblock),"ready"in T&&t(9,o=T.ready),"classes"in T&&t(0,l=T.classes),"layout"in T&&t(10,c=T.layout),"columns"in T&&t(1,d=T.columns),"plugin"in T&&t(13,m=T.plugin)},i.$$.update=()=>{i.$$.dirty&16384&&(n=!isNaN(Number(y.columnHeight))&&y.columnHeight>0?y.columnHeight:1/0),i.$$.dirty&512&&o&&R()},[l,d,f,v,x,I,p,P,r,o,c,h,u,m,y]}var Ao=class extends U{constructor(e){super(),G(this,e,m1,f1,j,{statblock:8,ready:9,classes:0,layout:10,columns:1,maxColumns:11,detached:12,targets:2,plugin:13})}get maxColumns(){return this.$$.ctx[11]}get detached(){return this.$$.ctx[12]}get targets(){return this.$$.ctx[2]}},td=Ao;function g1(i){re(i,"svelte-1unaafm",`.statblock.svelte-1unaafm{--active-primary-color:var(--statblock-primary-color);--active-rule-color:var(--statblock-rule-color);--active-background-color:var(--statblock-background-color);--active-bar-color:var(--statblock-bar-color);--active-bar-border-size:var(--statblock-bar-border-size);--active-bar-border-color:var(--statblock-bar-border-color);--active-image-width:var(--statblock-image-width);--active-image-height:var(--statblock-image-height);--active-image-border-size:var(--statblock-image-border-size);--active-image-border-color:var(
--statblock-image-border-color,
--active-primary-color
);--active-border-size:var(--statblock-border-size);--active-border-color:var(--statblock-border-color);--active-box-shadow-color:var(--statblock-box-shadow-color);--active-box-shadow-x-offset:var(--statblock-box-shadow-x-offset);--active-box-shadow-y-offset:var(--statblock-box-shadow-y-offset);--active-box-shadow-blur:var(--statblock-box-shadow-blur);--active-font-color:var(
--statblock-font-color,
--active-primary-color
);--active-font-weight:var(--statblock-font-weight);--active-content-font:var(--statblock-content-font);--active-content-font-size:var(--statblock-content-font-size);--active-heading-font:var(--statblock-heading-font);--active-heading-font-color:var(--statblock-heading-font-color);--active-heading-font-size:var(--statblock-heading-font-size);--active-heading-font-variant:var(--statblock-heading-font-variant);--active-heading-font-weight:var(--statblock-heading-font-weight);--active-heading-line-height:var(--statblock-heading-line-height);--active-property-line-height:var(--statblock-property-line-height);--active-property-font:var(--statblock-property-font);--active-property-font-color:var(--statblock-property-font-color);--active-property-font-variant:var(--statblock-property-font-variant);--active-property-font-size:var(--statblock-property-font-size);--active-property-font-weight:var(--statblock-property-font-weight);--active-property-name-font:var(--statblock-property-name-font);--active-property-name-font-color:var(
--statblock-property-name-font-color
);--active-property-name-font-variant:var(
--statblock-property-name-font-variant
);--active-property-name-font-size:var(
--statblock-property-name-font-size
);--active-property-name-font-weight:var(
--statblock-property-name-font-weight
);--active-section-heading-border-size:var(
--statblock-section-heading-border-size
);--active-section-heading-border-color:var(
--statblock-section-heading-border-color
);--active-section-heading-font:var(--statblock-section-heading-font);--active-section-heading-font-color:var(
--statblock-section-heading-font-color
);--active-section-heading-font-size:var(
--statblock-section-heading-font-size
);--active-section-heading-font-variant:var(
--statblock-section-heading-font-variant
);--active-section-heading-font-weight:var(
--statblock-section-heading-font-weight
);--active-saves-line-height:var(--statblock-saves-line-height);--active-spells-font-style:var(--statblock-spells-font-style);--active-subheading-font:var(--statblock-subheading-font);--active-subheading-font-color:var(--statblock-subheading-font-color);--active-subheading-font-size:var(--statblock-subheading-font-size);--active-subheading-font-style:var(--statblock-subheading-font-style);--active-subheading-font-weight:var(
--statblock-subheading-font-weight
);--active-table-header-font-weight:var(
--statblock-table-header-font-weight
);--active-traits-font:var(--statblock-traits-font);--active-traits-font-color:var(--statblock-traits-font-color);--active-traits-font-size:var(--statblock-traits-font-size);--active-traits-font-weight:var(--statblock-traits-font-weight);--active-traits-font-style:var(--statblock-traits-font-style);--active-traits-name-font:var(--statblock-traits-name-font);--active-traits-name-font-color:var(
--statblock-traits-name-font-color
);--active-traits-name-font-size:var(--statblock-traits-name-font-size);--active-traits-name-font-weight:var(
--statblock-traits-name-font-weight
);--active-traits-name-font-style:var(
--statblock-traits-name-font-style
);--active-link-style:var(--statblock-link-style)}.statblock.svelte-1unaafm a{font-style:var(--statblock-link-style)}.container.svelte-1unaafm{display:flex;position:relative;width:100%;margin:0.25rem 0}.statblock.svelte-1unaafm{margin:0 auto;position:relative}.icons.svelte-1unaafm{position:absolute;left:var(--size-2-2)}`)}function id(i){let e,t=i[8],n,a,s,r,o=ad(i),l=i[3]&&sd(i);return{c(){e=k("div"),o.c(),a=W(),l&&l.c(),s=Oe(),g(e,"class",n=Pi(i[5].join(" "))+" svelte-1unaafm"),oe(e,"obsidian-statblock-plugin",!0),oe(e,"statblock",!0)},m(c,d){D(c,e,d),o.m(e,null),D(c,a,d),l&&l.m(c,d),D(c,s,d),r=!0},p(c,d){d[0]&256&&j(t,t=c[8])?(he(),Q(o,1,1,N),de(),o=ad(c),o.c(),M(o,1),o.m(e,null)):o.p(c,d),(!r||d[0]&32&&n!==(n=Pi(c[5].join(" "))+" svelte-1unaafm"))&&g(e,"class",n),(!r||d[0]&32)&&oe(e,"obsidian-statblock-plugin",!0),(!r||d[0]&32)&&oe(e,"statblock",!0),c[3]?l?l.p(c,d):(l=sd(c),l.c(),l.m(s.parentNode,s)):l&&(l.d(1),l=null)},i(c){r||(M(o),r=!0)},o(c){Q(o),r=!1},d(c){c&&A(e),o.d(c),c&&A(a),l&&l.d(c),c&&A(s)}}}function p1(i){let e;return{c(){e=k("span"),e.textContent="Invalid monster."},m(t,n){D(t,e,n)},p:N,i:N,o:N,d(t){t&&A(e)}}}function b1(i){let e,t,n=i[7],a,s,r;e=new so({});let o=nd(i);return s=new so({}),{c(){se(e.$$.fragment),t=W(),o.c(),a=W(),se(s.$$.fragment)},m(l,c){ie(e,l,c),D(l,t,c),o.m(l,c),D(l,a,c),ie(s,l,c),r=!0},p(l,c){c[0]&128&&j(n,n=l[7])?(he(),Q(o,1,1,N),de(),o=nd(l),o.c(),M(o,1),o.m(a.parentNode,a)):o.p(l,c)},i(l){r||(M(e.$$.fragment,l),M(o),M(s.$$.fragment,l),r=!0)},o(l){Q(e.$$.fragment,l),Q(o),Q(s.$$.fragment,l),r=!1},d(l){ne(e,l),l&&A(t),o.d(l),l&&A(a),ne(s,l)}}}function nd(i){let e,t;return e=new td({props:{columns:i[7],maxColumns:i[10],statblock:i[1],ready:i[6],classes:i[5],layout:i[2],plugin:i[0]}}),e.$on("save",i[19]),e.$on("export",i[20]),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},p(n,a){let s={};a[0]&128&&(s.columns=n[7]),a[0]&2&&(s.statblock=n[1]),a[0]&64&&(s.ready=n[6]),a[0]&32&&(s.classes=n[5]),a[0]&4&&(s.layout=n[2]),a[0]&1&&(s.plugin=n[0]),e.$set(s)},i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function ad(i){let e,t,n,a,s=[b1,p1],r=[];function o(l,c){return l[8]?0:1}return e=o(i,[-1,-1]),t=r[e]=s[e](i),{c(){t.c(),n=Oe()},m(l,c){r[e].m(l,c),D(l,n,c),a=!0},p(l,c){let d=e;e=o(l,c),e===d?r[e].p(l,c):(he(),Q(r[d],1,1,()=>{r[d]=null}),de(),t=r[e],t?t.p(l,c):(t=r[e]=s[e](l),t.c()),M(t,1),t.m(n.parentNode,n))},i(l){a||(M(t),a=!0)},o(l){Q(t),a=!1},d(l){r[e].d(l),l&&A(n)}}}function sd(i){let e,t,n,a;return{c(){e=k("div"),g(e,"class","icons svelte-1unaafm")},m(s,r){D(s,e,r),n||(a=[ee(t=i[11].call(null,e)),H(e,"click",i[12])],n=!0)},p:N,d(s){s&&A(e),n=!1,ce(a)}}}function y1(i){let e,t,n=i[6]&&id(i);return{c(){e=k("div"),n&&n.c(),g(e,"class","container svelte-1unaafm")},m(a,s){D(a,e,s),n&&n.m(e,null),i[21](e),t=!0},p(a,s){a[6]?n?(n.p(a,s),s[0]&64&&M(n,1)):(n=id(a),n.c(),M(n,1),n.m(e,null)):n&&(he(),Q(n,1,1,()=>{n=null}),de())},i(a){t||(M(n),t=!0)},o(a){Q(n),t=!1},d(a){a&&A(e),n&&n.d(),i[21](null)}}}function v1(i,e,t){let n,a,s,r,o,l,c=Pe(),{monster:d}=e,{context:h}=e,{plugin:u}=e,{statblock:f}=e,{renderer:m}=e,{layout:p}=e,{canSave:y=!0}=e,{icons:w=!0}=e,_=Ne();Se(i,_,J=>t(8,l=J));let O=!isNaN(Number(d.columns??p.columns))&&Number(d.columns??p.columns)>0?Number(d.columns??p.columns):2,E=Number(`${d.columnWidth}`.replace(/\D/g,"")),S=!isNaN(E??p.columnWidth)&&(E??p.columnWidth)>0?E:400,v=u.canUseDiceRoller&&(d.dice??u.settings.useDice),x=d.render??u.settings.renderDice;At("plugin",u),At("tryToRenderLinks",u.settings.tryToRenderLinks),At("context",h),At("monster",_),At("dice",v),At("render",x),At("renderer",m),At("layout",p);let P=Ne(!1);At("reset",P);let I,R=()=>{if(d.forceColumns??p.forceColumns){t(7,n=O),$.disconnect();return}let J=I.clientWidth;t(7,n=Math.min(Math.max(Math.floor(J/S),1),O))},T=(0,Xt.debounce)(()=>{R(),a||t(6,a=!0)},100,!1),$=new ResizeObserver(T);bi(()=>{T(),$.observe(I)}),yi(()=>{$.disconnect()});let K=J=>{new Xt.ExtraButtonComponent(J).setIcon("vertical-three-dots")},Z=new Xt.Menu;Z.addItem(J=>J.setIcon("save").setTitle("Save to Bestiary").setDisabled(!y).onClick(()=>c("save"))),Z.addItem(J=>{J.setTitle("Copy YAML").setIcon("code").onClick(async()=>{try{await navigator.clipboard.writeText((0,Xt.stringifyYaml)(d)),new Xt.Notice("Creature YAML copied to clipboard")}catch(ue){new Xt.Notice(`There was an issue copying the yaml:
${ue.message}`)}})}),Z.addItem(J=>J.setIcon("image-down").setTitle("Export as PNG").onClick(()=>c("export"))),v&&Z.addItem(J=>J.setIcon("reset").setTitle("Reset Dice").onClick(()=>{P.set(!0),P.set(!1)}));let F=J=>{Z.showAtMouseEvent(J)},V=(J,ue="")=>J?.toLowerCase().replace(/\s+/g,"-")??ue,B=J=>{let ue=[];for(let X of J){if(X.type=="layout"){let z=u.manager.getAllLayouts().find(ge=>ge.id==X.layout);ue.push(V(z?.name))}"nested"in X&&ue.push(...B(X.nested))}return ue};function Y(J){je.call(this,i,J)}function L(J){je.call(this,i,J)}function ae(J){Re[J?"unshift":"push"](()=>{I=J,t(4,I)})}return i.$$set=J=>{"monster"in J&&t(13,d=J.monster),"context"in J&&t(14,h=J.context),"plugin"in J&&t(0,u=J.plugin),"statblock"in J&&t(1,f=J.statblock),"renderer"in J&&t(15,m=J.renderer),"layout"in J&&t(2,p=J.layout),"canSave"in J&&t(16,y=J.canSave),"icons"in J&&t(3,w=J.icons)},i.$$.update=()=>{i.$$.dirty[0]&8192&&Te(_,l=d,l),i.$$.dirty[0]&8192&&t(18,s=V(d.name,"no-name")),i.$$.dirty[0]&4&&t(17,r=V(p.name,"no-layout")),i.$$.dirty[0]&393218&&t(5,o=[s,r,...B(f)].filter(J=>J?.length))},t(7,n=O),t(6,a=!1),[u,f,p,w,I,o,a,n,l,_,O,K,F,d,h,m,y,r,s,Y,L,ae]}var Do=class extends U{constructor(e){super(),G(this,e,v1,y1,j,{monster:13,context:14,plugin:0,statblock:1,renderer:15,layout:2,canSave:16,icons:3},g1,[-1,-1])}},rd=Do;var Ro=It(mi());var od=It(mi());var yt=require("obsidian");function ga(i){let e=new Blob([i],{type:"text/javascript"}),t=URL.createObjectURL(e),n=new Worker(t,{name:"Fantasy Statblocks Creature Parser"});return URL.revokeObjectURL(t),n}function Po(){return ga('var If=Object.create;var vs=Object.defineProperty,Rf=Object.defineProperties,Ff=Object.getOwnPropertyDescriptor,$f=Object.getOwnPropertyDescriptors,Vf=Object.getOwnPropertyNames,yl=Object.getOwnPropertySymbols,Hf=Object.getPrototypeOf,wl=Object.prototype.hasOwnProperty,_f=Object.prototype.propertyIsEnumerable;var ir=(s,e)=>(e=Symbol[s])?e:Symbol.for("Symbol."+s);var bl=(s,e,t)=>e in s?vs(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,kl=(s,e)=>{for(var t in e||(e={}))wl.call(e,t)&&bl(s,t,e[t]);if(yl)for(var t of yl(e))_f.call(e,t)&&bl(s,t,e[t]);return s},Sl=(s,e)=>Rf(s,$f(e));var Wf=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),vl=(s,e)=>{for(var t in e)vs(s,t,{get:e[t],enumerable:!0})},Kf=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Vf(e))!wl.call(s,n)&&n!==t&&vs(s,n,{get:()=>e[n],enumerable:!(i=Ff(e,n))||i.enumerable});return s};var xl=(s,e,t)=>(t=s!=null?If(Hf(s)):{},Kf(e||!s||!s.__esModule?vs(t,"default",{value:s,enumerable:!0}):t,s));var qf=function(s,e){this[0]=s,this[1]=e};var k=s=>{var e=s[ir("asyncIterator")],t=!1,i,n={};return e==null?(e=s[ir("iterator")](),i=r=>n[r]=o=>e[r](o)):(e=e.call(s),i=r=>n[r]=o=>{if(t){if(t=!1,r==="throw")throw o;return o}return t=!0,{done:!1,value:new qf(new Promise(l=>{var a=e[r](o);if(!(a instanceof Object))throw TypeError("Object expected");l(a)}),1)}}),n[ir("iterator")]=()=>n,i("next"),"throw"in e?i("throw"):n.throw=r=>{throw r},"return"in e&&i("return"),n};var rr=Wf((sr,nr)=>{(function(s,e){typeof sr=="object"&&typeof nr!="undefined"?nr.exports=e():typeof define=="function"&&define.amd?define(e):(s=typeof globalThis!="undefined"?globalThis:s||self,s["fast-copy"]=e())})(sr,function(){"use strict";var s=Function.prototype.toString,e=Object.create,t=Object.defineProperty,i=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.getOwnPropertySymbols,o=Object.getPrototypeOf,l=Object.prototype,a=l.hasOwnProperty,h=l.propertyIsEnumerable,f=typeof r=="function",c=typeof WeakMap=="function",u=function(){if(c)return function(){return new WeakMap};var S=function(){function w(){this._keys=[],this._values=[]}return w.prototype.has=function(A){return!!~this._keys.indexOf(A)},w.prototype.get=function(A){return this._values[this._keys.indexOf(A)]},w.prototype.set=function(A,O){this._keys.push(A),this._values.push(O)},w}();return function(){return new S}}(),d=function(S,w){var A=S.__proto__||o(S);if(!A)return e(null);var O=A.constructor;if(O===w.Object)return A===w.Object.prototype?{}:e(A);if(~s.call(O).indexOf("[native code]"))try{return new O}catch(L){}return e(A)},p=function(S,w,A,O){var L=d(S,w);O.set(S,L);for(var N in S)a.call(S,N)&&(L[N]=A(S[N],O));if(f)for(var x=r(S),D=0,I=x.length,E=void 0;D<I;++D)E=x[D],h.call(S,E)&&(L[E]=A(S[E],O));return L},m=function(S,w,A,O){var L=d(S,w);O.set(S,L);for(var N=f?n(S).concat(r(S)):n(S),x=0,D=N.length,I=void 0,E=void 0;x<D;++x)if(I=N[x],I!=="callee"&&I!=="caller")if(E=i(S,I),E){!E.get&&!E.set&&(E.value=A(S[I],O));try{t(L,I,E)}catch(F){L[I]=E.value}}else L[I]=A(S[I],O);return L},g=function(S){var w="";return S.global&&(w+="g"),S.ignoreCase&&(w+="i"),S.multiline&&(w+="m"),S.unicode&&(w+="u"),S.sticky&&(w+="y"),w},b=Array.isArray,v=Object.getPrototypeOf,C=function(){return typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:(console&&console.error&&console.error(\'Unable to locate global object, returning "this".\'),this)}();function M(S,w){var A=!!(w&&w.isStrict),O=w&&w.realm||C,L=A?m:p,N=function(x,D){if(!x||typeof x!="object")return x;if(D.has(x))return D.get(x);var I=x.__proto__||v(x),E=I&&I.constructor;if(!E||E===O.Object)return L(x,O,N,D);var F;if(b(x)){if(A)return m(x,O,N,D);F=new E,D.set(x,F);for(var xe=0,gt=x.length;xe<gt;++xe)F[xe]=N(x[xe],D);return F}if(x instanceof O.Date)return new E(x.getTime());if(x instanceof O.RegExp)return F=new E(x.source,x.flags||g(x)),F.lastIndex=x.lastIndex,F;if(O.Map&&x instanceof O.Map)return F=new E,D.set(x,F),x.forEach(function(Ie,ks){F.set(ks,N(Ie,D))}),F;if(O.Set&&x instanceof O.Set)return F=new E,D.set(x,F),x.forEach(function(Ie){F.add(N(Ie,D))}),F;if(O.Blob&&x instanceof O.Blob)return x.slice(0,x.size,x.type);if(O.Buffer&&O.Buffer.isBuffer(x))return F=O.Buffer.allocUnsafe?O.Buffer.allocUnsafe(x.length):new E(x.length),D.set(x,F),x.copy(F),F;if(O.ArrayBuffer){if(O.ArrayBuffer.isView(x))return F=new E(x.buffer.slice(0)),D.set(x,F),F;if(x instanceof O.ArrayBuffer)return F=x.slice(0),D.set(x,F),F}return typeof x.then=="function"||x instanceof Error||O.WeakMap&&x instanceof O.WeakMap||O.WeakSet&&x instanceof O.WeakSet?x:L(x,O,N,D)};return N(S,u())}return M.default=M,M.strict=function(w,A){return M(w,{isStrict:!0,realm:A?A.realm:void 0})},M})});var Bf=xl(rr());var q=class s{constructor(){}lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){let n=[];return this.decompose(0,e,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(t,this.length,n,1),Qt.from(n,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let i=[];return this.decompose(e,t,i,0),Qt.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),n=new It(this),r=new It(e);for(let o=t,l=t;;){if(n.next(o),r.next(o),o=0,n.lineBreak!=r.lineBreak||n.done!=r.done||n.value!=r.value)return!1;if(l+=n.value.length,n.done||l>=i)return!0}}iter(e=1){return new It(this,e)}iterRange(e,t=this.length){return new Os(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let n=this.line(e).from;i=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Ts(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?s.empty:e.length<=32?new ge(e):Qt.from(ge.split(e,[]))}},ge=class s extends q{constructor(e,t=jf(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,n){for(let r=0;;r++){let o=this.text[r],l=n+o.length;if((t?i:l)>=e)return new lr(n,l,i,o);n=l+1,i++}}decompose(e,t,i,n){let r=e<=0&&t>=this.length?this:new s(Al(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(n&1){let o=i.pop(),l=Cs(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new s(l,o.length+r.length));else{let a=l.length>>1;i.push(new s(l.slice(0,a)),new s(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof s))return super.replace(e,t,i);let n=Cs(this.text,Cs(i.text,Al(this.text,0,e)),t),r=this.length+i.length-(t-e);return n.length<=32?new s(n,r):Qt.from(s.split(n,[]),r)}sliceString(e,t=this.length,i=`\n`){let n="";for(let r=0,o=0;r<=t&&o<this.text.length;o++){let l=this.text[o],a=r+l.length;r>e&&o&&(n+=i),e<a&&t>r&&(n+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],n=-1;for(let r of e)i.push(r),n+=r.length+1,i.length==32&&(t.push(new s(i,n)),i=[],n=-1);return n>-1&&t.push(new s(i,n)),t}},Qt=class s extends q{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,n){for(let r=0;;r++){let o=this.children[r],l=n+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,n);n=l+1,i=a+1}}decompose(e,t,i,n){for(let r=0,o=0;o<=t&&r<this.children.length;r++){let l=this.children[r],a=o+l.length;if(e<=a&&t>=o){let h=n&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if(i.lines<this.lines)for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],l=r+o.length;if(e>=r&&t<=l){let a=o.replace(e-r,t-r,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let f=this.children.slice();return f[n]=a,new s(f,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`\n`){let n="";for(let r=0,o=0;r<this.children.length&&o<=t;r++){let l=this.children[r],a=o+l.length;o>e&&r&&(n+=i),e<a&&t>o&&(n+=l.sliceString(e-o,t-o,i)),o=a+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof s))return 0;let i=0,[n,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,r+=t){if(n==o||r==l)return i;let a=this.children[n],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,n)=>i+n.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new ge(d,t)}let n=Math.max(32,i>>5),r=n<<1,o=n>>1,l=[],a=0,h=-1,f=[];function c(d){let p;if(d.lines>r&&d instanceof s)for(let m of d.children)c(m);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof ge&&a&&(p=f[f.length-1])instanceof ge&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,f[f.length-1]=new ge(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>n&&u(),a+=d.lines,h+=d.length+1,f.push(d))}function u(){a!=0&&(l.push(f.length==1?f[0]:s.from(f,h)),h=-1,a=f.length=0)}for(let d of e)c(d);return u(),l.length==1?l[0]:new s(l,t)}};q.empty=new ge([""],0);function jf(s){let e=-1;for(let t of s)e+=t.length+1;return e}function Cs(s,e,t=0,i=1e9){for(let n=0,r=0,o=!0;r<s.length&&n<=i;r++){let l=s[r],a=n+l.length;a>=t&&(a>i&&(l=l.slice(0,i-n)),n<t&&(l=l.slice(t-n)),o?(e[e.length-1]+=l,o=!1):e.push(l)),n=a+1}return e}function Al(s,e,t){return Cs(s,[""],e,t)}var It=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof ge?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],r=this.offsets[i],o=r>>1,l=n instanceof ge?n.text.length:n.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`\n`,this;e--}else if(n instanceof ge){let a=n.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=n.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof ge?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Os=class{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new It(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=i?n:t<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},Ts=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:n}=this.inner.next(e);return t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol!="undefined"&&(q.prototype[Symbol.iterator]=function(){return this.iter()},It.prototype[Symbol.iterator]=Os.prototype[Symbol.iterator]=Ts.prototype[Symbol.iterator]=function(){return this});var lr=class{constructor(e,t,i,n){this.from=e,this.to=t,this.number=i,this.text=n}get length(){return this.to-this.from}},Zt="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(s=>s?parseInt(s,36):1);for(let s=1;s<Zt.length;s++)Zt[s]+=Zt[s-1];function zf(s){for(let e=1;e<Zt.length;e+=2)if(Zt[e]>s)return Zt[e-1]<=s;return!1}function Cl(s){return s>=127462&&s<=127487}var Ml=8205;function nt(s,e,t=!0,i=!0){return(t?Ll:Uf)(s,e,i)}function Ll(s,e,t){if(e==s.length)return e;e&&Pl(s.charCodeAt(e))&&Bl(s.charCodeAt(e-1))&&e--;let i=Ms(s,e);for(e+=ar(i);e<s.length;){let n=Ms(s,e);if(i==Ml||n==Ml||t&&zf(n))e+=ar(n),i=n;else if(Cl(n)){let r=0,o=e-2;for(;o>=0&&Cl(Ms(s,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Uf(s,e,t){for(;e>0;){let i=Ll(s,e-2,t);if(i<e)return i;e--}return 0}function Pl(s){return s>=56320&&s<57344}function Bl(s){return s>=55296&&s<56320}function Ms(s,e){let t=s.charCodeAt(e);if(!Bl(t)||e+1==s.length)return t;let i=s.charCodeAt(e+1);return Pl(i)?(t-55296<<10)+(i-56320)+65536:t}function ar(s){return s<65536?1:2}var hr=/\\r\\n?|\\n/,de=function(s){return s[s.Simple=0]="Simple",s[s.TrackDel=1]="TrackDel",s[s.TrackBefore=2]="TrackBefore",s[s.TrackAfter=3]="TrackAfter",s}(de||(de={})),Rt=class s{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,n=0;t<this.sections.length;){let r=this.sections[t++],o=this.sections[t++];o<0?(e(i,n,r),n+=r):n+=o,i+=r}}iterChangedRanges(e,t=!1){fr(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],n=this.sections[t++];n<0?e.push(i,n):e.push(n,i)}return new s(e)}composeDesc(e){return this.empty?e:e.empty?this:Il(this,e)}mapDesc(e,t=!1){return e.empty?this:cr(this,e,t)}mapPos(e,t=-1,i=de.Simple){let n=0,r=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=n+l;if(a<0){if(h>e)return r+(e-n);r+=l}else{if(i!=de.Simple&&h>=e&&(i==de.TrackDel&&n<e&&h>e||i==de.TrackBefore&&n<e||i==de.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==n||t<0?r:r+a;r+=a}n=h}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return r}touchesRange(e,t=e){for(let i=0,n=0;i<this.sections.length&&n<=t;){let r=this.sections[i++],o=this.sections[i++],l=n+r;if(o>=0&&n<=t&&l>=e)return n<e&&l>t?"cover":!0;n=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],n=this.sections[t++];e+=(e?" ":"")+i+(n>=0?":"+n:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new s(e)}static create(e){return new s(e)}},ye=class s extends Rt{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return fr(this,(t,i,n,r,o)=>e=e.replace(n,n+(i-t),o),!1),e}mapDesc(e,t=!1){return cr(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let n=0,r=0;n<t.length;n+=2){let o=t[n],l=t[n+1];if(l>=0){t[n]=l,t[n+1]=o;let a=n>>1;for(;i.length<a;)i.push(q.empty);i.push(o?e.slice(r,r+o):q.empty)}r+=o}return new s(t,i)}compose(e){return this.empty?e:e.empty?this:Il(this,e,!0)}map(e,t=!1){return e.empty?this:cr(this,e,t,!0)}iterChanges(e,t=!1){fr(this,e,t)}get desc(){return Rt.create(this.sections)}filter(e){let t=[],i=[],n=[],r=new Ft(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&r.len==0;){if(r.done)break e;let f=Math.min(r.len,a-l);le(n,f,-1);let c=r.ins==-1?-1:r.off==0?r.ins:0;le(t,f,c),c>0&&yt(i,t,r.text),r.forward(f),l+=f}let h=e[o++];for(;l<h;){if(r.done)break e;let f=Math.min(r.len,h-l);le(t,f,-1),le(n,f,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(f),l+=f}}return{changes:new s(t,i),filtered:Rt.create(n)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],n=this.sections[t+1];n<0?e.push(i):n==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let n=[],r=[],o=0,l=null;function a(f=!1){if(!f&&!n.length)return;o<t&&le(n,t-o,-1);let c=new s(n,r);l=l?l.compose(c.map(l)):c,n=[],r=[],o=0}function h(f){if(Array.isArray(f))for(let c of f)h(c);else if(f instanceof s){if(f.length!=t)throw new RangeError(`Mismatched change set length (got ${f.length}, expected ${t})`);a(),l=l?l.compose(f.map(l)):f}else{let{from:c,to:u=c,insert:d}=f;if(c>u||c<0||u>t)throw new RangeError(`Invalid change range ${c} to ${u} (in doc of length ${t})`);let p=d?typeof d=="string"?q.of(d.split(i||hr)):d:q.empty,m=p.length;if(c==u&&m==0)return;c<o&&a(),c>o&&le(n,c-o,-1),le(n,u-c,m),yt(r,n,p),o=u}}return h(e),a(!l),l}static empty(e){return new s(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let n=0;n<e.length;n++){let r=e[n];if(typeof r=="number")t.push(r,-1);else{if(!Array.isArray(r)||typeof r[0]!="number"||r.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length<n;)i.push(q.empty);i[n]=q.of(r.slice(1)),t.push(r[0],i[n].length)}}}return new s(t,i)}static createSet(e,t){return new s(e,t)}};function le(s,e,t,i=!1){if(e==0&&t<=0)return;let n=s.length-2;n>=0&&t<=0&&t==s[n+1]?s[n]+=e:e==0&&s[n]==0?s[n+1]+=t:i?(s[n]+=e,s[n+1]+=t):s.push(e,t)}function yt(s,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<s.length)s[s.length-1]=s[s.length-1].append(t);else{for(;s.length<i;)s.push(q.empty);s.push(t)}}function fr(s,e,t){let i=s.inserted;for(let n=0,r=0,o=0;o<s.sections.length;){let l=s.sections[o++],a=s.sections[o++];if(a<0)n+=l,r+=l;else{let h=n,f=r,c=q.empty;for(;h+=l,f+=a,a&&i&&(c=c.append(i[o-2>>1])),!(t||o==s.sections.length||s.sections[o+1]<0);)l=s.sections[o++],a=s.sections[o++];e(n,h,r,f,c),n=h,r=f}}}function cr(s,e,t,i=!1){let n=[],r=i?[]:null,o=new Ft(s),l=new Ft(e);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);le(n,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let h=l.len;for(le(n,l.ins,-1);h;){let f=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=f&&(le(n,0,o.ins),r&&yt(r,n,o.text),a=o.i),o.forward(f),h-=f}l.next()}else if(o.ins>=0){let h=0,f=o.len;for(;f;)if(l.ins==-1){let c=Math.min(f,l.len);h+=c,f-=c,l.forward(c)}else if(l.ins==0&&l.len<f)f-=l.len,l.next();else break;le(n,h,a<o.i?o.ins:0),r&&a<o.i&&yt(r,n,o.text),a=o.i,o.forward(o.len-f)}else{if(o.done&&l.done)return r?ye.createSet(n,r):Rt.create(n);throw new Error("Mismatched change set lengths")}}function Il(s,e,t=!1){let i=[],n=t?[]:null,r=new Ft(s),o=new Ft(e);for(let l=!1;;){if(r.done&&o.done)return n?ye.createSet(i,n):Rt.create(i);if(r.ins==0)le(i,r.len,0,l),r.next();else if(o.len==0&&!o.done)le(i,0,o.ins,l),n&&yt(n,i,o.text),o.next();else{if(r.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(r.len2,o.len),h=i.length;if(r.ins==-1){let f=o.ins==-1?-1:o.off?0:o.ins;le(i,a,f,l),n&&f&&yt(n,i,o.text)}else o.ins==-1?(le(i,r.off?0:r.len,a,l),n&&yt(n,i,r.textBit(a))):(le(i,r.off?0:r.len,o.off?0:o.ins,l),n&&!o.off&&yt(n,i,o.text));l=(r.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}var Ft=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?q.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?q.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},Xt=class s{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&16?this.to:this.from}get head(){return this.flags&16?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&4?-1:this.flags&8?1:0}get bidiLevel(){let e=this.flags&3;return e==3?null:e}get goalColumn(){let e=this.flags>>5;return e==33554431?void 0:e}map(e,t=-1){let i,n;return this.empty?i=n=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),n=e.mapPos(this.to,-1)),i==this.from&&n==this.to?this:new s(i,n,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return R.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return R.range(this.anchor,i)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return R.range(e.anchor,e.head)}static create(e,t,i){return new s(e,t,i)}},R=class s{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:s.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let t=0;t<this.ranges.length;t++)if(!this.ranges[t].eq(e.ranges[t]))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new s([this.main],0)}addRange(e,t=!0){return s.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,s.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new s(e.ranges.map(t=>Xt.fromJSON(t)),e.main)}static single(e,t=e){return new s([s.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,n=0;n<e.length;n++){let r=e[n];if(r.empty?r.from<=i:r.from<i)return s.normalized(e.slice(),t);i=r.to}return new s(e,t)}static cursor(e,t=0,i,n){return Xt.create(e,e,(t==0?0:t<0?4:8)|(i==null?3:Math.min(2,i))|(n!=null?n:33554431)<<5)}static range(e,t,i,n){let r=(i!=null?i:33554431)<<5|(n==null?3:Math.min(2,n));return t<e?Xt.create(t,e,24|r):Xt.create(e,t,(t>e?4:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((n,r)=>n.from-r.from),t=e.indexOf(i);for(let n=1;n<e.length;n++){let r=e[n],o=e[n-1];if(r.empty?r.from<=o.to:r.from<o.to){let l=o.from,a=Math.max(r.to,o.to);n<=t&&t--,e.splice(--n,2,r.anchor>r.head?s.range(a,l):s.range(l,a))}}return new s(e,t)}};function Rl(s,e){for(let t of s.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}var kr=0,V=class s{constructor(e,t,i,n,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=n,this.id=kr++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}static define(e={}){return new s(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Sr),!!e.static,e.enables)}of(e){return new ei([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can\'t compute a static facet");return new ei(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can\'t compute a static facet");return new ei(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}};function Sr(s,e){return s==e||s.length==e.length&&s.every((t,i)=>t===e[i])}var ei=class{constructor(e,t,i,n){this.dependencies=e,this.facet=t,this.type=i,this.value=n,this.id=kr++}dynamicSlot(e){var t;let i=this.value,n=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,h=!1,f=[];for(let c of this.dependencies)c=="doc"?a=!0:c=="selection"?h=!0:((t=e[c.id])!==null&&t!==void 0?t:1)&1||f.push(e[c.id]);return{create(c){return c.values[o]=i(c),1},update(c,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||ur(c,f)){let d=i(c);if(l?!Ol(d,c.values[o],n):!n(d,c.values[o]))return c.values[o]=d,1}return 0},reconfigure:(c,u)=>{let d,p=u.config.address[r];if(p!=null){let m=Ls(u,p);if(this.dependencies.every(g=>g instanceof V?u.facet(g)===c.facet(g):g instanceof rt?u.field(g,!1)==c.field(g,!1):!0)||(l?Ol(d=i(c),m,n):n(d=i(c),m)))return c.values[o]=m,0}else d=i(c);return c.values[o]=d,1}}}};function Ol(s,e,t){if(s.length!=e.length)return!1;for(let i=0;i<s.length;i++)if(!t(s[i],e[i]))return!1;return!0}function ur(s,e){let t=!1;for(let i of e)Di(s,i)&1&&(t=!0);return t}function Gf(s,e,t){let i=t.map(a=>s[a.id]),n=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=s[e.id]>>1;function l(a){let h=[];for(let f=0;f<i.length;f++){let c=Ls(a,i[f]);if(n[f]==2)for(let u of c)h.push(u);else h.push(c)}return e.combine(h)}return{create(a){for(let h of i)Di(a,h);return a.values[o]=l(a),1},update(a,h){if(!ur(a,r))return 0;let f=l(a);return e.compare(f,a.values[o])?0:(a.values[o]=f,1)},reconfigure(a,h){let f=ur(a,i),c=h.config.facets[e.id],u=h.facet(e);if(c&&!f&&Sr(t,c))return a.values[o]=u,0;let d=l(a);return e.compare(d,u)?(a.values[o]=u,0):(a.values[o]=d,1)}}}var Tl=V.define({static:!0}),rt=class s{constructor(e,t,i,n,r){this.id=e,this.createF=t,this.updateF=i,this.compareF=n,this.spec=r,this.provides=void 0}static define(e){let t=new s(kr++,e.create,e.update,e.compare||((i,n)=>i===n),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Tl).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,n)=>{let r=i.values[t],o=this.updateF(r,n);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,n)=>n.config.address[this.id]!=null?(i.values[t]=n.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,Tl.of({field:this,create:e})]}get extension(){return this}},Pt={lowest:4,low:3,default:2,high:1,highest:0};function Ei(s){return e=>new Ns(e,s)}var Bs={highest:Ei(Pt.highest),high:Ei(Pt.high),default:Ei(Pt.default),low:Ei(Pt.low),lowest:Ei(Pt.lowest)},Ns=class{constructor(e,t){this.inner=e,this.prec=t}},Es=class s{of(e){return new Li(this,e)}reconfigure(e){return s.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}},Li=class{constructor(e,t){this.compartment=e,this.inner=t}},Ds=class s{constructor(e,t,i,n,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=n,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let n=[],r=Object.create(null),o=new Map;for(let u of Jf(e,t,o))u instanceof rt?n.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of n)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let f=i==null?void 0:i.config.facets;for(let u in r){let d=r[u],p=d[0].facet,m=f&&f[u]||[];if(d.every(g=>g.type==0))if(l[p.id]=a.length<<1|1,Sr(m,d))a.push(i.facet(p));else{let g=p.combine(d.map(b=>b.value));a.push(i&&p.compare(g,i.facet(p))?i.facet(p):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(b=>g.dynamicSlot(b)));l[p.id]=h.length<<1,h.push(g=>Gf(g,p,d))}}let c=h.map(u=>u(l));return new s(e,o,c,l,a,r)}};function Jf(s,e,t){let i=[[],[],[],[],[]],n=new Map;function r(o,l){let a=n.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof Li&&t.delete(o.compartment)}if(n.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof Li){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof Ns)r(o.inner,o.prec);else if(o instanceof rt)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof ei)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,Pt.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(s,Pt.default),i.reduce((o,l)=>o.concat(l))}function Di(s,e){if(e&1)return 2;let t=e>>1,i=s.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;s.status[t]=4;let n=s.computeSlot(s,s.config.dynamicSlots[t]);return s.status[t]=2|n}function Ls(s,e){return e&1?s.config.staticValues[e>>1]:s.values[e>>1]}var Fl=V.define(),$l=V.define({combine:s=>s.some(e=>e),static:!0}),Vl=V.define({combine:s=>s.length?s[0]:void 0,static:!0}),Hl=V.define(),_l=V.define(),Wl=V.define(),Kl=V.define({combine:s=>s.length?s[0]:!1}),ot=class{constructor(e,t){this.type=e,this.value=t}static define(){return new dr}},dr=class{of(e){return new ot(this,e)}},pr=class{constructor(e){this.map=e}of(e){return new Z(this,e)}},Z=class s{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new s(this.type,t)}is(e){return this.type==e}static define(e={}){return new pr(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let n of e){let r=n.map(t);r&&i.push(r)}return i}};Z.reconfigure=Z.define();Z.appendConfig=Z.define();var pe=class s{constructor(e,t,i,n,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=n,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Rl(i,t.newLength),r.some(l=>l.type==s.time)||(this.annotations=r.concat(s.time.of(Date.now())))}static create(e,t,i,n,r,o){return new s(e,t,i,n,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(s.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}};pe.time=ot.define();pe.userEvent=ot.define();pe.addToHistory=ot.define();pe.remote=ot.define();function Yf(s,e){let t=[];for(let i=0,n=0;;){let r,o;if(i<s.length&&(n==e.length||e[n]>=s[i]))r=s[i++],o=s[i++];else if(n<e.length)r=e[n++],o=e[n++];else return t;!t.length||t[t.length-1]<r?t.push(r,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function ql(s,e,t){var i;let n,r,o;return t?(n=e.changes,r=ye.empty(e.changes.length),o=s.changes.compose(e.changes)):(n=e.changes.map(s.changes),r=s.changes.mapDesc(e.changes,!0),o=s.changes.compose(n)),{changes:o,selection:e.selection?e.selection.map(r):(i=s.selection)===null||i===void 0?void 0:i.map(n),effects:Z.mapEffects(s.effects,n).concat(Z.mapEffects(e.effects,r)),annotations:s.annotations.length?s.annotations.concat(e.annotations):e.annotations,scrollIntoView:s.scrollIntoView||e.scrollIntoView}}function mr(s,e,t){let i=e.selection,n=ti(e.annotations);return e.userEvent&&(n=n.concat(pe.userEvent.of(e.userEvent))),{changes:e.changes instanceof ye?e.changes:ye.of(e.changes||[],t,s.facet(Vl)),selection:i&&(i instanceof R?i:R.single(i.anchor,i.head)),effects:ti(e.effects),annotations:n,scrollIntoView:!!e.scrollIntoView}}function jl(s,e,t){let i=mr(s,e.length?e[0]:{},s.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let r=1;r<e.length;r++){e[r].filter===!1&&(t=!1);let o=!!e[r].sequential;i=ql(i,mr(s,e[r],o?i.changes.newLength:s.doc.length),o)}let n=pe.create(s,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Qf(t?Xf(n):n)}function Xf(s){let e=s.startState,t=!0;for(let n of e.facet(Hl)){let r=n(s);if(r===!1){t=!1;break}Array.isArray(r)&&(t=t===!0?r:Yf(t,r))}if(t!==!0){let n,r;if(t===!1)r=s.changes.invertedDesc,n=ye.empty(e.doc.length);else{let o=s.changes.filter(t);n=o.changes,r=o.filtered.mapDesc(o.changes).invertedDesc}s=pe.create(e,n,s.selection&&s.selection.map(r),Z.mapEffects(s.effects,r),s.annotations,s.scrollIntoView)}let i=e.facet(_l);for(let n=i.length-1;n>=0;n--){let r=i[n](s);r instanceof pe?s=r:Array.isArray(r)&&r.length==1&&r[0]instanceof pe?s=r[0]:s=jl(e,ti(r),!1)}return s}function Qf(s){let e=s.startState,t=e.facet(Wl),i=s;for(let n=t.length-1;n>=0;n--){let r=t[n](s);r&&Object.keys(r).length&&(i=ql(i,mr(e,r,s.changes.newLength),!0))}return i==s?s:pe.create(e,s.changes,s.selection,i.effects,i.annotations,i.scrollIntoView)}var Zf=[];function ti(s){return s==null?Zf:Array.isArray(s)?s:[s]}var Ke=function(s){return s[s.Word=0]="Word",s[s.Space=1]="Space",s[s.Other=2]="Other",s}(Ke||(Ke={})),ec=/[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/,gr;try{gr=new RegExp("[\\\\p{Alphabetic}\\\\p{Number}_]","u")}catch(s){}function tc(s){if(gr)return gr.test(s);for(let e=0;e<s.length;e++){let t=s[e];if(/\\w/.test(t)||t>"\\x80"&&(t.toUpperCase()!=t.toLowerCase()||ec.test(t)))return!0}return!1}function ic(s){return e=>{if(!/\\S/.test(e))return Ke.Space;if(tc(e))return Ke.Word;for(let t=0;t<s.length;t++)if(e.indexOf(s[t])>-1)return Ke.Word;return Ke.Other}}var Q=class s{constructor(e,t,i,n,r,o){this.config=e,this.doc=t,this.selection=i,this.values=n,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)Di(this,l<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Di(this,i),Ls(this,i)}update(...e){return jl(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:n}=t;for(let o of e.effects)o.is(Es.reconfigure)?(t&&(n=new Map,t.compartments.forEach((l,a)=>n.set(a,l)),t=null),n.set(o.value.compartment,o.value.extension)):o.is(Z.reconfigure)?(t=null,i=o.value):o.is(Z.appendConfig)&&(t=null,i=ti(i).concat(o.value));let r;t?r=e.startState.values.slice():(t=Ds.resolve(i,n,this),r=new s(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,a)=>a.reconfigure(l,this),null).values),new s(t,e.newDoc,e.newSelection,r,(o,l)=>l.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:R.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),n=this.changes(i.changes),r=[i.range],o=ti(i.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),h=this.changes(a.changes),f=h.map(n);for(let u=0;u<l;u++)r[u]=r[u].map(f);let c=n.mapDesc(h,!0);r.push(a.range.map(c)),n=n.compose(f),o=Z.mapEffects(o,f).concat(Z.mapEffects(ti(a.effects),c))}return{changes:n,selection:R.create(r,t.mainIndex),effects:o}}changes(e=[]){return e instanceof ye?e:ye.of(e,this.doc.length,this.facet(s.lineSeparator))}toText(e){return q.of(e.split(this.facet(s.lineSeparator)||hr))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Di(this,t),Ls(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let n=e[i];n instanceof rt&&this.config.address[n.id]!=null&&(t[i]=n.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let n=[];if(i){for(let r in i)if(Object.prototype.hasOwnProperty.call(e,r)){let o=i[r],l=e[r];n.push(o.init(a=>o.spec.fromJSON(l,a)))}}return s.create({doc:e.doc,selection:R.fromJSON(e.selection),extensions:t.extensions?n.concat([t.extensions]):n})}static create(e={}){let t=Ds.resolve(e.extensions||[],new Map),i=e.doc instanceof q?e.doc:q.of((e.doc||"").split(t.staticFacet(s.lineSeparator)||hr)),n=e.selection?e.selection instanceof R?e.selection:R.single(e.selection.anchor,e.selection.head):R.single(0);return Rl(n,i.length),t.staticFacet($l)||(n=n.asSingle()),new s(t,i,n,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(s.tabSize)}get lineBreak(){return this.facet(s.lineSeparator)||`\n`}get readOnly(){return this.facet(Kl)}phrase(e,...t){for(let i of this.facet(s.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\\$(\\$|\\d*)/g,(i,n)=>{if(n=="$")return"$";let r=+(n||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let n=[];for(let r of this.facet(Fl))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&n.push(o[e]);return n}charCategorizer(e){return ic(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:n}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let a=nt(t,o,!1);if(r(t.slice(a,o))!=Ke.Word)break;o=a}for(;l<n;){let a=nt(t,l);if(r(t.slice(l,a))!=Ke.Word)break;l=a}return o==l?null:R.range(o+i,l+i)}};Q.allowMultipleSelections=$l;Q.tabSize=V.define({combine:s=>s.length?s[0]:4});Q.lineSeparator=Vl;Q.readOnly=Kl;Q.phrases=V.define({compare(s,e){let t=Object.keys(s),i=Object.keys(e);return t.length==i.length&&t.every(n=>s[n]==e[n])}});Q.languageData=Fl;Q.changeFilter=Hl;Q.transactionFilter=_l;Q.transactionExtender=Wl;Es.reconfigure=Z.define();var lt=class{eq(e){return this==e}range(e,t=e){return Pi.create(e,t,this)}};lt.prototype.startSide=lt.prototype.endSide=0;lt.prototype.point=!1;lt.prototype.mapMode=de.TrackDel;var Pi=class s{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new s(e,t,i)}};function yr(s,e){return s.from-e.from||s.value.startSide-e.value.startSide}var br=class s{constructor(e,t,i,n){this.from=e,this.to=t,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,n=0){let r=i?this.to:this.from;for(let o=n,l=r.length;;){if(o==l)return o;let a=o+l>>1,h=r[a]-e||(i?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,t,i,n){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);r<o;r++)if(n(this.from[r]+e,this.to[r]+e,this.value[r])===!1)return!1}map(e,t){let i=[],n=[],r=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let h=this.value[a],f=this.from[a]+e,c=this.to[a]+e,u,d;if(f==c){let p=t.mapPos(f,h.startSide,h.mapMode);if(p==null||(u=d=p,h.startSide!=h.endSide&&(d=t.mapPos(f,h.endSide),d<u)))continue}else if(u=t.mapPos(f,h.startSide),d=t.mapPos(c,h.endSide),u>d||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),i.push(h),n.push(u-o),r.push(d-o))}return{mapped:i.length?new s(n,r,i,l):null,pos:o}}},ne=class s{constructor(e,t,i,n){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=n}static create(e,t,i,n){return new s(e,t,i,n)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:n=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(yr)),this.isEmpty)return t.length?s.of(t):this;let l=new Ps(this,null,-1).goto(0),a=0,h=[],f=new $t;for(;l.value||a<t.length;)if(a<t.length&&(l.from-t[a].from||l.startSide-t[a].value.startSide)>=0){let c=t[a++];f.addInner(c.from,c.to,c.value)||h.push(c)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(l.chunkIndex)<t[a].from)&&(!o||n>this.chunkEnd(l.chunkIndex)||r<this.chunkPos[l.chunkIndex])&&f.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||n>l.to||r<l.from||o(l.from,l.to,l.value))&&(f.addInner(l.from,l.to,l.value)||h.push(Pi.create(l.from,l.to,l.value))),l.next());return f.finishInner(this.nextLayer.isEmpty&&!h.length?s.empty:this.nextLayer.update({add:h,filter:o,filterFrom:n,filterTo:r}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],n=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],a=this.chunk[o],h=e.touchesRange(l,l+a.length);if(h===!1)n=Math.max(n,a.maxPoint),t.push(a),i.push(e.mapPos(l));else if(h===!0){let{mapped:f,pos:c}=a.map(l,e);f&&(n=Math.max(n,f.maxPoint),t.push(f),i.push(c))}}let r=this.nextLayer.map(e);return t.length==0?r:new s(i,t,r||s.empty,n)}between(e,t,i){if(!this.isEmpty){for(let n=0;n<this.chunk.length;n++){let r=this.chunkPos[n],o=this.chunk[n];if(t>=r&&e<=r+o.length&&o.between(r,e-r,t-r,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Bi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Bi.from(e).goto(t)}static compare(e,t,i,n,r=-1){let o=e.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=r),l=t.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=r),a=Nl(o,l,i),h=new Bt(o,a,r),f=new Bt(l,a,r);i.iterGaps((c,u,d)=>El(h,c,f,u,d,n)),i.empty&&i.length==0&&El(h,0,f,0,0,n)}static eq(e,t,i=0,n){n==null&&(n=999999999);let r=e.filter(f=>!f.isEmpty&&t.indexOf(f)<0),o=t.filter(f=>!f.isEmpty&&e.indexOf(f)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let l=Nl(r,o),a=new Bt(r,l,0).goto(i),h=new Bt(o,l,0).goto(i);for(;;){if(a.to!=h.to||!wr(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>n)return!0;a.next(),h.next()}}static spans(e,t,i,n,r=-1){let o=new Bt(e,null,r).goto(t),l=t,a=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let f=o.activeForPoint(o.to),c=o.pointFrom<t?f.length+1:Math.min(f.length,a);n.point(l,h,o.point,f,c,o.pointRank),a=Math.min(o.openEnd(h),f.length)}else h>l&&(n.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>i)return a+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(e,t=!1){let i=new $t;for(let n of e instanceof Pi?[e]:t?sc(e):e)i.add(n.from,n.to,n.value);return i.finish()}};ne.empty=new ne([],[],null,-1);function sc(s){if(s.length>1)for(let e=s[0],t=1;t<s.length;t++){let i=s[t];if(yr(e,i)>0)return s.slice().sort(yr);e=i}return s}ne.empty.nextLayer=ne.empty;var $t=class s{constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}finishChunk(e){this.chunks.push(new br(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new s)).add(e,t,i)}addInner(e,t,i){let n=e-this.lastTo||i.startSide-this.last.endSide;if(n<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return n<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(ne.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=ne.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function Nl(s,e,t){let i=new Map;for(let r of s)for(let o=0;o<r.chunk.length;o++)r.chunk[o].maxPoint<=0&&i.set(r.chunk[o],r.chunkPos[o]);let n=new Set;for(let r of e)for(let o=0;o<r.chunk.length;o++){let l=i.get(r.chunk[o]);l!=null&&(t?t.mapPos(l):l)==r.chunkPos[o]&&!(t!=null&&t.touchesRange(l,l+r.chunk[o].length))&&n.add(r.chunk[o])}return n}var Ps=class{constructor(e,t,i,n=0){this.layer=e,this.skip=t,this.minPoint=i,this.rank=n}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,i){for(;this.chunkIndex<this.layer.chunk.length;){let n=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(n)||this.layer.chunkEnd(this.chunkIndex)<e||n.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let n=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!i||this.rangeIndex<n)&&this.setRangeIndex(n)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],i=e+t.from[this.rangeIndex];if(this.from=i,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}},Bi=class s{constructor(e){this.heap=e}static from(e,t=null,i=-1){let n=[];for(let r=0;r<e.length;r++)for(let o=e[r];!o.isEmpty;o=o.nextLayer)o.maxPoint>=i&&n.push(new Ps(o,t,i,r));return n.length==1?n[0]:new s(n)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)or(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)or(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),or(this.heap,0)}}};function or(s,e){for(let t=s[e];;){let i=(e<<1)+1;if(i>=s.length)break;let n=s[i];if(i+1<s.length&&n.compare(s[i+1])>=0&&(n=s[i+1],i++),t.compare(n)<0)break;s[i]=t,s[e]=n,e=i}}var Bt=class{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Bi.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){xs(this.active,e),xs(this.activeTo,e),xs(this.activeRank,e),this.minActive=Dl(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:n,rank:r}=this.cursor;for(;t<this.activeRank.length&&this.activeRank[t]<=r;)t++;As(this.active,t,i),As(this.activeTo,t,n),As(this.activeRank,t,r),e&&As(e,t,this.cursor.from),this.minActive=Dl(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>e){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),i&&xs(i,n)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=r,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=r.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let n=i.length-1;n>=0&&i[n]<e;n--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}};function El(s,e,t,i,n,r){s.goto(e),t.goto(i);let o=i+n,l=i,a=i-e;for(;;){let h=s.to+a-t.to||s.endSide-t.endSide,f=h<0?s.to+a:t.to,c=Math.min(f,o);if(s.point||t.point?s.point&&t.point&&(s.point==t.point||s.point.eq(t.point))&&wr(s.activeForPoint(s.to+a),t.activeForPoint(t.to))||r.comparePoint(l,c,s.point,t.point):c>l&&!wr(s.active,t.active)&&r.compareRange(l,c,s.active,t.active),f>o)break;l=f,h<=0&&s.next(),h>=0&&t.next()}}function wr(s,e){if(s.length!=e.length)return!1;for(let t=0;t<s.length;t++)if(s[t]!=e[t]&&!s[t].eq(e[t]))return!1;return!0}function xs(s,e){for(let t=e,i=s.length-1;t<i;t++)s[t]=s[t+1];s.pop()}function As(s,e,t){for(let i=s.length-1;i>=e;i--)s[i+1]=s[i];s[e]=t}function Dl(s,e){let t=-1,i=1e9;for(let n=0;n<e.length;n++)(e[n]-i||s[n].endSide-s[t].endSide)<0&&(t=n,i=e[n]);return t}function zl(s,e,t,i){for(let n=0,r=0;;){if(r>=e)return n;if(n==s.length)break;r+=s.charCodeAt(n)==9?t-r%t:1,n=nt(s,n)}return i===!0?-1:s.length}var vr="\\u037C",Ul=typeof Symbol=="undefined"?"__"+vr:Symbol.for(vr),xr=typeof Symbol=="undefined"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Gl=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{},Ce=class{constructor(e,t){this.rules=[];let{finish:i}=t||{};function n(o){return/^@/.test(o)?[o]:o.split(/,\\s*/)}function r(o,l,a,h){let f=[],c=/^@(\\w+)\\b/.exec(o[0]),u=c&&c[1]=="keyframes";if(c&&l==null)return a.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))r(d.split(/,\\s*/).map(m=>o.map(g=>m.replace(/&/,g))).reduce((m,g)=>m.concat(g)),p,a);else if(p&&typeof p=="object"){if(!c)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(n(d),p,f,u)}else p!=null&&f.push(d.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(f.length||u)&&a.push((i&&!c&&!h?o.map(i):o).join(", ")+" {"+f.join(" ")+"}")}for(let o in e)r(n(o),e[o],this.rules)}getRules(){return this.rules.join(`\n`)}static newName(){let e=Gl[Ul]||1;return Gl[Ul]=e+1,vr+e.toString(36)}static mount(e,t,i){let n=e[xr],r=i&&i.nonce;n?r&&n.setNonce(r):n=new Ar(e,r),n.mount(Array.isArray(t)?t:[t])}},Jl=new Map,Ar=class{constructor(e,t){this.root=e;let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let r=Jl.get(i);if(r)return e[xr]=r;this.sheet=new n.CSSStyleSheet,Jl.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[xr]=this}mount(e){let t=this.sheet,i=0,n=0;for(let r=0;r<e.length;r++){let o=e[r],l=this.modules.indexOf(o);if(l<n&&l>-1&&(this.modules.splice(l,1),n--,l=-1),l==-1){if(this.modules.splice(n++,0,o),t)for(let a=0;a<o.rules.length;a++)t.insertRule(o.rules[a],i++)}else{for(;n<l;)i+=this.modules[n++].rules.length;i+=o.rules.length,n++}}if(t)this.root.adoptedStyleSheets.indexOf(this.sheet)<0&&(this.root.adoptedStyleSheets=[this.sheet,...this.root.adoptedStyleSheets]);else{let r="";for(let l=0;l<this.modules.length;l++)r+=this.modules[l].getRules()+`\n`;this.styleTag.textContent=r;let o=this.root.head||this.root;this.styleTag.parentNode!=o&&o.insertBefore(this.styleTag,o.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var Vt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\\\",221:"]",222:"\'"},Rs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:\'"\'},Nd=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),Ed=typeof navigator!="undefined"&&/MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent);for(ee=0;ee<10;ee++)Vt[48+ee]=Vt[96+ee]=String(ee);var ee;for(ee=1;ee<=24;ee++)Vt[ee+111]="F"+ee;var ee;for(ee=65;ee<=90;ee++)Vt[ee]=String.fromCharCode(ee+32),Rs[ee]=String.fromCharCode(ee);var ee;for(Is in Vt)Rs.hasOwnProperty(Is)||(Rs[Is]=Vt[Is]);var Is;function js(s){let e;return s.nodeType==11?e=s.getSelection?s:s.ownerDocument:e=s,e.getSelection()}function ri(s,e){return e?s==e||s.contains(e.nodeType!=1?e.parentNode:e):!1}function oc(s){let e=s.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Ks(s,e){if(!e.anchorNode)return!1;try{return ri(s,e.anchorNode)}catch(t){return!1}}function Hi(s){return s.nodeType==3?oi(s,0,s.nodeValue.length).getClientRects():s.nodeType==1?s.getClientRects():[]}function zs(s,e,t,i){return t?Yl(s,e,t,i,-1)||Yl(s,e,t,i,1):!1}function Us(s){for(var e=0;;e++)if(s=s.previousSibling,!s)return e}function Yl(s,e,t,i,n){for(;;){if(s==t&&e==i)return!0;if(e==(n<0?0:_i(s))){if(s.nodeName=="DIV")return!1;let r=s.parentNode;if(!r||r.nodeType!=1)return!1;e=Us(s)+(n<0?0:1),s=r}else if(s.nodeType==1){if(s=s.childNodes[e+(n<0?-1:0)],s.nodeType==1&&s.contentEditable=="false")return!1;e=n<0?_i(s):0}else return!1}}function _i(s){return s.nodeType==3?s.nodeValue.length:s.childNodes.length}var xa={left:0,right:0,top:0,bottom:0};function lo(s,e){let t=e?s.left:s.right;return{left:t,right:t,top:s.top,bottom:s.bottom}}function lc(s){return{left:0,right:s.innerWidth,top:0,bottom:s.innerHeight}}function ac(s,e,t,i,n,r,o,l){let a=s.ownerDocument,h=a.defaultView||window;for(let f=s;f;)if(f.nodeType==1){let c,u=f==a.body;if(u)c=lc(h);else{if(f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let m=f.getBoundingClientRect();c={left:m.left,right:m.left+f.clientWidth,top:m.top,bottom:m.top+f.clientHeight}}let d=0,p=0;if(n=="nearest")e.top<c.top?(p=-(c.top-e.top+o),t>0&&e.bottom>c.bottom+p&&(p=e.bottom-c.bottom+p+o)):e.bottom>c.bottom&&(p=e.bottom-c.bottom+o,t<0&&e.top-p<c.top&&(p=-(c.top+p-e.top+o)));else{let m=e.bottom-e.top,g=c.bottom-c.top;p=(n=="center"&&m<=g?e.top+m/2-g/2:n=="start"||n=="center"&&t<0?e.top-o:e.bottom-g+o)-c.top}if(i=="nearest"?e.left<c.left?(d=-(c.left-e.left+r),t>0&&e.right>c.right+d&&(d=e.right-c.right+d+r)):e.right>c.right&&(d=e.right-c.right+r,t<0&&e.left<c.left+d&&(d=-(c.left+d-e.left+r))):d=(i=="center"?e.left+(e.right-e.left)/2-(c.right-c.left)/2:i=="start"==l?e.left-r:e.right-(c.right-c.left)+r)-c.left,d||p)if(u)h.scrollBy(d,p);else{let m=0,g=0;if(p){let b=f.scrollTop;f.scrollTop+=p,g=f.scrollTop-b}if(d){let b=f.scrollLeft;f.scrollLeft+=d,m=f.scrollLeft-b}e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g},m&&Math.abs(m-d)<1&&(i="nearest"),g&&Math.abs(g-p)<1&&(n="nearest")}if(u)break;f=f.assignedSlot||f.parentNode}else if(f.nodeType==11)f=f.host;else break}function hc(s){let e=s.ownerDocument;for(let t=s.parentNode;t&&t!=e.body;)if(t.nodeType==1){if(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.assignedSlot||t.parentNode}else if(t.nodeType==11)t=t.host;else break;return null}var Nr=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){this.set(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)}set(e,t,i,n){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=n}},ii=null;function Aa(s){if(s.setActive)return s.setActive();if(ii)return s.focus(ii);let e=[];for(let t=s;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(s.focus(ii==null?{get preventScroll(){return ii={preventScroll:!0},!0}}:void 0),!ii){ii=!1;for(let t=0;t<e.length;){let i=e[t++],n=e[t++],r=e[t++];i.scrollTop!=n&&(i.scrollTop=n),i.scrollLeft!=r&&(i.scrollLeft=r)}}}var Xl;function oi(s,e,t=e){let i=Xl||(Xl=document.createRange());return i.setEnd(s,t),i.setStart(s,e),i}function ni(s,e,t){let i={key:e,code:e,keyCode:t,which:t,cancelable:!0},n=new KeyboardEvent("keydown",i);n.synthetic=!0,s.dispatchEvent(n);let r=new KeyboardEvent("keyup",i);return r.synthetic=!0,s.dispatchEvent(r),n.defaultPrevented||r.defaultPrevented}function fc(s){for(;s;){if(s&&(s.nodeType==9||s.nodeType==11&&s.host))return s;s=s.assignedSlot||s.parentNode}return null}function Ca(s){for(;s.attributes.length;)s.removeAttributeNode(s.attributes[0])}function cc(s,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(;;)if(i){if(t.nodeType!=1)return!1;let n=t.childNodes[i-1];n.contentEditable=="false"?i--:(t=n,i=_i(t))}else{if(t==s)return!0;i=Us(t),t=t.parentNode}}var ae=class s{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new s(e.parentNode,Us(e),t)}static after(e,t){return new s(e.parentNode,Us(e)+1,t)}},ao=[],U=class s{constructor(){this.parent=null,this.dom=null,this.dirty=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let i of this.children){if(i==e)return t;t+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}coordsAt(e,t){return null}sync(e,t){if(this.dirty&2){let i=this.dom,n=null,r;for(let o of this.children){if(o.dirty){if(!o.dom&&(r=n?n.nextSibling:i.firstChild)){let l=s.get(r);(!l||!l.parent&&l.canReuseDOM(o))&&o.reuseDOM(r)}o.sync(e,t),o.dirty=0}if(r=n?n.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&r!=o.dom&&(t.written=!0),o.dom.parentNode==i)for(;r&&r!=o.dom;)r=Ql(r);else i.insertBefore(o.dom,r);n=o.dom}for(r=n?n.nextSibling:i.firstChild,r&&t&&t.node==i&&(t.written=!0);r;)r=Ql(r)}else if(this.dirty&1)for(let i of this.children)i.dirty&&(i.sync(e,t),i.dirty=0)}reuseDOM(e){}localPosFromDOM(e,t){let i;if(e==this.dom)i=this.dom.childNodes[t];else{let n=_i(e)==0?0:t==0?-1:1;for(;;){let r=e.parentNode;if(r==this.dom)break;n==0&&r.firstChild!=r.lastChild&&(e==r.firstChild?n=-1:n=1),e=r}n<0?i=e:i=e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!s.get(i);)i=i.nextSibling;if(!i)return this.length;for(let n=0,r=0;;n++){let o=this.children[n];if(o.dom==i)return r;r+=o.length+o.breakAfter}}domBoundsAround(e,t,i=0){let n=-1,r=-1,o=-1,l=-1;for(let a=0,h=i,f=i;a<this.children.length;a++){let c=this.children[a],u=h+c.length;if(h<e&&u>t)return c.domBoundsAround(e,t,h);if(u>=e&&n==-1&&(n=a,r=h),h>t&&c.dom.parentNode==this.dom){o=a,l=f;break}f=u,h=u+c.breakAfter}return{from:r,to:l<0?i+this.length:l,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(e=!1){this.dirty|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.dirty|=2),t.dirty&1)return;t.dirty|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.dirty&&this.markParentsDirty(!0))}setDOM(e){this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,i=ao){this.markDirty();for(let n=e;n<t;n++){let r=this.children[n];r.parent==this&&r.destroy()}this.children.splice(e,t-e,...i);for(let n=0;n<i.length;n++)i[n].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Gs(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,i,n,r,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor}getSide(){return 0}destroy(){this.parent=null}};U.prototype.breakAfter=0;function Ql(s){let e=s.nextSibling;return s.parentNode.removeChild(s),e}var Gs=class{constructor(e,t,i){this.children=e,this.pos=t,this.i=i,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}};function Ma(s,e,t,i,n,r,o,l,a){let{children:h}=s,f=h.length?h[e]:null,c=r.length?r[r.length-1]:null,u=c?c.breakAfter:o;if(!(e==i&&f&&!o&&!u&&r.length<2&&f.merge(t,n,r.length?c:null,t==0,l,a))){if(i<h.length){let d=h[i];d&&n<d.length?(e==i&&(d=d.split(n),n=0),!u&&c&&d.merge(0,n,c,!0,0,a)?r[r.length-1]=d:(n&&d.merge(0,n,null,!1,0,a),r.push(d))):d!=null&&d.breakAfter&&(c?c.breakAfter=1:o=1),i++}for(f&&(f.breakAfter=o,t>0&&(!o&&r.length&&f.merge(t,f.length,r[0],!1,l,0)?f.breakAfter=r.shift().breakAfter:(t<f.length||f.children.length&&f.children[f.children.length-1].length==0)&&f.merge(t,f.length,null,!1,l,0),e++));e<i&&r.length;)if(h[i-1].become(r[r.length-1]))i--,r.pop(),a=r.length?0:l;else if(h[e].become(r[0]))e++,r.shift(),l=r.length?0:a;else break;!r.length&&e&&i<h.length&&!h[e-1].breakAfter&&h[i].merge(0,0,h[e-1],!1,l,a)&&e--,(e<i||r.length)&&s.replaceChildren(e,i,r)}}function Oa(s,e,t,i,n,r){let o=s.childCursor(),{i:l,off:a}=o.findPos(t,1),{i:h,off:f}=o.findPos(e,-1),c=e-t;for(let u of i)c+=u.length;s.length+=c,Ma(s,h,f,l,a,i,0,n,r)}var be=typeof navigator!="undefined"?navigator:{userAgent:"",vendor:"",platform:""},Er=typeof document!="undefined"?document:{documentElement:{style:{}}},Dr=/Edge\\/(\\d+)/.exec(be.userAgent),Ta=/MSIE \\d/.test(be.userAgent),Lr=/Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(be.userAgent),an=!!(Ta||Lr||Dr),Zl=!an&&/gecko\\/(\\d+)/i.test(be.userAgent),Cr=!an&&/Chrome\\/(\\d+)/.exec(be.userAgent),ea="webkitFontSmoothing"in Er.documentElement.style,Na=!an&&/Apple Computer/.test(be.vendor),ta=Na&&(/Mobile\\/\\w+/.test(be.userAgent)||be.maxTouchPoints>2),B={mac:ta||/Mac/.test(be.platform),windows:/Win/.test(be.platform),linux:/Linux|X11/.test(be.platform),ie:an,ie_version:Ta?Er.documentMode||6:Lr?+Lr[1]:Dr?+Dr[1]:0,gecko:Zl,gecko_version:Zl?+(/Firefox\\/(\\d+)/.exec(be.userAgent)||[0,0])[1]:0,chrome:!!Cr,chrome_version:Cr?+Cr[1]:0,ios:ta,android:/Android\\b/.test(be.userAgent),webkit:ea,safari:Na,webkit_version:ea?+(/\\bAppleWebKit\\/(\\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:Er.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"},uc=256,Ht=class s extends U{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,i){return i&&(!(i instanceof s)||this.length-(t-e)+i.length>uc)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new s(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new ae(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return Pr(this.dom,e,t)}},ft=class s extends U{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let n of t)n.setParent(this)}setAttrs(e){if(Ca(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.dirty|=6)}sync(e,t){this.dom?this.dirty&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,i,n,r,o){return i&&(!(i instanceof s&&i.mark.eq(this.mark))||e&&r<=0||t<this.length&&o<=0)?!1:(Oa(this,e,t,i?i.children:[],r-1,o-1),this.markDirty(),!0)}split(e){let t=[],i=0,n=-1,r=0;for(let l of this.children){let a=i+l.length;a>e&&t.push(i<e?l.split(e-i):l),n<0&&i>=e&&(n=r),i=a,r++}let o=this.length-e;return this.length=e,n>-1&&(this.children.length=n,this.markDirty()),new s(this.mark,t,o)}domAtPos(e){return Pa(this,e)}coordsAt(e,t){return Ia(this,e,t)}};function Pr(s,e,t){let i=s.nodeValue.length;e>i&&(e=i);let n=e,r=e,o=0;e==0&&t<0||e==i&&t>=0?B.chrome||B.gecko||(e?(n--,o=1):r<i&&(r++,o=-1)):t<0?n--:r<i&&r++;let l=oi(s,n,r).getClientRects();if(!l.length)return xa;let a=l[(o?o<0:t>=0)?0:l.length-1];return B.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?lo(a,o<0):a||null}var Wi=class s extends U{constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}static create(e,t,i){return new(e.customView||s)(e,t,i)}split(e){let t=s.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.dom.contentEditable="false")}getSide(){return this.side}merge(e,t,i,n,r,o){return i&&(!(i instanceof s)||!this.widget.compare(i.widget)||e>0&&r<=0||t<this.length&&o<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-t),!0)}become(e){return e.length==this.length&&e instanceof s&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return q.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,i=t&&t.state.doc,n=this.posAtStart;return i?i.slice(n,n+this.length):q.empty}domAtPos(e){return(this.length?e==0:this.side>0)?ae.before(this.dom):ae.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let i=this.dom.getClientRects(),n=null;if(!i.length)return xa;for(let r=e>0?i.length-1:0;n=i[r],!(e>0?r==0:r==i.length-1||n.top<n.bottom);r+=e>0?-1:1);return this.length?n:lo(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}},Js=class extends Wi{domAtPos(e){let{topView:t,text:i}=this.widget;return t?Br(e,0,t,i,this.length-t.length,(n,r)=>n.domAtPos(r),(n,r)=>new ae(n,Math.min(r,n.nodeValue.length))):new ae(i,Math.min(e,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(e,t){let{topView:i,text:n}=this.widget;return i?Da(e,t,i,n,this.length-i.length):Math.min(t,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(e,t){let{topView:i,text:n}=this.widget;return i?Br(e,t,i,n,this.length-i.length,(r,o,l)=>r.coordsAt(o,l),(r,o,l)=>Pr(r,o,l)):Pr(n,e,t)}destroy(){var e;super.destroy(),(e=this.widget.topView)===null||e===void 0||e.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}};function Br(s,e,t,i,n,r,o){if(t instanceof ft){for(let l=t.dom.firstChild;l;l=l.nextSibling){let a=U.get(l);if(a){let h=ri(l,i),f=a.length+(h?n:0);if(s<f||s==f&&a.getSide()<=0)return h?Br(s,e,a,i,n,r,o):r(a,s,e);s-=f}else{let h=Ea(s,e,l,o);if(typeof h!="number")return h;s=h}}return r(t,t.length,-1)}else return t.dom==i?o(i,s,e):r(t,s,e)}function Ea(s,e,t,i){if(t.nodeType==3){let n=t.nodeValue.length;if(s<=n)return i(t,s,e);s-=n}else if(t.nodeType==1&&t.contentEditable!="false")for(let n=t.firstChild;n;n=n.nextSibling){let r=Ea(s,e,n,i);if(typeof r!="number")return r;s=r}return s}function Da(s,e,t,i,n){if(t instanceof ft){let r=0;for(let o=t.dom.firstChild;o;o=o.nextSibling){let l=U.get(o);if(l){let a=ri(o,i);if(ri(o,s))return r+(a?Da(s,e,l,i,n):l.localPosFromDOM(s,e));r+=l.length+(a?n:0)}else{let a=La(s,e,o);if(a.result!=null)return r+a.result;r+=a.size}}}else if(t.dom==i)return Math.min(e,i.nodeValue.length);return t.localPosFromDOM(s,e)}function La(s,e,t){if(t.nodeType==3)return s==t?{result:e}:{size:t.nodeValue.length};if(t.nodeType==1&&t.contentEditable!="false"){let i=0;for(let n=t.firstChild,r=0;;n=n.nextSibling,r++){if(s==t&&r==e)return{result:i};if(!n)return{size:i};let o=La(s,e,n);if(o.result!=null)return{result:e+o.result};i+=o.size}}else return t.contains(s)?{result:0}:{size:0}}var li=class s extends U{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof s&&e.side==this.side}split(){return new s(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?ae.before(this.dom):ae.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){let t=this.dom.getBoundingClientRect(),i=dc(this,this.side>0?-1:1);return i&&i.top<t.bottom&&i.bottom>t.top?{left:t.left,right:t.right,top:i.top,bottom:i.bottom}:t}get overrideDOMText(){return q.empty}get isHidden(){return!0}};Ht.prototype.children=Wi.prototype.children=li.prototype.children=ao;function dc(s,e){let t=s.parent,i=t?t.children.indexOf(s):-1;for(;t&&i>=0;)if(e<0?i>0:i<t.children.length){let n=t.children[i+e];if(n instanceof Ht){let r=n.coordsAt(e<0?n.length:0,e);if(r)return r}i+=e}else if(t instanceof ft&&t.parent)i=t.parent.children.indexOf(t)+(e<0?0:1),t=t.parent;else{let n=t.dom.lastChild;if(n&&n.nodeName=="BR")return n.getClientRects()[0];break}}function Pa(s,e){let t=s.dom,{children:i}=s,n=0;for(let r=0;n<i.length;n++){let o=i[n],l=r+o.length;if(!(l==r&&o.getSide()<=0)){if(e>r&&e<l&&o.dom.parentNode==t)return o.domAtPos(e-r);if(e<=r)break;r=l}}for(let r=n;r>0;r--){let o=i[r-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let r=n;r<i.length;r++){let o=i[r];if(o.dom.parentNode==t)return o.domAtPos(0)}return new ae(t,0)}function Ba(s,e,t){let i,{children:n}=s;t>0&&e instanceof ft&&n.length&&(i=n[n.length-1])instanceof ft&&i.mark.eq(e.mark)?Ba(i,e.children[0],t-1):(n.push(e),e.setParent(s)),s.length+=e.length}function Ia(s,e,t){let i=null,n=-1,r=null,o=-1;function l(h,f){for(let c=0,u=0;c<h.children.length&&u<=f;c++){let d=h.children[c],p=u+d.length;p>=f&&(d.children.length?l(d,f-u):(!r||r instanceof li&&t>0)&&(p>f||u==p&&d.getSide()>0)?(r=d,o=f-u):(u<f||u==p&&d.getSide()<0)&&(i=d,n=f-u)),u=p}}l(s,e);let a=(t<0?i:r)||i||r;return a?a.coordsAt(Math.max(0,a==i?n:o),t):pc(s)}function pc(s){let e=s.dom.lastChild;if(!e)return s.dom.getBoundingClientRect();let t=Hi(e);return t[t.length-1]||null}function Ir(s,e){for(let t in s)t=="class"&&e.class?e.class+=" "+s.class:t=="style"&&e.style?e.style+=";"+s.style:e[t]=s[t];return e}function ho(s,e){if(s==e)return!0;if(!s||!e)return!1;let t=Object.keys(s),i=Object.keys(e);if(t.length!=i.length)return!1;for(let n of t)if(i.indexOf(n)==-1||s[n]!==e[n])return!1;return!0}function Rr(s,e,t){let i=null;if(e)for(let n in e)t&&n in t||s.removeAttribute(i=n);if(t)for(let n in t)e&&e[n]==t[n]||s.setAttribute(i=n,t[n]);return!!i}var _t=class{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}ignoreEvent(e){return!0}get customView(){return null}get isHidden(){return!1}destroy(e){}},te=function(s){return s[s.Text=0]="Text",s[s.WidgetBefore=1]="WidgetBefore",s[s.WidgetAfter=2]="WidgetAfter",s[s.WidgetRange=3]="WidgetRange",s}(te||(te={})),Y=class extends lt{constructor(e,t,i,n){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=n}get heightRelevant(){return!1}static mark(e){return new Ys(e)}static widget(e){let t=e.side||0,i=!!e.block;return t+=i?t>0?3e8:-4e8:t>0?1e8:-1e8,new Wt(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,n;if(e.isBlockGap)i=-5e8,n=4e8;else{let{start:r,end:o}=Ra(e,t);i=(r?t?-3e8:-1:5e8)-1,n=(o?t?2e8:1:-6e8)+1}return new Wt(e,i,n,t,e.widget||null,!0)}static line(e){return new Ki(e)}static set(e,t=!1){return ne.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};Y.none=ne.empty;var Ys=class s extends Y{constructor(e){let{start:t,end:i}=Ra(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){return this==e||e instanceof s&&this.tagName==e.tagName&&this.class==e.class&&ho(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}};Ys.prototype.point=!1;var Ki=class s extends Y{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof s&&this.spec.class==e.spec.class&&ho(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}};Ki.prototype.mapMode=de.TrackBefore;Ki.prototype.point=!0;var Wt=class s extends Y{constructor(e,t,i,n,r,o){super(t,i,r,e),this.block=n,this.isReplace=o,this.mapMode=n?t<=0?de.TrackBefore:de.TrackAfter:de.TrackDel}get type(){return this.startSide<this.endSide?te.WidgetRange:this.startSide<=0?te.WidgetBefore:te.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&this.widget.estimatedHeight>=5}eq(e){return e instanceof s&&mc(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}};Wt.prototype.point=!0;function Ra(s,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=s;return t==null&&(t=s.inclusive),i==null&&(i=s.inclusive),{start:t!=null?t:e,end:i!=null?i:e}}function mc(s,e){return s==e||!!(s&&e&&s.compare(e))}function Fr(s,e,t,i=0){let n=t.length-1;n>=0&&t[n]+i>=s?t[n]=Math.max(t[n],e):t.push(s,e)}var we=class s extends U{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,n,r,o){if(i){if(!(i instanceof s))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),Oa(this,e,t,i?i.children:[],r,o),!0}split(e){let t=new s;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:n}=this.childPos(e);n&&(t.append(this.children[i].split(n),0),this.children[i].merge(n,this.children[i].length,null,!1,0,0),i++);for(let r=i;r<this.children.length;r++)t.append(this.children[r],0);for(;i>0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){ho(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Ba(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=Ir(t,this.attrs||{})),i&&(this.attrs=Ir({class:i},this.attrs||{}))}domAtPos(e){return Pa(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.dirty|=6)}sync(e,t){var i;this.dom?this.dirty&4&&(Ca(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Rr(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let n=this.dom.lastChild;for(;n&&U.get(n)instanceof ft;)n=n.lastChild;if(!n||!this.length||n.nodeName!="BR"&&((i=U.get(n))===null||i===void 0?void 0:i.isEditable)==!1&&(!B.ios||!this.children.some(r=>r instanceof Ht))){let r=document.createElement("BR");r.cmIgnore=!0,this.dom.appendChild(r)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let i of this.children){if(!(i instanceof Ht)||/[^ -~]/.test(i.text))return null;let n=Hi(i.dom);if(n.length!=1)return null;e+=n[0].width,t=n[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let i=Ia(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:n}=this.parent.view.viewState,r=i.bottom-i.top;if(Math.abs(r-n.lineHeight)<2&&n.textHeight<r){let o=(r-n.textHeight)/2;return{top:i.top+o,bottom:i.bottom-o,left:i.left,right:i.left}}}return i}become(e){return!1}get type(){return te.Text}static find(e,t){for(let i=0,n=0;i<e.children.length;i++){let r=e.children[i],o=n+r.length;if(o>=t){if(r instanceof s)return r;if(o>t)break}n=o+r.breakAfter}return null}},qi=class s extends U{constructor(e,t,i){super(),this.widget=e,this.length=t,this.type=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,n,r,o){return i&&(!(i instanceof s)||!this.widget.compare(i.widget)||e>0&&r<=0||t<this.length&&o<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?ae.before(this.dom):ae.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let i=new s(this.widget,t,this.type);return i.breakAfter=this.breakAfter,i}get children(){return ao}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.dom.contentEditable="false")}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):q.empty}domBoundsAround(){return null}become(e){return e instanceof s&&e.type==this.type&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}},$r=class s{constructor(e,t,i,n){this.doc=e,this.pos=t,this.end=i,this.disallowBlockEffectsFor=n,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!e.breakAfter&&!(e instanceof qi&&e.type==te.WidgetBefore)}getLine(){return this.curLine||(this.content.push(this.curLine=new we),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Fs(new li(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||this.getLine()}buildText(e,t,i){for(;e>0;){if(this.textOff==this.text.length){let{value:r,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=r,this.textOff=0}let n=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(Fs(new Ht(this.text.slice(this.textOff,this.textOff+n)),t),i),this.atCursorPos=!0,this.textOff+=n,e-=n,i=0}}span(e,t,i,n){this.buildText(t-e,i,n),this.pos=t,this.openStart<0&&(this.openStart=n)}point(e,t,i,n,r,o){if(this.disallowBlockEffectsFor[o]&&i instanceof Wt){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=t-e;if(i instanceof Wt)if(i.block){let{type:a}=i;a==te.WidgetAfter&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new qi(i.widget||new Xs("div"),l,a))}else{let a=Wi.create(i.widget||new Xs("span"),l,l?0:i.startSide),h=this.atCursorPos&&!a.isEditable&&r<=n.length&&(e<t||i.startSide>0),f=!a.isEditable&&(e<t||r>n.length||i.startSide<=0),c=this.getLine();this.pendingBuffer==2&&!h&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(n),h&&(c.append(Fs(new li(1),n),r),r=n.length+Math.max(0,r-n.length)),c.append(Fs(a,n),r),this.atCursorPos=f,this.pendingBuffer=f?e<t||r>n.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=r)}static build(e,t,i,n,r){let o=new s(e,t,i,r);return o.openEnd=ne.spans(n,t,i,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}};function Fs(s,e){for(let t of e)s=new ft(t,[s],s.length);return s}var Xs=class extends _t{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}},Fa=V.define(),$a=V.define(),Va=V.define(),Ha=V.define(),Vr=V.define(),_a=V.define(),Wa=V.define(),Ka=V.define({combine:s=>s.some(e=>e)}),gc=V.define({combine:s=>s.some(e=>e)}),Qs=class s{constructor(e,t="nearest",i="nearest",n=5,r=5){this.range=e,this.y=t,this.x=i,this.yMargin=n,this.xMargin=r}map(e){return e.empty?this:new s(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}},ia=Z.define({map:(s,e)=>s.map(e)});function ht(s,e,t){let i=s.facet(Ha);i.length?i[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}var hn=V.define({combine:s=>s.length?s[0]:!0}),yc=0,Ii=V.define(),ai=class s{constructor(e,t,i,n){this.id=e,this.create=t,this.domEventHandlers=i,this.extension=n(this)}static define(e,t){let{eventHandlers:i,provide:n,decorations:r}=t||{};return new s(yc++,e,i,o=>{let l=[Ii.of(o)];return r&&l.push(ji.of(a=>{let h=a.plugin(o);return h?r(h):Y.none})),n&&l.push(n(o)),l})}static fromClass(e,t){return s.define(i=>new e(i),t)}},$i=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(ht(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(n){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){ht(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){ht(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}},qa=V.define(),fo=V.define(),ji=V.define(),ja=V.define(),za=V.define(),Ri=V.define(),wt=class s{constructor(e,t,i,n){this.fromA=e,this.toA=t,this.fromB=i,this.toB=n}join(e){return new s(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let n=e[t-1];if(!(n.fromA>i.toA)){if(n.toA<i.fromA)break;i=i.join(n),e.splice(t-1,1)}}return e.splice(t,0,i),e}static extendWithRanges(e,t){if(t.length==0)return e;let i=[];for(let n=0,r=0,o=0,l=0;;n++){let a=n==e.length?null:e[n],h=o-l,f=a?a.fromB:1e9;for(;r<t.length&&t[r]<f;){let c=t[r],u=t[r+1],d=Math.max(l,c),p=Math.min(f,u);if(d<=p&&new s(d+h,p+h,d,p).addToSet(i),u>f)break;r+=2}if(!a)return i;new s(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),o=a.toA,l=a.toB}}},Zs=class s{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=ye.empty(this.startState.doc.length);for(let r of i)this.changes=this.changes.compose(r.changes);let n=[];this.changes.iterChangedRanges((r,o,l,a)=>n.push(new wt(r,o,l,a))),this.changedRanges=n}static create(e,t,i){return new s(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},ce=function(s){return s[s.LTR=0]="LTR",s[s.RTL=1]="RTL",s}(ce||(ce={})),Hr=ce.LTR,bc=ce.RTL;function Ua(s){let e=[];for(let t=0;t<s.length;t++)e.push(1<<+s[t]);return e}var wc=Ua("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),kc=Ua("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),_r=Object.create(null),qe=[];for(let s of["()","[]","{}"]){let e=s.charCodeAt(0),t=s.charCodeAt(1);_r[e]=t,_r[t]=-e}function Sc(s){return s<=247?wc[s]:1424<=s&&s<=1524?2:1536<=s&&s<=1785?kc[s-1536]:1774<=s&&s<=2220?4:8192<=s&&s<=8203?256:64336<=s&&s<=65023?4:s==8204?256:1}var vc=/[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac\\ufb50-\\ufdff]/,kt=class{constructor(e,t,i){this.from=e,this.to=t,this.level=i}get dir(){return this.level%2?bc:Hr}side(e,t){return this.dir==t==e?this.to:this.from}static find(e,t,i,n){let r=-1;for(let o=0;o<e.length;o++){let l=e[o];if(l.from<=t&&l.to>=t){if(l.level==i)return o;(r<0||(n!=0?n<0?l.from<t:l.to>t:e[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}},G=[];function xc(s,e){let t=s.length,i=e==Hr?1:2,n=e==Hr?2:1;if(!s||i==1&&!vc.test(s))return Ga(t);for(let o=0,l=i,a=i;o<t;o++){let h=Sc(s.charCodeAt(o));h==512?h=l:h==8&&a==4&&(h=16),G[o]=h==4?2:h,h&7&&(a=h),l=h}for(let o=0,l=i,a=i;o<t;o++){let h=G[o];if(h==128)o<t-1&&l==G[o+1]&&l&24?h=G[o]=l:G[o]=256;else if(h==64){let f=o+1;for(;f<t&&G[f]==64;)f++;let c=o&&l==8||f<t&&G[f]==8?a==1?1:8:256;for(let u=o;u<f;u++)G[u]=c;o=f-1}else h==8&&a==1&&(G[o]=1);l=h,h&7&&(a=h)}for(let o=0,l=0,a=0,h,f,c;o<t;o++)if(f=_r[h=s.charCodeAt(o)])if(f<0){for(let u=l-3;u>=0;u-=3)if(qe[u+1]==-f){let d=qe[u+2],p=d&2?i:d&4?d&1?n:i:0;p&&(G[o]=G[qe[u]]=p),l=u;break}}else{if(qe.length==189)break;qe[l++]=o,qe[l++]=h,qe[l++]=a}else if((c=G[o])==2||c==1){let u=c==i;a=u?0:1;for(let d=l-3;d>=0;d-=3){let p=qe[d+2];if(p&2)break;if(u)qe[d+2]|=2;else{if(p&4)break;qe[d+2]|=4}}}for(let o=0;o<t;o++)if(G[o]==256){let l=o+1;for(;l<t&&G[l]==256;)l++;let a=(o?G[o-1]:i)==1,h=(l<t?G[l]:i)==1,f=a==h?a?1:2:i;for(let c=o;c<l;c++)G[c]=f;o=l-1}let r=[];if(i==1)for(let o=0;o<t;){let l=o,a=G[o++]!=1;for(;o<t&&a==(G[o]!=1);)o++;if(a)for(let h=o;h>l;){let f=h,c=G[--h]!=2;for(;h>l&&c==(G[h-1]!=2);)h--;r.push(new kt(h,f,c?2:1))}else r.push(new kt(l,o,0))}else for(let o=0;o<t;){let l=o,a=G[o++]==2;for(;o<t&&a==(G[o]==2);)o++;r.push(new kt(l,o,a?1:2))}return r}function Ga(s){return[new kt(0,s,0)]}var Ja="";function Ac(s,e,t,i,n){var r;let o=i.head-s.from,l=-1;if(o==0){if(!n||!s.length)return null;e[0].level!=t&&(o=e[0].side(!1,t),l=0)}else if(o==s.length){if(n)return null;let u=e[e.length-1];u.level!=t&&(o=u.side(!0,t),l=e.length-1)}l<0&&(l=kt.find(e,o,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc));let a=e[l];o==a.side(n,t)&&(a=e[l+=n?1:-1],o=a.side(!n,t));let h=n==(a.dir==t),f=nt(s.text,o,h);if(Ja=s.text.slice(Math.min(o,f),Math.max(o,f)),f!=a.side(n,t))return R.cursor(f+s.from,h?-1:1,a.level);let c=l==(n?e.length-1:0)?null:e[l+(n?1:-1)];return!c&&a.level!=t?R.cursor(n?s.to:s.from,n?-1:1,t):c&&c.level<a.level?R.cursor(c.side(!n,t)+s.from,n?1:-1,c.level):R.cursor(f+s.from,n?-1:1,a.level)}var bt="\\uFFFF",en=class{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(Q.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=bt}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let n=e;;){this.findPointBefore(i,n),this.readNode(n);let r=n.nextSibling;if(r==t)break;let o=U.get(n),l=U.get(r);(o&&l?o.breakAfter:(o?o.breakAfter:sa(n))||sa(r)&&(n.nodeName!="BR"||n.cmIgnore))&&this.lineBreak(),n=r}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,n=this.lineSeparator?null:/\\r\\n?|\\n/g;;){let r=-1,o=1,l;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=n.exec(t))&&(r=l.index,o=l[0].length),this.append(t.slice(i,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);i=r+o}}readNode(e){if(e.cmIgnore)return;let t=U.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let n=i.iter();!n.next().done;)n.lineBreak?this.lineBreak():this.append(n.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+Math.min(t,i.offset))}};function sa(s){return s.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\\d|SECTION|PRE)$/.test(s.nodeName)}var tn=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},sn=class extends U{constructor(e){super(),this.view=e,this.compositionDeco=Y.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new we],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new wt(0,0,0,e.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(e){let t=e.changedRanges;this.minWidth>0&&t.length&&(t.every(({fromA:o,toA:l})=>l<this.minWidthFrom||o>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.view.inputState.composing<0?this.compositionDeco=Y.none:(e.transactions.length||this.dirty)&&(this.compositionDeco=Mc(this.view,e.changes)),(B.ie||B.chrome)&&!this.compositionDeco.size&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,n=this.updateDeco(),r=Tc(i,n,e.changes);return t=wt.extendWithRanges(t,r),this.dirty==0&&t.length==0?!1:(this.updateInner(t,e.startState.doc.length),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let r=B.chrome||B.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,r),this.dirty=0,r&&(r.written||i.selectionRange.focusNode!=r.node)&&(this.forceSelection=!0),this.dom.style.height=""});let n=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let r of this.children)r instanceof qi&&r.widget instanceof nn&&n.push(r.dom);i.updateGaps(n)}updateChildren(e,t){let i=this.childCursor(t);for(let n=e.length-1;;n--){let r=n>=0?e[n]:null;if(!r)break;let{fromA:o,toA:l,fromB:a,toB:h}=r,{content:f,breakAtStart:c,openStart:u,openEnd:d}=$r.build(this.view.state.doc,a,h,this.decorations,this.dynamicDecorationMap),{i:p,off:m}=i.findPos(l,1),{i:g,off:b}=i.findPos(o,-1);Ma(this,g,b,p,m,f,c,u,d)}}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,n=i==this.dom,r=!n&&Ks(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(n||t||r))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.domAtPos(l.anchor),h=l.empty?a:this.domAtPos(l.head);if(B.gecko&&l.empty&&!this.compositionDeco.size&&Cc(a)){let c=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(c,a.node.childNodes[a.offset]||null)),a=h=new ae(c,0),o=!0}let f=this.view.observer.selectionRange;(o||!f.focusNode||!zs(a.node,a.offset,f.anchorNode,f.anchorOffset)||!zs(h.node,h.offset,f.focusNode,f.focusOffset))&&(this.view.observer.ignore(()=>{B.android&&B.chrome&&this.dom.contains(f.focusNode)&&Nc(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let c=js(this.view.root);if(c)if(l.empty){if(B.gecko){let u=Oc(a.node,a.offset);if(u&&u!=3){let d=Xa(a.node,a.offset,u==1?1:-1);d&&(a=new ae(d,u==1?0:d.nodeValue.length))}}c.collapse(a.node,a.offset),l.bidiLevel!=null&&f.cursorBidiLevel!=null&&(f.cursorBidiLevel=l.bidiLevel)}else if(c.extend){c.collapse(a.node,a.offset);try{c.extend(h.node,h.offset)}catch(u){}}else{let u=document.createRange();l.anchor>l.head&&([a,h]=[h,a]),u.setEnd(h.node,h.offset),u.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(u)}r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(a,h)),this.impreciseAnchor=a.precise?null:new ae(f.anchorNode,f.anchorOffset),this.impreciseHead=h.precise?null:new ae(f.focusNode,f.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:e}=this,t=e.state.selection.main,i=js(e.root),{anchorNode:n,anchorOffset:r}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=we.find(this,t.head);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!a||!h||a.bottom>h.top)return;let f=this.domAtPos(t.head+t.assoc);i.collapse(f.node,f.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let c=e.observer.selectionRange;e.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=t.from&&i.collapse(n,r)}nearest(e){for(let t=e;t;){let i=U.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let n=this.children[t];if(i<n.length||n instanceof we)break;t++,i=0}return this.children[t].domAtPos(i)}coordsAt(e,t){for(let i=this.length,n=this.children.length-1;;n--){let r=this.children[n],o=i-r.breakAfter-r.length;if(e>o||e==o&&r.type!=te.WidgetBefore&&r.type!=te.WidgetAfter&&(!n||t==2||this.children[n-1].breakAfter||this.children[n-1].type==te.WidgetBefore&&t>-2))return r.coordsAt(e-o,t);i=o}}measureVisibleLineHeights(e){let t=[],{from:i,to:n}=e,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==ce.LTR;for(let h=0,f=0;f<this.children.length;f++){let c=this.children[f],u=h+c.length;if(u>n)break;if(h>=i){let d=c.dom.getBoundingClientRect();if(t.push(d.height),o){let p=c.dom.lastChild,m=p?Hi(p):[];if(m.length){let g=m[m.length-1],b=a?g.right-d.left:d.right-g.left;b>l&&(l=b,this.minWidth=r,this.minWidthFrom=h,this.minWidthTo=u)}}}h=u+c.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?ce.RTL:ce.LTR}measureTextSize(){for(let r of this.children)if(r instanceof we){let o=r.measureTextSize();if(o)return o}let e=document.createElement("div"),t,i,n;return e.className="cm-line",e.style.width="99999px",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let r=Hi(e.firstChild)[0];t=e.getBoundingClientRect().height,i=r?r.width/27:7,n=r?r.height:t,e.remove()}),{lineHeight:t,charWidth:i,textHeight:n}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Gs(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,n=0;;n++){let r=n==t.viewports.length?null:t.viewports[n],o=r?r.from-1:this.length;if(o>i){let l=t.lineBlockAt(o).bottom-t.lineBlockAt(i).top;e.push(Y.replace({widget:new nn(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return Y.set(e)}updateDeco(){let e=this.view.state.facet(ji).map((t,i)=>(this.dynamicDecorationMap[i]=typeof t=="function")?t(this.view):t);for(let t=e.length;t<e.length+3;t++)this.dynamicDecorationMap[t]=!1;return this.decorations=[...e,this.compositionDeco,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]}scrollIntoView(e){let{range:t}=e,i=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),n;if(!i)return;!t.empty&&(n=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,n.left),top:Math.min(i.top,n.top),right:Math.max(i.right,n.right),bottom:Math.max(i.bottom,n.bottom)});let r=0,o=0,l=0,a=0;for(let f of this.view.state.facet(za).map(c=>c(this.view)))if(f){let{left:c,right:u,top:d,bottom:p}=f;c!=null&&(r=Math.max(r,c)),u!=null&&(o=Math.max(o,u)),d!=null&&(l=Math.max(l,d)),p!=null&&(a=Math.max(a,p))}let h={left:i.left-r,top:i.top-l,right:i.right+o,bottom:i.bottom+a};ac(this.view.scrollDOM,h,t.head<t.anchor?-1:1,e.x,e.y,e.xMargin,e.yMargin,this.view.textDirection==ce.LTR)}};function Cc(s){return s.node.nodeType==1&&s.node.firstChild&&(s.offset==0||s.node.childNodes[s.offset-1].contentEditable=="false")&&(s.offset==s.node.childNodes.length||s.node.childNodes[s.offset].contentEditable=="false")}var nn=class extends _t{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}};function Ya(s){let e=s.observer.selectionRange,t=e.focusNode&&Xa(e.focusNode,e.focusOffset,0);if(!t)return null;let i=s.docView.nearest(t);if(!i)return null;if(i instanceof we){let n=t;for(;n.parentNode!=i.dom;)n=n.parentNode;let r=n.previousSibling;for(;r&&!U.get(r);)r=r.previousSibling;let o=r?U.get(r).posAtEnd:i.posAtStart;return{from:o,to:o,node:n,text:t}}else{for(;;){let{parent:r}=i;if(!r)return null;if(r instanceof we)break;i=r}let n=i.posAtStart;return{from:n,to:n+i.length,node:i.dom,text:t}}}function Mc(s,e){let t=Ya(s);if(!t)return Y.none;let{from:i,to:n,node:r,text:o}=t,l=e.mapPos(i,1),a=Math.max(l,e.mapPos(n,-1)),{state:h}=s,f=r.nodeType==3?r.nodeValue:new en([],h).readRange(r.firstChild,null).text;if(a-l<f.length)if(h.doc.sliceString(l,Math.min(h.doc.length,l+f.length),bt)==f)a=l+f.length;else if(h.doc.sliceString(Math.max(0,a-f.length),a,bt)==f)l=a-f.length;else return Y.none;else if(h.doc.sliceString(l,a,bt)!=f)return Y.none;let c=U.get(r);return c instanceof Js?c=c.widget.topView:c&&(c.parent=null),Y.set(Y.replace({widget:new Wr(r,o,c),inclusive:!0}).range(l,a))}var Wr=class extends _t{constructor(e,t,i){super(),this.top=e,this.text=t,this.topView=i}eq(e){return this.top==e.top&&this.text==e.text}toDOM(){return this.top}ignoreEvent(){return!1}get customView(){return Js}};function Xa(s,e,t){if(t<=0)for(let i=s,n=e;;){if(i.nodeType==3)return i;if(i.nodeType==1&&n>0)i=i.childNodes[n-1],n=_i(i);else break}if(t>=0)for(let i=s,n=e;;){if(i.nodeType==3)return i;if(i.nodeType==1&&n<i.childNodes.length&&t>=0)i=i.childNodes[n],n=0;else break}return null}function Oc(s,e){return s.nodeType!=1?0:(e&&s.childNodes[e-1].contentEditable=="false"?1:0)|(e<s.childNodes.length&&s.childNodes[e].contentEditable=="false"?2:0)}var Kr=class{constructor(){this.changes=[]}compareRange(e,t){Fr(e,t,this.changes)}comparePoint(e,t){Fr(e,t,this.changes)}};function Tc(s,e,t){let i=new Kr;return ne.compare(s,e,t,i),i.changes}function Nc(s,e){for(let t=s;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function Ec(s,e,t=1){let i=s.charCategorizer(e),n=s.doc.lineAt(e),r=e-n.from;if(n.length==0)return R.cursor(e);r==0?t=1:r==n.length&&(t=-1);let o=r,l=r;t<0?o=nt(n.text,r,!1):l=nt(n.text,r);let a=i(n.text.slice(o,l));for(;o>0;){let h=nt(n.text,o,!1);if(i(n.text.slice(h,o))!=a)break;o=h}for(;l<n.length;){let h=nt(n.text,l);if(i(n.text.slice(l,h))!=a)break;l=h}return R.range(o+n.from,l+n.from)}function Dc(s,e){return e.left>s?e.left-s:Math.max(0,s-e.right)}function Lc(s,e){return e.top>s?e.top-s:Math.max(0,s-e.bottom)}function Mr(s,e){return s.top<e.bottom-1&&s.bottom>e.top+1}function na(s,e){return e<s.top?{top:e,left:s.left,right:s.right,bottom:s.bottom}:s}function ra(s,e){return e>s.bottom?{top:s.top,left:s.left,right:s.right,bottom:e}:s}function qr(s,e,t){let i,n,r,o,l=!1,a,h,f,c;for(let p=s.firstChild;p;p=p.nextSibling){let m=Hi(p);for(let g=0;g<m.length;g++){let b=m[g];n&&Mr(n,b)&&(b=na(ra(b,n.bottom),n.top));let v=Dc(e,b),C=Lc(t,b);if(v==0&&C==0)return p.nodeType==3?oa(p,e,t):qr(p,e,t);if(!i||o>C||o==C&&r>v){i=p,n=b,r=v,o=C;let M=C?t<b.top?-1:1:v?e<b.left?-1:1:0;l=!M||(M>0?g<m.length-1:g>0)}v==0?t>b.bottom&&(!f||f.bottom<b.bottom)?(a=p,f=b):t<b.top&&(!c||c.top>b.top)&&(h=p,c=b):f&&Mr(f,b)?f=ra(f,b.bottom):c&&Mr(c,b)&&(c=na(c,b.top))}}if(f&&f.bottom>=t?(i=a,n=f):c&&c.top<=t&&(i=h,n=c),!i)return{node:s,offset:0};let u=Math.max(n.left,Math.min(n.right,e));if(i.nodeType==3)return oa(i,u,t);if(l&&i.contentEditable!="false")return qr(i,u,t);let d=Array.prototype.indexOf.call(s.childNodes,i)+(e>=(n.left+n.right)/2?1:0);return{node:s,offset:d}}function oa(s,e,t){let i=s.nodeValue.length,n=-1,r=1e9,o=0;for(let l=0;l<i;l++){let a=oi(s,l,l+1).getClientRects();for(let h=0;h<a.length;h++){let f=a[h];if(f.top==f.bottom)continue;o||(o=e-f.left);let c=(f.top>t?f.top-t:t-f.bottom)-1;if(f.left-1<=e&&f.right+1>=e&&c<r){let u=e>=(f.left+f.right)/2,d=u;if((B.chrome||B.gecko)&&oi(s,l).getBoundingClientRect().left==f.right&&(d=!u),c<=0)return{node:s,offset:l+(d?1:0)};n=l+(d?1:0),r=c}}}return{node:s,offset:n>-1?n:o>0?s.nodeValue.length:0}}function Qa(s,e,t,i=-1){var n,r;let o=s.contentDOM.getBoundingClientRect(),l=o.top+s.viewState.paddingTop,a,{docHeight:h}=s.viewState,{x:f,y:c}=e,u=c-l;if(u<0)return 0;if(u>h)return s.state.doc.length;for(let M=s.defaultLineHeight/2,S=!1;a=s.elementAtHeight(u),a.type!=te.Text;)for(;u=i>0?a.bottom+M:a.top-M,!(u>=0&&u<=h);){if(S)return t?null:0;S=!0,i=-i}c=l+u;let d=a.from;if(d<s.viewport.from)return s.viewport.from==0?0:t?null:la(s,o,a,f,c);if(d>s.viewport.to)return s.viewport.to==s.state.doc.length?s.state.doc.length:t?null:la(s,o,a,f,c);let p=s.dom.ownerDocument,m=s.root.elementFromPoint?s.root:p,g=m.elementFromPoint(f,c);g&&!s.contentDOM.contains(g)&&(g=null),g||(f=Math.max(o.left+1,Math.min(o.right-1,f)),g=m.elementFromPoint(f,c),g&&!s.contentDOM.contains(g)&&(g=null));let b,v=-1;if(g&&((n=s.docView.nearest(g))===null||n===void 0?void 0:n.isEditable)!=!1){if(p.caretPositionFromPoint){let M=p.caretPositionFromPoint(f,c);M&&({offsetNode:b,offset:v}=M)}else if(p.caretRangeFromPoint){let M=p.caretRangeFromPoint(f,c);M&&({startContainer:b,startOffset:v}=M,(!s.contentDOM.contains(b)||B.safari&&Pc(b,v,f)||B.chrome&&Bc(b,v,f))&&(b=void 0))}}if(!b||!s.docView.dom.contains(b)){let M=we.find(s.docView,d);if(!M)return u>a.top+a.height/2?a.to:a.from;({node:b,offset:v}=qr(M.dom,f,c))}let C=s.docView.nearest(b);if(!C)return null;if(C.isWidget&&((r=C.dom)===null||r===void 0?void 0:r.nodeType)==1){let M=C.dom.getBoundingClientRect();return e.y<M.top||e.y<=M.bottom&&e.x<=(M.left+M.right)/2?C.posAtStart:C.posAtEnd}else return C.localPosFromDOM(b,v)+C.posAtStart}function la(s,e,t,i,n){let r=Math.round((i-e.left)*s.defaultCharacterWidth);if(s.lineWrapping&&t.height>s.defaultLineHeight*1.5){let l=Math.floor((n-t.top)/s.defaultLineHeight);r+=l*s.viewState.heightOracle.lineLength}let o=s.state.sliceDoc(t.from,t.to);return t.from+zl(o,r,s.state.tabSize)}function Pc(s,e,t){let i;if(s.nodeType!=3||e!=(i=s.nodeValue.length))return!1;for(let n=s.nextSibling;n;n=n.nextSibling)if(n.nodeType!=1||n.nodeName!="BR")return!1;return oi(s,i-1,i).getBoundingClientRect().left>t}function Bc(s,e,t){if(e!=0)return!1;for(let n=s;;){let r=n.parentNode;if(!r||r.nodeType!=1||r.firstChild!=n)return!1;if(r.classList.contains("cm-line"))break;n=r}let i=s.nodeType==1?s.getBoundingClientRect():oi(s,0,Math.max(s.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Ic(s,e,t,i){let n=s.state.doc.lineAt(e.head),r=!i||!s.lineWrapping?null:s.coordsAtPos(e.assoc<0&&e.head>n.from?e.head-1:e.head);if(r){let a=s.dom.getBoundingClientRect(),h=s.textDirectionAt(n.from),f=s.posAtCoords({x:t==(h==ce.LTR)?a.right-1:a.left+1,y:(r.top+r.bottom)/2});if(f!=null)return R.cursor(f,t?-1:1)}let o=we.find(s.docView,e.head),l=o?t?o.posAtEnd:o.posAtStart:t?n.to:n.from;return R.cursor(l,t?-1:1)}function aa(s,e,t,i){let n=s.state.doc.lineAt(e.head),r=s.bidiSpans(n),o=s.textDirectionAt(n.from);for(let l=e,a=null;;){let h=Ac(n,r,o,l,t),f=Ja;if(!h){if(n.number==(t?s.state.doc.lines:1))return l;f=`\n`,n=s.state.doc.line(n.number+(t?1:-1)),r=s.bidiSpans(n),h=R.cursor(t?n.from:n.to)}if(a){if(!a(f))return l}else{if(!i)return h;a=i(f)}l=h}}function Rc(s,e,t){let i=s.state.charCategorizer(e),n=i(t);return r=>{let o=i(r);return n==Ke.Space&&(n=o),n==o}}function Fc(s,e,t,i){let n=e.head,r=t?1:-1;if(n==(t?s.state.doc.length:0))return R.cursor(n,e.assoc);let o=e.goalColumn,l,a=s.contentDOM.getBoundingClientRect(),h=s.coordsAtPos(n),f=s.documentTop;if(h)o==null&&(o=h.left-a.left),l=r<0?h.top:h.bottom;else{let d=s.viewState.lineBlockAt(n);o==null&&(o=Math.min(a.right-a.left,s.defaultCharacterWidth*(n-d.from))),l=(r<0?d.top:d.bottom)+f}let c=a.left+o,u=i!=null?i:s.defaultLineHeight>>1;for(let d=0;;d+=10){let p=l+(u+d)*r,m=Qa(s,{x:c,y:p},!1,r);if(p<a.top||p>a.bottom||(r<0?m<n:m>n))return R.cursor(m,e.assoc,void 0,o)}}function Or(s,e,t){let i=s.state.facet(ja).map(n=>n(s));for(;;){let n=!1;for(let r of i)r.between(t.from-1,t.from+1,(o,l,a)=>{t.from>o&&t.from<l&&(t=e.head>t.from?R.cursor(o,1):R.cursor(l,-1),n=!0)});if(!n)return t}}var jr=class{constructor(e){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let t=(i,n)=>{this.ignoreDuringComposition(n)||n.type=="keydown"&&this.keydown(e,n)||(this.mustFlushObserver(n)&&e.observer.forceFlush(),this.runCustomHandlers(n.type,e,n)?n.preventDefault():i(e,n))};for(let i in ie){let n=ie[i];e.contentDOM.addEventListener(i,r=>{ha(e,r)&&t(n,r)},Ur[i]),this.registeredEvents.push(i)}e.scrollDOM.addEventListener("mousedown",i=>{if(i.target==e.scrollDOM&&i.clientY>e.contentDOM.getBoundingClientRect().bottom&&(t(ie.mousedown,i),!i.defaultPrevented&&i.button==2)){let n=e.contentDOM.style.minHeight;e.contentDOM.style.minHeight="100%",setTimeout(()=>e.contentDOM.style.minHeight=n,200)}}),B.chrome&&B.chrome_version==102&&e.scrollDOM.addEventListener("wheel",()=>{this.chromeScrollHack<0?e.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout(()=>{this.chromeScrollHack=-1,e.contentDOM.style.pointerEvents=""},100)},{passive:!0}),this.notifiedFocused=e.hasFocus,B.safari&&e.contentDOM.addEventListener("input",()=>null)}setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}ensureHandlers(e,t){var i;let n;this.customHandlers=[];for(let r of t)if(n=(i=r.update(e).spec)===null||i===void 0?void 0:i.domEventHandlers){this.customHandlers.push({plugin:r.value,handlers:n});for(let o in n)this.registeredEvents.indexOf(o)<0&&o!="scroll"&&(this.registeredEvents.push(o),e.contentDOM.addEventListener(o,l=>{ha(e,l)&&this.runCustomHandlers(o,e,l)&&l.preventDefault()}))}}runCustomHandlers(e,t,i){for(let n of this.customHandlers){let r=n.handlers[e];if(r)try{if(r.call(n.plugin,i,t)||i.defaultPrevented)return!0}catch(o){ht(t.state,o)}}return!1}runScrollHandlers(e,t){this.lastScrollTop=e.scrollDOM.scrollTop,this.lastScrollLeft=e.scrollDOM.scrollLeft;for(let i of this.customHandlers){let n=i.handlers.scroll;if(n)try{n.call(i.plugin,t,e)}catch(r){ht(e.state,r)}}}keydown(e,t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&Date.now()<this.lastEscPress+2e3)return!0;if(B.android&&B.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return e.observer.delayAndroidKey(t.key,t.keyCode),!0;let i;return B.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&((i=Za.find(n=>n.keyCode==t.keyCode))&&!t.ctrlKey||$c.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(this.pendingIOSKey=i||t,setTimeout(()=>this.flushIOSKey(e),250),!0):!1}flushIOSKey(e){let t=this.pendingIOSKey;return t?(this.pendingIOSKey=void 0,ni(e.contentDOM,t.key,t.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:B.safari&&!B.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}mustFlushObserver(e){return e.type=="keydown"&&e.keyCode!=229}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}},Za=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],$c="dthko",Vc=[16,17,18,20,91,92,224,225],$s=6;function Vs(s){return Math.max(0,s)*.7+8}var zr=class{constructor(e,t,i,n){this.view=e,this.style=i,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=hc(e.contentDOM);let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(Q.allowMultipleSelections)&&Hc(e,t),this.dragMove=_c(e,t),this.dragging=Wc(e,t)&&sh(t)==1?null:!1}start(e){this.dragging===!1&&(e.preventDefault(),this.select(e))}move(e){var t;if(e.buttons==0)return this.destroy();if(this.dragging!==!1)return;this.select(this.lastEvent=e);let i=0,n=0,r=((t=this.scrollParent)===null||t===void 0?void 0:t.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};e.clientX<=r.left+$s?i=-Vs(r.left-e.clientX):e.clientX>=r.right-$s&&(i=Vs(e.clientX-r.right)),e.clientY<=r.top+$s?n=-Vs(r.top-e.clientY):e.clientY>=r.bottom-$s&&(n=Vs(e.clientY-r.bottom)),this.setScrollSpeed(i,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}select(e){let t=this.style.get(e,this.extend,this.multiple);(this.mustSelect||!t.eq(this.view.state.selection)||t.main.assoc!=this.view.state.selection.main.assoc)&&this.view.dispatch({selection:t,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.docChanged&&this.dragging&&(this.dragging=this.dragging.map(e.changes)),this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function Hc(s,e){let t=s.state.facet(Fa);return t.length?t[0](e):B.mac?e.metaKey:e.ctrlKey}function _c(s,e){let t=s.state.facet($a);return t.length?t[0](e):B.mac?!e.altKey:!e.ctrlKey}function Wc(s,e){let{main:t}=s.state.selection;if(t.empty)return!1;let i=js(s.root);if(!i||i.rangeCount==0)return!0;let n=i.getRangeAt(0).getClientRects();for(let r=0;r<n.length;r++){let o=n[r];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function ha(s,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=s.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=U.get(t))&&i.ignoreEvent(e))return!1;return!0}var ie=Object.create(null),Ur=Object.create(null),eh=B.ie&&B.ie_version<15||B.ios&&B.webkit_version<604;function Kc(s){let e=s.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{s.focus(),t.remove(),th(s,t.value)},50)}function th(s,e){let{state:t}=s,i,n=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(Gr!=null&&t.selection.ranges.every(a=>a.empty)&&Gr==r.toString()){let a=-1;i=t.changeByRange(h=>{let f=t.doc.lineAt(h.from);if(f.from==a)return{range:h};a=f.from;let c=t.toText((o?r.line(n++).text:e)+t.lineBreak);return{changes:{from:f.from,insert:c},range:R.cursor(h.from+c.length)}})}else o?i=t.changeByRange(a=>{let h=r.line(n++);return{changes:{from:a.from,to:a.to,insert:h.text},range:R.cursor(a.from+h.length)}}):i=t.replaceSelection(r);s.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}ie.keydown=(s,e)=>{s.inputState.setSelectionOrigin("select"),e.keyCode==27?s.inputState.lastEscPress=Date.now():Vc.indexOf(e.keyCode)<0&&(s.inputState.lastEscPress=0)};ie.touchstart=(s,e)=>{s.inputState.lastTouchTime=Date.now(),s.inputState.setSelectionOrigin("select.pointer")};ie.touchmove=s=>{s.inputState.setSelectionOrigin("select.pointer")};Ur.touchstart=Ur.touchmove={passive:!0};ie.mousedown=(s,e)=>{if(s.observer.flush(),s.inputState.lastTouchTime>Date.now()-2e3)return;let t=null;for(let i of s.state.facet(Va))if(t=i(s,e),t)break;if(!t&&e.button==0&&(t=zc(s,e)),t){let i=s.root.activeElement!=s.contentDOM;s.inputState.startMouseSelection(new zr(s,e,t,i)),i&&s.observer.ignore(()=>Aa(s.contentDOM)),s.inputState.mouseSelection&&s.inputState.mouseSelection.start(e)}};function fa(s,e,t,i){if(i==1)return R.cursor(e,t);if(i==2)return Ec(s.state,e,t);{let n=we.find(s.docView,e),r=s.state.doc.lineAt(n?n.posAtEnd:e),o=n?n.posAtStart:r.from,l=n?n.posAtEnd:r.to;return l<s.state.doc.length&&l==r.to&&l++,R.range(o,l)}}var ih=(s,e)=>s>=e.top&&s<=e.bottom,ca=(s,e,t)=>ih(e,t)&&s>=t.left&&s<=t.right;function qc(s,e,t,i){let n=we.find(s.docView,e);if(!n)return 1;let r=e-n.posAtStart;if(r==0)return 1;if(r==n.length)return-1;let o=n.coordsAt(r,-1);if(o&&ca(t,i,o))return-1;let l=n.coordsAt(r,1);return l&&ca(t,i,l)?1:o&&ih(i,o)?-1:1}function ua(s,e){let t=s.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:qc(s,t,e.clientX,e.clientY)}}var jc=B.ie&&B.ie_version<=11,da=null,pa=0,ma=0;function sh(s){if(!jc)return s.detail;let e=da,t=ma;return da=s,ma=Date.now(),pa=!e||t>Date.now()-400&&Math.abs(e.clientX-s.clientX)<2&&Math.abs(e.clientY-s.clientY)<2?(pa+1)%3:1}function zc(s,e){let t=ua(s,e),i=sh(e),n=s.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),n=n.map(r.changes))},get(r,o,l){let a=ua(s,r),h,f=fa(s,a.pos,a.bias,i);if(t.pos!=a.pos&&!o){let c=fa(s,t.pos,t.bias,i),u=Math.min(c.from,f.from),d=Math.max(c.to,f.to);f=u<f.from?R.range(u,d):R.range(d,u)}return o?n.replaceRange(n.main.extend(f.from,f.to)):l&&i==1&&n.ranges.length>1&&(h=Uc(n,a.pos))?h:l?n.addRange(f):R.create([f])}}}function Uc(s,e){for(let t=0;t<s.ranges.length;t++){let{from:i,to:n}=s.ranges[t];if(i<=e&&n>=e)return R.create(s.ranges.slice(0,t).concat(s.ranges.slice(t+1)),s.mainIndex==t?0:s.mainIndex-(s.mainIndex>t?1:0))}return null}ie.dragstart=(s,e)=>{let{selection:{main:t}}=s.state,{mouseSelection:i}=s.inputState;i&&(i.dragging=t),e.dataTransfer&&(e.dataTransfer.setData("Text",s.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove")};function ga(s,e,t,i){if(!t)return;let n=s.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();let{mouseSelection:r}=s.inputState,o=i&&r&&r.dragging&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,l={from:n,insert:t},a=s.state.changes(o?[o,l]:l);s.focus(),s.dispatch({changes:a,selection:{anchor:a.mapPos(n,-1),head:a.mapPos(n,1)},userEvent:o?"move.drop":"input.drop"})}ie.drop=(s,e)=>{if(!e.dataTransfer)return;if(s.state.readOnly)return e.preventDefault();let t=e.dataTransfer.files;if(t&&t.length){e.preventDefault();let i=Array(t.length),n=0,r=()=>{++n==t.length&&ga(s,e,i.filter(o=>o!=null).join(s.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let l=new FileReader;l.onerror=r,l.onload=()=>{/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(l.result)||(i[o]=l.result),r()},l.readAsText(t[o])}}else ga(s,e,e.dataTransfer.getData("Text"),!0)};ie.paste=(s,e)=>{if(s.state.readOnly)return e.preventDefault();s.observer.flush();let t=eh?null:e.clipboardData;t?(th(s,t.getData("text/plain")||t.getData("text/uri-text")),e.preventDefault()):Kc(s)};function Gc(s,e){let t=s.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),s.focus()},50)}function Jc(s){let e=[],t=[],i=!1;for(let n of s.selection.ranges)n.empty||(e.push(s.sliceDoc(n.from,n.to)),t.push(n));if(!e.length){let n=-1;for(let{from:r}of s.selection.ranges){let o=s.doc.lineAt(r);o.number>n&&(e.push(o.text),t.push({from:o.from,to:Math.min(s.doc.length,o.to+1)})),n=o.number}i=!0}return{text:e.join(s.lineBreak),ranges:t,linewise:i}}var Gr=null;ie.copy=ie.cut=(s,e)=>{let{text:t,ranges:i,linewise:n}=Jc(s.state);if(!t&&!n)return;Gr=n?t:null;let r=eh?null:e.clipboardData;r?(e.preventDefault(),r.clearData(),r.setData("text/plain",t)):Gc(s,t),e.type=="cut"&&!s.state.readOnly&&s.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"})};var nh=ot.define();function rh(s,e){let t=[];for(let i of s.facet(Wa)){let n=i(s,e);n&&t.push(n)}return t?s.update({effects:t,annotations:nh.of(!0)}):null}function oh(s){setTimeout(()=>{let e=s.hasFocus;if(e!=s.inputState.notifiedFocused){let t=rh(s.state,e);t?s.dispatch(t):s.update([])}},10)}ie.focus=s=>{s.inputState.lastFocusTime=Date.now(),!s.scrollDOM.scrollTop&&(s.inputState.lastScrollTop||s.inputState.lastScrollLeft)&&(s.scrollDOM.scrollTop=s.inputState.lastScrollTop,s.scrollDOM.scrollLeft=s.inputState.lastScrollLeft),oh(s)};ie.blur=s=>{s.observer.clearSelectionRange(),oh(s)};ie.compositionstart=ie.compositionupdate=s=>{s.inputState.compositionFirstChange==null&&(s.inputState.compositionFirstChange=!0),s.inputState.composing<0&&(s.inputState.composing=0)};ie.compositionend=s=>{s.inputState.composing=-1,s.inputState.compositionEndedAt=Date.now(),s.inputState.compositionPendingKey=!0,s.inputState.compositionPendingChange=s.observer.pendingRecords().length>0,s.inputState.compositionFirstChange=null,B.chrome&&B.android&&s.observer.flushSoon(),setTimeout(()=>{s.inputState.composing<0&&s.docView.compositionDeco.size&&s.update([])},50)};ie.contextmenu=s=>{s.inputState.lastContextMenu=Date.now()};ie.beforeinput=(s,e)=>{var t;let i;if(B.chrome&&B.android&&(i=Za.find(n=>n.inputType==e.inputType))&&(s.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let n=((t=window.visualViewport)===null||t===void 0?void 0:t.height)||0;setTimeout(()=>{var r;(((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0)>n+10&&s.hasFocus&&(s.contentDOM.blur(),s.focus())},100)}};var ya=["pre-wrap","normal","pre-line","break-spaces"],Jr=class{constructor(e){this.lineWrapping=e,this.doc=q.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return ya.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i<e.length;i++){let n=e[i];n<0?i++:this.heightSamples[Math.floor(n*10)]||(t=!0,this.heightSamples[Math.floor(n*10)]=!0)}return t}refresh(e,t,i,n,r,o){let l=ya.indexOf(e)>-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=i,this.textHeight=n,this.lineLength=r,a){this.heightSamples={};for(let h=0;h<o.length;h++){let f=o[h];f<0?h++:this.heightSamples[Math.floor(f*10)]=!0}}return a}},Yr=class{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}},at=class s{constructor(e,t,i,n,r){this.from=e,this.length=t,this.top=i,this.height=n,this.type=r}get to(){return this.from+this.length}get bottom(){return this.top+this.height}join(e){let t=(Array.isArray(this.type)?this.type:[this]).concat(Array.isArray(e.type)?e.type:[e]);return new s(this.from,this.length+e.length,this.top,this.height+e.height,t)}},z=function(s){return s[s.ByPos=0]="ByPos",s[s.ByHeight=1]="ByHeight",s[s.ByPosNoHeight=2]="ByPosNoHeight",s}(z||(z={})),qs=.001,ke=class s{constructor(e,t,i=2){this.length=e,this.height=t,this.flags=i}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,t){this.height!=t&&(Math.abs(this.height-t)>qs&&(e.heightChanged=!0),this.height=t)}replace(e,t,i){return s.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,n){let r=this,o=i.doc;for(let l=n.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:f,toB:c}=n[l],u=r.lineAt(a,z.ByPosNoHeight,i.setDoc(t),0,0),d=u.to>=h?u:r.lineAt(h,z.ByPosNoHeight,i,0,0);for(c+=d.to-h,h=d.to;l>0&&u.from<=n[l-1].toA;)a=n[l-1].fromA,f=n[l-1].fromB,l--,a<u.from&&(u=r.lineAt(a,z.ByPosNoHeight,i,0,0));f+=u.from-a,a=u.from;let p=Qr.build(i.setDoc(o),e,f,c);r=r.replace(a,h,p)}return r.updateHeight(i,0)}static empty(){return new Me(0,0)}static of(e){if(e.length==1)return e[0];let t=0,i=e.length,n=0,r=0;for(;;)if(t==i)if(n>r*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),i+=1+l.break,n-=l.size}else if(r>n*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,r-=l.size}else break;else if(n<r){let l=e[t++];l&&(n+=l.size)}else{let l=e[--i];l&&(r+=l.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,i++),new Xr(s.of(e.slice(0,t)),o,s.of(e.slice(i)))}};ke.prototype.size=1;var rn=class extends ke{constructor(e,t,i){super(e,t),this.type=i}blockAt(e,t,i,n){return new at(n,this.length,i,this.height,this.type)}lineAt(e,t,i,n,r){return this.blockAt(0,i,n,r)}forEachLine(e,t,i,n,r,o){e<=r+this.length&&t>=r&&o(this.blockAt(0,i,n,r))}updateHeight(e,t=0,i=!1,n){return n&&n.from<=t&&n.more&&this.setHeight(e,n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}},Me=class s extends rn{constructor(e,t){super(e,t,te.Text),this.collapsed=0,this.widgetHeight=0}replace(e,t,i){let n=i[0];return i.length==1&&(n instanceof s||n instanceof St&&n.flags&4)&&Math.abs(this.length-n.length)<10?(n instanceof St?n=new s(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):ke.of(i)}updateHeight(e,t=0,i=!1,n){return n&&n.from<=t&&n.more?this.setHeight(e,n.heights[n.index++]):(i||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}},St=class s extends ke{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,n=e.doc.lineAt(t+this.length).number,r=n-i+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*r);o=a/r,this.length>r+1&&(l=(this.height-a)/(this.length-r-1))}else o=this.height/r;return{firstLine:i,lastLine:n,perLine:o,perChar:l}}blockAt(e,t,i,n){let{firstLine:r,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,n);if(t.lineWrapping){let h=n+Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length),f=t.doc.lineAt(h),c=l+f.length*a,u=Math.max(i,e-c/2);return new at(f.from,f.length,u,c,te.Text)}else{let h=Math.max(0,Math.min(o-r,Math.floor((e-i)/l))),{from:f,length:c}=t.doc.line(r+h);return new at(f,c,i+l*h,l,te.Text)}}lineAt(e,t,i,n,r){if(t==z.ByHeight)return this.blockAt(e,i,n,r);if(t==z.ByPosNoHeight){let{from:d,to:p}=i.doc.lineAt(e);return new at(d,p-d,0,0,te.Text)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(i,r),h=i.doc.lineAt(e),f=l+h.length*a,c=h.number-o,u=n+l*c+a*(h.from-r-c);return new at(h.from,h.length,Math.max(n,Math.min(u,n+this.height-f)),f,te.Text)}forEachLine(e,t,i,n,r,o){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:l,perLine:a,perChar:h}=this.heightMetrics(i,r);for(let f=e,c=n;f<=t;){let u=i.doc.lineAt(f);if(f==e){let p=u.number-l;c+=a*p+h*(e-r-p)}let d=a+h*u.length;o(new at(u.from,u.length,c,d,te.Text)),c+=d,f=u.to+1}}replace(e,t,i){let n=this.length-t;if(n>0){let r=i[i.length-1];r instanceof s?i[i.length-1]=new s(r.length+n):i.push(null,new s(n-1))}if(e>0){let r=i[0];r instanceof s?i[0]=new s(e+r.length):i.unshift(new s(e-1),null)}return ke.of(i)}decomposeLeft(e,t){t.push(new s(e-1),null)}decomposeRight(e,t){t.push(null,new s(this.length-e-1))}updateHeight(e,t=0,i=!1,n){let r=t+this.length;if(n&&n.from<=t+this.length&&n.more){let o=[],l=Math.max(t,n.from),a=-1;for(n.from>t&&o.push(new s(n.from-t-1).updateHeight(e,t));l<=r&&n.more;){let f=e.doc.lineAt(l).length;o.length&&o.push(null);let c=n.heights[n.index++];a==-1?a=c:Math.abs(c-a)>=qs&&(a=-2);let u=new Me(f,c);u.outdated=!1,o.push(u),l+=f+1}l<=r&&o.push(null,new s(r-l).updateHeight(e,l));let h=ke.of(o);return(a<0||Math.abs(h.height-this.height)>=qs||Math.abs(a-this.heightMetrics(e,t).perLine)>=qs)&&(e.heightChanged=!0),h}else(i||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},Xr=class extends ke{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,n){let r=i+this.left.height;return e<r?this.left.blockAt(e,t,i,n):this.right.blockAt(e,t,r,n+this.left.length+this.break)}lineAt(e,t,i,n,r){let o=n+this.left.height,l=r+this.left.length+this.break,a=t==z.ByHeight?e<o:e<l,h=a?this.left.lineAt(e,t,i,n,r):this.right.lineAt(e,t,i,o,l);if(this.break||(a?h.to<l:h.from>l))return h;let f=t==z.ByPosNoHeight?z.ByPosNoHeight:z.ByPos;return a?h.join(this.right.lineAt(l,f,i,o,l)):this.left.lineAt(l,f,i,n,r).join(h)}forEachLine(e,t,i,n,r,o){let l=n+this.left.height,a=r+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,i,n,r,o),t>=a&&this.right.forEachLine(e,t,i,l,a,o);else{let h=this.lineAt(a,z.ByPos,i,n,r);e<h.from&&this.left.forEachLine(e,h.from-1,i,n,r,o),h.to>=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,l,a,o)}}replace(e,t,i){let n=this.left.length+this.break;if(t<n)return this.balanced(this.left.replace(e,t,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-n,t-n,i));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let l of i)r.push(l);if(e>0&&ba(r,o-1),t<this.length){let l=r.length;this.decomposeRight(t,r),ba(r,l)}return ke.of(r)}decomposeLeft(e,t){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(i++,e>=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,n=i+this.break;if(e>=n)return this.right.decomposeRight(e-n,t);e<i&&this.left.decomposeRight(e,t),this.break&&e<n&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?ke.of(this.break?[e,null,t]:[e,t]):(this.left=e,this.right=t,this.height=e.height+t.height,this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,n){let{left:r,right:o}=this,l=t+r.length+this.break,a=null;return n&&n.from<=t+r.length&&n.more?a=r=r.updateHeight(e,t,i,n):r.updateHeight(e,t,i),n&&n.from<=l+o.length&&n.more?a=o=o.updateHeight(e,l,i,n):o.updateHeight(e,l,i),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}};function ba(s,e){let t,i;s[e]==null&&(t=s[e-1])instanceof St&&(i=s[e+1])instanceof St&&s.splice(e-1,3,new St(t.length+1+i.length))}var Yc=5,Qr=class s{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Me?n.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Me(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e<t||i.heightRelevant){let n=i.widget?i.widget.estimatedHeight:0;n<0&&(n=this.oracle.lineHeight);let r=t-e;i.block?this.addBlock(new rn(r,n,i.type)):(r||n>=Yc)&&this.addLineDeco(n,r)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Me(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new St(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Me)return e;let t=new Me(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine(),e.type==te.WidgetAfter&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,e.type!=te.WidgetBefore&&(this.covering=e)}addLineDeco(e,t){let i=this.ensureLine();i.length+=t,i.collapsed+=t,i.widgetHeight=Math.max(i.widgetHeight,e),this.writtenTo=this.pos=this.pos+t}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Me)&&!this.isCovered?this.nodes.push(new Me(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=e;for(let n of this.nodes)n instanceof Me&&n.updateHeight(this.oracle,i),i+=n?n.length:1;return this.nodes}static build(e,t,i,n){let r=new s(i,e);return ne.spans(t,i,n,r,0),r.finish(i)}};function Xc(s,e,t){let i=new Zr;return ne.compare(s,e,t,i,0),i.changes}var Zr=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,i,n){(e<t||i&&i.heightRelevant||n&&n.heightRelevant)&&Fr(e,t,this.changes,5)}};function Qc(s,e){let t=s.getBoundingClientRect(),i=s.ownerDocument,n=i.defaultView||window,r=Math.max(0,t.left),o=Math.min(n.innerWidth,t.right),l=Math.max(0,t.top),a=Math.min(n.innerHeight,t.bottom);for(let h=s.parentNode;h&&h!=i.body;)if(h.nodeType==1){let f=h,c=window.getComputedStyle(f);if((f.scrollHeight>f.clientHeight||f.scrollWidth>f.clientWidth)&&c.overflow!="visible"){let u=f.getBoundingClientRect();r=Math.max(r,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=h==s.parentNode?u.bottom:Math.min(a,u.bottom)}h=c.position=="absolute"||c.position=="fixed"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function Zc(s,e){let t=s.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}var Vi=class{constructor(e,t,i){this.from=e,this.to=t,this.size=i}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++){let n=e[i],r=t[i];if(n.from!=r.from||n.to!=r.to||n.size!=r.size)return!1}return!0}draw(e){return Y.replace({widget:new eo(this.size,e)}).range(this.from,this.to)}},eo=class extends _t{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}},on=class{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaler=wa,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ce.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(fo).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new Jr(t),this.stateDeco=e.facet(ji).filter(i=>typeof i!="function"),this.heightMap=ke.empty().applyChanges(this.stateDeco,q.empty,this.heightOracle.setDoc(e.doc),[new wt(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Y.set(this.lineGaps.map(i=>i.draw(!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let n=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>n>=r&&n<=o)){let{from:r,to:o}=this.lineBlockAt(n);e.push(new si(r,o))}}this.viewports=e.sort((i,n)=>i.from-n.from),this.scaler=this.heightMap.height<=7e6?wa:new to(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:Fi(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(ji).filter(h=>typeof h!="function");let n=e.changedRanges,r=wt.extendWithRanges(n,Xc(i,this.stateDeco,e?e.changes:ye.empty(this.state.doc.length))),o=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=o&&(e.flags|=2);let l=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<l.from||t.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let a=!e.changes.empty||e.flags&2||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),a&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(gc)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),n=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?ce.RTL:ce.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,f=0,c=parseInt(i.paddingTop)||0,u=parseInt(i.paddingBottom)||0;(this.paddingTop!=c||this.paddingBottom!=u)&&(this.paddingTop=c,this.paddingBottom=u,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(n.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let d=(this.printing?Zc:Qc)(t,this.paddingTop),p=d.top-this.pixelViewport.top,m=d.bottom-this.pixelViewport.bottom;this.pixelViewport=d;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let b=l.width;if((this.contentDOMWidth!=b||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),a){let C=e.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(C)&&(o=!0),o||n.lineWrapping&&Math.abs(b-this.contentDOMWidth)>n.charWidth){let{lineHeight:M,charWidth:S,textHeight:w}=e.docView.measureTextSize();o=M>0&&n.refresh(r,M,S,w,b/S,C),o&&(e.docView.minWidth=0,h|=8)}p>0&&m>0?f=Math.max(p,m):p<0&&m<0&&(f=Math.min(p,m)),n.heightChanged=!1;for(let M of this.viewports){let S=M.from==this.viewport.from?C:e.docView.measureVisibleLineHeights(M);this.heightMap=(o?ke.empty().applyChanges(this.stateDeco,q.empty,this.heightOracle,[new wt(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(n,0,o,new Yr(M.from,S))}n.heightChanged&&(h|=2)}let v=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return v&&(this.viewport=this.getViewport(f,this.scrollTarget)),this.updateForViewport(),(h&2||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),n=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new si(n.lineAt(o-i*1e3,z.ByHeight,r,0,0).from,n.lineAt(l+(1-i)*1e3,z.ByHeight,r,0,0).to);if(t){let{head:h}=t.range;if(h<a.from||h>a.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=n.lineAt(h,z.ByPos,r,0,0),u;t.y=="center"?u=(c.top+c.bottom)/2-f/2:t.y=="start"||t.y=="nearest"&&h<a.from?u=c.top:u=c.bottom-f,a=new si(n.lineAt(u-1e3/2,z.ByHeight,r,0,0).from,n.lineAt(u+f+1e3/2,z.ByHeight,r,0,0).to)}}return a}mapViewport(e,t){let i=t.mapPos(e.from,-1),n=t.mapPos(e.to,1);return new si(this.heightMap.lineAt(i,z.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(n,z.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},i=0){if(!this.inView)return!0;let{top:n}=this.heightMap.lineAt(e,z.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(t,z.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(e==0||n<=o-Math.max(10,Math.min(-i,250)))&&(t==this.state.doc.length||r>=l+Math.max(10,Math.min(i,250)))&&n>o-2*1e3&&r<l+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let i=[];for(let n of e)t.touchesRange(n.from,n.to)||i.push(new Vi(t.mapPos(n.from),t.mapPos(n.to),n.size));return i}ensureLineGaps(e,t){let i=this.heightOracle.lineWrapping,n=i?1e4:2e3,r=n>>1,o=n<<1;if(this.defaultTextDirection!=ce.LTR&&!i)return[];let l=[],a=(h,f,c,u)=>{if(f-h<r)return;let d=this.state.selection.main,p=[d.from];d.empty||p.push(d.to);for(let g of p)if(g>h&&g<f){a(h,g-10,c,u),a(g+10,f,c,u);return}let m=tu(e,g=>g.from>=c.from&&g.to<=c.to&&Math.abs(g.from-h)<r&&Math.abs(g.to-f)<r&&!p.some(b=>g.from<b&&g.to>b));if(!m){if(f<c.to&&t&&i&&t.visibleRanges.some(g=>g.from<=f&&g.to>=f)){let g=t.moveToLineBoundary(R.cursor(f),!1,!0).head;g>h&&(f=g)}m=new Vi(h,f,this.gapSize(c,h,f,u))}l.push(m)};for(let h of this.viewportLines){if(h.length<o)continue;let f=eu(h.from,h.to,this.stateDeco);if(f.total<o)continue;let c=this.scrollTarget?this.scrollTarget.range.head:null,u,d;if(i){let p=n/this.heightOracle.lineLength*this.heightOracle.lineHeight,m,g;if(c!=null){let b=_s(f,c),v=((this.visibleBottom-this.visibleTop)/2+p)/h.height;m=b-v,g=b+v}else m=(this.visibleTop-h.top-p)/h.height,g=(this.visibleBottom-h.top+p)/h.height;u=Hs(f,m),d=Hs(f,g)}else{let p=f.total*this.heightOracle.charWidth,m=n*this.heightOracle.charWidth,g,b;if(c!=null){let v=_s(f,c),C=((this.pixelViewport.right-this.pixelViewport.left)/2+m)/p;g=v-C,b=v+C}else g=(this.pixelViewport.left-m)/p,b=(this.pixelViewport.right+m)/p;u=Hs(f,g),d=Hs(f,b)}u>h.from&&a(h.from,u,h,f),d<h.to&&a(d,h.to,h,f)}return l}gapSize(e,t,i,n){let r=_s(n,i)-_s(n,t);return this.heightOracle.lineWrapping?e.height*r:n.total*this.heightOracle.charWidth*r}updateLineGaps(e){Vi.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Y.set(e.map(t=>t.draw(this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];ne.spans(e,this.viewport.from,this.viewport.to,{span(n,r){t.push({from:n,to:r})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((n,r)=>n.from!=t[r].from||n.to!=t[r].to);return this.visibleRanges=t,i?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Fi(this.heightMap.lineAt(e,z.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return Fi(this.heightMap.lineAt(this.scaler.fromDOM(e),z.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(e){return Fi(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},si=class{constructor(e,t){this.from=e,this.to=t}};function eu(s,e,t){let i=[],n=s,r=0;return ne.spans(t,s,e,{span(){},point(o,l){o>n&&(i.push({from:n,to:o}),r+=o-n),n=l}},20),n<e&&(i.push({from:n,to:e}),r+=e-n),{total:r,ranges:i}}function Hs({total:s,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let i=Math.floor(s*t);for(let n=0;;n++){let{from:r,to:o}=e[n],l=o-r;if(i<=l)return r+i;i-=l}}function _s(s,e){let t=0;for(let{from:i,to:n}of s.ranges){if(e<=n){t+=e-i;break}t+=n-i}return t/s.total}function tu(s,e){for(let t of s)if(e(t))return t}var wa={toDOM(s){return s},fromDOM(s){return s},scale:1},to=class{constructor(e,t,i){let n=0,r=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=t.lineAt(l,z.ByPos,e,0,0).top,f=t.lineAt(a,z.ByPos,e,0,0).bottom;return n+=f-h,{from:l,to:a,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(t.height-n);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(e){for(let t=0,i=0,n=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.top)return n+(e-i)*this.scale;if(e<=r.bottom)return r.domTop+(e-r.top);i=r.bottom,n=r.domBottom}}fromDOM(e){for(let t=0,i=0,n=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.domTop)return i+(e-n)/this.scale;if(e<=r.domBottom)return r.top+(e-r.domTop);i=r.bottom,n=r.domBottom}}};function Fi(s,e){if(e.scale==1)return s;let t=e.toDOM(s.top),i=e.toDOM(s.bottom);return new at(s.from,s.length,t,i-t,Array.isArray(s.type)?s.type.map(n=>Fi(n,e)):s.type)}var Ws=V.define({combine:s=>s.join(" ")}),io=V.define({combine:s=>s.indexOf(!0)>-1}),so=Ce.newName(),lh=Ce.newName(),ah=Ce.newName(),hh={"&light":"."+lh,"&dark":"."+ah};function no(s,e,t){return new Ce(e,{finish(i){return/&/.test(i)?i.replace(/&\\w*/,n=>{if(n=="&")return s;if(!t||!t[n])throw new RangeError(`Unsupported selector: ${n}`);return t[n]}):s+" "+i}})}var iu=no("."+so,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},hh),ro=class{constructor(e,t,i,n){this.typeOver=n,this.bounds=null,this.text="";let{impreciseHead:r,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,i,0))){let l=r||o?[]:nu(e),a=new en(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=ru(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!ri(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!ri(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset);this.newSel=R.single(h,a)}}};function fh(s,e){let t,{newSel:i}=e,n=s.state.selection.main;if(e.bounds){let{from:r,to:o}=e.bounds,l=n.from,a=null;(s.inputState.lastKeyCode===8&&s.inputState.lastKeyTime>Date.now()-100||B.android&&e.text.length<o-r)&&(l=n.to,a="end");let h=su(s.state.doc.sliceString(r,o,bt),e.text,l-r,a);h&&(B.chrome&&s.inputState.lastKeyCode==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==bt+bt&&h.toB--,t={from:r+h.from,to:r+h.toA,insert:q.of(e.text.slice(h.from,h.toB).split(bt))})}else i&&(!s.hasFocus&&s.state.facet(hn)||i.main.eq(n))&&(i=null);if(!t&&!i)return!1;if(!t&&e.typeOver&&!n.empty&&i&&i.main.empty?t={from:n.from,to:n.to,insert:s.state.doc.slice(n.from,n.to)}:t&&t.from>=n.from&&t.to<=n.to&&(t.from!=n.from||t.to!=n.to)&&n.to-n.from-(t.to-t.from)<=4?t={from:n.from,to:n.to,insert:s.state.doc.slice(n.from,t.from).append(t.insert).append(s.state.doc.slice(t.to,n.to))}:(B.mac||B.android)&&t&&t.from==t.to&&t.from==n.head-1&&/^\\. ?$/.test(t.insert.toString())&&s.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=R.single(i.main.anchor-1,i.main.head-1)),t={from:n.from,to:n.to,insert:q.of([" "])}):B.chrome&&t&&t.from==t.to&&t.from==n.head&&t.insert.toString()==`\n `&&s.lineWrapping&&(i&&(i=R.single(i.main.anchor-1,i.main.head-1)),t={from:n.from,to:n.to,insert:q.of([" "])}),t){let r=s.state;if(B.ios&&s.inputState.flushIOSKey(s)||B.android&&(t.from==n.from&&t.to==n.to&&t.insert.length==1&&t.insert.lines==2&&ni(s.contentDOM,"Enter",13)||t.from==n.from-1&&t.to==n.to&&t.insert.length==0&&ni(s.contentDOM,"Backspace",8)||t.from==n.from&&t.to==n.to+1&&t.insert.length==0&&ni(s.contentDOM,"Delete",46)))return!0;let o=t.insert.toString();if(s.state.facet(_a).some(h=>h(s,t.from,t.to,o)))return!0;s.inputState.composing>=0&&s.inputState.composing++;let l;if(t.from>=n.from&&t.to<=n.to&&t.to-t.from>=(n.to-n.from)/3&&(!i||i.main.empty&&i.main.from==t.from+t.insert.length)&&s.inputState.composing<0){let h=n.from<t.from?r.sliceDoc(n.from,t.from):"",f=n.to>t.to?r.sliceDoc(t.to,n.to):"";l=r.replaceSelection(s.state.toText(h+t.insert.sliceString(0,void 0,s.state.lineBreak)+f))}else{let h=r.changes(t),f=i&&i.main.to<=h.newLength?i.main:void 0;if(r.selection.ranges.length>1&&s.inputState.composing>=0&&t.to<=n.to&&t.to>=n.to-10){let c=s.state.sliceDoc(t.from,t.to),u=Ya(s)||s.state.doc.lineAt(n.head),d=n.to-t.to,p=n.to-n.from;l=r.changeByRange(m=>{if(m.from==n.from&&m.to==n.to)return{changes:h,range:f||m.map(h)};let g=m.to-d,b=g-c.length;if(m.to-m.from!=p||s.state.sliceDoc(b,g)!=c||u&&m.to>=u.from&&m.from<=u.to)return{range:m};let v=r.changes({from:b,to:g,insert:t.insert}),C=m.to-n.to;return{changes:v,range:f?R.range(Math.max(0,f.anchor+C),Math.max(0,f.head+C)):m.map(v)}})}else l={changes:h,selection:f&&r.selection.replaceRange(f)}}let a="input.type";return(s.composing||s.inputState.compositionPendingChange&&s.inputState.compositionEndedAt>Date.now()-50)&&(s.inputState.compositionPendingChange=!1,a+=".compose",s.inputState.compositionFirstChange&&(a+=".start",s.inputState.compositionFirstChange=!1)),s.dispatch(l,{scrollIntoView:!0,userEvent:a}),!0}else if(i&&!i.main.eq(n)){let r=!1,o="select";return s.inputState.lastSelectionTime>Date.now()-50&&(s.inputState.lastSelectionOrigin=="select"&&(r=!0),o=s.inputState.lastSelectionOrigin),s.dispatch({selection:i,scrollIntoView:r,userEvent:o}),!0}else return!1}function su(s,e,t,i){let n=Math.min(s.length,e.length),r=0;for(;r<n&&s.charCodeAt(r)==e.charCodeAt(r);)r++;if(r==n&&s.length==e.length)return null;let o=s.length,l=e.length;for(;o>0&&l>0&&s.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,r-Math.min(o,l));t-=o+a-r}if(o<r&&s.length<e.length){let a=t<=r&&t>=o?r-t:0;r-=a,l=r+(l-o),o=r}else if(l<r){let a=t<=r&&t>=l?r-t:0;r-=a,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function nu(s){let e=[];if(s.root.activeElement!=s.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:n,focusOffset:r}=s.observer.selectionRange;return t&&(e.push(new tn(t,i)),(n!=t||r!=i)&&e.push(new tn(n,r))),e}function ru(s,e){if(s.length==0)return null;let t=s[0].pos,i=s.length==2?s[1].pos:t;return t>-1&&i>-1?R.single(t+e,i+e):null}var ou={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Tr=B.ie&&B.ie_version<=11,oo=class{constructor(e){this.view=e,this.active=!1,this.selectionRange=new Nr,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(B.ie&&B.ie_version<=11||B.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Tr&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM),this.resizeContent=new ResizeObserver(()=>this.view.requestMeasure()),this.resizeContent.observe(e.contentDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runScrollHandlers(this.view,e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,n=this.selectionRange;if(i.state.facet(hn)?i.root.activeElement!=this.dom:!Ks(i.dom,n))return;let r=n.anchorNode&&i.docView.nearest(n.anchorNode);if(r&&r.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(B.ie&&B.ie_version<=11||B.android&&B.chrome)&&!i.state.selection.main.empty&&n.focusNode&&zs(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=B.safari&&e.root.nodeType==11&&oc(this.dom.ownerDocument)==this.dom&&lu(this.view)||js(e.root);if(!t||this.selectionRange.eq(t))return!1;let i=Ks(this.dom,t);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&cc(this.dom,t)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(t),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let i=this.dom;i;)if(i.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=t)i.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,ou),Tr&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Tr&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var i;if(!this.delayedAndroidKey){let n=()=>{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),!this.flush()&&r.force&&ni(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(n)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,n=!1;for(let r of e){let o=this.readMutation(r);o&&(o.typeOver&&(n=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:n}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),n=this.selectionChanged&&Ks(this.dom,this.selectionRange);return e<0&&!n?null:(e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new ro(this.view,e,t,i))}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return!1;let i=this.view.state,n=fh(this.view,t);return this.view.state==i&&this.view.update([]),n}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.dirty|=4),e.type=="childList"){let i=ka(t,e.previousSibling||e.target.previousSibling,-1),n=ka(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:n?t.posBefore(n):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,t,i,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect(),(n=this.resizeContent)===null||n===void 0||n.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}};function ka(s,e,t){for(;e;){let i=U.get(e);if(i&&i.parent==s)return i;let n=e.parentNode;e=n!=s.dom?n:t>0?e.nextSibling:e.previousSibling}return null}function lu(s){let e=null;function t(a){a.preventDefault(),a.stopImmediatePropagation(),e=a.getTargetRanges()[0]}if(s.contentDOM.addEventListener("beforeinput",t,!0),s.dom.ownerDocument.execCommand("indent"),s.contentDOM.removeEventListener("beforeinput",t,!0),!e)return null;let i=e.startContainer,n=e.startOffset,r=e.endContainer,o=e.endOffset,l=s.docView.domAtPos(s.state.selection.main.anchor);return zs(l.node,l.offset,r,o)&&([i,n,r,o]=[r,o,i,n]),{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:o}}var K=class s{constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=e.dispatch||(t=>this.update([t])),this.dispatch=this.dispatch.bind(this),this._root=e.root||fc(e.parent)||document,this.viewState=new on(e.state||Q.create(e)),this.plugins=this.state.facet(Ii).map(t=>new $i(t));for(let t of this.plugins)t.update(this);this.observer=new oo(this),this.inputState=new jr(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),e.parent&&e.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...e){this._dispatch(e.length==1&&e[0]instanceof pe?e[0]:this.state.update(...e))}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,n,r=this.state;for(let u of e){if(u.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn\'t start from the previous state.");r=u.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,l=0,a=null;e.some(u=>u.annotation(nh))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=rh(r,o),a||(l=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(f=null)):this.observer.clear(),r.facet(Q.phrases)!=this.state.facet(Q.phrases))return this.setState(r);n=Zs.create(this,r,e),n.flags|=l;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(c&&(c=c.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection;c=new Qs(d.empty?d:R.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of u.effects)d.is(ia)&&(c=d.value)}this.viewState.update(n,c),this.bidiCache=ln.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),t=this.docView.update(n),this.state.facet(Ri)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(n.startState.facet(Ws)!=n.state.facet(Ws)&&(this.viewState.mustMeasureContent=!0),(t||i||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!n.empty)for(let u of this.state.facet(Vr))u(n);(a||f)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),f&&!fh(this,f)&&h.force&&ni(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new on(e),this.plugins=e.facet(Ii).map(i=>new $i(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView=new sn(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Ii),i=e.state.facet(Ii);if(t!=i){let n=[];for(let r of i){let o=t.indexOf(r);if(o<0)n.push(new $i(r));else{let l=this.plugins[o];l.mustUpdate=e,n.push(l)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=n,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else for(let n of this.plugins)n.mustUpdate=e;for(let n=0;n<this.plugins.length;n++)this.plugins[n].update(this)}measure(e=!0){if(this.destroyed)return;this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,{scrollHeight:i,scrollTop:n,clientHeight:r}=this.scrollDOM,o=n>i-r-4?i:n;try{for(let l=0;;l++){this.updateState=1;let a=this.viewport,h=this.viewState.lineBlockAtHeight(o),f=this.viewState.measure(this);if(!f&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];f&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(g=>{try{return g.read(this)}catch(b){return ht(this.state,b),Sa}}),d=Zs.create(this,this.state,[]),p=!1,m=!1;d.flags|=f,t?t.flags|=f:t=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),p=this.docView.update(d));for(let g=0;g<c.length;g++)if(u[g]!=Sa)try{let b=c[g];b.write&&b.write(u[g],this)}catch(b){ht(this.state,b)}if(this.viewState.editorHeight)if(this.viewState.scrollTarget)this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,m=!0;else{let g=this.viewState.lineBlockAt(h.from).top-h.top;(g>1||g<-1)&&(this.scrollDOM.scrollTop+=g,m=!0)}if(p&&this.docView.updateSelection(!0),this.viewport.from==a.from&&this.viewport.to==a.to&&!m&&this.measureRequests.length==0)break}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(Vr))l(t)}get themeClasses(){return so+" "+(this.state.facet(io)?ah:lh)+" "+this.state.facet(Ws)}updateAttrs(){let e=va(this,qa,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(hn)?"true":"false",class:"cm-content",style:`${B.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),va(this,fo,t);let i=this.observer.ignore(()=>{let n=Rr(this.contentDOM,this.contentAttrs,t),r=Rr(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let n of i.effects)if(n.is(s.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=n.value}}mountStyles(){this.styleModules=this.state.facet(Ri),Ce.mount(this.root,this.styleModules.concat(iu).reverse())}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn\'t allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.spec!=e)&&this.pluginMap.set(e,t=this.plugins.find(i=>i.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return Or(this,e,aa(this,e,t,i))}moveByGroup(e,t){return Or(this,e,aa(this,e,t,i=>Rc(this,e.head,i)))}moveToLineBoundary(e,t,i=!0){return Ic(this,e,t,i)}moveVertically(e,t,i){return Or(this,e,Fc(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),Qa(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let n=this.state.doc.lineAt(e),r=this.bidiSpans(n),o=r[kt.find(r,e-n.from,-1,t)];return lo(i,o.dir==ce.LTR==t>0)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Ka)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>au)return Ga(e.length);let t=this.textDirectionAt(e.from);for(let n of this.bidiCache)if(n.from==e.from&&n.dir==t)return n.order;let i=xc(e.text,t);return this.bidiCache.push(new ln(e.from,e.to,t,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||B.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Aa(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return ia.of(new Qs(typeof e=="number"?R.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}static domEventHandlers(e){return ai.define(()=>({}),{eventHandlers:e})}static theme(e,t){let i=Ce.newName(),n=[Ws.of(i),Ri.of(no(`.${i}`,e))];return t&&t.dark&&n.push(io.of(!0)),n}static baseTheme(e){return Bs.lowest(Ri.of(no("."+so,e,hh)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),n=i&&U.get(i)||U.get(e);return((t=n==null?void 0:n.rootView)===null||t===void 0?void 0:t.view)||null}};K.styleModule=Ri;K.inputHandler=_a;K.focusChangeEffect=Wa;K.perLineTextDirection=Ka;K.exceptionSink=Ha;K.updateListener=Vr;K.editable=hn;K.mouseSelectionStyle=Va;K.dragMovesSelection=$a;K.clickAddsSelectionRange=Fa;K.decorations=ji;K.atomicRanges=ja;K.scrollMargins=za;K.darkTheme=io;K.contentAttributes=fo;K.editorAttributes=qa;K.lineWrapping=K.contentAttributes.of({class:"cm-lineWrapping"});K.announce=Z.define();var au=4096,Sa={},ln=class s{constructor(e,t,i,n){this.from=e,this.to=t,this.dir=i,this.order=n}static update(e,t){if(t.empty)return e;let i=[],n=e.length?e[e.length-1].dir:ce.LTR;for(let r=Math.max(0,e.length-10);r<e.length;r++){let o=e[r];o.dir==n&&!t.touchesRange(o.from,o.to)&&i.push(new s(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.order))}return i}};function va(s,e,t){for(let i=s.state.facet(e),n=i.length-1;n>=0;n--){let r=i[n],o=typeof r=="function"?r(s):r;o&&Ir(o,t)}return t}var Rd=B.mac?"mac":B.windows?"win":B.linux?"linux":"key";var hu=!B.ios;var fu={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};hu&&(fu[".cm-line"].caretColor="transparent !important");var Fd=/x/.unicode!=null?"gu":"g";var $d=K.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"\'\'",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}});var ct=class extends lt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};ct.prototype.elementClass="";ct.prototype.toDOM=void 0;ct.prototype.mapMode=de.TrackBefore;ct.prototype.startSide=ct.prototype.endSide=-1;ct.prototype.point=!0;var Wu=xl(rr());var cu=0,zi=class{constructor(e,t){this.from=e,this.to=t}},j=class{constructor(e={}){this.id=cu++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn\'t define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can\'t add per-node props to node types");return typeof e!="function"&&(e=Se.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}};j.closedBy=new j({deserialize:s=>s.split(" ")});j.openedBy=new j({deserialize:s=>s.split(" ")});j.group=new j({deserialize:s=>s.split(" ")});j.isolate=new j({deserialize:s=>{if(s&&s!="rtl"&&s!="ltr"&&s!="auto")throw new RangeError("Invalid value for isolate: "+s);return s||"auto"}});j.contextHash=new j({perNode:!0});j.lookAhead=new j({perNode:!0});j.mounted=new j({perNode:!0});var hi=class{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}static get(e){return e&&e.props&&e.props[j.mounted.id]}},uu=Object.create(null),Se=class s{constructor(e,t,i,n=0){this.name=e,this.props=t,this.id=i,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):uu,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),n=new s(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(n)),r){if(r[0].perNode)throw new RangeError("Can\'t store a per-node prop on a node type");t[r[0].id]=r[1]}}return n}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(j.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let n of i.split(" "))t[n]=e[i];return i=>{for(let n=i.prop(j.group),r=-1;r<(n?n.length:0);r++){let o=t[r<0?i.name:n[r]];if(o)return o}}}};Se.none=new Se("",Object.create(null),0,8);var fn=new WeakMap,ch=new WeakMap,re;(function(s){s[s.ExcludeBuffers=1]="ExcludeBuffers",s[s.IncludeAnonymous=2]="IncludeAnonymous",s[s.IgnoreMounts=4]="IgnoreMounts",s[s.IgnoreOverlays=8]="IgnoreOverlays"})(re||(re={}));var he=class s{constructor(e,t,i,n,r){if(this.type=e,this.children=t,this.positions=i,this.length=n,this.props=null,r&&r.length){this.props=Object.create(null);for(let[o,l]of r)this.props[typeof o=="number"?o:o.id]=l}}toString(){let e=hi.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let n=i.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new Ji(this.topNode,e)}cursorAt(e,t=0,i=0){let n=fn.get(this)||this.topNode,r=new Ji(n);return r.moveTo(e,t),fn.set(this,r._tree),r}get topNode(){return new je(this,0,0,null)}resolve(e,t=0){let i=Ui(fn.get(this)||this.topNode,e,t,!1);return fn.set(this,i),i}resolveInner(e,t=0){let i=Ui(ch.get(this)||this.topNode,e,t,!0);return ch.set(this,i),i}resolveStack(e,t=0){return du(this,e,t)}iterate(e){let{enter:t,leave:i,from:n=0,to:r=this.length}=e,o=e.mode||0,l=(o&re.IncludeAnonymous)>0;for(let a=this.cursor(o|re.IncludeAnonymous);;){let h=!1;if(a.from<=r&&a.to>=n&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:bo(Se.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,n)=>new s(this.type,t,i,n,this.propValues),e.makeTree||((t,i,n)=>new s(Se.none,t,i,n)))}static build(e){return pu(e)}};he.empty=new he(Se.none,[],[],0);var co=class s{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new s(this.buffer,this.index)}},vt=class s{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return Se.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],i=this.buffer[e+3],n=this.set.types[t],r=n.name;if(/\\W/.test(r)&&!n.isError&&(r=JSON.stringify(r)),e+=4,i==e)return r;let o=[];for(;e<i;)o.push(this.childString(e)),e=this.buffer[e+3];return r+"("+o.join(",")+")"}findChild(e,t,i,n,r){let{buffer:o}=this,l=-1;for(let a=e;a!=t&&!(ph(r,n,o[a+1],o[a+2])&&(l=a,i>0));a=o[a+3]);return l}slice(e,t,i){let n=this.buffer,r=new Uint16Array(t-e),o=0;for(let l=e,a=0;l<t;){r[a++]=n[l++],r[a++]=n[l++]-i;let h=r[a++]=n[l++]-i;r[a++]=n[l++]-e,o=Math.max(o,h)}return new s(r,o,this.set)}};function ph(s,e,t,i){switch(s){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function Ui(s,e,t,i){for(var n;s.from==s.to||(t<1?s.from>=e:s.from>e)||(t>-1?s.to<=e:s.to<e);){let o=!i&&s instanceof je&&s.index<0?null:s.parent;if(!o)return s;s=o}let r=i?0:re.IgnoreOverlays;if(i)for(let o=s,l=o.parent;l;o=l,l=o.parent)o instanceof je&&o.index<0&&((n=l.enter(e,t,r))===null||n===void 0?void 0:n.from)!=o.from&&(s=l);for(;;){let o=s.enter(e,t,r);if(!o)return s;s=o}}var un=class{cursor(e=0){return new Ji(this,e)}getChild(e,t=null,i=null){let n=uh(this,e,t,i);return n.length?n[0]:null}getChildren(e,t=null,i=null){return uh(this,e,t,i)}resolve(e,t=0){return Ui(this,e,t,!1)}resolveInner(e,t=0){return Ui(this,e,t,!0)}matchContext(e){return uo(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let n=t.lastChild;if(!n||n.to!=t.to)break;n.type.isError&&n.from==n.to?(i=t,t=n.prevSibling):t=n}return i}get node(){return this}get next(){return this.parent}},je=class s extends un{constructor(e,t,i,n){super(),this._tree=e,this.from=t,this.index=i,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,n,r=0){for(let o=this;;){for(let{children:l,positions:a}=o._tree,h=t>0?l.length:-1;e!=h;e+=t){let f=l[e],c=a[e]+o.from;if(ph(n,i,c,c+f.length)){if(f instanceof vt){if(r&re.ExcludeBuffers)continue;let u=f.findChild(0,f.buffer.length,t,i-c,n);if(u>-1)return new Gi(new po(o,f,e,c),null,u)}else if(r&re.IncludeAnonymous||!f.type.isAnonymous||yo(f)){let u;if(!(r&re.IgnoreMounts)&&(u=hi.get(f))&&!u.overlay)return new s(u.tree,c,e,o);let d=new s(f,c,e,o);return r&re.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?f.children.length-1:0,t,i,n)}}}if(r&re.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,i=0){let n;if(!(i&re.IgnoreOverlays)&&(n=hi.get(this._tree))&&n.overlay){let r=e-this.from;for(let{from:o,to:l}of n.overlay)if((t>0?o<=r:o<r)&&(t<0?l>=r:l>r))return new s(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function uh(s,e,t,i){let n=s.cursor(),r=[];if(!n.firstChild())return r;if(t!=null){for(let o=!1;!o;)if(o=n.type.is(t),!n.nextSibling())return r}for(;;){if(i!=null&&n.type.is(i))return r;if(n.type.is(e)&&r.push(n.node),!n.nextSibling())return i==null?r:[]}}function uo(s,e,t=e.length-1){for(let i=s.parent;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}var po=class{constructor(e,t,i,n){this.parent=e,this.buffer=t,this.index=i,this.start=n}},Gi=class s extends un{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new s(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&re.ExcludeBuffers)return null;let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new s(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new s(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new s(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,n=this.index+4,r=i.buffer[this.index+3];if(r>n){let o=i.buffer[this.index+1];e.push(i.slice(n,r,o)),t.push(0)}return new he(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function mh(s){if(!s.length)return null;let e=0,t=s[0];for(let r=1;r<s.length;r++){let o=s[r];(o.from>t.from||o.to<t.to)&&(t=o,e=r)}let i=t instanceof je&&t.index<0?null:t.parent,n=s.slice();return i?n[e]=i:n.splice(e,1),new mo(n,t)}var mo=class{constructor(e,t){this.heads=e,this.node=t}get next(){return mh(this.heads)}};function du(s,e,t){let i=s.resolveInner(e,t),n=null;for(let r=i instanceof je?i:i.context.parent;r;r=r.parent)if(r.index<0){let o=r.parent;(n||(n=[i])).push(o.resolve(e,t)),r=o}else{let o=hi.get(r.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let l=new je(o.tree,o.overlay[0].from+r.from,-1,r);(n||(n=[i])).push(Ui(l,e,t,!1))}}return n?mh(n):i}var Ji=class{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof je)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=i+n.buffer[e+1],this.to=i+n.buffer[e+2],!0}yield(e){return e?e instanceof je?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:n}=this.buffer,r=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&re.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&re.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&re.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let n=i<0?0:this.stack[i]+4;if(this.index!=n)return this.yieldBuf(t.findChild(n,this.index,-1,0,4))}else{let n=t.buffer[this.index+3];if(n<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(n)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:n}=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let r=0;r<this.index;r++)if(n.buffer.buffer[r+3]<this.index)return!1;({index:t,parent:i}=n)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let r=t+e,o=e<0?-1:i._tree.children.length;r!=o;r+=e){let l=i._tree.children[r];if(this.mode&re.IncludeAnonymous||l instanceof vt||!l.type.isAnonymous||yo(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,i=0;if(e&&e.context==this.buffer)e:for(let n=this.index,r=this.stack.length;r>=0;){for(let o=e;o;o=o._parent)if(o.index==n){if(n==this.index)return o;t=o,i=r+1;break e}n=this.stack[--r]}for(let n=i;n<this.stack.length;n++)t=new Gi(this.buffer,t,this.stack[n]);return this.bufferNode=new Gi(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let n=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(n=!0)}for(;n&&t&&t(this),n=this.type.isAnonymous,!this.nextSibling();){if(!i)return;this.parent(),i--,n=!0}}}matchContext(e){if(!this.buffer)return uo(this.node,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let n=e.length-1,r=this.stack.length-1;n>=0;r--){if(r<0)return uo(this.node,e,n);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[n]&&e[n]!=o.name)return!1;n--}}return!0}};function yo(s){return s.children.some(e=>e instanceof vt||!e.type.isAnonymous||yo(e))}function pu(s){var e;let{buffer:t,nodeSet:i,maxBufferLength:n=1024,reused:r=[],minRepeatType:o=i.types.length}=s,l=Array.isArray(t)?new co(t,t.length):t,a=i.types,h=0,f=0;function c(S,w,A,O,L,N){let{id:x,start:D,end:I,size:E}=l,F=f;for(;E<0;)if(l.next(),E==-1){let st=r[x];A.push(st),O.push(D-S);return}else if(E==-3){h=x;return}else if(E==-4){f=x;return}else throw new RangeError(`Unrecognized record size: ${E}`);let xe=a[x],gt,Ie,ks=D-S;if(I-D<=n&&(Ie=g(l.pos-w,L))){let st=new Uint16Array(Ie.size-Ie.skip),Ae=l.pos-Ie.size,We=st.length;for(;l.pos>Ae;)We=b(Ie.start,st,We);gt=new vt(st,I-Ie.start,i),ks=Ie.start-S}else{let st=l.pos-E;l.next();let Ae=[],We=[],Lt=x>=o?x:-1,Yt=0,Ss=I;for(;l.pos>st;)Lt>=0&&l.id==Lt&&l.size>=0?(l.end<=Ss-n&&(p(Ae,We,D,Yt,l.end,Ss,Lt,F),Yt=Ae.length,Ss=l.end),l.next()):N>2500?u(D,st,Ae,We):c(D,st,Ae,We,Lt,N+1);if(Lt>=0&&Yt>0&&Yt<Ae.length&&p(Ae,We,D,Yt,D,Ss,Lt,F),Ae.reverse(),We.reverse(),Lt>-1&&Yt>0){let gl=d(xe);gt=bo(xe,Ae,We,0,Ae.length,0,I-D,gl,gl)}else gt=m(xe,Ae,We,I-D,F-I)}A.push(gt),O.push(ks)}function u(S,w,A,O){let L=[],N=0,x=-1;for(;l.pos>w;){let{id:D,start:I,end:E,size:F}=l;if(F>4)l.next();else{if(x>-1&&I<x)break;x<0&&(x=E-n),L.push(D,I,E),N++,l.next()}}if(N){let D=new Uint16Array(N*4),I=L[L.length-2];for(let E=L.length-3,F=0;E>=0;E-=3)D[F++]=L[E],D[F++]=L[E+1]-I,D[F++]=L[E+2]-I,D[F++]=F;A.push(new vt(D,L[2]-I,i)),O.push(I-S)}}function d(S){return(w,A,O)=>{let L=0,N=w.length-1,x,D;if(N>=0&&(x=w[N])instanceof he){if(!N&&x.type==S&&x.length==O)return x;(D=x.prop(j.lookAhead))&&(L=A[N]+x.length+D)}return m(S,w,A,O,L)}}function p(S,w,A,O,L,N,x,D){let I=[],E=[];for(;S.length>O;)I.push(S.pop()),E.push(w.pop()+A-L);S.push(m(i.types[x],I,E,N-L,D-N)),w.push(L-A)}function m(S,w,A,O,L=0,N){if(h){let x=[j.contextHash,h];N=N?[x].concat(N):[x]}if(L>25){let x=[j.lookAhead,L];N=N?[x].concat(N):[x]}return new he(S,w,A,O,N)}function g(S,w){let A=l.fork(),O=0,L=0,N=0,x=A.end-n,D={size:0,start:0,skip:0};e:for(let I=A.pos-S;A.pos>I;){let E=A.size;if(A.id==w&&E>=0){D.size=O,D.start=L,D.skip=N,N+=4,O+=4,A.next();continue}let F=A.pos-E;if(E<0||F<I||A.start<x)break;let xe=A.id>=o?4:0,gt=A.start;for(A.next();A.pos>F;){if(A.size<0)if(A.size==-3)xe+=4;else break e;else A.id>=o&&(xe+=4);A.next()}L=gt,O+=E,N+=xe}return(w<0||O==S)&&(D.size=O,D.start=L,D.skip=N),D.size>4?D:void 0}function b(S,w,A){let{id:O,start:L,end:N,size:x}=l;if(l.next(),x>=0&&O<o){let D=A;if(x>4){let I=l.pos-(x-4);for(;l.pos>I;)A=b(S,w,A)}w[--A]=D,w[--A]=N-S,w[--A]=L-S,w[--A]=O}else x==-3?h=O:x==-4&&(f=O);return A}let v=[],C=[];for(;l.pos>0;)c(s.start||0,s.bufferStart||0,v,C,-1,0);let M=(e=s.length)!==null&&e!==void 0?e:v.length?C[0]+v[0].length:0;return new he(a[s.topID],v.reverse(),C.reverse(),M)}var dh=new WeakMap;function cn(s,e){if(!s.isAnonymous||e instanceof vt||e.type!=s)return 1;let t=dh.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=s||!(i instanceof he)){t=1;break}t+=cn(s,i)}dh.set(e,t)}return t}function bo(s,e,t,i,n,r,o,l,a){let h=0;for(let p=i;p<n;p++)h+=cn(s,e[p]);let f=Math.ceil(h*1.5/8),c=[],u=[];function d(p,m,g,b,v){for(let C=g;C<b;){let M=C,S=m[C],w=cn(s,p[C]);for(C++;C<b;C++){let A=cn(s,p[C]);if(w+A>=f)break;w+=A}if(C==M+1){if(w>f){let A=p[M];d(A.children,A.positions,0,A.children.length,m[M]+v);continue}c.push(p[M])}else{let A=m[C-1]+p[C-1].length-S;c.push(bo(s,p,m,M,C,S,A,null,a))}u.push(S+v-r)}}return d(e,t,i,n,0),(l||a)(c,u,o)}var Kt=class s{constructor(e,t,i,n,r=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=n,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let n=[new s(0,e.length,e,0,!1,i)];for(let r of t)r.to>e.length&&n.push(r);return n}static applyChanges(e,t,i=128){if(!t.length)return e;let n=[],r=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let f=l<t.length?t[l]:null,c=f?f.fromA:1e9;if(c-a>=i)for(;o&&o.from<c;){let u=o;if(a>=u.from||c<=u.to||h){let d=Math.max(u.from,a)-h,p=Math.min(u.to,c)-h;u=d>=p?null:new s(d,p,u.tree,u.offset+h,l>0,!!f)}if(u&&n.push(u),o.to>c)break;o=r<e.length?e[r++]:null}if(!f)break;a=f.toA,h=f.toA-f.toB}return n}},dn=class{startParse(e,t,i){return typeof e=="string"&&(e=new go(e)),i=i?i.length?i.map(n=>new zi(n.from,n.to)):[new zi(0,0)]:[new zi(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let n=this.startParse(e,t,i);for(;;){let r=n.advance();if(r)return r}}},go=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};var Hd=new j({perNode:!0});var mu=0,Je=class s{constructor(e,t,i){this.set=e,this.base=t,this.modified=i,this.id=mu++}static define(e){if(e!=null&&e.base)throw new Error("Can not derive from a modified tag");let t=new s([],null,[]);if(t.set.push(t),e)for(let i of e.set)t.set.push(i);return t}static defineModifier(){let e=new yn;return t=>t.modified.indexOf(e)>-1?t:yn.get(t.base||t,t.modified.concat(e).sort((i,n)=>i.id-n.id))}},gu=0,yn=class s{constructor(){this.instances=[],this.id=gu++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&yu(t,l.modified));if(i)return i;let n=[],r=new Je(n,e,t);for(let l of t)l.instances.push(r);let o=bu(t);for(let l of e.set)if(!l.modified.length)for(let a of o)n.push(s.get(l,a));return r}};function yu(s,e){return s.length==e.length&&s.every((t,i)=>t==e[i])}function bu(s){let e=[[]];for(let t=0;t<s.length;t++)for(let i=0,n=e.length;i<n;i++)e.push(e[i].concat(s[t]));return e.sort((t,i)=>i.length-t.length)}function bh(s){let e=Object.create(null);for(let t in s){let i=s[t];Array.isArray(i)||(i=[i]);for(let n of t.split(" "))if(n){let r=[],o=2,l=n;for(let c=0;;){if(l=="..."&&c>0&&c+3==n.length){o=1;break}let u=/^"(?:[^"\\\\]|\\\\.)*?"|[^\\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+n);if(r.push(u[0]=="*"?"":u[0][0]==\'"\'?JSON.parse(u[0]):u[0]),c+=u[0].length,c==n.length)break;let d=n[c++];if(c==n.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+n);l=n.slice(c)}let a=r.length-1,h=r[a];if(!h)throw new RangeError("Invalid path: "+n);let f=new fi(i,o,a>0?r.slice(0,a):null);e[h]=f.sort(e[h])}}return wh.add(e)}var wh=new j,fi=class{constructor(e,t,i,n){this.tags=e,this.mode=t,this.context=i,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}};fi.empty=new fi([],2,null);function vo(s,e){let t=Object.create(null);for(let r of s)if(!Array.isArray(r.tag))t[r.tag.id]=r.class;else for(let o of r.tag)t[o.id]=r.class;let{scope:i,all:n=null}=e||{};return{style:r=>{let o=n;for(let l of r)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function wu(s,e){let t=null;for(let i of s){let n=i.style(e);n&&(t=t?t+" "+n:n)}return t}function kh(s,e,t,i=0,n=s.length){let r=new ko(i,Array.isArray(e)?e:[e],t);r.highlightRange(s.cursor(),i,n,"",r.highlighters),r.flush(n)}var ko=class{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,n,r){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=n,f=ku(e)||fi.empty,c=wu(r,f.tags);if(c&&(h&&(h+=" "),h+=c,f.mode==1&&(n+=(n?" ":"")+c)),this.startSpan(e.from,h),f.opaque)return;let u=e.tree&&e.tree.prop(j.mounted);if(u&&u.overlay){let d=e.node.enter(u.overlay[0].from+l,1),p=this.highlighters.filter(g=>!g.scope||g.scope(u.tree.type)),m=e.firstChild();for(let g=0,b=l;;g++){let v=g<u.overlay.length?u.overlay[g]:null,C=v?v.from+l:a,M=Math.max(t,b),S=Math.min(i,C);if(M<S&&m)for(;e.from<S&&(this.highlightRange(e,M,S,n,r),this.startSpan(Math.min(S,e.to),h),!(e.to>=C||!e.nextSibling())););if(!v||C>i)break;b=v.to+l,b>t&&(this.highlightRange(d.cursor(),Math.max(t,v.from+l),Math.min(i,b),n,p),this.startSpan(b,h))}m&&e.parent()}else if(e.firstChild()){do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,n,r),this.startSpan(Math.min(i,e.to),h)}while(e.nextSibling());e.parent()}}};function ku(s){let e=s.type.prop(wh);for(;e&&e.context&&!s.matchContext(e.context);)e=e.next;return e||null}var T=Je.define,pn=T(),xt=T(),gh=T(xt),yh=T(xt),At=T(),mn=T(At),wo=T(At),Ge=T(),qt=T(Ge),ze=T(),Ue=T(),So=T(),Yi=T(So),gn=T(),y={comment:pn,lineComment:T(pn),blockComment:T(pn),docComment:T(pn),name:xt,variableName:T(xt),typeName:gh,tagName:T(gh),propertyName:yh,attributeName:T(yh),className:T(xt),labelName:T(xt),namespace:T(xt),macroName:T(xt),literal:At,string:mn,docString:T(mn),character:T(mn),attributeValue:T(mn),number:wo,integer:T(wo),float:T(wo),bool:T(At),regexp:T(At),escape:T(At),color:T(At),url:T(At),keyword:ze,self:T(ze),null:T(ze),atom:T(ze),unit:T(ze),modifier:T(ze),operatorKeyword:T(ze),controlKeyword:T(ze),definitionKeyword:T(ze),moduleKeyword:T(ze),operator:Ue,derefOperator:T(Ue),arithmeticOperator:T(Ue),logicOperator:T(Ue),bitwiseOperator:T(Ue),compareOperator:T(Ue),updateOperator:T(Ue),definitionOperator:T(Ue),typeOperator:T(Ue),controlOperator:T(Ue),punctuation:So,separator:T(So),bracket:Yi,angleBracket:T(Yi),squareBracket:T(Yi),paren:T(Yi),brace:T(Yi),content:Ge,heading:qt,heading1:T(qt),heading2:T(qt),heading3:T(qt),heading4:T(qt),heading5:T(qt),heading6:T(qt),contentSeparator:T(Ge),list:T(Ge),quote:T(Ge),emphasis:T(Ge),strong:T(Ge),link:T(Ge),monospace:T(Ge),strikethrough:T(Ge),inserted:T(),deleted:T(),changed:T(),invalid:T(),meta:gn,documentMeta:T(gn),annotation:T(gn),processingInstruction:T(gn),definition:Je.defineModifier(),constant:Je.defineModifier(),function:Je.defineModifier(),standard:Je.defineModifier(),local:Je.defineModifier(),special:Je.defineModifier()},Kd=vo([{tag:y.link,class:"tok-link"},{tag:y.heading,class:"tok-heading"},{tag:y.emphasis,class:"tok-emphasis"},{tag:y.strong,class:"tok-strong"},{tag:y.keyword,class:"tok-keyword"},{tag:y.atom,class:"tok-atom"},{tag:y.bool,class:"tok-bool"},{tag:y.url,class:"tok-url"},{tag:y.labelName,class:"tok-labelName"},{tag:y.inserted,class:"tok-inserted"},{tag:y.deleted,class:"tok-deleted"},{tag:y.literal,class:"tok-literal"},{tag:y.string,class:"tok-string"},{tag:y.number,class:"tok-number"},{tag:[y.regexp,y.escape,y.special(y.string)],class:"tok-string2"},{tag:y.variableName,class:"tok-variableName"},{tag:y.local(y.variableName),class:"tok-variableName tok-local"},{tag:y.definition(y.variableName),class:"tok-variableName tok-definition"},{tag:y.special(y.variableName),class:"tok-variableName2"},{tag:y.definition(y.propertyName),class:"tok-propertyName tok-definition"},{tag:y.typeName,class:"tok-typeName"},{tag:y.namespace,class:"tok-namespace"},{tag:y.className,class:"tok-className"},{tag:y.macroName,class:"tok-macroName"},{tag:y.propertyName,class:"tok-propertyName"},{tag:y.operator,class:"tok-operator"},{tag:y.comment,class:"tok-comment"},{tag:y.meta,class:"tok-meta"},{tag:y.invalid,class:"tok-invalid"},{tag:y.punctuation,class:"tok-punctuation"}]);var xo,Qi=new j;var Su=new j,Oe=class{constructor(e,t,i=[],n=""){this.data=e,this.name=n,Q.prototype.hasOwnProperty("tree")||Object.defineProperty(Q.prototype,"tree",{get(){return Zi(this)}}),this.parser=t,this.extension=[ci.of(this),Q.languageData.of((r,o,l)=>{let a=Sh(r,o,l),h=a.type.prop(Qi);if(!h)return[];let f=r.facet(h),c=a.type.prop(Su);if(c){let u=a.resolve(o-a.from,l);for(let d of c)if(d.test(u,r)){let p=r.facet(d.facet);return d.type=="replace"?p:p.concat(f)}}return f})].concat(i)}isActiveAt(e,t,i=-1){return Sh(e,t,i).type.prop(Qi)==this.data}findRegions(e){let t=e.facet(ci);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],n=(r,o)=>{if(r.prop(Qi)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(j.mounted);if(l){if(l.tree.prop(Qi)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let a=i.length;if(n(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;a<r.children.length;a++){let h=r.children[a];h instanceof he&&n(h,r.positions[a]+o)}};return n(Zi(e),0),i}get allowsNesting(){return!0}};Oe.setState=Z.define();function Sh(s,e,t){let i=s.facet(ci),n=Zi(s).topNode;if(!i||i.allowsNesting)for(let r=n;r;r=r.enter(e,t,re.ExcludeBuffers))r.type.isTop&&(n=r);return n}function Zi(s){let e=s.field(Oe.state,!1);return e?e.tree:he.empty}var Oo=class{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e<i||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}},Xi=null,To=class s{constructor(e,t,i=[],n,r,o,l,a){this.parser=e,this.state=t,this.fragments=i,this.tree=n,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new s(e,t,[],he.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Oo(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=he.empty&&this.isDone(t!=null?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let n=Date.now()+e;e=()=>Date.now()>n}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let n=this.parse.advance();if(n)if(this.fragments=this.withoutTempSkipped(Kt.addTree(n,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=n,this.parse=null,this.treeLen<(t!=null?t:this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Kt.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Xi;Xi=this;try{return e()}finally{Xi=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=vh(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:n,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,f,c,u)=>a.push({fromA:h,toA:f,fromB:c,toB:u})),i=Kt.applyChanges(i,a),n=he.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let f=e.mapPos(h.from,1),c=e.mapPos(h.to,-1);f<c&&l.push({from:f,to:c})}}}return new s(this.parser,t,i,n,r,o,l,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:n,to:r}=this.skipped[i];n<e.to&&r>e.from&&(this.fragments=vh(this.fragments,n,r),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends dn{createParse(t,i,n){let r=n[0].from,o=n[n.length-1].to;return{parsedPos:r,advance(){let a=Xi;if(a){for(let h of n)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new he(Se.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Xi}};function vh(s,e,t){return Kt.applyChanges(s,[{fromA:e,toA:t,fromB:e,toB:t}])}var es=class s{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new s(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=To.create(e.facet(ci).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new s(i)}};Oe.state=rt.define({create:es.init,update(s,e){for(let t of e.effects)if(t.is(Oe.setState))return t.value;return e.startState.facet(ci)!=e.state.facet(ci)?es.init(e.state):s.apply(e)}});var Ch=s=>{let e=setTimeout(()=>s(),500);return()=>clearTimeout(e)};typeof requestIdleCallback!="undefined"&&(Ch=s=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(s,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});var Ao=typeof navigator!="undefined"&&(!((xo=navigator.scheduling)===null||xo===void 0)&&xo.isInputPending)?()=>navigator.scheduling.isInputPending():null,vu=ai.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Oe.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),e.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Oe.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Ch(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:n}}=this.view,r=i.field(Oe.state);if(r.tree==r.context.tree&&r.context.isDone(n+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Ao?Math.max(25,e.timeRemaining()-5):1e9),l=r.context.treeLen<n&&i.doc.length>n+1e3,a=r.context.work(()=>Ao&&Ao()||Date.now()>o,n+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:Oe.setState.of(new es(r.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>ht(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),ci=V.define({combine(s){return s.length?s[0]:null},enables:s=>[Oe.state,vu,K.contentAttributes.compute([s],e=>{let t=e.facet(s);return t&&t.name?{"data-language":t.name}:{}})]});var Ct=class s{constructor(e,t){this.specs=e;let i;function n(l){let a=Ce.newName();return(i||(i=Object.create(null)))["."+a]=l,a}let r=typeof t.all=="string"?t.all:t.all?n(t.all):void 0,o=t.scope;this.scope=o instanceof Oe?l=>l.prop(Qi)==o.data:o?l=>l==o:void 0,this.style=vo(e.map(l=>({tag:l.tag,class:l.class||n(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new Ce(i):null,this.themeType=t.themeType}static define(e,t){return new s(e,t||{})}},No=V.define(),Mh=V.define({combine(s){return s.length?[s[0]]:null}});function Co(s){let e=s.facet(No);return e.length?e:s.facet(Mh)}function bn(s,e){let t=[xu],i;return s instanceof Ct&&(s.module&&t.push(K.styleModule.of(s.module)),i=s.themeType),e!=null&&e.fallback?t.push(Mh.of(s)):i?t.push(No.computeN([K.darkTheme],n=>n.facet(K.darkTheme)==(i=="dark")?[s]:[])):t.push(No.of(s)),t}var Eo=class{constructor(e){this.markCache=Object.create(null),this.tree=Zi(e.state),this.decorations=this.buildDeco(e,Co(e.state))}update(e){let t=Zi(e.state),i=Co(e.state),n=i!=Co(e.startState);t.length<e.view.viewport.to&&!n&&t.type==this.tree.type?this.decorations=this.decorations.map(e.changes):(t!=this.tree||e.viewportChanged||n)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i))}buildDeco(e,t){if(!t||!this.tree.length)return Y.none;let i=new $t;for(let{from:n,to:r}of e.visibleRanges)kh(this.tree,t,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=Y.mark({class:a})))},n,r);return i.finish()}},xu=Bs.high(ai.fromClass(Eo,{decorations:s=>s.decorations})),Zd=Ct.define([{tag:y.meta,color:"#404740"},{tag:y.link,textDecoration:"underline"},{tag:y.heading,textDecoration:"underline",fontWeight:"bold"},{tag:y.emphasis,fontStyle:"italic"},{tag:y.strong,fontWeight:"bold"},{tag:y.strikethrough,textDecoration:"line-through"},{tag:y.keyword,color:"#708"},{tag:[y.atom,y.bool,y.url,y.contentSeparator,y.labelName],color:"#219"},{tag:[y.literal,y.inserted],color:"#164"},{tag:[y.string,y.deleted],color:"#a11"},{tag:[y.regexp,y.escape,y.special(y.string)],color:"#e40"},{tag:y.definition(y.variableName),color:"#00f"},{tag:y.local(y.variableName),color:"#30a"},{tag:[y.typeName,y.namespace],color:"#085"},{tag:y.className,color:"#167"},{tag:[y.special(y.variableName),y.macroName],color:"#256"},{tag:y.definition(y.propertyName),color:"#00c"},{tag:y.comment,color:"#940"},{tag:y.invalid,color:"#f00"}]);var Au=Object.create(null),xh=[Se.none];var Ah=[],Cu=Object.create(null);for(let[s,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Cu[s]=Mu(Au,e);function Mo(s,e){Ah.indexOf(s)>-1||(Ah.push(s),console.warn(e))}function Mu(s,e){let t=null;for(let r of e.split(".")){let o=s[r]||y[r];o?typeof o=="function"?t?t=o(t):Mo(r,`Modifier ${r} used at start of tag`):t?Mo(r,`Tag ${r} used as modifier`):t=o:Mo(r,`Unknown highlighting tag ${r}`)}if(!t)return 0;let i=e.replace(/ /g,"_"),n=Se.define({id:xh.length,name:i,props:[bh({[i]:t})]});return xh.push(n),n.id}var Ou="#abb2bf",Tu="#7d8799",Nu="#ffffff",Eu="#21252b",Do="rgba(0, 0, 0, 0.5)",Du="#292d3e",Lo="#353a42",Lu="rgba(128, 203, 196, 0.2)",Oh="#ffcc00",Pu=K.theme({"&":{color:"#ffffff",backgroundColor:Du},".cm-content":{caretColor:Oh},"&.cm-focused .cm-cursor":{borderLeftColor:Oh},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Lu},".cm-panels":{backgroundColor:Eu,color:"#ffffff"},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:Do},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847",outline:"1px solid #515a6b"},".cm-gutters":{background:"#292d3e",color:"#676e95",border:"none"},".cm-activeLineGutter":{backgroundColor:Do},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Lo},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Lo,borderBottomColor:Lo},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Do,color:Ou}}},{dark:!0}),Bu=Ct.define([{tag:y.keyword,color:"#c792ea"},{tag:y.operator,color:"#89ddff"},{tag:y.special(y.variableName),color:"#eeffff"},{tag:y.typeName,color:"#f07178"},{tag:y.atom,color:"#f78c6c"},{tag:y.number,color:"#ff5370"},{tag:y.definition(y.variableName),color:"#82aaff"},{tag:y.string,color:"#c3e88d"},{tag:y.special(y.string),color:"#f07178"},{tag:y.comment,color:Tu},{tag:y.variableName,color:"#f07178"},{tag:y.tagName,color:"#ff5370"},{tag:y.bracket,color:"#a2a1a4"},{tag:y.meta,color:"#ffcb6b"},{tag:y.attributeName,color:"#c792ea"},{tag:y.propertyName,color:"#c792ea"},{tag:y.className,color:"#decb6b"},{tag:y.invalid,color:Nu}]),Iu=[Pu,bn(Bu)];var Th="#2e3440",$o="#3b4252",Nh="#434c5e",wn="#4c566a";var Eh="#e5e9f0",Fo="#eceff4",Po="#8fbcbb",Dh="#88c0d0",Ru="#81a1c1",Re="#5e81ac",Fu="#bf616a",ui="#d08770",Bo="#ebcb8b",Lh="#a3be8c",$u="#b48ead",Ph="#d30102",Vo=Fo,Io=Vo,Vu="#ffffff",Ro=$o,Hu=Vo,Bh=$o,Ih=K.theme({"&":{color:Th,backgroundColor:Vu},".cm-content":{caretColor:Bh},".cm-cursor, .cm-dropCursor":{borderLeftColor:Bh},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Hu},".cm-panels":{backgroundColor:Vo,color:wn},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:`1px solid ${wn}`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:Eh},".cm-activeLine":{backgroundColor:Io},".cm-selectionMatch":{backgroundColor:Eh},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{outline:`1px solid ${wn}`},"&.cm-focused .cm-matchingBracket":{backgroundColor:Fo},".cm-gutters":{backgroundColor:Fo,color:Th,border:"none"},".cm-activeLineGutter":{backgroundColor:Io},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Ro},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Ro,borderBottomColor:Ro},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Io,color:wn}}},{dark:!1}),_u=Ct.define([{tag:y.keyword,color:Re},{tag:[y.name,y.deleted,y.character,y.propertyName,y.macroName],color:ui},{tag:[y.variableName],color:ui},{tag:[y.function(y.variableName)],color:Re},{tag:[y.labelName],color:Ru},{tag:[y.color,y.constant(y.name),y.standard(y.name)],color:Re},{tag:[y.definition(y.name),y.separator],color:Lh},{tag:[y.brace],color:Po},{tag:[y.annotation],color:Ph},{tag:[y.number,y.changed,y.annotation,y.modifier,y.self,y.namespace],color:Dh},{tag:[y.typeName,y.className],color:Bo},{tag:[y.operator,y.operatorKeyword],color:Lh},{tag:[y.tagName],color:$u},{tag:[y.squareBracket],color:Fu},{tag:[y.angleBracket],color:ui},{tag:[y.attributeName],color:Bo},{tag:[y.regexp],color:Re},{tag:[y.quote],color:$o},{tag:[y.string],color:ui},{tag:y.link,color:Po,textDecoration:"underline",textUnderlinePosition:"under"},{tag:[y.url,y.escape,y.special(y.string)],color:ui},{tag:[y.meta],color:Dh},{tag:[y.comment],color:Nh,fontStyle:"italic"},{tag:y.strong,fontWeight:"bold",color:Re},{tag:y.emphasis,fontStyle:"italic",color:Re},{tag:y.strikethrough,textDecoration:"line-through"},{tag:y.heading,fontWeight:"bold",color:Re},{tag:y.special(y.heading1),fontWeight:"bold",color:Re},{tag:y.heading1,fontWeight:"bold",color:Re},{tag:[y.heading2,y.heading3,y.heading4],fontWeight:"bold",color:Re},{tag:[y.heading5,y.heading6],color:Re},{tag:[y.atom,y.bool,y.special(y.variableName)],color:ui},{tag:[y.processingInstruction,y.inserted],color:Po},{tag:[y.contentSeparator],color:Bo},{tag:y.invalid,color:Nh,borderBottom:`1px dotted ${Ph}`}]),fp=[Ih,bn(_u)];var ts=(s,e=0)=>{let t=[];if(e==5||!s||s==null)return"";if(typeof s=="string")return s;if(typeof s=="number")return`${s}`;if(Array.isArray(s))t.push(`${s.map(i=>ts(i,e++)).join(" ")}`);else if(typeof s=="object")for(let[i,n]of Object.entries(s))t.push(ts(i,e++),ts(n,e++));return t.join(" ")};function di(s=[],e=[]){s||(s=[]),Array.isArray(s)||(s=[s]),e||(e=[]),Array.isArray(e)||(e=[e]);for(let t of e!=null?e:[])if(t)if(Array.isArray(t)){let i=ts(t.slice(1));s=s.filter(n=>n.name!=t[0]&&n.desc!=i),s.push({name:t[0],desc:i})}else typeof t=="object"&&("name"in t||"desc"in t)&&(s=s.filter(i=>{var n;return(!((n=i.name)!=null&&n.length)||i.name!=t.name)&&i.desc!=t.desc}),s.push(Sl(kl({},t),{name:t.name,desc:ts(t.desc)})));return s}var dl={};vl(dl,{Alias:()=>Ze,CST:()=>hl,Composer:()=>Ut,Document:()=>et,Lexer:()=>Oi,LineCounter:()=>Ti,Pair:()=>J,Parser:()=>Gt,Scalar:()=>P,Schema:()=>vi,YAMLError:()=>Ai,YAMLMap:()=>X,YAMLParseError:()=>ve,YAMLSeq:()=>oe,YAMLWarning:()=>Ci,isAlias:()=>Ne,isCollection:()=>W,isDocument:()=>Ye,isMap:()=>Ee,isNode:()=>_,isPair:()=>H,isScalar:()=>$,isSeq:()=>De,parse:()=>Lf,parseAllDocuments:()=>Df,parseDocument:()=>ul,stringify:()=>Pf,visit:()=>Le,visitAsync:()=>is});var kn=Symbol.for("yaml.alias"),Sn=Symbol.for("yaml.document"),Fe=Symbol.for("yaml.map"),Ho=Symbol.for("yaml.pair"),Te=Symbol.for("yaml.scalar"),ut=Symbol.for("yaml.seq"),ue=Symbol.for("yaml.node.type"),Ne=s=>!!s&&typeof s=="object"&&s[ue]===kn,Ye=s=>!!s&&typeof s=="object"&&s[ue]===Sn,Ee=s=>!!s&&typeof s=="object"&&s[ue]===Fe,H=s=>!!s&&typeof s=="object"&&s[ue]===Ho,$=s=>!!s&&typeof s=="object"&&s[ue]===Te,De=s=>!!s&&typeof s=="object"&&s[ue]===ut;function W(s){if(s&&typeof s=="object")switch(s[ue]){case Fe:case ut:return!0}return!1}function _(s){if(s&&typeof s=="object")switch(s[ue]){case kn:case Fe:case Te:case ut:return!0}return!1}var Rh=s=>($(s)||W(s))&&!!s.anchor;var me=Symbol("break visit"),Fh=Symbol("skip children"),Xe=Symbol("remove node");function Le(s,e){let t=$h(e);Ye(s)?pi(null,s.contents,t,Object.freeze([s]))===Xe&&(s.contents=null):pi(null,s,t,Object.freeze([]))}Le.BREAK=me;Le.SKIP=Fh;Le.REMOVE=Xe;function pi(s,e,t,i){let n=Vh(s,e,t,i);if(_(n)||H(n))return Hh(s,i,n),pi(s,n,t,i);if(typeof n!="symbol"){if(W(e)){i=Object.freeze(i.concat(e));for(let r=0;r<e.items.length;++r){let o=pi(r,e.items[r],t,i);if(typeof o=="number")r=o-1;else{if(o===me)return me;o===Xe&&(e.items.splice(r,1),r-=1)}}}else if(H(e)){i=Object.freeze(i.concat(e));let r=pi("key",e.key,t,i);if(r===me)return me;r===Xe&&(e.key=null);let o=pi("value",e.value,t,i);if(o===me)return me;o===Xe&&(e.value=null)}}return n}async function is(s,e){let t=$h(e);Ye(s)?await mi(null,s.contents,t,Object.freeze([s]))===Xe&&(s.contents=null):await mi(null,s,t,Object.freeze([]))}is.BREAK=me;is.SKIP=Fh;is.REMOVE=Xe;async function mi(s,e,t,i){let n=await Vh(s,e,t,i);if(_(n)||H(n))return Hh(s,i,n),mi(s,n,t,i);if(typeof n!="symbol"){if(W(e)){i=Object.freeze(i.concat(e));for(let r=0;r<e.items.length;++r){let o=await mi(r,e.items[r],t,i);if(typeof o=="number")r=o-1;else{if(o===me)return me;o===Xe&&(e.items.splice(r,1),r-=1)}}}else if(H(e)){i=Object.freeze(i.concat(e));let r=await mi("key",e.key,t,i);if(r===me)return me;r===Xe&&(e.key=null);let o=await mi("value",e.value,t,i);if(o===me)return me;o===Xe&&(e.value=null)}}return n}function $h(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function Vh(s,e,t,i){var n,r,o,l,a;if(typeof t=="function")return t(s,e,i);if(Ee(e))return(n=t.Map)==null?void 0:n.call(t,s,e,i);if(De(e))return(r=t.Seq)==null?void 0:r.call(t,s,e,i);if(H(e))return(o=t.Pair)==null?void 0:o.call(t,s,e,i);if($(e))return(l=t.Scalar)==null?void 0:l.call(t,s,e,i);if(Ne(e))return(a=t.Alias)==null?void 0:a.call(t,s,e,i)}function Hh(s,e,t){let i=e[e.length-1];if(W(i))i.items[s]=t;else if(H(i))s==="key"?i.key=t:i.value=t;else if(Ye(i))i.contents=t;else{let n=Ne(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}var Ku={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},qu=s=>s.replace(/[!,[\\]{}]/g,e=>Ku[e]),Qe=class s{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,t)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let i=e.trim().split(/[ \\t]+/),n=i.shift();switch(n){case"%TAG":{if(i.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[r,o]=i;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[r]=i;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\\d+\\.\\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${n}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren\'t resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}let[,i,n]=e.match(new RegExp("^(.*!)([^!]*)$","s"));n||t(`The ${e} tag has no suffix`);let r=this.tags[i];if(r)try{return r+decodeURIComponent(n)}catch(o){return t(String(o)),null}return i==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,i]of Object.entries(this.tags))if(e.startsWith(i))return t+qu(e.substring(i.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),n;if(e&&i.length>0&&_(e.contents)){let r={};Le(e.contents,(o,l)=>{_(l)&&l.tag&&(r[l.tag]=!0)}),n=Object.keys(r)}else n=[];for(let[r,o]of i)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||n.some(l=>l.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`\n`)}};Qe.defaultYaml={explicit:!1,version:"1.2"};Qe.defaultTags={"!!":"tag:yaml.org,2002:"};function vn(s){if(/[\\x00-\\x19\\s,[\\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function _o(s){let e=new Set;return Le(s,{Value(t,i){i.anchor&&e.add(i.anchor)}}),e}function Wo(s,e){for(let t=1;;++t){let i=`${s}${t}`;if(!e.has(i))return i}}function _h(s,e){let t=[],i=new Map,n=null;return{onAnchor:r=>{t.push(r),n||(n=_o(s));let o=Wo(e,n);return n.add(o),o},setAnchors:()=>{for(let r of t){let o=i.get(r);if(typeof o=="object"&&o.anchor&&($(o.node)||W(o.node)))o.node.anchor=o.anchor;else{let l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=r,l}}},sourceObjects:i}}function Mt(s,e,t,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let n=0,r=i.length;n<r;++n){let o=i[n],l=Mt(s,i,String(n),o);l===void 0?delete i[n]:l!==o&&(i[n]=l)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let r=i.get(n),o=Mt(s,i,n,r);o===void 0?i.delete(n):o!==r&&i.set(n,o)}else if(i instanceof Set)for(let n of Array.from(i)){let r=Mt(s,i,n,n);r===void 0?i.delete(n):r!==n&&(i.delete(n),i.add(r))}else for(let[n,r]of Object.entries(i)){let o=Mt(s,i,n,r);o===void 0?delete i[n]:o!==r&&(i[n]=o)}return s.call(e,t,i)}function se(s,e,t){if(Array.isArray(s))return s.map((i,n)=>se(i,String(n),t));if(s&&typeof s.toJSON=="function"){if(!t||!Rh(s))return s.toJSON(e,t);let i={aliasCount:0,count:1,res:void 0};t.anchors.set(s,i),t.onCreate=r=>{i.res=r,delete t.onCreate};let n=s.toJSON(e,t);return t.onCreate&&t.onCreate(n),n}return typeof s=="bigint"&&!(t!=null&&t.keep)?Number(s):s}var Ot=class{constructor(e){Object.defineProperty(this,ue,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:i,onAnchor:n,reviver:r}={}){if(!Ye(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=se(this,"",o);if(typeof n=="function")for(let{count:a,res:h}of o.anchors.values())n(h,a);return typeof r=="function"?Mt(r,{"":l},"",l):l}};var Ze=class extends Ot{constructor(e){super(kn),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let t;return Le(e,{Node:(i,n)=>{if(n===this)return Le.BREAK;n.anchor===this.source&&(t=n)}}),t}toJSON(e,t){if(!t)return{source:this.source};let{anchors:i,doc:n,maxAliasCount:r}=t,o=this.resolve(n);if(!o){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(a)}let l=i.get(o);if(l||(se(o,null,t),l=i.get(o)),!l||l.res===void 0){let a="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(a)}if(r>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=xn(n,o,i)),l.count*l.aliasCount>r)){let a="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(a)}return l.res}toString(e,t,i){let n=`*${this.source}`;if(e){if(vn(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${n} `}return n}};function xn(s,e,t){if(Ne(e)){let i=e.resolve(s),n=t&&i&&t.get(i);return n?n.count*n.aliasCount:0}else if(W(e)){let i=0;for(let n of e.items){let r=xn(s,n,t);r>i&&(i=r)}return i}else if(H(e)){let i=xn(s,e.key,t),n=xn(s,e.value,t);return Math.max(i,n)}return 1}var An=s=>!s||typeof s!="function"&&typeof s!="object",P=class extends Ot{constructor(e){super(Te),this.value=e}toJSON(e,t){return t!=null&&t.keep?this.value:se(this.value,e,t)}toString(){return String(this.value)}};P.BLOCK_FOLDED="BLOCK_FOLDED";P.BLOCK_LITERAL="BLOCK_LITERAL";P.PLAIN="PLAIN";P.QUOTE_DOUBLE="QUOTE_DOUBLE";P.QUOTE_SINGLE="QUOTE_SINGLE";var ju="tag:yaml.org,2002:";function zu(s,e,t){var i;if(e){let n=t.filter(o=>o.tag===e),r=(i=n.find(o=>!o.format))!=null?i:n[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return t.find(n=>{var r;return((r=n.identify)==null?void 0:r.call(n,s))&&!n.format})}function dt(s,e,t){var c,u,d;if(Ye(s)&&(s=s.contents),_(s))return s;if(H(s)){let p=(u=(c=t.schema[Fe]).createNode)==null?void 0:u.call(c,t.schema,null,t);return p.items.push(s),p}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt!="undefined"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:i,onAnchor:n,onTagObj:r,schema:o,sourceObjects:l}=t,a;if(i&&s&&typeof s=="object"){if(a=l.get(s),a)return a.anchor||(a.anchor=n(s)),new Ze(a.anchor);a={anchor:null,node:null},l.set(s,a)}e!=null&&e.startsWith("!!")&&(e=ju+e.slice(2));let h=zu(s,e,o.tags);if(!h){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let p=new P(s);return a&&(a.node=p),p}h=s instanceof Map?o[Fe]:Symbol.iterator in Object(s)?o[ut]:o[Fe]}r&&(r(h),delete t.onTagObj);let f=h!=null&&h.createNode?h.createNode(t.schema,s,t):typeof((d=h==null?void 0:h.nodeClass)==null?void 0:d.from)=="function"?h.nodeClass.from(t.schema,s,t):new P(s);return e?f.tag=e:h.default||(f.tag=h.tag),a&&(a.node=f),f}function ss(s,e,t){let i=t;for(let n=e.length-1;n>=0;--n){let r=e[n];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=i,i=o}else i=new Map([[r,i]])}return dt(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var gi=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,jt=class extends Ot{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(i=>_(i)||H(i)?i.clone(e):i),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(gi(e))this.add(t);else{let[i,...n]=e,r=this.get(i,!0);if(W(r))r.addIn(n,t);else if(r===void 0&&this.schema)this.set(i,ss(this.schema,n,t));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}deleteIn(e){let[t,...i]=e;if(i.length===0)return this.delete(t);let n=this.get(t,!0);if(W(n))return n.deleteIn(i);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${i}`)}getIn(e,t){let[i,...n]=e,r=this.get(i,!0);return n.length===0?!t&&$(r)?r.value:r:W(r)?r.getIn(n,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!H(t))return!1;let i=t.value;return i==null||e&&$(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(e){let[t,...i]=e;if(i.length===0)return this.has(t);let n=this.get(t,!0);return W(n)?n.hasIn(i):!1}setIn(e,t){let[i,...n]=e;if(n.length===0)this.set(i,t);else{let r=this.get(i,!0);if(W(r))r.setIn(n,t);else if(r===void 0&&this.schema)this.set(i,ss(this.schema,n,t));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}};jt.maxFlowStringSingleLineLength=60;var Wh=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function Pe(s,e){return/^\\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var $e=(s,e,t)=>s.endsWith(`\n`)?Pe(t,e):t.includes(`\n`)?`\n`+Pe(t,e):(s.endsWith(" ")?"":" ")+t;var Ko="flow",Cn="block",ns="quoted";function rs(s,e,t="flow",{indentAtStart:i,lineWidth:n=80,minContentWidth:r=20,onFold:o,onOverflow:l}={}){if(!n||n<0)return s;let a=Math.max(1+r,1+n-e.length);if(s.length<=a)return s;let h=[],f={},c=n-e.length;typeof i=="number"&&(i>n-Math.max(2,r)?h.push(0):c=n-i);let u,d,p=!1,m=-1,g=-1,b=-1;t===Cn&&(m=Kh(s,m),m!==-1&&(c=m+a));for(let C;C=s[m+=1];){if(t===ns&&C==="\\\\"){switch(g=m,s[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}b=m}if(C===`\n`)t===Cn&&(m=Kh(s,m)),c=m+a,u=void 0;else{if(C===" "&&d&&d!==" "&&d!==`\n`&&d!==" "){let M=s[m+1];M&&M!==" "&&M!==`\n`&&M!==" "&&(u=m)}if(m>=c)if(u)h.push(u),c=u+a,u=void 0;else if(t===ns){for(;d===" "||d===" ";)d=C,C=s[m+=1],p=!0;let M=m>b+1?m-2:g-1;if(f[M])return s;h.push(M),f[M]=!0,c=M+a,u=void 0}else p=!0}d=C}if(p&&l&&l(),h.length===0)return s;o&&o();let v=s.slice(0,h[0]);for(let C=0;C<h.length;++C){let M=h[C],S=h[C+1]||s.length;M===0?v=`\n${e}${s.slice(0,S)}`:(t===ns&&f[M]&&(v+=`${s[M]}\\\\`),v+=`\n${e}${s.slice(M+1,S)}`)}return v}function Kh(s,e){let t=s[e+1];for(;t===" "||t===" ";){do t=s[e+=1];while(t&&t!==`\n`);t=s[e+1]}return e}var On=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),Tn=s=>/^(%|---|\\.\\.\\.)/m.test(s);function Uu(s,e,t){if(!e||e<0)return!1;let i=e-t,n=s.length;if(n<=i)return!1;for(let r=0,o=0;r<n;++r)if(s[r]===`\n`){if(r-o>i)return!0;if(o=r+1,n-o<=i)return!1}return!0}function os(s,e){let t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:i}=e,n=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(Tn(s)?" ":""),o="",l=0;for(let a=0,h=t[a];h;h=t[++a])if(h===" "&&t[a+1]==="\\\\"&&t[a+2]==="n"&&(o+=t.slice(l,a)+"\\\\ ",a+=1,l=a,h="\\\\"),h==="\\\\")switch(t[a+1]){case"u":{o+=t.slice(l,a);let f=t.substr(a+2,4);switch(f){case"0000":o+="\\\\0";break;case"0007":o+="\\\\a";break;case"000b":o+="\\\\v";break;case"001b":o+="\\\\e";break;case"0085":o+="\\\\N";break;case"00a0":o+="\\\\_";break;case"2028":o+="\\\\L";break;case"2029":o+="\\\\P";break;default:f.substr(0,2)==="00"?o+="\\\\x"+f.substr(2):o+=t.substr(a,6)}a+=5,l=a+1}break;case"n":if(i||t[a+2]===\'"\'||t.length<n)a+=1;else{for(o+=t.slice(l,a)+`\n\n`;t[a+2]==="\\\\"&&t[a+3]==="n"&&t[a+4]!==\'"\';)o+=`\n`,a+=2;o+=r,t[a+2]===" "&&(o+="\\\\"),a+=1,l=a+1}break;default:a+=1}return o=l?o+t.slice(l):t,i?o:rs(o,r,ns,On(e,!1))}function qo(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`\n`)||/[ \\t]\\n|\\n[ \\t]/.test(s))return os(s,e);let t=e.indent||(Tn(s)?" ":""),i="\'"+s.replace(/\'/g,"\'\'").replace(/\\n+/g,`$&\n${t}`)+"\'";return e.implicitKey?i:rs(i,t,Ko,On(e,!1))}function yi(s,e){let{singleQuote:t}=e.options,i;if(t===!1)i=os;else{let n=s.includes(\'"\'),r=s.includes("\'");n&&!r?i=qo:r&&!n?i=os:i=t?qo:os}return i(s,e)}var jo;try{jo=new RegExp(`(^|(?<!\n))\n+(?!\n|$)`,"g")}catch(s){jo=/\\n+(?!\\n|$)/g}function Mn({comment:s,type:e,value:t},i,n,r){let{blockQuote:o,commentString:l,lineWidth:a}=i.options;if(!o||/\\n[\\t ]+$/.test(t)||/^\\s*$/.test(t))return yi(t,i);let h=i.indent||(i.forceBlockIndent||Tn(t)?" ":""),f=o==="literal"?!0:o==="folded"||e===P.BLOCK_FOLDED?!1:e===P.BLOCK_LITERAL?!0:!Uu(t,a,h.length);if(!t)return f?`|\n`:`>\n`;let c,u;for(u=t.length;u>0;--u){let w=t[u-1];if(w!==`\n`&&w!==" "&&w!==" ")break}let d=t.substring(u),p=d.indexOf(`\n`);p===-1?c="-":t===d||p!==d.length-1?(c="+",r&&r()):c="",d&&(t=t.slice(0,-d.length),d[d.length-1]===`\n`&&(d=d.slice(0,-1)),d=d.replace(jo,`$&${h}`));let m=!1,g,b=-1;for(g=0;g<t.length;++g){let w=t[g];if(w===" ")m=!0;else if(w===`\n`)b=g;else break}let v=t.substring(0,b<g?b+1:g);v&&(t=t.substring(v.length),v=v.replace(/\\n+/g,`$&${h}`));let M=(f?"|":">")+(m?h?"2":"1":"")+c;if(s&&(M+=" "+l(s.replace(/ ?[\\r\\n]+/g," ")),n&&n()),f)return t=t.replace(/\\n+/g,`$&${h}`),`${M}\n${h}${v}${t}${d}`;t=t.replace(/\\n+/g,`\n$&`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").replace(/\\n+/g,`$&${h}`);let S=rs(`${v}${t}${d}`,h,Cn,On(i,!0));return`${M}\n${h}${S}`}function Gu(s,e,t,i){let{type:n,value:r}=s,{actualString:o,implicitKey:l,indent:a,indentStep:h,inFlow:f}=e;if(l&&r.includes(`\n`)||f&&/[[\\]{},]/.test(r))return yi(r,e);if(!r||/^[\\n\\t ,[\\]{}#&*!|>\'"%@`]|^[?-]$|^[?-][ \\t]|[\\n:][ \\t]|[ \\t]\\n|[\\n\\t ]#|[\\n\\t :]$/.test(r))return l||f||!r.includes(`\n`)?yi(r,e):Mn(s,e,t,i);if(!l&&!f&&n!==P.PLAIN&&r.includes(`\n`))return Mn(s,e,t,i);if(Tn(r)){if(a==="")return e.forceBlockIndent=!0,Mn(s,e,t,i);if(l&&a===h)return yi(r,e)}let c=r.replace(/\\n+/g,`$&\n${a}`);if(o){let u=m=>{var g;return m.default&&m.tag!=="tag:yaml.org,2002:str"&&((g=m.test)==null?void 0:g.test(c))},{compat:d,tags:p}=e.doc.schema;if(p.some(u)||d!=null&&d.some(u))return yi(r,e)}return l?c:rs(c,a,Ko,On(e,!1))}function pt(s,e,t,i){let{implicitKey:n,inFlow:r}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)}),{type:l}=s;l!==P.QUOTE_DOUBLE&&/[\\x00-\\x08\\x0b-\\x1f\\x7f-\\x9f\\u{D800}-\\u{DFFF}]/u.test(o.value)&&(l=P.QUOTE_DOUBLE);let a=f=>{switch(f){case P.BLOCK_FOLDED:case P.BLOCK_LITERAL:return n||r?yi(o.value,e):Mn(o,e,t,i);case P.QUOTE_DOUBLE:return os(o.value,e);case P.QUOTE_SINGLE:return qo(o.value,e);case P.PLAIN:return Gu(o,e,t,i);default:return null}},h=a(l);if(h===null){let{defaultKeyType:f,defaultStringType:c}=e.options,u=n&&f||c;if(h=a(u),h===null)throw new Error(`Unsupported default string type ${u}`)}return h}function Nn(s,e){let t=Object.assign({blockQuote:!0,commentString:Wh,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},s.schema.toStringOptions,e),i;switch(t.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:i,options:t}}function Ju(s,e){var n,r,o,l;if(e.tag){let a=s.filter(h=>h.tag===e.tag);if(a.length>0)return(n=a.find(h=>h.format===e.format))!=null?n:a[0]}let t,i;if($(e)){i=e.value;let a=s.filter(h=>{var f;return(f=h.identify)==null?void 0:f.call(h,i)});t=(r=a.find(h=>h.format===e.format))!=null?r:a.find(h=>!h.format)}else i=e,t=s.find(a=>a.nodeClass&&i instanceof a.nodeClass);if(!t){let a=(l=(o=i==null?void 0:i.constructor)==null?void 0:o.name)!=null?l:typeof i;throw new Error(`Tag not resolved for ${a} value`)}return t}function Yu(s,e,{anchors:t,doc:i}){if(!i.directives)return"";let n=[],r=($(s)||W(s))&&s.anchor;r&&vn(r)&&(t.add(r),n.push(`&${r}`));let o=s.tag?s.tag:e.default?null:e.tag;return o&&n.push(i.directives.tagString(o)),n.join(" ")}function mt(s,e,t,i){var a,h;if(H(s))return s.toString(e,t,i);if(Ne(s)){if(e.doc.directives)return s.toString(e);if((a=e.resolvedAliases)!=null&&a.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let n,r=_(s)?s:e.doc.createNode(s,{onTagObj:f=>n=f});n||(n=Ju(e.doc.schema.tags,r));let o=Yu(r,n,e);o.length>0&&(e.indentAtStart=((h=e.indentAtStart)!=null?h:0)+o.length+1);let l=typeof n.stringify=="function"?n.stringify(r,e,t,i):$(r)?pt(r,e,t,i):r.toString(e,t,i);return o?$(r)||l[0]==="{"||l[0]==="["?`${o} ${l}`:`${o}\n${e.indent}${l}`:l}function qh({key:s,value:e},t,i,n){var A,O;let{allNullValues:r,doc:o,indent:l,indentStep:a,options:{commentString:h,indentSeq:f,simpleKeys:c}}=t,u=_(s)&&s.comment||null;if(c){if(u)throw new Error("With simple keys, key nodes cannot have comments");if(W(s)){let L="With simple keys, collection cannot be used as a key value";throw new Error(L)}}let d=!c&&(!s||u&&e==null&&!t.inFlow||W(s)||($(s)?s.type===P.BLOCK_FOLDED||s.type===P.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!d&&(c||!r),indent:l+a});let p=!1,m=!1,g=mt(s,t,()=>p=!0,()=>m=!0);if(!d&&!t.inFlow&&g.length>1024){if(c)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");d=!0}if(t.inFlow){if(r||e==null)return p&&i&&i(),g===""?"?":d?`? ${g}`:g}else if(r&&!c||e==null&&d)return g=`? ${g}`,u&&!p?g+=$e(g,t.indent,h(u)):m&&n&&n(),g;p&&(u=null),d?(u&&(g+=$e(g,t.indent,h(u))),g=`? ${g}\n${l}:`):(g=`${g}:`,u&&(g+=$e(g,t.indent,h(u))));let b,v,C;_(e)?(b=!!e.spaceBefore,v=e.commentBefore,C=e.comment):(b=!1,v=null,C=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!d&&!u&&$(e)&&(t.indentAtStart=g.length+1),m=!1,!f&&a.length>=2&&!t.inFlow&&!d&&De(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let M=!1,S=mt(e,t,()=>M=!0,()=>m=!0),w=" ";if(u||b||v){if(w=b?`\n`:"",v){let L=h(v);w+=`\n${Pe(L,t.indent)}`}S===""&&!t.inFlow?w===`\n`&&(w=`\n\n`):w+=`\n${t.indent}`}else if(!d&&W(e)){let L=S[0],N=S.indexOf(`\n`),x=N!==-1,D=(O=(A=t.inFlow)!=null?A:e.flow)!=null?O:e.items.length===0;if(x||!D){let I=!1;if(x&&(L==="&"||L==="!")){let E=S.indexOf(" ");L==="&"&&E!==-1&&E<N&&S[E+1]==="!"&&(E=S.indexOf(" ",E+1)),(E===-1||N<E)&&(I=!0)}I||(w=`\n${t.indent}`)}}else(S===""||S[0]===`\n`)&&(w="");return g+=w+S,t.inFlow?M&&i&&i():C&&!M?g+=$e(g,t.indent,h(C)):m&&n&&n(),g}function En(s,e){(s==="debug"||s==="warn")&&(typeof process!="undefined"&&process.emitWarning?process.emitWarning(e):console.warn(e))}var jh="<<";function Dn(s,e,{key:t,value:i}){if(s!=null&&s.doc.schema.merge&&Xu(t))if(i=Ne(i)?i.resolve(s.doc):i,De(i))for(let n of i.items)zo(s,e,n);else if(Array.isArray(i))for(let n of i)zo(s,e,n);else zo(s,e,i);else{let n=se(t,"",s);if(e instanceof Map)e.set(n,se(i,n,s));else if(e instanceof Set)e.add(n);else{let r=Qu(t,n,s),o=se(i,r,s);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}var Xu=s=>s===jh||$(s)&&s.value===jh&&(!s.type||s.type===P.PLAIN);function zo(s,e,t){let i=s&&Ne(t)?t.resolve(s.doc):t;if(!Ee(i))throw new Error("Merge sources must be maps or map aliases");let n=i.toJSON(null,s,Map);for(let[r,o]of n)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function Qu(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(_(s)&&(t!=null&&t.doc)){let i=Nn(t.doc,{});i.anchors=new Set;for(let r of t.anchors.keys())i.anchors.add(r.anchor);i.inFlow=!0,i.inStringifyKey=!0;let n=s.toString(i);if(!t.mapKeyWarned){let r=JSON.stringify(n);r.length>40&&(r=r.substring(0,36)+\'..."\'),En(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return n}return JSON.stringify(e)}function bi(s,e,t){let i=dt(s,void 0,t),n=dt(e,void 0,t);return new J(i,n)}var J=class s{constructor(e,t=null){Object.defineProperty(this,ue,{value:Ho}),this.key=e,this.value=t}clone(e){let{key:t,value:i}=this;return _(t)&&(t=t.clone(e)),_(i)&&(i=i.clone(e)),new s(t,i)}toJSON(e,t){let i=t!=null&&t.mapAsMap?new Map:{};return Dn(t,i,this)}toString(e,t,i){return e!=null&&e.doc?qh(this,e,t,i):JSON.stringify(this)}};function Pn(s,e,t){var r;return(((r=e.inFlow)!=null?r:s.flow)?ed:Zu)(s,e,t)}function Zu({comment:s,items:e},t,{blockItemPrefix:i,flowChars:n,itemIndent:r,onChompKeep:o,onComment:l}){let{indent:a,options:{commentString:h}}=t,f=Object.assign({},t,{indent:r,type:null}),c=!1,u=[];for(let p=0;p<e.length;++p){let m=e[p],g=null;if(_(m))!c&&m.spaceBefore&&u.push(""),Ln(t,u,m.commentBefore,c),m.comment&&(g=m.comment);else if(H(m)){let v=_(m.key)?m.key:null;v&&(!c&&v.spaceBefore&&u.push(""),Ln(t,u,v.commentBefore,c))}c=!1;let b=mt(m,f,()=>g=null,()=>c=!0);g&&(b+=$e(b,r,h(g))),c&&g&&(c=!1),u.push(i+b)}let d;if(u.length===0)d=n.start+n.end;else{d=u[0];for(let p=1;p<u.length;++p){let m=u[p];d+=m?`\n${a}${m}`:`\n`}}return s?(d+=`\n`+Pe(h(s),a),l&&l()):c&&o&&o(),d}function ed({comment:s,items:e},t,{flowChars:i,itemIndent:n,onComment:r}){let{indent:o,indentStep:l,flowCollectionPadding:a,options:{commentString:h}}=t;n+=l;let f=Object.assign({},t,{indent:n,inFlow:!0,type:null}),c=!1,u=0,d=[];for(let b=0;b<e.length;++b){let v=e[b],C=null;if(_(v))v.spaceBefore&&d.push(""),Ln(t,d,v.commentBefore,!1),v.comment&&(C=v.comment);else if(H(v)){let S=_(v.key)?v.key:null;S&&(S.spaceBefore&&d.push(""),Ln(t,d,S.commentBefore,!1),S.comment&&(c=!0));let w=_(v.value)?v.value:null;w?(w.comment&&(C=w.comment),w.commentBefore&&(c=!0)):v.value==null&&(S!=null&&S.comment)&&(C=S.comment)}C&&(c=!0);let M=mt(v,f,()=>C=null);b<e.length-1&&(M+=","),C&&(M+=$e(M,n,h(C))),!c&&(d.length>u||M.includes(`\n`))&&(c=!0),d.push(M),u=d.length}let p,{start:m,end:g}=i;if(d.length===0)p=m+g;else{if(!c){let b=d.reduce((v,C)=>v+C.length+2,2);c=t.options.lineWidth>0&&b>t.options.lineWidth}if(c){p=m;for(let b of d)p+=b?`\n${l}${o}${b}`:`\n`;p+=`\n${o}${g}`}else p=`${m}${a}${d.join(" ")}${a}${g}`}return s&&(p+=$e(p,o,h(s)),r&&r()),p}function Ln({indent:s,options:{commentString:e}},t,i,n){if(i&&n&&(i=i.replace(/^\\n+/,"")),i){let r=Pe(e(i),s);t.push(r.trimStart())}}function Tt(s,e){let t=$(e)?e.value:e;for(let i of s)if(H(i)&&(i.key===e||i.key===t||$(i.key)&&i.key.value===t))return i}var X=class extends jt{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Fe,e),this.items=[]}static from(e,t,i){let{keepUndefined:n,replacer:r}=i,o=new this(e),l=(a,h)=>{if(typeof r=="function")h=r.call(t,a,h);else if(Array.isArray(r)&&!r.includes(a))return;(h!==void 0||n)&&o.items.push(bi(a,h,i))};if(t instanceof Map)for(let[a,h]of t)l(a,h);else if(t&&typeof t=="object")for(let a of Object.keys(t))l(a,t[a]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){var o;let i;H(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new J(e,e==null?void 0:e.value):i=new J(e.key,e.value);let n=Tt(this.items,i.key),r=(o=this.schema)==null?void 0:o.sortMapEntries;if(n){if(!t)throw new Error(`Key ${i.key} already set`);$(n.value)&&An(i.value)?n.value.value=i.value:n.value=i.value}else if(r){let l=this.items.findIndex(a=>r(i,a)<0);l===-1?this.items.push(i):this.items.splice(l,0,i)}else this.items.push(i)}delete(e){let t=Tt(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){var r;let i=Tt(this.items,e),n=i==null?void 0:i.value;return(r=!t&&$(n)?n.value:n)!=null?r:void 0}has(e){return!!Tt(this.items,e)}set(e,t){this.add(new J(e,t),!0)}toJSON(e,t,i){let n=i?new i:t!=null&&t.mapAsMap?new Map:{};t!=null&&t.onCreate&&t.onCreate(n);for(let r of this.items)Dn(t,n,r);return n}toString(e,t,i){if(!e)return JSON.stringify(this);for(let n of this.items)if(!H(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Pn(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:t})}};var Ve={collection:"map",default:!0,nodeClass:X,tag:"tag:yaml.org,2002:map",resolve(s,e){return Ee(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,t)=>X.from(s,e,t)};var oe=class extends jt{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(ut,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Bn(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let i=Bn(e);if(typeof i!="number")return;let n=this.items[i];return!t&&$(n)?n.value:n}has(e){let t=Bn(e);return typeof t=="number"&&t<this.items.length}set(e,t){let i=Bn(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);let n=this.items[i];$(n)&&An(t)?n.value=t:this.items[i]=t}toJSON(e,t){let i=[];t!=null&&t.onCreate&&t.onCreate(i);let n=0;for(let r of this.items)i.push(se(r,String(n++),t));return i}toString(e,t,i){return e?Pn(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:i,onComment:t}):JSON.stringify(this)}static from(e,t,i){let{replacer:n}=i,r=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let l of t){if(typeof n=="function"){let a=t instanceof Set?l:String(o++);l=n.call(t,a,l)}r.items.push(dt(l,void 0,i))}}return r}};function Bn(s){let e=$(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}var He={collection:"seq",default:!0,nodeClass:oe,tag:"tag:yaml.org,2002:seq",resolve(s,e){return De(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,t)=>oe.from(s,e,t)};var Nt={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,i){return e=Object.assign({actualString:!0},e),pt(s,e,t,i)}};var zt={identify:s=>s==null,createNode:()=>new P(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new P(null),stringify:({source:s},e)=>typeof s=="string"&&zt.test.test(s)?s:e.options.nullStr};var ls={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new P(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&ls.test.test(s)){let i=s[0]==="t"||s[0]==="T";if(e===i)return s}return e?t.options.trueStr:t.options.falseStr}};function fe({format:s,minFractionDigits:e,tag:t,value:i}){if(typeof i=="bigint")return String(i);let n=typeof i=="number"?i:Number(i);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let r=JSON.stringify(i);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let l=e-(r.length-o-1);for(;l-- >0;)r+="0"}return r}var In={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\\.(?:inf|Inf|INF|nan|NaN|NAN))$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:fe},Rn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\\.[0-9]+|[0-9]+(?:\\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():fe(s)}},Fn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\\.[0-9]+|[0-9]+\\.[0-9]*)$/,resolve(s){let e=new P(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:fe};var $n=s=>typeof s=="bigint"||Number.isInteger(s),Uo=(s,e,t,{intAsBigInt:i})=>i?BigInt(s):parseInt(s.substring(e),t);function zh(s,e,t){let{value:i}=s;return $n(i)&&i>=0?t+i.toString(e):fe(s)}var Vn={identify:s=>$n(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>Uo(s,2,8,t),stringify:s=>zh(s,8,"0o")},Hn={identify:$n,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>Uo(s,0,10,t),stringify:fe},_n={identify:s=>$n(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>Uo(s,2,16,t),stringify:s=>zh(s,16,"0x")};var Uh=[Ve,He,Nt,zt,ls,Vn,Hn,_n,In,Rn,Fn];function Gh(s){return typeof s=="bigint"||Number.isInteger(s)}var Wn=({value:s})=>JSON.stringify(s),td=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:Wn},{identify:s=>s==null,createNode:()=>new P(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Wn},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true|false$/,resolve:s=>s==="true",stringify:Wn},{identify:Gh,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>Gh(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:Wn}],id={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},Jh=[Ve,He].concat(td,id);var as={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof Buffer=="function")return Buffer.from(s,"base64");if(typeof atob=="function"){let t=atob(s.replace(/[\\n\\r]/g,"")),i=new Uint8Array(t.length);for(let n=0;n<t.length;++n)i[n]=t.charCodeAt(n);return i}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:e,value:t},i,n,r){let o=t,l;if(typeof Buffer=="function")l=o instanceof Buffer?o.toString("base64"):Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let a="";for(let h=0;h<o.length;++h)a+=String.fromCharCode(o[h]);l=btoa(a)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e||(e=P.BLOCK_LITERAL),e!==P.QUOTE_DOUBLE){let a=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),h=Math.ceil(l.length/a),f=new Array(h);for(let c=0,u=0;c<h;++c,u+=a)f[c]=l.substr(u,a);l=f.join(e===P.BLOCK_LITERAL?`\n`:" ")}return pt({comment:s,type:e,value:l},i,n,r)}};function Go(s,e){var t;if(De(s))for(let i=0;i<s.items.length;++i){let n=s.items[i];if(!H(n)){if(Ee(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let r=n.items[0]||new J(new P(null));if(n.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${n.commentBefore}\n${r.key.commentBefore}`:n.commentBefore),n.comment){let o=(t=r.value)!=null?t:r.key;o.comment=o.comment?`${n.comment}\n${o.comment}`:n.comment}n=r}s.items[i]=H(n)?n:new J(n)}}else e("Expected a sequence for this tag");return s}function Jo(s,e,t){let{replacer:i}=t,n=new oe(s);n.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof i=="function"&&(o=i.call(e,String(r++),o));let l,a;if(Array.isArray(o))if(o.length===2)l=o[0],a=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let h=Object.keys(o);if(h.length===1)l=h[0],a=o[l];else throw new TypeError(`Expected tuple with one key, not ${h.length} keys`)}else l=o;n.items.push(bi(l,a,t))}return n}var hs={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Go,createNode:Jo};var wi=class s extends oe{constructor(){super(),this.add=X.prototype.add.bind(this),this.delete=X.prototype.delete.bind(this),this.get=X.prototype.get.bind(this),this.has=X.prototype.has.bind(this),this.set=X.prototype.set.bind(this),this.tag=s.tag}toJSON(e,t){if(!t)return super.toJSON(e);let i=new Map;t!=null&&t.onCreate&&t.onCreate(i);for(let n of this.items){let r,o;if(H(n)?(r=se(n.key,"",t),o=se(n.value,r,t)):r=se(n,"",t),i.has(r))throw new Error("Ordered maps must not include duplicate keys");i.set(r,o)}return i}static from(e,t,i){let n=Jo(e,t,i),r=new this;return r.items=n.items,r}};wi.tag="tag:yaml.org,2002:omap";var fs={collection:"seq",identify:s=>s instanceof Map,nodeClass:wi,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){let t=Go(s,e),i=[];for(let{key:n}of t.items)$(n)&&(i.includes(n.value)?e(`Ordered maps must not include duplicate keys: ${n.value}`):i.push(n.value));return Object.assign(new wi,t)},createNode:(s,e,t)=>wi.from(s,e,t)};function Yh({value:s,source:e},t){return e&&(s?Yo:Xo).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}var Yo={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new P(!0),stringify:Yh},Xo={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,resolve:()=>new P(!1),stringify:Yh};var Xh={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?\\.(?:inf|Inf|INF|nan|NaN|NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:fe},Qh={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():fe(s)}},Zh={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\\.[0-9_]*$/,resolve(s){let e=new P(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){let i=s.substring(t+1).replace(/_/g,"");i[i.length-1]==="0"&&(e.minFractionDigits=i.length)}return e},stringify:fe};var cs=s=>typeof s=="bigint"||Number.isInteger(s);function Kn(s,e,t,{intAsBigInt:i}){let n=s[0];if((n==="-"||n==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),i){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}let o=BigInt(s);return n==="-"?BigInt(-1)*o:o}let r=parseInt(s,t);return n==="-"?-1*r:r}function Qo(s,e,t){let{value:i}=s;if(cs(i)){let n=i.toString(e);return i<0?"-"+t+n.substr(1):t+n}return fe(s)}var ef={identify:cs,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>Kn(s,2,2,t),stringify:s=>Qo(s,2,"0b")},tf={identify:cs,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>Kn(s,1,8,t),stringify:s=>Qo(s,8,"0")},sf={identify:cs,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>Kn(s,0,10,t),stringify:fe},nf={identify:cs,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>Kn(s,2,16,t),stringify:s=>Qo(s,16,"0x")};var ki=class s extends X{constructor(e){super(e),this.tag=s.tag}add(e){let t;H(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new J(e.key,null):t=new J(e,null),Tt(this.items,t.key)||this.items.push(t)}get(e,t){let i=Tt(this.items,e);return!t&&H(i)?$(i.key)?i.key.value:i.key:i}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let i=Tt(this.items,e);i&&!t?this.items.splice(this.items.indexOf(i),1):!i&&t&&this.items.push(new J(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,i){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,i);throw new Error("Set items must all have null values")}static from(e,t,i){let{replacer:n}=i,r=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof n=="function"&&(o=n.call(t,o,o)),r.items.push(bi(o,null,i));return r}};ki.tag="tag:yaml.org,2002:set";var us={collection:"map",identify:s=>s instanceof Set,nodeClass:ki,default:!1,tag:"tag:yaml.org,2002:set",createNode:(s,e,t)=>ki.from(s,e,t),resolve(s,e){if(Ee(s)){if(s.hasAllNullValues(!0))return Object.assign(new ki,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s}};function Zo(s,e){let t=s[0],i=t==="-"||t==="+"?s.substring(1):s,n=o=>e?BigInt(o):Number(o),r=i.replace(/_/g,"").split(":").reduce((o,l)=>o*n(60)+n(l),n(0));return t==="-"?n(-1)*r:r}function rf(s){let{value:e}=s,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return fe(s);let i="";e<0&&(i="-",e*=t(-1));let n=t(60),r=[e%n];return e<60?r.unshift(0):(e=(e-r[0])/n,r.unshift(e%n),e>=60&&(e=(e-r[0])/n,r.unshift(e))),i+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\\d*$/,"")}var qn={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>Zo(s,t),stringify:rf},jn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*$/,resolve:s=>Zo(s,!1),stringify:rf},Si={identify:s=>s instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\\\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\\\.[0-9]+)?)(?:[ \\\\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(s){let e=s.match(Si.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,i,n,r,o,l]=e.map(Number),a=e[7]?Number((e[7]+"00").substr(1,3)):0,h=Date.UTC(t,i-1,n,r||0,o||0,l||0,a),f=e[8];if(f&&f!=="Z"){let c=Zo(f,!1);Math.abs(c)<30&&(c*=60),h-=6e4*c}return new Date(h)},stringify:({value:s})=>s.toISOString().replace(/((T00:00)?:00)?\\.000Z$/,"")};var el=[Ve,He,Nt,zt,Yo,Xo,ef,tf,sf,nf,Xh,Qh,Zh,as,fs,hs,us,qn,jn,Si];var of=new Map([["core",Uh],["failsafe",[Ve,He,Nt]],["json",Jh],["yaml11",el],["yaml-1.1",el]]),lf={binary:as,bool:ls,float:Fn,floatExp:Rn,floatNaN:In,floatTime:jn,int:Hn,intHex:_n,intOct:Vn,intTime:qn,map:Ve,null:zt,omap:fs,pairs:hs,seq:He,set:us,timestamp:Si},af={"tag:yaml.org,2002:binary":as,"tag:yaml.org,2002:omap":fs,"tag:yaml.org,2002:pairs":hs,"tag:yaml.org,2002:set":us,"tag:yaml.org,2002:timestamp":Si};function zn(s,e){let t=of.get(e);if(!t)if(Array.isArray(s))t=[];else{let i=Array.from(of.keys()).filter(n=>n!=="yaml11").map(n=>JSON.stringify(n)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${i} or define customTags array`)}if(Array.isArray(s))for(let i of s)t=t.concat(i);else typeof s=="function"&&(t=s(t.slice()));return t.map(i=>{if(typeof i!="string")return i;let n=lf[i];if(n)return n;let r=Object.keys(lf).map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown custom tag "${i}"; use one of ${r}`)})}var sd=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0,vi=class s{constructor({compat:e,customTags:t,merge:i,resolveKnownTags:n,schema:r,sortMapEntries:o,toStringDefaults:l}){this.compat=Array.isArray(e)?zn(e,"compat"):e?zn(null,e):null,this.merge=!!i,this.name=typeof r=="string"&&r||"core",this.knownTags=n?af:{},this.tags=zn(t,this.name),this.toStringOptions=l!=null?l:null,Object.defineProperty(this,Fe,{value:Ve}),Object.defineProperty(this,Te,{value:Nt}),Object.defineProperty(this,ut,{value:He}),this.sortMapEntries=typeof o=="function"?o:o===!0?sd:null}clone(){let e=Object.create(s.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};function hf(s,e){var a;let t=[],i=e.directives===!0;if(e.directives!==!1&&s.directives){let h=s.directives.toString(s);h?(t.push(h),i=!0):s.directives.docStart&&(i=!0)}i&&t.push("---");let n=Nn(s,e),{commentString:r}=n.options;if(s.commentBefore){t.length!==1&&t.unshift("");let h=r(s.commentBefore);t.unshift(Pe(h,""))}let o=!1,l=null;if(s.contents){if(_(s.contents)){if(s.contents.spaceBefore&&i&&t.push(""),s.contents.commentBefore){let c=r(s.contents.commentBefore);t.push(Pe(c,""))}n.forceBlockIndent=!!s.comment,l=s.contents.comment}let h=l?void 0:()=>o=!0,f=mt(s.contents,n,()=>l=null,h);l&&(f+=$e(f,"",r(l))),(f[0]==="|"||f[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${f}`:t.push(f)}else t.push(mt(s.contents,n));if((a=s.directives)!=null&&a.docEnd)if(s.comment){let h=r(s.comment);h.includes(`\n`)?(t.push("..."),t.push(Pe(h,""))):t.push(`... ${h}`)}else t.push("...");else{let h=s.comment;h&&o&&(h=h.replace(/^\\n+/,"")),h&&((!o||l)&&t[t.length-1]!==""&&t.push(""),t.push(Pe(r(h),"")))}return t.join(`\n`)+`\n`}var et=class s{constructor(e,t,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ue,{value:Sn});let n=null;typeof t=="function"||Array.isArray(t)?n=t:i===void 0&&t&&(i=t,t=void 0);let r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,uniqueKeys:!0,version:"1.2"},i);this.options=r;let{version:o}=r;i!=null&&i._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Qe({version:o}),this.setSchema(o,i),this.contents=e===void 0?null:this.createNode(e,n,i)}clone(){let e=Object.create(s.prototype,{[ue]:{value:Sn}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=_(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){xi(this.contents)&&this.contents.add(e)}addIn(e,t){xi(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let i=_o(this);e.anchor=!t||i.has(t)?Wo(t||"a",i):t}return new Ze(e.anchor)}createNode(e,t,i){let n;if(typeof t=="function")e=t.call({"":e},"",e),n=t;else if(Array.isArray(t)){let g=v=>typeof v=="number"||v instanceof String||v instanceof Number,b=t.filter(g).map(String);b.length>0&&(t=t.concat(b)),n=t}else i===void 0&&t&&(i=t,t=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:l,keepUndefined:a,onTagObj:h,tag:f}=i!=null?i:{},{onAnchor:c,setAnchors:u,sourceObjects:d}=_h(this,o||"a"),p={aliasDuplicateObjects:r!=null?r:!0,keepUndefined:a!=null?a:!1,onAnchor:c,onTagObj:h,replacer:n,schema:this.schema,sourceObjects:d},m=dt(e,f,p);return l&&W(m)&&(m.flow=!0),u(),m}createPair(e,t,i={}){let n=this.createNode(e,null,i),r=this.createNode(t,null,i);return new J(n,r)}delete(e){return xi(this.contents)?this.contents.delete(e):!1}deleteIn(e){return gi(e)?this.contents==null?!1:(this.contents=null,!0):xi(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return W(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return gi(e)?!t&&$(this.contents)?this.contents.value:this.contents:W(this.contents)?this.contents.getIn(e,t):void 0}has(e){return W(this.contents)?this.contents.has(e):!1}hasIn(e){return gi(e)?this.contents!==void 0:W(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=ss(this.schema,[e],t):xi(this.contents)&&this.contents.set(e,t)}setIn(e,t){gi(e)?this.contents=t:this.contents==null?this.contents=ss(this.schema,Array.from(e),t):xi(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let i;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Qe({version:"1.1"}),i={merge:!0,resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Qe({version:e}),i={merge:!1,resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let n=JSON.stringify(e);throw new Error(`Expected \'1.1\', \'1.2\' or null as first argument, but found: ${n}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(i)this.schema=new vi(Object.assign(i,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:i,maxAliasCount:n,onAnchor:r,reviver:o}={}){let l={anchors:new Map,doc:this,keep:!e,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=se(this.contents,t!=null?t:"",l);if(typeof r=="function")for(let{count:h,res:f}of l.anchors.values())r(f,h);return typeof o=="function"?Mt(o,{"":a},"",a):a}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return hf(this,e)}};function xi(s){if(W(s))return!0;throw new Error("Expected a YAML collection as document contents")}var Ai=class extends Error{constructor(e,t,i,n){super(),this.name=e,this.code=i,this.message=n,this.pos=t}},ve=class extends Ai{constructor(e,t,i){super("YAMLParseError",e,t,i)}},Ci=class extends Ai{constructor(e,t,i){super("YAMLWarning",e,t,i)}},ds=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(l=>e.linePos(l));let{line:i,col:n}=t.linePos[0];t.message+=` at line ${i}, column ${n}`;let r=n-1,o=s.substring(e.lineStarts[i-1],e.lineStarts[i]).replace(/[\\n\\r]+$/,"");if(r>=60&&o.length>80){let l=Math.min(r-39,o.length-79);o="\\u2026"+o.substring(l),r-=l-1}if(o.length>80&&(o=o.substring(0,79)+"\\u2026"),i>1&&/^ *$/.test(o.substring(0,r))){let l=s.substring(e.lineStarts[i-2],e.lineStarts[i-1]);l.length>80&&(l=l.substring(0,79)+`\\u2026\n`),o=l+o}if(/[^ ]/.test(o)){let l=1,a=t.linePos[1];a&&a.line===i&&a.col>n&&(l=Math.max(1,Math.min(a.col-n,80-r)));let h=" ".repeat(r)+"^".repeat(l);t.message+=`:\n\n${o}\n${h}\n`}};function tt(s,{flow:e,indicator:t,next:i,offset:n,onError:r,startOnNewline:o}){let l=!1,a=o,h=o,f="",c="",u=!1,d=!1,p=!1,m=null,g=null,b=null,v=null,C=null;for(let w of s)switch(p&&(w.type!=="space"&&w.type!=="newline"&&w.type!=="comma"&&r(w.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p=!1),w.type){case"space":!e&&a&&t!=="doc-start"&&w.source[0]===" "&&r(w,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=!0;break;case"comment":{h||r(w,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let A=w.source.substring(1)||" ";f?f+=c+A:f=A,c="",a=!1;break}case"newline":a?f?f+=w.source:l=!0:c+=w.source,a=!0,u=!0,(m||g)&&(d=!0),h=!0;break;case"anchor":m&&r(w,"MULTIPLE_ANCHORS","A node can have at most one anchor"),w.source.endsWith(":")&&r(w.offset+w.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=w,C===null&&(C=w.offset),a=!1,h=!1,p=!0;break;case"tag":{g&&r(w,"MULTIPLE_TAGS","A node can have at most one tag"),g=w,C===null&&(C=w.offset),a=!1,h=!1,p=!0;break}case t:(m||g)&&r(w,"BAD_PROP_ORDER",`Anchors and tags must be after the ${w.source} indicator`),v&&r(w,"UNEXPECTED_TOKEN",`Unexpected ${w.source} in ${e!=null?e:"collection"}`),v=w,a=!1,h=!1;break;case"comma":if(e){b&&r(w,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=w,a=!1,h=!1;break}default:r(w,"UNEXPECTED_TOKEN",`Unexpected ${w.type} token`),a=!1,h=!1}let M=s[s.length-1],S=M?M.offset+M.source.length:n;return p&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&r(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),{comma:b,found:v,spaceBefore:l,comment:f,hasNewline:u,hasNewlineAfterProp:d,anchor:m,tag:g,end:S,start:C!=null?C:S}}function Et(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(`\n`))return!0;if(s.end){for(let e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of s.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(Et(e.key)||Et(e.value))return!0}return!1;default:return!0}}function ps(s,e,t){if((e==null?void 0:e.type)==="flow-collection"){let i=e.end[0];i.indent===s&&(i.source==="]"||i.source==="}")&&Et(e)&&t(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function Un(s,e,t){let{uniqueKeys:i}=s.options;if(i===!1)return!1;let n=typeof i=="function"?i:(r,o)=>r===o||$(r)&&$(o)&&r.value===o.value&&!(r.value==="<<"&&s.schema.merge);return e.some(r=>n(r.key,t))}var ff="All mapping items must start at the same column";function cf({composeNode:s,composeEmptyNode:e},t,i,n,r){var f,c;let o=(f=r==null?void 0:r.nodeClass)!=null?f:X,l=new o(t.schema);t.atRoot&&(t.atRoot=!1);let a=i.offset,h=null;for(let u of i.items){let{start:d,key:p,sep:m,value:g}=u,b=tt(d,{indicator:"explicit-key-ind",next:p!=null?p:m==null?void 0:m[0],offset:a,onError:n,startOnNewline:!0}),v=!b.found;if(v){if(p&&(p.type==="block-seq"?n(a,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==i.indent&&n(a,"BAD_INDENT",ff)),!b.anchor&&!b.tag&&!m){h=b.end,b.comment&&(l.comment?l.comment+=`\n`+b.comment:l.comment=b.comment);continue}(b.hasNewlineAfterProp||Et(p))&&n(p!=null?p:d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((c=b.found)==null?void 0:c.indent)!==i.indent&&n(a,"BAD_INDENT",ff);let C=b.end,M=p?s(t,p,b,n):e(t,C,d,null,b,n);t.schema.compat&&ps(i.indent,p,n),Un(t,l.items,M)&&n(C,"DUPLICATE_KEY","Map keys must be unique");let S=tt(m!=null?m:[],{indicator:"map-value-ind",next:g,offset:M.range[2],onError:n,startOnNewline:!p||p.type==="block-scalar"});if(a=S.end,S.found){v&&((g==null?void 0:g.type)==="block-map"&&!S.hasNewline&&n(a,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&b.start<S.found.offset-1024&&n(M.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let w=g?s(t,g,S,n):e(t,a,m,null,S,n);t.schema.compat&&ps(i.indent,g,n),a=w.range[2];let A=new J(M,w);t.options.keepSourceTokens&&(A.srcToken=u),l.items.push(A)}else{v&&n(M.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(M.comment?M.comment+=`\n`+S.comment:M.comment=S.comment);let w=new J(M);t.options.keepSourceTokens&&(w.srcToken=u),l.items.push(w)}}return h&&h<a&&n(h,"IMPOSSIBLE","Map comment with trailing content"),l.range=[i.offset,a,h!=null?h:a],l}function uf({composeNode:s,composeEmptyNode:e},t,i,n,r){var f;let o=(f=r==null?void 0:r.nodeClass)!=null?f:oe,l=new o(t.schema);t.atRoot&&(t.atRoot=!1);let a=i.offset,h=null;for(let{start:c,value:u}of i.items){let d=tt(c,{indicator:"seq-item-ind",next:u,offset:a,onError:n,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||u)u&&u.type==="block-seq"?n(d.end,"BAD_INDENT","All sequence items must start at the same column"):n(a,"MISSING_CHAR","Sequence item without - indicator");else{h=d.end,d.comment&&(l.comment=d.comment);continue}let p=u?s(t,u,d,n):e(t,d.end,c,null,d,n);t.schema.compat&&ps(i.indent,u,n),a=p.range[2],l.items.push(p)}return l.range=[i.offset,a,h!=null?h:a],l}function it(s,e,t,i){let n="";if(s){let r=!1,o="";for(let l of s){let{source:a,type:h}=l;switch(h){case"space":r=!0;break;case"comment":{t&&!r&&i(l,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=a.substring(1)||" ";n?n+=o+f:n=f,o="";break}case"newline":n&&(o+=a),r=!0;break;default:i(l,"UNEXPECTED_TOKEN",`Unexpected ${h} at node end`)}e+=a.length}}return{comment:n,offset:e}}var tl="Block collections are not allowed within flow collections",il=s=>s&&(s.type==="block-map"||s.type==="block-seq");function df({composeNode:s,composeEmptyNode:e},t,i,n,r){var g,b;let o=i.start.source==="{",l=o?"flow map":"flow sequence",a=(g=r==null?void 0:r.nodeClass)!=null?g:o?X:oe,h=new a(t.schema);h.flow=!0;let f=t.atRoot;f&&(t.atRoot=!1);let c=i.offset+i.start.source.length;for(let v=0;v<i.items.length;++v){let C=i.items[v],{start:M,key:S,sep:w,value:A}=C,O=tt(M,{flow:l,indicator:"explicit-key-ind",next:S!=null?S:w==null?void 0:w[0],offset:c,onError:n,startOnNewline:!1});if(!O.found){if(!O.anchor&&!O.tag&&!w&&!A){v===0&&O.comma?n(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${l}`):v<i.items.length-1&&n(O.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${l}`),O.comment&&(h.comment?h.comment+=`\n`+O.comment:h.comment=O.comment),c=O.end;continue}!o&&t.options.strict&&Et(S)&&n(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(v===0)O.comma&&n(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${l}`);else if(O.comma||n(O.start,"MISSING_CHAR",`Missing , between ${l} items`),O.comment){let L="";e:for(let N of M)switch(N.type){case"comma":case"space":break;case"comment":L=N.source.substring(1);break e;default:break e}if(L){let N=h.items[h.items.length-1];H(N)&&(N=(b=N.value)!=null?b:N.key),N.comment?N.comment+=`\n`+L:N.comment=L,O.comment=O.comment.substring(L.length+1)}}if(!o&&!w&&!O.found){let L=A?s(t,A,O,n):e(t,O.end,w,null,O,n);h.items.push(L),c=L.range[2],il(A)&&n(L.range,"BLOCK_IN_FLOW",tl)}else{let L=O.end,N=S?s(t,S,O,n):e(t,L,M,null,O,n);il(S)&&n(N.range,"BLOCK_IN_FLOW",tl);let x=tt(w!=null?w:[],{flow:l,indicator:"map-value-ind",next:A,offset:N.range[2],onError:n,startOnNewline:!1});if(x.found){if(!o&&!O.found&&t.options.strict){if(w)for(let E of w){if(E===x.found)break;if(E.type==="newline"){n(E,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}O.start<x.found.offset-1024&&n(x.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else A&&("source"in A&&A.source&&A.source[0]===":"?n(A,"MISSING_CHAR",`Missing space after : in ${l}`):n(x.start,"MISSING_CHAR",`Missing , or : between ${l} items`));let D=A?s(t,A,x,n):x.found?e(t,x.end,w,null,x,n):null;D?il(A)&&n(D.range,"BLOCK_IN_FLOW",tl):x.comment&&(N.comment?N.comment+=`\n`+x.comment:N.comment=x.comment);let I=new J(N,D);if(t.options.keepSourceTokens&&(I.srcToken=C),o){let E=h;Un(t,E.items,N)&&n(L,"DUPLICATE_KEY","Map keys must be unique"),E.items.push(I)}else{let E=new X(t.schema);E.flow=!0,E.items.push(I),h.items.push(E)}c=D?D.range[2]:x.end}}let u=o?"}":"]",[d,...p]=i.end,m=c;if(d&&d.source===u)m=d.offset+d.source.length;else{let v=l[0].toUpperCase()+l.substring(1),C=f?`${v} must end with a ${u}`:`${v} in block collection must be sufficiently indented and end with a ${u}`;n(c,f?"MISSING_CHAR":"BAD_INDENT",C),d&&d.source.length!==1&&p.unshift(d)}if(p.length>0){let v=it(p,m,t.options.strict,n);v.comment&&(h.comment?h.comment+=`\n`+v.comment:h.comment=v.comment),h.range=[i.offset,m,v.offset]}else h.range=[i.offset,m,m];return h}function sl(s,e,t,i,n,r){let o=t.type==="block-map"?cf(s,e,t,i,r):t.type==="block-seq"?uf(s,e,t,i,r):df(s,e,t,i,r),l=o.constructor;return n==="!"||n===l.tagName?(o.tag=l.tagName,o):(n&&(o.tag=n),o)}function pf(s,e,t,i,n){var c,u;let r=i?e.directives.tagName(i.source,d=>n(i,"TAG_RESOLVE_FAILED",d)):null,o=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!i||!r||r==="!"||r===X.tagName&&o==="map"||r===oe.tagName&&o==="seq"||!o)return sl(s,e,t,n,r);let l=e.schema.tags.find(d=>d.tag===r&&d.collection===o);if(!l){let d=e.schema.knownTags[r];if(d&&d.collection===o)e.schema.tags.push(Object.assign({},d,{default:!1})),l=d;else return d!=null&&d.collection?n(i,"BAD_COLLECTION_TYPE",`${d.tag} used for ${o} collection, but expects ${d.collection}`,!0):n(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,!0),sl(s,e,t,n,r)}let a=sl(s,e,t,n,r,l),h=(u=(c=l.resolve)==null?void 0:c.call(l,a,d=>n(i,"TAG_RESOLVE_FAILED",d),e.options))!=null?u:a,f=_(h)?h:new P(h);return f.range=a.range,f.tag=r,l!=null&&l.format&&(f.format=l.format),f}function Gn(s,e,t){let i=s.offset,n=nd(s,e,t);if(!n)return{value:"",type:null,comment:"",range:[i,i,i]};let r=n.mode===">"?P.BLOCK_FOLDED:P.BLOCK_LITERAL,o=s.source?rd(s.source):[],l=o.length;for(let m=o.length-1;m>=0;--m){let g=o[m][1];if(g===""||g==="\\r")l=m;else break}if(l===0){let m=n.chomp==="+"&&o.length>0?`\n`.repeat(Math.max(1,o.length-1)):"",g=i+n.length;return s.source&&(g+=s.source.length),{value:m,type:r,comment:n.comment,range:[i,g,g]}}let a=s.indent+n.indent,h=s.offset+n.length,f=0;for(let m=0;m<l;++m){let[g,b]=o[m];if(b===""||b==="\\r")n.indent===0&&g.length>a&&(a=g.length);else{g.length<a&&t(h+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),n.indent===0&&(a=g.length),f=m;break}h+=g.length+b.length+1}for(let m=o.length-1;m>=l;--m)o[m][0].length>a&&(l=m+1);let c="",u="",d=!1;for(let m=0;m<f;++m)c+=o[m][0].slice(a)+`\n`;for(let m=f;m<l;++m){let[g,b]=o[m];h+=g.length+b.length+1;let v=b[b.length-1]==="\\r";if(v&&(b=b.slice(0,-1)),b&&g.length<a){let M=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;t(h-b.length-(v?2:1),"BAD_INDENT",M),g=""}r===P.BLOCK_LITERAL?(c+=u+g.slice(a)+b,u=`\n`):g.length>a||b[0]===" "?(u===" "?u=`\n`:!d&&u===`\n`&&(u=`\n\n`),c+=u+g.slice(a)+b,u=`\n`,d=!0):b===""?u===`\n`?c+=`\n`:u=`\n`:(c+=u+b,u=" ",d=!1)}switch(n.chomp){case"-":break;case"+":for(let m=l;m<o.length;++m)c+=`\n`+o[m][0].slice(a);c[c.length-1]!==`\n`&&(c+=`\n`);break;default:c+=`\n`}let p=i+n.length+s.source.length;return{value:c,type:r,comment:n.comment,range:[i,p,p]}}function nd({offset:s,props:e},t,i){if(e[0].type!=="block-scalar-header")return i(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=e[0],r=n[0],o=0,l="",a=-1;for(let u=1;u<n.length;++u){let d=n[u];if(!l&&(d==="-"||d==="+"))l=d;else{let p=Number(d);!o&&p?o=p:a===-1&&(a=s+u)}}a!==-1&&i(a,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let h=!1,f="",c=n.length;for(let u=1;u<e.length;++u){let d=e[u];switch(d.type){case"space":h=!0;case"newline":c+=d.source.length;break;case"comment":t&&!h&&i(d,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),c+=d.source.length,f=d.source.substring(1);break;case"error":i(d,"UNEXPECTED_TOKEN",d.message),c+=d.source.length;break;default:{let p=`Unexpected token in block scalar header: ${d.type}`;i(d,"UNEXPECTED_TOKEN",p);let m=d.source;m&&typeof m=="string"&&(c+=m.length)}}}return{mode:r,indent:o,chomp:l,comment:f,length:c}}function rd(s){let e=s.split(/\\n( *)/),t=e[0],i=t.match(/^( *)/),r=[i!=null&&i[1]?[i[1],t.slice(i[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}function Jn(s,e,t){let{offset:i,type:n,source:r,end:o}=s,l,a,h=(u,d,p)=>t(i+u,d,p);switch(n){case"scalar":l=P.PLAIN,a=od(r,h);break;case"single-quoted-scalar":l=P.QUOTE_SINGLE,a=ld(r,h);break;case"double-quoted-scalar":l=P.QUOTE_DOUBLE,a=ad(r,h);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[i,i+r.length,i+r.length]}}let f=i+r.length,c=it(o,f,e,t);return{value:a,type:l,comment:c.comment,range:[i,f,c.offset]}}function od(s,e){let t="";switch(s[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),mf(s)}function ld(s,e){return(s[s.length-1]!=="\'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing \'quote"),mf(s.slice(1,-1)).replace(/\'\'/g,"\'")}function mf(s){var a;let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\\r?\n`,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\\r?\n`,"sy")}catch(h){e=new RegExp("(.*?)[ \\\\t]*\\\\r?\\\\n","sy"),t=new RegExp("[ \\\\t]*(.*?)[ \\\\t]*\\\\r?\\\\n","sy")}let i=e.exec(s);if(!i)return s;let n=i[1],r=" ",o=e.lastIndex;for(t.lastIndex=o;i=t.exec(s);)i[1]===""?r===`\n`?n+=r:r=`\n`:(n+=r+i[1],r=" "),o=t.lastIndex;let l=new RegExp("[ \\\\t]*(.*)","sy");return l.lastIndex=o,i=l.exec(s),n+r+((a=i==null?void 0:i[1])!=null?a:"")}function ad(s,e){let t="";for(let i=1;i<s.length-1;++i){let n=s[i];if(!(n==="\\r"&&s[i+1]===`\n`))if(n===`\n`){let{fold:r,offset:o}=hd(s,i);t+=r,i=o}else if(n==="\\\\"){let r=s[++i],o=fd[r];if(o)t+=o;else if(r===`\n`)for(r=s[i+1];r===" "||r===" ";)r=s[++i+1];else if(r==="\\r"&&s[i+1]===`\n`)for(r=s[++i+1];r===" "||r===" ";)r=s[++i+1];else if(r==="x"||r==="u"||r==="U"){let l={x:2,u:4,U:8}[r];t+=cd(s,i+1,l,e),i+=l}else{let l=s.substr(i-1,2);e(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),t+=l}}else if(n===" "||n===" "){let r=i,o=s[i+1];for(;o===" "||o===" ";)o=s[++i+1];o!==`\n`&&!(o==="\\r"&&s[i+2]===`\n`)&&(t+=i>r?s.slice(r,i+1):n)}else t+=n}return(s[s.length-1]!==\'"\'||s.length===1)&&e(s.length,"MISSING_CHAR",\'Missing closing "quote\'),t}function hd(s,e){let t="",i=s[e+1];for(;(i===" "||i===" "||i===`\n`||i==="\\r")&&!(i==="\\r"&&s[e+2]!==`\n`);)i===`\n`&&(t+=`\n`),e+=1,i=s[e+1];return t||(t=" "),{fold:t,offset:e}}var fd={0:"\\0",a:"\\x07",b:"\\b",e:"\\x1B",f:"\\f",n:`\n`,r:"\\r",t:" ",v:"\\v",N:"\\x85",_:"\\xA0",L:"\\u2028",P:"\\u2029"," ":" ",\'"\':\'"\',"/":"/","\\\\":"\\\\"," ":" "};function cd(s,e,t,i){let n=s.substr(e,t),o=n.length===t&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;if(isNaN(o)){let l=s.substr(e-2,t+2);return i(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),l}return String.fromCodePoint(o)}function nl(s,e,t,i){let{value:n,type:r,comment:o,range:l}=e.type==="block-scalar"?Gn(e,s.options.strict,i):Jn(e,s.options.strict,i),a=t?s.directives.tagName(t.source,c=>i(t,"TAG_RESOLVE_FAILED",c)):null,h=t&&a?ud(s.schema,n,a,t,i):e.type==="scalar"?dd(s,n,e,i):s.schema[Te],f;try{let c=h.resolve(n,u=>i(t!=null?t:e,"TAG_RESOLVE_FAILED",u),s.options);f=$(c)?c:new P(c)}catch(c){let u=c instanceof Error?c.message:String(c);i(t!=null?t:e,"TAG_RESOLVE_FAILED",u),f=new P(n)}return f.range=l,f.source=n,r&&(f.type=r),a&&(f.tag=a),h.format&&(f.format=h.format),o&&(f.comment=o),f}function ud(s,e,t,i,n){var l;if(t==="!")return s[Te];let r=[];for(let a of s.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)r.push(a);else return a;for(let a of r)if((l=a.test)!=null&&l.test(e))return a;let o=s.knownTags[t];return o&&!o.collection?(s.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[Te])}function dd({directives:s,schema:e},t,i,n){var o;let r=e.tags.find(l=>{var a;return l.default&&((a=l.test)==null?void 0:a.test(t))})||e[Te];if(e.compat){let l=(o=e.compat.find(a=>{var h;return a.default&&((h=a.test)==null?void 0:h.test(t))}))!=null?o:e[Te];if(r.tag!==l.tag){let a=s.tagString(r.tag),h=s.tagString(l.tag),f=`Value may be parsed as either ${a} or ${h}`;n(i,"TAG_RESOLVE_FAILED",f,!0)}}return r}function gf(s,e,t){if(e){t===null&&(t=e.length);for(let i=t-1;i>=0;--i){let n=e[i];switch(n.type){case"space":case"comment":case"newline":s-=n.source.length;continue}for(n=e[++i];(n==null?void 0:n.type)==="space";)s+=n.source.length,n=e[++i];break}}return s}var pd={composeNode:rl,composeEmptyNode:Yn};function rl(s,e,t,i){let{spaceBefore:n,comment:r,anchor:o,tag:l}=t,a,h=!0;switch(e.type){case"alias":a=md(s,e,i),(o||l)&&i(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":a=nl(s,e,l,i),o&&(a.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":a=pf(pd,s,e,l,i),o&&(a.anchor=o.source.substring(1));break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;i(e,"UNEXPECTED_TOKEN",f),a=Yn(s,e.offset,void 0,null,t,i),h=!1}}return o&&a.anchor===""&&i(o,"BAD_ALIAS","Anchor cannot be an empty string"),n&&(a.spaceBefore=!0),r&&(e.type==="scalar"&&e.source===""?a.comment=r:a.commentBefore=r),s.options.keepSourceTokens&&h&&(a.srcToken=e),a}function Yn(s,e,t,i,{spaceBefore:n,comment:r,anchor:o,tag:l,end:a},h){let f={type:"scalar",offset:gf(e,t,i),indent:-1,source:""},c=nl(s,f,l,h);return o&&(c.anchor=o.source.substring(1),c.anchor===""&&h(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(c.spaceBefore=!0),r&&(c.comment=r,c.range[2]=a),c}function md({options:s},{offset:e,source:t,end:i},n){let r=new Ze(t.substring(1));r.source===""&&n(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&n(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+t.length,l=it(i,o,s.strict,n);return r.range=[e,o,l.offset],l.comment&&(r.comment=l.comment),r}function yf(s,e,{offset:t,start:i,value:n,end:r},o){let l=Object.assign({_directives:e},s),a=new et(void 0,l),h={atRoot:!0,directives:a.directives,options:a.options,schema:a.schema},f=tt(i,{indicator:"doc-start",next:n!=null?n:r==null?void 0:r[0],offset:t,onError:o,startOnNewline:!0});f.found&&(a.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!f.hasNewline&&o(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),a.contents=n?rl(h,n,f,o):Yn(h,f.end,i,null,f,o);let c=a.contents.range[2],u=it(r,c,!1,o);return u.comment&&(a.comment=u.comment),a.range=[t,c,u.offset],a}function ms(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];let{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function bf(s){var n;let e="",t=!1,i=!1;for(let r=0;r<s.length;++r){let o=s[r];switch(o[0]){case"#":e+=(e===""?"":i?`\n\n`:`\n`)+(o.substring(1)||" "),t=!0,i=!1;break;case"%":((n=s[r+1])==null?void 0:n[0])!=="#"&&(r+=1),t=!1;break;default:t||(i=!0),t=!1}}return{comment:e,afterEmptyLine:i}}var Ut=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,i,n,r)=>{let o=ms(t);r?this.warnings.push(new Ci(o,i,n)):this.errors.push(new ve(o,i,n))},this.directives=new Qe({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:i,afterEmptyLine:n}=bf(this.prelude);if(i){let r=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${i}`:i;else if(n||e.directives.docStart||!r)e.commentBefore=i;else if(W(r)&&!r.flow&&r.items.length>0){let o=r.items[0];H(o)&&(o=o.key);let l=o.commentBefore;o.commentBefore=l?`${i}\n${l}`:i}else{let o=r.commentBefore;r.commentBefore=o?`${i}\n${o}`:i}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:bf(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,i=-1){for(let n of e)yield*k(this.next(n));yield*k(this.end(t,i))}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,i,n)=>{let r=ms(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",i,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=yf(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,i=new ve(ms(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new ve(ms(e),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let t=it(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let i=this.doc.comment;this.doc.comment=i?`${i}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new ve(ms(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let i=Object.assign({_directives:this.directives},this.options),n=new et(void 0,i);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,t,t],this.decorate(n,!1),yield n}}};var hl={};vl(hl,{BOM:()=>gs,DOCUMENT:()=>ys,FLOW_END:()=>bs,SCALAR:()=>Mi,createScalarToken:()=>kf,isCollection:()=>bd,isScalar:()=>wd,prettyToken:()=>kd,resolveAsScalar:()=>wf,setScalarValue:()=>Sf,stringify:()=>xf,tokenType:()=>al,visit:()=>Dt});function wf(s,e=!0,t){if(s){let i=(n,r,o)=>{let l=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(t)t(l,r,o);else throw new ve([l,l+1],r,o)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Jn(s,e,i);case"block-scalar":return Gn(s,e,i)}}return null}function kf(s,e){var h;let{implicitKey:t=!1,indent:i,inFlow:n=!1,offset:r=-1,type:o="PLAIN"}=e,l=pt({type:o,value:s},{implicitKey:t,indent:i>0?" ".repeat(i):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),a=(h=e.end)!=null?h:[{type:"newline",offset:-1,indent:i,source:`\n`}];switch(l[0]){case"|":case">":{let f=l.indexOf(`\n`),c=l.substring(0,f),u=l.substring(f+1)+`\n`,d=[{type:"block-scalar-header",offset:r,indent:i,source:c}];return vf(d,a)||d.push({type:"newline",offset:-1,indent:i,source:`\n`}),{type:"block-scalar",offset:r,indent:i,props:d,source:u}}case\'"\':return{type:"double-quoted-scalar",offset:r,indent:i,source:l,end:a};case"\'":return{type:"single-quoted-scalar",offset:r,indent:i,source:l,end:a};default:return{type:"scalar",offset:r,indent:i,source:l,end:a}}}function Sf(s,e,t={}){let{afterKey:i=!1,implicitKey:n=!1,inFlow:r=!1,type:o}=t,l="indent"in s?s.indent:null;if(i&&typeof l=="number"&&(l+=2),!o)switch(s.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let h=s.props[0];if(h.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=h.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let a=pt({type:o,value:e},{implicitKey:n||l===null,indent:l!==null&&l>0?" ".repeat(l):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(a[0]){case"|":case">":gd(s,a);break;case\'"\':ol(s,a,"double-quoted-scalar");break;case"\'":ol(s,a,"single-quoted-scalar");break;default:ol(s,a,"scalar")}}function gd(s,e){let t=e.indexOf(`\n`),i=e.substring(0,t),n=e.substring(t+1)+`\n`;if(s.type==="block-scalar"){let r=s.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=i,s.source=n}else{let{offset:r}=s,o="indent"in s?s.indent:-1,l=[{type:"block-scalar-header",offset:r,indent:o,source:i}];vf(l,"end"in s?s.end:void 0)||l.push({type:"newline",offset:-1,indent:o,source:`\n`});for(let a of Object.keys(s))a!=="type"&&a!=="offset"&&delete s[a];Object.assign(s,{type:"block-scalar",indent:o,props:l,source:n})}}function vf(s,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":s.push(t);break;case"newline":return s.push(t),!0}return!1}function ol(s,e,t){switch(s.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":s.type=t,s.source=e;break;case"block-scalar":{let i=s.props.slice(1),n=e.length;s.props[0].type==="block-scalar-header"&&(n-=s.props[0].source.length);for(let r of i)r.offset+=n;delete s.props,Object.assign(s,{type:t,source:e,end:i});break}case"block-map":case"block-seq":{let n={type:"newline",offset:s.offset+e.length,indent:s.indent,source:`\n`};delete s.items,Object.assign(s,{type:t,source:e,end:[n]});break}default:{let i="indent"in s?s.indent:-1,n="end"in s&&Array.isArray(s.end)?s.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(s))r!=="type"&&r!=="offset"&&delete s[r];Object.assign(s,{type:t,indent:i,source:e,end:n})}}}var xf=s=>"type"in s?Qn(s):Xn(s);function Qn(s){switch(s.type){case"block-scalar":{let e="";for(let t of s.props)e+=Qn(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(let t of s.items)e+=Xn(t);return e}case"flow-collection":{let e=s.start.source;for(let t of s.items)e+=Xn(t);for(let t of s.end)e+=t.source;return e}case"document":{let e=Xn(s);if(s.end)for(let t of s.end)e+=t.source;return e}default:{let e=s.source;if("end"in s&&s.end)for(let t of s.end)e+=t.source;return e}}}function Xn({start:s,key:e,sep:t,value:i}){let n="";for(let r of s)n+=r.source;if(e&&(n+=Qn(e)),t)for(let r of t)n+=r.source;return i&&(n+=Qn(i)),n}var ll=Symbol("break visit"),yd=Symbol("skip children"),Af=Symbol("remove item");function Dt(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),Cf(Object.freeze([]),s,e)}Dt.BREAK=ll;Dt.SKIP=yd;Dt.REMOVE=Af;Dt.itemAtPath=(s,e)=>{let t=s;for(let[i,n]of e){let r=t==null?void 0:t[i];if(r&&"items"in r)t=r.items[n];else return}return t};Dt.parentCollection=(s,e)=>{let t=Dt.itemAtPath(s,e.slice(0,-1)),i=e[e.length-1][0],n=t==null?void 0:t[i];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function Cf(s,e,t){let i=t(e,s);if(typeof i=="symbol")return i;for(let n of["key","value"]){let r=e[n];if(r&&"items"in r){for(let o=0;o<r.items.length;++o){let l=Cf(Object.freeze(s.concat([[n,o]])),r.items[o],t);if(typeof l=="number")o=l-1;else{if(l===ll)return ll;l===Af&&(r.items.splice(o,1),o-=1)}}typeof i=="function"&&n==="key"&&(i=i(e,s))}}return typeof i=="function"?i(e,s):i}var gs="\\uFEFF",ys="",bs="",Mi="",bd=s=>!!s&&"items"in s,wd=s=>!!s&&(s.type==="scalar"||s.type==="single-quoted-scalar"||s.type==="double-quoted-scalar"||s.type==="block-scalar");function kd(s){switch(s){case gs:return"<BOM>";case ys:return"<DOC>";case bs:return"<FLOW_END>";case Mi:return"<SCALAR>";default:return JSON.stringify(s)}}function al(s){switch(s){case gs:return"byte-order-mark";case ys:return"doc-mode";case bs:return"flow-error-end";case Mi:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`\n`:case`\\r\n`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(s[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"\'":return"single-quoted-scalar";case\'"\':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function Be(s){switch(s){case void 0:case" ":case`\n`:case"\\r":case" ":return!0;default:return!1}}var Mf="0123456789ABCDEFabcdef".split(""),Sd="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*\'()".split(""),fl=",[]{}".split(""),vd=` ,[]{}\n\\r `.split(""),cl=s=>!s||vd.includes(s),Oi=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){var n;e&&(this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null),this.atEnd=!t;let i=(n=this.next)!=null?n:"stream";for(;i&&(t||this.hasChars(1));)i=yield*k(this.parseNext(i))}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`\n`?!0:t==="\\r"?this.buffer[e+1]===`\n`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let i=0;for(;t===" ";)t=this.buffer[++i+e];if(t==="\\r"){let n=this.buffer[i+e+1];if(n===`\n`||!n&&!this.atEnd)return e+i+1}return t===`\n`||i>=this.indentNext||!t&&!this.atEnd?e+i:-1}if(t==="-"||t==="."){let i=this.buffer.substr(e,3);if((i==="---"||i==="...")&&Be(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`\n`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*k(this.parseStream());case"line-start":return yield*k(this.parseLineStart());case"block-start":return yield*k(this.parseBlockStart());case"doc":return yield*k(this.parseDocument());case"flow":return yield*k(this.parseFlowCollection());case"quoted-scalar":return yield*k(this.parseQuotedScalar());case"block-scalar":return yield*k(this.parseBlockScalar());case"plain-scalar":return yield*k(this.parsePlainScalar())}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===gs&&(yield*k(this.pushCount(1)),e=e.substring(1)),e[0]==="%"){let t=e.length,i=e.indexOf("#");if(i!==-1){let r=e[i-1];(r===" "||r===" ")&&(t=i-1)}for(;;){let r=e[t-1];if(r===" "||r===" ")t-=1;else break}let n=(yield*k(this.pushCount(t)))+(yield*k(this.pushSpaces(!0)));return yield*k(this.pushCount(e.length-n)),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*k(this.pushSpaces(!0));return yield*k(this.pushCount(e.length-t)),yield*k(this.pushNewline()),"stream"}return yield ys,yield*k(this.parseLineStart())}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if(t==="---"&&Be(this.charAt(3)))return yield*k(this.pushCount(3)),this.indentValue=0,this.indentNext=0,"doc";if(t==="..."&&Be(this.charAt(3)))return yield*k(this.pushCount(3)),"stream"}return this.indentValue=yield*k(this.pushSpaces(!1)),this.indentNext>this.indentValue&&!Be(this.charAt(1))&&(this.indentNext=this.indentValue),yield*k(this.parseBlockStart())}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Be(t)){let i=(yield*k(this.pushCount(1)))+(yield*k(this.pushSpaces(!0)));return this.indentNext=this.indentValue+1,this.indentValue+=i,yield*k(this.parseBlockStart())}return"doc"}*parseDocument(){yield*k(this.pushSpaces(!0));let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*k(this.pushIndicators());switch(e[t]){case"#":yield*k(this.pushCount(e.length-t));case void 0:return yield*k(this.pushNewline()),yield*k(this.parseLineStart());case"{":case"[":return yield*k(this.pushCount(1)),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*k(this.pushCount(1)),"doc";case"*":return yield*k(this.pushUntil(cl)),"doc";case\'"\':case"\'":return yield*k(this.parseQuotedScalar());case"|":case">":return t+=yield*k(this.parseBlockScalarHeader()),t+=yield*k(this.pushSpaces(!0)),yield*k(this.pushCount(e.length-t)),yield*k(this.pushNewline()),yield*k(this.parseBlockScalar());default:return yield*k(this.parsePlainScalar())}}*parseFlowCollection(){let e,t,i=-1;do e=yield*k(this.pushNewline()),e>0?(t=yield*k(this.pushSpaces(!1)),this.indentValue=i=t):t=0,t+=yield*k(this.pushSpaces(!0));while(e+t>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&n[0]!=="#"||i===0&&(n.startsWith("---")||n.startsWith("..."))&&Be(n[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield bs,yield*k(this.parseLineStart());let r=0;for(;n[r]===",";)r+=yield*k(this.pushCount(1)),r+=yield*k(this.pushSpaces(!0)),this.flowKey=!1;switch(r+=yield*k(this.pushIndicators()),n[r]){case void 0:return"flow";case"#":return yield*k(this.pushCount(n.length-r)),"flow";case"{":case"[":return yield*k(this.pushCount(1)),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*k(this.pushCount(1)),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*k(this.pushUntil(cl)),"flow";case\'"\':case"\'":return this.flowKey=!0,yield*k(this.parseQuotedScalar());case":":{let o=this.charAt(1);if(this.flowKey||Be(o)||o===",")return this.flowKey=!1,yield*k(this.pushCount(1)),yield*k(this.pushSpaces(!0)),"flow"}default:return this.flowKey=!1,yield*k(this.parsePlainScalar())}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="\'")for(;t!==-1&&this.buffer[t+1]==="\'";)t=this.buffer.indexOf("\'",t+2);else for(;t!==-1;){let r=0;for(;this.buffer[t-1-r]==="\\\\";)r+=1;if(r%2===0)break;t=this.buffer.indexOf(\'"\',t+1)}let i=this.buffer.substring(0,t),n=i.indexOf(`\n`,this.pos);if(n!==-1){for(;n!==-1;){let r=this.continueScalar(n+1);if(r===-1)break;n=i.indexOf(`\n`,r)}n!==-1&&(t=n-(i[n-1]==="\\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*k(this.pushToIndex(t+1,!1)),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*k(this.pushUntil(t=>Be(t)||t==="#"))}*parseBlockScalar(){let e=this.pos-1,t=0,i;e:for(let n=this.pos;i=this.buffer[n];++n)switch(i){case" ":t+=1;break;case`\n`:e=n,t=0;break;case"\\r":{let r=this.buffer[n+1];if(!r&&!this.atEnd)return this.setNext("block-scalar");if(r===`\n`)break}default:break e}if(!i&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext+=this.blockScalarIndent;do{let n=this.continueScalar(e+1);if(n===-1)break;e=this.buffer.indexOf(`\n`,n)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}if(!this.blockScalarKeep)do{let n=e-1,r=this.buffer[n];r==="\\r"&&(r=this.buffer[--n]);let o=n;for(;r===" "||r===" ";)r=this.buffer[--n];if(r===`\n`&&n>=this.pos&&n+1+t>o)e=n;else break}while(!0);return yield Mi,yield*k(this.pushToIndex(e+1,!0)),yield*k(this.parseLineStart())}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,i=this.pos-1,n;for(;n=this.buffer[++i];)if(n===":"){let r=this.buffer[i+1];if(Be(r)||e&&r===",")break;t=i}else if(Be(n)){let r=this.buffer[i+1];if(n==="\\r"&&(r===`\n`?(i+=1,n=`\n`,r=this.buffer[i+1]):t=i),r==="#"||e&&fl.includes(r))break;if(n===`\n`){let o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(e&&fl.includes(n))break;t=i}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield Mi,yield*k(this.pushToIndex(t+1,!0)),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let i=this.buffer.slice(this.pos,e);return i?(yield i,this.pos+=i.length,i.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*k(this.pushTag()))+(yield*k(this.pushSpaces(!0)))+(yield*k(this.pushIndicators()));case"&":return(yield*k(this.pushUntil(cl)))+(yield*k(this.pushSpaces(!0)))+(yield*k(this.pushIndicators()));case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(Be(t)||e&&fl.includes(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*k(this.pushCount(1)))+(yield*k(this.pushSpaces(!0)))+(yield*k(this.pushIndicators()))}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!Be(t)&&t!==">";)t=this.buffer[++e];return yield*k(this.pushToIndex(t===">"?e+1:e,!1))}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Sd.includes(t))t=this.buffer[++e];else if(t==="%"&&Mf.includes(this.buffer[e+1])&&Mf.includes(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*k(this.pushToIndex(e,!1))}}*pushNewline(){let e=this.buffer[this.pos];return e===`\n`?yield*k(this.pushCount(1)):e==="\\r"&&this.charAt(1)===`\n`?yield*k(this.pushCount(2)):0}*pushSpaces(e){let t=this.pos-1,i;do i=this.buffer[++t];while(i===" "||e&&i===" ");let n=t-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=t),n}*pushUntil(e){let t=this.pos,i=this.buffer[t];for(;!e(i);)i=this.buffer[++t];return yield*k(this.pushToIndex(t,!1))}};var Ti=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,i=this.lineStarts.length;for(;t<i;){let r=t+i>>1;this.lineStarts[r]<e?t=r+1:i=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let n=this.lineStarts[t-1];return{line:t,col:e-n+1}}}};function _e(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function Of(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Nf(s){switch(s==null?void 0:s.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Zn(s){var e;switch(s.type){case"document":return s.start;case"block-map":{let t=s.items[s.items.length-1];return(e=t.sep)!=null?e:t.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function Ni(s){var t;if(s.length===0)return[];let e=s.length;e:for(;--e>=0;)switch(s[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((t=s[++e])==null?void 0:t.type)==="space";);return s.splice(e,s.length)}function Tf(s){if(s.start.type==="flow-seq-start")for(let e of s.items)e.sep&&!e.value&&!_e(e.start,"explicit-key-ind")&&!_e(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Nf(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var Gt=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Oi,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(e,t))yield*k(this.next(i));t||(yield*k(this.end()))}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*k(this.step()),this.offset+=e.length;return}let t=al(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*k(this.step()),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let i=`Not a YAML token: ${e}`;yield*k(this.pop({type:"error",offset:this.offset,message:i,source:e})),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*k(this.pop())}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&(!e||e.type!=="doc-end")){for(;this.stack.length>0;)yield*k(this.pop());this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*k(this.stream());switch(e.type){case"document":return yield*k(this.document(e));case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*k(this.scalar(e));case"block-scalar":return yield*k(this.blockScalar(e));case"block-map":return yield*k(this.blockMap(e));case"block-seq":return yield*k(this.blockSequence(e));case"flow-collection":return yield*k(this.flowCollection(e));case"doc-end":return yield*k(this.documentEnd(e))}yield*k(this.pop())}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e!=null?e:this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let i=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in i?i.indent:0:t.type==="flow-collection"&&i.type==="document"&&(t.indent=0),t.type==="flow-collection"&&Tf(t),i.type){case"document":i.value=t;break;case"block-scalar":i.props.push(t);break;case"block-map":{let n=i.items[i.items.length-1];if(n.value){i.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!_e(n.start,"explicit-key-ind");return}break}case"block-seq":{let n=i.items[i.items.length-1];n.value?i.items.push({start:[],value:t}):n.value=t;break}case"flow-collection":{let n=i.items[i.items.length-1];!n||n.value?i.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*k(this.pop()),yield*k(this.pop(t))}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&Of(n.start)===-1&&(t.indent===0||n.start.every(r=>r.type!=="comment"||r.indent<t.indent))&&(i.type==="document"?i.end=n.start:i.items.push({start:n.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*k(this.lineEnd(e));switch(this.type){case"doc-start":{Of(e.start)!==-1?(yield*k(this.pop()),yield*k(this.step())):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=Zn(this.peek(2)),i=Ni(t),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let r={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*k(this.lineEnd(e))}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`\n`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`\n`,t)+1}yield*k(this.pop());break;default:yield*k(this.pop()),yield*k(this.step())}}*blockMap(e){var i;let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0,r=Array.isArray(n)?n[n.length-1]:void 0;(r==null?void 0:r.type)==="comment"?n==null||n.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2],r=(i=n==null?void 0:n.value)==null?void 0:i.end;if(Array.isArray(r)){Array.prototype.push.apply(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent&&t.sep,r=[];if(n&&t.sep&&!t.value){let o=[];for(let l=0;l<t.sep.length;++l){let a=t.sep[l];switch(a.type){case"newline":o.push(l);break;case"space":break;case"comment":a.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||t.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!_e(t.start,"explicit-key-ind")?t.start.push(this.sourceToken):n||t.value?(r.push(this.sourceToken),e.items.push({start:r})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]}),this.onKeyLine=!0;return;case"map-value-ind":if(_e(t.start,"explicit-key-ind"))if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(_e(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(Nf(t.key)&&!_e(t.sep,"newline")){let o=Ni(t.start),l=t.key,a=t.sep;a.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:l,sep:a}]})}else r.length>0?t.sep=t.sep.concat(r,this.sourceToken):t.sep.push(this.sourceToken);else if(_e(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=Ni(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||n?e.items.push({start:r,key:null,sep:[this.sourceToken]}):_e(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);n||t.value?(e.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){n&&o.type!=="block-seq"&&_e(t.start,"explicit-key-ind")&&e.items.push({start:r}),this.stack.push(o);return}}}}yield*k(this.pop()),yield*k(this.step())}*blockSequence(e){var i;let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0,r=Array.isArray(n)?n[n.length-1]:void 0;(r==null?void 0:r.type)==="comment"?n==null||n.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2],r=(i=n==null?void 0:n.value)==null?void 0:i.end;if(Array.isArray(r)){Array.prototype.push.apply(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||_e(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*k(this.pop()),yield*k(this.step())}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let i;do yield*k(this.pop()),i=this.peek(1);while(i&&i.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):(yield*k(this.pop()),yield*k(this.step()))}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===e.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*k(this.pop()),yield*k(this.step());else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let n=Zn(i),r=Ni(n);Tf(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let l={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=l}else yield*k(this.lineEnd(e))}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`\n`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`\n`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=Zn(e),i=Ni(t);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Zn(e),i=Ni(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*k(this.pop())))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*k(this.pop()),yield*k(this.step());break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*k(this.pop()))}}};function Ef(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new Ti||null,prettyErrors:e}}function Df(s,e={}){let{lineCounter:t,prettyErrors:i}=Ef(e),n=new Gt(t==null?void 0:t.addNewLine),r=new Ut(e),o=Array.from(r.compose(n.parse(s)));if(i&&t)for(let l of o)l.errors.forEach(ds(s,t)),l.warnings.forEach(ds(s,t));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function ul(s,e={}){let{lineCounter:t,prettyErrors:i}=Ef(e),n=new Gt(t==null?void 0:t.addNewLine),r=new Ut(e),o=null;for(let l of r.compose(n.parse(s),!0,s.length))if(!o)o=l;else if(o.options.logLevel!=="silent"){o.errors.push(new ve(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&t&&(o.errors.forEach(ds(s,t)),o.warnings.forEach(ds(s,t))),o}function Lf(s,e,t){let i;typeof e=="function"?i=e:t===void 0&&e&&typeof e=="object"&&(t=e);let n=ul(s,t);if(!n)return null;if(n.warnings.forEach(r=>En(n.options.logLevel,r)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:i},t))}function Pf(s,e,t){var n;let i=null;if(typeof e=="function"||Array.isArray(e)?i=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let r=Math.round(t);t=r<1?void 0:r>8?{indent:8}:{indent:r}}if(s===void 0){let{keepUndefined:r}=(n=t!=null?t:e)!=null?n:{};if(!r)return}return new et(s,i,t).toString(t)}var pl=dl;var er="STATBLOCK-WIKI-LINK",xd=new RegExp(`<${er}>([\\\\s\\\\S]+?)<${er}>`),tr="STATBLOCK-MARKDOWN-LINK",Ad=new RegExp(`<${tr}>([\\\\s\\\\S]+?)(?:\\\\|([\\\\s\\\\S]+?))?<${tr}>`),Cd=/(<STATBLOCK-(?:WIKI|MARKDOWN)-LINK>[\\s\\S]+?<STATBLOCK-(?:WIKI|MARKDOWN)-LINK>)/,ws=class s{static isStatblockLink(e){return Cd.test(e)}static replaceWikiLink(e){return`<${er}>${e}<${er}>`}static replaceMarkdownLink(e,t){return`<${tr}>${e}${t?"|"+t:""}<${tr}>`}static transformSource(e){return e.replace(/\\[\\[([\\s\\S]+?)\\]\\]/g,(t,i)=>s.replaceWikiLink(i)).replace(/\\[([\\s\\S]*?)\\]\\(([\\s\\S]+?)\\)/g,(t,i,n)=>s.replaceMarkdownLink(n,i))}static transformYamlSource(e){return s.transformSource(e)}static stringifyLinks(e){return e.replace(new RegExp(xd,"g"),(t,i)=>`[[${i}]]`).replace(new RegExp(Ad,"g"),(t,i,n)=>`[${n||""}](${i})`)}};var Jt=self,ml=class{constructor(){this.queue=[];this.parsing=!1;Jt.addEventListener("message",e=>{e.data.type=="queue"&&(this.add(...e.data.data),this.debug&&console.debug(`Fantasy Statblocks: Received queue message for ${e.data.data.length} paths`))}),Jt.addEventListener("message",e=>{e.data.type=="debug"&&(this.debug=e.data.data)})}add(...e){this.debug&&console.debug(`Fantasy Statblocks: Adding ${e.length} paths to queue`),this.queue.push(...e),this.parsing||this.parse()}processContent(e,t){this.debug&&console.debug(`Fantasy Statblocks: Process Content: ${t.path}`);let i=this.findFirstStatBlock(e);if(i){this.debug&&console.debug(`Fantasy Statblocks: found Statblock: ${JSON.stringify(i)}`);let n=ws.transformSource(i),r=Object.assign({},pl.parse(n),{mtime:t.mtime});this.debug&&console.debug(`Fantasy Statblocks: ${JSON.stringify(r)}`),this.processMonster(r,t)}}findFirstStatBlock(e){let t=e.match(/^```[^\\S\\r\\n]*statblock\\s?\\n([\\s\\S]+?)^```/m);return t?t[1]:null}async parse(){for(this.parsing=!0;this.queue.length;){let e=this.queue.shift();this.debug&&console.debug(`Fantasy Statblocks: Parsing ${e} for statblocks (${this.queue.length} to go)`);let t=await this.getFileData(e);if(!e.endsWith(".md")||!t.data)continue;let{file:i,statblock:n}=t.data;try{n==="inline"?this.processContent(t.data.content,i):this.parseFrontmatter(t.data.info,i)}catch(r){console.error(`There was an error parsing the Statblock in ${e}: \n\n${r.message}`)}Jt.postMessage({type:"done",data:e})}this.parsing=!1,Jt.postMessage({type:"save",data:null})}async getFileData(e){return new Promise(t=>{Jt.addEventListener("message",i=>{i.data.type=="file"&&t(i.data)}),Jt.postMessage({data:e,type:"get"})})}parseFrontmatter(e,t){if(!e.exists)return;let i=ws.transformYamlSource(e.frontmatter),n=this.validate(Object.assign({},(0,Bf.default)(pl.parse(i)),{mtime:t.mtime}));n.traits&&(n.traits=di([],n.traits)),this.processMonster(n,t)}processMonster(e,t){e.actions&&(e.actions=di([],e.actions)),e.bonus_actions&&(e.bonus_actions=di([],e.bonus_actions)),e.reactions&&(e.reactions=di([],e.reactions)),e.legendary_actions&&(e.legendary_actions=di([],e.legendary_actions)),e["statblock-link"]&&e["statblock-link"].startsWith("#")&&(e["statblock-link"]=`[${e.name}](${t.path}${e["statblock-link"]})`),this.debug&&console.debug(`Fantasy Statblocks: Adding ${e.name} to bestiary from ${t.basename}`),Jt.postMessage({type:"update",data:{monster:e,path:t.path}})}validate(e){return e}};new ml;\n')}var Mo=class extends yt.Component{constructor(){super(...arguments);this.watchPaths=new Map;this.workers=[];this.index=0;this.queue=new Set}get metadataCache(){return this.plugin.app.metadataCache}get vault(){return this.plugin.app.vault}setDebug(){for(let t of this.workers)t.postMessage({type:"debug",data:this.plugin.settings.debug})}initialize(t){return this.plugin=t,this}onload(){this.setDebug(),this.registerEvent(this.metadataCache.on("changed",async n=>{if(!this.plugin.settings.autoParse)return;let{frontmatter:a}=this.metadataCache.getFileCache(n)??{};if(!a||!a.statblock){this.watchPaths.has(n.path)&&this.delete(n.path);return}this.plugin.settings.debug&&console.debug(`Fantasy Statblocks: Reparsing ${n.name}`),this.parsePath(n)})),this.registerEvent(this.vault.on("rename",async(n,a)=>{this.plugin.settings.autoParse&&n instanceof yt.TFile&&this.watchPaths.has(a)&&(this.plugin.settings.debug&&console.debug(`Fantasy Statblocks: Handling rename of ${a} to ${n.path}`),await this.delete(a),this.parsePath(n))})),this.registerEvent(this.vault.on("delete",n=>{this.plugin.settings.autoParse&&n instanceof yt.TFile&&this.watchPaths.has(n.path)&&this.delete(n.path)}));let t=yt.Platform.isIosApp?2:Math.max(Math.ceil(navigator.hardwareConcurrency/2),2);for(let n=0;n<t;n++){let a=new Po;this.workers.push(a),a.addEventListener("message",async s=>{if(s.data.type=="get"){let r=s.data.data,o=this.plugin.app.vault.getAbstractFileByPath(r);if(this.queue.delete(r),o instanceof yt.TFile){let l=await this.getFileInformation(o);a.postMessage(l??{type:"file"})}else a.postMessage({type:"file"}),this.parsePath(o)}}),a.addEventListener("message",async s=>{if(s.data.type=="update"){let{monster:r,path:o}=s.data.data,l=ve.hasCreature(r.name);r.path=o,ve.addEphemeralCreature(r),this.watchPaths.set(o,r.name),this.plugin.settings.debug&&console.debug(`Fantasy Statblocks: ${l?"Updated":"Added"} ${r.name}`)}}),a.addEventListener("message",async s=>{s.data.type=="save"&&await this.save()})}this.plugin.app.workspace.onLayoutReady(()=>{if(!this.plugin.settings.autoParse){ve.setResolved(!0);return}this.start(!0)})}async save(){this.queue.size||(this.startTime&&(console.info(`Fantasy Statblocks: Frontmatter Parsing Complete in ${((Date.now()-this.startTime)/1e3).toLocaleString()} seconds.`),this.startTime=0),this.announce&&(new yt.Notice("Fantasy Statblocks: Frontmatter Parsing complete."),this.announce=!1),ve.setResolved(!0))}async delete(t){ve.removeEphemeralCreature(this.watchPaths.get(t)),this.watchPaths.delete(t),this.plugin.settings.debug&&console.debug(`Fantasy Statblocks: Removing '${t}' from bestiary`)}start(t=!1){ve.setResolved(!1),this.announce=t,this.startTime=Date.now(),console.info("Fantasy Statblocks: Starting Frontmatter Parsing."),this.plugin.settings.paths?.length||(this.plugin.settings.paths=["/"]);let n=!1;for(let a of this.plugin.settings.paths){let s=this.vault.getAbstractFileByPath(a);s&&(n=!0,this.parsePath(s))}n||this.save()}pathContainsFile(t){if(!this.plugin.settings.paths.length||this.plugin.settings.paths.contains("/"))return!0;for(let n of this.plugin.settings.paths)if(t.path.startsWith(n))return!0;return!1}parsePath(t){if(!this.pathContainsFile(t))return;let n=new Set;for(let a of this.getFiles(t))n.add(a);this.startParsing([...n])}startParsing(t){if(t.length){for(let n of t)this.queue.add(n);this.workers[this.index].postMessage({type:"queue",data:t}),this.index=(this.index+1)%this.workers.length}}async getFileInformation(t){if(this.watchPaths.has(t.path)&&ve.get(this.watchPaths.get(t.path))?.mtime==t.stat.mtime)return null;let n=this.plugin.app.metadataCache.getFileCache(t);if(!n?.frontmatter?.statblock||n?.frontmatter?.statblock!==!0&&n?.frontmatter?.statblock!=="true"&&n?.frontmatter?.statblock!=="inline")return null;let a=await this.plugin.app.vault.cachedRead(t),s=(0,yt.getFrontMatterInfo)(a);return{type:"file",data:{statblock:n.frontmatter.statblock=="inline"?"inline":"frontmatter",content:a,info:s,file:{path:t.path,basename:t.basename,mtime:t.stat.mtime}}}}getFiles(t){let n=[];if(t instanceof yt.TFolder)for(let a of t.children)n.push(a.path);return t instanceof yt.TFile&&t.extension==="md"&&n.push(t.path),n}async reparseVault(){this.start(!1)}onunload(){for(let t of this.workers)t.terminate();this.workers=[]}},wi=new Mo;var k1=[{name:"Aboleth",source:"5e SRD",size:"Large",type:"aberration",subtype:"",alignment:"lawful evil",ac:17,hp:135,hit_dice:"18d10 + 36",speed:"10 ft., swim 40 ft.",stats:[21,9,15,18,15,18],saves:[{constitution:6},{intelligence:8},{wisdom:6}],skillsaves:[{history:12},{perception:10}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 20",languages:"Deep Speech, telepathy 120 ft.",cr:"10",bestiary:!0,traits:[{name:"Amphibious",desc:"The aboleth can breathe air and water.",attack_bonus:0},{name:"Mucous Cloud",desc:"While underwater, the aboleth is surrounded by transformative mucus. A creature that touches the aboleth or that hits it with a melee attack while within 5 ft. of it must make a DC 14 Constitution saving throw. On a failure, the creature is diseased for 1d4 hours. The diseased creature can breathe only underwater.",attack_bonus:0},{name:"Probing Telepathy",desc:"If a creature communicates telepathically with the aboleth, the aboleth learns the creature's greatest desires if the aboleth can see the creature.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The aboleth makes three tentacle attacks.",attack_bonus:0},{name:"Tentacle",desc:"Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 12 (2d6 + 5) bludgeoning damage. If the target is a creature, it must succeed on a DC 14 Constitution saving throw or become diseased. The disease has no effect for 1 minute and can be removed by any magic that cures disease. After 1 minute, the diseased creature's skin becomes translucent and slimy, the creature can't regain hit points unless it is underwater, and the disease can be removed only by heal or another disease-curing spell of 6th level or higher. When the creature is outside a body of water, it takes 6 (1d12) acid damage every 10 minutes unless moisture is applied to the skin before 10 minutes have passed.",attack_bonus:9,damage_dice:"2d6",damage_bonus:5},{name:"Tail",desc:"Melee Weapon Attack: +9 to hit, reach 10 ft. one target. Hit: 15 (3d6 + 5) bludgeoning damage.",attack_bonus:9,damage_dice:"3d6",damage_bonus:5},{name:"Enslave (3/day)",desc:`The aboleth targets one creature it can see within 30 ft. of it. The target must succeed on a DC 14 Wisdom saving throw or be magically charmed by the aboleth until the aboleth dies or until it is on a different plane of existence from the target. The charmed target is under the aboleth's control and can't take reactions, and the aboleth and the target can communicate telepathically with each other over any distance.
Whenever the charmed target takes damage, the target can repeat the saving throw. On a success, the effect ends. No more than once every 24 hours, the target can also repeat the saving throw when it is at least 1 mile away from the aboleth.`,attack_bonus:0}],legendary_actions:[{name:"Detect",desc:"The aboleth makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Swipe",desc:"The aboleth makes one tail attack.",attack_bonus:0},{name:"Psychic Drain (Costs 2 Actions)",desc:"One creature charmed by the aboleth takes 10 (3d6) psychic damage, and the aboleth regains hit points equal to the damage the creature takes.",attack_bonus:0}]},{name:"Acolyte",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:10,hp:9,hit_dice:"2d8",speed:"30 ft.",stats:[10,10,10,10,14,11],skillsaves:[{medicine:4},{religion:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 12",languages:"any one language (usually Common)",cr:"1/4",bestiary:!0,traits:[],actions:[{name:"Club",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 2 (1d4) bludgeoning damage.",attack_bonus:2,damage_dice:"1d4"}],spells:["The acolyte is a 1st-level spellcaster. Its spellcasting ability is Wisdom (spell save DC 12, +4 to hit with spell attacks). The acolyte has following cleric spells prepared:",{"Cantrips (at will)":"light, sacred flame, thaumaturgy"},{"1st level (3 slots)":"bless, cure wounds, sanctuary"}]},{name:"Adult Black Dragon",source:"5e SRD",size:"Huge",type:"dragon",subtype:"",alignment:"chaotic evil",ac:19,hp:195,hit_dice:"17d12 + 84",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[23,14,21,14,13,17],saves:[{dexterity:7},{constitution:10},{wisdom:6},{charisma:8}],skillsaves:[null,{perception:11},{stealth:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 21",languages:"Common, Draconic",cr:"14",bestiary:!0,traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +11 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage plus 4 (1d8) acid damage.",attack_bonus:11,damage_dice:"2d10 + 1d8",damage_bonus:6},{name:"Claw",desc:"Melee Weapon Attack: +11 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",attack_bonus:11,damage_dice:"2d6",damage_bonus:6},{name:"Tail",desc:"Melee Weapon Attack: +11 to hit, reach 15 ft., one target. Hit: 15 (2d8 + 6) bludgeoning damage.",attack_bonus:11,damage_dice:"2d8",damage_bonus:6},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 16 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Acid Breath (Recharge 5-6)",desc:"The dragon exhales acid in a 60-foot line that is 5 feet wide. Each creature in that line must make a DC 18 Dexterity saving throw, taking 54 (12d8) acid damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"12d8"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 19 Dexterity saving throw or take 13 (2d6 + 6) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Adult Blue Dracolich",source:"5e SRD",size:"Huge",type:"undead",subtype:"",alignment:"lawful evil",ac:19,hp:225,hit_dice:"18d12 + 108",speed:"40 ft., burrow 30 ft., fly 80 ft.",stats:[25,10,23,16,15,19],skillsaves:[{perception:12}],damage_vulnerabilities:"",damage_resistances:"necrotic",damage_immunities:"lightning, poison",condition_immunities:"charmed, exhaustion, frightened, paralyzed, poisoned",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 22",languages:"Common, Draconic",cr:"17",bestiary:!0,traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dracolich fails a saving throw, it can choose to succeed instead.",attack_bonus:0},{name:"Magic Resistance",desc:"The dracolich has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dracolich can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +12 to hit, reach 10 ft., one target. Hit: 18 (2d10 + 7) piercing damage plus 5 (1d10) lightning damage.",attack_bonus:12,damage_dice:"2d10 + 1d10",damage_bonus:7},{name:"Claw",desc:"Melee Weapon Attack: +12 to hit, reach 5 ft., one target. Hit: 14 (2d6 + 7) slashing damage.",attack_bonus:12,damage_dice:"2d6",damage_bonus:7},{name:"Tail",desc:"Melee Weapon Attack: +12 to hit, reach 15 ft., one target. Hit: 16 (2d8 + 7) bludgeoning damage.",attack_bonus:12,damage_dice:"2d8",damage_bonus:7},{name:"Frightful Presence",desc:"Each creature of the dracolich's choice that is within 120 feet of the dracolich and aware of it must succeed on a DC 18 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dracolich's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Lightning Breath (Recharge 5-6)",desc:"The dracolich exhales lightning in a 90-foot line that is 5 feet wide. Each creature in that line must make a DC 20 Dexterity saving throw, taking 66 (12d10) lightning damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"12d10"}],legendary_actions:[{name:"Detect",desc:"The dracolich makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dracolich makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dracolich beats its tattered wings. Each creature within 10 ft. of the dracolich must succeed on a DC 21 Dexterity saving throw or take 14 (2d6 + 7) bludgeoning damage and be knocked prone. After beating its wings this way, the dracolich can fly up to half its flying speed.",attack_bonus:0}]},{name:"Adult Blue Dragon",source:"5e SRD",size:"Huge",type:"dragon",subtype:"",alignment:"lawful evil",ac:19,hp:225,hit_dice:"18d12 + 108",speed:"40 ft., burrow 30 ft., fly 80 ft.",stats:[25,10,23,16,15,19],saves:[{dexterity:5},{constitution:11},{wisdom:7},{charisma:9}],skillsaves:[null,{perception:12},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 22",languages:"Common, Draconic",cr:"16",bestiary:!0,traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +12 to hit, reach 10 ft., one target. Hit: 18 (2d10 + 7) piercing damage plus 5 (1d10) lightning damage.",attack_bonus:12,damage_dice:"2d10 + 1d10",damage_bonus:7},{name:"Claw",desc:"Melee Weapon Attack: +12 to hit, reach 5 ft., one target. Hit: 14 (2d6 + 7) slashing damage.",attack_bonus:12,damage_dice:"2d6",damage_bonus:7},{name:"Tail",desc:"Melee Weapon Attack: +12 to hit, reach 15 ft., one target. Hit: 16 (2d8 + 7) bludgeoning damage.",attack_bonus:12,damage_dice:"2d8",damage_bonus:7},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 ft. of the dragon and aware of it must succeed on a DC 17 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Lightning Breath (Recharge 5-6)",desc:"The dragon exhales lightning in a 90-foot line that is 5 ft. wide. Each creature in that line must make a DC 19 Dexterity saving throw, taking 66 (12d10) lightning damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"12d10"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 20 Dexterity saving throw or take 14 (2d6 + 7) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Adult Brass Dragon",source:"5e SRD",size:"Huge",type:"dragon",subtype:"",alignment:"chaotic good",ac:18,hp:172,hit_dice:"15d12 + 74",speed:"40 ft., burrow 40 ft., fly 80 ft.",stats:[23,10,21,14,13,17],saves:[{dexterity:5},{constitution:10},{wisdom:6},{charisma:8}],skillsaves:[null,{history:7},{persuasion:8},{perception:11},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 21",languages:"Common, Draconic",cr:"13",bestiary:!0,traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +11 to hit, reach,.0 ft., one target. Hit: 17 (2d10 + 6) piercing damage.",attack_bonus:11,damage_dice:"2d10",damage_bonus:6},{name:"Claw",desc:"Melee Weapon Attack: +11 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",attack_bonus:11,damage_dice:"2d6",damage_bonus:6},{name:"Tail",desc:"Melee Weapon Attack: +11 to hit, reach 15 ft., one target. Hit: 15 (2d8 + 6) bludgeoning damage.",attack_bonus:11,damage_dice:"2d8",damage_bonus:6},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 16 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Fire Breath. The dragon exhales fire in an 60-foot line that is 5 feet wide. Each creature in that line must make a DC 18 Dexterity saving throw, taking 45 (13d6) fire damage on a failed save, or half as much damage on a successful one.
Sleep Breath. The dragon exhales sleep gas in a 60-foot cone. Each creature in that area must succeed on a DC 18 Constitution saving throw or fall unconscious for 10 minutes. This effect ends for a creature if the creature takes damage or someone uses an action to wake it.`,attack_bonus:0,damage_dice:"13d6"}]},{name:"Adult Bronze Dragon",source:"5e SRD",size:"Huge",type:"dragon",subtype:"",alignment:"lawful good",ac:19,hp:212,hit_dice:"17d12 + 101",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[25,10,23,16,15,19],saves:[{dexterity:5},{constitution:11},{wisdom:7},{charisma:9}],skillsaves:[{insight:7},{perception:12},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 22",languages:"Common, Draconic",cr:"15",bestiary:!0,traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +12 to hit, reach 10 ft., one target. Hit: 18 (2d10 + 7) piercing damage.",attack_bonus:12,damage_dice:"2d10",damage_bonus:7},{name:"Claw",desc:"Melee Weapon Attack: +12 to hit, reach 5 ft., one target. Hit: 14 (2d6 + 7) slashing damage.",attack_bonus:12,damage_dice:"2d6",damage_bonus:7},{name:"Tail",desc:"Melee Weapon Attack: +12 to hit, reach 15 ft., one target. Hit: 16 (2d8 + 7) bludgeoning damage.",attack_bonus:12,damage_dice:"2d8",damage_bonus:7},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 17 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Lightning Breath. The dragon exhales lightning in a 90-foot line that is 5 feet wide. Each creature in that line must make a DC 19 Dexterity saving throw, taking 66 (12d10) lightning damage on a failed save, or half as much damage on a successful one.
Repulsion Breath. The dragon exhales repulsion energy in a 30-foot cone. Each creature in that area must succeed on a DC 19 Strength saving throw. On a failed save, the creature is pushed 60 feet away from the dragon.`,attack_bonus:0,damage_dice:"12d10"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 20 Dexterity saving throw or take 14 (2d6 + 7) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Adult Copper Dragon",source:"5e SRD",size:"Huge",type:"dragon",subtype:"",alignment:"chaotic good",ac:18,hp:184,hit_dice:"16d12 + 80",speed:"40 ft., climb 40 ft., fly 80 ft.",stats:[23,12,21,18,15,17],saves:[{dexterity:6},{constitution:10},{wisdom:7},{charisma:8}],skillsaves:[{deception:8},{perception:12},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 22",languages:"Common, Draconic",cr:"14",bestiary:!0,traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +11 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage.",attack_bonus:11,damage_dice:"2d10",damage_bonus:6},{name:"Claw",desc:"Melee Weapon Attack: +11 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",attack_bonus:11,damage_dice:"2d6",damage_bonus:6},{name:"Tail",desc:"Melee Weapon Attack: +11 to hit, reach 15 ft., one target. Hit: 15 (2d8 + 6) bludgeoning damage.",attack_bonus:11,damage_dice:"2d8",damage_bonus:6},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 16 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Acid Breath. The dragon exhales acid in an 60-foot line that is 5 feet wide. Each creature in that line must make a DC 18 Dexterity saving throw, taking 54 (12d8) acid damage on a failed save, or half as much damage on a successful one.
Slowing Breath. The dragon exhales gas in a 60-foot cone. Each creature in that area must succeed on a DC 18 Constitution saving throw. On a failed save, the creature can't use reactions, its speed is halved, and it can't make more than one attack on its turn. In addition, the creature can use either an action or a bonus action on its turn, but not both. These effects last for 1 minute. The creature can repeat the saving throw at the end of each of its turns, ending the effect on itself with a successful save.`,attack_bonus:0,damage_dice:"12d8"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 19 Dexterity saving throw or take 13 (2d6 + 6) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Adult Gold Dragon",source:"5e SRD",size:"Huge",type:"dragon",subtype:"",alignment:"lawful good",ac:19,hp:256,hit_dice:"19d12 + 132",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[27,14,25,16,15,24],saves:[{dexterity:8},{constitution:13},{wisdom:8},{charisma:13}],skillsaves:[{insight:8},{persuasion:13},{perception:14},{stealth:8}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 24",languages:"Common, Draconic",cr:"17",bestiary:!0,traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +14 to hit, reach 10 ft., one target. Hit: 19 (2d10 + 8) piercing damage.",attack_bonus:14,damage_dice:"2d10",damage_bonus:8},{name:"Claw",desc:"Melee Weapon Attack: +14 to hit, reach 5 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",attack_bonus:14,damage_dice:"2d6",damage_bonus:8},{name:"Tail",desc:"Melee Weapon Attack: +14 to hit, reach 15 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",attack_bonus:14,damage_dice:"2d8",damage_bonus:8},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 21 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Fire Breath. The dragon exhales fire in a 60-foot cone. Each creature in that area must make a DC 21 Dexterity saving throw, taking 66 (12d10) fire damage on a failed save, or half as much damage on a successful one.
Weakening Breath. The dragon exhales gas in a 60-foot cone. Each creature in that area must succeed on a DC 21 Strength saving throw or have disadvantage on Strength-based attack rolls, Strength checks, and Strength saving throws for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.`,attack_bonus:0,damage_dice:"12d10"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 22 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Adult Green Dragon",source:"5e SRD",size:"Huge",type:"dragon",subtype:"",alignment:"lawful evil",ac:19,hp:207,hit_dice:"18d12 + 90",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[23,12,21,18,15,17],saves:[{dexterity:6},{constitution:10},{wisdom:7},{charisma:8}],skillsaves:[{deception:8},{insight:7},{persuasion:8},{perception:12},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"poisoned",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 22",languages:"Common, Draconic",cr:"15",bestiary:!0,traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +11 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage plus 7 (2d6) poison damage.",attack_bonus:11,damage_dice:"2d10 + 2d6",damage_bonus:6},{name:"Claw",desc:"Melee Weapon Attack: +11 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",attack_bonus:11,damage_dice:"2d6",damage_bonus:6},{name:"Tail",desc:"Melee Weapon Attack: +11 to hit, reach 15 ft., one target. Hit: 15 (2d8 + 6) bludgeoning damage.",attack_bonus:11,damage_dice:"2d8",damage_bonus:6},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 16 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours .",attack_bonus:0},{name:"Poison Breath (Recharge 5-6)",desc:"The dragon exhales poisonous gas in a 60-foot cone. Each creature in that area must make a DC 18 Constitution saving throw, taking 56 (16d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"16d6"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 19 Dexterity saving throw or take 13 (2d6 + 6) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Adult Red Dragon",source:"5e SRD",size:"Huge",type:"dragon",subtype:"",alignment:"chaotic evil",ac:19,hp:256,hit_dice:"19d12 + 132",speed:"40 ft., climb 40 ft., fly 80 ft.",stats:[27,10,25,16,13,21],saves:[{dexterity:6},{constitution:13},{wisdom:7},{charisma:11}],skillsaves:[{perception:13},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 23",languages:"Common, Draconic",cr:"17",bestiary:!0,traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +14 to hit, reach 10 ft., one target. Hit: 19 (2d10 + 8) piercing damage plus 7 (2d6) fire damage.",attack_bonus:14,damage_dice:"2d10 + 2d6",damage_bonus:8},{name:"Claw",desc:"Melee Weapon Attack: +14 to hit, reach 5 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",attack_bonus:14,damage_dice:"2d6",damage_bonus:8},{name:"Tail",desc:"Melee Weapon Attack: +14 to hit, reach 15 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",attack_bonus:14,damage_dice:"2d8",damage_bonus:8},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 ft. of the dragon and aware of it must succeed on a DC 19 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Fire Breath (Recharge 5-6)",desc:"The dragon exhales fire in a 60-foot cone. Each creature in that area must make a DC 21 Dexterity saving throw, taking 63 (18d6) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"18d6"},{name:"Lair Actions",desc:`On initiative count 20 (losing initiative ties), the dragon takes a lair action to cause one of the following effects: the dragon can't use the same effect two rounds in a row:
\u2022 Magma erupts from a point on the ground the dragon can see within 120 feet of it, creating a 20-foot-high, 5-foot-radius geyser. Each creature in the geyser's area must make a DC 15 Dexterity saving throw, taking 21 (6d6) fire damage on a failed save, or half as much damage on a successful one.
\u2022 A tremor shakes the lair in a 60-foot-radius around the dragon. Each creature other than the dragon on the ground in that area must succeed on a DC 15 Dexterity saving throw or be knocked prone.
\u2022 Volcanic gases form a cloud in a 20-foot-radius sphere centered on a point the dragon can see within 120 feet of it. The sphere spreads around corners, and its area is lightly obscured. It lasts until initiative count 20 on the next round. Each creature that starts its turn in the cloud must succeed on a DC 13 Constitution saving throw or be poisoned until the end of its turn. While poisoned in this way, a creature is incapacitated.`,attack_bonus:0,damage_dice:"6d6"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 22 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Adult Silver Dragon",source:"5e SRD",size:"Huge",type:"dragon",subtype:"",alignment:"lawful good",ac:19,hp:243,hit_dice:"18d12 + 126",speed:"40 ft., fly 80 ft.",stats:[27,10,25,16,13,21],saves:[{dexterity:5},{constitution:12},{wisdom:6},{charisma:10}],skillsaves:[{arcana:8},{history:8},{perception:11},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 21",languages:"Common, Draconic",cr:"16",bestiary:!0,traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +13 to hit, reach 10 ft., one target. Hit: 19 (2d10 + 8) piercing damage.",attack_bonus:13,damage_dice:"2d10",damage_bonus:8},{name:"Claw",desc:"Melee Weapon Attack: +13 to hit, reach 5 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",attack_bonus:13,damage_dice:"2d6",damage_bonus:8},{name:"Tail",desc:"Melee Weapon Attack: +13 to hit, reach 15 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",attack_bonus:13,damage_dice:"2d8",damage_bonus:8},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 18 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Cold Breath. The dragon exhales an icy blast in a 60-foot cone. Each creature in that area must make a DC 20 Constitution saving throw, taking 58 (13d8) cold damage on a failed save, or half as much damage on a successful one.
Paralyzing Breath. The dragon exhales paralyzing gas in a 60-foot cone. Each creature in that area must succeed on a DC 20 Constitution saving throw or be paralyzed for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.`,attack_bonus:0,damage_dice:"13d8"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 22 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Adult White Dragon",source:"5e SRD",size:"Huge",type:"dragon",subtype:"",alignment:"chaotic evil",ac:18,hp:200,hit_dice:"16d12 + 96",speed:"40 ft., burrow 30 ft., fly 80 ft., swim 40 ft.",stats:[22,10,22,8,12,12],saves:[{dexterity:5},{constitution:11},{wisdom:6},{charisma:6}],skillsaves:[{perception:11},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 21",languages:"Common, Draconic",cr:"13",bestiary:!0,traits:[{name:"Ice Walk",desc:"The dragon can move across and climb icy surfaces without needing to make an ability check. Additionally, difficult terrain composed of ice or snow doesn't cost it extra moment.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +11 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage plus 4 (1d8) cold damage.",attack_bonus:11,damage_dice:"2d10 + 1d8",damage_bonus:6},{name:"Claw",desc:"Melee Weapon Attack: +11 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",attack_bonus:11,damage_dice:"2d6",damage_bonus:6},{name:"Tail",desc:"Melee Weapon Attack: +11 to hit, reach 15 ft., one target. Hit: 15 (2d8 + 6) bludgeoning damage.",attack_bonus:11,damage_dice:"2d8",damage_bonus:6},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 ft. of the dragon and aware of it must succeed on a DC 14 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Cold Breath (Recharge 5-6)",desc:"The dragon exhales an icy blast in a 60-foot cone. Each creature in that area must make a DC 19 Constitution saving throw, taking 54 (12d8) cold damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"12d8"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 19 Dexterity saving throw or take 13 (2d6 + 6) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Air Elemental",source:"5e SRD",size:"Large",type:"elemental",subtype:"",alignment:"neutral",ac:15,hp:90,hit_dice:"12d10 + 24",speed:"fly 90 ft. (hover)",stats:[14,20,14,6,10,6],damage_vulnerabilities:"",damage_resistances:"lightning; thunder; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"exhaustion, grappled, paralyzed, petrified, poisoned, prone, restrained, unconscious",senses:"darkvision 60 ft., passive Perception 10",languages:"Auran",cr:"5",bestiary:!0,traits:[{name:"Air Form",desc:"The elemental can enter a hostile creature's space and stop there. It can move through a space as narrow as 1 inch wide without squeezing.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The elemental makes two slam attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 14 (2d8 + 5) bludgeoning damage.",attack_bonus:8,damage_dice:"2d8",damage_bonus:5},{name:"Whirlwind (Recharge 4-6)",desc:`Each creature in the elemental's space must make a DC 13 Strength saving throw. On a failure, a target takes 15 (3d8 + 2) bludgeoning damage and is flung up 20 feet away from the elemental in a random direction and knocked prone. If a thrown target strikes an object, such as a wall or floor, the target takes 3 (1d6) bludgeoning damage for every 10 feet it was thrown. If the target is thrown at another creature, that creature must succeed on a DC 13 Dexterity saving throw or take the same damage and be knocked prone.
If the saving throw is successful, the target takes half the bludgeoning damage and isn't flung away or knocked prone.`,attack_bonus:0}]},{name:"Ancient Black Dragon",source:"5e SRD",size:"Gargantuan",type:"dragon",subtype:"",alignment:"chaotic evil",ac:22,hp:367,hit_dice:"21d20 + 146",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[27,14,25,16,15,19],saves:[{dexterity:9},{constitution:14},{wisdom:9},{charisma:11}],skillsaves:[{perception:16},{stealth:9}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 26",languages:"Common, Draconic",cr:"21",bestiary:!0,traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack:+ 15 to hit, reach 15 ft., one target. Hit: 19 (2d10 + 8) piercing damage plus 9 (2d8) acid damage.",attack_bonus:15,damage_dice:"2d10 + 2d8",damage_bonus:8},{name:"Claw",desc:"Melee Weapon Attack: +15 to hit, reach 10 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",attack_bonus:15,damage_dice:"2d6",damage_bonus:8},{name:"Tail",desc:"Melee Weapon Attack: +15 to hit, reach 20 ft ., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",attack_bonus:15,damage_dice:"2d8",damage_bonus:8},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 19 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Acid Breath (Recharge 5-6)",desc:"The dragon exhales acid in a 90-foot line that is 10 feet wide. Each creature in that line must make a DC 22 Dexterity saving throw, taking 67 (15d8) acid damage on a failed save, or half as much damage on a successful one.",attack_bonus:0}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 23 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Ancient Blue Dragon",source:"5e SRD",size:"Gargantuan",type:"dragon",subtype:"",alignment:"lawful evil",ac:22,hp:481,hit_dice:"26d20 + 208",speed:"40 ft., burrow 40 ft., fly 80 ft.",stats:[29,10,27,18,17,21],saves:[{dexterity:7},{constitution:15},{wisdom:10},{charisma:12}],skillsaves:[{perception:17},{stealth:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 27",languages:"Common, Draconic",cr:"23",bestiary:!0,actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +16 to hit, reach 15 ft., one target. Hit: 20 (2d10 + 9) piercing damage plus 11 (2d10) lightning damage.",attack_bonus:16,damage_dice:"2d10 + 2d10",damage_bonus:9},{name:"Claw",desc:"Melee Weapon Attack: +16 to hit, reach 10 ft., one target. Hit: 16 (2d6 + 9) slashing damage.",attack_bonus:16,damage_dice:"2d6",damage_bonus:9},{name:"Tail",desc:"Melee Weapon Attack: +16 to hit, reach 20 ft., one target. Hit: 18 (2d8 + 9) bludgeoning damage.",attack_bonus:16,damage_dice:"2d8",damage_bonus:9},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 20 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Lightning Breath (Recharge 5-6)",desc:"The dragon exhales lightning in a 120-foot line that is 10 feet wide. Each creature in that line must make a DC 23 Dexterity saving throw, taking 88 (16d10) lightning damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"16d10"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 24 Dexterity saving throw or take 16 (2d6 + 9) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Ancient Brass Dragon",source:"5e SRD",size:"Gargantuan",type:"dragon",subtype:"",alignment:"chaotic good",ac:20,hp:297,hit_dice:"17d20 + 118",speed:"40 ft., burrow 40 ft., fly 80 ft.",stats:[27,10,25,16,15,19],saves:[{dexterity:6},{constitution:13},{wisdom:8},{charisma:10}],skillsaves:[{history:9},{persuasion:10},{perception:14},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 24",languages:"Common, Draconic",cr:"20",bestiary:!0,traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +14 to hit, reach 15 ft., one target. Hit: 19 (2d10 + 8) piercing damage.",attack_bonus:14,damage_dice:"2d10",damage_bonus:8},{name:"Claw",desc:"Melee Weapon Attack: +14 to hit, reach 10 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",attack_bonus:14,damage_dice:"2d6",damage_bonus:8},{name:"Tail",desc:"Melee Weapon Attack: +14 to hit, reach 20 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",attack_bonus:14,damage_dice:"2d8",damage_bonus:8},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 18 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons:
Fire Breath. The dragon exhales fire in an 90-foot line that is 10 feet wide. Each creature in that line must make a DC 21 Dexterity saving throw, taking 56 (16d6) fire damage on a failed save, or half as much damage on a successful one.
Sleep Breath. The dragon exhales sleep gas in a 90-foot cone. Each creature in that area must succeed on a DC 21 Constitution saving throw or fall unconscious for 10 minutes. This effect ends for a creature if the creature takes damage or someone uses an action to wake it.`,attack_bonus:0,damage_dice:"16d6"},{name:"Change Shape",desc:`The dragon magically polymorphs into a humanoid or beast that has a challenge rating no higher than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the dragon's choice).
In a new form, the dragon retains its alignment, hit points, Hit Dice, ability to speak, proficiencies, Legendary Resistance, lair actions, and Intelligence, Wisdom, and Charisma scores, as well as this action. Its statistics and capabilities are otherwise replaced by those of the new form, except any class features or legendary actions of that form.`,attack_bonus:0}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 22 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Ancient Bronze Dragon",source:"5e SRD",size:"Gargantuan",type:"dragon",subtype:"",alignment:"lawful good",ac:22,hp:444,hit_dice:"24d20 + 192",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[29,10,27,18,17,21],saves:[{dexterity:7},{constitution:15},{wisdom:10},{charisma:12}],skillsaves:[{insight:10},{perception:17},{stealth:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 27",languages:"Common, Draconic",cr:"22",bestiary:!0,traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +16 to hit, reach 15 ft., one target. Hit: 20 (2d10 + 9) piercing damage.",attack_bonus:16,damage_dice:"2d10",damage_bonus:9},{name:"Claw",desc:"Melee Weapon Attack: +16 to hit, reach 10 ft., one target. Hit: 16 (2d6 + 9) slashing damage.",attack_bonus:16,damage_dice:"1d6",damage_bonus:9},{name:"Tail",desc:"Melee Weapon Attack: +16 to hit, reach 20 ft., one target. Hit: 18 (2d8 + 9) bludgeoning damage.",attack_bonus:0,damage_dice:"2d8",damage_bonus:9},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 20 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Lightning Breath. The dragon exhales lightning in a 120-foot line that is 10 feet wide. Each creature in that line must make a DC 23 Dexterity saving throw, taking 88 (16d10) lightning damage on a failed save, or half as much damage on a successful one.
Repulsion Breath. The dragon exhales repulsion energy in a 30-foot cone. Each creature in that area must succeed on a DC 23 Strength saving throw. On a failed save, the creature is pushed 60 feet away from the dragon.`,attack_bonus:0,damage_dice:"16d10"},{name:"Change Shape",desc:`The dragon magically polymorphs into a humanoid or beast that has a challenge rating no higher than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the dragon's choice).
In a new form, the dragon retains its alignment, hit points, Hit Dice, ability to speak, proficiencies, Legendary Resistance, lair actions, and Intelligence, Wisdom, and Charisma scores, as well as this action. Its statistics and capabilities are otherwise replaced by those of the new form, except any class features or legendary actions of that form.`,attack_bonus:0}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 24 Dexterity saving throw or take 16 (2d6 + 9) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Ancient Copper Dragon",source:"5e SRD",size:"Gargantuan",type:"dragon",subtype:"",alignment:"chaotic good",ac:21,hp:350,hit_dice:"20d20 + 140",speed:"40 ft., climb 40 ft., fly 80 ft.",stats:[27,12,25,20,17,19],saves:[{dexterity:8},{constitution:14},{wisdom:10},{charisma:11}],skillsaves:[{stealth:8},{perception:17},{deception:11}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 27",languages:"Common, Draconic",cr:"21",bestiary:!0,traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +15 to hit, reach 15 ft., one target. Hit: 19 (2d10 + 8) piercing damage.",attack_bonus:15,damage_dice:"2d10",damage_bonus:8},{name:"Claw",desc:"Melee Weapon Attack: +15 to hit, reach 10 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",attack_bonus:15,damage_dice:"2d6",damage_bonus:8},{name:"Tail",desc:"Melee Weapon Attack: +15 to hit, reach 20 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",attack_bonus:15,damage_dice:"2d8",damage_bonus:8},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 19 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Acid Breath. The dragon exhales acid in an 90-foot line that is 10 feet wide. Each creature in that line must make a DC 22 Dexterity saving throw, taking 63 (14d8) acid damage on a failed save, or half as much damage on a successful one.
Slowing Breath. The dragon exhales gas in a 90-foot cone. Each creature in that area must succeed on a DC 22 Constitution saving throw. On a failed save, the creature can't use reactions, its speed is halved, and it can't make more than one attack on its turn. In addition, the creature can use either an action or a bonus action on its turn, but not both. These effects last for 1 minute. The creature can repeat the saving throw at the end of each of its turns, ending the effect on itself with a successful save.`,attack_bonus:0,damage_dice:"14d8"},{name:"Change Shape",desc:`The dragon magically polymorphs into a humanoid or beast that has a challenge rating no higher than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the dragon's choice).
In a new form, the dragon retains its alignment, hit points, Hit Dice, ability to speak, proficiencies, Legendary Resistance, lair actions, and Intelligence, Wisdom, and Charisma scores, as well as this action. Its statistics and capabilities are otherwise replaced by those of the new form, except any class features or legendary actions of that form.`,attack_bonus:0}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 23 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Ancient Gold Dragon",source:"5e SRD",size:"Gargantuan",type:"dragon",subtype:"",alignment:"lawful good",ac:22,hp:546,hit_dice:"28d20 + 252",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[30,14,29,18,17,28],saves:[{dexterity:9},{constitution:16},{wisdom:10},{charisma:16}],skillsaves:[{persuasion:16},{stealth:9},{perception:17},{insight:10}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 27",languages:"Common, Draconic",cr:"24",bestiary:!0,traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +17 to hit, reach 15 ft., one target. Hit: 21 (2d10 + 10) piercing damage.",attack_bonus:17,damage_dice:"2d10",damage_bonus:10},{name:"Claw",desc:"Melee Weapon Attack: +17 to hit, reach 10 ft., one target. Hit: 17 (2d6 + 10) slashing damage.",attack_bonus:17,damage_dice:"2d6",damage_bonus:10},{name:"Tail",desc:"Melee Weapon Attack: +17 to hit, reach 20 ft., one target. Hit: 19 (2d8 + 10) bludgeoning damage.",attack_bonus:17,damage_dice:"2d8",damage_bonus:10},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 24 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Fire Breath. The dragon exhales fire in a 90-foot cone. Each creature in that area must make a DC 24 Dexterity saving throw, taking 71 (13d10) fire damage on a failed save, or half as much damage on a successful one.
Weakening Breath. The dragon exhales gas in a 90-foot cone. Each creature in that area must succeed on a DC 24 Strength saving throw or have disadvantage on Strength-based attack rolls, Strength checks, and Strength saving throws for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.`,attack_bonus:0,damage_dice:"13d10"},{name:"Change Shape",desc:`The dragon magically polymorphs into a humanoid or beast that has a challenge rating no higher than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the dragon's choice).
In a new form, the dragon retains its alignment, hit points, Hit Dice, ability to speak, proficiencies, Legendary Resistance, lair actions, and Intelligence, Wisdom, and Charisma scores, as well as this action. Its statistics and capabilities are otherwise replaced by those of the new form, except any class features or legendary actions of that form.`,attack_bonus:0}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 25 Dexterity saving throw or take 17 (2d6 + 10) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Ancient Green Dragon",source:"5e SRD",size:"Gargantuan",type:"dragon",subtype:"",alignment:"lawful evil",ac:21,hp:385,hit_dice:"22d20 + 154",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[27,12,25,20,17,19],saves:[{dexterity:8},{constitution:14},{wisdom:10},{charisma:11}],skillsaves:[{deception:11},{insight:10},{perception:17},{persuasion:11},{stealth:8}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"poisoned",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 27",languages:"Common, Draconic",cr:"22",bestiary:!0,traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +15 to hit, reach 15 ft., one target. Hit: 19 (2d10 + 8) piercing damage plus 10 (3d6) poison damage.",attack_bonus:15,damage_dice:"2d10 + 3d6",damage_bonus:9},{name:"Claw",desc:"Melee Weapon Attack: +15 to hit, reach 10 ft., one target. Hit: 22 (4d6 + 8) slashing damage.",attack_bonus:15,damage_dice:"4d6",damage_bonus:8},{name:"Tail",desc:"Melee Weapon Attack: +15 to hit, reach 20 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",attack_bonus:16,damage_dice:"2d8",damage_bonus:8},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 19 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Poison Breath (Recharge 5-6)",desc:"The dragon exhales poisonous gas in a 90-foot cone. Each creature in that area must make a DC 22 Constitution saving throw, taking 77 (22d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"22d6"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 23 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Ancient Red Dragon",source:"5e SRD",size:"Gargantuan",type:"dragon",subtype:"",alignment:"chaotic evil",ac:22,hp:546,hit_dice:"28d20 + 252",speed:"40 ft., climb 40 ft., fly 80 ft.",stats:[30,10,29,18,15,23],saves:[{dexterity:7},{constitution:16},{wisdom:9},{charisma:13}],skillsaves:[{perception:16},{stealth:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 26",languages:"Common, Draconic",cr:"24",bestiary:!0,traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +17 to hit, reach 15 ft., one target. Hit: 21 (2d10 + 10) piercing damage plus 14 (4d6) fire damage.",attack_bonus:17,damage_dice:"2d10 + 4d6",damage_bonus:10},{name:"Claw",desc:"Melee Weapon Attack: +17 to hit, reach 10 ft., one target. Hit: 17 (2d6 + 10) slashing damage.",attack_bonus:17,damage_dice:"2d6",damage_bonus:10},{name:"Tail",desc:"Melee Weapon Attack: +17 to hit, reach 20 ft., one target. Hit: 19 (2d8 + 10) bludgeoning damage.",attack_bonus:17,damage_dice:"2d8",damage_bonus:10},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 21 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Fire Breath (Recharge 5-6)",desc:"The dragon exhales fire in a 90-foot cone. Each creature in that area must make a DC 24 Dexterity saving throw, taking 91 (26d6) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"26d6"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 25 Dexterity saving throw or take 17 (2d6 + 10) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Ancient Silver Dragon",source:"5e SRD",size:"Gargantuan",type:"dragon",subtype:"",alignment:"lawful good",ac:22,hp:487,hit_dice:"25d20 + 224",speed:"40 ft., fly 80 ft.",stats:[30,10,29,18,15,23],saves:[{dexterity:7},{constitution:16},{wisdom:9},{charisma:13}],skillsaves:[{arcana:11},{perception:16},{history:11},{stealth:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 26",languages:"Common, Draconic",cr:"23",bestiary:!0,traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +17 to hit, reach 15 ft., one target. Hit: 21 (2d10 + 10) piercing damage.",attack_bonus:17,damage_dice:"2d10",damage_bonus:10},{name:"Claw",desc:"Melee Weapon Attack: +17 to hit, reach 10 ft., one target. Hit: 17 (2d6 + 10) slashing damage.",attack_bonus:17,damage_dice:"2d6",damage_bonus:10},{name:"Tail",desc:"Melee Weapon Attack: +17 to hit, reach 20 ft., one target. Hit: 19 (2d8 + 10) bludgeoning damage.",attack_bonus:17,damage_dice:"2d8",damage_bonus:10},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 21 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Cold Breath. The dragon exhales an icy blast in a 90-foot cone. Each creature in that area must make a DC 24 Constitution saving throw, taking 67 (15d8) cold damage on a failed save, or half as much damage on a successful one.
Paralyzing Breath. The dragon exhales paralyzing gas in a 90- foot cone. Each creature in that area must succeed on a DC 24 Constitution saving throw or be paralyzed for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.`,attack_bonus:0,damage_dice:"15d8"},{name:"Change Shape",desc:`The dragon magically polymorphs into a humanoid or beast that has a challenge rating no higher than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the dragon's choice).
In a new form, the dragon retains its alignment, hit points, Hit Dice, ability to speak, proficiencies, Legendary Resistance, lair actions, and Intelligence, Wisdom, and Charisma scores, as well as this action. Its statistics and capabilities are otherwise replaced by those of the new form, except any class features or legendary actions of that form.`,attack_bonus:0}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 25 Dexterity saving throw or take 17 (2d6 + 10) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Ancient White Dragon",source:"5e SRD",size:"Gargantuan",type:"dragon",subtype:"",alignment:"chaotic evil",ac:20,hp:333,hit_dice:"18d20 + 144",speed:"40 ft., burrow 40 ft., fly 80 ft., swim 40 ft.",stats:[26,10,26,10,13,14],saves:[{dexterity:6},{constitution:14},{wisdom:7},{charisma:8}],skillsaves:[{perception:13},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 23",languages:"Common, Draconic",cr:"20",bestiary:!0,traits:[{name:"Ice Walk",desc:"The dragon can move across and climb icy surfaces without needing to make an ability check. Additionally, difficult terrain composed of ice or snow doesn't cost it extra moment.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +14 to hit, reach 15 ft., one target. Hit: 19 (2d10 + 8) piercing damage plus 9 (2d8) cold damage.",attack_bonus:14,damage_dice:"2d10 + 2d8",damage_bonus:8},{name:"Claw",desc:"Melee Weapon Attack: +14 to hit, reach 10 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",attack_bonus:14,damage_dice:"2d6",damage_bonus:8},{name:"Tail",desc:"Melee Weapon Attack: +14 to hit, reach 20 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",attack_bonus:14,damage_dice:"2d8",damage_bonus:8},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 16 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours .",attack_bonus:0},{name:"Cold Breath (Recharge 5-6)",desc:"The dragon exhales an icy blast in a 90-foot cone. Each creature in that area must make a DC 22 Constitution saving throw, taking 72 (l6d8) cold damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"16d8"}]},{name:"Androsphinx",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"lawful neutral",ac:17,hp:199,hit_dice:"19d10 + 94",speed:"40 ft., fly 60 ft.",stats:[22,10,20,16,18,23],saves:[{dexterity:6},{constitution:11},{intelligence:9},{wisdom:10}],skillsaves:[{religion:15},{perception:10},{arcana:9}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"psychic; bludgeoning, piercing, and slashing from nonmagical weapons",condition_immunities:"charmed, frightened",senses:"truesight 120 ft., passive Perception 20",languages:"Common, Sphinx",cr:"17",bestiary:!0,traits:[{name:"Inscrutable",desc:"The sphinx is immune to any effect that would sense its emotions or read its thoughts, as well as any divination spell that it refuses. Wisdom (Insight) checks made to ascertain the sphinx's intentions or sincerity have disadvantage.",attack_bonus:0},{name:"Magic Weapons",desc:"The sphinx's weapon attacks are magical.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The sphinx makes two claw attacks.",attack_bonus:0},{name:"Claw",desc:"Melee Weapon Attack: +12 to hit, reach 5 ft., one target. Hit: 17 (2d10 + 6) slashing damage.",attack_bonus:12,damage_dice:"2d10",damage_bonus:6},{name:"Roar (3/Day)",desc:`The sphinx emits a magical roar. Each time it roars before finishing a long rest, the roar is louder and the effect is different, as detailed below. Each creature within 500 feet of the sphinx and able to hear the roar must make a saving throw.
First Roar. Each creature that fails a DC 18 Wisdom saving throw is frightened for 1 minute. A frightened creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.
Second Roar. Each creature that fails a DC 18 Wisdom saving throw is deafened and frightened for 1 minute. A frightened creature is paralyzed and can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.
Third Roar. Each creature makes a DC 18 Constitution saving throw. On a failed save, a creature takes 44 (8d10) thunder damage and is knocked prone. On a successful save, the creature takes half as much damage and isn't knocked prone.`,attack_bonus:0}],legendary_actions:[{name:"Claw Attack",desc:"The sphinx makes one claw attack.",attack_bonus:0},{name:"Teleport (Costs 2 Actions)",desc:"The sphinx magically teleports, along with any equipment it is wearing or carrying, up to 120 feet to an unoccupied space it can see.",attack_bonus:0},{name:"Cast a Spell (Costs 3 Actions)",desc:"The sphinx casts a spell from its list of prepared spells, using a spell slot as normal.",attack_bonus:0}],spells:["The sphinx is a 12th-level spellcaster. Its spellcasting ability is Wisdom (spell save DC 18, +10 to hit with spell attacks). It requires no material components to cast its spells. The sphinx has the following cleric spells prepared:",{"Cantrips (at will)":"sacred flame, spare the dying, thaumaturgy"},{"1st level (4 slots)":"command, detect evil and good, detect magic"},{"2nd level (3 slots)":"lesser restoration, zone of truth"},{"3rd level (3 slots)":"dispel magic, tongues"},{"4th level (3 slots)":"banishment, freedom of movement"},{"5th level (2 slots)":"flame strike, greater restoration"},{"6th level (1 slot)":"heroes' feast"}]},{name:"Animated Armor",source:"5e SRD",size:"Medium",type:"construct",subtype:"",alignment:"unaligned",ac:18,hp:33,hit_dice:"6d8 + 6",speed:"25 ft.",stats:[14,11,13,1,3,1],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison, psychic",condition_immunities:"blinded, charmed, deafened, exhaustion, frightened, paralyzed, petrified, poisoned",senses:"blindsight 60 ft. (blind beyond this radius), passive Perception 6",languages:"",cr:"1",bestiary:!0,traits:[{name:"Antimagic Susceptibility",desc:"The armor is incapacitated while in the area of an antimagic field. If targeted by dispel magic, the armor must succeed on a Constitution saving throw against the caster's spell save DC or fall unconscious for 1 minute.",attack_bonus:0},{name:"False Appearance",desc:"While the armor remains motionless, it is indistinguishable from a normal suit of armor.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The armor makes two melee attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) bludgeoning damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Ankheg",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"unaligned",ac:14,hp:39,hit_dice:"6d10 + 6",speed:"30 ft., burrow 10 ft.",stats:[17,11,13,1,13,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., tremorsense 60 ft., passive Perception 11",languages:"",cr:"2",bestiary:!0,actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage plus 3 (1d6) acid damage. If the target is a Large or smaller creature, it is grappled (escape DC 13). Until this grapple ends, the ankheg can bite only the grappled creature and has advantage on attack rolls to do so.",attack_bonus:5,damage_dice:"2d6 + 1d6",damage_bonus:3},{name:"Acid Spray (Recharge 6)",desc:"The ankheg spits acid in a line that is 30 ft. long and 5 ft. wide, provided that it has no creature grappled. Each creature in that line must make a DC 13 Dexterity saving throw, taking 10 (3d6) acid damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"3d6"}]},{name:"Ape",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:19,hit_dice:"3d8 + 5",speed:"30 ft., climb 30 ft.",stats:[16,14,14,6,12,7],skillsaves:[{athletics:5},{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"1/2",bestiary:!0,actions:[{name:"Multiattack",desc:"The ape makes two fist attacks.",attack_bonus:0},{name:"Fist",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) bludgeoning damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Rock",desc:"Ranged Weapon Attack: +5 to hit, range 25/50 ft., one target. Hit: 6 (1d6 + 3) bludgeoning damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3}]},{name:"Archmage",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:12,hp:99,hit_dice:"18d8 + 18",speed:"30 ft.",stats:[10,14,12,20,15,16],saves:[{intelligence:9},{wisdom:6}],skillsaves:[{arcana:13},{history:13}],damage_vulnerabilities:"",damage_resistances:"damage from spells; non magical bludgeoning, piercing, and slashing (from stoneskin)",damage_immunities:"",condition_immunities:"",senses:"passive Perception 12",languages:"any six languages",cr:"12",bestiary:!0,traits:[{name:"Magic Resistance",desc:"The archmage has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Dagger",desc:"Melee or Ranged Weapon Attack: +6 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 4 (1d4 + 2) piercing damage.",attack_bonus:6,damage_dice:"1d4",damage_bonus:2}],spells:["The archmage is an 18th-level spellcaster. Its spellcasting ability is Intelligence (spell save DC 17, +9 to hit with spell attacks). The archmage can cast disguise self and invisibility at will and has the following wizard spells prepared:",{"Cantrips (at will)":"fire bolt, light, mage hand, prestidigitation, shocking grasp"},{"1st level (4 slots)":"detect magic, identify, mage armor*, magic missile"},{"2nd level (3 slots)":"detect thoughts, mirror image, misty step"},{"3rd level (3 slots)":"counterspell,fly, lightning bolt"},{"4th level (3 slots)":"banishment, fire shield, stoneskin*"},{"5th level (3 slots)":"cone of cold, scrying, wall of force"},{"6th level (1 slot)":"globe of invulnerability"},{"7th level (1 slot)":"teleport"},{"8th level (1 slot)":"mind blank*"},{"9th level (1 slot)":"time stop"},"* The archmage casts these spells on itself before combat."]},{name:"Assassin",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any non-good alignment",ac:15,hp:78,hit_dice:"12d8 + 24",speed:"30 ft.",stats:[11,16,14,13,11,10],saves:[{dexterity:6},{intelligence:4}],skillsaves:[{acrobatics:6},{deception:3},{perception:3},{stealth:9}],damage_vulnerabilities:"",damage_resistances:"poison",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"Thieves' cant plus any two languages",cr:"8",bestiary:!0,traits:[{name:"Assassinate",desc:"During its first turn, the assassin has advantage on attack rolls against any creature that hasn't taken a turn. Any hit the assassin scores against a surprised creature is a critical hit.",attack_bonus:0},{name:"Evasion",desc:"If the assassin is subjected to an effect that allows it to make a Dexterity saving throw to take only half damage, the assassin instead takes no damage if it succeeds on the saving throw, and only half damage if it fails.",attack_bonus:0},{name:"Sneak Attack (1/Turn)",desc:"The assassin deals an extra 13 (4d6) damage when it hits a target with a weapon attack and has advantage on the attack roll, or when the target is within 5 ft. of an ally of the assassin that isn't incapacitated and the assassin doesn't have disadvantage on the attack roll.",attack_bonus:0,damage_dice:"4d6"}],actions:[{name:"Multiattack",desc:"The assassin makes two shortsword attacks.",attack_bonus:0},{name:"Shortsword",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) piercing damage, and the target must make a DC 15 Constitution saving throw, taking 24 (7d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:6,damage_dice:"1d6",damage_bonus:3},{name:"Light Crossbow",desc:"Ranged Weapon Attack: +6 to hit, range 80/320 ft., one target. Hit: 7 (1d8 + 3) piercing damage, and the target must make a DC 15 Constitution saving throw, taking 24 (7d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:6,damage_dice:"1d8",damage_bonus:3}]},{name:"Awakened Shrub",source:"5e SRD",size:"Small",type:"plant",subtype:"",alignment:"unaligned",ac:9,hp:10,hit_dice:"3d6 + -1",speed:"20 ft.",stats:[3,8,11,10,10,6],damage_vulnerabilities:"fire",damage_resistances:"piercing",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"one language known by its creator",cr:"0",bestiary:!0,traits:[{name:"False Appearance",desc:"While the shrub remains motionless, it is indistinguishable from a normal shrub.",attack_bonus:0}],actions:[{name:"Rake",desc:"Melee Weapon Attack: +1 to hit, reach 5 ft., one target. Hit: 1 (1d4 \u2014 1) slashing damage.",attack_bonus:1,damage_dice:"1d4",damage_bonus:-1}]},{name:"Awakened Tree",source:"5e SRD",size:"Huge",type:"plant",subtype:"",alignment:"unaligned",ac:13,hp:59,hit_dice:"7d12 + 13",speed:"20 ft.",stats:[19,6,15,10,10,7],damage_vulnerabilities:"fire",damage_resistances:"bludgeoning, piercing",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"one language known by its creator",cr:"2",bestiary:!0,traits:[{name:"False Appearance",desc:"While the tree remains motionless, it is indistinguishable from a normal tree.",attack_bonus:0}],actions:[{name:"Slam",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 14 (3d6 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"3d6",damage_bonus:4}]},{name:"Axe Beak",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:19,hit_dice:"3d10 + 2",speed:"50 ft.",stats:[14,12,12,2,10,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"1/4",bestiary:!0,actions:[{name:"Beak",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) slashing damage.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2}]},{name:"Azer",source:"5e SRD",size:"Medium",type:"elemental",subtype:"",alignment:"lawful neutral",ac:17,hp:39,hit_dice:"6d8 + 12",speed:"30 ft.",stats:[17,12,15,12,13,10],saves:[{constitution:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"passive Perception 11",languages:"Ignan",cr:"2",bestiary:!0,traits:[{name:"Heated Body",desc:"A creature that touches the azer or hits it with a melee attack while within 5 ft. of it takes 5 (1d10) fire damage.",attack_bonus:0,damage_dice:"1d10"},{name:"Heated Weapons",desc:"When the azer hits with a metal melee weapon, it deals an extra 3 (1d6) fire damage (included in the attack).",attack_bonus:0},{name:"Illumination",desc:"The azer sheds bright light in a 10-foot radius and dim light for an additional 10 ft..",attack_bonus:0}],actions:[{name:"Warhammer",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) bludgeoning damage, or 8 (1d10 + 3) bludgeoning damage if used with two hands to make a melee attack, plus 3 (1d6) fire damage.",attack_bonus:5,damage_dice:"1d8 + 1d6",damage_bonus:3}]},{name:"Baboon",source:"5e SRD",size:"Small",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:3,hit_dice:"1d6 + -1",speed:"30 ft., climb 30 ft.",stats:[8,14,11,4,12,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 11",languages:"",cr:"0",bestiary:!0,traits:[{name:"Pack Tactics",desc:"The baboon has advantage on an attack roll against a creature if at least one of the baboon's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +1 to hit, reach 5 ft., one target. Hit: 1 (1d4 \u2014 1) piercing damage.",attack_bonus:1,damage_dice:"1d4",damage_bonus:-1}]},{name:"Badger",source:"5e SRD",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:3,hit_dice:"1d4",speed:"20 ft., burrow 5 ft.",stats:[4,11,12,2,12,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 11",languages:"",cr:"0",bestiary:!0,traits:[{name:"Keen Smell",desc:"The badger has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 1 piercing damage.",attack_bonus:2,damage_bonus:1}]},{name:"Balor",source:"5e SRD",size:"Huge",type:"fiend",subtype:"demon",alignment:"chaotic evil",ac:19,hp:262,hit_dice:"21d12 + 125",speed:"40 ft., fly 80 ft.",stats:[26,15,22,20,16,22],saves:[{strength:14},{constitution:12},{wisdom:9},{charisma:12}],damage_vulnerabilities:"",damage_resistances:"cold, lightning; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"truesight 120 ft., passive Perception 13",languages:"Abyssal, telepathy 120 ft.",cr:"19",bestiary:!0,traits:[{name:"Death Throes",desc:"When the balor dies, it explodes, and each creature within 30 feet of it must make a DC 20 Dexterity saving throw, taking 70 (20d6) fire damage on a failed save, or half as much damage on a successful one. The explosion ignites flammable objects in that area that aren't being worn or carried, and it destroys the balor's weapons.",attack_bonus:0,damage_dice:"20d6"},{name:"Fire Aura",desc:"At the start of each of the balor's turns, each creature within 5 feet of it takes 10 (3d6) fire damage, and flammable objects in the aura that aren't being worn or carried ignite. A creature that touches the balor or hits it with a melee attack while within 5 feet of it takes 10 (3d6) fire damage.",attack_bonus:0,damage_dice:"3d6"},{name:"Magic Resistance",desc:"The balor has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Magic Weapons",desc:"The balor's weapon attacks are magical.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The balor makes two attacks: one with its longsword and one with its whip.",attack_bonus:0},{name:"Longsword",desc:"Melee Weapon Attack: +14 to hit, reach 10 ft., one target. Hit: 21 (3d8 + 8) slashing damage plus 13 (3d8) lightning damage. If the balor scores a critical hit, it rolls damage dice three times, instead of twice.",attack_bonus:14,damage_dice:"3d8 + 3d8",damage_bonus:8},{name:"Whip",desc:"Melee Weapon Attack: +14 to hit, reach 30 ft., one target. Hit: 15 (2d6 + 8) slashing damage plus 10 (3d6) fire damage, and the target must succeed on a DC 20 Strength saving throw or be pulled up to 25 feet toward the balor.",attack_bonus:14,damage_dice:"2d6 + 3d6",damage_bonus:8},{name:"Teleport",desc:"The balor magically teleports, along with any equipment it is wearing or carrying, up to 120 feet to an unoccupied space it can see.",attack_bonus:0},{name:"Variant: Summon Demon (1/Day)",desc:`The demon chooses what to summon and attempts a magical summoning.
A balor has a 50 percent chance of summoning 1d8 vrocks, 1d6 hezrous, 1d4 glabrezus, 1d3 nalfeshnees, 1d2 mariliths, or one goristro.
A summoned demon appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other demons. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.`,attack_bonus:0}]},{name:"Bandit",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any non-lawful alignment",ac:12,hp:11,hit_dice:"2d8 + 2",speed:"30 ft.",stats:[11,12,12,10,10,10],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"any one language (usually Common)",cr:"1/8",bestiary:!0,actions:[{name:"Scimitar",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) slashing damage.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1},{name:"Light Crossbow",desc:"Ranged Weapon Attack: +3 to hit, range 80 ft./320 ft., one target. Hit: 5 (1d8 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d8",damage_bonus:1}]},{name:"Bandit Captain",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any non-lawful alignment",ac:15,hp:65,hit_dice:"10d8 + 20",speed:"30 ft.",stats:[15,16,14,14,11,14],saves:[{strength:4},{dexterity:5},{wisdom:2}],skillsaves:[{athletics:4},{deception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"any two languages",cr:"2",bestiary:!0,actions:[{name:"Multiattack",desc:"The captain makes three melee attacks: two with its scimitar and one with its dagger. Or the captain makes two ranged attacks with its daggers.",attack_bonus:0},{name:"Scimitar",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Dagger",desc:"Melee or Ranged Weapon Attack: +5 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 5 (1d4 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d4",damage_bonus:3}],reactions:[{name:"Parry",desc:"The captain adds 2 to its AC against one melee attack that would hit it. To do so, the captain must see the attacker and be wielding a melee weapon.",attack_bonus:0}]},{name:"Barbed Devil",source:"5e SRD",size:"Medium",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:15,hp:110,hit_dice:"13d8 + 51",speed:"30 ft.",stats:[16,17,18,12,14,14],saves:[{strength:6},{constitution:7},{wisdom:5},{charisma:5}],skillsaves:[{deception:5},{insight:5},{perception:8}],damage_vulnerabilities:"",damage_resistances:"cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"darkvision 120 ft., passive Perception 18",languages:"Infernal, telepathy 120 ft.",cr:"5",bestiary:!0,traits:[{name:"Barbed Hide",desc:"At the start of each of its turns, the barbed devil deals 5 (1d10) piercing damage to any creature grappling it.",attack_bonus:0,damage_dice:"1d10"},{name:"Devil's Sight",desc:"Magical darkness doesn't impede the devil's darkvision.",attack_bonus:0},{name:"Magic Resistance",desc:"The devil has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The devil makes three melee attacks: one with its tail and two with its claws. Alternatively, it can use Hurl Flame twice.",attack_bonus:0},{name:"Claw",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft ., one target. Hit: 6 (1d6 + 3) piercing damage.",attack_bonus:6,damage_dice:"1d6",damage_bonus:3},{name:"Tail",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) piercing damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:3},{name:"Hurl Flame",desc:"Ranged Spell Attack: +5 to hit, range 150 ft., one target. Hit: 10 (3d6) fire damage. If the target is a flammable object that isn't being worn or carried, it also catches fire.",attack_bonus:5,damage_dice:"3d6"}]},{name:"Basilisk",source:"5e SRD",size:"Medium",type:"monstrosity",subtype:"",alignment:"unaligned",ac:12,hp:52,hit_dice:"8d8 + 16",speed:"20 ft.",stats:[16,8,15,2,8,7],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 9",languages:"",cr:"3",bestiary:!0,traits:[{name:"Petrifying Gaze",desc:`If a creature starts its turn within 30 ft. of the basilisk and the two of them can see each other, the basilisk can force the creature to make a DC 12 Constitution saving throw if the basilisk isn't incapacitated. On a failed save, the creature magically begins to turn to stone and is restrained. It must repeat the saving throw at the end of its next turn. On a success, the effect ends. On a failure, the creature is petrified until freed by the greater restoration spell or other magic.
A creature that isn't surprised can avert its eyes to avoid the saving throw at the start of its turn. If it does so, it can't see the basilisk until the start of its next turn, when it can avert its eyes again. If it looks at the basilisk in the meantime, it must immediately make the save.
If the basilisk sees its reflection within 30 ft. of it in bright light, it mistakes itself for a rival and targets itself with its gaze.`,attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) piercing damage plus 7 (2d6) poison damage.",attack_bonus:5,damage_dice:"2d6 + 2d6",damage_bonus:3}]},{name:"Bat",source:"5e SRD",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:1,hit_dice:"1d4 + -2",speed:"5 ft., fly 30 ft.",stats:[2,15,8,2,12,4],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 60 ft., passive Perception 11",languages:"",cr:"0",bestiary:!0,traits:[{name:"Echolocation",desc:"The bat can't use its blindsight while deafened.",attack_bonus:0},{name:"Keen Hearing",desc:"The bat has advantage on Wisdom (Perception) checks that rely on hearing.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +0 to hit, reach 5 ft., one creature. Hit: 1 piercing damage.",attack_bonus:0,damage_bonus:1}]},{name:"Bearded Devil",source:"5e SRD",size:"Medium",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:13,hp:52,hit_dice:"8d8 + 16",speed:"30 ft.",stats:[16,15,15,9,11,11],saves:[{strength:5},{constitution:4},{wisdom:2}],damage_vulnerabilities:"",damage_resistances:"cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"darkvision 120 ft., passive Perception 10",languages:"Infernal, telepathy 120 ft.",cr:"3",bestiary:!0,traits:[{name:"Devil's Sight",desc:"Magical darkness doesn't impede the devil's darkvision.",attack_bonus:0},{name:"Magic Resistance",desc:"The devil has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Steadfast",desc:"The devil can't be frightened while it can see an allied creature within 30 feet of it.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The devil makes two attacks: one with its beard and one with its glaive.",attack_bonus:0},{name:"Beard",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one creature. Hit: 6 (1d8 + 2) piercing damage, and the target must succeed on a DC 12 Constitution saving throw or be poisoned for 1 minute. While poisoned in this way, the target can't regain hit points. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:5,damage_dice:"1d8",damage_bonus:2},{name:"Glaive",desc:"Melee Weapon Attack: +5 to hit, reach 10 ft., one target. Hit: 8 (1d10 + 3) slashing damage. If the target is a creature other than an undead or a construct, it must succeed on a DC 12 Constitution saving throw or lose 5 (1d10) hit points at the start of each of its turns due to an infernal wound. Each time the devil hits the wounded target with this attack, the damage dealt by the wound increases by 5 (1d10). Any creature can take an action to stanch the wound with a successful DC 12 Wisdom (Medicine) check. The wound also closes if the target receives magical healing.",attack_bonus:5,damage_dice:"1d10",damage_bonus:3}]},{name:"Behir",source:"5e SRD",size:"Huge",type:"monstrosity",subtype:"",alignment:"neutral evil",ac:17,hp:168,hit_dice:"16d12 + 64",speed:"50 ft., climb 40 ft.",stats:[23,16,18,7,14,12],skillsaves:[{perception:6},{stealth:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning",condition_immunities:"",senses:"darkvision 90 ft., passive Perception 16",languages:"Draconic",cr:"11",bestiary:!0,actions:[{name:"Multiattack",desc:"The behir makes two attacks: one with its bite and one to constrict.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 22 (3d10 + 6) piercing damage.",attack_bonus:10,damage_dice:"3d10",damage_bonus:6},{name:"Constrict",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one Large or smaller creature. Hit: 17 (2d10 + 6) bludgeoning damage plus 17 (2d10 + 6) slashing damage. The target is grappled (escape DC 16) if the behir isn't already constricting a creature, and the target is restrained until this grapple ends.",attack_bonus:10,damage_dice:"2d10 + 2d10",damage_bonus:6},{name:"Lightning Breath (Recharge 5-6)",desc:"The behir exhales a line of lightning that is 20 ft. long and 5 ft. wide. Each creature in that line must make a DC 16 Dexterity saving throw, taking 66 (12d10) lightning damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"12d10"},{name:"Swallow",desc:`The behir makes one bite attack against a Medium or smaller target it is grappling. If the attack hits, the target is also swallowed, and the grapple ends. While swallowed, the target is blinded and restrained, it has total cover against attacks and other effects outside the behir, and it takes 21 (6d6) acid damage at the start of each of the behir's turns. A behir can have only one creature swallowed at a time.
If the behir takes 30 damage or more on a single turn from the swallowed creature, the behir must succeed on a DC 14 Constitution saving throw at the end of that turn or regurgitate the creature, which falls prone in a space within 10 ft. of the behir. If the behir dies, a swallowed creature is no longer restrained by it and can escape from the corpse by using 15 ft. of movement, exiting prone.`,attack_bonus:0,damage_dice:"6d6"}]},{name:"Berserker",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any chaotic alignment",ac:13,hp:67,hit_dice:"9d8 + 26",speed:"30 ft.",stats:[16,12,17,9,11,9],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"any one language (usually Common)",cr:"2",bestiary:!0,traits:[{name:"Reckless",desc:"At the start of its turn, the berserker can gain advantage on all melee weapon attack rolls during that turn, but attack rolls against it have advantage until the start of its next turn.",attack_bonus:0}],actions:[{name:"Greataxe",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 9 (1d12 + 3) slashing damage.",attack_bonus:5,damage_dice:"1d12",damage_bonus:3}]},{name:"Black Bear",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:19,hit_dice:"3d8 + 5",speed:"40 ft., climb 30 ft.",stats:[15,10,14,2,12,7],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"1/2",bestiary:!0,traits:[{name:"Keen Smell",desc:"The bear has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The bear makes two attacks: one with its bite and one with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:3,damage_dice:"1d6",damage_bonus:2},{name:"Claws",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) slashing damage.",attack_bonus:3,damage_dice:"2d4",damage_bonus:2}]},{name:"Black Dragon Wyrmling",source:"5e SRD",size:"Medium",type:"dragon",subtype:"",alignment:"chaotic evil",ac:17,hp:33,hit_dice:"6d8 + 6",speed:"30 ft., fly 60 ft., swim 30 ft.",stats:[15,14,13,10,11,13],saves:[{dexterity:4},{constitution:3},{wisdom:2},{charisma:3}],skillsaves:[{perception:4},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"2",bestiary:!0,traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (1d10 + 2) piercing damage plus 2 (1d4) acid damage.",attack_bonus:4,damage_dice:"1d10",damage_bonus:2},{name:"Acid Breath (Recharge 5-6)",desc:"The dragon exhales acid in a 15-foot line that is 5 feet wide. Each creature in that line must make a DC 11 Dexterity saving throw, taking 22 (Sd8) acid damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"5d8"}]},{name:"Black Pudding",source:"5e SRD",size:"Large",type:"ooze",subtype:"",alignment:"unaligned",ac:7,hp:85,hit_dice:"10d10 + 30",speed:"20 ft., climb 20 ft.",stats:[16,5,16,1,6,1],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid, cold, lightning, slashing",condition_immunities:"blinded, charmed, deafened, exhaustion, frightened, prone",senses:"blindsight 60 ft. (blind beyond this radius), passive Perception 8",languages:"",cr:"4",bestiary:!0,traits:[{name:"Amorphous",desc:"The pudding can move through a space as narrow as 1 inch wide without squeezing.",attack_bonus:0},{name:"Corrosive Form",desc:"A creature that touches the pudding or hits it with a melee attack while within 5 feet of it takes 4 (1d8) acid damage. Any nonmagical weapon made of metal or wood that hits the pudding corrodes. After dealing damage, the weapon takes a permanent and cumulative -1 penalty to damage rolls. If its penalty drops to -5, the weapon is destroyed. Nonmagical ammunition made of metal or wood that hits the pudding is destroyed after dealing damage. The pudding can eat through 2-inch-thick, nonmagical wood or metal in 1 round.",attack_bonus:0,damage_dice:"1d8"},{name:"Spider Climb",desc:"The pudding can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0}],actions:[{name:"Pseudopod",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) bludgeoning damage plus 18 (4d8) acid damage. In addition, nonmagical armor worn by the target is partly dissolved and takes a permanent and cumulative -1 penalty to the AC it offers. The armor is destroyed if the penalty reduces its AC to 10.",attack_bonus:5,damage_dice:"1d6 + 4d8",damage_bonus:3}],reactions:[{name:"Split",desc:"When a pudding that is Medium or larger is subjected to lightning or slashing damage, it splits into two new puddings if it has at least 10 hit points. Each new pudding has hit points equal to half the original pudding's, rounded down. New puddings are one size smaller than the original pudding.",attack_bonus:0}]},{name:"Blink Dog",source:"5e SRD",size:"Medium",type:"fey",subtype:"",alignment:"lawful good",ac:13,hp:22,hit_dice:"4d8 + 4",speed:"40 ft.",stats:[12,17,12,10,13,11],skillsaves:[{perception:3},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"Blink Dog, understands Sylvan but can't speak it",cr:"1/4",bestiary:!0,traits:[{name:"Keen Hearing and Smell",desc:"The dog has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1},{name:"Teleport (Recharge 4-6)",desc:"The dog magically teleports, along with any equipment it is wearing or carrying, up to 40 ft. to an unoccupied space it can see. Before or after teleporting, the dog can make one bite attack.",attack_bonus:0}]},{name:"Blood Hawk",source:"5e SRD",size:"Small",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:7,hit_dice:"2d6",speed:"10 ft., fly 60 ft.",stats:[6,14,10,3,14,5],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"",cr:"1/8",bestiary:!0,traits:[{name:"Keen Sight",desc:"The hawk has advantage on Wisdom (Perception) checks that rely on sight.",attack_bonus:0},{name:"Pack Tactics",desc:"The hawk has advantage on an attack roll against a creature if at least one of the hawk's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Beak",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Blue Dragon Wyrmling",source:"5e SRD",size:"Medium",type:"dragon",subtype:"",alignment:"lawful evil",ac:17,hp:52,hit_dice:"8d8 + 16",speed:"30 ft., burrow 15 ft., fly 60 ft.",stats:[17,10,15,12,11,15],saves:[{dexterity:2},{constitution:4},{wisdom:2},{charisma:4}],skillsaves:[{perception:4},{stealth:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"3",bestiary:!0,actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (1d10 + 3) piercing damage plus 3 (1d6) lightning damage.",attack_bonus:5,damage_dice:"1d10 + 1d6",damage_bonus:3},{name:"Lightning Breath (Recharge 5-6)",desc:"The dragon exhales lightning in a 30-foot line that is 5 feet wide. Each creature in that line must make a DC 12 Dexterity saving throw, taking 22 (4d10) lightning damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"4d10"}]},{name:"Boar",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:11,hit_dice:"2d8 + 2",speed:"40 ft.",stats:[13,11,12,2,9,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 9",languages:"",cr:"1/4",bestiary:!0,traits:[{name:"Charge",desc:"If the boar moves at least 20 ft. straight toward a target and then hits it with a tusk attack on the same turn, the target takes an extra 3 (1d6) slashing damage. If the target is a creature, it must succeed on a DC 11 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"1d6"},{name:"Relentless (Recharges after a Short or Long Rest)",desc:"If the boar takes 7 damage or less that would reduce it to 0 hit points, it is reduced to 1 hit point instead.",attack_bonus:0}],actions:[{name:"Tusk",desc:"Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) slashing damage.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Bone Devil",source:"5e SRD",size:"Large",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:19,hp:142,hit_dice:"15d10 + 59",speed:"40 ft., fly 40 ft.",stats:[18,16,18,13,14,16],saves:[{intelligence:5},{wisdom:6},{charisma:7}],skillsaves:[{deception:7},{insight:6}],damage_vulnerabilities:"",damage_resistances:"cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"darkvision 120 ft., passive Perception 9",languages:"Infernal, telepathy 120 ft.",cr:"12",bestiary:!0,traits:[{name:"Devil's Sight",desc:"Magical darkness doesn't impede the devil's darkvision.",attack_bonus:0},{name:"Magic Resistance",desc:"The devil has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The devil makes three attacks: two with its claws and one with its sting.",attack_bonus:0},{name:"Multiattack",desc:"The devil makes three attacks: two with its claws and one with its sting.",attack_bonus:0},{name:"Claw",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 8 (1d8 + 4) slashing damage.",attack_bonus:8,damage_dice:"1d8",damage_bonus:4},{name:"Claw",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 8 (1d8 + 4) slashing damage.",attack_bonus:8,damage_dice:"1d8",damage_bonus:4},{name:"Sting",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 13 (2d8 + 4) piercing damage plus 17 (5d6) poison damage, and the target must succeed on a DC 14 Constitution saving throw or become poisoned for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success .",attack_bonus:8,damage_dice:"2d8",damage_bonus:4},{name:"Sting",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 13 (2d8 + 4) piercing damage plus 17 (5d6) poison damage, and the target must succeed on a DC 14 Constitution saving throw or become poisoned for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success .",attack_bonus:8,damage_dice:"2d8",damage_bonus:4}]},{name:"Brass Dragon Wyrmling",source:"5e SRD",size:"Medium",type:"dragon",subtype:"",alignment:"chaotic good",ac:16,hp:16,hit_dice:"3d8 + 2",speed:"30 ft., burrow 15 ft., fly 60 ft.",stats:[15,10,13,10,11,13],saves:[{dexterity:2},{constitution:3},{wisdom:2},{charisma:3}],skillsaves:[{perception:4},{stealth:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"1",bestiary:!0,actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (1d10 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d10",damage_bonus:2},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Fire Breath. The dragon exhales fire in an 20-foot line that is 5 feet wide. Each creature in that line must make a DC 11 Dexterity saving throw, taking 14 (4d6) fire damage on a failed save, or half as much damage on a successful one.
Sleep Breath. The dragon exhales sleep gas in a 15-foot cone. Each creature in that area must succeed on a DC 11 Constitution saving throw or fall unconscious for 1 minute. This effect ends for a creature if the creature takes damage or someone uses an action to wake it.`,attack_bonus:0,damage_dice:"4d6"}]},{name:"Bronze Dragon Wyrmling",source:"5e SRD",size:"Medium",type:"dragon",subtype:"",alignment:"lawful good",ac:17,hp:32,hit_dice:"5d8 + 9",speed:"30 ft., fly 60 ft., swim 30 ft.",stats:[17,10,15,12,11,15],saves:[{dexterity:2},{constitution:4},{wisdom:2},{charisma:4}],skillsaves:[{perception:4},{stealth:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"2",bestiary:!0,traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (1d10 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d10",damage_bonus:3},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Lightning Breath. The dragon exhales lightning in a 40-foot line that is 5 feet wide. Each creature in that line must make a DC 12 Dexterity saving throw, taking 16 (3d10) lightning damage on a failed save, or half as much damage on a successful one.
Repulsion Breath. The dragon exhales repulsion energy in a 30-foot cone. Each creature in that area must succeed on a DC 12 Strength saving throw. On a failed save, the creature is pushed 30 feet away from the dragon.`,attack_bonus:0,damage_dice:"3d10"}]},{name:"Brown Bear",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:34,hit_dice:"4d10 + 12",speed:"40 ft., climb 30 ft.",stats:[19,10,16,2,13,7],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"1",bestiary:!0,traits:[{name:"Keen Smell",desc:"The bear has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The bear makes two attacks: one with its bite and one with its claws.",attack_bonus:0},{name:"Bite",desc:"Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (1d8 + 4) piercing damage.",attack_bonus:5,damage_dice:"1d8",damage_bonus:4},{name:"Claws",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:5,damage_dice:"2d6",damage_bonus:4}]},{name:"Bugbear",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"goblinoid",alignment:"chaotic evil",ac:16,hp:27,hit_dice:"5d8 + 4",speed:"30 ft.",stats:[15,14,13,8,11,9],skillsaves:[{stealth:6},{survival:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"Common, Goblin",cr:"1",bestiary:!0,traits:[{name:"Brute",desc:"A melee weapon deals one extra die of its damage when the bugbear hits with it (included in the attack).",attack_bonus:0},{name:"Surprise Attack",desc:"If the bugbear surprises a creature and hits it with an attack during the first round of combat, the target takes an extra 7 (2d6) damage from the attack.",attack_bonus:0,damage_dice:"2d6"}],actions:[{name:"Morningstar",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 11 (2d8 + 2) piercing damage.",attack_bonus:4,damage_dice:"2d8",damage_bonus:2},{name:"Javelin",desc:"Melee or Ranged Weapon Attack: +4 to hit, reach 5 ft. or range 30/120 ft., one target. Hit: 9 (2d6 + 2) piercing damage in melee or 5 (1d6 + 2) piercing damage at range.",attack_bonus:4,damage_dice:"2d6",damage_bonus:2}]},{name:"Bulette",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"unaligned",ac:17,hp:94,hit_dice:"9d10 + 44",speed:"40 ft., burrow 40 ft.",stats:[19,11,21,2,10,5],skillsaves:[{perception:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., tremorsense 60 ft., passive Perception 16",languages:"",cr:"5",bestiary:!0,traits:[{name:"Standing Leap",desc:"The bulette's long jump is up to 30 ft. and its high jump is up to 15 ft., with or without a running start.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 30 (4d12 + 4) piercing damage.",attack_bonus:7,damage_dice:"4d12",damage_bonus:4},{name:"Deadly Leap",desc:"If the bulette jumps at least 15 ft. as part of its movement, it can then use this action to land on its ft. in a space that contains one or more other creatures. Each of those creatures must succeed on a DC 16 Strength or Dexterity saving throw (target's choice) or be knocked prone and take 14 (3d6 + 4) bludgeoning damage plus 14 (3d6 + 4) slashing damage. On a successful save, the creature takes only half the damage, isn't knocked prone, and is pushed 5 ft. out of the bulette's space into an unoccupied space of the creature's choice. If no unoccupied space is within range, the creature instead falls prone in the bulette's space.",attack_bonus:0}]},{name:"Camel",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:9,hp:15,hit_dice:"2d10 + 4",speed:"50 ft.",stats:[16,8,14,2,8,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 9",languages:"",cr:"1/8",bestiary:!0,actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 2 (1d4) bludgeoning damage.",attack_bonus:5,damage_dice:"1d4"}]},{name:"Carrion Crawler",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"unaligned",ac:13,hp:51,hit_dice:"6d10 + 18",speed:"30 ft., climb 30 ft.",stats:[14,13,16,1,12,5],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 13",languages:"",cr:"2",bestiary:!0,traits:[{name:"Keen Smell",desc:"The carrion crawler has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0},{name:"Spider Climb",desc:"The carrion crawler can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The carrion crawler makes two attacks: one with its tentacles and one with its bite.",attack_bonus:0},{name:"Tentacles",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one creature. Hit: 4 (1d4 + 2) poison damage, and the target must succeed on a DC 13 Constitution saving throw or be poisoned for 1 minute. Until this poison ends, the target is paralyzed. The target can repeat the saving throw at the end of each of its turns, ending the poison on itself on a success.",attack_bonus:8,damage_dice:"1d4",damage_bonus:2},{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) piercing damage.",attack_bonus:4,damage_dice:"2d4",damage_bonus:2}]},{name:"Cat",source:"5e SRD",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:2,hit_dice:"1d4 + -1",speed:"40 ft., climb 30 ft.",stats:[3,15,10,3,12,7],skillsaves:[{perception:3},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"0",bestiary:!0,traits:[{name:"Keen Smell",desc:"The cat has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Claws",desc:"Melee Weapon Attack: +0 to hit, reach 5 ft., one target. Hit: 1 slashing damage.",attack_bonus:0,damage_bonus:1}]},{name:"Cave Bear",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:42,hit_dice:"5d10 + 14",speed:"40 ft., swim 30 ft.",stats:[20,10,16,2,13,7],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 13",languages:"",cr:"2",bestiary:!0,traits:[{name:"Keen Smell",desc:"The bear has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The bear makes two attacks: one with its bite and one with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 9 (1d8 + 5) piercing damage.",attack_bonus:7,damage_dice:"1d8",damage_bonus:5},{name:"Claws",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:5}]},{name:"Centaur",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"neutral good",ac:12,hp:45,hit_dice:"6d10 + 12",speed:"50 ft.",stats:[18,14,14,9,13,11],skillsaves:[{athletics:6},{perception:3},{survival:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"Elvish, Sylvan",cr:"2",bestiary:!0,traits:[{name:"Charge",desc:"If the centaur moves at least 30 ft. straight toward a target and then hits it with a pike attack on the same turn, the target takes an extra 10 (3d6) piercing damage.",attack_bonus:0,damage_dice:"3d6"}],actions:[{name:"Multiattack",desc:"The centaur makes two attacks: one with its pike and one with its hooves or two with its longbow.",attack_bonus:0},{name:"Pike",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 9 (1d10 + 4) piercing damage.",attack_bonus:6,damage_dice:"1d10",damage_bonus:4},{name:"Hooves",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4},{name:"Longbow",desc:"Ranged Weapon Attack: +4 to hit, range 150/600 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2}]},{name:"Chain Devil",source:"5e SRD",size:"Medium",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:16,hp:85,hit_dice:"10d8 + 40",speed:"30 ft.",stats:[18,15,18,11,12,14],damage_vulnerabilities:"",damage_resistances:"cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"darkvision 120 ft., passive Perception 8",languages:"Infernal, telepathy 120 ft.",cr:"11",bestiary:!0,traits:[{name:"Devil's Sight",desc:"Magical darkness doesn't impede the devil's darkvision.",attack_bonus:0},{name:"Magic Resistance",desc:"The devil has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The devil makes two attacks with its chains.",attack_bonus:0},{name:"Chain",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 11 (2d6 + 4) slashing damage. The target is grappled (escape DC 14) if the devil isn't already grappling a creature. Until this grapple ends, the target is restrained and takes 7 (2d6) piercing damage at the start of each of its turns.",attack_bonus:8,damage_dice:"2d6",damage_bonus:4},{name:"Animate Chains (Recharges after a Short or Long Rest)",desc:`Up to four chains the devil can see within 60 feet of it magically sprout razor-edged barbs and animate under the devil's control, provided that the chains aren't being worn or carried.
Each animated chain is an object with AC 20, 20 hit points, resistance to piercing damage, and immunity to psychic and thunder damage. When the devil uses Multiattack on its turn, it can use each animated chain to make one additional chain attack. An animated chain can grapple one creature of its own but can't make attacks while grappling. An animated chain reverts to its inanimate state if reduced to 0 hit points or if the devil is incapacitated or dies.`,attack_bonus:0}],reactions:[{name:"Unnerving Mask",desc:"When a creature the devil can see starts its turn within 30 feet of the devil, the devil can create the illusion that it looks like one of the creature's departed loved ones or bitter enemies. If the creature can see the devil, it must succeed on a DC 14 Wisdom saving throw or be frightened until the end of its turn.",attack_bonus:0}]},{name:"Chimera",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"chaotic evil",ac:14,hp:114,hit_dice:"12d10 + 48",speed:"30 ft., fly 60 ft.",stats:[19,11,19,3,14,10],skillsaves:[{perception:8}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 18",languages:"understands Draconic but can't speak",cr:"6",bestiary:!0,actions:[{name:"Multiattack",desc:"The chimera makes three attacks: one with its bite, one with its horns, and one with its claws. When its fire breath is available, it can use the breath in place of its bite or horns.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) piercing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Horns",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 10 (1d12 + 4) bludgeoning damage.",attack_bonus:7,damage_dice:"1d12",damage_bonus:4},{name:"Claws",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Fire Breath (Recharge 5-6)",desc:"The dragon head exhales fire in a 15-foot cone. Each creature in that area must make a DC 15 Dexterity saving throw, taking 31 (7d8) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"7d8"}]},{name:"Chuul",source:"5e SRD",size:"Large",type:"aberration",subtype:"",alignment:"chaotic evil",ac:16,hp:93,hit_dice:"11d10 + 32",speed:"30 ft., swim 30 ft.",stats:[19,10,16,5,11,5],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 14",languages:"understands Deep Speech but can't speak",cr:"4",bestiary:!0,traits:[{name:"Amphibious",desc:"The chuul can breathe air and water.",attack_bonus:0},{name:"Sense Magic",desc:"The chuul senses magic within 120 feet of it at will. This trait otherwise works like the detect magic spell but isn't itself magical.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The chuul makes two pincer attacks. If the chuul is grappling a creature, the chuul can also use its tentacles once.",attack_bonus:0},{name:"Pincer",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage. The target is grappled (escape DC 14) if it is a Large or smaller creature and the chuul doesn't have two other creatures grappled.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4},{name:"Tentacles",desc:"One creature grappled by the chuul must succeed on a DC 13 Constitution saving throw or be poisoned for 1 minute. Until this poison ends, the target is paralyzed. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:0}]},{name:"Clay Golem",source:"5e SRD",size:"Large",type:"construct",subtype:"",alignment:"unaligned",ac:14,hp:133,hit_dice:"14d10 + 56",speed:"20 ft.",stats:[20,9,18,3,8,1],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid, poison, psychic; bludgeoning, piercing, and slashing from nonmagical weapons that aren't adamantine",condition_immunities:"charmed, exhaustion, frightened, paralyzed, petrified, poisoned",senses:"darkvision 60 ft., passive Perception 9",languages:"understands the languages of its creator but can't speak",cr:"9",bestiary:!0,traits:[{name:"Acid Absorption",desc:"Whenever the golem is subjected to acid damage, it takes no damage and instead regains a number of hit points equal to the acid damage dealt.",attack_bonus:0},{name:"Berserk",desc:"Whenever the golem starts its turn with 60 hit points or fewer, roll a d6. On a 6, the golem goes berserk. On each of its turns while berserk, the golem attacks the nearest creature it can see. If no creature is near enough to move to and attack, the golem attacks an object, with preference for an object smaller than itself. Once the golem goes berserk, it continues to do so until it is destroyed or regains all its hit points.",attack_bonus:0},{name:"Immutable Form",desc:"The golem is immune to any spell or effect that would alter its form.",attack_bonus:0},{name:"Magic Resistance",desc:"The golem has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Magic Weapons",desc:"The golem's weapon attacks are magical.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The golem makes two slam attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 16 (2d10 + 5) bludgeoning damage. If the target is a creature, it must succeed on a DC 15 Constitution saving throw or have its hit point maximum reduced by an amount equal to the damage taken. The target dies if this attack reduces its hit point maximum to 0. The reduction lasts until removed by the greater restoration spell or other magic.",attack_bonus:8,damage_dice:"2d10",damage_bonus:5},{name:"Haste (Recharge 5-6)",desc:"Until the end of its next turn, the golem magically gains a +2 bonus to its AC, has advantage on Dexterity saving throws, and can use its slam attack as a bonus action.",attack_bonus:0}]},{name:"Cloaker",source:"5e SRD",size:"Large",type:"aberration",subtype:"",alignment:"chaotic neutral",ac:14,hp:78,hit_dice:"12d10 + 12",speed:"10 ft., fly 40 ft.",stats:[17,15,12,13,12,14],skillsaves:[{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 11",languages:"Deep Speech, Undercommon",cr:"8",bestiary:!0,traits:[{name:"Damage Transfer",desc:"While attached to a creature, the cloaker takes only half the damage dealt to it (rounded down). and that creature takes the other half.",attack_bonus:0},{name:"False Appearance",desc:"While the cloaker remains motionless without its underside exposed, it is indistinguishable from a dark leather cloak.",attack_bonus:0},{name:"Light Sensitivity",desc:"While in bright light, the cloaker has disadvantage on attack rolls and Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The cloaker makes two attacks: one with its bite and one with its tail.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one creature. Hit: 10 (2d6 + 3) piercing damage, and if the target is Large or smaller, the cloaker attaches to it. If the cloaker has advantage against the target, the cloaker attaches to the target's head, and the target is blinded and unable to breathe while the cloaker is attached. While attached, the cloaker can make this attack only against the target and has advantage on the attack roll. The cloaker can detach itself by spending 5 feet of its movement. A creature, including the target, can take its action to detach the cloaker by succeeding on a DC 16 Strength check.",attack_bonus:6,damage_dice:"2d6",damage_bonus:3},{name:"Tail",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one creature. Hit: 7 (1d8 + 3) slashing damage.",attack_bonus:6,damage_dice:"1d8",damage_bonus:3},{name:"Moan",desc:"Each creature within 60 feet of the cloaker that can hear its moan and that isn't an aberration must succeed on a DC 13 Wisdom saving throw or become frightened until the end of the cloaker's next turn. If a creature's saving throw is successful, the creature is immune to the cloaker's moan for the next 24 hours.",attack_bonus:0},{name:"Phantasms (Recharges after a Short or Long Rest)",desc:`The cloaker magically creates three illusory duplicates of itself if it isn't in bright light. The duplicates move with it and mimic its actions, shifting position so as to make it impossible to track which cloaker is the real one. If the cloaker is ever in an area of bright light, the duplicates disappear.
Whenever any creature targets the cloaker with an attack or a harmful spell while a duplicate remains, that creature rolls randomly to determine whether it targets the cloaker or one of the duplicates. A creature is unaffected by this magical effect if it can't see or if it relies on senses other than sight.
A duplicate has the cloaker's AC and uses its saving throws. If an attack hits a duplicate, or if a duplicate fails a saving throw against an effect that deals damage, the duplicate disappears.`,attack_bonus:0}]},{name:"Cloud Giant",source:"5e SRD",size:"Huge",type:"giant",subtype:"",alignment:"neutral good (50%) or neutral evil (50%)",ac:14,hp:200,hit_dice:"16d12 + 96",speed:"40 ft.",stats:[27,10,22,12,16,16],saves:[{constitution:10},{wisdom:7},{charisma:7}],skillsaves:[{insight:7},{perception:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 17",languages:"Common, Giant",cr:"9",bestiary:!0,traits:[{name:"Keen Smell",desc:"The giant has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0},{name:"Innate Spellcasting",desc:`The giant's innate spellcasting ability is Charisma. It can innately cast the following spells, requiring no material components:
At will: detect magic, fog cloud, light
3/day each: feather fall, fly, misty step, telekinesis
1/day each: control weather, gaseous form`,attack_bonus:0}],actions:[{name:"Multiattack",desc:"The giant makes two morningstar attacks.",attack_bonus:0},{name:"Morningstar",desc:"Melee Weapon Attack: +12 to hit, reach 10 ft., one target. Hit: 21 (3d8 + 8) piercing damage.",attack_bonus:12,damage_dice:"3d8",damage_bonus:8},{name:"Rock",desc:"Ranged Weapon Attack: +12 to hit, range 60/240 ft., one target. Hit: 30 (4d10 + 8) bludgeoning damage.",attack_bonus:12,damage_dice:"4d10",damage_bonus:8}]},{name:"Cockatrice",source:"5e SRD",size:"Small",type:"monstrosity",subtype:"",alignment:"unaligned",ac:11,hp:27,hit_dice:"6d6 + 6",speed:"20 ft., fly 40 ft.",stats:[6,12,12,2,13,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 11",languages:"",cr:"1/2",bestiary:!0,actions:[{name:"Bite",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one creature. Hit: 3 (1d4 + 1) piercing damage, and the target must succeed on a DC 11 Constitution saving throw against being magically petrified. On a failed save, the creature begins to turn to stone and is restrained. It must repeat the saving throw at the end of its next turn. On a success, the effect ends. On a failure, the creature is petrified for 24 hours.",attack_bonus:3,damage_dice:"1d4",damage_bonus:1}]},{name:"Commoner",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:10,hp:4,hit_dice:"1d8 + -1",speed:"30 ft.",stats:[10,10,10,10,10,10],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"any one language (usually Common)",cr:"0",bestiary:!0,actions:[{name:"Club",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 2 (1d4) bludgeoning damage.",attack_bonus:2,damage_dice:"1d4"}]},{name:"Constrictor Snake",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:13,hit_dice:"2d10 + 2",speed:"30 ft., swim 30 ft.",stats:[15,14,12,1,10,3],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., passive Perception 10",languages:"",cr:"1/4",bestiary:!0,actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Constrict",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 6 (1d8 + 2) bludgeoning damage, and the target is grappled (escape DC 14). Until this grapple ends, the creature is restrained, and the snake can't constrict another target.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2}]},{name:"Copper Dragon Wyrmling",source:"5e SRD",size:"Medium",type:"dragon",subtype:"",alignment:"chaotic good",ac:16,hp:22,hit_dice:"4d8 + 4",speed:"30 ft., climb 30 ft., fly 60 ft.",stats:[15,12,13,14,11,13],saves:[{dexterity:3},{constitution:3},{wisdom:2},{charisma:3}],skillsaves:[{perception:4},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"1",bestiary:!0,actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (1d10 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d10",damage_bonus:2},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Acid Breath. The dragon exhales acid in an 20-foot line that is 5 feet wide. Each creature in that line must make a DC 11 Dexterity saving throw, taking 18 (4d8) acid damage on a failed save, or half as much damage on a successful one.
Slowing Breath. The dragon exhales gas in a 1 5-foot cone. Each creature in that area must succeed on a DC 11 Constitution saving throw. On a failed save, the creature can't use reactions, its speed is halved, and it can't make more than one attack on its turn. In addition, the creature can use either an action or a bonus action on its turn, but not both. These effects last for 1 minute. The creature can repeat the saving throw at the end of each of its turns, ending the effect on itself with a successful save.`,attack_bonus:0,damage_dice:"4d8"}]},{name:"Couatl",source:"5e SRD",size:"Medium",type:"celestial",subtype:"",alignment:"lawful good",ac:19,hp:97,hit_dice:"13d8 + 38",speed:"30 ft., fly 90 ft.",stats:[16,20,17,18,20,18],saves:[{constitution:5},{wisdom:7},{charisma:6}],damage_vulnerabilities:"",damage_resistances:"radiant",damage_immunities:"psychic; bludgeoning, piercing, and slashing from nonmagical weapons",condition_immunities:"",senses:"truesight 120 ft., passive Perception 15",languages:"all, telepathy 120 ft.",cr:"4",bestiary:!0,traits:[{name:"Innate Spellcasting",desc:`The couatl's spellcasting ability is Charisma (spell save DC 14). It can innately cast the following spells, requiring only verbal components:
At will: detect evil and good, detect magic, detect thoughts
3/day each: bless, create food and water, cure wounds, lesser restoration, protection from poison, sanctuary, shield
1/day each: dream, greater restoration, scrying`,attack_bonus:0},{name:"Magic Weapons",desc:"The couatl's weapon attacks are magical.",attack_bonus:0},{name:"Shielded Mind",desc:"The couatl is immune to scrying and to any effect that would sense its emotions, read its thoughts, or detect its location.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one creature. Hit: 8 (1d6 + 5) piercing damage, and the target must succeed on a DC 13 Constitution saving throw or be poisoned for 24 hours. Until this poison ends, the target is unconscious. Another creature can use an action to shake the target awake.",attack_bonus:8,damage_dice:"1d6",damage_bonus:5},{name:"Constrict",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one Medium or smaller creature. Hit: 10 (2d6 + 3) bludgeoning damage, and the target is grappled (escape DC 15). Until this grapple ends, the target is restrained, and the couatl can't constrict another target.",attack_bonus:6,damage_dice:"2d6",damage_bonus:3},{name:"Change Shape",desc:`The couatl magically polymorphs into a humanoid or beast that has a challenge rating equal to or less than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the couatl's choice).
In a new form, the couatl retains its game statistics and ability to speak, but its AC, movement modes, Strength, Dexterity, and other actions are replaced by those of the new form, and it gains any statistics and capabilities (except class features, legendary actions, and lair actions) that the new form has but that it lacks. If the new form has a bite attack, the couatl can use its bite in that form.`,attack_bonus:0}]},{name:"Crab",source:"5e SRD",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:2,hit_dice:"1d4",speed:"20 ft., swim 20 ft.",stats:[2,11,10,1,8,2],skillsaves:[{stealth:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 30 ft., passive Perception 9",languages:"",cr:"0",bestiary:!0,traits:[{name:"Amphibious",desc:"The crab can breathe air and water.",attack_bonus:0}],actions:[{name:"Claw",desc:"Melee Weapon Attack: +0 to hit, reach 5 ft., one target. Hit: 1 bludgeoning damage.",attack_bonus:0,damage_bonus:1}]},{name:"Crocodile",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:19,hit_dice:"3d10 + 2",speed:"20 ft., swim 20 ft.",stats:[15,10,13,2,10,5],skillsaves:[{stealth:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"1/2",bestiary:!0,traits:[{name:"Hold Breath",desc:"The crocodile can hold its breath for 15 minutes.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 7 (1d10 + 2) piercing damage, and the target is grappled (escape DC 12). Until this grapple ends, the target is restrained, and the crocodile can't bite another target",attack_bonus:4,damage_dice:"1d10",damage_bonus:2}]},{name:"Cult Fanatic",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any non-good alignment",ac:13,hp:22,hit_dice:"6d8 + -5",speed:"30 ft.",stats:[11,14,12,10,13,14],skillsaves:[{deception:4},{persuasion:4},{religion:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 11",languages:"any one language (usually Common)",cr:"2",bestiary:!0,traits:[{name:"Dark Devotion",desc:"The fanatic has advantage on saving throws against being charmed or frightened.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The fanatic makes two melee attacks.",attack_bonus:0},{name:"Dagger",desc:"Melee or Ranged Weapon Attack: +4 to hit, reach 5 ft. or range 20/60 ft., one creature. Hit: 4 (1d4 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}],spells:["The fanatic is a 4th-level spellcaster. Its spell casting ability is Wisdom (spell save DC 11, +3 to hit with spell attacks). The fanatic has the following cleric spells prepared:","Cantrips (at will): light, sacred flame, thaumaturgy",{"1st level (4 slots)":"command, inflict wounds, shield of faith"},{"2nd level (3 slots)":"hold person, spiritual weapon"}]},{name:"Cultist",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any non-good alignment",ac:12,hp:9,hit_dice:"2d8",speed:"30 ft.",stats:[11,12,10,10,11,10],skillsaves:[{deception:2},{religion:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"any one language (usually Common)",cr:"1/8",bestiary:!0,traits:[{name:"Dark Devotion",desc:"The cultist has advantage on saving throws against being charmed or frightened.",attack_bonus:0}],actions:[{name:"Scimitar",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one creature. Hit: 4 (1d6 + 1) slashing damage.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Darkmantle",source:"5e SRD",size:"Small",type:"monstrosity",subtype:"",alignment:"unaligned",ac:11,hp:22,hit_dice:"5d6 + 4",speed:"10 ft., fly 30 ft.",stats:[16,12,13,2,10,5],skillsaves:[{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 60 ft., passive Perception 10",languages:"",cr:"1/2",bestiary:!0,traits:[{name:"Echolocation",desc:"The darkmantle can't use its blindsight while deafened.",attack_bonus:0},{name:"False Appearance",desc:"While the darkmantle remains motionless, it is indistinguishable from a cave formation such as a stalactite or stalagmite.",attack_bonus:0}],actions:[{name:"Crush",desc:`Melee Weapon Attack: +5 to hit, reach 5 ft., one creature. Hit: 6 (1d6 + 3) bludgeoning damage, and the darkmantle attaches to the target. If the target is Medium or smaller and the darkmantle has advantage on the attack roll, it attaches by engulfing the target's head, and the target is also blinded and unable to breathe while the darkmantle is attached in this way.
While attached to the target, the darkmantle can attack no other creature except the target but has advantage on its attack rolls. The darkmantle's speed also becomes 0, it can't benefit from any bonus to its speed, and it moves with the target.
A creature can detach the darkmantle by making a successful DC 13 Strength check as an action. On its turn, the darkmantle can detach itself from the target by using 5 feet of movement.`,attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Darkness Aura (1/day)",desc:"A 15-foot radius of magical darkness extends out from the darkmantle, moves with it, and spreads around corners. The darkness lasts as long as the darkmantle maintains concentration, up to 10 minutes (as if concentrating on a spell). Darkvision can't penetrate this darkness, and no natural light can illuminate it. If any of the darkness overlaps with an area of light created by a spell of 2nd level or lower, the spell creating the light is dispelled.",attack_bonus:0}]},{name:"Death Dog",source:"5e SRD",size:"Medium",type:"monstrosity",subtype:"",alignment:"neutral evil",ac:12,hp:39,hit_dice:"6d8 + 12",speed:"40 ft.",stats:[15,14,14,3,13,6],skillsaves:[{perception:5},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 15",languages:"",cr:"1",bestiary:!0,traits:[{name:"Two-Headed",desc:"The dog has advantage on Wisdom (Perception) checks and on saving throws against being blinded, charmed, deafened, frightened, stunned, or knocked unconscious.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dog makes two bite attacks.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage. If the target is a creature, it must succeed on a DC 12 Constitution saving throw against disease or become poisoned until the disease is cured. Every 24 hours that elapse, the creature must repeat the saving throw, reducing its hit point maximum by 5 (1d10) on a failure. This reduction lasts until the disease is cured. The creature dies if the disease reduces its hit point maximum to 0.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Deep Gnome (Svirfneblin)",source:"5e SRD",size:"Small",type:"humanoid",subtype:"gnome",alignment:"neutral good",ac:15,hp:16,hit_dice:"3d6 + 5",speed:"20 ft.",stats:[15,14,14,12,10,9],skillsaves:[{perception:2},{investigation:3},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 12",languages:"Gnomish, Terran, Undercommon",cr:"1/2",bestiary:!0,traits:[{name:"Stone Camouflage",desc:"The gnome has advantage on Dexterity (Stealth) checks made to hide in rocky terrain.",attack_bonus:0},{name:"Gnome Cunning",desc:"The gnome has advantage on Intelligence, Wisdom, and Charisma saving throws against magic.",attack_bonus:0},{name:"Innate Spellcasting",desc:`The gnome's innate spellcasting ability is Intelligence (spell save DC 11). It can innately cast the following spells, requiring no material components:
At will: nondetection (self only)
1/day each: blindness/deafness, blur, disguise self`,attack_bonus:0}],actions:[{name:"War Pick",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2},{name:"Poisoned Dart",desc:"Ranged Weapon Attack: +4 to hit, range 30/120 ft., one creature. Hit: 4 (1d4 + 2) piercing damage, and the target must succeed on a DC 12 Constitution saving throw or be poisoned for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Deer",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:4,hit_dice:"1d8 + -1",speed:"50 ft.",stats:[11,16,11,2,14,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 12",languages:"",cr:"0",bestiary:!0,actions:[{name:"Bite",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 2 (1d4) piercing damage.",attack_bonus:2,damage_dice:"1d4"}]},{name:"Deva",source:"5e SRD",size:"Medium",type:"celestial",subtype:"",alignment:"lawful good",ac:17,hp:136,hit_dice:"16d8 + 64",speed:"30 ft., fly 90 ft.",stats:[18,18,18,17,20,20],saves:[{wisdom:9},{charisma:9}],skillsaves:[{insight:9},{perception:9}],damage_vulnerabilities:"",damage_resistances:"radiant; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"",condition_immunities:"charmed, exhaustion, frightened",senses:"darkvision 120 ft., passive Perception 19",languages:"all, telepathy 120 ft.",cr:"10",bestiary:!0,traits:[{name:"Angelic Weapons",desc:"The deva's weapon attacks are magical. When the deva hits with any weapon, the weapon deals an extra 4d8 radiant damage (included in the attack).",attack_bonus:0},{name:"Innate Spellcasting",desc:`The deva's spellcasting ability is Charisma (spell save DC 17). The deva can innately cast the following spells, requiring only verbal components:
At will: detect evil and good
1/day each: commune, raise dead`,attack_bonus:0},{name:"Magic Resistance",desc:"The deva has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The deva makes two melee attacks.",attack_bonus:0},{name:"Mace",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 7 (1d6 + 4) bludgeoning damage plus 18 (4d8) radiant damage.",attack_bonus:8,damage_dice:"1d6 + 4d8",damage_bonus:4},{name:"Healing Touch (3/Day)",desc:"The deva touches another creature. The target magically regains 20 (4d8 + 2) hit points and is freed from any curse, disease, poison, blindness, or deafness.",attack_bonus:0},{name:"Change Shape",desc:`The deva magically polymorphs into a humanoid or beast that has a challenge rating equal to or less than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the deva's choice).
In a new form, the deva retains its game statistics and ability to speak, but its AC, movement modes, Strength, Dexterity, and special senses are replaced by those of the new form, and it gains any statistics and capabilities (except class features, legendary actions, and lair actions) that the new form has but that it lacks.`,attack_bonus:0}]},{name:"Dire Wolf",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:14,hp:37,hit_dice:"5d10 + 9",speed:"50 ft.",stats:[17,15,15,3,12,7],skillsaves:[{perception:3},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"1",bestiary:!0,traits:[{name:"Keen Hearing and Smell",desc:"The wolf has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0},{name:"Pack Tactics",desc:"The wolf has advantage on an attack roll against a creature if at least one of the wolf's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) piercing damage. If the target is a creature, it must succeed on a DC 13 Strength saving throw or be knocked prone.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3}]},{name:"Djinni",source:"5e SRD",size:"Large",type:"elemental",subtype:"",alignment:"chaotic good",ac:17,hp:161,hit_dice:"14d10 + 84",speed:"30 ft., fly 90 ft.",stats:[21,15,22,15,16,20],saves:[{dexterity:6},{wisdom:7},{charisma:9}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning, thunder",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 13",languages:"Auran",cr:"11",bestiary:!0,traits:[{name:"Elemental Demise",desc:"If the djinni dies, its body disintegrates into a warm breeze, leaving behind only equipment the djinni was wearing or carrying.",attack_bonus:0},{name:"Innate Spellcasting",desc:`The djinni's innate spellcasting ability is Charisma (spell save DC 17, +9 to hit with spell attacks). It can innately cast the following spells, requiring no material components:
At will: detect evil and good, detect magic, thunderwave 3/day each: create food and water (can create wine instead of water), tongues, wind walk
1/day each: conjure elemental (air elemental only), creation, gaseous form, invisibility, major image, plane shift`,attack_bonus:0},{name:"Variant: Genie Powers",desc:`Genies have a variety of magical capabilities, including spells. A few have even greater powers that allow them to alter their appearance or the nature of reality.
Disguises.
Some genies can veil themselves in illusion to pass as other similarly shaped creatures. Such genies can innately cast the disguise self spell at will, often with a longer duration than is normal for that spell. Mightier genies can cast the true polymorph spell one to three times per day, possibly with a longer duration than normal. Such genies can change only their own shape, but a rare few can use the spell on other creatures and objects as well.
Wishes.
The genie power to grant wishes is legendary among mortals. Only the most potent genies, such as those among the nobility, can do so. A particular genie that has this power can grant one to three wishes to a creature that isn't a genie. Once a genie has granted its limit of wishes, it can't grant wishes again for some amount of time (usually 1 year). and cosmic law dictates that the same genie can expend its limit of wishes on a specific creature only once in that creature's existence.
To be granted a wish, a creature within 60 feet of the genie states a desired effect to it. The genie can then cast the wish spell on the creature's behalf to bring about the effect. Depending on the genie's nature, the genie might try to pervert the intent of the wish by exploiting the wish's poor wording. The perversion of the wording is usually crafted to be to the genie's benefit.`,attack_bonus:0}],actions:[{name:"Multiattack",desc:"The djinni makes three scimitar attacks.",attack_bonus:0},{name:"Scimitar",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) slashing damage plus 3 (1d6) lightning or thunder damage (djinni's choice).",attack_bonus:9,damage_dice:"2d6 + 1d6",damage_bonus:5},{name:"Create Whirlwind",desc:`A 5-foot-radius, 30-foot-tall cylinder of swirling air magically forms on a point the djinni can see within 120 feet of it. The whirlwind lasts as long as the djinni maintains concentration (as if concentrating on a spell). Any creature but the djinni that enters the whirlwind must succeed on a DC 18 Strength saving throw or be restrained by it. The djinni can move the whirlwind up to 60 feet as an action, and creatures restrained by the whirlwind move with it. The whirlwind ends if the djinni loses sight of it.
A creature can use its action to free a creature restrained by the whirlwind, including itself, by succeeding on a DC 18 Strength check. If the check succeeds, the creature is no longer restrained and moves to the nearest space outside the whirlwind.`,attack_bonus:0}]},{name:"Doppelganger",source:"5e SRD",size:"Medium",type:"monstrosity",subtype:"shapechanger",alignment:"unaligned",ac:14,hp:52,hit_dice:"8d8 + 16",speed:"30 ft.",stats:[11,18,14,11,12,14],skillsaves:[{deception:6},{insight:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"charmed",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 11",languages:"Common",cr:"3",bestiary:!0,traits:[{name:"Shapechanger",desc:"The doppelganger can use its action to polymorph into a Small or Medium humanoid it has seen, or back into its true form. Its statistics, other than its size, are the same in each form. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",attack_bonus:0},{name:"Ambusher",desc:"The doppelganger has advantage on attack rolls against any creature it has surprised.",attack_bonus:0},{name:"Surprise Attack",desc:"If the doppelganger surprises a creature and hits it with an attack during the first round of combat, the target takes an extra 10 (3d6) damage from the attack.",attack_bonus:0,damage_dice:"3d6"}],actions:[{name:"Multiattack",desc:"The doppelganger makes two melee attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 7 (1d6 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"1d6",damage_bonus:4},{name:"Read Thoughts",desc:"The doppelganger magically reads the surface thoughts of one creature within 60 ft. of it. The effect can penetrate barriers, but 3 ft. of wood or dirt, 2 ft. of stone, 2 inches of metal, or a thin sheet of lead blocks it. While the target is in range, the doppelganger can continue reading its thoughts, as long as the doppelganger's concentration isn't broken (as if concentrating on a spell). While reading the target's mind, the doppelganger has advantage on Wisdom (Insight) and Charisma (Deception, Intimidation, and Persuasion) checks against the target.",attack_bonus:0}]},{name:"Draft Horse",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:19,hit_dice:"3d10 + 2",speed:"40 ft.",stats:[18,10,12,2,11,7],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"1/4",bestiary:!0,actions:[{name:"Hooves",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 9 (2d4 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"2d4",damage_bonus:4}]},{name:"Dragon Turtle",source:"5e SRD",size:"Gargantuan",type:"dragon",subtype:"",alignment:"neutral",ac:20,hp:341,hit_dice:"22d20 + 110",speed:"20 ft., swim 40 ft.",stats:[25,10,20,10,12,12],saves:[{dexterity:6},{constitution:11},{wisdom:7}],damage_vulnerabilities:"",damage_resistances:"fire",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 11",languages:"Aquan, Draconic",cr:"17",bestiary:!0,traits:[{name:"Amphibious",desc:"The dragon turtle can breathe air and water.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon turtle makes three attacks: one with its bite and two with its claws. It can make one tail attack in place of its two claw attacks.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +13 to hit, reach 15 ft., one target. Hit: 26 (3d12 + 7) piercing damage.",attack_bonus:13,damage_dice:"3d12",damage_bonus:7},{name:"Claw",desc:"Melee Weapon Attack: +13 to hit, reach 10 ft., one target. Hit: 16 (2d8 + 7) slashing damage.",attack_bonus:13,damage_dice:"2d8",damage_bonus:7},{name:"Tail",desc:"Melee Weapon Attack: +13 to hit, reach 15 ft., one target. Hit: 26 (3d12 + 7) bludgeoning damage. If the target is a creature, it must succeed on a DC 20 Strength saving throw or be pushed up to 10 feet away from the dragon turtle and knocked prone.",attack_bonus:13,damage_dice:"3d12",damage_bonus:7},{name:"Steam Breath (Recharge 5-6)",desc:"The dragon turtle exhales scalding steam in a 60-foot cone. Each creature in that area must make a DC 18 Constitution saving throw, taking 52 (15d6) fire damage on a failed save, or half as much damage on a successful one. Being underwater doesn't grant resistance against this damage.",attack_bonus:0,damage_dice:"15d6"}]},{name:"Dretch",source:"5e SRD",size:"Small",type:"fiend",subtype:"demon",alignment:"chaotic evil",ac:11,hp:18,hit_dice:"4d6 + 4",speed:"20 ft.",stats:[11,11,12,5,8,3],damage_vulnerabilities:"",damage_resistances:"cold, fire, lightning",damage_immunities:"poison",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 9",languages:"Abyssal, telepathy 60 ft. (works only with creatures that understand Abyssal)",cr:"1/4",bestiary:!0,actions:[{name:"Multiattack",desc:"The dretch makes two attacks: one with its bite and one with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 3 (1d6) piercing damage.",attack_bonus:2,damage_dice:"1d6"},{name:"Claws",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 5 (2d4) slashing damage.",attack_bonus:2,damage_dice:"2d4"},{name:"Fetid Cloud (1/Day)",desc:"A 10-foot radius of disgusting green gas extends out from the dretch. The gas spreads around corners, and its area is lightly obscured. It lasts for 1 minute or until a strong wind disperses it. Any creature that starts its turn in that area must succeed on a DC 11 Constitution saving throw or be poisoned until the start of its next turn. While poisoned in this way, the target can take either an action or a bonus action on its turn, not both, and can't take reactions.",attack_bonus:0}]},{name:"Drider",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"chaotic evil",ac:19,hp:123,hit_dice:"13d10 + 51",speed:"30 ft., climb 30 ft.",stats:[16,16,18,13,14,12],skillsaves:[{perception:5},{stealth:9}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 15",languages:"Elvish, Undercommon",cr:"6",bestiary:!0,traits:[{name:"Fey Ancestry",desc:"The drider has advantage on saving throws against being charmed, and magic can't put the drider to sleep.",attack_bonus:0},{name:"Innate Spellcasting",desc:`The drider's innate spellcasting ability is Wisdom (spell save DC 13). The drider can innately cast the following spells, requiring no material components:
At will: dancing lights
1/day each: darkness, faerie fire`,attack_bonus:0},{name:"Spider Climb",desc:"The drider can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0},{name:"Sunlight Sensitivity",desc:"While in sunlight, the drider has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",attack_bonus:0},{name:"Web Walker",desc:"The drider ignores movement restrictions caused by webbing.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The drider makes three attacks, either with its longsword or its longbow. It can replace one of those attacks with a bite attack.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one creature. Hit: 2 (1d4) piercing damage plus 9 (2d8) poison damage.",attack_bonus:6,damage_dice:"1d4",damage_bonus:2},{name:"Longsword",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) slashing damage, or 8 (1d10 + 3) slashing damage if used with two hands.",attack_bonus:6,damage_dice:"1d8",damage_bonus:3},{name:"Longbow",desc:"Ranged Weapon Attack: +6 to hit, range 150/600 ft., one target. Hit: 7 (1d8 + 3) piercing damage plus 4 (1d8) poison damage.",attack_bonus:6,damage_dice:"1d8",damage_bonus:3}]},{name:"Drow",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"elf",alignment:"neutral evil",ac:15,hp:13,hit_dice:"3d8 + -1",speed:"30 ft.",stats:[10,14,10,11,11,12],skillsaves:[{perception:2},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 12",languages:"Elvish, Undercommon",cr:"1/4",bestiary:!0,traits:[{name:"Fey Ancestry",desc:"The drow has advantage on saving throws against being charmed, and magic can't put the drow to sleep.",attack_bonus:0},{name:"Innate Spellcasting",desc:`The drow's spellcasting ability is Charisma (spell save DC 11). It can innately cast the following spells, requiring no material components:
At will: dancing lights
1/day each: darkness, faerie fire`,attack_bonus:0},{name:"Sunlight Sensitivity",desc:"While in sunlight, the drow has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Shortsword",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Hand Crossbow",desc:"Ranged Weapon Attack: +4 to hit, range 30/120 ft., one target. Hit: 5 (1d6 + 2) piercing damage, and the target must succeed on a DC 13 Constitution saving throw or be poisoned for 1 hour. If the saving throw fails by 5 or more, the target is also unconscious while poisoned in this way. The target wakes up if it takes damage or if another creature takes an action to shake it awake.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Druid",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:11,hp:27,hit_dice:"5d8 + 4",speed:"30 ft.",stats:[10,12,13,12,15,11],skillsaves:[{nature:3},{medicine:4},{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"Druidic plus any two languages",cr:"2",bestiary:!0,traits:[],actions:[{name:"Quarterstaff",desc:"Melee Weapon Attack: +2 to hit (+4 to hit with shillelagh), reach 5 ft., one target. Hit: 3 (1d6) bludgeoning damage, or 6 (1d8 + 2) bludgeoning damage with shillelagh or if wielded with two hands.",attack_bonus:2,damage_dice:"1d6"}],spells:["The druid is a 4th-level spellcaster. Its spellcasting ability is Wisdom (spell save DC 12, +4 to hit with spell attacks). It has the following druid spells prepared:",{"Cantrips (at will)":"druidcraft, produce flame, shillelagh"},{"1st level (4 slots)":"entangle, longstrider, speak with animals, thunderwave"},{"2nd level (3 slots)":"animal messenger, barkskin"}]},{name:"Dryad",source:"5e SRD",size:"Medium",type:"fey",subtype:"",alignment:"neutral",ac:11,hp:22,hit_dice:"5d8 + -1",speed:"30 ft.",stats:[10,12,11,14,15,18],skillsaves:[{perception:4},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"Elvish, Sylvan",cr:"1",bestiary:!0,traits:[{name:"Innate Spellcasting",desc:`The dryad's innate spellcasting ability is Charisma (spell save DC 14). The dryad can innately cast the following spells, requiring no material components:
At will: druidcraft
3/day each: entangle, goodberry
1/day each: barkskin, pass without trace, shillelagh`,attack_bonus:0},{name:"Magic Resistance",desc:"The dryad has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Speak with Beasts and Plants",desc:"The dryad can communicate with beasts and plants as if they shared a language.",attack_bonus:0},{name:"Tree Stride",desc:"Once on her turn, the dryad can use 10 ft. of her movement to step magically into one living tree within her reach and emerge from a second living tree within 60 ft. of the first tree, appearing in an unoccupied space within 5 ft. of the second tree. Both trees must be large or bigger.",attack_bonus:0}],actions:[{name:"Club",desc:"Melee Weapon Attack: +2 to hit (+6 to hit with shillelagh), reach 5 ft., one target. Hit: 2 (1 d4) bludgeoning damage, or 8 (1d8 + 4) bludgeoning damage with shillelagh.",attack_bonus:2,damage_dice:"1d4"},{name:"Fey Charm",desc:`The dryad targets one humanoid or beast that she can see within 30 feet of her. If the target can see the dryad, it must succeed on a DC 14 Wisdom saving throw or be magically charmed. The charmed creature regards the dryad as a trusted friend to be heeded and protected. Although the target isn't under the dryad's control, it takes the dryad's requests or actions in the most favorable way it can.
Each time the dryad or its allies do anything harmful to the target, it can repeat the saving throw, ending the effect on itself on a success. Otherwise, the effect lasts 24 hours or until the dryad dies, is on a different plane of existence from the target, or ends the effect as a bonus action. If a target's saving throw is successful, the target is immune to the dryad's Fey Charm for the next 24 hours.
The dryad can have no more than one humanoid and up to three beasts charmed at a time.`,attack_bonus:0}]},{name:"Duergar",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"dwarf",alignment:"lawful evil",ac:16,hp:26,hit_dice:"4d8 + 8",speed:"25 ft.",stats:[14,11,14,11,10,9],damage_vulnerabilities:"",damage_resistances:"poison",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 10",languages:"Dwarvish, Undercommon",cr:"1",bestiary:!0,traits:[{name:"Duergar Resilience",desc:"The duergar has advantage on saving throws against poison, spells, and illusions, as well as to resist being charmed or paralyzed.",attack_bonus:0},{name:"Sunlight Sensitivity",desc:"While in sunlight, the duergar has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Enlarge (Recharges after a Short or Long Rest)",desc:"For 1 minute, the duergar magically increases in size, along with anything it is wearing or carrying. While enlarged, the duergar is Large, doubles its damage dice on Strength-based weapon attacks (included in the attacks), and makes Strength checks and Strength saving throws with advantage. If the duergar lacks the room to become Large, it attains the maximum size possible in the space available.",attack_bonus:0},{name:"War Pick",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) piercing damage, or 11 (2d8 + 2) piercing damage while enlarged.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2},{name:"Javelin",desc:"Melee or Ranged Weapon Attack: +4 to hit, reach 5 ft. or range 30/120 ft., one target. Hit: 5 (1d6 + 2) piercing damage, or 9 (2d6 + 2) piercing damage while enlarged.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Invisibility (Recharges after a Short or Long Rest)",desc:"The duergar magically turns invisible until it attacks, casts a spell, or uses its Enlarge, or until its concentration is broken, up to 1 hour (as if concentrating on a spell). Any equipment the duergar wears or carries is invisible with it .",attack_bonus:0}]},{name:"Dust Mephit",source:"5e SRD",size:"Small",type:"elemental",subtype:"",alignment:"neutral evil",ac:12,hp:17,hit_dice:"5d6 + -1",speed:"30 ft., fly 30 ft.",stats:[5,14,10,9,11,10],skillsaves:[{perception:2},{stealth:4}],damage_vulnerabilities:"fire",damage_resistances:"",damage_immunities:"poison",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 12",languages:"Auran, Terran",cr:"1/2",bestiary:!0,traits:[{name:"Death Burst",desc:"When the mephit dies, it explodes in a burst of dust. Each creature within 5 ft. of it must then succeed on a DC 10 Constitution saving throw or be blinded for 1 minute. A blinded creature can repeat the saving throw on each of its turns, ending the effect on itself on a success.",attack_bonus:0},{name:"Innate Spellcasting (1/Day)",desc:"The mephit can innately cast sleep, requiring no material components. Its innate spellcasting ability is Charisma.",attack_bonus:0}],actions:[{name:"Claws",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 4 (1d4 + 2) slashing damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2},{name:"Blinding Breath (Recharge 6)",desc:"The mephit exhales a 15-foot cone of blinding dust. Each creature in that area must succeed on a DC 10 Dexterity saving throw or be blinded for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:0},{name:"Variant: Summon Mephits (1/Day)",desc:"The mephit has a 25 percent chance of summoning 1d4 mephits of its kind. A summoned mephit appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other mephits. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",attack_bonus:0}]},{name:"Eagle",source:"5e SRD",size:"Small",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:3,hit_dice:"1d6 + -1",speed:"10 ft., fly 60 ft.",stats:[6,15,10,2,14,7],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"",cr:"0",bestiary:!0,traits:[{name:"Keen Sight",desc:"The eagle has advantage on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Talons",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) slashing damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Earth Elemental",source:"5e SRD",size:"Large",type:"elemental",subtype:"",alignment:"neutral",ac:17,hp:126,hit_dice:"12d10 + 60",speed:"30 ft., burrow 30 ft.",stats:[20,8,20,5,10,5],damage_vulnerabilities:"thunder",damage_resistances:"bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"exhaustion, paralyzed, petrified, poisoned, unconscious",senses:"darkvision 60 ft., tremorsense 60 ft., passive Perception 10",languages:"Terran",cr:"5",bestiary:!0,traits:[{name:"Earth Glide",desc:"The elemental can burrow through nonmagical, unworked earth and stone. While doing so, the elemental doesn't disturb the material it moves through.",attack_bonus:0},{name:"Siege Monster",desc:"The elemental deals double damage to objects and structures.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The elemental makes two slam attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 14 (2d8 + 5) bludgeoning damage.",attack_bonus:8,damage_dice:"2d8",damage_bonus:5}]},{name:"Efreeti",source:"5e SRD",size:"Large",type:"elemental",subtype:"",alignment:"lawful evil",ac:17,hp:200,hit_dice:"16d10 + 112",speed:"40 ft., fly 60 ft.",stats:[22,12,24,16,15,16],saves:[{intelligence:7},{wisdom:6},{charisma:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 12",languages:"Ignan",cr:"11",bestiary:!0,traits:[{name:"Elemental Demise",desc:"If the efreeti dies, its body disintegrates in a flash of fire and puff of smoke, leaving behind only equipment the djinni was wearing or carrying.",attack_bonus:0},{name:"Innate Spellcasting",desc:`The efreeti's innate spell casting ability is Charisma (spell save DC 15, +7 to hit with spell attacks). It can innately cast the following spells, requiring no material components:
At will: detect magic
3/day: enlarge/reduce, tongues
1/day each: conjure elemental (fire elemental only), gaseous form, invisibility, major image, plane shift, wall of fire`,attack_bonus:0},{name:"Variant: Genie Powers",desc:`Genies have a variety of magical capabilities, including spells. A few have even greater powers that allow them to alter their appearance or the nature of reality.
Disguises.
Some genies can veil themselves in illusion to pass as other similarly shaped creatures. Such genies can innately cast the disguise self spell at will, often with a longer duration than is normal for that spell. Mightier genies can cast the true polymorph spell one to three times per day, possibly with a longer duration than normal. Such genies can change only their own shape, but a rare few can use the spell on other creatures and objects as well.
Wishes.
The genie power to grant wishes is legendary among mortals. Only the most potent genies, such as those among the nobility, can do so. A particular genie that has this power can grant one to three wishes to a creature that isn't a genie. Once a genie has granted its limit of wishes, it can't grant wishes again for some amount of time (usually 1 year). and cosmic law dictates that the same genie can expend its limit of wishes on a specific creature only once in that creature's existence.
To be granted a wish, a creature within 60 feet of the genie states a desired effect to it. The genie can then cast the wish spell on the creature's behalf to bring about the effect. Depending on the genie's nature, the genie might try to pervert the intent of the wish by exploiting the wish's poor wording. The perversion of the wording is usually crafted to be to the genie's benefit.`,attack_bonus:0}],actions:[{name:"Multiattack",desc:"The efreeti makes two scimitar attacks or uses its Hurl Flame twice.",attack_bonus:0},{name:"Scimitar",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage plus 7 (2d6) fire damage.",attack_bonus:10,damage_dice:"2d6 + 2d6",damage_bonus:6},{name:"Hurl Flame",desc:"Ranged Spell Attack: +7 to hit, range 120 ft., one target. Hit: 17 (5d6) fire damage.",attack_bonus:7,damage_dice:"5d6"}]},{name:"Elephant",source:"5e SRD",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:76,hit_dice:"8d12 + 24",speed:"40 ft.",stats:[22,9,17,3,11,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"4",bestiary:!0,traits:[{name:"Trampling Charge",desc:"If the elephant moves at least 20 ft. straight toward a creature and then hits it with a gore attack on the same turn, that target must succeed on a DC 12 Strength saving throw or be knocked prone. If the target is prone, the elephant can make one stomp attack against it as a bonus action.",attack_bonus:0}],actions:[{name:"Gore",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 19 (3d8 + 6) piercing damage.",attack_bonus:8,damage_dice:"3d8",damage_bonus:6},{name:"Stomp",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one prone creature. Hit: 22 (3d10 + 6) bludgeoning damage.",attack_bonus:8,damage_dice:"3d10",damage_bonus:6}]},{name:"Elk",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:13,hit_dice:"2d10 + 2",speed:"50 ft.",stats:[16,10,12,2,10,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"1/4",bestiary:!0,traits:[{name:"Charge",desc:"If the elk moves at least 20 ft. straight toward a target and then hits it with a ram attack on the same turn, the target takes an extra 7 (2d6) damage. If the target is a creature, it must succeed on a DC 13 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"2d6"}],actions:[{name:"Ram",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) bludgeoning damage.",attack_bonus:0},{name:"Hooves",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one prone creature. Hit: 8 (2d4 + 3) bludgeoning damage.",attack_bonus:0}]},{name:"Erinyes",source:"5e SRD",size:"Medium",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:18,hp:153,hit_dice:"18d8 + 72",speed:"30 ft., fly 60 ft.",stats:[18,16,18,14,14,18],saves:[{dexterity:7},{constitution:8},{wisdom:6},{charisma:8}],damage_vulnerabilities:"",damage_resistances:"cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"truesight 120 ft., passive Perception 12",languages:"Infernal, telepathy 120 ft.",cr:"12",bestiary:!0,traits:[{name:"Hellish Weapons",desc:"The erinyes's weapon attacks are magical and deal an extra 13 (3d8) poison damage on a hit (included in the attacks).",attack_bonus:0},{name:"Magic Resistance",desc:"The erinyes has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The erinyes makes three attacks",attack_bonus:0},{name:"Longsword",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 8 (1d8 + 4) slashing damage, or 9 (1d10 + 4) slashing damage if used with two hands, plus 13 (3d8) poison damage.",attack_bonus:8,damage_dice:"1d8 + 3d8",damage_bonus:4},{name:"Longbow",desc:"Ranged Weapon Attack: +7 to hit, range 150/600 ft., one target. Hit: 7 (1d8 + 3) piercing damage plus 13 (3d8) poison damage, and the target must succeed on a DC 14 Constitution saving throw or be poisoned. The poison lasts until it is removed by the lesser restoration spell or similar magic.",attack_bonus:7,damage_dice:"1d8 + 3d8",damage_bonus:3},{name:"Variant: Rope of Entanglement",desc:"Some erinyes carry a rope of entanglement (detailed in the Dungeon Master's Guide). When such an erinyes uses its Multiattack, the erinyes can use the rope in place of two of the attacks.",attack_bonus:0}],reactions:[{name:"Parry",desc:"The erinyes adds 4 to its AC against one melee attack that would hit it. To do so, the erinyes must see the attacker and be wielding a melee weapon.",attack_bonus:0}]},{name:"Ettercap",source:"5e SRD",size:"Medium",type:"monstrosity",subtype:"",alignment:"neutral evil",ac:13,hp:44,hit_dice:"8d8 + 8",speed:"30 ft., climb 30 ft.",stats:[14,15,13,7,12,8],skillsaves:[{perception:3},{stealth:4},{survival:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 13",languages:"",cr:"2",bestiary:!0,traits:[{name:"Spider Climb",desc:"The ettercap can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0},{name:"Web Sense",desc:"While in contact with a web, the ettercap knows the exact location of any other creature in contact with the same web.",attack_bonus:0},{name:"Web Walker",desc:"The ettercap ignores movement restrictions caused by webbing.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The ettercap makes two attacks: one with its bite and one with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 6 (1d8 + 2) piercing damage plus 4 (1d8) poison damage. The target must succeed on a DC 11 Constitution saving throw or be poisoned for 1 minute. The creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2},{name:"Claws",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) slashing damage.",attack_bonus:4,damage_dice:"2d4",damage_bonus:2},{name:"Web (Recharge 5-6)",desc:"Ranged Weapon Attack: +4 to hit, range 30/60 ft., one Large or smaller creature. Hit: The creature is restrained by webbing. As an action, the restrained creature can make a DC 11 Strength check, escaping from the webbing on a success. The effect ends if the webbing is destroyed. The webbing has AC 10, 5 hit points, is vulnerable to fire damage and immune to bludgeoning damage.",attack_bonus:0},{name:"Variant: Web Garrote",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one Medium or Small creature against which the ettercap has advantage on the attack roll. Hit: 4 (1d4 + 2) bludgeoning damage, and the target is grappled (escape DC 12). Until this grapple ends, the target can't breathe, and the ettercap has advantage on attack rolls against it.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Ettin",source:"5e SRD",size:"Large",type:"giant",subtype:"",alignment:"chaotic evil",ac:12,hp:85,hit_dice:"10d10 + 30",speed:"40 ft.",stats:[21,8,17,6,10,8],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"Giant, Orc",cr:"4",bestiary:!0,traits:[{name:"Two Heads",desc:"The ettin has advantage on Wisdom (Perception) checks and on saving throws against being blinded, charmed, deafened, frightened, stunned, and knocked unconscious.",attack_bonus:0},{name:"Wakeful",desc:"When one of the ettin's heads is asleep, its other head is awake.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The ettin makes two attacks: one with its battleaxe and one with its morningstar.",attack_bonus:0},{name:"Battleaxe",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 14 (2d8 + 5) slashing damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:5},{name:"Morningstar",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 14 (2d8 + 5) piercing damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:5}]},{name:"Fire Elemental",source:"5e SRD",size:"Large",type:"elemental",subtype:"",alignment:"neutral",ac:13,hp:102,hit_dice:"12d10 + 36",speed:"50 ft.",stats:[10,17,16,6,10,7],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"fire, poison",condition_immunities:"exhaustion, grappled, paralyzed, petrified, poisoned, prone, restrained, unconscious",senses:"darkvision 60 ft., passive Perception 10",languages:"Ignan",cr:"5",bestiary:!0,traits:[{name:"Fire Form",desc:"The elemental can move through a space as narrow as 1 inch wide without squeezing. A creature that touches the elemental or hits it with a melee attack while within 5 ft. of it takes 5 (1d10) fire damage. In addition, the elemental can enter a hostile creature's space and stop there. The first time it enters a creature's space on a turn, that creature takes 5 (1d10) fire damage and catches fire; until someone takes an action to douse the fire, the creature takes 5 (1d10) fire damage at the start of each of its turns.",attack_bonus:0,damage_dice:"5d10"},{name:"Illumination",desc:"The elemental sheds bright light in a 30-foot radius and dim light in an additional 30 ft..",attack_bonus:0},{name:"Water Susceptibility",desc:"For every 5 ft. the elemental moves in water, or for every gallon of water splashed on it, it takes 1 cold damage.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The elemental makes two touch attacks.",attack_bonus:0},{name:"Touch",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) fire damage. If the target is a creature or a flammable object, it ignites. Until a creature takes an action to douse the fire, the target takes 5 (1d10) fire damage at the start of each of its turns.",attack_bonus:6,damage_dice:"2d6",damage_bonus:3}]},{name:"Fire Giant",source:"5e SRD",size:"Huge",type:"giant",subtype:"",alignment:"lawful evil",ac:18,hp:162,hit_dice:"13d12 + 77",speed:"30 ft.",stats:[25,9,23,10,14,13],saves:[{dexterity:3},{constitution:10},{charisma:5}],skillsaves:[{athletics:11},{perception:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"passive Perception 16",languages:"Giant",cr:"9",bestiary:!0,actions:[{name:"Multiattack",desc:"The giant makes two greatsword attacks.",attack_bonus:0},{name:"Greatsword",desc:"Melee Weapon Attack: +11 to hit, reach 10 ft., one target. Hit: 28 (6d6 + 7) slashing damage.",attack_bonus:11,damage_dice:"6d6",damage_bonus:7},{name:"Rock",desc:"Ranged Weapon Attack: +11 to hit, range 60/240 ft., one target. Hit: 29 (4d10 + 7) bludgeoning damage.",attack_bonus:11,damage_dice:"4d10",damage_bonus:7}]},{name:"Flesh Golem",source:"5e SRD",size:"Medium",type:"construct",subtype:"",alignment:"neutral",ac:9,hp:93,hit_dice:"11d8 + 43",speed:"30 ft.",stats:[19,9,18,6,10,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning, poison; bludgeoning, piercing, and slashing from nonmagical weapons that aren't adamantine",condition_immunities:"charmed, exhaustion, frightened, paralyzed, petrified, poisoned",senses:"darkvision 60 ft., passive Perception 10",languages:"understands the languages of its creator but can't speak",cr:"5",bestiary:!0,traits:[{name:"Berserk",desc:`Whenever the golem starts its turn with 40 hit points or fewer, roll a d6. On a 6, the golem goes berserk. On each of its turns while berserk, the golem attacks the nearest creature it can see. If no creature is near enough to move to and attack, the golem attacks an object, with preference for an object smaller than itself. Once the golem goes berserk, it continues to do so until it is destroyed or regains all its hit points.
The golem's creator, if within 60 feet of the berserk golem, can try to calm it by speaking firmly and persuasively. The golem must be able to hear its creator, who must take an action to make a DC 15 Charisma (Persuasion) check. If the check succeeds, the golem ceases being berserk. If it takes damage while still at 40 hit points or fewer, the golem might go berserk again.`,attack_bonus:0},{name:"Aversion of Fire",desc:"If the golem takes fire damage, it has disadvantage on attack rolls and ability checks until the end of its next turn.",attack_bonus:0},{name:"Immutable Form",desc:"The golem is immune to any spell or effect that would alter its form.",attack_bonus:0},{name:"Lightning Absorption",desc:"Whenever the golem is subjected to lightning damage, it takes no damage and instead regains a number of hit points equal to the lightning damage dealt.",attack_bonus:0},{name:"Magic Resistance",desc:"The golem has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Magic Weapons",desc:"The golem's weapon attacks are magical.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The golem makes two slam attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) bludgeoning damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:4}]},{name:"Flying Snake",source:"5e SRD",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:14,hp:5,hit_dice:"2d4",speed:"30 ft., fly 60 ft., swim 30 ft.",stats:[4,18,11,2,12,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., passive Perception 11",languages:"",cr:"1/8",bestiary:!0,traits:[{name:"Flyby",desc:"The snake doesn't provoke opportunity attacks when it flies out of an enemy's reach.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 1 piercing damage plus 7 (3d4) poison damage.",attack_bonus:6,damage_bonus:1}]},{name:"Flying Sword",source:"5e SRD",size:"Small",type:"construct",subtype:"",alignment:"unaligned",ac:17,hp:17,hit_dice:"5d6 + -1",speed:"0 ft., fly 50 ft. It can hover.",stats:[12,15,11,1,5,1],saves:[{dexterity:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison, psychic",condition_immunities:"blinded, charmed, deafened, frightened, paralyzed, petrified, poisoned",senses:"blindsight 60 ft. (blind beyond this radius), passive Perception 7",languages:"",cr:"1/4",bestiary:!0,traits:[{name:"Antimagic Susceptibility",desc:"The sword is incapacitated while in the area of an antimagic field. If targeted by dispel magic, the sword must succeed on a Constitution saving throw against the caster's spell save DC or fall unconscious for 1 minute.",attack_bonus:0},{name:"False Appearance",desc:"While the sword remains motionless and isn't flying, it is indistinguishable from a normal sword.",attack_bonus:0}],actions:[{name:"Longsword",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 5 (1d8 + 1) slashing damage.",attack_bonus:3,damage_dice:"1d8",damage_bonus:1}]},{name:"Frog",source:"5e SRD",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:1,hit_dice:"1d4 + -2",speed:"20 ft., swim 20 ft.",stats:[1,13,8,1,8,3],skillsaves:[{perception:1},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 11",languages:"",cr:"0",bestiary:!0,traits:[{name:"Amphibious",desc:"The frog can breathe air and water",attack_bonus:0},{name:"Standing Leap",desc:"The frog's long jump is up to 10 ft. and its high jump is up to 5 ft., with or without a running start.",attack_bonus:0}]},{name:"Frost Giant",source:"5e SRD",size:"Huge",type:"giant",subtype:"",alignment:"neutral evil",ac:15,hp:138,hit_dice:"12d12 + 60",speed:"40 ft.",stats:[23,9,21,9,10,12],saves:[{constitution:8},{wisdom:3},{charisma:4}],skillsaves:[{athletics:9},{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"passive Perception 13",languages:"Giant",cr:"8",bestiary:!0,actions:[{name:"Multiattack",desc:"The giant makes two greataxe attacks.",attack_bonus:0},{name:"Greataxe",desc:"Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 25 (3d12 + 6) slashing damage.",attack_bonus:9,damage_dice:"3d12",damage_bonus:6},{name:"Rock",desc:"Ranged Weapon Attack: +9 to hit, range 60/240 ft., one target. Hit: 28 (4d10 + 6) bludgeoning damage.",attack_bonus:9,damage_dice:"4d10",damage_bonus:6}]},{name:"Gargoyle",source:"5e SRD",size:"Medium",type:"elemental",subtype:"",alignment:"chaotic evil",ac:15,hp:52,hit_dice:"7d8 + 20",speed:"30 ft., fly 60 ft.",stats:[15,11,16,6,11,7],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, and slashing from nonmagical weapons that aren't adamantine",damage_immunities:"poison",condition_immunities:"exhaustion, petrified, poisoned",senses:"darkvision 60 ft., passive Perception 10",languages:"Terran",cr:"2",bestiary:!0,traits:[{name:"False Appearance",desc:"While the gargoyle remains motion less, it is indistinguishable from an inanimate statue.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The gargoyle makes two attacks: one with its bite and one with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Claws",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) slashing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Gelatinous Cube",source:"5e SRD",size:"Large",type:"ooze",subtype:"",alignment:"unaligned",ac:6,hp:84,hit_dice:"8d10 + 40",speed:"15 ft.",stats:[14,3,20,1,6,1],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"blinded, charmed, deafened, exhaustion, frightened, prone",senses:"blindsight 60 ft. (blind beyond this radius), passive Perception 8",languages:"",cr:"2",bestiary:!0,traits:[{name:"Ooze Cube",desc:`The cube takes up its entire space. Other creatures can enter the space, but a creature that does so is subjected to the cube's Engulf and has disadvantage on the saving throw.
Creatures inside the cube can be seen but have total cover.
A creature within 5 feet of the cube can take an action to pull a creature or object out of the cube. Doing so requires a successful DC 12 Strength check, and the creature making the attempt takes 10 (3d6) acid damage.
The cube can hold only one Large creature or up to four Medium or smaller creatures inside it at a time.`,attack_bonus:0},{name:"Transparent",desc:"Even when the cube is in plain sight, it takes a successful DC 15 Wisdom (Perception) check to spot a cube that has neither moved nor attacked. A creature that tries to enter the cube's space while unaware of the cube is surprised by the cube.",attack_bonus:0}],actions:[{name:"Pseudopod",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 10 (3d6) acid damage.",attack_bonus:4,damage_dice:"3d6"},{name:"Engulf",desc:`The cube moves up to its speed. While doing so, it can enter Large or smaller creatures' spaces. Whenever the cube enters a creature's space, the creature must make a DC 12 Dexterity saving throw.
On a successful save, the creature can choose to be pushed 5 feet back or to the side of the cube. A creature that chooses not to be pushed suffers the consequences of a failed saving throw.
On a failed save, the cube enters the creature's space, and the creature takes 10 (3d6) acid damage and is engulfed. The engulfed creature can't breathe, is restrained, and takes 21 (6d6) acid damage at the start of each of the cube's turns. When the cube moves, the engulfed creature moves with it.
An engulfed creature can try to escape by taking an action to make a DC 12 Strength check. On a success, the creature escapes and enters a space of its choice within 5 feet of the cube.`,attack_bonus:0}]},{name:"Ghast",source:"5e SRD",size:"Medium",type:"undead",subtype:"",alignment:"chaotic evil",ac:13,hp:36,hit_dice:"8d8",speed:"30 ft.",stats:[16,17,10,11,10,8],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"necrotic",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 10",languages:"Common",cr:"2",bestiary:!0,traits:[{name:"Stench",desc:"Any creature that starts its turn within 5 ft. of the ghast must succeed on a DC 10 Constitution saving throw or be poisoned until the start of its next turn. On a successful saving throw, the creature is immune to the ghast's Stench for 24 hours.",attack_bonus:0},{name:"Turn Defiance",desc:"The ghast and any ghouls within 30 ft. of it have advantage on saving throws against effects that turn undead.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one creature. Hit: 12 (2d8 + 3) piercing damage.",attack_bonus:3,damage_dice:"2d8",damage_bonus:3},{name:"Claws",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage. If the target is a creature other than an undead, it must succeed on a DC 10 Constitution saving throw or be paralyzed for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3}]},{name:"Ghost",source:"5e SRD",size:"Medium",type:"undead",subtype:"",alignment:"any alignment",ac:11,hp:45,hit_dice:"10d8",speed:"0 ft., fly 40 ft. It can hover.",stats:[7,13,10,10,12,17],damage_vulnerabilities:"",damage_resistances:"acid, fire, lightning, thunder; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"cold, necrotic, poison",condition_immunities:"charmed, exhaustion, frightened, grappled, paralyzed, petrified, poisoned, prone, restrained",senses:"darkvision 60 ft., passive Perception 11",languages:"any languages it knew in life",cr:"4",bestiary:!0,traits:[{name:"Ethereal Sight",desc:"The ghost can see 60 ft. into the Ethereal Plane when it is on the Material Plane, and vice versa.",attack_bonus:0},{name:"Incorporeal Movement",desc:"The ghost can move through other creatures and objects as if they were difficult terrain. It takes 5 (1d10) force damage if it ends its turn inside an object.",attack_bonus:0}],actions:[{name:"Withering Touch",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 17 (4d6 + 3) necrotic damage.",attack_bonus:5,damage_dice:"4d6",damage_bonus:3},{name:"Etherealness",desc:"The ghost enters the Ethereal Plane from the Material Plane, or vice versa. It is visible on the Material Plane while it is in the Border Ethereal, and vice versa, yet it can't affect or be affected by anything on the other plane.",attack_bonus:0},{name:"Horrifying Visage",desc:"Each non-undead creature within 60 ft. of the ghost that can see it must succeed on a DC 13 Wisdom saving throw or be frightened for 1 minute. If the save fails by 5 or more, the target also ages 1d4 _ 10 years. A frightened target can repeat the saving throw at the end of each of its turns, ending the frightened condition on itself on a success. If a target's saving throw is successful or the effect ends for it, the target is immune to this ghost's Horrifying Visage for the next 24 hours. The aging effect can be reversed with a greater restoration spell, but only within 24 hours of it occurring.",attack_bonus:0},{name:"Possession (Recharge 6)",desc:`One humanoid that the ghost can see within 5 ft. of it must succeed on a DC 13 Charisma saving throw or be possessed by the ghost; the ghost then disappears, and the target is incapacitated and loses control of its body. The ghost now controls the body but doesn't deprive the target of awareness. The ghost can't be targeted by any attack, spell, or other effect, except ones that turn undead, and it retains its alignment, Intelligence, Wisdom, Charisma, and immunity to being charmed and frightened. It otherwise uses the possessed target's statistics, but doesn't gain access to the target's knowledge, class features, or proficiencies.
The possession lasts until the body drops to 0 hit points, the ghost ends it as a bonus action, or the ghost is turned or forced out by an effect like the dispel evil and good spell. When the possession ends, the ghost reappears in an unoccupied space within 5 ft. of the body. The target is immune to this ghost's Possession for 24 hours after succeeding on the saving throw or after the possession ends.`,attack_bonus:0}]},{name:"Ghoul",source:"5e SRD",size:"Medium",type:"undead",subtype:"",alignment:"chaotic evil",ac:12,hp:22,hit_dice:"5d8 + -1",speed:"30 ft.",stats:[13,15,10,7,10,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 10",languages:"Common",cr:"1",bestiary:!0,actions:[{name:"Bite",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one creature. Hit: 9 (2d6 + 2) piercing damage.",attack_bonus:2,damage_dice:"2d6",damage_bonus:2},{name:"Claws",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) slashing damage. If the target is a creature other than an elf or undead, it must succeed on a DC 10 Constitution saving throw or be paralyzed for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:0}]},{name:"Giant Ape",source:"5e SRD",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:157,hit_dice:"15d12 + 59",speed:"40 ft., climb 40 ft.",stats:[23,14,18,7,12,7],skillsaves:[{athletics:9},{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"",cr:"7",bestiary:!0,actions:[{name:"Multiattack",desc:"The ape makes two fist attacks.",attack_bonus:0},{name:"Fist",desc:"Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 22 (3d10 + 6) bludgeoning damage.",attack_bonus:9,damage_dice:"3d10",damage_bonus:6},{name:"Rock",desc:"Ranged Weapon Attack: +9 to hit, range 50/100 ft., one target. Hit: 30 (7d6 + 6) bludgeoning damage.",attack_bonus:9,damage_dice:"7d6",damage_bonus:6}]},{name:"Giant Badger",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:13,hit_dice:"2d8 + 4",speed:"30 ft., burrow 10 ft.",stats:[13,10,15,2,12,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 11",languages:"",cr:"1/4",bestiary:!0,traits:[{name:"Keen Smell",desc:"The badger has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The badger makes two attacks: one with its bite and one with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1},{name:"Claws",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 6 (2d4 + 1) slashing damage.",attack_bonus:3,damage_dice:"2d4",damage_bonus:1}]},{name:"Giant Bat",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:22,hit_dice:"4d10",speed:"10 ft., fly 60 ft.",stats:[15,16,11,2,12,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 60 ft., passive Perception 11",languages:"",cr:"1/4",bestiary:!0,traits:[{name:"Echolocation",desc:"The bat can't use its blindsight while deafened.",attack_bonus:0},{name:"Keen Hearing",desc:"The bat has advantage on Wisdom (Perception) checks that rely on hearing.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Giant Boar",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:42,hit_dice:"5d10 + 14",speed:"40 ft.",stats:[17,10,16,2,7,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 8",languages:"",cr:"2",bestiary:!0,traits:[{name:"Charge",desc:"If the boar moves at least 20 ft. straight toward a target and then hits it with a tusk attack on the same turn, the target takes an extra 7 (2d6) slashing damage. If the target is a creature, it must succeed on a DC 13 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"2d6"},{name:"Relentless (Recharges after a Short or Long Rest)",desc:"If the boar takes 10 damage or less that would reduce it to 0 hit points, it is reduced to 1 hit point instead.",attack_bonus:0}],actions:[{name:"Tusk",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3}]},{name:"Giant Centipede",source:"5e SRD",size:"Small",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:4,hit_dice:"1d6",speed:"30 ft., climb 30 ft.",stats:[5,14,12,1,7,3],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 30 ft., passive Perception 8",languages:"",cr:"1/4",bestiary:!0,actions:[{name:"Bite",desc:"Bite. Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 4 (1d4 + 2) piercing damage, and the target must succeed on a DC 11 Constitution saving throw or take 10 (3d6) poison damage. If the poison damage reduces the target to 0 hit points, the target is stable but poisoned for 1 hour, even after regaining hit points, and is paralyzed while poisoned in this way.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Giant Constrictor Snake",source:"5e SRD",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:60,hit_dice:"8d12 + 8",speed:"30 ft., swim 30 ft.",stats:[19,14,12,1,10,3],skillsaves:[{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., passive Perception 12",languages:"",cr:"2",bestiary:!0,actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one creature. Hit: 11 (2d6 + 4) piercing damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4},{name:"Constrict",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one creature. Hit: 13 (2d8 + 4) bludgeoning damage, and the target is grappled (escape DC 16). Until this grapple ends, the creature is restrained, and the snake can't constrict another target.",attack_bonus:6,damage_dice:"2d8",damage_bonus:4}]},{name:"Giant Crab",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:15,hp:13,hit_dice:"3d8 + -1",speed:"30 ft., swim 30 ft.",stats:[13,15,11,1,9,3],skillsaves:[{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 30 ft., passive Perception 9",languages:"",cr:"1/8",bestiary:!0,traits:[{name:"Amphibious",desc:"The crab can breathe air and water.",attack_bonus:0}],actions:[{name:"Claw",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) bludgeoning damage, and the target is grappled (escape DC 11). The crab has two claws, each of which can grapple only one target.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Giant Crocodile",source:"5e SRD",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:14,hp:85,hit_dice:"9d12 + 26",speed:"30 ft., swim 50 ft.",stats:[21,9,17,2,10,7],skillsaves:[{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"5",bestiary:!0,traits:[{name:"Hold Breath",desc:"The crocodile can hold its breath for 30 minutes.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The crocodile makes two attacks: one with its bite and one with its tail.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 21 (3d10 + 5) piercing damage, and the target is grappled (escape DC 16). Until this grapple ends, the target is restrained, and the crocodile can't bite another target.",attack_bonus:8,damage_dice:"3d10",damage_bonus:5},{name:"Tail",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target not grappled by the crocodile. Hit: 14 (2d8 + 5) bludgeoning damage. If the target is a creature, it must succeed on a DC 16 Strength saving throw or be knocked prone.",attack_bonus:8,damage_dice:"2d8",damage_bonus:5}]},{name:"Giant Eagle",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"neutral good",ac:13,hp:26,hit_dice:"4d10 + 4",speed:"10 ft., fly 80 ft.",stats:[16,17,13,8,14,10],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"Giant Eagle, understands Common and Auran but can't speak",cr:"1",bestiary:!0,traits:[{name:"Keen Sight",desc:"The eagle has advantage on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The eagle makes two attacks: one with its beak and one with its talons.",attack_bonus:0},{name:"Beak",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Talons",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3}]},{name:"Giant Elk",source:"5e SRD",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:15,hp:42,hit_dice:"5d12 + 9",speed:"60 ft.",stats:[19,16,14,7,14,10],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"Giant Elk, understands Common, Elvish, and Sylvan but can't speak",cr:"2",bestiary:!0,traits:[{name:"Charge",desc:"If the elk moves at least 20 ft. straight toward a target and then hits it with a ram attack on the same turn, the target takes an extra 7 (2d6) damage. If the target is a creature, it must succeed on a DC 14 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"2d6"}],actions:[{name:"Ram",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4},{name:"Hooves",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one prone creature. Hit: 22 (4d8 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"4d8",damage_bonus:4}]},{name:"Giant Fire Beetle",source:"5e SRD",size:"Small",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:4,hit_dice:"1d6",speed:"30 ft.",stats:[8,10,12,1,7,3],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 30 ft., passive Perception 8",languages:"",cr:"0",bestiary:!0,traits:[{name:"Illumination",desc:"The beetle sheds bright light in a 10-foot radius and dim light for an additional 10 ft..",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +1 to hit, reach 5 ft., one target. Hit: 2 (1d6 \u2014 1) slashing damage.",attack_bonus:1,damage_dice:"1d6",damage_bonus:-1}]},{name:"Giant Frog",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:18,hit_dice:"4d8",speed:"30 ft., swim 30 ft.",stats:[12,13,11,2,10,3],skillsaves:[{perception:2},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 12",languages:"",cr:"1/4",bestiary:!0,traits:[{name:"Amphibious",desc:"The frog can breathe air and water",attack_bonus:0},{name:"Standing Leap",desc:"The frog's long jump is up to 20 ft. and its high jump is up to 10 ft., with or without a running start.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) piercing damage, and the target is grappled (escape DC 11). Until this grapple ends, the target is restrained, and the frog can't bite another target.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1},{name:"Swallow",desc:"The frog makes one bite attack against a Small or smaller target it is grappling. If the attack hits, the target is swallowed, and the grapple ends. The swallowed target is blinded and restrained, it has total cover against attacks and other effects outside the frog, and it takes 5 (2d4) acid damage at the start of each of the frog's turns. The frog can have only one target swallowed at a time. If the frog dies, a swallowed creature is no longer restrained by it and can escape from the corpse using 5 ft. of movement, exiting prone.",attack_bonus:0}]},{name:"Giant Goat",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:19,hit_dice:"3d10 + 2",speed:"40 ft.",stats:[17,11,12,3,12,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 11",languages:"",cr:"1/2",bestiary:!0,traits:[{name:"Charge",desc:"If the goat moves at least 20 ft. straight toward a target and then hits it with a ram attack on the same turn, the target takes an extra 5 (2d4) bludgeoning damage. If the target is a creature, it must succeed on a DC 13 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"2d4"},{name:"Sure-Footed",desc:"The goat has advantage on Strength and Dexterity saving throws made against effects that would knock it prone.",attack_bonus:0}],actions:[{name:"Ram",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (2d4 + 3) bludgeoning damage.",attack_bonus:5,damage_dice:"2d4",damage_bonus:3}]},{name:"Giant Hyena",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:45,hit_dice:"6d10 + 12",speed:"50 ft.",stats:[16,14,14,2,12,7],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"1",bestiary:!0,traits:[{name:"Rampage",desc:"When the hyena reduces a creature to 0 hit points with a melee attack on its turn, the hyena can take a bonus action to move up to half its speed and make a bite attack.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3}]},{name:"Giant Lizard",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:19,hit_dice:"3d10 + 2",speed:"30 ft., climb 30 ft.",stats:[15,12,13,2,10,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 10",languages:"",cr:"1/4",bestiary:!0,traits:[{name:"Variant: Hold Breath",desc:"The lizard can hold its breath for 15 minutes. (A lizard that has this trait also has a swimming speed of 30 feet.)",attack_bonus:0},{name:"Variant: Spider Climb",desc:"The lizard can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2}]},{name:"Giant Octopus",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:52,hit_dice:"8d10 + 8",speed:"10 ft., swim 60 ft.",stats:[17,13,13,4,10,4],skillsaves:[{perception:4},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"",cr:"1",bestiary:!0,traits:[{name:"Hold Breath",desc:"While out of water, the octopus can hold its breath for 1 hour.",attack_bonus:0},{name:"Underwater Camouflage",desc:"The octopus has advantage on Dexterity (Stealth) checks made while underwater.",attack_bonus:0},{name:"Water Breathing",desc:"The octopus can breathe only underwater.",attack_bonus:0}],actions:[{name:"Tentacles",desc:"Melee Weapon Attack: +5 to hit, reach 15 ft., one target. Hit: 10 (2d6 + 3) bludgeoning damage. If the target is a creature, it is grappled (escape DC 16). Until this grapple ends, the target is restrained, and the octopus can't use its tentacles on another target.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3},{name:"Ink Cloud (Recharges after a Short or Long Rest)",desc:"A 20-foot-radius cloud of ink extends all around the octopus if it is underwater. The area is heavily obscured for 1 minute, although a significant current can disperse the ink. After releasing the ink, the octopus can use the Dash action as a bonus action.",attack_bonus:0}]},{name:"Giant Owl",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"neutral",ac:12,hp:19,hit_dice:"3d10 + 2",speed:"5 ft., fly 60 ft.",stats:[13,15,12,8,13,10],skillsaves:[{perception:5},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 15",languages:"Giant Owl, understands Common, Elvish, and Sylvan but can't speak",cr:"1/4",bestiary:!0,traits:[{name:"Flyby",desc:"The owl doesn't provoke opportunity attacks when it flies out of an enemy's reach.",attack_bonus:0},{name:"Keen Hearing and Sight",desc:"The owl has advantage on Wisdom (Perception) checks that rely on hearing or sight.",attack_bonus:0}],actions:[{name:"Talons",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 8 (2d6 + 1) slashing damage.",attack_bonus:3,damage_dice:"2d6",damage_bonus:1}]},{name:"Giant Poisonous Snake",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:14,hp:11,hit_dice:"2d8 + 2",speed:"30 ft., swim 30 ft.",stats:[10,18,13,2,10,3],skillsaves:[{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., passive Perception 12",languages:"",cr:"1/4",bestiary:!0,actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 6 (1d4 + 4) piercing damage, and the target must make a DC 11 Constitution saving throw, taking 10 (3d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:6,damage_dice:"1d4",damage_bonus:4}]},{name:"Giant Rat",source:"5e SRD",size:"Small",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:7,hit_dice:"2d6",speed:"30 ft.",stats:[7,15,11,2,10,4],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"",cr:"1/8",bestiary:!0,traits:[{name:"Keen Smell",desc:"The rat has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0},{name:"Pack Tactics",desc:"The rat has advantage on an attack roll against a creature if at least one of the rat's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Giant Rat (Diseased)",source:"5e SRD",size:"Small",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:7,hit_dice:"2d6",speed:"30 ft.",stats:[7,15,11,2,10,4],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"",cr:"1/8",bestiary:!0,actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 3 (1d4 + 2) piercing damage. If the target is a creature, it must succeed on a DC 10 Constitution saving throw or contract a disease. Until the disease is cured, the target can't regain hit points except by magical means, and the target's hit point maximum decreases by 3 (1d6) every 24 hours. If the target's hit point maximum drops to 0 as a result of this disease, the target dies.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Giant Scorpion",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:15,hp:52,hit_dice:"7d10 + 13",speed:"40 ft.",stats:[15,13,15,1,9,3],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 60 ft., passive Perception 9",languages:"",cr:"3",bestiary:!0,actions:[{name:"Claw",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) bludgeoning damage, and the target is grappled (escape DC 12). The scorpion has two claws, each of which can grapple only one target.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2},{name:"Multiattack",desc:"The scorpion makes three attacks: two with its claws and one with its sting.",attack_bonus:0},{name:"Sting",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 7 (1d10 + 2) piercing damage, and the target must make a DC 12 Constitution saving throw, taking 22 (4d10) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:4,damage_dice:"1d10",damage_bonus:2}]},{name:"Giant Sea Horse",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:16,hit_dice:"3d10 + -1",speed:"0 ft., swim 40 ft.",stats:[12,15,11,2,12,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 11",languages:"",cr:"1/2",bestiary:!0,traits:[{name:"Charge",desc:"If the sea horse moves at least 20 ft. straight toward a target and then hits it with a ram attack on the same turn, the target takes an extra 7 (2d6) bludgeoning damage. If the target is a creature, it must succeed on a DC 11 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"2d6"},{name:"Water Breathing",desc:"The sea horse can breathe only underwater.",attack_bonus:0}],actions:[{name:"Ram",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) bludgeoning damage.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Giant Shark",source:"5e SRD",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:126,hit_dice:"11d12 + 54",speed:"swim 50 ft.",stats:[23,11,21,1,10,5],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 60 ft., passive Perception 13",languages:"",cr:"5",bestiary:!0,traits:[{name:"Blood Frenzy",desc:"The shark has advantage on melee attack rolls against any creature that doesn't have all its hit points.",attack_bonus:0},{name:"Water Breathing",desc:"The shark can breathe only underwater.",attack_bonus:0}],actions:[{name:"Bite",desc:"Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 22 (3d10 + 6) piercing damage.",attack_bonus:9,damage_dice:"3d10",damage_bonus:6}]},{name:"Giant Spider",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:14,hp:26,hit_dice:"4d10 + 4",speed:"30 ft., climb 30 ft.",stats:[14,16,12,2,11,4],skillsaves:[{stealth:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 10",languages:"",cr:"1",bestiary:!0,traits:[{name:"Spider Climb",desc:"The spider can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0},{name:"Web Sense",desc:"While in contact with a web, the spider knows the exact location of any other creature in contact with the same web.",attack_bonus:0},{name:"Web Walker",desc:"The spider ignores movement restrictions caused by webbing.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one creature. Hit: 7 (1d8 + 3) piercing damage, and the target must make a DC 11 Constitution saving throw, taking 9 (2d8) poison damage on a failed save, or half as much damage on a successful one. If the poison damage reduces the target to 0 hit points, the target is stable but poisoned for 1 hour, even after regaining hit points, and is paralyzed while poisoned in this way.",attack_bonus:5,damage_dice:"1d8",damage_bonus:3},{name:"Web (Recharge 5-6)",desc:"Ranged Weapon Attack: +5 to hit, range 30/60 ft., one creature. Hit: The target is restrained by webbing. As an action, the restrained target can make a DC 12 Strength check, bursting the webbing on a success. The webbing can also be attacked and destroyed (AC 10; hp 5; vulnerability to fire damage; immunity to bludgeoning, poison, and psychic damage).",attack_bonus:5}]},{name:"Giant Toad",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:39,hit_dice:"6d10 + 6",speed:"20 ft., swim 40 ft.",stats:[15,13,13,2,10,3],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 10",languages:"",cr:"1",bestiary:!0,traits:[{name:"Amphibious",desc:"The toad can breathe air and water",attack_bonus:0},{name:"Standing Leap",desc:"The toad's long jump is up to 20 ft. and its high jump is up to 10 ft., with or without a running start.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (1d10 + 2) piercing damage plus 5 (1d10) poison damage, and the target is grappled (escape DC 13). Until this grapple ends, the target is restrained, and the toad can't bite another target.",attack_bonus:4,damage_dice:"1d10",damage_bonus:2},{name:"Swallow",desc:`The toad makes one bite attack against a Medium or smaller target it is grappling. If the attack hits, the target is swallowed, and the grapple ends. The swallowed target is blinded and restrained, it has total cover against attacks and other effects outside the toad, and it takes 10 (3d6) acid damage at the start of each of the toad's turns. The toad can have only one target swallowed at a time.
If the toad dies, a swallowed creature is no longer restrained by it and can escape from the corpse using 5 feet of movement, exiting prone.`,attack_bonus:0}]},{name:"Giant Vulture",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"neutral evil",ac:10,hp:22,hit_dice:"3d10 + 5",speed:"10 ft., fly 60 ft.",stats:[15,10,15,6,12,7],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"understands Common but can't speak",cr:"1",bestiary:!0,traits:[{name:"Keen Sight and Smell",desc:"The vulture has advantage on Wisdom (Perception) checks that rely on sight or smell.",attack_bonus:0},{name:"Pack Tactics",desc:"The vulture has advantage on an attack roll against a creature if at least one of the vulture's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The vulture makes two attacks: one with its beak and one with its talons.",attack_bonus:0},{name:"Beak",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) piercing damage.",attack_bonus:4,damage_dice:"2d4",damage_bonus:2},{name:"Talons",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 9 (2d6 + 2) slashing damage.",attack_bonus:4,damage_dice:"2d6",damage_bonus:2}]},{name:"Giant Wasp",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:13,hit_dice:"3d8 + -1",speed:"10 ft., fly 50 ft., swim 50 ft.",stats:[10,14,10,1,10,3],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"1/2",bestiary:!0,actions:[{name:"Sting",desc:"Sting. Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 5 (1d6 + 2) piercing damage, and the target must make a DC 11 Constitution saving throw, taking 10 (3d6) poison damage on a failed save, or half as much damage on a successful one. If the poison damage reduces the target to 0 hit points, the target is stable but poisoned for 1 hour, even after regaining hit points, and is paralyzed while poisoned in this way.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Giant Weasel",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:9,hit_dice:"2d8",speed:"40 ft.",stats:[11,16,10,4,12,5],skillsaves:[{perception:3},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 13",languages:"",cr:"1/8",bestiary:!0,traits:[{name:"Keen Hearing and Smell",desc:"The weasel has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0}],actions:[{name:"Bite",desc:"Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 5 (1d4 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d4",damage_bonus:3}]},{name:"Giant Wolf Spider",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:11,hit_dice:"2d8 + 2",speed:"40 ft., climb 40 ft.",stats:[12,16,13,3,12,4],skillsaves:[{perception:3},{stealth:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 13",languages:"",cr:"1/4",bestiary:!0,traits:[{name:"Spider Climb",desc:"The spider can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0},{name:"Web Sense",desc:"While in contact with a web, the spider knows the exact location of any other creature in contact with the same web.",attack_bonus:0},{name:"Web Walker",desc:"The spider ignores movement restrictions caused by webbing.",attack_bonus:0}],actions:[{name:"Bite",desc:"Weapon Attack: +3 to hit, reach 5 ft., one creature. Hit: 4 (1d6 + 1) piercing damage, and the target must make a DC 11 Constitution saving throw, taking 7 (2d6) poison damage on a failed save, or half as much damage on a successful one. If the poison damage reduces the target to 0 hit points, the target is stable but poisoned for 1 hour, even after regaining hit points, and is paralyzed while poisoned in this way.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Gibbering Mouther",source:"5e SRD",size:"Medium",type:"aberration",subtype:"",alignment:"neutral",ac:9,hp:67,hit_dice:"9d8 + 26",speed:"10 ft., swim 10 ft.",stats:[10,8,16,3,10,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"prone",senses:"darkvision 60 ft., passive Perception 10",languages:"",cr:"2",bestiary:!0,traits:[{name:"Aberrant Ground",desc:"The ground in a 10-foot radius around the mouther is doughlike difficult terrain. Each creature that starts its turn in that area must succeed on a DC 10 Strength saving throw or have its speed reduced to 0 until the start of its next turn.",attack_bonus:0},{name:"Gibbering",desc:"The mouther babbles incoherently while it can see any creature and isn't incapacitated. Each creature that starts its turn within 20 feet of the mouther and can hear the gibbering must succeed on a DC 10 Wisdom saving throw. On a failure, the creature can't take reactions until the start of its next turn and rolls a d8 to determine what it does during its turn. On a 1 to 4, the creature does nothing. On a 5 or 6, the creature takes no action or bonus action and uses all its movement to move in a randomly determined direction. On a 7 or 8, the creature makes a melee attack against a randomly determined creature within its reach or does nothing if it can't make such an attack.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The gibbering mouther makes one bite attack and, if it can, uses its Blinding Spittle.",attack_bonus:0},{name:"Bites",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one creature. Hit: 17 (5d6) piercing damage. If the target is Medium or smaller, it must succeed on a DC 10 Strength saving throw or be knocked prone. If the target is killed by this damage, it is absorbed into the mouther.",attack_bonus:2,damage_dice:"5d6"},{name:"Blinding Spittle (Recharge 5-6)",desc:"The mouther spits a chemical glob at a point it can see within 15 feet of it. The glob explodes in a blinding flash of light on impact. Each creature within 5 feet of the flash must succeed on a DC 13 Dexterity saving throw or be blinded until the end of the mouther's next turn.",attack_bonus:0}]},{name:"Glabrezu",source:"5e SRD",size:"Large",type:"fiend",subtype:"demon",alignment:"chaotic evil",ac:17,hp:157,hit_dice:"15d10 + 74",speed:"40 ft.",stats:[20,15,21,19,17,16],saves:[{strength:9},{constitution:9},{wisdom:7},{charisma:7}],damage_vulnerabilities:"",damage_resistances:"cold, fire, lightning; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"poisoned",senses:"truesight 120 ft., passive Perception 13",languages:"Abyssal, telepathy 120 ft.",cr:"9",bestiary:!0,traits:[{name:"Innate Spellcasting",desc:`The glabrezu's spellcasting ability is Intelligence (spell save DC 16). The glabrezu can innately cast the following spells, requiring no material components:
At will: darkness, detect magic, dispel magic
1/day each: confusion, fly, power word stun`,attack_bonus:0},{name:"Magic Resistance",desc:"The glabrezu has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The glabrezu makes four attacks: two with its pincers and two with its fists. Alternatively, it makes two attacks with its pincers and casts one spell.",attack_bonus:0},{name:"Pincer",desc:"Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 16 (2d10 + 5) bludgeoning damage. If the target is a Medium or smaller creature, it is grappled (escape DC 15). The glabrezu has two pincers, each of which can grapple only one target.",attack_bonus:9,damage_dice:"2d10",damage_bonus:5},{name:"Fist",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) bludgeoning damage.",attack_bonus:9,damage_dice:"2d4",damage_bonus:2},{name:"Variant: Summon Demon (1/Day)",desc:`The demon chooses what to summon and attempts a magical summoning.
A glabrezu has a 30 percent chance of summoning 1d3 vrocks, 1d2 hezrous, or one glabrezu.
A summoned demon appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other demons. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.`,attack_bonus:0}]},{name:"Gladiator",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:16,hp:112,hit_dice:"15d8 + 44",speed:"30 ft.",stats:[18,15,16,10,12,15],saves:[{strength:7},{dexterity:5},{constitution:6}],skillsaves:[{intimidation:5},{athletics:10}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 11",languages:"any one language (usually Common)",cr:"5",bestiary:!0,traits:[{name:"Brave",desc:"The gladiator has advantage on saving throws against being frightened.",attack_bonus:0},{name:"Brute",desc:"A melee weapon deals one extra die of its damage when the gladiator hits with it (included in the attack).",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The gladiator makes three melee attacks or two ranged attacks.",attack_bonus:0},{name:"Spear",desc:"Melee or Ranged Weapon Attack: +7 to hit, reach 5 ft. and range 20/60 ft., one target. Hit: 11 (2d6 + 4) piercing damage, or 13 (2d8 + 4) piercing damage if used with two hands to make a melee attack.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Shield Bash",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one creature. Hit: 9 (2d4 + 4) bludgeoning damage. If the target is a Medium or smaller creature, it must succeed on a DC 15 Strength saving throw or be knocked prone.",attack_bonus:7,damage_dice:"2d4",damage_bonus:4}],reactions:[{name:"Parry",desc:"The gladiator adds 3 to its AC against one melee attack that would hit it. To do so, the gladiator must see the attacker and be wielding a melee weapon.",attack_bonus:0}]},{name:"Gnoll",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"gnoll",alignment:"chaotic evil",ac:15,hp:22,hit_dice:"5d8 + -1",speed:"30 ft.",stats:[14,12,11,6,10,7],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"Gnoll",cr:"1/2",bestiary:!0,traits:[{name:"Rampage",desc:"When the gnoll reduces a creature to 0 hit points with a melee attack on its turn, the gnoll can take a bonus action to move up to half its speed and make a bite attack.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 4 (1d4 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2},{name:"Spear",desc:"Melee or Ranged Weapon Attack: +4 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 5 (1d6 + 2) piercing damage, or 6 (1d8 + 2) piercing damage if used with two hands to make a melee attack.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Longbow",desc:"Ranged Weapon Attack: +3 to hit, range 150/600 ft., one target. Hit: 5 (1d8 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d8",damage_bonus:1}]},{name:"Goat",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:4,hit_dice:"1d8 + -1",speed:"40 ft.",stats:[12,10,11,2,10,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"0",bestiary:!0,traits:[{name:"Charge",desc:"If the goat moves at least 20 ft. straight toward a target and then hits it with a ram attack on the same turn, the target takes an extra 2 (1d4) bludgeoning damage. If the target is a creature, it must succeed on a DC 10 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"1d4"},{name:"Sure-Footed",desc:"The goat has advantage on Strength and Dexterity saving throws made against effects that would knock it prone.",attack_bonus:0}],actions:[{name:"Ram",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 3 (1d4 + 1) bludgeoning damage.",attack_bonus:3,damage_dice:"1d4",damage_bonus:1}]},{name:"Goblin",source:"5e SRD",size:"Small",type:"humanoid",subtype:"goblinoid",alignment:"neutral evil",ac:15,hp:7,hit_dice:"2d6",speed:"30 ft.",stats:[8,14,10,10,8,8],skillsaves:[{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 9",languages:"Common, Goblin",cr:"1/4",bestiary:!0,traits:[{name:"Nimble Escape",desc:"The goblin can take the Disengage or Hide action as a bonus action on each of its turns.",attack_bonus:0}],actions:[{name:"Scimitar",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) slashing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Shortbow",desc:"Ranged Weapon Attack: +4 to hit, range 80/320 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Gold Dragon Wyrmling",source:"5e SRD",size:"Medium",type:"dragon",subtype:"",alignment:"lawful good",ac:17,hp:60,hit_dice:"8d8 + 24",speed:"30 ft., fly 60 ft., swim 30 ft.",stats:[19,14,17,14,11,16],saves:[{dexterity:4},{constitution:5},{wisdom:2},{charisma:5}],skillsaves:[{perception:4},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"3",bestiary:!0,traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 9 (1d10 + 4) piercing damage.",attack_bonus:6,damage_dice:"1d10",damage_bonus:4},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Fire Breath. The dragon exhales fire in a 15-foot cone. Each creature in that area must make a DC 13 Dexterity saving throw, taking 22 (4d10) fire damage on a failed save, or half as much damage on a successful one.
Weakening Breath. The dragon exhales gas in a 15-foot cone. Each creature in that area must succeed on a DC 13 Strength saving throw or have disadvantage on Strength-based attack rolls, Strength checks, and Strength saving throws for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.`,attack_bonus:0,damage_dice:"4d10"}]},{name:"Gorgon",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"unaligned",ac:19,hp:114,hit_dice:"12d10 + 48",speed:"40 ft.",stats:[20,11,18,2,12,7],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"petrified",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"",cr:"5",bestiary:!0,traits:[{name:"Trampling Charge",desc:"If the gorgon moves at least 20 feet straight toward a creature and then hits it with a gore attack on the same turn, that target must succeed on a DC 16 Strength saving throw or be knocked prone. If the target is prone, the gorgon can make one attack with its hooves against it as a bonus action.",attack_bonus:0}],actions:[{name:"Gore",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 18 (2d12 + 5) piercing damage.",attack_bonus:8,damage_dice:"2d12",damage_bonus:5},{name:"Hooves",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 16 (2d10 + 5) bludgeoning damage.",attack_bonus:8,damage_dice:"2d10",damage_bonus:5},{name:"Petrifying Breath (Recharge 5-6)",desc:"The gorgon exhales petrifying gas in a 30-foot cone. Each creature in that area must succeed on a DC 13 Constitution saving throw. On a failed save, a target begins to turn to stone and is restrained. The restrained target must repeat the saving throw at the end of its next turn. On a success, the effect ends on the target. On a failure, the target is petrified until freed by the greater restoration spell or other magic.",attack_bonus:0}]},{name:"Gray Ooze",source:"5e SRD",size:"Medium",type:"ooze",subtype:"",alignment:"unaligned",ac:8,hp:22,hit_dice:"3d8 + 8",speed:"10 ft., climb 10 ft.",stats:[12,6,16,1,6,2],skillsaves:[{stealth:2}],damage_vulnerabilities:"",damage_resistances:"acid, cold, fire",damage_immunities:"",condition_immunities:"blinded, charmed, deafened, exhaustion, frightened, prone",senses:"blindsight 60 ft. (blind beyond this radius), passive Perception 8",languages:"",cr:"1/2",bestiary:!0,traits:[{name:"Amorphous",desc:"The ooze can move through a space as narrow as 1 inch wide without squeezing.",attack_bonus:0},{name:"Corrode Metal",desc:`Any nonmagical weapon made of metal that hits the ooze corrodes. After dealing damage, the weapon takes a permanent and cumulative -1 penalty to damage rolls. If its penalty drops to -5, the weapon is destroyed. Nonmagical ammunition made of metal that hits the ooze is destroyed after dealing damage.
The ooze can eat through 2-inch-thick, nonmagical metal in 1 round.`,attack_bonus:0},{name:"False Appearance",desc:"While the ooze remains motionless, it is indistinguishable from an oily pool or wet rock.",attack_bonus:0}],actions:[{name:"Pseudopod",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) bludgeoning damage plus 7 (2d6) acid damage, and if the target is wearing nonmagical metal armor, its armor is partly corroded and takes a permanent and cumulative -1 penalty to the AC it offers. The armor is destroyed if the penalty reduces its AC to 10.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Green Dragon Wyrmling",source:"5e SRD",size:"Medium",type:"dragon",subtype:"",alignment:"lawful evil",ac:17,hp:38,hit_dice:"7d8 + 6",speed:"30 ft., fly 60 ft., swim 30 ft.",stats:[15,12,13,14,11,13],saves:[{dexterity:3},{constitution:3},{wisdom:2},{charisma:3}],skillsaves:[{perception:4},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"poisoned",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"2",bestiary:!0,traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (1d10 + 2) piercing damage plus 3 (1d6) poison damage.",attack_bonus:4,damage_dice:"1d10 + 1d6",damage_bonus:3},{name:"Poison Breath (Recharge 5-6)",desc:"The dragon exhales poisonous gas in a 15-foot cone. Each creature in that area must make a DC 11 Constitution saving throw, taking 21 (6d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"6d6"}]},{name:"Green Hag",source:"5e SRD",size:"Medium",type:"fey",subtype:"",alignment:"neutral evil",ac:17,hp:82,hit_dice:"11d8 + 32",speed:"30 ft.",stats:[18,12,16,13,14,14],skillsaves:[{arcana:3},{deception:4},{perception:4},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"Common, Draconic, Sylvan",cr:"3",bestiary:!0,traits:[{name:"Amphibious",desc:"The hag can breathe air and water.",attack_bonus:0},{name:"Innate Spellcasting",desc:`The hag's innate spellcasting ability is Charisma (spell save DC 12). She can innately cast the following spells, requiring no material components:
At will: dancing lights, minor illusion, vicious mockery`,attack_bonus:0},{name:"Mimicry",desc:"The hag can mimic animal sounds and humanoid voices. A creature that hears the sounds can tell they are imitations with a successful DC 14 Wisdom (Insight) check.",attack_bonus:0},{name:"Hag Coven",desc:`When hags must work together, they form covens, in spite of their selfish natures. A coven is made up of hags of any type, all of whom are equals within the group. However, each of the hags continues to desire more personal power.
A coven consists of three hags so that any arguments between two hags can be settled by the third. If more than three hags ever come together, as might happen if two covens come into conflict, the result is usually chaos.`,attack_bonus:0},{name:"Shared Spellcasting (Coven Only)",desc:`While all three members of a hag coven are within 30 feet of one another, they can each cast the following spells from the wizard's spell list but must share the spell slots among themselves:
\u2022 1st level (4 slots): identify, ray of sickness
\u2022 2nd level (3 slots): hold person, locate object
\u2022 3rd level (3 slots): bestow curse, counterspell, lightning bolt
\u2022 4th level (3 slots): phantasmal killer, polymorph
\u2022 5th level (2 slots): contact other plane, scrying
\u2022 6th level (1 slot): eye bite
For casting these spells, each hag is a 12th-level spellcaster that uses Intelligence as her spellcasting ability. The spell save DC is 12+the hag's Intelligence modifier, and the spell attack bonus is 4+the hag's Intelligence modifier.`,attack_bonus:0},{name:"Hag Eye (Coven Only)",desc:`A hag coven can craft a magic item called a hag eye, which is made from a real eye coated in varnish and often fitted to a pendant or other wearable item. The hag eye is usually entrusted to a minion for safekeeping and transport. A hag in the coven can take an action to see what the hag eye sees if the hag eye is on the same plane of existence. A hag eye has AC 10, 1 hit point, and darkvision with a radius of 60 feet. If it is destroyed, each coven member takes 3d10 psychic damage and is blinded for 24 hours.
A hag coven can have only one hag eye at a time, and creating a new one requires all three members of the coven to perform a ritual. The ritual takes 1 hour, and the hags can't perform it while blinded. During the ritual, if the hags take any action other than performing the ritual, they must start over.`,attack_bonus:0}],actions:[{name:"Claws",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) slashing damage.",attack_bonus:6,damage_dice:"2d8",damage_bonus:4},{name:"Illusory Appearance",desc:`The hag covers herself and anything she is wearing or carrying with a magical illusion that makes her look like another creature of her general size and humanoid shape. The illusion ends if the hag takes a bonus action to end it or if she dies.
The changes wrought by this effect fail to hold up to physical inspection. For example, the hag could appear to have smooth skin, but someone touching her would feel her rough flesh. Otherwise, a creature must take an action to visually inspect the illusion and succeed on a DC 20 Intelligence (Investigation) check to discern that the hag is disguised.`,attack_bonus:0},{name:"Invisible Passage",desc:"The hag magically turns invisible until she attacks or casts a spell, or until her concentration ends (as if concentrating on a spell). While invisible, she leaves no physical evidence of her passage, so she can be tracked only by magic. Any equipment she wears or carries is invisible with her.",attack_bonus:0}]},{name:"Grick",source:"5e SRD",size:"Medium",type:"monstrosity",subtype:"",alignment:"neutral",ac:14,hp:27,hit_dice:"6d8",speed:"30 ft., climb 30 ft.",stats:[14,14,11,3,14,5],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, and slashing damage from nonmagical weapons",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 12",languages:"",cr:"2",bestiary:!0,traits:[{name:"Stone Camouflage",desc:"The grick has advantage on Dexterity (Stealth) checks made to hide in rocky terrain.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The grick makes one attack with its tentacles. If that attack hits, the grick can make one beak attack against the same target.",attack_bonus:0},{name:"Tentacles",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 9 (2d6 + 2) slashing damage.",attack_bonus:4,damage_dice:"2d6",damage_bonus:2},{name:"Beak",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Griffon",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"unaligned",ac:12,hp:59,hit_dice:"7d10 + 20",speed:"30 ft., fly 80 ft.",stats:[18,15,16,2,13,8],skillsaves:[{perception:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 15",languages:"",cr:"2",bestiary:!0,traits:[{name:"Keen Sight",desc:"The griffon has advantage on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The griffon makes two attacks: one with its beak and one with its claws.",attack_bonus:0},{name:"Beak",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 8 (1d8 + 4) piercing damage.",attack_bonus:6,damage_dice:"1d8",damage_bonus:4},{name:"Claws",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4}]},{name:"Grimlock",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"grimlock",alignment:"neutral evil",ac:11,hp:11,hit_dice:"2d8 + 2",speed:"30 ft.",stats:[16,12,12,9,8,6],skillsaves:[{athletics:5},{perception:3},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"blinded",condition_immunities:"",senses:"blindsight 30 ft. or 10 ft. while deafened (blind beyond this radius), passive Perception 13",languages:"Undercommon",cr:"1/4",bestiary:!0,traits:[{name:"Blind Senses",desc:"The grimlock can't use its blindsight while deafened and unable to smell.",attack_bonus:0},{name:"Keen Hearing and Smell",desc:"The grimlock has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0},{name:"Stone Camouflage",desc:"The grimlock has advantage on Dexterity (Stealth) checks made to hide in rocky terrain.",attack_bonus:0}],actions:[{name:"Spiked Bone Club",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 5 (1d4 + 3) bludgeoning damage plus 2 (1d4) piercing damage.",attack_bonus:5,damage_dice:"1d4 + 1d4",damage_bonus:5}]},{name:"Guard",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:16,hp:11,hit_dice:"2d8 + 2",speed:"30 ft.",stats:[13,12,12,10,11,10],skillsaves:[{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 12",languages:"any one language (usually Common)",cr:"1/8",bestiary:!0,actions:[{name:"Spear",desc:"Melee or Ranged Weapon Attack: +3 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 4 (1d6 + 1) piercing damage or 5 (1d8 + 1) piercing damage if used with two hands to make a melee attack.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Guardian Naga",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"lawful good",ac:18,hp:127,hit_dice:"15d10 + 44",speed:"40 ft.",stats:[19,18,16,16,19,18],saves:[{dexterity:8},{constitution:7},{intelligence:7},{wisdom:8},{charisma:8}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"charmed, poisoned",senses:"darkvision 60 ft., passive Perception 14",languages:"Celestial, Common",cr:"10",bestiary:!0,traits:[{name:"Rejuvenation",desc:"If it dies, the naga returns to life in 1d6 days and regains all its hit points. Only a wish spell can prevent this trait from functioning.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one creature. Hit: 8 (1d8 + 4) piercing damage, and the target must make a DC 15 Constitution saving throw, taking 45 (10d8) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:8,damage_dice:"1d8",damage_bonus:4},{name:"Spit Poison",desc:"Ranged Weapon Attack: +8 to hit, range 15/30 ft., one creature. Hit: The target must make a DC 15 Constitution saving throw, taking 45 (10d8) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:8,damage_dice:"10d8"}],spells:["The naga is an 11th-level spellcaster. Its spellcasting ability is Wisdom (spell save DC 16, +8 to hit with spell attacks), and it needs only verbal components to cast its spells. It has the following cleric spells prepared:",{"Cantrips (at will)":"mending, sacred flame, thaumaturgy"},{"1st level (4 slots)":"command, cure wounds, shield of faith"},{"2nd level (3 slots)":"calm emotions, hold person"},{"3rd level (3 slots)":"bestow curse, clairvoyance"},{"4th level (3 slots)":"banishment, freedom of movement"},{"5th level (2 slots)":"flame strike, geas"},{"6th level (1 slot)":"true seeing"}]},{name:"Gynosphinx",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"lawful neutral",ac:17,hp:136,hit_dice:"16d10 + 48",speed:"40 ft., fly 60 ft.",stats:[18,15,16,18,18,18],skillsaves:[{arcana:12},{history:12},{perception:8},{religion:8}],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"psychic",condition_immunities:"charmed, frightened",senses:"truesight 120 ft., passive Perception 18",languages:"Common, Sphinx",cr:"11",bestiary:!0,traits:[{name:"Inscrutable",desc:"The sphinx is immune to any effect that would sense its emotions or read its thoughts, as well as any divination spell that it refuses. Wisdom (Insight) checks made to ascertain the sphinx's intentions or sincerity have disadvantage.",attack_bonus:0},{name:"Magic Weapons",desc:"The sphinx's weapon attacks are magical.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The sphinx makes two claw attacks.",attack_bonus:0},{name:"Claw",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) slashing damage.",attack_bonus:9,damage_dice:"2d8",damage_bonus:4}],legendary_actions:[{name:"Claw Attack",desc:"The sphinx makes one claw attack.",attack_bonus:0},{name:"Teleport (Costs 2 Actions)",desc:"The sphinx magically teleports, along with any equipment it is wearing or carrying, up to 120 feet to an unoccupied space it can see.",attack_bonus:0},{name:"Cast a Spell (Costs 3 Actions)",desc:"The sphinx casts a spell from its list of prepared spells, using a spell slot as normal.",attack_bonus:0}],spells:["The sphinx is a 9th-level spellcaster. Its spellcasting ability is Intelligence (spell save DC 16, +8 to hit with spell attacks). It requires no material components to cast its spells. The sphinx has the following wizard spells prepared:",{"Cantrips (at will)":"mage hand, minor illusion, prestidigitation"},{"1st level (4 slots)":"detect magic, identify, shield"},{"2nd level (3 slots)":"darkness, locate object, suggestion"},{"3rd level (3 slots)":"dispel magic, remove curse, tongues"},{"4th level (3 slots)":"banishment, greater invisibility"},{"5th level (1 slot)":"legend lore"}]},{name:"Half-Red Dragon Veteran",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"human",alignment:"any alignment",ac:18,hp:65,hit_dice:"10d8 + 20",speed:"30 ft.",stats:[16,13,14,10,11,10],damage_vulnerabilities:"",damage_resistances:"fire",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 12",languages:"Common, Draconic",cr:"5",bestiary:!0,actions:[{name:"Multiattack",desc:"The veteran makes two longsword attacks. If it has a shortsword drawn, it can also make a shortsword attack.",attack_bonus:0},{name:"Longsword",desc:"Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) slashing damage, or 8 (1d10 + 3) slashing damage if used with two hands.",attack_bonus:5,damage_dice:"1d8",damage_bonus:3},{name:"Shortsword",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Heavy Crossbow",desc:"Ranged Weapon Attack: +3 to hit, range 100/400 ft., one target. Hit: 6 (1d10 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d10",damage_bonus:1},{name:"Fire Breath (Recharge 5-6)",desc:"The veteran exhales fire in a 15-foot cone. Each creature in that area must make a DC 15 Dexterity saving throw, taking 24 (7d6) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"7d6"}]},{name:"Harpy",source:"5e SRD",size:"Medium",type:"monstrosity",subtype:"",alignment:"chaotic evil",ac:11,hp:38,hit_dice:"7d8 + 6",speed:"20 ft., fly 40 ft.",stats:[12,13,12,7,10,13],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"Common",cr:"1",bestiary:!0,actions:[{name:"Multiattack",desc:"The harpy makes two attacks: one with its claws and one with its club.",attack_bonus:0},{name:"Claws",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 6 (2d4 + 1) slashing damage.",attack_bonus:3,damage_dice:"2d4",damage_bonus:1},{name:"Club",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 3 (1d4 + 1) bludgeoning damage.",attack_bonus:3,damage_dice:"1d4",damage_bonus:1},{name:"Luring Song",desc:`The harpy sings a magical melody. Every humanoid and giant within 300 ft. of the harpy that can hear the song must succeed on a DC 11 Wisdom saving throw or be charmed until the song ends. The harpy must take a bonus action on its subsequent turns to continue singing. It can stop singing at any time. The song ends if the harpy is incapacitated.
While charmed by the harpy, a target is incapacitated and ignores the songs of other harpies. If the charmed target is more than 5 ft. away from the harpy, the must move on its turn toward the harpy by the most direct route. It doesn't avoid opportunity attacks, but before moving into damaging terrain, such as lava or a pit, and whenever it takes damage from a source other than the harpy, a target can repeat the saving throw. A creature can also repeat the saving throw at the end of each of its turns. If a creature's saving throw is successful, the effect ends on it.
A target that successfully saves is immune to this harpy's song for the next 24 hours.`,attack_bonus:0}]},{name:"Hawk",source:"5e SRD",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:1,hit_dice:"1d4 + -2",speed:"10 ft., fly 60 ft.",stats:[5,16,8,2,14,6],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"",cr:"0",bestiary:!0,traits:[{name:"Keen Sight",desc:"The hawk has advantage on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Talons",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 1 slashing damage.",attack_bonus:5,damage_bonus:1}]},{name:"Hell Hound",source:"5e SRD",size:"Medium",type:"fiend",subtype:"",alignment:"lawful evil",ac:15,hp:45,hit_dice:"7d8 + 13",speed:"50 ft.",stats:[17,12,14,6,13,6],skillsaves:[{perception:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 15",languages:"understands Infernal but can't speak it",cr:"3",bestiary:!0,traits:[{name:"Keen Hearing and Smell",desc:"The hound has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0},{name:"Pack Tactics",desc:"The hound has advantage on an attack roll against a creature if at least one of the hound's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) piercing damage plus 7 (2d6) fire damage.",attack_bonus:5,damage_dice:"1d8",damage_bonus:3},{name:"Fire Breath (Recharge 5-6)",desc:"The hound exhales fire in a 15-foot cone. Each creature in that area must make a DC 12 Dexterity saving throw, taking 21 (6d6) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"6d6"}]},{name:"Hezrou",source:"5e SRD",size:"Large",type:"fiend",subtype:"demon",alignment:"chaotic evil",ac:16,hp:136,hit_dice:"13d10 + 64",speed:"30 ft.",stats:[19,17,20,5,12,13],saves:[{strength:7},{constitution:8},{wisdom:4}],damage_vulnerabilities:"",damage_resistances:"cold, fire, lightning; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"poisoned",senses:"darkvision 120 ft., passive Perception 11",languages:"Abyssal, telepathy 120 ft.",cr:"8",bestiary:!0,traits:[{name:"Magic Resistance",desc:"The hezrou has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Stench",desc:"Any creature that starts its turn within 10 feet of the hezrou must succeed on a DC 14 Constitution saving throw or be poisoned until the start of its next turn. On a successful saving throw, the creature is immune to the hezrou's stench for 24 hours.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The hezrou makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 15 (2d10 + 4) piercing damage.",attack_bonus:7,damage_dice:"2d10",damage_bonus:4},{name:"Claws",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Variant: Summon Demon (1/Day)",desc:`The demon chooses what to summon and attempts a magical summoning.
A hezrou has a 30 percent chance of summoning 2d6 dretches or one hezrou.
A summoned demon appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other demons. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.`,attack_bonus:0}]},{name:"Hill Giant",source:"5e SRD",size:"Huge",type:"giant",subtype:"",alignment:"chaotic evil",ac:13,hp:105,hit_dice:"10d12 + 40",speed:"40 ft.",stats:[21,8,19,5,9,6],skillsaves:[{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 12",languages:"Giant",cr:"5",bestiary:!0,actions:[{name:"Multiattack",desc:"The giant makes two greatclub attacks.",attack_bonus:0},{name:"Greatclub",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 18 (3d8 + 5) bludgeoning damage.",attack_bonus:8,damage_dice:"3d8",damage_bonus:5},{name:"Rock",desc:"Ranged Weapon Attack: +8 to hit, range 60/240 ft., one target. Hit: 21 (3d10 + 5) bludgeoning damage.",attack_bonus:8,damage_dice:"3d10",damage_bonus:5}]},{name:"Hippogriff",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"unaligned",ac:11,hp:19,hit_dice:"3d10 + 2",speed:"40 ft, fly 60 ft.",stats:[17,13,13,2,12,8],skillsaves:[{perception:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 15",languages:"",cr:"1",bestiary:!0,traits:[{name:"Keen Sight",desc:"The hippogriff has advantage on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The hippogriff makes two attacks: one with its beak and one with its claws.",attack_bonus:0},{name:"Beak",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (1d10 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d10",damage_bonus:3},{name:"Claws",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3}]},{name:"Hobgoblin",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"goblinoid",alignment:"lawful evil",ac:18,hp:11,hit_dice:"2d8 + 2",speed:"30 ft.",stats:[13,12,12,10,10,9],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"Common, Goblin",cr:"1/2",bestiary:!0,traits:[{name:"Martial Advantage",desc:"Once per turn, the hobgoblin can deal an extra 7 (2d6) damage to a creature it hits with a weapon attack if that creature is within 5 ft. of an ally of the hobgoblin that isn't incapacitated.",attack_bonus:0,damage_dice:"2d6"}],actions:[{name:"Longsword",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 5 (1d8 + 1) slashing damage, or 6 (1d10 + 1) slashing damage if used with two hands.",attack_bonus:3,damage_dice:"1d8",damage_bonus:1},{name:"Longbow",desc:"Ranged Weapon Attack: +3 to hit, range 150/600 ft., one target. Hit: 5 (1d8 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d8",damage_bonus:1}]},{name:"Homunculus",source:"5e SRD",size:"Tiny",type:"construct",subtype:"",alignment:"neutral",ac:13,hp:5,hit_dice:"2d4",speed:"20 ft., fly 40 ft.",stats:[4,15,11,10,10,7],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"charmed, poisoned",senses:"darkvision 60 ft., passive Perception 10",languages:"understands the languages of its creator but can't speak",cr:"0",bestiary:!0,traits:[{name:"Telepathic Bond",desc:"While the homunculus is on the same plane of existence as its master, it can magically convey what it senses to its master, and the two can communicate telepathically.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 1 piercing damage, and the target must succeed on a DC 10 Constitution saving throw or be poisoned for 1 minute. If the saving throw fails by 5 or more, the target is instead poisoned for 5 (1d10) minutes and unconscious while poisoned in this way.",attack_bonus:4,damage_bonus:1}]},{name:"Horned Devil",source:"5e SRD",size:"Large",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:18,hp:148,hit_dice:"17d10 + 54",speed:"20 ft., fly 60 ft.",stats:[22,17,21,12,16,17],saves:[{strength:10},{dexterity:7},{wisdom:7},{charisma:7}],damage_vulnerabilities:"",damage_resistances:"cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"darkvision 120 ft., passive Perception 13",languages:"Infernal, telepathy 120 ft.",cr:"11",bestiary:!0,traits:[{name:"Devil's Sight",desc:"Magical darkness doesn't impede the devil's darkvision.",attack_bonus:0},{name:"Magic Resistance",desc:"The devil has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The devil makes three melee attacks: two with its fork and one with its tail. It can use Hurl Flame in place of any melee attack.",attack_bonus:0},{name:"Fork",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 15 (2d8 + 6) piercing damage.",attack_bonus:10,damage_dice:"2d8",damage_bonus:6},{name:"Tail",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 10 (1d8 + 6) piercing damage. If the target is a creature other than an undead or a construct, it must succeed on a DC 17 Constitution saving throw or lose 10 (3d6) hit points at the start of each of its turns due to an infernal wound. Each time the devil hits the wounded target with this attack, the damage dealt by the wound increases by 10 (3d6). Any creature can take an action to stanch the wound with a successful DC 12 Wisdom (Medicine) check. The wound also closes if the target receives magical healing.",attack_bonus:10,damage_dice:"1d8",damage_bonus:6},{name:"Hurl Flame",desc:"Ranged Spell Attack: +7 to hit, range 150 ft., one target. Hit: 14 (4d6) fire damage. If the target is a flammable object that isn't being worn or carried, it also catches fire.",attack_bonus:7,damage_dice:"4d6"}]},{name:"Hunter Shark",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:45,hit_dice:"6d10 + 12",speed:"swim 40 ft.",stats:[18,13,15,1,10,4],skillsaves:[{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 12",languages:"",cr:"2",bestiary:!0,traits:[{name:"Blood Frenzy",desc:"The shark has advantage on melee attack rolls against any creature that doesn't have all its hit points.",attack_bonus:0},{name:"Water Breathing",desc:"The shark can breathe only underwater.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) piercing damage.",attack_bonus:6,damage_dice:"2d8",damage_bonus:4}]},{name:"Hydra",source:"5e SRD",size:"Huge",type:"monstrosity",subtype:"",alignment:"unaligned",ac:15,hp:172,hit_dice:"15d12 + 74",speed:"30 ft., swim 30 ft.",stats:[20,12,20,2,10,7],skillsaves:[{perception:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 16",languages:"",cr:"8",bestiary:!0,traits:[{name:"Hold Breath",desc:"The hydra can hold its breath for 1 hour.",attack_bonus:0},{name:"Multiple Heads",desc:`The hydra has five heads. While it has more than one head, the hydra has advantage on saving throws against being blinded, charmed, deafened, frightened, stunned, and knocked unconscious.
Whenever the hydra takes 25 or more damage in a single turn, one of its heads dies. If all its heads die, the hydra dies.
At the end of its turn, it grows two heads for each of its heads that died since its last turn, unless it has taken fire damage since its last turn. The hydra regains 10 hit points for each head regrown in this way.`,attack_bonus:0},{name:"Reactive Heads",desc:"For each head the hydra has beyond one, it gets an extra reaction that can be used only for opportunity attacks.",attack_bonus:0},{name:"Wakeful",desc:"While the hydra sleeps, at least one of its heads is awake.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The hydra makes as many bite attacks as it has heads.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 10 (1d10 + 5) piercing damage.",attack_bonus:8,damage_dice:"1d10",damage_bonus:5}]},{name:"Hyena",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:5,hit_dice:"1d8",speed:"50 ft.",stats:[11,13,12,2,12,5],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"0",bestiary:!0,traits:[{name:"Pack Tactics",desc:"The hyena has advantage on an attack roll against a creature if at least one of the hyena's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Bite",desc:"Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 3 (1d6) piercing damage.",attack_bonus:2,damage_dice:"1d6"}]},{name:"Ice Devil",source:"5e SRD",size:"Large",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:18,hp:180,hit_dice:"19d10 + 75",speed:"40 ft.",stats:[21,14,18,18,15,18],saves:[{dexterity:7},{constitution:9},{wisdom:7},{charisma:9}],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 12",languages:"Infernal, telepathy 120 ft.",cr:"14",bestiary:!0,traits:[{name:"Devil's Sight",desc:"Magical darkness doesn't impede the devil's darkvision.",attack_bonus:0},{name:"Magic Resistance",desc:"The devil has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The devil makes three attacks: one with its bite, one with its claws, and one with its tail.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) piercing damage plus 10 (3d6) cold damage.",attack_bonus:10,damage_dice:"2d6 + 3d6",damage_bonus:5},{name:"Claws",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 10 (2d4 + 5) slashing damage plus 10 (3d6) cold damage.",attack_bonus:10,damage_dice:"2d4 + 3d6",damage_bonus:5},{name:"Tail",desc:"Melee Weapon Attack:+10 to hit, reach 10 ft., one target. Hit: 12 (2d6 + 5) bludgeoning damage plus 10 (3d6) cold damage.",attack_bonus:10,damage_dice:"2d6 + 3d6",damage_bonus:5},{name:"Wall of Ice",desc:`The devil magically forms an opaque wall of ice on a solid surface it can see within 60 feet of it. The wall is 1 foot thick and up to 30 feet long and 10 feet high, or it's a hemispherical dome up to 20 feet in diameter.
When the wall appears, each creature in its space is pushed out of it by the shortest route. The creature chooses which side of the wall to end up on, unless the creature is incapacitated. The creature then makes a DC 17 Dexterity saving throw, taking 35 (10d6) cold damage on a failed save, or half as much damage on a successful one.
The wall lasts for 1 minute or until the devil is incapacitated or dies. The wall can be damaged and breached; each 10-foot section has AC 5, 30 hit points, vulnerability to fire damage, and immunity to acid, cold, necrotic, poison, and psychic damage. If a section is destroyed, it leaves behind a sheet of frigid air in the space the wall occupied. Whenever a creature finishes moving through the frigid air on a turn, willingly or otherwise, the creature must make a DC 17 Constitution saving throw, taking 17 (5d6) cold damage on a failed save, or half as much damage on a successful one. The frigid air dissipates when the rest of the wall vanishes.`,attack_bonus:0}]},{name:"Ice Mephit",source:"5e SRD",size:"Small",type:"elemental",subtype:"",alignment:"neutral evil",ac:11,hp:21,hit_dice:"6d6",speed:"30 ft., fly 30 ft.",stats:[7,13,10,9,11,12],skillsaves:[{perception:2},{stealth:3}],damage_vulnerabilities:"bludgeoning, fire",damage_resistances:"",damage_immunities:"cold, poison",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 12",languages:"Aquan, Auran",cr:"1/2",bestiary:!0,traits:[{name:"Death Burst",desc:"When the mephit dies, it explodes in a burst of jagged ice. Each creature within 5 ft. of it must make a DC 10 Dexterity saving throw, taking 4 (1d8) slashing damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"1d8"},{name:"False Appearance",desc:"While the mephit remains motionless, it is indistinguishable from an ordinary shard of ice.",attack_bonus:0},{name:"Innate Spellcasting (1/Day)",desc:"The mephit can innately cast fog cloud, requiring no material components. Its innate spellcasting ability is Charisma.",attack_bonus:0}],actions:[{name:"Claws",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one creature. Hit: 3 (1d4 + 1) slashing damage plus 2 (1d4) cold damage.",attack_bonus:3,damage_dice:"1d4",damage_bonus:1},{name:"Frost Breath (Recharge 6)",desc:"The mephit exhales a 15-foot cone of cold air. Each creature in that area must succeed on a DC 10 Dexterity saving throw, taking 5 (2d4) cold damage on a failed save, or half as much damage on a successful one.",attack_bonus:0},{name:"Variant: Summon Mephits (1/Day)",desc:"The mephit has a 25 percent chance of summoning 1d4 mephits of its kind. A summoned mephit appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other mephits. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",attack_bonus:0}]},{name:"Imp",source:"5e SRD",size:"Tiny",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:13,hp:10,hit_dice:"3d4 + 2",speed:"20 ft., fly 40 ft.",stats:[6,17,13,11,12,14],skillsaves:[{deception:4},{insight:3},{persuasion:4},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"cold; bludgeoning, piercing, and slashing from nonmagical/nonsilver weapons",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"darkvision 120 ft., passive Perception 11",languages:"Infernal, Common",cr:"1",bestiary:!0,traits:[{name:"Shapechanger",desc:"The imp can use its action to polymorph into a beast form that resembles a rat (speed 20 ft.), a raven (20 ft., fly 60 ft.), or a spider (20 ft., climb 20 ft.), or back into its true form. Its statistics are the same in each form, except for the speed changes noted. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",attack_bonus:0},{name:"Devil's Sight",desc:"Magical darkness doesn't impede the imp's darkvision.",attack_bonus:0},{name:"Magic Resistance",desc:"The imp has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Variant: Familiar",desc:"The imp can serve another creature as a familiar, forming a telepathic bond with its willing master. While the two are bonded, the master can sense what the quasit senses as long as they are within 1 mile of each other. While the imp is within 10 feet of its master, the master shares the quasit's Magic Resistance trait. At any time and for any reason, the imp can end its service as a familiar, ending the telepathic bond.",attack_bonus:0}],actions:[{name:"Sting (Bite in Beast Form)",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft ., one target. Hit: 5 (1d4 + 3) piercing damage, and the target must make on a DC 11 Constitution saving throw, taking 10 (3d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:5,damage_dice:"1d4",damage_bonus:3},{name:"Invisibility",desc:"The imp magically turns invisible until it attacks, or until its concentration ends (as if concentrating on a spell). Any equipment the imp wears or carries is invisible with it.",attack_bonus:0}]},{name:"Invisible Stalker",source:"5e SRD",size:"Medium",type:"elemental",subtype:"",alignment:"neutral",ac:14,hp:104,hit_dice:"16d8 + 32",speed:"50 ft., fly 50 ft. (hover)",stats:[16,19,14,10,15,11],skillsaves:[{perception:8},{stealth:10}],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"exhaustion, grappled, paralyzed, petrified, poisoned, prone, restrained, unconscious",senses:"darkvision 60 ft., passive Perception 18",languages:"Auran, understands Common but doesn't speak it",cr:"6",bestiary:!0,traits:[{name:"Invisibility",desc:"The stalker is invisible.",attack_bonus:0},{name:"Faultless Tracker",desc:"The stalker is given a quarry by its summoner. The stalker knows the direction and distance to its quarry as long as the two of them are on the same plane of existence. The stalker also knows the location of its summoner.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The stalker makes two slam attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) bludgeoning damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:3}]},{name:"Iron Golem",source:"5e SRD",size:"Large",type:"construct",subtype:"",alignment:"unaligned",ac:20,hp:210,hit_dice:"20d10 + 100",speed:"30 ft.",stats:[24,9,20,3,11,1],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire, poison, psychic; bludgeoning, piercing, and slashing from nonmagical weapons that aren't adamantine",condition_immunities:"charmed, exhaustion, frightened, paralyzed, petrified, poisoned",senses:"darkvision 120 ft., passive Perception 10",languages:"understands the languages of its creator but can't speak",cr:"16",bestiary:!0,traits:[{name:"Fire Absorption",desc:"Whenever the golem is subjected to fire damage, it takes no damage and instead regains a number of hit points equal to the fire damage dealt.",attack_bonus:0},{name:"Immutable Form",desc:"The golem is immune to any spell or effect that would alter its form.",attack_bonus:0},{name:"Magic Resistance",desc:"The golem has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Magic Weapons",desc:"The golem's weapon attacks are magical.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The golem makes two melee attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +13 to hit, reach 5 ft., one target. Hit: 20 (3d8 + 7) bludgeoning damage.",attack_bonus:13,damage_dice:"3d8",damage_bonus:7},{name:"Sword",desc:"Melee Weapon Attack: +13 to hit, reach 10 ft., one target. Hit: 23 (3d10 + 7) slashing damage.",attack_bonus:13,damage_dice:"3d10",damage_bonus:7},{name:"Poison Breath (Recharge 5-6)",desc:"The golem exhales poisonous gas in a 15-foot cone. Each creature in that area must make a DC 19 Constitution saving throw, taking 45 (l0d8) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"10d8"}]},{name:"Jackal",source:"5e SRD",size:"Small",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:3,hit_dice:"1d6 + -1",speed:"40 ft.",stats:[8,15,11,3,12,6],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"0",bestiary:!0,traits:[{name:"Keen Hearing and Smell",desc:"The jackal has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0},{name:"Pack Tactics",desc:"The jackal has advantage on an attack roll against a creature if at least one of the jackal's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +1 to hit, reach 5 ft., one target. Hit: 1 (1d4 \u2014 1) piercing damage.",attack_bonus:1,damage_dice:"1d4",damage_bonus:-1}]},{name:"Killer Whale",source:"5e SRD",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:90,hit_dice:"12d12 + 12",speed:"swim 60 ft.",stats:[19,10,13,3,12,7],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 120 ft., passive Perception 13",languages:"",cr:"3",bestiary:!0,traits:[{name:"Echolocation",desc:"The whale can't use its blindsight while deafened.",attack_bonus:0},{name:"Hold Breath",desc:"The whale can hold its breath for 30 minutes",attack_bonus:0},{name:"Keen Hearing",desc:"The whale has advantage on Wisdom (Perception) checks that rely on hearing.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 21 (5d6 + 4) piercing damage.",attack_bonus:0}]},{name:"Knight",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:18,hp:52,hit_dice:"8d8 + 16",speed:"30 ft.",stats:[16,11,14,11,11,15],saves:[{constitution:4},{wisdom:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"any one language (usually Common)",cr:"3",bestiary:!0,traits:[{name:"Brave",desc:"The knight has advantage on saving throws against being frightened.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The knight makes two melee attacks.",attack_bonus:0},{name:"Greatsword",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3},{name:"Heavy Crossbow",desc:"Ranged Weapon Attack: +2 to hit, range 100/400 ft., one target. Hit: 5 (1d10) piercing damage.",attack_bonus:2,damage_dice:"1d10"},{name:"Leadership (Recharges after a Short or Long Rest)",desc:"For 1 minute, the knight can utter a special command or warning whenever a nonhostile creature that it can see within 30 ft. of it makes an attack roll or a saving throw. The creature can add a d4 to its roll provided it can hear and understand the knight. A creature can benefit from only one Leadership die at a time. This effect ends if the knight is incapacitated.",attack_bonus:0}],reactions:[{name:"Parry",desc:"The knight adds 2 to its AC against one melee attack that would hit it. To do so, the knight must see the attacker and be wielding a melee weapon.",attack_bonus:0}]},{name:"Kobold",source:"5e SRD",size:"Small",type:"humanoid",subtype:"kobold",alignment:"lawful evil",ac:12,hp:5,hit_dice:"2d6 + -2",speed:"30 ft.",stats:[7,15,9,8,7,8],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 8",languages:"Common, Draconic",cr:"1/8",bestiary:!0,traits:[{name:"Sunlight Sensitivity",desc:"While in sunlight, the kobold has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",attack_bonus:0},{name:"Pack Tactics",desc:"The kobold has advantage on an attack roll against a creature if at least one of the kobold's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Dagger",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2},{name:"Sling",desc:"Ranged Weapon Attack: +4 to hit, range 30/120 ft., one target. Hit: 4 (1d4 + 2) bludgeoning damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Kraken",source:"5e SRD",size:"Gargantuan",type:"monstrosity",subtype:"titan",alignment:"chaotic evil",ac:18,hp:472,hit_dice:"27d20 + 188",speed:"20 ft., swim 60 ft.",stats:[30,11,25,22,18,20],saves:[{strength:17},{dexterity:7},{constitution:14},{intelligence:13},{wisdom:11}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning; bludgeoning, piercing, and slashing from nonmagical weapons",condition_immunities:"frightened, paralyzed",senses:"truesight 120 ft., passive Perception 14",languages:"understands Abyssal, Celestial, Infernal, and Primordial but can't speak, telepathy 120 ft.",cr:"23",bestiary:!0,traits:[{name:"Amphibious",desc:"The kraken can breathe air and water.",attack_bonus:0},{name:"Freedom of Movement",desc:"The kraken ignores difficult terrain, and magical effects can't reduce its speed or cause it to be restrained. It can spend 5 feet of movement to escape from nonmagical restraints or being grappled.",attack_bonus:0},{name:"Siege Monster",desc:"The kraken deals double damage to objects and structures.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The kraken makes three tentacle attacks, each of which it can replace with one use of Fling.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 23 (3d8 + 10) piercing damage. If the target is a Large or smaller creature grappled by the kraken, that creature is swallowed, and the grapple ends. While swallowed, the creature is blinded and restrained, it has total cover against attacks and other effects outside the kraken, and it takes 42 (12d6) acid damage at the start of each of the kraken's turns. If the kraken takes 50 damage or more on a single turn from a creature inside it, the kraken must succeed on a DC 25 Constitution saving throw at the end of that turn or regurgitate all swallowed creatures, which fall prone in a space within 10 feet of the kraken. If the kraken dies, a swallowed creature is no longer restrained by it and can escape from the corpse using 15 feet of movement, exiting prone.",attack_bonus:7,damage_dice:"3d8",damage_bonus:10},{name:"Tentacle",desc:"Melee Weapon Attack: +7 to hit, reach 30 ft., one target. Hit: 20 (3d6 + 10) bludgeoning damage, and the target is grappled (escape DC 18). Until this grapple ends, the target is restrained. The kraken has ten tentacles, each of which can grapple one target.",attack_bonus:7,damage_dice:"3d6",damage_bonus:10},{name:"Fling",desc:"One Large or smaller object held or creature grappled by the kraken is thrown up to 60 feet in a random direction and knocked prone. If a thrown target strikes a solid surface, the target takes 3 (1d6) bludgeoning damage for every 10 feet it was thrown. If the target is thrown at another creature, that creature must succeed on a DC 18 Dexterity saving throw or take the same damage and be knocked prone.",attack_bonus:0},{name:"Lightning Storm",desc:"The kraken magically creates three bolts of lightning, each of which can strike a target the kraken can see within 120 feet of it. A target must make a DC 23 Dexterity saving throw, taking 22 (4d10) lightning damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"4d10"}],legendary_actions:[{name:"Tentacle Attack or Fling",desc:"The kraken makes one tentacle attack or uses its Fling.",attack_bonus:0},{name:"Lightning Storm (Costs 2 Actions)",desc:"The kraken uses Lightning Storm.",attack_bonus:0},{name:"Ink Cloud (Costs 3 Actions)",desc:"While underwater, the kraken expels an ink cloud in a 60-foot radius. The cloud spreads around corners, and that area is heavily obscured to creatures other than the kraken. Each creature other than the kraken that ends its turn there must succeed on a DC 23 Constitution saving throw, taking 16 (3d10) poison damage on a failed save, or half as much damage on a successful one. A strong current disperses the cloud, which otherwise disappears at the end of the kraken's next turn.",attack_bonus:0}]},{name:"Lamia",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"chaotic evil",ac:13,hp:97,hit_dice:"13d10 + 25",speed:"30 ft.",stats:[16,13,15,14,15,16],skillsaves:[{deception:7},{insight:4},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 12",languages:"Abyssal, Common",cr:"4",bestiary:!0,traits:[{name:"Innate Spellcasting",desc:"The lamia's innate spellcasting ability is Charisma (spell save DC 13). It can innately cast the following spells, requiring no material components. At will: disguise self (any humanoid form), major image 3/day each: charm person, mirror image, scrying, suggestion 1/day: geas",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The lamia makes two attacks: one with its claws and one with its dagger or Intoxicating Touch.",attack_bonus:0},{name:"Claws",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 14 (2d10 + 3) slashing damage.",attack_bonus:5,damage_dice:"2d10",damage_bonus:3},{name:"Dagger",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 5 (1d4 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d4",damage_bonus:3},{name:"Intoxicating Touch",desc:"Melee Spell Attack: +5 to hit, reach 5 ft., one creature. Hit: The target is magically cursed for 1 hour. Until the curse ends, the target has disadvantage on Wisdom saving throws and all ability checks.",attack_bonus:0}]},{name:"Lemure",source:"5e SRD",size:"Medium",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:7,hp:13,hit_dice:"3d8 + -1",speed:"15 ft.",stats:[10,5,11,1,11,3],damage_vulnerabilities:"",damage_resistances:"cold",damage_immunities:"fire, poison",condition_immunities:"charmed, frightened, poisoned",senses:"darkvision 120 ft., passive Perception 10",languages:"understands infernal but can't speak",cr:"0",bestiary:!0,traits:[{name:"Devil's Sight",desc:"Magical darkness doesn't impede the lemure's darkvision.",attack_bonus:0},{name:"Hellish Rejuvenation",desc:"A lemure that dies in the Nine Hells comes back to life with all its hit points in 1d10 days unless it is killed by a good-aligned creature with a bless spell cast on that creature or its remains are sprinkled with holy water.",attack_bonus:0}],actions:[{name:"Fist",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 2 (1d4) bludgeoning damage",attack_bonus:3,damage_dice:"1d4"}]},{name:"Lich",source:"5e SRD",size:"Medium",type:"undead",subtype:"",alignment:"any evil alignment",ac:17,hp:135,hit_dice:"18d8 + 54",speed:"30 ft.",stats:[11,16,16,20,14,16],saves:[{constitution:10},{intelligence:12},{wisdom:9}],skillsaves:[{arcana:18},{history:12},{insight:9},{perception:9}],damage_vulnerabilities:"",damage_resistances:"cold, lightning, necrotic",damage_immunities:"poison; bludgeoning, piercing, and slashing from nonmagical weapons",condition_immunities:"charmed, exhaustion, frightened, paralyzed, poisoned",senses:"truesight 120 ft., passive Perception 19",languages:"Common plus up to five other languages",cr:"21",bestiary:!0,traits:[{name:"Legendary Resistance (3/Day)",desc:"If the lich fails a saving throw, it can choose to succeed instead.",attack_bonus:0},{name:"Rejuvenation",desc:"If it has a phylactery, a destroyed lich gains a new body in 1d10 days, regaining all its hit points and becoming active again. The new body appears within 5 feet of the phylactery.",attack_bonus:0},{name:"Turn Resistance",desc:"The lich has advantage on saving throws against any effect that turns undead.",attack_bonus:0}],actions:[{name:"Paralyzing Touch",desc:"Melee Spell Attack: +12 to hit, reach 5 ft., one creature. Hit: 10 (3d6) cold damage. The target must succeed on a DC 18 Constitution saving throw or be paralyzed for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:12,damage_dice:"3d6"}],legendary_actions:[{name:"Cantrip",desc:"The lich casts a cantrip.",attack_bonus:0},{name:"Paralyzing Touch (Costs 2 Actions)",desc:"The lich uses its Paralyzing Touch.",attack_bonus:0},{name:"Frightening Gaze (Costs 2 Actions)",desc:"The lich fixes its gaze on one creature it can see within 10 feet of it. The target must succeed on a DC 18 Wisdom saving throw against this magic or become frightened for 1 minute. The frightened target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a target's saving throw is successful or the effect ends for it, the target is immune to the lich's gaze for the next 24 hours.",attack_bonus:0},{name:"Disrupt Life (Costs 3 Actions)",desc:"Each living creature within 20 feet of the lich must make a DC 18 Constitution saving throw against this magic, taking 21 (6d6) necrotic damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"6d6"}],spells:["The lich is an 18th-level spellcaster. Its spellcasting ability is Intelligence (spell save DC 20, +12 to hit with spell attacks). The lich has the following wizard spells prepared:",{"Cantrips (at will)":"mage hand, prestidigitation, ray of frost"},{"1st level (4 slots)":"detect magic, magic missile, shield, thunderwave"},{"2nd level (3 slots)":"detect thoughts, invisibility, Melf's acid arrow, mirror image"},{"3rd level (3 slots)":"animate dead, counterspell, dispel magic, fireball"},{"4th level (3 slots)":"blight, dimension door"},{"5th level (3 slots)":"cloudkill, scrying"},{"6th level (1 slot)":"disintegrate, globe of invulnerability"},{"7th level (1 slot)":"finger of death, plane shift"},{"8th level (1 slot)":"dominate monster, power word stun"},{"9th level (1 slot)":"power word kill"}]},{name:"Lion",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:26,hit_dice:"4d10 + 4",speed:"50 ft.",stats:[17,15,13,3,12,8],skillsaves:[{perception:3},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"1",bestiary:!0,traits:[{name:"Keen Smell",desc:"The lion has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0},{name:"Pack Tactics",desc:"The lion has advantage on an attack roll against a creature if at least one of the lion's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0},{name:"Pounce",desc:"If the lion moves at least 20 ft. straight toward a creature and then hits it with a claw attack on the same turn, that target must succeed on a DC 13 Strength saving throw or be knocked prone. If the target is prone, the lion can make one bite attack against it as a bonus action.",attack_bonus:0},{name:"Running Leap",desc:"With a 10-foot running start, the lion can long jump up to 25 ft..",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d8",damage_bonus:3},{name:"Claw",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3}]},{name:"Lizard",source:"5e SRD",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:2,hit_dice:"1d4 + -1",speed:"20 ft., climb 20 ft.",stats:[2,11,10,1,8,3],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 9",languages:"",cr:"0",bestiary:!0,actions:[{name:"Bite",desc:"Melee Weapon Attack: +0 to hit, reach 5 ft., one target. Hit: 1 piercing damage.",attack_bonus:0,damage_bonus:1}]},{name:"Lizardfolk",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"lizardfolk",alignment:"neutral",ac:15,hp:22,hit_dice:"4d8 + 4",speed:"30 ft., swim 30 ft.",stats:[15,10,13,7,12,7],skillsaves:[{perception:3},{stealth:4},{survival:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"Draconic",cr:"1/2",bestiary:!0,traits:[{name:"Hold Breath",desc:"The lizardfolk can hold its breath for 15 minutes.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The lizardfolk makes two melee attacks, each one with a different weapon.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Heavy Club",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) bludgeoning damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Javelin",desc:"Melee or Ranged Weapon Attack: +4 to hit, reach 5 ft. or range 30/120 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Spiked Shield",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Mage",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:12,hp:40,hit_dice:"9d8 + -1",speed:"30 ft.",stats:[9,14,11,17,12,11],saves:[{intelligence:6},{wisdom:4}],skillsaves:[{arcana:6},{history:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 11",languages:"any four languages",cr:"6",bestiary:!0,traits:[],actions:[{name:"Dagger",desc:"Melee or Ranged Weapon Attack: +5 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 4 (1d4 + 2) piercing damage.",attack_bonus:5,damage_dice:"1d4",damage_bonus:2}],spells:["The mage is a 9th-level spellcaster. Its spellcasting ability is Intelligence (spell save DC 14, +6 to hit with spell attacks). The mage has the following wizard spells prepared:",{"Cantrips (at will)":"fire bolt, light, mage hand, prestidigitation"},{"1st level (4 slots)":"detect magic, mage armor, magic missile, shield"},{"2nd level (3 slots)":"misty step, suggestion"},{"3rd level (3 slots)":"counterspell, fireball, fly"},{"4th level (3 slots)":"greater invisibility, ice storm"},{"5th level (1 slot)":"cone of cold"}]},{name:"Magma Mephit",source:"5e SRD",size:"Small",type:"elemental",subtype:"",alignment:"neutral evil",ac:11,hp:22,hit_dice:"5d6 + 4",speed:"30 ft., fly 30 ft.",stats:[8,12,12,7,10,10],skillsaves:[{stealth:3}],damage_vulnerabilities:"cold",damage_resistances:"",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 10",languages:"Ignan, Terran",cr:"1/2",bestiary:!0,traits:[{name:"Death Burst",desc:"When the mephit dies, it explodes in a burst of lava. Each creature within 5 ft. of it must make a DC 11 Dexterity saving throw, taking 7 (2d6) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"2d6"},{name:"False Appearance",desc:"While the mephit remains motionless, it is indistinguishable from an ordinary mound of magma.",attack_bonus:0},{name:"Innate Spellcasting (1/Day)",desc:"The mephit can innately cast heat metal (spell save DC 10), requiring no material components. Its innate spellcasting ability is Charisma.",attack_bonus:0}],actions:[{name:"Claws",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft ., one creature. Hit: 3 (1d4 + 1) slashing damage plus 2 (1d4) fire damage.",attack_bonus:3,damage_dice:"1d4",damage_bonus:1},{name:"Fire Breath (Recharge 6)",desc:"The mephit exhales a 15-foot cone of fire. Each creature in that area must make a DC 11 Dexterity saving throw, taking 7 (2d6) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0},{name:"Variant: Summon Mephits (1/Day)",desc:"The mephit has a 25 percent chance of summoning 1d4 mephits of its kind. A summoned mephit appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other mephits. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",attack_bonus:0}]},{name:"Magmin",source:"5e SRD",size:"Small",type:"elemental",subtype:"",alignment:"chaotic neutral",ac:14,hp:9,hit_dice:"2d6 + 2",speed:"30 ft.",stats:[7,15,12,8,11,10],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"fire",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"Ignan",cr:"1/2",bestiary:!0,traits:[{name:"Death Burst",desc:"When the magmin dies, it explodes in a burst of fire and magma. Each creature within 10 ft. of it must make a DC 11 Dexterity saving throw, taking 7 (2d6) fire damage on a failed save, or half as much damage on a successful one. Flammable objects that aren't being worn or carried in that area are ignited.",attack_bonus:0,damage_dice:"2d6"},{name:"Ignited Illumination",desc:"As a bonus action, the magmin can set itself ablaze or extinguish its flames. While ablaze, the magmin sheds bright light in a 10-foot radius and dim light for an additional 10 ft.",attack_bonus:0}],actions:[{name:"Touch",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d6) fire damage. If the target is a creature or a flammable object, it ignites. Until a target takes an action to douse the fire, the target takes 3 (1d6) fire damage at the end of each of its turns.",attack_bonus:4,damage_dice:"2d6"}]},{name:"Mammoth",source:"5e SRD",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:126,hit_dice:"11d12 + 54",speed:"40 ft.",stats:[24,9,21,3,11,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"6",bestiary:!0,traits:[{name:"Trampling Charge",desc:"If the mammoth moves at least 20 ft. straight toward a creature and then hits it with a gore attack on the same turn, that target must succeed on a DC 18 Strength saving throw or be knocked prone. If the target is prone, the mammoth can make one stomp attack against it as a bonus action.",attack_bonus:0}],actions:[{name:"Gore",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 25 (4d8 + 7) piercing damage.",attack_bonus:10,damage_dice:"4d8",damage_bonus:7},{name:"Stomp",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one prone creature. Hit: 29 (4d10 + 7) bludgeoning damage.",attack_bonus:10,damage_dice:"4d10",damage_bonus:7}]},{name:"Manticore",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"lawful evil",ac:14,hp:68,hit_dice:"8d10 + 24",speed:"30 ft., fly 50 ft.",stats:[17,16,17,7,12,8],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 11",languages:"",cr:"3",bestiary:!0,traits:[{name:"Tail Spike Regrowth",desc:"The manticore has twenty-four tail spikes. Used spikes regrow when the manticore finishes a long rest.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The manticore makes three attacks: one with its bite and two with its claws or three with its tail spikes.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d8",damage_bonus:3},{name:"Claw",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Tail Spike",desc:"Ranged Weapon Attack: +5 to hit, range 100/200 ft., one target. Hit: 7 (1d8 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d8",damage_bonus:3}]},{name:"Marilith",source:"5e SRD",size:"Large",type:"fiend",subtype:"demon",alignment:"chaotic evil",ac:18,hp:189,hit_dice:"18d10 + 90",speed:"40 ft.",stats:[18,20,20,18,16,20],saves:[{strength:9},{constitution:10},{wisdom:8},{charisma:10}],damage_vulnerabilities:"",damage_resistances:"cold, fire, lightning; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"poisoned",senses:"truesight 120 ft., passive Perception 13",languages:"Abyssal, telepathy 120 ft.",cr:"16",bestiary:!0,traits:[{name:"Magic Resistance",desc:"The marilith has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Magic Weapons",desc:"The marilith's weapon attacks are magical.",attack_bonus:0},{name:"Reactive",desc:"The marilith can take one reaction on every turn in combat.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The marilith can make seven attacks: six with its longswords and one with its tail.",attack_bonus:0},{name:"Longsword",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) slashing damage.",attack_bonus:9,damage_dice:"2d8",damage_bonus:4},{name:"Tail",desc:"Melee Weapon Attack: +9 to hit, reach 10 ft., one creature. Hit: 15 (2d10 + 4) bludgeoning damage. If the target is Medium or smaller, it is grappled (escape DC 19). Until this grapple ends, the target is restrained, the marilith can automatically hit the target with its tail, and the marilith can't make tail attacks against other targets.",attack_bonus:9,damage_dice:"2d10",damage_bonus:4},{name:"Teleport",desc:"The marilith magically teleports, along with any equipment it is wearing or carrying, up to 120 feet to an unoccupied space it can see.",attack_bonus:0},{name:"Variant: Summon Demon (1/Day)",desc:`The demon chooses what to summon and attempts a magical summoning.
A marilith has a 50 percent chance of summoning 1d6 vrocks, 1d4 hezrous, 1d3 glabrezus, 1d2 nalfeshnees, or one marilith.
A summoned demon appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other demons. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.`,attack_bonus:0}],reactions:[{name:"Parry",desc:"The marilith adds 5 to its AC against one melee attack that would hit it. To do so, the marilith must see the attacker and be wielding a melee weapon.",attack_bonus:0}]},{name:"Mastiff",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:5,hit_dice:"1d8",speed:"40 ft.",stats:[13,14,12,3,12,7],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"1/8",bestiary:!0,traits:[{name:"Keen Hearing and Smell",desc:"The mastiff has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) piercing damage. If the target is a creature, it must succeed on a DC 11 Strength saving throw or be knocked prone.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Medusa",source:"5e SRD",size:"Medium",type:"monstrosity",subtype:"",alignment:"lawful evil",ac:15,hp:127,hit_dice:"17d8 + 50",speed:"30 ft.",stats:[10,15,16,12,13,15],skillsaves:[{deception:5},{insight:4},{perception:4},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"Common",cr:"6",bestiary:!0,traits:[{name:"Petrifying Gaze",desc:`When a creature that can see the medusa's eyes starts its turn within 30 ft. of the medusa, the medusa can force it to make a DC 14 Constitution saving throw if the medusa isn't incapacitated and can see the creature. If the saving throw fails by 5 or more, the creature is instantly petrified. Otherwise, a creature that fails the save begins to turn to stone and is restrained. The restrained creature must repeat the saving throw at the end of its next turn, becoming petrified on a failure or ending the effect on a success. The petrification lasts until the creature is freed by the greater restoration spell or other magic.
Unless surprised, a creature can avert its eyes to avoid the saving throw at the start of its turn. If the creature does so, it can't see the medusa until the start of its next turn, when it can avert its eyes again. If the creature looks at the medusa in the meantime, it must immediately make the save.
If the medusa sees itself reflected on a polished surface within 30 ft. of it and in an area of bright light, the medusa is, due to its curse, affected by its own gaze.`,attack_bonus:0}],actions:[{name:"Multiattack",desc:"The medusa makes either three melee attacks \u2014 one with its snake hair and two with its shortsword \u2014 or two ranged attacks with its longbow.",attack_bonus:0},{name:"Snake Hair",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one creature. Hit: 4 (1d4 + 2) piercing damage plus 14 (4d6) poison damage.",attack_bonus:5,damage_dice:"1d4",damage_bonus:2},{name:"Shortsword",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:2},{name:"Longbow",desc:"Ranged Weapon Attack: +5 to hit, range 150/600 ft., one target. Hit: 6 (1d8 + 2) piercing damage plus 7 (2d6) poison damage.",attack_bonus:5,damage_dice:"2d6"}]},{name:"Merfolk",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"merfolk",alignment:"neutral",ac:11,hp:11,hit_dice:"2d8 + 2",speed:"10 ft., swim 40 ft.",stats:[10,13,12,11,11,12],skillsaves:[{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 12",languages:"Aquan, Common",cr:"1/8",bestiary:!0,traits:[{name:"Amphibious",desc:"The merfolk can breathe air and water.",attack_bonus:0}],actions:[{name:"Spear",desc:"Melee or Ranged Weapon Attack: +2 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 3 (1d6) piercing damage, or 4 (1d8) piercing damage if used with two hands to make a melee attack.",attack_bonus:2,damage_dice:"1d6"}]},{name:"Merrow",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"chaotic evil",ac:13,hp:45,hit_dice:"6d10 + 12",speed:"10 ft., swim 40 ft.",stats:[18,10,15,8,10,9],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"Abyssal, Aquan",cr:"2",bestiary:!0,traits:[{name:"Amphibious",desc:"The merrow can breathe air and water.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The merrow makes two attacks: one with its bite and one with its claws or harpoon.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 8 (1d8 + 4) piercing damage.",attack_bonus:6,damage_dice:"1d8",damage_bonus:4},{name:"Claws",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 9 (2d4 + 4) slashing damage.",attack_bonus:6,damage_dice:"2d4",damage_bonus:4},{name:"Harpoon",desc:"Melee or Ranged Weapon Attack: +6 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 11 (2d6 + 4) piercing damage. If the target is a Huge or smaller creature, it must succeed on a Strength contest against the merrow or be pulled up to 20 feet toward the merrow.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4}]},{name:"Mimic",source:"5e SRD",size:"Medium",type:"monstrosity",subtype:"shapechanger",alignment:"neutral",ac:12,hp:58,hit_dice:"9d8 + 17",speed:"15 ft.",stats:[17,12,15,5,13,8],skillsaves:[{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid",condition_immunities:"prone",senses:"darkvision 60 ft., passive Perception 11",languages:"",cr:"2",bestiary:!0,traits:[{name:"Shapechanger",desc:"The mimic can use its action to polymorph into an object or back into its true, amorphous form. Its statistics are the same in each form. Any equipment it is wearing or carrying isn 't transformed. It reverts to its true form if it dies.",attack_bonus:0},{name:"Adhesive (Object Form Only)",desc:"The mimic adheres to anything that touches it. A Huge or smaller creature adhered to the mimic is also grappled by it (escape DC 13). Ability checks made to escape this grapple have disadvantage.",attack_bonus:0},{name:"False Appearance (Object Form Only)",desc:"While the mimic remains motionless, it is indistinguishable from an ordinary object.",attack_bonus:0},{name:"Grappler",desc:"The mimic has advantage on attack rolls against any creature grappled by it.",attack_bonus:0}],actions:[{name:"Pseudopod",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) bludgeoning damage. If the mimic is in object form, the target is subjected to its Adhesive trait.",attack_bonus:5,damage_dice:"1d8",damage_bonus:3},{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) piercing damage plus 4 (1d8) acid damage.",attack_bonus:5,damage_dice:"1d8 + 1d8",damage_bonus:3}]},{name:"Minotaur",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"chaotic evil",ac:14,hp:76,hit_dice:"9d10 + 26",speed:"40 ft.",stats:[18,11,16,6,16,9],skillsaves:[{perception:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 17",languages:"Abyssal",cr:"3",bestiary:!0,traits:[{name:"Charge",desc:"If the minotaur moves at least 10 ft. straight toward a target and then hits it with a gore attack on the same turn, the target takes an extra 9 (2d8) piercing damage. If the target is a creature, it must succeed on a DC 14 Strength saving throw or be pushed up to 10 ft. away and knocked prone.",attack_bonus:0,damage_dice:"2d8"},{name:"Labyrinthine Recall",desc:"The minotaur can perfectly recall any path it has traveled.",attack_bonus:0},{name:"Reckless",desc:"At the start of its turn, the minotaur can gain advantage on all melee weapon attack rolls it makes during that turn, but attack rolls against it have advantage until the start of its next turn.",attack_bonus:0}],actions:[{name:"Greataxe",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 17 (2d12 + 4) slashing damage.",attack_bonus:6,damage_dice:"2d12",damage_bonus:4},{name:"Gore",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) piercing damage.",attack_bonus:6,damage_dice:"2d8",damage_bonus:4}]},{name:"Minotaur Skeleton",source:"5e SRD",size:"Large",type:"undead",subtype:"",alignment:"lawful evil",ac:12,hp:67,hit_dice:"9d10 + 17",speed:"40 ft.",stats:[18,11,15,6,8,5],damage_vulnerabilities:"bludgeoning",damage_resistances:"",damage_immunities:"poison",condition_immunities:"exhaustion, poisoned",senses:"darkvision 60 ft., passive Perception 9",languages:"understands Abyssal but can't speak",cr:"2",bestiary:!0,traits:[{name:"Charge",desc:"If the skeleton moves at least 10 feet straight toward a target and then hits it with a gore attack on the same turn, the target takes an extra 9 (2d8) piercing damage. If the target is a creature, it must succeed on a DC 14 Strength saving throw or be pushed up to 10 feet away and knocked prone.",attack_bonus:0,damage_dice:"2d8"}],actions:[{name:"Greataxe",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 17 (2d12 + 4) slashing damage.",attack_bonus:6,damage_dice:"2d12",damage_bonus:4},{name:"Gore",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) piercing damage.",attack_bonus:6,damage_dice:"2d8",damage_bonus:4}]},{name:"Mule",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:11,hit_dice:"2d8 + 2",speed:"40 ft.",stats:[14,10,13,2,10,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"1/8",bestiary:!0,traits:[{name:"Beast of Burden",desc:"The mule is considered to be a Large animal for the purpose of determining its carrying capacity.",attack_bonus:0},{name:"Sure-Footed",desc:"The mule has advantage on Strength and Dexterity saving throws made against effects that would knock it prone.",attack_bonus:0}],actions:[{name:"Hooves",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) bludgeoning damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Mummy",source:"5e SRD",size:"Medium",type:"undead",subtype:"",alignment:"lawful evil",ac:11,hp:58,hit_dice:"9d8 + 17",speed:"20 ft.",stats:[16,8,15,6,10,12],saves:[{wisdom:2}],damage_vulnerabilities:"fire",damage_resistances:"",damage_immunities:"bludgeoning, piercing, and slashing from nonmagical weapons",condition_immunities:"necrotic, poisoned",senses:"darkvision 60 ft., passive Perception 10",languages:"the languages it knew in life",cr:"3",bestiary:!0,actions:[{name:"Multiattack",desc:"The mummy can use its Dreadful Glare and makes one attack with its rotting fist.",attack_bonus:0},{name:"Rotting Fist",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) bludgeoning damage plus 10 (3d6) necrotic damage. If the target is a creature, it must succeed on a DC 12 Constitution saving throw or be cursed with mummy rot. The cursed target can't regain hit points, and its hit point maximum decreases by 10 (3d6) for every 24 hours that elapse. If the curse reduces the target's hit point maximum to 0, the target dies, and its body turns to dust. The curse lasts until removed by the remove curse spell or other magic.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3},{name:"Dreadful Glare",desc:"The mummy targets one creature it can see within 60 ft. of it. If the target can see the mummy, it must succeed on a DC 11 Wisdom saving throw against this magic or become frightened until the end of the mummy's next turn. If the target fails the saving throw by 5 or more, it is also paralyzed for the same duration. A target that succeeds on the saving throw is immune to the Dreadful Glare of all mummies (but not mummy lords) for the next 24 hours.",attack_bonus:0}]},{name:"Mummy Lord",source:"5e SRD",size:"Medium",type:"undead",subtype:"",alignment:"lawful evil",ac:17,hp:97,hit_dice:"13d8 + 38",speed:"20 ft.",stats:[18,10,17,11,18,16],saves:[{constitution:8},{intelligence:5},{wisdom:9},{charisma:8}],skillsaves:[{history:5},{religion:5}],damage_vulnerabilities:"bludgeoning",damage_resistances:"",damage_immunities:"necrotic, poison; bludgeoning, piercing, and slashing from nonmagical weapons",condition_immunities:"charmed, exhaustion, frightened, paralyzed, poisoned",senses:"darkvision 60 ft., passive Perception 14",languages:"the languages it knew in life",cr:"15",bestiary:!0,traits:[{name:"Magic Resistance",desc:"The mummy lord has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Rejuvenation",desc:"A destroyed mummy lord gains a new body in 24 hours if its heart is intact, regaining all its hit points and becoming active again. The new body appears within 5 feet of the mummy lord's heart.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The mummy can use its Dreadful Glare and makes one attack with its rotting fist.",attack_bonus:0},{name:"Rotting Fist",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 14 (3d6 + 4) bludgeoning damage plus 21 (6d6) necrotic damage. If the target is a creature, it must succeed on a DC 16 Constitution saving throw or be cursed with mummy rot. The cursed target can't regain hit points, and its hit point maximum decreases by 10 (3d6) for every 24 hours that elapse. If the curse reduces the target's hit point maximum to 0, the target dies, and its body turns to dust. The curse lasts until removed by the remove curse spell or other magic.",attack_bonus:9,damage_dice:"3d6 + 6d6",damage_bonus:4},{name:"Dreadful Glare",desc:"The mummy lord targets one creature it can see within 60 feet of it. If the target can see the mummy lord, it must succeed on a DC 16 Wisdom saving throw against this magic or become frightened until the end of the mummy's next turn. If the target fails the saving throw by 5 or more, it is also paralyzed for the same duration. A target that succeeds on the saving throw is immune to the Dreadful Glare of all mummies and mummy lords for the next 24 hours.",attack_bonus:0}],legendary_actions:[{name:"Attack",desc:"The mummy lord makes one attack with its rotting fist or uses its Dreadful Glare.",attack_bonus:0},{name:"Blinding Dust",desc:"Blinding dust and sand swirls magically around the mummy lord. Each creature within 5 feet of the mummy lord must succeed on a DC 16 Constitution saving throw or be blinded until the end of the creature's next turn.",attack_bonus:0},{name:"Blasphemous Word (Costs 2 Actions)",desc:"The mummy lord utters a blasphemous word. Each non-undead creature within 10 feet of the mummy lord that can hear the magical utterance must succeed on a DC 16 Constitution saving throw or be stunned until the end of the mummy lord's next turn.",attack_bonus:0},{name:"Channel Negative Energy (Costs 2 Actions)",desc:"The mummy lord magically unleashes negative energy. Creatures within 60 feet of the mummy lord, including ones behind barriers and around corners, can't regain hit points until the end of the mummy lord's next turn.",attack_bonus:0},{name:"Whirlwind of Sand (Costs 2 Actions)",desc:"The mummy lord magically transforms into a whirlwind of sand, moves up to 60 feet, and reverts to its normal form. While in whirlwind form, the mummy lord is immune to all damage, and it can't be grappled, petrified, knocked prone, restrained, or stunned. Equipment worn or carried by the mummy lord remain in its possession.",attack_bonus:0}],spells:["The mummy lord is a 10th-level spellcaster. Its spellcasting ability is Wisdom (spell save DC 17, +9 to hit with spell attacks). The mummy lord has the following cleric spells prepared:",{"Cantrips (at will)":"sacred flame, thaumaturgy"},{"1st level (4 slots)":"command, guiding bolt, shield of faith"},{"2nd level (3 slots)":"hold person, silence, spiritual weapon"},{"3rd level (3 slots)":"animate dead, dispel magic"},{"4th level (3 slots)":"divination, guardian of faith"},{"5th level (2 slots)":"contagion, insect plague"},{"6th level (1 slot)":"harm"}]},{name:"Nalfeshnee",source:"5e SRD",size:"Large",type:"fiend",subtype:"demon",alignment:"chaotic evil",ac:18,hp:184,hit_dice:"16d10 + 96",speed:"20 ft., fly 30 ft.",stats:[21,10,22,19,12,15],saves:[{constitution:11},{intelligence:9},{wisdom:6},{charisma:7}],damage_vulnerabilities:"",damage_resistances:"cold, fire, lightning; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"poisoned",senses:"truesight 120 ft., passive Perception 11",languages:"Abyssal, telepathy 120 ft.",cr:"13",bestiary:!0,traits:[{name:"Magic Resistance",desc:"The nalfeshnee has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The nalfeshnee uses Horror Nimbus if it can. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 32 (5d10 + 5) piercing damage.",attack_bonus:10,damage_dice:"5d10",damage_bonus:5},{name:"Claw",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 15 (3d6 + 5) slashing damage.",attack_bonus:10,damage_dice:"3d6",damage_bonus:5},{name:"Horror Nimbus (Recharge 5-6)",desc:"The nalfeshnee magically emits scintillating, multicolored light. Each creature within 15 feet of the nalfeshnee that can see the light must succeed on a DC 15 Wisdom saving throw or be frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the nalfeshnee's Horror Nimbus for the next 24 hours.",attack_bonus:0},{name:"Teleport",desc:"The nalfeshnee magically teleports, along with any equipment it is wearing or carrying, up to 120 feet to an unoccupied space it can see.",attack_bonus:0},{name:"Variant: Summon Demon (1/Day)",desc:`The demon chooses what to summon and attempts a magical summoning.
A nalfeshnee has a 50 percent chance of summoning 1d4 vrocks, 1d3 hezrous, 1d2 glabrezus, or one nalfeshnee.
A summoned demon appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other demons. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.`,attack_bonus:0}]},{name:"Night Hag",source:"5e SRD",size:"Medium",type:"fiend",subtype:"",alignment:"neutral evil",ac:17,hp:112,hit_dice:"15d8 + 44",speed:"30 ft.",stats:[18,15,16,16,14,16],skillsaves:[{deception:7},{insight:6},{perception:6},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"cold, fire; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"",condition_immunities:"charmed",senses:"darkvision 120 ft., passive Perception 16",languages:"Abyssal, Common, Infernal, Primordial",cr:"5",bestiary:!0,traits:[{name:"Innate Spellcasting",desc:`The hag's innate spellcasting ability is Charisma (spell save DC 14, +6 to hit with spell attacks). She can innately cast the following spells, requiring no material components:
At will: detect magic, magic missile
2/day each: plane shift (self only), ray of enfeeblement, sleep`,attack_bonus:0},{name:"Magic Resistance",desc:"The hag has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Night Hag Items",desc:`A night hag carries two very rare magic items that she must craft for herself If either object is lost, the night hag will go to great lengths to retrieve it, as creating a new tool takes time and effort.
Heartstone: This lustrous black gem allows a night hag to become ethereal while it is in her possession. The touch of a heartstone also cures any disease. Crafting a heartstone takes 30 days.
Soul Bag: When an evil humanoid dies as a result of a night hag's Nightmare Haunting, the hag catches the soul in this black sack made of stitched flesh. A soul bag can hold only one evil soul at a time, and only the night hag who crafted the bag can catch a soul with it. Crafting a soul bag takes 7 days and a humanoid sacrifice (whose flesh is used to make the bag).`,attack_bonus:0},{name:"Hag Coven",desc:`When hags must work together, they form covens, in spite of their selfish natures. A coven is made up of hags of any type, all of whom are equals within the group. However, each of the hags continues to desire more personal power.
A coven consists of three hags so that any arguments between two hags can be settled by the third. If more than three hags ever come together, as might happen if two covens come into conflict, the result is usually chaos.`,attack_bonus:0},{name:"Shared Spellcasting (Coven Only)",desc:`While all three members of a hag coven are within 30 feet of one another, they can each cast the following spells from the wizard's spell list but must share the spell slots among themselves:
\u2022 1st level (4 slots): identify, ray of sickness
\u2022 2nd level (3 slots): hold person, locate object
\u2022 3rd level (3 slots): bestow curse, counterspell, lightning bolt
\u2022 4th level (3 slots): phantasmal killer, polymorph
\u2022 5th level (2 slots): contact other plane, scrying
\u2022 6th level (1 slot): eye bite
For casting these spells, each hag is a 12th-level spellcaster that uses Intelligence as her spellcasting ability. The spell save DC is 12+the hag's Intelligence modifier, and the spell attack bonus is 4+the hag's Intelligence modifier.`,attack_bonus:0},{name:"Hag Eye (Coven Only)",desc:`A hag coven can craft a magic item called a hag eye, which is made from a real eye coated in varnish and often fitted to a pendant or other wearable item. The hag eye is usually entrusted to a minion for safekeeping and transport. A hag in the coven can take an action to see what the hag eye sees if the hag eye is on the same plane of existence. A hag eye has AC 10, 1 hit point, and darkvision with a radius of 60 feet. If it is destroyed, each coven member takes 3d10 psychic damage and is blinded for 24 hours.
A hag coven can have only one hag eye at a time, and creating a new one requires all three members of the coven to perform a ritual. The ritual takes 1 hour, and the hags can't perform it while blinded. During the ritual, if the hags take any action other than performing the ritual, they must start over.`,attack_bonus:0}],actions:[{name:"Claws (Hag Form Only)",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:4},{name:"Change Shape",desc:"The hag magically polymorphs into a Small or Medium female humanoid, or back into her true form. Her statistics are the same in each form. Any equipment she is wearing or carrying isn't transformed. She reverts to her true form if she dies.",attack_bonus:0},{name:"Etherealness",desc:"The hag magically enters the Ethereal Plane from the Material Plane, or vice versa. To do so, the hag must have a heartstone in her possession.",attack_bonus:0},{name:"Nightmare Haunting (1/Day)",desc:"While on the Ethereal Plane, the hag magically touches a sleeping humanoid on the Material Plane. A protection from evil and good spell cast on the target prevents this contact, as does a magic circle. As long as the contact persists, the target has dreadful visions. If these visions last for at least 1 hour, the target gains no benefit from its rest, and its hit point maximum is reduced by 5 (1d10). If this effect reduces the target's hit point maximum to 0, the target dies, and if the target was evil, its soul is trapped in the hag's soul bag. The reduction to the target's hit point maximum lasts until removed by the greater restoration spell or similar magic.",attack_bonus:0}]},{name:"Nightmare",source:"5e SRD",size:"Large",type:"fiend",subtype:"",alignment:"neutral evil",ac:13,hp:68,hit_dice:"8d10 + 24",speed:"60 ft., fly 90 ft.",stats:[18,15,16,10,13,15],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"passive Perception 11",languages:"understands Abyssal, Common, and Infernal but can't speak",cr:"3",bestiary:!0,traits:[{name:"Confer Fire Resistance",desc:"The nightmare can grant resistance to fire damage to anyone riding it.",attack_bonus:0},{name:"Illumination",desc:"The nightmare sheds bright light in a 10-foot radius and dim light for an additional 10 feet.",attack_bonus:0}],actions:[{name:"Hooves",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) bludgeoning damage plus 7 (2d6) fire damage.",attack_bonus:6,damage_dice:"2d8 + 2d6",damage_bonus:4},{name:"Ethereal Stride",desc:"The nightmare and up to three willing creatures within 5 feet of it magically enter the Ethereal Plane from the Material Plane, or vice versa.",attack_bonus:0}]},{name:"Noble",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:15,hp:9,hit_dice:"2d8",speed:"30 ft.",stats:[11,12,11,12,14,16],skillsaves:[{deception:5},{insight:4},{persuasion:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 12",languages:"any two languages",cr:"1/8",bestiary:!0,actions:[{name:"Rapier",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 5 (1d8 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d8",damage_bonus:1}],reactions:[{name:"Parry",desc:"The noble adds 2 to its AC against one melee attack that would hit it. To do so, the noble must see the attacker and be wielding a melee weapon.",attack_bonus:0}]},{name:"Ochre Jelly",source:"5e SRD",size:"Large",type:"ooze",subtype:"",alignment:"unaligned",ac:8,hp:45,hit_dice:"6d10 + 12",speed:"10 ft., climb 10 ft.",stats:[15,6,14,2,6,1],damage_vulnerabilities:"",damage_resistances:"acid",damage_immunities:"lightning, slashing",condition_immunities:"blinded, charmed, deafened, exhaustion, frightened, prone",senses:"blindsight 60 ft. (blind beyond this radius), passive Perception 8",languages:"",cr:"2",bestiary:!0,traits:[{name:"Amorphous",desc:"The jelly can move through a space as narrow as 1 inch wide without squeezing.",attack_bonus:0},{name:"Spider Climb",desc:"The jelly can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0}],actions:[{name:"Pseudopod",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 9 (2d6 + 2) bludgeoning damage plus 3 (1d6) acid damage.",attack_bonus:4,damage_dice:"2d6",damage_bonus:2}],reactions:[{name:"Split",desc:"When a jelly that is Medium or larger is subjected to lightning or slashing damage, it splits into two new jellies if it has at least 10 hit points. Each new jelly has hit points equal to half the original jelly's, rounded down. New jellies are one size smaller than the original jelly.",attack_bonus:0}]},{name:"Octopus",source:"5e SRD",size:"Small",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:3,hit_dice:"1d6 + -1",speed:"5 ft., swim 30 ft.",stats:[4,15,11,3,10,4],skillsaves:[{perception:2},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 12",languages:"",cr:"0",bestiary:!0,traits:[{name:"Hold Breath",desc:"While out of water, the octopus can hold its breath for 30 minutes.",attack_bonus:0},{name:"Underwater Camouflage",desc:"The octopus has advantage on Dexterity (Stealth) checks made while underwater.",attack_bonus:0},{name:"Water Breathing",desc:"The octopus can breathe only underwater.",attack_bonus:0}],actions:[{name:"Tentacles",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 1 bludgeoning damage, and the target is grappled (escape DC 10). Until this grapple ends, the octopus can't use its tentacles on another target.",attack_bonus:4,damage_bonus:1},{name:"Ink Cloud (Recharges after a Short or Long Rest)",desc:"A 5-foot-radius cloud of ink extends all around the octopus if it is underwater. The area is heavily obscured for 1 minute, although a significant current can disperse the ink. After releasing the ink, the octopus can use the Dash action as a bonus action.",attack_bonus:0}]},{name:"Ogre",source:"5e SRD",size:"Large",type:"giant",subtype:"",alignment:"chaotic evil",ac:11,hp:59,hit_dice:"7d10 + 20",speed:"40 ft.",stats:[19,8,16,5,7,7],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 8",languages:"Common, Giant",cr:"2",bestiary:!0,actions:[{name:"Greatclub",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"2d8",damage_bonus:4},{name:"Javelin",desc:"Melee or Ranged Weapon Attack: +6 to hit, reach 5 ft. or range 30/120 ft., one target. Hit: 11 (2d6 + 4) piercing damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4}]},{name:"Ogre Zombie",source:"5e SRD",size:"Large",type:"undead",subtype:"",alignment:"neutral evil",ac:8,hp:85,hit_dice:"9d10 + 35",speed:"30 ft.",stats:[19,6,18,3,6,5],saves:[{wisdom:0}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 8",languages:"understands Common and Giant but can't speak",cr:"2",bestiary:!0,traits:[{name:"Undead Fortitude",desc:"If damage reduces the zombie to 0 hit points, it must make a Constitution saving throw with a DC of 5+the damage taken, unless the damage is radiant or from a critical hit. On a success, the zombie drops to 1 hit point instead.",attack_bonus:0}],actions:[{name:"Morningstar",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"2d8",damage_bonus:4}]},{name:"Oni",source:"5e SRD",size:"Large",type:"giant",subtype:"",alignment:"lawful evil",ac:16,hp:110,hit_dice:"13d10 + 38",speed:"30 ft., fly 30 ft.",stats:[19,11,16,14,12,15],saves:[{dexterity:3},{constitution:6},{wisdom:4},{charisma:5}],skillsaves:[{arcana:5},{deception:8},{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"Common, Giant",cr:"7",bestiary:!0,traits:[{name:"Innate Spellcasting",desc:`The oni's innate spellcasting ability is Charisma (spell save DC 13). The oni can innately cast the following spells, requiring no material components:
At will: darkness, invisibility
1/day each: charm person, cone of cold, gaseous form, sleep`,attack_bonus:0},{name:"Magic Weapons",desc:"The oni's weapon attacks are magical.",attack_bonus:0},{name:"Regeneration",desc:"The oni regains 10 hit points at the start of its turn if it has at least 1 hit point.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The oni makes two attacks, either with its claws or its glaive.",attack_bonus:0},{name:"Claw (Oni Form Only)",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 8 (1d8 + 4) slashing damage.",attack_bonus:7,damage_dice:"1d8",damage_bonus:4},{name:"Glaive",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 15 (2d10 + 4) slashing damage, or 9 (1d10 + 4) slashing damage in Small or Medium form.",attack_bonus:7,damage_dice:"2d10",damage_bonus:4},{name:"Change Shape",desc:"The oni magically polymorphs into a Small or Medium humanoid, into a Large giant, or back into its true form. Other than its size, its statistics are the same in each form. The only equipment that is transformed is its glaive, which shrinks so that it can be wielded in humanoid form. If the oni dies, it reverts to its true form, and its glaive reverts to its normal size.",attack_bonus:0}]},{name:"Orc",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"orc",alignment:"chaotic evil",ac:13,hp:15,hit_dice:"2d8 + 6",speed:"30 ft.",stats:[16,12,16,7,11,10],skillsaves:[{intimidation:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"Common, Orc",cr:"1/2",bestiary:!0,traits:[{name:"Aggressive",desc:"As a bonus action, the orc can move up to its speed toward a hostile creature that it can see.",attack_bonus:0}],actions:[{name:"Greataxe",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 9 (1d12 + 3) slashing damage.",attack_bonus:5,damage_dice:"1d12",damage_bonus:3},{name:"Javelin",desc:"Melee or Ranged Weapon Attack: +5 to hit, reach 5 ft. or range 30/120 ft., one target. Hit: 6 (1d6 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3}]},{name:"Otyugh",source:"5e SRD",size:"Large",type:"aberration",subtype:"",alignment:"neutral",ac:14,hp:114,hit_dice:"12d10 + 48",speed:"30 ft.",stats:[16,11,19,6,13,6],saves:[{constitution:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 11",languages:"Otyugh",cr:"5",bestiary:!0,traits:[{name:"Limited Telepathy",desc:"The otyugh can magically transmit simple messages and images to any creature within 120 ft. of it that can understand a language. This form of telepathy doesn't allow the receiving creature to telepathically respond.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The otyugh makes three attacks: one with its bite and two with its tentacles.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 12 (2d8 + 3) piercing damage. If the target is a creature, it must succeed on a DC 15 Constitution saving throw against disease or become poisoned until the disease is cured. Every 24 hours that elapse, the target must repeat the saving throw, reducing its hit point maximum by 5 (1d10) on a failure. The disease is cured on a success. The target dies if the disease reduces its hit point maximum to 0. This reduction to the target's hit point maximum lasts until the disease is cured.",attack_bonus:6,damage_dice:"2d8",damage_bonus:3},{name:"Tentacle",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 7 (1d8 + 3) bludgeoning damage plus 4 (1d8) piercing damage. If the target is Medium or smaller, it is grappled (escape DC 13) and restrained until the grapple ends. The otyugh has two tentacles, each of which can grapple one target.",attack_bonus:6,damage_dice:"1d8",damage_bonus:3},{name:"Tentacle Slam",desc:"The otyugh slams creatures grappled by it into each other or a solid surface. Each creature must succeed on a DC 14 Constitution saving throw or take 10 (2d6 + 3) bludgeoning damage and be stunned until the end of the otyugh's next turn. On a successful save, the target takes half the bludgeoning damage and isn't stunned.",attack_bonus:0}]},{name:"Owl",source:"5e SRD",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:1,hit_dice:"1d4 + -2",speed:"5 ft., fly 60 ft.",stats:[3,13,8,2,12,7],skillsaves:[{perception:3},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 13",languages:"",cr:"0",bestiary:!0,traits:[{name:"Flyby",desc:"The owl doesn't provoke opportunity attacks when it flies out of an enemy's reach.",attack_bonus:0},{name:"Keen Hearing and Sight",desc:"The owl has advantage on Wisdom (Perception) checks that rely on hearing or sight.",attack_bonus:0}],actions:[{name:"Talons",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 1 slashing damage.",attack_bonus:3,damage_bonus:1}]},{name:"Owlbear",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"unaligned",ac:13,hp:59,hit_dice:"7d10 + 20",speed:"40 ft.",stats:[20,12,17,3,12,7],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 13",languages:"",cr:"3",bestiary:!0,traits:[{name:"Keen Sight and Smell",desc:"The owlbear has advantage on Wisdom (Perception) checks that rely on sight or smell.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The owlbear makes two attacks: one with its beak and one with its claws.",attack_bonus:0},{name:"Beak",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one creature. Hit: 10 (1d10 + 5) piercing damage.",attack_bonus:7,damage_dice:"1d10",damage_bonus:5},{name:"Claws",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 14 (2d8 + 5) slashing damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:5}]},{name:"Panther",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:13,hit_dice:"3d8 + -1",speed:"50 ft., climb 40 ft.",stats:[14,15,10,3,14,7],skillsaves:[{perception:4},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"",cr:"1/4",bestiary:!0,traits:[{name:"Keen Smell",desc:"The panther has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0},{name:"Pounce",desc:"If the panther moves at least 20 ft. straight toward a creature and then hits it with a claw attack on the same turn, that target must succeed on a DC 12 Strength saving throw or be knocked prone. If the target is prone, the panther can make one bite attack against it as a bonus action.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Claw",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) slashing damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Pegasus",source:"5e SRD",size:"Large",type:"celestial",subtype:"",alignment:"chaotic good",ac:12,hp:59,hit_dice:"7d10 + 20",speed:"60 ft., fly 90 ft.",stats:[18,15,16,10,15,13],saves:[{dexterity:4},{wisdom:4},{charisma:3}],skillsaves:[{perception:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 16",languages:"understands Celestial, Common, Elvish, and Sylvan but can't speak",cr:"2",bestiary:!0,actions:[{name:"Hooves",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4}]},{name:"Phase Spider",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"unaligned",ac:13,hp:32,hit_dice:"5d10 + 4",speed:"30 ft., climb 30 ft.",stats:[15,15,12,6,10,6],skillsaves:[{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"",cr:"3",bestiary:!0,traits:[{name:"Ethereal Jaunt",desc:"As a bonus action, the spider can magically shift from the Material Plane to the Ethereal Plane, or vice versa.",attack_bonus:0},{name:"Spider Climb",desc:"The spider can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0},{name:"Web Walker",desc:"The spider ignores movement restrictions caused by webbing.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 7 (1d10 + 2) piercing damage, and the target must make a DC 11 Constitution saving throw, taking 18 (4d8) poison damage on a failed save, or half as much damage on a successful one. If the poison damage reduces the target to 0 hit points, the target is stable but poisoned for 1 hour, even after regaining hit points, and is paralyzed while poisoned in this way.",attack_bonus:4,damage_dice:"1d10",damage_bonus:2}]},{name:"Pit Fiend",source:"5e SRD",size:"Large",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:19,hp:300,hit_dice:"24d10 + 168",speed:"30 ft., fly 60 ft.",stats:[26,14,24,22,18,24],saves:[{dexterity:8},{constitution:13},{wisdom:10}],damage_vulnerabilities:"",damage_resistances:"cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"truesight 120 ft., passive Perception 14",languages:"Infernal, telepathy 120 ft.",cr:"20",bestiary:!0,traits:[{name:"Fear Aura",desc:"Any creature hostile to the pit fiend that starts its turn within 20 feet of the pit fiend must make a DC 21 Wisdom saving throw, unless the pit fiend is incapacitated. On a failed save, the creature is frightened until the start of its next turn. If a creature's saving throw is successful, the creature is immune to the pit fiend's Fear Aura for the next 24 hours.",attack_bonus:0},{name:"Magic Resistance",desc:"The pit fiend has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Magic Weapons",desc:"The pit fiend's weapon attacks are magical.",attack_bonus:0},{name:"Innate Spellcasting",desc:`The pit fiend's spellcasting ability is Charisma (spell save DC 21). The pit fiend can innately cast the following spells, requiring no material components:
At will: detect magic, fireball
3/day each: hold monster, wall of fire`,attack_bonus:0}],actions:[{name:"Multiattack",desc:"The pit fiend makes four attacks: one with its bite, one with its claw, one with its mace, and one with its tail.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +14 to hit, reach 5 ft., one target. Hit: 22 (4d6 + 8) piercing damage. The target must succeed on a DC 21 Constitution saving throw or become poisoned. While poisoned in this way, the target can't regain hit points, and it takes 21 (6d6) poison damage at the start of each of its turns. The poisoned target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:14,damage_dice:"4d6",damage_bonus:8},{name:"Claw",desc:"Melee Weapon Attack: +14 to hit, reach 10 ft. , one target. Hit: 17 (2d8 + 8) slashing damage.",attack_bonus:14,damage_dice:"2d8",damage_bonus:8},{name:"Mace",desc:"Melee Weapon Attack: +14 to hit, reach 10ft., one target. Hit: 15 (2d6 + 8) bludgeoning damage plus 21 (6d6) fire damage.",attack_bonus:14,damage_dice:"2d6",damage_bonus:8},{name:"Tail",desc:"Melee Weapon Attack: +14 to hit, reach 10ft., one target. Hit: 24 (3d1O + 8) bludgeoning damage.",attack_bonus:14,damage_dice:"3d10",damage_bonus:8}]},{name:"Planetar",source:"5e SRD",size:"Large",type:"celestial",subtype:"",alignment:"lawful good",ac:19,hp:200,hit_dice:"16d10 + 112",speed:"40 ft., fly 120 ft.",stats:[24,20,24,19,22,25],saves:[{constitution:12},{wisdom:11},{charisma:12}],skillsaves:[{perception:11}],damage_vulnerabilities:"",damage_resistances:"radiant; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"",condition_immunities:"charmed, exhaustion, frightened",senses:"truesight 120 ft., passive Perception 21",languages:"all, telepathy 120 ft.",cr:"16",bestiary:!0,traits:[{name:"Angelic Weapons",desc:"The planetar's weapon attacks are magical. When the planetar hits with any weapon, the weapon deals an extra 5d8 radiant damage (included in the attack).",attack_bonus:0},{name:"Divine Awareness",desc:"The planetar knows if it hears a lie.",attack_bonus:0},{name:"Innate Spellcasting",desc:`The planetar's spellcasting ability is Charisma (spell save DC 20). The planetar can innately cast the following spells, requiring no material components:
At will: detect evil and good, invisibility (self only)
3/day each: blade barrier, dispel evil and good, flame strike, raise dead
1/day each: commune, control weather, insect plague`,attack_bonus:0},{name:"Magic Resistance",desc:"The planetar has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The planetar makes two melee attacks.",attack_bonus:0},{name:"Greatsword",desc:"Melee Weapon Attack: +12 to hit, reach 5 ft., one target. Hit: 21 (4d6 + 7) slashing damage plus 22 (5d8) radiant damage.",attack_bonus:12,damage_dice:"4d6 + 5d8",damage_bonus:7},{name:"Healing Touch (4/Day)",desc:"The planetar touches another creature. The target magically regains 30 (6d8 + 3) hit points and is freed from any curse, disease, poison, blindness, or deafness.",attack_bonus:0}]},{name:"Plesiosaurus",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:68,hit_dice:"8d10 + 24",speed:"20 ft., swim 40 ft.",stats:[18,15,16,2,12,5],skillsaves:[{perception:3},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"2",bestiary:!0,traits:[{name:"Hold Breath",desc:"The plesiosaurus can hold its breath for 1 hour.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 14 (3d6 + 4) piercing damage.",attack_bonus:6,damage_dice:"3d6",damage_bonus:4}]},{name:"Poisonous Snake",source:"5e SRD",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:2,hit_dice:"1d4 + -1",speed:"30 ft., swim 30 ft.",stats:[2,16,11,1,10,3],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., passive Perception 10",languages:"",cr:"1/8",bestiary:!0,actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 1 piercing damage, and the target must make a DC 10 Constitution saving throw, taking 5 (2d4) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:5,damage_bonus:1}]},{name:"Polar Bear",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:42,hit_dice:"5d10 + 14",speed:"40 ft., swim 30 ft.",stats:[20,10,16,2,13,7],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"2",bestiary:!0,traits:[{name:"Keen Smell",desc:"The bear has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The bear makes two attacks: one with its bite and one with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 9 (1d8 + 5) piercing damage.",attack_bonus:7,damage_dice:"1d8",damage_bonus:5},{name:"Claws",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:5}]},{name:"Pony",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:11,hit_dice:"2d8 + 2",speed:"40 ft.",stats:[15,10,13,2,11,7],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"1/8",bestiary:!0,actions:[{name:"Hooves",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) bludgeoning damage.",attack_bonus:4,damage_dice:"2d4",damage_bonus:2}]},{name:"Priest",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:13,hp:27,hit_dice:"5d8 + 4",speed:"25 ft.",stats:[10,10,12,13,16,13],skillsaves:[{medicine:7},{persuasion:3},{religion:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"any two languages",cr:"2",bestiary:!0,traits:[{name:"Divine Eminence",desc:"As a bonus action, the priest can expend a spell slot to cause its melee weapon attacks to magically deal an extra 10 (3d6) radiant damage to a target on a hit. This benefit lasts until the end of the turn. If the priest expends a spell slot of 2nd level or higher, the extra damage increases by 1d6 for each level above 1st.",attack_bonus:0,damage_dice:"3d6"}],actions:[{name:"Mace",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 3 (1d6) bludgeoning damage.",attack_bonus:2,damage_dice:"1d6"}],spells:["The priest is a 5th-level spellcaster. Its spellcasting ability is Wisdom (spell save DC 13, +5 to hit with spell attacks). The priest has the following cleric spells prepared:",{"Cantrips (at will)":"light, sacred flame, thaumaturgy"},{"1st level (4 slots)":"cure wounds, guiding bolt, sanctuary"},{"2nd level (3 slots)":"lesser restoration, spiritual weapon"},{"3rd level (2 slots)":"dispel magic, spirit guardians"}]},{name:"Pseudodragon",source:"5e SRD",size:"Tiny",type:"dragon",subtype:"",alignment:"neutral good",ac:13,hp:7,hit_dice:"2d4 + 2",speed:"15 ft., fly 60 ft.",stats:[6,15,13,10,12,10],skillsaves:[{perception:3},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 13",languages:"understands Common and Draconic but can't speak",cr:"1/4",bestiary:!0,traits:[{name:"Keen Senses",desc:"The pseudodragon has advantage on Wisdom (Perception) checks that rely on sight, hearing, or smell.",attack_bonus:0},{name:"Magic Resistance",desc:"The pseudodragon has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Limited Telepathy",desc:"The pseudodragon can magically communicate simple ideas, emotions, and images telepathically with any creature within 100 ft. of it that can understand a language.",attack_bonus:0},{name:"Variant: Familiar",desc:"The pseudodragon can serve another creature as a familiar, forming a magic, telepathic bond with that willing companion. While the two are bonded, the companion can sense what the pseudodragon senses as long as they are within 1 mile of each other. While the pseudodragon is within 10 feet of its companion, the companion shares the pseudodragon's Magic Resistance trait. At any time and for any reason, the pseudodragon can end its service as a familiar, ending the telepathic bond.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2},{name:"Sting",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 4 (1d4 + 2) piercing damage, and the target must succeed on a DC 11 Constitution saving throw or become poisoned for 1 hour. If the saving throw fails by 5 or more, the target falls unconscious for the same duration, or until it takes damage or another creature uses an action to shake it awake.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Purple Worm",source:"5e SRD",size:"Gargantuan",type:"monstrosity",subtype:"",alignment:"unaligned",ac:18,hp:247,hit_dice:"15d20 + 89",speed:"50 ft., burrow 30 ft.",stats:[28,7,22,1,8,4],saves:[{constitution:11},{wisdom:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 30 ft., tremorsense 60 ft., passive Perception 9",languages:"",cr:"15",bestiary:!0,traits:[{name:"Tunneler",desc:"The worm can burrow through solid rock at half its burrow speed and leaves a 10-foot-diameter tunnel in its wake.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The worm makes two attacks: one with its bite and one with its stinger.",attack_bonus:0},{name:"Bite",desc:`Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 22 (3d8 + 9) piercing damage. If the target is a Large or smaller creature, it must succeed on a DC 19 Dexterity saving throw or be swallowed by the worm. A swallowed creature is blinded and restrained, it has total cover against attacks and other effects outside the worm, and it takes 21 (6d6) acid damage at the start of each of the worm's turns.
If the worm takes 30 damage or more on a single turn from a creature inside it, the worm must succeed on a DC 21 Constitution saving throw at the end of that turn or regurgitate all swallowed creatures, which fall prone in a space within 10 feet of the worm. If the worm dies, a swallowed creature is no longer restrained by it and can escape from the corpse by using 20 feet of movement, exiting prone.`,attack_bonus:9,damage_dice:"3d8",damage_bonus:9},{name:"Tail Stinger",desc:"Melee Weapon Attack: +9 to hit, reach 10 ft., one creature. Hit: 19 (3d6 + 9) piercing damage, and the target must make a DC 19 Constitution saving throw, taking 42 (12d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:9,damage_dice:"3d6",damage_bonus:9}]},{name:"Quasit",source:"5e SRD",size:"Tiny",type:"fiend",subtype:"demon",alignment:"chaotic evil",ac:13,hp:7,hit_dice:"3d4 + -1",speed:"40 ft.",stats:[5,17,10,7,10,10],skillsaves:[{stealth:5}],damage_vulnerabilities:"",damage_resistances:"cold; fire; lightning; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"poisoned",senses:"darkvision 120 ft., passive Perception 10",languages:"Abyssal, Common",cr:"1",bestiary:!0,traits:[{name:"Shapechanger",desc:"The quasit can use its action to polymorph into a beast form that resembles a bat (speed 10 ft. fly 40 ft.), a centipede (40 ft., climb 40 ft.), or a toad (40 ft., swim 40 ft.), or back into its true form . Its statistics are the same in each form, except for the speed changes noted. Any equipment it is wearing or carrying isn't transformed . It reverts to its true form if it dies.",attack_bonus:0},{name:"Magic Resistance",desc:"The quasit has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Variant: Familiar",desc:"The quasit can serve another creature as a familiar, forming a telepathic bond with its willing master. While the two are bonded, the master can sense what the quasit senses as long as they are within 1 mile of each other. While the quasit is within 10 feet of its master, the master shares the quasit's Magic Resistance trait. At any time and for any reason, the quasit can end its service as a familiar, ending the telepathic bond.",attack_bonus:0}],actions:[{name:"Claw (Bite in Beast Form)",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft ., one target. Hit: 5 (1d4 + 3) piercing damage, and the target must succeed on a DC 10 Constitution saving throw or take 5 (2d4) poison damage and become poisoned for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:4,damage_dice:"1d4",damage_bonus:3},{name:"Scare (1/day)",desc:"One creature of the quasit's choice within 20 ft. of it must succeed on a DC 10 Wisdom saving throw or be frightened for 1 minute. The target can repeat the saving throw at the end of each of its turns, with disadvantage if the quasit is within line of sight, ending the effect on itself on a success.",attack_bonus:0},{name:"Invisibility",desc:"The quasit magically turns invisible until it attacks or uses Scare, or until its concentration ends (as if concentrating on a spell). Any equipment the quasit wears or carries is invisible with it.",attack_bonus:0}]},{name:"Quipper",source:"5e SRD",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:1,hit_dice:"1d4 + -2",speed:"swim 40 ft.",stats:[2,16,9,1,7,2],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 8",languages:"",cr:"0",bestiary:!0,traits:[{name:"Blood Frenzy",desc:"The quipper has advantage on melee attack rolls against any creature that doesn't have all its hit points.",attack_bonus:0},{name:"Water Breathing",desc:"The quipper can breathe only underwater.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 1 piercing damage.",attack_bonus:5,damage_bonus:1}]},{name:"Rakshasa",source:"5e SRD",size:"Medium",type:"fiend",subtype:"",alignment:"lawful evil",ac:16,hp:110,hit_dice:"13d8 + 51",speed:"40 ft.",stats:[14,17,18,13,16,20],skillsaves:[{deception:10},{insight:8}],damage_vulnerabilities:"piercing from magic weapons wielded by good creatures",damage_resistances:"",damage_immunities:"bludgeoning, piercing, and slashing from nonmagical weapons",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 13",languages:"Common, Infernal",cr:"13",bestiary:!0,traits:[{name:"Limited Magic Immunity",desc:"The rakshasa can't be affected or detected by spells of 6th level or lower unless it wishes to be. It has advantage on saving throws against all other spells and magical effects.",attack_bonus:0},{name:"Innate Spellcasting",desc:`The rakshasa's innate spellcasting ability is Charisma (spell save DC 18, +10 to hit with spell attacks). The rakshasa can innately cast the following spells, requiring no material components:
At will: detect thoughts, disguise self, mage hand, minor illusion
3/day each: charm person, detect magic, invisibility, major image, suggestion
1/day each: dominate person, fly, plane shift, true seeing`,attack_bonus:0}],actions:[{name:"Multiattack",desc:"The rakshasa makes two claw attacks",attack_bonus:0},{name:"Claw",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 9 (2d6 + 2) slashing damage, and the target is cursed if it is a creature. The magical curse takes effect whenever the target takes a short or long rest, filling the target's thoughts with horrible images and dreams. The cursed target gains no benefit from finishing a short or long rest. The curse lasts until it is lifted by a remove curse spell or similar magic.",attack_bonus:7,damage_dice:"2d6",damage_bonus:2}]},{name:"Rat",source:"5e SRD",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:1,hit_dice:"1d4 + -2",speed:"20 ft.",stats:[2,11,9,2,10,4],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 10",languages:"",cr:"0",bestiary:!0,traits:[{name:"Keen Smell",desc:"The rat has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +0 to hit, reach 5 ft., one target. Hit: 1 piercing damage.",attack_bonus:0,damage_bonus:1}]},{name:"Raven",source:"5e SRD",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:1,hit_dice:"1d4 + -2",speed:"10 ft., fly 50 ft.",stats:[2,14,8,2,12,6],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"0",bestiary:!0,traits:[{name:"Mimicry",desc:"The raven can mimic simple sounds it has heard, such as a person whispering, a baby crying, or an animal chittering. A creature that hears the sounds can tell they are imitations with a successful DC 10 Wisdom (Insight) check.",attack_bonus:0}],actions:[{name:"Beak",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 1 piercing damage.",attack_bonus:0}]},{name:"Red Dragon Wyrmling",source:"5e SRD",size:"Medium",type:"dragon",subtype:"",alignment:"chaotic evil",ac:17,hp:75,hit_dice:"10d8 + 30",speed:"30 ft., climb 30 ft., fly 60 ft.",stats:[19,10,17,12,11,15],saves:[{dexterity:2},{constitution:5},{wisdom:2},{charisma:4}],skillsaves:[{perception:4},{stealth:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"4",bestiary:!0,actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 9 (1d10 + 4) piercing damage plus 3 (1d6) fire damage.",attack_bonus:6,damage_dice:"1d10 + 1d6",damage_bonus:4},{name:"Fire Breath (Recharge 5-6)",desc:"The dragon exhales fire in a 15-foot cone. Each creature in that area must make a DC 13 Dexterity saving throw, taking 24 (7d6) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"7d6"}]},{name:"Reef Shark",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:22,hit_dice:"4d8 + 4",speed:"swim 40 ft.",stats:[14,13,13,1,10,4],skillsaves:[{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 30 ft., passive Perception 12",languages:"",cr:"1/2",bestiary:!0,traits:[{name:"Pack Tactics",desc:"The shark has advantage on an attack roll against a creature if at least one of the shark's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0},{name:"Water Breathing",desc:"The shark can breathe only underwater.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2}]},{name:"Remorhaz",source:"5e SRD",size:"Huge",type:"monstrosity",subtype:"",alignment:"unaligned",ac:17,hp:195,hit_dice:"17d12 + 84",speed:"30 ft., burrow 20 ft.",stats:[24,13,21,4,10,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold, fire",condition_immunities:"",senses:"darkvision 60 ft., tremorsense 60 ft., passive Perception 10",languages:"",cr:"11",bestiary:!0,traits:[{name:"Heated Body",desc:"A creature that touches the remorhaz or hits it with a melee attack while within 5 feet of it takes 10 (3d6) fire damage.",attack_bonus:0,damage_dice:"3d6"}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +11 to hit, reach 10 ft., one target. Hit: 40 (6d10 + 7) piercing damage plus 10 (3d6) fire damage. If the target is a creature, it is grappled (escape DC 17). Until this grapple ends, the target is restrained, and the remorhaz can't bite another target.",attack_bonus:11,damage_dice:"6d10 + 3d6",damage_bonus:7},{name:"Swallow",desc:`The remorhaz makes one bite attack against a Medium or smaller creature it is grappling. If the attack hits, that creature takes the bite's damage and is swallowed, and the grapple ends. While swallowed, the creature is blinded and restrained, it has total cover against attacks and other effects outside the remorhaz, and it takes 21 (6d6) acid damage at the start of each of the remorhaz's turns.
If the remorhaz takes 30 damage or more on a single turn from a creature inside it, the remorhaz must succeed on a DC 15 Constitution saving throw at the end of that turn or regurgitate all swallowed creatures, which fall prone in a space within 10 feet oft he remorhaz. If the remorhaz dies, a swallowed creature is no longer restrained by it and can escape from the corpse using 15 feet of movement, exiting prone.`,attack_bonus:0}]},{name:"Rhinoceros",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:45,hit_dice:"6d10 + 12",speed:"40 ft.",stats:[21,8,15,2,12,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 11",languages:"",cr:"2",bestiary:!0,traits:[{name:"Charge",desc:"If the rhinoceros moves at least 20 ft. straight toward a target and then hits it with a gore attack on the same turn, the target takes an extra 9 (2d8) bludgeoning damage. If the target is a creature, it must succeed on a DC 15 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"2d8"}],actions:[{name:"Gore",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 14 (2d8 + 5) bludgeoning damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:5}]},{name:"Riding Horse",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:13,hit_dice:"2d10 + 2",speed:"60 ft.",stats:[16,10,12,2,11,7],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"1/4",bestiary:!0,actions:[{name:"Hooves",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (2d4 + 3) bludgeoning damage.",attack_bonus:5,damage_dice:"2d4",damage_bonus:3}]},{name:"Roc",source:"5e SRD",size:"Gargantuan",type:"monstrosity",subtype:"",alignment:"unaligned",ac:15,hp:248,hit_dice:"16d20 + 80",speed:"20 ft., fly 120 ft.",stats:[28,10,20,3,10,9],saves:[{dexterity:4},{constitution:9},{wisdom:4},{charisma:3}],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"",cr:"11",bestiary:!0,traits:[{name:"Keen Sight",desc:"The roc has advantage on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The roc makes two attacks: one with its beak and one with its talons.",attack_bonus:0},{name:"Beak",desc:"Melee Weapon Attack: +13 to hit, reach 10 ft., one target. Hit: 27 (4d8 + 9) piercing damage.",attack_bonus:13,damage_dice:"4d8",damage_bonus:9},{name:"Talons",desc:"Melee Weapon Attack: +13 to hit, reach 5 ft., one target. Hit: 23 (4d6 + 9) slashing damage, and the target is grappled (escape DC 19). Until this grapple ends, the target is restrained, and the roc can't use its talons on another target.",attack_bonus:13,damage_dice:"4d6",damage_bonus:9}]},{name:"Roper",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"neutral evil",ac:20,hp:93,hit_dice:"11d10 + 32",speed:"10 ft., climb 10 ft.",stats:[18,8,17,7,16,6],skillsaves:[{perception:6},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 16",languages:"",cr:"5",bestiary:!0,traits:[{name:"False Appearance",desc:"While the roper remains motionless, it is indistinguishable from a normal cave formation, such as a stalagmite.",attack_bonus:0},{name:"Grasping Tendrils",desc:"The roper can have up to six tendrils at a time. Each tendril can be attacked (AC 20; 10 hit points; immunity to poison and psychic damage). Destroying a tendril deals no damage to the roper, which can extrude a replacement tendril on its next turn. A tendril can also be broken if a creature takes an action and succeeds on a DC 15 Strength check against it.",attack_bonus:0},{name:"Spider Climb",desc:"The roper can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The roper makes four attacks with its tendrils, uses Reel, and makes one attack with its bite.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 22 (4d8 + 4) piercing damage.",attack_bonus:7,damage_dice:"4d8",damage_bonus:4},{name:"Tendril",desc:"Melee Weapon Attack: +7 to hit, reach 50 ft., one creature. Hit: The target is grappled (escape DC 15). Until the grapple ends, the target is restrained and has disadvantage on Strength checks and Strength saving throws, and the roper can't use the same tendril on another target.",attack_bonus:7},{name:"Reel",desc:"The roper pulls each creature grappled by it up to 25 ft. straight toward it.",attack_bonus:0}]},{name:"Rug of Smothering",source:"5e SRD",size:"Large",type:"construct",subtype:"",alignment:"unaligned",ac:12,hp:33,hit_dice:"6d10",speed:"10 ft.",stats:[17,14,10,1,3,1],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison, psychic",condition_immunities:"blinded, charmed, deafened, frightened, paralyzed, petrified, poisoned",senses:"blindsight 60 ft. (blind beyond this radius), passive Perception 6",languages:"",cr:"2",bestiary:!0,traits:[{name:"Antimagic Susceptibility",desc:"The rug is incapacitated while in the area of an antimagic field. If targeted by dispel magic, the rug must succeed on a Constitution saving throw against the caster's spell save DC or fall unconscious for 1 minute.",attack_bonus:0},{name:"Damage Transfer",desc:"While it is grappling a creature, the rug takes only half the damage dealt to it, and the creature grappled by the rug takes the other half.",attack_bonus:0},{name:"False Appearance",desc:"While the rug remains motionless, it is indistinguishable from a normal rug.",attack_bonus:0}],actions:[{name:"Smother",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one Medium or smaller creature. Hit: The creature is grappled (escape DC 13). Until this grapple ends, the target is restrained, blinded, and at risk of suffocating, and the rug can't smother another target. In addition, at the start of each of the target's turns, the target takes 10 (2d6 + 3) bludgeoning damage.",attack_bonus:0,damage_dice:"2d6",damage_bonus:3}]},{name:"Rust Monster",source:"5e SRD",size:"Medium",type:"monstrosity",subtype:"",alignment:"unaligned",ac:14,hp:27,hit_dice:"5d8 + 4",speed:"40 ft.",stats:[13,12,13,2,13,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 11",languages:"",cr:"1/2",bestiary:!0,traits:[{name:"Iron Scent",desc:"The rust monster can pinpoint, by scent, the location of ferrous metal within 30 feet of it.",attack_bonus:0},{name:"Rust Metal",desc:"Any nonmagical weapon made of metal that hits the rust monster corrodes. After dealing damage, the weapon takes a permanent and cumulative -1 penalty to damage rolls. If its penalty drops to -5, the weapon is destroyed. Non magical ammunition made of metal that hits the rust monster is destroyed after dealing damage.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 5 (1d8 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d8",damage_bonus:1},{name:"Antennae",desc:`The rust monster corrodes a nonmagical ferrous metal object it can see within 5 feet of it. If the object isn't being worn or carried, the touch destroys a 1-foot cube of it. If the object is being worn or carried by a creature, the creature can make a DC 11 Dexterity saving throw to avoid the rust monster's touch.
If the object touched is either metal armor or a metal shield being worn or carried, its takes a permanent and cumulative -1 penalty to the AC it offers. Armor reduced to an AC of 10 or a shield that drops to a +0 bonus is destroyed. If the object touched is a held metal weapon, it rusts as described in the Rust Metal trait.`,attack_bonus:0}]},{name:"Saber-Toothed Tiger",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:52,hit_dice:"7d10 + 13",speed:"40 ft.",stats:[18,14,15,3,12,8],skillsaves:[{perception:3},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"2",bestiary:!0,traits:[{name:"Keen Smell",desc:"The tiger has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0},{name:"Pounce",desc:"If the tiger moves at least 20 ft. straight toward a creature and then hits it with a claw attack on the same turn, that target must succeed on a DC 14 Strength saving throw or be knocked prone. If the target is prone, the tiger can make one bite attack against it as a bonus action.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 10 (1d10 + 5) piercing damage.",attack_bonus:6,damage_dice:"1d10",damage_bonus:5},{name:"Claw",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) slashing damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:5}]},{name:"Sahuagin",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"sahuagin",alignment:"lawful evil",ac:12,hp:22,hit_dice:"4d8 + 4",speed:"30 ft., swim 40 ft.",stats:[13,11,12,12,13,9],skillsaves:[{perception:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 15",languages:"Sahuagin",cr:"1/2",bestiary:!0,traits:[{name:"Blood Frenzy",desc:"The sahuagin has advantage on melee attack rolls against any creature that doesn't have all its hit points.",attack_bonus:0},{name:"Limited Amphibiousness",desc:"The sahuagin can breathe air and water, but it needs to be submerged at least once every 4 hours to avoid suffocating.",attack_bonus:0},{name:"Shark Telepathy",desc:"The sahuagin can magically command any shark within 120 feet of it, using a limited telepathy.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The sahuagin makes two melee attacks: one with its bite and one with its claws or spear.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 3 (1d4 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d4",damage_bonus:1},{name:"Claws",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 3 (1d4 + 1) slashing damage.",attack_bonus:3,damage_dice:"1d4",damage_bonus:1},{name:"Spear",desc:"Melee or Ranged Weapon Attack: +3 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 4 (1d6 + 1) piercing damage, or 5 (1d8 + 1) piercing damage if used with two hands to make a melee attack.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Salamander",source:"5e SRD",size:"Large",type:"elemental",subtype:"",alignment:"neutral evil",ac:15,hp:90,hit_dice:"12d10 + 24",speed:"30 ft.",stats:[18,14,15,11,10,12],damage_vulnerabilities:"cold",damage_resistances:"bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"fire",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"Ignan",cr:"5",bestiary:!0,traits:[{name:"Heated Body",desc:"A creature that touches the salamander or hits it with a melee attack while within 5 ft. of it takes 7 (2d6) fire damage.",attack_bonus:0,damage_dice:"2d6"},{name:"Heated Weapons",desc:"Any metal melee weapon the salamander wields deals an extra 3 (1d6) fire damage on a hit (included in the attack).",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The salamander makes two attacks: one with its spear and one with its tail.",attack_bonus:0},{name:"Spear",desc:"Melee or Ranged Weapon Attack: +7 to hit, reach 5 ft. or range 20 ft./60 ft., one target. Hit: 11 (2d6 + 4) piercing damage, or 13 (2d8 + 4) piercing damage if used with two hands to make a melee attack, plus 3 (1d6) fire damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Tail",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage plus 7 (2d6) fire damage, and the target is grappled (escape DC 14). Until this grapple ends, the target is restrained, the salamander can automatically hit the target with its tail, and the salamander can't make tail attacks against other targets.",attack_bonus:7,damage_dice:"2d6 + 2d6",damage_bonus:4}]},{name:"Satyr",source:"5e SRD",size:"Medium",type:"fey",subtype:"",alignment:"chaotic neutral",ac:14,hp:31,hit_dice:"7d8 + -1",speed:"40 ft.",stats:[12,16,11,12,10,14],skillsaves:[{perception:2},{performance:6},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 12",languages:"Common, Elvish, Sylvan",cr:"1/2",bestiary:!0,traits:[{name:"Magic Resistance",desc:"The satyr has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Ram",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 6 (2d4 + 1) bludgeoning damage.",attack_bonus:3,damage_dice:"2d4",damage_bonus:1},{name:"Shortsword",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1 d6 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Shortbow",desc:"Ranged Weapon Attack: +5 to hit, range 80/320 ft., one target. Hit: 6 (1d6 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Variant: Panpipes",desc:"Gentle Lullaby. The creature falls asleep and is unconscious for 1 minute. The effect ends if the creature takes damage or if someone takes an action to shake the creature awake.",attack_bonus:0}]},{name:"Scorpion",source:"5e SRD",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:1,hit_dice:"1d4 + -2",speed:"10 ft.",stats:[2,11,8,1,8,2],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., passive Perception 9",languages:"",cr:"0",bestiary:!0,actions:[{name:"Sting",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one creature. Hit: 1 piercing damage, and the target must make a DC 9 Constitution saving throw, taking 4 (1d8) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:2,damage_bonus:1}]},{name:"Scout",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:13,hp:16,hit_dice:"3d8 + 2",speed:"30 ft.",stats:[11,14,12,11,13,11],skillsaves:[{nature:4},{perception:5},{stealth:6},{survival:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 15",languages:"any one language (usually Common)",cr:"1/2",bestiary:!0,traits:[{name:"Keen Hearing and Sight",desc:"The scout has advantage on Wisdom (Perception) checks that rely on hearing or sight.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The scout makes two melee attacks or two ranged attacks.",attack_bonus:0},{name:"Shortsword",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Longbow",desc:"Ranged Weapon Attack: +4 to hit, ranged 150/600 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2}]},{name:"Sea Hag",source:"5e SRD",size:"Medium",type:"fey",subtype:"",alignment:"chaotic evil",ac:14,hp:52,hit_dice:"7d8 + 20",speed:"30 ft., swim 40 ft.",stats:[16,13,16,12,12,13],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 11",languages:"Aquan, Common, Giant",cr:"2",bestiary:!0,traits:[{name:"Amphibious",desc:"The hag can breathe air and water.",attack_bonus:0},{name:"Horrific Appearance",desc:`Any humanoid that starts its turn within 30 feet of the hag and can see the hag's true form must make a DC 11 Wisdom saving throw. On a failed save, the creature is frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, with disadvantage if the hag is within line of sight, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the hag's Horrific Appearance for the next 24 hours.
Unless the target is surprised or the revelation of the hag's true form is sudden, the target can avert its eyes and avoid making the initial saving throw. Until the start of its next turn, a creature that averts its eyes has disadvantage on attack rolls against the hag.`,attack_bonus:0},{name:"Hag Coven",desc:`When hags must work together, they form covens, in spite of their selfish natures. A coven is made up of hags of any type, all of whom are equals within the group. However, each of the hags continues to desire more personal power.
A coven consists of three hags so that any arguments between two hags can be settled by the third. If more than three hags ever come together, as might happen if two covens come into conflict, the result is usually chaos.`,attack_bonus:0},{name:"Shared Spellcasting (Coven Only)",desc:`While all three members of a hag coven are within 30 feet of one another, they can each cast the following spells from the wizard's spell list but must share the spell slots among themselves:
\u2022 1st level (4 slots): identify, ray of sickness
\u2022 2nd level (3 slots): hold person, locate object
\u2022 3rd level (3 slots): bestow curse, counterspell, lightning bolt
\u2022 4th level (3 slots): phantasmal killer, polymorph
\u2022 5th level (2 slots): contact other plane, scrying
\u2022 6th level (1 slot): eye bite
For casting these spells, each hag is a 12th-level spellcaster that uses Intelligence as her spellcasting ability. The spell save DC is 12+the hag's Intelligence modifier, and the spell attack bonus is 4+the hag's Intelligence modifier.`,attack_bonus:0},{name:"Hag Eye (Coven Only)",desc:`A hag coven can craft a magic item called a hag eye, which is made from a real eye coated in varnish and often fitted to a pendant or other wearable item. The hag eye is usually entrusted to a minion for safekeeping and transport. A hag in the coven can take an action to see what the hag eye sees if the hag eye is on the same plane of existence. A hag eye has AC 10, 1 hit point, and darkvision with a radius of 60 feet. If it is destroyed, each coven member takes 3d10 psychic damage and is blinded for 24 hours.
A hag coven can have only one hag eye at a time, and creating a new one requires all three members of the coven to perform a ritual. The ritual takes 1 hour, and the hags can't perform it while blinded. During the ritual, if the hags take any action other than performing the ritual, they must start over.`,attack_bonus:0}],actions:[{name:"Claws",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3},{name:"Death Glare",desc:"The hag targets one frightened creature she can see within 30 ft. of her. If the target can see the hag, it must succeed on a DC 11 Wisdom saving throw against this magic or drop to 0 hit points.",attack_bonus:0},{name:"Illusory Appearance",desc:`The hag covers herself and anything she is wearing or carrying with a magical illusion that makes her look like an ugly creature of her general size and humanoid shape. The effect ends if the hag takes a bonus action to end it or if she dies.
The changes wrought by this effect fail to hold up to physical inspection. For example, the hag could appear to have no claws, but someone touching her hand might feel the claws. Otherwise, a creature must take an action to visually inspect the illusion and succeed on a DC 16 Intelligence (Investigation) check to discern that the hag is disguised.`,attack_bonus:0}]},{name:"Sea Horse",source:"5e SRD",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:1,hit_dice:"1d4 + -2",speed:"swim 20 ft.",stats:[1,12,8,1,10,2],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"0",bestiary:!0,traits:[{name:"Water Breathing",desc:"The sea horse can breathe only underwater.",attack_bonus:0}]},{name:"Shadow",source:"5e SRD",size:"Medium",type:"undead",subtype:"",alignment:"chaotic evil",ac:12,hp:16,hit_dice:"3d8 + 2",speed:"40 ft.",stats:[6,14,13,6,10,8],skillsaves:[{stealth:4}],damage_vulnerabilities:"radiant",damage_resistances:"acid, cold, fire, lightning, thunder; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"necrotic, poison",condition_immunities:"exhaustion, frightened, grappled, paralyzed, petrified, poisoned, prone, restrained",senses:"darkvision 60 ft., passive Perception 10",languages:"",cr:"1/2",bestiary:!0,traits:[{name:"Amorphous",desc:"The shadow can move through a space as narrow as 1 inch wide without squeezing.",attack_bonus:0},{name:"Shadow Stealth",desc:"While in dim light or darkness, the shadow can take the Hide action as a bonus action. Its stealth bonus is also improved to +6.",attack_bonus:0},{name:"Sunlight Weakness",desc:"While in sunlight, the shadow has disadvantage on attack rolls, ability checks, and saving throws.",attack_bonus:0}],actions:[{name:"Strength Drain",desc:`Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 9 (2d6 + 2) necrotic damage, and the target's Strength score is reduced by 1d4. The target dies if this reduces its Strength to 0. Otherwise, the reduction lasts until the target finishes a short or long rest.
If a non-evil humanoid dies from this attack, a new shadow rises from the corpse 1d4 hours later.`,attack_bonus:4,damage_dice:"2d6",damage_bonus:2}]},{name:"Shambling Mound",source:"5e SRD",size:"Large",type:"plant",subtype:"",alignment:"unaligned",ac:15,hp:136,hit_dice:"16d10 + 48",speed:"20 ft., swim 20 ft.",stats:[18,8,16,5,10,5],skillsaves:[{stealth:2}],damage_vulnerabilities:"",damage_resistances:"cold, fire",damage_immunities:"lightning",condition_immunities:"blinded, deafened, exhaustion",senses:"blindsight 60 ft. (blind beyond this radius), passive Perception 10",languages:"",cr:"5",bestiary:!0,traits:[{name:"Lightning Absorption",desc:"Whenever the shambling mound is subjected to lightning damage, it takes no damage and regains a number of hit points equal to the lightning damage dealt.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The shambling mound makes two slam attacks. If both attacks hit a Medium or smaller target, the target is grappled (escape DC 14), and the shambling mound uses its Engulf on it.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) bludgeoning damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:4},{name:"Engulf",desc:"The shambling mound engulfs a Medium or smaller creature grappled by it. The engulfed target is blinded, restrained, and unable to breathe, and it must succeed on a DC 14 Constitution saving throw at the start of each of the mound's turns or take 13 (2d8 + 4) bludgeoning damage. If the mound moves, the engulfed target moves with it. The mound can have only one creature engulfed at a time.",attack_bonus:0}]},{name:"Shield Guardian",source:"5e SRD",size:"Large",type:"construct",subtype:"",alignment:"unaligned",ac:17,hp:142,hit_dice:"15d10 + 59",speed:"30 ft.",stats:[18,8,18,7,10,3],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"charmed, exhaustion, frightened, paralyzed, poisoned",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 10",languages:"understands commands given in any language but can't speak",cr:"7",bestiary:!0,traits:[{name:"Bound",desc:"The shield guardian is magically bound to an amulet. As long as the guardian and its amulet are on the same plane of existence, the amulet's wearer can telepathically call the guardian to travel to it, and the guardian knows the distance and direction to the amulet. If the guardian is within 60 feet of the amulet's wearer, half of any damage the wearer takes (rounded up) is transferred to the guardian.",attack_bonus:0},{name:"Regeneration",desc:"The shield guardian regains 10 hit points at the start of its turn if it has at least 1 hit. point.",attack_bonus:0},{name:"Spell Storing",desc:"A spellcaster who wears the shield guardian's amulet can cause the guardian to store one spell of 4th level or lower. To do so, the wearer must cast the spell on the guardian. The spell has no effect but is stored within the guardian. When commanded to do so by the wearer or when a situation arises that was predefined by the spellcaster, the guardian casts the stored spell with any parameters set by the original caster, requiring no components. When the spell is cast or a new spell is stored, any previously stored spell is lost.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The guardian makes two fist attacks.",attack_bonus:0},{name:"Fist",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4}],reactions:[{name:"Shield",desc:"When a creature makes an attack against the wearer of the guardian's amulet, the guardian grants a +2 bonus to the wearer's AC if the guardian is within 5 feet of the wearer.",attack_bonus:0}]},{name:"Shrieker",source:"5e SRD",size:"Medium",type:"plant",subtype:"",alignment:"unaligned",ac:5,hp:13,hit_dice:"3d8 + -1",speed:"0 ft.",stats:[1,1,10,1,3,1],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"blinded, deafened, frightened",senses:"blindsight 30 ft. (blind beyond this radius), passive Perception 6",languages:"",cr:"0",bestiary:!0,traits:[{name:"False Appearance",desc:"While the shrieker remains motionless, it is indistinguishable from an ordinary fungus.",attack_bonus:0}],actions:[{name:"Shriek",desc:"When bright light or a creature is within 30 feet of the shrieker, it emits a shriek audible within 300 feet of it. The shrieker continues to shriek until the disturbance moves out of range and for 1d4 of the shrieker's turns afterward",attack_bonus:0}]},{name:"Silver Dragon Wyrmling",source:"5e SRD",size:"Medium",type:"dragon",subtype:"",alignment:"lawful good",ac:17,hp:45,hit_dice:"6d8 + 18",speed:"30 ft., fly 60 ft.",stats:[19,10,17,12,11,15],saves:[{dexterity:2},{constitution:5},{wisdom:2},{charisma:4}],skillsaves:[{perception:4},{stealth:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"2",bestiary:!0,actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 9 (1d10 + 4) piercing damage.",attack_bonus:6,damage_dice:"1d10",damage_bonus:4},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Cold Breath. The dragon exhales an icy blast in a 15-foot cone. Each creature in that area must make a DC 13 Constitution saving throw, taking 18 (4d8) cold damage on a failed save, or half as much damage on a successful one.
Paralyzing Breath. The dragon exhales paralyzing gas in a 15-foot cone. Each creature in that area must succeed on a DC 13 Constitution saving throw or be paralyzed for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.`,attack_bonus:0,damage_dice:"4d8"}]},{name:"Skeleton",source:"5e SRD",size:"Medium",type:"undead",subtype:"",alignment:"lawful evil",ac:13,hp:13,hit_dice:"2d8 + 4",speed:"30 ft.",stats:[10,14,15,6,8,5],damage_vulnerabilities:"bludgeoning",damage_resistances:"",damage_immunities:"",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 9",languages:"understands all languages it spoke in life but can't speak",cr:"1/4",bestiary:!0,actions:[{name:"Shortsword",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Shortbow",desc:"Ranged Weapon Attack: +4 to hit, range 80/320 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Solar",source:"5e SRD",size:"Large",type:"celestial",subtype:"",alignment:"lawful good",ac:21,hp:243,hit_dice:"18d10 + 144",speed:"50 ft., fly 150 ft.",stats:[26,22,26,25,25,30],saves:[{intelligence:14},{wisdom:14},{charisma:17}],skillsaves:[{perception:14}],damage_vulnerabilities:"",damage_resistances:"radiant; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"necrotic, poison",condition_immunities:"charmed, exhaustion, frightened, poisoned",senses:"truesight 120 ft., passive Perception 24",languages:"all, telepathy 120 ft.",cr:"21",bestiary:!0,traits:[{name:"Angelic Weapons",desc:"The solar's weapon attacks are magical. When the solar hits with any weapon, the weapon deals an extra 6d8 radiant damage (included in the attack).",attack_bonus:0},{name:"Divine Awareness",desc:"The solar knows if it hears a lie.",attack_bonus:0},{name:"Innate Spellcasting",desc:`The solar's spell casting ability is Charisma (spell save DC 25). It can innately cast the following spells, requiring no material components:
At will: detect evil and good, invisibility (self only)
3/day each: blade barrier, dispel evil and good, resurrection
1/day each: commune, control weather`,attack_bonus:0},{name:"Magic Resistance",desc:"The solar has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The solar makes two greatsword attacks.",attack_bonus:0},{name:"Greatsword",desc:"Melee Weapon Attack: +15 to hit, reach 5 ft., one target. Hit: 22 (4d6 + 8) slashing damage plus 27 (6d8) radiant damage.",attack_bonus:15,damage_dice:"4d6 + 6d8",damage_bonus:8},{name:"Slaying Longbow",desc:"Ranged Weapon Attack: +13 to hit, range 150/600 ft., one target. Hit: 15 (2d8 + 6) piercing damage plus 27 (6d8) radiant damage. If the target is a creature that has 190 hit points or fewer, it must succeed on a DC 15 Constitution saving throw or die.",attack_bonus:13,damage_dice:"2d8 + 6d8",damage_bonus:6},{name:"Flying Sword",desc:"The solar releases its greatsword to hover magically in an unoccupied space within 5 ft. of it. If the solar can see the sword, the solar can mentally command it as a bonus action to fly up to 50 ft. and either make one attack against a target or return to the solar's hands. If the hovering sword is targeted by any effect, the solar is considered to be holding it. The hovering sword falls if the solar dies.",attack_bonus:0},{name:"Healing Touch (4/Day)",desc:"The solar touches another creature. The target magically regains 40 (8d8 + 4) hit points and is freed from any curse, disease, poison, blindness, or deafness.",attack_bonus:0}],legendary_actions:[{name:"Teleport",desc:"The solar magically teleports, along with any equipment it is wearing or carrying, up to 120 ft. to an unoccupied space it can see.",attack_bonus:0},{name:"Searing Burst (Costs 2 Actions)",desc:"The solar emits magical, divine energy. Each creature of its choice in a 10 -foot radius must make a DC 23 Dexterity saving throw, taking 14 (4d6) fire damage plus 14 (4d6) radiant damage on a failed save, or half as much damage on a successful one.",attack_bonus:0},{name:"Blinding Gaze (Costs 3 Actions)",desc:"The solar targets one creature it can see within 30 ft. of it. If the target can see it, the target must succeed on a DC 15 Constitution saving throw or be blinded until magic such as the lesser restoration spell removes the blindness.",attack_bonus:0}]},{name:"Specter",source:"5e SRD",size:"Medium",type:"undead",subtype:"",alignment:"chaotic evil",ac:12,hp:22,hit_dice:"5d8 + -1",speed:"0 ft., fly 50 ft. (hover)",stats:[1,14,11,10,10,11],damage_vulnerabilities:"",damage_resistances:"acid, cold, fire, lightning, thunder; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"necrotic, poison",condition_immunities:"charmed, exhaustion, grappled, paralyzed, petrified, poisoned, prone, restrained, unconscious",senses:"darkvision 60 ft., passive Perception 10",languages:"understands all languages it knew in life but can't speak",cr:"1",bestiary:!0,traits:[{name:"Incorporeal Movement",desc:"The specter can move through other creatures and objects as if they were difficult terrain. It takes 5 (1d10) force damage if it ends its turn inside an object.",attack_bonus:0},{name:"Sunlight Sensitivity",desc:"While in sunlight, the specter has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Life Drain",desc:"Melee Spell Attack: +4 to hit, reach 5 ft., one creature. Hit: 10 (3d6) necrotic damage. The target must succeed on a DC 10 Constitution saving throw or its hit point maximum is reduced by an amount equal to the damage taken. This reduction lasts until the creature finishes a long rest. The target dies if this effect reduces its hit point maximum to 0.",attack_bonus:4,damage_dice:"3d6"}]},{name:"Spider",source:"5e SRD",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:1,hit_dice:"1d4 + -2",speed:"20 ft., climb 20 ft.",stats:[2,14,8,1,10,2],skillsaves:[{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 12",languages:"",cr:"0",bestiary:!0,traits:[{name:"Spider Climb",desc:"The spider can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0},{name:"Web Sense",desc:"While in contact with a web, the spider knows the exact location of any other creature in contact with the same web.",attack_bonus:0},{name:"Web Walker",desc:"The spider ignores movement restrictions caused by webbing.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 1 piercing damage, and the target must succeed on a DC 9 Constitution saving throw or take 2 (1d4) poison damage.",attack_bonus:4,damage_bonus:1}]},{name:"Spirit Naga",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"chaotic evil",ac:15,hp:75,hit_dice:"10d10 + 20",speed:"40 ft.",stats:[18,17,14,16,15,16],saves:[{dexterity:6},{constitution:5},{wisdom:5},{charisma:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"charmed, poisoned",senses:"darkvision 60 ft., passive Perception 12",languages:"Abyssal, Common",cr:"8",bestiary:!0,traits:[{name:"Rejuvenation",desc:"If it dies, the naga returns to life in 1d6 days and regains all its hit points. Only a wish spell can prevent this trait from functioning.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one creature. Hit: 7 (1d6 + 4) piercing damage, and the target must make a DC 13 Constitution saving throw, taking 31 (7d8) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:7,damage_dice:"1d6",damage_bonus:4}],spells:["The naga is a 10th-level spellcaster. Its spellcasting ability is Intelligence (spell save DC 14, +6 to hit with spell attacks), and it needs only verbal components to cast its spells. It has the following wizard spells prepared:",{"Cantrips (at will)":"mage hand, minor illusion, ray of frost"},{"1st level (4 slots)":"charm person, detect magic, sleep"},{"2nd level (3 slots)":"detect thoughts, hold person"},{"3rd level (3 slots)":"lightning bolt, water breathing"},{"4th level (3 slots)":"blight, dimension door"},{"5th level (2 slots)":"dominate person"}]},{name:"Sprite",source:"5e SRD",size:"Tiny",type:"fey",subtype:"",alignment:"neutral good",ac:15,hp:2,hit_dice:"1d4 + -1",speed:"10 ft., fly 40 ft.",stats:[3,18,10,14,13,11],skillsaves:[{perception:3},{stealth:8}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"Common, Elvish, Sylvan",cr:"1/4",bestiary:!0,actions:[{name:"Longsword",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 1 slashing damage.",attack_bonus:2,damage_bonus:1},{name:"Shortbow",desc:"Ranged Weapon Attack: +6 to hit, range 40/160 ft., one target. Hit: 1 piercing damage, and the target must succeed on a DC 10 Constitution saving throw or become poisoned for 1 minute. If its saving throw result is 5 or lower, the poisoned target falls unconscious for the same duration, or until it takes damage or another creature takes an action to shake it awake.",attack_bonus:6,damage_bonus:1},{name:"Heart Sight",desc:"The sprite touches a creature and magically knows the creature's current emotional state. If the target fails a DC 10 Charisma saving throw, the sprite also knows the creature's alignment. Celestials, fiends, and undead automatically fail the saving throw.",attack_bonus:0},{name:"Invisibility",desc:"The sprite magically turns invisible until it attacks or casts a spell, or until its concentration ends (as if concentrating on a spell). Any equipment the sprite wears or carries is invisible with it.",attack_bonus:0}]},{name:"Spy",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:12,hp:27,hit_dice:"6d8",speed:"30 ft.",stats:[10,15,10,12,14,16],skillsaves:[{deception:5},{insight:4},{investigation:5},{perception:6},{persuasion:5},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 16",languages:"any two languages",cr:"1",bestiary:!0,traits:[{name:"Cunning Action",desc:"On each of its turns, the spy can use a bonus action to take the Dash, Disengage, or Hide action.",attack_bonus:0},{name:"Sneak Attack (1/Turn)",desc:"The spy deals an extra 7 (2d6) damage when it hits a target with a weapon attack and has advantage on the attack roll, or when the target is within 5 ft. of an ally of the spy that isn't incapacitated and the spy doesn't have disadvantage on the attack roll.",attack_bonus:0,damage_dice:"2d6"}],actions:[{name:"Multiattack",desc:"The spy makes two melee attacks.",attack_bonus:0},{name:"Shortsword",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Hand Crossbow",desc:"Ranged Weapon Attack: +4 to hit, range 30/120 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Steam Mephit",source:"5e SRD",size:"Small",type:"elemental",subtype:"",alignment:"neutral evil",ac:10,hp:21,hit_dice:"6d6",speed:"30 ft., fly 30 ft.",stats:[5,11,10,11,10,12],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 10",languages:"Aquan, Ignan",cr:"1/4",bestiary:!0,traits:[{name:"Death Burst",desc:"When the mephit dies, it explodes in a cloud of steam. Each creature within 5 ft. of the mephit must succeed on a DC 10 Dexterity saving throw or take 4 (1d8) fire damage.",attack_bonus:0,damage_dice:"1d8"},{name:"Innate Spellcasting (1/Day)",desc:"The mephit can innately cast blur, requiring no material components. Its innate spellcasting ability is Charisma.",attack_bonus:0}],actions:[{name:"Claws",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one creature. Hit: 2 (1d4) slashing damage plus 2 (1d4) fire damage.",attack_bonus:2,damage_dice:"2d4"},{name:"Steam Breath (Recharge 6)",desc:"The mephit exhales a 15-foot cone of scalding steam. Each creature in that area must succeed on a DC 10 Dexterity saving throw, taking 4 (1d8) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0},{name:"Variant: Summon Mephits (1/Day)",desc:"The mephit has a 25 percent chance of summoning 1d4 mephits of its kind. A summoned mephit appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other mephits. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",attack_bonus:0}]},{name:"Stirge",source:"5e SRD",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:14,hp:2,hit_dice:"1d4 + -1",speed:"10 ft., fly 40 ft.",stats:[4,16,11,2,8,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 9",languages:"",cr:"1/8",bestiary:!0,actions:[{name:"Blood Drain",desc:`Melee Weapon Attack: +5 to hit, reach 5 ft., one creature. Hit: 5 (1d4 + 3) piercing damage, and the stirge attaches to the target. While attached, the stirge doesn't attack. Instead, at the start of each of the stirge's turns, the target loses 5 (1d4 + 3) hit points due to blood loss.
The stirge can detach itself by spending 5 feet of its movement. It does so after it drains 10 hit points of blood from the target or the target dies. A creature, including the target, can use its action to detach the stirge.`,attack_bonus:5,damage_dice:"1d4",damage_bonus:3}]},{name:"Stone Giant",source:"5e SRD",size:"Huge",type:"giant",subtype:"",alignment:"neutral",ac:17,hp:126,hit_dice:"11d12 + 54",speed:"40 ft.",stats:[23,15,20,10,12,9],saves:[{dexterity:5},{constitution:8},{wisdom:4}],skillsaves:[{athletics:12},{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"Giant",cr:"7",bestiary:!0,traits:[{name:"Stone Camouflage",desc:"The giant has advantage on Dexterity (Stealth) checks made to hide in rocky terrain.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The giant makes two greatclub attacks.",attack_bonus:0},{name:"Greatclub",desc:"Melee Weapon Attack: +9 to hit, reach 15 ft., one target. Hit: 19 (3d8 + 6) bludgeoning damage.",attack_bonus:9,damage_dice:"3d8",damage_bonus:6},{name:"Rock",desc:"Ranged Weapon Attack: +9 to hit, range 60/240 ft., one target. Hit: 28 (4d10 + 6) bludgeoning damage. If the target is a creature, it must succeed on a DC 17 Strength saving throw or be knocked prone.",attack_bonus:9,damage_dice:"4d10",damage_bonus:6}],reactions:[{name:"Rock Catching",desc:"If a rock or similar object is hurled at the giant, the giant can, with a successful DC 10 Dexterity saving throw, catch the missile and take no bludgeoning damage from it.",attack_bonus:0}]},{name:"Stone Golem",source:"5e SRD",size:"Large",type:"construct",subtype:"",alignment:"unaligned",ac:17,hp:178,hit_dice:"17d10 + 84",speed:"30 ft.",stats:[22,9,20,3,11,1],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison, psychic; bludgeoning, piercing, and slashing from nonmagical weapons that aren't adamantine",condition_immunities:"charmed, exhaustion, frightened, paralyzed, petrified, poisoned",senses:"darkvision 120 ft., passive Perception 10",languages:"understands the languages of its creator but can't speak",cr:"10",bestiary:!0,traits:[{name:"Immutable Form",desc:"The golem is immune to any spell or effect that would alter its form.",attack_bonus:0},{name:"Magic Resistance",desc:"The golem has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Magic Weapons",desc:"The golem's weapon attacks are magical.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The golem makes two slam attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 19 (3d8 + 6) bludgeoning damage.",attack_bonus:10,damage_dice:"3d8",damage_bonus:6},{name:"Slow (Recharge 5-6)",desc:"The golem targets one or more creatures it can see within 10 ft. of it. Each target must make a DC 17 Wisdom saving throw against this magic. On a failed save, a target can't use reactions, its speed is halved, and it can't make more than one attack on its turn. In addition, the target can take either an action or a bonus action on its turn, not both. These effects last for 1 minute. A target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:0}]},{name:"Storm Giant",source:"5e SRD",size:"Huge",type:"giant",subtype:"",alignment:"chaotic good",ac:16,hp:230,hit_dice:"20d12 + 100",speed:"50 ft., swim 50 ft.",stats:[29,14,20,16,18,18],saves:[{strength:14},{constitution:10},{wisdom:9},{charisma:9}],skillsaves:[{arcana:8},{athletics:14},{history:8},{perception:9}],damage_vulnerabilities:"",damage_resistances:"cold",damage_immunities:"lightning, thunder",condition_immunities:"",senses:"passive Perception 19",languages:"Common, Giant",cr:"13",bestiary:!0,traits:[{name:"Amphibious",desc:"The giant can breathe air and water.",attack_bonus:0},{name:"Innate Spellcasting",desc:`The giant's innate spellcasting ability is Charisma (spell save DC 17). It can innately cast the following spells, requiring no material components:
At will: detect magic, feather fall, levitate, light
3/day each: control weather, water breathing`,attack_bonus:0}],actions:[{name:"Multiattack",desc:"The giant makes two greatsword attacks.",attack_bonus:0},{name:"Greatsword",desc:"Melee Weapon Attack: +14 to hit, reach 10 ft., one target. Hit: 30 (6d6 + 9) slashing damage.",attack_bonus:14,damage_dice:"6d6",damage_bonus:9},{name:"Rock",desc:"Ranged Weapon Attack: +14 to hit, range 60/240 ft., one target. Hit: 35 (4d12 + 9) bludgeoning damage.",attack_bonus:14,damage_dice:"4d12",damage_bonus:9},{name:"Lightning Strike (Recharge 5-6)",desc:"The giant hurls a magical lightning bolt at a point it can see within 500 feet of it. Each creature within 10 feet of that point must make a DC 17 Dexterity saving throw, taking 54 (12d8) lightning damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"12d8"}]},{name:"Succubus/Incubus",source:"5e SRD",size:"Medium",type:"fiend",subtype:"shapechanger",alignment:"neutral evil",ac:15,hp:66,hit_dice:"12d8 + 12",speed:"30 ft., fly 60 ft.",stats:[8,17,13,15,12,20],skillsaves:[{deception:9},{insight:5},{perception:5},{persuasion:9},{stealth:7}],damage_vulnerabilities:"",damage_resistances:"cold, fire, lightning, poison; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 15",languages:"Abyssal, Common, Infernal, telepathy 60 ft.",cr:"4",bestiary:!0,traits:[{name:"Telepathic Bond",desc:"The fiend ignores the range restriction on its telepathy when communicating with a creature it has charmed. The two don't even need to be on the same plane of existence.",attack_bonus:0},{name:"Shapechanger",desc:"The fiend can use its action to polymorph into a Small or Medium humanoid, or back into its true form. Without wings, the fiend loses its flying speed. Other than its size and speed, its statistics are the same in each form. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",attack_bonus:0}],actions:[{name:"Claw (Fiend Form Only)",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Charm",desc:`One humanoid the fiend can see within 30 feet of it must succeed on a DC 15 Wisdom saving throw or be magically charmed for 1 day. The charmed target obeys the fiend's verbal or telepathic commands. If the target suffers any harm or receives a suicidal command, it can repeat the saving throw, ending the effect on a success. If the target successfully saves against the effect, or if the effect on it ends, the target is immune to this fiend's Charm for the next 24 hours.
The fiend can have only one target charmed at a time. If it charms another, the effect on the previous target ends.`,attack_bonus:0},{name:"Draining Kiss",desc:"The fiend kisses a creature charmed by it or a willing creature. The target must make a DC 15 Constitution saving throw against this magic, taking 32 (5d10 + 5) psychic damage on a failed save, or half as much damage on a successful one. The target's hit point maximum is reduced by an amount equal to the damage taken. This reduction lasts until the target finishes a long rest. The target dies if this effect reduces its hit point maximum to 0.",attack_bonus:0,damage_dice:"5d10",damage_bonus:5},{name:"Etherealness",desc:"The fiend magically enters the Ethereal Plane from the Material Plane, or vice versa.",attack_bonus:0}]},{name:"Swarm of Bats",source:"5e SRD",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:12,hp:22,hit_dice:"5d8 + -1",speed:"0 ft., fly 30 ft.",stats:[5,15,10,2,12,4],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",senses:"blindsight 60 ft., passive Perception 11",languages:"",cr:"1/4",bestiary:!0,traits:[{name:"Echolocation",desc:"The swarm can't use its blindsight while deafened.",attack_bonus:0},{name:"Keen Hearing",desc:"The swarm has advantage on Wisdom (Perception) checks that rely on hearing.",attack_bonus:0},{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny bat. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0}],actions:[{name:"Bites",desc:"Melee Weapon Attack: +4 to hit, reach 0 ft., one creature in the swarm's space. Hit: 5 (2d4) piercing damage, or 2 (1d4) piercing damage if the swarm has half of its hit points or fewer.",attack_bonus:4,damage_dice:"2d4"}]},{name:"Swarm of Beetles",source:"5e SRD",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:12,hp:22,hit_dice:"5d8 + -1",speed:"20 ft., burrow 5 ft., climb 20 ft.",stats:[3,13,10,1,7,1],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",senses:"blindsight 10 ft., passive Perception 8",languages:"",cr:"1/2",bestiary:!0,traits:[{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny insect. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0}],actions:[{name:"Bites",desc:"Melee Weapon Attack: +3 to hit, reach 0 ft., one target in the swarm's space. Hit: 10 (4d4) piercing damage, or 5 (2d4) piercing damage if the swarm has half of its hit points or fewer.",attack_bonus:3,damage_dice:"4d4"}]},{name:"Swarm of Centipedes",source:"5e SRD",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:12,hp:22,hit_dice:"5d8 + -1",speed:"20 ft., climb 20 ft.",stats:[3,13,10,1,7,1],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",senses:"blindsight 10 ft., passive Perception 8",languages:"",cr:"1/2",bestiary:!0,traits:[{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny insect. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0}],actions:[{name:"Bites",desc:`Melee Weapon Attack: +3 to hit, reach 0 ft., one target in the swarm's space. Hit: 10 (4d4) piercing damage, or 5 (2d4) piercing damage if the swarm has half of its hit points or fewer.
A creature reduced to 0 hit points by a swarm of centipedes is stable but poisoned for 1 hour, even after regaining hit points, and paralyzed while poisoned in this way.`,attack_bonus:3,damage_dice:"4d4"}]},{name:"Swarm of Insects",source:"5e SRD",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:12,hp:22,hit_dice:"5d8 + -1",speed:"20 ft., climb 20 ft.",stats:[3,13,10,1,7,1],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",senses:"blindsight 10 ft., passive Perception 8",languages:"",cr:"1/2",bestiary:!0,traits:[{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny insect. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0}],actions:[{name:"Bites",desc:"Melee Weapon Attack: +3 to hit, reach 0 ft., one target in the swarm's space. Hit: 10 (4d4) piercing damage, or 5 (2d4) piercing damage if the swarm has half of its hit points or fewer.",attack_bonus:3,damage_dice:"4d4"}]},{name:"Swarm of Poisonous Snakes",source:"5e SRD",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:14,hp:36,hit_dice:"8d8",speed:"30 ft., swim 30 ft.",stats:[8,18,11,1,10,3],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",senses:"blindsight 10 ft., passive Perception 10",languages:"",cr:"2",bestiary:!0,traits:[{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny snake. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0}],actions:[{name:"Bites",desc:"Melee Weapon Attack: +6 to hit, reach 0 ft., one creature in the swarm's space. Hit: 7 (2d6) piercing damage, or 3 (1d6) piercing damage if the swarm has half of its hit points or fewer. The target must make a DC 10 Constitution saving throw, taking 14 (4d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:6,damage_dice:"2d6"}]},{name:"Swarm of Quippers",source:"5e SRD",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:13,hp:28,hit_dice:"8d8 + -8",speed:"0 ft., swim 40 ft.",stats:[13,16,9,1,7,2],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",senses:"darkvision 60 ft., passive Perception 8",languages:"",cr:"1",bestiary:!0,traits:[{name:"Blood Frenzy",desc:"The swarm has advantage on melee attack rolls against any creature that doesn't have all its hit points.",attack_bonus:0},{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny quipper. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0},{name:"Water Breathing",desc:"The swarm can breathe only underwater.",attack_bonus:0}],actions:[{name:"Bites",desc:"Melee Weapon Attack: +5 to hit, reach 0 ft., one creature in the swarm's space. Hit: 14 (4d6) piercing damage, or 7 (2d6) piercing damage if the swarm has half of its hit points or fewer.",attack_bonus:5,damage_dice:"4d6"}]},{name:"Swarm of Rats",source:"5e SRD",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:10,hp:24,hit_dice:"7d8 + -8",speed:"30 ft.",stats:[9,11,9,2,10,3],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",senses:"darkvision 30 ft., passive Perception 10",languages:"",cr:"1/4",bestiary:!0,traits:[{name:"Keen Smell",desc:"The swarm has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0},{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny rat. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0}],actions:[{name:"Bites",desc:"Melee Weapon Attack: +2 to hit, reach 0 ft., one target in the swarm's space. Hit: 7 (2d6) piercing damage, or 3 (1d6) piercing damage if the swarm has half of its hit points or fewer.",attack_bonus:2,damage_dice:"2d6"}]},{name:"Swarm of Ravens",source:"5e SRD",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:12,hp:24,hit_dice:"7d8 + -8",speed:"10 ft., fly 50 ft.",stats:[6,14,8,3,12,6],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",senses:"passive Perception 15",languages:"",cr:"1/4",bestiary:!0,traits:[{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny raven. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0}],actions:[{name:"Beaks",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target in the swarm's space. Hit: 7 (2d6) piercing damage, or 3 (1d6) piercing damage if the swarm has half of its hit points or fewer.",attack_bonus:4,damage_dice:"2d6"}]},{name:"Swarm of Spiders",source:"5e SRD",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:12,hp:22,hit_dice:"5d8 + -1",speed:"20 ft., climb 20 ft.",stats:[3,13,10,1,7,1],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, paralyzed, petrified, prone, restrained, stunned",senses:"blindsight 10 ft., passive Perception 8",languages:"",cr:"1/2",bestiary:!0,traits:[{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny insect. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0},{name:"Spider Climb",desc:"The swarm can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0},{name:"Web Sense",desc:"While in contact with a web, the swarm knows the exact location of any other creature in contact with the same web.",attack_bonus:0},{name:"Web Walker",desc:"The swarm ignores movement restrictions caused by webbing.",attack_bonus:0}],actions:[{name:"Bites",desc:"Melee Weapon Attack: +3 to hit, reach 0 ft., one target in the swarm's space. Hit: 10 (4d4) piercing damage, or 5 (2d4) piercing damage if the swarm has half of its hit points or fewer.",attack_bonus:3,damage_dice:"4d4"}]},{name:"Swarm of Wasps",source:"5e SRD",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:12,hp:22,hit_dice:"5d8 + -1",speed:"5 ft., fly 30 ft.",stats:[3,13,10,1,7,1],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",senses:"blindsight 10 ft., passive Perception 8",languages:"",cr:"1/2",bestiary:!0,traits:[{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny insect. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0}],actions:[{name:"Bites",desc:"Melee Weapon Attack: +3 to hit, reach 0 ft., one target in the swarm's space. Hit: 10 (4d4) piercing damage, or 5 (2d4) piercing damage if the swarm has half of its hit points or fewer.",attack_bonus:3,damage_dice:"4d4"}]},{name:"Tarrasque",source:"5e SRD",size:"Gargantuan",type:"monstrosity",subtype:"titan",alignment:"unaligned",ac:25,hp:676,hit_dice:"33d20 + 329",speed:"40 ft.",stats:[30,11,30,3,11,11],saves:[{intelligence:5},{wisdom:9},{charisma:9}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire, poison; bludgeoning, piercing, and slashing from nonmagical weapons",condition_immunities:"charmed, frightened, paralyzed, poisoned",senses:"blindsight 120 ft., passive Perception 10",languages:"",cr:"30",bestiary:!0,traits:[{name:"Legendary Resistance (3/Day)",desc:"If the tarrasque fails a saving throw, it can choose to succeed instead.",attack_bonus:0},{name:"Magic Resistance",desc:"The tarrasque has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Reflective Carapace",desc:"Any time the tarrasque is targeted by a magic missile spell, a line spell, or a spell that requires a ranged attack roll, roll a d6. On a 1 to 5, the tarrasque is unaffected. On a 6, the tarrasque is unaffected, and the effect is reflected back at the caster as though it originated from the tarrasque, turning the caster into the target.",attack_bonus:0},{name:"Siege Monster",desc:"The tarrasque deals double damage to objects and structures.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The tarrasque can use its Frightful Presence. It then makes five attacks: one with its bite, two with its claws, one with its horns, and one with its tai l. It can use its Swallow instead of its bite.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +19 to hit, reach 10 ft., one target. Hit: 36 (4d12 + 10) piercing damage. If the target is a creature, it is grappled (escape DC 20). Until this grapple ends, the target is restrained, and the tarrasque can't bite another target.",attack_bonus:19,damage_dice:"4d12",damage_bonus:10},{name:"Claw",desc:"Melee Weapon Attack: +19 to hit, reach 15 ft., one target. Hit: 28 (4d8 + 10) slashing damage.",attack_bonus:19,damage_dice:"4d8",damage_bonus:10},{name:"Horns",desc:"Melee Weapon Attack: +19 to hit, reach 10 ft., one target. Hit: 32 (4d10 + 10) piercing damage.",attack_bonus:19,damage_dice:"4d10",damage_bonus:10},{name:"Tail",desc:"Melee Weapon Attack: +19 to hit, reach 20 ft., one target. Hit: 24 (4d6 + 10) bludgeoning damage. If the target is a creature, it must succeed on a DC 20 Strength saving throw or be knocked prone.",attack_bonus:19,damage_dice:"4d6",damage_bonus:10},{name:"Frightful Presence",desc:"Each creature of the tarrasque's choice within 120 feet of it and aware of it must succeed on a DC 17 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, with disadvantage if the tarrasque is within line of sight, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the tarrasque's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Swallow",desc:`The tarrasque makes one bite attack against a Large or smaller creature it is grappling. If the attack hits, the target takes the bite's damage, the target is swallowed, and the grapple ends. While swallowed, the creature is blinded and restrained, it has total cover against attacks and other effects outside the tarrasque, and it takes 56 (16d6) acid damage at the start of each of the tarrasque's turns.
If the tarrasque takes 60 damage or more on a single turn from a creature inside it, the tarrasque must succeed on a DC 20 Constitution saving throw at the end of that turn or regurgitate all swallowed creatures, which fall prone in a space within 10 feet of the tarrasque. If the tarrasque dies, a swallowed creature is no longer restrained by it and can escape from the corpse by using 30 feet of movement, exiting prone.`,attack_bonus:0}],legendary_actions:[{name:"Attack",desc:"The tarrasque makes one claw attack or tail attack.",attack_bonus:0},{name:"Move",desc:"The tarrasque moves up to half its speed.",attack_bonus:0},{name:"Chomp (Costs 2 Actions)",desc:"The tarrasque makes one bite attack or uses its Swallow.",attack_bonus:0}]},{name:"Thug",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any non-good alignment",ac:11,hp:32,hit_dice:"5d8 + 9",speed:"30 ft.",stats:[15,11,14,10,10,11],skillsaves:[{intimidation:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"any one language (usually Common)",cr:"1/2",bestiary:!0,traits:[{name:"Pack Tactics",desc:"The thug has advantage on an attack roll against a creature if at least one of the thug's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The thug makes two melee attacks.",attack_bonus:0},{name:"Mace",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 5 (1d6 + 2) bludgeoning damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Heavy Crossbow",desc:"Ranged Weapon Attack: +2 to hit, range 100/400 ft., one target. Hit: 5 (1d10) piercing damage.",attack_bonus:2,damage_dice:"1d10"}]},{name:"Tiger",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:37,hit_dice:"5d10 + 9",speed:"40 ft.",stats:[17,15,14,3,12,8],skillsaves:[{perception:3},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 13",languages:"",cr:"1",bestiary:!0,traits:[{name:"Keen Smell",desc:"The tiger has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0},{name:"Pounce",desc:"If the tiger moves at least 20 ft. straight toward a creature and then hits it with a claw attack on the same turn, that target must succeed on a DC 13 Strength saving throw or be knocked prone. If the target is prone, the tiger can make one bite attack against it as a bonus action.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (1d10 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d10",damage_bonus:3},{name:"Claw",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) slashing damage.",attack_bonus:0}]},{name:"Treant",source:"5e SRD",size:"Huge",type:"plant",subtype:"",alignment:"chaotic good",ac:16,hp:138,hit_dice:"12d12 + 60",speed:"30 ft.",stats:[23,8,21,12,16,12],damage_vulnerabilities:"fire",damage_resistances:"bludgeoning, piercing",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"Common, Druidic, Elvish, Sylvan",cr:"9",bestiary:!0,traits:[{name:"False Appearance",desc:"While the treant remains motionless, it is indistinguishable from a normal tree.",attack_bonus:0},{name:"Siege Monster",desc:"The treant deals double damage to objects and structures.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The treant makes two slam attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 16 (3d6 + 6) bludgeoning damage.",attack_bonus:10,damage_dice:"3d6",damage_bonus:6},{name:"Rock",desc:"Ranged Weapon Attack: +10 to hit, range 60/180 ft., one target. Hit: 28 (4d10 + 6) bludgeoning damage.",attack_bonus:10,damage_dice:"4d10",damage_bonus:6},{name:"Animate Trees (1/Day)",desc:"The treant magically animates one or two trees it can see within 60 feet of it. These trees have the same statistics as a treant, except they have Intelligence and Charisma scores of 1, they can't speak, and they have only the Slam action option. An animated tree acts as an ally of the treant. The tree remains animate for 1 day or until it dies; until the treant dies or is more than 120 feet from the tree; or until the treant takes a bonus action to turn it back into an inanimate tree. The tree then takes root if possible.",attack_bonus:0}]},{name:"Tribal Warrior",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:12,hp:11,hit_dice:"2d8 + 2",speed:"30 ft.",stats:[13,11,12,8,11,8],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"any one language",cr:"1/8",bestiary:!0,traits:[{name:"Pack Tactics",desc:"The warrior has advantage on an attack roll against a creature if at least one of the warrior's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Spear",desc:"Melee or Ranged Weapon Attack: +3 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 4 (1d6 + 1) piercing damage, or 5 (1d8 + 1) piercing damage if used with two hands to make a melee attack.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Triceratops",source:"5e SRD",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:95,hit_dice:"10d12 + 30",speed:"50 ft.",stats:[22,9,17,2,11,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"5",bestiary:!0,traits:[{name:"Trampling Charge",desc:"If the triceratops moves at least 20 ft. straight toward a creature and then hits it with a gore attack on the same turn, that target must succeed on a DC 13 Strength saving throw or be knocked prone. If the target is prone, the triceratops can make one stomp attack against it as a bonus action.",attack_bonus:0}],actions:[{name:"Gore",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 24 (4d8 + 6) piercing damage.",attack_bonus:9,damage_dice:"4d8",damage_bonus:6},{name:"Stomp",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one prone creature. Hit: 22 (3d10 + 6) bludgeoning damage",attack_bonus:9,damage_dice:"3d10",damage_bonus:6}]},{name:"Troll",source:"5e SRD",size:"Large",type:"giant",subtype:"",alignment:"chaotic evil",ac:15,hp:84,hit_dice:"8d10 + 40",speed:"30 ft.",stats:[18,13,20,7,9,7],skillsaves:[{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 12",languages:"Giant",cr:"5",bestiary:!0,traits:[{name:"Keen Smell",desc:"The troll has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0},{name:"Regeneration",desc:"The troll regains 10 hit points at the start of its turn. If the troll takes acid or fire damage, this trait doesn't function at the start of the troll's next turn. The troll dies only if it starts its turn with 0 hit points and doesn't regenerate.",attack_bonus:0},{name:"Variant: Loathsome Limbs",desc:`Whenever the troll takes at least 15 slashing damage at one time, roll a d20 to determine what else happens to it:
1-10: Nothing else happens.
11-14: One leg is severed from the troll if it has any legs left.
15- 18: One arm is severed from the troll if it has any arms left.
19-20: The troll is decapitated, but the troll dies only if it can't regenerate. If it dies, so does the severed head.
If the troll finishes a short or long rest without reattaching a severed limb or head, the part regrows. At that point, the severed part dies. Until then, a severed part acts on the troll's initiative and has its own action and movement. A severed part has AC 13, 10 hit points, and the troll's Regeneration trait.
A severed leg is unable to attack and has a speed of 5 feet.
A severed arm has a speed of 5 feet and can make one claw attack on its turn, with disadvantage on the attack roll unless the troll can see the arm and its target. Each time the troll loses an arm, it loses a claw attack.
If its head is severed, the troll loses its bite attack and its body is blinded unless the head can see it. The severed head has a speed of 0 feet and the troll's Keen Smell trait. It can make a bite attack but only against a target in its space.
The troll's speed is halved if it's missing a leg. If it loses both legs, it falls prone. If it has both arms, it can crawl. With only one arm, it can still crawl, but its speed is halved. With no arms or legs, its speed is 0, and it can't benefit from bonuses to speed.`,attack_bonus:0}],actions:[{name:"Multiattack",desc:"The troll makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 7 (1d6 + 4) piercing damage.",attack_bonus:7,damage_dice:"1d6",damage_bonus:4},{name:"Claw",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4}]},{name:"Tyrannosaurus Rex",source:"5e SRD",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:136,hit_dice:"13d12 + 51",speed:"50 ft.",stats:[25,10,19,2,12,9],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"",cr:"8",bestiary:!0,actions:[{name:"Multiattack",desc:"The tyrannosaurus makes two attacks: one with its bite and one with its tail. It can't make both attacks against the same target.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 33 (4d12 + 7) piercing damage. If the target is a Medium or smaller creature, it is grappled (escape DC 17). Until this grapple ends, the target is restrained, and the tyrannosaurus can't bite another target.",attack_bonus:10,damage_dice:"4d12",damage_bonus:7},{name:"Tail",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 20 (3d8 + 7) bludgeoning damage.",attack_bonus:10,damage_dice:"3d8",damage_bonus:7}]},{name:"Unicorn",source:"5e SRD",size:"Large",type:"celestial",subtype:"",alignment:"lawful good",ac:12,hp:67,hit_dice:"9d10 + 17",speed:"50 ft.",stats:[18,14,15,11,17,16],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"charmed, paralyzed, poisoned",senses:"darkvision 60 ft., passive Perception 13",languages:"Celestial, Elvish, Sylvan, telepathy 60 ft.",cr:"5",bestiary:!0,traits:[{name:"Charge",desc:"If the unicorn moves at least 20 ft. straight toward a target and then hits it with a horn attack on the same turn, the target takes an extra 9 (2d8) piercing damage. If the target is a creature, it must succeed on a DC 15 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"2d8"},{name:"Innate Spellcasting",desc:`The unicorn's innate spellcasting ability is Charisma (spell save DC 14). The unicorn can innately cast the following spells, requiring no components:
At will: detect evil and good, druidcraft, pass without trace
1/day each: calm emotions, dispel evil and good, entangle`,attack_bonus:0},{name:"Magic Resistance",desc:"The unicorn has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Magic Weapons",desc:"The unicorn's weapon attacks are magical.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The unicorn makes two attacks: one with its hooves and one with its horn.",attack_bonus:0},{name:"Hooves",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft ., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Horn",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft ., one target. Hit: 8 (1d8 + 4) piercing damage.",attack_bonus:7,damage_dice:"1d8",damage_bonus:4},{name:"Healing Touch (3/Day)",desc:"The unicorn touches another creature with its horn. The target magically regains 11 (2d8 + 2) hit points. In addition, the touch removes all diseases and neutralizes all poisons afflicting the target.",attack_bonus:0},{name:"Teleport (1/Day)",desc:"The unicorn magically teleports itself and up to three willing creatures it can see within 5 ft. of it, along with any equipment they are wearing or carrying, to a location the unicorn is familiar with, up to 1 mile away.",attack_bonus:0}],legendary_actions:[{name:"Hooves",desc:"The unicorn makes one attack with its hooves.",attack_bonus:0},{name:"Shimmering Shield (Costs 2 Actions)",desc:"The unicorn creates a shimmering, magical field around itself or another creature it can see within 60 ft. of it. The target gains a +2 bonus to AC until the end of the unicorn's next turn.",attack_bonus:0},{name:"Heal Self (Costs 3 Actions)",desc:"The unicorn magically regains 11 (2d8 + 2) hit points.",attack_bonus:0}]},{name:"Vampire",source:"5e SRD",size:"Medium",type:"undead",subtype:"shapechanger",alignment:"lawful evil",ac:16,hp:144,hit_dice:"17d8 + 67",speed:"30 ft.",stats:[18,18,18,17,15,18],saves:[{dexterity:9},{wisdom:7},{charisma:9}],skillsaves:[{perception:7},{stealth:9}],damage_vulnerabilities:"",damage_resistances:"necrotic; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 17",languages:"the languages it knew in life",cr:"13",bestiary:!0,traits:[{name:"Shapechanger",desc:`If the vampire isn't in sun light or running water, it can use its action to polymorph into a Tiny bat or a Medium cloud of mist, or back into its true form.
While in bat form, the vampire can't speak, its walking speed is 5 feet, and it has a flying speed of 30 feet. Its statistics, other than its size and speed, are unchanged. Anything it is wearing transforms with it, but nothing it is carrying does. It reverts to its true form if it dies.
While in mist form, the vampire can't take any actions, speak, or manipulate objects. It is weightless, has a flying speed of 20 feet, can hover, and can enter a hostile creature's space and stop there. In addition, if air can pass through a space, the mist can do so without squeezing, and it can't pass through water. It has advantage on Strength, Dexterity, and Constitution saving throws, and it is immune to all nonmagical damage, except the damage it takes from sunlight.`,attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the vampire fails a saving throw, it can choose to succeed instead.",attack_bonus:0},{name:"Misty Escape",desc:`When it drops to 0 hit points outside its resting place, the vampire transforms into a cloud of mist (as in the Shapechanger trait) instead of falling unconscious, provided that it isn't in sunlight or running water. If it can't transform, it is destroyed.
While it has 0 hit points in mist form, it can't revert to its vampire form, and it must reach its resting place within 2 hours or be destroyed. Once in its resting place, it reverts to its vampire form. It is then paralyzed until it regains at least 1 hit point. After spending 1 hour in its resting place with 0 hit points, it regains 1 hit point.`,attack_bonus:0},{name:"Regeneration",desc:"The vampire regains 20 hit points at the start of its turn if it has at least 1 hit point and isn't in sunlight or running water. If the vampire takes radiant damage or damage from holy water, this trait doesn't function at the start of the vampire's next turn.",attack_bonus:0},{name:"Spider Climb",desc:"The vampire can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0},{name:"Vampire Weaknesses",desc:`The vampire has the following flaws:
Forbiddance. The vampire can't enter a residence without an invitation from one of the occupants.
Harmed by Running Water. The vampire takes 20 acid damage if it ends its turn in running water.
Stake to the Heart. If a piercing weapon made of wood is driven into the vampire's heart while the vampire is incapacitated in its resting place, the vampire is paralyzed until the stake is removed.
Sunlight Hypersensitivity. The vampire takes 20 radiant damage when it starts its turn in sunlight. While in sunlight, it has disadvantage on attack rolls and ability checks.`,attack_bonus:0}],actions:[{name:"Multiattack (Vampire Form Only)",desc:"The vampire makes two attacks, only one of which can be a bite attack.",attack_bonus:0},{name:"Unarmed Strike (Vampire Form Only)",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one creature. Hit: 8 (1d8 + 4) bludgeoning damage. Instead of dealing damage, the vampire can grapple the target (escape DC 18).",attack_bonus:9,damage_dice:"1d8",damage_bonus:4},{name:"Bite (Bat or Vampire Form Only)",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one willing creature, or a creature that is grappled by the vampire, incapacitated, or restrained. Hit: 7 (1d6 + 4) piercing damage plus 10 (3d6) necrotic damage. The target's hit point maximum is reduced by an amount equal to the necrotic damage taken, and the vampire regains hit points equal to that amount. The reduction lasts until the target finishes a long rest. The target dies if this effect reduces its hit point maximum to 0. A humanoid slain in this way and then buried in the ground rises the following night as a vampire spawn under the vampire's control.",attack_bonus:9,damage_dice:"1d6 + 3d6",damage_bonus:4},{name:"Charm",desc:`The vampire targets one humanoid it can see within 30 ft. of it. If the target can see the vampire, the target must succeed on a DC 17 Wisdom saving throw against this magic or be charmed by the vampire. The charmed target regards the vampire as a trusted friend to be heeded and protected. Although the target isn't under the vampire's control, it takes the vampire's requests or actions in the most favorable way it can, and it is a willing target for the vampire's bit attack.
Each time the vampire or the vampire's companions do anything harmful to the target, it can repeat the saving throw, ending the effect on itself on a success. Otherwise, the effect lasts 24 hours or until the vampire is destroyed, is on a different plane of existence than the target, or takes a bonus action to end the effect.`,attack_bonus:0},{name:"Children of the Night (1/Day)",desc:"The vampire magically calls 2d4 swarms of bats or rats, provided that the sun isn't up. While outdoors, the vampire can call 3d6 wolves instead. The called creatures arrive in 1d4 rounds, acting as allies of the vampire and obeying its spoken commands. The beasts remain for 1 hour, until the vampire dies, or until the vampire dismisses them as a bonus action.",attack_bonus:0}],legendary_actions:[{name:"Move",desc:"The vampire moves up to its speed without provoking opportunity attacks.",attack_bonus:0},{name:"Unarmed Strike",desc:"The vampire makes one unarmed strike.",attack_bonus:0},{name:"Bite (Costs 2 Actions)",desc:"The vampire makes one bite attack.",attack_bonus:0}]},{name:"Vampire Spawn",source:"5e SRD",size:"Medium",type:"undead",subtype:"",alignment:"neutral evil",ac:15,hp:82,hit_dice:"11d8 + 32",speed:"30 ft.",stats:[16,16,16,11,10,12],saves:[{dexterity:6},{wisdom:3}],skillsaves:[{perception:3},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"necrotic; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 13",languages:"the languages it knew in life",cr:"5",bestiary:!0,traits:[{name:"Regeneration",desc:"The vampire regains 10 hit points at the start of its turn if it has at least 1 hit point and isn't in sunlight or running water. If the vampire takes radiant damage or damage from holy water, this trait doesn't function at the start of the vampire's next turn.",attack_bonus:0},{name:"Spider Climb",desc:"The vampire can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0},{name:"Vampire Weaknesses",desc:`The vampire has the following flaws:
Forbiddance. The vampire can't enter a residence without an invitation from one of the occupants.
Harmed by Running Water. The vampire takes 20 acid damage when it ends its turn in running water.
Stake to the Heart. The vampire is destroyed if a piercing weapon made of wood is driven into its heart while it is incapacitated in its resting place.
Sunlight Hypersensitivity. The vampire takes 20 radiant damage when it starts its turn in sunlight. While in sunlight, it has disadvantage on attack rolls and ability checks.`,attack_bonus:0}],actions:[{name:"Multiattack",desc:"The vampire makes two attacks, only one of which can be a bite attack.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one willing creature, or a creature that is grappled by the vampire, incapacitated, or restrained. Hit: 6 (1d6 + 3) piercing damage plus 7 (2d6) necrotic damage. The target's hit point maximum is reduced by an amount equal to the necrotic damage taken, and the vampire regains hit points equal to that amount. The reduction lasts until the target finishes a long rest. The target dies if this effect reduces its hit point maximum to 0.",attack_bonus:61},{name:"Claws",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one creature. Hit: 8 (2d4 + 3) slashing damage. Instead of dealing damage, the vampire can grapple the target (escape DC 13).",attack_bonus:6,damage_dice:"2d4",damage_bonus:3}]},{name:"Veteran",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:17,hp:58,hit_dice:"9d8 + 17",speed:"30 ft.",stats:[16,13,14,10,11,10],skillsaves:[{athletics:5},{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 12",languages:"any one language (usually Common)",cr:"3",bestiary:!0,actions:[{name:"Multiattack",desc:"The veteran makes two longsword attacks. If it has a shortsword drawn, it can also make a shortsword attack.",attack_bonus:0},{name:"Longsword",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) slashing damage, or 8 (1d10 + 3) slashing damage if used with two hands.",attack_bonus:5,damage_dice:"1d8",damage_bonus:3},{name:"Shortsword",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Heavy Crossbow",desc:"Ranged Weapon Attack: +3 to hit, range 100/400 ft., one target. Hit: 6 (1d10 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d10",damage_bonus:1}]},{name:"Violet Fungus",source:"5e SRD",size:"Medium",type:"plant",subtype:"",alignment:"unaligned",ac:5,hp:18,hit_dice:"4d8",speed:"5 ft.",stats:[3,1,10,1,3,1],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"blinded, deafened, frightened",senses:"blindsight 30 ft. (blind beyond this radius), passive Perception 6",languages:"",cr:"1/4",bestiary:!0,traits:[{name:"False Appearance",desc:"While the violet fungus remains motionless, it is indistinguishable from an ordinary fungus.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The fungus makes 1d4 Rotting Touch attacks.",attack_bonus:0},{name:"Rotting Touch",desc:"Melee Weapon Attack: +2 to hit, reach 10 ft., one creature. Hit: 4 (1d8) necrotic damage.",attack_bonus:2,damage_dice:"1d8"}]},{name:"Vrock",source:"5e SRD",size:"Large",type:"fiend",subtype:"demon",alignment:"chaotic evil",ac:15,hp:104,hit_dice:"11d10 + 43",speed:"40 ft., fly 60 ft.",stats:[17,15,18,8,13,8],saves:[{dexterity:5},{wisdom:4},{charisma:2}],damage_vulnerabilities:"",damage_resistances:"cold, fire, lightning; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"poisoned",senses:"darkvision 120 ft., passive Perception 11",languages:"Abyssal, telepathy 120 ft.",cr:"6",bestiary:!0,traits:[{name:"Magic Resistance",desc:"The vrock has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The vrock makes two attacks: one with its beak and one with its talons.",attack_bonus:0},{name:"Beak",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) piercing damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:3},{name:"Talons",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 14 (2d10 + 3) slashing damage.",attack_bonus:6,damage_dice:"2d10",damage_bonus:3},{name:"Spores (Recharge 6)",desc:"A 15-foot-radius cloud of toxic spores extends out from the vrock. The spores spread around corners. Each creature in that area must succeed on a DC 14 Constitution saving throw or become poisoned. While poisoned in this way, a target takes 5 (1d10) poison damage at the start of each of its turns. A target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. Emptying a vial of holy water on the target also ends the effect on it.",attack_bonus:0},{name:"Stunning Screech (1/Day)",desc:"The vrock emits a horrific screech. Each creature within 20 feet of it that can hear it and that isn't a demon must succeed on a DC 14 Constitution saving throw or be stunned until the end of the vrock's next turn .",attack_bonus:0},{name:"Variant: Summon Demon (1/Day)",desc:`The demon chooses what to summon and attempts a magical summoning.
A vrock has a 30 percent chance of summoning 2d4 dretches or one vrock.
A summoned demon appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other demons. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.`,attack_bonus:0}]},{name:"Vulture",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:5,hit_dice:"1d8",speed:"10 ft., fly 50 ft.",stats:[7,10,13,2,12,4],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"0",bestiary:!0,traits:[{name:"Keen Sight and Smell",desc:"The vulture has advantage on Wisdom (Perception) checks that rely on sight or smell.",attack_bonus:0},{name:"Pack Tactics",desc:"The vulture has advantage on an attack roll against a creature if at least one of the vulture's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Beak",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 2 (1d4) piercing damage.",attack_bonus:2,damage_dice:"1d4"}]},{name:"Warhorse",source:"5e SRD",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:19,hit_dice:"3d10 + 2",speed:"60 ft.",stats:[18,12,13,2,12,7],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 11",languages:"",cr:"1/2",bestiary:!0,traits:[{name:"Trampling Charge",desc:"If the horse moves at least 20 ft. straight toward a creature and then hits it with a hooves attack on the same turn, that target must succeed on a DC 14 Strength saving throw or be knocked prone. If the target is prone, the horse can make another attack with its hooves against it as a bonus action.",attack_bonus:0}],actions:[{name:"Hooves",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4}]},{name:"Warhorse Skeleton",source:"5e SRD",size:"Large",type:"undead",subtype:"",alignment:"lawful evil",ac:13,hp:22,hit_dice:"3d10 + 5",speed:"60 ft.",stats:[18,12,15,2,8,5],damage_vulnerabilities:"bludgeoning",damage_resistances:"",damage_immunities:"poison",condition_immunities:"exhaustion, poisoned",senses:"darkvision 60 ft., passive Perception 9",languages:"",cr:"1/2",bestiary:!0,actions:[{name:"Hooves",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4}]},{name:"Water Elemental",source:"5e SRD",size:"Large",type:"elemental",subtype:"",alignment:"neutral",ac:14,hp:114,hit_dice:"12d10 + 48",speed:"30 ft., swim 90 ft.",stats:[18,14,18,5,10,8],damage_vulnerabilities:"",damage_resistances:"acid; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"exhaustion, grappled, paralyzed, petrified, poisoned, prone, restrained, unconscious",senses:"darkvision 60 ft., passive Perception 10",languages:"Aquan",cr:"5",bestiary:!0,traits:[{name:"Water Form",desc:"The elemental can enter a hostile creature's space and stop there. It can move through a space as narrow as 1 inch wide without squeezing.",attack_bonus:0},{name:"Freeze",desc:"If the elemental takes cold damage, it partially freezes; its speed is reduced by 20 ft. until the end of its next turn.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The elemental makes two slam attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) bludgeoning damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:4},{name:"Whelm (Recharge 4-6)",desc:`Each creature in the elemental's space must make a DC 15 Strength saving throw. On a failure, a target takes 13 (2d8 + 4) bludgeoning damage. If it is Large or smaller, it is also grappled (escape DC 14). Until this grapple ends, the target is restrained and unable to breathe unless it can breathe water. If the saving throw is successful, the target is pushed out of the elemental's space.
The elemental can grapple one Large creature or up to two Medium or smaller creatures at one time. At the start of each of the elemental's turns, each target grappled by it takes 13 (2d8 + 4) bludgeoning damage. A creature within 5 feet of the elemental can pull a creature or object out of it by taking an action to make a DC 14 Strength and succeeding.`,attack_bonus:0}]},{name:"Weasel",source:"5e SRD",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:1,hit_dice:"1d4 + -2",speed:"30 ft.",stats:[3,16,8,2,12,3],skillsaves:[{perception:3},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"0",bestiary:!0,traits:[{name:"Keen Hearing and Smell",desc:"The weasel has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one creature. Hit: 1 piercing damage.",attack_bonus:5,damage_bonus:1}]},{name:"Werebear",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"human",alignment:"neutral good",ac:10,hp:135,hit_dice:"18d8 + 54",speed:"30 ft. (40 ft., climb 30 ft. in bear or hybrid form)",stats:[19,10,17,11,12,12],skillsaves:[{perception:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"bludgeoning, piercing, and slashing damage from nonmagical weapons that aren't silvered",condition_immunities:"",senses:"passive Perception 17",languages:"Common (can't speak in bear form)",cr:"5",bestiary:!0,traits:[{name:"Shapechanger",desc:"The werebear can use its action to polymorph into a Large bear-humanoid hybrid or into a Large bear, or back into its true form, which is humanoid. Its statistics, other than its size and AC, are the same in each form. Any equipment it. is wearing or carrying isn't transformed. It reverts to its true form if it dies.",attack_bonus:0},{name:"Keen Smell",desc:"The werebear has advantage on WisGlom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"In bear form, the werebear makes two claw attacks. In humanoid form, it makes two greataxe attacks. In hybrid form, it can attack like a bear or a humanoid.",attack_bonus:0},{name:"Bite (Bear or Hybrid Form Only)",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 15 (2d10 + 4) piercing damage. If the target is a humanoid, it must succeed on a DC 14 Constitution saving throw or be cursed with were bear lycanthropy.",attack_bonus:7,damage_dice:"2d10",damage_bonus:4},{name:"Claw (Bear or Hybrid Form Only)",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:4},{name:"Greataxe (Humanoid or Hybrid Form Only)",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 10 (1d12 + 4) slashing damage.",attack_bonus:7,damage_dice:"1d12",damage_bonus:4}]},{name:"Wereboar",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"human",alignment:"neutral evil",ac:10,hp:78,hit_dice:"12d8 + 24",speed:"30 ft. (40 ft. in boar form)",stats:[17,10,15,10,11,8],skillsaves:[{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"bludgeoning, piercing, and slashing damage from nonmagical weapons that aren't silvered",condition_immunities:"",senses:"passive Perception 12",languages:"Common (can't speak in boar form)",cr:"4",bestiary:!0,traits:[{name:"Shapechanger",desc:"The wereboar can use its action to polymorph into a boar-humanoid hybrid or into a boar, or back into its true form, which is humanoid. Its statistics, other than its AC, are the same in each form. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",attack_bonus:0},{name:"Charge (Boar or Hybrid Form Only)",desc:"If the wereboar moves at least 15 feet straight toward a target and then hits it with its tusks on the same turn, the target takes an extra 7 (2d6) slashing damage. If the target is a creature, it must succeed on a DC 13 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"2d6"},{name:"Relentless (Recharges after a Short or Long Rest)",desc:"If the wereboar takes 14 damage or less that would reduce it to 0 hit points, it is reduced to 1 hit point instead.",attack_bonus:0}],actions:[{name:"Multiattack (Humanoid or Hybrid Form Only)",desc:"The wereboar makes two attacks, only one of which can be with its tusks.",attack_bonus:0},{name:"Maul (Humanoid or Hybrid Form Only)",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) bludgeoning damage.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3},{name:"Tusks (Boar or Hybrid Form Only)",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage. If the target is a humanoid, it must succeed on a DC 12 Constitution saving throw or be cursed with wereboar lycanthropy.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3}]},{name:"Wererat",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"human",alignment:"lawful evil",ac:12,hp:33,hit_dice:"6d8 + 6",speed:"30 ft.",stats:[10,15,12,11,10,8],skillsaves:[{perception:2},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"bludgeoning, piercing, and slashing damage from nonmagical weapons that aren't silvered",condition_immunities:"",senses:"darkvision 60 ft. (rat form only), passive Perception 12",languages:"Common (can't speak in rat form)",cr:"2",bestiary:!0,traits:[{name:"Shapechanger",desc:"The wererat can use its action to polymorph into a rat-humanoid hybrid or into a giant rat, or back into its true form, which is humanoid. Its statistics, other than its size, are the same in each form. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",attack_bonus:0},{name:"Keen Smell",desc:"The wererat has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Multiattack (Humanoid or Hybrid Form Only)",desc:"The wererat makes two attacks, only one of which can be a bite.",attack_bonus:0},{name:"Bite (Rat or Hybrid Form Only).",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) piercing damage. If the target is a humanoid, it must succeed on a DC 11 Constitution saving throw or be cursed with wererat lycanthropy.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2},{name:"Shortsword (Humanoid or Hybrid Form Only)",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Hand Crossbow (Humanoid or Hybrid Form Only)",desc:"Ranged Weapon Attack: +4 to hit, range 30/120 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Weretiger",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"human",alignment:"neutral",ac:12,hp:120,hit_dice:"16d8 + 48",speed:"30 ft. (40 ft. in tiger form)",stats:[17,15,16,10,13,11],skillsaves:[{perception:5},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"bludgeoning, piercing, and slashing damage from nonmagical weapons that aren't silvered",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 15",languages:"Common (can't speak in tiger form)",cr:"4",bestiary:!0,traits:[{name:"Shapechanger",desc:"The weretiger can use its action to polymorph into a tiger-humanoid hybrid or into a tiger, or back into its true form, which is humanoid. Its statistics, other than its size, are the same in each form. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",attack_bonus:0},{name:"Keen Hearing and Smell",desc:"The weretiger has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0},{name:"Pounce (Tiger or Hybrid Form Only)",desc:"If the weretiger moves at least 15 feet straight toward a creature and then hits it with a claw attack on the same turn, that target must succeed on a DC 14 Strength saving throw or be knocked prone. If the target is prone, the weretiger can make one bite attack against it as a bonus action.",attack_bonus:0}],actions:[{name:"Multiattack (Humanoid or Hybrid Form Only)",desc:"In humanoid form, the weretiger makes two scimitar attacks or two longbow attacks. In hybrid form, it can attack like a humanoid or make two claw attacks.",attack_bonus:0},{name:"Bite (Tiger or Hybrid Form Only)",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (1d10 + 3) piercing damage. If the target is a humanoid, it must succeed on a DC 13 Constitution saving throw or be cursed with weretiger lycanthropy.",attack_bonus:5,damage_dice:"1d10",damage_bonus:3},{name:"Claw (Tiger or Hybrid Form Only)",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) slashing damage.",attack_bonus:5,damage_dice:"1d8",damage_bonus:3},{name:"Scimitar (Humanoid or Hybrid Form Only)",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Longbow (Humanoid or Hybrid Form Only)",desc:"Ranged Weapon Attack: +4 to hit, range 150/600 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2}]},{name:"Werewolf",source:"5e SRD",size:"Medium",type:"humanoid",subtype:"human",alignment:"chaotic evil",ac:11,hp:58,hit_dice:"9d8 + 17",speed:"30 ft. (40 ft. in wolf form)",stats:[15,13,14,10,11,10],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"bludgeoning, piercing, and slashing damage from nonmagical weapons that aren't silvered",condition_immunities:"",senses:"passive Perception 14",languages:"Common (can't speak in wolf form)",cr:"3",bestiary:!0,traits:[{name:"Shapechanger",desc:"The werewolf can use its action to polymorph into a wolf-humanoid hybrid or into a wolf, or back into its true form, which is humanoid. Its statistics, other than its AC, are the same in each form. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",attack_bonus:0},{name:"Keen Hearing and Smell",desc:"The werewolf has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0}],actions:[{name:"Multiattack (Humanoid or Hybrid Form Only)",desc:"The werewolf makes two attacks: one with its bite and one with its claws or spear.",attack_bonus:0},{name:"Bite (Wolf or Hybrid Form Only)",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) piercing damage. If the target is a humanoid, it must succeed on a DC 12 Constitution saving throw or be cursed with werewolf lycanthropy.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2},{name:"Claws (Hybrid Form Only)",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 7 (2d4 + 2) slashing damage.",attack_bonus:4,damage_dice:"2d4",damage_bonus:2},{name:"Spear (Humanoid Form Only)",desc:"Melee or Ranged Weapon Attack: +4 to hit, reach 5 ft. or range 20/60 ft., one creature. Hit: 5 (1d6 + 2) piercing damage, or 6 (1d8 + 2) piercing damage if used with two hands to make a melee attack.",attack_bonus:4,damage_dice:"1d6",damage_bonus:-2}]},{name:"White Dragon Wyrmling",source:"5e SRD",size:"Medium",type:"dragon",subtype:"",alignment:"chaotic evil",ac:16,hp:32,hit_dice:"5d8 + 9",speed:"30 ft., burrow 15 ft., fly 60 ft., swim 30 ft.",stats:[14,10,14,5,10,11],saves:[{dexterity:2},{constitution:4},{wisdom:2},{charisma:2}],skillsaves:[{perception:4},{stealth:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"2",bestiary:!0,actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (1d10 + 2) piercing damage plus 2 (1d4) cold damage.",attack_bonus:4,damage_dice:"1d10 + 1d4",damage_bonus:2},{name:"Cold Breath (Recharge 5-6)",desc:"The dragon exhales an icy blast of hail in a 15-foot cone. Each creature in that area must make a DC 12 Constitution saving throw, taking 22 (5d8) cold damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"5d8"}]},{name:"Wight",source:"5e SRD",size:"Medium",type:"undead",subtype:"",alignment:"neutral evil",ac:14,hp:45,hit_dice:"6d8 + 18",speed:"30 ft.",stats:[15,14,16,10,13,15],skillsaves:[{perception:3},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"necrotic; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 13",languages:"the languages it knew in life",cr:"3",bestiary:!0,traits:[{name:"Sunlight Sensitivity",desc:"While in sunlight, the wight has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The wight makes two longsword attacks or two longbow attacks. It can use its Life Drain in place of one longsword attack.",attack_bonus:0},{name:"Life Drain",desc:`Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 5 (1d6 + 2) necrotic damage. The target must succeed on a DC 13 Constitution saving throw or its hit point maximum is reduced by an amount equal to the damage taken. This reduction lasts until the target finishes a long rest. The target dies if this effect reduces its hit point maximum to 0.
A humanoid slain by this attack rises 24 hours later as a zombie under the wight's control, unless the humanoid is restored to life or its body is destroyed. The wight can have no more than twelve zombies under its control at one time.`,attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Longsword",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) slashing damage, or 7 (1d10 + 2) slashing damage if used with two hands.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2},{name:"Longbow",desc:"Ranged Weapon Attack: +4 to hit, range 150/600 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2}]},{name:"Will-o'-Wisp",source:"5e SRD",size:"Tiny",type:"undead",subtype:"",alignment:"chaotic evil",ac:19,hp:22,hit_dice:"9d4 + -1",speed:"0 ft., fly 50 ft. (hover)",stats:[1,28,10,13,14,11],damage_vulnerabilities:"",damage_resistances:"acid, cold, fire, necrotic, thunder; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"lightning, poison",condition_immunities:"exhaustion, grappled, paralyzed, poisoned, prone, restrained, unconscious",senses:"darkvision 120 ft., passive Perception 12",languages:"the languages it knew in life",cr:"2",bestiary:!0,traits:[{name:"Consume Life",desc:"As a bonus action, the will-o'-wisp can target one creature it can see within 5 ft. of it that has 0 hit points and is still alive. The target must succeed on a DC 10 Constitution saving throw against this magic or die. If the target dies, the will-o'-wisp regains 10 (3d6) hit points.",attack_bonus:0},{name:"Ephemeral",desc:"The will-o'-wisp can't wear or carry anything.",attack_bonus:0},{name:"Incorporeal Movement",desc:"The will-o'-wisp can move through other creatures and objects as if they were difficult terrain. It takes 5 (1d10) force damage if it ends its turn inside an object.",attack_bonus:0},{name:"Variable Illumination",desc:"The will-o'-wisp sheds bright light in a 5- to 20-foot radius and dim light for an additional number of ft. equal to the chosen radius. The will-o'-wisp can alter the radius as a bonus action.",attack_bonus:0}],actions:[{name:"Shock",desc:"Melee Spell Attack: +4 to hit, reach 5 ft., one creature. Hit: 9 (2d8) lightning damage.",attack_bonus:4,damage_dice:"2d8"},{name:"Invisibility",desc:"The will-o'-wisp and its light magically become invisible until it attacks or uses its Consume Life, or until its concentration ends (as if concentrating on a spell).",attack_bonus:0}]},{name:"Winter Wolf",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"neutral evil",ac:13,hp:75,hit_dice:"10d10 + 20",speed:"50 ft.",stats:[18,13,14,7,12,8],skillsaves:[{perception:5},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"passive Perception 15",languages:"Common, Giant, Winter Wolf",cr:"3",bestiary:!0,traits:[{name:"Keen Hearing and Smell",desc:"The wolf has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0},{name:"Pack Tactics",desc:"The wolf has advantage on an attack roll against a creature if at least one of the wolf's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0},{name:"Snow Camouflage",desc:"The wolf has advantage on Dexterity (Stealth) checks made to hide in snowy terrain.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) piercing damage. If the target is a creature, it must succeed on a DC 14 Strength saving throw or be knocked prone.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4},{name:"Cold Breath (Recharge 5-6)",desc:"The wolf exhales a blast of freezing wind in a 15-foot cone. Each creature in that area must make a DC 12 Dexterity saving throw, taking 18 (4d8) cold damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"4d8"}]},{name:"Wolf",source:"5e SRD",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:11,hit_dice:"2d8 + 2",speed:"40 ft.",stats:[12,15,12,3,12,6],skillsaves:[{perception:3},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"1/4",bestiary:!0,traits:[{name:"Keen Hearing and Smell",desc:"The wolf has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0},{name:"Pack Tactics",desc:"The wolf has advantage on an attack roll against a creature if at least one of the wolf's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) piercing damage. If the target is a creature, it must succeed on a DC 11 Strength saving throw or be knocked prone.",attack_bonus:4,damage_dice:"2d4",damage_bonus:2}]},{name:"Worg",source:"5e SRD",size:"Large",type:"monstrosity",subtype:"",alignment:"neutral evil",ac:13,hp:26,hit_dice:"4d10 + 4",speed:"50 ft.",stats:[16,13,13,7,11,8],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"Goblin, Worg",cr:"1/2",bestiary:!0,traits:[{name:"Keen Hearing and Smell",desc:"The worg has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) piercing damage. If the target is a creature, it must succeed on a DC 13 Strength saving throw or be knocked prone.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3}]},{name:"Wraith",source:"5e SRD",size:"Medium",type:"undead",subtype:"",alignment:"neutral evil",ac:13,hp:67,hit_dice:"9d8 + 26",speed:"0 ft., fly 60 ft. (hover)",stats:[6,16,16,12,14,15],damage_vulnerabilities:"",damage_resistances:"acid, cold, fire, lightning, thunder; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"necrotic, poison",condition_immunities:"charmed, exhaustion, grappled, paralyzed, petrified, poisoned, prone, restrained",senses:"darkvision 60 ft., passive Perception 12",languages:"the languages it knew in life",cr:"5",bestiary:!0,traits:[{name:"Incorporeal Movement",desc:"The wraith can move through other creatures and objects as if they were difficult terrain. It takes 5 (1d10) force damage if it ends its turn inside an object.",attack_bonus:0},{name:"Sunlight Sensitivity",desc:"While in sunlight, the wraith has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Life Drain",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one creature. Hit: 21 (4d8 + 3) necrotic damage. The target must succeed on a DC 14 Constitution saving throw or its hit point maximum is reduced by an amount equal to the damage taken. This reduction lasts until the target finishes a long rest. The target dies if this effect reduces its hit point maximum to 0.",attack_bonus:6,damage_dice:"4d8",damage_bonus:3},{name:"Create Specter",desc:"The wraith targets a humanoid within 10 feet of it that has been dead for no longer than 1 minute and died violently. The target's spirit rises as a specter in the space of its corpse or in the nearest unoccupied space. The specter is under the wraith's control. The wraith can have no more than seven specters under its control at one time.",attack_bonus:0}]},{name:"Wyvern",source:"5e SRD",size:"Large",type:"dragon",subtype:"",alignment:"unaligned",ac:13,hp:110,hit_dice:"13d10 + 38",speed:"20 ft., fly 80 ft.",stats:[19,10,16,5,12,6],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"",cr:"6",bestiary:!0,actions:[{name:"Multiattack",desc:"The wyvern makes two attacks: one with its bite and one with its stinger. While flying, it can use its claws in place of one other attack.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one creature. Hit: 11 (2d6 + 4) piercing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Claws",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:4},{name:"Stinger",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one creature. Hit: 11 (2d6 + 4) piercing damage. The target must make a DC 15 Constitution saving throw, taking 24 (7d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4}]},{name:"Xorn",source:"5e SRD",size:"Medium",type:"elemental",subtype:"",alignment:"neutral",ac:19,hp:73,hit_dice:"7d8 + 41",speed:"20 ft., burrow 20 ft.",stats:[17,10,22,11,10,11],skillsaves:[{perception:6},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"piercing and slashing from nonmagical weapons that aren't adamantine",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., tremorsense 60 ft., passive Perception 16",languages:"Terran",cr:"5",bestiary:!0,traits:[{name:"Earth Glide",desc:"The xorn can burrow through nonmagical, unworked earth and stone. While doing so, the xorn doesn't disturb the material it moves through.",attack_bonus:0},{name:"Stone Camouflage",desc:"The xorn has advantage on Dexterity (Stealth) checks made to hide in rocky terrain.",attack_bonus:0},{name:"Treasure Sense",desc:"The xorn can pinpoint, by scent, the location of precious metals and stones, such as coins and gems, within 60 ft. of it.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The xorn makes three claw attacks and one bite attack.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (3d6 + 3) piercing damage.",attack_bonus:6,damage_dice:"3d6",damage_bonus:3},{name:"Claw",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) slashing damage.",attack_bonus:6,damage_dice:"1d6",damage_bonus:3}]},{name:"Young Black Dragon",source:"5e SRD",size:"Large",type:"dragon",subtype:"",alignment:"chaotic evil",ac:18,hp:127,hit_dice:"15d10 + 44",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[19,14,17,12,11,15],saves:[{dexterity:5},{constitution:6},{wisdom:3},{charisma:5}],skillsaves:[{perception:6},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid",condition_immunities:"",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 16",languages:"Common, Draconic",cr:"7",bestiary:!0,traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 15 (2d10 + 4) piercing damage plus 4 (1d8) acid damage.",attack_bonus:7,damage_dice:"2d10 + 1d8",damage_bonus:4},{name:"Claw",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Acid Breath (Recharge 5-6)",desc:"The dragon exhales acid in a 30-foot line that is 5 feet wide. Each creature in that line must make a DC 14 Dexterity saving throw, taking 49 (11d8) acid damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"11d8"}]},{name:"Young Blue Dragon",source:"5e SRD",size:"Large",type:"dragon",subtype:"",alignment:"lawful evil",ac:18,hp:152,hit_dice:"16d10 + 64",speed:"40 ft., burrow 40 ft., fly 80 ft.",stats:[21,10,19,14,13,17],saves:[{dexterity:4},{constitution:8},{wisdom:5},{charisma:7}],skillsaves:[{perception:9},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning",condition_immunities:"",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 19",languages:"Common, Draconic",cr:"9",bestiary:!0,actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 16 (2d10 + 5) piercing damage plus 5 (1d10) lightning damage.",attack_bonus:9,damage_dice:"2d10 + 1d10",damage_bonus:5},{name:"Claw",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) slashing damage.",attack_bonus:9,damage_dice:"2d6",damage_bonus:5},{name:"Lightning Breath (Recharge 5-6)",desc:"The dragon exhales lightning in an 60-foot line that is 5 feet wide. Each creature in that line must make a DC 16 Dexterity saving throw, taking 55 (10d10) lightning damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"10d10"}]},{name:"Young Brass Dragon",source:"5e SRD",size:"Large",type:"dragon",subtype:"",alignment:"chaotic good",ac:17,hp:110,hit_dice:"13d10 + 38",speed:"40 ft., burrow 20 ft., fly 80 ft.",stats:[19,10,17,12,11,15],saves:[{dexterity:3},{constitution:6},{wisdom:3},{charisma:5}],skillsaves:[{perception:6},{persuasion:5},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 16",languages:"Common, Draconic",cr:"6",bestiary:!0,actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 15 (2d10 + 4) piercing damage.",attack_bonus:7,damage_dice:"2d10",damage_bonus:4},{name:"Claw",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Fire Breath. The dragon exhales fire in a 40-foot line that is 5 feet wide. Each creature in that line must make a DC 14 Dexterity saving throw, taking 42 (12d6) fire damage on a failed save, or half as much damage on a successful one.
Sleep Breath. The dragon exhales sleep gas in a 30-foot cone. Each creature in that area must succeed on a DC 14 Constitution saving throw or fall unconscious for 5 minutes. This effect ends for a creature if the creature takes damage or someone uses an action to wake it.`,attack_bonus:0,damage_dice:"12d6"}]},{name:"Young Bronze Dragon",source:"5e SRD",size:"Large",type:"dragon",subtype:"",alignment:"lawful good",ac:18,hp:142,hit_dice:"15d10 + 59",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[21,10,19,14,13,17],saves:[{dexterity:3},{constitution:7},{wisdom:4},{charisma:6}],skillsaves:[{insight:4},{perception:7},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning",condition_immunities:"",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 17",languages:"Common, Draconic",cr:"8",bestiary:!0,traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 16 (2d10 + 5) piercing damage.",attack_bonus:8,damage_dice:"2d10",damage_bonus:5},{name:"Claw",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) slashing damage.",attack_bonus:8,damage_dice:"2d6",damage_bonus:5},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Lightning Breath. The dragon exhales lightning in a 60-foot line that is 5 feet wide. Each creature in that line must make a DC 15 Dexterity saving throw, taking 55 (10d10) lightning damage on a failed save, or half as much damage on a successful one.
Repulsion Breath. The dragon exhales repulsion energy in a 30-foot cone. Each creature in that area must succeed on a DC 15 Strength saving throw. On a failed save, the creature is pushed 40 feet away from the dragon.`,attack_bonus:0,damage_dice:"10d10"}]},{name:"Young Copper Dragon",source:"5e SRD",size:"Large",type:"dragon",subtype:"",alignment:"chaotic good",ac:17,hp:119,hit_dice:"14d10 + 42",speed:"40 ft., climb 40 ft., fly 80 ft.",stats:[19,12,17,16,13,15],saves:[{dexterity:4},{constitution:6},{wisdom:4},{charisma:5}],skillsaves:[{deception:5},{perception:7},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid",condition_immunities:"",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 17",languages:"Common, Draconic",cr:"7",bestiary:!0,actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 15 (2d10 + 4) piercing damage.",attack_bonus:7,damage_dice:"2d10",damage_bonus:4},{name:"Claw",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Acid Breath. The dragon exhales acid in an 40-foot line that is 5 feet wide. Each creature in that line must make a DC 14 Dexterity saving throw, taking 40 (9d8) acid damage on a failed save, or half as much damage on a successful one.
Slowing Breath. The dragon exhales gas in a 30-foot cone. Each creature in that area must succeed on a DC 14 Constitution saving throw. On a failed save, the creature can't use reactions, its speed is halved, and it can't make more than one attack on its turn. In addition, the creature can use either an action or a bonus action on its turn, but not both. These effects last for 1 minute. The creature can repeat the saving throw at the end of each of its turns, ending the effect on itself with a successful save.`,attack_bonus:0,damage_dice:"9d8"}]},{name:"Young Gold Dragon",source:"5e SRD",size:"Large",type:"dragon",subtype:"",alignment:"lawful good",ac:18,hp:178,hit_dice:"17d10 + 84",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[23,14,21,16,13,20],saves:[{dexterity:6},{constitution:9},{wisdom:5},{charisma:9}],skillsaves:[{insight:5},{perception:9},{persuasion:9},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 19",languages:"Common, Draconic",cr:"10",bestiary:!0,traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage.",attack_bonus:10,damage_dice:"2d10",damage_bonus:6},{name:"Claw",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",attack_bonus:10,damage_dice:"2d6",damage_bonus:6},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Fire Breath. The dragon exhales fire in a 30-foot cone. Each creature in that area must make a DC 17 Dexterity saving throw, taking 55 (10d10) fire damage on a failed save, or half as much damage on a successful one.
Weakening Breath. The dragon exhales gas in a 30-foot cone. Each creature in that area must succeed on a DC 17 Strength saving throw or have disadvantage on Strength-based attack rolls, Strength checks, and Strength saving throws for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.`,attack_bonus:0,damage_dice:"10d10"}]},{name:"Young Green Dragon",source:"5e SRD",size:"Large",type:"dragon",subtype:"",alignment:"lawful evil",ac:18,hp:136,hit_dice:"16d10 + 48",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[19,12,17,16,13,15],saves:[{dexterity:4},{constitution:6},{wisdom:4},{charisma:5}],skillsaves:[{deception:5},{perception:7},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"poisoned",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 17",languages:"Common, Draconic",cr:"8",bestiary:!0,traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 15 (2d10 + 4) piercing damage plus 7 (2d6) poison damage.",attack_bonus:7,damage_dice:"2d10 + 2d6",damage_bonus:4},{name:"Claw",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Poison Breath (Recharge 5-6)",desc:"The dragon exhales poisonous gas in a 30-foot cone. Each creature in that area must make a DC 14 Constitution saving throw, taking 42 (12d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"12d6"}]},{name:"Young Red Dragon",source:"5e SRD",size:"Large",type:"dragon",subtype:"",alignment:"chaotic evil",ac:18,hp:178,hit_dice:"17d10 + 84",speed:"40 ft., climb 40 ft., fly 80 ft.",stats:[23,10,21,14,11,19],saves:[{dexterity:4},{constitution:9},{wisdom:4},{charisma:8}],skillsaves:[{perception:8},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 18",languages:"Common, Draconic",cr:"10",bestiary:!0,actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage plus 3 (1d6) fire damage.",attack_bonus:10,damage_dice:"2d10 + 1d6",damage_bonus:6},{name:"Claw",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",attack_bonus:10,damage_dice:"2d6",damage_bonus:6},{name:"Fire Breath (Recharge 5-6)",desc:"The dragon exhales fire in a 30-foot cone. Each creature in that area must make a DC 17 Dexterity saving throw, taking 56 (16d6) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"16d6"}]},{name:"Young Silver Dragon",source:"5e SRD",size:"Large",type:"dragon",subtype:"",alignment:"lawful good",ac:18,hp:168,hit_dice:"16d10 + 80",speed:"40 ft., fly 80 ft.",stats:[23,10,21,14,11,19],saves:[{dexterity:4},{constitution:9},{wisdom:4},{charisma:8}],skillsaves:[{arcana:6},{history:6},{perception:8},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 18",languages:"Common, Draconic",cr:"9",bestiary:!0,actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage.",attack_bonus:10,damage_dice:"2d10",damage_bonus:6},{name:"Claw",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",attack_bonus:10,damage_dice:"2d6",damage_bonus:6},{name:"Breath Weapons (Recharge 5-6)",desc:`The dragon uses one of the following breath weapons.
Cold Breath. The dragon exhales an icy blast in a 30-foot cone. Each creature in that area must make a DC 17 Constitution saving throw, taking 54 (12d8) cold damage on a failed save, or half as much damage on a successful one.
Paralyzing Breath. The dragon exhales paralyzing gas in a 30-foot cone. Each creature in that area must succeed on a DC 17 Constitution saving throw or be paralyzed for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.`,attack_bonus:0,damage_dice:"12d8"}]},{name:"Young White Dragon",source:"5e SRD",size:"Large",type:"dragon",subtype:"",alignment:"chaotic evil",ac:17,hp:133,hit_dice:"14d10 + 56",speed:"40 ft., burrow 20 ft., fly 80 ft., swim 40 ft.",stats:[18,10,18,6,11,12],saves:[{dexterity:3},{constitution:7},{wisdom:3},{charisma:4}],skillsaves:[{perception:6},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 16",languages:"Common, Draconic",cr:"6",bestiary:!0,traits:[{name:"Ice Walk",desc:"The dragon can move across and climb icy surfaces without needing to make an ability check. Additionally, difficult terrain composed of ice or snow doesn't cost it extra moment.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 15 (2d10 + 4) piercing damage plus 4 (1d8) cold damage.",attack_bonus:7,damage_dice:"2d10 + 1d8",damage_bonus:4},{name:"Claw",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Cold Breath (Recharge 5-6)",desc:"The dragon exhales an icy blast in a 30-foot cone. Each creature in that area must make a DC 15 Constitution saving throw, taking 45 (10d8) cold damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"10d8"}]},{name:"Zombie",source:"5e SRD",size:"Medium",type:"undead",subtype:"",alignment:"neutral evil",ac:8,hp:22,hit_dice:"3d8 + 8",speed:"20 ft.",stats:[13,6,16,3,6,5],saves:[{wisdom:0}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 8",languages:"understands all languages it spoke in life but can't speak",cr:"1/4",bestiary:!0,traits:[{name:"Undead Fortitude",desc:"If damage reduces the zombie to 0 hit points, it must make a Constitution saving throw with a DC of 5+the damage taken, unless the damage is radiant or from a critical hit. On a success, the zombie drops to 1 hit point instead.",attack_bonus:0}],actions:[{name:"Slam",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) bludgeoning damage.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]}],pa=new Map(k1.map(i=>[i.name,i]));var We,Lt,Ni,ba,li,tn,ya,_i,en,tt,va,Qo,ka,Io,Li,Wn,Eo=class{constructor(){Ee(this,_i);Ee(this,va);Ee(this,ka);Ee(this,Li);Ee(this,We,new Map);Ee(this,Lt,new Map);Ee(this,Ni,new Map);Ee(this,ba,!1);Ee(this,li,new Map);Ee(this,tn,new Map);Ee(this,ya,new Map);Ee(this,tt,void 0)}getSortedBy(e){return te(this,ya).get(e)??[]}onSortedBy(e,t){let n=te(this,tt).on(`fantasy-statblocks:bestiary:sorted:${e}`,a=>t(a));return()=>{te(this,tt).offref(n)}}registerSorter(e,t){te(this,tn).has(e)||te(this,tn).set(e,t),Qe(this,_i,en).call(this,e)}getIndices(){return te(this,li)}getIndex(e){return te(this,li).get(e)??new Map}registerIndex(e){te(this,li).has(e)||te(this,li).set(e,new Map)}onIndexUpdated(e,t){if(!te(this,li).has(e))return()=>{};let n=te(this,tt).on(`fantasy-statblocks:bestiary:indexed:${e}`,()=>t());return()=>{te(this,tt).offref(n)}}initialize(e){this.registerIndex("source"),this.registerSorter("name",(t,n)=>t.name.localeCompare(n.name)),ei(this,tt,e.app.workspace),wi.initialize(e).load(),e.addCommand({id:"parse-frontmatter",name:"Parse Frontmatter for Creatures",callback:()=>{wi.start(!0)}}),e.register(()=>wi.unload()),e.registerEvent(e.app.workspace.on("fantasy-statblocks:srd-change",t=>{this.enableSRD=t,t?ei(this,We,new Map([...pa,...te(this,We)])):ei(this,We,new Map([...te(this,Lt),...te(this,Ni)]))})),this.enableSRD=!e.settings.disableSRD,this.enableSRD&&ei(this,We,new Map(pa));for(let[,t]of e.settings.monsters)this.addLocalCreature(t)}hasLocal(e){return te(this,Lt).has(e)}getLocal(e){return te(this,Lt).get(e)}isLocal(e){return te(this,Lt).has(e)&&te(this,We).get(e)===te(this,Lt).get(e)}addLocalCreature(e){e.name&&(te(this,Lt).set(e.name,e),te(this,We).set(e.name,e),Qe(this,va,Qo).call(this,e),Qe(this,Li,Wn).call(this),Qe(this,_i,en).call(this))}removeLocalCreature(e){te(this,We).has(e)&&te(this,We).get(e)===te(this,Lt).get(e)&&te(this,We).delete(e),Qe(this,ka,Io).call(this,te(this,Lt).get(e)),te(this,Lt).delete(e),te(this,Ni).has(e)?te(this,We).set(e,te(this,Ni).get(e)):this.enableSRD&&pa.has(e)&&te(this,We).set(e,pa.get(e)),Qe(this,Li,Wn).call(this),Qe(this,_i,en).call(this)}addEphemeralCreature(e){e.name&&(te(this,Ni).set(e.name,e),te(this,We).set(e.name,e),te(this,tt).trigger("fantasy-statblocks:bestiary:creature-added",e),Qe(this,va,Qo).call(this,e),Qe(this,_i,en).call(this),Qe(this,Li,Wn).call(this))}removeEphemeralCreature(e){Qe(this,ka,Io).call(this,te(this,We).get(e)),te(this,We).delete(e),te(this,Ni).delete(e),Qe(this,Li,Wn).call(this),Qe(this,_i,en).call(this)}removeCreatures(...e){for(let t of e)this.isLocal(t)?this.removeLocalCreature(t):this.removeEphemeralCreature(t)}isResolved(){return te(this,ba)}setResolved(e){ei(this,ba,e),e&&(te(this,tt).trigger("fantasy-statblocks:bestiary:resolved"),Qe(this,Li,Wn).call(this),Qe(this,_i,en).call(this))}onResolved(e){let t;return this.isResolved()?e():t=te(this,tt).on("fantasy-statblocks:bestiary:resolved",()=>e()),()=>{t&&te(this,tt).offref(t)}}onUpdated(e){let t;return this.isResolved()?e():t=te(this,tt).on("fantasy-statblocks:bestiary:updated",()=>e()),()=>{t&&te(this,tt).offref(t)}}size(){return te(this,We).size}getBestiary(){return te(this,We)}getBestiaryCreatures(){return Array.from(te(this,We).values())}getBestiaryNames(){return Array.from(te(this,We).keys()).sort()}hasCreature(e){return te(this,We).has(e)}getExtensions(e,t){let n=[(0,od.default)(e)];if(!("extends"in e)||!(Array.isArray(e.extends)||typeof e.extends=="string"))return n;if(e.extends&&e.extends.length)for(let a of[e.extends].flat()){if(t.has(a)){console.info("Circular extend dependency detected in "+[...t]);continue}t.add(e.name);let s=te(this,We).get(a);s&&n.push(...this.getExtensions(s,t))}return n}getExtensionNames(e,t){let n=[e.name];if(!("extends"in e)||!(Array.isArray(e.extends)||typeof e.extends=="string"))return n;if(e.extends&&e.extends.length)for(let a of[e.extends].flat()){if(t.has(a)){console.info("Circular extend dependency detected in "+[...t]);continue}t.add(e.name);let s=te(this,We).get(a);s&&n.push(...this.getExtensionNames(s,t))}return n}async getCreatureFromBestiary(e){return new Promise(t=>{this.onResolved(()=>{this.hasCreature(e)||t(null);let n=te(this,We).get(e);t(Object.assign({},...this.getExtensions(n,new Set(n.name)),n))})})}getCreatureFromBestiarySync(e){if(!this.isResolved())throw new Error("The bestiary is not fully resolved.");if(!this.hasCreature(e))return null;let t=te(this,We).get(e);return Object.assign({},...this.getExtensions(t,new Set(t.name)),t)}get(e){return te(this,We).get(e)}};We=new WeakMap,Lt=new WeakMap,Ni=new WeakMap,ba=new WeakMap,li=new WeakMap,tn=new WeakMap,ya=new WeakMap,_i=new WeakSet,en=function(...e){this.isResolved()&&setTimeout(()=>{for(let t of e&&e.length?e:[...te(this,tn).keys()])te(this,ya).set(t,this.getBestiaryCreatures().sort((n,a)=>te(this,tn).get(t)(n,a))),te(this,tt).trigger(`fantasy-statblocks:bestiary:sorted:${t}`,this.getSortedBy(t))},0)},tt=new WeakMap,va=new WeakSet,Qo=function(e){setTimeout(()=>{for(let[t,n]of te(this,li))if(t in e){let a=[];if(Array.isArray(e[t]))for(let s of e[t])a.push(ye(s));else a.push(ye(e[t]));for(let s of a)n.has(s)?n.get(s).add(e.name):n.set(s,new Set([e.name]));te(this,tt).trigger(`fantasy-statblocks:bestiary:indexed:${t}`)}},0)},ka=new WeakSet,Io=function(e){setTimeout(()=>{for(let[t,n]of te(this,li))if(t in e){let a=ye(e[t]);n.has(a)&&n.get(a).delete(e.name),te(this,tt).trigger(`fantasy-statblocks:bestiary:indexed:${t}`)}},0)},Li=new WeakSet,Wn=function(){this.isResolved()&&te(this,tt).trigger("fantasy-statblocks:bestiary:updated")};var ve=new Eo;var cd=It(mi()),qt=class extends ld.MarkdownRenderChild{constructor(t,n=!0){super(t.container);this.rendererParameters=t;this.icons=n;this.loaded=!1;this.container=t.container,this.plugin=t.plugin,this.context=t.context??"",this.setCreature(t),this.setLayout(),this.init()}setLayout(){this.layout=this.rendererParameters.layout??this.plugin.manager.getAllLayouts().find(t=>t.name==(this.params.layout??this.monster.layout)||t.name==(this.params.statblock??this.monster.statblock))??this.plugin.manager.getDefaultLayout()}get canSave(){return"name"in this.params}async build(){let t=Object.assign({},this.monster??{},this.params??{});if(Object.values(t).length||(t=Object.assign({},t,{note:this.context})),t.note){let a=Array.isArray(t.note)?t.note.flat(1/0).pop():t.note,s=await this.plugin.app.metadataCache.getFirstLinkpathDest(`${a}`,this.context??"");if(s&&s instanceof wt.TFile){let r=(0,wt.getFrontMatterInfo)(await this.plugin.app.vault.cachedRead(s));r.exists&&Object.assign(t,(0,Ro.default)((0,wt.parseYaml)(ct.transformYamlSource(r.frontmatter))??{}),this.params)}}"image"in t&&Array.isArray(t.image)&&(t.image=t.image.flat(2).join(""));let n=ve.getExtensions(t,new Set);for(let a of n.reverse())t=Object.assign(t,a);t=Object.assign(t,this.monster??{},this.params??{});for(let a of this.unwrapBlocks(this.layout.blocks))if("properties"in a){for(let s of a.properties)if(!(!(s in t)&&!(`${s}+`in t)&&!(`${s}-`in t)))switch(a.type){case"traits":{let r=new Map,o=[],l=new Set;for(let d of n){let h=Oi(s,d);for(let u of h)r.set(u.name,u);h=Oi(`${s}+`,d);for(let u of h)o.push(u);h=Oi(`${s}-`,d);for(let u of h)l.add(u.name)}let c=Oi(s,t);for(let d of c)s in this.params?r.set(d.name,d):(r.delete(d.name),o.push(d));c=Oi(`${s}+`,t);for(let d of c)o.push(d);c=Oi(`${s}-`,t);for(let d of c)l.add(d.name);c=Oi(`${s}-`,this.params);for(let d of c)l.add(d.name);for(let d of l)r.delete(d),o=o.filter(h=>h.name!==d);c=Oi(s,this.params);for(let d of c)r.delete(d.name),o.push(d);c=Oi(`${s}+`,this.params);for(let d of c)o.push(d);Object.assign(t,{[s]:[...r.values(),...o]});break}case"saves":{let r=t[s]??[];s in t&&!Array.isArray(t[s])&&typeof t[s]=="object"&&(r=Object.entries(t[s]??{}).map(([l,c])=>({[l]:c}))),Object.assign(t,{[s]:r});let o=[];`${s}+`in t&&!Array.isArray(t[`${s}+`])&&typeof t[`${s}+`]=="object"&&(o=Object.entries(t[s]??{}).map(([l,c])=>({[l]:c}))),o.length&&Object.assign(t,{[s]:Xr(t[s],o)});break}default:if(`${s}+`in t&&s in t){let r=Xr(t[s],t[`${s}+`]);r&&Object.assign(t,{[s]:r})}}}return t=this.transformLinks(t),t}unwrapBlocks(t){let n=[];for(let a of t)switch(a.type){case"group":case"inline":case"collapse":{n.push(...this.unwrapBlocks(a.nested));break}case"layout":case"ifelse":case"javascript":continue;default:n.push(a);break}return n}setCreature(t){"params"in t?(this.params=t.params,this.monster=Object.assign({},ve.get(this.params.monster)??ve.get(this.params.creature))):(this.params={},this.monster=t.monster)}async init(){this.containerEl.empty(),this.monster=await this.build(),this.$ui=new rd({target:this.containerEl,props:{context:this.context,monster:this.monster,statblock:this.layout.blocks,layout:this.layout,plugin:this.plugin,renderer:this,canSave:this.canSave,icons:this.icons??!0}}),this.$ui.$on("save",async()=>{ve.hasCreature(this.monster.name)&&!await No(this.plugin.app,"This will overwrite an existing monster in settings. Are you sure?")||this.plugin.saveMonster({...(0,Ro.default)(this.monster),source:this.monster.source??"Homebrew",layout:this.layout.name})}),this.$ui.$on("export",()=>{this.plugin.exportAsPng(this.monster.name,this.containerEl.firstElementChild)});let t=ve.getExtensionNames(this.monster,new Set);this.plugin.registerEvent(this.plugin.app.workspace.on("fantasy-statblocks:bestiary:creature-added",async n=>{t.includes(n.name)&&(this.monster=(0,cd.default)(n),this.monster=await this.build(),this.$ui.$set({monster:this.monster}))}))}transformLinks(t){return(0,wt.parseYaml)(ct.transformYamlSource((0,wt.stringifyYaml)(t).replace(/\\#/g,"#")))}};async function No(i,e,t={cta:"Yes",secondary:"No"}){return new Promise((n,a)=>{let s=new Wo(i,e,t);s.onClose=()=>{n(s.confirmed)},s.open()})}var Wo=class extends wt.Modal{constructor(t,n,a){super(t);this.text=n;this.buttons=a;this.confirmed=!1}async display(){new Promise(t=>{this.contentEl.empty(),this.contentEl.addClass("confirm-modal"),this.contentEl.createEl("p",{text:this.text});let n=this.contentEl.createDiv("fantasy-calendar-confirm-buttons");new wt.ButtonComponent(n).setButtonText(this.buttons.cta).setCta().onClick(()=>{this.confirmed=!0,this.close()}),new wt.ButtonComponent(n).setButtonText(this.buttons.secondary).onClick(()=>{this.close()})})}onOpen(){this.display()}};function Oi(i,e){let t=[];if(i in e&&Array.isArray(e[i]))for(let n of e[i])!Array.isArray(n)&&typeof n=="object"&&"name"in n&&t.push(n),Array.isArray(n)&&n.length>=1&&t.push({name:n[0],desc:n.slice(1).join("")});return t}var ke=require("obsidian");var Jt=require("obsidian");var wa=[["group","Group"],["inline","Inline Group"],["ifelse","If/Else"],["collapse","Collapsible"],["javascript","JavaScript"],["layout","Layout"],["action","Action"],[null,"separator"],["heading","Heading"],["image","Image"],["property","Property Line"],["saves","Saves"],["spells","Spells"],["subheading","Subheading"],["table","Table"],["text","Text"],["traits","Traits"]];function Os(i){let e=i-1;return e*e*e+1}function $i(i,{from:e,to:t},n={}){let a=getComputedStyle(i),s=a.transform==="none"?"":a.transform,[r,o]=a.transformOrigin.split(" ").map(parseFloat),l=e.left+e.width*r/t.width-(t.left+r),c=e.top+e.height*o/t.height-(t.top+o),{delay:d=0,duration:h=f=>Math.sqrt(f)*120,easing:u=Os}=n;return{delay:d,duration:Ie(h)?h(Math.sqrt(l*l+c*c)):h,easing:u,css:(f,m)=>{let p=m*l,y=m*c,w=f+m*e.width/t.width,_=f+m*e.height/t.height;return`transform: ${s} translate(${p}px, ${y}px) scale(${w}, ${_});`}}}function hd(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(i,a).enumerable})),t.push.apply(t,n)}return t}function an(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hd(Object(t),!0).forEach(function(n){Ln(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):hd(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Ts(i){"@babel/helpers - typeof";return Ts=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ts(i)}function Ln(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function w1(i,e){if(i==null)return{};var t={},n=Object.keys(i),a,s;for(s=0;s<n.length;s++)a=n[s],!(e.indexOf(a)>=0)&&(t[a]=i[a]);return t}function _1(i,e){if(i==null)return{};var t=w1(i,e),n,a;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(a=0;a<s.length;a++)n=s[a],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(i,n)&&(t[n]=i[n])}return t}function O1(i,e){return x1(i)||C1(i,e)||Xo(i,e)||D1()}function $n(i){return S1(i)||T1(i)||Xo(i)||A1()}function S1(i){if(Array.isArray(i))return $o(i)}function x1(i){if(Array.isArray(i))return i}function T1(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function C1(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n=[],a=!0,s=!1,r,o;try{for(t=t.call(i);!(a=(r=t.next()).done)&&(n.push(r.value),!(e&&n.length===e));a=!0);}catch(l){s=!0,o=l}finally{try{!a&&t.return!=null&&t.return()}finally{if(s)throw o}}return n}}function Xo(i,e){if(i){if(typeof i=="string")return $o(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return $o(i,e)}}function $o(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=i[t];return n}function A1(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Is(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=Xo(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var n=0,a=function(){};return{s:a,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(l){throw l},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,r=!1,o;return{s:function(){t=t.call(i)},n:function(){var l=t.next();return s=l.done,l},e:function(l){r=!0,o=l},f:function(){try{!s&&t.return!=null&&t.return()}finally{if(r)throw o}}}}var P1="finalize",M1="consider";function Bn(i,e,t){i.dispatchEvent(new CustomEvent(P1,{detail:{items:e,info:t}}))}function Hi(i,e,t){i.dispatchEvent(new CustomEvent(M1,{detail:{items:e,info:t}}))}var Rs="draggedEntered",Ca="draggedLeft",Ws="draggedOverIndex",qo="draggedLeftDocument",Cs={LEFT_FOR_ANOTHER:"leftForAnother",OUTSIDE_OF_ANY:"outsideOfAny"};function E1(i,e,t){i.dispatchEvent(new CustomEvent(Rs,{detail:{indexObj:e,draggedEl:t}}))}function Q1(i,e,t){i.dispatchEvent(new CustomEvent(Ca,{detail:{draggedEl:e,type:Cs.LEFT_FOR_ANOTHER,theOtherDz:t}}))}function I1(i,e){i.dispatchEvent(new CustomEvent(Ca,{detail:{draggedEl:e,type:Cs.OUTSIDE_OF_ANY}}))}function R1(i,e,t){i.dispatchEvent(new CustomEvent(Ws,{detail:{indexObj:e,draggedEl:t}}))}function W1(i){window.dispatchEvent(new CustomEvent(qo,{detail:{draggedEl:i}}))}var qe={DRAG_STARTED:"dragStarted",DRAGGED_ENTERED:Rs,DRAGGED_ENTERED_ANOTHER:"dragEnteredAnother",DRAGGED_OVER_INDEX:Ws,DRAGGED_LEFT:Ca,DRAGGED_LEFT_ALL:"draggedLeftAll",DROPPED_INTO_ZONE:"droppedIntoZone",DROPPED_INTO_ANOTHER:"droppedIntoAnother",DROPPED_OUTSIDE_OF_ANY:"droppedOutsideOfAny",DRAG_STOPPED:"dragStopped"},ze={POINTER:"pointer",KEYBOARD:"keyboard"},Ns="isDndShadowItem",Uo="data-is-dnd-shadow-item",hi="id:dnd-shadow-placeholder-0000",N1="dnd-action-dragged-el",it="id",Bo=0;function _d(){Bo++}function Od(){if(Bo===0)throw new Error("Bug! trying to decrement when there are no dropzones");Bo--}var Vo=typeof window>"u",_e=function(){};function Sd(i){var e,t=i.getBoundingClientRect(),n=getComputedStyle(i),a=n.transform;if(a){var s,r,o,l;if(a.startsWith("matrix3d("))e=a.slice(9,-1).split(/, /),s=+e[0],r=+e[5],o=+e[12],l=+e[13];else if(a.startsWith("matrix("))e=a.slice(7,-1).split(/, /),s=+e[0],r=+e[3],o=+e[4],l=+e[5];else return t;var c=n.transformOrigin,d=t.x-o-(1-s)*parseFloat(c),h=t.y-l-(1-r)*parseFloat(c.slice(c.indexOf(" ")+1)),u=s?t.width/s:i.offsetWidth,f=r?t.height/r:i.offsetHeight;return{x:d,y:h,width:u,height:f,top:h,right:d+u,bottom:h+f,left:d}}else return t}function xd(i){var e=Sd(i);return{top:e.top+window.scrollY,bottom:e.bottom+window.scrollY,left:e.left+window.scrollX,right:e.right+window.scrollX}}function Yo(i){var e=i.getBoundingClientRect();return{top:e.top+window.scrollY,bottom:e.bottom+window.scrollY,left:e.left+window.scrollX,right:e.right+window.scrollX}}function Td(i){return{x:(i.left+i.right)/2,y:(i.top+i.bottom)/2}}function L1(i,e){return Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2))}function Go(i,e){return i.y<=e.bottom&&i.y>=e.top&&i.x>=e.left&&i.x<=e.right}function Sa(i){return Td(Yo(i))}function dd(i,e){var t=Sa(i),n=xd(e);return Go(t,n)}function $1(i,e){var t=Sa(i),n=Sa(e);return L1(t,n)}function B1(i){var e=Yo(i);return e.right<0||e.left>document.documentElement.scrollWidth||e.bottom<0||e.top>document.documentElement.scrollHeight}function z1(i,e){var t=Yo(e);return Go(i,t)?{top:i.y-t.top,bottom:t.bottom-i.y,left:i.x-t.left,right:Math.min(t.right,document.documentElement.clientWidth)-i.x}:null}var on;function Ko(){_e(function(){return"resetting indexes cache"}),on=new Map}Ko();function H1(i){_e(function(){return"resetting indexes cache for dz"}),on.delete(i)}function F1(i){var e=Array.from(i.children).findIndex(function(t){return t.getAttribute(Uo)});if(e>=0)return on.has(i)||on.set(i,new Map),on.get(i).set(e,xd(i.children[e])),e}function j1(i,e){if(!dd(i,e))return null;var t=e.children;if(t.length===0)return{index:0,isProximityBased:!0};for(var n=F1(e),a=0;a<t.length;a++)if(dd(i,t[a])){var s=on.has(e)&&on.get(e).get(a);return s&&!Go(Sa(i),s)?{index:n,isProximityBased:!1}:{index:a,isProximityBased:!1}}for(var r=Number.MAX_VALUE,o=void 0,l=0;l<t.length;l++){var c=$1(i,t[l]);c<r&&(r=c,o=l)}return{index:o,isProximityBased:!0}}var _a=25;function Cd(){var i;function e(){i={directionObj:void 0,stepPx:0}}e();function t(s){var r=i,o=r.directionObj,l=r.stepPx;o&&(s.scrollBy(o.x*l,o.y*l),window.requestAnimationFrame(function(){return t(s)}))}function n(s){return _a-s}function a(s,r){if(!r)return!1;var o=z1(s,r);if(o===null)return e(),!1;var l=!!i.directionObj,c=!1,d=!1;return r.scrollHeight>r.clientHeight&&(o.bottom<_a?(c=!0,i.directionObj={x:0,y:1},i.stepPx=n(o.bottom)):o.top<_a&&(c=!0,i.directionObj={x:0,y:-1},i.stepPx=n(o.top)),!l&&c)||r.scrollWidth>r.clientWidth&&(o.right<_a?(d=!0,i.directionObj={x:1,y:0},i.stepPx=n(o.right)):o.left<_a&&(d=!0,i.directionObj={x:-1,y:0},i.stepPx=n(o.left)),!l&&d)?(t(r),!0):(e(),!1)}return{scrollIfNeeded:a,resetScrolling:e}}function Si(i){return JSON.stringify(i,null,2)}function ud(i){if(!i)throw new Error("cannot get depth of a falsy node");return Ad(i,0)}function Ad(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return i.parentElement?Ad(i.parentElement,e+1):e-1}function Z1(i,e){if(Object.keys(i).length!==Object.keys(e).length)return!1;for(var t in i)if(!{}.hasOwnProperty.call(e,t)||e[t]!==i[t])return!1;return!0}function X1(i,e){if(i.length!==e.length)return!1;for(var t=0;t<i.length;t++)if(i[t]!==e[t])return!1;return!0}var q1=200,fd=10,Dd=Cd(),U1=Dd.scrollIfNeeded,V1=Dd.resetScrolling,zo;function Y1(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:q1,n,a,s=!1,r,o=Array.from(e).sort(function(c,d){return ud(d)-ud(c)});function l(){var c=Sa(i),d=U1(c,n);if(!d&&r&&Math.abs(r.x-c.x)<fd&&Math.abs(r.y-c.y)<fd){zo=window.setTimeout(l,t);return}if(B1(i)){_e(function(){return"off document"}),W1(i);return}r=c;var h=!1,u=Is(o),f;try{for(u.s();!(f=u.n()).done;){var m=f.value;d&&H1(n);var p=j1(i,m);if(p!==null){var y=p.index;h=!0,m!==n?(n&&Q1(n,i,m),E1(m,p,i),n=m):y!==a&&(R1(m,p,i),a=y);break}}}catch(w){u.e(w)}finally{u.f()}!h&&s&&n?(I1(n,i),n=void 0,a=void 0,s=!1):s=!0,zo=window.setTimeout(l,t)}l()}function G1(){_e(function(){return"unobserving"}),clearTimeout(zo),V1(),Ko()}var K1=300,As;function Ds(i){var e=i.touches?i.touches[0]:i;As={x:e.clientX,y:e.clientY}}var Pd=Cd(),J1=Pd.scrollIfNeeded,eb=Pd.resetScrolling,Md;function Ed(){if(As){var i=J1(As,document.documentElement);i&&Ko()}Md=window.setTimeout(Ed,K1)}function tb(){_e(function(){return"arming window scroller"}),window.addEventListener("mousemove",Ds),window.addEventListener("touchmove",Ds),Ed()}function ib(){_e(function(){return"disarming window scroller"}),window.removeEventListener("mousemove",Ds),window.removeEventListener("touchmove",Ds),As=void 0,window.clearTimeout(Md),eb()}function nb(i){var e=i.cloneNode(!0),t=[],n=i.tagName==="SELECT",a=n?[i]:$n(i.querySelectorAll("select")),s=Is(a),r;try{for(s.s();!(r=s.n()).done;){var o=r.value;t.push(o.value)}}catch(f){s.e(f)}finally{s.f()}if(a.length<=0)return e;for(var l=n?[e]:$n(e.querySelectorAll("select")),c=0;c<l.length;c++){var d=l[c],h=t[c],u=d.querySelector('option[value="'.concat(h,'"'));u&&u.setAttribute("selected",!0)}return e}var xa=Object.freeze({USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT:"USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT"}),ab=Ln({},xa.USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT,!1);function Qd(i){if(!xa[i])throw new Error("Can't get non existing feature flag ".concat(i,"! Supported flags: ").concat(Object.keys(xa)));return ab[i]}var sb=.2;function nn(i){return"".concat(i," ").concat(sb,"s ease")}function rb(i,e){var t=i.getBoundingClientRect(),n=nb(i);Id(i,n),n.id=N1,n.style.position="fixed";var a=t.top,s=t.left;if(n.style.top="".concat(a,"px"),n.style.left="".concat(s,"px"),e){var r=Td(t);a-=r.y-e.y,s-=r.x-e.x,window.setTimeout(function(){n.style.top="".concat(a,"px"),n.style.left="".concat(s,"px")},0)}return n.style.margin="0",n.style.boxSizing="border-box",n.style.height="".concat(t.height,"px"),n.style.width="".concat(t.width,"px"),n.style.transition="".concat(nn("top"),", ").concat(nn("left"),", ").concat(nn("background-color"),", ").concat(nn("opacity"),", ").concat(nn("color")," "),window.setTimeout(function(){return n.style.transition+=", ".concat(nn("width"),", ").concat(nn("height"))},0),n.style.zIndex="9999",n.style.cursor="grabbing",n}function ob(i){i.style.cursor="grab"}function lb(i,e,t,n){Id(e,i);var a=e.getBoundingClientRect(),s=i.getBoundingClientRect(),r=a.width-s.width,o=a.height-s.height;if(r||o){var l={left:(t-s.left)/s.width,top:(n-s.top)/s.height};Qd(xa.USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT)||(i.style.height="".concat(a.height,"px"),i.style.width="".concat(a.width,"px")),i.style.left="".concat(parseFloat(i.style.left)-l.left*r,"px"),i.style.top="".concat(parseFloat(i.style.top)-l.top*o,"px")}}function Id(i,e){var t=window.getComputedStyle(i);Array.from(t).filter(function(n){return n.startsWith("background")||n.startsWith("padding")||n.startsWith("font")||n.startsWith("text")||n.startsWith("align")||n.startsWith("justify")||n.startsWith("display")||n.startsWith("flex")||n.startsWith("border")||n==="opacity"||n==="color"||n==="list-style-type"||Qd(xa.USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT)&&(n==="width"||n==="height")}).forEach(function(n){return e.style.setProperty(n,t.getPropertyValue(n),t.getPropertyPriority(n))})}function cb(i,e){i.draggable=!1,i.ondragstart=function(){return!1},e?(i.style.userSelect="",i.style.WebkitUserSelect="",i.style.cursor=""):(i.style.userSelect="none",i.style.WebkitUserSelect="none",i.style.cursor="grab")}function Rd(i){i.style.display="none",i.style.position="fixed",i.style.zIndex="-5"}function hb(i){i.style.visibility="hidden",i.setAttribute(Uo,"true")}function db(i){i.style.visibility="",i.removeAttribute(Uo)}function xs(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return[]};i.forEach(function(n){var a=e(n);Object.keys(a).forEach(function(s){n.style[s]=a[s]}),t(n).forEach(function(s){return n.classList.add(s)})})}function Ps(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return[]};i.forEach(function(n){var a=e(n);Object.keys(a).forEach(function(s){n.style[s]=""}),t(n).forEach(function(s){return n.classList.contains(s)&&n.classList.remove(s)})})}function ub(i){var e=i.style.minHeight;i.style.minHeight=window.getComputedStyle(i).getPropertyValue("height");var t=i.style.minWidth;return i.style.minWidth=window.getComputedStyle(i).getPropertyValue("width"),function(){i.style.minHeight=e,i.style.minWidth=t}}var fb="--any--",mb=100,md=3,gd={outline:"rgba(255, 255, 102, 0.7) solid 2px"},ci,dt,Pt,Ls,Ge,$s,zn,_t,Bi,$t,rn=!1,Jo=!1,el,Aa=!1,Oa=[],Yt=new Map,Ye=new Map,Lo=new WeakMap;function gb(i,e){_e(function(){return"registering drop-zone if absent"}),Yt.has(e)||Yt.set(e,new Set),Yt.get(e).has(i)||(Yt.get(e).add(i),_d())}function pd(i,e){Yt.get(e).delete(i),Od(),Yt.get(e).size===0&&Yt.delete(e)}function pb(){_e(function(){return"watching dragged element"}),tb();var i=Yt.get(Ls),e=Is(i),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.addEventListener(Rs,Wd),n.addEventListener(Ca,Nd),n.addEventListener(Ws,Ld)}}catch(s){e.e(s)}finally{e.f()}window.addEventListener(qo,Hn);var a=Math.max.apply(Math,[mb].concat($n(Array.from(i.keys()).map(function(s){return Ye.get(s).dropAnimationDurationMs}))));Y1(dt,i,a*1.07)}function bb(){_e(function(){return"unwatching dragged element"}),ib();var i=Yt.get(Ls),e=Is(i),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.removeEventListener(Rs,Wd),n.removeEventListener(Ca,Nd),n.removeEventListener(Ws,Ld)}}catch(a){e.e(a)}finally{e.f()}window.removeEventListener(qo,Hn),G1()}function yb(i){return i.findIndex(function(e){return e[it]===hi})}function Bs(i){return i.findIndex(function(e){return!!e[Ns]&&e[it]!==hi})}function Wd(i){_e(function(){return["dragged entered",i.currentTarget,i.detail]});var e=Ye.get(i.currentTarget),t=e.items,n=e.dropFromOthersDisabled;if(n&&i.currentTarget!==Ge){_e(function(){return"ignoring dragged entered because drop is currently disabled"});return}if(Aa=!1,t=t.filter(function(h){return h[it]!==zn[it]}),_e(function(){return"dragged entered items ".concat(Si(t))}),Ge!==i.currentTarget){var a=Ye.get(Ge).items,s=a.filter(function(h){return!h[Ns]});Hi(Ge,s,{trigger:qe.DRAGGED_ENTERED_ANOTHER,id:Pt[it],source:ze.POINTER})}else{var r=yb(t);r!==-1&&(_e(function(){return"removing placeholder item from origin dz"}),t.splice(r,1))}var o=i.detail.indexObj,l=o.index,c=o.isProximityBased,d=c&&l===i.currentTarget.children.length-1?l+1:l;_t=i.currentTarget,t.splice(d,0,zn),Hi(i.currentTarget,t,{trigger:qe.DRAGGED_ENTERED,id:Pt[it],source:ze.POINTER})}function Nd(i){if(rn){_e(function(){return["dragged left",i.currentTarget,i.detail]});var e=Ye.get(i.currentTarget),t=e.items,n=e.dropFromOthersDisabled;if(n&&i.currentTarget!==Ge&&i.currentTarget!==_t){_e(function(){return"drop is currently disabled"});return}var a=Bs(t),s=t.splice(a,1)[0];_t=void 0;var r=i.detail,o=r.type,l=r.theOtherDz;if(o===Cs.OUTSIDE_OF_ANY||o===Cs.LEFT_FOR_ANOTHER&&l!==Ge&&Ye.get(l).dropFromOthersDisabled){_e(function(){return"dragged left all, putting shadow element back in the origin dz"}),Aa=!0,_t=Ge;var c=Ye.get(Ge).items;c.splice($s,0,s),Hi(Ge,c,{trigger:qe.DRAGGED_LEFT_ALL,id:Pt[it],source:ze.POINTER})}Hi(i.currentTarget,t,{trigger:qe.DRAGGED_LEFT,id:Pt[it],source:ze.POINTER})}}function Ld(i){_e(function(){return["dragged is over index",i.currentTarget,i.detail]});var e=Ye.get(i.currentTarget),t=e.items,n=e.dropFromOthersDisabled;if(n&&i.currentTarget!==Ge){_e(function(){return"drop is currently disabled"});return}Aa=!1;var a=i.detail.indexObj.index,s=Bs(t);t.splice(s,1),t.splice(a,0,zn),Hi(i.currentTarget,t,{trigger:qe.DRAGGED_OVER_INDEX,id:Pt[it],source:ze.POINTER})}function Ms(i){i.preventDefault();var e=i.touches?i.touches[0]:i;$t={x:e.clientX,y:e.clientY},dt.style.transform="translate3d(".concat($t.x-Bi.x,"px, ").concat($t.y-Bi.y,"px, 0)")}function Hn(){_e(function(){return"dropped"}),Jo=!0,window.removeEventListener("mousemove",Ms),window.removeEventListener("touchmove",Ms),window.removeEventListener("mouseup",Hn),window.removeEventListener("touchend",Hn),bb(),ob(dt),_t||(_e(function(){return"element was dropped right after it left origin but before entering somewhere else"}),_t=Ge),_e(function(){return["dropped in dz",_t]});var i=Ye.get(_t),e=i.items,t=i.type;Ps(Yt.get(t),function(s){return Ye.get(s).dropTargetStyle},function(s){return Ye.get(s).dropTargetClasses});var n=Bs(e);n===-1&&(n=$s),e=e.map(function(s){return s[Ns]?Pt:s});function a(){el(),Bn(_t,e,{trigger:Aa?qe.DROPPED_OUTSIDE_OF_ANY:qe.DROPPED_INTO_ZONE,id:Pt[it],source:ze.POINTER}),_t!==Ge&&Bn(Ge,Ye.get(Ge).items,{trigger:qe.DROPPED_INTO_ANOTHER,id:Pt[it],source:ze.POINTER}),db(_t.children[n]),wb()}vb(n,a)}function vb(i,e){var t=Sd(_t.children[i]),n={x:t.left-parseFloat(dt.style.left),y:t.top-parseFloat(dt.style.top)},a=Ye.get(_t),s=a.dropAnimationDurationMs,r="transform ".concat(s,"ms ease");dt.style.transition=dt.style.transition?dt.style.transition+","+r:r,dt.style.transform="translate3d(".concat(n.x,"px, ").concat(n.y,"px, 0)"),window.setTimeout(e,s)}function kb(i,e){Oa.push({dz:i,destroy:e}),window.requestAnimationFrame(function(){Rd(i),document.body.appendChild(i)})}function wb(){dt.remove(),ci.remove(),Oa.length&&(_e(function(){return["will destroy zones that were removed during drag",Oa]}),Oa.forEach(function(i){var e=i.dz,t=i.destroy;t(),e.remove()}),Oa=[]),dt=void 0,ci=void 0,Pt=void 0,Ls=void 0,Ge=void 0,$s=void 0,zn=void 0,_t=void 0,Bi=void 0,$t=void 0,rn=!1,Jo=!1,el=void 0,Aa=!1}function _b(i,e){var t=!1,n={items:void 0,type:void 0,flipDurationMs:0,dragDisabled:!1,morphDisabled:!1,dropFromOthersDisabled:!1,dropTargetStyle:gd,dropTargetClasses:[],transformDraggedElement:function(){},centreDraggedOnCursor:!1};_e(function(){return["dndzone good to go options: ".concat(Si(e),", config: ").concat(Si(n)),{node:i}]});var a=new Map;function s(){window.addEventListener("mousemove",l,{passive:!1}),window.addEventListener("touchmove",l,{passive:!1,capture:!1}),window.addEventListener("mouseup",o,{passive:!1}),window.addEventListener("touchend",o,{passive:!1})}function r(){window.removeEventListener("mousemove",l),window.removeEventListener("touchmove",l),window.removeEventListener("mouseup",o),window.removeEventListener("touchend",o)}function o(){r(),ci=void 0,Bi=void 0,$t=void 0}function l(u){u.preventDefault();var f=u.touches?u.touches[0]:u;$t={x:f.clientX,y:f.clientY},(Math.abs($t.x-Bi.x)>=md||Math.abs($t.y-Bi.y)>=md)&&(r(),d())}function c(u){if(u.target!==u.currentTarget&&(u.target.value!==void 0||u.target.isContentEditable)){_e(function(){return"won't initiate drag on a nested input element"});return}if(u.button){_e(function(){return"ignoring none left click button: ".concat(u.button)});return}if(rn){_e(function(){return"cannot start a new drag before finalizing previous one"});return}u.stopPropagation();var f=u.touches?u.touches[0]:u;Bi={x:f.clientX,y:f.clientY},$t=an({},Bi),ci=u.currentTarget,s()}function d(){_e(function(){return["drag start config: ".concat(Si(n)),ci]}),rn=!0;var u=a.get(ci);$s=u,Ge=ci.parentElement;var f=Ge.getRootNode(),m=f.body||f,p=n.items,y=n.type,w=n.centreDraggedOnCursor;Pt=an({},p[u]),Ls=y,zn=an(an({},Pt),{},Ln({},Ns,!0));var _=an(an({},zn),{},Ln({},it,hi));dt=rb(ci,w&&$t);function O(){dt.parentElement?window.requestAnimationFrame(O):(m.appendChild(dt),dt.focus(),pb(),Rd(ci),m.appendChild(ci))}window.requestAnimationFrame(O),xs(Array.from(Yt.get(n.type)).filter(function(E){return E===Ge||!Ye.get(E).dropFromOthersDisabled}),function(E){return Ye.get(E).dropTargetStyle},function(E){return Ye.get(E).dropTargetClasses}),p.splice(u,1,_),el=ub(Ge),Hi(Ge,p,{trigger:qe.DRAG_STARTED,id:Pt[it],source:ze.POINTER}),window.addEventListener("mousemove",Ms,{passive:!1}),window.addEventListener("touchmove",Ms,{passive:!1,capture:!1}),window.addEventListener("mouseup",Hn,{passive:!1}),window.addEventListener("touchend",Hn,{passive:!1})}function h(u){var f=u.items,m=f===void 0?void 0:f,p=u.flipDurationMs,y=p===void 0?0:p,w=u.type,_=w===void 0?fb:w,O=u.dragDisabled,E=O===void 0?!1:O,S=u.morphDisabled,v=S===void 0?!1:S,x=u.dropFromOthersDisabled,P=x===void 0?!1:x,I=u.dropTargetStyle,R=I===void 0?gd:I,T=u.dropTargetClasses,$=T===void 0?[]:T,K=u.transformDraggedElement,Z=K===void 0?function(){}:K,F=u.centreDraggedOnCursor,V=F===void 0?!1:F;n.dropAnimationDurationMs=y,n.type&&_!==n.type&&pd(i,n.type),n.type=_,n.items=$n(m),n.dragDisabled=E,n.morphDisabled=v,n.transformDraggedElement=Z,n.centreDraggedOnCursor=V,t&&rn&&!Jo&&(!Z1(R,n.dropTargetStyle)||!X1($,n.dropTargetClasses))&&(Ps([i],function(){return n.dropTargetStyle},function(){return $}),xs([i],function(){return R},function(){return $})),n.dropTargetStyle=R,n.dropTargetClasses=$n($);function B(J,ue){return Ye.get(J)?Ye.get(J)[ue]:n[ue]}t&&rn&&n.dropFromOthersDisabled!==P&&(P?Ps([i],function(J){return B(J,"dropTargetStyle")},function(J){return B(J,"dropTargetClasses")}):xs([i],function(J){return B(J,"dropTargetStyle")},function(J){return B(J,"dropTargetClasses")})),n.dropFromOthersDisabled=P,Ye.set(i,n),gb(i,_);for(var Y=Bs(n.items),L=0;L<i.children.length;L++){var ae=i.children[L];if(cb(ae,E),L===Y){n.transformDraggedElement(dt,Pt,L),v||lb(dt,ae,$t.x,$t.y),hb(ae);continue}ae.removeEventListener("mousedown",Lo.get(ae)),ae.removeEventListener("touchstart",Lo.get(ae)),E||(ae.addEventListener("mousedown",c),ae.addEventListener("touchstart",c),Lo.set(ae,c)),a.set(ae,L),t||(t=!0)}}return h(e),{update:function(f){_e(function(){return"pointer dndzone will update newOptions: ".concat(Si(f))}),h(f)},destroy:function(){function f(){_e(function(){return"pointer dndzone will destroy"}),pd(i,Ye.get(i).type),Ye.delete(i)}rn?(_e(function(){return"pointer dndzone will be scheduled for destruction"}),kb(i,f)):f()}}}var Ss,Ho={DND_ZONE_ACTIVE:"dnd-zone-active",DND_ZONE_DRAG_DISABLED:"dnd-zone-drag-disabled"},$d=(Ss={},Ln(Ss,Ho.DND_ZONE_ACTIVE,"Tab to one the items and press space-bar or enter to start dragging it"),Ln(Ss,Ho.DND_ZONE_DRAG_DISABLED,"This is a disabled drag and drop list"),Ss),Ob="dnd-action-aria-alert",Ve;function Fo(){Ve||(Ve=document.createElement("div"),function(){Ve.id=Ob,Ve.style.position="fixed",Ve.style.bottom="0",Ve.style.left="0",Ve.style.zIndex="-5",Ve.style.opacity="0",Ve.style.height="0",Ve.style.width="0",Ve.setAttribute("role","alert")}(),document.body.prepend(Ve),Object.entries($d).forEach(function(i){var e=O1(i,2),t=e[0],n=e[1];return document.body.prepend(Tb(t,n))}))}function Sb(){return Vo?null:(document.readyState==="complete"?Fo():window.addEventListener("DOMContentLoaded",Fo),an({},Ho))}function xb(){Vo||!Ve||(Object.keys($d).forEach(function(i){var e;return(e=document.getElementById(i))===null||e===void 0?void 0:e.remove()}),Ve.remove(),Ve=void 0)}function Tb(i,e){var t=document.createElement("div");return t.id=i,t.innerHTML="<p>".concat(e,"</p>"),t.style.display="none",t.style.position="fixed",t.style.zIndex="-5",t}function Nn(i){if(!Vo){Ve||Fo(),Ve.innerHTML="";var e=document.createTextNode(i);Ve.appendChild(e),Ve.style.display="none",Ve.style.display="inline"}}var Cb="--any--",bd={outline:"rgba(255, 255, 102, 0.7) solid 2px"},Bt=!1,jo,ut,ln="",sn,Ut,zi="",Es=new WeakSet,yd=new WeakMap,vd=new WeakMap,Zo=new Map,ht=new Map,Vt=new Map,Qs;function Ab(i,e){_e(function(){return"registering drop-zone if absent"}),Vt.size===0&&(_e(function(){return"adding global keydown and click handlers"}),Qs=Sb(),window.addEventListener("keydown",Bd),window.addEventListener("click",zd)),Vt.has(e)||Vt.set(e,new Set),Vt.get(e).has(i)||(Vt.get(e).add(i),_d())}function kd(i,e){_e(function(){return"unregistering drop-zone"}),ut===i&&Ta(),Vt.get(e).delete(i),Od(),Vt.get(e).size===0&&Vt.delete(e),Vt.size===0&&(_e(function(){return"removing global keydown and click handlers"}),window.removeEventListener("keydown",Bd),window.removeEventListener("click",zd),Qs=void 0,xb())}function Bd(i){if(Bt)switch(i.key){case"Escape":{Ta();break}}}function zd(){Bt&&(Es.has(document.activeElement)||(_e(function(){return"clicked outside of any draggable"}),Ta()))}function Db(i){if(_e(function(){return"zone focus"}),!!Bt){var e=i.currentTarget;if(e!==ut){ln=e.getAttribute("aria-label")||"";var t=ht.get(ut),n=t.items,a=n.find(function(h){return h[it]===Ut}),s=n.indexOf(a),r=n.splice(s,1)[0],o=ht.get(e),l=o.items,c=o.autoAriaDisabled;e.getBoundingClientRect().top<ut.getBoundingClientRect().top||e.getBoundingClientRect().left<ut.getBoundingClientRect().left?(l.push(r),c||Nn("Moved item ".concat(zi," to the end of the list ").concat(ln))):(l.unshift(r),c||Nn("Moved item ".concat(zi," to the beginning of the list ").concat(ln)));var d=ut;Bn(d,n,{trigger:qe.DROPPED_INTO_ANOTHER,id:Ut,source:ze.KEYBOARD}),Bn(e,l,{trigger:qe.DROPPED_INTO_ZONE,id:Ut,source:ze.KEYBOARD}),ut=e}}}function Hd(){Zo.forEach(function(i,e){var t=i.update;return t(ht.get(e))})}function Ta(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;_e(function(){return"drop"}),ht.get(ut).autoAriaDisabled||Nn("Stopped dragging item ".concat(zi)),Es.has(document.activeElement)&&document.activeElement.blur(),i&&Hi(ut,ht.get(ut).items,{trigger:qe.DRAG_STOPPED,id:Ut,source:ze.KEYBOARD}),Ps(Vt.get(jo),function(e){return ht.get(e).dropTargetStyle},function(e){return ht.get(e).dropTargetClasses}),sn=null,Ut=null,zi="",jo=null,ut=null,ln="",Bt=!1,Hd()}function Pb(i,e){var t={items:void 0,type:void 0,dragDisabled:!1,zoneTabIndex:0,dropFromOthersDisabled:!1,dropTargetStyle:bd,dropTargetClasses:[],autoAriaDisabled:!1};function n(d,h,u){d.length<=1||d.splice(u,1,d.splice(h,1,d[u])[0])}function a(d){switch(_e(function(){return["handling key down",d.key]}),d.key){case"Enter":case" ":{if((d.target.disabled!==void 0||d.target.href||d.target.isContentEditable)&&!Es.has(d.target))return;d.preventDefault(),d.stopPropagation(),Bt?Ta():s(d);break}case"ArrowDown":case"ArrowRight":{if(!Bt)return;d.preventDefault(),d.stopPropagation();var h=ht.get(i),u=h.items,f=Array.from(i.children),m=f.indexOf(d.currentTarget);_e(function(){return["arrow down",m]}),m<f.length-1&&(t.autoAriaDisabled||Nn("Moved item ".concat(zi," to position ").concat(m+2," in the list ").concat(ln)),n(u,m,m+1),Bn(i,u,{trigger:qe.DROPPED_INTO_ZONE,id:Ut,source:ze.KEYBOARD}));break}case"ArrowUp":case"ArrowLeft":{if(!Bt)return;d.preventDefault(),d.stopPropagation();var p=ht.get(i),y=p.items,w=Array.from(i.children),_=w.indexOf(d.currentTarget);_e(function(){return["arrow up",_]}),_>0&&(t.autoAriaDisabled||Nn("Moved item ".concat(zi," to position ").concat(_," in the list ").concat(ln)),n(y,_,_-1),Bn(i,y,{trigger:qe.DROPPED_INTO_ZONE,id:Ut,source:ze.KEYBOARD}));break}}}function s(d){_e(function(){return"drag start"}),o(d.currentTarget),ut=i,jo=t.type,Bt=!0;var h=Array.from(Vt.get(t.type)).filter(function(f){return f===ut||!ht.get(f).dropFromOthersDisabled});if(xs(h,function(f){return ht.get(f).dropTargetStyle},function(f){return ht.get(f).dropTargetClasses}),!t.autoAriaDisabled){var u="Started dragging item ".concat(zi,". Use the arrow keys to move it within its list ").concat(ln);h.length>1&&(u+=", or tab to another list in order to move the item into it"),Nn(u)}Hi(i,ht.get(i).items,{trigger:qe.DRAG_STARTED,id:Ut,source:ze.KEYBOARD}),Hd()}function r(d){Bt&&d.currentTarget!==sn&&(d.stopPropagation(),Ta(!1),s(d))}function o(d){var h=ht.get(i),u=h.items,f=Array.from(i.children),m=f.indexOf(d);sn=d,sn.tabIndex=0,Ut=u[m][it],zi=f[m].getAttribute("aria-label")||""}function l(d){var h=d.items,u=h===void 0?[]:h,f=d.type,m=f===void 0?Cb:f,p=d.dragDisabled,y=p===void 0?!1:p,w=d.zoneTabIndex,_=w===void 0?0:w,O=d.dropFromOthersDisabled,E=O===void 0?!1:O,S=d.dropTargetStyle,v=S===void 0?bd:S,x=d.dropTargetClasses,P=x===void 0?[]:x,I=d.autoAriaDisabled,R=I===void 0?!1:I;t.items=$n(u),t.dragDisabled=y,t.dropFromOthersDisabled=E,t.zoneTabIndex=_,t.dropTargetStyle=v,t.dropTargetClasses=P,t.autoAriaDisabled=R,t.type&&m!==t.type&&kd(i,t.type),t.type=m,Ab(i,m),R||(i.setAttribute("aria-disabled",y),i.setAttribute("role","list"),i.setAttribute("aria-describedby",y?Qs.DND_ZONE_DRAG_DISABLED:Qs.DND_ZONE_ACTIVE)),ht.set(i,t),Bt?i.tabIndex=i===ut||sn.contains(i)||t.dropFromOthersDisabled||ut&&t.type!==ht.get(ut).type?-1:0:i.tabIndex=t.zoneTabIndex,i.addEventListener("focus",Db);for(var T=function(Z){var F=i.children[Z];Es.add(F),F.tabIndex=Bt?-1:0,R||F.setAttribute("role","listitem"),F.removeEventListener("keydown",yd.get(F)),F.removeEventListener("click",vd.get(F)),y||(F.addEventListener("keydown",a),yd.set(F,a),F.addEventListener("click",r),vd.set(F,r)),Bt&&t.items[Z][it]===Ut&&(_e(function(){return["focusing on",{i:Z,focusedItemId:Ut}]}),sn=F,sn.tabIndex=0,F.focus())},$=0;$<i.children.length;$++)T($)}l(e);var c={update:function(h){_e(function(){return"keyboard dndzone will update newOptions: ".concat(Si(h))}),l(h)},destroy:function(){_e(function(){return"keyboard dndzone will destroy"}),kd(i,t.type),ht.delete(i),Zo.delete(i)}};return Zo.set(i,c),c}var Mb=["items","flipDurationMs","type","dragDisabled","morphDisabled","dropFromOthersDisabled","zoneTabIndex","dropTargetStyle","dropTargetClasses","transformDraggedElement","autoAriaDisabled","centreDraggedOnCursor"];function di(i,e){wd(e);var t=_b(i,e),n=Pb(i,e);return{update:function(s){wd(s),t.update(s),n.update(s)},destroy:function(){t.destroy(),n.destroy()}}}function wd(i){var e=i.items,t=i.flipDurationMs,n=i.type,a=i.dragDisabled,s=i.morphDisabled,r=i.dropFromOthersDisabled,o=i.zoneTabIndex,l=i.dropTargetStyle,c=i.dropTargetClasses,d=i.transformDraggedElement,h=i.autoAriaDisabled,u=i.centreDraggedOnCursor,f=_1(i,Mb);if(Object.keys(f).length>0&&console.warn("dndzone will ignore unknown options",f),!e)throw new Error("no 'items' key provided to dndzone");var m=e.find(function(p){return!{}.hasOwnProperty.call(p,it)});if(m)throw new Error("missing '".concat(it,"' property for item ").concat(Si(m)));if(c&&!Array.isArray(c))throw new Error("dropTargetClasses should be an array but instead it is a ".concat(Ts(c),", ").concat(Si(c)));if(o&&!Eb(o))throw new Error("zoneTabIndex should be a number but instead it is a ".concat(Ts(o),", ").concat(Si(o)))}function Eb(i){return!isNaN(i)&&function(e){return(e|0)===e}(parseFloat(i))}var zs=require("obsidian");var Fd=require("@codemirror/view"),Le=(i,e)=>{(0,zs.setIcon)(i,e)};function Da(i,e,t,n,a="js"){let s=new zs.TextAreaComponent(i).setValue(e);return s.inputEl.addClasses(["statblock-textarea",...t]),Ht(s.inputEl,Fd.EditorView.updateListener.of(r=>{r.docChanged&&n(r.state.doc.toString())}),a)}function Qb(i){re(i,"svelte-r3p86y",".property-block-container.svelte-r3p86y{display:flex;justify-content:space-between;align-items:center}.info.svelte-r3p86y{display:flex;flex-flow:column}.context.svelte-r3p86y{display:flex;align-items:center;gap:0.25rem;color:var(--text-muted)}.context-item.svelte-r3p86y{display:flex;align-items:center}")}function jd(i){let e,t,n=i[0].size+"",a,s;return{c(){e=k("span"),t=me("(H"),a=me(n),s=me(")")},m(r,o){D(r,e,o),b(e,t),b(e,a),b(e,s)},p(r,o){o&1&&n!==(n=r[0].size+"")&&we(a,n)},d(r){r&&A(e)}}}function Zd(i){let e,t,n=i[0].headers.join(" | ")+"",a,s;return{c(){e=k("strong"),t=me("("),a=me(n),s=me(")")},m(r,o){D(r,e,o),b(e,t),b(e,a),b(e,s)},p(r,o){o&1&&n!==(n=r[0].headers.join(" | ")+"")&&we(a,n)},d(r){r&&A(e)}}}function Ib(i){let e,t,n=i[2](i[0].layout)+"",a;return{c(){e=k("small"),t=k("em"),a=me(n)},m(s,r){D(s,e,r),b(e,t),b(t,a)},p(s,r){r&1&&n!==(n=s[2](s[0].layout)+"")&&we(a,n)},d(s){s&&A(e)}}}function Rb(i){let e,t,n=i[0].properties.join(", ")+"",a;return{c(){e=k("small"),t=k("em"),a=me(n)},m(s,r){D(s,e,r),b(e,t),b(t,a)},p(s,r){r&1&&n!==(n=s[0].properties.join(", ")+"")&&we(a,n)},d(s){s&&A(e)}}}function Xd(i){let e,t,n,a;return{c(){e=k("div"),g(e,"class","context-item heading svelte-r3p86y"),g(e,"aria-label","Has Heading")},m(s,r){D(s,e,r),n||(a=ee(t=Le.call(null,e,"heading-glyph")),n=!0)},d(s){s&&A(e),n=!1,a()}}}function qd(i){let e,t,n,a;return{c(){e=k("div"),g(e,"class","context-item conditioned svelte-r3p86y"),g(e,"aria-label","Conditioned")},m(s,r){D(s,e,r),n||(a=ee(t=Le.call(null,e,"help-circle")),n=!0)},d(s){s&&A(e),n=!1,a()}}}function Ud(i){let e,t,n,a;return{c(){e=k("div"),g(e,"class","context-item callback svelte-r3p86y"),g(e,"aria-label","Has Callback")},m(s,r){D(s,e,r),n||(a=ee(t=Le.call(null,e,"code-glyph")),n=!0)},d(s){s&&A(e),n=!1,a()}}}function Vd(i){let e,t,n,a;return{c(){e=k("div"),g(e,"class","context-item dice svelte-r3p86y"),g(e,"aria-label","Will Parse for Dice Rolls")},m(s,r){D(s,e,r),n||(a=ee(t=Le.call(null,e,"dices")),n=!0)},d(s){s&&A(e),n=!1,a()}}}function Yd(i){let e,t,n,a;return{c(){e=k("div"),g(e,"class","context-item dice svelte-r3p86y"),g(e,"aria-label","Render markdown enabled")},m(s,r){D(s,e,r),n||(a=ee(t=Le.call(null,e,"markdown-icon")),n=!0)},d(s){s&&A(e),n=!1,a()}}}function Wb(i){let e,t,n,a,s=i[1](i[0].type)+"",r,o,l,c,d,h,u,f,m,p,y=i[0].type=="heading"&&jd(i),w=i[0].type=="table"&&i[0].headers?.length&&Zd(i);function _(R,T){return R[0].type!="layout"?Rb:Ib}let O=_(i,-1),E=O(i),S="heading"in i[0]&&Xd(i),v=i[0].conditioned&&qd(i),x="callback"in i[0]&&Ud(i),P=("dice"in i[0]&&i[0].dice||"diceCallback"in i[0]&&i[0].diceCallback?.length)&&Vd(i),I="markdown"in i[0]&&i[0].markdown&&Yd(i);return{c(){e=k("div"),t=k("div"),n=k("div"),a=k("span"),r=me(s),o=W(),y&&y.c(),l=W(),w&&w.c(),c=W(),E.c(),d=W(),h=k("small"),S&&S.c(),u=W(),v&&v.c(),f=W(),x&&x.c(),m=W(),P&&P.c(),p=W(),I&&I.c(),g(t,"class","info svelte-r3p86y"),g(h,"class","context svelte-r3p86y"),g(e,"class","property-block-container svelte-r3p86y")},m(R,T){D(R,e,T),b(e,t),b(t,n),b(n,a),b(a,r),b(n,o),y&&y.m(n,null),b(n,l),w&&w.m(n,null),b(t,c),E.m(t,null),b(e,d),b(e,h),S&&S.m(h,null),b(h,u),v&&v.m(h,null),b(h,f),x&&x.m(h,null),b(h,m),P&&P.m(h,null),b(h,p),I&&I.m(h,null)},p(R,[T]){T&1&&s!==(s=R[1](R[0].type)+"")&&we(r,s),R[0].type=="heading"?y?y.p(R,T):(y=jd(R),y.c(),y.m(n,l)):y&&(y.d(1),y=null),R[0].type=="table"&&R[0].headers?.length?w?w.p(R,T):(w=Zd(R),w.c(),w.m(n,null)):w&&(w.d(1),w=null),O===(O=_(R,T))&&E?E.p(R,T):(E.d(1),E=O(R),E&&(E.c(),E.m(t,null))),"heading"in R[0]?S||(S=Xd(R),S.c(),S.m(h,u)):S&&(S.d(1),S=null),R[0].conditioned?v||(v=qd(R),v.c(),v.m(h,f)):v&&(v.d(1),v=null),"callback"in R[0]?x||(x=Ud(R),x.c(),x.m(h,m)):x&&(x.d(1),x=null),"dice"in R[0]&&R[0].dice||"diceCallback"in R[0]&&R[0].diceCallback?.length?P||(P=Vd(R),P.c(),P.m(h,p)):P&&(P.d(1),P=null),"markdown"in R[0]&&R[0].markdown?I||(I=Yd(R),I.c(),I.m(h,null)):I&&(I.d(1),I=null)},i:N,o:N,d(R){R&&A(e),y&&y.d(),w&&w.d(),E.d(),S&&S.d(),v&&v.d(),x&&x.d(),P&&P.d(),I&&I.d()}}}function Nb(i,e,t){let{block:n}=e,{plugin:a}=e;n.type=="heading"&&!n.size&&(n.size=1);let s=o=>"display"in n?`${n.display} (${o[0].toUpperCase()+o.slice(1).toLowerCase()})`:o[0].toUpperCase()+o.slice(1).toLowerCase(),r=o=>a.manager.getLayout(o)?.name??"No layout selected";return i.$$set=o=>{"block"in o&&t(0,n=o.block),"plugin"in o&&t(3,a=o.plugin)},[n,s,r,a]}var tl=class extends U{constructor(e){super(),G(this,e,Nb,Wb,j,{block:0,plugin:3},Qb)}},Gd=tl;var Vs=require("obsidian");var _u=It(mi()),pe=require("obsidian");var eu=require("obsidian");function Lb(i){re(i,"svelte-1blh0v3",".creator-zone.svelte-1blh0v3{display:flex;justify-content:space-evenly;gap:1rem;flex-flow:row wrap}.header-container.svelte-1blh0v3{display:flex;align-items:center}")}function Kd(i,e,t){let n=i.slice();return n[11]=e[t],n}function Jd(i,e){let t,n,a=e[11].name+"",s,r,o,l,c,d,h=N,u,f;function m(){return e[8](e[11])}return{key:i,first:null,c(){t=k("div"),n=k("span"),s=me(a),r=W(),o=k("div"),c=W(),g(n,"class","table-header"),g(t,"class","header-container svelte-1blh0v3"),this.first=t},m(p,y){D(p,t,y),b(t,n),b(n,s),b(t,r),b(t,o),b(t,c),u||(f=[ee(l=e[5].call(null,o)),H(o,"click",m)],u=!0)},p(p,y){e=p,y&1&&a!==(a=e[11].name+"")&&we(s,a)},r(){d=t.getBoundingClientRect()},f(){Qi(t),h()},a(){h(),h=Ei(t,d,$i,{duration:il})},d(p){p&&A(t),u=!1,ce(f)}}}function $b(i){let e,t,n=[],a=new Map,s,r,o,l=i[0].filter(i[7]),c=d=>d[11].id;for(let d=0;d<l.length;d+=1){let h=Kd(i,l,d),u=c(h);a.set(u,n[d]=Jd(u,h))}return{c(){e=k("div"),t=k("section");for(let d=0;d<n.length;d+=1)n[d].c();g(t,"class","creator-zone svelte-1blh0v3"),g(e,"class","table-header-container")},m(d,h){D(d,e,h),b(e,t);for(let u=0;u<n.length;u+=1)n[u]&&n[u].m(t,null);r||(o=[ee(s=di.call(null,t,{items:i[0],flipDurationMs:il,dragDisabled:i[1],type:"table_headers"})),H(t,"consider",i[2]),H(t,"finalize",i[3])],r=!0)},p(d,[h]){if(h&17){l=d[0].filter(d[7]);for(let u=0;u<n.length;u+=1)n[u].r();n=gt(n,h,c,1,d,l,a,t,vh,Jd,null,Kd);for(let u=0;u<n.length;u+=1)n[u].a()}s&&Ie(s.update)&&h&3&&s.update.call(null,{items:d[0],flipDurationMs:il,dragDisabled:d[1],type:"table_headers"})},i:N,o:N,d(d){d&&A(e);for(let h=0;h<n.length;h+=1)n[h].d();r=!1,ce(o)}}}var il=300;function Bb(i,e,t){let n=Pe(),{headers:a}=e,s=a.map(m=>({name:m,id:q()})),r=!1;function o(m){let{items:p,info:{source:y,trigger:w}}=m.detail;t(0,s=[...p])}function l(m){let{items:p,info:{source:y}}=m.detail;t(0,s=[...p]),n("sorted",s)}function c(m){m.preventDefault(),t(1,r=!1)}let d=m=>{t(0,s=s.filter(p=>p.id!=m.id)),n("sorted",s)},h=m=>{new eu.ExtraButtonComponent(m).setIcon("cross-in-box")},u=m=>m.id!==hi,f=m=>d(m);return i.$$set=m=>{"headers"in m&&t(6,a=m.headers)},[s,r,o,l,d,h,a,u,f]}var nl=class extends U{constructor(e){super(),G(this,e,Bb,$b,j,{headers:6},Lb)}},tu=nl;var Hs=require("obsidian");function zb(i){re(i,"svelte-mn2hp8",".setting-item.svelte-mn2hp8{align-items:center}.icon.svelte-mn2hp8{display:flex;align-items:center}")}function iu(i,e,t){let n=i.slice();return n[18]=e[t],n[19]=e,n[20]=t,n}function Hb(i){let e,t=i[18].prop+"",n;return{c(){e=k("div"),n=me(t),g(e,"class","setting-item-name")},m(a,s){D(a,e,s),b(e,n)},p(a,s){s&4&&t!==(t=a[18].prop+"")&&we(n,t)},d(a){a&&A(e)}}}function Fb(i){let e,t,n,a;function s(){i[13].call(e,i[19],i[20])}return{c(){e=k("input"),g(e,"type","text"),g(e,"placeholder",t=String(i[18].prop))},m(r,o){D(r,e,o),kt(e,i[18].prop),n||(a=H(e,"input",s),n=!0)},p(r,o){i=r,o&4&&t!==(t=String(i[18].prop))&&g(e,"placeholder",t),o&4&&e.value!==i[18].prop&&kt(e,i[18].prop)},d(r){r&&A(e),n=!1,a()}}}function jb(i){let e,t,n,a;function s(){return i[15](i[18])}return{c(){e=k("div"),g(e,"class","edit")},m(r,o){D(r,e,o),n||(a=[H(e,"click",s),ee(t=i[10].call(null,e))],n=!0)},p(r,o){i=r},d(r){r&&A(e),n=!1,ce(a)}}}function Zb(i){let e,t,n,a;function s(){return i[14](i[18])}return{c(){e=k("div"),g(e,"class","done")},m(r,o){D(r,e,o),n||(a=[H(e,"click",s),ee(t=i[11].call(null,e))],n=!0)},p(r,o){i=r},d(r){r&&A(e),n=!1,ce(a)}}}function nu(i,e){let t,n,a,s,r,o,l,c,d,h,u,f,m,p;function y(x,P){return x[1]==x[18].id?Fb:Hb}let w=y(e,-1),_=w(e);function O(x,P){return x[1]==x[18].id?Zb:jb}let E=O(e,-1),S=E(e);function v(){return e[16](e[18])}return{key:i,first:null,c(){t=k("div"),n=k("div"),r=W(),o=k("div"),_.c(),l=W(),c=k("div"),S.c(),d=W(),h=k("div"),f=W(),g(n,"class","icon svelte-mn2hp8"),g(n,"style",a=e[0]?"cursor: grab":"cursor: grabbing"),g(o,"class","setting-item-info"),g(h,"class","delete"),g(c,"class","setting-item-control"),g(t,"class","setting-item svelte-mn2hp8"),this.first=t},m(x,P){D(x,t,P),b(t,n),b(t,r),b(t,o),_.m(o,null),b(t,l),b(t,c),S.m(c,null),b(c,d),b(c,h),b(t,f),m||(p=[ee(s=Le.call(null,n,"grip-vertical")),H(n,"mousedown",e[5]),H(n,"touchstart",e[5]),H(h,"click",v),ee(u=e[7].call(null,h))],m=!0)},p(x,P){e=x,P&1&&a!==(a=e[0]?"cursor: grab":"cursor: grabbing")&&g(n,"style",a),w===(w=y(e,P))&&_?_.p(e,P):(_.d(1),_=w(e),_&&(_.c(),_.m(o,null))),E===(E=O(e,P))&&S?S.p(e,P):(S.d(1),S=E(e),S&&(S.c(),S.m(c,d)))},d(x){x&&A(t),_.d(),S.d(),m=!1,ce(p)}}}function Xb(i){let e,t=[],n=new Map,a,s,r,o=i[2],l=c=>c[18].id;for(let c=0;c<o.length;c+=1){let d=iu(i,o,c),h=l(d);n.set(h,t[c]=nu(h,d))}return{c(){e=k("section");for(let c=0;c<t.length;c+=1)t[c].c();g(e,"class","subheading-zone")},m(c,d){D(c,e,d);for(let h=0;h<t.length;h+=1)t[h]&&t[h].m(e,null);s||(r=[ee(a=di.call(null,e,{items:i[2],flipDurationMs:au,dragDisabled:i[0],type:"subheading"})),H(e,"consider",i[3]),H(e,"finalize",i[4])],s=!0)},p(c,[d]){d&871&&(o=c[2],t=gt(t,d,l,1,c,o,n,e,io,nu,null,iu)),a&&Ie(a.update)&&d&5&&a.update.call(null,{items:c[2],flipDurationMs:au,dragDisabled:c[0],type:"subheading"})},i:N,o:N,d(c){c&&A(e);for(let d=0;d<t.length;d+=1)t[d].d();s=!1,ce(r)}}}var au=300;function qb(i,e,t){let n,{properties:a=[]}=e,s=Pe(),r=!0;function o(S){let{items:v,info:{source:x,trigger:P}}=S.detail;t(2,n=[...v]),x===ze.KEYBOARD&&P===qe.DRAG_STOPPED&&t(0,r=!0)}function l(S){let{items:v,info:{source:x}}=S.detail;t(2,n=[...v]),s("sorted",n.map(({prop:P})=>P)),x===ze.POINTER&&t(0,r=!0)}function c(S){S.preventDefault(),t(0,r=!1)}let d=S=>{t(2,n=n.filter(v=>v.id!=S.id)),s("sorted",n.map(({prop:v})=>v))},h=S=>{new Hs.ExtraButtonComponent(S).setIcon("trash")},u,f=S=>{t(1,u=S.id)},m=S=>{t(2,n=n.map(v=>v.id==S.id?{id:S.id,prop:S.prop}:v)),t(1,u=null),s("sorted",n.map(({prop:v})=>v))},p=S=>{new Hs.ExtraButtonComponent(S).setIcon("pencil")},y=S=>{new Hs.ExtraButtonComponent(S).setIcon("check")};function w(S,v){S[v].prop=this.value,t(2,n),t(12,a)}let _=S=>m(S),O=S=>f(S),E=S=>d(S);return i.$$set=S=>{"properties"in S&&t(12,a=S.properties)},i.$$.update=()=>{i.$$.dirty&4096&&t(2,n=[...a])},[r,u,n,o,l,c,d,h,f,m,p,y,a,w,_,O,E]}var al=class extends U{constructor(e){super(),G(this,e,qb,Xb,j,{properties:12},zb)}},su=al;var gu=require("obsidian");function Fn(i,{delay:e=0,duration:t=400,easing:n=Os,axis:a="y"}={}){let s=getComputedStyle(i),r=+s.opacity,o=a==="y"?"height":"width",l=parseFloat(s[o]),c=a==="y"?["top","bottom"]:["left","right"],d=c.map(w=>`${w[0].toUpperCase()}${w.slice(1)}`),h=parseFloat(s[`padding${d[0]}`]),u=parseFloat(s[`padding${d[1]}`]),f=parseFloat(s[`margin${d[0]}`]),m=parseFloat(s[`margin${d[1]}`]),p=parseFloat(s[`border${d[0]}Width`]),y=parseFloat(s[`border${d[1]}Width`]);return{delay:e,duration:t,easing:n,css:w=>`overflow: hidden;opacity: ${Math.min(w*20,1)*r};${o}: ${w*l}px;padding-${c[0]}: ${w*h}px;padding-${c[1]}: ${w*u}px;margin-${c[0]}: ${w*f}px;margin-${c[1]}: ${w*m}px;border-${c[0]}-width: ${w*p}px;border-${c[1]}-width: ${w*y}px;`}}var uu=require("obsidian");var Ub=require("obsidian");function cn(i){switch(i){case"inline":case"group":return{type:i,id:q(),properties:[],nested:[]};case"heading":return{type:"heading",id:q(),properties:[],size:1};case"property":return{type:"property",id:q(),properties:[]};case"saves":return{type:"saves",id:q(),properties:[]};case"traits":return{type:"traits",id:q(),properties:[]};case"spells":return{type:"spells",id:q(),properties:[]};case"subheading":return{type:"subheading",id:q(),properties:[]};case"image":return{type:"image",id:q(),properties:[]};case"table":return{type:"table",id:q(),properties:[],headers:[],calculate:!0};case"text":return{type:"text",id:q(),properties:[],text:null};case"ifelse":return{type:"ifelse",id:q(),conditions:[]};case"collapse":return{type:"collapse",id:q(),heading:null,hasRule:!1,conditioned:!1,nested:[cn("group")],open:!1};case"javascript":return{type:"javascript",id:q(),conditioned:!1,code:""};case"layout":return{type:"layout",id:q(),layout:null};case"action":return{type:"action",id:q(),icon:"clapperboard"}}}var jn=require("obsidian");var ru=require("@codemirror/view");function Vb(i){re(i,"svelte-1ss6215",".setting-item-info.svelte-1ss6215{width:100%}.setting-item-name.svelte-1ss6215{display:flex;align-items:center;gap:0.25rem}")}function Yb(i){let e;function t(s,r){return!s[0]||!s[0].condition?Jb:Kb}let n=t(i,-1),a=n(i);return{c(){e=k("div"),a.c(),g(e,"class","setting-item-name svelte-1ss6215")},m(s,r){D(s,e,r),a.m(e,null)},p(s,r){n===(n=t(s,r))&&a?a.p(s,r):(a.d(1),a=n(s),a&&(a.c(),a.m(e,null)))},d(s){s&&A(e),a.d()}}}function Gb(i){let e,t,n,a;return{c(){e=k("div")},m(s,r){D(s,e,r),n||(a=ee(t=i[4].call(null,e)),n=!0)},p:N,d(s){s&&A(e),n=!1,a()}}}function Kb(i){let e,t=i[0].condition+"",n;return{c(){e=k("code"),n=me(t)},m(a,s){D(a,e,s),b(e,n)},p(a,s){s&1&&t!==(t=a[0].condition+"")&&we(n,t)},d(a){a&&A(e)}}}function Jb(i){let e,t,n,a,s,r;return{c(){e=k("div"),n=W(),a=k("em"),a.textContent="No condition set"},m(o,l){D(o,e,l),D(o,n,l),D(o,a,l),s||(r=ee(t=Le.call(null,e,"alert-triangle")),s=!0)},p:N,d(o){o&&A(e),o&&A(n),o&&A(a),s=!1,r()}}}function e0(i){let e,t,n,a;return{c(){e=k("div"),g(e,"class","edit")},m(s,r){D(s,e,r),n||(a=[H(e,"click",i[8]),ee(t=i[5].call(null,e))],n=!0)},p:N,d(s){s&&A(e),n=!1,ce(a)}}}function t0(i){let e,t,n,a;return{c(){e=k("div"),g(e,"class","done")},m(s,r){D(s,e,r),n||(a=[H(e,"click",i[3]),ee(t=i[6].call(null,e))],n=!0)},p:N,d(s){s&&A(e),n=!1,ce(a)}}}function i0(i){let e,t,n,a,s,r,o,l;function c(p,y){return p[1]?Gb:Yb}let d=c(i,-1),h=d(i);function u(p,y){return p[1]?t0:e0}let f=u(i,-1),m=f(i);return{c(){e=k("div"),h.c(),t=W(),n=k("div"),m.c(),a=W(),s=k("div"),g(e,"class","setting-item-info svelte-1ss6215"),g(s,"class","delete"),g(n,"class","setting-item-control")},m(p,y){D(p,e,y),h.m(e,null),D(p,t,y),D(p,n,y),m.m(n,null),b(n,a),b(n,s),o||(l=[H(s,"click",i[9]),ee(r=i[7].call(null,s))],o=!0)},p(p,[y]){d===(d=c(p,y))&&h?h.p(p,y):(h.d(1),h=d(p),h&&(h.c(),h.m(e,null))),f===(f=u(p,y))&&m?m.p(p,y):(m.d(1),m=f(p),m&&(m.c(),m.m(n,a)))},i:N,o:N,d(p){p&&A(e),h.d(),p&&A(t),p&&A(n),m.d(),o=!1,ce(l)}}}function n0(i,e,t){let n=Pe(),{condition:a}=e,{editing:s=!1}=e,r;function o(){r&&(t(0,a.condition=r.state.doc.toString(),a),r.destroy()),n("done")}let l=m=>{let p=new jn.TextAreaComponent(m).setValue(a?.condition?a.condition:"");r=Ht(p.inputEl,ru.EditorView.updateListener.of(y=>{y.docChanged&&t(0,a.condition=y.state.doc.toString(),a)}))},c=m=>{new jn.ExtraButtonComponent(m).setIcon("pencil")},d=m=>{new jn.ExtraButtonComponent(m).setIcon("check")},h=m=>{new jn.ExtraButtonComponent(m).setIcon("trash")};yi(()=>{r?.destroy()});let u=()=>n("edit"),f=()=>n("delete");return i.$$set=m=>{"condition"in m&&t(0,a=m.condition),"editing"in m&&t(1,s=m.editing)},[a,s,n,o,l,c,d,h,u,f]}var sl=class extends U{constructor(e){super(),G(this,e,n0,i0,j,{condition:0,editing:1},Vb)}},ou=sl;function a0(i){re(i,"svelte-mn2hp8",".setting-item.svelte-mn2hp8{align-items:center}.icon.svelte-mn2hp8{display:flex;align-items:center}")}function lu(i,e,t){let n=i.slice();return n[15]=e[t],n}function cu(i){let e,t,n,a,s,r,o,l,c,d;function h(){return i[11](i[15])}function u(){return i[12](i[15])}function f(){return i[13](i[15])}return r=new ou({props:{condition:i[15].prop,editing:i[1]==i[15].id}}),r.$on("delete",h),r.$on("edit",u),r.$on("done",f),{c(){e=k("div"),t=k("div"),s=W(),se(r.$$.fragment),o=W(),g(t,"class","icon svelte-mn2hp8"),g(t,"style",n=i[2]?"cursor: grab":"cursor: grabbing"),g(e,"class","setting-item svelte-mn2hp8")},m(m,p){D(m,e,p),b(e,t),b(e,s),ie(r,e,null),b(e,o),l=!0,c||(d=[ee(a=Le.call(null,t,"grip-vertical")),H(t,"mousedown",i[6]),H(t,"touchstart",i[6])],c=!0)},p(m,p){i=m,(!l||p&4&&n!==(n=i[2]?"cursor: grab":"cursor: grabbing"))&&g(t,"style",n);let y={};p&8&&(y.condition=i[15].prop),p&10&&(y.editing=i[1]==i[15].id),r.$set(y)},i(m){l||(M(r.$$.fragment,m),l=!0)},o(m){Q(r.$$.fragment,m),l=!1},d(m){m&&A(e),ne(r),c=!1,ce(d)}}}function hu(i,e){let t,n=e[1],a,s,r=cu(e);return{key:i,first:null,c(){t=Oe(),r.c(),a=Oe(),this.first=t},m(o,l){D(o,t,l),r.m(o,l),D(o,a,l),s=!0},p(o,l){e=o,l&2&&j(n,n=e[1])?(he(),Q(r,1,1,N),de(),r=cu(e),r.c(),M(r,1),r.m(a.parentNode,a)):r.p(e,l)},i(o){s||(M(r),s=!0)},o(o){Q(r),s=!1},d(o){o&&A(t),o&&A(a),r.d(o)}}}function s0(i){let e,t,n,a,s,r=[],o=new Map,l,c,d,h,u=i[3],f=m=>m[15].id;for(let m=0;m<u.length;m+=1){let p=lu(i,u,m),y=f(p);o.set(y,r[m]=hu(y,p))}return{c(){e=k("div"),n=W(),a=k("div"),s=k("section");for(let m=0;m<r.length;m+=1)r[m].c();g(s,"class","subheading-zone"),g(a,"class","additional")},m(m,p){D(m,e,p),D(m,n,p),D(m,a,p),b(a,s);for(let y=0;y<r.length;y+=1)r[y]&&r[y].m(s,null);c=!0,d||(h=[ee(t=i[9].call(null,e)),ee(l=di.call(null,s,{items:i[3],flipDurationMs:du,dragDisabled:i[2],type:"subheading"})),H(s,"consider",i[4]),H(s,"finalize",i[5])],d=!0)},p(m,[p]){p&462&&(u=m[3],he(),r=gt(r,p,f,1,m,u,o,s,Ji,hu,null,lu),de()),l&&Ie(l.update)&&p&12&&l.update.call(null,{items:m[3],flipDurationMs:du,dragDisabled:m[2],type:"subheading"})},i(m){if(!c){for(let p=0;p<u.length;p+=1)M(r[p]);c=!0}},o(m){for(let p=0;p<r.length;p+=1)Q(r[p]);c=!1},d(m){m&&A(e),m&&A(n),m&&A(a);for(let p=0;p<r.length;p+=1)r[p].d();d=!1,ce(h)}}}var du=300;function r0(i,e,t){let n,a,s=N,r=()=>(s(),s=Tt(o,E=>t(10,a=E)),o);i.$$.on_destroy.push(()=>s());let{conditions:o}=e;r();let l=null,c=Pe(),d=!0;function h(E){let{items:S,info:{source:v,trigger:x}}=E.detail;t(3,n=[...S]),v===ze.KEYBOARD&&x===qe.DRAG_STOPPED&&t(2,d=!0)}function u(E){let{items:S,info:{source:v}}=E.detail;t(3,n=[...S]),c("sorted",n.map(({prop:x})=>x)),v===ze.POINTER&&t(2,d=!0)}function f(E){E.preventDefault(),t(2,d=!1)}let m=E=>{t(3,n=n.filter(S=>S.id!=E.id)),c("sorted",n.map(({prop:S})=>S))},p=E=>{t(3,n=n.map(S=>S.id==E.id?{id:E.id,prop:E.prop}:S)),t(1,l=null),c("sorted",n.map(({prop:S})=>S))},y=E=>{new uu.Setting(E).setName("Add new condition").addButton(S=>S.setIcon("plus").onClick(()=>{let v=q();t(1,l=v),t(3,n=[...n,{prop:{nested:[cn("group")],condition:null},id:v}]),c("sorted",n.map(({prop:x})=>x))}))},w=E=>m(E),_=E=>t(1,l=E.id),O=E=>p(E);return i.$$set=E=>{"conditions"in E&&r(t(0,o=E.conditions))},i.$$.update=()=>{i.$$.dirty&1024&&t(3,n=a.map(E=>({prop:E,id:q()})))},[o,l,d,n,h,u,f,m,p,y,a,w,_,O]}var rl=class extends U{constructor(e){super(),G(this,e,r0,s0,j,{conditions:0},a0)}},fu=rl;function o0(i){re(i,"svelte-131x181",".condition-builder-container.svelte-131x181 .setting-item.svelte-131x181{align-items:flex-start}")}function mu(i){let e,t,n;return{c(){e=k("div"),e.innerHTML=`<span>Conditions are used to determine what block is
rendered. Conditions are evaluated top to bottom - the
first to evaluate to</span>
<code>true</code>
<span>is the condition that will be used. If the last
condition is left blank and no others were true, it will
be used.</span>
<br/>
<br/>
<span>The expression receives the</span>
<code>monster</code>
<span>parameter, which can be used to access properties of the
monster being rendered.</span>
<br/>
<br/>
<strong>All conditions must return a true/false value. For
example:</strong>
<code>return monster.ac &gt; 1</code>`,g(e,"class","setting-item-description")},m(a,s){D(a,e,s),n=!0},i(a){n||(Dt(()=>{n&&(t||(t=Ki(e,Fn,{},!0)),t.run(1))}),n=!0)},o(a){t||(t=Ki(e,Fn,{},!1)),t.run(0),n=!1},d(a){a&&A(e),a&&t&&t.end()}}}function l0(i){let e,t,n,a,s,r,o,l,c,d,h,u,f=i[1]&&mu(i);return c=new fu({props:{conditions:i[2]}}),c.$on("sorted",i[7]),{c(){e=k("div"),t=k("div"),n=k("div"),f&&f.c(),a=W(),s=k("div"),r=k("div"),l=W(),se(c.$$.fragment),g(n,"class","setting-item-info"),g(s,"class","setting-item-control"),g(t,"class","setting-item svelte-131x181"),g(e,"class","condition-builder-container svelte-131x181")},m(m,p){D(m,e,p),b(e,t),b(t,n),f&&f.m(n,null),b(t,a),b(t,s),b(s,r),b(e,l),ie(c,e,null),d=!0,h||(u=[ee(o=i[4].call(null,r)),H(r,"click",i[6])],h=!0)},p(m,[p]){m[1]?f?p&2&&M(f,1):(f=mu(m),f.c(),M(f,1),f.m(n,null)):f&&(he(),Q(f,1,1,()=>{f=null}),de())},i(m){d||(M(f),M(c.$$.fragment,m),d=!0)},o(m){Q(f),Q(c.$$.fragment,m),d=!1},d(m){m&&A(e),f&&f.d(),ne(c),h=!1,ce(u)}}}function c0(i,e,t){let n,{plugin:a}=e,{block:s}=e,r=Ne(s.conditions),o=async()=>{t(5,a.settings.hideConditionHelp=!a.settings.hideConditionHelp,a),await a.saveSettings()},l=h=>{new gu.ExtraButtonComponent(h).setIcon("help-circle")},c=()=>o(),d=h=>t(0,s.conditions=[...h.detail],s);return i.$$set=h=>{"plugin"in h&&t(5,a=h.plugin),"block"in h&&t(0,s=h.block)},i.$$.update=()=>{i.$$.dirty&32&&t(1,n=a.settings.hideConditionHelp)},[s,n,r,o,l,a,c,d]}var ol=class extends U{constructor(e){super(),G(this,e,c0,l0,j,{plugin:5,block:0},o0)}},pu=ol;var un=require("@codemirror/view");var dl=It(Fs()),js=class extends dl.FuzzyInputSuggest{getItemText(e){return e.name}renderNote(e,t){}renderTitle(e,t){this.renderMatches(e,t.item.name,t.match.matches)}},Zs=class extends dl.FuzzyInputSuggest{renderNote(e,t){}renderTitle(e,t){this.renderMatches(e,t.item,t.match.matches)}getItemText(e){return e}};var wu=require("obsidian"),vt=class extends wu.Modal{constructor(t){super(t.app);this.plugin=t;this.modalEl.addClass("fantasy-statblocks-modal"),t.register(()=>this.close())}};function Us(i,e,t){switch(e.type){case"group":case"inline":return new ul(i,e);case"action":return new bl(i,e);case"collapse":return new fl(i,e);case"ifelse":return new pl(i,e);case"javascript":return new ml(i,e);case"heading":return new yl(i,e);case"layout":return new gl(i,e,t);case"property":return new vl(i,e);case"saves":return new kl(i,e);case"spells":return new wl(i,e);case"subheading":return new _l(i,e);case"table":return new Ol(i,e);case"traits":return new Sl(i,e);case"text":return new xl(i,e);default:return new hn(i,e)}}var Fi=class extends vt{constructor(t,n){super(t);this.plugin=t;n&&(this.block=(0,_u.default)(n)),this.containerEl.addClass("statblock-edit-block")}onOpen(){this.titleEl.setText("Edit Block"),this.display()}buildButtons(t){t.empty(),new pe.Setting(t).addButton(n=>n.setCta().setIcon("checkmark").setTooltip("Save").onClick(()=>{this.saved=!0,this.close()})).addExtraButton(n=>n.setIcon("cross").setTooltip("Cancel").onClick(()=>{this.close()}))}buildProperty(t){}},ul=class extends Fi{async display(){this.contentEl.empty(),new pe.Setting(this.contentEl).setName("Section Heading").setDesc("This text will be used for the section heading. Can be left blank.").addText(e=>{e.setValue(this.block.heading).onChange(t=>this.block.heading=t)}),new pe.Setting(this.contentEl).setName("Has Rule").setDesc("If present, the block will have a horizontal rule placed after it.").addToggle(e=>{e.setValue(this.block.hasRule).onChange(t=>this.block.hasRule=t)}),new pe.Setting(this.contentEl).setName("CSS Container Class").setDesc("All nested elements inside this group container will receive this CSS class. If blank, no class will be applied.").addText(e=>{e.setValue(this.block.cls).onChange(t=>this.block.cls=t)}),this.buildConditions(this.contentEl.createDiv()),this.buildButtons(this.contentEl.createDiv())}buildConditions(e){e.empty();let t=this.block;new pe.Setting(e).setName("Conditional").setDesc("The block will not be added if the associated properties are not present.").addToggle(n=>{n.setValue(t.conditioned).onChange(a=>{t.conditioned=a,this.buildConditions(e)})})}},fl=class extends Fi{async display(){this.contentEl.empty(),new pe.Setting(this.contentEl).setName("Section Heading").setDesc("This text will be used for the section heading. Can be left blank.").addText(e=>{e.setValue(this.block.heading).onChange(t=>this.block.heading=t)}),new pe.Setting(this.contentEl).setName("Open by Default").setDesc("The block will start open.").addToggle(e=>{e.setValue(this.block.open).onChange(t=>this.block.open=t)}),new pe.Setting(this.contentEl).setName("Has Rule").setDesc("If present, the block will have a horizontal rule placed after it.").addToggle(e=>{e.setValue(this.block.hasRule).onChange(t=>this.block.hasRule=t)}),this.buildButtons(this.contentEl.createDiv())}},ml=class extends Fi{async display(){this.contentEl.empty(),new pe.Setting(this.contentEl).setName("JavaScript").setHeading().setDesc(createFragment(t=>{t.createSpan({text:"JavaScript blocks can be used to do highly advanced HTML elements. The JavaScript code will be provided the "}),t.createEl("code",{text:"monster"}),t.createSpan({text:" and "}),t.createEl("code",{text:"property"}),t.createSpan({text:"parameters and should return a HTML element, which will be attached to the block's container element."})}));let e=new pe.TextAreaComponent(this.contentEl).setValue(this.block.code);e.inputEl.addClass("statblock-textarea"),this.editor=Ht(e.inputEl,un.EditorView.updateListener.of(t=>{t.docChanged&&(this.block.code=t.state.doc.toString())})),this.buildButtons(this.contentEl.createDiv())}},gl=class extends Fi{constructor(t,n,a){super(t,n);this.layout=a}hasLayoutNestedAlready(t){for(let n of t)if(n.type=="layout"&&n.layout==this.layout||"nested"in n&&this.hasLayoutNestedAlready(n.nested))return!0;return!1}async display(){this.contentEl.empty(),new pe.Setting(this.contentEl).setName("Layout to Insert").addDropdown(t=>{for(let n of this.plugin.manager.getAllLayouts())n.id!=this.layout&&(this.hasLayoutNestedAlready(n.blocks)||t.addOption(n.id,n.name));this.block.layout&&t.setValue(this.block.layout),t.onChange(n=>{this.block.layout=n})}),this.buildButtons(this.contentEl.createDiv())}},pl=class extends Fi{async display(){this.contentEl.empty(),this.buildConditions(this.contentEl.createDiv()),this.buildButtons(this.contentEl.createDiv())}buildConditions(e){new pu({target:e,props:{plugin:this.plugin,block:this.block}})}},qs,Ou,Xs=class extends Fi{constructor(){super(...arguments);Ee(this,qs);this.propertiesEl=createDiv("block-properties-container");this.separatorEl=createDiv("block-separator-container");this.conditionsEl=createDiv("block-conditions-container");this.diceEl=createDiv("block-dice-container");this.advancedEl=createEl("details",{cls:"statblock-nested-settings",attr:{...this.plugin.settings.showAdvanced?{open:!0}:{}}});this.buttonsEl=createDiv("block-buttons-container")}async display(){this.containerEl.addClass("statblock-block-editor"),this.contentEl.empty(),this.contentEl.appendChild(this.propertiesEl),this.contentEl.appendChild(this.separatorEl),this.contentEl.appendChild(this.conditionsEl),this.contentEl.appendChild(this.diceEl),this.contentEl.appendChild(this.advancedEl),this.contentEl.appendChild(this.buttonsEl),this.buildProperties(this.propertiesEl),this.buildSeparator(this.separatorEl),this.buildConditions(this.conditionsEl),this.buildDice(this.diceEl),Qe(this,qs,Ou).call(this,this.advancedEl),this.buildButtons(this.buttonsEl)}onClose(){this.editor?.destroy()}buildProperties(t){}buildSeparator(t){}buildConditions(t){}buildDice(t){}};qs=new WeakSet,Ou=function(t){t.empty(),t.ontoggle=()=>{this.plugin.settings.showAdvanced=t.open,this.plugin.saveSettings()};let n=t.createEl("summary");new pe.Setting(n).setHeading().setName("Advanced Settings"),n.createDiv("collapser").createDiv("handle"),this.buildAdvanced(t.createDiv())};var bl=class extends Xs{buildProperties(e){e.empty(),new pe.Setting(e).setName("Icon").setDesc("Choose the icon to use for the button.").addText(t=>{t.setValue(this.block.icon);let n=(0,pe.getIconIds)().map(s=>s.replace(/^lucide-/,""));new Zs(this.app,t,n).onSelect(async s=>{this.block.icon=s.item,this.buildProperties(e)}),t.inputEl.onblur=async()=>{let s=t.inputEl.value?.trim()?t.inputEl.value.trim():"/";this.block.icon=s,this.buildProperties(e)}}).addExtraButton(t=>{t.setIcon(this.block.icon).setDisabled(!0)}),new pe.Setting(e).setName("Action").setDesc("Choose a Command to run when this action is executed.").addText(t=>{t.setValue(this.block.action);let n=this.app.commands.listCommands();new js(this.app,t,n).onSelect(async s=>{this.block.action=s.item.id}),t.inputEl.onblur=async()=>{let s=t.inputEl.value?.trim()?t.inputEl.value.trim():"/";this.block.action=n.find(r=>r.name.toLowerCase()===s?.toLowerCase())?.id}})}buildAdvanced(e){e.empty(),new pe.Setting(e).setHeading().setName("Callback").setDesc(createFragment(n=>{n.createSpan({text:"Executing the action will run the callback. Any registered commands will "}),n.createEl("strong",{text:"not"}),n.createSpan({text:" be ran."}),n.createEl("br"),n.createSpan({text:"The callback will receive the "}),n.createEl("code",{text:"monster"}),n.createSpan({text:" parameter. "})}));let t=new pe.TextAreaComponent(e).setValue(this.block.callback);t.inputEl.addClass("statblock-textarea"),this.editor=Ht(t.inputEl,un.EditorView.updateListener.of(n=>{n.docChanged&&(this.block.callback=n.state.doc.toString())}))}},hn=class extends Xs{buildProperties(e){e.empty();let t=this.block;new pe.Setting(e).setName("Link Monster Property").addText(n=>n.setValue(t.properties[0]).onChange(a=>{t.properties[0]=a}))}buildAdvanced(e){if(e.empty(),this.plugin.canUseDiceRoller){new pe.Setting(e).setHeading().setName("Dice Callback").setDesc(createFragment(n=>{n.createSpan({text:"The block will run the callback and use the returned values for the dice strings."}),n.createEl("br"),n.createSpan({text:"The callback will receive the "}),n.createEl("code",{text:"monster"}),n.createSpan({text:" and "}),n.createEl("code",{text:"property"}),n.createSpan({text:"parameters. Dice callbacks should return an array of strings and objects, with the objects defining the dice rolls:"}),n.createEl("br"),pe.MarkdownRenderer.render(this.plugin.app,"```ts\ninterface DiceCallbackObject {\n text: string // string to be parsed into a dice roll\n original?: string // optional, shown in parenthesis\n}\n```",n.createDiv(),"",new pe.Component),n.createEl("br"),n.createEl("span",{text:"For example: "}),n.createEl("br"),pe.MarkdownRenderer.render(this.plugin.app,'```ts\nconst diceText = monster.stats[5] + "d20 + 2";\nreturn ["The monster guesses you have: ", { text: diceText }, " freckles."];\n```',n.createDiv(),"",new pe.Component)}));let t=new pe.TextAreaComponent(e).setValue(this.block.diceCallback);t.inputEl.addClasses(["statblock-textarea","statblock-textarea-small"]),this.editor=Ht(t.inputEl,un.EditorView.updateListener.of(n=>{n.docChanged&&(this.block.diceCallback=n.state.doc.toString())}))}}buildSeparator(e){}buildConditions(e){e.empty();let t=this.block;new pe.Setting(e).setName("Conditional").setDesc("The block will not be added if the associated properties are not present.").addToggle(n=>{n.setValue(t.conditioned).onChange(a=>{t.conditioned=a,this.buildConditions(e)})}),this.block.conditioned||new pe.Setting(e).setName("Fallback").setDesc("If not present, this text will be displayed.").addText(n=>{t.fallback||(t.fallback="-"),n.setValue(t.fallback).onChange(a=>{t.fallback=a})}),new pe.Setting(e).setName("Has Rule").setDesc("If present, the block will have a horizontal rule placed after it.").addToggle(n=>{n.setValue(t.hasRule).onChange(a=>t.hasRule=a)})}buildDice(e){e.empty();let t=this.block;this.plugin.canUseDiceRoller&&(new pe.Setting(e).setName("Parse for Dice").setDesc("The plugin will attempt to add dice rollers as specified.").addToggle(n=>n.setValue(t.dice).onChange(a=>{t.dice=a,this.buildDice(e)})),t.dice&&new pe.Setting(e.createDiv()).setName("Link Dice to Property").setDesc("The dice roller will parse this property instead of the original.").addText(n=>{n.setValue(t.diceProperty).onChange(a=>{t.diceProperty=a})}))}},dn=class extends hn{buildAdvanced(e){super.buildAdvanced(e)}},yl=class extends hn{buildProperties(e){super.buildProperties(e),new pe.Setting(e).setName("Header Size").setDesc("The heading will use this size.").addDropdown(t=>{this.block.size||this.block.size==1,t.addOptions({1:"H1",2:"H2",3:"H3",4:"H4",5:"H5",6:"H6"}).setValue(`${this.block.size}`).onChange(n=>this.block.size=Number(n))})}},vl=class extends dn{buildAdvanced(e){super.buildAdvanced(e),new pe.Setting(e).setHeading().setName("Callback").setDesc(createFragment(n=>{n.createSpan({text:"The block will run the callback and use the returned string as the property."}),n.createEl("br"),n.createSpan({text:"The callback will receive the "}),n.createEl("code",{text:"monster"}),n.createSpan({text:" parameter. The callback should return a string. For example: "}),n.createEl("code",{text:"return monster.name"}),n.createEl("br"),n.createEl("strong",{text:"Please Note: This will not run if a dice callback is provided."})}));let t=new pe.TextAreaComponent(e).setValue(this.block.callback);t.inputEl.addClass("statblock-textarea"),this.editor=Ht(t.inputEl,un.EditorView.updateListener.of(n=>{n.docChanged&&(this.block.callback=n.state.doc.toString())}))}onClose(){this.editor?.destroy()}buildProperties(e){super.buildProperties(e),new pe.Setting(e).setName("Do Not Add Property as CSS Class").setDesc("Enable this to prevent adding the property to the containing HTML element as a CSS class. This can be used to avoid collisions with native Obsidian CSS.").addToggle(t=>{t.setValue(this.block.doNotAddClass).onChange(n=>{this.block.doNotAddClass=n,this.display()})}),new pe.Setting(e).setName("Display Text").setDesc("This text will be used for the property name.").addText(t=>{t.setValue(this.block.display).onChange(n=>this.block.display=n)})}},kl=class extends dn{buildProperties(e){super.buildProperties(e),new pe.Setting(e).setName("Display Text").setDesc("This text will be used for the property name.").addText(t=>{t.setValue(this.block.display).onChange(n=>this.block.display=n)})}},wl=class extends dn{buildProperties(e){super.buildProperties(e),new pe.Setting(e).setName("Trait Name").setDesc("Name to display for the Spellcasting trait. Defaults to Spellcasting if not provided.").addText(t=>{t.setValue(this.block.heading).onChange(n=>this.block.heading=n)})}},_l=class extends hn{buildProperties(e){e.empty();let t=this.block,n=e.createDiv("statblock-additional-container"),a="";new pe.Setting(n).setHeading().setName("Link Monster Properties").addText(o=>o.setPlaceholder("property").setValue(a).onChange(l=>a=l)).addExtraButton(o=>o.setIcon("plus-with-circle").onClick(()=>{if(!a||!a.length){new pe.Notice("A valid property must be supplied.");return}t.properties.push(a),this.buildProperties(e)}));let s=n.createDiv("additional");new su({target:s,props:{properties:this.block.properties.map(o=>({prop:o,id:q()}))}}).$on("sorted",o=>{t.properties=[...o.detail]})}buildSeparator(e){e.empty(),new pe.Setting(e).setName("Separator").setDesc("Text separating properties").addText(t=>{t.setValue(this.block.separator).onChange(n=>{if(n===" "){this.block.separator=n;return}this.block.separator=(n??"").trim().length===0?", ":n})})}},Ol=class extends hn{buildAdvanced(e){super.buildAdvanced(e),new pe.Setting(e).setHeading().setName("Ability Modifier Calculation").setDesc(createFragment(n=>{n.createSpan({text:"Allows a custom modifier for the stat."}),n.createEl("br"),n.createSpan({text:"Variables "}),n.createEl("code",{text:"stat"}),n.createSpan({text:" and "}),n.createEl("code",{text:"monster"}),n.createSpan({text:"are accessible, use these to calculate the modifier."})}));let t=new pe.TextAreaComponent(e).setValue(this.block.modifier);t.inputEl.addClasses(["statblock-textarea","statblock-textarea-small"]),this.editor=Ht(t.inputEl,un.EditorView.updateListener.of(n=>{n.docChanged&&(this.block.modifier=n.state.doc.toString())}))}buildProperties(e){super.buildProperties(e);let t=e.createDiv("statblock-additional-container"),n="";new pe.Setting(t).setHeading().setName("Table Headers").addText(s=>s.setPlaceholder("header").setValue(n).onChange(r=>n=r)).addExtraButton(s=>s.setIcon("plus-with-circle").onClick(()=>{if(!n||!n.length){new pe.Notice("A valid property must be supplied.");return}this.block.headers.push(n),this.buildProperties(e)}));let a=t.createDiv("additional");new tu({target:a,props:{headers:this.block.headers}}).$on("sorted",s=>{this.block.headers=[...s.detail?.map(r=>r.name)??[]]}),new pe.Setting(e).setName("Calculate Modifiers").setDesc("The block will attempt to calculate modifiers for table values.").addToggle(s=>{s.setValue(this.block.calculate).onChange(r=>{this.block.calculate=r})})}},Sl=class extends dn{buildProperties(e){super.buildProperties(e),new pe.Setting(e).setName("Do Not Add Property as CSS Class").setDesc("Disable this to prevent adding the property to the containing HTML element as a CSS class. This can be used to avoid collisions with native Obsidian CSS.").addToggle(n=>{n.setValue(this.block.doNotAddClass).onChange(a=>{this.block.doNotAddClass=a,this.display()})}),new pe.Setting(e).setName("Use Monster Property for Heading").setDesc("The Section heading will be set to the value of the specified property.").addToggle(n=>{n.setValue(this.block.headingProp).onChange(a=>{this.block.headingProp=a,this.display()})}),new pe.Setting(e).setName("Section Heading").setDesc(this.block.headingProp?"The section will use this property for the section heading. If the property does not exist or is blank, the section heading will not appear.":"This text will be used for the section heading. Can be left blank.").addText(n=>{n.setValue(this.block.heading).onChange(a=>this.block.heading=a)}),new pe.Setting(e).setName("Section Subheading Text").setDesc(createFragment(n=>{n.createSpan({text:"Text entered here will appear directly after the section heading, before the actual traits. Use "}),n.createEl("code",{text:"{{monster}}"}),n.createSpan({text:" to insert the current monster's name."})})).controlEl.detach(),new pe.TextAreaComponent(this.contentEl).setValue(this.block.subheadingText).onChange(n=>this.block.subheadingText=n)}buildAdvanced(e){super.buildAdvanced(e),new pe.Setting(e).setHeading().setName("Callback").setDesc(createFragment(n=>{n.createSpan({text:"The block will run the callback and use the returned string as the property."}),n.createEl("br"),n.createSpan({text:"The callback will receive the "}),n.createEl("code",{text:"monster"}),n.createSpan({text:" and "}),n.createEl("code",{text:"property"}),n.createSpan({text:" parameters. The callback should return a string. For example: "}),n.createEl("code",{text:"return monster.name"}),n.createEl("br"),n.createEl("strong",{text:"Please Note: This will not run if a dice callback is provided."})}));let t=new pe.TextAreaComponent(e).setValue(this.block.callback);t.inputEl.addClass("statblock-textarea"),this.editor=Ht(t.inputEl,un.EditorView.updateListener.of(n=>{n.docChanged&&(this.block.callback=n.state.doc.toString())}))}},xl=class extends dn{buildAdvanced(e){super.buildAdvanced(e),new pe.Setting(e).setHeading().setName("Text to Show").setDesc(createFragment(t=>{t.createSpan({text:"The block will "}),t.createEl("strong",{text:"always"}),t.createSpan({text:" display the text entered here."})})),new pe.TextAreaComponent(e).setValue(this.block.text).onChange(t=>{this.block.text=t})}buildProperties(e){super.buildProperties(e),new pe.Setting(e).setName("Use Monster Property for Heading").setDesc("The Section heading will be set to the value of the specified property.").addToggle(t=>{t.setValue(this.block.headingProp).onChange(n=>{this.block.headingProp=n,this.display()})}),new pe.Setting(e).setName("Section Heading").setDesc(this.block.headingProp?"The section will use this property for the section heading. If the property does not exist or is blank, the section heading will not appear.":"This text will be used for the section heading. Can be left blank.").addText(t=>{t.setValue(this.block.heading).onChange(n=>this.block.heading=n)})}};function w0(i){re(i,"svelte-1e3b779",".statblock-creator-container.svelte-1e3b779.svelte-1e3b779{display:flex;justify-content:space-between;width:100%;height:100%;gap:0.25rem}body:not(.is-mobile) .statblock-creator-container.svelte-1e3b779:not(:hover)>.icons.svelte-1e3b779{visibility:hidden}.statblock-creator-block.svelte-1e3b779.svelte-1e3b779{width:100%}.icons.svelte-1e3b779.svelte-1e3b779{display:flex;justify-content:flex-end}.statblock-creator-container.svelte-1e3b779 .icons.svelte-1e3b779{align-items:center}.icon.svelte-1e3b779:not(:first-child) .clickable-icon{margin-left:0}.layout.svelte-1e3b779.svelte-1e3b779{border:2px dashed grey}")}function _0(i){let e,t;return e=new Gd({props:{block:i[0],plugin:i[1]}}),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},p(n,a){let s={};a&1&&(s.block=n[0]),a&2&&(s.plugin=n[1]),e.$set(s)},i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function O0(i){let e;return{c(){e=me("JavaScript")},m(t,n){D(t,e,n)},p:N,i:N,o:N,d(t){t&&A(e)}}}function Su(i){let e,t,n,a,s=[O0,_0],r=[];function o(l,c){return l[0].type=="javascript"?0:l[0].type!="ifelse"&&l[0].type!="collapse"?1:-1}return~(t=o(i,-1))&&(n=r[t]=s[t](i)),{c(){e=k("div"),n&&n.c(),g(e,"class","statblock-creator-block svelte-1e3b779"),oe(e,"layout",i[0].type=="layout")},m(l,c){D(l,e,c),~t&&r[t].m(e,null),a=!0},p(l,c){let d=t;t=o(l,c),t===d?~t&&r[t].p(l,c):(n&&(he(),Q(r[d],1,1,()=>{r[d]=null}),de()),~t?(n=r[t],n?n.p(l,c):(n=r[t]=s[t](l),n.c()),M(n,1),n.m(e,null)):n=null),(!a||c&1)&&oe(e,"layout",l[0].type=="layout")},i(l){a||(M(n),a=!0)},o(l){Q(n),a=!1},d(l){l&&A(e),~t&&r[t].d()}}}function S0(i){let e,t=i[0],n,a,s,r,o,l,c,d,h,u,f=Su(i);return{c(){e=k("div"),f.c(),n=W(),a=k("div"),s=k("div"),o=W(),l=k("div"),g(s,"class","icon svelte-1e3b779"),g(l,"class","icon svelte-1e3b779"),g(a,"class","icons svelte-1e3b779"),g(e,"class","statblock-creator-container svelte-1e3b779")},m(m,p){D(m,e,p),f.m(e,null),b(e,n),b(e,a),b(a,s),b(a,o),b(a,l),d=!0,h||(u=[ee(r=i[2].call(null,s)),ee(c=i[3].call(null,l))],h=!0)},p(m,[p]){p&1&&j(t,t=m[0])?(he(),Q(f,1,1,N),de(),f=Su(m),f.c(),M(f,1),f.m(e,n)):f.p(m,p)},i(m){d||(M(f),d=!0)},o(m){Q(f),d=!1},d(m){m&&A(e),f.d(m),h=!1,ce(u)}}}function x0(i,e,t){let{block:n}=e,{plugin:a}=e,{layout:s}=e,r=Pe(),o=()=>{let h=Us(a,n,s);h.onClose=()=>{h.saved&&r("edited",h.block)},h.open()},l=h=>{new Vs.ExtraButtonComponent(h).setIcon("pencil").setTooltip("Edit Block").onClick(()=>{o()})},c=h=>{new Vs.ExtraButtonComponent(h).setIcon("plus").setTooltip("Add Condition").onClick(()=>{})},d=h=>{new Vs.ExtraButtonComponent(h).setIcon("trash").setTooltip("Delete Block").onClick(()=>r("trash",n))};return i.$$set=h=>{"block"in h&&t(0,n=h.block),"plugin"in h&&t(1,a=h.plugin),"layout"in h&&t(4,s=h.layout)},[n,a,l,d,s]}var Tl=class extends U{constructor(e){super(),G(this,e,x0,S0,j,{block:0,plugin:1,layout:4},w0)}},xu=Tl;var fn=require("obsidian");function T0(i){re(i,"svelte-1swdhxf",".min-height{min-height:2rem}.block.svelte-1swdhxf.svelte-1swdhxf{display:flex;justify-content:flex-start;align-items:center}.item.svelte-1swdhxf.svelte-1swdhxf{display:grid;grid-template-columns:1fr;width:100%;padding:2px;margin:2px}.group.svelte-1swdhxf.svelte-1swdhxf{display:grid;grid-template-columns:1fr;border:2px dashed grey;min-height:2rem}.dropdown-icon.svelte-1swdhxf.svelte-1swdhxf{align-self:flex-start}.inline.svelte-1swdhxf.svelte-1swdhxf{display:flex;justify-content:space-between;flex-wrap:wrap;width:100%;height:100%;min-width:2rem}.action-icon.svelte-1swdhxf.svelte-1swdhxf{display:flex;align-items:center}.icon.svelte-1swdhxf.svelte-1swdhxf{display:flex}.statblock-creator-container.svelte-1swdhxf.svelte-1swdhxf{display:flex;justify-content:space-between;width:100%;height:100%;gap:0.25rem}.statblock-creator-container.action-container.svelte-1swdhxf.svelte-1swdhxf{justify-content:flex-start}body:not(.is-mobile) .statblock-creator-container.svelte-1swdhxf:not(:hover)>.icons.svelte-1swdhxf{visibility:hidden}.statblock-creator-block.svelte-1swdhxf.svelte-1swdhxf{width:100%}.icons.svelte-1swdhxf.svelte-1swdhxf{display:flex;justify-content:flex-end}.statblock-creator-container.svelte-1swdhxf .icons.svelte-1swdhxf{align-items:center}.icon.svelte-1swdhxf:not(:first-child) .clickable-icon{margin-left:0}.if-else-block-container.svelte-1swdhxf.svelte-1swdhxf{display:grid;grid-template-columns:1fr;border:2px solid grey;border-radius:0.25rem;min-height:2rem;padding:0.25rem}.collapse-container.svelte-1swdhxf.svelte-1swdhxf{display:grid;grid-template-columns:auto 1fr;align-items:center;gap:0.25rem}.collapsible.svelte-1swdhxf.svelte-1swdhxf{border-left:2px solid grey;padding-left:0.25rem}")}function Tu(i,e,t){let n=i.slice();return n[33]=e[t],n[34]=e,n[35]=t,n}function Cu(i,e,t){let n=i.slice();return n[36]=e[t].condition,n[37]=e[t].nested,n[38]=e,n[39]=t,n}function Au(i){let e,t,n,a,s;return{c(){e=k("div"),g(e,"class","icon svelte-1swdhxf"),g(e,"style",t=i[6]?"cursor: grab":"cursor: grabbing")},m(r,o){D(r,e,o),a||(s=[ee(n=Le.call(null,e,"grip-vertical")),H(e,"mousedown",i[9]),H(e,"touchstart",i[9])],a=!0)},p(r,o){o[0]&64&&t!==(t=r[6]?"cursor: grab":"cursor: grabbing")&&g(e,"style",t)},d(r){r&&A(e),a=!1,ce(s)}}}function C0(i){let e,t,n;return t=new xu({props:{plugin:i[1],block:i[33],layout:i[2]}}),t.$on("trash",i[29]),t.$on("edited",i[30]),{c(){e=k("div"),se(t.$$.fragment),g(e,"class","item svelte-1swdhxf")},m(a,s){D(a,e,s),ie(t,e,null),n=!0},p(a,s){let r={};s[0]&2&&(r.plugin=a[1]),s[0]&33&&(r.block=a[33]),s[0]&4&&(r.layout=a[2]),t.$set(r)},i(a){n||(M(t.$$.fragment,a),n=!0)},o(a){Q(t.$$.fragment,a),n=!1},d(a){a&&A(e),ne(t)}}}function A0(i){let e,t,n,a,s,r,o,l,c,d,h,u;function f(){return i[27](i[33])}function m(){return i[28](i[33])}return{c(){e=k("div"),t=k("div"),a=W(),s=k("div"),r=k("div"),l=W(),c=k("div"),g(t,"class","action-icon svelte-1swdhxf"),g(r,"class","icon svelte-1swdhxf"),g(c,"class","icon svelte-1swdhxf"),g(s,"class","icons svelte-1swdhxf"),g(e,"class","action-container statblock-creator-container svelte-1swdhxf")},m(p,y){D(p,e,y),b(e,t),b(e,a),b(e,s),b(s,r),b(s,l),b(s,c),h||(u=[ee(n=Le.call(null,t,i[33].icon)),ee(o=i[14].call(null,r)),H(r,"click",f),ee(d=i[15].call(null,c)),H(c,"click",m)],h=!0)},p(p,y){i=p,n&&Ie(n.update)&&y[0]&33&&n.update.call(null,i[33].icon)},i:N,o:N,d(p){p&&A(e),h=!1,ce(u)}}}function D0(i){let e,t,n,a,s=[],r=new Map,o,l,c,d,h,u,f,m,p,y,w=i[33].conditions,_=S=>S[36];for(let S=0;S<w.length;S+=1){let v=Cu(i,w,S),x=_(v);r.set(x,s[S]=Du(x,v))}function O(){return i[25](i[33])}function E(){return i[26](i[33])}return{c(){e=k("div"),t=k("div"),n=k("div"),a=k("div");for(let S=0;S<s.length;S+=1)s[S].c();o=W(),l=k("div"),c=k("div"),h=W(),u=k("div"),g(a,"class","if-else-block-container svelte-1swdhxf"),g(n,"class","statblock-creator-block svelte-1swdhxf"),g(c,"class","icon svelte-1swdhxf"),g(u,"class","icon svelte-1swdhxf"),g(l,"class","icons svelte-1swdhxf"),g(t,"class","statblock-creator-container svelte-1swdhxf"),g(e,"class","item svelte-1swdhxf")},m(S,v){D(S,e,v),b(e,t),b(t,n),b(n,a);for(let x=0;x<s.length;x+=1)s[x]&&s[x].m(a,null);b(t,o),b(t,l),b(l,c),b(l,h),b(l,u),m=!0,p||(y=[ee(d=i[14].call(null,c)),H(c,"click",O),ee(f=i[15].call(null,u)),H(u,"click",E)],p=!0)},p(S,v){i=S,v[0]&35&&(w=i[33].conditions,he(),s=gt(s,v,_,1,i,w,r,a,Ji,Du,null,Cu),de())},i(S){if(!m){for(let v=0;v<w.length;v+=1)M(s[v]);m=!0}},o(S){for(let v=0;v<s.length;v+=1)Q(s[v]);m=!1},d(S){S&&A(e);for(let v=0;v<s.length;v+=1)s[v].d();p=!1,ce(y)}}}function P0(i){let e,t,n,a,s,r,o,l,c,d,h,u,f,m,p,y,w,_,O,E,S;function v(Z,F){return Z[33].heading?Q0:E0}let x=v(i,[-1,-1]),P=x(i);function I(Z){i[19](Z,i[33])}function R(Z){i[20](Z)}let T={draggable:!1};i[33].nested!==void 0&&(T.blocks=i[33].nested),i[1]!==void 0&&(T.plugin=i[1]),c=new Zn({props:T}),Re.push(()=>Nt(c,"blocks",I)),Re.push(()=>Nt(c,"plugin",R));function $(){return i[21](i[33])}function K(){return i[22](i[33])}return{c(){e=k("div"),t=k("div"),n=k("div"),a=k("div"),r=W(),o=k("div"),P.c(),l=W(),se(c.$$.fragment),u=W(),f=k("div"),m=k("div"),y=W(),w=k("div"),g(o,"class","collapsible svelte-1swdhxf"),g(n,"class","statblock-creator-block collapse-container svelte-1swdhxf"),g(m,"class","icon svelte-1swdhxf"),g(w,"class","icon svelte-1swdhxf"),g(f,"class","icons svelte-1swdhxf"),g(t,"class","statblock-creator-container svelte-1swdhxf"),g(e,"class","item svelte-1swdhxf")},m(Z,F){D(Z,e,F),b(e,t),b(t,n),b(n,a),b(n,r),b(n,o),P.m(o,null),b(o,l),ie(c,o,null),b(t,u),b(t,f),b(f,m),b(f,y),b(f,w),O=!0,E||(S=[ee(s=Le.call(null,a,"chevrons-down-up")),ee(p=i[14].call(null,m)),H(m,"click",$),ee(_=i[15].call(null,w)),H(w,"click",K)],E=!0)},p(Z,F){i=Z,x===(x=v(i,F))&&P?P.p(i,F):(P.d(1),P=x(i),P&&(P.c(),P.m(o,l)));let V={};!d&&F[0]&33&&(d=!0,V.blocks=i[33].nested,Wt(()=>d=!1)),!h&&F[0]&2&&(h=!0,V.plugin=i[1],Wt(()=>h=!1)),c.$set(V)},i(Z){O||(M(c.$$.fragment,Z),O=!0)},o(Z){Q(c.$$.fragment,Z),O=!1},d(Z){Z&&A(e),P.d(),ne(c),E=!1,ce(S)}}}function M0(i){let e,t,n,a,s,r=i[33],o,l;function c(f){i[17](f,i[33])}function d(f){i[18](f)}let h={inline:i[33].type=="inline"};i[33].nested!==void 0&&(h.blocks=i[33].nested),i[1]!==void 0&&(h.plugin=i[1]),t=new Zn({props:h}),Re.push(()=>Nt(t,"blocks",c)),Re.push(()=>Nt(t,"plugin",d));let u=Pu(i);return{c(){e=k("div"),se(t.$$.fragment),s=W(),u.c(),o=Oe(),g(e,"class","item svelte-1swdhxf"),oe(e,"group",i[33].type=="group"||i[33].type=="inline")},m(f,m){D(f,e,m),ie(t,e,null),D(f,s,m),u.m(f,m),D(f,o,m),l=!0},p(f,m){i=f;let p={};m[0]&33&&(p.inline=i[33].type=="inline"),!n&&m[0]&33&&(n=!0,p.blocks=i[33].nested,Wt(()=>n=!1)),!a&&m[0]&2&&(a=!0,p.plugin=i[1],Wt(()=>a=!1)),t.$set(p),(!l||m[0]&33)&&oe(e,"group",i[33].type=="group"||i[33].type=="inline"),m[0]&33&&j(r,r=i[33])?(u.d(1),u=Pu(i),u.c(),u.m(o.parentNode,o)):u.p(i,m)},i(f){l||(M(t.$$.fragment,f),l=!0)},o(f){Q(t.$$.fragment,f),l=!1},d(f){f&&A(e),ne(t),f&&A(s),f&&A(o),u.d(f)}}}function Du(i,e){let t,n,a,s,r=e[36]+"",o,l,c,d,h,u,f;function m(w){e[23](w,e[37],e[38],e[39])}function p(w){e[24](w)}let y={draggable:!1};return e[37]!==void 0&&(y.blocks=e[37]),e[1]!==void 0&&(y.plugin=e[1]),c=new Zn({props:y}),Re.push(()=>Nt(c,"blocks",m)),Re.push(()=>Nt(c,"plugin",p)),{key:i,first:null,c(){t=k("div"),n=k("div"),a=k("small"),s=k("code"),o=me(r),l=W(),se(c.$$.fragment),u=W(),g(n,"class","condition"),g(t,"class","condition-container"),this.first=t},m(w,_){D(w,t,_),b(t,n),b(n,a),b(a,s),b(s,o),b(n,l),ie(c,n,null),b(t,u),f=!0},p(w,_){e=w,(!f||_[0]&33)&&r!==(r=e[36]+"")&&we(o,r);let O={};!d&&_[0]&33&&(d=!0,O.blocks=e[37],Wt(()=>d=!1)),!h&&_[0]&2&&(h=!0,O.plugin=e[1],Wt(()=>h=!1)),c.$set(O)},i(w){f||(M(c.$$.fragment,w),f=!0)},o(w){Q(c.$$.fragment,w),f=!1},d(w){w&&A(t),ne(c)}}}function E0(i){let e;return{c(){e=k("span"),e.textContent="Collapse"},m(t,n){D(t,e,n)},p:N,d(t){t&&A(e)}}}function Q0(i){let e,t=i[33].heading+"",n;return{c(){e=k("span"),n=me(t)},m(a,s){D(a,e,s),b(e,n)},p(a,s){s[0]&33&&t!==(t=a[33].heading+"")&&we(n,t)},d(a){a&&A(e)}}}function Pu(i){let e,t,n,a;return{c(){e=k("div"),g(e,"class","dropdown-icon svelte-1swdhxf")},m(s,r){D(s,e,r),n||(a=ee(t=i[13].call(null,e,i[33])),n=!0)},p(s,r){i=s,t&&Ie(t.update)&&r[0]&33&&t.update.call(null,i[33])},d(s){s&&A(e),n=!1,a()}}}function Mu(i){let e,t,n;return t=new _s({}),{c(){e=k("div"),se(t.$$.fragment),g(e,"aria-label","Block Has Rule")},m(a,s){D(a,e,s),ie(t,e,null),n=!0},i(a){n||(M(t.$$.fragment,a),n=!0)},o(a){Q(t.$$.fragment,a),n=!1},d(a){a&&A(e),ne(t)}}}function Eu(i,e){let t,n,a,s,r,o,l,c,d,h=N,u,f=e[3]&&Au(e),m=[M0,P0,D0,A0,C0],p=[];function y(_,O){return _[33].type=="group"||_[33].type=="inline"?0:_[33].type=="collapse"?1:_[33].type=="ifelse"?2:_[33].type=="action"?3:4}r=y(e,[-1,-1]),o=p[r]=m[r](e);let w="hasRule"in e[33]&&e[33].hasRule&&Mu(e);return{key:i,first:null,c(){t=k("div"),n=k("div"),a=k("div"),f&&f.c(),s=W(),o.c(),l=W(),w&&w.c(),c=W(),g(a,"class","block svelte-1swdhxf"),g(n,"class","block-container"),this.first=t},m(_,O){D(_,t,O),b(t,n),b(n,a),f&&f.m(a,null),b(a,s),p[r].m(a,null),b(n,l),w&&w.m(n,null),b(t,c),u=!0},p(_,O){e=_,e[3]?f?f.p(e,O):(f=Au(e),f.c(),f.m(a,s)):f&&(f.d(1),f=null);let E=r;r=y(e,O),r===E?p[r].p(e,O):(he(),Q(p[E],1,1,()=>{p[E]=null}),de(),o=p[r],o?o.p(e,O):(o=p[r]=m[r](e),o.c()),M(o,1),o.m(a,null)),"hasRule"in e[33]&&e[33].hasRule?w?O[0]&33&&M(w,1):(w=Mu(e),w.c(),M(w,1),w.m(n,null)):w&&(he(),Q(w,1,1,()=>{w=null}),de())},r(){d=t.getBoundingClientRect()},f(){Qi(t),h()},a(){h(),h=Ei(t,d,$i,{duration:Cl})},i(_){u||(M(o),M(w),u=!0)},o(_){Q(o),Q(w),u=!1},d(_){_&&A(t),f&&f.d(),p[r].d(),w&&w.d()}}}function I0(i){let e,t,n=[],a=new Map,s,r,o,l,c=i[0].filter(i[16]),d=h=>h[33].id;for(let h=0;h<c.length;h+=1){let u=Tu(i,c,h),f=d(u);a.set(f,n[h]=Eu(f,u))}return{c(){e=k("div"),t=k("section");for(let h=0;h<n.length;h+=1)n[h].c();g(t,"class","creator-zone svelte-1swdhxf"),oe(t,"inline",i[4]),g(e,"class","creator")},m(h,u){D(h,e,u),b(e,t);for(let f=0;f<n.length;f+=1)n[f]&&n[f].m(t,null);r=!0,o||(l=[ee(s=di.call(null,t,{items:i[0],flipDurationMs:Cl,dragDisabled:i[6],dropFromOthersDisabled:!i[3],type:"creator",dropTargetClasses:["min-height"]})),H(t,"consider",i[7]),H(t,"finalize",i[8])],o=!0)},p(h,u){if(u[0]&7791){c=h[0].filter(h[16]),he();for(let f=0;f<n.length;f+=1)n[f].r();n=gt(n,u,d,1,h,c,a,t,En,Eu,null,Tu);for(let f=0;f<n.length;f+=1)n[f].a();de()}s&&Ie(s.update)&&u[0]&73&&s.update.call(null,{items:h[0],flipDurationMs:Cl,dragDisabled:h[6],dropFromOthersDisabled:!h[3],type:"creator",dropTargetClasses:["min-height"]}),(!r||u[0]&16)&&oe(t,"inline",h[4])},i(h){if(!r){for(let u=0;u<c.length;u+=1)M(n[u]);r=!0}},o(h){for(let u=0;u<n.length;u+=1)Q(n[u]);r=!1},d(h){h&&A(e);for(let u=0;u<n.length;u+=1)n[u].d();o=!1,ce(l)}}}var Cl=300;function R0(i,e,t){let n=Pe(),{blocks:a=[]}=e,{layout:s}=e,{draggable:r=!0}=e,{inline:o=!1}=e,{plugin:l}=e,c=!0;function d(L){let{items:ae,info:{source:J,trigger:ue}}=L.detail;t(0,a=[...ae]),J===ze.KEYBOARD&&ue===qe.DRAG_STOPPED&&t(6,c=!0)}function h(L){let{items:ae,info:{source:J}}=L.detail;t(0,a=[...ae]),n("sorted",a),J===ze.POINTER&&t(6,c=!0)}function u(L){L.preventDefault(),t(6,c=!1)}let f=L=>{t(0,a=a.filter(ae=>ae.id!=L.id)),n("sorted",a)},m=L=>{let ae=a.findIndex(J=>J.id==L.id);a.splice(ae,1,L),t(0,a)},p=L=>{let ae=Us(l,L,s);ae.onClose=()=>{ae.saved&&m(ae.block)},ae.open()},y=async(L,ae)=>{if(!("nested"in L))return;let J=new fn.Menu().setNoIcon();wa.forEach(ue=>{if(ue[1]=="separator"){J.addSeparator();return}J.addItem(X=>{X.setTitle(ue[1]).onClick(()=>{let z=cn(ue[0]);z&&(L.nested=[...L.nested,z],t(0,a),n("sorted",a))})})}),J.showAtMouseEvent(ae)},w=(L,ae)=>{new fn.ExtraButtonComponent(L).setIcon(r?"vertical-three-dots":"plus-circle"),L.onclick=J=>{r?new fn.Menu().addItem(ue=>{ue.setTitle("Add").setIcon("plus-with-circle").onClick(X=>{y(ae,J)})}).addItem(ue=>ue.setTitle("Edit").setIcon("pencil").onClick(()=>{p(ae)})).addItem(ue=>ue.setTitle("Delete").setIcon("trash").onClick(()=>f(ae))).showAtMouseEvent(J):y(ae,J)}},_=L=>{new fn.ExtraButtonComponent(L).setIcon("pencil").setTooltip("Edit Block")},O=L=>{new fn.ExtraButtonComponent(L).setIcon("trash").setTooltip("Delete Block")},E=L=>L.id!==hi;function S(L,ae){i.$$.not_equal(ae.nested,L)&&(ae.nested=L,t(0,a))}function v(L){l=L,t(1,l)}function x(L,ae){i.$$.not_equal(ae.nested,L)&&(ae.nested=L,t(0,a))}function P(L){l=L,t(1,l)}let I=L=>p(L),R=L=>f(L);function T(L,ae,J,ue){J[ue].nested=L,t(0,a)}function $(L){l=L,t(1,l)}let K=L=>p(L),Z=L=>f(L),F=L=>p(L),V=L=>f(L),B=L=>f(L.detail),Y=L=>m(L.detail);return i.$$set=L=>{"blocks"in L&&t(0,a=L.blocks),"layout"in L&&t(2,s=L.layout),"draggable"in L&&t(3,r=L.draggable),"inline"in L&&t(4,o=L.inline),"plugin"in L&&t(1,l=L.plugin)},[a,l,s,r,o,hi,c,d,h,u,f,m,p,w,_,O,E,S,v,x,P,I,R,T,$,K,Z,F,V,B,Y]}var Zn=class extends U{constructor(e){super(),G(this,e,R0,I0,j,{blocks:0,layout:2,draggable:3,inline:4,plugin:1},T0,[-1,-1])}},Qu=Zn;var Ys=require("obsidian");function Ot(i){return Fe(i)}function mn(i,e){return At(i,e)}function W0(i){let e,t,n,a,s,r,o,l;return s=new Qu({props:{blocks:i[1],plugin:i[3],layout:i[0].id}}),s.$on("sorted",i[4]),{c(){e=k("div"),t=k("div"),a=W(),se(s.$$.fragment),g(e,"class","creator-container")},m(c,d){D(c,e,d),b(e,t),b(e,a),ie(s,e,null),r=!0,o||(l=ee(n=i[5].call(null,t)),o=!0)},p(c,[d]){let h={};d&2&&(h.blocks=c[1]),d&1&&(h.layout=c[0].id),s.$set(h)},i(c){r||(M(s.$$.fragment,c),r=!0)},o(c){Q(s.$$.fragment,c),r=!1},d(c){c&&A(e),ne(s),o=!1,l()}}}function N0(i,e,t){let n,a,s=Ot("layout");Se(i,s,d=>t(0,a=d));let r=Ot("plugin"),o=d=>{Te(s,a.blocks=[...d.detail],a)},l=d=>{new Ys.Setting(d).setHeading().setName("Blocks").addExtraButton(h=>{h.setIcon("plus-with-circle").setTooltip("Add Block").extraSettingsEl.onClickEvent(u=>c(u))})},c=async d=>{let h=new Ys.Menu().setNoIcon();wa.forEach(u=>{if(u[1]=="separator"){h.addSeparator();return}h.addItem(f=>{f.setTitle(u[1]).onClick(()=>{let m=cn(u[0]);m&&Te(s,a.blocks=[...a.blocks,m],a)})})}),h.showAtMouseEvent(d)};return i.$$.update=()=>{i.$$.dirty&1&&t(1,n=a.blocks)},[a,n,s,r,o,l]}var Al=class extends U{constructor(e){super(),G(this,e,N0,W0,j,{})}},Dl=Al;var Ea=require("obsidian");var Pa=require("obsidian");function L0(i){re(i,"svelte-1cgghnt",".drop-items.svelte-1cgghnt.svelte-1cgghnt{width:100%;margin:0.5rem 0}.drop-item-container.svelte-1cgghnt .icon.svelte-1cgghnt,.icons.svelte-1cgghnt.svelte-1cgghnt{display:flex;align-items:center}.drop-item-container.svelte-1cgghnt.svelte-1cgghnt{display:grid;grid-template-columns:auto 1fr auto;align-items:center;justify-content:space-between;gap:1rem;width:100%}.drop-item-container.svelte-1cgghnt.svelte-1cgghnt:not(.draggable){cursor:inherit !important}.drop-item-container.svelte-1cgghnt.svelte-1cgghnt:not(:last-child){margin-bottom:0.5rem}")}function Iu(i,e,t){let n=i.slice();return n[15]=e[t],n}function Ru(i){let e,t,n,a,s;return{c(){e=k("div"),g(e,"class","icon svelte-1cgghnt"),g(e,"style",t=i[5]?"cursor: grab":"cursor: grabbing")},m(r,o){D(r,e,o),a||(s=[ee(n=Le.call(null,e,"grip-vertical")),H(e,"mousedown",i[6]),H(e,"touchstart",i[6])],a=!0)},p(r,o){o&32&&t!==(t=r[5]?"cursor: grab":"cursor: grabbing")&&g(e,"style",t)},d(r){r&&A(e),a=!1,ce(s)}}}function Wu(i){let e,t,n,a,s,r,o,l;return{c(){e=k("div"),t=k("div"),a=W(),s=k("div"),g(t,"class","icon svelte-1cgghnt"),g(s,"class","icon svelte-1cgghnt"),g(e,"class","icons svelte-1cgghnt")},m(c,d){D(c,e,d),b(e,t),b(e,a),b(e,s),o||(l=[ee(n=i[9].call(null,t,i[15])),ee(r=i[10].call(null,s,i[15]))],o=!0)},p(c,d){i=c,n&&Ie(n.update)&&d&1&&n.update.call(null,i[15]),r&&Ie(r.update)&&d&1&&r.update.call(null,i[15])},d(c){c&&A(e),o=!1,ce(l)}}}function Nu(i,e){let t,n,a,s,r,o,l,c=N,d,h=e[2]&&Ru(e);var u=e[4];function f(p){return{props:{item:p[15]}}}u&&(s=Vr(u,f(e)));let m=e[3]&&Wu(e);return{key:i,first:null,c(){t=k("div"),h&&h.c(),n=W(),a=k("div"),s&&se(s.$$.fragment),r=W(),m&&m.c(),o=W(),g(a,"class","drop-item"),oe(a,"type",e[1]),g(t,"class","drop-item-container svelte-1cgghnt"),oe(t,"draggable",e[2]),this.first=t},m(p,y){D(p,t,y),h&&h.m(t,null),b(t,n),b(t,a),s&&ie(s,a,null),b(t,r),m&&m.m(t,null),b(t,o),d=!0},p(p,y){e=p,e[2]?h?h.p(e,y):(h=Ru(e),h.c(),h.m(t,n)):h&&(h.d(1),h=null);let w={};if(y&1&&(w.item=e[15]),y&16&&u!==(u=e[4])){if(s){he();let _=s;Q(_.$$.fragment,1,0,()=>{ne(_,1)}),de()}u?(s=Vr(u,f(e)),se(s.$$.fragment),M(s.$$.fragment,1),ie(s,a,null)):s=null}else u&&s.$set(w);(!d||y&2)&&oe(a,"type",e[1]),e[3]?m?m.p(e,y):(m=Wu(e),m.c(),m.m(t,o)):m&&(m.d(1),m=null),(!d||y&4)&&oe(t,"draggable",e[2])},r(){l=t.getBoundingClientRect()},f(){Qi(t),c()},a(){c(),c=Ei(t,l,$i,{duration:Pl})},i(p){d||(s&&M(s.$$.fragment,p),d=!0)},o(p){s&&Q(s.$$.fragment,p),d=!1},d(p){p&&A(t),h&&h.d(),s&&ne(s),m&&m.d()}}}function $0(i){let e,t=[],n=new Map,a,s,r,o,l=i[0].filter(i[12]),c=d=>d[15].id;for(let d=0;d<l.length;d+=1){let h=Iu(i,l,d),u=c(h);n.set(u,t[d]=Nu(u,h))}return{c(){e=k("div");for(let d=0;d<t.length;d+=1)t[d].c();g(e,"class","drop-items svelte-1cgghnt")},m(d,h){D(d,e,h);for(let u=0;u<t.length;u+=1)t[u]&&t[u].m(e,null);s=!0,r||(o=[ee(a=di.call(null,e,{items:i[0],flipDurationMs:Pl,dragDisabled:i[5],dropFromOthersDisabled:!0,type:i[1]})),H(e,"consider",i[7]),H(e,"finalize",i[8])],r=!0)},p(d,[h]){if(h&127){l=d[0].filter(d[12]),he();for(let u=0;u<t.length;u+=1)t[u].r();t=gt(t,h,c,1,d,l,n,e,En,Nu,null,Iu);for(let u=0;u<t.length;u+=1)t[u].a();de()}a&&Ie(a.update)&&h&35&&a.update.call(null,{items:d[0],flipDurationMs:Pl,dragDisabled:d[5],dropFromOthersDisabled:!0,type:d[1]})},i(d){if(!s){for(let h=0;h<l.length;h+=1)M(t[h]);s=!0}},o(d){for(let h=0;h<t.length;h+=1)Q(t[h]);s=!1},d(d){d&&A(e);for(let h=0;h<t.length;h+=1)t[h].d();r=!1,ce(o)}}}var Pl=300;function B0(i,e,t){let{items:n}=e,{type:a}=e,{draggable:s=!0}=e,{showIcons:r=!0}=e,{component:o}=e,{onDrop:l}=e,c=Pe(),d=new Pa.Scope;function h(_){_.preventDefault(),app.keymap.pushScope(d),t(5,u=!1)}let u=!1;function f(_){t(0,n=_.detail.items)}function m(_){app.keymap.popScope(d),l(_.detail.items)}let p=(_,O)=>{new Pa.ExtraButtonComponent(_).setIcon("wrench").onClick(()=>c("advanced",O))},y=(_,O)=>{new Pa.ExtraButtonComponent(_).setIcon("trash").onClick(()=>c("trash",O))},w=_=>_.id!==hi;return i.$$set=_=>{"items"in _&&t(0,n=_.items),"type"in _&&t(1,a=_.type),"draggable"in _&&t(2,s=_.draggable),"showIcons"in _&&t(3,r=_.showIcons),"component"in _&&t(4,o=_.component),"onDrop"in _&&t(11,l=_.onDrop)},[n,a,s,r,o,u,h,f,m,p,y,l,w]}var Ml=class extends U{constructor(e){super(),G(this,e,B0,$0,j,{items:0,type:1,draggable:2,showIcons:3,component:4,onDrop:11},L0)}},Lu=Ml;function $u(i){let e,t=i[0].desc+"",n;return{c(){e=k("div"),n=me(t),g(e,"class","setting-item-description")},m(a,s){D(a,e,s),b(e,n)},p(a,s){s&1&&t!==(t=a[0].desc+"")&&we(n,t)},d(a){a&&A(e)}}}function z0(i){let e,t,n,a,s=i[0].regex+"",r,o,l,c=i[0].desc&&$u(i);return{c(){e=k("div"),t=k("div"),n=k("code"),a=me("/"),r=me(s),o=me("/"),l=W(),c&&c.c(),g(t,"class","setting-item-name"),g(e,"class","dice-parsing setting-item-info")},m(d,h){D(d,e,h),b(e,t),b(t,n),b(n,a),b(n,r),b(n,o),b(e,l),c&&c.m(e,null)},p(d,[h]){h&1&&s!==(s=d[0].regex+"")&&we(r,s),d[0].desc?c?c.p(d,h):(c=$u(d),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:N,o:N,d(d){d&&A(e),c&&c.d()}}}function H0(i,e,t){let{item:n}=e;return i.$$set=a=>{"item"in a&&t(0,n=a.item)},[n]}var El=class extends U{constructor(e){super(),G(this,e,H0,z0,j,{item:0})}},Bu=El;var Gt=require("obsidian");var Ma=class extends vt{constructor(t,n){super(t);this.item={regex:"",parser:"",id:q()};this.saved=!0;n?(this.editing=!0,this.item={...n}):this.editing=!1}onOpen(){this.titleEl.setText(this.editing?"Editing Dice Parser":"New Dice Parser"),this.display()}async display(){this.contentEl.empty(),new Gt.Setting(this.contentEl).setName("Example").setDesc("Add an example, for reference only.").addText(t=>{t.setValue(this.item.desc).onChange(n=>this.item.desc=n)}),this.buildRegEx(this.contentEl.createDiv()),this.buildParser(this.contentEl.createDiv()),this.buildTester(this.contentEl.createDiv()),new Gt.Setting(this.contentEl).addExtraButton(t=>t.setIcon("cross").setTooltip("Cancel").onClick(()=>{this.saved=!1,this.close()}))}buildTester(t){t.empty()}buildRegEx(t){t.empty(),new Gt.Setting(t).setHeading().setName("Regular Expression").setDesc(""),this.regex=Da(t,this.item.regex,["statblock-textarea-x-small"],n=>{this.item.regex=n})}getCallbackDescription(){return createFragment(t=>{t.createSpan({text:"The dice parser callback needs to parse the results of the regular expression and return the correct dice string to display."}),t.createEl("br"),t.createEl("br"),t.createSpan({text:"The callback will have the "}),t.createEl("code",{text:"original"}),t.createSpan({text:" (the matched text), "}),t.createEl("code",{text:"matches"}),t.createSpan({text:" (the RegExpMatchArray), and "}),t.createEl("code",{text:"monster"}),t.createSpan({text:" (current monster being rendered) parameters available in the callback."}),t.createEl("br"),t.createEl("br"),t.createSpan({text:"The callback should return an instance of:"}),Gt.MarkdownRenderer.render(this.plugin.app,"```ts\ninterface DiceCallbackObject {\n text: string // string to be parsed into a dice roll\n original?: string // optional, shown in parenthesis\n}\n```",t.createDiv(),"",new Gt.Component),t.createEl("br"),t.createEl("span",{text:"For example: "}),t.createEl("br"),Gt.MarkdownRenderer.render(this.plugin.app,'```ts\nreturn { text: "1d20 + 3" };\n```',t.createDiv(),"",new Gt.Component)})}buildParser(t){t.empty();let n=new Gt.Setting(t).setHeading().setName("Callback").addExtraButton(a=>{let s=!1;a.setIcon("help-circle").onClick(()=>{s?n.setDesc(""):n.setDesc(this.getCallbackDescription()),s=!s})});n.settingEl.style.alignItems="flex-start",this.parser=Da(t,this.item.parser,[],a=>{this.item.parser=a})}};function F0(i){re(i,"svelte-tnyfuy",".defaults.svelte-tnyfuy{color:var(--text-muted);font-style:italic;font-size:smaller}")}function j0(i){let e,t,n,a,s,r;return{c(){e=k("div"),n=W(),a=k("span"),a.textContent=`This layout does not have any dice parsers defined. Add one to
begin parsing for dice.`,g(a,"class","defaults svelte-tnyfuy")},m(o,l){D(o,e,l),D(o,n,l),D(o,a,l),s||(r=ee(t=i[7].call(null,e)),s=!0)},d(o){o&&A(e),o&&A(n),o&&A(a),s=!1,r()}}}function Z0(i){let e,t,n,a,s,r;return{c(){e=k("div"),n=W(),a=k("span"),a.textContent=`This layout is currently using the default dice parsers. Add a
custom dice parser to override this behavior.`,g(a,"class","defaults svelte-tnyfuy")},m(o,l){D(o,e,l),D(o,n,l),D(o,a,l),s||(r=ee(t=i[7].call(null,e)),s=!0)},d(o){o&&A(e),o&&A(n),o&&A(a),s=!1,r()}}}function zu(i){let e,t;return e=new Lu({props:{type:"dice",component:Bu,items:i[1]??ys(),onDrop:i[3],showIcons:i[1]!=null,draggable:i[1]!=null}}),e.$on("advanced",i[11]),e.$on("trash",i[12]),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},p(n,a){let s={};a&2&&(s.items=n[1]??ys()),a&2&&(s.showIcons=n[1]!=null),a&2&&(s.draggable=n[1]!=null),e.$set(s)},i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function X0(i){let e,t,n,a,s,r,o,l,c,d,h,u,f,m,p,y,w,_,O,E,S,v,x,P,I=i[1],R,T,$;function K(B,Y){if(!B[1])return Z0;if(B[1].length==0)return j0}let Z=K(i,-1),F=Z&&Z(i),V=zu(i);return{c(){e=k("div"),t=k("div"),t.innerHTML=`<div class="setting-item-name">Columns</div>
<div class="setting-item-description">Always try to split into this many columns, regardless of height.</div>`,n=W(),a=k("div"),s=k("input"),r=W(),o=k("div"),l=k("div"),l.innerHTML=`<div class="setting-item-name">Column width</div>
<div class="setting-item-description">Width in pixels. Default: 400px</div>`,c=W(),d=k("div"),h=k("input"),u=W(),f=k("div"),m=k("div"),m.innerHTML=`<div class="setting-item-name">Force columns</div>
<div class="setting-item-description">Ignore available space when calculating columns.</div>`,p=W(),y=k("div"),_=W(),O=k("div"),S=W(),v=k("div"),x=k("div"),F&&F.c(),P=W(),V.c(),g(t,"class","setting-item-info"),g(s,"type","number"),g(s,"min","0"),g(a,"class","setting-item-control"),g(e,"class","setting-item"),g(l,"class","setting-item-info"),g(h,"type","number"),g(h,"min","0"),g(d,"class","setting-item-control"),g(o,"class","setting-item"),g(m,"class","setting-item-info"),g(y,"class","setting-item-control"),g(f,"class","setting-item"),g(x,"class","additional"),g(v,"class","dice-parsing statblock-additional-container")},m(B,Y){D(B,e,Y),b(e,t),b(e,n),b(e,a),b(a,s),kt(s,i[0].columns),D(B,r,Y),D(B,o,Y),b(o,l),b(o,c),b(o,d),b(d,h),kt(h,i[0].columnWidth),D(B,u,Y),D(B,f,Y),b(f,m),b(f,p),b(f,y),D(B,_,Y),D(B,O,Y),D(B,S,Y),D(B,v,Y),b(v,x),F&&F.m(x,null),b(x,P),V.m(x,null),R=!0,T||($=[H(s,"input",i[9]),H(h,"input",i[10]),ee(w=i[8].call(null,y)),ee(E=i[6].call(null,O))],T=!0)},p(B,[Y]){Y&1&&Yi(s.value)!==B[0].columns&&kt(s,B[0].columns),Y&1&&Yi(h.value)!==B[0].columnWidth&&kt(h,B[0].columnWidth),Z!==(Z=K(B,Y))&&(F&&F.d(1),F=Z&&Z(B),F&&(F.c(),F.m(x,P))),Y&2&&j(I,I=B[1])?(he(),Q(V,1,1,N),de(),V=zu(B),V.c(),M(V,1),V.m(x,null)):V.p(B,Y)},i(B){R||(M(V),R=!0)},o(B){Q(V),R=!1},d(B){B&&A(e),B&&A(r),B&&A(o),B&&A(u),B&&A(f),B&&A(_),B&&A(O),B&&A(S),B&&A(v),F&&F.d(),V.d(B),T=!1,ce($)}}}function q0(i,e,t){let n,a,s=Ot("layout");Se(i,s,w=>t(0,a=w));let r=Ot("plugin");function o(w){Te(s,a.diceParsing=[...w],a)}let l=w=>{let _=new Ma(r,w);_.onClose=()=>{if(!_.saved)return;a.diceParsing==null&&Te(s,a.diceParsing=[],a);let O=a.diceParsing.indexOf(w);O===-1?a.diceParsing.push(_.item):a.diceParsing.splice(O,1,_.item),s.set(a)},_.open()},c=w=>{t(1,n=n.filter(_=>_.id!=w.id)),Te(s,a.diceParsing=[...n],a)},d=w=>{new Ea.Setting(w).setHeading().setName("Dice Parsing").setDesc(createFragment(_=>{_.createSpan({text:"Add "}),_.createEl("a",{href:"https://regex101.com",text:"regular expressions"}),_.createSpan({text:" to detect dice rolls inside your layout."}),_.createEl("br"),_.createSpan({text:"These are parsed in order, and the first one to trigger is what will be used."})})).addExtraButton(_=>{_.setIcon("plus-with-circle").onClick(()=>{l()})})},h=w=>{new Ea.Setting(w).setName(n==null?"Remove default parsers":"Restore default parsers").addButton(_=>{_.setIcon(n==null?"trash":"archive-restore").onClick(()=>{t(1,n=n==null?[]:null)})})},u=w=>{new Ea.ToggleComponent(w).setValue(a.forceColumns).onChange(()=>{Te(s,a.forceColumns=!a.forceColumns,a)})};function f(){a.columns=Yi(this.value),s.set(a)}function m(){a.columnWidth=Yi(this.value),s.set(a)}let p=w=>l(w.detail),y=w=>c(w.detail);return i.$$.update=()=>{i.$$.dirty&1&&t(1,n=a.diceParsing?[...a.diceParsing]:null)},[a,n,s,o,l,c,d,h,u,f,m,p,y]}var Ql=class extends U{constructor(e){super(),G(this,e,q0,X0,j,{},F0)}},Il=Ql;var Ax=require("obsidian");var Nl=require("obsidian");var Ia=["primaryColor","ruleColor","backgroundColor","borderSize","borderColor","barColor","barBorderSize","barBorderColor","imageWidth","imageHeight","imageBorderSize","imageBorderColor","boxShadowColor","boxShadowXOffset","boxShadowYOffset","boxShadowBlur","fontColor","fontWeight","contentFont","contentFontSize","headingFont","headingFontColor","headingFontSize","headingFontVariant","headingFontWeight","propertyFont","propertyFontColor","propertyFontVariant","propertyFontSize","propertyFontWeight","propertyNameFont","propertyNameFontVariant","propertyNameFontSize","propertyNameFontColor","propertyNameFontWeight","sectionHeadingBorderSize","sectionHeadingBorderColor","sectionHeadingFont","sectionHeadingFontColor","sectionHeadingFontSize","sectionHeadingFontVariant","sectionHeadingFontWeight","subheadingFont","subheadingFontColor","subheadingFontSize","subheadingFontStyle","subheadingFontWeight","traitsFont","traitsFontColor","traitsFontSize","traitsFontWeight","traitsFontStyle","traitsNameFont","traitsNameFontColor","traitsNameFontSize","traitsNameFontWeight","traitsNameFontStyle"],Rl={primaryColor:"#7a200d",ruleColor:"#922610",backgroundColor:"#fdf1dc",borderSize:"1px",borderColor:"#ddd",barColor:"#e69a28",barBorderSize:"1px",barBorderColor:"#000",imageWidth:"75px",imageHeight:"75px",imageBorderSize:"2px",imageBorderColor:"primaryColor",boxShadowColor:"#ddd",boxShadowXOffset:"0",boxShadowYOffset:"0",boxShadowBlur:"1.5em",fontColor:"primaryColor",fontWeight:"700",contentFont:'"Noto Sans", "Myriad Pro", Calibri, Helvetica, Arial, sans-serif',contentFontSize:"14px",headingFont:'"Libre Baskerville", "Lora", "Calisto MT", "Bookman Old Style", Bookman, "Goudy Old Style", Garamond, "Hoefler Text", "Bitstream Charter", Georgia, serif',headingFontColor:"fontColor",headingFontSize:"23px",headingFontVariant:"small-caps",headingFontWeight:"fontWeight",sectionHeadingBorderSize:"1px",sectionHeadingBorderColor:"primaryColor",sectionHeadingFont:null,sectionHeadingFontColor:"fontColor",sectionHeadingFontSize:"21px",sectionHeadingFontVariant:"small-caps",sectionHeadingFontWeight:"normal",subheadingFont:"contentFont",subheadingFontColor:"fontColor",subheadingFontSize:"12px",subheadingFontStyle:"italic",subheadingFontWeight:"normal",propertyFont:"contentFont",propertyFontColor:"fontColor",propertyFontVariant:"normal",propertyFontSize:"contentFontSize",propertyFontWeight:null,propertyNameFont:"contentFont",propertyNameFontColor:"fontColor",propertyNameFontWeight:null,propertyNameFontVariant:null,propertyNameFontSize:"contentFontSize",traitsFont:"contentFont",traitsFontColor:"fontColor",traitsFontSize:"contentFontSize",traitsFontWeight:null,traitsFontStyle:null,traitsNameFont:"contentFont",traitsNameFontColor:"fontColor",traitsNameFontSize:"contentFontSize",traitsNameFontWeight:"bold",traitsNameFontStyle:"italic"},Ce={Light:"moonstone",Dark:"obsidian",None:"none"};function Wl(i,e,t){let n=new Set,a=Xn(i,e,t);for(;Ia.includes(a)&&!n.has(a);)n.add(a),a=Xn(i,a,t);return n}function Hu(i,e,t){let n=Xn(i,e,t);return n!=null&&Ia.includes(n)}function Xn(i,e,t){return(t!=Ce.None?i?.[t]?.[e]:null)??i?.[e]??Rl[e]??null}function Gs(i,e,t,n=new Set){n.add(e);let a=Xn(i,e,t);return Ia.includes(a)?n.has(a)?null:Gs(i,a,t,n):a}var be=Object.freeze({Number:"Number",Color:"Color",Font:"Font",Size:"Size",Style:"Style",Variant:"Variant",Weight:"Weight"}),Ks=[{name:"General",desc:"",properties:[{type:be.Color,property:"primaryColor",desc:"This is used to derive several other properties by default.",name:"Primary color"},{type:be.Color,property:"ruleColor",name:"Rule color"},{type:be.Color,property:"backgroundColor",name:"Background color"},{type:be.Color,property:"borderColor",name:"Border color"},{type:be.Size,property:"borderSize",name:"Border size"}]},{name:"Content font",desc:"",properties:[{type:be.Font,name:"Content font",desc:"This is the font used for most of the content in a statblock.",property:"contentFont"},{type:be.Size,name:"Content font size",property:"contentFontSize"},{type:be.Weight,name:"Content font weight",property:"fontWeight"},{type:be.Color,name:"Content font color",property:"fontColor"}]},{name:"Bar",desc:"Control the appearance of the top and bottom bars.",properties:[{type:be.Color,name:"Bar color",property:"barColor"},{type:be.Color,name:"Bar border color",property:"barBorderColor"},{type:be.Size,name:"Bar border size",property:"barBorderSize"}]},{name:"Images",desc:"",properties:[{type:be.Size,name:"Image width",property:"imageWidth"},{type:be.Size,name:"Image height",property:"imageHeight"},{type:be.Size,name:"Image border size",property:"imageBorderSize"},{type:be.Color,name:"Image border color",property:"imageBorderColor"}]},{name:"Shadow",desc:"",properties:[{type:be.Color,name:"Shadow color",property:"boxShadowColor"},{type:be.Size,name:"Shadow x offset",property:"boxShadowXOffset"},{type:be.Size,name:"Shadow y offset",property:"boxShadowYOffset"},{type:be.Size,name:"Shadow blur",property:"boxShadowBlur"}]},{name:"Headings",desc:"Anything related to heading blocks.",properties:[{type:be.Font,property:"headingFont",name:"Heading font"},{type:be.Color,property:"headingFontColor",name:"Heading font color"},{type:be.Size,property:"headingFontSize",name:"Heading font size"},{type:be.Variant,property:"headingFontVariant",name:"Heading font variant"},{type:be.Weight,property:"headingFontWeight",name:"Heading font weight"}]},{name:"Properties",desc:"Anything related to property blocks.",properties:[{type:be.Font,property:"propertyFont",name:"Property font"},{type:be.Color,property:"propertyFontColor",name:"Property font color"},{type:be.Size,property:"propertyFontSize",name:"Property font size"},{type:be.Variant,property:"propertyFontVariant",name:"Property font variant"},{type:be.Weight,property:"propertyFontWeight",name:"Property font weight"},{type:be.Font,property:"propertyNameFont",name:"Property heading font"},{type:be.Color,property:"propertyNameFontColor",name:"Property name font color"},{type:be.Size,property:"propertyNameFontSize",name:"Property name font size"},{type:be.Variant,property:"propertyNameFontVariant",name:"Property name font variant"},{type:be.Weight,property:"propertyNameFontWeight",name:"Property name font weight"}]},{name:"Section headings",desc:"Anything related to section heading blocks.",properties:[{type:be.Font,property:"sectionHeadingFont",name:"Section heading font"},{type:be.Color,property:"sectionHeadingFontColor",name:"Section heading font color"},{type:be.Size,property:"sectionHeadingFontSize",name:"Section heading font size"},{type:be.Variant,property:"sectionHeadingFontVariant",name:"Section heading font variant"},{type:be.Weight,property:"sectionHeadingFontWeight",name:"Section heading font weight"},{type:be.Size,property:"sectionHeadingBorderSize",name:"Section heading border size"},{type:be.Color,property:"sectionHeadingBorderColor",name:"Section heading border color"}]},{name:"Subheadings",desc:"",properties:[{type:be.Font,property:"subheadingFont",name:"Subheading font"},{type:be.Color,property:"subheadingFontColor",name:"Subheading font color"},{type:be.Size,property:"subheadingFontSize",name:"Subheading font size"},{type:be.Style,property:"subheadingFontStyle",name:"Subheading font style"},{type:be.Weight,property:"subheadingFontWeight",name:"Subheading font weight"}]},{name:"Traits",desc:"",properties:[{type:be.Font,property:"traitsFont",name:"Traits font"},{type:be.Color,property:"traitsFontColor",name:"Traits font color"},{type:be.Size,property:"traitsFontSize",name:"Traits font size"},{type:be.Style,property:"traitsFontStyle",name:"Traits font style"},{type:be.Weight,property:"traitsFontWeight",name:"Traits font weight"},{type:be.Font,property:"traitsNameFont",name:"Trait name font"},{type:be.Color,property:"traitsNameFontColor",name:"Trait name font color"},{type:be.Size,property:"traitsNameFontSize",name:"Trait name font size"},{type:be.Style,property:"traitsNameFontStyle",name:"Trait name font style"},{type:be.Weight,property:"traitsNameFontWeight",name:"Trait name font weight"}]}],Qa=new Map;for(let i of Ks)for(let e of i.properties)Qa.has(e.type)||Qa.set(e.type,[]),Qa.get(e.type).push(e);function Fu(i,e,t){let n=i.slice();return n[19]=e[t],n}function U0(i){let e,t,n;return{c(){e=k("input"),g(e,"type","text"),g(e,"spellcheck","false"),e.value=i[4]},m(a,s){D(a,e,s),t||(n=H(e,"change",i[16]),t=!0)},p(a,s){s&16&&e.value!==a[4]&&(e.value=a[4])},d(a){a&&A(e),t=!1,n()}}}function V0(i){let e,t,n;return{c(){e=k("input"),g(e,"type","color"),e.value=i[4]},m(a,s){D(a,e,s),t||(n=H(e,"change",i[15]),t=!0)},p(a,s){s&16&&(e.value=a[4])},d(a){a&&A(e),t=!1,n()}}}function Y0(i){let e,t,n,a=i[1],s=[];for(let r=0;r<a.length;r+=1)s[r]=ju(Fu(i,a,r));return{c(){e=k("select");for(let r=0;r<s.length;r+=1)s[r].c();g(e,"class","dropdown")},m(r,o){D(r,e,o);for(let l=0;l<s.length;l+=1)s[l]&&s[l].m(e,null);t||(n=H(e,"change",i[14]),t=!0)},p(r,o){if(o&10){a=r[1];let l;for(l=0;l<a.length;l+=1){let c=Fu(r,a,l);s[l]?s[l].p(c,o):(s[l]=ju(c),s[l].c(),s[l].m(e,null))}for(;l<s.length;l+=1)s[l].d(1);s.length=a.length}},d(r){r&&A(e),Xe(s,r),t=!1,n()}}}function ju(i){let e,t=i[19].name+"",n,a,s;return{c(){e=k("option"),n=me(t),e.__value=a=i[19].property,e.value=e.__value,e.selected=s=i[3]==i[19].property},m(r,o){D(r,e,o),b(e,n)},p(r,o){o&2&&t!==(t=r[19].name+"")&&we(n,t),o&2&&a!==(a=r[19].property)&&(e.__value=a,e.value=e.__value),o&10&&s!==(s=r[3]==r[19].property)&&(e.selected=s)},d(r){r&&A(e)}}}function Zu(i){let e,t,n,a;return{c(){e=k("div")},m(s,r){D(s,e,r),n||(a=ee(t=i[11].call(null,e)),n=!0)},p:N,d(s){s&&A(e),n=!1,a()}}}function G0(i){let e,t,n,a=i[0].name+"",s,r,o,l=(i[0].desc??"")+"",c,d,h,u,f=i[2],m,p,y,w,_;function O(x,P){return x[2]?Y0:x[0].type===be.Color?V0:U0}let E=O(i,-1),S=E(i),v=Zu(i);return{c(){e=k("div"),t=k("div"),n=k("div"),s=me(a),r=W(),o=k("div"),c=me(l),d=W(),h=k("div"),S.c(),u=W(),v.c(),m=W(),p=k("div"),g(n,"class","setting-item-name"),g(o,"class","setting-item-description"),g(t,"class","setting-item-info"),g(h,"class","setting-item-control"),g(e,"class","setting-item")},m(x,P){D(x,e,P),b(e,t),b(t,n),b(n,s),b(t,r),b(t,o),b(o,c),b(e,d),b(e,h),S.m(h,null),b(h,u),v.m(h,null),b(h,m),b(h,p),w||(_=ee(y=i[12].call(null,p)),w=!0)},p(x,[P]){P&1&&a!==(a=x[0].name+"")&&we(s,a),P&1&&l!==(l=(x[0].desc??"")+"")&&we(c,l),E===(E=O(x,P))&&S?S.p(x,P):(S.d(1),S=E(x),S&&(S.c(),S.m(h,u))),P&4&&j(f,f=x[2])?(v.d(1),v=Zu(x),v.c(),v.m(h,m)):v.p(x,P)},i:N,o:N,d(x){x&&A(e),S.d(),v.d(x),w=!1,_()}}}function K0(i,e,t){let n,a,s,r,o,l,{property:c}=e,d=Ot("layout");Se(i,d,v=>t(18,a=v));let h=Ot("mode");Se(i,h,v=>t(17,n=v));let u=pt([d,h],([v,x])=>Qa.get(c.type).filter(P=>P.property!=c.property&&!Wl(v.cssProperties,P.property,x).has(c.property)));Se(i,u,v=>t(1,s=v));let f=pt([d,h],([v,x])=>Gs(v.cssProperties,c.property,x)??"");Se(i,f,v=>t(4,l=v));let m=pt([d,h,u],([v,x,P])=>Xn(v.cssProperties,c.property,x)??P[0].property);Se(i,m,v=>t(3,o=v));let p=pt([d,h],([v,x])=>Hu(v.cssProperties,c.property,x));Se(i,p,v=>t(2,r=v));let y=v=>{new Nl.ExtraButtonComponent(v).setIcon(r?"unlink":"link").onClick(()=>{_(r?Gs(a.cssProperties,c.property,n):s.find(x=>!Wl(a.cssProperties,x.property,n).has(c.property)).property)})},w=v=>{new Nl.ExtraButtonComponent(v).setIcon("undo").onClick(()=>{n===Ce.None?delete a.cssProperties?.[c.property]:delete a.cssProperties?.[n]?.[c.property],d.set(a)})},_=v=>{a.cssProperties||Te(d,a.cssProperties={},a),n===Ce.None?Te(d,a.cssProperties[c.property]=v,a):(a.cssProperties[n]||Te(d,a.cssProperties[n]={},a),Te(d,a.cssProperties[n][c.property]=v,a))},O=v=>_(v.currentTarget.value),E=v=>_(v.currentTarget.value),S=v=>_(v.currentTarget.value);return i.$$set=v=>{"property"in v&&t(0,c=v.property)},[c,s,r,o,l,d,h,u,f,m,p,y,w,_,O,E,S]}var Ll=class extends U{constructor(e){super(),G(this,e,K0,G0,j,{property:0})}},Xu=Ll;var qu=require("obsidian");function J0(i){re(i,"svelte-1tfzjob",'.always-open.svelte-1tfzjob.svelte-1tfzjob{pointer-events:none}.creator-settings-container.svelte-1tfzjob.svelte-1tfzjob{pointer-events:initial}.calendarium-nested-settings.svelte-1tfzjob.svelte-1tfzjob{position:relative}.calendarium-nested-summary.svelte-1tfzjob.svelte-1tfzjob{outline:none;list-style:none !important;list-style-type:none !important;min-height:1rem;border-top-left-radius:0.1rem;border-top-right-radius:0.1rem;cursor:pointer;background-color:var(--creator-background-color);margin-right:0;display:flex;justify-content:space-between}summary.svelte-1tfzjob.svelte-1tfzjob::-webkit-details-marker,summary.svelte-1tfzjob.svelte-1tfzjob::marker{display:none !important}.always-open.svelte-1tfzjob .handle.svelte-1tfzjob{display:none}.collapser.svelte-1tfzjob.svelte-1tfzjob{display:flex;flex-flow:column;justify-content:flex-start;align-items:flex-end;content:""}.handle.svelte-1tfzjob.svelte-1tfzjob{transform:rotate(0deg);transition:transform 0.25s;display:flex}details[open].svelte-1tfzjob .handle.svelte-1tfzjob{transform:rotate(90deg)}.creator-settings-container.svelte-1tfzjob.svelte-1tfzjob{padding:0.75em var(--size-4-3)}.calendarium-nested-settings.svelte-1tfzjob.svelte-1tfzjob{border-top:0px}')}function ey(i){let e,t,n,a,s,r,o,l,c,d,h,u,f,m,p,y,w,_,O,E=i[6].default,S=st(E,i,i[5],null);return{c(){e=k("details"),t=k("summary"),n=k("div"),a=k("div"),s=k("div"),r=me(i[1]),o=W(),l=k("div"),c=me(i[2]),d=W(),h=k("div"),u=k("div"),f=k("div"),p=W(),y=k("div"),S&&S.c(),g(s,"class","setting-item-name"),g(l,"class","setting-item-description"),g(a,"class","setting-item-info"),g(n,"class","setting-item setting-item-heading"),g(f,"class","handle svelte-1tfzjob"),g(u,"class","warning-container"),g(h,"class","collapser svelte-1tfzjob"),g(t,"class","calendarium-nested-summary svelte-1tfzjob"),g(y,"class","creator-settings-container svelte-1tfzjob"),g(e,"class","creator calendarium-nested-settings setting-item svelte-1tfzjob"),oe(e,"always-open",i[3])},m(v,x){D(v,e,x),b(e,t),b(t,n),b(n,a),b(a,s),b(s,r),b(a,o),b(a,l),b(l,c),b(t,d),b(t,h),b(h,u),b(u,f),b(e,p),b(e,y),S&&S.m(y,null),e.open=i[0],w=!0,_||(O=[ee(m=i[4].call(null,f)),H(e,"toggle",i[7])],_=!0)},p(v,[x]){(!w||x&2)&&we(r,v[1]),(!w||x&4)&&we(c,v[2]),S&&S.p&&(!w||x&32)&&ot(S,E,v,v[5],w?rt(E,v[5],x,null):lt(v[5]),null),x&1&&(e.open=v[0]),(!w||x&8)&&oe(e,"always-open",v[3])},i(v){w||(M(S,v),w=!0)},o(v){Q(S,v),w=!1},d(v){v&&A(e),S&&S.d(v),_=!1,ce(O)}}}function ty(i,e,t){let{$$slots:n={},$$scope:a}=e,{open:s=!0}=e,{name:r}=e,{desc:o=""}=e,{alwaysOpen:l=!1}=e,c=h=>{(0,qu.setIcon)(h,"chevron-right")};function d(){s=this.open,t(0,s)}return i.$$set=h=>{"open"in h&&t(0,s=h.open),"name"in h&&t(1,r=h.name),"desc"in h&&t(2,o=h.desc),"alwaysOpen"in h&&t(3,l=h.alwaysOpen),"$$scope"in h&&t(5,a=h.$$scope)},[s,r,o,l,c,a,n,d]}var $l=class extends U{constructor(e){super(),G(this,e,ty,ey,j,{open:0,name:1,desc:2,alwaysOpen:3},J0)}},Ra=$l;function Uu(i,e,t){let n=i.slice();return n[1]=e[t],n}function Vu(i){let e,t;return e=new Xu({props:{property:i[1]}}),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},p(n,a){let s={};a&1&&(s.property=n[1]),e.$set(s)},i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function iy(i){let e,t,n=i[0].properties,a=[];for(let r=0;r<n.length;r+=1)a[r]=Vu(Uu(i,n,r));let s=r=>Q(a[r],1,1,()=>{a[r]=null});return{c(){for(let r=0;r<a.length;r+=1)a[r].c();e=Oe()},m(r,o){for(let l=0;l<a.length;l+=1)a[l]&&a[l].m(r,o);D(r,e,o),t=!0},p(r,o){if(o&1){n=r[0].properties;let l;for(l=0;l<n.length;l+=1){let c=Uu(r,n,l);a[l]?(a[l].p(c,o),M(a[l],1)):(a[l]=Vu(c),a[l].c(),M(a[l],1),a[l].m(e.parentNode,e))}for(he(),l=n.length;l<a.length;l+=1)s(l);de()}},i(r){if(!t){for(let o=0;o<n.length;o+=1)M(a[o]);t=!0}},o(r){a=a.filter(Boolean);for(let o=0;o<a.length;o+=1)Q(a[o]);t=!1},d(r){Xe(a,r),r&&A(e)}}}function ny(i){let e,t;return e=new Ra({props:{name:i[0].name,desc:i[0].desc,$$slots:{default:[iy]},$$scope:{ctx:i}}}),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},p(n,[a]){let s={};a&1&&(s.name=n[0].name),a&1&&(s.desc=n[0].desc),a&17&&(s.$$scope={dirty:a,ctx:n}),e.$set(s)},i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function ay(i,e,t){let{group:n}=e;return i.$$set=a=>{"group"in a&&t(0,n=a.group)},[n]}var Bl=class extends U{constructor(e){super(),G(this,e,ay,ny,j,{group:0})}},Yu=Bl;function sy(i){re(i,"svelte-1obegcf",".appearance-parent.svelte-1obegcf{overflow:hidden}.property-groups.svelte-1obegcf{overflow:auto;height:100%}")}function Gu(i,e,t){let n=i.slice();return n[5]=e[t],n}function Ku(i){let e,t;return e=new Yu({props:{group:i[5]}}),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},p:N,i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function ry(i){let e,t,n,a,s,r,o,l,c,d,h,u,f,m,p,y,w,_=Ks,O=[];for(let S=0;S<_.length;S+=1)O[S]=Ku(Gu(i,_,S));let E=S=>Q(O[S],1,1,()=>{O[S]=null});return{c(){e=k("div"),t=k("div"),n=k("div"),n.innerHTML='<div class="setting-item-name">Set colors for...</div>',a=W(),s=k("div"),r=k("button"),r.textContent="Both",o=W(),l=k("button"),d=W(),h=k("button"),f=W(),m=k("div");for(let S=0;S<O.length;S+=1)O[S].c();g(n,"class","setting-item-info"),oe(r,"mod-cta",i[0]==Ce.None),g(l,"aria-label","Light"),oe(l,"mod-cta",i[0]==Ce.Light),g(h,"aria-label","Dark"),oe(h,"mod-cta",i[0]==Ce.Dark),g(s,"class","setting-item-control"),g(t,"class","setting-item"),g(m,"class","property-groups svelte-1obegcf"),g(e,"class","appearance-parent svelte-1obegcf")},m(S,v){D(S,e,v),b(e,t),b(t,n),b(t,a),b(t,s),b(s,r),b(s,o),b(s,l),b(s,d),b(s,h),b(e,f),b(e,m);for(let x=0;x<O.length;x+=1)O[x]&&O[x].m(m,null);p=!0,y||(w=[H(r,"click",i[2]),ee(c=Le.call(null,l,"sun")),H(l,"click",i[3]),ee(u=Le.call(null,h,"moon")),H(h,"click",i[4])],y=!0)},p(S,[v]){if((!p||v&1)&&oe(r,"mod-cta",S[0]==Ce.None),(!p||v&1)&&oe(l,"mod-cta",S[0]==Ce.Light),(!p||v&1)&&oe(h,"mod-cta",S[0]==Ce.Dark),v&0){_=Ks;let x;for(x=0;x<_.length;x+=1){let P=Gu(S,_,x);O[x]?(O[x].p(P,v),M(O[x],1)):(O[x]=Ku(P),O[x].c(),M(O[x],1),O[x].m(m,null))}for(he(),x=_.length;x<O.length;x+=1)E(x);de()}},i(S){if(!p){for(let v=0;v<_.length;v+=1)M(O[v]);p=!0}},o(S){O=O.filter(Boolean);for(let v=0;v<O.length;v+=1)Q(O[v]);p=!1},d(S){S&&A(e),Xe(O,S),y=!1,ce(w)}}}function oy(i,e,t){let n,a=Ne(Ce.None);return Se(i,a,l=>t(0,n=l)),mn("mode",a),[n,a,()=>Te(a,n=Ce.None,n),()=>Te(a,n=Ce.Light,n),()=>Te(a,n=Ce.Dark,n)]}var zl=class extends U{constructor(e){super(),G(this,e,oy,ry,j,{},sy)}},Ju=zl;var Kt=require("obsidian");var Hl=require("obsidian"),ef=It(Fs());var qn=class extends ef.FuzzyInputSuggest{constructor(){super(...arguments);this.field="name"}getItemText(t){return ye(t[this.field])}renderNote(t,n){let{item:a,match:s}=n;(0,Hl.renderMatches)(t,ye(a.source),s.matches)}renderTitle(t,n){let{item:a,match:s}=n;(0,Hl.renderMatches)(t,ye(a.name),s.matches)}};function ly(i){re(i,"svelte-1jv9opu",".previewer.svelte-1jv9opu{height:100%;display:grid;grid-template-rows:auto 1fr auto;gap:0.5rem}.preview.svelte-1jv9opu{overflow:hidden;position:relative}.inner.svelte-1jv9opu{overflow:auto;padding:var(--size-4-4);transform-origin:top left;scale:var(--scale, 0.625);width:calc(100% / var(--scale, 0.625));height:calc(100% / var(--scale, 0.625))}.definition.svelte-1jv9opu{display:flex;flex-flow:column nowrap;gap:0.25rem}.yaml-editor.svelte-1jv9opu{font-size:var(--font-smallest)}")}function cy(i){let e,t,n,a,s,r,o,l,c,d,h,u,f,m,p,y,w,_,O,E,S,v,x;return{c(){e=k("div"),t=k("div"),t.innerHTML='<div class="setting-item-name">Set theme mode</div>',n=W(),a=k("div"),s=k("button"),o=W(),l=k("button"),d=W(),h=k("div"),u=k("div"),f=k("div"),f.textContent="Scale preview",m=W(),p=k("div"),y=me("Current: "),w=me(i[1]),_=W(),O=k("div"),E=k("input"),g(t,"class","setting-item-info"),g(s,"aria-label","Light"),oe(s,"mod-cta",i[2]==Ce.Light),g(l,"aria-label","Dark"),oe(l,"mod-cta",i[2]==Ce.Dark),g(a,"class","setting-item-control"),g(e,"class","setting-item"),g(f,"class","setting-item-name"),g(p,"class","setting-item-description"),g(u,"class","setting-item-info"),g(E,"class","slider"),g(E,"type","range"),g(E,"min","0"),g(E,"max","1"),g(E,"step","0.1"),g(O,"class","setting-item-control"),g(h,"class","setting-item")},m(P,I){D(P,e,I),b(e,t),b(e,n),b(e,a),b(a,s),b(a,o),b(a,l),D(P,d,I),D(P,h,I),b(h,u),b(u,f),b(u,m),b(u,p),b(p,y),b(p,w),b(h,_),b(h,O),b(O,E),kt(E,i[1]),v||(x=[ee(r=Le.call(null,s,"sun")),H(s,"click",i[14]),ee(c=Le.call(null,l,"moon")),H(l,"click",i[15]),H(E,"change",i[16]),H(E,"input",i[16]),ee(S=i[10].call(null,O))],v=!0)},p(P,I){I&4&&oe(s,"mod-cta",P[2]==Ce.Light),I&4&&oe(l,"mod-cta",P[2]==Ce.Dark),I&2&&we(w,P[1]),I&2&&kt(E,P[1])},d(P){P&&A(e),P&&A(d),P&&A(h),v=!1,ce(x)}}}function hy(i){let e,t,n,a;return{c(){e=k("div"),g(e,"class","yaml-editor svelte-1jv9opu")},m(s,r){D(s,e,r),n||(a=ee(t=i[6].call(null,e)),n=!0)},p:N,d(s){s&&A(e),n=!1,a()}}}function dy(i){let e,t,n,a,s,r,o,l,c,d,h,u,f,m,p,y,w;return d=new Ra({props:{name:"Settings",desc:i[3],open:!1,$$slots:{default:[cy]},$$scope:{ctx:i}}}),f=new Ra({props:{name:"Editor",open:!1,$$slots:{default:[hy]},$$scope:{ctx:i}}}),{c(){e=k("div"),t=k("div"),t.textContent=`Select a creature to preview the layout, or enter your own definition
below.`,n=W(),a=k("div"),s=k("div"),r=W(),o=k("div"),c=W(),se(d.$$.fragment),h=W(),u=k("div"),se(f.$$.fragment),g(s,"class","preview-container inner svelte-1jv9opu"),g(a,"class","preview svelte-1jv9opu"),g(u,"class","definition svelte-1jv9opu"),g(e,"class","previewer svelte-1jv9opu"),g(e,"style",m=`--scale: ${i[1]}`),oe(e,"theme-light",i[2]===Ce.Light),oe(e,"theme-dark",i[2]===Ce.Dark)},m(_,O){D(_,e,O),b(e,t),b(e,n),b(e,a),b(a,s),i[13](s),b(e,r),b(e,o),b(e,c),ie(d,e,null),b(e,h),b(e,u),ie(f,u,null),p=!0,y||(w=ee(l=i[5].call(null,o)),y=!0)},p(_,[O]){let E={};O&8&&(E.desc=_[3]),O&8388614&&(E.$$scope={dirty:O,ctx:_}),d.$set(E);let S={};O&8388608&&(S.$$scope={dirty:O,ctx:_}),f.$set(S),(!p||O&2&&m!==(m=`--scale: ${_[1]}`))&&g(e,"style",m),(!p||O&4)&&oe(e,"theme-light",_[2]===Ce.Light),(!p||O&4)&&oe(e,"theme-dark",_[2]===Ce.Dark)},i(_){p||(M(d.$$.fragment,_),M(f.$$.fragment,_),p=!0)},o(_){Q(d.$$.fragment,_),Q(f.$$.fragment,_),p=!1},d(_){_&&A(e),i[13](null),ne(d),ne(f),y=!1,w()}}}function uy(i,e,t){let n,a,s,r,{previewed:o}=e,l=Ot("plugin"),c=Ot("layout");Se(i,c,R=>t(19,s=R));let d=Pe(),h=(R,T)=>{R.empty(),f.setCreature({monster:T}),f.init()},u,f;bi(()=>{let R={};try{R={...R,...(0,Kt.parseYaml)(o)}}catch{}f=new qt({plugin:l,container:u,layout:s,monster:R},!1)});let m=R=>{let T=new Kt.SearchComponent(R).setPlaceholder("Find a creature");new qn(l.app,T,l.api.getBestiaryCreatures()).onSelect(async K=>{if(K.item){T.setValue("");let Z=(0,Kt.stringifyYaml)(K.item);d("update",Z),p.dispatch({changes:[{from:0,to:p.state.doc.length,insert:Z}]})}})},p,y=R=>{p=Da(R,o,[],(0,Kt.debounce)(T=>{try{let $=(0,Kt.parseYaml)(T);d("update",T),h(u,$)}catch{}},500))},w=Ne(Ce.None);Se(i,w,R=>t(2,a=R));let _=R=>{a==R?Te(w,a=Ce.None,a):Te(w,a=R,a)};yi(()=>{p&&p.destroy()});let O=Ne(1);Se(i,O,R=>t(1,n=R));let E=R=>{new Kt.ExtraButtonComponent(R).setIcon("undo").onClick(()=>{Te(O,n=1,n)})},S=pt([w,O],([R,T])=>{let $=[`Scale: ${T}`];return R===Ce.Light&&$.push("Mode: Light"),R===Ce.Dark&&$.push("Mode: Dark"),$.join(", ")});Se(i,S,R=>t(3,r=R));function v(R){Re[R?"unshift":"push"](()=>{u=R,t(0,u)})}let x=()=>_(Ce.Light),P=()=>_(Ce.Dark);function I(){n=Yi(this.value),O.set(n)}return i.$$set=R=>{"previewed"in R&&t(12,o=R.previewed)},[u,n,a,r,c,m,y,w,_,O,E,S,o,v,x,P,I]}var Fl=class extends U{constructor(e){super(),G(this,e,uy,dy,j,{previewed:12},ly)}},tf=Fl;function fy(i){re(i,"svelte-1idjk8u",".statblock-mobile.svelte-1idjk8u{display:flex;flex-flow:column;gap:0.25rem}.top.svelte-1idjk8u{display:flex;align-items:center;justify-content:space-between;padding:0.25rem}.buttons.svelte-1idjk8u{display:flex;align-items:center}.name.svelte-1idjk8u{display:flex;align-items:center}.name.svelte-1idjk8u .buttons{display:flex;justify-content:flex-end;align-items:center}.vertical-tab-header.svelte-1idjk8u{display:flex;flex-flow:column nowrap}.vertical-tab-content.svelte-1idjk8u{padding:var(--size-4-8)}.bottom.svelte-1idjk8u{display:flex;justify-content:flex-end;align-items:center;margin-top:auto}")}function nf(i,e,t){let n=i.slice();return n[16]=e[t],n}function my(i){let e,t,n,a,s,r,o,l,c,d,h,u,f,m,p,y,w,_;return f=new Il({}),p=new Dl({}),{c(){e=k("div"),t=k("div"),n=k("div"),s=W(),r=k("div"),o=k("div"),c=W(),d=k("div"),u=W(),se(f.$$.fragment),m=W(),se(p.$$.fragment),g(n,"class","name svelte-1idjk8u"),g(o,"class","save"),g(d,"class","cancel"),g(r,"class","buttons svelte-1idjk8u"),g(t,"class","top svelte-1idjk8u"),g(e,"class","statblock-mobile svelte-1idjk8u")},m(O,E){D(O,e,E),b(e,t),b(t,n),b(t,s),b(t,r),b(r,o),b(r,c),b(r,d),b(e,u),ie(f,e,null),b(e,m),ie(p,e,null),y=!0,w||(_=[ee(a=i[5].call(null,n)),ee(l=i[6].call(null,o)),ee(h=i[7].call(null,d))],w=!0)},p:N,i(O){y||(M(f.$$.fragment,O),M(p.$$.fragment,O),y=!0)},o(O){Q(f.$$.fragment,O),Q(p.$$.fragment,O),y=!1},d(O){O&&A(e),ne(f),ne(p),w=!1,ce(_)}}}function gy(i){let e,t,n,a,s,r,o,l,c,d,h,u,f,m,p,y,w,_,O,E,S,v,x,P,I,R=i[4],T=[];for(let V=0;V<R.length;V+=1)T[V]=af(nf(i,R,V));let $=i[1]==="General"&&sf(i),K=i[1]==="Appearance"&&rf(i),Z=i[1]==="Advanced"&&of(i),F=i[1]==="Previewer"&&lf(i);return{c(){e=k("div"),t=k("div"),n=k("h3"),n.textContent="Layout Editor",a=W(),s=k("div"),o=W(),l=k("div");for(let V=0;V<T.length;V+=1)T[V].c();c=W(),d=k("div"),h=k("div"),f=W(),m=k("div"),y=W(),w=k("div"),_=k("div"),$&&$.c(),O=W(),K&&K.c(),E=W(),Z&&Z.c(),S=W(),F&&F.c(),g(s,"class","name svelte-1idjk8u"),g(l,"class","vertical-tab-header-group-items"),g(t,"class","vertical-tab-header-group"),g(h,"class","save"),g(m,"class","cancel"),g(d,"class","bottom svelte-1idjk8u"),g(e,"class","vertical-tab-header svelte-1idjk8u"),g(_,"class","vertical-tab-content svelte-1idjk8u"),g(w,"class",v="vertical-tab-content-container "+i[1].toLowerCase()+"s svelte-1idjk8u")},m(V,B){D(V,e,B),b(e,t),b(t,n),b(t,a),b(t,s),b(t,o),b(t,l);for(let Y=0;Y<T.length;Y+=1)T[Y]&&T[Y].m(l,null);b(e,c),b(e,d),b(d,h),b(d,f),b(d,m),D(V,y,B),D(V,w,B),b(w,_),$&&$.m(_,null),b(_,O),K&&K.m(_,null),b(_,E),Z&&Z.m(_,null),b(_,S),F&&F.m(_,null),x=!0,P||(I=[ee(r=i[5].call(null,s)),ee(u=i[6].call(null,h)),ee(p=i[7].call(null,m))],P=!0)},p(V,B){if(B&18){R=V[4];let Y;for(Y=0;Y<R.length;Y+=1){let L=nf(V,R,Y);T[Y]?T[Y].p(L,B):(T[Y]=af(L),T[Y].c(),T[Y].m(l,null))}for(;Y<T.length;Y+=1)T[Y].d(1);T.length=R.length}V[1]==="General"?$?B&2&&M($,1):($=sf(V),$.c(),M($,1),$.m(_,O)):$&&(he(),Q($,1,1,()=>{$=null}),de()),V[1]==="Appearance"?K?B&2&&M(K,1):(K=rf(V),K.c(),M(K,1),K.m(_,E)):K&&(he(),Q(K,1,1,()=>{K=null}),de()),V[1]==="Advanced"?Z?B&2&&M(Z,1):(Z=of(V),Z.c(),M(Z,1),Z.m(_,S)):Z&&(he(),Q(Z,1,1,()=>{Z=null}),de()),V[1]==="Previewer"?F?(F.p(V,B),B&2&&M(F,1)):(F=lf(V),F.c(),M(F,1),F.m(_,null)):F&&(he(),Q(F,1,1,()=>{F=null}),de()),(!x||B&2&&v!==(v="vertical-tab-content-container "+V[1].toLowerCase()+"s svelte-1idjk8u"))&&g(w,"class",v)},i(V){x||(M($),M(K),M(Z),M(F),x=!0)},o(V){Q($),Q(K),Q(Z),Q(F),x=!1},d(V){V&&A(e),Xe(T,V),V&&A(y),V&&A(w),$&&$.d(),K&&K.d(),Z&&Z.d(),F&&F.d(),P=!1,ce(I)}}}function af(i){let e,t=i[16]+"",n,a,s,r;function o(){return i[11](i[16])}return{c(){e=k("div"),n=me(t),a=W(),g(e,"class","vertical-tab-nav-item"),oe(e,"is-active",i[1]===i[16])},m(l,c){D(l,e,c),b(e,n),b(e,a),s||(r=H(e,"click",o),s=!0)},p(l,c){i=l,c&18&&oe(e,"is-active",i[1]===i[16])},d(l){l&&A(e),s=!1,r()}}}function sf(i){let e,t;return e=new Dl({}),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function rf(i){let e,t;return e=new Ju({}),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function of(i){let e,t;return e=new Il({}),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function lf(i){let e,t;return e=new tf({props:{previewed:i[0]}}),e.$on("update",i[12]),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},p(n,a){let s={};a&1&&(s.previewed=n[0]),e.$set(s)},i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function py(i){let e,t=`<style>
${i[2].join(`
`)}
</style>`,n,a,s,r,o,l=[gy,my],c=[];function d(h,u){return Jt.Platform.isMobile?1:0}return a=d(i,-1),s=c[a]=l[a](i),{c(){e=new pi(!1),n=W(),s.c(),r=Oe(),e.a=n},m(h,u){e.m(t,h,u),D(h,n,u),c[a].m(h,u),D(h,r,u),o=!0},p(h,[u]){(!o||u&4)&&t!==(t=`<style>
${h[2].join(`
`)}
</style>`)&&e.p(t),s.p(h,u)},i(h){o||(M(s),o=!0)},o(h){Q(s),o=!1},d(h){h&&e.d(),h&&A(n),c[a].d(h),h&&A(r)}}}function by(i,e,t){let n,a,{layout:s}=e,{plugin:r}=e,o=Ne(s);Se(i,o,O=>t(14,n=O)),mn("plugin",r),mn("layout",o);let l="",c=["General","Appearance","Advanced","Previewer"],d=c[0],h=!1,u=O=>{if(O.empty(),h){let E=n.name;new Jt.TextComponent(O).setValue(E).onChange(v=>{E=v});let S=O.createDiv("buttons");new Jt.ExtraButtonComponent(S).setIcon("checkmark").setTooltip("Save").onClick(()=>{h=!1,Te(o,n.name=E,n),u(O)}),new Jt.ExtraButtonComponent(S).setIcon("cross-in-box").setTooltip("Cancel").onClick(()=>{h=!1,u(O)})}else O.createEl("h5",{text:n.name}),new Jt.ExtraButtonComponent(O.createDiv("buttons")).setIcon("pencil").setTooltip("Edit Name").onClick(()=>{h=!0,u(O)})},f=Pe(),m=O=>{new Jt.ButtonComponent(O).setIcon("checkmark").setCta().setTooltip("Save").onClick(()=>{f("saved")})},p=O=>{new Jt.ExtraButtonComponent(O).setIcon("cross").setTooltip("Cancel").onClick(()=>{f("cancel")})},y=pt(o,O=>r.manager.getSheetRules(O));Se(i,y,O=>t(2,a=O));let w=O=>t(1,d=O),_=O=>t(0,l=O.detail);return i.$$set=O=>{"layout"in O&&t(9,s=O.layout),"plugin"in O&&t(10,r=O.plugin)},[l,d,a,o,c,u,m,p,y,s,r,w,_]}var jl=class extends U{constructor(e){super(),G(this,e,by,py,j,{layout:9,plugin:10},fy)}},cf=jl;var mc=It(mi());function Zl(){return ga('var Vh=Object.create;var xo=Object.defineProperty;var Wh=Object.getOwnPropertyDescriptor;var zh=Object.getOwnPropertyNames;var Uh=Object.getPrototypeOf,jh=Object.prototype.hasOwnProperty;var ye=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var Gh=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of zh(t))!jh.call(n,r)&&r!==e&&xo(n,r,{get:()=>t[r],enumerable:!(i=Wh(t,r))||i.enumerable});return n};var ko=(n,t,e)=>(e=n!=null?Vh(Uh(n)):{},Gh(t||!n||!n.__esModule?xo(e,"default",{value:n,enumerable:!0}):e,n));var li=ye(oi=>{"use strict";function Kh(n,t,e){if(e===void 0&&(e=Array.prototype),n&&typeof e.find=="function")return e.find.call(n,t);for(var i=0;i<n.length;i++)if(Object.prototype.hasOwnProperty.call(n,i)){var r=n[i];if(t.call(void 0,r,i,n))return r}}function nr(n,t){return t===void 0&&(t=Object),t&&typeof t.freeze=="function"?t.freeze(n):n}var Co=nr({HTML:"text/html",isHTML:function(n){return n===Co.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Ao=nr({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(n){return n===Ao.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});oi.find=Kh;oi.freeze=nr;oi.MIME_TYPE=Co;oi.NAMESPACE=Ao});var pr=ye(re=>{var Po=li(),_t=Po.find,ai=Po.NAMESPACE;function qh(n){return n!==""}function Xh(n){return n?n.split(/[\\t\\n\\f\\r ]+/).filter(qh):[]}function Yh(n,t){return n.hasOwnProperty(t)||(n[t]=!0),n}function To(n){if(!n)return[];var t=Xh(n);return Object.keys(t.reduce(Yh,{}))}function Jh(n){return function(t){return n&&n.indexOf(t)!==-1}}function ci(n,t){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}function bt(n,t){var e=n.prototype;if(!(e instanceof t)){let r=function(){};var i=r;r.prototype=t.prototype,r=new r,ci(e,r),n.prototype=e=r}e.constructor!=n&&(typeof n!="function"&&console.error("unknown Class:"+n),e.constructor=n)}var wt={},Nt=wt.ELEMENT_NODE=1,Pe=wt.ATTRIBUTE_NODE=2,Gi=wt.TEXT_NODE=3,Io=wt.CDATA_SECTION_NODE=4,_o=wt.ENTITY_REFERENCE_NODE=5,Zh=wt.ENTITY_NODE=6,Lo=wt.PROCESSING_INSTRUCTION_NODE=7,Bo=wt.COMMENT_NODE=8,Fo=wt.DOCUMENT_NODE=9,$o=wt.DOCUMENT_TYPE_NODE=10,Kt=wt.DOCUMENT_FRAGMENT_NODE=11,Qh=wt.NOTATION_NODE=12,ft={},lt={},Ug=ft.INDEX_SIZE_ERR=(lt[1]="Index size error",1),jg=ft.DOMSTRING_SIZE_ERR=(lt[2]="DOMString size error",2),yt=ft.HIERARCHY_REQUEST_ERR=(lt[3]="Hierarchy request error",3),Gg=ft.WRONG_DOCUMENT_ERR=(lt[4]="Wrong document",4),Kg=ft.INVALID_CHARACTER_ERR=(lt[5]="Invalid character",5),qg=ft.NO_DATA_ALLOWED_ERR=(lt[6]="No data allowed",6),Xg=ft.NO_MODIFICATION_ALLOWED_ERR=(lt[7]="No modification allowed",7),Ho=ft.NOT_FOUND_ERR=(lt[8]="Not found",8),Yg=ft.NOT_SUPPORTED_ERR=(lt[9]="Not supported",9),Mo=ft.INUSE_ATTRIBUTE_ERR=(lt[10]="Attribute in use",10),Jg=ft.INVALID_STATE_ERR=(lt[11]="Invalid state",11),Zg=ft.SYNTAX_ERR=(lt[12]="Syntax error",12),Qg=ft.INVALID_MODIFICATION_ERR=(lt[13]="Invalid modification",13),tm=ft.NAMESPACE_ERR=(lt[14]="Invalid namespace",14),em=ft.INVALID_ACCESS_ERR=(lt[15]="Invalid access",15);function Z(n,t){if(t instanceof Error)var e=t;else e=this,Error.call(this,lt[n]),this.message=lt[n],Error.captureStackTrace&&Error.captureStackTrace(this,Z);return e.code=n,t&&(this.message=this.message+": "+t),e}Z.prototype=Error.prototype;ci(ft,Z);function Gt(){}Gt.prototype={length:0,item:function(n){return this[n]||null},toString:function(n,t){for(var e=[],i=0;i<this.length;i++)Ne(this[i],e,n,t);return e.join("")},filter:function(n){return Array.prototype.filter.call(this,n)},indexOf:function(n){return Array.prototype.indexOf.call(this,n)}};function Ie(n,t){this._node=n,this._refresh=t,or(this)}function or(n){var t=n._node._inc||n._node.ownerDocument._inc;if(n._inc!=t){var e=n._refresh(n._node);Zo(n,"length",e.length),ci(e,n),n._inc=t}}Ie.prototype.item=function(n){return or(this),this[n]};bt(Ie,Gt);function Ki(){}function Vo(n,t){for(var e=n.length;e--;)if(n[e]===t)return e}function Eo(n,t,e,i){if(i?t[Vo(t,i)]=e:t[t.length++]=e,n){e.ownerElement=n;var r=n.ownerDocument;r&&(i&&Uo(r,n,i),tc(r,n,e))}}function Ro(n,t,e){var i=Vo(t,e);if(i>=0){for(var r=t.length-1;i<r;)t[i]=t[++i];if(t.length=r,n){var s=n.ownerDocument;s&&(Uo(s,n,e),e.ownerElement=null)}}else throw new Z(Ho,new Error(n.tagName+"@"+e))}Ki.prototype={length:0,item:Gt.prototype.item,getNamedItem:function(n){for(var t=this.length;t--;){var e=this[t];if(e.nodeName==n)return e}},setNamedItem:function(n){var t=n.ownerElement;if(t&&t!=this._ownerElement)throw new Z(Mo);var e=this.getNamedItem(n.nodeName);return Eo(this._ownerElement,this,n,e),e},setNamedItemNS:function(n){var t=n.ownerElement,e;if(t&&t!=this._ownerElement)throw new Z(Mo);return e=this.getNamedItemNS(n.namespaceURI,n.localName),Eo(this._ownerElement,this,n,e),e},removeNamedItem:function(n){var t=this.getNamedItem(n);return Ro(this._ownerElement,this,t),t},removeNamedItemNS:function(n,t){var e=this.getNamedItemNS(n,t);return Ro(this._ownerElement,this,e),e},getNamedItemNS:function(n,t){for(var e=this.length;e--;){var i=this[e];if(i.localName==t&&i.namespaceURI==n)return i}return null}};function Wo(){}Wo.prototype={hasFeature:function(n,t){return!0},createDocument:function(n,t,e){var i=new fi;if(i.implementation=this,i.childNodes=new Gt,i.doctype=e||null,e&&i.appendChild(e),t){var r=i.createElementNS(n,t);i.appendChild(r)}return i},createDocumentType:function(n,t,e){var i=new Yi;return i.name=n,i.nodeName=n,i.publicId=t||"",i.systemId=e||"",i}};function G(){}G.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(n,t){return qi(this,n,t)},replaceChild:function(n,t){qi(this,n,t,Go),t&&this.removeChild(t)},removeChild:function(n){return jo(this,n)},appendChild:function(n){return this.insertBefore(n,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(n){return sr(this.ownerDocument||this,this,n)},normalize:function(){for(var n=this.firstChild;n;){var t=n.nextSibling;t&&t.nodeType==Gi&&n.nodeType==Gi?(this.removeChild(t),n.appendData(t.data)):(n.normalize(),n=t)}},isSupported:function(n,t){return this.ownerDocument.implementation.hasFeature(n,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(n){for(var t=this;t;){var e=t._nsMap;if(e){for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]===n)return i}t=t.nodeType==Pe?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(n){for(var t=this;t;){var e=t._nsMap;if(e&&n in e&&Object.prototype.hasOwnProperty.call(e,n))return e[n];t=t.nodeType==Pe?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(n){var t=this.lookupPrefix(n);return t==null}};function zo(n){return n=="<"&&"&lt;"||n==">"&&"&gt;"||n=="&"&&"&amp;"||n==\'"\'&&"&quot;"||"&#"+n.charCodeAt()+";"}ci(wt,G);ci(wt,G.prototype);function hi(n,t){if(t(n))return!0;if(n=n.firstChild)do if(hi(n,t))return!0;while(n=n.nextSibling)}function fi(){this.ownerDocument=this}function tc(n,t,e){n&&n._inc++;var i=e.namespaceURI;i===ai.XMLNS&&(t._nsMap[e.prefix?e.localName:""]=e.value)}function Uo(n,t,e,i){n&&n._inc++;var r=e.namespaceURI;r===ai.XMLNS&&delete t._nsMap[e.prefix?e.localName:""]}function lr(n,t,e){if(n&&n._inc){n._inc++;var i=t.childNodes;if(e)i[i.length++]=e;else{for(var r=t.firstChild,s=0;r;)i[s++]=r,r=r.nextSibling;i.length=s,delete i[i.length]}}}function jo(n,t){var e=t.previousSibling,i=t.nextSibling;return e?e.nextSibling=i:n.firstChild=i,i?i.previousSibling=e:n.lastChild=e,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,lr(n.ownerDocument,n),t}function ec(n){return n&&(n.nodeType===G.DOCUMENT_NODE||n.nodeType===G.DOCUMENT_FRAGMENT_NODE||n.nodeType===G.ELEMENT_NODE)}function ic(n){return n&&(Lt(n)||ar(n)||qt(n)||n.nodeType===G.DOCUMENT_FRAGMENT_NODE||n.nodeType===G.COMMENT_NODE||n.nodeType===G.PROCESSING_INSTRUCTION_NODE)}function qt(n){return n&&n.nodeType===G.DOCUMENT_TYPE_NODE}function Lt(n){return n&&n.nodeType===G.ELEMENT_NODE}function ar(n){return n&&n.nodeType===G.TEXT_NODE}function Do(n,t){var e=n.childNodes||[];if(_t(e,Lt)||qt(t))return!1;var i=_t(e,qt);return!(t&&i&&e.indexOf(i)>e.indexOf(t))}function Oo(n,t){var e=n.childNodes||[];function i(s){return Lt(s)&&s!==t}if(_t(e,i))return!1;var r=_t(e,qt);return!(t&&r&&e.indexOf(r)>e.indexOf(t))}function nc(n,t,e){if(!ec(n))throw new Z(yt,"Unexpected parent node type "+n.nodeType);if(e&&e.parentNode!==n)throw new Z(Ho,"child not in parent");if(!ic(t)||qt(t)&&n.nodeType!==G.DOCUMENT_NODE)throw new Z(yt,"Unexpected node type "+t.nodeType+" for parent node type "+n.nodeType)}function rc(n,t,e){var i=n.childNodes||[],r=t.childNodes||[];if(t.nodeType===G.DOCUMENT_FRAGMENT_NODE){var s=r.filter(Lt);if(s.length>1||_t(r,ar))throw new Z(yt,"More than one element or text in fragment");if(s.length===1&&!Do(n,e))throw new Z(yt,"Element in fragment can not be inserted before doctype")}if(Lt(t)&&!Do(n,e))throw new Z(yt,"Only one element can be added and only after doctype");if(qt(t)){if(_t(i,qt))throw new Z(yt,"Only one doctype is allowed");var o=_t(i,Lt);if(e&&i.indexOf(o)<i.indexOf(e))throw new Z(yt,"Doctype can only be inserted before an element");if(!e&&o)throw new Z(yt,"Doctype can not be appended since element is present")}}function Go(n,t,e){var i=n.childNodes||[],r=t.childNodes||[];if(t.nodeType===G.DOCUMENT_FRAGMENT_NODE){var s=r.filter(Lt);if(s.length>1||_t(r,ar))throw new Z(yt,"More than one element or text in fragment");if(s.length===1&&!Oo(n,e))throw new Z(yt,"Element in fragment can not be inserted before doctype")}if(Lt(t)&&!Oo(n,e))throw new Z(yt,"Only one element can be added and only after doctype");if(qt(t)){let a=function(h){return qt(h)&&h!==e};var l=a;if(_t(i,a))throw new Z(yt,"Only one doctype is allowed");var o=_t(i,Lt);if(e&&i.indexOf(o)<i.indexOf(e))throw new Z(yt,"Doctype can only be inserted before an element")}}function qi(n,t,e,i){nc(n,t,e),n.nodeType===G.DOCUMENT_NODE&&(i||rc)(n,t,e);var r=t.parentNode;if(r&&r.removeChild(t),t.nodeType===Kt){var s=t.firstChild;if(s==null)return t;var o=t.lastChild}else s=o=t;var l=e?e.previousSibling:n.lastChild;s.previousSibling=l,o.nextSibling=e,l?l.nextSibling=s:n.firstChild=s,e==null?n.lastChild=o:e.previousSibling=o;do s.parentNode=n;while(s!==o&&(s=s.nextSibling));return lr(n.ownerDocument||n,n),t.nodeType==Kt&&(t.firstChild=t.lastChild=null),t}function sc(n,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=n,t.previousSibling=n.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:n.firstChild=t,n.lastChild=t,lr(n.ownerDocument,n,t),t}fi.prototype={nodeName:"#document",nodeType:Fo,doctype:null,documentElement:null,_inc:1,insertBefore:function(n,t){if(n.nodeType==Kt){for(var e=n.firstChild;e;){var i=e.nextSibling;this.insertBefore(e,t),e=i}return n}return qi(this,n,t),n.ownerDocument=this,this.documentElement===null&&n.nodeType===Nt&&(this.documentElement=n),n},removeChild:function(n){return this.documentElement==n&&(this.documentElement=null),jo(this,n)},replaceChild:function(n,t){qi(this,n,t,Go),n.ownerDocument=this,t&&this.removeChild(t),Lt(n)&&(this.documentElement=n)},importNode:function(n,t){return Jo(this,n,t)},getElementById:function(n){var t=null;return hi(this.documentElement,function(e){if(e.nodeType==Nt&&e.getAttribute("id")==n)return t=e,!0}),t},getElementsByClassName:function(n){var t=To(n);return new Ie(this,function(e){var i=[];return t.length>0&&hi(e.documentElement,function(r){if(r!==e&&r.nodeType===Nt){var s=r.getAttribute("class");if(s){var o=n===s;if(!o){var l=To(s);o=t.every(Jh(l))}o&&i.push(r)}}}),i})},createElement:function(n){var t=new be;t.ownerDocument=this,t.nodeName=n,t.tagName=n,t.localName=n,t.childNodes=new Gt;var e=t.attributes=new Ki;return e._ownerElement=t,t},createDocumentFragment:function(){var n=new Ji;return n.ownerDocument=this,n.childNodes=new Gt,n},createTextNode:function(n){var t=new hr;return t.ownerDocument=this,t.appendData(n),t},createComment:function(n){var t=new cr;return t.ownerDocument=this,t.appendData(n),t},createCDATASection:function(n){var t=new fr;return t.ownerDocument=this,t.appendData(n),t},createProcessingInstruction:function(n,t){var e=new dr;return e.ownerDocument=this,e.tagName=e.target=n,e.nodeValue=e.data=t,e},createAttribute:function(n){var t=new Xi;return t.ownerDocument=this,t.name=n,t.nodeName=n,t.localName=n,t.specified=!0,t},createEntityReference:function(n){var t=new ur;return t.ownerDocument=this,t.nodeName=n,t},createElementNS:function(n,t){var e=new be,i=t.split(":"),r=e.attributes=new Ki;return e.childNodes=new Gt,e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.namespaceURI=n,i.length==2?(e.prefix=i[0],e.localName=i[1]):e.localName=t,r._ownerElement=e,e},createAttributeNS:function(n,t){var e=new Xi,i=t.split(":");return e.ownerDocument=this,e.nodeName=t,e.name=t,e.namespaceURI=n,e.specified=!0,i.length==2?(e.prefix=i[0],e.localName=i[1]):e.localName=t,e}};bt(fi,G);function be(){this._nsMap={}}be.prototype={nodeType:Nt,hasAttribute:function(n){return this.getAttributeNode(n)!=null},getAttribute:function(n){var t=this.getAttributeNode(n);return t&&t.value||""},getAttributeNode:function(n){return this.attributes.getNamedItem(n)},setAttribute:function(n,t){var e=this.ownerDocument.createAttribute(n);e.value=e.nodeValue=""+t,this.setAttributeNode(e)},removeAttribute:function(n){var t=this.getAttributeNode(n);t&&this.removeAttributeNode(t)},appendChild:function(n){return n.nodeType===Kt?this.insertBefore(n,null):sc(this,n)},setAttributeNode:function(n){return this.attributes.setNamedItem(n)},setAttributeNodeNS:function(n){return this.attributes.setNamedItemNS(n)},removeAttributeNode:function(n){return this.attributes.removeNamedItem(n.nodeName)},removeAttributeNS:function(n,t){var e=this.getAttributeNodeNS(n,t);e&&this.removeAttributeNode(e)},hasAttributeNS:function(n,t){return this.getAttributeNodeNS(n,t)!=null},getAttributeNS:function(n,t){var e=this.getAttributeNodeNS(n,t);return e&&e.value||""},setAttributeNS:function(n,t,e){var i=this.ownerDocument.createAttributeNS(n,t);i.value=i.nodeValue=""+e,this.setAttributeNode(i)},getAttributeNodeNS:function(n,t){return this.attributes.getNamedItemNS(n,t)},getElementsByTagName:function(n){return new Ie(this,function(t){var e=[];return hi(t,function(i){i!==t&&i.nodeType==Nt&&(n==="*"||i.tagName==n)&&e.push(i)}),e})},getElementsByTagNameNS:function(n,t){return new Ie(this,function(e){var i=[];return hi(e,function(r){r!==e&&r.nodeType===Nt&&(n==="*"||r.namespaceURI===n)&&(t==="*"||r.localName==t)&&i.push(r)}),i})}};fi.prototype.getElementsByTagName=be.prototype.getElementsByTagName;fi.prototype.getElementsByTagNameNS=be.prototype.getElementsByTagNameNS;bt(be,G);function Xi(){}Xi.prototype.nodeType=Pe;bt(Xi,G);function ui(){}ui.prototype={data:"",substringData:function(n,t){return this.data.substring(n,n+t)},appendData:function(n){n=this.data+n,this.nodeValue=this.data=n,this.length=n.length},insertData:function(n,t){this.replaceData(n,0,t)},appendChild:function(n){throw new Error(lt[yt])},deleteData:function(n,t){this.replaceData(n,t,"")},replaceData:function(n,t,e){var i=this.data.substring(0,n),r=this.data.substring(n+t);e=i+e+r,this.nodeValue=this.data=e,this.length=e.length}};bt(ui,G);function hr(){}hr.prototype={nodeName:"#text",nodeType:Gi,splitText:function(n){var t=this.data,e=t.substring(n);t=t.substring(0,n),this.data=this.nodeValue=t,this.length=t.length;var i=this.ownerDocument.createTextNode(e);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}};bt(hr,ui);function cr(){}cr.prototype={nodeName:"#comment",nodeType:Bo};bt(cr,ui);function fr(){}fr.prototype={nodeName:"#cdata-section",nodeType:Io};bt(fr,ui);function Yi(){}Yi.prototype.nodeType=$o;bt(Yi,G);function Ko(){}Ko.prototype.nodeType=Qh;bt(Ko,G);function qo(){}qo.prototype.nodeType=Zh;bt(qo,G);function ur(){}ur.prototype.nodeType=_o;bt(ur,G);function Ji(){}Ji.prototype.nodeName="#document-fragment";Ji.prototype.nodeType=Kt;bt(Ji,G);function dr(){}dr.prototype.nodeType=Lo;bt(dr,G);function Xo(){}Xo.prototype.serializeToString=function(n,t,e){return Yo.call(n,t,e)};G.prototype.toString=Yo;function Yo(n,t){var e=[],i=this.nodeType==9&&this.documentElement||this,r=i.prefix,s=i.namespaceURI;if(s&&r==null){var r=i.lookupPrefix(s);if(r==null)var o=[{namespace:s,prefix:null}]}return Ne(this,e,n,t,o),e.join("")}function No(n,t,e){var i=n.prefix||"",r=n.namespaceURI;if(!r||i==="xml"&&r===ai.XML||r===ai.XMLNS)return!1;for(var s=e.length;s--;){var o=e[s];if(o.prefix===i)return o.namespace!==r}return!0}function rr(n,t,e){n.push(" ",t,\'="\',e.replace(/[<&"]/g,zo),\'"\')}function Ne(n,t,e,i,r){if(r||(r=[]),i)if(n=i(n),n){if(typeof n=="string"){t.push(n);return}}else return;switch(n.nodeType){case Nt:var s=n.attributes,o=s.length,v=n.firstChild,l=n.tagName;e=ai.isHTML(n.namespaceURI)||e;var a=l;if(!e&&!n.prefix&&n.namespaceURI){for(var h,c=0;c<s.length;c++)if(s.item(c).name==="xmlns"){h=s.item(c).value;break}if(!h)for(var f=r.length-1;f>=0;f--){var u=r[f];if(u.prefix===""&&u.namespace===n.namespaceURI){h=u.namespace;break}}if(h!==n.namespaceURI)for(var f=r.length-1;f>=0;f--){var u=r[f];if(u.namespace===n.namespaceURI){u.prefix&&(a=u.prefix+":"+l);break}}}t.push("<",a);for(var d=0;d<o;d++){var p=s.item(d);p.prefix=="xmlns"?r.push({prefix:p.localName,namespace:p.value}):p.nodeName=="xmlns"&&r.push({prefix:"",namespace:p.value})}for(var d=0;d<o;d++){var p=s.item(d);if(No(p,e,r)){var b=p.prefix||"",y=p.namespaceURI;rr(t,b?"xmlns:"+b:"xmlns",y),r.push({prefix:b,namespace:y})}Ne(p,t,e,i,r)}if(l===a&&No(n,e,r)){var b=n.prefix||"",y=n.namespaceURI;rr(t,b?"xmlns:"+b:"xmlns",y),r.push({prefix:b,namespace:y})}if(v||e&&!/^(?:meta|link|img|br|hr|input)$/i.test(l)){if(t.push(">"),e&&/^script$/i.test(l))for(;v;)v.data?t.push(v.data):Ne(v,t,e,i,r.slice()),v=v.nextSibling;else for(;v;)Ne(v,t,e,i,r.slice()),v=v.nextSibling;t.push("</",a,">")}else t.push("/>");return;case Fo:case Kt:for(var v=n.firstChild;v;)Ne(v,t,e,i,r.slice()),v=v.nextSibling;return;case Pe:return rr(t,n.name,n.value);case Gi:return t.push(n.data.replace(/[<&]/g,zo).replace(/]]>/g,"]]&gt;"));case Io:return t.push("<![CDATA[",n.data,"]]>");case Bo:return t.push("<!--",n.data,"-->");case $o:var N=n.publicId,C=n.systemId;if(t.push("<!DOCTYPE ",n.name),N)t.push(" PUBLIC ",N),C&&C!="."&&t.push(" ",C),t.push(">");else if(C&&C!=".")t.push(" SYSTEM ",C,">");else{var O=n.internalSubset;O&&t.push(" [",O,"]"),t.push(">")}return;case Lo:return t.push("<?",n.target," ",n.data,"?>");case _o:return t.push("&",n.nodeName,";");default:t.push("??",n.nodeName)}}function Jo(n,t,e){var i;switch(t.nodeType){case Nt:i=t.cloneNode(!1),i.ownerDocument=n;case Kt:break;case Pe:e=!0;break}if(i||(i=t.cloneNode(!1)),i.ownerDocument=n,i.parentNode=null,e)for(var r=t.firstChild;r;)i.appendChild(Jo(n,r,e)),r=r.nextSibling;return i}function sr(n,t,e){var i=new t.constructor;for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var s=t[r];typeof s!="object"&&s!=i[r]&&(i[r]=s)}switch(t.childNodes&&(i.childNodes=new Gt),i.ownerDocument=n,i.nodeType){case Nt:var o=t.attributes,l=i.attributes=new Ki,a=o.length;l._ownerElement=i;for(var h=0;h<a;h++)i.setAttributeNode(sr(n,o.item(h),!0));break;case Pe:e=!0}if(e)for(var c=t.firstChild;c;)i.appendChild(sr(n,c,e)),c=c.nextSibling;return i}function Zo(n,t,e){n[t]=e}try{if(Object.defineProperty){let n=function(t){switch(t.nodeType){case Nt:case Kt:var e=[];for(t=t.firstChild;t;)t.nodeType!==7&&t.nodeType!==8&&e.push(n(t)),t=t.nextSibling;return e.join("");default:return t.nodeValue}};oc=n,Object.defineProperty(Ie.prototype,"length",{get:function(){return or(this),this.$$length}}),Object.defineProperty(G.prototype,"textContent",{get:function(){return n(this)},set:function(t){switch(this.nodeType){case Nt:case Kt:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),Zo=function(t,e,i){t["$$"+e]=i}}}catch(n){}var oc;re.DocumentType=Yi;re.DOMException=Z;re.DOMImplementation=Wo;re.Element=be;re.Node=G;re.NodeList=Gt;re.XMLSerializer=Xo});var tl=ye(di=>{var Qo=li().freeze;di.XML_ENTITIES=Qo({amp:"&",apos:"\'",gt:">",lt:"<",quot:\'"\'});di.HTML_ENTITIES=Qo({lt:"<",gt:">",amp:"&",quot:\'"\',apos:"\'",Agrave:"\\xC0",Aacute:"\\xC1",Acirc:"\\xC2",Atilde:"\\xC3",Auml:"\\xC4",Aring:"\\xC5",AElig:"\\xC6",Ccedil:"\\xC7",Egrave:"\\xC8",Eacute:"\\xC9",Ecirc:"\\xCA",Euml:"\\xCB",Igrave:"\\xCC",Iacute:"\\xCD",Icirc:"\\xCE",Iuml:"\\xCF",ETH:"\\xD0",Ntilde:"\\xD1",Ograve:"\\xD2",Oacute:"\\xD3",Ocirc:"\\xD4",Otilde:"\\xD5",Ouml:"\\xD6",Oslash:"\\xD8",Ugrave:"\\xD9",Uacute:"\\xDA",Ucirc:"\\xDB",Uuml:"\\xDC",Yacute:"\\xDD",THORN:"\\xDE",szlig:"\\xDF",agrave:"\\xE0",aacute:"\\xE1",acirc:"\\xE2",atilde:"\\xE3",auml:"\\xE4",aring:"\\xE5",aelig:"\\xE6",ccedil:"\\xE7",egrave:"\\xE8",eacute:"\\xE9",ecirc:"\\xEA",euml:"\\xEB",igrave:"\\xEC",iacute:"\\xED",icirc:"\\xEE",iuml:"\\xEF",eth:"\\xF0",ntilde:"\\xF1",ograve:"\\xF2",oacute:"\\xF3",ocirc:"\\xF4",otilde:"\\xF5",ouml:"\\xF6",oslash:"\\xF8",ugrave:"\\xF9",uacute:"\\xFA",ucirc:"\\xFB",uuml:"\\xFC",yacute:"\\xFD",thorn:"\\xFE",yuml:"\\xFF",nbsp:"\\xA0",iexcl:"\\xA1",cent:"\\xA2",pound:"\\xA3",curren:"\\xA4",yen:"\\xA5",brvbar:"\\xA6",sect:"\\xA7",uml:"\\xA8",copy:"\\xA9",ordf:"\\xAA",laquo:"\\xAB",not:"\\xAC",shy:"\\xAD\\xAD",reg:"\\xAE",macr:"\\xAF",deg:"\\xB0",plusmn:"\\xB1",sup2:"\\xB2",sup3:"\\xB3",acute:"\\xB4",micro:"\\xB5",para:"\\xB6",middot:"\\xB7",cedil:"\\xB8",sup1:"\\xB9",ordm:"\\xBA",raquo:"\\xBB",frac14:"\\xBC",frac12:"\\xBD",frac34:"\\xBE",iquest:"\\xBF",times:"\\xD7",divide:"\\xF7",forall:"\\u2200",part:"\\u2202",exist:"\\u2203",empty:"\\u2205",nabla:"\\u2207",isin:"\\u2208",notin:"\\u2209",ni:"\\u220B",prod:"\\u220F",sum:"\\u2211",minus:"\\u2212",lowast:"\\u2217",radic:"\\u221A",prop:"\\u221D",infin:"\\u221E",ang:"\\u2220",and:"\\u2227",or:"\\u2228",cap:"\\u2229",cup:"\\u222A",int:"\\u222B",there4:"\\u2234",sim:"\\u223C",cong:"\\u2245",asymp:"\\u2248",ne:"\\u2260",equiv:"\\u2261",le:"\\u2264",ge:"\\u2265",sub:"\\u2282",sup:"\\u2283",nsub:"\\u2284",sube:"\\u2286",supe:"\\u2287",oplus:"\\u2295",otimes:"\\u2297",perp:"\\u22A5",sdot:"\\u22C5",Alpha:"\\u0391",Beta:"\\u0392",Gamma:"\\u0393",Delta:"\\u0394",Epsilon:"\\u0395",Zeta:"\\u0396",Eta:"\\u0397",Theta:"\\u0398",Iota:"\\u0399",Kappa:"\\u039A",Lambda:"\\u039B",Mu:"\\u039C",Nu:"\\u039D",Xi:"\\u039E",Omicron:"\\u039F",Pi:"\\u03A0",Rho:"\\u03A1",Sigma:"\\u03A3",Tau:"\\u03A4",Upsilon:"\\u03A5",Phi:"\\u03A6",Chi:"\\u03A7",Psi:"\\u03A8",Omega:"\\u03A9",alpha:"\\u03B1",beta:"\\u03B2",gamma:"\\u03B3",delta:"\\u03B4",epsilon:"\\u03B5",zeta:"\\u03B6",eta:"\\u03B7",theta:"\\u03B8",iota:"\\u03B9",kappa:"\\u03BA",lambda:"\\u03BB",mu:"\\u03BC",nu:"\\u03BD",xi:"\\u03BE",omicron:"\\u03BF",pi:"\\u03C0",rho:"\\u03C1",sigmaf:"\\u03C2",sigma:"\\u03C3",tau:"\\u03C4",upsilon:"\\u03C5",phi:"\\u03C6",chi:"\\u03C7",psi:"\\u03C8",omega:"\\u03C9",thetasym:"\\u03D1",upsih:"\\u03D2",piv:"\\u03D6",OElig:"\\u0152",oelig:"\\u0153",Scaron:"\\u0160",scaron:"\\u0161",Yuml:"\\u0178",fnof:"\\u0192",circ:"\\u02C6",tilde:"\\u02DC",ensp:"\\u2002",emsp:"\\u2003",thinsp:"\\u2009",zwnj:"\\u200C",zwj:"\\u200D",lrm:"\\u200E",rlm:"\\u200F",ndash:"\\u2013",mdash:"\\u2014",lsquo:"\\u2018",rsquo:"\\u2019",sbquo:"\\u201A",ldquo:"\\u201C",rdquo:"\\u201D",bdquo:"\\u201E",dagger:"\\u2020",Dagger:"\\u2021",bull:"\\u2022",hellip:"\\u2026",permil:"\\u2030",prime:"\\u2032",Prime:"\\u2033",lsaquo:"\\u2039",rsaquo:"\\u203A",oline:"\\u203E",euro:"\\u20AC",trade:"\\u2122",larr:"\\u2190",uarr:"\\u2191",rarr:"\\u2192",darr:"\\u2193",harr:"\\u2194",crarr:"\\u21B5",lceil:"\\u2308",rceil:"\\u2309",lfloor:"\\u230A",rfloor:"\\u230B",loz:"\\u25CA",spades:"\\u2660",clubs:"\\u2663",hearts:"\\u2665",diams:"\\u2666"});di.entityMap=di.HTML_ENTITIES});var al=ye(mr=>{var yi=li().NAMESPACE,gr=/[A-Z_a-z\\xC0-\\xD6\\xD8-\\xF6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/,el=new RegExp("[\\\\-\\\\.0-9"+gr.source.slice(1,-1)+"\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040]"),il=new RegExp("^"+gr.source+el.source+"*(?::"+gr.source+el.source+"*)?$"),pi=0,se=1,_e=2,gi=3,Le=4,Be=5,mi=6,Zi=7;function Fe(n,t){this.message=n,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Fe)}Fe.prototype=new Error;Fe.prototype.name=Fe.name;function sl(){}sl.prototype={parse:function(n,t,e){var i=this.domBuilder;i.startDocument(),ol(t,t={}),lc(n,t,e,i,this.errorHandler),i.endDocument()}};function lc(n,t,e,i,r){function s(H){if(H>65535){H-=65536;var L=55296+(H>>10),nt=56320+(H&1023);return String.fromCharCode(L,nt)}else return String.fromCharCode(H)}function o(H){var L=H.slice(1,-1);return L in e?e[L]:L.charAt(0)==="#"?s(parseInt(L.substr(1).replace("x","0x"))):(r.error("entity not found:"+H),H)}function l(H){if(H>b){var L=n.substring(b,H).replace(/&#?\\w+;/g,o);u&&a(b),i.characters(L,0,H-b),b=H}}function a(H,L){for(;H>=c&&(L=f.exec(n));)h=L.index,c=h+L[0].length,u.lineNumber++;u.columnNumber=H-h+1}for(var h=0,c=0,f=/.*(?:\\r\\n?|\\n)|.*$/g,u=i.locator,d=[{currentNSMap:t}],p={},b=0;;){try{var y=n.indexOf("<",b);if(y<0){if(!n.substr(b).match(/^\\s*$/)){var v=i.doc,N=v.createTextNode(n.substr(b));v.appendChild(N),i.currentElement=N}return}switch(y>b&&l(y),n.charAt(y+1)){case"/":var w=n.indexOf(">",y+3),C=n.substring(y+2,w).replace(/[ \\t\\n\\r]+$/g,""),O=d.pop();w<0?(C=n.substring(y+2).replace(/[\\s<].*/,""),r.error("end tag name: "+C+" is not complete:"+O.tagName),w=y+1+C.length):C.match(/\\s</)&&(C=C.replace(/[\\s<].*/,""),r.error("end tag name: "+C+" maybe not complete"),w=y+1+C.length);var k=O.localNSMap,T=O.tagName==C,x=T||O.tagName&&O.tagName.toLowerCase()==C.toLowerCase();if(x){if(i.endElement(O.uri,O.localName,C),k)for(var M in k)Object.prototype.hasOwnProperty.call(k,M)&&i.endPrefixMapping(M);T||r.fatalError("end tag name: "+C+" is not match the current start tagName:"+O.tagName)}else d.push(O);w++;break;case"?":u&&a(y),w=uc(n,y,i);break;case"!":u&&a(y),w=fc(n,y,i,r);break;default:u&&a(y);var S=new ll,_=d[d.length-1].currentNSMap,w=ac(n,y,S,_,o,r),D=S.length;if(!S.closed&&cc(n,w,S.tagName,p)&&(S.closed=!0,e.nbsp||r.warning("unclosed xml attribute")),u&&D){for(var F=nl(u,{}),P=0;P<D;P++){var B=S[P];a(B.offset),B.locator=nl(u,{})}i.locator=F,rl(S,i,_)&&d.push(S),i.locator=u}else rl(S,i,_)&&d.push(S);yi.isHTML(S.uri)&&!S.closed?w=hc(n,w,S.tagName,o,i):w++}}catch(H){if(H instanceof Fe)throw H;r.error("element parse error: "+H),w=-1}w>b?b=w:l(Math.max(y,b)+1)}}function nl(n,t){return t.lineNumber=n.lineNumber,t.columnNumber=n.columnNumber,t}function ac(n,t,e,i,r,s){function o(d,p,b){e.attributeNames.hasOwnProperty(d)&&s.fatalError("Attribute "+d+" redefined"),e.addValue(d,p,b)}for(var l,a,h=++t,c=pi;;){var f=n.charAt(h);switch(f){case"=":if(c===se)l=n.slice(t,h),c=gi;else if(c===_e)c=gi;else throw new Error("attribute equal must after attrName");break;case"\'":case\'"\':if(c===gi||c===se)if(c===se&&(s.warning(\'attribute value must after "="\'),l=n.slice(t,h)),t=h+1,h=n.indexOf(f,t),h>0)a=n.slice(t,h).replace(/&#?\\w+;/g,r),o(l,a,t-1),c=Be;else throw new Error("attribute value no end \'"+f+"\' match");else if(c==Le)a=n.slice(t,h).replace(/&#?\\w+;/g,r),o(l,a,t),s.warning(\'attribute "\'+l+\'" missed start quot(\'+f+")!!"),t=h+1,c=Be;else throw new Error(\'attribute value must after "="\');break;case"/":switch(c){case pi:e.setTagName(n.slice(t,h));case Be:case mi:case Zi:c=Zi,e.closed=!0;case Le:case se:break;case _e:e.closed=!0;break;default:throw new Error("attribute invalid close char(\'/\')")}break;case"":return s.error("unexpected end of input"),c==pi&&e.setTagName(n.slice(t,h)),h;case">":switch(c){case pi:e.setTagName(n.slice(t,h));case Be:case mi:case Zi:break;case Le:case se:a=n.slice(t,h),a.slice(-1)==="/"&&(e.closed=!0,a=a.slice(0,-1));case _e:c===_e&&(a=l),c==Le?(s.warning(\'attribute "\'+a+\'" missed quot(")!\'),o(l,a.replace(/&#?\\w+;/g,r),t)):((!yi.isHTML(i[""])||!a.match(/^(?:disabled|checked|selected)$/i))&&s.warning(\'attribute "\'+a+\'" missed value!! "\'+a+\'" instead!!\'),o(a,a,t));break;case gi:throw new Error("attribute value missed!!")}return h;case"\\x80":f=" ";default:if(f<=" ")switch(c){case pi:e.setTagName(n.slice(t,h)),c=mi;break;case se:l=n.slice(t,h),c=_e;break;case Le:var a=n.slice(t,h).replace(/&#?\\w+;/g,r);s.warning(\'attribute "\'+a+\'" missed quot(")!!\'),o(l,a,t);case Be:c=mi;break}else switch(c){case _e:var u=e.tagName;(!yi.isHTML(i[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&s.warning(\'attribute "\'+l+\'" missed value!! "\'+l+\'" instead2!!\'),o(l,l,t),t=h,c=se;break;case Be:s.warning(\'attribute space is required"\'+l+\'"!!\');case mi:c=se,t=h;break;case gi:c=Le,t=h;break;case Zi:throw new Error("elements closed character \'/\' and \'>\' must be connected to")}}h++}}function rl(n,t,e){for(var i=n.tagName,r=null,f=n.length;f--;){var s=n[f],o=s.qName,l=s.value,u=o.indexOf(":");if(u>0)var a=s.prefix=o.slice(0,u),h=o.slice(u+1),c=a==="xmlns"&&h;else h=o,a=null,c=o==="xmlns"&&"";s.localName=h,c!==!1&&(r==null&&(r={},ol(e,e={})),e[c]=r[c]=l,s.uri=yi.XMLNS,t.startPrefixMapping(c,l))}for(var f=n.length;f--;){s=n[f];var a=s.prefix;a&&(a==="xml"&&(s.uri=yi.XML),a!=="xmlns"&&(s.uri=e[a||""]))}var u=i.indexOf(":");u>0?(a=n.prefix=i.slice(0,u),h=n.localName=i.slice(u+1)):(a=null,h=n.localName=i);var d=n.uri=e[a||""];if(t.startElement(d,h,i,n),n.closed){if(t.endElement(d,h,i),r)for(a in r)Object.prototype.hasOwnProperty.call(r,a)&&t.endPrefixMapping(a)}else return n.currentNSMap=e,n.localNSMap=r,!0}function hc(n,t,e,i,r){if(/^(?:script|textarea)$/i.test(e)){var s=n.indexOf("</"+e+">",t),o=n.substring(t+1,s);if(/[&<]/.test(o))return/^script$/i.test(e)?(r.characters(o,0,o.length),s):(o=o.replace(/&#?\\w+;/g,i),r.characters(o,0,o.length),s)}return t+1}function cc(n,t,e,i){var r=i[e];return r==null&&(r=n.lastIndexOf("</"+e+">"),r<t&&(r=n.lastIndexOf("</"+e)),i[e]=r),r<t}function ol(n,t){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}function fc(n,t,e,i){var r=n.charAt(t+2);switch(r){case"-":if(n.charAt(t+3)==="-"){var s=n.indexOf("-->",t+4);return s>t?(e.comment(n,t+4,s-t-4),s+3):(i.error("Unclosed comment"),-1)}else return-1;default:if(n.substr(t+3,6)=="CDATA["){var s=n.indexOf("]]>",t+9);return e.startCDATA(),e.characters(n,t+9,s-t-9),e.endCDATA(),s+3}var o=dc(n,t),l=o.length;if(l>1&&/!doctype/i.test(o[0][0])){var a=o[1][0],h=!1,c=!1;l>3&&(/^public$/i.test(o[2][0])?(h=o[3][0],c=l>4&&o[4][0]):/^system$/i.test(o[2][0])&&(c=o[3][0]));var f=o[l-1];return e.startDTD(a,h,c),e.endDTD(),f.index+f[0].length}}return-1}function uc(n,t,e){var i=n.indexOf("?>",t);if(i){var r=n.substring(t,i).match(/^<\\?(\\S*)\\s*([\\s\\S]*?)\\s*$/);if(r){var s=r[0].length;return e.processingInstruction(r[1],r[2]),i+2}else return-1}return-1}function ll(){this.attributeNames={}}ll.prototype={setTagName:function(n){if(!il.test(n))throw new Error("invalid tagName:"+n);this.tagName=n},addValue:function(n,t,e){if(!il.test(n))throw new Error("invalid attribute:"+n);this.attributeNames[n]=this.length,this[this.length++]={qName:n,value:t,offset:e}},length:0,getLocalName:function(n){return this[n].localName},getLocator:function(n){return this[n].locator},getQName:function(n){return this[n].qName},getURI:function(n){return this[n].uri},getValue:function(n){return this[n].value}};function dc(n,t){var e,i=[],r=/\'[^\']+\'|"[^"]+"|[^\\s<>\\/=]+=?|(\\/?\\s*>|<)/g;for(r.lastIndex=t,r.exec(n);e=r.exec(n);)if(i.push(e),e[1])return i}mr.XMLReader=sl;mr.ParseError=Fe});var pl=ye(wi=>{var pc=li(),br=pr(),hl=tl(),ul=al(),gc=br.DOMImplementation,cl=pc.NAMESPACE,mc=ul.ParseError,yc=ul.XMLReader;function dl(n){this.options=n||{locator:{}}}dl.prototype.parseFromString=function(n,t){var e=this.options,i=new yc,r=e.domBuilder||new bi,s=e.errorHandler,o=e.locator,l=e.xmlns||{},a=/\\/x?html?$/.test(t),h=a?hl.HTML_ENTITIES:hl.XML_ENTITIES;return o&&r.setDocumentLocator(o),i.errorHandler=bc(s,r,o),i.domBuilder=e.domBuilder||r,a&&(l[""]=cl.HTML),l.xml=l.xml||cl.XML,n&&typeof n=="string"?i.parse(n,l,h):i.errorHandler.error("invalid doc source"),r.doc};function bc(n,t,e){if(!n){if(t instanceof bi)return t;n=t}var i={},r=n instanceof Function;e=e||{};function s(o){var l=n[o];!l&&r&&(l=n.length==2?function(a){n(o,a)}:n),i[o]=l&&function(a){l("[xmldom "+o+"] "+a+yr(e))}||function(){}}return s("warning"),s("error"),s("fatalError"),i}function bi(){this.cdata=!1}function $e(n,t){t.lineNumber=n.lineNumber,t.columnNumber=n.columnNumber}bi.prototype={startDocument:function(){this.doc=new gc().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(n,t,e,i){var r=this.doc,s=r.createElementNS(n,e||t),o=i.length;Qi(this,s),this.currentElement=s,this.locator&&$e(this.locator,s);for(var l=0;l<o;l++){var n=i.getURI(l),a=i.getValue(l),e=i.getQName(l),h=r.createAttributeNS(n,e);this.locator&&$e(i.getLocator(l),h),h.value=h.nodeValue=a,s.setAttributeNode(h)}},endElement:function(n,t,e){var i=this.currentElement,r=i.tagName;this.currentElement=i.parentNode},startPrefixMapping:function(n,t){},endPrefixMapping:function(n){},processingInstruction:function(n,t){var e=this.doc.createProcessingInstruction(n,t);this.locator&&$e(this.locator,e),Qi(this,e)},ignorableWhitespace:function(n,t,e){},characters:function(n,t,e){if(n=fl.apply(this,arguments),n){if(this.cdata)var i=this.doc.createCDATASection(n);else var i=this.doc.createTextNode(n);this.currentElement?this.currentElement.appendChild(i):/^\\s*$/.test(n)&&this.doc.appendChild(i),this.locator&&$e(this.locator,i)}},skippedEntity:function(n){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(n){(this.locator=n)&&(n.lineNumber=0)},comment:function(n,t,e){n=fl.apply(this,arguments);var i=this.doc.createComment(n);this.locator&&$e(this.locator,i),Qi(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(n,t,e){var i=this.doc.implementation;if(i&&i.createDocumentType){var r=i.createDocumentType(n,t,e);this.locator&&$e(this.locator,r),Qi(this,r),this.doc.doctype=r}},warning:function(n){console.warn("[xmldom warning] "+n,yr(this.locator))},error:function(n){console.error("[xmldom error] "+n,yr(this.locator))},fatalError:function(n){throw new mc(n,this.locator)}};function yr(n){if(n)return`\n@`+(n.systemId||"")+"#[line:"+n.lineNumber+",col:"+n.columnNumber+"]"}function fl(n,t,e){return typeof n=="string"?n.substr(t,e):n.length>=t+e||t?new java.lang.String(n,t,e)+"":n}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\\w+/g,function(n){bi.prototype[n]=function(){return null}});function Qi(n,t){n.currentElement?n.currentElement.appendChild(t):n.doc.appendChild(t)}wi.__DOMHandler=bi;wi.DOMParser=dl;wi.DOMImplementation=br.DOMImplementation;wi.XMLSerializer=br.XMLSerializer});var ml=ye(tn=>{var gl=pr();tn.DOMImplementation=gl.DOMImplementation;tn.XMLSerializer=gl.XMLSerializer;tn.DOMParser=pl().DOMParser});var hh=ye((Cs,As)=>{(function(n,t){typeof Cs=="object"&&typeof As!="undefined"?As.exports=t():typeof define=="function"&&define.amd?define(t):(n=typeof globalThis!="undefined"?globalThis:n||self,n["fast-copy"]=t())})(Cs,function(){"use strict";var n=Function.prototype.toString,t=Object.create,e=Object.defineProperty,i=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,s=Object.getOwnPropertySymbols,o=Object.getPrototypeOf,l=Object.prototype,a=l.hasOwnProperty,h=l.propertyIsEnumerable,c=typeof s=="function",f=typeof WeakMap=="function",u=function(){if(f)return function(){return new WeakMap};var k=function(){function T(){this._keys=[],this._values=[]}return T.prototype.has=function(x){return!!~this._keys.indexOf(x)},T.prototype.get=function(x){return this._values[this._keys.indexOf(x)]},T.prototype.set=function(x,M){this._keys.push(x),this._values.push(M)},T}();return function(){return new k}}(),d=function(k,T){var x=k.__proto__||o(k);if(!x)return t(null);var M=x.constructor;if(M===T.Object)return x===T.Object.prototype?{}:t(x);if(~n.call(M).indexOf("[native code]"))try{return new M}catch(S){}return t(x)},p=function(k,T,x,M){var S=d(k,T);M.set(k,S);for(var _ in k)a.call(k,_)&&(S[_]=x(k[_],M));if(c)for(var w=s(k),D=0,F=w.length,P=void 0;D<F;++D)P=w[D],h.call(k,P)&&(S[P]=x(k[P],M));return S},b=function(k,T,x,M){var S=d(k,T);M.set(k,S);for(var _=c?r(k).concat(s(k)):r(k),w=0,D=_.length,F=void 0,P=void 0;w<D;++w)if(F=_[w],F!=="callee"&&F!=="caller")if(P=i(k,F),P){!P.get&&!P.set&&(P.value=x(k[F],M));try{e(S,F,P)}catch(B){S[F]=P.value}}else S[F]=x(k[F],M);return S},y=function(k){var T="";return k.global&&(T+="g"),k.ignoreCase&&(T+="i"),k.multiline&&(T+="m"),k.unicode&&(T+="u"),k.sticky&&(T+="y"),T},v=Array.isArray,N=Object.getPrototypeOf,C=function(){return typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:(console&&console.error&&console.error(\'Unable to locate global object, returning "this".\'),this)}();function O(k,T){var x=!!(T&&T.isStrict),M=T&&T.realm||C,S=x?b:p,_=function(w,D){if(!w||typeof w!="object")return w;if(D.has(w))return D.get(w);var F=w.__proto__||N(w),P=F&&F.constructor;if(!P||P===M.Object)return S(w,M,_,D);var B;if(v(w)){if(x)return b(w,M,_,D);B=new P,D.set(w,B);for(var H=0,L=w.length;H<L;++H)B[H]=_(w[H],D);return B}if(w instanceof M.Date)return new P(w.getTime());if(w instanceof M.RegExp)return B=new P(w.source,w.flags||y(w)),B.lastIndex=w.lastIndex,B;if(M.Map&&w instanceof M.Map)return B=new P,D.set(w,B),w.forEach(function(nt,W){B.set(W,_(nt,D))}),B;if(M.Set&&w instanceof M.Set)return B=new P,D.set(w,B),w.forEach(function(nt){B.add(_(nt,D))}),B;if(M.Blob&&w instanceof M.Blob)return w.slice(0,w.size,w.type);if(M.Buffer&&M.Buffer.isBuffer(w))return B=M.Buffer.allocUnsafe?M.Buffer.allocUnsafe(w.length):new P(w.length),D.set(w,B),w.copy(B),B;if(M.ArrayBuffer){if(M.ArrayBuffer.isView(w))return B=new P(w.buffer.slice(0)),D.set(w,B),B;if(w instanceof M.ArrayBuffer)return B=w.slice(0),D.set(w,B),B}return typeof w.then=="function"||w instanceof Error||M.WeakMap&&w instanceof M.WeakMap||M.WeakSet&&w instanceof M.WeakSet?w:S(w,M,_,D)};return _(k,u())}return O.default=O,O.strict=function(T,x){return O(T,{isStrict:!0,realm:x?x.realm:void 0})},O})});var bl=ko(ml());async function wl(n){return new Promise((t,e)=>{let i=new FileReader;i.onload=async r=>{let s=r.target.result,l=new bl.DOMParser().parseFromString(s,"application/xml").getElementsByTagName("monster"),a=[];if(l.length){for(let h of Array.from(l))try{let c={image:null,name:at(h,"name"),size:Cc(h),type:at(h,"type"),subtype:at(h,"subtype"),alignment:at(h,"alignment"),ac:Ac(h),hp:Number(yl(h,"hp")),hit_dice:yl(h,"hit_dice"),speed:at(h,"speed"),stats:[Number(at(h,"str")),Number(at(h,"dex")),Number(at(h,"con")),Number(at(h,"int")),Number(at(h,"wis")),Number(at(h,"cha"))],saves:xc(h),skillsaves:vc(h),damage_vulnerabilities:at(h,"vulnerable"),damage_resistances:at(h,"resist"),damage_immunities:at(h,"immune"),condition_immunities:at(h,"conditionImmune"),senses:at(h,"senses"),languages:at(h,"languages"),cr:at(h,"cr"),traits:en(h,"trait"),spells:wc(h),actions:en(h,"action"),legendary_actions:en(h,"legendary"),reactions:en(h,"reaction"),source:Tc(h)};a.push(c)}catch(c){console.error(c);continue}t(a)}},i.readAsText(n)})}function at(n,t){let e=n.getElementsByTagName(t);if(e&&e.length)return e[0].textContent}function en(n,t){var r;if(!((r=n.getElementsByTagName(t))!=null&&r.length))return[];let e=n.getElementsByTagName(t),i=[];for(let s of Array.from(e)){let o=s.getElementsByTagName("name");if(!o||!o.length||!o[0].textContent||o[0].textContent.includes("Spellcasting"))continue;let l=[],a=s.getElementsByTagName("text");for(let h of Array.from(a))l.push(h.textContent);i.push({name:o[0].textContent,desc:l.join(" ")})}return i}function wc(n){var i;if(!((i=n.getElementsByTagName("trait"))!=null&&i.length))return[];let e=Array.from(n.getElementsByTagName("trait")).find(r=>{var s;return(s=r.getElementsByTagName("name")[0])==null?void 0:s.textContent.includes("Spellcasting")});return e?Array.from(e.getElementsByTagName("text")).map(r=>r.textContent.replace(/(&#8226;|\u2022)/u,"").trim()).filter(r=>r.length):[]}function vc(n){var i;if(!((i=n.getElementsByTagName("skill"))!=null&&i.length))return[];let t=n.getElementsByTagName("skill")[0].textContent.split(", "),e=[];return t.forEach(r=>{let s=r.split(/\\s[\\+\\-]/);e.push({[s[0]]:Number(s[1])})}),e}var Sc={Str:"strength",Dex:"dexterity",Con:"constitution",Int:"intelligence",Wis:"wisdom",Cha:"charisma"};function xc(n){var i;if(!((i=n.getElementsByTagName("save"))!=null&&i.length))return[];let t=n.getElementsByTagName("save")[0].textContent.split(", "),e=[];return t.forEach(r=>{let s=r.split(/\\s[\\+\\-]/);e.push({[Sc[s[0]]]:Number(s[1])})}),e}function yl(n,t){var s,o;if(!((s=n.getElementsByTagName("hp"))!=null&&s.length))return"";let e=n.getElementsByTagName("hp")[0].textContent,[,i,r]=(o=e.match(/(\\d+) \\(([\\s\\S]+)\\)/))!=null?o:[,"",""];return{hp:i,hit_dice:r}[t]}var kc={T:"tiny",S:"small",M:"medium",L:"large",H:"huge",G:"gargantuan"};function Cc(n){var t;return n.getElementsByTagName("size")&&(t=kc[n.getElementsByTagName("size")[0].textContent])!=null?t:""}function Ac(n){var t;if(n.getElementsByTagName("ac")){let[,e]=(t=n.getElementsByTagName("ac")[0])==null?void 0:t.textContent.match(/(\\d+)/);return Number(e)}return 0}function Tc(n){var e,i,r,s,o,l;let t="Unknown";if((e=n.getElementsByTagName("source"))!=null&&e.length)t=n.getElementsByTagName("source")[0].textContent;else if((i=n.getElementsByTagName("trait"))!=null&&i.length&&Array.from(n.getElementsByTagName("trait")).find(a=>{var h;return((h=a.getElementsByTagName("name"))==null?void 0:h[0].textContent)=="Source"})){let a=Array.from(n.getElementsByTagName("trait")).find(h=>{var c,f;return((f=(c=h.getElementsByTagName("name"))==null?void 0:c[0])==null?void 0:f.textContent)=="Source"});t=(o=(s=(r=a==null?void 0:a.getElementsByTagName("text"))==null?void 0:r[0])==null?void 0:s.textContent)==null?void 0:o.replace(/p. \\d+/,"").trim()}else if((l=n.getElementsByTagName("description"))!=null&&l.length){let a=n.getElementsByTagName("description"),h="Source: ";if(a[0].textContent.includes(h)){let c=a[0].textContent.lastIndexOf(h);t=a[0].textContent.slice(c+h.length).split(/, ?/)[0]}}return t}var Mc={STR:"strength",DEX:"dexterity",CON:"constitution",INT:"intelligence",WIS:"wisdom",CHA:"charisma"};async function vl(n){return new Promise((t,e)=>{let i=new FileReader,r=[];i.onload=async s=>{var o,l,a,h,c,f,u,d,p,b,y,v,N,C,O,k,T,x,M,S,_,w,D,F,P,B,H,L,nt,W,st,gt,xt,It,jt,me,si,so,oo,lo,ao,ho,co,fo,uo,po,go,mo,yo,bo,wo,vo,So;try{let tr=JSON.parse(s.target.result),$h=Object.keys(tr).filter(er=>/^Creatures\\./.test(er));for(let er of $h)try{let K=tr[er],Hh={name:K.Name,source:(o=K.Source)!=null&&o.trim().length?(l=K.Source)==null?void 0:l.trim():"Unknown",type:(c=(h=(a=K.Type)==null?void 0:a.split(/,\\s?/))==null?void 0:h[0])==null?void 0:c.trim(),subtype:"",size:"",alignment:(d=(u=(f=K.Type)==null?void 0:f.split(/,\\s?/))==null?void 0:u[1])==null?void 0:d.trim(),hp:(p=K.HP)==null?void 0:p.Value,hit_dice:(v=(y=(b=K.HP)==null?void 0:b.Notes)==null?void 0:y.replace(/([()])/g,""))==null?void 0:v.trim(),ac:K.AC.Value,speed:(C=(N=K.Speed)==null?void 0:N.join(", "))==null?void 0:C.trim(),stats:Object.values((O=K.Abilities)!=null?O:{}),damage_immunities:(M=(x=(T=(k=K.DamageImmunities)==null?void 0:k.join("; "))==null?void 0:T.toLowerCase())==null?void 0:x.trim())!=null?M:"",damage_resistances:(D=(w=(_=(S=K.DamageResistances)==null?void 0:S.join(", "))==null?void 0:_.toLowerCase())==null?void 0:w.trim())!=null?D:"",damage_vulnerabilities:(H=(B=(P=(F=K.DamageVulnerabilities)==null?void 0:F.join(", "))==null?void 0:P.toLowerCase())==null?void 0:B.trim())!=null?H:"",condition_immunities:(st=(W=(nt=(L=K.ConditionImmunities)==null?void 0:L.join(", "))==null?void 0:nt.toLowerCase())==null?void 0:W.trim())!=null?st:"",saves:(xt=(gt=K.Saves)==null?void 0:gt.map(({Name:ot,Modifier:ir})=>({[Mc[ot]]:ir})))!=null?xt:[],skillsaves:(jt=(It=K.Skills)==null?void 0:It.map(({Name:ot,Modifier:ir})=>({[ot]:ir})))!=null?jt:[],senses:(so=(si=(me=K.Senses)==null?void 0:me.join(", "))==null?void 0:si.trim())!=null?so:"",languages:(ao=(lo=(oo=K.Languages)==null?void 0:oo.join(", "))==null?void 0:lo.trim())!=null?ao:"",cr:(co=(ho=K.Challenge)==null?void 0:ho.trim())!=null?co:"",traits:(uo=(fo=K.Traits)==null?void 0:fo.map(ot=>({name:ot.Name,desc:ot.Content})))!=null?uo:[],actions:(go=(po=K.Actions)==null?void 0:po.map(ot=>({name:ot.Name,desc:ot.Content})))!=null?go:[],bonus_actions:(yo=(mo=K.BonusActions)==null?void 0:mo.map(ot=>({name:ot.Name,desc:ot.Content})))!=null?yo:[],reactions:(wo=(bo=K.Reactions)==null?void 0:bo.map(ot=>({name:ot.Name,desc:ot.Content})))!=null?wo:[],legendary_actions:(So=(vo=K.LegendaryActions)==null?void 0:vo.map(ot=>({name:ot.Name,desc:ot.Content})))!=null?So:[],image:null};r.push(Hh)}catch(K){continue}t(r)}catch(tr){e()}},i.readAsText(n)})}async function Sl(n){return new Promise((t,e)=>{let i=new FileReader;i.onload=async r=>{var o,l,a,h,c,f,u,d,p,b,y,v,N,C,O,k,T,x,M,S,_,w,D,F,P;let s=[];try{let B=JSON.parse(r.target.result),H=[];B.creatures?H=B.creatures:H=[B];for(let L of H)try{let nt={image:null,name:L.name,source:"CritterDB",type:L.stats.race,subtype:"",size:L.stats.size,alignment:L.stats.alignment,hp:L.stats.hitPoints,hit_dice:`${Math.floor(L.stats.extraHealthFromConstitution/L.stats.abilityScoreModifiers.constitution)}d${L.stats.hitDieSize} + ${L.stats.extraHealthFromConstitution}`,ac:L.stats.armorClass,speed:L.stats.speed,stats:[L.stats.abilityScores.strength,L.stats.abilityScores.dexterity,L.stats.abilityScores.constitution,L.stats.abilityScores.intelligence,L.stats.abilityScores.wisdom,L.stats.abilityScores.charisma],damage_immunities:(l=(o=L.stats.damageImmunities)==null?void 0:o.join("; ").toLowerCase().trim())!=null?l:"",damage_resistances:(h=(a=L.stats.damageResistances)==null?void 0:a.join(", ").toLowerCase().trim())!=null?h:"",damage_vulnerabilities:(f=(c=L.stats.damageVulnerabilities)==null?void 0:c.join(", ").toLowerCase().trim())!=null?f:"",condition_immunities:(d=(u=L.stats.conditionImmunities)==null?void 0:u.join(", ").toLowerCase().trim())!=null?d:"",saves:(b=(p=L.stats.savingThrows)==null?void 0:p.map(W=>{var st;if(!(!("value"in W)&&!("modifier"in W)))return{[W.ability]:(st=W.value)!=null?st:W.modifier}}).filter(W=>W))!=null?b:[],skillsaves:(v=(y=L.stats.skills)==null?void 0:y.map(W=>{var st;if(!(!("value"in W)&&!("modifier"in W)))return{[W.name]:(st=W.value)!=null?st:W.modifier}}).filter(W=>W))!=null?v:[],senses:(C=(N=L.stats.senses)==null?void 0:N.join(", ").trim())!=null?C:"",languages:(k=(O=L.stats.languages)==null?void 0:O.join(", ").trim())!=null?k:"",cr:(T=L.stats.challengeRating)!=null?T:"",traits:(M=(x=L.stats.additionalAbilities)==null?void 0:x.map(W=>({name:W.name,desc:W.description.replace(/<[^>]*>/g,"")})))!=null?M:[],actions:(_=(S=L.stats.actions)==null?void 0:S.map(W=>({name:W.name,desc:W.description.replace(/<[^>]*>/g,"")})))!=null?_:[],reactions:(D=(w=L.stats.reactions)==null?void 0:w.map(W=>({name:W.name,desc:W.description.replace(/<[^>]*>/g,"")})))!=null?D:[],legendary_actions:(P=(F=L.stats.legendaryActions)==null?void 0:F.map(W=>({name:W.name,desc:W.description.replace(/<[^>]*>/g,"")})))!=null?P:[]};s.push(nt)}catch(nt){continue}t(s)}catch(B){e()}},i.readAsText(n)})}var U=class n{constructor(){}lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,i){let r=[];return this.decompose(0,t,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(e,this.length,r,1),Ve.from(r,this.length-(e-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){let i=[];return this.decompose(t,e,i,0),Ve.from(i,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),r=new Se(this),s=new Se(t);for(let o=e,l=e;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=i)return!0}}iter(t=1){return new Se(this,t)}iterRange(t,e=this.length){return new ln(this,t,e)}iterLines(t,e){let i;if(t==null)i=this.iter();else{e==null&&(e=this.lines+1);let r=this.line(t).from;i=this.iterRange(r,Math.max(r,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new an(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?n.empty:t.length<=32?new kt(t):Ve.from(kt.split(t,[]))}},kt=class n extends U{constructor(t,e=Ec(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,i,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((e?i:l)>=t)return new vr(r,l,i,o);r=l+1,i++}}decompose(t,e,i,r){let s=t<=0&&e>=this.length?this:new n(xl(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(r&1){let o=i.pop(),l=sn(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new n(l,o.length+s.length));else{let a=l.length>>1;i.push(new n(l.slice(0,a)),new n(l.slice(a)))}}else i.push(s)}replace(t,e,i){if(!(i instanceof n))return super.replace(t,e,i);let r=sn(this.text,sn(i.text,xl(this.text,0,t)),e),s=this.length+i.length-(e-t);return r.length<=32?new n(r,s):Ve.from(n.split(r,[]),s)}sliceString(t,e=this.length,i=`\n`){let r="";for(let s=0,o=0;s<=e&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>t&&o&&(r+=i),t<a&&e>s&&(r+=l.slice(Math.max(0,t-s),e-s)),s=a+1}return r}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let i=[],r=-1;for(let s of t)i.push(s),r+=s.length+1,i.length==32&&(e.push(new n(i,r)),i=[],r=-1);return r>-1&&e.push(new n(i,r)),e}},Ve=class n extends U{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let i of t)this.lines+=i.lines}lineInner(t,e,i,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=i+o.lines-1;if((e?a:l)>=t)return o.lineInner(t,e,i,r);r=l+1,i=a+1}}decompose(t,e,i,r){for(let s=0,o=0;o<=e&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(t<=a&&e>=o){let h=r&((o<=t?1:0)|(a>=e?2:0));o>=t&&a<=e&&!h?i.push(l):l.decompose(t-o,e-o,i,h)}o=a+1}}replace(t,e,i){if(i.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(t>=s&&e<=l){let a=o.replace(t-s,e-s,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let c=this.children.slice();return c[r]=a,new n(c,this.length-(e-t)+i.length)}return super.replace(s,l,a)}s=l+1}return super.replace(t,e,i)}sliceString(t,e=this.length,i=`\n`){let r="";for(let s=0,o=0;s<this.children.length&&o<=e;s++){let l=this.children[s],a=o+l.length;o>t&&s&&(r+=i),t<a&&e>o&&(r+=l.sliceString(t-o,e-o,i)),o=a+1}return r}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof n))return 0;let i=0,[r,s,o,l]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;r+=e,s+=e){if(r==o||s==l)return i;let a=this.children[r],h=t.children[s];if(a!=h)return i+a.scanIdentical(h,e);i+=a.length+1}}static from(t,e=t.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let d of t)i+=d.lines;if(i<32){let d=[];for(let p of t)p.flatten(d);return new kt(d,e)}let r=Math.max(32,i>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>s&&d instanceof n)for(let b of d.children)f(b);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof kt&&a&&(p=c[c.length-1])instanceof kt&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new kt(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>r&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:n.from(c,h)),h=-1,a=c.length=0)}for(let d of t)f(d);return u(),l.length==1?l[0]:new n(l,e)}};U.empty=new kt([""],0);function Ec(n){let t=-1;for(let e of n)t+=e.length+1;return t}function sn(n,t,e=0,i=1e9){for(let r=0,s=0,o=!0;s<n.length&&r<=i;s++){let l=n[s],a=r+l.length;a>=e&&(a>i&&(l=l.slice(0,i-r)),r<e&&(l=l.slice(e-r)),o?(t[t.length-1]+=l,o=!1):t.push(l)),r=a+1}return t}function xl(n,t,e){return sn(n,[""],t,e)}var Se=class{constructor(t,e=1){this.dir=e,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[e>0?1:(t instanceof kt?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],s=this.offsets[i],o=s>>1,l=r instanceof kt?r.text.length:r.children.length;if(o==(e>0?l:0)){if(i==0)return this.done=!0,this.value="",this;e>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(e>0?0:1)){if(this.offsets[i]+=e,t==0)return this.lineBreak=!0,this.value=`\n`,this;t--}else if(r instanceof kt){let a=r.text[o+(e<0?-1:0)];if(this.offsets[i]+=e,a.length>Math.max(0,t))return this.value=t==0?a:e>0?a.slice(t):a.slice(0,a.length-t),this;t-=a.length}else{let a=r.children[o+(e<0?-1:0)];t>a.length?(t-=a.length,this.offsets[i]+=e):(e<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(e>0?1:(a instanceof kt?a.text.length:a.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}},ln=class{constructor(t,e,i){this.value="",this.done=!1,this.cursor=new Se(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;let{value:r}=this.cursor.next(t);return this.pos+=(r.length+t)*e,this.value=r.length<=i?r:e<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},an=class{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:i,value:r}=this.inner.next(t);return e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol!="undefined"&&(U.prototype[Symbol.iterator]=function(){return this.iter()},Se.prototype[Symbol.iterator]=ln.prototype[Symbol.iterator]=an.prototype[Symbol.iterator]=function(){return this});var vr=class{constructor(t,e,i,r){this.from=t,this.to=e,this.number=i,this.text=r}get length(){return this.to-this.from}},We="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(n=>n?parseInt(n,36):1);for(let n=1;n<We.length;n++)We[n]+=We[n-1];function Rc(n){for(let t=1;t<We.length;t+=2)if(We[t]>n)return We[t-1]<=n;return!1}function kl(n){return n>=127462&&n<=127487}var Cl=8205;function Xt(n,t,e=!0,i=!0){return(e?Dl:Dc)(n,t,i)}function Dl(n,t,e){if(t==n.length)return t;t&&Ol(n.charCodeAt(t))&&Nl(n.charCodeAt(t-1))&&t--;let i=on(n,t);for(t+=Sr(i);t<n.length;){let r=on(n,t);if(i==Cl||r==Cl||e&&Rc(r))t+=Sr(r),i=r;else if(kl(r)){let s=0,o=t-2;for(;o>=0&&kl(on(n,o));)s++,o-=2;if(s%2==0)break;t+=2}else break}return t}function Dc(n,t,e){for(;t>0;){let i=Dl(n,t-2,e);if(i<t)return i;t--}return 0}function Ol(n){return n>=56320&&n<57344}function Nl(n){return n>=55296&&n<56320}function on(n,t){let e=n.charCodeAt(t);if(!Nl(e)||t+1==n.length)return e;let i=n.charCodeAt(t+1);return Ol(i)?(e-55296<<10)+(i-56320)+65536:e}function Sr(n){return n<65536?1:2}var xr=/\\r\\n?|\\n/,vt=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(vt||(vt={})),xe=class n{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;e<this.sections.length;e+=2)t+=this.sections[e];return t}get newLength(){let t=0;for(let e=0;e<this.sections.length;e+=2){let i=this.sections[e+1];t+=i<0?this.sections[e]:i}return t}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(t){for(let e=0,i=0,r=0;e<this.sections.length;){let s=this.sections[e++],o=this.sections[e++];o<0?(t(i,r,s),r+=s):r+=o,i+=s}}iterChangedRanges(t,e=!1){kr(this,t,e)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let i=this.sections[e++],r=this.sections[e++];r<0?t.push(i,r):t.push(r,i)}return new n(t)}composeDesc(t){return this.empty?t:t.empty?this:Pl(this,t)}mapDesc(t,e=!1){return t.empty?this:Cr(this,t,e)}mapPos(t,e=-1,i=vt.Simple){let r=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=r+l;if(a<0){if(h>t)return s+(t-r);s+=l}else{if(i!=vt.Simple&&h>=t&&(i==vt.TrackDel&&r<t&&h>t||i==vt.TrackBefore&&r<t||i==vt.TrackAfter&&h>t))return null;if(h>t||h==t&&e<0&&!l)return t==r||e<0?s:s+a;s+=a}r=h}if(t>r)throw new RangeError(`Position ${t} is out of range for changeset of length ${r}`);return s}touchesRange(t,e=t){for(let i=0,r=0;i<this.sections.length&&r<=e;){let s=this.sections[i++],o=this.sections[i++],l=r+s;if(o>=0&&r<=e&&l>=t)return r<t&&l>e?"cover":!0;r=l}return!1}toString(){let t="";for(let e=0;e<this.sections.length;){let i=this.sections[e++],r=this.sections[e++];t+=(t?" ":"")+i+(r>=0?":"+r:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new n(t)}static create(t){return new n(t)}},Ct=class n extends xe{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return kr(this,(e,i,r,s,o)=>t=t.replace(r,r+(i-e),o),!1),t}mapDesc(t,e=!1){return Cr(this,t,e,!0)}invert(t){let e=this.sections.slice(),i=[];for(let r=0,s=0;r<e.length;r+=2){let o=e[r],l=e[r+1];if(l>=0){e[r]=l,e[r+1]=o;let a=r>>1;for(;i.length<a;)i.push(U.empty);i.push(o?t.slice(s,s+o):U.empty)}s+=o}return new n(e,i)}compose(t){return this.empty?t:t.empty?this:Pl(this,t,!0)}map(t,e=!1){return t.empty?this:Cr(this,t,e,!0)}iterChanges(t,e=!1){kr(this,t,e)}get desc(){return xe.create(this.sections)}filter(t){let e=[],i=[],r=[],s=new ke(this);t:for(let o=0,l=0;;){let a=o==t.length?1e9:t[o++];for(;l<a||l==a&&s.len==0;){if(s.done)break t;let c=Math.min(s.len,a-l);ut(r,c,-1);let f=s.ins==-1?-1:s.off==0?s.ins:0;ut(e,c,f),f>0&&oe(i,e,s.text),s.forward(c),l+=c}let h=t[o++];for(;l<h;){if(s.done)break t;let c=Math.min(s.len,h-l);ut(e,c,-1),ut(r,c,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(c),l+=c}}return{changes:new n(e,i),filtered:xe.create(r)}}toJSON(){let t=[];for(let e=0;e<this.sections.length;e+=2){let i=this.sections[e],r=this.sections[e+1];r<0?t.push(i):r==0?t.push([i]):t.push([i].concat(this.inserted[e>>1].toJSON()))}return t}static of(t,e,i){let r=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!r.length)return;o<e&&ut(r,e-o,-1);let f=new n(r,s);l=l?l.compose(f.map(l)):f,r=[],s=[],o=0}function h(c){if(Array.isArray(c))for(let f of c)h(f);else if(c instanceof n){if(c.length!=e)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${e})`);a(),l=l?l.compose(c.map(l)):c}else{let{from:f,to:u=f,insert:d}=c;if(f>u||f<0||u>e)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${e})`);let p=d?typeof d=="string"?U.of(d.split(i||xr)):d:U.empty,b=p.length;if(f==u&&b==0)return;f<o&&a(),f>o&&ut(r,f-o,-1),ut(r,u-f,b),oe(s,r,p),o=u}}return h(t),a(!l),l}static empty(t){return new n(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],i=[];for(let r=0;r<t.length;r++){let s=t[r];if(typeof s=="number")e.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)e.push(s[0],0);else{for(;i.length<r;)i.push(U.empty);i[r]=U.of(s.slice(1)),e.push(s[0],i[r].length)}}}return new n(e,i)}static createSet(t,e){return new n(t,e)}};function ut(n,t,e,i=!1){if(t==0&&e<=0)return;let r=n.length-2;r>=0&&e<=0&&e==n[r+1]?n[r]+=t:t==0&&n[r]==0?n[r+1]+=e:i?(n[r]+=t,n[r+1]+=e):n.push(t,e)}function oe(n,t,e){if(e.length==0)return;let i=t.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(e);else{for(;n.length<i;)n.push(U.empty);n.push(e)}}function kr(n,t,e){let i=n.inserted;for(let r=0,s=0,o=0;o<n.sections.length;){let l=n.sections[o++],a=n.sections[o++];if(a<0)r+=l,s+=l;else{let h=r,c=s,f=U.empty;for(;h+=l,c+=a,a&&i&&(f=f.append(i[o-2>>1])),!(e||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];t(r,h,s,c,f),r=h,s=c}}}function Cr(n,t,e,i=!1){let r=[],s=i?[]:null,o=new ke(n),l=new ke(t);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);ut(r,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!e))){let h=l.len;for(ut(r,l.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=c&&(ut(r,0,o.ins),s&&oe(s,r,o.text),a=o.i),o.forward(c),h-=c}l.next()}else if(o.ins>=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;ut(r,h,a<o.i?o.ins:0),s&&a<o.i&&oe(s,r,o.text),a=o.i,o.forward(o.len-c)}else{if(o.done&&l.done)return s?Ct.createSet(r,s):xe.create(r);throw new Error("Mismatched change set lengths")}}function Pl(n,t,e=!1){let i=[],r=e?[]:null,s=new ke(n),o=new ke(t);for(let l=!1;;){if(s.done&&o.done)return r?Ct.createSet(i,r):xe.create(i);if(s.ins==0)ut(i,s.len,0,l),s.next();else if(o.len==0&&!o.done)ut(i,0,o.ins,l),r&&oe(r,i,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,o.len),h=i.length;if(s.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;ut(i,a,c,l),r&&c&&oe(r,i,o.text)}else o.ins==-1?(ut(i,s.off?0:s.len,a,l),r&&oe(r,i,s.textBit(a))):(ut(i,s.off?0:s.len,o.off?0:o.ins,l),r&&!o.off&&oe(r,i,o.text));l=(s.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),s.forward2(a),o.forward(a)}}}}var ke=class{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i<t.length?(this.len=t[this.i++],this.ins=t[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:t}=this.set,e=this.i-2>>1;return e>=t.length?U.empty:t[e]}textBit(t){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length&&!t?U.empty:e[i].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}},He=class n{constructor(t,e,i){this.from=t,this.to=e,this.flags=i}get anchor(){return this.flags&16?this.to:this.from}get head(){return this.flags&16?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&4?-1:this.flags&8?1:0}get bidiLevel(){let t=this.flags&3;return t==3?null:t}get goalColumn(){let t=this.flags>>5;return t==33554431?void 0:t}map(t,e=-1){let i,r;return this.empty?i=r=t.mapPos(this.from,e):(i=t.mapPos(this.from,1),r=t.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new n(i,r,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return $.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return $.range(this.anchor,i)}eq(t){return this.anchor==t.anchor&&this.head==t.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return $.range(t.anchor,t.head)}static create(t,e,i){return new n(t,e,i)}},$=class n{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:n.create(this.ranges.map(i=>i.map(t,e)),this.mainIndex)}eq(t){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let e=0;e<this.ranges.length;e++)if(!this.ranges[e].eq(t.ranges[e]))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new n([this.main],0)}addRange(t,e=!0){return n.create([t].concat(this.ranges),e?0:this.mainIndex+1)}replaceRange(t,e=this.mainIndex){let i=this.ranges.slice();return i[e]=t,n.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(t=>t.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new n(t.ranges.map(e=>He.fromJSON(e)),t.main)}static single(t,e=t){return new n([n.range(t,e)],0)}static create(t,e=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;r<t.length;r++){let s=t[r];if(s.empty?s.from<=i:s.from<i)return n.normalized(t.slice(),e);i=s.to}return new n(t,e)}static cursor(t,e=0,i,r){return He.create(t,t,(e==0?0:e<0?4:8)|(i==null?3:Math.min(2,i))|(r!=null?r:33554431)<<5)}static range(t,e,i,r){let s=(i!=null?i:33554431)<<5|(r==null?3:Math.min(2,r));return e<t?He.create(e,t,24|s):He.create(t,e,(e>t?4:0)|s)}static normalized(t,e=0){let i=t[e];t.sort((r,s)=>r.from-s.from),e=t.indexOf(i);for(let r=1;r<t.length;r++){let s=t[r],o=t[r-1];if(s.empty?s.from<=o.to:s.from<o.to){let l=o.from,a=Math.max(s.to,o.to);r<=e&&e--,t.splice(--r,2,s.anchor>s.head?n.range(a,l):n.range(l,a))}}return new n(t,e)}};function Il(n,t){for(let e of n.ranges)if(e.to>t)throw new RangeError("Selection points outside of document")}var Pr=0,V=class n{constructor(t,e,i,r,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=r,this.id=Pr++,this.default=t([]),this.extensions=typeof s=="function"?s(this):s}static define(t={}){return new n(t.combine||(e=>e),t.compareInput||((e,i)=>e===i),t.compare||(t.combine?(e,i)=>e===i:Ir),!!t.static,t.enables)}of(t){return new ze([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can\'t compute a static facet");return new ze(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can\'t compute a static facet");return new ze(t,this,2,e)}from(t,e){return e||(e=i=>i),this.compute([t],i=>e(i.field(t)))}};function Ir(n,t){return n==t||n.length==t.length&&n.every((e,i)=>e===t[i])}var ze=class{constructor(t,e,i,r){this.dependencies=t,this.facet=e,this.type=i,this.value=r,this.id=Pr++}dynamicSlot(t){var e;let i=this.value,r=this.facet.compareInput,s=this.id,o=t[s]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:((e=t[f.id])!==null&&e!==void 0?e:1)&1||c.push(t[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||Ar(f,c)){let d=i(f);if(l?!Al(d,f.values[o],r):!r(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,p=u.config.address[s];if(p!=null){let b=un(u,p);if(this.dependencies.every(y=>y instanceof V?u.facet(y)===f.facet(y):y instanceof Yt?u.field(y,!1)==f.field(y,!1):!0)||(l?Al(d=i(f),b,r):r(d=i(f),b)))return f.values[o]=b,0}else d=i(f);return f.values[o]=d,1}}}};function Al(n,t,e){if(n.length!=t.length)return!1;for(let i=0;i<n.length;i++)if(!e(n[i],t[i]))return!1;return!0}function Ar(n,t){let e=!1;for(let i of t)Si(n,i)&1&&(e=!0);return e}function Oc(n,t,e){let i=e.map(a=>n[a.id]),r=e.map(a=>a.type),s=i.filter(a=>!(a&1)),o=n[t.id]>>1;function l(a){let h=[];for(let c=0;c<i.length;c++){let f=un(a,i[c]);if(r[c]==2)for(let u of f)h.push(u);else h.push(f)}return t.combine(h)}return{create(a){for(let h of i)Si(a,h);return a.values[o]=l(a),1},update(a,h){if(!Ar(a,s))return 0;let c=l(a);return t.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,h){let c=Ar(a,i),f=h.config.facets[t.id],u=h.facet(t);if(f&&!c&&Ir(e,f))return a.values[o]=u,0;let d=l(a);return t.compare(d,u)?(a.values[o]=u,0):(a.values[o]=d,1)}}}var Tl=V.define({static:!0}),Yt=class n{constructor(t,e,i,r,s){this.id=t,this.createF=e,this.updateF=i,this.compareF=r,this.spec=s,this.provides=void 0}static define(t){let e=new n(Pr++,t.create,t.update,t.compare||((i,r)=>i===r),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(Tl).find(i=>i.field==this);return((e==null?void 0:e.create)||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:i=>(i.values[e]=this.create(i),1),update:(i,r)=>{let s=i.values[e],o=this.updateF(s,r);return this.compareF(s,o)?0:(i.values[e]=o,1)},reconfigure:(i,r)=>r.config.address[this.id]!=null?(i.values[e]=r.field(this),0):(i.values[e]=this.create(i),1)}}init(t){return[this,Tl.of({field:this,create:t})]}get extension(){return this}},we={lowest:4,low:3,default:2,high:1,highest:0};function vi(n){return t=>new hn(t,n)}var pn={highest:vi(we.highest),high:vi(we.high),default:vi(we.default),low:vi(we.low),lowest:vi(we.lowest)},hn=class{constructor(t,e){this.inner=t,this.prec=e}},cn=class n{of(t){return new xi(this,t)}reconfigure(t){return n.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}},xi=class{constructor(t,e){this.compartment=t,this.inner=e}},fn=class n{constructor(t,e,i,r,s,o){for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(t){let e=this.address[t.id];return e==null?t.default:this.staticValues[e>>1]}static resolve(t,e,i){let r=[],s=Object.create(null),o=new Map;for(let u of Nc(t,e,o))u instanceof Yt?r.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of r)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i==null?void 0:i.config.facets;for(let u in s){let d=s[u],p=d[0].facet,b=c&&c[u]||[];if(d.every(y=>y.type==0))if(l[p.id]=a.length<<1|1,Ir(b,d))a.push(i.facet(p));else{let y=p.combine(d.map(v=>v.value));a.push(i&&p.compare(y,i.facet(p))?i.facet(p):y)}else{for(let y of d)y.type==0?(l[y.id]=a.length<<1|1,a.push(y.value)):(l[y.id]=h.length<<1,h.push(v=>y.dynamicSlot(v)));l[p.id]=h.length<<1,h.push(y=>Oc(y,p,d))}}let f=h.map(u=>u(l));return new n(t,o,f,l,a,s)}};function Nc(n,t,e){let i=[[],[],[],[],[]],r=new Map;function s(o,l){let a=r.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof xi&&e.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof xi){if(e.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=t.get(o.compartment)||o.inner;e.set(o.compartment,h),s(h,l)}else if(o instanceof hn)s(o.inner,o.prec);else if(o instanceof Yt)i[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof ze)i[l].push(o),o.facet.extensions&&s(o.facet.extensions,we.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(n,we.default),i.reduce((o,l)=>o.concat(l))}function Si(n,t){if(t&1)return 2;let e=t>>1,i=n.status[e];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[e]=4;let r=n.computeSlot(n,n.config.dynamicSlots[e]);return n.status[e]=2|r}function un(n,t){return t&1?n.config.staticValues[t>>1]:n.values[t>>1]}var _l=V.define(),Ll=V.define({combine:n=>n.some(t=>t),static:!0}),Bl=V.define({combine:n=>n.length?n[0]:void 0,static:!0}),Fl=V.define(),$l=V.define(),Hl=V.define(),Vl=V.define({combine:n=>n.length?n[0]:!1}),Jt=class{constructor(t,e){this.type=t,this.value=e}static define(){return new Tr}},Tr=class{of(t){return new Jt(this,t)}},Mr=class{constructor(t){this.map=t}of(t){return new tt(this,t)}},tt=class n{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return e===void 0?void 0:e==this.value?this:new n(this.type,e)}is(t){return this.type==t}static define(t={}){return new Mr(t.map||(e=>e))}static mapEffects(t,e){if(!t.length)return t;let i=[];for(let r of t){let s=r.map(e);s&&i.push(s)}return i}};tt.reconfigure=tt.define();tt.appendConfig=tt.define();var St=class n{constructor(t,e,i,r,s,o){this.startState=t,this.changes=e,this.selection=i,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Il(i,e.newLength),s.some(l=>l.type==n.time)||(this.annotations=s.concat(n.time.of(Date.now())))}static create(t,e,i,r,s,o){return new n(t,e,i,r,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(n.userEvent);return!!(e&&(e==t||e.length>t.length&&e.slice(0,t.length)==t&&e[t.length]=="."))}};St.time=Jt.define();St.userEvent=Jt.define();St.addToHistory=Jt.define();St.remote=Jt.define();function Pc(n,t){let e=[];for(let i=0,r=0;;){let s,o;if(i<n.length&&(r==t.length||t[r]>=n[i]))s=n[i++],o=n[i++];else if(r<t.length)s=t[r++],o=t[r++];else return e;!e.length||e[e.length-1]<s?e.push(s,o):e[e.length-1]<o&&(e[e.length-1]=o)}}function Wl(n,t,e){var i;let r,s,o;return e?(r=t.changes,s=Ct.empty(t.changes.length),o=n.changes.compose(t.changes)):(r=t.changes.map(n.changes),s=n.changes.mapDesc(t.changes,!0),o=n.changes.compose(r)),{changes:o,selection:t.selection?t.selection.map(s):(i=n.selection)===null||i===void 0?void 0:i.map(r),effects:tt.mapEffects(n.effects,r).concat(tt.mapEffects(t.effects,s)),annotations:n.annotations.length?n.annotations.concat(t.annotations):t.annotations,scrollIntoView:n.scrollIntoView||t.scrollIntoView}}function Er(n,t,e){let i=t.selection,r=Ue(t.annotations);return t.userEvent&&(r=r.concat(St.userEvent.of(t.userEvent))),{changes:t.changes instanceof Ct?t.changes:Ct.of(t.changes||[],e,n.facet(Bl)),selection:i&&(i instanceof $?i:$.single(i.anchor,i.head)),effects:Ue(t.effects),annotations:r,scrollIntoView:!!t.scrollIntoView}}function zl(n,t,e){let i=Er(n,t.length?t[0]:{},n.doc.length);t.length&&t[0].filter===!1&&(e=!1);for(let s=1;s<t.length;s++){t[s].filter===!1&&(e=!1);let o=!!t[s].sequential;i=Wl(i,Er(n,t[s],o?i.changes.newLength:n.doc.length),o)}let r=St.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return _c(e?Ic(r):r)}function Ic(n){let t=n.startState,e=!0;for(let r of t.facet(Fl)){let s=r(n);if(s===!1){e=!1;break}Array.isArray(s)&&(e=e===!0?s:Pc(e,s))}if(e!==!0){let r,s;if(e===!1)s=n.changes.invertedDesc,r=Ct.empty(t.doc.length);else{let o=n.changes.filter(e);r=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}n=St.create(t,r,n.selection&&n.selection.map(s),tt.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let i=t.facet($l);for(let r=i.length-1;r>=0;r--){let s=i[r](n);s instanceof St?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof St?n=s[0]:n=zl(t,Ue(s),!1)}return n}function _c(n){let t=n.startState,e=t.facet(Hl),i=n;for(let r=e.length-1;r>=0;r--){let s=e[r](n);s&&Object.keys(s).length&&(i=Wl(i,Er(t,s,n.changes.newLength),!0))}return i==n?n:St.create(t,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}var Lc=[];function Ue(n){return n==null?Lc:Array.isArray(n)?n:[n]}var Bt=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(Bt||(Bt={})),Bc=/[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/,Rr;try{Rr=new RegExp("[\\\\p{Alphabetic}\\\\p{Number}_]","u")}catch(n){}function Fc(n){if(Rr)return Rr.test(n);for(let t=0;t<n.length;t++){let e=n[t];if(/\\w/.test(e)||e>"\\x80"&&(e.toUpperCase()!=e.toLowerCase()||Bc.test(e)))return!0}return!1}function $c(n){return t=>{if(!/\\S/.test(t))return Bt.Space;if(Fc(t))return Bt.Word;for(let e=0;e<n.length;e++)if(t.indexOf(n[e])>-1)return Bt.Word;return Bt.Other}}var Q=class n{constructor(t,e,i,r,s,o){this.config=t,this.doc=e,this.selection=i,this.values=r,this.status=t.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)Si(this,l<<1);this.computeSlot=null}field(t,e=!0){let i=this.config.address[t.id];if(i==null){if(e)throw new RangeError("Field is not present in this state");return}return Si(this,i),un(this,i)}update(...t){return zl(this,t,!0)}applyTransaction(t){let e=this.config,{base:i,compartments:r}=e;for(let o of t.effects)o.is(cn.reconfigure)?(e&&(r=new Map,e.compartments.forEach((l,a)=>r.set(a,l)),e=null),r.set(o.value.compartment,o.value.extension)):o.is(tt.reconfigure)?(e=null,i=o.value):o.is(tt.appendConfig)&&(e=null,i=Ue(i).concat(o.value));let s;e?s=t.startState.values.slice():(e=fn.resolve(i,r,this),s=new n(e,this.doc,this.selection,e.dynamicSlots.map(()=>null),(l,a)=>a.reconfigure(l,this),null).values),new n(e,t.newDoc,t.newSelection,s,(o,l)=>l.update(o,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:$.cursor(e.from+t.length)}))}changeByRange(t){let e=this.selection,i=t(e.ranges[0]),r=this.changes(i.changes),s=[i.range],o=Ue(i.effects);for(let l=1;l<e.ranges.length;l++){let a=t(e.ranges[l]),h=this.changes(a.changes),c=h.map(r);for(let u=0;u<l;u++)s[u]=s[u].map(c);let f=r.mapDesc(h,!0);s.push(a.range.map(f)),r=r.compose(c),o=tt.mapEffects(o,c).concat(tt.mapEffects(Ue(a.effects),f))}return{changes:r,selection:$.create(s,e.mainIndex),effects:o}}changes(t=[]){return t instanceof Ct?t:Ct.of(t,this.doc.length,this.facet(n.lineSeparator))}toText(t){return U.of(t.split(this.facet(n.lineSeparator)||xr))}sliceDoc(t=0,e=this.doc.length){return this.doc.sliceString(t,e,this.lineBreak)}facet(t){let e=this.config.address[t.id];return e==null?t.default:(Si(this,e),un(this,e))}toJSON(t){let e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let i in t){let r=t[i];r instanceof Yt&&this.config.address[r.id]!=null&&(e[i]=r.spec.toJSON(this.field(t[i]),this))}return e}static fromJSON(t,e={},i){if(!t||typeof t.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(t,s)){let o=i[s],l=t[s];r.push(o.init(a=>o.spec.fromJSON(l,a)))}}return n.create({doc:t.doc,selection:$.fromJSON(t.selection),extensions:e.extensions?r.concat([e.extensions]):r})}static create(t={}){let e=fn.resolve(t.extensions||[],new Map),i=t.doc instanceof U?t.doc:U.of((t.doc||"").split(e.staticFacet(n.lineSeparator)||xr)),r=t.selection?t.selection instanceof $?t.selection:$.single(t.selection.anchor,t.selection.head):$.single(0);return Il(r,i.length),e.staticFacet(Ll)||(r=r.asSingle()),new n(e,i,r,e.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(n.tabSize)}get lineBreak(){return this.facet(n.lineSeparator)||`\n`}get readOnly(){return this.facet(Vl)}phrase(t,...e){for(let i of this.facet(n.phrases))if(Object.prototype.hasOwnProperty.call(i,t)){t=i[t];break}return e.length&&(t=t.replace(/\\$(\\$|\\d*)/g,(i,r)=>{if(r=="$")return"$";let s=+(r||1);return!s||s>e.length?i:e[s-1]})),t}languageDataAt(t,e,i=-1){let r=[];for(let s of this.facet(_l))for(let o of s(this,e,i))Object.prototype.hasOwnProperty.call(o,t)&&r.push(o[t]);return r}charCategorizer(t){return $c(this.languageDataAt("wordChars",t).join(""))}wordAt(t){let{text:e,from:i,length:r}=this.doc.lineAt(t),s=this.charCategorizer(t),o=t-i,l=t-i;for(;o>0;){let a=Xt(e,o,!1);if(s(e.slice(a,o))!=Bt.Word)break;o=a}for(;l<r;){let a=Xt(e,l);if(s(e.slice(l,a))!=Bt.Word)break;l=a}return o==l?null:$.range(o+i,l+i)}};Q.allowMultipleSelections=Ll;Q.tabSize=V.define({combine:n=>n.length?n[0]:4});Q.lineSeparator=Bl;Q.readOnly=Vl;Q.phrases=V.define({compare(n,t){let e=Object.keys(n),i=Object.keys(t);return e.length==i.length&&e.every(r=>n[r]==t[r])}});Q.languageData=_l;Q.changeFilter=Fl;Q.transactionFilter=$l;Q.transactionExtender=Hl;cn.reconfigure=tt.define();var Zt=class{eq(t){return this==t}range(t,e=t){return ki.create(t,e,this)}};Zt.prototype.startSide=Zt.prototype.endSide=0;Zt.prototype.point=!1;Zt.prototype.mapMode=vt.TrackDel;var ki=class n{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(t,e,i){return new n(t,e,i)}};function Dr(n,t){return n.from-t.from||n.value.startSide-t.value.startSide}var Or=class n{constructor(t,e,i,r){this.from=t,this.to=e,this.value=i,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(t,e,i,r=0){let s=i?this.to:this.from;for(let o=r,l=s.length;;){if(o==l)return o;let a=o+l>>1,h=s[a]-t||(i?this.value[a].endSide:this.value[a].startSide)-e;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(t,e,i,r){for(let s=this.findIndex(e,-1e9,!0),o=this.findIndex(i,1e9,!1,s);s<o;s++)if(r(this.from[s]+t,this.to[s]+t,this.value[s])===!1)return!1}map(t,e){let i=[],r=[],s=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let h=this.value[a],c=this.from[a]+t,f=this.to[a]+t,u,d;if(c==f){let p=e.mapPos(c,h.startSide,h.mapMode);if(p==null||(u=d=p,h.startSide!=h.endSide&&(d=e.mapPos(c,h.endSide),d<u)))continue}else if(u=e.mapPos(c,h.startSide),d=e.mapPos(f,h.endSide),u>d||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),i.push(h),r.push(u-o),s.push(d-o))}return{mapped:i.length?new n(r,s,i,l):null,pos:o}}},ht=class n{constructor(t,e,i,r){this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=r}static create(t,e,i,r){return new n(t,e,i,r)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:i=!1,filterFrom:r=0,filterTo:s=this.length}=t,o=t.filter;if(e.length==0&&!o)return this;if(i&&(e=e.slice().sort(Dr)),this.isEmpty)return e.length?n.of(e):this;let l=new dn(this,null,-1).goto(0),a=0,h=[],c=new Ce;for(;l.value||a<e.length;)if(a<e.length&&(l.from-e[a].from||l.startSide-e[a].value.startSide)>=0){let f=e[a++];c.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==e.length||this.chunkEnd(l.chunkIndex)<e[a].from)&&(!o||r>this.chunkEnd(l.chunkIndex)||s<this.chunkPos[l.chunkIndex])&&c.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||r>l.to||s<l.from||o(l.from,l.to,l.value))&&(c.addInner(l.from,l.to,l.value)||h.push(ki.create(l.from,l.to,l.value))),l.next());return c.finishInner(this.nextLayer.isEmpty&&!h.length?n.empty:this.nextLayer.update({add:h,filter:o,filterFrom:r,filterTo:s}))}map(t){if(t.empty||this.isEmpty)return this;let e=[],i=[],r=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],a=this.chunk[o],h=t.touchesRange(l,l+a.length);if(h===!1)r=Math.max(r,a.maxPoint),e.push(a),i.push(t.mapPos(l));else if(h===!0){let{mapped:c,pos:f}=a.map(l,t);c&&(r=Math.max(r,c.maxPoint),e.push(c),i.push(f))}}let s=this.nextLayer.map(t);return e.length==0?s:new n(i,e,s||n.empty,r)}between(t,e,i){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let s=this.chunkPos[r],o=this.chunk[r];if(e>=s&&t<=s+o.length&&o.between(s,t-s,e-s,i)===!1)return}this.nextLayer.between(t,e,i)}}iter(t=0){return Ci.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Ci.from(t).goto(e)}static compare(t,e,i,r,s=-1){let o=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),l=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),a=Ml(o,l,i),h=new ve(o,a,s),c=new ve(l,a,s);i.iterGaps((f,u,d)=>El(h,f,c,u,d,r)),i.empty&&i.length==0&&El(h,0,c,0,0,r)}static eq(t,e,i=0,r){r==null&&(r=999999999);let s=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0),o=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=Ml(s,o),a=new ve(s,l,0).goto(i),h=new ve(o,l,0).goto(i);for(;;){if(a.to!=h.to||!Nr(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>r)return!0;a.next(),h.next()}}static spans(t,e,i,r,s=-1){let o=new ve(t,null,s).goto(e),l=e,a=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFrom<e?c.length+1:Math.min(c.length,a);r.point(l,h,o.point,c,f,o.pointRank),a=Math.min(o.openEnd(h),c.length)}else h>l&&(r.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>i)return a+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(t,e=!1){let i=new Ce;for(let r of t instanceof ki?[t]:e?Hc(t):t)i.add(r.from,r.to,r.value);return i.finish()}};ht.empty=new ht([],[],null,-1);function Hc(n){if(n.length>1)for(let t=n[0],e=1;e<n.length;e++){let i=n[e];if(Dr(t,i)>0)return n.slice().sort(Dr);t=i}return n}ht.empty.nextLayer=ht.empty;var Ce=class n{constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}finishChunk(t){this.chunks.push(new Or(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new n)).add(t,e,i)}addInner(t,e,i){let r=t-this.lastTo||i.startSide-this.last.endSide;if(r<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=e,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let i=e.value.length-1;return this.last=e.value[i],this.lastFrom=e.from[i]+t,this.lastTo=e.to[i]+t,!0}finish(){return this.finishInner(ht.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let e=ht.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}};function Ml(n,t,e){let i=new Map;for(let s of n)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&i.set(s.chunk[o],s.chunkPos[o]);let r=new Set;for(let s of t)for(let o=0;o<s.chunk.length;o++){let l=i.get(s.chunk[o]);l!=null&&(e?e.mapPos(l):l)==s.chunkPos[o]&&!(e!=null&&e.touchesRange(l,l+s.chunk[o].length))&&r.add(s.chunk[o])}return r}var dn=class{constructor(t,e,i,r=0){this.layer=t,this.skip=e,this.minPoint=i,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(t,e=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this}gotoInner(t,e,i){for(;this.chunkIndex<this.layer.chunk.length;){let r=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<t||r.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!i||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(t,e){(this.to-t||this.endSide-e)<0&&this.gotoInner(t,e,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let t=this.layer.chunkPos[this.chunkIndex],e=this.layer.chunk[this.chunkIndex],i=t+e.from[this.rangeIndex];if(this.from=i,this.to=t+e.to[this.rangeIndex],this.value=e.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=t}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide}},Ci=class n{constructor(t){this.heap=t}static from(t,e=null,i=-1){let r=[];for(let s=0;s<t.length;s++)for(let o=t[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=i&&r.push(new dn(o,e,i,s));return r.length==1?r[0]:new n(r)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let i of this.heap)i.goto(t,e);for(let i=this.heap.length>>1;i>=0;i--)wr(this.heap,i);return this.next(),this}forward(t,e){for(let i of this.heap)i.forward(t,e);for(let i=this.heap.length>>1;i>=0;i--)wr(this.heap,i);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),wr(this.heap,0)}}};function wr(n,t){for(let e=n[t];;){let i=(t<<1)+1;if(i>=n.length)break;let r=n[i];if(i+1<n.length&&r.compare(n[i+1])>=0&&(r=n[i+1],i++),e.compare(r)<0)break;n[i]=e,n[t]=r,t=i}}var ve=class{constructor(t,e,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Ci.from(t,e,i)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){nn(this.active,t),nn(this.activeTo,t),nn(this.activeRank,t),this.minActive=Rl(this.active,this.activeTo)}addActive(t){let e=0,{value:i,to:r,rank:s}=this.cursor;for(;e<this.activeRank.length&&this.activeRank[e]<=s;)e++;rn(this.active,e,i),rn(this.activeTo,e,r),rn(this.activeRank,e,s),t&&rn(t,e,this.cursor.from),this.minActive=Rl(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>t){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),i&&nn(i,r)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(i),this.cursor.next();else if(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let r=i.length-1;r>=0&&i[r]<t;r--)this.openStart++}}activeForPoint(t){if(!this.active.length)return this.active;let e=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>t||this.activeTo[i]==t&&this.active[i].endSide>=this.point.endSide)&&e.push(this.active[i]);return e.reverse()}openEnd(t){let e=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>t;i--)e++;return e}};function El(n,t,e,i,r,s){n.goto(t),e.goto(i);let o=i+r,l=i,a=i-t;for(;;){let h=n.to+a-e.to||n.endSide-e.endSide,c=h<0?n.to+a:e.to,f=Math.min(c,o);if(n.point||e.point?n.point&&e.point&&(n.point==e.point||n.point.eq(e.point))&&Nr(n.activeForPoint(n.to+a),e.activeForPoint(e.to))||s.comparePoint(l,f,n.point,e.point):f>l&&!Nr(n.active,e.active)&&s.compareRange(l,f,n.active,e.active),c>o)break;l=c,h<=0&&n.next(),h>=0&&e.next()}}function Nr(n,t){if(n.length!=t.length)return!1;for(let e=0;e<n.length;e++)if(n[e]!=t[e]&&!n[e].eq(t[e]))return!1;return!0}function nn(n,t){for(let e=t,i=n.length-1;e<i;e++)n[e]=n[e+1];n.pop()}function rn(n,t,e){for(let i=n.length-1;i>=t;i--)n[i+1]=n[i];n[t]=e}function Rl(n,t){let e=-1,i=1e9;for(let r=0;r<t.length;r++)(t[r]-i||n[r].endSide-n[e].endSide)<0&&(e=r,i=t[r]);return e}function Ul(n,t,e,i){for(let r=0,s=0;;){if(s>=t)return r;if(r==n.length)break;s+=n.charCodeAt(r)==9?e-s%e:1,r=Xt(n,r)}return i===!0?-1:n.length}var _r="\\u037C",jl=typeof Symbol=="undefined"?"__"+_r:Symbol.for(_r),Lr=typeof Symbol=="undefined"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Gl=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{},Rt=class{constructor(t,e){this.rules=[];let{finish:i}=e||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\\s*/)}function s(o,l,a,h){let c=[],f=/^@(\\w+)\\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&l==null)return a.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))s(d.split(/,\\s*/).map(b=>o.map(y=>b.replace(/&/,y))).reduce((b,y)=>b.concat(y)),p,a);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");s(r(d),p,c,u)}else p!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,b=>"-"+b.toLowerCase())+": "+p+";")}(c.length||u)&&a.push((i&&!f&&!h?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in t)s(r(o),t[o],this.rules)}getRules(){return this.rules.join(`\n`)}static newName(){let t=Gl[jl]||1;return Gl[jl]=t+1,_r+t.toString(36)}static mount(t,e,i){let r=t[Lr],s=i&&i.nonce;r?s&&r.setNonce(s):r=new Br(t,s),r.mount(Array.isArray(e)?e:[e])}},Kl=new Map,Br=class{constructor(t,e){this.root=t;let i=t.ownerDocument||t,r=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&r.CSSStyleSheet){let s=Kl.get(i);if(s)return t[Lr]=s;this.sheet=new r.CSSStyleSheet,Kl.set(i,this)}else this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[Lr]=this}mount(t){let e=this.sheet,i=0,r=0;for(let s=0;s<t.length;s++){let o=t[s],l=this.modules.indexOf(o);if(l<r&&l>-1&&(this.modules.splice(l,1),r--,l=-1),l==-1){if(this.modules.splice(r++,0,o),e)for(let a=0;a<o.rules.length;a++)e.insertRule(o.rules[a],i++)}else{for(;r<l;)i+=this.modules[r++].rules.length;i+=o.rules.length,r++}}if(e)this.root.adoptedStyleSheets.indexOf(this.sheet)<0&&(this.root.adoptedStyleSheets=[this.sheet,...this.root.adoptedStyleSheets]);else{let s="";for(let l=0;l<this.modules.length;l++)s+=this.modules[l].getRules()+`\n`;this.styleTag.textContent=s;let o=this.root.head||this.root;this.styleTag.parentNode!=o&&o.insertBefore(this.styleTag,o.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}};var Ae={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\\\",221:"]",222:"\'"},mn={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:\'"\'},um=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),dm=typeof navigator!="undefined"&&/MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent);for(et=0;et<10;et++)Ae[48+et]=Ae[96+et]=String(et);var et;for(et=1;et<=24;et++)Ae[et+111]="F"+et;var et;for(et=65;et<=90;et++)Ae[et]=String.fromCharCode(et+32),mn[et]=String.fromCharCode(et);var et;for(gn in Ae)mn.hasOwnProperty(gn)||(mn[gn]=Ae[gn]);var gn;function An(n){let t;return n.nodeType==11?t=n.getSelection?n:n.ownerDocument:t=n,t.getSelection()}function qe(n,t){return t?n==t||n.contains(t.nodeType!=1?t.parentNode:t):!1}function zc(n){let t=n.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function kn(n,t){if(!t.anchorNode)return!1;try{return qe(n,t.anchorNode)}catch(e){return!1}}function Di(n){return n.nodeType==3?Xe(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Tn(n,t,e,i){return e?ql(n,t,e,i,-1)||ql(n,t,e,i,1):!1}function Mn(n){for(var t=0;;t++)if(n=n.previousSibling,!n)return t}function ql(n,t,e,i,r){for(;;){if(n==e&&t==i)return!0;if(t==(r<0?0:Oi(n))){if(n.nodeName=="DIV")return!1;let s=n.parentNode;if(!s||s.nodeType!=1)return!1;t=Mn(n)+(r<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[t+(r<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;t=r<0?Oi(n):0}else return!1}}function Oi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}var Sa={left:0,right:0,top:0,bottom:0};function vs(n,t){let e=t?n.left:n.right;return{left:e,right:e,top:n.top,bottom:n.bottom}}function Uc(n){return{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function jc(n,t,e,i,r,s,o,l){let a=n.ownerDocument,h=a.defaultView||window;for(let c=n;c;)if(c.nodeType==1){let f,u=c==a.body;if(u)f=Uc(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let b=c.getBoundingClientRect();f={left:b.left,right:b.left+c.clientWidth,top:b.top,bottom:b.top+c.clientHeight}}let d=0,p=0;if(r=="nearest")t.top<f.top?(p=-(f.top-t.top+o),e>0&&t.bottom>f.bottom+p&&(p=t.bottom-f.bottom+p+o)):t.bottom>f.bottom&&(p=t.bottom-f.bottom+o,e<0&&t.top-p<f.top&&(p=-(f.top+p-t.top+o)));else{let b=t.bottom-t.top,y=f.bottom-f.top;p=(r=="center"&&b<=y?t.top+b/2-y/2:r=="start"||r=="center"&&e<0?t.top-o:t.bottom-y+o)-f.top}if(i=="nearest"?t.left<f.left?(d=-(f.left-t.left+s),e>0&&t.right>f.right+d&&(d=t.right-f.right+d+s)):t.right>f.right&&(d=t.right-f.right+s,e<0&&t.left<f.left+d&&(d=-(f.left+d-t.left+s))):d=(i=="center"?t.left+(t.right-t.left)/2-(f.right-f.left)/2:i=="start"==l?t.left-s:t.right-(f.right-f.left)+s)-f.left,d||p)if(u)h.scrollBy(d,p);else{let b=0,y=0;if(p){let v=c.scrollTop;c.scrollTop+=p,y=c.scrollTop-v}if(d){let v=c.scrollLeft;c.scrollLeft+=d,b=c.scrollLeft-v}t={left:t.left-b,top:t.top-y,right:t.right-b,bottom:t.bottom-y},b&&Math.abs(b-d)<1&&(i="nearest"),y&&Math.abs(y-p)<1&&(r="nearest")}if(u)break;c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function Gc(n){let t=n.ownerDocument;for(let e=n.parentNode;e&&e!=t.body;)if(e.nodeType==1){if(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth)return e;e=e.assignedSlot||e.parentNode}else if(e.nodeType==11)e=e.host;else break;return null}var Wr=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,r){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=r}},je=null;function xa(n){if(n.setActive)return n.setActive();if(je)return n.focus(je);let t=[];for(let e=n;e&&(t.push(e,e.scrollTop,e.scrollLeft),e!=e.ownerDocument);e=e.parentNode);if(n.focus(je==null?{get preventScroll(){return je={preventScroll:!0},!0}}:void 0),!je){je=!1;for(let e=0;e<t.length;){let i=t[e++],r=t[e++],s=t[e++];i.scrollTop!=r&&(i.scrollTop=r),i.scrollLeft!=s&&(i.scrollLeft=s)}}}var Xl;function Xe(n,t,e=t){let i=Xl||(Xl=document.createRange());return i.setEnd(n,e),i.setStart(n,t),i}function Ke(n,t,e){let i={key:t,code:t,keyCode:e,which:e,cancelable:!0},r=new KeyboardEvent("keydown",i);r.synthetic=!0,n.dispatchEvent(r);let s=new KeyboardEvent("keyup",i);return s.synthetic=!0,n.dispatchEvent(s),r.defaultPrevented||s.defaultPrevented}function Kc(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function ka(n){for(;n.attributes.length;)n.removeAttributeNode(n.attributes[0])}function qc(n,t){let e=t.focusNode,i=t.focusOffset;if(!e||t.anchorNode!=e||t.anchorOffset!=i)return!1;for(;;)if(i){if(e.nodeType!=1)return!1;let r=e.childNodes[i-1];r.contentEditable=="false"?i--:(e=r,i=Oi(e))}else{if(e==n)return!0;i=Mn(e),e=e.parentNode}}var dt=class n{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(t,e){return new n(t.parentNode,Mn(t),e)}static after(t,e){return new n(t.parentNode,Mn(t)+1,e)}},Ss=[],X=class n{constructor(){this.parent=null,this.dom=null,this.dirty=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t){let e=this.posAtStart;for(let i of this.children){if(i==t)return e;e+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}coordsAt(t,e){return null}sync(t,e){if(this.dirty&2){let i=this.dom,r=null,s;for(let o of this.children){if(o.dirty){if(!o.dom&&(s=r?r.nextSibling:i.firstChild)){let l=n.get(s);(!l||!l.parent&&l.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(t,e),o.dirty=0}if(s=r?r.nextSibling:i.firstChild,e&&!e.written&&e.node==i&&s!=o.dom&&(e.written=!0),o.dom.parentNode==i)for(;s&&s!=o.dom;)s=Yl(s);else i.insertBefore(o.dom,s);r=o.dom}for(s=r?r.nextSibling:i.firstChild,s&&e&&e.node==i&&(e.written=!0);s;)s=Yl(s)}else if(this.dirty&1)for(let i of this.children)i.dirty&&(i.sync(t,e),i.dirty=0)}reuseDOM(t){}localPosFromDOM(t,e){let i;if(t==this.dom)i=this.dom.childNodes[e];else{let r=Oi(t)==0?0:e==0?-1:1;for(;;){let s=t.parentNode;if(s==this.dom)break;r==0&&s.firstChild!=s.lastChild&&(t==s.firstChild?r=-1:r=1),t=s}r<0?i=t:i=t.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!n.get(i);)i=i.nextSibling;if(!i)return this.length;for(let r=0,s=0;;r++){let o=this.children[r];if(o.dom==i)return s;s+=o.length+o.breakAfter}}domBoundsAround(t,e,i=0){let r=-1,s=-1,o=-1,l=-1;for(let a=0,h=i,c=i;a<this.children.length;a++){let f=this.children[a],u=h+f.length;if(h<t&&u>e)return f.domBoundsAround(t,e,h);if(u>=t&&r==-1&&(r=a,s=h),h>e&&f.dom.parentNode==this.dom){o=a,l=c;break}c=u,h=u+f.breakAfter}return{from:s,to:l<0?i+this.length:l,startDOM:(r?this.children[r-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(t=!1){this.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),e.dirty&1)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(t){this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,i=Ss){this.markDirty();for(let r=t;r<e;r++){let s=this.children[r];s.parent==this&&s.destroy()}this.children.splice(t,e-t,...i);for(let r=0;r<i.length;r++)i[r].setParent(this)}ignoreMutation(t){return!1}ignoreEvent(t){return!1}childCursor(t=this.length){return new En(this.children,t,this.children.length)}childPos(t,e=1){return this.childCursor().findPos(t,e)}toString(){let t=this.constructor.name.replace("View","");return t+(this.children.length?"("+this.children.join()+")":this.length?"["+(t=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(t){return t.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(t,e,i,r,s,o){return!1}become(t){return!1}canReuseDOM(t){return t.constructor==this.constructor}getSide(){return 0}destroy(){this.parent=null}};X.prototype.breakAfter=0;function Yl(n){let t=n.nextSibling;return n.parentNode.removeChild(n),t}var En=class{constructor(t,e,i){this.children=t,this.pos=e,this.i=i,this.off=0}findPos(t,e=1){for(;;){if(t>this.pos||t==this.pos&&(e>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}};function Ca(n,t,e,i,r,s,o,l,a){let{children:h}=n,c=h.length?h[t]:null,f=s.length?s[s.length-1]:null,u=f?f.breakAfter:o;if(!(t==i&&c&&!o&&!u&&s.length<2&&c.merge(e,r,s.length?f:null,e==0,l,a))){if(i<h.length){let d=h[i];d&&r<d.length?(t==i&&(d=d.split(r),r=0),!u&&f&&d.merge(0,r,f,!0,0,a)?s[s.length-1]=d:(r&&d.merge(0,r,null,!1,0,a),s.push(d))):d!=null&&d.breakAfter&&(f?f.breakAfter=1:o=1),i++}for(c&&(c.breakAfter=o,e>0&&(!o&&s.length&&c.merge(e,c.length,s[0],!1,l,0)?c.breakAfter=s.shift().breakAfter:(e<c.length||c.children.length&&c.children[c.children.length-1].length==0)&&c.merge(e,c.length,null,!1,l,0),t++));t<i&&s.length;)if(h[i-1].become(s[s.length-1]))i--,s.pop(),a=s.length?0:l;else if(h[t].become(s[0]))t++,s.shift(),l=s.length?0:a;else break;!s.length&&t&&i<h.length&&!h[t-1].breakAfter&&h[i].merge(0,0,h[t-1],!1,l,a)&&t--,(t<i||s.length)&&n.replaceChildren(t,i,s)}}function Aa(n,t,e,i,r,s){let o=n.childCursor(),{i:l,off:a}=o.findPos(e,1),{i:h,off:c}=o.findPos(t,-1),f=t-e;for(let u of i)f+=u.length;n.length+=f,Ca(n,h,c,l,a,i,0,r,s)}var At=typeof navigator!="undefined"?navigator:{userAgent:"",vendor:"",platform:""},zr=typeof document!="undefined"?document:{documentElement:{style:{}}},Ur=/Edge\\/(\\d+)/.exec(At.userAgent),Ta=/MSIE \\d/.test(At.userAgent),jr=/Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(At.userAgent),Vn=!!(Ta||jr||Ur),Jl=!Vn&&/gecko\\/(\\d+)/i.test(At.userAgent),Fr=!Vn&&/Chrome\\/(\\d+)/.exec(At.userAgent),Zl="webkitFontSmoothing"in zr.documentElement.style,Ma=!Vn&&/Apple Computer/.test(At.vendor),Ql=Ma&&(/Mobile\\/\\w+/.test(At.userAgent)||At.maxTouchPoints>2),I={mac:Ql||/Mac/.test(At.platform),windows:/Win/.test(At.platform),linux:/Linux|X11/.test(At.platform),ie:Vn,ie_version:Ta?zr.documentMode||6:jr?+jr[1]:Ur?+Ur[1]:0,gecko:Jl,gecko_version:Jl?+(/Firefox\\/(\\d+)/.exec(At.userAgent)||[0,0])[1]:0,chrome:!!Fr,chrome_version:Fr?+Fr[1]:0,ios:Ql,android:/Android\\b/.test(At.userAgent),webkit:Zl,safari:Ma,webkit_version:Zl?+(/\\bAppleWebKit\\/(\\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:zr.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"},Xc=256,Te=class n extends X{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){t.nodeType==3&&this.createDOM(t)}merge(t,e,i){return i&&(!(i instanceof n)||this.length-(e-t)+i.length>Xc)?!1:(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new n(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new dt(this.dom,t)}domBoundsAround(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return Gr(this.dom,t,e)}},ee=class n extends X{constructor(t,e=[],i=0){super(),this.mark=t,this.children=e,this.length=i;for(let r of e)r.setParent(this)}setAttrs(t){if(ka(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?this.dirty&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,i,r,s,o){return i&&(!(i instanceof n&&i.mark.eq(this.mark))||t&&s<=0||e<this.length&&o<=0)?!1:(Aa(this,t,e,i?i.children:[],s-1,o-1),this.markDirty(),!0)}split(t){let e=[],i=0,r=-1,s=0;for(let l of this.children){let a=i+l.length;a>t&&e.push(i<t?l.split(t-i):l),r<0&&i>=t&&(r=s),i=a,s++}let o=this.length-t;return this.length=t,r>-1&&(this.children.length=r,this.markDirty()),new n(this.mark,e,o)}domAtPos(t){return Oa(this,t)}coordsAt(t,e){return Pa(this,t,e)}};function Gr(n,t,e){let i=n.nodeValue.length;t>i&&(t=i);let r=t,s=t,o=0;t==0&&e<0||t==i&&e>=0?I.chrome||I.gecko||(t?(r--,o=1):s<i&&(s++,o=-1)):e<0?r--:s<i&&s++;let l=Xe(n,r,s).getClientRects();if(!l.length)return Sa;let a=l[(o?o<0:e>=0)?0:l.length-1];return I.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?vs(a,o<0):a||null}var Ni=class n extends X{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||n)(t,e,i)}split(t){let e=n.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){(!this.dom||!this.widget.updateDOM(this.dom,t))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.dom.contentEditable="false")}getSide(){return this.side}merge(t,e,i,r,s,o){return i&&(!(i instanceof n)||!this.widget.compare(i.widget)||t>0&&s<=0||e<this.length&&o<=0)?!1:(this.length=t+(i?i.length:0)+(this.length-e),!0)}become(t){return t.length==this.length&&t instanceof n&&t.side==this.side&&this.widget.constructor==t.widget.constructor?(this.widget.compare(t.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,!0):!1}ignoreMutation(){return!0}ignoreEvent(t){return this.widget.ignoreEvent(t)}get overrideDOMText(){if(this.length==0)return U.empty;let t=this;for(;t.parent;)t=t.parent;let{view:e}=t,i=e&&e.state.doc,r=this.posAtStart;return i?i.slice(r,r+this.length):U.empty}domAtPos(t){return(this.length?t==0:this.side>0)?dt.before(this.dom):dt.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),r=null;if(!i.length)return Sa;for(let s=t>0?i.length-1:0;r=i[s],!(t>0?s==0:s==i.length-1||r.top<r.bottom);s+=t>0?-1:1);return this.length?r:vs(r,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}},Rn=class extends Ni{domAtPos(t){let{topView:e,text:i}=this.widget;return e?Kr(t,0,e,i,this.length-e.length,(r,s)=>r.domAtPos(s),(r,s)=>new dt(r,Math.min(s,r.nodeValue.length))):new dt(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:r}=this.widget;return i?Ra(t,e,i,r,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:r}=this.widget;return i?Kr(t,e,i,r,this.length-i.length,(s,o,l)=>s.coordsAt(o,l),(s,o,l)=>Gr(s,o,l)):Gr(r,t,e)}destroy(){var t;super.destroy(),(t=this.widget.topView)===null||t===void 0||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}};function Kr(n,t,e,i,r,s,o){if(e instanceof ee){for(let l=e.dom.firstChild;l;l=l.nextSibling){let a=X.get(l);if(a){let h=qe(l,i),c=a.length+(h?r:0);if(n<c||n==c&&a.getSide()<=0)return h?Kr(n,t,a,i,r,s,o):s(a,n,t);n-=c}else{let h=Ea(n,t,l,o);if(typeof h!="number")return h;n=h}}return s(e,e.length,-1)}else return e.dom==i?o(i,n,t):s(e,n,t)}function Ea(n,t,e,i){if(e.nodeType==3){let r=e.nodeValue.length;if(n<=r)return i(e,n,t);n-=r}else if(e.nodeType==1&&e.contentEditable!="false")for(let r=e.firstChild;r;r=r.nextSibling){let s=Ea(n,t,r,i);if(typeof s!="number")return s;n=s}return n}function Ra(n,t,e,i,r){if(e instanceof ee){let s=0;for(let o=e.dom.firstChild;o;o=o.nextSibling){let l=X.get(o);if(l){let a=qe(o,i);if(qe(o,n))return s+(a?Ra(n,t,l,i,r):l.localPosFromDOM(n,t));s+=l.length+(a?r:0)}else{let a=Da(n,t,o);if(a.result!=null)return s+a.result;s+=a.size}}}else if(e.dom==i)return Math.min(t,i.nodeValue.length);return e.localPosFromDOM(n,t)}function Da(n,t,e){if(e.nodeType==3)return n==e?{result:t}:{size:e.nodeValue.length};if(e.nodeType==1&&e.contentEditable!="false"){let i=0;for(let r=e.firstChild,s=0;;r=r.nextSibling,s++){if(n==e&&s==t)return{result:i};if(!r)return{size:i};let o=Da(n,t,r);if(o.result!=null)return{result:t+o.result};i+=o.size}}else return e.contains(n)?{result:0}:{size:0}}var Ye=class n extends X{constructor(t){super(),this.side=t}get length(){return 0}merge(){return!1}become(t){return t instanceof n&&t.side==this.side}split(){return new n(this.side)}sync(){if(!this.dom){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),this.setDOM(t)}}getSide(){return this.side}domAtPos(t){return this.side>0?dt.before(this.dom):dt.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=Yc(this,this.side>0?-1:1);return i&&i.top<e.bottom&&i.bottom>e.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return U.empty}get isHidden(){return!0}};Te.prototype.children=Ni.prototype.children=Ye.prototype.children=Ss;function Yc(n,t){let e=n.parent,i=e?e.children.indexOf(n):-1;for(;e&&i>=0;)if(t<0?i>0:i<e.children.length){let r=e.children[i+t];if(r instanceof Te){let s=r.coordsAt(t<0?r.length:0,t);if(s)return s}i+=t}else if(e instanceof ee&&e.parent)i=e.parent.children.indexOf(e)+(t<0?0:1),e=e.parent;else{let r=e.dom.lastChild;if(r&&r.nodeName=="BR")return r.getClientRects()[0];break}}function Oa(n,t){let e=n.dom,{children:i}=n,r=0;for(let s=0;r<i.length;r++){let o=i[r],l=s+o.length;if(!(l==s&&o.getSide()<=0)){if(t>s&&t<l&&o.dom.parentNode==e)return o.domAtPos(t-s);if(t<=s)break;s=l}}for(let s=r;s>0;s--){let o=i[s-1];if(o.dom.parentNode==e)return o.domAtPos(o.length)}for(let s=r;s<i.length;s++){let o=i[s];if(o.dom.parentNode==e)return o.domAtPos(0)}return new dt(e,0)}function Na(n,t,e){let i,{children:r}=n;e>0&&t instanceof ee&&r.length&&(i=r[r.length-1])instanceof ee&&i.mark.eq(t.mark)?Na(i,t.children[0],e-1):(r.push(t),t.setParent(n)),n.length+=t.length}function Pa(n,t,e){let i=null,r=-1,s=null,o=-1;function l(h,c){for(let f=0,u=0;f<h.children.length&&u<=c;f++){let d=h.children[f],p=u+d.length;p>=c&&(d.children.length?l(d,c-u):(!s||s instanceof Ye&&e>0)&&(p>c||u==p&&d.getSide()>0)?(s=d,o=c-u):(u<c||u==p&&d.getSide()<0)&&(i=d,r=c-u)),u=p}}l(n,t);let a=(e<0?i:s)||i||s;return a?a.coordsAt(Math.max(0,a==i?r:o),e):Jc(n)}function Jc(n){let t=n.dom.lastChild;if(!t)return n.dom.getBoundingClientRect();let e=Di(t);return e[e.length-1]||null}function qr(n,t){for(let e in n)e=="class"&&t.class?t.class+=" "+n.class:e=="style"&&t.style?t.style+=";"+n.style:t[e]=n[e];return t}function xs(n,t){if(n==t)return!0;if(!n||!t)return!1;let e=Object.keys(n),i=Object.keys(t);if(e.length!=i.length)return!1;for(let r of e)if(i.indexOf(r)==-1||n[r]!==t[r])return!1;return!0}function Xr(n,t,e){let i=null;if(t)for(let r in t)e&&r in e||n.removeAttribute(i=r);if(e)for(let r in e)t&&t[r]==e[r]||n.setAttribute(i=r,e[r]);return!!i}var Me=class{eq(t){return!1}updateDOM(t,e){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}ignoreEvent(t){return!0}get customView(){return null}get isHidden(){return!1}destroy(t){}},it=function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n}(it||(it={})),J=class extends Zt{constructor(t,e,i,r){super(),this.startSide=t,this.endSide=e,this.widget=i,this.spec=r}get heightRelevant(){return!1}static mark(t){return new Dn(t)}static widget(t){let e=t.side||0,i=!!t.block;return e+=i?e>0?3e8:-4e8:e>0?1e8:-1e8,new Ee(t,e,e,i,t.widget||null,!1)}static replace(t){let e=!!t.block,i,r;if(t.isBlockGap)i=-5e8,r=4e8;else{let{start:s,end:o}=Ia(t,e);i=(s?e?-3e8:-1:5e8)-1,r=(o?e?2e8:1:-6e8)+1}return new Ee(t,i,r,e,t.widget||null,!0)}static line(t){return new Pi(t)}static set(t,e=!1){return ht.of(t,e)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};J.none=ht.empty;var Dn=class n extends J{constructor(t){let{start:e,end:i}=Ia(t);super(e?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){return this==t||t instanceof n&&this.tagName==t.tagName&&this.class==t.class&&xs(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}};Dn.prototype.point=!1;var Pi=class n extends J{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof n&&this.spec.class==t.spec.class&&xs(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}};Pi.prototype.mapMode=vt.TrackBefore;Pi.prototype.point=!0;var Ee=class n extends J{constructor(t,e,i,r,s,o){super(e,i,s,t),this.block=r,this.isReplace=o,this.mapMode=r?e<=0?vt.TrackBefore:vt.TrackAfter:vt.TrackDel}get type(){return this.startSide<this.endSide?it.WidgetRange:this.startSide<=0?it.WidgetBefore:it.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&this.widget.estimatedHeight>=5}eq(t){return t instanceof n&&Zc(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}};Ee.prototype.point=!0;function Ia(n,t=!1){let{inclusiveStart:e,inclusiveEnd:i}=n;return e==null&&(e=n.inclusive),i==null&&(i=n.inclusive),{start:e!=null?e:t,end:i!=null?i:t}}function Zc(n,t){return n==t||!!(n&&t&&n.compare(t))}function Yr(n,t,e,i=0){let r=e.length-1;r>=0&&e[r]+i>=n?e[r]=Math.max(e[r],t):e.push(n,t)}var Tt=class n extends X{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,e,i,r,s,o){if(i){if(!(i instanceof n))return!1;this.dom||i.transferDOM(this)}return r&&this.setDeco(i?i.attrs:null),Aa(this,t,e,i?i.children:[],s,o),!0}split(t){let e=new n;if(e.breakAfter=this.breakAfter,this.length==0)return e;let{i,off:r}=this.childPos(t);r&&(e.append(this.children[i].split(r),0),this.children[i].merge(r,this.children[i].length,null,!1,0,0),i++);for(let s=i;s<this.children.length;s++)e.append(this.children[s],0);for(;i>0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){xs(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Na(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=qr(e,this.attrs||{})),i&&(this.attrs=qr({class:i},this.attrs||{}))}domAtPos(t){return Oa(this,t)}reuseDOM(t){t.nodeName=="DIV"&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?this.dirty&4&&(ka(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Xr(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t,e);let r=this.dom.lastChild;for(;r&&X.get(r)instanceof ee;)r=r.lastChild;if(!r||!this.length||r.nodeName!="BR"&&((i=X.get(r))===null||i===void 0?void 0:i.isEditable)==!1&&(!I.ios||!this.children.some(s=>s instanceof Te))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let t=0,e;for(let i of this.children){if(!(i instanceof Te)||/[^ -~]/.test(i.text))return null;let r=Di(i.dom);if(r.length!=1)return null;t+=r[0].width,e=r[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(t,e){let i=Pa(this,t,e);if(!this.children.length&&i&&this.parent){let{heightOracle:r}=this.parent.view.viewState,s=i.bottom-i.top;if(Math.abs(s-r.lineHeight)<2&&r.textHeight<s){let o=(s-r.textHeight)/2;return{top:i.top+o,bottom:i.bottom-o,left:i.left,right:i.left}}}return i}become(t){return!1}get type(){return it.Text}static find(t,e){for(let i=0,r=0;i<t.children.length;i++){let s=t.children[i],o=r+s.length;if(o>=e){if(s instanceof n)return s;if(o>e)break}r=o+s.breakAfter}return null}},Ii=class n extends X{constructor(t,e,i){super(),this.widget=t,this.length=e,this.type=i,this.breakAfter=0,this.prevWidget=null}merge(t,e,i,r,s,o){return i&&(!(i instanceof n)||!this.widget.compare(i.widget)||t>0&&s<=0||e<this.length&&o<=0)?!1:(this.length=t+(i?i.length:0)+(this.length-e),!0)}domAtPos(t){return t==0?dt.before(this.dom):dt.after(this.dom,t==this.length)}split(t){let e=this.length-t;this.length=t;let i=new n(this.widget,e,this.type);return i.breakAfter=this.breakAfter,i}get children(){return Ss}sync(t){(!this.dom||!this.widget.updateDOM(this.dom,t))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.dom.contentEditable="false")}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):U.empty}domBoundsAround(){return null}become(t){return t instanceof n&&t.type==this.type&&t.widget.constructor==this.widget.constructor?(t.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,this.breakAfter=t.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(t){return this.widget.ignoreEvent(t)}get isEditable(){return!1}get isWidget(){return!0}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}},Jr=class n{constructor(t,e,i,r){this.doc=t,this.pos=e,this.end=i,this.disallowBlockEffectsFor=r,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=t.iter(),this.skip=e}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let t=this.content[this.content.length-1];return!t.breakAfter&&!(t instanceof Ii&&t.type==it.WidgetBefore)}getLine(){return this.curLine||(this.content.push(this.curLine=new Tt),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(yn(new Ye(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||this.getLine()}buildText(t,e,i){for(;t>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,t--;continue}else this.text=s,this.textOff=0}let r=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-i)),this.getLine().append(yn(new Te(this.text.slice(this.textOff,this.textOff+r)),e),i),this.atCursorPos=!0,this.textOff+=r,t-=r,i=0}}span(t,e,i,r){this.buildText(e-t,i,r),this.pos=e,this.openStart<0&&(this.openStart=r)}point(t,e,i,r,s,o){if(this.disallowBlockEffectsFor[o]&&i instanceof Ee){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=e-t;if(i instanceof Ee)if(i.block){let{type:a}=i;a==it.WidgetAfter&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Ii(i.widget||new On("div"),l,a))}else{let a=Ni.create(i.widget||new On("span"),l,l?0:i.startSide),h=this.atCursorPos&&!a.isEditable&&s<=r.length&&(t<e||i.startSide>0),c=!a.isEditable&&(t<e||s>r.length||i.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!h&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(r),h&&(f.append(yn(new Ye(1),r),s),s=r.length+Math.max(0,s-r.length)),f.append(yn(a,r),s),this.atCursorPos=c,this.pendingBuffer=c?t<e||s>r.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=r.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=s)}static build(t,e,i,r,s){let o=new n(t,e,i,s);return o.openEnd=ht.spans(r,e,i,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}};function yn(n,t){for(let e of t)n=new ee(e,[n],n.length);return n}var On=class extends Me{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}},_a=V.define(),La=V.define(),Ba=V.define(),Fa=V.define(),Zr=V.define(),$a=V.define(),Ha=V.define(),Va=V.define({combine:n=>n.some(t=>t)}),Qc=V.define({combine:n=>n.some(t=>t)}),Nn=class n{constructor(t,e="nearest",i="nearest",r=5,s=5){this.range=t,this.y=e,this.x=i,this.yMargin=r,this.xMargin=s}map(t){return t.empty?this:new n(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}},ta=tt.define({map:(n,t)=>n.map(t)});function te(n,t,e){let i=n.facet(Fa);i.length?i[0](t):window.onerror?window.onerror(String(t),e,void 0,void 0,t):e?console.error(e+":",t):console.error(t)}var Wn=V.define({combine:n=>n.length?n[0]:!0}),tf=0,Ai=V.define(),Je=class n{constructor(t,e,i,r){this.id=t,this.create=e,this.domEventHandlers=i,this.extension=r(this)}static define(t,e){let{eventHandlers:i,provide:r,decorations:s}=e||{};return new n(tf++,t,i,o=>{let l=[Ai.of(o)];return s&&l.push(_i.of(a=>{let h=a.plugin(o);return h?s(h):J.none})),r&&l.push(r(o)),l})}static fromClass(t,e){return n.define(i=>new t(i),e)}},Ei=class{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}update(t){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(i){if(te(e.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(r){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(e){te(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(!((e=this.value)===null||e===void 0)&&e.destroy)try{this.value.destroy()}catch(i){te(t.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}},Wa=V.define(),ks=V.define(),_i=V.define(),za=V.define(),Ua=V.define(),Ti=V.define(),ae=class n{constructor(t,e,i,r){this.fromA=t,this.toA=e,this.fromB=i,this.toB=r}join(t){return new n(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,i=this;for(;e>0;e--){let r=t[e-1];if(!(r.fromA>i.toA)){if(r.toA<i.fromA)break;i=i.join(r),t.splice(e-1,1)}}return t.splice(e,0,i),t}static extendWithRanges(t,e){if(e.length==0)return t;let i=[];for(let r=0,s=0,o=0,l=0;;r++){let a=r==t.length?null:t[r],h=o-l,c=a?a.fromB:1e9;for(;s<e.length&&e[s]<c;){let f=e[s],u=e[s+1],d=Math.max(l,f),p=Math.min(c,u);if(d<=p&&new n(d+h,p+h,d,p).addToSet(i),u>c)break;s+=2}if(!a)return i;new n(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),o=a.toA,l=a.toB}}},Pn=class n{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=Ct.empty(this.startState.doc.length);for(let s of i)this.changes=this.changes.compose(s.changes);let r=[];this.changes.iterChangedRanges((s,o,l,a)=>r.push(new ae(s,o,l,a))),this.changedRanges=r}static create(t,e,i){return new n(t,e,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},mt=function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n}(mt||(mt={})),Qr=mt.LTR,ef=mt.RTL;function ja(n){let t=[];for(let e=0;e<n.length;e++)t.push(1<<+n[e]);return t}var nf=ja("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),rf=ja("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),ts=Object.create(null),Ft=[];for(let n of["()","[]","{}"]){let t=n.charCodeAt(0),e=n.charCodeAt(1);ts[t]=e,ts[e]=-t}function sf(n){return n<=247?nf[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?rf[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8203?256:64336<=n&&n<=65023?4:n==8204?256:1}var of=/[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac\\ufb50-\\ufdff]/,he=class{constructor(t,e,i){this.from=t,this.to=e,this.level=i}get dir(){return this.level%2?ef:Qr}side(t,e){return this.dir==e==t?this.to:this.from}static find(t,e,i,r){let s=-1;for(let o=0;o<t.length;o++){let l=t[o];if(l.from<=e&&l.to>=e){if(l.level==i)return o;(s<0||(r!=0?r<0?l.from<e:l.to>e:t[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}},Y=[];function lf(n,t){let e=n.length,i=t==Qr?1:2,r=t==Qr?2:1;if(!n||i==1&&!of.test(n))return Ga(e);for(let o=0,l=i,a=i;o<e;o++){let h=sf(n.charCodeAt(o));h==512?h=l:h==8&&a==4&&(h=16),Y[o]=h==4?2:h,h&7&&(a=h),l=h}for(let o=0,l=i,a=i;o<e;o++){let h=Y[o];if(h==128)o<e-1&&l==Y[o+1]&&l&24?h=Y[o]=l:Y[o]=256;else if(h==64){let c=o+1;for(;c<e&&Y[c]==64;)c++;let f=o&&l==8||c<e&&Y[c]==8?a==1?1:8:256;for(let u=o;u<c;u++)Y[u]=f;o=c-1}else h==8&&a==1&&(Y[o]=1);l=h,h&7&&(a=h)}for(let o=0,l=0,a=0,h,c,f;o<e;o++)if(c=ts[h=n.charCodeAt(o)])if(c<0){for(let u=l-3;u>=0;u-=3)if(Ft[u+1]==-c){let d=Ft[u+2],p=d&2?i:d&4?d&1?r:i:0;p&&(Y[o]=Y[Ft[u]]=p),l=u;break}}else{if(Ft.length==189)break;Ft[l++]=o,Ft[l++]=h,Ft[l++]=a}else if((f=Y[o])==2||f==1){let u=f==i;a=u?0:1;for(let d=l-3;d>=0;d-=3){let p=Ft[d+2];if(p&2)break;if(u)Ft[d+2]|=2;else{if(p&4)break;Ft[d+2]|=4}}}for(let o=0;o<e;o++)if(Y[o]==256){let l=o+1;for(;l<e&&Y[l]==256;)l++;let a=(o?Y[o-1]:i)==1,h=(l<e?Y[l]:i)==1,c=a==h?a?1:2:i;for(let f=o;f<l;f++)Y[f]=c;o=l-1}let s=[];if(i==1)for(let o=0;o<e;){let l=o,a=Y[o++]!=1;for(;o<e&&a==(Y[o]!=1);)o++;if(a)for(let h=o;h>l;){let c=h,f=Y[--h]!=2;for(;h>l&&f==(Y[h-1]!=2);)h--;s.push(new he(h,c,f?2:1))}else s.push(new he(l,o,0))}else for(let o=0;o<e;){let l=o,a=Y[o++]==2;for(;o<e&&a==(Y[o]==2);)o++;s.push(new he(l,o,a?1:2))}return s}function Ga(n){return[new he(0,n,0)]}var Ka="";function af(n,t,e,i,r){var s;let o=i.head-n.from,l=-1;if(o==0){if(!r||!n.length)return null;t[0].level!=e&&(o=t[0].side(!1,e),l=0)}else if(o==n.length){if(r)return null;let u=t[t.length-1];u.level!=e&&(o=u.side(!0,e),l=t.length-1)}l<0&&(l=he.find(t,o,(s=i.bidiLevel)!==null&&s!==void 0?s:-1,i.assoc));let a=t[l];o==a.side(r,e)&&(a=t[l+=r?1:-1],o=a.side(!r,e));let h=r==(a.dir==e),c=Xt(n.text,o,h);if(Ka=n.text.slice(Math.min(o,c),Math.max(o,c)),c!=a.side(r,e))return $.cursor(c+n.from,h?-1:1,a.level);let f=l==(r?t.length-1:0)?null:t[l+(r?1:-1)];return!f&&a.level!=e?$.cursor(r?n.to:n.from,r?-1:1,e):f&&f.level<a.level?$.cursor(f.side(!r,e)+n.from,r?1:-1,f.level):$.cursor(c+n.from,r?-1:1,a.level)}var le="\\uFFFF",In=class{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(Q.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=le}readRange(t,e){if(!t)return this;let i=t.parentNode;for(let r=t;;){this.findPointBefore(i,r),this.readNode(r);let s=r.nextSibling;if(s==e)break;let o=X.get(r),l=X.get(s);(o&&l?o.breakAfter:(o?o.breakAfter:ea(r))||ea(s)&&(r.nodeName!="BR"||r.cmIgnore))&&this.lineBreak(),r=s}return this.findPointBefore(i,e),this}readTextNode(t){let e=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,e.length));for(let i=0,r=this.lineSeparator?null:/\\r\\n?|\\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=e.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=r.exec(e))&&(s=l.index,o=l[0].length),this.append(e.slice(i,s<0?e.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==t&&a.pos>this.text.length&&(a.pos-=o-1);i=s+o}}readNode(t){if(t.cmIgnore)return;let e=X.get(t),i=e&&e.overrideDOMText;if(i!=null){this.findPointInside(t,i.length);for(let r=i.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName=="BR"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==e&&(i.pos=this.text.length)}findPointInside(t,e){for(let i of this.points)(t.nodeType==3?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+Math.min(e,i.offset))}};function ea(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\\d|SECTION|PRE)$/.test(n.nodeName)}var _n=class{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}},Ln=class extends X{constructor(t){super(),this.view=t,this.compositionDeco=J.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new Tt],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new ae(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.every(({fromA:o,toA:l})=>l<this.minWidthFrom||o>this.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.view.inputState.composing<0?this.compositionDeco=J.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=cf(this.view,t.changes)),(I.ie||I.chrome)&&!this.compositionDeco.size&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,r=this.updateDeco(),s=uf(i,r,t.changes);return e=ae.extendWithRanges(e,s),this.dirty==0&&e.length==0?!1:(this.updateInner(e,t.startState.doc.length),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=I.chrome||I.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,s),this.dirty=0,s&&(s.written||i.selectionRange.focusNode!=s.node)&&(this.forceSelection=!0),this.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.children)s instanceof Ii&&s.widget instanceof Bn&&r.push(s.dom);i.updateGaps(r)}updateChildren(t,e){let i=this.childCursor(e);for(let r=t.length-1;;r--){let s=r>=0?t[r]:null;if(!s)break;let{fromA:o,toA:l,fromB:a,toB:h}=s,{content:c,breakAtStart:f,openStart:u,openEnd:d}=Jr.build(this.view.state.doc,a,h,this.decorations,this.dynamicDecorationMap),{i:p,off:b}=i.findPos(l,1),{i:y,off:v}=i.findPos(o,-1);Ca(this,y,v,p,b,c,f,u,d)}}updateSelection(t=!1,e=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,r=i==this.dom,s=!r&&kn(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(r||e||s))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.domAtPos(l.anchor),h=l.empty?a:this.domAtPos(l.head);if(I.gecko&&l.empty&&!this.compositionDeco.size&&hf(a)){let f=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(f,a.node.childNodes[a.offset]||null)),a=h=new dt(f,0),o=!0}let c=this.view.observer.selectionRange;(o||!c.focusNode||!Tn(a.node,a.offset,c.anchorNode,c.anchorOffset)||!Tn(h.node,h.offset,c.focusNode,c.focusOffset))&&(this.view.observer.ignore(()=>{I.android&&I.chrome&&this.dom.contains(c.focusNode)&&df(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=An(this.view.root);if(f)if(l.empty){if(I.gecko){let u=ff(a.node,a.offset);if(u&&u!=3){let d=Xa(a.node,a.offset,u==1?1:-1);d&&(a=new dt(d,u==1?0:d.nodeValue.length))}}f.collapse(a.node,a.offset),l.bidiLevel!=null&&c.cursorBidiLevel!=null&&(c.cursorBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(a.node,a.offset);try{f.extend(h.node,h.offset)}catch(u){}}else{let u=document.createRange();l.anchor>l.head&&([a,h]=[h,a]),u.setEnd(h.node,h.offset),u.setStart(a.node,a.offset),f.removeAllRanges(),f.addRange(u)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(a,h)),this.impreciseAnchor=a.precise?null:new dt(c.anchorNode,c.anchorOffset),this.impreciseHead=h.precise?null:new dt(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=An(t.root),{anchorNode:r,anchorOffset:s}=t.observer.selectionRange;if(!i||!e.empty||!e.assoc||!i.modify)return;let o=Tt.find(this,e.head);if(!o)return;let l=o.posAtStart;if(e.head==l||e.head==l+o.length)return;let a=this.coordsAt(e.head,-1),h=this.coordsAt(e.head,1);if(!a||!h||a.bottom>h.top)return;let c=this.domAtPos(e.head+e.assoc);i.collapse(c.node,c.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let f=t.observer.selectionRange;t.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=e.from&&i.collapse(r,s)}nearest(t){for(let e=t;e;){let i=X.get(e);if(i&&i.rootView==this)return i;e=e.parentNode}return null}posFromDOM(t,e){let i=this.nearest(t);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(t,e)+i.posAtStart}domAtPos(t){let{i:e,off:i}=this.childCursor().findPos(t,-1);for(;e<this.children.length-1;){let r=this.children[e];if(i<r.length||r instanceof Tt)break;e++,i=0}return this.children[e].domAtPos(i)}coordsAt(t,e){for(let i=this.length,r=this.children.length-1;;r--){let s=this.children[r],o=i-s.breakAfter-s.length;if(t>o||t==o&&s.type!=it.WidgetBefore&&s.type!=it.WidgetAfter&&(!r||e==2||this.children[r-1].breakAfter||this.children[r-1].type==it.WidgetBefore&&e>-2))return s.coordsAt(t-o,e);i=o}}measureVisibleLineHeights(t){let e=[],{from:i,to:r}=t,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==mt.LTR;for(let h=0,c=0;c<this.children.length;c++){let f=this.children[c],u=h+f.length;if(u>r)break;if(h>=i){let d=f.dom.getBoundingClientRect();if(e.push(d.height),o){let p=f.dom.lastChild,b=p?Di(p):[];if(b.length){let y=b[b.length-1],v=a?y.right-d.left:d.right-y.left;v>l&&(l=v,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=u)}}}h=u+f.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return getComputedStyle(this.children[e].dom).direction=="rtl"?mt.RTL:mt.LTR}measureTextSize(){for(let s of this.children)if(s instanceof Tt){let o=s.measureTextSize();if(o)return o}let t=document.createElement("div"),e,i,r;return t.className="cm-line",t.style.width="99999px",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(t);let s=Di(t.firstChild)[0];e=t.getBoundingClientRect().height,i=s?s.width/27:7,r=s?s.height:e,t.remove()}),{lineHeight:e,charWidth:i,textHeight:r}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new En(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,r=0;;r++){let s=r==e.viewports.length?null:e.viewports[r],o=s?s.from-1:this.length;if(o>i){let l=e.lineBlockAt(o).bottom-e.lineBlockAt(i).top;t.push(J.replace({widget:new Bn(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!s)break;i=s.to+1}return J.set(t)}updateDeco(){let t=this.view.state.facet(_i).map((e,i)=>(this.dynamicDecorationMap[i]=typeof e=="function")?e(this.view):e);for(let e=t.length;e<t.length+3;e++)this.dynamicDecorationMap[e]=!1;return this.decorations=[...t,this.compositionDeco,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]}scrollIntoView(t){let{range:e}=t,i=this.coordsAt(e.head,e.empty?e.assoc:e.head>e.anchor?-1:1),r;if(!i)return;!e.empty&&(r=this.coordsAt(e.anchor,e.anchor>e.head?-1:1))&&(i={left:Math.min(i.left,r.left),top:Math.min(i.top,r.top),right:Math.max(i.right,r.right),bottom:Math.max(i.bottom,r.bottom)});let s=0,o=0,l=0,a=0;for(let c of this.view.state.facet(Ua).map(f=>f(this.view)))if(c){let{left:f,right:u,top:d,bottom:p}=c;f!=null&&(s=Math.max(s,f)),u!=null&&(o=Math.max(o,u)),d!=null&&(l=Math.max(l,d)),p!=null&&(a=Math.max(a,p))}let h={left:i.left-s,top:i.top-l,right:i.right+o,bottom:i.bottom+a};jc(this.view.scrollDOM,h,e.head<e.anchor?-1:1,t.x,t.y,t.xMargin,t.yMargin,this.view.textDirection==mt.LTR)}};function hf(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}var Bn=class extends Me{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}};function qa(n){let t=n.observer.selectionRange,e=t.focusNode&&Xa(t.focusNode,t.focusOffset,0);if(!e)return null;let i=n.docView.nearest(e);if(!i)return null;if(i instanceof Tt){let r=e;for(;r.parentNode!=i.dom;)r=r.parentNode;let s=r.previousSibling;for(;s&&!X.get(s);)s=s.previousSibling;let o=s?X.get(s).posAtEnd:i.posAtStart;return{from:o,to:o,node:r,text:e}}else{for(;;){let{parent:s}=i;if(!s)return null;if(s instanceof Tt)break;i=s}let r=i.posAtStart;return{from:r,to:r+i.length,node:i.dom,text:e}}}function cf(n,t){let e=qa(n);if(!e)return J.none;let{from:i,to:r,node:s,text:o}=e,l=t.mapPos(i,1),a=Math.max(l,t.mapPos(r,-1)),{state:h}=n,c=s.nodeType==3?s.nodeValue:new In([],h).readRange(s.firstChild,null).text;if(a-l<c.length)if(h.doc.sliceString(l,Math.min(h.doc.length,l+c.length),le)==c)a=l+c.length;else if(h.doc.sliceString(Math.max(0,a-c.length),a,le)==c)l=a-c.length;else return J.none;else if(h.doc.sliceString(l,a,le)!=c)return J.none;let f=X.get(s);return f instanceof Rn?f=f.widget.topView:f&&(f.parent=null),J.set(J.replace({widget:new es(s,o,f),inclusive:!0}).range(l,a))}var es=class extends Me{constructor(t,e,i){super(),this.top=t,this.text=e,this.topView=i}eq(t){return this.top==t.top&&this.text==t.text}toDOM(){return this.top}ignoreEvent(){return!1}get customView(){return Rn}};function Xa(n,t,e){if(e<=0)for(let i=n,r=t;;){if(i.nodeType==3)return i;if(i.nodeType==1&&r>0)i=i.childNodes[r-1],r=Oi(i);else break}if(e>=0)for(let i=n,r=t;;){if(i.nodeType==3)return i;if(i.nodeType==1&&r<i.childNodes.length&&e>=0)i=i.childNodes[r],r=0;else break}return null}function ff(n,t){return n.nodeType!=1?0:(t&&n.childNodes[t-1].contentEditable=="false"?1:0)|(t<n.childNodes.length&&n.childNodes[t].contentEditable=="false"?2:0)}var is=class{constructor(){this.changes=[]}compareRange(t,e){Yr(t,e,this.changes)}comparePoint(t,e){Yr(t,e,this.changes)}};function uf(n,t,e){let i=new is;return ht.compare(n,t,e,i),i.changes}function df(n,t){for(let e=n;e&&e!=t;e=e.assignedSlot||e.parentNode)if(e.nodeType==1&&e.contentEditable=="false")return!0;return!1}function pf(n,t,e=1){let i=n.charCategorizer(t),r=n.doc.lineAt(t),s=t-r.from;if(r.length==0)return $.cursor(t);s==0?e=1:s==r.length&&(e=-1);let o=s,l=s;e<0?o=Xt(r.text,s,!1):l=Xt(r.text,s);let a=i(r.text.slice(o,l));for(;o>0;){let h=Xt(r.text,o,!1);if(i(r.text.slice(h,o))!=a)break;o=h}for(;l<r.length;){let h=Xt(r.text,l);if(i(r.text.slice(l,h))!=a)break;l=h}return $.range(o+r.from,l+r.from)}function gf(n,t){return t.left>n?t.left-n:Math.max(0,n-t.right)}function mf(n,t){return t.top>n?t.top-n:Math.max(0,n-t.bottom)}function $r(n,t){return n.top<t.bottom-1&&n.bottom>t.top+1}function ia(n,t){return t<n.top?{top:t,left:n.left,right:n.right,bottom:n.bottom}:n}function na(n,t){return t>n.bottom?{top:n.top,left:n.left,right:n.right,bottom:t}:n}function ns(n,t,e){let i,r,s,o,l=!1,a,h,c,f;for(let p=n.firstChild;p;p=p.nextSibling){let b=Di(p);for(let y=0;y<b.length;y++){let v=b[y];r&&$r(r,v)&&(v=ia(na(v,r.bottom),r.top));let N=gf(t,v),C=mf(e,v);if(N==0&&C==0)return p.nodeType==3?ra(p,t,e):ns(p,t,e);if(!i||o>C||o==C&&s>N){i=p,r=v,s=N,o=C;let O=C?e<v.top?-1:1:N?t<v.left?-1:1:0;l=!O||(O>0?y<b.length-1:y>0)}N==0?e>v.bottom&&(!c||c.bottom<v.bottom)?(a=p,c=v):e<v.top&&(!f||f.top>v.top)&&(h=p,f=v):c&&$r(c,v)?c=na(c,v.bottom):f&&$r(f,v)&&(f=ia(f,v.top))}}if(c&&c.bottom>=e?(i=a,r=c):f&&f.top<=e&&(i=h,r=f),!i)return{node:n,offset:0};let u=Math.max(r.left,Math.min(r.right,t));if(i.nodeType==3)return ra(i,u,e);if(l&&i.contentEditable!="false")return ns(i,u,e);let d=Array.prototype.indexOf.call(n.childNodes,i)+(t>=(r.left+r.right)/2?1:0);return{node:n,offset:d}}function ra(n,t,e){let i=n.nodeValue.length,r=-1,s=1e9,o=0;for(let l=0;l<i;l++){let a=Xe(n,l,l+1).getClientRects();for(let h=0;h<a.length;h++){let c=a[h];if(c.top==c.bottom)continue;o||(o=t-c.left);let f=(c.top>e?c.top-e:e-c.bottom)-1;if(c.left-1<=t&&c.right+1>=t&&f<s){let u=t>=(c.left+c.right)/2,d=u;if((I.chrome||I.gecko)&&Xe(n,l).getBoundingClientRect().left==c.right&&(d=!u),f<=0)return{node:n,offset:l+(d?1:0)};r=l+(d?1:0),s=f}}}return{node:n,offset:r>-1?r:o>0?n.nodeValue.length:0}}function Ya(n,t,e,i=-1){var r,s;let o=n.contentDOM.getBoundingClientRect(),l=o.top+n.viewState.paddingTop,a,{docHeight:h}=n.viewState,{x:c,y:f}=t,u=f-l;if(u<0)return 0;if(u>h)return n.state.doc.length;for(let O=n.defaultLineHeight/2,k=!1;a=n.elementAtHeight(u),a.type!=it.Text;)for(;u=i>0?a.bottom+O:a.top-O,!(u>=0&&u<=h);){if(k)return e?null:0;k=!0,i=-i}f=l+u;let d=a.from;if(d<n.viewport.from)return n.viewport.from==0?0:e?null:sa(n,o,a,c,f);if(d>n.viewport.to)return n.viewport.to==n.state.doc.length?n.state.doc.length:e?null:sa(n,o,a,c,f);let p=n.dom.ownerDocument,b=n.root.elementFromPoint?n.root:p,y=b.elementFromPoint(c,f);y&&!n.contentDOM.contains(y)&&(y=null),y||(c=Math.max(o.left+1,Math.min(o.right-1,c)),y=b.elementFromPoint(c,f),y&&!n.contentDOM.contains(y)&&(y=null));let v,N=-1;if(y&&((r=n.docView.nearest(y))===null||r===void 0?void 0:r.isEditable)!=!1){if(p.caretPositionFromPoint){let O=p.caretPositionFromPoint(c,f);O&&({offsetNode:v,offset:N}=O)}else if(p.caretRangeFromPoint){let O=p.caretRangeFromPoint(c,f);O&&({startContainer:v,startOffset:N}=O,(!n.contentDOM.contains(v)||I.safari&&yf(v,N,c)||I.chrome&&bf(v,N,c))&&(v=void 0))}}if(!v||!n.docView.dom.contains(v)){let O=Tt.find(n.docView,d);if(!O)return u>a.top+a.height/2?a.to:a.from;({node:v,offset:N}=ns(O.dom,c,f))}let C=n.docView.nearest(v);if(!C)return null;if(C.isWidget&&((s=C.dom)===null||s===void 0?void 0:s.nodeType)==1){let O=C.dom.getBoundingClientRect();return t.y<O.top||t.y<=O.bottom&&t.x<=(O.left+O.right)/2?C.posAtStart:C.posAtEnd}else return C.localPosFromDOM(v,N)+C.posAtStart}function sa(n,t,e,i,r){let s=Math.round((i-t.left)*n.defaultCharacterWidth);if(n.lineWrapping&&e.height>n.defaultLineHeight*1.5){let l=Math.floor((r-e.top)/n.defaultLineHeight);s+=l*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(e.from,e.to);return e.from+Ul(o,s,n.state.tabSize)}function yf(n,t,e){let i;if(n.nodeType!=3||t!=(i=n.nodeValue.length))return!1;for(let r=n.nextSibling;r;r=r.nextSibling)if(r.nodeType!=1||r.nodeName!="BR")return!1;return Xe(n,i-1,i).getBoundingClientRect().left>e}function bf(n,t,e){if(t!=0)return!1;for(let r=n;;){let s=r.parentNode;if(!s||s.nodeType!=1||s.firstChild!=r)return!1;if(s.classList.contains("cm-line"))break;r=s}let i=n.nodeType==1?n.getBoundingClientRect():Xe(n,0,Math.max(n.nodeValue.length,1)).getBoundingClientRect();return e-i.left>5}function wf(n,t,e,i){let r=n.state.doc.lineAt(t.head),s=!i||!n.lineWrapping?null:n.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head);if(s){let a=n.dom.getBoundingClientRect(),h=n.textDirectionAt(r.from),c=n.posAtCoords({x:e==(h==mt.LTR)?a.right-1:a.left+1,y:(s.top+s.bottom)/2});if(c!=null)return $.cursor(c,e?-1:1)}let o=Tt.find(n.docView,t.head),l=o?e?o.posAtEnd:o.posAtStart:e?r.to:r.from;return $.cursor(l,e?-1:1)}function oa(n,t,e,i){let r=n.state.doc.lineAt(t.head),s=n.bidiSpans(r),o=n.textDirectionAt(r.from);for(let l=t,a=null;;){let h=af(r,s,o,l,e),c=Ka;if(!h){if(r.number==(e?n.state.doc.lines:1))return l;c=`\n`,r=n.state.doc.line(r.number+(e?1:-1)),s=n.bidiSpans(r),h=$.cursor(e?r.from:r.to)}if(a){if(!a(c))return l}else{if(!i)return h;a=i(c)}l=h}}function vf(n,t,e){let i=n.state.charCategorizer(t),r=i(e);return s=>{let o=i(s);return r==Bt.Space&&(r=o),r==o}}function Sf(n,t,e,i){let r=t.head,s=e?1:-1;if(r==(e?n.state.doc.length:0))return $.cursor(r,t.assoc);let o=t.goalColumn,l,a=n.contentDOM.getBoundingClientRect(),h=n.coordsAtPos(r),c=n.documentTop;if(h)o==null&&(o=h.left-a.left),l=s<0?h.top:h.bottom;else{let d=n.viewState.lineBlockAt(r);o==null&&(o=Math.min(a.right-a.left,n.defaultCharacterWidth*(r-d.from))),l=(s<0?d.top:d.bottom)+c}let f=a.left+o,u=i!=null?i:n.defaultLineHeight>>1;for(let d=0;;d+=10){let p=l+(u+d)*s,b=Ya(n,{x:f,y:p},!1,s);if(p<a.top||p>a.bottom||(s<0?b<r:b>r))return $.cursor(b,t.assoc,void 0,o)}}function Hr(n,t,e){let i=n.state.facet(za).map(r=>r(n));for(;;){let r=!1;for(let s of i)s.between(e.from-1,e.from+1,(o,l,a)=>{e.from>o&&e.from<l&&(e=t.head>e.from?$.cursor(o,1):$.cursor(l,-1),r=!0)});if(!r)return e}}var rs=class{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(i,r)=>{this.ignoreDuringComposition(r)||r.type=="keydown"&&this.keydown(t,r)||(this.mustFlushObserver(r)&&t.observer.forceFlush(),this.runCustomHandlers(r.type,t,r)?r.preventDefault():i(t,r))};for(let i in rt){let r=rt[i];t.contentDOM.addEventListener(i,s=>{la(t,s)&&e(r,s)},os[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(rt.mousedown,i),!i.defaultPrevented&&i.button==2)){let r=t.contentDOM.style.minHeight;t.contentDOM.style.minHeight="100%",setTimeout(()=>t.contentDOM.style.minHeight=r,200)}}),I.chrome&&I.chrome_version==102&&t.scrollDOM.addEventListener("wheel",()=>{this.chromeScrollHack<0?t.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout(()=>{this.chromeScrollHack=-1,t.contentDOM.style.pointerEvents=""},100)},{passive:!0}),this.notifiedFocused=t.hasFocus,I.safari&&t.contentDOM.addEventListener("input",()=>null)}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}ensureHandlers(t,e){var i;let r;this.customHandlers=[];for(let s of e)if(r=(i=s.update(t).spec)===null||i===void 0?void 0:i.domEventHandlers){this.customHandlers.push({plugin:s.value,handlers:r});for(let o in r)this.registeredEvents.indexOf(o)<0&&o!="scroll"&&(this.registeredEvents.push(o),t.contentDOM.addEventListener(o,l=>{la(t,l)&&this.runCustomHandlers(o,t,l)&&l.preventDefault()}))}}runCustomHandlers(t,e,i){for(let r of this.customHandlers){let s=r.handlers[t];if(s)try{if(s.call(r.plugin,i,e)||i.defaultPrevented)return!0}catch(o){te(e.state,o)}}return!1}runScrollHandlers(t,e){this.lastScrollTop=t.scrollDOM.scrollTop,this.lastScrollLeft=t.scrollDOM.scrollLeft;for(let i of this.customHandlers){let r=i.handlers.scroll;if(r)try{r.call(i.plugin,e,t)}catch(s){te(t.state,s)}}}keydown(t,e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&Date.now()<this.lastEscPress+2e3)return!0;if(I.android&&I.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return t.observer.delayAndroidKey(e.key,e.keyCode),!0;let i;return I.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((i=Ja.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||xf.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=i||e,setTimeout(()=>this.flushIOSKey(t),250),!0):!1}flushIOSKey(t){let e=this.pendingIOSKey;return e?(this.pendingIOSKey=void 0,Ke(t.contentDOM,e.key,e.keyCode)):!1}ignoreDuringComposition(t){return/^key/.test(t.type)?this.composing>0?!0:I.safari&&!I.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}mustFlushObserver(t){return t.type=="keydown"&&t.keyCode!=229}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}},Ja=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xf="dthko",kf=[16,17,18,20,91,92,224,225],bn=6;function wn(n){return Math.max(0,n)*.7+8}var ss=class{constructor(t,e,i,r){this.view=t,this.style=i,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=Gc(t.contentDOM);let s=t.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(Q.allowMultipleSelections)&&Cf(t,e),this.dragMove=Af(t,e),this.dragging=Tf(t,e)&&eh(e)==1?null:!1}start(t){this.dragging===!1&&(t.preventDefault(),this.select(t))}move(t){var e;if(t.buttons==0)return this.destroy();if(this.dragging!==!1)return;this.select(this.lastEvent=t);let i=0,r=0,s=((e=this.scrollParent)===null||e===void 0?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+bn?i=-wn(s.left-t.clientX):t.clientX>=s.right-bn&&(i=wn(t.clientX-s.right)),t.clientY<=s.top+bn?r=-wn(s.top-t.clientY):t.clientY>=s.bottom-bn&&(r=wn(t.clientY-s.bottom)),this.setScrollSpeed(i,r)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}select(t){let e=this.style.get(t,this.extend,this.multiple);(this.mustSelect||!e.eq(this.view.state.selection)||e.main.assoc!=this.view.state.selection.main.assoc)&&this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}};function Cf(n,t){let e=n.state.facet(_a);return e.length?e[0](t):I.mac?t.metaKey:t.ctrlKey}function Af(n,t){let e=n.state.facet(La);return e.length?e[0](t):I.mac?!t.altKey:!t.ctrlKey}function Tf(n,t){let{main:e}=n.state.selection;if(e.empty)return!1;let i=An(n.root);if(!i||i.rangeCount==0)return!0;let r=i.getRangeAt(0).getClientRects();for(let s=0;s<r.length;s++){let o=r[s];if(o.left<=t.clientX&&o.right>=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function la(n,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target,i;e!=n.contentDOM;e=e.parentNode)if(!e||e.nodeType==11||(i=X.get(e))&&i.ignoreEvent(t))return!1;return!0}var rt=Object.create(null),os=Object.create(null),Za=I.ie&&I.ie_version<15||I.ios&&I.webkit_version<604;function Mf(n){let t=n.dom.parentNode;if(!t)return;let e=t.appendChild(document.createElement("textarea"));e.style.cssText="position: fixed; left: -10000px; top: 10px",e.focus(),setTimeout(()=>{n.focus(),e.remove(),Qa(n,e.value)},50)}function Qa(n,t){let{state:e}=n,i,r=1,s=e.toText(t),o=s.lines==e.selection.ranges.length;if(ls!=null&&e.selection.ranges.every(a=>a.empty)&&ls==s.toString()){let a=-1;i=e.changeByRange(h=>{let c=e.doc.lineAt(h.from);if(c.from==a)return{range:h};a=c.from;let f=e.toText((o?s.line(r++).text:t)+e.lineBreak);return{changes:{from:c.from,insert:f},range:$.cursor(h.from+f.length)}})}else o?i=e.changeByRange(a=>{let h=s.line(r++);return{changes:{from:a.from,to:a.to,insert:h.text},range:$.cursor(a.from+h.length)}}):i=e.replaceSelection(s);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}rt.keydown=(n,t)=>{n.inputState.setSelectionOrigin("select"),t.keyCode==27?n.inputState.lastEscPress=Date.now():kf.indexOf(t.keyCode)<0&&(n.inputState.lastEscPress=0)};rt.touchstart=(n,t)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};rt.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};os.touchstart=os.touchmove={passive:!0};rt.mousedown=(n,t)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return;let e=null;for(let i of n.state.facet(Ba))if(e=i(n,t),e)break;if(!e&&t.button==0&&(e=Df(n,t)),e){let i=n.root.activeElement!=n.contentDOM;n.inputState.startMouseSelection(new ss(n,t,e,i)),i&&n.observer.ignore(()=>xa(n.contentDOM)),n.inputState.mouseSelection&&n.inputState.mouseSelection.start(t)}};function aa(n,t,e,i){if(i==1)return $.cursor(t,e);if(i==2)return pf(n.state,t,e);{let r=Tt.find(n.docView,t),s=n.state.doc.lineAt(r?r.posAtEnd:t),o=r?r.posAtStart:s.from,l=r?r.posAtEnd:s.to;return l<n.state.doc.length&&l==s.to&&l++,$.range(o,l)}}var th=(n,t)=>n>=t.top&&n<=t.bottom,ha=(n,t,e)=>th(t,e)&&n>=e.left&&n<=e.right;function Ef(n,t,e,i){let r=Tt.find(n.docView,t);if(!r)return 1;let s=t-r.posAtStart;if(s==0)return 1;if(s==r.length)return-1;let o=r.coordsAt(s,-1);if(o&&ha(e,i,o))return-1;let l=r.coordsAt(s,1);return l&&ha(e,i,l)?1:o&&th(i,o)?-1:1}function ca(n,t){let e=n.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:e,bias:Ef(n,e,t.clientX,t.clientY)}}var Rf=I.ie&&I.ie_version<=11,fa=null,ua=0,da=0;function eh(n){if(!Rf)return n.detail;let t=fa,e=da;return fa=n,da=Date.now(),ua=!t||e>Date.now()-400&&Math.abs(t.clientX-n.clientX)<2&&Math.abs(t.clientY-n.clientY)<2?(ua+1)%3:1}function Df(n,t){let e=ca(n,t),i=eh(t),r=n.state.selection;return{update(s){s.docChanged&&(e.pos=s.changes.mapPos(e.pos),r=r.map(s.changes))},get(s,o,l){let a=ca(n,s),h,c=aa(n,a.pos,a.bias,i);if(e.pos!=a.pos&&!o){let f=aa(n,e.pos,e.bias,i),u=Math.min(f.from,c.from),d=Math.max(f.to,c.to);c=u<c.from?$.range(u,d):$.range(d,u)}return o?r.replaceRange(r.main.extend(c.from,c.to)):l&&i==1&&r.ranges.length>1&&(h=Of(r,a.pos))?h:l?r.addRange(c):$.create([c])}}}function Of(n,t){for(let e=0;e<n.ranges.length;e++){let{from:i,to:r}=n.ranges[e];if(i<=t&&r>=t)return $.create(n.ranges.slice(0,e).concat(n.ranges.slice(e+1)),n.mainIndex==e?0:n.mainIndex-(n.mainIndex>e?1:0))}return null}rt.dragstart=(n,t)=>{let{selection:{main:e}}=n.state,{mouseSelection:i}=n.inputState;i&&(i.dragging=e),t.dataTransfer&&(t.dataTransfer.setData("Text",n.state.sliceDoc(e.from,e.to)),t.dataTransfer.effectAllowed="copyMove")};function pa(n,t,e,i){if(!e)return;let r=n.posAtCoords({x:t.clientX,y:t.clientY},!1);t.preventDefault();let{mouseSelection:s}=n.inputState,o=i&&s&&s.dragging&&s.dragMove?{from:s.dragging.from,to:s.dragging.to}:null,l={from:r,insert:e},a=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:a,selection:{anchor:a.mapPos(r,-1),head:a.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"})}rt.drop=(n,t)=>{if(!t.dataTransfer)return;if(n.state.readOnly)return t.preventDefault();let e=t.dataTransfer.files;if(e&&e.length){t.preventDefault();let i=Array(e.length),r=0,s=()=>{++r==e.length&&pa(n,t,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o<e.length;o++){let l=new FileReader;l.onerror=s,l.onload=()=>{/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(l.result)||(i[o]=l.result),s()},l.readAsText(e[o])}}else pa(n,t,t.dataTransfer.getData("Text"),!0)};rt.paste=(n,t)=>{if(n.state.readOnly)return t.preventDefault();n.observer.flush();let e=Za?null:t.clipboardData;e?(Qa(n,e.getData("text/plain")||e.getData("text/uri-text")),t.preventDefault()):Mf(n)};function Nf(n,t){let e=n.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function Pf(n){let t=[],e=[],i=!1;for(let r of n.selection.ranges)r.empty||(t.push(n.sliceDoc(r.from,r.to)),e.push(r));if(!t.length){let r=-1;for(let{from:s}of n.selection.ranges){let o=n.doc.lineAt(s);o.number>r&&(t.push(o.text),e.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),r=o.number}i=!0}return{text:t.join(n.lineBreak),ranges:e,linewise:i}}var ls=null;rt.copy=rt.cut=(n,t)=>{let{text:e,ranges:i,linewise:r}=Pf(n.state);if(!e&&!r)return;ls=r?e:null;let s=Za?null:t.clipboardData;s?(t.preventDefault(),s.clearData(),s.setData("text/plain",e)):Nf(n,e),t.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"})};var ih=Jt.define();function nh(n,t){let e=[];for(let i of n.facet(Ha)){let r=i(n,t);r&&e.push(r)}return e?n.update({effects:e,annotations:ih.of(!0)}):null}function rh(n){setTimeout(()=>{let t=n.hasFocus;if(t!=n.inputState.notifiedFocused){let e=nh(n.state,t);e?n.dispatch(e):n.update([])}},10)}rt.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),rh(n)};rt.blur=n=>{n.observer.clearSelectionRange(),rh(n)};rt.compositionstart=rt.compositionupdate=n=>{n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0)};rt.compositionend=n=>{n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,I.chrome&&I.android&&n.observer.flushSoon(),setTimeout(()=>{n.inputState.composing<0&&n.docView.compositionDeco.size&&n.update([])},50)};rt.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};rt.beforeinput=(n,t)=>{var e;let i;if(I.chrome&&I.android&&(i=Ja.find(r=>r.inputType==t.inputType))&&(n.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let r=((e=window.visualViewport)===null||e===void 0?void 0:e.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>r+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}};var ga=["pre-wrap","normal","pre-line","break-spaces"],as=class{constructor(t){this.lineWrapping=t,this.doc=U.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(t,e){let i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return ga.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i<t.length;i++){let r=t[i];r<0?i++:this.heightSamples[Math.floor(r*10)]||(e=!0,this.heightSamples[Math.floor(r*10)]=!0)}return e}refresh(t,e,i,r,s,o){let l=ga.indexOf(t)>-1,a=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=e,this.charWidth=i,this.textHeight=r,this.lineLength=s,a){this.heightSamples={};for(let h=0;h<o.length;h++){let c=o[h];c<0?h++:this.heightSamples[Math.floor(c*10)]=!0}}return a}},hs=class{constructor(t,e){this.from=t,this.heights=e,this.index=0}get more(){return this.index<this.heights.length}},Qt=class n{constructor(t,e,i,r,s){this.from=t,this.length=e,this.top=i,this.height=r,this.type=s}get to(){return this.from+this.length}get bottom(){return this.top+this.height}join(t){let e=(Array.isArray(this.type)?this.type:[this]).concat(Array.isArray(t.type)?t.type:[t]);return new n(this.from,this.length+t.length,this.top,this.height+t.height,e)}},q=function(n){return n[n.ByPos=0]="ByPos",n[n.ByHeight=1]="ByHeight",n[n.ByPosNoHeight=2]="ByPosNoHeight",n}(q||(q={})),Cn=.001,Mt=class n{constructor(t,e,i=2){this.length=t,this.height=e,this.flags=i}get outdated(){return(this.flags&2)>0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>Cn&&(t.heightChanged=!0),this.height=e)}replace(t,e,i){return n.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,r){let s=this,o=i.doc;for(let l=r.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:c,toB:f}=r[l],u=s.lineAt(a,q.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=h?u:s.lineAt(h,q.ByPosNoHeight,i,0,0);for(f+=d.to-h,h=d.to;l>0&&u.from<=r[l-1].toA;)a=r[l-1].fromA,c=r[l-1].fromB,l--,a<u.from&&(u=s.lineAt(a,q.ByPosNoHeight,i,0,0));c+=u.from-a,a=u.from;let p=fs.build(i.setDoc(o),t,c,f);s=s.replace(a,h,p)}return s.updateHeight(i,0)}static empty(){return new Dt(0,0)}static of(t){if(t.length==1)return t[0];let e=0,i=t.length,r=0,s=0;for(;;)if(e==i)if(r>s*2){let l=t[e-1];l.break?t.splice(--e,1,l.left,null,l.right):t.splice(--e,1,l.left,l.right),i+=1+l.break,r-=l.size}else if(s>r*2){let l=t[i];l.break?t.splice(i,1,l.left,null,l.right):t.splice(i,1,l.left,l.right),i+=2+l.break,s-=l.size}else break;else if(r<s){let l=t[e++];l&&(r+=l.size)}else{let l=t[--i];l&&(s+=l.size)}let o=0;return t[e-1]==null?(o=1,e--):t[e]==null&&(o=1,i++),new cs(n.of(t.slice(0,e)),o,n.of(t.slice(i)))}};Mt.prototype.size=1;var Fn=class extends Mt{constructor(t,e,i){super(t,e),this.type=i}blockAt(t,e,i,r){return new Qt(r,this.length,i,this.height,this.type)}lineAt(t,e,i,r,s){return this.blockAt(0,i,r,s)}forEachLine(t,e,i,r,s,o){t<=s+this.length&&e>=s&&o(this.blockAt(0,i,r,s))}updateHeight(t,e=0,i=!1,r){return r&&r.from<=e&&r.more&&this.setHeight(t,r.heights[r.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}},Dt=class n extends Fn{constructor(t,e){super(t,e,it.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let r=i[0];return i.length==1&&(r instanceof n||r instanceof ce&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof ce?r=new n(r.length,this.height):r.height=this.height,this.outdated||(r.outdated=!1),r):Mt.of(i)}updateHeight(t,e=0,i=!1,r){return r&&r.from<=e&&r.more?this.setHeight(t,r.heights[r.index++]):(i||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}},ce=class n extends Mt{constructor(t){super(t,0)}heightMetrics(t,e){let i=t.doc.lineAt(e).number,r=t.doc.lineAt(e+this.length).number,s=r-i+1,o,l=0;if(t.lineWrapping){let a=Math.min(this.height,t.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:i,lastLine:r,perLine:o,perChar:l}}blockAt(t,e,i,r){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(e,r);if(e.lineWrapping){let h=r+Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length),c=e.doc.lineAt(h),f=l+c.length*a,u=Math.max(i,t-f/2);return new Qt(c.from,c.length,u,f,it.Text)}else{let h=Math.max(0,Math.min(o-s,Math.floor((t-i)/l))),{from:c,length:f}=e.doc.line(s+h);return new Qt(c,f,i+l*h,l,it.Text)}}lineAt(t,e,i,r,s){if(e==q.ByHeight)return this.blockAt(t,i,r,s);if(e==q.ByPosNoHeight){let{from:d,to:p}=i.doc.lineAt(t);return new Qt(d,p-d,0,0,it.Text)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(i,s),h=i.doc.lineAt(t),c=l+h.length*a,f=h.number-o,u=r+l*f+a*(h.from-s-f);return new Qt(h.from,h.length,Math.max(r,Math.min(u,r+this.height-c)),c,it.Text)}forEachLine(t,e,i,r,s,o){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:l,perLine:a,perChar:h}=this.heightMetrics(i,s);for(let c=t,f=r;c<=e;){let u=i.doc.lineAt(c);if(c==t){let p=u.number-l;f+=a*p+h*(t-s-p)}let d=a+h*u.length;o(new Qt(u.from,u.length,f,d,it.Text)),f+=d,c=u.to+1}}replace(t,e,i){let r=this.length-e;if(r>0){let s=i[i.length-1];s instanceof n?i[i.length-1]=new n(s.length+r):i.push(null,new n(r-1))}if(t>0){let s=i[0];s instanceof n?i[0]=new n(t+s.length):i.unshift(new n(t-1),null)}return Mt.of(i)}decomposeLeft(t,e){e.push(new n(t-1),null)}decomposeRight(t,e){e.push(null,new n(this.length-t-1))}updateHeight(t,e=0,i=!1,r){let s=e+this.length;if(r&&r.from<=e+this.length&&r.more){let o=[],l=Math.max(e,r.from),a=-1;for(r.from>e&&o.push(new n(r.from-e-1).updateHeight(t,e));l<=s&&r.more;){let c=t.doc.lineAt(l).length;o.length&&o.push(null);let f=r.heights[r.index++];a==-1?a=f:Math.abs(f-a)>=Cn&&(a=-2);let u=new Dt(c,f);u.outdated=!1,o.push(u),l+=c+1}l<=s&&o.push(null,new n(s-l).updateHeight(t,l));let h=Mt.of(o);return(a<0||Math.abs(h.height-this.height)>=Cn||Math.abs(a-this.heightMetrics(t,e).perLine)>=Cn)&&(t.heightChanged=!0),h}else(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},cs=class extends Mt{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return this.flags&1}blockAt(t,e,i,r){let s=i+this.left.height;return t<s?this.left.blockAt(t,e,i,r):this.right.blockAt(t,e,s,r+this.left.length+this.break)}lineAt(t,e,i,r,s){let o=r+this.left.height,l=s+this.left.length+this.break,a=e==q.ByHeight?t<o:t<l,h=a?this.left.lineAt(t,e,i,r,s):this.right.lineAt(t,e,i,o,l);if(this.break||(a?h.to<l:h.from>l))return h;let c=e==q.ByPosNoHeight?q.ByPosNoHeight:q.ByPos;return a?h.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,r,s).join(h)}forEachLine(t,e,i,r,s,o){let l=r+this.left.height,a=s+this.left.length+this.break;if(this.break)t<a&&this.left.forEachLine(t,e,i,r,s,o),e>=a&&this.right.forEachLine(t,e,i,l,a,o);else{let h=this.lineAt(a,q.ByPos,i,r,s);t<h.from&&this.left.forEachLine(t,h.from-1,i,r,s,o),h.to>=t&&h.from<=e&&o(h),e>h.to&&this.right.forEachLine(h.to+1,e,i,l,a,o)}}replace(t,e,i){let r=this.left.length+this.break;if(e<r)return this.balanced(this.left.replace(t,e,i),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-r,e-r,i));let s=[];t>0&&this.decomposeLeft(t,s);let o=s.length;for(let l of i)s.push(l);if(t>0&&ma(s,o-1),e<this.length){let l=s.length;this.decomposeRight(e,s),ma(s,l)}return Mt.of(s)}decomposeLeft(t,e){let i=this.left.length;if(t<=i)return this.left.decomposeLeft(t,e);e.push(this.left),this.break&&(i++,t>=i&&e.push(null)),t>i&&this.right.decomposeLeft(t-i,e)}decomposeRight(t,e){let i=this.left.length,r=i+this.break;if(t>=r)return this.right.decomposeRight(t-r,e);t<i&&this.left.decomposeRight(t,e),this.break&&t<r&&e.push(null),e.push(this.right)}balanced(t,e){return t.size>2*e.size||e.size>2*t.size?Mt.of(this.break?[t,null,e]:[t,e]):(this.left=t,this.right=e,this.height=t.height+e.height,this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,i=!1,r){let{left:s,right:o}=this,l=e+s.length+this.break,a=null;return r&&r.from<=e+s.length&&r.more?a=s=s.updateHeight(t,e,i,r):s.updateHeight(t,e,i),r&&r.from<=l+o.length&&r.more?a=o=o.updateHeight(t,l,i,r):o.updateHeight(t,l,i),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}};function ma(n,t){let e,i;n[t]==null&&(e=n[t-1])instanceof ce&&(i=n[t+1])instanceof ce&&n.splice(t-1,3,new ce(e.length+1+i.length))}var If=5,fs=class n{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let i=Math.min(e,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof Dt?r.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Dt(i-this.pos,-1)),this.writtenTo=i,e>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,i){if(t<e||i.heightRelevant){let r=i.widget?i.widget.estimatedHeight:0;r<0&&(r=this.oracle.lineHeight);let s=e-t;i.block?this.addBlock(new Fn(s,r,i.type)):(s||r>=If)&&this.addLineDeco(r,s)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTo<t&&((this.writtenTo<t-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new Dt(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new ce(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Dt)return t;let e=new Dt(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type==it.WidgetAfter&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=it.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(e instanceof Dt)&&!this.isCovered?this.nodes.push(new Dt(0,-1)):(this.writtenTo<this.pos||e==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=t;for(let r of this.nodes)r instanceof Dt&&r.updateHeight(this.oracle,i),i+=r?r.length:1;return this.nodes}static build(t,e,i,r){let s=new n(i,t);return ht.spans(e,i,r,s,0),s.finish(i)}};function _f(n,t,e){let i=new us;return ht.compare(n,t,e,i,0),i.changes}var us=class{constructor(){this.changes=[]}compareRange(){}comparePoint(t,e,i,r){(t<e||i&&i.heightRelevant||r&&r.heightRelevant)&&Yr(t,e,this.changes,5)}};function Lf(n,t){let e=n.getBoundingClientRect(),i=n.ownerDocument,r=i.defaultView||window,s=Math.max(0,e.left),o=Math.min(r.innerWidth,e.right),l=Math.max(0,e.top),a=Math.min(r.innerHeight,e.bottom);for(let h=n.parentNode;h&&h!=i.body;)if(h.nodeType==1){let c=h,f=window.getComputedStyle(c);if((c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let u=c.getBoundingClientRect();s=Math.max(s,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=h==n.parentNode?u.bottom:Math.min(a,u.bottom)}h=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:s-e.left,right:Math.max(s,o)-e.left,top:l-(e.top+t),bottom:Math.max(l,a)-(e.top+t)}}function Bf(n,t){let e=n.getBoundingClientRect();return{left:0,right:e.right-e.left,top:t,bottom:e.bottom-(e.top+t)}}var Ri=class{constructor(t,e,i){this.from=t,this.to=e,this.size=i}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let r=t[i],s=e[i];if(r.from!=s.from||r.to!=s.to||r.size!=s.size)return!1}return!0}draw(t){return J.replace({widget:new ds(this.size,t)}).range(this.from,this.to)}},ds=class extends Me{constructor(t,e){super(),this.size=t,this.vertical=e}eq(t){return t.size==this.size&&t.vertical==this.vertical}toDOM(){let t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t}get estimatedHeight(){return this.vertical?this.size:-1}},$n=class{constructor(t){this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaler=ya,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=mt.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let e=t.facet(ks).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new as(e),this.stateDeco=t.facet(_i).filter(i=>typeof i!="function"),this.heightMap=Mt.empty().applyChanges(this.stateDeco,U.empty,this.heightOracle.setDoc(t.doc),[new ae(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=J.set(this.lineGaps.map(i=>i.draw(!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let r=i?e.head:e.anchor;if(!t.some(({from:s,to:o})=>r>=s&&r<=o)){let{from:s,to:o}=this.lineBlockAt(r);t.push(new Ge(s,o))}}this.viewports=t.sort((i,r)=>i.from-r.from),this.scaler=this.heightMap.height<=7e6?ya:new ps(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(this.scaler.scale==1?t:Mi(t,this.scaler))})}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(_i).filter(h=>typeof h!="function");let r=t.changedRanges,s=ae.extendWithRanges(r,_f(i,this.stateDeco,t?t.changes:Ct.empty(this.state.doc.length))),o=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=o&&(t.flags|=2);let l=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<l.from||e.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,e));let a=!t.changes.empty||t.flags&2||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),a&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(Qc)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,i=window.getComputedStyle(e),r=this.heightOracle,s=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?mt.RTL:mt.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),l=e.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,c=0,f=parseInt(i.paddingTop)||0,u=parseInt(i.paddingBottom)||0;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,h|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(r.lineWrapping&&(a=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=8);let d=(this.printing?Bf:Lf)(e,this.paddingTop),p=d.top-this.pixelViewport.top,b=d.bottom-this.pixelViewport.bottom;this.pixelViewport=d;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let v=l.width;if((this.contentDOMWidth!=v||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,h|=8),a){let C=t.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(C)&&(o=!0),o||r.lineWrapping&&Math.abs(v-this.contentDOMWidth)>r.charWidth){let{lineHeight:O,charWidth:k,textHeight:T}=t.docView.measureTextSize();o=O>0&&r.refresh(s,O,k,T,v/k,C),o&&(t.docView.minWidth=0,h|=8)}p>0&&b>0?c=Math.max(p,b):p<0&&b<0&&(c=Math.min(p,b)),r.heightChanged=!1;for(let O of this.viewports){let k=O.from==this.viewport.from?C:t.docView.measureVisibleLineHeights(O);this.heightMap=(o?Mt.empty().applyChanges(this.stateDeco,U.empty,this.heightOracle,[new ae(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new hs(O.from,k))}r.heightChanged&&(h|=2)}let N=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return N&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(h&2||N)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),r=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new Ge(r.lineAt(o-i*1e3,q.ByHeight,s,0,0).from,r.lineAt(l+(1-i)*1e3,q.ByHeight,s,0,0).to);if(e){let{head:h}=e.range;if(h<a.from||h>a.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=r.lineAt(h,q.ByPos,s,0,0),u;e.y=="center"?u=(f.top+f.bottom)/2-c/2:e.y=="start"||e.y=="nearest"&&h<a.from?u=f.top:u=f.bottom-c,a=new Ge(r.lineAt(u-1e3/2,q.ByHeight,s,0,0).from,r.lineAt(u+c+1e3/2,q.ByHeight,s,0,0).to)}}return a}mapViewport(t,e){let i=e.mapPos(t.from,-1),r=e.mapPos(t.to,1);return new Ge(this.heightMap.lineAt(i,q.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,q.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:e},i=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(t,q.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(e,q.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(t==0||r<=o-Math.max(10,Math.min(-i,250)))&&(e==this.state.doc.length||s>=l+Math.max(10,Math.min(i,250)))&&r>o-2*1e3&&s<l+2*1e3}mapLineGaps(t,e){if(!t.length||e.empty)return t;let i=[];for(let r of t)e.touchesRange(r.from,r.to)||i.push(new Ri(e.mapPos(r.from),e.mapPos(r.to),r.size));return i}ensureLineGaps(t,e){let i=this.heightOracle.lineWrapping,r=i?1e4:2e3,s=r>>1,o=r<<1;if(this.defaultTextDirection!=mt.LTR&&!i)return[];let l=[],a=(h,c,f,u)=>{if(c-h<s)return;let d=this.state.selection.main,p=[d.from];d.empty||p.push(d.to);for(let y of p)if(y>h&&y<c){a(h,y-10,f,u),a(y+10,c,f,u);return}let b=$f(t,y=>y.from>=f.from&&y.to<=f.to&&Math.abs(y.from-h)<s&&Math.abs(y.to-c)<s&&!p.some(v=>y.from<v&&y.to>v));if(!b){if(c<f.to&&e&&i&&e.visibleRanges.some(y=>y.from<=c&&y.to>=c)){let y=e.moveToLineBoundary($.cursor(c),!1,!0).head;y>h&&(c=y)}b=new Ri(h,c,this.gapSize(f,h,c,u))}l.push(b)};for(let h of this.viewportLines){if(h.length<o)continue;let c=Ff(h.from,h.to,this.stateDeco);if(c.total<o)continue;let f=this.scrollTarget?this.scrollTarget.range.head:null,u,d;if(i){let p=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,b,y;if(f!=null){let v=Sn(c,f),N=((this.visibleBottom-this.visibleTop)/2+p)/h.height;b=v-N,y=v+N}else b=(this.visibleTop-h.top-p)/h.height,y=(this.visibleBottom-h.top+p)/h.height;u=vn(c,b),d=vn(c,y)}else{let p=c.total*this.heightOracle.charWidth,b=r*this.heightOracle.charWidth,y,v;if(f!=null){let N=Sn(c,f),C=((this.pixelViewport.right-this.pixelViewport.left)/2+b)/p;y=N-C,v=N+C}else y=(this.pixelViewport.left-b)/p,v=(this.pixelViewport.right+b)/p;u=vn(c,y),d=vn(c,v)}u>h.from&&a(h.from,u,h,c),d<h.to&&a(d,h.to,h,c)}return l}gapSize(t,e,i,r){let s=Sn(r,i)-Sn(r,e);return this.heightOracle.lineWrapping?t.height*s:r.total*this.heightOracle.charWidth*s}updateLineGaps(t){Ri.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=J.set(t.map(e=>e.draw(this.heightOracle.lineWrapping))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];ht.spans(t,this.viewport.from,this.viewport.to,{span(r,s){e.push({from:r,to:s})},point(){}},20);let i=e.length!=this.visibleRanges.length||this.visibleRanges.some((r,s)=>r.from!=e[s].from||r.to!=e[s].to);return this.visibleRanges=e,i?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||Mi(this.heightMap.lineAt(t,q.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return Mi(this.heightMap.lineAt(this.scaler.fromDOM(t),q.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return Mi(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},Ge=class{constructor(t,e){this.from=t,this.to=e}};function Ff(n,t,e){let i=[],r=n,s=0;return ht.spans(e,n,t,{span(){},point(o,l){o>r&&(i.push({from:r,to:o}),s+=o-r),r=l}},20),r<t&&(i.push({from:r,to:t}),s+=t-r),{total:s,ranges:i}}function vn({total:n,ranges:t},e){if(e<=0)return t[0].from;if(e>=1)return t[t.length-1].to;let i=Math.floor(n*e);for(let r=0;;r++){let{from:s,to:o}=t[r],l=o-s;if(i<=l)return s+i;i-=l}}function Sn(n,t){let e=0;for(let{from:i,to:r}of n.ranges){if(t<=r){e+=t-i;break}e+=r-i}return e/n.total}function $f(n,t){for(let e of n)if(t(e))return e}var ya={toDOM(n){return n},fromDOM(n){return n},scale:1},ps=class{constructor(t,e,i){let r=0,s=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=e.lineAt(l,q.ByPos,t,0,0).top,c=e.lineAt(a,q.ByPos,t,0,0).bottom;return r+=c-h,{from:l,to:a,top:h,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(e.height-r);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(t){for(let e=0,i=0,r=0;;e++){let s=e<this.viewports.length?this.viewports[e]:null;if(!s||t<s.top)return r+(t-i)*this.scale;if(t<=s.bottom)return s.domTop+(t-s.top);i=s.bottom,r=s.domBottom}}fromDOM(t){for(let e=0,i=0,r=0;;e++){let s=e<this.viewports.length?this.viewports[e]:null;if(!s||t<s.domTop)return i+(t-r)/this.scale;if(t<=s.domBottom)return s.top+(t-s.domTop);i=s.bottom,r=s.domBottom}}};function Mi(n,t){if(t.scale==1)return n;let e=t.toDOM(n.top),i=t.toDOM(n.bottom);return new Qt(n.from,n.length,e,i-e,Array.isArray(n.type)?n.type.map(r=>Mi(r,t)):n.type)}var xn=V.define({combine:n=>n.join(" ")}),gs=V.define({combine:n=>n.indexOf(!0)>-1}),ms=Rt.newName(),sh=Rt.newName(),oh=Rt.newName(),lh={"&light":"."+sh,"&dark":"."+oh};function ys(n,t,e){return new Rt(t,{finish(i){return/&/.test(i)?i.replace(/&\\w*/,r=>{if(r=="&")return n;if(!e||!e[r])throw new RangeError(`Unsupported selector: ${r}`);return e[r]}):n+" "+i}})}var Hf=ys("."+ms,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},lh),bs=class{constructor(t,e,i,r){this.typeOver=r,this.bounds=null,this.text="";let{impreciseHead:s,impreciseAnchor:o}=t.docView;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,i,0))){let l=s||o?[]:Wf(t),a=new In(l,t.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=zf(l,this.bounds.from)}else{let l=t.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!qe(t.contentDOM,l.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!qe(t.contentDOM,l.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset);this.newSel=$.single(h,a)}}};function ah(n,t){let e,{newSel:i}=t,r=n.state.selection.main;if(t.bounds){let{from:s,to:o}=t.bounds,l=r.from,a=null;(n.inputState.lastKeyCode===8&&n.inputState.lastKeyTime>Date.now()-100||I.android&&t.text.length<o-s)&&(l=r.to,a="end");let h=Vf(n.state.doc.sliceString(s,o,le),t.text,l-s,a);h&&(I.chrome&&n.inputState.lastKeyCode==13&&h.toB==h.from+2&&t.text.slice(h.from,h.toB)==le+le&&h.toB--,e={from:s+h.from,to:s+h.toA,insert:U.of(t.text.slice(h.from,h.toB).split(le))})}else i&&(!n.hasFocus&&n.state.facet(Wn)||i.main.eq(r))&&(i=null);if(!e&&!i)return!1;if(!e&&t.typeOver&&!r.empty&&i&&i.main.empty?e={from:r.from,to:r.to,insert:n.state.doc.slice(r.from,r.to)}:e&&e.from>=r.from&&e.to<=r.to&&(e.from!=r.from||e.to!=r.to)&&r.to-r.from-(e.to-e.from)<=4?e={from:r.from,to:r.to,insert:n.state.doc.slice(r.from,e.from).append(e.insert).append(n.state.doc.slice(e.to,r.to))}:(I.mac||I.android)&&e&&e.from==e.to&&e.from==r.head-1&&/^\\. ?$/.test(e.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&e.insert.length==2&&(i=$.single(i.main.anchor-1,i.main.head-1)),e={from:r.from,to:r.to,insert:U.of([" "])}):I.chrome&&e&&e.from==e.to&&e.from==r.head&&e.insert.toString()==`\n `&&n.lineWrapping&&(i&&(i=$.single(i.main.anchor-1,i.main.head-1)),e={from:r.from,to:r.to,insert:U.of([" "])}),e){let s=n.state;if(I.ios&&n.inputState.flushIOSKey(n)||I.android&&(e.from==r.from&&e.to==r.to&&e.insert.length==1&&e.insert.lines==2&&Ke(n.contentDOM,"Enter",13)||e.from==r.from-1&&e.to==r.to&&e.insert.length==0&&Ke(n.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&Ke(n.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();if(n.state.facet($a).some(h=>h(n,e.from,e.to,o)))return!0;n.inputState.composing>=0&&n.inputState.composing++;let l;if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let h=r.from<e.from?s.sliceDoc(r.from,e.from):"",c=r.to>e.to?s.sliceDoc(e.to,r.to):"";l=s.replaceSelection(n.state.toText(h+e.insert.sliceString(0,void 0,n.state.lineBreak)+c))}else{let h=s.changes(e),c=i&&i.main.to<=h.newLength?i.main:void 0;if(s.selection.ranges.length>1&&n.inputState.composing>=0&&e.to<=r.to&&e.to>=r.to-10){let f=n.state.sliceDoc(e.from,e.to),u=qa(n)||n.state.doc.lineAt(r.head),d=r.to-e.to,p=r.to-r.from;l=s.changeByRange(b=>{if(b.from==r.from&&b.to==r.to)return{changes:h,range:c||b.map(h)};let y=b.to-d,v=y-f.length;if(b.to-b.from!=p||n.state.sliceDoc(v,y)!=f||u&&b.to>=u.from&&b.from<=u.to)return{range:b};let N=s.changes({from:v,to:y,insert:e.insert}),C=b.to-r.to;return{changes:N,range:c?$.range(Math.max(0,c.anchor+C),Math.max(0,c.head+C)):b.map(N)}})}else l={changes:h,selection:c&&s.selection.replaceRange(c)}}let a="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,a+=".compose",n.inputState.compositionFirstChange&&(a+=".start",n.inputState.compositionFirstChange=!1)),n.dispatch(l,{scrollIntoView:!0,userEvent:a}),!0}else if(i&&!i.main.eq(r)){let s=!1,o="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(s=!0),o=n.inputState.lastSelectionOrigin),n.dispatch({selection:i,scrollIntoView:s,userEvent:o}),!0}else return!1}function Vf(n,t,e,i){let r=Math.min(n.length,t.length),s=0;for(;s<r&&n.charCodeAt(s)==t.charCodeAt(s);)s++;if(s==r&&n.length==t.length)return null;let o=n.length,l=t.length;for(;o>0&&l>0&&n.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,s-Math.min(o,l));e-=o+a-s}if(o<s&&n.length<t.length){let a=e<=s&&e>=o?s-e:0;s-=a,l=s+(l-o),o=s}else if(l<s){let a=e<=s&&e>=l?s-e:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function Wf(n){let t=[];if(n.root.activeElement!=n.contentDOM)return t;let{anchorNode:e,anchorOffset:i,focusNode:r,focusOffset:s}=n.observer.selectionRange;return e&&(t.push(new _n(e,i)),(r!=e||s!=i)&&t.push(new _n(r,s))),t}function zf(n,t){if(n.length==0)return null;let e=n[0].pos,i=n.length==2?n[1].pos:e;return e>-1&&i>-1?$.single(e+t,i+t):null}var Uf={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Vr=I.ie&&I.ie_version<=11,ws=class{constructor(t){this.view=t,this.active=!1,this.selectionRange=new Wr,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let i of e)this.queue.push(i);(I.ie&&I.ie_version<=11||I.ios&&t.composing)&&e.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Vr&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var e;((e=this.view.docView)===null||e===void 0?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(t.scrollDOM),this.resizeContent=new ResizeObserver(()=>this.view.requestMeasure()),this.resizeContent.observe(t.contentDOM)),this.addWindowListeners(this.win=t.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runScrollHandlers(this.view,t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,i)=>e!=t[i]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,r=this.selectionRange;if(i.state.facet(Wn)?i.root.activeElement!=this.dom:!kn(i.dom,r))return;let s=r.anchorNode&&i.docView.nearest(r.anchorNode);if(s&&s.ignoreEvent(t)){e||(this.selectionChanged=!1);return}(I.ie&&I.ie_version<=11||I.android&&I.chrome)&&!i.state.selection.main.empty&&r.focusNode&&Tn(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=I.safari&&t.root.nodeType==11&&zc(this.dom.ownerDocument)==this.dom&&jf(this.view)||An(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=kn(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&qc(this.dom,e)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(e),i&&(this.selectionChanged=!0),!0)}setSelectionRange(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let t=0,e=null;for(let i=this.dom;i;)if(i.nodeType==1)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==i?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=e)i.addEventListener("scroll",this.onScroll)}}ignore(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Uf),Vr&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Vr&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,e){var i;if(!this.delayedAndroidKey){let r=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),!this.flush()&&s.force&&Ke(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,i=-1,r=!1;for(let s of t){let o=this.readMutation(s);o&&(o.typeOver&&(r=!0),e==-1?{from:e,to:i}=o:(e=Math.min(o.from,e),i=Math.max(o.to,i)))}return{from:e,to:i,typeOver:r}}readChange(){let{from:t,to:e,typeOver:i}=this.processRecords(),r=this.selectionChanged&&kn(this.dom,this.selectionRange);return t<0&&!r?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new bs(this.view,t,e,i))}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return!1;let i=this.view.state,r=ah(this.view,e);return this.view.state==i&&this.view.update([]),r}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty(t.type=="attributes"),t.type=="attributes"&&(e.dirty|=4),t.type=="childList"){let i=ba(e,t.previousSibling||t.target.previousSibling,-1),r=ba(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:r?e.posBefore(r):e.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var t,e,i,r;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(e=this.gapIntersection)===null||e===void 0||e.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect(),(r=this.resizeContent)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}};function ba(n,t,e){for(;t;){let i=X.get(t);if(i&&i.parent==n)return i;let r=t.parentNode;t=r!=n.dom?r:e>0?t.nextSibling:t.previousSibling}return null}function jf(n){let t=null;function e(a){a.preventDefault(),a.stopImmediatePropagation(),t=a.getTargetRanges()[0]}if(n.contentDOM.addEventListener("beforeinput",e,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",e,!0),!t)return null;let i=t.startContainer,r=t.startOffset,s=t.endContainer,o=t.endOffset,l=n.docView.domAtPos(n.state.selection.main.anchor);return Tn(l.node,l.offset,s,o)&&([i,r,s,o]=[s,o,i,r]),{anchorNode:i,anchorOffset:r,focusNode:s,focusOffset:o}}var z=class n{constructor(t={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=t.dispatch||(e=>this.update([e])),this.dispatch=this.dispatch.bind(this),this._root=t.root||Kc(t.parent)||document,this.viewState=new $n(t.state||Q.create(t)),this.plugins=this.state.facet(Ai).map(e=>new Ei(e));for(let e of this.plugins)e.update(this);this.observer=new ws(this),this.inputState=new rs(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new Ln(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(t.length==1&&t[0]instanceof St?t[0]:this.state.update(...t))}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e=!1,i=!1,r,s=this.state;for(let u of t){if(u.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn\'t start from the previous state.");s=u.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;t.some(u=>u.annotation(ih))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=nh(s,o),a||(l=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(c=null)):this.observer.clear(),s.facet(Q.phrases)!=this.state.facet(Q.phrases))return this.setState(s);r=Pn.create(this,s,t),r.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of t){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection;f=new Nn(d.empty?d:$.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of u.effects)d.is(ta)&&(f=d.value)}this.viewState.update(r,f),this.bidiCache=Hn.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),e=this.docView.update(r),this.state.facet(Ti)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(e,t.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(xn)!=r.state.facet(xn)&&(this.viewState.mustMeasureContent=!0),(e||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!r.empty)for(let u of this.state.facet(Zr))u(r);(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!ah(this,c)&&h.force&&Ke(this.contentDOM,h.key,h.keyCode)})}setState(t){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let e=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new $n(t),this.plugins=t.facet(Ai).map(i=>new Ei(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView=new Ln(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(Ai),i=t.state.facet(Ai);if(e!=i){let r=[];for(let s of i){let o=e.indexOf(s);if(o<0)r.push(new Ei(s));else{let l=this.plugins[o];l.mustUpdate=t,r.push(l)}}for(let s of this.plugins)s.mustUpdate!=t&&s.destroy(this);this.plugins=r,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else for(let r of this.plugins)r.mustUpdate=t;for(let r=0;r<this.plugins.length;r++)this.plugins[r].update(this)}measure(t=!0){if(this.destroyed)return;this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:r,clientHeight:s}=this.scrollDOM,o=r>i-s-4?i:r;try{for(let l=0;;l++){this.updateState=1;let a=this.viewport,h=this.viewState.lineBlockAtHeight(o),c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let f=[];c&4||([this.measureRequests,f]=[f,this.measureRequests]);let u=f.map(y=>{try{return y.read(this)}catch(v){return te(this.state,v),wa}}),d=Pn.create(this,this.state,[]),p=!1,b=!1;d.flags|=c,e?e.flags|=c:e=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),p=this.docView.update(d));for(let y=0;y<f.length;y++)if(u[y]!=wa)try{let v=f[y];v.write&&v.write(u[y],this)}catch(v){te(this.state,v)}if(this.viewState.editorHeight)if(this.viewState.scrollTarget)this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,b=!0;else{let y=this.viewState.lineBlockAt(h.from).top-h.top;(y>1||y<-1)&&(this.scrollDOM.scrollTop+=y,b=!0)}if(p&&this.docView.updateSelection(!0),this.viewport.from==a.from&&this.viewport.to==a.to&&!b&&this.measureRequests.length==0)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let l of this.state.facet(Zr))l(e)}get themeClasses(){return ms+" "+(this.state.facet(gs)?oh:sh)+" "+this.state.facet(xn)}updateAttrs(){let t=va(this,Wa,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Wn)?"true":"false",class:"cm-content",style:`${I.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),va(this,ks,e);let i=this.observer.ignore(()=>{let r=Xr(this.contentDOM,this.contentAttrs,e),s=Xr(this.dom,this.editorAttrs,t);return r||s});return this.editorAttrs=t,this.contentAttrs=e,i}showAnnouncements(t){let e=!0;for(let i of t)for(let r of i.effects)if(r.is(n.announce)){e&&(this.announceDOM.textContent=""),e=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(Ti),Rt.mount(this.root,this.styleModules.concat(Hf).reverse())}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn\'t allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let e=0;e<this.measureRequests.length;e++)if(this.measureRequests[e].key===t.key){this.measureRequests[e]=t;return}}this.measureRequests.push(t)}}plugin(t){let e=this.pluginMap.get(t);return(e===void 0||e&&e.spec!=t)&&this.pluginMap.set(t,e=this.plugins.find(i=>i.spec==t)||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,i){return Hr(this,t,oa(this,t,e,i))}moveByGroup(t,e){return Hr(this,t,oa(this,t,e,i=>vf(this,t.head,i)))}moveToLineBoundary(t,e,i=!0){return wf(this,t,e,i)}moveVertically(t,e,i){return Hr(this,t,Sf(this,t,e,i))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),Ya(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;let r=this.state.doc.lineAt(t),s=this.bidiSpans(r),o=s[he.find(s,t-r.from,-1,e)];return vs(i,o.dir==mt.LTR==e>0)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(Va)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Gf)return Ga(t.length);let e=this.textDirectionAt(t.from);for(let r of this.bidiCache)if(r.from==t.from&&r.dir==e)return r.order;let i=lf(t.text,e);return this.bidiCache.push(new Hn(t.from,t.to,e,i)),i}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||I.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{xa(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return ta.of(new Nn(typeof t=="number"?$.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return Je.define(()=>({}),{eventHandlers:t})}static theme(t,e){let i=Rt.newName(),r=[xn.of(i),Ti.of(ys(`.${i}`,t))];return e&&e.dark&&r.push(gs.of(!0)),r}static baseTheme(t){return pn.lowest(Ti.of(ys("."+ms,t,lh)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),r=i&&X.get(i)||X.get(t);return((e=r==null?void 0:r.rootView)===null||e===void 0?void 0:e.view)||null}};z.styleModule=Ti;z.inputHandler=$a;z.focusChangeEffect=Ha;z.perLineTextDirection=Va;z.exceptionSink=Fa;z.updateListener=Zr;z.editable=Wn;z.mouseSelectionStyle=Ba;z.dragMovesSelection=La;z.clickAddsSelectionRange=_a;z.decorations=_i;z.atomicRanges=za;z.scrollMargins=Ua;z.darkTheme=gs;z.contentAttributes=ks;z.editorAttributes=Wa;z.lineWrapping=z.contentAttributes.of({class:"cm-lineWrapping"});z.announce=tt.define();var Gf=4096,wa={},Hn=class n{constructor(t,e,i,r){this.from=t,this.to=e,this.dir=i,this.order=r}static update(t,e){if(e.empty)return t;let i=[],r=t.length?t[t.length-1].dir:mt.LTR;for(let s=Math.max(0,t.length-10);s<t.length;s++){let o=t[s];o.dir==r&&!e.touchesRange(o.from,o.to)&&i.push(new n(e.mapPos(o.from,1),e.mapPos(o.to,-1),o.dir,o.order))}return i}};function va(n,t,e){for(let i=n.state.facet(t),r=i.length-1;r>=0;r--){let s=i[r],o=typeof s=="function"?s(n):s;o&&qr(o,e)}return e}var wm=I.mac?"mac":I.windows?"win":I.linux?"linux":"key";var Kf=!I.ios;var qf={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};Kf&&(qf[".cm-line"].caretColor="transparent !important");var vm=/x/.unicode!=null?"gu":"g";var Sm=z.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"\'\'",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}});var ie=class extends Zt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}};ie.prototype.elementClass="";ie.prototype.toDOM=void 0;ie.prototype.mapMode=vt.TrackBefore;ie.prototype.startSide=ie.prototype.endSide=-1;ie.prototype.point=!0;var Tu=ko(hh());var Xf=0,Li=class{constructor(t,e){this.from=t,this.to=e}},j=class{constructor(t={}){this.id=Xf++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn\'t define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can\'t add per-node props to node types");return typeof t!="function"&&(t=Et.match(t)),e=>{let i=t(e);return i===void 0?null:[this,i]}}};j.closedBy=new j({deserialize:n=>n.split(" ")});j.openedBy=new j({deserialize:n=>n.split(" ")});j.group=new j({deserialize:n=>n.split(" ")});j.isolate=new j({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});j.contextHash=new j({perNode:!0});j.lookAhead=new j({perNode:!0});j.mounted=new j({perNode:!0});var Ze=class{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}static get(t){return t&&t.props&&t.props[j.mounted.id]}},Yf=Object.create(null),Et=class n{constructor(t,e,i,r=0){this.name=t,this.props=e,this.id=i,this.flags=r}static define(t){let e=t.props&&t.props.length?Object.create(null):Yf,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),r=new n(t.name||"",e,t.id,i);if(t.props){for(let s of t.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can\'t store a per-node prop on a node type");e[s[0].id]=s[1]}}return r}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let e=this.prop(j.group);return e?e.indexOf(t)>-1:!1}return this.id==t}static match(t){let e=Object.create(null);for(let i in t)for(let r of i.split(" "))e[r]=t[i];return i=>{for(let r=i.prop(j.group),s=-1;s<(r?r.length:0);s++){let o=e[s<0?i.name:r[s]];if(o)return o}}}};Et.none=new Et("",Object.create(null),0,8);var zn=new WeakMap,ch=new WeakMap,ct;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays"})(ct||(ct={}));var pt=class n{constructor(t,e,i,r,s){if(this.type=t,this.children=e,this.positions=i,this.length=r,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,l]of s)this.props[typeof o=="number"?o:o.id]=l}}toString(){let t=Ze.get(this);if(t&&!t.overlay)return t.tree.toString();let e="";for(let i of this.children){let r=i.toString();r&&(e&&(e+=","),e+=r)}return this.type.name?(/\\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(e.length?"("+e+")":""):e}cursor(t=0){return new $i(this.topNode,t)}cursorAt(t,e=0,i=0){let r=zn.get(this)||this.topNode,s=new $i(r);return s.moveTo(t,e),zn.set(this,s._tree),s}get topNode(){return new $t(this,0,0,null)}resolve(t,e=0){let i=Bi(zn.get(this)||this.topNode,t,e,!1);return zn.set(this,i),i}resolveInner(t,e=0){let i=Bi(ch.get(this)||this.topNode,t,e,!0);return ch.set(this,i),i}resolveStack(t,e=0){return Jf(this,t,e)}iterate(t){let{enter:e,leave:i,from:r=0,to:s=this.length}=t,o=t.mode||0,l=(o&ct.IncludeAnonymous)>0;for(let a=this.cursor(o|ct.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=r&&(!l&&a.type.isAnonymous||e(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Ns(Et.none,this.children,this.positions,0,this.children.length,0,this.length,(e,i,r)=>new n(this.type,e,i,r,this.propValues),t.makeTree||((e,i,r)=>new n(Et.none,e,i,r)))}static build(t){return Zf(t)}};pt.empty=new pt(Et.none,[],[],0);var Ts=class n{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new n(this.buffer,this.index)}},fe=class n{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return Et.none}toString(){let t=[];for(let e=0;e<this.buffer.length;)t.push(this.childString(e)),e=this.buffer[e+3];return t.join(",")}childString(t){let e=this.buffer[t],i=this.buffer[t+3],r=this.set.types[e],s=r.name;if(/\\W/.test(s)&&!r.isError&&(s=JSON.stringify(s)),t+=4,i==t)return s;let o=[];for(;t<i;)o.push(this.childString(t)),t=this.buffer[t+3];return s+"("+o.join(",")+")"}findChild(t,e,i,r,s){let{buffer:o}=this,l=-1;for(let a=t;a!=e&&!(dh(s,r,o[a+1],o[a+2])&&(l=a,i>0));a=o[a+3]);return l}slice(t,e,i){let r=this.buffer,s=new Uint16Array(e-t),o=0;for(let l=t,a=0;l<e;){s[a++]=r[l++],s[a++]=r[l++]-i;let h=s[a++]=r[l++]-i;s[a++]=r[l++]-t,o=Math.max(o,h)}return new n(s,o,this.set)}};function dh(n,t,e,i){switch(n){case-2:return e<t;case-1:return i>=t&&e<t;case 0:return e<t&&i>t;case 1:return e<=t&&i>t;case 2:return i>t;case 4:return!0}}function Bi(n,t,e,i){for(var r;n.from==n.to||(e<1?n.from>=t:n.from>t)||(e>-1?n.to<=t:n.to<t);){let o=!i&&n instanceof $t&&n.index<0?null:n.parent;if(!o)return n;n=o}let s=i?0:ct.IgnoreOverlays;if(i)for(let o=n,l=o.parent;l;o=l,l=o.parent)o instanceof $t&&o.index<0&&((r=l.enter(t,e,s))===null||r===void 0?void 0:r.from)!=o.from&&(n=l);for(;;){let o=n.enter(t,e,s);if(!o)return n;n=o}}var jn=class{cursor(t=0){return new $i(this,t)}getChild(t,e=null,i=null){let r=fh(this,t,e,i);return r.length?r[0]:null}getChildren(t,e=null,i=null){return fh(this,t,e,i)}resolve(t,e=0){return Bi(this,t,e,!1)}resolveInner(t,e=0){return Bi(this,t,e,!0)}matchContext(t){return Ms(this,t)}enterUnfinishedNodesBefore(t){let e=this.childBefore(t),i=this;for(;e;){let r=e.lastChild;if(!r||r.to!=e.to)break;r.type.isError&&r.from==r.to?(i=e,e=r.prevSibling):e=r}return i}get node(){return this}get next(){return this.parent}},$t=class n extends jn{constructor(t,e,i,r){super(),this._tree=t,this.from=e,this.index=i,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,e,i,r,s=0){for(let o=this;;){for(let{children:l,positions:a}=o._tree,h=e>0?l.length:-1;t!=h;t+=e){let c=l[t],f=a[t]+o.from;if(dh(r,i,f,f+c.length)){if(c instanceof fe){if(s&ct.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,e,i-f,r);if(u>-1)return new Fi(new Es(o,c,t,f),null,u)}else if(s&ct.IncludeAnonymous||!c.type.isAnonymous||Os(c)){let u;if(!(s&ct.IgnoreMounts)&&(u=Ze.get(c))&&!u.overlay)return new n(u.tree,f,t,o);let d=new n(c,f,t,o);return s&ct.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(e<0?c.children.length-1:0,e,i,r)}}}if(s&ct.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+e:t=e<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,i=0){let r;if(!(i&ct.IgnoreOverlays)&&(r=Ze.get(this._tree))&&r.overlay){let s=t-this.from;for(let{from:o,to:l}of r.overlay)if((e>0?o<=s:o<s)&&(e<0?l>=s:l>s))return new n(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,i)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function fh(n,t,e,i){let r=n.cursor(),s=[];if(!r.firstChild())return s;if(e!=null){for(let o=!1;!o;)if(o=r.type.is(e),!r.nextSibling())return s}for(;;){if(i!=null&&r.type.is(i))return s;if(r.type.is(t)&&s.push(r.node),!r.nextSibling())return i==null?s:[]}}function Ms(n,t,e=t.length-1){for(let i=n.parent;e>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[e]&&t[e]!=i.name)return!1;e--}}return!0}var Es=class{constructor(t,e,i,r){this.parent=t,this.buffer=e,this.index=i,this.start=r}},Fi=class n extends jn{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,i){super(),this.context=t,this._parent=e,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}child(t,e,i){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],t,e-this.context.start,i);return s<0?null:new n(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,i=0){if(i&ct.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return s<0?null:new n(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new n(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new n(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:i}=this.context,r=this.index+4,s=i.buffer[this.index+3];if(s>r){let o=i.buffer[this.index+1];t.push(i.slice(r,s,o)),e.push(0)}return new pt(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function ph(n){if(!n.length)return null;let t=0,e=n[0];for(let s=1;s<n.length;s++){let o=n[s];(o.from>e.from||o.to<e.to)&&(e=o,t=s)}let i=e instanceof $t&&e.index<0?null:e.parent,r=n.slice();return i?r[t]=i:r.splice(t,1),new Rs(r,e)}var Rs=class{constructor(t,e){this.heads=t,this.node=e}get next(){return ph(this.heads)}};function Jf(n,t,e){let i=n.resolveInner(t,e),r=null;for(let s=i instanceof $t?i:i.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(r||(r=[i])).push(o.resolve(t,e)),s=o}else{let o=Ze.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let l=new $t(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[i])).push(Bi(l,t,e,!1))}}return r?ph(r):i}var $i=class{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof $t)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let i=t._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,e){this.index=t;let{start:i,buffer:r}=this.buffer;return this.type=e||r.set.types[r.buffer[t]],this.from=i+r.buffer[t+1],this.to=i+r.buffer[t+2],!0}yield(t){return t?t instanceof $t?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],t,e-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?i&ct.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ct.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&ct.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let r=i<0?0:this.stack[i]+4;if(this.index!=r)return this.yieldBuf(e.findChild(r,this.index,-1,0,4))}else{let r=e.buffer[this.index+3];if(r<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(r)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:r}=this;if(r){if(t>0){if(this.index<r.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(r.buffer.buffer[s+3]<this.index)return!1;({index:e,parent:i}=r)}else({index:e,_parent:i}=this._tree);for(;i;{index:e,_parent:i}=i)if(e>-1)for(let s=e+t,o=t<0?-1:i._tree.children.length;s!=o;s+=t){let l=i._tree.children[s];if(this.mode&ct.IncludeAnonymous||l instanceof fe||!l.type.isAnonymous||Os(l))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,e););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,e=null,i=0;if(t&&t.context==this.buffer)t:for(let r=this.index,s=this.stack.length;s>=0;){for(let o=t;o;o=o._parent)if(o.index==r){if(r==this.index)return o;e=o,i=s+1;break t}r=this.stack[--s]}for(let r=i;r<this.stack.length;r++)e=new Fi(this.buffer,e,this.stack[r]);return this.bufferNode=new Fi(this.buffer,e,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,e){for(let i=0;;){let r=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(r=!0)}for(;r&&e&&e(this),r=this.type.isAnonymous,!this.nextSibling();){if(!i)return;this.parent(),i--,r=!0}}}matchContext(t){if(!this.buffer)return Ms(this.node,t);let{buffer:e}=this.buffer,{types:i}=e.set;for(let r=t.length-1,s=this.stack.length-1;r>=0;s--){if(s<0)return Ms(this.node,t,r);let o=i[e.buffer[this.stack[s]]];if(!o.isAnonymous){if(t[r]&&t[r]!=o.name)return!1;r--}}return!0}};function Os(n){return n.children.some(t=>t instanceof fe||!t.type.isAnonymous||Os(t))}function Zf(n){var t;let{buffer:e,nodeSet:i,maxBufferLength:r=1024,reused:s=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(e)?new Ts(e,e.length):e,a=i.types,h=0,c=0;function f(k,T,x,M,S,_){let{id:w,start:D,end:F,size:P}=l,B=c;for(;P<0;)if(l.next(),P==-1){let st=s[w];x.push(st),M.push(D-k);return}else if(P==-3){h=w;return}else if(P==-4){c=w;return}else throw new RangeError(`Unrecognized record size: ${P}`);let H=a[w],L,nt,W=D-k;if(F-D<=r&&(nt=y(l.pos-T,S))){let st=new Uint16Array(nt.size-nt.skip),gt=l.pos-nt.size,xt=st.length;for(;l.pos>gt;)xt=v(nt.start,st,xt);L=new fe(st,F-nt.start,i),W=nt.start-k}else{let st=l.pos-P;l.next();let gt=[],xt=[],It=w>=o?w:-1,jt=0,me=F;for(;l.pos>st;)It>=0&&l.id==It&&l.size>=0?(l.end<=me-r&&(p(gt,xt,D,jt,l.end,me,It,B),jt=gt.length,me=l.end),l.next()):_>2500?u(D,st,gt,xt):f(D,st,gt,xt,It,_+1);if(It>=0&&jt>0&&jt<gt.length&&p(gt,xt,D,jt,D,me,It,B),gt.reverse(),xt.reverse(),It>-1&&jt>0){let si=d(H);L=Ns(H,gt,xt,0,gt.length,0,F-D,si,si)}else L=b(H,gt,xt,F-D,B-F)}x.push(L),M.push(W)}function u(k,T,x,M){let S=[],_=0,w=-1;for(;l.pos>T;){let{id:D,start:F,end:P,size:B}=l;if(B>4)l.next();else{if(w>-1&&F<w)break;w<0&&(w=P-r),S.push(D,F,P),_++,l.next()}}if(_){let D=new Uint16Array(_*4),F=S[S.length-2];for(let P=S.length-3,B=0;P>=0;P-=3)D[B++]=S[P],D[B++]=S[P+1]-F,D[B++]=S[P+2]-F,D[B++]=B;x.push(new fe(D,S[2]-F,i)),M.push(F-k)}}function d(k){return(T,x,M)=>{let S=0,_=T.length-1,w,D;if(_>=0&&(w=T[_])instanceof pt){if(!_&&w.type==k&&w.length==M)return w;(D=w.prop(j.lookAhead))&&(S=x[_]+w.length+D)}return b(k,T,x,M,S)}}function p(k,T,x,M,S,_,w,D){let F=[],P=[];for(;k.length>M;)F.push(k.pop()),P.push(T.pop()+x-S);k.push(b(i.types[w],F,P,_-S,D-_)),T.push(S-x)}function b(k,T,x,M,S=0,_){if(h){let w=[j.contextHash,h];_=_?[w].concat(_):[w]}if(S>25){let w=[j.lookAhead,S];_=_?[w].concat(_):[w]}return new pt(k,T,x,M,_)}function y(k,T){let x=l.fork(),M=0,S=0,_=0,w=x.end-r,D={size:0,start:0,skip:0};t:for(let F=x.pos-k;x.pos>F;){let P=x.size;if(x.id==T&&P>=0){D.size=M,D.start=S,D.skip=_,_+=4,M+=4,x.next();continue}let B=x.pos-P;if(P<0||B<F||x.start<w)break;let H=x.id>=o?4:0,L=x.start;for(x.next();x.pos>B;){if(x.size<0)if(x.size==-3)H+=4;else break t;else x.id>=o&&(H+=4);x.next()}S=L,M+=P,_+=H}return(T<0||M==k)&&(D.size=M,D.start=S,D.skip=_),D.size>4?D:void 0}function v(k,T,x){let{id:M,start:S,end:_,size:w}=l;if(l.next(),w>=0&&M<o){let D=x;if(w>4){let F=l.pos-(w-4);for(;l.pos>F;)x=v(k,T,x)}T[--x]=D,T[--x]=_-k,T[--x]=S-k,T[--x]=M}else w==-3?h=M:w==-4&&(c=M);return x}let N=[],C=[];for(;l.pos>0;)f(n.start||0,n.bufferStart||0,N,C,-1,0);let O=(t=n.length)!==null&&t!==void 0?t:N.length?C[0]+N[0].length:0;return new pt(a[n.topID],N.reverse(),C.reverse(),O)}var uh=new WeakMap;function Un(n,t){if(!n.isAnonymous||t instanceof fe||t.type!=n)return 1;let e=uh.get(t);if(e==null){e=1;for(let i of t.children){if(i.type!=n||!(i instanceof pt)){e=1;break}e+=Un(n,i)}uh.set(t,e)}return e}function Ns(n,t,e,i,r,s,o,l,a){let h=0;for(let p=i;p<r;p++)h+=Un(n,t[p]);let c=Math.ceil(h*1.5/8),f=[],u=[];function d(p,b,y,v,N){for(let C=y;C<v;){let O=C,k=b[C],T=Un(n,p[C]);for(C++;C<v;C++){let x=Un(n,p[C]);if(T+x>=c)break;T+=x}if(C==O+1){if(T>c){let x=p[O];d(x.children,x.positions,0,x.children.length,b[O]+N);continue}f.push(p[O])}else{let x=b[C-1]+p[C-1].length-k;f.push(Ns(n,p,b,O,C,k,x,null,a))}u.push(k+N-s)}}return d(t,e,i,r,0),(l||a)(f,u,o)}var Re=class n{constructor(t,e,i,r,s=!1,o=!1){this.from=t,this.to=e,this.tree=i,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,e=[],i=!1){let r=[new n(0,t.length,t,0,!1,i)];for(let s of e)s.to>t.length&&r.push(s);return r}static applyChanges(t,e,i=128){if(!e.length)return t;let r=[],s=1,o=t.length?t[0]:null;for(let l=0,a=0,h=0;;l++){let c=l<e.length?e[l]:null,f=c?c.fromA:1e9;if(f-a>=i)for(;o&&o.from<f;){let u=o;if(a>=u.from||f<=u.to||h){let d=Math.max(u.from,a)-h,p=Math.min(u.to,f)-h;u=d>=p?null:new n(d,p,u.tree,u.offset+h,l>0,!!c)}if(u&&r.push(u),o.to>f)break;o=s<t.length?t[s++]:null}if(!c)break;a=c.toA,h=c.toA-c.toB}return r}},Gn=class{startParse(t,e,i){return typeof t=="string"&&(t=new Ds(t)),i=i?i.length?i.map(r=>new Li(r.from,r.to)):[new Li(0,0)]:[new Li(0,t.length)],this.createParse(t,e||[],i)}parse(t,e,i){let r=this.startParse(t,e,i);for(;;){let s=r.advance();if(s)return s}}},Ds=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}};var km=new j({perNode:!0});var Qf=0,zt=class n{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Qf++}static define(t){if(t!=null&&t.base)throw new Error("Can not derive from a modified tag");let e=new n([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new Yn;return e=>e.modified.indexOf(t)>-1?e:Yn.get(e.base||e,e.modified.concat(t).sort((i,r)=>i.id-r.id))}},tu=0,Yn=class n{constructor(){this.instances=[],this.id=tu++}static get(t,e){if(!e.length)return t;let i=e[0].instances.find(l=>l.base==t&&eu(e,l.modified));if(i)return i;let r=[],s=new zt(r,t,e);for(let l of e)l.instances.push(s);let o=iu(e);for(let l of t.set)if(!l.modified.length)for(let a of o)r.push(n.get(l,a));return s}};function eu(n,t){return n.length==t.length&&n.every((e,i)=>e==t[i])}function iu(n){let t=[[]];for(let e=0;e<n.length;e++)for(let i=0,r=t.length;i<r;i++)t.push(t[i].concat(n[e]));return t.sort((e,i)=>i.length-e.length)}function yh(n){let t=Object.create(null);for(let e in n){let i=n[e];Array.isArray(i)||(i=[i]);for(let r of e.split(" "))if(r){let s=[],o=2,l=r;for(let f=0;;){if(l=="..."&&f>0&&f+3==r.length){o=1;break}let u=/^"(?:[^"\\\\]|\\\\.)*?"|[^\\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+r);if(s.push(u[0]=="*"?"":u[0][0]==\'"\'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==r.length)break;let d=r[f++];if(f==r.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+r);l=r.slice(f)}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+r);let c=new Qe(i,o,a>0?s.slice(0,a):null);t[h]=c.sort(t[h])}}return bh.add(t)}var bh=new j,Qe=class{constructor(t,e,i,r){this.tags=t,this.mode=e,this.context=i,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}get depth(){return this.context?this.context.length:0}};Qe.empty=new Qe([],2,null);function Ls(n,t){let e=Object.create(null);for(let s of n)if(!Array.isArray(s.tag))e[s.tag.id]=s.class;else for(let o of s.tag)e[o.id]=s.class;let{scope:i,all:r=null}=t||{};return{style:s=>{let o=r;for(let l of s)for(let a of l.set){let h=e[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function nu(n,t){let e=null;for(let i of n){let r=i.style(t);r&&(e=e?e+" "+r:r)}return e}function wh(n,t,e,i=0,r=n.length){let s=new Is(i,Array.isArray(t)?t:[t],e);s.highlightRange(n.cursor(),i,r,"",s.highlighters),s.flush(r)}var Is=class{constructor(t,e,i){this.at=t,this.highlighters=e,this.span=i,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,i,r,s){let{type:o,from:l,to:a}=t;if(l>=i||a<=e)return;o.isTop&&(s=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=r,c=ru(t)||Qe.empty,f=nu(s,c.tags);if(f&&(h&&(h+=" "),h+=f,c.mode==1&&(r+=(r?" ":"")+f)),this.startSpan(t.from,h),c.opaque)return;let u=t.tree&&t.tree.prop(j.mounted);if(u&&u.overlay){let d=t.node.enter(u.overlay[0].from+l,1),p=this.highlighters.filter(y=>!y.scope||y.scope(u.tree.type)),b=t.firstChild();for(let y=0,v=l;;y++){let N=y<u.overlay.length?u.overlay[y]:null,C=N?N.from+l:a,O=Math.max(e,v),k=Math.min(i,C);if(O<k&&b)for(;t.from<k&&(this.highlightRange(t,O,k,r,s),this.startSpan(Math.min(k,t.to),h),!(t.to>=C||!t.nextSibling())););if(!N||C>i)break;v=N.to+l,v>e&&(this.highlightRange(d.cursor(),Math.max(e,N.from+l),Math.min(i,v),r,p),this.startSpan(v,h))}b&&t.parent()}else if(t.firstChild()){do if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,r,s),this.startSpan(Math.min(i,t.to),h)}while(t.nextSibling());t.parent()}}};function ru(n){let t=n.type.prop(bh);for(;t&&t.context&&!n.matchContext(t.context);)t=t.next;return t||null}var A=zt.define,Kn=A(),ue=A(),gh=A(ue),mh=A(ue),de=A(),qn=A(de),Ps=A(de),Wt=A(),De=A(Wt),Ht=A(),Vt=A(),_s=A(),Hi=A(_s),Xn=A(),g={comment:Kn,lineComment:A(Kn),blockComment:A(Kn),docComment:A(Kn),name:ue,variableName:A(ue),typeName:gh,tagName:A(gh),propertyName:mh,attributeName:A(mh),className:A(ue),labelName:A(ue),namespace:A(ue),macroName:A(ue),literal:de,string:qn,docString:A(qn),character:A(qn),attributeValue:A(qn),number:Ps,integer:A(Ps),float:A(Ps),bool:A(de),regexp:A(de),escape:A(de),color:A(de),url:A(de),keyword:Ht,self:A(Ht),null:A(Ht),atom:A(Ht),unit:A(Ht),modifier:A(Ht),operatorKeyword:A(Ht),controlKeyword:A(Ht),definitionKeyword:A(Ht),moduleKeyword:A(Ht),operator:Vt,derefOperator:A(Vt),arithmeticOperator:A(Vt),logicOperator:A(Vt),bitwiseOperator:A(Vt),compareOperator:A(Vt),updateOperator:A(Vt),definitionOperator:A(Vt),typeOperator:A(Vt),controlOperator:A(Vt),punctuation:_s,separator:A(_s),bracket:Hi,angleBracket:A(Hi),squareBracket:A(Hi),paren:A(Hi),brace:A(Hi),content:Wt,heading:De,heading1:A(De),heading2:A(De),heading3:A(De),heading4:A(De),heading5:A(De),heading6:A(De),contentSeparator:A(Wt),list:A(Wt),quote:A(Wt),emphasis:A(Wt),strong:A(Wt),link:A(Wt),monospace:A(Wt),strikethrough:A(Wt),inserted:A(),deleted:A(),changed:A(),invalid:A(),meta:Xn,documentMeta:A(Xn),annotation:A(Xn),processingInstruction:A(Xn),definition:zt.defineModifier(),constant:zt.defineModifier(),function:zt.defineModifier(),standard:zt.defineModifier(),local:zt.defineModifier(),special:zt.defineModifier()},Tm=Ls([{tag:g.link,class:"tok-link"},{tag:g.heading,class:"tok-heading"},{tag:g.emphasis,class:"tok-emphasis"},{tag:g.strong,class:"tok-strong"},{tag:g.keyword,class:"tok-keyword"},{tag:g.atom,class:"tok-atom"},{tag:g.bool,class:"tok-bool"},{tag:g.url,class:"tok-url"},{tag:g.labelName,class:"tok-labelName"},{tag:g.inserted,class:"tok-inserted"},{tag:g.deleted,class:"tok-deleted"},{tag:g.literal,class:"tok-literal"},{tag:g.string,class:"tok-string"},{tag:g.number,class:"tok-number"},{tag:[g.regexp,g.escape,g.special(g.string)],class:"tok-string2"},{tag:g.variableName,class:"tok-variableName"},{tag:g.local(g.variableName),class:"tok-variableName tok-local"},{tag:g.definition(g.variableName),class:"tok-variableName tok-definition"},{tag:g.special(g.variableName),class:"tok-variableName2"},{tag:g.definition(g.propertyName),class:"tok-propertyName tok-definition"},{tag:g.typeName,class:"tok-typeName"},{tag:g.namespace,class:"tok-namespace"},{tag:g.className,class:"tok-className"},{tag:g.macroName,class:"tok-macroName"},{tag:g.propertyName,class:"tok-propertyName"},{tag:g.operator,class:"tok-operator"},{tag:g.comment,class:"tok-comment"},{tag:g.meta,class:"tok-meta"},{tag:g.invalid,class:"tok-invalid"},{tag:g.punctuation,class:"tok-punctuation"}]);var Bs,Wi=new j;var su=new j,Ot=class{constructor(t,e,i=[],r=""){this.data=t,this.name=r,Q.prototype.hasOwnProperty("tree")||Object.defineProperty(Q.prototype,"tree",{get(){return zi(this)}}),this.parser=e,this.extension=[ti.of(this),Q.languageData.of((s,o,l)=>{let a=vh(s,o,l),h=a.type.prop(Wi);if(!h)return[];let c=s.facet(h),f=a.type.prop(su);if(f){let u=a.resolve(o-a.from,l);for(let d of f)if(d.test(u,s)){let p=s.facet(d.facet);return d.type=="replace"?p:p.concat(c)}}return c})].concat(i)}isActiveAt(t,e,i=-1){return vh(t,e,i).type.prop(Wi)==this.data}findRegions(t){let e=t.facet(ti);if((e==null?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let i=[],r=(s,o)=>{if(s.prop(Wi)==this.data){i.push({from:o,to:o+s.length});return}let l=s.prop(j.mounted);if(l){if(l.tree.prop(Wi)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+s.length});return}else if(l.overlay){let a=i.length;if(r(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;a<s.children.length;a++){let h=s.children[a];h instanceof pt&&r(h,s.positions[a]+o)}};return r(zi(t),0),i}get allowsNesting(){return!0}};Ot.setState=tt.define();function vh(n,t,e){let i=n.facet(ti),r=zi(n).topNode;if(!i||i.allowsNesting)for(let s=r;s;s=s.enter(t,e,ct.ExcludeBuffers))s.type.isTop&&(r=s);return r}function zi(n){let t=n.field(Ot.state,!1);return t?t.tree:pt.empty}var Vs=class{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t<i||e>=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}},Vi=null,Ws=class n{constructor(t,e,i=[],r,s,o,l,a){this.parser=t,this.state=e,this.fragments=i,this.tree=r,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new n(t,e,[],pt.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Vs(this.state.doc),this.fragments)}work(t,e){return e!=null&&e>=this.state.doc.length&&(e=void 0),this.tree!=pt.empty&&this.isDone(e!=null?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof t=="number"){let r=Date.now()+t;t=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),e!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&e<this.state.doc.length&&this.parse.stopAt(e);;){let r=this.parse.advance();if(r)if(this.fragments=this.withoutTempSkipped(Re.addTree(r,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=r,this.parse=null,this.treeLen<(e!=null?e:this.state.doc.length))this.parse=this.startParse();else return!0;if(t())return!1}})}takeTree(){let t,e;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(e=this.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(Re.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Vi;Vi=this;try{return t()}finally{Vi=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Sh(t,e.from,e.to);return t}changes(t,e){let{fragments:i,tree:r,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!t.empty){let a=[];if(t.iterChangedRanges((h,c,f,u)=>a.push({fromA:h,toA:c,fromB:f,toB:u})),i=Re.applyChanges(i,a),r=pt.empty,s=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let c=t.mapPos(h.from,1),f=t.mapPos(h.to,-1);c<f&&l.push({from:c,to:f})}}}return new n(this.parser,e,i,r,s,o,l,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let e=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:r,to:s}=this.skipped[i];r<t.to&&s>t.from&&(this.fragments=Sh(this.fragments,r,s),this.skipped.splice(i--,1))}return this.skipped.length>=e?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends Gn{createParse(e,i,r){let s=r[0].from,o=r[r.length-1].to;return{parsedPos:s,advance(){let a=Vi;if(a){for(let h of r)a.tempSkipped.push(h);t&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,t]):t)}return this.parsedPos=o,new pt(Et.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&e[0].from==0&&e[0].to>=t}static get(){return Vi}};function Sh(n,t,e){return Re.applyChanges(n,[{fromA:t,toA:e,fromB:t,toB:e}])}var Ui=class n{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),i=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,i)||e.takeTree(),new n(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ws.create(t.facet(ti).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new n(i)}};Ot.state=Yt.define({create:Ui.init,update(n,t){for(let e of t.effects)if(e.is(Ot.setState))return e.value;return t.startState.facet(ti)!=t.state.facet(ti)?Ui.init(t.state):n.apply(t)}});var Ch=n=>{let t=setTimeout(()=>n(),500);return()=>clearTimeout(t)};typeof requestIdleCallback!="undefined"&&(Ch=n=>{let t=-1,e=setTimeout(()=>{t=requestIdleCallback(n,{timeout:400})},100);return()=>t<0?clearTimeout(e):cancelIdleCallback(t)});var Fs=typeof navigator!="undefined"&&(!((Bs=navigator.scheduling)===null||Bs===void 0)&&Bs.isInputPending)?()=>navigator.scheduling.isInputPending():null,ou=Je.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(Ot.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Ot.state);(e.tree!=e.context.tree||!e.context.isDone(t.doc.length))&&(this.working=Ch(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEnd<e&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=e+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:r}}=this.view,s=i.field(Ot.state);if(s.tree==s.context.tree&&s.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!Fs?Math.max(25,t.timeRemaining()-5):1e9),l=s.context.treeLen<r&&i.doc.length>r+1e3,a=s.context.work(()=>Fs&&Fs()||Date.now()>o,r+(l?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Ot.setState.of(new Ui(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(e=>te(this.view.state,e)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),ti=V.define({combine(n){return n.length?n[0]:null},enables:n=>[Ot.state,ou,z.contentAttributes.compute([n],t=>{let e=t.facet(n);return e&&e.name?{"data-language":e.name}:{}})]});var pe=class n{constructor(t,e){this.specs=t;let i;function r(l){let a=Rt.newName();return(i||(i=Object.create(null)))["."+a]=l,a}let s=typeof e.all=="string"?e.all:e.all?r(e.all):void 0,o=e.scope;this.scope=o instanceof Ot?l=>l.prop(Wi)==o.data:o?l=>l==o:void 0,this.style=Ls(t.map(l=>({tag:l.tag,class:l.class||r(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=i?new Rt(i):null,this.themeType=e.themeType}static define(t,e){return new n(t,e||{})}},zs=V.define(),Ah=V.define({combine(n){return n.length?[n[0]]:null}});function $s(n){let t=n.facet(zs);return t.length?t:n.facet(Ah)}function Jn(n,t){let e=[lu],i;return n instanceof pe&&(n.module&&e.push(z.styleModule.of(n.module)),i=n.themeType),t!=null&&t.fallback?e.push(Ah.of(n)):i?e.push(zs.computeN([z.darkTheme],r=>r.facet(z.darkTheme)==(i=="dark")?[n]:[])):e.push(zs.of(n)),e}var Us=class{constructor(t){this.markCache=Object.create(null),this.tree=zi(t.state),this.decorations=this.buildDeco(t,$s(t.state))}update(t){let e=zi(t.state),i=$s(t.state),r=i!=$s(t.startState);e.length<t.view.viewport.to&&!r&&e.type==this.tree.type?this.decorations=this.decorations.map(t.changes):(e!=this.tree||t.viewportChanged||r)&&(this.tree=e,this.decorations=this.buildDeco(t.view,i))}buildDeco(t,e){if(!e||!this.tree.length)return J.none;let i=new Ce;for(let{from:r,to:s}of t.visibleRanges)wh(this.tree,e,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=J.mark({class:a})))},r,s);return i.finish()}},lu=pn.high(Je.fromClass(Us,{decorations:n=>n.decorations})),Lm=pe.define([{tag:g.meta,color:"#404740"},{tag:g.link,textDecoration:"underline"},{tag:g.heading,textDecoration:"underline",fontWeight:"bold"},{tag:g.emphasis,fontStyle:"italic"},{tag:g.strong,fontWeight:"bold"},{tag:g.strikethrough,textDecoration:"line-through"},{tag:g.keyword,color:"#708"},{tag:[g.atom,g.bool,g.url,g.contentSeparator,g.labelName],color:"#219"},{tag:[g.literal,g.inserted],color:"#164"},{tag:[g.string,g.deleted],color:"#a11"},{tag:[g.regexp,g.escape,g.special(g.string)],color:"#e40"},{tag:g.definition(g.variableName),color:"#00f"},{tag:g.local(g.variableName),color:"#30a"},{tag:[g.typeName,g.namespace],color:"#085"},{tag:g.className,color:"#167"},{tag:[g.special(g.variableName),g.macroName],color:"#256"},{tag:g.definition(g.propertyName),color:"#00c"},{tag:g.comment,color:"#940"},{tag:g.invalid,color:"#f00"}]);var au=Object.create(null),xh=[Et.none];var kh=[],hu=Object.create(null);for(let[n,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])hu[n]=cu(au,t);function Hs(n,t){kh.indexOf(n)>-1||(kh.push(n),console.warn(t))}function cu(n,t){let e=null;for(let s of t.split(".")){let o=n[s]||g[s];o?typeof o=="function"?e?e=o(e):Hs(s,`Modifier ${s} used at start of tag`):e?Hs(s,`Tag ${s} used as modifier`):e=o:Hs(s,`Unknown highlighting tag ${s}`)}if(!e)return 0;let i=t.replace(/ /g,"_"),r=Et.define({id:xh.length,name:i,props:[yh({[i]:e})]});return xh.push(r),r.id}var fu="#abb2bf",uu="#7d8799",du="#ffffff",pu="#21252b",js="rgba(0, 0, 0, 0.5)",gu="#292d3e",Gs="#353a42",mu="rgba(128, 203, 196, 0.2)",Th="#ffcc00",yu=z.theme({"&":{color:"#ffffff",backgroundColor:gu},".cm-content":{caretColor:Th},"&.cm-focused .cm-cursor":{borderLeftColor:Th},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:mu},".cm-panels":{backgroundColor:pu,color:"#ffffff"},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:js},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847",outline:"1px solid #515a6b"},".cm-gutters":{background:"#292d3e",color:"#676e95",border:"none"},".cm-activeLineGutter":{backgroundColor:js},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Gs},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Gs,borderBottomColor:Gs},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:js,color:fu}}},{dark:!0}),bu=pe.define([{tag:g.keyword,color:"#c792ea"},{tag:g.operator,color:"#89ddff"},{tag:g.special(g.variableName),color:"#eeffff"},{tag:g.typeName,color:"#f07178"},{tag:g.atom,color:"#f78c6c"},{tag:g.number,color:"#ff5370"},{tag:g.definition(g.variableName),color:"#82aaff"},{tag:g.string,color:"#c3e88d"},{tag:g.special(g.string),color:"#f07178"},{tag:g.comment,color:uu},{tag:g.variableName,color:"#f07178"},{tag:g.tagName,color:"#ff5370"},{tag:g.bracket,color:"#a2a1a4"},{tag:g.meta,color:"#ffcb6b"},{tag:g.attributeName,color:"#c792ea"},{tag:g.propertyName,color:"#c792ea"},{tag:g.className,color:"#decb6b"},{tag:g.invalid,color:du}]),wu=[yu,Jn(bu)];var Mh="#2e3440",Zs="#3b4252",Eh="#434c5e",Zn="#4c566a";var Rh="#e5e9f0",Js="#eceff4",Ks="#8fbcbb",Dh="#88c0d0",vu="#81a1c1",Pt="#5e81ac",Su="#bf616a",ei="#d08770",qs="#ebcb8b",Oh="#a3be8c",xu="#b48ead",Nh="#d30102",Qs=Js,Xs=Qs,ku="#ffffff",Ys=Zs,Cu=Qs,Ph=Zs,Ih=z.theme({"&":{color:Mh,backgroundColor:ku},".cm-content":{caretColor:Ph},".cm-cursor, .cm-dropCursor":{borderLeftColor:Ph},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Cu},".cm-panels":{backgroundColor:Qs,color:Zn},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:`1px solid ${Zn}`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:Rh},".cm-activeLine":{backgroundColor:Xs},".cm-selectionMatch":{backgroundColor:Rh},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{outline:`1px solid ${Zn}`},"&.cm-focused .cm-matchingBracket":{backgroundColor:Js},".cm-gutters":{backgroundColor:Js,color:Mh,border:"none"},".cm-activeLineGutter":{backgroundColor:Xs},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Ys},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Ys,borderBottomColor:Ys},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Xs,color:Zn}}},{dark:!1}),Au=pe.define([{tag:g.keyword,color:Pt},{tag:[g.name,g.deleted,g.character,g.propertyName,g.macroName],color:ei},{tag:[g.variableName],color:ei},{tag:[g.function(g.variableName)],color:Pt},{tag:[g.labelName],color:vu},{tag:[g.color,g.constant(g.name),g.standard(g.name)],color:Pt},{tag:[g.definition(g.name),g.separator],color:Oh},{tag:[g.brace],color:Ks},{tag:[g.annotation],color:Nh},{tag:[g.number,g.changed,g.annotation,g.modifier,g.self,g.namespace],color:Dh},{tag:[g.typeName,g.className],color:qs},{tag:[g.operator,g.operatorKeyword],color:Oh},{tag:[g.tagName],color:xu},{tag:[g.squareBracket],color:Su},{tag:[g.angleBracket],color:ei},{tag:[g.attributeName],color:qs},{tag:[g.regexp],color:Pt},{tag:[g.quote],color:Zs},{tag:[g.string],color:ei},{tag:g.link,color:Ks,textDecoration:"underline",textUnderlinePosition:"under"},{tag:[g.url,g.escape,g.special(g.string)],color:ei},{tag:[g.meta],color:Dh},{tag:[g.comment],color:Eh,fontStyle:"italic"},{tag:g.strong,fontWeight:"bold",color:Pt},{tag:g.emphasis,fontStyle:"italic",color:Pt},{tag:g.strikethrough,textDecoration:"line-through"},{tag:g.heading,fontWeight:"bold",color:Pt},{tag:g.special(g.heading1),fontWeight:"bold",color:Pt},{tag:g.heading1,fontWeight:"bold",color:Pt},{tag:[g.heading2,g.heading3,g.heading4],fontWeight:"bold",color:Pt},{tag:[g.heading5,g.heading6],color:Pt},{tag:[g.atom,g.bool,g.special(g.variableName)],color:ei},{tag:[g.processingInstruction,g.inserted],color:Ks},{tag:[g.contentSeparator],color:qs},{tag:g.invalid,color:Eh,borderBottom:`1px dotted ${Nh}`}]),Km=[Ih,Jn(Au)];function ji(n,t=0,e=" ",i=!0){let r=[];if(t==5||n==null)return"";if(typeof n=="string")return n;if(typeof n=="number")return`${n}`;if(Array.isArray(n))r.push(`${i?"(":""}${n.map(s=>ji(s,t++)).join(e)}${i?")":""}`);else if(typeof n=="object")for(let s of Object.values(n))r.push(ji(s,t++));return r.join(" ")}var Mu={str:"strength",dex:"dexterity",con:"constitution",wis:"wisdom",int:"intelligence",cha:"charisma"};function Ut(n){return n?n.replace(/{@condition (.+?)(?:\\|.+)?}/g,"$1").replace(/{@item (.+?)(?:\\|.+)?}/g,"$1").replace(/{@spell ([\\s\\S]+?)(?:\\|.+)?}/g,"$1").replace(/{@recharge (.+?)(?:\\|.+)?}/g,"(Recharge $1-6)").replace(/{@recharge}/g,"(Recharge 6)").replace(/{@h}/g,"").replace(/{@damage (.+?)}/g,"$1").replace(/{@atk ms}/g,"Melee Spell Attack").replace(/{@atk rs}/g,"Ranged Spell Attack").replace(/{@atk mw}/g,"Melee Weapon Attack").replace(/{@atk rw}/g,"Ranged Weapon Attack").replace(/{@atk mw,rw}/g,"Melee / Ranged Weapon Attack").replace(/{@creature (.+?)(?:\\|.+)?}/g,"$1").replace(/{@skill (.+?)(?:\\|.+)?}/g,"$1").replace(/{@dice (.+?)(?:\\|.+)?}/g,"$1").replace(/{@hit (\\d+?)(?:\\|.+)?}/g,"+$1").replace(/{@dc (\\d+?)(?:\\|.+)?}/g,"$1").replace(/{@quickref (.+?)\\|\\|.+?}/,"$1"):""}async function _h(n){return new Promise((t,e)=>{let i=new FileReader;i.onload=async r=>{var s,o,l,a,h,c,f,u,d,p,b,y,v,N,C,O,k;try{let T=JSON.parse(r.target.result),x;"monster"in T?x=T.monster:Array.isArray(T)?x=T:typeof T=="object"?x=[T]:e("Invalid monster JSON provided.");let M=[];for(let S of x)try{let _={image:null,bestiary:!0,name:S.name,source:Hu(S),type:Eu(S.type),subtype:Ru(S.type),size:Ju[(s=S.size)==null?void 0:s[0]],alignment:Bu(S),hp:S.hp&&"average"in S.hp?(o=S.hp)==null?void 0:o.average:null,hit_dice:S.hp&&"formula"in S.hp?(l=S.hp)==null?void 0:l.formula:"",ac:Nu(S.ac),speed:Fu(S),stats:[S.str,S.dex,S.con,S.int,S.wis,S.cha],damage_immunities:Ut(ii(S.immune)),damage_resistances:Ut(ii(S.resist)),damage_vulnerabilities:Ut(ii(S.vulnerable)),condition_immunities:Ut(ii(S.conditionImmune)),saves:Object.entries((a=S.save)!=null?a:{}).map(w=>{var F,P;if(!w||!w[1])return;let[,D]=(P=(F=w[1])==null?void 0:F.match(/.*?(\\d+)/))!=null?P:[];if(D)return{[Mu[w[0]]]:D}}).filter(w=>w),skillsaves:Hg(S),senses:$u(S),languages:ji(S.languages,0,", ",!1),cr:Du(S.cr),traits:(c=(h=S.trait)==null?void 0:h.flatMap(Oe))!=null?c:[],actions:(u=(f=S.action)==null?void 0:f.flatMap(Oe))!=null?u:[],bonus_actions:(p=(d=S.bonus)==null?void 0:d.flatMap(Oe))!=null?p:[],reactions:(y=(b=S.reaction)==null?void 0:b.flatMap(Oe))!=null?y:[],legendary_actions:(N=(v=S.legendary)==null?void 0:v.flatMap(Oe))!=null?N:[],mythic_actions:[...(C=(S.mythicHeader?[{name:"",entries:S.mythicHeader}]:[]).flatMap(Oe))!=null?C:[],...(k=(O=S.mythic)==null?void 0:O.flatMap(Oe))!=null?k:[]],spells:Lu(S),spellsNotes:Ou(S).join(" ")};M.push(_)}catch(_){console.error(_);continue}t(M)}catch(T){console.error("reject!!!",T),e(T)}},i.readAsText(n)})}function Eu(n){if(n)return typeof n=="string"?n:n.type}function Ru(n){if(!n||typeof n=="string"||!n.tags)return;let t=[];for(var e of n.tags)typeof e=="string"?t.push(e):t.push(e.tag);return t.join(", ")}function Du(n){if(n)return typeof n=="string"?n:n.cr}function Ou(n){let t=[];for(let e in n.spellcasting)t.push(ji(n.spellcasting[e].footerEntries,0,", ",!1));return t}function ii(n){if(!n)return"";let t=[];for(let e of n){if(typeof e=="string"){t.push(e);continue}if("special"in e){t.push(e.special);continue}if("immune"in e){t.push(`${ii(e.immune)}${e.note?" ":""}${e.note?e.note:""}`);continue}if("resist"in e){t.push(`${ii(e.resist)}${e.note?" ":""}${e.note?e.note:""}`);continue}}return t.join(", ")}function Nu(n=[]){var e;let[t]=n;if(t){if(typeof t=="number")return t;if(typeof t=="string"){let[i,r]=(e=t.match(/(\\d+)/))!=null?e:[];return r?Number(r):null}if(typeof t=="object")return"special"in t?t.special:"ac"in t?"from"in t?`${t.ac} (${Ut(t.from.join(", "))})`:`${t.ac}`:null}}var Pu={0:"Cantrips (at will)",1:"1st level",2:"2nd level",3:"3rd level",4:"4th level",5:"5th level",6:"6th level",7:"7th level",8:"8th level",9:"9th level"};function to(n){let t=[];for(let e of n){if(typeof e=="string"){t.push(e);continue}!e.hidden&&e.entry&&e.entry.length&&t.push(e.entry)}return Ut(t.join(", "))}function Iu(n){let t=[];for(let e of Object.keys(n)){let i=n[e],r=Number(e.replace(/[^0-9]/,""));t.push([r,to(i)])}return t}function _u(n){var r,s;let t=[Ut(((r=n.headerEntries)!=null?r:[]).join(`\n`))];if("spells"in n)try{for(let o in(s=n.spells)!=null?s:{}){let l=n.spells[o],{spells:a}=l,h=`${Pu[o]}`;h+="slots"in l?` (${l.slots} slots)`:"";let c=Ut(a.join(", "));t.push({[h]:c})}}catch(o){throw new Error("There was an error parsing the spells.")}if("will"in n&&n.will.length>0)try{t.push({"At will":to(n.will)})}catch(o){throw new Error("There was an error parsing the at-will spells.")}if("ritual"in n&&n.ritual.length>0)try{t.push({Rituals:to(n.ritual)})}catch(o){throw new Error("There was an error parsing the ritual spells.")}let e=["rest","daily","weekly","yearly","charges"],i={rest:"/rest each",daily:"/day each",weekly:"/week each",yearly:"/year each",charges:" charges"};for(let o of e)if(o in n){let l=Iu(n[o]);for(let a of l.sort((h,c)=>c[0]-h[0]))t.push({[`${a[0]}${i[o]}`]:a[1]})}return t}function Lu(n){return!n.spellcasting||!n.spellcasting.length?[]:n.spellcasting.flatMap(_u)}function Bu(n){return n.alignment?Qn(n.alignment):null}function Qn(n){var e;if(!n)return null;let t=[];if(Array.isArray(n)){let i=[];for(let r of n)typeof r=="string"?i.push(Qn(r)):t.push(Qn(r));i.length>0&&t.push(i.join(" "))}else if(typeof n=="object"){if("special"in n&&n.special!=null)return n.special;if("alignment"in n)return`${((e=n.alignment)!=null?e:[]).map(i=>Qn(i)).join(" ")}${n.chance?` (${n.chance}%)`:""}${n.note?` (${n.note})`:""}`}else{switch(n.toUpperCase()){case"L":return"lawful";case"N":return"neutral";case"NX":return"neutral (law/chaos axis)";case"NY":return"neutral (good/evil axis)";case"C":return"chaotic";case"G":return"good";case"E":return"evil";case"U":return"unaligned";case"A":return"any alignment"}return n}return t.join(" or ")}function Fu(n){var l,a;let t=n.speed;if(!t)return"\\u2014";if(typeof t=="number")return`${t}`;function e(h){return typeof h=="number"?h:h.number!=null?h.number:h}function i(h){var c;return typeof h=="number"?"":(c=h==null?void 0:h.condition)!=null?c:""}let r=[],s=["walk","burrow","climb","fly","swim"];for(let h of s){if(h!="walk"&&!(h in t)&&!(h in((l=t.alternate)!=null?l:{})))continue;let c=[];r.push(`${h==="walk"?"":`${h} `}${e((a=t[h])!=null?a:0)} ft. ${i(t[h])}`.trim()),t.alternate&&t.alternate[h]&&t.alternate[h].forEach(f=>{r.push(`${h==="walk"?"":`${h} `}${e(f!=null?f:0)} ft. ${i(f)}`.trim())})}let o=", ";if(t.choose){o="; ";let h=t.choose.from.sort();h.length>1?(`${h.slice(0,h.length-1).join(", ")}${h[h.length-1]}${t.choose.amount}`,t.choose.note&&`${t.choose.note}`):r.push(`${h} ${t.choose.amount} ft.${t.choose.note?` ${t.choose.note}`:""}`)}return r.join(o)}function $u(n){if(typeof n.senses=="string")return n.senses;let t=[];return Array.isArray(n.senses)&&n.senses.length>0&&(t=[n.senses.join(", ").trim()]),n.passive&&t.push(`passive Perception ${n.passive}`),t.join(", ")}function Hu(n){var e,i,r;let t=[];return(e=n.source)!=null&&e.length&&t.push((i=m[n.source])!=null?i:n.source),(r=n.otherSources)!=null&&r.length&&t.push(...n.otherSources.map(s=>{var o;return(o=m[s.source])!=null?o:s.source})),t}function Oe(n){return n.entries.reduce((e,i)=>{var s;if(typeof i!="string"){let o=(s=i.items)==null?void 0:s.map(l=>typeof l=="string"?{name:l,entries:[]}:"entry"in l?{name:l.name,entries:[l.entry]}:{name:l.name,entries:l.entries});return e.concat(o!=null?o:[])}return e.length>1||e[0].entries.push(i),e},[{name:n.name,entries:[]}]).map(({name:e,entries:i})=>({name:Ut(e),desc:Ut(i.join(`\n`))}))}var Vu="F",Wu="D",zu="T",Uu="S",ju="M",Gu="L",Ku="H",qu="G",Xu="C",Yu="V",Ju={[Vu]:"Fine",[Wu]:"Diminutive",[zu]:"Tiny",[Uu]:"Small",[ju]:"Medium",[Gu]:"Large",[Ku]:"Huge",[qu]:"Gargantuan",[Xu]:"Colossal",[Yu]:"Varies"},Zu="CoS",Qu="DMG",td="EEPC",ed="EET",id="HotDQ",nd="LMoP",rd="Mag",sd="MM",od="OotA",ld="PHB",ad="PotA",hd="RoT",cd="RoTOS",fd="SCAG",ud="SKT",dd="ToA",pd="ToD",gd="TTP",md="TftYP",yd="TftYP-AtG",bd="TftYP-DiT",wd="TftYP-TFoF",vd="TftYP-THSoT",Sd="TftYP-TSC",xd="TftYP-ToH",kd="TftYP-WPM",Cd="VGM",Ad="XGE",Td="OGA",Md="MTF",Ed="WDH",Rd="WDMM",Dd="GGR",Od="KKW",Nd="LLK",Pd="GoS",Id="AI",_d="OoW",Ld="ESK",Bd="DIP",Fd="HftT",$d="DC",Hd="SLW",Vd="SDW",Wd="BGDIA",zd="LR",Ud="AL",jd="SAC",Gd="ERLW",Kd="EFR",qd="RMBRE",Xd="RMR",Yd="MFF",Jd="AWM",Zd="IMR",Qd="SADS",tp="EGW",ep="ToR",ip="DD",np="FS",rp="US",sp="MOT",op="IDRotF",lp="TCE",ap="VRGR",hp="HoL",cp="Screen",fp="ScreenWildernessKit",up="HF",dp="CM",pp="WBtW",gp="CRCotN",eo="AL",mp=`${eo}CurseOfStrahd`,yp=`${eo}ElementalEvil`,bp=`${eo}RageOfDemons`,ni="PS",wp=`${ni}A`,vp=`${ni}I`,Sp=`${ni}K`,xp=`${ni}Z`,kp=`${ni}X`,Cp=`${ni}D`,E="UA",Ap=`${E}Artificer`,Tp=`${E}EladrinAndGith`,Mp=`${E}Eberron`,Ep=`${E}FeatsForRaces`,Rp=`${E}FeatsForSkills`,Dp=`${E}FiendishOptions`,Op=`${E}Feats`,Np=`${E}GothicHeroes`,Pp=`${E}ModernMagic`,Ip=`${E}StarterSpells`,_p=`${E}TheMysticClass`,Lp=`${E}ThatOldBlackMagic`,Bp=`${E}TheRangerRevised`,Fp=`${E}WaterborneAdventures`,$p=`${E}VariantRules`,Hp=`${E}LightDarkUnderdark`,Vp=`${E}RangerAndRogue`,Wp=`${E}ATrioOfSubclasses`,zp=`${E}BarbarianPrimalPaths`,Up=`${E}RevisedSubclasses`,jp=`${E}KitsOfOld`,Gp=`${E}BardBardColleges`,Kp=`${E}ClericDivineDomains`,qp=`${E}Druid`,Xp=`${E}RevisedClassOptions`,Yp=`${E}Fighter`,Jp=`${E}Monk`,Zp=`${E}Paladin`,Qp=`${E}ModifyingClasses`,tg=`${E}Sorcerer`,eg=`${E}WarlockAndWizard`,ig=`${E}TheFaithful`,ng=`${E}WizardRevisited`,rg=`${E}ElfSubraces`,sg=`${E}MassCombat`,og=`${E}ThreePillarExperience`,lg=`${E}GreyhawkInitiative`,ag=`${E}ThreeSubclasses`,hg=`${E}OrderDomain`,cg=`${E}CentaursMinotaurs`,fg=`${E}GiantSoulSorcerer`,ug=`${E}RacesOfEberron`,dg=`${E}RacesOfRavnica`,pg=`${E}WGE`,gg=`${E}OfShipsAndSea`,mg=`${E}Sidekicks`,yg=`${E}ArtificerRevisited`,bg=`${E}BarbarianAndMonk`,wg=`${E}SorcererAndWarlock`,vg=`${E}BardAndPaladin`,Sg=`${E}ClericDruidWizard`,xg=`${E}FighterRangerRogue`,kg=`${E}ClassFeatureVariants`,Cg=`${E}FighterRogueWizard`,Ag=`${E}PrestigeClassesRunMagic`,Tg=`${E}Ranger`,Mg=`${E}2020SubclassesPt1`,Eg=`${E}2020SubclassesPt2`,Rg=`${E}2020SubclassesPt3`,Dg=`${E}2020SubclassesPt4`,Og=`${E}2020SubclassesPt5`,Ng=`${E}2020SpellsAndMagicTattoos`,Pg=`${E}2020PsionicOptionsRevisited`,Ig=`${E}2020SubclassesRevisited`,_g=`${E}2020Feats`,Lg=`${E}2021GothicLineages`,Bg=`${E}2021FolkOfTheFeywild`,Fg=`${E}2021DraconicOptions`,$g=`${E}2021MagesOfStrixhaven`,io="Adventurers League: ",ri="Plane Shift: ",R="Unearthed Arcana: ",ge="Tales from the Yawning Portal",m={};m[Zu]="Curse of Strahd";m[Qu]="Dungeon Master\'s Guide";m[td]="Elemental Evil Player\'s Companion";m[ed]="Elemental Evil: Trinkets";m[id]="Hoard of the Dragon Queen";m[nd]="Lost Mine of Phandelver";m[rd]="Dragon Magazine";m[sd]="Monster Manual";m[od]="Out of the Abyss";m[ld]="Player\'s Handbook";m[ad]="Princes of the Apocalypse";m[hd]="The Rise of Tiamat";m[cd]="The Rise of Tiamat Online Supplement";m[fd]="Sword Coast Adventurer\'s Guide";m[ud]="Storm King\'s Thunder";m[dd]="Tomb of Annihilation";m[pd]="Tyranny of Dragons";m[gd]="The Tortle Package";m[md]=ge;m[yd]=`${ge}: Against the Giants`;m[bd]=`${ge}: Dead in Thay`;m[wd]=`${ge}: The Forge of Fury`;m[vd]=`${ge}: The Hidden Shrine of Tamoachan`;m[Sd]=`${ge}: The Sunless Citadel`;m[xd]=`${ge}: Tomb of Horrors`;m[kd]=`${ge}: White Plume Mountain`;m[Cd]="Volo\'s Guide to Monsters";m[Ad]="Xanathar\'s Guide to Everything";m[Td]="One Grung Above";m[Md]="Mordenkainen\'s Tome of Foes";m[Ed]="Waterdeep: Dragon Heist";m[Rd]="Waterdeep: Dungeon of the Mad Mage";m[Dd]="Guildmasters\' Guide to Ravnica";m[Od]="Krenko\'s Way";m[Nd]="Lost Laboratory of Kwalish";m[Pd]="Ghosts of Saltmarsh";m[Id]="Acquisitions Incorporated";m[_d]="The Orrery of the Wanderer";m[Ld]="Essentials Kit";m[Bd]="Dragon of Icespire Peak";m[Fd]="Hunt for the Thessalhydra";m[$d]="Divine Contention";m[Hd]="Storm Lord\'s Wrath";m[Vd]="Sleeping Dragon\'s Wake";m[Wd]="Baldur\'s Gate: Descent Into Avernus";m[zd]="Locathah Rising";m[Ud]="Adventurers\' League";m[jd]="Sage Advice Compendium";m[Gd]="Eberron: Rising from the Last War";m[Kd]="Eberron: Forgotten Relics";m[qd]="The Lost Dungeon of Rickedness: Big Rick Energy";m[Xd]="Dungeons & Dragons vs. Rick and Morty: Basic Rules";m[Yd]="Mordenkainen\'s Fiendish Folio";m[Jd]="Adventure with Muk";m[Zd]="Infernal Machine Rebuild";m[Qd]="Sapphire Anniversary Dice Set";m[tp]="Explorer\'s Guide to Wildemount";m[ep]="Tide of Retribution";m[ip]="Dangerous Designs";m[np]="Frozen Sick";m[rp]="Unwelcome Spirits";m[sp]="Mythic Odysseys of Theros";m[op]="Icewind Dale: Rime of the Frostmaiden";m[lp]="Tasha\'s Cauldron of Everything";m[ap]="Van Richten\'s Guide to Ravenloft";m[hp]="The House of Lament";m[cp]="Dungeon Master\'s Screen";m[fp]="Dungeon Master\'s Screen: Wilderness Kit";m[up]="Heroes\' Feast";m[dp]="Candlekeep Mysteries";m[mp]=`${io}Curse of Strahd`;m[yp]=`${io}Elemental Evil`;m[bp]=`${io}Rage of Demons`;m[wp]=`${ri}Amonkhet`;m[vp]=`${ri}Innistrad`;m[Sp]=`${ri}Kaladesh`;m[xp]=`${ri}Zendikar`;m[kp]=`${ri}Ixalan`;m[Cp]=`${ri}Dominaria`;m[Ap]=`${R}Artificer`;m[Tp]=`${R}Eladrin and Gith`;m[Mp]=`${R}Eberron`;m[Ep]=`${R}Feats for Races`;m[Rp]=`${R}Feats for Skills`;m[Dp]=`${R}Fiendish Options`;m[Op]=`${R}Feats`;m[Np]=`${R}Gothic Heroes`;m[Pp]=`${R}Modern Magic`;m[Ip]=`${R}Starter Spells`;m[_p]=`${R}The Mystic Class`;m[Lp]=`${R}That Old Black Magic`;m[Bp]=`${R}The Ranger, Revised`;m[Fp]=`${R}Waterborne Adventures`;m[$p]=`${R}Variant Rules`;m[Hp]=`${R}Light, Dark, Underdark!`;m[Vp]=`${R}Ranger and Rogue`;m[Wp]=`${R}A Trio of Subclasses`;m[zp]=`${R}Barbarian Primal Paths`;m[Up]=`${R}Revised Subclasses`;m[jp]=`${R}Kits of Old`;m[Gp]=`${R}Bard: Bard Colleges`;m[Kp]=`${R}Cleric: Divine Domains`;m[qp]=`${R}Druid`;m[Xp]=`${R}Revised Class Options`;m[Yp]=`${R}Fighter`;m[Jp]=`${R}Monk`;m[Zp]=`${R}Paladin`;m[Qp]=`${R}Modifying Classes`;m[tg]=`${R}Sorcerer`;m[eg]=`${R}Warlock and Wizard`;m[ig]=`${R}The Faithful`;m[ng]=`${R}Wizard Revisited`;m[rg]=`${R}Elf Subraces`;m[sg]=`${R}Mass Combat`;m[og]=`${R}Three-Pillar Experience`;m[lg]=`${R}Greyhawk Initiative`;m[ag]=`${R}Three Subclasses`;m[hg]=`${R}Order Domain`;m[cg]=`${R}Centaurs and Minotaurs`;m[fg]=`${R}Giant Soul Sorcerer`;m[ug]=`${R}Races of Eberron`;m[dg]=`${R}Races of Ravnica`;m[pg]="Wayfinder\'s Guide to Eberron";m[gg]=`${R}Of Ships and the Sea`;m[mg]=`${R}Sidekicks`;m[yg]=`${R}Artificer Revisited`;m[bg]=`${R}Barbarian and Monk`;m[wg]=`${R}Sorcerer and Warlock`;m[vg]=`${R}Bard and Paladin`;m[Sg]=`${R}Cleric, Druid, and Wizard`;m[xg]=`${R}Fighter, Ranger, and Rogue`;m[kg]=`${R}Class Feature Variants`;m[Cg]=`${R}Fighter, Rogue, and Wizard`;m[Ag]=`${R}Prestige Classes and Rune Magic`;m[Tg]=`${R}Ranger`;m[Mg]=`${R}2020 Subclasses, Part 1`;m[Eg]=`${R}2020 Subclasses, Part 2`;m[Rg]=`${R}2020 Subclasses, Part 3`;m[Dg]=`${R}2020 Subclasses, Part 4`;m[Og]=`${R}2020 Subclasses, Part 5`;m[Ng]=`${R}2020 Spells and Magic Tattoos`;m[Pg]=`${R}2020 Psionic Options Revisited`;m[Ig]=`${R}2020 Subclasses Revisited`;m[_g]=`${R}2020 Feats`;m[Lg]=`${R}2021 Gothic Lineages`;m[Bg]=`${R}2021 Folk of the Feywild`;m[Fg]=`${R}2021 Draconic Options`;m[$g]=`${R}2021 Mages of Strixhaven`;m[pp]="The Wild Beyond the Witchlight";m[gp]="Critical Role: Call of the Netherdeep";function Hg(n){var r,s,o;let t=n.skill;if(!t)return[];let e=[],i=[];for(let l of Object.keys(t)){if(l=="other"){let c=t[l];for(let f of c){let u=f.oneOf;if(!u)continue;let d=Object.keys(u).sort(),p=d.shift(),b=u[p],[,y]=(r=b==null?void 0:b.match(/.*?(\\d+)/))!=null?r:[];i.push({[`plus one of the following: ${p.charAt(0).toUpperCase()+p.slice(1)}`]:y});for(let v of d.slice(1)){let N=u[v],[,C]=(s=N==null?void 0:N.match(/.*?(\\d+)/))!=null?s:[];C&&i.push({[v]:C})}}continue}let a=t[l],[,h]=(o=a==null?void 0:a.match(/.*?(\\d+)/))!=null?o:[];h&&e.push({[l]:h})}return[...e.filter(l=>l),...i.filter(l=>l)]}var Lh={0:{cr:"0",value:0,xp:0},"1/8":{cr:"1/8",value:.125,xp:25},"1/4":{cr:"1/4",value:.25,xp:50},"1/2":{cr:"1/2",value:.5,xp:100},"0.125":{cr:"1/8",value:.125,xp:25},"0.25":{cr:"1/4",value:.25,xp:50},"0.5":{cr:"1/2",value:.5,xp:100},1:{cr:"1",value:1,xp:200},2:{cr:"2",value:2,xp:450},3:{cr:"3",value:3,xp:700},4:{cr:"4",value:4,xp:1100},5:{cr:"5",value:5,xp:1800},6:{cr:"6",value:6,xp:2300},7:{cr:"7",value:7,xp:2900},8:{cr:"8",value:8,xp:3900},9:{cr:"9",value:9,xp:5e3},10:{cr:"10",value:10,xp:5900},11:{cr:"11",value:11,xp:7200},12:{cr:"12",value:12,xp:8400},13:{cr:"13",value:13,xp:1e4},14:{cr:"14",value:14,xp:11500},15:{cr:"15",value:15,xp:13e3},16:{cr:"16",value:16,xp:15e3},17:{cr:"17",value:17,xp:18e3},18:{cr:"18",value:18,xp:2e4},19:{cr:"19",value:19,xp:22e3},20:{cr:"20",value:20,xp:25e3},21:{cr:"21",value:21,xp:33e3},22:{cr:"22",value:22,xp:41e3},23:{cr:"23",value:23,xp:5e4},24:{cr:"24",value:24,xp:62e3},25:{cr:"25",value:25,xp:75e3},26:{cr:"26",value:26,xp:9e4},27:{cr:"27",value:27,xp:105e3},28:{cr:"28",value:28,xp:12e4},29:{cr:"29",value:29,xp:135e3},30:{cr:"30",value:30,xp:155e3}};function ne(n){return Math.floor(((n!=null?n:10)-10)/2)}var Bh={tiny:4,small:6,medium:8,large:10,huge:12,gargantuan:20},Vg={str:"strength",dex:"dexterity",con:"constitution",int:"intelligence",wis:"wisdom",cha:"charisma"},no=class n{constructor(t){this.monster=t;this.proficiency=this.getProf(this.monster);this.stats={str:this.monster.strPoints,dex:this.monster.dexPoints,con:this.monster.conPoints,int:this.monster.intPoints,wis:this.monster.wisPoints,cha:this.monster.chaPoints};this.modifiers={str:ne(this.stats.str),dex:ne(this.stats.dex),con:ne(this.stats.con),int:ne(this.stats.int),wis:ne(this.stats.wis),cha:ne(this.stats.cha)}}static parse(t){var r,s,o,l,a,h;let e=new n(t);return{image:null,name:t.name,source:"TetraCube",type:t.type,subtype:"",size:t.size,alignment:t.alignment,hp:(r=e.getHP(t))==null?void 0:r.hp,hit_dice:(s=e.getHP(t))==null?void 0:s.dice,ac:(a=(l=((o=t.ac)!=null?o:[])[0])==null?void 0:l.ac)!=null?a:"",speed:e.getSpeedString(t),stats:[t.strPoints,t.dexPoints,t.conPoints,t.intPoints,t.wisPoints,t.chaPoints],damage_immunities:e.parseImmune(t,"i"),damage_resistances:e.parseImmune(t,"r"),damage_vulnerabilities:e.parseImmune(t,"v"),condition_immunities:e.parseConditions(t),saves:e.getSaves(t),skillsaves:e.getSkills(t),senses:e.getSenses(t),languages:e.getLanguages(t),cr:(h=t.cr)!=null?h:"",traits:e.getTraits(t.abilities),actions:e.getTraits(t.actions),reactions:e.getTraits(t.reactions),legendary_actions:e.getTraits(t.legendaries),spells:e.getSpells(t.abilities)}}getHP(t){var e,i;if(t.customHP||t.hitDice&&/(\\d+) \\((.+)\\)/.test(t.hpText)){let[r,s,o]=(e=t.hpText.match(/(\\d+) \\((.+)\\)/))!=null?e:[];return{hp:s,dice:o}}if(t.hitDice){let r=Number(t.hitDice),s=(i=Bh[t.size])!=null?i:Bh.medium,o=this.modifiers.con,l=r*s/(2+.5)+o*r,a=o>0?"+":"-",h=o==0?"":` ${a} ${o*r}`;return{hp:l,dice:`${r}d${s}${h}`}}}getSpeedString(t){if(t.customSpeed)return t.speedDesc;let e=[t.speed+" ft."];return t.burrowSpeed>0&&e.push("burrow "+t.burrowSpeed+" ft."),t.climbSpeed>0&&e.push("climb "+t.climbSpeed+" ft."),t.flySpeed>0&&e.push("fly "+t.flySpeed+" ft."+(t.hover?" (hover)":"")),t.swimSpeed>0&&e.push("swim "+t.swimSpeed+" ft."),e.join(", ")}parseImmune(t,e){let i=[];"damagetypes"in t&&Array.isArray(t.damagetypes)&&i.push(...t.damagetypes.filter(s=>s.type==e).map(s=>s.name));let r=[];return"specialdamage"in t&&Array.isArray(t.specialdamage)&&r.push(...t.specialdamage.filter(s=>s.type==e).map(s=>s.name)),[i.join(", "),r.join(", ")].filter(s=>s&&s.length).join("; ")}getLanguages(t){let e=[],i=[],r=[];for(let s=0;s<t.languages.length;s++){let o=t.languages[s];o.speaks||o.speaks==null?i.push(o):r.push(o)}return i.length>0&&e.push([i.slice(0,i.length-2).map(s=>s.name).join(", "),i.slice(-1).map(s=>s.name)].filter(s=>s).join(" and ")),r.length>0&&e.push([r.slice(0,r.length-2).map(s=>s.name).join(", "),r.slice(-1).map(s=>s.name)].filter(s=>s).join(" and ")),t.telepathy>0&&e.push("telepathy "+t.telepathy+" ft."),e.length==0&&e.push("&mdash;"),e.join("; ")}getSenses(t){let e=[];t.blindsight>0&&e.push("blindsight "+t.blindsight+" ft."+(t.blind?" (blind beyond this radius)":"")),t.darkvision>0&&e.push("darkvision "+t.darkvision+" ft."),t.tremorsense>0&&e.push("tremorsense "+t.tremorsense+" ft."),t.truesight>0&&e.push("truesight "+t.truesight+" ft.");let i=t.skills.find(s=>s.name=="perception"),r=10+ne(t.wisPoints);return i!=null&&(r+=this.proficiency*("note"in i?2:1)),e.push("passive Perception "+r),e.join(", ")}transformString(t){return t.replace(/(_|\\*|\\s*>\\s*)/g,"").replace(/\\[MON(S)?\\]/g,`${this.monster.shortName&&this.monster.shortName.length?this.monster.shortName:this.monster.name}$1`).replace(/\\[(\\w+)\\]/g,(e,i)=>{if(i=i.toLowerCase(),!(i in this.modifiers))return e;let r=this.modifiers[i];return`${r>=0?"+":""}${r}`}).replace(/\\[(\\w+) (ATK|SAVE)\\s?(?:([+-])\\s?(\\d+))?\\]/g,(e,i,r="ATK",s="+",o=0)=>{if(i=i.toLowerCase(),!(i in this.modifiers))return e;o=s=="+"?Number(o):-Number(o);let l=(r=="ATK"?0:8)+this.modifiers[i]+this.proficiency+o;return`${l>=0?"+":""}${l}`}).replace(/\\[(\\w+)?\\s?(\\d*[dD]\\d+)\\s?(?:([+-])\\s?(\\d+))?\\]/g,(e,i,r,s="+",o=0)=>{var f;i=i.toLowerCase();let[,l=1,a]=(f=r.match(/(\\d*)[dD](\\d+)/))!=null?f:[];if(l||(l=1),!a)return e;o=s=="+"?Number(o):-Number(o),i in this.modifiers&&(o+=this.modifiers[i]);let h=Math.floor((a/2+.5)*l)+o,c=[`${l}d${a}`];return o&&o!=0&&(c.push(o>=0?"+":"-"),c.push(o)),`${h} (${c.join(" ")})`})}getTraits(t){return!t||!t.length?void 0:t.filter(i=>i.name!="Spellcasting").map(i=>({name:i.name,desc:this.transformString(i.desc)}))}getSpells(t){var r;if(!t.abilities||!t.abilities.length)return;let{desc:e}=(r=t.abilities.find(s=>s.name=="Spellcasting"))!=null?r:{};return e?this.transformString(e).trim().split(`\n`).filter(s=>s.length):void 0}getSaves(t){if(!("sthrows"in t)||!Array.isArray(t.sthrows)||!t.sthrows.length)return[];let e=this.proficiency,i=[];for(let r of t.sthrows){let s=r.name,o=ne(Number(t[`${s}Points`]));isNaN(o)||i.push({[Vg[s]]:o+e})}return i}getSkills(t){if(!("skills"in t)||!Array.isArray(t.skills)||!t.skills.length)return[];let e=[],i=this.proficiency;for(let r of t.skills){let s=r.stat,o=ne(Number(t[`${s}Points`]));if(isNaN(o))continue;let l="note"in r;e.push({[r.name]:i+o+o*Number(l)})}return e}getProf(t){var i,r;let e=0;return t.cr=="*"&&(e=t.customProf),"cr"in t&&t.cr in Lh&&(e=Math.max(Math.floor(2+(((r=(i=Lh[t.cr])==null?void 0:i.value)!=null?r:0)-1)/4),2)),isNaN(Number(e))?0:Number(e)}parseConditions(t){if("conditions"in t&&Array.isArray(t.conditions))return t.conditions.map(e=>e.name).join(", ")}};async function Fh(n){return new Promise((t,e)=>{let i=new FileReader,r=[];i.onload=async s=>{try{let o=JSON.parse(s.target.result),l;"monster"in o?l=o.monster:Array.isArray(o)?l=o:typeof o=="object"?l=[o]:e("Invalid monster JSON provided.");let a=[];for(let h of l)try{let c=no.parse(h);a.push(c)}catch(c){console.error(c);continue}t(a)}catch(o){console.error("reject!!!",o),e(o)}},i.readAsText(n)})}var ro=self;ro.onmessage=async n=>{if(!n.data)return;let{files:t,source:e}=n.data,i=[];for(let r of t)switch(e){case"5e":{let s=await _h(r);i.push(...s!=null?s:[]);break}case"critter":{let s=await Sl(r);i.push(...s!=null?s:[]);break}case"improved":{let s=await vl(r);i.push(...s!=null?s:[]);break}case"appfile":{let s=await wl(r);i.push(...s!=null?s:[]);break}case"tetra":{let s=await Fh(r);i.push(...s!=null?s:[]);break}case"generic":{let s=await new Promise((o,l)=>{let a=new FileReader;a.onload=async h=>{try{let c=JSON.parse(h.target.result),f=[];if(Array.isArray(c))f=c;else if(typeof c=="object")if("name"in c)f=[c];else for(let d in c)Array.isArray(c[d])&&f.push(...c[d]);else l("Invalid monster JSON provided. Must be array or object.");let u=[];for(let d of f)"name"in d&&u.push(d);o(u)}catch(c){console.error("reject!!!",c),l(c)}},a.readAsText(r)});i.push(...s!=null?s:[])}}ro.postMessage({monsters:i})};ro.addEventListener("unhandledrejection",function(n){throw n.reason});\n')}var Un=require("obsidian");var Xl=class extends vt{constructor(){super(...arguments);this.saved=!1}display(){this.titleEl.createSpan({text:"Set Sources"}),new Un.Setting(this.contentEl).setName("A source could not be found for some imported monsters. Do you wish to manually add one?").addText(t=>{t.setPlaceholder("Unknown").onChange(n=>{this.source=n})}),this.buildButtons(this.contentEl)}buildButtons(t){new Un.Setting(t).addButton(n=>n.setCta().setIcon("checkmark").setTooltip("Save").onClick(()=>{this.saved=!0,this.close()})).addExtraButton(n=>n.setIcon("cross").setTooltip("Cancel").onClick(()=>{this.close()}))}onOpen(){this.display()}},yy=async i=>new Promise(e=>{let t=new Xl(i);t.onClose=()=>{t.saved||e(null),e(t.source)},t.open()}),Wa=class{constructor(e){this.plugin=e;this.workers=new Map}async import(e,t){return new Promise(n=>{let a=new Zl,s=q();this.workers.set(s,a),a.onmessage=async r=>{let{monsters:o}=r.data??{monsters:[]};if(o){new Un.Notice(`Successfully imported ${o.length} Monsters`);let l=o.filter(d=>d.source=="Unknown"||!d.source),c;l.length&&(c=await yy(this.plugin))&&l.forEach(d=>d.source=c)}a.terminate(),this.workers.delete(s),n(o)},a.onerror=r=>{new Un.Notice(`There was an error importing the file.
${r.message}`),a.terminate(),this.workers.delete(s),n([])},a.postMessage({files:e,source:t})})}};var er=require("obsidian");var Mt=require("obsidian");function vy(i){re(i,"svelte-1m3i208",".top-level.svelte-1m3i208.svelte-1m3i208{display:flex;flex-flow:column nowrap}textarea.svelte-1m3i208.svelte-1m3i208{flex-grow:1;height:500px;max-height:50vh}.json.svelte-1m3i208.svelte-1m3i208{margin-bottom:1rem;display:flex;justify-content:flex-start;align-items:center}.json.svelte-1m3i208>div.svelte-1m3i208{border-radius:4px;margin:5px 0px}.active.svelte-1m3i208.svelte-1m3i208{background-color:var(--background-secondary-alt)}.buttons.svelte-1m3i208.svelte-1m3i208{margin-top:1rem;display:flex;justify-content:flex-end;align-items:center}")}function hf(i){let e,t,n,a;return{c(){e=k("textarea"),e.value=t=i[6](),g(e,"class","svelte-1m3i208")},m(s,r){D(s,e,r),i[11](e),n||(a=H(e,"blur",i[12]),n=!0)},p:N,d(s){s&&A(e),i[11](null),n=!1,a()}}}function ky(i){let e,t,n,a,s,r,o,l,c,d,h,u=i[0],f,m,p,y,w,_,O,E,S,v=hf(i);return{c(){e=k("div"),t=k("h2"),t.textContent="Edit Monster",n=W(),a=k("div"),s=k("div"),r=k("div"),l=W(),c=k("div"),h=W(),v.c(),f=W(),m=k("div"),p=k("div"),w=W(),_=k("div"),g(r,"class","svelte-1m3i208"),oe(r,"active",!i[0]),g(c,"class","svelte-1m3i208"),oe(c,"active",i[0]),g(s,"class","json svelte-1m3i208"),g(a,"class","top-level svelte-1m3i208"),g(m,"class","buttons svelte-1m3i208"),g(e,"class","edit-monster-modal")},m(x,P){D(x,e,P),b(e,t),b(e,n),b(e,a),b(a,s),b(s,r),b(s,l),b(s,c),b(a,h),v.m(a,null),b(e,f),b(e,m),b(m,p),b(m,w),b(m,_),E||(S=[ee(o=i[3].call(null,r)),H(r,"click",i[9]),ee(d=i[2].call(null,c)),H(c,"click",i[10]),ee(y=i[4].call(null,p)),ee(O=i[5].call(null,_))],E=!0)},p(x,[P]){P&1&&oe(r,"active",!x[0]),P&1&&oe(c,"active",x[0]),P&1&&j(u,u=x[0])?(v.d(1),v=hf(x),v.c(),v.m(a,null)):v.p(x,P)},i:N,o:N,d(x){x&&A(e),v.d(x),E=!1,ce(S)}}}function wy(i,e,t){let n=Pe(),{monster:a={}}=e,s=!1,r,o=w=>{new Mt.ExtraButtonComponent(w).setIcon("code-glyph").setTooltip("JSON")},l=w=>{new Mt.ExtraButtonComponent(w).setIcon("lines-of-text").setTooltip("YAML")},c=w=>{new Mt.ButtonComponent(w).setIcon("checkmark").setTooltip("Save Changes").onClick(()=>{if(s)try{s?t(8,a=JSON.parse(r.value)):t(8,a=(0,Mt.parseYaml)(r.value))}catch(_){console.error(_),new Mt.Notice(`There was an error saving the creaturen
${_.message}`);return}n("save",a)})},d=w=>{new Mt.ExtraButtonComponent(w).setIcon("cross").setTooltip("Cancel").onClick(()=>{n("cancel")})};function h(){return s?JSON.stringify(a,null,2):!a||!Object.keys(a??{})?.length?"":(0,Mt.stringifyYaml)(a).trim()}function u(){try{s?t(8,a=JSON.parse(r.value)):t(8,a=(0,Mt.parseYaml)(r.value))}catch(w){console.error(w)}}let f=()=>t(0,s=!1),m=()=>t(0,s=!0);function p(w){Re[w?"unshift":"push"](()=>{r=w,t(1,r)})}let y=()=>u();return i.$$set=w=>{"monster"in w&&t(8,a=w.monster)},[s,r,o,l,c,d,h,u,a,f,m,p,y]}var ql=class extends U{constructor(e){super(),G(this,e,wy,ky,j,{monster:8},vy)}},df=ql;var Vn=class extends vt{constructor(t,n={}){super(t);this.monster=n}onOpen(){this._instance=new df({target:this.contentEl,props:{monster:this.monster}}),this._instance.$on("cancel",()=>{this.close()}),this._instance.$on("save",async({detail:t})=>{if(!t.name){new er.Notice("Creatures must be given a name.");return}await this.plugin.updateMonster(this.monster,t),this.close()})}onClose(){}close(){this._instance&&this._instance.$destroy(),super.close()}},Js=class extends vt{constructor(t,n){super(t);this.monster=n}async display(){er.Platform.isMobile||(this.contentEl.style.maxWidth="85vw"),new qt({container:this.contentEl,monster:this.monster,plugin:this.plugin})}onOpen(){this.display()}};var _y=[{type:"inline",id:q(),properties:[],hasRule:!0,nested:[{type:"group",id:q(),properties:["name","description","aspects","temporaryAspects"],nested:[{type:"heading",id:q(),properties:["name"],conditioned:!0,size:1},{type:"text",id:q(),properties:["description"],conditioned:!0,markdown:!0,text:null,dice:!1},{type:"text",id:q(),properties:["aspects"],markdown:!0,text:null,dice:!1,conditioned:!0,heading:"Aspects"},{type:"text",id:q(),properties:["temporaryAspects"],markdown:!0,text:null,dice:!1,conditioned:!0,heading:"Temporary Aspects"}],conditioned:!0},{type:"image",id:q(),properties:["image"],conditioned:!0}]},{type:"table",id:q(),properties:["stress"],headers:["Physical","Mental"],calculate:!1,hasRule:!0,conditioned:!0},{type:"traits",id:q(),properties:["consequences"],conditioned:!0,heading:"Consequences"},{type:"traits",id:q(),properties:["skills"],conditioned:!0,hasRule:!1,heading:"Skills"},{type:"traits",id:q(),properties:["stunts"],markdown:!0,dice:!1,conditioned:!0,heading:"Stunts"},{type:"traits",id:q(),properties:["items"],heading:"Items",conditioned:!0,markdown:!0,dice:!1},{type:"traits",id:q(),properties:["extras"],heading:"Extras",conditioned:!0,markdown:!0,dice:!1}],uf={blocks:_y,id:"basic-fate-core-layout",name:"Basic Fate Core Layout",edited:!1};var ST=[{type:"inline",id:q(),properties:[],hasRule:!0,nested:[{type:"group",id:q(),properties:["name","description","aspects","temporaryAspects"],nested:[{type:"heading",id:q(),properties:["name"],conditioned:!0,size:1},{type:"text",id:q(),properties:["description"],conditioned:!0,markdown:!0,text:null,dice:!1},{type:"text",id:q(),properties:["aspects"],markdown:!0,text:null,dice:!1,conditioned:!0,heading:"Aspects"},{type:"text",id:q(),properties:["temporaryAspects"],markdown:!0,text:null,dice:!1,conditioned:!0,heading:"Temporary Aspects"}],conditioned:!0},{type:"image",id:q(),properties:["image"],conditioned:!0}]},{type:"table",id:q(),properties:["stress"],headers:["Physical","Mental"],calculate:!1,hasRule:!0,conditioned:!0},{type:"traits",id:q(),properties:["consequences"],conditioned:!0,heading:"Consequences"},{type:"traits",id:q(),properties:["skills"],conditioned:!0,hasRule:!1,heading:"Skills"},{type:"traits",id:q(),properties:["stunts"],markdown:!0,dice:!1,conditioned:!0,heading:"Stunts"},{type:"traits",id:q(),properties:["items"],heading:"Items",conditioned:!0,markdown:!0,dice:!1},{type:"traits",id:q(),properties:["extras"],heading:"Extras",conditioned:!0,markdown:!0,dice:!1}],ff={blocks:[{type:"inline",id:"e9b8483aeafa",properties:[],nested:[{type:"property",id:"2b596a6919fb",properties:["name"],fallback:"-",markdown:!0,dice:!1,conditioned:!0,display:" "},{type:"property",id:"98389a48f808",properties:["level"],fallback:"-",display:" ",conditioned:!0,markdown:!0,dice:!1}],hasRule:!0},{type:"group",id:"4b3a6809a938",properties:[],nested:[{type:"inline",id:"289a4b787968",properties:[],nested:[{type:"property",id:"694a3888b859",properties:["rare_01"],fallback:"-",conditioned:!0,markdown:!0},{type:"property",id:"590a88988ae8",properties:["rare_02"],fallback:"-",conditioned:!0,markdown:!0},{type:"property",id:"9a9be808699a",properties:["rare_03"],fallback:"-",conditioned:!0,markdown:!0},{type:"property",id:"2988db1a685a",properties:["rare_04"],fallback:"-",conditioned:!0,markdown:!0},{type:"property",id:"ba891ba8cbeb",properties:["alignment"],fallback:" ",display:" ",conditioned:!0,markdown:!0},{type:"property",id:"ebf9883938a8",properties:["size"],fallback:" ",display:" ",conditioned:!0,markdown:!0},{type:"property",id:"dabaf9e9fb68",properties:["trait_01"],fallback:" ",display:" ",conditioned:!0,markdown:!0},{type:"property",id:"e81a6aeadbf9",properties:["trait_02"],fallback:" ",display:" ",conditioned:!0,markdown:!0},{type:"property",id:"fa7919caabbb",properties:["trait_03"],fallback:"-",conditioned:!0,display:" ",markdown:!0},{type:"property",id:"58c9c8580b68",properties:["trait_04"],fallback:"-",conditioned:!0,display:" ",markdown:!0},{type:"property",id:"da894a7b8849",properties:["trait_05"],fallback:"-",display:" ",conditioned:!0,markdown:!0},{type:"property",id:"fb6b4b6bab49",properties:["trait_06"],fallback:"-",display:" ",conditioned:!0,markdown:!0},{type:"property",id:"480a5bfafb88",properties:["trait_07"],fallback:"-",display:" ",conditioned:!0,markdown:!0}],hasRule:!0,conditioned:!0}]},{type:"group",id:"5999ea79ca3b",properties:[],nested:[{type:"traits",id:"9a9af9fbe959",properties:["perception"],fallback:"-",heading:" ",conditioned:!0,dice:!0,markdown:!0,headingProp:!0},{type:"property",id:"ba28f9384918",properties:["languages"],fallback:"-",display:"Language",conditioned:!0,markdown:!0},{type:"traits",id:"a8f8187b89fb",properties:["skills"],fallback:"-",markdown:!0,dice:!0,conditioned:!0,heading:" "},{type:"table",id:"b82b0a1a9969",properties:["abilityMods"],headers:["Str","Dex","Con","Int","Wis","Cha"],calculate:!1,fallback:"-",conditioned:!0,dice:!0},{type:"traits",id:"e96ba9d8a80a",properties:["abilities_top"],fallback:"-",conditioned:!0,dice:!0,markdown:!0,heading:" ",hasRule:!1}],hasRule:!0},{type:"group",id:"faaa08993a98",properties:[],nested:[{type:"traits",id:"68ca69891bea",properties:["armorclass"],fallback:"-",heading:"",conditioned:!0,dice:!0,markdown:!0},{type:"traits",id:"9b1998e9a8da",properties:["health"],fallback:"-",heading:"",conditioned:!0,dice:!0,markdown:!0},{type:"traits",id:"ca2bf968987b",properties:["abilities_mid"],fallback:"-",heading:"",conditioned:!0,dice:!0,markdown:!0,hasRule:!1}],hasRule:!0},{type:"group",id:"cbeabaf93b58",properties:[],nested:[{type:"property",id:"0b4809ba0b29",properties:["speed"],fallback:"-",display:"Speed",conditioned:!0,markdown:!0,dice:!1},{type:"traits",id:"882bc9aa0898",properties:["attacks"],fallback:"-",conditioned:!0,dice:!0,markdown:!0,headingProp:!1,heading:""},{type:"traits",id:"6919b8996939",properties:["spellcasting"],fallback:"-",heading:" ",markdown:!0,dice:!0,conditioned:!0},{type:"traits",id:"aacb399a3b58",properties:["abilities_bot"],fallback:"-",conditioned:!0,dice:!0,markdown:!0,hasRule:!1}],hasRule:!0},{type:"text",id:"1b195a894b58",properties:["token"],text:null,fallback:"",heading:"Show to Players",conditioned:!0,markdown:!0},{type:"image",id:"1bba89582b29",properties:["token"],fallback:"",conditioned:!0,hasRule:!0},{type:"property",id:"88e97a485b79",properties:["sourcebook"],fallback:"-",conditioned:!0,markdown:!0,dice:!1,display:" Source:"}],name:"Basic Pathfinder 2e Layout",id:"path-2e-block",version:2,diceParsing:[{regex:/\((\d+d\d+(?:\s*[+-]\s*\d+)?)\)/.source,parser:`const [, text] = matches;
return ["(", { text }, ")"];`,id:q(),desc:"(1d8+3)"},{regex:/(\w+?) ([+-])(\d+)/.source,parser:`let [, initial, sign, number] = matches;
let mult = 1;
if (sign === "-") {
mult = -1;
}
let text;
if (!isNaN(Number(number))) {
text = \`1d20+\${mult * Number(number)}\`;
}
return [original, " (", { text }, ")"];`,id:q(),desc:"longsword +15"}]};var mf={blocks:[{type:"inline",id:"2a9b58ba0ab8",properties:[],nested:[{type:"heading",id:"c89a2ae859f8",properties:["name"],size:1,fallback:"Creature"},{type:"image",id:"e83a48f858b8",properties:["image"],fallback:"TILE ART",conditioned:!0,hasRule:!1}],hasRule:!0},{type:"group",id:"fabb0b884838",properties:[],nested:[{type:"text",id:"5b7bc86b6919",properties:["flavor_text"],text:null,fallback:"-",conditioned:!0,markdown:!0,hasRule:!1}],cls:"flavor-text",hasRule:!0},{type:"group",id:"1a6999887a69",properties:[],nested:[{type:"javascript",id:"d958f898e9fa",conditioned:!1,code:`var base_string = \`\${monster.level} level \${monster.role}\`;
if (monster.size) {
base_string = \`\${monster.size} \${base_string}\`;
}
const monster_strength = document.createElement("p");
monster_strength.innerHTML = base_string;
monster_strength.classList.add("monster-strength");
if (monster.type) {
const type = \`[\${monster.type}]\`;
const type_block = document.createElement("span");
type_block.classList.add("type");
type_block.innerText = type;
monster_strength.append(type_block)
}
return monster_strength;`},{type:"property",id:"780809c90898",properties:["initiative"],fallback:"+0",display:"Initiative: ",markdown:!0},{type:"property",id:"88eb4a6aea0b",properties:["vulnerability"],fallback:"-",display:"Vulnerability: ",conditioned:!0,markdown:!0}],hasRule:!0},{type:"group",id:"999bb81b7aab",properties:[],nested:[{type:"traits",id:"996ab9d9a86a",properties:["actions"],fallback:"-",markdown:!0,hasRule:!0},{type:"traits",id:"69ca5b7a3898",properties:["traits"],fallback:"-",conditioned:!0,markdown:!0,hasRule:!0},{type:"traits",id:"c8794b580948",properties:["triggered_actions"],fallback:"-",headingProp:!1,heading:"Triggered Abilities",conditioned:!0,markdown:!0,hasRule:!0},{type:"traits",id:"aa1a3a2abb19",properties:["nastier_traits"],fallback:"-",headingProp:!1,heading:"Nastier Specials",conditioned:!0,subheadingText:"",markdown:!0,hasRule:!0}],hasRule:!1,cls:"abilities"},{type:"group",id:"8a7969a96a48",properties:[],nested:[{type:"javascript",id:"f99b8b1bf908",conditioned:!1,code:`const getStatLine = (statName, statValue) => {
const statLine = document.createElement("div");
const statClass = \`\${statName.toLowerCase()}-block\`;
statLine.classList.add("defense-line");
statLine.classList.add(statClass);
const statNameBlock = document.createElement("span");
statNameBlock.classList.add("defense-name");
statNameBlock.innerText = statName.toUpperCase();
const statValueBlock = document.createElement("span");
statValueBlock.classList.add("defense-value");
if (statName === "HP" && monster.mook !== undefined) {
statValue = \`\${statValue} (mook)\`;
}
statValueBlock.innerText = statValue;
statLine.append(statNameBlock);
statLine.append(statValueBlock);
return statLine;
}
const statFullBlock = document.createElement("div");
statFullBlock.classList.add("defense-block");
statFullBlock.append(getStatLine("AC", monster.ac));
statFullBlock.append(getStatLine("PD", monster.pd));
statFullBlock.append(getStatLine("MD", monster.md));
statFullBlock.append(getStatLine("HP", monster.hp));
return statFullBlock;
`},{type:"property",id:"6aa9684a08db",properties:["mook"],fallback:"-",display:"Mook",conditioned:!0,callback:"return `Kill one _${monster.name}_ for every ${monster.hp} damage dealt to the mob`",markdown:!0}],cls:"monster-stats"},{type:"group",id:"a96bcabad818",properties:[],nested:[{type:"text",id:"4a0b6a59385a",properties:["description"],text:null,conditioned:!0,fallback:"-",markdown:!0}],cls:"monster-description"}],name:"Basic 13th Age Monster Layout",id:"basic-13th-age-monster-block"};var gf={blocks:[{type:"group",id:"0a58d8280a7b",properties:[],nested:[{type:"image",id:"48db7bfb6809",properties:["Token"],fallback:"-",conditioned:!0}]},{type:"group",id:"b8e9ea5a5b68",properties:[],nested:[{type:"inline",id:"7a3a6b3ad9d9",properties:[],nested:[{type:"heading",id:"0a982a598818",properties:["Name"],size:1,fallback:"-"},{type:"property",id:"cb1a28885afb",properties:["Type"],fallback:"Unknown.",conditioned:!1,display:" "}]},{type:"subheading",id:"4b3848590a48",properties:["TitleOfMob","FlavorText","TypeOfBoss"],separator:" , ",fallback:"-",conditioned:!0}],hasRule:!0},{type:"group",id:"fb98fb48f93a",properties:[],nested:[{type:"inline",id:"3898c8ea0bf9",properties:[],nested:[{type:"property",id:"a8980a09e92a",properties:["BadassRank"],fallback:" ",conditioned:!1,display:" "},{type:"property",id:"c83a18fb2ac9",properties:["MovementType"],fallback:" ",display:" ",callback:`const Move = monster.MovementType;
const Types = ['move', 'flight', 'swim', 'burrow', 'teleport', 'leap', 'hover', 'climb',];
const Symbols = ['\u2B47', '\u{E1502}', '\u{E1504}', '\u{E1506}', '\u{E1503}', '\u{E1501}', '\u{E1500}', '\u{E1505}',];
let Output = '';
for (let i = 0; i < Types.length; i++) {
for (let j = 0; j <= 10; j++) {
if (Move.includes(\`\${Types[i]} \${j}\`)) {
Output += \`\${Symbols[i]} \${j} Square\${j > 1 ? 's' : ''}\\n\`;
}
}
}
return Output.trim();`},{type:"inline",id:"59e8dad80b6b",properties:[],nested:[{type:"property",id:"d8d98b8b6bfa",properties:["Health"],fallback:"Dead",conditioned:!0,display:"Health:"},{type:"property",id:"c969ebe85aca",properties:["Shield"],fallback:"N/A",display:"Shield:",conditioned:!0},{type:"property",id:"b95a6a68e89b",properties:["Armor"],fallback:"N/A",conditioned:!0,display:"Armor:"},{type:"property",id:"cb4a68db0ad8",properties:["Traits"],fallback:"N/A",display:"Traits:",conditioned:!0,markdown:!0}],cls:"shat"}],cls:"bomshat"}]},{type:"group",id:"2a99795abbb8",properties:[],nested:[{type:"property",id:"1a4aaa3b78e9",properties:["Weapon"],fallback:"N/A",conditioned:!1,dice:!0,display:"Weapon:"},{type:"property",id:"4a8b3ae86bb8",properties:["Special"],fallback:"-",display:"Special:",dice:!0,markdown:!0},{type:"property",id:"d85b69696908",properties:["SuperSpecial"],fallback:"-",display:"Additional Effects:",conditioned:!0,markdown:!0,dice:!0,hasRule:!0}],hasRule:!1},{type:"group",id:"8ae89989a83b",properties:[],nested:[{type:"traits",id:"cb28b8484afa",properties:["Actions"],fallback:"-",heading:"Actions",conditioned:!0,hasRule:!1,markdown:!0,dice:!0},{type:"traits",id:"5beae9c80838",properties:["Mayhem"],fallback:"-",conditioned:!0,heading:"\u{E1531} Mayhem",dice:!0,markdown:!0},{type:"traits",id:"ea6b78db3b59",properties:["Loot"],fallback:"-",heading:"Loot",conditioned:!0,dice:!0,markdown:!0}],hasRule:!1,cls:""},{type:"group",id:"283a2b39ca3a",properties:[],nested:[{type:"text",id:"8a78b8393819",properties:["Image"],text:null,fallback:"-",heading:"",conditioned:!0},{type:"image",id:"2b09ea3958fa",properties:["Image"],fallback:"-",conditioned:!0}],cls:"biggies"}],id:"basic-bnb-bestiary-layout",name:"Basic BnB Bestiary Layout",edited:!1};var pf={blocks:[{type:"inline",id:"aabbab5bb92a",properties:[],nested:[{type:"image",id:"a80b9a1a791b",properties:["Token"],fallback:"-",conditioned:!0}]},{type:"inline",id:"19788a293819",properties:[],nested:[{type:"heading",id:"bb98085bdbab",properties:["Name"],fallback:"Unknown",conditioned:!1,size:1},{type:"property",id:"f97b886ba819",properties:["Type"],fallback:"Unknown",display:"",conditioned:!0,markdown:!0,dice:!1}],hasRule:!0},{type:"group",id:"c81968abe80b",properties:[],nested:[{type:"inline",id:"4809ea49d92a",properties:[],nested:[{type:"inline",id:"48f93a487988",properties:[],nested:[{type:"property",id:"4dc7e12b6c6c",properties:["MovementType"],fallback:"-",display:" ",conditioned:!0,callback:`const Move = monster.MovementType;
const Types = ['move', 'flight', 'swim', 'burrow', 'teleport', 'leap', 'hover', 'climb',];
const Symbols = ['\u2B47', '\u{E1502}', '\u{E1504}', '\u{E1506}', '\u{E1503}', '\u{E1501}', '\u{E1500}', '\u{E1505}',];
let Output = '';
for (let i = 0; i < Types.length; i++) {
for (let j = 0; j <= 10; j++) {
if (Move.includes(\`\${Types[i]} \${j}\`)) {
Output += \`\${Symbols[i]} \${j} Square\${j > 1 ? 's' : ''}\\n\`;
}
}
}
return Output.trim();`,markdown:!1,hasRule:!1},{type:"inline",id:"294ad96ad9ba",properties:[],nested:[{type:"property",id:"4a3beb0948e9",properties:["Health"],fallback:"-",display:"Health:",conditioned:!0},{type:"property",id:"7ac8d84999bb",properties:["Regen"],fallback:"-",display:"HP Regen:",conditioned:!0,dice:!0},{type:"property",id:"ea8b1b5bfb4a",properties:["Shield"],fallback:"",display:"Shield:",conditioned:!0},{type:"property",id:"596b79ab7b6a",properties:["Charge"],fallback:"-",display:"SH Charge:",conditioned:!0,dice:!0},{type:"property",id:"f8aa6b4a396a",properties:["Armor"],fallback:"-",display:"Armor:",conditioned:!0},{type:"property",id:"8a2a6a691918",properties:["Repair"],fallback:"-",display:"AR Repair:",conditioned:!0,dice:!0},{type:"property",id:"2b5b9b0b689b",properties:["Traits"],fallback:"-",conditioned:!0,display:"Traits:"}],cls:"familiar-tams"}],cls:""}],hasRule:!1,cls:"move-shat"},{type:"table",id:"cb4bdb99abdb",properties:["Abilityscore"],headers:["ACC","DMG","SPD","MST"],calculate:!1,fallback:"-",conditioned:!0,dice:!0},{type:"property",id:"494b58086a5a",properties:["Damage"],fallback:"-",display:"Damage:",conditioned:!0,dice:!0,hasRule:!0}],hasRule:!1,conditioned:!0},{type:"group",id:"eaa94ab86ba9",properties:[],nested:[{type:"property",id:"3a4a88da394a",properties:["Weapon"],fallback:"N/A",markdown:!0,display:"Weapon:",dice:!0,conditioned:!0},{type:"property",id:"5a8b7b08b8ca",properties:["Special"],fallback:"N/A",display:"Special:",markdown:!0,hasRule:!1,dice:!0,conditioned:!0},{type:"traits",id:"b9da9b7a6958",properties:["SuperSpecial"],fallback:"-",conditioned:!0,dice:!0,markdown:!0}],hasRule:!0,conditioned:!0},{type:"group",id:"799ada4bc8c9",properties:[],nested:[{type:"table",id:"5a2bdb7819b8",properties:["Hit-Crit"],headers:["2-7","8-15","16+"],calculate:!1,fallback:"-",conditioned:!0,dice:!0},{type:"traits",id:"ea68aaba0819",properties:["Actions"],fallback:"-",heading:"Actions",conditioned:!0,markdown:!0,dice:!0},{type:"traits",id:"d979ba0a69da",properties:["Skills"],fallback:"-",headingProp:!1,heading:"Skills",conditioned:!0,markdown:!0,dice:!0}],conditioned:!1,hasRule:!0},{type:"image",id:"999b68298919",properties:["Image"],fallback:"-",conditioned:!0}],id:"basic-bnb-familiar-layout",name:"Basic BnB Familiar Layout",edited:!1};var gn=[ni,uf,ff,mf,gf,pf];var Jf=It(Fs());var pn=require("obsidian");function Oy(i){re(i,"svelte-xx603q",".pagination.svelte-xx603q.svelte-xx603q{display:flex;justify-content:space-between;align-items:center;gap:1rem}.paginated-container.svelte-xx603q.svelte-xx603q{display:flex;align-items:center;gap:1rem}.paginated.svelte-xx603q.svelte-xx603q{display:flex;align-items:center;gap:1rem}.clickable-icon.active.svelte-xx603q.svelte-xx603q{background-color:var(--background-modifier-hover)}.slicer.svelte-xx603q.svelte-xx603q{display:flex;align-items:center;gap:0.5rem}.slicer.svelte-xx603q .per.svelte-xx603q{color:var(--text-muted);font-size:var(--font-smallest)}")}function bf(i,e,t){let n=i.slice();return n[16]=e[t],n}function Sy(i){let e,t=i[16]+"",n,a,s,r;function o(){return i[14](i[16])}return{c(){e=k("span"),n=me(t),a=W(),g(e,"class","clickable-icon svelte-xx603q"),oe(e,"active",i[16]==i[3])},m(l,c){D(l,e,c),b(e,n),b(e,a),s||(r=H(e,"click",o),s=!0)},p(l,c){i=l,c&16&&t!==(t=i[16]+"")&&we(n,t),c&24&&oe(e,"active",i[16]==i[3])},d(l){l&&A(e),s=!1,r()}}}function xy(i){let e,t,n;return{c(){e=k("span"),e.textContent="..."},m(a,s){D(a,e,s),t||(n=H(e,"click",i[13]),t=!0)},p:N,d(a){a&&A(e),t=!1,n()}}}function yf(i){let e;function t(s,r){return s[16]==null?xy:Sy}let n=t(i,-1),a=n(i);return{c(){a.c(),e=Oe()},m(s,r){a.m(s,r),D(s,e,r)},p(s,r){n===(n=t(s,r))&&a?a.p(s,r):(a.d(1),a=n(s),a&&(a.c(),a.m(e.parentNode,e)))},d(s){a.d(s),s&&A(e)}}}function Ty(i){let e,t,n,a,s,r,o,l,c,d,h,u,f,m,p,y,w,_=i[4],O=[];for(let E=0;E<_.length;E+=1)O[E]=yf(bf(i,_,E));return{c(){e=k("div"),t=k("div"),n=k("div"),s=W(),r=k("span"),r.textContent="per page",o=W(),l=k("div"),c=k("div"),h=W(),u=k("div");for(let E=0;E<O.length;E+=1)O[E].c();f=W(),m=k("div"),g(r,"class","per svelte-xx603q"),g(t,"class","slicer svelte-xx603q"),g(c,"class","previous"),g(u,"class","paginated svelte-xx603q"),g(m,"class","next"),g(l,"class","paginated-container svelte-xx603q"),g(e,"class","pagination svelte-xx603q")},m(E,S){D(E,e,S),b(e,t),b(t,n),b(t,s),b(t,r),b(e,o),b(e,l),b(l,c),b(l,h),b(l,u);for(let v=0;v<O.length;v+=1)O[v]&&O[v].m(u,null);b(l,f),b(l,m),y||(w=[ee(a=i[5].call(null,n)),ee(d=i[6].call(null,c)),ee(p=i[7].call(null,m))],y=!0)},p(E,[S]){if(S&280){_=E[4];let v;for(v=0;v<_.length;v+=1){let x=bf(E,_,v);O[v]?O[v].p(x,S):(O[v]=yf(x),O[v].c(),O[v].m(u,null))}for(;v<O.length;v+=1)O[v].d(1);O.length=_.length}},i:N,o:N,d(E){E&&A(e),Xe(O,E),y=!1,ce(w)}}}function Cy(i,e,t){let n,a,s,r=N,o=()=>(r(),r=Tt(p,I=>t(3,s=I)),p),l,c=N,d=()=>(c(),c=Tt(y,I=>t(12,l=I)),y),h,u=N,f=()=>(u(),u=Tt(m,I=>t(15,h=I)),m);i.$$.on_destroy.push(()=>r()),i.$$.on_destroy.push(()=>c()),i.$$.on_destroy.push(()=>u());let{slice:m}=e;f();let{page:p}=e;o();let{pages:y}=e;d();let w=I=>{new pn.DropdownComponent(I).addOptions({10:"10",25:"25",50:"50",100:"100",200:"200"}).setValue(`${h}`).onChange(R=>Te(m,h=Number(R),h))},_,O=I=>{t(9,_=new pn.ExtraButtonComponent(I).setIcon("chevron-left").setDisabled(s==1).onClick(()=>{Te(p,s=s-1,s)}))},E,S=I=>{t(10,E=new pn.ExtraButtonComponent(I).setIcon("chevron-right").setDisabled(s==l).onClick(()=>{Te(p,s=Math.min(s+1,l),s)}))},v=I=>{let R=new pn.Menu;for(let T of n)R.addItem($=>{$.setTitle(`${T}`).onClick(()=>{Te(p,s=T,s)})});R.showAtMouseEvent(I)},x=I=>v(I),P=I=>Te(p,s=I,s);return i.$$set=I=>{"slice"in I&&f(t(0,m=I.slice)),"page"in I&&o(t(1,p=I.page)),"pages"in I&&d(t(2,y=I.pages))},i.$$.update=()=>{i.$$.dirty&4096&&t(11,n=[...Array(l).keys()].map(I=>I+1)),i.$$.dirty&5640&&E&&_&&(E.setDisabled(s==l),_.setDisabled(s==1)),i.$$.dirty&6152&&t(4,a=n.reduce((I,R)=>(R==1||s==1&&(R==2||R==3)||R==l||s==l&&(R==l-1||R==l-2)||R==s-1||R==s||R==s+1?I.push(R):I.length>=1&&I[I.length-1]!=null&&I.push(null),I),[]))},[m,p,y,s,a,w,O,S,v,_,E,n,l,x,P]}var Ul=class extends U{constructor(e){super(),G(this,e,Cy,Ty,j,{slice:0,page:1,pages:2},Oy)}},vf=Ul;var Yn=require("obsidian");var xi=Ne(""),bn=Ne([]),tr="None",kf=pt([xi,bn],([i,e])=>(i?.length?1:0)+(e?.length?1:0));function Ay(i){let e,t,n,a;return{c(){e=k("div"),g(e,"class","creature")},m(s,r){D(s,e,r),n||(a=ee(t=i[0].call(null,e)),n=!0)},p:N,i:N,o:N,d(s){s&&A(e),n=!1,a()}}}function Dy(i,e,t){let n;Se(i,xi,c=>t(3,n=c));let{item:a}=e,s=Pe(),r=Ot("plugin"),o,l=c=>{t(2,o=new Yn.Setting(c));let d,h=!1;if(Array.isArray(a.source)){let u=a.source.slice(0,4);a.source.length>4&&(u.push(`and ${a.source.length-4} more`),h=!0),d=ye(u,0,", ",!1)}else d=a.source;if(o.setDesc(d??""),h&&o.descEl.setAttr("aria-label",ye(a.source,0,", ",!1)),ve.isLocal(a.name))o.addExtraButton(u=>{u.setIcon("pencil").setTooltip("Edit").onClick(()=>{new Vn(r,a).open()})}).addExtraButton(u=>{u.setIcon("trash").setTooltip("Delete").onClick(async()=>{await r.deleteMonsters(a.name)})});else if(a.path){let u=r.app.vault.getFileByPath(a.path);if(!u)return;o.addExtraButton(f=>{f.setIcon("file-symlink").onClick(async()=>{await r.app.workspace.getLeaf().openFile(u),r.app.setting.close()})})}o.addExtraButton(u=>{u.setIcon("info").setTooltip("View").onClick(()=>{new Js(r,a).open()})})};return i.$$set=c=>{"item"in c&&t(1,a=c.item)},i.$$.update=()=>{if(i.$$.dirty&14&&o)if(n.length){let c=(0,Yn.prepareSimpleSearch)(n)(a.name);c&&(o.nameEl.empty(),(0,Yn.renderMatches)(o.nameEl,a.name,c.matches))}else o.setName(a.name)},[l,a,o,n]}var Vl=class extends U{constructor(e){super(),G(this,e,Dy,Ay,j,{item:1})}},wf=Vl;var sr=require("obsidian");var ir=require("obsidian");function Py(i){re(i,"svelte-1xutc2s",".search.svelte-1xutc2s,.search.svelte-1xutc2s input{width:100%}")}function My(i){let e,t,n,a;return{c(){e=k("div"),g(e,"class","search svelte-1xutc2s")},m(s,r){D(s,e,r),n||(a=ee(t=i[1].call(null,e)),n=!0)},p:N,i:N,o:N,d(s){s&&A(e),n=!1,a()}}}function Ey(i,e,t){let n,a=N,s=()=>(a(),a=Tt(r,c=>t(3,n=c)),r);i.$$.on_destroy.push(()=>a());let{filter:r}=e;s();let{placeholder:o}=e,l=c=>{let d=new ir.SearchComponent(c).setPlaceholder(o).onChange((0,ir.debounce)(h=>{Te(r,n=h,n)},10));r.subscribe(h=>{(!h||!h.length)&&d.setValue("")})};return i.$$set=c=>{"filter"in c&&s(t(0,r=c.filter)),"placeholder"in c&&t(2,o=c.placeholder)},[r,l,o]}var Yl=class extends U{constructor(e){super(),G(this,e,Ey,My,j,{filter:0,placeholder:2},Py)}},_f=Yl;function Qy(i){re(i,"svelte-66wdl1","div.svelte-66wdl1{display:inline-block;vertical-align:middle;margin:0 3pt;border-width:calc(1em / 5);border-style:solid;border-radius:50%;animation:var(--duration) infinite svelte-66wdl1-rotate}@keyframes svelte-66wdl1-rotate{100%{transform:rotate(360deg)}}")}function Iy(i){let e,t=`${i[0]} transparent ${i[0]}
${i[0]}`;return{c(){e=k("div"),Be(e,"--duration",i[1]),g(e,"class","svelte-66wdl1"),Be(e,"border-color",t),Be(e,"width",i[2]),Be(e,"height",i[2])},m(n,a){D(n,e,a)},p(n,[a]){a&2&&Be(e,"--duration",n[1]);let s=a&2;(s||a&3&&t!==(t=`${n[0]} transparent ${n[0]}
${n[0]}`))&&Be(e,"border-color",t),(s||a&6)&&Be(e,"width",n[2]),(s||a&6)&&Be(e,"height",n[2])},i:N,o:N,d(n){n&&A(e)}}}function Ry(i,e,t){let{color:n="cornflowerblue"}=e,{duration:a="1.5s"}=e,{size:s="1em"}=e;return i.$$set=r=>{"color"in r&&t(0,n=r.color),"duration"in r&&t(1,a=r.duration),"size"in r&&t(2,s=r.size)},[n,a,s]}var Gl=class extends U{constructor(e){super(),G(this,e,Ry,Iy,j,{color:0,duration:1,size:2},Qy)}},Kl=Gl;function nr(i){return Object.prototype.toString.call(i)==="[object Date]"}function Jl(i,e,t,n){if(typeof t=="number"||nr(t)){let a=n-t,s=(t-e)/(i.dt||1/60),r=i.opts.stiffness*a,o=i.opts.damping*s,l=(r-o)*i.inv_mass,c=(s+l)*i.dt;return Math.abs(c)<i.opts.precision&&Math.abs(a)<i.opts.precision?n:(i.settled=!1,nr(t)?new Date(t.getTime()+c):t+c)}else{if(Array.isArray(t))return t.map((a,s)=>Jl(i,e[s],t[s],n[s]));if(typeof t=="object"){let a={};for(let s in t)a[s]=Jl(i,e[s],t[s],n[s]);return a}else throw new Error(`Cannot spring ${typeof t} values`)}}function Of(i,e={}){let t=Ne(i),{stiffness:n=.15,damping:a=.8,precision:s=.01}=e,r,o,l,c=i,d=i,h=1,u=0,f=!1;function m(y,w={}){d=y;let _=l={};return i==null||w.hard||p.stiffness>=1&&p.damping>=1?(f=!0,r=Mi(),c=y,t.set(i=d),Promise.resolve()):(w.soft&&(u=1/((w.soft===!0?.5:+w.soft)*60),h=0),o||(r=Mi(),f=!1,o=Vi(O=>{if(f)return f=!1,o=null,!1;h=Math.min(h+u,1);let E={inv_mass:h,opts:p,settled:!0,dt:(O-r)*60/1e3},S=Jl(E,c,i,d);return r=O,c=i,t.set(i=S),E.settled&&(o=null),!E.settled})),new Promise(O=>{o.promise.then(()=>{_===l&&O()})}))}let p={set:m,update:(y,w)=>m(y(d,i),w),subscribe:t.subscribe,stiffness:n,damping:a,precision:s};return p}function Wy(i){let e,t=`rotate(${i[0].angle}deg) scale(${i[0].scale}) translate(${i[0].dx}px,
${i[0].dy}px)`,n,a=i[11].default,s=st(a,i,i[10],null);return{c(){e=k("span"),s&&s.c(),Be(e,"transform",t)},m(r,o){D(r,e,o),s&&s.m(e,null),n=!0},p(r,[o]){s&&s.p&&(!n||o&1024)&&ot(s,a,r,r[10],n?rt(a,r[10],o,null):lt(r[10]),null),o&1&&t!==(t=`rotate(${r[0].angle}deg) scale(${r[0].scale}) translate(${r[0].dx}px,
${r[0].dy}px)`)&&Be(e,"transform",t)},i(r){n||(M(s,r),n=!0)},o(r){Q(s,r),n=!1},d(r){r&&A(e),s&&s.d(r)}}}function Ny(i,e,t){let n,{$$slots:a={},$$scope:s}=e,{wiggle:r=!1}=e,{angle:o=0}=e,{scale:l=1}=e,{dx:c=0}=e,{dy:d=0}=e,{duration:h=200}=e,{stiffness:u=.05}=e,{damping:f=.1}=e,m={angle:0,scale:1,dx:0,dy:0},p=Of(m,{stiffness:u,damping:f});return Se(i,p,y=>t(0,n=y)),i.$$set=y=>{"wiggle"in y&&t(2,r=y.wiggle),"angle"in y&&t(3,o=y.angle),"scale"in y&&t(4,l=y.scale),"dx"in y&&t(5,c=y.dx),"dy"in y&&t(6,d=y.dy),"duration"in y&&t(7,h=y.duration),"stiffness"in y&&t(8,u=y.stiffness),"damping"in y&&t(9,f=y.damping),"$$scope"in y&&t(10,s=y.$$scope)},i.$$.update=()=>{i.$$.dirty&132&&r&&setTimeout(()=>t(2,r=!1),h),i.$$.dirty&124&&p.set(r?{scale:l,angle:o,dx:c,dy:d}:m)},[n,p,r,o,l,c,d,h,u,f,s,a]}var ec=class extends U{constructor(e){super(),G(this,e,Ny,Wy,j,{wiggle:2,angle:3,scale:4,dx:5,dy:6,duration:7,stiffness:8,damping:9})}},tc=ec;function Ly(i){let e,t,n=[i[0],{fill:"currentColor"},{viewBox:"0 0 16 16"}],a={};for(let s=0;s<n.length;s+=1)a=at(a,n[s]);return{c(){e=jt("svg"),t=jt("path"),g(t,"d","M3.646 9.146a.5.5 0 0 1 .708 0L8 12.793l3.646-3.647a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 0-.708zm0-2.292a.5.5 0 0 0 .708 0L8 3.207l3.646 3.647a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 0 0 0 .708z"),ri(e,a)},m(s,r){D(s,e,r),b(e,t)},p(s,[r]){ri(e,a=Wi(n,[r&1&&s[0],{fill:"currentColor"},{viewBox:"0 0 16 16"}]))},i:N,o:N,d(s){s&&A(e)}}}function $y(i,e,t){return i.$$set=n=>{t(0,e=at(at({},e),Ft(n)))},e=Ft(e),[e]}var ic=class extends U{constructor(e){super(),G(this,e,$y,Ly,j,{})}},nc=ic;function By(i){let e,t,n=[i[0],{viewBox:"0 0 24 24"},{fill:"currentColor"}],a={};for(let s=0;s<n.length;s+=1)a=at(a,n[s]);return{c(){e=jt("svg"),t=jt("path"),g(t,"d","M18.3 5.71a.996.996 0 0 0-1.41 0L12 10.59L7.11 5.7A.996.996 0 1 0 5.7 7.11L10.59 12L5.7 16.89a.996.996 0 1 0 1.41 1.41L12 13.41l4.89 4.89a.996.996 0 1 0 1.41-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4z"),ri(e,a)},m(s,r){D(s,e,r),b(e,t)},p(s,[r]){ri(e,a=Wi(n,[r&1&&s[0],{viewBox:"0 0 24 24"},{fill:"currentColor"}]))},i:N,o:N,d(s){s&&A(e)}}}function zy(i,e,t){return i.$$set=n=>{t(0,e=at(at({},e),Ft(n)))},e=Ft(e),[e]}var ac=class extends U{constructor(e){super(),G(this,e,zy,By,j,{})}},ar=ac;function Hy(i){let e,t,n=[i[0],{viewBox:"0 0 24 24"},{fill:"currentColor"}],a={};for(let s=0;s<n.length;s+=1)a=at(a,n[s]);return{c(){e=jt("svg"),t=jt("path"),g(t,"d","M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2S2 6.477 2 12s4.477 10 10 10Zm-4.906-3.68L18.32 7.094A8 8 0 0 1 7.094 18.32ZM5.68 16.906A8 8 0 0 1 16.906 5.68L5.68 16.906Z"),ri(e,a)},m(s,r){D(s,e,r),b(e,t)},p(s,[r]){ri(e,a=Wi(n,[r&1&&s[0],{viewBox:"0 0 24 24"},{fill:"currentColor"}]))},i:N,o:N,d(s){s&&A(e)}}}function Fy(i,e,t){return i.$$set=n=>{t(0,e=at(at({},e),Ft(n)))},e=Ft(e),[e]}var sc=class extends U{constructor(e){super(),G(this,e,Fy,Hy,j,{})}},rc=sc;var nt=i=>i instanceof Object?(i.label===void 0&&console.error(`MultiSelect option ${JSON.stringify(i)} is an object but has no label key`),i.label):`${i}`;function Na(i,e=null){if(!i?.style)return null;if(!["selected","option",null].includes(e)){console.error(`MultiSelect: Invalid key=${e} for get_style`);return}if(typeof i=="object"&&i.style){if(typeof i.style=="string")return i.style;if(typeof i.style=="object"){if(e&&e in i.style)return i.style[e];console.error(`Invalid style object for option=${JSON.stringify(i)}`)}}}var{Boolean:jy}=oa;function Zy(i){re(i,"svelte-1r2hsto",".svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect){position:relative;align-items:center;display:flex;cursor:text;box-sizing:border-box;border:var(--sms-border, 1pt solid lightgray);border-radius:var(--sms-border-radius, 3pt);background:var(--sms-bg);width:var(--sms-width);max-width:var(--sms-max-width);padding:var(--sms-padding, 0 3pt);color:var(--sms-text-color);font-size:var(--sms-font-size, inherit);min-height:var(--sms-min-height, 22pt);margin:var(--sms-margin)}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect.open){z-index:var(--sms-open-z-index, 4)}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect:focus-within){border:var(--sms-focus-border, 1pt solid var(--sms-active-color, cornflowerblue))}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect.disabled){background:var(--sms-disabled-bg, lightgray);cursor:not-allowed}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.selected){display:flex;flex:1;padding:0;margin:0;flex-wrap:wrap}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.selected > li){align-items:center;border-radius:3pt;display:flex;margin:2pt;line-height:normal;transition:0.3s;white-space:nowrap;background:var(--sms-selected-bg, rgba(0, 0, 0, 0.15));padding:var(--sms-selected-li-padding, 1pt 5pt);color:var(--sms-selected-text-color, var(--sms-text-color))}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.selected > li[draggable='true']){cursor:grab}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.selected > li.active){background:var(--sms-li-active-bg, var(--sms-active-color, rgba(0, 0, 0, 0.15)))}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect button){border-radius:50%;display:flex;transition:0.2s;color:inherit;background:transparent;border:none;cursor:pointer;outline:none;padding:0;margin:0 0 0 3pt}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect button.remove-all){margin:0 3pt}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(ul.selected > li button:hover, button.remove-all:hover, button:focus){color:var(--sms-remove-btn-hover-color, lightskyblue);background:var(--sms-remove-btn-hover-bg, rgba(0, 0, 0, 0.2))}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect input){margin:auto 0;padding:0}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.selected > input){border:none;outline:none;background:none;flex:1;min-width:2em;color:var(--sms-text-color);font-size:inherit;cursor:inherit;border-radius:0}div.multiselect.svelte-1r2hsto>ul.selected.svelte-1r2hsto>input.svelte-1r2hsto::placeholder{padding-left:5pt;color:var(--sms-placeholder-color);opacity:var(--sms-placeholder-opacity)}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > input.form-control){width:2em;position:absolute;background:transparent;border:none;outline:none;z-index:-1;opacity:0;pointer-events:none}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.options){list-style:none;top:100%;left:0;width:100%;position:absolute;overflow:auto;transition:all 0.2s;box-sizing:border-box;background:var(--sms-options-bg, white);max-height:var(--sms-options-max-height, 50vh);overscroll-behavior:var(--sms-options-overscroll, none);box-shadow:var(--sms-options-shadow, 0 0 14pt -8pt black);border:var(--sms-options-border);border-width:var(--sms-options-border-width);border-radius:var(--sms-options-border-radius, 1ex);padding:var(--sms-options-padding);margin:var(--sms-options-margin, inherit)}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.options.hidden){visibility:hidden;opacity:0;transform:translateY(50px)}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.options > li){padding:3pt 2ex;cursor:pointer;scroll-margin:var(--sms-options-scroll-margin, 100px)}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.options .user-msg){display:block;padding:3pt 2ex}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.options > li.selected){background:var(--sms-li-selected-bg);color:var(--sms-li-selected-color)}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.options > li.active){background:var(--sms-li-active-bg, var(--sms-active-color, rgba(0, 0, 0, 0.15)))}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.options > li.disabled){cursor:not-allowed;background:var(--sms-li-disabled-bg, #f5f5f6);color:var(--sms-li-disabled-text, #b8b8b8)}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(span.max-select-msg){padding:0 3pt}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto::highlight(sms-search-matches){color:mediumaquamarine}")}var Xy=i=>({searchText:i[0]&8,msgType:i[0]&1073810458,msg:i[0]&1073843226,option:i[0]&33554434}),Sf=i=>({searchText:i[3],msgType:i[116],msg:i[117],option:i[118],idx:i[125]});function oc(i){let e=i.slice(),t={dupe:e[15],create:e[10],"no-match":e[30]}[e[116]];return e[117]=t,e}function lc(i){let e=i.slice(),t=e[4].map(nt).includes(e[3]);e[112]=t;let n=!e[16]&&e[112]&&"dupe";e[113]=n;let a=!!(e[11]&&e[10])&&"create";e[114]=a;let s=!!(e[1]?.length==0&&e[30])&&"no-match";e[115]=s;let r=e[113]||e[114]||e[115];return e[116]=r,e}function xf(i,e,t){let n=i.slice();n[118]=e[t],n[125]=t;let a=n[118]instanceof Object?n[118]:{label:n[118]};n[119]=a.label,n[42]=a.disabled!==void 0?a.disabled:null,n[120]=a.title!==void 0?a.title:null,n[121]=a.selectedTitle!==void 0?a.selectedTitle:null,n[122]=a.disabledTitle!==void 0?a.disabledTitle:n[13];let s=n[0]===n[125];return n[123]=s,n}var qy=i=>({option:i[0]&33554434}),Tf=i=>({option:i[118],idx:i[125]}),Uy=i=>({option:i[0]&33554434}),Cf=i=>({option:i[118],idx:i[125]}),Vy=i=>({option:i[0]&16,idx:i[0]&16}),Af=i=>({option:i[118],idx:i[125]}),Yy=i=>({option:i[0]&16,idx:i[0]&16}),Df=i=>({option:i[118],idx:i[125]}),Gy=i=>({option:i[0]&16,idx:i[0]&16}),Pf=i=>({option:i[118],idx:i[125]}),Ky=i=>({selected:i[0]&16,disabled:i[1]&2048,invalid:i[0]&128,id:i[0]&262144,placeholder:i[1]&8,open:i[0]&256,required:i[1]&128,option:i[0]&16,idx:i[0]&16}),Mf=i=>({selected:i[4],disabled:i[42],invalid:i[7],id:i[18],placeholder:i[34],open:i[8],required:i[38],option:i[118],idx:i[125]});function Ef(i,e,t){let n=i.slice();return n[118]=e[t],n[125]=t,n}var Jy=i=>({option:i[0]&16,idx:i[0]&16}),Qf=i=>({option:i[118],idx:i[125]}),ev=i=>({option:i[0]&16,idx:i[0]&16}),If=i=>({option:i[118],idx:i[125]}),tv=i=>({option:i[0]&16,idx:i[0]&16}),Rf=i=>({option:i[118],idx:i[125]}),iv=i=>({open:i[0]&256,option:i[0]&16,idx:i[0]&16}),Wf=i=>({open:i[8],option:i[118],idx:i[125]});function nv(i){let e,t;return e=new nc({props:{width:"15px",style:"min-width: 1em; padding: 0 1pt; cursor: pointer;"}}),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},p:N,i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function av(i){let e=nt(i[118])+"",t;return{c(){t=me(e)},m(n,a){D(n,t,a)},p(n,a){a[0]&16&&e!==(e=nt(n[118])+"")&&we(t,e)},d(n){n&&A(t)}}}function sv(i){let e,t=nt(i[118])+"",n;return{c(){e=new pi(!1),n=Oe(),e.a=n},m(a,s){e.m(t,a,s),D(a,n,s)},p(a,s){s[0]&16&&t!==(t=nt(a[118])+"")&&e.p(t)},d(a){a&&A(n),a&&e.d()}}}function rv(i){let e;function t(s,r){return s[32]?sv:av}let n=t(i,[-1,-1,-1,-1,-1]),a=n(i);return{c(){a.c(),e=Oe()},m(s,r){a.m(s,r),D(s,e,r)},p(s,r){n===(n=t(s,r))&&a?a.p(s,r):(a.d(1),a=n(s),a&&(a.c(),a.m(e.parentNode,e)))},d(s){a.d(s),s&&A(e)}}}function ov(i){let e,t=i[69].default,n=st(t,i,i[107],If),a=n||rv(i);return{c(){a&&a.c()},m(s,r){a&&a.m(s,r),e=!0},p(s,r){n?n.p&&(!e||r[0]&16|r[3]&16384)&&ot(n,t,s,s[107],e?rt(t,s[107],r,ev):lt(s[107]),If):a&&a.p&&(!e||r[0]&16|r[1]&2)&&a.p(s,e?r:[-1,-1,-1,-1,-1])},i(s){e||(M(a,s),e=!0)},o(s){Q(a,s),e=!1},d(s){a&&a.d(s)}}}function Nf(i){let e,t,n,a,s,r=i[69]["remove-icon"],o=st(r,i,i[107],Qf),l=o||lv(i);function c(){return i[89](i[118])}function d(){return i[90](i[118])}return{c(){e=k("button"),l&&l.c(),g(e,"type","button"),g(e,"title",t=i[36]+" "+nt(i[118])),g(e,"class","remove svelte-1r2hsto")},m(h,u){D(h,e,u),l&&l.m(e,null),n=!0,a||(s=[H(e,"mouseup",si(c)),H(e,"keydown",function(){Ie(i[54](d))&&i[54](d).apply(this,arguments)})],a=!0)},p(h,u){i=h,o&&o.p&&(!n||u[0]&16|u[3]&16384)&&ot(o,r,i,i[107],n?rt(r,i[107],u,Jy):lt(i[107]),Qf),(!n||u[0]&16|u[1]&32&&t!==(t=i[36]+" "+nt(i[118])))&&g(e,"title",t)},i(h){n||(M(l,h),n=!0)},o(h){Q(l,h),n=!1},d(h){h&&A(e),l&&l.d(h),a=!1,ce(s)}}}function lv(i){let e,t;return e=new ar({props:{width:"15px"}}),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},p:N,i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function Lf(i,e){let t,n,a,s,r,o,l=N,c,d,h,u=e[69].selected,f=st(u,e,e[107],Rf),m=f||ov(e),p=!e[42]&&(e[37]===null||e[4].length>e[37])&&Nf(e);function y(){return e[91](e[125])}return{key:i,first:null,c(){t=k("li"),m&&m.c(),n=W(),p&&p.c(),g(t,"class",a=Pi(e[23])+" svelte-1r2hsto"),g(t,"role","option"),g(t,"aria-selected","true"),g(t,"draggable",s=e[39]&&!e[42]&&e[4].length>1),g(t,"style",r=Na(e[118],"selected")),oe(t,"active",e[46]===e[125]),this.first=t},m(w,_){D(w,t,_),m&&m.m(t,null),b(t,n),p&&p.m(t,null),c=!0,d||(h=[H(t,"dragstart",function(){Ie(e[57](e[125]))&&e[57](e[125]).apply(this,arguments)}),H(t,"drop",Ur(function(){Ie(e[56](e[125]))&&e[56](e[125]).apply(this,arguments)})),H(t,"dragenter",y),H(t,"dragover",Ur(e[85]))],d=!0)},p(w,_){e=w,f?f.p&&(!c||_[0]&16|_[3]&16384)&&ot(f,u,e,e[107],c?rt(u,e[107],_,tv):lt(e[107]),Rf):m&&m.p&&(!c||_[0]&16|_[1]&2|_[3]&16384)&&m.p(e,c?_:[-1,-1,-1,-1,-1]),!e[42]&&(e[37]===null||e[4].length>e[37])?p?(p.p(e,_),_[0]&16|_[1]&2112&&M(p,1)):(p=Nf(e),p.c(),M(p,1),p.m(t,null)):p&&(he(),Q(p,1,1,()=>{p=null}),de()),(!c||_[0]&8388608&&a!==(a=Pi(e[23])+" svelte-1r2hsto"))&&g(t,"class",a),(!c||_[0]&16|_[1]&2304&&s!==(s=e[39]&&!e[42]&&e[4].length>1))&&g(t,"draggable",s),(!c||_[0]&16&&r!==(r=Na(e[118],"selected")))&&g(t,"style",r),(!c||_[0]&8388624|_[1]&32768)&&oe(t,"active",e[46]===e[125])},r(){o=t.getBoundingClientRect()},f(){Qi(t),l()},a(){l(),l=Ei(t,o,$i,{duration:100})},i(w){c||(M(m,w),M(p),c=!0)},o(w){Q(m,w),Q(p),c=!1},d(w){w&&A(t),m&&m.d(w),p&&p.d(),d=!1,ce(h)}}}function $f(i){let e,t=i[69].spinner,n=st(t,i,i[107],Pf),a=n||cv(i);return{c(){a&&a.c()},m(s,r){a&&a.m(s,r),e=!0},p(s,r){n&&n.p&&(!e||r[0]&16|r[3]&16384)&&ot(n,t,s,s[107],e?rt(t,s[107],r,Gy):lt(s[107]),Pf)},i(s){e||(M(a,s),e=!0)},o(s){Q(a,s),e=!1},d(s){a&&a.d(s)}}}function cv(i){let e,t;return e=new Kl({}),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function hv(i){let e,t,n,a=i[26]&&(i[26]>1||i[27])&&Bf(i),s=i[26]!==1&&i[4].length>1&&zf(i);return{c(){a&&a.c(),e=W(),s&&s.c(),t=Oe()},m(r,o){a&&a.m(r,o),D(r,e,o),s&&s.m(r,o),D(r,t,o),n=!0},p(r,o){r[26]&&(r[26]>1||r[27])?a?(a.p(r,o),o[0]&201326592&&M(a,1)):(a=Bf(r),a.c(),M(a,1),a.m(e.parentNode,e)):a&&(he(),Q(a,1,1,()=>{a=null}),de()),r[26]!==1&&r[4].length>1?s?(s.p(r,o),o[0]&67108880&&M(s,1)):(s=zf(r),s.c(),M(s,1),s.m(t.parentNode,t)):s&&(he(),Q(s,1,1,()=>{s=null}),de())},i(r){n||(M(a),M(s),n=!0)},o(r){Q(a),Q(s),n=!1},d(r){a&&a.d(r),r&&A(e),s&&s.d(r),r&&A(t)}}}function dv(i){let e,t=i[69]["disabled-icon"],n=st(t,i,i[107],Df),a=n||mv(i);return{c(){a&&a.c()},m(s,r){a&&a.m(s,r),e=!0},p(s,r){n&&n.p&&(!e||r[0]&16|r[3]&16384)&&ot(n,t,s,s[107],e?rt(t,s[107],r,Yy):lt(s[107]),Df)},i(s){e||(M(a,s),e=!0)},o(s){Q(a,s),e=!1},d(s){a&&a.d(s)}}}function Bf(i){let e,t,n;function a(r){i[94](r)}let s={angle:20,$$slots:{default:[uv]},$$scope:{ctx:i}};return i[43]!==void 0&&(s.wiggle=i[43]),e=new tc({props:s}),Re.push(()=>Nt(e,"wiggle",a)),{c(){se(e.$$.fragment)},m(r,o){ie(e,r,o),n=!0},p(r,o){let l={};o[0]&469762064|o[3]&16384&&(l.$$scope={dirty:o,ctx:r}),!t&&o[1]&4096&&(t=!0,l.wiggle=r[43],Wt(()=>t=!1)),e.$set(l)},i(r){n||(M(e.$$.fragment,r),n=!0)},o(r){Q(e.$$.fragment,r),n=!1},d(r){ne(e,r)}}}function uv(i){let e,t=i[27]?.(i[4].length,i[26])+"",n,a;return{c(){e=k("span"),n=me(t),g(e,"class",a="max-select-msg "+i[28]+" svelte-1r2hsto")},m(s,r){D(s,e,r),b(e,n)},p(s,r){r[0]&201326608&&t!==(t=s[27]?.(s[4].length,s[26])+"")&&we(n,t),r[0]&268435456&&a!==(a="max-select-msg "+s[28]+" svelte-1r2hsto")&&g(e,"class",a)},d(s){s&&A(e)}}}function zf(i){let e,t,n,a,s=i[69]["remove-icon"],r=st(s,i,i[107],Af),o=r||fv(i);return{c(){e=k("button"),o&&o.c(),g(e,"type","button"),g(e,"class","remove remove-all svelte-1r2hsto"),g(e,"title",i[35])},m(l,c){D(l,e,c),o&&o.m(e,null),t=!0,n||(a=[H(e,"mouseup",si(i[53])),H(e,"keydown",i[54](i[53]))],n=!0)},p(l,c){r&&r.p&&(!t||c[0]&16|c[3]&16384)&&ot(r,s,l,l[107],t?rt(s,l[107],c,Vy):lt(l[107]),Af),(!t||c[1]&16)&&g(e,"title",l[35])},i(l){t||(M(o,l),t=!0)},o(l){Q(o,l),t=!1},d(l){l&&A(e),o&&o.d(l),n=!1,ce(a)}}}function fv(i){let e,t;return e=new ar({props:{width:"15px"}}),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},p:N,i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function mv(i){let e,t;return e=new rc({props:{width:"14pt",style:"margin: 0 2pt;","data-name":"disabled-icon"}}),{c(){se(e.$$.fragment)},m(n,a){ie(e,n,a),t=!0},p:N,i(n){t||(M(e.$$.fragment,n),t=!0)},o(n){Q(e.$$.fragment,n),t=!1},d(n){ne(e,n)}}}function Hf(i){let e,t,n,a,s,r,o=i[1].slice(0,Math.max(0,i[25]??0)||1/0),l=[];for(let h=0;h<o.length;h+=1)l[h]=Ff(xf(i,o,h));let c=h=>Q(l[h],1,1,()=>{l[h]=null}),d=i[3]&&jf(lc(i));return{c(){e=k("ul");for(let h=0;h<l.length;h+=1)l[h].c();t=W(),d&&d.c(),g(e,"class",n="options "+i[40]+" svelte-1r2hsto"),g(e,"role","listbox"),g(e,"aria-multiselectable",a=i[26]===null||i[26]>1),g(e,"aria-expanded",i[8]),g(e,"aria-disabled",s=i[42]?"true":null),oe(e,"hidden",!i[8])},m(h,u){D(h,e,u);for(let f=0;f<l.length;f+=1)l[f]&&l[f].m(e,null);b(e,t),d&&d.m(e,null),i[105](e),r=!0},p(h,u){if(u[0]&39845891|u[1]&393218|u[3]&16384){o=h[1].slice(0,Math.max(0,h[25]??0)||1/0);let f;for(f=0;f<o.length;f+=1){let m=xf(h,o,f);l[f]?(l[f].p(m,u),M(l[f],1)):(l[f]=Ff(m),l[f].c(),M(l[f],1),l[f].m(e,t))}for(he(),f=o.length;f<l.length;f+=1)c(f);de()}h[3]?d?(d.p(lc(h),u),u[0]&8&&M(d,1)):(d=jf(lc(h)),d.c(),M(d,1),d.m(e,null)):d&&(he(),Q(d,1,1,()=>{d=null}),de()),(!r||u[1]&512&&n!==(n="options "+h[40]+" svelte-1r2hsto"))&&g(e,"class",n),(!r||u[0]&67108864&&a!==(a=h[26]===null||h[26]>1))&&g(e,"aria-multiselectable",a),(!r||u[0]&256)&&g(e,"aria-expanded",h[8]),(!r||u[1]&2048&&s!==(s=h[42]?"true":null))&&g(e,"aria-disabled",s),(!r||u[0]&256|u[1]&512)&&oe(e,"hidden",!h[8])},i(h){if(!r){for(let u=0;u<o.length;u+=1)M(l[u]);M(d),r=!0}},o(h){l=l.filter(jy);for(let u=0;u<l.length;u+=1)Q(l[u]);Q(d),r=!1},d(h){h&&A(e),Xe(l,h),d&&d.d(),i[105](null)}}}function gv(i){let e=nt(i[118])+"",t;return{c(){t=me(e)},m(n,a){D(n,t,a)},p(n,a){a[0]&33554434&&e!==(e=nt(n[118])+"")&&we(t,e)},d(n){n&&A(t)}}}function pv(i){let e,t=nt(i[118])+"",n;return{c(){e=new pi(!1),n=Oe(),e.a=n},m(a,s){e.m(t,a,s),D(a,n,s)},p(a,s){s[0]&33554434&&t!==(t=nt(a[118])+"")&&e.p(t)},d(a){a&&A(n),a&&e.d()}}}function bv(i){let e;function t(s,r){return s[32]?pv:gv}let n=t(i,[-1,-1,-1,-1,-1]),a=n(i);return{c(){a.c(),e=Oe()},m(s,r){a.m(s,r),D(s,e,r)},p(s,r){n===(n=t(s,r))&&a?a.p(s,r):(a.d(1),a=n(s),a&&(a.c(),a.m(e.parentNode,e)))},d(s){a.d(s),s&&A(e)}}}function yv(i){let e,t=i[69].default,n=st(t,i,i[107],Tf),a=n||bv(i);return{c(){a&&a.c()},m(s,r){a&&a.m(s,r),e=!0},p(s,r){n?n.p&&(!e||r[0]&33554434|r[3]&16384)&&ot(n,t,s,s[107],e?rt(t,s[107],r,qy):lt(s[107]),Tf):a&&a.p&&(!e||r[0]&33554434|r[1]&2)&&a.p(s,e?r:[-1,-1,-1,-1,-1])},i(s){e||(M(a,s),e=!0)},o(s){Q(a,s),e=!1},d(s){a&&a.d(s)}}}function Ff(i){let e,t,n,a,s,r,o,l=i[69].option,c=st(l,i,i[107],Cf),d=c||yv(i);function h(...m){return i[95](i[42],i[118],...m)}function u(){return i[96](i[42],i[125])}function f(){return i[97](i[42],i[125])}return{c(){e=k("li"),d&&d.c(),g(e,"title",t=i[42]?i[122]:i[48](i[119])&&i[121]||i[120]),g(e,"class",n=i[22]+" "+(i[123]?i[21]:"")+" svelte-1r2hsto"),g(e,"role","option"),g(e,"aria-selected","false"),g(e,"style",a=Na(i[118],"option")),oe(e,"selected",i[48](i[119])),oe(e,"active",i[123]),oe(e,"disabled",i[42])},m(m,p){D(m,e,p),d&&d.m(e,null),s=!0,r||(o=[H(e,"mousedown",si(i[71])),H(e,"mouseup",si(h)),H(e,"mouseover",u),H(e,"focus",f),H(e,"mouseout",i[98]),H(e,"blur",i[99])],r=!0)},p(m,p){i=m,c?c.p&&(!s||p[0]&33554434|p[3]&16384)&&ot(c,l,i,i[107],s?rt(l,i[107],p,Uy):lt(i[107]),Cf):d&&d.p&&(!s||p[0]&33554434|p[1]&2|p[3]&16384)&&d.p(i,s?p:[-1,-1,-1,-1,-1]),(!s||p[0]&33554434|p[1]&131072&&t!==(t=i[42]?i[122]:i[48](i[119])&&i[121]||i[120]))&&g(e,"title",t),(!s||p[0]&6291457&&n!==(n=i[22]+" "+(i[123]?i[21]:"")+" svelte-1r2hsto"))&&g(e,"class",n),(!s||p[0]&33554434&&a!==(a=Na(i[118],"option")))&&g(e,"style",a),(!s||p[0]&39845891|p[1]&131072)&&oe(e,"selected",i[48](i[119])),(!s||p[0]&6291457)&&oe(e,"active",i[123]),(!s||p[0]&39845891)&&oe(e,"disabled",i[42])},i(m){s||(M(d,m),s=!0)},o(m){Q(d,m),s=!1},d(m){m&&A(e),d&&d.d(m),r=!1,ce(o)}}}function jf(i){let e,t,n=i[116]&&Zf(oc(i));return{c(){n&&n.c(),e=Oe()},m(a,s){n&&n.m(a,s),D(a,e,s),t=!0},p(a,s){a[116]?n?(n.p(oc(a),s),s[0]&1073810458&&M(n,1)):(n=Zf(oc(a)),n.c(),M(n,1),n.m(e.parentNode,e)):n&&(he(),Q(n,1,1,()=>{n=null}),de())},i(a){t||(M(n),t=!0)},o(a){Q(n),t=!1},d(a){n&&n.d(a),a&&A(e)}}}function Zf(i){let e,t,n,a,s=i[69]["user-msg"],r=st(s,i,i[107],Sf),o=r||vv(i);return{c(){e=k("li"),o&&o.c(),g(e,"title",i[10]),g(e,"role","option"),g(e,"aria-selected","false"),g(e,"class","user-msg svelte-1r2hsto"),oe(e,"active",i[44]),Be(e,"cursor",{dupe:"not-allowed",create:"pointer","no-match":"default"}[i[116]])},m(l,c){D(l,e,c),o&&o.m(e,null),t=!0,n||(a=[H(e,"mousedown",si(i[70])),H(e,"mouseup",si(i[100])),H(e,"mouseover",i[101]),H(e,"focus",i[102]),H(e,"mouseout",i[103]),H(e,"blur",i[104])],n=!0)},p(l,c){r?r.p&&(!t||c[0]&1107397658|c[3]&16384)&&ot(r,s,l,l[107],t?rt(s,l[107],c,Xy):lt(l[107]),Sf):o&&o.p&&(!t||c[0]&1073843226)&&o.p(l,t?c:[-1,-1,-1,-1,-1]),(!t||c[0]&1024)&&g(e,"title",l[10]),(!t||c[1]&8192)&&oe(e,"active",l[44]),c[0]&1073810458&&Be(e,"cursor",{dupe:"not-allowed",create:"pointer","no-match":"default"}[l[116]])},i(l){t||(M(o,l),t=!0)},o(l){Q(o,l),t=!1},d(l){l&&A(e),o&&o.d(l),n=!1,ce(a)}}}function vv(i){let e=i[117]+"",t;return{c(){t=me(e)},m(n,a){D(n,t,a)},p(n,a){a[0]&1073843226&&e!==(e=n[117]+"")&&we(t,e)},d(n){n&&A(t)}}}function kv(i){let e,t,n,a,s,r,o,l=[],c=new Map,d,h,u,f,m,p,y,w,_,O,E,S,v,x,P,I,R;Dt(i[86]);let T=i[69]["expand-icon"],$=st(T,i,i[107],Wf),K=$||nv(i),Z=i[4],F=X=>X[16]?[X[17](X[118]),X[125]]:X[17](X[118]);for(let X=0;X<Z.length;X+=1){let z=Ef(i,Z,X),ge=F(z);c.set(ge,l[X]=Lf(ge,z))}let V=i[69]["after-input"],B=st(V,i,i[107],Mf),Y=i[24]&&$f(i),L=[dv,hv],ae=[];function J(X,z){return X[42]?0:X[4].length>0?1:-1}~(O=J(i,[-1,-1,-1,-1,-1]))&&(E=ae[O]=L[O](i));let ue=(i[3]&&i[30]||i[2]?.length>0)&&Hf(i);return{c(){e=k("div"),t=k("input"),s=W(),K&&K.c(),r=W(),o=k("ul");for(let X=0;X<l.length;X+=1)l[X].c();d=W(),h=k("input"),p=W(),B&&B.c(),w=W(),Y&&Y.c(),_=W(),E&&E.c(),S=W(),ue&&ue.c(),g(t,"name",i[29]),t.required=n=!!i[38],t.value=a=i[4].length>=Number(i[38])?JSON.stringify(i[4]):null,g(t,"tabindex","-1"),g(t,"aria-hidden","true"),g(t,"aria-label","ignore this, used only to prevent form submission if select is required but empty"),g(t,"class","form-control svelte-1r2hsto"),g(h,"class",u=Pi(i[19])+" svelte-1r2hsto"),g(h,"id",i[18]),h.disabled=i[42],g(h,"autocomplete",i[12]),g(h,"inputmode",i[20]),g(h,"pattern",i[33]),g(h,"placeholder",f=i[4].length==0?i[34]:null),g(h,"aria-invalid",m=i[7]?"true":null),g(h,"ondrop","return false"),g(o,"class",y="selected "+i[41]+" svelte-1r2hsto"),g(o,"aria-label","selected options"),g(e,"class",v="multiselect "+i[31]+" svelte-1r2hsto"),g(e,"title",x=i[42]?i[14]:null),g(e,"data-id",i[18]),g(e,"role","searchbox"),g(e,"tabindex","-1"),oe(e,"disabled",i[42]),oe(e,"single",i[26]===1),oe(e,"open",i[8]),oe(e,"invalid",i[7])},m(X,z){D(X,e,z),b(e,t),i[87](t),b(e,s),K&&K.m(e,null),b(e,r),b(e,o);for(let ge=0;ge<l.length;ge+=1)l[ge]&&l[ge].m(o,null);b(o,d),b(o,h),i[92](h),kt(h,i[3]),b(o,p),B&&B.m(o,null),b(e,w),Y&&Y.m(e,null),b(e,_),~O&&ae[O].m(e,null),b(e,S),ue&&ue.m(e,null),i[106](e),P=!0,I||(R=[H(window,"click",i[55]),H(window,"touchstart",i[55]),H(window,"resize",i[86]),H(t,"invalid",i[88]),H(h,"input",i[93]),H(h,"mouseup",uh(si(i[51]))),H(h,"keydown",si(i[52])),H(h,"focus",i[72]),H(h,"focus",i[51]),H(h,"input",i[58]),H(h,"blur",i[73]),H(h,"change",i[74]),H(h,"click",i[75]),H(h,"keydown",i[76]),H(h,"keyup",i[77]),H(h,"mousedown",i[78]),H(h,"mouseenter",i[79]),H(h,"mouseleave",i[80]),H(h,"touchcancel",i[81]),H(h,"touchend",i[82]),H(h,"touchmove",i[83]),H(h,"touchstart",i[84]),H(e,"mouseup",si(i[51]))],I=!0)},p(X,z){if((!P||z[0]&536870912)&&g(t,"name",X[29]),(!P||z[1]&128&&n!==(n=!!X[38]))&&(t.required=n),(!P||z[0]&16|z[1]&128&&a!==(a=X[4].length>=Number(X[38])?JSON.stringify(X[4]):null)&&t.value!==a)&&(t.value=a),$&&$.p&&(!P||z[0]&272|z[3]&16384)&&ot($,T,X,X[107],P?rt(T,X[107],z,iv):lt(X[107]),Wf),z[0]&8585232|z[1]&109611362|z[3]&16384){Z=X[4],he();for(let xe=0;xe<l.length;xe+=1)l[xe].r();l=gt(l,z,F,1,X,Z,c,o,En,Lf,d,Ef);for(let xe=0;xe<l.length;xe+=1)l[xe].a();de()}(!P||z[0]&524288&&u!==(u=Pi(X[19])+" svelte-1r2hsto"))&&g(h,"class",u),(!P||z[0]&262144)&&g(h,"id",X[18]),(!P||z[1]&2048)&&(h.disabled=X[42]),(!P||z[0]&4096)&&g(h,"autocomplete",X[12]),(!P||z[0]&1048576)&&g(h,"inputmode",X[20]),(!P||z[1]&4)&&g(h,"pattern",X[33]),(!P||z[0]&16|z[1]&8&&f!==(f=X[4].length==0?X[34]:null))&&g(h,"placeholder",f),(!P||z[0]&128&&m!==(m=X[7]?"true":null))&&g(h,"aria-invalid",m),z[0]&8&&h.value!==X[3]&&kt(h,X[3]),B&&B.p&&(!P||z[0]&262544|z[1]&2184|z[3]&16384)&&ot(B,V,X,X[107],P?rt(V,X[107],z,Ky):lt(X[107]),Mf),(!P||z[1]&1024&&y!==(y="selected "+X[41]+" svelte-1r2hsto"))&&g(o,"class",y),X[24]?Y?(Y.p(X,z),z[0]&16777216&&M(Y,1)):(Y=$f(X),Y.c(),M(Y,1),Y.m(e,_)):Y&&(he(),Q(Y,1,1,()=>{Y=null}),de());let ge=O;O=J(X,z),O===ge?~O&&ae[O].p(X,z):(E&&(he(),Q(ae[ge],1,1,()=>{ae[ge]=null}),de()),~O?(E=ae[O],E?E.p(X,z):(E=ae[O]=L[O](X),E.c()),M(E,1),E.m(e,S)):E=null),X[3]&&X[30]||X[2]?.length>0?ue?(ue.p(X,z),z[0]&1073741836&&M(ue,1)):(ue=Hf(X),ue.c(),M(ue,1),ue.m(e,null)):ue&&(he(),Q(ue,1,1,()=>{ue=null}),de()),(!P||z[1]&1&&v!==(v="multiselect "+X[31]+" svelte-1r2hsto"))&&g(e,"class",v),(!P||z[0]&16384|z[1]&2048&&x!==(x=X[42]?X[14]:null))&&g(e,"title",x),(!P||z[0]&262144)&&g(e,"data-id",X[18]),(!P||z[1]&2049)&&oe(e,"disabled",X[42]),(!P||z[0]&67108864|z[1]&1)&&oe(e,"single",X[26]===1),(!P||z[0]&256|z[1]&1)&&oe(e,"open",X[8]),(!P||z[0]&128|z[1]&1)&&oe(e,"invalid",X[7])},i(X){if(!P){M(K,X);for(let z=0;z<Z.length;z+=1)M(l[z]);M(B,X),M(Y),M(E),M(ue),P=!0}},o(X){Q(K,X);for(let z=0;z<l.length;z+=1)Q(l[z]);Q(B,X),Q(Y),Q(E),Q(ue),P=!1},d(X){X&&A(e),i[87](null),K&&K.d(X);for(let z=0;z<l.length;z+=1)l[z].d();i[92](null),B&&B.d(X),Y&&Y.d(),~O&&ae[O].d(),ue&&ue.d(),i[106](null),I=!1,ce(R)}}}function wv(i,e,t){let n,{$$slots:a={},$$scope:s}=e,{activeIndex:r=null}=e,{activeOption:o=null}=e,{createOptionMsg:l="Create this option..."}=e,{allowUserOptions:c=!1}=e,{allowEmpty:d=!1}=e,{autocomplete:h="off"}=e,{autoScroll:u=!0}=e,{breakpoint:f=800}=e,{defaultDisabledTitle:m="This option is disabled"}=e,{disabled:p=!1}=e,{disabledInputTitle:y="This input is disabled"}=e,{duplicateOptionMsg:w="This option is already selected"}=e,{duplicates:_=!1}=e,{key:O=C=>`${nt(C)}`.toLowerCase()}=e,{filterFunc:E=(C,De)=>De?`${nt(C)}`.toLowerCase().includes(De.toLowerCase()):!0}=e,{closeDropdownOnSelect:S="desktop"}=e,{form_input:v=null}=e,{highlightMatches:x=!0}=e,{id:P=null}=e,{input:I=null}=e,{inputClass:R=""}=e,{inputmode:T=null}=e,{invalid:$=!1}=e,{liActiveOptionClass:K=""}=e,{liOptionClass:Z=""}=e,{liSelectedClass:F=""}=e,{loading:V=!1}=e,{matchingOptions:B=[]}=e,{maxOptions:Y=void 0}=e,{maxSelect:L=null}=e,{maxSelectMsg:ae=(C,De)=>De>1?`${C}/${De}`:""}=e,{maxSelectMsgClass:J=""}=e,{name:ue=null}=e,{noMatchingOptionsMsg:X="No matching options"}=e,{open:z=!1}=e,{options:ge}=e,{outerDiv:xe=null}=e,{outerDivClass:Me=""}=e,{parseLabelsAsHtml:et=!1}=e,{pattern:St=null}=e,{placeholder:kn=null}=e,{removeAllTitle:wn="Remove all"}=e,{removeBtnTitle:Et="Remove"}=e,{minSelect:Qt=null}=e,{required:ft=!1}=e,{resetFilterOnAdd:ur=!0}=e,{searchText:Ke=""}=e,{selected:Ae=ge?.filter(C=>C instanceof Object&&C?.preselected).slice(0,L??void 0)??[]}=e,{sortSelected:Xi=!1}=e,{selectedOptionsDraggable:fr=!Xi}=e,{ulOptionsClass:vc=""}=e,{ulSelectedClass:kc=""}=e,{value:Ua=null}=e,im=C=>{t(59,Ua=L===1?C[0]??null:C)},nm=C=>{L===1?t(4,Ae=C?[C]:[]):t(4,Ae=C??[])},Va=!1;ge?.length>0||(c||V||p||d?ge=[]:console.error("MultiSelect received no options")),L!==null&&L<1&&console.error(`MultiSelect's maxSelect must be null or positive integer, got ${L}`),Array.isArray(Ae)||console.error(`MultiSelect's selected prop should always be an array, got ${Ae}`),L&&typeof ft=="number"&&ft>L&&console.error(`MultiSelect maxSelect=${L} < required=${ft}, makes it impossible for users to submit a valid form`),et&&c&&console.warn("Don't combine parseLabelsAsHtml and allowUserOptions. It's susceptible to XSS attacks!"),Xi&&fr&&console.warn("MultiSelect's sortSelected and selectedOptionsDraggable should not be combined as any user re-orderings of selected options will be undone by sortSelected on component re-renders."),c&&!l&&l!==null&&console.error(`MultiSelect has allowUserOptions=${c} but createOptionMsg=${l} is falsy. This prevents the "Add option" <span> from showing up, resulting in a confusing user experience.`),Y&&(typeof Y!="number"||Y<0||Y%1!=0)&&console.error(`MultiSelect's maxOptions must be undefined or a positive integer, got ${Y}`);let fi=Pe(),qi=!1,mr;if(r!==null&&!B[r])throw`Run time error, activeIndex=${r} is out of bounds, matchingOptions.length=${B.length}`;function ea(C,De){L&&L>1&&Ae.length>=L&&t(43,Va=!0),!isNaN(Number(C))&&typeof Ae.map(nt)[0]=="number"&&(C=Number(C));let Ze=Ae.map(O).includes(O(C));if((L===null||L===1||Ae.length<L)&&(_||!Ze)){if(!ge.includes(C)&&[!0,"append"].includes(c)&&Ke.length>0&&(typeof ge[0]=="object"?C={label:Ke}:(["number","undefined"].includes(typeof ge[0])&&!isNaN(Number(Ke))?C=Number(Ke):C=Ke,fi("create",{option:C})),c==="append"&&t(2,ge=[...ge,C])),ur&&t(3,Ke=""),["",void 0,null].includes(C)){console.error(`MultiSelect: encountered falsy option ${C}`);return}L===1?t(4,Ae=[C]):(t(4,Ae=[...Ae,C]),Xi===!0?t(4,Ae=Ae.sort((br,Ui)=>{let[ia,Ga]=[nt(br),nt(Ui)];return`${ia}`.localeCompare(`${Ga}`)})):typeof Xi=="function"&&t(4,Ae=Ae.sort(Xi)));let mt=Ae.length===L,_n=S===!0||S==="desktop"&&mr<f;mt||_n?gr(De):_n||I?.focus(),fi("add",{option:C}),fi("change",{option:C,type:"add"}),t(7,$=!1),v?.setCustomValidity("")}}function ta(C){if(Ae.length===0)return;let De=Ae.findIndex(mt=>O(mt)===O(C)),[Ze]=Ae.splice(De,1);if(Ze===void 0&&c&&(Ze=typeof ge[0]?{label:C}:C),Ze===void 0)return console.error(`Multiselect can't remove selected option ${JSON.stringify(C)}, not found in selected list`);t(4,Ae=[...Ae]),t(7,$=!1),v?.setCustomValidity(""),fi("remove",{option:Ze}),fi("change",{option:Ze,type:"remove"})}function wc(C){p||(t(8,z=!0),C instanceof FocusEvent||I?.focus(),fi("open",{event:C}))}function gr(C){t(8,z=!1),I?.blur(),t(0,r=null),fi("close",{event:C})}async function am(C){if(C.key==="Escape"||C.key==="Tab")gr(C),t(3,Ke="");else if(C.key==="Enter")C.preventDefault(),o?(Ae.includes(o)?ta(o):ea(o,C),t(3,Ke="")):c&&Ke.length>0?ea(Ke,C):wc(C);else if(["ArrowDown","ArrowUp"].includes(C.key)){if(r===null&&B.length>0){t(0,r=0);return}else if(c&&!B.length&&Ke.length>0){t(44,qi=!qi);return}else if(r===null)return;C.preventDefault();let De=C.key==="ArrowUp"?-1:1;if(t(0,r=(r+De)%B.length),r<0&&t(0,r=B.length-1),u){await us();let Ze=document.querySelector("ul.options > li.active");Ze&&Ze.scrollIntoViewIfNeeded?.()}}else C.key==="Backspace"&&Ae.length>0&&!Ke?ta(Ae.at(-1)):B.length>0&&t(0,r=0)}function sm(){fi("removeAll",{options:Ae}),fi("change",{options:Ae,type:"removeAll"}),t(4,Ae=[]),t(3,Ke="")}let rm=C=>De=>{["Enter","Space"].includes(De.code)&&(De.preventDefault(),C())};function om(C){xe&&!xe.contains(C.target)&&gr(C)}let pr=null,lm=C=>De=>{if(!De.dataTransfer)return;De.dataTransfer.dropEffect="move";let Ze=parseInt(De.dataTransfer.getData("text/plain")),mt=[...Ae];Ze<C?(mt.splice(C+1,0,mt[Ze]),mt.splice(Ze,1)):(mt.splice(C,0,mt[Ze]),mt.splice(Ze+1,1)),t(4,Ae=mt),t(46,pr=null)},cm=C=>De=>{De.dataTransfer&&(De.dataTransfer.effectAllowed="move",De.dataTransfer.dropEffect="move",De.dataTransfer.setData("text/plain",`${C}`))},Ya;function hm(C){if(!x||typeof CSS>"u"||!CSS.highlights)return;CSS.highlights.clear();let De=C?.target?.value.trim().toLowerCase();if(!De)return;let Ze=document.createTreeWalker(Ya,NodeFilter.SHOW_TEXT,{acceptNode:Ui=>Ui?.textContent===X?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),mt=[],_n=Ze.nextNode();for(;_n;)mt.push(_n),_n=Ze.nextNode();let br=mt.map(Ui=>{let ia=Ui.textContent?.toLowerCase(),Ga=[],yr=0;for(;ia&&yr<ia.length;){let On=ia.indexOf(De,yr);if(On===-1)break;Ga.push(On),yr=On+De.length}return Ga.map(On=>{let vr=new Range;return vr.setStart(Ui,On),vr.setEnd(Ui,On+De.length),vr})});CSS.highlights.set("sms-search-matches",new Highlight(...br.flat()))}function dm(C){je.call(this,i,C)}function um(C){je.call(this,i,C)}function fm(C){je.call(this,i,C)}function mm(C){je.call(this,i,C)}function gm(C){je.call(this,i,C)}function pm(C){je.call(this,i,C)}function bm(C){je.call(this,i,C)}function ym(C){je.call(this,i,C)}function vm(C){je.call(this,i,C)}function km(C){je.call(this,i,C)}function wm(C){je.call(this,i,C)}function _m(C){je.call(this,i,C)}function Om(C){je.call(this,i,C)}function Sm(C){je.call(this,i,C)}function xm(C){je.call(this,i,C)}function Tm(C){je.call(this,i,C)}function Cm(){t(45,mr=window.innerWidth)}function Am(C){Re[C?"unshift":"push"](()=>{v=C,t(5,v)})}let Dm=()=>{t(7,$=!0);let C;L&&L>1&&Number(ft)>1?C=`Please select between ${ft} and ${L} options`:Number(ft)>1?C=`Please select at least ${ft} options`:C="Please select an option",v?.setCustomValidity(C)},Pm=C=>ta(C),Mm=C=>ta(C),Em=C=>t(46,pr=C);function Qm(C){Re[C?"unshift":"push"](()=>{I=C,t(6,I)})}function Im(){Ke=this.value,t(3,Ke)}function Rm(C){Va=C,t(43,Va)}let Wm=(C,De,Ze)=>{C||ea(De,Ze)},Nm=(C,De)=>{C||t(0,r=De)},Lm=(C,De)=>{C||t(0,r=De)},$m=()=>t(0,r=null),Bm=()=>t(0,r=null),zm=C=>{c&&ea(Ke,C)},Hm=()=>t(44,qi=!0),Fm=()=>t(44,qi=!0),jm=()=>t(44,qi=!1),Zm=()=>t(44,qi=!1);function Xm(C){Re[C?"unshift":"push"](()=>{Ya=C,t(47,Ya)})}function qm(C){Re[C?"unshift":"push"](()=>{xe=C,t(9,xe)})}return i.$$set=C=>{"activeIndex"in C&&t(0,r=C.activeIndex),"activeOption"in C&&t(60,o=C.activeOption),"createOptionMsg"in C&&t(10,l=C.createOptionMsg),"allowUserOptions"in C&&t(11,c=C.allowUserOptions),"allowEmpty"in C&&t(61,d=C.allowEmpty),"autocomplete"in C&&t(12,h=C.autocomplete),"autoScroll"in C&&t(62,u=C.autoScroll),"breakpoint"in C&&t(63,f=C.breakpoint),"defaultDisabledTitle"in C&&t(13,m=C.defaultDisabledTitle),"disabled"in C&&t(42,p=C.disabled),"disabledInputTitle"in C&&t(14,y=C.disabledInputTitle),"duplicateOptionMsg"in C&&t(15,w=C.duplicateOptionMsg),"duplicates"in C&&t(16,_=C.duplicates),"key"in C&&t(17,O=C.key),"filterFunc"in C&&t(64,E=C.filterFunc),"closeDropdownOnSelect"in C&&t(65,S=C.closeDropdownOnSelect),"form_input"in C&&t(5,v=C.form_input),"highlightMatches"in C&&t(66,x=C.highlightMatches),"id"in C&&t(18,P=C.id),"input"in C&&t(6,I=C.input),"inputClass"in C&&t(19,R=C.inputClass),"inputmode"in C&&t(20,T=C.inputmode),"invalid"in C&&t(7,$=C.invalid),"liActiveOptionClass"in C&&t(21,K=C.liActiveOptionClass),"liOptionClass"in C&&t(22,Z=C.liOptionClass),"liSelectedClass"in C&&t(23,F=C.liSelectedClass),"loading"in C&&t(24,V=C.loading),"matchingOptions"in C&&t(1,B=C.matchingOptions),"maxOptions"in C&&t(25,Y=C.maxOptions),"maxSelect"in C&&t(26,L=C.maxSelect),"maxSelectMsg"in C&&t(27,ae=C.maxSelectMsg),"maxSelectMsgClass"in C&&t(28,J=C.maxSelectMsgClass),"name"in C&&t(29,ue=C.name),"noMatchingOptionsMsg"in C&&t(30,X=C.noMatchingOptionsMsg),"open"in C&&t(8,z=C.open),"options"in C&&t(2,ge=C.options),"outerDiv"in C&&t(9,xe=C.outerDiv),"outerDivClass"in C&&t(31,Me=C.outerDivClass),"parseLabelsAsHtml"in C&&t(32,et=C.parseLabelsAsHtml),"pattern"in C&&t(33,St=C.pattern),"placeholder"in C&&t(34,kn=C.placeholder),"removeAllTitle"in C&&t(35,wn=C.removeAllTitle),"removeBtnTitle"in C&&t(36,Et=C.removeBtnTitle),"minSelect"in C&&t(37,Qt=C.minSelect),"required"in C&&t(38,ft=C.required),"resetFilterOnAdd"in C&&t(67,ur=C.resetFilterOnAdd),"searchText"in C&&t(3,Ke=C.searchText),"selected"in C&&t(4,Ae=C.selected),"sortSelected"in C&&t(68,Xi=C.sortSelected),"selectedOptionsDraggable"in C&&t(39,fr=C.selectedOptionsDraggable),"ulOptionsClass"in C&&t(40,vc=C.ulOptionsClass),"ulSelectedClass"in C&&t(41,kc=C.ulSelectedClass),"value"in C&&t(59,Ua=C.value),"$$scope"in C&&t(107,s=C.$$scope)},i.$$.update=()=>{i.$$.dirty[0]&16&&im(Ae),i.$$.dirty[1]&268435456&&nm(Ua),i.$$.dirty[0]&196636|i.$$.dirty[2]&4&&t(1,B=ge.filter(C=>E(C,Ke)&&(!Ae.map(O).includes(O(C))||_))),i.$$.dirty[0]&3&&t(60,o=B[r??-1]??null),i.$$.dirty[0]&16&&t(48,n=C=>Ae.map(nt).includes(C))},[r,B,ge,Ke,Ae,v,I,$,z,xe,l,c,h,m,y,w,_,O,P,R,T,K,Z,F,V,Y,L,ae,J,ue,X,Me,et,St,kn,wn,Et,Qt,ft,fr,vc,kc,p,Va,qi,mr,pr,Ya,n,ea,ta,wc,am,sm,rm,om,lm,cm,hm,Ua,o,d,u,f,E,S,x,ur,Xi,a,dm,um,fm,mm,gm,pm,bm,ym,vm,km,wm,_m,Om,Sm,xm,Tm,Cm,Am,Dm,Pm,Mm,Em,Qm,Im,Rm,Wm,Nm,Lm,$m,Bm,zm,Hm,Fm,jm,Zm,Xm,qm,s]}var cc=class extends U{constructor(e){super(),G(this,e,wv,kv,j,{activeIndex:0,activeOption:60,createOptionMsg:10,allowUserOptions:11,allowEmpty:61,autocomplete:12,autoScroll:62,breakpoint:63,defaultDisabledTitle:13,disabled:42,disabledInputTitle:14,duplicateOptionMsg:15,duplicates:16,key:17,filterFunc:64,closeDropdownOnSelect:65,form_input:5,highlightMatches:66,id:18,input:6,inputClass:19,inputmode:20,invalid:7,liActiveOptionClass:21,liOptionClass:22,liSelectedClass:23,loading:24,matchingOptions:1,maxOptions:25,maxSelect:26,maxSelectMsg:27,maxSelectMsgClass:28,name:29,noMatchingOptionsMsg:30,open:8,options:2,outerDiv:9,outerDivClass:31,parseLabelsAsHtml:32,pattern:33,placeholder:34,removeAllTitle:35,removeBtnTitle:36,minSelect:37,required:38,resetFilterOnAdd:67,searchText:3,selected:4,sortSelected:68,selectedOptionsDraggable:39,ulOptionsClass:40,ulSelectedClass:41,value:59},Zy,[-1,-1,-1,-1,-1])}},La=cc;function _v(i=!0){let e=this,t=new IntersectionObserver(function([n]){let a=n.intersectionRatio;if(a<1){let s=a<=0&&i?"center":"nearest";e.scrollIntoView({block:s,inline:s})}this.disconnect()});return t.observe(e),t}typeof Element<"u"&&!Element.prototype?.scrollIntoViewIfNeeded&&typeof IntersectionObserver<"u"&&(Element.prototype.scrollIntoViewIfNeeded=_v);function Ov(i){re(i,"svelte-1dl3a9e",".multiselect-container.svelte-1dl3a9e{width:100%}.multiselect-container.svelte-1dl3a9e .multiselect-dropdown{height:auto;min-height:var(--input-height, 30px)}.multiselect-container.svelte-1dl3a9e div.multiselect{--sms-border:none;--sms-bg:var(--interactive-normal);--sms-options-bg:var(--interactive-normal);--sms-border-radius:var(--radius)}.multiselect-container.svelte-1dl3a9e div.multiselect ul{padding-left:0;border-radius:var(--radius)}.multiselect-container.svelte-1dl3a9e div.multiselect button{height:0}.multiselect-container.svelte-1dl3a9e div.multiselect input{width:0;font-size:var(--font-ui-small)}.multiselect-container.svelte-1dl3a9e div.multiselect li{border-left:none}.multiselect-container.svelte-1dl3a9e div.multiselect li::before{content:none}")}function Sv(i){let e,t,n,a;function s(o){i[5](o)}let r={options:i[3],outerDivClass:"multiselect-dropdown",placeholder:i[1]};return i[2]!==void 0&&(r.selected=i[2]),t=new La({props:r}),Re.push(()=>Nt(t,"selected",s)),{c(){e=k("div"),se(t.$$.fragment),g(e,"class","multiselect-container svelte-1dl3a9e")},m(o,l){D(o,e,l),ie(t,e,null),a=!0},p(o,[l]){let c={};l&2&&(c.placeholder=o[1]),!n&&l&4&&(n=!0,c.selected=o[2],Wt(()=>n=!1)),t.$set(c)},i(o){a||(M(t.$$.fragment,o),a=!0)},o(o){Q(t.$$.fragment,o),a=!1},d(o){o&&A(e),ne(t)}}}function xv(i,e,t){let n,a=N,s=()=>(a(),a=Tt(r,h=>t(2,n=h)),r);i.$$.on_destroy.push(()=>a());let{filter:r}=e;s();let{options:o}=e,l=[...o,tr],{placeholder:c}=e;function d(h){n=h,r.set(n)}return i.$$set=h=>{"filter"in h&&s(t(0,r=h.filter)),"options"in h&&t(4,o=h.options),"placeholder"in h&&t(1,c=h.placeholder)},[r,c,n,l,o,d]}var hc=class extends U{constructor(e){super(),G(this,e,xv,Sv,j,{filter:0,options:4,placeholder:1},Ov)}},Xf=hc;function Tv(i){re(i,"svelte-1y4cmh8",".controls.svelte-1y4cmh8{display:flex;justify-content:space-between;align-items:center;gap:0.5rem}.filter-button.svelte-1y4cmh8{position:relative}.filter-number.svelte-1y4cmh8{position:absolute;bottom:0;right:0;background-color:var(--interactive-normal);border-radius:50%;width:14px;height:14px;display:flex;align-items:center;justify-content:center;font-size:var(--font-smallest);pointer-events:none}.container.svelte-1y4cmh8{display:flex;flex-flow:column nowrap;gap:1rem}")}function qf(i){let e,t,n,a;return t=new Xf({props:{options:i[1],placeholder:"Sources",filter:bn}}),{c(){e=k("div"),se(t.$$.fragment),g(e,"class","filters")},m(s,r){D(s,e,r),ie(t,e,null),a=!0},p(s,r){i=s;let o={};r&2&&(o.options=i[1]),t.$set(o)},i(s){a||(M(t.$$.fragment,s),Dt(()=>{a&&(n||(n=Ki(e,Fn,{easing:ai},!0)),n.run(1))}),a=!0)},o(s){Q(t.$$.fragment,s),n||(n=Ki(e,Fn,{easing:ai},!1)),n.run(0),a=!1},d(s){s&&A(e),ne(t),s&&n&&n.end()}}}function Cv(i){let e,t,n,a,s,r,o,l,c,d,h,u,f,m,p,y,w,_,O,E;n=new _f({props:{filter:xi,placeholder:"Search Creatures"}});let S=i[0]&&qf(i);return{c(){e=k("div"),t=k("div"),se(n.$$.fragment),a=W(),s=k("div"),r=k("div"),l=W(),c=k("div"),d=me(i[2]),h=W(),u=k("div"),m=W(),p=k("div"),w=W(),S&&S.c(),g(c,"class","filter-number svelte-1y4cmh8"),g(s,"class","filter-button svelte-1y4cmh8"),g(p,"aria-label","Delete filtered creatures"),g(t,"class","controls svelte-1y4cmh8"),g(e,"class","container svelte-1y4cmh8")},m(v,x){D(v,e,x),b(e,t),ie(n,t,null),b(t,a),b(t,s),b(s,r),b(s,l),b(s,c),b(c,d),b(t,h),b(t,u),b(t,m),b(t,p),b(e,w),S&&S.m(e,null),_=!0,O||(E=[ee(o=i[7].call(null,r)),H(s,"click",i[9]),ee(f=i[5].call(null,u)),H(u,"click",i[10]),ee(y=i[6].call(null,p)),H(p,"click",i[11])],O=!0)},p(v,[x]){(!_||x&4)&&we(d,v[2]),v[0]?S?(S.p(v,x),x&1&&M(S,1)):(S=qf(v),S.c(),M(S,1),S.m(e,null)):S&&(he(),Q(S,1,1,()=>{S=null}),de())},i(v){_||(M(n.$$.fragment,v),M(S),_=!0)},o(v){Q(n.$$.fragment,v),Q(S),_=!1},d(v){v&&A(e),ne(n),S&&S.d(),O=!1,ce(E)}}}function Av(i,e,t){let n,a,s,r;Se(i,bn,w=>t(12,n=w)),Se(i,xi,w=>t(13,a=w)),Se(i,kf,w=>t(2,r=w));let o=Ne([...ve.getIndex("source").keys()]);Se(i,o,w=>t(1,s=w));let l=Pe();ve.onIndexUpdated("source",()=>Te(o,s=[...ve.getIndex("source").keys()],s));let c=!0,d=w=>{new sr.ExtraButtonComponent(w).setIcon("reset")},h=w=>{new sr.ExtraButtonComponent(w).setIcon("trash")},u=w=>{new sr.ExtraButtonComponent(w).setIcon("filter")},f=()=>{Te(xi,a="",a),Te(bn,n=[],n)};return[c,s,r,o,l,d,h,u,f,()=>t(0,c=!c),()=>f(),()=>l("remove")]}var dc=class extends U{constructor(e){super(),G(this,e,Av,Cv,j,{},Tv)}},Uf=dc;var Gf=require("obsidian");function Dv(i){re(i,"svelte-1e6o0go",".bestiary-container.svelte-1e6o0go{display:flex;flex-flow:column;gap:1rem}.filters-container.svelte-1e6o0go{display:flex;flex-flow:column nowrap;gap:0.25rem}")}function Vf(i,e,t){let n=i.slice();return n[16]=e[t],n}function Yf(i,e){let t,n,a;return n=new wf({props:{item:e[16]}}),n.$on("close",e[13]),{key:i,first:null,c(){t=Oe(),se(n.$$.fragment),this.first=t},m(s,r){D(s,t,r),ie(n,s,r),a=!0},p(s,r){e=s;let o={};r&8&&(o.item=e[16]),n.$set(o)},i(s){a||(M(n.$$.fragment,s),a=!0)},o(s){Q(n.$$.fragment,s),a=!1},d(s){s&&A(t),ne(n,s)}}}function Pv(i){let e,t,n,a,s,r=(i[2].length?i[2].length:"No")+"",o,l,c=i[2].length===1?"":"s",d,h,u,f=[],m=new Map,p,y,w,_;n=new Uf({}),n.$on("remove",i[12]);let O=i[3],E=S=>S[16].name;for(let S=0;S<O.length;S+=1){let v=Vf(i,O,S),x=E(v);m.set(x,f[S]=Yf(x,v))}return w=new vf({props:{slice:i[5],page:i[6],pages:i[9]}}),{c(){e=k("div"),t=k("div"),se(n.$$.fragment),a=W(),s=k("div"),o=me(r),l=me(" creature"),d=me(c),h=W(),u=k("div");for(let S=0;S<f.length;S+=1)f[S].c();p=W(),y=k("div"),se(w.$$.fragment),g(s,"class","setting-item-description"),g(t,"class","filters-container svelte-1e6o0go"),Be(t,"background-color",i[0]),Be(t,"top","-"+i[1]),g(u,"class","creatures-container"),g(y,"class","pagination-container"),g(e,"class","bestiary-container svelte-1e6o0go")},m(S,v){D(S,e,v),b(e,t),ie(n,t,null),b(t,a),b(t,s),b(s,o),b(s,l),b(s,d),b(e,h),b(e,u);for(let x=0;x<f.length;x+=1)f[x]&&f[x].m(u,null);b(e,p),b(e,y),ie(w,y,null),_=!0},p(S,[v]){(!_||v&4)&&r!==(r=(S[2].length?S[2].length:"No")+"")&&we(o,r),(!_||v&4)&&c!==(c=S[2].length===1?"":"s")&&we(d,c),(!_||v&1)&&Be(t,"background-color",S[0]),(!_||v&2)&&Be(t,"top","-"+S[1]),v&8&&(O=S[3],he(),f=gt(f,v,E,1,S,O,m,u,Ji,Yf,null,Vf),de())},i(S){if(!_){M(n.$$.fragment,S);for(let v=0;v<O.length;v+=1)M(f[v]);M(w.$$.fragment,S),_=!0}},o(S){Q(n.$$.fragment,S);for(let v=0;v<f.length;v+=1)Q(f[v]);Q(w.$$.fragment,S),_=!1},d(S){S&&A(e),ne(n);for(let v=0;v<f.length;v+=1)f[v].d();ne(w)}}}function Mv(i,e,t){let n,a,s,{plugin:r}=e;mn("plugin",r);let{backgroundColor:o}=e,{paddingTop:l}=e,c=Ne(ve.getBestiaryCreatures());Se(i,c,O=>t(14,a=O));let d=ve.onSortedBy("name",O=>{Te(c,a=O,a)});yi(()=>{d()});let h=Ne(50),u=Ne(1),f=pt([c,xi,bn],([O,E,S])=>{let v=[];for(let x of O){let P=!0;E.length&&((0,Gf.prepareSimpleSearch)(E)(x.name)||(P=!1)),S.length&&![x.source].flat().some(I=>S.includes(I))&&(P=!1),!x.source&&S.includes(tr)&&(P=!0),P&&v.push(x)}return v});Se(i,f,O=>t(2,n=O));let m=async()=>{n.length&&await No(r.app,`Are you sure you want to delete ${n.length} creature${n.length===1?"":"s"}?`)&&await r.deleteMonsters(...n.map(O=>O.name))},p=pt([h,f],([O,E])=>Math.ceil(E.length/O)),y=pt([f,h,u],([O,E,S])=>O.slice((S-1)*E,S*E));Se(i,y,O=>t(3,s=O));let w=()=>m();function _(O){je.call(this,i,O)}return i.$$set=O=>{"plugin"in O&&t(11,r=O.plugin),"backgroundColor"in O&&t(0,o=O.backgroundColor),"paddingTop"in O&&t(1,l=O.paddingTop)},[o,l,n,s,c,h,u,f,m,p,y,r,w,_]}var uc=class extends U{constructor(e){super(),G(this,e,Mv,Pv,j,{plugin:11,backgroundColor:0,paddingTop:1},Dv)}},Kf=uc;var Gn=(i=>(i.None="None",i.Average="Average",i.Roll="Roll",i))(Gn||{});var Ba=class extends ke.PluginSettingTab{constructor(t,n){super(t,n);this.plugin=n;this.results=[];this.importer=new Wa(this.plugin)}async display(){try{let{containerEl:t}=this;t.empty(),t.addClass("statblock-settings"),t.createEl("h2",{text:"Fantasy Statblocks Settings"}),this.generateTopSettings(t.createDiv()),this.generateParseSettings(t.createDiv()),this.generateAdvancedSettings(t.createDiv()),this.generateLayouts(t.createDiv()),this.generateImports(t.createDiv()),this.generateMonsters(t.createDiv()),t.createDiv("coffee").createEl("a",{href:"https://www.buymeacoffee.com/valentine195"}).createEl("img",{attr:{src:"https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=\u2615&slug=valentine195&button_colour=e3e7ef&font_colour=262626&font_family=Inter&outline_colour=262626&coffee_colour=ff0000"}})}catch(t){console.error(t),new ke.Notice("There was an error displaying the settings tab for 5e Statblocks.")}}generateAdvancedSettings(t){t.empty(),new ke.Setting(t).setHeading().setName("Advanced Settings"),new ke.Setting(t).setName("Try to Save Data Atomically").setDesc(createFragment(n=>{n.createSpan({text:"This will cause to plugin to save data to a temporary file before saving the actual data file in an attempt to prevent data loss."}),n.createEl("br"),n.createSpan({text:"This can cause issues sometimes when using sync services."}),n.createEl("br");let a=n.createDiv();(0,ke.setIcon)(a.createDiv(),"warning"),a.createSpan({attr:{style:"color: var(--text-error)"},text:"This setting is currently disabled."})})).addToggle(n=>n.setValue(this.plugin.settings.atomicWrite).onChange(async a=>{this.plugin.settings.atomicWrite=a,await this.plugin.saveSettings()}))}generateTopSettings(t){t.empty(),new ke.Setting(t).setHeading().setName("General Settings"),new ke.Setting(t).setName("Integrate Dice Roller").setDesc(createFragment(n=>{this.plugin.diceRollerInstalled?(n.createSpan({text:"Add Dice Roller dice to statblocks by default. Use "}),n.createEl("code",{text:"dice: false"}),n.createSpan({text:" to disable per-statblock."})):n.createSpan({text:"This setting is only usable with the Dice Roller plugin enabled."})})).setDisabled(!this.plugin.diceRollerInstalled).addToggle(n=>n.setValue(this.plugin.settings.useDice).onChange(async a=>{this.plugin.settings.useDice=a,await this.plugin.saveSettings()})),new ke.Setting(t).setName("Render Dice Rolls").setDesc(createFragment(n=>{this.plugin.diceRollerInstalled?(n.createSpan({text:"Roll graphical dice inside statblocks by default. Use "}),n.createEl("code",{text:"render: false"}),n.createSpan({text:" to disable per-statblock."})):n.createSpan({text:"This setting is only usable with the Dice Roller plugin enabled."})})).setDisabled(!this.plugin.diceRollerInstalled).addToggle(n=>n.setValue(this.plugin.settings.renderDice).onChange(async a=>{this.plugin.settings.renderDice=a,this.plugin.diceRollerInstalled&&window.DiceRoller.registerSource(yn,{showDice:!0,shouldRender:this.plugin.settings.renderDice,showFormula:!1,showParens:!1,expectedValue:Gn.Average,text:null}),await this.plugin.saveSettings()})),new ke.Setting(t).setName("Try to Render Wikilinks").setDesc(createFragment(n=>{n.createSpan({text:"The plugin will attempt to detect wikilinks inside Statblocks."}),n.createEl("br"),n.createEl("strong",{text:"Please note: these links will not be added to the graph."})})).addToggle(n=>n.setValue(this.plugin.settings.tryToRenderLinks).onChange(async a=>{this.plugin.settings.tryToRenderLinks=a,await this.plugin.saveSettings()})),new ke.Setting(t).setName("Enable 5e SRD").setDesc(createFragment(n=>{n.createSpan({text:"Use the Dungeons & Dragons 5th Edition System Reference Document monsters."})})).addToggle(n=>n.setValue(!this.plugin.settings.disableSRD).onChange(async a=>{this.plugin.settings.disableSRD=!a,await this.plugin.saveSettings(),this.plugin.app.workspace.trigger("fantasy-statblocks:srd-change",a)}))}generateParseSettings(t){t.empty();let n=t.createDiv("statblock-additional-container");new ke.Setting(n).setHeading().setName("Note Parsing"),new ke.Setting(n).setName("Automatically Parse Frontmatter for Creatures").setDesc(createFragment(r=>{r.createSpan({text:"The plugin will watch the vault for creatures defined in note frontmatter."}),r.createEl("br"),r.createEl("br"),r.createSpan({text:'The "Parse Frontmatter for Creatures" command can also be used.'})})).addToggle(r=>{r.setValue(this.plugin.settings.autoParse).onChange(async o=>{this.plugin.settings.autoParse=o,o&&wi.start(),await this.plugin.saveSettings()})}),new ke.Setting(n).setName("Enable Debug Messages").setDesc(createFragment(r=>{r.createSpan({text:"Debug messages will be displayed by the file parser."})})).addToggle(r=>r.setValue(this.plugin.settings.debug).onChange(async o=>{this.plugin.settings.debug=o,wi.setDebug(),await this.plugin.saveSettings()}));let a;new ke.Setting(n).setName("Bestiary Folder").setDesc("The plugin will only parse notes inside these folders and their children.").addText(async r=>{let o=this.app.vault.getAllLoadedFiles().filter(c=>c instanceof ke.TFolder&&!this.plugin.settings.paths.includes(c.path));r.setPlaceholder("/"),new Jf.FolderInputSuggest(this.app,r,[...o]).onSelect(async({item:c})=>{a=(0,ke.normalizePath)(c.path),r.setValue(c.path)}),r.inputEl.onblur=async()=>{let c=r.inputEl.value?.trim()?r.inputEl.value.trim():"/";a=(0,ke.normalizePath)(c)}}).addExtraButton(r=>{r.setIcon("plus-with-circle").onClick(async()=>{!a||!a.length||(this.plugin.settings.paths.push((0,ke.normalizePath)(a)),await this.plugin.saveSettings(),await wi.reparseVault(),await this.generateParseSettings(t))})});let s=n.createDiv("additional");for(let r of this.plugin.settings.paths)new ke.Setting(s).setName(r).addExtraButton(o=>o.setIcon("trash").onClick(async()=>{this.plugin.settings.paths=this.plugin.settings.paths.filter(l=>l!=r),await this.plugin.saveSettings(),await wi.reparseVault(),await this.generateParseSettings(t)}))}generateLayouts(t){t.empty(),new ke.Setting(t).setHeading().setName("Layouts");let n=t.createDiv("statblock-additional-container");n.createDiv("setting-item").createDiv().appendChild(createFragment(l=>{l.createSpan({text:"New statblock layouts can be created and managed here. A specific layout can be used for a creature using the "}),l.createEl("code",{text:"layout"}),l.createSpan({text:" parameter."})}));let a=new ke.Setting(n).setName("Import From JSON").setDesc("Import a custom layout from a JSON file."),s=createEl("input",{attr:{type:"file",name:"layout",accept:".json",multiple:!0}});s.onchange=async()=>{let{files:l}=s;if(l.length)try{let{files:c}=s;if(!c.length)return;for(let d of Array.from(c))await new Promise((h,u)=>{let f=new FileReader;f.onload=async m=>{try{let p=JSON.parse(m.target.result);if(!p){u(new Error("Invalid layout imported"));return}if(!p?.name){u(new Error("Invalid layout imported: layout does not have a name"));return}if(!p?.blocks){u(new Error("Invalid layout imported: no blocks defined in layout."));return}p.diceParsing||(p.diceParsing=[]),p.id=q(),!this.plugin.settings.alwaysImport&&p.blocks.find(y=>y.type=="javascript")&&!await Ev(this.plugin)&&h(),this.plugin.settings.layouts.push(this.getDuplicate(p)),h()}catch(p){u(p)}},f.readAsText(d)}).catch(h=>{new ke.Notice(`There was an error importing the layout:
${h}`),console.error(h)});await this.plugin.saveSettings(),s.value=null,this.buildCustomLayouts(o,t)}catch{}},a.addButton(l=>{l.setIcon("upload"),l.buttonEl.addClass("statblock-file-upload"),l.buttonEl.appendChild(s),l.onClick(()=>s.click())}),new ke.Setting(n).setName("Add New Layout").addButton(l=>l.setIcon("plus-with-circle").setTooltip("Add New Layout").onClick(()=>{let c=new $a(this.plugin);c.onClose=async()=>{if(!c.saved)return;let d=this.getDuplicate(c.layout);this.plugin.settings.layouts.push(d),this.plugin.manager.addLayout(d),await this.plugin.saveSettings(),this.buildCustomLayouts(o,t)},c.open()}));let r=n.createDiv("additional");new ke.Setting(r).setName("Default Layout").setDesc("Change the default statblock layout used, if not specified.").addDropdown(async l=>{for(let c of this.plugin.manager.getAllLayouts())l.addOption(c.id,c.name);(!this.plugin.settings.default||!this.plugin.manager.getAllLayouts().find(({id:c})=>c==this.plugin.settings.default))&&(this.plugin.settings.default=ni.id,await this.plugin.saveSettings()),l.setValue(this.plugin.settings.default??ni.id),l.onChange(async c=>{this.plugin.settings.default=c,this.plugin.manager.setDefaultLayout(c),await this.plugin.saveSettings()})}),new ke.Setting(r).setName("Show Advanced Options").setDesc("Show advanced options when editing layout blocks.").addToggle(l=>l.setValue(this.plugin.settings.showAdvanced).onChange(async c=>{this.plugin.settings.showAdvanced=c,await this.plugin.saveSettings()}));let o=n.createDiv("additional");this.buildCustomLayouts(o,t)}getDuplicate(t){if(!this.plugin.manager.getAllLayouts().find(o=>o.name==t.name))return t;let n=this.plugin.manager.getSortedLayoutNames().filter(o=>o.contains(`${t.name} Copy`)),a=`${t.name} Copy`,s=a,r=1;for(;n.includes(s);)s=`${a} (${r})`,r++;return{blocks:(0,mc.default)(t.blocks),name:s,id:q()}}buildCustomLayouts(t,n){t.empty(),this.plugin.manager.getAllDefaultLayouts().some(a=>a.removed)&&new ke.Setting(t).setName("Restore Default Layouts").addButton(a=>{a.setIcon("rotate-ccw").onClick(async()=>{for(let s of Object.values(this.plugin.settings.defaultLayouts))s.removed=!1,s.edited||delete this.plugin.settings.defaultLayouts[s.id];await this.plugin.saveSettings(),this.generateLayouts(n)})});for(let a of this.plugin.manager.getAllDefaultLayouts()){if(a.removed)continue;let s=new ke.Setting(t).setName(a.name).addExtraButton(r=>{r.setIcon("pencil").setTooltip("Edit").onClick(()=>{let o=new $a(this.plugin,a);o.onClose=async()=>{o.saved&&(o.layout.edited=!0,this.plugin.settings.defaultLayouts[a.id]=o.layout,await this.plugin.saveSettings(),this.plugin.manager.updateDefaultLayout(a.id,o.layout),this.generateLayouts(n))},o.open()})});a.edited&&s.addExtraButton(r=>r.setIcon("undo").onClick(async()=>{let o=gn.find(({id:l})=>l==a.id);delete this.plugin.settings.defaultLayouts[a.id],await this.plugin.saveSettings(),this.plugin.manager.updateDefaultLayout(a.id,o),this.generateLayouts(n)})),s.addExtraButton(r=>{r.setIcon("duplicate-glyph").setTooltip("Create Copy").onClick(async()=>{let o=this.getDuplicate(a);this.plugin.settings.layouts.push(o),await this.plugin.saveSettings(),this.plugin.manager.addLayout(o),this.buildCustomLayouts(t,n)})}).addExtraButton(r=>{r.setIcon("import-glyph").setTooltip("Export as JSON").onClick(()=>{let o=createEl("a"),l=new Blob([JSON.stringify(a)],{type:"json"}),c=URL.createObjectURL(l);o.href=c,o.download=`${a.name}.json`,o.click(),URL.revokeObjectURL(c)})}).addExtraButton(r=>{r.setIcon("trash").setTooltip("Delete").onClick(async()=>{a.removed=!0,this.plugin.settings.defaultLayouts[a.id]=a,await this.plugin.saveSettings(),this.generateLayouts(n)})})}for(let a of this.plugin.settings.layouts)new ke.Setting(t).setName(a.name).addExtraButton(s=>{s.setIcon("pencil").setTooltip("Edit").onClick(()=>{let r=new $a(this.plugin,a);r.onClose=async()=>{r.saved&&(gn.find(({id:o})=>o==a.id)&&(r.layout.edited=!0),this.plugin.settings.layouts.splice(this.plugin.settings.layouts.indexOf(a),1,r.layout),await this.plugin.saveSettings(),this.plugin.manager.updateLayout(a.id,r.layout),this.generateLayouts(n))},r.open()})}).addExtraButton(s=>{s.setIcon("duplicate-glyph").setTooltip("Create Copy").onClick(async()=>{let r=this.getDuplicate(a);this.plugin.settings.layouts.push(r),await this.plugin.saveSettings(),this.plugin.manager.addLayout(r),this.buildCustomLayouts(t,n)})}).addExtraButton(s=>{s.setIcon("import-glyph").setTooltip("Export as JSON").onClick(()=>{let r=createEl("a"),o=new Blob([JSON.stringify(a)],{type:"json"}),l=URL.createObjectURL(o);r.href=l,r.download=`${a.name}.json`,r.click(),URL.revokeObjectURL(l)})}).addExtraButton(s=>{s.setIcon("trash").setTooltip("Delete").onClick(async()=>{this.plugin.settings.layouts=this.plugin.settings.layouts.filter(r=>r.id!==a.id),await this.plugin.saveSettings(),this.plugin.manager.removeLayout(a.id),this.generateLayouts(n)})})}generateImports(t){t.empty(),new ke.Setting(t).setHeading().setName("Import Homebrew Creatures");let n=t.createDiv("statblock-additional-container");new ke.Setting(n).setDesc("Import creatures from creature files. Monsters are stored by name, so only the last creature by that name will be saved. This is destructive - any saved creature will be overwritten.");let a=n.createDiv("additional"),s=new ke.Setting(a).setName("Import DnDAppFile").setDesc("Only import content that you own."),r=createEl("input",{attr:{type:"file",name:"dndappfile",accept:".xml",multiple:!0}});r.onchange=async()=>{let{files:w}=r;if(w.length)try{let{files:_}=r;if(!_.length)return;let O=await this.importer.import(_,"appfile");O&&O.length&&await this.plugin.saveMonsters(O),this.display()}catch{}},s.addButton(w=>{w.setButtonText("Choose File(s)").setTooltip("Import DnDAppFile Data"),w.buttonEl.addClass("statblock-file-upload"),w.buttonEl.appendChild(r),w.onClick(()=>r.click())});let o=new ke.Setting(a).setName("Import Improved Initiative Data").setDesc("Only import content that you own."),l=createEl("input",{attr:{type:"file",name:"improvedinitiative",accept:".json",multiple:!0}});l.onchange=async()=>{let{files:w}=l;if(w.length)try{let{files:_}=l;if(!_.length)return;let O=await this.importer.import(_,"improved");O&&O.length&&await this.plugin.saveMonsters(O),this.display()}catch{}},o.addButton(w=>{w.setButtonText("Choose File(s)").setTooltip("Import Improved Initiative Data"),w.buttonEl.addClass("statblock-file-upload"),w.buttonEl.appendChild(l),w.onClick(()=>l.click())});let c=new ke.Setting(a).setName("Import CritterDB Data").setDesc("Only import content that you own."),d=createEl("input",{attr:{type:"file",name:"critterdb",accept:".json",multiple:!0}});d.onchange=async()=>{let{files:w}=d;if(w.length)try{let{files:_}=d;if(!_.length)return;let O=await this.importer.import(_,"critter");O&&O.length&&await this.plugin.saveMonsters(O),this.display()}catch{}},c.addButton(w=>{w.setButtonText("Choose File(s)").setTooltip("Import CritterDB Data"),w.buttonEl.addClass("statblock-file-upload"),w.buttonEl.appendChild(d),w.onClick(()=>d.click())});let h=new ke.Setting(a).setName("Import 5e.tools Data").setDesc("Only import content that you own."),u=createEl("input",{attr:{type:"file",name:"fivetools",accept:".json",multiple:!0}});u.onchange=async()=>{let{files:w}=u;if(!w.length)return;let _=await this.importer.import(w,"5e");_&&_.length&&await this.plugin.saveMonsters(_),this.display()},h.addButton(w=>{w.setButtonText("Choose File(s)").setTooltip("Import 5e.tools Data"),w.buttonEl.addClass("statblock-file-upload"),w.buttonEl.appendChild(u),w.onClick(()=>u.click())});let f=new ke.Setting(a).setName("Import TetraCube Data").setDesc("Only import content that you own."),m=createEl("input",{attr:{type:"file",name:"tetra",accept:".json, .monster",multiple:!0}});m.onchange=async()=>{let{files:w}=m;if(!w.length)return;let _=await this.importer.import(w,"tetra");_&&_.length&&await this.plugin.saveMonsters(_),this.display()},f.addButton(w=>{w.setButtonText("Choose File(s)").setTooltip("Import TetraCube Data"),w.buttonEl.addClass("statblock-file-upload"),w.buttonEl.appendChild(m),w.onClick(()=>m.click())});let p=new ke.Setting(a).setName("Import Generic Data").setDesc(createFragment(w=>{w.createSpan({text:"Import generic JSON files. JSON objects will be imported "}),w.createEl("strong",{text:"as-is"}),w.createSpan({text:" and all objects must have the "}),w.createEl("code",{text:"name"}),w.createSpan({text:" property."})})),y=createEl("input",{attr:{type:"file",name:"generic",accept:".json, .monster",multiple:!0}});y.onchange=async()=>{let{files:w}=y;if(!w.length)return;let _=await this.importer.import(w,"generic");_&&_.length&&await this.plugin.saveMonsters(_),this.display()},p.addButton(w=>{w.setButtonText("Choose File(s)").setTooltip("Import Generic Data"),w.buttonEl.addClass("statblock-file-upload"),w.buttonEl.appendChild(y),w.onClick(()=>y.click())})}generateMonsters(t){t.empty(),new ke.Setting(t).setHeading().setName("Bestiary");let n=t.createDiv("statblock-additional-container statblock-monsters");new ke.Setting(n).setName("Add Creature").addButton(o=>{o.setIcon("plus-with-circle").onClick(()=>{let l=new Vn(this.plugin);l.onClose=()=>{this.generateMonsters(t)},l.open()})});let a=this.containerEl.closest(".statblock-settings"),{backgroundColor:s,paddingTop:r}=getComputedStyle(a);this.$UI=new Kf({target:n,props:{plugin:this.plugin,backgroundColor:s,paddingTop:r}})}hide(){this.$UI.$destroy()}},$a=class extends vt{constructor(t,n={name:"Layout",blocks:[],id:q()}){super(t);this.plugin=t;this.saved=!1;this.layout=(0,mc.default)(n),this.modalEl.addClasses(["mod-sidebar-layout","mod-settings"]),this.contentEl.addClass("vertical-tabs-container")}onOpen(){this.display()}display(){this.titleEl.createSpan({text:"Create Layout"}),this.creator=new cf({target:this.contentEl,props:{layout:this.layout,plugin:this.plugin}}),this.creator.$on("saved",()=>{this.saved=!0,this.close()}),this.creator.$on("cancel",()=>{this.close()})}};async function Ev(i){return new Promise((e,t)=>{try{let n=new fc(i);n.onClose=()=>{e(n.confirmed)},n.open()}catch{t()}})}var fc=class extends vt{constructor(t){super(t);this.plugin=t;this.confirmed=!1}async display(){this.contentEl.empty(),this.contentEl.addClass("confirm-modal"),this.contentEl.createEl("p",{text:"This Layout includes JavaScript blocks. JavaScript blocks can execute code in your vault, which could cause loss or corruption of data."}),this.contentEl.createEl("p",{text:"Are you sure you want to import this layout?"});let t=this.contentEl.createDiv("confirm-buttons-container");t.createEl("a").createEl("small",{cls:"dont-ask",text:"Import and don't ask again"}).onclick=async()=>{this.confirmed=!0,this.plugin.settings.alwaysImport=!0,this.close()};let n=t.createDiv("confirm-buttons");new ke.ButtonComponent(n).setButtonText("Import").setCta().onClick(()=>{this.confirmed=!0,this.close()}),n.createEl("a").createEl("small",{cls:"dont-ask",text:"Cancel"}).onclick=()=>{this.close()}}onOpen(){this.display()}};var tm=It(mi());var or=require("obsidian");var Qv=["creature","name","layout","source","dice","render","columns","forceColumns","columnWidth","columnHeight","extends"],rr=class extends or.EditorSuggest{constructor(t){super(t.app);this.plugin=t;this._context=4}getSuggestions(t){let n=[];switch(this._context){case 3:{n=["true","false"];break}case 1:{n=this.plugin.api.getBestiaryNames();break}case 0:{n=this.plugin.manager.getSortedLayoutNames();break}case 2:{let a=this.plugin.manager.getLayoutOrDefault(this._layout).id;this._props=this.plugin.manager.getProperties(a),n=[...new Set([...Qv,...this._props.keys()??[]])].filter(s=>!this._keys.includes(s));break}case 4:default:return[]}return t.query?.length?n.filter(a=>a.toLowerCase().contains(t.query.toLowerCase())):n}renderSuggestion(t,n){n.createSpan({text:t})}selectSuggestion(t,n){if(!this.context)return;let a=this.context.editor.getLine(this.context.end.line).slice(this.context.end.ch),[s,r]=a.match(/^(\] ?)/)??[],o;if(this._context===2)if(this._props.has(t))switch(this._props.get(t).type){case"heading":case"subheading":case"property":case"image":case"text":{t=`${t}: `;break}case"traits":{t=`${t}:
- name:
desc:`,o=t.length-10;break}case"table":{t=`${t}: []`,o=t.length-1;break}case"saves":case"spells":{t=`${t}:
- `,o=t.length;break}case"inline":case"group":case"ifelse":case"collapse":case"javascript":case"layout":default:break}else t=`${t}: `,o=t.length;this.context.editor.replaceRange(`${t}`,this.context.start,{...this.context.end,ch:this.context.start.ch+this.context.query.length+(r?.length??0)},"statblocks"),this.context.editor.setCursor(this.context.start.line,this.context.start.ch+o),this.close()}onTrigger(t,n,a){let s=n.getRange({line:0,ch:0},t);if(s.indexOf("```statblock\n")===-1)return null;let r=s.split(`
`),o=!1,l;for(let d=r.length-1;d>=0;d--){let h=r[d];if(/^\`\`\`$/.test(h))return null;if(/^\`\`\`statblock/.test(h)){o=!0,l=d;break}}if(!o)return;let c=n.getLine(t.line);if(this._context=4,/^name/.test(c))return null;if(/^(dice|render)/.test(c)){this._context=3;let d=c.match(/^(dice|render):\s?(.*)\n?/);if(!d)return null;let[h,u,f]=d;return f==="true"||f==="false"?null:{end:t,start:{ch:u.length+2,line:t.line},query:f}}if(/^(monster|creature|extends):/.test(c)){this._context=1;let d=c.match(/^(monster|creature|extends):\s?(.*)\n?/);if(!d)return null;let[h,u,f]=d;return ve.getBestiaryNames().find(m=>m.toLowerCase()==f.toLowerCase())?null:{end:t,start:{ch:u.length+2,line:t.line},query:f}}if(/^(layout):/m.test(c)){this._context=0;let d=c.match(/^(layout):\s?(.*)\n?/);if(!d)return null;let[h,u,f]=d;return this.plugin.manager.getAllLayouts().find(p=>p.name.toLowerCase()==f.toLowerCase())?null:{end:t,start:{ch:u.length+2,line:t.line},query:f}}try{let d=n.getValue().split(`
`);d.splice(t.line,1),d=d.slice(l+1);let h=d.findIndex(f=>/^```$/.test(f));h<0&&(h=d.length);let u=(0,or.parseYaml)(d.slice(0,h).join(`
`));this._keys=Object.keys(u),this._layout=u.layout??this.plugin.manager.getDefaultLayout().name}catch{this._keys=[]}return this._keys||(this._keys=[]),this._context=2,{end:t,start:{ch:0,line:t.line},query:c}}};var vn,Ha,gc,Kn,lr,Fa,ui,Ti,ja,Za,pc,Xa,bc,za=class{constructor(){Ee(this,Ha);Ee(this,Kn);Ee(this,Za);Ee(this,Xa);Ee(this,vn,new Map);Ee(this,Fa,void 0);Ee(this,ui,new Map);Ee(this,Ti,new Map);Ee(this,ja,new WeakMap)}initialize(e){this.setDefaultLayout(e.default),this.setDefaultLayouts(e.defaultLayouts),this.setLayouts(e.layouts);for(let t of this.getAllLayouts())this.addStyleSheet(t)}unload(){for(let e of te(this,vn).values())e.detach()}addStyleSheet(e){this.removeStyleSheet(e.id);let t=this.generateStyleSheet(e);t&&te(this,vn).set(e.id,t)}removeStyleSheet(e){te(this,vn).has(e)&&te(this,vn).get(e).detach()}getSheetRules(e){if(!e.cssProperties)return[];let t=`.${e.name.toLowerCase().replace(/\s+/g,"-")}`,n=[Qe(this,Kn,lr).call(this,t,{...Rl,...e.cssProperties})];return Ce.Light in e.cssProperties&&n.push(Qe(this,Kn,lr).call(this,`.theme-light ${t}`,e.cssProperties[Ce.Light])),Ce.Dark in e.cssProperties&&n.push(Qe(this,Kn,lr).call(this,`.theme-dark ${t}`,e.cssProperties[Ce.Dark])),n}generateStyleSheet(e,t=`FS_CSS_PROPERTIES_${e.id}`){if(!e.cssProperties)return null;let n=document.head.createEl("style",{attr:{id:t}}),a=this.getSheetRules(e);for(let s of a)n.sheet.insertRule(s,n.sheet.cssRules.length);return n}updateDefaultLayout(e,t){te(this,ui).delete(e),this.setDefaultLayouts({[t.id]:t}),this.addStyleSheet(t)}removeDefaultLayout(e){te(this,ui).delete(e),this.removeStyleSheet(e)}setDefaultLayouts(e){for(let t of gn)te(this,ui).set(t.id,t.id in e?e[t.id]:t);setTimeout(()=>{for(let t of te(this,ui).values())Qe(this,Za,pc).call(this,t)},0)}setDefaultLayout(e){ei(this,Fa,e)}getDefaultLayout(){return this.getAllLayouts()?.find(e=>e.id==te(this,Fa))??ni}setLayouts(e){for(let t of e)te(this,Ti).set(t.id,t);setTimeout(()=>{for(let t of e)Qe(this,Za,pc).call(this,t)},0)}getCustomLayouts(){return te(this,Ti).values()}getAllLayouts(){return[...te(this,ui).values(),...te(this,Ti).values()].filter(e=>!("removed"in e)||!e.removed)}getAllDefaultLayouts(){return[...te(this,ui).values()]}getLayout(e){return te(this,Ti).get(e)??te(this,ui).get(e)??null}getLayoutOrDefault(e){return this.getAllLayouts().find(t=>t.name==e)??this.getDefaultLayout()}updateLayout(e,t){te(this,Ti).delete(e),this.setLayouts([t]),this.addStyleSheet(t)}removeLayout(e){te(this,Ti).delete(e),this.removeStyleSheet(e)}addLayout(e){this.setLayouts([e]),this.addStyleSheet(e)}getSortedLayoutNames(){let e=new Set([this.getDefaultLayout().name]);for(let t of this.getAllLayouts())e.has(t.name)||e.add(t.name);return[...e]}getProperties(e){let t=typeof e=="string"?this.getLayout(e):e;return te(this,ja).get(t)}};vn=new WeakMap,Ha=new WeakSet,gc=function(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)},Kn=new WeakSet,lr=function(e,t){let n=[];for(let[a,s]of Object.entries(t)){if(a==Ce.Dark||a==Ce.Light)continue;let r=Ia.includes(s)?`var(--statblock-${Qe(this,Ha,gc).call(this,s)})`:s;n.push(`
--statblock-${Qe(this,Ha,gc).call(this,a)}: ${r};`)}return`${e} {${n.join("")}
}`},Fa=new WeakMap,ui=new WeakMap,Ti=new WeakMap,ja=new WeakMap,Za=new WeakSet,pc=function(e){let t=new Map;te(this,ja).set(e,Qe(this,Xa,bc).call(this,e.blocks,t))},Xa=new WeakSet,bc=function(e,t){for(let n of e){if("nested"in n){Qe(this,Xa,bc).call(this,n.nested,t);continue}if("properties"in n)for(let a of n.properties)t.set(a,n)}return t};var ji=require("obsidian");var Ci="fantasy-statblocks-creature-pane",qa=class extends ji.ItemView{constructor(t,n){super(t);this.plugin=n;this.topEl=this.contentEl.createDiv("creature-view-top-pane");this.statblockEl=this.contentEl.createDiv("creature-statblock-container");this.load(),this.containerEl.addClasses(["fantasy-statblocks","creature-view-container"]),this.containerEl.on("mouseover","a.internal-link",(0,ji.debounce)(a=>{this.plugin.app.workspace.trigger("hover-link",{event:a,source:this.plugin.manifest.id,hoverParent:this.leaf,targetEl:a.target,linktext:a.target.dataset.href})},10)),this.containerEl.on("click","a.internal-link",a=>app.workspace.openLinkText(a.target.dataset.href,"fantasy-statblocks"))}onload(){let t=new ji.SearchComponent(this.topEl).setPlaceholder("Find a creature"),n=new qn(this.plugin.app,t,ve.getBestiaryCreatures());ve.onResolved(()=>{n.items=ve.getBestiaryCreatures()}),n.onSelect(async a=>{a&&(await this.render(a.item),t.setValue(""))}),new ji.ExtraButtonComponent(this.topEl).setIcon("cross").setTooltip("Close Statblock").onClick(async()=>{await this.render(),t.setValue("")})}async render(t){if(this.statblockEl.empty(),!t){this.statblockEl.createEl("em",{text:"Select a creature to view it here."});return}let n=this.plugin.api.render(t,this.statblockEl);this.addChild(n)}getDisplayText(){return"Combatant"}getIcon(){return"skull"}getViewType(){return Ci}};var yc=It(mi());var Jn,cr=class{constructor(e){Ee(this,Jn,void 0);ei(this,Jn,e)}getVersion(){return te(this,Jn).settings.version}getBestiary(){return ve.getBestiary()}getBestiaryCreatures(){return ve.getBestiaryCreatures()}getBestiaryNames(){return ve.getBestiaryNames()}hasCreature(e){return ve.hasCreature(e)}getCreatureFromBestiary(e){return ve.getCreatureFromBestiarySync(e)}async getCreature(e){return await ve.getCreatureFromBestiary(e)}getSortedBy(e){return ve.getSortedBy(e)}onSortedBy(e,t){return ve.onSortedBy(e,t)}registerSorter(e,t){return ve.registerSorter(e,t)}getIndices(){return ve.getIndices()}getIndex(e){return ve.getIndex(e)}registerIndex(e){return ve.registerIndex(e)}onIndexUpdated(e,t){return ve.onIndexUpdated(e,t)}isResolved(){return ve.isResolved()}onResolved(e){return ve.onResolved(e)}onUpdated(e){return ve.onUpdated(e)}render(e,t,n){let a=Object.assign({},(0,yc.default)(this.getCreatureFromBestiary(e.name)??{}),(0,yc.default)(e));return a?(n&&(a.name=n),new qt({container:t,monster:a,plugin:te(this,Jn),context:"STATBLOCK_RENDERER"})):null}isStatblockLink(e){return oi.isStatblockLink(e)}parseStatblockLink(e){return oi.stringifyLinks(e)}};Jn=new WeakMap;var yn="FANTASY_STATBLOCKS_PLUGIN",Iv={monsters:[],defaultLayouts:{},layouts:[],default:ni.name,useDice:!0,renderDice:!1,export:!0,showAdvanced:!1,version:{major:null,minor:null,patch:null},paths:["/"],autoParse:!1,disableSRD:!1,tryToRenderLinks:!0,debug:!1,notifiedOfFantasy:!1,hideConditionHelp:!1,alwaysImport:!1,defaultLayoutsIntegrated:!1,atomicWrite:!1},dr,hr=class extends Zi.Plugin{constructor(){super(...arguments);this.manager=new za;this.api=new cr(this);Ee(this,dr,t=>{let n=t?.creature??t?.name??"";if(ve.hasCreature(n)){let a=ve.get(n);this.creature_view?this.creature_view.render(a):this.openCreatureView().then(s=>s.render(a))}})}getRoller(t){return this.canUseDiceRoller?window.DiceRoller.getRollerSync(t,yn):void 0}getRollerString(t){return this.canUseDiceRoller?window.DiceRoller.getRollerString(t,yn):t}get diceRollerInstalled(){return window.DiceRoller!=null}get canUseDiceRoller(){return this.diceRollerInstalled?this.settings.useDice:!1}get creature_view(){let t=this.app.workspace.getLeavesOfType(Ci),n=t?.length?t[0]:null;if(n&&n.view&&n.view instanceof qa)return n.view}async openCreatureView(t=!1){let n,a=this.app.workspace.getLeavesOfType(Ci);return!t&&a?.length?n=a.shift():(t&&a?.length?n=this.app.workspace.createLeafInParent(a[0].parent,a[0].parent.children.length):n=this.app.workspace.getRightLeaf(!0),await n.setViewState({type:Ci})),this.app.workspace.revealLeaf(n),n.view}async onload(){console.log("Fantasy StatBlocks loaded"),this.app.workspace.trigger("fantasy-statblocks:loaded",null),await this.loadSettings(),await this.saveSettings(),this.manager.initialize(this.settings),this.register(()=>this.manager.unload()),ve.initialize(this),ct.initialize(this.app.metadataCache),this.register(()=>ct.unload()),this.registerHoverLinkSource(this.manifest.id,{display:this.manifest.name,defaultMod:!1}),this.addCommand({id:"open-creature-view",name:"Open Creature pane",checkCallback:t=>this.app.workspace.getLeavesOfType(Ci).length?!1:(t||this.openCreatureView(),!0)}),this.addCommand({id:"reveal-creature-view",name:"Reveal Creature pane",checkCallback:t=>this.app.workspace.getLeavesOfType(Ci).length?(t||this.openCreatureView(),!0):!1}),this.addCommand({id:"open-new-creature-view",name:"Open new Creature pane",callback:()=>{this.openCreatureView(!0)}}),this.addRibbonIcon("skull","Open Creature pane",async t=>{this.openCreatureView(t.getModifierState("Meta"))}),this.registerObsidianProtocolHandler("creature-pane",te(this,dr).bind(this)),(0,Zi.addIcon)("markdown-icon",'<svg fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M593.8 59.1H46.2C20.7 59.1 0 79.8 0 105.2v301.5c0 25.5 20.7 46.2 46.2 46.2h547.7c25.5 0 46.2-20.7 46.1-46.1V105.2c0-25.4-20.7-46.1-46.2-46.1zM338.5 360.6H277v-120l-61.5 76.9-61.5-76.9v120H92.3V151.4h61.5l61.5 76.9 61.5-76.9h61.5v209.2zm135.3 3.1L381.5 256H443V151.4h61.5V256H566z"/></svg>'),this.addSettingTab(new Ba(this.app,this)),(window.FantasyStatblocks=this.api)&&this.register(()=>delete window.FantasyStatblocks),this.registerMarkdownCodeBlockProcessor("statblock",this.postprocessor.bind(this)),this.registerEditorSuggest(new rr(this)),this.registerView(Ci,t=>new qa(t,this)),this.canUseDiceRoller&&window.DiceRoller.registerSource(yn,{showDice:!0,shouldRender:this.settings.renderDice,showFormula:!1,showParens:!1,expectedValue:Gn.Average,text:null}),this.registerEvent(this.app.workspace.on("dice-roller:loaded",()=>{window.DiceRoller.registerSource(yn,{showDice:!0,shouldRender:this.settings.renderDice,showFormula:!1,showParens:!1,expectedValue:Gn.Average,text:null})}))}async loadSettings(){let t=await this.loadData();if(this.settings={...Iv,...t},!this.settings.defaultLayoutsIntegrated){for(let s of this.settings.layouts)s.id=q();this.settings.default=(this.layouts.find(({name:s})=>s==this.settings.default)??ni).id,this.settings.defaultLayoutsIntegrated=!0}if(Array.isArray(this.settings.defaultLayouts)){let s={};for(let r of this.settings.defaultLayouts)(r.removed||r.edited)&&(s[r.id]=r);this.settings.defaultLayouts=s}for(let s of gn){if(!(s.id in this.settings.defaultLayouts)||s.version==null)continue;let r=this.settings.defaultLayouts[s.id];if(!(r.version>=s.version)){if(r.edited){r.updatable=!0;continue}r.blocks=(0,tm.default)(s.blocks)}}function n(...s){for(let r of s)r.type=="spells"&&(r.properties.length||r.properties.push("spells")),"nested"in r&&n(...r.nested)}for(let s of this.settings.layouts)n(...s.blocks);let a=this.manifest.version.split(".");this.settings.version={major:Number(a[0]),minor:Number(a[1]),patch:Number(a[2])}}async saveSettings(){this.app.workspace.trigger("fantasy-statblocks:settings-change",this.settings),await this.saveData(this.settings)}async loadData(){return await super.loadData()}async saveData(t){super.saveData(t)}async saveMonster(t,n=!0){if(t.name){if(ve.isLocal(t.name)){let a=this.settings.monsters.findIndex(([s])=>s===t.name);a>=0?this.settings.monsters.splice(a,1,[t.name,t]):this.settings.monsters.push([t.name,t])}else this.settings.monsters.push([t.name,t]);ve.addLocalCreature(t),n&&await this.saveSettings()}}async saveMonsters(t){for(let n of t)await this.saveMonster(n,!1);await this.saveSettings()}async updateMonster(t,n){await this.deleteMonsters(t.name),await this.saveMonster(n)}async deleteMonsters(...t){for(let n of t)ve.removeLocalCreature(n);this.settings.monsters=this.settings.monsters.filter(([n])=>!t.includes(n)),await this.saveSettings()}onunload(){console.log("Fantasy StatBlocks unloaded"),this.app.workspace.getLeavesOfType(Ci).forEach(t=>t.detach())}exportAsPng(t,n){function a(r){return!r.hasClass||!r.hasClass("clickable-icon")}let s=n.querySelector(".statblock-content");s&&delete s.style.boxShadow,em.default.toPng(n,{filter:a,style:{height:"100%"}}).then(r=>{let o=document.createElement("a");o.download=t+".png",o.href=r,o.click(),o.detach()}).catch(r=>{new Zi.Notice(`There was an error creating the image:
${r.message}`),console.error(r)})}get layouts(){return this.manager.getAllLayouts()}get defaultLayout(){return this.manager.getDefaultLayout()}getLayoutOrDefault(t){return this.manager.getLayoutOrDefault(t.layout)}async postprocessor(t,n,a){try{t=ct.transformSource(t);let s=(0,Zi.parseYaml)(t);n.addClass("statblock-plugin-container"),n.parentElement?.addClass("statblock-plugin-parent");let r=new qt({container:n,plugin:this,params:s,context:a.sourcePath});a.addChild(r)}catch(s){console.error(`Obsidian Statblock Error:
${s}`),createEl("pre").setText(`\`\`\`statblock
There was an error rendering the statblock:
${s.stack.split(`
`).filter(o=>!/^at/.test(o?.trim())).join(`
`)}
\`\`\``)}}render(t,n,a){this.api.render(t,n,a)}};dr=new WeakMap;