@cldmv/fix-headers 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,19 @@
1
1
  #!/usr/bin/env node
2
- var Nr=Object.defineProperty;var i=(e,t)=>Nr(e,"name",{value:t,configurable:!0});import{realpathSync as wr}from"node:fs";import{fileURLToPath as ho,pathToFileURL as go}from"node:url";import{readFile as Cr}from"node:fs/promises";import{createRequire as Fr}from"node:module";import{dirname as jr,isAbsolute as Lr,resolve as ze}from"node:path";var Mr=3e4,Pr=new Set(["localhost","127.0.0.1","[::1]"]);function ie(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}i(ie,"isPlainObject");function ae(e,t){let r={...e};for(let[n,o]of Object.entries(t))n!=="__proto__"&&(r[n]=ie(r[n])&&ie(o)?ae(r[n],o):o);return r}i(ae,"mergeConfig");function Be(e){return e.kind==="file"?e.path:e.href}i(Be,"describeSource");async function Rr(e){if(e.kind==="file")return{text:await Cr(e.path,"utf8"),source:e};let t;try{t=await fetch(e.href,{cache:"no-store",redirect:"follow",signal:AbortSignal.timeout(Mr)})}catch(r){let n=r.cause instanceof Error?r.cause.message:r.message;throw new Error(`Failed to fetch config ${e.href}: ${n}`,{cause:r})}if(!t.ok)throw new Error(`Failed to fetch config ${e.href}: HTTP ${t.status} ${t.statusText}`);return{text:await t.text(),source:{kind:"url",href:t.url}}}i(Rr,"readSource");function He(e){if(e.protocol==="http:"&&!Pr.has(e.hostname))throw new Error(`Refusing to fetch config over plain http: ${e.href} (use https)`);return{kind:"url",href:e.href}}i(He,"toUrlSource");function Ir(e,t){if(/^https?:\/\//i.test(e))return He(new URL(e));if(/^[a-z][a-z\d+.-]+:\/\//i.test(e))throw new Error(`Unsupported extends URL "${e}" in ${Be(t)}; use https, a file path or a package path`);let r=/^\.{1,2}[\\/]/.test(e);if(t.kind==="url"){if(r||e.startsWith("/"))return He(new URL(e,t.href));throw new Error(`Cannot extend package "${e}" from the remote config ${t.href}; use a URL or a relative path`)}if(r||Lr(e))return{kind:"file",path:ze(jr(t.path),e)};try{return{kind:"file",path:Fr(t.path).resolve(e)}}catch(n){throw new Error(`Cannot resolve extends "${e}" from ${t.path}: ${n.message}`,{cause:n})}}i(Ir,"resolveReference");function Or(e,t){if(e===void 0)return[];let r=Array.isArray(e)?e:[e];if(!r.every(n=>typeof n=="string"&&n.trim().length>0))throw new Error(`Config "extends" must be a string or an array of strings: ${t}`);return r.map(n=>n.trim())}i(Or,"readExtends");async function We(e,t){let r=Be(e);if(t.includes(r))throw new Error(`Config extends cycle: ${[...t,r].join(" -> ")}`);let{text:n,source:o}=await Rr(e),a;try{a=JSON.parse(n)}catch(u){throw new Error(`Config ${r} is not valid JSON: ${u.message}`,{cause:u})}if(!ie(a))throw new Error(`Config file must contain a JSON object: ${r}`);let{extends:s,...c}=a,l={};for(let u of Or(s,r))l=ae(l,await We(Ir(u,o),[...t,r]));return ae(l,c)}i(We,"loadSource");function Tr(e,t=process.cwd()){return We({kind:"file",path:ze(t,e)},[])}i(Tr,"loadConfigFile");async function V(e,t){let r=typeof e[t]=="string"?e[t].trim():"";if(r.length===0)return e;let n=typeof e.cwd=="string"&&e.cwd.length>0?e.cwd:process.cwd(),o={...await Tr(r,n),...e};return delete o[t],o}i(V,"applyConfigOption");import{readFile as io,stat as ao,writeFile as so}from"node:fs/promises";import{relative as gr,resolve as yr}from"node:path";import{extname as lt}from"node:path";import{extname as Ur}from"node:path";var Ye=[".css"];function _r(e){let t=Ur(e).toLowerCase();return Ye.includes(t)?{kind:"block",blockStart:"/*",blockLinePrefix:" * ",blockEnd:" */"}:null}i(_r,"resolveCssCommentSyntax");var Ge={id:"css",extensions:Ye,enabledByDefault:!0,resolveCommentSyntax(e){return _r(e)}};import{extname as Hr}from"node:path";var Ve=[".go"];function zr(e){let t=Hr(e).toLowerCase();return Ve.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(zr,"resolveGoCommentSyntax");var Je={id:"go",extensions:Ve,enabledByDefault:!0,resolveCommentSyntax(e){return zr(e)}};import{extname as Br}from"node:path";var Ke=[".html",".htm"];function Wr(e){let t=Br(e).toLowerCase();return Ke.includes(t)?{kind:"html",blockStart:"<!--",blockLinePrefix:" ",blockEnd:"-->"}:null}i(Wr,"resolveHtmlCommentSyntax");var qe={id:"html",extensions:Ke,enabledByDefault:!0,resolveCommentSyntax(e){return Wr(e)}};import{extname as Yr}from"node:path";var Xe=[".jsonv",".jsonc",".json5"];function Gr(e){let t=Yr(e).toLowerCase();return Xe.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(Gr,"resolveJsonCommentSyntax");var Ze={id:"json",extensions:Xe,enabledByDefault:!0,resolveCommentSyntax(e){return Gr(e)}};import{extname as Vr}from"node:path";var Qe=[".js",".mjs",".cjs",".ts",".tsx",".jsx"];function Jr(e){let t=Vr(e).toLowerCase();return Qe.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(Jr,"resolveNodeCommentSyntax");function Kr(e,t){let r=t.match(/^#!.*\b(node|bun|deno|tsx|ts-node)\b.*(?:\r?\n|$)/);return r?r[0]:""}i(Kr,"resolveNodePreservedPrefix");var et={id:"node",extensions:Qe,enabledByDefault:!0,resolvePreservedPrefix(e,t){return Kr(e,t)},resolveCommentSyntax(e){return Jr(e)}};import{extname as qr}from"node:path";var tt=[".php"];function Xr(e){let t=qr(e).toLowerCase();return tt.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(Xr,"resolvePhpCommentSyntax");var rt={id:"php",extensions:tt,enabledByDefault:!0,resolveCommentSyntax(e){return Xr(e)}};import{extname as Zr}from"node:path";var nt=[".py"];function Qr(e,t){let r=t.match(/^#!.*\bpython(?:\d+(?:\.\d+)*)?\b.*(?:\r?\n|$)/);return r?r[0]:""}i(Qr,"resolvePythonPreservedPrefix");var ot={id:"python",extensions:nt,enabledByDefault:!0,resolvePreservedPrefix(e,t){return Qr(e,t)},resolveCommentSyntax(e){let t=Zr(e).toLowerCase();return nt.includes(t)?{kind:"line",linePrefix:"#"}:null}};import{extname as en}from"node:path";var it=[".rs"];function tn(e){let t=en(e).toLowerCase();return it.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(tn,"resolveRustCommentSyntax");var at={id:"rust",extensions:it,enabledByDefault:!0,resolveCommentSyntax(e){return tn(e)}};import{extname as rn}from"node:path";var st=[".yaml",".yml"];function nn(e){let t=rn(e).toLowerCase();return st.includes(t)?{kind:"line",linePrefix:"#"}:null}i(nn,"resolveYamlCommentSyntax");var ct={id:"yaml",extensions:st,enabledByDefault:!0,resolveCommentSyntax(e){return nn(e)}};var ut=[Ge,Je,qe,Ze,et,rt,ot,at,ct],yi=new Map(ut.map(e=>[e.id,e]));function on(e,t){return!t||typeof t!="object"?e:e.kind==="line"?{...e,linePrefix:typeof t.linePrefix=="string"&&t.linePrefix.length>0?t.linePrefix:e.linePrefix,lineSeparator:typeof t.lineSeparator=="string"?t.lineSeparator:e.lineSeparator}:{...e,blockStart:typeof t.blockStart=="string"&&t.blockStart.length>0?t.blockStart:e.blockStart,blockLinePrefix:typeof t.blockLinePrefix=="string"&&t.blockLinePrefix.length>0?t.blockLinePrefix:e.blockLinePrefix,blockEnd:typeof t.blockEnd=="string"&&t.blockEnd.length>0?t.blockEnd:e.blockEnd}}i(on,"applySyntaxOverride");function L(e={}){let t=new Set(Array.isArray(e.enabledDetectors)?e.enabledDetectors:[]),r=new Set(Array.isArray(e.disabledDetectors)?e.disabledDetectors:[]);return ut.filter(n=>t.size>0?t.has(n.id):r.has(n.id)?!1:n.enabledByDefault)}i(L,"getEnabledDetectors");function dt(e={}){if(Array.isArray(e.includeExtensions)&&e.includeExtensions.length>0)return new Set(e.includeExtensions.map(r=>r.toLowerCase()));let t=L(e);return new Set(t.flatMap(r=>r.extensions))}i(dt,"getAllowedExtensions");function ft(e,t={}){let r=lt(e).toLowerCase(),n=Array.isArray(t.detectors)?t.detectors:L(t);for(let o of n){if(!o.extensions.includes(r))continue;let a=o.resolveCommentSyntax(e);if(a){let s=t.detectorSyntaxOverrides&&typeof t.detectorSyntaxOverrides=="object"?t.detectorSyntaxOverrides:{};return on(a,s[o.id])}}return{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}}i(ft,"getCommentSyntaxForFile");function mt(e,t,r={}){let n=lt(e).toLowerCase(),o=L(r);for(let a of o)if(a.extensions.includes(n))return typeof a.resolvePreservedPrefix=="function"?a.resolvePreservedPrefix(e,t):"";return""}i(mt,"getPreservedPrefixForFile");var pt=200,R=1,J=2;function N(e,t,r){if(e==null)return r;if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error(`${t} must be a whole number of 0 or more, got ${JSON.stringify(e)}`);return e}i(N,"resolveLayoutCount");import{join as At,relative as $t,resolve as pe,sep as fe}from"node:path";import{realpath as yn,stat as xn}from"node:fs/promises";import{access as an,readdir as sn,readFile as Di,stat as cn}from"node:fs/promises";import{constants as ln}from"node:fs";import{dirname as $i,join as un,resolve as vi}from"node:path";async function se(e){try{return await an(e,ln.F_OK),!0}catch{return!1}}i(se,"pathExists");async function ce(e,t){let r=[],n=await sn(e,{withFileTypes:!0});for(let o of n){let a=un(e,o.name);if(o.isDirectory()&&t.recursive===!1||o.isDirectory()&&t.ignoreFolders.has(o.name)||o.isDirectory()&&await t.shouldSkipDirectory?.(a,o.name)===!0)continue;if(o.isDirectory()){let l=await ce(a,t);r.push(...l);continue}if(!o.isFile())continue;let s=o.name.lastIndexOf(".");if(s===-1)continue;let c=o.name.slice(s).toLowerCase();t.allowedExtensions.has(c)&&r.push(a)}return r}i(ce,"walkFiles");async function ht(e){let t=await cn(e);return{createdAt:t.birthtimeMs>0&&t.birthtime<t.mtime?t.birthtime:t.mtime,updatedAt:t.mtime}}i(ht,"readFileDates");import{execFile as dn}from"node:child_process";import{lstat as fn,readFile as mn}from"node:fs/promises";import{dirname as gt,isAbsolute as pn,join as bt,relative as wt,resolve as le,sep as Et}from"node:path";import hn from"ignore";function yt(e,t){return new Promise(r=>{dn("git",t,{cwd:e,encoding:"utf8",maxBuffer:Number.POSITIVE_INFINITY},(n,o)=>{if(!n){r({code:0,stdout:o});return}r({code:typeof n.code=="number"?n.code:-1,stdout:""})})})}i(yt,"runGitCommand");function de(e,t){return wt(e,t).split(Et).join("/")}i(de,"toPosixRelative");async function St(e){try{return hn().add(await mn(e,"utf8"))}catch{return null}}i(St,"readIgnoreFile");async function gn(e){return fn(bt(e,".git")).then(()=>!0,()=>!1)}i(gn,"hasGitEntry");function xt(e,t,r){for(let n=e.length-1;n>=0;n--){let{base:o,rules:a}=e[n],s=a.test(`${de(o,t)}${r?"/":""}`);if(s.ignored||s.unignored)return s.ignored}return!1}i(xt,"matchesRules");async function Dt(e,t){let r=await St(bt(e,".gitignore"));return{kind:"rules",nested:!0,excluded:!1,matchers:r?[...t,{base:e,rules:r}]:t}}i(Dt,"buildRulesContext");async function ue(e){let[t,r]=await Promise.all([yt(e,["check-ignore","-q","."]),yt(e,["ls-files","--cached","--others","--exclude-standard","-z"])]);if(t.code!==1||r.code!==0)return Dt(e,[]);let n=new Set,o=new Set;for(let a of r.stdout.split("\0")){let s=a.endsWith("/")?a.slice(0,-1):a;if(s.length!==0){n.add(s);for(let c=s.indexOf("/");c!==-1;c=s.indexOf("/",c+1))o.add(s.slice(0,c))}}return{kind:"git",root:e,entries:n,dirs:o}}i(ue,"resolveScopeContext");function kt(e){let t=le(e.root),r=e.gitignore;if(r===!1)return{isIgnored:i(async()=>!1,"isIgnored")};let n=new Map,o=i(async()=>{if(typeof r!="string"&&!Array.isArray(r))return ue(t);let c=typeof r=="string"?[r]:r.filter(u=>typeof u=="string"),l=[];for(let u of c){let f=await St(le(t,u));f&&l.push({base:t,rules:f})}return{kind:"rules",nested:!1,excluded:!1,matchers:l}},"buildRootContext"),a=i(c=>{let l=n.get(c);return l||(l=c===t?o():s(c),n.set(c,l)),l},"contextFor"),s=i(async c=>{let l=await a(gt(c));return l.kind==="git"?l.entries.has(de(l.root,c))?ue(c):l:!l.nested||l.excluded?l:xt(l.matchers,c,!0)?{...l,excluded:!0}:await gn(c)?ue(c):Dt(c,l.matchers)},"deriveContext");return{async isIgnored(c,l){let u=le(c),f=wt(t,u);if(f.length===0||f===".."||f.startsWith(`..${Et}`)||pn(f))return!1;let p=await a(gt(u));if(p.kind==="git"){let x=de(p.root,u);return!(p.entries.has(x)||l&&p.dirs.has(x))}return p.excluded||xt(p.matchers,u,l)}}}i(kt,"createIgnoreFilter");function bn(e){return dt(e)}i(bn,"resolveExtensions");var vt=new Set([".git"]);function me(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}i(me,"normalizeFolderPath");function wn(e){return Array.isArray(e)?e.map(t=>{if(typeof t=="string")return{path:t,recursive:!0};if(t&&typeof t=="object"&&typeof t.path=="string")return{path:t.path,recursive:t.recursive!==!1};throw new TypeError(`Invalid includeFolders entry: ${JSON.stringify(t)} (expected a path string or { path, recursive? })`)}):[]}i(wn,"resolveIncludeFolders");function Nt(e,t){let r=t instanceof Error?t.message:String(t);console.warn(`fix-headers: skipped include folder "${e}" (${r})`)}i(Nt,"reportSkippedIncludeFolder");function En(e,t){if(!Array.isArray(t)||t.length===0)return()=>!1;let r=pe(e),n=[],o=new Set;for(let a of t){if(typeof a!="string")continue;let s=me(a);if(s.length!==0){if(s.includes("/")){n.push(pe(r,s));continue}o.add(s)}}return(a,s)=>{if(o.has(s))return!0;for(let l of n)if(a===l||a.startsWith(`${l}/`))return!0;let c=me($t(r,a));return n.some(l=>{let u=me($t(r,l));return c===u||c.startsWith(`${u}/`)})}}i(En,"buildExclusionMatcher");async function he(e){let t=bn(e),r=wn(e.includeFolders),n=Array.isArray(e.excludeFolders)?e.excludeFolders:[],o=En(e.projectRoot,n),a=kt({root:e.projectRoot,gitignore:e.gitignore}),s=i(async(m,h)=>o(m,h)||await a.isIgnored(m,!0),"shouldSkipDirectory"),c=r.length>0?r.map(m=>({includeFolder:m.path,rootPath:At(e.projectRoot,m.path),recursive:m.recursive})):[{includeFolder:".",rootPath:e.projectRoot,recursive:!0}],l=[];for(let m of c){let h=await xn(m.rootPath).catch(S=>S);if(h instanceof Error){if(h.code==="ENOENT"){Nt(m.includeFolder,h);continue}throw h}if(!h.isDirectory()){Nt(m.includeFolder,`path is not a directory: ${m.rootPath}`);continue}let w=await yn(m.rootPath).catch(()=>pe(m.rootPath));l.push({...m,realRoot:w})}let u=i((m,h)=>{if(m.realRoot===h.realRoot)return m.recursive||!h.recursive;let w=m.realRoot.endsWith(fe)?m.realRoot:`${m.realRoot}${fe}`;if(!m.recursive||!h.realRoot.startsWith(w))return!1;let S=m.rootPath;for(let A of h.realRoot.slice(w.length).split(fe))if(S=At(S,A),vt.has(A)||o(S,A))return!1;return!0},"covers"),f=[...l].sort((m,h)=>m.realRoot.length-h.realRoot.length||Number(h.recursive)-Number(m.recursive)),p=[];for(let m of f)p.some(h=>u(h,m))||p.push(m);let x=[];for(let m of l){if(!p.includes(m))continue;let h=await ce(m.rootPath,{allowedExtensions:t,ignoreFolders:vt,shouldSkipDirectory:s,recursive:m.recursive});x.push(...h)}let g=[];for(let m of new Set(x))!o(m,m.split("/").at(-1)||"")&&!await a.isIgnored(m,!1)&&g.push(m);return g}i(he,"discoverFiles");import{basename as Wn,dirname as Yn,extname as Gn,resolve as we}from"node:path";import{dirname as _t,isAbsolute as Ln,join as Ht,relative as Mn,resolve as zt,sep as Pn}from"node:path";import{readFile as Sn}from"node:fs/promises";import{join as Dn}from"node:path";async function kn(e){try{return await Sn(e,"utf8")}catch{return null}}i(kn,"readManifest");async function D(e,t){let r=[];for(let n of t){let o=await kn(Dn(e,n));o!==null&&r.push({file:n,content:o})}return r.length>0?{dir:e,manifest:r[0].file,files:r}:null}i(D,"detectManifests");function C(e,t){return e.files.find(r=>r.file===t)?.content??null}i(C,"manifestContent");function b(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}i(b,"cleanName");function ge(e){if(typeof e!="string")return;let t=e.search(/[<(]/);return b(t===-1?e:e.slice(0,t))}i(ge,"personName");function K(e){try{return JSON.parse(e)}catch{return}}i(K,"parseJsonManifest");function*ye(e,t){let r="";for(let n of e.split(/\r?\n/)){let o=n.trim();if(o.startsWith("[")){let a=o.match(/^\[([^[\]]+)\]/);r=a?a[1].split(".").map(s=>s.trim()).join("."):"";continue}r===t&&(yield o)}}i(ye,"sectionLines");function I(e,t,r){let n=new RegExp(`^${r}\\s*=\\s*(?:"([^"\\\\]*)"|'([^']*)')`);for(let o of ye(e,t)){let a=o.match(n);if(a)return b(a[1]??a[2])}}i(I,"readTomlString");function xe(e,t,r){let n=new RegExp(`^${r}\\s*[=:](.*)$`);for(let o of ye(e,t)){let a=o.match(n);if(a)return b(a[1])}}i(xe,"readIniValue");function An(e,t,r){let n=new RegExp(`^${r}\\s*=\\s*\\[`),o=null;for(let a of ye(e,t)){if(o!==null){o.push(a);continue}let s=a.match(n);s&&(o=[a.slice(s[0].length)])}return o===null?null:o.join(`
2
+ var Nr=Object.defineProperty;var i=(e,t)=>Nr(e,"name",{value:t,configurable:!0});import{realpathSync as wr}from"node:fs";import{fileURLToPath as ho,pathToFileURL as go}from"node:url";import{readFile as Cr}from"node:fs/promises";import{createRequire as Fr}from"node:module";import{dirname as jr,isAbsolute as Lr,resolve as ze}from"node:path";var Mr=3e4,Pr=new Set(["localhost","127.0.0.1","[::1]"]);function ie(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}i(ie,"isPlainObject");function ae(e,t){let r={...e};for(let[n,o]of Object.entries(t))n!=="__proto__"&&(r[n]=ie(r[n])&&ie(o)?ae(r[n],o):o);return r}i(ae,"mergeConfig");function Be(e){return e.kind==="file"?e.path:e.href}i(Be,"describeSource");async function Rr(e){if(e.kind==="file")return{text:await Cr(e.path,"utf8"),source:e};let t;try{t=await fetch(e.href,{cache:"no-store",redirect:"follow",signal:AbortSignal.timeout(Mr)})}catch(r){let n=r.cause instanceof Error?r.cause.message:r.message;throw new Error(`Failed to fetch config ${e.href}: ${n}`,{cause:r})}if(!t.ok)throw new Error(`Failed to fetch config ${e.href}: HTTP ${t.status} ${t.statusText}`);return{text:await t.text(),source:{kind:"url",href:t.url}}}i(Rr,"readSource");function He(e){if(e.protocol==="http:"&&!Pr.has(e.hostname))throw new Error(`Refusing to fetch config over plain http: ${e.href} (use https)`);return{kind:"url",href:e.href}}i(He,"toUrlSource");function Ir(e,t){if(/^https?:\/\//i.test(e))return He(new URL(e));if(/^[a-z][a-z\d+.-]+:\/\//i.test(e))throw new Error(`Unsupported extends URL "${e}" in ${Be(t)}; use https, a file path or a package path`);let r=/^\.{1,2}[\\/]/.test(e);if(t.kind==="url"){if(r||e.startsWith("/"))return He(new URL(e,t.href));throw new Error(`Cannot extend package "${e}" from the remote config ${t.href}; use a URL or a relative path`)}if(r||Lr(e))return{kind:"file",path:ze(jr(t.path),e)};try{return{kind:"file",path:Fr(t.path).resolve(e)}}catch(n){throw new Error(`Cannot resolve extends "${e}" from ${t.path}: ${n.message}`,{cause:n})}}i(Ir,"resolveReference");function Or(e,t){if(e===void 0)return[];let r=Array.isArray(e)?e:[e];if(!r.every(n=>typeof n=="string"&&n.trim().length>0))throw new Error(`Config "extends" must be a string or an array of strings: ${t}`);return r.map(n=>n.trim())}i(Or,"readExtends");async function We(e,t){let r=Be(e);if(t.includes(r))throw new Error(`Config extends cycle: ${[...t,r].join(" -> ")}`);let{text:n,source:o}=await Rr(e),a;try{a=JSON.parse(n)}catch(u){throw new Error(`Config ${r} is not valid JSON: ${u.message}`,{cause:u})}if(!ie(a))throw new Error(`Config file must contain a JSON object: ${r}`);let{extends:s,...c}=a,l={};for(let u of Or(s,r))l=ae(l,await We(Ir(u,o),[...t,r]));return ae(l,c)}i(We,"loadSource");function Tr(e,t=process.cwd()){return We({kind:"file",path:ze(t,e)},[])}i(Tr,"loadConfigFile");async function V(e,t){let r=typeof e[t]=="string"?e[t].trim():"";if(r.length===0)return e;let n=typeof e.cwd=="string"&&e.cwd.length>0?e.cwd:process.cwd(),o={...await Tr(r,n),...e};return delete o[t],o}i(V,"applyConfigOption");import{readFile as io,stat as ao,writeFile as so}from"node:fs/promises";import{relative as gr,resolve as yr}from"node:path";import{extname as lt}from"node:path";import{extname as Ur}from"node:path";var Ye=[".css"];function _r(e){let t=Ur(e).toLowerCase();return Ye.includes(t)?{kind:"block",blockStart:"/*",blockLinePrefix:" * ",blockEnd:" */"}:null}i(_r,"resolveCssCommentSyntax");var Ge={id:"css",extensions:Ye,enabledByDefault:!0,resolveCommentSyntax(e){return _r(e)}};import{extname as Hr}from"node:path";var Ve=[".go"];function zr(e){let t=Hr(e).toLowerCase();return Ve.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(zr,"resolveGoCommentSyntax");var Je={id:"go",extensions:Ve,enabledByDefault:!0,resolveCommentSyntax(e){return zr(e)}};import{extname as Br}from"node:path";var Ke=[".html",".htm"];function Wr(e){let t=Br(e).toLowerCase();return Ke.includes(t)?{kind:"html",blockStart:"<!--",blockLinePrefix:" ",blockEnd:"-->"}:null}i(Wr,"resolveHtmlCommentSyntax");var qe={id:"html",extensions:Ke,enabledByDefault:!0,resolveCommentSyntax(e){return Wr(e)}};import{extname as Yr}from"node:path";var Xe=[".jsonv",".jsonc",".json5"];function Gr(e){let t=Yr(e).toLowerCase();return Xe.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(Gr,"resolveJsonCommentSyntax");var Ze={id:"json",extensions:Xe,enabledByDefault:!0,resolveCommentSyntax(e){return Gr(e)}};import{extname as Vr}from"node:path";var Qe=[".js",".mjs",".cjs",".ts",".tsx",".jsx"];function Jr(e){let t=Vr(e).toLowerCase();return Qe.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(Jr,"resolveNodeCommentSyntax");function Kr(e,t){let r=t.match(/^#!.*\b(node|bun|deno|tsx|ts-node)\b.*(?:\r?\n|$)/);return r?r[0]:""}i(Kr,"resolveNodePreservedPrefix");var et={id:"node",extensions:Qe,enabledByDefault:!0,resolvePreservedPrefix(e,t){return Kr(e,t)},resolveCommentSyntax(e){return Jr(e)}};import{extname as qr}from"node:path";var tt=[".php"];function Xr(e){let t=qr(e).toLowerCase();return tt.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(Xr,"resolvePhpCommentSyntax");var rt={id:"php",extensions:tt,enabledByDefault:!0,resolveCommentSyntax(e){return Xr(e)}};import{extname as Zr}from"node:path";var nt=[".py"];function Qr(e,t){let r=t.match(/^#!.*\bpython(?:\d+(?:\.\d+)*)?\b.*(?:\r?\n|$)/);return r?r[0]:""}i(Qr,"resolvePythonPreservedPrefix");var ot={id:"python",extensions:nt,enabledByDefault:!0,resolvePreservedPrefix(e,t){return Qr(e,t)},resolveCommentSyntax(e){let t=Zr(e).toLowerCase();return nt.includes(t)?{kind:"line",linePrefix:"#"}:null}};import{extname as en}from"node:path";var it=[".rs"];function tn(e){let t=en(e).toLowerCase();return it.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(tn,"resolveRustCommentSyntax");var at={id:"rust",extensions:it,enabledByDefault:!0,resolveCommentSyntax(e){return tn(e)}};import{extname as rn}from"node:path";var st=[".yaml",".yml"];function nn(e){let t=rn(e).toLowerCase();return st.includes(t)?{kind:"line",linePrefix:"#"}:null}i(nn,"resolveYamlCommentSyntax");var ct={id:"yaml",extensions:st,enabledByDefault:!0,resolveCommentSyntax(e){return nn(e)}};var ut=[Ge,Je,qe,Ze,et,rt,ot,at,ct],yi=new Map(ut.map(e=>[e.id,e]));function on(e,t){return!t||typeof t!="object"?e:e.kind==="line"?{...e,linePrefix:typeof t.linePrefix=="string"&&t.linePrefix.length>0?t.linePrefix:e.linePrefix,lineSeparator:typeof t.lineSeparator=="string"?t.lineSeparator:e.lineSeparator}:{...e,blockStart:typeof t.blockStart=="string"&&t.blockStart.length>0?t.blockStart:e.blockStart,blockLinePrefix:typeof t.blockLinePrefix=="string"&&t.blockLinePrefix.length>0?t.blockLinePrefix:e.blockLinePrefix,blockEnd:typeof t.blockEnd=="string"&&t.blockEnd.length>0?t.blockEnd:e.blockEnd}}i(on,"applySyntaxOverride");function L(e={}){let t=new Set(Array.isArray(e.enabledDetectors)?e.enabledDetectors:[]),r=new Set(Array.isArray(e.disabledDetectors)?e.disabledDetectors:[]);return ut.filter(n=>t.size>0?t.has(n.id):r.has(n.id)?!1:n.enabledByDefault)}i(L,"getEnabledDetectors");function dt(e={}){if(Array.isArray(e.includeExtensions)&&e.includeExtensions.length>0)return new Set(e.includeExtensions.map(r=>r.toLowerCase()));let t=L(e);return new Set(t.flatMap(r=>r.extensions))}i(dt,"getAllowedExtensions");function ft(e,t={}){let r=lt(e).toLowerCase(),n=Array.isArray(t.detectors)?t.detectors:L(t);for(let o of n){if(!o.extensions.includes(r))continue;let a=o.resolveCommentSyntax(e);if(a){let s=t.detectorSyntaxOverrides&&typeof t.detectorSyntaxOverrides=="object"?t.detectorSyntaxOverrides:{};return on(a,s[o.id])}}return{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}}i(ft,"getCommentSyntaxForFile");function mt(e,t,r={}){let n=lt(e).toLowerCase(),o=L(r);for(let a of o)if(a.extensions.includes(n))return typeof a.resolvePreservedPrefix=="function"?a.resolvePreservedPrefix(e,t):"";return""}i(mt,"getPreservedPrefixForFile");var pt=200,R=1,J=2;function N(e,t,r){if(e==null)return r;if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error(`${t} must be a whole number of 0 or more, got ${JSON.stringify(e)}`);return e}i(N,"resolveLayoutCount");import{join as At,relative as $t,resolve as pe,sep as fe}from"node:path";import{realpath as yn,stat as xn}from"node:fs/promises";import{access as an,readdir as sn,readFile as Di,stat as cn}from"node:fs/promises";import{constants as ln}from"node:fs";import{dirname as $i,join as un,resolve as vi}from"node:path";async function se(e){try{return await an(e,ln.F_OK),!0}catch{return!1}}i(se,"pathExists");async function ce(e,t){let r=[],n=await sn(e,{withFileTypes:!0});for(let o of n){let a=un(e,o.name);if(o.isDirectory()&&t.recursive===!1||o.isDirectory()&&t.ignoreFolders.has(o.name)||o.isDirectory()&&await t.shouldSkipDirectory?.(a,o.name)===!0)continue;if(o.isDirectory()){let l=await ce(a,t);r.push(...l);continue}if(!o.isFile())continue;let s=o.name.lastIndexOf(".");if(s===-1)continue;let c=o.name.slice(s).toLowerCase();t.allowedExtensions.has(c)&&r.push(a)}return r}i(ce,"walkFiles");async function ht(e){let t=await cn(e);return{createdAt:t.birthtimeMs>0&&t.birthtime<t.mtime?t.birthtime:t.mtime,updatedAt:t.mtime}}i(ht,"readFileDates");import{execFile as dn}from"node:child_process";import{lstat as fn,readFile as mn}from"node:fs/promises";import{dirname as gt,isAbsolute as pn,join as bt,relative as wt,resolve as le,sep as Et}from"node:path";import hn from"ignore";function yt(e,t){return new Promise(r=>{dn("git",t,{cwd:e,encoding:"utf8",maxBuffer:Number.POSITIVE_INFINITY},(n,o)=>{if(!n){r({code:0,stdout:o});return}r({code:typeof n.code=="number"?n.code:-1,stdout:""})})})}i(yt,"runGitCommand");function de(e,t){return wt(e,t).split(Et).join("/")}i(de,"toPosixRelative");async function St(e){try{return hn().add(await mn(e,"utf8"))}catch{return null}}i(St,"readIgnoreFile");async function gn(e){return fn(bt(e,".git")).then(()=>!0,()=>!1)}i(gn,"hasGitEntry");function xt(e,t,r){for(let n=e.length-1;n>=0;n--){let{base:o,rules:a}=e[n],s=a.test(`${de(o,t)}${r?"/":""}`);if(s.ignored||s.unignored)return s.ignored}return!1}i(xt,"matchesRules");async function Dt(e,t){let r=await St(bt(e,".gitignore"));return{kind:"rules",nested:!0,excluded:!1,matchers:r?[...t,{base:e,rules:r}]:t}}i(Dt,"buildRulesContext");async function ue(e){let[t,r]=await Promise.all([yt(e,["check-ignore","-q","."]),yt(e,["ls-files","--cached","--others","--exclude-standard","-z"])]);if(t.code!==1||r.code!==0)return Dt(e,[]);let n=new Set,o=new Set;for(let a of r.stdout.split("\0")){let s=a.endsWith("/")?a.slice(0,-1):a;if(s.length!==0){n.add(s);for(let c=s.indexOf("/");c!==-1;c=s.indexOf("/",c+1))o.add(s.slice(0,c))}}return{kind:"git",root:e,entries:n,dirs:o}}i(ue,"resolveScopeContext");function kt(e){let t=le(e.root),r=e.gitignore;if(r===!1)return{isIgnored:i(async()=>!1,"isIgnored")};let n=new Map,o=i(async()=>{if(typeof r!="string"&&!Array.isArray(r))return ue(t);let c=typeof r=="string"?[r]:r.filter(u=>typeof u=="string"),l=[];for(let u of c){let f=await St(le(t,u));f&&l.push({base:t,rules:f})}return{kind:"rules",nested:!1,excluded:!1,matchers:l}},"buildRootContext"),a=i(c=>{let l=n.get(c);return l||(l=c===t?o():s(c),n.set(c,l)),l},"contextFor"),s=i(async c=>{let l=await a(gt(c));return l.kind==="git"?l.entries.has(de(l.root,c))?ue(c):l:!l.nested||l.excluded?l:xt(l.matchers,c,!0)?{...l,excluded:!0}:await gn(c)?ue(c):Dt(c,l.matchers)},"deriveContext");return{async isIgnored(c,l){let u=le(c),f=wt(t,u);if(f.length===0||f===".."||f.startsWith(`..${Et}`)||pn(f))return!1;let p=await a(gt(u));if(p.kind==="git"){let g=de(p.root,u);return!(p.entries.has(g)||l&&p.dirs.has(g))}return p.excluded||xt(p.matchers,u,l)}}}i(kt,"createIgnoreFilter");function bn(e){return dt(e)}i(bn,"resolveExtensions");var vt=new Set([".git"]);function me(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}i(me,"normalizeFolderPath");function wn(e){return Array.isArray(e)?e.map(t=>{if(typeof t=="string")return{path:t,recursive:!0};if(t&&typeof t=="object"&&typeof t.path=="string")return{path:t.path,recursive:t.recursive!==!1};throw new TypeError(`Invalid includeFolders entry: ${JSON.stringify(t)} (expected a path string or { path, recursive? })`)}):[]}i(wn,"resolveIncludeFolders");function Nt(e,t){let r=t instanceof Error?t.message:String(t);console.warn(`fix-headers: skipped include folder "${e}" (${r})`)}i(Nt,"reportSkippedIncludeFolder");function En(e,t){if(!Array.isArray(t)||t.length===0)return()=>!1;let r=pe(e),n=[],o=new Set;for(let a of t){if(typeof a!="string")continue;let s=me(a);if(s.length!==0){if(s.includes("/")){n.push(pe(r,s));continue}o.add(s)}}return(a,s)=>{if(o.has(s))return!0;for(let l of n)if(a===l||a.startsWith(`${l}/`))return!0;let c=me($t(r,a));return n.some(l=>{let u=me($t(r,l));return c===u||c.startsWith(`${u}/`)})}}i(En,"buildExclusionMatcher");async function he(e){let t=bn(e),r=wn(e.includeFolders),n=Array.isArray(e.excludeFolders)?e.excludeFolders:[],o=En(e.projectRoot,n),a=kt({root:e.projectRoot,gitignore:e.gitignore}),s=i(async(m,h)=>o(m,h)||await a.isIgnored(m,!0),"shouldSkipDirectory"),c=r.length>0?r.map(m=>({includeFolder:m.path,rootPath:At(e.projectRoot,m.path),recursive:m.recursive})):[{includeFolder:".",rootPath:e.projectRoot,recursive:!0}],l=[];for(let m of c){let h=await xn(m.rootPath).catch(S=>S);if(h instanceof Error){if(h.code==="ENOENT"){Nt(m.includeFolder,h);continue}throw h}if(!h.isDirectory()){Nt(m.includeFolder,`path is not a directory: ${m.rootPath}`);continue}let w=await yn(m.rootPath).catch(()=>pe(m.rootPath));l.push({...m,realRoot:w})}let u=i((m,h)=>{if(m.realRoot===h.realRoot)return m.recursive||!h.recursive;let w=m.realRoot.endsWith(fe)?m.realRoot:`${m.realRoot}${fe}`;if(!m.recursive||!h.realRoot.startsWith(w))return!1;let S=m.rootPath;for(let A of h.realRoot.slice(w.length).split(fe))if(S=At(S,A),vt.has(A)||o(S,A))return!1;return!0},"covers"),f=[...l].sort((m,h)=>m.realRoot.length-h.realRoot.length||Number(h.recursive)-Number(m.recursive)),p=[];for(let m of f)p.some(h=>u(h,m))||p.push(m);let g=[];for(let m of l){if(!p.includes(m))continue;let h=await ce(m.rootPath,{allowedExtensions:t,ignoreFolders:vt,shouldSkipDirectory:s,recursive:m.recursive});g.push(...h)}let y=[];for(let m of new Set(g))!o(m,m.split("/").at(-1)||"")&&!await a.isIgnored(m,!1)&&y.push(m);return y}i(he,"discoverFiles");import{basename as Wn,dirname as Yn,extname as Gn,resolve as we}from"node:path";import{dirname as _t,isAbsolute as Ln,join as Ht,relative as Mn,resolve as zt,sep as Pn}from"node:path";import{readFile as Sn}from"node:fs/promises";import{join as Dn}from"node:path";async function kn(e){try{return await Sn(e,"utf8")}catch{return null}}i(kn,"readManifest");async function D(e,t){let r=[];for(let n of t){let o=await kn(Dn(e,n));o!==null&&r.push({file:n,content:o})}return r.length>0?{dir:e,manifest:r[0].file,files:r}:null}i(D,"detectManifests");function C(e,t){return e.files.find(r=>r.file===t)?.content??null}i(C,"manifestContent");function b(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}i(b,"cleanName");function ge(e){if(typeof e!="string")return;let t=e.search(/[<(]/);return b(t===-1?e:e.slice(0,t))}i(ge,"personName");function K(e){try{return JSON.parse(e)}catch{return}}i(K,"parseJsonManifest");function*ye(e,t){let r="";for(let n of e.split(/\r?\n/)){let o=n.trim();if(o.startsWith("[")){let a=o.match(/^\[([^[\]]+)\]/);r=a?a[1].split(".").map(s=>s.trim()).join("."):"";continue}r===t&&(yield o)}}i(ye,"sectionLines");function I(e,t,r){let n=new RegExp(`^${r}\\s*=\\s*(?:"([^"\\\\]*)"|'([^']*)')`);for(let o of ye(e,t)){let a=o.match(n);if(a)return b(a[1]??a[2])}}i(I,"readTomlString");function xe(e,t,r){let n=new RegExp(`^${r}\\s*[=:](.*)$`);for(let o of ye(e,t)){let a=o.match(n);if(a)return b(a[1])}}i(xe,"readIniValue");function An(e,t,r){let n=new RegExp(`^${r}\\s*=\\s*\\[`),o=null;for(let a of ye(e,t)){if(o!==null){o.push(a);continue}let s=a.match(n);s&&(o=[a.slice(s[0].length)])}return o===null?null:o.join(`
3
3
  `)}i(An,"tomlArrayText");function $n(e,t){let r=t;for(;r<e.length;)if(e[r]==="#"){let n=e.indexOf(`
4
- `,r);r=n===-1?e.length:n+1}else if(/\s/.test(e[r]))r+=1;else break;return r}i($n,"skipTomlSpace");function O(e,t){let r=An(e,t,"authors");if(r===null)return;let n=r.slice($n(r,0)),o=n.match(/^(?:"([^"\\\n]*)"|'([^'\n]*)')/);if(o)return ge(o[1]??o[2]);let s=n.match(/^\{([^}\n]*)\}/)?.[1].match(/(?:^|,)\s*name\s*=\s*(?:"([^"\\\n]*)"|'([^'\n]*)')/);return s?b(s[1]??s[2]):void 0}i(O,"readTomlAuthor");var Ct=["go.mod"];function vn(e){let t=e.match(/^\s*module\s+(.+)$/m);if(t)return b(t[1].replace(/\/\/.*$/,"").trim().replace(/^["`](.*)["`]$/,"$1"))}i(vn,"readModulePath");var Ft={id:"go",languages:["go"],manifests:Ct,detect(e){return D(e,Ct)},read(e){return{name:vn(e.files[0].content)}}};var jt=["package.json"];function Nn(e){let t=b(e?.name),r=b(e?.publisher),n=typeof e?.engines?.vscode=="string";return t&&r&&n?`${r}.${t}`:t}i(Nn,"readPublishedName");function Cn(e){if(e!==null&&typeof e=="object"){let t=e;return b(t.company)??b(t.name)}return ge(e)}i(Cn,"readAuthorCompany");var Lt={id:"node",languages:["node"],manifests:jt,detect(e){return D(e,jt)},read(e){let t=K(e.files[0].content);return{name:Nn(t),company:Cn(t?.author)}}};var Mt=["composer.json"],Pt={id:"php",languages:["php"],manifests:Mt,detect(e){return D(e,Mt)},read(e){let t=K(e.files[0].content),r=t?.authors;return{name:b(t?.name),company:Array.isArray(r)?b(r[0]?.name):void 0}}};var Rt=["pyproject.toml","setup.cfg","setup.py"];function It(e,t){let r=e.indexOf("setup(");if(r===-1)return;let n=e.slice(r).match(new RegExp(`\\b${t}\\s*=\\s*(["'])([^"'\\n]+)\\1`));return n&&n[2].trim()||void 0}i(It,"readSetupPyArgument");function Fn(e){let t=C(e,"pyproject.toml"),r=C(e,"setup.cfg"),n=C(e,"setup.py");return(t===null?void 0:I(t,"project","name")??I(t,"tool.poetry","name"))??(r===null?void 0:xe(r,"metadata","name"))??(n===null?void 0:It(n,"name"))}i(Fn,"readPythonName");function jn(e){let t=C(e,"pyproject.toml"),r=C(e,"setup.cfg"),n=C(e,"setup.py");return(t===null?void 0:O(t,"project")??O(t,"tool.poetry"))??(r===null?void 0:xe(r,"metadata","author"))??(n===null?void 0:It(n,"author"))}i(jn,"readPythonCompany");var Ot={id:"python",languages:["python"],manifests:Rt,detect(e){return D(e,Rt)},read(e){return{name:Fn(e),company:jn(e)}}};var Tt=["Cargo.toml"],Ut={id:"rust",languages:["rust"],manifests:Tt,detect(e){return D(e,Tt)},read(e){let t=e.files[0].content;return{name:I(t,"package","name"),company:O(t,"package")}}};var Rn=[Lt,Ot,Pt,Ut,Ft],Bt=["name","company"];async function be(e,t,r){let o=(await Promise.all(t.map(async s=>({driver:s,detection:await s.detect(e)})))).filter(s=>s.detection!==null),a=o.filter(s=>typeof r=="string"&&s.driver.languages.includes(r));return[...a,...o.filter(s=>!a.includes(s))]}i(be,"claimFolder");function In(e,t){let r=Mn(t,e);return r!==""&&r!==".."&&!r.startsWith(`..${Pn}`)&&!Ln(r)}i(In,"isStrictlyInside");async function Wt(e,t={}){let r=Array.isArray(t.drivers)?t.drivers:Rn,n=typeof t.scanRoot=="string"?zt(t.scanRoot):null,o=zt(e),a=await be(o,r,t.language);for(;a.length===0;){if(await se(Ht(o,".git")))return{root:o,marker:".git",drivers:[],fields:{},sources:{}};let f=_t(o);if(f===o)return null;o=f,a=await be(o,r,t.language)}let s={},c={},l=o,u=a;for(;;){for(let{driver:p,detection:x}of u){let g=p.read(x);for(let m of Bt)s[m]===void 0&&g[m]!==void 0&&(s[m]=g[m],c[m]={driver:p.id,manifest:x.manifest,dir:l})}if(Bt.every(p=>s[p]!==void 0)||n===null||!In(l,n)||await se(Ht(l,".git")))break;l=_t(l),u=await be(l,r,t.language)}return{root:o,marker:a[0].detection.manifest,drivers:a.map(f=>f.driver.id),fields:s,sources:c}}i(Wt,"resolveManifestProject");import{execFile as On}from"node:child_process";import{promisify as Tn}from"node:util";var Gt=Tn(On);async function k(e,t){try{let{stdout:r}=await Gt("git",t,{cwd:e}),n=r.trim();return n.length>0?n:null}catch{return null}}i(k,"runGit");function Yt(e,t){let r=0;for(let n=t-1;n>=0&&e[n]==="\\";n--)r++;return r%2===1}i(Yt,"isEscaped");function Un(e){let t=e.trim();if(!t.endsWith(")")||Yt(t,t.length-1))return t;let r=0;for(let n=t.length-1;n>=0;n--){let o=t[n];if(!(o!=="("&&o!==")"||Yt(t,n))&&(r+=o===")"?1:-1,r===0))return t.slice(0,n).trim()}return t}i(Un,"stripUidComment");function _n(e){let t=e.trim();if(t.length===0)return{authorName:null,authorEmail:null};let r=t.match(/<([^>\n]+)>\s*$/),n=r?.[1]?.trim()||null,o=(r?t.slice(0,r.index):t).trim();return{authorName:Un(o)||o||null,authorEmail:n}}i(_n,"parseSignerUid");async function Hn(e,t){try{let{stdout:r}=await Gt(e,t),n=r.trim();return n.length>0?n:null}catch{return null}}i(Hn,"runProgram");function zn(e){return e.replace(/\\x([0-9a-fA-F]{2})/g,(t,r)=>String.fromCharCode(Number.parseInt(r,16)))}i(zn,"decodeColonField");async function Bn(e){let t=await k(e,["config","--get","gpg.format"]);if(t!==null&&t!=="openpgp")return null;let r=await k(e,["config","--get","user.signingkey"]);if(!r)return null;let n=await k(e,["config","--get","gpg.openpgp.program"])||await k(e,["config","--get","gpg.program"])||"gpg",o=await Hn(n,["--batch","--with-colons","--list-keys",r]);if(!o)return null;for(let a of o.split(`
4
+ `,r);r=n===-1?e.length:n+1}else if(/\s/.test(e[r]))r+=1;else break;return r}i($n,"skipTomlSpace");function O(e,t){let r=An(e,t,"authors");if(r===null)return;let n=r.slice($n(r,0)),o=n.match(/^(?:"([^"\\\n]*)"|'([^'\n]*)')/);if(o)return ge(o[1]??o[2]);let s=n.match(/^\{([^}\n]*)\}/)?.[1].match(/(?:^|,)\s*name\s*=\s*(?:"([^"\\\n]*)"|'([^'\n]*)')/);return s?b(s[1]??s[2]):void 0}i(O,"readTomlAuthor");var Ct=["go.mod"];function vn(e){let t=e.match(/^\s*module\s+(.+)$/m);if(t)return b(t[1].replace(/\/\/.*$/,"").trim().replace(/^["`](.*)["`]$/,"$1"))}i(vn,"readModulePath");var Ft={id:"go",languages:["go"],manifests:Ct,detect(e){return D(e,Ct)},read(e){return{name:vn(e.files[0].content)}}};var jt=["package.json"];function Nn(e){let t=b(e?.name),r=b(e?.publisher),n=typeof e?.engines?.vscode=="string";return t&&r&&n?`${r}.${t}`:t}i(Nn,"readPublishedName");function Cn(e){if(e!==null&&typeof e=="object"){let t=e;return b(t.company)??b(t.name)}return ge(e)}i(Cn,"readAuthorCompany");var Lt={id:"node",languages:["node"],manifests:jt,detect(e){return D(e,jt)},read(e){let t=K(e.files[0].content);return{name:Nn(t),company:Cn(t?.author)}}};var Mt=["composer.json"],Pt={id:"php",languages:["php"],manifests:Mt,detect(e){return D(e,Mt)},read(e){let t=K(e.files[0].content),r=t?.authors;return{name:b(t?.name),company:Array.isArray(r)?b(r[0]?.name):void 0}}};var Rt=["pyproject.toml","setup.cfg","setup.py"];function It(e,t){let r=e.indexOf("setup(");if(r===-1)return;let n=e.slice(r).match(new RegExp(`\\b${t}\\s*=\\s*(["'])([^"'\\n]+)\\1`));return n&&n[2].trim()||void 0}i(It,"readSetupPyArgument");function Fn(e){let t=C(e,"pyproject.toml"),r=C(e,"setup.cfg"),n=C(e,"setup.py");return(t===null?void 0:I(t,"project","name")??I(t,"tool.poetry","name"))??(r===null?void 0:xe(r,"metadata","name"))??(n===null?void 0:It(n,"name"))}i(Fn,"readPythonName");function jn(e){let t=C(e,"pyproject.toml"),r=C(e,"setup.cfg"),n=C(e,"setup.py");return(t===null?void 0:O(t,"project")??O(t,"tool.poetry"))??(r===null?void 0:xe(r,"metadata","author"))??(n===null?void 0:It(n,"author"))}i(jn,"readPythonCompany");var Ot={id:"python",languages:["python"],manifests:Rt,detect(e){return D(e,Rt)},read(e){return{name:Fn(e),company:jn(e)}}};var Tt=["Cargo.toml"],Ut={id:"rust",languages:["rust"],manifests:Tt,detect(e){return D(e,Tt)},read(e){let t=e.files[0].content;return{name:I(t,"package","name"),company:O(t,"package")}}};var Rn=[Lt,Ot,Pt,Ut,Ft],Bt=["name","company"];async function be(e,t,r){let o=(await Promise.all(t.map(async s=>({driver:s,detection:await s.detect(e)})))).filter(s=>s.detection!==null),a=o.filter(s=>typeof r=="string"&&s.driver.languages.includes(r));return[...a,...o.filter(s=>!a.includes(s))]}i(be,"claimFolder");function In(e,t){let r=Mn(t,e);return r!==""&&r!==".."&&!r.startsWith(`..${Pn}`)&&!Ln(r)}i(In,"isStrictlyInside");async function Wt(e,t={}){let r=Array.isArray(t.drivers)?t.drivers:Rn,n=typeof t.scanRoot=="string"?zt(t.scanRoot):null,o=zt(e),a=await be(o,r,t.language);for(;a.length===0;){if(await se(Ht(o,".git")))return{root:o,marker:".git",drivers:[],fields:{},sources:{}};let f=_t(o);if(f===o)return null;o=f,a=await be(o,r,t.language)}let s={},c={},l=o,u=a;for(;;){for(let{driver:p,detection:g}of u){let y=p.read(g);for(let m of Bt)s[m]===void 0&&y[m]!==void 0&&(s[m]=y[m],c[m]={driver:p.id,manifest:g.manifest,dir:l})}if(Bt.every(p=>s[p]!==void 0)||n===null||!In(l,n)||await se(Ht(l,".git")))break;l=_t(l),u=await be(l,r,t.language)}return{root:o,marker:a[0].detection.manifest,drivers:a.map(f=>f.driver.id),fields:s,sources:c}}i(Wt,"resolveManifestProject");import{execFile as On}from"node:child_process";import{promisify as Tn}from"node:util";var Gt=Tn(On);async function k(e,t){try{let{stdout:r}=await Gt("git",t,{cwd:e}),n=r.trim();return n.length>0?n:null}catch{return null}}i(k,"runGit");function Yt(e,t){let r=0;for(let n=t-1;n>=0&&e[n]==="\\";n--)r++;return r%2===1}i(Yt,"isEscaped");function Un(e){let t=e.trim();if(!t.endsWith(")")||Yt(t,t.length-1))return t;let r=0;for(let n=t.length-1;n>=0;n--){let o=t[n];if(!(o!=="("&&o!==")"||Yt(t,n))&&(r+=o===")"?1:-1,r===0))return t.slice(0,n).trim()}return t}i(Un,"stripUidComment");function _n(e){let t=e.trim();if(t.length===0)return{authorName:null,authorEmail:null};let r=t.match(/<([^>\n]+)>\s*$/),n=r?.[1]?.trim()||null,o=(r?t.slice(0,r.index):t).trim();return{authorName:Un(o)||o||null,authorEmail:n}}i(_n,"parseSignerUid");async function Hn(e,t){try{let{stdout:r}=await Gt(e,t),n=r.trim();return n.length>0?n:null}catch{return null}}i(Hn,"runProgram");function zn(e){return e.replace(/\\x([0-9a-fA-F]{2})/g,(t,r)=>String.fromCharCode(Number.parseInt(r,16)))}i(zn,"decodeColonField");async function Bn(e){let t=await k(e,["config","--get","gpg.format"]);if(t!==null&&t!=="openpgp")return null;let r=await k(e,["config","--get","user.signingkey"]);if(!r)return null;let n=await k(e,["config","--get","gpg.openpgp.program"])||await k(e,["config","--get","gpg.program"])||"gpg",o=await Hn(n,["--batch","--with-colons","--list-keys",r]);if(!o)return null;for(let a of o.split(`
5
5
  `)){let s=a.split(":");if(s[0]==="uid"&&s[1]!=="r"&&s[1]!=="e"&&s[9])return zn(s[9])}return null}i(Bn,"readSigningKeyUid");async function Vt(e,t={}){let r=await k(e,["config","--get","user.name"]),n=await k(e,["config","--get","user.email"]);if(t.useGpgSignerAuthor===!0){let o=await Bn(e)||await k(e,["log","-1","--format=%GS"]),a=_n(o||"");r=a.authorName||r,n=n||a.authorEmail}if(!r||!n){let o=await k(e,["log","-1","--format=%an|%ae"]);if(o){let[a,s]=o.split("|");r=r||a||null,n=n||s||null}}return{authorName:r,authorEmail:n}}i(Vt,"detectGitAuthor");function Jt(e){return e.replace(/z$/i,"+00:00")}i(Jt,"canonicalGitDate");async function Kt(e,t){let r=await k(e,["log","--follow","--format=%aI|%at","--reverse","--",t]);if(!r)return null;let n=r.split(`
6
6
  `)[0],[o,a]=n.split("|");if(!o||!a)return null;let s=Number.parseInt(a,10);return Number.isNaN(s)?null:{date:Jt(o),timestamp:s}}i(Kt,"getGitCreationDate");async function qt(e,t){let r=await k(e,["log","-1","--format=%aI|%at","--",t]);if(!r)return null;let[n,o]=r.split("|");if(!n||!o)return null;let a=Number.parseInt(o,10);return Number.isNaN(a)?null:{date:Jt(n),timestamp:a}}i(qt,"getGitLastModifiedDate");function Vn(e){return Wn(e)||"project"}i(Vn,"folderName");function Jn(e,t){if(typeof t!="string")return e;let r=t.trim();return r.length===0||/<[^>]+>/.test(e)?e:`${e} <${r}>`}i(Jn,"formatAuthorNameWithCompany");async function Kn(e,t={}){let r=Array.isArray(t.detectors)?t.detectors:L(t),n=typeof t.preferredExtension=="string"?t.preferredExtension.trim().toLowerCase():"",o=n.length>0?r.find(u=>u.extensions.includes(n)):void 0,a=await Wt(e,{drivers:t.drivers,language:o?.id,scanRoot:t.scanRoot}),s=a?a.root:we(e),c=a?.sources.name,l=a?.sources.company;return{language:o?.id??a?.drivers[0]??"unknown",rootDir:s,marker:a?a.marker:null,projectName:a?.fields.name??Vn(s),projectNameSource:c?{from:"manifest",...c}:{from:"folder",dir:s},companyName:a?.fields.company??null,companyNameSource:l?{from:"manifest",...l}:{from:"none"},drivers:a?a.drivers:[]}}i(Kn,"detectProjectFromMarkers");async function Ee(e={}){let t=e.targetFilePath||e.cwd||process.cwd(),r=we(t),n=L(e),o=e.targetFilePath?Yn(r):r,a=e.targetFilePath?Gn(r).toLowerCase():"",s=we(e.projectRoot||e.cwd||process.cwd()),c=await Kn(o,{detectors:n,preferredExtension:a,scanRoot:s}),l=await Vt(c.rootDir,{useGpgSignerAuthor:e.useGpgSignerAuthor===!0}),u=e.authorName||l.authorName||"Unknown Author",f=typeof e.companyName=="string"?e.companyName.trim():"";return{projectName:e.projectName||c.projectName,projectNameSource:e.projectName?{from:"option"}:c.projectNameSource,language:e.language||c.language,projectRoot:e.projectRoot||c.rootDir,marker:e.marker===void 0?c.marker:e.marker,authorName:Jn(u,e.company),authorEmail:e.authorEmail||l.authorEmail||"unknown@example.com",companyName:f||c.companyName,companyNameSource:f?{from:"option"}:c.companyNameSource,copyrightStartYear:Number.isInteger(e.copyrightStartYear)?Number(e.copyrightStartYear):null}}i(Ee,"resolveProjectMetadata");function qn(e){return Se({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),offsetMinutes:-e.getTimezoneOffset()})}i(qn,"formatDateWithTimezone");function Se(e){return`${er(e," ")} ${tr(e.offsetMinutes)}`}i(Se,"formatSpaceDate");function Zt(e){if(typeof e!="string")throw new Error(`timezone must be an IANA time zone name string, such as "America/Los_Angeles" or "UTC" (got ${typeof e})`);try{Qt(e)}catch(t){throw new Error(`Unknown time zone "${e}": expected an IANA time zone name, such as "America/Los_Angeles" or "UTC"`,{cause:t})}return e}i(Zt,"assertTimeZone");var Xt=new Map;function Qt(e){let t=Xt.get(e);return t||(t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),Xt.set(e,t)),t}i(Qt,"getZoneFormatter");function De(e,t){let r={};for(let o of Qt(t).formatToParts(new Date(e*1e3)))r[o.type]=Number(o.value);let n=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second)/1e3;return{year:r.year,month:r.month,day:r.day,hour:r.hour,minute:r.minute,second:r.second,offsetMinutes:(n-e)/60}}i(De,"toZonedDateParts");function er(e,t){let r=i(n=>String(n).padStart(2,"0"),"pad");return`${String(e.year).padStart(4,"0")}-${r(e.month)}-${r(e.day)}${t}${r(e.hour)}:${r(e.minute)}:${r(e.second)}`}i(er,"formatWallClock");function tr(e){let t=i(n=>String(n).padStart(2,"0"),"pad"),r=Math.abs(e);return`${e>=0?"+":"-"}${t(Math.floor(r/60))}:${t(r%60)}`}i(tr,"formatOffset");function q(e=new Date){return{date:qn(e),timestamp:Math.floor(e.getTime()/1e3)}}i(q,"toDatePayload");var Xn=/^(\d{4})-(\d{2})-(\d{2})(?:T|\s+)(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?\s*(?:(Z)|([+-])(\d{2}):?(\d{2}))$/i;function F(e){let t=Xn.exec(e.trim());if(!t)return null;let[r,n,o,a,s,c]=t.slice(1,7).map(Number),l=t[7]?0:Number(t[9])*60+Number(t[10]),u=t[8]==="-"?-l:l,f=new Date(Date.UTC(r,n-1,o,a,s,c));return!(f.getUTCFullYear()===r&&f.getUTCMonth()===n-1&&f.getUTCDate()===o&&f.getUTCHours()===a&&f.getUTCMinutes()===s&&f.getUTCSeconds()===c)||Number(t[10]??0)>59?null:{year:r,month:n,day:o,hour:a,minute:s,second:c,offsetMinutes:u,timestamp:Math.floor(f.getTime()/1e3)-u*60}}i(F,"parseHeaderDate");function ke(e){return`${er(e,"T")}${tr(e.offsetMinutes)}`}i(ke,"formatIsoDate");var Zn={"git-created":"git first commit","filesystem-created":"filesystem creation time"};function rr(e,t){let r=e.match(new RegExp(`${t}:[^\\S\\n]*(.*)$`,"m"));return r?r[1].trim():null}i(rr,"readHeaderField");function Ae(e){let t=null;for(let{source:r,payload:n}of e)n&&(!t||n.timestamp<t.payload.timestamp)&&(t={source:r,payload:n});return t}i(Ae,"pickOldestDate");function or({existing:e,gitCreated:t,filesystemCreated:r,fixCreatedDate:n=!1}){let o=[{source:"git-created",payload:t},{source:"filesystem-created",payload:r}];if(!e)return Ae(o);if(!n)return{source:"existing-header",payload:e};let a=F(e.date)?e:null;return Ae([{source:"existing-header",payload:a},...o])}i(or,"resolveCreatedDate");function ir(e,t=null){if(t)return De(e.timestamp,t).year;let r=F(e.date);return r?r.year:new Date(e.timestamp*1e3).getFullYear()}i(ir,"dateYear");function nr(e,t,r,n){let o=e.match(/^(.+?)\s*\((\d+)\)$/),a=o?F(o[1]):null;if(!o||!a)return n.push({check:`${r}-format`,field:t,advisory:!1,value:e,message:`${t} value "${e}" is not a "<datetime> (<epoch>)" pair with a recognised datetime`}),null;let s=Number.parseInt(o[2],10);return s!==a.timestamp&&n.push({check:`${r}-epoch`,field:t,advisory:!1,value:e,expected:`${o[1]} (${a.timestamp})`,message:`${t} epoch ${s} does not match ${o[1]} (expected ${a.timestamp})`}),{text:o[1],timestamp:a.timestamp}}i(nr,"checkDateValue");function ar(e,t={},r={}){let n=[],o=rr(e,"@Date"),a=o===null?null:nr(o,"@Date","created",n),s=Ae([{source:"git-created",payload:t.gitCreated},{source:"filesystem-created",payload:t.filesystemCreated}]);if(a&&s&&a.timestamp>s.payload.timestamp){let f=Zn[s.source];n.push({check:"created-newer-than-source",field:"@Date",advisory:r.strictCreatedDate!==!0,value:o,expected:`${s.payload.date} (${s.payload.timestamp})`,source:s.source,message:`@Date ${a.text} is later than the ${f} ${s.payload.date} (${s.payload.timestamp})`})}let c=rr(e,"@Last modified time"),l=c===null?null:nr(c,"@Last modified time","modified",n),u=t.gitLastModified;return l&&u&&l.timestamp!==u.timestamp&&n.push({check:"modified-git",field:"@Last modified time",advisory:!0,value:c,expected:`${u.date} (${u.timestamp})`,message:`@Last modified time ${l.text} does not match the git last commit ${u.date} (${u.timestamp})`}),n}i(ar,"checkHeaderDates");function $e(e){if(!e)return null;let t=F(e.date);return t&&t.timestamp!==e.timestamp?{date:e.date,timestamp:t.timestamp}:e}i($e,"repairDateEpoch");function sr(e){let t=F(e.date);return t?{date:ke(t),timestamp:t.timestamp}:e}i(sr,"normalizeDatePayload");function cr(e,t){let r=F(e.date);if(!r)return e;let n=De(r.timestamp,t);return n.offsetMinutes===r.offsetMinutes||!Number.isInteger(n.offsetMinutes)?e:{date:/^\d{4}-\d{2}-\d{2}T/i.test(e.date.trim())?ke(n):Se(n),timestamp:r.timestamp}}i(cr,"convertDatePayload");import{relative as eo}from"node:path";import{extname as Qn}from"node:path";function T(e,t={}){let r=Qn(e).toLowerCase(),n=N(t.spacing,"spacing",R);return r.length===0?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */",spacing:n}:{...ft(e,t),spacing:n}}i(T,"getHeaderSyntaxForFile");function lr(e,t){let r=e.spacing??R;if(e.kind==="line"){let c=e.linePrefix||"#",l=typeof e.lineSeparator=="string"?e.lineSeparator:" ",u=Array.from({length:r},()=>c);return[...u,...t.map(f=>`${c}${l}${f}`),...u].join(`
7
7
  `)}let n=e.blockStart||(e.kind==="html"?"<!--":"/**"),o=e.blockLinePrefix||(e.kind==="html"?" ":" * "),a=e.blockEnd||(e.kind==="html"?"-->":" */"),s=Array.from({length:r},()=>o.trimEnd());return[n,...s,...t.map(c=>`${o}${c}`),...s,a].join(`
8
8
  `)}i(lr,"renderHeaderLines");function ve(e){let t=`/${eo(e.projectRoot,e.absoluteFilePath).replace(/\\/g,"/")}`,r=T(e.absoluteFilePath,e.syntaxOptions||{language:e.language}),n=e.createdByName||e.authorName,o=e.createdByEmail||e.authorEmail,a=e.lastModifiedByName||e.authorName,s=e.lastModifiedByEmail||e.authorEmail,c=typeof e.companyName=="string"?e.companyName.trim():"",l=c.length>0?`${c} `:"",u=[`@Project: ${e.projectName}`,`@Filename: ${t}`,`@Date: ${e.createdAt.date} (${e.createdAt.timestamp})`,`@Author: ${n}`,`@Email: <${o}>`,"-----",`@Last modified by: ${a} (${s})`,`@Last modified time: ${e.lastModifiedAt.date} (${e.lastModifiedAt.timestamp})`,"-----",`@Copyright: Copyright (c) ${e.copyrightStartYear}-${e.currentYear} ${l}All rights reserved.`];return lr(r,u)}i(ve,"buildHeader");var to=Object.freeze(["projectName","filename","createdAt","authorName","authorEmail","lastModifiedByName","lastModifiedByEmail","lastModifiedAt","copyrightStartYear","copyrightEndYear","companyName"]);function $(e,t){let r=e.match(new RegExp(`@${t}:[ \\t]*(.*)$`,"m")),n=r?r[1].trim():"";return n.length>0?n:null}i($,"readTag");function ro(e){if(e===null)return{name:null,email:null};if(!e.endsWith(")"))return{name:e,email:null};let t=e.slice(0,-1),r=t.indexOf("(",t.lastIndexOf(")")+1);return r===-1?{name:e,email:null}:{name:t.slice(0,r).trimEnd()||null,email:t.slice(r+1)||null}}i(ro,"splitLastModifiedBy");function no(e){let t={startYear:null,endYear:null,companyName:null},r=e?.match(/^Copyright\s+\(c\)\s+(\d{4})/i);if(!r)return t;let n=e.slice(r[0].length),o=n.match(/^\s*-\s*(\d{4})/);o&&(n=n.slice(o[0].length));let a=n.toLowerCase(),s=a.endsWith("all rights reserved.")?20:a.endsWith("all rights reserved")?19:0;return s===0||!/^\s/.test(n)?t:{startYear:r[1],endYear:o?o[1]:null,companyName:n.slice(0,-s).trim()||null}}i(no,"splitCopyright");function ur(e){let t=ro($(e,"Last modified by")),r=no($(e,"Copyright")),n=$(e,"Email");return{projectName:$(e,"Project"),filename:$(e,"Filename"),createdAt:$(e,"Date"),authorName:$(e,"Author"),authorEmail:n===null?null:n.replace(/^<(.*)>$/,"$1"),lastModifiedByName:t.name,lastModifiedByEmail:t.email,lastModifiedAt:$(e,"Last modified time"),copyrightStartYear:r.startYear,copyrightEndYear:r.endYear,companyName:r.companyName}}i(ur,"parseHeaderFields");function dr(e,t){let r=ur(e??""),n=ur(t);return to.filter(o=>r[o]!==n[o]).map(o=>({field:o,previous:r[o],detected:n[o]}))}i(dr,"compareHeaderFields");function X(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}i(X,"escapeRegex");function mr(e,t,r={}){let n=mt(e,t,r);return n.length===0?{prefix:"",body:t}:{prefix:n,body:t.slice(n.length)}}i(mr,"splitPreservedPrefix");function fr(e,t){if(t.kind==="html"){let n=X(t.blockStart||"<!--"),o=X(t.blockEnd||"-->");return e.match(new RegExp(`^${n}[\\s\\S]*?${o}\\n*`))}if(t.kind==="line"){let n=X(t.linePrefix||"#");return e.match(new RegExp(`^(?:${n}.*\\n)+\\n*`))}let r=X((t.blockEnd||" */").trim());return e.match(new RegExp(`^/\\*[\\s\\S]*?${r}\\n*`))}i(fr,"matchHeaderSegment");function Ne(e,t="",r={}){let{prefix:n,body:o}=mr(t,e,r),a=o.split(`
9
9
  `).slice(0,pt).join(`
10
10
  `),s=T(t,r);if(!fr(a,s))return null;let l=0,u=0;for(;;){let f=a.slice(l),p=fr(f,s);if(!p||!p[0].includes("@Project:"))break;l+=p[0].length,u=l}return u===0?null:{start:n.length,end:n.length+u}}i(Ne,"findProjectHeader");function Ce(e,t,r="",n={}){let o=Ne(e,r,n),a=N(n.margin,"margin",J),s=T(r,n).kind==="line"?Math.max(1,a):a,c=`
11
- `.repeat(s+1);if(!o){let{prefix:p,body:x}=mr(r,e,n),g=`${p}${t}${c}${x.replace(/^\n+/,"")}`;return{nextContent:g,changed:g!==e}}let l=e.slice(0,o.start),u=e.slice(o.end).replace(/^\n+/,""),f=`${l}${t}${c}${u}`;return{nextContent:f,changed:f!==e}}i(Ce,"replaceOrInsertHeader");function oo(e,t){let r=e.length,n=t.length,o=Array.from({length:r+1},()=>new Array(n+1).fill(0));for(let l=r-1;l>=0;l-=1)for(let u=n-1;u>=0;u-=1)o[l][u]=e[l]===t[u]?o[l+1][u+1]+1:Math.max(o[l+1][u],o[l][u+1]);let a=[],s=0,c=0;for(;s<r&&c<n;)e[s]===t[c]?(a.push({type:" ",line:e[s]}),s+=1,c+=1):o[s+1][c]>=o[s][c+1]?(a.push({type:"-",line:e[s]}),s+=1):(a.push({type:"+",line:t[c]}),c+=1);for(;s<r;s+=1)a.push({type:"-",line:e[s]});for(;c<n;c+=1)a.push({type:"+",line:t[c]});return a}i(oo,"diffLines");function pr(e,t){return`${t===0?e:e+1},${t}`}i(pr,"formatRange");function hr(e,t,r={}){let n=e===null?[]:e.split(`
11
+ `.repeat(s+1),l=i(g=>g.trim()===""?`${t}
12
+ `:`${t}${c}${g}`,"join");if(!o){let{prefix:g,body:y}=mr(r,e,n),m=`${g}${l(y.replace(/^\n+/,""))}`;return{nextContent:m,changed:m!==e}}let u=e.slice(0,o.start),f=e.slice(o.end).replace(/^\n+/,""),p=`${u}${l(f)}`;return{nextContent:p,changed:p!==e}}i(Ce,"replaceOrInsertHeader");function oo(e,t){let r=e.length,n=t.length,o=Array.from({length:r+1},()=>new Array(n+1).fill(0));for(let l=r-1;l>=0;l-=1)for(let u=n-1;u>=0;u-=1)o[l][u]=e[l]===t[u]?o[l+1][u+1]+1:Math.max(o[l+1][u],o[l][u+1]);let a=[],s=0,c=0;for(;s<r&&c<n;)e[s]===t[c]?(a.push({type:" ",line:e[s]}),s+=1,c+=1):o[s+1][c]>=o[s][c+1]?(a.push({type:"-",line:e[s]}),s+=1):(a.push({type:"+",line:t[c]}),c+=1);for(;s<r;s+=1)a.push({type:"-",line:e[s]});for(;c<n;c+=1)a.push({type:"+",line:t[c]});return a}i(oo,"diffLines");function pr(e,t){return`${t===0?e:e+1},${t}`}i(pr,"formatRange");function hr(e,t,r={}){let n=e===null?[]:e.split(`
12
13
  `),o=t.split(`
13
- `),a=oo(n,o),s=Math.max(0,r.context??3),c=r.lineOffset??0,l=[];if(a.forEach((x,g)=>{if(x.type===" ")return;let m=l[l.length-1];m&&g-m.last<=s*2+1?m.last=g:l.push({first:g,last:g})}),l.length===0)return"";let u=r.fromFile??"a",f=r.toFile??"b",p=[`--- ${e===null?"/dev/null":u}`,`+++ ${f}`];for(let x of l){let g=Math.max(0,x.first-s),m=Math.min(a.length,x.last+s+1),h=a.slice(0,g),w=a.slice(g,m),S=h.filter(d=>d.type!=="+").length+c,A=h.filter(d=>d.type!=="-").length+c,U=w.filter(d=>d.type!=="+").length,y=w.filter(d=>d.type!=="-").length;p.push(`@@ -${pr(S,U)} +${pr(A,y)} @@`);for(let d of w)p.push(`${d.type}${d.line}`)}return p.join(`
14
- `)}i(hr,"createUnifiedDiff");function co(e){return V(e,"configFile")}i(co,"resolveRuntimeOptions");function lo(e){let t=e.match(/@Author:\s*(.+)$/m),r=e.match(/@Email:\s*<([^>\n]+)>/m);return{authorName:t?.[1]?.trim(),authorEmail:r?.[1]?.trim()}}i(lo,"extractHeaderAuthorIdentity");function uo(e){let t=e.match(/@Last modified by:\s*(.+?)\s*\(([^)\n]+)\)\s*$/m);return{authorName:t?.[1]?.trim(),authorEmail:t?.[2]?.trim()}}i(uo,"extractHeaderLastModifiedIdentity");function fo(e){let t=e.match(/@Date:\s*(.+?)\s*\((\d+)\)$/m);if(!t||!t[1]||!t[2])return null;let r=Number.parseInt(t[2],10);return Number.isNaN(r)?null:{date:t[1].trim(),timestamp:r}}i(fo,"extractHeaderCreatedAt");function mo(e){let t=e.match(/@Last modified time:\s*(.+?)\s*\((\d+)\)$/m);if(!t||!t[1]||!t[2])return null;let r=Number.parseInt(t[2],10);return Number.isNaN(r)?null:{date:t[1].trim(),timestamp:r}}i(mo,"extractHeaderLastModifiedAt");async function xr(e={}){let t=await co(e),r=t.timezone===void 0||t.timezone===null?null:Zt(t.timezone),n=t.convertTimezone===!0;if(n&&!r)throw new Error("convertTimezone requires timezone: set timezone (CLI --timezone <name>) to the IANA zone to convert header dates into");let o=yr(t.projectRoot||t.cwd||process.cwd()),a=await Ee({...t,cwd:o});N(t.spacing,"spacing",R),N(t.margin,"margin",J);let s=t.check===!0,c=s||t.dryRun===!0,l=t.fixCreatedDate===!0,u=i(y=>y,"keepDate"),f=t.normalizeDateFormat===!0?sr:u,p=r?y=>cr(y,r):u,x=n?p:u,g;if(typeof t.input=="string"&&t.input.trim().length>0){let y=yr(o,t.input),d=await ao(y).catch(()=>null);if(!d)throw new Error(`Input path does not exist: ${t.input}`);if(d.isFile())g=[y];else if(d.isDirectory())g=await he({projectRoot:y,language:a.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,includeFolders:t.includeFolders,excludeFolders:t.excludeFolders,includeExtensions:t.includeExtensions,gitignore:t.gitignore});else throw new Error(`Input path must be a file or directory: ${t.input}`)}else g=await he({projectRoot:o,language:a.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,includeFolders:t.includeFolders,excludeFolders:t.excludeFolders,includeExtensions:t.includeExtensions,gitignore:t.gitignore});let m=new Date().getFullYear(),h=[],w=new Set,S=0,A=0,U=0;for(let y of g){let d=await Ee({...t,cwd:o,targetFilePath:y});w.add(`${d.language}:${d.projectRoot}`);let je=gr(o,y),_=await io(y,"utf8"),Z=Ne(_,y,{language:d.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin}),E=Z?_.slice(Z.start,Z.end):"",H=E.length>0?lo(E):{},z=E.length>0?uo(E):{},Dr=E.length>0?fo(E):null,kr=E.length>0?mo(E):null,Le=await ht(y),Me=gr(d.projectRoot,y),Pe=await Kt(d.projectRoot,Me),Q=await qt(d.projectRoot,Me),Re=q(Le.createdAt),ee=or({existing:$e(Dr),gitCreated:Pe,filesystemCreated:Re,fixCreatedDate:l}),te=$e(kr),Ie=ee.source,Ar=te?"existing-header":Q?"git-last-modified":"filesystem-updated",B=f(Ie==="existing-header"?x(ee.payload):p(ee.payload)),$r=d.copyrightStartYear===null?"created-date":"option",re=d.copyrightStartYear??ir(B,r),Oe=f(te?x(te):p(Q||q(Le.updatedAt))),W=t.forceAuthorUpdate===!0,Y=t.forceLastModifiedAuthorUpdate===!0,Te=ve({absoluteFilePath:y,language:d.language,syntaxOptions:{language:d.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin},projectRoot:d.projectRoot,projectName:d.projectName,createdByName:W?d.authorName:H.authorName||d.authorName,createdByEmail:W?d.authorEmail:H.authorEmail||d.authorEmail,lastModifiedByName:Y?d.authorName:z.authorName||d.authorName,lastModifiedByEmail:Y?d.authorEmail:z.authorEmail||d.authorEmail,authorName:d.authorName,authorEmail:d.authorEmail,createdAt:B,lastModifiedAt:Oe,copyrightStartYear:re,companyName:d.companyName,currentYear:m}),Ue=Ce(_,Te,y,{language:d.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin}),G=Ue.changed,_e=G?f(p(q(new Date))):Oe,vr=G?"current-time-on-change":Ar,M=G?ve({absoluteFilePath:y,language:d.language,syntaxOptions:{language:d.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin},projectRoot:d.projectRoot,projectName:d.projectName,createdByName:W?d.authorName:H.authorName||d.authorName,createdByEmail:W?d.authorEmail:H.authorEmail||d.authorEmail,lastModifiedByName:Y?d.authorName:z.authorName||d.authorName,lastModifiedByEmail:Y?d.authorEmail:z.authorEmail||d.authorEmail,authorName:d.authorName,authorEmail:d.authorEmail,createdAt:B,lastModifiedAt:_e,copyrightStartYear:re,companyName:d.companyName,currentYear:m}):Te,j=G?Ce(_,M,y,{language:d.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin}):Ue,ne={file:je,changed:j.changed};if(s){let v=ar(E,{gitCreated:Pe,gitLastModified:Q,filesystemCreated:Re},{strictCreatedDate:t.strictCreatedDate===!0}),P=v.filter(oe=>oe.advisory).length;ne.dateIssues=v,U+=P,A+=v.length>P?1:0}if(t.sampleOutput===!0&&j.changed){let v=E.length>0?E.trimEnd():null,P=je.replace(/\\/g,"/"),oe=j.nextContent.slice(0,j.nextContent.indexOf(M)).split(`
15
- `).length-1;ne.sample={previousValue:v,newValue:M,diff:hr(v,M,{fromFile:`a/${P}`,toFile:`b/${P}`,lineOffset:oe}),issues:dr(v,M),detectedValues:{projectName:d.projectName,projectNameSource:d.projectNameSource,language:d.language,projectRoot:d.projectRoot,marker:d.marker,authorName:d.authorName,authorEmail:d.authorEmail,companyName:d.companyName,companyNameSource:d.companyNameSource,copyrightStartYear:re,copyrightStartYearSource:$r,createdAtSource:Ie,lastModifiedAtSource:vr,createdAt:B,lastModifiedAt:_e}}}h.push(ne),j.changed&&(S+=1,c||await so(y,j.nextContent,"utf8"))}return{metadata:a,detectedProjects:Array.from(w),filesScanned:g.length,filesUpdated:S,dryRun:c,check:s,...s?{filesWithDateDrift:A,dateAdvisories:U}:{},changes:h}}i(xr,"fixHeaders");function po(e){return xr(e)}i(po,"fixHeaders");var br=po;var yo=`fix-headers CLI
14
+ `),a=oo(n,o),s=Math.max(0,r.context??3),c=r.lineOffset??0,l=[];if(a.forEach((g,y)=>{if(g.type===" ")return;let m=l[l.length-1];m&&y-m.last<=s*2+1?m.last=y:l.push({first:y,last:y})}),l.length===0)return"";let u=r.fromFile??"a",f=r.toFile??"b",p=[`--- ${e===null?"/dev/null":u}`,`+++ ${f}`];for(let g of l){let y=Math.max(0,g.first-s),m=Math.min(a.length,g.last+s+1),h=a.slice(0,y),w=a.slice(y,m),S=h.filter(d=>d.type!=="+").length+c,A=h.filter(d=>d.type!=="-").length+c,U=w.filter(d=>d.type!=="+").length,x=w.filter(d=>d.type!=="-").length;p.push(`@@ -${pr(S,U)} +${pr(A,x)} @@`);for(let d of w)p.push(`${d.type}${d.line}`)}return p.join(`
15
+ `)}i(hr,"createUnifiedDiff");function co(e){return V(e,"configFile")}i(co,"resolveRuntimeOptions");function lo(e){let t=e.match(/@Author:\s*(.+)$/m),r=e.match(/@Email:\s*<([^>\n]+)>/m);return{authorName:t?.[1]?.trim(),authorEmail:r?.[1]?.trim()}}i(lo,"extractHeaderAuthorIdentity");function uo(e){let t=e.match(/@Last modified by:\s*(.+?)\s*\(([^)\n]+)\)\s*$/m);return{authorName:t?.[1]?.trim(),authorEmail:t?.[2]?.trim()}}i(uo,"extractHeaderLastModifiedIdentity");function fo(e){let t=e.match(/@Date:\s*(.+?)\s*\((\d+)\)$/m);if(!t||!t[1]||!t[2])return null;let r=Number.parseInt(t[2],10);return Number.isNaN(r)?null:{date:t[1].trim(),timestamp:r}}i(fo,"extractHeaderCreatedAt");function mo(e){let t=e.match(/@Last modified time:\s*(.+?)\s*\((\d+)\)$/m);if(!t||!t[1]||!t[2])return null;let r=Number.parseInt(t[2],10);return Number.isNaN(r)?null:{date:t[1].trim(),timestamp:r}}i(mo,"extractHeaderLastModifiedAt");async function xr(e={}){let t=await co(e),r=t.timezone===void 0||t.timezone===null?null:Zt(t.timezone),n=t.convertTimezone===!0;if(n&&!r)throw new Error("convertTimezone requires timezone: set timezone (CLI --timezone <name>) to the IANA zone to convert header dates into");let o=yr(t.projectRoot||t.cwd||process.cwd()),a=await Ee({...t,cwd:o});N(t.spacing,"spacing",R),N(t.margin,"margin",J);let s=t.check===!0,c=s||t.dryRun===!0,l=t.fixCreatedDate===!0,u=i(x=>x,"keepDate"),f=t.normalizeDateFormat===!0?sr:u,p=r?x=>cr(x,r):u,g=n?p:u,y;if(typeof t.input=="string"&&t.input.trim().length>0){let x=yr(o,t.input),d=await ao(x).catch(()=>null);if(!d)throw new Error(`Input path does not exist: ${t.input}`);if(d.isFile())y=[x];else if(d.isDirectory())y=await he({projectRoot:x,language:a.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,includeFolders:t.includeFolders,excludeFolders:t.excludeFolders,includeExtensions:t.includeExtensions,gitignore:t.gitignore});else throw new Error(`Input path must be a file or directory: ${t.input}`)}else y=await he({projectRoot:o,language:a.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,includeFolders:t.includeFolders,excludeFolders:t.excludeFolders,includeExtensions:t.includeExtensions,gitignore:t.gitignore});let m=new Date().getFullYear(),h=[],w=new Set,S=0,A=0,U=0;for(let x of y){let d=await Ee({...t,cwd:o,targetFilePath:x});w.add(`${d.language}:${d.projectRoot}`);let je=gr(o,x),_=await io(x,"utf8"),Z=Ne(_,x,{language:d.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin}),E=Z?_.slice(Z.start,Z.end):"",H=E.length>0?lo(E):{},z=E.length>0?uo(E):{},Dr=E.length>0?fo(E):null,kr=E.length>0?mo(E):null,Le=await ht(x),Me=gr(d.projectRoot,x),Pe=await Kt(d.projectRoot,Me),Q=await qt(d.projectRoot,Me),Re=q(Le.createdAt),ee=or({existing:$e(Dr),gitCreated:Pe,filesystemCreated:Re,fixCreatedDate:l}),te=$e(kr),Ie=ee.source,Ar=te?"existing-header":Q?"git-last-modified":"filesystem-updated",B=f(Ie==="existing-header"?g(ee.payload):p(ee.payload)),$r=d.copyrightStartYear===null?"created-date":"option",re=d.copyrightStartYear??ir(B,r),Oe=f(te?g(te):p(Q||q(Le.updatedAt))),W=t.forceAuthorUpdate===!0,Y=t.forceLastModifiedAuthorUpdate===!0,Te=ve({absoluteFilePath:x,language:d.language,syntaxOptions:{language:d.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin},projectRoot:d.projectRoot,projectName:d.projectName,createdByName:W?d.authorName:H.authorName||d.authorName,createdByEmail:W?d.authorEmail:H.authorEmail||d.authorEmail,lastModifiedByName:Y?d.authorName:z.authorName||d.authorName,lastModifiedByEmail:Y?d.authorEmail:z.authorEmail||d.authorEmail,authorName:d.authorName,authorEmail:d.authorEmail,createdAt:B,lastModifiedAt:Oe,copyrightStartYear:re,companyName:d.companyName,currentYear:m}),Ue=Ce(_,Te,x,{language:d.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin}),G=Ue.changed,_e=G?f(p(q(new Date))):Oe,vr=G?"current-time-on-change":Ar,M=G?ve({absoluteFilePath:x,language:d.language,syntaxOptions:{language:d.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin},projectRoot:d.projectRoot,projectName:d.projectName,createdByName:W?d.authorName:H.authorName||d.authorName,createdByEmail:W?d.authorEmail:H.authorEmail||d.authorEmail,lastModifiedByName:Y?d.authorName:z.authorName||d.authorName,lastModifiedByEmail:Y?d.authorEmail:z.authorEmail||d.authorEmail,authorName:d.authorName,authorEmail:d.authorEmail,createdAt:B,lastModifiedAt:_e,copyrightStartYear:re,companyName:d.companyName,currentYear:m}):Te,j=G?Ce(_,M,x,{language:d.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin}):Ue,ne={file:je,changed:j.changed};if(s){let v=ar(E,{gitCreated:Pe,gitLastModified:Q,filesystemCreated:Re},{strictCreatedDate:t.strictCreatedDate===!0}),P=v.filter(oe=>oe.advisory).length;ne.dateIssues=v,U+=P,A+=v.length>P?1:0}if(t.sampleOutput===!0&&j.changed){let v=E.length>0?E.trimEnd():null,P=je.replace(/\\/g,"/"),oe=j.nextContent.slice(0,j.nextContent.indexOf(M)).split(`
16
+ `).length-1;ne.sample={previousValue:v,newValue:M,diff:hr(v,M,{fromFile:`a/${P}`,toFile:`b/${P}`,lineOffset:oe}),issues:dr(v,M),detectedValues:{projectName:d.projectName,projectNameSource:d.projectNameSource,language:d.language,projectRoot:d.projectRoot,marker:d.marker,authorName:d.authorName,authorEmail:d.authorEmail,companyName:d.companyName,companyNameSource:d.companyNameSource,copyrightStartYear:re,copyrightStartYearSource:$r,createdAtSource:Ie,lastModifiedAtSource:vr,createdAt:B,lastModifiedAt:_e}}}h.push(ne),j.changed&&(S+=1,c||await so(x,j.nextContent,"utf8"))}return{metadata:a,detectedProjects:Array.from(w),filesScanned:y.length,filesUpdated:S,dryRun:c,check:s,...s?{filesWithDateDrift:A,dateAdvisories:U}:{},changes:h}}i(xr,"fixHeaders");function po(e){return xr(e)}i(po,"fixHeaders");var br=po;var yo=`fix-headers CLI
16
17
 
17
18
  Usage:
18
19
  fix-headers [options]
@@ -60,5 +61,5 @@ Examples:
60
61
  fix-headers --check --verbose
61
62
  fix-headers --timezone America/Los_Angeles --convert-timezone
62
63
  fix-headers --project-name @scope/pkg --company-name "Catalyzed Motivation Inc."
63
- `;function xo(e){return e.replace(/-([a-z])/g,(t,r)=>r.toUpperCase())}i(xo,"toCamelCase");function bo(e){let t={},r={help:!1,json:!1,diff:!1},n={"include-folder":"includeFolders","exclude-folder":"excludeFolders","include-extension":"includeExtensions","enable-detector":"enabledDetectors","disable-detector":"disabledDetectors"},o={cwd:"cwd",input:"input","project-name":"projectName",language:"language","project-root":"projectRoot",marker:"marker","author-name":"authorName","author-email":"authorEmail",company:"company","company-name":"companyName","copyright-start-year":"copyrightStartYear",spacing:"spacing",margin:"margin",timezone:"timezone",config:"config"};for(let a=0;a<e.length;a+=1){let s=e[a];if(s==="-h"||s==="--help"){r.help=!0;continue}if(s==="--json"){r.json=!0;continue}if(s==="--diff"){r.diff=!0;continue}if(s==="--verbose"){t.verbose=!0;continue}if(s==="--dry-run"){t.dryRun=!0;continue}if(s==="--check"){t.check=!0;continue}if(s==="--fix-created-date"){t.fixCreatedDate=!0;continue}if(s==="--strict-created-date"){t.strictCreatedDate=!0;continue}if(s==="--normalize-date-format"){t.normalizeDateFormat=!0;continue}if(s==="--convert-timezone"){t.convertTimezone=!0;continue}if(s==="--sample-output"){t.sampleOutput=!0;continue}if(s==="--force-author-update"){t.forceAuthorUpdate=!0;continue}if(s==="--force-last-modified-author-update"){t.forceLastModifiedAuthorUpdate=!0;continue}if(s==="--use-gpg-signer-author"){t.useGpgSignerAuthor=!0;continue}if(!s.startsWith("--"))throw new Error(`Unexpected argument: ${s}`);let c=s.slice(2);if(c==="include-folder-non-recursive"){let f=e[a+1];if(!f||f.startsWith("--"))throw new Error(`Missing value for --${c}`);a+=1;let p=Array.isArray(t.includeFolders)?t.includeFolders:[];t.includeFolders=[...p,{path:f,recursive:!1}];continue}if(n[c]){let f=e[a+1];if(!f||f.startsWith("--"))throw new Error(`Missing value for --${c}`);a+=1;let p=n[c],x=Array.isArray(t[p])?t[p]:[];t[p]=Array.from(new Set([...x,f]));continue}if(o[c]){let f=e[a+1];if(!f||f.startsWith("--"))throw new Error(`Missing value for --${c}`);a+=1;let p=o[c];if(p==="copyrightStartYear"||p==="spacing"||p==="margin"){if(t[p]=Number.parseInt(f,10),Number.isNaN(t[p]))throw new Error(`Invalid number for --${c}: ${f}`)}else p==="marker"&&f==="null"?t[p]=null:t[p]=f;continue}let l=xo(c),u=e[a+1];if(!u||u.startsWith("--"))throw new Error(`Unknown or malformed flag: --${c}`);a+=1,t[l]=u}return{options:t,help:r.help,json:r.json,diff:r.diff}}i(bo,"parseCliArgs");function wo(e){return V(e,"config")}i(wo,"applyConfigFile");function Fe(e){if(!e||typeof e!="object")return[];let t=e;return(Array.isArray(t.changes)?t.changes:[]).filter(n=>n&&n.changed===!0&&n.sample&&typeof n.sample.newValue=="string")}i(Fe,"getSampledChanges");function Er(e){return typeof e=="string"?`"${e}"`:"(missing)"}i(Er,"formatIssueValue");function Eo(e,t){for(let r of Fe(t)){let n=Array.isArray(r.sample.issues)?r.sample.issues:[];if(e(`issues: ${r.file||"<unknown-file>"}`),n.length===0){e(" (no field differences; header formatting only)");continue}for(let o of n)e(` ${o?.field||"<unknown-field>"}: found ${Er(o?.previous)}, expected ${Er(o?.detected)}`)}}i(Eo,"printIssues");function So(e,t){for(let r of Fe(t))typeof r.sample.diff=="string"&&r.sample.diff.length>0&&e(r.sample.diff)}i(So,"printDiffs");function Do(e,t){for(let r of Fe(t))e(`sample: ${r.file||"<unknown-file>"}`),e("previous:"),e(r.sample.previousValue===null?"(none)":String(r.sample.previousValue)),e("new:"),e(r.sample.newValue),r.sample.detectedValues&&typeof r.sample.detectedValues=="object"&&(e("detected-values:"),e(JSON.stringify(r.sample.detectedValues,null,2)))}i(Do,"printSampleOutput");function ko(e,t){if(!t||typeof t!="object")return;let r=t,o=(Array.isArray(r.changes)?r.changes:[]).filter(a=>a&&a.changed===!0).map(a=>a.file||"<unknown-file>");for(let a of o)e(`updated: ${a}`)}i(ko,"printChangedFiles");function Sr(e,t,r,n){let o=r.sampleOutput===!0||n;r.verbose===!0&&(ko(e,t),o&&Eo(e,t)),r.sampleOutput===!0&&Do(e,t),n&&So(e,t)}i(Sr,"printDetails");function Ao(e,t,r){let n=Array.isArray(t.changes)?t.changes:[];for(let o of n){let a=Array.isArray(o?.dateIssues)?o.dateIssues:[];for(let s of a)s.advisory===!0&&!r||e(`${s.advisory===!0?"advisory":"drift"}: ${o.file||"<unknown-file>"}: ${s.message}`)}}i(Ao,"printDateIssues");async function $o(e,t={}){let r=t.runner||br,n=t.stdout||console.log,o=t.stderr||console.error;try{let a=bo(e);if(a.help)return n(yo),0;let s=await wo(a.options),c=await r(a.diff?{...s,sampleOutput:!0}:s),l=c&&typeof c=="object"&&c.check===!0?c:null,u=l&&Number(l.filesWithDateDrift)>0?1:0;if(a.json)return n(JSON.stringify(c,null,2)),u;if(l)return n(`fix-headers check: scanned=${l.filesScanned??0}, drift=${l.filesWithDateDrift??0}, advisories=${l.dateAdvisories??0}`),Ao(n,l,s.verbose===!0),u;if(c&&typeof c=="object"){let f=c;n(`fix-headers complete: scanned=${f.filesScanned??0}, updated=${f.filesUpdated??0}, dryRun=${f.dryRun===!0}`),Sr(n,c,s,a.diff)}else Sr(n,c,s,a.diff),n("fix-headers complete");return 0}catch(a){let s=a instanceof Error?a.message:String(a);return o(`fix-headers failed: ${s}`),1}}i($o,"runCli");function vo(e=process.argv,t=import.meta.url,r=$o){let n=!1;if(e[1])try{let o=wr(e[1]),a=wr(ho(t));n=o===a}catch{n=t===go(e[1]).href}return n?(r(e.slice(2)).then(o=>{process.exitCode=o}),!0):!1}i(vo,"runCliAsMain");vo();export{wo as applyConfigFile,bo as parseCliArgs,$o as runCli,vo as runCliAsMain};
64
+ `;function xo(e){return e.replace(/-([a-z])/g,(t,r)=>r.toUpperCase())}i(xo,"toCamelCase");function bo(e){let t={},r={help:!1,json:!1,diff:!1},n={"include-folder":"includeFolders","exclude-folder":"excludeFolders","include-extension":"includeExtensions","enable-detector":"enabledDetectors","disable-detector":"disabledDetectors"},o={cwd:"cwd",input:"input","project-name":"projectName",language:"language","project-root":"projectRoot",marker:"marker","author-name":"authorName","author-email":"authorEmail",company:"company","company-name":"companyName","copyright-start-year":"copyrightStartYear",spacing:"spacing",margin:"margin",timezone:"timezone",config:"config"};for(let a=0;a<e.length;a+=1){let s=e[a];if(s==="-h"||s==="--help"){r.help=!0;continue}if(s==="--json"){r.json=!0;continue}if(s==="--diff"){r.diff=!0;continue}if(s==="--verbose"){t.verbose=!0;continue}if(s==="--dry-run"){t.dryRun=!0;continue}if(s==="--check"){t.check=!0;continue}if(s==="--fix-created-date"){t.fixCreatedDate=!0;continue}if(s==="--strict-created-date"){t.strictCreatedDate=!0;continue}if(s==="--normalize-date-format"){t.normalizeDateFormat=!0;continue}if(s==="--convert-timezone"){t.convertTimezone=!0;continue}if(s==="--sample-output"){t.sampleOutput=!0;continue}if(s==="--force-author-update"){t.forceAuthorUpdate=!0;continue}if(s==="--force-last-modified-author-update"){t.forceLastModifiedAuthorUpdate=!0;continue}if(s==="--use-gpg-signer-author"){t.useGpgSignerAuthor=!0;continue}if(!s.startsWith("--"))throw new Error(`Unexpected argument: ${s}`);let c=s.slice(2);if(c==="include-folder-non-recursive"){let f=e[a+1];if(!f||f.startsWith("--"))throw new Error(`Missing value for --${c}`);a+=1;let p=Array.isArray(t.includeFolders)?t.includeFolders:[];t.includeFolders=[...p,{path:f,recursive:!1}];continue}if(n[c]){let f=e[a+1];if(!f||f.startsWith("--"))throw new Error(`Missing value for --${c}`);a+=1;let p=n[c],g=Array.isArray(t[p])?t[p]:[];t[p]=Array.from(new Set([...g,f]));continue}if(o[c]){let f=e[a+1];if(!f||f.startsWith("--"))throw new Error(`Missing value for --${c}`);a+=1;let p=o[c];if(p==="copyrightStartYear"||p==="spacing"||p==="margin"){if(t[p]=Number.parseInt(f,10),Number.isNaN(t[p]))throw new Error(`Invalid number for --${c}: ${f}`)}else p==="marker"&&f==="null"?t[p]=null:t[p]=f;continue}let l=xo(c),u=e[a+1];if(!u||u.startsWith("--"))throw new Error(`Unknown or malformed flag: --${c}`);a+=1,t[l]=u}return{options:t,help:r.help,json:r.json,diff:r.diff}}i(bo,"parseCliArgs");function wo(e){return V(e,"config")}i(wo,"applyConfigFile");function Fe(e){if(!e||typeof e!="object")return[];let t=e;return(Array.isArray(t.changes)?t.changes:[]).filter(n=>n&&n.changed===!0&&n.sample&&typeof n.sample.newValue=="string")}i(Fe,"getSampledChanges");function Er(e){return typeof e=="string"?`"${e}"`:"(missing)"}i(Er,"formatIssueValue");function Eo(e,t){for(let r of Fe(t)){let n=Array.isArray(r.sample.issues)?r.sample.issues:[];if(e(`issues: ${r.file||"<unknown-file>"}`),n.length===0){e(" (no field differences; header formatting only)");continue}for(let o of n)e(` ${o?.field||"<unknown-field>"}: found ${Er(o?.previous)}, expected ${Er(o?.detected)}`)}}i(Eo,"printIssues");function So(e,t){for(let r of Fe(t))typeof r.sample.diff=="string"&&r.sample.diff.length>0&&e(r.sample.diff)}i(So,"printDiffs");function Do(e,t){for(let r of Fe(t))e(`sample: ${r.file||"<unknown-file>"}`),e("previous:"),e(r.sample.previousValue===null?"(none)":String(r.sample.previousValue)),e("new:"),e(r.sample.newValue),r.sample.detectedValues&&typeof r.sample.detectedValues=="object"&&(e("detected-values:"),e(JSON.stringify(r.sample.detectedValues,null,2)))}i(Do,"printSampleOutput");function ko(e,t){if(!t||typeof t!="object")return;let r=t,o=(Array.isArray(r.changes)?r.changes:[]).filter(a=>a&&a.changed===!0).map(a=>a.file||"<unknown-file>");for(let a of o)e(`updated: ${a}`)}i(ko,"printChangedFiles");function Sr(e,t,r,n){let o=r.sampleOutput===!0||n;r.verbose===!0&&(ko(e,t),o&&Eo(e,t)),r.sampleOutput===!0&&Do(e,t),n&&So(e,t)}i(Sr,"printDetails");function Ao(e,t,r){let n=Array.isArray(t.changes)?t.changes:[];for(let o of n){let a=Array.isArray(o?.dateIssues)?o.dateIssues:[];for(let s of a)s.advisory===!0&&!r||e(`${s.advisory===!0?"advisory":"drift"}: ${o.file||"<unknown-file>"}: ${s.message}`)}}i(Ao,"printDateIssues");async function $o(e,t={}){let r=t.runner||br,n=t.stdout||console.log,o=t.stderr||console.error;try{let a=bo(e);if(a.help)return n(yo),0;let s=await wo(a.options),c=await r(a.diff?{...s,sampleOutput:!0}:s),l=c&&typeof c=="object"&&c.check===!0?c:null,u=l&&Number(l.filesWithDateDrift)>0?1:0;if(a.json)return n(JSON.stringify(c,null,2)),u;if(l)return n(`fix-headers check: scanned=${l.filesScanned??0}, drift=${l.filesWithDateDrift??0}, advisories=${l.dateAdvisories??0}`),Ao(n,l,s.verbose===!0),u;if(c&&typeof c=="object"){let f=c;n(`fix-headers complete: scanned=${f.filesScanned??0}, updated=${f.filesUpdated??0}, dryRun=${f.dryRun===!0}`),Sr(n,c,s,a.diff)}else Sr(n,c,s,a.diff),n("fix-headers complete");return 0}catch(a){let s=a instanceof Error?a.message:String(a);return o(`fix-headers failed: ${s}`),1}}i($o,"runCli");function vo(e=process.argv,t=import.meta.url,r=$o){let n=!1;if(e[1])try{let o=wr(e[1]),a=wr(ho(t));n=o===a}catch{n=t===go(e[1]).href}return n?(r(e.slice(2)).then(o=>{process.exitCode=o}),!0):!1}i(vo,"runCliAsMain");vo();export{wo as applyConfigFile,bo as parseCliArgs,$o as runCli,vo as runCliAsMain};
64
65
  //# sourceMappingURL=fix-headers.mjs.map
package/dist/index.cjs CHANGED
@@ -1,14 +1,16 @@
1
1
  /**
2
+ *
2
3
  * @Project: @cldmv/fix-headers
3
4
  * @Filename: /src/cjs/index.cjs
4
- * @Date: 2026-09-28 06:56:09 -07:00 (1790603769)
5
+ * @Date: 2026-09-28T06:56:09-07:00 (1790603769)
5
6
  * @Author: Nate Corcoran <CLDMV>
6
7
  * @Email: <Shinrai@users.noreply.github.com>
7
8
  * -----
8
9
  * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
9
- * @Last modified time: 2026-09-28 06:56:09 -07:00 (1790603769)
10
+ * @Last modified time: 2026-10-02T12:28:11-07:00 (1790969291)
10
11
  * -----
11
- * @Copyright: Copyright (c) 2026-2026 Catalyzed Motivation Inc. All rights reserved.
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
12
14
  */
13
15
 
14
16
  /**
package/dist/index.mjs CHANGED
@@ -1,15 +1,16 @@
1
- var Dr=Object.defineProperty;var i=(e,t)=>Dr(e,"name",{value:t,configurable:!0});import{readFile as eo,stat as to,writeFile as ro}from"node:fs/promises";import{relative as gr,resolve as hr}from"node:path";import{readFile as Nr}from"node:fs/promises";import{createRequire as kr}from"node:module";import{dirname as $r,isAbsolute as Ar,resolve as _e}from"node:path";var Cr=3e4,vr=new Set(["localhost","127.0.0.1","[::1]"]);function oe(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}i(oe,"isPlainObject");function ie(e,t){let r={...e};for(let[n,o]of Object.entries(t))n!=="__proto__"&&(r[n]=oe(r[n])&&oe(o)?ie(r[n],o):o);return r}i(ie,"mergeConfig");function Ue(e){return e.kind==="file"?e.path:e.href}i(Ue,"describeSource");async function Fr(e){if(e.kind==="file")return{text:await Nr(e.path,"utf8"),source:e};let t;try{t=await fetch(e.href,{cache:"no-store",redirect:"follow",signal:AbortSignal.timeout(Cr)})}catch(r){let n=r.cause instanceof Error?r.cause.message:r.message;throw new Error(`Failed to fetch config ${e.href}: ${n}`,{cause:r})}if(!t.ok)throw new Error(`Failed to fetch config ${e.href}: HTTP ${t.status} ${t.statusText}`);return{text:await t.text(),source:{kind:"url",href:t.url}}}i(Fr,"readSource");function He(e){if(e.protocol==="http:"&&!vr.has(e.hostname))throw new Error(`Refusing to fetch config over plain http: ${e.href} (use https)`);return{kind:"url",href:e.href}}i(He,"toUrlSource");function Lr(e,t){if(/^https?:\/\//i.test(e))return He(new URL(e));if(/^[a-z][a-z\d+.-]+:\/\//i.test(e))throw new Error(`Unsupported extends URL "${e}" in ${Ue(t)}; use https, a file path or a package path`);let r=/^\.{1,2}[\\/]/.test(e);if(t.kind==="url"){if(r||e.startsWith("/"))return He(new URL(e,t.href));throw new Error(`Cannot extend package "${e}" from the remote config ${t.href}; use a URL or a relative path`)}if(r||Ar(e))return{kind:"file",path:_e($r(t.path),e)};try{return{kind:"file",path:kr(t.path).resolve(e)}}catch(n){throw new Error(`Cannot resolve extends "${e}" from ${t.path}: ${n.message}`,{cause:n})}}i(Lr,"resolveReference");function Pr(e,t){if(e===void 0)return[];let r=Array.isArray(e)?e:[e];if(!r.every(n=>typeof n=="string"&&n.trim().length>0))throw new Error(`Config "extends" must be a string or an array of strings: ${t}`);return r.map(n=>n.trim())}i(Pr,"readExtends");async function Be(e,t){let r=Ue(e);if(t.includes(r))throw new Error(`Config extends cycle: ${[...t,r].join(" -> ")}`);let{text:n,source:o}=await Fr(e),a;try{a=JSON.parse(n)}catch(m){throw new Error(`Config ${r} is not valid JSON: ${m.message}`,{cause:m})}if(!oe(a))throw new Error(`Config file must contain a JSON object: ${r}`);let{extends:s,...c}=a,l={};for(let m of Pr(s,r))l=ie(l,await Be(Lr(m,o),[...t,r]));return ie(l,c)}i(Be,"loadSource");function Mr(e,t=process.cwd()){return Be({kind:"file",path:_e(t,e)},[])}i(Mr,"loadConfigFile");async function ze(e,t){let r=typeof e[t]=="string"?e[t].trim():"";if(r.length===0)return e;let n=typeof e.cwd=="string"&&e.cwd.length>0?e.cwd:process.cwd(),o={...await Mr(r,n),...e};return delete o[t],o}i(ze,"applyConfigOption");import{extname as ct}from"node:path";import{extname as jr}from"node:path";var Ye=[".css"];function Rr(e){let t=jr(e).toLowerCase();return Ye.includes(t)?{kind:"block",blockStart:"/*",blockLinePrefix:" * ",blockEnd:" */"}:null}i(Rr,"resolveCssCommentSyntax");var Ge={id:"css",extensions:Ye,enabledByDefault:!0,resolveCommentSyntax(e){return Rr(e)}};import{extname as Ir}from"node:path";var We=[".go"];function Tr(e){let t=Ir(e).toLowerCase();return We.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(Tr,"resolveGoCommentSyntax");var Ve={id:"go",extensions:We,enabledByDefault:!0,resolveCommentSyntax(e){return Tr(e)}};import{extname as Or}from"node:path";var Je=[".html",".htm"];function Hr(e){let t=Or(e).toLowerCase();return Je.includes(t)?{kind:"html",blockStart:"<!--",blockLinePrefix:" ",blockEnd:"-->"}:null}i(Hr,"resolveHtmlCommentSyntax");var Ke={id:"html",extensions:Je,enabledByDefault:!0,resolveCommentSyntax(e){return Hr(e)}};import{extname as _r}from"node:path";var qe=[".jsonv",".jsonc",".json5"];function Ur(e){let t=_r(e).toLowerCase();return qe.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(Ur,"resolveJsonCommentSyntax");var Xe={id:"json",extensions:qe,enabledByDefault:!0,resolveCommentSyntax(e){return Ur(e)}};import{extname as Br}from"node:path";var Ze=[".js",".mjs",".cjs",".ts",".tsx",".jsx"];function zr(e){let t=Br(e).toLowerCase();return Ze.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(zr,"resolveNodeCommentSyntax");function Yr(e,t){let r=t.match(/^#!.*\b(node|bun|deno|tsx|ts-node)\b.*(?:\r?\n|$)/);return r?r[0]:""}i(Yr,"resolveNodePreservedPrefix");var Qe={id:"node",extensions:Ze,enabledByDefault:!0,resolvePreservedPrefix(e,t){return Yr(e,t)},resolveCommentSyntax(e){return zr(e)}};import{extname as Gr}from"node:path";var et=[".php"];function Wr(e){let t=Gr(e).toLowerCase();return et.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(Wr,"resolvePhpCommentSyntax");var tt={id:"php",extensions:et,enabledByDefault:!0,resolveCommentSyntax(e){return Wr(e)}};import{extname as Vr}from"node:path";var rt=[".py"];function Jr(e,t){let r=t.match(/^#!.*\bpython(?:\d+(?:\.\d+)*)?\b.*(?:\r?\n|$)/);return r?r[0]:""}i(Jr,"resolvePythonPreservedPrefix");var nt={id:"python",extensions:rt,enabledByDefault:!0,resolvePreservedPrefix(e,t){return Jr(e,t)},resolveCommentSyntax(e){let t=Vr(e).toLowerCase();return rt.includes(t)?{kind:"line",linePrefix:"#"}:null}};import{extname as Kr}from"node:path";var ot=[".rs"];function qr(e){let t=Kr(e).toLowerCase();return ot.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(qr,"resolveRustCommentSyntax");var it={id:"rust",extensions:ot,enabledByDefault:!0,resolveCommentSyntax(e){return qr(e)}};import{extname as Xr}from"node:path";var at=[".yaml",".yml"];function Zr(e){let t=Xr(e).toLowerCase();return at.includes(t)?{kind:"line",linePrefix:"#"}:null}i(Zr,"resolveYamlCommentSyntax");var st={id:"yaml",extensions:at,enabledByDefault:!0,resolveCommentSyntax(e){return Zr(e)}};var lt=[Ge,Ve,Ke,Xe,Qe,tt,nt,it,st],Qo=new Map(lt.map(e=>[e.id,e]));function Qr(e,t){return!t||typeof t!="object"?e:e.kind==="line"?{...e,linePrefix:typeof t.linePrefix=="string"&&t.linePrefix.length>0?t.linePrefix:e.linePrefix,lineSeparator:typeof t.lineSeparator=="string"?t.lineSeparator:e.lineSeparator}:{...e,blockStart:typeof t.blockStart=="string"&&t.blockStart.length>0?t.blockStart:e.blockStart,blockLinePrefix:typeof t.blockLinePrefix=="string"&&t.blockLinePrefix.length>0?t.blockLinePrefix:e.blockLinePrefix,blockEnd:typeof t.blockEnd=="string"&&t.blockEnd.length>0?t.blockEnd:e.blockEnd}}i(Qr,"applySyntaxOverride");function P(e={}){let t=new Set(Array.isArray(e.enabledDetectors)?e.enabledDetectors:[]),r=new Set(Array.isArray(e.disabledDetectors)?e.disabledDetectors:[]);return lt.filter(n=>t.size>0?t.has(n.id):r.has(n.id)?!1:n.enabledByDefault)}i(P,"getEnabledDetectors");function ut(e={}){if(Array.isArray(e.includeExtensions)&&e.includeExtensions.length>0)return new Set(e.includeExtensions.map(r=>r.toLowerCase()));let t=P(e);return new Set(t.flatMap(r=>r.extensions))}i(ut,"getAllowedExtensions");function mt(e,t={}){let r=ct(e).toLowerCase(),n=Array.isArray(t.detectors)?t.detectors:P(t);for(let o of n){if(!o.extensions.includes(r))continue;let a=o.resolveCommentSyntax(e);if(a){let s=t.detectorSyntaxOverrides&&typeof t.detectorSyntaxOverrides=="object"?t.detectorSyntaxOverrides:{};return Qr(a,s[o.id])}}return{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}}i(mt,"getCommentSyntaxForFile");function dt(e,t,r={}){let n=ct(e).toLowerCase(),o=P(r);for(let a of o)if(a.extensions.includes(n))return typeof a.resolvePreservedPrefix=="function"?a.resolvePreservedPrefix(e,t):"";return""}i(dt,"getPreservedPrefixForFile");var ft=200,R=1,V=2;function C(e,t,r){if(e==null)return r;if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error(`${t} must be a whole number of 0 or more, got ${JSON.stringify(e)}`);return e}i(C,"resolveLayoutCount");import{join as Nt,relative as kt,resolve as fe,sep as me}from"node:path";import{realpath as dn,stat as fn}from"node:fs/promises";import{access as en,readdir as tn,readFile as ii,stat as rn}from"node:fs/promises";import{constants as nn}from"node:fs";import{dirname as ci,join as on,resolve as li}from"node:path";async function ae(e){try{return await en(e,nn.F_OK),!0}catch{return!1}}i(ae,"pathExists");async function se(e,t){let r=[],n=await tn(e,{withFileTypes:!0});for(let o of n){let a=on(e,o.name);if(o.isDirectory()&&t.recursive===!1||o.isDirectory()&&t.ignoreFolders.has(o.name)||o.isDirectory()&&await t.shouldSkipDirectory?.(a,o.name)===!0)continue;if(o.isDirectory()){let l=await se(a,t);r.push(...l);continue}if(!o.isFile())continue;let s=o.name.lastIndexOf(".");if(s===-1)continue;let c=o.name.slice(s).toLowerCase();t.allowedExtensions.has(c)&&r.push(a)}return r}i(se,"walkFiles");async function pt(e){let t=await rn(e);return{createdAt:t.birthtimeMs>0&&t.birthtime<t.mtime?t.birthtime:t.mtime,updatedAt:t.mtime}}i(pt,"readFileDates");import{execFile as an}from"node:child_process";import{lstat as sn,readFile as cn}from"node:fs/promises";import{dirname as gt,isAbsolute as ln,join as xt,relative as bt,resolve as ce,sep as wt}from"node:path";import un from"ignore";function ht(e,t){return new Promise(r=>{an("git",t,{cwd:e,encoding:"utf8",maxBuffer:Number.POSITIVE_INFINITY},(n,o)=>{if(!n){r({code:0,stdout:o});return}r({code:typeof n.code=="number"?n.code:-1,stdout:""})})})}i(ht,"runGitCommand");function ue(e,t){return bt(e,t).split(wt).join("/")}i(ue,"toPosixRelative");async function Et(e){try{return un().add(await cn(e,"utf8"))}catch{return null}}i(Et,"readIgnoreFile");async function mn(e){return sn(xt(e,".git")).then(()=>!0,()=>!1)}i(mn,"hasGitEntry");function yt(e,t,r){for(let n=e.length-1;n>=0;n--){let{base:o,rules:a}=e[n],s=a.test(`${ue(o,t)}${r?"/":""}`);if(s.ignored||s.unignored)return s.ignored}return!1}i(yt,"matchesRules");async function St(e,t){let r=await Et(xt(e,".gitignore"));return{kind:"rules",nested:!0,excluded:!1,matchers:r?[...t,{base:e,rules:r}]:t}}i(St,"buildRulesContext");async function le(e){let[t,r]=await Promise.all([ht(e,["check-ignore","-q","."]),ht(e,["ls-files","--cached","--others","--exclude-standard","-z"])]);if(t.code!==1||r.code!==0)return St(e,[]);let n=new Set,o=new Set;for(let a of r.stdout.split("\0")){let s=a.endsWith("/")?a.slice(0,-1):a;if(s.length!==0){n.add(s);for(let c=s.indexOf("/");c!==-1;c=s.indexOf("/",c+1))o.add(s.slice(0,c))}}return{kind:"git",root:e,entries:n,dirs:o}}i(le,"resolveScopeContext");function Dt(e){let t=ce(e.root),r=e.gitignore;if(r===!1)return{isIgnored:i(async()=>!1,"isIgnored")};let n=new Map,o=i(async()=>{if(typeof r!="string"&&!Array.isArray(r))return le(t);let c=typeof r=="string"?[r]:r.filter(m=>typeof m=="string"),l=[];for(let m of c){let f=await Et(ce(t,m));f&&l.push({base:t,rules:f})}return{kind:"rules",nested:!1,excluded:!1,matchers:l}},"buildRootContext"),a=i(c=>{let l=n.get(c);return l||(l=c===t?o():s(c),n.set(c,l)),l},"contextFor"),s=i(async c=>{let l=await a(gt(c));return l.kind==="git"?l.entries.has(ue(l.root,c))?le(c):l:!l.nested||l.excluded?l:yt(l.matchers,c,!0)?{...l,excluded:!0}:await mn(c)?le(c):St(c,l.matchers)},"deriveContext");return{async isIgnored(c,l){let m=ce(c),f=bt(t,m);if(f.length===0||f===".."||f.startsWith(`..${wt}`)||ln(f))return!1;let p=await a(gt(m));if(p.kind==="git"){let x=ue(p.root,m);return!(p.entries.has(x)||l&&p.dirs.has(x))}return p.excluded||yt(p.matchers,m,l)}}}i(Dt,"createIgnoreFilter");function pn(e){return ut(e)}i(pn,"resolveExtensions");var $t=new Set([".git"]);function de(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}i(de,"normalizeFolderPath");function gn(e){return Array.isArray(e)?e.map(t=>{if(typeof t=="string")return{path:t,recursive:!0};if(t&&typeof t=="object"&&typeof t.path=="string")return{path:t.path,recursive:t.recursive!==!1};throw new TypeError(`Invalid includeFolders entry: ${JSON.stringify(t)} (expected a path string or { path, recursive? })`)}):[]}i(gn,"resolveIncludeFolders");function At(e,t){let r=t instanceof Error?t.message:String(t);console.warn(`fix-headers: skipped include folder "${e}" (${r})`)}i(At,"reportSkippedIncludeFolder");function hn(e,t){if(!Array.isArray(t)||t.length===0)return()=>!1;let r=fe(e),n=[],o=new Set;for(let a of t){if(typeof a!="string")continue;let s=de(a);if(s.length!==0){if(s.includes("/")){n.push(fe(r,s));continue}o.add(s)}}return(a,s)=>{if(o.has(s))return!0;for(let l of n)if(a===l||a.startsWith(`${l}/`))return!0;let c=de(kt(r,a));return n.some(l=>{let m=de(kt(r,l));return c===m||c.startsWith(`${m}/`)})}}i(hn,"buildExclusionMatcher");async function pe(e){let t=pn(e),r=gn(e.includeFolders),n=Array.isArray(e.excludeFolders)?e.excludeFolders:[],o=hn(e.projectRoot,n),a=Dt({root:e.projectRoot,gitignore:e.gitignore}),s=i(async(d,g)=>o(d,g)||await a.isIgnored(d,!0),"shouldSkipDirectory"),c=r.length>0?r.map(d=>({includeFolder:d.path,rootPath:Nt(e.projectRoot,d.path),recursive:d.recursive})):[{includeFolder:".",rootPath:e.projectRoot,recursive:!0}],l=[];for(let d of c){let g=await fn(d.rootPath).catch(S=>S);if(g instanceof Error){if(g.code==="ENOENT"){At(d.includeFolder,g);continue}throw g}if(!g.isDirectory()){At(d.includeFolder,`path is not a directory: ${d.rootPath}`);continue}let w=await dn(d.rootPath).catch(()=>fe(d.rootPath));l.push({...d,realRoot:w})}let m=i((d,g)=>{if(d.realRoot===g.realRoot)return d.recursive||!g.recursive;let w=d.realRoot.endsWith(me)?d.realRoot:`${d.realRoot}${me}`;if(!d.recursive||!g.realRoot.startsWith(w))return!1;let S=d.rootPath;for(let k of g.realRoot.slice(w.length).split(me))if(S=Nt(S,k),$t.has(k)||o(S,k))return!1;return!0},"covers"),f=[...l].sort((d,g)=>d.realRoot.length-g.realRoot.length||Number(g.recursive)-Number(d.recursive)),p=[];for(let d of f)p.some(g=>m(g,d))||p.push(d);let x=[];for(let d of l){if(!p.includes(d))continue;let g=await se(d.rootPath,{allowedExtensions:t,ignoreFolders:$t,shouldSkipDirectory:s,recursive:d.recursive});x.push(...g)}let h=[];for(let d of new Set(x))!o(d,d.split("/").at(-1)||"")&&!await a.isIgnored(d,!1)&&h.push(d);return h}i(pe,"discoverFiles");import{basename as Hn,dirname as _n,extname as Un,resolve as be}from"node:path";import{dirname as Ht,isAbsolute as An,join as _t,relative as Cn,resolve as Ut,sep as vn}from"node:path";import{readFile as yn}from"node:fs/promises";import{join as xn}from"node:path";async function bn(e){try{return await yn(e,"utf8")}catch{return null}}i(bn,"readManifest");async function D(e,t){let r=[];for(let n of t){let o=await bn(xn(e,n));o!==null&&r.push({file:n,content:o})}return r.length>0?{dir:e,manifest:r[0].file,files:r}:null}i(D,"detectManifests");function v(e,t){return e.files.find(r=>r.file===t)?.content??null}i(v,"manifestContent");function b(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}i(b,"cleanName");function ge(e){if(typeof e!="string")return;let t=e.search(/[<(]/);return b(t===-1?e:e.slice(0,t))}i(ge,"personName");function J(e){try{return JSON.parse(e)}catch{return}}i(J,"parseJsonManifest");function*he(e,t){let r="";for(let n of e.split(/\r?\n/)){let o=n.trim();if(o.startsWith("[")){let a=o.match(/^\[([^[\]]+)\]/);r=a?a[1].split(".").map(s=>s.trim()).join("."):"";continue}r===t&&(yield o)}}i(he,"sectionLines");function I(e,t,r){let n=new RegExp(`^${r}\\s*=\\s*(?:"([^"\\\\]*)"|'([^']*)')`);for(let o of he(e,t)){let a=o.match(n);if(a)return b(a[1]??a[2])}}i(I,"readTomlString");function ye(e,t,r){let n=new RegExp(`^${r}\\s*[=:](.*)$`);for(let o of he(e,t)){let a=o.match(n);if(a)return b(a[1])}}i(ye,"readIniValue");function wn(e,t,r){let n=new RegExp(`^${r}\\s*=\\s*\\[`),o=null;for(let a of he(e,t)){if(o!==null){o.push(a);continue}let s=a.match(n);s&&(o=[a.slice(s[0].length)])}return o===null?null:o.join(`
1
+ var Dr=Object.defineProperty;var i=(e,t)=>Dr(e,"name",{value:t,configurable:!0});import{readFile as eo,stat as to,writeFile as ro}from"node:fs/promises";import{relative as gr,resolve as hr}from"node:path";import{readFile as Nr}from"node:fs/promises";import{createRequire as kr}from"node:module";import{dirname as $r,isAbsolute as Ar,resolve as _e}from"node:path";var Cr=3e4,vr=new Set(["localhost","127.0.0.1","[::1]"]);function oe(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}i(oe,"isPlainObject");function ie(e,t){let r={...e};for(let[n,o]of Object.entries(t))n!=="__proto__"&&(r[n]=oe(r[n])&&oe(o)?ie(r[n],o):o);return r}i(ie,"mergeConfig");function Ue(e){return e.kind==="file"?e.path:e.href}i(Ue,"describeSource");async function Fr(e){if(e.kind==="file")return{text:await Nr(e.path,"utf8"),source:e};let t;try{t=await fetch(e.href,{cache:"no-store",redirect:"follow",signal:AbortSignal.timeout(Cr)})}catch(r){let n=r.cause instanceof Error?r.cause.message:r.message;throw new Error(`Failed to fetch config ${e.href}: ${n}`,{cause:r})}if(!t.ok)throw new Error(`Failed to fetch config ${e.href}: HTTP ${t.status} ${t.statusText}`);return{text:await t.text(),source:{kind:"url",href:t.url}}}i(Fr,"readSource");function He(e){if(e.protocol==="http:"&&!vr.has(e.hostname))throw new Error(`Refusing to fetch config over plain http: ${e.href} (use https)`);return{kind:"url",href:e.href}}i(He,"toUrlSource");function Lr(e,t){if(/^https?:\/\//i.test(e))return He(new URL(e));if(/^[a-z][a-z\d+.-]+:\/\//i.test(e))throw new Error(`Unsupported extends URL "${e}" in ${Ue(t)}; use https, a file path or a package path`);let r=/^\.{1,2}[\\/]/.test(e);if(t.kind==="url"){if(r||e.startsWith("/"))return He(new URL(e,t.href));throw new Error(`Cannot extend package "${e}" from the remote config ${t.href}; use a URL or a relative path`)}if(r||Ar(e))return{kind:"file",path:_e($r(t.path),e)};try{return{kind:"file",path:kr(t.path).resolve(e)}}catch(n){throw new Error(`Cannot resolve extends "${e}" from ${t.path}: ${n.message}`,{cause:n})}}i(Lr,"resolveReference");function Pr(e,t){if(e===void 0)return[];let r=Array.isArray(e)?e:[e];if(!r.every(n=>typeof n=="string"&&n.trim().length>0))throw new Error(`Config "extends" must be a string or an array of strings: ${t}`);return r.map(n=>n.trim())}i(Pr,"readExtends");async function Be(e,t){let r=Ue(e);if(t.includes(r))throw new Error(`Config extends cycle: ${[...t,r].join(" -> ")}`);let{text:n,source:o}=await Fr(e),a;try{a=JSON.parse(n)}catch(m){throw new Error(`Config ${r} is not valid JSON: ${m.message}`,{cause:m})}if(!oe(a))throw new Error(`Config file must contain a JSON object: ${r}`);let{extends:s,...l}=a,c={};for(let m of Pr(s,r))c=ie(c,await Be(Lr(m,o),[...t,r]));return ie(c,l)}i(Be,"loadSource");function Mr(e,t=process.cwd()){return Be({kind:"file",path:_e(t,e)},[])}i(Mr,"loadConfigFile");async function ze(e,t){let r=typeof e[t]=="string"?e[t].trim():"";if(r.length===0)return e;let n=typeof e.cwd=="string"&&e.cwd.length>0?e.cwd:process.cwd(),o={...await Mr(r,n),...e};return delete o[t],o}i(ze,"applyConfigOption");import{extname as ct}from"node:path";import{extname as jr}from"node:path";var Ye=[".css"];function Rr(e){let t=jr(e).toLowerCase();return Ye.includes(t)?{kind:"block",blockStart:"/*",blockLinePrefix:" * ",blockEnd:" */"}:null}i(Rr,"resolveCssCommentSyntax");var Ge={id:"css",extensions:Ye,enabledByDefault:!0,resolveCommentSyntax(e){return Rr(e)}};import{extname as Ir}from"node:path";var We=[".go"];function Tr(e){let t=Ir(e).toLowerCase();return We.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(Tr,"resolveGoCommentSyntax");var Ve={id:"go",extensions:We,enabledByDefault:!0,resolveCommentSyntax(e){return Tr(e)}};import{extname as Or}from"node:path";var Je=[".html",".htm"];function Hr(e){let t=Or(e).toLowerCase();return Je.includes(t)?{kind:"html",blockStart:"<!--",blockLinePrefix:" ",blockEnd:"-->"}:null}i(Hr,"resolveHtmlCommentSyntax");var Ke={id:"html",extensions:Je,enabledByDefault:!0,resolveCommentSyntax(e){return Hr(e)}};import{extname as _r}from"node:path";var qe=[".jsonv",".jsonc",".json5"];function Ur(e){let t=_r(e).toLowerCase();return qe.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(Ur,"resolveJsonCommentSyntax");var Xe={id:"json",extensions:qe,enabledByDefault:!0,resolveCommentSyntax(e){return Ur(e)}};import{extname as Br}from"node:path";var Ze=[".js",".mjs",".cjs",".ts",".tsx",".jsx"];function zr(e){let t=Br(e).toLowerCase();return Ze.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(zr,"resolveNodeCommentSyntax");function Yr(e,t){let r=t.match(/^#!.*\b(node|bun|deno|tsx|ts-node)\b.*(?:\r?\n|$)/);return r?r[0]:""}i(Yr,"resolveNodePreservedPrefix");var Qe={id:"node",extensions:Ze,enabledByDefault:!0,resolvePreservedPrefix(e,t){return Yr(e,t)},resolveCommentSyntax(e){return zr(e)}};import{extname as Gr}from"node:path";var et=[".php"];function Wr(e){let t=Gr(e).toLowerCase();return et.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(Wr,"resolvePhpCommentSyntax");var tt={id:"php",extensions:et,enabledByDefault:!0,resolveCommentSyntax(e){return Wr(e)}};import{extname as Vr}from"node:path";var rt=[".py"];function Jr(e,t){let r=t.match(/^#!.*\bpython(?:\d+(?:\.\d+)*)?\b.*(?:\r?\n|$)/);return r?r[0]:""}i(Jr,"resolvePythonPreservedPrefix");var nt={id:"python",extensions:rt,enabledByDefault:!0,resolvePreservedPrefix(e,t){return Jr(e,t)},resolveCommentSyntax(e){let t=Vr(e).toLowerCase();return rt.includes(t)?{kind:"line",linePrefix:"#"}:null}};import{extname as Kr}from"node:path";var ot=[".rs"];function qr(e){let t=Kr(e).toLowerCase();return ot.includes(t)?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}:null}i(qr,"resolveRustCommentSyntax");var it={id:"rust",extensions:ot,enabledByDefault:!0,resolveCommentSyntax(e){return qr(e)}};import{extname as Xr}from"node:path";var at=[".yaml",".yml"];function Zr(e){let t=Xr(e).toLowerCase();return at.includes(t)?{kind:"line",linePrefix:"#"}:null}i(Zr,"resolveYamlCommentSyntax");var st={id:"yaml",extensions:at,enabledByDefault:!0,resolveCommentSyntax(e){return Zr(e)}};var lt=[Ge,Ve,Ke,Xe,Qe,tt,nt,it,st],Qo=new Map(lt.map(e=>[e.id,e]));function Qr(e,t){return!t||typeof t!="object"?e:e.kind==="line"?{...e,linePrefix:typeof t.linePrefix=="string"&&t.linePrefix.length>0?t.linePrefix:e.linePrefix,lineSeparator:typeof t.lineSeparator=="string"?t.lineSeparator:e.lineSeparator}:{...e,blockStart:typeof t.blockStart=="string"&&t.blockStart.length>0?t.blockStart:e.blockStart,blockLinePrefix:typeof t.blockLinePrefix=="string"&&t.blockLinePrefix.length>0?t.blockLinePrefix:e.blockLinePrefix,blockEnd:typeof t.blockEnd=="string"&&t.blockEnd.length>0?t.blockEnd:e.blockEnd}}i(Qr,"applySyntaxOverride");function P(e={}){let t=new Set(Array.isArray(e.enabledDetectors)?e.enabledDetectors:[]),r=new Set(Array.isArray(e.disabledDetectors)?e.disabledDetectors:[]);return lt.filter(n=>t.size>0?t.has(n.id):r.has(n.id)?!1:n.enabledByDefault)}i(P,"getEnabledDetectors");function ut(e={}){if(Array.isArray(e.includeExtensions)&&e.includeExtensions.length>0)return new Set(e.includeExtensions.map(r=>r.toLowerCase()));let t=P(e);return new Set(t.flatMap(r=>r.extensions))}i(ut,"getAllowedExtensions");function mt(e,t={}){let r=ct(e).toLowerCase(),n=Array.isArray(t.detectors)?t.detectors:P(t);for(let o of n){if(!o.extensions.includes(r))continue;let a=o.resolveCommentSyntax(e);if(a){let s=t.detectorSyntaxOverrides&&typeof t.detectorSyntaxOverrides=="object"?t.detectorSyntaxOverrides:{};return Qr(a,s[o.id])}}return{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */"}}i(mt,"getCommentSyntaxForFile");function dt(e,t,r={}){let n=ct(e).toLowerCase(),o=P(r);for(let a of o)if(a.extensions.includes(n))return typeof a.resolvePreservedPrefix=="function"?a.resolvePreservedPrefix(e,t):"";return""}i(dt,"getPreservedPrefixForFile");var ft=200,R=1,V=2;function C(e,t,r){if(e==null)return r;if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error(`${t} must be a whole number of 0 or more, got ${JSON.stringify(e)}`);return e}i(C,"resolveLayoutCount");import{join as Nt,relative as kt,resolve as fe,sep as me}from"node:path";import{realpath as dn,stat as fn}from"node:fs/promises";import{access as en,readdir as tn,readFile as ii,stat as rn}from"node:fs/promises";import{constants as nn}from"node:fs";import{dirname as ci,join as on,resolve as li}from"node:path";async function ae(e){try{return await en(e,nn.F_OK),!0}catch{return!1}}i(ae,"pathExists");async function se(e,t){let r=[],n=await tn(e,{withFileTypes:!0});for(let o of n){let a=on(e,o.name);if(o.isDirectory()&&t.recursive===!1||o.isDirectory()&&t.ignoreFolders.has(o.name)||o.isDirectory()&&await t.shouldSkipDirectory?.(a,o.name)===!0)continue;if(o.isDirectory()){let c=await se(a,t);r.push(...c);continue}if(!o.isFile())continue;let s=o.name.lastIndexOf(".");if(s===-1)continue;let l=o.name.slice(s).toLowerCase();t.allowedExtensions.has(l)&&r.push(a)}return r}i(se,"walkFiles");async function pt(e){let t=await rn(e);return{createdAt:t.birthtimeMs>0&&t.birthtime<t.mtime?t.birthtime:t.mtime,updatedAt:t.mtime}}i(pt,"readFileDates");import{execFile as an}from"node:child_process";import{lstat as sn,readFile as cn}from"node:fs/promises";import{dirname as gt,isAbsolute as ln,join as xt,relative as bt,resolve as ce,sep as wt}from"node:path";import un from"ignore";function ht(e,t){return new Promise(r=>{an("git",t,{cwd:e,encoding:"utf8",maxBuffer:Number.POSITIVE_INFINITY},(n,o)=>{if(!n){r({code:0,stdout:o});return}r({code:typeof n.code=="number"?n.code:-1,stdout:""})})})}i(ht,"runGitCommand");function ue(e,t){return bt(e,t).split(wt).join("/")}i(ue,"toPosixRelative");async function Et(e){try{return un().add(await cn(e,"utf8"))}catch{return null}}i(Et,"readIgnoreFile");async function mn(e){return sn(xt(e,".git")).then(()=>!0,()=>!1)}i(mn,"hasGitEntry");function yt(e,t,r){for(let n=e.length-1;n>=0;n--){let{base:o,rules:a}=e[n],s=a.test(`${ue(o,t)}${r?"/":""}`);if(s.ignored||s.unignored)return s.ignored}return!1}i(yt,"matchesRules");async function St(e,t){let r=await Et(xt(e,".gitignore"));return{kind:"rules",nested:!0,excluded:!1,matchers:r?[...t,{base:e,rules:r}]:t}}i(St,"buildRulesContext");async function le(e){let[t,r]=await Promise.all([ht(e,["check-ignore","-q","."]),ht(e,["ls-files","--cached","--others","--exclude-standard","-z"])]);if(t.code!==1||r.code!==0)return St(e,[]);let n=new Set,o=new Set;for(let a of r.stdout.split("\0")){let s=a.endsWith("/")?a.slice(0,-1):a;if(s.length!==0){n.add(s);for(let l=s.indexOf("/");l!==-1;l=s.indexOf("/",l+1))o.add(s.slice(0,l))}}return{kind:"git",root:e,entries:n,dirs:o}}i(le,"resolveScopeContext");function Dt(e){let t=ce(e.root),r=e.gitignore;if(r===!1)return{isIgnored:i(async()=>!1,"isIgnored")};let n=new Map,o=i(async()=>{if(typeof r!="string"&&!Array.isArray(r))return le(t);let l=typeof r=="string"?[r]:r.filter(m=>typeof m=="string"),c=[];for(let m of l){let f=await Et(ce(t,m));f&&c.push({base:t,rules:f})}return{kind:"rules",nested:!1,excluded:!1,matchers:c}},"buildRootContext"),a=i(l=>{let c=n.get(l);return c||(c=l===t?o():s(l),n.set(l,c)),c},"contextFor"),s=i(async l=>{let c=await a(gt(l));return c.kind==="git"?c.entries.has(ue(c.root,l))?le(l):c:!c.nested||c.excluded?c:yt(c.matchers,l,!0)?{...c,excluded:!0}:await mn(l)?le(l):St(l,c.matchers)},"deriveContext");return{async isIgnored(l,c){let m=ce(l),f=bt(t,m);if(f.length===0||f===".."||f.startsWith(`..${wt}`)||ln(f))return!1;let p=await a(gt(m));if(p.kind==="git"){let h=ue(p.root,m);return!(p.entries.has(h)||c&&p.dirs.has(h))}return p.excluded||yt(p.matchers,m,c)}}}i(Dt,"createIgnoreFilter");function pn(e){return ut(e)}i(pn,"resolveExtensions");var $t=new Set([".git"]);function de(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}i(de,"normalizeFolderPath");function gn(e){return Array.isArray(e)?e.map(t=>{if(typeof t=="string")return{path:t,recursive:!0};if(t&&typeof t=="object"&&typeof t.path=="string")return{path:t.path,recursive:t.recursive!==!1};throw new TypeError(`Invalid includeFolders entry: ${JSON.stringify(t)} (expected a path string or { path, recursive? })`)}):[]}i(gn,"resolveIncludeFolders");function At(e,t){let r=t instanceof Error?t.message:String(t);console.warn(`fix-headers: skipped include folder "${e}" (${r})`)}i(At,"reportSkippedIncludeFolder");function hn(e,t){if(!Array.isArray(t)||t.length===0)return()=>!1;let r=fe(e),n=[],o=new Set;for(let a of t){if(typeof a!="string")continue;let s=de(a);if(s.length!==0){if(s.includes("/")){n.push(fe(r,s));continue}o.add(s)}}return(a,s)=>{if(o.has(s))return!0;for(let c of n)if(a===c||a.startsWith(`${c}/`))return!0;let l=de(kt(r,a));return n.some(c=>{let m=de(kt(r,c));return l===m||l.startsWith(`${m}/`)})}}i(hn,"buildExclusionMatcher");async function pe(e){let t=pn(e),r=gn(e.includeFolders),n=Array.isArray(e.excludeFolders)?e.excludeFolders:[],o=hn(e.projectRoot,n),a=Dt({root:e.projectRoot,gitignore:e.gitignore}),s=i(async(d,g)=>o(d,g)||await a.isIgnored(d,!0),"shouldSkipDirectory"),l=r.length>0?r.map(d=>({includeFolder:d.path,rootPath:Nt(e.projectRoot,d.path),recursive:d.recursive})):[{includeFolder:".",rootPath:e.projectRoot,recursive:!0}],c=[];for(let d of l){let g=await fn(d.rootPath).catch(S=>S);if(g instanceof Error){if(g.code==="ENOENT"){At(d.includeFolder,g);continue}throw g}if(!g.isDirectory()){At(d.includeFolder,`path is not a directory: ${d.rootPath}`);continue}let w=await dn(d.rootPath).catch(()=>fe(d.rootPath));c.push({...d,realRoot:w})}let m=i((d,g)=>{if(d.realRoot===g.realRoot)return d.recursive||!g.recursive;let w=d.realRoot.endsWith(me)?d.realRoot:`${d.realRoot}${me}`;if(!d.recursive||!g.realRoot.startsWith(w))return!1;let S=d.rootPath;for(let k of g.realRoot.slice(w.length).split(me))if(S=Nt(S,k),$t.has(k)||o(S,k))return!1;return!0},"covers"),f=[...c].sort((d,g)=>d.realRoot.length-g.realRoot.length||Number(g.recursive)-Number(d.recursive)),p=[];for(let d of f)p.some(g=>m(g,d))||p.push(d);let h=[];for(let d of c){if(!p.includes(d))continue;let g=await se(d.rootPath,{allowedExtensions:t,ignoreFolders:$t,shouldSkipDirectory:s,recursive:d.recursive});h.push(...g)}let y=[];for(let d of new Set(h))!o(d,d.split("/").at(-1)||"")&&!await a.isIgnored(d,!1)&&y.push(d);return y}i(pe,"discoverFiles");import{basename as Hn,dirname as _n,extname as Un,resolve as be}from"node:path";import{dirname as Ht,isAbsolute as An,join as _t,relative as Cn,resolve as Ut,sep as vn}from"node:path";import{readFile as yn}from"node:fs/promises";import{join as xn}from"node:path";async function bn(e){try{return await yn(e,"utf8")}catch{return null}}i(bn,"readManifest");async function D(e,t){let r=[];for(let n of t){let o=await bn(xn(e,n));o!==null&&r.push({file:n,content:o})}return r.length>0?{dir:e,manifest:r[0].file,files:r}:null}i(D,"detectManifests");function v(e,t){return e.files.find(r=>r.file===t)?.content??null}i(v,"manifestContent");function b(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}i(b,"cleanName");function ge(e){if(typeof e!="string")return;let t=e.search(/[<(]/);return b(t===-1?e:e.slice(0,t))}i(ge,"personName");function J(e){try{return JSON.parse(e)}catch{return}}i(J,"parseJsonManifest");function*he(e,t){let r="";for(let n of e.split(/\r?\n/)){let o=n.trim();if(o.startsWith("[")){let a=o.match(/^\[([^[\]]+)\]/);r=a?a[1].split(".").map(s=>s.trim()).join("."):"";continue}r===t&&(yield o)}}i(he,"sectionLines");function I(e,t,r){let n=new RegExp(`^${r}\\s*=\\s*(?:"([^"\\\\]*)"|'([^']*)')`);for(let o of he(e,t)){let a=o.match(n);if(a)return b(a[1]??a[2])}}i(I,"readTomlString");function ye(e,t,r){let n=new RegExp(`^${r}\\s*[=:](.*)$`);for(let o of he(e,t)){let a=o.match(n);if(a)return b(a[1])}}i(ye,"readIniValue");function wn(e,t,r){let n=new RegExp(`^${r}\\s*=\\s*\\[`),o=null;for(let a of he(e,t)){if(o!==null){o.push(a);continue}let s=a.match(n);s&&(o=[a.slice(s[0].length)])}return o===null?null:o.join(`
2
2
  `)}i(wn,"tomlArrayText");function En(e,t){let r=t;for(;r<e.length;)if(e[r]==="#"){let n=e.indexOf(`
3
- `,r);r=n===-1?e.length:n+1}else if(/\s/.test(e[r]))r+=1;else break;return r}i(En,"skipTomlSpace");function T(e,t){let r=wn(e,t,"authors");if(r===null)return;let n=r.slice(En(r,0)),o=n.match(/^(?:"([^"\\\n]*)"|'([^'\n]*)')/);if(o)return ge(o[1]??o[2]);let s=n.match(/^\{([^}\n]*)\}/)?.[1].match(/(?:^|,)\s*name\s*=\s*(?:"([^"\\\n]*)"|'([^'\n]*)')/);return s?b(s[1]??s[2]):void 0}i(T,"readTomlAuthor");var Ct=["go.mod"];function Sn(e){let t=e.match(/^\s*module\s+(.+)$/m);if(t)return b(t[1].replace(/\/\/.*$/,"").trim().replace(/^["`](.*)["`]$/,"$1"))}i(Sn,"readModulePath");var vt={id:"go",languages:["go"],manifests:Ct,detect(e){return D(e,Ct)},read(e){return{name:Sn(e.files[0].content)}}};var Ft=["package.json"];function Dn(e){let t=b(e?.name),r=b(e?.publisher),n=typeof e?.engines?.vscode=="string";return t&&r&&n?`${r}.${t}`:t}i(Dn,"readPublishedName");function Nn(e){if(e!==null&&typeof e=="object"){let t=e;return b(t.company)??b(t.name)}return ge(e)}i(Nn,"readAuthorCompany");var Lt={id:"node",languages:["node"],manifests:Ft,detect(e){return D(e,Ft)},read(e){let t=J(e.files[0].content);return{name:Dn(t),company:Nn(t?.author)}}};var Pt=["composer.json"],Mt={id:"php",languages:["php"],manifests:Pt,detect(e){return D(e,Pt)},read(e){let t=J(e.files[0].content),r=t?.authors;return{name:b(t?.name),company:Array.isArray(r)?b(r[0]?.name):void 0}}};var jt=["pyproject.toml","setup.cfg","setup.py"];function Rt(e,t){let r=e.indexOf("setup(");if(r===-1)return;let n=e.slice(r).match(new RegExp(`\\b${t}\\s*=\\s*(["'])([^"'\\n]+)\\1`));return n&&n[2].trim()||void 0}i(Rt,"readSetupPyArgument");function kn(e){let t=v(e,"pyproject.toml"),r=v(e,"setup.cfg"),n=v(e,"setup.py");return(t===null?void 0:I(t,"project","name")??I(t,"tool.poetry","name"))??(r===null?void 0:ye(r,"metadata","name"))??(n===null?void 0:Rt(n,"name"))}i(kn,"readPythonName");function $n(e){let t=v(e,"pyproject.toml"),r=v(e,"setup.cfg"),n=v(e,"setup.py");return(t===null?void 0:T(t,"project")??T(t,"tool.poetry"))??(r===null?void 0:ye(r,"metadata","author"))??(n===null?void 0:Rt(n,"author"))}i($n,"readPythonCompany");var It={id:"python",languages:["python"],manifests:jt,detect(e){return D(e,jt)},read(e){return{name:kn(e),company:$n(e)}}};var Tt=["Cargo.toml"],Ot={id:"rust",languages:["rust"],manifests:Tt,detect(e){return D(e,Tt)},read(e){let t=e.files[0].content;return{name:I(t,"package","name"),company:T(t,"package")}}};var Fn=[Lt,It,Mt,Ot,vt],Bt=["name","company"];async function xe(e,t,r){let o=(await Promise.all(t.map(async s=>({driver:s,detection:await s.detect(e)})))).filter(s=>s.detection!==null),a=o.filter(s=>typeof r=="string"&&s.driver.languages.includes(r));return[...a,...o.filter(s=>!a.includes(s))]}i(xe,"claimFolder");function Ln(e,t){let r=Cn(t,e);return r!==""&&r!==".."&&!r.startsWith(`..${vn}`)&&!An(r)}i(Ln,"isStrictlyInside");async function zt(e,t={}){let r=Array.isArray(t.drivers)?t.drivers:Fn,n=typeof t.scanRoot=="string"?Ut(t.scanRoot):null,o=Ut(e),a=await xe(o,r,t.language);for(;a.length===0;){if(await ae(_t(o,".git")))return{root:o,marker:".git",drivers:[],fields:{},sources:{}};let f=Ht(o);if(f===o)return null;o=f,a=await xe(o,r,t.language)}let s={},c={},l=o,m=a;for(;;){for(let{driver:p,detection:x}of m){let h=p.read(x);for(let d of Bt)s[d]===void 0&&h[d]!==void 0&&(s[d]=h[d],c[d]={driver:p.id,manifest:x.manifest,dir:l})}if(Bt.every(p=>s[p]!==void 0)||n===null||!Ln(l,n)||await ae(_t(l,".git")))break;l=Ht(l),m=await xe(l,r,t.language)}return{root:o,marker:a[0].detection.manifest,drivers:a.map(f=>f.driver.id),fields:s,sources:c}}i(zt,"resolveManifestProject");import{execFile as Pn}from"node:child_process";import{promisify as Mn}from"node:util";var Gt=Mn(Pn);async function N(e,t){try{let{stdout:r}=await Gt("git",t,{cwd:e}),n=r.trim();return n.length>0?n:null}catch{return null}}i(N,"runGit");function Yt(e,t){let r=0;for(let n=t-1;n>=0&&e[n]==="\\";n--)r++;return r%2===1}i(Yt,"isEscaped");function jn(e){let t=e.trim();if(!t.endsWith(")")||Yt(t,t.length-1))return t;let r=0;for(let n=t.length-1;n>=0;n--){let o=t[n];if(!(o!=="("&&o!==")"||Yt(t,n))&&(r+=o===")"?1:-1,r===0))return t.slice(0,n).trim()}return t}i(jn,"stripUidComment");function Rn(e){let t=e.trim();if(t.length===0)return{authorName:null,authorEmail:null};let r=t.match(/<([^>\n]+)>\s*$/),n=r?.[1]?.trim()||null,o=(r?t.slice(0,r.index):t).trim();return{authorName:jn(o)||o||null,authorEmail:n}}i(Rn,"parseSignerUid");async function In(e,t){try{let{stdout:r}=await Gt(e,t),n=r.trim();return n.length>0?n:null}catch{return null}}i(In,"runProgram");function Tn(e){return e.replace(/\\x([0-9a-fA-F]{2})/g,(t,r)=>String.fromCharCode(Number.parseInt(r,16)))}i(Tn,"decodeColonField");async function On(e){let t=await N(e,["config","--get","gpg.format"]);if(t!==null&&t!=="openpgp")return null;let r=await N(e,["config","--get","user.signingkey"]);if(!r)return null;let n=await N(e,["config","--get","gpg.openpgp.program"])||await N(e,["config","--get","gpg.program"])||"gpg",o=await In(n,["--batch","--with-colons","--list-keys",r]);if(!o)return null;for(let a of o.split(`
3
+ `,r);r=n===-1?e.length:n+1}else if(/\s/.test(e[r]))r+=1;else break;return r}i(En,"skipTomlSpace");function T(e,t){let r=wn(e,t,"authors");if(r===null)return;let n=r.slice(En(r,0)),o=n.match(/^(?:"([^"\\\n]*)"|'([^'\n]*)')/);if(o)return ge(o[1]??o[2]);let s=n.match(/^\{([^}\n]*)\}/)?.[1].match(/(?:^|,)\s*name\s*=\s*(?:"([^"\\\n]*)"|'([^'\n]*)')/);return s?b(s[1]??s[2]):void 0}i(T,"readTomlAuthor");var Ct=["go.mod"];function Sn(e){let t=e.match(/^\s*module\s+(.+)$/m);if(t)return b(t[1].replace(/\/\/.*$/,"").trim().replace(/^["`](.*)["`]$/,"$1"))}i(Sn,"readModulePath");var vt={id:"go",languages:["go"],manifests:Ct,detect(e){return D(e,Ct)},read(e){return{name:Sn(e.files[0].content)}}};var Ft=["package.json"];function Dn(e){let t=b(e?.name),r=b(e?.publisher),n=typeof e?.engines?.vscode=="string";return t&&r&&n?`${r}.${t}`:t}i(Dn,"readPublishedName");function Nn(e){if(e!==null&&typeof e=="object"){let t=e;return b(t.company)??b(t.name)}return ge(e)}i(Nn,"readAuthorCompany");var Lt={id:"node",languages:["node"],manifests:Ft,detect(e){return D(e,Ft)},read(e){let t=J(e.files[0].content);return{name:Dn(t),company:Nn(t?.author)}}};var Pt=["composer.json"],Mt={id:"php",languages:["php"],manifests:Pt,detect(e){return D(e,Pt)},read(e){let t=J(e.files[0].content),r=t?.authors;return{name:b(t?.name),company:Array.isArray(r)?b(r[0]?.name):void 0}}};var jt=["pyproject.toml","setup.cfg","setup.py"];function Rt(e,t){let r=e.indexOf("setup(");if(r===-1)return;let n=e.slice(r).match(new RegExp(`\\b${t}\\s*=\\s*(["'])([^"'\\n]+)\\1`));return n&&n[2].trim()||void 0}i(Rt,"readSetupPyArgument");function kn(e){let t=v(e,"pyproject.toml"),r=v(e,"setup.cfg"),n=v(e,"setup.py");return(t===null?void 0:I(t,"project","name")??I(t,"tool.poetry","name"))??(r===null?void 0:ye(r,"metadata","name"))??(n===null?void 0:Rt(n,"name"))}i(kn,"readPythonName");function $n(e){let t=v(e,"pyproject.toml"),r=v(e,"setup.cfg"),n=v(e,"setup.py");return(t===null?void 0:T(t,"project")??T(t,"tool.poetry"))??(r===null?void 0:ye(r,"metadata","author"))??(n===null?void 0:Rt(n,"author"))}i($n,"readPythonCompany");var It={id:"python",languages:["python"],manifests:jt,detect(e){return D(e,jt)},read(e){return{name:kn(e),company:$n(e)}}};var Tt=["Cargo.toml"],Ot={id:"rust",languages:["rust"],manifests:Tt,detect(e){return D(e,Tt)},read(e){let t=e.files[0].content;return{name:I(t,"package","name"),company:T(t,"package")}}};var Fn=[Lt,It,Mt,Ot,vt],Bt=["name","company"];async function xe(e,t,r){let o=(await Promise.all(t.map(async s=>({driver:s,detection:await s.detect(e)})))).filter(s=>s.detection!==null),a=o.filter(s=>typeof r=="string"&&s.driver.languages.includes(r));return[...a,...o.filter(s=>!a.includes(s))]}i(xe,"claimFolder");function Ln(e,t){let r=Cn(t,e);return r!==""&&r!==".."&&!r.startsWith(`..${vn}`)&&!An(r)}i(Ln,"isStrictlyInside");async function zt(e,t={}){let r=Array.isArray(t.drivers)?t.drivers:Fn,n=typeof t.scanRoot=="string"?Ut(t.scanRoot):null,o=Ut(e),a=await xe(o,r,t.language);for(;a.length===0;){if(await ae(_t(o,".git")))return{root:o,marker:".git",drivers:[],fields:{},sources:{}};let f=Ht(o);if(f===o)return null;o=f,a=await xe(o,r,t.language)}let s={},l={},c=o,m=a;for(;;){for(let{driver:p,detection:h}of m){let y=p.read(h);for(let d of Bt)s[d]===void 0&&y[d]!==void 0&&(s[d]=y[d],l[d]={driver:p.id,manifest:h.manifest,dir:c})}if(Bt.every(p=>s[p]!==void 0)||n===null||!Ln(c,n)||await ae(_t(c,".git")))break;c=Ht(c),m=await xe(c,r,t.language)}return{root:o,marker:a[0].detection.manifest,drivers:a.map(f=>f.driver.id),fields:s,sources:l}}i(zt,"resolveManifestProject");import{execFile as Pn}from"node:child_process";import{promisify as Mn}from"node:util";var Gt=Mn(Pn);async function N(e,t){try{let{stdout:r}=await Gt("git",t,{cwd:e}),n=r.trim();return n.length>0?n:null}catch{return null}}i(N,"runGit");function Yt(e,t){let r=0;for(let n=t-1;n>=0&&e[n]==="\\";n--)r++;return r%2===1}i(Yt,"isEscaped");function jn(e){let t=e.trim();if(!t.endsWith(")")||Yt(t,t.length-1))return t;let r=0;for(let n=t.length-1;n>=0;n--){let o=t[n];if(!(o!=="("&&o!==")"||Yt(t,n))&&(r+=o===")"?1:-1,r===0))return t.slice(0,n).trim()}return t}i(jn,"stripUidComment");function Rn(e){let t=e.trim();if(t.length===0)return{authorName:null,authorEmail:null};let r=t.match(/<([^>\n]+)>\s*$/),n=r?.[1]?.trim()||null,o=(r?t.slice(0,r.index):t).trim();return{authorName:jn(o)||o||null,authorEmail:n}}i(Rn,"parseSignerUid");async function In(e,t){try{let{stdout:r}=await Gt(e,t),n=r.trim();return n.length>0?n:null}catch{return null}}i(In,"runProgram");function Tn(e){return e.replace(/\\x([0-9a-fA-F]{2})/g,(t,r)=>String.fromCharCode(Number.parseInt(r,16)))}i(Tn,"decodeColonField");async function On(e){let t=await N(e,["config","--get","gpg.format"]);if(t!==null&&t!=="openpgp")return null;let r=await N(e,["config","--get","user.signingkey"]);if(!r)return null;let n=await N(e,["config","--get","gpg.openpgp.program"])||await N(e,["config","--get","gpg.program"])||"gpg",o=await In(n,["--batch","--with-colons","--list-keys",r]);if(!o)return null;for(let a of o.split(`
4
4
  `)){let s=a.split(":");if(s[0]==="uid"&&s[1]!=="r"&&s[1]!=="e"&&s[9])return Tn(s[9])}return null}i(On,"readSigningKeyUid");async function Wt(e,t={}){let r=await N(e,["config","--get","user.name"]),n=await N(e,["config","--get","user.email"]);if(t.useGpgSignerAuthor===!0){let o=await On(e)||await N(e,["log","-1","--format=%GS"]),a=Rn(o||"");r=a.authorName||r,n=n||a.authorEmail}if(!r||!n){let o=await N(e,["log","-1","--format=%an|%ae"]);if(o){let[a,s]=o.split("|");r=r||a||null,n=n||s||null}}return{authorName:r,authorEmail:n}}i(Wt,"detectGitAuthor");function Vt(e){return e.replace(/z$/i,"+00:00")}i(Vt,"canonicalGitDate");async function Jt(e,t){let r=await N(e,["log","--follow","--format=%aI|%at","--reverse","--",t]);if(!r)return null;let n=r.split(`
5
- `)[0],[o,a]=n.split("|");if(!o||!a)return null;let s=Number.parseInt(a,10);return Number.isNaN(s)?null:{date:Vt(o),timestamp:s}}i(Jt,"getGitCreationDate");async function Kt(e,t){let r=await N(e,["log","-1","--format=%aI|%at","--",t]);if(!r)return null;let[n,o]=r.split("|");if(!n||!o)return null;let a=Number.parseInt(o,10);return Number.isNaN(a)?null:{date:Vt(n),timestamp:a}}i(Kt,"getGitLastModifiedDate");function Bn(e){return Hn(e)||"project"}i(Bn,"folderName");function zn(e,t){if(typeof t!="string")return e;let r=t.trim();return r.length===0||/<[^>]+>/.test(e)?e:`${e} <${r}>`}i(zn,"formatAuthorNameWithCompany");async function Yn(e,t={}){let r=Array.isArray(t.detectors)?t.detectors:P(t),n=typeof t.preferredExtension=="string"?t.preferredExtension.trim().toLowerCase():"",o=n.length>0?r.find(m=>m.extensions.includes(n)):void 0,a=await zt(e,{drivers:t.drivers,language:o?.id,scanRoot:t.scanRoot}),s=a?a.root:be(e),c=a?.sources.name,l=a?.sources.company;return{language:o?.id??a?.drivers[0]??"unknown",rootDir:s,marker:a?a.marker:null,projectName:a?.fields.name??Bn(s),projectNameSource:c?{from:"manifest",...c}:{from:"folder",dir:s},companyName:a?.fields.company??null,companyNameSource:l?{from:"manifest",...l}:{from:"none"},drivers:a?a.drivers:[]}}i(Yn,"detectProjectFromMarkers");async function we(e={}){let t=e.targetFilePath||e.cwd||process.cwd(),r=be(t),n=P(e),o=e.targetFilePath?_n(r):r,a=e.targetFilePath?Un(r).toLowerCase():"",s=be(e.projectRoot||e.cwd||process.cwd()),c=await Yn(o,{detectors:n,preferredExtension:a,scanRoot:s}),l=await Wt(c.rootDir,{useGpgSignerAuthor:e.useGpgSignerAuthor===!0}),m=e.authorName||l.authorName||"Unknown Author",f=typeof e.companyName=="string"?e.companyName.trim():"";return{projectName:e.projectName||c.projectName,projectNameSource:e.projectName?{from:"option"}:c.projectNameSource,language:e.language||c.language,projectRoot:e.projectRoot||c.rootDir,marker:e.marker===void 0?c.marker:e.marker,authorName:zn(m,e.company),authorEmail:e.authorEmail||l.authorEmail||"unknown@example.com",companyName:f||c.companyName,companyNameSource:f?{from:"option"}:c.companyNameSource,copyrightStartYear:Number.isInteger(e.copyrightStartYear)?Number(e.copyrightStartYear):null}}i(we,"resolveProjectMetadata");function Gn(e){return Ee({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),offsetMinutes:-e.getTimezoneOffset()})}i(Gn,"formatDateWithTimezone");function Ee(e){return`${Qt(e," ")} ${er(e.offsetMinutes)}`}i(Ee,"formatSpaceDate");function Xt(e){if(typeof e!="string")throw new Error(`timezone must be an IANA time zone name string, such as "America/Los_Angeles" or "UTC" (got ${typeof e})`);try{Zt(e)}catch(t){throw new Error(`Unknown time zone "${e}": expected an IANA time zone name, such as "America/Los_Angeles" or "UTC"`,{cause:t})}return e}i(Xt,"assertTimeZone");var qt=new Map;function Zt(e){let t=qt.get(e);return t||(t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),qt.set(e,t)),t}i(Zt,"getZoneFormatter");function Se(e,t){let r={};for(let o of Zt(t).formatToParts(new Date(e*1e3)))r[o.type]=Number(o.value);let n=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second)/1e3;return{year:r.year,month:r.month,day:r.day,hour:r.hour,minute:r.minute,second:r.second,offsetMinutes:(n-e)/60}}i(Se,"toZonedDateParts");function Qt(e,t){let r=i(n=>String(n).padStart(2,"0"),"pad");return`${String(e.year).padStart(4,"0")}-${r(e.month)}-${r(e.day)}${t}${r(e.hour)}:${r(e.minute)}:${r(e.second)}`}i(Qt,"formatWallClock");function er(e){let t=i(n=>String(n).padStart(2,"0"),"pad"),r=Math.abs(e);return`${e>=0?"+":"-"}${t(Math.floor(r/60))}:${t(r%60)}`}i(er,"formatOffset");function K(e=new Date){return{date:Gn(e),timestamp:Math.floor(e.getTime()/1e3)}}i(K,"toDatePayload");var Wn=/^(\d{4})-(\d{2})-(\d{2})(?:T|\s+)(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?\s*(?:(Z)|([+-])(\d{2}):?(\d{2}))$/i;function F(e){let t=Wn.exec(e.trim());if(!t)return null;let[r,n,o,a,s,c]=t.slice(1,7).map(Number),l=t[7]?0:Number(t[9])*60+Number(t[10]),m=t[8]==="-"?-l:l,f=new Date(Date.UTC(r,n-1,o,a,s,c));return!(f.getUTCFullYear()===r&&f.getUTCMonth()===n-1&&f.getUTCDate()===o&&f.getUTCHours()===a&&f.getUTCMinutes()===s&&f.getUTCSeconds()===c)||Number(t[10]??0)>59?null:{year:r,month:n,day:o,hour:a,minute:s,second:c,offsetMinutes:m,timestamp:Math.floor(f.getTime()/1e3)-m*60}}i(F,"parseHeaderDate");function De(e){return`${Qt(e,"T")}${er(e.offsetMinutes)}`}i(De,"formatIsoDate");var Vn={"git-created":"git first commit","filesystem-created":"filesystem creation time"};function tr(e,t){let r=e.match(new RegExp(`${t}:[^\\S\\n]*(.*)$`,"m"));return r?r[1].trim():null}i(tr,"readHeaderField");function Ne(e){let t=null;for(let{source:r,payload:n}of e)n&&(!t||n.timestamp<t.payload.timestamp)&&(t={source:r,payload:n});return t}i(Ne,"pickOldestDate");function nr({existing:e,gitCreated:t,filesystemCreated:r,fixCreatedDate:n=!1}){let o=[{source:"git-created",payload:t},{source:"filesystem-created",payload:r}];if(!e)return Ne(o);if(!n)return{source:"existing-header",payload:e};let a=F(e.date)?e:null;return Ne([{source:"existing-header",payload:a},...o])}i(nr,"resolveCreatedDate");function or(e,t=null){if(t)return Se(e.timestamp,t).year;let r=F(e.date);return r?r.year:new Date(e.timestamp*1e3).getFullYear()}i(or,"dateYear");function rr(e,t,r,n){let o=e.match(/^(.+?)\s*\((\d+)\)$/),a=o?F(o[1]):null;if(!o||!a)return n.push({check:`${r}-format`,field:t,advisory:!1,value:e,message:`${t} value "${e}" is not a "<datetime> (<epoch>)" pair with a recognised datetime`}),null;let s=Number.parseInt(o[2],10);return s!==a.timestamp&&n.push({check:`${r}-epoch`,field:t,advisory:!1,value:e,expected:`${o[1]} (${a.timestamp})`,message:`${t} epoch ${s} does not match ${o[1]} (expected ${a.timestamp})`}),{text:o[1],timestamp:a.timestamp}}i(rr,"checkDateValue");function ir(e,t={},r={}){let n=[],o=tr(e,"@Date"),a=o===null?null:rr(o,"@Date","created",n),s=Ne([{source:"git-created",payload:t.gitCreated},{source:"filesystem-created",payload:t.filesystemCreated}]);if(a&&s&&a.timestamp>s.payload.timestamp){let f=Vn[s.source];n.push({check:"created-newer-than-source",field:"@Date",advisory:r.strictCreatedDate!==!0,value:o,expected:`${s.payload.date} (${s.payload.timestamp})`,source:s.source,message:`@Date ${a.text} is later than the ${f} ${s.payload.date} (${s.payload.timestamp})`})}let c=tr(e,"@Last modified time"),l=c===null?null:rr(c,"@Last modified time","modified",n),m=t.gitLastModified;return l&&m&&l.timestamp!==m.timestamp&&n.push({check:"modified-git",field:"@Last modified time",advisory:!0,value:c,expected:`${m.date} (${m.timestamp})`,message:`@Last modified time ${l.text} does not match the git last commit ${m.date} (${m.timestamp})`}),n}i(ir,"checkHeaderDates");function ke(e){if(!e)return null;let t=F(e.date);return t&&t.timestamp!==e.timestamp?{date:e.date,timestamp:t.timestamp}:e}i(ke,"repairDateEpoch");function ar(e){let t=F(e.date);return t?{date:De(t),timestamp:t.timestamp}:e}i(ar,"normalizeDatePayload");function sr(e,t){let r=F(e.date);if(!r)return e;let n=Se(r.timestamp,t);return n.offsetMinutes===r.offsetMinutes||!Number.isInteger(n.offsetMinutes)?e:{date:/^\d{4}-\d{2}-\d{2}T/i.test(e.date.trim())?De(n):Ee(n),timestamp:r.timestamp}}i(sr,"convertDatePayload");import{relative as Kn}from"node:path";import{extname as Jn}from"node:path";function O(e,t={}){let r=Jn(e).toLowerCase(),n=C(t.spacing,"spacing",R);return r.length===0?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */",spacing:n}:{...mt(e,t),spacing:n}}i(O,"getHeaderSyntaxForFile");function cr(e,t){let r=e.spacing??R;if(e.kind==="line"){let c=e.linePrefix||"#",l=typeof e.lineSeparator=="string"?e.lineSeparator:" ",m=Array.from({length:r},()=>c);return[...m,...t.map(f=>`${c}${l}${f}`),...m].join(`
6
- `)}let n=e.blockStart||(e.kind==="html"?"<!--":"/**"),o=e.blockLinePrefix||(e.kind==="html"?" ":" * "),a=e.blockEnd||(e.kind==="html"?"-->":" */"),s=Array.from({length:r},()=>o.trimEnd());return[n,...s,...t.map(c=>`${o}${c}`),...s,a].join(`
7
- `)}i(cr,"renderHeaderLines");function $e(e){let t=`/${Kn(e.projectRoot,e.absoluteFilePath).replace(/\\/g,"/")}`,r=O(e.absoluteFilePath,e.syntaxOptions||{language:e.language}),n=e.createdByName||e.authorName,o=e.createdByEmail||e.authorEmail,a=e.lastModifiedByName||e.authorName,s=e.lastModifiedByEmail||e.authorEmail,c=typeof e.companyName=="string"?e.companyName.trim():"",l=c.length>0?`${c} `:"",m=[`@Project: ${e.projectName}`,`@Filename: ${t}`,`@Date: ${e.createdAt.date} (${e.createdAt.timestamp})`,`@Author: ${n}`,`@Email: <${o}>`,"-----",`@Last modified by: ${a} (${s})`,`@Last modified time: ${e.lastModifiedAt.date} (${e.lastModifiedAt.timestamp})`,"-----",`@Copyright: Copyright (c) ${e.copyrightStartYear}-${e.currentYear} ${l}All rights reserved.`];return cr(r,m)}i($e,"buildHeader");var qn=Object.freeze(["projectName","filename","createdAt","authorName","authorEmail","lastModifiedByName","lastModifiedByEmail","lastModifiedAt","copyrightStartYear","copyrightEndYear","companyName"]);function $(e,t){let r=e.match(new RegExp(`@${t}:[ \\t]*(.*)$`,"m")),n=r?r[1].trim():"";return n.length>0?n:null}i($,"readTag");function Xn(e){if(e===null)return{name:null,email:null};if(!e.endsWith(")"))return{name:e,email:null};let t=e.slice(0,-1),r=t.indexOf("(",t.lastIndexOf(")")+1);return r===-1?{name:e,email:null}:{name:t.slice(0,r).trimEnd()||null,email:t.slice(r+1)||null}}i(Xn,"splitLastModifiedBy");function Zn(e){let t={startYear:null,endYear:null,companyName:null},r=e?.match(/^Copyright\s+\(c\)\s+(\d{4})/i);if(!r)return t;let n=e.slice(r[0].length),o=n.match(/^\s*-\s*(\d{4})/);o&&(n=n.slice(o[0].length));let a=n.toLowerCase(),s=a.endsWith("all rights reserved.")?20:a.endsWith("all rights reserved")?19:0;return s===0||!/^\s/.test(n)?t:{startYear:r[1],endYear:o?o[1]:null,companyName:n.slice(0,-s).trim()||null}}i(Zn,"splitCopyright");function lr(e){let t=Xn($(e,"Last modified by")),r=Zn($(e,"Copyright")),n=$(e,"Email");return{projectName:$(e,"Project"),filename:$(e,"Filename"),createdAt:$(e,"Date"),authorName:$(e,"Author"),authorEmail:n===null?null:n.replace(/^<(.*)>$/,"$1"),lastModifiedByName:t.name,lastModifiedByEmail:t.email,lastModifiedAt:$(e,"Last modified time"),copyrightStartYear:r.startYear,copyrightEndYear:r.endYear,companyName:r.companyName}}i(lr,"parseHeaderFields");function ur(e,t){let r=lr(e??""),n=lr(t);return qn.filter(o=>r[o]!==n[o]).map(o=>({field:o,previous:r[o],detected:n[o]}))}i(ur,"compareHeaderFields");function q(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}i(q,"escapeRegex");function dr(e,t,r={}){let n=dt(e,t,r);return n.length===0?{prefix:"",body:t}:{prefix:n,body:t.slice(n.length)}}i(dr,"splitPreservedPrefix");function mr(e,t){if(t.kind==="html"){let n=q(t.blockStart||"<!--"),o=q(t.blockEnd||"-->");return e.match(new RegExp(`^${n}[\\s\\S]*?${o}\\n*`))}if(t.kind==="line"){let n=q(t.linePrefix||"#");return e.match(new RegExp(`^(?:${n}.*\\n)+\\n*`))}let r=q((t.blockEnd||" */").trim());return e.match(new RegExp(`^/\\*[\\s\\S]*?${r}\\n*`))}i(mr,"matchHeaderSegment");function Ae(e,t="",r={}){let{prefix:n,body:o}=dr(t,e,r),a=o.split(`
5
+ `)[0],[o,a]=n.split("|");if(!o||!a)return null;let s=Number.parseInt(a,10);return Number.isNaN(s)?null:{date:Vt(o),timestamp:s}}i(Jt,"getGitCreationDate");async function Kt(e,t){let r=await N(e,["log","-1","--format=%aI|%at","--",t]);if(!r)return null;let[n,o]=r.split("|");if(!n||!o)return null;let a=Number.parseInt(o,10);return Number.isNaN(a)?null:{date:Vt(n),timestamp:a}}i(Kt,"getGitLastModifiedDate");function Bn(e){return Hn(e)||"project"}i(Bn,"folderName");function zn(e,t){if(typeof t!="string")return e;let r=t.trim();return r.length===0||/<[^>]+>/.test(e)?e:`${e} <${r}>`}i(zn,"formatAuthorNameWithCompany");async function Yn(e,t={}){let r=Array.isArray(t.detectors)?t.detectors:P(t),n=typeof t.preferredExtension=="string"?t.preferredExtension.trim().toLowerCase():"",o=n.length>0?r.find(m=>m.extensions.includes(n)):void 0,a=await zt(e,{drivers:t.drivers,language:o?.id,scanRoot:t.scanRoot}),s=a?a.root:be(e),l=a?.sources.name,c=a?.sources.company;return{language:o?.id??a?.drivers[0]??"unknown",rootDir:s,marker:a?a.marker:null,projectName:a?.fields.name??Bn(s),projectNameSource:l?{from:"manifest",...l}:{from:"folder",dir:s},companyName:a?.fields.company??null,companyNameSource:c?{from:"manifest",...c}:{from:"none"},drivers:a?a.drivers:[]}}i(Yn,"detectProjectFromMarkers");async function we(e={}){let t=e.targetFilePath||e.cwd||process.cwd(),r=be(t),n=P(e),o=e.targetFilePath?_n(r):r,a=e.targetFilePath?Un(r).toLowerCase():"",s=be(e.projectRoot||e.cwd||process.cwd()),l=await Yn(o,{detectors:n,preferredExtension:a,scanRoot:s}),c=await Wt(l.rootDir,{useGpgSignerAuthor:e.useGpgSignerAuthor===!0}),m=e.authorName||c.authorName||"Unknown Author",f=typeof e.companyName=="string"?e.companyName.trim():"";return{projectName:e.projectName||l.projectName,projectNameSource:e.projectName?{from:"option"}:l.projectNameSource,language:e.language||l.language,projectRoot:e.projectRoot||l.rootDir,marker:e.marker===void 0?l.marker:e.marker,authorName:zn(m,e.company),authorEmail:e.authorEmail||c.authorEmail||"unknown@example.com",companyName:f||l.companyName,companyNameSource:f?{from:"option"}:l.companyNameSource,copyrightStartYear:Number.isInteger(e.copyrightStartYear)?Number(e.copyrightStartYear):null}}i(we,"resolveProjectMetadata");function Gn(e){return Ee({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),offsetMinutes:-e.getTimezoneOffset()})}i(Gn,"formatDateWithTimezone");function Ee(e){return`${Qt(e," ")} ${er(e.offsetMinutes)}`}i(Ee,"formatSpaceDate");function Xt(e){if(typeof e!="string")throw new Error(`timezone must be an IANA time zone name string, such as "America/Los_Angeles" or "UTC" (got ${typeof e})`);try{Zt(e)}catch(t){throw new Error(`Unknown time zone "${e}": expected an IANA time zone name, such as "America/Los_Angeles" or "UTC"`,{cause:t})}return e}i(Xt,"assertTimeZone");var qt=new Map;function Zt(e){let t=qt.get(e);return t||(t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),qt.set(e,t)),t}i(Zt,"getZoneFormatter");function Se(e,t){let r={};for(let o of Zt(t).formatToParts(new Date(e*1e3)))r[o.type]=Number(o.value);let n=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second)/1e3;return{year:r.year,month:r.month,day:r.day,hour:r.hour,minute:r.minute,second:r.second,offsetMinutes:(n-e)/60}}i(Se,"toZonedDateParts");function Qt(e,t){let r=i(n=>String(n).padStart(2,"0"),"pad");return`${String(e.year).padStart(4,"0")}-${r(e.month)}-${r(e.day)}${t}${r(e.hour)}:${r(e.minute)}:${r(e.second)}`}i(Qt,"formatWallClock");function er(e){let t=i(n=>String(n).padStart(2,"0"),"pad"),r=Math.abs(e);return`${e>=0?"+":"-"}${t(Math.floor(r/60))}:${t(r%60)}`}i(er,"formatOffset");function K(e=new Date){return{date:Gn(e),timestamp:Math.floor(e.getTime()/1e3)}}i(K,"toDatePayload");var Wn=/^(\d{4})-(\d{2})-(\d{2})(?:T|\s+)(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?\s*(?:(Z)|([+-])(\d{2}):?(\d{2}))$/i;function F(e){let t=Wn.exec(e.trim());if(!t)return null;let[r,n,o,a,s,l]=t.slice(1,7).map(Number),c=t[7]?0:Number(t[9])*60+Number(t[10]),m=t[8]==="-"?-c:c,f=new Date(Date.UTC(r,n-1,o,a,s,l));return!(f.getUTCFullYear()===r&&f.getUTCMonth()===n-1&&f.getUTCDate()===o&&f.getUTCHours()===a&&f.getUTCMinutes()===s&&f.getUTCSeconds()===l)||Number(t[10]??0)>59?null:{year:r,month:n,day:o,hour:a,minute:s,second:l,offsetMinutes:m,timestamp:Math.floor(f.getTime()/1e3)-m*60}}i(F,"parseHeaderDate");function De(e){return`${Qt(e,"T")}${er(e.offsetMinutes)}`}i(De,"formatIsoDate");var Vn={"git-created":"git first commit","filesystem-created":"filesystem creation time"};function tr(e,t){let r=e.match(new RegExp(`${t}:[^\\S\\n]*(.*)$`,"m"));return r?r[1].trim():null}i(tr,"readHeaderField");function Ne(e){let t=null;for(let{source:r,payload:n}of e)n&&(!t||n.timestamp<t.payload.timestamp)&&(t={source:r,payload:n});return t}i(Ne,"pickOldestDate");function nr({existing:e,gitCreated:t,filesystemCreated:r,fixCreatedDate:n=!1}){let o=[{source:"git-created",payload:t},{source:"filesystem-created",payload:r}];if(!e)return Ne(o);if(!n)return{source:"existing-header",payload:e};let a=F(e.date)?e:null;return Ne([{source:"existing-header",payload:a},...o])}i(nr,"resolveCreatedDate");function or(e,t=null){if(t)return Se(e.timestamp,t).year;let r=F(e.date);return r?r.year:new Date(e.timestamp*1e3).getFullYear()}i(or,"dateYear");function rr(e,t,r,n){let o=e.match(/^(.+?)\s*\((\d+)\)$/),a=o?F(o[1]):null;if(!o||!a)return n.push({check:`${r}-format`,field:t,advisory:!1,value:e,message:`${t} value "${e}" is not a "<datetime> (<epoch>)" pair with a recognised datetime`}),null;let s=Number.parseInt(o[2],10);return s!==a.timestamp&&n.push({check:`${r}-epoch`,field:t,advisory:!1,value:e,expected:`${o[1]} (${a.timestamp})`,message:`${t} epoch ${s} does not match ${o[1]} (expected ${a.timestamp})`}),{text:o[1],timestamp:a.timestamp}}i(rr,"checkDateValue");function ir(e,t={},r={}){let n=[],o=tr(e,"@Date"),a=o===null?null:rr(o,"@Date","created",n),s=Ne([{source:"git-created",payload:t.gitCreated},{source:"filesystem-created",payload:t.filesystemCreated}]);if(a&&s&&a.timestamp>s.payload.timestamp){let f=Vn[s.source];n.push({check:"created-newer-than-source",field:"@Date",advisory:r.strictCreatedDate!==!0,value:o,expected:`${s.payload.date} (${s.payload.timestamp})`,source:s.source,message:`@Date ${a.text} is later than the ${f} ${s.payload.date} (${s.payload.timestamp})`})}let l=tr(e,"@Last modified time"),c=l===null?null:rr(l,"@Last modified time","modified",n),m=t.gitLastModified;return c&&m&&c.timestamp!==m.timestamp&&n.push({check:"modified-git",field:"@Last modified time",advisory:!0,value:l,expected:`${m.date} (${m.timestamp})`,message:`@Last modified time ${c.text} does not match the git last commit ${m.date} (${m.timestamp})`}),n}i(ir,"checkHeaderDates");function ke(e){if(!e)return null;let t=F(e.date);return t&&t.timestamp!==e.timestamp?{date:e.date,timestamp:t.timestamp}:e}i(ke,"repairDateEpoch");function ar(e){let t=F(e.date);return t?{date:De(t),timestamp:t.timestamp}:e}i(ar,"normalizeDatePayload");function sr(e,t){let r=F(e.date);if(!r)return e;let n=Se(r.timestamp,t);return n.offsetMinutes===r.offsetMinutes||!Number.isInteger(n.offsetMinutes)?e:{date:/^\d{4}-\d{2}-\d{2}T/i.test(e.date.trim())?De(n):Ee(n),timestamp:r.timestamp}}i(sr,"convertDatePayload");import{relative as Kn}from"node:path";import{extname as Jn}from"node:path";function O(e,t={}){let r=Jn(e).toLowerCase(),n=C(t.spacing,"spacing",R);return r.length===0?{kind:"block",blockStart:"/**",blockLinePrefix:" * ",blockEnd:" */",spacing:n}:{...mt(e,t),spacing:n}}i(O,"getHeaderSyntaxForFile");function cr(e,t){let r=e.spacing??R;if(e.kind==="line"){let l=e.linePrefix||"#",c=typeof e.lineSeparator=="string"?e.lineSeparator:" ",m=Array.from({length:r},()=>l);return[...m,...t.map(f=>`${l}${c}${f}`),...m].join(`
6
+ `)}let n=e.blockStart||(e.kind==="html"?"<!--":"/**"),o=e.blockLinePrefix||(e.kind==="html"?" ":" * "),a=e.blockEnd||(e.kind==="html"?"-->":" */"),s=Array.from({length:r},()=>o.trimEnd());return[n,...s,...t.map(l=>`${o}${l}`),...s,a].join(`
7
+ `)}i(cr,"renderHeaderLines");function $e(e){let t=`/${Kn(e.projectRoot,e.absoluteFilePath).replace(/\\/g,"/")}`,r=O(e.absoluteFilePath,e.syntaxOptions||{language:e.language}),n=e.createdByName||e.authorName,o=e.createdByEmail||e.authorEmail,a=e.lastModifiedByName||e.authorName,s=e.lastModifiedByEmail||e.authorEmail,l=typeof e.companyName=="string"?e.companyName.trim():"",c=l.length>0?`${l} `:"",m=[`@Project: ${e.projectName}`,`@Filename: ${t}`,`@Date: ${e.createdAt.date} (${e.createdAt.timestamp})`,`@Author: ${n}`,`@Email: <${o}>`,"-----",`@Last modified by: ${a} (${s})`,`@Last modified time: ${e.lastModifiedAt.date} (${e.lastModifiedAt.timestamp})`,"-----",`@Copyright: Copyright (c) ${e.copyrightStartYear}-${e.currentYear} ${c}All rights reserved.`];return cr(r,m)}i($e,"buildHeader");var qn=Object.freeze(["projectName","filename","createdAt","authorName","authorEmail","lastModifiedByName","lastModifiedByEmail","lastModifiedAt","copyrightStartYear","copyrightEndYear","companyName"]);function $(e,t){let r=e.match(new RegExp(`@${t}:[ \\t]*(.*)$`,"m")),n=r?r[1].trim():"";return n.length>0?n:null}i($,"readTag");function Xn(e){if(e===null)return{name:null,email:null};if(!e.endsWith(")"))return{name:e,email:null};let t=e.slice(0,-1),r=t.indexOf("(",t.lastIndexOf(")")+1);return r===-1?{name:e,email:null}:{name:t.slice(0,r).trimEnd()||null,email:t.slice(r+1)||null}}i(Xn,"splitLastModifiedBy");function Zn(e){let t={startYear:null,endYear:null,companyName:null},r=e?.match(/^Copyright\s+\(c\)\s+(\d{4})/i);if(!r)return t;let n=e.slice(r[0].length),o=n.match(/^\s*-\s*(\d{4})/);o&&(n=n.slice(o[0].length));let a=n.toLowerCase(),s=a.endsWith("all rights reserved.")?20:a.endsWith("all rights reserved")?19:0;return s===0||!/^\s/.test(n)?t:{startYear:r[1],endYear:o?o[1]:null,companyName:n.slice(0,-s).trim()||null}}i(Zn,"splitCopyright");function lr(e){let t=Xn($(e,"Last modified by")),r=Zn($(e,"Copyright")),n=$(e,"Email");return{projectName:$(e,"Project"),filename:$(e,"Filename"),createdAt:$(e,"Date"),authorName:$(e,"Author"),authorEmail:n===null?null:n.replace(/^<(.*)>$/,"$1"),lastModifiedByName:t.name,lastModifiedByEmail:t.email,lastModifiedAt:$(e,"Last modified time"),copyrightStartYear:r.startYear,copyrightEndYear:r.endYear,companyName:r.companyName}}i(lr,"parseHeaderFields");function ur(e,t){let r=lr(e??""),n=lr(t);return qn.filter(o=>r[o]!==n[o]).map(o=>({field:o,previous:r[o],detected:n[o]}))}i(ur,"compareHeaderFields");function q(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}i(q,"escapeRegex");function dr(e,t,r={}){let n=dt(e,t,r);return n.length===0?{prefix:"",body:t}:{prefix:n,body:t.slice(n.length)}}i(dr,"splitPreservedPrefix");function mr(e,t){if(t.kind==="html"){let n=q(t.blockStart||"<!--"),o=q(t.blockEnd||"-->");return e.match(new RegExp(`^${n}[\\s\\S]*?${o}\\n*`))}if(t.kind==="line"){let n=q(t.linePrefix||"#");return e.match(new RegExp(`^(?:${n}.*\\n)+\\n*`))}let r=q((t.blockEnd||" */").trim());return e.match(new RegExp(`^/\\*[\\s\\S]*?${r}\\n*`))}i(mr,"matchHeaderSegment");function Ae(e,t="",r={}){let{prefix:n,body:o}=dr(t,e,r),a=o.split(`
8
8
  `).slice(0,ft).join(`
9
- `),s=O(t,r);if(!mr(a,s))return null;let l=0,m=0;for(;;){let f=a.slice(l),p=mr(f,s);if(!p||!p[0].includes("@Project:"))break;l+=p[0].length,m=l}return m===0?null:{start:n.length,end:n.length+m}}i(Ae,"findProjectHeader");function Ce(e,t,r="",n={}){let o=Ae(e,r,n),a=C(n.margin,"margin",V),s=O(r,n).kind==="line"?Math.max(1,a):a,c=`
10
- `.repeat(s+1);if(!o){let{prefix:p,body:x}=dr(r,e,n),h=`${p}${t}${c}${x.replace(/^\n+/,"")}`;return{nextContent:h,changed:h!==e}}let l=e.slice(0,o.start),m=e.slice(o.end).replace(/^\n+/,""),f=`${l}${t}${c}${m}`;return{nextContent:f,changed:f!==e}}i(Ce,"replaceOrInsertHeader");function Qn(e,t){let r=e.length,n=t.length,o=Array.from({length:r+1},()=>new Array(n+1).fill(0));for(let l=r-1;l>=0;l-=1)for(let m=n-1;m>=0;m-=1)o[l][m]=e[l]===t[m]?o[l+1][m+1]+1:Math.max(o[l+1][m],o[l][m+1]);let a=[],s=0,c=0;for(;s<r&&c<n;)e[s]===t[c]?(a.push({type:" ",line:e[s]}),s+=1,c+=1):o[s+1][c]>=o[s][c+1]?(a.push({type:"-",line:e[s]}),s+=1):(a.push({type:"+",line:t[c]}),c+=1);for(;s<r;s+=1)a.push({type:"-",line:e[s]});for(;c<n;c+=1)a.push({type:"+",line:t[c]});return a}i(Qn,"diffLines");function fr(e,t){return`${t===0?e:e+1},${t}`}i(fr,"formatRange");function pr(e,t,r={}){let n=e===null?[]:e.split(`
9
+ `),s=O(t,r);if(!mr(a,s))return null;let c=0,m=0;for(;;){let f=a.slice(c),p=mr(f,s);if(!p||!p[0].includes("@Project:"))break;c+=p[0].length,m=c}return m===0?null:{start:n.length,end:n.length+m}}i(Ae,"findProjectHeader");function Ce(e,t,r="",n={}){let o=Ae(e,r,n),a=C(n.margin,"margin",V),s=O(r,n).kind==="line"?Math.max(1,a):a,l=`
10
+ `.repeat(s+1),c=i(h=>h.trim()===""?`${t}
11
+ `:`${t}${l}${h}`,"join");if(!o){let{prefix:h,body:y}=dr(r,e,n),d=`${h}${c(y.replace(/^\n+/,""))}`;return{nextContent:d,changed:d!==e}}let m=e.slice(0,o.start),f=e.slice(o.end).replace(/^\n+/,""),p=`${m}${c(f)}`;return{nextContent:p,changed:p!==e}}i(Ce,"replaceOrInsertHeader");function Qn(e,t){let r=e.length,n=t.length,o=Array.from({length:r+1},()=>new Array(n+1).fill(0));for(let c=r-1;c>=0;c-=1)for(let m=n-1;m>=0;m-=1)o[c][m]=e[c]===t[m]?o[c+1][m+1]+1:Math.max(o[c+1][m],o[c][m+1]);let a=[],s=0,l=0;for(;s<r&&l<n;)e[s]===t[l]?(a.push({type:" ",line:e[s]}),s+=1,l+=1):o[s+1][l]>=o[s][l+1]?(a.push({type:"-",line:e[s]}),s+=1):(a.push({type:"+",line:t[l]}),l+=1);for(;s<r;s+=1)a.push({type:"-",line:e[s]});for(;l<n;l+=1)a.push({type:"+",line:t[l]});return a}i(Qn,"diffLines");function fr(e,t){return`${t===0?e:e+1},${t}`}i(fr,"formatRange");function pr(e,t,r={}){let n=e===null?[]:e.split(`
11
12
  `),o=t.split(`
12
- `),a=Qn(n,o),s=Math.max(0,r.context??3),c=r.lineOffset??0,l=[];if(a.forEach((x,h)=>{if(x.type===" ")return;let d=l[l.length-1];d&&h-d.last<=s*2+1?d.last=h:l.push({first:h,last:h})}),l.length===0)return"";let m=r.fromFile??"a",f=r.toFile??"b",p=[`--- ${e===null?"/dev/null":m}`,`+++ ${f}`];for(let x of l){let h=Math.max(0,x.first-s),d=Math.min(a.length,x.last+s+1),g=a.slice(0,h),w=a.slice(h,d),S=g.filter(u=>u.type!=="+").length+c,k=g.filter(u=>u.type!=="-").length+c,H=w.filter(u=>u.type!=="+").length,y=w.filter(u=>u.type!=="-").length;p.push(`@@ -${fr(S,H)} +${fr(k,y)} @@`);for(let u of w)p.push(`${u.type}${u.line}`)}return p.join(`
13
- `)}i(pr,"createUnifiedDiff");function no(e){return ze(e,"configFile")}i(no,"resolveRuntimeOptions");function oo(e){let t=e.match(/@Author:\s*(.+)$/m),r=e.match(/@Email:\s*<([^>\n]+)>/m);return{authorName:t?.[1]?.trim(),authorEmail:r?.[1]?.trim()}}i(oo,"extractHeaderAuthorIdentity");function io(e){let t=e.match(/@Last modified by:\s*(.+?)\s*\(([^)\n]+)\)\s*$/m);return{authorName:t?.[1]?.trim(),authorEmail:t?.[2]?.trim()}}i(io,"extractHeaderLastModifiedIdentity");function ao(e){let t=e.match(/@Date:\s*(.+?)\s*\((\d+)\)$/m);if(!t||!t[1]||!t[2])return null;let r=Number.parseInt(t[2],10);return Number.isNaN(r)?null:{date:t[1].trim(),timestamp:r}}i(ao,"extractHeaderCreatedAt");function so(e){let t=e.match(/@Last modified time:\s*(.+?)\s*\((\d+)\)$/m);if(!t||!t[1]||!t[2])return null;let r=Number.parseInt(t[2],10);return Number.isNaN(r)?null:{date:t[1].trim(),timestamp:r}}i(so,"extractHeaderLastModifiedAt");async function yr(e={}){let t=await no(e),r=t.timezone===void 0||t.timezone===null?null:Xt(t.timezone),n=t.convertTimezone===!0;if(n&&!r)throw new Error("convertTimezone requires timezone: set timezone (CLI --timezone <name>) to the IANA zone to convert header dates into");let o=hr(t.projectRoot||t.cwd||process.cwd()),a=await we({...t,cwd:o});C(t.spacing,"spacing",R),C(t.margin,"margin",V);let s=t.check===!0,c=s||t.dryRun===!0,l=t.fixCreatedDate===!0,m=i(y=>y,"keepDate"),f=t.normalizeDateFormat===!0?ar:m,p=r?y=>sr(y,r):m,x=n?p:m,h;if(typeof t.input=="string"&&t.input.trim().length>0){let y=hr(o,t.input),u=await to(y).catch(()=>null);if(!u)throw new Error(`Input path does not exist: ${t.input}`);if(u.isFile())h=[y];else if(u.isDirectory())h=await pe({projectRoot:y,language:a.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,includeFolders:t.includeFolders,excludeFolders:t.excludeFolders,includeExtensions:t.includeExtensions,gitignore:t.gitignore});else throw new Error(`Input path must be a file or directory: ${t.input}`)}else h=await pe({projectRoot:o,language:a.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,includeFolders:t.includeFolders,excludeFolders:t.excludeFolders,includeExtensions:t.includeExtensions,gitignore:t.gitignore});let d=new Date().getFullYear(),g=[],w=new Set,S=0,k=0,H=0;for(let y of h){let u=await we({...t,cwd:o,targetFilePath:y});w.add(`${u.language}:${u.projectRoot}`);let ve=gr(o,y),_=await eo(y,"utf8"),X=Ae(_,y,{language:u.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin}),E=X?_.slice(X.start,X.end):"",U=E.length>0?oo(E):{},B=E.length>0?io(E):{},xr=E.length>0?ao(E):null,br=E.length>0?so(E):null,Fe=await pt(y),Le=gr(u.projectRoot,y),Pe=await Jt(u.projectRoot,Le),Z=await Kt(u.projectRoot,Le),Me=K(Fe.createdAt),Q=nr({existing:ke(xr),gitCreated:Pe,filesystemCreated:Me,fixCreatedDate:l}),ee=ke(br),je=Q.source,wr=ee?"existing-header":Z?"git-last-modified":"filesystem-updated",z=f(je==="existing-header"?x(Q.payload):p(Q.payload)),Er=u.copyrightStartYear===null?"created-date":"option",te=u.copyrightStartYear??or(z,r),Re=f(ee?x(ee):p(Z||K(Fe.updatedAt))),Y=t.forceAuthorUpdate===!0,G=t.forceLastModifiedAuthorUpdate===!0,Ie=$e({absoluteFilePath:y,language:u.language,syntaxOptions:{language:u.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin},projectRoot:u.projectRoot,projectName:u.projectName,createdByName:Y?u.authorName:U.authorName||u.authorName,createdByEmail:Y?u.authorEmail:U.authorEmail||u.authorEmail,lastModifiedByName:G?u.authorName:B.authorName||u.authorName,lastModifiedByEmail:G?u.authorEmail:B.authorEmail||u.authorEmail,authorName:u.authorName,authorEmail:u.authorEmail,createdAt:z,lastModifiedAt:Re,copyrightStartYear:te,companyName:u.companyName,currentYear:d}),Te=Ce(_,Ie,y,{language:u.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin}),W=Te.changed,Oe=W?f(p(K(new Date))):Re,Sr=W?"current-time-on-change":wr,M=W?$e({absoluteFilePath:y,language:u.language,syntaxOptions:{language:u.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin},projectRoot:u.projectRoot,projectName:u.projectName,createdByName:Y?u.authorName:U.authorName||u.authorName,createdByEmail:Y?u.authorEmail:U.authorEmail||u.authorEmail,lastModifiedByName:G?u.authorName:B.authorName||u.authorName,lastModifiedByEmail:G?u.authorEmail:B.authorEmail||u.authorEmail,authorName:u.authorName,authorEmail:u.authorEmail,createdAt:z,lastModifiedAt:Oe,copyrightStartYear:te,companyName:u.companyName,currentYear:d}):Ie,L=W?Ce(_,M,y,{language:u.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin}):Te,re={file:ve,changed:L.changed};if(s){let A=ir(E,{gitCreated:Pe,gitLastModified:Z,filesystemCreated:Me},{strictCreatedDate:t.strictCreatedDate===!0}),j=A.filter(ne=>ne.advisory).length;re.dateIssues=A,H+=j,k+=A.length>j?1:0}if(t.sampleOutput===!0&&L.changed){let A=E.length>0?E.trimEnd():null,j=ve.replace(/\\/g,"/"),ne=L.nextContent.slice(0,L.nextContent.indexOf(M)).split(`
14
- `).length-1;re.sample={previousValue:A,newValue:M,diff:pr(A,M,{fromFile:`a/${j}`,toFile:`b/${j}`,lineOffset:ne}),issues:ur(A,M),detectedValues:{projectName:u.projectName,projectNameSource:u.projectNameSource,language:u.language,projectRoot:u.projectRoot,marker:u.marker,authorName:u.authorName,authorEmail:u.authorEmail,companyName:u.companyName,companyNameSource:u.companyNameSource,copyrightStartYear:te,copyrightStartYearSource:Er,createdAtSource:je,lastModifiedAtSource:Sr,createdAt:z,lastModifiedAt:Oe}}}g.push(re),L.changed&&(S+=1,c||await ro(y,L.nextContent,"utf8"))}return{metadata:a,detectedProjects:Array.from(w),filesScanned:h.length,filesUpdated:S,dryRun:c,check:s,...s?{filesWithDateDrift:k,dateAdvisories:H}:{},changes:g}}i(yr,"fixHeaders");function co(e){return yr(e)}i(co,"fixHeaders");var Va=co;export{Va as default,co as fixHeaders};
13
+ `),a=Qn(n,o),s=Math.max(0,r.context??3),l=r.lineOffset??0,c=[];if(a.forEach((h,y)=>{if(h.type===" ")return;let d=c[c.length-1];d&&y-d.last<=s*2+1?d.last=y:c.push({first:y,last:y})}),c.length===0)return"";let m=r.fromFile??"a",f=r.toFile??"b",p=[`--- ${e===null?"/dev/null":m}`,`+++ ${f}`];for(let h of c){let y=Math.max(0,h.first-s),d=Math.min(a.length,h.last+s+1),g=a.slice(0,y),w=a.slice(y,d),S=g.filter(u=>u.type!=="+").length+l,k=g.filter(u=>u.type!=="-").length+l,H=w.filter(u=>u.type!=="+").length,x=w.filter(u=>u.type!=="-").length;p.push(`@@ -${fr(S,H)} +${fr(k,x)} @@`);for(let u of w)p.push(`${u.type}${u.line}`)}return p.join(`
14
+ `)}i(pr,"createUnifiedDiff");function no(e){return ze(e,"configFile")}i(no,"resolveRuntimeOptions");function oo(e){let t=e.match(/@Author:\s*(.+)$/m),r=e.match(/@Email:\s*<([^>\n]+)>/m);return{authorName:t?.[1]?.trim(),authorEmail:r?.[1]?.trim()}}i(oo,"extractHeaderAuthorIdentity");function io(e){let t=e.match(/@Last modified by:\s*(.+?)\s*\(([^)\n]+)\)\s*$/m);return{authorName:t?.[1]?.trim(),authorEmail:t?.[2]?.trim()}}i(io,"extractHeaderLastModifiedIdentity");function ao(e){let t=e.match(/@Date:\s*(.+?)\s*\((\d+)\)$/m);if(!t||!t[1]||!t[2])return null;let r=Number.parseInt(t[2],10);return Number.isNaN(r)?null:{date:t[1].trim(),timestamp:r}}i(ao,"extractHeaderCreatedAt");function so(e){let t=e.match(/@Last modified time:\s*(.+?)\s*\((\d+)\)$/m);if(!t||!t[1]||!t[2])return null;let r=Number.parseInt(t[2],10);return Number.isNaN(r)?null:{date:t[1].trim(),timestamp:r}}i(so,"extractHeaderLastModifiedAt");async function yr(e={}){let t=await no(e),r=t.timezone===void 0||t.timezone===null?null:Xt(t.timezone),n=t.convertTimezone===!0;if(n&&!r)throw new Error("convertTimezone requires timezone: set timezone (CLI --timezone <name>) to the IANA zone to convert header dates into");let o=hr(t.projectRoot||t.cwd||process.cwd()),a=await we({...t,cwd:o});C(t.spacing,"spacing",R),C(t.margin,"margin",V);let s=t.check===!0,l=s||t.dryRun===!0,c=t.fixCreatedDate===!0,m=i(x=>x,"keepDate"),f=t.normalizeDateFormat===!0?ar:m,p=r?x=>sr(x,r):m,h=n?p:m,y;if(typeof t.input=="string"&&t.input.trim().length>0){let x=hr(o,t.input),u=await to(x).catch(()=>null);if(!u)throw new Error(`Input path does not exist: ${t.input}`);if(u.isFile())y=[x];else if(u.isDirectory())y=await pe({projectRoot:x,language:a.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,includeFolders:t.includeFolders,excludeFolders:t.excludeFolders,includeExtensions:t.includeExtensions,gitignore:t.gitignore});else throw new Error(`Input path must be a file or directory: ${t.input}`)}else y=await pe({projectRoot:o,language:a.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,includeFolders:t.includeFolders,excludeFolders:t.excludeFolders,includeExtensions:t.includeExtensions,gitignore:t.gitignore});let d=new Date().getFullYear(),g=[],w=new Set,S=0,k=0,H=0;for(let x of y){let u=await we({...t,cwd:o,targetFilePath:x});w.add(`${u.language}:${u.projectRoot}`);let ve=gr(o,x),_=await eo(x,"utf8"),X=Ae(_,x,{language:u.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin}),E=X?_.slice(X.start,X.end):"",U=E.length>0?oo(E):{},B=E.length>0?io(E):{},xr=E.length>0?ao(E):null,br=E.length>0?so(E):null,Fe=await pt(x),Le=gr(u.projectRoot,x),Pe=await Jt(u.projectRoot,Le),Z=await Kt(u.projectRoot,Le),Me=K(Fe.createdAt),Q=nr({existing:ke(xr),gitCreated:Pe,filesystemCreated:Me,fixCreatedDate:c}),ee=ke(br),je=Q.source,wr=ee?"existing-header":Z?"git-last-modified":"filesystem-updated",z=f(je==="existing-header"?h(Q.payload):p(Q.payload)),Er=u.copyrightStartYear===null?"created-date":"option",te=u.copyrightStartYear??or(z,r),Re=f(ee?h(ee):p(Z||K(Fe.updatedAt))),Y=t.forceAuthorUpdate===!0,G=t.forceLastModifiedAuthorUpdate===!0,Ie=$e({absoluteFilePath:x,language:u.language,syntaxOptions:{language:u.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin},projectRoot:u.projectRoot,projectName:u.projectName,createdByName:Y?u.authorName:U.authorName||u.authorName,createdByEmail:Y?u.authorEmail:U.authorEmail||u.authorEmail,lastModifiedByName:G?u.authorName:B.authorName||u.authorName,lastModifiedByEmail:G?u.authorEmail:B.authorEmail||u.authorEmail,authorName:u.authorName,authorEmail:u.authorEmail,createdAt:z,lastModifiedAt:Re,copyrightStartYear:te,companyName:u.companyName,currentYear:d}),Te=Ce(_,Ie,x,{language:u.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin}),W=Te.changed,Oe=W?f(p(K(new Date))):Re,Sr=W?"current-time-on-change":wr,M=W?$e({absoluteFilePath:x,language:u.language,syntaxOptions:{language:u.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin},projectRoot:u.projectRoot,projectName:u.projectName,createdByName:Y?u.authorName:U.authorName||u.authorName,createdByEmail:Y?u.authorEmail:U.authorEmail||u.authorEmail,lastModifiedByName:G?u.authorName:B.authorName||u.authorName,lastModifiedByEmail:G?u.authorEmail:B.authorEmail||u.authorEmail,authorName:u.authorName,authorEmail:u.authorEmail,createdAt:z,lastModifiedAt:Oe,copyrightStartYear:te,companyName:u.companyName,currentYear:d}):Ie,L=W?Ce(_,M,x,{language:u.language,enabledDetectors:t.enabledDetectors,disabledDetectors:t.disabledDetectors,detectorSyntaxOverrides:t.detectorSyntaxOverrides,spacing:t.spacing,margin:t.margin}):Te,re={file:ve,changed:L.changed};if(s){let A=ir(E,{gitCreated:Pe,gitLastModified:Z,filesystemCreated:Me},{strictCreatedDate:t.strictCreatedDate===!0}),j=A.filter(ne=>ne.advisory).length;re.dateIssues=A,H+=j,k+=A.length>j?1:0}if(t.sampleOutput===!0&&L.changed){let A=E.length>0?E.trimEnd():null,j=ve.replace(/\\/g,"/"),ne=L.nextContent.slice(0,L.nextContent.indexOf(M)).split(`
15
+ `).length-1;re.sample={previousValue:A,newValue:M,diff:pr(A,M,{fromFile:`a/${j}`,toFile:`b/${j}`,lineOffset:ne}),issues:ur(A,M),detectedValues:{projectName:u.projectName,projectNameSource:u.projectNameSource,language:u.language,projectRoot:u.projectRoot,marker:u.marker,authorName:u.authorName,authorEmail:u.authorEmail,companyName:u.companyName,companyNameSource:u.companyNameSource,copyrightStartYear:te,copyrightStartYearSource:Er,createdAtSource:je,lastModifiedAtSource:Sr,createdAt:z,lastModifiedAt:Oe}}}g.push(re),L.changed&&(S+=1,l||await ro(x,L.nextContent,"utf8"))}return{metadata:a,detectedProjects:Array.from(w),filesScanned:y.length,filesUpdated:S,dryRun:l,check:s,...s?{filesWithDateDrift:k,dateAdvisories:H}:{},changes:g}}i(yr,"fixHeaders");function co(e){return yr(e)}i(co,"fixHeaders");var Va=co;export{Va as default,co as fixHeaders};
15
16
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cldmv/fix-headers",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Multi-language project header normalizer with auto-detection and override support.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -43,7 +43,8 @@
43
43
  "lint:fix": "eslint --config .configs/eslint.config.mjs . --fix",
