/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ var $6=Object.create;var kh=Object.defineProperty;var M6=Object.getOwnPropertyDescriptor;var O6=Object.getOwnPropertyNames;var R6=Object.getPrototypeOf,L6=Object.prototype.hasOwnProperty;var YP=r=>{throw TypeError(r)};var N6=(r,e,t)=>e in r?kh(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var k=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(n){throw t=[n],n}};var B6=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},Nb=(r,e)=>{for(var t in e)kh(r,t,{get:e[t],enumerable:!0})},KP=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of O6(e))!L6.call(r,i)&&i!==t&&kh(r,i,{get:()=>e[i],enumerable:!(n=M6(e,i))||n.enumerable});return r};var QP=(r,e,t)=>(t=r!=null?$6(R6(r)):{},KP(e||!r||!r.__esModule?kh(t,"default",{value:r,enumerable:!0}):t,r)),V6=r=>KP(kh({},"__esModule",{value:!0}),r);var pe=(r,e,t)=>N6(r,typeof e!="symbol"?e+"":e,t),d_=(r,e,t)=>e.has(r)||YP("Cannot "+t);var z=(r,e,t)=>(d_(r,e,"read from private field"),t?t.call(r):e.get(r)),Ye=(r,e,t)=>e.has(r)?YP("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),He=(r,e,t,n)=>(d_(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),ct=(r,e,t)=>(d_(r,e,"access private method"),t);var BM,VM,qM=k(()=>{BM=r=>{let e,t=new Set,n=(c,u)=>{let d=typeof c=="function"?c(e):c;if(!Object.is(d,e)){let f=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),t.forEach(p=>p(e,f))}},i=()=>e,a={setState:n,getState:i,getInitialState:()=>l,subscribe:c=>(t.add(c),()=>t.delete(c))},l=e=r(n,i,a);return a},VM=(r=>r?BM(r):BM)});function sg(r){if(r.kind)return r.kind;let e=(r.name??"").toLowerCase(),t=oj(r.endpoint),n=i=>t===i||t.endsWith(`.${i}`);return e==="anthropic"||n("api.anthropic.com")?"anthropic":e==="gemini"||n("generativelanguage.googleapis.com")?"gemini":"openai"}function oj(r){let e=(r??"").trim();if(!e)return"";for(let t of[e,`https://${e}`])try{return new URL(t).hostname.toLowerCase()}catch{}return""}function sj(r){return r.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"provider"}function Aw(r,e){let t=sj(r),n=new Set(e.map(o=>o.id).filter(o=>!!o)),i=t;for(let o=2;n.has(i);o++)i=`${t}-${o}`;return i}function Dw(r){let e=!1,t=new Set;for(let n of r){if(n.id&&!t.has(n.id)){t.add(n.id);continue}n.id=Aw(n.id??n.name,r),t.add(n.id),e=!0}return e}function gc(r,e){return e&&e.name===r?e:void 0}function Iw(r){return ag[r].map(e=>({...e}))}var ag,UM,aj,lj,Fw,fo=k(()=>{ag={openai:[{name:"gpt-5.5",maxTokens:105e4,maxOutputTokens:128e3,supportsTemperature:!1},{name:"gpt-5.4",maxTokens:105e4,maxOutputTokens:128e3,supportsTemperature:!1},{name:"gpt-5.4-mini",maxTokens:4e5,maxOutputTokens:128e3,supportsTemperature:!1},{name:"gpt-5.4-nano",maxTokens:4e5,maxOutputTokens:128e3,supportsTemperature:!1},{name:"gpt-4.1",maxTokens:1047576,maxOutputTokens:32768,supportsTemperature:!0},{name:"gpt-4.1-mini",maxTokens:1047576,maxOutputTokens:32768,supportsTemperature:!0},{name:"gpt-4o",maxTokens:128e3,maxOutputTokens:16384,supportsTemperature:!0},{name:"gpt-4o-mini",maxTokens:128e3,maxOutputTokens:16384,supportsTemperature:!0},{name:"o3",maxTokens:2e5,maxOutputTokens:1e5,supportsTemperature:!1},{name:"o4-mini",maxTokens:2e5,maxOutputTokens:1e5,supportsTemperature:!1}],google:[{name:"gemini-3.5-flash",maxTokens:1048576,maxOutputTokens:65536,supportsTemperature:!0},{name:"gemini-3.1-pro-preview",maxTokens:1048576,maxOutputTokens:65536,supportsTemperature:!0},{name:"gemini-3.1-flash-lite",maxTokens:1048576,maxOutputTokens:65536,supportsTemperature:!0},{name:"gemini-3-pro-preview",maxTokens:1048576,maxOutputTokens:65536,supportsTemperature:!0},{name:"gemini-3-flash-preview",maxTokens:1048576,maxOutputTokens:65536,supportsTemperature:!0},{name:"gemini-2.5-pro",maxTokens:1048576,maxOutputTokens:65536,supportsTemperature:!0},{name:"gemini-2.5-flash",maxTokens:1048576,maxOutputTokens:65536,supportsTemperature:!0},{name:"gemini-2.5-flash-lite",maxTokens:1048576,maxOutputTokens:65536,supportsTemperature:!0}],anthropic:[{name:"claude-fable-5",maxTokens:1e6,maxOutputTokens:128e3,supportsTemperature:!1},{name:"claude-sonnet-5",maxTokens:1e6,maxOutputTokens:128e3,supportsTemperature:!1},{name:"claude-opus-4-8",maxTokens:1e6,maxOutputTokens:128e3,supportsTemperature:!1},{name:"claude-opus-4-5",maxTokens:2e5,maxOutputTokens:64e3,supportsTemperature:!0},{name:"claude-haiku-4-5",maxTokens:2e5,maxOutputTokens:64e3,supportsTemperature:!0}]},UM={openai:["gpt-4-32k","gpt-4-1106-preview"],google:["gemini-1.5-pro","gemini-1.5-flash","gemini-1.5-flash-8b"]};aj={id:"openai",name:"OpenAI",endpoint:"https://api.openai.com/v1",kind:"openai",apiKey:"",models:Iw("openai"),autoSyncModels:!0,modelSource:"modelsDev"},lj={id:"gemini",name:"Gemini",endpoint:"https://generativelanguage.googleapis.com",kind:"gemini",apiKey:"",models:Iw("google"),autoSyncModels:!0,modelSource:"modelsDev"},Fw=[aj,lj]});function zM(r,e){return Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0}function lg(r,e=$p){let t=r.trim();if(!t)return r;let n=zM(e,t.toLowerCase());if(n)return n;let[i,...o]=t.split(/\s+/),s=zM(e,i.toLowerCase());return s?[s,...o].join(" "):r}function HM(r){let e={},t=r.split(/\r?\n/);for(let n of t){let i=n.trim();if(!i||i.startsWith("#"))continue;let o=i.indexOf("=");if(o===-1)continue;let s=i.slice(0,o).trim().toLowerCase(),a=i.slice(o+1).trim();!s||!a||Object.defineProperty(e,s,{value:a,enumerable:!0,writable:!0,configurable:!0})}return e}function gk(r){return Object.entries(r).filter(([e,t])=>e&&t).map(([e,t])=>`${e} = ${t}`).join(` `)}function cg(r){let e=Object.entries(r);if(e.length===0)return[];let n=["t","tm","yd"].map(s=>{let a=r[s];return a?[s,a]:null}).filter(s=>s!==null),i=new Set(n.map(([s])=>s)),o=e.filter(([s])=>!i.has(s)).sort((s,a)=>{let l=s[0].length-a[0].length;return l!==0?l:s[0].localeCompare(a[0])});return[...n,...o]}function Pw(r){return cg(r).map(([e,t])=>`${e}=${t}`).join(", ")}var $p,Ku=k(()=>{$p={t:"today",tm:"tomorrow",yd:"yesterday",nw:"next week",nm:"next month",ny:"next year",lw:"last week",lm:"last month",ly:"last year"}});var $w,vk=k(()=>{fo();Ku();$w={choices:[],inputPrompt:"single-line",persistInputPromptDrafts:!0,useSelectionAsCaptureValue:!0,namePastedImagesAfterNoteTitle:!1,searchNestedChoices:!0,templateFolderLauncherRow:"bottom",devMode:!1,templateFolderPaths:[],announceUpdates:"major",version:"0.0.0",globalVariables:{},onePageInputEnabled:!1,disableOnlineFeatures:!0,enableUriCallbacks:!1,enableRibbonIcon:!1,showCaptureNotification:!0,showInputCancellationNotification:!1,enableTemplatePropertyTypes:!1,dateAliases:$p,ai:{defaultModel:"Ask me",defaultSystemPrompt:'As an AI assistant within Obsidian, your primary goal is to help users manage their ideas and knowledge more effectively. Format your responses using Markdown syntax. Please use the [[Obsidian]] link format. You can write aliases for the links by writing [[Obsidian|the alias after the pipe symbol]]. To use mathematical notation, use LaTeX syntax. LaTeX syntax for larger equations should be on separate lines, surrounded with double dollar signs ($$). You can also inline math expressions by wrapping it in $ symbols. For example, use $$w_{ij}^{\\text{new}}:=w_{ij}^{\\text{current}}+\\eta\\cdot\\delta_j\\cdot x_{ij}$$ on a separate line, but you can write "($\\eta$ = learning rate, $\\delta_j$ = error term, $x_{ij}$ = input)" inline.',promptTemplatesFolderPath:"",showAssistant:!0,providers:Fw,confirmToolCalls:"destructive"},migrations:{migrateToMacroIDFromEmbeddedMacro:!0,useQuickAddTemplateFolder:!1,incrementFileNameSettingMoveToDefaultBehavior:!1,consolidateFileExistsBehavior:!1,repairTemplateFileExistsBehavior:!1,mutualExclusionInsertAfterAndWriteToBottomOfFile:!1,setVersionAfterUpdateModalRelease:!1,addDefaultAIProviders:!1,removeMacroIndirection:!1,migrateFileOpeningSettings:!1,backfillFileOpeningDefaults:!1,setProviderModelDiscoveryMode:!1,migrateProviderApiKeysToSecretStorage:!1,migrateToMultipleTemplateFolders:!1,refreshStaleDefaultModelSeeds:!1,pinAiModelRefs:!1}}});function Ze(r){if(typeof structuredClone=="function")try{return structuredClone(r)}catch{}return vc(r,new Map)}function vc(r,e){if(r===null||typeof r!="object")return r;if(e.has(r))return e.get(r);if(r instanceof Date){let i=new Date(r.getTime());return e.set(r,i),i}if(Array.isArray(r)){let i=[];e.set(r,i);for(let o of r)i.push(vc(o,e));return i}if(r instanceof Map){let i=new Map;e.set(r,i);for(let[o,s]of r.entries())i.set(vc(o,e),vc(s,e));return i}if(r instanceof Set){let i=new Set;e.set(r,i);for(let o of r.values())i.add(vc(o,e));return i}if(r instanceof RegExp){let i=new RegExp(r.source,r.flags);return i.lastIndex=r.lastIndex,e.set(r,i),i}if(r instanceof ArrayBuffer){let i=r.slice(0);return e.set(r,i),i}if(ArrayBuffer.isView(r)){if(r instanceof DataView){let a=new DataView(vc(r.buffer,e),r.byteOffset,r.byteLength);return e.set(r,a),a}let i=r,o=vc(i.buffer,e),s=new i.constructor(o,i.byteOffset,i.length);return e.set(r,s),s}let t=Object.getPrototypeOf(r),n=Object.create(t);e.set(r,n);for(let[i,o]of Object.entries(r))Object.defineProperty(n,i,{value:vc(o,e),writable:!0,enumerable:!0,configurable:!0});return n}var qn=k(()=>{});var ne,ht=k(()=>{qM();vk();qn();ne=(()=>{let r=VM((i,o)=>({...Ze($w)})),{getState:e,setState:t,subscribe:n}=r;return{getState:e,replaceState:i=>t(i,!0),setState:t,subscribe:n}})()});var Qu,ug,P,De=k(()=>{Qu=class Qu{register(e){return Qu.loggers.push(e),this}logError(e){let t=e instanceof Error?e.message:e,n=e instanceof Error?e.stack:void 0,i=e instanceof Error?e:void 0;Qu.loggers.forEach(o=>o.logError(t,n,i))}logWarning(e){let t=e instanceof Error?e.message:e,n=e instanceof Error?e.stack:void 0,i=e instanceof Error?e:void 0;Qu.loggers.forEach(o=>o.logWarning(t,n,i))}logMessage(e){let t=e instanceof Error?e.message:e,n=e instanceof Error?e.stack:void 0,i=e instanceof Error?e:void 0;Qu.loggers.forEach(o=>o.logMessage(t,n,i))}};Qu.loggers=[];ug=Qu,P=new ug});var zo,WM,yk,$i,ul,dl,Ds,Mw,Mp,Op,Rp,pl,Xu,GCe,Zu,Ow,Rw,yc,bk,wk,YCe,KCe,QCe,Ht,Cr,li,Ck,bc,Ho,ba,fl,Lw,Wo,Ek,xk,Tk,jM,GM,YM,KM,QM,XM,ZM,JM,eO,tO,rO,Sk,nO,iO,oO,sO,aO,lO,cO,uO,dO,pO,fO,mO,hO,Nw,dg,ml,gO,Je=k(()=>{zo="{{value}}",WM="{{name}}",yk=new RegExp(/^-?[0-9]*$/),$i="top",ul="bottom",dl="cursor",Ds="ordered",Mw=new RegExp(/{{DATE(\+-?[0-9]+)?(?:\|((?:startof|endof):[a-z]+))?(?:\|case:([a-z-]+))?}}/i),Mp=new RegExp(/{{DATE:((?:\[[^\]\n\r]*\]|\[(?![^\]\n\r]*\])|[^}\n\r+|\[]|\|(?!(?:startof|endof):[a-z])(?!(?:case):[a-z-]+}}))*)(\+-?[0-9]+)?(?:\|((?:startof|endof):[a-z]+))?(?:\|case:([a-z-]+))?}}/i),Op=new RegExp(/{{TIME(?:\|case:([a-z-]+))?}}/i),Rp=new RegExp(/{{TIME:((?:\[[^\]\n\r]*\]|\[(?![^\]\n\r]*\])|[^}\n\r+|\[]|\|(?!(?:case):[a-z-]+}}))*)(?:\|case:([a-z-]+))?}}/i),pl=new RegExp(/{{(?:NAME|VALUE)(?!:)(?:\|[^\n\r}]*)?}}/i),Xu=new RegExp(/{{VALUE:([^\n\r}]*)}}/i),GCe=new RegExp(/{{FIELD:([^\n\r}]*)}}/i),Zu="FIELD:",Ow=new RegExp(/{{FIELD:([^\n\r}|{]*)(\|[^\n\r}{]*)?}}/i),Rw=new RegExp(/{{FILE:([^\n\r{}]*)}}/i),yc=new RegExp(/{{VDATE:([^\n\r},|{]*)(?:,([^\n\r}|{]*))?(?:\|([^\n\r}{]*))?}}/i),bk=new RegExp(/{{LINKCURRENT}}/i),wk=new RegExp(/{{LINKSECTION}}/i),YCe=new RegExp(/{{FILENAMECURRENT}}/i),KCe=new RegExp(/{{FOLDERCURRENT(\|name)?}}/i),QCe=new RegExp(/{{FOLDER(\|name)?}}/i),Ht=new RegExp(/\.md$/i),Cr=new RegExp(/\.canvas$/i),li=new RegExp(/\.base$/i),Ck=new RegExp(/\.js$/),bc=new RegExp(/{{MACRO:([^\n\r}]*)}}/i),Ho=new RegExp(/{{TEMPLATE:([^\n\r}]*\.(?:md|canvas|base))}}/i),ba=new RegExp(/{{GLOBAL_VAR:([^\n\r}]*)}}/i),fl=new RegExp(/`{3,}js quickadd([\s\S]*?)`{3,}/),Lw=new RegExp(/{{MVALUE}}/i),Wo=new RegExp(/{{TITLE}}/i),Ek=new RegExp(/{{SELECTED}}/i),xk=new RegExp(/{{CLIPBOARD}}/i),Tk=new RegExp(/{{RANDOM:(\d+)}}/i),jM=new RegExp(/\[\[([^\]]*)$/),GM=new RegExp(/#([^ ]*)$/),YM=new RegExp(/{{[D]?[A]?[T]?[E]?[}]?[}]?$/i),KM=new RegExp(/{{[D]?[A]?[T]?[E]?[:]?$|{{DATE:[^\n\r}]*}}$/i),QM=new RegExp(/{{[N]?[A]?[M]?[E]?[}]?[}]?$/i),XM=new RegExp(/{{[V]?[A]?[L]?[U]?[E]?[}]?[}]?$/i),ZM=new RegExp(/{{[V]?[A]?[L]?[U]?[E]?[:]?$|{{VALUE:[^\n\r}]*}}$/i),JM=new RegExp(/{{[V]?[D]?[A]?[T]?[E]?[:]?$|{{VDATE:[^\n\r}]*}}$/i),eO=new RegExp(/{{[L]?[I]?[N]?[K]?[C]?[U]?[R]?[R]?[E]?[N]?[T]?[}]?[}]?$/i),tO=new RegExp(/^\{\{(?:l(?:i(?:n(?:k(?:s(?:e(?:c(?:t(?:i(?:o(?:n(?:\}\}?)?)?)?)?)?)?)?)?)?)?)?)?$/i),rO=new RegExp(/{{[F]?[I]?[L]?[E]?[N]?[A]?[M]?[E]?[C]?[U]?[R]?[R]?[E]?[N]?[T]?[}]?[}]?$/i),Sk=new RegExp(/{{[F]?[O]?[L]?[D]?[E]?[R]?[C]?[U]?[R]?[R]?[E]?[N]?[T]?[}]?[}]?$/i),nO=new RegExp(/{{[F]?[O]?[L]?[D]?[E]?[R]?[}]?[}]?$/i),iO=new RegExp(/{{[F]?[I]?[L]?[E]?[:]?$/i),oO=new RegExp(/{{[F]?[I]?[E]?[L]?[D]?[:]?$/i),sO=new RegExp(/{{[T]?[E]?[M]?[P]?[L]?[A]?[T]?[E]?[:]?$|{{TEMPLATE:[^\n\r}]*[}]?[}]?$/i),aO=new RegExp(/{{[M]?[A]?[C]?[R]?[O]?[:]?$|{{MACRO:[^\n\r}]*}}$/i),lO=new RegExp(/{{[M]?[V]?[A]?[L]?[U]?[E]?[}]?[}]?/i),cO=new RegExp(/{{[T]?[I]?[T]?[L]?[E]?[}]?[}]?/i),uO=new RegExp(/{{[S]?[E]?[L]?[E]?[C]?[T]?[E]?[D]?[}]?[}]?/i),dO=new RegExp(/{{[C]?[L]?[I]?[P]?[B]?[O]?[A]?[R]?[D]?[}]?[}]?$/i),pO=new RegExp(/{{[R]?[A]?[N]?[D]?[O]?[M]?[:]?$|{{RANDOM:[^\n\r}]*}}$/i),fO=new RegExp(/{{[G]?[L]?[O]?[B]?[A]?[L]?[_]?[V]?[A]?[R]?[:]?$|{{GLOBAL_VAR:[^\n\r}]*}}$/i),mO=new RegExp(/{{[T]?[I]?[M]?[E]?[}]?[}]?/i),hO=new RegExp(/{{[T]?[I]?[M]?[E]?[:]?$|{{TIME:[^\n\r}]*}}$/i),Nw="__qa.",dg=`${Nw}captureTargetFilePath`,ml=`${Nw}dateOrigin`,gO=new RegExp(/\[\[([^\]]*)\]\]/)});var Bw=k(()=>{});var Tt,jo=k(()=>{Tt=class extends Error{constructor(e){super(e||"Macro execution aborted"),this.name="MacroAbortError"}}});function Ir(){return new dt(wc)}var dt,wc,Er=k(()=>{jo();dt=class extends Tt{},wc="Input cancelled by user"});function Ju(r,e){if(r instanceof Error){if(!e)return r;let n=new Error(`${e}: ${r.message}`);return n.name=r.name,n.stack=r.stack,n}if(typeof r=="string")return new Error(e?`${e}: ${r}`:r);let t=e?`${e}: ${String(r)}`:String(r);return new Error(t)}function pt(r){return r instanceof dt?!0:typeof r=="string"&&cj.has(r)}function bO(r){return typeof r=="object"&&r!==null||typeof r=="function"}function pj(r,e){let t=r;for(let n=0;n{Lp(n,r)};return(...n)=>{try{let i=e(...n);typeof i?.then=="function"&&Promise.resolve(i).catch(t)}catch(i){t(i)}}}var _k,cj,yO,uj,dj,rr=k(()=>{De();Bw();Er();_k=100;cj=new Set(["no input given.","No input given.","cancelled"]),yO=new WeakMap,uj=1e4,dj=8});function Ik(r,e){try{let t=r.workspace.getActiveViewOfType(kO.MarkdownView);if(!t||t.file?.path!==e.path)return{cursor:null,value:null};let n=t.editor,i=n?.getCursor?.(),o=i&&typeof i.line=="number"&&typeof i.ch=="number"?{line:i.line,ch:i.ch}:null,s=typeof n?.getValue=="function"?n.getValue():null;return{cursor:o,value:s}}catch{return{cursor:null,value:null}}}function xj(r,e){return r!==null&&e!==null&&(r.line!==e.line||r.ch!==e.ch)}function SO(r){return typeof r!="string"?null:[...r.matchAll(Ej)].length}function Tj(r,e){let t=SO(r),n=SO(e);return t!==null&&n!==null&&t>n}function _O(r,e){return xj(r.cursor,e.cursor)||Tj(r.value,e.value)}async function qw(r,e,t=500){try{let n=r.vault.adapter;if(!("stat"in n)||typeof n.stat!="function")return;let i=await n.stat(e.path);if(!i)return;let o=i.mtime,s=Date.now(),a=30;for(;Date.now()-swindow.setTimeout(e,r))}async function $k(r,e,t={}){if(e.extension!=="md"||!hg(r))return;let i=ed(r)?.templater?.files_with_pending_templates;if(!(i instanceof Set)){await AO(r,e,{timeoutMs:t.timeoutMs??5e3,gracePeriodMs:t.appearTimeoutMs??2500,quietPeriodMs:200});return}let{timeoutMs:o=5e3,appearTimeoutMs:s=2500}=t,a=Date.now();for(;Date.now()-a0)&&t.size===0){if(fg){await fg;return}fg=(async()=>{try{r.workspace.trigger("templater:all-templates-executed"),await e.templater?.functions_generator?.teardown?.()}catch(n){P.logWarning(`withTemplaterFileCreationSuppressed: teardown failed \u2013 ${n.message}`)}})();try{await fg}finally{fg=null}}}async function Mk(r,e,t){let n=ed(r),i=n?.templater?.files_with_pending_templates;if(!n||!hg(r)||!(i instanceof Set))return await t();Pk++;let o=Fk.get(e);o||(o={count:0,hadPathInitially:i.has(e)},Fk.set(e,o),o.hadPathInitially||i.add(e)),o.count++;let s=!1;try{let a=await t();return s=!0,a}finally{o.count--,Pk--,o.count<=0&&(Fk.delete(e),o.hadPathInitially||(s&&await mg(Sj),i.delete(e),await _j(r,n,i)))}}async function AO(r,e,t={}){let{timeoutMs:n=2e3,quietPeriodMs:i=150,gracePeriodMs:o=800}=t;try{let s=r.vault.adapter;if(!("stat"in s)||typeof s.stat!="function")return;let a=await s.stat(e.path);if(!a)return;let l=a.mtime,c=Date.now(),u=!1,d=c,f=50;for(;Date.now()-d=i)return}else if(m-d>=o)return;f=Math.min(Math.floor(f*1.5),200)}}catch(s){P.logWarning(`waitForFileToStopChanging: fallback due to adapter/stat failure \u2013 ${s.message}`)}}async function kj(r,e){let t=Vw.get(r)??Promise.resolve(),n,i=new Promise(s=>{n=()=>s()}),o=t.catch(()=>{}).then(()=>i);Vw.set(r,o),o.finally(()=>{Vw.get(r)===o&&Vw.delete(r)}).catch(()=>{}),await t.catch(()=>{});try{return await e()}finally{n()}}async function td(r,e,t={}){if(e.extension!=="md")return;let n=ed(r),i=n?.templater,o=i?.overwrite_file_commands;if(!n||!i||typeof o!="function")return;let{skipIfNoTags:s=!0,postWait:a=!0}=t;await kj(e.path,async()=>{await qw(r,e);let l;try{l=await r.vault.read(e)}catch(c){We(c,`overwriteTemplaterOnce: failed to read ${e.path} before render`);return}if(!(s&&!l.includes("<%")))try{await o.call(i,e),a&&await qw(r,e,800)}catch(c){try{await r.vault.modify(e,l)}catch(u){P.logWarning(`Failed to rollback ${e.path} after Templater error: ${u.message}`)}We(c,`Templater failed on ${e.path}. Rolled back to pre-render state.`)}})}async function hl(r,e,t){if(t.extension!=="md")return e;let n=ed(r),i=n?.templater,o=i?.parse_template;if(!n||!i||typeof o!="function")return e;let s=i.create_running_config,a=typeof s=="function"?s.call(i,void 0,t,4):{target_file:t,run_mode:4,frontmatter:{}};return await o.call(i,a,e)}async function Ec(r,e){if(e.extension!=="md"||r.workspace.getActiveFile()?.path!==e.path)return!1;let t=ed(r),n=!!t?.settings?.auto_jump_to_cursor,i=t?.editor_handler,o=i?.jump_to_next_cursor_location;if(!n)return!1;let s=Ik(r,e);if(typeof o=="function")try{return await o.call(i,e,!0),_O(s,Ik(r,e))}catch(a){P.logWarning(`jumpToNextTemplaterCursorIfPossible: API failed \u2013 ${a.message}`)}try{return!r.commands.executeCommandById?.("templater-obsidian:jump-to-next-cursor-location")?!1:_O(s,Ik(r,e))}catch{}return!1}var kO,Ej,Fk,Pk,fg,Sj,Vw,DO=k(()=>{kO=require("obsidian");De();rr();Ej=/<%\s*tp\.file\.cursor\([0-9]*\)\s*%>/g;Fk=new Map,Pk=0,fg=null,Sj=350;Vw=new Map});function ln(r){let e=r.workspace.getActiveViewOfType(IO.MarkdownView);return e?.editor?e:null}function rd(r){return ln(r)?.editor.getSelection()??""}var IO,wa=k(()=>{IO=require("obsidian")});function Vp(r){return Aj.has(r)}function id(r){return r==="inFrontmatter"}function zw(r){return Dj.has(r)}function Ij(r,e,t){return r==="embed"&&t.type==="activeFile"&&Vp(e)?"embed":"link"}function Fj(r,e,t,n){return r==="selection"&&t.type==="activeFile"&&zw(e)&&n==="link"?"selection":"none"}function Pj(r){return r?.type==="specifiedFile"?{type:"specifiedFile",path:typeof r.path=="string"?r.path.trim():""}:{type:"activeFile"}}function $j(r){return typeof r=="object"&&r!==null&&"enabled"in r&&"placement"in r}function xc(r){if($j(r)){let e=r.placement??"replaceSelection",t=Pj(r.destination),n=Ij(r.linkType,e,t);return{enabled:r.enabled,placement:e,requireActiveFile:r.requireActiveFile??!0,linkType:n,displayText:Fj(r.displayText,e,t,n),destination:t,frontmatterProperty:r.frontmatterProperty,frontmatterHandling:id(e)?r.frontmatterHandling??nd:r.frontmatterHandling}}return{enabled:r,placement:"replaceSelection",requireActiveFile:!!r,linkType:"link",displayText:"none",destination:{type:"activeFile"}}}var nd,Aj,Dj,od=k(()=>{nd="alwaysAppend",Aj=new Set(["replaceSelection","afterSelection","endOfLine","newLine"]);Dj=new Set(["replaceSelection","afterSelection"])});function Mj(r){return r.vault.getConfig?.("useMarkdownLinks")===!0}function Oj(r,e){let t=e.replace(/\s+/g,n=>/[\r\n]/.test(n)?" ":n).trim();if(t){if(Mj(r))return t.replace(/\\/g,"\\\\").replace(/\[/g,"\\[").replace(/\]/g,"\\]");if(!(t.includes("]]")||t.includes("[[")||t.endsWith("]")))return t}}function Rj(r){return`[[${r.path.replace(/\.md$/i,"")}]]`}function Hw(r,e,t={}){let n=t.sourcePath??"";if(t.linkType==="embed"&&(!t.placement||Vp(t.placement)))return`![[${r.metadataCache.fileToLinktext(e,n)}]]`;let o=t.alias===void 0?void 0:Oj(r,t.alias);return o===void 0?r.fileManager.generateMarkdownLink(e,n):r.fileManager.generateMarkdownLink(e,n,void 0,o)}function Ok(r){let e=r.trim().replace(/^\/+/,"");return e?/\.md$/i.test(e)?e:`${e}.md`:""}function vg(r,e){if(e.type!=="specifiedFile")return null;let t=Ok(e.path);if(!t)return null;let n=r.vault.getAbstractFileByPath(t);return!(n instanceof gg.TFile)||n.extension!=="md"?null:n}function Lj(r,e){return r.length===0?e:r.endsWith(` `)?`${r}${e}`:`${r} ${e}`}async function Ww(r,e,t){let n=t.destination;if(n?.type!=="specifiedFile")return!1;let i=vg(r,n);if(!i)throw new Error(`Append link target file not found or is not a Markdown file: ${n.path}`);let o=Hw(r,e,{sourcePath:i.path,linkType:"link"});return await r.vault.process(i,s=>Lj(s,o)),!0}async function Nj(r){let e=window.navigator?.clipboard;if(!e?.writeText)return P.logMessage("QuickAdd: Clipboard API is unavailable."),!1;try{return await e.writeText(r),!0}catch(t){return P.logMessage(`QuickAdd: Could not copy link to clipboard: ${t instanceof Error?t.message:String(t)}`),!1}}async function jw(r){let e=Rj(r);return await Nj(e)?(new gg.Notice(`Copied link to '${r.basename}' to clipboard.`,FO),!0):(new gg.Notice(`Created '${r.basename}', but QuickAdd could not copy its link to the clipboard.`,FO),!1)}var gg,FO,yg=k(()=>{gg=require("obsidian");De();od();FO=4e3});function mo(r){if(r.nodeType===Node.DOCUMENT_NODE)return r;let e=r.ownerDocument;if(!e)throw new Error("Unable to resolve owner document for DOM node.");return e}function sd(r){let e=mo(r).defaultView;if(!e)throw new Error("Unable to resolve owner window for DOM node.");return e}function nr(r,e){return mo(r).createElement(e)}function bg(r,e){return mo(r).createTextNode(e)}var Is=k(()=>{});function Gw(r){for(let e of r.workspace.getLeavesOfType("markdown")){let t=e.view;if(!(!t.containerEl||!t.file||t.file.extension!=="md"))try{let n=mo(t.containerEl).activeElement;if(!n||!t.containerEl.contains(n)||!n.closest(".metadata-property-value")||n.matches(Bj))continue;let o=n.closest(".metadata-property")?.getAttribute("data-property-key");if(!o)continue;return{file:t.file,key:o}}catch{continue}}return null}function Vj(r,e,t){let n=e.trim();if(!n)throw new Error("Cannot append link to an empty frontmatter property key.");let i=OO(r,n),o=r[i];if(Array.isArray(o)){o.push(t);return}if(o==null||o===""){r[i]=t;return}if(typeof o=="string"){r[i]=`${o} ${t}`;return}throw new Error(`Cannot append link to frontmatter property '${i}' because it contains a ${typeof o} value.`)}function MO(r,e,t,n=nd){let i=e.trim();if(!i)throw new Error("Cannot append link to an empty frontmatter property key.");let o=OO(r,i),s=r[o];if(Array.isArray(s)){s.push(t);return}if(s===null||s===""){r[o]=[t];return}if(s===void 0){if(n==="error")throw new Error(`Cannot append link to frontmatter property '${o}' because it does not exist.`);r[o]=[t];return}if(typeof s=="object")throw new Error(`Cannot append link to frontmatter property '${o}' because it contains an object value.`);if(n!=="alwaysAppend")throw new Error(`Cannot append link to frontmatter property '${o}' because it is not a list and the link-handling mode is '${PO[n]}'. Choose '${PO.alwaysAppend}' to convert it into a list and append.`);r[o]=[s,t]}function OO(r,e){let t=$O(e),n=Object.keys(r).filter(i=>$O(i)===t);if(n.length>1)throw new Error(`Cannot append link to frontmatter property '${e}' because the note has multiple properties that normalize to that key.`);return n[0]??e}function $O(r){return r.trim().toLowerCase()}async function Yw(r,e,t){let n=r.fileManager.generateMarkdownLink(t,e.file.path);try{return await r.fileManager.processFrontMatter(e.file,i=>{Vj(i,e.key,n)}),!0}catch(i){return P.logError(`QuickAdd: created the file but could not append the link to frontmatter property '${e.key}' in '${e.file.path}': ${i instanceof Error?i.message:String(i)}`),!1}}var PO,Bj,qp=k(()=>{De();od();Is();PO={alwaysAppend:"Create or convert",createProperty:"Create if missing",error:"Require list"},Bj=['input[type="number"]','input[type="date"]','input[type="datetime-local"]','input[type="time"]','input[type="month"]','input[type="checkbox"]'].join(", ")});function wg(r,e){let t=ln(r);return t?.file?.path===e.path?t:null}function Rk(r,e){try{let t=ln(e);return t?(t.editor.replaceSelection(r),!0):(P.logError(`unable to append '${r}' to current line.`),!1)}catch{return P.logError(`unable to append '${r}' to current line.`),!1}}function Lk(r,e,t){try{let n=ln(t);if(!n)return P.logError(`unable to insert '${r}' on new line ${e}.`),!1;let i=n.editor,s=i.getCursor().line,a=r.split(` `),l=a.length,c=a[l-1]?.length??0;if(e==="above")i.replaceRange(r+` `,{line:s,ch:0}),i.setCursor({line:s+l-1,ch:c});else{let u=i.getLine(s);i.replaceRange(` `+r,{line:s,ch:u.length}),i.setCursor({line:s+l,ch:c})}return!0}catch{return P.logError(`unable to insert '${r}' on new line ${e}.`),!1}}function Nk(r,e){return Lk(r,"above",e)}function Bk(r,e){return Lk(r,"below",e)}function qj(r,e,t,n){let i=l=>r.posToOffset(l),o=e.map(l=>{let[c,u]=i(l.anchor)<=i(l.head)?[l.anchor,l.head]:[l.head,l.anchor];return{from:c,to:u,text:n(r.getRange(c,u))}}).sort((l,c)=>i(l.from)-i(c.from)),s=o.map(({from:l,to:c,text:u})=>t==="replaceSelection"?{from:l,to:c,text:u}:{from:c,text:u}),a=[];if(t==="replaceSelection"){let l=0;for(let{from:c,to:u,text:d}of o)a.push(i(c)+l+d.length),l+=d.length-(i(u)-i(c))}r.transaction({changes:s}),t==="replaceSelection"&&r.setSelections(a.map(l=>({anchor:r.offsetToPos(l)})))}async function RO(r,e,t="replaceSelection",n={}){let{requireActiveView:i=!0,frontmatterProperty:o,frontmatterHandling:s=nd,textForSelection:a}=n,l=r.workspace.getActiveViewOfType(Kw.MarkdownView);if(!l){let p="Cannot append link because no active Markdown view is available.";if(i)throw new Error(p);P.logMessage(p);return}if(t==="inFrontmatter"){let p=l.file;if(!p)throw new Error("Cannot append link because the active Markdown view has no file.");await r.fileManager.processFrontMatter(p,m=>{MO(m,o??"",e,s)});return}let c=l.editor;if(!c){let p="Cannot append link because the active Markdown view has no editor.";if(i)throw new Error(p);P.logMessage(p);return}let u=c.listSelections().map(p=>({anchor:{...p.anchor},head:{...p.head}}));if(a&&u.length>0&&(t==="replaceSelection"||t==="afterSelection")){qj(c,u,t,a);return}if(t==="replaceSelection"){c.replaceSelection(e);return}let d=({line:p,ch:m})=>c.posToOffset({line:p,ch:m}),f=u.sort((p,m)=>d(m.head)-d(p.head));for(let p of f){let m=d(p.anchor)>d(p.head)?p.anchor:p.head;switch(t){case"afterSelection":{c.replaceRange(e,m);break}case"endOfLine":{let v=c.getLine(m.line),g={line:m.line,ch:v.length};c.replaceRange(e,g);break}case"newLine":{let v=c.getLine(m.line),g={line:m.line,ch:v.length},w=v.length===0?"":` `;c.replaceRange(w+e,g);break}}}}async function ad(r,e,t){if(!t?.enabled)return!1;let n=xc(t),i=r.workspace.getActiveViewOfType(Kw.MarkdownView),o=n.placement!=="inFrontmatter";if(!i||!i.file||o&&!i.editor){if(t.requireActiveFile)throw new Error("Cannot append link because no active Markdown view is available.");return!1}let s=i.file.path,a=Hw(r,e,{sourcePath:s,linkType:n.linkType,placement:n.placement}),l=n.displayText==="selection"?c=>Hw(r,e,{sourcePath:s,linkType:n.linkType,placement:n.placement,alias:c}):void 0;return await RO(r,a,n.placement,{requireActiveView:!1,frontmatterProperty:n.frontmatterProperty,frontmatterHandling:n.frontmatterHandling,textForSelection:l}),!0}function Vk(r,e,t,n){try{if(e.extension!=="md"||!Number.isSafeInteger(t)||t<0||t>n.length)return!1;let i=r.workspace.getActiveViewOfType(Kw.MarkdownView);if(!i||i.file?.path!==e.path||i.getMode()==="preview")return!1;let o=i.editor;return!o||o.getValue()!==n?!1:(o.setCursor(o.offsetToPos(t)),!0)}catch{return P.logMessage(`Unable to place cursor after capture in '${e.path}'.`),!1}}var Kw,LO=k(()=>{Kw=require("obsidian");wa();De();od();yg();qp()});function Qw(r){return Ht.test(r)||Cr.test(r)||li.test(r)}function Mi(r,e){let t=e.trim().replace(/^\/+/,"");if(!t)return null;let n=Qw(t)?t:`${t}.md`,i=r.vault.getAbstractFileByPath(n);return i instanceof NO.TFile?i:null}function ui(r){if(!Array.isArray(r))return[];let e=new Set,t=[];for(let n of r){if(typeof n!="string")continue;let i=n.trim().replace(/^\/+/,"").replace(/\/+$/,"");!i||e.has(i)||(e.add(i),t.push(i))}return t}function qk(r,e){return e.length===0?!0:e.some(t=>r===t||r.startsWith(`${t}/`))}var NO,Xw=k(()=>{NO=require("obsidian");Je()});function VO(r){if(!r)return!1;let e=r,t=e.getViewState?.();return!!e.pinned||!!t?.pinned||!!t?.state?.pinned}function Cg(r){let e=r.workspace;return(e.rootSplit?e.getMostRecentLeaf?.(e.rootSplit):null)??e.getMostRecentLeaf?.()??null}function Uj(r){let e=[];return r.workspace.iterateRootLeaves(t=>{e.includes(t)||e.push(t)}),e}function BO(r){return r.parent?.id??r.parent??null}function zj(r,e){let t=BO(e),n=r.filter(s=>s===e||VO(s)?!1:t===null||BO(s)!==t);if(n.length===0)return null;let i=r.indexOf(e);return(i===-1?r:[...r.slice(i+1),...r.slice(0,i)]).find(s=>n.includes(s))??n[0]}function Hj(r){return r instanceof Up.TFile?!0:typeof r=="object"&&r!==null&&"path"in r&&typeof r.path=="string"&&"extension"in r&&typeof r.extension=="string"}function Wj(r,e,t,n){if(n&&(e==="tab"||e==="reuse")&&VO(n))return zj(Uj(r),n)??r.workspace.getLeaf("tab");switch(e){case"reuse":return r.workspace.getLeaf(!1);case"tab":return r.workspace.getLeaf("tab");case"split":return r.workspace.getLeaf("split",t);case"window":return r.workspace.getLeaf("window");case"left-sidebar":return r.workspace.getLeftLeaf(!0);case"right-sidebar":return r.workspace.getRightLeaf(!0);default:return r.workspace.getLeaf("tab")}}async function gl(r,e,t={}){let{location:n="tab",direction:i="vertical",mode:o,focus:s=!0,eState:a,originLeaf:l}=t,c=typeof e=="string"?r.vault.getAbstractFileByPath(e):e;if(!Hj(c)){let f=typeof e=="string"?e:e.path;throw new Error(`File not found: ${f}`)}let u=l??Cg(r),d=Wj(r,n,i,u);if(!d)throw new Error("Could not obtain a workspace leaf.");if(await d.openFile(c),o&&o!=="default"&&!(typeof o=="object"&&o.mode==="default")){let f=d.getViewState(),p={...f.state??{}};o==="preview"||typeof o=="object"&&o.mode==="preview"?(p.mode="preview",delete p.source):o==="source"?(p.mode="source",p.source=!0):o==="live"||o==="live-preview"?(p.mode="source",p.source=!1):typeof o=="object"&&o.mode==="source"&&(p.mode="source",p.source=o.source),await d.setViewState({...f,state:{...p,...a}})}return s&&r.workspace.setActiveLeaf(d,{focus:!0}),d}function Uk(r){return(0,Up.normalizePath)(r).replace(/\/{2,}/g,"/").replace(/^\/+/,"")}function qO(r,e){return Uk(r)===Uk(e)}function ld(r,e,t=!0){let n;return r.workspace.iterateRootLeaves(i=>{let o=i.view;if(o instanceof Up.FileView&&o.file&&(o.file===e||qO(e.path,o.file.path))){n=i;return}}),n!==void 0?(t&&r.workspace.setActiveLeaf(n,{focus:!0}),n):null}var Up,UO=k(()=>{Up=require("obsidian")});function vl(r){let e=0,t=0,n=!1,i=0,o=0,s=0;for(;e<=r.length;){let a=r.indexOf(` `,e),l=a===-1?r.length:a,c=r.slice(e,l).replace(/\r$/,""),u=a===-1?r.length+1:a+1,d=jj.exec(c);if(n){if(d&&d[1].length>=i&&d[2].trim().length===0)return zO(r.slice(o,e),s)}else if(d){let f=d[2].trim().split(/\s+/)[0]?.toLowerCase();(f==="js"||f==="javascript")&&(n=!0,i=d[1].length,o=u,s=t+1)}if(e=u,t++,a===-1)break}return n?zO(r.slice(o),s):{code:null,error:Gj}}function zO(r,e){return r.trim().length===0?{code:"",error:Yj}:{code:` `.repeat(e)+r}}var jj,Gj,Yj,Eg=k(()=>{jj=/^ {0,3}(`{3,})(.*)$/,Gj="No ```js (or ```javascript) code block found in the note.",Yj="The ```js code block is empty."});function HO(r){return r instanceof Zw}function Qj(r){return r.charCodeAt(0)===65279?r.slice(1):r}function Xj(r){return Qj(r).trimStart().slice(0,Kj).toLowerCase()}function Zj(r){return/^<(?:!doctype\s+html|html\b|head\b|body\b|script\b|meta\b|title\b|div\b)/.test(Xj(r))}function zk(r,e){let t=new Zw(r);throw e.reportLoadErrors!==!1&&We(t),t}function Jj(r){return`QuickAdd could not load ${r}. This file looks like a saved webpage, not a JavaScript file. Open the script on GitHub, use the Raw button, then download the .js file and select that file in QuickAdd.`}function eG(r){return`QuickAdd loaded ${r}, but its default export is not a function. Change it to module.exports = async (params) => { ... } or exports.default = async (params) => { ... }. If you meant to export several functions, use module.exports = { run } and select Script::run.`}function tG(r,e){let t=e?`the required module "${e}"`:"a required module";return`QuickAdd could not load ${r} because it could not find ${t}. Check that the required file or package exists, and that the capitalization in require(...) matches the file name exactly.`}function rG(r){return WO(r)?(r instanceof Error?r.message:String(r)).match(/Cannot find module ['"]([^'"]+)['"]/)?.[1]:void 0}function WO(r){return!r||typeof r!="object"?!1:r.code==="MODULE_NOT_FOUND"?!0:(r instanceof Error?r.message:String(r)).includes("Cannot find module")}function nG(r){return r!==null&&typeof r=="object"}function iG(r){return typeof r.entry=="function"?!0:Object.entries(r).some(([e,t])=>e!=="settings"&&e!=="quickadd"&&typeof t=="function")}function oG(r){return typeof r=="function"?!0:nG(r)?iG(r):!1}function cd(r){let e=r.split("::").map(t=>t.trim()).filter(Boolean);return{basename:e[0],memberAccess:e.slice(1)}}function eC(r){let e=r.path??r.id;if(e===void 0)return;let{memberAccess:t}=cd(r.name??"");return t&&t.length>0?`${e}::${t.join("::")}`:e}async function Fs(r,e,t={}){let n=e.vault.getAbstractFileByPath(r.path);if(!n){P.logError(`failed to load file ${r.path}.`);return}if(n instanceof Jw.TFile){let i=m=>window.require&&window.require(m),o={},s={exports:o},a=await e.vault.read(n),l=a;if(Ht.test(n.path)){let{code:m,error:v}=vl(a);if(m===null||m.length===0){t.reportLoadErrors!==!1&&new Jw.Notice(`QuickAdd: ${v} (${r.path})`);return}l=m}Zj(l)&&zk(Jj(r.path),t);try{new Function("require","module","exports",l)(i,s,o)}catch(m){throw WO(m)&&zk(tG(r.path,rG(m)),t),m}let c=o.default||s.exports;if(!c)return;let u=c,d=!!o.default,{memberAccess:f}=cd(r.name),p=!!(f&&f.length>0);if(f&&f.length>0){let m;for(;m=f.shift();)u=u[m]}return d&&!p&&!oG(u)&&zk(eG(r.path),t),u}}var Jw,Kj,Zw,tC=k(()=>{Jw=require("obsidian");Je();De();Eg();rr();Kj=1024,Zw=class extends Error{constructor(e){super(e),this.name="UserScriptLoadError"}}});function yl(r){if(r==null||typeof r!="string"&&typeof r!="number"&&typeof r!="boolean")return"";let e=String(r).trim();return e.startsWith("#")?e.substring(1).trim():e}function Tc(r){return r==null?[]:(Array.isArray(r)?r:typeof r=="string"?r.split(/,|\s+/):[r]).map(yl).filter(Boolean)}var rC=k(()=>{});var di,ud=k(()=>{rC();di=class{static filterFiles(e,t,n){let i=e;return i=this.applyInclusionFilters(i,t,n),i=this.applyExclusionFilters(i,t,n),i}static applyInclusionFilters(e,t,n){let i=!1,o=e,s=this.getIncludeFolders(t);return s.length>0&&(i=!0,o=o.filter(a=>s.some(l=>this.matchesFolder(a,l)))),t.tags&&t.tags.length>0&&(i=!0,o=o.filter(a=>this.matchesAllTags(a,t.tags??[],n))),i?o:e}static applyExclusionFilters(e,t,n){return e.filter(i=>!(t.excludeFolders&&t.excludeFolders.length>0&&t.excludeFolders.some(o=>this.matchesFolder(i,o))||t.excludeTags&&t.excludeTags.length>0&&this.matchesAnyTag(i,t.excludeTags,n)||t.excludeFiles&&t.excludeFiles.length>0&&t.excludeFiles.some(o=>this.matchesFile(i,o))))}static getIncludeFolders(e){let t=e.folders?.length?e.folders:e.folder?[e.folder]:[];return[...new Set(t.map(n=>this.normalizePath(n)).filter(Boolean))]}static matchesFolder(e,t){let n=this.normalizePath(t),i=this.normalizePath(e.path);return i.startsWith(n+"/")||i.substring(0,i.lastIndexOf("/"))===n}static matchesAllTags(e,t,n){return this.matchesTags(e,t,n,"all")}static matchesAnyTag(e,t,n){return this.matchesTags(e,t,n,"any")}static matchesTags(e,t,n,i){let o=n(e);if(!o)return!1;let s=this.getAllTags(o),a=t.map(c=>this.normalizeTag(c)).filter(Boolean),l=c=>s.some(u=>u===c||u.startsWith(c+"/"));return i==="all"?a.every(l):a.some(l)}static matchesFile(e,t){return e.name===t||e.path===t}static getAllTags(e){let t=[];return e.frontmatter?.tags&&t.push(...Tc(e.frontmatter.tags)),e.frontmatter?.tag&&t.push(...Tc(e.frontmatter.tag)),e.tags&&t.push(...e.tags.map(n=>yl(n.tag))),t.filter(Boolean)}static normalizeTag(e){return yl(e)}static normalizePath(e){return e.replace(/^\/+|\/+$/g,"")}}});function Go(r){return r.vault.getAllLoadedFiles().filter(e=>e instanceof Hk.TFolder).map(e=>e.path)}function zp(r,e){let t=r.vault.getAbstractFileByPath(e);return!!t&&t instanceof Hk.TFolder}function ho(r,e){let t=e.replace(/\/+$/,"");if(t==="")return r.vault.getMarkdownFiles();let n=`${t}/`;return r.vault.getMarkdownFiles().filter(i=>i.path===t||i.path.startsWith(n))}function sG(r){let e=r.frontmatter;if(!e)return[];let t=Object.entries(e);if(!t.length)return[];let n=t.filter(([o,s])=>{let a=o.toLowerCase();return a==="tags"||a==="tag"});return n?n.flatMap(([,o])=>Tc(o)).filter(o=>!!o):[]}function aG(r,e){let t=r.metadataCache.getFileCache(e);if(!t)return[];let n=[];return t.frontmatter&&n.push(...sG(t)),t.tags&&Array.isArray(t.tags)&&n.push(...t.tags.map(i=>yl(i.tag))),n}function xg(r,e){let t=e.replace(/^#/,"");return r.vault.getMarkdownFiles().filter(n=>aG(r,n).includes(t))}function Hp(r,e){return di.filterFiles(r.vault.getMarkdownFiles(),e,t=>r.metadataCache.getFileCache(t))}function lG(r,e){let t=e.trim().toLowerCase();return r==null?!1:Array.isArray(r)?r.some(n=>n!=null&&typeof n!="object"&&String(n).trim().toLowerCase()===t):typeof r=="object"?!1:String(r).trim().toLowerCase()===t}function Wp(r,e,t,n){let i=e.trim().toLowerCase();if(!i)return[];let o=r.vault.getMarkdownFiles().filter(a=>{let l=r.metadataCache.getFileCache(a)?.frontmatter;if(!l)return!1;let c=Object.entries(l).find(([u])=>u.toLowerCase()===i);return c?t===void 0?!0:lG(c[1],t):!1});return n&&(n.folder||n.tags?.length||n.excludeFolders?.length||n.excludeTags?.length||n.excludeFiles?.length)&&(o=di.filterFiles(o,n,a=>r.metadataCache.getFileCache(a))),o}var Hk,jO=k(()=>{Hk=require("obsidian");ud();rC()});function GO(r,e){return r.commands.findCommand(e)}function nC(r,e){GO(r,e)&&(delete r.commands.commands[e],delete r.commands.editorCommands[e])}var YO=k(()=>{});function Yo(r){return r.split("|")}function KO(r){return r.startsWith("|")?r.slice(1):r}function Oi(r){let e=r.indexOf(":");if(e===-1)return null;let t=r.slice(0,e).trim().toLowerCase();if(!t)return null;let n=r.slice(e+1).trim();return{key:t,value:n}}function Sc(r){if(!r)return!0;let e=r.trim().toLowerCase();return!["false","no","0","off"].includes(e)}function Ps(r,e){let t=!1;return{remaining:r.filter(i=>i.trim().toLowerCase()===e?(t=!0,!1):!0),found:t}}var dd=k(()=>{});function iC(r){let e=r.trim().toLowerCase(),t=cG[e];if(!t)throw new Error(`Unknown date unit "${r.trim()}". Valid units: ${uG}.`);return t}function Wk(r){let e=Oi(r);return e?e.key==="startof"?{boundary:"start",unit:iC(e.value)}:e.key==="endof"?{boundary:"end",unit:iC(e.value)}:null:null}function jp(r,e){return e?e.boundary==="start"?r.startOf(e.unit):r.endOf(e.unit):r}var cG,uG,Tg=k(()=>{dd();cG={year:"year",years:"year",y:"year",quarter:"quarter",quarters:"quarter",q:"quarter",month:"month",months:"month",week:"week",weeks:"week",w:"week",isoweek:"isoWeek",isoweeks:"isoWeek",day:"day",days:"day",d:"day"},uG="year, quarter, month, week, isoweek, day"});function dG(r){return r===void 0?window.moment():window.moment(r)}function pG(r){let e=dG(r?.now);return r?.origin?window.moment(r.origin).hour(e.hour()).minute(e.minute()).second(e.second()).millisecond(e.millisecond()):e}function Ko(r){let e;return r?.offset!==null&&r?.offset!==void 0&&typeof r.offset=="number"&&(e=window.moment.duration(r.offset,"days")),jp(pG(r).add(e),r?.snap).format(r?.format??"YYYY-MM-DD")}var QO=k(()=>{Tg()});var Dt=k(()=>{DO();LO();Xw();UO();tC();jO();YO();QO()});var xr,cn,Ur,Fr,oC,kc,bl,pd,XO,sC,Gp,ZO,jk,aC,fG,mG,hG,gG,vG,yG,bG,wG,CG,JO,go=k(()=>{xr="top",cn="bottom",Ur="right",Fr="left",oC="auto",kc=[xr,cn,Ur,Fr],bl="start",pd="end",XO="clippingParents",sC="viewport",Gp="popper",ZO="reference",jk=kc.reduce(function(r,e){return r.concat([e+"-"+bl,e+"-"+pd])},[]),aC=[].concat(kc,[oC]).reduce(function(r,e){return r.concat([e,e+"-"+bl,e+"-"+pd])},[]),fG="beforeRead",mG="read",hG="afterRead",gG="beforeMain",vG="main",yG="afterMain",bG="beforeWrite",wG="write",CG="afterWrite",JO=[fG,mG,hG,gG,vG,yG,bG,wG,CG]});function Sn(r){return r?(r.nodeName||"").toLowerCase():null}var Ac=k(()=>{});function pr(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var e=r.ownerDocument;return e&&e.defaultView||window}return r}var $s=k(()=>{});function Qo(r){var e=pr(r).Element;return r instanceof e||r instanceof Element}function un(r){var e=pr(r).HTMLElement;return r instanceof e||r instanceof HTMLElement}function Yp(r){if(typeof ShadowRoot>"u")return!1;var e=pr(r).ShadowRoot;return r instanceof e||r instanceof ShadowRoot}var vo=k(()=>{$s()});function EG(r){var e=r.state;Object.keys(e.elements).forEach(function(t){var n=e.styles[t]||{},i=e.attributes[t]||{},o=e.elements[t];!un(o)||!Sn(o)||(Object.assign(o.style,n),Object.keys(i).forEach(function(s){var a=i[s];a===!1?o.removeAttribute(s):o.setAttribute(s,a===!0?"":a)}))})}function xG(r){var e=r.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(n){var i=e.elements[n],o=e.attributes[n]||{},s=Object.keys(e.styles.hasOwnProperty(n)?e.styles[n]:t[n]),a=s.reduce(function(l,c){return l[c]="",l},{});!un(i)||!Sn(i)||(Object.assign(i.style,a),Object.keys(o).forEach(function(l){i.removeAttribute(l)}))})}}var eR,tR=k(()=>{Ac();vo();eR={name:"applyStyles",enabled:!0,phase:"write",fn:EG,effect:xG,requires:["computeStyles"]}});function _n(r){return r.split("-")[0]}var Dc=k(()=>{});var Ms,fd,wl,Ic=k(()=>{Ms=Math.max,fd=Math.min,wl=Math.round});function Kp(){var r=navigator.userAgentData;return r!=null&&r.brands&&Array.isArray(r.brands)?r.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}var Gk=k(()=>{});function Sg(){return!/^((?!chrome|android).)*safari/i.test(Kp())}var Yk=k(()=>{Gk()});function Xo(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var n=r.getBoundingClientRect(),i=1,o=1;e&&un(r)&&(i=r.offsetWidth>0&&wl(n.width)/r.offsetWidth||1,o=r.offsetHeight>0&&wl(n.height)/r.offsetHeight||1);var s=Qo(r)?pr(r):window,a=s.visualViewport,l=!Sg()&&t,c=(n.left+(l&&a?a.offsetLeft:0))/i,u=(n.top+(l&&a?a.offsetTop:0))/o,d=n.width/i,f=n.height/o;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c,x:c,y:u}}var Qp=k(()=>{vo();Ic();$s();Yk()});function md(r){var e=Xo(r),t=r.offsetWidth,n=r.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:r.offsetLeft,y:r.offsetTop,width:t,height:n}}var lC=k(()=>{Qp()});function _g(r,e){var t=e.getRootNode&&e.getRootNode();if(r.contains(e))return!0;if(t&&Yp(t)){var n=e;do{if(n&&r.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}var Kk=k(()=>{vo()});function Ri(r){return pr(r).getComputedStyle(r)}var Xp=k(()=>{$s()});function Qk(r){return["table","td","th"].indexOf(Sn(r))>=0}var rR=k(()=>{Ac()});function Un(r){return((Qo(r)?r.ownerDocument:r.document)||window.document).documentElement}var Cl=k(()=>{vo()});function El(r){return Sn(r)==="html"?r:r.assignedSlot||r.parentNode||(Yp(r)?r.host:null)||Un(r)}var kg=k(()=>{Ac();Cl();vo()});function nR(r){return!un(r)||Ri(r).position==="fixed"?null:r.offsetParent}function TG(r){var e=/firefox/i.test(Kp()),t=/Trident/i.test(Kp());if(t&&un(r)){var n=Ri(r);if(n.position==="fixed")return null}var i=El(r);for(Yp(i)&&(i=i.host);un(i)&&["html","body"].indexOf(Sn(i))<0;){var o=Ri(i);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||e&&o.willChange==="filter"||e&&o.filter&&o.filter!=="none")return i;i=i.parentNode}return null}function Os(r){for(var e=pr(r),t=nR(r);t&&Qk(t)&&Ri(t).position==="static";)t=nR(t);return t&&(Sn(t)==="html"||Sn(t)==="body"&&Ri(t).position==="static")?e:t||TG(r)||e}var Zp=k(()=>{$s();Ac();Xp();vo();rR();kg();Gk()});function hd(r){return["top","bottom"].indexOf(r)>=0?"x":"y"}var cC=k(()=>{});function gd(r,e,t){return Ms(r,fd(e,t))}function iR(r,e,t){var n=gd(r,e,t);return n>t?t:n}var Xk=k(()=>{Ic()});function Ag(){return{top:0,right:0,bottom:0,left:0}}var Zk=k(()=>{});function Dg(r){return Object.assign({},Ag(),r)}var Jk=k(()=>{Zk()});function Ig(r,e){return e.reduce(function(t,n){return t[n]=r,t},{})}var eA=k(()=>{});function _G(r){var e,t=r.state,n=r.name,i=r.options,o=t.elements.arrow,s=t.modifiersData.popperOffsets,a=_n(t.placement),l=hd(a),c=[Fr,Ur].indexOf(a)>=0,u=c?"height":"width";if(!(!o||!s)){var d=SG(i.padding,t),f=md(o),p=l==="y"?xr:Fr,m=l==="y"?cn:Ur,v=t.rects.reference[u]+t.rects.reference[l]-s[l]-t.rects.popper[u],g=s[l]-t.rects.reference[l],y=Os(o),w=y?l==="y"?y.clientHeight||0:y.clientWidth||0:0,T=v/2-g/2,b=d[p],E=w-f[u]-d[m],C=w/2-f[u]/2+T,_=gd(b,C,E),I=l;t.modifiersData[n]=(e={},e[I]=_,e.centerOffset=_-C,e)}}function kG(r){var e=r.state,t=r.options,n=t.element,i=n===void 0?"[data-popper-arrow]":n;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||_g(e.elements.popper,i)&&(e.elements.arrow=i))}var SG,oR,sR=k(()=>{Dc();lC();Kk();Zp();cC();Xk();Jk();eA();go();SG=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Dg(typeof e!="number"?e:Ig(e,kc))};oR={name:"arrow",enabled:!0,phase:"main",fn:_G,effect:kG,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]}});function Zo(r){return r.split("-")[1]}var Jp=k(()=>{});function DG(r,e){var t=r.x,n=r.y,i=e.devicePixelRatio||1;return{x:wl(t*i)/i||0,y:wl(n*i)/i||0}}function aR(r){var e,t=r.popper,n=r.popperRect,i=r.placement,o=r.variation,s=r.offsets,a=r.position,l=r.gpuAcceleration,c=r.adaptive,u=r.roundOffsets,d=r.isFixed,f=s.x,p=f===void 0?0:f,m=s.y,v=m===void 0?0:m,g=typeof u=="function"?u({x:p,y:v}):{x:p,y:v};p=g.x,v=g.y;var y=s.hasOwnProperty("x"),w=s.hasOwnProperty("y"),T=Fr,b=xr,E=window;if(c){var C=Os(t),_="clientHeight",I="clientWidth";if(C===pr(t)&&(C=Un(t),Ri(C).position!=="static"&&a==="absolute"&&(_="scrollHeight",I="scrollWidth")),C=C,i===xr||(i===Fr||i===Ur)&&o===pd){b=cn;var q=d&&C===E&&E.visualViewport?E.visualViewport.height:C[_];v-=q-n.height,v*=l?1:-1}if(i===Fr||(i===xr||i===cn)&&o===pd){T=Ur;var B=d&&C===E&&E.visualViewport?E.visualViewport.width:C[I];p-=B-n.width,p*=l?1:-1}}var J=Object.assign({position:a},c&&AG),re=u===!0?DG({x:p,y:v},pr(t)):{x:p,y:v};if(p=re.x,v=re.y,l){var L;return Object.assign({},J,(L={},L[b]=w?"0":"",L[T]=y?"0":"",L.transform=(E.devicePixelRatio||1)<=1?"translate("+p+"px, "+v+"px)":"translate3d("+p+"px, "+v+"px, 0)",L))}return Object.assign({},J,(e={},e[b]=w?v+"px":"",e[T]=y?p+"px":"",e.transform="",e))}function IG(r){var e=r.state,t=r.options,n=t.gpuAcceleration,i=n===void 0?!0:n,o=t.adaptive,s=o===void 0?!0:o,a=t.roundOffsets,l=a===void 0?!0:a,c={placement:_n(e.placement),variation:Zo(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,aR(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,aR(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var AG,lR,cR=k(()=>{go();Zp();$s();Cl();Xp();Dc();Jp();Ic();AG={top:"auto",right:"auto",bottom:"auto",left:"auto"};lR={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:IG,data:{}}});function FG(r){var e=r.state,t=r.instance,n=r.options,i=n.scroll,o=i===void 0?!0:i,s=n.resize,a=s===void 0?!0:s,l=pr(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&c.forEach(function(u){u.addEventListener("scroll",t.update,uC)}),a&&l.addEventListener("resize",t.update,uC),function(){o&&c.forEach(function(u){u.removeEventListener("scroll",t.update,uC)}),a&&l.removeEventListener("resize",t.update,uC)}}var uC,uR,dR=k(()=>{$s();uC={passive:!0};uR={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:FG,data:{}}});function ef(r){return r.replace(/left|right|bottom|top/g,function(e){return PG[e]})}var PG,pR=k(()=>{PG={left:"right",right:"left",bottom:"top",top:"bottom"}});function dC(r){return r.replace(/start|end/g,function(e){return $G[e]})}var $G,fR=k(()=>{$G={start:"end",end:"start"}});function vd(r){var e=pr(r),t=e.pageXOffset,n=e.pageYOffset;return{scrollLeft:t,scrollTop:n}}var pC=k(()=>{$s()});function yd(r){return Xo(Un(r)).left+vd(r).scrollLeft}var fC=k(()=>{Qp();Cl();pC()});function tA(r,e){var t=pr(r),n=Un(r),i=t.visualViewport,o=n.clientWidth,s=n.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;var c=Sg();(c||!c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a+yd(r),y:l}}var mR=k(()=>{$s();Cl();fC();Yk()});function rA(r){var e,t=Un(r),n=vd(r),i=(e=r.ownerDocument)==null?void 0:e.body,o=Ms(t.scrollWidth,t.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=Ms(t.scrollHeight,t.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-n.scrollLeft+yd(r),l=-n.scrollTop;return Ri(i||t).direction==="rtl"&&(a+=Ms(t.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}var hR=k(()=>{Cl();Xp();fC();pC();Ic()});function bd(r){var e=Ri(r),t=e.overflow,n=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+i+n)}var mC=k(()=>{Xp()});function hC(r){return["html","body","#document"].indexOf(Sn(r))>=0?r.ownerDocument.body:un(r)&&bd(r)?r:hC(El(r))}var gR=k(()=>{kg();mC();Ac();vo()});function Fc(r,e){var t;e===void 0&&(e=[]);var n=hC(r),i=n===((t=r.ownerDocument)==null?void 0:t.body),o=pr(n),s=i?[o].concat(o.visualViewport||[],bd(n)?n:[]):n,a=e.concat(s);return i?a:a.concat(Fc(El(s)))}var nA=k(()=>{gR();kg();$s();mC()});function tf(r){return Object.assign({},r,{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height})}var iA=k(()=>{});function MG(r,e){var t=Xo(r,!1,e==="fixed");return t.top=t.top+r.clientTop,t.left=t.left+r.clientLeft,t.bottom=t.top+r.clientHeight,t.right=t.left+r.clientWidth,t.width=r.clientWidth,t.height=r.clientHeight,t.x=t.left,t.y=t.top,t}function vR(r,e,t){return e===sC?tf(tA(r,t)):Qo(e)?MG(e,t):tf(rA(Un(r)))}function OG(r){var e=Fc(El(r)),t=["absolute","fixed"].indexOf(Ri(r).position)>=0,n=t&&un(r)?Os(r):r;return Qo(n)?e.filter(function(i){return Qo(i)&&_g(i,n)&&Sn(i)!=="body"}):[]}function oA(r,e,t,n){var i=e==="clippingParents"?OG(r):[].concat(e),o=[].concat(i,[t]),s=o[0],a=o.reduce(function(l,c){var u=vR(r,c,n);return l.top=Ms(u.top,l.top),l.right=fd(u.right,l.right),l.bottom=fd(u.bottom,l.bottom),l.left=Ms(u.left,l.left),l},vR(r,s,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}var yR=k(()=>{go();mR();hR();nA();Zp();Cl();Xp();vo();Qp();kg();Kk();Ac();iA();Ic()});function Fg(r){var e=r.reference,t=r.element,n=r.placement,i=n?_n(n):null,o=n?Zo(n):null,s=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(i){case xr:l={x:s,y:e.y-t.height};break;case cn:l={x:s,y:e.y+e.height};break;case Ur:l={x:e.x+e.width,y:a};break;case Fr:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var c=i?hd(i):null;if(c!=null){var u=c==="y"?"height":"width";switch(o){case bl:l[c]=l[c]-(e[u]/2-t[u]/2);break;case pd:l[c]=l[c]+(e[u]/2-t[u]/2);break;default:}}return l}var sA=k(()=>{Dc();Jp();cC();go()});function Rs(r,e){e===void 0&&(e={});var t=e,n=t.placement,i=n===void 0?r.placement:n,o=t.strategy,s=o===void 0?r.strategy:o,a=t.boundary,l=a===void 0?XO:a,c=t.rootBoundary,u=c===void 0?sC:c,d=t.elementContext,f=d===void 0?Gp:d,p=t.altBoundary,m=p===void 0?!1:p,v=t.padding,g=v===void 0?0:v,y=Dg(typeof g!="number"?g:Ig(g,kc)),w=f===Gp?ZO:Gp,T=r.rects.popper,b=r.elements[m?w:f],E=oA(Qo(b)?b:b.contextElement||Un(r.elements.popper),l,u,s),C=Xo(r.elements.reference),_=Fg({reference:C,element:T,strategy:"absolute",placement:i}),I=tf(Object.assign({},T,_)),q=f===Gp?I:C,B={top:E.top-q.top+y.top,bottom:q.bottom-E.bottom+y.bottom,left:E.left-q.left+y.left,right:q.right-E.right+y.right},J=r.modifiersData.offset;if(f===Gp&&J){var re=J[i];Object.keys(B).forEach(function(L){var W=[Ur,cn].indexOf(L)>=0?1:-1,j=[xr,cn].indexOf(L)>=0?"y":"x";B[L]+=re[j]*W})}return B}var Pg=k(()=>{yR();Cl();Qp();sA();iA();go();vo();Jk();eA()});function aA(r,e){e===void 0&&(e={});var t=e,n=t.placement,i=t.boundary,o=t.rootBoundary,s=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,c=l===void 0?aC:l,u=Zo(n),d=u?a?jk:jk.filter(function(m){return Zo(m)===u}):kc,f=d.filter(function(m){return c.indexOf(m)>=0});f.length===0&&(f=d);var p=f.reduce(function(m,v){return m[v]=Rs(r,{placement:v,boundary:i,rootBoundary:o,padding:s})[_n(v)],m},{});return Object.keys(p).sort(function(m,v){return p[m]-p[v]})}var bR=k(()=>{Jp();go();Pg();Dc()});function RG(r){if(_n(r)===oC)return[];var e=ef(r);return[dC(r),e,dC(e)]}function LG(r){var e=r.state,t=r.options,n=r.name;if(!e.modifiersData[n]._skip){for(var i=t.mainAxis,o=i===void 0?!0:i,s=t.altAxis,a=s===void 0?!0:s,l=t.fallbackPlacements,c=t.padding,u=t.boundary,d=t.rootBoundary,f=t.altBoundary,p=t.flipVariations,m=p===void 0?!0:p,v=t.allowedAutoPlacements,g=e.options.placement,y=_n(g),w=y===g,T=l||(w||!m?[ef(g)]:RG(g)),b=[g].concat(T).reduce(function(he,Ie){return he.concat(_n(Ie)===oC?aA(e,{placement:Ie,boundary:u,rootBoundary:d,padding:c,flipVariations:m,allowedAutoPlacements:v}):Ie)},[]),E=e.rects.reference,C=e.rects.popper,_=new Map,I=!0,q=b[0],B=0;B=0,j=W?"width":"height",$=Rs(e,{placement:J,boundary:u,rootBoundary:d,altBoundary:f,padding:c}),G=W?L?Ur:Fr:L?cn:xr;E[j]>C[j]&&(G=ef(G));var U=ef(G),H=[];if(o&&H.push($[re]<=0),a&&H.push($[G]<=0,$[U]<=0),H.every(function(he){return he})){q=J,I=!1;break}_.set(J,H)}if(I)for(var Y=m?3:1,ie=function(Ie){var we=b.find(function(Ge){var Pe=_.get(Ge);if(Pe)return Pe.slice(0,Ie).every(function(Ve){return Ve})});if(we)return q=we,"break"},oe=Y;oe>0;oe--){var ce=ie(oe);if(ce==="break")break}e.placement!==q&&(e.modifiersData[n]._skip=!0,e.placement=q,e.reset=!0)}}var wR,CR=k(()=>{pR();Dc();fR();Pg();bR();go();Jp();wR={name:"flip",enabled:!0,phase:"main",fn:LG,requiresIfExists:["offset"],data:{_skip:!1}}});function ER(r,e,t){return t===void 0&&(t={x:0,y:0}),{top:r.top-e.height-t.y,right:r.right-e.width+t.x,bottom:r.bottom-e.height+t.y,left:r.left-e.width-t.x}}function xR(r){return[xr,Ur,cn,Fr].some(function(e){return r[e]>=0})}function NG(r){var e=r.state,t=r.name,n=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=Rs(e,{elementContext:"reference"}),a=Rs(e,{altBoundary:!0}),l=ER(s,n),c=ER(a,i,o),u=xR(l),d=xR(c);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}var TR,SR=k(()=>{go();Pg();TR={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:NG}});function BG(r,e,t){var n=_n(r),i=[Fr,xr].indexOf(n)>=0?-1:1,o=typeof t=="function"?t(Object.assign({},e,{placement:r})):t,s=o[0],a=o[1];return s=s||0,a=(a||0)*i,[Fr,Ur].indexOf(n)>=0?{x:a,y:s}:{x:s,y:a}}function VG(r){var e=r.state,t=r.options,n=r.name,i=t.offset,o=i===void 0?[0,0]:i,s=aC.reduce(function(u,d){return u[d]=BG(d,e.rects,o),u},{}),a=s[e.placement],l=a.x,c=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[n]=s}var _R,kR=k(()=>{Dc();go();_R={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:VG}});function qG(r){var e=r.state,t=r.name;e.modifiersData[t]=Fg({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var AR,DR=k(()=>{sA();AR={name:"popperOffsets",enabled:!0,phase:"read",fn:qG,data:{}}});function lA(r){return r==="x"?"y":"x"}var IR=k(()=>{});function UG(r){var e=r.state,t=r.options,n=r.name,i=t.mainAxis,o=i===void 0?!0:i,s=t.altAxis,a=s===void 0?!1:s,l=t.boundary,c=t.rootBoundary,u=t.altBoundary,d=t.padding,f=t.tether,p=f===void 0?!0:f,m=t.tetherOffset,v=m===void 0?0:m,g=Rs(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),y=_n(e.placement),w=Zo(e.placement),T=!w,b=hd(y),E=lA(b),C=e.modifiersData.popperOffsets,_=e.rects.reference,I=e.rects.popper,q=typeof v=="function"?v(Object.assign({},e.rects,{placement:e.placement})):v,B=typeof q=="number"?{mainAxis:q,altAxis:q}:Object.assign({mainAxis:0,altAxis:0},q),J=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,re={x:0,y:0};if(C){if(o){var L,W=b==="y"?xr:Fr,j=b==="y"?cn:Ur,$=b==="y"?"height":"width",G=C[b],U=G+g[W],H=G-g[j],Y=p?-I[$]/2:0,ie=w===bl?_[$]:I[$],oe=w===bl?-I[$]:-_[$],ce=e.elements.arrow,he=p&&ce?md(ce):{width:0,height:0},Ie=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Ag(),we=Ie[W],Ge=Ie[j],Pe=gd(0,_[$],he[$]),Ve=T?_[$]/2-Y-Pe-we-B.mainAxis:ie-Pe-we-B.mainAxis,qe=T?-_[$]/2+Y+Pe+Ge+B.mainAxis:oe+Pe+Ge+B.mainAxis,et=e.elements.arrow&&Os(e.elements.arrow),_t=et?b==="y"?et.clientTop||0:et.clientLeft||0:0,ye=(L=J?.[b])!=null?L:0,$e=G+Ve-ye-_t,ge=G+qe-ye,xe=gd(p?fd(U,$e):U,G,p?Ms(H,ge):H);C[b]=xe,re[b]=xe-G}if(a){var tt,kt=b==="x"?xr:Fr,Pt=b==="x"?cn:Ur,gt=C[E],Lt=E==="y"?"height":"width",Lr=gt+g[kt],lt=gt-g[Pt],rt=[xr,Fr].indexOf(y)!==-1,cr=(tt=J?.[E])!=null?tt:0,ti=rt?Lr:gt-_[Lt]-I[Lt]-cr+B.altAxis,Fo=rt?gt+_[Lt]+I[Lt]-cr-B.altAxis:lt,vn=p&&rt?iR(ti,gt,Fo):gd(p?ti:Lr,gt,p?Fo:lt);C[E]=vn,re[E]=vn-gt}e.modifiersData[n]=re}}var FR,PR=k(()=>{go();Dc();cC();IR();Xk();lC();Zp();Pg();Jp();Zk();Ic();FR={name:"preventOverflow",enabled:!0,phase:"main",fn:UG,requiresIfExists:["offset"]}});var cA=k(()=>{});function uA(r){return{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}}var $R=k(()=>{});function dA(r){return r===pr(r)||!un(r)?vd(r):uA(r)}var MR=k(()=>{pC();$s();vo();$R()});function zG(r){var e=r.getBoundingClientRect(),t=wl(e.width)/r.offsetWidth||1,n=wl(e.height)/r.offsetHeight||1;return t!==1||n!==1}function pA(r,e,t){t===void 0&&(t=!1);var n=un(e),i=un(e)&&zG(e),o=Un(e),s=Xo(r,i,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(n||!n&&!t)&&((Sn(e)!=="body"||bd(o))&&(a=dA(e)),un(e)?(l=Xo(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):o&&(l.x=yd(o))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}var OR=k(()=>{Qp();MR();Ac();vo();fC();Cl();mC();Ic()});function HG(r){var e=new Map,t=new Set,n=[];r.forEach(function(o){e.set(o.name,o)});function i(o){t.add(o.name);var s=[].concat(o.requires||[],o.requiresIfExists||[]);s.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&i(l)}}),n.push(o)}return r.forEach(function(o){t.has(o.name)||i(o)}),n}function fA(r){var e=HG(r);return JO.reduce(function(t,n){return t.concat(e.filter(function(i){return i.phase===n}))},[])}var RR=k(()=>{go()});function mA(r){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(r())})})),e}}var LR=k(()=>{});function hA(r){var e=r.reduce(function(t,n){var i=t[n.name];return t[n.name]=i?Object.assign({},i,n,{options:Object.assign({},i.options,n.options),data:Object.assign({},i.data,n.data)}):n,t},{});return Object.keys(e).map(function(t){return e[t]})}var NR=k(()=>{});function VR(){for(var r=arguments.length,e=new Array(r),t=0;t{OR();lC();nA();Zp();RR();LR();NR();vo();BR={placement:"bottom",modifiers:[],strategy:"absolute"}});var WG,gA,zR=k(()=>{UR();dR();DR();cR();tR();kR();CR();PR();sR();SR();cA();WG=[uR,AR,lR,eR,_R,wR,FR,oR,TR],gA=qR({defaultModifiers:WG})});var HR=k(()=>{go();cA();zR()});function WR(r,e){return jG.test(r[e])}function GG(r){if(!r.includes("![["))return r;let e="",t=0,n=0,i=0;for(;ne&&r.charCodeAt(t-1)===35){for(;t>e&&r.charCodeAt(t-1)===35;)t--;for(;t>e&&WR(r,t-1);)t--}return r.slice(e,t)}function QG(r){if(!r.includes("[[")&&!r.includes("]]"))return r;let e="",t=0,n=0;for(;n{jG=/^\s$/;XG=/[*_`~]/g});function zr(r){return typeof r=="string"?r:r==null?"":String(r)}function gC(r,e){r.scope?.register(["Mod","Shift"],"Enter",()=>(e(),!1)),typeof r.setInstructions=="function"&&r.setInstructions([{command:"\u2191\u2193",purpose:"to navigate"},{command:"\u21B5",purpose:"to choose"},{command:"ctrl/cmd+shift+\u21B5",purpose:"to skip (leave empty)"},{command:"esc",purpose:"to cancel"}]);let t=r.modalEl;if(t&&typeof t.createDiv=="function"){let i=t.createDiv({cls:"qa-suggester-skip-bar"}).createEl("button",{text:"Skip (leave empty)",cls:"qa-suggester-skip-button"});i.type="button",i.setAttribute("aria-label","Skip and leave empty"),i.addEventListener("click",o=>{o.preventDefault(),e()})}}function wd(r){let e=!1;return t=>{e||(e=!0,P.logWarning(Ju(t,r)))}}function xl(r){return zr(r)}function fr(r){return r.normalize("NFC").toLowerCase()}function $g(r){return r.toLowerCase().endsWith(".md")?r.slice(0,-3):r}function vC(r,e,t,n,i={}){let o=r.value;r.value=o.slice(0,e)+n+o.slice(t),r.setSelectionRange(e+n.length,e+n.length);let s=new Event("input",{bubbles:!0});i.fromCompletion&&(s.fromCompletion=!0),r.dispatchEvent(s)}function GR(r,e,t){if(r.replaceChildren(),!t){r.textContent=e;return}let n="",i=[],o=[],s=0;for(let d of e){let f=d.toLowerCase(),p=s,m=s+d.length;for(let v=0;vd){d>l&&r.append(bg(r,e.slice(l,d)));let p=nr(r,"mark");p.className="qa-highlight",p.textContent=e.slice(d,f),r.append(p),l=f}c=u+a.length,u=n.indexOf(a,c)}l{De();Is();rr();jR()});var yC,ZG,JG,yA,Mg,Hr,Ca=k(()=>{HR();yC=require("obsidian");De();Is();Qi();ZG=(r,e)=>(r%e+e)%e,JG=0,yA=class{constructor(e,t,n,i,o){this.isOpen=!1;this.owner=e,this.containerEl=t,this.optionIdPrefix=i,this.onActiveOptionChange=o,this.clickListener=s=>{let a=this.findSuggestionItem(s.target);a&&this.onSuggestionClick(s,a)},this.mousemoveListener=s=>{let a=this.findSuggestionItem(s.target);a&&this.onSuggestionMouseover(s,a)},t.addEventListener("click",this.clickListener),t.addEventListener("mousemove",this.mousemoveListener),n.register([],"ArrowUp",s=>{if(!s.isComposing&&this.isOpen)return this.setSelectedItem(this.selectedItem-1,!0),!1}),n.register([],"ArrowDown",s=>{if(!s.isComposing&&this.isOpen)return this.setSelectedItem(this.selectedItem+1,!0),!1}),n.register([],"Enter",s=>{if(!s.isComposing&&this.isOpen)return this.useSelectedItem(s),!1}),n.register([],"PageUp",s=>{if(!s.isComposing&&this.isOpen)return this.setSelectedItem(Math.max(0,this.selectedItem-5),!0),!1}),n.register([],"PageDown",s=>{if(!s.isComposing&&this.isOpen)return this.setSelectedItem(Math.min(this.suggestions.length-1,this.selectedItem+5),!0),!1})}findSuggestionItem(e){let t=this.containerEl.ownerDocument.defaultView;if(!t||!(e instanceof t.Element))return null;let n=e.closest(".suggestion-item");return n&&this.containerEl.contains(n)?n:null}onSuggestionClick(e,t){e.preventDefault();let n=this.suggestions.indexOf(t);this.setSelectedItem(n,!1),this.useSelectedItem(e)}onSuggestionMouseover(e,t){let n=this.suggestions.indexOf(t);this.setSelectedItem(n,!1)}setSuggestions(e){this.containerEl.replaceChildren();let t=[];if(e.forEach((n,i)=>{let o=this.containerEl.ownerDocument.createElement("div");o.classList.add("suggestion-item"),this.containerEl.appendChild(o),o.setAttribute("role","option"),o.setAttribute("aria-selected","false"),o.setAttribute("id",`${this.optionIdPrefix}-option-${i}`),this.owner.renderSuggestion(n,o),t.push(o)}),this.values=e,this.suggestions=t,e.length===0){this.isOpen=!1,this.onActiveOptionChange(null);return}this.setSelectedItem(0,!1),this.isOpen=!0}useSelectedItem(e){let t=this.values[this.selectedItem];t&&this.owner.selectSuggestion(t,e)}setSelectedItem(e,t){if(!this.suggestions?.length)return;let n=ZG(e,this.suggestions.length),i=this.suggestions[this.selectedItem],o=this.suggestions[n];i?.classList.remove("is-selected"),o?.classList.add("is-selected"),i?.setAttribute("aria-selected","false"),o?.setAttribute("aria-selected","true"),this.onActiveOptionChange(o?.id??null),this.selectedItem=n,t&&o.scrollIntoView(!1)}close(){this.isOpen=!1,this.onActiveOptionChange(null)}getIsOpen(){return this.isOpen}},Mg=new WeakMap,Hr=class{constructor(e,t){this.popper=null;this.currentRequestId=0;this.isOpen=!1;this.destroyed=!1;this.noResultsTimeout=null;this.currentQuery="";this.renderMatch=GR;let n=this.constructor.name,i=Mg.get(t);i||(i=new Map,Mg.set(t,i));let o=i.get(n);o&&o.destroy(),Mg.set(t,i),i.set(n,this),this.app=e,this.inputEl=t,this.scope=new yC.Scope,this.suggestEl=this.inputEl.ownerDocument.createElement("div"),this.suggestEl.classList.add("suggestion-container");let s=this.inputEl.ownerDocument.createElement("div");s.classList.add("suggestion"),this.suggestEl.appendChild(s),this.listboxId=`qa-suggest-listbox-${++JG}`,s.id=this.listboxId,s.setAttribute("role","listbox"),s.setAttribute("aria-label","Suggestions"),this.suggest=new yA(this,s,this.scope,this.listboxId,a=>this.setActiveDescendant(a)),this.scope.register([],"Escape",this.close.bind(this)),this.debouncedOnInputChanged=(0,yC.debounce)(this.onInputChanged.bind(this),50),this.inputEventListener=a=>this.debouncedOnInputChanged(a),this.focusEventListener=()=>this.debouncedOnInputChanged(),this.inputBlurListener=this.close.bind(this),this.inputEl.addEventListener("input",this.inputEventListener),this.inputEl.addEventListener("focus",this.focusEventListener),this.inputEl.addEventListener("blur",this.inputBlurListener),this.inputEl.setAttribute("role","combobox"),this.inputEl.setAttribute("aria-autocomplete","list"),this.inputEl.setAttribute("aria-expanded","false"),this.inputEl.setAttribute("aria-controls",this.listboxId),this.inputEl.setAttribute("aria-haspopup","listbox"),this.suggestEl.addEventListener("mousedown",a=>{a.preventDefault()}),this.globalClickListener=this.onGlobalClick.bind(this),this.globalWheelListener=this.onGlobalWheel.bind(this),this.globalResizeListener=this.close.bind(this),this.globalBlurListener=this.close.bind(this)}onGlobalClick(e){if(!this.isOpen)return;let t=e.target;!this.suggestEl.contains(t)&&!this.inputEl.contains(t)&&this.close()}onGlobalWheel(e){if(!this.isOpen)return;let t=e.target;this.suggestEl.contains(t)||this.close()}async onInputChanged(e){if(this.destroyed)return;let t=e;if(t?.fromCompletion&&t.keepOpen){let o=this.inputEl.value,s=++this.currentRequestId;this.currentQuery=o;try{let a=await this.getSuggestions(o);s===this.currentRequestId&&(a?.length?(this.suggest.setSuggestions(a),this.isOpen||this.open(this.app.dom.appContainerEl,this.inputEl)):this.close())}catch(a){P.logError(a)}return}if(t?.fromCompletion)return;let n=this.inputEl.value,i=++this.currentRequestId;this.currentQuery=n;try{let o=await this.getSuggestions(n);if(i!==this.currentRequestId)return;if(!o||o.length===0){this.isOpen&&this.showNoResultsAndClose();return}this.suggest.setSuggestions(o),this.open(this.app.dom.appContainerEl,this.inputEl)}catch(o){P.logError(o),this.close()}}showNoResultsAndClose(){this.noResultsTimeout&&sd(this.inputEl).clearTimeout(this.noResultsTimeout),this.close()}open(e,t){if(this.destroyed)return;this.isOpen||this.app.keymap.pushScope(this.scope),this.isOpen=!0,this.inputEl.setAttribute("aria-expanded","true"),this.inputEl.setAttribute("aria-controls",this.listboxId);let n=mo(t);if((mo(e)===n?e:n.body).appendChild(this.suggestEl),this.popper){this.popper.update();return}this.popper=gA(t,this.suggestEl,{placement:"bottom-start",modifiers:[{name:"sameWidth",enabled:!0,fn:({state:l,instance:c})=>{let u=`${l.rects.reference.width}px`;l.styles.popper.width!==u&&(l.styles.popper.width=u,c.update())},phase:"beforeWrite",requires:["computeStyles"]},{name:"flip",enabled:!0},{name:"preventOverflow",enabled:!0},{name:"offset",enabled:!0,options:{offset:[0,4]}}]});let s=n,a=sd(t);s.addEventListener("pointerdown",this.globalClickListener,!0),s.addEventListener("wheel",this.globalWheelListener,!0),a.addEventListener("resize",this.globalResizeListener),a.addEventListener("blur",this.globalBlurListener)}close(){if(!this.isOpen)return;this.app.keymap.popScope(this.scope),this.isOpen=!1,this.inputEl.setAttribute("aria-expanded","false"),this.setActiveDescendant(null),this.suggest.close(),this.suggest.setSuggestions([]),this.popper&&(this.popper.destroy(),this.popper=null),this.suggestEl.remove(),this.noResultsTimeout&&(sd(this.inputEl).clearTimeout(this.noResultsTimeout),this.noResultsTimeout=null);let e=mo(this.inputEl),t=sd(this.inputEl);e.removeEventListener("pointerdown",this.globalClickListener,!0),e.removeEventListener("wheel",this.globalWheelListener,!0),t.removeEventListener("resize",this.globalResizeListener),t.removeEventListener("blur",this.globalBlurListener)}destroy(){this.destroyed=!0,this.close(),this.inputEl.removeEventListener("input",this.inputEventListener),this.inputEl.removeEventListener("focus",this.focusEventListener),this.inputEl.removeEventListener("blur",this.inputBlurListener);let e=this.constructor.name,t=Mg.get(this.inputEl);t&&(t.delete(e),t.size===0&&Mg.delete(this.inputEl))}setActiveDescendant(e){if(e){this.inputEl.setAttribute("aria-activedescendant",e);return}this.inputEl.removeAttribute("aria-activedescendant")}getCurrentQuery(){return this.currentQuery}}});function YR(r,e=0){return(zn[r[e+0]]+zn[r[e+1]]+zn[r[e+2]]+zn[r[e+3]]+"-"+zn[r[e+4]]+zn[r[e+5]]+"-"+zn[r[e+6]]+zn[r[e+7]]+"-"+zn[r[e+8]]+zn[r[e+9]]+"-"+zn[r[e+10]]+zn[r[e+11]]+zn[r[e+12]]+zn[r[e+13]]+zn[r[e+14]]+zn[r[e+15]]).toLowerCase()}var zn,KR=k(()=>{zn=[];for(let r=0;r<256;++r)zn.push((r+256).toString(16).slice(1))});function bA(){return crypto.getRandomValues(e4)}var e4,QR=k(()=>{e4=new Uint8Array(16)});function t4(r,e,t){return!e&&!r&&crypto.randomUUID?crypto.randomUUID():r4(r,e,t)}function r4(r,e,t){r=r||{};let n=r.random??r.rng?.()??bA();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[t+i]=n[i];return e}return YR(n)}var ir,XR=k(()=>{QR();KR();ir=t4});var Ea=k(()=>{XR()});function bC(r){return Ne(r)&&r.type==="Multi"}function Ne(r){return typeof r=="object"&&r!==null}function Qe(r){return bC(r)?Array.isArray(r.choices)?r.choices:[]:[]}function Tl(r){return bC(r)&&Array.isArray(r.choices)}function rf(r){if(!Array.isArray(r))return!0;let e=t=>t.some(n=>{if(Array.isArray(n))return!0;if(!Ne(n)||n.type!=="Multi")return!1;let i=n.choices;return Array.isArray(i)?e(i):wC(i)});return e(r)}function Wr(r){return Array.isArray(r)?r:[]}function wC(r){return Array.isArray(r)||r==null?!1:typeof r=="object"?Object.keys(r).length>0:!!r}function Jo(r){return bC(r)?wC(r.choices):!1}function nf(r){switch(r){case"Template":return"file-text";case"Capture":return"pencil";case"Macro":return"terminal";case"Multi":return"folder";default:return"file-plus"}}function Cd(r){return(typeof r.icon=="string"?r.icon.trim():"")||nf(r.type)}function dn(r){let e=[],t=n=>{Ne(n)&&(e.push(n),Qe(n).forEach(t))};return Wr(r).forEach(t),e}function ZR(r){let e=new Map,t=n=>{let i=[];for(let o of n){if(!Ne(o)){i.push(o);continue}let s=o,a=e.get(s.id);if(a){if(JSON.stringify(s)===JSON.stringify(a))continue;s={...s,id:ir()}}e.set(s.id,s),bC(s)&&Array.isArray(s.choices)&&(s={...s,choices:t(s.choices)}),i.push(s)}return i};return t(r)}function JR(r){if(!Array.isArray(r))return{choices:[],changed:!1,repaired:[]};let e=new Set,t=[],n=o=>{let s=!1,a=[];for(let l of o){if(Array.isArray(l)){s=!0,a.push(...n(l));continue}if(!Ne(l)){s=!0;continue}let c=l;if(Tl(c)){let f=c.choices,p=n(f);p!==f&&(c={...c,choices:p},s=!0)}let u=c.id;if(typeof u=="string"&&u!==""&&!e.has(u)){e.add(u),a.push(c);continue}let d={...c,id:ir()};e.add(d.id),t.push({previousId:u,choice:d}),a.push(d),s=!0}return s?a:o},i=n(r);return{choices:i,changed:i!==r,repaired:t}}function Og(r,e=[],t=0,n=null){let i=[];for(let o of Wr(r)){if(!Ne(o))continue;let s=[...e,o.name];i.push({choice:o,id:o.id,path:s,depth:t,parentId:n}),i.push(...Og(Qe(o),s,t+1,o.id))}return i}var It=k(()=>{Ea()});function Pc(r){return Array.isArray?Array.isArray(r):dL(r)==="[object Array]"}function v4(r){if(typeof r=="string")return r;if(typeof r=="bigint")return r.toString();let e=r+"";return e=="0"&&1/r==-1/0?"-0":e}function CA(r){return r==null?"":v4(r)}function fi(r){return typeof r=="string"}function EC(r){return typeof r=="number"}function y4(r){return r===!0||r===!1||b4(r)&&dL(r)=="[object Boolean]"}function uL(r){return typeof r=="object"}function b4(r){return uL(r)&&r!==null}function yo(r){return r!=null}function CC(r){return!r.trim().length}function dL(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}function pL(r){let e=null,t=null,n=null,i=1,o=null;if(fi(r)||Pc(r))n=r,e=iL(r),t=xC(r);else{if(!nL.call(r,"name"))throw new Error(x4("name"));let s=r.name;if(n=s,nL.call(r,"weight")&&r.weight!==void 0&&(i=r.weight,i<=0))throw new Error(T4(xC(s)));e=iL(s),t=xC(s),o=r.getFn??null}return{path:e,id:t,weight:i,src:n,getFn:o}}function iL(r){return Pc(r)?r:r.split(".")}function xC(r){return Pc(r)?r.join("."):r}function k4(r,e){let t=[],n=!1,i=(o,s,a,l)=>{if(yo(o))if(!s[a])t.push(l!==void 0?{v:o,i:l}:o);else{let c=o[s[a]];if(!yo(c))return;if(a===s.length-1&&(fi(c)||EC(c)||y4(c)||typeof c=="bigint"))t.push(l!==void 0?{v:CA(c),i:l}:CA(c));else if(Pc(c)){n=!0;for(let u=0,d=c.length;u=9&&r<=13||r===32||r===160}function $4(r=1,e=3){let t=new Map,n=Math.pow(10,e);return{get(i){let o=0,s=!1;for(let l=0;l=e&&t.push([n,i]),n=-1)}return r[o-1]&&o-n>=e&&t.push([n,o-1]),t}function R4(r,e,t,{location:n=je.location,distance:i=je.distance,threshold:o=je.threshold,findAllMatches:s=je.findAllMatches,minMatchCharLength:a=je.minMatchCharLength,includeMatches:l=je.includeMatches,ignoreLocation:c=je.ignoreLocation}={}){if(e.length>32)throw new Error(E4(32));let u=e.length,d=r.length,f=Math.max(0,Math.min(n,d)),p=o,m=f,v=(q,B)=>{let J=q/u;if(c)return J;let re=Math.abs(f-B);return i?J+re/i:re?1:J},g=a>1||l,y=g?Array(d):[],w;for(;(w=r.indexOf(e,m))>-1;){let q=v(0,w);if(p=Math.min(q,p),m=w+u,g){let B=0;for(;B=re;j-=1){let $=j-1,G=t[r[$]];if(W[j]=(W[j+1]<<1|1)&G,q&&(W[j]|=(T[j+1]|T[j])<<1|1|T[j+1]),W[j]&_&&(b=v(q,$),b<=p)){if(p=b,m=$,E=q,m<=f)break;re=Math.max(1,2*f-m)}}if(v(q+1,f)>p)break;T=W}if(g&&m>=0){let q=Math.min(d-1,m+u-1+E);for(let B=m;B<=q;B+=1)t[r[B]]&&(y[B]=1)}let I={isMatch:m>=0,score:Math.max(.001,b)};if(g){let q=O4(y,a);q.length?l&&(I.indices=q):I.isMatch=!1}return I}function L4(r){let e={};for(let t=0,n=r.length;tt[0]-n[0]||t[1]-n[1]);let e=[r[0]];for(let t=1,n=r.length;t=t)break;let i=n;for(;i=t||r[o]===" "){i++;break}if(r[o]==="$"&&(o+1>=t||r[o+1]===" ")){i+=2;break}}i++}e.push(r.substring(n,i)),n=i}else{for(;i{let n=z4(t.replace(/\u0000/g,"|").trim()).filter(o=>o&&!!o.trim()),i=[];for(let o=0,s=n.length;o{if(fi(i)){let l={keyId:null,pattern:i};return t&&(l.searcher=TC(i,e)),l}let o=Object.keys(i),s=j4(i);if(!s&&o.length>1&&!_A(i))return n(aL(i));if(G4(i)){let l=s?i[SA.PATH]:o[0],c=s?i[SA.PATTERN]:i[l];if(!fi(c))throw new Error(C4(l));let u={keyId:xC(l),pattern:c};return t&&(u.searcher=TC(c,e)),u}let a={children:[],operator:o[0]};return o.forEach(l=>{let c=i[l];Pc(c)&&c.forEach(u=>{a.children.push(n(u))})}),a};return _A(r)||(r=aL(r)),n(r)}function kA(r,{ignoreFieldNorm:e=je.ignoreFieldNorm}){let t=1;return r.forEach(({key:n,norm:i,score:o})=>{let s=n?n.weight:null;t*=Math.pow(o===0&&s?Number.EPSILON:o,(s||1)*(e?1:i))}),t}function Y4(r,{ignoreFieldNorm:e=je.ignoreFieldNorm}){r.forEach(t=>{t.score=kA(t.matches,{ignoreFieldNorm:e})})}function Q4(r){let e=[];return r.matches.forEach(t=>{if(!yo(t.indices)||!t.indices.length)return;let n={indices:t.indices,value:t.value};t.key&&(n.key=t.key.id),t.idx>-1&&(n.refIndex=t.idx),e.push(n)}),e}function X4(r,e,{includeMatches:t=je.includeMatches,includeScore:n=je.includeScore}={}){return r.map(i=>{let{idx:o}=i,s={item:e[o],refIndex:o};return t&&(s.matches=Q4(i)),n&&(s.score=i.score),s})}function J4(r){lL.has(r)||(lL.add(r),console.warn(`[Fuse] tokenize regex ${r} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function eY(r){if(typeof r=="function"){let e=!1;return t=>{let n=r(t);if(!e&&(e=!0,!Array.isArray(n)||n.some(i=>typeof i!="string")))throw new Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(n)?"array containing non-strings":typeof n}.`);return n}}return r instanceof RegExp?(r.global||J4(r),e=>e.match(r)||[]):e=>e.match(Z4)||[]}function AA({isCaseSensitive:r=!1,ignoreDiacritics:e=!1,tokenize:t}={}){let n=eY(t);return{tokenize(i){return r||(i=i.toLowerCase()),e&&(i=Rg(i)),n(i)}}}function wA(r,e,t,n){let i=n.tokenize(e);if(!i.length)return;r.fieldCount++,r.docFieldCount.set(t,(r.docFieldCount.get(t)||0)+1);let o=new Set(i),s=r.docTermFieldHits.get(t);s||(s=new Map,r.docTermFieldHits.set(t,s));for(let a of o)s.set(a,(s.get(a)||0)+1),r.df.set(a,(r.df.get(a)||0)+1)}function gL(r,e,t,n){let{i,v:o,$:s}=e;if(o!==void 0){wA(r,o,i,n);return}if(s)for(let a=0;aa-l);for(let a of t)iY(r,a);let n=a=>{let l=0,c=t.length;for(;l>>1;t[u]i?n(a):a,l);r.docFieldCount=o;let s=new Map;for(let[a,l]of r.docTermFieldHits)s.set(a>i?n(a):a,l);r.docTermFieldHits=s}var w4,EA,C4,E4,x4,T4,S4,nL,_4,A4,D4,I4,F4,je,DA,mL,N4,Rg,FA,B4,xA,oL,q4,U4,W4,TA,SC,SA,_A,j4,G4,aL,K4,Z4,lL,tY,$c,Mc,_C=k(()=>{w4="Incorrect 'index' type",EA="Invalid doc index: must be a non-negative integer within the bounds of the docs array",C4=r=>`Invalid value for key ${r}`,E4=r=>`Pattern length exceeds max of ${r}.`,x4=r=>`Missing ${r} property in key`,T4=r=>`Property 'weight' in key '${r}' must be a positive integer`,S4="Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.",nL=Object.prototype.hasOwnProperty,_4=class{constructor(r){this._keys=[],this._keyMap={};let e=0;r.forEach(t=>{let n=pL(t);this._keys.push(n),this._keyMap[n.id]=n,e+=n.weight}),this._keys.forEach(t=>{t.weight/=e})}get(r){return this._keyMap[r]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};A4={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},D4={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(r,e)=>r.score===e.score?r.idx{this._keysMap[e.id]=t})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;let r=this.docs.length;this.records=new Array(r);let e=0;if(fi(this.docs[0]))for(let t=0;tr&&(this.records[e].i-=1)}removeAll(r){let e=new Set;for(let n of r)Number.isInteger(n)&&n>=0&&e.add(n);if(e.size===0)return;this.records=this.records.filter(n=>!e.has(n.i));let t=Array.from(e).sort((n,i)=>n-i);for(let n of this.records){let i=0,o=t.length;for(;i>>1;t[s]e),records:this.records}}};mL={\u0142:"l",\u0141:"L",\u0111:"d",\u0110:"D",\u00F8:"o",\u00D8:"O",\u0127:"h",\u0126:"H",\u0167:"t",\u0166:"T",\u0131:"i",\u00DF:"ss"},N4=new RegExp("["+Object.keys(mL).join("")+"]","g"),Rg=typeof String.prototype.normalize=="function"?r=>r.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"").replace(N4,e=>mL[e]):r=>r,FA=class{constructor(r,{location:e=je.location,threshold:t=je.threshold,distance:n=je.distance,includeMatches:i=je.includeMatches,findAllMatches:o=je.findAllMatches,minMatchCharLength:s=je.minMatchCharLength,isCaseSensitive:a=je.isCaseSensitive,ignoreDiacritics:l=je.ignoreDiacritics,ignoreLocation:c=je.ignoreLocation}={}){if(this.options={location:e,threshold:t,distance:n,includeMatches:i,findAllMatches:o,minMatchCharLength:s,isCaseSensitive:a,ignoreDiacritics:l,ignoreLocation:c},r=a?r:r.toLowerCase(),r=l?Rg(r):r,this.pattern=r,this.chunks=[],!this.pattern.length)return;let u=(f,p)=>{this.chunks.push({pattern:f,alphabet:L4(f),startIndex:p})},d=this.pattern.length;if(d>32){let f=0,p=d%32,m=d-p;for(;f{let{isMatch:y,score:w,indices:T}=R4(r,m,v,{location:i+g,distance:o,threshold:s,findAllMatches:a,minMatchCharLength:l,includeMatches:n,ignoreLocation:c});y&&(f=!0),d+=w,y&&T&&u.push(...T)});let p={isMatch:f,score:f?d/this.chunks.length:1};return f&&n&&(p.indices=IA(u)),p}},B4=new Set(["fuzzy","include"]);xA=[{type:"exact",multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:r=>({type:"exact",search(e){let t=e===r;return{isMatch:t,score:t?0:1,indices:[0,r.length-1]}}})},{type:"include",multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:r=>({type:"include",search(e){let t=0,n,i=[],o=r.length;for(;(n=e.indexOf(r,t))>-1;)t=n+o,i.push([n,t-1]);let s=!!i.length;return{isMatch:s,score:s?0:1,indices:i}}})},{type:"prefix-exact",multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:r=>({type:"prefix-exact",search(e){let t=e.startsWith(r);return{isMatch:t,score:t?0:1,indices:[0,r.length-1]}}})},{type:"inverse-prefix-exact",multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:r=>({type:"inverse-prefix-exact",search(e){let t=!e.startsWith(r);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}})},{type:"inverse-suffix-exact",multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:r=>({type:"inverse-suffix-exact",search(e){let t=!e.endsWith(r);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}})},{type:"suffix-exact",multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:r=>({type:"suffix-exact",search(e){let t=e.endsWith(r);return{isMatch:t,score:t?0:1,indices:[e.length-r.length,e.length-1]}}})},{type:"inverse-exact",multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:r=>({type:"inverse-exact",search(e){let t=e.indexOf(r)===-1;return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}})},{type:"fuzzy",multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(r,e={})=>{let t=new FA(r,{location:e.location??je.location,threshold:e.threshold??je.threshold,distance:e.distance??je.distance,includeMatches:e.includeMatches??je.includeMatches,findAllMatches:e.findAllMatches??je.findAllMatches,minMatchCharLength:e.minMatchCharLength??je.minMatchCharLength,isCaseSensitive:e.isCaseSensitive??je.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics??je.ignoreDiacritics,ignoreLocation:e.ignoreLocation??je.ignoreLocation});return{type:"fuzzy",search(n){return t.searchIn(n)}}}}],oL=xA.length,q4="\0",U4="|";W4=class{constructor(r,{isCaseSensitive:e=je.isCaseSensitive,ignoreDiacritics:t=je.ignoreDiacritics,includeMatches:n=je.includeMatches,minMatchCharLength:i=je.minMatchCharLength,ignoreLocation:o=je.ignoreLocation,findAllMatches:s=je.findAllMatches,location:a=je.location,threshold:l=je.threshold,distance:c=je.distance}={}){this.query=null,this.options={isCaseSensitive:e,ignoreDiacritics:t,includeMatches:n,minMatchCharLength:i,findAllMatches:s,ignoreLocation:o,location:a,threshold:l,distance:c},r=e?r:r.toLowerCase(),r=t?Rg(r):r,this.pattern=r,this.query=H4(this.pattern,this.options)}static condition(r,e){return e.useExtendedSearch}searchIn(r){let e=this.query;if(!e)return{isMatch:!1,score:1};let{includeMatches:t,isCaseSensitive:n,ignoreDiacritics:i}=this.options;r=n?r:r.toLowerCase(),r=i?Rg(r):r;let o=0,s=[],a=0,l=!1;for(let c=0,u=e.length;c!!(r[SC.AND]||r[SC.OR]),j4=r=>!!r[SA.PATH],G4=r=>!Pc(r)&&uL(r)&&!_A(r),aL=r=>({[SC.AND]:Object.keys(r).map(e=>({[e]:r[e]}))});K4=class{constructor(r,e){this.limit=r,this.heap=[],this.comparator=e}get size(){return this.heap.length}insert(r){this.size0;){let t=r-1>>1;if(this.comparator(e[r],e[t])<=0)break;let n=e[r];e[r]=e[t],e[t]=n,r=t}}_sinkDown(r){let e=this.heap,t=e.length,n=r;do{r=n;let i=2*r+1,o=2*r+2;if(i0&&(n=i),o0&&(n=o),n!==r){let s=e[r];e[r]=e[n],e[n]=s}}while(n!==r)}};Z4=/[\p{L}\p{M}\p{N}_]+/gu,lL=new WeakSet;tY=class{static condition(r,e){return e.useTokenSearch}constructor(r,e){this.options=e,this.analyzer=AA({isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,tokenize:e.tokenize});let t=this.analyzer.tokenize(r),{df:n,fieldCount:i}=e._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(let o of t){this.termSearchers.push(new FA(o,{location:e.location,threshold:e.threshold,distance:e.distance,includeMatches:e.includeMatches,findAllMatches:e.findAllMatches,minMatchCharLength:e.minMatchCharLength,isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,ignoreLocation:!0}));let s=n.get(o)||0,a=Math.log(1+(i-s+.5)/(s+.5));this.idfWeights.push(a)}this.combineAll=e.tokenMatch==="all",this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(r){if(!this.termSearchers.length)return{isMatch:!1,score:1};let e=[],t=0,n=0,i=0,o=0,s=this.combineAll&&!this.useMask?new Set:null;for(let c=0;c0?1-t/n:0,l={isMatch:!0,score:Math.max(.001,a)};return this.options.includeMatches&&e.length&&(l.indices=IA(e)),this.combineAll&&(this.useMask?l.matchedMask=o:l.matchedTerms=s,l.termCount=this.numTerms),l}};$c=class{constructor(r,e,t){this.options={...je,...e},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new _4(this.options.keys),this._docs=r,this._myIndex=null,this._invertedIndex=null,this.setCollection(r,t),this._lastQuery=null,this._lastSearcher=null}_getSearcher(r){if(this._lastQuery===r)return this._lastSearcher;let e=TC(r,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=r,this._lastSearcher=e,e}setCollection(r,e){if(this._docs=r,e&&!(e instanceof DA))throw new Error(w4);if(this._myIndex=e||fL(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let t=AA({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=rY(this._myIndex.records,this._myIndex.keys.length,t)}this._invalidateSearcherCache()}add(r){if(!yo(r))return;this._docs.push(r);let e=this._myIndex.add(r,this._docs.length-1);if(this._invertedIndex&&e){let t=AA({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});nY(this._invertedIndex,e,this._myIndex.keys.length,t)}this._invalidateSearcherCache()}remove(r=()=>!1){let e=[],t=[];for(let n=0,i=this._docs.length;n!n.has(o)),this._myIndex.removeAll(t),this._invalidateSearcherCache()}return e}removeAt(r){if(!Number.isInteger(r)||r<0||r>=this._docs.length)throw new Error(EA);this._invertedIndex&&cL(this._invertedIndex,[r]);let e=this._docs.splice(r,1)[0];return this._myIndex.removeAt(r),this._invalidateSearcherCache(),e}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}_normalizedKeys(){return this._myIndex.keys.map(r=>this._keyStore.get(r.id)||r)}search(r,e){let{limit:t=-1}=e||{},{includeMatches:n,includeScore:i,shouldSort:o,sortFn:s,ignoreFieldNorm:a}=this.options;if(fi(r)&&!r.trim()){let f=this._docs.map((p,m)=>({item:p,refIndex:m}));return EC(t)&&t>-1&&(f=f.slice(0,t)),f}let l=o&&EC(t)&&t>0&&fi(r),c=s,u=(f,p)=>c(f,p)||f.idx-p.idx,d;if(l){let f=new K4(t,u);fi(this._docs[0])?this._searchStringList(r,{heap:f,ignoreFieldNorm:a}):this._searchObjectList(r,{heap:f,ignoreFieldNorm:a}),d=f.extractSorted()}else d=fi(r)?fi(this._docs[0])?this._searchStringList(r):this._searchObjectList(r):this._searchLogical(r),Y4(d,{ignoreFieldNorm:a}),o&&d.sort(fi(r)?u:c),EC(t)&&t>-1&&(d=d.slice(0,t));return X4(d,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(r,{heap:e,ignoreFieldNorm:t}={}){let n=this._getSearcher(r),i=this.options.useTokenSearch&&this.options.tokenMatch==="all",{records:o}=this._myIndex,s=e?null:[];return o.forEach(({v:a,i:l,n:c})=>{if(!yo(a))return;let u=n.searchIn(a);if(u.isMatch){let d={score:u.score,value:a,norm:c,indices:u.indices};i&&(d.matchedMask=u.matchedMask,d.matchedTerms=u.matchedTerms,d.termCount=u.termCount);let f=[d];if(!i||this._coversAllTokens(f)){let p={item:a,idx:l,matches:f};e?(p.score=kA(p.matches,{ignoreFieldNorm:t}),e.insert(p)):s.push(p)}}}),s}_searchLogical(r){let e=hL(r,this.options),t=this._normalizedKeys(),n=(a,l,c)=>{if(!("children"in a)){let{keyId:p,searcher:m}=a,v;return p===null?(v=[],t.forEach((g,y)=>{v.push(...this._findMatches({key:g,value:l[y],searcher:m}))})):v=this._findMatches({key:this._keyStore.get(p),value:this._myIndex.getValueForItemAtKeyId(l,p),searcher:m}),v&&v.length?[{idx:c,item:l,matches:v}]:[]}let{children:u,operator:d}=a,f=[];for(let p=0,m=u.length;p{if(yo(a)){let c=n(e,a,l);c.length&&(o.has(l)||(o.set(l,{idx:l,item:a,matches:[]}),s.push(o.get(l))),c.forEach(({matches:u})=>{o.get(l).matches.push(...u)}))}}),s}_searchObjectList(r,{heap:e,ignoreFieldNorm:t}={}){let n=this._getSearcher(r),i=this.options.useTokenSearch&&this.options.tokenMatch==="all",{records:o}=this._myIndex,s=this._normalizedKeys(),a=e?null:[];return o.forEach(({$:l,i:c})=>{if(!yo(l))return;let u=[],d=!1,f=!1;if(s.forEach((p,m)=>{let v=this._findMatches({key:p,value:l[m],searcher:n});v.length?(u.push(...v),v[0].hasInverse&&(f=!0)):d=!0}),!(f&&d)&&u.length&&(!i||this._coversAllTokens(u))){let p={idx:c,item:l,matches:u};e?(p.score=kA(p.matches,{ignoreFieldNorm:t}),e.insert(p)):a.push(p)}}),a}_findMatches({key:r,value:e,searcher:t}){if(!yo(e))return[];let n=[];if(Pc(e))e.forEach(({v:i,i:o,n:s})=>{if(!yo(i))return;let a=t.searchIn(i);if(a.isMatch){let l={score:a.score,key:r,value:i,idx:o,norm:s,indices:a.indices,hasInverse:a.hasInverse};a.termCount!==void 0&&(l.matchedMask=a.matchedMask,l.matchedTerms=a.matchedTerms,l.termCount=a.termCount),n.push(l)}});else{let{v:i,n:o}=e,s=t.searchIn(i);if(s.isMatch){let a={score:s.score,key:r,value:i,norm:o,indices:s.indices,hasInverse:s.hasInverse};s.termCount!==void 0&&(a.matchedMask=s.matchedMask,a.matchedTerms=s.matchedTerms,a.termCount=s.termCount),n.push(a)}}return n}_coversAllTokens(r){let e=r.length?r[0].termCount:void 0;if(e===void 0)return!0;if(e<=31){let n=0;for(let i=0;iPA(e))};Mc=$c});var Lg,$A,oY,sY,vL,yL,of,MA=k(()=>{Lg=require("obsidian");_C();Qi();$A=class{constructor(e=100){this.cache=new Map;this.maxSize=e}peek(e){return this.cache.get(e)}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){let n=this.cache.keys().next().value;this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}},oY=20,sY=100,vL=/\w/,yL={base:{basenameExact:-1e3,aliasExact:-900,basenamePrefix:-500,aliasPrefix:-500,substringBasename:-300,fuzzyMatch:0,unresolvedLink:1e3},boosts:{sameFolder:-.15,recency:-.1,tagOverlap:-.05,tagOverlapMax:-.2},penalties:{titleLengthThreshold:15,titleLengthMultiplier:.02,aliasMinPenalty:.05,aliasMaxPenalty:.6,aliasLengthMultiplier:.04,positionMultiplier:.05},thresholds:{recencyDays:1,fuzzyRelaxCount:5}},of=class r{constructor(e,t){this.fileMap=new Map;this.recentFiles=new $A;this.unresolvedLinks=new Set;this.unresolvedLinksDirty=!0;this.isIndexing=!1;this.indexPromise=null;this.reindexTimeout=null;this.fuseUpdateTimeout=null;this.pendingFuseUpdates=new Map;this.reindexBuffer=null;this.effectiveWeights=yL;this.app=e,this.plugin=t;let n={keys:[{name:"basenameNormalized",weight:.8},{name:"aliasesNormalized",weight:.6},{name:"pathNormalized",weight:.2}],ignoreLocation:!0,findAllMatches:!0,shouldSort:!1,includeMatches:!0};this.fuseStrict=new Mc([],{...n,threshold:.2}),this.fuseRelaxed=new Mc([],{...n,threshold:.4}),this.setupEventListeners(),this.effectiveWeights=yL}static getInstance(e,t){return r.instance||(r.instance=new r(e,t)),r.instance}static getInstanceIfExists(){return r.instance??void 0}getLastOpenedAt(e){return this.recentFiles.peek(e)}setupEventListeners(){this.plugin.registerEvent(this.app.workspace.on("file-open",e=>{if(e){this.recentFiles.set(e.path,Date.now());let t=this.fileMap.get(e.path);t&&(t.openedAt=Date.now())}})),this.plugin.registerEvent(this.app.metadataCache.on("changed",e=>{e instanceof Lg.TFile&&e.extension==="md"&&this.updateFile(e)})),this.plugin.registerEvent(this.app.metadataCache.on("resolved",()=>{this.unresolvedLinksDirty=!0,this.fileMap.size===0&&this.scheduleReindex()})),this.plugin.registerEvent(this.app.vault.on("create",e=>{e instanceof Lg.TFile&&e.extension==="md"&&this.addFile(e)})),this.plugin.registerEvent(this.app.vault.on("delete",e=>{e instanceof Lg.TFile&&this.removeFile(e)})),this.plugin.registerEvent(this.app.vault.on("rename",(e,t)=>{e instanceof Lg.TFile&&e.extension==="md"&&(this.removeFileByPath(t),this.addFile(e))}))}async ensureIndexed(){if(this.isIndexing&&this.indexPromise)return this.indexPromise;if(this.fileMap.size===0)return this.reindex()}scheduleReindex(){this.reindexTimeout!==null&&window.clearTimeout(this.reindexTimeout),this.reindexTimeout=window.setTimeout(()=>{this.reindex()},500)}async reindex(){if(this.isIndexing&&this.indexPromise)return this.indexPromise;this.isIndexing=!0,this.indexPromise=this.performReindex();try{await this.indexPromise}finally{this.isIndexing=!1,this.indexPromise=null}}async performReindex(){let e=new Map;this.reindexBuffer=e;try{let t=this.app.vault.getMarkdownFiles(),n=new Map;await(async(o,s=50)=>{for(let a=0;awindow.setTimeout(c,0))}})(t),this.fileMap=n;for(let[o,s]of e)s.op==="remove"?this.fileMap.delete(o):s.file&&this.fileMap.set(o,this.createIndexedFile(s.file));this.updateFuseIndex(),this.updateUnresolvedLinks()}catch(t){try{this.updateFuseIndex()}catch{}throw t}finally{this.reindexBuffer=null}}extractAliases(e){if(!e)return[];let t=[];for(let[n,i]of Object.entries(e)){let o=n.toLowerCase();if(!(o!=="alias"&&o!=="aliases"))if(typeof i=="string"){let s=i.split(",").map(a=>a.trim()).filter(a=>a.length>0);t.push(...s)}else Array.isArray(i)&&t.push(...i.filter(s=>typeof s=="string").map(s=>s.trim()).filter(s=>s.length>0))}return t}createIndexedFile(e){let t=this.app.metadataCache.getFileCache(e),n=t?.frontmatter,i=this.extractAliases(n),o=i.map(c=>fr(c)),s=(t?.headings??[]).map(c=>vA(c.heading)),a=[];if(t?.blocks)for(let c of Object.values(t.blocks))c.id&&a.push(c.id);let l=t?.tags?.map(c=>c.tag)??[];if(n?.tags){let c=Array.isArray(n.tags)?n.tags:[n.tags];l.push(...c.filter(u=>typeof u=="string"))}return{path:e.path,pathNormalized:fr(e.path),basename:e.basename,basenameNormalized:fr(e.basename),aliases:i,aliasesNormalized:o,headings:s,blockIds:a,tags:l,modified:e.stat.mtime,openedAt:this.recentFiles.peek(e.path),folder:e.parent?.path??""}}addFile(e){let t=this.createIndexedFile(e);this.fileMap.set(e.path,t),this.scheduleFuseUpdate(e.path,"add"),this.reindexBuffer?.set(e.path,{op:"upsert",file:e})}updateFile(e){let t=this.createIndexedFile(e);this.fileMap.set(e.path,t),this.scheduleFuseUpdate(e.path,"update"),this.unresolvedLinksDirty=!0,this.reindexBuffer?.set(e.path,{op:"upsert",file:e})}removeFile(e){this.removeFileByPath(e.path)}removeFileByPath(e){this.fileMap.delete(e),this.scheduleFuseUpdate(e,"remove"),this.reindexBuffer?.set(e,{op:"remove"})}updateFuseIndex(){let e=Array.from(this.fileMap.values());this.fuseStrict.setCollection(e),this.fuseRelaxed.setCollection(e)}scheduleFuseUpdate(e,t){if(this.isIndexing)return;let n=this.pendingFuseUpdates.get(e);if(n)if(n==="add"&&t==="remove"){this.pendingFuseUpdates.delete(e);return}else n==="remove"&&t==="add"?this.pendingFuseUpdates.set(e,"update"):this.pendingFuseUpdates.set(e,t);else this.pendingFuseUpdates.set(e,t);this.fuseUpdateTimeout!==null&&window.clearTimeout(this.fuseUpdateTimeout),this.fuseUpdateTimeout=window.setTimeout(()=>{this.processPendingFuseUpdates()},sY)}processPendingFuseUpdates(){if(this.pendingFuseUpdates.size!==0){if(this.isIndexing){this.pendingFuseUpdates.clear();return}if(this.pendingFuseUpdates.size>oY){this.updateFuseIndex(),this.pendingFuseUpdates.clear();return}for(let[e,t]of this.pendingFuseUpdates)switch(t){case"add":{this.fuseStrict.remove(i=>i.path===e),this.fuseRelaxed.remove(i=>i.path===e);let n=this.fileMap.get(e);n&&(this.fuseStrict.add(n),this.fuseRelaxed.add(n));break}case"update":{this.fuseStrict.remove(i=>i.path===e),this.fuseRelaxed.remove(i=>i.path===e);let n=this.fileMap.get(e);n&&(this.fuseStrict.add(n),this.fuseRelaxed.add(n));break}case"remove":{this.fuseStrict.remove(n=>n.path===e),this.fuseRelaxed.remove(n=>n.path===e);break}}this.pendingFuseUpdates.clear()}}updateUnresolvedLinks(){let e=this.app.metadataCache.unresolvedLinks;this.unresolvedLinks.clear();for(let t in e)for(let n in e[t])this.unresolvedLinks.add(n);this.unresolvedLinksDirty=!1}search(e,t={},n=50){this.unresolvedLinksDirty&&this.updateUnresolvedLinks();let i=[],o=fr(e);if(e.includes("#"))return this.searchWithHeadings(e,t,n);let s=new Set,a=Array.from(this.fileMap.values());for(let c of a)c.basenameNormalized===o&&(i.push({file:c,score:this.calculateScore(c,e,t,this.effectiveWeights.base.basenameExact,"exact"),matchType:"exact",displayText:c.basename}),s.add(c.path));for(let c of a){if(s.has(c.path))continue;let u=c.aliasesNormalized.indexOf(o);u!==-1&&(i.push({file:c,score:this.calculateScore(c,e,t,this.effectiveWeights.base.aliasExact,"alias"),matchType:"alias",displayText:c.aliases[u]}),s.add(c.path))}for(let c of a)c.basenameNormalized.startsWith(o)&&c.basenameNormalized!==o&&!s.has(c.path)&&(i.push({file:c,score:this.calculateScore(c,e,t,this.effectiveWeights.base.basenamePrefix,"fuzzy"),matchType:"fuzzy",displayText:c.basename}),s.add(c.path));for(let c of a)for(let[u,d]of c.aliasesNormalized.entries())d.startsWith(o)&&d!==o&&!s.has(c.path)&&(i.push({file:c,score:this.calculateScore(c,e,t,this.effectiveWeights.base.aliasPrefix,"alias"),matchType:"alias",displayText:c.aliases[u]}),s.add(c.path));for(let c of a){if(s.has(c.path))continue;let u=c.basenameNormalized.indexOf(o);if(u>0){let d=c.basenameNormalized[u-1];vL.test(d)||(i.push({file:c,score:this.calculateScore(c,e,t,this.effectiveWeights.base.substringBasename,"fuzzy"),matchType:"fuzzy",displayText:c.basename}),s.add(c.path))}}let l=this.fuseStrict.search(o,{limit:n*2});l.lengthm.key==="aliasesNormalized"),d=!!u,f=d?"alias":"fuzzy",p=c.item.basename;if(d){let m=typeof u?.value=="string"?u.value:void 0,v=m?c.item.aliasesNormalized.findIndex(g=>g===m):c.item.aliasesNormalized.findIndex(g=>g.includes(o));v>=0&&(p=c.item.aliases[v])}i.push({file:c.item,score:this.calculateScore(c.item,e,t,(c.score??.5)+this.effectiveWeights.base.fuzzyMatch,f),matchType:f,displayText:p}),s.add(c.item.path)}if(e.length>=2){let c=0,u=e.length<3?10:20;for(let d of this.unresolvedLinks){if(c>=u)break;fr(d).includes(o)&&(i.push({file:{path:d,pathNormalized:fr(d),basename:d,basenameNormalized:fr(d),aliases:[],aliasesNormalized:[],headings:[],blockIds:[],tags:[],modified:0,folder:""},score:this.effectiveWeights.base.unresolvedLink,matchType:"unresolved",displayText:d}),c++)}}return i.sort((c,u)=>c.score-u.score).slice(0,n)}calculateScore(e,t,n,i,o){let s=i;if(n.currentFolder&&e.folder===n.currentFolder&&(s+=this.effectiveWeights.boosts.sameFolder),e.openedAt&&(Date.now()-e.openedAt)/864e5d.tags.includes(p));f.length>0&&(s+=this.effectiveWeights.boosts.tagOverlap*Math.min(f.length,Math.abs(this.effectiveWeights.boosts.tagOverlapMax/this.effectiveWeights.boosts.tagOverlap)))}}let a=fr(t),l=e.basename.length;if(o==="alias"&&e.aliases.length>0){let d=e.aliasesNormalized.findIndex(f=>f.includes(a));d>=0&&(l=e.aliases[d].length)}if(o==="alias"){let d=Math.max(0,(l-this.effectiveWeights.penalties.titleLengthThreshold)*this.effectiveWeights.penalties.aliasLengthMultiplier),f=Math.min(this.effectiveWeights.penalties.aliasMaxPenalty,this.effectiveWeights.penalties.aliasMinPenalty+d);s+=f}l>this.effectiveWeights.penalties.titleLengthThreshold&&(s+=(l-this.effectiveWeights.penalties.titleLengthThreshold)*this.effectiveWeights.penalties.titleLengthMultiplier);let c=e.basenameNormalized;if(o==="alias"&&e.aliases.length>0){let d=e.aliasesNormalized.findIndex(f=>f.includes(a));d>=0&&(c=e.aliasesNormalized[d])}let u=c.indexOf(a);return u>=0&&(s+=u*this.effectiveWeights.penalties.positionMultiplier),s}searchWithHeadings(e,t,n){let[i,o]=e.split("#"),s=fr(o??""),a=[];if(i===""){let l=0,c=200,u=Array.from(this.fileMap.values());for(let d of u){if(l>=c)break;for(let f of d.headings){if(l>=c)break;fr(f).includes(s)&&(a.push({file:d,score:this.calculateScore(d,e,t,.1),matchType:"heading",displayText:`${d.basename}#${f}`}),l++)}}}else{let l=this.searchFiles(i,t,n);if(l.length===0)return[];for(let c of l)for(let u of c.file.headings)fr(u).includes(s)&&a.push({file:c.file,score:c.score+.05,matchType:"heading",displayText:`${c.file.basename}#${u}`})}return a.sort((l,c)=>l.score-c.score).slice(0,n)}searchFiles(e,t,n){let i=[],o=fr(e),s=new Set,a=Array.from(this.fileMap.values());for(let c of a)c.basenameNormalized===o&&(i.push({file:c,score:this.calculateScore(c,e,t,-1e3,"exact"),matchType:"exact",displayText:c.basename}),s.add(c.path));for(let c of a){if(s.has(c.path))continue;let u=c.aliasesNormalized.indexOf(o);u!==-1&&(i.push({file:c,score:this.calculateScore(c,e,t,this.effectiveWeights.base.aliasExact,"alias"),matchType:"alias",displayText:c.aliases[u]}),s.add(c.path))}for(let c of a)c.basenameNormalized.startsWith(o)&&c.basenameNormalized!==o&&!s.has(c.path)&&(i.push({file:c,score:this.calculateScore(c,e,t,-500,"fuzzy"),matchType:"fuzzy",displayText:c.basename}),s.add(c.path));for(let c of a)for(let[u,d]of c.aliasesNormalized.entries())d.startsWith(o)&&d!==o&&!s.has(c.path)&&(i.push({file:c,score:this.calculateScore(c,e,t,-500,"alias"),matchType:"alias",displayText:c.aliases[u]}),s.add(c.path));for(let c of a){if(s.has(c.path))continue;let u=c.basenameNormalized.indexOf(o);if(u>0){let d=c.basenameNormalized[u-1];vL.test(d)||(i.push({file:c,score:this.calculateScore(c,e,t,-300,"fuzzy"),matchType:"fuzzy",displayText:c.basename}),s.add(c.path))}}let l=this.fuseStrict.search(o,{limit:n*2});l.lengthm.key==="aliasesNormalized"),d=!!u,f=d?"alias":"fuzzy",p=c.item.basename;if(d){let m=typeof u?.value=="string"?u.value:void 0,v=m?c.item.aliasesNormalized.findIndex(g=>g===m):c.item.aliasesNormalized.findIndex(g=>g.includes(o));v>=0&&(p=c.item.aliases[v])}i.push({file:c.item,score:this.calculateScore(c.item,e,t,(c.score??.5)+this.effectiveWeights.base.fuzzyMatch,f),matchType:f,displayText:p}),s.add(c.item.path)}return i.sort((c,u)=>c.score-u.score).slice(0,n)}getFile(e){return this.fileMap.get(e)}getHeadings(e){return e.headings}getBlockIds(e){return e.blockIds}getIndexedFileCount(){return this.fileMap.size}}});function bL(r){OA=r}function kn(){if(!OA)throw new Error("QuickAdd plugin instance accessed before it was initialised.");return OA}var OA,xa=k(()=>{});function aY(r,e){let t=nr(r,"span");switch(t.classList.add("qa-suggestion-pill"),e){case"alias":return t.classList.add("qa-alias-pill"),t.textContent="alias",t;case"heading":return t.classList.add("qa-heading-pill"),t.textContent="H",t;case"block":return t.classList.add("qa-block-pill"),t.textContent="^",t;case"unresolved":return t.classList.add("qa-unresolved-pill"),t.textContent="unresolved",t;default:return null}}var kC,Oc,AC=k(()=>{Ca();kC=require("obsidian");Je();MA();Qi();xa();Is();Oc=class extends Hr{constructor(t,n,i){super(t,n);this.app=t;this.inputEl=n;this.lastInput="";this.sourcePathOverride=i?.sourcePath,this.fileIndex=of.getInstance(t,kn()),this.fileIndex.ensureIndexed()}normalizeFolderPath(t){return!t||t==="/"?"":t.replace(/\/+$/,"")}getSourcePath(){return this.sourcePathOverride??this.app.workspace.getActiveFile()?.path??""}getSourceFolder(){let t=this.getSourcePath();if(!t)return"";let n=this.app.fileManager.getNewFileParent(t);return this.normalizeFolderPath(n?.path)}resolveRelative(t,n){let i=this.normalizeFolderPath(t),o=n;for(o.startsWith("./")&&(o=o.slice(2));o.startsWith("../");){let s=i.split("/");if(!i||s.length===0||s.length===1&&s[0]==="")break;s.pop(),i=s.join("/"),o=o.slice(3)}return{folder:this.normalizeFolderPath(i),query:o}}getSuggestions(t){if(this.inputEl.selectionStart===null)return[];let n=this.inputEl.selectionStart,i=t.slice(0,n),o=jM.exec(i);if(!o)return[];let s=o[1];if(this.lastInput=s,s.includes("#^"))return this.getBlockSuggestions(s);if(s.indexOf("#")>0)return this.getHeadingSuggestions(s);if(s.startsWith("./")||s.startsWith("../"))return this.getRelativePathSuggestions(s);if(i.includes("![["))return this.getAttachmentSuggestions(s);let c=this.getSourceFolder(),u=this.app.workspace.getActiveFile(),d={currentFile:this.sourcePathOverride?void 0:u??void 0,currentFolder:c};return this.fileIndex.search(s,d,50)}getHeadingSuggestions(t){let[n,i]=t.split("#"),o=n.trim()==="",s=fr(i??""),a=[];if(o){let c=this.app.workspace.getActiveFile();if(c){let u=this.fileIndex.getFile(c.path);u&&(a=[u])}}else a=this.fileIndex.search(n,{},1).map(c=>c.file);if(a.length===0)return[];let l=[];for(let c of a){let d=this.fileIndex.getHeadings(c).filter(f=>i===""||fr(f).includes(s)).slice(0,20);for(let f of d)l.push({file:c,score:0,matchType:"heading",displayText:o?`#${f}`:`${c.basename}#${f}`})}return l}getBlockSuggestions(t){let[n,i]=t.split("#^"),o=fr(i??""),s=this.fileIndex.search(n,{},1);if(s.length===0)return[];let a=s[0].file;return this.fileIndex.getBlockIds(a).filter(c=>i===""||fr(c).includes(o)).slice(0,20).map(c=>({file:a,score:0,matchType:"block",displayText:`${a.basename}#^${c}`}))}getRelativePathSuggestions(t){let n=this.getSourceFolder(),{folder:i,query:o}=this.resolveRelative(n,t);if(o)return this.fileIndex.search(o,{currentFolder:i},20);let s=this.fileIndex.search("",{currentFolder:i},50),a=l=>this.normalizeFolderPath(l||"");return s.filter(l=>a(l.file.folder)===a(i))}getAttachmentSuggestions(t){let n=this.app.vault.getFiles(),i=["png","jpg","jpeg","gif","svg","pdf","mp4","webm","mov","canvas"],o=fr(t);return n.filter(a=>i.includes(a.extension.toLowerCase())&&(t===""||fr(a.basename).includes(o))).slice(0,20).map(a=>({file:{path:a.path,pathNormalized:fr(a.path),basename:a.basename,basenameNormalized:fr(a.basename),aliases:[],aliasesNormalized:[],headings:[],blockIds:[],tags:[],modified:a.stat.mtime,folder:this.normalizeFolderPath(a.parent?.path||"")},score:0,matchType:"exact",displayText:a.name}))}renderSuggestion(t,n){let{file:i,matchType:o,displayText:s}=t;n.classList.add("qaFileSuggestionItem"),n.classList.add(`qa-suggest-${o}`);let a=s,l="",c=!1,u="";switch(o){case"exact":a=i.basename,l=i.path;break;case"alias":a=s,l=i.path;break;case"fuzzy":a=i.basename,l=i.path;break;case"heading":{let[v,g]=s.split("#"),y=this.lastInput.includes("#")?this.lastInput.split("#")[1]:"",w=fr(y??"");y&&fr(g).includes(w)?(a=g,c=!0,u=y):a=g,l=v;break}case"block":{let[v,g]=s.split("#^");a=g,l=v;break}case"unresolved":a=s,l="Unresolved link";break}let d=nr(n,"div");d.className="qa-suggestion-content";let f=nr(n,"span");f.className="suggestion-main-text",c?this.renderMatch(f,a,u):f.textContent=a,d.appendChild(f);let p=aY(n,o);p&&d.appendChild(p);let m=nr(n,"span");m.className="suggestion-sub-text",m.textContent=l,n.replaceChildren(d,m),this.addHoverTooltip(n,i)}open(t,n){if(super.open(t,n),!this.scrollListener){let i=mo(this.inputEl),o=()=>this.hideTooltip();i.addEventListener("scroll",o,{passive:!0}),this.scrollListener=o,this.scrollListenerDocument=i}}hideTooltip(){let t=mo(this.inputEl);this.tooltipTimeout!==void 0&&(window.clearTimeout(this.tooltipTimeout),this.tooltipTimeout=void 0),t.querySelector(".qa-file-tooltip")?.remove()}addHoverTooltip(t,n){let i=mo(t);t.addEventListener("mouseenter",()=>{this.hideTooltip(),this.tooltipTimeout=window.setTimeout(()=>{let o=this.createTooltip(n);o&&(i.body.appendChild(o),this.positionTooltip(o,t))},200)}),t.addEventListener("mouseleave",()=>this.hideTooltip()),t.addEventListener("blur",()=>this.hideTooltip())}createTooltip(t){let n=this.app.vault.getAbstractFileByPath(t.path);if(!n||!(n instanceof kC.TFile))return null;let i=this.inputEl,o=nr(i,"div");o.className="qa-file-tooltip";let s=nr(i,"div");s.className="qa-tooltip-header",s.textContent=n.basename;let a=nr(i,"div");a.className="qa-tooltip-content";let l=nr(i,"div");l.textContent=`Path: ${n.path}`;let c=nr(i,"div");return c.textContent=`Modified: ${new Date(n.stat.mtime).toLocaleDateString()}`,a.append(l,c),o.append(s,a),o}positionTooltip(t,n){let i=n.getBoundingClientRect();t.style.left=`${i.right+10}px`,t.style.top=`${i.top}px`}close(){this.hideTooltip(),this.scrollListener&&this.scrollListenerDocument&&(this.scrollListenerDocument.removeEventListener("scroll",this.scrollListener),this.scrollListener=void 0,this.scrollListenerDocument=void 0),super.close()}selectSuggestion(t){if(this.inputEl.selectionStart===null)return;let n=this.inputEl.selectionStart,i=this.lastInput.length,o=this.inputEl.value,s=0,a=this.inputEl.value.slice(n-this.lastInput.length-3,n-this.lastInput.length)==="![[";if(t.matchType==="unresolved")s=this.makeLinkManually(o,t.displayText.replace(/.md$/,""),n,i);else if(t.matchType==="heading"||t.matchType==="block"){let l=t.displayText;s=this.makeLinkManually(o,l,n,i)}else if(a)s=this.makeLinkManually(o,t.displayText,n,i);else{let l=this.app.vault.getAbstractFileByPath(t.file.path);if(l instanceof kC.TFile){let c=t.matchType==="alias"?t.displayText:void 0;s=this.makeLinkObsidianMethod(l,o,n,i,c)}else s=this.makeLinkManually(o,t.displayText,n,i)}this.inputEl.trigger("input"),this.close(),this.inputEl.setSelectionRange(s,s)}makeLinkObsidianMethod(t,n,i,o,s){let a=this.app.vault.getAbstractFileByPath(t.path);if(!(a instanceof kC.TFile))return this.makeLinkManually(n,t.path,i,o);let l=this.app.fileManager.generateMarkdownLink(a,this.getSourcePath(),"",s??"");return this.inputEl.value=this.getNewInputValueForFileLink(n,l,i,o),i-o+l.length+2}makeLinkManually(t,n,i,o){return this.inputEl.value=this.getNewInputValueForFileName(t,n,i,o),i-o+n.length+2}getNewInputValueForFileLink(t,n,i,o){return`${t.slice(0,i-o-2)}${n}${t.slice(i)}`}getNewInputValueForFileName(t,n,i,o){return`${t.slice(0,i-o)}${n}]]${t.slice(i)}`}}});var wL,DC,CL=k(()=>{_C();wL={threshold:.4,includeScore:!0,keys:[""]},DC=class r{constructor(e,t){this.sortedTags=[];this.fuse=new Mc([],wL);this.app=e,this.refresh(),t.registerEvent(this.app.metadataCache.on("resolved",()=>this.refresh()))}static getInstance(e,t){return r.instance||(r.instance=new r(e,t)),r.instance}refresh(){let e=this.app.metadataCache.getTags(),t=Object.keys(e);this.sortedTags=t.sort((n,i)=>n.length!==i.length?n.length-i.length:n.localeCompare(i)),this.fuse=new Mc(this.sortedTags,wL)}getSortedTags(){return this.sortedTags}search(e){return this.fuse.search(e)}}});function lY(r,e){let t=r.slice(0,e),n=t.lastIndexOf("[[");return n===-1?!1:t.lastIndexOf("]]"){Je();Ca();Qi();xa();CL();Rc=class extends Hr{constructor(t,n,i){super(t,n);this.app=t;this.inputEl=n;this.lastInput="";this.lastInputStart=0;this.lastInputLength=0;this.tagIndex=DC.getInstance(t,kn()),i?.refreshIndex!==!1&&this.tagIndex.refresh()}getSuggestions(t){if(this.inputEl.selectionStart===null)return[];let n=this.inputEl.selectionStart,i=t.slice(0,n),o=GM.exec(i);if(!o)return[];if(o.index===void 0)return[];if(lY(i,o.index))return[];let s=o[1];this.lastInput=s,this.lastInputStart=o.index,this.lastInputLength=o[0].length;let a=this.tagIndex.getSortedTags(),l=s.toLowerCase(),c=a.filter(p=>p.replace(/^#/,"").toLowerCase().startsWith(l)).slice(0,5),u=this.tagIndex.search(s).filter(p=>p.score!==void 0&&p.score<.8).map(p=>p.item).slice(0,10),d=new Set(c),f=[...c];for(let p of u)!d.has(p)&&f.length<15&&(f.push(p),d.add(p));return f}renderSuggestion(t,n){this.renderMatch(n,t,this.lastInput)}selectSuggestion(t){let n=this.inputEl;if(n.selectionStart===null)return;let i=this.lastInputStart,o=i+this.lastInputLength,s=t.startsWith("#")?t:`#${t}`;vC(n,i,o,s,{fromCompletion:!0}),this.close()}}});var mi,sf=k(()=>{mi=class r{constructor(){this.drafts=new Map;this.pendingSubmittedDraftKeys=new Set;this.executionScopeDepth=0;this.executionScopeFailed=!1;this.MAX_ENTRIES=100}static getInstance(){return r.instance||(r.instance=new r),r.instance}makeKey(e){return JSON.stringify({v:1,kind:e.kind,header:e.header,placeholder:e.placeholder??"",linkSourcePath:e.linkSourcePath??"",scopeId:e.scopeId??""})}get(e){let t=this.drafts.get(e);if(t)return t.timestamp=Date.now(),t.value}set(e,t){this.drafts.size>=this.MAX_ENTRIES&&!this.drafts.has(e)&&this.evictOldest(1),this.drafts.set(e,{value:t,timestamp:Date.now()})}handleSubmittedDraft(e,t){if(!this.hasActiveExecutionScope()){this.clear(e);return}this.set(e,t),this.pendingSubmittedDraftKeys.add(e)}beginExecutionScope(){this.executionScopeDepth+=1}commitExecutionScope(){if(this.hasActiveExecutionScope()&&(this.executionScopeDepth-=1,!(this.executionScopeDepth>0))){if(!this.executionScopeFailed)for(let e of this.pendingSubmittedDraftKeys)this.clear(e);this.resetExecutionScope()}}rollbackExecutionScope(){this.hasActiveExecutionScope()&&(this.executionScopeFailed=!0,this.executionScopeDepth-=1,this.executionScopeDepth===0&&this.resetExecutionScope())}markExecutionScopeFailed(){this.hasActiveExecutionScope()&&(this.executionScopeFailed=!0)}hasActiveExecutionScope(){return this.executionScopeDepth>0}clear(e){this.drafts.delete(e),this.pendingSubmittedDraftKeys.delete(e)}clearAll(){this.drafts.clear(),this.resetExecutionScope()}evictOldest(e){let t=Array.from(this.drafts.entries()).sort(([,n],[,i])=>n.timestamp-i.timestamp).slice(0,e);for(let[n]of t)this.drafts.delete(n),this.pendingSubmittedDraftKeys.delete(n)}resetExecutionScope(){this.pendingSubmittedDraftKeys.clear(),this.executionScopeDepth=0,this.executionScopeFailed=!1}}});var af,RA=k(()=>{ht();sf();af=class{constructor(e,t){this.store=mi.getInstance();this.initialValue="";this.didChange=!1;this.draftKey=this.store.makeKey(e),this.shouldPersist=t??(()=>ne.getState().persistInputPromptDrafts)}hydrate(e){return this.initialValue=e,this.shouldPersist()?this.store.get(this.draftKey)??e:e}markChanged(){this.didChange=!0}persist(e,t){if(this.shouldPersist()){if(t){this.store.handleSubmittedDraft(this.draftKey,e);return}if(!(!this.didChange||e===this.initialValue)){if(!e.trim()){this.store.clear(this.draftKey);return}this.store.set(this.draftKey,e)}}}}});function FC(r,e){if(r.focus(),e?.cursorAtEnd){let t=r.value.length;r.setSelectionRange(t,t);return}r.select()}var LA=k(()=>{});function PC(r,e,t){let n=e?.trim();if(!n)return;let i=r.createDiv({text:n,cls:"qa-prompt-context"});return i.setAttr("title",t?.trim()||n),i}var NA=k(()=>{});var lf,Ng,$C=k(()=>{De();lf=r=>{P.logWarning(r)},Ng=()=>{}});function cY(r,e){let t=Math.min(r.length,e.length),n=0;for(;nt||r.length>64||e.length>64)return t+1;let n=[],i=Array.from({length:e.length+1},(s,a)=>a),o=[];for(let s=1;s<=r.length;s++){o=new Array(e.length+1),o[0]=s;let a=o[0];for(let l=1;l<=e.length;l++){let c=r[s-1]===e[l-1]?0:1,u=Math.min(i[l]+1,o[l-1]+1,i[l-1]+c);s>1&&l>1&&r[s-1]===e[l-2]&&r[s-2]===e[l-1]&&(u=Math.min(u,n[l-2]+1)),o[l]=u,ut)return t+1;n=i,i=o}return i[e.length]}function xL(r,e,t=3){let n=r.trim().toLowerCase();if(!n)return[];let i=e.map((a,l)=>({candidate:a,index:l})).filter(a=>a.candidate!==n),o=i.map(a=>({...a,distance:EL(n,a.candidate,2)})).filter(a=>a.distance<=1).sort((a,l)=>a.distance-l.distance||a.index-l.index);if(o.length>0)return o.slice(0,t).map(a=>a.candidate);if(n.length>=2){let a=i.map(l=>({...l,shared:cY(n,l.candidate)})).filter(l=>l.shared>=2).sort((l,c)=>c.shared-l.shared||l.index-c.index);if(a.length>0)return a.slice(0,t).map(l=>l.candidate)}return i.map(a=>({...a,distance:EL(n,a.candidate,2)})).filter(a=>a.distance<=2&&a.candidate.length>=10).sort((a,l)=>a.distance-l.distance||a.index-l.index).slice(0,t).map(a=>a.candidate)}var TL=k(()=>{});function Bg(r){let t=/^(\s*---\r?\n)([\s\S]*?)(\r?\n(?:---|\.\.\.)\s*(?:\r?\n|$))/.exec(r);return t?[0,t[0].length]:null}function Vg(r,e,t,n){let[i,o]=n??[Number.NaN,Number.NaN];if(!(n!==null&&e>=i&&e<=o))return{isInYaml:!1,isQuoted:!1,lineStart:0,lineEnd:0,baseIndent:"",isKeyValuePosition:!1,isListItemPosition:!1};let a=r.lastIndexOf(` `,e-1)+1,l=r.indexOf(` `,Math.max(e,t)),c=l===-1?r.length:l,u=r.slice(a,e),d=r.slice(t,c),f=(u.match(/^\s*/)||[""])[0],p=r[e-1]==='"'&&r[t]==='"'||r[e-1]==="'"&&r[t]==="'",m=u.replace(/["']$/,""),g=d.replace(/^["']/,"").replace(/\s+#.*$/,"").trim().length===0,y=/:\s*$/.test(m)&&g,w=/^\s*-\s*$/.test(m)&&g;return{isInYaml:!0,isQuoted:p,lineStart:a,lineEnd:c,baseIndent:f,isKeyValuePosition:y,isListItemPosition:w}}var BA=k(()=>{});function SL(r){return r.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(uY,e=>`\\x${e.charCodeAt(0).toString(16).padStart(2,"0")}`)}function qg(r){return`"${SL(r)}"`}function VA(r,e,t){let n=Vg(r,e,t,Bg(r));return!n.isInYaml||!n.isQuoted?!1:n.isKeyValuePosition||n.isListItemPosition}function cf(r,e,t,n){return VA(r,e,t)?r[e-1]==='"'?SL(n):n.replace(/'/g,"''"):n}function qA(r,e,t){let n=Vg(r,e,t,Bg(r));return!n.isInYaml||n.isQuoted?!1:n.isKeyValuePosition||n.isListItemPosition}var uY,UA=k(()=>{BA();uY=new RegExp("[\0-\x7F]","g")});function MC(r,e,t){let n=r.trim().toLowerCase();if(dY.has(n))return n;t?.(`QuickAdd: Unsupported multi-select format "${r}" in "${e}". Supported formats: auto, inline, spaced, yaml, markdown.`)}function pY(r,e){let t=r.lastIndexOf(` `,e-1)+1;return r.slice(t,e).match(/^\s*/)?.[0]??""}function fY(r){return`- ${r.replace(/\r\n?|\n/g,` `)}`}function _L(r){let{input:e,matchStart:t,values:n,format:i}=r,o=n.map(s=>String(s));switch(i){case"auto":return;case"inline":return o.join(",");case"spaced":return o.join(", ");case"yaml":return`[${o.map(qg).join(", ")}]`;case"markdown":{if(o.length===0)return"";let s=pY(e,t);return o.map(fY).join(` ${s}`)}default:return i}}var dY,OC=k(()=>{UA();dY=new Set(["auto","inline","spaced","yaml","markdown"])});function LC(r,e){return r.length<=e?r:`${r.slice(0,e)}\u2026`}function hY(r){let e=r.map(t=>`"${t}"`);return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function kL(r,e){let t=LC(r,32),n=`{{FIELD:${LC(e,48)}}}`,i=mY.get(r);if(i)return`Unknown FIELD filter "${t}" - ${i}. Ignored in ${n}.`;let o=xL(r,RC);return o.length>0?`Unknown FIELD filter "${t}" - did you mean ${hY(o)}? Ignored in ${n}.`:`Unknown FIELD filter "${t}" in ${n} was ignored. Supported filters: ${RC.join(", ")}.`}function gY(r,e){let t=LC(r,32);return`FIELD filter "${t}" needs a value - write "${t}:value". Ignored in {{FIELD:${LC(e,48)}}}.`}function vY(r,e,t){(t.warn??lf)(kL(r,e))}var RC,mY,hi,Lc=k(()=>{$C();dd();TL();OC();RC=["folder","tag","inline","inline-code-blocks","exclude-folder","exclude-tag","exclude-file","default","default-from","default-empty","default-always","case-sensitive","multi","format"],mY=new Map([["case-insensitive",'matching is already case-insensitive; use "case-sensitive:true" to match exactly']]);hi=class{static parse(e,t){let n=Yo(e).map(c=>c.trim()),i=n[0],o={},s=!1,a="auto",l=!1;for(let c=1;cm.trim().toLowerCase()).filter(m=>m.length>0));break;case"default":o.defaultValue=p;break;case"default-from":o.defaultFrom=p.toLowerCase();break;case"default-empty":o.defaultEmpty=p.toLowerCase()==="true";break;case"default-always":o.defaultAlways=p.toLowerCase()==="true";break;case"case-sensitive":o.caseSensitive=p.toLowerCase()==="true";break;case"exclude-folder":o.excludeFolders||(o.excludeFolders=[]),o.excludeFolders.push(p);break;case"exclude-tag":{o.excludeTags||(o.excludeTags=[]);let m=p.startsWith("#")?p.substring(1):p;o.excludeTags.push(m);break}case"exclude-file":o.excludeFiles||(o.excludeFiles=[]),o.excludeFiles.push(p);break}}return!s&&l&&(t?.warn?.(`QuickAdd: |format: needs |multi in "{{FIELD:${e}}}"; ignoring.`),a="auto"),{fieldName:i,filters:o,...s?{multiSelect:s}:{},...a!=="auto"?{multiFormat:a}:{}}}}});function zA(r){return r.replace(/^\/+|\/+$/g,"")}function Ug(r,e=t=>t){return JSON.stringify([...r].map(e).sort())}function AL(r,e){let t=[`folder=${zA(r)}`];return e.folders?.length&&t.push(`folders=${Ug(e.folders,zA)}`),e.tags?.length&&t.push(`tags=${Ug(e.tags)}`),e.excludeFolders?.length&&t.push(`xfolder=${Ug(e.excludeFolders,zA)}`),e.excludeTags?.length&&t.push(`xtag=${Ug(e.excludeTags)}`),e.excludeFiles?.length&&t.push(`xfile=${Ug(e.excludeFiles)}`),t.join("|")}function bY(r){let{folderPath:e,mode:t,label:n,optional:i,allowCustomInput:o,multiSelect:s,filter:a}=r,l=[AL(e,a),`mode=${t}`];return n&&l.push(`label=${n}`),i&&l.push("optional"),o&&l.push("custom"),s&&l.push("multi"),l.join("|")}function NC(r,e){if(!r)return null;let t=Yo(r),n=(t.shift()??"").trim();if(!n)return null;let i=t,o=Ps(i,"optional");i=o.remaining;let s=o.found,a=Ps(i,"custom");i=a.remaining;let l=a.found,c=Ps(i,"multi");i=c.remaining;let u=c.found,d="name",f=[];for(let b of i){let E=b.trim().toLowerCase();if(yY.has(E)){d=E;continue}f.push(b)}let p,m;for(let b of f){let E=Oi(b);E&&(E.key==="label"&&E.value?p=E.value:E.key==="name"&&E.value&&(m=E.value))}let v=hi.parse(r,{warn:e?.warn}),g=u||(v.multiSelect??!1),y=v.multiFormat??"auto",w={folder:n,tags:v.filters.tags,excludeFolders:v.filters.excludeFolders,excludeTags:v.filters.excludeTags,excludeFiles:v.filters.excludeFiles},T=m?`${zg}name=${m}|${AL(n,w)}${g?"|multi":""}`:`${zg}${bY({folderPath:n,mode:d,label:p,optional:s,allowCustomInput:l,multiSelect:g,filter:w})}`;return{raw:r,folderPath:n,mode:d,label:p,aliasName:m,optional:s,allowCustomInput:l,filter:w,multiSelect:g,multiFormat:y,variableKey:T}}function DL(r,e){if(!r)return r;for(let t of e)if(r===t)return r;return`${bo}${r}`}function Ed(r){return typeof r!="string"||r===""?{kind:"empty"}:r.startsWith(bo)?{kind:"custom",text:r.slice(bo.length)}:r.startsWith(Ta)?{kind:"file",path:r.slice(Ta.length)}:{kind:"raw",value:r}}function Nc(r){return(r.split("/").pop()??r).replace(/\.(md|canvas|base)$/i,"")}function IL(r){return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function wY(r){if(!r)return;let e=Object.entries(r).find(([t])=>t.toLowerCase()==="title");return e?IL(e[1]):void 0}function CY(r){let e=r?.headings?.find(t=>t.level===1);return IL(e?.heading)}function EY(r){let e=r.parent?.path;return e&&e!=="/"?e:r.path.includes("/")?r.path.slice(0,r.path.lastIndexOf("/")):"vault root"}function xY(r){return r.basename?r.basename:Nc(r.path)}function HA(r,e){let t=r.map(i=>{let o=e?.(i)??null,s=xY(i),a=wY(o?.frontmatter)??CY(o)??s,l=a===s?s:`${a} (${s})`;return{file:i,primary:a,label:l}}),n=new Map;for(let{label:i}of t)n.set(i,(n.get(i)??0)+1);return t.map(({file:i,primary:o,label:s})=>{let a=(n.get(s)??0)<=1?s:`${s} - ${EY(i)}`;return{primary:o,secondary:i.path,label:a}})}function Sl(r,e){return HA(r,e).map(t=>t.label)}var zg,Ta,bo,yY,wo=k(()=>{Lc();dd();zg="FILE:",Ta="@file:",bo="@filecustom:",yY=new Set(["name","link","path"])});function xd(r){return TY.has(r.toUpperCase())}function WA(r){if(r.length===0||r==="."||r===".."||r.startsWith(".")||Hg.test(r)||Wg.test(r)||jg.test(r))return!1;let e=r.split(".")[0]??"";return e.length===0||!xd(e)}var Hg,Wg,jg,TY,Gg=k(()=>{Hg=new RegExp("[\0-]","u"),Wg=/[\\/:*?"<>|]/u,jg=/[. ]$/u,TY=new Set(["CON","PRN","AUX","NUL","COM1","COM2","COM3","COM4","COM5","COM6","COM7","COM8","COM9","LPT1","LPT2","LPT3","LPT4","LPT5","LPT6","LPT7","LPT8","LPT9"])});function SY(r){return(r??"").trim().replace(/\\/g,"/")}function _Y(r){return r.startsWith("/")||/^[a-zA-Z]:/.test(r)}function kY(r){return r.split("/").some(e=>/^\.\.[. ]*$/u.test(e))}function Pr(r){let e=SY(r);return e?_Y(e)||kY(e):!1}var Sa=k(()=>{});function kl(r){return Object.hasOwn(_l,r)}function FL(r){let e=r.toLowerCase();return e==="jpeg"||Object.values(_l).includes(e)}function AY(r){let e=t=>String(t).padStart(2,"0");return`${r.getFullYear()}-${e(r.getMonth()+1)}-${e(r.getDate())} ${e(r.getHours())}.${e(r.getMinutes())}.${e(r.getSeconds())}`}function IY(r){return r.replace(DY,"").replace(/\s+/g," ").replace(/[. ]+$/g,"").trim()}function BC(r){if(r.nameAfterNoteTitle){let e=IY(Nc(r.sourcePath));if(e.length>0&&WA(e))return`${e}.${r.extension}`}return`Clipboard image ${AY(r.now)}.${r.extension}`}function PL(r,e){if(!kl(r))throw new Error(`Unsupported clipboard image type: ${r}`);return BC({extension:_l[r],sourcePath:"",now:e,nameAfterNoteTitle:!1})}function $L(r){let e=r.split(/[\\/]/u).at(-1)??"",t=e.lastIndexOf("."),n=t>=0?e.slice(0,t):e;return WA(n)?n:null}async function jA(r,e,t,n,i){if(!kl(t))throw new Error(`Unsupported image type: ${t}`);let o=await r.fileManager.getAvailablePathForAttachment(i,n||void 0);if(Pr(o))throw new Error(`Refusing to save image outside the vault: '${o}'`);return r.vault.createBinary(o,e)}async function VC(r,e,t,n,i){if(!kl(t))throw new Error(`Unsupported clipboard image type: ${t}`);let o=i?.nameAfterNoteTitle??ne.getState().namePastedImagesAfterNoteTitle;return jA(r,e,t,n,BC({extension:_l[t],sourcePath:n,now:i?.now??new Date,nameAfterNoteTitle:o}))}function qC(r,e,t){let n=r.fileManager.generateMarkdownLink(e,t);return n.startsWith("!")?n:`!${n}`}var _l,DY,UC=k(()=>{ht();wo();Gg();Sa();_l=Object.assign(Object.create(null),{"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg"});DY=/[/\\:*?"<>|#^[\]]/g});function FY(){let r=zC.filter(t=>t.inputEl.isConnected);return r.find(t=>document.activeElement!==null&&t.inputEl.contains(document.activeElement))??r.at(-1)??null}function uf(r,e,t={}){let n=t.sourcePath??"",i=null,o=!1,s=!1,a=()=>{s=!0},l=()=>{s=!1},c=(y,w,T,b)=>{switch(T.kind){case"stand-down":return;case"take":if(w.preventDefault(),i){new Yg.Notice(y==="paste"?"QuickAdd: an image is still being saved \u2014 paste again in a moment.":"QuickAdd: an image is still being saved \u2014 drop again in a moment.");return}i=m(T.images,b).then(()=>{}).finally(()=>{i=null});return;default:return HC(T)}},u=y=>{let w=y.clipboardData;if(!w||s)return;let T=new Date;c("paste",y,ML("paste",w,r),T)},d=y=>{if(s)return;let w=y.dataTransfer;!w||!RL(w)||(y.preventDefault(),w.dropEffect="copy",e.classList.add("qa-image-drop-target"))},f=()=>{e.classList.remove("qa-image-drop-target")},p=y=>{if(f(),s)return;let w=y.dataTransfer;if(!w||!RL(w))return;let T=new Date;c("drop",y,ML("drop",w,r),T)};async function m(y,w){let T=e.readOnly;e.readOnly=!0,e.setAttribute("aria-busy","true"),e.classList.add("qa-image-paste-busy");let b=[];try{for(let C of y){let _;switch(C.origin){case"vault":_=C.file;break;case"bytes":{let I=await C.file.arrayBuffer(),q=OY(C,w,n);_=await RY(()=>jA(r,I,C.mimeType,n,q));break}default:return HC(C)}b.push(qC(r,_,n))}}catch(C){P.logError(`Failed to save image: ${C instanceof Error?C.message:String(C)}`),new Yg.Notice("QuickAdd: failed to save image.")}finally{e.readOnly=T,e.removeAttribute("aria-busy"),e.classList.remove("qa-image-paste-busy")}if(b.length===0||o)return"";let E=b.join(e.tagName==="TEXTAREA"?` `:" ");try{return LY(e,E),E}catch(C){return P.logError(`Failed to insert image link: ${C instanceof Error?C.message:String(C)}`),new Yg.Notice("QuickAdd: saved the image but could not insert its link."),""}}async function v(y){let w=new Date,T=MY(y);if(T.length===0)return P.logMessage("QuickAdd: image ingest skipped (no-images)."),"";if(i)return new Yg.Notice("QuickAdd: an image is still being saved \u2014 drop again in a moment."),P.logMessage("QuickAdd: image ingest skipped (busy)."),"";let b="";return i=(async()=>{b=await m(T,w)})().finally(()=>{i=null}),await i,b.length>0&&P.logMessage(`QuickAdd: ingested ${T.length} image(s) into the active prompt.`),b}e.addEventListener("paste",u),e.addEventListener("dragenter",d),e.addEventListener("dragover",d),e.addEventListener("dragleave",f),e.addEventListener("drop",p),e.addEventListener("compositionstart",a),e.addEventListener("compositionend",l);let g={isBusy:()=>i!==null,whenIdle:()=>i??Promise.resolve(),ingestFiles:v,detach:()=>{o=!0,f(),e.removeEventListener("paste",u),e.removeEventListener("dragenter",d),e.removeEventListener("dragover",d),e.removeEventListener("dragleave",f),e.removeEventListener("drop",p),e.removeEventListener("compositionstart",a),e.removeEventListener("compositionend",l);let y=zC.findIndex(w=>w.handle===g);y>=0&&zC.splice(y,1)}};return zC.push({handle:g,inputEl:e}),g}async function NL(r){let e=FY();if(!e)return P.logMessage("QuickAdd: image ingest skipped (no-active-prompt)."),{ok:!1,reason:"no-active-prompt"};if(e.handle.isBusy())return P.logMessage("QuickAdd: image ingest skipped (busy)."),{ok:!1,reason:"busy"};let t=await e.handle.ingestFiles(r);return t.length===0?{ok:!1,reason:"no-images"}:{ok:!0,inserted:t}}function ML(r,e,t){switch(r){case"paste":{if(e.getData("text/plain").length>0)return{kind:"stand-down"};let n=OL(e).map(i=>({origin:"bytes",...i,naming:{kind:"paste-name"}}));return n.length>0?{kind:"take",images:n}:{kind:"stand-down"}}case"drop":{let n=PY(e,t);if(n.length>0)return{kind:"take",images:n};let i=OL(e).map(o=>({origin:"bytes",...o,naming:BL(o)}));return i.length>0?{kind:"take",images:i}:{kind:"stand-down"}}default:return HC(r)}}function PY(r,e){let t=[];for(let n of r.getData("text/plain").split(/\r?\n/u)){let i=n.trim();if(i.length===0||i.toLowerCase().startsWith("file://")||Pr(i))continue;let o=e.vault.getAbstractFileByPath(i);$Y(o)&&t.push({origin:"vault",file:o})}return t}function $Y(r){return r!==null&&"extension"in r&&typeof r.extension=="string"&&FL(r.extension)}function OL(r){let e=[],t=0;for(let o of Array.from(r.items??[])){if(o.kind!=="file"||(t++,!kl(o.type)))continue;let s=o.getAsFile();s&&e.push({file:s,mimeType:o.type})}if(t>0&&e.length===t)return e;if(e.length===0){let o=[];for(let s of Array.from(r.files??[]))kl(s.type)&&o.push({file:s,mimeType:s.type});return o}let n=[...e],i=new Set(e.map(({file:o,mimeType:s})=>`${o.name}\0${o.size}\0${s}\0${o.lastModified}`));for(let o of Array.from(r.files??[])){if(!kl(o.type))continue;let s=`${o.name}\0${o.size}\0${o.type}\0${o.lastModified}`;i.has(s)||(i.add(s),n.push({file:o,mimeType:o.type}))}return n}function MY(r){return r.flatMap(e=>{if(!kl(e.type))return[];let t={file:e,mimeType:e.type};return[{origin:"bytes",...t,naming:BL(t)}]})}function BL(r){let e=$L(r.file.name);return e===null?{kind:"clipboard-stamp"}:{kind:"original-stem",stem:e}}function OY(r,e,t){switch(r.naming.kind){case"clipboard-stamp":return PL(r.mimeType,e);case"paste-name":return BC({extension:_l[r.mimeType],sourcePath:t,now:e,nameAfterNoteTitle:ne.getState().namePastedImagesAfterNoteTitle});case"original-stem":return`${r.naming.stem}.${_l[r.mimeType]}`;default:return HC(r.naming)}}function RL(r){return Array.from(r.types??[]).some(e=>e==="Files"||kl(e))}function HC(r){throw new Error(`Unexpected image intake value: ${String(r)}`)}function RY(r){let e=LL.then(r,r);return LL=e.catch(()=>{}),e}function LY(r,e){r.focus();let t=!1;try{t=r.ownerDocument.execCommand("insertText",!1,e)}catch{t=!1}if(t)return;let n=r.selectionStart??r.value.length,i=r.selectionEnd??n;r.setRangeText(e,n,i,"end"),r.dispatchEvent(new Event("input",{bubbles:!0}))}var Yg,zC,LL,Kg=k(()=>{Yg=require("obsidian");De();UC();ht();Sa();zC=[];LL=Promise.resolve()});function VL(r,e){return!r.isComposing&&r.key.toLowerCase()===e.toLowerCase()&&r.shiftKey&&(r.ctrlKey||r.metaKey)}function WC(r){return VL(r,"Enter")}function jC(r){return VL(r,Qg)}function UL(r){return r?`Look at the note without losing this draft. ${qL}`:"Look at the note without losing this draft."}function zL(){return`${qL} returns to the prompt`}var Qg,qL,df=k(()=>{Qg="E",qL="Ctrl/Cmd+Shift+E"});function HL(r,e,t,n){let i=Math.max(0,Math.min(e,r.length)),o=Math.max(i,Math.min(t,r.length));return{text:r.slice(0,i)+n+r.slice(o),cursor:i+n.length}}function WL(r,e=42){let t=r.slice(0,e*4),n=t.replace(/\s+/g," ").trim();return n.length<=e?t.length{});function KA(r){YA.add(r)}function QA(r){YA.delete(r)}function jL(){return YA.size>0}var YA,XA=k(()=>{YA=new Set});function NY(r,e){let t=new Set([e]);return r.workspace.iterateAllLeaves?.(i=>{let o=i.view?.containerEl?.ownerDocument;o&&t.add(o)}),[...t]}var Wn,Ls,Bc,ZA=k(()=>{Wn=require("obsidian");wa();Is();df();GA();XA();Ls=class Ls{constructor(e,t){this.app=e;this.handle=t;this.chipEl=null;this.insertButton=null;this.compactChrome=!1;this.returnScope=null;this.selectionDocuments=[];this.selectionListener=null;this.chipKeyListener=null;this.hasSelection=null;this.selectionPreview=""}static isPeeking(){return Ls.active!==null}static getActive(){return Ls.active}static activate(e,t){let n=Ls.active;if(n){let o=n.handle.title;n.cancel(),new Wn.Notice(`QuickAdd: cancelled the peeked prompt "${o}".`)}let i=new Ls(e,t);return Ls.active=i,i.mount(),i}static discard(){Ls.active?.destroy()}discard(){this.destroy()}resume(){if(!this.canReturnNow())return;let e=this.handle;this.destroy(),e.resume()}cancel(){let e=this.handle;this.destroy(),e.cancel()}insertSelectionAndResume(){if(!this.canReturnNow())return;let e=rd(this.app);if(!e){this.resume();return}let t=this.handle;this.destroy(),t.insertSelectionAndResume(e)}canReturnNow(){return jL()?(new Wn.Notice("QuickAdd: close the open prompt before returning to the peeked one."),!1):!0}mount(){let n=(this.app.workspace.containerEl?.ownerDocument??document).body;this.compactChrome=Wn.Platform.isPhone;let i=n.createDiv({cls:"qa-peek-chip"});i.setAttribute("role","status"),i.setAttribute("aria-live","polite"),this.compactChrome&&i.addClass("qa-peek-chip--compact","qa-peek-chip--top");let o=i.createDiv({cls:"qa-peek-chip-header"}),s=o.createEl("span",{cls:"qa-peek-chip-icon"});s.setAttribute("aria-hidden","true"),(0,Wn.setIcon)(s,"eye");let a=o.createDiv({cls:"qa-peek-chip-titles"});a.createDiv({cls:"qa-peek-chip-title",text:this.compactChrome?this.handle.title:"QuickAdd is waiting"}),this.compactChrome||(a.createDiv({cls:"qa-peek-chip-subtitle",text:this.handle.title}),i.createEl("p",{cls:"qa-peek-chip-hint",text:"Look at the note, copy or select text, then come back. Your draft is still there."}));let l=i.createDiv({cls:"qa-peek-chip-actions"});this.insertButton=new Wn.ButtonComponent(l).setButtonText(this.compactChrome?"Insert":"Insert selection").setCta().setTooltip("Drop the selected text into your draft and return").onClick(()=>this.insertSelectionAndResume()),this.insertButton.buttonEl.setAttribute("aria-label","Insert the selected text and return to QuickAdd"),new Wn.ButtonComponent(l).setButtonText("Return").setTooltip("Go back to the prompt without inserting").onClick(()=>this.resume());let c=new Wn.ButtonComponent(l).setTooltip("Discard this run").onClick(()=>this.cancel());if(c.buttonEl.addClass("qa-peek-chip-cancel"),c.buttonEl.setAttribute("aria-label","Cancel this run"),this.compactChrome){let u=nr(c.buttonEl,"span");u.className="qa-peek-chip-cancel-icon",u.setAttribute("aria-hidden","true"),(0,Wn.setIcon)(u,"x"),c.buttonEl.replaceChildren(u)}else c.setButtonText("Cancel");Wn.Platform.isMobile||i.createEl("p",{cls:"qa-peek-chip-keys",text:zL()}),this.chipEl=i,this.refreshInsertButton(),this.listenForSelection(),this.listenForChipEscape(),this.pushReturnShortcut()}listenForSelection(){let e=(0,Wn.debounce)(()=>this.refreshInsertButton(),100,!0);this.selectionListener=e,this.selectionDocuments=NY(this.app,this.chipEl?.ownerDocument??document);for(let t of this.selectionDocuments)t.addEventListener("selectionchange",e)}refreshInsertButton(){let e=this.insertButton;if(!e)return;let t=rd(this.app),n=t.length>0,i=n&&!this.compactChrome?WL(t):"";n===this.hasSelection&&i===this.selectionPreview||(this.hasSelection=n,this.selectionPreview=i,e.setDisabled(!n),e.buttonEl.classList.toggle("qa-peek-insert-ready",n),this.compactChrome||e.setButtonText(n?`Insert \u201C${i}\u201D`:"Insert selection"))}listenForChipEscape(){let e=this.chipEl;e&&(this.chipKeyListener=t=>{if(t.isComposing||t.key!=="Escape")return;let n=t.target;!(n instanceof Node)||!e.contains(n)||(t.preventDefault(),this.resume())},e.addEventListener("keydown",this.chipKeyListener))}pushReturnShortcut(){this.returnScope=new Wn.Scope(this.app.scope),this.returnScope.register(["Mod","Shift"],Qg,()=>(this.resume(),!1)),this.app.keymap.pushScope(this.returnScope)}destroy(){if(Ls.active===this&&(Ls.active=null),this.returnScope&&(this.app.keymap.popScope(this.returnScope),this.returnScope=null),this.chipKeyListener&&this.chipEl&&(this.chipEl.removeEventListener("keydown",this.chipKeyListener),this.chipKeyListener=null),this.selectionListener){for(let e of this.selectionDocuments)e.removeEventListener("selectionchange",this.selectionListener);this.selectionListener.cancel?.(),this.selectionListener=null}this.selectionDocuments=[],this.chipEl?.remove(),this.chipEl=null,this.insertButton=null}};Ls.active=null;Bc=Ls});function BY(r){ln(r)?.editor?.focus?.()}var GL,Vc,GC=k(()=>{wa();ZA();GA();XA();GL="qa-prompt-peek-hidden",Vc=class{constructor(e){this.host=e;this.peeking=!1;this.session=null}peek(){if(this.peeking)return;let e=this.host.getField();e&&this.host.setValue(e.value),this.host.persistDraft(),this.peeking=!0,this.hideModal(),this.session=Bc.activate(this.host.app,{title:this.host.title,resume:()=>this.resume(),cancel:()=>this.cancel(),insertSelectionAndResume:t=>this.insertSelectionAndResume(t)})}onHostOpened(){KA(this.host)}onHostClosed(){QA(this.host),this.peeking&&(this.peeking=!1,this.session?.discard(),this.session=null)}hideModal(){QA(this.host),this.host.containerEl.addClass(GL),this.host.app.keymap.popScope(this.host.scope),BY(this.host.app)}showModal(){this.host.app.keymap.pushScope(this.host.scope),this.host.containerEl.removeClass(GL),KA(this.host),this.host.getField()?.focus()}resume(){this.peeking&&(this.peeking=!1,this.session=null,this.showModal())}insertSelectionAndResume(e){if(!this.peeking)return;let t=this.host.getField();if(t){let n=t.selectionStart??t.value.length,i=t.selectionEnd??n,o=HL(t.value,n,i,e);t.value=o.text,t.setSelectionRange(o.cursor,o.cursor),this.host.setValue(o.text)}else this.host.setValue(this.host.getValue()+e);this.host.markDraftChanged(),this.host.persistDraft(),this.resume()}cancel(){this.peeking&&(this.peeking=!1,this.session=null,this.host.app.keymap.pushScope(this.host.scope),this.host.close())}}});function YL(r){return Xg.Platform.isPhone||(r?.innerWidth??Number.POSITIVE_INFINITY)<=540}function pf(r){let e=YL(r.ownerDocument.defaultView);return r.classList.toggle("qa-prompt-compact",e),e}function ff(r){let e=YL(r.buttonEl.ownerDocument.defaultView);r.setButtonText(e?qY:VY),r.setTooltip(UL(!Xg.Platform.isMobile)),r.buttonEl.setAttribute("aria-label","Peek at the note. Your draft stays."),r.buttonEl.classList.add("qa-peek-button");let t=nr(r.buttonEl,"span");return t.className="qa-peek-button-icon",t.setAttribute("aria-hidden","true"),(0,Xg.setIcon)(t,"eye"),r.buttonEl.prepend(t),r}var Xg,VY,qY,YC=k(()=>{Xg=require("obsidian");Is();df();VY="Peek at note",qY="Peek"});var mf,sr,Ns=k(()=>{mf=require("obsidian");AC();IC();RA();LA();NA();Kg();Er();GC();df();YC();sr=class r extends mf.Modal{constructor(t,n,i,o,s,a,l){super(t);this.header=n;this.linkSourcePath=s;this.options=l;this.didSubmit=!1;this.didClose=!1;this.submitClickCallback=t=>this.submit();this.cancelClickCallback=t=>this.cancel();this.skipClickCallback=t=>this.skip();this.submitEnterCallback=t=>{if(this.supportsPeek()&&jC(t)){t.preventDefault(),this.peek.peek();return}if(this.isOptionalPrompt&&WC(t)){t.preventDefault(),this.skip();return}!t.isComposing&&t.key==="Enter"&&(t.preventDefault(),this.submit())};this.placeholder=i??"",this.description=a?.trim()||void 0,this.draftHandler=new af({kind:"single",header:this.header,placeholder:this.placeholder,linkSourcePath:this.linkSourcePath,scopeId:l?.draftScopeId}),this.input=this.draftHandler.hydrate(o??""),this.waitForClose=new Promise((c,u)=>{this.resolvePromise=c,this.rejectPromise=u}),this.peek=new Vc({app:t,title:this.header,containerEl:this.containerEl,scope:this.scope,getField:()=>this.inputComponent?.inputEl,getValue:()=>this.input,setValue:c=>{this.input=c},markDraftChanged:()=>this.draftHandler.markChanged(),persistDraft:()=>this.persistDraft(),close:()=>this.close()}),this.display(),this.open(),this.attachSuggesters()}static Prompt(t,n,i,o,s,a){return new r(t,n,i,o,void 0,s,a).waitForClose}static PromptWithContext(t,n,i,o,s,a,l){return new r(t,n,i,o,s,a,l).waitForClose}display(){this.containerEl.addClass("quickAddModal","qaInputPrompt"),pf(this.containerEl),this.contentEl.empty(),this.titleEl.textContent=this.header,PC(this.contentEl,this.options?.contextLine,this.options?.contextLineFull),this.description&&this.contentEl.createDiv({text:this.description,cls:"setting-item-description"}).setCssStyles({marginBottom:"0.75rem"}),this.isOptionalPrompt&&this.contentEl.createDiv({text:"Optional \u2014 leave empty, press Skip, or ctrl/cmd+shift+\u21B5.",cls:"setting-item-description"}).setCssStyles({marginBottom:"0.75rem"});let t=this.contentEl.createDiv();this.inputComponent=this.createInputField(t,this.placeholder,this.input),this.createButtonBar(t)}get isOptionalPrompt(){return this.options?.optional===!0}supportsPeek(){return this.options?.allowPeek===!0}createInputField(t,n,i){let o=new mf.TextComponent(t);return o.inputEl.setCssStyles({width:"100%"}),o.setPlaceholder(n??"").setValue(i??"").onChange(s=>this.onInputChanged(s)).inputEl.addEventListener("keydown",this.submitEnterCallback),this.options?.imagePaste&&(this.imagePasteHandle=uf(this.app,o.inputEl,this.options.imagePaste)),o}createButton(t,n,i){let o=new mf.ButtonComponent(t);return o.setButtonText(n).onClick(i),o}createButtonBar(t){let n=t.createDiv({cls:"qa-prompt-actions"}),i=n.createDiv({cls:"qa-prompt-actions-primary"});if(this.createButton(i,"Ok",this.submitClickCallback).setCta().buttonEl.setCssStyles({marginRight:"0"}),this.createButton(i,"Cancel",this.cancelClickCallback),this.isOptionalPrompt){let o=this.createButton(i,"Skip",this.skipClickCallback);o.setTooltip("Leave this field empty"),o.buttonEl.setAttribute("aria-label","Skip and leave empty")}if(this.supportsPeek()){let o=n.createDiv({cls:"qa-prompt-actions-secondary"});ff(this.createButton(o,"Peek at note",()=>this.peek.peek()))}}transformInputOnSubmit(t){return t}submit(){if(this.didSubmit||this.didClose)return;if(this.imagePasteHandle?.isBusy()){this.imagePasteHandle.whenIdle().then(()=>this.submit());return}let t=this.inputComponent?.inputEl?.value??this.input;this.input=this.transformInputOnSubmit(t),this.didSubmit=!0,this.close()}skip(){this.input="",this.didSubmit=!0,this.close()}cancel(){this.close()}resolveInput(){this.didSubmit?this.resolvePromise(this.input):this.rejectPromise(Ir())}onInputChanged(t){this.draftHandler.markChanged(),this.input=t}syncInputFromEl(){this.inputComponent?.inputEl&&(this.input=this.inputComponent.inputEl.value)}persistDraft(){this.draftHandler.persist(this.input,this.didSubmit)}attachSuggesters(){this.fileSuggester=new Oc(this.app,this.inputComponent.inputEl,{sourcePath:this.linkSourcePath}),this.tagSuggester=new Rc(this.app,this.inputComponent.inputEl)}removeInputListener(){this.inputComponent.inputEl.removeEventListener("keydown",this.submitEnterCallback),this.imagePasteHandle?.detach()}onOpen(){super.onOpen(),this.peek.onHostOpened(),FC(this.inputComponent.inputEl,this.options)}onClose(){this.didClose=!0,this.didSubmit||this.syncInputFromEl(),this.persistDraft(),this.peek.onHostClosed(),this.resolveInput(),this.removeInputListener(),this.fileSuggester?.destroy(),this.tagSuggester?.destroy(),super.onClose()}}});function XL(r,e,t){return Array.isArray(r)?r.map(n=>QL(n,e,t)):QL(r,e,t)}function QL(r,e,t){if(e==="link")return t(r);let n=Ed(r);switch(n.kind){case"empty":return"";case"file":return e==="path"?n.path:Nc(n.path);case"custom":case"raw":return n.kind==="custom"?n.text:n.value}}var ZL=k(()=>{wo()});function t8(r){return ZY.test(r.trim())}function r8(r){let e=r.replace(JY,"");return e===r?!1:!e8.test(e)}function QC(r,e){return QY.has(r)?r8(e):t8(e)}function XC(r){return r==="noteTitle"||r==="captureTarget"||r==="folder"||r==="templatePath"||r==="lineTarget"||r==="filePath"}function JA(r){return r!=="templatePath"&&r!=="generic"}function ZC(r,e){if(r==="generic")return{};let t=XY[r];return e?{title:t.ask,placeholder:t.hint}:{placeholder:t.partOf}}function n8(r,e=44){if(r.length<=e)return r;let t=r.split("/");if(t.length===1)return r;let n=t[t.length-1];if(t.length===2){let s=`${JL}/${n}`;return s.length{Je();QY=new Set(["captureText"]),XY={noteTitle:{ask:"Note title",hint:"Title for the new note",partOf:"Part of the new note's title"},captureTarget:{ask:"Capture target",hint:"Where to capture to",partOf:"Part of the capture destination"},captureText:{ask:"Text to capture",hint:"Text to add to the note",partOf:"Part of the text added to the note"},noteBody:{ask:"Note content",hint:"Text inserted into the note",partOf:"Part of the text inserted into the note"},folder:{ask:"Folder",hint:"Folder for the new note",partOf:"Part of the folder path"},templatePath:{ask:"Template",hint:"Path to the template file",partOf:"Part of the template path"},lineTarget:{ask:"Line to find",hint:"Existing line to anchor the capture to",partOf:"Part of the line to find"},filePath:{ask:"File to open",hint:"Path to the file to open",partOf:"Part of the file path"}},ZY=new RegExp(`^(?:${pl.source})$`,"i"),JY=new RegExp(pl.source,"gi"),e8=/\{\{[^}\n\r]*\}\}/;JL="\u2026"});function tv(r,e){if(!r||!e)return null;let t=r,n=t.metadataTypeManager??t.metadataCache?.app?.metadataTypeManager;if(!n||typeof n.getTypeInfo!="function")return null;let i=n.getTypeInfo(e),o=i?.expected?.type??i?.inferred?.type;return typeof o=="string"?o:null}function s8(r){return r!==null&&i8.has(r.toLowerCase())}function eN(r,e){return o8.has(e.toLowerCase())||s8(tv(r,e))}var i8,o8,JC=k(()=>{i8=new Set(["aliases","list","multitext","tags"]),o8=new Set(["aliases","cssclasses","tags"])});function a8(r,e=","){let t=[],n="",i=[],o=null;for(let a=0;a=0&&r[u]==="\\";u--)c++;c%2===0&&(o=null)}continue}if(l==='"'){o=l,n+=l;continue}if(l in tN){i.push(tN[l]),n+=l;continue}if(i.length>0){let c=i[i.length-1];l===c&&i.pop(),n+=l;continue}if(l===e){let c=n.trim();c.length>0&&t.push(c),n="";continue}n+=l}let s=n.trim();return s.length>0&&t.push(s),t}function l8(r){return r.includes(` `)?r.replace(/\r?\n/g,` `):r.includes("\\n")?r.replace(/\\n/g,` `):r}function c8(r){if(!r)return!1;let e=r.toLowerCase();return e==="list"||e==="tags"||e==="multitext"}function rN(r,e){let t=r.trim();if(!t)return;let n=l8(t),i=e?.propertyType??tv(e?.app,e?.propertyKey),o=c8(i),a=o||i===null,c=n.split(/\n/).map(u=>u.trim()).filter(u=>u.length>0);if(a&&c.length>0&&c.every(u=>/^-\s+/.test(u)))return c.map(u=>u.replace(/^-[\s]*/,"").trim());if(n.startsWith("[")&&n.endsWith("]")||n.startsWith("{")&&n.endsWith("}")){if(i&&!o&&i!=="list")return;try{return JSON.parse(n)}catch{}}if(n.includes(",")&&a){let u=a8(n);if(u.length>1)return u}}var tN,nN=k(()=>{JC();tN={"[":"]","(":")","{":"}","<":">"}});function eE(r){if(typeof r=="string"&&r.startsWith("@date:")){let e=r.substring(6),t=new Date(e);if(!Number.isNaN(t.getTime()))return t}return r}function eD(r){return typeof r!="string"&&(Array.isArray(r)||typeof r=="object"&&r!==null||typeof r=="number"||typeof r=="boolean"||r===null)}function iN(r){return Array.isArray(r)||typeof r=="object"&&r!==null}function oN(r){if(eD(r))return Array.isArray(r)?"[]":r===null?"null":typeof r=="object"?"{}":String(r)}var rv=k(()=>{});var sN,Bs,tE=k(()=>{BA();nN();rv();JC();sN="\0",Bs=class{constructor(e){this.app=e;this.map=new Map;this.propertyTypeCache=new Map}maybeCollect(e){let{input:t,matchStart:n,matchEnd:i,rawValue:o,fallbackKey:s,collectionActive:a,heuristicEnabled:l}=e;if(!a)return;let c=Bg(t),u=Vg(t,n,i,c);if(!u.isInYaml)return;let d=t.slice(u.lineStart,u.lineEnd),f=d.trim(),p=d.match(/^\s*([^:]+):/),m=p?p[1].trim():s,v=/^-\s*['"]?\{\{(?:VALUE|FIELD|FILE):[^}]+\}\}['"]?\s*$/i,g=null;if(u.isKeyValuePosition?g=[m]:v.test(f)&&(g=this.findListParentPath(t,u.lineStart,u.baseIndent??"")),!g||g.length===0)return;let y=g[g.length-1],w=o;if(l&&typeof o=="string"){let b=rN(o,this.buildParseOptions(y));b!==void 0&&(w=b)}if(!eD(w)||Array.isArray(w)&&w.length===0||!l&&!iN(w))return;let T=g.join(sN);return this.map.set(T,w),w}drain(){let e=new Map(this.map);return this.map.clear(),e}merge(e){for(let[t,n]of e)this.map.set(t,n)}buildParseOptions(e){return{propertyKey:e,propertyType:this.resolvePropertyType(e),app:this.app}}findListParentPath(e,t,n){let i=t-1,o=[],s=n.length;for(;i>=0;){let a=e.lastIndexOf(` `,i),l=a===-1?0:a+1,c=e.slice(l,i+1),u=c.trim();if(u.length===0){i=l-2;continue}if(u==="---"||u==="...")break;if(u.startsWith("-")){i=l-2;continue}let d=c.match(/^(\s*)([^:\n]+):/);if(d){let p=(d[1]??"").length;if(p0?o:null}resolvePropertyType(e){if(!this.app)return null;if(this.propertyTypeCache.has(e))return this.propertyTypeCache.get(e)??null;let t=tv(this.app,e);return this.propertyTypeCache.set(e,t),t}};Bs.PATH_SEPARATOR=sN});function aN(r){if(!r)return null;let e=r.trim().toLowerCase();switch(e){case"kebab":case"snake":case"camel":case"pascal":case"title":case"lower":case"upper":case"slug":return e;default:return null}}function iv(r){return aN(r)!==null}function tD(r){if(!r)return r;let e=r.toLowerCase();return e.slice(0,1).toUpperCase()+e.slice(1)}function rD(r){return/\p{L}/u.test(r)?/\p{Lu}/u.test(r)&&!/\p{Ll}/u.test(r):!1}function rE(r){return/\p{Lu}/u.test(r)&&/\p{Ll}/u.test(r)}function u8(r){return/^\p{Ll}/u.test(r)&&rE(r)}function d8(r){if(!r)return[];{let t=r.match(/^([\p{Ll}][\p{Lu}]{2,})([\p{N}]+)?$/u);if(t){let n=[t[1]];return t[2]&&n.push(t[2]),n}}if(/^[\p{Ll}][\p{Lu}][\p{Ll}]+(?:[\p{Lu}][\p{Ll}]+)*$/u.test(r))return[r];let e=r;return e=e.replace(/([\p{Lu}])([\p{Lu}][\p{Ll}])/gu,"$1 $2"),e=e.replace(/([\p{Ll}\p{N}])([\p{Lu}])/gu,"$1 $2"),e=e.replace(/([\p{L}])([\p{N}])/gu,"$1 $2"),e=e.replace(/([\p{N}])([\p{L}])/gu,"$1 $2"),e.trim().split(/\s+/u).map(t=>t.trim()).filter(Boolean)}function p8(r){return r.split(/[^\p{L}\p{N}\p{M}]+/gu).filter(Boolean).flatMap(d8).filter(Boolean)}function ov(r,e){let t=aN(e);if(!t)return r;if(t==="lower")return r.toLowerCase();if(t==="upper")return r.toUpperCase();let n=p8(r);if(n.length===0)return"";switch(t){case"kebab":return n.map(i=>i.toLowerCase()).join("-");case"snake":return n.map(i=>i.toLowerCase()).join("_");case"camel":{let[i,...o]=n,s=i?u8(i)?i:i.toLowerCase():"",a=o.map(l=>rD(l)||rE(l)?l:tD(l));return[s,...a].join("")}case"pascal":return n.map(i=>rD(i)||rE(i)?i:tD(i)).join("");case"title":return n.map(i=>rD(i)||rE(i)?i:tD(i)).join(" ");case"slug":{let i=n.map(o=>o.toLowerCase()).join("-");return xd(i)?`${i}-`:i}default:return r}}var nv,nE=k(()=>{Gg();nv=["kebab","snake","camel","pascal","title","lower","upper","slug"]});function iE(r){let e=r.trim();return e&&(/^\[\[.*\]\]$/.test(e)?e:`[[${e}]]`)}var nD=k(()=>{});function h8(r,e,t){return t&&e?`${r}${iD}${e}`:r}function av(r){let e=r.indexOf(iD);return e===-1?r:r.slice(0,e)}function g8(r,e){let t=e.toLowerCase(),n=null;for(let i of r.keys())if(i.toLowerCase()===t&&r.get(i)!==void 0){if(n)return null;n=i}return n}function qc(r,e){if(!e)return null;let t=[e],n=av(e);n!==e&&t.push(n);for(let i of t){if(r.has(i)&&r.get(i)!==void 0)return i;let o=g8(r,i);if(o)return o}return null}function v8(r){let{remaining:e,found:t}=Ps(r,"optional");return{remaining:e,optional:t}}function dN(r){let{remaining:e,optional:t}=v8(r),{remaining:n,found:i}=Ps(e,"trim");return{remaining:n,optional:t,trim:i}}function y8(r,e){let t=r.trim();if(!t)return!1;let n=Oi(t);return n?(e?oD:sE).has(n.key):!1}function b8(r,e){let t=e?oD:sE;return r.some(n=>{let i=Oi(n.trim());if(!i||i.key!=="type"||!t.has("type"))return!1;let o=i.value.trim().toLowerCase();return o==="number"||o==="slider"})}function pN(r,e,t,n,i){if(r.length===0)return{defaultValue:"",allowCustomInput:!1,usesOptions:!1};let o=t?oD:sE,s=b8(r,t),a=r.some(B=>y8(B,t)||s&&lN.has(Oi(B.trim())?.key??"")),l=e&&r.some(B=>B.trim().toLowerCase()==="custom"),c=e&&r.some(B=>B.trim().toLowerCase()==="multi");if(!(a||l||c))return{defaultValue:r.join("|").trim(),allowCustomInput:!1,usesOptions:!1};let d,f,p="",m=!1,v,g,y,w,T,b,E,C,_=!1,I,q;for(let B of r){let J=B.trim();if(!J)continue;if(e&&J.toLowerCase()==="custom"){m=!0;continue}if(e&&J.toLowerCase()==="multi"){_=!0;continue}let re=Oi(J);if(!re)continue;let{key:L,value:W}=re;if(!(!o.has(L)&&!(s&&lN.has(L))))switch(L){case"label":W&&(d=W);break;case"case":W&&(f=W);break;case"default":p=W;break;case"custom":m=Sc(W);break;case"type":W&&(v=W);break;case"min":g=W;break;case"max":y=W;break;case"step":w=W;break;case"text":T=W;break;case"optional":b=Sc(W);break;case"trim":E=Sc(W);break;case"multi":_=!0,I=W.trim().toLowerCase()==="linklist"?"linklist":"text";break;case"format":q=MC(W,n,i);break;case"name":W?C=W:i(`QuickAdd: empty |name: ignored in "${n}"; provide a variable name, e.g. {{VALUE:a,b|name:category}}.`);break;default:break}}return{label:d,caseStyle:f,defaultValue:p,allowCustomInput:m,name:C,usesOptions:!0,inputTypeOverride:v,minRaw:g,maxRaw:y,stepRaw:w,displayValuesRaw:T,optionalExplicit:b,trimExplicit:E,multiSelect:_,multiEmit:I,multiFormat:q}}function fN(r,{tokenDisplay:e,hasOptions:t,allowCustomInput:n},i){if(!r)return;let o=r.trim().toLowerCase(),s=o==="boolean"?"checkbox":o;if(!f8.has(s)){i(`QuickAdd: Unsupported VALUE type "${r}" in token "${e}". Supported types: multiline, number, slider, checkbox, text.`);return}if(t||n){i(`QuickAdd: Ignoring type:${s} for option-list VALUE token "${e}".`);return}return s}function gf(r){if(r===void 0)return;let e=r.trim();if(!e)return;let t=Number(e);return Number.isFinite(t)?t:void 0}function w8(r){return r.minRaw!==void 0||r.maxRaw!==void 0||r.stepRaw!==void 0}function cN(r,e,t){let n=gf(r.minRaw),i=gf(r.maxRaw),o=gf(r.stepRaw),s={};return r.minRaw!==void 0&&(n===void 0?t(`QuickAdd: Ignoring invalid min in VALUE token "${e}".`):s.min=n),r.maxRaw!==void 0&&(i===void 0?t(`QuickAdd: Ignoring invalid max in VALUE token "${e}".`):s.max=i),s.min!==void 0&&s.max!==void 0&&s.max0?s:void 0}function mN(r,e,t,n){if(t!=="number"&&t!=="slider")return w8(r)&&n(`QuickAdd: Ignoring numeric range options in "${e}" because type is not number or slider.`),{inputTypeOverride:t};if(t!=="slider"){let c=cN(r,e,n);return{inputTypeOverride:t,numericConfig:c}}let i=gf(r.minRaw),o=gf(r.maxRaw),s=r.stepRaw===void 0?1:gf(r.stepRaw),a=i===void 0||o===void 0?"slider requires finite min and max values":o<=i?"max must be greater than min":s===void 0||s<=0?"step must be greater than 0":void 0;if(a)return n(`QuickAdd: Invalid slider configuration in "${e}" (${a}); falling back to type:number.`),{inputTypeOverride:"number",numericConfig:cN(r,e,Ng)};let l={min:i,max:o,step:s};return{inputTypeOverride:t,numericConfig:l,sliderConfig:l}}function uN(r){let e=String(r),t=/e-(\d+)$/i.exec(e);if(t)return Number(t[1]);let n=e.indexOf(".");return n===-1?0:e.length-n-1}function C8(r,e){return String(Number(r.toFixed(e)))}function Vs(r,e){let t=r?.trim()??"";if(!t)return"";let n=Number(t);if(!Number.isFinite(n))return"";let i=e?.min,o=e?.max,s=n;if(i!==void 0&&(s=Math.max(i,s)),o!==void 0&&(s=Math.min(o,s)),e?.step!==void 0&&e.step>0){let a=i??0,l=Math.round((s-a)/e.step);s=a+l*e.step,i!==void 0&&(s=Math.max(i,s)),o!==void 0&&(s=Math.min(o,s));let c=Math.max(uN(a),uN(e.step));return C8(s,c)}return String(s)}function lv(r,e){return Vs(r,e)||String(e.min)}function oE(r){return r!==void 0&&E8.has(r)}function sv(r){let e=[],t="",n=!1;for(let i=0;i=r.length||r[s]===","){n=!1,i=s-1;continue}return r.split(",")}t+=o;continue}if(o===","){e.push(t),t="";continue}if(oE(o)&&t.trim()===""){n=!0,t="";continue}t+=o}return n?r.split(","):(e.push(t),e)}function sD(r){let e=r.trim();if(!oE(e[0]))return r;let t=sv(e);return t.length===1&&t[0]!==e?t[0].trim():r}function cv(r,e){if(!r)return null;let t=e?.warn??lf,n=Yo(r),i=(n.shift()??"").trim();if(!i)return null;let o=sv(i).map(B=>B.trim()).filter(Boolean),s=o.length>1,{remaining:a,optional:l,trim:c}=dN(n),u=`{{VALUE:${r}}}`,d=pN(a,s,!0,u,t),{label:f,caseStyle:p,defaultValue:m,allowCustomInput:v}=d,g=d.multiSelect??!1,y=d.multiEmit??"text",w=d.multiFormat??"auto",T=d.optionalExplicit??l,b=d.trimExplicit??c;if(!d.usesOptions){let B=m;v=s&&B.toLowerCase()==="custom",m=v?"":B}s&&m&&(m=sD(m));let E=fN(d.inputTypeOverride,{tokenDisplay:u,hasOptions:s,allowCustomInput:v},t),C=mN(d,u,E,t),_;if(d.displayValuesRaw!==void 0){if(!s)throw new Error(`QuickAdd: VALUE option "text" is only supported for option-list tokens in "${u}".`);if(_=sv(d.displayValuesRaw).map(B=>B.trim()).filter(Boolean),_.length!==o.length)throw new Error(`QuickAdd: VALUE token "${u}" must define the same number of text entries and item entries. To include a comma inside one entry, wrap it in double quotes, e.g. "a, b".`);if(new Set(_).size!==_.length)throw new Error(`QuickAdd: VALUE token "${u}" has duplicate text entries. Text entries must be unique.`)}let I=d.name?.trim()||void 0;I&&I.includes(iD)&&(t(`QuickAdd: |name in "${u}" contains a reserved control character and was ignored.`),I=void 0),I&&m8.has(I.toLowerCase())&&(t(`QuickAdd: |name:${I} is reserved and was ignored in "${u}". Choose a different name.`),I=void 0),I&&!s&&t(`QuickAdd: |name on a single value in "${u}" is redundant \u2014 use {{VALUE:${I}}} directly.`),p&&!iv(p)&&(t(`QuickAdd: Unsupported |case style "${p}" in token "${u}". Supported styles: ${nv.join(", ")}.`),p=void 0),g&&!s&&(t(`QuickAdd: |multi needs an option list (2+ comma-separated values) in "${u}"; ignoring.`),g=!1),g&&p&&(t(`QuickAdd: |case is ignored with |multi in "${u}" \u2014 a list is not case-transformed.`),p=void 0),!g&&d.multiFormat!==void 0&&(t(`QuickAdd: |format: needs |multi in "${u}"; ignoring.`),w="auto"),!s&&!d.usesOptions&&a.some(B=>B.trim().toLowerCase()==="custom")&&(t(`QuickAdd: |custom needs an option list (2+ comma-separated values) in "${u}"; ignoring.`),m.toLowerCase()==="custom"&&(m=""));let q=I||h8(i,f,s);return{raw:r,variableName:i,aliasName:I,variableKey:q,label:f,caseStyle:p,defaultValue:m,allowCustomInput:v,suggestedValues:o,displayValues:_,hasOptions:s,inputTypeOverride:C.inputTypeOverride,numericConfig:C.numericConfig,sliderConfig:C.sliderConfig,optional:T,trim:b,multiSelect:g,multiEmit:y,multiFormat:w}}function aD(r,e){let t=e?.warn??lf,n=KO(r),i=Yo(n).map(v=>v.trim()).filter(Boolean),{remaining:o,optional:s,trim:a}=dN(i);if(o.length===0)return{defaultValue:"",optional:s,trim:a};let l=`{{VALUE${r}}}`,c=pN(o,!1,!1,l,t);if(c.displayValuesRaw!==void 0)throw new Error(`QuickAdd: VALUE option "text" is only supported for option-list tokens in "${l}".`);let{label:u,caseStyle:d,defaultValue:f}=c;c.usesOptions||(f=f.trim()),d&&!iv(d)&&(t(`QuickAdd: Unsupported |case style "${d}" in token "${l}". Supported styles: ${nv.join(", ")}.`),d=void 0);let p=fN(c.inputTypeOverride,{tokenDisplay:l,hasOptions:!1,allowCustomInput:c.allowCustomInput},t),m=mN(c,l,p,t);return{label:u,caseStyle:d,defaultValue:f,inputTypeOverride:m.inputTypeOverride,numericConfig:m.numericConfig,sliderConfig:m.sliderConfig,optional:c.optionalExplicit??s,trim:c.trimExplicit??a}}var iD,f8,lN,sE,oD,m8,E8,x8,es=k(()=>{dd();nE();OC();$C();iD="",f8=new Set(["multiline","number","slider","checkbox","text"]),lN=new Set(["min","max","step"]),sE=new Set(["label","default","custom","type","case","text","optional","trim","multi","format"]),oD=new Set([...sE,"name"]),m8=new Set(["value","title"]);E8=new Set(['"',"\u201C","\u201D"]);x8=/[^\S\r\n]/});function uv(r){if(!r)return{optional:!1,withTime:!1};let{remaining:e,found:t}=Ps(Yo(r),"optional"),{remaining:n,found:i}=Ps(e,"time"),{remaining:o,found:s}=Ps(n,"datetime"),a,l=!1,c,u,d=[];for(let p of o){let m=Oi(p.trim());if(m?.key==="optional"){a=Sc(m.value);continue}if(m?.key==="type"){m.value.trim().toLowerCase()==="datetime"&&(l=!0);continue}if(m?.key==="startof"||m?.key==="endof"){c||(c={boundary:m.key==="startof"?"start":"end",unit:iC(m.value)});continue}if(m?.key==="case"){u=m.value.trim()||void 0;continue}d.push(p)}return{defaultValue:d.join("|").trim()||void 0,optional:a??t,withTime:i||s||l,snap:c,...u?{caseStyle:u}:{}}}function aE(r){try{return{options:uv(r)}}catch(e){return{options:{optional:!1,withTime:!1},error:e instanceof Error?e.message:String(e)}}}var dv=k(()=>{dd();Tg()});function hN(r){if(!r)return null;let e=r.indexOf("|");if(e===-1){let o=r.trim();return o?{macroName:o}:null}let t=r.slice(0,e).trim();if(!t)return null;let n=r.slice(e+1).trim();if(!n)return{macroName:t};if(!n.toLowerCase().startsWith("label:"))return null;let i=n.slice(6).trim();return{macroName:t,label:i||void 0}}var gN=k(()=>{});function Uc(r){if(r==null)return"";if(typeof r=="string")return r;if(typeof r=="number"||typeof r=="boolean")return String(r);if(typeof r=="bigint"||typeof r=="symbol")return r.toString();if(r instanceof Error)return r.message;try{return JSON.stringify(r)??Object.prototype.toString.call(r)}catch{return Object.prototype.toString.call(r)}}function zc(r){return T8.includes(r)}function bN(r){switch(r){case"lessThan":case"lessThanOrEqual":case"greaterThan":case"greaterThanOrEqual":return"number";case"equals":case"notEquals":return"string";case"contains":case"notContains":return"string";default:return"boolean"}}function wN(r){if(!zc(r.operator)||r.expectedValue===void 0||r.expectedValue===null)return;let e=r.expectedValue.trim();switch(r.valueType){case"number":{let t=Number(e);return Number.isNaN(t)?NaN:t}case"boolean":{let t=e.toLowerCase();return vN.has(t)?!0:yN.has(t)?!1:!!e}default:return e}}function lD(r,e){switch(e){case"number":return typeof r=="number"?r:typeof r=="boolean"?r?1:0:Number(r);case"boolean":if(typeof r=="boolean")return r;if(typeof r=="string"){let t=r.trim().toLowerCase();if(vN.has(t))return!0;if(yN.has(t))return!1}return!!r;default:return r==null?"":Uc(r)}}function S8(r){if(!zc(r.operator))return"";let e=r.expectedValue??"";return e.length===0?"(empty)":r.valueType==="string"?`"${e}"`:e}function _8(r){let e=r.variableName?`$${r.variableName}`:"(missing variable)",t=A8(r.operator),n=zc(r.operator)?` ${S8(r)}`:"";return`${e} ${t}${n}`.trim()}function k8(r){let e=r.exportName?`::${r.exportName}`:"";return`script ${r.scriptPath}${e}`}function vf(r){return r.mode==="variable"?_8(r):k8(r)}function A8(r){switch(r){case"equals":return"equals";case"notEquals":return"does not equal";case"lessThan":return"is less than";case"lessThanOrEqual":return"is less than or equal to";case"greaterThan":return"is greater than";case"greaterThanOrEqual":return"is greater than or equal to";case"contains":return"contains";case"notContains":return"does not contain";case"isTruthy":return"is truthy";case"isFalsy":return"is falsy";default:return r}}var T8,vN,yN,yf=k(()=>{T8=["equals","notEquals","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","contains","notContains"],vN=new Set(["true","1","yes","on"]),yN=new Set(["false","0","no","off"])});function pv(r){let e=[],t=r.length,n=0;for(;n=3){a=c;break}s=c}if(a===-1)break;e.push({start:i,end:a}),n=a}return e}function EN(r){let e=pv(r),t=r.length,n=e.length>0?e[e.length-1].end:0;for(;n=3&&r.startsWith(cD,o))return!0;n=o}return!1}function fv(r){return r?"YYYY-MM-DD HH:mm":"YYYY-MM-DD"}function mv(r,e,t,n){if(r===void 0)return null;let i=r,o;if(typeof i=="string"&&i&&!i.startsWith("@date:")){if(n){let s=ne.getState().dateAliases,a=n.parseDate(lg(i,s));a&&(o=`@date:${a.moment.toISOString()}`,i=o)}}else i instanceof Date&&(Number.isNaN(i.getTime())||(o=`@date:${i.toISOString()}`,i=o));if(typeof i=="string"&&i.startsWith("@date:")){let s=i.substring(6);if(n&&window.moment){let a=window.moment(s);if(a?.isValid())return{text:jp(a,t).format(e),...o!==void 0?{normalized:o}:{}}}return{text:"",...o!==void 0?{normalized:o}:{}}}return typeof i=="string"&&i?{text:i}:i!=null?{text:Uc(i)}:{text:""}}var CN,D8,lE,cD,_a,bf=k(()=>{CN=require("obsidian");Je();wo();ZL();ev();Dt();De();tE();ht();Ku();nE();rv();UA();OC();nD();Lc();es();$C();dv();Tg();gN();yf();D8=new Set(["number","slider","checkbox"]),lE=10,cD="js quickadd";_a=class{constructor(e){this.app=e;this.variables=new Map;this.linkToCurrentFileBehavior="required";this.targetFolderPath=null;this.promptScope="generic";this.promptScopeSoleValue=!1;this.templatePropertyCollectionDepth=0;this.namedSuggesterOptionSigs=new Map;this.namedSuggesterConflictsWarned=new Set;this.warnSink=e=>this.warn(e);this.propertyCollector=new Bs(e)}runClocks(){return this.clocks}warn(e){P.logWarning(e)}reportProblem(e){P.logError(e)}setTemplateInclusionState(e){this.templateInclusion=e}setPromptRunContext(e){this.promptRunContext={...this.promptRunContext,...e}}getPromptRunContext(){return this.promptRunContext}async withPromptScope(e,t,n){let i=this.promptScope,o=this.promptScopeSoleValue;this.promptScope=e,this.promptScopeSoleValue=QC(e,t);try{return await n()}finally{this.promptScope=i,this.promptScopeSoleValue=o}}hasConcreteVariable(e){return this.variables.has(e)?this.variables.get(e)!==void 0:!1}setTitle(e){this.hasConcreteVariable("title")||this.variables.set("title",e)}getAnonymousValue(){return this.value}replacer(e,t,n){return e.replace(t,function(){return n})}applyCaseOption(e,t,n){return t?iv(t)?ov(e,t):(this.warn(`QuickAdd: Unsupported |case style "${t}" in token "${n}". Supported styles: ${nv.join(", ")}.`),e):e}replaceDateInString(e){let t=e;for(;Mw.test(t);){let n=Mw.exec(t),i;if(n&&n[1]){let l=n[1].replace("+","").trim();yk.test(l)&&(i=parseInt(l))}let o=n?.[2]?Wk(n[2])??void 0:void 0,s=this.runClocks(),a=Ko({offset:i,snap:o,origin:s?.date,now:s?.now});t=this.replacer(t,Mw,this.applyCaseOption(a,n?.[3],n?.[0]??"{{DATE}}"))}for(;Mp.test(t);){let n=Mp.exec(t);if(!n)throw new Error(`Unable to parse date format. Invalid syntax in: "${t.substring(Math.max(0,t.search(Mp)-10),Math.min(t.length,t.search(Mp)+30))}..."`);let i=n[1],o;if(n[2]){let c=n[2].replace("+","").trim();yk.test(c)&&(o=parseInt(c))}let s=n[3]?Wk(n[3])??void 0:void 0,a=this.runClocks(),l=Ko({format:i,offset:o,snap:s,origin:a?.date,now:a?.now});t=this.replacer(t,Mp,this.applyCaseOption(l,n[4],n[0]))}return t}replaceTimeInString(e){let t=e;for(;Op.test(t);){let n=Op.exec(t);if(!n)throw new Error(`Unable to parse time format. Invalid syntax in: "${t.substring(Math.max(0,t.search(Op)-10),Math.min(t.length,t.search(Op)+30))}..."`);let i=Ko({format:"HH:mm",now:this.runClocks()?.now});t=this.replacer(t,Op,this.applyCaseOption(i,n[1],n[0]))}for(;Rp.test(t);){let n=Rp.exec(t);if(!n)throw new Error(`Unable to parse formatted time. Invalid syntax in: "${t.substring(Math.max(0,t.search(Rp)-10),Math.min(t.length,t.search(Rp)+30))}..."`);let i=n[1],o=Ko({format:i,now:this.runClocks()?.now});t=this.replacer(t,Rp,this.applyCaseOption(o,n[2],n[0]))}return t}async replaceValueInString(e){let t=e;if(!pl.test(t))return t;if(this.valuePromptContext=this.getValuePromptContext(t),this.hasConcreteVariable("value")){let i=this.variables.get("value");this.value=Uc(i)}this.value===void 0&&(this.value=await this.promptForValue());let n=new RegExp(pl.source,"gi");return t=t.replace(n,(...i)=>{let o=i[0],s=i[i.length-2],a=i[i.length-1],l=o.slice(2,-2),c=l.indexOf("|");if(c===-1)return cf(a,s,s+o.length,this.value);let u=l.slice(c),d=aD(u,{warn:this.warnSink}),f=this.value===""&&d.defaultValue&&!d.optional?d.defaultValue:this.value,p=this.applyValueTextOptions(f,d);return d.inputTypeOverride==="text"&&p!==""&&qA(a,s,s+o.length)?qg(p):cf(a,s,s+o.length,p)}),t}applyValueTextOptions(e,t){let n=String(e??""),i=t.trim?n.trim():n;return ov(i,t.caseStyle)}applyValueTokenOptions(e,t){return Array.isArray(e)?t.trim?e.map(n=>typeof n=="string"?n.trim():n):e:typeof e=="string"?this.applyValueTextOptions(e,t):e}getValuePromptContext(e){let t=new RegExp(pl.source,"gi"),n,i;for(;(n=t.exec(e))!==null;){let s=n[0].slice(2,-2),a=s.indexOf("|");if(a===-1)continue;let l=s.slice(a),c=aD(l,{warn:Ng});i||(i={}),!i.description&&c.label&&(i.description=c.label),!i.defaultValue&&c.defaultValue&&(i.defaultValue=c.defaultValue),c.inputTypeOverride&&!i.inputTypeOverride&&(i.inputTypeOverride=c.inputTypeOverride),c.numericConfig&&!i.numericConfig&&(i.numericConfig=c.numericConfig),c.sliderConfig&&!i.sliderConfig&&(i.sliderConfig=c.sliderConfig),c.optional&&(i.optional=!0)}return i}async replaceSelectedInString(e){if(!Ek.test(e))return e;let t=await this.getSelectedText(),n=new RegExp(Ek.source,"gi");return e.replace(n,()=>t)}async replaceClipboardInString(e){if(!xk.test(e))return e;let t=await this.getClipboardContent(),n=new RegExp(xk.source,"gi");return e.replace(n,()=>t)}async replaceLinkToCurrentFileInString(e){if(!bk.test(e))return e;let t=this.getCurrentFileLink();if(!t){if(this.linkToCurrentFileBehavior==="required")throw new Error("Unable to get current file path. Make sure you have a file open in the editor.");P.logMessage("Skipping {{LINKCURRENT}} replacement because no active file is available.")}let n=new RegExp(bk.source,"gi");return e.replace(n,()=>t??"")}replaceLinkToCurrentSectionInString(e){if(!wk.test(e))return e;let t=this.getCurrentFileLinkToSection();if(!t){if(this.linkToCurrentFileBehavior==="required")throw new Error("Unable to get current file path. Make sure you have a file open in the editor.");P.logMessage("Skipping {{LINKSECTION}} replacement because no active file is available.")}let n=new RegExp(wk.source,"gi");return e.replace(n,()=>t??"")}replaceCurrentFileLinksInString(e){return this.replaceCurrentFileTokensInString(e,{links:!0})}replaceCurrentFileTokensInString(e,t){let n=/{{(?:(LINKCURRENT|LINKSECTION|FILENAMECURRENT|TITLE)|(FOLDERCURRENT|FOLDER)(\|name)?)}}/gi,i,o,s,a,l,c,u,d,f=!1,p=!1,m=!1,v=e.replace(n,(y,w,T,b)=>{if(T!==void 0&&T.toUpperCase()==="FOLDERCURRENT"){if(!t.activeFolder)return y;if(c===void 0)if(c=this.getCurrentFolderPath(),c===null)u=null;else{let E=c.lastIndexOf("/");u=E===-1?c:c.slice(E+1)}return c===null&&(m=!0),(b?u:c)??""}if(T!==void 0){if(!t.folder)return y;if(a===void 0){a=this.targetFolderPath??"";let E=a.lastIndexOf("/");l=E===-1?a:a.slice(E+1)}return b?l:a}switch((w??"").toUpperCase()){case"LINKCURRENT":return t.links?(i===void 0&&(i=this.getCurrentFileLink()??null),i||(f=!0),i??""):y;case"LINKSECTION":return t.links?(o===void 0&&(o=this.getCurrentFileLinkToSection()??null),o||(f=!0),o??""):y;case"FILENAMECURRENT":return t.fileName?(s===void 0&&(s=this.getCurrentFileName()??null),s||(p=!0),s??""):y;case"TITLE":return t.title?(d===void 0&&(d=this.getVariableValue("title")),d):y}return y}),g="Unable to get the active file's folder. Make sure you have a file open in the editor.";if(m&&t.activeFolder==="path")throw new Error(g);if(f||p||m){if(this.linkToCurrentFileBehavior==="required")throw new Error(f?"Unable to get current file path. Make sure you have a file open in the editor.":p?"Unable to get current file name. Make sure you have a file open in the editor.":g);P.logMessage("Skipping current-file token replacement because no active file is available.")}return v}async replaceCurrentFileNameInString(e){return this.replaceCurrentFileTokensInString(e,{fileName:!0})}setLinkToCurrentFileBehavior(e){this.linkToCurrentFileBehavior=e}setTargetFolderPath(e){if(e==null){this.targetFolderPath=null;return}let t=e.trim();this.targetFolderPath=t==="/"?"":t.replace(/^\/+/,"").replace(/\/+$/,"")}replaceTargetFolderInString(e){return this.replaceCurrentFileTokensInString(e,{folder:!0})}getAndClearTemplatePropertyVars(){return this.propertyCollector.drain()}mergeTemplatePropertyVars(e){this.propertyCollector.merge(e)}renderCollectedOrArrayValue(e){if(Array.isArray(e.rawValue)&&e.multiFormat){let i=_L({input:e.input,matchStart:e.matchStart,values:e.rawValue,format:e.multiFormat});if(i!==void 0)return i}let t=this.propertyCollector.maybeCollect({...e,collectionActive:this.templatePropertyCollectionDepth>0}),n=oN(t);if(n!==void 0)return n;if(Array.isArray(e.rawValue))return cf(e.input,e.matchStart,e.matchEnd,e.rawValue.join(","))}async withTemplatePropertyCollection(e){this.templatePropertyCollectionDepth+=1;try{return await e()}finally{this.templatePropertyCollectionDepth-=1}}getCurrentFileLinkToSection(){return null}getCurrentFolderPath(){return null}warnOnNamedOptionConflict(e){if(!e.aliasName||!e.hasOptions)return;let t=e.variableKey.toLowerCase(),n=JSON.stringify([e.suggestedValues,e.allowCustomInput,e.displayValues??null,e.multiSelect,e.multiEmit]),i=this.namedSuggesterOptionSigs.get(t);if(i===void 0){this.namedSuggesterOptionSigs.set(t,n);return}i!==n&&!this.namedSuggesterConflictsWarned.has(t)&&(this.namedSuggesterConflictsWarned.add(t),this.warn(`QuickAdd: named value "${e.variableKey}" is defined with different option lists; the first definition's value is reused.`))}async ensureValueVariableResolved(e){let{variableName:t,variableKey:n,label:i,defaultValue:o,allowCustomInput:s,suggestedValues:a,displayValues:l,hasOptions:c}=e;this.warnOnNamedOptionConflict(e);let u=qc(this.variables,n);if(u)return u;let d=!c&&i?i:void 0,f=c&&i?i:void 0;if(c&&e.multiSelect){let m=await this.suggestForValueMulti(a,s,{placeholder:f,variableKey:n,displayValues:l,optional:e.optional});return this.variables.set(n,e.multiEmit==="linklist"?m.map(iE):m),n}let p="";return c?p=await this.suggestForValue(a,s,{placeholder:f,variableKey:n,displayValues:l,optional:e.optional}):p=await this.promptForVariable(t,{defaultValue:o,description:d,inputTypeOverride:e.inputTypeOverride,numericConfig:e.numericConfig,sliderConfig:e.sliderConfig,variableKey:n,optional:e.optional}),!p&&o&&!e.optional&&(p=o),this.variables.set(n,p),n}async resolveNamedSuggesterDefinitions(e){if(!/\|\s*name\s*:/i.test(e))return;let t=new RegExp(Xu.source,"gi"),n=[],i;for(;(i=t.exec(e))!==null;){if(!i[1])continue;let a;try{a=cv(i[1],{warn:Ng})}catch{return}a&&n.push({parsed:a,index:i.index})}let o=new Map;for(let{parsed:a,index:l}of n){if(a.hasOptions&&a.aliasName)continue;let c=a.variableKey.toLowerCase();o.has(c)||o.set(c,l)}let s=new Set;for(let{parsed:a,index:l}of n){if(!a.hasOptions||!a.aliasName)continue;let c=a.variableKey.toLowerCase();(o.get(c)??l)>=l||s.has(c)||(s.add(c),await this.ensureValueVariableResolved(a))}}async replaceVariableInString(e){let t=e;await this.resolveNamedSuggesterDefinitions(t);let n=new RegExp(Xu.source,"gi"),i=this.isTemplatePropertyTypesEnabled(),o;for(;(o=n.exec(t))!==null;){if(!o[1])throw new Error(`Unable to parse variable. Invalid syntax in: "${t.substring(Math.max(0,o.index-10),Math.min(t.length,o.index+30))}..."`);let s=cv(o[1],{warn:this.warnSink});if(!s)throw new Error(`Unable to parse variable. Invalid syntax in: "${t.substring(Math.max(0,o.index-10),Math.min(t.length,o.index+30))}..."`);let{variableName:a}=s,l=await this.ensureValueVariableResolved(s),c=this.variables.get(l),u=this.applyValueTokenOptions(c,s),d=this.renderCollectedOrArrayValue({input:t,matchStart:o.index,matchEnd:o.index+o[0].length,rawValue:u,fallbackKey:a,heuristicEnabled:i&&this.templatePropertyCollectionDepth>0&&s.inputTypeOverride!=="text",multiFormat:s.multiFormat}),f,p=!1;if(d!==void 0)f=d;else{let g=String(this.applyValueTextOptions(this.getVariableValue(l),s)??"");s.inputTypeOverride==="text"&&g!==""&&qA(t,o.index,o.index+o[0].length)?f=qg(g):D8.has(s.inputTypeOverride??"")&&VA(t,o.index,o.index+o[0].length)?(p=!0,f=g):f=cf(t,o.index,o.index+o[0].length,g)}let m=p?o.index-1:o.index,v=o.index+o[0].length+(p?1:0);t=t.slice(0,m)+f+t.slice(v),n.lastIndex=m+f.length}return t}async replaceFieldVarInString(e){let t=new RegExp(Ow.source,"gi"),n="",i=0,o;for(;(o=t.exec(e))!==null;){n+=e.slice(i,o.index);let s=o[1]+(o[2]||"");if(s){let a=this.getFieldVariableKey(s),l=hi.parse(s,{warnUnknown:!0,warn:this.warnSink});this.hasConcreteVariable(a)||this.variables.set(a,await this.suggestForField(s,l));let c=this.hasConcreteVariable(a)?this.variables.get(a):this.getVariableValue(a),u;Array.isArray(c)?u=this.renderCollectedOrArrayValue({input:e,matchStart:o.index,matchEnd:o.index+o[0].length,rawValue:c,fallbackKey:l.fieldName,heuristicEnabled:!1,multiFormat:l.multiFormat??"auto"})??c.join(","):u=cf(e,o.index,o.index+o[0].length,String(c??"")),n+=u}else n+=o[0];i=t.lastIndex}return n+e.slice(i)}getFieldVariableKey(e){return`${Zu}${e}`}async replaceFileInString(e){let t=new RegExp(Rw.source,"gi"),n="",i=0,o;for(;(o=t.exec(e))!==null;){n+=e.slice(i,o.index);let s=NC(o[1]??"",{warn:this.warnSink});if(!s){n+=o[0],i=t.lastIndex;continue}let a=s.variableKey;this.hasConcreteVariable(a)||this.variables.set(a,await this.suggestForFile(s));let l=XL(this.variables.get(a),s.mode,c=>this.getFileLinkForStoredValue(c));if(Array.isArray(l)){let c=this.renderCollectedOrArrayValue({input:e,matchStart:o.index,matchEnd:o.index+o[0].length,rawValue:l,fallbackKey:s.aliasName??s.folderPath,heuristicEnabled:!1,multiFormat:s.multiFormat});n+=c??l.join(",")}else n+=l;i=t.lastIndex}return n+e.slice(i)}getFileLinkForStoredValue(e){let t=Ed(e);if(t.kind==="empty")return"";if(t.kind!=="file"){let o=t.kind==="custom"?t.text:t.value;return o?`[[${o}]]`:""}let n=t.path;if(!n)return"";let i=this.app?.vault.getAbstractFileByPath(n);return i instanceof CN.TFile?this.app?.fileManager.generateMarkdownLink(i,this.getLinkSourcePath()??"")??`[[${Nc(n)}]]`:`[[${Nc(n)}]]`}getLinkSourcePath(){return null}async replaceMathValueInString(e){let t=new RegExp(Lw.source,"gi"),n=this.variables.get("mvalue"),i=typeof n=="string"&&n.trim()?n:null,o="",s=0,a;for(;(a=t.exec(e))!==null;)o+=e.slice(s,a.index),o+=i??await this.promptForMathValue(),s=a.index+a[0].length;return o+=e.slice(s),o}async replaceMacrosInString(e){let t=e;for(;bc.test(t);){let n=bc.exec(t);if(!n)continue;if(!n[1]){t=this.replacer(t,bc,"");continue}let i=hN(n[1]);if(!i){t=this.replacer(t,bc,"");continue}let{macroName:o,label:s}=i,a=await this.getMacroValue(o,s?{label:s}:void 0);t=this.replacer(t,bc,a?a.toString():"")}return t}suggestForValueMulti(e,t,n){return[]}async replaceDateVariableInString(e){let t=new RegExp(yc.source,"gi"),n="",i=0,o;for(;(o=t.exec(e))!==null;){n+=e.slice(i,o.index),i=o.index+o[0].length;let s=o[1]?.trim();if(!s){n+=o[0];continue}let{defaultValue:a,optional:l,withTime:c,snap:u,caseStyle:d}=uv(o[3]),f=o[2]?.trim()||fv(c);if(this.variables.get(s)===void 0){let v=await this.promptForVariable(s,{type:"VDATE",dateFormat:f,defaultValue:a,optional:l,withTime:c});if(l&&!v?.trim())this.variables.set(s,"");else if(v?.startsWith("@date:"))this.variables.set(s,v);else{if(!this.dateParser)throw new Error("Date parser is not available");let g=ne.getState().dateAliases,y=lg(v,g),w=this.dateParser.parseDate(y);if(w)this.variables.set(s,`@date:${w.moment.toISOString()}`);else throw new Error(`unable to parse date variable ${v}${l?"":". Tip: add |optional inside the {{VDATE}} token to allow leaving this date empty"}`)}}let m=mv(this.variables.get(s),f,u,this.dateParser);m?.normalized!==void 0&&this.variables.set(s,m.normalized),n+=this.applyCaseOption(m?.text??"",d,o[0])}return n+e.slice(i)}async replaceTemplateInString(e){let t=e;for(;Ho.test(t);){let n=Ho.exec(t);if(!n||!n[1])continue;let i=n[1];if(this.templateInclusion??(this.templateInclusion={visited:new Set,depth:0}),this.templateInclusion.visited.has(i)){let s=`[QuickAdd: template inclusion cycle detected at "${i}"]`;this.reportProblem(s),t=this.replacer(t,Ho,s);continue}if(this.templateInclusion.depth>=lE){let s=`[QuickAdd: max template inclusion depth (${lE}) exceeded at "${i}"]`;this.reportProblem(s),t=this.replacer(t,Ho,s);continue}this.templateInclusion.visited.add(i);let o;try{o=await this.getTemplateContent(i)}finally{this.templateInclusion.visited.delete(i)}t=this.replacer(t,Ho,o)}return t}replaceLinebreakInString(e){let t="";for(let n=0;n=d)break;if(dp.start){u=!0;break}}}if(c!==-1&&!u){n+=e.slice(i,c+2),i=c+2;continue}}let a=e[i],l=e[i+1];a==="\\"?l==="n"?(n+=` `,i+=2):l==="\\"?(n+="\\",i+=2):(n+="\\",i+=1):(n+=a,i+=1)}return n}replaceRandomInString(e){let t=e;for(;Tk.test(t);){let n=Tk.exec(t);if(!n||!n[1])continue;let i=parseInt(n[1]);if(i<=0||i>100)throw new Error(`Random string length must be between 1 and 100. Got: ${i}`);let o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",s="";for(let a=0;a{(function(r){r[r.AM=0]="AM",r[r.PM=1]="PM"})(vt||(vt={}));(function(r){r[r.SUNDAY=0]="SUNDAY",r[r.MONDAY=1]="MONDAY",r[r.TUESDAY=2]="TUESDAY",r[r.WEDNESDAY=3]="WEDNESDAY",r[r.THURSDAY=4]="THURSDAY",r[r.FRIDAY=5]="FRIDAY",r[r.SATURDAY=6]="SATURDAY"})(Zt||(Zt={}));(function(r){r[r.JANUARY=1]="JANUARY",r[r.FEBRUARY=2]="FEBRUARY",r[r.MARCH=3]="MARCH",r[r.APRIL=4]="APRIL",r[r.MAY=5]="MAY",r[r.JUNE=6]="JUNE",r[r.JULY=7]="JULY",r[r.AUGUST=8]="AUGUST",r[r.SEPTEMBER=9]="SEPTEMBER",r[r.OCTOBER=10]="OCTOBER",r[r.NOVEMBER=11]="NOVEMBER",r[r.DECEMBER=12]="DECEMBER"})(Eo||(Eo={}))});function qs(r,e){r.assign("day",e.getDate()),r.assign("month",e.getMonth()+1),r.assign("year",e.getFullYear())}function cE(r,e){r.assign("hour",e.getHours()),r.assign("minute",e.getMinutes()),r.assign("second",e.getSeconds()),r.assign("millisecond",e.getMilliseconds()),r.assign("meridiem",e.getHours()<12?vt.AM:vt.PM)}function Dl(r,e){r.imply("day",e.getDate()),r.imply("month",e.getMonth()+1),r.imply("year",e.getFullYear())}function hv(r,e){r.imply("hour",e.getHours()),r.imply("minute",e.getMinutes()),r.imply("second",e.getSeconds()),r.imply("millisecond",e.getMilliseconds()),r.imply("meridiem",e.getHours()<12?vt.AM:vt.PM)}var Sd=k(()=>{Al()});function Wc(r,e,t,n,i=0){let o=0,s=0;for(;sn.dstStart(e.getFullYear())&&!(e>n.dstEnd(e.getFullYear()))?n.timezoneOffsetDuringDst:n.timezoneOffsetNonDst}var P8,uD=k(()=>{Al();P8={ACDT:630,ACST:570,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,ALMT:360,AMST:-180,AMT:-240,ANAST:720,ANAT:720,AQTT:300,ART:-180,AST:-240,AWDT:540,AWST:480,AZOST:0,AZOT:-60,AZST:300,AZT:240,BNT:480,BOT:-240,BRST:-120,BRT:-180,BST:60,BTT:360,CAST:480,CAT:120,CCT:390,CDT:-300,CEST:120,CET:{timezoneOffsetDuringDst:120,timezoneOffsetNonDst:60,dstStart:r=>TN(r,Eo.MARCH,Zt.SUNDAY,2),dstEnd:r=>TN(r,Eo.OCTOBER,Zt.SUNDAY,3)},CHADT:825,CHAST:765,CKT:-600,CLST:-180,CLT:-240,COT:-300,CST:-360,CT:{timezoneOffsetDuringDst:-300,timezoneOffsetNonDst:-360,dstStart:r=>Wc(r,Eo.MARCH,Zt.SUNDAY,2,2),dstEnd:r=>Wc(r,Eo.NOVEMBER,Zt.SUNDAY,1,2)},CVT:-60,CXT:420,ChST:600,DAVT:420,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEST:180,EET:120,EGST:0,EGT:-60,EST:-300,ET:{timezoneOffsetDuringDst:-240,timezoneOffsetNonDst:-300,dstStart:r=>Wc(r,Eo.MARCH,Zt.SUNDAY,2,2),dstEnd:r=>Wc(r,Eo.NOVEMBER,Zt.SUNDAY,1,2)},FJST:780,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GMT:0,GST:240,GYT:-240,HAA:-180,HAC:-300,HADT:-540,HAE:-240,HAP:-420,HAR:-360,HAST:-600,HAT:-90,HAY:-480,HKT:480,HLV:-210,HNA:-240,HNC:-360,HNE:-300,HNP:-480,HNR:-420,HNT:-150,HNY:-540,HOVT:420,ICT:420,IDT:180,IOT:360,IRDT:270,IRKST:540,IRKT:540,IRST:210,IST:330,JST:540,KGT:360,KRAST:480,KRAT:480,KST:540,KUYT:240,LHDT:660,LHST:630,LINT:840,MAGST:720,MAGT:720,MART:-510,MAWT:300,MDT:-360,MESZ:120,MEZ:60,MHT:720,MMT:390,MSD:240,MSK:180,MST:-420,MT:{timezoneOffsetDuringDst:-360,timezoneOffsetNonDst:-420,dstStart:r=>Wc(r,Eo.MARCH,Zt.SUNDAY,2,2),dstEnd:r=>Wc(r,Eo.NOVEMBER,Zt.SUNDAY,1,2)},MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:690,NOVST:420,NOVT:360,NPT:345,NST:-150,NUT:-660,NZDT:780,NZST:720,OMSST:420,OMST:420,PDT:-420,PET:-300,PETST:720,PETT:720,PGT:600,PHOT:780,PHT:480,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PT:{timezoneOffsetDuringDst:-420,timezoneOffsetNonDst:-480,dstStart:r=>Wc(r,Eo.MARCH,Zt.SUNDAY,2,2),dstEnd:r=>Wc(r,Eo.NOVEMBER,Zt.SUNDAY,1,2)},PWT:540,PYST:-180,PYT:-240,RET:240,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SRT:-180,SST:-660,TAHT:-600,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TVT:720,ULAT:480,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-210,VLAST:660,VLAT:660,VUT:660,WAST:120,WAT:60,WEST:60,WESZ:60,WET:0,WEZ:0,WFT:720,WGST:-120,WGT:-180,WIB:420,WIT:540,WITA:480,WST:780,WT:0,YAKST:600,YAKT:600,YAPT:600,YEKST:360,YEKT:360}});function Dn(r,e){let t=new Date(r);if(e.y&&(e.year=e.y,delete e.y),e.mo&&(e.month=e.mo,delete e.mo),e.M&&(e.month=e.M,delete e.M),e.w&&(e.week=e.w,delete e.w),e.d&&(e.day=e.d,delete e.d),e.h&&(e.hour=e.h,delete e.h),e.m&&(e.minute=e.m,delete e.m),e.s&&(e.second=e.s,delete e.s),e.ms&&(e.millisecond=e.ms,delete e.ms),"year"in e){let n=Math.floor(e.year);t.setFullYear(t.getFullYear()+n);let i=e.year-n;i>0&&(e.month=e?.month??0,e.month+=i*12)}if("quarter"in e){let n=Math.floor(e.quarter);t.setMonth(t.getMonth()+n*3)}if("month"in e){let n=Math.floor(e.month);t.setMonth(t.getMonth()+n);let i=e.month-n;i>0&&(e.week=e?.week??0,e.week+=i*4)}if("week"in e){let n=Math.floor(e.week);t.setDate(t.getDate()+n*7);let i=e.week-n;i>0&&(e.day=e?.day??0,e.day+=Math.round(i*7))}if("day"in e){let n=Math.floor(e.day);t.setDate(t.getDate()+n);let i=e.day-n;i>0&&(e.hour=e?.hour??0,e.hour+=Math.round(i*24))}if("hour"in e){let n=Math.floor(e.hour);t.setHours(t.getHours()+n);let i=e.hour-n;i>0&&(e.minute=e?.minute??0,e.minute+=Math.round(i*60))}if("minute"in e){let n=Math.floor(e.minute);t.setMinutes(t.getMinutes()+n);let i=e.minute-n;i>0&&(e.second=e?.second??0,e.second+=Math.round(i*60))}if("second"in e){let n=Math.floor(e.second);t.setSeconds(t.getSeconds()+n);let i=e.second-n;i>0&&(e.millisecond=e?.millisecond??0,e.millisecond+=Math.round(i*1e3))}if("millisecond"in e){let n=Math.floor(e.millisecond);t.setMilliseconds(t.getMilliseconds()+n)}return t}function jc(r){let e={};for(let t in r)e[t]=-r[t];return e}var SN,Il=k(()=>{SN={day:0,second:0,millisecond:0}});var Gc,Ct,Fl,Us=k(()=>{Sd();uD();Il();Gc=class r{constructor(e,t){pe(this,"instant");pe(this,"timezoneOffset");this.instant=e??new Date,this.timezoneOffset=t??null}static fromDate(e){return new r(e)}static fromInput(e,t){if(e instanceof Date)return r.fromDate(e);let n=e?.instant??new Date,i=uE(e?.timezone,n,t);return new r(n,i)}getDateWithAdjustedTimezone(){let e=new Date(this.instant);return this.timezoneOffset!==null&&e.setMinutes(e.getMinutes()-this.getSystemTimezoneAdjustmentMinute(this.instant)),e}getSystemTimezoneAdjustmentMinute(e,t){e||(e=new Date);let n=-e.getTimezoneOffset(),i=t??this.timezoneOffset??n;return n-i}getTimezoneOffset(){return this.timezoneOffset??-this.instant.getTimezoneOffset()}},Ct=class r{constructor(e,t){pe(this,"knownValues");pe(this,"impliedValues");pe(this,"reference");pe(this,"_tags",new Set);if(this.reference=e,this.knownValues={},this.impliedValues={},t)for(let i in t)this.knownValues[i]=t[i];let n=e.getDateWithAdjustedTimezone();this.imply("day",n.getDate()),this.imply("month",n.getMonth()+1),this.imply("year",n.getFullYear()),this.imply("hour",12),this.imply("minute",0),this.imply("second",0),this.imply("millisecond",0)}static createRelativeFromReference(e,t=SN){let n=Dn(e.getDateWithAdjustedTimezone(),t),i=new r(e);return i.addTag("result/relativeDate"),"hour"in t||"minute"in t||"second"in t||"millisecond"in t?(i.addTag("result/relativeDateAndTime"),cE(i,n),qs(i,n),i.assign("timezoneOffset",e.getTimezoneOffset())):(hv(i,n),i.imply("timezoneOffset",e.getTimezoneOffset()),"day"in t?(i.assign("day",n.getDate()),i.assign("month",n.getMonth()+1),i.assign("year",n.getFullYear()),i.assign("weekday",n.getDay())):"week"in t?(i.assign("day",n.getDate()),i.assign("month",n.getMonth()+1),i.assign("year",n.getFullYear()),i.imply("weekday",n.getDay())):(i.imply("day",n.getDate()),"month"in t?(i.assign("month",n.getMonth()+1),i.assign("year",n.getFullYear())):(i.imply("month",n.getMonth()+1),"year"in t?i.assign("year",n.getFullYear()):i.imply("year",n.getFullYear())))),i}get(e){return e in this.knownValues?this.knownValues[e]:e in this.impliedValues?this.impliedValues[e]:null}isCertain(e){return e in this.knownValues}getCertainComponents(){return Object.keys(this.knownValues)}imply(e,t){return e in this.knownValues?this:(this.impliedValues[e]=t,this)}assign(e,t){return this.knownValues[e]=t,delete this.impliedValues[e],this}addDurationAsImplied(e){let t=this.dateWithoutTimezoneAdjustment(),n=Dn(t,e);return("day"in e||"week"in e||"month"in e||"year"in e)&&(this.delete(["day","weekday","month","year"]),this.imply("day",n.getDate()),this.imply("weekday",n.getDay()),this.imply("month",n.getMonth()+1),this.imply("year",n.getFullYear())),("second"in e||"minute"in e||"hour"in e)&&(this.delete(["second","minute","hour"]),this.imply("second",n.getSeconds()),this.imply("minute",n.getMinutes()),this.imply("hour",n.getHours())),this}delete(e){typeof e=="string"&&(e=[e]);for(let t of e)delete this.knownValues[t],delete this.impliedValues[t]}clone(){let e=new r(this.reference);e.knownValues={},e.impliedValues={};for(let t in this.knownValues)e.knownValues[t]=this.knownValues[t];for(let t in this.impliedValues)e.impliedValues[t]=this.impliedValues[t];return e}isOnlyDate(){return!this.isCertain("hour")&&!this.isCertain("minute")&&!this.isCertain("second")}isOnlyTime(){return!this.isCertain("weekday")&&!this.isCertain("day")&&!this.isCertain("month")&&!this.isCertain("year")}isOnlyWeekdayComponent(){return this.isCertain("weekday")&&!this.isCertain("day")&&!this.isCertain("month")}isDateWithUnknownYear(){return this.isCertain("month")&&!this.isCertain("year")}isValidDate(){let e=new Date(Date.UTC(this.get("year"),this.get("month")-1,this.get("day"),this.get("hour"),this.get("minute"),this.get("second"),this.get("millisecond")));return e.setUTCFullYear(this.get("year")),!(e.getUTCFullYear()!==this.get("year")||e.getUTCMonth()!==this.get("month")-1||e.getUTCDate()!==this.get("day")||this.get("hour")!=null&&e.getUTCHours()!=this.get("hour")||this.get("minute")!=null&&e.getUTCMinutes()!=this.get("minute"))}toString(){return`[ParsingComponents { tags: ${JSON.stringify(Array.from(this._tags).sort())}, knownValues: ${JSON.stringify(this.knownValues)}, impliedValues: ${JSON.stringify(this.impliedValues)}}, reference: ${JSON.stringify(this.reference)}]`}date(){let e=this.get("timezoneOffset")??this.reference.timezoneOffset;if(e==null)return this.dateWithoutTimezoneAdjustment();let t=new Date(Date.UTC(this.get("year"),this.get("month")-1,this.get("day"),this.get("hour"),this.get("minute"),this.get("second"),this.get("millisecond")));return t.setUTCFullYear(this.get("year")),new Date(t.getTime()-e*6e4)}addTag(e){return this._tags.add(e),this}addTags(e){for(let t of e)this._tags.add(t);return this}tags(){return new Set(this._tags)}dateWithoutTimezoneAdjustment(){let e=new Date(this.get("year"),this.get("month")-1,this.get("day"),this.get("hour"),this.get("minute"),this.get("second"),this.get("millisecond"));return e.setFullYear(this.get("year")),e}},Fl=class r{constructor(e,t,n,i,o){pe(this,"refDate");pe(this,"index");pe(this,"text");pe(this,"reference");pe(this,"start");pe(this,"end");this.reference=e,this.refDate=e.instant,this.index=t,this.text=n,this.start=i||new Ct(e),this.end=o}clone(){let e=new r(this.reference,this.index,this.text);return e.start=this.start?this.start.clone():null,e.end=this.end?this.end.clone():null,e}date(){return this.start.date()}addTag(e){return this.start.addTag(e),this.end&&this.end.addTag(e),this}addTags(e){return this.start.addTags(e),this.end&&this.end.addTags(e),this}tags(){let e=new Set(this.start.tags());if(this.end)for(let t of this.end.tags())e.add(t);return e}toString(){let e=Array.from(this.tags()).sort();return`[ParsingResult {index: ${this.index}, text: '${this.text}', tags: ${JSON.stringify(e)} ...}]`}}});function dD(r,e,t="\\s{0,5},?\\s{0,5}"){let n=e.replace(/\((?!\?)/g,"(?:");return`${r}${n}(?:${t}${n}){0,10}`}function $8(r){let e;return r instanceof Array?e=[...r]:r instanceof Map?e=Array.from(r.keys()):e=Object.keys(r),e}function pn(r){return`(?:${$8(r).sort((t,n)=>n.length-t.length).join("|").replace(/\./g,"\\.")})`}var Pl=k(()=>{});function dE(r){return r<100&&(r>50?r=r+1900:r=r+2e3),r}function Yc(r,e,t){let n=new Date(r);n.setMonth(t-1),n.setDate(e);let i=Dn(n,{year:1}),o=Dn(n,{year:-1});return Math.abs(i.getTime()-r.getTime()){Il()});function M8(r){let e=r.toLowerCase();return pD[e]!==void 0?pD[e]:e==="a"||e==="an"||e=="the"?1:e.match(/few/)?3:e.match(/half/)?.5:e.match(/couple/)?2:e.match(/several/)?7:parseFloat(e)}function xf(r){let e=r.toLowerCase();return fD[e]!==void 0?fD[e]:(e=e.replace(/(?:st|nd|rd|th)$/i,""),parseInt(e))}function ka(r){if(/BE/i.test(r))return r=r.replace(/BE/i,""),parseInt(r)-543;if(/BCE?/i.test(r))return r=r.replace(/BCE?/i,""),-parseInt(r);if(/(AD|CE)/i.test(r))return r=r.replace(/(AD|CE)/i,""),parseInt(r);let e=parseInt(r);return dE(e)}function ts(r){let e={},t=r,n=_N.exec(t);for(;n;)R8(e,n),t=t.substring(n[0].length).trim(),n=_N.exec(t);return Object.keys(e).length==0?null:e}function R8(r,e){if(e[0].match(/^[a-zA-Z]+$/))return;let t=M8(e[1]),n=gv[e[2].toLowerCase()];r[n]=t}var pE,mD,Li,pD,fD,kN,gv,AN,Ef,Kc,DN,_N,O8,IN,$l,Qc,$r=k(()=>{Pl();Cf();pE={sunday:0,sun:0,"sun.":0,monday:1,mon:1,"mon.":1,tuesday:2,tue:2,"tue.":2,wednesday:3,wed:3,"wed.":3,thursday:4,thurs:4,"thurs.":4,thur:4,"thur.":4,thu:4,"thu.":4,friday:5,fri:5,"fri.":5,saturday:6,sat:6,"sat.":6},mD={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},Li={...mD,jan:1,"jan.":1,feb:2,"feb.":2,mar:3,"mar.":3,apr:4,"apr.":4,jun:6,"jun.":6,jul:7,"jul.":7,aug:8,"aug.":8,sep:9,"sep.":9,sept:9,"sept.":9,oct:10,"oct.":10,nov:11,"nov.":11,dec:12,"dec.":12},pD={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},fD={first:1,second:2,third:3,fourth:4,fifth:5,sixth:6,seventh:7,eighth:8,ninth:9,tenth:10,eleventh:11,twelfth:12,thirteenth:13,fourteenth:14,fifteenth:15,sixteenth:16,seventeenth:17,eighteenth:18,nineteenth:19,twentieth:20,"twenty first":21,"twenty-first":21,"twenty second":22,"twenty-second":22,"twenty third":23,"twenty-third":23,"twenty fourth":24,"twenty-fourth":24,"twenty fifth":25,"twenty-fifth":25,"twenty sixth":26,"twenty-sixth":26,"twenty seventh":27,"twenty-seventh":27,"twenty eighth":28,"twenty-eighth":28,"twenty ninth":29,"twenty-ninth":29,thirtieth:30,"thirty first":31,"thirty-first":31},kN={second:"second",seconds:"second",minute:"minute",minutes:"minute",hour:"hour",hours:"hour",day:"day",days:"day",week:"week",weeks:"week",month:"month",months:"month",quarter:"quarter",quarters:"quarter",year:"year",years:"year"},gv={s:"second",sec:"second",second:"second",seconds:"second",m:"minute",min:"minute",mins:"minute",minute:"minute",minutes:"minute",h:"hour",hr:"hour",hrs:"hour",hour:"hour",hours:"hour",d:"day",day:"day",days:"day",w:"week",week:"week",weeks:"week",mo:"month",mon:"month",mos:"month",month:"month",months:"month",qtr:"quarter",quarter:"quarter",quarters:"quarter",y:"year",yr:"year",year:"year",years:"year",...kN},AN=`(?:${pn(pD)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s{0,2}an?)?|an?\\b(?:\\s{0,2}few)?|few|several|the|a?\\s{0,2}couple\\s{0,2}(?:of)?)`;Ef=`(?:${pn(fD)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;Kc="(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-9][0-9]{3}|[0-9]{2}(?!\\w|:\\d|\\s+(?:am|pm|o\\s*clock|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)))";DN=`(${AN})\\s{0,3}(${pn(gv)})`,_N=new RegExp(DN,"i"),O8=`(${AN})\\s{0,3}(${pn(kN)})`,IN="\\s{0,5},?(?:\\s*and)?\\s{0,5}",$l=dD("(?:(?:about|around)\\s{0,3})?",DN,IN),Qc=dD("(?:(?:about|around)\\s{0,3})?",O8,IN)});var Ft,gi=k(()=>{Ft=class{constructor(){pe(this,"cachedInnerPattern",null);pe(this,"cachedPattern",null)}innerPatternHasChange(e,t){return this.innerPattern(e)!==t}patternLeftBoundary(){return"(\\W|^)"}pattern(e){return this.cachedInnerPattern&&!this.innerPatternHasChange(e,this.cachedInnerPattern)?this.cachedPattern:(this.cachedInnerPattern=this.innerPattern(e),this.cachedPattern=new RegExp(`${this.patternLeftBoundary()}${this.cachedInnerPattern.source}`,this.cachedInnerPattern.flags),this.cachedPattern)}extract(e,t){let n=t[1]??"";t.index=t.index+n.length,t[0]=t[0].substring(n.length);for(let i=2;i{$r();Us();gi();L8=new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${$l})(?=\\W|$)`,"i"),N8=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${$l})(?=\\W|$)`,"i"),B8=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${Qc})(?=\\W|$)`,"i"),vv=class extends Ft{constructor(t){super();pe(this,"strictMode");this.strictMode=t}innerPattern(t){return this.strictMode?B8:t.option.forwardDate?L8:N8}innerExtract(t,n){if(n[0].match(/^for\s*the\s*\w+/))return null;let i=ts(n[1]);return i?Ct.createRelativeFromReference(t.reference,i):null}}});var V8,PN,$N,q8,MN,yv,ON=k(()=>{Cf();$r();$r();$r();Pl();gi();V8=new RegExp(`(?:on\\s{0,3})?(${Ef})(?:\\s{0,3}(?:to|\\-|\\\u2013|until|through|till)\\s{0,3}(${Ef}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${pn(Li)})(?:(?:-|/|,?\\s{0,3})(${Kc}(?!\\w)))?(?=\\W|$)`,"i"),PN=1,$N=2,q8=3,MN=4,yv=class extends Ft{innerPattern(){return V8}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=Li[t[q8].toLowerCase()],o=xf(t[PN]);if(o>31)return t.index=t.index+t[PN].length,null;if(n.start.assign("month",i),n.start.assign("day",o),t[MN]){let s=ka(t[MN]);n.start.assign("year",s)}else{let s=Yc(e.refDate,o,i);n.start.imply("year",s)}if(t[$N]){let s=xf(t[$N]);n.end=n.start.clone(),n.end.assign("day",s)}return n}}});var U8,z8,RN,hD,gD,bv,LN=k(()=>{Cf();$r();$r();$r();Pl();gi();U8=new RegExp(`(${pn(Li)})(?:-|/|\\s*,?\\s*)(${Ef})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${Ef})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${Kc}))?(?=\\W|$)(?!\\:\\d)`,"i"),z8=1,RN=2,hD=3,gD=4,bv=class extends Ft{constructor(t){super();pe(this,"shouldSkipYearLikeDate");this.shouldSkipYearLikeDate=t}innerPattern(){return U8}innerExtract(t,n){let i=Li[n[z8].toLowerCase()],o=xf(n[RN]);if(o>31||this.shouldSkipYearLikeDate&&!n[hD]&&!n[gD]&&n[RN].match(/^\d{2}$/))return null;let s=t.createParsingComponents({day:o,month:i}).addTag("parser/ENMonthNameMiddleEndianParser");if(n[gD]){let c=ka(n[gD]);s.assign("year",c)}else{let c=Yc(t.refDate,o,i);s.imply("year",c)}if(!n[hD])return s;let a=xf(n[hD]),l=t.createParsingResult(n.index,n[0]);return l.start=s,l.end=s.clone(),l.end.assign("day",a),l}}});var H8,W8,j8,NN,wv,BN=k(()=>{$r();Cf();Pl();$r();gi();H8=new RegExp(`((?:in)\\s*)?(${pn(Li)})\\s*(?:(?:,|-|of)?\\s*(${Kc})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),W8=1,j8=2,NN=3,wv=class extends Ft{innerPattern(){return H8}innerExtract(e,t){let n=t[j8].toLowerCase();if(t[0].length<=3&&!mD[n])return null;let i=e.createParsingResult(t.index+(t[W8]||"").length,t.index+t[0].length);i.start.imply("day",1),i.start.addTag("parser/ENMonthNameParser");let o=Li[n];if(i.start.assign("month",o),t[NN]){let s=ka(t[NN]);i.start.assign("year",s)}else{let s=Yc(e.refDate,1,o);i.start.imply("year",s)}return i}}});var G8,Y8,K8,VN,Q8,Cv,qN=k(()=>{$r();Pl();gi();G8=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${pn(Li)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),Y8=1,K8=2,VN=3,Q8=4,Cv=class extends Ft{constructor(t){super();pe(this,"strictMonthDateOrder");this.strictMonthDateOrder=t}innerPattern(){return G8}innerExtract(t,n){let i=parseInt(n[Y8]),o=parseInt(n[Q8]),s=n[VN]?parseInt(n[VN]):Li[n[K8].toLowerCase()];if(s<1||s>12){if(this.strictMonthDateOrder)return null;o>=1&&o<=12&&([s,o]=[o,s])}return o<1||o>31?null:{day:o,month:s,year:i}}}});var X8,Z8,J8,e5,Ev,UN=k(()=>{$r();Pl();$r();gi();X8="(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-9][0-9]{3})",Z8=new RegExp(`(${X8})(?:\\s*[-.\\/,]?\\s*|\\s+of\\s+)(${pn(Li)})(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),J8=1,e5=2,Ev=class extends Ft{innerPattern(){return Z8}innerExtract(e,t){let n=ka(t[J8]),i=t[e5].toLowerCase(),o=Li[i],s=e.createParsingResult(t.index,t[0]);return s.start.imply("day",1),s.start.assign("month",o),s.start.assign("year",n),s.start.addTag("parser/ENYearMonthNameParser"),s}}});var t5,r5,n5,xv,zN=k(()=>{gi();t5=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),r5=1,n5=2,xv=class extends Ft{innerPattern(){return t5}innerExtract(e,t){let n=parseInt(t[n5]),i=parseInt(t[r5]);return e.createParsingComponents().imply("day",1).assign("month",i).assign("year",n)}}});function i5(r,e,t,n){return new RegExp(`${r}${e}(\\d{1,4})(?:(?:\\.|:|\uFF1A)(\\d{1,2})(?:(?::|\uFF1A)(\\d{2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${t}`,n)}function o5(r,e){return new RegExp(`^(${r})(\\d{1,4})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${e}`,"i")}var vD,_d,fE,mE,Tf,hE,HN=k(()=>{Al();vD=2,_d=3,fE=4,mE=5,Tf=6,hE=class{constructor(e=!1){pe(this,"strictMode");pe(this,"cachedPrimaryPrefix",null);pe(this,"cachedPrimarySuffix",null);pe(this,"cachedPrimaryTimePattern",null);pe(this,"cachedFollowingPhase",null);pe(this,"cachedFollowingSuffix",null);pe(this,"cachedFollowingTimePatten",null);this.strictMode=e}patternFlags(){return"i"}primaryPatternLeftBoundary(){return"(^|\\s|T|\\b)"}primarySuffix(){return"(?!/)(?=\\W|$)"}followingSuffix(){return"(?!/)(?=\\W|$)"}pattern(e){return this.getPrimaryTimePatternThroughCache()}extract(e,t){let n=this.extractPrimaryTimeComponents(e,t);if(!n)return t[0].match(/^\d{4}/)?(t.index+=4,null):(t.index+=t[0].length,null);let i=t.index+t[1].length,o=t[0].substring(t[1].length),s=e.createParsingResult(i,o,n);t.index+=t[0].length;let a=e.text.substring(t.index),c=this.getFollowingTimePatternThroughCache().exec(a);return o.match(/^\d{3,4}/)&&c&&(c[0].match(/^\s*([+-])\s*\d{2,4}$/)||c[0].match(/^\s*([+-])\s*\d{2}\W\d{2}/))?null:!c||c[0].match(/^\s*([+-])\s*\d{3,4}$/)?this.checkAndReturnWithoutFollowingPattern(s):(s.end=this.extractFollowingTimeComponents(e,c,s),s.end&&(s.text+=c[0]),this.checkAndReturnWithFollowingPattern(s))}extractPrimaryTimeComponents(e,t,n=!1){let i=e.createParsingComponents(),o=0,s=null,a=parseInt(t[vD]);if(a>100){if(t[vD].length==4&&t[_d]==null&&!t[Tf]||this.strictMode||t[_d]!=null)return null;o=a%100,a=Math.floor(a/100)}if(a>24)return null;if(t[_d]!=null){if(t[_d].length==1&&!t[Tf])return null;o=parseInt(t[_d])}if(o>=60)return null;if(a>12&&(s=vt.PM),t[Tf]!=null){if(a>12)return null;let l=t[Tf][0].toLowerCase();l=="a"&&(s=vt.AM,a==12&&(a=0)),l=="p"&&(s=vt.PM,a!=12&&(a+=12))}if(i.assign("hour",a),i.assign("minute",o),s!==null?i.assign("meridiem",s):a<12?i.imply("meridiem",vt.AM):i.imply("meridiem",vt.PM),t[mE]!=null){let l=parseInt(t[mE].substring(0,3));if(l>=1e3)return null;i.assign("millisecond",l)}if(t[fE]!=null){let l=parseInt(t[fE]);if(l>=60)return null;i.assign("second",l)}return i}extractFollowingTimeComponents(e,t,n){let i=e.createParsingComponents();if(t[mE]!=null){let l=parseInt(t[mE].substring(0,3));if(l>=1e3)return null;i.assign("millisecond",l)}if(t[fE]!=null){let l=parseInt(t[fE]);if(l>=60)return null;i.assign("second",l)}let o=parseInt(t[vD]),s=0,a=-1;if(t[_d]!=null?s=parseInt(t[_d]):o>100&&(s=o%100,o=Math.floor(o/100)),s>=60||o>24)return null;if(o>=12&&(a=vt.PM),t[Tf]!=null){if(o>12)return null;let l=t[Tf][0].toLowerCase();l=="a"&&(a=vt.AM,o==12&&(o=0,i.isCertain("day")||i.imply("day",i.get("day")+1))),l=="p"&&(a=vt.PM,o!=12&&(o+=12)),n.start.isCertain("meridiem")||(a==vt.AM?(n.start.imply("meridiem",vt.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",vt.PM),n.start.get("hour")!=12&&n.start.assign("hour",n.start.get("hour")+12)))}return i.assign("hour",o),i.assign("minute",s),a>=0?i.assign("meridiem",a):n.start.isCertain("meridiem")&&n.start.get("hour")>12?n.start.get("hour")-12>o?i.imply("meridiem",vt.AM):o<=12&&(i.assign("hour",o+12),i.assign("meridiem",vt.PM)):o>12?i.imply("meridiem",vt.PM):o<=12&&i.imply("meridiem",vt.AM),i.date().getTime()24)return null}return e}checkAndReturnWithFollowingPattern(e){if(e.text.match(/^\d+-\d+$/))return null;let t=e.text.match(/[^\d:.](\d[\d.]+)\s*-\s*(\d[\d.]+)$/);if(t){if(this.strictMode)return null;let n=t[1],i=t[2];if(i.includes(".")&&!i.match(/\d(\.\d{2})+$/))return null;let o=parseInt(i),s=parseInt(n);if(o>24||s>24)return null}return e}getPrimaryTimePatternThroughCache(){let e=this.primaryPrefix(),t=this.primarySuffix();return this.cachedPrimaryPrefix===e&&this.cachedPrimarySuffix===t?this.cachedPrimaryTimePattern:(this.cachedPrimaryTimePattern=i5(this.primaryPatternLeftBoundary(),e,t,this.patternFlags()),this.cachedPrimaryPrefix=e,this.cachedPrimarySuffix=t,this.cachedPrimaryTimePattern)}getFollowingTimePatternThroughCache(){let e=this.followingPhase(),t=this.followingSuffix();return this.cachedFollowingPhase===e&&this.cachedFollowingSuffix===t?this.cachedFollowingTimePatten:(this.cachedFollowingTimePatten=o5(e,t),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=t,this.cachedFollowingTimePatten)}}});var Tv,WN=k(()=>{Al();HN();Tv=class extends hE{constructor(e){super(e)}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|to|until|through|till|\\?)\\s*"}primaryPrefix(){return"(?:(?:at|from)\\s*)??"}primarySuffix(){return"(?:\\s*(?:o\\W*clock|at\\s*night|in\\s*the\\s*(?:morning|afternoon)))?(?!/)(?=\\W|$)"}extractPrimaryTimeComponents(e,t){let n=super.extractPrimaryTimeComponents(e,t);if(!n)return n;if(t[0].endsWith("night")){let i=n.get("hour");i>=6&&i<12?(n.assign("hour",n.get("hour")+12),n.assign("meridiem",vt.PM)):i<6&&n.assign("meridiem",vt.AM)}if(t[0].endsWith("afternoon")){n.assign("meridiem",vt.PM);let i=n.get("hour");i>=0&&i<=6&&n.assign("hour",n.get("hour")+12)}return t[0].endsWith("morning")&&(n.assign("meridiem",vt.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ENTimeExpressionParser")}extractFollowingTimeComponents(e,t,n){let i=super.extractFollowingTimeComponents(e,t,n);return i&&i.addTag("parser/ENTimeExpressionParser"),i}}});var s5,a5,Sv,jN=k(()=>{$r();Us();gi();Il();s5=new RegExp(`(${$l})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),a5=new RegExp(`(${Qc})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),Sv=class extends Ft{constructor(t){super();pe(this,"strictMode");this.strictMode=t}innerPattern(){return this.strictMode?a5:s5}innerExtract(t,n){let i=ts(n[1]);return i?Ct.createRelativeFromReference(t.reference,jc(i)):null}}});var l5,c5,u5,_v,GN=k(()=>{$r();Us();gi();l5=new RegExp(`(${$l})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),c5=new RegExp(`(${Qc})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),u5=1,_v=class extends Ft{constructor(t){super();pe(this,"strictMode");this.strictMode=t}innerPattern(){return this.strictMode?c5:l5}innerExtract(t,n){let i=ts(n[u5]);return i?Ct.createRelativeFromReference(t.reference,i):null}}});var Sf,rs,Xc=k(()=>{Sf=class{refine(e,t){return t.filter(n=>this.isValid(e,n))}},rs=class{refine(e,t){if(t.length<2)return t;let n=[],i=t[0],o=null;for(let s=1;s{console.log(`${this.constructor.name} merged ${l} and ${c} into ${u}`)}),i=u}}return i!=null&&n.push(i),n}}});var kv,YN=k(()=>{Xc();Il();kv=class extends rs{shouldMergeResults(e,t,n){return!t.end&&!n.end&&e.match(this.patternBetween())!=null}mergeResults(e,t,n){if(!t.start.isOnlyWeekdayComponent()&&!n.start.isOnlyWeekdayComponent()&&(n.start.getCertainComponents().forEach(o=>{t.start.isCertain(o)||t.start.imply(o,n.start.get(o))}),t.start.getCertainComponents().forEach(o=>{n.start.isCertain(o)||n.start.imply(o,t.start.get(o))})),t.start.date()>n.start.date()){let o=t.start.date(),s=n.start.date();n.start.isOnlyWeekdayComponent()&&Dn(s,{day:7})>o?(s=Dn(s,{day:7}),n.start.imply("day",s.getDate()),n.start.imply("month",s.getMonth()+1),n.start.imply("year",s.getFullYear())):t.start.isOnlyWeekdayComponent()&&Dn(o,{day:-7})o?(s=Dn(s,{year:1}),n.start.imply("year",s.getFullYear())):t.start.isDateWithUnknownYear()&&Dn(o,{year:-1}){YN();Av=class extends kv{patternBetween(){return/^\s*(to|-|–|until|through|till)\s*$/i}}});function yD(r,e){let t=r.clone(),n=r.start,i=e.start;if(t.start=QN(n,i),r.end!=null||e.end!=null){let o=r.end==null?r.start:r.end,s=e.end==null?e.start:e.end,a=QN(o,s);if(r.end==null&&a.date().getTime()i.startsWith("casualReference/")));return e.isCertain("meridiem")?t.assign("meridiem",e.get("meridiem")):e.get("meridiem")!=null&&!n&&t.imply("meridiem",e.get("meridiem")),t.get("meridiem")==vt.PM&&t.get("hour")<12&&(e.isCertain("hour")?t.assign("hour",t.get("hour")+12):t.imply("hour",t.get("hour")+12)),t.addTags(r.tags()),t.addTags(e.tags()),t}var XN=k(()=>{Al();Sd()});var Dv,ZN=k(()=>{Xc();XN();Dv=class extends rs{shouldMergeResults(e,t,n){return(t.start.isOnlyDate()&&n.start.isOnlyTime()||n.start.isOnlyDate()&&t.start.isOnlyTime())&&e.match(this.patternBetween())!=null}mergeResults(e,t,n){let i=t.start.isOnlyDate()?yD(t,n):yD(n,t);return i.index=t.index,i.text=t.text+e+n.text,i}}});var _f,JN=k(()=>{ZN();_f=class extends Dv{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|\u2219|:)?\\s*$")}}});var d5,Iv,e1=k(()=>{uD();d5=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i"),Iv=class{constructor(e){pe(this,"timezoneOverrides");this.timezoneOverrides=e}refine(e,t){let n=e.option.timezones??{};return t.forEach(i=>{let o=e.text.substring(i.index+i.text.length),s=d5.exec(o);if(!s)return;let a=s[1].toUpperCase(),l=i.start.date()??i.refDate??new Date,c={...this.timezoneOverrides,...n},u=uE(a,l,c);if(u==null)return;e.debug(()=>{console.log(`Extracting timezone: '${a}' into: ${u} for: ${i.start}`)});let d=i.start.get("timezoneOffset");d!==null&&u!=d&&(i.start.isCertain("timezoneOffset")||a!=s[1])||i.start.isOnlyDate()&&a!=s[1]||(i.text+=s[0],i.start.isCertain("timezoneOffset")||i.start.assign("timezoneOffset",u),i.end!=null&&!i.end.isCertain("timezoneOffset")&&i.end.assign("timezoneOffset",u))}),t}}});var p5,f5,m5,h5,Fv,t1=k(()=>{p5=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),f5=1,m5=2,h5=3,Fv=class{refine(e,t){return t.forEach(function(n){if(n.start.isCertain("timezoneOffset"))return;let i=e.text.substring(n.index+n.text.length),o=p5.exec(i);if(!o)return;e.debug(()=>{console.log(`Extracting timezone: '${o[0]}' into : ${n}`)});let s=parseInt(o[m5]),a=parseInt(o[h5]||"0"),l=s*60+a;l>840||(o[f5]==="-"&&(l=-l),n.end!=null&&n.end.assign("timezoneOffset",l),n.start.assign("timezoneOffset",l),n.text+=o[0])}),t}}});var Zc,bD=k(()=>{Zc=class{refine(e,t){if(t.length<2)return t;let n=[],i=t[0];for(let o=1;o=i.index+i.text.length){n.push(i),i=s;continue}let a=null,l=null;s.text.length>i.text.length?(a=s,l=i):(a=i,l=s),e.debug(()=>{console.log(`${this.constructor.name} remove ${l} by ${a}`)}),i=a}return i!=null&&n.push(i),n}}});function r1(r,e,t){let n=r.getDateWithAdjustedTimezone(),i=g5(n,e,t),o=new Ct(r);return o=o.addDurationAsImplied({day:i}),o.assign("weekday",e),o}function g5(r,e,t){let n=r.getDay();switch(t){case"this":return kd(r,e);case"last":return n1(r,e);case"next":return n==Zt.SUNDAY?e==Zt.SUNDAY?7:e:n==Zt.SATURDAY?e==Zt.SATURDAY?7:e==Zt.SUNDAY?8:1+e:e=0&&(n-=7),n}var wD=k(()=>{Al();Us()});var Pv,i1=k(()=>{Sd();Sd();Il();wD();Pv=class{refine(e,t){return e.option.forwardDate&&t.forEach(n=>{let i=e.reference.getDateWithAdjustedTimezone();if(n.start.isOnlyTime()&&e.reference.instant>n.start.date()){let o=e.reference.getDateWithAdjustedTimezone(),s=new Date(o);s.setDate(s.getDate()+1),Dl(n.start,s),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} time from the ref date (${o}) to the following day (${s})`)}),n.end&&n.end.isOnlyTime()&&(Dl(n.end,s),n.start.date()>n.end.date()&&(s.setDate(s.getDate()+1),Dl(n.end,s)))}if(n.start.isOnlyWeekdayComponent()&&i>n.start.date()){let o=kd(i,n.start.get("weekday"))||7,s=Dn(i,{day:o});if(Dl(n.start,s),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} weekday (${n.start})`)}),n.end&&n.start.date()>n.end.date()){let a=kd(i,n.start.get("weekday"))||7,l=Dn(i,{day:a});Dl(n.end,l),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} weekday (${n.end})`)})}}if(n.start.isDateWithUnknownYear()&&i>n.start.date())for(let o=0;o<3&&i>n.start.date();o++)n.start.imply("year",n.start.get("year")+1),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} year (${n.start})`)}),n.end&&!n.end.isCertain("year")&&(n.end.imply("year",n.end.get("year")+1),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} month (${n.start})`)}))}),t}}});var $v,o1=k(()=>{Xc();$v=class extends Sf{constructor(t){super();pe(this,"strictMode");this.strictMode=t}isValid(t,n){return n.text.replace(" ","").match(/^\d*(\.\d*)?$/)?(t.debug(()=>{console.log(`Removing unlikely result '${n.text}'`)}),!1):n.start.isValidDate()?n.end&&!n.end.isValidDate()?(t.debug(()=>{console.log(`Removing invalid result: ${n} (${n.end})`)}),!1):this.strictMode?this.isStrictModeValid(t,n):!0:(t.debug(()=>{console.log(`Removing invalid result: ${n} (${n.start})`)}),!1)}isStrictModeValid(t,n){return n.start.isOnlyWeekdayComponent()?(t.debug(()=>{console.log(`(Strict) Removing weekday only component: ${n} (${n.end})`)}),!1):!0}}});var y5,b5,w5,C5,s1,E5,a1,l1,x5,c1,u1,Mv,d1=k(()=>{gi();y5=new RegExp("([0-9]{4})\\-([0-9]{1,2})\\-([0-9]{1,2})(?:T([0-9]{1,2}):([0-9]{1,2})(?::([0-9]{1,2})(?:\\.(\\d{1,4}))?)?(Z|([+-]\\d{2}):?(\\d{2})?)?)?(?=\\W|$)","i"),b5=1,w5=2,C5=3,s1=4,E5=5,a1=6,l1=7,x5=8,c1=9,u1=10,Mv=class extends Ft{innerPattern(){return y5}innerExtract(e,t){let n=e.createParsingComponents({year:parseInt(t[b5]),month:parseInt(t[w5]),day:parseInt(t[C5])});if(t[s1]!=null&&(n.assign("hour",parseInt(t[s1])),n.assign("minute",parseInt(t[E5])),t[a1]!=null&&n.assign("second",parseInt(t[a1])),t[l1]!=null&&n.assign("millisecond",parseInt(t[l1])),t[x5]!=null)){let i=0;if(t[c1]){let o=parseInt(t[c1]),s=0;t[u1]!=null&&(s=parseInt(t[u1])),i=o*60,i<0?i-=s:i+=s}n.assign("timezoneOffset",i)}return n.addTag("parser/ISOFormatParser")}}});var Ov,p1=k(()=>{Xc();Ov=class extends rs{mergeResults(e,t,n){let i=n.clone();return i.index=t.index,i.text=t.text+e+i.text,i.start.assign("weekday",t.start.get("weekday")),i.end&&i.end.assign("weekday",t.start.get("weekday")),i}shouldMergeResults(e,t,n){return t.start.isOnlyWeekdayComponent()&&!t.start.isCertain("hour")&&n.start.isCertain("day")&&e.match(/^,?\s*$/)!=null}}});function f1(r,e=!1){return r.parsers.unshift(new Mv),r.refiners.unshift(new Ov),r.refiners.unshift(new Fv),r.refiners.unshift(new Zc),r.refiners.push(new Iv),r.refiners.push(new Zc),r.refiners.push(new Pv),r.refiners.push(new $v(e)),r}var m1=k(()=>{e1();t1();bD();i1();o1();d1();p1()});function h1(r){let e=r.getDateWithAdjustedTimezone(),t=new Ct(r,{});return qs(t,e),cE(t,e),t.assign("timezoneOffset",r.getTimezoneOffset()),t.addTag("casualReference/now"),t}function g1(r){let e=r.getDateWithAdjustedTimezone(),t=new Ct(r,{});return qs(t,e),hv(t,e),t.delete("meridiem"),t.addTag("casualReference/today"),t}function v1(r){return T5(r,1).addTag("casualReference/yesterday")}function y1(r){return gE(r,1).addTag("casualReference/tomorrow")}function T5(r,e){return gE(r,-e)}function gE(r,e){let t=r.getDateWithAdjustedTimezone(),n=new Ct(r,{}),i=new Date(t.getTime());return i.setDate(i.getDate()+e),qs(n,i),hv(n,i),n.delete("meridiem"),n}function b1(r,e=22){let t=r.getDateWithAdjustedTimezone(),n=new Ct(r,{});return qs(n,t),n.imply("hour",e),n.imply("meridiem",vt.PM),n.addTag("casualReference/tonight"),n}function w1(r,e=20){let t=new Ct(r,{});return t.imply("meridiem",vt.PM),t.imply("hour",e),t.addTag("casualReference/evening"),t}function C1(r){let e=new Ct(r,{});return r.getDateWithAdjustedTimezone().getHours()>2&&e.addDurationAsImplied({day:1}),e.assign("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/midnight"),e}function E1(r,e=6){let t=new Ct(r,{});return t.imply("meridiem",vt.AM),t.imply("hour",e),t.imply("minute",0),t.imply("second",0),t.imply("millisecond",0),t.addTag("casualReference/morning"),t}function x1(r,e=15){let t=new Ct(r,{});return t.imply("meridiem",vt.PM),t.imply("hour",e),t.imply("minute",0),t.imply("second",0),t.imply("millisecond",0),t.addTag("casualReference/afternoon"),t}function T1(r){let e=new Ct(r,{});return e.imply("meridiem",vt.AM),e.assign("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/noon"),e}var CD=k(()=>{Us();Sd();Al()});var S5,Rv,_1=k(()=>{gi();Sd();CD();S5=/(now|today|tonight|tomorrow|overmorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,Rv=class extends Ft{innerPattern(e){return S5}innerExtract(e,t){let n=e.refDate,i=t[0].toLowerCase(),o=e.createParsingComponents();switch(i){case"now":o=h1(e.reference);break;case"today":o=g1(e.reference);break;case"yesterday":o=v1(e.reference);break;case"tomorrow":case"tmr":case"tmrw":o=y1(e.reference);break;case"tonight":o=b1(e.reference);break;case"overmorrow":o=gE(e.reference,2);break;default:if(i.match(/last\s*night/)){if(n.getHours()>6){let s=new Date(n.getTime());s.setDate(s.getDate()-1),n=s}qs(o,n),o.imply("hour",0)}break}return o.addTag("parser/ENCasualDateParser"),o}}});var _5,Lv,k1=k(()=>{gi();CD();_5=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,Lv=class extends Ft{innerPattern(){return _5}innerExtract(e,t){let n=null;switch(t[1].toLowerCase()){case"afternoon":n=x1(e.reference);break;case"evening":case"night":n=w1(e.reference);break;case"midnight":n=C1(e.reference);break;case"morning":n=E1(e.reference);break;case"noon":case"midday":n=T1(e.reference);break}return n&&n.addTag("parser/ENCasualTimeParser"),n}}});var k5,A5,D5,I5,Nv,A1=k(()=>{$r();Pl();gi();wD();Al();k5=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${pn(pE)}|weekend|weekday)(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(?:of\\s*)?(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),A5=1,D5=2,I5=3,Nv=class extends Ft{innerPattern(){return k5}innerExtract(e,t){let n=t[A5],i=t[I5],o=n||i;o=o||"",o=o.toLowerCase();let s=null;o=="last"||o=="past"?s="last":o=="next"?s="next":o=="this"&&(s="this");let a=t[D5].toLowerCase(),l;if(pE[a]!==void 0)l=pE[a];else if(a=="weekend")l=s=="last"?Zt.SUNDAY:Zt.SATURDAY;else if(a=="weekday"){let c=e.reference.getDateWithAdjustedTimezone().getDay();c==Zt.SUNDAY||c==Zt.SATURDAY?l=s=="last"?Zt.FRIDAY:Zt.MONDAY:(l=c-1,l=s=="last"?l-1:l+1,l=l%5+1)}else return null;return r1(e.reference,l,s)}}});var F5,P5,$5,Bv,D1=k(()=>{$r();Us();gi();Pl();F5=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${pn(gv)})(?=\\s*)(?=\\W|$)`,"i"),P5=1,$5=2,Bv=class extends Ft{innerPattern(){return F5}innerExtract(e,t){let n=t[P5].toLowerCase(),i=t[$5].toLowerCase(),o=gv[i];if(n=="next"||n.startsWith("after")){let l={};return l[o]=1,Ct.createRelativeFromReference(e.reference,l)}if(n=="last"||n=="past"){let l={};return l[o]=-1,Ct.createRelativeFromReference(e.reference,l)}let s=e.createParsingComponents(),a=new Date(e.reference.instant.getTime());return i.match(/week/i)?(a.setDate(a.getDate()-a.getDay()),s.imply("day",a.getDate()),s.imply("month",a.getMonth()+1),s.imply("year",a.getFullYear())):i.match(/month/i)?(a.setDate(1),s.imply("day",a.getDate()),s.assign("year",a.getFullYear()),s.assign("month",a.getMonth()+1)):i.match(/year/i)&&(a.setDate(1),a.setMonth(0),s.imply("day",a.getDate()),s.imply("month",a.getMonth()+1),s.assign("year",a.getFullYear())),s}}});var M5,O5,R5,I1,F1,ED,Vv,P1=k(()=>{Cf();M5=new RegExp("([^\\d]|^)([0-3]{0,1}[0-9]{1})[\\/\\.\\-]([0-3]{0,1}[0-9]{1})(?:[\\/\\.\\-]([0-9]{4}|[0-9]{2}))?(\\W|$)","i"),O5=1,R5=5,I1=2,F1=3,ED=4,Vv=class{constructor(e){pe(this,"groupNumberMonth");pe(this,"groupNumberDay");this.groupNumberMonth=e?F1:I1,this.groupNumberDay=e?I1:F1}pattern(){return M5}extract(e,t){let n=t.index+t[O5].length,i=t.index+t[0].length-t[R5].length;if(n>0&&e.text.substring(0,n).match("\\d/?$")||i12)&&a>12)if(l>=1&&l<=12&&a<=31)[l,a]=[a,l];else return null;if(l<1||l>31)return null;if(s.start.assign("day",l),s.start.assign("month",a),t[ED]){let c=parseInt(t[ED]),u=dE(c);s.start.assign("year",u)}else{let c=Yc(e.refDate,l,a);s.start.imply("year",c)}return s.addTag("parser/SlashDateFormatParser")}}});var L5,N5,qv,$1=k(()=>{$r();Us();gi();Il();L5=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${$l})(?=\\W|$)`,"i"),N5=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${Qc})(?=\\W|$)`,"i"),qv=class extends Ft{constructor(t=!0){super();pe(this,"allowAbbreviations");this.allowAbbreviations=t}innerPattern(){return this.allowAbbreviations?L5:N5}innerExtract(t,n){let i=n[1].toLowerCase(),o=ts(n[2]);if(!o)return null;switch(i){case"last":case"past":case"-":o=jc(o);break}return Ct.createRelativeFromReference(t.reference,o)}}});function B5(r){return r.text.match(/^[+-]/i)!=null}function M1(r){return r.text.match(/^-/i)!=null}var Uv,O1=k(()=>{Xc();Us();$r();Il();Uv=class extends rs{shouldMergeResults(e,t,n){return e.match(/^\s*$/i)?B5(n)||M1(n):!1}mergeResults(e,t,n,i){let o=ts(n.text);M1(n)&&(o=jc(o));let s=Ct.createRelativeFromReference(Gc.fromDate(t.start.date()),o);return new Fl(t.reference,t.index,`${t.text}${e}${n.text}`,s)}}});function R1(r){return r.text.match(/\s+(before|from)$/i)!=null}function V5(r){return r.text.match(/\s+(after|since)$/i)!=null}var zv,L1=k(()=>{Xc();Us();$r();Il();zv=class extends rs{patternBetween(){return/^\s*$/i}shouldMergeResults(e,t,n){return!e.match(this.patternBetween())||!R1(t)&&!V5(t)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,t,n){let i=ts(t.text);R1(t)&&(i=jc(i));let o=Ct.createRelativeFromReference(Gc.fromDate(n.start.date()),i);return new Fl(n.reference,t.index,`${t.text}${e}${n.text}`,o)}}});var q5,U5,Hv,N1=k(()=>{$r();q5=new RegExp(`^\\s*(${Kc})`,"i"),U5=1,Hv=class{refine(e,t){return t.forEach(function(n){if(!n.start.isDateWithUnknownYear())return;let i=e.text.substring(n.index+n.text.length),o=q5.exec(i);if(!o||o[0].trim().length<=3)return;e.debug(()=>{console.log(`Extracting year: '${o[0]}' into : ${n}`)});let s=ka(o[U5]);n.end!=null&&n.end.assign("year",s),n.start.assign("year",s),n.text+=o[0]}),t}}});var Wv,B1=k(()=>{Xc();Wv=class extends Sf{constructor(){super()}isValid(e,t){let n=t.text.trim();return n===e.text.trim()?!0:n.toLowerCase()==="may"&&!e.text.substring(0,t.index).trim().match(/\b(in)$/i)?(e.debug(()=>{console.log(`Removing unlikely result: ${t}`)}),!1):n.toLowerCase().endsWith("the second")?(e.text.substring(t.index+t.text.length).trim().length>0&&e.debug(()=>{console.log(`Removing unlikely result: ${t}`)}),!1):!0}}});var Ad,xD=k(()=>{FN();ON();LN();BN();qN();UN();zN();WN();jN();GN();KN();JN();m1();_1();k1();A1();D1();P1();$1();O1();L1();bD();N1();B1();Ad=class{createCasualConfiguration(e=!1){let t=this.createConfiguration(!1,e);return t.parsers.push(new Rv),t.parsers.push(new Lv),t.parsers.push(new wv),t.parsers.push(new Bv),t.parsers.push(new qv),t.refiners.push(new Wv),t}createConfiguration(e=!0,t=!1){let n=f1({parsers:[new Vv(t),new vv(e),new yv,new bv(t),new Nv,new xv,new Tv(e),new Sv(e),new _v(e),new Ev],refiners:[new _f]},e);return n.parsers.unshift(new Cv(e)),n.refiners.unshift(new zv),n.refiners.unshift(new Uv),n.refiners.unshift(new Zc),n.refiners.push(new _f),n.refiners.push(new Hv),n.refiners.push(new Av),n}}});var kf,TD,V1=k(()=>{Us();xD();kf=class r{constructor(e){pe(this,"parsers");pe(this,"refiners");pe(this,"defaultConfig",new Ad);e=e||this.defaultConfig.createCasualConfiguration(),this.parsers=[...e.parsers],this.refiners=[...e.refiners]}clone(){return new r({parsers:[...this.parsers],refiners:[...this.refiners]})}parseDate(e,t,n){let i=this.parse(e,t,n);return i.length>0?i[0].start.date():null}parse(e,t,n){let i=new TD(e,t,n),o=[];return this.parsers.forEach(s=>{let a=r.executeParser(i,s);o=o.concat(a)}),o.sort((s,a)=>s.index-a.index),this.refiners.forEach(function(s){o=s.refine(i,o)}),o}static executeParser(e,t){let n=[],i=t.pattern(e),o=e.text,s=e.text,a=i.exec(s);for(;a;){let l=a.index+o.length-s.length;a.index=l;let c=t.extract(e,a);if(!c){s=o.substring(a.index+1),a=i.exec(s);continue}let u=null;c instanceof Fl?u=c:c instanceof Ct?(u=e.createParsingResult(a.index,a[0]),u.start=c):u=e.createParsingResult(a.index,a[0],c);let d=u.index,f=u.text;e.debug(()=>console.log(`${t.constructor.name} extracted (at index=${d}) '${f}'`)),n.push(u),s=o.substring(d+f.length),a=i.exec(s)}return n}},TD=class{constructor(e,t,n){pe(this,"text");pe(this,"option");pe(this,"reference");pe(this,"refDate");this.text=e,this.option=n??{},this.reference=Gc.fromInput(t,this.option.timezones),this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof Ct?e:new Ct(this.reference,e)}createParsingResult(e,t,n,i){let o=typeof t=="string"?t:this.text.substring(e,t),s=n?this.createParsingComponents(n):null,a=i?this.createParsingComponents(i):null;return new Fl(this.reference,e,o,s,a)}debug(e){this.option.debug&&(this.option.debug instanceof Function?this.option.debug(e):this.option.debug.debug(e))}}});var SD,q1,z5,u$e,U1=k(()=>{V1();xD();SD=new Ad,q1=new kf(SD.createCasualConfiguration(!1)),z5=new kf(SD.createConfiguration(!0,!1)),u$e=new kf(SD.createCasualConfiguration(!0))});function z1(r,e,t){return W5.parseDate(r,e,t)}var W5,H1=k(()=>{U1();W5=q1});function K5(r){return!G5.test(r)}var G5,Y5,_D,ns,Dd=k(()=>{H1();G5=/\b(?:last|previous)\b|\bpast\s+(?:few\s+)?(?:\w*day|weekend|week|month|year|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\w*\b/i,Y5=/\bprevious\b/gi;_D=class{getParsedDate(e,t=new Date){let n=e.replace(Y5,"last");return z1(n,t,{forwardDate:K5(n)})}parseDate(e){if(!e||!e.trim())return null;try{let t=this.getParsedDate(e);return t?window.moment?{moment:window.moment(t)}:(console.warn("Moment.js is not available"),null):null}catch(t){return console.warn("Failed to parse date:",e,t),null}}},ns=new _D});function W1(r){return r<=31||r===127||r===8232||r===8233}function Z5(r){let e="",t=0;for(;t0&&e.includes(r[t-1]);)t--;return r.slice(0,t)}function Id(r){return J5.filter(e=>r.includes(e))}function Y1(r){return`A file or folder name cannot contain ${X1(r)}, so this choice would fail at run time. ${Q1}`}function K1(r,e){return`Cannot create "${e}": a file or folder name cannot contain ${X1(r)}. ${Q1}`}function X1(r){return r.map(e=>`"${e}"`).join(", ")}function In(r,e="File path"){let{path:t,problems:n}=J1(r,e);if(n.length>0)throw new Error(n[0]);return t}function Z1(r,e="File path"){return J1(r,e)}function J1(r,e){let t=[],n=r.replace(/\\/g,"/").split("/");return{path:n.map((o,s)=>o.length===0&&s!==0&&s!==n.length-1?(t.push(`${e} contains an empty path segment after formatting.`),o):eK(o,e,t)).join("/"),problems:t}}function eK(r,e,t){if(r.length===0)return r;let n=Q5.test(r),i=X5.test(r),o=Z5(r);n&&(o=o.replace(/^ /u,"")),i&&(o=o.replace(/ $/u,""));let s=j1(o," ");return s==="."||s===".."?(t.push(`${e} cannot contain "." or ".." path segments.`),s):(o=j1(o,". "),o||t.push(`${e} contains an empty path segment after formatting.`),o)}var G1,Q5,X5,J5,Q1,Aa=k(()=>{G1="\0-\x7F\u2028\u2029",Q5=new RegExp(`^ *[${G1}]`,"u"),X5=new RegExp(`[${G1}] *$`,"u");J5=[":"];Q1="Check your own text and tokens like {{TIME}}, which is HH:mm."});function OE(r){return mK.has(r)}function Ol(r){if(!r||r.kind==="now")return"today";if(r.kind==="ask")return"ask";if(r.kind==="variable")return"variable";for(let e of AD)if(r.offset===e.offset&&r.unit===e.unit)return e.id;return"custom"}function RE(r){let{preset:e,previous:t}=r;if(e!=="today"){if(e==="ask")return t?.kind==="ask"?t:n2(Ol(t));if(e==="variable")return t?.kind==="variable"?t:{kind:"variable",name:""};if(e==="custom")return t?.kind==="relative"&&Ol(t)==="custom"?t:{kind:"relative",offset:-2,unit:"days"};for(let n of AD)if(n.id===e)return{kind:"relative",offset:n.offset,unit:n.unit}}}function n2(r){for(let e of ME)if(e.id===r&&e.defaultValue)return{kind:"ask",defaultValue:e.defaultValue};return{kind:"ask"}}function ty(r){let e=(r??"").trim().toLowerCase();for(let t of ME)if(t.aliases.some(n=>n===e))return t.id;return"kept"}function LE(r){let e=ME.map(t=>({value:t.id,label:t.label}));if(ty(r)==="kept"){let t=r?.trim();t&&e.push({value:"kept",label:t})}return e}function NE(r,e){if(r==="kept"){let t=e?.trim();return t||void 0}for(let t of ME)if(t.id===r)return t.defaultValue}function i2(r){return typeof r=="string"&&r.trim().toLowerCase()==="ask"}function $f(r){return r?.kind==="ask"?r:n2(Ol(r))}var fK,kE,AE,DE,IE,Jv,FE,ey,PE,AD,$E,ME,mK,Jc=k(()=>{fK=["today","ask","yesterday","last-week","next-week","last-month","custom","variable"],kE="Which day",AE="The day {{DATE}} writes. The clock stays now. Hold Shift in the QuickAdd menu to pick a different day.",DE="Picker starts on",IE="The date the picker suggests first. You can still pick a different day.",Jv="How far from today",FE="How many days, weeks, months, or years from today. Negative is the past.",ey="Variable name",PE="A VDATE or script value that already has the day.",AD=[{id:"yesterday",label:"Yesterday",offset:-1,unit:"days"},{id:"last-week",label:"Last week",offset:-1,unit:"weeks"},{id:"next-week",label:"Next week",offset:1,unit:"weeks"},{id:"last-month",label:"Last month",offset:-1,unit:"months"}],$E=[{value:"today",label:"Today"},{value:"ask",label:"Ask each time"},...AD.map(r=>({value:r.id,label:r.label})),{value:"custom",label:"Custom\u2026"},{value:"variable",label:"A variable\u2026"}],ME=[{id:"today",label:"Today",defaultValue:void 0,aliases:["","today"]},{id:"yesterday",label:"Yesterday",defaultValue:"yesterday",aliases:["yesterday","yd"]},{id:"last-week",label:"Last week",defaultValue:"last week",aliases:["last week","lw"]},{id:"next-week",label:"Next week",defaultValue:"next week",aliases:["next week","nw"]},{id:"last-month",label:"Last month",defaultValue:"last month",aliases:["last month","lm"]}],mK=new Set(fK)});function $2(r){let e=t=>{t.preventDefault(),t.stopPropagation()};r.addEventListener("pointerdown",e),r.addEventListener("mousedown",e)}function aQ(r){r.forEach(e=>{e.addEventListener("keydown",t=>{if(t.key==="ArrowRight"||t.key==="ArrowLeft"){let i=(r.indexOf(e)+(t.key==="ArrowRight"?1:-1)+r.length)%r.length;r[i].focus(),t.preventDefault()}})})}var dy,vi,Pd=k(()=>{dy=require("obsidian"),vi=class r extends dy.Modal{constructor(t,n,i){super(t);this.header=n;this.text=i;this.input=null;this.waitForClose=new Promise(o=>{this.resolvePromise=o}),this.open(),this.display()}static Ask(t,n,i){return new r(t,n,i).waitForClose}static async Prompt(t,n,i){return await r.Ask(t,n,i)===!0}display(){this.containerEl.addClass("quickAddModal","qaYesNoPrompt"),this.contentEl.empty(),this.titleEl.textContent=this.header,this.contentEl.createEl("p",{text:this.text});let t=this.contentEl.createDiv({cls:"yesNoPromptButtonContainer"}),n=new dy.ButtonComponent(t).setButtonText("No").onClick(()=>this.submit(!1));$2(n.buttonEl);let i=new dy.ButtonComponent(t).setButtonText("Yes").onClick(()=>this.submit(!0)).setDestructive();$2(i.buttonEl),i.buttonEl.focus(),aQ([n.buttonEl,i.buttonEl])}submit(t){this.input=t,this.close()}onClose(){super.onClose(),this.resolvePromise(this.input)}}});var vr,Tr=k(()=>{vr=(c=>(c.Obsidian="Obsidian",c.UserScript="UserScript",c.Choice="Choice",c.Wait="Wait",c.NestedChoice="NestedChoice",c.EditorCommand="EditorCommand",c.AIAssistant="AIAssistant",c.OpenFile="OpenFile",c.Conditional="Conditional",c))(vr||{})});function mn(r){return typeof r=="object"&&r!==null}function ou(r){return mn(r)&&!Array.isArray(r)}function M7(r){return ou(r)?!1:Array.isArray(r)?r.length>0:Kn(r)}function hn(r){return ou(r)?r.commands:M7(r)?r:void 0}function ar(r){return Array.isArray(r)?r:[]}function Xf(r){return Array.isArray(r)?r:[]}function xy(r){return Array.isArray(r)}function Kn(r){return Array.isArray(r)||r==null?!1:typeof r=="object"?Object.keys(r).length>0:!!r}function pI(r){let e=ar(r),t=new Set,n=!1,i=[];for(let o of e){if(Array.isArray(o)){let l=pI(o);for(let c of l.commands){let u=c.id;if(typeof u=="string"&&u!==""&&!t.has(u)){t.add(u),i.push(c);continue}let d={...c,id:ir()};t.add(d.id),i.push(d)}n=!0;continue}if(!mn(o)){n=!0;continue}let s=o.id;if(typeof s=="string"&&s!==""&&!t.has(s)){t.add(s),i.push(o);continue}let a={...o,id:ir()};t.add(a.id),i.push(a),n=!0}return n?{commands:i,changed:n}:{commands:e,changed:!1}}function vB(r){yB(r,new Set)}function yB(r,e){mn(r)&&(e.has(r)||(e.add(r),ou(r)&&(r.id=ir()),mx(hn(r),e)))}function mx(r,e){if(xy(r))for(let t of r){if(Array.isArray(t)){mx(t,e);continue}if(!mn(t)||e.has(t))continue;e.add(t),t.id=ir();let n=t;mx(n.thenCommands,e),mx(n.elseCommands,e),bB(n.choice,e)}}function bB(r,e){if(!mn(r)||e.has(r))return;e.add(r);let t=r;if(t.id=ir(),t.type==="Macro"&&yB(t.macro,e),t.type==="Multi"&&Array.isArray(t.choices))for(let n of t.choices)bB(n,e)}var Qn=k(()=>{Ea()});function su(r){return r!==null&&typeof r=="object"}function wx(r){return r?.secretStorage}function gx(r){return r.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"setting"}function L7(r){let e=5381;for(let t=0;t>>0).toString(36).slice(0,R7)}function CB(r,e){return r.length<=e?r:r.slice(0,e).replace(/-+$/g,"")||"setting"}function TB(r,e){let t=e?.id;return typeof t=="string"&&t.trim().length>0?t:r}function fI(r,e,t){let i=(t?[hx,r,e,t]:[hx,r,e]).join("-");if(i.length<=wB)return i;let o=L7([r,e,t].filter(Boolean).join(":")),s=t?4:3,a=wB-hx.length-o.length-(t?.length??0)-s,l=Math.max(8,Math.floor(a*.6)),c=Math.max(8,a-l);return[hx,CB(r,l),CB(e,c),...t?[t]:[],o].join("-")}function mI(r){return r?.message??String(r)}function Hs(r,e){let t=e;for(;t=r.length)break;let n=hI(r,t,new Map);if(!n?.name){t+=1;continue}if(t=Hs(r,n.end),r[t]!==":"){t+=1;continue}if(t=Hs(r,t+1),r[t]==='"'||r[t]==="'"||r[t]==="`"){let i=Sy(r,t);if(!i)break;e.set(n.name,i.value),t=i.end;continue}if(r.slice(t,t+4)==="true"){e.set(n.name,!0),t+=4;continue}if(r.slice(t,t+5)==="false"){e.set(n.name,!1),t+=5;continue}if(r[t]==="{"){let i=Ty(r,t,"{","}");if(i===-1)break;t=i+1;continue}if(r[t]==="["){let i=Ty(r,t,"[","]");if(i===-1)break;t=i+1;continue}for(;t=a)break;let c=hI(t,l,o);if(!c){l+=1;continue}if(l=Hs(t,c.end),t[l]!==":"){l+=1;continue}if(l=Hs(t,l+1),t[l]!=="{"){l+=1;continue}let u=Ty(t,l,"{","}");if(u===-1||u>a)break;let d=t.slice(l+1,u);V7(d)&&(i=!0,c.name&&n.add(c.name)),l=u+1}}return{names:n,foundSecretOptions:i}}function em(r){return su(r)?r.type==="secret"||(r.type==="text"||r.type==="input")&&r.secret===!0:!1}function Zf(r){return su(r)&&r[xB]===!0&&typeof r.secretRef=="string"&&r.secretRef.trim().length>0}function vx(r){return{[xB]:!0,secretRef:r}}function q7(r,e,t){let n=r.id?.trim()||r.path||r.name||"script";return fI(gx(n),gx(TB(e,t)))}function U7(r){let e=r?.options;return e?Object.entries(e).filter(([,t])=>em(t)).map(([t])=>t):[]}function z7(r){let e=r?.options;return e?Object.entries(e).filter(([,t])=>em(t)):[]}function H7(r){return typeof r.id=="string"&&r.id.trim().length>0}async function gI(r,e){let t=wx(r);if(!t?.getSecret)return null;try{return await Promise.resolve(t.getSecret(e))}catch(n){return P.logWarning(`Failed to read user script SecretStorage entry "${e}": ${mI(n)}`),null}}async function W7(r,e,t){let n=wx(r);if(!n?.setSecret)return!1;try{return await Promise.resolve(n.setSecret(e,t)),!0}catch(i){return P.logWarning(`Failed to write user script SecretStorage entry "${e}": ${mI(i)}`),!1}}async function j7(r,e,t,n,i){let o=e.id?.trim()||e.path||e.name||"script",s=gx(o),a=gx(TB(t,i)),l=fI(s,a),c=1;for(;;){let u=await gI(r,l);if(!u||u===n)return l;c+=1,l=fI(s,a,String(c))}}async function vI(r,e,t,n,i,o){if(n.length===0)return null;let s=i?.trim()||await j7(r,e,t,n,o);return await W7(r,s,n)?s:null}async function yI(r,e){let t=e?.trim();if(!t)return!0;let n=wx(r);if(!n)return!0;let i=n.deleteSecret??n.removeSecret??n.delete;try{if(i)return await Promise.resolve(i.call(n,t)),!0;if(n.setSecret)return await Promise.resolve(n.setSecret(t,"")),!0}catch(o){P.logWarning(`Failed to clear user script SecretStorage entry "${t}": ${mI(o)}`)}return!1}async function Cx(r,e,t){let n=e.settings??{},i={...n},o=new Set(U7(t));for(let[s,a]of Object.entries(n)){if(Zf(a)){let l=await gI(r,a.secretRef);if(l){i[s]=l;continue}throw new Error(`Secret setting "${s}" for user script "${e.name}" is unavailable. Re-enter it on this device.`)}o.has(s)&&(i[s]=typeof a=="string"?a:"")}return i}async function tm(r,e,t){let n=z7(t);if(n.length===0)return!1;let i=wx(r);if(!i?.getSecret||!i?.setSecret)return n.some(([a])=>{let l=e.settings?.[a];return typeof l=="string"&&l.length>0})&&P.logWarning(`SecretStorage unavailable; leaving plaintext user script secret settings for "${e.name}" unchanged.`),!1;let o=!1;for(let[s,a]of n){let l=e.settings?.[s];if(Zf(l))continue;if(typeof l!="string"||l.length===0){if(!H7(a))continue;let u=q7(e,s,a);if(!await gI(r,u))continue;e.settings[s]=vx(u);for(let[f,p]of Object.entries(e.settings))f!==s&&Zf(p)&&p.secretRef===u&&delete e.settings[f];o=!0;continue}let c=await vI(r,e,s,l,void 0,a);c&&(e.settings[s]=vx(c),o=!0)}return o}function Ex(r,e){let t=r.settings?.[e];return Zf(t)?t.secretRef:void 0}async function G7(r,e){if(!su(e))return!0;let t=Object.values(e).filter(Zf).map(i=>i.secretRef);return(await Promise.all(t.map(i=>yI(r,i)))).every(Boolean)}async function _B(r,e){if(!su(e))return!0;let t=!0;if(e.type==="Macro"&&(t=await yx(r,hn(e.macro))&&t),e.type==="Multi"&&Array.isArray(e.choices))for(let n of e.choices)t=await _B(r,n)&&t;return t}async function _y(r,e){if(!su(e))return!0;let t=!0;return e.type==="UserScript"&&(t=await G7(r,e.settings)&&t),Array.isArray(e.thenCommands)&&(t=await yx(r,e.thenCommands)&&t),Array.isArray(e.elseCommands)&&(t=await yx(r,e.elseCommands)&&t),t=await _B(r,e.choice)&&t,t}async function yx(r,e){if(!Array.isArray(e))return!0;let t=!0;for(let n of e){if(Array.isArray(n)){t=await yx(r,n)&&t;continue}t=await _y(r,n)&&t}return t}function Y7(r,e){let t=r.path;if(typeof t=="string")return e?.secretOptionNamesByPath?.get(t)}function K7(r,e,t){if(su(r))for(let[n,i]of Object.entries(r)){if(Zf(i)){delete r[n];continue}typeof i=="string"&&(e===null||e?.has(n)||e===void 0&&t?.stripUnknownStringSettings===!0)&&delete r[n]}}function bI(r,e){su(r)&&(r.type==="UserScript"&&K7(r.settings,Y7(r,e),e),Array.isArray(r.thenCommands)&&bx(r.thenCommands,e),Array.isArray(r.elseCommands)&&bx(r.elseCommands,e),rm(r.choice,e))}function bx(r,e){if(Array.isArray(r))for(let t of r){if(Array.isArray(t)){bx(t,e);continue}bI(t,e)}}function rm(r,e){if(su(r)&&(r.type==="Macro"&&bx(hn(r.macro),e),r.type==="Multi"&&Array.isArray(r.choices)))for(let t of r.choices)rm(t,e)}var hx,xB,O7,wB,R7,Bl=k(()=>{De();Eg();Qn();hx="quickadd-user-script",xB="__quickaddSecret",O7=/\.md$/i,wB=64,R7=8});function nm(r,e){if(e.options)for(let t in e.options){let n=r[t]===void 0,i="defaultValue"in e.options[t]&&e.options[t].defaultValue!==void 0;n&&i&&!em(e.options[t])&&(r[t]=e.options[t].defaultValue)}}var xx=k(()=>{Bl()});function Ji(r){if(r.length===0)return 0;let e=new TextEncoder().encode(r).length,t=!1;for(let i=0;i127){t=!0;break}return Math.max(1,Math.ceil(e/(t?3:4)))}function AB(r){return!Number.isFinite(r)||r<=0?1:Math.max(1,Math.floor(r*.45))}var ky=k(()=>{});function PB(){return ne.getState().ai.providers.flatMap(e=>e.models).map(e=>e.name)}function EI(){return ne.getState().ai.providers}function DB(r,e){for(let t of r){let n=t.models.find(i=>i.name===e);if(n)return{provider:t,model:n}}}function CI(r){let e=EI();return e.filter(t=>t.models.some(n=>n.name===r)).map(t=>{let n=`${t.id??t.name}/${r}`;return e.some(o=>o.models.some(s=>s.name===n))?`{ name: "${r}", provider: "${t.id??t.name}" } (the string "${n}" is itself a model id on another provider)`:n})}function FB(r,e){IB.has(r)||(IB.add(r),P.logWarning(e))}function Ld(r,e){let t=EI(),n=e?.silent===!0;if(r==null)return;if(typeof r!="string"){let s=t.find(c=>c.id===r.providerId),a=s?.models.find(c=>c.name===r.name);if(s&&a)return{provider:s,model:a};let l=DB(t,r.name);return l?(n||FB(`pin:${r.providerId}/${r.name}\u2192${l.provider.id??l.provider.name}`,`Model "${r.name}" is pinned to provider "${r.providerId}", which no longer serves it. Using "${l.provider.name}" instead \u2014 re-select the model in the command's settings to pin it again.`),l):void 0}let i=DB(t,r);if(i){let s=CI(r);return s.length>1&&!n&&FB(`ambiguous:${r}\u2192${i.provider.id??i.provider.name}`,`Model "${r}" is served by ${s.length} providers; using "${i.provider.name}". Qualify it to choose explicitly: ${s.join(", ")}.`),i}let o=r.indexOf("/");if(!(o<=0||o===r.length-1))return $B(r.slice(0,o),r.slice(o+1))}function $B(r,e){let t=EI(),n=r.trim().toLowerCase(),i=t.find(s=>s.id?.toLowerCase()===n)??t.find(s=>s.name.trim().toLowerCase()===n),o=i?.models.find(s=>s.name===e);if(i&&o)return{provider:i,model:o}}function im(r){let e=typeof r=="string"?r:r?.name;if(!e)throw new Error('Invalid model parameter. Expected a string (e.g., "gpt-4o" or "openai/gpt-4o") or an object with a name property (e.g., {name: "gpt-4o", provider: "openai"})');let t=typeof r!="string"&&r.provider?$B(r.provider,e):Ld(e);if(!t){let n=e.includes("/")?e.slice(e.indexOf("/")+1):e,i=[...CI(e),...n!==e?CI(n):[]],o=i.length?` Did you mean ${i.join(" or ")}?`:" Add it under Edit providers in QuickAdd's AI Assistant settings (the sparkles button below the choice list), or enable auto-sync for that provider.";throw new Error(`Model '${typeof r=="string"?r:`${r.provider??""}/${e}`}' not found in configured providers.${o}`)}return t}var IB,om=k(()=>{De();ht();IB=new Set});var Dx=k(()=>{});var Mn,Vl=k(()=>{Ea();Mn=class{constructor(e,t){this.name=e,this.type=t,this.id=ir()}}});var Rx,Or,lu=k(()=>{Rx=require("obsidian");De();Qi();Er();Or=class r extends Rx.FuzzySuggestModal{constructor(t,n,i,o={}){super(t);this.warnedOnEmptyDisplay=!1;this.warnRenderItemFailure=wd("Custom renderItem threw an error; falling back to default rendering");this.warnCustomValueFailure=wd("Custom create-row rendering threw an error; falling back to default rendering");this.allowCustomValue=!0;this.items=i,this.displayItems=n.map(s=>zr(s)),this.searchItems=o.searchItems?.map(s=>zr(s))??[],this.promise=new Promise((s,a)=>{this.resolvePromise=s,this.rejectPromise=a}),this.renderItem=o.renderItem,this.allowCustomValue=o.allowCustomValue??!0,this.customValueLabel=o.customValueLabel,this.valueExists=o.valueExists,this.inputEl.addEventListener("keydown",s=>{if(s.code!=="Tab"||!("chooser"in this))return;let{values:a,selectedItem:l}=this.chooser,{value:c}=this.inputEl;this.inputEl.value=a[l]?.item??c}),o.placeholder&&this.setPlaceholder(o.placeholder),typeof o.limit=="number"&&(this.limit=o.limit),o.emptyStateText&&(this.emptyStateText=o.emptyStateText),this.displayItems.length!==this.items.length&&(this.displayItems=this.items.map((s,a)=>{let l=this.displayItems[a];return zr(l??s)})),this.searchItems.length!==this.items.length&&(this.searchItems=this.items.map((s,a)=>zr(this.searchItems[a]??this.displayItems[a]??s))),o.skippable&&gC(this,()=>this.skip()),this.warnIfEmptyDisplay(),this.open()}static Suggest(t,n,i,o={}){return new r(t,n,i,o).promise}getItemText(t){if(t===this.inputEl.value)return t;let n=this.items.indexOf(t),i=n>=0?this.searchItems[n]:void 0;return zr(i??t)}getItems(){return this.items}getSuggestions(t){let n=xl(t),i=super.getSuggestions(n);if(!this.allowCustomValue)return i;let o=xl(this.inputEl.value);if(!o||this.items.includes(o)||this.valueExists?.(o)||i.some(l=>l.item===o))return i;let a={item:o,match:{score:Number.NEGATIVE_INFINITY,matches:[]}};return this.customValueLabel?i.unshift(a):i.push(a),i}selectSuggestion(t,n){this.resolved=!0,super.selectSuggestion(t,n)}renderSuggestion(t,n){if(this.customValueLabel&&t.match.score===Number.NEGATIVE_INFINITY){this.renderCustomValue(t.item,n);return}if(!this.renderItem){super.renderSuggestion(t,n);return}try{n.empty(),this.renderItem(t.item,n)}catch(i){this.warnRenderItemFailure(i),n.empty(),super.renderSuggestion(t,n)}}renderCustomValue(t,n){try{n.empty(),n.addClass("mod-complex"),n.createDiv({cls:"suggestion-content"}).createDiv({cls:"suggestion-title",text:this.customValueLabel?.(t)??t});let o=n.createDiv({cls:"suggestion-aux"});(0,Rx.setIcon)(o.createSpan({cls:"suggestion-flair"}),"file-plus")}catch(i){this.warnCustomValueFailure(i),n.empty(),super.renderSuggestion({item:t,match:{score:0,matches:[]}},n)}}onChooseItem(t,n){this.resolved=!0,this.resolvePromise(t)}skip(){this.resolved=!0,this.resolvePromise(""),this.close()}onClose(){super.onClose(),this.resolved||this.rejectPromise(Ir())}warnIfEmptyDisplay(){if(this.warnedOnEmptyDisplay)return;this.displayItems.some(n=>n.length===0)&&(this.warnedOnEmptyDisplay=!0,P.logWarning("QuickAdd suggester received empty display values. Check your displayItems mapping."))}}});var So=k(()=>{});var St,Ws=k(()=>{Tr();Vl();wa();De();St=class extends Mn{constructor(e){super(e,"EditorCommand"),this.editorCommandType=e}static getSelectedText(e){return this.getActiveMarkdownView(e).editor.getSelection()}static getActiveMarkdownView(e){let t=ln(e);if(!t)throw P.logError("no active markdown editor."),new Error("no active markdown editor.");return t}}});var cm,kI=k(()=>{So();Ws();cm=class extends St{constructor(){super("Copy")}static async run(e){let t=St.getSelectedText(e);await navigator.clipboard.writeText(t)}}});var um,AI=k(()=>{So();Ws();De();um=class extends St{constructor(){super("Cut")}static async run(e){let t=St.getSelectedText(e),n=St.getActiveMarkdownView(e);if(!t){P.logError("nothing selected.");return}await navigator.clipboard.writeText(t),n.editor.replaceSelection("")}}});var dm,DI=k(()=>{So();De();Ws();dm=class extends St{constructor(){super("Paste")}static async run(e){let t=await navigator.clipboard.readText(),n=St.getActiveMarkdownView(e);if(!n){P.logError("no active markdown view.");return}n.editor.replaceSelection(t)}}});var UB,pm,II=k(()=>{UB=require("obsidian");De();Ws();So();pm=class extends St{constructor(){super("Paste with format")}static async run(e){let t=St.getActiveMarkdownView(e);if(!t){P.logError("no active markdown view.");return}let n="";try{if("read"in navigator.clipboard&&navigator.clipboard.read){let i=await navigator.clipboard.read(),o=!1;for(let s of i)if(s.types.includes("text/html")){let l=await(await s.getType("text/html")).text();n=(0,UB.htmlToMarkdown)(l),o=!0;break}o||(n=await navigator.clipboard.readText())}else n=await navigator.clipboard.readText();t.editor.replaceSelection(n)}catch(i){P.logWarning(`Formatted paste failed. Falling back to plain text: ${i}`);try{let o=await navigator.clipboard.readText();t.editor.replaceSelection(o)}catch(o){P.logError(`Failed to read clipboard text: ${o}`)}}}}});var fm,FI=k(()=>{So();Ws();fm=class extends St{constructor(){super("Select active line")}static run(e){let t=St.getActiveMarkdownView(e),{line:n}=t.editor.getCursor(),o=t.editor.getLine(n).length;t.editor.setSelection({line:n,ch:0},{line:n,ch:o})}}});var mm,PI=k(()=>{Ws();So();Je();De();mm=class extends St{constructor(){super("Select link on active line")}static run(e){let t=St.getActiveMarkdownView(e),{line:n}=t.editor.getCursor(),i=t.editor.getLine(n),o=gO.exec(i);if(!o){P.logError(`no internal link found on line ${n}.`);return}let s=o.index,a=o[0].length+s;t.editor.setSelection({line:n,ch:s},{line:n,ch:a})}}});var hm,$I=k(()=>{Ws();So();hm=class extends St{constructor(){super("Move cursor to file start")}static run(e){St.getActiveMarkdownView(e).editor.setCursor({line:0,ch:0})}}});var gm,MI=k(()=>{Ws();So();gm=class extends St{constructor(){super("Move cursor to file end")}static run(e){let t=St.getActiveMarkdownView(e),n=t.editor.lastLine(),i=t.editor.getLine(n).length;t.editor.setCursor({line:n,ch:i})}}});var vm,OI=k(()=>{Ws();So();vm=class extends St{constructor(){super("Move cursor to line start")}static run(e){let t=St.getActiveMarkdownView(e),{line:n}=t.editor.getCursor();t.editor.setCursor({line:n,ch:0})}}});var ym,RI=k(()=>{Ws();So();ym=class extends St{constructor(){super("Move cursor to line end")}static run(e){let t=St.getActiveMarkdownView(e),{line:n}=t.editor.getCursor(),i=t.editor.getLine(n).length;t.editor.setCursor({line:n,ch:i})}}});function sV(r,e=new Set){if(r==null||e.has(r))return[];if(e.add(r),typeof r=="string")return[r];if(typeof r!="object")return[String(r)];let t=r,n=[];for(let i of M9){let o=t[i];o!==void 0&&n.push(...sV(o,e))}return n}function Xx(r){return Number(r.replace(/,/g,""))}function O9(r){let e=r.match(/context (?:length|window)(?:\s+is)?(?:\s+of)?\s*(\d[\d,]*)/i);return e?Xx(e[1]):null}function R9(r){let e=r.match(/(\d[\d,]*)\s*(?:tokens?\s+)?in the completion\b/i);if(e){let n=Xx(e[1]),i=O9(r);return i===null?"input":n>=i?"output":"input"}let t=r.match(/input length and max_tokens exceed context limit:?\s*(\d[\d,]*)\s*\+\s*(\d[\d,]*)(?:\s*>\s*(\d[\d,]*))?/i);if(t){let n=Xx(t[2]),i=t[3]?Xx(t[3]):null;return i===null?"input":n>=i?"output":"input"}return null}function Oy(r){let e=sV(r).join(" "),t=R9(e);return t==="output"?"output_budget":t==="input"?"input_context":$9.some(n=>n.test(e))?"output_budget":P9.some(n=>n.test(e))?"input_context":"other"}function aV(r){return Oy(r)==="input_context"}function Zx(r,e){let t="",n="",i;try{i=e.json}catch{i=void 0}if(i&&typeof i=="object"){let s=i,a=s.error??s;t=String(a.message??s.message??""),n=String(a.code??a.type??a.status??"")}t||(t=typeof e.text=="string"&&e.text.length>0?e.text:`HTTP ${e.status}`);let o=new Error(`${r} request failed (HTTP ${e.status})${n?` [${n}]`:""}: ${t}`);return o.status=e.status,n&&(o.providerCode=n),o}var P9,$9,M9,Ry=k(()=>{P9=[/context[_ -]?length[_ -]?exceeded/i,/context[_ -]?window[_ -]?exceeded/i,/maximum context length/i,/context window/i,/too many input tokens/i,/input(?: is)? too long/i,/prompt(?: is)? too long/i,/input token count/i,/reduce the length of (?:the |your )?(?:messages|prompt|input)/i,/exceed(?:s|ed|ing)? (?:the )?(?:maximum |allowed )?(?:input |prompt )?(?:token|context)/i],$9=[/max_tokens/i,/max_completion_tokens/i,/max(?:imum)? output tokens/i,/output token limit/i],M9=["message","code","type","status","statusText","providerCode","error","response","json","cause"]});function G9(r){return r.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"provider"}function Y9(r){let e=r.name?.trim()||"provider";return`${j9}-${G9(e)}`}async function dV(r,e){if(!r?.secretStorage?.getSecret)return null;try{return await Promise.resolve(r.secretStorage.getSecret(e))}catch(t){return P.logWarning(`Failed to read SecretStorage entry "${e}": ${t.message??t}`),null}}async function Gs(r,e){let t=e.apiKeyRef?.trim();if(t){let n=await dV(r,t);if(n)return n}return e.apiKey??""}async function pV(r,e,t){let n=t?.trim();if(!n||!r?.secretStorage?.getSecret||!r.secretStorage?.setSecret)return null;let i=Y9(e),o=i,s=1;for(;;){let a=await dV(r,o);if(!a)break;if(a===n)return o;s+=1,o=`${i}-${s}`}try{return await Promise.resolve(r.secretStorage.setSecret(o,n)),o}catch(a){return P.logWarning(`Failed to write SecretStorage entry "${o}": ${a.message??a}`),null}}var j9,Nd=k(()=>{De();j9="quickadd-ai"});function VV(r){try{let e=window.require;return e?e(r):null}catch{return null}}async function Im(r,e){let t=r.vault.adapter;if(typeof sF.FileSystemAdapter!="function"||!(t instanceof sF.FileSystemAdapter))return;let n=VV("fs"),i=VV("path");if(!n?.promises||!i)return;let o=await n.promises.realpath(t.getBasePath()),a=t.getFullPath(e);for(;!eZ(n,a);){let f=i.dirname(a);if(f===a)break;a=f}let l;try{l=await n.promises.realpath(a)}catch{throw new Ny(`Refusing to write to "${e}": it resolves through an unresolvable (dangling) symlink.`)}let c=i.relative(o,l);if(c===".."||c.startsWith(`..${i.sep}`)||i.isAbsolute(c))throw new Ny(`Refusing to write to "${e}": it resolves (via a symlink) outside the vault.`);if(c.split(i.sep).some(f=>f.startsWith(".")))throw new Ny(`Refusing to write to "${e}": it resolves (via a symlink) into a config/hidden directory.`)}function eZ(r,e){try{return r.lstatSync(e),!0}catch{return!1}}var sF,Ny,aF=k(()=>{sF=require("obsidian"),Ny=class extends Error{constructor(e){super(e),this.name="VaultWriteEscapeError"}}});var ve,Bi=k(()=>{jo();ve=class extends Tt{}});var Cq,hr,Ul=k(()=>{Cq=require("obsidian");De();Qi();Er();hr=class r extends Cq.FuzzySuggestModal{constructor(t,n,i,o,s){super(t);this.warnedOnEmptyDisplay=!1;this.warnRenderItemFailure=wd("Custom renderItem threw an error; falling back to default rendering");this.renderItem=o,this.items=i,this.displayItems=n.map(a=>zr(a)),this.promise=new Promise((a,l)=>{this.resolvePromise=a,this.rejectPromise=l}),s?.skippable&&gC(this,()=>this.skip()),this.inputEl.addEventListener("keydown",a=>{if(a.code!=="Tab"||!("chooser"in this))return;let{values:l,selectedItem:c}=this.chooser,{value:u}=this.inputEl;this.inputEl.value=l[c]?.item??u}),this.displayItems.length!==this.items.length&&(this.displayItems=this.items.map((a,l)=>{let c=this.displayItems[l];return zr(c??a)})),this.warnIfEmptyDisplay(),this.open()}static Suggest(t,n,i,o,s,a){let l=new r(t,n,i,s,a);return o&&l.setPlaceholder(o),l.promise}getItemText(t){let n=this.items.indexOf(t),i=n>=0?this.displayItems[n]:void 0;return zr(i??t)}getItems(){return this.items}getSuggestions(t){let n=xl(t);return super.getSuggestions(n)}selectSuggestion(t,n){this.resolved=!0,super.selectSuggestion(t,n)}renderSuggestion(t,n){if(!this.renderItem){super.renderSuggestion(t,n);return}try{n.empty(),this.renderItem(t.item,n)}catch(i){this.warnRenderItemFailure(i),n.empty(),super.renderSuggestion(t,n)}}onChooseItem(t,n){this.resolved=!0,this.resolvePromise(t)}skip(){this.resolved=!0,this.resolvePromise(""),this.close()}onClose(){super.onClose(),this.resolved||this.rejectPromise(Ir())}warnIfEmptyDisplay(){if(this.warnedOnEmptyDisplay)return;this.displayItems.some(n=>n.length===0)&&(this.warnedOnEmptyDisplay=!0,P.logWarning("QuickAdd suggester received empty display values. Check your displayItems mapping."))}}});function Jn(r,e){if(!r)throw new Error(typeof e=="function"?e():e)}var zy=k(()=>{});function $m(r){return _F.filter(e=>typeof r[e]=="number")}function PT(r){let e={...r};for(let t of _F)delete e[t];return e}function kF(r,e){return r.supportsTemperature===!1&&$m(e).length>0?PT(e):e}function AF(r,e){return e.length===0?!1:kJ.some(t=>t.test(r))}function $T(r){let e=r.map(t=>_J[t]);return e.length<=1?e.join(""):e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`}var _F,_J,FT,kJ,Eq=k(()=>{_F=["temperature","top_p","frequency_penalty","presence_penalty"],_J={temperature:"Temperature",top_p:"Top P",frequency_penalty:"Frequency penalty",presence_penalty:"Presence penalty"};FT=_F.join("|"),kJ=[new RegExp(`unsupported (?:parameter|value)[^.]{0,40}['\`"]?(?:${FT})['\`"]?`,"i"),new RegExp(`['\`"]?(?:${FT})['\`"]?[^.]{0,40}(?:is deprecated|is not supported|not supported|does not support)`,"i"),new RegExp(`unrecognized request argument[^.]{0,40}(?:${FT})`,"i"),new RegExp(`(?:${FT})[^.]{0,40}extra inputs are not permitted`,"i")]});function MT(r){let e=r.workspace.activeEditor?.editor?.getCursor(),t=r.workspace.activeEditor?.editor?.listSelections();return()=>{e&&r.workspace.activeEditor?.editor?.setCursor(e),t&&r.workspace.activeEditor?.editor?.setSelections(t)}}var DF=k(()=>{});function Hy(r){let e=Array.isArray(r)?r:{...r},t=e.type==="object"||Array.isArray(e.type)&&e.type.includes("object")||e.properties!==void 0;if(e.properties){let n={};for(let[i,o]of Object.entries(e.properties))n[i]=Hy(o);e.properties=n}return e.items&&!Array.isArray(e.items)&&(e.items=Hy(e.items)),t&&(e.additionalProperties=!1,e.required=e.properties?Object.keys(e.properties):[]),e}function AJ(r){let e=[];for(let t of r)if(t.role==="system")e.push({role:"system",content:t.content});else if(t.role==="user")e.push({role:"user",content:t.content});else if(t.role==="assistant"){let n={role:"assistant",content:t.content??""};t.toolCalls&&t.toolCalls.length>0&&(n.tool_calls=t.toolCalls.map(i=>({id:i.id,type:"function",function:{name:i.name,arguments:i.rawArgs??JSON.stringify(i.args??{})}}))),e.push(n)}else for(let n of t.results)e.push({role:"tool",tool_call_id:n.toolCallId,content:n.isError?`ERROR: ${n.content}`:n.content});return e}function DJ(r){return r.map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.strict?Hy(e.parameters):e.parameters,...e.strict?{strict:!0}:{}}}))}function IJ(r){return typeof r=="string"?r:{type:"function",function:{name:r.name}}}function PJ(r,e){let t={model:r,...e.modelParams??{},messages:AJ(e.messages)};return e.tools&&e.tools.length>0&&(t.tools=DJ(e.tools),e.toolChoice&&(t.tool_choice=IJ(e.toolChoice)),e.disableParallel&&(t.parallel_tool_calls=!1)),e.maxOutputTokens!==void 0&&(FJ.test(r)?t.max_completion_tokens=e.maxOutputTokens:t.max_tokens=e.maxOutputTokens),e.responseFormat&&(t.response_format=e.responseFormat.schema?{type:"json_schema",json_schema:{name:e.responseFormat.name??"response",strict:e.responseFormat.strict??!0,schema:e.responseFormat.strict??!0?Hy(e.responseFormat.schema):e.responseFormat.schema}}:{type:"json_object"}),t}function $J(r){let e=r.choices?.[0]??{},t=e.message??{},i=(t.tool_calls??[]).map(a=>MJ(a)),o=String(e.finish_reason??""),s=r.usage??{};return{content:t.content??"",toolCalls:i,normalizedStopReason:i.length>0||o==="tool_calls"?"tool_calls":o==="length"?"length":o==="stop"?"stop":"other",rawStopReason:o,usage:{promptTokens:s.prompt_tokens??0,completionTokens:s.completion_tokens??0,totalTokens:s.total_tokens??0}}}function xq(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)?r:null}function MJ(r){let e=r.function.arguments;if(typeof e=="string")try{let n=xq(JSON.parse(e||"{}"));if(!n)throw new Error("tool arguments are not a JSON object");return{id:r.id,name:r.function.name,args:n,rawArgs:e}}catch{return{id:r.id,name:r.function.name,args:null,rawArgs:e,parseError:!0}}let t=xq(e);return t?{id:r.id,name:r.function.name,args:t}:{id:r.id,name:r.function.name,args:null,rawArgs:typeof e=="string"?e:JSON.stringify(e??{}),parseError:!0}}function OJ(r,e,t){let n=[],i=[];for(let a of e.messages)if(a.role==="system")a.content&&n.push(a.content);else if(a.role==="user")i.push({role:"user",content:a.content});else if(a.role==="assistant"){let l=[];a.content&&l.push({type:"text",text:a.content});for(let c of a.toolCalls??[])l.push({type:"tool_use",id:c.id,name:c.name,input:c.args??{}});i.push({role:"assistant",content:l})}else i.push({role:"user",content:a.results.map(l=>({type:"tool_result",tool_use_id:l.toolCallId,content:l.content,...l.isError?{is_error:!0}:{}}))});let o={model:r,max_tokens:e.maxOutputTokens??t,messages:i};n.length>0&&(o.system=n.join(` `));let s=e.modelParams??{};return typeof s.temperature=="number"&&(o.temperature=s.temperature),typeof s.top_p=="number"&&(o.top_p=s.top_p),e.tools&&e.tools.length>0&&(o.tools=e.tools.map(a=>({name:a.name,description:a.description,input_schema:a.parameters})),e.toolChoice?o.tool_choice=RJ(e.toolChoice,e.disableParallel):e.disableParallel&&(o.tool_choice={type:"auto",disable_parallel_tool_use:!0})),e.responseFormat?.schema&&(o.output_config={format:{type:"json_schema",schema:Hy(e.responseFormat.schema)}}),o}function RJ(r,e){let t=e?{disable_parallel_tool_use:!0}:{};return typeof r=="string"?r==="required"?{type:"any",...t}:r==="none"?{type:"none"}:{type:"auto",...t}:{type:"tool",name:r.name,...t}}function LJ(r){let e=r.content??[],t=e.filter(a=>a.type==="tool_use").map(a=>({id:a.id??"",name:a.name??"",args:a.input??{}})),n=String(r.stop_reason??""),i=r.usage??{},o=i.input_tokens??0,s=i.output_tokens??0;return{content:e.filter(a=>a.type==="text").map(a=>a.text??"").join(""),toolCalls:t,normalizedStopReason:n==="tool_use"||t.length>0?"tool_calls":n==="max_tokens"?"length":n==="end_turn"||n==="stop_sequence"?"stop":"other",rawStopReason:n,usage:{promptTokens:o,completionTokens:s,totalTokens:o+s}}}function NJ(r,e){let t=[],n=[];for(let a of e.messages)if(a.role==="system")a.content&&t.push(a.content);else if(a.role==="user")n.push({role:"user",parts:[{text:a.content}]});else if(a.role==="assistant")if(Array.isArray(a.providerRaw))n.push({role:"model",parts:a.providerRaw});else{let l=[];a.content&&l.push({text:a.content});for(let c of a.toolCalls??[])l.push({functionCall:{name:c.name,args:c.args??{}}});n.push({role:"model",parts:l})}else n.push({role:"user",parts:a.results.map(l=>({functionResponse:{name:l.name,response:l.isError?{error:l.content}:{result:l.content}}}))});let i={contents:n};t.length>0&&(i.systemInstruction={role:"system",parts:[{text:t.join(` `)}]}),e.tools&&e.tools.length>0&&(i.tools=[{functionDeclarations:e.tools.map(a=>({name:a.name,description:a.description,parameters:a.parameters}))}],e.toolChoice&&(i.toolConfig=BJ(e.toolChoice)));let o={},s=e.modelParams??{};return typeof s.temperature=="number"&&(o.temperature=s.temperature),typeof s.top_p=="number"&&(o.topP=s.top_p),e.maxOutputTokens!==void 0&&(o.maxOutputTokens=e.maxOutputTokens),e.responseFormat?.schema&&(o.responseMimeType="application/json",o.responseSchema=e.responseFormat.schema),Object.keys(o).length>0&&(i.generationConfig=o),i}function BJ(r){return typeof r=="string"?{functionCallingConfig:{mode:r==="required"?"ANY":r==="none"?"NONE":"AUTO"}}:{functionCallingConfig:{mode:"ANY",allowedFunctionNames:[r.name]}}}function VJ(r){let e=r.candidates?.[0]??{},n=(e.content??{}).parts??[],i=n.filter(a=>a.functionCall).map((a,l)=>({id:a.functionCall?.id??`gemini-call-${l}`,name:a.functionCall?.name??"",args:a.functionCall?.args??{}})),o=String(e.finishReason??""),s=r.usageMetadata??{};return{content:n.filter(a=>typeof a.text=="string").map(a=>a.text??"").join(""),toolCalls:i,normalizedStopReason:i.length>0?"tool_calls":o==="MAX_TOKENS"?"length":o==="STOP"?"stop":"other",rawStopReason:o,usage:{promptTokens:s.promptTokenCount??0,completionTokens:s.candidatesTokenCount??0,totalTokens:s.totalTokenCount??0},providerRaw:n}}function IF(r,e,t,n=8192){switch(r){case"anthropic":return OJ(e,t,n);case"gemini":return NJ(e,t);default:return PJ(e,t)}}function Tq(r,e){switch(r){case"anthropic":return LJ(e);case"gemini":return VJ(e);default:return $J(e)}}var FJ,Sq=k(()=>{FJ=/^(?:o[1-9]|gpt-(?:[5-9]|\d\d))/i});async function Mm(r,e,t){let n=(0,jy.requestUrl)({...r,throw:!1});t&&t();let i=await n;if(i.status>=400)throw Zx(e,i);return i.json}function qJ(r){return{id:r.id,model:r.model,content:r.choices[0].message.content,usage:{promptTokens:r.usage.prompt_tokens,completionTokens:r.usage.completion_tokens,totalTokens:r.usage.total_tokens},stopReason:r.choices[0].finish_reason,stopSequence:null,created:r.created}}function UJ(r){return{id:r.id,model:r.model,content:r.content.filter(e=>e.type==="text").map(e=>e.text??"").join(""),usage:{promptTokens:r.usage.input_tokens,completionTokens:r.usage.output_tokens,totalTokens:r.usage.input_tokens+r.usage.output_tokens},stopReason:r.stop_reason,stopSequence:r.stop_sequence,created:Date.now()}}async function zJ(r,e,t,n,i,o,s){return Mm({url:`${t.endpoint}/chat/completions`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({model:e.name,...i,messages:[{role:"system",content:n},{role:"user",content:o}]})},t.name,s)}function FF(r){if(typeof r.maxOutputTokens=="number"&&Number.isFinite(r.maxOutputTokens)&&r.maxOutputTokens>0)return Math.floor(r.maxOutputTokens);let e=4096;return Number.isFinite(r.maxTokens)&&r.maxTokens>0?Math.min(e,r.maxTokens):e}async function HJ(r,e,t,n,i,o,s){let a={model:e.name,max_tokens:FF(e),messages:[{role:"user",content:o}]};return n&&n.trim().length>0&&(a.system=n),typeof i.temperature=="number"&&(a.temperature=i.temperature),typeof i.top_p=="number"&&(a.top_p=i.top_p),Mm({url:`${t.endpoint}/v1/messages`,method:"POST",headers:{"Content-Type":"application/json","x-api-key":r,"anthropic-version":"2023-06-01"},body:JSON.stringify(a)},t.name,s)}async function WJ(r,e,t,n,i,o,s){let a=`${t.endpoint}/v1beta/models/${encodeURIComponent(e.name)}:generateContent`,l={};typeof i.temperature=="number"&&(l.temperature=i.temperature),typeof i.top_p=="number"&&(l.topP=i.top_p);let c={contents:[{role:"user",parts:[{text:o}]}]};return n&&n.trim().length>0&&(c.systemInstruction={role:"system",parts:[{text:n}]}),Object.keys(l).length>0&&(c.generationConfig=l),Mm({url:a,method:"POST",headers:{"Content-Type":"application/json","x-goog-api-key":r},body:JSON.stringify(c)},t.name,s)}function jJ(r){let e=r.candidates?.[0],n=(e?.content?.parts??[]).map(i=>typeof i.text=="string"?i.text:"").join("");return{id:`${Date.now()}`,model:r.modelVersion??"gemini",content:n,usage:{promptTokens:r.usageMetadata?.promptTokenCount??0,completionTokens:r.usageMetadata?.candidatesTokenCount??0,totalTokens:r.usageMetadata?.totalTokenCount??0},stopReason:e?.finishReason??"",stopSequence:null,created:Date.now()}}function OT(r,e,t,n,i,o={}){return async function(a){if(ne.getState().disableOnlineFeatures)throw new Error("Blocking request: Online features are disabled in settings.");let l=Ji(a)+Ji(i),c=Date.now(),u=MF({provider:n.name,endpoint:n.endpoint,model:t.name,systemPrompt:i,prompt:a,modelOptions:o});P.logMessage(`[AI Request ${u}] Started ${n.name}/${t.name}`),Number.isFinite(t.maxTokens)&&t.maxTokens>0&&l>t.maxTokens&&P.logMessage(`[AI Request ${u}] Estimated prompt size is ${l} tokens, above the configured ${t.maxTokens} token context. Sending anyway; the provider will enforce the exact limit.`);try{let d=MT(r),f=sg(n),p=async w=>f==="anthropic"?UJ(await HJ(e,t,n,i,w,a,d)):f==="gemini"?jJ(await WJ(e,t,n,i,w,a,d)):qJ(await zJ(e,t,n,i,w,a,d)),m=kF(t,o),v=$m(m);v.length===0&&$m(o).length>0&&P.logMessage(`[AI Request ${u}] ${t.name} uses fixed sampling; not sending ${$T($m(o))}.`);let g;try{g=await p(m)}catch(w){let T=w.message??String(w);if(!AF(T,v))throw w;let b=$T(v);P.logMessage(`[AI Request ${u}] ${n.name} rejected ${b}; retrying without sampling parameters.`),new jy.Notice(`${t.name} doesn't accept the ${b} setting${v.length>1?"s":""}, so QuickAdd retried without ${v.length>1?"them":"it"}. You can remove ${v.length>1?"them":"it"} from this command's advanced settings.`),g=await p(PT(m))}let y=Date.now()-c;return Wy(u,{status:"success",durationMs:y,usage:g.usage}),P.logMessage(`[AI Request ${u}] Success in ${y}ms`),g}catch(d){let f=d.message??String(d),p=Date.now()-c;Wy(u,{status:"error",durationMs:p,errorMessage:f}),P.logMessage(`[AI Request ${u}] Failed in ${p}ms: ${f}`);let m=Oy(d)==="input_context"?" The prompt likely exceeds the model's context window \u2014 shorten it, choose a model with a larger context, or use the chunked AI prompt API.":"",v=new Error(`Error while making request to ${n.name}: ${f}${m}`,{cause:d});throw We(v),v}}}async function _q(r,e,t,n,i,o){if(r==="anthropic")return Mm({url:`${t.endpoint}/v1/messages`,method:"POST",headers:{"Content-Type":"application/json","x-api-key":e,"anthropic-version":"2023-06-01"},body:JSON.stringify(i)},t.name,o);if(r==="gemini"){let s=`${t.endpoint}/v1beta/models/${encodeURIComponent(n.name)}:generateContent`;return Mm({url:s,method:"POST",headers:{"Content-Type":"application/json","x-goog-api-key":e},body:JSON.stringify(i)},t.name,o)}return Mm({url:`${t.endpoint}/chat/completions`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify(i)},t.name,o)}async function PF(r,e,t,n,i,o){if(ne.getState().disableOnlineFeatures)throw new Error("Blocking request: Online features are disabled in settings.");let s=sg(n),a={...i,modelParams:kF(t,i.modelParams??{})},l=$m(a.modelParams??{}),c=IF(s,t.name,a,FF(t)),u=i.messages.find(m=>m.role==="system"),d=[...i.messages].reverse().find(m=>m.role==="user"),f=Date.now(),p=MF({provider:n.name,endpoint:n.endpoint,model:t.name,systemPrompt:u&&u.role==="system"?u.content:"",prompt:d&&d.role==="user"?d.content:"[tool-calling turn]",modelOptions:i.modelParams??{}});try{let m;try{m=await _q(s,e,n,t,c,o)}catch(y){let w=y.message??String(y);if(!AF(w,l))throw y;let T=$T(l);P.logMessage(`[AI Chat ${p}] ${n.name} rejected ${T}; retrying without sampling parameters.`),new jy.Notice(`${t.name} doesn't accept the ${T} setting${l.length>1?"s":""}, so QuickAdd retried without ${l.length>1?"them":"it"}.`);let b=IF(s,t.name,{...a,modelParams:PT(a.modelParams??{})},FF(t));m=await _q(s,e,n,t,b,o)}let v=Tq(s,m),g=Date.now()-f;return Wy(p,{status:"success",durationMs:g,usage:v.usage}),P.logMessage(`[AI Chat ${p}] Success in ${g}ms`),{id:m.id??`${Date.now()}`,model:t.name,content:v.content,usage:v.usage,stopReason:v.rawStopReason,stopSequence:null,created:Date.now(),toolCalls:v.toolCalls,normalizedStopReason:v.normalizedStopReason,providerRaw:v.providerRaw}}catch(m){let v=m.message??String(m),g=Date.now()-f;Wy(p,{status:"error",durationMs:g,errorMessage:v});let y=new Error(`Error while making request to ${n.name}: ${v}`,{cause:m});throw We(y),y}}var jy,$F=k(()=>{jy=require("obsidian");Eq();ht();RT();DF();rr();fo();Sq();De();ky();Ry()});function Om(r){if(r){let e=new Aq.Notice(kq("starting",""),1e6);return{setMessage:(t,n)=>{e.setMessage(kq(t,n))},hide:()=>e.hide()}}return{setMessage:()=>{},hide:()=>{}}}var Aq,kq,OF=k(()=>{Aq=require("obsidian"),kq=(r,e)=>`${r==="dead"?"AI request failed.":`Assistant is ${r}.`}${e?` ${e}`:""}`});function NF(r){return{...r,modelOptions:{...r.modelOptions},usage:r.usage?{...r.usage}:void 0}}function MF(r){let e=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,t=Date.now();return os.push({...r,modelOptions:{...r.modelOptions??{}},id:e,createdAt:t,status:"pending"}),Pq(),e}function Wy(r,e){let t=os.find(n=>n.id===r);t&&(t.status=e.status,t.durationMs=e.durationMs,t.usage=e.usage,t.errorMessage=e.errorMessage,Pq())}function Fq(r=10){Number.isFinite(r)||(r=10);let e=Math.floor(r);return e<=0?[]:os.slice(-e).map(NF).reverse()}function Pq(){if(os.length<=Dq)return;let r=os.length-Dq;for(;r>0;){let e=os.findIndex(t=>t.status!=="pending");if(e===-1)break;os.splice(e,1),r-=1}}function $q(r){let e=os.find(t=>t.id===r);return e?NF(e):null}function Mq(){let r=os[os.length-1];return r?NF(r):null}function Oq(){os.splice(0,os.length)}async function GJ(r,e,t){if(typeof r!="function")throw new TypeError("Callback must be a function.");if(!(e instanceof Promise))throw new TypeError("Promise must be an instance of Promise.");if(typeof t!="number"||t<=0)throw new TypeError("Interval must be a positive number.");let n=!1;for(e.then(()=>{n=!0},()=>{n=!0});!n;)r(),await sleep(t)}function YJ(r){return r instanceof Error?r:new Error(String(r))}async function KJ(r,e,t,n=!0,i){let o;if(e.enable)o=t.find(c=>c.path.endsWith(e.name));else{let c=t.map(u=>u.basename);if(i)o=await i.suggester(c,t,"Select a prompt template");else if(n)o=await hr.Suggest(r,c,t);else throw new ve("This AI command asks which prompt template to use, but this run is non-interactive. Enable a specific prompt template in the command, or re-run with the ui flag.")}Jn(o,"Prompt template does not exist");let s=o.path,a=r.vault.getAbstractFileByPath(s);Jn(a instanceof Iq.TFile,`${s} is not a file`);let l=await r.vault.cachedRead(a);return[o.basename,l]}async function Rq(r,e,t){if(ne.getState().disableOnlineFeatures)throw new Error("Online features are disabled in settings. Enable them to use the AI Assistant.");let n=Om(e.showAssistantMessages);try{let{apiKey:i,model:o,provider:s,outputVariableName:a,promptTemplate:l,systemPrompt:c,promptTemplateFolder:u}=e,d=ho(r,u),[f,p]=await KJ(r,l,d,e.interactive??!0,e.promptProvider);n.setMessage("waiting","QuickAdd is formatting the prompt template.");let m=await t(p),v=["prompting",`Using prompt template "${f}".`];n.setMessage(v[0],v[1]);let y=OT(r,i,o,s,c,e.modelOptions)(m),T=(await BF(y,100,C=>{n.setMessage(v[0],`${v[1]} (${(C/1e3).toFixed(2)}s)`)},C=>{n.setMessage("finished",`Took ${(C/1e3).toFixed(2)}s.`)})).content,b=("> "+T).replace(/\n/g,` > `),E={[a]:T,[`${a}-quoted`]:b};return window.setTimeout(()=>n.hide(),5e3),E}catch(i){throw n.setMessage("dead",i.message),window.setTimeout(()=>n.hide(),5e3),pt(i)?new dt("Input cancelled by user"):i}}async function BF(r,e,t,n){let i=Date.now();return await GJ(()=>t(Date.now()-i),r,e),n(Date.now()-i),await r}async function Lq(r,e,t){if(ne.getState().disableOnlineFeatures)throw new Error("Online features are disabled in settings. Enable them to use the AI Assistant.");let n=Om(e.showAssistantMessages);try{let{apiKey:i,model:o,provider:s,outputVariableName:a,systemPrompt:l,prompt:c,modelOptions:u}=e;n.setMessage("waiting","QuickAdd is formatting the prompt template.");let d=await t(c),f=["prompting","Using custom prompt."];n.setMessage(f[0],f[1]);let m=OT(r,i,o,s,l,u)(d),g=(await BF(m,100,T=>{n.setMessage(f[0],`${f[1]} (${(T/1e3).toFixed(2)}s)`)},T=>{n.setMessage("finished",`Took ${(T/1e3).toFixed(2)}s.`)})).content,y=("> "+g).replace(/\n/g,` > `),w={[a]:g,[`${a}-quoted`]:y};return window.setTimeout(()=>n.hide(),5e3),w}catch(i){throw n.setMessage("dead",i.message),window.setTimeout(()=>n.hide(),5e3),i}}function XJ(){return Array.from(new Set([LF,...["kebab","snake","camel","pascal","title","lower","upper","slug"].map(r=>ov(LF,r))])).filter(Boolean)}function Bq(r){if(r.length<=1)return null;let e=Math.floor(r.length/2),t=[` `,` `,". "," "],n=-1,i=Number.POSITIVE_INFINITY;for(let a of t){let l=r.lastIndexOf(a,e),c=r.indexOf(a,e),u=[l,c].filter(d=>d>0);for(let d of u){let f=d+a.length;if(f<=0||f>=r.length)continue;let p=Math.abs(f-e);p0&&n=56320&&s<=57343&&(o+=1),o<=0||o>=r.length?null:[r.slice(0,o),r.slice(o)]}function ZJ(r){let e=new RegExp(Xu.source,"gi"),t;for(;(t=e.exec(r))!==null;)if(t[1].split("|")[0].trim().toLowerCase()==="chunk")return!0;return!1}function JJ(r){return Ho.test(r)||bc.test(r)||ba.test(r)||fl.test(r)}function eee(r){return Nq.some(e=>r.includes(e))}function tee(r){return Nq.slice().sort((e,t)=>t.length-e.length).reduce((e,t)=>e.split(t).join(" "),r)}function Vq(r){if(r>LT)throw new Error(`QuickAdd would split this chunked AI request into more than ${LT} prompts, which exceeds the safety limit. Increase the chunk size, use a larger chunk separator, or reduce the input text.`)}function ree(r,e,t){let n=Math.max(1,Math.floor(e)),i=[r],o=0;for(;i.length>0;){let s=i.pop(),l=Ji(s)<=n?null:Bq(s);if(!l){t.push(s),o+=1,Vq(o);continue}i.push(l[1],l[0])}}function nee(r){let e=r.flags.replace(/[gy]/g,"");return new RegExp(r.source+"|",e).exec("").length-1}function oee(r,e){if(typeof e=="string"){let s=r.split(e);return{chunks:s,separators:new Array(Math.max(0,s.length-1)).fill(e)}}if(nee(e)>0||iee.test(e.source))return{chunks:r.split(e),separators:null};let t=new RegExp(`(${e.source})`,e.flags),n=r.split(t),i=[],o=[];for(let s=0;s{let u=[];ree(l,t,u),u.forEach((d,f)=>{i.push({text:d,joiner:f===0&&c>0?e?.[c-1]??"":""})})}),!n)return i.map(l=>l.text);let o=[],s="",a=0;for(let l of i){let c=Ji(l.text)+Math.max(1,Ji(l.joiner));s!==""&&a+c>=t&&(o.push(s),s="",a=0),s+=s===""?l.text:l.joiner+l.text,a+=c}return s!==""&&o.push(s),o}function aee(r,e){let t=Math.max(1,Math.floor(r));if(e!==void 0&&Number.isFinite(e)&&e>0){let n=Math.floor(e);return{budget:Math.min(t,n),clamped:n>t}}return{budget:t,clamped:!1}}async function qq(r,e,t){if(ne.getState().disableOnlineFeatures)throw new Error("Online features are disabled in settings. Enable them to use the AI Assistant.");let n=Om(e.showAssistantMessages);try{let{apiKey:i,model:o,provider:s,outputVariableName:a,systemPrompt:l,promptTemplate:c,text:u,modelOptions:d}=e;n.setMessage("chunking","Creating prompt chunks with text and prompt template");let f=e.chunkSeparator||/\n/g,{chunks:p,separators:m}=oee(u,f),v=await t(c,{chunk:LF});if(!(ZJ(c)||JJ(c)&&eee(v)))throw new Error("The chunked prompt template does not reference the chunk text. Add {{VALUE:chunk}} to your prompt template so each chunk is inserted.");let y=o.maxTokens,w=AB(y),T=tee(v),b=Ji(l)+Ji(T);if(b>=y)throw new Error(`The estimated prompt overhead (${b} tokens) exceeds the model's entire context window (${y} tokens). Shorten the system prompt or prompt template, or use a model with a larger context window.`);let{budget:E,clamped:C}=aee(w-b,e.maxChunkTokens);C&&P.logMessage(`[ChunkedPrompt] Requested max chunk tokens (${e.maxChunkTokens}) exceeds this model's estimated input budget; using ${E} estimated tokens per chunk instead.`);let _=e.shouldMerge??!0,I=see(p,m,E,_);Vq(I.length);let q=OT(r,i,o,s,l,d),B=["prompting",`${I.length} prompts being sent.`];n.setMessage(B[0],B[1]);let J=new RF(5,1e3*30),re=!1,L=0,W=Promise.resolve(),j=ce=>{let he=W.then(()=>{if(re)throw new Error("Chunked prompt stopped after an earlier failure.");return t(c,{chunk:ce})});return W=he.then(()=>{},()=>{}),he},$=async(ce,he=0)=>{if(re)throw new Error("Chunked prompt stopped after an earlier failure.");let Ie;try{Ie=await j(ce)}catch(we){throw re=!0,we}try{return[(await J.add(()=>{if(re)throw new Error("Chunked prompt stopped after an earlier failure.");if(L+=1,L>LT)throw new Error(`Chunked AI request exceeded the safety limit of ${LT} provider requests.`);return q(Ie)})).content]}catch(we){let Ge=Bq(ce);if(he>=QJ||!Ge||!aV(we))throw re=!0,we;n.setMessage("prompting","Provider rejected a prompt for context length. Retrying with smaller chunks.");let[Pe,Ve]=Ge,qe=await $(Pe,he+1),et=await $(Ve,he+1);return[...qe,...et]}},G=Promise.all(I.map(ce=>$(ce))),Y=(await BF(G,100,ce=>{n.setMessage(B[0],`${B[1]} (${(ce/1e3).toFixed(2)}s)`)},ce=>{n.setMessage("finished",`Took ${(ce/1e3).toFixed(2)}s.`)})).flat().join(e.resultJoiner),ie=("> "+Y).replace(/\n/g,` > `),oe={[a]:Y,[`${a}-quoted`]:ie};return window.setTimeout(()=>n.hide(),5e3),oe}catch(i){throw n.setMessage("dead",i.message),window.setTimeout(()=>n.hide(),5e3),i}}var Iq,Dq,os,RF,QJ,LT,LF,Nq,iee,RT=k(()=>{Iq=require("obsidian");Er();Bi();Ul();ht();Dt();zy();rr();$F();Ry();OF();ky();De();Je();nE();Dq=25,os=[];RF=class{constructor(e,t){this.maxRequests=e;this.intervalMs=t;this.queue=[];this.startTimes=[]}add(e){return new Promise((t,n)=>{this.queue.push(async()=>{try{t(await e())}catch(i){n(YJ(i))}}),this.schedule()})}schedule(){if(this.queue.length===0)return;let e=Date.now();if(this.startTimes=this.startTimes.filter(i=>e-i=this.maxRequests){let i=this.startTimes[0],o=Math.max(0,this.intervalMs-(e-i));window.setTimeout(()=>this.schedule(),o+1);return}let t=this.queue.shift();if(!t)return;this.startTimes.push(e);let n=t();window.setTimeout(()=>this.schedule(),this.intervalMs),this.schedule()}},QJ=12,LT=500,LF="quickadd_chunk_probe_123456789";Nq=XJ();iee=/(?:^|[^\\])(?:\\\\)*\\[1-9]/});function Uq(r){return r.normalize("NFKD").toLowerCase()}var lee,Bd,VF=k(()=>{lee=0;Bd=class{constructor(e,t){this.options=t;this.instanceId=++lee;this.indexedItems=[];this.renderedRows=[];this.query="";this.rootEl=document.createElement("div"),this.rootEl.className="qa-searchable-multi-select";let n=document.createElement("div");n.className="search-input-container qa-searchable-multi-select__search-container",this.searchInputEl=document.createElement("input"),this.searchInputEl.className="qa-searchable-multi-select__search",this.searchInputEl.type="search",this.searchInputEl.name=`qa-multi-select-search-${this.instanceId}`,this.searchInputEl.placeholder=t.searchPlaceholder??"Search options...",this.searchInputEl.setAttribute("aria-label",this.searchInputEl.placeholder),this.searchInputEl.setAttribute("autocomplete","off"),this.searchInputEl.setAttribute("spellcheck","false"),n.appendChild(this.searchInputEl),this.summaryEl=document.createElement("div"),this.summaryEl.className="qa-searchable-multi-select__summary",this.summaryEl.setAttribute("aria-live","polite"),this.listEl=document.createElement("div"),this.listEl.className="qa-searchable-multi-select__list",this.listEl.setAttribute("role","group"),this.listEl.setAttribute("aria-label","Options"),this.rootEl.append(n,this.summaryEl,this.listEl),e.appendChild(this.rootEl),this.searchInputEl.addEventListener("input",()=>{this.query=this.searchInputEl.value,this.renderList()}),this.searchInputEl.addEventListener("keydown",i=>{if(i.key==="ArrowDown"){i.preventDefault(),this.renderedRows[0]?.input.focus();return}if(i.key==="ArrowUp"){i.preventDefault(),this.renderedRows.at(-1)?.input.focus();return}i.key==="Escape"&&this.query&&(i.preventDefault(),i.stopPropagation(),this.query="",this.searchInputEl.value="",this.renderList())}),this.setItems(t.items)}setItems(e){this.indexedItems=e.map((t,n)=>({item:t,index:n,searchableText:Uq(`${t.label} ${t.searchText??""}`)})),this.searchInputEl.disabled=e.length===0,this.renderList()}focusSearchOnOpen(){document.body.classList.contains("is-mobile")||this.searchInputEl.focus()}refreshSelection(){for(let{item:e,input:t}of this.renderedRows)t.checked=this.options.isSelected(e),t.closest("label")?.classList.toggle("is-selected",t.checked);this.updateSummary()}getMatchingItems(){let e=Uq(this.query.trim()).split(/\s+/).filter(Boolean);return e.length===0?this.indexedItems:this.indexedItems.filter(({searchableText:t})=>e.every(n=>t.includes(n)))}getVisibleItems(e){if(e.length<=200)return e;let t=[],n=[];for(let i of e)(this.options.isSelected(i.item)?t:n).push(i);return[...t,...n].slice(0,200)}renderList(){this.listEl.replaceChildren(),this.renderedRows=[];let e=this.getMatchingItems(),t=this.getVisibleItems(e);if(t.length===0){let n=document.createElement("div");n.className="qa-searchable-multi-select__empty",n.setAttribute("role","status"),n.textContent=this.indexedItems.length?`No options match \u201C${this.query.trim()}\u201D`:this.options.emptyText??"No options available",this.listEl.appendChild(n)}for(let n of t)this.renderRow(n);if(e.length>t.length){let n=document.createElement("div");n.className="qa-searchable-multi-select__limit",n.setAttribute("role","status"),n.textContent=`Showing ${t.length} of ${e.length} options. Refine your search to see the rest.`,this.listEl.appendChild(n)}this.updateSummary(e.length)}renderRow(e){let{item:t,index:n}=e,i=document.createElement("label");i.className="qa-searchable-multi-select__option";let o=document.createElement("input");o.type="checkbox",o.name=`qa-multi-select-${this.instanceId}`,o.id=`qa-multi-select-${this.instanceId}-${n}`,o.checked=this.options.isSelected(t);let s=document.createElement("span");s.className="qa-searchable-multi-select__option-label",s.textContent=t.label,i.htmlFor=o.id,i.classList.toggle("is-selected",o.checked),i.append(s,o),o.addEventListener("change",()=>{this.options.onToggle(t,o.checked),this.refreshSelection()}),o.addEventListener("keydown",a=>{this.handleOptionKeydown(a,o)}),this.listEl.appendChild(i),this.renderedRows.push({item:t,input:o})}handleOptionKeydown(e,t){let n=this.renderedRows.findIndex(i=>i.input===t);if(e.key==="ArrowDown"){e.preventDefault(),this.renderedRows[n+1]?.input.focus();return}if(e.key==="ArrowUp"){e.preventDefault(),n===0?this.searchInputEl.focus():this.renderedRows[n-1]?.input.focus();return}if(e.key==="Home"){e.preventDefault(),this.renderedRows[0]?.input.focus();return}if(e.key==="End"){e.preventDefault(),this.renderedRows.at(-1)?.input.focus();return}if(e.key==="Enter"||e.key===" "){e.preventDefault(),t.checked=!t.checked,t.dispatchEvent(new Event("change",{bubbles:!0}));return}e.key==="/"&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&(e.preventDefault(),this.searchInputEl.focus())}updateSummary(e=this.getMatchingItems().length){let n=`${this.options.getSelectedCount?.()??new Set(this.indexedItems.filter(({item:i})=>this.options.isSelected(i)).map(({item:i})=>i.key)).size} selected`;if(!this.query.trim()){this.summaryEl.textContent=`${n} \xB7 ${this.indexedItems.length} options`;return}this.summaryEl.textContent=`${n} \xB7 ${e} matches`}}});var du,Vd,zq=k(()=>{du=require("obsidian");Qi();Er();VF();Vd=class r extends du.Modal{constructor(t,n,i,o={}){super(t);this.didSubmit=!1;this.skipped=!1;this.selected=new Set;this.customValues=[];this.draft="";this.items=i,this.displayItems=n.length===i.length?n:i,this.opts=o,this.seedPreselection(o.preselected),this.waitForClose=new Promise((s,a)=>{this.resolvePromise=s,this.rejectPromise=a}),this.render(),this.open(),this.picker.focusSearchOnOpen()}static Suggest(t,n,i,o={}){return new r(t,n,i,o).waitForClose}seedPreselection(t){if(t?.length)for(let n of t){let i=n?.trim();i&&(!this.items.includes(i)&&!this.customValues.includes(i)&&this.customValues.push(i),this.selected.add(i))}}render(){this.containerEl.addClass("quickAddModal","qaSearchableMultiSelectModal","qaMultiSuggester"),this.titleEl.setText(this.opts.placeholder??"Select one or more");let{contentEl:t}=this;t.empty();let n=t.createDiv({cls:"qa-multi-list"});this.picker=new Bd(n,{items:this.getSearchableItems(),isSelected:({value:o})=>this.selected.has(o),onToggle:({value:o},s)=>{s?this.selected.add(o):this.selected.delete(o)},getSelectedCount:()=>this.selected.size}),this.opts.allowCustomValue&&new du.Setting(t).setName("Add a custom value").addText(s=>{s.setPlaceholder("Not in the list\u2026").setValue(this.draft).onChange(a=>this.draft=a),s.inputEl.addClass("qa-multi-custom-input"),s.inputEl.addEventListener("keydown",a=>{a.key==="Enter"&&(a.preventDefault(),this.commitDraft())})}).addButton(s=>s.setButtonText("Add").onClick(()=>this.commitDraft())).settingEl.addClass("qa-multi-custom");let i=new du.Setting(t);i.settingEl.addClass("qa-multi-actions"),i.addButton(o=>o.setButtonText("Done").setCta().onClick(()=>this.submit())),i.addButton(o=>o.setButtonText("Cancel").onClick(()=>this.close())),this.opts.skippable&&i.addButton(o=>o.setButtonText("Skip").setTooltip("Leave empty").onClick(()=>{this.skipped=!0,this.didSubmit=!0,this.close()}))}getSearchableItems(){return[...this.items.map((t,n)=>({key:t,value:t,label:zr(this.displayItems[n]??t),searchText:t})),...this.customValues.map(t=>({key:t,value:t,label:t}))]}commitDraft(){let t=this.draft.trim();return t?(this.items.includes(t)||this.customValues.includes(t))&&this.selected.has(t)?(new du.Notice(`"${t}" is already added.`),!1):(!this.items.includes(t)&&!this.customValues.includes(t)&&this.customValues.push(t),this.selected.add(t),this.draft="",this.render(),this.focusCustomInput(),!0):(new du.Notice("Enter a value to add."),!1)}focusCustomInput(){this.contentEl.querySelector(".qa-multi-custom-input")?.focus()}submit(){if(this.opts.allowCustomValue&&this.draft.trim()){let t=this.draft.trim();!this.items.includes(t)&&!this.customValues.includes(t)&&this.customValues.push(t),this.selected.add(t),this.draft=""}this.didSubmit=!0,this.close()}collectResult(){let t=[];for(let n of this.items)this.selected.has(n)&&t.push(n);for(let n of this.customValues)this.selected.has(n)&&t.push(n);return t}onClose(){super.onClose(),this.didSubmit?this.resolvePromise(this.skipped?[]:this.collectResult()):this.rejectPromise(Ir())}}});var pu,cee,uee,dee,Wq,qF,Gy,UF,Hq,NT,zF=k(()=>{pu=r=>r.toString().padStart(2,"0"),cee=r=>{if(typeof r=="number"&&r>=0&&r<=6)return r;let t=window.moment?.localeData?.()?.firstDayOfWeek?.();return typeof t=="number"&&t>=0&&t<=6?t:0},uee=r=>{let e=new Intl.DateTimeFormat(void 0,{weekday:"short"}),t=new Date(2021,7,1),n=Array.from({length:7},(i,o)=>{let s=new Date(t.getFullYear(),t.getMonth(),t.getDate()+o);return e.format(s)});return n.slice(r).concat(n.slice(0,r))},dee=(r,e)=>new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"}).format(new Date(r,e,1)),Wq=(r,e,t)=>`${r}-${pu(e+1)}-${pu(t)}`,qF=r=>Wq(r.getFullYear(),r.getMonth(),r.getDate()),Gy=r=>{if(!r)return null;let e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(r);if(e){let[,n,i,o]=e;return new Date(Number.parseInt(n,10),Number.parseInt(i,10)-1,Number.parseInt(o,10))}let t=new Date(r);return Number.isNaN(t.getTime())?null:t},UF=(r,e,t,n)=>{let i=Wq(r,e,t);return n?`${i}T${pu(n.hour)}:${pu(n.minute)}:00`:i},Hq=r=>{if(!r)return null;let e=/[T ](\d{2}):(\d{2})/.exec(r);if(!e)return null;let t=Number.parseInt(e[1],10),n=Number.parseInt(e[2],10);return Number.isNaN(t)||Number.isNaN(n)||t<0||t>23||n<0||n>59?null:{hour:t,minute:n}},NT=r=>{let e=cee(r.weekStartsOn),t=uee(e),n=Gy(r.initialIso)??new Date,i=n.getFullYear(),o=n.getMonth(),s=r.initialIso,a=r.withTime===!0,l=a?Hq(r.initialIso)??{hour:0,minute:0}:null,c=r.container.createDiv({cls:"qa-date-picker"}),u=c.createDiv({cls:"qa-date-picker__header"}),d=u.createEl("button",{cls:"qa-date-picker__nav",text:"\u2039"});d.type="button",d.setAttr("aria-label","Previous month");let f=u.createDiv({cls:"qa-date-picker__label"}),p=u.createEl("button",{cls:"qa-date-picker__nav",text:"\u203A"});p.type="button",p.setAttr("aria-label","Next month");let m=c.createDiv({cls:"qa-date-picker__weekdays"});t.forEach(I=>{let q=m.createDiv({cls:"qa-date-picker__weekday"});q.textContent=I});let v=c.createDiv({cls:"qa-date-picker__grid"}),g=c.createDiv({cls:"qa-date-picker__actions"}),y=g.createEl("button",{cls:"qa-date-picker__action",text:"Today"});y.type="button";let w=g.createEl("button",{cls:"qa-date-picker__action",text:"Clear"});w.type="button";let T;if(a){let I=c.createDiv({cls:"qa-date-picker__time"});I.createEl("label",{cls:"qa-date-picker__time-label",text:"Time"}),T=I.createEl("input",{cls:"qa-date-picker__time-input"}),T.type="time",l&&(T.value=`${pu(l.hour)}:${pu(l.minute)}`)}let b=I=>{o+=I,o>11?(o=0,i+=1):o<0&&(o=11,i-=1),_()},E=(I,q)=>{s=I,r.onSelect(I,q),_()},C=I=>{s=void 0,r.onSelect(null,I),_()};d.addEventListener("click",()=>b(-1)),p.addEventListener("click",()=>b(1)),y.addEventListener("click",()=>{let I=new Date,q=UF(I.getFullYear(),I.getMonth(),I.getDate(),l);i=I.getFullYear(),o=I.getMonth(),E(q,"action")}),w.addEventListener("click",()=>C("action")),T&&T.addEventListener("change",()=>{if(T.value.trim()==="")l={hour:0,minute:0};else{let[I,q]=T.value.split(":").map(B=>Number.parseInt(B,10));if(Number.isNaN(I)||Number.isNaN(q))return;l={hour:I,minute:q}}if(s){let I=Gy(s);I&&E(UF(I.getFullYear(),I.getMonth(),I.getDate(),l),"picker")}});let _=()=>{f.textContent=dee(i,o),v.empty();let q=(new Date(i,o,1).getDay()-e+7)%7,B=new Date(i,o,1-q),J=qF(new Date),re=s?Gy(s):null,L=re?qF(re):void 0,W=new Intl.DateTimeFormat(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"});for(let j=0;j<42;j+=1){let $=new Date(B);$.setDate(B.getDate()+j);let G=qF($),U=$.getMonth()!==o,H=G===J,Y=L&&G===L,ie=v.createEl("button",{cls:"qa-date-picker__day",text:String($.getDate())});ie.type="button",ie.setAttr("aria-label",W.format($)),U&&ie.addClass("is-outside"),H&&ie.addClass("is-today"),Y&&(ie.addClass("is-selected"),ie.setAttr("aria-pressed","true")),ie.addEventListener("click",()=>{let oe=UF($.getFullYear(),$.getMonth(),$.getDate(),l);E(oe,"picker")})}};return _(),{setSelectedIso:(I,{updateView:q}={})=>{if(s=I,I&&q!==!1){let B=Gy(I);B&&(i=B.getFullYear(),o=B.getMonth())}if(a&&I){let B=Hq(I);B&&(l=B,T&&(T.value=`${pu(B.hour)}:${pu(B.minute)}`))}_()},setViewFromIso:I=>{let q=Gy(I);q&&(i=q.getFullYear(),o=q.getMonth(),_())},destroy:()=>{c.remove()}}}});function zl(r,e,t=ns,n){if(!r||!r.trim())return{isValid:!1,error:"Empty input"};try{let i=n??ne.getState().dateAliases,o=lg(r,i),s=t.parseDate(o);if(s?.moment?.isValid()){let a=s.moment.toISOString(),l=e?s.moment.format(e):s.moment.format("YYYY-MM-DD");return{isValid:!0,isoString:a,formatted:l}}else return{isValid:!1,error:"Unable to parse date"}}catch(i){return{isValid:!1,error:`Parse error: ${i instanceof Error?i.message:"Unknown error"}`}}}function qa(r,e){if(!window.moment)return null;try{let t=window.moment(r);if(t.isValid())return t.format(e)}catch{}return null}var Rm=k(()=>{Dd();ht();Ku()});var Nm,Lm,Hl,BT=k(()=>{Nm=require("obsidian");Ns();zF();Rm();ht();Ku();Lm=class Lm extends sr{constructor(t,n,i,o,s,a,l){super(t,n,i,o??"",void 0,void 0,a);this.isOpen=!0;this.containerEl.addClass("qaDatePrompt"),this.withTime=l===!0,this.dateFormat=s||(this.withTime?"YYYY-MM-DD HH:mm":"YYYY-MM-DD"),this.defaultValue=o,this.currentInput=this.inputComponent?.inputEl?.value??o??"",this.mountDatePicker(),this.updatePreviewDebounced=(0,Nm.debounce)(this.updatePreview.bind(this),250,!0),this.updatePreview()}supportsPeek(){return!1}static Prompt(t,n,i,o,s,a,l){return new Lm(t,n,i,o,s,a,l).waitForClose}createInputField(t,n,i){t.addClass("qa-date-input");let o=new Nm.TextComponent(t);return o.inputEl.addClass("qa-vdate-input"),o.setPlaceholder(n??"").setValue(i??"").onChange(s=>{this.lastPickerDisplayValue=void 0,this.onInputChanged(s),this.currentInput=s,this.updatePreviewDebounced()}).inputEl.addEventListener("keydown",this.submitEnterCallback),this.currentInput=i??"",this.pickerHostEl=t.createDiv({cls:"qa-date-picker-container"}),this.createPreviewElement(t),o}mountDatePicker(){this.datePicker=NT({container:this.pickerHostEl,initialIso:this.selectedIso,withTime:this.withTime,onSelect:t=>{t?this.applyPickerSelection(t):this.clearPickerSelection()}})}createPreviewElement(t){let n=t.createDiv("vdate-preview-container");n.createEl("div",{text:"Preview:",cls:"vdate-preview-label"}),this.previewEl=n.createEl("div",{cls:"vdate-preview-text"}),this.previewEl.textContent=Lm.PREVIEW_PLACEHOLDER;let i=cg(ne.getState().dateAliases);if(i.length>0){let o=n.createEl("details",{cls:"vdate-alias-details"});o.createEl("summary",{text:`Aliases (${i.length})`}).addClass("vdate-alias-summary");let a=o.createEl("div",{cls:"vdate-alias-list"});a.textContent=Pw(ne.getState().dateAliases)}}updatePreview(){if(!this.isOpen)return;let t=this.currentInput.trim();if(!t&&this.defaultValue&&!this.isOptionalPrompt){this.renderPreviewFromInput(this.defaultValue);return}if(!t){this.selectedIso=void 0,this.lastPickerDisplayValue=void 0,this.syncPickerSelection(),this.setPreviewText(this.isOptionalPrompt?"Will be left empty":Lm.PREVIEW_PLACEHOLDER,!1);return}if(t.startsWith("@date:")){let n=t.slice(6).trim();if(n){this.selectedIso=n,this.lastPickerDisplayValue=void 0,this.syncPickerSelection(n),this.renderPreviewFromIso(n);return}}if(this.selectedIso&&this.lastPickerDisplayValue&&t===this.lastPickerDisplayValue){this.syncPickerSelection(this.selectedIso,!1),this.renderPreviewFromIso(this.selectedIso);return}this.renderPreviewFromInput(t)}formatIsoForInput(t){let n=qa(t,this.dateFormat);return n||(t.length>=10?t.slice(0,10):t)}syncPickerSelection(t,n=!0){this.datePicker?.setSelectedIso(t,{updateView:n})}applyPickerSelection(t){let n=this.formatIsoForInput(t);this.selectedIso=t,this.lastPickerDisplayValue=n,this.inputComponent?.inputEl&&(this.inputComponent.inputEl.value=n),this.onInputChanged(n),this.currentInput=n,this.syncPickerSelection(t),this.renderPreviewFromIso(t)}clearPickerSelection(){this.inputComponent?.inputEl&&(this.inputComponent.inputEl.value=""),this.onInputChanged(""),this.currentInput="",this.selectedIso=void 0,this.lastPickerDisplayValue=void 0,this.syncPickerSelection(),this.updatePreview()}renderPreviewFromIso(t){this.setPreviewText(this.formatIsoForInput(t),!1)}renderPreviewFromInput(t){let n=zl(t,this.dateFormat);if(n.isValid&&n.isoString){this.selectedIso=n.isoString,this.lastPickerDisplayValue=void 0,this.syncPickerSelection(n.isoString);let i=n.formatted??this.formatIsoForInput(n.isoString);this.setPreviewText(i,!1)}else{this.selectedIso=void 0,this.lastPickerDisplayValue=void 0,this.syncPickerSelection();let i=n.error||"Unable to parse date";this.setPreviewText(i,!0)}}setPreviewText(t,n){this.previewEl.textContent=t,this.previewEl.toggleClass("is-error",n)}onOpen(){super.onOpen()}transformInputOnSubmit(t){let n=t.trim();if(n.startsWith("@date:"))return n;if(this.selectedIso&&this.lastPickerDisplayValue&&n===this.lastPickerDisplayValue)return`@date:${this.selectedIso}`;if(!n&&this.defaultValue&&!this.isOptionalPrompt){let i=zl(this.defaultValue,this.dateFormat);if(i.isValid&&i.isoString)return`@date:${i.isoString}`}if(n){let i=zl(n,this.dateFormat);if(i.isValid&&i.isoString)return`@date:${i.isoString}`;new Nm.Notice(`QuickAdd: "${n}" could not be parsed as a date; using it as-is.`)}return t}onClose(){this.isOpen=!1,this.updatePreviewDebounced.cancel(),!this.input.trim()&&this.defaultValue&&!this.isOptionalPrompt&&(this.input=this.defaultValue),super.onClose()}};Lm.PREVIEW_PLACEHOLDER="Preview will appear here";Hl=Lm});function pee(r,e,t,n={}){let i=n.tab??" ";if(e===t){let d=e+i.length;return{regionStart:e,regionEnd:e,replacement:i,selectionStart:d,selectionEnd:d}}let o=e===0?0:r.lastIndexOf(` `,e-1)+1,a=r.slice(o,t).split(` `),l=a.length-1,c=0,u=a.map((d,f)=>f===l&&d===""?d:(c+=i.length,i+d));return{regionStart:o,regionEnd:t,replacement:u.join(` `),selectionStart:e+i.length,selectionEnd:t+c}}function fee(r,e){r.setSelectionRange(e.regionStart,e.regionEnd);let t=r.ownerDocument,n=!1;try{n=typeof t.execCommand=="function"&&t.execCommand("insertText",!1,e.replacement)}catch{n=!1}if(!n){let i=r.value;r.value=i.slice(0,e.regionStart)+e.replacement+i.slice(e.regionEnd),r.setSelectionRange(e.selectionStart,e.selectionEnd),r.dispatchEvent(new Event("input",{bubbles:!0}));return}r.setSelectionRange(e.selectionStart,e.selectionEnd)}function jq(r,e={}){let t=i=>{if(i.key!=="Tab"||i.shiftKey||i.ctrlKey||i.metaKey||i.altKey||i.isComposing||i.defaultPrevented)return;i.preventDefault();let o=r.selectionStart??r.value.length,s=r.selectionEnd??o;fee(r,pee(r.value,o,s,e))};r.addEventListener("keydown",t);let n=!1;return()=>{n||(n=!0,r.removeEventListener("keydown",t))}}var Gq=k(()=>{});var Bm,fu,HF=k(()=>{Bm=require("obsidian");AC();IC();RA();LA();NA();Gq();Kg();Er();GC();df();YC();fu=class r extends Bm.Modal{constructor(t,n,i,o,s,a,l){super(t);this.header=n;this.linkSourcePath=s;this.options=l;this.didSubmit=!1;this.didClose=!1;this.submitClickCallback=t=>this.submit();this.cancelClickCallback=t=>this.cancel();this.skipClickCallback=t=>this.skip();this.submitEnterCallback=t=>{if(this.supportsPeek()&&jC(t)){t.preventDefault(),this.peek.peek();return}if(this.isOptionalPrompt&&WC(t)){t.preventDefault(),this.skip();return}(t.ctrlKey||t.metaKey)&&t.key==="Enter"&&(t.preventDefault(),this.submit())};this.placeholder=i??"",this.description=a?.trim()||void 0,this.draftHandler=new af({kind:"multi",header:this.header,placeholder:this.placeholder,linkSourcePath:this.linkSourcePath,scopeId:l?.draftScopeId}),this.input=this.draftHandler.hydrate(o??""),this.waitForClose=new Promise((c,u)=>{this.resolvePromise=c,this.rejectPromise=u}),this.peek=new Vc({app:t,title:this.header,containerEl:this.containerEl,scope:this.scope,getField:()=>this.inputComponent?.inputEl,getValue:()=>this.input,setValue:c=>{this.input=c},markDraftChanged:()=>this.draftHandler.markChanged(),persistDraft:()=>this.persistDraft(),close:()=>this.close()}),this.display(),this.open(),this.attachSuggesters()}static Prompt(t,n,i,o,s,a){return new r(t,n,i,o,void 0,s,a).waitForClose}static PromptWithContext(t,n,i,o,s,a,l){return new r(t,n,i,o,s,a,l).waitForClose}display(){this.containerEl.addClass("quickAddModal","qaWideInputPrompt"),pf(this.containerEl),this.contentEl.empty(),this.titleEl.textContent=this.header,PC(this.contentEl,this.options?.contextLine,this.options?.contextLineFull),this.description&&this.contentEl.createDiv({text:this.description,cls:"setting-item-description"}).setCssStyles({marginBottom:"0.75rem"}),this.isOptionalPrompt&&this.contentEl.createDiv({text:"Optional \u2014 leave empty, press Skip, or ctrl/cmd+shift+\u21B5.",cls:"setting-item-description"}).setCssStyles({marginBottom:"0.75rem"});let t=this.contentEl.createDiv();this.inputComponent=this.createInputField(t,this.placeholder,this.input),this.createButtonBar(t)}createInputField(t,n,i){let o=new Bm.TextAreaComponent(t);return o.inputEl.classList.add("wideInputPromptInputEl"),o.inputEl.setAttribute("dir","auto"),o.setPlaceholder(n??"").setValue(i??"").onChange(s=>this.onInputChanged(s)).inputEl.addEventListener("keydown",this.submitEnterCallback),this.disposeIndent=jq(o.inputEl),this.options?.imagePaste&&(this.imagePasteHandle=uf(this.app,o.inputEl,this.options.imagePaste)),o}createButton(t,n,i){let o=new Bm.ButtonComponent(t);return o.setButtonText(n).onClick(i),o}get isOptionalPrompt(){return this.options?.optional===!0}supportsPeek(){return this.options?.allowPeek===!0}createButtonBar(t){let n=t.createDiv({cls:"qa-prompt-actions"}),i=n.createDiv({cls:"qa-prompt-actions-primary"});if(this.createButton(i,"Ok",this.submitClickCallback).setCta().buttonEl.setCssStyles({marginRight:"0"}),this.createButton(i,"Cancel",this.cancelClickCallback),this.isOptionalPrompt){let o=this.createButton(i,"Skip",this.skipClickCallback);o.setTooltip("Leave this field empty"),o.buttonEl.setAttribute("aria-label","Skip and leave empty")}if(this.supportsPeek()){let o=n.createDiv({cls:"qa-prompt-actions-secondary"});ff(this.createButton(o,"Peek at note",()=>this.peek.peek()))}}submit(){if(!(this.didSubmit||this.didClose)){if(this.imagePasteHandle?.isBusy()){this.imagePasteHandle.whenIdle().then(()=>this.submit());return}this.input=this.inputComponent?.inputEl?.value??this.input,this.didSubmit=!0,this.close()}}skip(){this.didSubmit||(this.input="",this.didSubmit=!0,this.close())}cancel(){this.close()}resolveInput(){this.didSubmit?this.resolvePromise(this.input):this.rejectPromise(Ir())}onInputChanged(t){this.draftHandler.markChanged(),this.input=t}syncInputFromEl(){this.inputComponent?.inputEl&&(this.input=this.inputComponent.inputEl.value)}persistDraft(){this.draftHandler.persist(this.input,this.didSubmit)}attachSuggesters(){this.fileSuggester=new Oc(this.app,this.inputComponent.inputEl,{sourcePath:this.linkSourcePath}),this.tagSuggester=new Rc(this.app,this.inputComponent.inputEl)}removeInputListener(){this.inputComponent.inputEl.removeEventListener("keydown",this.submitEnterCallback),this.disposeIndent?.(),this.imagePasteHandle?.detach()}onOpen(){super.onOpen(),this.peek.onHostOpened(),FC(this.inputComponent.inputEl,this.options)}onClose(){this.didClose=!0,this.didSubmit||this.syncInputFromEl(),this.persistDraft(),this.peek.onHostClosed(),this.resolveInput(),this.removeInputListener(),this.fileSuggester?.destroy(),this.tagSuggester?.destroy(),super.onClose()}}});var Yy,Yq=k(()=>{Ns();es();Yy=class r extends sr{supportsPeek(){return!1}static Prompt(e,t,n,i,o,s){return new r(e,t,n,i,void 0,o,s).waitForClose}static PromptWithContext(e,t,n,i,o,s,a){return new r(e,t,n,i,o,s,a).waitForClose}createInputField(e,t,n){let i=super.createInputField(e,t,n);i.inputEl.type="number",i.inputEl.inputMode="decimal";let o=this.options?.numeric;return o?.min!==void 0&&(i.inputEl.min=String(o.min)),o?.max!==void 0&&(i.inputEl.max=String(o.max)),i.inputEl.setAttr("step",o?.step!==void 0?String(o.step):"any"),i}transformInputOnSubmit(e){return this.options?.numeric?e===""&&this.isOptionalPrompt?"":Vs(e,this.options.numeric):e}}});var WF,Ky,Kq=k(()=>{Ns();es();WF={min:0,max:100,step:1},Ky=class r extends sr{supportsPeek(){return!1}static Prompt(e,t,n,i,o,s){return new r(e,t,n,i,void 0,o,s).waitForClose}static PromptWithContext(e,t,n,i,o,s,a){return new r(e,t,n,i,o,s,a).waitForClose}createInputField(e,t,n){let i=this.options?.slider??WF,o=this.isOptionalPrompt&&!n,s=lv(n,i);this.sliderEl=e.createEl("input"),this.sliderEl.type="range",this.sliderEl.min=String(i.min),this.sliderEl.max=String(i.max),this.sliderEl.step=String(i.step),this.sliderEl.value=s,this.sliderEl.setCssStyles({width:"100%"});let a=super.createInputField(e,void 0,s);return this.numberEl=a.inputEl,this.numberEl.type="number",this.numberEl.inputMode="decimal",this.numberEl.min=String(i.min),this.numberEl.max=String(i.max),this.numberEl.step=String(i.step),o&&(this.numberEl.value=""),this.sliderEl.addEventListener("input",()=>this.syncFromSlider()),this.numberEl.addEventListener("input",()=>this.syncFromNumber()),a}syncFromSlider(){!this.sliderEl||!this.numberEl||(this.numberEl.value=this.sliderEl.value,this.onInputChanged(this.sliderEl.value))}syncFromNumber(){if(!this.sliderEl||!this.numberEl)return;let e=this.numberEl.value;if(e===""&&this.isOptionalPrompt){this.onInputChanged("");return}let t=Vs(e,this.options?.slider??WF);t!==""&&(this.sliderEl.value=t),this.onInputChanged(e)}transformInputOnSubmit(e){return e===""&&this.isOptionalPrompt?"":lv(e,this.options?.slider??WF)}}});var Vm,Qq=k(()=>{HF();Ns();Yq();Kq();xa();Vm=class{factory(e){return e==="multiline"?fu:e==="number"?Yy:e==="slider"?Ky:kn().settings.inputPrompt==="multi-line"?fu:sr}}});function gee(r){return`\\begin{${r}} \u261A \\end{${r}}\u261A`}var mee,hee,Xq,jF=k(()=>{mee=["\\!","\\,","\\:","\\>","\\;","\\#","\\$","\\%","\\&","\\","_","{ }","|","^{\u261A}\u261A","[\u261A]\u261A","\\above","\\abovewithdelims","\\acute","\\aleph","\\alpha","\\amalg","\\And","\\angle","\\approx","\\approxeq","\\arccos","\\arcsin","\\arctan","\\arg","\\array","\\arrowvert","\\Arrowvert","\\ast","\\asymp","\\atop","\\atopwithdelims","\\backepsilon","\\backprime","\\backsim","\\backsimeq","\\backslash","\\bar","\\barwedge","\\Bbb","\\Bbbk","\\because","\\begin","\\beta","\\beth","\\between","\\bf","\\Bigg","\\bigg","\\Big","\\big","\\Biggl","\\Biggm","\\Biggr","\\biggl","\\biggm","\\biggr","\\Bigl","\\Bigm","\\Bigl","\\bigl","\\bigm","\\bigr","\\bigcap","\\bigcirc","\\bigcup","\\bigodot","\\bigoplus","\\bigotimes","\\bigsqcup","\\bigstar","\\bigtriangledown","\\bigtriangleup","\\biguplus","\\bigvee","\\bigwedge","\\binom","\\blacklozenge","\\blacksquare","\\blacktriangle","\\blacktriangledown","\\blacktriangleleft","\\blacktriangleright","\\bmod","\\boldsymbol","\\bot","\\bowtie","\\Box","\\boxdot","\\boxed","\\boxminus","\\boxplus","\\boxtimes","\\brace","\\bracevert","\\brack","\\breve","\\bullet","\\Bumpeq","\\bumpeq","\\cal","\\cancel","\\Cap","\\cap","\\cases","\\cdot","\\cdotp","\\cdots","\\centerdot","\\cfrac{\u261A}{\u261A}\u261A","\\check","\\checkmark","\\chi","\\choose","\\circ","\\circeq","\\circlearrowleft","\\circlearrowright","\\circledast","\\circledcirc","\\circleddash","\\circledR","\\circledS","\\class","\\clubsuit","\\colon","\\color","\\complement","\\cong","\\coprod","\\cos","\\cosh","\\cot","\\coth","\\cr","\\csc","\\cssId","\\Cup","\\cup","\\curlyeqprec","\\curlyeqsucc","\\curlyvee","\\curlywedge","\\curvearrowleft","\\curvearrowright","\\dagger","\\ddagger","\\daleth","\\dashleftarrow","\\dashrightarrow","\\dashv","\\dbinom","\\dot","\\ddot","\\dddot","\\ddddot","\\ddots","\\DeclareMathOperator","\\def","\\deg","\\Delta","\\delta","\\det","\\dfrac{\u261A}{\u261A}\u261A","\\diagdown","\\diagup","\\Diamond","\\diamond","\\diamondsuit","\\digamma","\\dim","\\displaylines","\\displaystyle","\\div","\\divideontimes","\\Doteq","\\doteq","\\dotplus","\\dots","\\dotsb","\\dotsc","\\dotsi","\\dotsm","\\dotso","\\doublebarwedge","\\doublecap","\\doublecup","\\downarrow","\\Downarrow","\\downdownarrows","\\downharpoonleft","\\downharpoonright","\\ell","\\emptyset","\\end","\\enspace","\\epsilon","\\eqalign","\\eqalignno","\\eqcirc","\\eqsim","\\eqslantgtr","\\eqslantless","\\equiv","\\eta","\\eth","\\exists","\\exp","\\fallingdotseq","\\fbox","\\Finv","\\flat","\\forall","\\frac{\u261A}{\u261A}\u261A","\\frak","\\frown","\\Game","\\Gamma","\\gamma","\\gcd","\\ge","\\geq","\\geqq","\\geqslant","\\genfrac","\\gets","\\gg","\\ggg","\\gggtr","\\gimel","\\gtrapprox","\\gnapprox","\\gneq","\\gneqq","\\gvertneqq","\\gtrsim","\\gnsim","\\grave","\\gt","\\gtrdot","\\gtreqless","\\gtreqqless","\\gtrless","\\hat","\\hbar","\\hbox","\\hdashline","\\hline","\\heartsuit","\\hfil","\\hfill","\\hom","\\hookleftarrow","\\hookrightarrow","\\hphantom","\\href","\\hskip","\\hslash","\\hspace","\\Huge","\\huge","\\iddots","\\idotsint","\\iff","\\iiiint","\\iiint","\\iint","\\int","\\intop","\\Im","\\imath","\\impliedby","\\implies","\\in","\\inf","\\infty","\\injlim","\\intercal","\\iota","\\it","\\jmath","\\Join","\\kappa","\\ker","\\kern","\\Lambda","\\lambda","\\land","\\langle","\\LARGE","\\Large","\\large","\\LaTeX","\\lbrace","\\lbrack","\\lceil","\\ldotp","\\ldots","\\le","\\leq","\\leqq","\\leqslant","\\leadsto","\\left","\\leftarrow","\\Leftarrow","\\leftarrowtail","\\leftharpoondown","\\leftharpoonup","\\leftleftarrows","\\leftrightarrow","\\Leftrightarrow","\\leftrightarrows","\\leftrightharpoons","\\leftrightsquigarrow","\\leftroot","\\leftthreetimes","\\leqalignno","\\lessapprox","\\lessdot","\\lesseqgtr","\\lesseqqgtr","\\lessgtr","\\lesssim","\\lfloor","\\lg","\\lgroup","\\lhd","\\lim","\\liminf","\\limits","\\limsup","\\ll","\\llap","\\llcorner","\\lrcorner","\\Lleftarrow","\\lll","\\llless","\\lmoustache","\\ln","\\lnapprox","\\lneq","\\lneqq","\\lnot","\\lnsim","\\log","\\longleftarrow","\\Longleftarrow","\\longrightarrow","\\Longrightarrow","\\longleftrightarrow","\\Longleftrightarrow","\\longmapsto","\\looparrowleft","\\looparrowright","\\lor","\\lower","\\lozenge","\\Lsh","\\lt","\\ltimes","\\lvert","\\lVert","\\lvertneqq","\\maltese","\\mapsto","\\mathbb","\\mathbf","\\mathbin","\\mathcal","\\mathchoice","\\mathclose","\\mathfrak","\\mathinner","\\mathit","\\mathop","\\mathopen","\\mathord","\\mathpunct","\\mathrel","\\mathring","\\mathrm","\\mathscr","\\mathsf","\\mathstrut","\\mathtt","\\matrix","\\max","\\mbox","\\measuredangle","\\mho","\\mid","\\min","\\mit","\\mod","\\models","\\moveleft","\\moveright","\\mp","\\mskip","\\mspace","\\mu","\\multimap","\\nabla","\\natural","\\ncong","\\ne","\\nearrow","\\neg","\\negthinspace","\\negmedspace","\\negthickspace","\\neq","\\newcommand","\\newenvironment","\\newline","\\nexists","\\ngeq","\\ngeqq","\\ngeqslant","\\ngtr","\\ni","\\nleftarrow","\\nLeftarrow","\\nleftrightarrow","\\nLeftrightarrow","\\nleq","\\nleqq","\\nleqslant","\\nless","\\nmid","\\nobreakspace","\\nolimits","\\normalsize","\\not","\\notag","\\notin","\\nparallel","\\nprec","\\npreceq","\\nrightarrow","\\nRightarrow","\\nshortmid","\\nshortparallel","\\nsim","\\nsubseteq","\\nsubseteqq","\\nsucc","\\nsucceq","\\nsupseteq","\\nsupseteqq","\\ntriangleleft","\\ntrianglelefteq","\\ntriangleright","\\ntrianglerighteq","\\nu","\\nVDash","\\nVdash","\\nvDash","\\nvdash","\\nwarrow","\\odot","\\ominus","\\oplus","\\oslash","\\otimes","\\oint","\\oldstyle","\\omega","\\Omega","\\omicron","\\operatorname","\\over","\\overbrace","\\overleftarrow","\\overrightarrow","\\overleftrightarrow","\\overline","\\overparen","\\overset","\\overwithdelims","\\owns","\\parallel","\\partial","\\perp","\\phantom","\\phi","\\Phi","\\pi","\\Pi","\\pitchfork","\\pm","\\pmatrix","\\pmb","\\pmod","\\pod","\\Pr","\\prec","\\precapprox","\\precnapprox","\\preccurlyeq","\\preceq","\\precneqq","\\precsim","\\precnsim","\\prime","\\prod","\\projlim","\\propto","\\psi","\\Psi","\\quad","\\qquad","\\raise","\\rangle","\\rbrace","\\rbrack","\\rceil","\\Re","\\renewcommand","\\require (non-standard)","\\restriction","\\rfloor","\\rgroup","\\rhd","\\rho","\\right","\\rightarrow","\\Rightarrow","\\rightarrowtail","\\rightharpoondown","\\rightharpoonup","\\rightleftarrows","\\rightleftharpoons","\\rightrightarrows","\\rightsquigarrow","\\rightthreetimes","\\risingdotseq","\\rlap","\\rm","\\rmoustache","\\Rrightarrow","\\Rsh","\\rtimes","\\Rule (non-standard)","\\rvert","\\rVert","\\S","\\scr","\\scriptscriptstyle","\\scriptsize","\\scriptstyle","\\searrow","\\sec","\\setminus","\\sf","\\sharp","\\shortmid","\\shortparallel","\\shoveleft","\\shoveright","\\sideset","\\sigma","\\Sigma","\\sim","\\simeq","\\sin","\\sinh","\\skew","\\small","\\smallfrown","\\smallint","\\smallsetminus","\\smallsmile","\\smash","\\smile","\\space","\\Space (non-standard)","\\spadesuit","\\sphericalangle","\\sqcap","\\sqcup","\\sqrt","\\sqsubset","\\sqsupset","\\sqsubseteq","\\sqsupseteq","\\square","\\stackrel","\\star","\\strut","\\style","\\subset","\\Subset","\\subseteq","\\subsetneq","\\subseteqq","\\subsetneqq","\\substack","\\succ","\\succapprox","\\succnapprox","\\succcurlyeq","\\succeq","\\succneqq","\\succsim","\\succnsim","\\sum","\\sup","\\supset","\\Supset","\\supseteq","\\supsetneq","\\supseteqq","\\supsetneqq","\\surd","\\swarrow","\\tag","\\tan","\\tanh","\\tau","\\tbinom","\\TeX","\\text{\u261A}\u261A","\\textbf{\u261A}\u261A","\\textit{\u261A}\u261A","\\textrm{\u261A}\u261A","\\textsf{\u261A}\u261A","\\texttt{\u261A}\u261A","\\textstyle","\\tfrac{\u261A}{\u261A}\u261A","\\therefore","\\theta","\\Theta","\\thickapprox","\\thicksim","\\thinspace","\\tilde","\\times","\\tiny","\\Tiny","\\to","\\top","\\triangle","\\triangledown","\\triangleleft","\\triangleright","\\trianglelefteq","\\trianglerighteq","\\triangleq","\\tt","\\twoheadleftarrow","\\twoheadrightarrow","\\ulcorner","\\urcorner","\\underbrace","\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\underline","\\underparen","\\underset","\\unicode","\\unlhd","\\unrhd","\\uparrow","\\Uparrow","\\updownarrow","\\Updownarrow","\\upharpoonleft","\\upharpoonright","\\uplus","\\uproot","\\upsilon","\\Upsilon","\\upuparrows","\\varDelta","\\varepsilon","\\varGamma","\\varinjlim","\\varkappa","\\varLambda","\\varlimsup","\\varliminf","\\varnothing","\\varOmega","\\varphi","\\varPhi","\\varpi","\\varPi","\\varprojlim","\\varpropto","\\varPsi","\\varrho","\\varsigma","\\varSigma","\\varsubsetneq","\\varsubsetneqq","\\varsupsetneq","\\varsupsetneqq","\\vartheta","\\varTheta","\\vartriangle","\\vartriangleleft","\\vartriangleright","\\varUpsilon","\\varXi","\\vcenter","\\vdash","\\Vdash","\\vDash","\\vdots","\\vec","\\vee","\\veebar","\\verb","\\vert","\\Vert","\\vphantom","\\Vvdash","\\wedge","\\widehat","\\widetilde","\\wp","\\wr","\\Xi","\\xi","\\xleftarrow","\\xrightarrow","\\yen","\\zeta","\\{%C\\}%C","\\langle %C \\rangle%C"],hee=["align","align*","alignat","alignat*","array","Bmatrix","bmatrix","cases","eqnarray","eqnarray*","equation","equation*","gather","gather*","matrix","pmatrix","smallmatrix","subarray","Vmatrix","vmatrix"];Xq=[...mee,...hee.map(gee)]});function yee(r){if(GF.has(r))return GF.get(r)??null;let e=null;try{e=(0,Zq.renderMath)(r,!0)}catch{e=null}return GF.set(r,e),e}function bee(r){return YF===null&&(YF=new Mc(r,{findAllMatches:!0,threshold:.8})),YF}var Zq,vee,GF,YF,VT,Jq=k(()=>{Ca();_C();Zq=require("obsidian");jF();xa();vee=new RegExp(/\\([a-z{}A-Z0-9]*)$/),GF=new Map,YF=null;VT=class extends Hr{constructor(t){super(kn().app,t);this.inputEl=t;this.lastInput="";this.symbols=Object.assign([],Xq)}getSuggestions(t){if(this.inputEl.selectionStart===null)return[];let n=this.inputEl.selectionStart,i=t.slice(0,n),o=i.lastIndexOf("\\"),s=i.slice(o),a=vee.exec(s),l=[];a&&(this.lastInput=a[1],l=this.symbols.filter(d=>d.toLowerCase().contains(this.lastInput)));let c=new Set(l);return bee(this.symbols).search(this.lastInput).map(d=>d.item).filter(d=>c.has(d))}renderSuggestion(t,n){if(t){n.setText(t);let i=yee(t);i&&n.append(i.cloneNode(!0))}}selectSuggestion(t){if(this.inputEl.selectionStart===null)return;let n=this.inputEl.selectionStart,i=this.lastInput.length,o=this.inputEl.value,s=0,a=t.replace(/\\\\/g,"\\");if(this.inputEl.value=`${o.slice(0,n-i-1)}${a}${o.slice(n)}`,s=n-i+t.length-1,this.inputEl.trigger("input"),this.close(),t.contains("\u261A")){let l=this.inputEl.value.indexOf("\u261A");this.inputEl.value=this.inputEl.value.replace("\u261A",""),this.inputEl.setSelectionRange(l,l)}else this.inputEl.setSelectionRange(s,s)}}});var eo,qT,eU=k(()=>{eo=require("obsidian");xa();jF();Jq();Er();qT=class r extends eo.Modal{constructor(){super(kn().app);this.didSubmit=!1;this.keybindListener=t=>{(t.ctrlKey||t.metaKey)&&t.key==="Enter"&&this.submit(),t.key==="Tab"&&(t.preventDefault(),this.cursorToGoTo())};this.submitClickCallback=t=>this.submit();this.cancelClickCallback=t=>this.cancel();this.open(),this.display(),this.waitForClose=new Promise((t,n)=>{this.resolvePromise=t,this.rejectPromise=n}),new VT(this.inputEl),this.inputEl.focus(),this.inputEl.select()}static Prompt(){return new r().waitForClose}display(){this.containerEl.addClass("quickAddModal","qaMathModal"),this.contentEl.empty();let t=this.contentEl.createDiv();t.className="math math-block is-loaded";let n=new eo.TextAreaComponent(this.contentEl);n.inputEl.setCssStyles({width:"100%",height:"10rem"}),this.inputEl=n.inputEl,n.onChange((0,eo.debounce)(async o=>await this.mathjaxLoop(t,o),50)),n.inputEl.addEventListener("keydown",this.keybindListener),this.contentEl.createDiv({text:"Ctrl/Cmd+Enter to submit \xB7 Tab to jump to the cursor marker",cls:"setting-item-description"}).setCssStyles({marginTop:"0.5rem"}),this.createButtonBar(this.contentEl.createDiv())}async onOpen(){super.onOpen(),await(0,eo.loadMathJax)()}async mathjaxLoop(t,n){let i=(0,eo.renderMath)(n,!0);await(0,eo.finishRenderMath)(),t.empty(),t.append(i)}cursorToGoTo(){if(this.inputEl.value.contains("\u261A")){let t=this.inputEl.value.indexOf("\u261A");this.inputEl.value=this.inputEl.value.replace("\u261A",""),this.inputEl.setSelectionRange(t,t)}}createButton(t,n,i){let o=new eo.ButtonComponent(t);return o.setButtonText(n).onClick(i),o}createButtonBar(t){let n=t.createDiv();this.createButton(n,"Ok",this.submitClickCallback).setCta().buttonEl.setCssStyles({marginRight:"0"}),this.createButton(n,"Cancel",this.cancelClickCallback),n.setCssStyles({display:"flex",flexDirection:"row-reverse",justifyContent:"flex-start",marginTop:"1rem",gap:"0.5rem"})}removeInputListeners(){this.inputEl.removeEventListener("keydown",this.keybindListener)}resolveInput(){let t=this.inputEl.value.replace(/\\n/g,"\\\\n").replace(new RegExp("\u261A","g"),"");this.didSubmit?this.resolvePromise(t):this.rejectPromise(Ir())}submit(){this.didSubmit=!0,this.close()}cancel(){this.close()}onClose(){super.onClose(),this.resolveInput(),this.removeInputListeners()}}});var Pz=B6(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});require("obsidian");var jl=class extends Error{},n0=class extends jl{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},i0=class extends jl{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},o0=class extends jl{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},zd=class extends jl{},QT=class extends jl{constructor(e){super(`Invalid unit ${e}`)}},to=class extends jl{},Ua=class extends jl{constructor(){super("Zone is an abstract class")}},be="numeric",ea="short",Ao="long",XT={year:be,month:be,day:be},PU={year:be,month:ea,day:be},wee={year:be,month:ea,day:be,weekday:ea},$U={year:be,month:Ao,day:be},MU={year:be,month:Ao,day:be,weekday:Ao},OU={hour:be,minute:be},RU={hour:be,minute:be,second:be},LU={hour:be,minute:be,second:be,timeZoneName:ea},NU={hour:be,minute:be,second:be,timeZoneName:Ao},BU={hour:be,minute:be,hourCycle:"h23"},VU={hour:be,minute:be,second:be,hourCycle:"h23"},qU={hour:be,minute:be,second:be,hourCycle:"h23",timeZoneName:ea},UU={hour:be,minute:be,second:be,hourCycle:"h23",timeZoneName:Ao},zU={year:be,month:be,day:be,hour:be,minute:be},HU={year:be,month:be,day:be,hour:be,minute:be,second:be},WU={year:be,month:ea,day:be,hour:be,minute:be},jU={year:be,month:ea,day:be,hour:be,minute:be,second:be},Cee={year:be,month:ea,day:be,weekday:ea,hour:be,minute:be},GU={year:be,month:Ao,day:be,hour:be,minute:be,timeZoneName:ea},YU={year:be,month:Ao,day:be,hour:be,minute:be,second:be,timeZoneName:ea},KU={year:be,month:Ao,day:be,weekday:Ao,hour:be,minute:be,timeZoneName:Ao},QU={year:be,month:Ao,day:be,weekday:Ao,hour:be,minute:be,second:be,timeZoneName:Ao},jd=class{get type(){throw new Ua}get name(){throw new Ua}get ianaName(){return this.name}get isUniversal(){throw new Ua}offsetName(e,t){throw new Ua}formatOffset(e,t){throw new Ua}offset(e){throw new Ua}equals(e){throw new Ua}get isValid(){throw new Ua}},KF=null,ZT=class r extends jd{static get instance(){return KF===null&&(KF=new r),KF}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return ZU(e,t,n)}formatOffset(e,t){return tb(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}},YT={};function Eee(r){return YT[r]||(YT[r]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),YT[r]}var xee={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Tee(r,e){let t=r.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,i,o,s,a,l,c,u]=n;return[s,i,o,a,l,c,u]}function See(r,e){let t=r.formatToParts(e),n=[];for(let i=0;i=0?m:1e3+m,(f-p)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}},tU={};function _ee(r,e={}){let t=JSON.stringify([r,e]),n=tU[t];return n||(n=new Intl.ListFormat(r,e),tU[t]=n),n}var s0={};function a0(r,e={}){let t=JSON.stringify([r,e]),n=s0[t];return n||(n=new Intl.DateTimeFormat(r,e),s0[t]=n),n}var l0={};function kee(r,e={}){let t=JSON.stringify([r,e]),n=l0[t];return n||(n=new Intl.NumberFormat(r,e),l0[t]=n),n}var c0={};function Aee(r,e={}){let{base:t,...n}=e,i=JSON.stringify([r,n]),o=c0[i];return o||(o=new Intl.RelativeTimeFormat(r,e),c0[i]=o),o}var Jy=null;function Dee(){return Jy||(Jy=new Intl.DateTimeFormat().resolvedOptions().locale,Jy)}function Iee(r){let e=r.indexOf("-x-");e!==-1&&(r=r.substring(0,e));let t=r.indexOf("-u-");if(t===-1)return[r];{let n,i;try{n=a0(r).resolvedOptions(),i=r}catch{let l=r.substring(0,t);n=a0(l).resolvedOptions(),i=l}let{numberingSystem:o,calendar:s}=n;return[i,o,s]}}function Fee(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}function Pee(r){let e=[];for(let t=1;t<=12;t++){let n=ft.utc(2009,t,1);e.push(r(n))}return e}function $ee(r){let e=[];for(let t=1;t<=7;t++){let n=ft.utc(2016,11,13+t);e.push(r(n))}return e}function zT(r,e,t,n){let i=r.listingMode();return i==="error"?null:i==="en"?t(e):n(e)}function Mee(r){return r.numberingSystem&&r.numberingSystem!=="latn"?!1:r.numberingSystem==="latn"||!r.locale||r.locale.startsWith("en")||new Intl.DateTimeFormat(r.intl).resolvedOptions().numberingSystem==="latn"}var u0=class{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:i,floor:o,...s}=n;if(!t||Object.keys(s).length>0){let a={useGrouping:!1,...n};n.padTo>0&&(a.minimumIntegerDigits=n.padTo),this.inf=kee(e,a)}}format(e){if(this.inf){let t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{let t=this.floor?Math.floor(e):T0(e,3);return Yr(t,this.padTo)}}},d0=class{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let s=-1*(e.offset/60),a=s>=0?`Etc/GMT+${s}`:`Etc/GMT${s}`;e.offset!==0&&yu.create(a).valid?(i=a,this.dt=e):(i="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let o={...this.opts};o.timeZone=o.timeZone||i,this.dtf=a0(t,o)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){let n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:n}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},p0=class{constructor(e,t,n){this.opts={style:"long",...n},!t&&XU()&&(this.rtf=Aee(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):Qee(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}},kr=class r{static fromOpts(e){return r.create(e.locale,e.numberingSystem,e.outputCalendar,e.defaultToEN)}static create(e,t,n,i=!1){let o=e||_r.defaultLocale,s=o||(i?"en-US":Dee()),a=t||_r.defaultNumberingSystem,l=n||_r.defaultOutputCalendar;return new r(s,a,l,o)}static resetCache(){Jy=null,s0={},l0={},c0={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:n}={}){return r.create(e,t,n)}constructor(e,t,n,i){let[o,s,a]=Iee(e);this.locale=o,this.numberingSystem=t||s||null,this.outputCalendar=n||a||null,this.intl=Fee(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Mee(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:r.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return zT(this,e,tz,()=>{let n=t?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";return this.monthsCache[i][e]||(this.monthsCache[i][e]=Pee(o=>this.extract(o,n,"month"))),this.monthsCache[i][e]})}weekdays(e,t=!1){return zT(this,e,iz,()=>{let n=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=t?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=$ee(o=>this.extract(o,n,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return zT(this,void 0,()=>oz,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[ft.utc(2016,11,13,9),ft.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return zT(this,e,sz,()=>{let t={era:e};return this.eraCache[e]||(this.eraCache[e]=[ft.utc(-40,1,1),ft.utc(2017,1,1)].map(n=>this.extract(n,t,"era"))),this.eraCache[e]})}extract(e,t,n){let i=this.dtFormatter(e,t),o=i.formatToParts(),s=o.find(a=>a.type.toLowerCase()===n);return s?s.value:null}numberFormatter(e={}){return new u0(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new d0(e,this.intl,t)}relFormatter(e={}){return new p0(this.intl,this.isEnglish(),e)}listFormatter(e={}){return _ee(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}},QF=null,ls=class r extends jd{static get utcInstance(){return QF===null&&(QF=new r(0)),QF}static instance(e){return e===0?r.utcInstance:new r(e)}static parseSpecifier(e){if(e){let t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new r(lS(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${tb(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${tb(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return tb(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}},f0=class extends jd{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function vu(r,e){if(yt(r)||r===null)return e;if(r instanceof jd)return r;if(Oee(r)){let t=r.toLowerCase();return t==="default"?e:t==="local"||t==="system"?ZT.instance:t==="utc"||t==="gmt"?ls.utcInstance:ls.parseSpecifier(t)||yu.create(r)}else return Wd(r)?ls.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new f0(r)}var rU=()=>Date.now(),nU="system",iU=null,oU=null,sU=null,aU=60,lU,_r=class{static get now(){return rU}static set now(e){rU=e}static set defaultZone(e){nU=e}static get defaultZone(){return vu(nU,ZT.instance)}static get defaultLocale(){return iU}static set defaultLocale(e){iU=e}static get defaultNumberingSystem(){return oU}static set defaultNumberingSystem(e){oU=e}static get defaultOutputCalendar(){return sU}static set defaultOutputCalendar(e){sU=e}static get twoDigitCutoffYear(){return aU}static set twoDigitCutoffYear(e){aU=e%100}static get throwOnInvalid(){return lU}static set throwOnInvalid(e){lU=e}static resetCaches(){kr.resetCache(),yu.resetCache()}};function yt(r){return typeof r>"u"}function Wd(r){return typeof r=="number"}function sS(r){return typeof r=="number"&&r%1===0}function Oee(r){return typeof r=="string"}function Ree(r){return Object.prototype.toString.call(r)==="[object Date]"}function XU(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Lee(r){return Array.isArray(r)?r:[r]}function cU(r,e,t){if(r.length!==0)return r.reduce((n,i)=>{let o=[e(i),i];return n&&t(n[0],o[0])===n[0]?n:o},null)[1]}function Nee(r,e){return e.reduce((t,n)=>(t[n]=r[n],t),{})}function jm(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Wl(r,e,t){return sS(r)&&r>=e&&r<=t}function Bee(r,e){return r-e*Math.floor(r/e)}function Yr(r,e=2){let t=r<0,n;return t?n="-"+(""+-r).padStart(e,"0"):n=(""+r).padStart(e,"0"),n}function gu(r){if(!(yt(r)||r===null||r===""))return parseInt(r,10)}function qd(r){if(!(yt(r)||r===null||r===""))return parseFloat(r)}function x0(r){if(!(yt(r)||r===null||r==="")){let e=parseFloat("0."+r)*1e3;return Math.floor(e)}}function T0(r,e,t=!1){let n=10**e;return(t?Math.trunc:Math.round)(r*n)/n}function ib(r){return r%4===0&&(r%100!==0||r%400===0)}function eb(r){return ib(r)?366:365}function JT(r,e){let t=Bee(e-1,12)+1,n=r+(e-t)/12;return t===2?ib(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function aS(r){let e=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond);return r.year<100&&r.year>=0&&(e=new Date(e),e.setUTCFullYear(r.year,r.month-1,r.day)),+e}function eS(r){let e=(r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400))%7,t=r-1,n=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7;return e===4||n===3?53:52}function m0(r){return r>99?r:r>_r.twoDigitCutoffYear?1900+r:2e3+r}function ZU(r,e,t,n=null){let i=new Date(r),o={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(o.timeZone=n);let s={timeZoneName:e,...o},a=new Intl.DateTimeFormat(t,s).formatToParts(i).find(l=>l.type.toLowerCase()==="timezonename");return a?a.value:null}function lS(r,e){let t=parseInt(r,10);Number.isNaN(t)&&(t=0);let n=parseInt(e,10)||0,i=t<0||Object.is(t,-0)?-n:n;return t*60+i}function JU(r){let e=Number(r);if(typeof r=="boolean"||r===""||Number.isNaN(e))throw new to(`Invalid unit value ${r}`);return e}function tS(r,e){let t={};for(let n in r)if(jm(r,n)){let i=r[n];if(i==null)continue;t[e(n)]=JU(i)}return t}function tb(r,e){let t=Math.trunc(Math.abs(r/60)),n=Math.trunc(Math.abs(r%60)),i=r>=0?"+":"-";switch(e){case"short":return`${i}${Yr(t,2)}:${Yr(n,2)}`;case"narrow":return`${i}${t}${n>0?`:${n}`:""}`;case"techie":return`${i}${Yr(t,2)}${Yr(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function cS(r){return Nee(r,["hour","minute","second","millisecond"])}var Vee=["January","February","March","April","May","June","July","August","September","October","November","December"],ez=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],qee=["J","F","M","A","M","J","J","A","S","O","N","D"];function tz(r){switch(r){case"narrow":return[...qee];case"short":return[...ez];case"long":return[...Vee];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var rz=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],nz=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Uee=["M","T","W","T","F","S","S"];function iz(r){switch(r){case"narrow":return[...Uee];case"short":return[...nz];case"long":return[...rz];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var oz=["AM","PM"],zee=["Before Christ","Anno Domini"],Hee=["BC","AD"],Wee=["B","A"];function sz(r){switch(r){case"narrow":return[...Wee];case"short":return[...Hee];case"long":return[...zee];default:return null}}function jee(r){return oz[r.hour<12?0:1]}function Gee(r,e){return iz(e)[r.weekday-1]}function Yee(r,e){return tz(e)[r.month-1]}function Kee(r,e){return sz(e)[r.year<0?0:1]}function Qee(r,e,t="always",n=!1){let i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},o=["hours","minutes","seconds"].indexOf(r)===-1;if(t==="auto"&&o){let d=r==="days";switch(e){case 1:return d?"tomorrow":`next ${i[r][0]}`;case-1:return d?"yesterday":`last ${i[r][0]}`;case 0:return d?"today":`this ${i[r][0]}`}}let s=Object.is(e,-0)||e<0,a=Math.abs(e),l=a===1,c=i[r],u=n?l?c[1]:c[2]||c[1]:l?i[r][0]:r;return s?`${a} ${u} ago`:`in ${a} ${u}`}function uU(r,e){let t="";for(let n of r)n.literal?t+=n.val:t+=e(n.val);return t}var Xee={D:XT,DD:PU,DDD:$U,DDDD:MU,t:OU,tt:RU,ttt:LU,tttt:NU,T:BU,TT:VU,TTT:qU,TTTT:UU,f:zU,ff:WU,fff:GU,ffff:KU,F:HU,FF:jU,FFF:YU,FFFF:QU},_o=class r{static create(e,t={}){return new r(e,t)}static parseFormat(e){let t=null,n="",i=!1,o=[];for(let s=0;s0&&o.push({literal:i||/^\s+$/.test(n),val:n}),t=null,n="",i=!i):i||a===t?n+=a:(n.length>0&&o.push({literal:/^\s+$/.test(n),val:n}),n=a,t=a)}return n.length>0&&o.push({literal:i||/^\s+$/.test(n),val:n}),o}static macroTokenToFormatOpts(e){return Xee[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0){if(this.opts.forceSimple)return Yr(e,t);let n={...this.opts};return t>0&&(n.padTo=t),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,t){let n=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",o=(p,m)=>this.loc.extract(e,p,m),s=p=>e.isOffsetFixed&&e.offset===0&&p.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,p.format):"",a=()=>n?jee(e):o({hour:"numeric",hourCycle:"h12"},"dayperiod"),l=(p,m)=>n?Yee(e,p):o(m?{month:p}:{month:p,day:"numeric"},"month"),c=(p,m)=>n?Gee(e,p):o(m?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),u=p=>{let m=r.macroTokenToFormatOpts(p);return m?this.formatWithSystemDefault(e,m):p},d=p=>n?Kee(e,p):o({era:p},"era"),f=p=>{switch(p){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return s({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return s({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return s({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return a();case"d":return i?o({day:"numeric"},"day"):this.num(e.day);case"dd":return i?o({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return c("short",!0);case"cccc":return c("long",!0);case"ccccc":return c("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return c("short",!1);case"EEEE":return c("long",!1);case"EEEEE":return c("narrow",!1);case"L":return i?o({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?o({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return l("short",!0);case"LLLL":return l("long",!0);case"LLLLL":return l("narrow",!0);case"M":return i?o({month:"numeric"},"month"):this.num(e.month);case"MM":return i?o({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return l("short",!1);case"MMMM":return l("long",!1);case"MMMMM":return l("narrow",!1);case"y":return i?o({year:"numeric"},"year"):this.num(e.year);case"yy":return i?o({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?o({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?o({year:"numeric"},"year"):this.num(e.year,6);case"G":return d("short");case"GG":return d("long");case"GGGGG":return d("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return u(p)}};return uU(r.parseFormat(t),f)}formatDurationFromString(e,t){let n=l=>{switch(l[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},i=l=>c=>{let u=n(c);return u?this.num(l.get(u),c.length):c},o=r.parseFormat(t),s=o.reduce((l,{literal:c,val:u})=>c?l:l.concat(u),[]),a=e.shiftTo(...s.map(n).filter(l=>l));return uU(o,i(a))}},ko=class{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}},az=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Gm(...r){let e=r.reduce((t,n)=>t+n.source,"");return RegExp(`^${e}$`)}function Ym(...r){return e=>r.reduce(([t,n,i],o)=>{let[s,a,l]=o(e,i);return[{...t,...s},a||n,l]},[{},null,1]).slice(0,2)}function Km(r,...e){if(r==null)return[null,null];for(let[t,n]of e){let i=t.exec(r);if(i)return n(i)}return[null,null]}function lz(...r){return(e,t)=>{let n={},i;for(i=0;ip!==void 0&&(m||p&&u)?-p:p;return[{years:f(qd(t)),months:f(qd(n)),weeks:f(qd(i)),days:f(qd(o)),hours:f(qd(s)),minutes:f(qd(a)),seconds:f(qd(l),l==="-0"),milliseconds:f(x0(c),d)}]}var ute={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function k0(r,e,t,n,i,o,s){let a={year:e.length===2?m0(gu(e)):gu(e),month:ez.indexOf(t)+1,day:gu(n),hour:gu(i),minute:gu(o)};return s&&(a.second=gu(s)),r&&(a.weekday=r.length>3?rz.indexOf(r)+1:nz.indexOf(r)+1),a}var dte=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function pte(r){let[,e,t,n,i,o,s,a,l,c,u,d]=r,f=k0(e,i,n,t,o,s,a),p;return l?p=ute[l]:c?p=0:p=lS(u,d),[f,new ls(p)]}function fte(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var mte=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,hte=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,gte=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function dU(r){let[,e,t,n,i,o,s,a]=r;return[k0(e,i,n,t,o,s,a),ls.utcInstance]}function vte(r){let[,e,t,n,i,o,s,a]=r;return[k0(e,a,t,n,i,o,s),ls.utcInstance]}var yte=Gm(Jee,_0),bte=Gm(ete,_0),wte=Gm(tte,_0),Cte=Gm(uz),pz=Ym(ste,Qm,ob,sb),Ete=Ym(rte,Qm,ob,sb),xte=Ym(nte,Qm,ob,sb),Tte=Ym(Qm,ob,sb);function Ste(r){return Km(r,[yte,pz],[bte,Ete],[wte,xte],[Cte,Tte])}function _te(r){return Km(fte(r),[dte,pte])}function kte(r){return Km(r,[mte,dU],[hte,dU],[gte,vte])}function Ate(r){return Km(r,[lte,cte])}var Dte=Ym(Qm);function Ite(r){return Km(r,[ate,Dte])}var Fte=Gm(ite,ote),Pte=Gm(dz),$te=Ym(Qm,ob,sb);function Mte(r){return Km(r,[Fte,pz],[Pte,$te])}var pU="Invalid Duration",fz={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Ote={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...fz},ss=146097/400,qm=146097/4800,Rte={years:{quarters:4,months:12,weeks:ss/7,days:ss,hours:ss*24,minutes:ss*24*60,seconds:ss*24*60*60,milliseconds:ss*24*60*60*1e3},quarters:{months:3,weeks:ss/28,days:ss/4,hours:ss*24/4,minutes:ss*24*60/4,seconds:ss*24*60*60/4,milliseconds:ss*24*60*60*1e3/4},months:{weeks:qm/7,days:qm,hours:qm*24,minutes:qm*24*60,seconds:qm*24*60*60,milliseconds:qm*24*60*60*1e3},...fz},Hd=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Lte=Hd.slice(0).reverse();function hu(r,e,t=!1){let n={values:t?e.values:{...r.values,...e.values||{}},loc:r.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||r.conversionAccuracy,matrix:e.matrix||r.matrix};return new Ue(n)}function mz(r,e){let t=e.milliseconds??0;for(let n of Lte.slice(1))e[n]&&(t+=e[n]*r[n].milliseconds);return t}function fU(r,e){let t=mz(r,e)<0?-1:1;Hd.reduceRight((n,i)=>{if(yt(e[i]))return n;if(n){let o=e[n]*t,s=r[i][n],a=Math.floor(o/s);e[i]+=a*t,e[n]-=a*s*t}return i},null),Hd.reduce((n,i)=>{if(yt(e[i]))return n;if(n){let o=e[n]%1;e[n]-=o,e[i]+=o*r[n][i]}return i},null)}function Nte(r){let e={};for(let[t,n]of Object.entries(r))n!==0&&(e[t]=n);return e}var Ue=class r{constructor(e){let t=e.conversionAccuracy==="longterm"||!1,n=t?Rte:Ote;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||kr.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return r.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new to(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new r({values:tS(e,r.normalizeUnit),loc:kr.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(Wd(e))return r.fromMillis(e);if(r.isDuration(e))return e;if(typeof e=="object")return r.fromObject(e);throw new to(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){let[n]=Ate(e);return n?r.fromObject(n,t):r.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){let[n]=Ite(e);return n?r.fromObject(n,t):r.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new to("need to specify a reason the Duration is invalid");let n=e instanceof ko?e:new ko(e,t);if(_r.throwOnInvalid)throw new o0(n);return new r({invalid:n})}static normalizeUnit(e){let t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new QT(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){let n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?_o.create(this.loc,n).formatDurationFromString(this,e):pU}toHuman(e={}){if(!this.isValid)return pU;let t=Hd.map(n=>{let i=this.values[n];return yt(i)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(i)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(t)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=T0(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},ft.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}toMillis(){return this.isValid?mz(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let t=r.fromDurationLike(e),n={};for(let i of Hd)(jm(t.values,i)||jm(this.values,i))&&(n[i]=t.get(i)+this.get(i));return hu(this,{values:n},!0)}minus(e){if(!this.isValid)return this;let t=r.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;let t={};for(let n of Object.keys(this.values))t[n]=JU(e(this.values[n],n));return hu(this,{values:t},!0)}get(e){return this[r.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let t={...this.values,...tS(e,r.normalizeUnit)};return hu(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:i}={}){let s={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:i,conversionAccuracy:n};return hu(this,s)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return fU(this.matrix,e),hu(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Nte(this.normalize().shiftToAll().toObject());return hu(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(s=>r.normalizeUnit(s));let t={},n={},i=this.toObject(),o;for(let s of Hd)if(e.indexOf(s)>=0){o=s;let a=0;for(let c in n)a+=this.matrix[c][s]*n[c],n[c]=0;Wd(i[s])&&(a+=i[s]);let l=Math.trunc(a);t[s]=l,n[s]=(a*1e3-l*1e3)/1e3}else Wd(i[s])&&(n[s]=i[s]);for(let s in n)n[s]!==0&&(t[o]+=s===o?n[s]:n[s]/this.matrix[o][s]);return fU(this.matrix,t),hu(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return hu(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(n,i){return n===void 0||n===0?i===void 0||i===0:n===i}for(let n of Hd)if(!t(this.values[n],e.values[n]))return!1;return!0}},Um="Invalid Interval";function Bte(r,e){return!r||!r.isValid?Wm.invalid("missing or invalid start"):!e||!e.isValid?Wm.invalid("missing or invalid end"):ee:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?r.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];let t=e.map(Xy).filter(s=>this.contains(s)).sort(),n=[],{s:i}=this,o=0;for(;i+this.e?this.e:s;n.push(r.fromDateTimes(i,a)),i=a,o+=1}return n}splitBy(e){let t=Ue.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:n}=this,i=1,o,s=[];for(;nl*i));o=+a>+this.e?this.e:a,s.push(r.fromDateTimes(n,o)),n=o,i+=1}return s}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let t=this.s>e.s?this.s:e.s,n=this.e=n?null:r.fromDateTimes(t,n)}union(e){if(!this.isValid)return this;let t=this.se.e?this.e:e.e;return r.fromDateTimes(t,n)}static merge(e){let[t,n]=e.sort((i,o)=>i.s-o.s).reduce(([i,o],s)=>o?o.overlaps(s)||o.abutsStart(s)?[i,o.union(s)]:[i.concat([o]),s]:[i,s],[[],null]);return n&&t.push(n),t}static xor(e){let t=null,n=0,i=[],o=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),s=Array.prototype.concat(...o),a=s.sort((l,c)=>l.time-c.time);for(let l of a)n+=l.type==="s"?1:-1,n===1?t=l.time:(t&&+t!=+l.time&&i.push(r.fromDateTimes(t,l.time)),t=null);return r.merge(i)}difference(...e){return r.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:Um}toLocaleString(e=XT,t={}){return this.isValid?_o.create(this.s.loc.clone(t),e).formatInterval(this):Um}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Um}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Um}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Um}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Um}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):Ue.invalid(this.invalidReason)}mapEndpoints(e){return r.fromDateTimes(e(this.s),e(this.e))}},zm=class{static hasDST(e=_r.defaultZone){let t=ft.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return yu.isValidZone(e)}static normalizeZone(e){return vu(e,_r.defaultZone)}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null,outputCalendar:o="gregory"}={}){return(i||kr.create(t,n,o)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null,outputCalendar:o="gregory"}={}){return(i||kr.create(t,n,o)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null}={}){return(i||kr.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null}={}){return(i||kr.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return kr.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return kr.create(t,null,"gregory").eras(e)}static features(){return{relative:XU()}}};function mU(r,e){let t=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=t(e)-t(r);return Math.floor(Ue.fromMillis(n).as("days"))}function Vte(r,e,t){let n=[["years",(l,c)=>c.year-l.year],["quarters",(l,c)=>c.quarter-l.quarter+(c.year-l.year)*4],["months",(l,c)=>c.month-l.month+(c.year-l.year)*12],["weeks",(l,c)=>{let u=mU(l,c);return(u-u%7)/7}],["days",mU]],i={},o=r,s,a;for(let[l,c]of n)t.indexOf(l)>=0&&(s=l,i[l]=c(r,e),a=o.plus(i),a>e?(i[l]--,r=o.plus(i),r>e&&(a=r,i[l]--,r=o.plus(i))):r=a);return[r,i,a,s]}function qte(r,e,t,n){let[i,o,s,a]=Vte(r,e,t),l=e-i,c=t.filter(d=>["hours","minutes","seconds","milliseconds"].indexOf(d)>=0);c.length===0&&(s0?Ue.fromMillis(l,n).shiftTo(...c).plus(u):u}var A0={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},hU={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Ute=A0.hanidec.replace(/[\[|\]]/g,"").split("");function zte(r){let e=parseInt(r,10);if(isNaN(e)){e="";for(let t=0;t=o&&n<=s&&(e+=n-o)}}return parseInt(e,10)}else return e}function Xs({numberingSystem:r},e=""){return new RegExp(`${A0[r||"latn"]}${e}`)}var Hte="missing Intl.DateTimeFormat.formatToParts support";function Rt(r,e=t=>t){return{regex:r,deser:([t])=>e(zte(t))}}var Wte="\xA0",hz=`[ ${Wte}]`,gz=new RegExp(hz,"g");function jte(r){return r.replace(/\./g,"\\.?").replace(gz,hz)}function gU(r){return r.replace(/\./g,"").replace(gz," ").toLowerCase()}function Zs(r,e){return r===null?null:{regex:RegExp(r.map(jte).join("|")),deser:([t])=>r.findIndex(n=>gU(t)===gU(n))+e}}function vU(r,e){return{regex:r,deser:([,t,n])=>lS(t,n),groups:e}}function HT(r){return{regex:r,deser:([e])=>e}}function Gte(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Yte(r,e){let t=Xs(e),n=Xs(e,"{2}"),i=Xs(e,"{3}"),o=Xs(e,"{4}"),s=Xs(e,"{6}"),a=Xs(e,"{1,2}"),l=Xs(e,"{1,3}"),c=Xs(e,"{1,6}"),u=Xs(e,"{1,9}"),d=Xs(e,"{2,4}"),f=Xs(e,"{4,6}"),p=g=>({regex:RegExp(Gte(g.val)),deser:([y])=>y,literal:!0}),v=(g=>{if(r.literal)return p(g);switch(g.val){case"G":return Zs(e.eras("short"),0);case"GG":return Zs(e.eras("long"),0);case"y":return Rt(c);case"yy":return Rt(d,m0);case"yyyy":return Rt(o);case"yyyyy":return Rt(f);case"yyyyyy":return Rt(s);case"M":return Rt(a);case"MM":return Rt(n);case"MMM":return Zs(e.months("short",!0),1);case"MMMM":return Zs(e.months("long",!0),1);case"L":return Rt(a);case"LL":return Rt(n);case"LLL":return Zs(e.months("short",!1),1);case"LLLL":return Zs(e.months("long",!1),1);case"d":return Rt(a);case"dd":return Rt(n);case"o":return Rt(l);case"ooo":return Rt(i);case"HH":return Rt(n);case"H":return Rt(a);case"hh":return Rt(n);case"h":return Rt(a);case"mm":return Rt(n);case"m":return Rt(a);case"q":return Rt(a);case"qq":return Rt(n);case"s":return Rt(a);case"ss":return Rt(n);case"S":return Rt(l);case"SSS":return Rt(i);case"u":return HT(u);case"uu":return HT(a);case"uuu":return Rt(t);case"a":return Zs(e.meridiems(),0);case"kkkk":return Rt(o);case"kk":return Rt(d,m0);case"W":return Rt(a);case"WW":return Rt(n);case"E":case"c":return Rt(t);case"EEE":return Zs(e.weekdays("short",!1),1);case"EEEE":return Zs(e.weekdays("long",!1),1);case"ccc":return Zs(e.weekdays("short",!0),1);case"cccc":return Zs(e.weekdays("long",!0),1);case"Z":case"ZZ":return vU(new RegExp(`([+-]${a.source})(?::(${n.source}))?`),2);case"ZZZ":return vU(new RegExp(`([+-]${a.source})(${n.source})?`),2);case"z":return HT(/[a-z_+-/]{1,256}?/i);case" ":return HT(/[^\S\n\r]/);default:return p(g)}})(r)||{invalidReason:Hte};return v.token=r,v}var Kte={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function Qte(r,e,t){let{type:n,value:i}=r;if(n==="literal"){let l=/^\s+$/.test(i);return{literal:!l,val:l?" ":i}}let o=e[n],s=n;n==="hour"&&(e.hour12!=null?s=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?s="hour12":s="hour24":s=t.hour12?"hour12":"hour24");let a=Kte[s];if(typeof a=="object"&&(a=a[o]),a)return{literal:!1,val:a}}function Xte(r){return[`^${r.map(t=>t.regex).reduce((t,n)=>`${t}(${n.source})`,"")}$`,r]}function Zte(r,e,t){let n=r.match(e);if(n){let i={},o=1;for(let s in t)if(jm(t,s)){let a=t[s],l=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(n.slice(o,o+l))),o+=l}return[n,i]}else return[n,{}]}function Jte(r){let e=o=>{switch(o){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},t=null,n;return yt(r.z)||(t=yu.create(r.z)),yt(r.Z)||(t||(t=new ls(r.Z)),n=r.Z),yt(r.q)||(r.M=(r.q-1)*3+1),yt(r.h)||(r.h<12&&r.a===1?r.h+=12:r.h===12&&r.a===0&&(r.h=0)),r.G===0&&r.y&&(r.y=-r.y),yt(r.u)||(r.S=x0(r.u)),[Object.keys(r).reduce((o,s)=>{let a=e(s);return a&&(o[a]=r[s]),o},{}),t,n]}var XF=null;function ere(){return XF||(XF=ft.fromMillis(1555555555555)),XF}function tre(r,e){if(r.literal)return r;let t=_o.macroTokenToFormatOpts(r.val),n=bz(t,e);return n==null||n.includes(void 0)?r:n}function vz(r,e){return Array.prototype.concat(...r.map(t=>tre(t,e)))}function yz(r,e,t){let n=vz(_o.parseFormat(t),r),i=n.map(s=>Yte(s,r)),o=i.find(s=>s.invalidReason);if(o)return{input:e,tokens:n,invalidReason:o.invalidReason};{let[s,a]=Xte(i),l=RegExp(s,"i"),[c,u]=Zte(e,l,a),[d,f,p]=u?Jte(u):[null,null,void 0];if(jm(u,"a")&&jm(u,"H"))throw new zd("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:n,regex:l,rawMatches:c,matches:u,result:d,zone:f,specificOffset:p}}}function rre(r,e,t){let{result:n,zone:i,specificOffset:o,invalidReason:s}=yz(r,e,t);return[n,i,o,s]}function bz(r,e){if(!r)return null;let n=_o.create(e,r).dtFormatter(ere()),i=n.formatToParts(),o=n.resolvedOptions();return i.map(s=>Qte(s,r,o))}var wz=[0,31,59,90,120,151,181,212,243,273,304,334],Cz=[0,31,60,91,121,152,182,213,244,274,305,335];function as(r,e){return new ko("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}function Ez(r,e,t){let n=new Date(Date.UTC(r,e-1,t));r<100&&r>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);let i=n.getUTCDay();return i===0?7:i}function xz(r,e,t){return t+(ib(r)?Cz:wz)[e-1]}function Tz(r,e){let t=ib(r)?Cz:wz,n=t.findIndex(o=>oeS(e)?(a=e+1,s=1):a=e,{weekYear:a,weekNumber:s,weekday:o,...cS(r)}}function yU(r){let{weekYear:e,weekNumber:t,weekday:n}=r,i=Ez(e,1,4),o=eb(e),s=t*7+n-i-3,a;s<1?(a=e-1,s+=eb(a)):s>o?(a=e+1,s-=eb(e)):a=e;let{month:l,day:c}=Tz(a,s);return{year:a,month:l,day:c,...cS(r)}}function ZF(r){let{year:e,month:t,day:n}=r,i=xz(e,t,n);return{year:e,ordinal:i,...cS(r)}}function bU(r){let{year:e,ordinal:t}=r,{month:n,day:i}=Tz(e,t);return{year:e,month:n,day:i,...cS(r)}}function nre(r){let e=sS(r.weekYear),t=Wl(r.weekNumber,1,eS(r.weekYear)),n=Wl(r.weekday,1,7);return e?t?n?!1:as("weekday",r.weekday):as("week",r.week):as("weekYear",r.weekYear)}function ire(r){let e=sS(r.year),t=Wl(r.ordinal,1,eb(r.year));return e?t?!1:as("ordinal",r.ordinal):as("year",r.year)}function Sz(r){let e=sS(r.year),t=Wl(r.month,1,12),n=Wl(r.day,1,JT(r.year,r.month));return e?t?n?!1:as("day",r.day):as("month",r.month):as("year",r.year)}function _z(r){let{hour:e,minute:t,second:n,millisecond:i}=r,o=Wl(e,0,23)||e===24&&t===0&&n===0&&i===0,s=Wl(t,0,59),a=Wl(n,0,59),l=Wl(i,0,999);return o?s?a?l?!1:as("millisecond",i):as("second",n):as("minute",t):as("hour",e)}var JF="Invalid DateTime",wU=864e13;function WT(r){return new ko("unsupported zone",`the zone "${r.name}" is not supported`)}function e0(r){return r.weekData===null&&(r.weekData=h0(r.c)),r.weekData}function Ud(r,e){let t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new ft({...t,...e,old:t})}function kz(r,e,t){let n=r-e*60*1e3,i=t.offset(n);if(e===i)return[n,e];n-=(i-e)*60*1e3;let o=t.offset(n);return i===o?[n,i]:[r-Math.min(i,o)*60*1e3,Math.max(i,o)]}function jT(r,e){r+=e*60*1e3;let t=new Date(r);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function KT(r,e,t){return kz(aS(r),e,t)}function CU(r,e){let t=r.o,n=r.c.year+Math.trunc(e.years),i=r.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,o={...r.c,year:n,month:i,day:Math.min(r.c.day,JT(n,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},s=Ue.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=aS(o),[l,c]=kz(a,t,r.zone);return s!==0&&(l+=s,c=r.zone.offset(l)),{ts:l,o:c}}function Qy(r,e,t,n,i,o){let{setZone:s,zone:a}=t;if(r&&Object.keys(r).length!==0||e){let l=e||a,c=ft.fromObject(r,{...t,zone:l,specificOffset:o});return s?c:c.setZone(a)}else return ft.invalid(new ko("unparsable",`the input "${i}" can't be parsed as ${n}`))}function GT(r,e,t=!0){return r.isValid?_o.create(kr.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}function t0(r,e){let t=r.c.year>9999||r.c.year<0,n="";return t&&r.c.year>=0&&(n+="+"),n+=Yr(r.c.year,t?6:4),e?(n+="-",n+=Yr(r.c.month),n+="-",n+=Yr(r.c.day)):(n+=Yr(r.c.month),n+=Yr(r.c.day)),n}function EU(r,e,t,n,i,o){let s=Yr(r.c.hour);return e?(s+=":",s+=Yr(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(s+=":")):s+=Yr(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(s+=Yr(r.c.second),(r.c.millisecond!==0||!n)&&(s+=".",s+=Yr(r.c.millisecond,3))),i&&(r.isOffsetFixed&&r.offset===0&&!o?s+="Z":r.o<0?(s+="-",s+=Yr(Math.trunc(-r.o/60)),s+=":",s+=Yr(Math.trunc(-r.o%60))):(s+="+",s+=Yr(Math.trunc(r.o/60)),s+=":",s+=Yr(Math.trunc(r.o%60)))),o&&(s+="["+r.zone.ianaName+"]"),s}var Az={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},ore={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},sre={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Dz=["year","month","day","hour","minute","second","millisecond"],are=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],lre=["year","ordinal","hour","minute","second","millisecond"];function xU(r){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[r.toLowerCase()];if(!e)throw new QT(r);return e}function TU(r,e){let t=vu(e.zone,_r.defaultZone),n=kr.fromObject(e),i=_r.now(),o,s;if(yt(r.year))o=i;else{for(let c of Dz)yt(r[c])&&(r[c]=Az[c]);let a=Sz(r)||_z(r);if(a)return ft.invalid(a);let l=t.offset(i);[o,s]=KT(r,l,t)}return new ft({ts:o,zone:t,loc:n,o:s})}function SU(r,e,t){let n=yt(t.round)?!0:t.round,i=(s,a)=>(s=T0(s,n||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(s,a)),o=s=>t.calendary?e.hasSame(r,s)?0:e.startOf(s).diff(r.startOf(s),s).get(s):e.diff(r,s).get(s);if(t.unit)return i(o(t.unit),t.unit);for(let s of t.units){let a=o(s);if(Math.abs(a)>=1)return i(a,s)}return i(r>e?-0:0,t.units[t.units.length-1])}function _U(r){let e={},t;return r.length>0&&typeof r[r.length-1]=="object"?(e=r[r.length-1],t=Array.from(r).slice(0,r.length-1)):t=Array.from(r),[e,t]}var ft=class r{constructor(e){let t=e.zone||_r.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new ko("invalid input"):null)||(t.isValid?null:WT(t));this.ts=yt(e.ts)?_r.now():e.ts;let i=null,o=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[i,o]=[e.old.c,e.old.o];else{let a=t.offset(this.ts);i=jT(this.ts,a),n=Number.isNaN(i.year)?new ko("invalid input"):null,i=n?null:i,o=n?null:a}this._zone=t,this.loc=e.loc||kr.create(),this.invalid=n,this.weekData=null,this.c=i,this.o=o,this.isLuxonDateTime=!0}static now(){return new r({})}static local(){let[e,t]=_U(arguments),[n,i,o,s,a,l,c]=t;return TU({year:n,month:i,day:o,hour:s,minute:a,second:l,millisecond:c},e)}static utc(){let[e,t]=_U(arguments),[n,i,o,s,a,l,c]=t;return e.zone=ls.utcInstance,TU({year:n,month:i,day:o,hour:s,minute:a,second:l,millisecond:c},e)}static fromJSDate(e,t={}){let n=Ree(e)?e.valueOf():NaN;if(Number.isNaN(n))return r.invalid("invalid input");let i=vu(t.zone,_r.defaultZone);return i.isValid?new r({ts:n,zone:i,loc:kr.fromObject(t)}):r.invalid(WT(i))}static fromMillis(e,t={}){if(Wd(e))return e<-wU||e>wU?r.invalid("Timestamp out of range"):new r({ts:e,zone:vu(t.zone,_r.defaultZone),loc:kr.fromObject(t)});throw new to(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(Wd(e))return new r({ts:e*1e3,zone:vu(t.zone,_r.defaultZone),loc:kr.fromObject(t)});throw new to("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};let n=vu(t.zone,_r.defaultZone);if(!n.isValid)return r.invalid(WT(n));let i=_r.now(),o=yt(t.specificOffset)?n.offset(i):t.specificOffset,s=tS(e,xU),a=!yt(s.ordinal),l=!yt(s.year),c=!yt(s.month)||!yt(s.day),u=l||c,d=s.weekYear||s.weekNumber,f=kr.fromObject(t);if((u||a)&&d)throw new zd("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&a)throw new zd("Can't mix ordinal dates with month/day");let p=d||s.weekday&&!u,m,v,g=jT(i,o);p?(m=are,v=ore,g=h0(g)):a?(m=lre,v=sre,g=ZF(g)):(m=Dz,v=Az);let y=!1;for(let I of m){let q=s[I];yt(q)?y?s[I]=v[I]:s[I]=g[I]:y=!0}let w=p?nre(s):a?ire(s):Sz(s),T=w||_z(s);if(T)return r.invalid(T);let b=p?yU(s):a?bU(s):s,[E,C]=KT(b,o,n),_=new r({ts:E,zone:n,o:C,loc:f});return s.weekday&&u&&e.weekday!==_.weekday?r.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${_.toISO()}`):_}static fromISO(e,t={}){let[n,i]=Ste(e);return Qy(n,i,t,"ISO 8601",e)}static fromRFC2822(e,t={}){let[n,i]=_te(e);return Qy(n,i,t,"RFC 2822",e)}static fromHTTP(e,t={}){let[n,i]=kte(e);return Qy(n,i,t,"HTTP",t)}static fromFormat(e,t,n={}){if(yt(e)||yt(t))throw new to("fromFormat requires an input string and a format");let{locale:i=null,numberingSystem:o=null}=n,s=kr.fromOpts({locale:i,numberingSystem:o,defaultToEN:!0}),[a,l,c,u]=rre(s,e,t);return u?r.invalid(u):Qy(a,l,n,`format ${t}`,e,c)}static fromString(e,t,n={}){return r.fromFormat(e,t,n)}static fromSQL(e,t={}){let[n,i]=Mte(e);return Qy(n,i,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new to("need to specify a reason the DateTime is invalid");let n=e instanceof ko?e:new ko(e,t);if(_r.throwOnInvalid)throw new n0(n);return new r({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){let n=bz(e,kr.fromObject(t));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(e,t={}){return vz(_o.parseFormat(e),kr.fromObject(t)).map(i=>i.val).join("")}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?e0(this).weekYear:NaN}get weekNumber(){return this.isValid?e0(this).weekNumber:NaN}get weekday(){return this.isValid?e0(this).weekday:NaN}get ordinal(){return this.isValid?ZF(this.c).ordinal:NaN}get monthShort(){return this.isValid?zm.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?zm.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?zm.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?zm.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,t=6e4,n=aS(this.c),i=this.zone.offset(n-e),o=this.zone.offset(n+e),s=this.zone.offset(n-i*t),a=this.zone.offset(n-o*t);if(s===a)return[this];let l=n-s*t,c=n-a*t,u=jT(l,s),d=jT(c,a);return u.hour===d.hour&&u.minute===d.minute&&u.second===d.second&&u.millisecond===d.millisecond?[Ud(this,{ts:l}),Ud(this,{ts:c})]:[this]}get isInLeapYear(){return ib(this.year)}get daysInMonth(){return JT(this.year,this.month)}get daysInYear(){return this.isValid?eb(this.year):NaN}get weeksInWeekYear(){return this.isValid?eS(this.weekYear):NaN}resolvedLocaleOptions(e={}){let{locale:t,numberingSystem:n,calendar:i}=_o.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:i}}toUTC(e=0,t={}){return this.setZone(ls.instance(e),t)}toLocal(){return this.setZone(_r.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if(e=vu(e,_r.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(t||n){let o=e.offset(this.ts),s=this.toObject();[i]=KT(s,o,e)}return Ud(this,{ts:i,zone:e})}else return r.invalid(WT(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){let i=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return Ud(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let t=tS(e,xU),n=!yt(t.weekYear)||!yt(t.weekNumber)||!yt(t.weekday),i=!yt(t.ordinal),o=!yt(t.year),s=!yt(t.month)||!yt(t.day),a=o||s,l=t.weekYear||t.weekNumber;if((a||i)&&l)throw new zd("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(s&&i)throw new zd("Can't mix ordinal dates with month/day");let c;n?c=yU({...h0(this.c),...t}):yt(t.ordinal)?(c={...this.toObject(),...t},yt(t.day)&&(c.day=Math.min(JT(c.year,c.month),c.day))):c=bU({...ZF(this.c),...t});let[u,d]=KT(c,this.o,this.zone);return Ud(this,{ts:u,o:d})}plus(e){if(!this.isValid)return this;let t=Ue.fromDurationLike(e);return Ud(this,CU(this,t))}minus(e){if(!this.isValid)return this;let t=Ue.fromDurationLike(e).negate();return Ud(this,CU(this,t))}startOf(e){if(!this.isValid)return this;let t={},n=Ue.normalizeUnit(e);switch(n){case"years":t.month=1;case"quarters":case"months":t.day=1;case"weeks":case"days":t.hour=0;case"hours":t.minute=0;case"minutes":t.second=0;case"seconds":t.millisecond=0;break}if(n==="weeks"&&(t.weekday=1),n==="quarters"){let i=Math.ceil(this.month/3);t.month=(i-1)*3+1}return this.set(t)}endOf(e){return this.isValid?this.plus({[e]:1}).startOf(e).minus(1):this}toFormat(e,t={}){return this.isValid?_o.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):JF}toLocaleString(e=XT,t={}){return this.isValid?_o.create(this.loc.clone(t),e).formatDateTime(this):JF}toLocaleParts(e={}){return this.isValid?_o.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:i=!0,extendedZone:o=!1}={}){if(!this.isValid)return null;let s=e==="extended",a=t0(this,s);return a+="T",a+=EU(this,s,t,n,i,o),a}toISODate({format:e="extended"}={}){return this.isValid?t0(this,e==="extended"):null}toISOWeekDate(){return GT(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:i=!1,extendedZone:o=!1,format:s="extended"}={}){return this.isValid?(i?"T":"")+EU(this,s==="extended",t,e,n,o):null}toRFC2822(){return GT(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return GT(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?t0(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let i="HH:mm:ss.SSS";return(t||e)&&(n&&(i+=" "),t?i+="z":e&&(i+="ZZ")),GT(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():JF}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",n={}){if(!this.isValid||!e.isValid)return Ue.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...n},o=Lee(t).map(Ue.normalizeUnit),s=e.valueOf()>this.valueOf(),a=s?this:e,l=s?e:this,c=qte(a,l,o,i);return s?c.negate():c}diffNow(e="milliseconds",t={}){return this.diff(r.now(),e,t)}until(e){return this.isValid?Wm.fromDateTimes(this,e):this}hasSame(e,t){if(!this.isValid)return!1;let n=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t)<=n&&n<=i.endOf(t)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let t=e.base||r.fromObject({},{zone:this.zone}),n=e.padding?thist.valueOf(),Math.min)}static max(...e){if(!e.every(r.isDateTime))throw new to("max requires all arguments be DateTimes");return cU(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){let{locale:i=null,numberingSystem:o=null}=n,s=kr.fromOpts({locale:i,numberingSystem:o,defaultToEN:!0});return yz(s,e,t)}static fromStringExplain(e,t,n={}){return r.fromFormatExplain(e,t,n)}static get DATE_SHORT(){return XT}static get DATE_MED(){return PU}static get DATE_MED_WITH_WEEKDAY(){return wee}static get DATE_FULL(){return $U}static get DATE_HUGE(){return MU}static get TIME_SIMPLE(){return OU}static get TIME_WITH_SECONDS(){return RU}static get TIME_WITH_SHORT_OFFSET(){return LU}static get TIME_WITH_LONG_OFFSET(){return NU}static get TIME_24_SIMPLE(){return BU}static get TIME_24_WITH_SECONDS(){return VU}static get TIME_24_WITH_SHORT_OFFSET(){return qU}static get TIME_24_WITH_LONG_OFFSET(){return UU}static get DATETIME_SHORT(){return zU}static get DATETIME_SHORT_WITH_SECONDS(){return HU}static get DATETIME_MED(){return WU}static get DATETIME_MED_WITH_SECONDS(){return jU}static get DATETIME_MED_WITH_WEEKDAY(){return Cee}static get DATETIME_FULL(){return GU}static get DATETIME_FULL_WITH_SECONDS(){return YU}static get DATETIME_HUGE(){return KU}static get DATETIME_HUGE_WITH_SECONDS(){return QU}};function Xy(r){if(ft.isDateTime(r))return r;if(r&&r.valueOf&&Wd(r.valueOf()))return ft.fromJSDate(r);if(r&&typeof r=="object")return ft.fromObject(r);throw new to(`Unknown datetime argument: ${r}, of type ${typeof r}`)}var D0={renderNullAs:"\\-",taskCompletionTracking:!1,taskCompletionUseEmojiShorthand:!1,taskCompletionText:"completion",taskCompletionDateFormat:"yyyy-MM-dd",recursiveSubTaskCompletion:!1,warnOnEmptyResult:!0,refreshEnabled:!0,refreshInterval:2500,defaultDateFormat:"MMMM dd, yyyy",defaultDateTimeFormat:"h:mm a - MMMM dd, yyyy",maxRecursiveRenderDepth:4,tableIdColumnName:"File",tableGroupColumnName:"Group",showResultCount:!0},cre={allowHtml:!0};({...D0,...cre});var g0=class r{constructor(e){pe(this,"value");pe(this,"successful");this.value=e,this.successful=!0}map(e){return new r(e(this.value))}flatMap(e){return e(this.value)}mapErr(e){return this}bimap(e,t){return this.map(e)}orElse(e){return this.value}cast(){return this}orElseThrow(e){return this.value}},v0=class r{constructor(e){pe(this,"error");pe(this,"successful");this.error=e,this.successful=!1}map(e){return this}flatMap(e){return this}mapErr(e){return new r(e(this.error))}bimap(e,t){return this.mapErr(t)}orElse(e){return e}cast(){return this}orElseThrow(e){throw e?new Error(e(this.error)):new Error(""+this.error)}},rS;(function(r){function e(o){return new g0(o)}r.success=e;function t(o){return new v0(o)}r.failure=t;function n(o,s,a){return o.successful?s.successful?a(o.value,s.value):t(s.error):t(o.error)}r.flatMap2=n;function i(o,s,a){return n(o,s,(l,c)=>e(a(l,c)))}r.map2=i})(rS||(rS={}));var ure=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},nS={exports:{}};nS.exports;(function(r,e){(function(t,n){r.exports=n()})(typeof self<"u"?self:ure,function(){return(function(t){var n={};function i(o){if(n[o])return n[o].exports;var s=n[o]={i:o,l:!1,exports:{}};return t[o].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=n,i.d=function(o,s,a){i.o(o,s)||Object.defineProperty(o,s,{configurable:!1,enumerable:!0,get:a})},i.r=function(o){Object.defineProperty(o,"__esModule",{value:!0})},i.n=function(o){var s=o&&o.__esModule?function(){return o.default}:function(){return o};return i.d(s,"a",s),s},i.o=function(o,s){return Object.prototype.hasOwnProperty.call(o,s)},i.p="",i(i.s=0)})([function(t,n,i){function o(x){if(!(this instanceof o))return new o(x);this._=x}var s=o.prototype;function a(x,A){for(var N=0;N>7),buf:(function(Z){var se=l(function(de,Me,it,ur){return de.concat(it===ur.length-1?Buffer.from([Me,0]).readUInt16BE(0):ur.readUInt16BE(it))},[],Z);return Buffer.from(c(function(de){return(de<<1&65535)>>8},se))})(N.buf)}}),N}function d(){return typeof Buffer<"u"}function f(){if(!d())throw new Error("Buffer global does not exist; please use webpack if you need to parse Buffers in the browser.")}function p(x){f();var A=l(function(se,de){return se+de},0,x);if(A%8!=0)throw new Error("The bits ["+x.join(", ")+"] add up to "+A+" which is not an even number of bytes; the total should be divisible by 8");var N,K=A/8,Z=(N=function(se){return se>48},l(function(se,de){return se||(N(de)?de:se)},null,x));if(Z)throw new Error(Z+" bit range requested exceeds 48 bit (6 byte) Number max.");return new o(function(se,de){var Me=K+de;return Me>se.length?I(de,K.toString()+" bytes"):_(Me,l(function(it,ur){var $t=u(ur,it.buf);return{coll:it.coll.concat($t.v),buf:$t.buf}},{coll:[],buf:se.slice(de,Me)},x).coll)})}function m(x,A){return new o(function(N,K){return f(),K+A>N.length?I(K,A+" bytes for "+x):_(K+A,N.slice(K,K+A))})}function v(x,A){if(typeof(N=A)!="number"||Math.floor(N)!==N||A<0||A>6)throw new Error(x+" requires integer length in range [0, 6].");var N}function g(x){return v("uintBE",x),m("uintBE("+x+")",x).map(function(A){return A.readUIntBE(0,x)})}function y(x){return v("uintLE",x),m("uintLE("+x+")",x).map(function(A){return A.readUIntLE(0,x)})}function w(x){return v("intBE",x),m("intBE("+x+")",x).map(function(A){return A.readIntBE(0,x)})}function T(x){return v("intLE",x),m("intLE("+x+")",x).map(function(A){return A.readIntLE(0,x)})}function b(x){return x instanceof o}function E(x){return{}.toString.call(x)==="[object Array]"}function C(x){return d()&&Buffer.isBuffer(x)}function _(x,A){return{status:!0,index:x,value:A,furthest:-1,expected:[]}}function I(x,A){return E(A)||(A=[A]),{status:!1,index:-1,value:null,furthest:x,expected:A}}function q(x,A){if(!A||x.furthest>A.furthest)return x;var N=x.furthest===A.furthest?(function(K,Z){if((function(){if(o._supportsSet!==void 0)return o._supportsSet;var Yt=typeof Set<"u";return o._supportsSet=Yt,Yt})()&&Array.from){for(var se=new Set(K),de=0;de=0;){if(de in N){K=N[de].line,se===0&&(se=N[de].lineStart);break}(x.charAt(de)===` `||x.charAt(de)==="\r"&&x.charAt(de+1)!==` `)&&(Z++,se===0&&(se=de+1)),de--}var Me=K+Z,it=A-se;return N[A]={line:Me,lineStart:se},{offset:A,line:Me+1,column:it+1}}function re(x){if(!b(x))throw new Error("not a parser: "+x)}function L(x,A){return typeof x=="string"?x.charAt(A):x[A]}function W(x){if(typeof x!="number")throw new Error("not a number: "+x)}function j(x){if(typeof x!="function")throw new Error("not a function: "+x)}function $(x){if(typeof x!="string")throw new Error("not a string: "+x)}var G=2,U=3,H=8,Y=5*H,ie=4*H,oe=" ";function ce(x,A){return new Array(A+1).join(x)}function he(x,A,N){var K=A-x.length;return K<=0?x:ce(N,K)+x}function Ie(x,A,N,K){return{from:x-A>0?x-A:0,to:x+N>K?K:x+N}}function we(x,A){var N,K,Z,se,de,Me=A.index,it=Me.offset,ur=1;if(it===x.length)return"Got the end of the input";if(C(x)){var $t=it-it%H,ri=it-$t,ot=Ie($t,Y,ie+H,x.length),Yt=c(function(mt){return c(function(qi){return he(qi.toString(16),2,"0")},mt)},(function(mt,qi){var hs=mt.length,Po=[],Nr=0;if(hs<=qi)return[mt.slice()];for(var Qr=0;Qr=4&&(N+=1),ur=2,Z=c(function(mt){return mt.length<=4?mt.join(" "):mt.slice(0,4).join(" ")+" "+mt.slice(4).join(" ")},Yt),(de=(8*(se.to>0?se.to-1:se.to)).toString(16).length)<2&&(de=2)}else{var or=x.split(/\r\n|[\n\r\u2028\u2029]/);N=Me.column-1,K=Me.line-1,se=Ie(K,G,U,or.length),Z=or.slice(se.from,se.to),de=se.to.toString().length}var yn=K-se.from;return C(x)&&(de=(8*(se.to>0?se.to-1:se.to)).toString(16).length)<2&&(de=2),l(function(mt,qi,hs){var Po,Nr=hs===yn,Qr=Nr?"> ":oe;return Po=C(x)?he((8*(se.from+hs)).toString(16),de,"0"):he((se.from+hs+1).toString(),de," "),[].concat(mt,[Qr+Po+" | "+qi],Nr?[oe+ce(" ",de)+" | "+he("",N," ")+ce("^",ur)]:[])},[],Z).join(` `)}function Ge(x,A){return[` `,"-- PARSING FAILED "+ce("-",50),` `,we(x,A),` `,(N=A.expected,N.length===1?`Expected: `+N[0]:`Expected one of the following: `+N.join(", ")),` `].join("");var N}function Pe(x){return x.flags!==void 0?x.flags:[x.global?"g":"",x.ignoreCase?"i":"",x.multiline?"m":"",x.unicode?"u":"",x.sticky?"y":""].join("")}function Ve(){for(var x=[].slice.call(arguments),A=x.length,N=0;N=2?W(A):A=0;var N=(function(Z){return RegExp("^(?:"+Z.source+")",Pe(Z))})(x),K=""+x;return o(function(Z,se){var de=N.exec(Z.slice(se));if(de){if(0<=A&&A<=de.length){var Me=de[0],it=de[A];return _(se+Me.length,it)}return I(se,"valid match group (0 to "+de.length+") in "+K)}return I(se,K)})}function xe(x){return o(function(A,N){return _(N,x)})}function tt(x){return o(function(A,N){return I(N,x)})}function kt(x){if(b(x))return o(function(A,N){var K=x._(A,N);return K.index=N,K.value="",K});if(typeof x=="string")return kt($e(x));if(x instanceof RegExp)return kt(ge(x));throw new Error("not a string, regexp, or parser: "+x)}function Pt(x){return re(x),o(function(A,N){var K=x._(A,N),Z=A.slice(N,K.index);return K.status?I(N,'not "'+Z+'"'):_(N,null)})}function gt(x){return j(x),o(function(A,N){var K=L(A,N);return N=x.length?I(A,"any character/byte"):_(A+1,L(x,A))}),cr=o(function(x,A){return _(x.length,x.slice(A))}),ti=o(function(x,A){return A=0}).desc(A)},o.optWhitespace=Gt,o.Parser=o,o.range=function(x,A){return gt(function(N){return x<=N&&N<=A}).desc(x+"-"+A)},o.regex=ge,o.regexp=ge,o.sepBy=_t,o.sepBy1=ye,o.seq=Ve,o.seqMap=qe,o.seqObj=function(){for(var x,A={},N=0,K=(x=arguments,Array.prototype.slice.call(x)),Z=K.length,se=0;se255)throw new Error("Value specified to byte constructor ("+x+"=0x"+x.toString(16)+") is larger in value than a single byte.");var A=(x>15?"0x":"0x0")+x.toString(16);return o(function(N,K){var Z=L(N,K);return Z===x?_(K+1,Z):I(K,A)})},buffer:function(x){return m("buffer",x).map(function(A){return Buffer.from(A)})},encodedString:function(x,A){return m("string",A).map(function(N){return N.toString(x)})},uintBE:g,uint8BE:g(1),uint16BE:g(2),uint32BE:g(4),uintLE:y,uint8LE:y(1),uint16LE:y(2),uint32LE:y(4),intBE:w,int8BE:w(1),int16BE:w(2),int32BE:w(4),intLE:T,int8LE:T(1),int16LE:T(2),int32LE:T(4),floatBE:m("floatBE",4).map(function(x){return x.readFloatBE(0)}),floatLE:m("floatLE",4).map(function(x){return x.readFloatLE(0)}),doubleBE:m("doubleBE",8).map(function(x){return x.readDoubleBE(0)}),doubleLE:m("doubleLE",8).map(function(x){return x.readDoubleLE(0)})},t.exports=o}])})})(nS,nS.exports);var R=nS.exports,I0=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;function Iz(r){return r==null?r:r.shiftToAll().normalize()}function kU(r){return r.includes("/")&&(r=r.substring(r.lastIndexOf("/")+1)),r.endsWith(".md")&&(r=r.substring(0,r.length-3)),r}R.alt(R.regex(new RegExp(I0(),"")),R.regex(/[0-9\p{Letter}_-]+/u).map(r=>r.toLocaleLowerCase()),R.whitespace.map(r=>"-"),R.any.map(r=>"")).many().map(r=>r.join(""));var dre=R.alt(R.regex(new RegExp(I0(),"")),R.regex(/[0-9\p{Letter}_-]+/u),R.whitespace.map(r=>" "),R.any.map(r=>" ")).many().map(r=>r.join("").split(/\s+/).join(" ").trim());function pre(r){return dre.tryParse(r)}function fre(r){return r=Iz(r),r=Ue.fromObject(Object.fromEntries(Object.entries(r.toObject()).filter(([,e])=>e!=0))),r.toHuman()}var rb;(function(r){function e(b,E=D0,C=!1){let _=t(b);if(!_)return E.renderNullAs;switch(_.type){case"null":return E.renderNullAs;case"string":return _.value;case"number":case"boolean":return""+_.value;case"html":return _.value.outerHTML;case"widget":return _.value.markdown();case"link":return _.value.markdown();case"function":return"";case"array":let I="";return C&&(I+="["),I+=_.value.map(q=>e(q,E,!0)).join(", "),C&&(I+="]"),I;case"object":return"{ "+Object.entries(_.value).map(q=>q[0]+": "+e(q[1],E,!0)).join(", ")+" }";case"date":return _.value.second==0&&_.value.hour==0&&_.value.minute==0?_.value.toFormat(E.defaultDateFormat):_.value.toFormat(E.defaultDateTimeFormat);case"duration":return fre(_.value)}}r.toString=e;function t(b){return f(b)?{type:"null",value:b}:c(b)?{type:"number",value:b}:l(b)?{type:"string",value:b}:m(b)?{type:"boolean",value:b}:d(b)?{type:"duration",value:b}:u(b)?{type:"date",value:b}:g(b)?{type:"widget",value:b}:p(b)?{type:"array",value:b}:v(b)?{type:"link",value:b}:T(b)?{type:"function",value:b}:y(b)?{type:"html",value:b}:w(b)?{type:"object",value:b}:void 0}r.wrapValue=t;function n(b,E){if(w(b)){let C={};for(let[_,I]of Object.entries(b))C[_]=n(I,E);return C}else if(p(b)){let C=[];for(let _ of b)C.push(n(_,E));return C}else return E(b)}r.mapLeaves=n;function i(b,E,C){if(b===void 0&&(b=null),E===void 0&&(E=null),b===null&&E===null)return 0;if(b===null)return-1;if(E===null)return 1;let _=t(b),I=t(E);if(_===void 0&&I===void 0)return 0;if(_===void 0)return-1;if(I===void 0)return 1;if(_.type!=I.type)return _.type.localeCompare(I.type);if(_.value===I.value)return 0;switch(_.type){case"string":return _.value.localeCompare(I.value);case"number":return _.valueie),re=J(q.path).localeCompare(J(B.path));if(re!=0)return re;let L=q.type.localeCompare(B.type);return L!=0?L:q.subpath&&!B.subpath?1:!q.subpath&&B.subpath?-1:!q.subpath&&!B.subpath?0:(q.subpath??"").localeCompare(B.subpath??"");case"date":return _.value0;case"boolean":return E.value;case"link":return!!E.value.path;case"date":return E.value.toMillis()!=0;case"duration":return E.value.as("seconds")!=0;case"object":return Object.keys(E.value).length>0;case"array":return E.value.length>0;case"null":return!1;case"html":case"widget":case"function":return!0}}r.isTruthy=s;function a(b){if(b==null)return b;if(r.isArray(b))return[].concat(b.map(E=>a(E)));if(r.isObject(b)){let E={};for(let[C,_]of Object.entries(b))E[C]=a(_);return E}else return b}r.deepCopy=a;function l(b){return typeof b=="string"}r.isString=l;function c(b){return typeof b=="number"}r.isNumber=c;function u(b){return b instanceof ft}r.isDate=u;function d(b){return b instanceof Ue}r.isDuration=d;function f(b){return b==null}r.isNull=f;function p(b){return Array.isArray(b)}r.isArray=p;function m(b){return typeof b=="boolean"}r.isBoolean=m;function v(b){return b instanceof iS}r.isLink=v;function g(b){return b instanceof nb}r.isWidget=g;function y(b){return typeof HTMLElement<"u"?b instanceof HTMLElement:!1}r.isHtml=y;function w(b){return typeof b=="object"&&!y(b)&&!g(b)&&!p(b)&&!d(b)&&!u(b)&&!v(b)&&b!==void 0&&!f(b)}r.isObject=w;function T(b){return typeof b=="function"}r.isFunction=T})(rb||(rb={}));var AU;(function(r){function e(i){return rb.isObject(i)&&Object.keys(i).length==2&&"key"in i&&"rows"in i}r.isElementGroup=e;function t(i){for(let o of i)if(!e(o))return!1;return!0}r.isGrouping=t;function n(i){if(t(i)){let o=0;for(let s of i)o+=n(s.rows);return o}else return i.length}r.count=n})(AU||(AU={}));var iS=class r{constructor(e){pe(this,"path");pe(this,"display");pe(this,"subpath");pe(this,"embed");pe(this,"type");Object.assign(this,e)}static file(e,t=!1,n){return new r({path:e,embed:t,display:n,subpath:void 0,type:"file"})}static infer(e,t=!1,n){if(e.includes("#^")){let i=e.split("#^");return r.block(i[0],i[1],t,n)}else if(e.includes("#")){let i=e.split("#");return r.header(i[0],i[1],t,n)}else return r.file(e,t,n)}static header(e,t,n,i){return new r({path:e,embed:n,display:i,subpath:pre(t),type:"header"})}static block(e,t,n,i){return new r({path:e,embed:n,display:i,subpath:t,type:"block"})}static fromObject(e){return new r(e)}equals(e){return e==null||e==null?!1:this.path==e.path&&this.type==e.type&&this.subpath==e.subpath}toString(){return this.markdown()}toObject(){return{path:this.path,type:this.type,subpath:this.subpath,display:this.display,embed:this.embed}}withPath(e){return new r(Object.assign({},this,{path:e}))}withDisplay(e){return new r(Object.assign({},this,{display:e}))}withHeader(e){return r.header(this.path,e,this.embed,this.display)}toFile(){return r.file(this.path,this.embed,this.display)}toEmbed(){if(this.embed)return this;{let e=new r(this);return e.embed=!0,e}}fromEmbed(){if(this.embed){let e=new r(this);return e.embed=!1,e}else return this}markdown(){let e=(this.embed?"!":"")+"[["+this.obsidianLink();return this.display?e+="|"+this.display:(e+="|"+kU(this.path),(this.type=="header"||this.type=="block")&&(e+=" > "+this.subpath)),e+="]]",e}obsidianLink(){let e=this.path.replaceAll("|","\\|");return this.type=="header"?e+"#"+this.subpath?.replaceAll("|","\\|"):this.type=="block"?e+"#^"+this.subpath?.replaceAll("|","\\|"):e}fileName(){return kU(this.path).replace(".md","")}},nb=class{constructor(e){pe(this,"$widget");this.$widget=e}},y0=class extends nb{constructor(t,n){super("dataview:list-pair");pe(this,"key");pe(this,"value");this.key=t,this.value=n}markdown(){return`${rb.toString(this.key)}: ${rb.toString(this.value)}`}},b0=class extends nb{constructor(t,n){super("dataview:external-link");pe(this,"url");pe(this,"display");this.url=t,this.display=n}markdown(){return`[${this.display??this.url}](${this.url})`}},DU;(function(r){function e(s,a){return new y0(s,a)}r.listPair=e;function t(s,a){return new b0(s,a)}r.externalLink=t;function n(s){return s.$widget==="dataview:list-pair"}r.isListPair=n;function i(s){return s.$widget==="dataview:external-link"}r.isExternalLink=i;function o(s){return n(s)||i(s)}r.isBuiltin=o})(DU||(DU={}));var Sr;(function(r){function e(f){return{type:"variable",name:f}}r.variable=e;function t(f){return{type:"literal",value:f}}r.literal=t;function n(f,p,m){return{type:"binaryop",left:f,op:p,right:m}}r.binaryOp=n;function i(f,p){return{type:"index",object:f,index:p}}r.index=i;function o(f){let p=f.split("."),m=r.variable(p[0]);for(let v=1;v"||f==">="||f=="!="||f=="="}r.isCompareOp=d,r.NULL=r.literal(null)})(Sr||(Sr={}));var za;(function(r){function e(u){return{type:"tag",tag:u}}r.tag=e;function t(u){return{type:"csv",path:u}}r.csv=t;function n(u){return{type:"folder",folder:u}}r.folder=n;function i(u,d){return{type:"link",file:u,direction:d?"incoming":"outgoing"}}r.link=i;function o(u,d,f){return{type:"binaryop",left:u,op:d,right:f}}r.binaryOp=o;function s(u,d){return{type:"binaryop",left:u,op:"&",right:d}}r.and=s;function a(u,d){return{type:"binaryop",left:u,op:"|",right:d}}r.or=a;function l(u){return{type:"negate",child:u}}r.negate=l;function c(){return{type:"empty"}}r.empty=c})(za||(za={}));var IU=new RegExp(I0(),""),w0={year:Ue.fromObject({years:1}),years:Ue.fromObject({years:1}),yr:Ue.fromObject({years:1}),yrs:Ue.fromObject({years:1}),month:Ue.fromObject({months:1}),months:Ue.fromObject({months:1}),mo:Ue.fromObject({months:1}),mos:Ue.fromObject({months:1}),week:Ue.fromObject({weeks:1}),weeks:Ue.fromObject({weeks:1}),wk:Ue.fromObject({weeks:1}),wks:Ue.fromObject({weeks:1}),w:Ue.fromObject({weeks:1}),day:Ue.fromObject({days:1}),days:Ue.fromObject({days:1}),d:Ue.fromObject({days:1}),hour:Ue.fromObject({hours:1}),hours:Ue.fromObject({hours:1}),hr:Ue.fromObject({hours:1}),hrs:Ue.fromObject({hours:1}),h:Ue.fromObject({hours:1}),minute:Ue.fromObject({minutes:1}),minutes:Ue.fromObject({minutes:1}),min:Ue.fromObject({minutes:1}),mins:Ue.fromObject({minutes:1}),m:Ue.fromObject({minutes:1}),second:Ue.fromObject({seconds:1}),seconds:Ue.fromObject({seconds:1}),sec:Ue.fromObject({seconds:1}),secs:Ue.fromObject({seconds:1}),s:Ue.fromObject({seconds:1})},C0={now:()=>ft.local(),today:()=>ft.local().startOf("day"),yesterday:()=>ft.local().startOf("day").minus(Ue.fromObject({days:1})),tomorrow:()=>ft.local().startOf("day").plus(Ue.fromObject({days:1})),sow:()=>ft.local().startOf("week"),"start-of-week":()=>ft.local().startOf("week"),eow:()=>ft.local().endOf("week"),"end-of-week":()=>ft.local().endOf("week"),soy:()=>ft.local().startOf("year"),"start-of-year":()=>ft.local().startOf("year"),eoy:()=>ft.local().endOf("year"),"end-of-year":()=>ft.local().endOf("year"),som:()=>ft.local().startOf("month"),"start-of-month":()=>ft.local().startOf("month"),eom:()=>ft.local().endOf("month"),"end-of-month":()=>ft.local().endOf("month")},E0=["FROM","WHERE","LIMIT","GROUP","FLATTEN"];function mre(r){let e=-1;for(;(e=r.indexOf("|",e+1))>=0;)if(!(e>0&&r[e-1]=="\\"))return[r.substring(0,e).replace(/\\\|/g,"|"),r.substring(e+1)];return[r.replace(/\\\|/g,"|"),void 0]}function hre(r){let[e,t]=mre(r);return iS.infer(e,!1,t)}function Zy(r,e,t){return R.seqMap(r,R.seq(R.optWhitespace,e,R.optWhitespace,r).many(),(n,i)=>{if(i.length==0)return n;let o=t(n,i[0][1],i[0][3]);for(let s=1;s(i,o)=>{let s=r._(i,o);if(!s.status)return s;for(let a of e){let l=a(s.value)._(i,s.index);if(!l.status)return s;s=l}return s})}var Js=R.createLanguage({number:r=>R.regexp(/-?[0-9]+(\.[0-9]+)?/).map(e=>Number.parseFloat(e)).desc("number"),string:r=>R.string('"').then(R.alt(r.escapeCharacter,R.noneOf('"\\')).atLeast(0).map(e=>e.join(""))).skip(R.string('"')).desc("string"),escapeCharacter:r=>R.string("\\").then(R.any).map(e=>e==='"'?'"':e==="\\"?"\\":"\\"+e),bool:r=>R.regexp(/true|false|True|False/).map(e=>e.toLowerCase()=="true").desc("boolean ('true' or 'false')"),tag:r=>R.seqMap(R.string("#"),R.alt(R.regexp(/[^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~\[\]\\\s]/).desc("text")).many(),(e,t)=>e+t.join("")).desc("tag ('#hello/stuff')"),identifier:r=>R.seqMap(R.alt(R.regexp(/\p{Letter}/u),R.regexp(IU).desc("text")),R.alt(R.regexp(/[0-9\p{Letter}_-]/u),R.regexp(IU).desc("text")).many(),(e,t)=>e+t.join("")).desc("variable identifier"),link:r=>R.regexp(/\[\[([^\[\]]*?)\]\]/u,1).map(e=>hre(e)).desc("file link"),embedLink:r=>R.seqMap(R.string("!").atMost(1),r.link,(e,t)=>(e.length>0&&(t.embed=!0),t)).desc("file link"),binaryPlusMinus:r=>R.regexp(/\+|-/).map(e=>e).desc("'+' or '-'"),binaryMulDiv:r=>R.regexp(/\*|\/|%/).map(e=>e).desc("'*' or '/' or '%'"),binaryCompareOp:r=>R.regexp(/>=|<=|!=|>|<|=/).map(e=>e).desc("'>=' or '<=' or '!=' or '=' or '>' or '<'"),binaryBooleanOp:r=>R.regexp(/and|or|&|\|/i).map(e=>e.toLowerCase()=="and"?"&":e.toLowerCase()=="or"?"|":e).desc("'and' or 'or'"),rootDate:r=>R.seqMap(R.regexp(/\d{4}/),R.string("-"),R.regexp(/\d{2}/),(e,t,n)=>ft.fromObject({year:Number.parseInt(e),month:Number.parseInt(n)})).desc("date in format YYYY-MM[-DDTHH-MM-SS.MS]"),dateShorthand:r=>R.alt(...Object.keys(C0).sort((e,t)=>t.length-e.length).map(R.string)),date:r=>gre(r.rootDate,e=>R.seqMap(R.string("-"),R.regexp(/\d{2}/),(t,n)=>e.set({day:Number.parseInt(n)})),e=>R.seqMap(R.string("T"),R.regexp(/\d{2}/),(t,n)=>e.set({hour:Number.parseInt(n)})),e=>R.seqMap(R.string(":"),R.regexp(/\d{2}/),(t,n)=>e.set({minute:Number.parseInt(n)})),e=>R.seqMap(R.string(":"),R.regexp(/\d{2}/),(t,n)=>e.set({second:Number.parseInt(n)})),e=>R.alt(R.seqMap(R.string("."),R.regexp(/\d{3}/),(t,n)=>e.set({millisecond:Number.parseInt(n)})),R.succeed(e)),e=>R.alt(R.seqMap(R.string("+").or(R.string("-")),R.regexp(/\d{1,2}(:\d{2})?/),(t,n)=>e.setZone("UTC"+t+n,{keepLocalTime:!0})),R.seqMap(R.string("Z"),()=>e.setZone("utc",{keepLocalTime:!0})),R.seqMap(R.string("["),R.regexp(/[0-9A-Za-z+-\/]+/u),R.string("]"),(t,n,i)=>e.setZone(n,{keepLocalTime:!0})))).assert(e=>e.isValid,"valid date").desc("date in format YYYY-MM[-DDTHH-MM-SS.MS]"),datePlus:r=>R.alt(r.dateShorthand.map(e=>C0[e]()),r.date).desc("date in format YYYY-MM[-DDTHH-MM-SS.MS] or in shorthand"),durationType:r=>R.alt(...Object.keys(w0).sort((e,t)=>t.length-e.length).map(R.string)),duration:r=>R.seqMap(r.number,R.optWhitespace,r.durationType,(e,t,n)=>w0[n].mapUnits(i=>i*e)).sepBy1(R.string(",").trim(R.optWhitespace).or(R.optWhitespace)).map(e=>e.reduce((t,n)=>t.plus(n))).desc("duration like 4hr2min"),rawNull:r=>R.string("null"),tagSource:r=>r.tag.map(e=>za.tag(e)),csvSource:r=>R.seqMap(R.string("csv(").skip(R.optWhitespace),r.string,R.string(")"),(e,t,n)=>za.csv(t)),linkIncomingSource:r=>r.link.map(e=>za.link(e.path,!0)),linkOutgoingSource:r=>R.seqMap(R.string("outgoing(").skip(R.optWhitespace),r.link,R.string(")"),(e,t,n)=>za.link(t.path,!1)),folderSource:r=>r.string.map(e=>za.folder(e)),parensSource:r=>R.seqMap(R.string("("),R.optWhitespace,r.source,R.optWhitespace,R.string(")"),(e,t,n,i,o)=>n),negateSource:r=>R.seqMap(R.alt(R.string("-"),R.string("!")),r.atomSource,(e,t)=>za.negate(t)),atomSource:r=>R.alt(r.parensSource,r.negateSource,r.linkOutgoingSource,r.linkIncomingSource,r.folderSource,r.tagSource,r.csvSource),binaryOpSource:r=>Zy(r.atomSource,r.binaryBooleanOp.map(e=>e),za.binaryOp),source:r=>r.binaryOpSource,variableField:r=>r.identifier.chain(e=>E0.includes(e.toUpperCase())?R.fail("Variable fields cannot be a keyword ("+E0.join(" or ")+")"):R.succeed(Sr.variable(e))).desc("variable"),numberField:r=>r.number.map(e=>Sr.literal(e)).desc("number"),stringField:r=>r.string.map(e=>Sr.literal(e)).desc("string"),boolField:r=>r.bool.map(e=>Sr.literal(e)).desc("boolean"),dateField:r=>R.seqMap(R.string("date("),R.optWhitespace,r.datePlus,R.optWhitespace,R.string(")"),(e,t,n,i,o)=>Sr.literal(n)).desc("date"),durationField:r=>R.seqMap(R.string("dur("),R.optWhitespace,r.duration,R.optWhitespace,R.string(")"),(e,t,n,i,o)=>Sr.literal(n)).desc("duration"),nullField:r=>r.rawNull.map(e=>Sr.NULL),linkField:r=>r.link.map(e=>Sr.literal(e)),listField:r=>r.field.sepBy(R.string(",").trim(R.optWhitespace)).wrap(R.string("[").skip(R.optWhitespace),R.optWhitespace.then(R.string("]"))).map(e=>Sr.list(e)).desc("list ('[1, 2, 3]')"),objectField:r=>R.seqMap(r.identifier.or(r.string),R.string(":").trim(R.optWhitespace),r.field,(e,t,n)=>({name:e,value:n})).sepBy(R.string(",").trim(R.optWhitespace)).wrap(R.string("{").skip(R.optWhitespace),R.optWhitespace.then(R.string("}"))).map(e=>{let t={};for(let n of e)t[n.name]=n.value;return Sr.object(t)}).desc("object ('{ a: 1, b: 2 }')"),atomInlineField:r=>R.alt(r.date,r.duration.map(e=>Iz(e)),r.string,r.tag,r.embedLink,r.bool,r.number,r.rawNull),inlineFieldList:r=>r.atomInlineField.sepBy(R.string(",").trim(R.optWhitespace).lookahead(r.atomInlineField)),inlineField:r=>R.alt(R.seqMap(r.atomInlineField,R.string(",").trim(R.optWhitespace),r.inlineFieldList,(e,t,n)=>[e].concat(n)),r.atomInlineField),atomField:r=>R.alt(r.embedLink.map(e=>Sr.literal(e)),r.negatedField,r.linkField,r.listField,r.objectField,r.lambdaField,r.parensField,r.boolField,r.numberField,r.stringField,r.dateField,r.durationField,r.nullField,r.variableField),indexField:r=>R.seqMap(r.atomField,R.alt(r.dotPostfix,r.indexPostfix,r.functionPostfix).many(),(e,t)=>{let n=e;for(let i of t)switch(i.type){case"dot":n=Sr.index(n,Sr.literal(i.field));break;case"index":n=Sr.index(n,i.field);break;case"function":n=Sr.func(n,i.fields);break}return n}),negatedField:r=>R.seqMap(R.string("!"),r.indexField,(e,t)=>Sr.negate(t)).desc("negated field"),parensField:r=>R.seqMap(R.string("("),R.optWhitespace,r.field,R.optWhitespace,R.string(")"),(e,t,n,i,o)=>n),lambdaField:r=>R.seqMap(r.identifier.sepBy(R.string(",").trim(R.optWhitespace)).wrap(R.string("(").trim(R.optWhitespace),R.string(")").trim(R.optWhitespace)),R.string("=>").trim(R.optWhitespace),r.field,(e,t,n)=>({type:"lambda",arguments:e,value:n})),dotPostfix:r=>R.seqMap(R.string("."),r.identifier,(e,t)=>({type:"dot",field:t})),indexPostfix:r=>R.seqMap(R.string("["),R.optWhitespace,r.field,R.optWhitespace,R.string("]"),(e,t,n,i,o)=>({type:"index",field:n})),functionPostfix:r=>R.seqMap(R.string("("),R.optWhitespace,r.field.sepBy(R.string(",").trim(R.optWhitespace)),R.optWhitespace,R.string(")"),(e,t,n,i,o)=>({type:"function",fields:n})),binaryMulDivField:r=>Zy(r.indexField,r.binaryMulDiv,Sr.binaryOp),binaryPlusMinusField:r=>Zy(r.binaryMulDivField,r.binaryPlusMinus,Sr.binaryOp),binaryCompareField:r=>Zy(r.binaryPlusMinusField,r.binaryCompareOp,Sr.binaryOp),binaryBooleanField:r=>Zy(r.binaryCompareField,r.binaryBooleanOp,Sr.binaryOp),binaryOpField:r=>r.binaryBooleanField,field:r=>r.binaryOpField});function vre(r){try{return rS.success(Js.field.tryParse(r))}catch(e){return rS.failure(""+e)}}var oS;(function(r){function e(n,i){return{name:n,field:i}}r.named=e;function t(n,i){return{field:n,direction:i}}r.sortBy=t})(oS||(oS={}));function yre(r){return R.custom((e,t)=>(n,i)=>{let o=r._(n,i);return o.status?Object.assign({},o,{value:[o.value,n.substring(i,o.index)]}):o})}function bre(r){return r.split(/[\r\n]+/).map(e=>e.trim()).join("")}function FU(r,e){return R.eof.map(r).or(R.whitespace.then(e))}var Fz=R.createLanguage({queryType:r=>R.alt(R.regexp(/TABLE|LIST|TASK|CALENDAR/i)).map(e=>e.toLowerCase()).desc("query type ('TABLE', 'LIST', 'TASK', or 'CALENDAR')"),explicitNamedField:r=>R.seqMap(Js.field.skip(R.whitespace),R.regexp(/AS/i).skip(R.whitespace),Js.identifier.or(Js.string),(e,t,n)=>oS.named(n,e)),comment:()=>R.Parser((r,e)=>{let t=r.substring(e);if(!t.startsWith("//"))return R.makeFailure(e,"Not a comment");t=t.split(` `)[0];let n=t.substring(2).trim();return R.makeSuccess(e+t.length,n)}),namedField:r=>R.alt(r.explicitNamedField,yre(Js.field).map(([e,t])=>oS.named(bre(t),e))),sortField:r=>R.seqMap(Js.field.skip(R.optWhitespace),R.regexp(/ASCENDING|DESCENDING|ASC|DESC/i).atMost(1),(e,t)=>{let n=t.length==0?"ascending":t[0].toLowerCase();return n=="desc"&&(n="descending"),n=="asc"&&(n="ascending"),{field:e,direction:n}}),headerClause:r=>r.queryType.chain(e=>{switch(e){case"table":return FU(()=>({type:e,fields:[],showId:!0}),R.seqMap(R.regexp(/WITHOUT\s+ID/i).skip(R.optWhitespace).atMost(1),R.sepBy(r.namedField,R.string(",").trim(R.optWhitespace)),(t,n)=>({type:e,fields:n,showId:t.length==0})));case"list":return FU(()=>({type:e,format:void 0,showId:!0}),R.seqMap(R.regexp(/WITHOUT\s+ID/i).skip(R.optWhitespace).atMost(1),Js.field.atMost(1),(t,n)=>({type:e,format:n.length==1?n[0]:void 0,showId:t.length==0})));case"task":return R.succeed({type:e});case"calendar":return R.whitespace.then(R.seqMap(r.namedField,t=>({type:e,showId:!0,field:t})));default:return R.fail(`Unrecognized query type '${e}'`)}}).desc("TABLE or LIST or TASK or CALENDAR"),fromClause:r=>R.seqMap(R.regexp(/FROM/i),R.whitespace,Js.source,(e,t,n)=>n),whereClause:r=>R.seqMap(R.regexp(/WHERE/i),R.whitespace,Js.field,(e,t,n)=>({type:"where",clause:n})).desc("WHERE "),sortByClause:r=>R.seqMap(R.regexp(/SORT/i),R.whitespace,r.sortField.sepBy1(R.string(",").trim(R.optWhitespace)),(e,t,n)=>({type:"sort",fields:n})).desc("SORT field [ASC/DESC]"),limitClause:r=>R.seqMap(R.regexp(/LIMIT/i),R.whitespace,Js.field,(e,t,n)=>({type:"limit",amount:n})).desc("LIMIT "),flattenClause:r=>R.seqMap(R.regexp(/FLATTEN/i).skip(R.whitespace),r.namedField,(e,t)=>({type:"flatten",field:t})).desc("FLATTEN [AS ]"),groupByClause:r=>R.seqMap(R.regexp(/GROUP BY/i).skip(R.whitespace),r.namedField,(e,t)=>({type:"group",field:t})).desc("GROUP BY [AS ]"),clause:r=>R.alt(r.fromClause,r.whereClause,r.sortByClause,r.limitClause,r.groupByClause,r.flattenClause),query:r=>R.seqMap(r.headerClause.trim(r0),r.fromClause.trim(r0).atMost(1),r.clause.trim(r0).many(),(e,t,n)=>({header:e,source:t.length==0?za.folder(""):t[0],operations:n,settings:D0}))}),r0=R.alt(R.whitespace,Fz.comment).many().map(r=>r.join("")),wre=r=>r?r.plugins.plugins.dataview?.api:window.DataviewAPI,Cre=r=>r.plugins.enabledPlugins.has("dataview");Ha.DATE_SHORTHANDS=C0;Ha.DURATION_TYPES=w0;Ha.EXPRESSION=Js;Ha.KEYWORDS=E0;Ha.QUERY_LANGUAGE=Fz;Ha.getAPI=wre;Ha.isPluginEnabled=Cre;Ha.parseField=vre});function ab(r){if(!r.includes(",")){let o=r.trim();return o?[o]:[]}let e=[],t="",n=!1;for(let o=0;o{});function lb(r){return r.replace(/[\\"]/g,"\\$&")}function Ere(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $z(r){return lb(Ere(r))}function uS(r){return typeof r=="object"&&r!==null&&"path"in r&&typeof r.path=="string"}var P0,cb,Mz=k(()=>{P0=QP(Pz());De();F0();cb=class{static getDataviewAPI(e){let t=(0,P0.getAPI)(e);return t||(P.logMessage("Dataview plugin is not installed or enabled"),null)}static async getFieldValues(e,t){let n=new Set,i=this.getDataviewAPI(e);if(!i)return n;try{let s=`field("${lb(t)}")`,a=`TABLE ${s} WHERE ${s}`,l=await i.query(a);if(l.successful&&l.value.values)for(let c of l.value.values){let u=c[1];Array.isArray(u)?u.forEach(d=>{d&&typeof d=="string"?n.add(d.trim()):uS(d)?n.add(d.path):d&&typeof d!="object"&&n.add(String(d).trim())}):uS(u)?n.add(u.path):u&&typeof u=="string"?ab(u).forEach(d=>n.add(d)):u&&typeof u!="object"&&n.add(String(u).trim())}}catch(o){P.logError(new Error(`Failed to query Dataview for field ${t}: ${o}`))}return n}static async getFieldValuesWithFilter(e,t,n={}){let i=new Set,o=this.getDataviewAPI(e);if(!o)return i;try{let a=`field("${lb(t)}")`,l=[a],c=(n.folders?.length?n.folders:n.folder?[n.folder]:[]).map(v=>v.replace(/^\/+|\/+$/g,"")).filter(Boolean);if(c.length>0){let v=c.map(g=>`regexmatch("^${$z(g)}/", file.path)`);l.push(`(${v.join(" OR ")})`)}n.tags&&n.tags.length>0&&n.tags.forEach(v=>{let g=v.startsWith("#")?v:`#${v}`;l.push(`contains(file.tags, "${lb(g)}")`)}),n.excludeFolders&&n.excludeFolders.length>0&&n.excludeFolders.forEach(v=>{let g=v.replace(/^\/+|\/+$/g,"");l.push(`!regexmatch("^${$z(g)}/", file.path)`)}),n.excludeTags&&n.excludeTags.length>0&&n.excludeTags.forEach(v=>{let g=v.startsWith("#")?v:`#${v}`;l.push(`!contains(file.tags, "${lb(g)}")`)});let u=l.join(" AND "),d=`TABLE ${a} WHERE ${u}`,f=await o.query(d),p=n.excludeFiles??[],m=v=>{if(p.length===0)return!1;let g=v[0],y=g&&typeof g.path=="string"?g.path:null;if(!y)return!1;let w=y.split("/").pop()??y;return p.some(T=>T===y||T===w)};if(f.successful&&f.value.values)for(let v of f.value.values){if(m(v))continue;let g=v[1];Array.isArray(g)?g.forEach(y=>{y&&typeof y=="string"?i.add(y.trim()):uS(y)?i.add(y.path):y&&typeof y!="object"&&i.add(String(y).trim())}):uS(g)?i.add(g.path):g&&typeof g=="string"?ab(g).forEach(y=>i.add(y)):g&&typeof g!="object"&&i.add(String(g).trim())}}catch(s){P.logError(new Error(`Failed to query Dataview for field ${t} with filters: ${s}`))}return i}static isAvailable(e){return(0,P0.getAPI)(e)!==null}}});var Gl,dS=k(()=>{Gl=class r{constructor(){this.cache=new Map;this.TTL=300*1e3;this.MAX_CACHE_ENTRIES=100;this.MAX_VALUES_PER_ENTRY=1e3;this.cleanupInterval=null;this.revision=0}static getInstance(){return r.instance||(r.instance=new r),r.instance}startAutomaticCleanup(e){if(this.cleanupInterval===null&&typeof window<"u"){let t=window.setInterval(()=>{this.cleanExpired()},6e4);this.cleanupInterval=e(t)}}registerInvalidationListeners(e,t){let n=()=>this.clear();t(e.metadataCache.on("changed",n)),t(e.metadataCache.on("deleted",n)),t(e.vault.on("rename",n))}get(e,t){let n=this.makeKey(e,t),i=this.cache.get(n);return i?Date.now()-i.timestamp>this.TTL?(this.cache.delete(n),null):new Set(i.values):null}set(e,t,n){let i=this.makeKey(e,n),o=new Set,s=0;for(let a of t){if(s>=this.MAX_VALUES_PER_ENTRY)break;o.add(a),s++}this.cache.size>=this.MAX_CACHE_ENTRIES&&!this.cache.has(i)&&this.evictOldestEntries(1),this.cache.set(i,{values:o,timestamp:Date.now()})}getRevision(){return this.revision}setIfRevision(e,t,n,i){return this.revision!==i?!1:(this.set(e,t,n),!0)}evictOldestEntries(e){let t=Array.from(this.cache.entries()).sort(([,n],[,i])=>n.timestamp-i.timestamp).slice(0,e);for(let[n]of t)this.cache.delete(n)}clear(e){if(this.revision++,e){let t=[];for(let n of this.cache.keys())this.keyFieldName(n)===e&&t.push(n);for(let n of t)this.cache.delete(n)}else this.cache.clear()}cleanExpired(){let e=Date.now(),t=[];for(let[n,i]of this.cache.entries())e-i.timestamp>this.TTL&&t.push(n);for(let n of t)this.cache.delete(n)}getStats(){return{size:this.cache.size,maxSize:this.MAX_CACHE_ENTRIES,cleanupInterval:this.cleanupInterval}}destroy(){this.cleanupInterval=null,this.clear()}makeKey(e,t){return JSON.stringify([e,t||null])}keyFieldName(e){try{let t=JSON.parse(e);if(Array.isArray(t)&&typeof t[0]=="string")return t[0]}catch{}}}});var Xm,Oz=k(()=>{Xm=class{static deduplicate(e,t={}){let{strategy:n="case-insensitive",preserveFirstOccurrence:i=!0,sortResult:o=!0}=t,s=e.length,a;switch(n){case"exact":a=this.deduplicateExact(e);break;case"case-sensitive":a=this.deduplicateCaseSensitive(e,i);break;default:a=this.deduplicateCaseInsensitive(e,i);break}return o&&(a=this.sortValues(a,n)),{values:a,duplicatesRemoved:s-a.length,strategy:n}}static deduplicateExact(e){return this.deduplicateWithSet(e)}static deduplicateCaseSensitive(e,t){if(t){let n=new Set;return e.filter(i=>n.has(i)?!1:(n.add(i),!0))}return this.deduplicateWithSet(e)}static deduplicateWithSet(e){return Array.from(new Set(e))}static deduplicateCaseInsensitive(e,t){let n=new Map;for(let i of e){let o=this.normalizeForComparison(i);n.has(o)&&t||n.set(o,i)}return Array.from(n.values())}static normalizeForComparison(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}static sortValues(e,t){return e.sort((n,i)=>{if(t==="case-insensitive"){let o=n.toLowerCase(),s=i.toLowerCase();return o===s?this.getCasePriority(n)-this.getCasePriority(i):o.localeCompare(s)}return n.localeCompare(i)})}static getCasePriority(e){return e===e.toUpperCase()?3:e===e.toLowerCase()?2:e[0]===e[0].toUpperCase()?1:0}static analyzeVariations(e){let t=new Map;for(let o of e){let s=this.normalizeForComparison(o);t.has(s)||t.set(s,[]);let a=t.get(s);a&&a.push(o)}let n=0,i="";for(let[o,s]of t)s.length>n&&(n=s.length,i=o);return{totalValues:e.length,uniqueValues:t.size,caseVariations:t,mostCommonCase:i}}static getSuggestions(e,t,n=.8){let i=this.normalizeForComparison(e),o=[];for(let s of t){let a=this.normalizeForComparison(s);this.calculateSimilarity(i,a)>=n&&i!==a&&o.push(s)}return o.slice(0,5)}static calculateSimilarity(e,t){if(e.length===0)return t.length===0?1:0;if(t.length===0)return 0;let n=[];for(let o=0;o<=t.length;o++)n[o]=[o];for(let o=0;o<=e.length;o++)n[0][o]=o;for(let o=1;o<=t.length;o++)for(let s=1;s<=e.length;s++)t.charAt(o-1)===e.charAt(s-1)?n[o][s]=n[o-1][s-1]:n[o][s]=Math.min(n[o-1][s-1]+1,n[o][s-1]+1,n[o-1][s]+1);let i=Math.max(e.length,t.length);return 1-n[t.length][e.length]/i}}});var ta,$0=k(()=>{Je();Oz();ta=class{static processValues(e,t){let n=e.size,i=Array.from(e).filter(c=>!this.isUnresolvedFieldToken(c)),o={strategy:t.caseSensitive?"case-sensitive":"case-insensitive",preserveFirstOccurrence:!0,sortResult:!0},s=Xm.deduplicate(i,o);i=s.values;let{processedValues:a,hasDefault:l}=this.applyDefaultValues(i,t);return i=a,{values:i,hasDefaultValue:l,duplicatesRemoved:s.duplicatesRemoved,totalProcessed:n}}static isUnresolvedFieldToken(e){return this.unresolvedFieldTokenRegex.test(e.trim())}static applyDefaultValues(e,t){if(!t.defaultValue)return{processedValues:e,hasDefault:!1};let n=t.defaultValue,i=[...e],o=!1,s=a=>t.caseSensitive?a===n:this.normalizeForComparison(a)===this.normalizeForComparison(n);return t.defaultAlways?(i=i.filter(a=>!s(a)),i.unshift(n),o=!0):t.defaultEmpty&&e.length===0?(i=[n],o=!0):!t.defaultEmpty&&!t.defaultAlways&&(i.some(s)||(i.unshift(n),o=!0)),{processedValues:i,hasDefault:o}}static promoteValueToFront(e,t,n=!1){let i=o=>n?o===t:this.normalizeForComparison(o)===this.normalizeForComparison(t);return[t,...e.filter(o=>!i(o))]}static canonicalizeAgainst(e,t,n=!1){if(n)return t;let i=this.normalizeForComparison(t);return e.find(o=>this.normalizeForComparison(o)===i)??t}static normalizeForComparison(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}static getSmartDefaults(e,t){let n={status:["To Do","In Progress","Done","Cancelled"],priority:["High","Medium","Low"],type:["Note","Task","Project","Reference"],category:["Personal","Work","Study"],mood:["\u{1F60A} Good","\u{1F610} Neutral","\u{1F614} Bad"],rating:["\u2B50","\u2B50\u2B50","\u2B50\u2B50\u2B50","\u2B50\u2B50\u2B50\u2B50","\u2B50\u2B50\u2B50\u2B50\u2B50"],progress:["0%","25%","50%","75%","100%"],difficulty:["Easy","Medium","Hard"],size:["Small","Medium","Large"]},i=e.toLowerCase();if(Object.prototype.hasOwnProperty.call(n,i))return n[i];for(let[o,s]of Object.entries(n))if(i.includes(o)||o.includes(i))return s;if(t.length>0){let o=new Map;for(let s of t)o.set(s,(o.get(s)||0)+1);return Array.from(o.entries()).sort((s,a)=>a[1]-s[1]).slice(0,5).map(([s])=>s)}return[]}static validateDefaultValue(e,t,n){let i=[],o=[];if(t.length>0){let l=Xm.analyzeVariations(t),c=e.toLowerCase();for(let[d,f]of l.caseVariations)if(d===c){f.includes(e)||(o.push(...f.slice(0,3)),i.push(`Consider using existing case: ${f[0]}`));break}let u=Xm.getSuggestions(e,t,.8);u.length>0&&(o.push(...u),i.push(`Similar existing values found: ${u.slice(0,3).join(", ")}`))}let a=this.getSmartDefaults(n,t);return a.length>0&&!a.includes(e)&&(a.map(c=>c.toLowerCase()).includes(e.toLowerCase())||(o.push(...a.slice(0,3)),i.push(`Consider common values for ${n}: ${a.slice(0,3).join(", ")}`))),{isValid:!0,suggestions:[...new Set(o)],warnings:i}}};ta.unresolvedFieldTokenRegex=new RegExp(`^${Ow.source}$`,"i")});var Yl,Zm,M0=k(()=>{F0();Yl=class Yl{static parseInlineFields(e,t){let n=new Map,i=this.removeCodeBlocksAndFrontmatter(e,t),o;for(;(o=Yl.INLINE_FIELD_REGEX.exec(i))!==null;){let s=o[1].trim(),a=o[2].trim();if(a){n.has(s)||n.set(s,new Set);for(let l of ab(a))n.get(s)?.add(l)}}return Yl.INLINE_FIELD_REGEX.lastIndex=0,n}static removeCodeBlocksAndFrontmatter(e,t){return e=e.replace(this.FRONTMATTER_REGEX,""),e=this.filterFencedCodeBlocks(e,t?.includeCodeBlocks),e.replace(this.INLINE_CODE_SPAN_REGEX,"")}static filterFencedCodeBlocks(e,t){if(!e.includes("```"))return e;let n=new Set((t??[]).map(u=>u.trim().toLowerCase()).filter(u=>u.length>0)),i=e.split(` `),o=[],s=!1,a=0,l="",c=[];for(let u of i){if(!s){let d=this.matchFenceOpen(u);d?(s=!0,a=d.length,l=d.info,c=[u]):o.push(u);continue}if(this.matchFenceClose(u,a)){let d=l.trim().split(/\s+/)[0]?.toLowerCase();if(n.size>0&&d!==void 0&&d.length>0&&n.has(d))for(let p=1;p=t}static stripTrailingCarriage(e){return e.endsWith("\r")?e.slice(0,-1):e}static getFieldValues(e,t,n){return this.parseInlineFields(e,n).get(t)||new Set}};Yl.INLINE_FIELD_REGEX=/(?:^|[\n\r])(?![ \t]*[-*+][ \t]+\[[ xX]\])([^:\n\r]+?)::[ \t]*(.*)$/gmu,Yl.FRONTMATTER_REGEX=/^---\r?\n[\s\S]*?\r?\n---\r?\n/,Yl.INLINE_CODE_SPAN_REGEX=/`[^`]*`/g,Yl.FENCE_OPEN_REGEX=/^[ \t]*(`{3,})([^`]*)$/,Yl.FENCE_CLOSE_REGEX=/^[ \t]*(`{3,})[ \t]*$/;Zm=Yl});function O0(r){let e=[];return r.folder&&e.push(`folder:${r.folder}`),r.folders?.length&&e.push(`folders:${r.folders.join(",")}`),r.tags&&e.push(`tags:${r.tags.join(",")}`),r.inline&&e.push("inline:true"),r.inlineCodeBlocks?.length&&e.push(`inline-code-blocks:${r.inlineCodeBlocks.join(",")}`),r.caseSensitive&&e.push("case-sensitive:true"),r.excludeFolders&&e.push(`exclude-folders:${r.excludeFolders.join(",")}`),r.excludeTags&&e.push(`exclude-tags:${r.excludeTags.join(",")}`),r.excludeFiles&&e.push(`exclude-files:${r.excludeFiles.join(",")}`),r.defaultValue&&e.push(`default:${r.defaultValue}`),r.defaultEmpty&&e.push("default-empty:true"),r.defaultAlways&&e.push("default-always:true"),e.join("|")}async function Rz(r,e,t){let n=await Nz(r,e,t);return ta.processValues(n,t).values}async function Lz(r,e,t){let n=await Nz(r,e,t),i=ta.processValues(n,t);return{values:i.values,hasDefaultValue:i.hasDefaultValue}}async function Nz(r,e,t){let n=Gl.getInstance(),i=O0(t),o=n.get(e,i);if(o)return o;let s=n.getRevision(),a=await R0(r,e,t);return n.setIfRevision(e,a,i,s),a}async function R0(r,e,t){let n=e.trim().toLowerCase();if(n==="tags"||n==="tag"){let i=await xre(r,t);if(i.size>0)return i}try{if(!t.inline&&cb.isAvailable(r)){let i=await cb.getFieldValuesWithFilter(r,e,t);if(i.size>0)return i}}catch{}return await _re(r,e,t)}async function xre(r,e){if(!(!!e.folder||!!e.folders?.length||!!e.tags?.length||!!e.excludeFolders?.length||!!e.excludeTags?.length||!!e.excludeFiles?.length)){let n=Tre(r);if(n.size>0)return n}return await Sre(r,e)}function Tre(r){let e=new Set;try{let t=r.metadataCache.getTags?.();if(!t)return e;for(let n of Object.keys(t)){let o=(n.startsWith("#")?n.substring(1):n).trim();o&&e.add(o)}}catch{}return e}async function Sre(r,e){let t=new Set,n=r.vault.getMarkdownFiles();n=di.filterFiles(n,e,o=>r.metadataCache.getFileCache(o));let i=50;for(let o=0;o{let u=new Set;try{let d=r.metadataCache.getFileCache(c),f=d?.frontmatter?.tags;if(f!=null){let m=Array.isArray(f)?f:[f];for(let v of m){let g=String(v).trim();g&&u.add(g)}}let p=d?.frontmatter?.tag;if(p!=null){let m=Array.isArray(p)?p:[p];for(let v of m){let g=String(v).trim();g&&u.add(g)}}if(d?.tags)for(let m of d.tags){let v=String(m.tag??"").trim(),g=v.startsWith("#")?v.substring(1):v;g&&u.add(g)}}catch{}return u}),l=await Promise.all(a);for(let c of l)for(let u of c)t.add(u)}return t}async function _re(r,e,t){let n=new Set,i=r.vault.getMarkdownFiles();i=di.filterFiles(i,t,s=>r.metadataCache.getFileCache(s));let o=50;for(let s=0;s{let d=new Set;try{let p=r.metadataCache.getFileCache(u)?.frontmatter?.[e];if(p!=null){if(Array.isArray(p))p.forEach(m=>{let v=String(m).trim();v&&d.add(v)});else if(typeof p!="object"){let m=String(p).trim();m&&d.add(m)}}if(t.inline)try{let m=await r.vault.read(u);Zm.getFieldValues(m,e,{includeCodeBlocks:t.inlineCodeBlocks}).forEach(g=>{let y=String(g).trim();y&&d.add(y)})}catch{}}catch{}return d}),c=await Promise.all(l);for(let u of c)for(let d of u)n.add(d)}return n}var L0=k(()=>{Mz();ud();dS();$0();M0()});function kre(r,e){let t=e.trim();if(!t||!r)return null;let n=r[t];if(n===void 0){let i=t.toLowerCase(),o=Object.keys(r).find(s=>s.toLowerCase()===i);o!==void 0&&(n=r[o])}if(n==null)return null;if(Array.isArray(n)){let i=[];for(let o of n){let s=Bz(o);s!==null&&i.push(s)}return i.length>0?i:null}return Bz(n)}function pS(r,e,t){if(!e||e.extension!=="md")return null;let n=r.metadataCache.getFileCache(e)?.frontmatter;return kre(n,t)}function Bz(r){if(r==null)return null;let e=typeof r;if(e==="string"||e==="number"||e==="boolean"){let t=String(r).trim();return t.length>0?t:null}return null}var N0=k(()=>{});function ub(r){return r.replace(Are," ").replace(/\s+/g," ").trim()}function Vz(r){return!(r.trim()===""||/^( {4,}|\t)/.test(r)||/^ {0,3}#{1,6}[ \t]/.test(r)||/^ {0,3}(`{3,}|~{3,})/.test(r)||/^ {0,3}>/.test(r)||/^ {0,3}([-*+]|\d{1,9}[.)])[ \t]/.test(r)||/^ {0,3}(=+|-+)\s*$/.test(r)||/^ {0,3}([*_-])([ \t]*\1){2,}[ \t]*$/.test(r))}function qz(r){let e=[],t=!1,n="",i=0;for(let o=0;o=i&&(t=!1,n="",i=0);continue}else{let c=s.match(/^ {0,3}(`{3,}|~{3,})/);if(c){t=!0,n=c[1][0],i=c[1].length;continue}}let a=s.match(/^ {0,3}(#{1,6})[ \t]+(.*)$/);if(a){e.push({heading:a[2],level:a[1].length,line:o});continue}let l=s.match(/^ {0,3}(=+|-+)\s*$/);if(l&&o>0){let c=r[o-1],u=e.length>0&&e[e.length-1].line===o-1,d=o<2||!Vz(r[o-2]);!u&&d&&Vz(c)&&e.push({heading:c.trim(),level:l[1][0]==="="?1:2,line:o-1});continue}}return e}function Dre(r,e){let t=[],n=ub(r[e].heading);n&&t.push(n);let i=r[e].level;for(let o=e-1;o>=0&&i>1;o--)if(r[o].leveld!==t&&ub(u.heading).toLowerCase()===i))return`#${n}`;let s=Dre(r,t);if(s.length<2)return null;let a=s.join("#"),l=a.toLowerCase();return Ire(r).some((u,d)=>d!==t&&u===l)?null:`#${a}`}function Ire(r){let e=new Array(r.length),t=[];for(let n=0;n0&&r[t[t.length-1]].level>=r[n].level;)t.pop();let i=t.length>0?e[t[t.length-1]]:[],o=ub(r[n].heading);e[n]=o?[...i,o]:i,t.push(n)}return e.map(n=>n.join("#").toLowerCase())}var Are,zz=k(()=>{Are=/[!"#$%&()*+,.:;<=>?@^`{|}~/[\]\\\r\n]/g});function bu(r,{logPrefix:e,noticePrefix:t=e,defaultReason:n}){if(!(r instanceof Tt))return!1;let i=typeof r.message=="string"&&r.message.trim().length>0?r.message:n;return P.logMessage(`${e}: ${i}`),(!(r instanceof dt||typeof r.message=="string"&&r.message.toLowerCase().includes("cancelled by user"))||ne.getState().showInputCancellationNotification)&&new Hz.Notice(`${t}: ${i}`),!0}var Hz,db=k(()=>{Hz=require("obsidian");jo();Er();ht();De()});var Wz={};Nb(Wz,{SingleMacroEngine:()=>B0});function Pre(r){if(r==null)return"";if(typeof r=="string")return r;if(typeof r=="number"||typeof r=="boolean")return String(r);if(typeof r=="bigint"||typeof r=="symbol")return r.toString();if(r instanceof Error)return r.message;try{return JSON.stringify(r)}catch{return Object.prototype.toString.call(r)}}var Fre,B0,jz=k(()=>{De();Tr();Dt();It();xx();Bl();pb();db();Qn();jo();Fre=new Set(["settings","entry","quickadd"]);B0=class{constructor(e,t,n,i,o){this.app=e;this.plugin=t;this.choices=n;this.emittedConflictNotice=!1;this.choiceExecutor=i,o?(this.variables=o,this.choiceExecutor.variables=o):i.variables?this.variables=i.variables:(this.variables=new Map,this.choiceExecutor.variables=this.variables)}async runAndGetOutput(e,t){this.emittedConflictNotice=!1;let{basename:n,memberAccess:i}=cd(e),o=c=>(c??"").trim(),s=dn(this.choices).find(c=>c.type==="Macro"&&o(c.name)===o(n));if(!s){let c=d=>o(d).toLowerCase(),u=dn(this.choices).filter(d=>d.type==="Macro"&&c(d.name)===c(n));if(u.length>1)throw P.logError(`Ambiguous macro reference '${e}'. Multiple choices match when ignoring case.`),new Error(`Ambiguous macro reference '${e}'. Please disambiguate by renaming macros.`);s=u[0]}if(!s)throw P.logError(`macro '${e}' does not exist.`),new Error(`macro '${e}' does not exist.`);let a=new Wa(this.app,this.plugin,s,this.choiceExecutor,this.variables,void 0,t?.label);if(i?.length){let c=await this.tryExecuteExport(a,s,i);if(this.ensureNotAborted(),c.executed)return this.formatResult(c.result)}await a.run(),this.ensureNotAborted();let l=a.getOutput();if(i?.length){let c=this.resolveMemberAccess(l,i);c.found||P.logWarning(`Macro '${s.name}' was asked for member '${i.join("::")}', but it has no user script exporting it; the result is empty.`),l=c.value}return typeof l=="function"?l=await l():l&&typeof l=="object"&&(l=JSON.stringify(l)),Pre(l)}getVariables(){return this.variables}async tryExecuteExport(e,t,n){let i=ar(t.macro?.commands);if(!i.length)return{executed:!1};let o=i.map((c,u)=>({command:c,index:u})).filter(c=>mn(c.command)&&c.command.type==="UserScript");if(o.length===0)return{executed:!1};let s=await this.selectUserScriptCandidate(t,o,n),a=s.candidate.command.id,l=i.slice(0,s.candidate.index);try{l.length&&(await e.runSubset(l),this.ensureNotAborted());let c=t.macro?.commands,u=xy(c)?c:i,d;a!==void 0?d=u.findIndex(b=>mn(b)&&b.id===a&&b.type==="UserScript"):d=s.candidate.index;let f=d>=0?u[d]:void 0;if(!f||f.type!=="UserScript")throw new Tt(`Could not resolve the member-access script for '${t.name}'.`);let p=f;p.settings||(p.settings={});let m=s.candidate.exportsRef!==void 0?s.candidate.exportsRef:await Fs(p,this.app);if(m==null)throw new Tt(`Macro '${t.name}' could not load '${p.name}' for member access.`);let v=typeof m=="object"||typeof m=="function"?m.settings:void 0;v&&typeof v=="object"&&nm(p.settings,v);let g=s.candidate.resolvedMember??this.resolveMemberAccess(m,s.memberAccess);if(!g.found)throw new Tt(`Macro '${t.name}' routes member access to '${p.name}', but that script does not export '${s.memberAccess.join("::")}'.`);let y=u.slice(d+1),w=p.settings;typeof g.value=="function"&&(await tm(this.app,p,v&&typeof v=="object"?v:void 0)&&await this.plugin.saveSettings?.(),w=await Cx(this.app,p,v&&typeof v=="object"?v:void 0));let T=await this.executeResolvedMember(g.value,e,w);return this.ensureNotAborted(),e.setOutput(T),this.syncVariablesFromParams(e),y.length&&(await e.runSubset(y),this.ensureNotAborted()),{executed:!0,result:T}}catch(c){throw bu(c,{logPrefix:"Macro execution aborted",noticePrefix:"Macro execution aborted",defaultReason:"Macro execution aborted"})&&this.choiceExecutor.signalAbort?.(c),c}}resolveMemberAccess(e,t){let n=e;for(let i of t){if(n==null||typeof n!="object"&&typeof n!="function")return{found:!1};let o=n;if(!(i in o))return{found:!1};n=o[i]}return{found:!0,value:n}}async executeResolvedMember(e,t,n){return typeof e=="function"?await e(t.params,n):e}async selectUserScriptCandidate(e,t,n){if(t.length===1)return{candidate:{command:t[0].command,index:t[0].index},memberAccess:n};let i=this.resolveScriptSelector(e,t,n);if(i)return{candidate:{command:i.command,index:i.index},memberAccess:i.memberAccess};let o=[];for(let l of t){let c=await Fs(l.command,this.app);o.push({command:l.command,index:l.index,exportsRef:c,resolvedMember:this.resolveMemberAccess(c,n)})}let s=o.filter(l=>l.resolvedMember.found);if(s.length===1)return{candidate:s[0],memberAccess:n};if(s.length===0)throw new Tt(`Macro '${e.name}' could not find '${n.join("::")}' in any user script.`);if(Fre.has(n[0])){let l=s[0];return this.warnReservedKeyConflict(e,n,l,s),{candidate:l,memberAccess:n}}let a=s.map(l=>`'${l.command.name}'`).join(", ");throw new Tt(`Macro '${e.name}' has multiple user scripts exporting '${n.join("::")}': ${a}. Disambiguate with '{{MACRO:${e.name}::