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

432 lines
726 KiB
JavaScript
Raw Permalink Normal View History

vault auto-backup: 05.07.2022 - 19:21:37 Affected files: .gitattributes .gitignore .obsidian/app.json .obsidian/appearance.json .obsidian/community-plugins.json .obsidian/core-plugins.json .obsidian/graph.json .obsidian/page-preview.json .obsidian/plugins/calendar/data.json .obsidian/plugins/calendar/main.js .obsidian/plugins/calendar/manifest.json .obsidian/plugins/initiative-tracker/main.js .obsidian/plugins/initiative-tracker/manifest.json .obsidian/plugins/initiative-tracker/styles.css .obsidian/plugins/obsidian-5e-statblocks/data.json .obsidian/plugins/obsidian-5e-statblocks/main.js .obsidian/plugins/obsidian-5e-statblocks/manifest.json .obsidian/plugins/obsidian-5e-statblocks/styles.css .obsidian/plugins/obsidian-admonition/data.json .obsidian/plugins/obsidian-admonition/main.js .obsidian/plugins/obsidian-admonition/manifest.json .obsidian/plugins/obsidian-admonition/styles.css .obsidian/plugins/obsidian-auto-link-title/main.js .obsidian/plugins/obsidian-auto-link-title/manifest.json .obsidian/plugins/obsidian-auto-link-title/styles.css .obsidian/plugins/obsidian-dialogue-plugin/main.js .obsidian/plugins/obsidian-dialogue-plugin/manifest.json .obsidian/plugins/obsidian-dialogue-plugin/styles.css .obsidian/plugins/obsidian-dice-roller/main.js .obsidian/plugins/obsidian-dice-roller/manifest.json .obsidian/plugins/obsidian-dice-roller/styles.css .obsidian/plugins/obsidian-git/data.json .obsidian/plugins/obsidian-icons-plugin/main.js .obsidian/plugins/obsidian-icons-plugin/manifest.json .obsidian/plugins/obsidian-icons-plugin/styles.css .obsidian/plugins/obsidian-image-toolkit/data.json .obsidian/plugins/obsidian-image-toolkit/main.js .obsidian/plugins/obsidian-image-toolkit/manifest.json .obsidian/plugins/obsidian-image-toolkit/styles.css .obsidian/plugins/obsidian-pandoc/main.js .obsidian/plugins/obsidian-pandoc/manifest.json .obsidian/plugins/obsidian-pandoc/styles.css .obsidian/plugins/obsidian-reading-time/main.js .obsidian/plugins/obsidian-reading-time/manifest.json .obsidian/plugins/periodic-notes/data.json .obsidian/plugins/periodic-notes/main.js .obsidian/plugins/periodic-notes/manifest.json .obsidian/plugins/periodic-notes/styles.css .obsidian/plugins/table-editor-obsidian/data.json .obsidian/plugins/table-editor-obsidian/main.js .obsidian/plugins/table-editor-obsidian/manifest.json .obsidian/plugins/table-editor-obsidian/styles.css .obsidian/themes/Deep Work.css Personen/PC/Artennis.md Personen/PC/Untitled.md Sessions/05.07.22.md
2022-07-05 17:21:40 +00:00
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var bc=Object.create;var za=Object.defineProperty;var _c=Object.getOwnPropertyDescriptor;var kc=Object.getOwnPropertyNames;var vc=Object.getPrototypeOf,yc=Object.prototype.hasOwnProperty;var Ts=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),wc=(t,e)=>{for(var a in e)za(t,a,{get:e[a],enumerable:!0})},Cs=(t,e,a,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of kc(e))!yc.call(t,i)&&i!==a&&za(t,i,{get:()=>e[i],enumerable:!(n=_c(e,i))||n.enumerable});return t};var ma=(t,e,a)=>(a=t!=null?bc(vc(t)):{},Cs(e||!t||!t.__esModule?za(a,"default",{value:t,enumerable:!0}):a,t)),Tc=t=>Cs(za({},"__esModule",{value:!0}),t);var As=Ts((xs,zn)=>{(function(t){"use strict";var e=D(),a=I(),n=T(),i=k(),s={imagePlaceholder:void 0,cacheBust:!1},o={toSvg:r,toPng:d,toJpeg:l,toBlob:m,toPixelData:c,impl:{fontFaces:n,images:i,util:e,inliner:a,options:{}}};typeof zn<"u"?zn.exports=o:t.domtoimage=o;function r(g,p){return p=p||{},u(p),Promise.resolve(g).then(function(E){return f(E,p.filter,!0)}).then(b).then(y).then(v).then(function(E){return _(E,p.width||e.width(g),p.height||e.height(g))});function v(E){return p.bgcolor&&(E.style.backgroundColor=p.bgcolor),p.width&&(E.style.width=p.width+"px"),p.height&&(E.style.height=p.height+"px"),p.style&&Object.keys(p.style).forEach(function(H){E.style[H]=p.style[H]}),E}}function c(g,p){return h(g,p||{}).then(function(v){return v.getContext("2d").getImageData(0,0,e.width(g),e.height(g)).data})}function d(g,p){return h(g,p||{}).then(function(v){return v.toDataURL()})}function l(g,p){return p=p||{},h(g,p).then(function(v){return v.toDataURL("image/jpeg",p.quality||1)})}function m(g,p){return h(g,p||{}).then(e.canvasToBlob)}function u(g){typeof g.imagePlaceholder>"u"?o.impl.options.imagePlaceholder=s.imagePlaceholder:o.impl.options.imagePlaceholder=g.imagePlaceholder,typeof g.cacheBust>"u"?o.impl.options.cacheBust=s.cacheBust:o.impl.options.cacheBust=g.cacheBust}function h(g,p){return r(g,p).then(e.makeImage).then(e.delay(100)).then(function(E){var H=v(g);return H.getContext("2d").drawImage(E,0,0),H});function v(E){var H=document.createElement("canvas");if(H.width=p.width||e.width(E),H.height=p.height||e.height(E),p.bgcolor){var w=H.getContext("2d");w.fillStyle=p.bgcolor,w.fillRect(0,0,H.width,H.height)}return H}}function f(g,p,v){if(!v&&p&&!p(g))return Promise.resolve();return Promise.resolve(g).then(E).then(function(W){return H(g,W,p)}).then(function(W){return w(g,W)});function E(W){return W instanceof HTMLCanvasElement?e.makeImage(W.toDataURL()):W.cloneNode(!1)}function H(W,R,G){var z=W.childNodes;if(z.length===0)return Promise.resolve(R);return Z(R,e.asArray(z),G).then(function(){return R});function Z(N,ue,ce){var ve=Promise.resolve();return ue.forEach(function(Fe){ve=ve.then(function(){return f(Fe,ce)}).then(function(ie){ie&&N.appendChild(ie)})}),ve}}function w(W,R){if(!(R instanceof Element))return R;return Promise.resolve().then(G).then(z).then(Z).then(N).then(function(){return R});function G(){ue(window.getComputedStyle(W),R.style);function ue(ce,ve){ce.cssText?ve.cssText=ce.cssText:Fe(ce,ve);function Fe(ie,he){e.asArray(ie).forEach(function(O){he.setProperty(O,ie.getPropertyValue(O),ie.getPropertyPriority(O))})}}}function z(){[":before",":after"].forEach(function(ce){ue(ce)});function ue(ce){var ve=window.getComputedStyle(W,ce),Fe=ve.getPropertyValue("content");if(Fe===""||Fe==="none")return;var ie=e.uid();R.className=R.className+" "+ie;var he=document.createElement("style");he.appendChild(O(ie,ce,ve)),R.appendChild(he);function O(K,ee,Q){var ge="."+K+":"+ee,Le=Q.cssText?ua(Q):Mt(Q);return document.createTextNode(ge+"{"+Le+"}");function ua(Je){var Ue=Je.getPropertyValue("content");return Je.cssText+" content: "+Ue+";"}function Mt(Je){return e.asArray(Je).map(Ue).join("; ")+";";function Ue(St){return St+": "+Je.getPropertyValue(St)+(Je.getPropertyPriority(St)?" !important":"")}}}}}function Z(){W instanceof HTMLTextAreaElement&&(R.innerHTML=W.value),W instanceof HTMLInputElement&&R.setAttribute("value",W.value)}function N(){R instanceof SVGElement&&(R.setAttribute("xmlns","http://www.w3.
`)})}function p(){return Promise.resolve(e.asArray(document.styleSheets)).then(E).then(v).then(function(w){return w.map(H)});function v(w){return w.filter(function(W){return W.type===CSSRule.FONT_FACE_RULE}).filter(function(W){return a.shouldProcess(W.style.getPropertyValue("src"))})}function E(w){var W=[];return w.forEach(function(R){try{e.asArray(R.cssRules||[]).forEach(W.push.bind(W))}catch(G){console.log("Error while reading CSS rules from "+R.href,G.toString())}}),W}function H(w){return{resolve:function(){var R=(w.parentStyleSheet||{}).href;return a.inlineAll(w.cssText,R)},src:function(){return w.style.getPropertyValue("src")}}}}}function k(){return{inlineAll:p,impl:{newImage:g}};function g(v){return{inline:E};function E(H){return e.isDataUrl(v.src)?Promise.resolve():Promise.resolve(v.src).then(H||e.getAndEncode).then(function(w){return e.dataAsUrl(w,e.mimeType(v.src))}).then(function(w){return new Promise(function(W,R){v.onload=W,v.onerror=R,v.src=w})})}}function p(v){if(!(v instanceof Element))return Promise.resolve(v);return E(v).then(function(){return v instanceof HTMLImageElement?g(v).inline():Promise.all(e.asArray(v.childNodes).map(function(H){return p(H)}))});function E(H){var w=H.style.getPropertyValue("background");return w?a.inlineAll(w).then(function(W){H.style.setProperty("background",W,H.style.getPropertyPriority("background"))}).then(function(){return H}):Promise.resolve(H)}}}})(xs)});var _a=Ts((_i,ki)=>{(function(t,e){typeof _i=="object"&&typeof ki<"u"?ki.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self,t["fast-copy"]=e())})(_i,function(){"use strict";var t=Function.prototype.toString,e=Object.create,a=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,s=Object.getOwnPropertySymbols,o=Object.getPrototypeOf,r=Object.prototype,c=r.hasOwnProperty,d=r.propertyIsEnumerable,l=typeof s=="function",m=typeof WeakMap=="function",u=function(){if(m)return function(){return new WeakMap};var k=function(){function g(){this._keys=[],this._values=[]}return g.prototype.has=function(p){return!!~this._keys.indexOf(p)},g.prototype.get=function(p){return this._values[this._keys.indexOf(p)]},g.prototype.set=function(p,v){this._keys.push(p),this._values.push(v)},g}();return function(){return new k}}(),h=function(k,g){var p=k.__proto__||o(k);if(!p)return e(null);var v=p.constructor;if(v===g.Object)return p===g.Object.prototype?{}:e(p);if(~t.call(v).indexOf("[native code]"))try{return new v}catch{}return e(p)},f=function(k,g,p,v){var E=h(k,g);v.set(k,E);for(var H in k)c.call(k,H)&&(E[H]=p(k[H],v));if(l)for(var w=s(k),W=0,R=w.length,G=void 0;W<R;++W)G=w[W],d.call(k,G)&&(E[G]=p(k[G],v));return E},b=function(k,g,p,v){var E=h(k,g);v.set(k,E);for(var H=l?i(k).concat(s(k)):i(k),w=0,W=H.length,R=void 0,G=void 0;w<W;++w)if(R=H[w],R!=="callee"&&R!=="caller")if(G=n(k,R),G){!G.get&&!G.set&&(G.value=p(k[R],v));try{a(E,R,G)}catch{E[R]=G.value}}else E[R]=p(k[R],v);return E},y=function(k){var g="";return k.global&&(g+="g"),k.ignoreCase&&(g+="i"),k.multiline&&(g+="m"),k.unicode&&(g+="u"),k.sticky&&(g+="y"),g},_=Array.isArray,D=Object.getPrototypeOf,I=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 T(k,g){var p=!!(g&&g.isStrict),v=g&&g.realm||I,E=p?b:f,H=function(w,W){if(!w||typeof w!="object")return w;if(W.has(w))return W.get(w);var R=w.__proto__||D(w),G=R&&R.constructor;if(!G||G===v.Object)return E(w,v,H,W);var z;if(_(w)){if(p)return b(w,v,H,W);z=new G,W.set(w,z);for(var Z=0,N=w.length;Z<N;++Z)z[Z]=H(w[Z],W);return z}if(w instanceof v.Date)return new G(w.getTime());if(w instanceof v.RegExp)return z=new G(w.source,w.flags||y(w)),z.lastIndex=w.lastIndex,z;if(v.Map&&w instanceof v.Map)return z=new G,W.set(w,z),w.forEach(function(ue,ce){z.set(ce,H(ue,W))}),z;if(v.Set&&w instanceof v.Set)return z=new G,W.set(w,z),w.forEach(function(ue){z.add(H(ue,W))}),z;if(v.Blob&&w instanceof
"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 \`\${CR[
monster.cr
].cr} (\${CR[
monster.cr
].xp.toLocaleString()} XP)\`;
}
return "";`},{type:"property",id:L(),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:L(),properties:["traits"],conditioned:!0,dice:!0},{type:"spells",id:L(),properties:["spells"],conditioned:!0,dice:!0},{type:"traits",id:L(),properties:["actions"],heading:"Actions",conditioned:!0,dice:!0},{type:"traits",id:L(),properties:["bonus_actions"],heading:"Bonus Actions",conditioned:!0,dice:!0},{type:"traits",id:L(),properties:["legendary_actions"],heading:"Legendary Actions",conditioned:!0,dice:!0},{type:"traits",id:L(),properties:["reactions"],heading:"Reactions",conditioned:!0,dice:!0},{type:"traits",id:L(),properties:["lair_actions"],heading:"Lair Actions",conditioned:!0,dice:!0}],Ve={blocks:xc,name:"Basic 5e Layout"};var Wo=require("obsidian");function P(){}var Ms=t=>t;function Ac(t){return t&&typeof t=="object"&&typeof t.then=="function"}function $n(t){return t()}function Ds(){return Object.create(null)}function fe(t){t.forEach($n)}function et(t){return typeof t=="function"}function j(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}var La;function Ss(t,e){return La||(La=document.createElement("a")),La.href=e,t===La.href}function Es(t){return Object.keys(t).length===0}function Is(t){return t??""}function te(t){return t&&et(t.destroy)?t.destroy:P}var Ps=typeof window<"u",Dc=Ps?()=>window.performance.now():()=>Date.now(),Gn=Ps?t=>requestAnimationFrame(t):P;var Yt=new Set;function Ws(t){Yt.forEach(e=>{e.c(t)||(Yt.delete(e),e.f())}),Yt.size!==0&&Gn(Ws)}function Mc(t){let e;return Yt.size===0&&Gn(Ws),{promise:new Promise(a=>{Yt.add(e={c:t,f:a})}),abort(){Yt.delete(e)}}}var Hs=!1;function Sc(){Hs=!0}function Ec(){Hs=!1}function x(t,e){t.appendChild(e)}function Y(t,e,a){let n=qn(t);if(!n.getElementById(e)){let i=C("style");i.id=e,i.textContent=a,Os(n,i)}}function qn(t){if(!t)return document;let e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function Ic(t){let e=C("style");return Os(qn(t),e),e.sheet}function Os(t,e){x(t.head||t,e)}function S(t,e,a){t.insertBefore(e,a||null)}function M(t){t.parentNode.removeChild(t)}function tt(t,e){for(let a=0;a<t.length;a+=1)t[a]&&t[a].d(e)}function C(t){return document.createElement(t)}function J(t){return document.createTextNode(t)}function $(){return J(" ")}function oe(){return J("")}function Ee(t,e,a,n){return t.addEventListener(e,a,n),()=>t.removeEventListener(e,a,n)}function A(t,e,a){a==null?t.removeAttribute(e):t.getAttribute(e)!==a&&t.setAttribute(e,a)}function Pc(t){return Array.from(t.childNodes)}function me(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function Un(t,e,a,n){a===null?t.style.removeProperty(e):t.style.setProperty(e,a,n?"important":"")}function $e(t,e,a){t.classList[a?"add":"remove"](e)}function Wc(t,e,{bubbles:a=!1,cancelable:n=!1}={}){let i=document.createEvent("CustomEvent");return i.initCustomEvent(t,a,n,e),i}var qa=new Map,Ua=0;function Hc(t){let e=5381,a=t.length;for(;a--;)e=(e<<5)-e^t.charCodeAt(a);return e>>>0}function Oc(t,e){let a={stylesheet:Ic(e),rules:{}};return qa.set(t,a),a}function Rc(t,e,a,n,i,s,o,r=0){let c=16.666/n,d=`{
`;for(let y=0;y<=1;y+=c){let _=e+(a-e)*s(y);d+=y*100+`%{${o(_,1-_)}}
`}let l=d+`100% {${o(a,1-a)}}
}`,m=`__svelte_${Hc(l)}_${r}`,u=qn(t),{stylesheet:h,rules:f}=qa.get(u)||Oc(u,t);f[m]||(f[m]=!0,h.insertRule(`@keyframes ${m} ${l}`,h.cssRules.length));let b=t.style.animation||"";return t.style.animation=`${b?`${b}, `:""}${m} ${n}ms linear ${i}ms 1 both`,Ua+=1,m}function Bc(t,e){let a=(t.style.animation||"").split(", "),n=a.filter(e?s=>s.indexOf(e)<0:s=>s.indexOf("__svelte")===-1),i=a.length-n.length;i&&(t.style.animation=n.join(", "),Ua-=i,Ua||zc())}function zc(){Gn(()=>{Ua||(qa.forEach(t=>{let{stylesheet:e}=t,a=e.cssRules.length;for(;a--;)e.deleteRule(a);t.rules={}}),qa.clear())})}function Va(t,e,a,n){if(!e)return P;let i=t.getBoundingClientRect();if(e.left===i.left&&e.right===i.right&&e.top===i.top&&e.bottom===i.bottom)return P;let{delay:s=0,duration:o=300,easing:r=Ms,start:c=Dc()+s,end:d=c+o,tick:l=P,css:m}=a(t,{from:e,to:i},n),u=!0,h=!1,f;function b(){m&&(f=Rc(t,0,1,o,s,r,m)),s||(h=!0)}function y(){m&&Bc(t,f),u=!1}return Mc(_=>{if(!h&&_>=c&&(h=!0),h&&_>=d&&(l(1,0),y()),!u)return!1;if(h){let D=_-c,I=0+1*r(D/o);l(I,1-I)}return!0}),b(),l(0,1),y}function Ka(t){let e=getComputedStyle(t);if(e.position!=="absolute"&&e.position!=="fixed"){let{width:a,height:n}=e,i=t.getBoundingClientRect();t.style.position="absolute",t.style.width=a,t.style.height=n,Nc(t,i)}}function Nc(t,e){let a=t.getBoundingClientRect();if(e.left!==a.left||e.top!==a.top){let n=getComputedStyle(t),i=n.transform==="none"?"":n.transform;t.style.transform=`${i} translate(${e.left-a.left}px, ${e.top-a.top}px)`}}var pa;function mt(t){pa=t}function Pt(){if(!pa)throw new Error("Function called outside component initialization");return pa}function fa(t){Pt().$$.on_mount.push(t)}function Vn(t){Pt().$$.on_destroy.push(t)}function ze(){let t=Pt();return(e,a,{cancelable:n=!1}={})=>{let i=t.$$.callbacks[e];if(i){let s=Wc(e,a,{cancelable:n});return i.slice().forEach(o=>{o.call(t,s)}),!s.defaultPrevented}return!0}}function ht(t,e){return Pt().$$.context.set(t,e),e}function be(t){return Pt().$$.context.get(t)}function Kn(){return Pt().$$.context}function Yn(t,e){let a=t.$$.callbacks[e.type];a&&a.slice().forEach(n=>n.call(this,e))}var ga=[];var Qe=[],$a=[],Fn=[],Fc=Promise.resolve(),Ln=!1;function Lc(){Ln||(Ln=!0,Fc.then(Zn))}function jn(t){$a.push(t)}function Xn(t){Fn.push(t)}var Nn=new Set,ja=0;function Zn(){let t=pa;do{for(;ja<ga.length;){let e=ga[ja];ja++,mt(e),jc(e.$$)}for(mt(null),ga.length=0,ja=0;Qe.length;)Qe.pop()();for(let e=0;e<$a.length;e+=1){let a=$a[e];Nn.has(a)||(Nn.add(a),a())}$a.length=0}while(ga.length);for(;Fn.length;)Fn.pop()();Ln=!1,Nn.clear(),mt(t)}function jc(t){if(t.fragment!==null){t.update(),fe(t.before_update);let e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(jn)}}var Ga=new Set,It;function de(){It={r:0,c:[],p:It}}function le(){It.r||fe(It.c),It=It.p}function B(t,e){t&&t.i&&(Ga.delete(t),t.i(e))}function F(t,e,a,n){if(t&&t.o){if(Ga.has(t))return;Ga.add(t),It.c.push(()=>{Ga.delete(t),n&&(a&&t.d(1),n())}),t.o(e)}}function Rs(t,e){let a=e.token={};function n(i,s,o,r){if(e.token!==a)return;e.resolved=r;let c=e.ctx;o!==void 0&&(c=c.slice(),c[o]=r);let d=i&&(e.current=i)(c),l=!1;e.block&&(e.blocks?e.blocks.forEach((m,u)=>{u!==s&&m&&(de(),F(m,1,1,()=>{e.blocks[u]===m&&(e.blocks[u]=null)}),le())}):e.block.d(1),d.c(),B(d,1),d.m(e.mount(),e.anchor),l=!0),e.block=d,e.blocks&&(e.blocks[s]=d),l&&Zn()}if(Ac(t)){let i=Pt();if(t.then(s=>{mt(i),n(e.then,1,e.value,s),mt(null)},s=>{if(mt(i),n(e.catch,2,e.error,s),mt(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,t),!0;e.resolved=t}}function Bs(t,e,a){let n=e.slice(),{resolved:i}=t;t.current===t.then&&(n[t.value]=i),t.current===t.catch&&(n[t.error]=i),t.block.p(n,a)}var Sm=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function $c(t,e){t.d(1),e.delete(t.key)}function Gc(t,e){F(t,1,1,()=>{e.delete(t.key)})}function zs(t,e){t.f(),$c(t,e)}function Ns(t,e){t.f(),Gc(t,e)}function Ya(t,e,a,n,i,s,o,r,c,d,l,m){let u=t.length,h=s.length,f=u,b={};for(;f--;)b[t[f].key]=f;let y=[],_=new Map,D=ne
${d.message}`),console.error(d)}else{let d=r.parseForDice(n);Array.isArray(d)?c=d:c=[d]}return t.$$set=d=>{"property"in d&&a(0,n=d.property)},[n,c,s]}var ai=class extends q{constructor(e){super(),U(this,e,od,sd,j,{property:0},ed)}},Ys=ai;var Xs=require("obsidian");function rd(t){Y(t,"svelte-4lp5jt",".statblock-markdown.svelte-4lp5jt{display:inline}.statblock-markdown.svelte-4lp5jt p{display:inline}")}function cd(t){let e,a,n,i;return{c(){e=C("div"),A(e,"class","statblock-markdown svelte-4lp5jt")},m(s,o){S(s,e,o),n||(i=te(a=t[0].call(null,e)),n=!0)},p:P,i:P,o:P,d(s){s&&M(e),n=!1,i()}}}function dd(t,e,a){let{property:n}=e,i=be("context"),s=be("renderer"),o=r=>{Xs.MarkdownRenderer.renderMarkdown(n,r,i,s)};return t.$$set=r=>{"property"in r&&a(1,n=r.property)},[o,n]}var ni=class extends q{constructor(e){super(),U(this,e,dd,cd,j,{property:1},rd)}},Zs=ni;function ld(t){let e,a;return e=new Ys({props:{property:t[0]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),a=!0},p(n,i){let s={};i&1&&(s.property=n[0]),e.$set(s)},i(n){a||(B(e.$$.fragment,n),a=!0)},o(n){F(e.$$.fragment,n),a=!1},d(n){ae(e,n)}}}function ud(t){let e,a;return e=new Zs({props:{property:t[0]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),a=!0},p(n,i){let s={};i&1&&(s.property=n[0]),e.$set(s)},i(n){a||(B(e.$$.fragment,n),a=!0)},o(n){F(e.$$.fragment,n),a=!1},d(n){ae(e,n)}}}function md(t){let e,a,n,i,s=[ud,ld],o=[];function r(c,d){return c[1]?0:1}return e=r(t,-1),a=o[e]=s[e](t),{c(){a.c(),n=oe()},m(c,d){o[e].m(c,d),S(c,n,d),i=!0},p(c,[d]){let l=e;e=r(c,d),e===l?o[e].p(c,d):(de(),F(o[l],1,1,()=>{o[l]=null}),le(),a=o[e],a?a.p(c,d):(a=o[e]=s[e](c),a.c()),B(a,1),a.m(n.parentNode,n))},i(c){i||(B(a),i=!0)},o(c){F(a),i=!1},d(c){o[e].d(c),c&&M(n)}}}function hd(t,e,a){let{property:n}=e,{render:i=!1}=e;return t.$$set=s=>{"property"in s&&a(0,n=s.property),"render"in s&&a(1,i=s.render)},[n,i]}var ii=class extends q{constructor(e){super(),U(this,e,hd,md,j,{property:0,render:1})}},kt=ii;function gd(t){Y(t,"svelte-oskcir",".property-text.svelte-oskcir{display:inline;white-space:pre-line;text-indent:0}.property-name.svelte-oskcir{margin:0;margin-right:0.25em;display:inline;font-weight:bold;font-style:italic}")}function Js(t){let e,a;return{c(){e=C("div"),a=J(t[0]),A(e,"class","property-name svelte-oskcir")},m(n,i){S(n,e,i),x(e,a)},p(n,i){i&1&&me(a,n[0])},d(n){n&&M(e)}}}function pd(t){let e,a,n,i,s,o=t[0]&&Js(t);return i=new kt({props:{render:t[2],property:t[1]}}),{c(){e=C("div"),o&&o.c(),a=$(),n=C("div"),se(i.$$.fragment),A(n,"class","property-text svelte-oskcir"),A(e,"class","property")},m(r,c){S(r,e,c),o&&o.m(e,null),x(e,a),x(e,n),ne(i,n,null),s=!0},p(r,[c]){r[0]?o?o.p(r,c):(o=Js(r),o.c(),o.m(e,a)):o&&(o.d(1),o=null);let d={};c&4&&(d.render=r[2]),c&2&&(d.property=r[1]),i.$set(d)},i(r){s||(B(i.$$.fragment,r),s=!0)},o(r){F(i.$$.fragment,r),s=!1},d(r){r&&M(e),o&&o.d(),ae(i)}}}function fd(t,e,a){let{name:n}=e,{desc:i}=e,{render:s=!1}=e;return t.$$set=o=>{"name"in o&&a(0,n=o.name),"desc"in o&&a(1,i=o.desc),"render"in o&&a(2,s=o.render)},[n,i,s]}var si=class extends q{constructor(e){super(),U(this,e,fd,pd,j,{name:0,desc:1,render:2},gd)}},ba=si;var no=require("obsidian");function bd(t){Y(t,"svelte-nhjtjx",".spell-line.svelte-nhjtjx .spells.svelte-nhjtjx{font-style:italic}")}function Qs(t,e,a){let n=t.slice();return n[3]=e[a],n[5]=a,n}function eo(t,e,a){let n=t.slice();return n[6]=e[a],n[8]=a,n}function _d(t){let e,a;return e=new ba({props:{name:"",desc:t[3].header}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),a=!0},p:P,i(n){a||(B(e.$$.fragment,n),a=!0)},o(n){F(e.$$.fragment,n),a=!1},d(n){ae(e,n)}}}function kd(t){let e,a;return e=new ba({props:{name:"Spellcasting",desc:t[3].header}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),a=!0},p:P,i(n){a||(B(e.$$.fragment,n),a=!0)},o(n){F(e.$$.fragment,n),a=!1},d(n){ae(e,n)}}}function vd(t){let e,a,n=t[6].split(":").shift()+"",i,s,o,r,c=t[6].split(":").pop()+"",d;return{c(){e=C("li"),a=C("span"),i=J(n),s=J(":"),o=$(),r=C("span"),d=J(c),A(a,"class","spell-level"),A(r,"class","spells svelte-nhjtjx"),A(e,"class","spell-line svelte-nhjtjx")},m(l,m){S(l,e,m),x(e,a),
"Bookman Old Style", Bookman, "Goudy Old Style", Garamond,
"Hoefler Text", "Bitstream Charter", Georgia, serif;color:var(--statblock-primary-color);font-weight:700;margin:0px;font-size:23px;letter-spacing:1px;font-variant:small-caps;display:flex;justify-content:space-between;align-items:center}`)}function so(t,e,a){let n=t.slice();return n[2]=e[a],n}function oo(t){let e,a=t[0][t[2]]+"",n;return{c(){e=C("div"),n=J(a),A(e,"class","heading svelte-v0iiew")},m(i,s){S(i,e,s),x(e,n)},p(i,s){s&3&&a!==(a=i[0][i[2]]+"")&&me(n,a)},d(i){i&&M(e)}}}function ro(t){let e,a=t[2]in t[0]&&oo(t);return{c(){a&&a.c(),e=oe()},m(n,i){a&&a.m(n,i),S(n,e,i)},p(n,i){n[2]in n[0]?a?a.p(n,i):(a=oo(n),a.c(),a.m(e.parentNode,e)):a&&(a.d(1),a=null)},d(n){a&&a.d(n),n&&M(e)}}}function xd(t){let e,a=t[1].properties,n=[];for(let i=0;i<a.length;i+=1)n[i]=ro(so(t,a,i));return{c(){e=C("div");for(let i=0;i<n.length;i+=1)n[i].c();A(e,"class","flex-container svelte-v0iiew")},m(i,s){S(i,e,s);for(let o=0;o<n.length;o+=1)n[o].m(e,null)},p(i,[s]){if(s&3){a=i[1].properties;let o;for(o=0;o<a.length;o+=1){let r=so(i,a,o);n[o]?n[o].p(r,s):(n[o]=ro(r),n[o].c(),n[o].m(e,null))}for(;o<n.length;o+=1)n[o].d(1);n.length=a.length}},i:P,o:P,d(i){i&&M(e),tt(n,i)}}}function Ad(t,e,a){let{monster:n}=e,{item:i}=e;return t.$$set=s=>{"monster"in s&&a(0,n=s.monster),"item"in s&&a(1,i=s.item)},[n,i]}var ri=class extends q{constructor(e){super(),U(this,e,Ad,xd,j,{monster:0,item:1},Cd)}},co=ri;var uo=require("obsidian");function Dd(t){Y(t,"svelte-18djcuw",".line.svelte-18djcuw{line-height:1.4;display:block;color:var(--statblock-primary-color)}.property-name.svelte-18djcuw{margin:0;margin-right:0.25em;display:inline;font-weight:bold}")}function lo(t){let e,a,n,i,s;return i=new kt({props:{render:t[0].markdown,property:t[1]}}),{c(){e=C("div"),a=C("span"),a.textContent=`${t[2]}`,n=$(),se(i.$$.fragment),A(a,"class","property-name svelte-18djcuw"),A(e,"class","line svelte-18djcuw")},m(o,r){S(o,e,r),x(e,a),x(e,n),ne(i,e,null),s=!0},p(o,r){let c={};r&1&&(c.render=o[0].markdown),r&2&&(c.property=o[1]),i.$set(c)},i(o){s||(B(i.$$.fragment,o),s=!0)},o(o){F(i.$$.fragment,o),s=!1},d(o){o&&M(e),ae(i)}}}function Md(t){let e,a,n=(!t[0].conditioned||t[0].conditioned&&`${t[1]}`.length)&&lo(t);return{c(){n&&n.c(),e=oe()},m(i,s){n&&n.m(i,s),S(i,e,s),a=!0},p(i,[s]){!i[0].conditioned||i[0].conditioned&&`${i[1]}`.length?n?(n.p(i,s),s&3&&B(n,1)):(n=lo(i),n.c(),B(n,1),n.m(e.parentNode,e)):n&&(de(),F(n,1,1,()=>{n=null}),le())},i(i){a||(B(n),a=!0)},o(i){F(n),a=!1},d(i){n&&n.d(i),i&&M(e)}}}function Sd(t,e,a){let{monster:n}=e,{item:i}=e,s=_t(n[i.properties[0]]),o=i.display??i.properties[0];if(i.callback)try{let r=document.body.createEl("iframe"),c=r.contentWindow.Function;s=new c("monster",i.callback).call(void 0,n)??s,document.body.removeChild(r)}catch(r){new uo.Notice(`There was an error executing the provided callback for [${i.properties.join(", ")}]
${r.message}`),console.error(r)}return!i.conditioned&&!`${s}`.length&&(s=i.fallback??"-"),t.$$set=r=>{"monster"in r&&a(3,n=r.monster),"item"in r&&a(0,i=r.item)},[i,s,o,n]}var ci=class extends q{constructor(e){super(),U(this,e,Sd,Md,j,{monster:3,item:0},Dd)}},mo=ci;function Ed(t){Y(t,"svelte-sujd32",`.tapered-rule.svelte-sujd32{width:auto;margin:0.5em 0;height:5px;background:-webkit-linear-gradient(
0deg,
var(--statblock-rule-color) 0%,
var(--statblock-rule-color) 50%,
var(--statblock-background-color) 95%,
var(--statblock-background-color) 100%
);clip-path:polygon(0 0, 0 100%, 95% 50%);-webkit-clip-path:polygon(0 0, 0 100%, 95% 50%)}`)}function Id(t){let e;return{c(){e=C("div"),A(e,"class","tapered-rule svelte-sujd32")},m(a,n){S(a,e,n)},p:P,i:P,o:P,d(a){a&&M(e)}}}var di=class extends q{constructor(e){super(),U(this,e,null,Id,j,{},Ed)}},Ja=di;function Pd(t){Y(t,"svelte-1ey5nbe",".line.svelte-1ey5nbe{line-height:1.4;display:block;color:var(--statblock-primary-color)}.property-name.svelte-1ey5nbe{margin:0;margin-right:0.25em;display:inline;font-weight:bold}.property-text.svelte-1ey5nbe{display:inline;margin:0}")}function Wd(t){let e,a,n,i=(t[0].display??Fa(t[0].properties[0]))+"",s,o,r,c,d;return c=new kt({props:{render:t[0].markdown,property:t[1]}}),{c(){e=C("div"),a=C("div"),n=C("span"),s=J(i),o=$(),r=C("div"),se(c.$$.fragment),A(n,"class","property-name svelte-1ey5nbe"),A(r,"class","property-text svelte-1ey5nbe"),A(a,"class","line svelte-1ey5nbe"),A(e,"class","info")},m(l,m){S(l,e,m),x(e,a),x(a,n),x(n,s),x(a,o),x(a,r),ne(c,r,null),d=!0},p(l,[m]){(!d||m&1)&&i!==(i=(l[0].display??Fa(l[0].properties[0]))+"")&&me(s,i);let u={};m&1&&(u.render=l[0].markdown),c.$set(u)},i(l){d||(B(c.$$.fragment,l),d=!0)},o(l){F(c.$$.fragment,l),d=!1},d(l){l&&M(e),ae(c)}}}function Hd(t){return`${t>0?"+":""}${t}`}function Od(t,e,a){let{monster:n}=e,{item:i}=e,s=n[i.properties[0]];Array.isArray(s)||(s=[]);let o=s.map(c=>{if(typeof c!="object"||c==null)return null;let d=Object.keys(c)[0];if(!d)return null;let l=Object.values(c)[0];return!l||isNaN(Number(l))?null:`${Fa(d)} ${Hd(l)}`}).filter(c=>c).join(", "),r=be("dice");return t.$$set=c=>{"monster"in c&&a(2,n=c.monster),"item"in c&&a(0,i=c.item)},[i,o,n]}var li=class extends q{constructor(e){super(),U(this,e,Od,Wd,j,{monster:2,item:0},Pd)}},ho=li;function Rd(t){Y(t,"svelte-htlq9m",".section-header.svelte-htlq9m{border-bottom:1px solid var(--statblock-primary-color);color:var(--statblock-primary-color);font-size:21px;font-variant:small-caps;font-weight:normal;letter-spacing:1px;margin:0;margin-bottom:0.3em;break-inside:avoid-column;break-after:avoid-column}")}function Bd(t){let e,a;return{c(){e=C("h3"),a=J(t[0]),A(e,"class","section-header svelte-htlq9m")},m(n,i){S(n,e,i),x(e,a)},p(n,[i]){i&1&&me(a,n[0])},i:P,o:P,d(n){n&&M(e)}}}function zd(t,e,a){let{header:n}=e;return t.$$set=i=>{"header"in i&&a(0,n=i.header)},[n]}var ui=class extends q{constructor(e){super(),U(this,e,zd,Bd,j,{header:0},Rd)}},Qa=ui;function Nd(t){Y(t,"svelte-4yps8l",".subheading.svelte-4yps8l{font-weight:normal;font-style:italic;font-size:12px;margin:0}")}function Fd(t){let e;return{c(){e=C("div"),e.textContent=`${t[0].join(" ")}`,A(e,"class","subheading svelte-4yps8l")},m(a,n){S(a,e,n)},p:P,d(a){a&&M(e)}}}function Ld(t){let e,a=t[0].length&&Fd(t);return{c(){a&&a.c(),e=oe()},m(n,i){a&&a.m(n,i),S(n,e,i)},p(n,[i]){n[0].length&&a.p(n,i)},i:P,o:P,d(n){a&&a.d(n),n&&M(e)}}}function jd(t,e,a){let{monster:n}=e,{item:i}=e,s=[];for(let o of i.properties)o in n&&s.push(`${_t(n[o])}`);return t.$$set=o=>{"monster"in o&&a(1,n=o.monster),"item"in o&&a(2,i=o.item)},[s,n,i]}var mi=class extends q{constructor(e){super(),U(this,e,jd,Ld,j,{monster:1,item:2},Nd)}},go=mi;function $d(t){Y(t,"svelte-1gnzqxx",".statblock-table-header.svelte-1gnzqxx{font-weight:bold}.table.svelte-1gnzqxx{display:flex;justify-content:space-evenly;align-items:center;flex-wrap:wrap}.table-item.svelte-1gnzqxx{display:flex;justify-content:center;align-items:center;flex-flow:column nowrap}")}function po(t,e,a){let n=t.slice();return n[4]=e[a],n[6]=a,n}function fo(t){let e,a,n=_o(t[4])+"",i,s;return{c(){e=C("span"),a=J("("),i=J(n),s=J(")")},m(o,r){S(o,e,r),x(e,a),x(e,i),x(e,s)},p(o,r){r&2&&n!==(n=_o(o[4])+"")&&me(i,n)},d(o){o&&M(e)}}}function bo(t){let e,a,n=`${t[2][t[6]]}`.toUpperCase()+"",i,s,o,r=t[4]+"",c,d,l,m=t[0].calculate&&fo(t);return{c(){e=C("div"),a=C("span"),i=J(n),s=$(),o=C("span"),c=J(r),d=$(),m&&m.c(),l=$(),A(a,"class","statblock-table-header svelte-1gnzqxx"),A(e,"class","table-item svelte-1gnzqxx")},m(u,h){S(u,e,h),x(e,a),x(a,i),x(e,s),x(e,o),x(o,c),x(o,d),m&&m.m(o,null),x(e,l)},p(u,h){h&2&&r!==(r
sans-serif;font-size:14px;color:var(--statblock-primary-color);background-color:var(--statblock-background-color);padding:0.5em;border:1px #ddd solid;box-shadow:0 0 1.5em #ddd;margin-left:2px;margin-right:2px;display:flex;gap:1rem}.statblock-content.svelte-wrk0j1>.column{width:var(--statblock-column-width)}@media screen and (max-width: 400px){.statblock-content.svelte-wrk0j1>.column{width:75vw}}.statblock-item-container{margin-bottom:0.25rem}.statblock-detached{position:absolute;top:-9999px}.statblock-item-inline{display:flex;justify-content:space-between}`)}function al(t){let e,a;return{c(){e=C("div"),a=C("div"),A(a,"class","statblock-content svelte-wrk0j1"),A(e,"class","statblock-content-container"),Un(e,"--statblock-column-width",t[1])},m(n,i){S(n,e,i),x(e,a),t[6](a)},p(n,[i]){i&2&&Un(e,"--statblock-column-width",n[1])},i:P,o:P,d(n){n&&M(e),t[6](null)}}}function nl(t,e,a){let n,i=ze(),{statblock:s}=e,{columns:o=1}=e,{ready:r}=e,{maxColumns:c=o}=e,d=be("monster"),l=_=>_.conditioned==null||!_.conditioned||!_.properties.length?!0:_.properties.some(D=>!!(D in d&&(Array.isArray(d[D])&&d[D].length||typeof d[D]=="string"&&d[D].length||typeof d[D]=="number"))),m=Kn(),u=(_,D)=>{let I=[],T=D??createDiv("statblock-item-container");if(m.set("item",_),!l(_))return[];switch(I.push(T),_.type){case"group":{for(let k of _.nested??[]){let g=u(k,T);I.push(...g)}break}case"heading":{let k=new co({target:T,props:{monster:d,item:_},context:m});k.$on("save",g=>i("save",g.detail)),k.$on("export",g=>i("export",g.detail));break}case"inline":{let k=createDiv("statblock-item-inline");for(let g of _.nested??[])u(g,k.createDiv("statblock-inline-item"));I.push(k);break}case"image":{new Do({target:T,props:{monster:d,item:_},context:m});break}case"property":{new mo({target:T,props:{monster:d,item:_},context:m});break}case"saves":{new ho({target:T,props:{monster:d,item:_},context:m});break}case"spells":{let k=d[_.properties[0]];if(!Array.isArray(k)||!k.length)return;new io({target:T,props:{monster:d},context:m});break}case"subheading":{new go({target:T,props:{monster:d,item:_},context:m});break}case"table":{new ko({target:T,props:{monster:d,item:_},context:m});break}case"text":{new wo({target:T,props:{monster:d,item:_}});break}case"traits":{let k=d[_.properties[0]];if(!Array.isArray(k)||!k.length)return[];_.heading&&new Qa({target:T,props:{header:_.heading},context:m});try{for(let g of k){let p=createDiv("statblock-item-container");new ba({target:p,props:{name:g.name,desc:g.desc,render:_.markdown},context:m}),I.push(p)}}catch{return[]}break}}if(_.hasRule){let k=createDiv("statblock-item-container");new Ja({target:k}),I.push(k)}return I},h=_=>{_.empty();let D=[];for(let p of s)D.push(...u(p));let I=_.createDiv("column");if(o==1){D.forEach(p=>I.appendChild(p));return}let T=document.body.createDiv("statblock-detached"),k=new Map;for(let p of D)T.appendChild(p),k.set(p,p.clientHeight);T.style.width=b;let g;d.forceColumns?g=T.clientHeight/c:d.columns&&d.columns>0?g=Math.max(T.clientHeight/d.columns,T.clientHeight/o):g=Math.min(T.clientHeight/o,n),T.empty(),T.detach();for(let p of D)_.childElementCount<o&&I.clientHeight+k.get(p)>g&&(I=_.createDiv("column")),I.appendChild(p)},f,b="400px";d.columnWidth&&(typeof d.columnWidth=="number"&&(b=`${d.columnWidth}px`),typeof d.columnWidth=="string"&&(b=d.columnWidth));function y(_){Qe[_?"unshift":"push"](()=>{f=_,a(0,f)})}t.$$set=_=>{"statblock"in _&&a(2,s=_.statblock),"columns"in _&&a(3,o=_.columns),"ready"in _&&a(4,r=_.ready),"maxColumns"in _&&a(5,c=_.maxColumns)},t.$$.update=()=>{if(t.$$.dirty&17){e:r&&f&&h(f)}};e:n=!isNaN(Number(d.columnHeight))&&d.columnHeight>0?d.columnHeight:1/0;return[f,b,s,o,r,c,y]}var fi=class extends q{constructor(e){super(),U(this,e,nl,al,j,{statblock:2,columns:3,ready:4,maxColumns:5},tl)}},Mo=fi;function il(t){Y(t,"svelte-1r5gl1g",".container.svelte-1r5gl1g{display:flex;width:100%;margin:0.25rem 0}.statblock.svelte-1r5gl1g{margin:0 auto;position:relative}.icons.svelte-1r5gl1g{position:absolute;right:0}")}function So(t){let e,a,n,i,s,o,r,c=[ol,sl],d=[];function l(u,h){return
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kl(){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 mn(t,e){var a;if(typeof Symbol>"u"||t[Symbol.iterator]==null){if(Array.isArray(t)||(a=Si(t))||e&&t&&typeof t.length=="number"){a&&(t=a);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(c){throw c},f:i}}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,o=!1,r;return{s:function(){a=t[Symbol.iterator]()},n:function(){var c=a.next();return s=c.done,c},e:function(c){o=!0,r=c},f:function(){try{!s&&a.return!=null&&a.return()}finally{if(o)throw r}}}}var vl="finalize",yl="consider";function ea(t,e,a){t.dispatchEvent(new CustomEvent(vl,{detail:{items:e,info:a}}))}function Tt(t,e,a){t.dispatchEvent(new CustomEvent(yl,{detail:{items:e,info:a}}))}var hn="draggedEntered",Aa="draggedLeft",gn="draggedOverIndex",Ei="draggedLeftDocument",sn={LEFT_FOR_ANOTHER:"leftForAnother",OUTSIDE_OF_ANY:"outsideOfAny"};function wl(t,e,a){t.dispatchEvent(new CustomEvent(hn,{detail:{indexObj:e,draggedEl:a}}))}function Tl(t,e,a){t.dispatchEvent(new CustomEvent(Aa,{detail:{draggedEl:e,type:sn.LEFT_FOR_ANOTHER,theOtherDz:a}}))}function Cl(t,e){t.dispatchEvent(new CustomEvent(Aa,{detail:{draggedEl:e,type:sn.OUTSIDE_OF_ANY}}))}function xl(t,e,a){t.dispatchEvent(new CustomEvent(gn,{detail:{indexObj:e,draggedEl:a}}))}function Al(t){window.dispatchEvent(new CustomEvent(Ei,{detail:{draggedEl:t}}))}var We={DRAG_STARTED:"dragStarted",DRAGGED_ENTERED:hn,DRAGGED_ENTERED_ANOTHER:"dragEnteredAnother",DRAGGED_OVER_INDEX:gn,DRAGGED_LEFT:Aa,DRAGGED_LEFT_ALL:"draggedLeftAll",DROPPED_INTO_ZONE:"droppedIntoZone",DROPPED_INTO_ANOTHER:"droppedIntoAnother",DROPPED_OUTSIDE_OF_ANY:"droppedOutsideOfAny",DRAG_STOPPED:"dragStopped"},He={POINTER:"pointer",KEYBOARD:"keyboard"},pn="isDndShadowItem",Ii="data-is-dnd-shadow-item",Ct="id:dnd-shadow-placeholder-0000",Dl="dnd-action-dragged-el",De="id",Ti=0;function Zo(){Ti++}function Jo(){if(Ti===0)throw new Error("Bug! trying to decrement when there are no dropzones");Ti--}var Pi=typeof window>"u",X=function(){};function Qo(t){var e,a=t.getBoundingClientRect(),n=getComputedStyle(t),i=n.transform;if(i){var s,o,r,c;if(i.startsWith("matrix3d("))e=i.slice(9,-1).split(/, /),s=+e[0],o=+e[5],r=+e[12],c=+e[13];else if(i.startsWith("matrix("))e=i.slice(7,-1).split(/, /),s=+e[0],o=+e[3],r=+e[4],c=+e[5];else return a;var d=n.transformOrigin,l=a.x-r-(1-s)*parseFloat(d),m=a.y-c-(1-o)*parseFloat(d.slice(d.indexOf(" ")+1)),u=s?a.width/s:t.offsetWidth,h=o?a.height/o:t.offsetHeight;return{x:l,y:m,width:u,height:h,top:m,right:l+u,bottom:m+h,left:l}}else return a}function er(t){var e=Qo(t);return{top:e.top+window.scrollY,bottom:e.bottom+window.scrollY,left:e.left+window.scrollX,right:e.right+window.scrollX}}function Wi(t){var e=t.getBoundingClientRect();return{top:e.top+window.scrollY,bottom:e.bottom+window.scrollY,left:e.left+window.scrollX,right:e.right+window.scrollX}}function tr(t){return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function Ml(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Hi(t,e){return t.y<=e.bottom&&t.y>=e.top&&t.x>=e.left&&t.x<=e.right}function Ca(t){return tr(Wi(t))}function Fo(t,e){var a=Ca(t),n=er(e);return Hi(a,n)}function Sl(t,e){var a=Ca(t),n=Ca(e);return Ml(a,n)}function El(t){var e=Wi(t);return e.right<0||e.left>document.documentElement.scrollWidth||e.bottom<0||e.top>document.documentElement.scrollHeight}function Il(t,e){var a=Wi(e);return Hi(t,a)?{top:t.y-a.top,bottom:a.bottom-t.y,left:t.x-a.left,right:Math.min(a.right,document.documentElement.clientWidth)-t.x}:null}var Bt;function Oi(){X(function(){return"resetting indexes cache"}),Bt=new Map}Oi();function Pl(t){X(function(){return"resetting indexes cache for dz"}),Bt.delete(t)}function Wl(t){var e=Array.from(t.children).findIndex(function(a){return a.getAttribute(Ii)});if(e>=0)return Bt.has(t)||Bt.set(t,new Map),Bt.get(t).set(e,er(t.children[e])),e}function Hl(t,e){if(!Fo(t,e))return null;var a=e.children;if(a.length===0)return{index:0,isProximityBased:!0};for(var n=Wl(e),i=0;i<a.length;i++)if(Fo(t,a[i])){var s=Bt.has(e)&&Bt.get(e).get(i);return s&&!Hi(Ca(t),s)?{index:n,isProximityBased:!1}:{index:i,isProximityBased:!1}}for(var o=Number.MAX_VALUE,r=void 0,c=0;c<a.length;c++){var d=Sl(t,a[c]);d<o&&(o=d,r=c)}return{index:r,isProximityBased:!0}}var va=25;function ar(){var t;function e(){t={directionObj:voi
${D.message}`);return}n("save",i)})},l=_=>{new qe.ExtraButtonComponent(_).setIcon("cross").setTooltip("Cancel").onClick(()=>{n("cancel")})};function m(){return s?JSON.stringify(i,null,2):!i||!Object.keys(i??{})?.length?"":(0,qe.stringifyYaml)(i).trim()}function u(){try{s?a(8,i=JSON.parse(o.value)):a(8,i=(0,qe.parseYaml)(o.value))}catch(_){console.error(_)}}let h=()=>a(0,s=!1),f=()=>a(0,s=!0);function b(_){Qe[_?"unshift":"push"](()=>{o=_,a(1,o)})}let y=()=>u();return t.$$set=_=>{"monster"in _&&a(8,i=_.monster)},[s,o,r,c,d,l,m,u,i,h,f,b,y]}var qi=class extends q{constructor(e){super(),U(this,e,Fu,Nu,j,{monster:8},zu)}},Br=qi;var sa=class extends wn.Modal{constructor(a,n={}){super(a.app);this.plugin=a;this.monster=n}onOpen(){this._instance=new Br({target:this.contentEl,props:{monster:this.monster}}),this._instance.$on("cancel",()=>{this.close()}),this._instance.$on("save",async({detail:a})=>{if(!a.name){new wn.Notice("Creatures must be given a name.");return}await this.plugin.updateMonster(this.monster,a),this.close()})}onClose(){}close(){this._instance&&this._instance.$destroy(),super.close()}};var Tn=class extends Nt.Modal{constructor(a,n){super(a.app);this.plugin=a;this.monster=n}async display(){Nt.Platform.isMobile||(this.contentEl.style.maxWidth="85vw"),new vt(this.contentEl,this.monster,this.plugin,!1,null,this.plugin.defaultLayout)}onOpen(){this.display()}};var us=ma(_a());function Sa(t){let e=new Blob([t],{type:"text/javascript"}),a=URL.createObjectURL(e),n=new Worker(a);return URL.revokeObjectURL(a),n}function Ui(){return Sa('var dn=Object.create;var yt=Object.defineProperty;var Sn=Object.getOwnPropertyDescriptor;var vn=Object.getOwnPropertyNames;var Rn=Object.getPrototypeOf,yn=Object.prototype.hasOwnProperty;var Ae=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var En=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of vn(t))!yn.call(e,i)&&i!==n&&yt(e,i,{get:()=>t[i],enumerable:!(r=Sn(t,i))||r.enumerable});return e};var _n=(e,t,n)=>(n=e!=null?dn(Rn(e)):{},En(t||!e||!e.__esModule?yt(n,"default",{value:e,enumerable:!0}):n,e));var _t=Ae(Et=>{Et.entityMap={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:
${o.message}`),i.terminate(),this.workers.delete(s),n([])},i.postMessage({files:e,source:a})})}};var sc=require("obsidian");var In=require("obsidian");var pe="top",xe="bottom",Ce="right",_e="left",Cn="auto",At=[pe,xe,Ce,_e],pt="start",Ft="end",zr="clippingParents",xn="viewport",oa="popper",Nr="reference",Ki=At.reduce(function(t,e){return t.concat([e+"-"+pt,e+"-"+Ft])},[]),An=[].concat(At,[Cn]).reduce(function(t,e){return t.concat([e,e+"-"+pt,e+"-"+Ft])},[]),ju="beforeRead",$u="read",Gu="afterRead",qu="beforeMain",Uu="main",Vu="afterMain",Ku="beforeWrite",Yu="write",Xu="afterWrite",Fr=[ju,$u,Gu,qu,Uu,Vu,Ku,Yu,Xu];function Me(t){return t?(t.nodeName||"").toLowerCase():null}function ke(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function ut(t){var e=ke(t).Element;return t instanceof e||t instanceof Element}function Ae(t){var e=ke(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function ra(t){if(typeof ShadowRoot>"u")return!1;var e=ke(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function Zu(t){var e=t.state;Object.keys(e.elements).forEach(function(a){var n=e.styles[a]||{},i=e.attributes[a]||{},s=e.elements[a];!Ae(s)||!Me(s)||(Object.assign(s.style,n),Object.keys(i).forEach(function(o){var r=i[o];r===!1?s.removeAttribute(o):s.setAttribute(o,r===!0?"":r)}))})}function Ju(t){var e=t.state,a={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,a.popper),e.styles=a,e.elements.arrow&&Object.assign(e.elements.arrow.style,a.arrow),function(){Object.keys(e.elements).forEach(function(n){var i=e.elements[n],s=e.attributes[n]||{},o=Object.keys(e.styles.hasOwnProperty(n)?e.styles[n]:a[n]),r=o.reduce(function(c,d){return c[d]="",c},{});!Ae(i)||!Me(i)||(Object.assign(i.style,r),Object.keys(s).forEach(function(c){i.removeAttribute(c)}))})}}var Lr={name:"applyStyles",enabled:!0,phase:"write",fn:Zu,effect:Ju,requires:["computeStyles"]};function Se(t){return t.split("-")[0]}var st=Math.max,Lt=Math.min,ft=Math.round;function Xe(t,e){e===void 0&&(e=!1);var a=t.getBoundingClientRect(),n=1,i=1;if(Ae(t)&&e){var s=t.offsetHeight,o=t.offsetWidth;o>0&&(n=ft(a.width)/o||1),s>0&&(i=ft(a.height)/s||1)}return{width:a.width/n,height:a.height/i,top:a.top/i,right:a.right/n,bottom:a.bottom/i,left:a.left/n,x:a.left/n,y:a.top/i}}function jt(t){var e=Xe(t),a=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-a)<=1&&(a=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:a,height:n}}function Ia(t,e){var a=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(a&&ra(a)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Ne(t){return ke(t).getComputedStyle(t)}function Yi(t){return["table","td","th"].indexOf(Me(t))>=0}function Oe(t){return((ut(t)?t.ownerDocument:t.document)||window.document).documentElement}function bt(t){return Me(t)==="html"?t:t.assignedSlot||t.parentNode||(ra(t)?t.host:null)||Oe(t)}function jr(t){return!Ae(t)||Ne(t).position==="fixed"?null:t.offsetParent}function Qu(t){var e=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,a=navigator.userAgent.indexOf("Trident")!==-1;if(a&&Ae(t)){var n=Ne(t);if(n.position==="fixed")return null}var i=bt(t);for(ra(i)&&(i=i.host);Ae(i)&&["html","body"].indexOf(Me(i))<0;){var s=Ne(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function ot(t){for(var e=ke(t),a=jr(t);a&&Yi(a)&&Ne(a).position==="static";)a=jr(a);return a&&(Me(a)==="html"||Me(a)==="body"&&Ne(a).position==="static")?e:a||Qu(t)||e}function $t(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Gt(t,e,a){return st(t,Lt(e,a))}function $r(t,e,a){var n=Gt(t,e,a);return n>a?a:n}function Pa(){return{top:0,right:0,bottom:0,left:0}}function Wa(t){return Object.assign({},Pa(),t)}functio
${m}`),console.error(m)});await this.plugin.saveSettings(),this.buildCustomLayouts(r)}catch{}},i.addButton(c=>{c.setIcon("upload"),c.buttonEl.addClass("statblock-file-upload"),c.buttonEl.appendChild(s),c.onClick(()=>s.click())}),new V.Setting(n).setName("Add New Layout").addButton(c=>c.setIcon("plus-with-circle").setTooltip("Add New Statblock").onClick(()=>{let d=new Wn(this.plugin);d.onClose=async()=>{!d.saved||(this.plugin.settings.layouts.push(this.getDuplicate(d.layout)),await this.plugin.saveSettings(),this.buildCustomLayouts(r))},d.open()}));let o=n.createDiv("additional");new V.Setting(o).setName("Default Layout").setDesc("Change the default statblock layout used, if not specified.").addDropdown(async c=>{for(let d of ds)c.addOption(d.name,d.name);for(let d of this.plugin.settings.layouts)c.addOption(d.name,d.name);(!this.plugin.settings.default||!this.plugin.settings.layouts.find(({name:d})=>d==this.plugin.settings.default))&&(this.plugin.settings.default=Ve.name,await this.plugin.saveSettings()),c.setValue(this.plugin.settings.default??Ve.name),c.onChange(async d=>{this.plugin.settings.default=d,await this.plugin.saveSettings()})}),new V.Setting(o).setName("Show Advanced Options").setDesc("Show advanced options when editing layout blocks.").addToggle(c=>c.setValue(this.plugin.settings.showAdvanced).onChange(async d=>{this.plugin.settings.showAdvanced=d,await this.plugin.saveSettings()}));let r=n.createDiv("additional");this.buildCustomLayouts(r)}getDuplicate(a){if(!this.plugin.settings.layouts.find(r=>r.name==a.name)&&a.name!=Ve.name)return a;let n=[Ve.name,...this.plugin.settings.layouts.filter(r=>r.name.contains(`${a.name} Copy`)).map(r=>r.name)],i=`${a.name} Copy`,s=i,o=1;for(;n.includes(s);)s=`${i} (${o})`,o++;return{blocks:(0,us.default)(a.blocks),name:s}}buildCustomLayouts(a){a.empty();for(let n of ds)new V.Setting(a).setName(n.name).addExtraButton(i=>{i.setIcon("duplicate-glyph").setTooltip("Create Copy").onClick(async()=>{this.plugin.settings.layouts.push(this.getDuplicate(n)),await this.plugin.saveSettings(),this.buildCustomLayouts(a)})});for(let n of this.plugin.settings.layouts)new V.Setting(a).setName(n.name).addExtraButton(i=>{i.setIcon("pencil").setTooltip("Edit").onClick(()=>{let s=new Wn(this.plugin,n);s.onClose=async()=>{!s.saved||(this.plugin.settings.layouts.splice(this.plugin.settings.layouts.indexOf(n),1,s.layout),await this.plugin.saveSettings(),this.buildCustomLayouts(a))},s.open()})}).addExtraButton(i=>{i.setIcon("duplicate-glyph").setTooltip("Create Copy").onClick(async()=>{this.plugin.settings.layouts.push(this.getDuplicate(n)),await this.plugin.saveSettings(),this.buildCustomLayouts(a)})}).addExtraButton(i=>{i.setIcon("import-glyph").setTooltip("Export as JSON").onClick(()=>{let s=createEl("a"),o=new Blob([JSON.stringify(n)],{type:"json"}),r=URL.createObjectURL(o);s.href=r,s.download=`${n.name}.json`,s.click(),URL.revokeObjectURL(r)})}).addExtraButton(i=>{i.setIcon("trash").setTooltip("Delete").onClick(async()=>{this.plugin.settings.layouts=this.plugin.settings.layouts.filter(s=>s.name!==n.name),await this.plugin.saveSettings(),this.buildCustomLayouts(a)})})}generateImports(a){a.empty(),new V.Setting(a).setHeading().setName("Import Homebrew Creatures");let n=a.createDiv("statblock-additional-container");new V.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 i=n.createDiv("additional"),s=new V.Setting(i).setName("Import DnDAppFile").setDesc("Only import content that you own."),o=createEl("input",{attr:{type:"file",name:"dndappfile",accept:".xml",multiple:!0}});o.onchange=async()=>{let{files:b}=o;if(!!b.length)try{let{files:y}=o;if(!y.length)return;let _=await this.importer.import(y,"appfile");_&&_.length&&await this.plugin.saveMonsters(_),this.display()}catch{}},s.addButton(b=>{b.setButtonText("Choose File(s)").setTooltip("Import DnDAppFile Data"),b.buttonEl.addClass("statblock-file-upload"),b.buttonEl.appendChild(o),b.onClick((
${o.message}`),console.error(o)})}parseForDice(a){let n=s=>{let o,r;if(/\w+ [\+\-]\d+/.test(s.trim())){let[,c,d,l]=s.match(/(\w+ )([\+\-])(\d+)/)??[],m=1;d==="-"&&(m=-1),isNaN(Number(l))||(o=`1d20+${m*Number(l)}`,r=`${c} ${d}${l}`)}else if(/[\+\-]\d+ to hit/.test(s.trim())){let[,c,d]=s.match(/([\+\-])(\d+)/)??[],l=1;c==="-"&&(l=-1),isNaN(Number(d))||(o=`1d20+${l*Number(d)}`,r=s)}else if(/\d+\s\(\d+d\d+(?:\s*[+\-]\s*\d+)?\)/.test(s.trim())){let[,c,d]=s.match(/(\d+)\s\((\d+d\d+(?:\s*[+\-]\s*\d+)?)\)/)??[];!isNaN(Number(c))&&d&&(o=d)}return{text:o,original:r}},i=s=>/\w+ [\+\-]\d+/.test(s.trim())||/[\+\-]\d+ to hit/.test(s.trim())||/\d+\s\(\d+d\d+(?:\s*[+\-]\s*\d+)?\)/.test(s.trim());return a.split(/([\+\-]\d+ to hit|\d+\s\(\d+d\d+(?:\s*[+\-]\s*\d+)?\)|\w+ [\+\-]\d+)/).map(s=>i(s)?n(s):s)}get defaultLayout(){return this.settings.layouts?.find(a=>a.name==this.settings.default)??Ve}async postprocessor(a,n,i){try{let s=(0,Be.parseYaml)(a);s=JSON.parse(JSON.stringify(s).replace(/\\#/g,"#"));let o=s&&"name"in s;if((!s||!Object.values(s??{}).length)&&(s=Object.assign({},s,{note:i.sourcePath})),s.note){let m=Array.isArray(s.note)?s.note.flat(1/0).pop():s.note,u=await this.app.metadataCache.getFirstLinkpathDest(`${m}`,i.sourcePath);if(u&&u instanceof Be.TFile){let h=await this.app.metadataCache.getFileCache(u);Object.assign(s,(0,On.default)(h.frontmatter)??{})}}let r=Object.assign({},this.bestiary.get(s.monster)??this.bestiary.get(s.creature));if(r){let m=Kt(r.traits??[],s.traits??[]),u=Kt(r.actions??[],s.actions??[]),h=Kt(r.bonus_actions??[],s.bonus_actions??[]),f=Kt(r.legendary_actions??[],s.legendary_actions??[]),b=Kt(r.reactions??[],s.reactions??[]);Object.assign(s,{traits:m,actions:u,bonus_actions:h,reactions:b,legendary_actions:f})}"image"in s&&Array.isArray(s.image)&&(s.image=s.image.flat(2).join(""));let c=Object.assign({},r??{},s??{}),d=this.settings.layouts.find(m=>m.name==c?.layout||m.name==c?.statblock)??this.defaultLayout;n.addClass("statblock-plugin-container"),n.parentElement?.addClass("statblock-plugin-parent");let l=new vt(n,c,this,o,i.sourcePath,d);i.addChild(l)}catch(s){console.error(`Obsidian Statblock Error:
${s}`),createEl("pre").setText(`\`\`\`statblock
There was an error rendering the statblock:
${s.stack.split(`
`).filter(r=>!/^at/.test(r?.trim())).join(`
`)}
\`\`\``)}}render(a,n,i){let s=Object.assign(this.bestiary.get(a.name)??{},{...a});return s?(i&&(s.name=i),new vt(n,s,this,!1,"",this.defaultLayout)):null}};