cv.ViewPlugin.fromClass(nm),nm=class{constructor(e){this.view=e,this.handleClickEvent=this.handleClickEvent.bind(this),this.view.dom.addEventListener("click",this.handleClickEvent)}destroy(){this.view.dom.removeEventListener("click",this.handleClickEvent)}handleClickEvent(e){let{target:t}=e;if(!t||!(t instanceof HTMLInputElement)||t.type!=="checkbox")return!1;let n=t.closest("ul.plugin-tasks-query-result, div.callout-content");if(n){if(n.matches("div.callout-content")){let m=`obsidian-tasks-plugin warning: Tasks cannot add or remove completion dates or make the next copy of a recurring task for tasks written inside a callout when you click their checkboxes in Live Preview.
-If you wanted Tasks to do these things, please undo your change, then either click the line of the task and use the "Toggle Task Done" command, or switch to Reading View to click the checkbox.`;console.warn(m),new dv.Notice(m,45e3)}return!1}let{state:s}=this.view,i=this.view.posAtDOM(t),a=s.doc.lineAt(i),o=fe.fromLine({line:a.text,taskLocation:pt.fromUnknownPosition(""),fallbackDate:null});if(o===null)return!1;e.preventDefault();let l=o.toggleWithRecurrenceInUsersOrder().map(m=>m.toFileLineString()).join(s.lineBreak),c=s.update({changes:{from:a.from,to:a.to,insert:l}});this.view.dispatch(c);let f=t.checked;return setTimeout(()=>{t.checked=f},1),!0}};var fi=require("obsidian");function pv(r,e,t,n=void 0){let s="";e.isEmpty()||(s+=`Only tasks containing the global filter '${e.get()}'.
+`),u=0,l=[];for(let m=a.lineStart;m<=a.lineEnd;m++){let y=o[m];if(y===void 0)continue;let k=null,E=fe.fromLine({line:y,taskLocation:new pt(i,m,a.lineStart,u,k),fallbackDate:null});E!==null&&(l.push(E),u++)}let c=new Nn({obsidianComponent:n,parentUlElement:e,taskLayoutOptions:new Cr,queryLayoutOptions:new En});for(let m=0;mfv.ViewPlugin.fromClass(im),im=class{constructor(e){this.view=e,this.handleClickEvent=this.handleClickEvent.bind(this),this.view.dom.addEventListener("click",this.handleClickEvent)}destroy(){this.view.dom.removeEventListener("click",this.handleClickEvent)}handleClickEvent(e){let{target:t}=e;if(!t||!(t instanceof HTMLInputElement)||t.type!=="checkbox")return!1;let n=t.closest("ul.plugin-tasks-query-result, div.callout-content");if(n){if(n.matches("div.callout-content")){let m=`obsidian-tasks-plugin warning: Tasks cannot add or remove completion dates or make the next copy of a recurring task for tasks written inside a callout when you click their checkboxes in Live Preview.
+If you wanted Tasks to do these things, please undo your change, then either click the line of the task and use the "Toggle Task Done" command, or switch to Reading View to click the checkbox.`;console.warn(m),new pv.Notice(m,45e3)}return!1}let{state:s}=this.view,i=this.view.posAtDOM(t),a=s.doc.lineAt(i),o=fe.fromLine({line:a.text,taskLocation:pt.fromUnknownPosition(""),fallbackDate:null});if(o===null)return!1;e.preventDefault();let l=o.toggleWithRecurrenceInUsersOrder().map(m=>m.toFileLineString()).join(s.lineBreak),c=s.update({changes:{from:a.from,to:a.to,insert:l}});this.view.dispatch(c);let f=t.checked;return setTimeout(()=>{t.checked=f},1),!0}};var di=require("obsidian");function hv(r,e,t,n=void 0){let s="";e.isEmpty()||(s+=`Only tasks containing the global filter '${e.get()}'.
-`);let i=new li(" "),a=new on(r,n);if(!a.ignoreGlobalQuery&&t.hasInstructions()){let o=t.query(n);s+=`Explanation of the global query:
+`);let i=new ui(" "),a=new un(r,n);if(!a.ignoreGlobalQuery&&t.hasInstructions()){let o=t.query(n);s+=`Explanation of the global query:
${i.explainQuery(o)}
`}return s+=`Explanation of this Tasks code block query:
-${i.explainQuery(a)}`,s}function il(r,e,t){let n=new on(r,t);return n.ignoreGlobalQuery?n:e.query(t).append(n)}function mv(r){for(let t of fe.allDateFields()){let n=r[t];if(n&&!n.isValid())return!1}let e=r.happensDates.some(t=>!!(t!=null&&t.isValid()));return!r.isDone&&e}function al(r){return r.dueDate?"dueDate":r.scheduledDate?"scheduledDate":r.startDate?"startDate":null}function sm(r,e,t,n){let s=r[e];return gv(s,r,e,t,n)}function hv(r,e,t,n){let s=window.moment();return gv(s,r,e,t,n)}function gv(r,e,t,n,s){let i=new He(r).postpone(n,s),a=bt.removeInferredStatusIfNeeded(e,[new fe(ot(ke({},e),{[t]:i}))])[0];return{postponedDate:i,postponedTask:a}}function yv(r,e){let t=r==null?void 0:r.format("DD MMM YYYY");return`Task's ${e} changed to ${t}`}function Tv(r,e,t){return`\u2139\uFE0F ${im(r,e,t)} (right-click for more options)`}function xP(r){return r.charAt(0).toUpperCase()+r.slice(1)}function im(r,e,t){let n=al(r),s=r[n];return _v(n,s,e,t)}function bv(r,e,t){let n=al(r),s=window.moment().startOf("day");return _v(n,s,e,t)}function _v(r,e,t,n){let i=new He(e).postpone(n,t).format("ddd Do MMM"),a=t!=1?t:"a";return e.isSameOrBefore(window.moment(),"day")?`${xP(r.replace("Date",""))} in ${a} ${n}, on ${i}`.replace(" in 0 days"," today").replace("in a day","tomorrow"):`Postpone ${r.replace("Date"," date")} by ${a} ${n}, to ${i}`}var am=require("obsidian");var In=class extends di{constructor(e,t,n=ja){super(n);let s=(l,c,f,m,y,k)=>{let E=y(t,m,f);c.setTitle(E).onClick(()=>In.postponeOnClickCallback(l,t,m,f,k,n))},i=bv,a=hv;this.addItem(l=>s(e,l,"days",0,i,a)),this.addItem(l=>s(e,l,"day",1,i,a)),this.addSeparator();let o=im,u=sm;this.addItem(l=>s(e,l,"days",2,o,u)),this.addItem(l=>s(e,l,"days",3,o,u)),this.addItem(l=>s(e,l,"days",4,o,u)),this.addItem(l=>s(e,l,"days",5,o,u)),this.addItem(l=>s(e,l,"days",6,o,u)),this.addSeparator(),this.addItem(l=>s(e,l,"week",1,o,u)),this.addItem(l=>s(e,l,"weeks",2,o,u)),this.addItem(l=>s(e,l,"weeks",3,o,u)),this.addItem(l=>s(e,l,"month",1,o,u))}static postponeOnClickCallback(o,u,l,c){return L(this,arguments,function*(e,t,n,s,i=sm,a=ja){let f=al(t);if(f===null){let k="\u26A0\uFE0F Postponement requires a date: due, scheduled or start.";return new am.Notice(k,1e4)}let{postponedDate:m,postponedTask:y}=i(t,f,s,n);yield a(t,y),In.postponeSuccessCallback(e,f,m)})}static postponeSuccessCallback(e,t,n){e.disabled=!0;let s=yv(n,t);new am.Notice(s,2e3)}};var ol=class{constructor({plugin:e,events:t}){this.addQueryRenderChild=this._addQueryRenderChild.bind(this);this.app=e.app,this.events=t,e.registerMarkdownCodeBlockProcessor("tasks",this._addQueryRenderChild.bind(this))}_addQueryRenderChild(e,t,n){return L(this,null,function*(){n.addChild(new om({app:this.app,events:this.events,container:t,source:e,filePath:n.sourcePath}))})}},om=class extends fi.MarkdownRenderChild{constructor({app:t,events:n,container:s,source:i,filePath:a}){super(s);switch(this.app=t,this.events=n,this.source=i,this.filePath=a,this.containerEl.className){case"block-language-tasks":this.query=il(this.source,ar.getInstance(),this.filePath),this.queryType="tasks";break;default:this.query=il(this.source,ar.getInstance(),this.filePath),this.queryType="tasks";break}}onload(){this.events.triggerRequestCacheUpdate(this.render.bind(this)),this.renderEventRef=this.events.onCacheUpdate(this.render.bind(this)),this.reloadQueryAtMidnight()}onunload(){this.renderEventRef!==void 0&&this.events.off(this.renderEventRef),this.queryReloadTimeout!==void 0&&clearTimeout(this.queryReloadTimeout)}reloadQueryAtMidnight(){let t=new Date;t.setHours(24,0,0,0);let n=new Date,s=t.getTime()-n.getTime();this.queryReloadTimeout=setTimeout(()=>{this.query=il(this.source,ar.getInstance(),this.filePath),this.events.triggerRequestCacheUpdate(this.render.bind(this)),this.reloadQueryAtMidnight()},s+1e3)}render(s){return L(this,arguments,function*({tasks:t,state:n}){var a;let i=this.containerEl.createEl("div");n==="Warm"&&this.query.error===void 0?yield this.renderQuerySearchResults(t,n,i):this.query.error!==void 0?this.renderErrorMessage(i,this.query.error):this.renderLoadingMessage(i),(a=this.containerEl.firstChild)==null||a.replaceWith(i)})}renderQuerySearchResults(t,n,s){return L(this,null,function*(){this.query.debug(`[render] Render called: plugin state: ${n}; searching ${t.length} tasks`),this.query.queryLayoutOptions.explainQuery&&this.createExplanation(s);let i=this.query.applyQueryToTasks(t);if(i.searchErrorMessage!==void 0){this.renderErrorMessage(s,i.searchErrorMessage);return}yield this.addAllTaskGroups(i.taskGroups,s);let a=i.totalTasksCount;this.addTaskCount(s,i),this.query.debug(`[render] ${a} tasks displayed`)})}renderErrorMessage(t,n){t.createDiv().innerHTML=`Tasks query: ${n.replace(/\n/g,"
")}
`}renderLoadingMessage(t){t.setText("Loading Tasks ...")}createExplanation(t){let n=pv(this.source,ye.getInstance(),ar.getInstance(),this.filePath),s=t.createEl("pre");s.addClasses(["plugin-tasks-query-explanation"]),s.setText(n),t.appendChild(s)}createTaskList(t,n){return L(this,null,function*(){let s=new En(this.query.taskLayoutOptions,this.query.queryLayoutOptions),i=n.createEl("ul");i.addClasses(["contains-task-list","plugin-tasks-query-result"]),i.addClasses(s.taskListHiddenClasses());let a=this.getGroupingAttribute();a&&a.length>0&&(i.dataset.taskGroupBy=a);let o=new Nn({obsidianComponent:this,parentUlElement:i,taskLayoutOptions:this.query.taskLayoutOptions,queryLayoutOptions:this.query.queryLayoutOptions});for(let[u,l]of t.entries()){let c=this.isFilenameUnique({task:l}),f=yield o.renderTaskLine(l,u,c);f.querySelectorAll("[data-footnote-id]").forEach(E=>E.remove());let y=f.createSpan("task-extras");this.query.queryLayoutOptions.hideUrgency||this.addUrgency(y,l);let k=this.query.queryLayoutOptions.shortMode;this.query.queryLayoutOptions.hideBacklinks||this.addBacklinks(y,l,k,c),this.query.queryLayoutOptions.hideEditButton||this.addEditButton(y,l),!this.query.queryLayoutOptions.hidePostponeButton&&mv(l)&&this.addPostponeButton(y,l,k),i.appendChild(f)}n.appendChild(i)})}addEditButton(t,n){t.createEl("a",{cls:"tasks-edit"}).onClickEvent(i=>{i.preventDefault();let a=u=>L(this,null,function*(){yield ci({originalTask:n,newTasks:bt.removeInferredStatusIfNeeded(n,u)})});new On({app:this.app,task:n,onSubmit:a}).open()})}addUrgency(t,n){let s=new Intl.NumberFormat().format(n.urgency);t.createSpan({text:s,cls:"tasks-urgency"})}addAllTaskGroups(t,n){return L(this,null,function*(){for(let s of t.groups)yield this.addGroupHeadings(n,s.groupHeadings),yield this.createTaskList(s.tasks,n)})}addGroupHeadings(t,n){return L(this,null,function*(){for(let s of n)yield this.addGroupHeading(t,s)})}addGroupHeading(t,n){return L(this,null,function*(){let s="h6";n.nestingLevel===0?s="h4":n.nestingLevel===1&&(s="h5");let i=t.createEl(s,{cls:"tasks-group-heading"});yield fi.MarkdownRenderer.renderMarkdown(n.displayName,i,this.filePath,this)})}addBacklinks(t,n,s,i){var c;let a=t.createSpan({cls:"tasks-backlink"});s||a.append(" (");let o=a.createEl("a");o.rel="noopener",o.target="_blank",o.addClass("internal-link"),s&&o.addClass("internal-link-short-mode");let u;s?u=" \u{1F517}":u=(c=n.getLinkText({isFilenameUnique:i}))!=null?c:"",o.setText(u);let l=this.app.vault;o.addEventListener("click",f=>L(this,null,function*(){let m=yield em(n,l);if(m){let[y,k]=m,E=this.app.workspace.getLeaf(fi.Keymap.isModEvent(f));f.preventDefault(),yield E.openFile(k,{eState:{line:y}})}})),o.addEventListener("mousedown",f=>L(this,null,function*(){if(f.button===1){let m=yield em(n,l);if(m){let[y,k]=m,E=this.app.workspace.getLeaf("tab");f.preventDefault(),yield E.openFile(k,{eState:{line:y}})}}})),s||a.append(")")}addPostponeButton(t,n,s){let a="day",o=Tv(n,1,a),u=t.createEl("button",{attr:{id:"postpone-button",title:o}}),l=s?["tasks-postpone","tasks-postpone-short-mode"]:["tasks-postpone"];u.addClasses(l),u.setText(" \u23E9"),u.addEventListener("click",c=>{c.preventDefault(),In.postponeOnClickCallback(u,n,1,a)}),u.addEventListener("contextmenu",c=>L(this,null,function*(){c.stopPropagation(),new In(u,n).showAtPosition({x:c.clientX,y:c.clientY})}))}addTaskCount(t,n){this.query.queryLayoutOptions.hideTaskCount||t.createDiv({text:n.totalTasksCountDisplayText(),cls:"tasks-count"})}isFilenameUnique({task:t}){let n=t.path.match(/([^/]*)\..+$/i);if(n===null)return;let s=n[1];return this.app.vault.getMarkdownFiles().filter(a=>{if(a.basename===s)return!0}).length<2}getGroupingAttribute(){let t=[];for(let n of this.query.grouping)t.push(n.property);return t.join(",")}};var _e=require("obsidian");var ul=class{constructor(e){this._markdown="";this.columnNames=e,this.addTitleRow()}get markdown(){return this._markdown}addTitleRow(){let e="|",t="|";this.columnNames.forEach(n=>{e+=` ${n} |`,t+=" ----- |"}),this._markdown+=`${e}
+${i.explainQuery(a)}`,s}function al(r,e,t){let n=new un(r,t);return n.ignoreGlobalQuery?n:e.query(t).append(n)}function gv(r){for(let t of fe.allDateFields()){let n=r[t];if(n&&!n.isValid())return!1}let e=r.happensDates.some(t=>!!(t!=null&&t.isValid()));return!r.isDone&&e}function ol(r){return r.dueDate?"dueDate":r.scheduledDate?"scheduledDate":r.startDate?"startDate":null}function am(r,e,t,n){let s=r[e];return bv(s,r,e,t,n)}function yv(r,e,t,n){let s=window.moment();return bv(s,r,e,t,n)}function bv(r,e,t,n,s){let i=new Ye(r).postpone(n,s),a=Tt.removeInferredStatusIfNeeded(e,[new fe(ot(Se({},e),{[t]:i}))])[0];return{postponedDate:i,postponedTask:a}}function Tv(r,e){let t=r==null?void 0:r.format("DD MMM YYYY");return`Task's ${e} changed to ${t}`}function _v(r,e,t){return`\u2139\uFE0F ${om(r,e,t)} (right-click for more options)`}function MP(r){return r.charAt(0).toUpperCase()+r.slice(1)}function om(r,e,t){let n=ol(r),s=r[n];return wv(n,s,e,t)}function vv(r,e,t){let n=ol(r),s=window.moment().startOf("day");return wv(n,s,e,t)}function wv(r,e,t,n){let i=new Ye(e).postpone(n,t).format("ddd Do MMM"),a=t!=1?t:"a";return e.isSameOrBefore(window.moment(),"day")?`${MP(r.replace("Date",""))} in ${a} ${n}, on ${i}`.replace(" in 0 days"," today").replace("in a day","tomorrow"):`Postpone ${r.replace("Date"," date")} by ${a} ${n}, to ${i}`}var um=require("obsidian");var In=class extends ci{constructor(e,t,n=$a){super(n);let s=(l,c,f,m,y,k)=>{let E=y(t,m,f);c.setTitle(E).onClick(()=>In.postponeOnClickCallback(l,t,m,f,k,n))},i=vv,a=yv;this.addItem(l=>s(e,l,"days",0,i,a)),this.addItem(l=>s(e,l,"day",1,i,a)),this.addSeparator();let o=om,u=am;this.addItem(l=>s(e,l,"days",2,o,u)),this.addItem(l=>s(e,l,"days",3,o,u)),this.addItem(l=>s(e,l,"days",4,o,u)),this.addItem(l=>s(e,l,"days",5,o,u)),this.addItem(l=>s(e,l,"days",6,o,u)),this.addSeparator(),this.addItem(l=>s(e,l,"week",1,o,u)),this.addItem(l=>s(e,l,"weeks",2,o,u)),this.addItem(l=>s(e,l,"weeks",3,o,u)),this.addItem(l=>s(e,l,"month",1,o,u))}static postponeOnClickCallback(o,u,l,c){return L(this,arguments,function*(e,t,n,s,i=am,a=$a){let f=ol(t);if(f===null){let k="\u26A0\uFE0F Postponement requires a date: due, scheduled or start.";return new um.Notice(k,1e4)}let{postponedDate:m,postponedTask:y}=i(t,f,s,n);yield a(t,y),In.postponeSuccessCallback(e,f,m)})}static postponeSuccessCallback(e,t,n){e.style.pointerEvents="none";let s=Tv(n,t);new um.Notice(s,2e3)}};var ul=class{constructor({plugin:e,events:t}){this.addQueryRenderChild=this._addQueryRenderChild.bind(this);this.app=e.app,this.events=t,e.registerMarkdownCodeBlockProcessor("tasks",this._addQueryRenderChild.bind(this))}_addQueryRenderChild(e,t,n){return L(this,null,function*(){n.addChild(new lm({app:this.app,events:this.events,container:t,source:e,filePath:n.sourcePath}))})}},lm=class extends di.MarkdownRenderChild{constructor({app:t,events:n,container:s,source:i,filePath:a}){super(s);switch(this.app=t,this.events=n,this.source=i,this.filePath=a,this.containerEl.className){case"block-language-tasks":this.query=al(this.source,or.getInstance(),this.filePath),this.queryType="tasks";break;default:this.query=al(this.source,or.getInstance(),this.filePath),this.queryType="tasks";break}}onload(){this.events.triggerRequestCacheUpdate(this.render.bind(this)),this.renderEventRef=this.events.onCacheUpdate(this.render.bind(this)),this.reloadQueryAtMidnight()}onunload(){this.renderEventRef!==void 0&&this.events.off(this.renderEventRef),this.queryReloadTimeout!==void 0&&clearTimeout(this.queryReloadTimeout)}reloadQueryAtMidnight(){let t=new Date;t.setHours(24,0,0,0);let n=new Date,s=t.getTime()-n.getTime();this.queryReloadTimeout=setTimeout(()=>{this.query=al(this.source,or.getInstance(),this.filePath),this.events.triggerRequestCacheUpdate(this.render.bind(this)),this.reloadQueryAtMidnight()},s+1e3)}render(s){return L(this,arguments,function*({tasks:t,state:n}){var a;let i=this.containerEl.createEl("div");n==="Warm"&&this.query.error===void 0?yield this.renderQuerySearchResults(t,n,i):this.query.error!==void 0?this.renderErrorMessage(i,this.query.error):this.renderLoadingMessage(i),(a=this.containerEl.firstChild)==null||a.replaceWith(i)})}renderQuerySearchResults(t,n,s){return L(this,null,function*(){this.query.debug(`[render] Render called: plugin state: ${n}; searching ${t.length} tasks`),this.query.queryLayoutOptions.explainQuery&&this.createExplanation(s);let i=this.query.applyQueryToTasks(t);if(i.searchErrorMessage!==void 0){this.renderErrorMessage(s,i.searchErrorMessage);return}yield this.addAllTaskGroups(i.taskGroups,s);let a=i.totalTasksCount;this.addTaskCount(s,i),this.query.debug(`[render] ${a} tasks displayed`)})}renderErrorMessage(t,n){t.createDiv().innerHTML=`Tasks query: ${n.replace(/\n/g,"
")}
`}renderLoadingMessage(t){t.setText("Loading Tasks ...")}createExplanation(t){let n=hv(this.source,ye.getInstance(),or.getInstance(),this.filePath),s=t.createEl("pre");s.addClasses(["plugin-tasks-query-explanation"]),s.setText(n),t.appendChild(s)}createTaskList(t,n){return L(this,null,function*(){let s=new lu(this.query.taskLayoutOptions,this.query.queryLayoutOptions),i=n.createEl("ul");i.addClasses(["contains-task-list","plugin-tasks-query-result"]),i.addClasses(s.taskListHiddenClasses());let a=this.getGroupingAttribute();a&&a.length>0&&(i.dataset.taskGroupBy=a);let o=new Nn({obsidianComponent:this,parentUlElement:i,taskLayoutOptions:this.query.taskLayoutOptions,queryLayoutOptions:this.query.queryLayoutOptions});for(let[u,l]of t.entries()){let c=this.isFilenameUnique({task:l}),f=yield o.renderTaskLine(l,u,c);f.querySelectorAll("[data-footnote-id]").forEach(E=>E.remove());let y=f.createSpan("task-extras");this.query.queryLayoutOptions.hideUrgency||this.addUrgency(y,l);let k=this.query.queryLayoutOptions.shortMode;this.query.queryLayoutOptions.hideBacklinks||this.addBacklinks(y,l,k,c),this.query.queryLayoutOptions.hideEditButton||this.addEditButton(y,l),!this.query.queryLayoutOptions.hidePostponeButton&&gv(l)&&this.addPostponeButton(y,l,k),i.appendChild(f)}n.appendChild(i)})}addEditButton(t,n){t.createEl("a",{cls:"tasks-edit",href:"#",title:"Edit task"}).onClickEvent(i=>{i.preventDefault();let a=u=>L(this,null,function*(){yield li({originalTask:n,newTasks:Tt.removeInferredStatusIfNeeded(n,u)})});new On({app:this.app,task:n,onSubmit:a}).open()})}addUrgency(t,n){let s=new Intl.NumberFormat().format(n.urgency);t.createSpan({text:s,cls:"tasks-urgency"})}addAllTaskGroups(t,n){return L(this,null,function*(){for(let s of t.groups)yield this.addGroupHeadings(n,s.groupHeadings),yield this.createTaskList(s.tasks,n)})}addGroupHeadings(t,n){return L(this,null,function*(){for(let s of n)yield this.addGroupHeading(t,s)})}addGroupHeading(t,n){return L(this,null,function*(){let s="h6";n.nestingLevel===0?s="h4":n.nestingLevel===1&&(s="h5");let i=t.createEl(s,{cls:"tasks-group-heading"});yield di.MarkdownRenderer.renderMarkdown(n.displayName,i,this.filePath,this)})}addBacklinks(t,n,s,i){var c;let a=t.createSpan({cls:"tasks-backlink"});s||a.append(" (");let o=a.createEl("a");o.rel="noopener",o.target="_blank",o.addClass("internal-link"),s&&o.addClass("internal-link-short-mode");let u;s?u=" \u{1F517}":u=(c=n.getLinkText({isFilenameUnique:i}))!=null?c:"",o.setText(u);let l=this.app.vault;o.addEventListener("click",f=>L(this,null,function*(){let m=yield rm(n,l);if(m){let[y,k]=m,E=this.app.workspace.getLeaf(di.Keymap.isModEvent(f));f.preventDefault(),yield E.openFile(k,{eState:{line:y}})}})),o.addEventListener("mousedown",f=>L(this,null,function*(){if(f.button===1){let m=yield rm(n,l);if(m){let[y,k]=m,E=this.app.workspace.getLeaf("tab");f.preventDefault(),yield E.openFile(k,{eState:{line:y}})}}})),s||a.append(")")}addPostponeButton(t,n,s){let a="day",o=_v(n,1,a),u=t.createEl("a",{cls:"tasks-postpone"+(s?" tasks-postpone-short-mode":""),href:"#",title:o});u.addEventListener("click",l=>{l.preventDefault(),In.postponeOnClickCallback(u,n,1,a)}),u.addEventListener("contextmenu",l=>L(this,null,function*(){l.stopPropagation(),new In(u,n).showAtPosition({x:l.clientX,y:l.clientY})}))}addTaskCount(t,n){this.query.queryLayoutOptions.hideTaskCount||t.createDiv({text:n.totalTasksCountDisplayText(),cls:"tasks-count"})}isFilenameUnique({task:t}){let n=t.path.match(/([^/]*)\..+$/i);if(n===null)return;let s=n[1];return this.app.vault.getMarkdownFiles().filter(a=>{if(a.basename===s)return!0}).length<2}getGroupingAttribute(){let t=[];for(let n of this.query.grouping)t.push(n.property);return t.join(",")}};var _e=require("obsidian");var ll=class{constructor(e){this._markdown="";this.columnNames=e,this.addTitleRow()}get markdown(){return this._markdown}addTitleRow(){let e="|",t="|";this.columnNames.forEach(n=>{e+=` ${n} |`,t+=" ----- |"}),this._markdown+=`${e}
`,this._markdown+=`${t}
`}addRow(e){let t=this.makeRowText(e);this._markdown+=`${t}
`}addRowIfNew(e){let t=this.makeRowText(e);this._markdown.includes(t)||(this._markdown+=`${t}
-`)}makeRowText(e){let t="|";return e.forEach(n=>{t+=` ${n} |`}),t}};function vv(r,e){return r.findIndex(t=>t.symbol===e)}function RP(r,e){let t=Q.getTypeForUnknownSymbol(r.symbol);r.type!==t&&(t==="TODO"&&r.symbol!==" "||e.push(`For information, the conventional type for status symbol ${Fr(r.symbol)} is ${Fr(t)}: you may wish to review this type.`))}function MP(r,e,t){let n=vv(r,e.nextStatusSymbol);if(n===-1){t.push(`Next symbol ${Fr(e.nextStatusSymbol)} is unknown: create a status with symbol ${Fr(e.nextStatusSymbol)}.`);return}if(e.type!=="DONE")return;let s=r[n];if(s){if(s.type!=="TODO"&&s.type!=="IN_PROGRESS"){let i="https://publish.obsidian.md/tasks/Getting+Started/Statuses/Recurring+Tasks+and+Custom+Statuses",a=[`This \`DONE\` status is followed by ${Fr(s.type)}, not \`TODO\` or \`IN_PROGRESS\`.`,"If used to complete a recurring task, it will instead be followed by `TODO` or `IN_PROGRESS`, to ensure the next task matches the `not done` filter.",`See [Recurring Tasks and Custom Statuses](${i}).`].join("
");t.push(a)}}else t.push("Unexpected failure to find the next status.")}function CP(r,e,t){let n=[];return e.symbol===Q.EMPTY.symbol?(n.push("Empty symbol: this status will be ignored."),n):vv(r,e.symbol)!=t?(n.push(`Duplicate symbol '${Fr(e.symbol)}': this status will be ignored.`),n):(RP(e,n),MP(r,e,n),n)}function wv(r){let e=new ul(["Status Symbol","Next Status Symbol","Status Name","Status Type","Problems (if any)"]),t=Ne.allStatuses(r);return t.forEach((n,s)=>{e.addRow([Fr(n.symbol),Fr(n.nextStatusSymbol),n.name,Fr(n.type),CP(t,n,s).join("
")])}),e.markdown}function Ev(r,e,t,n){let i=wv(r),a=e.mermaidDiagram(!0);return`# ${t}
+`)}makeRowText(e){let t="|";return e.forEach(n=>{t+=` ${n} |`}),t}};function Ev(r,e){return r.findIndex(t=>t.symbol===e)}function CP(r,e){let t=Q.getTypeForUnknownSymbol(r.symbol);r.type!==t&&(t==="TODO"&&r.symbol!==" "||e.push(`For information, the conventional type for status symbol ${Wr(r.symbol)} is ${Wr(t)}: you may wish to review this type.`))}function AP(r,e,t){let n=Ev(r,e.nextStatusSymbol);if(n===-1){t.push(`Next symbol ${Wr(e.nextStatusSymbol)} is unknown: create a status with symbol ${Wr(e.nextStatusSymbol)}.`);return}if(e.type!=="DONE")return;let s=r[n];if(s){if(s.type!=="TODO"&&s.type!=="IN_PROGRESS"){let i="https://publish.obsidian.md/tasks/Getting+Started/Statuses/Recurring+Tasks+and+Custom+Statuses",a=[`This \`DONE\` status is followed by ${Wr(s.type)}, not \`TODO\` or \`IN_PROGRESS\`.`,"If used to complete a recurring task, it will instead be followed by `TODO` or `IN_PROGRESS`, to ensure the next task matches the `not done` filter.",`See [Recurring Tasks and Custom Statuses](${i}).`].join("
");t.push(a)}}else t.push("Unexpected failure to find the next status.")}function PP(r,e,t){let n=[];return e.symbol===Q.EMPTY.symbol?(n.push("Empty symbol: this status will be ignored."),n):Ev(r,e.symbol)!=t?(n.push(`Duplicate symbol '${Wr(e.symbol)}': this status will be ignored.`),n):(CP(e,n),AP(r,e,n),n)}function kv(r){let e=new ll(["Status Symbol","Next Status Symbol","Status Name","Status Type","Problems (if any)"]),t=Ne.allStatuses(r);return t.forEach((n,s)=>{e.addRow([Wr(n.symbol),Wr(n.nextStatusSymbol),n.name,Wr(n.type),PP(t,n,s).join("
")])}),e.markdown}function Sv(r,e,t,n){let i=kv(r),a=e.mermaidDiagram(!0);return`# ${t}
## About this file
@@ -327,14 +327,14 @@ ${i}
These are the settings actually used by Tasks.
-${a}`}function Fr(r){return r===""?r:"`"+(r!==" "?r:"space")+"`"}function kv(){return[[" ","Unchecked","x","TODO"],["x","Checked"," ","DONE"],[">","Rescheduled","x","TODO"],["<","Scheduled","x","TODO"],["!","Important","x","TODO"],["-","Cancelled"," ","CANCELLED"],["/","In Progress","x","IN_PROGRESS"],["?","Question","x","TODO"],["*","Star","x","TODO"],["n","Note","x","TODO"],["l","Location","x","TODO"],["i","Information","x","TODO"],["I","Idea","x","TODO"],["S","Amount","x","TODO"],["p","Pro","x","TODO"],["c","Con","x","TODO"],["b","Bookmark","x","TODO"],['"',"Quote","x","TODO"],["0","Speech bubble 0","0","NON_TASK"],["1","Speech bubble 1","1","NON_TASK"],["2","Speech bubble 2","2","NON_TASK"],["3","Speech bubble 3","3","NON_TASK"],["4","Speech bubble 4","4","NON_TASK"],["5","Speech bubble 5","5","NON_TASK"],["6","Speech bubble 6","6","NON_TASK"],["7","Speech bubble 7","7","NON_TASK"],["8","Speech bubble 8","8","NON_TASK"],["9","Speech bubble 9","9","NON_TASK"]]}function Sv(){return[[" ","incomplete","x","TODO"],["x","complete / done"," ","DONE"],["-","cancelled"," ","CANCELLED"],[">","deferred","x","TODO"],["/","in progress, or half-done","x","IN_PROGRESS"],["!","Important","x","TODO"],["?","question","x","TODO"],["R","review","x","TODO"],["+","Inbox / task that should be processed later","x","TODO"],["b","bookmark","x","TODO"],["B","brainstorm","x","TODO"],["D","deferred or scheduled","x","TODO"],["I","Info","x","TODO"],["i","idea","x","TODO"],["N","note","x","TODO"],["Q","quote","x","TODO"],["W","win / success / reward","x","TODO"],["P","pro","x","TODO"],["C","con","x","TODO"]]}function Ov(){return[[" ","Unchecked","x","TODO"],["x","Checked"," ","DONE"],["-","Cancelled"," ","CANCELLED"],["/","In Progress","x","IN_PROGRESS"],[">","Deferred","x","TODO"],["!","Important","x","TODO"],["?","Question","x","TODO"],["r","Review","x","TODO"]]}function Dv(){return[[" ","Unchecked","x","TODO"],["x","Regular"," ","DONE"],["X","Checked"," ","DONE"],["-","Dropped"," ","CANCELLED"],[">","Forward","x","TODO"],["D","Date","x","TODO"],["?","Question","x","TODO"],["/","Half Done","x","IN_PROGRESS"],["+","Add","x","TODO"],["R","Research","x","TODO"],["!","Important","x","TODO"],["i","Idea","x","TODO"],["B","Brainstorm","x","TODO"],["P","Pro","x","TODO"],["C","Con","x","TODO"],["Q","Quote","x","TODO"],["N","Note","x","TODO"],["b","Bookmark","x","TODO"],["I","Information","x","TODO"],["p","Paraphrase","x","TODO"],["L","Location","x","TODO"],["E","Example","x","TODO"],["A","Answer","x","TODO"],["r","Reward","x","TODO"],["c","Choice","x","TODO"],["d","Doing","x","IN_PROGRESS"],["T","Time","x","TODO"],["@","Character / Person","x","TODO"],["t","Talk","x","TODO"],["O","Outline / Plot","x","TODO"],["~","Conflict","x","TODO"],["W","World","x","TODO"],["f","Clue / Find","x","TODO"],["F","Foreshadow","x","TODO"],["H","Favorite / Health","x","TODO"],["&","Symbolism","x","TODO"],["s","Secret","x","TODO"]]}function xv(){return[[" ","Unchecked","x","TODO"],["x","Checked"," ","DONE"],[">","Rescheduled","x","TODO"],["<","Scheduled","x","TODO"],["!","Important","x","TODO"],["-","Cancelled"," ","CANCELLED"],["/","In Progress","x","IN_PROGRESS"],["?","Question","x","TODO"],["*","Star","x","TODO"],["n","Note","x","TODO"],["l","Location","x","TODO"],["i","Information","x","TODO"],["I","Idea","x","TODO"],["S","Amount","x","TODO"],["p","Pro","x","TODO"],["c","Con","x","TODO"],["b","Bookmark","x","TODO"],["f","Fire","x","TODO"],["k","Key","x","TODO"],["w","Win","x","TODO"],["u","Up","x","TODO"],["d","Down","x","TODO"]]}function Rv(){return[[" ","to-do","x","TODO"],["/","incomplete","x","IN_PROGRESS"],["x","done"," ","DONE"],["-","canceled"," ","CANCELLED"],[">","forwarded","x","TODO"],["<","scheduling","x","TODO"],["?","question","x","TODO"],["!","important","x","TODO"],["*","star","x","TODO"],['"',"quote","x","TODO"],["l","location","x","TODO"],["b","bookmark","x","TODO"],["i","information","x","TODO"],["S","savings","x","TODO"],["I","idea","x","TODO"],["p","pros","x","TODO"],["c","cons","x","TODO"],["f","fire","x","TODO"],["k","key","x","TODO"],["w","win","x","TODO"],["u","up","x","TODO"],["d","down","x","TODO"]]}function Mv(){return[[" ","to-do","x","TODO"],["/","incomplete","x","IN_PROGRESS"],["x","done"," ","DONE"],["-","canceled"," ","CANCELLED"],[">","forwarded","x","TODO"],["<","scheduling","x","TODO"],["?","question","x","TODO"],["!","important","x","TODO"],["*","star","x","TODO"],['"',"quote","x","TODO"],["l","location","x","TODO"],["b","bookmark","x","TODO"],["i","information","x","TODO"],["S","savings","x","TODO"],["I","idea","x","TODO"],["p","pros","x","TODO"],["c","cons","x","TODO"],["f","fire","x","TODO"],["k","key","x","TODO"],["w","win","x","TODO"],["u","up","x","TODO"],["d","down","x","TODO"]]}var Cv=[{text:"Core Statuses",level:"h3",class:"",open:!0,notice:{class:"setting-item-description",text:null,html:"These are the core statuses that Tasks supports natively, with no need for custom CSS styling or theming.
You can add edit and add your own custom statuses in the section below.
"},settings:[{name:"",description:"",type:"function",initialValue:"",placeholder:"",settingName:"insertTaskCoreStatusSettings",featureFlag:"",notice:null}]},{text:"Custom Statuses",level:"h3",class:"",open:!0,notice:{class:"setting-item-description",text:null,html:`You should first select and install a CSS Snippet or Theme to style custom checkboxes.
Then, use the buttons below to set up your custom statuses, to match your chosen CSS checkboxes.
Note Any statuses with the same symbol as any earlier statuses will be ignored. You can confirm the actually loaded statuses by running the 'Create or edit task' command and looking at the Status drop-down.
See the documentation to get started!
`},settings:[{name:"",description:"",type:"function",initialValue:"",placeholder:"",settingName:"insertCustomTaskStatusSettings",featureFlag:"",notice:null}]}];var br=require("obsidian");var fs=class{validate(e){let t=[];return t.push(...this.validateSymbol(e)),t.push(...this.validateName(e)),t.push(...this.validateNextSymbol(e)),t}validateStatusCollectionEntry(e){let[t,n,s,i]=e,a=[];if(a.push(...this.validateType(i)),t===s&&i!=="NON_TASK"&&a.push(`Status symbol '${t}' toggles to itself`),a.length>0)return a;let o=Q.createFromImportedValue(e).configuration;return a.push(...this.validateSymbolTypeConventions(o)),a.push(...this.validate(o)),a}validateSymbol(e){return fs.validateOneSymbol(e.symbol,"Task Status Symbol")}validateNextSymbol(e){return fs.validateOneSymbol(e.nextStatusSymbol,"Task Next Status Symbol")}validateName(e){let t=[];return e.name.length===0&&t.push("Task Status Name cannot be empty."),t}validateType(e){let t=jt[e],n=[];return t||n.push(`Status Type "${e}" is not a valid type`),t=="EMPTY"&&n.push('Status Type "EMPTY" is not permitted in user data'),n}validateSymbolTypeConventions(e){let t=[],n=e.symbol,s=new Ee,i=n==="X"?"x":n,a=s.bySymbol(i);return a.type!=="EMPTY"&&(e.nextStatusSymbol!==a.nextStatusSymbol&&t.push(`Next Status Symbol for symbol '${n}': '${e.nextStatusSymbol}' is inconsistent with convention '${a.nextStatusSymbol}'`),e.type!==a.type&&t.push(`Status Type for symbol '${n}': '${e.type}' is inconsistent with convention '${a.type}'`)),t}static validateOneSymbol(e,t){let n=[];return e.length===0&&n.push(`${t} cannot be empty.`),e.length>1&&n.push(`${t} ("${e}") must be a single character.`),n}};var ps=new fs,zt=class extends br.Modal{constructor(t,n,s){super(t.app);this.plugin=t;this.saved=!1;this.error=!1;this.statusSymbol=n.symbol,this.statusName=n.name,this.statusNextSymbol=n.nextStatusSymbol,this.statusAvailableAsCommand=n.availableAsCommand,this.type=n.type,this.isCoreStatus=s}statusConfiguration(){return new Ve(this.statusSymbol,this.statusName,this.statusNextSymbol,this.statusAvailableAsCommand,this.type)}display(){return L(this,null,function*(){let{contentEl:t}=this;t.empty();let n=t.createDiv(),s;new br.Setting(n).setName("Task Status Symbol").setDesc("This is the character between the square braces. (It can only be edited for Custom statuses, and not Core statuses.)").addText(l=>{s=l,l.setValue(this.statusSymbol).onChange(c=>{this.statusSymbol=c,zt.setValid(l,ps.validateSymbol(this.statusConfiguration()))})}).setDisabled(this.isCoreStatus).then(l=>{zt.setValid(s,ps.validateSymbol(this.statusConfiguration()))});let i;new br.Setting(n).setName("Task Status Name").setDesc("This is the friendly name of the task status.").addText(l=>{i=l,l.setValue(this.statusName).onChange(c=>{this.statusName=c,zt.setValid(l,ps.validateName(this.statusConfiguration()))})}).then(l=>{zt.setValid(i,ps.validateName(this.statusConfiguration()))});let a;new br.Setting(n).setName("Task Next Status Symbol").setDesc("When clicked on this is the symbol that should be used next.").addText(l=>{a=l,l.setValue(this.statusNextSymbol).onChange(c=>{this.statusNextSymbol=c,zt.setValid(l,ps.validateNextSymbol(this.statusConfiguration()))})}).then(l=>{zt.setValid(a,ps.validateNextSymbol(this.statusConfiguration()))}),new br.Setting(n).setName("Task Status Type").setDesc("Control how the status behaves for searching and toggling.").addDropdown(l=>{["TODO","IN_PROGRESS","DONE","CANCELLED","NON_TASK"].forEach(f=>{l.addOption(f,f)}),l.setValue(this.type).onChange(f=>{this.type=Q.getTypeFromStatusTypeString(f)})}),Q.tasksPluginCanCreateCommandsForStatuses()&&new br.Setting(n).setName("Available as command").setDesc("If enabled this status will be available as a command so you can assign a hotkey and toggle the status using it.").addToggle(l=>{l.setValue(this.statusAvailableAsCommand).onChange(c=>L(this,null,function*(){this.statusAvailableAsCommand=c}))});let o=t.createDiv(),u=new br.Setting(o);u.addButton(l=>(l.setTooltip("Save").setIcon("checkmark").onClick(()=>L(this,null,function*(){let c=ps.validate(this.statusConfiguration());if(c.length>0){let f=c.join(`
+${a}`}function Wr(r){return r===""?r:"`"+(r!==" "?r:"space")+"`"}function Ov(){return[[" ","Unchecked","x","TODO"],["x","Checked"," ","DONE"],[">","Rescheduled","x","TODO"],["<","Scheduled","x","TODO"],["!","Important","x","TODO"],["-","Cancelled"," ","CANCELLED"],["/","In Progress","x","IN_PROGRESS"],["?","Question","x","TODO"],["*","Star","x","TODO"],["n","Note","x","TODO"],["l","Location","x","TODO"],["i","Information","x","TODO"],["I","Idea","x","TODO"],["S","Amount","x","TODO"],["p","Pro","x","TODO"],["c","Con","x","TODO"],["b","Bookmark","x","TODO"],['"',"Quote","x","TODO"],["0","Speech bubble 0","0","NON_TASK"],["1","Speech bubble 1","1","NON_TASK"],["2","Speech bubble 2","2","NON_TASK"],["3","Speech bubble 3","3","NON_TASK"],["4","Speech bubble 4","4","NON_TASK"],["5","Speech bubble 5","5","NON_TASK"],["6","Speech bubble 6","6","NON_TASK"],["7","Speech bubble 7","7","NON_TASK"],["8","Speech bubble 8","8","NON_TASK"],["9","Speech bubble 9","9","NON_TASK"]]}function Dv(){return[[" ","incomplete","x","TODO"],["x","complete / done"," ","DONE"],["-","cancelled"," ","CANCELLED"],[">","deferred","x","TODO"],["/","in progress, or half-done","x","IN_PROGRESS"],["!","Important","x","TODO"],["?","question","x","TODO"],["R","review","x","TODO"],["+","Inbox / task that should be processed later","x","TODO"],["b","bookmark","x","TODO"],["B","brainstorm","x","TODO"],["D","deferred or scheduled","x","TODO"],["I","Info","x","TODO"],["i","idea","x","TODO"],["N","note","x","TODO"],["Q","quote","x","TODO"],["W","win / success / reward","x","TODO"],["P","pro","x","TODO"],["C","con","x","TODO"]]}function xv(){return[[" ","Unchecked","x","TODO"],["x","Checked"," ","DONE"],["-","Cancelled"," ","CANCELLED"],["/","In Progress","x","IN_PROGRESS"],[">","Deferred","x","TODO"],["!","Important","x","TODO"],["?","Question","x","TODO"],["r","Review","x","TODO"]]}function Rv(){return[[" ","Unchecked","x","TODO"],["x","Regular"," ","DONE"],["X","Checked"," ","DONE"],["-","Dropped"," ","CANCELLED"],[">","Forward","x","TODO"],["D","Date","x","TODO"],["?","Question","x","TODO"],["/","Half Done","x","IN_PROGRESS"],["+","Add","x","TODO"],["R","Research","x","TODO"],["!","Important","x","TODO"],["i","Idea","x","TODO"],["B","Brainstorm","x","TODO"],["P","Pro","x","TODO"],["C","Con","x","TODO"],["Q","Quote","x","TODO"],["N","Note","x","TODO"],["b","Bookmark","x","TODO"],["I","Information","x","TODO"],["p","Paraphrase","x","TODO"],["L","Location","x","TODO"],["E","Example","x","TODO"],["A","Answer","x","TODO"],["r","Reward","x","TODO"],["c","Choice","x","TODO"],["d","Doing","x","IN_PROGRESS"],["T","Time","x","TODO"],["@","Character / Person","x","TODO"],["t","Talk","x","TODO"],["O","Outline / Plot","x","TODO"],["~","Conflict","x","TODO"],["W","World","x","TODO"],["f","Clue / Find","x","TODO"],["F","Foreshadow","x","TODO"],["H","Favorite / Health","x","TODO"],["&","Symbolism","x","TODO"],["s","Secret","x","TODO"]]}function Mv(){return[[" ","Unchecked","x","TODO"],["x","Checked"," ","DONE"],[">","Rescheduled","x","TODO"],["<","Scheduled","x","TODO"],["!","Important","x","TODO"],["-","Cancelled"," ","CANCELLED"],["/","In Progress","x","IN_PROGRESS"],["?","Question","x","TODO"],["*","Star","x","TODO"],["n","Note","x","TODO"],["l","Location","x","TODO"],["i","Information","x","TODO"],["I","Idea","x","TODO"],["S","Amount","x","TODO"],["p","Pro","x","TODO"],["c","Con","x","TODO"],["b","Bookmark","x","TODO"],["f","Fire","x","TODO"],["k","Key","x","TODO"],["w","Win","x","TODO"],["u","Up","x","TODO"],["d","Down","x","TODO"]]}function Cv(){return[[" ","to-do","x","TODO"],["/","incomplete","x","IN_PROGRESS"],["x","done"," ","DONE"],["-","canceled"," ","CANCELLED"],[">","forwarded","x","TODO"],["<","scheduling","x","TODO"],["?","question","x","TODO"],["!","important","x","TODO"],["*","star","x","TODO"],['"',"quote","x","TODO"],["l","location","x","TODO"],["b","bookmark","x","TODO"],["i","information","x","TODO"],["S","savings","x","TODO"],["I","idea","x","TODO"],["p","pros","x","TODO"],["c","cons","x","TODO"],["f","fire","x","TODO"],["k","key","x","TODO"],["w","win","x","TODO"],["u","up","x","TODO"],["d","down","x","TODO"]]}function Av(){return[[" ","to-do","x","TODO"],["/","incomplete","x","IN_PROGRESS"],["x","done"," ","DONE"],["-","canceled"," ","CANCELLED"],[">","forwarded","x","TODO"],["<","scheduling","x","TODO"],["?","question","x","TODO"],["!","important","x","TODO"],["*","star","x","TODO"],['"',"quote","x","TODO"],["l","location","x","TODO"],["b","bookmark","x","TODO"],["i","information","x","TODO"],["S","savings","x","TODO"],["I","idea","x","TODO"],["p","pros","x","TODO"],["c","cons","x","TODO"],["f","fire","x","TODO"],["k","key","x","TODO"],["w","win","x","TODO"],["u","up","x","TODO"],["d","down","x","TODO"]]}var Pv=[{text:"Core Statuses",level:"h3",class:"",open:!0,notice:{class:"setting-item-description",text:null,html:"These are the core statuses that Tasks supports natively, with no need for custom CSS styling or theming.
You can add edit and add your own custom statuses in the section below.
"},settings:[{name:"",description:"",type:"function",initialValue:"",placeholder:"",settingName:"insertTaskCoreStatusSettings",featureFlag:"",notice:null}]},{text:"Custom Statuses",level:"h3",class:"",open:!0,notice:{class:"setting-item-description",text:null,html:`You should first select and install a CSS Snippet or Theme to style custom checkboxes.
Then, use the buttons below to set up your custom statuses, to match your chosen CSS checkboxes.
Note Any statuses with the same symbol as any earlier statuses will be ignored. You can confirm the actually loaded statuses by running the 'Create or edit task' command and looking at the Status drop-down.
See the documentation to get started!
`},settings:[{name:"",description:"",type:"function",initialValue:"",placeholder:"",settingName:"insertCustomTaskStatusSettings",featureFlag:"",notice:null}]}];var vr=require("obsidian");var ds=class{validate(e){let t=[];return t.push(...this.validateSymbol(e)),t.push(...this.validateName(e)),t.push(...this.validateNextSymbol(e)),t}validateStatusCollectionEntry(e){let[t,n,s,i]=e,a=[];if(a.push(...this.validateType(i)),t===s&&i!=="NON_TASK"&&a.push(`Status symbol '${t}' toggles to itself`),a.length>0)return a;let o=Q.createFromImportedValue(e).configuration;return a.push(...this.validateSymbolTypeConventions(o)),a.push(...this.validate(o)),a}validateSymbol(e){return ds.validateOneSymbol(e.symbol,"Task Status Symbol")}validateNextSymbol(e){return ds.validateOneSymbol(e.nextStatusSymbol,"Task Next Status Symbol")}validateName(e){let t=[];return e.name.length===0&&t.push("Task Status Name cannot be empty."),t}validateType(e){let t=Gt[e],n=[];return t||n.push(`Status Type "${e}" is not a valid type`),t=="EMPTY"&&n.push('Status Type "EMPTY" is not permitted in user data'),n}validateSymbolTypeConventions(e){let t=[],n=e.symbol,s=new Ee,i=n==="X"?"x":n,a=s.bySymbol(i);return a.type!=="EMPTY"&&(e.nextStatusSymbol!==a.nextStatusSymbol&&t.push(`Next Status Symbol for symbol '${n}': '${e.nextStatusSymbol}' is inconsistent with convention '${a.nextStatusSymbol}'`),e.type!==a.type&&t.push(`Status Type for symbol '${n}': '${e.type}' is inconsistent with convention '${a.type}'`)),t}static validateOneSymbol(e,t){let n=[];return e.length===0&&n.push(`${t} cannot be empty.`),e.length>1&&n.push(`${t} ("${e}") must be a single character.`),n}};var fs=new ds,zt=class extends vr.Modal{constructor(t,n,s){super(t.app);this.plugin=t;this.saved=!1;this.error=!1;this.statusSymbol=n.symbol,this.statusName=n.name,this.statusNextSymbol=n.nextStatusSymbol,this.statusAvailableAsCommand=n.availableAsCommand,this.type=n.type,this.isCoreStatus=s}statusConfiguration(){return new Ve(this.statusSymbol,this.statusName,this.statusNextSymbol,this.statusAvailableAsCommand,this.type)}display(){return L(this,null,function*(){let{contentEl:t}=this;t.empty();let n=t.createDiv(),s;new vr.Setting(n).setName("Task Status Symbol").setDesc("This is the character between the square braces. (It can only be edited for Custom statuses, and not Core statuses.)").addText(l=>{s=l,l.setValue(this.statusSymbol).onChange(c=>{this.statusSymbol=c,zt.setValid(l,fs.validateSymbol(this.statusConfiguration()))})}).setDisabled(this.isCoreStatus).then(l=>{zt.setValid(s,fs.validateSymbol(this.statusConfiguration()))});let i;new vr.Setting(n).setName("Task Status Name").setDesc("This is the friendly name of the task status.").addText(l=>{i=l,l.setValue(this.statusName).onChange(c=>{this.statusName=c,zt.setValid(l,fs.validateName(this.statusConfiguration()))})}).then(l=>{zt.setValid(i,fs.validateName(this.statusConfiguration()))});let a;new vr.Setting(n).setName("Task Next Status Symbol").setDesc("When clicked on this is the symbol that should be used next.").addText(l=>{a=l,l.setValue(this.statusNextSymbol).onChange(c=>{this.statusNextSymbol=c,zt.setValid(l,fs.validateNextSymbol(this.statusConfiguration()))})}).then(l=>{zt.setValid(a,fs.validateNextSymbol(this.statusConfiguration()))}),new vr.Setting(n).setName("Task Status Type").setDesc("Control how the status behaves for searching and toggling.").addDropdown(l=>{["TODO","IN_PROGRESS","DONE","CANCELLED","NON_TASK"].forEach(f=>{l.addOption(f,f)}),l.setValue(this.type).onChange(f=>{this.type=Q.getTypeFromStatusTypeString(f)})}),Q.tasksPluginCanCreateCommandsForStatuses()&&new vr.Setting(n).setName("Available as command").setDesc("If enabled this status will be available as a command so you can assign a hotkey and toggle the status using it.").addToggle(l=>{l.setValue(this.statusAvailableAsCommand).onChange(c=>L(this,null,function*(){this.statusAvailableAsCommand=c}))});let o=t.createDiv(),u=new vr.Setting(o);u.addButton(l=>(l.setTooltip("Save").setIcon("checkmark").onClick(()=>L(this,null,function*(){let c=fs.validate(this.statusConfiguration());if(c.length>0){let f=c.join(`
`)+`
-Fix errors before saving.`;new br.Notice(f);return}this.saved=!0,this.close()})),l)),u.addExtraButton(l=>(l.setIcon("cross").setTooltip("Cancel").onClick(()=>{this.saved=!1,this.close()}),l))})}onOpen(){this.display()}static setValidationError(t){t.inputEl.addClass("tasks-settings-is-invalid")}static removeValidationError(t){t.inputEl.removeClass("tasks-settings-is-invalid")}static setValid(t,n){n.length===0?zt.removeValidationError(t):zt.setValidationError(t)}};var It=class extends _e.PluginSettingTab{constructor({plugin:t}){super(t.app,t);this.customFunctions={insertTaskCoreStatusSettings:this.insertTaskCoreStatusSettings.bind(this),insertCustomTaskStatusSettings:this.insertCustomTaskStatusSettings.bind(this)};this.plugin=t}saveSettings(t){return L(this,null,function*(){yield this.plugin.saveSettings(),t&&this.display()})}display(){let{containerEl:t}=this;t.empty(),this.containerEl.addClass("tasks-settings"),t.createEl("h3",{text:"Tasks Settings"}),t.createEl("p",{cls:"tasks-setting-important",text:"Changing any settings requires a restart of obsidian."}),t.createEl("h4",{text:"Task Format Settings"}),new _e.Setting(t).setName("Task Format").setDesc(It.createFragmentWithHTML('The format that Tasks uses to read and write tasks.
Important: Tasks currently only supports one format at a time. Selecting Dataview will currently stop Tasks reading its own emoji signifiers.
See the documentation.
')).addDropdown(s=>{for(let i of Object.keys(Jr))s.addOption(i,Jr[i].displayName);s.setValue(K().taskFormat).onChange(i=>L(this,null,function*(){Ke({taskFormat:i}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Global filter Settings"}),new _e.Setting(t).setName("Global task filter").setDesc(It.createFragmentWithHTML('Recommended: Leave empty if you want all checklist items in your vault to be tasks managed by this plugin.
Use a global filter if you want Tasks to only act on a subset of your "- [ ]
" checklist items, so that a checklist item must include the specified string in its description in order to be considered a task.
For example, if you set the global filter to #task
, the Tasks plugin will only handle checklist items tagged with #task
.Other checklist items will remain normal checklist items and not appear in queries or get a done date set.
See the documentation.
')).addText(s=>{s.setPlaceholder("e.g. #task or TODO").setValue(ye.getInstance().get()).onChange(i=>L(this,null,function*(){Ke({globalFilter:i}),ye.getInstance().set(i),yield this.plugin.saveSettings()}))}),new _e.Setting(t).setName("Remove global filter from description").setDesc("Enabling this removes the string that you set as global filter from the task description when displaying a task.").addToggle(s=>{let i=K();s.setValue(i.removeGlobalFilter).onChange(a=>L(this,null,function*(){Ke({removeGlobalFilter:a}),ye.getInstance().setRemoveGlobalFilter(a),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Global Query"}),IP(new _e.Setting(t).setDesc(It.createFragmentWithHTML('A query that is automatically included at the start of every Tasks block in the vault. Useful for adding default filters, or layout options.
See the documentation.
')).addTextArea(s=>{let i=K();s.inputEl.rows=4,s.setPlaceholder(`# For example...
+Fix errors before saving.`;new vr.Notice(f);return}this.saved=!0,this.close()})),l)),u.addExtraButton(l=>(l.setIcon("cross").setTooltip("Cancel").onClick(()=>{this.saved=!1,this.close()}),l))})}onOpen(){this.display()}static setValidationError(t){t.inputEl.addClass("tasks-settings-is-invalid")}static removeValidationError(t){t.inputEl.removeClass("tasks-settings-is-invalid")}static setValid(t,n){n.length===0?zt.removeValidationError(t):zt.setValidationError(t)}};var It=class extends _e.PluginSettingTab{constructor({plugin:t}){super(t.app,t);this.customFunctions={insertTaskCoreStatusSettings:this.insertTaskCoreStatusSettings.bind(this),insertCustomTaskStatusSettings:this.insertCustomTaskStatusSettings.bind(this)};this.plugin=t}saveSettings(t){return L(this,null,function*(){yield this.plugin.saveSettings(),t&&this.display()})}display(){let{containerEl:t}=this;t.empty(),this.containerEl.addClass("tasks-settings"),t.createEl("h3",{text:"Tasks Settings"}),t.createEl("p",{cls:"tasks-setting-important",text:"Changing any settings requires a restart of obsidian."}),t.createEl("h4",{text:"Task Format Settings"}),new _e.Setting(t).setName("Task Format").setDesc(It.createFragmentWithHTML('The format that Tasks uses to read and write tasks.
Important: Tasks currently only supports one format at a time. Selecting Dataview will currently stop Tasks reading its own emoji signifiers.
See the documentation.
')).addDropdown(s=>{for(let i of Object.keys(rn))s.addOption(i,rn[i].displayName);s.setValue(K().taskFormat).onChange(i=>L(this,null,function*(){Ke({taskFormat:i}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Global filter Settings"}),new _e.Setting(t).setName("Global task filter").setDesc(It.createFragmentWithHTML('Recommended: Leave empty if you want all checklist items in your vault to be tasks managed by this plugin.
Use a global filter if you want Tasks to only act on a subset of your "- [ ]
" checklist items, so that a checklist item must include the specified string in its description in order to be considered a task.
For example, if you set the global filter to #task
, the Tasks plugin will only handle checklist items tagged with #task
.Other checklist items will remain normal checklist items and not appear in queries or get a done date set.
See the documentation.
')).addText(s=>{s.setPlaceholder("e.g. #task or TODO").setValue(ye.getInstance().get()).onChange(i=>L(this,null,function*(){Ke({globalFilter:i}),ye.getInstance().set(i),yield this.plugin.saveSettings()}))}),new _e.Setting(t).setName("Remove global filter from description").setDesc("Enabling this removes the string that you set as global filter from the task description when displaying a task.").addToggle(s=>{let i=K();s.setValue(i.removeGlobalFilter).onChange(a=>L(this,null,function*(){Ke({removeGlobalFilter:a}),ye.getInstance().setRemoveGlobalFilter(a),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Global Query"}),LP(new _e.Setting(t).setDesc(It.createFragmentWithHTML('A query that is automatically included at the start of every Tasks block in the vault. Useful for adding default filters, or layout options.
See the documentation.
')).addTextArea(s=>{let i=K();s.inputEl.rows=4,s.setPlaceholder(`# For example...
path does not include _templates/
limit 300
-show urgency`).setValue(i.globalQuery).onChange(a=>L(this,null,function*(){Ke({globalQuery:a}),ar.getInstance().set(a),yield this.plugin.saveSettings()}))})),t.createEl("h4",{text:"Task Statuses"});let{headingOpened:n}=K();Cv.forEach(s=>{this.addOneSettingsBlock(t,s,n)}),t.createEl("h4",{text:"Date Settings"}),new _e.Setting(t).setName("Set created date on every added task").setDesc(It.createFragmentWithHTML(`Enabling this will add a timestamp \u2795 YYYY-MM-DD before other date values, when a task is created with 'Create or edit task', or by completing a recurring task.See the documentation.
`)).addToggle(s=>{let i=K();s.setValue(i.setCreatedDate).onChange(a=>L(this,null,function*(){Ke({setCreatedDate:a}),yield this.plugin.saveSettings()}))}),new _e.Setting(t).setName("Set done date on every completed task").setDesc(It.createFragmentWithHTML('Enabling this will add a timestamp \u2705 YYYY-MM-DD at the end when a task is toggled to done.See the documentation.
')).addToggle(s=>{let i=K();s.setValue(i.setDoneDate).onChange(a=>L(this,null,function*(){Ke({setDoneDate:a}),yield this.plugin.saveSettings()}))}),new _e.Setting(t).setName("Set cancelled date on every cancelled task").setDesc(It.createFragmentWithHTML('Enabling this will add a timestamp \u274C YYYY-MM-DD at the end when a task is toggled to cancelled.See the documentation.
')).addToggle(s=>{let i=K();s.setValue(i.setCancelledDate).onChange(a=>L(this,null,function*(){Ke({setCancelledDate:a}),yield this.plugin.saveSettings()}))}),new _e.Setting(t).setName("Use filename as Scheduled date for undated tasks").setDesc(It.createFragmentWithHTML('Save time entering Scheduled (\u23F3) dates.If this option is enabled, any undated tasks will be given a default Scheduled date extracted from their file name.The date in the file name must be in one of YYYY-MM-DD
or YYYYMMDD
formats.Undated tasks have none of Due (\u{1F4C5} ), Scheduled (\u23F3) and Start (\u{1F6EB}) dates.See the documentation.
')).addToggle(s=>{let i=K();s.setValue(i.useFilenameAsScheduledDate).onChange(a=>L(this,null,function*(){Ke({useFilenameAsScheduledDate:a}),yield this.plugin.saveSettings()}))}),new _e.Setting(t).setName("Folders with default Scheduled dates").setDesc("Leave empty if you want to use default Scheduled dates everywhere, or enter a comma-separated list of folders.").addText(s=>L(this,null,function*(){let i=K();yield this.plugin.saveSettings(),s.setValue(It.renderFolderArray(i.filenameAsDateFolders)).onChange(a=>L(this,null,function*(){let o=It.parseCommaSeparatedFolders(a);Ke({filenameAsDateFolders:o}),yield this.plugin.saveSettings()}))})),t.createEl("h4",{text:"Recurring task Settings"}),new _e.Setting(t).setName("Next recurrence appears on the line below").setDesc(It.createFragmentWithHTML('Enabling this will make the next recurrence of a task appear on the line below the completed task. Otherwise the next recurrence will appear before the completed one.See the documentation.
')).addToggle(s=>{let{recurrenceOnNextLine:i}=K();s.setValue(i).onChange(a=>L(this,null,function*(){Ke({recurrenceOnNextLine:a}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Auto-suggest Settings"}),new _e.Setting(t).setName("Auto-suggest task content").setDesc(It.createFragmentWithHTML('Enabling this will open an intelligent suggest menu while typing inside a recognized task line.See the documentation.
')).addToggle(s=>{let i=K();s.setValue(i.autoSuggestInEditor).onChange(a=>L(this,null,function*(){Ke({autoSuggestInEditor:a}),yield this.plugin.saveSettings()}))}),new _e.Setting(t).setName("Minimum match length for auto-suggest").setDesc("If higher than 0, auto-suggest will be triggered only when the beginning of any supported keywords is recognized.").addSlider(s=>{let i=K();s.setLimits(0,3,1).setValue(i.autoSuggestMinMatch).setDynamicTooltip().onChange(a=>L(this,null,function*(){Ke({autoSuggestMinMatch:a}),yield this.plugin.saveSettings()}))}),new _e.Setting(t).setName("Maximum number of auto-suggestions to show").setDesc('How many suggestions should be shown when an auto-suggest menu pops up (including the "\u23CE" option).').addSlider(s=>{let i=K();s.setLimits(3,12,1).setValue(i.autoSuggestMaxItems).setDynamicTooltip().onChange(a=>L(this,null,function*(){Ke({autoSuggestMaxItems:a}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Dialog Settings"}),new _e.Setting(t).setName("Provide access keys in dialogs").setDesc(It.createFragmentWithHTML('If the access keys (keyboard shortcuts) for various controls in dialog boxes conflict with system keyboard shortcuts or assistive technology functionality that is important for you, you may want to deactivate them here.See the documentation.
')).addToggle(s=>{let i=K();s.setValue(i.provideAccessKeys).onChange(a=>L(this,null,function*(){Ke({provideAccessKeys:a}),yield this.plugin.saveSettings()}))})}addOneSettingsBlock(t,n,s){let i=t.createEl("details",{cls:"tasks-nested-settings",attr:ke({},n.open||s[n.text]?{open:!0}:{})});i.empty(),i.ontoggle=()=>{s[n.text]=i.open,Ke({headingOpened:s}),this.plugin.saveSettings()};let a=i.createEl("summary");if(new _e.Setting(a).setHeading().setName(n.text),a.createDiv("collapser").createDiv("handle"),n.notice!==null){let o=i.createEl("div",{cls:n.notice.class,text:n.notice.text});n.notice.html!==null&&o.insertAdjacentHTML("beforeend",n.notice.html)}n.settings.forEach(o=>{if(!(o.featureFlag!==""&&!Jb(o.featureFlag))&&(o.type==="checkbox"?new _e.Setting(i).setName(o.name).setDesc(o.description).addToggle(u=>{let l=K();l.generalSettings[o.settingName]||ts(o.settingName,o.initialValue),u.setValue(l.generalSettings[o.settingName]).onChange(c=>L(this,null,function*(){ts(o.settingName,c),yield this.plugin.saveSettings()}))}):o.type==="text"?new _e.Setting(i).setName(o.name).setDesc(o.description).addText(u=>{let l=K();l.generalSettings[o.settingName]||ts(o.settingName,o.initialValue);let c=f=>L(this,null,function*(){ts(o.settingName,f),yield this.plugin.saveSettings()});u.setPlaceholder(o.placeholder.toString()).setValue(l.generalSettings[o.settingName].toString()).onChange((0,_e.debounce)(c,500,!0))}):o.type==="textarea"?new _e.Setting(i).setName(o.name).setDesc(o.description).addTextArea(u=>{let l=K();l.generalSettings[o.settingName]||ts(o.settingName,o.initialValue);let c=f=>L(this,null,function*(){ts(o.settingName,f),yield this.plugin.saveSettings()});u.setPlaceholder(o.placeholder.toString()).setValue(l.generalSettings[o.settingName].toString()).onChange((0,_e.debounce)(c,500,!0)),u.inputEl.rows=8,u.inputEl.cols=40}):o.type==="function"&&this.customFunctions[o.settingName](i,this),o.notice!==null)){let u=i.createEl("p",{cls:o.notice.class,text:o.notice.text});o.notice.html!==null&&u.insertAdjacentHTML("beforeend",o.notice.html)}})}static parseCommaSeparatedFolders(t){return t.split(",").map(n=>n.trim()).map(n=>n.replace(/^\/|\/$/g,"")).filter(n=>n!=="")}static renderFolderArray(t){return t.join(",")}insertTaskCoreStatusSettings(t,n){let{statusSettings:s}=K();s.coreStatuses.forEach(a=>{Av(t,a,s.coreStatuses,s,n,n.plugin,!0)}),new _e.Setting(t).addButton(a=>{let o="Review and check your Statuses";a.setButtonText(o).setCta().onClick(()=>L(this,null,function*(){let l=window.moment().format("YYYY-MM-DD HH-mm-ss"),c=`Tasks Plugin - ${o} ${l}.md`,f=this.plugin.manifest.version,m=Ee.getInstance(),y=Ev(s,m,o,f),k=yield app.vault.create(c,y);yield this.app.workspace.getLeaf(!0).openFile(k)})),a.setTooltip("Create a new file in the root of the vault, containing a Mermaid diagram of the current status settings.")}).infoEl.remove()}insertCustomTaskStatusSettings(t,n){let{statusSettings:s}=K();s.customStatuses.forEach(l=>{Av(t,l,s.customStatuses,s,n,n.plugin,!1)}),t.createEl("div"),new _e.Setting(t).addButton(l=>{l.setButtonText("Add New Task Status").setCta().onClick(()=>L(this,null,function*(){Ne.addStatus(s.customStatuses,new Ve("","","",!1,"TODO")),yield pi(s,n)}))}).infoEl.remove();let a=[["AnuPpuccin Theme",kv()],["Aura Theme",Sv()],["Ebullientworks Theme",Ov()],["ITS Theme & SlRvb Checkboxes",Dv()],["Minimal Theme",Rv()],["Things Theme",Mv()],["LYT Mode Theme (Dark mode only)",xv()]];for(let[l,c]of a)new _e.Setting(t).addButton(m=>{let y=`${l}: Add ${c.length} supported Statuses`;m.setButtonText(y).onClick(()=>L(this,null,function*(){yield NP(c,s,n)}))}).infoEl.remove();new _e.Setting(t).addButton(l=>{l.setButtonText("Add All Unknown Status Types").setCta().onClick(()=>L(this,null,function*(){let f=this.plugin.getTasks().map(y=>y.status),m=Ee.getInstance().findUnknownStatuses(f);m.length!==0&&(m.forEach(y=>{Ne.addStatus(s.customStatuses,y)}),yield pi(s,n))}))}).infoEl.remove(),new _e.Setting(t).addButton(l=>{l.setButtonText("Reset Custom Status Types to Defaults").setWarning().onClick(()=>L(this,null,function*(){Ne.resetAllCustomStatuses(s),yield pi(s,n)}))}).infoEl.remove()}},$a=It;$a.createFragmentWithHTML=t=>createFragment(n=>n.createDiv().innerHTML=t);function Av(r,e,t,n,s,i,a){let o=r.createEl("pre");o.addClass("row-for-status"),o.textContent=new Q(e).previewText();let u=new _e.Setting(r);u.infoEl.replaceWith(o),a||u.addExtraButton(l=>{l.setIcon("cross").setTooltip("Delete").onClick(()=>L(this,null,function*(){Ne.deleteStatus(t,e)&&(yield pi(n,s))}))}),u.addExtraButton(l=>{l.setIcon("pencil").setTooltip("Edit").onClick(()=>L(this,null,function*(){let c=new zt(i,e,a);c.onClose=()=>L(this,null,function*(){c.saved&&Ne.replaceStatus(t,e,c.statusConfiguration())&&(yield pi(n,s))}),c.open()}))}),u.infoEl.remove()}function NP(r,e,t){return L(this,null,function*(){Ne.bulkAddStatusCollection(e,r).forEach(s=>{new _e.Notice(s)}),yield pi(e,t)})}function pi(r,e){return L(this,null,function*(){Ke({statusSettings:r}),Ne.applyToStatusRegistry(r,Ee.getInstance()),yield e.saveSettings(!0)})}function IP(r){let{settingEl:e,infoEl:t,controlEl:n}=r,s=n.querySelector("textarea");s!==null&&(e.style.display="block",t.style.marginRight="0px",s.style.minWidth="-webkit-fill-available")}var Pv=require("obsidian");var ll=class extends Pv.EditorSuggest{constructor(t,n){super(t);this.settings=n,t.scope.register([],"Tab",()=>{var i;let s=(i=this.context)==null?void 0:i.editor;return s?(s.exec("indentMore"),!1):!0})}onTrigger(t,n,s){if(!this.settings.autoSuggestInEditor)return null;let i=n.getLine(t.line);return Kb(i,t.ch)?{start:{line:t.line,ch:0},end:{line:t.line,ch:i.length},query:i}:null}getSuggestions(t){var a,o,u;let n=t.query,s=t.editor.getCursor();return((u=(o=(a=Ca()).buildSuggestions)==null?void 0:o.call(a,n,s.ch,this.settings))!=null?u:[]).map(l=>ot(ke({},l),{context:t}))}renderSuggestion(t,n){n.setText(t.displayText)}selectSuggestion(t,n){var u,l,c;let s=t.context.editor;if(t.suggestionType==="empty"){this.close();let f=new KeyboardEvent("keydown",{code:"Enter",key:"Enter"});(l=(u=s==null?void 0:s.cm)==null?void 0:u.contentDOM)==null||l.dispatchEvent(f);return}let i=t.context.editor.getCursor(),a={line:i.line,ch:(c=t.insertAt)!=null?c:i.ch},o=t.insertSkip?{line:i.line,ch:a.ch+t.insertSkip}:void 0;t.context.editor.replaceRange(t.appendText,a,o),t.context.editor.setCursor({line:i.line,ch:a.ch+t.appendText.length})}};var Nv=(r,e)=>{let t,n=new Promise((a,o)=>{t=a});return e(r,a=>{let o=a.map(u=>u.toFileLineString()).join(`
-`);t(o)}).open(),n};var Iv=(r,e)=>{let t=gu({line:"",path:""});return new On({app:r,task:t,onSubmit:e})};var Fv=r=>({createTaskLineModal:()=>Nv(r,Iv)});var cl=class extends Lv.Plugin{get apiV1(){return Fv(app)}onload(){return L(this,null,function*(){Rt.registerConsoleLogger(),wp("info",`loading plugin "${this.manifest.name}" v${this.manifest.version}`),yield this.loadSettings();let{loggingOptions:t}=K();Rt.configure(t),this.addSettingTab(new $a({plugin:this})),tv({metadataCache:this.app.metadataCache,vault:this.app.vault,workspace:this.app.workspace}),yield this.loadTaskStatuses();let n=new Zu({obsidianEvents:this.app.workspace});this.cache=new rs({metadataCache:this.app.metadataCache,vault:this.app.vault,events:n}),this.inlineRenderer=new sl({plugin:this}),this.queryRenderer=new ol({plugin:this,events:n}),this.registerEditorExtension(fv()),this.registerEditorSuggest(new ll(this.app,K())),new yu({plugin:this})})}loadTaskStatuses(){return L(this,null,function*(){let{statusSettings:t}=K();Ne.applyToStatusRegistry(t,Ee.getInstance())})}onunload(){var t;wp("info",`unloading plugin "${this.manifest.name}" v${this.manifest.version}`),(t=this.cache)==null||t.unload()}loadSettings(){return L(this,null,function*(){let t=yield this.loadData();Ke(t),t=K(),ye.getInstance().set(t.globalFilter),ye.getInstance().setRemoveGlobalFilter(t.removeGlobalFilter),ar.getInstance().set(t.globalQuery),yield this.loadTaskStatuses()})}saveSettings(){return L(this,null,function*(){yield this.saveData(K())})}getTasks(){var t;return(t=this.cache)==null?void 0:t.getTasks()}};
+show urgency`).setValue(i.globalQuery).onChange(a=>L(this,null,function*(){Ke({globalQuery:a}),or.getInstance().set(a),yield this.plugin.saveSettings()}))})),t.createEl("h4",{text:"Task Statuses"});let{headingOpened:n}=K();Pv.forEach(s=>{this.addOneSettingsBlock(t,s,n)}),t.createEl("h4",{text:"Date Settings"}),new _e.Setting(t).setName("Set created date on every added task").setDesc(It.createFragmentWithHTML(`Enabling this will add a timestamp \u2795 YYYY-MM-DD before other date values, when a task is created with 'Create or edit task', or by completing a recurring task.See the documentation.
`)).addToggle(s=>{let i=K();s.setValue(i.setCreatedDate).onChange(a=>L(this,null,function*(){Ke({setCreatedDate:a}),yield this.plugin.saveSettings()}))}),new _e.Setting(t).setName("Set done date on every completed task").setDesc(It.createFragmentWithHTML('Enabling this will add a timestamp \u2705 YYYY-MM-DD at the end when a task is toggled to done.See the documentation.
')).addToggle(s=>{let i=K();s.setValue(i.setDoneDate).onChange(a=>L(this,null,function*(){Ke({setDoneDate:a}),yield this.plugin.saveSettings()}))}),new _e.Setting(t).setName("Set cancelled date on every cancelled task").setDesc(It.createFragmentWithHTML('Enabling this will add a timestamp \u274C YYYY-MM-DD at the end when a task is toggled to cancelled.See the documentation.
')).addToggle(s=>{let i=K();s.setValue(i.setCancelledDate).onChange(a=>L(this,null,function*(){Ke({setCancelledDate:a}),yield this.plugin.saveSettings()}))}),new _e.Setting(t).setName("Use filename as Scheduled date for undated tasks").setDesc(It.createFragmentWithHTML('Save time entering Scheduled (\u23F3) dates.If this option is enabled, any undated tasks will be given a default Scheduled date extracted from their file name.The date in the file name must be in one of YYYY-MM-DD
or YYYYMMDD
formats.Undated tasks have none of Due (\u{1F4C5} ), Scheduled (\u23F3) and Start (\u{1F6EB}) dates.See the documentation.
')).addToggle(s=>{let i=K();s.setValue(i.useFilenameAsScheduledDate).onChange(a=>L(this,null,function*(){Ke({useFilenameAsScheduledDate:a}),yield this.plugin.saveSettings()}))}),new _e.Setting(t).setName("Folders with default Scheduled dates").setDesc("Leave empty if you want to use default Scheduled dates everywhere, or enter a comma-separated list of folders.").addText(s=>L(this,null,function*(){let i=K();yield this.plugin.saveSettings(),s.setValue(It.renderFolderArray(i.filenameAsDateFolders)).onChange(a=>L(this,null,function*(){let o=It.parseCommaSeparatedFolders(a);Ke({filenameAsDateFolders:o}),yield this.plugin.saveSettings()}))})),t.createEl("h4",{text:"Recurring task Settings"}),new _e.Setting(t).setName("Next recurrence appears on the line below").setDesc(It.createFragmentWithHTML('Enabling this will make the next recurrence of a task appear on the line below the completed task. Otherwise the next recurrence will appear before the completed one.See the documentation.
')).addToggle(s=>{let{recurrenceOnNextLine:i}=K();s.setValue(i).onChange(a=>L(this,null,function*(){Ke({recurrenceOnNextLine:a}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Auto-suggest Settings"}),new _e.Setting(t).setName("Auto-suggest task content").setDesc(It.createFragmentWithHTML('Enabling this will open an intelligent suggest menu while typing inside a recognized task line.See the documentation.
')).addToggle(s=>{let i=K();s.setValue(i.autoSuggestInEditor).onChange(a=>L(this,null,function*(){Ke({autoSuggestInEditor:a}),yield this.plugin.saveSettings()}))}),new _e.Setting(t).setName("Minimum match length for auto-suggest").setDesc("If higher than 0, auto-suggest will be triggered only when the beginning of any supported keywords is recognized.").addSlider(s=>{let i=K();s.setLimits(0,3,1).setValue(i.autoSuggestMinMatch).setDynamicTooltip().onChange(a=>L(this,null,function*(){Ke({autoSuggestMinMatch:a}),yield this.plugin.saveSettings()}))}),new _e.Setting(t).setName("Maximum number of auto-suggestions to show").setDesc('How many suggestions should be shown when an auto-suggest menu pops up (including the "\u23CE" option).').addSlider(s=>{let i=K();s.setLimits(3,12,1).setValue(i.autoSuggestMaxItems).setDynamicTooltip().onChange(a=>L(this,null,function*(){Ke({autoSuggestMaxItems:a}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Dialog Settings"}),new _e.Setting(t).setName("Provide access keys in dialogs").setDesc(It.createFragmentWithHTML('If the access keys (keyboard shortcuts) for various controls in dialog boxes conflict with system keyboard shortcuts or assistive technology functionality that is important for you, you may want to deactivate them here.See the documentation.
')).addToggle(s=>{let i=K();s.setValue(i.provideAccessKeys).onChange(a=>L(this,null,function*(){Ke({provideAccessKeys:a}),yield this.plugin.saveSettings()}))})}addOneSettingsBlock(t,n,s){let i=t.createEl("details",{cls:"tasks-nested-settings",attr:Se({},n.open||s[n.text]?{open:!0}:{})});i.empty(),i.ontoggle=()=>{s[n.text]=i.open,Ke({headingOpened:s}),this.plugin.saveSettings()};let a=i.createEl("summary");if(new _e.Setting(a).setHeading().setName(n.text),a.createDiv("collapser").createDiv("handle"),n.notice!==null){let o=i.createEl("div",{cls:n.notice.class,text:n.notice.text});n.notice.html!==null&&o.insertAdjacentHTML("beforeend",n.notice.html)}n.settings.forEach(o=>{if(!(o.featureFlag!==""&&!t_(o.featureFlag))&&(o.type==="checkbox"?new _e.Setting(i).setName(o.name).setDesc(o.description).addToggle(u=>{let l=K();l.generalSettings[o.settingName]||es(o.settingName,o.initialValue),u.setValue(l.generalSettings[o.settingName]).onChange(c=>L(this,null,function*(){es(o.settingName,c),yield this.plugin.saveSettings()}))}):o.type==="text"?new _e.Setting(i).setName(o.name).setDesc(o.description).addText(u=>{let l=K();l.generalSettings[o.settingName]||es(o.settingName,o.initialValue);let c=f=>L(this,null,function*(){es(o.settingName,f),yield this.plugin.saveSettings()});u.setPlaceholder(o.placeholder.toString()).setValue(l.generalSettings[o.settingName].toString()).onChange((0,_e.debounce)(c,500,!0))}):o.type==="textarea"?new _e.Setting(i).setName(o.name).setDesc(o.description).addTextArea(u=>{let l=K();l.generalSettings[o.settingName]||es(o.settingName,o.initialValue);let c=f=>L(this,null,function*(){es(o.settingName,f),yield this.plugin.saveSettings()});u.setPlaceholder(o.placeholder.toString()).setValue(l.generalSettings[o.settingName].toString()).onChange((0,_e.debounce)(c,500,!0)),u.inputEl.rows=8,u.inputEl.cols=40}):o.type==="function"&&this.customFunctions[o.settingName](i,this),o.notice!==null)){let u=i.createEl("p",{cls:o.notice.class,text:o.notice.text});o.notice.html!==null&&u.insertAdjacentHTML("beforeend",o.notice.html)}})}static parseCommaSeparatedFolders(t){return t.split(",").map(n=>n.trim()).map(n=>n.replace(/^\/|\/$/g,"")).filter(n=>n!=="")}static renderFolderArray(t){return t.join(",")}insertTaskCoreStatusSettings(t,n){let{statusSettings:s}=K();s.coreStatuses.forEach(a=>{Nv(t,a,s.coreStatuses,s,n,n.plugin,!0)}),new _e.Setting(t).addButton(a=>{let o="Review and check your Statuses";a.setButtonText(o).setCta().onClick(()=>L(this,null,function*(){let l=window.moment().format("YYYY-MM-DD HH-mm-ss"),c=`Tasks Plugin - ${o} ${l}.md`,f=this.plugin.manifest.version,m=Ee.getInstance(),y=Sv(s,m,o,f),k=yield app.vault.create(c,y);yield this.app.workspace.getLeaf(!0).openFile(k)})),a.setTooltip("Create a new file in the root of the vault, containing a Mermaid diagram of the current status settings.")}).infoEl.remove()}insertCustomTaskStatusSettings(t,n){let{statusSettings:s}=K();s.customStatuses.forEach(l=>{Nv(t,l,s.customStatuses,s,n,n.plugin,!1)}),t.createEl("div"),new _e.Setting(t).addButton(l=>{l.setButtonText("Add New Task Status").setCta().onClick(()=>L(this,null,function*(){Ne.addStatus(s.customStatuses,new Ve("","","",!1,"TODO")),yield fi(s,n)}))}).infoEl.remove();let a=[["AnuPpuccin Theme",Ov()],["Aura Theme",Dv()],["Ebullientworks Theme",xv()],["ITS Theme & SlRvb Checkboxes",Rv()],["Minimal Theme",Cv()],["Things Theme",Av()],["LYT Mode Theme (Dark mode only)",Mv()]];for(let[l,c]of a)new _e.Setting(t).addButton(m=>{let y=`${l}: Add ${c.length} supported Statuses`;m.setButtonText(y).onClick(()=>L(this,null,function*(){yield FP(c,s,n)}))}).infoEl.remove();new _e.Setting(t).addButton(l=>{l.setButtonText("Add All Unknown Status Types").setCta().onClick(()=>L(this,null,function*(){let f=this.plugin.getTasks().map(y=>y.status),m=Ee.getInstance().findUnknownStatuses(f);m.length!==0&&(m.forEach(y=>{Ne.addStatus(s.customStatuses,y)}),yield fi(s,n))}))}).infoEl.remove(),new _e.Setting(t).addButton(l=>{l.setButtonText("Reset Custom Status Types to Defaults").setWarning().onClick(()=>L(this,null,function*(){Ne.resetAllCustomStatuses(s),yield fi(s,n)}))}).infoEl.remove()}},Ba=It;Ba.createFragmentWithHTML=t=>createFragment(n=>n.createDiv().innerHTML=t);function Nv(r,e,t,n,s,i,a){let o=r.createEl("pre");o.addClass("row-for-status"),o.textContent=new Q(e).previewText();let u=new _e.Setting(r);u.infoEl.replaceWith(o),a||u.addExtraButton(l=>{l.setIcon("cross").setTooltip("Delete").onClick(()=>L(this,null,function*(){Ne.deleteStatus(t,e)&&(yield fi(n,s))}))}),u.addExtraButton(l=>{l.setIcon("pencil").setTooltip("Edit").onClick(()=>L(this,null,function*(){let c=new zt(i,e,a);c.onClose=()=>L(this,null,function*(){c.saved&&Ne.replaceStatus(t,e,c.statusConfiguration())&&(yield fi(n,s))}),c.open()}))}),u.infoEl.remove()}function FP(r,e,t){return L(this,null,function*(){Ne.bulkAddStatusCollection(e,r).forEach(s=>{new _e.Notice(s)}),yield fi(e,t)})}function fi(r,e){return L(this,null,function*(){Ke({statusSettings:r}),Ne.applyToStatusRegistry(r,Ee.getInstance()),yield e.saveSettings(!0)})}function LP(r){let{settingEl:e,infoEl:t,controlEl:n}=r,s=n.querySelector("textarea");s!==null&&(e.style.display="block",t.style.marginRight="0px",s.style.minWidth="-webkit-fill-available")}var Iv=require("obsidian");var cl=class extends Iv.EditorSuggest{constructor(t,n){super(t);this.settings=n,t.scope.register([],"Tab",()=>{var i;let s=(i=this.context)==null?void 0:i.editor;return s?(s.exec("indentMore"),!1):!0})}onTrigger(t,n,s){if(!this.settings.autoSuggestInEditor)return null;let i=n.getLine(t.line);return XT(i,t.ch)?{start:{line:t.line,ch:0},end:{line:t.line,ch:i.length},query:i}:null}getSuggestions(t){var a,o,u;let n=t.query,s=t.editor.getCursor();return((u=(o=(a=Ca()).buildSuggestions)==null?void 0:o.call(a,n,s.ch,this.settings))!=null?u:[]).map(l=>ot(Se({},l),{context:t}))}renderSuggestion(t,n){n.setText(t.displayText)}selectSuggestion(t,n){var u,l,c;let s=t.context.editor;if(t.suggestionType==="empty"){this.close();let f=new KeyboardEvent("keydown",{code:"Enter",key:"Enter"});(l=(u=s==null?void 0:s.cm)==null?void 0:u.contentDOM)==null||l.dispatchEvent(f);return}let i=t.context.editor.getCursor(),a={line:i.line,ch:(c=t.insertAt)!=null?c:i.ch},o=t.insertSkip?{line:i.line,ch:a.ch+t.insertSkip}:void 0;t.context.editor.replaceRange(t.appendText,a,o),t.context.editor.setCursor({line:i.line,ch:a.ch+t.appendText.length})}};var Fv=(r,e)=>{let t,n=new Promise((a,o)=>{t=a});return e(r,a=>{let o=a.map(u=>u.toFileLineString()).join(`
+`);t(o)}).open(),n};var Lv=(r,e)=>{let t=bu({line:"",path:""});return new On({app:r,task:t,onSubmit:e})};var Uv=r=>({createTaskLineModal:()=>Fv(r,Lv)});var dl=class extends qv.Plugin{get apiV1(){return Uv(app)}onload(){return L(this,null,function*(){Rt.registerConsoleLogger(),Ep("info",`loading plugin "${this.manifest.name}" v${this.manifest.version}`),yield this.loadSettings();let{loggingOptions:t}=K();Rt.configure(t),this.addSettingTab(new Ba({plugin:this})),nv({metadataCache:this.app.metadataCache,vault:this.app.vault,workspace:this.app.workspace}),yield this.loadTaskStatuses();let n=new Ju({obsidianEvents:this.app.workspace});this.cache=new ts({metadataCache:this.app.metadataCache,vault:this.app.vault,events:n}),this.inlineRenderer=new il({plugin:this}),this.queryRenderer=new ul({plugin:this,events:n}),this.registerEditorExtension(mv()),this.registerEditorSuggest(new cl(this.app,K())),new Tu({plugin:this})})}loadTaskStatuses(){return L(this,null,function*(){let{statusSettings:t}=K();Ne.applyToStatusRegistry(t,Ee.getInstance())})}onunload(){var t;Ep("info",`unloading plugin "${this.manifest.name}" v${this.manifest.version}`),(t=this.cache)==null||t.unload()}loadSettings(){return L(this,null,function*(){let t=yield this.loadData();Ke(t),t=K(),ye.getInstance().set(t.globalFilter),ye.getInstance().setRemoveGlobalFilter(t.removeGlobalFilter),or.getInstance().set(t.globalQuery),yield this.loadTaskStatuses()})}saveSettings(){return L(this,null,function*(){yield this.saveData(K())})}getTasks(){var t;return(t=this.cache)==null?void 0:t.getTasks()}};
/*!
* EventEmitter2
* https://github.com/hij1nx/EventEmitter2
diff --git a/.obsidian/plugins/obsidian-tasks-plugin/manifest.json b/.obsidian/plugins/obsidian-tasks-plugin/manifest.json
index 8235e41a..b491bf54 100644
--- a/.obsidian/plugins/obsidian-tasks-plugin/manifest.json
+++ b/.obsidian/plugins/obsidian-tasks-plugin/manifest.json
@@ -1,7 +1,7 @@
{
"id": "obsidian-tasks-plugin",
"name": "Tasks",
- "version": "5.6.0",
+ "version": "6.0.0",
"minAppVersion": "1.1.1",
"description": "Task management for Obsidian",
"helpUrl": "https://publish.obsidian.md/tasks/",
diff --git a/.obsidian/plugins/obsidian-tasks-plugin/styles.css b/.obsidian/plugins/obsidian-tasks-plugin/styles.css
index ec4138fe..08180d0e 100644
--- a/.obsidian/plugins/obsidian-tasks-plugin/styles.css
+++ b/.obsidian/plugins/obsidian-tasks-plugin/styles.css
@@ -46,19 +46,27 @@ ul.contains-task-list .task-list-item-checkbox {
}
}
-/* Pencil icon. */
-.tasks-edit {
- background-color: var(--text-faint);
- mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20aria-hidden%3D%22true%22%20focusable%3D%22false%22%20width%3D%221em%22%20height%3D%221em%22%20style%3D%22-ms-transform%3A%20rotate(360deg)%3B%20-webkit-transform%3A%20rotate(360deg)%3B%20transform%3A%20rotate(360deg)%3B%22%20preserveAspectRatio%3D%22xMidYMid%20meet%22%20viewBox%3D%220%200%201536%201536%22%3E%3Cpath%20d%3D%22M363%201408l91-91l-235-235l-91%2091v107h128v128h107zm523-928q0-22-22-22q-10%200-17%207l-542%20542q-7%207-7%2017q0%2022%2022%2022q10%200%2017-7l542-542q7-7%207-17zm-54-192l416%20416l-832%20832H0v-416zm683%2096q0%2053-37%2090l-166%20166l-416-416l166-165q36-38%2090-38q53%200%2091%2038l235%20234q37%2039%2037%2091z%22%20fill%3D%22%23626262%22%2F%3E%3C%2Fsvg%3E");
- -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20aria-hidden%3D%22true%22%20focusable%3D%22false%22%20width%3D%221em%22%20height%3D%221em%22%20style%3D%22-ms-transform%3A%20rotate(360deg)%3B%20-webkit-transform%3A%20rotate(360deg)%3B%20transform%3A%20rotate(360deg)%3B%22%20preserveAspectRatio%3D%22xMidYMid%20meet%22%20viewBox%3D%220%200%201536%201536%22%3E%3Cpath%20d%3D%22M363%201408l91-91l-235-235l-91%2091v107h128v128h107zm523-928q0-22-22-22q-10%200-17%207l-542%20542q-7%207-7%2017q0%2022%2022%2022q10%200%2017-7l542-542q7-7%207-17zm-54-192l416%20416l-832%20832H0v-416zm683%2096q0%2053-37%2090l-166%20166l-416-416l166-165q36-38%2090-38q53%200%2091%2038l235%20234q37%2039%2037%2091z%22%20fill%3D%22%23626262%22%2F%3E%3C%2Fsvg%3E");
- mask-size: contain;
- -webkit-mask-size: contain;
- display: inline-block;
+/* Edit and postpone */
+.tasks-edit, .tasks-postpone {
width: 1em;
height: 1em;
vertical-align: middle;
- margin-left: 0.5em;
+ margin-left: .33em;
cursor: pointer;
+ font-family: var(--font-interface);
+ color: var(--text-accent);
+}
+
+a.tasks-edit, a.tasks-postpone {
+ text-decoration: none;
+}
+
+.tasks-edit::after {
+ content: '📝';
+}
+
+.tasks-postpone::after {
+ content: '⏩';
}
/* Urgency score */
@@ -77,16 +85,6 @@ ul.contains-task-list .task-list-item-checkbox {
text-decoration: none;
}
-/* Postpone icon. */
-.tasks-postpone {
- background-color: transparent;
- padding: 0;
- font-size: var(--font-text-size);
- background-color: transparent;
- display: contents;
- cursor: pointer;
-}
-
.tasks-list-text {
position: relative;
}
diff --git a/.obsidian/plugins/obsidian-tracker/main.js b/.obsidian/plugins/obsidian-tracker/main.js
index 1d889fa4..45abf465 100644
--- a/.obsidian/plugins/obsidian-tracker/main.js
+++ b/.obsidian/plugins/obsidian-tracker/main.js
@@ -1,2 +1,2 @@
-"use strict";var t=require("obsidian");function e(t,e,n,r){return new(n||(n=Promise))((function(i,a){function l(t){try{u(r.next(t))}catch(t){a(t)}}function o(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(l,o)}u((r=r.apply(t,e||[])).next())}))}function n(t,e){return null==t||null==e?NaN:te?1:t>=e?0:NaN}function r(t,e){return null==t||null==e?NaN:et?1:e>=t?0:NaN}function i(t){let e,i,l;function o(t,n,r=0,a=t.length){if(r>>1;i(t[e],n)<0?r=e+1:a=e}while(rn(t(e),r),l=(e,n)=>t(e)-n):(e=t===n||t===r?t:a,i=t,l=t),{left:o,center:function(t,e,n=0,r=t.length){const i=o(t,e,n,r-1);return i>n&&l(t[i-1],e)>-l(t[i],e)?i-1:i},right:function(t,n,r=0,a=t.length){if(r>>1;i(t[e],n)<=0?r=e+1:a=e}while(r=t))-(null==e||!(e>=e))||(te?1:0)}const h=Math.sqrt(50),d=Math.sqrt(10),g=Math.sqrt(2);function p(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),l=a>=h?10:a>=d?5:a>=g?2:1;let o,u,s;return i<0?(s=Math.pow(10,-i)/l,o=Math.round(t*s),u=Math.round(e*s),o/se&&--u,s=-s):(s=Math.pow(10,i)*l,o=Math.round(t/s),u=Math.round(e/s),o*se&&--u),u=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n=i)&&(n=i)}return n}function x(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function A(t,e,r=0,i=1/0,a){if(e=Math.floor(e),r=Math.floor(Math.max(0,r)),i=Math.floor(Math.min(t.length-1,i)),!(r<=e&&e<=i))return t;for(a=void 0===a?c:function(t=n){if(t===n)return c;if("function"!=typeof t)throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||0===r?r:(0===t(n,n))-(0===t(e,e))}}(a);i>r;){if(i-r>600){const n=i-r+1,l=e-r+1,o=Math.log(n),u=.5*Math.exp(2*o/3),s=.5*Math.sqrt(o*u*(n-u)/n)*(l-n/2<0?-1:1);A(t,e,Math.max(r,Math.floor(e-l*u/n+s)),Math.min(i,Math.floor(e+(n-l)*u/n+s)),a)}const n=t[e];let l=r,o=i;for(w(t,r,e),a(t[i],n)>0&&w(t,r,i);l0;)--o}0===a(t[r],n)?w(t,r,o):(++o,w(t,o,i)),o<=e&&(r=o+1),e<=o&&(i=o-1)}return t}function w(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function b(t,e){return function(t,e,n){if(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}(t,n)),(r=t.length)&&!isNaN(e=+e)){if(e<=0||r<2)return x(t);if(e>=1)return v(t);var r,i=(r-1)*e,a=Math.floor(i),l=v(A(t,a).subarray(0,a+1));return l+(x(t.subarray(a+1))-l)*(i-a)}}(t,.5,e)}function D(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),a=new Array(i);++r+t(e)}function I(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function L(){return!this.__axis}function V(t,e){var n=[],r=null,i=null,a=6,l=6,o=3,u="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,s=t===M||t===E?-1:1,f=t===E||t===T?"x":"y",c=t===M||t===_?S:B;function h(h){var d=null==r?e.ticks?e.ticks.apply(e,n):e.domain():r,g=null==i?e.tickFormat?e.tickFormat.apply(e,n):C:i,p=Math.max(a,0)+o,y=e.range(),m=+y[0]+u,v=+y[y.length-1]+u,x=(e.bandwidth?I:N)(e.copy(),u),A=h.selection?h.selection():h,w=A.selectAll(".domain").data([null]),b=A.selectAll(".tick").data(d,e).order(),D=b.exit(),k=b.enter().append("g").attr("class","tick"),S=b.select("line"),B=b.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),b=b.merge(k),S=S.merge(k.append("line").attr("stroke","currentColor").attr(f+"2",s*a)),B=B.merge(k.append("text").attr("fill","currentColor").attr(f,s*p).attr("dy",t===M?"0em":t===_?"0.71em":"0.32em")),h!==A&&(w=w.transition(h),b=b.transition(h),S=S.transition(h),B=B.transition(h),D=D.transition(h).attr("opacity",F).attr("transform",(function(t){return isFinite(t=x(t))?c(t+u):this.getAttribute("transform")})),k.attr("opacity",F).attr("transform",(function(t){var e=this.parentNode.__axis;return c((e&&isFinite(e=e(t))?e:x(t))+u)}))),D.remove(),w.attr("d",t===E||t===T?l?"M"+s*l+","+m+"H"+u+"V"+v+"H"+s*l:"M"+u+","+m+"V"+v:l?"M"+m+","+s*l+"V"+u+"H"+v+"V"+s*l:"M"+m+","+u+"H"+v),b.attr("opacity",1).attr("transform",(function(t){return c(x(t)+u)})),S.attr(f+"2",s*a),B.attr(f,s*p).text(g),A.filter(L).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===T?"start":t===E?"end":"middle"),A.each((function(){this.__axis=x}))}return h.scale=function(t){return arguments.length?(e=t,h):e},h.ticks=function(){return n=Array.from(arguments),h},h.tickArguments=function(t){return arguments.length?(n=null==t?[]:Array.from(t),h):n.slice()},h.tickValues=function(t){return arguments.length?(r=null==t?null:Array.from(t),h):r&&r.slice()},h.tickFormat=function(t){return arguments.length?(i=t,h):i},h.tickSize=function(t){return arguments.length?(a=l=+t,h):a},h.tickSizeInner=function(t){return arguments.length?(a=+t,h):a},h.tickSizeOuter=function(t){return arguments.length?(l=+t,h):l},h.tickPadding=function(t){return arguments.length?(o=+t,h):o},h.offset=function(t){return arguments.length?(u=+t,h):u},h}function O(t){return V(_,t)}function P(t){return V(E,t)}var $={value:()=>{}};function Y(){for(var t,e=0,n=arguments.length,r={};e=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),l=-1,o=a.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++l0)for(var n,r,i=new Array(n),a=0;a=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),X.hasOwnProperty(e)?{space:X[e],local:t}:t}function j(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===H&&e.documentElement.namespaceURI===H?e.createElement(t):e.createElementNS(n,t)}}function q(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function G(t){var e=W(t);return(e.local?q:j)(e)}function Q(){}function Z(t){return null==t?Q:function(){return this.querySelector(t)}}function K(){return[]}function J(t){return null==t?K:function(){return this.querySelectorAll(t)}}function tt(t){return function(){return function(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}(t.apply(this,arguments))}}function et(t){return function(){return this.matches(t)}}function nt(t){return function(e){return e.matches(t)}}var rt=Array.prototype.find;function it(){return this.firstElementChild}var at=Array.prototype.filter;function lt(){return Array.from(this.children)}function ot(t){return new Array(t.length)}function ut(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function st(t,e,n,r,i,a){for(var l,o=0,u=e.length,s=a.length;oe?1:t>=e?0:NaN}function gt(t){return function(){this.removeAttribute(t)}}function pt(t){return function(){this.removeAttributeNS(t.space,t.local)}}function yt(t,e){return function(){this.setAttribute(t,e)}}function mt(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function vt(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function xt(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function At(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function wt(t){return function(){this.style.removeProperty(t)}}function bt(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Dt(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function kt(t,e){return t.style.getPropertyValue(e)||At(t).getComputedStyle(t,null).getPropertyValue(e)}function Ct(t){return function(){delete this[t]}}function Mt(t,e){return function(){this[t]=e}}function Tt(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function _t(t){return t.trim().split(/^|\s+/)}function Et(t){return t.classList||new Ft(t)}function Ft(t){this._node=t,this._names=_t(t.getAttribute("class")||"")}function St(t,e){for(var n=Et(t),r=-1,i=e.length;++r=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Jt=[null];function te(t,e){this._groups=t,this._parents=e}function ee(){return new te([[document.documentElement]],Jt)}function ne(t){return"string"==typeof t?new te([[document.querySelector(t)]],[document.documentElement]):new te([[t]],Jt)}function re(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function ie(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ae(){}te.prototype=ee.prototype={constructor:te,select:function(t){"function"!=typeof t&&(t=Z(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=A&&(A=x+1);!(v=y[A])&&++A=0;)(r=i[a])&&(l&&4^r.compareDocumentPosition(l)&&l.parentNode.insertBefore(r,l),l=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=dt);for(var n=this._groups,r=n.length,i=new Array(r),a=0;a1?this.each((null==e?wt:"function"==typeof e?Dt:bt)(t,e,null==n?"":n)):kt(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?Ct:"function"==typeof e?Tt:Mt)(t,e)):this.node()[t]},classed:function(t,e){var n=_t(t+"");if(arguments.length<2){for(var r=Et(this.node()),i=-1,a=n.length;++i=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),l=a.length;if(!(arguments.length<2)){for(o=e?Gt:qt,r=0;r>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?De(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?De(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=he.exec(t))?new Me(e[1],e[2],e[3],1):(e=de.exec(t))?new Me(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=ge.exec(t))?De(e[1],e[2],e[3],e[4]):(e=pe.exec(t))?De(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=ye.exec(t))?Be(e[1],e[2]/100,e[3]/100,1):(e=me.exec(t))?Be(e[1],e[2]/100,e[3]/100,e[4]):ve.hasOwnProperty(t)?be(ve[t]):"transparent"===t?new Me(NaN,NaN,NaN,0):null}function be(t){return new Me(t>>16&255,t>>8&255,255&t,1)}function De(t,e,n,r){return r<=0&&(t=e=n=NaN),new Me(t,e,n,r)}function ke(t){return t instanceof ae||(t=we(t)),t?new Me((t=t.rgb()).r,t.g,t.b,t.opacity):new Me}function Ce(t,e,n,r){return 1===arguments.length?ke(t):new Me(t,e,n,null==r?1:r)}function Me(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Te(){return`#${Se(this.r)}${Se(this.g)}${Se(this.b)}`}function _e(){const t=Ee(this.opacity);return`${1===t?"rgb(":"rgba("}${Fe(this.r)}, ${Fe(this.g)}, ${Fe(this.b)}${1===t?")":`, ${t})`}`}function Ee(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Fe(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Se(t){return((t=Fe(t))<16?"0":"")+t.toString(16)}function Be(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ie(t,e,n,r)}function Ne(t){if(t instanceof Ie)return new Ie(t.h,t.s,t.l,t.opacity);if(t instanceof ae||(t=we(t)),!t)return new Ie;if(t instanceof Ie)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),l=NaN,o=a-i,u=(a+i)/2;return o?(l=e===a?(n-r)/o+6*(n0&&u<1?0:l,new Ie(l,o,u,t.opacity)}function Ie(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Le(t){return(t=(t||0)%360)<0?t+360:t}function Ve(t){return Math.max(0,Math.min(1,t||0))}function Oe(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}re(ae,we,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:xe,formatHex:xe,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Ne(this).formatHsl()},formatRgb:Ae,toString:Ae}),re(Me,Ce,ie(ae,{brighter(t){return t=null==t?oe:Math.pow(oe,t),new Me(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?le:Math.pow(le,t),new Me(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Me(Fe(this.r),Fe(this.g),Fe(this.b),Ee(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Te,formatHex:Te,formatHex8:function(){return`#${Se(this.r)}${Se(this.g)}${Se(this.b)}${Se(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:_e,toString:_e})),re(Ie,(function(t,e,n,r){return 1===arguments.length?Ne(t):new Ie(t,e,n,null==r?1:r)}),ie(ae,{brighter(t){return t=null==t?oe:Math.pow(oe,t),new Ie(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?le:Math.pow(le,t),new Ie(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Me(Oe(t>=240?t-240:t+120,i,r),Oe(t,i,r),Oe(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Ie(Le(this.h),Ve(this.s),Ve(this.l),Ee(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Ee(this.opacity);return`${1===t?"hsl(":"hsla("}${Le(this.h)}, ${100*Ve(this.s)}%, ${100*Ve(this.l)}%${1===t?")":`, ${t})`}`}}));const Pe=Math.PI/180,$e=180/Math.PI,Ye=.96422,ze=1,Re=.82521,Ue=4/29,He=6/29,Xe=3*He*He,We=He*He*He;function je(t){if(t instanceof Ge)return new Ge(t.l,t.a,t.b,t.opacity);if(t instanceof tn)return en(t);t instanceof Me||(t=ke(t));var e,n,r=Je(t.r),i=Je(t.g),a=Je(t.b),l=Qe((.2225045*r+.7168786*i+.0606169*a)/ze);return r===i&&i===a?e=n=l:(e=Qe((.4360747*r+.3850649*i+.1430804*a)/Ye),n=Qe((.0139322*r+.0971045*i+.7141733*a)/Re)),new Ge(116*l-16,500*(e-l),200*(l-n),t.opacity)}function qe(t,e,n,r){return 1===arguments.length?je(t):new Ge(t,e,n,null==r?1:r)}function Ge(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function Qe(t){return t>We?Math.pow(t,1/3):t/Xe+Ue}function Ze(t){return t>He?t*t*t:Xe*(t-Ue)}function Ke(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Je(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function tn(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function en(t){if(isNaN(t.h))return new Ge(t.l,0,0,t.opacity);var e=t.h*Pe;return new Ge(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}re(Ge,qe,ie(ae,{brighter(t){return new Ge(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new Ge(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new Me(Ke(3.1338561*(e=Ye*Ze(e))-1.6168667*(t=ze*Ze(t))-.4906146*(n=Re*Ze(n))),Ke(-.9787684*e+1.9161415*t+.033454*n),Ke(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),re(tn,(function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof tn)return new tn(t.h,t.c,t.l,t.opacity);if(t instanceof Ge||(t=je(t)),0===t.a&&0===t.b)return new tn(NaN,0()=>t;function rn(t){return 1==(t=+t)?an:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):nn(isNaN(e)?n:e)}}function an(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):nn(isNaN(t)?e:t)}var ln=function t(e){var n=rn(e);function r(t,e){var r=n((t=Ce(t)).r,(e=Ce(e)).r),i=n(t.g,e.g),a=n(t.b,e.b),l=an(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=a(e),t.opacity=l(e),t+""}}return r.gamma=t,r}(1);var on,un=(on=function(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],a=t[r+1],l=r>0?t[r-1]:2*i-a,o=ra&&(i=e.slice(a,i),o[l]?o[l]+=i:o[++l]=i),(n=n[0])===(r=r[0])?o[l]?o[l]+=r:o[++l]=r:(o[++l]=null,u.push({i:l,x:hn(n,r)})),a=pn.lastIndex;return a180?e+=360:e-t>180&&(t+=360),a.push({i:n.push(i(n)+"rotate(",null,r)-2,x:hn(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(a.rotate,l.rotate,o,u),function(t,e,n,a){t!==e?a.push({i:n.push(i(n)+"skewX(",null,r)-2,x:hn(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(a.skewX,l.skewX,o,u),function(t,e,n,r,a,l){if(t!==n||e!==r){var o=a.push(i(a)+"scale(",null,",",null,")");l.push({i:o-4,x:hn(t,n)},{i:o-2,x:hn(e,r)})}else 1===n&&1===r||a.push(i(a)+"scale("+n+","+r+")")}(a.scaleX,a.scaleY,l.scaleX,l.scaleY,o,u),a=l=null,function(t){for(var e,n=-1,r=u.length;++n=0&&e._call.call(void 0,t),e=e._next;--En}()}finally{En=0,function(){var t,e,n=Tn,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Tn=e);_n=t,Hn(r)}(),In=0}}function Un(){var t=Vn.now(),e=t-Nn;e>Bn&&(Ln-=e,Nn=t)}function Hn(t){En||(Fn&&(Fn=clearTimeout(Fn)),t-In>24?(t<1/0&&(Fn=setTimeout(Rn,t-Vn.now()-Ln)),Sn&&(Sn=clearInterval(Sn))):(Sn||(Nn=Vn.now(),Sn=setInterval(Un,Bn)),En=1,On(Rn)))}function Xn(t,e,n){var r=new Yn;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}Yn.prototype=zn.prototype={constructor:Yn,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Pn():+n)+(null==e?0:+e),this._next||_n===this||(_n?_n._next=this:Tn=this,_n=this),this._call=t,this._time=n,Hn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Hn())}};var Wn=Y("start","end","cancel","interrupt"),jn=[],qn=0,Gn=1,Qn=2,Zn=3,Kn=4,Jn=5,tr=6;function er(t,e,n,r,i,a){var l=t.__transition;if(l){if(n in l)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function a(t){n.state=Gn,n.timer.restart(l,n.delay,n.time),n.delay<=t&&l(t-n.delay)}function l(a){var s,f,c,h;if(n.state!==Gn)return u();for(s in i)if((h=i[s]).name===n.name){if(h.state===Zn)return Xn(l);h.state===Kn?(h.state=tr,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[s]):+sqn)throw new Error("too late; already scheduled");return n}function rr(t,e){var n=ir(t,e);if(n.state>Zn)throw new Error("too late; already running");return n}function ir(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function ar(t,e){var n,r;return function(){var i=rr(this,t),a=i.tween;if(a!==n)for(var l=0,o=(r=n=a).length;l=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?nr:rr;return function(){var l=a(this,t),o=l.on;o!==r&&(i=(r=o).copy()).on(e,n),l.on=i}}(n,t,e))},attr:function(t,e){var n=W(t),r="transform"===n?Cn:ur;return this.attrTween(t,"function"==typeof e?(n.local?gr:dr)(n,r,or(this,"attr."+t,e)):null==e?(n.local?fr:sr)(n):(n.local?hr:cr)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=W(t);return this.tween(n,(r.local?pr:yr)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?kn:ur;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var a=kt(this,t),l=(this.style.removeProperty(t),kt(this,t));return a===l?null:a===n&&l===r?i:i=e(n=a,r=l)}}(t,r)).on("end.style."+t,br(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,a;return function(){var l=kt(this,t),o=n(this),u=o+"";return null==o&&(this.style.removeProperty(t),u=o=kt(this,t)),l===u?null:l===r&&u===i?a:(i=u,a=e(r=l,o))}}(t,r,or(this,"style."+t,e))).each(function(t,e){var n,r,i,a,l="style."+e,o="end."+l;return function(){var u=rr(this,t),s=u.on,f=null==u.value[l]?a||(a=br(e)):void 0;s===n&&i===f||(r=(n=s).copy()).on(o,i=f),u.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,a=n+"";return function(){var l=kt(this,t);return l===a?null:l===r?i:i=e(r=l,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function a(){var a=e.apply(this,arguments);return a!==i&&(r=(i=a)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,a,n)),r}return a._value=e,a}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(or(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=ir(this.node(),n).tween,a=0,l=i.length;aQn&&n.state=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Nr;const n=10**e;return function(t){this._+=t[0];for(let e=1,r=t.length;eSr)if(Math.abs(f*o-u*s)>Sr&&i){let h=n-a,d=r-l,g=o*o+u*u,p=h*h+d*d,y=Math.sqrt(g),m=Math.sqrt(c),v=i*Math.tan((Er-Math.acos((g+c-p)/(2*y*m)))/2),x=v/m,A=v/y;Math.abs(x-1)>Sr&&this._append`L${t+x*s},${e+x*f}`,this._append`A${i},${i},0,0,${+(f*h>s*d)},${this._x1=t+A*o},${this._y1=e+A*u}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,n,r,i,a){if(t=+t,e=+e,a=!!a,(n=+n)<0)throw new Error(`negative radius: ${n}`);let l=n*Math.cos(r),o=n*Math.sin(r),u=t+l,s=e+o,f=1^a,c=a?r-i:i-r;null===this._x1?this._append`M${u},${s}`:(Math.abs(this._x1-u)>Sr||Math.abs(this._y1-s)>Sr)&&this._append`L${u},${s}`,n&&(c<0&&(c=c%Fr+Fr),c>Br?this._append`A${n},${n},0,1,${f},${t-l},${e-o}A${n},${n},0,1,${f},${this._x1=u},${this._y1=s}`:c>Sr&&this._append`A${n},${n},0,${+(c>=Er)},${f},${this._x1=t+n*Math.cos(i)},${this._y1=e+n*Math.sin(i)}`)}rect(t,e,n,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}}function Lr(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Vr(t){return(t=Lr(Math.abs(t)))?t[1]:NaN}var Or,Pr=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $r(t){if(!(e=Pr.exec(t)))throw new Error("invalid format: "+t);var e;return new Yr({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Yr(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function zr(t,e){var n=Lr(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}$r.prototype=Yr.prototype,Yr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Rr={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>zr(100*t,e),r:zr,s:function(t,e){var n=Lr(t,e);if(!n)return t+"";var r=n[0],i=n[1],a=i-(Or=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,l=r.length;return a===l?r:a>l?r+new Array(a-l+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+Lr(t,Math.max(0,e+a-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ur(t){return t}var Hr,Xr,Wr,jr=Array.prototype.map,qr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Gr(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Ur:(e=jr.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,a=[],l=0,o=e[0],u=0;i>0&&o>0&&(u+o+1>r&&(o=Math.max(1,r-u)),a.push(t.substring(i-=o,i+o)),!((u+=o+1)>r));)o=e[l=(l+1)%e.length];return a.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",l=void 0===t.decimal?".":t.decimal+"",o=void 0===t.numerals?Ur:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(jr.call(t.numerals,String)),u=void 0===t.percent?"%":t.percent+"",s=void 0===t.minus?"−":t.minus+"",f=void 0===t.nan?"NaN":t.nan+"";function c(t){var e=(t=$r(t)).fill,n=t.align,c=t.sign,h=t.symbol,d=t.zero,g=t.width,p=t.comma,y=t.precision,m=t.trim,v=t.type;"n"===v?(p=!0,v="g"):Rr[v]||(void 0===y&&(y=12),m=!0,v="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var x="$"===h?i:"#"===h&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",A="$"===h?a:/[%p]/.test(v)?u:"",w=Rr[v],b=/[defgprs%]/.test(v);function D(t){var i,a,u,h=x,D=A;if("c"===v)D=w(t)+D,t="";else{var k=(t=+t)<0||1/t<0;if(t=isNaN(t)?f:w(Math.abs(t),y),m&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),k&&0==+t&&"+"!==c&&(k=!1),h=(k?"("===c?c:s:"-"===c||"("===c?"":c)+h,D=("s"===v?qr[8+Or/3]:"")+D+(k&&"("===c?")":""),b)for(i=-1,a=t.length;++i(u=t.charCodeAt(i))||u>57){D=(46===u?l+t.slice(i+1):t.slice(i))+D,t=t.slice(0,i);break}}p&&!d&&(t=r(t,1/0));var C=h.length+t.length+D.length,M=C>1)+h+t+D+M.slice(C);break;default:t=M+h+t+D}return o(t)}return y=void 0===y?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y)),D.toString=function(){return t+""},D}return{format:c,formatPrefix:function(t,e){var n=c(((t=$r(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Vr(e)/3))),i=Math.pow(10,-r),a=qr[8+r/3];return function(t){return n(i*t)+a}}}}function Qr(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}Hr=Gr({thousands:",",grouping:[3],currency:["$",""]}),Xr=Hr.format,Wr=Hr.formatPrefix;const Zr=Symbol("implicit");function Kr(){var t=new u,e=[],n=[],r=Zr;function i(i){let a=t.get(i);if(void 0===a){if(r!==Zr)return r;t.set(i,a=e.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new u;for(const r of n)t.has(r)||t.set(r,e.push(r)-1);return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return Kr(e,n).unknown(r)},Qr.apply(i,arguments),i}function Jr(t){return+t}var ti=[0,1];function ei(t){return t}function ni(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function ri(t,e,n){var r=t[0],i=t[1],a=e[0],l=e[1];return ie&&(n=t,t=e,e=n),s=function(n){return Math.max(t,Math.min(e,n))}),r=u>2?ii:ri,i=a=null,c}function c(e){return null==e||isNaN(e=+e)?n:(i||(i=r(l.map(t),o,u)))(t(s(e)))}return c.invert=function(n){return s(e((a||(a=r(o,l.map(t),hn)))(n)))},c.domain=function(t){return arguments.length?(l=Array.from(t,Jr),f()):l.slice()},c.range=function(t){return arguments.length?(o=Array.from(t),f()):o.slice()},c.rangeRound=function(t){return o=Array.from(t),u=vn,f()},c.clamp=function(t){return arguments.length?(s=!!t||ei,f()):s!==ei},c.interpolate=function(t){return arguments.length?(u=t,f()):u},c.unknown=function(t){return arguments.length?(n=t,c):n},function(n,r){return t=n,e=r,f()}}function oi(){return li()(ei,ei)}function ui(t,e,n,r){var i,a=m(t,e,n);switch((r=$r(null==r?",f":r)).type){case"s":var l=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Vr(e)/3)))-Vr(Math.abs(t)))}(a,l))||(r.precision=i),Wr(r,l);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Vr(e)-Vr(t))+1}(a,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-Vr(Math.abs(t)))}(a))||(r.precision=i-2*("%"===r.type))}return Xr(r)}function si(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){if(!((n=+n)>0))return[];if((t=+t)==(e=+e))return[t];const r=e=i))return[];const o=a-i+1,u=new Array(o);if(r)if(l<0)for(let t=0;t0;){if((i=y(u,s,n))===r)return a[l]=u,a[o]=s,e(a);if(i>0)u=Math.floor(u/i)*i,s=Math.ceil(s/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,s=Math.floor(s*i)/i}r=i}return t},t}function fi(){var t=oi();return t.copy=function(){return ai(t,fi())},Qr.apply(t,arguments),si(t)}const ci=new Date,hi=new Date;function di(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=e=>(t(e=new Date(+e)),e),i.ceil=n=>(t(n=new Date(n-1)),e(n,1),t(n),n),i.round=t=>{const e=i(t),n=i.ceil(t);return t-e(e(t=new Date(+t),null==n?1:Math.floor(n)),t),i.range=(n,r,a)=>{const l=[];if(n=i.ceil(n),a=null==a?1:Math.floor(a),!(n0))return l;let o;do{l.push(o=new Date(+n)),e(n,a),t(n)}while(odi((e=>{if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),((t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););})),n&&(i.count=(e,r)=>(ci.setTime(+e),hi.setTime(+r),t(ci),t(hi),Math.floor(n(ci,hi))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?e=>r(e)%t==0:e=>i.count(0,e)%t==0):i:null)),i}const gi=di((()=>{}),((t,e)=>{t.setTime(+t+e)}),((t,e)=>e-t));gi.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?di((e=>{e.setTime(Math.floor(e/t)*t)}),((e,n)=>{e.setTime(+e+n*t)}),((e,n)=>(n-e)/t)):gi:null),gi.range;const pi=1e3,yi=6e4,mi=36e5,vi=864e5,xi=6048e5,Ai=2592e6,wi=31536e6,bi=di((t=>{t.setTime(t-t.getMilliseconds())}),((t,e)=>{t.setTime(+t+e*pi)}),((t,e)=>(e-t)/pi),(t=>t.getUTCSeconds()));bi.range;const Di=di((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*pi)}),((t,e)=>{t.setTime(+t+e*yi)}),((t,e)=>(e-t)/yi),(t=>t.getMinutes()));Di.range;const ki=di((t=>{t.setUTCSeconds(0,0)}),((t,e)=>{t.setTime(+t+e*yi)}),((t,e)=>(e-t)/yi),(t=>t.getUTCMinutes()));ki.range;const Ci=di((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*pi-t.getMinutes()*yi)}),((t,e)=>{t.setTime(+t+e*mi)}),((t,e)=>(e-t)/mi),(t=>t.getHours()));Ci.range;const Mi=di((t=>{t.setUTCMinutes(0,0,0)}),((t,e)=>{t.setTime(+t+e*mi)}),((t,e)=>(e-t)/mi),(t=>t.getUTCHours()));Mi.range;const Ti=di((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*yi)/vi),(t=>t.getDate()-1));Ti.range;const _i=di((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/vi),(t=>t.getUTCDate()-1));_i.range;const Ei=di((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/vi),(t=>Math.floor(t/vi)));function Fi(t){return di((e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),((t,e)=>{t.setDate(t.getDate()+7*e)}),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*yi)/xi))}Ei.range;const Si=Fi(0),Bi=Fi(1),Ni=Fi(2),Ii=Fi(3),Li=Fi(4),Vi=Fi(5),Oi=Fi(6);function Pi(t){return di((e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)}),((t,e)=>(e-t)/xi))}Si.range,Bi.range,Ni.range,Ii.range,Li.range,Vi.range,Oi.range;const $i=Pi(0),Yi=Pi(1),zi=Pi(2),Ri=Pi(3),Ui=Pi(4),Hi=Pi(5),Xi=Pi(6);$i.range,Yi.range,zi.range,Ri.range,Ui.range,Hi.range,Xi.range;const Wi=di((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,e)=>{t.setMonth(t.getMonth()+e)}),((t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())),(t=>t.getMonth()));Wi.range;const ji=di((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)}),((t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth()));ji.range;const qi=di((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,e)=>{t.setFullYear(t.getFullYear()+e)}),((t,e)=>e.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));qi.every=t=>isFinite(t=Math.floor(t))&&t>0?di((e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,n)=>{e.setFullYear(e.getFullYear()+n*t)})):null,qi.range;const Gi=di((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)}),((t,e)=>e.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));Gi.every=t=>isFinite(t=Math.floor(t))&&t>0?di((e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null,Gi.range;const[Qi,Zi]=function(t,e,n,r,a,l){const o=[[bi,1,pi],[bi,5,5e3],[bi,15,15e3],[bi,30,3e4],[l,1,yi],[l,5,3e5],[l,15,9e5],[l,30,18e5],[a,1,mi],[a,3,108e5],[a,6,216e5],[a,12,432e5],[r,1,vi],[r,2,1728e5],[n,1,xi],[e,1,Ai],[e,3,7776e6],[t,1,wi]];function u(e,n,r){const a=Math.abs(n-e)/r,l=i((([,,t])=>t)).right(o,a);if(l===o.length)return t.every(m(e/wi,n/wi,r));if(0===l)return gi.every(Math.max(m(e,n,r),1));const[u,s]=o[a/o[l-1][2][t.toLowerCase(),e])))}function ca(t,e,n){var r=ia.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function ha(t,e,n){var r=ia.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function da(t,e,n){var r=ia.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function ga(t,e,n){var r=ia.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function pa(t,e,n){var r=ia.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function ya(t,e,n){var r=ia.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function ma(t,e,n){var r=ia.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function va(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function xa(t,e,n){var r=ia.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Aa(t,e,n){var r=ia.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function wa(t,e,n){var r=ia.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function ba(t,e,n){var r=ia.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Da(t,e,n){var r=ia.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function ka(t,e,n){var r=ia.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Ca(t,e,n){var r=ia.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Ma(t,e,n){var r=ia.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Ta(t,e,n){var r=ia.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function _a(t,e,n){var r=aa.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Ea(t,e,n){var r=ia.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Fa(t,e,n){var r=ia.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Sa(t,e){return oa(t.getDate(),e,2)}function Ba(t,e){return oa(t.getHours(),e,2)}function Na(t,e){return oa(t.getHours()%12||12,e,2)}function Ia(t,e){return oa(1+Ti.count(qi(t),t),e,3)}function La(t,e){return oa(t.getMilliseconds(),e,3)}function Va(t,e){return La(t,e)+"000"}function Oa(t,e){return oa(t.getMonth()+1,e,2)}function Pa(t,e){return oa(t.getMinutes(),e,2)}function $a(t,e){return oa(t.getSeconds(),e,2)}function Ya(t){var e=t.getDay();return 0===e?7:e}function za(t,e){return oa(Si.count(qi(t)-1,t),e,2)}function Ra(t){var e=t.getDay();return e>=4||0===e?Li(t):Li.ceil(t)}function Ua(t,e){return t=Ra(t),oa(Li.count(qi(t),t)+(4===qi(t).getDay()),e,2)}function Ha(t){return t.getDay()}function Xa(t,e){return oa(Bi.count(qi(t)-1,t),e,2)}function Wa(t,e){return oa(t.getFullYear()%100,e,2)}function ja(t,e){return oa((t=Ra(t)).getFullYear()%100,e,2)}function qa(t,e){return oa(t.getFullYear()%1e4,e,4)}function Ga(t,e){var n=t.getDay();return oa((t=n>=4||0===n?Li(t):Li.ceil(t)).getFullYear()%1e4,e,4)}function Qa(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+oa(e/60|0,"0",2)+oa(e%60,"0",2)}function Za(t,e){return oa(t.getUTCDate(),e,2)}function Ka(t,e){return oa(t.getUTCHours(),e,2)}function Ja(t,e){return oa(t.getUTCHours()%12||12,e,2)}function tl(t,e){return oa(1+_i.count(Gi(t),t),e,3)}function el(t,e){return oa(t.getUTCMilliseconds(),e,3)}function nl(t,e){return el(t,e)+"000"}function rl(t,e){return oa(t.getUTCMonth()+1,e,2)}function il(t,e){return oa(t.getUTCMinutes(),e,2)}function al(t,e){return oa(t.getUTCSeconds(),e,2)}function ll(t){var e=t.getUTCDay();return 0===e?7:e}function ol(t,e){return oa($i.count(Gi(t)-1,t),e,2)}function ul(t){var e=t.getUTCDay();return e>=4||0===e?Ui(t):Ui.ceil(t)}function sl(t,e){return t=ul(t),oa(Ui.count(Gi(t),t)+(4===Gi(t).getUTCDay()),e,2)}function fl(t){return t.getUTCDay()}function cl(t,e){return oa(Yi.count(Gi(t)-1,t),e,2)}function hl(t,e){return oa(t.getUTCFullYear()%100,e,2)}function dl(t,e){return oa((t=ul(t)).getUTCFullYear()%100,e,2)}function gl(t,e){return oa(t.getUTCFullYear()%1e4,e,4)}function pl(t,e){var n=t.getUTCDay();return oa((t=n>=4||0===n?Ui(t):Ui.ceil(t)).getUTCFullYear()%1e4,e,4)}function yl(){return"+0000"}function ml(){return"%"}function vl(t){return+t}function xl(t){return Math.floor(+t/1e3)}function Al(t){return new Date(t)}function wl(t){return t instanceof Date?+t:+new Date(+t)}function bl(t,e,n,r,i,a,l,o,u,s){var f=oi(),c=f.invert,h=f.domain,d=s(".%L"),g=s(":%S"),p=s("%I:%M"),y=s("%I %p"),m=s("%a %d"),v=s("%b %d"),x=s("%B"),A=s("%Y");function w(t){return(u(t)=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:vl,s:xl,S:$a,u:Ya,U:za,V:Ua,w:Ha,W:Xa,x:null,X:null,y:Wa,Y:qa,Z:Qa,"%":ml},A={a:function(t){return l[t.getUTCDay()]},A:function(t){return a[t.getUTCDay()]},b:function(t){return u[t.getUTCMonth()]},B:function(t){return o[t.getUTCMonth()]},c:null,d:Za,e:Za,f:nl,g:dl,G:pl,H:Ka,I:Ja,j:tl,L:el,m:rl,M:il,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:vl,s:xl,S:al,u:ll,U:ol,V:sl,w:fl,W:cl,x:null,X:null,y:hl,Y:gl,Z:yl,"%":ml},w={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=g.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=c.exec(e.slice(n));return r?(t.w=h.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=m.exec(e.slice(n));return r?(t.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=p.exec(e.slice(n));return r?(t.m=y.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return k(t,e,n,r)},d:wa,e:wa,f:Ta,g:ma,G:ya,H:Da,I:Da,j:ba,L:Ma,m:Aa,M:ka,p:function(t,e,n){var r=s.exec(e.slice(n));return r?(t.p=f.get(r[0].toLowerCase()),n+r[0].length):-1},q:xa,Q:Ea,s:Fa,S:Ca,u:ha,U:da,V:ga,w:ca,W:pa,x:function(t,e,r){return k(t,n,e,r)},X:function(t,e,n){return k(t,r,e,n)},y:ma,Y:ya,Z:va,"%":_a};function b(t,e){return function(n){var r,i,a,l=[],o=-1,u=0,s=t.length;for(n instanceof Date||(n=new Date(+n));++o53)return null;"w"in a||(a.w=1),"Z"in a?(i=(r=Ji(ta(a.y,0,1))).getUTCDay(),r=i>4||0===i?Yi.ceil(r):Yi(r),r=_i.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=Ki(ta(a.y,0,1))).getDay(),r=i>4||0===i?Bi.ceil(r):Bi(r),r=Ti.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),i="Z"in a?Ji(ta(a.y,0,1)).getUTCDay():Ki(ta(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,Ji(a)):Ki(a)}}function k(t,e,n,r){for(var i,a,l=0,o=e.length,u=n.length;l=u)return-1;if(37===(i=e.charCodeAt(l++))){if(i=e.charAt(l++),!(a=w[i in ra?e.charAt(l++):i])||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return x.x=b(n,x),x.X=b(r,x),x.c=b(e,x),A.x=b(n,A),A.X=b(r,A),A.c=b(e,A),{format:function(t){var e=b(t+="",x);return e.toString=function(){return t},e},parse:function(t){var e=D(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=b(t+="",A);return e.toString=function(){return t},e},utcParse:function(t){var e=D(t+="",!0);return e.toString=function(){return t},e}}}(t),na=ea.format,ea.parse,ea.utcFormat,ea.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var kl=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map((function(t){for(var e=t.length/6|0,n=new Array(e),r=0;r{un(t[t.length-1])})(kl);const Ml=Math.abs,Tl=Math.atan2,_l=Math.cos,El=Math.max,Fl=Math.min,Sl=Math.sin,Bl=Math.sqrt,Nl=1e-12,Il=Math.PI,Ll=Il/2,Vl=2*Il;function Ol(t){return t>=1?Ll:t<=-1?-Ll:Math.asin(t)}function Pl(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(null==n)e=null;else{const t=Math.floor(n);if(!(t>=0))throw new RangeError(`invalid digits: ${n}`);e=t}return t},()=>new Ir(e)}function $l(t){return t.innerRadius}function Yl(t){return t.outerRadius}function zl(t){return t.startAngle}function Rl(t){return t.endAngle}function Ul(t){return t&&t.padAngle}function Hl(t,e,n,r,i,a,l){var o=t-n,u=e-r,s=(l?a:-a)/Bl(o*o+u*u),f=s*u,c=-s*o,h=t+f,d=e+c,g=n+f,p=r+c,y=(h+g)/2,m=(d+p)/2,v=g-h,x=p-d,A=v*v+x*x,w=i-a,b=h*p-g*d,D=(x<0?-1:1)*Bl(El(0,w*w*A-b*b)),k=(b*x-v*D)/A,C=(-b*v-x*D)/A,M=(b*x+v*D)/A,T=(-b*v+x*D)/A,_=k-y,E=C-m,F=M-y,S=T-m;return _*_+E*E>F*F+S*S&&(k=M,C=T),{cx:k,cy:C,x01:-f,y01:-c,x11:k*(i/w-1),y11:C*(i/w-1)}}function Xl(){var t=$l,e=Yl,n=Cl(0),r=null,i=zl,a=Rl,l=Ul,o=null,u=Pl(s);function s(){var s,f,c=+t.apply(this,arguments),h=+e.apply(this,arguments),d=i.apply(this,arguments)-Ll,g=a.apply(this,arguments)-Ll,p=Ml(g-d),y=g>d;if(o||(o=s=u()),hNl)if(p>Vl-Nl)o.moveTo(h*_l(d),h*Sl(d)),o.arc(0,0,h,d,g,!y),c>Nl&&(o.moveTo(c*_l(g),c*Sl(g)),o.arc(0,0,c,g,d,y));else{var m,v,x=d,A=g,w=d,b=g,D=p,k=p,C=l.apply(this,arguments)/2,M=C>Nl&&(r?+r.apply(this,arguments):Bl(c*c+h*h)),T=Fl(Ml(h-c)/2,+n.apply(this,arguments)),_=T,E=T;if(M>Nl){var F=Ol(M/c*Sl(C)),S=Ol(M/h*Sl(C));(D-=2*F)>Nl?(w+=F*=y?1:-1,b-=F):(D=0,w=b=(d+g)/2),(k-=2*S)>Nl?(x+=S*=y?1:-1,A-=S):(k=0,x=A=(d+g)/2)}var B=h*_l(x),N=h*Sl(x),I=c*_l(b),L=c*Sl(b);if(T>Nl){var V,O=h*_l(A),P=h*Sl(A),$=c*_l(w),Y=c*Sl(w);if(p1?0:t<-1?Il:Math.acos(t)}((z*U+R*H)/(Bl(z*z+R*R)*Bl(U*U+H*H)))/2),W=Bl(V[0]*V[0]+V[1]*V[1]);_=Fl(T,(c-W)/(X-1)),E=Fl(T,(h-W)/(X+1))}else _=E=0}k>Nl?E>Nl?(m=Hl($,Y,B,N,h,E,y),v=Hl(O,P,I,L,h,E,y),o.moveTo(m.cx+m.x01,m.cy+m.y01),ENl&&D>Nl?_>Nl?(m=Hl(I,L,O,P,c,-_,y),v=Hl(B,N,$,Y,c,-_,y),o.lineTo(m.cx+m.x01,m.cy+m.y01),_t?1:e>=t?0:NaN}function Kl(t){return t}function Jl(t,e,n){this.k=t,this.x=e,this.y=n}var to,eo,no;jl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}},Jl.prototype={constructor:Jl,scale:function(t){return 1===t?this:new Jl(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Jl(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},Jl.prototype,function(t){t[t.Tag=0]="Tag",t[t.Frontmatter=1]="Frontmatter",t[t.Wiki=2]="Wiki",t[t.WikiLink=3]="WikiLink",t[t.WikiDisplay=4]="WikiDisplay",t[t.Text=5]="Text",t[t.dvField=6]="dvField",t[t.Table=7]="Table",t[t.FileMeta=8]="FileMeta",t[t.Task=9]="Task",t[t.TaskDone=10]="TaskDone",t[t.TaskNotDone=11]="TaskNotDone"}(to||(to={})),function(t){t[t.Line=0]="Line",t[t.Bar=1]="Bar",t[t.Pie=2]="Pie",t[t.Radar=3]="Radar",t[t.Summary=4]="Summary",t[t.Table=5]="Table",t[t.Month=6]="Month",t[t.Heatmap=7]="Heatmap",t[t.Bullet=8]="Bullet",t[t.Unknown=9]="Unknown"}(eo||(eo={})),function(t){t[t.Number=0]="Number",t[t.Int=1]="Int",t[t.Date=2]="Date",t[t.Time=3]="Time",t[t.DateTime=4]="DateTime",t[t.String=5]="String"}(no||(no={}));class ro{constructor(t,e){this.date=t,this.value=e}}class io{constructor(t,e,n){if(this.type=e,this.target=n,this.separator="",this.id=t,this.accessor=-1,this.accessor1=-1,this.accessor2=-1,this.valueType=no.Number,this.usedAsXDataset=!1,this.numTargets=0,e===to.Table){let t,e=new RegExp("\\[(?[0-9]+)\\]\\[(?[0-9]+)\\](\\[(?[0-9]+)\\])?","gm");for(;t=e.exec(n);)if(void 0!==t.groups.accessor){let r=parseFloat(t.groups.accessor);if(Number.isNumber(r)&&void 0!==t.groups.accessor1){let i=parseFloat(t.groups.accessor1);if(Number.isNumber(i)){let a;void 0!==t.groups.accessor2&&(a=parseFloat(t.groups.accessor2)),this.accessor=r,this.accessor1=i,Number.isNumber(a)&&(this.accessor2=a),this.parentTarget=n.replace(e,"")}break}}}else{let t,e=new RegExp("\\[(?[0-9]+)\\]","gm");for(;t=e.exec(n);)if(void 0!==t.groups.accessor){let r=parseFloat(t.groups.accessor);Number.isNumber(r)&&(this.accessor=r,this.parentTarget=n.replace(e,""));break}}}equalTo(t){return this.type===t.type&&this.target===t.target}getType(){return this.type}getTarget(){return this.target}getParentTarget(){return this.parentTarget}getId(){return this.id}getAccessor(t=0){switch(t){case 0:return this.accessor;case 1:return this.accessor1;case 2:return this.accessor2}return null}setSeparator(t){this.separator=t}getSeparator(t=!1){return""===this.separator?t?",":"/":this.separator}addNumTargets(t=1){this.numTargets=this.numTargets+t}getNumTargets(){return this.numTargets}}class ao{constructor(t,e){this.currentIndex=0,this.name="untitled",this.query=e,this.values=[],this.parent=t,this.id=-1,this.yMin=null,this.yMax=null,this.startDate=null,this.endDate=null,this.numTargets=0,this.lineInfo=null,this.barInfo=null,this.isTmpDataset=!1,this.valueType=null==e?void 0:e.valueType;for(let e=0;e=0&&n=0&&nthis.yMax)&&(this.yMax=e),(null===this.startDate||tthis.endDate)&&(this.endDate=t.clone()))}recalculateMinMax(){this.yMin=Math.min(...this.values),this.yMax=Math.max(...this.values)}getYMin(){return this.yMin}getYMax(){return this.yMax}getStartDate(){return this.startDate}getEndDate(){return this.endDate}shift(t,e){let n=!1;for(let r=0;r=e)&&(this.values[r]=this.values[r]+t,n=!0);n&&(this.yMin=this.yMin+t,this.yMax=this.yMax+t)}setPenalty(t){for(let e=0;ethis.yMax&&(this.yMax=t))}getQuery(){return this.query}accumulateValues(){let t=0;for(let e=0;ethis.yMax&&(this.yMax=t)}getValues(){return this.values}getLength(){return this.values.length}getLengthNotNull(){let t=0;for(let e=0;e[\d\.\/-]+)\s*,\s*(?[\d\.\/-]+)\s*\)/).groups;e&&(this.translateX=parseFloat(e.x),this.translateY=parseFloat(e.y))}}}class bo{constructor(t,e){this.filePath=t,this.tableIndex=e,this.xDataset=null,this.yDatasets=[]}}class Do{constructor(){this.fileTotal=0,this.fileAvailable=0,this.fileOutOfDateRange=0,this.fileNotInFormat=0,this.errorMessage="",this.minDate=window.moment(""),this.maxDate=window.moment(""),this.gotAnyValidXValue=!1,this.gotAnyValidYValue=!1}}const ko=function(){const t=["HH","H","hh","h"],e=["mm","m"],n=["ss","s",""];let r=[];for(let i of t)for(let t of e)for(let e of n){let n=`${i}:${t}`;""!==e&&(n+=`:${e}`),i.contains("h")&&(n+=" a"),r.push(n)}return r}();function Co(t,e,n){if(!e&&!n)return t;let r=t;if(r.startsWith("^")&&(r=r.slice(1)),e){let t=new RegExp("^("+e+")","gm");t.test(r)&&(r=r.replace(t,""))}if(n){let t=new RegExp("("+n+")$","gm");t.test(r)&&(r=r.replace(t,""))}return r}function Mo(t,e){let n=e;t.length>4&&t.startsWith("[[")&&t.endsWith("]]")&&(t=t.substring(2,t.length-2)),"iso-8601"===e.toLowerCase()&&(n=window.moment.ISO_8601);let r=window.moment(t,n,!0);return r=r.startOf("day"),r}function To(t,e,n=!0){if(!t||!e||0===e.length)return[null,t];let r=null;const i="^(?[0-9]+)("+e.join("|")+")$",a=new RegExp(i,"gm");let l=a.exec(t);return l&&void 0!==l.groups&&void 0!==l.groups.value&&(r=parseFloat(l.groups.value),Number.isNumber(r)&&!Number.isNaN(r))?(n&&(t=t.replace(a,"")),[r,t]):[null,t]}function _o(t){if(!t)return null;let e=window.moment.duration(0),n=!1,r=!1;t.startsWith("+")&&(r=!1,t=t.substring(1)),t.startsWith("-")&&(r=!0,t=t.substring(1));let i=null;[i,t]=To(t,["year","years","Y","y"]),null!==i&&(r&&(i*=-1),e.add(i,"years"),n=!0);let a=null;[a,t]=To(t,["month","months","M"]),null!==a&&(r&&(a*=-1),e.add(a,"months"),n=!0);let l=null;[l,t]=To(t,["week","weeks","W","w"]),null!==l&&(r&&(l*=-1),e.add(l,"weeks"),n=!0);let o=null;[o,t]=To(t,["day","days","D","d"]),null!==o&&(r&&(o*=-1),e.add(o,"days"),n=!0);let u=null;[u,t]=To(t,["hour","hours","H","h"]),null!==u&&(r&&(u*=-1),e.add(u,"hours"),n=!0);let s=null;[s,t]=To(t,["minute","minutes","m"]),null!==s&&(r&&(s*=-1),e.add(s,"minutes"),n=!0);let f=null;return[f,t]=To(t,["second","seconds","S","s"]),null!==f&&(r&&(f*=-1),e.add(f,"seconds"),n=!0),n?e:null}function Eo(t,e){let n=null,r=_o(t);return r&&window.moment.isDuration(r)&&(n=Bo(e),n=n.add(r),n&&n.isValid()),n}function Fo(t,e){return null==t?null:"iso-8601"===e.toLowerCase()?t.format():t.format(e)}function So(t,e){return Mo(Fo(window.moment(t),e),e)}function Bo(t){return Mo(Fo(window.moment(),t),t)}function No(t,e){for(var n=(e=e.replace(/^\./,"")).split("."),r=0,i=n.length;rt!==e)),i=n.reverse().findIndex((t=>t!==e));return-1===r&&-1===i?t:t.substring(r,t.length-i)}function Lo(t){if(null===t)return null;let e=new RegExp(']*?alt\\s*=\\s*[""\']?(?[^\'"" >]+?)[ \'""][^>]*?>',"g");return t.replace(e,((...t)=>{let e=t[t.length-1];return e&&e.emoji?e.emoji.trim():""}))}function Vo(t,e=null){let n=null,r=no.Number;if("string"==typeof t)if(t.includes(":")){let e=!1;t.startsWith("-")&&(e=!0,t=t.substring(1));let i=window.moment(t,ko,!0);i.isValid()&&(n=i.diff(window.moment("00:00","HH:mm",!0),"seconds"),e&&(n*=-1),r=no.Time)}else if(e){const r=Object.keys(e);for(let n of r)if("string"==typeof n){let r=new RegExp(n,"gm");if(r.test(t)&&Number.isNumber(e[n])){let i=e[n].toString();t=t.replace(r,i);break}}n=parseFloat(t),Number.isNaN(n)&&(n=null)}else n=parseFloat(t),Number.isNaN(n)&&(n=null);else"number"==typeof t&&(n=t);return{type:r,value:n}}function Oo(t,e="",n=""){var r=ne("body").append("svg");let i=r.append("text").text(t).attr("x",-99999).attr("y",-99999);e&&i.attr("class",e),n&&i.attr("transform","rotate("+n+")");var a=r.node().getBBox();return r.remove(),{width:a.width,height:a.height}}function Po(t,e,n){let r=(0|parseFloat(t.attr("width")))+e,i=(0|parseFloat(t.attr("height")))+n;t.attr("width",r),t.attr("height",i)}function $o(t,e,n){let r=new wo(t.attr("transform"));t.attr("transform","translate("+(r.translateX+e)+","+(r.translateY+n)+")")}function Yo(t){return t=(t=(t=t.replace(/(^\\s\*)|(\\s\*$)/gi,"")).replace(/\[ \]{2,}/gi," ")).replace(/\\n /,"\\n")}class zo{static get version(){return"1.3.8"}static toString(){return"JavaScript Expression Parser (JSEP) v"+zo.version}static addUnaryOp(t){return zo.max_unop_len=Math.max(t.length,zo.max_unop_len),zo.unary_ops[t]=1,zo}static addBinaryOp(t,e,n){return zo.max_binop_len=Math.max(t.length,zo.max_binop_len),zo.binary_ops[t]=e,n?zo.right_associative.add(t):zo.right_associative.delete(t),zo}static addIdentifierChar(t){return zo.additional_identifier_chars.add(t),zo}static addLiteral(t,e){return zo.literals[t]=e,zo}static removeUnaryOp(t){return delete zo.unary_ops[t],t.length===zo.max_unop_len&&(zo.max_unop_len=zo.getMaxKeyLen(zo.unary_ops)),zo}static removeAllUnaryOps(){return zo.unary_ops={},zo.max_unop_len=0,zo}static removeIdentifierChar(t){return zo.additional_identifier_chars.delete(t),zo}static removeBinaryOp(t){return delete zo.binary_ops[t],t.length===zo.max_binop_len&&(zo.max_binop_len=zo.getMaxKeyLen(zo.binary_ops)),zo.right_associative.delete(t),zo}static removeAllBinaryOps(){return zo.binary_ops={},zo.max_binop_len=0,zo}static removeLiteral(t){return delete zo.literals[t],zo}static removeAllLiterals(){return zo.literals={},zo}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new zo(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map((t=>t.length)))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return zo.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!zo.binary_ops[String.fromCharCode(t)]||zo.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return zo.isIdentifierStart(t)||zo.isDecimalDigit(t)}throwError(t){const e=new Error(t+" at character "+this.index);throw e.index=this.index,e.description=t,e}runHook(t,e){if(zo.hooks[t]){const n={context:this,node:e};return zo.hooks.run(t,n),n.node}return e}searchHook(t){if(zo.hooks[t]){const e={context:this};return zo.hooks[t].find((function(t){return t.call(e.context,e),e.node})),e.node}}gobbleSpaces(){let t=this.code;for(;t===zo.SPACE_CODE||t===zo.TAB_CODE||t===zo.LF_CODE||t===zo.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const t=this.gobbleExpressions(),e=1===t.length?t[0]:{type:zo.COMPOUND,body:t};return this.runHook("after-all",e)}gobbleExpressions(t){let e,n,r=[];for(;this.index0;){if(zo.binary_ops.hasOwnProperty(t)&&(!zo.isIdentifierStart(this.code)||this.index+t.lengthi.right_a&&t.right_a?n>t.prec:n<=t.prec;for(;r.length>2&&o(r[r.length-2]);)l=r.pop(),e=r.pop().value,a=r.pop(),t={type:zo.BINARY_EXP,operator:e,left:a,right:l},r.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+u),r.push(i,t)}for(o=r.length-1,t=r[o];o>1;)t={type:zo.BINARY_EXP,operator:r[o-1].value,left:r[o-2],right:t},o-=2;return t}gobbleToken(){let t,e,n,r;if(this.gobbleSpaces(),r=this.searchHook("gobble-token"),r)return this.runHook("after-token",r);if(t=this.code,zo.isDecimalDigit(t)||t===zo.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===zo.SQUOTE_CODE||t===zo.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(t===zo.OBRACK_CODE)r=this.gobbleArray();else{for(e=this.expr.substr(this.index,zo.max_unop_len),n=e.length;n>0;){if(zo.unary_ops.hasOwnProperty(e)&&(!zo.isIdentifierStart(this.code)||this.index+e.length=e.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}if(i===zo.COMMA_CODE){if(this.index++,r++,r!==e.length)if(t===zo.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===zo.CBRACK_CODE)for(let t=e.length;t{if("object"!=typeof t||!t.name||!t.init)throw new Error("Invalid JSEP plugin format");this.registered[t.name]||(t.init(this.jsep),this.registered[t.name]=t)}))}}(zo),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},right_associative:new Set,additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),zo.max_unop_len=zo.getMaxKeyLen(zo.unary_ops),zo.max_binop_len=zo.getMaxKeyLen(zo.binary_ops);const Uo=t=>new zo(t).parse();Object.getOwnPropertyNames(zo).forEach((t=>{void 0===Uo[t]&&"prototype"!==t&&(Uo[t]=zo[t])})),Uo.Jsep=zo;var Ho={name:"ternary",init(t){t.hooks.add("after-expression",(function(e){if(e.node&&this.code===t.QUMARK_CODE){this.index++;const n=e.node,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===t.COLON_CODE){this.index++;const i=this.gobbleExpression();if(i||this.throwError("Expected expression"),e.node={type:"ConditionalExpression",test:n,consequent:r,alternate:i},n.operator&&t.binary_ops[n.operator]<=.9){let r=n;for(;r.right.operator&&t.binary_ops[r.right.operator]<=.9;)r=r.right;e.node.test=r.right,r.right=e.node,e.node=n}}else this.throwError("Expected :")}}))}};Uo.plugins.register(Ho);var Xo,Wo={};function jo(t){if("number"==typeof t){if(0===t)return!1}else if(t instanceof ao&&t.getValues().some((function(t){return 0===t})))return!1;return!0}Xo=Wo,function(){var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function e(n){return function(n,r){var i,a,l,o,u,s,f,c,h,d=1,g=n.length,p="";for(a=0;a=0),o.type){case"b":i=parseInt(i,10).toString(2);break;case"c":i=String.fromCharCode(parseInt(i,10));break;case"d":case"i":i=parseInt(i,10);break;case"j":i=JSON.stringify(i,null,o.width?parseInt(o.width):0);break;case"e":i=o.precision?parseFloat(i).toExponential(o.precision):parseFloat(i).toExponential();break;case"f":i=o.precision?parseFloat(i).toFixed(o.precision):parseFloat(i);break;case"g":i=o.precision?String(Number(i.toPrecision(o.precision))):parseFloat(i);break;case"o":i=(parseInt(i,10)>>>0).toString(8);break;case"s":i=String(i),i=o.precision?i.substring(0,o.precision):i;break;case"t":i=String(!!i),i=o.precision?i.substring(0,o.precision):i;break;case"T":i=Object.prototype.toString.call(i).slice(8,-1).toLowerCase(),i=o.precision?i.substring(0,o.precision):i;break;case"u":i=parseInt(i,10)>>>0;break;case"v":i=i.valueOf(),i=o.precision?i.substring(0,o.precision):i;break;case"x":i=(parseInt(i,10)>>>0).toString(16);break;case"X":i=(parseInt(i,10)>>>0).toString(16).toUpperCase()}t.json.test(o.type)?p+=i:(!t.number.test(o.type)||c&&!o.sign?h="":(h=c?"+":"-",i=i.toString().replace(t.sign,"")),s=o.pad_char?"0"===o.pad_char?"0":o.pad_char.charAt(1):" ",f=o.width-(h+i).length,u=o.width&&f>0?s.repeat(f):"",p+=o.align?h+i+u:"0"===s?h+u+i:u+h+i)}return p}(function(e){if(r[e])return r[e];for(var n,i=e,a=[],l=0;i;){if(null!==(n=t.text.exec(i)))a.push(n[0]);else if(null!==(n=t.modulo.exec(i)))a.push("%");else{if(null===(n=t.placeholder.exec(i)))throw new SyntaxError("[sprintf] unexpected placeholder");if(n[2]){l|=1;var o=[],u=n[2],s=[];if(null===(s=t.key.exec(u)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o.push(s[1]);""!==(u=u.substring(s[0].length));)if(null!==(s=t.key_access.exec(u)))o.push(s[1]);else{if(null===(s=t.index_access.exec(u)))throw new SyntaxError("[sprintf] failed to parse named argument key");o.push(s[1])}n[2]=o}else l|=2;if(3===l)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");a.push({placeholder:n[0],param_no:n[1],keys:n[2],sign:n[3],pad_char:n[4],align:n[5],width:n[6],precision:n[7],type:n[8]})}i=i.substring(n[0].length)}return r[e]=a}(n),arguments)}function n(t,n){return e.apply(null,[t].concat(n||[]))}var r=Object.create(null);Xo.sprintf=e,Xo.vsprintf=n,"undefined"!=typeof window&&(window.sprintf=e,window.vsprintf=n)}();const qo={min:function(t,e){return x(t.getValues())},minDate:function(t,e){let n=x(t.getValues());if(Number.isNumber(n)){let e=Array.from(t);for(let t of e.reverse())if(null!==t.value&&t.value===n)return t.date}return"Error: min not found"},max:function(t,e){return v(t.getValues())},maxDate:function(t,e){let n=v(t.getValues());if(Number.isNumber(n)){let e=Array.from(t);for(let t of e.reverse())if(null!==t.value&&t.value===n)return t.date}return"Error: max not found"},startDate:function(t,e){if(t){let e=t.getStartDate();if(e&&e.isValid())return e}return e.startDate},endDate:function(t,e){if(t){let e=t.getEndDate();if(e&&e.isValid())return e}return e.endDate},sum:function(t,e){return k(t.getValues())},count:function(t,e){return"Error: deprecated function 'count'"},numTargets:function(t,e){return t.getNumTargets()},days:function(t,e){return"Error: deprecated function 'days'"},numDays:function(t,e){return t.getLength()},numDaysHavingData:function(t,e){return t.getLengthNotNull()},maxStreak:function(t,e){let n=0,r=0;for(let e of t)null!==e.value?n++:n=0,n>=r&&(r=n);return r},maxStreakStart:function(t,e){let n=0,r=0,i=null,a=null;if(t)for(let e of t)null!==e.value?(0===n&&(i=e.date),n++):n=0,n>=r&&(r=n,a=i);return a},maxStreakEnd:function(t,e){let n=0,r=0,i=null,a=null;if(t){let e=Array.from(t);for(let t=0;t=r&&(r=n,a=i)}}return a},maxBreaks:function(t,e){let n=0,r=0;for(let e of t)null===e.value?n++:n=0,n>r&&(r=n);return r},maxBreaksStart:function(t,e){let n=0,r=0,i=null,a=null;if(t)for(let e of t)null===e.value?(0===n&&(i=e.date),n++):n=0,n>=r&&(r=n,a=i);return a},maxBreaksEnd:function(t,e){let n=0,r=0,i=null,a=null;if(t){let e=Array.from(t);for(let t=0;t=r&&(r=n,a=i)}}return a},lastStreak:function(t,e){return"Error: deprecated function 'lastStreak'"},currentStreak:function(t,e){let n=0;if(t){let e=Array.from(t);for(let t=e.length-1;t>=0;t--){if(null===e[t].value)break;n++}}return n},currentStreakStart:function(t,e){let n=null;if(t){let e=Array.from(t);for(let t=e.length-1;t>=0;t--){let r=e[t];if(t=0;t--){let i=e[t];if(null===i.value)break;0===n&&(r=i.date),n++}}return null===r?"Error: absense":r},currentBreaks:function(t,e){let n=0;if(t){let e=Array.from(t);for(let t=e.length-1;t>=0;t--){if(null!==e[t].value)break;n++}}return n},currentBreaksStart:function(t,e){let n=null;if(t){let e=Array.from(t);for(let t=e.length-1;t>=0;t--){let r=e[t];if(t=0;t--){let i=e[t];if(null!==i.value)break;0===n&&(r=i.date),n++}}return null===r?"Error: absense":r},average:function(t,e){let n=t.getLengthNotNull();return jo(n)?k(t.getValues())/n:"Error: divide by zero in expression"},median:function(t,e){return b(t.getValues())},variance:function(t,e){return function(t,e){let n,r=0,i=0,a=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-i,i+=n/++r,a+=n*(e-i));else{let l=-1;for(let o of t)null!=(o=e(o,++l,t))&&(o=+o)>=o&&(n=o-i,i+=n/++r,a+=n*(o-i))}if(r>1)return a/(r-1)}(t.getValues())}},Go={"-":function(t){if("number"==typeof t)return-1*t;if(t instanceof ao){let e=t.cloneToTmpDataset();return e.getValues().forEach((function(t,e,n){null!==n[e]&&(n[e]=-1*t)})),e.recalculateMinMax(),e}return"Error: unknown operation for '-'"},"+":function(t){if("number"==typeof t)return t;if(t instanceof ao){return t.cloneToTmpDataset()}return"Error: unknown operation for '+'"}},Qo={"+":function(t,e){if("number"==typeof t&&"number"==typeof e)return t+e;if("number"==typeof t&&e instanceof ao){let n=e.cloneToTmpDataset();return n.getValues().forEach((function(e,n,r){null!==r[n]?r[n]=t+e:r[n]=null})),n.recalculateMinMax(),n}if(t instanceof ao&&"number"==typeof e){let n=t.cloneToTmpDataset();return n.getValues().forEach((function(t,n,r){null!==r[n]?r[n]=t+e:r[n]=null})),n.recalculateMinMax(),n}if(t instanceof ao&&e instanceof ao){let n=t.cloneToTmpDataset();return n.getValues().forEach((function(t,n,r){null!==r[n]?r[n]=t+e.getValues()[n]:r[n]=null})),n.recalculateMinMax(),n}return"Error: unknown operation for '+'"},"-":function(t,e){if("number"==typeof t&&"number"==typeof e)return t-e;if("number"==typeof t&&e instanceof ao){let n=e.cloneToTmpDataset();return n.getValues().forEach((function(e,n,r){null!==r[n]?r[n]=t-e:r[n]=null})),n.recalculateMinMax(),n}if(t instanceof ao&&"number"==typeof e){let n=t.cloneToTmpDataset();return n.getValues().forEach((function(t,n,r){null!==r[n]?r[n]=t-e:r[n]=null})),n}if(t instanceof ao&&e instanceof ao){let n=t.cloneToTmpDataset();return n.getValues().forEach((function(t,n,r){null!==r[n]?r[n]=t-e.getValues()[n]:r[n]=null})),n.recalculateMinMax(),n}return"Error: unknown operation for '-'"},"*":function(t,e){if("number"==typeof t&&"number"==typeof e)return t*e;if("number"==typeof t&&e instanceof ao){let n=e.cloneToTmpDataset();return n.getValues().forEach((function(e,n,r){null!==r[n]?r[n]=t*e:r[n]=null})),n.recalculateMinMax(),n}if(t instanceof ao&&"number"==typeof e){let n=t.cloneToTmpDataset();return n.getValues().forEach((function(t,n,r){null!==r[n]?r[n]=t*e:r[n]=null})),n.recalculateMinMax(),n}if(t instanceof ao&&e instanceof ao){let n=t.cloneToTmpDataset();return n.getValues().forEach((function(t,n,r){null!==r[n]?r[n]=t*e.getValues()[n]:r[n]=null})),n.recalculateMinMax(),n}return"Error: unknown operation for '*'"},"/":function(t,e){if(!jo(e))return"Error: divide by zero in expression";if("number"==typeof t&&"number"==typeof e)return t/e;if("number"==typeof t&&e instanceof ao){let n=e.cloneToTmpDataset();return n.getValues().forEach((function(e,n,r){null!==r[n]?r[n]=t/e:r[n]=null})),n.recalculateMinMax(),n}if(t instanceof ao&&"number"==typeof e){let n=t.cloneToTmpDataset();return n.getValues().forEach((function(t,n,r){null!==r[n]?r[n]=t/e:r[n]=null})),n.recalculateMinMax(),n}if(t instanceof ao&&e instanceof ao){let n=t.cloneToTmpDataset();return n.getValues().forEach((function(t,n,r){null!==r[n]?r[n]=t/e.getValues()[n]:r[n]=null})),n.recalculateMinMax(),n}return"Error: unknown operation for '/'"},"%":function(t,e){if(!jo(e))return"Error: divide by zero in expression";if("number"==typeof t&&"number"==typeof e)return t%e;if("number"==typeof t&&e instanceof ao){let n=e.cloneToTmpDataset();return n.getValues().forEach((function(e,n,r){null!==r[n]?r[n]=t%e:r[n]=null})),n.recalculateMinMax(),n}if(t instanceof ao&&"number"==typeof e){let n=t.cloneToTmpDataset();return n.getValues().forEach((function(t,n,r){null!==r[n]?r[n]=t%e:r[n]=null})),n.recalculateMinMax(),n}if(t instanceof ao&&e instanceof ao){let n=t.cloneToTmpDataset();return n.getValues().forEach((function(t,n,r){null!==r[n]?r[n]=t%e.getValues()[n]:r[n]=null})),n.recalculateMinMax(),n}return"Error: unknown operation for '%'"}},Zo={normalize:function(t,e,n){let r=t.getYMin(),i=t.getYMax();if(null!==r&&null!==i&&i>r){let e=t.cloneToTmpDataset();return e.getValues().forEach((function(t,e,n){n[e]=(t-r)/(i-r)})),e.recalculateMinMax(),e}return"Error: invalid data range for function 'normalize'"},setMissingValues:function(t,e,n){if(e&&e.length>0){let n=e[0],r=t.cloneToTmpDataset();return Number.isNumber(n)&&!Number.isNaN(n)?(r.getValues().forEach((function(t,e,r){null===t&&(r[e]=n)})),r.recalculateMinMax(),r):"Error: invalid arguments for function 'setMissingValues'"}return"Error: invalid arguments for function 'setMissingValues"}};function Ko(t,e){switch(t.type){case"Literal":return t.value;case"Identifier":let n=t.name;return n in qo||n in Zo?`Error: deprecated template variable '${n}', use '${n}()' instead`:`Error: unknown function name '${n}'`;case"UnaryExpression":let r=t,i=Ko(r.argument,e);return"string"==typeof i?i:Go[r.operator](i);case"BinaryExpression":let a=t,l=Ko(a.left,e),o=Ko(a.right,e),u=function(t,e){return"string"==typeof t?t:"string"==typeof e?e:"number"==typeof t||window.moment.isMoment(t)||t instanceof ao?"number"==typeof e||window.moment.isMoment(e)||e instanceof ao?"":"Error: invalide operant type":"Error: invalid operant type"}(l,o);return"string"==typeof u&&u.startsWith("Error:")?u:Qo[a.operator](l,o);case"CallExpression":let s=t,f=s.callee.name,c=function(t,e){return t.map((function(t){return Ko(t,e)}))}(s.arguments,e);if("string"==typeof c)return c;if("dataset"===f){if(1===c.length){let t=c[0];if("string"==typeof t)return t;if("number"!=typeof t)return"Error: function 'dataset' only accepts id in number";let n=function(t,e){return e.datasets.getDatasetById(t)}(t,e);return n||`Error: no dataset found for id '${t}'`}}else{if(f in qo){if(0===c.length){let t=null;for(let n of e.datasets)t||n.getQuery().usedAsXDataset||(t=n);return t?qo[f](t,e):`No available dataset found for function ${f}`}if(1===c.length){let t=c[0];return"string"==typeof t?t:t instanceof ao?qo[f](t,e):`Error: function '${f}' only accepts Dataset`}return`Error: Too many arguments for function ${f}`}if(f in Zo){if(1===c.length){if("string"==typeof c[0])return c[0];if(c[0]instanceof ao){let t=c[0];return Zo[f](t,null,e)}return`Error: function ${f} only accept Dataset`}if(c.length>1){if("string"==typeof c[0])return c[0];if(c[0]instanceof ao){let t=c[0];return Zo[f](t,c.filter((function(t,e,n){return e>0})),e)}return`Error: function ${f} only accept Dataset`}return`Error: Too many arguments for function ${f}`}}return`Error: unknown function name '${f}'`}return"Error: unknown expression"}function Jo(t,e){let n,r=[],i=new RegExp("{{(?[\\w+\\-*\\/0-9\\s()\\[\\]%.,]+)(::(?[\\w+\\-*\\/0-9\\s()\\[\\]%.:]+))?}}","gm");for(;n=i.exec(t);){let t=n[0];if(!r.some((e=>e.source===t))&&(void 0!==n.groups&&void 0!==n.groups.expr)){let i=n.groups.expr,a=null;try{a=Uo(i)}catch(t){return"Error:"+t.message}if(!a)return"Error: failed to parse expression";const l=Ko(a,e);if("string"==typeof l)return l;if("number"==typeof l||window.moment.isMoment(l)){let e=null;void 0!==n.groups.format&&(e=n.groups.format),r.push({source:t,value:l,format:e})}}}return r}function tu(t,e){let n=Jo(t,e);if("string"==typeof n)return n;let r=n;for(let n of r){let r=n.source,i=n.value,a=n.format,l="";"number"==typeof i?l=a?Wo.sprintf("%"+a,i):i.toFixed(1):window.moment.isMoment(i)&&(l=Fo(i,a||e.dateFormat)),l&&(t=t.split(r).join(l))}return t}function eu(t,e){if(t=t.trim(),/^([\-]?[0-9]+[\.][0-9]+|[\-]?[0-9]+)$/.test(t))return parseFloat(t);let n=Jo(t,e);if("string"==typeof n)return n;let r=n;return r.length>0?r[0].value:"Error: failed to resolve values"}function nu(t,e,n,r){let i="",a=.5*n.dataAreaSize.width,l=.7*a,o=l*r.ratioInnerRadius,u=[];for(let t of r.data){let e=eu(t,n);if("string"==typeof e){i=e;break}"number"==typeof e&&u.push(e)}if(""!==i)return i;let s=[];for(let t of r.label){let e=tu(t,n);if(e.startsWith("Error")){i=e;break}s.push(e)}if(""!==i)return i;let f=r.hideLabelLessThan,c=s.map((function(t){return Oo(t,"tracker-tick-label")})),h=[];for(let t of r.extLabel){let e=tu(t,n);if(e.startsWith("Error")){i=e;break}h.push(e)}if(""!==i)return i;let d=h.map((function(t){return Oo(t,"tracker-pie-label")})),g=r.showExtLabelOnlyIfNoLabel,p=Kr().range(r.dataColor),y=e.dataArea.append("g");y.attr("transform",(function(){return"translate("+.5*n.dataAreaSize.width+","+.5*n.dataAreaSize.height+")"}));let m=function(){var t=Kl,e=Zl,n=null,r=Cl(0),i=Cl(Vl),a=Cl(0);function l(l){var o,u,s,f,c,h=(l=Wl(l)).length,d=0,g=new Array(h),p=new Array(h),y=+r.apply(this,arguments),m=Math.min(Vl,Math.max(-Vl,i.apply(this,arguments)-y)),v=Math.min(Math.abs(m)/h,a.apply(this,arguments)),x=v*(m<0?-1:1);for(o=0;o0&&(d+=c);for(null!=e?g.sort((function(t,n){return e(p[t],p[n])})):null!=n&&g.sort((function(t,e){return n(l[t],l[e])})),o=0,s=d?(m-h*x)/d:0;o0?c*s:0)+x,p[u]={data:l[u],index:o,value:c,startAngle:y,endAngle:f,padAngle:v};return p}return l.value=function(e){return arguments.length?(t="function"==typeof e?e:Cl(+e),l):t},l.sortValues=function(t){return arguments.length?(e=t,n=null,l):e},l.sort=function(t){return arguments.length?(n=t,e=null,l):n},l.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:Cl(+t),l):r},l.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:Cl(+t),l):i},l.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:Cl(+t),l):a},l}(),v=m(u),x=y.selectAll("sector").data(v).enter().append("g").attr("class","sector"),A=Xl().innerRadius(o).outerRadius(l);var w=Xl().innerRadius(.9*a).outerRadius(.9*a);function b(t){return(t.endAngle-t.startAngle)/(2*Math.PI)Math.sqrt(Math.pow(u[0]-l[0],2)+Math.pow(u[1]-l[1],2))?[l,u]:[l,o,u]}x.append("path").attr("fill",(function(t,e){return p(e.toString())})).attr("d",A),y.selectAll("label").data(m(u)).enter().append("text").text((function(t,e){return b(t)?"":s[e]})).attr("transform",(function(t){return"translate("+A.centroid(t)[0]+","+A.centroid(t)[1]+")"})).style("text-anchor","middle").attr("class","tracker-pie-label"),y.selectAll("extLabel").data(v).enter().append("text").text((function(t,e){return g?""===s[e]||b(t)?h[e]:"":h[e]})).attr("transform",(function(t,e){let n=w.centroid(t),r=D(t);return n[0]=(.99*a-d[e].width)*(rc&&(c=s[t].width,f=t);let h=c/u[f].length,d=s[f].height,g=u.length,p=2*h,y=d,m=2*h,v=0,x=0;"vertical"===r.legendOrientation?(v=3*p+m+c,x=(g+1)*y):"horizontal"===r.legendOrientation&&(v=(2*p+m)*g+p+k(s,(function(t,e){return t.width})),x=y+d);let A=0,w=0;if("top"===r.legendPosition)A=n.dataAreaSize.width/2-v/2,w=o,Po(i,0,x+y),$o(a,0,x+y);else if("bottom"===r.legendPosition)A=n.dataAreaSize.width/2-v/2,w=o+n.dataAreaSize.height+y,Po(i,0,x+y);else if("left"===r.legendPosition)A=0,w=o+n.dataAreaSize.height/2-x/2,Po(i,v+p,0),$o(a,v+p,0);else{if("right"!==r.legendPosition)return;A=n.dataAreaSize.width+p,w=o+n.dataAreaSize.height/2-x/2,Po(i,v+p,0)}let b=e.graphArea.append("g").attr("id","legend").attr("transform","translate("+A+","+w+")"),D=b.append("rect").attr("class","tracker-legend").attr("width",v).attr("height",x);r.legendBgColor&&D.style("fill",r.legendBgColor),r.legendBorderColor&&D.style("stroke",r.legendBorderColor);let C=p,M=d,T=C+p+m,_=M;if("vertical"===r.legendOrientation)b.selectAll("markers").data(u).enter().append("circle").attr("cx",C+m/2).attr("cy",(function(t,e){return M+e*y})).attr("r",(function(t,e){return 5})).style("fill",(function(t,e){return r.dataColor[e]})),b.selectAll("labels").data(u).enter().append("text").attr("x",T).attr("y",(function(t,e){return _+e*y})).text((function(t,e){return t})).style("alignment-baseline","middle").attr("class","tracker-legend-label").style("fill",(function(t,e){return r.dataColor[e]}));else if("horizontal"===r.legendOrientation){let t=0;t=0,b.selectAll("markers").data(u).enter().append("circle").attr("cx",(function(e,n){return 0===n?t=C+m/2:t+=s[n].width+p+m+p,t})).attr("cy",M).attr("r",(function(t,e){return 5})).style("fill",(function(t,e){return r.dataColor[e]})),t=0,b.selectAll("labels").data(u).enter().append("text").attr("x",(function(e,n){return 0===n?t=T:t+=s[n].width+p+m+p,t})).attr("y",_).text((function(t,e){return t})).style("alignment-baseline","middle").attr("class","tracker-legend-label").style("fill",(function(t,e){return r.dataColor[e]}))}}(0,r,e,n),function(t,e,n){let r=ne(t),i=e.svg,a=parseFloat(i.attr("width")),l=parseFloat(i.attr("height"));i.attr("width",null).attr("height",null).attr("viewBox",`0 0 ${a} ${l}`).attr("preserveAspectRatio","xMidYMid meet"),n.fitPanelWidth?r.style("width","100%"):(r.style("width",(a*n.fixedScale).toString()+"px"),r.style("height",(l*n.fixedScale).toString()+"px"))}(t,r,e)}function iu(t,e,n){if(!e||!n)return;let r="";n.template,r=n.template;let i=tu(r,e);if(i.startsWith("Error:"))return i;if(r=i,""!==r){let e=ne(t).append("div");if(r.includes("\n")||r.includes("\\n")){let t=r.split(/(\n|\\n)/);for(let n of t)"\n"!==n&&"\\n"!==n&&e.append("div").text(n)}else e.text(r);""!==n.style&&e.attr("style",n.style)}}let au=!1,lu=2.8,ou=1.8;function uu(t,e){let n=e.dataset;if(0===n.length)return!1;let r=null;if(null===e.selectedDataset){for(let e of n)if(r=t.datasets.getDatasetById(e),r&&!r.getQuery().usedAsXDataset)break;if(r)return e.selectedDataset=r.getId(),!0}else{let i=e.selectedDataset,a=n.findIndex((t=>t===i));if(a>=0){if(a===e.dataset.length-1){for(let e of n)if(r=t.datasets.getDatasetById(e),r&&!r.getQuery().usedAsXDataset)break;return!!r&&(e.selectedDataset=r.getId(),!0)}{a++;let i=n[a];if(r=t.datasets.getDatasetById(i),e.selectedDataset=i,r&&!r.getQuery().usedAsXDataset)return!0;uu(t,e)}}}return!1}function su(t,e,n,r){ne(e).select("#svg").remove();for(var i=Object.getOwnPropertyNames(t),a=0;a").attr("id","arrowLeft").attr("transform","translate("+6.5*s+","+(g/2+D.height/2)+")").attr("class","tracker-month-title-arrow").on("click",(function(a){fu(e,r);let l=i.clone().add(1,"month");du(t,e,n,r,l)})).style("cursor","pointer"),p.append("text").text("◦").attr("id","arrowToday").attr("transform","translate("+6*s+","+(g/2+D.height/2)+")").attr("class","tracker-month-title-arrow").on("click",(function(i){fu(e,r);let a=Bo(n.dateFormat);du(t,e,n,r,a)})).style("cursor","pointer"),g+=8;let k=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];"mon"===r.startWeekOn.toLowerCase()&&k.push(k.shift());let C=Oo(k[0],"tracker-month-weekday");e.graphArea.selectAll("weekDays").data(k).enter().append("text").text((function(t){return t})).attr("transform",(function(t,e){return"translate("+(e+.5)*s+","+(g+C.height)+")"})).attr("class","tracker-month-weekday").attr("text-anchor","middle").style("cursor","default").on("click",(function(t){fu(e,r)})),g+=C.height+8;let M=null;r.dividingLineColor?M=r.dividingLineColor:r.color&&(M=r.color);let T=e.graphArea.append("rect").attr("x",0).attr("y",g).attr("width",6.5*s+C.width).attr("height",1).attr("class","tracker-month-dividing-line");M&&T.style("fill",M),g+=1,p.attr("height",g),e.header=p,$o(e.dataArea,0,g)}function hu(t,e,n,r,i){if(!n||!r)return;let a=r.mode;if("circle"!==a&&"annotation"!==a)return"Unknown month view mode";let l=r.selectedDataset;if(null===l)return;let o=n.datasets.getDatasetById(l);if(!o)return;let u=r.dataset.findIndex((t=>t===l));l<0&&(u=0);let s=r.threshold[u];i.month(),i.daysInMonth();let f=Oo("30","tracker-month-label"),c=Math.max(f.width,f.height)*lu,h=c/lu*ou/2,d=(c-2*h)/2,g=x(o.getValues());null!==r.yMin[u]&&(g=r.yMin[u]);let p=v(o.getValues());null!==r.yMax[u]&&(p=r.yMax[u]);let y=!0;(null===p||null===g||p<=g)&&(y=!1);const m=i.clone().startOf("month");let A=m.clone().subtract(m.day(),"days");"mon"===r.startWeekOn.toLowerCase()&&(A=A.add(1,"days"));const w=i.clone().endOf("month");let b=w.clone().add(7-w.day()-1,"days");"mon"===r.startWeekOn.toLowerCase()&&(b=b.add(1,"days"));const D=o.getStartDate(),k=o.getEndDate();let C=r.showAnnotation,M=r.annotation,T=M[u],_=r.showAnnotationOfAllTargets,E=[],F=0,S=0,B=0;for(let t=A.clone();t<=b;t.add(1,"days")){t=Mo(Fo(t,n.dateFormat),n.dateFormat),"2021-09-13"===t.format("YYYY-MM-DD")&&(au=!1),"mon"===r.startWeekOn.toLowerCase()?(F=t.day()-1,F<0&&(F=6),S=Math.floor(B/7)):(F=t.day(),S=Math.floor(B/7));let e=!0;(t.diff(m)<0||t.diff(w)>0)&&(e=!1);let i=!0;D&&k&&t.diff(D)>=0&&t.diff(k)<=0&&(i=!1);const a=o.getValue(t);au&&(console.log(o),console.log(Fo(t,n.dateFormat)),console.log(a));let l=!1;r.circleColorByValue?(y||null!==a&&a>s)&&(l=!0):null!==a&&a>s&&(l=!0);let u=null;r.circleColorByValue&&y&&null!==a&&(u=(a-g)/(p-g)),au&&(console.log(g),console.log(p),console.log(u));let f=o.getValue(t,1),c=o.getValue(t,-1),h=!1;null!==a&&a>s&&null!==c&&c>s&&(h=!0);let d=!1;null!==a&&a>s&&null!==f&&f>s&&(d=!0),au&&(console.log(`preValue: ${c}, curValue: ${a}, nextValue: ${f}`),console.log(r.threshold),console.log(`streakIn: ${h}, streakOut: ${d}`));let v="";if(C)if(_)for(let e of r.dataset){let i=r.dataset.findIndex((t=>t===e));if(i>=0){let a=n.datasets.getDatasetById(e).getValue(t),l=r.threshold[i];null!==a&&a>l&&(v+=M[i])}}else a>s&&(v=T);E.push({date:Fo(t,n.dateFormat),value:a,scaledValue:u,dayInMonth:t.date(),isInThisMonth:e,isOutOfDataRange:i,row:S,col:F,showCircle:l,streakIn:h,streakOut:d,annotation:v}),B++,au&&(au=!1)}let N=(F+1)*c,I=fi().domain([-.5,6.5]).range([0,N]);if("circle"===a&&r.showCircle&&r.showStreak){let t="#69b3a2";r.circleColor?t=r.circleColor:r.color&&(t=r.color),e.dataArea.selectAll("streakIn").data(E.filter((function(t){return t.streakIn}))).enter().append("rect").attr("x",(function(t){return I(t.col)-h-d})).attr("y",(function(t){return I(t.row)-1.5})).attr("width",d).attr("height",3).style("fill",(function(e){return e.showCircle?r.circleColorByValue?null!==e.scaledValue?Mn("white",t)(.8*e.scaledValue+.2):"none":t:"none"})).style("opacity",(function(t){return t.isOutOfDataRange||r.dimNotInMonth&&!t.isInThisMonth?.2:1})),e.dataArea.selectAll("streakOut").data(E.filter((function(t){return t.streakOut}))).enter().append("rect").attr("x",(function(t){return I(t.col)+h})).attr("y",(function(t){return I(t.row)-1.5})).attr("width",d).attr("height",3).style("fill",(function(e){return e.showCircle?r.circleColorByValue?null!==e.scaledValue?Mn("white",t)(.8*e.scaledValue+.2):"none":t:"none"})).style("opacity",(function(t){return t.isOutOfDataRange||r.dimNotInMonth&&!t.isInThisMonth?.2:1}))}let L="#69b3a2";r.circleColor?L=r.circleColor:r.color&&(L=r.color),"circle"===a&&r.showCircle&&e.dataArea.selectAll("dot").data(E).enter().append("circle").attr("r",h).attr("cx",(function(t){return I(t.col)})).attr("cy",(function(t){return I(t.row)})).style("fill",(function(t){if(t.showCircle){if(!r.circleColorByValue)return L;if(null!==t.scaledValue){return Mn("white",L)(.8*t.scaledValue+.2)}return"none"}return"none"})).style("opacity",(function(t){return t.isOutOfDataRange||r.dimNotInMonth&&!t.isInThisMonth?.2:1})).style("cursor","default");let V=Fo(window.moment(),n.dateFormat);if("circle"===a&&r.showTodayRing){let t=e.dataArea.selectAll("todayRing").data(E.filter((function(t){return t.date===V}))).enter().append("circle").attr("r",.9*h).attr("cx",(function(t){return I(t.col)})).attr("cy",(function(t){return I(t.row)})).attr("class","tracker-month-today-circle").style("cursor","default");""!==r.todayRingColor?t.style("stroke",r.todayRingColor):t.style("stroke","white")}"circle"===a&&r.showSelectedRing&&e.dataArea.selectAll("selectedRing").data(E).enter().append("circle").attr("r",h).attr("cx",(function(t){return I(t.col)})).attr("cy",(function(t){return I(t.row)})).attr("id",(function(t){return"tracker-selected-circle-"+t.date})).attr("class","tracker-month-selected-circle").style("cursor","default").style("stroke","none"),e.dataArea.selectAll("dayLabel").data(E).enter().append("text").text((function(t){return t.dayInMonth.toString()})).attr("transform",(function(t){return"translate("+I(t.col)+","+(I(t.row)+f.height/4)+")"})).style("fill-opacity",(function(t){return t.isOutOfDataRange||r.dimNotInMonth&&!t.isInThisMonth?.2:1})).attr("date",(function(t){return t.date})).attr("value",(function(t){return t.value})).attr("valueType",(function(t){return no[o.valueType]})).attr("class","tracker-month-label").on("click",(function(t){fu(e,r);let n=ne(this).attr("date");if(r.selectedDate=n,r.showSelectedRing&&e.dataArea.select("#tracker-selected-circle-"+n).style("stroke",r.selectedRingColor),r.showSelectedValue){let t=ne(this).attr("value"),n="";if("Time"===ne(this).attr("valueType")){n=window.moment("00:00","HH:mm",!0).add(parseFloat(t),"seconds").format("HH:mm")}else n=t;e.monitor.text(n)}})).style("cursor","pointer"),"annotation"===a&&C&&e.dataArea.selectAll("dayAnnotation").data(E).enter().append("text").text((function(t){return t.annotation})).attr("transform",(function(t){let e=I(t.col),n=I(t.row)+f.height/4;return t.annotation&&(n+=h),"translate("+e+","+n+")"})).attr("class","tracker-month-annotation");let O=parseFloat(e.svg.attr("width")),P=parseFloat(e.svg.attr("height")),$=parseFloat(e.graphArea.attr("width")),Y=parseFloat(e.graphArea.attr("height")),z=7*c+parseFloat(e.header.attr("height")),R=7*c;z>P&&Po(e.svg,0,z-P),R>O&&Po(e.svg,R-O,0),z>Y&&Po(e.graphArea,0,z-Y),R>$&&Po(e.svg,R-$,0)}function du(t,e,n,r,i){n&&gu&&(cu(t,e=su(e,t,n),n,r,i),hu(0,e,n,r,i))}function gu(t,e,n){if(!e||!gu)return;n.dataset;let r=0;for(let t of e.datasets)t.getQuery().usedAsXDataset||r++;if(0===r)return"No available dataset found";if(uu(e,n),null===n.selectedDataset)return"No available dataset found";let i={};i=su(i,t,e);let a=null;if(n.initMonth){if(a=Eo(n.initMonth,e.dateFormat),!a){let t=window.moment(n.initMonth,"YYYY-MM",!0);if(!t.isValid())return"Invalid initMonth";a=t}}else a=e.datasets.getDates().last();a&&(cu(t,i,e,n,a),hu(0,i,e,n,a),function(t,e,n){let r=ne(t),i=e.svg,a=parseFloat(i.attr("width")),l=parseFloat(i.attr("height"));i.attr("width",null).attr("height",null).attr("viewBox",`0 0 ${a} ${l}`).attr("preserveAspectRatio","xMidYMid meet"),n.fitPanelWidth?r.style("width","100%"):(r.style("width",(a*n.fixedScale).toString()+"px"),r.style("height",(l*n.fixedScale).toString()+"px"))}(t,i,e))}function pu(t,e,n){if(e&&pu)return"Under construction"}function yu(t,e,n){if(!e||!n)return;let r=parseFloat(n.dataset);e.datasets.getDatasetById(r),"horizontal"===n.orientation?e.dataAreaSize={width:250,height:24}:"vertical"===n.orientation&&(e.dataAreaSize={width:24,height:250});let i=function(t,e,n){let r={};if(!e||!n)return;let i=ne(t).append("svg").attr("id","svg").attr("width",e.dataAreaSize.width+e.margin.left+e.margin.right).attr("height",e.dataAreaSize.height+e.margin.top+e.margin.bottom);r.svg=i;let a=i.append("g").attr("id","graphArea").attr("transform","translate("+e.margin.left+","+e.margin.top+")").attr("width",e.dataAreaSize.width+e.margin.right).attr("height",e.dataAreaSize.height+e.margin.bottom);r.graphArea=a;let l=a.append("g").attr("id","dataArea").attr("width",e.dataAreaSize.width).attr("height",e.dataAreaSize.height);return r.dataArea=l,r}(t,e,n),a=function(t,e,n,r){if(!e||!n)return;let i=n.range,a=i[i.length-1],l=[0,a],o=n.valueUnit,u=function(t){return o&&o.endsWith("%")?ui(0,a,7)(t)+" %":ui(0,a,7)(t)},s=Oo(u(a),"tracker-tick-label");if("horizontal"===n.orientation){let n=fi();n.domain(l).range([0,e.dataAreaSize.width]),t.scale=n;let r=O(n);r.tickFormat(u);let i=t.dataArea.append("g").attr("id","axis").attr("transform","translate(0,"+e.dataAreaSize.height+")").call(r).attr("class","tracker-axis");t.axis=i,i.selectAll("path").style("stroke","none"),i.selectAll("line"),i.selectAll("text").attr("class","tracker-tick-label"),i.attr("width",e.dataAreaSize.width+s.width),i.attr("height",6+s.height),Po(t.svg,+s.width,6+s.height),Po(t.graphArea,+s.width,6+s.height)}else if("vertical"===n.orientation){let n=fi();n.domain(l).range([e.dataAreaSize.height,0]),t.scale=n;let r=P(n);r.tickFormat(u);let i=t.dataArea.append("g").attr("id","axis").attr("x",0).attr("y",0).call(r).attr("class","tracker-axis");t.axis=i,i.selectAll("path").style("stroke","none"),i.selectAll("line"),i.selectAll("text").attr("class","tracker-tick-label"),i.attr("width",6+s.width),i.attr("height",e.dataAreaSize.width),Po(t.svg,6+s.width,0),Po(t.graphArea,6+s.width,0),$o(t.dataArea,6+s.width,0)}}(i,e,n);if("string"==typeof a)return a;!function(t,e,n){if(!e||!n)return;if(n.title){let r=Oo(n.title,"tracker-title-small");if("horizontal"===n.orientation){let i=t.graphArea.append("text").text(n.title).attr("id","title").attr("x",r.width/2).attr("y",e.dataAreaSize.height/2).attr("height",r.height).attr("class","tracker-title-small");t.title=i,Po(t.svg,r.width+6,0),Po(t.graphArea,r.width+6,0),$o(t.dataArea,r.width+6,0)}else if("vertical"===n.orientation){let i=e.dataAreaSize.width/2;r.width>e.dataAreaSize.width&&(Po(t.svg,r.width-e.dataAreaSize.width,0),Po(t.graphArea,r.width-e.dataAreaSize.width,0),$o(t.dataArea,r.width/2-e.dataAreaSize.width/2,0),i=r.width/2);let a=parseFloat(t.axis.attr("width")),l=t.graphArea.append("text").text(n.title).attr("id","title").attr("x",i+a).attr("y",r.height/2).attr("height",r.height).attr("class","tracker-title-small");t.title=l,Po(t.svg,0,r.height+6),Po(t.graphArea,0,r.height+6),$o(t.dataArea,0,r.height+6)}}if(n.valueUnit){let r=Oo(n.valueUnit,"tracker-tick-label");if("horizontal"===n.orientation){let i=t.dataArea.append("text").text(n.valueUnit).attr("id","unit").attr("x",-1*(r.width+6)).attr("y",e.dataAreaSize.height+6).attr("height",r.height).attr("class","tracker-tick-label");t.unit=i}else if("vertical"===n.orientation){let i=t.dataArea.append("text").text(n.valueUnit).attr("id","unit").attr("x",e.dataAreaSize.width/2-r.width/2).attr("y",-(r.height/2+6)).attr("height",r.height).attr("class","tracker-tick-label");t.unit=i,Po(t.svg,0,r.height+6),Po(t.graphArea,0,r.height+6),$o(t.dataArea,0,r.height+6)}}}(i,e,n),function(t,e,n,r){if(!e||!n)return;let i=t.scale,a=n.range,l=n.rangeColor,o=[],u=0;for(let t=0;t=e&&(n=r=e):(n>e&&(n=e),r=a&&(n=r=a):(n>a&&(n=a),ro)&&(o=e.getYMax()),s=e.valueType===no.Time,null===u)u=s;else if(s!==u)return"Not all values in time format"}let f=null;"left"===r?f=n.yMin[0]:"right"===r&&(f=n.yMin[1]);let c=!1;"number"!=typeof f?f=l:c=!0;let h=null;"left"===r?h=n.yMax[0]:"right"===r&&(h=n.yMax[1]);let d=!1;if("number"!=typeof h?h=o:d=!0,h0&&(g=0));let v=[g,p];("left"===r&&n.reverseYAxis[0]||"right"===r&&n.reverseYAxis[1])&&(v=[p,g]),m.domain(v).range([e.dataAreaSize.height,0]),"left"===r?t.leftYScale=m:"right"===r&&(t.rightYScale=m);let x="";"left"===r?x=n.yAxisColor[0]:"right"===r&&(x=n.yAxisColor[1]);let A="";"left"===r?A=n.yAxisLabelColor[0]:"right"===r&&(A=n.yAxisLabelColor[1]);let w="";"left"===r?w=n.yAxisLabel[0]:"right"===r&&(w=n.yAxisLabel[1]);let b="",k=null,C=null;"left"===r?(b=n.yAxisUnit[0],k=n.yAxisTickInterval[0],C=n.yAxisTickLabelFormat[0]):"right"===r&&(b=n.yAxisUnit[1],k=n.yAxisTickInterval[1],C=n.yAxisTickLabelFormat[1]);let M,_=null;if(s?_=_o(k):(_=parseFloat(k),Number.isNumber(_)&&!Number.isNaN(_)||(_=null)),"left"===r?M=P(m):"right"===r&&(M=V(T,m)),M){let t=function(t,e,n,r=!1){if(r){if(n){function i(t){return window.moment("00:00","HH:mm",!0).add(t,"seconds").format(n)}return i}{function a(n){const r=Math.abs(e-t);let i=window.moment("00:00","HH:mm",!0).add(n,"seconds").format("HH:mm");return r>43200&&(ne||(n-t)/3600%2<1)&&(i=""),i}return a}}if(n){function l(t){return Wo.sprintf("%"+n,t)}return l}return ui(t,e,10)}(g,p,C,s);t&&M.tickFormat(t);let e=function(t,e,n,r=!1){const i=Math.abs(e-t);let a=[];r?a=n&&window.moment.isDuration(n)?D(t,e,Math.abs(n.asSeconds())):i>18e3?D(t=3600*Math.floor(t/3600),e=3600*Math.ceil(e/3600),3600):D(t=1800*Math.floor(t/1800),e=1800*Math.ceil(e/1800),1800):n&&"number"==typeof n&&(a=D(t,e,n));return 0===a.length?null:a}(g,p,_,s);e&&M.tickValues(e)}let E=t.dataArea.append("g").attr("id","yAxis").call(M).attr("class","tracker-axis");"right"==r&&E.attr("transform","translate("+e.dataAreaSize.width+" ,0)"),"left"===r?t.leftYAxis=E:"right"===r&&(t.rightYAxis=E);let F=E.selectAll("path");x&&F.style("stroke",x);let S=E.selectAll("line");x&&S.style("stroke",x);let B=E.selectAll("text").attr("class","tracker-tick-label");x&&B.style("fill",x);let N=0;for(let t of B)if(t.textContent){let e=Oo(t.textContent,"tracker-axis-label");e.width>N&&(N=e.width)}""!==b&&(w+=" ("+b+")");let I=Oo(w),L=E.append("text").text(w).attr("transform","rotate(-90)").attr("x",-1*e.dataAreaSize.height/2).attr("class","tracker-axis-label");"left"===r?L.attr("y",-6-N-I.height/2):L.attr("y",6+N+I.height),A&&L.style("fill",A);let O=I.height+N+6;E.attr("width",O),Po(t.svg,O,0),Po(t.graphArea,O,0),"left"===r&&($o(t.dataArea,O,0),t.title&&$o(t.title,O,0))}function xu(t,e,n,r,i){if(!e||!n)return;let a=null;if("left"===i?a=t.leftYScale:"right"===i&&(a=t.rightYScale),n.showLine[r.getId()]){let e=function(t,e){var n=Cl(!0),r=null,i=ql,a=null,l=Pl(o);function o(o){var u,s,f,c=(o=Wl(o)).length,h=!1;for(null==r&&(a=i(f=l())),u=0;u<=c;++u)!(u0&&(i.style("stroke",n.pointBorderColor[r.getId()]),i.style("stroke-width",n.pointBorderWidth[r.getId()]))),n.allowInspectData&&function(t,e,n){let r=e.dataArea.append("svg").style("opacity",0),i=r.append("rect").attr("x",0).attr("y",0),a=r.append("text"),l=a.append("tspan").attr("class","tracker-tooltip-label"),o=a.append("tspan").attr("class","tracker-tooltip-label"),u=3,s=3;t.on("mouseenter",(function(t){const[e,f]=function(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(e.getScreenCTM().inverse())).x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}(t);let c=0,h=0,d="date: "+ne(this).attr("date"),g=Oo(d,"tracker-tooltip-label");l.text(d),g.width>c&&(c=g.width),h+=g.height,l.attr("x",u).attr("y",h);let p="value: ",y=ne(this).attr("valueType"),m=ne(this).attr("value");if("Time"===y){p+=window.moment("00:00","HH:mm",!0).add(parseFloat(m),"seconds").format("HH:mm"),o.text(p)}else p+=m,o.text(p);let v=Oo(p,"tracker-tooltip-label");v.width>c&&(c=v.width),h+=s+v.height,o.attr("x",u).attr("y",h),c+=2*u,h+=2*s,a.attr("width",c).attr("height",h),i.attr("width",c).attr("height",h).attr("class","tracker-tooltip");let x=e,A=f,w=12,b=12;x=e+w+c>n.dataAreaSize.width?e-c-w:e+w,A=f-b-h<0?f+b:f-b-h,r.attr("x",x).attr("y",A),r.transition().duration(200).style("opacity",1)})).on("mouseleave",(function(){r.transition().duration(500).style("opacity",0)}))}(i,t,e)}}function wu(t,e,n,r,i,a,l){if(!e||!n)return;let o=e.dataAreaSize.width/r.getLength(),u=o;o-1>0&&(u=o-1),u/=l;let s=null;"left"===i?s=t.leftYScale:"right"===i&&(s=t.rightYScale);let f=t.dataArea.selectAll("bar").data(Array.from(r).filter((function(t){return null!==t.value}))).enter().append("rect").attr("x",(function(e,n){if(0===n){let n=a+1-l/2;if(n<1)return t.xScale(e.date)-o/2+a*u+n*u}return t.xScale(e.date)-o/2+a*u})).attr("y",(function(t){return s(Math.max(t.value,0))})).attr("width",(function(t,e){if(0===e){let t=a+1-l/2;return t<0?0:t<1?u*t:u}if(e===r.getLength()-1){let t=1-(a+1-l/2);return t<0?0:t<1?u*t:u}return u})).attr("height",(function(t){if(null!==t.value)return Math.abs(s(t.value)-s(0))})).attr("class","tracker-bar");n.barColor[r.getId()]&&f.style("fill",n.barColor[r.getId()])}function bu(t,e,n){let r=t.svg;t.graphArea;let i=t.dataArea,a=t.title,l=t.xAxis,o=t.leftYAxis,u=t.rightYAxis,s=0;a&&(s=parseFloat(a.attr("height")));let f=parseFloat(l.attr("height")),c=0;o&&(c=parseFloat(o.attr("width")));let h=0;u&&(h=parseFloat(u.attr("width")));let d=e.datasets,g=d.getXDatasetIds(),p=d.getNames(),y=p.map((function(t){return Oo(t,"tracker-legend-label")})),m=0,v=0;for(let t=0;tv&&(v=y[t].width,m=t);let x=v/p[m].length,A=y[m].height,w=p.length-g.length,b=2*x,D=A,C=2*x,M=0,T=0;"vertical"===n.legendOrientation?(M=3*b+C+v,T=(w+1)*D):"horizontal"===n.legendOrientation&&(M=(2*b+C)*w+b+k(y,(function(t,e){return g.includes(e)?0:t.width})),T=D+A);let _=0,E=0;if("top"===n.legendPosition)_=c+e.dataAreaSize.width/2-M/2,E=s,Po(r,0,T+D),$o(i,0,T+D);else if("bottom"===n.legendPosition)_=c+e.dataAreaSize.width/2-M/2,E=s+e.dataAreaSize.height+f+D,Po(r,0,T+D);else if("left"===n.legendPosition)_=0,E=s+e.dataAreaSize.height/2-T/2,Po(r,M+b,0),$o(i,M+b,0);else{if("right"!==n.legendPosition)return;_=e.dataAreaSize.width+c+h+b,E=s+e.dataAreaSize.height/2-T/2,Po(r,M+b,0)}let F=t.graphArea.append("g").attr("id","legend").attr("transform","translate("+_+","+E+")"),S=F.append("rect").attr("class","tracker-legend").attr("width",M).attr("height",T);n.legendBgColor&&S.style("fill",n.legendBgColor),n.legendBorderColor&&S.style("stroke",n.legendBorderColor);let B=b,N=A,I=B+b+C,L=N;if("vertical"===n.legendOrientation){n.GetGraphType()===eo.Line?(F.selectAll("markers").data(p).enter().append("line").attr("x1",B).attr("x2",B+C).attr("y1",(function(t,e){let n=g.filter((t=>ttttt!g.includes(e)))).enter().append("rect").attr("x",(function(t,e){let n=b;for(let[t,r]of y.entries())if(!g.includes(t)){if(!(ta.length;)a.push(r);if(null==e);else if("object"==typeof e&&null!==e){if(Array.isArray(e)){if(e.length>n)return l="Too many inputs for parameter '"+t+"'",l;if(0===e.length)return l="Empty array not allowd for "+t,l;for(let n=0;n0&&(u=e[n-1].trim()),"string"==typeof i){if(i=i.trim(),""!==i){l="Invalid inputs for "+t;break}a[n]=null!==u?u:r}else{if("boolean"!=typeof i){l="Invalid inputs for "+t;break}a[n]=i,o++}}else{let t=e[e.length-1];a[n]=o>0?t:r}}}else if("string"==typeof e){let i=Bu(e);if(i.length>1){if(i.length>n)return l="Too many inputs for parameter '"+t+"'",l;for(let e=0;e0&&(u=_u(i[e-1].trim())),""===n)a[e]=null!==u?u:r;else{let r=_u(n);if(null===r){l="Invalid inputs for "+t;break}a[e]=r,o++}}else{let t=_u(i[i.length-1].trim());a[e]=o>0&&null!==t?t:r}}else if(""===e);else{let n=_u(e);if(null!==n){a[0]=n,o++;for(let t=1;ta.length;)a.push(r);if(null==e);else if("object"==typeof e&&null!==e){if(Array.isArray(e)){if(e.length>n)return l="Too many inputs for parameter '"+t+"'",l;if(0===e.length)return l="Empty array not allowd for "+t,l;for(let n=0;n0&&(u=e[n-1].trim()),"string"==typeof i){if(i=i.trim(),""!==i){l="Invalid inputs for "+t;break}a[n]=null!==u?u:r}else{if("number"!=typeof i){l="Invalid inputs for "+t;break}a[n]=i,o++}}else{let t=e[e.length-1];a[n]=o>0?t:r}}}else if("string"==typeof e){let i=Bu(e);if(i.length>1){if(i.length>n)return l="Too many inputs for parameter '"+t+"'",l;for(let n=0;n0&&(u=Vo(i[n-1].trim()).value),""===e)null!==u&&Number.isNumber(u)?a[n]=u:a[n]=r;else{let r=Vo(e).value;if(null===r){l="Invalid inputs for "+t;break}a[n]=r,o++}}else{let t=Vo(i[e.length-1].trim()).value;a[n]=o>0&&null!==t?t:r}}else if(""===e);else{let n=Vo(e).value;if(null!==n){a[0]=n,o++;for(let t=1;t