Create a new weekday to see it here.",K(t,"class","existing-items")},m(e,n){V(e,t,n)},p:g,d(e){e&&P(t)}}}function aa(e,t){let n,a,r,i,o,s,l,c,d,u,h,f,p,m=g;return{key:e,first:null,c(){n=H("div"),a=H("div"),i=z(),o=H("div"),l=z(),c=H("div"),u=z(),K(a,"class","icon svelte-1xaj2n2"),K(c,"class","icon svelte-1xaj2n2"),K(n,"class","weekday svelte-1xaj2n2"),this.first=n},m(e,h){V(e,n,h),L(n,a),L(n,i),L(n,o),L(n,l),L(n,c),L(n,u),f||(p=[M(r=t[5].call(null,a)),Z(a,"mousedown",t[9]),Z(a,"touchstart",t[9]),M(s=t[7].call(null,o,t[17])),M(d=t[6].call(null,c,t[17]))],f=!0)},p(e,n){t=e,s&&x(s.update)&&4&n&&s.update.call(null,t[17]),d&&x(d.update)&&4&n&&d.update.call(null,t[17])},r(){h=n.getBoundingClientRect()},f(){le(n),m()},a(){m(),m=se(n,h,We,{duration:ca})},d(e){e&&P(n),f=!1,w(p)}}}function ra(e){let t;function n(e,t){return e[2].length?ta:na}let a=n(e),r=a(e);return{c(){r.c(),t=Y()},m(e,n){r.m(e,n),V(e,t,n)},p(e,i){a===(a=n(e))&&r?r.p(e,i):(r.d(1),r=a(e),r&&(r.c(),r.m(t.parentNode,t)))},d(e){r.d(e),e&&P(t)}}}function ia(e){let t,n,a,r,i,o,s,l,c,d=e[2],u=[];for(let t=0;tFirst Day \n This only effects which day of the week the first\n year starts on.
',r=z(),i=H("div"),o=H("select");for(let e=0;ee[12].call(o))),K(i,"class","setting-item-control"),K(n,"class","setting-item"),K(t,"class","first-weekday")},m(s,d){V(s,t,d),L(t,n),L(n,a),L(n,r),L(n,i),L(i,o);for(let e=0;e{"firstWeekday"in e&&a(0,r=e.firstWeekday),"overflow"in e&&a(1,i=e.overflow),"weekdays"in e&&a(2,l=e.weekdays)},e.$$.update=()=>{4&e.$$.dirty&&s("weekday-update",l),1&e.$$.dirty&&s("first-weekday-update",r),2&e.$$.dirty&&s("overflow-update",i)},[r,i,l,o,()=>{a(2,l=[...l,{type:"day",name:null,id:c()}])},e=>{(0,t.setIcon)(e,"fantasy-calendar-grip")},(e,n)=>{new t.ExtraButtonComponent(e).setIcon("trash").onClick((()=>a(2,l=l.filter((e=>e.id!==n.id)))))},(e,n)=>{new t.TextComponent(e).setValue(n.name).setPlaceholder("Name").onChange((e=>{n.name=e,s("weekday-update",l),a(2,l)})).inputEl.setAttr("style","width: 100%;")},e=>{new t.Setting(e).setName("Overflow Weeks").setDesc("Turn this off to make each month start on the first of the week.").addToggle((e=>{e.setValue(i).onChange((e=>{a(1,i=e)}))}))},function(e){e.preventDefault(),a(3,o=!1)},function(e){const{items:t,info:{source:n,trigger:r}}=e.detail;a(2,l=t),n===lt&&r===ot&&a(3,o=!0)},function(e){const{items:t,info:{source:n}}=e.detail;a(2,l=t),n===st&&a(3,o=!0)},function(){r=ne(this),a(0,r)}]}const ua=class extends Ge{constructor(e){super(),Pe(this,e,da,la,D,{firstWeekday:0,overflow:1,weekdays:2},Jn)}};function ha(e){R(e,"svelte-1nt6wkb",".month.svelte-1nt6wkb.svelte-1nt6wkb{display:grid;grid-template-columns:1fr 1fr auto auto;align-items:center;justify-content:space-between;gap:1rem}.month.svelte-1nt6wkb .icon.svelte-1nt6wkb{align-items:center}")}function fa(e){let t,n,a,r,i,o,s,l,c,d,u,h,f;return{c(){t=H("div"),n=H("input"),a=z(),r=H("input"),i=z(),o=H("select"),s=H("option"),s.textContent="Month",l=H("option"),l.textContent="Intercalary",c=z(),d=H("div"),K(n,"type","text"),K(n,"spellcheck","false"),K(n,"placeholder","Name"),ee(n,"width","100%"),K(r,"type","number"),K(r,"spellcheck","false"),K(r,"placeholder","Length"),ee(r,"width","100%"),K(r,"min","0"),s.__value="month",s.value=s.__value,l.__value="intercalary",l.value=l.__value,K(o,"class","dropdown"),void 0===e[0]&&Ee((()=>e[8].call(o))),K(d,"class","icon svelte-1nt6wkb"),K(t,"class","month svelte-1nt6wkb")},m(p,m){V(p,t,m),L(t,n),X(n,e[1]),L(t,a),L(t,r),X(r,e[2]),L(t,i),L(t,o),L(o,s),L(o,l),te(o,e[0]),L(t,c),L(t,d),h||(f=[Z(n,"input",e[6]),Z(n,"input",e[4]),Z(r,"input",e[7]),Z(r,"input",e[4]),Z(o,"change",e[8]),Z(o,"input",e[4]),M(u=e[3].call(null,d))],h=!0)},p(e,[t]){2&t&&n.value!==e[1]&&X(n,e[1]),4&t&&Q(r.value)!==e[2]&&X(r,e[2]),1&t&&te(o,e[0])},i:g,o:g,d(e){e&&P(t),h=!1,w(f)}}}function pa(e,n,a){const r=he();let{month:i}=n,o=i.name,s=i.type,l=i.length;const c=(0,t.debounce)((()=>{a(5,i.name=o,i),a(5,i.type=s,i),a(5,i.length=l,i),r("month-update")}),300,!0);return e.$$set=e=>{"month"in e&&a(5,i=e.month)},e.$$.update=()=>{1&e.$$.dirty&&a(5,i.type=s,i)},[s,o,l,e=>{new t.ExtraButtonComponent(e).setIcon("trash").onClick((()=>{r("month-delete")}))},c,i,function(){o=this.value,a(1,o)},function(){l=Q(this.value),a(2,l)},function(){s=ne(this),a(0,s)}]}const ma=class extends Ge{constructor(e){super(),Pe(this,e,pa,fa,D,{month:5},ha)}};function ga(e){R(e,"svelte-xv4vbj",".month.svelte-xv4vbj{display:flex;align-items:center;margin-top:0.5rem;gap:1rem}")}function ya(e,t,n){const a=e.slice();return a[12]=t[n],a}function va(e){let t,n,a,r,i,o=[],s=new Map,l=e[0];const c=e=>e[12].id;for(let t=0;tCreate a new month to see it here.",K(t,"class","existing-items")},m(e,n){V(e,t,n)},p:g,i:g,o:g,d(e){e&&P(t)}}}function wa(e,t){let n,a,r,i,o,s,l,c,d,u,h=g;return o=new ma({props:{month:t[12]}}),o.$on("mousedown",t[5]),o.$on("month-delete",(function(){return t[9](t[12])})),o.$on("month-update",t[10]),{key:e,first:null,c(){n=H("div"),a=H("div"),i=z(),je(o.$$.fragment),s=z(),K(a,"class","icon"),K(n,"class","month svelte-xv4vbj"),this.first=n},m(e,l){V(e,n,l),L(n,a),L(n,i),_e(o,n,null),L(n,s),c=!0,d||(u=[M(r=t[4].call(null,a)),Z(a,"mousedown",t[5]),Z(a,"touchstart",t[5])],d=!0)},p(e,n){t=e;const a={};1&n&&(a.month=t[12]),o.$set(a)},r(){l=n.getBoundingClientRect()},f(){le(n),h()},a(){h(),h=se(n,l,We,{duration:ka})},i(e){c||(Ne(o.$$.fragment,e),c=!0)},o(e){Oe(o.$$.fragment,e),c=!1},d(e){e&&P(n),Ve(o),d=!1,w(u)}}}function xa(e){let t,n,a,r;const i=[ba,va],o=[];function s(e,t){return e[0].length?1:0}return t=s(e),n=o[t]=i[t](e),{c(){n.c(),a=Y()},m(e,n){o[t].m(e,n),V(e,a,n),r=!0},p(e,r){let l=t;t=s(e),t===l?o[t].p(e,r):(Ie(),Oe(o[l],1,1,(()=>{o[l]=null})),Fe(),n=o[t],n?n.p(e,r):(n=o[t]=i[t](e),n.c()),Ne(n,1),n.m(a.parentNode,a))},i(e){r||(Ne(n),r=!0)},o(e){Oe(n),r=!1},d(e){o[t].d(e),e&&P(a)}}}function Da(e){let t,n;return t=new Qn({props:{label:"Months",$$slots:{default:[xa]},$$scope:{ctx:e}}}),t.$on("new-item",e[2]),{c(){je(t.$$.fragment)},m(e,a){_e(t,e,a),n=!0},p(e,[n]){const a={};32771&n&&(a.$$scope={dirty:n,ctx:e}),t.$set(a)},i(e){n||(Ne(t.$$.fragment,e),n=!0)},o(e){Oe(t.$$.fragment,e),n=!1},d(e){Ve(t,e)}}}const ka=300;function Ea(e,n,a){const r=e=>{a(0,s=s.filter((t=>t.id!=e.id))),o("month-update",s)};let i=!1;const o=he();let{months:s=[]}=n;return e.$$set=e=>{"months"in e&&a(0,s=e.months)},[s,i,()=>{a(0,s=[...s,{type:"month",name:null,length:null,id:c()}]),o("month-update",s)},r,e=>{(0,t.setIcon)(e,"fantasy-calendar-grip")},function(e){e.preventDefault(),a(1,i=!1)},function(e){const{items:t,info:{source:n,trigger:r}}=e.detail;a(0,s=t),n===lt&&r===ot&&a(1,i=!0)},function(e){const{items:t,info:{source:n}}=e.detail;a(0,s=t),o("month-update",s),n===st&&a(1,i=!0)},o,e=>r(e),()=>o("month-update",s)]}const Ca=class extends Ge{constructor(e){super(),Pe(this,e,Ea,Da,D,{months:0},ga)}};function Aa(e){R(e,"svelte-1ldxqlp",".dot.svelte-1ldxqlp{display:inline-block;height:0.875em;width:0.875em;margin:0 1px}")}function Ta(e){let t,n;return{c(){t=W("svg"),n=W("circle"),K(n,"stroke",e[0]),K(n,"fill",e[0]),K(n,"cx","3"),K(n,"cy","3"),K(n,"r","2"),K(t,"class","dot svelte-1ldxqlp"),K(t,"viewBox","0 0 6 6"),K(t,"xmlns","http://www.w3.org/2000/svg"),K(t,"aria-label",e[1])},m(e,a){V(e,t,a),L(t,n)},p(e,[a]){1&a&&K(n,"stroke",e[0]),1&a&&K(n,"fill",e[0]),2&a&&K(t,"aria-label",e[1])},i:g,o:g,d(e){e&&P(t)}}}function Sa(e,t,n){let{color:a}=t,{label:r}=t;return e.$$set=e=>{"color"in e&&n(0,a=e.color),"label"in e&&n(1,r=e.label)},[a,r]}const $a=class extends Ge{constructor(e){super(),Pe(this,e,Sa,Ta,D,{color:0,label:1},Aa)}};function Ma(e){R(e,"svelte-3snb0d",".event.svelte-3snb0d.svelte-3snb0d{display:grid;grid-template-columns:1fr auto;align-items:center;justify-content:space-between;gap:1rem;margin-top:0.5rem}.event-info.svelte-3snb0d.svelte-3snb0d{width:100%}.icons.svelte-3snb0d.svelte-3snb0d{display:flex;align-self:flex-start;justify-self:flex-end;align-items:center}.event.svelte-3snb0d .icon.svelte-3snb0d{align-items:center}.date.svelte-3snb0d.svelte-3snb0d{display:flex;justify-content:flex-start;gap:0.25rem}.clamp.svelte-3snb0d.svelte-3snb0d{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;word-break:keep-all;overflow:hidden;width:calc(var(--event-max-width) * 0.75)}")}function qa(e){let t,n;return t=new $a({props:{color:e[1].color,label:e[1].name}}),{c(){je(t.$$.fragment)},m(e,a){_e(t,e,a),n=!0},p(e,n){const a={};2&n&&(a.color=e[1].color),2&n&&(a.label=e[1].name),t.$set(a)},i(e){n||(Ne(t.$$.fragment,e),n=!0)},o(e){Oe(t.$$.fragment,e),n=!1},d(e){Ve(t,e)}}}function Ia(e){let t,n,a,r,i,o,s,l,c,d,u,h,f,p,m,g,y,v,b,x,D,k,E=e[0].name+"",C=(e[0].description??"")+"",A=null!=e[1]&&qa(e);return{c(){t=H("div"),n=H("div"),a=H("span"),A&&A.c(),r=z(),i=U(E),o=z(),s=H("div"),l=H("div"),c=U(e[2]),d=z(),u=H("span"),h=U(C),f=z(),p=H("div"),m=H("div"),y=z(),v=H("div"),K(a,"class","setting-item-name"),K(l,"class","date svelte-3snb0d"),K(u,"class","clamp svelte-3snb0d"),K(s,"class","setting-item-description"),K(n,"class","event-info svelte-3snb0d"),K(m,"class","icon svelte-3snb0d"),K(v,"class","icon svelte-3snb0d"),K(p,"class","icons svelte-3snb0d"),K(t,"class","event svelte-3snb0d")},m(w,E){V(w,t,E),L(t,n),L(n,a),A&&A.m(a,null),L(a,r),L(a,i),L(n,o),L(n,s),L(s,l),L(l,c),L(s,d),L(s,u),L(u,h),L(t,f),L(t,p),L(p,m),L(p,y),L(p,v),x=!0,D||(k=[M(g=e[5].call(null,m)),Z(m,"click",e[6]),M(b=e[4].call(null,v)),Z(v,"click",e[7])],D=!0)},p(e,[t]){null!=e[1]?A?(A.p(e,t),2&t&&Ne(A,1)):(A=qa(e),A.c(),Ne(A,1),A.m(a,r)):A&&(Ie(),Oe(A,1,1,(()=>{A=null})),Fe()),(!x||1&t)&&E!==(E=e[0].name+"")&&J(i,E),(!x||4&t)&&J(c,e[2]),(!x||1&t)&&C!==(C=(e[0].description??"")+"")&&J(h,C)},i(e){x||(Ne(A),x=!0)},o(e){Oe(A),x=!1},d(e){e&&P(t),A&&A.d(),D=!1,w(k)}}}function Fa(e,n,a){const r=he();let{event:i}=n,{category:o}=n,{date:s}=n;return e.$$set=e=>{"event"in e&&a(0,i=e.event),"category"in e&&a(1,o=e.category),"date"in e&&a(2,s=e.date)},[i,o,s,r,e=>{new t.ExtraButtonComponent(e).setIcon("trash").setTooltip("Delete").extraSettingsEl.setAttr("style","margin-left: 0;")},e=>{new t.ExtraButtonComponent(e).setIcon("pencil").setTooltip("Edit")},()=>r("edit"),()=>r("delete")]}const Na=class extends Ge{constructor(e){super(),Pe(this,e,Fa,Ia,D,{event:0,category:1,date:2},Ma)}};function Oa(e,t,n){const a=e.slice();return a[10]=t[n],a}function Ba(e){let t,n,a=e[0],r=[];for(let t=0;tOe(r[e],1,1,(()=>{r[e]=null}));return{c(){t=H("div");for(let e=0;eCreate a new event to see it here.",K(t,"class","existing-items")},m(e,n){V(e,t,n)},p:g,i:g,o:g,d(e){e&&P(t)}}}function Ra(e){let t,n;return t=new Na({props:{event:e[10],category:e[4](e[10].category),date:h(e[10].date,e[1],e[10].end)}}),t.$on("edit",(function(){return e[6](e[10])})),t.$on("delete",(function(){return e[7](e[10])})),{c(){je(t.$$.fragment)},m(e,a){_e(t,e,a),n=!0},p(n,a){e=n;const r={};1&a&&(r.event=e[10]),1&a&&(r.category=e[4](e[10].category)),3&a&&(r.date=h(e[10].date,e[1],e[10].end)),t.$set(r)},i(e){n||(Ne(t.$$.fragment,e),n=!0)},o(e){Oe(t.$$.fragment,e),n=!1},d(e){Ve(t,e)}}}function ja(e){let t,n,a,r;const i=[La,Ba],o=[];function s(e,t){return e[0].length?1:0}return t=s(e),n=o[t]=i[t](e),{c(){n.c(),a=Y()},m(e,n){o[t].m(e,n),V(e,a,n),r=!0},p(e,r){let l=t;t=s(e),t===l?o[t].p(e,r):(Ie(),Oe(o[l],1,1,(()=>{o[l]=null})),Fe(),n=o[t],n?n.p(e,r):(n=o[t]=i[t](e),n.c()),Ne(n,1),n.m(a.parentNode,a))},i(e){r||(Ne(n),r=!0)},o(e){Oe(n),r=!1},d(e){o[t].d(e),e&&P(a)}}}function _a(e){let t,n;return t=new Qn({props:{label:"Event",$$slots:{default:[ja]},$$scope:{ctx:e}}}),t.$on("new-item",e[8]),{c(){je(t.$$.fragment)},m(e,a){_e(t,e,a),n=!0},p(e,[n]){const a={};8195&n&&(a.$$scope={dirty:n,ctx:e}),t.$set(a)},i(e){n||(Ne(t.$$.fragment,e),n=!0)},o(e){Oe(t.$$.fragment,e),n=!1},d(e){Ve(t,e)}}}function Va(e,t,n){let{categories:a=[]}=t,{events:r=[]}=t,{months:i=[]}=t;const o=he(),s=e=>{o("new-item",e)},l=e=>{n(0,r=r.filter((t=>t.id!==e.id))),o("edit-events",r)};return e.$$set=e=>{"categories"in e&&n(5,a=e.categories),"events"in e&&n(0,r=e.events),"months"in e&&n(1,i=e.months)},e.$$.update=()=>{1&e.$$.dirty&&r.sort(((e,t)=>e.date.year!=t.date.year?e.date.year-t.date.year:e.date.month!=t.date.month?e.date.month-t.date.month:e.date.day-t.date.day))},[r,i,s,l,e=>a.find((({id:t})=>t==e)),a,e=>s(e),e=>l(e),function(t){me.call(this,e,t)}]}const Pa=class extends Ge{constructor(e){super(),Pe(this,e,Va,_a,D,{categories:5,events:0,months:1})}},Ga="#808080",Ha=["M6.5,16a9.5,9.5 0 1,0 19,0a9.5,9.5 0 1,0 -19,0","M19.79,6C22.25,7.2,25,9.92,25,16s-2.75,8.8-5.21,10a10.59,10.59,0,0,1-3.79.71A10.72,10.72,0,0,1,16,5.28,10.59,10.59,0,0,1,19.79,6Z","M19.43,5.86C21.79,7,24.5,9.7,24.5,16s-2.71,9-5.07,10.14a10.55,10.55,0,0,1-3.43.58A10.72,10.72,0,0,1,16,5.28,10.55,10.55,0,0,1,19.43,5.86Z","M17.87,5.46C20.23,6.34,24,8.88,24,16.17c0,6.85-3.33,9.36-5.69,10.29a11,11,0,0,1-2.31.26A10.72,10.72,0,0,1,16,5.28,10.49,10.49,0,0,1,17.87,5.46Z","M17.79,5.45C20,6.3,23.5,8.77,23.5,15.88c0,7.37-3.75,9.87-5.95,10.71a9.92,9.92,0,0,1-1.55.13A10.72,10.72,0,0,1,16,5.28,10.54,10.54,0,0,1,17.79,5.45Z","M17.35,5.38c1.9.79,5.15,3.25,5.15,10.72,0,7.25-3.06,9.68-5,10.5a10.87,10.87,0,0,1-1.52.12A10.72,10.72,0,0,1,16,5.28,10.1,10.1,0,0,1,17.35,5.38Z","M17.05,5.34c1.6.75,4.45,3.17,4.45,10.79,0,7.39-2.68,9.76-4.3,10.52a11.9,11.9,0,0,1-1.2.07A10.72,10.72,0,0,1,16,5.28,9,9,0,0,1,17.05,5.34Z","M16.85,5.33c1.3.74,3.65,3.12,3.65,10.67s-2.35,9.93-3.65,10.67c-.28,0-.56,0-.85,0A10.72,10.72,0,0,1,16,5.28,7.92,7.92,0,0,1,16.85,5.33Z","M16.46,5.31c.95.78,3,3.34,3,10.69s-2.09,9.91-3,10.69l-.46,0A10.72,10.72,0,0,1,16,5.28Z","M16.29,5.3c.65.8,2.21,3.48,2.21,10.78S17,25.91,16.3,26.7l-.3,0A10.72,10.72,0,0,1,16,5.28Z","M16.13,5.29c.37.89,1.37,3.92,1.37,10.79s-1,9.76-1.36,10.63H16A10.72,10.72,0,0,1,16,5.28Z","M16,5.29A85.5,85.5,0,0,1,16.5,16,85.5,85.5,0,0,1,16,26.71h0A10.72,10.72,0,0,1,16,5.28Z","M16,26.72A10.72,10.72,0,0,1,16,5.28Z","M15.5,16A85.59,85.59,0,0,0,16,26.72,10.72,10.72,0,0,1,16,5.28,85.59,85.59,0,0,0,15.5,16Z","M14.5,16.08c0,6.84,1,9.77,1.36,10.63a10.71,10.71,0,0,1,0-21.42C15.5,6.17,14.5,9.2,14.5,16.08Z","M15.7,26.7a10.7,10.7,0,0,1,0-21.4c-.65.8-2.21,3.47-2.21,10.78S15,25.92,15.7,26.7Z","M15.55,26.7a10.71,10.71,0,0,1,0-21.4c-1,.78-3.05,3.34-3.05,10.7S14.6,25.92,15.55,26.7Z","M15.16,26.68a10.71,10.71,0,0,1,0-21.36C13.85,6.06,11.5,8.43,11.5,16S13.85,25.94,15.16,26.68Z","M14.81,26.65A10.72,10.72,0,0,1,15,5.33c-1.59.76-4.45,3.17-4.45,10.8C10.5,23.53,13.19,25.9,14.81,26.65Z","M14.49,26.6a10.71,10.71,0,0,1,.17-21.23c-1.9.8-5.16,3.24-5.16,10.73C9.5,23.37,12.57,25.79,14.49,26.6Z","M14.46,26.6a10.71,10.71,0,0,1-.24-21.16C12,6.29,8.5,8.76,8.5,15.88,8.5,23.26,12.27,25.76,14.46,26.6Z","M13.72,26.47a10.71,10.71,0,0,1,.43-21C11.78,6.33,8,8.87,8,16.17,8,23,11.35,25.55,13.72,26.47Z","M12.6,26.19a10.73,10.73,0,0,1,0-20.35C10.23,7,7.5,9.67,7.5,16s2.73,9,5.1,10.16Z","M12.23,26a10.7,10.7,0,0,1,0-20C9.77,7.19,7,9.9,7,16S9.77,24.81,12.23,26Z",null,"M19.77,26C22.23,24.81,25,22.1,25,16S22.23,7.19,19.77,6a10.7,10.7,0,0,1,0,20Z","M19.4,26.16C21.77,25,24.5,22.33,24.5,16S21.77,7,19.4,5.84a10.71,10.71,0,0,1,0,20.32Z","M18.28,26.47C20.65,25.55,24,23,24,16.17c0-7.3-3.78-9.84-6.15-10.72a10.71,10.71,0,0,1,.43,21Z","M17.54,26.6c2.19-.84,6-3.34,6-10.72,0-7.12-3.5-9.59-5.72-10.44a10.71,10.71,0,0,1-.24,21.16Z","M17.51,26.6c1.92-.81,5-3.23,5-10.5,0-7.49-3.26-9.93-5.16-10.73a10.71,10.71,0,0,1,.17,21.23Z","M17.19,26.65c1.62-.75,4.31-3.12,4.31-10.52,0-7.63-2.86-10-4.45-10.8a10.72,10.72,0,0,1,.14,21.32Z","M16.84,26.68c1.31-.74,3.66-3.11,3.66-10.68S18.15,6.06,16.84,5.32a10.71,10.71,0,0,1,0,21.36Z","M16.45,26.7c.95-.78,3.05-3.34,3.05-10.7S17.4,6.08,16.45,5.3a10.71,10.71,0,0,1,0,21.4Z","M16.3,26.7c.67-.78,2.2-3.37,2.2-10.62S16.94,6.1,16.29,5.3a10.7,10.7,0,0,1,0,21.4Z","M16.14,26.71c.37-.86,1.36-3.79,1.36-10.63s-1-9.91-1.37-10.79a10.71,10.71,0,0,1,0,21.42Z","M16,26.72A85.59,85.59,0,0,0,16.5,16,85.59,85.59,0,0,0,16,5.28a10.72,10.72,0,0,1,0,21.44Z","M16,26.72V5.28a10.72,10.72,0,0,1,0,21.44Z","M16,26.72h0A85.59,85.59,0,0,1,15.5,16,85.59,85.59,0,0,1,16,5.28h0a10.72,10.72,0,0,1,0,21.44Z","M16,26.72h-.14c-.37-.86-1.36-3.79-1.36-10.63s1-9.91,1.37-10.79H16a10.72,10.72,0,0,1,0,21.44Z","M16,26.72l-.3,0c-.67-.78-2.2-3.37-2.2-10.62s1.56-10,2.21-10.78l.29,0a10.72,10.72,0,0,1,0,21.44Z","M16,26.72l-.45,0c-1-.78-3.05-3.34-3.05-10.7s2.1-9.92,3.05-10.7l.45,0a10.72,10.72,0,0,1,0,21.44Z","M16,26.72c-.28,0-.56,0-.84,0C13.85,25.94,11.5,23.57,11.5,16s2.35-9.94,3.66-10.68c.28,0,.56,0,.84,0a10.72,10.72,0,0,1,0,21.44Z","M16,26.72a11.7,11.7,0,0,1-1.19-.07c-1.62-.75-4.31-3.12-4.31-10.52,0-7.63,2.86-10,4.45-10.8.35,0,.7,0,1.05,0a10.72,10.72,0,0,1,0,21.44Z","M16,26.72a10.85,10.85,0,0,1-1.51-.12c-1.92-.81-5-3.23-5-10.5,0-7.49,3.26-9.93,5.16-10.73A11.9,11.9,0,0,1,16,5.28a10.72,10.72,0,0,1,0,21.44Z","M16,26.72a11.16,11.16,0,0,1-1.54-.12c-2.19-.84-6-3.34-6-10.72,0-7.12,3.5-9.59,5.72-10.44A10.43,10.43,0,0,1,16,5.28a10.72,10.72,0,0,1,0,21.44Z","M16,26.72a10.69,10.69,0,0,1-2.28-.25C11.35,25.55,8,23,8,16.17c0-7.3,3.78-9.84,6.15-10.72A11.26,11.26,0,0,1,16,5.28a10.72,10.72,0,0,1,0,21.44Z","M16,26.72a10.63,10.63,0,0,1-3.4-.56C10.23,25,7.5,22.33,7.5,16s2.73-9,5.1-10.16A10.72,10.72,0,1,1,16,26.72Z","M16,26.72a10.52,10.52,0,0,1-3.77-.7C9.77,24.81,7,22.1,7,16S9.77,7.19,12.23,6A10.52,10.52,0,0,1,16,5.28a10.72,10.72,0,0,1,0,21.44Z"],Wa={"New Moon":Ha[0],"New Moon Fading":Ha[1],"New Moon Faded":Ha[2],"Waxing Crescent Rising":Ha[3],"Waxing Crescent Risen":Ha[4],"Waxing Crescent":Ha[6],"Waxing Crescent Fading":Ha[7],"Waxing Crescent Faded":Ha[8],"First Quarter Rising":Ha[9],"First Quarter Risen":Ha[10],"First Quarter":Ha[12],"First Quarter Fading":Ha[13],"First Quarter Faded":Ha[14],"Waxing Gibbous Rising":Ha[15],"Waxing Gibbous Risen":Ha[16],"Waxing Gibbous":Ha[18],"Waxing Gibbous Fading":Ha[19],"Waxing Gibbous Faded":Ha[20],"Full Moon Rising":Ha[21],"Full Moon Risen":Ha[22],"Full Moon":Ha[24],"Full Moon Fading":Ha[25],"Full Moon Faded":Ha[26],"Waning Gibbous Rising":Ha[27],"Waning Gibbous Risen":Ha[28],"Waning Gibbous":Ha[30],"Waning Gibbous Fading":Ha[31],"Waning Gibbous Faded":Ha[32],"Last Quarter Rising":Ha[33],"Last Quarter Risen":Ha[34],"Last Quarter":Ha[36],"Last Quarter Fading":Ha[37],"Last Quarter Faded":Ha[38],"Waning Crescent Rising":Ha[39],"Waning Crescent Risen":Ha[40],"Waning Crescent":Ha[42],"Waning Crescent Fading":Ha[43],"Waning Crescent Faded":Ha[44],"New Moon Rising":Ha[45],"New Moon Risen":Ha[46]},Ua={4:["New Moon","First Quarter","Full Moon","Last Quarter"],8:["New Moon","Waxing Crescent","First Quarter","Waxing Gibbous","Full Moon","Waning Gibbous","Last Quarter","Waning Crescent"],16:["New Moon","New Moon Fading","Waxing Crescent","Waxing Crescent Fading","First Quarter","First Quarter Fading","Waxing Gibbous","Waxing Gibbous Fading","Full Moon","Full Moon Fading","Waning Gibbous","Waning Gibbous Fading","Last Quarter","Last Quarter Fading","Waning Crescent","Waning Crescent Fading"],24:["New Moon","New Moon Fading","Waxing Crescent Rising","Waxing Crescent","Waxing Crescent Fading","First Quarter Rising","First Quarter","First Quarter Fading","Waxing Gibbous Rising","Waxing Gibbous","Waxing Gibbous Fading","Full Moon Rising","Full Moon","Full Moon Fading","Waning Gibbous Rising","Waning Gibbous","Waning Gibbous Fading","Last Quarter Rising","Last Quarter","Last Quarter Fading","Waning Crescent Rising","Waning Crescent","Waning Crescent Fading","New Moon Rising"],40:["New Moon","New Moon Fading","New Moon Faded","Waxing Crescent Rising","Waxing Crescent Risen","Waxing Crescent","Waxing Crescent Fading","Waxing Crescent Faded","First Quarter Rising","First Quarter Risen","First Quarter","First Quarter Fading","First Quarter Faded","Waxing Gibbous Rising","Waxing Gibbous Risen","Waxing Gibbous","Waxing Gibbous Fading","Waxing Gibbous Faded","Full Moon Rising","Full Moon Risen","Full Moon","Full Moon Fading","Full Moon Faded","Waning Gibbous Rising","Waning Gibbous Risen","Waning Gibbous","Waning Gibbous Fading","Waning Gibbous Faded","Last Quarter Rising","Last Quarter Risen","Last Quarter","Last Quarter Fading","Last Quarter Faded","Waning Crescent Rising","Waning Crescent Risen","Waning Crescent","Waning Crescent Fading","Waning Crescent Faded","New Moon Rising","New Moon Risen"]};function za(e){R(e,"svelte-1ok7o99",".category.svelte-1ok7o99{display:grid;grid-template-columns:1fr auto auto;align-items:center;gap:0.5rem;padding-top:0.75rem}")}function Ya(e,t,n){const a=e.slice();return a[7]=t[n],a}function Za(e){let t,n=e[0],a=[];for(let t=0;tCreate a new category to see it here.",K(t,"class","existing-items")},m(e,n){V(e,t,n)},p:g,d(e){e&&P(t)}}}function Qa(e){let t,n,a,r,i,o,s,l,c,d,u,h,f;function p(...t){return e[5](e[7],...t)}return{c(){t=H("div"),n=H("div"),r=z(),i=H("div"),o=H("input"),l=z(),c=H("div"),u=z(),K(o,"type","color"),o.value=s=e[7].color,K(i,"class","color"),K(t,"class","category svelte-1ok7o99")},m(s,m){V(s,t,m),L(t,n),L(t,r),L(t,i),L(i,o),L(t,l),L(t,c),L(t,u),h||(f=[M(a=e[1].call(null,n,e[7])),Z(o,"change",p),M(d=e[2].call(null,c,e[7]))],h=!0)},p(t,n){e=t,a&&x(a.update)&&1&n&&a.update.call(null,e[7]),1&n&&s!==(s=e[7].color)&&(o.value=s),d&&x(d.update)&&1&n&&d.update.call(null,e[7])},d(e){e&&P(t),h=!1,w(f)}}}function Ja(e){let t;function n(e,t){return e[0].length?Za:Ka}let a=n(e),r=a(e);return{c(){r.c(),t=Y()},m(e,n){r.m(e,n),V(e,t,n)},p(e,i){a===(a=n(e))&&r?r.p(e,i):(r.d(1),r=a(e),r&&(r.c(),r.m(t.parentNode,t)))},d(e){r.d(e),e&&P(t)}}}function Xa(e){let t,n;return t=new Qn({props:{label:"Event Categories",$$slots:{default:[Ja]},$$scope:{ctx:e}}}),t.$on("new-item",e[4]),{c(){je(t.$$.fragment)},m(e,a){_e(t,e,a),n=!0},p(e,[n]){const a={};1025&n&&(a.$$scope={dirty:n,ctx:e}),t.$set(a)},i(e){n||(Ne(t.$$.fragment,e),n=!0)},o(e){Oe(t.$$.fragment,e),n=!1},d(e){Ve(t,e)}}}function er(e,n,a){const r=he();let{categories:i=[]}=n;const o=(e,t)=>{const{target:n}=e;n instanceof HTMLInputElement&&(t.color=n.value,r("update",t))};return e.$$set=e=>{"categories"in e&&a(0,i=e.categories)},[i,(e,n)=>{new t.TextComponent(e).setValue(n.name).setPlaceholder("Name").onChange((e=>{n.name=e,r("update",n)})).inputEl.setAttr("style","width: 100%;")},(e,n)=>{new t.ExtraButtonComponent(e).setIcon("trash").onClick((()=>{a(0,i=i.filter((e=>e.id!==n.id))),r("delete",n)}))},o,()=>{const e={id:c(),color:Ga,name:"Category"};a(0,i),r("new",e)},(e,t)=>o(t,e)]}const tr=class extends Ge{constructor(e){super(),Pe(this,e,er,Xa,D,{categories:0},za)}};function nr(t,n,a={cta:"Yes",secondary:"No"}){return e(this,void 0,void 0,(function*(){return new Promise(((e,r)=>{const i=new ar(t,n,a);i.onClose=()=>{e(i.confirmed)},i.open()}))}))}class ar extends t.Modal{constructor(e,t,n){super(e),this.text=t,this.buttons=n,this.confirmed=!1}display(){return e(this,void 0,void 0,(function*(){new Promise((e=>{this.contentEl.empty(),this.contentEl.addClass("confirm-modal"),this.contentEl.createEl("p",{text:this.text});const n=this.contentEl.createDiv("fantasy-calendar-confirm-buttons");new t.ButtonComponent(n).setButtonText(this.buttons.cta).setCta().onClick((()=>{this.confirmed=!0,this.close()})),new t.ButtonComponent(n).setButtonText(this.buttons.secondary).onClick((()=>{this.close()}))}))}))}onOpen(){this.display()}}function rr(e){R(e,"svelte-1f06yhl",".use-custom.svelte-1f06yhl.svelte-1f06yhl{padding-top:0.75rem}.weekday.svelte-1f06yhl.svelte-1f06yhl{display:grid;grid-template-columns:auto 1fr auto;align-items:center;justify-content:space-between;gap:1rem}.weekday.svelte-1f06yhl .icon.svelte-1f06yhl{align-items:center}.weekday.svelte-1f06yhl.svelte-1f06yhl{margin-top:0.5rem}")}function ir(e,t,n){const a=e.slice();return a[13]=t[n],a}function or(e){let t,n,a,r,i=[],o=new Map,s=e[1];const l=e=>e[13].id;for(let t=0;tCreate a new year to see it here.",K(t,"class","existing-items")},m(e,n){V(e,t,n)},p:g,d(e){e&&P(t)}}}function lr(e,t){let n,a,r,i,o,s,l,c,d,u,h,f,p,m=g;return{key:e,first:null,c(){n=H("div"),a=H("div"),i=z(),o=H("div"),l=z(),c=H("div"),u=z(),K(a,"class","icon svelte-1f06yhl"),K(c,"class","icon svelte-1f06yhl"),K(n,"class","weekday svelte-1f06yhl"),this.first=n},m(e,h){V(e,n,h),L(n,a),L(n,i),L(n,o),L(n,l),L(n,c),L(n,u),f||(p=[M(r=t[4].call(null,a)),Z(a,"mousedown",t[8]),Z(a,"touchstart",t[8]),M(s=t[6].call(null,o,t[13])),M(d=t[5].call(null,c,t[13]))],f=!0)},p(e,n){t=e,s&&x(s.update)&&2&n&&s.update.call(null,t[13]),d&&x(d.update)&&2&n&&d.update.call(null,t[13])},r(){h=n.getBoundingClientRect()},f(){le(n),m()},a(){m(),m=se(n,h,We,{duration:hr})},d(e){e&&P(n),f=!1,w(p)}}}function cr(e){let t;function n(e,t){return e[1]&&e[1].length?or:sr}let a=n(e),r=a(e);return{c(){r.c(),t=Y()},m(e,n){r.m(e,n),V(e,t,n)},p(e,i){a===(a=n(e))&&r?r.p(e,i):(r.d(1),r=a(e),r&&(r.c(),r.m(t.parentNode,t)))},d(e){r.d(e),e&&P(t)}}}function dr(e){let t,n,a,r;return{c(){t=H("div"),K(t,"class","use-custom svelte-1f06yhl")},m(i,o){V(i,t,o),a||(r=M(n=e[7].call(null,t)),a=!0)},d(e){e&&P(t),a=!1,r()}}}function ur(e){let t,n;return t=new Qn({props:{label:"Years",disabled:!e[0],$$slots:{"pre-add":[dr],default:[cr]},$$scope:{ctx:e}}}),t.$on("new-item",e[3]),{c(){je(t.$$.fragment)},m(e,a){_e(t,e,a),n=!0},p(e,[n]){const a={};1&n&&(a.disabled=!e[0]),65542&n&&(a.$$scope={dirty:n,ctx:e}),t.$set(a)},i(e){n||(Ne(t.$$.fragment,e),n=!0)},o(e){Oe(t.$$.fragment,e),n=!1},d(e){Ve(t,e)}}}const hr=300;function fr(n,a,r){let{useCustomYears:i}=a,{years:o}=a,{app:s}=a,l=!1;const d=he();return n.$$set=e=>{"useCustomYears"in e&&r(0,i=e.useCustomYears),"years"in e&&r(1,o=e.years),"app"in e&&r(11,s=e.app)},n.$$.update=()=>{2&n.$$.dirty&&d("years-update",o),1&n.$$.dirty&&d("use-custom-update",i)},[i,o,l,()=>{o||r(1,o=[]),r(1,o=[...o,{name:null,id:c(),type:"year"}])},e=>{(0,t.setIcon)(e,"fantasy-calendar-grip")},(e,n)=>{new t.ExtraButtonComponent(e).setIcon("trash").onClick((()=>r(1,o=o.filter((e=>e.id!==n.id)))))},(e,n)=>{new t.TextComponent(e).setValue(n.name).setPlaceholder("Name").onChange((e=>{n.name=e,d("years-update",o),r(1,o)})).inputEl.setAttr("style","width: 100%;")},n=>{new t.Setting(n).setName("Use Custom Years").setDesc(createFragment((e=>(e.createSpan({text:"Create custom years to display instead of incrementing from 1."}),e.createEl("br"),e.createSpan({text:"If on, "}),e.createEl("strong",{text:"only the years added below will be displayed."}),e)))).addToggle((t=>{let n=!1;t.setValue(i).onChange((a=>e(void 0,void 0,void 0,(function*(){!n&&i&&(null==o?void 0:o.length)?((yield nr(s,"The custom years you have created will be removed. Proceed?"))&&(r(1,o=[]),r(0,i=a),n=!1),n=!0,t.setValue(i)):(n=!1,r(0,i=a))}))))}))},function(e){e.preventDefault(),r(2,l=!1)},function(e){const{items:t,info:{source:n,trigger:a}}=e.detail;r(1,o=t),n===lt&&a===ot&&r(2,l=!0)},function(e){const{items:t,info:{source:n}}=e.detail;r(1,o=t),n===st&&r(2,l=!0)},s]}const pr=class extends Ge{constructor(e){super(),Pe(this,e,fr,ur,D,{useCustomYears:0,years:1,app:11},rr)}};function mr(e,t){void 0===t&&(t=!1);var n=e.getBoundingClientRect();return{width:n.width/1,height:n.height/1,top:n.top/1,right:n.right/1,bottom:n.bottom/1,left:n.left/1,x:n.left/1,y:n.top/1}}function gr(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function yr(e){var t=gr(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function vr(e){return e instanceof gr(e).Element||e instanceof Element}function br(e){return e instanceof gr(e).HTMLElement||e instanceof HTMLElement}function wr(e){return"undefined"!=typeof ShadowRoot&&(e instanceof gr(e).ShadowRoot||e instanceof ShadowRoot)}function xr(e){return e?(e.nodeName||"").toLowerCase():null}function Dr(e){return((vr(e)?e.ownerDocument:e.document)||window.document).documentElement}function kr(e){return mr(Dr(e)).left+yr(e).scrollLeft}function Er(e){return gr(e).getComputedStyle(e)}function Cr(e){var t=Er(e),n=t.overflow,a=t.overflowX,r=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+a)}function Ar(e,t,n){void 0===n&&(n=!1);var a,r,i=br(t),o=br(t)&&function(e){var t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,a=t.height/e.offsetHeight||1;return 1!==n||1!==a}(t),s=Dr(t),l=mr(e,o),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(i||!i&&!n)&&(("body"!==xr(t)||Cr(s))&&(c=(a=t)!==gr(a)&&br(a)?{scrollLeft:(r=a).scrollLeft,scrollTop:r.scrollTop}:yr(a)),br(t)?((d=mr(t,!0)).x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=kr(s))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Tr(e){var t=mr(e),n=e.offsetWidth,a=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-a)<=1&&(a=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:a}}function Sr(e){return"html"===xr(e)?e:e.assignedSlot||e.parentNode||(wr(e)?e.host:null)||Dr(e)}function $r(e){return["html","body","#document"].indexOf(xr(e))>=0?e.ownerDocument.body:br(e)&&Cr(e)?e:$r(Sr(e))}function Mr(e,t){var n;void 0===t&&(t=[]);var a=$r(e),r=a===(null==(n=e.ownerDocument)?void 0:n.body),i=gr(a),o=r?[i].concat(i.visualViewport||[],Cr(a)?a:[]):a,s=t.concat(o);return r?s:s.concat(Mr(Sr(o)))}function qr(e){return["table","td","th"].indexOf(xr(e))>=0}function Ir(e){return br(e)&&"fixed"!==Er(e).position?e.offsetParent:null}function Fr(e){for(var t=gr(e),n=Ir(e);n&&qr(n)&&"static"===Er(n).position;)n=Ir(n);return n&&("html"===xr(n)||"body"===xr(n)&&"static"===Er(n).position)?t:n||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&br(e)&&"fixed"===Er(e).position)return null;for(var n=Sr(e);br(n)&&["html","body"].indexOf(xr(n))<0;){var a=Er(n);if("none"!==a.transform||"none"!==a.perspective||"paint"===a.contain||-1!==["transform","perspective"].indexOf(a.willChange)||t&&"filter"===a.willChange||t&&a.filter&&"none"!==a.filter)return n;n=n.parentNode}return null}(e)||t}var Nr="top",Or="bottom",Br="right",Lr="left",Rr="auto",jr=[Nr,Or,Br,Lr],_r="start",Vr="end",Pr="viewport",Gr="popper",Hr=jr.reduce((function(e,t){return e.concat([t+"-"+_r,t+"-"+Vr])}),[]),Wr=[].concat(jr,[Rr]).reduce((function(e,t){return e.concat([t,t+"-"+_r,t+"-"+Vr])}),[]),Ur=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function zr(e){var t=new Map,n=new Set,a=[];function r(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var a=t.get(e);a&&r(a)}})),a.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||r(e)})),a}var Yr={placement:"bottom",modifiers:[],strategy:"absolute"};function Zr(){for(var e=arguments.length,t=new Array(e),n=0;n=0?"x":"y"}function ni(e){var t,n=e.reference,a=e.element,r=e.placement,i=r?Xr(r):null,o=r?ei(r):null,s=n.x+n.width/2-a.width/2,l=n.y+n.height/2-a.height/2;switch(i){case Nr:t={x:s,y:n.y-a.height};break;case Or:t={x:s,y:n.y+n.height};break;case Br:t={x:n.x+n.width,y:l};break;case Lr:t={x:n.x-a.width,y:l};break;default:t={x:n.x,y:n.y}}var c=i?ti(i):null;if(null!=c){var d="y"===c?"height":"width";switch(o){case _r:t[c]=t[c]-(n[d]/2-a[d]/2);break;case Vr:t[c]=t[c]+(n[d]/2-a[d]/2)}}return t}const ai={name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=ni({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}};var ri=Math.max,ii=Math.min,oi=Math.round,si={top:"auto",right:"auto",bottom:"auto",left:"auto"};function li(e){var t,n=e.popper,a=e.popperRect,r=e.placement,i=e.variation,o=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,u=!0===d?function(e){var t=e.x,n=e.y,a=window.devicePixelRatio||1;return{x:oi(oi(t*a)/a)||0,y:oi(oi(n*a)/a)||0}}(o):"function"==typeof d?d(o):o,h=u.x,f=void 0===h?0:h,p=u.y,m=void 0===p?0:p,g=o.hasOwnProperty("x"),y=o.hasOwnProperty("y"),v=Lr,b=Nr,w=window;if(c){var x=Fr(n),D="clientHeight",k="clientWidth";x===gr(n)&&"static"!==Er(x=Dr(n)).position&&"absolute"===s&&(D="scrollHeight",k="scrollWidth"),x=x,r!==Nr&&(r!==Lr&&r!==Br||i!==Vr)||(b=Or,m-=x[D]-a.height,m*=l?1:-1),r!==Lr&&(r!==Nr&&r!==Or||i!==Vr)||(v=Br,f-=x[k]-a.width,f*=l?1:-1)}var E,C=Object.assign({position:s},c&&si);return l?Object.assign({},C,((E={})[b]=y?"0":"",E[v]=g?"0":"",E.transform=(w.devicePixelRatio||1)<=1?"translate("+f+"px, "+m+"px)":"translate3d("+f+"px, "+m+"px, 0)",E)):Object.assign({},C,((t={})[b]=y?m+"px":"",t[v]=g?f+"px":"",t.transform="",t))}var ci={left:"right",right:"left",bottom:"top",top:"bottom"};function di(e){return e.replace(/left|right|bottom|top/g,(function(e){return ci[e]}))}var ui={start:"end",end:"start"};function hi(e){return e.replace(/start|end/g,(function(e){return ui[e]}))}function fi(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&wr(n)){var a=t;do{if(a&&e.isSameNode(a))return!0;a=a.parentNode||a.host}while(a)}return!1}function pi(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function mi(e,t){return t===Pr?pi(function(e){var t=gr(e),n=Dr(e),a=t.visualViewport,r=n.clientWidth,i=n.clientHeight,o=0,s=0;return a&&(r=a.width,i=a.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(o=a.offsetLeft,s=a.offsetTop)),{width:r,height:i,x:o+kr(e),y:s}}(e)):br(t)?function(e){var t=mr(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):pi(function(e){var t,n=Dr(e),a=yr(e),r=null==(t=e.ownerDocument)?void 0:t.body,i=ri(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),o=ri(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),s=-a.scrollLeft+kr(e),l=-a.scrollTop;return"rtl"===Er(r||n).direction&&(s+=ri(n.clientWidth,r?r.clientWidth:0)-i),{width:i,height:o,x:s,y:l}}(Dr(e)))}function gi(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function yi(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function vi(e,t){void 0===t&&(t={});var n=t,a=n.placement,r=void 0===a?e.placement:a,i=n.boundary,o=void 0===i?"clippingParents":i,s=n.rootBoundary,l=void 0===s?Pr:s,c=n.elementContext,d=void 0===c?Gr:c,u=n.altBoundary,h=void 0!==u&&u,f=n.padding,p=void 0===f?0:f,m=gi("number"!=typeof p?p:yi(p,jr)),g=d===Gr?"reference":Gr,y=e.rects.popper,v=e.elements[h?g:d],b=function(e,t,n){var a="clippingParents"===t?function(e){var t=Mr(Sr(e)),n=["absolute","fixed"].indexOf(Er(e).position)>=0&&br(e)?Fr(e):e;return vr(n)?t.filter((function(e){return vr(e)&&fi(e,n)&&"body"!==xr(e)})):[]}(e):[].concat(t),r=[].concat(a,[n]),i=r[0],o=r.reduce((function(t,n){var a=mi(e,n);return t.top=ri(a.top,t.top),t.right=ii(a.right,t.right),t.bottom=ii(a.bottom,t.bottom),t.left=ri(a.left,t.left),t}),mi(e,i));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}(vr(v)?v:v.contextElement||Dr(e.elements.popper),o,l),w=mr(e.elements.reference),x=ni({reference:w,element:y,strategy:"absolute",placement:r}),D=pi(Object.assign({},y,x)),k=d===Gr?D:w,E={top:b.top-k.top+m.top,bottom:k.bottom-b.bottom+m.bottom,left:b.left-k.left+m.left,right:k.right-b.right+m.right},C=e.modifiersData.offset;if(d===Gr&&C){var A=C[r];Object.keys(E).forEach((function(e){var t=[Br,Or].indexOf(e)>=0?1:-1,n=[Nr,Or].indexOf(e)>=0?"y":"x";E[e]+=A[n]*t}))}return E}const bi={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,a=e.name;if(!t.modifiersData[a]._skip){for(var r=n.mainAxis,i=void 0===r||r,o=n.altAxis,s=void 0===o||o,l=n.fallbackPlacements,c=n.padding,d=n.boundary,u=n.rootBoundary,h=n.altBoundary,f=n.flipVariations,p=void 0===f||f,m=n.allowedAutoPlacements,g=t.options.placement,y=Xr(g),v=l||(y!==g&&p?function(e){if(Xr(e)===Rr)return[];var t=di(e);return[hi(e),t,hi(t)]}(g):[di(g)]),b=[g].concat(v).reduce((function(e,n){return e.concat(Xr(n)===Rr?function(e,t){void 0===t&&(t={});var n=t,a=n.placement,r=n.boundary,i=n.rootBoundary,o=n.padding,s=n.flipVariations,l=n.allowedAutoPlacements,c=void 0===l?Wr:l,d=ei(a),u=d?s?Hr:Hr.filter((function(e){return ei(e)===d})):jr,h=u.filter((function(e){return c.indexOf(e)>=0}));0===h.length&&(h=u);var f=h.reduce((function(t,n){return t[n]=vi(e,{placement:n,boundary:r,rootBoundary:i,padding:o})[Xr(n)],t}),{});return Object.keys(f).sort((function(e,t){return f[e]-f[t]}))}(t,{placement:n,boundary:d,rootBoundary:u,padding:c,flipVariations:p,allowedAutoPlacements:m}):n)}),[]),w=t.rects.reference,x=t.rects.popper,D=new Map,k=!0,E=b[0],C=0;C=0,M=$?"width":"height",q=vi(t,{placement:A,boundary:d,rootBoundary:u,altBoundary:h,padding:c}),I=$?S?Br:Lr:S?Or:Nr;w[M]>x[M]&&(I=di(I));var F=di(I),N=[];if(i&&N.push(q[T]<=0),s&&N.push(q[I]<=0,q[F]<=0),N.every((function(e){return e}))){E=A,k=!1;break}D.set(A,N)}if(k)for(var O=function(e){var t=b.find((function(t){var n=D.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return E=t,"break"},B=p?3:1;B>0&&"break"!==O(B);B--);t.placement!==E&&(t.modifiersData[a]._skip=!0,t.placement=E,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function wi(e,t,n){return ri(e,ii(t,n))}function xi(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function Di(e){return[Nr,Br,Or,Lr].some((function(t){return e[t]>=0}))}var ki=Kr({defaultModifiers:[Jr,ai,{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,a=n.gpuAcceleration,r=void 0===a||a,i=n.adaptive,o=void 0===i||i,s=n.roundOffsets,l=void 0===s||s,c={placement:Xr(t.placement),variation:ei(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:r};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,li(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:l})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,li(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},a=t.attributes[e]||{},r=t.elements[e];br(r)&&xr(r)&&(Object.assign(r.style,n),Object.keys(a).forEach((function(e){var t=a[e];!1===t?r.removeAttribute(e):r.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var a=t.elements[e],r=t.attributes[e]||{},i=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});br(a)&&xr(a)&&(Object.assign(a.style,i),Object.keys(r).forEach((function(e){a.removeAttribute(e)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,a=e.name,r=n.offset,i=void 0===r?[0,0]:r,o=Wr.reduce((function(e,n){return e[n]=function(e,t,n){var a=Xr(e),r=[Lr,Nr].indexOf(a)>=0?-1:1,i="function"==typeof n?n(Object.assign({},t,{placement:e})):n,o=i[0],s=i[1];return o=o||0,s=(s||0)*r,[Lr,Br].indexOf(a)>=0?{x:s,y:o}:{x:o,y:s}}(n,t.rects,i),e}),{}),s=o[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[a]=o}},bi,{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,a=e.name,r=n.mainAxis,i=void 0===r||r,o=n.altAxis,s=void 0!==o&&o,l=n.boundary,c=n.rootBoundary,d=n.altBoundary,u=n.padding,h=n.tether,f=void 0===h||h,p=n.tetherOffset,m=void 0===p?0:p,g=vi(t,{boundary:l,rootBoundary:c,padding:u,altBoundary:d}),y=Xr(t.placement),v=ei(t.placement),b=!v,w=ti(y),x="x"===w?"y":"x",D=t.modifiersData.popperOffsets,k=t.rects.reference,E=t.rects.popper,C="function"==typeof m?m(Object.assign({},t.rects,{placement:t.placement})):m,A={x:0,y:0};if(D){if(i||s){var T="y"===w?Nr:Lr,S="y"===w?Or:Br,$="y"===w?"height":"width",M=D[w],q=D[w]+g[T],I=D[w]-g[S],F=f?-E[$]/2:0,N=v===_r?k[$]:E[$],O=v===_r?-E[$]:-k[$],B=t.elements.arrow,L=f&&B?Tr(B):{width:0,height:0},R=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},j=R[T],_=R[S],V=wi(0,k[$],L[$]),P=b?k[$]/2-F-V-j-C:N-V-j-C,G=b?-k[$]/2+F+V+_+C:O+V+_+C,H=t.elements.arrow&&Fr(t.elements.arrow),W=H?"y"===w?H.clientTop||0:H.clientLeft||0:0,U=t.modifiersData.offset?t.modifiersData.offset[t.placement][w]:0,z=D[w]+P-U-W,Y=D[w]+G-U;if(i){var Z=wi(f?ii(q,z):q,M,f?ri(I,Y):I);D[w]=Z,A[w]=Z-M}if(s){var K="x"===w?Nr:Lr,Q="x"===w?Or:Br,J=D[x],X=J+g[K],ee=J-g[Q],te=wi(f?ii(X,z):X,J,f?ri(ee,Y):ee);D[x]=te,A[x]=te-J}}t.modifiersData[a]=A}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,a=e.name,r=e.options,i=n.elements.arrow,o=n.modifiersData.popperOffsets,s=Xr(n.placement),l=ti(s),c=[Lr,Br].indexOf(s)>=0?"height":"width";if(i&&o){var d=function(e,t){return gi("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:yi(e,jr))}(r.padding,n),u=Tr(i),h="y"===l?Nr:Lr,f="y"===l?Or:Br,p=n.rects.reference[c]+n.rects.reference[l]-o[l]-n.rects.popper[c],m=o[l]-n.rects.reference[l],g=Fr(i),y=g?"y"===l?g.clientHeight||0:g.clientWidth||0:0,v=p/2-m/2,b=d[h],w=y-u[c]-d[f],x=y/2-u[c]/2+v,D=wi(b,x,w),k=l;n.modifiersData[a]=((t={})[k]=D,t.centerOffset=D-x,t)}},effect:function(e){var t=e.state,n=e.options.element,a=void 0===n?"[data-popper-arrow]":n;null!=a&&("string"!=typeof a||(a=t.elements.popper.querySelector(a)))&&fi(t.elements.popper,a)&&(t.elements.arrow=a)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,a=t.rects.reference,r=t.rects.popper,i=t.modifiersData.preventOverflow,o=vi(t,{elementContext:"reference"}),s=vi(t,{altBoundary:!0}),l=xi(o,a),c=xi(s,r,i),d=Di(l),u=Di(c);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:u},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":u})}}]});class Ei{constructor(e,t,n){this.containerEl=t,this.owner=e,t.on("click",".suggestion-item",this.onSuggestionClick.bind(this)),t.on("mousemove",".suggestion-item",this.onSuggestionMouseover.bind(this)),n.register([],"ArrowUp",(()=>(this.setSelectedItem(this.selectedItem-1,!0),!1))),n.register([],"ArrowDown",(()=>(this.setSelectedItem(this.selectedItem+1,!0),!1))),n.register([],"Enter",(e=>(this.useSelectedItem(e),!1))),n.register([],"Tab",(e=>(this.chooseSuggestion(e),!1)))}chooseSuggestion(e){if(!this.items||!this.items.length)return;const t=this.items[this.selectedItem];t&&this.owner.onChooseSuggestion(t,e)}onSuggestionClick(e,t){if(e.preventDefault(),!this.suggestions||!this.suggestions.length)return;const n=this.suggestions.indexOf(t);this.setSelectedItem(n,!1),this.useSelectedItem(e)}onSuggestionMouseover(e,t){if(!this.suggestions||!this.suggestions.length)return;const n=this.suggestions.indexOf(t);this.setSelectedItem(n,!1)}empty(){this.containerEl.empty()}setSuggestions(e){this.containerEl.empty();const t=[];e.forEach((e=>{const n=this.containerEl.createDiv("suggestion-item");this.owner.renderSuggestion(e,n),t.push(n)})),this.items=e,this.suggestions=t,this.setSelectedItem(0,!1)}useSelectedItem(e){if(!this.items||!this.items.length)return;const t=this.items[this.selectedItem];t&&this.owner.selectSuggestion(t,e)}wrap(e,t){return(e%t+t)%t}setSelectedItem(e,t){const n=this.wrap(e,this.suggestions.length),a=this.suggestions[this.selectedItem],r=this.suggestions[n];a&&a.removeClass("is-selected"),r&&r.addClass("is-selected"),this.selectedItem=n,t&&r.scrollIntoView(!1)}}class Ci extends t.FuzzySuggestModal{constructor(e,n,a){super(e),this.items=[],this.scope=new t.Scope,this.emptyStateText="No match found",this.limit=100,this.inputEl=n,this.items=a,this.suggestEl=createDiv("suggestion-container"),this.contentEl=this.suggestEl.createDiv("suggestion"),this.suggester=new Ei(this,this.contentEl,this.scope),this.scope.register([],"Escape",this.onEscape.bind(this)),this.inputEl.addEventListener("input",this.onInputChanged.bind(this)),this.inputEl.addEventListener("focus",this.onFocus.bind(this)),this.inputEl.addEventListener("blur",this.close.bind(this)),this.suggestEl.on("mousedown",".suggestion-container",(e=>{e.preventDefault()}))}empty(){this.suggester.empty()}onInputChanged(){if(this.shouldNotOpen)return;const e=this.modifyInput(this.inputEl.value),t=this.getSuggestions(e);t.length>0?this.suggester.setSuggestions(t.slice(0,this.limit)):this.onNoSuggestion(),this.open()}onFocus(){this.shouldNotOpen=!1,this.onInputChanged()}modifyInput(e){return e}onNoSuggestion(){this.empty(),this.renderSuggestion(null,this.contentEl.createDiv("suggestion-item"))}open(){this.app.keymap.pushScope(this.scope),document.body.appendChild(this.suggestEl),this.popper=ki(this.inputEl,this.suggestEl,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[0,10]}},{name:"flip",options:{fallbackPlacements:["top"]}}]})}onEscape(){this.close(),this.shouldNotOpen=!0}close(){this.app.keymap.popScope(this.scope),this.suggester.setSuggestions([]),this.popper&&this.popper.destroy(),this.suggestEl.detach()}createPrompt(e){this.promptEl||(this.promptEl=this.suggestEl.createDiv("prompt-instructions"));let t=this.promptEl.createDiv("prompt-instruction");for(let n of e)t.appendChild(n)}}class Ai extends Ci{constructor(e,t,n){super(e,t.inputEl,n),this.files=[...n],this.text=t,this.createPrompts(),this.inputEl.addEventListener("input",this.getFile.bind(this))}createPrompts(){this.createPrompt([createSpan({cls:"prompt-instruction-command",text:"Type #"}),createSpan({text:"to link heading"})]),this.createPrompt([createSpan({cls:"prompt-instruction-command",text:"Type ^"}),createSpan({text:"to link blocks"})]),this.createPrompt([createSpan({cls:"prompt-instruction-command",text:"Note: "}),createSpan({text:"Blocks must have been created already"})])}getFile(){const e=this.inputEl.value,t=this.app.metadataCache.getFirstLinkpathDest(e.split(/[\^#]/).shift()||"","");t!=this.file&&(this.file=t,this.file&&(this.cache=this.app.metadataCache.getFileCache(this.file)),this.onInputChanged())}getItemText(e){return e instanceof t.TFile?e.path:Object.prototype.hasOwnProperty.call(e,"heading")?e.heading:Object.prototype.hasOwnProperty.call(e,"id")?e.id:void 0}onChooseItem(e){e instanceof t.TFile?(this.text.setValue(e.basename),this.file=e,this.cache=this.app.metadataCache.getFileCache(this.file)):Object.prototype.hasOwnProperty.call(e,"heading")?this.text.setValue(this.file.basename+"#"+e.heading):Object.prototype.hasOwnProperty.call(e,"id")&&this.text.setValue(this.file.basename+"^"+e.id)}selectSuggestion({item:e}){let n;e instanceof t.TFile?(this.file=e,n=e.basename):Object.prototype.hasOwnProperty.call(e,"heading")?n=this.file.basename+"#"+e.heading:Object.prototype.hasOwnProperty.call(e,"id")&&(n=this.file.basename+"^"+e.id),this.text.setValue(n),this.close(),this.onClose()}renderSuggestion(e,n){let{item:a,match:r}=e||{},i=n.createDiv({cls:"suggestion-content"});if(!a)return i.setText(this.emptyStateText),void i.parentElement.addClass("is-selected");if(a instanceof t.TFile){let e=a.path.length-a.name.length;const t=r.matches.map((e=>createSpan("suggestion-highlight")));for(let n=e;ne[0]===n));if(e){let o=t[r.matches.indexOf(e)];i.appendChild(o),o.appendText(a.path.substring(e[0],e[1])),n+=e[1]-e[0]-1}else i.appendText(a.path[n])}n.createDiv({cls:"suggestion-note",text:a.path})}else Object.prototype.hasOwnProperty.call(a,"heading")?(i.setText(a.heading),i.prepend(createSpan({cls:"suggestion-flair",text:`H${a.level}`}))):Object.prototype.hasOwnProperty.call(a,"id")&&i.setText(a.id)}get headings(){return this.file?(this.cache||(this.cache=this.app.metadataCache.getFileCache(this.file)),this.cache.headings||[]):[]}get blocks(){return this.file?(this.cache||(this.cache=this.app.metadataCache.getFileCache(this.file)),Object.values(this.cache.blocks||{})||[]):[]}getItems(){const e=this.inputEl.value;return/#/.test(e)?(this.modifyInput=e=>e.split(/#/).pop(),this.headings):/\^/.test(e)?(this.modifyInput=e=>e.split(/\^/).pop(),this.blocks):this.files}}class Ti extends t.Modal{constructor(e,t,n,a){super(e),this.calendar=t,this.saved=!1,this.event={name:null,description:null,date:{month:null,day:null,year:null},id:c(),note:null,category:null},n&&(this.event=Object.assign({},n),this.editing=!0),a&&(this.event.date=Object.assign({},a)),this.containerEl.addClass("fantasy-calendar-create-event")}display(){return e(this,void 0,void 0,(function*(){this.contentEl.empty(),this.contentEl.createEl("h3",{text:this.editing?"Edit Event":"New Event"}),this.infoEl=this.contentEl.createDiv("event-info"),this.buildInfo(),this.dateEl=this.contentEl.createDiv("event-date"),this.buildDate(),new t.Setting(this.contentEl).addButton((e=>{e.setButtonText("Save").setCta().onClick((()=>{var e,n,a,r,i,o;if(null===(e=this.event.name)||void 0===e?void 0:e.length){if(this.event.end){this.event.end={year:null!==(n=this.event.end.year)&&void 0!==n?n:this.event.date.year,month:null!==(a=this.event.end.month)&&void 0!==a?a:this.event.date.month,day:null!==(r=this.event.end.day)&&void 0!==r?r:this.event.date.day};const e=this.event.date,t=this.event.end,s=Math.max(...this.calendar.static.months.map((e=>e.length))),l=s*this.calendar.static.months.length;if((e.year-1)*l+(null!==(i=e.month)&&void 0!==i?i:-1)*s+e.day>(t.year-1)*l+(null!==(o=t.month)&&void 0!==o?o:-1)*s+t.day){const e=Object.assign({},this.event.end);this.event.end=Object.assign({},this.event.date),this.event.date=Object.assign({},e)}}this.saved=!0,this.close()}else new t.Notice("The event must have a name.")}))})).addExtraButton((e=>{e.setIcon("cross").setTooltip("Cancel").onClick((()=>this.close()))}))}))}buildDate(){this.dateEl.empty(),this.buildStartDate(),this.endEl=this.dateEl.createDiv(),this.event.end?this.buildEndDate():new t.Setting(this.endEl).setName("Add End Date").addToggle((e=>{e.setValue(!1).onChange((e=>this.buildEndDate()))})),this.stringEl=this.dateEl.createDiv("event-date-string setting-item-description"),this.buildDateString()}buildStartDate(){this.startEl=this.dateEl.createDiv("fantasy-calendar-event-date"),this.startEl.createSpan({text:"Start:"}),this.startDateEl=this.startEl.createDiv("fantasy-calendar-date-fields"),this.buildDateFields(this.startDateEl,this.event.date)}buildEndDate(){var e;this.event.end=null!==(e=this.event.end)&&void 0!==e?e:Object.assign({},this.event.date),this.endEl.empty(),this.endEl.addClass("fantasy-calendar-event-date"),this.endEl.createSpan({text:"End:"}),this.endDateEl=this.endEl.createDiv("fantasy-calendar-date-fields"),this.buildDateFields(this.endDateEl,this.event.end)}buildDateString(){this.stringEl.empty(),this.stringEl.createSpan({text:h(this.event.date,this.calendar.static.months,this.event.end)})}buildDateFields(e,n=this.event.date){e.empty();const a=e.createDiv("fantasy-calendar-date-field");a.createEl("label",{text:"Day"}),new t.TextComponent(a).setPlaceholder("Day").setValue(`${n.day}`).onChange((e=>{n.day=Number(e),this.buildDateString()})).inputEl.setAttr("type","number");const r=e.createDiv("fantasy-calendar-date-field");r.createEl("label",{text:"Month"}),new t.DropdownComponent(r).addOptions(Object.fromEntries([["select","Select Month"],...this.calendar.static.months.map((e=>[e.name,e.name]))])).setValue(null!=n.month?this.calendar.static.months[n.month].name:"select").onChange((e=>{"select"===e&&(n.month=null);const t=this.calendar.static.months.find((t=>t.name==e));n.month=this.calendar.static.months.indexOf(t),this.buildDateString()}));const i=e.createDiv("fantasy-calendar-date-field");i.createEl("label",{text:"Year"}),new t.TextComponent(i).setPlaceholder("Year").setValue(`${n.year}`).onChange((e=>{n.year=e&&null!=e?Number(e):void 0,this.buildDateString()})).inputEl.setAttr("type","number")}buildInfo(){this.infoEl.empty(),new t.Setting(this.infoEl).setName("Note").setDesc("Link the event to a note.").addText((n=>{let a=this.app.vault.getFiles();if(n.setPlaceholder("Path"),this.event.note){const e=this.app.vault.getAbstractFileByPath(this.event.note);e&&e instanceof t.TFile&&n.setValue(e.basename)}const r=new Ai(this.app,n,[...a]);r.onClose=()=>e(this,void 0,void 0,(function*(){n.inputEl.blur(),this.event.note=r.file.path,this.tryParse(r.file)}))})),new t.Setting(this.infoEl).setName("Event Name").addText((e=>e.setPlaceholder("Event Name").setValue(this.event.name).onChange((e=>{this.event.name=e}))));const n=this.infoEl.createDiv("event-description");n.createEl("label",{text:"Event Description"}),new t.TextAreaComponent(n).setPlaceholder("Event Description").setValue(this.event.description).onChange((e=>{this.event.description=e})),new t.Setting(this.infoEl).setName("Event Category").addDropdown((e=>{const t=Object.fromEntries(this.calendar.categories.map((e=>[e.id,e.name])));e.addOptions(t).setValue(this.event.category).onChange((e=>this.event.category=e))}))}tryParse(t){var n,a,r,i,o;return e(this,void 0,void 0,(function*(){this.event.name=t.basename;const e=this.app.metadataCache.getFileCache(t),{frontmatter:s}=e;if(s){if("fc-date"in s){const{day:e,month:t,year:o}=s["fc-date"];if(e&&(this.event.date.day=e),t){if("string"==typeof t){const e=null!==(a=null===(n=this.calendar.static.months)||void 0===n?void 0:n.find((e=>e.name==t)))&&void 0!==a?a:null===(r=this.calendar.static.months)||void 0===r?void 0:r[0];this.event.date.month=null===(i=this.calendar.static.months)||void 0===i?void 0:i.indexOf(e)}"number"==typeof t&&(this.event.date.month=t-1)}o&&(this.event.date.year=o)}"fc-category"in s&&(this.calendar.categories.find((e=>e.name===s["fc-category"]))||this.calendar.categories.push({name:s["fantasy-category"],color:"#808080",id:c()}),this.event.category=null===(o=this.calendar.categories.find((e=>e.name===s["fc-category"])))||void 0===o?void 0:o.id)}yield this.display()}))}onOpen(){return e(this,void 0,void 0,(function*(){yield this.display()}))}}function Si(e){let t,n,a,r,i,o,s,l;return{c(){t=W("svg"),n=W("circle"),r=W("path"),o=W("circle"),K(n,"cx","16"),K(n,"cy","16"),K(n,"r","10"),K(n,"fill",a=e[0].faceColor),K(r,"class","shadow"),K(r,"fill",i=e[0].shadowColor),K(r,"d",e[4]),K(o,"cx","16"),K(o,"cy","16"),K(o,"r","10"),K(o,"fill","none"),K(o,"stroke","#000"),K(o,"stroke-width","2px"),K(t,"class","moon"),K(t,"id",s=e[0].id),K(t,"preserveAspectRatio","xMidYMid"),K(t,"aria-label",l=e[1]?`${e[0].name}\n${e[3]}`:null),K(t,"width",e[2]),K(t,"height",e[2]),K(t,"viewBox","0 0 32 32")},m(e,a){V(e,t,a),L(t,n),L(t,r),L(t,o)},p(e,[o]){1&o&&a!==(a=e[0].faceColor)&&K(n,"fill",a),1&o&&i!==(i=e[0].shadowColor)&&K(r,"fill",i),16&o&&K(r,"d",e[4]),1&o&&s!==(s=e[0].id)&&K(t,"id",s),11&o&&l!==(l=e[1]?`${e[0].name}\n${e[3]}`:null)&&K(t,"aria-label",l),4&o&&K(t,"width",e[2]),4&o&&K(t,"height",e[2])},i:g,o:g,d(e){e&&P(t)}}}function $i(e,t,n){let a,{moon:r}=t,{label:i=!0}=t,{size:o=28}=t,{phase:s}=t;return e.$$set=e=>{"moon"in e&&n(0,r=e.moon),"label"in e&&n(1,i=e.label),"size"in e&&n(2,o=e.size),"phase"in e&&n(3,s=e.phase)},e.$$.update=()=>{8&e.$$.dirty&&n(4,a=Wa[s])},[r,i,o,s,a]}const Mi=class extends Ge{constructor(e){super(),Pe(this,e,$i,Si,D,{moon:0,label:1,size:2,phase:3})}};function qi(e){R(e,"svelte-v24qmo",".moon.svelte-v24qmo{display:grid;grid-template-columns:1fr auto;align-items:center;justify-content:space-between;gap:1rem;margin-top:0.5rem}.setting-item-name.svelte-v24qmo{display:flex;align-items:center}.icons.svelte-v24qmo{display:flex;align-self:flex-start;justify-self:flex-end;align-items:center}.icon.svelte-v24qmo{align-items:center}")}function Ii(e,t,n){const a=e.slice();return a[10]=t[n],a}function Fi(e){let t,n,a=e[0],r=[];for(let t=0;tOe(r[e],1,1,(()=>{r[e]=null}));return{c(){t=H("div");for(let e=0;eCreate a new moon to see it here.",K(t,"class","existing-items")},m(e,n){V(e,t,n)},p:g,i:g,o:g,d(e){e&&P(t)}}}function Oi(e){let t,n,a,r,i,o,s,l,c,d,u,h,f,p,m,g,y,v,b,x,D,k,E,C=e[10].name+"",A=e[10].cycle+"";function T(){return e[7](e[10])}function S(){return e[8](e[10])}return r=new Mi({props:{moon:e[10],phase:"First Quarter",label:!1,size:20}}),{c(){t=H("div"),n=H("div"),a=H("span"),je(r.$$.fragment),i=z(),o=U(C),s=z(),l=H("div"),c=H("div"),d=U("Cycle: "),u=U(A),h=U(" days"),f=z(),p=H("div"),m=H("div"),y=z(),v=H("div"),x=z(),K(a,"class","setting-item-name svelte-v24qmo"),K(c,"class","date"),K(l,"class","setting-item-description"),K(n,"class","moon-info"),K(m,"class","icon svelte-v24qmo"),K(v,"class","icon svelte-v24qmo"),K(p,"class","icons svelte-v24qmo"),K(t,"class","moon svelte-v24qmo")},m(w,C){V(w,t,C),L(t,n),L(n,a),_e(r,a,null),L(a,i),L(a,o),L(n,s),L(n,l),L(l,c),L(c,d),L(c,u),L(c,h),L(t,f),L(t,p),L(p,m),L(p,y),L(p,v),L(t,x),D=!0,k||(E=[M(g=e[4].call(null,m)),Z(m,"click",T),M(b=e[3].call(null,v)),Z(v,"click",S)],k=!0)},p(t,n){e=t;const a={};1&n&&(a.moon=e[10]),r.$set(a),(!D||1&n)&&C!==(C=e[10].name+"")&&J(o,C),(!D||1&n)&&A!==(A=e[10].cycle+"")&&J(u,A)},i(e){D||(Ne(r.$$.fragment,e),D=!0)},o(e){Oe(r.$$.fragment,e),D=!1},d(e){e&&P(t),Ve(r),k=!1,w(E)}}}function Bi(e){let t,n,a,r;const i=[Ni,Fi],o=[];function s(e,t){return e[0].length?1:0}return t=s(e),n=o[t]=i[t](e),{c(){n.c(),a=Y()},m(e,n){o[t].m(e,n),V(e,a,n),r=!0},p(e,r){let l=t;t=s(e),t===l?o[t].p(e,r):(Ie(),Oe(o[l],1,1,(()=>{o[l]=null})),Fe(),n=o[t],n?n.p(e,r):(n=o[t]=i[t](e),n.c()),Ne(n,1),n.m(a.parentNode,a))},i(e){r||(Ne(n),r=!0)},o(e){Oe(n),r=!1},d(e){o[t].d(e),e&&P(a)}}}function Li(e){let t,n,a,r;return{c(){t=H("div")},m(i,o){V(i,t,o),a||(r=M(n=e[2].call(null,t)),a=!0)},d(e){e&&P(t),a=!1,r()}}}function Ri(e){let t,n;return t=new Qn({props:{label:"Moons",$$slots:{"pre-add":[Li],default:[Bi]},$$scope:{ctx:e}}}),t.$on("new-item",e[9]),{c(){je(t.$$.fragment)},m(e,a){_e(t,e,a),n=!0},p(e,[n]){const a={};8193&n&&(a.$$scope={dirty:n,ctx:e}),t.$set(a)},i(e){n||(Ne(t.$$.fragment,e),n=!0)},o(e){Oe(t.$$.fragment,e),n=!1},d(e){Ve(t,e)}}}function ji(e,n,a){let{moons:r=[]}=n,{displayMoons:i=!0}=n;const o=he(),s=e=>{a(0,r=r.filter((t=>t.id!==e.id))),o("edit-moons",r)};return e.$$set=e=>{"moons"in e&&a(0,r=e.moons),"displayMoons"in e&&a(6,i=e.displayMoons)},[r,o,e=>{new t.Setting(e).setName("Display Moons").setDesc("Display moons by default when viewing this calendar.").addToggle((e=>{e.setValue(i).onChange((e=>o("display-toggle",e)))}))},e=>{new t.ExtraButtonComponent(e).setIcon("trash").setTooltip("Delete").extraSettingsEl.setAttr("style","margin-left: 0;")},e=>{new t.ExtraButtonComponent(e).setIcon("pencil").setTooltip("Edit")},s,i,e=>o("new-item",e),e=>s(e),function(t){me.call(this,e,t)}]}const _i=class extends Ge{constructor(e){super(),Pe(this,e,ji,Ri,D,{moons:0,displayMoons:6},qi)}};function Vi(e){R(e,"svelte-1rh93fc",".leapday.svelte-1rh93fc.svelte-1rh93fc{display:grid;grid-template-columns:1fr auto;align-items:center;justify-content:space-between;gap:1rem;margin-top:0.5rem}.leapday-info.svelte-1rh93fc.svelte-1rh93fc{width:100%}.icons.svelte-1rh93fc.svelte-1rh93fc{display:flex;align-self:center;justify-self:flex-end;align-items:center}.leapday.svelte-1rh93fc .icon.svelte-1rh93fc{align-items:center}")}function Pi(e){let t,n,a,r,i,o,s,l,c,d,u,h,f,p,m,y,v=e[0].name+"";return{c(){t=H("div"),n=H("div"),a=H("span"),r=U(v),i=z(),o=H("div"),s=U(e[1]),l=z(),c=H("div"),d=H("div"),h=z(),f=H("div"),K(a,"class","setting-item-name"),K(o,"class","setting-item-description"),K(n,"class","leapday-info svelte-1rh93fc"),K(d,"class","icon svelte-1rh93fc"),K(f,"class","icon svelte-1rh93fc"),K(c,"class","icons svelte-1rh93fc"),K(t,"class","leapday svelte-1rh93fc")},m(g,v){V(g,t,v),L(t,n),L(n,a),L(a,r),L(n,i),L(n,o),L(o,s),L(t,l),L(t,c),L(c,d),L(c,h),L(c,f),m||(y=[M(u=e[4].call(null,d)),Z(d,"click",e[5]),M(p=e[3].call(null,f)),Z(f,"click",e[6])],m=!0)},p(e,[t]){1&t&&v!==(v=e[0].name+"")&&J(r,v),2&t&&J(s,e[1])},i:g,o:g,d(e){e&&P(t),m=!1,w(y)}}}function Gi(e,n,a){let r;const i=he();let{leapday:o}=n;return e.$$set=e=>{"leapday"in e&&a(0,o=e.leapday)},e.$$.update=()=>{1&e.$$.dirty&&a(1,r=d(o))},[o,r,i,e=>{new t.ExtraButtonComponent(e).setIcon("trash").setTooltip("Delete").extraSettingsEl.setAttr("style","margin-left: 0;")},e=>{new t.ExtraButtonComponent(e).setIcon("pencil").setTooltip("Edit")},()=>i("edit"),()=>i("delete")]}const Hi=class extends Ge{constructor(e){super(),Pe(this,e,Gi,Pi,D,{leapday:0},Vi)}};function Wi(e,t,n){const a=e.slice();return a[7]=t[n],a}function Ui(e){let t,n,a=e[0],r=[];for(let t=0;tOe(r[e],1,1,(()=>{r[e]=null}));return{c(){t=H("div");for(let e=0;eCreate a new leap day to see it here.",K(t,"class","existing-items")},m(e,n){V(e,t,n)},p:g,i:g,o:g,d(e){e&&P(t)}}}function Yi(e){let t,n;return t=new Hi({props:{leapday:e[7]}}),t.$on("edit",(function(){return e[3](e[7])})),t.$on("delete",(function(){return e[4](e[7])})),{c(){je(t.$$.fragment)},m(e,a){_e(t,e,a),n=!0},p(n,a){e=n;const r={};1&a&&(r.leapday=e[7]),t.$set(r)},i(e){n||(Ne(t.$$.fragment,e),n=!0)},o(e){Oe(t.$$.fragment,e),n=!1},d(e){Ve(t,e)}}}function Zi(e){let t,n,a,r;const i=[zi,Ui],o=[];function s(e,t){return e[0].length?1:0}return t=s(e),n=o[t]=i[t](e),{c(){n.c(),a=Y()},m(e,n){o[t].m(e,n),V(e,a,n),r=!0},p(e,r){let l=t;t=s(e),t===l?o[t].p(e,r):(Ie(),Oe(o[l],1,1,(()=>{o[l]=null})),Fe(),n=o[t],n?n.p(e,r):(n=o[t]=i[t](e),n.c()),Ne(n,1),n.m(a.parentNode,a))},i(e){r||(Ne(n),r=!0)},o(e){Oe(n),r=!1},d(e){o[t].d(e),e&&P(a)}}}function Ki(e){let t,n;return t=new Qn({props:{label:"Leap Days",$$slots:{default:[Zi]},$$scope:{ctx:e}}}),t.$on("new-item",e[5]),{c(){je(t.$$.fragment)},m(e,a){_e(t,e,a),n=!0},p(e,[n]){const a={};1025&n&&(a.$$scope={dirty:n,ctx:e}),t.$set(a)},i(e){n||(Ne(t.$$.fragment,e),n=!0)},o(e){Oe(t.$$.fragment,e),n=!1},d(e){Ve(t,e)}}}function Qi(e,t,n){let{leapdays:a=[]}=t;const r=he(),i=e=>{r("new-item",e)},o=e=>{n(0,a=a.filter((t=>t.id!==e.id))),r("edit-leapdays",a)};return e.$$set=e=>{"leapdays"in e&&n(0,a=e.leapdays)},[a,i,o,e=>i(e),e=>o(e),function(t){me.call(this,e,t)}]}const Ji=class extends Ge{constructor(e){super(),Pe(this,e,Qi,Ki,D,{leapdays:0})}};class Xi extends t.Modal{constructor(e,t,n){super(e),this.calendar=t,this.saved=!1,this.moon={name:null,cycle:null,offset:null,faceColor:"#fff",shadowColor:"#000",id:c()},n&&(this.moon=Object.assign({},n),this.editing=!0),this.containerEl.addClass("fantasy-calendar-create-moon")}display(){return e(this,void 0,void 0,(function*(){this.contentEl.empty(),this.contentEl.createEl("h3",{text:this.editing?"Edit Moon":"New Moon"}),this.infoEl=this.contentEl.createDiv("moon-info"),this.buildInfo(),new t.Setting(this.contentEl).addButton((e=>{e.setButtonText("Save").setCta().onClick((()=>{var e;(null===(e=this.moon.name)||void 0===e?void 0:e.length)?this.moon.cycle?(this.saved=!0,this.close()):new t.Notice("The moon must have a positive cycle."):new t.Notice("The moon must have a name.")}))})).addExtraButton((e=>{e.setIcon("cross").setTooltip("Cancel").onClick((()=>this.close()))}))}))}buildInfo(){this.infoEl.empty(),new t.Setting(this.infoEl).setName("Name").addText((e=>{e.setValue(this.moon.name).onChange((e=>{this.moon.name=e}))})),new t.Setting(this.infoEl).setName("Cycle").setDesc("How many days it takes for the moon to complete a full cycle.").addText((e=>{e.inputEl.setAttr("type","number"),e.setValue(`${this.moon.cycle}`).onChange((e=>{isNaN(Number(e))||(this.moon.cycle=Number(e))}))})),new t.Setting(this.infoEl).setName("Offset").setDesc("Shift the starting moon phase by a number of days.").addText((e=>{e.inputEl.setAttr("type","number"),e.setValue(`${this.moon.offset}`).onChange((e=>{isNaN(Number(e))||(this.moon.offset=Number(e))}))})),new t.Setting(this.infoEl).setName("Face Color").addText((e=>{e.inputEl.setAttr("type","color"),e.setValue(this.moon.faceColor).onChange((e=>{this.moon.faceColor=e}))})),new t.Setting(this.infoEl).setName("Shadow Color").addText((e=>{e.inputEl.setAttr("type","color"),e.setValue(this.moon.shadowColor).onChange((e=>{this.moon.shadowColor=e}))}))}onOpen(){return e(this,void 0,void 0,(function*(){yield this.display()}))}}class eo extends t.Modal{constructor(e,t,n){super(e),this.calendar=t,this.saved=!1,this.leapday={id:c(),name:"Leap Day",interval:[],intercalary:!1,timespan:null,offset:0,type:"leapday"},n&&(this.leapday=Object.assign({},n),this.editing=!0),this.containerEl.addClass("fantasy-calendar-create-leapday")}display(){return e(this,void 0,void 0,(function*(){this.contentEl.empty(),this.contentEl.createEl("h3",{text:this.editing?"Edit Leap Day":"New Leap Day"}),this.infoEl=this.contentEl.createDiv("leapday-info"),this.buildInfo(),new t.Setting(this.contentEl).addButton((e=>{e.setButtonText("Save").setCta().onClick((()=>{this.leapday.interval.length?null!=this.leapday.timespan?(this.saved=!0,this.close()):new t.Notice("The leap day must be attached to a Month."):new t.Notice("The leap day must have an interval.")}))})).addExtraButton((e=>{e.setIcon("cross").setTooltip("Cancel").onClick((()=>this.close()))}))}))}buildInfo(){this.infoEl.empty(),new t.Setting(this.infoEl).setName("Name").addText((e=>{e.setValue(this.leapday.name).onChange((e=>{this.leapday.name=e}))})),new t.Setting(this.infoEl).setName("Month").setDesc("The leap day will be added to this month.").addDropdown((e=>{for(let t of this.calendar.static.months){const n=this.calendar.static.months.indexOf(t);e.addOption(`${n}`,t.name)}e.setValue(`${this.leapday.timespan}`).onChange((e=>this.leapday.timespan=Number(e)))})),new t.Setting(this.infoEl).setName("Offset").setDesc("Shift the years the leap day is applied to.").addText((e=>{e.inputEl.setAttr("type","number"),e.setValue(`${this.leapday.offset}`).onChange((e=>{isNaN(Number(e))||(this.leapday.offset=Number(e))}))})),this.conditionsEl=this.infoEl.createDiv(),this.buildConditions()}buildConditions(){this.conditionsEl.empty(),new t.ButtonComponent(this.conditionsEl).setTooltip("Add New").setButtonText("+").onClick((()=>e(this,void 0,void 0,(function*(){const e=new to(this.app,this.intervals.length>0);e.onClose=()=>{e.saved&&(this.leapday.interval.push(e.condition),this.buildConditions())},e.open()})))).buttonEl.style.width="100%",this.conditionsEl.createSpan({text:d(this.leapday),cls:"fantasy-leap-day-interval-description setting-item"});for(let e of this.intervals)new t.Setting(this.conditionsEl).setName(this.getIntervalName(e)).addExtraButton((t=>{t.setIcon("pencil").setTooltip("Edit").onClick((()=>{const t=new to(this.app,0!=this.intervals.indexOf(e),e);t.onClose=()=>{t.saved&&(this.leapday.interval.splice(this.leapday.interval.indexOf(e),1,t.condition),this.buildConditions())},t.open()}))})).addExtraButton((t=>{t.setIcon("trash").setTooltip("Delete").onClick((()=>{this.leapday.interval.splice(this.leapday.interval.indexOf(e),1),this.intervals.length&&this.intervals[0].exclusive&&(this.intervals[0].exclusive=!1),this.buildConditions()}))}))}get intervals(){return this.leapday.interval.sort(((e,t)=>e.interval-t.interval))}getIntervalName(e){const t=[`${e.interval}`];return e.exclusive&&t.push("(Exclusive)"),e.ignore&&t.push(" - Ignoring Offset"),t.join(" ")}onOpen(){return e(this,void 0,void 0,(function*(){yield this.display()}))}}class to extends t.Modal{constructor(e,t,n){super(e),this.app=e,this.canBeExclusive=t,this.saved=!1,this.editing=!1,this.condition={interval:null,exclusive:!1,ignore:!1},n&&(this.condition=Object.assign({},n),this.editing=!0)}onOpen(){this.contentEl.empty(),this.contentEl.createEl("h3",{text:"Leap Day Condition"}),new t.Setting(this.contentEl).setName("Interval").setDesc("How often the condition applies.").addText((e=>{e.inputEl.setAttr("type","number"),e.setValue(`${this.condition.interval}`).onChange((e=>{isNaN(Number(e))||(this.condition.interval=Number(e))}))})),new t.Setting(this.contentEl).setName("Exclusive").setDesc("If true, the leap day will not apply when the year meets the condition.\n\nRequires the leap day to have at least one non-exclusive condition.").addToggle((e=>e.setDisabled(!this.canBeExclusive).setValue(this.condition.exclusive).onChange((e=>this.condition.exclusive=e)))),new t.Setting(this.contentEl).setName("Ignore Offset").setDesc("The condition will ignore the leap day's offset when checking to apply.").addToggle((e=>e.setValue(this.condition.ignore).onChange((e=>this.condition.ignore=e)))),this.buttonsEl=this.contentEl.createDiv("fantasy-context-buttons"),new t.ButtonComponent(this.buttonsEl).setCta().setButtonText(this.editing?"Save":"Create").onClick((()=>{this.condition.interval?(this.saved=!0,this.close()):new t.Notice("The condition requires an interval.")})),new t.ExtraButtonComponent(this.buttonsEl).setTooltip("Cancel").setIcon("cross").onClick((()=>this.close()))}}class no extends Ci{constructor(e,t,n){super(e,t.inputEl,n),this.folders=[...n],this.text=t,this.inputEl.addEventListener("input",(()=>this.getFolder()))}getFolder(){const e=this.inputEl.value,n=this.app.vault.getAbstractFileByPath(e);n!=this.folder&&n instanceof t.TFolder&&(this.folder=n,this.onInputChanged())}getItemText(e){return e.path}onChooseItem(e){this.text.setValue(e.path),this.folder=e}selectSuggestion({item:e}){let t=e.path;this.text.setValue(t),this.onClose(),this.close()}renderSuggestion(e,t){let{item:n,match:a}=e||{},r=t.createDiv({cls:"suggestion-content"});if(!n)return r.setText(this.emptyStateText),void r.parentElement.addClass("is-selected");let i=n.path.length-n.name.length;const o=a.matches.map((e=>createSpan("suggestion-highlight")));for(let e=i;et[0]===e));if(t){let i=o[a.matches.indexOf(t)];r.appendChild(i),i.appendText(n.path.substring(t[0],t[1])),e+=t[1]-t[0]-1}else r.appendText(n.path[e])}t.createDiv({cls:"suggestion-note",text:n.path})}getItems(){return this.folders}}var ao;!function(e){e.none="None",e.monthly="Monthly",e.yearly="Yearly"}(ao||(ao={})),(0,t.addIcon)("fantasy-calendar-grip",''),(0,t.addIcon)("fantasy-calendar-warning",'');class ro extends t.PluginSettingTab{constructor(e){super(e.app,e),this.plugin=e}get data(){return this.plugin.data}display(){return e(this,void 0,void 0,(function*(){this.containerEl.empty(),this.containerEl.createEl("h2",{text:"Fantasy Calendars"}),this.containerEl.addClass("fantasy-calendar-settings"),this.infoEl=this.containerEl.createDiv(),this.buildInfo();const n=new t.Setting(this.containerEl).setName("Import Calendar").setDesc("Import calendar from ");n.descEl.createEl("a",{href:"https://app.fantasy-calendar.com",text:"Fantasy Calendar",cls:"external-link"});const a=createEl("input",{attr:{type:"file",name:"merge",accept:".json",multiple:!0,style:"display: none;"}});a.onchange=()=>e(this,void 0,void 0,(function*(){const{files:e}=a;if(e.length){try{const t=[];for(let n of Array.from(e))t.push(JSON.parse(yield n.text()));const n=class{static import(e){var t,n,a,r,i,s,l,d,u,h,m,g,y,v,b,w,x,D,k,E,C,A,T,S,$,M,q,I;const F=[];for(let N of e){const e=null!==(t=N.name)&&void 0!==t?t:"Imported Calendar",O=N.static_data;if(!O)continue;const B=O.year_data;if(!B)continue;const L=null!==(n=B.first_day-1)&&void 0!==n?n:0,R=null===(a=B.overflow)||void 0===a||a,j=B.global_week;if(!j)continue;const _=j.map((e=>({type:"day",name:e,id:c()}))),V=B.timespans;if(!V)continue;const P=V.map((e=>({name:(0,f.decode)(e.name),type:e.type,length:e.length,id:c()}))),G=P.reduce(((e,t)=>"month"==t.type?e+t.length:e),0),H=[];if("leap_days"in B)for(let e of B.leap_days){const t=(null!==(r=e.interval.split(","))&&void 0!==r?r:["1"]).map((e=>{const t=/\+/.test(e),n=/\!/.test(e),a=e.match(/(\d+)/).first();return{ignore:t,exclusive:n,interval:Number(a)}}));H.push({name:null!==(i=e.name)&&void 0!==i?i:`Leap Day ${H.length+1}`,type:"leapday",interval:t,timespan:null!==(s=e.timespan)&&void 0!==s?s:0,intercalary:null!==(l=e.intercalary)&&void 0!==l&&l,offset:null!==(d=e.offset)&&void 0!==d?d:0,id:c()})}const W=[];if("moons"in O)for(let e of O.moons)W.push({name:null!==(u=e.name)&&void 0!==u?u:`Moon ${W.length+1}`,cycle:null!==(h=Number(e.cycle))&&void 0!==h?h:G,offset:null!==(m=e.shift)&&void 0!==m?m:0,faceColor:null!==(g=e.color)&&void 0!==g?g:"#ffffff",shadowColor:null!==(y=e.shadow_color)&&void 0!==y?y:"#000000",id:c()});const U=[];if("eras"in O)for(let e of O.eras)U.push({name:null!==(v=e.name)&&void 0!==v?v:`Era ${U.length+1}`,description:e.description,format:null!==(b=e.formatting)&&void 0!==b?b:"Year {{year}} - {{era_name}}",start:{year:null!==(x=null===(w=e.date)||void 0===w?void 0:w.year)&&void 0!==x?x:1,month:null!==(k=null===(D=e.date)||void 0===D?void 0:D.timespan)&&void 0!==k?k:0,day:null!==(C=null===(E=e.date)||void 0===E?void 0:E.day)&&void 0!==C?C:0}});const z={firstWeekDay:L,overflow:R,weekdays:_,months:P,moons:W,leapDays:H,eras:U,displayMoons:!0,incrementDay:!1},Y={year:1,day:1,month:0};N.dynamic_data&&(Y.year=null!==(A=N.dynamic_data.year)&&void 0!==A?A:Y.year,Y.day=null!==(T=N.dynamic_data.day)&&void 0!==T?T:Y.day,Y.month=null!==(S=N.dynamic_data.month)&&void 0!==S?S:Y.month);const Z=[],K=new Map;if("categories"in N)for(let e of N.categories){const t=e.name,n=null!==($=null==t?void 0:t.split(" ").join("-").toLowerCase())&&void 0!==$?$:c();let a=e.event_settings.color;if(a in p)a=p[a];else{a=a.split("-").join("");const e=createEl("canvas"),t=e.getContext("2d");t.fillStyle=a,a=t.fillStyle,e.detach()}K.set(n,{name:t,id:n,color:a})}if(N.events&&Array.isArray(N.events)&&N.events.length)for(let e of N.events){const t={day:null,year:null,month:null};if(e.data&&e.data.date&&Array.isArray(null===(M=e.data)||void 0===M?void 0:M.date)&&e.data.date.length)t.day=e.data.date[2],t.month=e.data.date[1],t.year=e.data.date[0];else if(e.data&&e.data.conditions&&Array.isArray(e.data.conditions)){const n=e.data.conditions;try{const e=n.find((e=>"Year"===e[0])),a=n.find((e=>"Month"===e[0])),r=n.find((e=>"Day"===e[0]));e&&(t.year=Number(e[2][0])),a&&(t.month=Number(a[2][0])),r&&(t.day=Number(r[2][0]))}catch(e){}}let n;if(e.description){const t=createDiv();t.innerHTML=e.description,n=t.textContent}Z.push({name:e.name,description:n,id:e.id,note:null,date:t,category:null!==(I=null===(q=K.get(e.event_category_id))||void 0===q?void 0:q.id)&&void 0!==I?I:null})}const Q=(0,o.Z)({count:K.size});for(let e of K.keys()){const t=K.get(e);t.color||(t.color=Q.shift().hex(),K.set(e,t))}const J={name:e,description:null,static:z,current:Y,events:Z,id:c(),categories:Array.from(K.values())};F.push(J)}return F}}.import(t);this.plugin.data.calendars.push(...n),yield this.plugin.saveCalendar(),this.buildCalendarUI()}catch(n){new t.Notice(`There was an error while importing the calendar${1==e.length?"":"s"}.`),console.error(n)}a.value=null}})),n.addButton((e=>{e.setButtonText("Choose Files"),e.buttonEl.addClass("calendar-file-upload"),e.buttonEl.appendChild(a),e.onClick((()=>a.click()))})),this.calendarUI=this.containerEl.createDiv("fantasy-calendars"),this.buildCalendarUI()}))}buildInfo(){this.infoEl.empty(),new t.Setting(this.infoEl).setName("Default Calendar to Open").setDesc("Views will open to this calendar by default.").addDropdown((e=>{e.addOption("none","None");for(let t of this.data.calendars)e.addOption(t.id,t.name);e.setValue(this.plugin.data.defaultCalendar),e.onChange((e=>{if("none"===e)return this.plugin.data.defaultCalendar=null,void this.plugin.saveSettings();this.plugin.data.defaultCalendar=e,this.plugin.saveSettings()}))})),new t.Setting(this.infoEl).setName("Display Event Previews").setDesc("Use the core Note Preview plugin to display event notes when hovered.").addToggle((e=>{e.setValue(this.data.eventPreview).onChange((e=>{this.data.eventPreview=e,this.plugin.saveSettings()}))})),new t.Setting(this.infoEl).setName("Folder to Watch").setDesc("The plugin will only watch for changes in this folder.").addText((n=>{var a;let r=this.app.vault.getAllLoadedFiles().filter((e=>e instanceof t.TFolder));n.setPlaceholder(null!==(a=this.plugin.data.path)&&void 0!==a?a:"/"),new no(this.app,n,[...r]).onClose=()=>e(this,void 0,void 0,(function*(){var e;const a=(null===(e=n.inputEl.value)||void 0===e?void 0:e.trim())?n.inputEl.value.trim():"/";this.plugin.data.path=(0,t.normalizePath)(a)})),n.inputEl.onblur=()=>e(this,void 0,void 0,(function*(){var e;const a=(null===(e=n.inputEl.value)||void 0===e?void 0:e.trim())?n.inputEl.value.trim():"/";this.plugin.data.path=(0,t.normalizePath)(a)}))})),new t.Setting(this.infoEl).setClass("fantasy-calendar-config").setName(createFragment((e=>{(0,t.setIcon)(e.createSpan(),"fantasy-calendar-warning"),e.createSpan({text:"Default Config Directory"})}))).setDesc(createFragment((e=>{var t;e.createSpan({text:"Please back up your data before changing this setting. Hidden directories must be manually entered."}),e.createEl("br"),e.createSpan({text:"Current directory: "});const n=null!==(t=this.data.configDirectory)&&void 0!==t?t:this.app.vault.configDir;e.createEl("code",{text:n})}))).addText((n=>e(this,void 0,void 0,(function*(){var a;let r=this.app.vault.getAllLoadedFiles().filter((e=>e instanceof t.TFolder));n.setPlaceholder(null!==(a=this.data.configDirectory)&&void 0!==a?a:this.app.vault.configDir),new no(this.app,n,[...r]).onClose=()=>e(this,void 0,void 0,(function*(){n.inputEl.value?(yield this.app.vault.adapter.exists(n.inputEl.value))||(this.data.configDirectory=n.inputEl.value,yield this.plugin.saveSettings()):this.data.configDirectory=null})),n.inputEl.onblur=()=>e(this,void 0,void 0,(function*(){n.inputEl.value&&(yield this.app.vault.adapter.exists(n.inputEl.value),this.data.configDirectory=n.inputEl.value,yield this.plugin.saveSettings(),this.display())}))})))).addExtraButton((t=>{t.setTooltip("Reset to Default").setIcon("undo-glyph").onClick((()=>e(this,void 0,void 0,(function*(){this.data.configDirectory=null,yield this.plugin.saveSettings(),this.display()}))))}))}buildCalendarUI(){this.calendarUI.empty(),new t.Setting(this.calendarUI).setHeading().setName("Add New Calendar").addButton((t=>t.setTooltip("Add Calendar").setButtonText("+").onClick((()=>{const t=new io(this.plugin);t.onClose=()=>e(this,void 0,void 0,(function*(){if(!t.saved)return;const e=i()(t.calendar);e.current.year||(e.current.year=1),yield this.plugin.addNewCalendar(e),this.showCalendars(n)})),t.open()}))));const n=this.calendarUI.createDiv("existing-calendars");this.showCalendars(n)}showCalendars(n){var a;if(n.empty(),this.data.calendars.length)for(let r of this.data.calendars)new t.Setting(n).setName(r.name).setDesc(null!==(a=r.description)&&void 0!==a?a:"").addExtraButton((t=>{t.setIcon("pencil").onClick((()=>{const t=new io(this.plugin,r);t.onClose=()=>e(this,void 0,void 0,(function*(){t.saved?(this.data.calendars.splice(this.data.calendars.indexOf(r),1,i()(t.calendar)),yield this.plugin.saveCalendar(),this.showCalendars(n)):this.showCalendars(n)})),t.open()}))})).addExtraButton((t=>{t.setIcon("trash").onClick((()=>e(this,void 0,void 0,(function*(){(yield nr(this.app,"Are you sure you want to delete this calendar?",{cta:"Delete",secondary:"Cancel"}))&&(this.plugin.data.calendars=this.plugin.data.calendars.filter((e=>e.id!=r.id)),yield this.plugin.saveCalendar(),this.buildInfo(),this.showCalendars(n))}))))}));else n.createSpan({text:"No calendars created! Create a calendar to see it here."})}}class io extends t.Modal{constructor(e,t){super(e.app),this.plugin=e,this.calendar=Object.assign({},il),this.saved=!1,this.editing=!1,this.canSave=!1,this.tempCurrentDays=this.calendar.current.day,this.calendar.id=c(),t&&(this.editing=!0,this.calendar=i()(t)),this.containerEl.addClass("fantasy-calendar-create-calendar")}get static(){return this.calendar.static}get week(){return this.static.weekdays}get months(){return this.static.months}get events(){return this.calendar.events}display(){return e(this,void 0,void 0,(function*(){this.contentEl.empty(),this.contentEl.createEl("h3",{text:this.editing?"Edit Calendar":"New Calendar"});const e=this.contentEl.createDiv("fantasy-calendar-apply-preset");new t.Setting(e).setName("Apply Preset").setDesc("Apply a common fantasy calendar as a preset.").addButton((e=>{e.setCta().setButtonText("Choose Preset").onClick((()=>{const e=new oo(this.app);e.onClose=()=>{var t;if(e.saved){if("Gregorian Calendar"==(null===(t=e.preset)||void 0===t?void 0:t.name)){const t=new Date;e.preset.current={year:t.getFullYear(),month:t.getMonth(),day:t.getDate()}}this.calendar=Object.assign(Object.assign({},e.preset),{id:this.calendar.id}),this.display()}},e.open()}))})),this.uiEl=this.contentEl.createDiv("fantasy-calendar-ui"),this.buttonsEl=this.contentEl.createDiv("fantasy-context-buttons"),this.buildButtons(),this.infoEl=this.uiEl.createDiv("calendar-info"),this.buildInfo(),this.weekdayEl=this.uiEl.createDiv(),this.buildWeekdays(),this.monthEl=this.uiEl.createDiv("fantasy-calendar-element"),this.buildMonths(),this.yearEl=this.uiEl.createDiv("fantasy-calendar-element"),this.buildYear(),this.leapdayEl=this.uiEl.createDiv("fantasy-calendar-element"),this.buildLeapDays(),this.eventEl=this.uiEl.createDiv("fantasy-calendar-element"),this.buildEvents(),this.categoryEl=this.uiEl.createDiv("fantasy-calendar-element"),this.buildCategories(),this.moonEl=this.uiEl.createDiv("fantasy-calendar-element"),this.buildMoons()}))}buildInfo(){this.infoEl.empty(),this.infoDetailEl=this.infoEl.createEl("details",{attr:{open:!0}}),this.infoDetailEl.createEl("summary").createEl("h4",{text:"Basic Info"}),new t.Setting(this.infoDetailEl).setName("Calendar Name").addText((e=>{e.setValue(this.calendar.name).onChange((e=>this.calendar.name=e))}));const e=this.infoDetailEl.createDiv("calendar-description");e.createEl("label",{text:"Calendar Description"}),new t.TextAreaComponent(e).setPlaceholder("Calendar Description").setValue(this.calendar.description).onChange((e=>{this.calendar.description=e})),new t.Setting(this.infoDetailEl).setName("Auto Increment Day").setDesc("Automatically increment the calendar day every real day.").addToggle((e=>{e.setValue(this.static.incrementDay).onChange((e=>{this.static.incrementDay=e}))})),this.dateFieldEl=this.infoDetailEl.createDiv("fantasy-calendar-date-fields"),this.buildDateFields()}buildDateFields(){var e,n,a,r,i,o;this.dateFieldEl.empty(),null==this.tempCurrentDays&&this.calendar.current.day&&(this.tempCurrentDays=this.calendar.current.day),null!=this.tempCurrentDays&&null!=this.calendar.current.month&&this.tempCurrentDays>(null===(e=this.calendar.static.months[this.calendar.current.month])||void 0===e?void 0:e.length)&&(this.tempCurrentDays=null===(n=this.calendar.static.months[this.calendar.current.month])||void 0===n?void 0:n.length);const s=this.dateFieldEl.createDiv("fantasy-calendar-date-field");s.createEl("label",{text:"Day"});const l=new t.TextComponent(s).setPlaceholder("Day").setValue(`${this.tempCurrentDays}`).setDisabled(null==this.calendar.current.month).onChange((e=>{var n,a;if(Number(e)<1||(null!==(a=Number(e)>(null===(n=this.calendar.static.months[this.calendar.current.month])||void 0===n?void 0:n.length))&&void 0!==a?a:1/0))return new t.Notice(`The current day must be between 1 and ${this.calendar.static.months[this.calendar.current.month].length}`),this.tempCurrentDays=this.calendar.current.day,void this.buildDateFields();this.tempCurrentDays=Number(e)}));l.inputEl.setAttr("type","number");const c=this.dateFieldEl.createDiv("fantasy-calendar-date-field");c.createEl("label",{text:"Month"}),new t.DropdownComponent(c).addOptions(Object.fromEntries([["select","Select Month"],...this.calendar.static.months.map((e=>[e.name,e.name]))])).setValue(null!=this.calendar.current.month?this.calendar.static.months[this.calendar.current.month].name:"select").onChange((e=>{"select"===e&&(this.calendar.current.month=null);const t=this.calendar.static.months.find((t=>t.name==e));this.calendar.current.month=this.calendar.static.months.indexOf(t),this.buildDateFields()}));const d=this.dateFieldEl.createDiv("fantasy-calendar-date-field");if(d.createEl("label",{text:"Year"}),this.calendar.static.useCustomYears){const e=new t.DropdownComponent(d);(null!==(a=this.calendar.static.years)&&void 0!==a?a:[]).forEach((t=>{e.addOption(t.id,t.name)})),this.calendar.current.year>(null===(r=this.calendar.static.years)||void 0===r?void 0:r.length)&&(this.calendar.current.year=this.calendar.static.years?this.calendar.static.years.length:null),e.setValue(null===(o=null===(i=this.calendar.static.years)||void 0===i?void 0:i[this.calendar.current.year-1])||void 0===o?void 0:o.id).onChange((e=>{this.calendar.current.year=this.calendar.static.years.findIndex((t=>t.id==e))+1}))}else new t.TextComponent(d).setPlaceholder("Year").setValue(`${this.calendar.current.year}`).onChange((e=>{this.calendar.current.year=Number(e)})).inputEl.setAttr("type","number")}buildWeekdays(){this.weekdayEl.empty();const e=new ua({target:this.weekdayEl,props:{weekdays:this.week,firstWeekday:this.calendar.static.firstWeekDay,overflow:this.calendar.static.overflow}});e.$on("weekday-update",(t=>{this.calendar.static.weekdays=t.detail,!this.calendar.static.firstWeekDay&&this.calendar.static.weekdays.length&&(this.calendar.static.firstWeekDay=0,e.$set({firstWeekday:this.calendar.static.firstWeekDay})),this.checkCanSave()})),e.$on("first-weekday-update",(e=>{this.calendar.static.firstWeekDay=e.detail})),e.$on("overflow-update",(t=>{this.calendar.static.overflow=t.detail,this.calendar.static.overflow||(this.calendar.static.firstWeekDay=0),e.$set({firstWeekday:this.calendar.static.firstWeekDay})}))}buildMonths(){this.monthEl.empty(),new Ca({target:this.monthEl,props:{months:this.months}}).$on("month-update",(e=>{this.calendar.static.months=e.detail,this.buildDateFields(),this.checkCanSave()}))}buildYear(){this.yearEl.empty();const e=new pr({target:this.yearEl,props:{useCustomYears:this.static.useCustomYears,years:this.static.years,app:this.app}});e.$on("years-update",(e=>{this.calendar.static.years=e.detail,this.buildDateFields(),this.buildEvents()})),e.$on("use-custom-update",(e=>{this.calendar.static.useCustomYears=e.detail,this.buildDateFields(),this.buildEvents()}))}buildLeapDays(){this.leapdayEl.empty();const t=new Ji({target:this.leapdayEl,props:{leapdays:this.static.leapDays}});t.$on("new-item",(n=>e(this,void 0,void 0,(function*(){const e=new eo(this.app,this.calendar,n.detail);e.onClose=()=>{if(e.saved){if(e.editing){const t=this.calendar.static.moons.indexOf(this.calendar.static.moons.find((t=>t.id===e.leapday.id)));this.calendar.static.leapDays.splice(t,1,Object.assign({},e.leapday))}else this.calendar.static.leapDays.push(Object.assign({},e.leapday));t.$set({leapdays:this.calendar.static.leapDays}),this.plugin.saveCalendar()}},e.open()})))),t.$on("edit-leapdays",(e=>{this.calendar.static.leapDays=e.detail}))}buildEvents(){this.eventEl.empty(),this.eventsUI=new Pa({target:this.eventEl,props:{events:this.events,months:this.calendar.static.months,categories:this.calendar.categories}}),this.eventsUI.$on("new-item",(t=>e(this,void 0,void 0,(function*(){const e=new Ti(this.app,this.calendar,t.detail);e.onClose=()=>{if(e.saved){if(e.editing){const t=this.calendar.events.indexOf(this.calendar.events.find((t=>t.id===e.event.id)));this.calendar.events.splice(t,1,Object.assign({},e.event))}else this.calendar.events.push(Object.assign({},e.event));this.eventsUI.$set({events:this.events}),this.plugin.saveCalendar()}},e.open()})))),this.eventsUI.$on("edit-events",(e=>{this.calendar.events=e.detail})),this.eventEl.setAttr("style",`--event-max-width: ${this.eventEl.getBoundingClientRect().width}px;`)}buildCategories(){this.categoryEl.empty();const e=new tr({target:this.categoryEl,props:{categories:this.calendar.categories}});e.$on("new",(e=>{this.calendar.categories.push(e.detail),this.eventsUI.$set({categories:this.calendar.categories})})),e.$on("update",(e=>{const t=this.calendar.categories.find((t=>t.id==e.detail.id));this.calendar.categories.splice(this.calendar.categories.indexOf(t),1,e.detail),this.eventsUI.$set({categories:this.calendar.categories,events:this.events})})),e.$on("delete",(e=>{this.calendar.categories.splice(this.calendar.categories.indexOf(e.detail),1),this.eventsUI.$set({categories:this.calendar.categories,events:this.events})}))}buildMoons(){var t;this.moonEl.empty(),this.static.displayMoons=null===(t=this.static.displayMoons)||void 0===t||t;const n=new _i({target:this.moonEl,props:{moons:this.static.moons,displayMoons:this.static.displayMoons}});n.$on("display-toggle",(e=>{this.static.displayMoons=e.detail,n.$set({displayMoons:this.static.displayMoons})})),n.$on("new-item",(t=>e(this,void 0,void 0,(function*(){const e=new Xi(this.app,this.calendar,t.detail);e.onClose=()=>{if(e.saved){if(e.editing){const t=this.calendar.static.moons.indexOf(this.calendar.static.moons.find((t=>t.id===e.moon.id)));this.calendar.static.moons.splice(t,1,Object.assign({},e.moon))}else this.calendar.static.moons.push(Object.assign({},e.moon));n.$set({moons:this.calendar.static.moons}),this.plugin.saveCalendar()}},e.open()})))),n.$on("edit-moons",(e=>{this.calendar.static.moons=e.detail}))}checkCanSave(){var e,t,n,a,r,i,o,s,l;(null===(e=this.months)||void 0===e?void 0:e.length)&&(null===(t=this.months)||void 0===t?void 0:t.every((e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.length})))&&(null===(n=this.months)||void 0===n?void 0:n.every((e=>e.length>0)))&&(null===(a=this.week)||void 0===a?void 0:a.length)&&(null===(r=this.week)||void 0===r?void 0:r.every((e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.length})))&&(null===(i=this.calendar.name)||void 0===i?void 0:i.length)&&this.calendar.static.firstWeekDay<(null!==(s=null===(o=this.week)||void 0===o?void 0:o.length)&&void 0!==s?s:1/0)&&(!this.calendar.static.useCustomYears||this.calendar.static.useCustomYears&&(null===(l=this.calendar.static.years)||void 0===l?void 0:l.length)&&this.calendar.static.years.every((e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.length})))&&(this.canSave=!0)}buildButtons(){this.buttonsEl.empty(),new t.ButtonComponent(this.buttonsEl).setCta().setButtonText(this.editing?"Save":"Create").onClick((()=>{var e,n;this.canSave||this.checkCanSave(),this.canSave?(this.calendar.current.day=this.tempCurrentDays,this.saved=!0,this.close()):(null===(e=this.calendar.name)||void 0===e?void 0:e.length)?this.week.length?this.week.every((e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.length}))?this.months.length?this.months.every((e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.length}))?this.months.every((e=>e.length))?this.calendar.static.useCustomYears&&!(null===(n=this.calendar.static.years)||void 0===n?void 0:n.length)?new t.Notice("Custom years must be defined."):this.calendar.static.useCustomYears&&!this.calendar.static.years.every((e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.length}))?new t.Notice("Each custom year must be named."):this.calendar.static.firstWeekDay>=this.week.length&&new t.Notice("The first day of the week must be a valid weekday."):new t.Notice("Every month must have a length."):new t.Notice("Every month must have a name."):new t.Notice("At least one month is required."):new t.Notice("Every weekday must have a name."):new t.Notice("At least one weekday is required."):new t.Notice("The calendar name is required!")})),new t.ExtraButtonComponent(this.buttonsEl).setTooltip("Cancel").setIcon("cross").onClick((()=>this.close()))}onOpen(){this.display()}}class oo extends t.Modal{onOpen(){return e(this,void 0,void 0,(function*(){yield this.display()}))}display(){return e(this,void 0,void 0,(function*(){this.containerEl.addClass("fantasy-calendar-choose-preset"),this.contentEl.empty(),this.contentEl.createEl("h3",{text:"Choose a Preset Calendar"});const e=this.contentEl.createDiv("fantasy-calendar-preset-container");for(const n of m){const a=new t.ButtonComponent(e).onClick((()=>{this.preset=n,this.display()}));this.preset==n&&a.setCta(),a.buttonEl.createDiv({cls:"setting-item-name",text:n.name}),a.buttonEl.createDiv({cls:"setting-item-description",text:n.description})}const n=this.contentEl.createDiv("fantasy-calendar-confirm-buttons");new t.ButtonComponent(n).setButtonText("Apply").onClick((()=>{this.saved=!0,this.close()})).setCta(),new t.ExtraButtonComponent(n).setIcon("cross").onClick((()=>{this.close()}))}))}}class so{constructor(e,t,n,a){this.data=e,this.number=t,this.year=n,this.calendar=a,this.days=[],this.leapDays=[],this.leapDays=this.calendar.leapDaysForMonth(this,n),this.days=[...new Array(e.length+this.leapDays.length).keys()].map((e=>new lo(this,e+1)))}get id(){return this.data.id}get index(){return this.calendar.data.months.indexOf(this.data)}get name(){return this.data.name}get length(){return this.days.length}get daysBefore(){return this.calendar.daysBeforeMonth(this)}get firstWeekday(){return this.calendar.data.overflow?this.days[0].weekday:0}get lastWeekday(){return this.days[this.days.length-1].weekday}get type(){return this.data.type}}class lo{constructor(e,t){this.month=e,this.number=t}get calendar(){return this.month.calendar}get date(){return{day:this.number,month:this.month.number,year:this.year}}get events(){return this.calendar.getEventsOnDate(this.date)}get longDate(){return{day:this.number,month:this.month.name,year:this.year}}get daysBefore(){return this.month.daysBefore+this.number-1}get year(){return this.month.year}get weekday(){const e=this.calendar.firstDayOfYear(this.year);return l(this.daysBefore%this.calendar.weekdays.length+e,this.calendar.weekdays.length)}get isCurrentDay(){return this.number==this.calendar.current.day&&this.month.number==this.calendar.current.month&&this.month.year==this.calendar.current.year}get isDisplaying(){return this.number==this.calendar.viewing.day&&this.calendar.displayed.year==this.calendar.viewing.year&&this.calendar.displayed.month==this.calendar.viewing.month}get moons(){return this.calendar.getMoonsForDate(this.date)}}class co extends t.Events{constructor(e,t){super(),this.object=e,this.plugin=t,this.displayed={year:null,month:null,day:null},this.viewing={year:null,month:null,day:null},this.displayed=Object.assign({},this.current),this.update(this.object)}getNameForYear(e){var t;return this.data.useCustomYears?this.data.useCustomYears&&e-1>=0&&e<=(null===(t=this.data.years)||void 0===t?void 0:t.length)?this.data.years[e-1].name:void 0:`${e}`}get displayWeeks(){return this.object.displayWeeks}getMonthsForYear(e){return this.data.months.map(((t,n)=>new so(t,n,e,this)))}update(e){this.object=null!=e?e:this.object,this.maxDays=Math.max(...this.data.months.map((e=>e.length))),this.trigger("month-update"),this.trigger("day-update")}get data(){return this.object.static}get current(){return this.object.current}get leapdays(){return this.data.leapDays}getEventsOnDate(e){const t=this.object.events.filter((t=>{if(!t.date.day)return!1;t.end||(t.end=Object.assign({},t.date));const n=Object.assign({},t.date),a=Object.assign({},t.end);if(null==n.month&&(a.month=n.month=e.month),null==n.year&&(a.year=n.year=e.year),n.year!=e.year&&a.year!=e.year)return!1;const r=this.daysBeforeDate(n),i=this.daysBeforeDate(e);if(a.year>e.year)return i>=r;const o=this.daysBeforeDate(a);return i>=r&&o>=i}));return t.sort(((e,t)=>e.end?t.end?this.areDatesEqual(e.date,t.date)?this.daysBeforeDate(t.end)-this.daysBeforeDate(e.end):this.daysBeforeDate(e.date)-this.daysBeforeDate(t.date):-1:0)),t}get currentDate(){return h(this.current,this.data.months)}get displayedDate(){return h(this.displayed,this.data.months)}get viewedDate(){return h(this.viewing,this.data.months)}reset(){this.displayed=Object.assign({},this.current),this.viewing=Object.assign({},this.current),this.trigger("month-update"),this.trigger("day-update")}setCurrentMonth(e){this.displayed.month=e,this.trigger("month-update")}goToNextDay(){this.viewing.day+=1;const e=this.getMonth(this.displayed.month,this.displayed.year);this.viewing.day>e.days.length&&(this.goToNext(),this.viewing.month=this.displayed.month,this.viewing.year=this.displayed.year,this.viewing.day=1),this.trigger("day-update")}goToNextCurrentDay(){this.current.day+=1;const e=this.getMonth(this.current.month,this.current.year);this.current.day>=e.days.length&&(this.current.day=1,this.current.month+=1,this.current.month>=this.data.months.length&&(this.current.month=0,this.current.year+=1)),this.trigger("day-update")}get nextMonthIndex(){return l(this.displayed.month+1,this.data.months.length)}get nextMonth(){return this.getMonth(this.displayed.month+1,this.displayed.year)}canGoToNextYear(e=this.displayed.year){return!this.data.useCustomYears||ethis.displayed.month){if(1==this.displayed.year)return void new t.Notice("This is the earliest year.");this.goToPreviousYear()}this.setCurrentMonth(this.prevMonthIndex)}goToPreviousDay(){this.viewing.day-=1,this.viewing.day<1&&(this.goToPrevious(),this.viewing.month=this.displayed.month,this.viewing.year=this.displayed.year,this.viewing.day=this.currentMonth.days.length),this.trigger("day-update")}goToPreviousYear(){this.displayed.year-=1,this.trigger("year-update")}get weekdays(){return this.data.weekdays}get currentMonth(){return this.getMonth(this.displayed.month,this.displayed.year)}leapDaysForYear(e){return this.leapdays.filter((t=>t.interval.sort(((e,t)=>e.interval-t.interval)).some((({interval:t,exclusive:n},a,r)=>n&&0==a?e%t!=0:n?void 0:r[a+1]&&r[a+1].exclusive?e%t==0&&e%r[a+1].interval!=0:e%t==0))))}leapDaysForMonth(e,t=this.displayed.year){return this.leapdays.filter((t=>t.timespan==e.number)).filter((e=>e.interval.sort(((e,t)=>e.interval-t.interval)).some((({interval:e,exclusive:n},a,r)=>n&&0==a?t%e!=0:n?void 0:r[a+1]&&r[a+1].exclusive?t%e==0&&t%r[a+1].interval!=0:t%e==0))))}getMonth(e,t,n=0){const a=this.data.months;let r=l(e,a.length);return e<0&&(t-=1),0==t?null:(e>=a.length&&(t+=1),"intercalary"==a[r].type&&0!=n?this.getMonth(e+n,t,n):new so(a[r],r,t,this))}getPaddedDaysForMonth(e){let t=e.days,n=[];const a=this.getMonth(e.index-1,this.displayed.year,-1);e.firstWeekday>0&&"month"==e.type&&(n=null!=a?a.days.slice(-e.firstWeekday):Array(e.firstWeekday).fill(null));let r=[];const i=this.getMonth(e.index+1,this.displayed.year,1);return e.lastWeekday"month"===e.type)).reduce(((e,t)=>e+t.length),0)}daysBeforeMonth(e,t=!1){if(0==e.number)return 0;const n=this.getMonthsForYear(e.year),a=t?n:n.filter((e=>"month"==e.type)),r=a.find((t=>t.data.id==e.data.id));return a.slice(0,a.indexOf(r)).reduce(((e,t)=>e+t.length),0)}areDatesEqual(e,t){return!(e.day!=t.day||e.month!=t.month&&null!=e.month&&null!=t.month||e.year!=t.year&&null!=e.year&&null!=t.year)}daysBeforeDate(e){return this.daysBeforeYear(e.year)+this.daysBeforeMonth(this.getMonth(e.month,e.year),!0)+e.day}get firstWeekday(){return this.data.firstWeekDay}get leapDaysBefore(){return 1==this.displayed.year?0:[...Array(this.displayed.year-1).keys()].map((e=>this.leapDaysForYear(e+1))).reduce(((e,t)=>e+t.length),0)}leapDaysBeforeYear(e){return 1==e?0:[...Array(e-1).keys()].map((e=>this.leapDaysForYear(e+1))).reduce(((e,t)=>e+t.length),0)}get daysBefore(){return this.daysBeforeYear(this.displayed.year)}get totalDaysBefore(){return this.daysBefore+this.leapDaysBefore}daysBeforeYear(e){return e<1?0:Math.abs(e-1)*this.daysPerYear}totalDaysBeforeYear(e){return e<1?0:Math.abs(e-1)*this.data.months.filter((e=>"month"==e.type)).reduce(((e,t)=>e+t.length),0)+this.leapDaysBeforeYear(e)}firstDayOfYear(e=this.displayed.year){var t;return this.data.overflow?1==e?this.firstWeekday:l(this.totalDaysBeforeYear(e)%this.data.weekdays.length+this.firstWeekday+(null!==(t=this.data.offset)&&void 0!==t?t:0),this.data.weekdays.length):0}get moons(){return this.data.moons}getMoonsForDate(e){const t=[],n=this.getMonth(e.month,e.year),a=n.days[e.day-1],r=this.totalDaysBeforeYear(e.year)+this.daysBeforeMonth(n,!0)+a.number-1;for(let e of this.moons){const{offset:n,cycle:a}=e,i=24;let o=(r-n)/a;const s=(o-Math.floor(o))*i%i,c=Ua[i];t.push([e,c[l(Math.round(s),c.length)]])}return t}}const uo=[];function ho(e,t=g){let n;const a=new Set;function r(t){if(D(e,t)&&(e=t,n)){const t=!uo.length;for(const t of a)t[1](),uo.push(t,e);if(t){for(let e=0;e{a.delete(s),0===a.size&&(n(),n=null)}}}}function fo(e){R(e,"svelte-1e1nyi2",".flag.svelte-1e1nyi2.svelte-1e1nyi2{cursor:pointer;position:relative;padding-left:0.125rem;text-align:left;width:100%;background-color:var(--hex-alpha);border-left:2px solid var(--color)}.flag-content.svelte-1e1nyi2.svelte-1e1nyi2{display:flex;gap:0.25rem;align-items:flex-start;justify-content:space-between}.day-view.svelte-1e1nyi2 .flag-content.svelte-1e1nyi2{justify-content:space-between}.clamp.svelte-1e1nyi2.svelte-1e1nyi2{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;word-break:keep-all;overflow:hidden;text-overflow:ellipsis}.note.svelte-1e1nyi2.svelte-1e1nyi2{display:flex;align-self:center}.multi.svelte-1e1nyi2.svelte-1e1nyi2{flex-shrink:0;overflow:visible;width:unset}.multi.svelte-1e1nyi2 .clamp.svelte-1e1nyi2{-webkit-line-clamp:1;overflow:visible}.multi.start.svelte-1e1nyi2.svelte-1e1nyi2{margin-left:0}.multi.end.svelte-1e1nyi2.svelte-1e1nyi2{margin-right:0}.multi.first.svelte-1e1nyi2.svelte-1e1nyi2{overflow:visible;white-space:nowrap}.multi.svelte-1e1nyi2.svelte-1e1nyi2:not(.first){color:transparent;overflow:hidden}.multi.svelte-1e1nyi2.svelte-1e1nyi2:not(.start){border:0;margin-left:-6px}.multi.svelte-1e1nyi2.svelte-1e1nyi2:not(.end){margin-right:-6px}.start.svelte-1e1nyi2>.flag-content.svelte-1e1nyi2{justify-content:flex-start;gap:1em}")}function po(e){let t,n,a,r;return{c(){t=H("div"),K(t,"class","note svelte-1e1nyi2")},m(i,o){V(i,t,o),a||(r=M(n=e[9].call(null,t)),a=!0)},d(e){e&&P(t),a=!1,r()}}}function mo(e){let t,n,a,r,i,o,s,l,c=e[0].name+"",d=e[0].note&&po(e);return{c(){t=H("div"),n=H("div"),a=H("span"),r=U(c),i=z(),d&&d.c(),K(a,"class","svelte-1e1nyi2"),ae(a,"clamp",!e[1]),ae(a,"day-view",e[1]),K(n,"class","flag-content svelte-1e1nyi2"),K(t,"class","flag svelte-1e1nyi2"),K(t,"aria-label",o=e[1]?null:e[0].name),ee(t,"--hex-alpha",e[6]+"40"),ee(t,"--color",e[6]),ae(t,"multi",e[4]),ae(t,"start",e[2]),ae(t,"end",e[3]),ae(t,"first",e[5]),ae(t,"day-view",e[1])},m(o,c){V(o,t,c),L(t,n),L(n,a),L(a,r),L(n,i),d&&d.m(n,null),s||(l=[Z(t,"click",e[14]),Z(t,"mouseover",e[15]),Z(t,"focus",go),Z(t,"contextmenu",e[16])],s=!0)},p(e,[i]){1&i&&c!==(c=e[0].name+"")&&J(r,c),2&i&&ae(a,"clamp",!e[1]),2&i&&ae(a,"day-view",e[1]),e[0].note?d||(d=po(e),d.c(),d.m(n,null)):d&&(d.d(1),d=null),3&i&&o!==(o=e[1]?null:e[0].name)&&K(t,"aria-label",o),64&i&&ee(t,"--hex-alpha",e[6]+"40"),64&i&&ee(t,"--color",e[6]),16&i&&ae(t,"multi",e[4]),4&i&&ae(t,"start",e[2]),8&i&&ae(t,"end",e[3]),32&i&&ae(t,"first",e[5]),2&i&&ae(t,"day-view",e[1])},i:g,o:g,d(e){e&&P(t),d&&d.d(),s=!1,w(l)}}}const go=()=>{};function yo(e,n,a){var r,i,o,s;const l=he();let{event:c}=n,{date:d}=n,{dayView:u=!1}=n,h=!1,f=!1,p=!1,m=!1,{categories:g}=n,y=null!==(i=null===(r=g.find((e=>e.id==c.category)))||void 0===r?void 0:r.color)&&void 0!==i?i:Ga;const v=t.Platform.isMacOS?"Meta":"Control";return e.$$set=e=>{"event"in e&&a(0,c=e.event),"date"in e&&a(10,d=e.date),"dayView"in e&&a(1,u=e.dayView),"categories"in e&&a(11,g=e.categories)},e.$$.update=()=>{1039&e.$$.dirty&&(null==c.end||u||(a(4,h=!0),a(2,f=!(d.day!==c.date.day||null!=c.date.month&&d.month!=c.date.month||null!=c.date.year&&d.year!==c.date.year)),a(5,m=f||1==d.day),a(3,p=!(d.day!==c.end.day||null!=c.end.month&&d.month!=c.end.month||null!=c.end.year&&d.year!==c.end.year)),f&&p&&(a(4,h=!1),a(2,f=!1),a(3,p=!1)))),14337&e.$$.dirty&&a(6,y=null!==a(13,s=null===a(12,o=g.find((e=>e.id==c.category)))||void 0===o?void 0:o.color)&&void 0!==s?s:Ga)},[c,u,f,p,h,m,y,l,v,e=>{(0,t.setIcon)(e,"note-glyph")},d,g,o,s,e=>{e.stopPropagation(),l("event-click",{event:c,modifier:e.getModifierState(v)})},e=>l("event-mouseover",{target:e.target,event:c}),e=>{e.stopPropagation(),l("event-context",{evt:e,event:c})}]}const vo=class extends Ge{constructor(e){super(),Pe(this,e,yo,mo,D,{event:0,date:10,dayView:1,categories:11},fo)}};function bo(e){R(e,"svelte-qnut28",".flags-container.svelte-qnut28{height:100%}.flag-container.svelte-qnut28{display:flex;flex-flow:column nowrap;gap:0.25rem}.overflow.svelte-qnut28{color:var(--text-muted);display:flex;justify-content:flex-end;width:100%}")}function wo(e){let t,n,a;return{c(){t=H("span"),n=U("+"),a=U(e[2])},m(e,r){V(e,t,r),L(t,n),L(t,a)},p(e,t){4&t&&J(a,e[2])},d(e){e&&P(t)}}}function xo(e){let t,n,a,r,i=e[2]>0&&wo(e);return{c(){t=H("div"),n=H("div"),a=z(),r=H("div"),i&&i.c(),K(n,"class","flag-container svelte-qnut28"),K(r,"class","overflow svelte-qnut28"),K(t,"class","flags-container svelte-qnut28")},m(o,s){V(o,t,s),L(t,n),e[8](n),L(t,a),L(t,r),i&&i.m(r,null),e[9](t)},p(e,[t]){e[2]>0?i?i.p(e,t):(i=wo(e),i.c(),i.m(r,null)):i&&(i.d(1),i=null)},i:g,o:g,d(n){n&&P(t),e[8](null),i&&i.d(),e[9](null)}}}function Do(t,n,a){let r,i,{events:o=[]}=n,{categories:s}=n,{dayView:l=!1}=n,{date:c}=n,{calendar:d}=n,u=0;const h=he(),f=()=>e(void 0,void 0,void 0,(function*(){if(a(2,u=0),o.length&&r&&i){i.empty();const e=r.getBoundingClientRect().height;let t=e;for(const n of o){const r=new vo({target:i,props:{event:n,categories:s,dayView:l,date:c}});if(r.$on("event-click",(e=>h("event-click",e.detail))),r.$on("event-mouseover",(e=>h("event-mouseover",e.detail))),r.$on("event-context",(e=>h("event-context",e.detail))),t=e-i.getBoundingClientRect().height,!l){if(t<0){i.lastElementChild.detach(),a(2,u=o.length-o.indexOf(n));break}if(0==t){a(2,u=o.length-o.indexOf(n)-1);break}}}}}));return d.on("view-resized",(()=>{l||f()})),ue(f),t.$$set=e=>{"events"in e&&a(3,o=e.events),"categories"in e&&a(4,s=e.categories),"dayView"in e&&a(5,l=e.dayView),"date"in e&&a(6,c=e.date),"calendar"in e&&a(7,d=e.calendar)},t.$$.update=()=>{8&t.$$.dirty&&a(3,o),11&t.$$.dirty&&o&&r&&i&&f()},[r,i,u,o,s,l,c,d,function(e){ye[e?"unshift":"push"]((()=>{i=e,a(1,i)}))},function(e){ye[e?"unshift":"push"]((()=>{r=e,a(0,r)}))}]}const ko=class extends Ge{constructor(e){super(),Pe(this,e,Do,xo,D,{events:3,categories:4,dayView:5,date:6,calendar:7},bo)}};function Eo(e){R(e,"svelte-5je88v",".day-view.svelte-5je88v{padding:5px 15px;display:flex;flex-flow:column nowrap;gap:0.5rem}.nav.svelte-5je88v,.date.svelte-5je88v{display:flex;justify-content:space-between;align-items:center}.left-nav.svelte-5je88v{display:flex}.left-nav.svelte-5je88v .clickable-icon{margin-right:0}.calendar-clickable.svelte-5je88v{align-items:center;cursor:pointer;display:flex;justify-content:center}h3.svelte-5je88v{margin:0}.day-view.svelte-5je88v .flag-container > .flag{padding-left:0.5rem}")}function Co(e,t,n){const a=e.slice();return a[22]=t[n][0],a[23]=t[n][1],a}function Ao(e){let t,n,a=e[3],r=[];for(let t=0;tOe(r[e],1,1,(()=>{r[e]=null}));return{c(){t=H("div");for(let e=0;e{I=null})),Fe());const a={};16&n&&(a.events=e[4]),64&n&&(a.categories=e[6]),4&n&&(a.date=e[2]),1&n&&(a.calendar=e[0]),T.$set(a)},i(e){S||(Ne(I),Ne(T.$$.fragment,e),S=!0)},o(e){Oe(I),Oe(T.$$.fragment,e),S=!1},d(e){e&&P(t),I&&I.d(),Ve(T),$=!1,w(q)}}}function $o(e,n,a){let r,i,o,s,l,c,d;pe("calendar").subscribe((e=>{a(0,c=e)})),pe("displayMoons").subscribe((e=>a(1,d=e))),c.on("day-update",(()=>{a(2,i=c.viewing),a(5,r=c.viewedDate),a(4,o=c.getEventsOnDate(c.viewing)),a(3,s=c.getMoonsForDate(c.viewing))}));const u=he();return e.$$.update=()=>{1&e.$$.dirty&&a(5,r=c.viewedDate),1&e.$$.dirty&&a(2,i=c.viewing),1&e.$$.dirty&&a(4,o=c.getEventsOnDate(c.viewing)),1&e.$$.dirty&&a(3,s=c.getMoonsForDate(c.viewing)),1&e.$$.dirty&&a(6,l=c.object.categories)},[c,d,i,s,o,r,l,u,e=>{new t.ExtraButtonComponent(e).setIcon("cross").setTooltip("Close")},e=>{new t.ExtraButtonComponent(e).setIcon("fantasy-calendar-reveal").setTooltip("Show on Calendar").onClick((()=>{a(0,c.displayed.year=c.viewing.year,c),c.setCurrentMonth(c.viewing.month)}))},e=>{new t.ExtraButtonComponent(e).setIcon("plus-with-circle").setTooltip("New Event").onClick((()=>u("event",i)))},e=>{new t.ExtraButtonComponent(e).setIcon("left-arrow")},e=>{new t.ExtraButtonComponent(e).setIcon("right-arrow")},()=>u("reveal"),()=>u("close"),()=>c.goToPreviousDay(),()=>c.goToNextDay(),function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)}]}const Mo=class extends Ge{constructor(e){super(),Pe(this,e,$o,So,D,{},Eo)}};function qo(e){R(e,"svelte-1gou5hh",".dot.svelte-1gou5hh{display:inline-block;min-height:6px;min-width:6px;height:6px;width:6px;margin:0 2px}.active.svelte-1gou5hh{color:var(--text-on-accent)}")}function Io(e){let t,n,a,r;return{c(){t=W("svg"),n=W("circle"),K(n,"stroke",a=e[2]??"currentColor"),K(n,"fill",r=e[2]??"currentColor"),K(n,"cx","3"),K(n,"cy","3"),K(n,"r","2"),K(t,"class","dot svelte-1gou5hh"),K(t,"viewBox","0 0 6 6"),K(t,"xmlns","http://www.w3.org/2000/svg"),ae(t,"filled",e[0]),ae(t,"active",e[1])},m(e,a){V(e,t,a),L(t,n)},p(e,[i]){4&i&&a!==(a=e[2]??"currentColor")&&K(n,"stroke",a),4&i&&r!==(r=e[2]??"currentColor")&&K(n,"fill",r),1&i&&ae(t,"filled",e[0]),2&i&&ae(t,"active",e[1])},i:g,o:g,d(e){e&&P(t)}}}function Fo(e,t,n){let{isFilled:a=!0}=t,{isActive:r=!1}=t,{color:i}=t;return e.$$set=e=>{"isFilled"in e&&n(0,a=e.isFilled),"isActive"in e&&n(1,r=e.isActive),"color"in e&&n(2,i=e.color)},[a,r,i]}const No=class extends Ge{constructor(e){super(),Pe(this,e,Fo,Io,D,{isFilled:0,isActive:1,color:2},qo)}};function Oo(e){R(e,"svelte-2o3rj3",".dots-container.svelte-2o3rj3{width:100%}.dot-container.svelte-2o3rj3{display:flex;flex-flow:row nowrap;width:fit-content;margin:auto;line-height:6px;min-height:6px}.centered.svelte-2o3rj3{justify-content:center;align-items:center}.overflow.svelte-2o3rj3{color:var(--text-muted);font-size:xx-small;display:flex;justify-content:flex-end;width:100%}")}function Bo(e){let t,n,a;return{c(){t=H("span"),n=U("+"),a=U(e[2])},m(e,r){V(e,t,r),L(t,n),L(t,a)},p(e,t){4&t&&J(a,e[2])},d(e){e&&P(t)}}}function Lo(e){let t,n,a,r,i=e[2]>0&&Bo(e);return{c(){t=H("div"),n=H("div"),a=z(),r=H("div"),i&&i.c(),K(n,"class","dot-container centered svelte-2o3rj3"),K(r,"class","overflow svelte-2o3rj3"),K(t,"class","dots-container svelte-2o3rj3")},m(o,s){V(o,t,s),L(t,n),e[6](n),L(t,a),L(t,r),i&&i.m(r,null),e[7](t)},p(e,[t]){e[2]>0?i?i.p(e,t):(i=Bo(e),i.c(),i.m(r,null)):i&&(i.d(1),i=null)},i:g,o:g,d(n){n&&P(t),e[6](null),i&&i.d(),e[7](null)}}}function Ro(t,n,a){let r,i,{events:o=[]}=n,{categories:s}=n,{calendar:l}=n,c=0;he();const d=()=>e(void 0,void 0,void 0,(function*(){if(a(2,c=0),o.length){i.empty();const e=r.getBoundingClientRect().width;let t=e;for(const n of o){if(new No({target:i,props:{color:u(n)}}),t=e-i.getBoundingClientRect().width,t<0){i.lastElementChild.detach(),a(2,c=o.length-o.indexOf(n));break}if(0==t){a(2,c=o.length-o.indexOf(n)-1);break}}}}));l.on("view-resized",(()=>{r&&i&&d()})),ue(d);const u=e=>{var t;return null===(t=s.find((t=>t.id==e.category)))||void 0===t?void 0:t.color};return t.$$set=e=>{"events"in e&&a(3,o=e.events),"categories"in e&&a(4,s=e.categories),"calendar"in e&&a(5,l=e.calendar)},t.$$.update=()=>{11&t.$$.dirty&&o&&r&&i&&d()},[r,i,c,o,s,l,function(e){ye[e?"unshift":"push"]((()=>{i=e,a(1,i)}))},function(e){ye[e?"unshift":"push"]((()=>{r=e,a(0,r)}))}]}const jo=class extends Ge{constructor(e){super(),Pe(this,e,Ro,Lo,D,{events:3,categories:4,calendar:5},Oo)}};function _o(e){R(e,"svelte-3pptg2",".day.svelte-3pptg2{background-color:transparent;border:2px solid transparent;border-radius:4px;color:var(--color-text-day);cursor:pointer;font-size:0.8em;height:100%;padding:2px;position:relative;text-align:center;vertical-align:baseline;overflow:visible;display:flex;flex-flow:column nowrap}.active.svelte-3pptg2{background-color:var(--background-secondary)}.viewing.svelte-3pptg2{border:2px solid var(--background-modifier-border)}.adjacent-month.svelte-3pptg2{opacity:0.25}")}function Vo(e,t,n){const a=e.slice();return a[20]=t[n][0],a[21]=t[n][1],a}function Po(e){let t,n;return t=new jo({props:{events:e[4],categories:e[9],calendar:e[0].calendar}}),{c(){je(t.$$.fragment)},m(e,a){_e(t,e,a),n=!0},p(e,n){const a={};16&n&&(a.events=e[4]),512&n&&(a.categories=e[9]),1&n&&(a.calendar=e[0].calendar),t.$set(a)},i(e){n||(Ne(t.$$.fragment,e),n=!0)},o(e){Oe(t.$$.fragment,e),n=!1},d(e){Ve(t,e)}}}function Go(e){let t,n,a,r=e[5]&&e[10]&&e[10].length&&Ho(e);return n=new ko({props:{events:e[4],categories:e[9],date:e[8],calendar:e[0].calendar}}),n.$on("event-click",e[12]),n.$on("event-mouseover",e[13]),n.$on("event-context",e[14]),{c(){r&&r.c(),t=z(),je(n.$$.fragment)},m(e,i){r&&r.m(e,i),V(e,t,i),_e(n,e,i),a=!0},p(e,a){e[5]&&e[10]&&e[10].length?r?(r.p(e,a),1056&a&&Ne(r,1)):(r=Ho(e),r.c(),Ne(r,1),r.m(t.parentNode,t)):r&&(Ie(),Oe(r,1,1,(()=>{r=null})),Fe());const i={};16&a&&(i.events=e[4]),512&a&&(i.categories=e[9]),256&a&&(i.date=e[8]),1&a&&(i.calendar=e[0].calendar),n.$set(i)},i(e){a||(Ne(r),Ne(n.$$.fragment,e),a=!0)},o(e){Oe(r),Oe(n.$$.fragment,e),a=!1},d(e){r&&r.d(e),e&&P(t),Ve(n,e)}}}function Ho(e){let t,n,a=e[10],r=[];for(let t=0;tOe(r[e],1,1,(()=>{r[e]=null}));return{c(){t=H("div");for(let e=0;e{p[r]=null})),Fe(),o=p[i],o?o.p(e,n):(o=p[i]=f[i](e),o.c()),Ne(o,1),o.m(t,null)),(!c||2&n&&s!==(s=$(e[1]?"adjacent-month fantasy-adjacent-month":"")+" svelte-3pptg2"))&&K(t,"class",s),(!c||5&n&&l!==(l=!e[2]&&e[0].events.length?`${e[0].events.length} event${1==e[0].events.length?"":"s"}`:void 0))&&K(t,"aria-label",l),2&n&&ae(t,"day",!0),2&n&&ae(t,"fantasy-day",!0),130&n&&ae(t,"active",e[7]&&!e[1]),74&n&&ae(t,"viewing",e[3]&&e[6]&&!e[1])},i(e){c||(Ne(o),c=!0)},o(e){Oe(o),c=!1},d(e){e&&P(t),p[i].d(),d=!1,w(u)}}}function zo(e,t,n){let a,r,i,o,s;const l=he();let c,d,{day:u}=t,{adjacent:h}=t,{fullView:f}=t,p=[];return pe("dayView").subscribe((e=>n(3,c=e))),pe("displayMoons").subscribe((e=>n(5,d=e))),u.calendar.on("month-update",(()=>{n(7,o=u.isCurrentDay),n(6,s=u.isDisplaying)})),u.calendar.on("day-update",(()=>{n(7,o=u.isCurrentDay),n(6,s=u.isDisplaying)})),e.$$set=e=>{"day"in e&&n(0,u=e.day),"adjacent"in e&&n(1,h=e.adjacent),"fullView"in e&&n(2,f=e.fullView)},e.$$.update=()=>{3&e.$$.dirty&&(h||n(4,p=u.events)),1&e.$$.dirty&&n(10,a=u.moons),1&e.$$.dirty&&n(9,r=u.calendar.object.categories),1&e.$$.dirty&&n(8,i=u.date),1&e.$$.dirty&&n(7,o=u.isCurrentDay),1&e.$$.dirty&&n(6,s=u.isDisplaying),8&e.$$.dirty&&n(3,c)},[u,h,f,c,p,d,s,o,i,r,a,l,function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},()=>l("day-click",u),()=>l("day-doubleclick",u),e=>l("day-context-menu",{day:u,evt:e})]}const Yo=class extends Ge{constructor(e){super(),Pe(this,e,zo,Uo,D,{day:0,adjacent:1,fullView:2},_o)}};function Zo(e){R(e,"svelte-1xujcmn",".fantasy-month.svelte-1xujcmn{display:grid;grid-template-columns:repeat(\n var(--calendar-columns),\n var(--column-widths)\n );grid-auto-rows:var(--calendar-rows)}.full-view.svelte-1xujcmn{height:100%;margin-bottom:0.5rem}.month.svelte-1xujcmn{border-radius:1rem;padding:0.25rem}.month-name.svelte-1xujcmn{margin:0}.month.svelte-1xujcmn .fantasy-day.day{padding:0px}")}function Ko(e,t,n){const a=e.slice();return a[16]=t[n],a}function Qo(e,t,n){const a=e.slice();return a[16]=t[n],a}function Jo(e,t,n){const a=e.slice();return a[16]=t[n],a}function Xo(e){let t,n,a=e[1].name+"";return{c(){t=H("h3"),n=U(a),K(t,"class","month-name svelte-1xujcmn")},m(e,a){V(e,t,a),L(t,n)},p(e,t){2&t&&a!==(a=e[1].name+"")&&J(n,a)},d(e){e&&P(t)}}}function es(e){let t;return{c(){t=H("div")},m(e,n){V(e,t,n)},p:g,i:g,o:g,d(e){e&&P(t)}}}function ts(e){let t,n;return t=new Yo({props:{day:e[16],adjacent:!0,fullView:e[3]}}),{c(){je(t.$$.fragment)},m(e,a){_e(t,e,a),n=!0},p(e,n){const a={};256&n&&(a.day=e[16]),8&n&&(a.fullView=e[3]),t.$set(a)},i(e){n||(Ne(t.$$.fragment,e),n=!0)},o(e){Oe(t.$$.fragment,e),n=!1},d(e){Ve(t,e)}}}function ns(e){let t,n,a,r;const i=[ts,es],o=[];function s(e,t){return e[5]&&null!=e[16]?0:1}return t=s(e),n=o[t]=i[t](e),{c(){n.c(),a=Y()},m(e,n){o[t].m(e,n),V(e,a,n),r=!0},p(e,r){let l=t;t=s(e),t===l?o[t].p(e,r):(Ie(),Oe(o[l],1,1,(()=>{o[l]=null})),Fe(),n=o[t],n?n.p(e,r):(n=o[t]=i[t](e),n.c()),Ne(n,1),n.m(a.parentNode,a))},i(e){r||(Ne(n),r=!0)},o(e){Oe(n),r=!1},d(e){o[t].d(e),e&&P(a)}}}function as(e){let t,n;return t=new Yo({props:{day:e[16],adjacent:!1,fullView:e[3]}}),t.$on("day-click",e[10]),t.$on("day-doubleclick",e[11]),t.$on("day-context-menu",e[12]),t.$on("event-click",e[13]),t.$on("event-mouseover",e[14]),t.$on("event-context",e[15]),{c(){je(t.$$.fragment)},m(e,a){_e(t,e,a),n=!0},p(e,n){const a={};128&n&&(a.day=e[16]),8&n&&(a.fullView=e[3]),t.$set(a)},i(e){n||(Ne(t.$$.fragment,e),n=!0)},o(e){Oe(t.$$.fragment,e),n=!1},d(e){Ve(t,e)}}}function rs(e){let t;return{c(){t=H("div")},m(e,n){V(e,t,n)},p:g,i:g,o:g,d(e){e&&P(t)}}}function is(e){let t,n;return t=new Yo({props:{day:e[16],adjacent:!0,fullView:e[3]}}),{c(){je(t.$$.fragment)},m(e,a){_e(t,e,a),n=!0},p(e,n){const a={};64&n&&(a.day=e[16]),8&n&&(a.fullView=e[3]),t.$set(a)},i(e){n||(Ne(t.$$.fragment,e),n=!0)},o(e){Oe(t.$$.fragment,e),n=!1},d(e){Ve(t,e)}}}function os(e){let t,n,a,r;const i=[is,rs],o=[];function s(e,t){return e[5]?0:1}return t=s(e),n=o[t]=i[t](e),{c(){n.c(),a=Y()},m(e,n){o[t].m(e,n),V(e,a,n),r=!0},p(e,r){let l=t;t=s(e),t===l?o[t].p(e,r):(Ie(),Oe(o[l],1,1,(()=>{o[l]=null})),Fe(),n=o[t],n?n.p(e,r):(n=o[t]=i[t](e),n.c()),Ne(n,1),n.m(a.parentNode,a))},i(e){r||(Ne(n),r=!0)},o(e){Oe(n),r=!1},d(e){o[t].d(e),e&&P(a)}}}function ss(e){let t,n,a,r,i=e[8],o=[];for(let t=0;tOe(o[e],1,1,(()=>{o[e]=null}));let l=e[7],c=[];for(let t=0;tOe(c[e],1,1,(()=>{c[e]=null}));let u=e[6],h=[];for(let t=0;tOe(h[e],1,1,(()=>{h[e]=null}));return{c(){t=H("div");for(let e=0;e{"yearView"in e&&n(0,s=e.yearView),"month"in e&&n(1,l=e.month),"columns"in e&&n(2,c=e.columns),"fullView"in e&&n(3,d=e.fullView),"weeks"in e&&n(4,u=e.weeks),"showPad"in e&&n(5,h=e.showPad)},e.$$.update=()=>{2&e.$$.dirty&&n(9,a=l.calendar.getPaddedDaysForMonth(l)),512&e.$$.dirty&&n(8,r=a.previous),2&e.$$.dirty&&n(7,i=l.days),512&e.$$.dirty&&n(6,o=a.next)},[s,l,c,d,u,h,o,i,r,a,function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)}]}const ds=class extends Ge{constructor(e){super(),Pe(this,e,cs,ls,D,{yearView:0,month:1,columns:2,fullView:3,weeks:4,showPad:5},Zo)}};function us(e){R(e,"svelte-1kua7ca",".fantasy-nav.nav.nav.svelte-1kua7ca{padding:10px 0px;margin:0;display:flex;flex-flow:row nowrap;justify-content:space-between;align-items:stretch}.container.svelte-1kua7ca{display:flex;align-items:center}.fantasy-title.svelte-1kua7ca{margin:0;line-height:1.25}.fantasy-right-nav.svelte-1kua7ca{display:flex;justify-content:center;align-items:flex-start}.calendar-clickable.svelte-1kua7ca{align-items:center;cursor:pointer;display:flex;justify-content:center}")}function hs(e){let t,n,a,r,i,o,s,l,c,d,u,h,f,p,m,y,v,b,x,D,k,E,C,A;return{c(){t=H("div"),n=H("h3"),a=H("span"),r=U(e[0]),i=z(),o=H("span"),s=U(e[1]),l=z(),c=H("div"),d=H("div"),u=H("div"),f=z(),p=H("div"),m=H("span"),m.textContent="Today",v=z(),b=H("div"),D=z(),k=H("div"),K(a,"class","fantasy-month month"),K(o,"class","fantasy-year year"),K(n,"class","fantasy-title title svelte-1kua7ca"),K(u,"class","arrow calendar-clickable svelte-1kua7ca"),K(u,"aria-label","Previous Month"),K(p,"class","reset-button calendar-clickable svelte-1kua7ca"),K(p,"aria-label",y="Today is "+e[2]),K(b,"class","arrow right calendar-clickable svelte-1kua7ca"),K(b,"aria-label","Next Month"),K(k,"class","calendar-clickable svelte-1kua7ca"),K(k,"aria-label","Calendar Settings"),K(d,"class","container svelte-1kua7ca"),K(c,"class","right-nav fantasy-right-nav svelte-1kua7ca"),K(t,"class","fantasy-nav nav svelte-1kua7ca")},m(g,y){V(g,t,y),L(t,n),L(n,a),L(a,r),L(n,i),L(n,o),L(o,s),L(t,l),L(t,c),L(c,d),L(d,u),L(d,f),L(d,p),L(p,m),L(d,v),L(d,b),L(d,D),L(d,k),C||(A=[M(h=e[4].call(null,u)),Z(u,"click",e[7]),Z(p,"click",e[8]),M(x=e[5].call(null,b)),Z(b,"click",e[9]),M(E=e[6].call(null,k)),Z(k,"click",e[10])],C=!0)},p(e,[t]){1&t&&J(r,e[0]),2&t&&J(s,e[1]),4&t&&y!==(y="Today is "+e[2])&&K(p,"aria-label",y)},i:g,o:g,d(e){e&&P(t),C=!1,w(A)}}}function fs(e,n,a){const r=he();let{month:i}=n,{year:o}=n,{current:s}=n;return e.$$set=e=>{"month"in e&&a(0,i=e.month),"year"in e&&a(1,o=e.year),"current"in e&&a(2,s=e.current)},[i,o,s,r,e=>{new t.ExtraButtonComponent(e).setIcon("left-arrow")},e=>{new t.ExtraButtonComponent(e).setIcon("right-arrow")},e=>{new t.ExtraButtonComponent(e).setIcon("gear")},()=>r("previous"),()=>r("reset"),e=>r("next"),e=>r("settings",e)]}const ps=class extends Ge{constructor(e){super(),Pe(this,e,fs,hs,D,{month:0,year:1,current:2},us)}};function ms(e){R(e,"svelte-i3pajt","#calendar-container .fantasy-nav.nav.nav.svelte-i3pajt{padding:0;margin:0;display:flex;flex-flow:row nowrap;justify-content:space-between;align-items:center;position:sticky;top:0;z-index:2}.fantasy-year-nav.svelte-i3pajt{display:flex;align-items:center;margin-right:auto}.container.svelte-i3pajt{display:flex;align-items:center}.fantasy-title.svelte-i3pajt{margin:0}.fantasy-right-nav.svelte-i3pajt{display:flex;justify-content:center;align-items:flex-start}.calendar-clickable.svelte-i3pajt{align-items:center;cursor:pointer;display:flex;justify-content:center}")}function gs(e){let t,n,a,r;return{c(){t=H("div"),K(t,"class","arrow calendar-clickable svelte-i3pajt"),K(t,"aria-label","Previous Year")},m(i,o){V(i,t,o),a||(r=[M(n=e[4].call(null,t)),Z(t,"click",e[7])],a=!0)},p:g,d(e){e&&P(t),a=!1,w(r)}}}function ys(e){let t,n,a,r;return{c(){t=H("div"),K(t,"class","arrow right calendar-clickable svelte-i3pajt"),K(t,"aria-label","Next Year")},m(i,o){V(i,t,o),a||(r=[M(n=e[5].call(null,t)),Z(t,"click",e[9])],a=!0)},p:g,d(e){e&&P(t),a=!1,w(r)}}}function vs(e){let t,n,a,r,i,o,s,l,c,d,u,h,f,p,m,y,v,b,x=e[1]&&gs(e),D=e[1]&&ys(e);return{c(){t=H("div"),n=H("div"),a=H("h2"),r=H("span"),i=U(e[0]),o=z(),s=H("div"),l=H("div"),x&&x.c(),c=z(),d=H("div"),u=H("span"),u.textContent="Today",f=z(),D&&D.c(),p=z(),m=H("div"),K(r,"class","fantasy-year"),K(a,"class","fantasy-title svelte-i3pajt"),K(n,"class","fantasy-year-nav svelte-i3pajt"),K(d,"class","reset-button calendar-clickable svelte-i3pajt"),K(d,"aria-label",h="Today is "+e[2]),K(m,"class","calendar-clickable svelte-i3pajt"),K(m,"aria-label","Calendar Settings"),K(l,"class","container svelte-i3pajt"),K(s,"class","right-nav fantasy-right-nav svelte-i3pajt"),K(t,"class","fantasy-nav nav svelte-i3pajt")},m(h,g){V(h,t,g),L(t,n),L(n,a),L(a,r),L(r,i),L(t,o),L(t,s),L(s,l),x&&x.m(l,null),L(l,c),L(l,d),L(d,u),L(l,f),D&&D.m(l,null),L(l,p),L(l,m),v||(b=[Z(d,"click",e[8]),M(y=e[6].call(null,m)),Z(m,"click",e[10])],v=!0)},p(e,[t]){1&t&&J(i,e[0]),e[1]?x?x.p(e,t):(x=gs(e),x.c(),x.m(l,c)):x&&(x.d(1),x=null),4&t&&h!==(h="Today is "+e[2])&&K(d,"aria-label",h),e[1]?D?D.p(e,t):(D=ys(e),D.c(),D.m(l,p)):D&&(D.d(1),D=null)},i:g,o:g,d(e){e&&P(t),x&&x.d(),D&&D.d(),v=!1,w(b)}}}function bs(e,n,a){const r=he();let{year:i}=n,{arrows:o=!1}=n,{current:s}=n;return e.$$set=e=>{"year"in e&&a(0,i=e.year),"arrows"in e&&a(1,o=e.arrows),"current"in e&&a(2,s=e.current)},[i,o,s,r,e=>{new t.ExtraButtonComponent(e).setIcon("left-arrow")},e=>{new t.ExtraButtonComponent(e).setIcon("right-arrow")},e=>{new t.ExtraButtonComponent(e).setIcon("gear")},()=>r("previous"),()=>r("reset"),e=>r("next"),e=>r("settings",e)]}const ws=class extends Ge{constructor(e){super(),Pe(this,e,bs,vs,D,{year:0,arrows:1,current:2},ms)}};function xs(e){R(e,"svelte-15hvixf",".year-view.svelte-15hvixf{height:100%;position:relative;display:flex;flex-direction:column}.year.svelte-15hvixf{display:grid;grid-template-columns:1fr 1fr 1fr;gap:1rem;overflow:auto;flex:1}.year.svelte-15hvixf:not(.full-view){grid-template-columns:1fr}")}function Ds(e){let t,n,a,r,i,o,s;return n=new ws({props:{year:e[3],current:e[0]}}),n.$on("next",e[9]),n.$on("previous",e[10]),n.$on("reset",e[11]),n.$on("settings",e[12]),{c(){t=H("div"),je(n.$$.fragment),a=z(),r=H("div"),K(r,"class","year svelte-15hvixf"),ae(r,"full-view",e[1]),K(t,"class","year-view svelte-15hvixf")},m(l,c){V(l,t,c),_e(n,t,null),L(t,a),L(t,r),e[13](r),i=!0,o||(s=Z(r,"scroll",e[5],{once:!0}),o=!0)},p(e,[t]){const a={};8&t&&(a.year=e[3]),1&t&&(a.current=e[0]),n.$set(a),2&t&&ae(r,"full-view",e[1])},i(e){i||(Ne(n.$$.fragment,e),i=!0)},o(e){Oe(n.$$.fragment,e),i=!1},d(a){a&&P(t),Ve(n),e[13](null),o=!1,s()}}}function ks(t,n,a){let r;const i=he();let o,s,l,c,{current:d}=n,{year:u}=n,{columns:h}=n,{fullView:f}=n;pe("calendar").subscribe((e=>{a(8,c=e)}));const p=[],m=pe("dayView"),g=pe("displayMoons"),y=new IntersectionObserver(((e,t)=>{t===y&&e.length&&e[0].isIntersecting&&(y.disconnect(),(c.canGoToNextYear(l.year)||l.number!==c.data.months.length-1)&&(w(),A(p.shift()),v()))}),{root:o,rootMargin:"0px",threshold:.25}),v=()=>{const e=o.children[o.children.length-2];e&&y.observe(e)},b=new IntersectionObserver(((e,t)=>{if(t!==b)return;if(!e&&!e.length)return;if(e[0].isIntersecting)return;const n=o.getBoundingClientRect();e[0].boundingClientRect.top{var t,n;if(c.canGoToNextYear(l.year)||l.number!==c.data.months.length-1){if(l=c.getMonth(l.number+1,l.year),0===l.number&&!(o.lastElementChild instanceof HTMLHeadingElement)){const e=o.createEl("h2",{text:c.getNameForYear(l.year),cls:"fantasy-title"});p.push(e),b.disconnect(),b.observe(e)}p.push(C(l,!1)),e&&(s=c.getMonth((null!==(t=null==s?void 0:s.number)&&void 0!==t?t:0)+1,null!==(n=null==s?void 0:s.year)&&void 0!==n?n:1)),D()}},x=new IntersectionObserver(((e,t)=>{t===x&&e.length&&e[0].isIntersecting&&(x.disconnect(),s&&(E(),A(p.pop()),D()))}),{root:o,rootMargin:"0px",threshold:.25}),D=()=>{const e=o.children[1];e&&x.observe(e)},k=new IntersectionObserver(((e,t)=>{t===k&&(e||e.length)&&e[0].isIntersecting&&(a(6,u-=1),b.observe(e[0].target),k.disconnect())}),{root:o,rootMargin:"0px",threshold:0}),E=(e=!0)=>{if(s=c.getMonth(s.number-1,s.year),s){if(p.unshift(C(s,!0)),0===s.number&&!(o.firstElementChild instanceof HTMLHeadingElement)){const e=createEl("h2",{text:c.getNameForYear(s.year),cls:"fantasy-title"});o.prepend(e),p.unshift(e),k.disconnect(),k.observe(e)}e&&(l=c.getMonth(l.number-1,l.year)),v()}},C=(e,t)=>{const n=new ds({target:o,anchor:t?o.children[0]:null,props:{month:e,fullView:!1,yearView:!0,columns:h,weeks:c.weekdays.length,showPad:!1},context:new Map([["dayView",m],["displayMoons",g]])});return n.$on("day-click",(e=>i("day-click",e.detail))),n.$on("day-doubleclick",(e=>i("day-doubleclick",e.detail))),n.$on("day-context-menu",(e=>i("day-context-menu",e.detail))),n.$on("event-mouseover",(e=>i("event-mouseover",e.detail))),n.$on("event-mouseover",(e=>i("event-mouseover",e.detail))),n},A=e=>{e instanceof HTMLHeadingElement?e.detach():e.$destroy()},T=(t=!1)=>e(void 0,void 0,void 0,(function*(){for(let e of p)A(e);p.splice(0,p.length),o.empty(),yield ke(),a(6,u=c.current.year),s=c.getMonth(c.displayed.month-1,c.displayed.year),l=s;for(let e=0;e{x.disconnect(),y.disconnect(),k.disconnect(),b.disconnect()},de().$$.on_destroy.push(S),ue(T);const $=()=>e(void 0,void 0,void 0,(function*(){yield ke(),x.observe(o.children[1]),y.observe(o.children[o.children.length-2])}));return t.$$set=e=>{"current"in e&&a(0,d=e.current),"year"in e&&a(6,u=e.year),"columns"in e&&a(7,h=e.columns),"fullView"in e&&a(1,f=e.fullView)},t.$$.update=()=>{320&t.$$.dirty&&a(3,r=c.getNameForYear(u))},[d,f,o,r,T,$,u,h,c,function(e){me.call(this,t,e)},function(e){me.call(this,t,e)},()=>T(!0),function(e){me.call(this,t,e)},function(e){ye[e?"unshift":"push"]((()=>{o=e,a(2,o)}))}]}const Es=class extends Ge{constructor(e){super(),Pe(this,e,ks,Ds,D,{current:0,year:6,columns:7,fullView:1},xs)}};function Cs(e){R(e,"svelte-ztrrn8",".year.svelte-ztrrn8{display:grid;grid-template-columns:1fr 1fr 1fr;gap:1rem;overflow:auto;flex:1}.year.svelte-ztrrn8:not(.full-view){grid-template-columns:1fr}")}function As(e,t,n){const a=e.slice();return a[8]=t[n],a}function Ts(e){let t,n;return t=new ds({props:{month:e[8],fullView:!1,yearView:!0,columns:e[2],weeks:e[8].calendar.weekdays.length,showPad:!1}}),t.$on("day-click",e[3]),t.$on("day-doubleclick",e[4]),t.$on("day-context-menu",e[5]),t.$on("event-click",e[6]),t.$on("event-mouseover",e[7]),{c(){je(t.$$.fragment)},m(e,a){_e(t,e,a),n=!0},p(e,n){const a={};2&n&&(a.month=e[8]),4&n&&(a.columns=e[2]),2&n&&(a.weeks=e[8].calendar.weekdays.length),t.$set(a)},i(e){n||(Ne(t.$$.fragment,e),n=!0)},o(e){Oe(t.$$.fragment,e),n=!1},d(e){Ve(t,e)}}}function Ss(e){let t,n,a=e[1],r=[];for(let t=0;tOe(r[e],1,1,(()=>{r[e]=null}));return{c(){t=H("div");for(let e=0;e{"fullView"in e&&n(0,a=e.fullView),"months"in e&&n(1,r=e.months),"columns"in e&&n(2,i=e.columns)},[a,r,i,function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)}]}const Ms=class extends Ge{constructor(e){super(),Pe(this,e,$s,Ss,D,{fullView:0,months:1,columns:2},Cs)}};function qs(e){R(e,"svelte-1xpvbi",".year-view.svelte-1xpvbi{height:100%;position:relative;display:flex;flex-direction:column}.year-container.svelte-1xpvbi{flex:1;overflow:auto}")}function Is(e){let t,n,a,r,i;return n=new ws({props:{year:e[2],current:e[0],arrows:!0}}),n.$on("next",e[9]),n.$on("previous",e[10]),n.$on("reset",e[11]),n.$on("settings",e[12]),{c(){t=H("div"),je(n.$$.fragment),a=z(),r=H("div"),K(r,"class","year-container svelte-1xpvbi"),K(t,"class","year-view svelte-1xpvbi")},m(o,s){V(o,t,s),_e(n,t,null),L(t,a),L(t,r),e[13](r),i=!0},p(e,[t]){const a={};4&t&&(a.year=e[2]),1&t&&(a.current=e[0]),n.$set(a)},i(e){i||(Ne(n.$$.fragment,e),i=!0)},o(e){Oe(n.$$.fragment,e),i=!1},d(a){a&&P(t),Ve(n),e[13](null)}}}function Fs(n,a,r){let i;const o=he(),s=pe("calendar"),l=pe("dayView"),c=pe("displayMoons");let d;s.subscribe((e=>{r(8,d=e)}));let u,{year:h}=a,{current:f}=a,{columns:p}=a;const m=(e,t=!1)=>{const n=d.getMonthsForYear(e),a=new Ms({target:u,anchor:t?u.children[0]:null,props:{months:n,fullView:!0,columns:p},context:new Map([["dayView",l],["displayMoons",c]])});return a.$on("day-click",(e=>o("day-click",e.detail))),a.$on("day-doubleclick",(e=>o("day-doubleclick",e.detail))),a.$on("day-context-menu",(e=>o("day-context-menu",e.detail))),a.$on("event-mouseover",(e=>o("event-mouseover",e.detail))),a.$on("event-mouseover",(e=>o("event-mouseover",e.detail))),a},g=[],y=()=>{d.canGoToNextYear(h)?(r(6,h+=1),w(h)):new t.Notice("This is the last year. Additional years can be created in settings.")},v=()=>{1!==h?(r(6,h-=1),w(h)):new t.Notice("This is the earliest year.")},b=()=>{r(6,h=d.current.year),w(h)},w=t=>e(void 0,void 0,void 0,(function*(){g.forEach((e=>{var t;(t=e)instanceof HTMLHeadingElement?t.detach():t.$destroy()})),u.empty(),yield ke(),t=t,g.push(m(t))}));return ue((()=>g.push(m(h)))),n.$$set=e=>{"year"in e&&r(6,h=e.year),"current"in e&&r(0,f=e.current),"columns"in e&&r(7,p=e.columns)},n.$$.update=()=>{320&n.$$.dirty&&r(2,i=d.getNameForYear(h))},[f,u,i,y,v,b,h,p,d,()=>y(),()=>v(),()=>b(),function(e){me.call(this,n,e)},function(e){ye[e?"unshift":"push"]((()=>{u=e,r(1,u)}))}]}const Ns=class extends Ge{constructor(e){super(),Pe(this,e,Fs,Is,D,{year:6,current:0,columns:7},qs)}};function Os(e){R(e,"svelte-1kty1w6","#calendar-container.year-view.svelte-1kty1w6.svelte-1kty1w6{height:100%}#calendar-container.fantasy-calendar.full-view.svelte-1kty1w6.svelte-1kty1w6{width:100%;padding:0 0.5rem 0.5rem;height:100%;display:flex;flex-flow:column}.fantasy-calendar.full-view.svelte-1kty1w6 .month-container.svelte-1kty1w6{height:100%}.month-container.svelte-1kty1w6.svelte-1kty1w6{display:flex}.month-view.svelte-1kty1w6.svelte-1kty1w6{flex-grow:2}.weeks.svelte-1kty1w6.svelte-1kty1w6{display:grid;grid-template-rows:auto 1fr}.week-num-container.svelte-1kty1w6.svelte-1kty1w6{display:grid;grid-template-rows:repeat(var(--calendar-rows), auto);padding:0.25rem 0}.week-num.svelte-1kty1w6.svelte-1kty1w6{background-color:transparent;border:2px solid transparent;border-radius:4px;color:var(--color-text-day);cursor:pointer;font-size:0.8em;height:100%;padding:2px;position:relative;text-align:center;vertical-align:baseline;overflow:visible}.weekdays.svelte-1kty1w6.svelte-1kty1w6{display:grid;grid-template-columns:repeat(var(--calendar-columns), 1fr);grid-template-rows:auto;padding:0 0.25rem;gap:2px}.weekday.svelte-1kty1w6.svelte-1kty1w6{background-color:var(--color-background-heading);color:var(--color-text-heading);font-size:0.6em;letter-spacing:1px;padding:4px;text-transform:uppercase;text-align:center;border:2px solid transparent}hr.svelte-1kty1w6.svelte-1kty1w6{margin:1rem 0}.moon-container{display:flex;flex-flow:row wrap;align-items:center;justify-content:center}")}function Bs(e,t,n){const a=e.slice();return a[48]=t[n],a}function Ls(e,t,n){const a=e.slice();return a[51]=t[n],a}function Rs(e){let t,n,a,r,i,o,s,l,c,d;t=new ps({props:{month:e[5].name,year:e[8],current:e[3].displayedDate}}),t.$on("next",e[30]),t.$on("previous",e[31]),t.$on("reset",e[32]),t.$on("settings",e[33]);let u=e[4]&&Vs(e),h=e[10],f=[];for(let t=0;t{l[u]=null})),Fe(),a=l[n],a?a.p(e,r):(a=l[n]=s[n](e),a.c()),Ne(a,1),a.m(t,null)),(!o||8&r[0])&&ee(t,"--calendar-columns",e[3].weekdays.length),(!o||8&r[0])&&ee(t,"--column-widths",1/e[3].weekdays.length*100+"%"),(!o||8&r[0])&&ee(t,"--calendar-rows",e[3].weeksPerCurrentMonth),2&r[0]&&ae(t,"full-view",e[1]),4&r[0]&&ae(t,"year-view",e[2]),e[0]&&!e[1]?d?(d.p(e,r),3&r[0]&&Ne(d,1)):(d=Hs(e),d.c(),Ne(d,1),d.m(i.parentNode,i)):d&&(Ie(),Oe(d,1,1,(()=>{d=null})),Fe())},i(e){o||(Ne(a),Ne(d),o=!0)},o(e){Oe(a),Oe(d),o=!1},d(e){e&&P(t),l[n].d(),e&&P(r),d&&d.d(e),e&&P(i)}}}function Us(e,t,n){let a,r,i,o,s,l,{fullView:c=!1}=t,{dayView:d=!1}=t,{yearView:u=!1}=t,{calendar:h}=t,{moons:f}=t,{displayWeeks:p}=t;const m=ho(d),g=ho(f),y=ho(h);return fe("dayView",m),fe("displayMoons",g),fe("calendar",y),h.on("month-update",(()=>{n(9,r=h.displayed.year),n(8,i=h.getNameForYear(h.displayed.year)),n(5,o=h.currentMonth),n(6,l=h.weeksOfMonth(o)),n(7,s=h.weekNumbersOfMonth(o))})),e.$$set=e=>{"fullView"in e&&n(1,c=e.fullView),"dayView"in e&&n(0,d=e.dayView),"yearView"in e&&n(2,u=e.yearView),"calendar"in e&&n(3,h=e.calendar),"moons"in e&&n(11,f=e.moons),"displayWeeks"in e&&n(4,p=e.displayWeeks)},e.$$.update=()=>{4&e.$$.dirty[0]&&u&&n(0,d=!1),1&e.$$.dirty[0]&&m.set(d),2048&e.$$.dirty[0]&&g.set(f),8&e.$$.dirty[0]&&y.set(h),8&e.$$.dirty[0]&&n(10,a=h.weekdays),8&e.$$.dirty[0]&&n(9,r=h.displayed.year),8&e.$$.dirty[0]&&n(8,i=h.getNameForYear(h.displayed.year)),8&e.$$.dirty[0]&&n(5,o=h.currentMonth),40&e.$$.dirty[0]&&n(7,s=h.weekNumbersOfMonth(o)),40&e.$$.dirty[0]&&n(6,l=h.weeksOfMonth(o))},[d,c,u,h,p,o,l,s,i,r,a,f,()=>h.goToNextYear(),()=>h.goToPreviousYear(),function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},()=>h.goToNextYear(),()=>h.goToPreviousYear(),function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},()=>h.goToNext(),()=>h.goToPrevious(),function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},()=>n(0,d=!1),function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)},function(t){me.call(this,e,t)}]}const zs=class extends Ge{constructor(e){super(),Pe(this,e,Us,Ws,D,{fullView:1,dayView:0,yearView:2,calendar:3,moons:11,displayWeeks:4},Os,[-1,-1])}},Ys="FANTASY_CALENDAR",Zs="FANTASY_CALENDAR_FULL_VIEW";(0,t.addIcon)(Ys,''),(0,t.addIcon)("fantasy-calendar-reveal",'');class Ks extends t.ItemView{constructor(e,t,n={}){super(t),this.plugin=e,this.leaf=t,this.options=n,this.updateMe=!0,this.yearView=!1,this.moons=!0,this.registerEvent(this.plugin.app.workspace.on("fantasy-calendars-updated",(()=>{this.updateCalendars()}))),this.registerEvent(this.plugin.app.workspace.on("layout-change",(()=>{this._app&&this._app.$set(Object.assign({fullView:this.full},this.full?{dayView:!1}:{}))})))}get root(){return this.leaf.getRoot()}get full(){return!("collapse"in this.root)}updateCalendars(){var e,t,n;if(!this.updateMe)return void(this.updateMe=!0);if(!this.plugin.data.calendars.length)return null===(e=this._app)||void 0===e||e.$destroy(),this.contentEl.empty(),this.noCalendarEl=this.contentEl.createDiv("fantasy-no-calendar"),void this.noCalendarEl.createSpan({text:"No calendars created! Create a calendar to see it here."});const a=null!==(n=null!==(t=this.plugin.data.calendars.find((e=>{var t;return e.id==(null===(t=this.calendar)||void 0===t?void 0:t.id)})))&&void 0!==t?t:this.plugin.defaultCalendar)&&void 0!==n?n:this.plugin.data.calendars[0];this.helper&&this.helper.object.id==a.id?this.update(a):this.setCurrentCalendar(a)}update(e){this.calendar=e,this.helper.update(this.calendar),this.registerCalendarInterval(),this._app?this._app.$set({calendar:this.helper}):this.build()}registerCalendarInterval(){if(this.interval&&(clearInterval(this.interval),this.interval=null),this.calendar.static.incrementDay){let e=new Date;this.calendar.date||(this.calendar.date=e.valueOf());const t=s(new Date(this.calendar.date),e);if(t>=1){for(let e=0;e{s(new Date,e)>=1&&(this.helper.goToNextCurrentDay(),this.helper.current,e=new Date,this.calendar.date=e.valueOf(),this.plugin.saveSettings())}),6e4),this.registerInterval(this.interval)}}setCurrentCalendar(e){var t;null===(t=this.noCalendarEl)||void 0===t||t.detach(),this.calendar=e,this.moons=this.calendar.static.displayMoons,this.helper=new co(this.calendar,this.plugin),this.registerCalendarInterval(),this.build()}createEventForDay(e){const t=new Ti(this.app,this.calendar,null,e);t.onClose=()=>{t.saved&&(this.calendar.events.push(t.event),this.plugin.saveSettings(),this._app.$set({calendar:this.helper}),this.triggerHelperEvent("day-update"))},t.open()}onOpen(){return e(this,void 0,void 0,(function*(){this.updateCalendars()}))}build(){this.contentEl.empty(),this._app=new zs({target:this.contentEl,props:{calendar:this.helper,fullView:this.full,yearView:this.yearView,moons:this.moons,displayWeeks:this.helper.displayWeeks}}),this._app.$on("day-click",(e=>{const t=e.detail;t.events.length||this.createEventForDay(t.date)})),this._app.$on("day-doubleclick",(e=>{const t=e.detail;t.events.length&&(this.helper.viewing.day=t.number,this.helper.viewing.month=this.helper.displayed.month,this.helper.viewing.year=this.helper.displayed.year,this.yearView=!1,this._app.$set({yearView:!1}),this._app.$set({dayView:!0}),this.triggerHelperEvent("day-update",!1))})),this._app.$on("day-context-menu",(e=>{const{day:n,evt:a}=e.detail,r=new t.Menu(this.app);r.setNoIcon(),this.full||r.addItem((e=>{e.setTitle("Open Day").onClick((()=>{this.helper.viewing.day=n.number,this.helper.viewing.month=this.helper.displayed.month,this.helper.viewing.year=this.helper.displayed.year,this.yearView=!1,this._app.$set({yearView:!1}),this._app.$set({dayView:!0}),this.triggerHelperEvent("day-update",!1)}))})),r.addItem((e=>{e.setTitle("Set as Today").onClick((()=>{this.calendar.current=n.date,this.helper.current.day=n.number,this.triggerHelperEvent("day-update"),this.plugin.saveSettings()}))})),r.addItem((e=>e.setTitle("New Event").onClick((()=>{this.createEventForDay(n.date)})))),r.showAtMouseEvent(a)})),this._app.$on("settings",(e=>{const n=e.detail,a=new t.Menu(this.app);a.setNoIcon(),a.addItem((e=>{e.setTitle((this.calendar.displayWeeks?"Hide":"Show")+" Weeks").onClick((()=>{this.calendar.displayWeeks=!this.calendar.displayWeeks,this.helper.update(this.calendar),this._app.$set({displayWeeks:this.calendar.displayWeeks}),this.plugin.saveSettings()}))})),a.addItem((e=>{e.setTitle("Open "+(this.yearView?"Month":"Year")).onClick((()=>{this.yearView=!this.yearView,this._app.$set({yearView:this.yearView})}))})),a.addItem((e=>{e.setTitle(this.moons?"Hide Moons":"Display Moons").onClick((()=>{this.toggleMoons()}))})),a.addItem((e=>{e.setTitle("View Day"),e.onClick((()=>{const e=new Js(this.plugin,this.calendar);e.onClose=()=>{e.confirmed&&(e.setCurrent?(this.calendar.current=Object.assign({},e.date),this.setCurrentCalendar(this.calendar)):(this.helper.displayed=Object.assign({},e.date),this.helper.update(),this._app.$set({calendar:this.helper})),this.plugin.saveSettings())},e.open()}))})),a.addItem((e=>{e.setTitle("Switch Calendars"),e.setDisabled(this.plugin.data.calendars.length<=1),e.onClick((()=>{const e=new Qs(this.plugin,this.calendar);e.onClose=()=>{e.confirmed&&this.setCurrentCalendar(e.calendar)},e.open()}))})),a.showAtMouseEvent(n)})),this._app.$on("event-click",(e=>{const{event:n,modifier:a}=e.detail;if(n.note){let e=[];this.app.workspace.iterateAllLeaves((a=>{a.view instanceof t.MarkdownView&&a.view.file.basename===n.note&&e.push(a)})),e.length?this.app.workspace.setActiveLeaf(e[0]):this.app.workspace.openLinkText(n.note,"",this.full||a)}else new Xs(n,this.plugin).open()})),this._app.$on("event-mouseover",(e=>{if(!this.plugin.data.eventPreview)return;const{target:t,event:n}=e.detail;n.note&&this.app.workspace.trigger("link-hover",this,t,n.note,"")})),this._app.$on("event-context",(n=>{const{evt:a,event:r}=n.detail,i=new t.Menu(this.app);i.setNoIcon(),r.note||i.addItem((n=>{n.setTitle("Create Note").onClick((()=>e(this,void 0,void 0,(function*(){var e,n,a,i;const o=null===(e=this.app.workspace.getActiveFile())||void 0===e?void 0:e.path,s=o&&null!==(a=null===(n=this.app.fileManager.getNewFileParent(o))||void 0===n?void 0:n.parent)&&void 0!==a?a:"/",l=`${r.date.year}-${r.date.month+1}-${r.date.day}`;let c;r.end&&(c=`${r.end.year}-${r.end.month+1}-${r.end.day}`);const d=Object.assign(Object.assign({"fc-calendar":this.calendar.name,"fc-date":l},r.end?{"fc-end":c}:{}),r.category?{"fc-category":null===(i=this.calendar.categories.find((e=>e.id==r.category)))||void 0===i?void 0:i.name}:{});r.note=(0,t.normalizePath)(`${s}/${r.name}.md`);let u=this.app.vault.getAbstractFileByPath(r.note);if(u||(u=yield this.app.vault.create(r.note,`---\n${(0,t.stringifyYaml)(d)}\n---`)),this.plugin.saveCalendar(),u instanceof t.TFile){const e=this.app.workspace.getLeavesOfType("markdown").find((e=>{e.view instanceof t.FileView&&(e.view.file.path,r.note)}));e?this.app.workspace.setActiveLeaf(e):yield this.app.workspace.getUnpinnedLeaf().openFile(u,{active:!0})}}))))})),i.addItem((e=>{e.setTitle("Edit Event").onClick((()=>{const e=new Ti(this.app,this.calendar,r);e.onClose=()=>{if(!e.saved)return;const t=this.calendar.events.find((e=>e.id==r.id));this.calendar.events.splice(this.calendar.events.indexOf(t),1,e.event),this.plugin.saveSettings(),this._app.$set({calendar:this.helper}),this.triggerHelperEvent("day-update")},e.open()}))})),i.addItem((t=>{t.setTitle("Delete Event").onClick((()=>e(this,void 0,void 0,(function*(){if(yield nr(this.app,"Are you sure you wish to delete this event?",{cta:"Delete",secondary:"Cancel"})){const e=this.calendar.events.find((e=>e.id==r.id));this.calendar.events.splice(this.calendar.events.indexOf(e),1),this.plugin.saveSettings(),this._app.$set({calendar:this.helper}),this.triggerHelperEvent("day-update")}}))))})),i.showAtMouseEvent(a)})),this._app.$on("event",(e=>{const t=e.detail;this.createEventForDay(t)})),this._app.$on("reset",(()=>{this.helper.reset(),this.yearView=!1,this._app.$set({yearView:!1}),this._app.$set({dayView:!0}),this.triggerHelperEvent("day-update",!1)}))}toggleMoons(){this.moons=!this.moons,this._app.$set({moons:this.moons})}onClose(){return e(this,void 0,void 0,(function*(){}))}onResize(){this.triggerHelperEvent("view-resized",!1)}getViewType(){return Ys}getDisplayText(){return"Fantasy Calendar"}getIcon(){return Ys}triggerHelperEvent(e,t=!0){this.helper&&(this.helper.trigger(e),t&&(this.updateMe=!1,this.plugin.app.workspace.trigger("fantasy-calendars-updated")))}onunload(){return e(this,void 0,void 0,(function*(){}))}}class Qs extends t.Modal{constructor(e,t){super(e.app),this.plugin=e,this.calendar=t,this.confirmed=!1}display(){return e(this,void 0,void 0,(function*(){this.contentEl.empty(),this.contentEl.createEl("h4",{text:"Switch Calendars"});const e=this.contentEl.createDiv("fantasy-calendar-dropdown");e.createEl("label",{text:"Choose a Calendar"}),new t.DropdownComponent(e).onChange((e=>{this.calendar=this.plugin.data.calendars.find((t=>t.id==e))})).addOptions(Object.fromEntries(this.plugin.data.calendars.map((e=>[e.id,e.name])))).setValue(this.calendar?this.calendar.id:null);const n=this.contentEl.createDiv("fantasy-calendar-confirm-buttons");new t.ButtonComponent(n).setButtonText("Switch").setCta().onClick((()=>{this.confirmed=!0,this.close()})),new t.ButtonComponent(n).setButtonText("Cancel").onClick((()=>{this.close()}))}))}onOpen(){this.display()}}class Js extends t.Modal{constructor(e,t){super(e.app),this.plugin=e,this.calendar=t,this.confirmed=!1,this.setCurrent=!1,this.date=Object.assign({},this.calendar.current),this.tempCurrentDays=this.date.day}display(){return e(this,void 0,void 0,(function*(){this.contentEl.empty(),this.contentEl.createEl("h4",{text:"View Day"}),this.dateFieldEl=this.contentEl.createDiv("fantasy-calendar-date-fields"),this.buildDateFields(),new t.Setting(this.contentEl).setName("Set as Current Date").setDesc("Also set this date to today's date.").addToggle((e=>e.setValue(this.setCurrent).onChange((e=>{this.setCurrent=e}))));const e=this.contentEl.createDiv("fantasy-calendar-confirm-buttons");new t.ButtonComponent(e).setButtonText("Switch").setCta().onClick((()=>{this.confirmed=!0,this.date.day=this.tempCurrentDays,this.close()})),new t.ButtonComponent(e).setButtonText("Cancel").onClick((()=>{this.close()}))}))}buildDateFields(){var e,n,a,r,i,o;this.dateFieldEl.empty(),null!=this.tempCurrentDays&&null!=this.date.month&&this.tempCurrentDays>(null===(e=this.calendar.static.months[this.date.month])||void 0===e?void 0:e.length)&&(this.tempCurrentDays=null===(n=this.calendar.static.months[this.date.month])||void 0===n?void 0:n.length);const s=this.dateFieldEl.createDiv("fantasy-calendar-date-field");s.createEl("label",{text:"Day"});const l=new t.TextComponent(s).setPlaceholder("Day").setValue(`${this.tempCurrentDays}`).setDisabled(null==this.date.month).onChange((e=>{var n,a;if(Number(e)<1||(null!==(a=Number(e)>(null===(n=this.calendar.static.months[this.date.month])||void 0===n?void 0:n.length))&&void 0!==a?a:1/0))return new t.Notice(`The current day must be between 1 and ${this.calendar.static.months[this.date.month].length}`),this.tempCurrentDays=this.date.day,void this.buildDateFields();this.tempCurrentDays=Number(e)}));l.inputEl.setAttr("type","number");const c=this.dateFieldEl.createDiv("fantasy-calendar-date-field");c.createEl("label",{text:"Month"}),new t.DropdownComponent(c).addOptions(Object.fromEntries([["select","Select Month"],...this.calendar.static.months.map((e=>[e.name,e.name]))])).setValue(null!=this.date.month?this.calendar.static.months[this.date.month].name:"select").onChange((e=>{"select"===e&&(this.date.month=null);const t=this.calendar.static.months.find((t=>t.name==e));this.date.month=this.calendar.static.months.indexOf(t),this.buildDateFields()}));const d=this.dateFieldEl.createDiv("fantasy-calendar-date-field");if(d.createEl("label",{text:"Year"}),this.calendar.static.useCustomYears){const e=new t.DropdownComponent(d);(null!==(a=this.calendar.static.years)&&void 0!==a?a:[]).forEach((t=>{e.addOption(t.id,t.name)})),this.date.year>(null===(r=this.calendar.static.years)||void 0===r?void 0:r.length)&&(this.date.year=this.calendar.static.years?this.calendar.static.years.length:null),e.setValue(null===(o=null===(i=this.calendar.static.years)||void 0===i?void 0:i[this.date.year-1])||void 0===o?void 0:o.id).onChange((e=>{this.date.year=this.calendar.static.years.findIndex((t=>t.id==e))+1}))}else new t.TextComponent(d).setPlaceholder("Year").setValue(`${this.date.year}`).onChange((e=>{this.date.year=Number(e)})).inputEl.setAttr("type","number")}onOpen(){this.display()}}class Xs extends t.Modal{constructor(e,t){super(t.app),this.event=e,this.plugin=t,this.containerEl.addClass("fantasy-calendar-view-event")}display(){return e(this,void 0,void 0,(function*(){this.contentEl.empty(),this.contentEl.createEl("h4",{text:this.event.name}),yield t.MarkdownRenderer.renderMarkdown(this.event.description,this.contentEl,this.event.note,null)}))}onOpen(){return e(this,void 0,void 0,(function*(){yield this.display()}))}}var el=n(477),tl=n.n(el);function nl(){return tl()('(()=>{"use strict";function n(n,t,e,l){return new(e||(e=Promise))((function(o,i){function a(n){try{s(l.next(n))}catch(n){i(n)}}function d(n){try{s(l.throw(n))}catch(n){i(n)}}function s(n){var t;n.done?o(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(a,d)}s((l=l.apply(n,t||[])).next())}))}function t(n,t){return(n%t+t)%t}Object.create,Object.create;const e=self;e.addEventListener("message",(o=>n(void 0,void 0,void 0,(function*(){var n,i,a,d,s,r,u;if("parse"===o.data.type){const{file:c,cache:f,sourceCalendars:v}=o.data,{frontmatter:m}=null!=f?f:{};if(!m)return;if(!("fc-calendar"in m)&&!("fc-date"in m)&&!("fc-start"in m))return;let h=m["fc-calendar"];Array.isArray(h)||(h=[h]);const{start:y,end:p}=l(m),g=v.filter((n=>h.includes(n.name))),x=m["fc-category"];for(let l of g){let o=h.indexOf(l.name);o>=y.length&&(o=y.length-1);let f=null!==(n=y[o])&&void 0!==n?n:{day:null,month:null,year:null},v=p.length?null!==(i=p[o])&&void 0!==i?i:p[p.length-1]:null;if((null==f?void 0:f.month)&&"string"==typeof(null==f?void 0:f.month)){let n=l.static.months.find((n=>n.name==f.month));f.month=n?l.static.months.indexOf(n):null}else(null==f?void 0:f.month)&&"number"==typeof(null==f?void 0:f.month)&&(f.month=t(f.month-1,l.static.months.length));if((null==v?void 0:v.month)&&"string"==typeof(null==v?void 0:v.month)){let n=l.static.months.find((n=>n.name==v.month));v.month=n?l.static.months.indexOf(n):null}else(null==v?void 0:v.month)&&"number"==typeof(null==v?void 0:v.month)&&(v.month=t(v.month-1,l.static.months.length));const m=l.categories.find((n=>(null==n?void 0:n.name)==x)),g=l.events.find((n=>n.note==c.path));(null==g?void 0:g.date.day)==f.day&&(null==g?void 0:g.date.month)==f.month&&(null==g?void 0:g.date.year)==f.year&&(null===(a=null==g?void 0:g.end)||void 0===a?void 0:a.day)==(null==v?void 0:v.day)&&(null===(d=null==g?void 0:g.end)||void 0===d?void 0:d.month)==(null==v?void 0:v.month)&&(null===(s=null==g?void 0:g.end)||void 0===s?void 0:s.year)==(null==v?void 0:v.year)&&(null==g?void 0:g.category)==(null==m?void 0:m.id)||e.postMessage({type:"update",id:l.id,index:l.events.indexOf(g),event:Object.assign(Object.assign({id:null!==(r=null==g?void 0:g.id)&&void 0!==r?r:"ID_xyxyxyxyxyxy".replace(/[xy]/g,(function(n){var t=16*Math.random()|0;return("x"==n?t:3&t|8).toString(16)})),name:null!==(u=null==g?void 0:g.name)&&void 0!==u?u:c.basename,note:c.path,date:f},v?{end:v}:{}),{category:null==m?void 0:m.id,description:null==g?void 0:g.description})})}e.postMessage({type:"save",id:null,index:null,event:null})}})))),e.addEventListener("message",(t=>n(void 0,void 0,void 0,(function*(){if("rename"===t.data.type){const{sourceCalendars:n,file:l}=t.data,o=l.oldPath.split("/").pop().split(".").shift();for(let t of n){const n=t.events.filter((n=>n.note==l.oldPath||n.note===o));for(let o of n)e.postMessage({type:"update",id:t.id,index:t.events.indexOf(o),event:Object.assign(Object.assign({},o),{note:l.path,name:l.basename})})}e.postMessage({type:"save",id:null,index:null,event:null})}}))));const l=n=>({start:[n["fc-date"in n?"fc-date":"fc-start"]].flat(2).map((n=>o(n))),end:["fc-end"in n?n["fc-end"]:[]].flat(2).map((n=>o(n)))}),o=n=>{if("string"!=typeof n)return n;try{const t=n.split(/[\\-\\/]/).map((n=>Number(n)));return{year:t[0],month:t[1],day:t[2]}}catch(n){return}}})();',"Worker",{name:"Fantasy Calendar Watcher",esModule:!1},void 0)}class al extends t.Component{constructor(e){super(),this.plugin=e,this.worker=new nl,this.files=new Map}get calendars(){return this.plugin.data.calendars}get vault(){return this.plugin.app.vault}get metadataCache(){return this.plugin.app.metadataCache}onload(){this.recurseFiles(),this.registerEvent(this.metadataCache.on("changed",(e=>{this.parseFileForEvents(e)}))),this.registerEvent(this.vault.on("rename",((e,n)=>{e instanceof t.TFile&&this.worker.postMessage({type:"rename",file:{path:e.path,basename:e.basename,oldPath:n},sourceCalendars:this.calendars})}))),this.registerEvent(this.vault.on("delete",(e=>{if(e instanceof t.TFile){for(let t of this.calendars)for(let n of t.events)n.note&&n.note===e.path&&(n.note=null);this.plugin.saveCalendar()}}))),this.worker.onmessage=t=>e(this,void 0,void 0,(function*(){if("save"===t.data.type)return void this.plugin.saveCalendar();const{id:e,index:n,event:a}=t.data;this.calendars.find((t=>t.id==e)).events.splice(n,n>=0?1:0,a)}))}recurseFiles(){const e=this.vault.getAbstractFileByPath(this.plugin.data.path);e&&e instanceof t.TFolder&&(this.recurseFolder(e),this.plugin.saveCalendar())}registerCalendar(e){console.log("[Fantasy Calendar] Parsing files for events.");const n=this.vault.getAbstractFileByPath(this.plugin.data.path);n&&n instanceof t.TFolder&&(this.recurseFolder(n,e),console.log("[Fantasy Calendar] Parsing complete."))}recurseFolder(e,n){t.Vault.recurseChildren(e,(e=>{e&&e instanceof t.TFile&&this.parseFileForEvents(e,n)}))}testPath(e){return null!=`/${e}`.match(new RegExp(`^${this.plugin.data.path}`))}parseFileForEvents(e,t){if(!this.testPath(e.path))return;const n=this.metadataCache.getFileCache(e);n&&this.worker.postMessage({type:"parse",file:{path:e.path,basename:e.basename},cache:n,sourceCalendars:t?[t]:this.calendars})}onunload(){this.worker.terminate(),this.worker=null}}const rl=t.Platform.isMacOS?"Meta":"Control",il={name:null,description:null,id:null,static:{incrementDay:!1,firstWeekDay:null,overflow:!0,weekdays:[],months:[],moons:[],displayMoons:!0,leapDays:[],eras:[]},current:{year:1,month:null,day:null},events:[],categories:[]},ol={calendars:[],currentCalendar:null,defaultCalendar:null,eventPreview:!1,configDirectory:null,path:"/"};class sl extends t.Plugin{constructor(){super(...arguments),this.watcher=new al(this)}addNewCalendar(t){return e(this,void 0,void 0,(function*(){this.data.calendars.push(Object.assign({},t)),this.data.defaultCalendar||(this.data.defaultCalendar=t.id),yield this.saveCalendar(),this.watcher.registerCalendar(t)}))}get currentCalendar(){return this.data.calendars.find((e=>e.id==this.data.currentCalendar))}get defaultCalendar(){var e;return null!==(e=this.data.calendars.find((e=>e.id==this.data.defaultCalendar)))&&void 0!==e?e:this.data.calendars[0]}get view(){const e=this.app.workspace.getLeavesOfType(Ys),t=e.length?e[0]:null;if(t&&t.view&&t.view instanceof Ks)return t.view}get full(){const e=this.app.workspace.getLeavesOfType(Zs),t=e.length?e[0]:null;if(t&&t.view&&t.view instanceof Ks)return t.view}onload(){return e(this,void 0,void 0,(function*(){console.log("Loading Fantasy Calendars v"+this.manifest.version),yield this.loadSettings(),this.watcher.load(),this.addSettingTab(new ro(this)),this.registerView(Ys,(e=>new Ks(this,e))),this.app.workspace.onLayoutReady((()=>this.addCalendarView(!0))),this.addRibbonIcon(Ys,"Open Large Fantasy Calendar",(e=>{this.app.workspace.getLeaf(e.getModifierState(rl)).setViewState({type:Zs})})),this.registerView(Zs,(e=>new Ks(this,e,{full:!0}))),this.addCommand({id:"open-fantasy-calendar",name:"Open Fantasy Calendar",callback:()=>{this.addCalendarView()}}),this.addCommand({id:"open-big-fantasy-calendar",name:"Open Large Fantasy Calendar",callback:()=>{this.addFullCalendarView()}}),this.addCommand({id:"toggle-moons",name:"Toggle Moons",checkCallback:e=>{const t=this.app.workspace.getActiveViewOfType(Ks);if(t)return e||t.toggleMoons(),!0}})}))}onunload(){return e(this,void 0,void 0,(function*(){console.log("Unloading Fantasy Calendars v"+this.manifest.version),this.app.workspace.getLeavesOfType(Ys).forEach((e=>e.detach())),this.app.workspace.getLeavesOfType(Zs).forEach((e=>e.detach())),this.watcher.unload()}))}addCalendarView(t=!1){return e(this,void 0,void 0,(function*(){t&&this.app.workspace.getLeavesOfType(Ys).length||(yield this.app.workspace.getRightLeaf(!1).setViewState({type:Ys}),this.view&&this.app.workspace.revealLeaf(this.view.leaf))}))}addFullCalendarView(t=!1){return e(this,void 0,void 0,(function*(){t&&this.app.workspace.getLeavesOfType(Zs).length||(this.app.workspace.getLeaf(!1).setViewState({type:Zs}),this.full&&this.app.workspace.revealLeaf(this.full.leaf))}))}loadSettings(){return e(this,void 0,void 0,(function*(){this.data=Object.assign(Object.assign({},ol),yield this.loadData()),this.configDirectory&&(yield this.app.vault.adapter.exists(this.configFilePath))&&(this.data=Object.assign({},this.data,JSON.parse(yield this.app.vault.adapter.read(this.configFilePath)))),!this.data.defaultCalendar&&this.data.calendars.length&&(this.data.defaultCalendar=this.data.calendars[0].id)}))}saveCalendar(){return e(this,void 0,void 0,(function*(){yield this.saveSettings(),this.app.workspace.trigger("fantasy-calendars-updated")}))}get configDirectory(){if(this.data&&this.data.configDirectory)return`${this.data.configDirectory}/plugins/fantasy-calendar`}get configFilePath(){if(this.data.configDirectory)return`${this.configDirectory}/data.json`}saveSettings(){return e(this,void 0,void 0,(function*(){this.saveData(this.data)}))}saveData(n){const a=Object.create(null,{saveData:{get:()=>super.saveData}});return e(this,void 0,void 0,(function*(){if(this.configDirectory)try{(yield this.app.vault.adapter.exists(this.configDirectory))||(yield this.app.vault.adapter.mkdir(this.configDirectory)),yield this.app.vault.adapter.write(this.configFilePath,JSON.stringify(n))}catch(e){console.error(e),new t.Notice("There was an error saving into the configured directory.")}yield a.saveData.call(this,n)}))}}})();var r=exports;for(var i in a)r[i]=a[i];a.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})();
\ No newline at end of file
diff --git a/.obsidian/plugins/fantasy-calendar/manifest.json b/.obsidian/plugins/fantasy-calendar/manifest.json
new file mode 100644
index 00000000..a362036d
--- /dev/null
+++ b/.obsidian/plugins/fantasy-calendar/manifest.json
@@ -0,0 +1,10 @@
+{
+ "id": "fantasy-calendar",
+ "name": "Fantasy Calendar",
+ "version": "1.9.0",
+ "minAppVersion": "0.12.10",
+ "author": "Jeremy Valentine",
+ "description": "Fantasy calendars in Obsidian!",
+ "authorUrl": "https://github.com/valentine195/obsidian-fantasy-calendar",
+ "isDesktopOnly": false
+}
diff --git a/.obsidian/plugins/fantasy-calendar/styles.css b/.obsidian/plugins/fantasy-calendar/styles.css
new file mode 100644
index 00000000..860570a6
--- /dev/null
+++ b/.obsidian/plugins/fantasy-calendar/styles.css
@@ -0,0 +1,211 @@
+.fantasy-calendar-confirm-buttons {
+ display: flex;
+ justify-content: flex-end;
+ align-items: center;
+ gap: 0.5rem;
+}
+
+.fantasy-calendar-settings .fantasy-calendars {
+ border-bottom: 1px solid var(--background-modifier-border);
+ border-top: 1px solid var(--background-modifier-border);
+ padding: 18px 0 0 0;
+}
+
+.fantasy-calendar-create-calendar input[disabled] {
+ cursor: not-allowed;
+}
+
+.fantasy-calendar-settings .fantasy-calendars .existing-calendars > span {
+ display: block;
+ text-align: center;
+ margin-bottom: 18px;
+ color: var(--text-muted);
+}
+
+.fantasy-calendar-settings
+ .fantasy-calendars
+ > .setting-item:not(.setting-item-heading) {
+ border: 0px;
+}
+
+.fantasy-calendar-settings .fantasy-calendar-config .setting-item-name {
+ display: flex;
+ gap: 0.25rem;
+ align-items: center;
+}
+
+/** Create Calendar Modal */
+.modal-container.fantasy-calendar-create-calendar > .modal {
+ transition: width 0.5s ease-in-out, height 0.5s ease-in-out;
+}
+
+.fantasy-calendar-create-calendar .modal-content {
+ display: flex;
+ flex-flow: column nowrap;
+ gap: 0.5rem;
+}
+
+.fantasy-calendar-create-calendar .calendar-info .calendar-description {
+ display: flex;
+ flex-flow: column nowrap;
+}
+
+.fantasy-calendar-create-calendar .calendar-info textarea {
+ resize: vertical;
+}
+
+.fantasy-calendar-create-calendar details {
+ padding: 0.5rem;
+}
+.fantasy-calendar-create-calendar details[open] {
+ border: 1px solid var(--background-modifier-border);
+ border-radius: 0.5rem;
+}
+
+.fantasy-calendar-create-calendar .fantasy-calendar-container .existing-items {
+ overflow: auto;
+ max-height: 500px;
+}
+
+.fantasy-calendar-create-calendar
+ .fantasy-calendar-container
+ .existing-items
+ > span {
+ display: block;
+ text-align: center;
+ color: var(--text-muted);
+}
+
+.fantasy-calendar-create-calendar details .setting-item {
+ border: 0px;
+}
+
+.fantasy-calendar-create-calendar summary * {
+ display: inline;
+ margin: 0;
+}
+.fantasy-context-buttons {
+ display: flex;
+ justify-content: flex-end;
+ align-items: center;
+ gap: 0.25rem;
+}
+
+.fantasy-calendar-create-calendar button[disabled] {
+ cursor: not-allowed;
+}
+
+.fantasy-calendar-create-event .event-info {
+ display: flex;
+ flex-flow: column nowrap;
+ width: 100%;
+ justify-content: flex-start;
+ align-items: flex-start;
+ gap: 0.5rem;
+}
+
+.fantasy-calendar-create-event .event-info > *,
+.fantasy-calendar-create-event .setting-item {
+ width: 100%;
+ padding-top: 0;
+ padding-bottom: 0.75rem;
+ border: 0;
+}
+.fantasy-calendar-create-event .event-info > .event-description {
+ display: flex;
+ flex-flow: column nowrap;
+}
+
+.fantasy-calendar-create-event .event-info textarea {
+ resize: vertical;
+}
+
+/** Preset Calendar Modal */
+.fantasy-calendar-choose-preset .fantasy-calendar-preset-container {
+ display: grid;
+ grid-template-columns: 1fr 1fr 1fr;
+ grid-auto-rows: 1fr;
+ gap: 1rem;
+ align-items: center;
+ justify-content: flex-start;
+}
+.fantasy-calendar-choose-preset .fantasy-calendar-preset-container button {
+ height: 100%;
+ width: 100%;
+ white-space: pre-line;
+ max-width: 250px;
+}
+.fantasy-calendar-choose-preset
+ .fantasy-calendar-preset-container
+ button.mod-cta {
+ box-shadow: 0px 0px 5px var(--background-modifier-box-shadow);
+}
+
+/** Leap Day Editor */
+.fantasy-leap-day-interval-description {
+ color: var(--text-muted);
+ border: 0;
+}
+
+.fantasy-calendar-event-date {
+ display: grid;
+ grid-template-columns: 1fr auto;
+ align-items: center;
+ gap: 0.5rem;
+}
+
+.fantasy-calendar-picker {
+ padding: 5px 15px;
+ display: flex;
+ flex-flow: column nowrap;
+ justify-content: flex-start;
+}
+.fantasy-calendar-full.view-content {
+ display: flex;
+ flex-flow: column;
+ width: 100%;
+}
+
+.fantasy-calendar-dropdown {
+ display: flex;
+ flex-flow: column;
+ width: 100%;
+ padding-bottom: 0.75rem;
+}
+
+.fantasy-calendar-view-event .modal-content {
+ max-width: 75vw;
+}
+
+.fantasy-no-calendar {
+ color: var(--text-muted);
+ display: flex;
+ justify-content: center;
+ text-align: center;
+ padding: 0.5rem;
+}
+
+.fantasy-title {
+ margin: 0;
+}
+
+.full-view .fantasy-title {
+ grid-column: span 3;
+}
+
+.fantasy-calendar-create-calendar .fantasy-calendar-date-fields {
+ padding-top: 0.75rem;
+}
+.fantasy-calendar-date-fields {
+ display: flex;
+ justify-content: space-between;
+ align-items: flex-start;
+ gap: 0.5rem;
+ padding-bottom: 0.75rem;
+}
+
+.fantasy-calendar-date-fields .fantasy-calendar-date-field {
+ display: flex;
+ flex-flow: column nowrap;
+}
+
diff --git a/.obsidian/plugins/ledger-obsidian/main.js b/.obsidian/plugins/ledger-obsidian/main.js
index 5b72d431..dfad1bfb 100644
--- a/.obsidian/plugins/ledger-obsidian/main.js
+++ b/.obsidian/plugins/ledger-obsidian/main.js
@@ -9861,2131 +9861,848 @@ const paypal = `
`;
-function ascending(a,b){return ab?1:a>=b?0:NaN;}
-
-function bisector(f){let delta=f;let compare=f;if(f.length===1){delta=(d,x)=>f(d)-x;compare=ascendingComparator(f);}function left(a,x,lo,hi){if(lo==null)lo=0;if(hi==null)hi=a.length;while(lo>>1;if(compare(a[mid],x)<0)lo=mid+1;else hi=mid;}return lo;}function right(a,x,lo,hi){if(lo==null)lo=0;if(hi==null)hi=a.length;while(lo>>1;if(compare(a[mid],x)>0)hi=mid;else lo=mid+1;}return lo;}function center(a,x,lo,hi){if(lo==null)lo=0;if(hi==null)hi=a.length;const i=left(a,x,lo,hi-1);return i>lo&&delta(a[i-1],x)>-delta(a[i],x)?i-1:i;}return {left,center,right};}function ascendingComparator(f){return (d,x)=>ascending(f(d),x);}
-
-function number$1(x){return x===null?NaN:+x;}
-
-const ascendingBisect=bisector(ascending);const bisectRight=ascendingBisect.right;const bisectCenter=bisector(number$1).center;
-
-var e10=Math.sqrt(50),e5=Math.sqrt(10),e2=Math.sqrt(2);function ticks(start,stop,count){var reverse,i=-1,n,ticks,step;stop=+stop,start=+start,count=+count;if(start===stop&&count>0)return [start];if(reverse=stop0){let r0=Math.round(start/step),r1=Math.round(stop/step);if(r0*stepstop)--r1;ticks=new Array(n=r1-r0+1);while(++istop)--r1;ticks=new Array(n=r1-r0+1);while(++i=0?(error>=e10?10:error>=e5?5:error>=e2?2:1)*Math.pow(10,power):-Math.pow(10,-power)/(error>=e10?10:error>=e5?5:error>=e2?2:1);}function tickStep(start,stop,count){var step0=Math.abs(stop-start)/Math.max(0,count),step1=Math.pow(10,Math.floor(Math.log(step0)/Math.LN10)),error=step0/step1;if(error>=e10)step1*=10;else if(error>=e5)step1*=5;else if(error>=e2)step1*=2;return stop{}};function dispatch(){for(var i=0,n=arguments.length,_={},t;i=0)name=t.slice(i+1),t=t.slice(0,i);if(t&&!types.hasOwnProperty(t))throw new Error("unknown type: "+t);return {type:t,name:name};});}Dispatch.prototype=dispatch.prototype={constructor:Dispatch,on:function(typename,callback){var _=this._,T=parseTypenames(typename+"",_),t,i=-1,n=T.length;// If no callback was specified, return the callback of the given type and name.
-if(arguments.length<2){while(++i0)for(var args=new Array(n),i=0,n,t;i=0&&(prefix=name.slice(0,i))!=="xmlns")name=name.slice(i+1);return namespaces.hasOwnProperty(prefix)?{space:namespaces[prefix],local:name}:name;// eslint-disable-line no-prototype-builtins
-}
-
-function creatorInherit(name){return function(){var document=this.ownerDocument,uri=this.namespaceURI;return uri===xhtml&&document.documentElement.namespaceURI===xhtml?document.createElement(name):document.createElementNS(uri,name);};}function creatorFixed(fullname){return function(){return this.ownerDocument.createElementNS(fullname.space,fullname.local);};}function creator(name){var fullname=namespace(name);return (fullname.local?creatorFixed:creatorInherit)(fullname);}
-
-function none(){}function selector(selector){return selector==null?none:function(){return this.querySelector(selector);};}
-
-function selection_select(select){if(typeof select!=="function")select=selector(select);for(var groups=this._groups,m=groups.length,subgroups=new Array(m),j=0;j=i1)i1=i0+1;while(!(next=updateGroup[i1])&&++i1=0;){if(node=group[i]){if(next&&node.compareDocumentPosition(next)^4)next.parentNode.insertBefore(node,next);next=node;}}}return this;}
-
-function selection_sort(compare){if(!compare)compare=ascending$1;function compareNode(a,b){return a&&b?compare(a.__data__,b.__data__):!a-!b;}for(var groups=this._groups,m=groups.length,sortgroups=new Array(m),j=0;jb?1:a>=b?0:NaN;}
-
-function selection_call(){var callback=arguments[0];arguments[0]=this;callback.apply(null,arguments);return this;}
-
-function selection_nodes(){return Array.from(this);}
-
-function selection_node(){for(var groups=this._groups,j=0,m=groups.length;j1?this.each((value==null?styleRemove:typeof value==="function"?styleFunction:styleConstant)(name,value,priority==null?"":priority)):styleValue(this.node(),name);}function styleValue(node,name){return node.style.getPropertyValue(name)||defaultView(node).getComputedStyle(node,null).getPropertyValue(name);}
-
-function propertyRemove(name){return function(){delete this[name];};}function propertyConstant(name,value){return function(){this[name]=value;};}function propertyFunction(name,value){return function(){var v=value.apply(this,arguments);if(v==null)delete this[name];else this[name]=v;};}function selection_property(name,value){return arguments.length>1?this.each((value==null?propertyRemove:typeof value==="function"?propertyFunction:propertyConstant)(name,value)):this.node()[name];}
-
-function classArray(string){return string.trim().split(/^|\s+/);}function classList(node){return node.classList||new ClassList(node);}function ClassList(node){this._node=node;this._names=classArray(node.getAttribute("class")||"");}ClassList.prototype={add:function(name){var i=this._names.indexOf(name);if(i<0){this._names.push(name);this._node.setAttribute("class",this._names.join(" "));}},remove:function(name){var i=this._names.indexOf(name);if(i>=0){this._names.splice(i,1);this._node.setAttribute("class",this._names.join(" "));}},contains:function(name){return this._names.indexOf(name)>=0;}};function classedAdd(node,names){var list=classList(node),i=-1,n=names.length;while(++i=0)name=t.slice(i+1),t=t.slice(0,i);return {type:t,name:name};});}function onRemove(typename){return function(){var on=this.__on;if(!on)return;for(var j=0,i=-1,m=on.length,o;j>8&0xf|m>>4&0xf0,m>>4&0xf|m&0xf0,(m&0xf)<<4|m&0xf,1)// #f00
-:l===8?rgba(m>>24&0xff,m>>16&0xff,m>>8&0xff,(m&0xff)/0xff)// #ff000000
-:l===4?rgba(m>>12&0xf|m>>8&0xf0,m>>8&0xf|m>>4&0xf0,m>>4&0xf|m&0xf0,((m&0xf)<<4|m&0xf)/0xff)// #f000
-:null// invalid hex
-):(m=reRgbInteger.exec(format))?new Rgb(m[1],m[2],m[3],1)// rgb(255, 0, 0)
-:(m=reRgbPercent.exec(format))?new Rgb(m[1]*255/100,m[2]*255/100,m[3]*255/100,1)// rgb(100%, 0%, 0%)
-:(m=reRgbaInteger.exec(format))?rgba(m[1],m[2],m[3],m[4])// rgba(255, 0, 0, 1)
-:(m=reRgbaPercent.exec(format))?rgba(m[1]*255/100,m[2]*255/100,m[3]*255/100,m[4])// rgb(100%, 0%, 0%, 1)
-:(m=reHslPercent.exec(format))?hsla(m[1],m[2]/100,m[3]/100,1)// hsl(120, 50%, 50%)
-:(m=reHslaPercent.exec(format))?hsla(m[1],m[2]/100,m[3]/100,m[4])// hsla(120, 50%, 50%, 1)
-:named.hasOwnProperty(format)?rgbn(named[format])// eslint-disable-line no-prototype-builtins
-:format==="transparent"?new Rgb(NaN,NaN,NaN,0):null;}function rgbn(n){return new Rgb(n>>16&0xff,n>>8&0xff,n&0xff,1);}function rgba(r,g,b,a){if(a<=0)r=g=b=NaN;return new Rgb(r,g,b,a);}function rgbConvert(o){if(!(o instanceof Color))o=color(o);if(!o)return new Rgb();o=o.rgb();return new Rgb(o.r,o.g,o.b,o.opacity);}function rgb(r,g,b,opacity){return arguments.length===1?rgbConvert(r):new Rgb(r,g,b,opacity==null?1:opacity);}function Rgb(r,g,b,opacity){this.r=+r;this.g=+g;this.b=+b;this.opacity=+opacity;}define(Rgb,rgb,extend(Color,{brighter:function(k){k=k==null?brighter:Math.pow(brighter,k);return new Rgb(this.r*k,this.g*k,this.b*k,this.opacity);},darker:function(k){k=k==null?darker:Math.pow(darker,k);return new Rgb(this.r*k,this.g*k,this.b*k,this.opacity);},rgb:function(){return this;},displayable:function(){return -0.5<=this.r&&this.r<255.5&&-0.5<=this.g&&this.g<255.5&&-0.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1;},hex:rgb_formatHex,// Deprecated! Use color.formatHex.
-formatHex:rgb_formatHex,formatRgb:rgb_formatRgb,toString:rgb_formatRgb}));function rgb_formatHex(){return "#"+hex(this.r)+hex(this.g)+hex(this.b);}function rgb_formatRgb(){var a=this.opacity;a=isNaN(a)?1:Math.max(0,Math.min(1,a));return (a===1?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(a===1?")":", "+a+")");}function hex(value){value=Math.max(0,Math.min(255,Math.round(value)||0));return (value<16?"0":"")+value.toString(16);}function hsla(h,s,l,a){if(a<=0)h=s=l=NaN;else if(l<=0||l>=1)h=s=NaN;else if(s<=0)h=NaN;return new Hsl(h,s,l,a);}function hslConvert(o){if(o instanceof Hsl)return new Hsl(o.h,o.s,o.l,o.opacity);if(!(o instanceof Color))o=color(o);if(!o)return new Hsl();if(o instanceof Hsl)return o;o=o.rgb();var r=o.r/255,g=o.g/255,b=o.b/255,min=Math.min(r,g,b),max=Math.max(r,g,b),h=NaN,s=max-min,l=(max+min)/2;if(s){if(r===max)h=(g-b)/s+(g0&&l<1?0:h;}return new Hsl(h,s,l,o.opacity);}function hsl(h,s,l,opacity){return arguments.length===1?hslConvert(h):new Hsl(h,s,l,opacity==null?1:opacity);}function Hsl(h,s,l,opacity){this.h=+h;this.s=+s;this.l=+l;this.opacity=+opacity;}define(Hsl,hsl,extend(Color,{brighter:function(k){k=k==null?brighter:Math.pow(brighter,k);return new Hsl(this.h,this.s,this.l*k,this.opacity);},darker:function(k){k=k==null?darker:Math.pow(darker,k);return new Hsl(this.h,this.s,this.l*k,this.opacity);},rgb:function(){var h=this.h%360+(this.h<0)*360,s=isNaN(h)||isNaN(this.s)?0:this.s,l=this.l,m2=l+(l<0.5?l:1-l)*s,m1=2*l-m2;return new Rgb(hsl2rgb(h>=240?h-240:h+120,m1,m2),hsl2rgb(h,m1,m2),hsl2rgb(h<120?h+240:h-120,m1,m2),this.opacity);},displayable:function(){return (0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1;},formatHsl:function(){var a=this.opacity;a=isNaN(a)?1:Math.max(0,Math.min(1,a));return (a===1?"hsl(":"hsla(")+(this.h||0)+", "+(this.s||0)*100+"%, "+(this.l||0)*100+"%"+(a===1?")":", "+a+")");}}));/* From FvD 13.37, CSS Color Module Level 3 */function hsl2rgb(h,m1,m2){return (h<60?m1+(m2-m1)*h/60:h<180?m2:h<240?m1+(m2-m1)*(240-h)/60:m1)*255;}
-
-var constant$1 = (x=>()=>x);
-
-function linear(a,d){return function(t){return a+t*d;};}function exponential(a,b,y){return a=Math.pow(a,y),b=Math.pow(b,y)-a,y=1/y,function(t){return Math.pow(a+t*b,y);};}function gamma(y){return (y=+y)===1?nogamma:function(a,b){return b-a?exponential(a,b,y):constant$1(isNaN(a)?b:a);};}function nogamma(a,b){var d=b-a;return d?linear(a,d):constant$1(isNaN(a)?b:a);}
-
-var interpolateRgb = (function rgbGamma(y){var color=gamma(y);function rgb$1(start,end){var r=color((start=rgb(start)).r,(end=rgb(end)).r),g=color(start.g,end.g),b=color(start.b,end.b),opacity=nogamma(start.opacity,end.opacity);return function(t){start.r=r(t);start.g=g(t);start.b=b(t);start.opacity=opacity(t);return start+"";};}rgb$1.gamma=rgbGamma;return rgb$1;})(1);
-
-function numberArray(a,b){if(!b)b=[];var n=a?Math.min(b.length,a.length):0,c=b.slice(),i;return function(t){for(i=0;ibi){// a string precedes the next number in b
-bs=b.slice(bi,bs);if(s[i])s[i]+=bs;// coalesce with previous string
-else s[++i]=bs;}if((am=am[0])===(bm=bm[0])){// numbers in a & b match
-if(s[i])s[i]+=bm;// coalesce with previous string
-else s[++i]=bm;}else {// interpolate non-matching numbers
-s[++i]=null;q.push({i:i,x:interpolateNumber(am,bm)});}bi=reB.lastIndex;}// Add remains of b.
-if(bi180)b+=360;else if(b-a>180)a+=360;// shortest path
-q.push({i:s.push(pop(s)+"rotate(",null,degParen)-2,x:interpolateNumber(a,b)});}else if(b){s.push(pop(s)+"rotate("+b+degParen);}}function skewX(a,b,s,q){if(a!==b){q.push({i:s.push(pop(s)+"skewX(",null,degParen)-2,x:interpolateNumber(a,b)});}else if(b){s.push(pop(s)+"skewX("+b+degParen);}}function scale(xa,ya,xb,yb,s,q){if(xa!==xb||ya!==yb){var i=s.push(pop(s)+"scale(",null,",",null,")");q.push({i:i-4,x:interpolateNumber(xa,xb)},{i:i-2,x:interpolateNumber(ya,yb)});}else if(xb!==1||yb!==1){s.push(pop(s)+"scale("+xb+","+yb+")");}}return function(a,b){var s=[],// string constants and placeholders
-q=[];// number interpolators
-a=parse(a),b=parse(b);translate(a.translateX,a.translateY,b.translateX,b.translateY,s,q);rotate(a.rotate,b.rotate,s,q);skewX(a.skewX,b.skewX,s,q);scale(a.scaleX,a.scaleY,b.scaleX,b.scaleY,s,q);a=b=null;// gc
-return function(t){var i=-1,n=q.length,o;while(++i=0)t._call.call(null,e);t=t._next;}--frame;}function wake(){clockNow=(clockLast=clock.now())+clockSkew;frame=timeout=0;try{timerFlush();}finally{frame=0;nap();clockNow=0;}}function poke(){var now=clock.now(),delay=now-clockLast;if(delay>pokeDelay)clockSkew-=delay,clockLast=now;}function nap(){var t0,t1=taskHead,t2,time=Infinity;while(t1){if(t1._call){if(time>t1._time)time=t1._time;t0=t1,t1=t1._next;}else {t2=t1._next,t1._next=null;t1=t0?t0._next=t2:taskHead=t2;}}taskTail=t0;sleep(time);}function sleep(time){if(frame)return;// Soonest alarm already set, or will be.
-if(timeout)timeout=clearTimeout(timeout);var delay=time-clockNow;// Strictly less than if we recomputed clockNow.
-if(delay>24){if(time{t.stop();callback(elapsed+delay);},delay,time);return t;}
+/** @license React v17.0.2
+ * react.development.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
-var emptyOn=dispatch("start","end","cancel","interrupt");var emptyTween=[];var CREATED=0;var SCHEDULED=1;var STARTING=2;var STARTED=3;var RUNNING=4;var ENDING=5;var ENDED=6;function schedule(node,name,id,index,group,timing){var schedules=node.__transition;if(!schedules)node.__transition={};else if(id in schedules)return;create$1(node,id,{name:name,index:index,// For context during callback.
-group:group,// For context during callback.
-on:emptyOn,tween:emptyTween,time:timing.time,delay:timing.delay,duration:timing.duration,ease:timing.ease,timer:null,state:CREATED});}function init(node,id){var schedule=get$1(node,id);if(schedule.state>CREATED)throw new Error("too late; already scheduled");return schedule;}function set$1(node,id){var schedule=get$1(node,id);if(schedule.state>STARTED)throw new Error("too late; already running");return schedule;}function get$1(node,id){var schedule=node.__transition;if(!schedule||!(schedule=schedule[id]))throw new Error("transition not found");return schedule;}function create$1(node,id,self){var schedules=node.__transition,tween;// Initialize the self timer when the transition is created.
-// Note the actual delay is not known until the first callback!
-schedules[id]=self;self.timer=timer(schedule,0,self.time);function schedule(elapsed){self.state=SCHEDULED;self.timer.restart(start,self.delay,self.time);// If the elapsed delay is less than our first sleep, start immediately.
-if(self.delay<=elapsed)start(elapsed-self.delay);}function start(elapsed){var i,j,n,o;// If the state is not SCHEDULED, then we previously errored on start.
-if(self.state!==SCHEDULED)return stop();for(i in schedules){o=schedules[i];if(o.name!==self.name)continue;// While this element already has a starting transition during this frame,
-// defer starting an interrupting transition until that transition has a
-// chance to tick (and possibly end); see d3/d3-transition#54!
-if(o.state===STARTED)return timeout$1(start);// Interrupt the active transition, if any.
-if(o.state===RUNNING){o.state=ENDED;o.timer.stop();o.on.call("interrupt",node,node.__data__,o.index,o.group);delete schedules[i];}// Cancel any pre-empted transitions.
-else if(+iSTARTING&&schedule.state=0)t=t.slice(0,i);return !t||t==="start";});}function onFunction(id,name,listener){var on0,on1,sit=start(name)?init:set$1;return function(){var schedule=sit(this,id),on=schedule.on;// If this node shared a dispatch with the previous node,
-// just assign the updated shared dispatch and weโre done!
-// Otherwise, copy-on-write.
-if(on!==on0)(on1=(on0=on).copy()).on(name,listener);schedule.on=on1;};}function transition_on(name,listener){var id=this._id;return arguments.length<2?get$1(this.node(),id).on.on(name):this.each(onFunction(id,name,listener));}
-
-function removeFunction(id){return function(){var parent=this.parentNode;for(var i in this.__transition)if(+i!==id)return;if(parent)parent.removeChild(this);};}function transition_remove(){return this.on("end.remove",removeFunction(this._id));}
-
-function transition_select(select){var name=this._name,id=this._id;if(typeof select!=="function")select=selector(select);for(var groups=this._groups,m=groups.length,subgroups=new Array(m),j=0;j=1e21?x.toLocaleString("en").replace(/,/g,""):x.toString(10);}// Computes the decimal coefficient and exponent of the specified number x with
-// significant digits p, where x is positive and p is in [1, 21] or undefined.
-// For example, formatDecimalParts(1.23) returns ["123", 0].
-function formatDecimalParts(x,p){if((i=(x=p?x.toExponential(p-1):x.toExponential()).indexOf("e"))<0)return null;// NaN, ยฑInfinity
-var i,coefficient=x.slice(0,i);// The string returned by toExponential either has the form \d\.\d+e[-+]\d+
-// (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
-return [coefficient.length>1?coefficient[0]+coefficient.slice(2):coefficient,+x.slice(i+1)];}
-
-function exponent(x){return x=formatDecimalParts(Math.abs(x)),x?x[1]:NaN;}
-
-function formatGroup(grouping,thousands){return function(value,width){var i=value.length,t=[],j=0,g=grouping[0],length=0;while(i>0&&g>0){if(length+g+1>width)g=Math.max(1,width-length);t.push(value.substring(i-=g,i+g));if((length+=g+1)>width)break;g=grouping[j=(j+1)%grouping.length];}return t.reverse().join(thousands);};}
-
-function formatNumerals(numerals){return function(value){return value.replace(/[0-9]/g,function(i){return numerals[+i];});};}
-
-// [[fill]align][sign][symbol][0][width][,][.precision][~][type]
-var re=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function formatSpecifier(specifier){if(!(match=re.exec(specifier)))throw new Error("invalid format: "+specifier);var match;return new FormatSpecifier({fill:match[1],align:match[2],sign:match[3],symbol:match[4],zero:match[5],width:match[6],comma:match[7],precision:match[8]&&match[8].slice(1),trim:match[9],type:match[10]});}formatSpecifier.prototype=FormatSpecifier.prototype;// instanceof
-function FormatSpecifier(specifier){this.fill=specifier.fill===undefined?" ":specifier.fill+"";this.align=specifier.align===undefined?">":specifier.align+"";this.sign=specifier.sign===undefined?"-":specifier.sign+"";this.symbol=specifier.symbol===undefined?"":specifier.symbol+"";this.zero=!!specifier.zero;this.width=specifier.width===undefined?undefined:+specifier.width;this.comma=!!specifier.comma;this.precision=specifier.precision===undefined?undefined:+specifier.precision;this.trim=!!specifier.trim;this.type=specifier.type===undefined?"":specifier.type+"";}FormatSpecifier.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===undefined?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===undefined?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type;};
-
-// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
-function formatTrim(s){out:for(var n=s.length,i=1,i0=-1,i1;i0)i0=0;break;}}return i0>0?s.slice(0,i0)+s.slice(i1+1):s;}
-
-var prefixExponent;function formatPrefixAuto(x,p){var d=formatDecimalParts(x,p);if(!d)return x+"";var coefficient=d[0],exponent=d[1],i=exponent-(prefixExponent=Math.max(-8,Math.min(8,Math.floor(exponent/3)))*3)+1,n=coefficient.length;return i===n?coefficient:i>n?coefficient+new Array(i-n+1).join("0"):i>0?coefficient.slice(0,i)+"."+coefficient.slice(i):"0."+new Array(1-i).join("0")+formatDecimalParts(x,Math.max(0,p+i-1))[0];// less than 1y!
-}
-
-function formatRounded(x,p){var d=formatDecimalParts(x,p);if(!d)return x+"";var coefficient=d[0],exponent=d[1];return exponent<0?"0."+new Array(-exponent).join("0")+coefficient:coefficient.length>exponent+1?coefficient.slice(0,exponent+1)+"."+coefficient.slice(exponent+1):coefficient+new Array(exponent-coefficient.length+2).join("0");}
-
-var formatTypes = {"%":(x,p)=>(x*100).toFixed(p),"b":x=>Math.round(x).toString(2),"c":x=>x+"","d":formatDecimal,"e":(x,p)=>x.toExponential(p),"f":(x,p)=>x.toFixed(p),"g":(x,p)=>x.toPrecision(p),"o":x=>Math.round(x).toString(8),"p":(x,p)=>formatRounded(x*100,p),"r":formatRounded,"s":formatPrefixAuto,"X":x=>Math.round(x).toString(16).toUpperCase(),"x":x=>Math.round(x).toString(16)};
-
-function identity$1(x){return x;}
-
-var map=Array.prototype.map,prefixes=["y","z","a","f","p","n","ยต","m","","k","M","G","T","P","E","Z","Y"];function formatLocale(locale){var group=locale.grouping===undefined||locale.thousands===undefined?identity$1:formatGroup(map.call(locale.grouping,Number),locale.thousands+""),currencyPrefix=locale.currency===undefined?"":locale.currency[0]+"",currencySuffix=locale.currency===undefined?"":locale.currency[1]+"",decimal=locale.decimal===undefined?".":locale.decimal+"",numerals=locale.numerals===undefined?identity$1:formatNumerals(map.call(locale.numerals,String)),percent=locale.percent===undefined?"%":locale.percent+"",minus=locale.minus===undefined?"โ":locale.minus+"",nan=locale.nan===undefined?"NaN":locale.nan+"";function newFormat(specifier){specifier=formatSpecifier(specifier);var fill=specifier.fill,align=specifier.align,sign=specifier.sign,symbol=specifier.symbol,zero=specifier.zero,width=specifier.width,comma=specifier.comma,precision=specifier.precision,trim=specifier.trim,type=specifier.type;// The "n" type is an alias for ",g".
-if(type==="n")comma=true,type="g";// The "" type, and any invalid type, is an alias for ".12~g".
-else if(!formatTypes[type])precision===undefined&&(precision=12),trim=true,type="g";// If zero fill is specified, padding goes after sign and before digits.
-if(zero||fill==="0"&&align==="=")zero=true,fill="0",align="=";// Compute the prefix and suffix.
-// For SI-prefix, the suffix is lazily computed.
-var prefix=symbol==="$"?currencyPrefix:symbol==="#"&&/[boxX]/.test(type)?"0"+type.toLowerCase():"",suffix=symbol==="$"?currencySuffix:/[%p]/.test(type)?percent:"";// What format function should we use?
-// Is this an integer type?
-// Can this type generate exponential notation?
-var formatType=formatTypes[type],maybeSuffix=/[defgprs%]/.test(type);// Set the default precision if not specified,
-// or clamp the specified precision to the supported range.
-// For significant precision, it must be in [1, 21].
-// For fixed precision, it must be in [0, 20].
-precision=precision===undefined?6:/[gprs]/.test(type)?Math.max(1,Math.min(21,precision)):Math.max(0,Math.min(20,precision));function format(value){var valuePrefix=prefix,valueSuffix=suffix,i,n,c;if(type==="c"){valueSuffix=formatType(value)+valueSuffix;value="";}else {value=+value;// Determine the sign. -0 is not less than 0, but 1 / -0 is!
-var valueNegative=value<0||1/value<0;// Perform the initial formatting.
-value=isNaN(value)?nan:formatType(Math.abs(value),precision);// Trim insignificant zeros.
-if(trim)value=formatTrim(value);// If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.
-if(valueNegative&&+value===0&&sign!=="+")valueNegative=false;// Compute the prefix and suffix.
-valuePrefix=(valueNegative?sign==="("?sign:minus:sign==="-"||sign==="("?"":sign)+valuePrefix;valueSuffix=(type==="s"?prefixes[8+prefixExponent/3]:"")+valueSuffix+(valueNegative&&sign==="("?")":"");// Break the formatted value into the integer โvalueโ part that can be
-// grouped, and fractional or exponential โsuffixโ part that is not.
-if(maybeSuffix){i=-1,n=value.length;while(++ic||c>57){valueSuffix=(c===46?decimal+value.slice(i+1):value.slice(i))+valueSuffix;value=value.slice(0,i);break;}}}}// If the fill character is not "0", grouping is applied before padding.
-if(comma&&!zero)value=group(value,Infinity);// Compute the padding.
-var length=valuePrefix.length+value.length+valueSuffix.length,padding=length>1)+valuePrefix+value+valueSuffix+padding.slice(length);break;default:value=padding+valuePrefix+value+valueSuffix;break;}return numerals(value);}format.toString=function(){return specifier+"";};return format;}function formatPrefix(specifier,value){var f=newFormat((specifier=formatSpecifier(specifier),specifier.type="f",specifier)),e=Math.max(-8,Math.min(8,Math.floor(exponent(value)/3)))*3,k=Math.pow(10,-e),prefix=prefixes[8+e/3];return function(value){return f(k*value)+prefix;};}return {format:newFormat,formatPrefix:formatPrefix};}
-
-var locale;var format;var formatPrefix;defaultLocale({thousands:",",grouping:[3],currency:["$",""]});function defaultLocale(definition){locale=formatLocale(definition);format=locale.format;formatPrefix=locale.formatPrefix;return locale;}
-
-function precisionFixed(step){return Math.max(0,-exponent(Math.abs(step)));}
-
-function precisionPrefix(step,value){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(exponent(value)/3)))*3-exponent(Math.abs(step)));}
-
-function precisionRound(step,max){step=Math.abs(step),max=Math.abs(max)-step;return Math.max(0,exponent(max)-exponent(step))+1;}
-
-function initRange(domain,range){switch(arguments.length){case 0:break;case 1:this.range(domain);break;default:this.range(range).domain(domain);break;}return this;}
-
-function constants(x){return function(){return x;};}
-
-function number$2(x){return +x;}
-
-var unit=[0,1];function identity$2(x){return x;}function normalize(a,b){return (b-=a=+a)?function(x){return (x-a)/b;}:constants(isNaN(b)?NaN:0.5);}function clamper(a,b){var t;if(a>b)t=a,a=b,b=t;return function(x){return Math.max(a,Math.min(b,x));};}// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].
-// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].
-function bimap(domain,range,interpolate){var d0=domain[0],d1=domain[1],r0=range[0],r1=range[1];if(d12?polymap:bimap;output=input=null;return scale;}function scale(x){return x==null||isNaN(x=+x)?unknown:(output||(output=piecewise(domain.map(transform),range,interpolate$1)))(transform(clamp(x)));}scale.invert=function(y){return clamp(untransform((input||(input=piecewise(range,domain.map(transform),interpolateNumber)))(y)));};scale.domain=function(_){return arguments.length?(domain=Array.from(_,number$2),rescale()):domain.slice();};scale.range=function(_){return arguments.length?(range=Array.from(_),rescale()):range.slice();};scale.rangeRound=function(_){return range=Array.from(_),interpolate$1=interpolateRound,rescale();};scale.clamp=function(_){return arguments.length?(clamp=_?true:identity$2,rescale()):clamp!==identity$2;};scale.interpolate=function(_){return arguments.length?(interpolate$1=_,rescale()):interpolate$1;};scale.unknown=function(_){return arguments.length?(unknown=_,scale):unknown;};return function(t,u){transform=t,untransform=u;return rescale();};}function continuous(){return transformer()(identity$2,identity$2);}
-
-function tickFormat(start,stop,count,specifier){var step=tickStep(start,stop,count),precision;specifier=formatSpecifier(specifier==null?",f":specifier);switch(specifier.type){case"s":{var value=Math.max(Math.abs(start),Math.abs(stop));if(specifier.precision==null&&!isNaN(precision=precisionPrefix(step,value)))specifier.precision=precision;return formatPrefix(specifier,value);}case"":case"e":case"g":case"p":case"r":{if(specifier.precision==null&&!isNaN(precision=precisionRound(step,Math.max(Math.abs(start),Math.abs(stop)))))specifier.precision=precision-(specifier.type==="e");break;}case"f":case"%":{if(specifier.precision==null&&!isNaN(precision=precisionFixed(step)))specifier.precision=precision-(specifier.type==="%")*2;break;}}return format(specifier);}
-
-function linearish(scale){var domain=scale.domain;scale.ticks=function(count){var d=domain();return ticks(d[0],d[d.length-1],count==null?10:count);};scale.tickFormat=function(count,specifier){var d=domain();return tickFormat(d[0],d[d.length-1],count==null?10:count,specifier);};scale.nice=function(count){if(count==null)count=10;var d=domain();var i0=0;var i1=d.length-1;var start=d[i0];var stop=d[i1];var prestep;var step;var maxIter=10;if(stop0){step=tickIncrement(start,stop,count);if(step===prestep){d[i0]=start;d[i1]=stop;return domain(d);}else if(step>0){start=Math.floor(start/step)*step;stop=Math.ceil(stop/step)*step;}else if(step<0){start=Math.ceil(start*step)/step;stop=Math.floor(stop*step)/step;}else {break;}prestep=step;}return scale;};return scale;}function linear$1(){var scale=continuous();scale.copy=function(){return copy(scale,linear$1());};initRange.apply(scale,arguments);return linearish(scale);}
-
-const LedgerViewType = 'ledger';
-class LedgerView extends obsidian.ItemView {
- constructor(leaf, plugin) {
- super(leaf);
- this.redraw = () => {
- const contentEl = this.containerEl.children[1];
- console.debug('ledger: Rendering preview for ledger file');
- contentEl.empty();
- const p = contentEl.createEl('p');
- p.setText('Hello world 2');
- const div = contentEl.createDiv();
- div.appendChild(this.makeSimpleBarD3());
- };
- this.makeSimpleBarD3 = () => {
- // https://www.essycode.com/posts/create-sparkline-charts-d3/
- const WIDTH = 160;
- const HEIGHT = 30;
- const DATA_COUNT = 40;
- const BAR_WIDTH = (WIDTH - DATA_COUNT) / DATA_COUNT;
- const data = range(DATA_COUNT).map((d) => Math.random());
- const x = linear$1().domain([0, DATA_COUNT]).range([0, WIDTH]);
- const y = linear$1().domain([0, 1]).range([HEIGHT, 0]);
- const svg = create('svg').attr('width', WIDTH).attr('height', HEIGHT);
- const g = svg.append('g');
- g.selectAll('.bar')
- .data(data)
- .enter()
- .append('rect')
- .attr('class', 'bar')
- .attr('x', (d, i) => x(i))
- .attr('y', (d) => HEIGHT - y(d))
- .attr('width', BAR_WIDTH)
- .attr('height', (d) => y(d))
- .attr('fill', 'MediumSeaGreen');
- return svg.node();
- };
- this.reloadData = () => {
- throw new Error('Not Implemented');
- };
- this.plugin = plugin;
- this.registerEvent(this.app.vault.on('modify', (file) => {
- if (file.path === this.plugin.settings.ledgerFile) {
- this.reloadData();
- }
- }));
- this.reloadData();
- this.redraw();
- }
- getViewType() {
- return LedgerViewType;
- }
- getDisplayText() {
- return 'Ledger';
- }
- getIcon() {
- return 'ledger';
- }
-}
-
-const defaultSettings = {
- currencySymbol: '$',
- ledgerFile: 'Ledger.md',
- includeFinalLineAmount: false,
- enableLedgerVis: false,
- assetAccountsPrefix: 'Assets',
- expenseAccountsPrefix: 'Expenses',
- incomeAccountsPrefix: 'Income',
- liabilityAccountsPrefix: 'Liabilities',
-};
-const settingsWithDefaults = (settings) => ({
- ...defaultSettings,
- ...settings,
-});
-class SettingsTab extends obsidian.PluginSettingTab {
- constructor(plugin) {
- super(plugin.app, plugin);
- this.plugin = plugin;
- }
- display() {
- const { containerEl } = this;
- containerEl.empty();
- containerEl.createEl('h2', { text: 'Ledger Plugin - Settings' });
- new obsidian.Setting(containerEl)
- .setName('Currency Symbol')
- .setDesc('Prefixes all transaction amounts')
- .addText((text) => {
- text.setPlaceholder('$').setValue(this.plugin.settings.currencySymbol);
- text.inputEl.onblur = (e) => {
- this.plugin.settings.currencySymbol = e.target.value;
- this.plugin.saveData(this.plugin.settings);
- };
- });
- new obsidian.Setting(containerEl)
- .setName('Ledger File')
- .setDesc('Path in the Vault to your Ledger file. Must be a .md file.')
- .addText((text) => {
- text
- .setValue(this.plugin.settings.ledgerFile)
- .setPlaceholder('Ledger.md');
- text.inputEl.onblur = (e) => {
- this.plugin.settings.ledgerFile = e.target.value;
- this.plugin.saveData(this.plugin.settings);
- };
- });
- new obsidian.Setting(containerEl)
- .setName('Include final line amount')
- .setDesc('Include the dollar amount on the final line of a transaction. This value is optional, and is alway equal to the sum of the previous lines * -1.')
- .addToggle((toggle) => {
- toggle
- .setValue(this.plugin.settings.includeFinalLineAmount)
- .onChange((value) => {
- this.plugin.settings.includeFinalLineAmount = value;
- this.plugin.saveData(this.plugin.settings);
- });
- });
- containerEl.createEl('h3', 'Transaction Category Prefixes');
- containerEl.createEl('p', {
- text: "Ledger uses categories to group exense types. Categories are grouped into a hierarchy by separating with a colon. For example 'expenses:food:grocery' and 'expenses:food:restaurants",
- });
- new obsidian.Setting(containerEl)
- .setName('Asset Category Prefix')
- .setDesc('The category prefix used for grouping asset accounts. If you use aliases in your Ledger file, this must be the **unaliased** category prefix. e.g. "Assets" instead of "a"')
- .addText((text) => {
- text.setValue(this.plugin.settings.assetAccountsPrefix);
- text.inputEl.onblur = (e) => {
- this.plugin.settings.assetAccountsPrefix = e.target.value;
- this.plugin.saveData(this.plugin.settings);
- };
- });
- new obsidian.Setting(containerEl)
- .setName('Expense Category Prefix')
- .setDesc('The category prefix used for grouping expense accounts. If you use aliases in your Ledger file, this must be the **unaliased** category prefix. e.g. "Expenses" instead of "e"')
- .addText((text) => {
- text.setValue(this.plugin.settings.expenseAccountsPrefix);
- text.inputEl.onblur = (e) => {
- this.plugin.settings.expenseAccountsPrefix = e.target.value;
- this.plugin.saveData(this.plugin.settings);
- };
- });
- new obsidian.Setting(containerEl)
- .setName('Income Category Prefix')
- .setDesc('The category prefix used for grouping income accounts. If you use aliases in your Ledger file, this must be the **unaliased** category prefix. e.g. "Income" instead of "i"')
- .addText((text) => {
- text.setValue(this.plugin.settings.incomeAccountsPrefix);
- text.inputEl.onblur = (e) => {
- this.plugin.settings.incomeAccountsPrefix = e.target.value;
- this.plugin.saveData(this.plugin.settings);
- };
- });
- new obsidian.Setting(containerEl)
- .setName('Liability Category Prefix')
- .setDesc('The category prefix used for grouping liability accounts. If you use aliases in your Ledger file, this must be the **unaliased** category prefix. e.g. "Liabilities" instead of "l"')
- .addText((text) => {
- text.setValue(this.plugin.settings.liabilityAccountsPrefix);
- text.inputEl.onblur = (e) => {
- this.plugin.settings.liabilityAccountsPrefix = e.target.value;
- this.plugin.saveData(this.plugin.settings);
- };
- });
- const div = containerEl.createEl('div', {
- cls: 'ledger-donation',
- });
- const donateText = document.createElement('p');
- donateText.appendText('If this plugin adds value for you and you would like to help support ' +
- 'continued development, please use the buttons below:');
- div.appendChild(donateText);
- const parser = new DOMParser();
- div.appendChild(createDonateButton('https://paypal.me/tgrosinger', parser.parseFromString(paypal, 'text/xml').documentElement));
- div.appendChild(createDonateButton('https://www.buymeacoffee.com/tgrosinger', parser.parseFromString(buyMeACoffee, 'text/xml').documentElement));
- }
-}
-const createDonateButton = (link, img) => {
- const a = document.createElement('a');
- a.setAttribute('href', link);
- a.addClass('ledger-donate-button');
- a.appendChild(img);
- return a;
-};
-
-/** @license React v16.13.1
- * react-is.development.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-var reactIs_development = createCommonjsModule(function (module, exports) {
-{(function(){// nor polyfill, then a plain number is used for performance.
-var hasSymbol=typeof Symbol==='function'&&Symbol.for;var REACT_ELEMENT_TYPE=hasSymbol?Symbol.for('react.element'):0xeac7;var REACT_PORTAL_TYPE=hasSymbol?Symbol.for('react.portal'):0xeaca;var REACT_FRAGMENT_TYPE=hasSymbol?Symbol.for('react.fragment'):0xeacb;var REACT_STRICT_MODE_TYPE=hasSymbol?Symbol.for('react.strict_mode'):0xeacc;var REACT_PROFILER_TYPE=hasSymbol?Symbol.for('react.profiler'):0xead2;var REACT_PROVIDER_TYPE=hasSymbol?Symbol.for('react.provider'):0xeacd;var REACT_CONTEXT_TYPE=hasSymbol?Symbol.for('react.context'):0xeace;// TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
-// (unstable) APIs that have been removed. Can we remove the symbols?
-var REACT_ASYNC_MODE_TYPE=hasSymbol?Symbol.for('react.async_mode'):0xeacf;var REACT_CONCURRENT_MODE_TYPE=hasSymbol?Symbol.for('react.concurrent_mode'):0xeacf;var REACT_FORWARD_REF_TYPE=hasSymbol?Symbol.for('react.forward_ref'):0xead0;var REACT_SUSPENSE_TYPE=hasSymbol?Symbol.for('react.suspense'):0xead1;var REACT_SUSPENSE_LIST_TYPE=hasSymbol?Symbol.for('react.suspense_list'):0xead8;var REACT_MEMO_TYPE=hasSymbol?Symbol.for('react.memo'):0xead3;var REACT_LAZY_TYPE=hasSymbol?Symbol.for('react.lazy'):0xead4;var REACT_BLOCK_TYPE=hasSymbol?Symbol.for('react.block'):0xead9;var REACT_FUNDAMENTAL_TYPE=hasSymbol?Symbol.for('react.fundamental'):0xead5;var REACT_RESPONDER_TYPE=hasSymbol?Symbol.for('react.responder'):0xead6;var REACT_SCOPE_TYPE=hasSymbol?Symbol.for('react.scope'):0xead7;function isValidElementType(type){return typeof type==='string'||typeof type==='function'||// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
-type===REACT_FRAGMENT_TYPE||type===REACT_CONCURRENT_MODE_TYPE||type===REACT_PROFILER_TYPE||type===REACT_STRICT_MODE_TYPE||type===REACT_SUSPENSE_TYPE||type===REACT_SUSPENSE_LIST_TYPE||typeof type==='object'&&type!==null&&(type.$$typeof===REACT_LAZY_TYPE||type.$$typeof===REACT_MEMO_TYPE||type.$$typeof===REACT_PROVIDER_TYPE||type.$$typeof===REACT_CONTEXT_TYPE||type.$$typeof===REACT_FORWARD_REF_TYPE||type.$$typeof===REACT_FUNDAMENTAL_TYPE||type.$$typeof===REACT_RESPONDER_TYPE||type.$$typeof===REACT_SCOPE_TYPE||type.$$typeof===REACT_BLOCK_TYPE);}function typeOf(object){if(typeof object==='object'&&object!==null){var $$typeof=object.$$typeof;switch($$typeof){case REACT_ELEMENT_TYPE:var type=object.type;switch(type){case REACT_ASYNC_MODE_TYPE:case REACT_CONCURRENT_MODE_TYPE:case REACT_FRAGMENT_TYPE:case REACT_PROFILER_TYPE:case REACT_STRICT_MODE_TYPE:case REACT_SUSPENSE_TYPE:return type;default:var $$typeofType=type&&type.$$typeof;switch($$typeofType){case REACT_CONTEXT_TYPE:case REACT_FORWARD_REF_TYPE:case REACT_LAZY_TYPE:case REACT_MEMO_TYPE:case REACT_PROVIDER_TYPE:return $$typeofType;default:return $$typeof;}}case REACT_PORTAL_TYPE:return $$typeof;}}return undefined;}// AsyncMode is deprecated along with isAsyncMode
-var AsyncMode=REACT_ASYNC_MODE_TYPE;var ConcurrentMode=REACT_CONCURRENT_MODE_TYPE;var ContextConsumer=REACT_CONTEXT_TYPE;var ContextProvider=REACT_PROVIDER_TYPE;var Element=REACT_ELEMENT_TYPE;var ForwardRef=REACT_FORWARD_REF_TYPE;var Fragment=REACT_FRAGMENT_TYPE;var Lazy=REACT_LAZY_TYPE;var Memo=REACT_MEMO_TYPE;var Portal=REACT_PORTAL_TYPE;var Profiler=REACT_PROFILER_TYPE;var StrictMode=REACT_STRICT_MODE_TYPE;var Suspense=REACT_SUSPENSE_TYPE;var hasWarnedAboutDeprecatedIsAsyncMode=false;// AsyncMode should be deprecated
-function isAsyncMode(object){{if(!hasWarnedAboutDeprecatedIsAsyncMode){hasWarnedAboutDeprecatedIsAsyncMode=true;// Using console['warn'] to evade Babel and ESLint
-console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, '+'and will be removed in React 17+. Update your code to use '+'ReactIs.isConcurrentMode() instead. It has the exact same API.');}}return isConcurrentMode(object)||typeOf(object)===REACT_ASYNC_MODE_TYPE;}function isConcurrentMode(object){return typeOf(object)===REACT_CONCURRENT_MODE_TYPE;}function isContextConsumer(object){return typeOf(object)===REACT_CONTEXT_TYPE;}function isContextProvider(object){return typeOf(object)===REACT_PROVIDER_TYPE;}function isElement(object){return typeof object==='object'&&object!==null&&object.$$typeof===REACT_ELEMENT_TYPE;}function isForwardRef(object){return typeOf(object)===REACT_FORWARD_REF_TYPE;}function isFragment(object){return typeOf(object)===REACT_FRAGMENT_TYPE;}function isLazy(object){return typeOf(object)===REACT_LAZY_TYPE;}function isMemo(object){return typeOf(object)===REACT_MEMO_TYPE;}function isPortal(object){return typeOf(object)===REACT_PORTAL_TYPE;}function isProfiler(object){return typeOf(object)===REACT_PROFILER_TYPE;}function isStrictMode(object){return typeOf(object)===REACT_STRICT_MODE_TYPE;}function isSuspense(object){return typeOf(object)===REACT_SUSPENSE_TYPE;}exports.AsyncMode=AsyncMode;exports.ConcurrentMode=ConcurrentMode;exports.ContextConsumer=ContextConsumer;exports.ContextProvider=ContextProvider;exports.Element=Element;exports.ForwardRef=ForwardRef;exports.Fragment=Fragment;exports.Lazy=Lazy;exports.Memo=Memo;exports.Portal=Portal;exports.Profiler=Profiler;exports.StrictMode=StrictMode;exports.Suspense=Suspense;exports.isAsyncMode=isAsyncMode;exports.isConcurrentMode=isConcurrentMode;exports.isContextConsumer=isContextConsumer;exports.isContextProvider=isContextProvider;exports.isElement=isElement;exports.isForwardRef=isForwardRef;exports.isFragment=isFragment;exports.isLazy=isLazy;exports.isMemo=isMemo;exports.isPortal=isPortal;exports.isProfiler=isProfiler;exports.isStrictMode=isStrictMode;exports.isSuspense=isSuspense;exports.isValidElementType=isValidElementType;exports.typeOf=typeOf;})();}
-});
-
-var reactIs = createCommonjsModule(function (module) {
-{module.exports=reactIs_development;}
-});
-
-/*
-object-assign
-(c) Sindre Sorhus
-@license MIT
-*/
-/* eslint-disable no-unused-vars */var getOwnPropertySymbols=Object.getOwnPropertySymbols;var hasOwnProperty=Object.prototype.hasOwnProperty;var propIsEnumerable=Object.prototype.propertyIsEnumerable;function toObject(val){if(val===null||val===undefined){throw new TypeError('Object.assign cannot be called with null or undefined');}return Object(val);}function shouldUseNative(){try{if(!Object.assign){return false;}// Detect buggy property enumeration order in older V8 versions.
-// https://bugs.chromium.org/p/v8/issues/detail?id=4118
-var test1=new String('abc');// eslint-disable-line no-new-wrappers
-test1[5]='de';if(Object.getOwnPropertyNames(test1)[0]==='5'){return false;}// https://bugs.chromium.org/p/v8/issues/detail?id=3056
-var test2={};for(var i=0;i<10;i++){test2['_'+String.fromCharCode(i)]=i;}var order2=Object.getOwnPropertyNames(test2).map(function(n){return test2[n];});if(order2.join('')!=='0123456789'){return false;}// https://bugs.chromium.org/p/v8/issues/detail?id=3056
-var test3={};'abcdefghijklmnopqrst'.split('').forEach(function(letter){test3[letter]=letter;});if(Object.keys(Object.assign({},test3)).join('')!=='abcdefghijklmnopqrst'){return false;}return true;}catch(err){// We don't expect any of the above to throw, but better to be safe.
-return false;}}var objectAssign=shouldUseNative()?Object.assign:function(target,source){var from;var to=toObject(target);var symbols;for(var s=1;s1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}printWarning('warn',format,args);}}function error(format){{for(var _len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2];}printWarning('error',format,args);}}function printWarning(level,format,args){// When changing this logic, you might want to also
-// update consoleWithStackDev.www.js as well.
-{var ReactDebugCurrentFrame=ReactSharedInternals.ReactDebugCurrentFrame;var stack=ReactDebugCurrentFrame.getStackAddendum();if(stack!==''){format+='%s';args=args.concat([stack]);}var argsWithFormat=args.map(function(item){return ''+item;});// Careful: RN currently depends on this prefix
-argsWithFormat.unshift('Warning: '+format);// We intentionally don't use spread (or .apply) directly because it
-// breaks IE9: https://github.com/facebook/react/issues/13610
-// eslint-disable-next-line react-internal/no-production-logging
-Function.prototype.apply.call(console[level],console,argsWithFormat);}}var didWarnStateUpdateForUnmountedComponent={};function warnNoop(publicInstance,callerName){{var _constructor=publicInstance.constructor;var componentName=_constructor&&(_constructor.displayName||_constructor.name)||'ReactClass';var warningKey=componentName+"."+callerName;if(didWarnStateUpdateForUnmountedComponent[warningKey]){return;}error("Can't call %s on a component that is not yet mounted. "+'This is a no-op, but it might indicate a bug in your application. '+'Instead, assign to `this.state` directly or define a `state = {};` '+'class property with the desired state in the %s component.',callerName,componentName);didWarnStateUpdateForUnmountedComponent[warningKey]=true;}}/**
- * This is the abstract API for an update queue.
- */var ReactNoopUpdateQueue={/**
- * Checks whether or not this composite component is mounted.
- * @param {ReactClass} publicInstance The instance we want to test.
- * @return {boolean} True if mounted, false otherwise.
- * @protected
- * @final
- */isMounted:function(publicInstance){return false;},/**
- * Forces an update. This should only be invoked when it is known with
- * certainty that we are **not** in a DOM transaction.
- *
- * You may want to call this when you know that some deeper aspect of the
- * component's state has changed but `setState` was not called.
- *
- * This will not invoke `shouldComponentUpdate`, but it will invoke
- * `componentWillUpdate` and `componentDidUpdate`.
- *
- * @param {ReactClass} publicInstance The instance that should rerender.
- * @param {?function} callback Called after component is updated.
- * @param {?string} callerName name of the calling function in the public API.
- * @internal
- */enqueueForceUpdate:function(publicInstance,callback,callerName){warnNoop(publicInstance,'forceUpdate');},/**
- * Replaces all of the state. Always use this or `setState` to mutate state.
- * You should treat `this.state` as immutable.
- *
- * There is no guarantee that `this.state` will be immediately updated, so
- * accessing `this.state` after calling this method may return the old value.
- *
- * @param {ReactClass} publicInstance The instance that should rerender.
- * @param {object} completeState Next state.
- * @param {?function} callback Called after component is updated.
- * @param {?string} callerName name of the calling function in the public API.
- * @internal
- */enqueueReplaceState:function(publicInstance,completeState,callback,callerName){warnNoop(publicInstance,'replaceState');},/**
- * Sets a subset of the state. This only exists because _pendingState is
- * internal. This provides a merging strategy that is not available to deep
- * properties which is confusing. TODO: Expose pendingState or don't use it
- * during the merge.
- *
- * @param {ReactClass} publicInstance The instance that should rerender.
- * @param {object} partialState Next partial state to be merged with state.
- * @param {?function} callback Called after component is updated.
- * @param {?string} Name of the calling function in the public API.
- * @internal
- */enqueueSetState:function(publicInstance,partialState,callback,callerName){warnNoop(publicInstance,'setState');}};var emptyObject={};{Object.freeze(emptyObject);}/**
- * Base class helpers for the updating state of a component.
- */function Component(props,context,updater){this.props=props;this.context=context;// If a component has string refs, we will assign a different object later.
-this.refs=emptyObject;// We initialize the default updater but the real one gets injected by the
-// renderer.
-this.updater=updater||ReactNoopUpdateQueue;}Component.prototype.isReactComponent={};/**
- * Sets a subset of the state. Always use this to mutate
- * state. You should treat `this.state` as immutable.
- *
- * There is no guarantee that `this.state` will be immediately updated, so
- * accessing `this.state` after calling this method may return the old value.
- *
- * There is no guarantee that calls to `setState` will run synchronously,
- * as they may eventually be batched together. You can provide an optional
- * callback that will be executed when the call to setState is actually
- * completed.
- *
- * When a function is provided to setState, it will be called at some point in
- * the future (not synchronously). It will be called with the up to date
- * component arguments (state, props, context). These values can be different
- * from this.* because your function may be called after receiveProps but before
- * shouldComponentUpdate, and this new state, props, and context will not yet be
- * assigned to this.
- *
- * @param {object|function} partialState Next partial state or function to
- * produce next partial state to be merged with current state.
- * @param {?function} callback Called after state is updated.
- * @final
- * @protected
- */Component.prototype.setState=function(partialState,callback){if(!(typeof partialState==='object'||typeof partialState==='function'||partialState==null)){{throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");}}this.updater.enqueueSetState(this,partialState,callback,'setState');};/**
- * Forces an update. This should only be invoked when it is known with
- * certainty that we are **not** in a DOM transaction.
- *
- * You may want to call this when you know that some deeper aspect of the
- * component's state has changed but `setState` was not called.
- *
- * This will not invoke `shouldComponentUpdate`, but it will invoke
- * `componentWillUpdate` and `componentDidUpdate`.
- *
- * @param {?function} callback Called after update is complete.
- * @final
- * @protected
- */Component.prototype.forceUpdate=function(callback){this.updater.enqueueForceUpdate(this,callback,'forceUpdate');};/**
- * Deprecated APIs. These APIs used to exist on classic React classes but since
- * we would like to deprecate them, we're not going to move them over to this
- * modern base class. Instead, we define a getter that warns if it's accessed.
- */{var deprecatedAPIs={isMounted:['isMounted','Instead, make sure to clean up subscriptions and pending requests in '+'componentWillUnmount to prevent memory leaks.'],replaceState:['replaceState','Refactor your code to use setState instead (see '+'https://github.com/facebook/react/issues/3236).']};var defineDeprecationWarning=function(methodName,info){Object.defineProperty(Component.prototype,methodName,{get:function(){warn('%s(...) is deprecated in plain JavaScript React classes. %s',info[0],info[1]);return undefined;}});};for(var fnName in deprecatedAPIs){if(deprecatedAPIs.hasOwnProperty(fnName)){defineDeprecationWarning(fnName,deprecatedAPIs[fnName]);}}}function ComponentDummy(){}ComponentDummy.prototype=Component.prototype;/**
- * Convenience component with default shallow equality check for sCU.
- */function PureComponent(props,context,updater){this.props=props;this.context=context;// If a component has string refs, we will assign a different object later.
-this.refs=emptyObject;this.updater=updater||ReactNoopUpdateQueue;}var pureComponentPrototype=PureComponent.prototype=new ComponentDummy();pureComponentPrototype.constructor=PureComponent;// Avoid an extra prototype jump for these methods.
-_assign(pureComponentPrototype,Component.prototype);pureComponentPrototype.isPureReactComponent=true;// an immutable object with a single mutable value
-function createRef(){var refObject={current:null};{Object.seal(refObject);}return refObject;}function getWrappedName(outerType,innerType,wrapperName){var functionName=innerType.displayName||innerType.name||'';return outerType.displayName||(functionName!==''?wrapperName+"("+functionName+")":wrapperName);}function getContextName(type){return type.displayName||'Context';}function getComponentName(type){if(type==null){// Host root, text node or just invalid type.
-return null;}{if(typeof type.tag==='number'){error('Received an unexpected object in getComponentName(). '+'This is likely a bug in React. Please file an issue.');}}if(typeof type==='function'){return type.displayName||type.name||null;}if(typeof type==='string'){return type;}switch(type){case exports.Fragment:return 'Fragment';case REACT_PORTAL_TYPE:return 'Portal';case exports.Profiler:return 'Profiler';case exports.StrictMode:return 'StrictMode';case exports.Suspense:return 'Suspense';case REACT_SUSPENSE_LIST_TYPE:return 'SuspenseList';}if(typeof type==='object'){switch(type.$$typeof){case REACT_CONTEXT_TYPE:var context=type;return getContextName(context)+'.Consumer';case REACT_PROVIDER_TYPE:var provider=type;return getContextName(provider._context)+'.Provider';case REACT_FORWARD_REF_TYPE:return getWrappedName(type,type.render,'ForwardRef');case REACT_MEMO_TYPE:return getComponentName(type.type);case REACT_BLOCK_TYPE:return getComponentName(type._render);case REACT_LAZY_TYPE:{var lazyComponent=type;var payload=lazyComponent._payload;var init=lazyComponent._init;try{return getComponentName(init(payload));}catch(x){return null;}}}}return null;}var hasOwnProperty=Object.prototype.hasOwnProperty;var RESERVED_PROPS={key:true,ref:true,__self:true,__source:true};var specialPropKeyWarningShown,specialPropRefWarningShown,didWarnAboutStringRefs;{didWarnAboutStringRefs={};}function hasValidRef(config){{if(hasOwnProperty.call(config,'ref')){var getter=Object.getOwnPropertyDescriptor(config,'ref').get;if(getter&&getter.isReactWarning){return false;}}}return config.ref!==undefined;}function hasValidKey(config){{if(hasOwnProperty.call(config,'key')){var getter=Object.getOwnPropertyDescriptor(config,'key').get;if(getter&&getter.isReactWarning){return false;}}}return config.key!==undefined;}function defineKeyPropWarningGetter(props,displayName){var warnAboutAccessingKey=function(){{if(!specialPropKeyWarningShown){specialPropKeyWarningShown=true;error('%s: `key` is not a prop. Trying to access it will result '+'in `undefined` being returned. If you need to access the same '+'value within the child component, you should pass it as a different '+'prop. (https://reactjs.org/link/special-props)',displayName);}}};warnAboutAccessingKey.isReactWarning=true;Object.defineProperty(props,'key',{get:warnAboutAccessingKey,configurable:true});}function defineRefPropWarningGetter(props,displayName){var warnAboutAccessingRef=function(){{if(!specialPropRefWarningShown){specialPropRefWarningShown=true;error('%s: `ref` is not a prop. Trying to access it will result '+'in `undefined` being returned. If you need to access the same '+'value within the child component, you should pass it as a different '+'prop. (https://reactjs.org/link/special-props)',displayName);}}};warnAboutAccessingRef.isReactWarning=true;Object.defineProperty(props,'ref',{get:warnAboutAccessingRef,configurable:true});}function warnIfStringRefCannotBeAutoConverted(config){{if(typeof config.ref==='string'&&ReactCurrentOwner.current&&config.__self&&ReactCurrentOwner.current.stateNode!==config.__self){var componentName=getComponentName(ReactCurrentOwner.current.type);if(!didWarnAboutStringRefs[componentName]){error('Component "%s" contains the string ref "%s". '+'Support for string refs will be removed in a future major release. '+'This case cannot be automatically converted to an arrow function. '+'We ask you to manually fix this case by using useRef() or createRef() instead. '+'Learn more about using refs safely here: '+'https://reactjs.org/link/strict-mode-string-ref',componentName,config.ref);didWarnAboutStringRefs[componentName]=true;}}}}/**
- * Factory method to create a new React element. This no longer adheres to
- * the class pattern, so do not use new to call it. Also, instanceof check
- * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
- * if something is a React Element.
- *
- * @param {*} type
- * @param {*} props
- * @param {*} key
- * @param {string|object} ref
- * @param {*} owner
- * @param {*} self A *temporary* helper to detect places where `this` is
- * different from the `owner` when React.createElement is called, so that we
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
- * functions, and as long as `this` and owner are the same, there will be no
- * change in behavior.
- * @param {*} source An annotation object (added by a transpiler or otherwise)
- * indicating filename, line number, and/or other information.
- * @internal
- */var ReactElement=function(type,key,ref,self,source,owner,props){var element={// This tag allows us to uniquely identify this as a React Element
-$$typeof:REACT_ELEMENT_TYPE,// Built-in properties that belong on the element
-type:type,key:key,ref:ref,props:props,// Record the component responsible for creating this element.
-_owner:owner};{// The validation flag is currently mutative. We put it on
-// an external backing store so that we can freeze the whole object.
-// This can be replaced with a WeakMap once they are implemented in
-// commonly used development environments.
-element._store={};// To make comparing ReactElements easier for testing purposes, we make
-// the validation flag non-enumerable (where possible, which should
-// include every environment we run tests in), so the test framework
-// ignores it.
-Object.defineProperty(element._store,'validated',{configurable:false,enumerable:false,writable:true,value:false});// self and source are DEV only properties.
-Object.defineProperty(element,'_self',{configurable:false,enumerable:false,writable:false,value:self});// Two elements created in two different places should be considered
-// equal for testing purposes and therefore we hide it from enumeration.
-Object.defineProperty(element,'_source',{configurable:false,enumerable:false,writable:false,value:source});if(Object.freeze){Object.freeze(element.props);Object.freeze(element);}}return element;};/**
- * Create and return a new ReactElement of the given type.
- * See https://reactjs.org/docs/react-api.html#createelement
- */function createElement(type,config,children){var propName;// Reserved names are extracted
-var props={};var key=null;var ref=null;var self=null;var source=null;if(config!=null){if(hasValidRef(config)){ref=config.ref;{warnIfStringRefCannotBeAutoConverted(config);}}if(hasValidKey(config)){key=''+config.key;}self=config.__self===undefined?null:config.__self;source=config.__source===undefined?null:config.__source;// Remaining properties are added to a new props object
-for(propName in config){if(hasOwnProperty.call(config,propName)&&!RESERVED_PROPS.hasOwnProperty(propName)){props[propName]=config[propName];}}}// Children can be more than one argument, and those are transferred onto
-// the newly allocated props object.
-var childrenLength=arguments.length-2;if(childrenLength===1){props.children=children;}else if(childrenLength>1){var childArray=Array(childrenLength);for(var i=0;i1){var childArray=Array(childrenLength);for(var i=0;i is not supported and will be removed in '+'a future major release. Did you mean to render instead?');}return context.Provider;},set:function(_Provider){context.Provider=_Provider;}},_currentValue:{get:function(){return context._currentValue;},set:function(_currentValue){context._currentValue=_currentValue;}},_currentValue2:{get:function(){return context._currentValue2;},set:function(_currentValue2){context._currentValue2=_currentValue2;}},_threadCount:{get:function(){return context._threadCount;},set:function(_threadCount){context._threadCount=_threadCount;}},Consumer:{get:function(){if(!hasWarnedAboutUsingNestedContextConsumers){hasWarnedAboutUsingNestedContextConsumers=true;error('Rendering is not supported and will be removed in '+'a future major release. Did you mean to render instead?');}return context.Consumer;}},displayName:{get:function(){return context.displayName;},set:function(displayName){if(!hasWarnedAboutDisplayNameOnConsumer){warn('Setting `displayName` on Context.Consumer has no effect. '+"You should set it directly on the context with Context.displayName = '%s'.",displayName);hasWarnedAboutDisplayNameOnConsumer=true;}}}});// $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
-context.Consumer=Consumer;}{context._currentRenderer=null;context._currentRenderer2=null;}return context;}var Uninitialized=-1;var Pending=0;var Resolved=1;var Rejected=2;function lazyInitializer(payload){if(payload._status===Uninitialized){var ctor=payload._result;var thenable=ctor();// Transition to the next state.
-var pending=payload;pending._status=Pending;pending._result=thenable;thenable.then(function(moduleObject){if(payload._status===Pending){var defaultExport=moduleObject.default;{if(defaultExport===undefined){error('lazy: Expected the result of a dynamic import() call. '+'Instead received: %s\n\nYour code should look like: \n '+// Break up imports to avoid accidentally parsing them as dependencies.
-'const MyComponent = lazy(() => imp'+"ort('./MyComponent'))",moduleObject);}}// Transition to the next state.
-var resolved=payload;resolved._status=Resolved;resolved._result=defaultExport;}},function(error){if(payload._status===Pending){// Transition to the next state.
-var rejected=payload;rejected._status=Rejected;rejected._result=error;}});}if(payload._status===Resolved){return payload._result;}else {throw payload._result;}}function lazy(ctor){var payload={// We use these fields to store the result.
-_status:-1,_result:ctor};var lazyType={$$typeof:REACT_LAZY_TYPE,_payload:payload,_init:lazyInitializer};{// In production, this would just set it on the object.
-var defaultProps;var propTypes;// $FlowFixMe
-Object.defineProperties(lazyType,{defaultProps:{configurable:true,get:function(){return defaultProps;},set:function(newDefaultProps){error('React.lazy(...): It is not supported to assign `defaultProps` to '+'a lazy component import. Either specify them where the component '+'is defined, or create a wrapping component around it.');defaultProps=newDefaultProps;// Match production behavior more closely:
-// $FlowFixMe
-Object.defineProperty(lazyType,'defaultProps',{enumerable:true});}},propTypes:{configurable:true,get:function(){return propTypes;},set:function(newPropTypes){error('React.lazy(...): It is not supported to assign `propTypes` to '+'a lazy component import. Either specify them where the component '+'is defined, or create a wrapping component around it.');propTypes=newPropTypes;// Match production behavior more closely:
-// $FlowFixMe
-Object.defineProperty(lazyType,'propTypes',{enumerable:true});}}});}return lazyType;}function forwardRef(render){{if(render!=null&&render.$$typeof===REACT_MEMO_TYPE){error('forwardRef requires a render function but received a `memo` '+'component. Instead of forwardRef(memo(...)), use '+'memo(forwardRef(...)).');}else if(typeof render!=='function'){error('forwardRef requires a render function but was given %s.',render===null?'null':typeof render);}else {if(render.length!==0&&render.length!==2){error('forwardRef render functions accept exactly two parameters: props and ref. %s',render.length===1?'Did you forget to use the ref parameter?':'Any additional parameter will be undefined.');}}if(render!=null){if(render.defaultProps!=null||render.propTypes!=null){error('forwardRef render functions do not support propTypes or defaultProps. '+'Did you accidentally pass a React component?');}}}var elementType={$$typeof:REACT_FORWARD_REF_TYPE,render:render};{var ownName;Object.defineProperty(elementType,'displayName',{enumerable:false,configurable:true,get:function(){return ownName;},set:function(name){ownName=name;if(render.displayName==null){render.displayName=name;}}});}return elementType;}// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
-var enableScopeAPI=false;// Experimental Create Event Handle API.
-function isValidElementType(type){if(typeof type==='string'||typeof type==='function'){return true;}// Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
-if(type===exports.Fragment||type===exports.Profiler||type===REACT_DEBUG_TRACING_MODE_TYPE||type===exports.StrictMode||type===exports.Suspense||type===REACT_SUSPENSE_LIST_TYPE||type===REACT_LEGACY_HIDDEN_TYPE||enableScopeAPI){return true;}if(typeof type==='object'&&type!==null){if(type.$$typeof===REACT_LAZY_TYPE||type.$$typeof===REACT_MEMO_TYPE||type.$$typeof===REACT_PROVIDER_TYPE||type.$$typeof===REACT_CONTEXT_TYPE||type.$$typeof===REACT_FORWARD_REF_TYPE||type.$$typeof===REACT_FUNDAMENTAL_TYPE||type.$$typeof===REACT_BLOCK_TYPE||type[0]===REACT_SERVER_BLOCK_TYPE){return true;}}return false;}function memo(type,compare){{if(!isValidElementType(type)){error('memo: The first argument must be a component. Instead '+'received: %s',type===null?'null':typeof type);}}var elementType={$$typeof:REACT_MEMO_TYPE,type:type,compare:compare===undefined?null:compare};{var ownName;Object.defineProperty(elementType,'displayName',{enumerable:false,configurable:true,get:function(){return ownName;},set:function(name){ownName=name;if(type.displayName==null){type.displayName=name;}}});}return elementType;}function resolveDispatcher(){var dispatcher=ReactCurrentDispatcher.current;if(!(dispatcher!==null)){{throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");}}return dispatcher;}function useContext(Context,unstable_observedBits){var dispatcher=resolveDispatcher();{if(unstable_observedBits!==undefined){error('useContext() second argument is reserved for future '+'use in React. Passing it is not supported. '+'You passed: %s.%s',unstable_observedBits,typeof unstable_observedBits==='number'&&Array.isArray(arguments[2])?'\n\nDid you call array.map(useContext)? '+'Calling Hooks inside a loop is not supported. '+'Learn more at https://reactjs.org/link/rules-of-hooks':'');}// TODO: add a more generic warning for invalid values.
-if(Context._context!==undefined){var realContext=Context._context;// Don't deduplicate because this legitimately causes bugs
-// and nobody should be using this in existing code.
-if(realContext.Consumer===Context){error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be '+'removed in a future major release. Did you mean to call useContext(Context) instead?');}else if(realContext.Provider===Context){error('Calling useContext(Context.Provider) is not supported. '+'Did you mean to call useContext(Context) instead?');}}}return dispatcher.useContext(Context,unstable_observedBits);}function useState(initialState){var dispatcher=resolveDispatcher();return dispatcher.useState(initialState);}function useReducer(reducer,initialArg,init){var dispatcher=resolveDispatcher();return dispatcher.useReducer(reducer,initialArg,init);}function useRef(initialValue){var dispatcher=resolveDispatcher();return dispatcher.useRef(initialValue);}function useEffect(create,deps){var dispatcher=resolveDispatcher();return dispatcher.useEffect(create,deps);}function useLayoutEffect(create,deps){var dispatcher=resolveDispatcher();return dispatcher.useLayoutEffect(create,deps);}function useCallback(callback,deps){var dispatcher=resolveDispatcher();return dispatcher.useCallback(callback,deps);}function useMemo(create,deps){var dispatcher=resolveDispatcher();return dispatcher.useMemo(create,deps);}function useImperativeHandle(ref,create,deps){var dispatcher=resolveDispatcher();return dispatcher.useImperativeHandle(ref,create,deps);}function useDebugValue(value,formatterFn){{var dispatcher=resolveDispatcher();return dispatcher.useDebugValue(value,formatterFn);}}// Helpers to patch console.logs to avoid logging during side-effect free
-// replaying on render function. This currently only patches the object
-// lazily which won't cover if the log function was extracted eagerly.
-// We could also eagerly patch the method.
-var disabledDepth=0;var prevLog;var prevInfo;var prevWarn;var prevError;var prevGroup;var prevGroupCollapsed;var prevGroupEnd;function disabledLog(){}disabledLog.__reactDisabledLog=true;function disableLogs(){{if(disabledDepth===0){/* eslint-disable react-internal/no-production-logging */prevLog=console.log;prevInfo=console.info;prevWarn=console.warn;prevError=console.error;prevGroup=console.group;prevGroupCollapsed=console.groupCollapsed;prevGroupEnd=console.groupEnd;// https://github.com/facebook/react/issues/19099
-var props={configurable:true,enumerable:true,value:disabledLog,writable:true};// $FlowFixMe Flow thinks console is immutable.
-Object.defineProperties(console,{info:props,log:props,warn:props,error:props,group:props,groupCollapsed:props,groupEnd:props});/* eslint-enable react-internal/no-production-logging */}disabledDepth++;}}function reenableLogs(){{disabledDepth--;if(disabledDepth===0){/* eslint-disable react-internal/no-production-logging */var props={configurable:true,enumerable:true,writable:true};// $FlowFixMe Flow thinks console is immutable.
-Object.defineProperties(console,{log:_assign({},props,{value:prevLog}),info:_assign({},props,{value:prevInfo}),warn:_assign({},props,{value:prevWarn}),error:_assign({},props,{value:prevError}),group:_assign({},props,{value:prevGroup}),groupCollapsed:_assign({},props,{value:prevGroupCollapsed}),groupEnd:_assign({},props,{value:prevGroupEnd})});/* eslint-enable react-internal/no-production-logging */}if(disabledDepth<0){error('disabledDepth fell below zero. '+'This is a bug in React. Please file an issue.');}}}var ReactCurrentDispatcher$1=ReactSharedInternals.ReactCurrentDispatcher;var prefix;function describeBuiltInComponentFrame(name,source,ownerFn){{if(prefix===undefined){// Extract the VM specific prefix used by each line.
-try{throw Error();}catch(x){var match=x.stack.trim().match(/\n( *(at )?)/);prefix=match&&match[1]||'';}}// We use the prefix to ensure our stacks line up with native stack frames.
-return '\n'+prefix+name;}}var reentry=false;var componentFrameCache;{var PossiblyWeakMap=typeof WeakMap==='function'?WeakMap:Map;componentFrameCache=new PossiblyWeakMap();}function describeNativeComponentFrame(fn,construct){// If something asked for a stack inside a fake render, it should get ignored.
-if(!fn||reentry){return '';}{var frame=componentFrameCache.get(fn);if(frame!==undefined){return frame;}}var control;reentry=true;var previousPrepareStackTrace=Error.prepareStackTrace;// $FlowFixMe It does accept undefined.
-Error.prepareStackTrace=undefined;var previousDispatcher;{previousDispatcher=ReactCurrentDispatcher$1.current;// Set the dispatcher in DEV because this might be call in the render function
-// for warnings.
-ReactCurrentDispatcher$1.current=null;disableLogs();}try{// This should throw.
-if(construct){// Something should be setting the props in the constructor.
-var Fake=function(){throw Error();};// $FlowFixMe
-Object.defineProperty(Fake.prototype,'props',{set:function(){// We use a throwing setter instead of frozen or non-writable props
-// because that won't throw in a non-strict mode function.
-throw Error();}});if(typeof Reflect==='object'&&Reflect.construct){// We construct a different control for this case to include any extra
-// frames added by the construct call.
-try{Reflect.construct(Fake,[]);}catch(x){control=x;}Reflect.construct(fn,[],Fake);}else {try{Fake.call();}catch(x){control=x;}fn.call(Fake.prototype);}}else {try{throw Error();}catch(x){control=x;}fn();}}catch(sample){// This is inlined manually because closure doesn't do it for us.
-if(sample&&control&&typeof sample.stack==='string'){// This extracts the first frame from the sample that isn't also in the control.
-// Skipping one frame that we assume is the frame that calls the two.
-var sampleLines=sample.stack.split('\n');var controlLines=control.stack.split('\n');var s=sampleLines.length-1;var c=controlLines.length-1;while(s>=1&&c>=0&&sampleLines[s]!==controlLines[c]){// We expect at least one stack frame to be shared.
-// Typically this will be the root most one. However, stack frames may be
-// cut off due to maximum stack limits. In this case, one maybe cut off
-// earlier than the other. We assume that the sample is longer or the same
-// and there for cut off earlier. So we should find the root most frame in
-// the sample somewhere in the control.
-c--;}for(;s>=1&&c>=0;s--,c--){// Next we find the first one that isn't the same which should be the
-// frame that called our sample function and the control.
-if(sampleLines[s]!==controlLines[c]){// In V8, the first line is describing the message but other VMs don't.
-// If we're about to return the first line, and the control is also on the same
-// line, that's a pretty good indicator that our sample threw at same line as
-// the control. I.e. before we entered the sample frame. So we ignore this result.
-// This can happen if you passed a class to function component, or non-function.
-if(s!==1||c!==1){do{s--;c--;// We may still have similar intermediate frames from the construct call.
-// The next one that isn't the same should be our match though.
-if(c<0||sampleLines[s]!==controlLines[c]){// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
-var _frame='\n'+sampleLines[s].replace(' at new ',' at ');{if(typeof fn==='function'){componentFrameCache.set(fn,_frame);}}// Return the line we found.
-return _frame;}}while(s>=1&&c>=0);}break;}}}}finally{reentry=false;{ReactCurrentDispatcher$1.current=previousDispatcher;reenableLogs();}Error.prepareStackTrace=previousPrepareStackTrace;}// Fallback to just using the name if we couldn't make it throw.
-var name=fn?fn.displayName||fn.name:'';var syntheticFrame=name?describeBuiltInComponentFrame(name):'';{if(typeof fn==='function'){componentFrameCache.set(fn,syntheticFrame);}}return syntheticFrame;}function describeFunctionComponentFrame(fn,source,ownerFn){{return describeNativeComponentFrame(fn,false);}}function shouldConstruct(Component){var prototype=Component.prototype;return !!(prototype&&prototype.isReactComponent);}function describeUnknownElementTypeFrameInDEV(type,source,ownerFn){if(type==null){return '';}if(typeof type==='function'){{return describeNativeComponentFrame(type,shouldConstruct(type));}}if(typeof type==='string'){return describeBuiltInComponentFrame(type);}switch(type){case exports.Suspense:return describeBuiltInComponentFrame('Suspense');case REACT_SUSPENSE_LIST_TYPE:return describeBuiltInComponentFrame('SuspenseList');}if(typeof type==='object'){switch(type.$$typeof){case REACT_FORWARD_REF_TYPE:return describeFunctionComponentFrame(type.render);case REACT_MEMO_TYPE:// Memo may contain any component type so we recursively resolve it.
-return describeUnknownElementTypeFrameInDEV(type.type,source,ownerFn);case REACT_BLOCK_TYPE:return describeFunctionComponentFrame(type._render);case REACT_LAZY_TYPE:{var lazyComponent=type;var payload=lazyComponent._payload;var init=lazyComponent._init;try{// Lazy may contain any component type so we recursively resolve it.
-return describeUnknownElementTypeFrameInDEV(init(payload),source,ownerFn);}catch(x){}}}}return '';}var loggedTypeFailures={};var ReactDebugCurrentFrame$1=ReactSharedInternals.ReactDebugCurrentFrame;function setCurrentlyValidatingElement(element){{if(element){var owner=element._owner;var stack=describeUnknownElementTypeFrameInDEV(element.type,element._source,owner?owner.type:null);ReactDebugCurrentFrame$1.setExtraStackFrame(stack);}else {ReactDebugCurrentFrame$1.setExtraStackFrame(null);}}}function checkPropTypes(typeSpecs,values,location,componentName,element){{// $FlowFixMe This is okay but Flow doesn't know it.
-var has=Function.call.bind(Object.prototype.hasOwnProperty);for(var typeSpecName in typeSpecs){if(has(typeSpecs,typeSpecName)){var error$1=void 0;// Prop type validation may throw. In case they do, we don't want to
-// fail the render phase where it didn't fail before. So we log it.
-// After these have been cleaned up, we'll let them throw.
-try{// This is intentionally an invariant that gets caught. It's the same
-// behavior as without this statement except with a better message.
-if(typeof typeSpecs[typeSpecName]!=='function'){var err=Error((componentName||'React class')+': '+location+' type `'+typeSpecName+'` is invalid; '+'it must be a function, usually from the `prop-types` package, but received `'+typeof typeSpecs[typeSpecName]+'`.'+'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');err.name='Invariant Violation';throw err;}error$1=typeSpecs[typeSpecName](values,typeSpecName,componentName,location,null,'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');}catch(ex){error$1=ex;}if(error$1&&!(error$1 instanceof Error)){setCurrentlyValidatingElement(element);error('%s: type specification of %s'+' `%s` is invalid; the type checker '+'function must return `null` or an `Error` but returned a %s. '+'You may have forgotten to pass an argument to the type checker '+'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and '+'shape all require an argument).',componentName||'React class',location,typeSpecName,typeof error$1);setCurrentlyValidatingElement(null);}if(error$1 instanceof Error&&!(error$1.message in loggedTypeFailures)){// Only monitor this failure once because there tends to be a lot of the
-// same error.
-loggedTypeFailures[error$1.message]=true;setCurrentlyValidatingElement(element);error('Failed %s type: %s',location,error$1.message);setCurrentlyValidatingElement(null);}}}}}function setCurrentlyValidatingElement$1(element){{if(element){var owner=element._owner;var stack=describeUnknownElementTypeFrameInDEV(element.type,element._source,owner?owner.type:null);setExtraStackFrame(stack);}else {setExtraStackFrame(null);}}}var propTypesMisspellWarningShown;{propTypesMisspellWarningShown=false;}function getDeclarationErrorAddendum(){if(ReactCurrentOwner.current){var name=getComponentName(ReactCurrentOwner.current.type);if(name){return '\n\nCheck the render method of `'+name+'`.';}}return '';}function getSourceInfoErrorAddendum(source){if(source!==undefined){var fileName=source.fileName.replace(/^.*[\\\/]/,'');var lineNumber=source.lineNumber;return '\n\nCheck your code at '+fileName+':'+lineNumber+'.';}return '';}function getSourceInfoErrorAddendumForProps(elementProps){if(elementProps!==null&&elementProps!==undefined){return getSourceInfoErrorAddendum(elementProps.__source);}return '';}/**
- * Warn if there's no key explicitly set on dynamic arrays of children or
- * object keys are not valid. This allows us to keep track of children between
- * updates.
- */var ownerHasKeyUseWarning={};function getCurrentComponentErrorInfo(parentType){var info=getDeclarationErrorAddendum();if(!info){var parentName=typeof parentType==='string'?parentType:parentType.displayName||parentType.name;if(parentName){info="\n\nCheck the top-level render call using <"+parentName+">.";}}return info;}/**
- * Warn if the element doesn't have an explicit key assigned to it.
- * This element is in an array. The array could grow and shrink or be
- * reordered. All children that haven't already been validated are required to
- * have a "key" property assigned to it. Error statuses are cached so a warning
- * will only be shown once.
- *
- * @internal
- * @param {ReactElement} element Element that requires a key.
- * @param {*} parentType element's parent's type.
- */function validateExplicitKey(element,parentType){if(!element._store||element._store.validated||element.key!=null){return;}element._store.validated=true;var currentComponentErrorInfo=getCurrentComponentErrorInfo(parentType);if(ownerHasKeyUseWarning[currentComponentErrorInfo]){return;}ownerHasKeyUseWarning[currentComponentErrorInfo]=true;// Usually the current owner is the offender, but if it accepts children as a
-// property, it may be the creator of the child that's responsible for
-// assigning it a key.
-var childOwner='';if(element&&element._owner&&element._owner!==ReactCurrentOwner.current){// Give the component that originally created this child.
-childOwner=" It was passed a child from "+getComponentName(element._owner.type)+".";}{setCurrentlyValidatingElement$1(element);error('Each child in a list should have a unique "key" prop.'+'%s%s See https://reactjs.org/link/warning-keys for more information.',currentComponentErrorInfo,childOwner);setCurrentlyValidatingElement$1(null);}}/**
- * Ensure that every element either is passed in a static location, in an
- * array with an explicit keys property defined, or in an object literal
- * with valid key property.
- *
- * @internal
- * @param {ReactNode} node Statically passed child of any type.
- * @param {*} parentType node's parent's type.
- */function validateChildKeys(node,parentType){if(typeof node!=='object'){return;}if(Array.isArray(node)){for(var i=0;i";info=' Did you accidentally export a JSX literal instead of a component?';}else {typeString=typeof type;}{error('React.createElement: type is invalid -- expected a string (for '+'built-in components) or a class/function (for composite '+'components) but got: %s.%s',typeString,info);}}var element=createElement.apply(this,arguments);// The result can be nullish if a mock or a custom function is used.
-// TODO: Drop this when these are no longer allowed as the type argument.
-if(element==null){return element;}// Skip key warning if the type isn't valid since our key validation logic
-// doesn't expect a non-string/function type and can throw confusing errors.
-// We don't want exception behavior to differ between dev and prod.
-// (Rendering will throw with a helpful message and as soon as the type is
-// fixed, the key warnings will appear.)
-if(validType){for(var i=2;iq)&&(t=(f=f.replace(' ',':')).length),0h&&(h=(c=c.trim()).charCodeAt(0));switch(h){case 38:return c.replace(F,'$1'+d.trim());case 58:return d.trim()+c.replace(F,'$1'+d.trim());default:if(0<1*e&&0b.charCodeAt(8))break;case 115:a=a.replace(b,'-webkit-'+b)+';'+a;break;case 207:case 102:a=a.replace(b,'-webkit-'+(102e.charCodeAt(0)&&(e=e.trim());V=e;e=[V];if(0 ({})}\n```\n\n',8:'ThemeProvider: Please make your "theme" prop an object.\n\n',9:"Missing document ``\n\n",10:"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",11:"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n",14:'ThemeProvider: "theme" prop is required.\n\n',15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to ``, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:"Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",17:"CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n"};function D(){for(var e=arguments.length<=0?void 0:arguments[0],t=[],n=1,r=arguments.length;n1?t-1:0),r=1;r=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,o=r;e>=o;)(o<<=1)<0&&j(16,""+e);this.groupSizes=new Uint32Array(o),this.groupSizes.set(n),this.length=o;for(var s=r;s=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),o=r+n,s=r;s1<<30)&&j(16,""+t),x.set(e,t),k.set(t,e),t;},z=function(e){return k.get(e);},M=function(e,t){t>=V&&(V=t+1),x.set(e,t),k.set(t,e);},G="style["+A+'][data-styled-version="5.3.3"]',L=new RegExp("^"+A+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),F=function(e,t,n){for(var r,o=n.split(","),s=0,i=o.length;s=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(A))return r;}}(n),s=void 0!==o?o.nextSibling:null;r.setAttribute(A,"active"),r.setAttribute("data-styled-version","5.3.3");var i=q();return i&&r.setAttribute("nonce",i),n.insertBefore(r,s),r;},$=function(){function e(e){var t=this.element=H(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0;}return !1;},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--;},t.getRule=function(e){return e0&&(u+=e+",");}),r+=""+a+c+'{content:"'+u+'"}/*!sc*/\n';}}}return r;}(this);},e;}(),K=/(a)(d)/gi,Q=function(e){return String.fromCharCode(e+(e>25?39:97));};function ee(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=Q(t%52)+n;return (Q(t%52)+n).replace(K,"$1-$2");}var te=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e;},ne=function(e){return te(5381,e);};var oe=ne("5.3.3"),se=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic="production"===undefined,this.componentId=t,this.baseHash=te(oe,t),this.baseStyle=n,Z.registerId(t);}return e.prototype.generateAndInjectStyles=function(e,t,n){var r=this.componentId,o=[];if(this.baseStyle&&o.push(this.baseStyle.generateAndInjectStyles(e,t,n)),this.isStatic&&!n.hash){if(this.staticRulesId&&t.hasNameForId(r,this.staticRulesId))o.push(this.staticRulesId);else {var s=Ne(this.rules,e,t,n).join(""),i=ee(te(this.baseHash,s)>>>0);if(!t.hasNameForId(r,i)){var a=n(s,"."+i,void 0,r);t.insertRules(r,i,a);}o.push(i),this.staticRulesId=i;}}else {for(var c=this.rules.length,u=te(this.baseHash,n.hash),l="",d=0;d>>0);if(!t.hasNameForId(r,m)){var y=n(l,"."+m,void 0,r);t.insertRules(r,m,y);}o.push(m);}}return o.join(" ");},e;}(),ie=/^\s*\/\/.*$/gm,ae=[":","[",".","#"];function ce(e){var t,n,r,o,s=void 0===e?E:e,i=s.options,a=void 0===i?E:i,c=s.plugins,u=void 0===c?w:c,l=new stylis_min(a),d=[],h=function(e){function t(t){if(t)try{e(t+"}");}catch(e){}}return function(n,r,o,s,i,a,c,u,l,d){switch(n){case 1:if(0===l&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===u)return r+"/*|*/";break;case 3:switch(u){case 102:case 112:return e(o[0]+r),"";default:return r+(0===d?"/*|*/":"");}case-2:r.split("/*|*/}").forEach(t);}};}(function(e){d.push(e);}),f=function(e,r,s){return 0===r&&-1!==ae.indexOf(s[n.length])||s.match(o)?e:"."+t;};function m(e,s,i,a){void 0===a&&(a="&");var c=e.replace(ie,""),u=s&&i?i+" "+s+" { "+c+" }":c;return t=a,n=s,r=new RegExp("\\"+n+"\\b","g"),o=new RegExp("(\\"+n+"\\b){2,}"),l(i||!s?"":s,u);}return l.use([].concat(u,[function(e,t,o){2===e&&o.length&&o[0].lastIndexOf(n)>0&&(o[0]=o[0].replace(r,f));},h,function(e){if(-2===e){var t=d;return d=[],t;}}])),m.hash=u.length?u.reduce(function(e,t){return t.name||j(15),te(e,t.name);},5381).toString():"",m;}var ue=/*#__PURE__*/react.createContext(),le=ue.Consumer,de=/*#__PURE__*/react.createContext(),he=(de.Consumer,new Z()),pe=ce();function fe(){return react.useContext(ue)||he;}function me(){return react.useContext(de)||pe;}var ve=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=pe);var r=n.name+t.hash;e.hasNameForId(n.id,r)||e.insertRules(n.id,r,t(n.rules,r,"@keyframes"));},this.toString=function(){return j(12,String(n.name));},this.name=e,this.id="sc-keyframes-"+e,this.rules=t;}return e.prototype.getName=function(e){return void 0===e&&(e=pe),this.name+e.hash;},e;}(),ge=/([A-Z])/,Se=/([A-Z])/g,we=/^ms-/,Ee=function(e){return "-"+e.toLowerCase();};function be(e){return ge.test(e)?e.replace(Se,Ee).replace(we,"-ms-"):e;}var _e=function(e){return null==e||!1===e||""===e;};function Ne(e,n,r,o){if(Array.isArray(e)){for(var s,i=[],a=0,c=e.length;a1?t-1:0),r=1;r1?t-1:0),i=1;i?@[\\\]^`{|}~-]+/g,je=/(^-|-$)/g;function Te(e){return e.replace(De,"-").replace(je,"");}var xe=function(e){return ee(ne(e)>>>0);};function ke(e){return "string"==typeof e&&(e.charAt(0)===e.charAt(0).toLowerCase());}var Ve=function(e){return "function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e);},Be=function(e){return "__proto__"!==e&&"constructor"!==e&&"prototype"!==e;};function ze(e,t,n){var r=e[n];Ve(t)&&Ve(r)?Me(r,t):e[n]=t;}function Me(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r=0||(o[n]=e[n]);return o;}(t,["componentId"]),s=r&&r+"-"+(ke(e)?e:Te(_(e)));return qe(e,v({},o,{attrs:S,componentId:s}),n);},Object.defineProperty(C,"defaultProps",{get:function(){return this._foldedDefaultProps;},set:function(t){this._foldedDefaultProps=o?Me({},e.defaultProps,t):t;}}),(Oe(f,g),C.warnTooManyClasses=function(e,t){var n={},r=!1;return function(o){if(!r&&(n[o]=!0,Object.keys(n).length>=200)){var s=t?' with the id of "'+t+'"':"";console.warn("Over 200 classes were generated for component "+e+s+".\nConsider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n "),r=!0,n={};}};}(f,g)),C.toString=function(){return "."+C.styledComponentId;},i&&hoistNonReactStatics_cjs(C,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),C;}var He=function(e){return function e(t,r,o){if(void 0===o&&(o=E),!reactIs.isValidElementType(r))return j(1,String(r));var s=function(){return t(r,o,Ce.apply(void 0,arguments));};return s.withConfig=function(n){return e(t,r,v({},o,{},n));},s.attrs=function(n){return e(t,r,v({},o,{attrs:Array.prototype.concat(o.attrs,n).filter(Boolean)}));},s;}(qe,e);};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(e){He[e]=He(e);});"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native"),"undefined"!=typeof window&&(window["__styled-components-init__"]=window["__styled-components-init__"]||0,1===window["__styled-components-init__"]&&console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."),window["__styled-components-init__"]+=1);
-
-const WideInput = He.input `
- width: 100%;
-`;
-const WideSelect = He.select `
- width: 100%;
-`;
-
-const InputWithIconWrapper = He.div `
- position: relative;
-`;
-const InputWithIcon = He(WideInput) `
- /* important required to override mobile stylesheet */
- padding-left: 25px !important;
-`;
-const InputIcon = He.i `
- position: absolute;
- display: block;
- transform: translate(0, -50%);
- top: 50%;
- pointer-events: none;
- width: 25px;
- text-align: center;
- font-style: normal;
-`;
-const CurrencyInput = ({ currencySymbol, amount, setAmount }) => (react.createElement(InputWithIconWrapper, null,
- react.createElement(InputWithIcon, { placeholder: "Amount", type: "number", value: amount, onChange: (e) => setAmount(e.target.value), onBlur: () => setAmount(parseFloat(amount).toFixed(2)) }),
- react.createElement(InputIcon, null, currencySymbol)));
-
-/**
- * Fuse.js v6.4.6 - Lightweight fuzzy-search (http://fusejs.io)
- *
- * Copyright (c) 2021 Kiro Risk (http://kiro.me)
- * All Rights Reserved. Apache Software License 2.0
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- */function isArray(value){return !Array.isArray?getTag(value)==='[object Array]':Array.isArray(value);}// Adapted from: https://github.com/lodash/lodash/blob/master/.internal/baseToString.js
-const INFINITY=1/0;function baseToString(value){// Exit early for strings to avoid a performance hit in some environments.
-if(typeof value=='string'){return value;}let result=value+'';return result=='0'&&1/value==-INFINITY?'-0':result;}function toString(value){return value==null?'':baseToString(value);}function isString(value){return typeof value==='string';}function isNumber(value){return typeof value==='number';}// Adapted from: https://github.com/lodash/lodash/blob/master/isBoolean.js
-function isBoolean(value){return value===true||value===false||isObjectLike(value)&&getTag(value)=='[object Boolean]';}function isObject(value){return typeof value==='object';}// Checks if `value` is object-like.
-function isObjectLike(value){return isObject(value)&&value!==null;}function isDefined(value){return value!==undefined&&value!==null;}function isBlank(value){return !value.trim().length;}// Gets the `toStringTag` of `value`.
-// Adapted from: https://github.com/lodash/lodash/blob/master/.internal/getTag.js
-function getTag(value){return value==null?value===undefined?'[object Undefined]':'[object Null]':Object.prototype.toString.call(value);}const EXTENDED_SEARCH_UNAVAILABLE='Extended search is not available';const INCORRECT_INDEX_TYPE="Incorrect 'index' type";const LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY=key=>`Invalid value for key ${key}`;const PATTERN_LENGTH_TOO_LARGE=max=>`Pattern length exceeds max of ${max}.`;const MISSING_KEY_PROPERTY=name=>`Missing ${name} property in key`;const INVALID_KEY_WEIGHT_VALUE=key=>`Property 'weight' in key '${key}' must be a positive integer`;const hasOwn=Object.prototype.hasOwnProperty;class KeyStore{constructor(keys){this._keys=[];this._keyMap={};let totalWeight=0;keys.forEach(key=>{let obj=createKey(key);totalWeight+=obj.weight;this._keys.push(obj);this._keyMap[obj.id]=obj;totalWeight+=obj.weight;});// Normalize weights so that their sum is equal to 1
-this._keys.forEach(key=>{key.weight/=totalWeight;});}get(keyId){return this._keyMap[keyId];}keys(){return this._keys;}toJSON(){return JSON.stringify(this._keys);}}function createKey(key){let path=null;let id=null;let src=null;let weight=1;if(isString(key)||isArray(key)){src=key;path=createKeyPath(key);id=createKeyId(key);}else {if(!hasOwn.call(key,'name')){throw new Error(MISSING_KEY_PROPERTY('name'));}const name=key.name;src=name;if(hasOwn.call(key,'weight')){weight=key.weight;if(weight<=0){throw new Error(INVALID_KEY_WEIGHT_VALUE(name));}}path=createKeyPath(name);id=createKeyId(name);}return {path,id,weight,src};}function createKeyPath(key){return isArray(key)?key:key.split('.');}function createKeyId(key){return isArray(key)?key.join('.'):key;}function get$2(obj,path){let list=[];let arr=false;const deepGet=(obj,path,index)=>{if(!isDefined(obj)){return;}if(!path[index]){// If there's no path left, we've arrived at the object we care about.
-list.push(obj);}else {let key=path[index];const value=obj[key];if(!isDefined(value)){return;}// If we're at the last value in the path, and if it's a string/number/bool,
-// add it to the list
-if(index===path.length-1&&(isString(value)||isNumber(value)||isBoolean(value))){list.push(toString(value));}else if(isArray(value)){arr=true;// Search each item in the array.
-for(let i=0,len=value.length;ia.score===b.score?a.idx{this._keysMap[key.id]=idx;});}create(){if(this.isCreated||!this.docs.length){return;}this.isCreated=true;// List is Array
-if(isString(this.docs[0])){this.docs.forEach((doc,docIndex)=>{this._addString(doc,docIndex);});}else {// List is Array