133 lines
106 KiB
JavaScript
133 lines
106 KiB
JavaScript
/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
if you want to view the source, please visit the github repository of this plugin
|
|
*/
|
|
|
|
var es=Object.defineProperty;var vn=Object.getOwnPropertyDescriptor;var Fn=Object.getOwnPropertyNames;var bn=Object.prototype.hasOwnProperty;var kn=(s,e)=>{for(var t in e)es(s,t,{get:e[t],enumerable:!0})},In=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Fn(e))!bn.call(s,n)&&n!==t&&es(s,n,{get:()=>e[n],enumerable:!(r=vn(e,n))||r.enumerable});return s};var On=s=>In(es({},"__esModule",{value:!0}),s);var Sa={};kn(Sa,{default:()=>Xt});module.exports=On(Sa);var L=require("obsidian");var Ks=require("obsidian");var we=require("obsidian"),R="all_folders",bt=class extends we.Modal{constructor(t,r,n,i){super(t);this.selectedFolders=new Set;this.folders=[];this.folders=r,n&&n.length>0&&n.forEach(a=>{a&&this.selectedFolders.add(a)}),this.onConfirm=i}async onOpen(){let{contentEl:t}=this;t.createEl("h2",{text:"Manage Cubox folders to be synced"}),t.addClass("cubox-modal"),this.listEl=t.createDiv({cls:"folder-list-container cubox-list-container"}),this.footerEl=t.createDiv({cls:"modal-footer"}),this.createFolderList(),this.footerEl.createEl("button",{text:"Cancel"}).addEventListener("click",()=>{this.close()}),this.footerEl.createEl("button",{text:"Done",cls:"mod-cta"}).addEventListener("click",()=>{if(this.selectedFolders.size===0){new we.Notice("Please select at least one option.");return}let i=this.selectedFolders.has(R)?[R]:Array.from(this.selectedFolders);this.onConfirm(i),this.close()})}createFolderList(){this.listEl.empty(),new we.Setting(this.listEl).setName("All items").addToggle(t=>{t.setValue(this.selectedFolders.has(R)),t.onChange(r=>{this.handleFolderToggle(R,r),this.redraw()})}),this.folders.forEach(t=>{let r=this.selectedFolders.has(R),n=new we.Setting(this.listEl).setName(t.nested_name).addToggle(i=>{i.setDisabled(r),i.setValue(!r&&this.selectedFolders.has(t.id)),r||i.onChange(a=>{this.handleFolderToggle(t.id,a),this.redraw()})});r&&n.settingEl.addClass("is-disabled")})}handleFolderToggle(t,r){t===R?r?(this.selectedFolders.clear(),this.selectedFolders.add(R)):this.selectedFolders.delete(R):r?(this.selectedFolders.delete(R),this.selectedFolders.add(t)):this.selectedFolders.delete(t)}redraw(){this.createFolderList()}onClose(){let{contentEl:t}=this;t.empty()}};var ce=require("obsidian"),H="all_items",qs="",kt=class extends ce.Modal{constructor(t,r,n,i){super(t);this.selectedTags=new Set;this.tags=[];this.tags=r,n&&n.length>0&&n.forEach(a=>{this.selectedTags.add(a)}),this.onConfirm=i}async onOpen(){let{contentEl:t}=this;t.createEl("h2",{text:"Manage Cubox tags to be synced"}),t.addClass("cubox-modal"),this.listEl=t.createDiv({cls:"tag-list-container cubox-list-container"}),this.footerEl=t.createDiv({cls:"modal-footer"}),this.createTagList(),this.footerEl.createEl("button",{text:"Cancel"}).addEventListener("click",()=>{this.close()}),this.footerEl.createEl("button",{text:"Done",cls:"mod-cta"}).addEventListener("click",()=>{if(this.selectedTags.size===0){new ce.Notice("Please select at least one option.");return}let i=this.selectedTags.has(H)?[H]:Array.from(this.selectedTags);this.onConfirm(i),this.close()})}createTagList(){this.listEl.empty(),new ce.Setting(this.listEl).setName("All items").addToggle(n=>{n.setValue(this.selectedTags.has(H)),n.onChange(i=>{this.handleTagToggle(H,i),this.redraw()})});let t=this.selectedTags.has(H),r=new ce.Setting(this.listEl).setName("No tags").addToggle(n=>{n.setDisabled(t),n.setValue(!t&&this.selectedTags.has(qs)),t||n.onChange(i=>{this.handleTagToggle(qs,i),this.redraw()})});t&&r.settingEl.addClass("is-disabled"),this.tags.forEach(n=>{let i=new ce.Setting(this.listEl).setName(n.nested_name).addToggle(a=>{a.setDisabled(t),a.setValue(!t&&this.selectedTags.has(n.id)),t||a.onChange(o=>{this.handleTagToggle(n.id,o),this.redraw()})});t&&i.settingEl.addClass("is-disabled")})}handleTagToggle(t,r){t===H?r?(this.selectedTags.clear(),this.selectedTags.add(H)):this.selectedTags.delete(H):r?(this.selectedTags.delete(H),this.selectedTags.add(t)):this.selectedTags.delete(t)}redraw(){this.createTagList()}onClose(){let{contentEl:t}=this;t.empty()}};var be=require("obsidian"),G="all",It=class extends be.Modal{constructor(t,r,n={},i){super(t);this.statuses=[{id:"all",name:"All items"},{id:"read",name:"Already read items only",value:!0},{id:"starred",name:"Starred items only",value:!0},{id:"annotated",name:"Annotated items only",value:!0}];this.selectedStatuses=new Set;this.statusValues=new Map;this.onSave=i,this.statuses.forEach(a=>{if(a.id!=="all"){let o=n[a.id]!==void 0?n[a.id]:a.value||!0;this.statusValues.set(a.id,o)}}),r&&r.length>0&&r.forEach(a=>{a&&this.selectedStatuses.add(a)})}async onOpen(){let{contentEl:t}=this;t.createEl("h2",{text:"Manage Cubox content status to be synced"}),t.addClass("cubox-modal"),this.listEl=t.createDiv({cls:"status-list-container cubox-list-container"}),this.footerEl=t.createDiv({cls:"modal-footer"}),this.createStatusList(),this.footerEl.createEl("button",{text:"Cancel"}).addEventListener("click",()=>{this.close()}),this.footerEl.createEl("button",{text:"Done",cls:"mod-cta"}).addEventListener("click",()=>{if(this.selectedStatuses.size===0){new be.Notice("Please select at least one option.");return}let i=Array.from(this.selectedStatuses),a={};this.statusValues.forEach((o,l)=>{a[l]=o}),this.onSave(i,a),this.close()})}createStatusList(){this.listEl.empty(),this.statuses.forEach(t=>{let r=this.selectedStatuses.has(G),n=new be.Setting(this.listEl).setName(t.name).addToggle(i=>{t.id===G?(i.setValue(this.selectedStatuses.has(G)),i.onChange(a=>{this.handleStatusToggle(G,a),this.redraw()})):(i.setDisabled(r),i.setValue(!r&&this.selectedStatuses.has(t.id)),r||i.onChange(a=>{this.handleStatusToggle(t.id,a),this.redraw()}))});t.id!==G&&r&&n.settingEl.addClass("is-disabled")})}handleStatusToggle(t,r){t===G?r?(this.selectedStatuses.clear(),this.selectedStatuses.add(G),this.statuses.forEach(n=>{n.id!=="all"&&this.statusValues.set(n.id,!1)})):this.selectedStatuses.delete(G):(r?(this.selectedStatuses.delete(G),this.selectedStatuses.add(t)):this.selectedStatuses.delete(t),this.statusValues.set(t,r))}redraw(){this.createStatusList()}onClose(){let{contentEl:t}=this;t.empty()}};var de=require("obsidian"),Ct=["Memo","Image","Audio","Video","File"],zs=new Set(Ct),ae="Others",Cn=["Article","Snippet",ae];function Bs(s){if(!s||s.length===0)return[];let e=Ct.some(r=>s.includes(r)),t=s.filter(r=>!zs.has(r));return e&&!t.includes(ae)&&t.push(ae),t}function Ys(s){let e=new Set,t=!1;for(let r of s)zs.has(r)||r===ae?t=!0:e.add(r);return t&&e.add(ae),Array.from(e)}function Gs(s){let e=[];for(let t of s)t===ae?e.push(...Ct):e.push(t);return[...new Set(e)]}function Js(s){if(!s||s.length===0)return!1;let e=s.includes("Article"),t=s.includes("Snippet"),r=s.includes(ae)||Ct.every(n=>s.includes(n));return e&&t&&r}var Ot=class extends de.Modal{constructor(t,r=[],n,i=""){super(t);this.selectedTypes=new Set;this.onSave=n,this.domain=i,r&&r.length>0&&r.forEach(a=>{a&&this.selectedTypes.add(a)})}onOpen(){let{contentEl:t}=this;t.empty(),t.createEl("h2",{text:"Manage Cubox content types to be synced"}),t.addClass("cubox-modal"),this.listEl=t.createDiv({cls:"type-list-container cubox-list-container"}),this.footerEl=t.createDiv({cls:"modal-footer"}),this.createTypeList(),this.footerEl.createEl("button",{text:"Cancel"}).addEventListener("click",()=>{this.close()}),this.footerEl.createEl("button",{text:"Done",cls:"mod-cta"}).addEventListener("click",()=>{if(this.selectedTypes.size===0){new de.Notice("Please select at least one option.");return}let i=Array.from(this.selectedTypes);this.onSave(i),this.close()})}createTypeList(){this.listEl.empty(),Cn.forEach(t=>{let r=new de.Setting(this.listEl);if(t===ae){let n=document.createDocumentFragment(),i=document.createElement("span");i.textContent=ae,n.appendChild(i);let a=document.createElement("span");a.className="cubox-others-info-icon",a.setAttribute("aria-label","About Memo and file types"),(0,de.setIcon)(a,"info"),a.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation();let l=this.domain==="cubox.pro"?"https://story.cubox.pro/memo-file-update":"https://cubox.cc/blog/memo-file-update/";window.open(l)}),n.appendChild(a),r.setName(n)}else r.setName(t);r.addToggle(n=>{n.setValue(this.selectedTypes.has(t)),n.onChange(i=>{this.handleTypeToggle(t,i),this.redraw()})})})}handleTypeToggle(t,r){r?this.selectedTypes.add(t):this.selectedTypes.delete(t)}redraw(){this.createTypeList()}onClose(){let{contentEl:t}=this;t.empty()}};var Be=class extends Error{constructor(e="Cubox API key is missing or invalid."){super(e),this.name="CuboxApiKeyMissingError"}},Dt=class{constructor(e,t){this.endpoint=`https://${e}`,this.apiKey=t}updateConfig(e,t){this.endpoint=`https://${e}`,this.apiKey=t}async request(e,t={}){let r=`${this.endpoint}${e}`,n={Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"};t.headers&&Object.entries(t.headers).forEach(([a,o])=>{typeof o=="string"&&(n[a]=o)});let i=await(0,Ks.requestUrl)({url:r,method:t.method||"GET",body:t.body,headers:n});if(i.status>=400)throw new Error(`API request failed: ${i.status}`);return JSON.parse(i.text)}async getArticles(e={lastCardId:null,lastCardUpdateTime:null}){var t;try{let r={limit:50},n=50;e.lastCardId!==null&&e.lastCardId.length>0&&e.lastCardUpdateTime!==null&&e.lastCardUpdateTime.length>0&&(r.last_card_id=e.lastCardId,r.last_card_update_time=e.lastCardUpdateTime),e.folderFilter&&e.folderFilter.length>0&&(e.folderFilter.includes(R)||(r.group_filters=e.folderFilter)),e.typeFilter&&e.typeFilter.length>0&&(r.type_filters=Gs(e.typeFilter)),e.statusFilter&&e.statusFilter.length>0&&(e.statusFilter.includes(G)||(e.isRead===!0&&(r.read=!0),e.isStarred===!0&&(r.starred=!0),e.isAnnotated===!0&&(r.annotated=!0))),e.tagsFilter&&e.tagsFilter.length>0&&(e.tagsFilter.includes(H)||(r.tag_filters=e.tagsFilter));let i="/c/api/third-party/card/filter",a=await this.request(i,{method:"POST",body:JSON.stringify(r)});if(a.code===-1100)throw new Be(a.message||"API key not found");let o=(t=a.data)!=null?t:[],l=o&&o.length>=n;return{articles:o,hasMore:l}}catch(r){throw console.error("\u83B7\u53D6\u6587\u7AE0\u5217\u8868\u5931\u8D25:",r),r}}async getArticleDetail(e){try{let t=`/c/api/third-party/card/content?id=${e}`;return(await this.request(t)).data}catch(t){return console.error(`\u83B7\u53D6\u6587\u7AE0 ${e} \u8BE6\u60C5\u5931\u8D25:`,t),null}}async getFolders(){var e;try{let t="/c/api/third-party/group/list";return(e=(await this.request(t)).data)!=null?e:[]}catch(t){throw console.error("\u83B7\u53D6 Cubox \u6587\u4EF6\u5939\u5217\u8868\u5931\u8D25:",t),t}}async getTags(){var e;try{let t="/c/api/third-party/tag/list";return(e=(await this.request(t)).data)!=null?e:[]}catch(t){throw console.error("\u83B7\u53D6 Cubox \u6807\u7B7E\u5217\u8868\u5931\u8D25:",t),t}}};var oe=class extends Error{},Mt=class extends oe{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Nt=class extends oe{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},_t=class extends oe{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},J=class extends oe{},ke=class extends oe{constructor(e){super(`Invalid unit ${e}`)}},D=class extends oe{},K=class extends oe{constructor(){super("Zone is an abstract class")}};var d="numeric",j="short",U="long",he={year:d,month:d,day:d},Ye={year:d,month:j,day:d},ts={year:d,month:j,day:d,weekday:j},Ge={year:d,month:U,day:d},Je={year:d,month:U,day:d,weekday:U},Ke={hour:d,minute:d},je={hour:d,minute:d,second:d},Qe={hour:d,minute:d,second:d,timeZoneName:j},Xe={hour:d,minute:d,second:d,timeZoneName:U},et={hour:d,minute:d,hourCycle:"h23"},tt={hour:d,minute:d,second:d,hourCycle:"h23"},st={hour:d,minute:d,second:d,hourCycle:"h23",timeZoneName:j},rt={hour:d,minute:d,second:d,hourCycle:"h23",timeZoneName:U},nt={year:d,month:d,day:d,hour:d,minute:d},it={year:d,month:d,day:d,hour:d,minute:d,second:d},at={year:d,month:j,day:d,hour:d,minute:d},ot={year:d,month:j,day:d,hour:d,minute:d,second:d},ss={year:d,month:j,day:d,weekday:j,hour:d,minute:d},lt={year:d,month:U,day:d,hour:d,minute:d,timeZoneName:j},ut={year:d,month:U,day:d,hour:d,minute:d,second:d,timeZoneName:j},ct={year:d,month:U,day:d,weekday:U,hour:d,minute:d,timeZoneName:U},dt={year:d,month:U,day:d,weekday:U,hour:d,minute:d,second:d,timeZoneName:U};var W=class{get type(){throw new K}get name(){throw new K}get ianaName(){return this.name}get isUniversal(){throw new K}offsetName(e,t){throw new K}formatOffset(e,t){throw new K}offset(e){throw new K}equals(e){throw new K}get isValid(){throw new K}};var rs=null,te=class extends W{static get instance(){return rs===null&&(rs=new te),rs}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return Lt(e,t,r)}formatOffset(e,t){return fe(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var Wt={};function Dn(s){return Wt[s]||(Wt[s]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:s,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),Wt[s]}var Mn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Nn(s,e){let t=s.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,n,i,a,o,l,u,c]=r;return[a,n,i,o,l,u,c]}function _n(s,e){let t=s.formatToParts(e),r=[];for(let n=0;n<t.length;n++){let{type:i,value:a}=t[n],o=Mn[i];i==="era"?r[o]=a:m(o)||(r[o]=parseInt(a,10))}return r}var Vt={},N=class extends W{static create(e){return Vt[e]||(Vt[e]=new N(e)),Vt[e]}static resetCache(){Vt={},Wt={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch(t){return!1}}constructor(e){super(),this.zoneName=e,this.valid=N.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return Lt(e,t,r,this.name)}formatOffset(e,t){return fe(this.offset(e),t)}offset(e){let t=new Date(e);if(isNaN(t))return NaN;let r=Dn(this.name),[n,i,a,o,l,u,c]=r.formatToParts?_n(r,t):Nn(r,t);o==="BC"&&(n=-Math.abs(n)+1);let y=Ie({year:n,month:i,day:a,hour:l===24?0:l,minute:u,second:c,millisecond:0}),g=+t,b=g%1e3;return g-=b>=0?b:1e3+b,(y-g)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}};var js={};function An(s,e={}){let t=JSON.stringify([s,e]),r=js[t];return r||(r=new Intl.ListFormat(s,e),js[t]=r),r}var ns={};function is(s,e={}){let t=JSON.stringify([s,e]),r=ns[t];return r||(r=new Intl.DateTimeFormat(s,e),ns[t]=r),r}var as={};function Ln(s,e={}){let t=JSON.stringify([s,e]),r=as[t];return r||(r=new Intl.NumberFormat(s,e),as[t]=r),r}var os={};function Vn(s,e={}){let{base:t,...r}=e,n=JSON.stringify([s,r]),i=os[n];return i||(i=new Intl.RelativeTimeFormat(s,e),os[n]=i),i}var ht=null;function Wn(){return ht||(ht=new Intl.DateTimeFormat().resolvedOptions().locale,ht)}var Qs={};function Rn(s){let e=Qs[s];if(!e){let t=new Intl.Locale(s);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,Qs[s]=e}return e}function Hn(s){let e=s.indexOf("-x-");e!==-1&&(s=s.substring(0,e));let t=s.indexOf("-u-");if(t===-1)return[s];{let r,n;try{r=is(s).resolvedOptions(),n=s}catch(o){let l=s.substring(0,t);r=is(l).resolvedOptions(),n=l}let{numberingSystem:i,calendar:a}=r;return[n,i,a]}}function Un(s,e,t){return(t||e)&&(s.includes("-u-")||(s+="-u"),t&&(s+=`-ca-${t}`),e&&(s+=`-nu-${e}`)),s}function $n(s){let e=[];for(let t=1;t<=12;t++){let r=f.utc(2009,t,1);e.push(s(r))}return e}function Pn(s){let e=[];for(let t=1;t<=7;t++){let r=f.utc(2016,11,13+t);e.push(s(r))}return e}function Rt(s,e,t,r){let n=s.listingMode();return n==="error"?null:n==="en"?t(e):r(e)}function Zn(s){return s.numberingSystem&&s.numberingSystem!=="latn"?!1:s.numberingSystem==="latn"||!s.locale||s.locale.startsWith("en")||new Intl.DateTimeFormat(s.intl).resolvedOptions().numberingSystem==="latn"}var ls=class{constructor(e,t,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;let{padTo:n,floor:i,...a}=r;if(!t||Object.keys(a).length>0){let o={useGrouping:!1,...r};r.padTo>0&&(o.minimumIntegerDigits=r.padTo),this.inf=Ln(e,o)}}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):Oe(e,3);return I(t,this.padTo)}}},us=class{constructor(e,t,r){this.opts=r,this.originalZone=void 0;let n;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let a=-1*(e.offset/60),o=a>=0?`Etc/GMT+${a}`:`Etc/GMT${a}`;e.offset!==0&&N.create(o).valid?(n=o,this.dt=e):(n="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,n=e.zone.name):(n="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let i={...this.opts};i.timeZone=i.timeZone||n,this.dtf=is(t,i)}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 r=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:r}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},cs=class{constructor(e,t,r){this.opts={style:"long",...r},!t&&Ht()&&(this.rtf=Vn(e,r))}format(e,t){return this.rtf?this.rtf.format(e,t):Xs(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}},qn={firstDay:1,minimalDays:4,weekend:[6,7]},T=class{static fromOpts(e){return T.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,r,n,i=!1){let a=e||w.defaultLocale,o=a||(i?"en-US":Wn()),l=t||w.defaultNumberingSystem,u=r||w.defaultOutputCalendar,c=ft(n)||w.defaultWeekSettings;return new T(o,l,u,c,a)}static resetCache(){ht=null,ns={},as={},os={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:r,weekSettings:n}={}){return T.create(e,t,r,n)}constructor(e,t,r,n,i){let[a,o,l]=Hn(e);this.locale=a,this.numberingSystem=t||o||null,this.outputCalendar=r||l||null,this.weekSettings=n,this.intl=Un(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=Zn(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:T.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,ft(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return Rt(this,e,ds,()=>{let r=t?{month:e,day:"numeric"}:{month:e},n=t?"format":"standalone";return this.monthsCache[n][e]||(this.monthsCache[n][e]=$n(i=>this.extract(i,r,"month"))),this.monthsCache[n][e]})}weekdays(e,t=!1){return Rt(this,e,hs,()=>{let r=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},n=t?"format":"standalone";return this.weekdaysCache[n][e]||(this.weekdaysCache[n][e]=Pn(i=>this.extract(i,r,"weekday"))),this.weekdaysCache[n][e]})}meridiems(){return Rt(this,void 0,()=>fs,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[f.utc(2016,11,13,9),f.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Rt(this,e,ms,()=>{let t={era:e};return this.eraCache[e]||(this.eraCache[e]=[f.utc(-40,1,1),f.utc(2017,1,1)].map(r=>this.extract(r,t,"era"))),this.eraCache[e]})}extract(e,t,r){let n=this.dtFormatter(e,t),i=n.formatToParts(),a=i.find(o=>o.type.toLowerCase()===r);return a?a.value:null}numberFormatter(e={}){return new ls(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new us(e,this.intl,t)}relFormatter(e={}){return new cs(this.intl,this.isEnglish(),e)}listFormatter(e={}){return An(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Ut()?Rn(this.locale):qn}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}};var ps=null,O=class extends W{static get utcInstance(){return ps===null&&(ps=new O(0)),ps}static instance(e){return e===0?O.utcInstance:new O(e)}static parseSpecifier(e){if(e){let t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new O(Ee(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${fe(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${fe(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return fe(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}};var Ce=class extends W{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 Q(s,e){let t;if(m(s)||s===null)return e;if(s instanceof W)return s;if(er(s)){let r=s.toLowerCase();return r==="default"?e:r==="local"||r==="system"?te.instance:r==="utc"||r==="gmt"?O.utcInstance:O.parseSpecifier(r)||N.create(s)}else return X(s)?O.instance(s):typeof s=="object"&&"offset"in s&&typeof s.offset=="function"?s:new Ce(s)}var ys={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"},tr={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]},zn=ys.hanidec.replace(/[\[|\]]/g,"").split("");function sr(s){let e=parseInt(s,10);if(isNaN(e)){e="";for(let t=0;t<s.length;t++){let r=s.charCodeAt(t);if(s[t].search(ys.hanidec)!==-1)e+=zn.indexOf(s[t]);else for(let n in tr){let[i,a]=tr[n];r>=i&&r<=a&&(e+=r-i)}}return parseInt(e,10)}else return e}var De={};function rr(){De={}}function Z({numberingSystem:s},e=""){let t=s||"latn";return De[t]||(De[t]={}),De[t][e]||(De[t][e]=new RegExp(`${ys[t]}${e}`)),De[t][e]}var nr=()=>Date.now(),ir="system",ar=null,or=null,lr=null,ur=60,cr,dr=null,w=class{static get now(){return nr}static set now(e){nr=e}static set defaultZone(e){ir=e}static get defaultZone(){return Q(ir,te.instance)}static get defaultLocale(){return ar}static set defaultLocale(e){ar=e}static get defaultNumberingSystem(){return or}static set defaultNumberingSystem(e){or=e}static get defaultOutputCalendar(){return lr}static set defaultOutputCalendar(e){lr=e}static get defaultWeekSettings(){return dr}static set defaultWeekSettings(e){dr=ft(e)}static get twoDigitCutoffYear(){return ur}static set twoDigitCutoffYear(e){ur=e%100}static get throwOnInvalid(){return cr}static set throwOnInvalid(e){cr=e}static resetCaches(){T.resetCache(),N.resetCache(),f.resetCache(),rr()}};var _=class{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var hr=[0,31,59,90,120,151,181,212,243,273,304,334],fr=[0,31,60,91,121,152,182,213,244,274,305,335];function q(s,e){return new _("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${s}, which is invalid`)}function $t(s,e,t){let r=new Date(Date.UTC(s,e-1,t));s<100&&s>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);let n=r.getUTCDay();return n===0?7:n}function mr(s,e,t){return t+(xe(s)?fr:hr)[e-1]}function gr(s,e){let t=xe(s)?fr:hr,r=t.findIndex(i=>i<e),n=e-t[r];return{month:r+1,day:n}}function Pt(s,e){return(s-e+7)%7+1}function mt(s,e=4,t=1){let{year:r,month:n,day:i}=s,a=mr(r,n,i),o=Pt($t(r,n,i),t),l=Math.floor((a-o+14-e)/7),u;return l<1?(u=r-1,l=Se(u,e,t)):l>Se(r,e,t)?(u=r+1,l=1):u=r,{weekYear:u,weekNumber:l,weekday:o,...pt(s)}}function Ts(s,e=4,t=1){let{weekYear:r,weekNumber:n,weekday:i}=s,a=Pt($t(r,1,e),t),o=me(r),l=n*7+i-a-7+e,u;l<1?(u=r-1,l+=me(u)):l>o?(u=r+1,l-=me(r)):u=r;let{month:c,day:h}=gr(u,l);return{year:u,month:c,day:h,...pt(s)}}function Zt(s){let{year:e,month:t,day:r}=s,n=mr(e,t,r);return{year:e,ordinal:n,...pt(s)}}function ws(s){let{year:e,ordinal:t}=s,{month:r,day:n}=gr(e,t);return{year:e,month:r,day:n,...pt(s)}}function Es(s,e){if(!m(s.localWeekday)||!m(s.localWeekNumber)||!m(s.localWeekYear)){if(!m(s.weekday)||!m(s.weekNumber)||!m(s.weekYear))throw new J("Cannot mix locale-based week fields with ISO-based week fields");return m(s.localWeekday)||(s.weekday=s.localWeekday),m(s.localWeekNumber)||(s.weekNumber=s.localWeekNumber),m(s.localWeekYear)||(s.weekYear=s.localWeekYear),delete s.localWeekday,delete s.localWeekNumber,delete s.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function pr(s,e=4,t=1){let r=gt(s.weekYear),n=$(s.weekNumber,1,Se(s.weekYear,e,t)),i=$(s.weekday,1,7);return r?n?i?!1:q("weekday",s.weekday):q("week",s.weekNumber):q("weekYear",s.weekYear)}function yr(s){let e=gt(s.year),t=$(s.ordinal,1,me(s.year));return e?t?!1:q("ordinal",s.ordinal):q("year",s.year)}function Ss(s){let e=gt(s.year),t=$(s.month,1,12),r=$(s.day,1,Me(s.year,s.month));return e?t?r?!1:q("day",s.day):q("month",s.month):q("year",s.year)}function xs(s){let{hour:e,minute:t,second:r,millisecond:n}=s,i=$(e,0,23)||e===24&&t===0&&r===0&&n===0,a=$(t,0,59),o=$(r,0,59),l=$(n,0,999);return i?a?o?l?!1:q("millisecond",n):q("second",r):q("minute",t):q("hour",e)}function m(s){return typeof s=="undefined"}function X(s){return typeof s=="number"}function gt(s){return typeof s=="number"&&s%1===0}function er(s){return typeof s=="string"}function wr(s){return Object.prototype.toString.call(s)==="[object Date]"}function Ht(){try{return typeof Intl!="undefined"&&!!Intl.RelativeTimeFormat}catch(s){return!1}}function Ut(){try{return typeof Intl!="undefined"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(s){return!1}}function Er(s){return Array.isArray(s)?s:[s]}function vs(s,e,t){if(s.length!==0)return s.reduce((r,n)=>{let i=[e(n),n];return r&&t(r[0],i[0])===r[0]?r:i},null)[1]}function Sr(s,e){return e.reduce((t,r)=>(t[r]=s[r],t),{})}function ge(s,e){return Object.prototype.hasOwnProperty.call(s,e)}function ft(s){if(s==null)return null;if(typeof s!="object")throw new D("Week settings must be an object");if(!$(s.firstDay,1,7)||!$(s.minimalDays,1,7)||!Array.isArray(s.weekend)||s.weekend.some(e=>!$(e,1,7)))throw new D("Invalid week settings");return{firstDay:s.firstDay,minimalDays:s.minimalDays,weekend:Array.from(s.weekend)}}function $(s,e,t){return gt(s)&&s>=e&&s<=t}function Bn(s,e){return s-e*Math.floor(s/e)}function I(s,e=2){let t=s<0,r;return t?r="-"+(""+-s).padStart(e,"0"):r=(""+s).padStart(e,"0"),r}function le(s){if(!(m(s)||s===null||s===""))return parseInt(s,10)}function pe(s){if(!(m(s)||s===null||s===""))return parseFloat(s)}function yt(s){if(!(m(s)||s===null||s==="")){let e=parseFloat("0."+s)*1e3;return Math.floor(e)}}function Oe(s,e,t=!1){let r=10**e;return(t?Math.trunc:Math.round)(s*r)/r}function xe(s){return s%4===0&&(s%100!==0||s%400===0)}function me(s){return xe(s)?366:365}function Me(s,e){let t=Bn(e-1,12)+1,r=s+(e-t)/12;return t===2?xe(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Ie(s){let e=Date.UTC(s.year,s.month-1,s.day,s.hour,s.minute,s.second,s.millisecond);return s.year<100&&s.year>=0&&(e=new Date(e),e.setUTCFullYear(s.year,s.month-1,s.day)),+e}function Tr(s,e,t){return-Pt($t(s,1,e),t)+e-1}function Se(s,e=4,t=1){let r=Tr(s,e,t),n=Tr(s+1,e,t);return(me(s)-r+n)/7}function Tt(s){return s>99?s:s>w.twoDigitCutoffYear?1900+s:2e3+s}function Lt(s,e,t,r=null){let n=new Date(s),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(i.timeZone=r);let a={timeZoneName:e,...i},o=new Intl.DateTimeFormat(t,a).formatToParts(n).find(l=>l.type.toLowerCase()==="timezonename");return o?o.value:null}function Ee(s,e){let t=parseInt(s,10);Number.isNaN(t)&&(t=0);let r=parseInt(e,10)||0,n=t<0||Object.is(t,-0)?-r:r;return t*60+n}function Fs(s){let e=Number(s);if(typeof s=="boolean"||s===""||Number.isNaN(e))throw new D(`Invalid unit value ${s}`);return e}function Ne(s,e){let t={};for(let r in s)if(ge(s,r)){let n=s[r];if(n==null)continue;t[e(r)]=Fs(n)}return t}function fe(s,e){let t=Math.trunc(Math.abs(s/60)),r=Math.trunc(Math.abs(s%60)),n=s>=0?"+":"-";switch(e){case"short":return`${n}${I(t,2)}:${I(r,2)}`;case"narrow":return`${n}${t}${r>0?`:${r}`:""}`;case"techie":return`${n}${I(t,2)}${I(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function pt(s){return Sr(s,["hour","minute","second","millisecond"])}var Yn=["January","February","March","April","May","June","July","August","September","October","November","December"],bs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Gn=["J","F","M","A","M","J","J","A","S","O","N","D"];function ds(s){switch(s){case"narrow":return[...Gn];case"short":return[...bs];case"long":return[...Yn];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 ks=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Is=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Jn=["M","T","W","T","F","S","S"];function hs(s){switch(s){case"narrow":return[...Jn];case"short":return[...Is];case"long":return[...ks];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var fs=["AM","PM"],Kn=["Before Christ","Anno Domini"],jn=["BC","AD"],Qn=["B","A"];function ms(s){switch(s){case"narrow":return[...Qn];case"short":return[...jn];case"long":return[...Kn];default:return null}}function xr(s){return fs[s.hour<12?0:1]}function vr(s,e){return hs(e)[s.weekday-1]}function Fr(s,e){return ds(e)[s.month-1]}function br(s,e){return ms(e)[s.year<0?0:1]}function Xs(s,e,t="always",r=!1){let n={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."]},i=["hours","minutes","seconds"].indexOf(s)===-1;if(t==="auto"&&i){let h=s==="days";switch(e){case 1:return h?"tomorrow":`next ${n[s][0]}`;case-1:return h?"yesterday":`last ${n[s][0]}`;case 0:return h?"today":`this ${n[s][0]}`;default:}}let a=Object.is(e,-0)||e<0,o=Math.abs(e),l=o===1,u=n[s],c=r?l?u[1]:u[2]||u[1]:l?n[s][0]:s;return a?`${o} ${c} ago`:`in ${o} ${c}`}function kr(s,e){let t="";for(let r of s)r.literal?t+=r.val:t+=e(r.val);return t}var Xn={D:he,DD:Ye,DDD:Ge,DDDD:Je,t:Ke,tt:je,ttt:Qe,tttt:Xe,T:et,TT:tt,TTT:st,TTTT:rt,f:nt,ff:at,fff:lt,ffff:ct,F:it,FF:ot,FFF:ut,FFFF:dt},C=class{static create(e,t={}){return new C(e,t)}static parseFormat(e){let t=null,r="",n=!1,i=[];for(let a=0;a<e.length;a++){let o=e.charAt(a);o==="'"?(r.length>0&&i.push({literal:n||/^\s+$/.test(r),val:r}),t=null,r="",n=!n):n||o===t?r+=o:(r.length>0&&i.push({literal:/^\s+$/.test(r),val:r}),r=o,t=o)}return r.length>0&&i.push({literal:n||/^\s+$/.test(r),val:r}),i}static macroTokenToFormatOpts(e){return Xn[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 I(e,t);let r={...this.opts};return t>0&&(r.padTo=t),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,t){let r=this.loc.listingMode()==="en",n=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(g,b)=>this.loc.extract(e,g,b),a=g=>e.isOffsetFixed&&e.offset===0&&g.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,g.format):"",o=()=>r?xr(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),l=(g,b)=>r?Fr(e,g):i(b?{month:g}:{month:g,day:"numeric"},"month"),u=(g,b)=>r?vr(e,g):i(b?{weekday:g}:{weekday:g,month:"long",day:"numeric"},"weekday"),c=g=>{let b=C.macroTokenToFormatOpts(g);return b?this.formatWithSystemDefault(e,b):g},h=g=>r?br(e,g):i({era:g},"era"),y=g=>{switch(g){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 a({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return a({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return a({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 o();case"d":return n?i({day:"numeric"},"day"):this.num(e.day);case"dd":return n?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return u("short",!0);case"cccc":return u("long",!0);case"ccccc":return u("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return u("short",!1);case"EEEE":return u("long",!1);case"EEEEE":return u("narrow",!1);case"L":return n?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return n?i({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 n?i({month:"numeric"},"month"):this.num(e.month);case"MM":return n?i({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 n?i({year:"numeric"},"year"):this.num(e.year);case"yy":return n?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return n?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return n?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return h("short");case"GG":return h("long");case"GGGGG":return h("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"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);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 c(g)}};return kr(C.parseFormat(t),y)}formatDurationFromString(e,t){let r=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}},n=l=>u=>{let c=r(u);return c?this.num(l.get(c),u.length):u},i=C.parseFormat(t),a=i.reduce((l,{literal:u,val:c})=>u?l:l.concat(c),[]),o=e.shiftTo(...a.map(r).filter(l=>l));return kr(i,n(o))}};var Or=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Ae(...s){let e=s.reduce((t,r)=>t+r.source,"");return RegExp(`^${e}$`)}function Le(...s){return e=>s.reduce(([t,r,n],i)=>{let[a,o,l]=i(e,n);return[{...t,...a},o||r,l]},[{},null,1]).slice(0,2)}function Ve(s,...e){if(s==null)return[null,null];for(let[t,r]of e){let n=t.exec(s);if(n)return r(n)}return[null,null]}function Cr(...s){return(e,t)=>{let r={},n;for(n=0;n<s.length;n++)r[s[n]]=le(e[t+n]);return[r,null,t+n]}}var Dr=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,ei=`(?:${Dr.source}?(?:\\[(${Or.source})\\])?)?`,Os=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Mr=RegExp(`${Os.source}${ei}`),Cs=RegExp(`(?:T${Mr.source})?`),ti=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,si=/(\d{4})-?W(\d\d)(?:-?(\d))?/,ri=/(\d{4})-?(\d{3})/,ni=Cr("weekYear","weekNumber","weekDay"),ii=Cr("year","ordinal"),ai=/(\d{4})-(\d\d)-(\d\d)/,Nr=RegExp(`${Os.source} ?(?:${Dr.source}|(${Or.source}))?`),oi=RegExp(`(?: ${Nr.source})?`);function _e(s,e,t){let r=s[e];return m(r)?t:le(r)}function li(s,e){return[{year:_e(s,e),month:_e(s,e+1,1),day:_e(s,e+2,1)},null,e+3]}function We(s,e){return[{hours:_e(s,e,0),minutes:_e(s,e+1,0),seconds:_e(s,e+2,0),milliseconds:yt(s[e+3])},null,e+4]}function wt(s,e){let t=!s[e]&&!s[e+1],r=Ee(s[e+1],s[e+2]),n=t?null:O.instance(r);return[{},n,e+3]}function Et(s,e){let t=s[e]?N.create(s[e]):null;return[{},t,e+1]}var ui=RegExp(`^T?${Os.source}$`),ci=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function di(s){let[e,t,r,n,i,a,o,l,u]=s,c=e[0]==="-",h=l&&l[0]==="-",y=(g,b=!1)=>g!==void 0&&(b||g&&c)?-g:g;return[{years:y(pe(t)),months:y(pe(r)),weeks:y(pe(n)),days:y(pe(i)),hours:y(pe(a)),minutes:y(pe(o)),seconds:y(pe(l),l==="-0"),milliseconds:y(yt(u),h)}]}var hi={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Ds(s,e,t,r,n,i,a){let o={year:e.length===2?Tt(le(e)):le(e),month:bs.indexOf(t)+1,day:le(r),hour:le(n),minute:le(i)};return a&&(o.second=le(a)),s&&(o.weekday=s.length>3?ks.indexOf(s)+1:Is.indexOf(s)+1),o}var fi=/^(?:(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 mi(s){let[,e,t,r,n,i,a,o,l,u,c,h]=s,y=Ds(e,n,r,t,i,a,o),g;return l?g=hi[l]:u?g=0:g=Ee(c,h),[y,new O(g)]}function gi(s){return s.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var pi=/^(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$/,yi=/^(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$/,Ti=/^(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 Ir(s){let[,e,t,r,n,i,a,o]=s;return[Ds(e,n,r,t,i,a,o),O.utcInstance]}function wi(s){let[,e,t,r,n,i,a,o]=s;return[Ds(e,o,t,r,n,i,a),O.utcInstance]}var Ei=Ae(ti,Cs),Si=Ae(si,Cs),xi=Ae(ri,Cs),vi=Ae(Mr),_r=Le(li,We,wt,Et),Fi=Le(ni,We,wt,Et),bi=Le(ii,We,wt,Et),ki=Le(We,wt,Et);function Ar(s){return Ve(s,[Ei,_r],[Si,Fi],[xi,bi],[vi,ki])}function Lr(s){return Ve(gi(s),[fi,mi])}function Vr(s){return Ve(s,[pi,Ir],[yi,Ir],[Ti,wi])}function Wr(s){return Ve(s,[ci,di])}var Ii=Le(We);function Rr(s){return Ve(s,[ui,Ii])}var Oi=Ae(ai,oi),Ci=Ae(Nr),Di=Le(We,wt,Et);function Hr(s){return Ve(s,[Oi,_r],[Ci,Di])}var Ur="Invalid Duration",Pr={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Mi={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:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...Pr},z=146097/400,Re=146097/4800,Ni={years:{quarters:4,months:12,weeks:z/7,days:z,hours:z*24,minutes:z*24*60,seconds:z*24*60*60,milliseconds:z*24*60*60*1e3},quarters:{months:3,weeks:z/28,days:z/4,hours:z*24/4,minutes:z*24*60/4,seconds:z*24*60*60/4,milliseconds:z*24*60*60*1e3/4},months:{weeks:Re/7,days:Re,hours:Re*24,minutes:Re*24*60,seconds:Re*24*60*60,milliseconds:Re*24*60*60*1e3},...Pr},ve=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],_i=ve.slice(0).reverse();function ye(s,e,t=!1){let r={values:t?e.values:{...s.values,...e.values||{}},loc:s.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||s.conversionAccuracy,matrix:e.matrix||s.matrix};return new p(r)}function Zr(s,e){var r;let t=(r=e.milliseconds)!=null?r:0;for(let n of _i.slice(1))e[n]&&(t+=e[n]*s[n].milliseconds);return t}function $r(s,e){let t=Zr(s,e)<0?-1:1;ve.reduceRight((r,n)=>{if(m(e[n]))return r;if(r){let i=e[r]*t,a=s[n][r],o=Math.floor(i/a);e[n]+=o*t,e[r]-=o*a*t}return n},null),ve.reduce((r,n)=>{if(m(e[n]))return r;if(r){let i=e[r]%1;e[r]-=i,e[n]+=i*s[r][n]}return n},null)}function Ai(s){let e={};for(let[t,r]of Object.entries(s))r!==0&&(e[t]=r);return e}var p=class{constructor(e){let t=e.conversionAccuracy==="longterm"||!1,r=t?Ni:Mi;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||T.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,t){return p.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new D(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new p({values:Ne(e,p.normalizeUnit),loc:T.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(X(e))return p.fromMillis(e);if(p.isDuration(e))return e;if(typeof e=="object")return p.fromObject(e);throw new D(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){let[r]=Wr(e);return r?p.fromObject(r,t):p.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){let[r]=Rr(e);return r?p.fromObject(r,t):p.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new D("need to specify a reason the Duration is invalid");let r=e instanceof _?e:new _(e,t);if(w.throwOnInvalid)throw new _t(r);return new p({invalid:r})}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 ke(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 r={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?C.create(this.loc,r).formatDurationFromString(this,e):Ur}toHuman(e={}){if(!this.isValid)return Ur;let t=ve.map(r=>{let n=this.values[r];return m(n)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:r.slice(0,-1)}).format(n)}).filter(r=>r);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+=Oe(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},f.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Zr(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let t=p.fromDurationLike(e),r={};for(let n of ve)(ge(t.values,n)||ge(this.values,n))&&(r[n]=t.get(n)+this.get(n));return ye(this,{values:r},!0)}minus(e){if(!this.isValid)return this;let t=p.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;let t={};for(let r of Object.keys(this.values))t[r]=Fs(e(this.values[r],r));return ye(this,{values:t},!0)}get(e){return this[p.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let t={...this.values,...Ne(e,p.normalizeUnit)};return ye(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:r,matrix:n}={}){let a={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:n,conversionAccuracy:r};return ye(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return $r(this.matrix,e),ye(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Ai(this.normalize().shiftToAll().toObject());return ye(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(a=>p.normalizeUnit(a));let t={},r={},n=this.toObject(),i;for(let a of ve)if(e.indexOf(a)>=0){i=a;let o=0;for(let u in r)o+=this.matrix[u][a]*r[u],r[u]=0;X(n[a])&&(o+=n[a]);let l=Math.trunc(o);t[a]=l,r[a]=(o*1e3-l*1e3)/1e3}else X(n[a])&&(r[a]=n[a]);for(let a in r)r[a]!==0&&(t[i]+=a===i?r[a]:r[a]/this.matrix[i][a]);return $r(this.matrix,t),ye(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 ye(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(r,n){return r===void 0||r===0?n===void 0||n===0:r===n}for(let r of ve)if(!t(this.values[r],e.values[r]))return!1;return!0}};var He="Invalid Interval";function Li(s,e){return!s||!s.isValid?v.invalid("missing or invalid start"):!e||!e.isValid?v.invalid("missing or invalid end"):e<s?v.invalid("end before start",`The end of an interval must be after its start, but you had start=${s.toISO()} and end=${e.toISO()}`):null}var v=class{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new D("need to specify a reason the Interval is invalid");let r=e instanceof _?e:new _(e,t);if(w.throwOnInvalid)throw new Nt(r);return new v({invalid:r})}static fromDateTimes(e,t){let r=Ue(e),n=Ue(t),i=Li(r,n);return i==null?new v({start:r,end:n}):i}static after(e,t){let r=p.fromDurationLike(t),n=Ue(e);return v.fromDateTimes(n,n.plus(r))}static before(e,t){let r=p.fromDurationLike(t),n=Ue(e);return v.fromDateTimes(n.minus(r),n)}static fromISO(e,t){let[r,n]=(e||"").split("/",2);if(r&&n){let i,a;try{i=f.fromISO(r,t),a=i.isValid}catch(u){a=!1}let o,l;try{o=f.fromISO(n,t),l=o.isValid}catch(u){l=!1}if(a&&l)return v.fromDateTimes(i,o);if(a){let u=p.fromISO(n,t);if(u.isValid)return v.after(i,u)}else if(l){let u=p.fromISO(r,t);if(u.isValid)return v.before(o,u)}}return v.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;let r=this.start.startOf(e,t),n;return t!=null&&t.useLocaleWeeks?n=this.end.reconfigure({locale:r.locale}):n=this.end,n=n.startOf(e,t),Math.floor(n.diff(r,e).get(e))+(n.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!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?v.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];let t=e.map(Ue).filter(a=>this.contains(a)).sort((a,o)=>a.toMillis()-o.toMillis()),r=[],{s:n}=this,i=0;for(;n<this.e;){let a=t[i]||this.e,o=+a>+this.e?this.e:a;r.push(v.fromDateTimes(n,o)),n=o,i+=1}return r}splitBy(e){let t=p.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:r}=this,n=1,i,a=[];for(;r<this.e;){let o=this.start.plus(t.mapUnits(l=>l*n));i=+o>+this.e?this.e:o,a.push(v.fromDateTimes(r,i)),r=i,n+=1}return a}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=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,r=this.e<e.e?this.e:e.e;return t>=r?null:v.fromDateTimes(t,r)}union(e){if(!this.isValid)return this;let t=this.s<e.s?this.s:e.s,r=this.e>e.e?this.e:e.e;return v.fromDateTimes(t,r)}static merge(e){let[t,r]=e.sort((n,i)=>n.s-i.s).reduce(([n,i],a)=>i?i.overlaps(a)||i.abutsStart(a)?[n,i.union(a)]:[n.concat([i]),a]:[n,a],[[],null]);return r&&t.push(r),t}static xor(e){let t=null,r=0,n=[],i=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),a=Array.prototype.concat(...i),o=a.sort((l,u)=>l.time-u.time);for(let l of o)r+=l.type==="s"?1:-1,r===1?t=l.time:(t&&+t!=+l.time&&n.push(v.fromDateTimes(t,l.time)),t=null);return v.merge(n)}difference(...e){return v.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()})`:He}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=he,t={}){return this.isValid?C.create(this.s.loc.clone(t),e).formatInterval(this):He}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:He}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:He}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:He}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:He}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):p.invalid(this.invalidReason)}mapEndpoints(e){return v.fromDateTimes(e(this.s),e(this.e))}};var ue=class{static hasDST(e=w.defaultZone){let t=f.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return N.isValidZone(e)}static normalizeZone(e){return Q(e,w.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||T.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||T.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||T.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null,outputCalendar:i="gregory"}={}){return(n||T.create(t,r,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null,outputCalendar:i="gregory"}={}){return(n||T.create(t,r,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null}={}){return(n||T.create(t,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null}={}){return(n||T.create(t,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return T.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return T.create(t,null,"gregory").eras(e)}static features(){return{relative:Ht(),localeWeek:Ut()}}};function qr(s,e){let t=n=>n.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=t(e)-t(s);return Math.floor(p.fromMillis(r).as("days"))}function Vi(s,e,t){let r=[["years",(l,u)=>u.year-l.year],["quarters",(l,u)=>u.quarter-l.quarter+(u.year-l.year)*4],["months",(l,u)=>u.month-l.month+(u.year-l.year)*12],["weeks",(l,u)=>{let c=qr(l,u);return(c-c%7)/7}],["days",qr]],n={},i=s,a,o;for(let[l,u]of r)t.indexOf(l)>=0&&(a=l,n[l]=u(s,e),o=i.plus(n),o>e?(n[l]--,s=i.plus(n),s>e&&(o=s,n[l]--,s=i.plus(n))):s=o);return[s,n,o,a]}function zr(s,e,t,r){let[n,i,a,o]=Vi(s,e,t),l=e-n,u=t.filter(h=>["hours","minutes","seconds","milliseconds"].indexOf(h)>=0);u.length===0&&(a<e&&(a=n.plus({[o]:1})),a!==n&&(i[o]=(i[o]||0)+l/(a-n)));let c=p.fromObject(i,r);return u.length>0?p.fromMillis(l,r).shiftTo(...u).plus(c):c}var Wi="missing Intl.DateTimeFormat.formatToParts support";function E(s,e=t=>t){return{regex:s,deser:([t])=>e(sr(t))}}var Ri=String.fromCharCode(160),Gr=`[ ${Ri}]`,Jr=new RegExp(Gr,"g");function Hi(s){return s.replace(/\./g,"\\.?").replace(Jr,Gr)}function Br(s){return s.replace(/\./g,"").replace(Jr," ").toLowerCase()}function ee(s,e){return s===null?null:{regex:RegExp(s.map(Hi).join("|")),deser:([t])=>s.findIndex(r=>Br(t)===Br(r))+e}}function Yr(s,e){return{regex:s,deser:([,t,r])=>Ee(t,r),groups:e}}function qt(s){return{regex:s,deser:([e])=>e}}function Ui(s){return s.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function $i(s,e){let t=Z(e),r=Z(e,"{2}"),n=Z(e,"{3}"),i=Z(e,"{4}"),a=Z(e,"{6}"),o=Z(e,"{1,2}"),l=Z(e,"{1,3}"),u=Z(e,"{1,6}"),c=Z(e,"{1,9}"),h=Z(e,"{2,4}"),y=Z(e,"{4,6}"),g=F=>({regex:RegExp(Ui(F.val)),deser:([k])=>k,literal:!0}),S=(F=>{if(s.literal)return g(F);switch(F.val){case"G":return ee(e.eras("short"),0);case"GG":return ee(e.eras("long"),0);case"y":return E(u);case"yy":return E(h,Tt);case"yyyy":return E(i);case"yyyyy":return E(y);case"yyyyyy":return E(a);case"M":return E(o);case"MM":return E(r);case"MMM":return ee(e.months("short",!0),1);case"MMMM":return ee(e.months("long",!0),1);case"L":return E(o);case"LL":return E(r);case"LLL":return ee(e.months("short",!1),1);case"LLLL":return ee(e.months("long",!1),1);case"d":return E(o);case"dd":return E(r);case"o":return E(l);case"ooo":return E(n);case"HH":return E(r);case"H":return E(o);case"hh":return E(r);case"h":return E(o);case"mm":return E(r);case"m":return E(o);case"q":return E(o);case"qq":return E(r);case"s":return E(o);case"ss":return E(r);case"S":return E(l);case"SSS":return E(n);case"u":return qt(c);case"uu":return qt(o);case"uuu":return E(t);case"a":return ee(e.meridiems(),0);case"kkkk":return E(i);case"kk":return E(h,Tt);case"W":return E(o);case"WW":return E(r);case"E":case"c":return E(t);case"EEE":return ee(e.weekdays("short",!1),1);case"EEEE":return ee(e.weekdays("long",!1),1);case"ccc":return ee(e.weekdays("short",!0),1);case"cccc":return ee(e.weekdays("long",!0),1);case"Z":case"ZZ":return Yr(new RegExp(`([+-]${o.source})(?::(${r.source}))?`),2);case"ZZZ":return Yr(new RegExp(`([+-]${o.source})(${r.source})?`),2);case"z":return qt(/[a-z_+-/]{1,256}?/i);case" ":return qt(/[^\S\n\r]/);default:return g(F)}})(s)||{invalidReason:Wi};return S.token=s,S}var Pi={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 Zi(s,e,t){let{type:r,value:n}=s;if(r==="literal"){let l=/^\s+$/.test(n);return{literal:!l,val:l?" ":n}}let i=e[r],a=r;r==="hour"&&(e.hour12!=null?a=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?a="hour12":a="hour24":a=t.hour12?"hour12":"hour24");let o=Pi[a];if(typeof o=="object"&&(o=o[i]),o)return{literal:!1,val:o}}function qi(s){return[`^${s.map(t=>t.regex).reduce((t,r)=>`${t}(${r.source})`,"")}$`,s]}function zi(s,e,t){let r=s.match(e);if(r){let n={},i=1;for(let a in t)if(ge(t,a)){let o=t[a],l=o.groups?o.groups+1:1;!o.literal&&o.token&&(n[o.token.val[0]]=o.deser(r.slice(i,i+l))),i+=l}return[r,n]}else return[r,{}]}function Bi(s){let e=i=>{switch(i){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,r;return m(s.z)||(t=N.create(s.z)),m(s.Z)||(t||(t=new O(s.Z)),r=s.Z),m(s.q)||(s.M=(s.q-1)*3+1),m(s.h)||(s.h<12&&s.a===1?s.h+=12:s.h===12&&s.a===0&&(s.h=0)),s.G===0&&s.y&&(s.y=-s.y),m(s.u)||(s.S=yt(s.u)),[Object.keys(s).reduce((i,a)=>{let o=e(a);return o&&(i[o]=s[a]),i},{}),t,r]}var Ms=null;function Yi(){return Ms||(Ms=f.fromMillis(1555555555555)),Ms}function Gi(s,e){if(s.literal)return s;let t=C.macroTokenToFormatOpts(s.val),r=As(t,e);return r==null||r.includes(void 0)?s:r}function Ns(s,e){return Array.prototype.concat(...s.map(t=>Gi(t,e)))}var St=class{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=Ns(C.parseFormat(t),e),this.units=this.tokens.map(r=>$i(r,e)),this.disqualifyingUnit=this.units.find(r=>r.invalidReason),!this.disqualifyingUnit){let[r,n]=qi(this.units);this.regex=RegExp(r,"i"),this.handlers=n}}explainFromTokens(e){if(this.isValid){let[t,r]=zi(e,this.regex,this.handlers),[n,i,a]=r?Bi(r):[null,null,void 0];if(ge(r,"a")&&ge(r,"H"))throw new J("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:r,result:n,zone:i,specificOffset:a}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function _s(s,e,t){return new St(s,t).explainFromTokens(e)}function Kr(s,e,t){let{result:r,zone:n,specificOffset:i,invalidReason:a}=_s(s,e,t);return[r,n,i,a]}function As(s,e){if(!s)return null;let r=C.create(e,s).dtFormatter(Yi()),n=r.formatToParts(),i=r.resolvedOptions();return n.map(a=>Zi(a,s,i))}var Ls="Invalid DateTime",jr=864e13;function xt(s){return new _("unsupported zone",`the zone "${s.name}" is not supported`)}function Vs(s){return s.weekData===null&&(s.weekData=mt(s.c)),s.weekData}function Ws(s){return s.localWeekData===null&&(s.localWeekData=mt(s.c,s.loc.getMinDaysInFirstWeek(),s.loc.getStartOfWeek())),s.localWeekData}function Fe(s,e){let t={ts:s.ts,zone:s.zone,c:s.c,o:s.o,loc:s.loc,invalid:s.invalid};return new f({...t,...e,old:t})}function nn(s,e,t){let r=s-e*60*1e3,n=t.offset(r);if(e===n)return[r,e];r-=(n-e)*60*1e3;let i=t.offset(r);return n===i?[r,n]:[s-Math.min(n,i)*60*1e3,Math.max(n,i)]}function zt(s,e){s+=e*60*1e3;let t=new Date(s);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function Yt(s,e,t){return nn(Ie(s),e,t)}function Qr(s,e){let t=s.o,r=s.c.year+Math.trunc(e.years),n=s.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...s.c,year:r,month:n,day:Math.min(s.c.day,Me(r,n))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=p.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"),o=Ie(i),[l,u]=nn(o,t,s.zone);return a!==0&&(l+=a,u=s.zone.offset(l)),{ts:l,o:u}}function $e(s,e,t,r,n,i){let{setZone:a,zone:o}=t;if(s&&Object.keys(s).length!==0||e){let l=e||o,u=f.fromObject(s,{...t,zone:l,specificOffset:i});return a?u:u.setZone(o)}else return f.invalid(new _("unparsable",`the input "${n}" can't be parsed as ${r}`))}function Bt(s,e,t=!0){return s.isValid?C.create(T.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(s,e):null}function Rs(s,e){let t=s.c.year>9999||s.c.year<0,r="";return t&&s.c.year>=0&&(r+="+"),r+=I(s.c.year,t?6:4),e?(r+="-",r+=I(s.c.month),r+="-",r+=I(s.c.day)):(r+=I(s.c.month),r+=I(s.c.day)),r}function Xr(s,e,t,r,n,i){let a=I(s.c.hour);return e?(a+=":",a+=I(s.c.minute),(s.c.millisecond!==0||s.c.second!==0||!t)&&(a+=":")):a+=I(s.c.minute),(s.c.millisecond!==0||s.c.second!==0||!t)&&(a+=I(s.c.second),(s.c.millisecond!==0||!r)&&(a+=".",a+=I(s.c.millisecond,3))),n&&(s.isOffsetFixed&&s.offset===0&&!i?a+="Z":s.o<0?(a+="-",a+=I(Math.trunc(-s.o/60)),a+=":",a+=I(Math.trunc(-s.o%60))):(a+="+",a+=I(Math.trunc(s.o/60)),a+=":",a+=I(Math.trunc(s.o%60)))),i&&(a+="["+s.zone.ianaName+"]"),a}var an={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Ji={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Ki={ordinal:1,hour:0,minute:0,second:0,millisecond:0},on=["year","month","day","hour","minute","second","millisecond"],ji=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Qi=["year","ordinal","hour","minute","second","millisecond"];function Xi(s){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"}[s.toLowerCase()];if(!e)throw new ke(s);return e}function en(s){switch(s.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Xi(s)}}function ea(s){return Jt[s]||(Gt===void 0&&(Gt=w.now()),Jt[s]=s.offset(Gt)),Jt[s]}function tn(s,e){let t=Q(e.zone,w.defaultZone);if(!t.isValid)return f.invalid(xt(t));let r=T.fromObject(e),n,i;if(m(s.year))n=w.now();else{for(let l of on)m(s[l])&&(s[l]=an[l]);let a=Ss(s)||xs(s);if(a)return f.invalid(a);let o=ea(t);[n,i]=Yt(s,o,t)}return new f({ts:n,zone:t,loc:r,o:i})}function sn(s,e,t){let r=m(t.round)?!0:t.round,n=(a,o)=>(a=Oe(a,r||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(a,o)),i=a=>t.calendary?e.hasSame(s,a)?0:e.startOf(a).diff(s.startOf(a),a).get(a):e.diff(s,a).get(a);if(t.unit)return n(i(t.unit),t.unit);for(let a of t.units){let o=i(a);if(Math.abs(o)>=1)return n(o,a)}return n(s>e?-0:0,t.units[t.units.length-1])}function rn(s){let e={},t;return s.length>0&&typeof s[s.length-1]=="object"?(e=s[s.length-1],t=Array.from(s).slice(0,s.length-1)):t=Array.from(s),[e,t]}var Gt,Jt={},f=class{constructor(e){let t=e.zone||w.defaultZone,r=e.invalid||(Number.isNaN(e.ts)?new _("invalid input"):null)||(t.isValid?null:xt(t));this.ts=m(e.ts)?w.now():e.ts;let n=null,i=null;if(!r)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[n,i]=[e.old.c,e.old.o];else{let o=X(e.o)&&!e.old?e.o:t.offset(this.ts);n=zt(this.ts,o),r=Number.isNaN(n.year)?new _("invalid input"):null,n=r?null:n,i=r?null:o}this._zone=t,this.loc=e.loc||T.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=n,this.o=i,this.isLuxonDateTime=!0}static now(){return new f({})}static local(){let[e,t]=rn(arguments),[r,n,i,a,o,l,u]=t;return tn({year:r,month:n,day:i,hour:a,minute:o,second:l,millisecond:u},e)}static utc(){let[e,t]=rn(arguments),[r,n,i,a,o,l,u]=t;return e.zone=O.utcInstance,tn({year:r,month:n,day:i,hour:a,minute:o,second:l,millisecond:u},e)}static fromJSDate(e,t={}){let r=wr(e)?e.valueOf():NaN;if(Number.isNaN(r))return f.invalid("invalid input");let n=Q(t.zone,w.defaultZone);return n.isValid?new f({ts:r,zone:n,loc:T.fromObject(t)}):f.invalid(xt(n))}static fromMillis(e,t={}){if(X(e))return e<-jr||e>jr?f.invalid("Timestamp out of range"):new f({ts:e,zone:Q(t.zone,w.defaultZone),loc:T.fromObject(t)});throw new D(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(X(e))return new f({ts:e*1e3,zone:Q(t.zone,w.defaultZone),loc:T.fromObject(t)});throw new D("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};let r=Q(t.zone,w.defaultZone);if(!r.isValid)return f.invalid(xt(r));let n=T.fromObject(t),i=Ne(e,en),{minDaysInFirstWeek:a,startOfWeek:o}=Es(i,n),l=w.now(),u=m(t.specificOffset)?r.offset(l):t.specificOffset,c=!m(i.ordinal),h=!m(i.year),y=!m(i.month)||!m(i.day),g=h||y,b=i.weekYear||i.weekNumber;if((g||c)&&b)throw new J("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(y&&c)throw new J("Can't mix ordinal dates with month/day");let S=b||i.weekday&&!g,F,k,M=zt(l,u);S?(F=ji,k=Ji,M=mt(M,a,o)):c?(F=Qi,k=Ki,M=Zt(M)):(F=on,k=an);let Y=!1;for(let ze of F){let xn=i[ze];m(xn)?Y?i[ze]=k[ze]:i[ze]=M[ze]:Y=!0}let re=S?pr(i,a,o):c?yr(i):Ss(i),P=re||xs(i);if(P)return f.invalid(P);let ne=S?Ts(i,a,o):c?ws(i):i,[ie,V]=Yt(ne,u,r),qe=new f({ts:ie,zone:r,o:V,loc:n});return i.weekday&&g&&e.weekday!==qe.weekday?f.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${qe.toISO()}`):qe.isValid?qe:f.invalid(qe.invalid)}static fromISO(e,t={}){let[r,n]=Ar(e);return $e(r,n,t,"ISO 8601",e)}static fromRFC2822(e,t={}){let[r,n]=Lr(e);return $e(r,n,t,"RFC 2822",e)}static fromHTTP(e,t={}){let[r,n]=Vr(e);return $e(r,n,t,"HTTP",t)}static fromFormat(e,t,r={}){if(m(e)||m(t))throw new D("fromFormat requires an input string and a format");let{locale:n=null,numberingSystem:i=null}=r,a=T.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0}),[o,l,u,c]=Kr(a,e,t);return c?f.invalid(c):$e(o,l,r,`format ${t}`,e,u)}static fromString(e,t,r={}){return f.fromFormat(e,t,r)}static fromSQL(e,t={}){let[r,n]=Hr(e);return $e(r,n,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new D("need to specify a reason the DateTime is invalid");let r=e instanceof _?e:new _(e,t);if(w.throwOnInvalid)throw new Mt(r);return new f({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){let r=As(e,T.fromObject(t));return r?r.map(n=>n?n.val:null).join(""):null}static expandFormat(e,t={}){return Ns(C.parseFormat(e),T.fromObject(t)).map(n=>n.val).join("")}static resetCache(){Gt=void 0,Jt={}}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?Vs(this).weekYear:NaN}get weekNumber(){return this.isValid?Vs(this).weekNumber:NaN}get weekday(){return this.isValid?Vs(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Ws(this).weekday:NaN}get localWeekNumber(){return this.isValid?Ws(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Ws(this).weekYear:NaN}get ordinal(){return this.isValid?Zt(this.c).ordinal:NaN}get monthShort(){return this.isValid?ue.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?ue.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?ue.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?ue.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,r=Ie(this.c),n=this.zone.offset(r-e),i=this.zone.offset(r+e),a=this.zone.offset(r-n*t),o=this.zone.offset(r-i*t);if(a===o)return[this];let l=r-a*t,u=r-o*t,c=zt(l,a),h=zt(u,o);return c.hour===h.hour&&c.minute===h.minute&&c.second===h.second&&c.millisecond===h.millisecond?[Fe(this,{ts:l}),Fe(this,{ts:u})]:[this]}get isInLeapYear(){return xe(this.year)}get daysInMonth(){return Me(this.year,this.month)}get daysInYear(){return this.isValid?me(this.year):NaN}get weeksInWeekYear(){return this.isValid?Se(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Se(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:t,numberingSystem:r,calendar:n}=C.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:r,outputCalendar:n}}toUTC(e=0,t={}){return this.setZone(O.instance(e),t)}toLocal(){return this.setZone(w.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:r=!1}={}){if(e=Q(e,w.defaultZone),e.equals(this.zone))return this;if(e.isValid){let n=this.ts;if(t||r){let i=e.offset(this.ts),a=this.toObject();[n]=Yt(a,i,e)}return Fe(this,{ts:n,zone:e})}else return f.invalid(xt(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:r}={}){let n=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:r});return Fe(this,{loc:n})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let t=Ne(e,en),{minDaysInFirstWeek:r,startOfWeek:n}=Es(t,this.loc),i=!m(t.weekYear)||!m(t.weekNumber)||!m(t.weekday),a=!m(t.ordinal),o=!m(t.year),l=!m(t.month)||!m(t.day),u=o||l,c=t.weekYear||t.weekNumber;if((u||a)&&c)throw new J("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(l&&a)throw new J("Can't mix ordinal dates with month/day");let h;i?h=Ts({...mt(this.c,r,n),...t},r,n):m(t.ordinal)?(h={...this.toObject(),...t},m(t.day)&&(h.day=Math.min(Me(h.year,h.month),h.day))):h=ws({...Zt(this.c),...t});let[y,g]=Yt(h,this.o,this.zone);return Fe(this,{ts:y,o:g})}plus(e){if(!this.isValid)return this;let t=p.fromDurationLike(e);return Fe(this,Qr(this,t))}minus(e){if(!this.isValid)return this;let t=p.fromDurationLike(e).negate();return Fe(this,Qr(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;let r={},n=p.normalizeUnit(e);switch(n){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0;break;case"milliseconds":break}if(n==="weeks")if(t){let i=this.loc.getStartOfWeek(),{weekday:a}=this;a<i&&(r.weekNumber=this.weekNumber-1),r.weekday=i}else r.weekday=1;if(n==="quarters"){let i=Math.ceil(this.month/3);r.month=(i-1)*3+1}return this.set(r)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?C.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Ls}toLocaleString(e=he,t={}){return this.isValid?C.create(this.loc.clone(t),e).formatDateTime(this):Ls}toLocaleParts(e={}){return this.isValid?C.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:r=!1,includeOffset:n=!0,extendedZone:i=!1}={}){if(!this.isValid)return null;let a=e==="extended",o=Rs(this,a);return o+="T",o+=Xr(this,a,t,r,n,i),o}toISODate({format:e="extended"}={}){return this.isValid?Rs(this,e==="extended"):null}toISOWeekDate(){return Bt(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:r=!0,includePrefix:n=!1,extendedZone:i=!1,format:a="extended"}={}){return this.isValid?(n?"T":"")+Xr(this,a==="extended",t,e,r,i):null}toRFC2822(){return Bt(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Bt(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Rs(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:r=!0}={}){let n="HH:mm:ss.SSS";return(t||e)&&(r&&(n+=" "),t?n+="z":e&&(n+="ZZ")),Bt(this,n,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Ls}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}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",r={}){if(!this.isValid||!e.isValid)return p.invalid("created by diffing an invalid DateTime");let n={locale:this.locale,numberingSystem:this.numberingSystem,...r},i=Er(t).map(p.normalizeUnit),a=e.valueOf()>this.valueOf(),o=a?this:e,l=a?e:this,u=zr(o,l,i,n);return a?u.negate():u}diffNow(e="milliseconds",t={}){return this.diff(f.now(),e,t)}until(e){return this.isValid?v.fromDateTimes(this,e):this}hasSame(e,t,r){if(!this.isValid)return!1;let n=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,r)<=n&&n<=i.endOf(t,r)}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||f.fromObject({},{zone:this.zone}),r=e.padding?this<t?-e.padding:e.padding:0,n=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(n=e.unit,i=void 0),sn(t,this.plus(r),{...e,numeric:"always",units:n,unit:i})}toRelativeCalendar(e={}){return this.isValid?sn(e.base||f.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(f.isDateTime))throw new D("min requires all arguments be DateTimes");return vs(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(f.isDateTime))throw new D("max requires all arguments be DateTimes");return vs(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,r={}){let{locale:n=null,numberingSystem:i=null}=r,a=T.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});return _s(a,e,t)}static fromStringExplain(e,t,r={}){return f.fromFormatExplain(e,t,r)}static buildFormatParser(e,t={}){let{locale:r=null,numberingSystem:n=null}=t,i=T.fromOpts({locale:r,numberingSystem:n,defaultToEN:!0});return new St(i,e)}static fromFormatParser(e,t,r={}){if(m(e)||m(t))throw new D("fromFormatParser requires an input string and a format parser");let{locale:n=null,numberingSystem:i=null}=r,a=T.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});if(!a.equals(t.locale))throw new D(`fromFormatParser called with a locale of ${a}, but the format parser was created for ${t.locale}`);let{result:o,zone:l,specificOffset:u,invalidReason:c}=t.explainFromTokens(e);return c?f.invalid(c):$e(o,l,r,`format ${t.format}`,e,u)}static get DATE_SHORT(){return he}static get DATE_MED(){return Ye}static get DATE_MED_WITH_WEEKDAY(){return ts}static get DATE_FULL(){return Ge}static get DATE_HUGE(){return Je}static get TIME_SIMPLE(){return Ke}static get TIME_WITH_SECONDS(){return je}static get TIME_WITH_SHORT_OFFSET(){return Qe}static get TIME_WITH_LONG_OFFSET(){return Xe}static get TIME_24_SIMPLE(){return et}static get TIME_24_WITH_SECONDS(){return tt}static get TIME_24_WITH_SHORT_OFFSET(){return st}static get TIME_24_WITH_LONG_OFFSET(){return rt}static get DATETIME_SHORT(){return nt}static get DATETIME_SHORT_WITH_SECONDS(){return it}static get DATETIME_MED(){return at}static get DATETIME_MED_WITH_SECONDS(){return ot}static get DATETIME_MED_WITH_WEEKDAY(){return ss}static get DATETIME_FULL(){return lt}static get DATETIME_FULL_WITH_SECONDS(){return ut}static get DATETIME_HUGE(){return ct}static get DATETIME_HUGE_WITH_SECONDS(){return dt}};function Ue(s){if(f.isDateTime(s))return s;if(s&&s.valueOf&&X(s.valueOf()))return f.fromJSDate(s);if(s&&typeof s=="object")return f.fromObject(s);throw new D(`Unknown datetime argument: ${s}, of type ${typeof s}`)}var ln=require("obsidian"),ta=/[<>:"/\\|?*\u0000-\u001F]/g;var sa="-",ra=s=>s.replace(ta,sa);var un=s=>{let e=ra(s).trim();return(0,ln.normalizePath)(e)},se=(s,e="yyyy-MM-dd HH:mm:ss")=>{if(!s)return"";try{let t=f.fromISO(s);return t.isValid?t.toFormat(e):s}catch(t){return console.error("Error formatting date:",t),s}};var na=Object.prototype.toString,Ze=Array.isArray||function(e){return na.call(e)==="[object Array]"};function Us(s){return typeof s=="function"}function ia(s){return Ze(s)?"array":typeof s}function Hs(s){return s.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function cn(s,e){return s!=null&&typeof s=="object"&&e in s}function aa(s,e){return s!=null&&typeof s!="object"&&s.hasOwnProperty&&s.hasOwnProperty(e)}var oa=RegExp.prototype.test;function la(s,e){return oa.call(s,e)}var ua=/\S/;function ca(s){return!la(ua,s)}var da={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function ha(s){return String(s).replace(/[&<>"'`=\/]/g,function(t){return da[t]})}var fa=/\s*/,ma=/\s+/,dn=/\s*=/,ga=/\s*\}/,pa=/#|\^|\/|>|\{|&|=|!/;function ya(s,e){if(!s)return[];var t=!1,r=[],n=[],i=[],a=!1,o=!1,l="",u=0;function c(){if(a&&!o)for(;i.length;)delete n[i.pop()];else i=[];a=!1,o=!1}var h,y,g;function b(V){if(typeof V=="string"&&(V=V.split(ma,2)),!Ze(V)||V.length!==2)throw new Error("Invalid tags: "+V);h=new RegExp(Hs(V[0])+"\\s*"),y=new RegExp("\\s*"+Hs(V[1])),g=new RegExp("\\s*"+Hs("}"+V[1]))}b(e||B.tags);for(var S=new Ft(s),F,k,M,Y,re,P;!S.eos();){if(F=S.pos,M=S.scanUntil(h),M)for(var ne=0,ie=M.length;ne<ie;++ne)Y=M.charAt(ne),ca(Y)?(i.push(n.length),l+=Y):(o=!0,t=!0,l+=" "),n.push(["text",Y,F,F+1]),F+=1,Y===`
|
|
`&&(c(),l="",u=0,t=!1);if(!S.scan(h))break;if(a=!0,k=S.scan(pa)||"name",S.scan(fa),k==="="?(M=S.scanUntil(dn),S.scan(dn),S.scanUntil(y)):k==="{"?(M=S.scanUntil(g),S.scan(ga),S.scanUntil(y),k="&"):M=S.scanUntil(y),!S.scan(y))throw new Error("Unclosed tag at "+S.pos);if(k==">"?re=[k,M,F,S.pos,l,u,t]:re=[k,M,F,S.pos],u++,n.push(re),k==="#"||k==="^")r.push(re);else if(k==="/"){if(P=r.pop(),!P)throw new Error('Unopened section "'+M+'" at '+F);if(P[1]!==M)throw new Error('Unclosed section "'+P[1]+'" at '+F)}else k==="name"||k==="{"||k==="&"?o=!0:k==="="&&b(M)}if(c(),P=r.pop(),P)throw new Error('Unclosed section "'+P[1]+'" at '+S.pos);return wa(Ta(n))}function Ta(s){for(var e=[],t,r,n=0,i=s.length;n<i;++n)t=s[n],t&&(t[0]==="text"&&r&&r[0]==="text"?(r[1]+=t[1],r[3]=t[3]):(e.push(t),r=t));return e}function wa(s){for(var e=[],t=e,r=[],n,i,a=0,o=s.length;a<o;++a)switch(n=s[a],n[0]){case"#":case"^":t.push(n),r.push(n),t=n[4]=[];break;case"/":i=r.pop(),i[5]=n[2],t=r.length>0?r[r.length-1][4]:e;break;default:t.push(n)}return e}function Ft(s){this.string=s,this.tail=s,this.pos=0}Ft.prototype.eos=function(){return this.tail===""};Ft.prototype.scan=function(e){var t=this.tail.match(e);if(!t||t.index!==0)return"";var r=t[0];return this.tail=this.tail.substring(r.length),this.pos+=r.length,r};Ft.prototype.scanUntil=function(e){var t=this.tail.search(e),r;switch(t){case-1:r=this.tail,this.tail="";break;case 0:r="";break;default:r=this.tail.substring(0,t),this.tail=this.tail.substring(t)}return this.pos+=r.length,r};function Pe(s,e){this.view=s,this.cache={".":this.view},this.parent=e}Pe.prototype.push=function(e){return new Pe(e,this)};Pe.prototype.lookup=function(e){var t=this.cache,r;if(t.hasOwnProperty(e))r=t[e];else{for(var n=this,i,a,o,l=!1;n;){if(e.indexOf(".")>0)for(i=n.view,a=e.split("."),o=0;i!=null&&o<a.length;)o===a.length-1&&(l=cn(i,a[o])||aa(i,a[o])),i=i[a[o++]];else i=n.view[e],l=cn(n.view,e);if(l){r=i;break}n=n.parent}t[e]=r}return Us(r)&&(r=r.call(this.view)),r};function A(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}A.prototype.clearCache=function(){typeof this.templateCache!="undefined"&&this.templateCache.clear()};A.prototype.parse=function(e,t){var r=this.templateCache,n=e+":"+(t||B.tags).join(":"),i=typeof r!="undefined",a=i?r.get(n):void 0;return a==null&&(a=ya(e,t),i&&r.set(n,a)),a};A.prototype.render=function(e,t,r,n){var i=this.getConfigTags(n),a=this.parse(e,i),o=t instanceof Pe?t:new Pe(t,void 0);return this.renderTokens(a,o,r,e,n)};A.prototype.renderTokens=function(e,t,r,n,i){for(var a="",o,l,u,c=0,h=e.length;c<h;++c)u=void 0,o=e[c],l=o[0],l==="#"?u=this.renderSection(o,t,r,n,i):l==="^"?u=this.renderInverted(o,t,r,n,i):l===">"?u=this.renderPartial(o,t,r,i):l==="&"?u=this.unescapedValue(o,t):l==="name"?u=this.escapedValue(o,t,i):l==="text"&&(u=this.rawValue(o)),u!==void 0&&(a+=u);return a};A.prototype.renderSection=function(e,t,r,n,i){var a=this,o="",l=t.lookup(e[1]);function u(y){return a.render(y,t,r,i)}if(l){if(Ze(l))for(var c=0,h=l.length;c<h;++c)o+=this.renderTokens(e[4],t.push(l[c]),r,n,i);else if(typeof l=="object"||typeof l=="string"||typeof l=="number")o+=this.renderTokens(e[4],t.push(l),r,n,i);else if(Us(l)){if(typeof n!="string")throw new Error("Cannot use higher-order sections without the original template");l=l.call(t.view,n.slice(e[3],e[5]),u),l!=null&&(o+=l)}else o+=this.renderTokens(e[4],t,r,n,i);return o}};A.prototype.renderInverted=function(e,t,r,n,i){var a=t.lookup(e[1]);if(!a||Ze(a)&&a.length===0)return this.renderTokens(e[4],t,r,n,i)};A.prototype.indentPartial=function(e,t,r){for(var n=t.replace(/[^ \t]/g,""),i=e.split(`
|
|
`),a=0;a<i.length;a++)i[a].length&&(a>0||!r)&&(i[a]=n+i[a]);return i.join(`
|
|
`)};A.prototype.renderPartial=function(e,t,r,n){if(r){var i=this.getConfigTags(n),a=Us(r)?r(e[1]):r[e[1]];if(a!=null){var o=e[6],l=e[5],u=e[4],c=a;l==0&&u&&(c=this.indentPartial(a,u,o));var h=this.parse(c,i);return this.renderTokens(h,t,r,c,n)}}};A.prototype.unescapedValue=function(e,t){var r=t.lookup(e[1]);if(r!=null)return r};A.prototype.escapedValue=function(e,t,r){var n=this.getConfigEscape(r)||B.escape,i=t.lookup(e[1]);if(i!=null)return typeof i=="number"&&n===B.escape?String(i):n(i)};A.prototype.rawValue=function(e){return e[1]};A.prototype.getConfigTags=function(e){return Ze(e)?e:e&&typeof e=="object"?e.tags:void 0};A.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!Ze(e))return e.escape};var B={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(s){vt.templateCache=s},get templateCache(){return vt.templateCache}},vt=new A;B.clearCache=function(){return vt.clearCache()};B.parse=function(e,t){return vt.parse(e,t)};B.render=function(e,t,r,n){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+ia(e)+'" was given as the first argument for mustache#render(template, view, partials)');return vt.render(e,t,r,n)};B.escape=ha;B.Scanner=Ft;B.Context=Pe;B.Writer=A;var $s=B;var Ps=require("obsidian"),hn=["title","article_title","tags","create_time","update_time","domain","url","cubox_url","description","description","words_count","type","words_count","id"],Kt=class{constructor(){this.dateFormat="yyyy-MM-dd"}setDateFormat(e){this.dateFormat=e}processFilenameTemplate(e,t){if(!e)return t.title||"Untitled";let r={title:t.title||"",article_title:t.article_title||"",create_time:t.create_time?se(t.create_time,this.dateFormat):"",update_time:t.update_time?se(t.update_time,this.dateFormat):"",domain:t.domain||"",type:t.type||"",id:t.id||""},n="";try{n=$s.render(e,r)}catch(a){console.error("\u6A21\u677F\u6E32\u67D3\u5931\u8D25:",a),n=t.title||"Untitled"}let i=100;return n.length>i&&(n=n.substring(0,i)),un(n)}processFrontMatter(e,t){let r={id:t.id};if(e.length===0)return(0,Ps.stringifyYaml)(r);for(let n of e){let i=n.split("::"),a=i[0],o=i.length>1?i[1]:a;if(a==="tags"&&t.tags&&t.tags.length>0){r[o]=t.tags;continue}if(a==="create_time"&&t.create_time){r[o]=se(t.create_time,this.dateFormat);continue}if(a==="update_time"&&t.update_time){r[o]=se(t.update_time,this.dateFormat);continue}let l=this.getArticleProperty(t,a);l&&(r[o]=l)}return(0,Ps.stringifyYaml)(r)}processContentTemplate(e,t){if(!e){let n="";return t.content&&(n+=t.content+`
|
|
|
|
`),t.highlights&&t.highlights.length>0&&(n+=`## Highlights
|
|
|
|
`,t.highlights.forEach(i=>{n+=`- ${i.text}
|
|
`})),n}let r=this.createArticleView(t);return e.includes("content_highlighted")&&t.content&&t.highlights&&t.highlights.length>0&&(r.content_highlighted=this.generateHighlightedContent(t.content,t.highlights)),$s.render(e,r)}createArticleView(e){var r;let t={...e,highlights:[],tags:e.tags||[],highlights_length:((r=e.highlights)==null?void 0:r.length)||0,create_time:e.create_time?se(e.create_time,this.dateFormat):"",update_time:e.update_time?se(e.update_time,this.dateFormat):""};return e.highlights&&e.highlights.length>0&&(t.highlights=e.highlights.map(n=>this.createHighlightView(n))),t.highlights.length===0?t.highlights_length=0:t.highlights_length=t.highlights.length,t}createHighlightView(e){let t=e.text||"";!t&&e.image_url?t=``:t.includes(`
|
|
`)&&(t=t.split(`
|
|
`).map((o,l)=>l===0?o:o.trim()?"> "+o:">").join(`
|
|
`));let r=e.note&&e.note.trim()?e.note.trim()+`
|
|
`:"",n={...e,text:t,note:r,create_time:e.create_time?se(e.create_time,this.dateFormat):""};return n.cubox_url||(n.cubox_url=""),n}generateHighlightedContent(e,t){if(!e||!t||t.length===0)return e||"";let r=e.length,n=new Array(r).fill(!1);for(let o of t){let l=o.text;if(!l)continue;let u=0,c;for(;(c=e.indexOf(l,u))!==-1;){for(let h=0;h<l.length;h++)n[c+h]=!0;u=c+1}}let i="",a=!1;for(let o=0;o<r;o++){let l=n[o];l&&!a&&(i+="==",a=!0),!l&&a&&(i+="==",a=!1),i+=e[o]}return a&&(i+="=="),i}getArticleProperty(e,t){return e[t]}needsArticleContent(e){return e?e.includes("{{content}}")||e.includes("{{{content}}}")||e.includes("{{content_highlighted}}")||e.includes("{{{content_highlighted}}}"):!0}};var x=require("obsidian");var Zs=(s,e)=>{if(s==="cubox.pro")switch(e){case"filename":return"https://help.cubox.pro/share/obplugin/#%E6%96%87%E4%BB%B6%E5%90%8D%E6%A8%A1%E6%9D%BF";case"metadata":return"https://help.cubox.pro/share/obplugin/#%E5%85%83%E5%B1%9E%E6%80%A7";case"content":return"https://help.cubox.pro/share/obplugin/#%E5%86%85%E5%AE%B9%E6%A8%A1%E6%9D%BF";case"date":return"https://help.cubox.pro/share/obplugin/#%E6%97%A5%E6%9C%9F%E6%A0%BC%E5%BC%8F";default:return"#"}else if(s==="cubox.cc")switch(e){case"filename":return"https://help.cubox.cc/share/obplugin/#filename-template";case"metadata":return"https://help.cubox.cc/share/obplugin/#metadata";case"content":return"https://help.cubox.cc/share/obplugin/#content-template";case"date":return"https://help.cubox.cc/share/obplugin/#date-format";default:return"#"}return"#"},jt=(s,e)=>s?`<div class="cubox-reference">For more, refer to <a href="${Zs(s,e)}" class="reference-link" target="_blank">reference</a>.</div>`:'<div class="cubox-reference">For more, refer to <a href="#" class="reference-link">reference</a>.</div>',fn=s=>jt(s,"filename"),mn=s=>jt(s,"metadata"),gn=s=>jt(s,"content"),pn=s=>jt(s,"date"),yn=`
|
|
Enter template for creating synced article file name.
|
|
|
|
<div class="cubox-variables-container">
|
|
<div class="cubox-variables-title">Available variables</div>
|
|
<ul class="cubox-variables-list">
|
|
<li>{{{title}}}</li>
|
|
<li>{{{article_title}}}</li>
|
|
<li>{{{create_time}}}</li>
|
|
<li>{{{update_time}}}</li>
|
|
<li>{{{domain}}}</li>
|
|
<li>{{{type}}}</li>
|
|
</ul>
|
|
<div class="cubox-reference domain-reference-filename"></div>
|
|
</div>
|
|
`,Tn=`
|
|
Enter the metadata separated by comma. you can also use custom aliases in the format of metadata::alias. For syncing purposes, the id will always be included.
|
|
|
|
<div class="cubox-variables-container">
|
|
<div class="cubox-variables-title">Available variables</div>
|
|
<ul class="cubox-variables-list">
|
|
<li>title</li>
|
|
<li>article_title</li>
|
|
<li>tags</li>
|
|
<li>create_time</li>
|
|
<li>update_time</li>
|
|
<li>domain</li>
|
|
<li>url</li>
|
|
<li>cubox_url</li>
|
|
<li>description</li>
|
|
<li>words_count</li>
|
|
<li>type</li>
|
|
</ul>
|
|
<div class="cubox-reference domain-reference-metadata"></div>
|
|
</div>
|
|
`,wn=`
|
|
Enter template for creating synced article content.
|
|
|
|
<div class="cubox-variables-container">
|
|
<div class="cubox-variables-title">Available variables</div>
|
|
<ul class="cubox-variables-list">
|
|
<li>{{{id}}}</li>
|
|
<li>{{{title}}}</li>
|
|
<li>{{{description}}}</li>
|
|
<li>{{{article_title}}}</li>
|
|
<li>{{{content}}}</li>
|
|
<li>{{{content_highlighted}}}</li>
|
|
<li>{{{highlights}}}</li>
|
|
<li class="highlight-item">
|
|
<ul class="highlight-sublist">
|
|
<li>{{{text}}}</li>
|
|
<li>{{{image_url}}}</li>
|
|
<li>{{{cubox_url}}}</li>
|
|
<li>{{{note}}}</li>
|
|
<li>{{{color}}}</li>
|
|
<li>{{{create_time}}}</li>
|
|
</ul>
|
|
</li>
|
|
<li>{{{tags}}}</li>
|
|
<li>{{{create_time}}}</li>
|
|
<li>{{{update_time}}}</li>
|
|
<li>{{{domain}}}</li>
|
|
<li>{{{url}}}</li>
|
|
<li>{{{cubox_url}}}</li>
|
|
<li>{{{words_count}}}</li>
|
|
</ul>
|
|
<div class="cubox-reference domain-reference-content"></div>
|
|
</div>
|
|
`,En=`
|
|
If date is used on above templates, enter the format date.
|
|
|
|
<div class="cubox-variables-container">
|
|
<div class="cubox-variables-title">Example</div>
|
|
<ul class="cubox-variables-list">
|
|
<li>yyyy-MM-dd</li>
|
|
<li>MM/dd/yyyy</li>
|
|
<li>dd.MM.yyyy</li>
|
|
<li>yyyy-MM-dd HH:mm:ss</li>
|
|
</ul>
|
|
<div class="cubox-reference domain-reference-date"></div>
|
|
</div>
|
|
`;var Sn=require("obsidian"),Ea=`# {{{title}}}
|
|
|
|
{{{description}}}
|
|
|
|
[Read in Cubox]({{{cubox_url}}})
|
|
[Read Original]({{{url}}})
|
|
|
|
---
|
|
|
|
{{#highlights.length}}
|
|
## Annotations
|
|
|
|
{{#highlights}}
|
|
> {{{text}}}
|
|
|
|
{{#note}}
|
|
{{{note}}}
|
|
{{/note}}
|
|
[Link\uFE0F]({{{cubox_url}}})
|
|
|
|
{{/highlights}}
|
|
{{/highlights.length}}`,Te={domain:"",apiKey:"",folderFilter:[],typeFilter:[],statusFilter:[],isRead:!0,isStarred:!0,isAnnotated:!0,tagsFilter:[],syncFrequency:30,targetFolder:"Cubox",filenameTemplate:"{{{title}}}-{{{create_time}}}",frontMatterVariables:["id","cubox_url","url","tags"],contentTemplate:Ea,highlightInContent:!0,dateFormat:"yyyy-MM-dd",lastSyncTime:0,lastSyncCardId:null,lastCardUpdateTime:null,syncing:!1},Qt=class extends x.PluginSettingTab{constructor(t,r){super(t,r);this.plugin=r}display(){let{containerEl:t}=this;t.empty(),new x.Setting(t).setName("Cubox server domain").setDesc("Select the correct domain name of the Cubox you are using.").addDropdown(o=>o.addOption("","Choose region").addOption("cubox.cc","cubox.cc (international)").addOption("cubox.pro","cubox.pro").setValue(this.plugin.settings.domain).onChange(async l=>{this.plugin.settings.domain=l,await this.plugin.saveSettings(),this.updateApiKeySetting(),this.plugin.updateCuboxApiConfig(l,this.plugin.settings.apiKey),this.updateHelpLinks(l)})),this.apiKeySetting=new x.Setting(t).setName("Your Cubox API key").setDesc("Please select a region first").addText(o=>(o.setPlaceholder("Enter your API key").setValue(this.plugin.settings.apiKey).onChange(async l=>{let u=l.trim();if(u.includes("://"))try{let c=u.includes("://")?new URL(u):null;if(c){let h=c.pathname.split("/").filter(y=>y.length>0);h.length>0&&(u=h[h.length-1])}o.setValue(u)}catch(c){new x.Notice("Invalid API key")}this.plugin.settings.apiKey=u,await this.plugin.saveSettings(),this.plugin.updateCuboxApiConfig(this.plugin.settings.domain,u)}),this.plugin.settings.domain||(o.inputEl.disabled=!0),o)),this.updateApiKeySetting(),new x.Setting(t).setName("Filter").setHeading(),new x.Setting(t).setName("Folder filter").setDesc("Manage Cubox folders to be synced").addButton(o=>o.setButtonText(this.getFolderFilterButtonText()).setCta().onClick(async()=>{if(!this.plugin.settings.apiKey){new x.Notice("Please enter the API key first");return}o.setButtonText("Loading folders...");try{let l=await this.plugin.cuboxApi.getFolders();new bt(this.app,l,this.plugin.settings.folderFilter,async c=>{this.plugin.settings.folderFilter=c,await this.plugin.saveSettings(),o.setButtonText(this.getFolderFilterButtonText())}).open()}catch(l){console.error("\u83B7\u53D6\u6587\u4EF6\u5939\u5217\u8868\u5931\u8D25:",l),new x.Notice("Failed to get Cubox folders"),o.setButtonText(this.getFolderFilterButtonText())}o.setButtonText(this.getFolderFilterButtonText())})),new x.Setting(t).setName("Tag filter").setDesc("Manage Cubox tags to be synced").addButton(o=>o.setButtonText(this.getTagFilterButtonText()).setCta().onClick(async()=>{if(!this.plugin.settings.apiKey){new x.Notice("Please enter the API key first");return}o.setButtonText("Loading tags...");try{let l=await this.plugin.cuboxApi.getTags();new kt(this.app,l,this.plugin.settings.tagsFilter,async c=>{this.plugin.settings.tagsFilter=c,await this.plugin.saveSettings(),o.setButtonText(this.getTagFilterButtonText())}).open()}catch(l){console.error("\u83B7\u53D6\u6807\u7B7E\u5217\u8868\u5931\u8D25:",l),new x.Notice("Failed to get Cubox tags"),o.setButtonText(this.getTagFilterButtonText())}o.setButtonText(this.getTagFilterButtonText())})),new x.Setting(t).setName("Type filter").setDesc("Manage Cubox content types to be synced").addButton(o=>o.setButtonText(this.getTypeFilterButtonText()).setCta().onClick(async()=>{if(!this.plugin.settings.apiKey){new x.Notice("Please enter the API key first");return}new Ot(this.app,Ys(this.plugin.settings.typeFilter),async u=>{this.plugin.settings.typeFilter=u,await this.plugin.saveSettings(),o.setButtonText(this.getTypeFilterButtonText())},this.plugin.settings.domain).open()})),new x.Setting(t).setName("Status filter").setDesc("Manage Cubox content status to be synced").addButton(o=>o.setButtonText(this.getStatusFilterButtonText()).setCta().onClick(async()=>{if(!this.plugin.settings.apiKey){new x.Notice("Please enter the API key first");return}let l={read:this.plugin.settings.isRead,starred:this.plugin.settings.isStarred,annotated:this.plugin.settings.isAnnotated};new It(this.app,this.plugin.settings.statusFilter,l,async(c,h)=>{this.plugin.settings.statusFilter=c,this.plugin.settings.isRead=h.read,this.plugin.settings.isStarred=h.starred,this.plugin.settings.isAnnotated=h.annotated,await this.plugin.saveSettings(),o.setButtonText(this.getStatusFilterButtonText())}).open()})),new x.Setting(t).setName("Sync").setHeading(),new x.Setting(t).setName("Sync interval").setDesc("Auto sync interval (in minutes). 0 means manual sync. Each item syncs only once. Subsequent updates won't be synced, and modifications in Obsidian won't affect Cubox. We recommend avoiding frequent updates.").addText(o=>o.setPlaceholder("Enter the interval").setValue(String(this.plugin.settings.syncFrequency)).onChange(async u=>{let c=parseInt(u);if(isNaN(c)){new x.Notice("Frequency must be a positive integer");return}c=Math.min(c,9999),this.plugin.settings.syncFrequency=c,await this.plugin.saveSettings(),this.plugin.setupAutoSync(),o.setValue(String(c))})),new x.Setting(t).setName("Folder").setDesc("Select the folder you'd like to sync to").addText(o=>o.setPlaceholder("Enter target folder path").setValue(this.plugin.settings.targetFolder).onChange(async l=>{this.plugin.settings.lastSyncCardId=null,this.plugin.settings.targetFolder=(0,Sn.normalizePath)(l),await this.plugin.saveSettings()}));let r=document.createRange().createContextualFragment(yn);new x.Setting(t).setName("File name template").setDesc(r).addText(o=>o.setPlaceholder("Enter file name template").setValue(this.plugin.settings.filenameTemplate).onChange(async l=>{this.plugin.settings.filenameTemplate=l,await this.plugin.saveSettings()})).addExtraButton(o=>o.setIcon("reset").setTooltip("Reset to default").onClick(async()=>{var u,c;this.plugin.settings.filenameTemplate=Te.filenameTemplate,await this.plugin.saveSettings();let l=(c=(u=o.extraSettingsEl.parentElement)==null?void 0:u.parentElement)==null?void 0:c.querySelector("input");l&&(l.value=Te.filenameTemplate)}));let n=document.createRange().createContextualFragment(Tn);new x.Setting(t).setName("Metadata variables").setDesc(n).addTextArea(o=>o.setPlaceholder("Enter front matter variables").setValue(this.plugin.settings.frontMatterVariables.join(",")).onChange(async l=>{this.plugin.settings.frontMatterVariables=l.split(",").map(u=>u.trim()).filter((u,c,h)=>hn.includes(u.split("::")[0])&&h.indexOf(u)===c),await this.plugin.saveSettings()}).then(l=>{l.inputEl.rows=20,l.inputEl.cols=30})).addExtraButton(o=>{o.setIcon("reset").setTooltip("Reset to default").onClick(async()=>{var u,c;this.plugin.settings.frontMatterVariables=Te.frontMatterVariables,await this.plugin.saveSettings();let l=(c=(u=o.extraSettingsEl.parentElement)==null?void 0:u.parentElement)==null?void 0:c.querySelector("textarea");l&&(l.value=Te.frontMatterVariables.join(","))})});let i=document.createRange().createContextualFragment(wn);new x.Setting(t).setName("Content template").setDesc(i).addTextArea(o=>o.setPlaceholder("Enter content template").setValue(this.plugin.settings.contentTemplate).onChange(async l=>{this.plugin.settings.contentTemplate=l,await this.plugin.saveSettings()}).then(l=>{l.inputEl.rows=24,l.inputEl.cols=30})).addExtraButton(o=>{o.setIcon("reset").setTooltip("Reset to default").onClick(async()=>{var u,c;this.plugin.settings.contentTemplate=Te.contentTemplate,await this.plugin.saveSettings();let l=(c=(u=o.extraSettingsEl.parentElement)==null?void 0:u.parentElement)==null?void 0:c.querySelector("textarea");l&&(l.value=Te.contentTemplate)})});let a=document.createRange().createContextualFragment(En);new x.Setting(t).setName("Date format").setDesc(a).addText(o=>o.setPlaceholder("Enter date format").setValue(this.plugin.settings.dateFormat).onChange(async l=>{this.plugin.settings.dateFormat=l,await this.plugin.saveSettings(),this.plugin.updateTemplateProcessorDateFormat(l)})),new x.Setting(t).setName("Status").setHeading(),new x.Setting(t).setDesc(`Last sync: ${this.plugin.formatLastSyncTime()}`),setTimeout(()=>{this.updateHelpLinks(this.plugin.settings.domain)},100)}updateApiKeySetting(){let t=this.plugin.settings.domain,r=this.apiKeySetting.components[0];if(!t)this.apiKeySetting.setDesc("Please select a region first"),r.inputEl.disabled=!0;else{let n=`https://${t}/web/settings/extensions`,i=this.apiKeySetting.descEl;i.empty(),i.appendChild(createSpan({text:"You can create a key in the "})),i.appendChild(createEl("a",{text:"Extension settings",href:n,attr:{target:"_blank",rel:"noopener"}})),i.appendChild(createSpan({text:" of Cubox web app."})),r.inputEl.disabled=!1}}updateHelpLinks(t){let r=(n,i)=>{let a=document.querySelector(n);if(a){a.empty();let o=a.createSpan({text:"For more, refer to "}),l=t?Zs(t,n.includes("filename")?"filename":n.includes("metadata")?"metadata":n.includes("content")?"content":"date"):"#",u=o.createEl("a",{text:"reference",cls:"reference-link",href:l});t&&u.setAttribute("target","_blank"),o.createSpan({text:"."})}};r(".domain-reference-filename",fn),r(".domain-reference-metadata",mn),r(".domain-reference-content",gn),r(".domain-reference-date",pn)}getFolderFilterButtonText(){let t=this.plugin.settings.folderFilter;return!t||t.length===0?"Select...":t.includes(R)?"All folders":`${t.length} selected`}getTypeFilterButtonText(){let t=this.plugin.settings.typeFilter;return!t||t.length===0?"Select...":Js(t)?"All types":`${t.length} selected`}getStatusFilterButtonText(){let t=this.plugin.settings.statusFilter;return!t||t.length===0?"Select...":t.includes("all")?"All items":`${t.length} selected`}getTagFilterButtonText(){let t=this.plugin.settings.tagsFilter;return!t||t.length===0?"Select...":t.includes(H)?"All items":t.includes("")?"No tags":`${t.length} selected`}};var Xt=class extends L.Plugin{async onload(){await this.loadSettings(),this.cuboxApi=new Dt(this.settings.domain,this.settings.apiKey),this.templateProcessor=new Kt,this.templateProcessor.setDateFormat(this.settings.dateFormat);let t="Cubox";(0,L.addIcon)(t,'<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_812_101)"><path d="M20.0858 18.3243C19.9877 24.0475 16.415 23.8861 11.8868 23.8861C7.35861 23.8861 5.01758 22.9138 5.01758 17.9719C5.01758 12.8223 7.35861 9 11.8868 9C16.415 9 20.0858 13.1746 20.0858 18.3243Z" stroke="currentColor" stroke-width="2"/><rect x="2" y="2" width="20" height="20" rx="10" stroke="currentColor" stroke-width="2"/></g><ellipse cx="9" cy="15.15" rx="1" ry="1.15" fill="currentColor"/><ellipse cx="12" cy="15.15" rx="1" ry="1.15" fill="currentColor"/><defs> <clipPath id="clip0_812_101"><rect x="1" y="1" width="22" height="22" rx="11" fill="white"/></clipPath></defs></svg>'),this.addRibbonIcon(t,t,async n=>{new L.Notice("Syncing your Cubox\u2026"),await this.syncCubox()}).addClass("cubox-sync-ribbon-class"),this.addCommand({id:"sync-cubox-data",name:"Sync now",callback:async()=>{await this.syncCubox()}}),this.addSettingTab(new Qt(this.app,this)),this.setupAutoSync()}onunload(){this.syncIntervalId&&window.clearInterval(this.syncIntervalId)}async loadSettings(){this.settings=Object.assign({},Te,await this.loadData()),this.settings.typeFilter=Bs(this.settings.typeFilter)}async saveSettings(){await this.saveData(this.settings)}async setupAutoSync(){this.syncIntervalId&&window.clearInterval(this.syncIntervalId),this.settings.syncFrequency>0&&(this.syncIntervalId=window.setInterval(async()=>await this.syncCubox(),this.settings.syncFrequency*60*1e3),this.registerInterval(this.syncIntervalId))}async syncCubox(){var t,r;if(this.settings.syncing){new L.Notice("Sync is in progress, please wait.");return}if(this.settings.folderFilter.length===0||this.settings.typeFilter.length===0||this.settings.statusFilter.length===0||this.settings.tagsFilter.length===0){new L.Notice("Please select the filter first");return}try{this.settings.syncing=!0,await this.saveSettings(),await this.ensureTargetFolder();let n=this.settings.lastSyncCardId,i=this.settings.lastCardUpdateTime,a=!0,o=0,l=0,u=0;for(;a;){let h=await this.cuboxApi.getArticles({lastCardId:n,lastCardUpdateTime:i,folderFilter:this.settings.folderFilter,typeFilter:this.settings.typeFilter,statusFilter:this.settings.statusFilter,tagsFilter:this.settings.tagsFilter,isRead:this.settings.isRead,isStarred:this.settings.isStarred,isAnnotated:this.settings.isAnnotated}),{articles:y,hasMore:g}=h,b=this.templateProcessor.needsArticleContent(this.settings.contentTemplate);if(y.length===0)break;for(let S of y)try{let F={...S};if(b){let ie=await this.cuboxApi.getArticleDetail(S.id);if(ie===null)continue;F.content=ie}let k=this.templateProcessor.processFilenameTemplate(this.settings.filenameTemplate,F),M=`${this.settings.targetFolder}/${k}.md`,Y=this.app.vault.getAbstractFileByPath(M);if(Y instanceof L.TFile){let ie=!1,V=(r=(t=this.app.metadataCache.getFileCache(Y))==null?void 0:t.frontmatter)==null?void 0:r.id;if(V&&V===S.id&&(ie=!0),ie){u++;continue}}let re=this.templateProcessor.processFrontMatter(this.settings.frontMatterVariables,F),P=this.templateProcessor.processContentTemplate(this.settings.contentTemplate,F),ne="";re.length>0&&(ne=`---
|
|
${re}
|
|
---
|
|
`),ne+=P,await this.app.vault.create(M,ne),o++}catch(F){l++,console.error("\u540C\u6B65 Cubox \u6570\u636E\u5931\u8D25:",F)}a=g,y.length>0&&(n=y[y.length-1].id,i=y[y.length-1].update_time,this.settings.lastSyncCardId=n,this.settings.lastCardUpdateTime=i,await this.saveSettings())}this.settings.lastSyncTime=Date.now(),this.settings.syncing=!1,await this.saveSettings();let c=`Cubox sync completed: ${o} new items${u>0?`, ${u} skipped`:""}${l>0?`, ${l} errors`:""}`;new L.Notice(c)}catch(n){if(console.error("\u540C\u6B65 Cubox \u6570\u636E\u5931\u8D25:",n),n instanceof Be){new L.Notice("Cubox API Key not found. Please set your API Key in plugin settings and try again.");return}new L.Notice("Cubox sync failed. Please check settings or network.")}finally{this.settings.syncing=!1,await this.saveSettings()}}async ensureTargetFolder(){let t=this.settings.targetFolder;this.app.vault.getAbstractFileByPath(t)instanceof L.TFolder||await this.app.vault.createFolder(t)}formatLastSyncTime(){return this.settings.lastSyncTime?se(new Date(this.settings.lastSyncTime).toISOString(),"yyyy-MM-dd HH:mm"):"never"}updateCuboxApiConfig(t,r){this.cuboxApi.updateConfig(t,r)}updateTemplateProcessorDateFormat(t){this.templateProcessor.setDateFormat(t)}};
|
|
/*! Bundled license information:
|
|
|
|
mustache/mustache.mjs:
|
|
(*!
|
|
* mustache.js - Logic-less {{mustache}} templates with JavaScript
|
|
* http://github.com/janl/mustache.js
|
|
*)
|
|
*/
|
|
|
|
/* nosourcemap */ |