1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[36080],{36080:(e,t,n)=>{n.r(t),n.d(t,{default:()=>K});var a=n(95155),r=n(12115),l=n(97003),s=n(27784),i=n(33789),o=n(90235),d=n(67001),u=n(33534);let h={id:"a4",label:"A4 (210 x 297 mm)",wMm:210,hMm:297},c=[h,{id:"letter",label:"Letter (8.5 x 11 in)",wMm:215.9,hMm:279.4},{id:"legal",label:"Legal (8.5 x 14 in)",wMm:215.9,hMm:355.6},{id:"a3",label:"A3 (297 x 420 mm)",wMm:297,hMm:420},{id:"a5",label:"A5 (148 x 210 mm)",wMm:148,hMm:210},{id:"tabloid",label:"Tabloid (11 x 17 in)",wMm:279.4,hMm:431.8}],m=["January","February","March","April","May","June","July","August","September","October","November","December"],g=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function p(e){return m[e-1]??""}function f(e){return String(e).padStart(2,"0")}function x(e,t,n){return new Date(e,t,n)}function y(e,t){return new Date(e,t,0).getDate()}function b(e){return`${e.getFullYear()}-${f(e.getMonth()+1)}-${f(e.getDate())}`}function w(e,t,n){let a=12*e+(t-1)+n;return{year:Math.floor(a/12),month:(a%12+12)%12+1}}function k(e,t){return e.length>t?`${e.slice(0,t-1)}\u2026`:e}function v(e,t){return e.length>90&&(t.titlesShortened+=1),k(e,90)}let N=0;function j(e){return N+=1,`${e}${N.toString(36)}`}function S(e,t,n){if(!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(n)||t<1||t>12||n<1||n>31)return null;let a=x(e,t-1,n);return a.getFullYear()!==e||a.getMonth()!==t-1||a.getDate()!==n?null:a}function $(e,t,n){if(t<1||t>12)return`there is no month ${t}`;if(n<1)return`there is no day ${n}`;let a=y(e,t);return n>a?`${p(t)} ${e} has only ${a} days`:"that is not a real date"}function M(e){return e<70?2e3+e:1900+e}let D=new Map;function T(e,t,n){for(let a=n.start.getFullYear();a<=n.end.getFullYear();a++){let r=S(a,e,t);if(r&&r>=n.start&&r<=n.end)return a}return n.start.getFullYear()}function E(e,t){let n=e.trim(),a=/^(\d{4})(\d{2})(\d{2})$/.exec(n);if(a){let e=S(Number(a[1]),Number(a[2]),Number(a[3]));return e?{date:e,kind:"date"}:null}let r=/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(Z?)$/.exec(n);if(!r)return null;let l=Number(r[1]),s=Number(r[2]),i=Number(r[3]);if("Z"===r[7]){let e=new Date(Date.UTC(l,s-1,i,Number(r[4]),Number(r[5]),Number(r[6])));return Number.isNaN(e.getTime())?null:{date:x(e.getFullYear(),e.getMonth(),e.getDate()),kind:"utc"}}let o=S(l,s,i);return o?{date:o,kind:t.TZID?"tzid":"floating"}:null}m.forEach((e,t)=>{D.set(e.toLowerCase(),t+1),D.set(e.slice(0,3).toLowerCase(),t+1)}),D.set("sept",9);let C=new Set(["DAILY","WEEKLY","MONTHLY","YEARLY"]),F={SU:0,MO:1,TU:2,WE:3,TH:4,FR:5,SA:6},A=["VALARM","VTODO","VJOURNAL","VFREEBUSY","VTIMEZONE"];function L(e){if(e.length<=73)return e;let t=[],n=0;for(;n<e.length;){let a=0===n?73:72;t.push((0===n?"":" ")+e.slice(n,n+a)),n+=a}return t.join("\r\n")}let Y="printableCalendar_v1",O={year:2026,month:1,months:1,weekStart:0,paper:"a4",landscape:!1,marginMm:8,weekNumbers:"off",weekendShade:!0,showAdjacent:!0,showDates:!0,noteLines:0,textSize:"medium",ink:"gray",title:"",subtitle:"",dateOrder:"mdy"},z=(e,t,n,a)=>{let r=Math.round(Number(e));return Number.isFinite(r)?Math.max(t,Math.min(n,r)):a},R=(e,t,n)=>t.includes(e)?e:n,I=(e,t)=>"string"==typeof e?e.slice(0,t):"";function W(e,t){if(!e||"object"!=typeof e)return t;let n=c.map(e=>e.id);return{year:z(e.year,1900,2200,t.year),month:z(e.month,1,12,t.month),months:z(e.months,1,12,t.months),weekStart:1===e.weekStart||6===e.weekStart?e.weekStart:0,paper:"string"==typeof e.paper&&n.includes(e.paper)?e.paper:t.paper,landscape:!0===e.landscape,marginMm:z(e.marginMm,0,25,t.marginMm),weekNumbers:R(e.weekNumbers,["off","iso","us"],t.weekNumbers),weekendShade:!1!==e.weekendShade,showAdjacent:!1!==e.showAdjacent,showDates:!1!==e.showDates,noteLines:z(e.noteLines,0,4,t.noteLines),textSize:R(e.textSize,["small","medium","large"],t.textSize),ink:R(e.ink,["gray","black"],t.ink),title:I(e.title,60),subtitle:I(e.subtitle,60),dateOrder:R(e.dateOrder,["dmy","mdy"],t.dateOrder)}}function U(e,t){let n=t=>null!==e.get(t);if(!n("y")&&!n("m")&&!n("p"))return t;let a=(t,n,a)=>{let r=e.get(t);return null===r?a:n(r)};return W({year:e.get("y")??t.year,month:e.get("m")??t.month,months:e.get("n")??t.months,weekStart:Number(e.get("ws")??t.weekStart),paper:e.get("p")??t.paper,landscape:a("land",e=>"1"===e,t.landscape),marginMm:e.get("mg")??t.marginMm,weekNumbers:e.get("wk")??t.weekNumbers,weekendShade:a("we",e=>"0"!==e,t.weekendShade),showAdjacent:a("adj",e=>"0"!==e,t.showAdjacent),showDates:a("dates",e=>"0"!==e,t.showDates),noteLines:e.get("lines")??t.noteLines,textSize:e.get("ts")??t.textSize,ink:e.get("ink")??t.ink,title:t.title,subtitle:t.subtitle,dateOrder:t.dateOrder},t)}let J={small:5.6,medium:6.6,large:7.8};function V({grid:e,config:t,wMm:n,hMm:r,byDay:l,fit:s,last:i}){let o=Math.sqrt(n*r/62370),d=Math.max(5,(J[t.textSize]??6.6)*o),u=Math.max(6,9.5*o),h=Math.max(11,20*o),c=Math.max(7,10*o),m=Math.max(6,8.5*o),p=Math.max(5,6.4*o),f="black"===t.ink?"#000000":"#8c8c8c",x="black"===t.ink?"#444444":"#aaaaaa",y="black"===t.ink?"#e3e3e3":"#f2f2f2",b="off"!==t.weekNumbers,w=`${b?`${(9*o).toFixed(2)}mm `:""}repeat(7, 1fr)`,k=`${(3.1*o).toFixed(2)}mm`,v=Array.from({length:7},(e,n)=>g[(t.weekStart+n)%7]??"");return(0,a.jsxs)("div",{className:`pcg-sheet${i?" pcg-last":""}`,style:{width:`${n}mm`,height:`${r}mm`,padding:`${t.marginMm}mm`},children:[(0,a.jsxs)("div",{className:"pcg-head",children:[t.title?(0,a.jsx)("div",{className:"pcg-title",style:{fontSize:`${c}pt`},children:t.title}):null,(0,a.jsx)("div",{className:"pcg-month",style:{fontSize:`${h}pt`},children:e.label}),t.subtitle?(0,a.jsx)("div",{className:"pcg-sub",style:{fontSize:`${c}pt`,color:x},children:t.subtitle}):null]}),(0,a.jsxs)("div",{className:"pcg-dow",style:{gridTemplateColumns:w,fontSize:`${m}pt`},children:[b?(0,a.jsx)("div",{style:{color:x,fontSize:`${p}pt`},children:"Wk"}):null,v.map((e,t)=>(0,a.jsx)("div",{children:e},`${e}-${t}`))]}),(0,a.jsx)("div",{className:"pcg-grid",style:{gridTemplateColumns:w,borderColor:f},children:e.rows.flatMap((e,n)=>{let r=[];for(let o of(b&&r.push((0,a.jsx)("div",{className:"pcg-wk",style:{borderColor:f,color:x,fontSize:`${p}pt`},children:"iso"===t.weekNumbers?e.isoWeek:e.usWeek},`wk-${n}`)),e.days)){var i;let e=o.inMonth?l.get(o.key)??[]:[],n=s?Math.min(s[o.key]??e.length,e.length):e.length,h=e.length-n;r.push((0,a.jsxs)("div",{className:"pcg-cell",style:{borderColor:f},children:[t.weekendShade&&(0===(i=o.weekday)||6===i)?(0,a.jsx)("svg",{className:"pcg-shade",viewBox:"0 0 4 4",preserveAspectRatio:"none","aria-hidden":"true",children:(0,a.jsx)("rect",{x:"0",y:"0",width:"4",height:"4",fill:y})}):null,t.showDates&&(o.inMonth||t.showAdjacent)?(0,a.jsx)("div",{className:"pcg-num",style:{fontSize:`${u}pt`,color:o.inMonth?"#000000":x},children:o.day}):null,o.inMonth?(0,a.jsxs)("ul",{className:"pcg-ev","data-pcg-day":o.key,style:{fontSize:`${d}pt`,lineHeight:`${(1.22*d).toFixed(2)}pt`},children:[e.slice(0,n).map(e=>(0,a.jsx)("li",{children:e.title},e.id)),h>0?(0,a.jsx)("li",{className:"pcg-more",children:`+${h} more`}):null]}):null,t.noteLines>0&&o.inMonth?(0,a.jsx)("div",{className:"pcg-lines",children:Array.from({length:t.noteLines},(e,t)=>(0,a.jsx)("div",{className:"pcg-line",style:{borderColor:x,height:k}},t))}):null]},o.key))}return r})})]})}var B=n(52863),P=n(14827),q=n(81322);let G=96/25.4,H="3/17 Ella birthday\n3/20 Dentist 9am\n3/28 Term ends\n2026-03-14 Pi Day",Z="h-9 w-full rounded-md border border-input bg-background px-2 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring";function _(e){let[t,n,a]=e.split("-"),r=m[Number(n)-1]??"";return`${r} ${Number(a)}, ${t}`}function K(){var e;let[t,n]=(0,r.useState)(O),[g,N]=(0,r.useState)(""),[z,R]=(0,r.useState)(""),[I,J]=(0,r.useState)(""),[K,Q]=(0,r.useState)(""),[X,ee]=(0,r.useState)(!1),[et,en]=(0,r.useState)(""),[ea,er]=(0,r.useState)(""),[el,es]=(0,r.useState)(!1),ei=(0,r.useRef)(null),eo=(0,r.useRef)(null),ed=(0,r.useRef)(null),eu=(0,r.useRef)(!1),eh=(0,r.useRef)(0),ec=(0,r.useCallback)((e,t)=>{n(n=>{let a={...n};return a[e]=t,a})},[]);(0,r.useEffect)(()=>
1{if(eu.current)return;eu.current=!0;let e=new Date,t={...O,year:e.getFullYear(),month:e.getMonth()+1,weekStart:function(){try{let e=new Intl.Locale(navigator.language),t="function"==typeof e.getWeekInfo?e.getWeekInfo():e.weekInfo,n=t?.firstDay;if(7===n)return 0;if(1===n)return 1;if(6===n)return 6}catch{}return 0}()},a=function(e){try{let t=window.localStorage.getItem(Y);if(!t)return null;let n=JSON.parse(t),a=n&&"object"==typeof n?n:{},r=W(a.c,e),l=12*r.year+r.month<12*e.year+e.month,s="string"==typeof a.e?a.e:"";return{config:l?{...r,year:e.year,month:e.month}:r,events:s.slice(0,4e4),cut:Math.max(0,s.length-4e4)}}catch{return null}}(t),r=e=>{N(e.events),R(e.events),e.cut>0&&en(`Your saved list was longer than this keeps, so the last ${e.cut} characters were cut. Paste them back before you change anything, or they go for good when this saves again.`)},l=window.location.hash.replace(/^#/,""),s=l.startsWith("c=")?function(e,t){try{let n=e.length%4?"=".repeat(4-e.length%4):"",a=atob(e.replace(/-/g,"+").replace(/_/g,"/")+n),r=new Uint8Array(a.length);for(let e=0;e<a.length;e++)r[e]=a.charCodeAt(e);let l=JSON.parse(new TextDecoder().decode(r));if(!l||"object"!=typeof l)return null;return{v:1,c:W(l.c,t),e:"string"==typeof l.e?l.e.slice(0,4e4):""}}catch{return null}}(l.slice(2),t):null;if(s){n(s.c),N(s.e),R(s.e),en(a&&a.events.trim().length>0?"Opened the calendar from that link, and changing anything here changes only your copy. The dates you had saved on this browser are untouched until you change this one, and opening the page without the link brings them back.":"Opened the calendar from that link. Changing anything here changes only your copy."),ee(!0);return}let i=new URLSearchParams(window.location.search);if(U(i,t)!==t){n(U(i,a?a.config:t)),a&&r(a),ee(!0);return}if(a){n(a.config),r(a),ee(!0);return}n(t),ee(!0)},[]),(0,s.Vd)(Y,()=>JSON.stringify({v:1,c:t,e:g}),[t,g]),(0,r.useEffect)(()=>{let e=window.setTimeout(()=>R(g),250);return()=>window.clearTimeout(e)},[g]);let em=(e=t.paper,c.find(t=>t.id===e)??h),eg=t.landscape?em.hMm:em.wMm,ep=t.landscape?em.wMm:em.hMm,ef=(0,r.useMemo)(()=>(function(e,t,n,a){let r=[];for(let l=0;l<n;l++){let n=w(e,t,l);r.push(function(e,t,n){let a=x(e,t-1,1),r=(a.getDay()-n+7)%7,l=y(e,t),s=[];for(let n=0;n<6;n++){let i=[];for(let a=0;a<7;a++){let s=7*n+a-r,o=x(e,t-1,1+s);i.push({date:o,key:b(o),day:o.getDate(),weekday:o.getDay(),inMonth:s>=0&&s<l})}let o=i.find(e=>4===e.weekday)?.date??i[0]?.date??a,d=function(e){let t=x(e.getFullYear(),e.getMonth(),e.getDate()),n=0===t.getDay()?7:t.getDay();t.setDate(t.getDate()+(4-n));let a=t.getFullYear(),r=x(a,0,4),l=0===r.getDay()?7:r.getDay();return r.setDate(r.getDate()+(4-l)),{week:1+Math.round((t.getTime()-r.getTime())/6048e5),year:a}}(o);s.push({days:i,isoWeek:d.week,isoYear:d.year,usWeek:function(e){let t=e.getFullYear(),n=x(t,0,1);return Math.floor((Math.round((x(t,e.getMonth(),e.getDate()).getTime()-n.getTime())/864e5)+1+n.getDay()-1)/7)+1}(o)})}return{year:e,month:t,label:`${p(t)} ${e}`,rows:s,sixRows:r+l>35}}(n.year,n.month,a))}return r})(t.year,t.month,t.months,t.weekStart),[t.year,t.month,t.months,t.weekStart]),ex=(0,r.useMemo)(()=>(function(e,t,n){let a=w(e,t,Math.max(1,n)-1);return{start:x(e,t-1,1),end:x(a.year,a.month-1,y(a.year,a.month))}})(t.year,t.month,t.months),[t.year,t.month,t.months]),ey=(0,r.useMemo)(()=>{let e={unreadable:[],ambiguous:[],outOfRange:[],outOfRangeTotal:0,unexpanded:[],notes:[],tzIgnored:0,utcShifted:0,duplicates:0,titlesShortened:0},n=function(e,t,n,a){let r=[],l=e.split(/\r?\n/);l.length>600&&a.notes.push(`Your list is ${l.length} lines long and only the first 600 were read, so ${l.length-600} lines were left off.`);let s=Math.min(l.length,600);for(let e=0;e<s;e++){let s=(l[e]??"").trim();if(!s||s.startsWith("#"))continue;let i=function(e,t,n){let a=/^(\d{4})-(\d{1,2})-(\d{1,2})(?![\d-])/.exec(e);if(a){let e=Number(a[1]),t=Number(a[2]),n=Number(a[3]),r=S(e,t,n);return r?{ok:!0,hit:{date:r,consumed:a[0].length,ambiguous:null}}:{ok:!1,reason:$(e,t,n)}}let r=/^(\d{1,2})[-/.](\d{1,2})(?:[-/.](\d{2}|\d{4}))?(?![\d./-])/.exec(e);if(r){let e=Number(r[1]),a=Number(r[2]),l=r[3],s="dmy"===t,i=s?a:e,o=s?e:a,d=void 0===l?T(i,o,n):2===l.length?M(Number(l)):Number(l),u=S(d,i,o);if(!u)return S(void 0===l?T(o,i,n):2===l.length?M(Number(l)):Number(l),o,i)?{ok:!1,reason:s?`dates are set to read day first, so this is day ${e} of month ${a}, which does not exist. Switch to month first if you meant ${p(e)} ${a}`:`dates are set to read month first, so there is no month ${e}. Switch to day first if you meant ${e} ${p(a)}`}:{ok:!1,reason:$(d,i,o)};let h=e!==a&&e>=1&&e<=12&&a>=1&&a<=12;return{ok:!0,hit:{date:u,consumed:r[0].length,ambiguous:h?`${p(i)} ${o}`:null}}}let l=/^([A-Za-z]{3,9})\.?\s+(\d{1,2})(?:st|nd|rd|th)?(?:,?\s+(\d{4}))?(?!\w)/.exec(e);if(l){let e=D.get((l[1]??"").toLowerCase());if(void 0!==e){let t=Number(l[2]),a=l[3],r=void 0===a?T(e,t,n):Number(a),s=S(r,e,t);return s?{ok:!0,hit:{date:s,consumed:l[0].length,ambiguous:null}}:{ok:!1,reason:$(r,e,t)}}}let s=/^(\d{1,2})(?:st|nd|rd|th)?\s+([A-Za-z]{3,9})\.?(?:,?\s+(\d{4}))?(?!\w)/.exec(e);if(s){let e=D.get((s[2]??"").toLowerCase());if(void 0!==e){let t=Number(s[1]),a=s[3],r=void 0===a?T(e,t,n):Number(a),l=S(r,e,t);return l?{ok:!0,hit:{date:l,consumed:s[0].length,ambiguous:null}}:{ok:!1,reason:$(r,e,t)}}}return{ok:!1,reason:"no date at the start of the line"}}(s,t,n);if(!i.ok){a.unreadable.push({line:e+1,text:k(s,70),reason:i.reason});continue}let o=s.slice(i.hit.consumed).replace(/^[\s,:-]+/,"").trim();if(!o){a.unreadable.push({line:e+1,text:k(s,70),reason:"there is a date here but nothing to print after it"});continue}if(i.hit.ambiguous&&a.ambiguous.push({line:e+1,text:k(s,70),reading:i.hit.ambiguous}),r.push({id:j("t"),date:i.hit.date,key:b(i.hit.date),title:v(o,a),source:"typed",repeated:!1}),r.length>=1200){a.notes.push("Stopped after 1200 events from your typed list.");break}}return r}(z,t.dateOrder,ex,e),a=I?function(e,t,n){let a=[],r=e.replace(/^\uFEFF/,"");r.length>15e5&&(n.notes.push(`That calendar file is very large, so only the first ${Math.round(1500)} thousand characters were read.`),r=r.slice(0,15e5));let l=r.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),s=[];for(let e of l.split("\n"))(e.startsWith(" ")||e.startsWith(" "))&&s.length>0?s[s.length-1]=`${s[s.length-1]??""}${e.slice(1)}`:s.push(e);if(!s.some(e=>e.toUpperCase().startsWith("BEGIN:VCALENDAR"))){let e=s.find(e=>e.trim().length>0)??"";return n.unreadable.push({line:1,text:k(e,70),reason:e?"this is not a calendar file, it has no BEGIN:VCALENDAR line":"the file is empty"}),a}let i=new Set,o=null,d=0,u=0,h=0,c=0,m=0,g=0,p=!1,f=e=>{if(!e.start){h+=1;return}let r=E(e.start.value,e.start.params);if(!r){c+=1;return}"tzid"===r.kind&&(n.tzIgnored+=1),"utc"===r.kind&&(n.utcShifted+=1);let l=v(e.summary.replace(/\s+/g," ").trim()||"Untitled event",n),s=1;if("date"===r.kind&&e.end){let t=E(e.end.value,e.end.params);if(t&&"date"===t.kind){let e=Math.round((t.date.getTime()-r.date.getTime())/864e5);e>1&&(s=e)}}s>31&&(s=31,m+=1);let o=[r.date],d=!1;if(e.rrule){let a=function(e){let t={freq:"",interval:1,count:null,until:null,byday:[],unsupported:[]};for(let n of e.split(";")){let e=n.indexOf("=");if(e<0)continue;let a=n.slice(0,e).trim().toUpperCase(),r=n.slice(e+1).trim().toUpperCase();switch(a){case"FREQ":t.freq=r;break;case"INTERVAL":{let e=Number(r);t.interval=Number.isFinite(e)&&e>=1?Math.min(Math.round(e),366):1;break}case"COUNT":{let e=Number(r);t.count=Number.isFinite(e)&&e>=1?Math.round(e):null;break}case"UNTIL":{let e=E(r,{});t.until=e?e.date:null;break}case"BYDAY":for(let e of r.split(",")){let n=e.trim(),a=F[n];void 0===a?t.unsupported.push(`BYDAY=${n}`):t.byday.push(a)}break;case"WKST":break;default:t.unsupported.push(a)}}return C.has(t.freq)||t.unsupported.push(t.freq?`FREQ=${t.freq}`:"a repeat rule with no FREQ"),t.byday.length>0&&"WEEKLY"!==t.freq&&t.unsupported.push("BYDAY on a rule that is not weekly"),t}(e.rrule);
1if(a.unsupported.length>0)n.unexpanded.push({title:l,part:a.unsupported.join(", ")});else{let e=function(e,t,n){let a=[],r=t.until&&t.until<n.end?t.until:n.end,l=0,s=!1,i=e=>(l+=1,e>=n.start&&a.push(e),(null===t.count||!(l>=t.count))&&(!(l>=3e3)&&!(a.length>=400)||(s=!0,!1))),o=null===t.count,d=Math.round((n.start.getTime()-e.getTime())/864e5);if("DAILY"===t.freq||"WEEKLY"===t.freq&&0===t.byday.length){let n="DAILY"===t.freq?t.interval:7*t.interval,l=o&&d>0?Math.floor(d/n):0;for(let t=l;t<l+3e3;t++){let a=x(e.getFullYear(),e.getMonth(),e.getDate()+t*n);if(a>r||!i(a))break}return{dates:a,capped:s}}if("WEEKLY"===t.freq){let l=[...new Set(t.byday)].sort((e,t)=>e-t),d=(e.getDay()+6)%7,u=x(e.getFullYear(),e.getMonth(),e.getDate()-d),h=Math.round((n.start.getTime()-u.getTime())/864e5/7),c=o&&h>0?Math.floor(h/t.interval):0;for(let n=c;n<c+3e3;n++){let a=x(u.getFullYear(),u.getMonth(),u.getDate()+n*t.interval*7);if(a>r)break;let s=!1;for(let t of l){let n=x(a.getFullYear(),a.getMonth(),a.getDate()+(t+6)%7);if(!(n<e)&&(n>r||!i(n))){s=!0;break}}if(s)break}return{dates:a,capped:s}}if("MONTHLY"===t.freq){let l=e.getDate(),d=(n.start.getFullYear()-e.getFullYear())*12+(n.start.getMonth()-e.getMonth()),u=o&&d>0?Math.floor(d/t.interval):0;for(let n=u;n<u+3e3;n++){let a=w(e.getFullYear(),e.getMonth()+1,n*t.interval);if(l>y(a.year,a.month)){if(x(a.year,a.month-1,1)>r)break;continue}let s=x(a.year,a.month-1,l);if(s>r||!i(s))break}return{dates:a,capped:s}}let u=e.getMonth()+1,h=e.getDate(),c=n.start.getFullYear()-e.getFullYear(),m=o&&c>0?Math.floor(c/t.interval):0;for(let n=m;n<m+3e3;n++){let a=e.getFullYear()+n*t.interval,l=S(a,u,h);if(!l){if(x(a,11,31)>r)break;continue}if(l>r||!i(l))break}return{dates:a,capped:s}}(r.date,a,t);e.capped&&(g+=1),e.dates.length>0&&(o=e.dates,d=e.dates.length>1||r.date<t.start)}}let u=new Set;for(let t of e.exdate)for(let e of t.split(",")){let t=E(e,{});t&&u.add(b(t.date))}for(let n of e.rdate)for(let e of n.split(",")){let n=E(e,{});n&&n.date>=t.start&&n.date<=t.end&&o.push(n.date)}for(let t of o)for(let r=0;r<s;r++){let s=x(t.getFullYear(),t.getMonth(),t.getDate()+r),o=b(s);if(u.has(o))continue;let h=`${e.uid||l}|${o}`;if(i.has(h)){n.duplicates+=1;continue}if(i.add(h),a.length>=1200){p=!0;return}a.push({id:j("i"),date:s,key:o,title:l,source:"ics",repeated:d})}};for(let e of s){let t=e.toUpperCase();if(t.startsWith("BEGIN:VEVENT")){o={summary:"",uid:"",start:null,end:null,rrule:null,exdate:[],rdate:[]};continue}if(t.startsWith("END:VEVENT")){o&&f(o),o=null;continue}if(A.some(e=>t.startsWith(`BEGIN:${e}`))){d+=1,u+=1;continue}if(A.some(e=>t.startsWith(`END:${e}`))){u=Math.max(0,u-1);continue}if(!o||u>0)continue;let n=function(e){let t=0,n=!1;for(;t<e.length;t++){let a=e[t];if('"'===a)n=!n;else if(":"===a&&!n)break}if(t>=e.length)return null;let a=e.slice(0,t).split(";"),r={};for(let e of a.slice(1)){let t=e.indexOf("=");t<0||(r[e.slice(0,t).toUpperCase()]=e.slice(t+1).replace(/^"|"$/g,"").toUpperCase())}return{name:(a[0]??"").toUpperCase(),params:r,value:e.slice(t+1)}}(e);if(n)switch(n.name){case"SUMMARY":o.summary=function(e){let t="";for(let n=0;n<e.length;n++){let a=e[n];if("\\"!==a){t+=a;continue}let r=e[n+1];"n"===r||"N"===r?(t+=" ",n+=1):"\\"===r||";"===r||","===r?(t+=r,n+=1):t+=a}return t}(n.value);break;case"UID":o.uid=n.value;break;case"DTSTART":o.start=n;break;case"DTEND":o.end=n;break;case"RRULE":o.rrule=n.value;break;case"EXDATE":o.exdate.push(n.value);break;case"RDATE":o.rdate.push(n.value)}}return h>0&&n.notes.push(`${h} entries in that file had no start date and were skipped.`),c>0&&n.notes.push(`${c} entries had a start date in a format this tool does not read.`),d>0&&n.notes.push(`${d} reminders, to-dos or time zone blocks in that file were ignored.`),m>0&&n.notes.push(`${m} events run longer than 31 days and were printed for their first 31 days only.`),g>0&&n.notes.push(`${g} repeating events stopped after 400 dates.`),p&&n.notes.push("Stopped at 1200 events, so later entries in that file were not read."),a}(I,ex,e):[];e.titlesShortened>0&&e.notes.push(`${e.titlesShortened} ${1===e.titlesShortened?"title was":"titles were"} longer than 90 characters and printed shortened.`);let r=[...n,...a],l=function(e,t,n){let a=new Map;for(let r of e){if(r.date<t.start||r.date>t.end){n.outOfRangeTotal+=1,n.outOfRange.length<40&&n.outOfRange.push({title:r.title,date:r.key});continue}let e=a.get(r.key);e?e.push(r):a.set(r.key,[r])}return a}(r,ex,e),s=0;
1return l.forEach(e=>{s+=e.length}),{all:r,byDay:l,diag:e,placed:s}},[z,I,t.dateOrder,ex]),eb=(0,r.useMemo)(()=>{let e=[JSON.stringify(t)];return ey.byDay.forEach((t,n)=>{e.push(`${n}:${t.map(e=>e.title).join("~")}`)}),e.join("|")},[t,ey]),[ew,ek]=(0,r.useState)({token:"",fit:{}}),ev=ew.token!==eb;(0,r.useEffect)(()=>{if(!X)return;let e=!0,t=()=>{if(!e)return;let t=eo.current;if(!t)return;let n={};t.querySelectorAll("ul[data-pcg-day]").forEach(e=>{let t=e.dataset.pcgDay;if(!t)return;let a=Array.from(e.children).filter(e=>e instanceof HTMLElement);if(0===a.length)return;let r=e.clientHeight,l=e=>e.offsetTop+e.offsetHeight;if(a.every(e=>l(e)<=r+1)){n[t]=a.length;return}let s=Number.parseFloat(window.getComputedStyle(e).lineHeight),i=Number.isFinite(s)&&s>0?s:a[0]?.offsetHeight??0,o=0;for(let e of a)if(l(e)<=r-i+1)o+=1;else break;n[t]=o}),ek({token:eb,fit:n})};t();let n=document.fonts;return n?.ready&&n.ready.then(t,()=>{}),()=>{e=!1}},[eb,X]);let eN=(0,r.useMemo)(()=>{if(ev)return[];let e=[];return ey.byDay.forEach((t,n)=>{let a=ew.fit[n]??t.length;for(let r=a;r<t.length;r++){let a=t[r];a&&e.push({key:n,title:a.title})}}),e.sort((e,t)=>e.key<t.key?-1:+(e.key>t.key)),e},[ey,ew,ev]),ej=ey.placed-eN.length,eS=(0,r.useMemo)(()=>{if("iso"!==t.weekNumbers)return[];let e=new Set;for(let t of ef)for(let n of t.rows)53===n.isoWeek&&e.add(n.isoYear);return[...e].sort((e,t)=>e-t)},[ef,t.weekNumbers]),e$=(0,r.useMemo)(()=>{if("iso"===t.weekNumbers&&1!==t.weekStart){let e=6===t.weekStart?"Saturday":"Sunday";return`ISO 8601 weeks run Monday to Sunday, and this grid starts on ${e}. The Wk column gives the ISO week of each row's Thursday, so the days before that row's Monday sit under the week number of the week that follows them.`}if("us"===t.weekNumbers&&0!==t.weekStart){let e=1===t.weekStart?"Monday":"Saturday";return`US week numbers run Sunday to Saturday, and this grid starts on ${e}. The Wk column gives the US week of each row's Thursday, so the last day of each row sits under the number of the week before it.`}return""},[t.weekNumbers,t.weekStart]),[eM,eD]=(0,r.useState)(0);(0,r.useEffect)(()=>{let e=ed.current;if(!e)return;eD(e.clientWidth);let t=new ResizeObserver(e=>{let t=e[0];t&&eD(t.contentRect.width)});return t.observe(e),()=>t.disconnect()},[X]);let eT=eg*G,eE=ep*G,eC=eM>0?Math.min(1,eM/eT):1,eF=Math.round(ef.length*(eE+10)*eC),eA=(0,r.useCallback)(async e=>{let t=eh.current+1;eh.current=t;try{let n=await (0,q.G)(e);if(eh.current!==t)return;J(n.text),Q(e.name),en(n.note)}catch(e){eh.current===t&&en(e instanceof Error&&e.message.includes("UTF-32")?e.message:"That file could not be read.")}},[]);(0,r.useEffect)(()=>{function e(e){let t=e.target;if(t&&"function"==typeof t.closest&&t.closest('input, textarea, [contenteditable="true"]'))return;let n=e.clipboardData?.files?.[0];if(n){e.preventDefault(),eA(n);return}let a=e.clipboardData?.getData("text")??"";a.includes("BEGIN:VCALENDAR")&&(e.preventDefault(),J(a),Q("pasted calendar"))}return document.addEventListener("paste",e),()=>document.removeEventListener("paste",e)},[eA]);let eL=e=>{let t=new Date;if("this"===e)return void n(e=>({...e,year:t.getFullYear(),month:t.getMonth()+1,months:1}));if("next"===e){let e=w(t.getFullYear(),t.getMonth()+1,1);n(t=>({...t,year:e.year,month:e.month,months:1}));return}if("year"===e)return void n(e=>({...e,year:t.getFullYear(),month:1,months:12}));if("school"===e){let e=t.getMonth()+1>=8?t.getFullYear():t.getFullYear()-1;n(t=>({...t,year:e,month:8,months:12}));return}n(e=>({...e,weekendShade:!1,weekNumbers:"off",noteLines:3,showDates:!0})),en(g.trim()||I?"Blank grid set. Your dates are still loaded, so clear the list below if you want an empty sheet.":"")},eY=async()=>{let e=function(e){let t=new TextEncoder().encode(JSON.stringify(e)),n="";for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}({v:1,c:t,e:g}),n=`${window.location.origin}${window.location.pathname}#c=${e}`;if(n.length>6e3)return void en(`That link would be ${n.length} characters, past the 6000 some browsers and chat apps carry safely. Shorten the list, or print the sheet instead.`);let{ok:a,note:r}=await (0,B.copyText)(n);if(a){en(""),er("link"),window.setTimeout(()=>er(e=>"link"===e?"":e),1600);return}window.history.replaceState(null,"",`#c=${e}`),en(`${r??""} The calendar is in the address bar now, so that is the text to select.`.trim())},eO=ey.diag,ez=!ev&&0===eN.length&&0===eO.unreadable.length&&0===eO.outOfRangeTotal&&0===eO.unexpanded.length&&0===eO.notes.length,eR=ey.all.length>0;return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("style",{children:` 2 @media print { 3 body * { visibility: hidden !important; } 4 #pcg-print, #pcg-print * { visibility: visible !important; } 5 #pcg-box { height: auto !important; overflow: visible !important; border: 0 !important; background: none !important; } 6 #pcg-scaler { transform: none !important; position: static !important; } 7 #pcg-print { position: absolute !important; left: 0 !important; top: 0 !important; } 8 .pcg-sheet { box-shadow: none !important; margin: 0 !important; } 9 } 10 @media screen { 11 .pcg-sheet { box-shadow: 0 0 0 1px rgba(0,0,0,0.14); margin-bottom: 10px; } 12 } 13 @page { size: ${eg}mm ${ep}mm; margin: 0; } 14 .pcg-sheet { background: #ffffff; color: #000000; display: flex; flex-direction: column; overflow: hidden; page-break-after: always; break-after: page;
14 font-family: system-ui, "Segoe UI", Arial, sans-serif; -webkit-print-color-adjust: exact; print-color-adjust: exact; } 15 .pcg-sheet.pcg-last { page-break-after: auto; break-after: auto; } 16 .pcg-sheet * { box-sizing: border-box; } 17 .pcg-head { flex: 0 0 auto; text-align: center; padding-bottom: 1.6mm; } 18 .pcg-title { letter-spacing: 0.4px; text-transform: uppercase; } 19 .pcg-month { font-weight: 700; letter-spacing: 0.4px; line-height: 1.1; } 20 .pcg-dow { display: grid; flex: 0 0 auto; text-align: center; font-weight: 600; padding-bottom: 0.8mm; } 21 .pcg-grid { display: grid; grid-template-rows: repeat(6, 1fr); flex: 1 1 auto; min-height: 0; border-right: 0.3mm solid; border-bottom: 0.3mm solid; } 22 .pcg-cell { position: relative; display: flex; flex-direction: column; overflow: hidden; padding: 0.7mm; border-top: 0.3mm solid; border-left: 0.3mm solid; } 23 .pcg-wk { display: flex; align-items: center; justify-content: center; border-top: 0.3mm solid; border-left: 0.3mm solid; } 24 .pcg-shade { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 0; } 25 .pcg-num { position: relative; z-index: 1; flex: 0 0 auto; text-align: right; font-weight: 600; line-height: 1; } 26 .pcg-ev { position: relative; z-index: 1; flex: 1 1 0; min-height: 0; overflow: hidden; list-style: none; margin: 0; padding: 0; border: 0; } 27 .pcg-ev li { margin: 0; padding: 0; overflow-wrap: break-word; word-break: break-word; } 28 .pcg-more { font-style: italic; opacity: 0.75; } 29 .pcg-lines { position: relative; z-index: 1; flex: 0 0 auto; } 30 .pcg-line { border-bottom: 0.2mm solid; } 31 `}),(0,a.jsxs)("section",{className:"space-y-3 rounded-lg border p-4",children:[(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsx)(l.$,{size:"sm",variant:"outline",onClick:()=>eL("this"),children:"This month"}),(0,a.jsx)(l.$,{size:"sm",variant:"outline",onClick:()=>eL("next"),children:"Next month"}),(0,a.jsx)(l.$,{size:"sm",variant:"outline",onClick:()=>eL("year"),children:"Whole year"}),(0,a.jsx)(l.$,{size:"sm",variant:"outline",onClick:()=>eL("school"),children:"School year"}),(0,a.jsx)(l.$,{size:"sm",variant:"outline",onClick:()=>eL("blank"),children:"Blank grid"})]}),(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(o.J,{htmlFor:"pcg-month",children:"Start month"}),(0,a.jsx)("select",{id:"pcg-month",className:Z,value:t.month,onChange:e=>ec("month",Number(e.target.value)),children:m.map((e,t)=>(0,a.jsx)("option",{value:t+1,children:e},e))})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(o.J,{htmlFor:"pcg-year",children:"Year"}),(0,a.jsx)(i.p,{id:"pcg-year",type:"number",min:1900,max:2200,value:t.year,onChange:e=>ec("year",Math.max(1900,Math.min(2200,Number(e.target.value)||t.year)))})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(o.J,{htmlFor:"pcg-count",children:"How many months"}),(0,a.jsx)("select",{id:"pcg-count",className:Z,value:t.months,onChange:e=>ec("months",Number(e.target.value)),children:Array.from({length:12},(e,t)=>t+1).map(e=>(0,a.jsx)("option",{value:e,children:1===e?"1 month, 1 page":`${e} months, ${e} pages`},e))})]})]})]}),(0,a.jsxs)("section",{className:"space-y-3 rounded-lg border p-4",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-2",children:[(0,a.jsx)(o.J,{htmlFor:"pcg-events",children:"Your dates, one per line"}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:eR?`${ey.all.length} read, ${ey.placed} inside these months`:"Nothing added yet, the sheet prints blank"})]}),(0,a.jsx)(d.T,{id:"pcg-events",value:g,onChange:e=>N(e.target.value),rows:6,spellCheck:!1,placeholder:H}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)(o.J,{htmlFor:"pcg-order",className:"text-xs",children:"Read 3/4 as"}),(0,a.jsxs)("select",{id:"pcg-order",className:`${Z} w-auto`,value:t.dateOrder,onChange:e=>ec("dateOrder","dmy"===e.target.value?"dmy":"mdy"),children:[(0,a.jsx)("option",{value:"mdy",children:"March 4, month first"}),(0,a.jsx)("option",{value:"dmy",children:"3 April, day first"})]})]}),g.trim()?(0,a.jsx)(l.$,{variant:"ghost",size:"sm",onClick:()=>N(""),children:"Clear the list"}):(0,a.jsx)(l.$,{variant:"ghost",size:"sm",onClick:()=>N(H),children:"Show me an example"})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"A date then a space then whatever you want in the box. 12/25, 2026-12-25, Dec 25 and 25 Dec all work, and 25/12 works once you switch the 3/4 reading to day first. Leave the year off and it lands on the first time that day comes round in the months you are printing."}),(0,a.jsx)("div",{role:"button",tabIndex:0,"aria-label":"Add a calendar file",onClick:()=>ei.current?.click(),onKeyDown:e=>
31{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),ei.current?.click())},onDragOver:e=>{e.preventDefault(),es(!0)},onDragLeave:()=>es(!1),onDrop:e=>{e.preventDefault(),es(!1);let t=e.dataTransfer.files[0];t&&eA(t)},className:`cursor-pointer rounded-md border border-dashed p-3 text-center text-xs ${el?"border-primary bg-primary/5":"text-muted-foreground"}`,children:K?(0,a.jsxs)("span",{children:["Using ",(0,a.jsx)("strong",{children:K}),". Click, drop or paste another to replace it."]}):(0,a.jsx)("span",{children:"Got an export from another calendar? Click to choose the .ics file, or drag it into this box, or paste it here."})}),(0,a.jsx)("input",{ref:ei,type:"file",accept:".ics,text/calendar",className:"hidden",onChange:e=>{let t=e.target.files?.[0];t&&eA(t),e.target.value=""}}),K?(0,a.jsx)(l.$,{variant:"ghost",size:"sm",onClick:()=>{J(""),Q("")},children:"Remove that file"}):null]}),(0,a.jsxs)("section",{className:"grid gap-3 rounded-lg border p-4 sm:grid-cols-2 lg:grid-cols-3",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(o.J,{htmlFor:"pcg-paper",children:"Paper"}),(0,a.jsx)("select",{id:"pcg-paper",className:Z,value:t.paper,onChange:e=>ec("paper",e.target.value),children:c.map(e=>(0,a.jsx)("option",{value:e.id,children:e.label},e.id))})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(o.J,{htmlFor:"pcg-orient",children:"Direction"}),(0,a.jsxs)("select",{id:"pcg-orient",className:Z,value:t.landscape?"land":"port",onChange:e=>ec("landscape","land"===e.target.value),children:[(0,a.jsx)("option",{value:"port",children:"Portrait"}),(0,a.jsx)("option",{value:"land",children:"Landscape"})]})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(o.J,{htmlFor:"pcg-week",children:"Week starts"}),(0,a.jsxs)("select",{id:"pcg-week",className:Z,value:t.weekStart,onChange:e=>ec("weekStart",Number(e.target.value)),children:[(0,a.jsx)("option",{value:0,children:"Sunday"}),(0,a.jsx)("option",{value:1,children:"Monday"}),(0,a.jsx)("option",{value:6,children:"Saturday"})]})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(o.J,{htmlFor:"pcg-wknum",children:"Week numbers"}),(0,a.jsxs)("select",{id:"pcg-wknum",className:Z,value:t.weekNumbers,onChange:e=>ec("weekNumbers","iso"===e.target.value?"iso":"us"===e.target.value?"us":"off"),children:[(0,a.jsx)("option",{value:"off",children:"Off"}),(0,a.jsx)("option",{value:"iso",children:"ISO 8601"}),(0,a.jsx)("option",{value:"us",children:"US, Sunday start"})]})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(o.J,{htmlFor:"pcg-size",children:"Box text size"}),(0,a.jsxs)("select",{id:"pcg-size",className:Z,value:t.textSize,onChange:e=>ec("textSize","small"===e.target.value?"small":"large"===e.target.value?"large":"medium"),children:[(0,a.jsx)("option",{value:"small",children:"Small, fits more"}),(0,a.jsx)("option",{value:"medium",children:"Medium"}),(0,a.jsx)("option",{value:"large",children:"Large, easier to read"})]})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(o.J,{htmlFor:"pcg-lines",children:"Ruled lines in each box"}),(0,a.jsx)("select",{id:"pcg-lines",className:Z,value:t.noteLines,onChange:e=>ec("noteLines",Number(e.target.value)),children:[0,1,2,3,4].map(e=>(0,a.jsx)("option",{value:e,children:0===e?"None":`${e} ${1===e?"line":"lines"}`},e))})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(o.J,{htmlFor:"pcg-ink",children:"Lines print"}),(0,a.jsxs)("select",{id:"pcg-ink",className:Z,value:t.ink,onChange:e=>ec("ink","black"===e.target.value?"black":"gray"),children:[(0,a.jsx)("option",{value:"gray",children:"Light gray, saves ink"}),(0,a.jsx)("option",{value:"black",children:"Solid black"})]})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(o.J,{htmlFor:"pcg-margin",children:"Page margin"}),(0,a.jsx)("select",{id:"pcg-margin",className:Z,value:t.marginMm,onChange:e=>ec("marginMm",Number(e.target.value)),children:[0,4,8,12,16,20].map(e=>(0,a.jsxs)("option",{value:e,children:[e," mm"]},e))})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(o.J,{htmlFor:"pcg-heading",children:"Heading (optional)"}),(0,a.jsx)(i.p,{id:"pcg-heading",value:t.title,maxLength:60,placeholder:"Torres family",onChange:e=>ec("title",e.target.value.slice(0,60))})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(o.J,{htmlFor:"pcg-sub",children:"Sub-heading (optional)"}),(0,a.jsx)(i.p,{id:"pcg-sub",value:t.subtitle,maxLength:60,placeholder:"Studio timetable",onCh
31ange:e=>ec("subtitle",e.target.value.slice(0,60))})]}),(0,a.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)("input",{type:"checkbox",className:"h-4 w-4",checked:t.weekendShade,onChange:e=>ec("weekendShade",e.target.checked)}),"Shade the weekend"]}),(0,a.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)("input",{type:"checkbox",className:"h-4 w-4",checked:t.showAdjacent,onChange:e=>ec("showAdjacent",e.target.checked)}),"Gray in the days either side"]}),(0,a.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)("input",{type:"checkbox",className:"h-4 w-4",checked:t.showDates,onChange:e=>ec("showDates",e.target.checked)}),"Print the date numbers"]})]}),(0,a.jsxs)("section",{className:"space-y-2 rounded-md border p-3",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(l.$,{onClick:()=>window.print(),children:"Print or save as PDF"}),(0,a.jsx)(l.$,{variant:"outline",size:"sm",onClick:eY,children:"link"===ea?"Calendar link copied":"Copy calendar link"}),(0,a.jsx)(l.$,{variant:"outline",size:"sm",onClick:()=>{if(0===ey.all.length)return void en("There are no dates to put in a calendar file yet.");let e=new Blob([function(e){let t=function(){let e=new Date().toISOString();return`${e.slice(0,4)}${e.slice(5,7)}${e.slice(8,10)}T${e.slice(11,13)}${e.slice(14,16)}${e.slice(17,19)}Z`}(),n=["BEGIN:VCALENDAR","VERSION:2.0","PRODID:-//ToolBreezy//Printable Calendar//EN","CALSCALE:GREGORIAN"];return e.forEach((e,a)=>{let r=x(e.date.getFullYear(),e.date.getMonth(),e.date.getDate()+1),l=`${e.date.getFullYear()}${f(e.date.getMonth()+1)}${f(e.date.getDate())}`,s=`${r.getFullYear()}${f(r.getMonth()+1)}${f(r.getDate())}`;n.push("BEGIN:VEVENT",L(`UID:${l}-${a}@toolbreezy`),`DTSTAMP:${t}`,`DTSTART;VALUE=DATE:${l}`,`DTEND;VALUE=DATE:${s}`,L(`SUMMARY:${e.title.replace(/\\/g,"\\\\").replace(/;/g,"\\;").replace(/,/g,"\\,").replace(/\n/g,"\\n")}`),"END:VEVENT")}),n.push("END:VCALENDAR"),`${n.join("\r\n")}\r 32`}(ey.all)],{type:"text/calendar;charset=utf-8"});(0,P.WN)(e,`calendar-${t.year}-${String(t.month).padStart(2,"0")}.ics`)},children:"Download these dates as .ics"})]}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["In the print box, set scale to 100% and turn off shrink to fit, or the sheet arrives smaller than the paper with an uneven edge. Choosing Save as PDF in that same box gives you a real PDF at the exact size, with text you can still select.",t.weekendShade?" Weekend shading is drawn into the sheet rather than as a background, so it survives the default print settings.":""]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"The calendar link carries your settings and your dates after the # in the address, which browsers never send to a server, so a family calendar stays between you and whoever you send it to."}),e$?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:e$}):null,eS.length>0?(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:[eS.join(" and ")," ",eS.length>1?"are 53 week years":"is a 53 week year"," under ISO 8601, so you will see a week 53 on these sheets."]}):null,et?(0,a.jsx)("p",{className:"text-xs font-medium text-amber-700 dark:text-amber-500",children:et}):null]}),(0,a.jsx)("div",{id:"pcg-box",ref:ed,className:"relative overflow-hidden rounded-md border bg-muted/40",style:{height:`${eF}px`},children:(0,a.jsx)("div",{id:"pcg-scaler",style:{position:"absolute",left:0,top:0,transform:`scale(${eC})`,transformOrigin:"top left"},children:(0,a.jsx)("div",{id:"pcg-print",ref:eo,children:ef.map((e,n)=>(0,a.jsx)(V,{grid:e,config:t,wMm:eg,hMm:ep,byDay:ey.byDay,fit:ev?null:ew.fit,last:n===ef.length-1},`${e.year}-${e.month}`))})})}),(0,a.jsxs)("section",{className:"space-y-3 rounded-lg border p-4 text-sm",children:[(0,a.jsx)("h3",{className:"font-semibold",children:"What landed on the sheet"}),eR||0!==eO.unreadable.length||0!==eO.outOfRangeTotal||0!==eO.unexpanded.length||0!==eO.notes.length?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("p",{children:[(0,a.jsx)("strong",{children:ej})," ",1===ej?"date is":"dates are"," printed across"," ",1===ef.length?"this sheet":`these ${ef.length} sheets`,ev?", measuring the boxes now":"."]}),ez?(0,a.jsx)("p",{className:"text-emerald-700 dark:text-emerald-500",children:"Everything you gave it fits in its box. Nothing was dropped and nothing was shortened."}):null,eN.length>0?(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{className:"font-medium",children:[eN.length," ",1===eN.length?"date does":"dates do",' not fit in its box and shows as "+ more" instead:']}),(0,a.jsx)("ul",{className:"mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground",children:eN.slice(0,40).map((e,t)=>(0,a.jsxs)("li",{children:[_(e.key),": ",e.title]},`${e.key}-${t}`))}),eN.length>40?(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["and ",eN.length-40," more beyond the first ",40,"."]}):null,(0,a.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Bigger paper, landscape, a smaller box text size or fewer ruled lines will take most of these."})]}):null,eO.outOfRangeTotal>0?(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{className:"font-medium",children:[eO.outOfRangeTotal," ",1===eO.outOfRangeTotal?"date falls":"dates fall"," outside the months you are printing:"]}),(0,a.jsx)("ul",{className:"mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground",children:eO.outOfRange.map((e,t)=>(0,a.jsxs)("li",{children:[_(e.date),": ",e.title]},`${e.date}-${t}`))}),eO.outOfRangeTotal>eO.outOfRange.length?(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["and ",eO.outOfRangeTotal-eO.outOfRange.length," more beyond the first"," ",40,"."]}):null]}):null,eO.unreadable.length>0?(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{className:"font-medium",children:[eO.unreadable.length," ",1===eO.unreadable.length?"line was":"lines were"," not readable:"]}),(0,a.jsx)("ul",{className:"mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground",children:eO.unreadable.slice(0,40).map((e,t)=>(0,a.jsxs)("li",{children:["Line ",e.line,', "',e.text,'": ',e.reason,"."]},`${e.line}-${t}`))}),eO.unreadable.length>40?(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["and ",eO.unreadable.length-40," more beyond the first ",40,"."]}):null]}):null,eO.ambiguous.length>0?(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{className:"font-medium",children:[eO.ambiguous.length," ",1===eO.ambiguous.length?"line could":"lines could"," be read two ways, and the setting above says which:"]}),(0,a.jsx)("ul",{className:"mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground",children:eO.ambiguous.slice(0,40).map((e,t)=>(0,a.jsxs)("li",{children:["Line ",e.line,', "',e.text,'", printed as ',e.reading,"."]},`${e.line}-${t}`))}),eO.ambiguous.length>40?(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["and ",eO.ambiguous.length-40," more beyond the first ",40,"."]}):null]}):null,eO.unexpanded.length>0?(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{className:"font-medium",children:[eO.unexpanded.length," repeating"," ",1===eO.unexpanded.length?"event was":"events were"," placed once only, because the repeat rule uses something this tool does not expand:"]}),(0,a.jsx)("ul",{className:"mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground",children:eO.unexpanded.slice(0,40).map((e,t)=>(0,a.jsxs)("li",{children:[e.title,", rule part ",e.part,"."]},`${e.title}-${t}`))}),eO.unexpanded.length>40?(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["and ",eO.unexpanded.length-40," more beyond the first ",40,"."]}):null]}):null,eO.tzIgnored>0||eO.utcShifted>0||eO.duplicates>0||eO.notes.length>0?(0,a.jsxs)("ul",{className:"list-disc space-y-0.5 pl-5 text-xs text-muted-foreground",children:[eO.tzIgnored>0?(0,a.jsxs)("li",{children:[eO.tzIgnored," events carried a named time zone. They print on the day and time written in the file, with no conversion."]}):null,eO.utcShifted>0?(0,a.jsxs)("li",{children:[eO.utcShifted," events were stored in UTC and were converted to your local date, which can move one across midnight."]}):null,eO.duplicates>0?(0,a.jsxs)("li",{children:[eO.duplicates," repeated copies of the same event on the same day were merged into one."]}):null,eO.notes.map((e,t)=>(0,a.jsx)("li",{children:e},t))]}):null]}):(0,a.jsx)("p",{className:"text-muted-foreground",children:"Add some dates above and this tells you exactly where every one of them went, including any the boxes were too small to hold."}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"No public holidays are printed. Holiday dates change by country, by region and by year, and a list this tool cannot check would be putting made-up facts on a sheet you are going to trust for months. Type the ones you keep and they print exactly as written."})]}),(0,a.jsx)(u.ToolActions,{title:"Printable Calendar",getParams:()=>(function(e){let t=new URLSearchParams;return t.set("y",String(e.year)),t.set("m",String(e.month)),t.set("n",String(e.months)),t.set("ws",String(e.weekStart)),t.set("p",e.paper),e.landscape&&t.set("land","1"),t.set("mg",String(e.marginMm)),"off"!==e.weekNumbers&&t.set("wk",e.weekNumbers),e.weekendShade||t.set("we","0"),e.showAdjacent||t.set("adj","0"),e.showDates||t.set("dates","0"),e.noteLines>0&&t.set("lines",String(e.noteLines)),"medium"!==e.textSize&&t.set("ts",e.textSize),"gray"!==e.ink&&t.set("ink",e.ink),t})(t)})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.