44
44
  "format": "prettier --config .configs/.prettierrc --write .",
45
45
  "format:check": "prettier --config .configs/.prettierrc --check .",
46
- "prepare": "node -e \"import('./.githooks/install.mjs').catch(()=>{})\""
46
+ "prepare": "node -e \"import('./.githooks/install.mjs').catch(()=>{})\"",
47
+ "fix:headers": "node ./src/cli.mjs --config .configs/fix-headers.json"
47
48
  },
48
49
  "keywords": [
49
50
  "headers",
@@ -84,6 +85,7 @@
84
85
  "license": "Apache-2.0",
85
86
  "sideEffects": false,
86
87
  "devDependencies": {
88
+ "@cldmv/configs": "^1.2.0",
87
89
  "@cldmv/eslint-plugin-jsonv": "^1.0.10",
88
90
  "@cldmv/jsonv": "^1.0.9",
89
91
  "@cldmv/prettier-plugin-jsonv": "^1.0.6",
@@ -94,6 +96,7 @@
94
96
  "@eslint/markdown": "^8.0.3",
95
97
  "@types/node": "^26.1.1",
96
98
  "@vitest/coverage-v8": "^5.0.0",
99
+ "esbuild": "^0.28.2",
97
100
  "eslint": "^10.11.0",
98
101
  "globals": "^17.12.0",
99
102
  "prettier": "^3.9.9",
@@ -103,5 +106,8 @@
103
106
  },
104
107
  "dependencies": {
105
108
  "ignore": "^7.0.5"
109
+ },
110
+ "overrides": {
111
+ "esbuild": "$esbuild"
106
112
  }
107
113
  }
@@ -18,6 +18,7 @@ export function parseHeaderFields(headerText: string): HeaderFields;
18
18
  */
19
19
  export function compareHeaderFields(previousHeader: string | null, nextHeader: string): HeaderFieldIssue[];
20
20
  /**
21
+ *
21
22
  * @Project: @cldmv/fix-headers
22
23
  * @Filename: /src/header/fields.mjs
23
24
  * @Date: 2026-09-28T09:14:18-07:00 (1790612058)
@@ -25,9 +26,10 @@ export function compareHeaderFields(previousHeader: string | null, nextHeader: s
25
26
  * @Email: <Shinrai@users.noreply.github.com>
26
27
  * -----
27
28
  * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
28
- * @Last modified time: 2026-09-28T09:14:18-07:00 (1790612058)
29
+ * @Last modified time: 2026-10-02T12:28:16-07:00 (1790969296)
29
30
  * -----
30
- * @Copyright: Copyright (c) 2026-2026 Catalyzed Motivation Inc. All rights reserved.
31
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
32
+ *
31
33
  */
32
34
  /**
33
35
  * @fileoverview Parses the individual fields back out of a rendered header block and
@@ -1,4 +1,5 @@
1
1
  /**
2
+ *
2
3
  * @Project: @cldmv/fix-headers
3
4
  * @Filename: /src/utils/diff.mjs
4
5
  * @Date: 2026-09-28T09:14:18-07:00 (1790612058)
@@ -6,9 +7,10 @@
6
7
  * @Email: <Shinrai@users.noreply.github.com>
7
8
  * -----
8
9
  * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
9
- * @Last modified time: 2026-09-28T09:14:18-07:00 (1790612058)
10
+ * @Last modified time: 2026-10-02T12:28:16-07:00 (1790969296)
10
11
  * -----
11
- * @Copyright: Copyright (c) 2026-2026 Catalyzed Motivation Inc. All rights reserved.
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
12
14
  */
13
15
  /**
14
16
  * @fileoverview Minimal line-level unified diff for header blocks. Header blocks are a
@@ -1,4 +1,5 @@
1
1
  /**
2
+ *
2
3
  * @Project: @cldmv/fix-headers
3
4
  * @Filename: /src/utils/time.mjs
4
5
  * @Date: 2026-03-01T17:59:32-08:00 (1772416772)
@@ -6,9 +7,10 @@
6
7
  * @Email: <Shinrai@users.noreply.github.com>
7
8
  * -----
8
9
  * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
9
- * @Last modified time: 2026-03-01T17:59:32-08:00 (1772416772)
10
+ * @Last modified time: 2026-10-02T12:28:16-07:00 (1790969296)
10
11
  * -----
11
- * @Copyright: Copyright (c) 2026-2026 Catalyzed Motivation Inc. All rights reserved.
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
12
14
  */
13
15
  /**
14
16
  * @fileoverview Date/time helpers used for header timestamp formatting.