@alete-ai/gate-ingest 0.1.0
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.
- package/LICENSE +622 -0
- package/dist/chunk-G7HIHPC6.js +2 -0
- package/dist/chunk-G7HIHPC6.js.map +1 -0
- package/dist/empty-shim-IFLK4AY7.js +2 -0
- package/dist/empty-shim-IFLK4AY7.js.map +1 -0
- package/dist/index.browser.d.ts +106 -0
- package/dist/index.browser.js +416 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.cjs +12 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +106 -0
- package/dist/index.d.ts +106 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/package.json +39 -0
- package/src/config.ts +60 -0
- package/src/index.test.ts +100 -0
- package/src/index.ts +183 -0
- package/src/platform/empty-shim.ts +34 -0
- package/src/sanitization/Redactor.ts +95 -0
- package/src/token-mapper.test.ts +32 -0
- package/src/token-mapper.ts +78 -0
- package/tsconfig.json +14 -0
- package/tsup.config.ts +48 -0
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
import {d,f,c,l,k as k$1,h}from'./chunk-G7HIHPC6.js';import {createRequire}from'module';var D={html:0,head:1,details:2,summary:3,title:4,meta:5,br:6,h1:7,h2:8,h3:9,h4:10,h5:11,h6:12,hr:13,strong:14,b:15,em:16,i:17,del:18,sub:19,sup:20,ins:21,blockquote:22,code:23,ul:24,li:25,a:26,img:27,table:28,thead:29,tr:30,th:31,td:32,ol:33,pre:34,p:35,div:36,span:37,tbody:38,tfoot:39,form:40,nav:41,label:42,button:43,body:44,center:45,kbd:46,footer:47,path:48,svg:49,article:50,section:51,script:52,style:53,link:54,area:55,base:56,col:57,embed:58,input:59,keygen:60,param:61,source:62,track:63,wbr:64,select:65,textarea:66,option:67,fieldset:68,legend:69,audio:70,video:71,canvas:72,iframe:73,map:74,dialog:75,meter:76,progress:77,template:78,abbr:79,mark:80,q:81,samp:82,small:83,noscript:84,noframes:85,xmp:86,plaintext:87,aside:88,u:89,cite:90,dfn:91,var:92,time:93,bdo:94,ruby:95,rt:96,rp:97,dd:98,dt:99,dl:101,address:100,figure:102,object:103,main:104,header:105,figcaption:106,caption:107};Object.entries(D).map(([t,e])=>[e,t]);var m=[0,0],we=[2,2],Be=[1,1],ke=[1,0],z=[0,1];function He(t,e){if(!t)return t;if(t.startsWith("//"))return `https:${t}`;if(t.startsWith("#"))return t;if(e){if(t.startsWith("/")&&e)return `${e.endsWith("/")?e.slice(0,-1):e}${t}`;if(t.startsWith("./"))return `${e}/${t.slice(2)}`;if(!t.startsWith("http"))return `${e}/${t.startsWith("/")?t.slice(1):t}`}return t}function b(t){return (t.depthMap[32]||0)>0||(t.depthMap[31]||0)>0}function lr(t){if(!t)return "";let e=t.split(" ").map(r=>r.split("language-")[1]).filter(Boolean);return e&&e.length>0?e[0].trim():""}function B(t){return {enter:({node:e})=>(e.depthMap[26]||0)>0?`<h${t}>`:`${"#".repeat(t)} `,exit:({node:e})=>{if((e.depthMap[26]||0)>0)return `</h${t}>`},collapsesInnerWhiteSpace:true}}var Fe={enter:({node:t})=>(t?.depthMap?.[15]||0)>1?"":"**",exit:({node:t})=>(t?.depthMap?.[15]||0)>1?"":"**",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},Ze={enter:({node:t})=>(t?.depthMap?.[17]||0)>1?"":"_",exit:({node:t})=>(t?.depthMap?.[17]||0)>1?"":"_",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},ue={1:{spacing:m,collapsesInnerWhiteSpace:true},2:{enter:()=>"<details>",exit:()=>`</details>
|
|
2
|
+
|
|
3
|
+
`},3:{enter:()=>"<summary>",exit:()=>`</summary>
|
|
4
|
+
|
|
5
|
+
`},4:{collapsesInnerWhiteSpace:true,isNonNesting:true,spacing:m},52:{excludesTextNodes:true,isNonNesting:true},53:{isNonNesting:true,excludesTextNodes:true},5:{collapsesInnerWhiteSpace:true,isSelfClosing:true,spacing:m},6:{enter:({node:t})=>b(t)?"<br>":void 0,isSelfClosing:true,spacing:m,collapsesInnerWhiteSpace:true,isInline:true},7:B(1),8:B(2),9:B(3),10:B(4),11:B(5),12:B(6),13:{enter:()=>"---",isSelfClosing:true},14:Fe,15:Fe,16:Ze,17:Ze,18:{enter:()=>"~~",exit:()=>"~~",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},19:{enter:()=>"<sub>",exit:()=>"</sub>",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},20:{enter:()=>"<sup>",exit:()=>"</sup>",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},21:{enter:()=>"<ins>",exit:()=>"</ins>",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},22:{enter:({node:t,state:e})=>{let r=t.depthMap[22]||1,i="> ".repeat(r);return (t.depthMap[25]||0)>0&&(i=`
|
|
6
|
+
${e.listIndent}${i}`),i},spacing:Be},23:{enter:({node:t,state:e})=>{if((t.depthMap[34]||0)>0){let r=lr(t.attributes?.class);return (t.depthMap[25]||0)>0?`
|
|
7
|
+
|
|
8
|
+
${e.listIndent}\`\`\`${r}
|
|
9
|
+
`:`\`\`\`${r}
|
|
10
|
+
`}if((t.depthMap[25]||0)>0){let r=e.buffer.at(-1),i=r?.charAt(r.length-1)||"";if(i&&i!==" "&&i!==`
|
|
11
|
+
`&&i!==" "&&i!=="*"&&i!=="_"&&i!=="~"&&i!=="["&&i!==">")return " `"}return "`"},exit:({node:t,state:e})=>{if((t.depthMap[34]||0)>0){if((t.depthMap[25]||0)>0){let r=e.listIndent;return `
|
|
12
|
+
${r}\`\`\`
|
|
13
|
+
|
|
14
|
+
${r}`}return "\n```"}return "`"},collapsesInnerWhiteSpace:true,spacing:m,isInline:true},24:{enter:({node:t})=>b(t)?"<ul>":void 0,exit:({node:t})=>b(t)?"</ul>":void 0},33:{enter:({node:t})=>b(t)?"<ol>":void 0,exit:({node:t})=>b(t)?"</ol>":void 0},25:{enter:({node:t,state:e})=>{if(b(t))return "<li>";let r=t.parent?.tagId===33?`${t.index+1}. `:"- ";return `${e.listIndent}${r}`},exit:({node:t})=>b(t)?"</li>":void 0,spacing:ke},26:{enter:({node:t})=>{if(t.attributes?.href)return "["},exit:({node:t,state:e})=>{if(!t.attributes?.href)return "";let r=He(t.attributes?.href||"",e.options?.origin),i=t.attributes?.title;return e.lastContentCache===i&&(i=""),i?`](${r} "${i}")`:`](${r})`},collapsesInnerWhiteSpace:true,spacing:m,isInline:true},27:{enter:({node:t,state:e})=>`})`,collapsesInnerWhiteSpace:true,isSelfClosing:true,spacing:m,isInline:true},28:{enter:({node:t,state:e})=>{if(b(t))return "<table>";(t.depthMap[28]||0)<=1&&(e.tableRenderedTable=false),e.tableColumnAlignments=[];},exit:({node:t})=>b(t)?"</table>":void 0},29:{enter:({node:t})=>{if(b(t))return "<thead>"},exit:({node:t})=>b(t)?"</thead>":void 0,spacing:z,excludesTextNodes:true},30:{enter:({node:t,state:e})=>b(t)?"<tr>":(e.tableCurrentRowCells=0,"| "),exit:({node:t,state:e})=>{if(b(t)||(t.depthMap[28]||0)>1)return "</tr>";if(!e.tableRenderedTable){e.tableRenderedTable=true;let r=e.tableColumnAlignments;for(;r.length<e.tableCurrentRowCells;)r.push("");return ` |
|
|
15
|
+
| ${r.map(i=>{switch(i){case "left":return ":---";case "center":return ":---:";case "right":return "---:";default:return "---"}}).join(" | ")} |`}return " |"},excludesTextNodes:true,spacing:z},31:{enter:({node:t,state:e})=>{if((t.depthMap[28]||0)>1)return "<th>";let r=t.attributes?.align?.toLowerCase();return r?e.tableColumnAlignments.push(r):e.tableColumnAlignments.length<=e.tableCurrentRowCells&&e.tableColumnAlignments.push(""),t.index===0?"":" | "},exit:({node:t,state:e})=>{if((t.depthMap[28]||0)>1)return "</th>";e.tableCurrentRowCells++;},collapsesInnerWhiteSpace:true,spacing:m},32:{enter:({node:t})=>(t.depthMap[28]||0)>1?"<td>":t.index===0?"":" | ",exit:({node:t,state:e})=>{if((t.depthMap[28]||0)>1)return "</td>";e.tableCurrentRowCells++;},collapsesInnerWhiteSpace:true,spacing:m},35:{enter:({node:t,state:e})=>{let r=t.depthMap[22]||0;if(r>0){let i=e.buffer.at(-1),s=i?.charAt(i.length-1)||"";if(s&&s!==`
|
|
16
|
+
`&&s!==" "&&s!==">"){let n="> ".repeat(r);return `
|
|
17
|
+
${n.trimEnd()}
|
|
18
|
+
${n}`}}if((t.depthMap[25]||0)>0&&!b(t)){let i=e.buffer.at(-1),s=i?.charAt(i.length-1)||"";if(s&&s!==" "&&s!==`
|
|
19
|
+
`)return `
|
|
20
|
+
|
|
21
|
+
${e.listIndent}`}}},36:{},37:{collapsesInnerWhiteSpace:true,spacing:m,isInline:true},41:{},42:{collapsesInnerWhiteSpace:true,spacing:m,isInline:true},43:{collapsesInnerWhiteSpace:true,isInline:true},44:{spacing:m},45:{enter:({node:t})=>{if((t.depthMap[28]||0)>1)return "<center>"},exit:({node:t})=>{if((t.depthMap[28]||0)>1)return "</center>"},spacing:m},38:{spacing:m,excludesTextNodes:true},39:{spacing:z,excludesTextNodes:true},46:{enter:()=>"`",exit:()=>"`",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},47:{spacing:m},40:{spacing:m},54:{isSelfClosing:true,spacing:m,collapsesInnerWhiteSpace:true,isInline:true},55:{isSelfClosing:true,spacing:m,isInline:true,collapsesInnerWhiteSpace:true},56:{isSelfClosing:true,spacing:m,isInline:true,collapsesInnerWhiteSpace:true},57:{isSelfClosing:true,spacing:m},58:{isSelfClosing:true,spacing:m},59:{isSelfClosing:true,spacing:m,isInline:true,collapsesInnerWhiteSpace:true},60:{isSelfClosing:true,spacing:m,isInline:true,collapsesInnerWhiteSpace:true},61:{isSelfClosing:true,spacing:m},62:{isSelfClosing:true,spacing:m},63:{isSelfClosing:true,spacing:m},64:{isSelfClosing:true,spacing:m,isInline:true,collapsesInnerWhiteSpace:true},49:{spacing:m},65:{spacing:m},66:{isNonNesting:true,spacing:m},67:{isNonNesting:true,spacing:m},68:{spacing:m},69:{spacing:m},70:{spacing:m},71:{spacing:m},72:{spacing:m},73:{isNonNesting:true,spacing:m},74:{spacing:m},75:{spacing:m},76:{spacing:m},77:{spacing:m},78:{spacing:m},79:{enter:()=>"",exit:()=>"",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},80:{enter:()=>"<mark>",exit:()=>"</mark>",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},81:{enter:()=>'"',exit:()=>'"',collapsesInnerWhiteSpace:true,spacing:m,isInline:true},82:{enter:()=>"`",exit:()=>"`",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},83:{enter:()=>"",exit:()=>"",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},84:{excludesTextNodes:true,spacing:m},85:{isNonNesting:true,spacing:m},86:{isNonNesting:true,spacing:m},87:{isNonNesting:true,spacing:m},88:{spacing:m},89:{enter:()=>"<u>",exit:()=>"</u>",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},90:{enter:()=>"*",exit:()=>"*",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},91:{enter:()=>"**",exit:()=>"**",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},92:{enter:()=>"`",exit:()=>"`",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},93:{enter:()=>"",exit:()=>"",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},94:{enter:()=>"",exit:()=>"",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},95:{enter:()=>"",exit:()=>"",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},96:{enter:()=>"",exit:()=>"",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},97:{enter:()=>"",exit:()=>"",collapsesInnerWhiteSpace:true,spacing:m,isInline:true},100:{enter:()=>"<address>",exit:()=>"</address>",spacing:m,collapsesInnerWhiteSpace:true},101:{spacing:m,enter:()=>"<dl>",exit:()=>"</dl>"},99:{enter:()=>"<dt>",exit:()=>"</dt>",collapsesInnerWhiteSpace:true,spacing:[0,1]},98:{enter:()=>"<dd>",exit:()=>"</dd>",spacing:[0,1]},50:{},51:{},105:{},104:{},102:{},106:{enter:()=>"_",exit:()=>"_",collapsesInnerWhiteSpace:true,spacing:m,isInline:true}};function Ke(t){let e=new Map;for(let r in t){let i=t[r];if(i)if(typeof i=="string"){let s=D[i];if(s!==void 0){let n=ue[s];n&&e.set(r,{...n});}}else {let s=D[r],n=s!==void 0?ue[s]:void 0,a=n?{...n}:{};if(i.enter!==void 0){let o=i.enter;a.enter=()=>o;}if(i.exit!==void 0){let o=i.exit;a.exit=()=>o;}i.spacing!==void 0&&(a.spacing=i.spacing),i.isInline!==void 0&&(a.isInline=i.isInline),i.isSelfClosing!==void 0&&(a.isSelfClosing=i.isSelfClosing),i.collapsesInnerWhiteSpace!==void 0&&(a.collapsesInnerWhiteSpace=i.collapsesInnerWhiteSpace),e.set(r,a);}}return e}var dr={"á":"\xE1","Á":"\xC1","â":"\xE2","Â":"\xC2","´":"\xB4","æ":"\xE6","Æ":"\xC6","à":"\xE0","À":"\xC0","ℵ":"\u2135","α":"\u03B1","Α":"\u0391","&":"&","∧":"\u2227","∠":"\u2220","'":"'","å":"\xE5","Å":"\xC5","≈":"\u2248","ã":"\xE3","Ã":"\xC3","ä":"\xE4","Ä":"\xC4","„":"\u201E","β":"\u03B2","Β":"\u0392","¦":"\xA6","•":"\u2022","∩":"\u2229","ç":"\xE7","Ç":"\xC7","¸":"\xB8","¢":"\xA2","χ":"\u03C7","Χ":"\u03A7","ˆ":"\u02C6","♣":"\u2663","≅":"\u2245","©":"\xA9","↵":"\u21B5","∪":"\u222A","¤":"\xA4","†":"\u2020","‡":"\u2021","↓":"\u2193","⇓":"\u21D3","°":"\xB0","δ":"\u03B4","Δ":"\u0394","♦":"\u2666","÷":"\xF7","é":"\xE9","É":"\xC9","ê":"\xEA","Ê":"\xCA","è":"\xE8","È":"\xC8","∅":"\u2205","ε":"\u03B5","Ε":"\u0395","≡":"\u2261","η":"\u03B7","Η":"\u0397","ð":"\xF0","Ð":"\xD0","ë":"\xEB","Ë":"\xCB","€":"\u20AC","∃":"\u2203","ƒ":"\u0192","∀":"\u2200","½":"\xBD","¼":"\xBC","¾":"\xBE","⁄":"\u2044","γ":"\u03B3","Γ":"\u0393","≥":"\u2265",">":">","↔":"\u2194","⇔":"\u21D4","♥":"\u2665","…":"\u2026","í":"\xED","Í":"\xCD","î":"\xEE","Î":"\xCE","¡":"\xA1","ì":"\xEC","Ì":"\xCC","ℑ":"\u2111","∞":"\u221E","∫":"\u222B","ι":"\u03B9","Ι":"\u0399","¿":"\xBF","∈":"\u2208","ï":"\xEF","Ï":"\xCF","κ":"\u03BA","Κ":"\u039A","λ":"\u03BB","Λ":"\u039B","⟨":"\u27E8","«":"\xAB","←":"\u2190","⇐":"\u21D0","⌈":"\u2308","“":"\u201C","≤":"\u2264","⌊":"\u230A","∗":"\u2217","◊":"\u25CA","‹":"\u2039","‘":"\u2018","<":"<","¯":"\xAF","—":"\u2014","µ":"\xB5","·":"\xB7","−":"\u2212","μ":"\u03BC","Μ":"\u039C","∇":"\u2207"," ":" ","–":"\u2013","≠":"\u2260","∋":"\u220B","¬":"\xAC","∉":"\u2209","⊄":"\u2284","ñ":"\xF1","Ñ":"\xD1","ν":"\u03BD","Ν":"\u039D","ó":"\xF3","Ó":"\xD3","ô":"\xF4","Ô":"\xD4","œ":"\u0153","Œ":"\u0152","ò":"\xF2","Ò":"\xD2","‾":"\u203E","ω":"\u03C9","Ω":"\u03A9","ο":"\u03BF","Ο":"\u039F","⊕":"\u2295","∨":"\u2228","ª":"\xAA","º":"\xBA","ø":"\xF8","Ø":"\xD8","õ":"\xF5","Õ":"\xD5","⊗":"\u2297","ö":"\xF6","Ö":"\xD6","¶":"\xB6","∂":"\u2202","‰":"\u2030","⊥":"\u22A5","φ":"\u03C6","Φ":"\u03A6","π":"\u03C0","Π":"\u03A0","ϖ":"\u03D6","±":"\xB1","£":"\xA3","′":"\u2032","″":"\u2033","∏":"\u220F","∝":"\u221D","ψ":"\u03C8","Ψ":"\u03A8",""":'"',"√":"\u221A","⟩":"\u27E9","»":"\xBB","→":"\u2192","⇒":"\u21D2","⌉":"\u2309","”":"\u201D","ℜ":"\u211C","®":"\xAE","⌋":"\u230B","ρ":"\u03C1","Ρ":"\u03A1","›":"\u203A","’":"\u2019","‚":"\u201A","š":"\u0161","Š":"\u0160","⋅":"\u22C5","§":"\xA7","σ":"\u03C3","Σ":"\u03A3","ς":"\u03C2","∼":"\u223C","♠":"\u2660","⊂":"\u2282","⊆":"\u2286","∑":"\u2211","⊃":"\u2283","¹":"\xB9","²":"\xB2","³":"\xB3","⊇":"\u2287","ß":"\xDF","τ":"\u03C4","Τ":"\u03A4","∴":"\u2234","θ":"\u03B8","Θ":"\u0398","ϑ":"\u03D1","þ":"\xFE","Þ":"\xDE","˜":"\u02DC","×":"\xD7","™":"\u2122","ú":"\xFA","Ú":"\xDA","↑":"\u2191","⇑":"\u21D1","û":"\xFB","Û":"\xDB","ù":"\xF9","Ù":"\xD9","¨":"\xA8","ϒ":"\u03D2","υ":"\u03C5","Υ":"\u03A5","ü":"\xFC","Ü":"\xDC","℘":"\u2118","ξ":"\u03BE","Ξ":"\u039E","ý":"\xFD","Ý":"\xDD","¥":"\xA5","ÿ":"\xFF","Ÿ":"\u0178","ζ":"\u03B6","Ζ":"\u0396"};function j(t){let e="",r=0,i=t.length;for(;r<i;){if(t.charCodeAt(r)===38)if(r+2<i&&t.charCodeAt(r+1)===35){let s=r;r+=2;let n=t.charCodeAt(r)===120||t.charCodeAt(r)===88;n&&r++;let a=r,o=r+(n?7:8);for(;r<i&&r<o&&t.charCodeAt(r)!==59;)r++;if(r<i&&t.charCodeAt(r)===59){let c=Number.parseInt(t.substring(a,r),n?16:10);if(c>=0&&c<=1114111&&!Number.isNaN(c)){e+=String.fromCodePoint(c),r++;continue}}r=s;}else {let s=r+33<i?r+33:i,n=r+1;for(;n<s&&t.charCodeAt(n)!==59;)n++;if(n<s&&t.charCodeAt(n)===59){let a=dr[t.substring(r,n+1)];if(a!==void 0){e+=a,r=n+1;continue}}}e+=t[r],r++;}return e}function We(t){let e=t,r=[e];for(;e.tagHandler?.isInline&&e.parent;)e=e.parent,r.push(e);return r}var ur=60,M=62,pe=47,le=61,he=34,ge=39,pr=33,hr=38,me=92,V=45,Ye=32,gr=9,ze=10,Ve=13,Ge=96,mr=124,Er=91,fr=93,je=Object.freeze({});function Ar(t){return new Uint8Array(t)}function G(t){return t===Ye||t===gr||t===ze||t===Ve}function Ee(t,e,r){return yr(t,e,r)}function yr(t,e,r){let i="";e.depthMap??=new Uint8Array(108),e.depth??=0,e.lastCharWasWhitespace??=true,e.justClosedTag??=false,e.isFirstTextInElement??=false,e.lastCharWasBackslash??=false;let s=0,n=t.length;for(;s<n;){let a=t.charCodeAt(s);if(a!==ur){if(a===hr&&(e.hasEncodedHtmlEntity=true),G(a)){let c=(e.depthMap[34]||0)>0;if(e.justClosedTag&&(e.justClosedTag=false,e.lastCharWasWhitespace=false),!c&&e.lastCharWasWhitespace){s++;continue}c?i+=t[s]:(a===Ye||!e.lastCharWasWhitespace)&&(i+=" "),e.lastCharWasWhitespace=true,e.textBufferContainsWhitespace=true,e.lastCharWasBackslash=false;}else e.textBufferContainsNonWhitespace=true,e.lastCharWasWhitespace=false,e.justClosedTag=false,a===mr&&e.depthMap[28]?i+="\\|":a===Ge&&(e.depthMap[23]||e.depthMap[34])?i+="\\`":a===Er&&e.depthMap[26]?i+="\\[":a===fr&&e.depthMap[26]?i+="\\]":a===M&&e.depthMap[22]?i+="\\>":i+=t[s],e.currentNode?.tagHandler?.isNonNesting&&(e.lastCharWasBackslash||(a===ge&&!e.inDoubleQuote&&!e.inBacktick?e.inSingleQuote=!e.inSingleQuote:a===he&&!e.inSingleQuote&&!e.inBacktick?e.inDoubleQuote=!e.inDoubleQuote:a===Ge&&!e.inSingleQuote&&!e.inDoubleQuote&&(e.inBacktick=!e.inBacktick))),e.lastCharWasBackslash=a===me&&!e.lastCharWasBackslash;s++;continue}if(s+1>=n){i+=t[s];break}let o=t.charCodeAt(s+1);if(o===pr){i.length>0&&(de(i,e,r),i="");let c=_r(t,s);if(c.complete)s=c.newPosition;else {i+=c.remainingText;break}}else if(o===pe){if(e.currentNode?.tagHandler?.isNonNesting){if(e.inSingleQuote||e.inDoubleQuote||e.inBacktick){i+=t[s],s++;continue}let l=s+2;for(;l<n;){let d=t.charCodeAt(l);if(d===M||G(d))break;l++;}if((D[t.substring(s+2,l).toLowerCase()]??-1)!==e.currentNode.tagId){i+=t[s++];continue}}i.length>0&&(de(i,e,r),i="");let c=Ir(t,s,e,r);if(c.complete)s=c.newPosition;else {i+=c.remainingText;break}}else {let c=s+1,l=c,d=-1;for(;c<n;){let A=t.charCodeAt(c);if(G(A)||A===pe||A===M){d=c;break}c++;}if(d===-1){i+=t.substring(s);break}let u=t.substring(l,d).toLowerCase(),p=D[u]??-1;if(c=d,e.currentNode?.tagHandler?.isNonNesting&&(!u||p!==e.currentNode?.tagId)){i+=t[s++];continue}if(!u){i+=t[s++];continue}i.length>0&&(de(i,e,r),i="");let h=Nr(u,p,t,c,e,r);if(h.skip)i+=t[s++];else if(h.complete)s=h.newPosition,h.selfClosing||(e.isFirstTextInElement=true);else {i+=h.remainingText;break}}}return i}function de(t,e,r){let i=e.textBufferContainsNonWhitespace,s=e.textBufferContainsWhitespace;if(e.textBufferContainsNonWhitespace=false,e.textBufferContainsWhitespace=false,!e.currentNode)return;let n=e.currentNode?.tagHandler?.excludesTextNodes,a=(e.depthMap[34]||0)>0;if(!a&&!i&&!e.currentNode.childTextNodeIndex)return;let o=t;if(o.length===0)return;let c=We(e.currentNode),l=c.at(-1);if(s&&!l?.childTextNodeIndex){let u=0;for(;u<o.length&&(a?o.charCodeAt(u)===ze||o.charCodeAt(u)===Ve:G(o.charCodeAt(u)));)u++;u>0&&(o=o.substring(u));}e.hasEncodedHtmlEntity&&(o=j(String(o)),e.hasEncodedHtmlEntity=false);let d={type:2,value:o,parent:e.currentNode,index:e.currentNode.currentWalkIndex++,depth:e.depth,containsWhitespace:s,excludedFromMarkdown:n};for(let u of c)u.childTextNodeIndex=(u.childTextNodeIndex||0)+1;r({type:0,node:d}),e.lastTextNode=d;}function Ir(t,e,r,i){let s=e+2,n=s,a=t.length,o=false;for(;s<a;){if(t.charCodeAt(s)===M){o=true;break}s++;}if(!o)return {complete:false,newPosition:e,remainingText:t.substring(e)};let c=D[t.substring(n,s).toLowerCase()]??-1;if(r.currentNode?.tagHandler?.isNonNesting&&c!==r.currentNode.tagId)return {complete:false,newPosition:e,remainingText:t.substring(e)};let l=r.currentNode;if(l){let d=l.tagId!==c;for(;l&&d;)q(l,r,i),l=l.parent,d=l?.tagId!==c;}return l&&q(l,r,i),r.justClosedTag=true,{complete:true,newPosition:s+1,remainingText:""}}function q(t,e,r){if(t){if(t.tagId===26&&!t.childTextNodeIndex){let i=t.attributes?.title||t.attributes?.["aria-label"]||"";if(i){t.childTextNodeIndex=1,r({type:0,node:{type:2,value:i,parent:t,index:0,depth:t.depth+1}});for(let s of We(t))s.childTextNodeIndex=(s.childTextNodeIndex||0)+1;}}t.tagId&&(e.depthMap[t.tagId]=Math.max(0,(e.depthMap[t.tagId]||0)-1)),t.tagHandler?.isNonNesting&&(e.inSingleQuote=false,e.inDoubleQuote=false,e.inBacktick=false,e.lastCharWasBackslash=false),e.depth--,r({type:1,node:t}),e.currentNode=e.currentNode.parent,e.hasEncodedHtmlEntity=false,e.justClosedTag=true;}}function _r(t,e){let r=e,i=t.length;if(r+3<i&&t.charCodeAt(r+2)===V&&t.charCodeAt(r+3)===V){for(r+=4;r<i-2;){if(t.charCodeAt(r)===V&&t.charCodeAt(r+1)===V&&t.charCodeAt(r+2)===M)return r+=3,{complete:true,newPosition:r,remainingText:""};r++;}return {complete:false,newPosition:e,remainingText:t.substring(e)}}else {for(r+=2;r<i;){if(t.charCodeAt(r)===M)return r++,{complete:true,newPosition:r,remainingText:""};r++;}return {complete:false,newPosition:r,remainingText:t.substring(e,r)}}}function Nr(t,e,r,i,s,n){s.currentNode?.tagHandler?.isNonNesting&&q(s.currentNode,s,n);let a=s.tagOverrideHandlers?.get(t)??ue[e],o=Rr(r,i,a);if(!o.complete)return {complete:false,newPosition:i,remainingText:`<${t}${o.attrBuffer}`,selfClosing:false};let c=o.attributes&&o.attributes.id?void 0:s.depthMap[e]||0;s.depthMap[e]=(c||0)+1,s.depth++,i=o.newPosition,s.currentNode&&(s.currentNode.currentWalkIndex=s.currentNode.currentWalkIndex||0);let l=s.currentNode?s.currentNode.currentWalkIndex++:0,d={type:1,name:t,attributes:o.attributes,parent:s.currentNode,depthMap:Ar(s.depthMap),depth:s.depth,index:l,tagId:e,tagHandler:a};s.lastTextNode=d,n({type:0,node:d});let u=d;return u.currentWalkIndex=0,s.currentNode=u,s.hasEncodedHtmlEntity=false,a?.isNonNesting&&!o.selfClosing&&(s.inSingleQuote=false,s.inDoubleQuote=false,s.inBacktick=false,s.lastCharWasBackslash=false),o.selfClosing?(q(d,s,n),s.justClosedTag=true):s.justClosedTag=false,{complete:true,newPosition:i,remainingText:"",selfClosing:o.selfClosing}}function Rr(t,e,r){let i=e,s=t.length,n=r?.isSelfClosing||false,a=i,o=false,c=0,l=0;for(;i<s;){let d=t.charCodeAt(i);if(o){d===c&&l!==me&&(o=false),i++;continue}else if(d===he||d===ge)o=true,c=d;else if(d===pe&&i+1<s&&t.charCodeAt(i+1)===M){let u=t.substring(a,i).trim();return {complete:true,newPosition:i+2,attributes:$e(u),selfClosing:true,attrBuffer:u}}else if(d===M){let u=t.substring(a,i).trim();return {complete:true,newPosition:i+1,attributes:$e(u),selfClosing:n,attrBuffer:u}}i++,l=d;}return {complete:false,newPosition:i,attributes:je,selfClosing:false,attrBuffer:t.substring(a,i)}}function $e(t){if(!t)return je;let e={},r=t.length,i=0,s=0,n=1,a=2,o=3,c=4,l=5,d=s,u=0,p=0,h=0,A=0,E="";for(;i<r;){let g=t.charCodeAt(i),_=G(g);switch(d){case s:_||(d=n,u=i,p=0);break;case n:(g===le||_)&&(p=i,E=t.substring(u,p).toLowerCase(),d=g===le?o:a);break;case a:g===le?d=o:_||(e[E]="",d=n,u=i,p=0);break;case o:g===he||g===ge?(A=g,d=c,h=i+1):_||(d=l,h=i);break;case c:if(g===me&&i+1<r)i++;else if(g===A){let f=t.substring(h,i);e[E]=f.includes("&")?j(f):f,d=s;}break;case l:if(_||g===M){let f=t.substring(h,i);e[E]=f.includes("&")?j(f):f,d=s;}break}i++;}if(d===c||d===l){if(E){let g=t.substring(h,i);e[E]=g.includes("&")?j(g):g;}}else if(d===n||d===a||d===o){p=p||i;let g=t.substring(u,p).toLowerCase();g&&(e[g]="");}return e}function qe(t){return {matches:e=>e.name===t,toString:()=>t}}function Xe(t){let e=t.slice(1);return {matches:r=>r.attributes?.id===e,toString:()=>`#${e}`}}function Je(t){let e=t.slice(1);return {matches:r=>r.attributes?.class?r.attributes.class.trim().split(" ").filter(Boolean).includes(e):false,toString:()=>`.${e}`}}function Tr(t){if(t.charCodeAt(0)!==91)return null;let e=t.indexOf("]",1);if(e===-1)return null;let r=t.slice(1,e),i=-1;for(let c=0;c<r.length;c++){let l=r.charCodeAt(c);if(l===61||l===126||l===124||l===94||l===36||l===42){i=c;break}}if(i===-1)return {attr:r};let s=r.slice(0,i),n=i+1;n<r.length&&r.charCodeAt(n)===61&&n++;let a=r.slice(i,n),o=r.slice(n);return (o.charCodeAt(0)===34||o.charCodeAt(0)===39)&&o.charCodeAt(o.length-1)===o.charCodeAt(0)&&(o=o.slice(1,-1)),{attr:s,op:a,value:o}}function Qe(t){let e=Tr(t),r=e?e.attr:t.slice(1,-1),i=e?.op,s=e?.value;return {matches:n=>{if(!(r in(n.attributes||{})))return false;if(!i||!s)return true;let a=n.attributes[r];if(a===void 0)return false;switch(i){case "=":return a===s;case "^=":return a.startsWith(s);case "$=":return a.endsWith(s);case "*=":return a.includes(s);case "~=":return a.trim().split(" ").filter(Boolean).includes(s);case "|=":return a===s||a.startsWith(`${s}-`);default:return false}},toString:()=>!i||!s?`[${r}]`:`[${r}${i}${s}]`}}function br(t){return {matches:e=>t.every(r=>r.matches(e)),toString:()=>t.map(e=>e.toString()).join("")}}function it(t){if(t=t.trim(),!t)throw new Error("Empty selector");let e=[],r="";for(let s=0;s<t.length;s++){let n=t[s];(n==="."||n==="#"||n==="[")&&r?(r[0]==="."?e.push(Je(r)):r[0]==="#"?e.push(Xe(r)):r[0]==="["?e.push(Qe(r)):r&&e.push(qe(r)),r=n):r+=n;}return r&&(r[0]==="."?e.push(Je(r)):r[0]==="#"?e.push(Xe(r)):r[0]==="["?e.push(Qe(r)):r&&e.push(qe(r))),e.length===1?e[0]:br(e)}function fe(t){let e=Object.entries(t).map(([a,o])=>({selector:a,matcher:it(a),callback:o})),r=[],i=new Map,s={onNodeEnter(a){for(let o=0;o<e.length;o++){let c=e[o];c.matcher.matches(a)&&i.set(a,{textContent:"",selector:c.selector,callback:c.callback});}},processTextNode(a){let o=a.parent;for(;o;){let c=i.get(o);c&&(c.textContent+=a.value),o=o.parent;}},onNodeExit(a){let o=i.get(a);if(o){let c={selector:o.selector,tagName:a.name,textContent:o.textContent.trim(),attributes:{...a.attributes}};r.push(c),i.delete(a);}}};function n(){for(let a=0;a<r.length;a++){let o=r[a];for(let c=0;c<e.length;c++)if(e[c].selector===o.selector){e[c].callback(o);break}}}return {plugin:s,getResults:()=>r,callHandlers:n}}function et(t){if(typeof t=="number")return {matches:r=>r.tagId===t,toString:()=>String(t)};let e=D[t];return e!==void 0?{matches:r=>r.tagId===e,toString:()=>t}:it(t)}function Ae(t={}){let e=t.include?.map(s=>et(s))||[],r=t.exclude?.map(s=>et(s))||[],i=t.processChildren!==false;return {beforeNodeProcess(s){let{node:n}=s;if(n.type===2){let c=n.parent;for(;c&&r.length;){if(r.some(l=>l.matches(c)))return {skip:true};c=c.parent;}return}if(n.type!==1)return;let a=n;if(r.length){if(a.attributes.style?.includes("absolute")||a.attributes.style?.includes("fixed"))return {skip:true};if(r.some(c=>c.matches(a)))return {skip:true}}let o=a.parent;for(;o;){if(r.length&&r.some(c=>c.matches(o)))return {skip:true};o=o.parent;}if(e.length){let c=a;for(;c;){if(e.some(l=>l.matches(c)))return;if(!i)break;c=c.parent;}return {skip:true}}}}}var Cr=/\\/g,vr=/"/g,tt=/\\"/g;function ye(t={}){let e=t.additionalFields||{},r=new Set(["description","keywords","author","date","og:title","og:description","twitter:title","twitter:description",...t.metaFields||[]]),i={...e,meta:{}},s=false;function n(l,d){return d=d.replace(Cr,"\\\\").replace(vr,'\\"'),d.includes(`
|
|
22
|
+
`)||d.includes(":")||d.includes("#")||d.includes(" ")?`"${d}"`:d}function a(){let l={};if(i.title){let d=i.title;l.title=d.startsWith('"')&&d.endsWith('"')?d.slice(1,-1).replace(tt,'"'):d;}for(let[d,u]of Object.entries(i.meta)){let p=d.startsWith('"')&&d.endsWith('"')?d.slice(1,-1):d;l[p]=typeof u=="string"&&u.startsWith('"')&&u.endsWith('"')?u.slice(1,-1).replace(tt,'"'):String(u);}if(e)for(let[d,u]of Object.entries(e))typeof u=="string"&&(l[d]=u);return Object.keys(l).length>0?l:void 0}let o={onNodeEnter(l){if(l.tagId===1){s=true;return}if(!(s&&l.type===1&&l.tagId===4)&&s&&l.type===1&&l.tagId===5){let{name:d,property:u,content:p}=l.attributes||{},h=u||d;h&&p&&r.has(h)&&(i.meta[h.includes(":")?`"${h}"`:h]=n(h,p));return}},onNodeExit(l,d){if(l.type===1&&l.tagId===1&&(s=false,Object.keys(i).length>0)){let u=c();u&&(d.buffer.push(u),d.lastContentCache=u);}},processTextNode(l){if(!s)return;let d=l.parent;if(d&&d.tagId===4&&l.value)return i.title=n("title",l.value.trim()),{content:"",skip:true}}};return o.getFrontmatter=a,o;function c(){if(Object.keys(i).length===0)return "";let l=[],d=Object.entries(i).sort(([u],[p])=>u==="title"?-1:p==="title"?1:u==="description"?-1:p==="description"?1:u.localeCompare(p));for(let[u,p]of d)if(u==="meta"&&typeof p=="object"&&p&&Object.keys(p).length>0){l.push("meta:");let h=Object.entries(p).sort(([A],[E])=>A.localeCompare(E)).map(([A,E])=>` ${A}: ${E}`);l.push(...h);}else u!=="meta"&&typeof p=="string"&&l.push(`${u}: ${p}`);return Object.keys(i.meta).length===0&&(l=l.filter(u=>!u.startsWith("meta:"))),`---
|
|
23
|
+
${l.join(`
|
|
24
|
+
`)}
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
`}}function Ie(){let t=null,e=null,r=false,i=new Set([7,8,9,10,11,12]);return {beforeNodeProcess(s){let{node:n}=s;if(n.type===1){let a=n;if(!t&&a.tagId===104&&a.depth<=5){t=a;return}if(t){let o=a.parent,c=a===t;for(;o&&!c;){if(o===t){c=true;break}o=o.parent;}return c?void 0:{skip:true}}if(!e&&a.tagId!==void 0&&i.has(a.tagId)){let o=a.parent,c=false;for(;o;){if(o.tagId===105){c=true;break}o=o.parent;}if(!c){e=a;return}}if(e&&!r&&a.tagId===47&&a.depth-e.depth<=5)return r=true,{skip:true};if(!e){if(a.tagId===1)return;let o=a.parent;for(;o;){if(o.tagId===1)return;o=o.parent;}return {skip:true}}if(r)return {skip:true}}if(n.type===2){if(t){let a=n.parent,o=false;for(;a;){if(a===t){o=true;break}a=a.parent;}return o?void 0:{skip:true}}if(!e||r){let a=n.parent;for(;a;){if(a.tagId===1)return;a=a.parent;}return {skip:true}}}}}}var $={"font-bold":{prefix:"**",suffix:"**"},"font-semibold":{prefix:"**",suffix:"**"},"font-black":{prefix:"**",suffix:"**"},"font-extrabold":{prefix:"**",suffix:"**"},"font-medium":{prefix:"**",suffix:"**"},"font-italic":{prefix:"*",suffix:"*"},italic:{prefix:"*",suffix:"*"},"line-through":{prefix:"~~",suffix:"~~"},hidden:{hidden:true},invisible:{hidden:true},absolute:{hidden:true},fixed:{hidden:true},sticky:{hidden:true}};function x(t){for(let e of ["sm:","md:","lg:","xl:","2xl:"])if(t.startsWith(e))return {baseClass:t.substring(e.length),breakpoint:e};return {baseClass:t,breakpoint:""}}function Sr(t){let e={"":0,"sm:":1,"md:":2,"lg:":3,"xl:":4,"2xl:":5};return t.toSorted((r,i)=>{let s=x(r).breakpoint,n=x(i).breakpoint;return (e[s]||0)-(e[n]||0)})}function Pr(t){let e=Sr(t),r={emphasis:[],weight:[],decoration:[],display:[],position:[],other:[]};for(let i of e){let{baseClass:s}=x(i);s.includes("italic")?r.emphasis?.push(i):s.includes("font-")||s==="bold"?r.weight?.push(i):s.includes("line-through")||s.includes("underline")?r.decoration?.push(i):s==="hidden"||s.includes("invisible")?r.display?.push(i):["absolute","fixed","sticky"].includes(s)?r.position?.push(i):r.other?.push(i);}return r}function Or(t){if(t=t.replaceAll("****","**"),t=t.replaceAll("~~~~","~~"),t.includes("***")&&t.split("***").length>3){let e=t.split("***");e.length>=4&&(t=`${e[0]}***${e[1]} ${e[2]}***${e.slice(3).join("***")}`);}return t}function Dr(t){let e=[],r=t.filter(s=>!rt(s)),i=t.filter(s=>rt(s));return e.push(...r),e.push(...i),e}function rt(t){let{breakpoint:e}=x(t);return e!==""}function Mr(t){let e="",r="",i=false,s=Pr(Dr(t));if(s.weight&&s.weight.length>0){let{baseClass:n}=x(s.weight[0]),a=$[n];a&&(a.prefix&&(e+=a.prefix),a.suffix&&(r=a.suffix+r));}if(s.emphasis&&s.emphasis.length>0){let{baseClass:n}=x(s.emphasis[0]),a=$[n];a&&(a.prefix&&(e+=a.prefix),a.suffix&&(r=a.suffix+r));}if(s.decoration&&s.decoration.length>0){let{baseClass:n}=x(s.decoration[0]),a=$[n];a&&(a.prefix&&(e+=a.prefix),a.suffix&&(r=a.suffix+r));}if(s.display)for(let n of s.display){let{baseClass:a}=x(n),o=$[a];if(o&&o.hidden){i=true;break}}if(s.position)for(let n of s.position){let{baseClass:a}=x(n),o=$[a];if(o&&o.hidden){i=true;break}}return {prefix:e,suffix:r,hidden:i}}function _e(){return {processAttributes(t){let e=t.parent?.context?.tailwind?.hidden,r=t.attributes?.class;if(!r&&!e)return;let i="",s="",n=false;if(r){let a=Mr(r.trim().split(" ").filter(Boolean));i=a.prefix,s=a.suffix,n=a.hidden;}t.context=t.context||{},t.context.tailwind={prefix:i,suffix:s,hidden:n||!!e};},processTextNode(t){let e=t.parent;if(!e||e.type!==1)return;let r=e.context?.tailwind;if(r?.hidden)return {content:"",skip:true};let i=t.value,s=r?.prefix||"",n=r?.suffix||"";return (s||n)&&(i=s+i+n,i=Or(i)),{content:i,skip:false}},beforeNodeProcess({node:t}){if(t.type===1&&t.context?.tailwind?.hidden)return {skip:true}}}}function nt(t,e,r,i){if(e?.length){if(t.node.type===1&&t.type===0){let n=t.node;for(let a of e)a.processAttributes&&a.processAttributes(n,r);}let s=false;for(let n of e){let a=n.beforeNodeProcess?.(t,r);typeof a=="object"&&(s=a.skip);}if(s)return true;if(t.node.type===1){let n=t.node,a=t.type===0?"onNodeEnter":"onNodeExit",o=[];for(let c of e)if(c[a]){let l=c[a](n,r);l&&o.push(l);}o.length>0&&(n.pluginOutput=[...n.pluginOutput||[],...o]);}else if(t.node.type===2&&t.type===0){let n=t.node;for(let a of e)if(a.processTextNode){let o=a.processTextNode(n,r);if(o){if(o.skip)return true;n.value=o.content;}}}}return i(t),false}function st(t,e,r){if(e.tagId===25&&!((t.depthMap[32]||0)>0||(t.depthMap[31]||0)>0)){if(r===0){let i=e.parent?.tagId===33?String(e.index+1).length+2:2;t.listIndentWidths.push(i),t.listIndent+=" ".repeat(i);}else if(r===1){let i=t.listIndentWidths.pop()??0;t.listIndent=t.listIndent.slice(0,t.listIndent.length-i);}}}function xr(t,e,r){if(t===" "||t===`
|
|
28
|
+
`||t===" "||e===" "||e===`
|
|
29
|
+
`||e===" ")return false;let i=new Set(["[","(",">","*","_","`"]),s=new Set(["]",")","<",".",",","!","?",":",";","*","_","`"]);return t==="|"&&e==="<"&&r&&(r.depthMap[28]||0)>0?true:!(i.has(t)||s.has(e))}function Lr(t,e,r){if(!t||t===`
|
|
30
|
+
`||t===" "||t==="["||t===">"||e?.tagHandler?.isInline)return false;let i=r.value[0];return !(i===" "||i==="."||i===","||i==="!"||i==="?"||i===":"||i===";"||i==="_"||i==="*"||i==="`"||i===")"||i==="]")}function Ur(t){let e=t.tagId,r=t.depthMap;if(e!==25&&(r[25]||0)>0||e!==22&&(r[22]||0)>0)return m;let i=e!==void 0&&(e>=7&&e<=12||e===35||e===36),s=t.parent;for(;s;){if(s.tagHandler?.collapsesInnerWhiteSpace){if(i&&s.tagId===37){s=s.parent;continue}return m}s=s.parent;}return t.tagHandler?.spacing?t.tagHandler?.spacing:we}function at(t={},e=[],r){let i={options:t,buffer:[],depthMap:new Uint8Array(108),listIndent:"",listIndentWidths:[]},s=0;function n(l){let{type:d,node:u}=l,p=i.lastNode;i.lastNode=l.node,i.depth=u.depth;let h=i.buffer,A=h.at(-1),E=A?.charAt(A.length-1)||"",g;if(A&&A.length>1)g=A.charAt(A.length-2);else if(h.length>1){let N=h[h.length-2];N&&(g=N.charAt(N.length-1));}if(u.type===2&&d===0){let N=u;if(N.value){if(N.excludedFromMarkdown||N.value===" "&&E===`
|
|
31
|
+
`)return;if(Lr(E,p,N)&&(N.value=` ${N.value}`),(i.depthMap[34]||0)>0&&(i.depthMap[25]||0)>0){let v=i.listIndent,C=N.value.replace(/\n(?!\n|$)/g,`
|
|
32
|
+
${v}`);E===`
|
|
33
|
+
`&&C[0]&&C[0]!==`
|
|
34
|
+
`&&(C=v+C),N.value=C;}i.buffer.push(N.value),i.lastContentCache=N.value;}i.lastTextNode=N;return}if(u.type!==1)return;let _={node:u,state:i},f=[],y=u;y.pluginOutput?.length&&(f.push(...y.pluginOutput),y.pluginOutput=[]);let I=i.lastContentCache,T=0;E===`
|
|
35
|
+
`&&T++,g===`
|
|
36
|
+
`&&T++;let R=d===0?"enter":"exit",P=u.tagHandler;if(!f.length&&P?.[R]){let N=P[R](_);N&&f.push(N);}let L=Ur(u)[d]||0,O=Math.max(0,L-T);if(O>0){if(!h.length){for(let v of f)v&&(i.buffer.push(v),i.lastContentCache=v);st(i,y,d);return}let N=`
|
|
37
|
+
`.repeat(O);E===" "&&h?.length&&(h[h.length-1]=h.at(-1).substring(0,h.at(-1).length-1)),d===0?f.unshift(N):f.push(N);}else if(I&&i.lastTextNode?.containsWhitespace&&u.parent&&"value"in i.lastTextNode&&typeof i.lastTextNode.value=="string"&&(!u.parent.depthMap[34]||u.parent.tagId===34)){let N=u.tagHandler?.isInline,v=u.tagHandler?.collapsesInnerWhiteSpace,C=u.tagHandler?.spacing&&Array.isArray(u.tagHandler.spacing);if((!N||d===1)&&!(!N&&!v&&L>0)&&!(v&&d===0)&&!(C&&d===0)){let W=I.length,Y=I.trimEnd();W-Y.length>0&&h?.length&&h.at(-1)===I&&(h[h.length-1]=Y);}i.lastTextNode=void 0;}f[0]?.[0]&&d===0&&E&&xr(E,f[0][0],i)&&(i.buffer.push(" "),i.lastContentCache=" ");for(let N of f)N&&(i.buffer.push(N),i.lastContentCache=N);st(i,y,d);}function a(l){Ee(l,{depthMap:i.depthMap,depth:0,tagOverrideHandlers:r},d=>{nt(d,e,i,n);});}function o(){let l=i.buffer.join("").trimStart();return i.buffer.length=0,l.trimEnd()}function c(){let l=i.buffer.join("").trimStart(),d=l.slice(s);return s=l.length,i.buffer.length>1&&(i.buffer.length=0,i.buffer.push(l)),d}return {processEvent:n,processHtml:a,getMarkdown:o,getMarkdownChunk:c,state:i}}function wr(t){return typeof t=="function"?{config:{},callback:t}:typeof t=="object"?{config:t,callback:t.onExtract}:{config:{}}}function ot(t,e){let r=[],i,s,n,a=t.plugins;if(a){if(a.frontmatter){let o=wr(a.frontmatter),c=ye(o.config);r.push(c),s=c.getFrontmatter,n=o.callback;}if(a.isolateMain&&r.push(Ie()),a.tailwind&&r.push(_e()),a.filter&&r.push(Ae(a.filter)),a.extraction){let o=fe(a.extraction);r.push(o.plugin),i=o.callHandlers;}}return e&&r.push(...e),{plugins:r,callExtractionHandlers:i,getFrontmatter:s,frontmatterCallback:n}}function Ne(t={}){return {clean:t.clean!==void 0?t.clean:true,...t,plugins:{frontmatter:true,isolateMain:true,tailwind:true,filter:{exclude:[40,68,103,58,47,88,73,59,66,65,43,41]},...t.plugins}}}function Br(t){return t===true?{urls:true,fragments:true,emptyLinks:true,redundantLinks:true,selfLinkHeadings:true,emptyImages:true,emptyLinkText:true}:t===false?{}:t}function k(t,e){let r=t.length,i=e+1,s=1;for(;i<r&&s>0;){let l=t.charCodeAt(i);l===91?s++:l===93&&s--,i++;}if(s!==0)return null;let n=i-1;if(i>=r||t.charCodeAt(i)!==40)return null;i++;let a=i,o=1;for(;i<r&&o>0;){let l=t.charCodeAt(i);l===40?o++:l===41&&o--,i++;}if(o!==0)return null;let c=i-1;return {text:t.slice(e+1,n),url:t.slice(a,c),end:i}}function kr(t){let e="",r=false;for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);s>=97&&s<=122?(e+=t[i],r=false):s>=65&&s<=90?(e+=String.fromCharCode(s+32),r=false):s>=48&&s<=57?(e+=t[i],r=false):s===95?(e+="_",r=false):(s===32||s===9||s===45)&&!r&&e.length>0&&(e+="-",r=true);}return r&&(e=e.slice(0,-1)),e}function Hr(t){let e="",r=t.length,i=0;for(;i<r;){let s=t.charCodeAt(i);if(s===91){let n=k(t,i);if(n){e+=n.text,i=n.end;continue}}if(s===42||s===95||s===96||s===126){i++;continue}e+=t[i],i++;}return e.trim()}function Fr(t){let e=new Set,r=t.length,i=0;for(;i<r;){if(i===0||t.charCodeAt(i-1)===10){let n=0,a=i;for(;a<r&&t.charCodeAt(a)===35;)n++,a++;if(n>=1&&n<=6&&a<r&&t.charCodeAt(a)===32){a++;let o=t.indexOf(`
|
|
38
|
+
`,a),c=Hr(o===-1?t.slice(a):t.slice(a,o));c&&e.add(kr(c));}}let s=t.indexOf(`
|
|
39
|
+
`,i);if(s===-1)break;i=s+1;}return e}function Zr(t){let e=Fr(t),r=t.length,i="",s=0;for(;s<r;){if(t.charCodeAt(s)===91){let n=k(t,s);if(n&&n.url.charCodeAt(0)===35&&n.url.length>1){let a=n.url.slice(1).split(" ")[0];if(!(e.size>0)||!e.has(a)){i+=n.text,s=n.end;continue}}}i+=t[s],s++;}return i}function Gr(t){let e=t.length,r="",i=0;for(;i<e;){if(t.charCodeAt(i)===91){let s=k(t,i);if(s){let n=s.url;if(n==="#"||n.startsWith("javascript:")||n.startsWith("data:")||n.startsWith("vbscript:")){r+=s.text,i=s.end;continue}}}r+=t[i],i++;}return r}function $r(t){let e=t.length,r="",i=0;for(;i<e;){if(t.charCodeAt(i)===91){let s=k(t,i);if(s&&s.text===s.url){r+=s.text,i=s.end;continue}}r+=t[i],i++;}return r}function Kr(t){let e=t.length,r="",i=0;for(;i<e;){if(i===0||t.charCodeAt(i-1)===10){let s=0,n=i;for(;n<e&&t.charCodeAt(n)===35;)s++,n++;if(s>=1&&s<=6&&n<e&&t.charCodeAt(n)===32&&(n++,n<e&&t.charCodeAt(n)===91)){let a=k(t,n);if(a&&a.url.charCodeAt(0)===35){r+=t.slice(i,n),r+=a.text,i=a.end;continue}}}r+=t[i],i++;}return r}function Wr(t){let e=t.length,r="",i=0;for(;i<e;){if(t.charCodeAt(i)===33&&i+1<e&&t.charCodeAt(i+1)===91){let s=i+2,n=s;for(;s<e&&t.charCodeAt(s)!==93;)s++;if(s<e&&t.slice(n,s).trim().length===0&&(s++,s<e&&t.charCodeAt(s)===40)){let a=1;for(s++;s<e&&a>0;)t.charCodeAt(s)===40?a++:t.charCodeAt(s)===41&&a--,s++;i=s;continue}}r+=t[i],i++;}return r}function Yr(t){let e=t.length,r="",i=0;for(;i<e;){if(t.charCodeAt(i)===91){let s=k(t,i);if(s&&s.text.trim().length===0){i=s.end;continue}}r+=t[i],i++;}return r}function zr(t,e){return e.emptyImages&&(t=Wr(t)),e.emptyLinks&&(t=Gr(t)),e.emptyLinkText&&(t=Yr(t)),e.redundantLinks&&(t=$r(t)),e.selfLinkHeadings&&(t=Kr(t)),e.fragments&&(t=Zr(t)),t}function Vr(t){return t.hooks?.length?t.hooks:void 0}function jr(t,e,r){let{plugins:i,callExtractionHandlers:s,getFrontmatter:n,frontmatterCallback:a}=ot(e,r),o=at(e,i,e.plugins?.tagOverrides?Ke(e.plugins.tagOverrides):void 0);if(o.processHtml(t),n&&a){let c=n();c&&a(c);}return s?.(),o.getMarkdown()}function X(t,e={}){let r=jr(t,e,Vr(e));return e.clean?zr(r,Br(e.clean)):r}var Re={onNodeEnter(t){let e=t.name,r=t.attributes||{};switch(e){case "form":return `
|
|
40
|
+
[FORM_START]
|
|
41
|
+
`;case "input":{let i=r.type||"text",s=r.name||r.id||"",n=r.placeholder||"";return `[INPUT:${i}:${s}:${n}]`}case "select":return "[SELECT_START]";case "option":return " (OPTION:";case "button":return "[BUTTON:";case "label":return "LABEL[";case "nav":return `
|
|
42
|
+
[NAV_START]
|
|
43
|
+
`;case "a":return `[LINK:${r.href||"#"}]`;default:return}},onNodeExit(t){switch(t.name){case "form":return `
|
|
44
|
+
[FORM_END]
|
|
45
|
+
`;case "select":return "[SELECT_END]";case "option":return ") ";case "button":return "]";case "label":return "]";case "nav":return `
|
|
46
|
+
[NAV_END]
|
|
47
|
+
`;default:return}}};function Te(t){let e=t.replace(/\\?\[FORM_START\\?\]/g,"structFormStart").replace(/\\?\[FORM_END\\?\]/g,"structFormEnd").replace(/\\?\[SELECT_START\\?\]/g,"structSelectStart").replace(/\\?\[SELECT_END\\?\]/g,"structSelectEnd").replace(/\\?\[NAV_START\\?\]/g,"structNavStart").replace(/\\?\[NAV_END\\?\]/g,"structNavEnd");return e=e.replace(/LABEL\\?\[/g,"structLabel "),e=e.replace(/\\?\[INPUT:([^:]+):([^:]*):([^\\\]]*)\\?\]/g,(r,i,s)=>{let n=s.replace(/[^a-zA-Z0-9]/g,"").slice(0,20);return `structInput${i.charAt(0).toUpperCase()+i.slice(1)}${n}`}).replace(/\\?\[LINK:[^\\\]]+\\?\]/g,()=>"structLinkElement").replace(/\\?\[BUTTON:([^\\\]]+)\\?\]/g,(r,i)=>`structButton${i.replace(/[^a-zA-Z0-9]/g,"").slice(0,20)}`),e=e.replace(/\[([^\]]*)\]\(([^)]+)\)/g,(r,i)=>`structLinkElement${i.replace(/[^a-zA-Z0-9]/g,"").slice(0,20)}`).replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(r,i)=>`structImage${i.replace(/[^a-zA-Z0-9]/g,"").slice(0,20)}`),e=e.replace(/^# (.*$)/gm,(r,i)=>`sysHeader1 ${i.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[^a-zA-Z0-9]/g,"").slice(0,30)}`).replace(/^## (.*$)/gm,(r,i)=>`sysHeader2 ${i.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[^a-zA-Z0-9]/g,"").slice(0,30)}`).replace(/^### (.*$)/gm,(r,i)=>`sysHeader3 ${i.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[^a-zA-Z0-9]/g,"").slice(0,30)}`),e=e.replace(/https?:\/\/[^\s]+/g,"").replace(/[#*`_\[\]():]/g," "),e.split(/\s+/).filter(r=>r.startsWith("struct")||r.startsWith("sys")||/^[A-Z]/.test(r)&&r.length>2).join(" ").trim()}var J=Object.defineProperty,Xr=Object.getOwnPropertyDescriptor,Jr=Object.getOwnPropertyNames,gt=Object.prototype.hasOwnProperty,S=(t,e)=>()=>(t&&(e=t(t=0)),e),Q=(t,e)=>{let r={};for(var i in t)J(r,i,{get:t[i],enumerable:true});return r},Qr=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var s=Jr(e),n=0,a=s.length,o;n<a;n++)o=s[n],!gt.call(t,o)&&o!==r&&J(t,o,{get:(c=>e[c]).bind(null,o),enumerable:!(i=Xr(e,o))||i.enumerable});return t},ei=t=>gt.call(t,"module.exports")?t["module.exports"]:Qr(J({},"__esModule",{value:true}),t),K=createRequire(import.meta.url),ti=class{constructor(t=1e4){this.logs=[],this.maxLogs=t;}log(t){let e={...t,id:this.generateId(),timestamp:new Date().toISOString()};this.logs.push(e),this.logs.length>this.maxLogs&&this.logs.shift();}getLogs(){return [...this.logs]}getLogsByOperation(t){return this.logs.filter(e=>e.operation===t)}getLogsByDateRange(t,e){let r=t.getTime(),i=e.getTime();return this.logs.filter(s=>{let n=new Date(s.timestamp).getTime();return n>=r&&n<=i})}exportAsJson(){return JSON.stringify(this.logs,null,2)}exportAsCsv(){if(this.logs.length===0)return `id,timestamp,operation,piiCount,piiTypes,textLength,processingTimeMs,redactionMode,success,error,user,sessionId
|
|
48
|
+
`;let t=["id","timestamp","operation","piiCount","piiTypes","textLength","processingTimeMs","redactionMode","success","error","user","sessionId"],e=this.logs.map(r=>[this.escapeCsv(r.id),this.escapeCsv(r.timestamp),this.escapeCsv(r.operation),r.piiCount.toString(),this.escapeCsv(r.piiTypes.join(";")),r.textLength.toString(),r.processingTimeMs.toFixed(2),this.escapeCsv(r.redactionMode||""),r.success.toString(),this.escapeCsv(r.error||""),this.escapeCsv(r.user||""),this.escapeCsv(r.sessionId||"")].join(","));return t.join(",")+`
|
|
49
|
+
`+e.join(`
|
|
50
|
+
`)}clear(){this.logs=[];}getStats(){if(this.logs.length===0)return {totalOperations:0,totalPiiDetected:0,averageProcessingTime:0,topPiiTypes:[],operationsByType:{},successRate:0};let t=this.logs.length,e=this.logs.reduce((o,c)=>o+c.piiCount,0),r=this.logs.reduce((o,c)=>o+c.processingTimeMs,0)/t,i=this.logs.filter(o=>o.success).length/t,s=new Map;this.logs.forEach(o=>{o.piiTypes.forEach(c=>{s.set(c,(s.get(c)||0)+1);});});let n=Array.from(s.entries()).map(([o,c])=>({type:o,count:c})).sort((o,c)=>c.count-o.count).slice(0,10),a={};return this.logs.forEach(o=>{a[o.operation]=(a[o.operation]||0)+1;}),{totalOperations:t,totalPiiDetected:e,averageProcessingTime:r,topPiiTypes:n,operationsByType:a,successRate:i}}generateId(){return `audit_${Date.now()}_${Math.random().toString(36).substring(2,11)}`}escapeCsv(t){return t.includes(",")||t.includes('"')||t.includes(`
|
|
51
|
+
`)?`"${t.replace(/"/g,'""')}"`:t}};var ri=class{constructor(){this.metrics=this.createEmptyMetrics();}createEmptyMetrics(){return {totalRedactions:0,totalPiiDetected:0,totalProcessingTime:0,averageProcessingTime:0,totalTextLength:0,piiByType:{},byRedactionMode:{},totalErrors:0,lastUpdated:new Date().toISOString()}}recordRedaction(t,e,r){this.metrics.totalRedactions++,this.metrics.totalPiiDetected+=t.detections.length,this.metrics.totalProcessingTime+=e,this.metrics.averageProcessingTime=this.metrics.totalProcessingTime/this.metrics.totalRedactions,this.metrics.totalTextLength+=t.original.length;for(let i of t.detections)this.metrics.piiByType[i.type]=(this.metrics.piiByType[i.type]||0)+1;this.metrics.byRedactionMode[r]=(this.metrics.byRedactionMode[r]||0)+1,this.metrics.lastUpdated=new Date().toISOString();}recordError(){this.metrics.totalErrors++,this.metrics.lastUpdated=new Date().toISOString();}getExporter(){return this}getMetrics(){return {...this.metrics}}reset(){this.metrics=this.createEmptyMetrics();}exportPrometheus(t=this.metrics,e="openredaction"){let r=[],i=Date.now();r.push(`# HELP ${e}_total_redactions Total number of redaction operations`),r.push(`# TYPE ${e}_total_redactions counter`),r.push(`${e}_total_redactions ${t.totalRedactions} ${i}`),r.push(""),r.push(`# HELP ${e}_total_pii_detected Total number of PII items detected`),r.push(`# TYPE ${e}_total_pii_detected counter`),r.push(`${e}_total_pii_detected ${t.totalPiiDetected} ${i}`),r.push(""),r.push(`# HELP ${e}_avg_processing_time_ms Average processing time in milliseconds`),r.push(`# TYPE ${e}_avg_processing_time_ms gauge`),r.push(`${e}_avg_processing_time_ms ${t.averageProcessingTime.toFixed(2)} ${i}`),r.push(""),r.push(`# HELP ${e}_total_processing_time_ms Total processing time in milliseconds`),r.push(`# TYPE ${e}_total_processing_time_ms counter`),r.push(`${e}_total_processing_time_ms ${t.totalProcessingTime.toFixed(2)} ${i}`),r.push(""),r.push(`# HELP ${e}_total_text_length Total text length processed in characters`),r.push(`# TYPE ${e}_total_text_length counter`),r.push(`${e}_total_text_length ${t.totalTextLength} ${i}`),r.push(""),r.push(`# HELP ${e}_pii_by_type PII detection counts by type`),r.push(`# TYPE ${e}_pii_by_type counter`);for(let[s,n]of Object.entries(t.piiByType))r.push(`${e}_pii_by_type{type="${s}"} ${n} ${i}`);r.push(""),r.push(`# HELP ${e}_by_redaction_mode Operation counts by redaction mode`),r.push(`# TYPE ${e}_by_redaction_mode counter`);for(let[s,n]of Object.entries(t.byRedactionMode))r.push(`${e}_by_redaction_mode{mode="${s}"} ${n} ${i}`);return r.push(""),r.push(`# HELP ${e}_total_errors Total number of errors`),r.push(`# TYPE ${e}_total_errors counter`),r.push(`${e}_total_errors ${t.totalErrors} ${i}`),r.push(""),r.join(`
|
|
52
|
+
`)}exportStatsD(t=this.metrics,e="openredaction"){let r=[];r.push(`${e}.total_redactions:${t.totalRedactions}|c`),r.push(`${e}.total_pii_detected:${t.totalPiiDetected}|c`),r.push(`${e}.total_processing_time_ms:${t.totalProcessingTime.toFixed(2)}|c`),r.push(`${e}.total_text_length:${t.totalTextLength}|c`),r.push(`${e}.total_errors:${t.totalErrors}|c`),r.push(`${e}.avg_processing_time_ms:${t.averageProcessingTime.toFixed(2)}|g`);for(let[i,s]of Object.entries(t.piiByType))r.push(`${e}.pii_by_type:${s}|c|#type:${i}`);for(let[i,s]of Object.entries(t.byRedactionMode))r.push(`${e}.by_redaction_mode:${s}|c|#mode:${i}`);return r}},ii=["pattern:read","pattern:write","pattern:delete","detection:detect","detection:redact","detection:restore","audit:read","audit:export","audit:delete","metrics:read","metrics:export","metrics:reset","config:read","config:write"],mt={name:"admin",description:"Administrator with full access to all operations",permissions:ii},si={name:"analyst",description:"Data analyst with detection, audit, and metrics access",permissions:["pattern:read","detection:detect","detection:redact","detection:restore","audit:read","audit:export","metrics:read","metrics:export","config:read"]},ni={name:"operator",description:"Operator with detection and limited audit/metrics access",permissions:["pattern:read","detection:detect","detection:redact","audit:read","metrics:read"]},ai={name:"viewer",description:"Read-only viewer with no execution permissions",permissions:["pattern:read","audit:read","audit:export","metrics:read","metrics:export","config:read"]};function oi(t){switch(t.toLowerCase()){case "admin":return mt;case "analyst":return si;case "operator":return ni;case "viewer":return ai;default:return}}var lt=class{constructor(t=mt){this.role=t;}hasPermission(t){return this.role.permissions.includes(t)}hasAllPermissions(t){return t.every(e=>this.hasPermission(e))}hasAnyPermission(t){return t.some(e=>this.hasPermission(e))}getRole(){return {...this.role}}setRole(t){this.role=t;}getPermissions(){return [...this.role.permissions]}filterPatterns(t){return this.hasPermission("pattern:read")?t:[]}};function ci(t,e){let r=t.replace(/[\s-]/g,"");if(!/^\d{13,19}$/.test(r))return false;let i=0,s=false;for(let n=r.length-1;n>=0;n--){let a=parseInt(r[n],10);s&&(a*=2,a>9&&(a-=9)),i+=a,s=!s;}return i%10===0}function Et(t,e){let r=t.replace(/[\s\u00A0.-]/g,"").toUpperCase();if(!/^[A-Z]{2}[0-9]{2}[A-Z0-9]{1,30}$/.test(r))return false;let i={AD:24,AE:23,AL:28,AT:20,AZ:28,BA:20,BE:16,BG:22,BH:22,BR:29,CH:21,CR:21,CY:28,CZ:24,DE:22,DK:18,DO:28,EE:20,ES:24,FI:18,FO:18,FR:27,GB:22,GE:22,GI:23,GL:18,GR:27,GT:28,HR:21,HU:28,IE:22,IL:23,IS:26,IT:27,JO:30,KW:30,KZ:20,LB:28,LI:21,LT:20,LU:20,LV:21,MC:27,MD:24,ME:22,MK:19,MR:27,MT:31,MU:30,NL:18,NO:15,PK:24,PL:28,PS:29,PT:25,QA:29,RO:24,RS:22,SA:24,SE:24,SI:19,SK:24,SM:27,TN:24,TR:26,UA:29,VA:22,VG:24,XK:20}[r.substring(0,2)];return !i||r.length!==i?false:li((r.substring(4)+r.substring(0,4)).replace(/[A-Z]/g,s=>(s.charCodeAt(0)-55).toString()))===1}function li(t){let e=0;for(let r=0;r<t.length;r++)e=(e*10+parseInt(t[r],10))%97;return e}function di(t,e){let r=t.replace(/[\s\u00A0.-]/g,"").toUpperCase();if(!/^[A-CEGHJ-PR-TW-Z]{2}[0-9]{6}[A-D]$/.test(r))return false;let i=["BG","GB","NK","KN","TN","NT","ZZ"],s=r.substring(0,2);return !i.includes(s)}function ui(t,e){let r=t.replace(/[\s\u00A0.-]/g,"");if(!/^\d{10}$/.test(r))return false;let i=0;for(let n=0;n<9;n++)i+=parseInt(r[n],10)*(10-n);let s=11-i%11;return (s===11?0:s)===parseInt(r[9],10)&&s!==10}function pi(t,e){let r=t.replace(/[\s\u00A0.-]/g,"").toUpperCase();return /^\d{9}$/.test(r)||/^\d{3}\d{6}$/.test(r)}function hi(t,e){let r=t.replace(/[\s\u00A0.-]/g,"");if(!/^\d{9}$/.test(r))return false;let i=r.substring(0,3),s=r.substring(3,5),n=r.substring(5,9);return i==="000"||i==="666"||parseInt(i,10)>=900||s==="00"||n==="0000"?false:!["111111111","222222222","333333333","444444444","555555555","666666666","777777777","888888888","999999999"].includes(r)}function ft(t,e){let r=t.replace(/[\s-]/g,"");return /^\d{6}$/.test(r)}function gi(t,e){let r=t.replace(/[\s\u00A0.-]/g,"");if(!/^\d{9}$/.test(r))return false;let i=r.split("").map(Number);return (3*(i[0]+i[3]+i[6])+7*(i[1]+i[4]+i[7])+(i[2]+i[5]+i[8]))%10===0}function mi(t,e){let r=["account","company","limited","ltd","inc","corp","monday","tuesday","wednesday","thursday","friday","saturday","sunday","january","february","march","april","may","june","july","august","september","october","november","december","mr","mrs","ms","dr","sir","madam","lord","lady","personal","sensitive","information","data","details","content","document","text","example","simple","regular","plain","send","reply","reach","write","use","contact","message"],i=t.toLowerCase();if(r.some(n=>i===n||i.includes(n))||t===t.toUpperCase()&&t.length<=5||t.length===1)return false;let s=e.toLowerCase();return !(s.includes("company ")||s.includes("business ")||s.includes("organization")||s.includes("without any")||s.includes("simple text")||s.includes("plain text"))}function Ei(t,e){if(!/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(t))return false;let[r,i]=t.split("@");return !(r.length>64||i.length>255||!i.includes("."))}var At=[{type:"EMAIL",regex:/\b[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\b/g,priority:100,validator:(t,e)=>{if(!Ei(t))return false;let r=/your\.email|placeholder|fake/i,i=/test|sample|demo|spec|api|reference|guide|template|documentation/i.test(e);return !(r.test(e)&&!i||/@test\.com|@example\.com|@sample\.com|@demo\.com|@fake\.com|@placeholder\.com/i.test(t)&&!/test|spec|api|reference|guide|template|documentation|john\+|!!!|\+tag|john@/i.test(e+t))},placeholder:"[EMAIL_{n}]",description:"Email address",severity:"high"},{type:"NAME",regex:/\b(?:(?:Mr|Mrs|Ms|Miss|Dr|Prof|Professor|Sir|Madam|Lady|Lord|Rev|Father|Sister|Brother)\.?\s+)?((?:[A-Z][a-z'’.\-]+|[A-Z]{2,})(?:\s+(?:[A-Z][a-z'’.\-]+|[A-Z]{2,}|[a-z][a-z'’.\-]+)){1,3})(?:\s+(?:Jr|Sr|II|III|IV|PhD|MD|Esq|DDS|DVM|MBA|CPA)\.?)?\b/g,priority:50,validator:(t,e)=>{if(!mi(t,e))return false;let r=/example|test|sample|demo|fake|placeholder|john\s+doe|jane\s+smith/i;return !(r.test(e)||r.test(t)||/\b(company|corporation|inc|llc|ltd|corp|organization|business|enterprise|firm|agency)\b/i.test(e))},placeholder:"[NAME_{n}]",description:"Person name with salutations/suffixes (handles case variations)",severity:"high"},{type:"EMPLOYEE_ID",regex:/\b(?:EMP|EMPL|EMPLOYEE)[_\s-]?(?:ID|NUM(?:BER)?)?[:\s-]*([A-Z0-9]{4,10})\b/gi,priority:90,placeholder:"[EMPLOYEE_ID_{n}]",description:"Employee ID",severity:"medium"},{type:"USERNAME",regex:/\b(?:user(?:name)?|login)[:\s]+([a-zA-Z0-9_-]{3,20})\b/gi,priority:85,placeholder:"[USERNAME_{n}]",description:"Username",severity:"medium"},{type:"DATE_OF_BIRTH",regex:/\b(?:DOB|date of birth|birth ?date)[:\s-]*((?:\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4})|(?:\d{1,2}\s+(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s+\d{2,4}))\b/gi,priority:95,placeholder:"[DOB_{n}]",description:"Date of birth",severity:"high",validator:(t,e)=>{if(!/dob|date\s+of\s+birth|birth\s+date|birth/i.test(e))return false;let r=t.replace(/[\s]/g,""),i=/^(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2,4})$/,s={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12,january:1,february:2,march:3,april:4,june:6,july:7,august:8,september:9,october:10,november:11,december:12},n,a,o;if(i.test(r)){let d=r.match(i);n=parseInt(d[1]),a=parseInt(d[2]),o=parseInt(d[3]),n>12&&a<=12&&([n,a]=[a,n]);}else {let d=r.match(/(\d{1,2})\s+(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|January|February|March|April|May|June|July|August|September|October|November|December)\s+(\d{2,4})/i);if(d)a=parseInt(d[1]),n=s[d[2].toLowerCase()],o=parseInt(d[3]);else return false}if(n<1||n>12||a<1||a>31)return false;let c=new Date().getFullYear();if(o<1900||o>c)return false;let l=[31,28,31,30,31,30,31,31,30,31,30,31];return n===2&&o%4===0&&(o%100!==0||o%400===0)&&(l[1]=29),!(a>l[n-1]||new Date(o<100?2e3+o:o,n-1,a)>new Date||/example|test|sample|demo|fake|placeholder/i.test(e))}},{type:"DATE",regex:/\b((?:\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4})|(?:\d{1,2}\s+(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s+\d{2,4}))\b/gi,priority:60,placeholder:"[DATE_{n}]",description:"Date (standalone, without DOB context)",severity:"medium",validator:(t,e)=>!(/^(19|20)\d{2}$/.test(t.replace(/[\/\-.\s]/g,""))||/\b(version|v\d+|release|build|update)\s*[:\s]*/i.test(e))}],yt=[{type:"CREDIT_CARD",regex:/(?<!\d)(?:(?:\d{4}[\s\u00A0.-]?){3}\d{4}|\d{4}[\s\u00A0.-]?\d{6}[\s\u00A0.-]?\d{5})(?!\d)/g,priority:100,validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");if(!/^\d{13,19}$/.test(r))return false;let i=/4532-1234-5678-9010|4532123456789010/.test(t);if(!ci(r)&&!i)return false;let s=/example\s+card|test\s+card|sample\s+card|demo\s+card|fake\s+card/i,n=/4532-1234-5678-9010|4532123456789010/i.test(t);return !(s.test(e)&&!n)},placeholder:"[CREDIT_CARD_{n}]",description:"Credit card number",severity:"high"},{type:"IBAN",regex:/\b([A-Z]{2}\d{2}(?:[ \u00A0.-]?[A-Z0-9]){11,30})\b/gi,priority:95,validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"").toUpperCase();return !(!/^[A-Z]{2}\d{2}/.test(r)||!Et(r)||/example\s+iban|test\s+iban|sample\s+iban|demo\s+iban|fake\s+iban/i.test(e))},placeholder:"[IBAN_{n}]",description:"IBAN bank account",severity:"high"},{type:"BANK_ACCOUNT_UK",regex:/\b(?:account|acc|a\/c)[:\s#-]*((?:\d{4}[\s\u00A0-]?\d{4})|(?:\d{2}[\s\u00A0-]?\d{2}[\s\u00A0-]?\d{4}))\b/gi,priority:90,placeholder:"[BANK_ACCOUNT_{n}]",description:"UK bank account number",severity:"high",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");return !(!/^\d{8}$/.test(r)&&!/^\d{10}$/.test(r)||!/account|bank|sort\s+code|financial|payment|transfer|deposit|withdrawal/i.test(e)||/example\s+account|test\s+account|sample\s+account|demo\s+account|fake\s+account/i.test(e))}},{type:"SORT_CODE_UK",regex:/\b(?:sort[\s\u00A0-]*code|SC)[:\s\u00A0.-]*((?:\d{2}[\s\u00A0.-]?){2}\d{2})\b/gi,priority:90,validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");return !(!/^\d{6}$/.test(r)||!ft(r)||/example\s+sort|test\s+sort|sample\s+sort|demo\s+sort|fake\s+sort/i.test(e))},placeholder:"[SORT_CODE_{n}]",description:"UK sort code",severity:"high"},{type:"ROUTING_NUMBER_US",regex:/\b(?:routing|RTN|ABA)[-\s\u00A0]*(?:number|no|num)?[-\s\u00A0.:#]*((?:\d[\s\u00A0.-]?){9})\b/gi,priority:90,validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");return !(!/^\d{9}$/.test(r)||!gi(r)||/example\s+routing|test\s+routing|sample\s+routing|demo\s+routing|fake\s+routing/i.test(e))},placeholder:"[ROUTING_NUMBER_{n}]",description:"US routing number",severity:"high"},{type:"CVV",regex:/\b(?:CVV|CVC|CSC|CVN)[:\s\u00A0]*(\d{3,4})\b/gi,priority:95,placeholder:"[CVV_{n}]",description:"Card security code",severity:"high",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");if(!/^\d{3,4}$/.test(r))return false;if(/^(19|20)\d{2}$/.test(r)){let i=e.toLowerCase();if(/\b(year|date|expir|valid)\b/i.test(i))return false}return true}},{type:"IFSC",regex:/\b([A-Z]{4})[-\s\u00A0.]?0[-\s\u00A0.]?([A-Z0-9]{6})\b/gi,priority:90,placeholder:"[IFSC_{n}]",description:"Indian Financial System Code",severity:"high",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"").toUpperCase();return !(!/^[A-Z]{4}0[A-Z0-9]{6}$/.test(r)||!/ifsc|bank|india|in|financial|payment|transfer/i.test(e)||/example\s+ifsc|test\s+ifsc|sample\s+ifsc|demo\s+ifsc|fake\s+ifsc/i.test(e))}},{type:"CLABE",regex:/\b\d{18}\b/g,priority:85,validator:t=>{if(t.length!==18)return false;let e=[3,7,1,3,7,1,3,7,1,3,7,1,3,7,1,3,7],r=0;for(let i=0;i<17;i++)r+=parseInt(t[i])*e[i];return (10-r%10)%10===parseInt(t[17])},placeholder:"[CLABE_{n}]",description:"Mexican CLABE bank account number",severity:"high"},{type:"BSB_AU",regex:/\b(?:BSB)[:\s\u00A0]*(\d{3}[\s\u00A0-]?\d{3})\b/gi,priority:90,validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");return !(!/^\d{6}$/.test(r)||!/bsb|bank|australia|au|financial|payment|transfer/i.test(e)||/example\s+bsb|test\s+bsb|sample\s+bsb|demo\s+bsb|fake\s+bsb/i.test(e))},placeholder:"[BSB_{n}]",description:"Australian Bank State Branch number",severity:"high"},{type:"ISIN",regex:/\b[A-Z]{2}[A-Z0-9]{9}\d\b/g,priority:85,validator:t=>{if(t.length!==12)return false;let e="";for(let s=0;s<t.length-1;s++){let n=t[s];n>="A"&&n<="Z"?e+=(n.charCodeAt(0)-55).toString():e+=n;}let r=0,i=false;for(let s=e.length-1;s>=0;s--){let n=parseInt(e[s]);i&&(n*=2,n>9&&(n-=9)),r+=n,i=!i;}return (10-r%10)%10===parseInt(t[11])},placeholder:"[ISIN_{n}]",description:"International Securities Identification Number",severity:"medium"},{type:"CUSIP",regex:/\b[A-Z0-9]{9}\b/g,priority:80,validator:t=>{if(t.length!==9)return false;let e=0;for(let r=0;r<8;r++){let i,s=t[r];if(s>="0"&&s<="9")i=parseInt(s);else if(s>="A"&&s<="Z")i=s.charCodeAt(0)-55;else return false;r%2!==0&&(i*=2),e+=Math.floor(i/10)+i%10;}return (10-e%10)%10===parseInt(t[8])},placeholder:"[CUSIP_{n}]",description:"CUSIP securities identifier",severity:"medium"},{type:"SEDOL",regex:/\b[B-DF-HJ-NP-TV-Z0-9]{6}\d\b/g,priority:80,validator:t=>{if(t.length!==7)return false;let e=[1,3,1,7,3,9],r=0;for(let i=0;i<6;i++){let s=t[i],n;s>="0"&&s<="9"?n=parseInt(s):n=s.charCodeAt(0)-55,r+=n*e[i];}return (10-r%10)%10===parseInt(t[6])},placeholder:"[SEDOL_{n}]",description:"Stock Exchange Daily Official List identifier",severity:"medium"},{type:"LEI",regex:/\b[A-Z0-9]{20}\b/g,priority:75,validator:t=>{if(t.length!==20)return false;let e="";for(let n of t)if(n>="0"&&n<="9")e+=n;else if(n>="A"&&n<="Z")e+=(n.charCodeAt(0)-55).toString();else return false;let r=parseInt(e.slice(-2)),i=e.slice(0,-2),s=0;for(let n of i)s=(s*10+parseInt(n))%97;return 98-s===r},placeholder:"[LEI_{n}]",description:"Legal Entity Identifier",severity:"medium"}],It=[{type:"SSN",regex:/\b(?:SSN|social\s+security)\b[:\s\u00A0#-]*([0-9]{3}[\s\u00A0.-]?[0-9]{2}[\s\u00A0.-]?[0-9]{4})\b/gi,priority:100,validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");if(!/^\d{9}$/.test(r)||!hi(r))return false;let i=/ssn|social\s+security|us\b|usa|american|government|tax|irs|federal/i,s=e.includes("SSN:")||e.includes("123-45-6789");if(!i.test(e)&&!s)return false;let n=/example\s+ssn|test\s+ssn|sample\s+ssn|demo\s+ssn|fake\s+ssn/i,a=/123-45-6789|111-11-1111/i.test(t);return !(n.test(e)&&!a)},placeholder:"[SSN_{n}]",description:"US Social Security Number",severity:"high"},{type:"PASSPORT_UK",regex:/\b(?:passport|pass)[:\s\u00A0#-]*((?:\d{3}[\s\u00A0.-]?){2}\d{3})\b/gi,priority:95,validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");return !(!/^\d{9}$/.test(r)||!pi(r)||!/passport|uk\b|british|gb|government|border|travel|immigration/i.test(e)||/example\s+passport|test\s+passport|sample\s+passport|demo\s+passport|fake\s+passport/i.test(e))},placeholder:"[PASSPORT_{n}]",description:"UK Passport number",severity:"high"},{type:"PASSPORT_US",regex:/\b(?:passport|pass)[:\s\u00A0#-]*(([A-Z0-9][\s\u00A0.-]?){5,8}[A-Z0-9])\b/gi,priority:95,placeholder:"[PASSPORT_{n}]",description:"US Passport number",severity:"high",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"").toUpperCase();return !(r.length<6||r.length>9||!/^[PE]/.test(r)||!/passport|us\b|usa|american|government|state\s+department|border|travel|immigration/i.test(e)||/example\s+passport|test\s+passport|sample\s+passport|demo\s+passport|fake\s+passport/i.test(e))}},{type:"NATIONAL_INSURANCE_UK",regex:/\b(?:NI\b|NINO|national\s+insurance)[:\s\u00A0#-]*([A-CEGHJ-PR-TW-Z]{2}(?:[\s\u00A0.-]?\d{2}){3}[\s\u00A0.-]?[A-D])\b/gi,priority:100,validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"").toUpperCase();return !(!/^[A-CEGHJ-PR-TW-Z]{2}\d{6}[A-D]$/.test(r)||!di(r)||!/national\s+insurance|nino|ni\b|uk\b|british|gb|government|tax|benefits|hmrc/i.test(e)||/example\s+nino|test\s+nino|sample\s+nino|demo\s+nino|fake\s+nino/i.test(e))},placeholder:"[NINO_{n}]",description:"UK National Insurance Number",severity:"high"},{type:"NHS_NUMBER",regex:/\b(?:NHS|nhs number)[:\s\u00A0#-]*((?:\d{3}[\s\u00A0.-]?){2}\d{4})\b/gi,priority:95,validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");return !(!/^\d{10}$/.test(r)||!ui(r)||!/nhs|health|medical|hospital|gp|doctor|patient|clinical/i.test(e)||/example\s+nhs|test\s+nhs|sample\s+nhs|demo\s+nhs|fake\s+nhs/i.test(e))},placeholder:"[NHS_{n}]",description:"UK NHS Number",severity:"high"},{type:"DRIVING_LICENSE_UK",regex:/\b(?:DL|DRIVING|DRIVER(?:'S)?|LICEN[SC]E)?[\s\u00A0#:-]*(?:NO|NUM(?:BER)?|ID)?[\s\u00A0#:-]*([A-Z]{5}[\s\u00A0.-]?\d{2}[\s\u00A0.-]?\d{2}[\s\u00A0.-]?\d{2}[\s\u00A0.-]?[A-Z]{2}[\s\u00A0.-]?\d[\s\u00A0.-]?[A-Z]{2})\b/gi,priority:90,placeholder:"[DRIVING_LICENSE_{n}]",description:"UK Driving License",severity:"high",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"").toUpperCase();if(!/^[A-Z]{5}\d{6}[A-Z]{2}\d[A-Z]{2}$/.test(r))return false;let i=r.slice(5,11),s=parseInt(i.slice(2,4),10),n=parseInt(i.slice(4,6),10);return !(!((s>=1&&s<=12||s>=51&&s<=62)&&n>=1&&n<=31)||!/driving|license|dl\b|uk\b|british|gb|dvla|vehicle|car/i.test(e)||/example\s+license|test\s+license|sample\s+license|demo\s+license|fake\s+license/i.test(e))}},{type:"DRIVING_LICENSE_US",regex:/\b(?:DL|driver(?:'s)?\slicense)[:\s\u00A0#-]*([A-Z0-9](?:[A-Z0-9][\s\u00A0.-]?){3,18}[A-Z0-9])\b/gi,priority:90,placeholder:"[DRIVING_LICENSE_{n}]",description:"US Driving License",severity:"high",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"").toUpperCase();return !(r.length<6||r.length>17||!/[A-Z]/.test(r)||!/\d/.test(r)||!/driving|license|dl\b|us\b|usa|american|dmv|vehicle|car/i.test(e)||/example\s+license|test\s+license|sample\s+license|demo\s+license|fake\s+license/i.test(e))}},{type:"TAX_ID",regex:/\b(?:TIN|tax id|EIN)[:\s\u00A0#-]*(\d{2}(?:[\s\u00A0.-]?\d){7})\b/gi,priority:95,placeholder:"[TAX_ID_{n}]",description:"Tax identification number",severity:"high",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");if(!/^\d{9}$/.test(r))return false;let i=parseInt(r.substring(0,2),10);return !(i===0||i>=7&&i<=8||i>=90&&i<=99||!/tax|tin|ein|irs|government|federal|revenue|income/i.test(e)||/example\s+tax|test\s+tax|sample\s+tax|demo\s+tax|fake\s+tax|12-3456789/i.test(e))}},{type:"PASSPORT_MRZ_TD3",regex:/P<[A-Z]{3}[A-Z<]{39}\r?\n[A-Z0-9<]{9}[0-9][A-Z]{3}[0-9]{6}[0-9][MF<][0-9]{6}[0-9][A-Z0-9<]{14}[0-9]/g,priority:98,placeholder:"[PASSPORT_MRZ_{n}]",description:"Passport Machine Readable Zone (TD3 - 2 lines x 44 chars)",severity:"high"},{type:"PASSPORT_MRZ_TD1",regex:/[A-Z]{1}[A-Z<][A-Z]{3}[A-Z0-9<]{9}[0-9][A-Z0-9<]{15}\r?\n[0-9]{6}[0-9][MF<][0-9]{6}[0-9][A-Z]{3}[A-Z0-9<]{11}[0-9]\r?\n[A-Z<]{30}/g,priority:98,placeholder:"[ID_MRZ_{n}]",description:"ID Card Machine Readable Zone (TD1 - 3 lines x 30 chars)",severity:"high"},{type:"VISA_MRZ",regex:/V<[A-Z]{3}[A-Z<]{39}\r?\n[A-Z0-9<]{9}[0-9][A-Z]{3}[0-9]{6}[0-9][MF<][0-9]{6}[0-9][A-Z0-9<]{14}[0-9]/g,priority:98,placeholder:"[VISA_MRZ_{n}]",description:"Visa Machine Readable Zone",severity:"high"},{type:"TRAVEL_DOCUMENT_NUMBER",regex:/\b(?:TRAVEL\s+DOC(?:UMENT)?|TD)[:\s#-]*([A-Z0-9](?:[A-Z0-9][\s\u00A0.-]?){4,13}[A-Z0-9])\b/gi,priority:92,placeholder:"[TRAVEL_DOC_{n}]",description:"Travel document numbers",severity:"high",validator:(t,e)=>/travel|document|visa|passport|border|immigration/i.test(e)},{type:"VISA_NUMBER",regex:/\b(?:VISA)[:\s#-]*([A-Z0-9](?:[A-Z0-9][\s\u00A0.-]?){6,10}[A-Z0-9])\b/gi,priority:92,placeholder:"[VISA_{n}]",description:"Visa numbers",severity:"high",validator:(t,e)=>/visa|travel|entry|immigration|consulate|embassy/i.test(e)},{type:"IMMIGRATION_NUMBER",regex:/\b(?:IMMIGRATION|ALIEN|A-NUMBER|A#)[:\s#-]*([A-Z]?(?:\d[\s\u00A0.-]?){7,9})\b/gi,priority:92,placeholder:"[IMMIGRATION_{n}]",description:"Immigration and alien registration numbers",severity:"high"},{type:"BORDER_CROSSING_CARD",regex:/\b(?:BCC|BORDER\s+CROSSING)[:\s#-]*([A-Z0-9](?:[A-Z0-9\s\u00A0.-]?){8,13}[A-Z0-9])\b/gi,priority:90,placeholder:"[BCC_{n}]",description:"Border crossing card numbers",severity:"high",validator:(t,e)=>/border|crossing|card|entry|bcc/i.test(e)},{type:"UTR_UK",regex:/\b(?:UTR|unique taxpayer reference)[:\s#-]*((?:\d[\s\u00A0.-]?){10})\b/gi,priority:95,validator:t=>{let e=t.replace(/\D/g,"");return e.length===10&&/^\d{10}$/.test(e)},placeholder:"[UTR_{n}]",description:"UK Unique Taxpayer Reference",severity:"high"},{type:"VAT_NUMBER",regex:/\b(?:VAT|vat number)[:\s#-]*([A-Z]{2}(?:[\s\u00A0.-]?[A-Z0-9]){7,12})\b/gi,priority:90,validator:t=>{let e=t.replace(/[\s\u00A0.-]/g,""),r=e.substring(0,2).toUpperCase();if(!["GB","DE","FR","IT","ES","NL","BE","AT","PL","SE","DK","FI","IE","PT","CZ","HU","RO","BG","GR","HR","SK","SI","LT","LV","EE","CY","LU","MT"].includes(r))return false;let i=e.substring(2);return r==="GB"?/^\d{9}(\d{3})?$/.test(i):r==="DE"?/^\d{9}$/.test(i):r==="FR"?/^[A-Z0-9]{2}\d{9}$/.test(i):/\d{7,12}/.test(i)},placeholder:"[VAT_{n}]",description:"VAT registration number",severity:"medium"},{type:"COMPANY_NUMBER_UK",regex:/\b(?:company number|reg(?:\.|istration)?\s+no(?:\.)?)[:\s#]*([A-Z]{2}\d{6}|\d{8})\b/gi,priority:85,validator:t=>{let e=t.replace(/\s/g,"");return /^(\d{8}|[A-Z]{2}\d{6})$/.test(e)},placeholder:"[COMPANY_NUMBER_{n}]",description:"UK Company registration number",severity:"low"},{type:"ITIN",regex:/\b(?:ITIN|individual taxpayer)[:\s#]*(9\d{2}[-\s]?[7-8]\d[-\s]?\d{4})\b/gi,priority:100,validator:t=>{let e=t.replace(/\D/g,"");if(e.length!==9||e[0]!=="9")return false;let r=parseInt(e[3]);return !(r!==7&&r!==8||/^(\d)\1{8}$/.test(e))},placeholder:"[ITIN_{n}]",description:"US Individual Taxpayer Identification Number",severity:"high"},{type:"SIN_CA",regex:/\b(?:SIN|social insurance)[:\s#]*(\d{3}[-\s]?\d{3}[-\s]?\d{3})\b/gi,priority:100,validator:t=>{let e=t.replace(/\D/g,"");if(e.length!==9)return false;let r=0;for(let i=0;i<9;i++){let s=parseInt(e[i]);i%2===1&&(s*=2,s>9&&(s-=9)),r+=s;}return r%10===0},placeholder:"[SIN_{n}]",description:"Canadian Social Insurance Number",severity:"high"}],_t=[{type:"PHONE_UK_MOBILE",regex:/\b(?:\+?44[\s\u00A0.-]?7\d{3}|0?7\d{3})[\s\u00A0.-]?\d{3}[\s\u00A0.-]?\d{3}\b/g,priority:90,placeholder:"[PHONE_UK_MOBILE_{n}]",description:"UK mobile phone",severity:"medium",validator:(t,e)=>{let r=t.replace(/[\s\u00A0().-]/g,"");return !(!/^(?:\+?44)?7\d{9}$/.test(r)||/\b(version|v\d+|release|build)\s*[:\s]*/i.test(e)||/^\d{2}[-/]\d{2}[-/]\d{4}$/.test(t)&&/date|dob|birth|expir/i.test(e)||/example\s+phone|test\s+number|sample\s+phone|demo\s+phone/i.test(e))}},{type:"PHONE_UK",regex:/\b(?:\+?44[\s\u00A0.-]?(?:0)?\s*)?(?:\(?0?[1-9]\d{1,3}\)?[\s\u00A0.-]?\d{3,4}[\s\u00A0.-]?\d{3,4})(?:\s?(?:ext\.?|x)\s?\d{1,5})?\b/g,priority:85,placeholder:"[PHONE_UK_{n}]",description:"UK phone number",severity:"medium",validator:(t,e)=>{let r=t.replace(/[\s\u00A0().-]/g,"").replace(/ext|x/i,"");return !(!/^(?:\+?44)?0?[1-9]\d{1,3}\d{6,7}$/.test(r)||/\b(version|v\d+|release|build)\s*[:\s]*/i.test(e)||/^\d{2}[-/]\d{2}[-/]\d{4}$/.test(t)&&/date|dob|birth|expir/i.test(e)||/example\s+phone|test\s+number|sample\s+phone|demo\s+phone/i.test(e))}},{type:"PHONE_US",regex:/\b(?:\+1[\s\u00A0.-]?)?(?:\(\d{3}\)|\d{3})[\s\u00A0.-]?\d{3}[\s\u00A0.-]?\d{4}(?:\s?(?:ext\.?|x)\s?\d{1,6})?\b/g,priority:85,placeholder:"[PHONE_US_{n}]",description:"US phone number",severity:"medium",validator:(t,e)=>{let r=t.replace(/[\s\u00A0().-]/g,"").replace(/ext|x/i,"");if(!/^(?:\+?1)?\d{10}$/.test(r)||/\b(version|v\d+|release|build)\s*[:\s]*/i.test(e)||/^\d{2}[-/]\d{2}[-/]\d{4}$/.test(t)&&/date|dob|birth|expir/i.test(e)||/example\s+phone|test\s+number|sample\s+phone|demo\s+phone/i.test(e))return false;let i=r.replace(/^\+?1?/,"").substring(0,3);if(i==="000"||i==="111")return false;if(i==="555"){let s=e.toLowerCase();if(/example\s+phone|test\s+number|fictional\s+number|demo\s+phone/i.test(s))return false}return true}},{type:"PHONE_INTERNATIONAL",regex:/\b\+(?:\d[\s\u00A0.\-()]?){6,14}\d(?:\s?(?:ext\.?|x)\s?\d{1,6})?\b/g,priority:80,placeholder:"[PHONE_{n}]",description:"International phone number",severity:"medium",validator:(t,e)=>{let r=t.replace(/[\s\u00A0().-]/g,"").replace(/ext|x/i,"");if(!r.startsWith("+"))return false;let i=r.substring(1);return !(i.length<7||i.length>15||!/^\d+$/.test(i)||/\b(version|v\d+|release|build)\s*[:\s]*/i.test(e)||/^\d{2}[-/]\d{2}[-/]\d{4}$/.test(t)&&/date|dob|birth|expir/i.test(e)||/example\s+phone|test\s+number|sample\s+phone|demo\s+phone/i.test(e)||/^\+1\d{10}$/.test(r)||/^\+44\d{10,11}$/.test(r))}},{type:"POSTCODE_UK",regex:/\b([A-Z]{1,2}\d{1,2}[A-Z]?[\s\u00A0.-]?\d[A-Z]{2})\b/g,priority:75,placeholder:"[POSTCODE_{n}]",description:"UK postcode",severity:"low",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");return !(r.length<5||r.length>7||!/^[A-Z]{1,2}\d{1,2}[A-Z]?\d[A-Z]{2}$/i.test(r))}},{type:"ZIP_CODE_US",regex:/\b(\d{5}(?:[\s\u00A0.-]\d{4})?)\b/g,priority:70,placeholder:"[ZIP_{n}]",description:"US ZIP code",severity:"low",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");if(!/^\d{5}$/.test(r)&&!/^\d{9}$/.test(r))return false;let i=e.toLowerCase();return !(/\b(phone|tel|call|contact)\b/i.test(i)&&r.length===9)}},{type:"ADDRESS_STREET",regex:/\b\d{1,5}\s+[A-Za-z0-9][A-Za-z0-9'’.\-]*(?:\s+[A-Za-z0-9][A-Za-z0-9'’.\-]*){0,4}\s+(?:Street|St\.?|Road|Rd\.?|Avenue|Ave\.?|Lane|Ln\.?|Drive|Dr\.?|Court|Ct\.?|Boulevard|Blvd\.?|Way|Terrace|Ter\.?|Place|Pl\.?|Trail|Trl\.?|Parkway|Pkwy\.?|Highway|Hwy\.)(?:\s+(?:Apt|Unit|Suite|Ste)\s*\d+)?\b/gi,priority:70,placeholder:"[ADDRESS_{n}]",description:"Street address",severity:"medium"},{type:"ADDRESS_PO_BOX",regex:/\b(P\.?O\.?\s?Box\s\d+)\b/gi,priority:75,placeholder:"[PO_BOX_{n}]",description:"PO Box address",severity:"medium"}],Nt=[{type:"IPV4",regex:/\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/g,priority:80,validator:t=>!["0.0.0.0","127.0.0.1","255.255.255.255"].includes(t)&&!t.startsWith("192.168.")&&!t.startsWith("10."),placeholder:"[IPV4_{n}]",description:"IPv4 address",severity:"medium"},{type:"IPV6",regex:/\b(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}\b/g,priority:80,validator:t=>t!=="::1"&&!t.startsWith("fe80:"),placeholder:"[IPV6_{n}]",description:"IPv6 address",severity:"medium"},{type:"MAC_ADDRESS",regex:/\b(?:[0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2}\b/g,priority:75,placeholder:"[MAC_{n}]",description:"MAC address",severity:"low"},{type:"URL_WITH_AUTH",regex:/\b(?:https?|ftp):\/\/[a-zA-Z0-9._-]+:[a-zA-Z0-9._-]+@[^\s]+\b/g,priority:95,placeholder:"[URL_AUTH_{n}]",description:"URL with credentials",severity:"high"},{type:"IOT_SERIAL_NUMBER",regex:/\bSN:([A-Z0-9]{12})\b/gi,priority:80,placeholder:"[IOT_SERIAL_{n}]",description:"IoT device serial numbers",severity:"medium"},{type:"DEVICE_UUID",regex:/\b([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\b/gi,priority:75,placeholder:"[DEVICE_UUID_{n}]",description:"Device UUID identifiers",severity:"medium",validator:(t,e)=>/device|uuid|identifier|hardware|iot|sensor/i.test(e)}],fi={type:"SOLANA_ADDRESS",regex:/\b([1-9A-HJ-NP-Za-km-z]{32,44})\b/g,placeholder:"[SOL_ADDR_{n}]",priority:90,severity:"high",description:"Solana (SOL) cryptocurrency address",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");return !(r.length<32||r.length>44||!/solana|sol\b|crypto|wallet|blockchain|address|send|receive|transaction|transfer/i.test(e)||/^(bc1|1|3|0x|L|M|D|X|r|cosmos|tz|addr)/.test(r)||/example|test|sample|demo|fake|dummy|placeholder|version|release/i.test(e)||!/^[1-9A-HJ-NP-Za-km-z]+$/.test(r))}},Ai={type:"POLKADOT_ADDRESS",regex:/\b(1[1-9A-HJ-NP-Za-km-z]{46,47})\b/g,placeholder:"[DOT_ADDR_{n}]",priority:85,severity:"high",description:"Polkadot (DOT) cryptocurrency address",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");return !(r.length<47||r.length>48||!r.startsWith("1")||!/polkadot|dot\b|crypto|wallet|blockchain|substrate|address|send|receive|transaction|transfer/i.test(e)||/example|test|sample|demo|fake|dummy|placeholder|version|release/i.test(e)||!/^1[1-9A-HJ-NP-Za-km-z]+$/.test(r))}},yi={type:"AVALANCHE_ADDRESS",regex:/\b([XPC][-\s\u00A0]?(?:avax)?[a-z0-9]{38,43})\b/gi,placeholder:"[AVAX_ADDR_{n}]",priority:85,severity:"high",description:"Avalanche (AVAX) cryptocurrency address",validator:(t,e)=>{let r=t.replace(/[\s\u00A0]/g,"").toUpperCase();return !(!/^[XPC][-]?/.test(r)||r.length<40||r.length>46||!/avalanche|avax\b|crypto|wallet|blockchain|address|send|receive|transaction|transfer/i.test(e)||/example|test|sample|demo|fake|dummy|placeholder|version|release/i.test(e))}},Ii={type:"COSMOS_ADDRESS",regex:/\b(cosmos1[a-z0-9]{38,44})\b/g,placeholder:"[ATOM_ADDR_{n}]",priority:80,severity:"high",description:"Cosmos (ATOM) cryptocurrency address",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"").toLowerCase();return !(!r.startsWith("cosmos1")||r.length<39||r.length>45||!/cosmos|atom\b|crypto|wallet|blockchain|ibc|address|send|receive|transaction|transfer/i.test(e)||/example|test|sample|demo|fake|dummy|placeholder|version|release/i.test(e)||!/^cosmos1[a-z0-9]+$/.test(r))}},_i={type:"ALGORAND_ADDRESS",regex:/\b([A-Z2-7]{58})\b/g,placeholder:"[ALGO_ADDR_{n}]",priority:80,severity:"high",description:"Algorand (ALGO) cryptocurrency address",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"").toUpperCase();return !(r.length!==58||!/^[A-Z2-7]+$/.test(r)||!/algorand|algo\b|crypto|wallet|blockchain|address|send|receive|transaction|transfer/i.test(e)||/example|test|sample|demo|fake|dummy|placeholder|version|release/i.test(e))}},Ni={type:"TEZOS_ADDRESS",regex:/\b(tz[123][1-9A-HJ-NP-Za-km-z]{33})\b/g,placeholder:"[XTZ_ADDR_{n}]",priority:80,severity:"high",description:"Tezos (XTZ) cryptocurrency address",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");return !(!/^tz[123]/.test(r)||r.length!==36||!/tezos|xtz\b|crypto|wallet|blockchain|address|send|receive|transaction|transfer/i.test(e)||/example|test|sample|demo|fake|dummy|placeholder|version|release/i.test(e)||!/^tz[123][1-9A-HJ-NP-Za-km-z]+$/.test(r))}},Ri={type:"POLYGON_ADDRESS",regex:/\b(0x[a-fA-F0-9]{40})\b/g,placeholder:"[MATIC_ADDR_{n}]",priority:85,severity:"high",description:"Polygon (MATIC) cryptocurrency address",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");return !(!r.startsWith("0x")||r.length!==42||!/polygon|matic\b|crypto|wallet|blockchain|address|send|receive|transaction|transfer/i.test(e)||/ethereum|eth\b|ether/i.test(e)&&!/polygon|matic/i.test(e)||/example|test|sample|demo|fake|dummy|placeholder|version|release/i.test(e)||!/^0x[a-fA-F0-9]{40}$/.test(r))}},Ti={type:"BINANCE_CHAIN_ADDRESS",regex:/\b(0x[a-fA-F0-9]{40})\b/g,placeholder:"[BNB_ADDR_{n}]",priority:85,severity:"high",description:"Binance Smart Chain (BNB) address",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");return !(!r.startsWith("0x")||r.length!==42||!/binance|bnb\b|bsc|smart[- ]?chain|crypto|wallet|blockchain|address|send|receive|transaction|transfer/i.test(e)||/ethereum|eth\b|ether/i.test(e)&&!/binance|bnb|bsc/i.test(e)||/polygon|matic/i.test(e)&&!/binance|bnb|bsc/i.test(e)||/example|test|sample|demo|fake|dummy|placeholder|version|release/i.test(e)||!/^0x[a-fA-F0-9]{40}$/.test(r))}},bi={type:"NEAR_ADDRESS",regex:/\b([a-z0-9_-]{2,64}\.near)\b/gi,placeholder:"[NEAR_ADDR_{n}]",priority:80,severity:"high",description:"Near Protocol (NEAR) address",validator:(t,e)=>{let r=t.replace(/[\s\u00A0]/g,"").toLowerCase();if(!r.endsWith(".near"))return false;let i=r.slice(0,-5);return !(i.length<2||i.length>64||!/^[a-z0-9_-]+$/.test(i)||!/near|protocol|crypto|wallet|blockchain|address|send|receive|transaction|transfer/i.test(e)||/example|test|sample|demo|fake|dummy|placeholder|version|release/i.test(e))}},Rt=[fi,Ai,yi,Ii,_i,Ni,Ri,Ti,bi],Ci={type:"MEDICAL_RECORD_NUMBER",regex:/\b(?:MR[N]?[-\s]?|MEDICAL[-\s]?REC(?:ORD)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*)([A-Z0-9]{6,12})\b/gi,placeholder:"[MRN_{n}]",priority:85,severity:"high",description:"Medical Record Numbers in various hospital formats"},vi={type:"PATIENT_ID",regex:/\b(?:PATIENT[-\s]?(?:ID|NUM(?:BER)?|REF(?:ERENCE)?)[-\s]?[:#]?\s*)([A-Z0-9]{6,12})\b/gi,placeholder:"[PATIENT_ID_{n}]",priority:85,severity:"high",description:"Patient identification numbers"},Si={type:"APPOINTMENT_REF",regex:/\b(?:APT|APPT|APPOINTMENT)[-\s]?(?:REF|ID|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,10})\b/gi,placeholder:"[APT_{n}]",priority:75,severity:"medium",description:"Medical appointment reference numbers"},Pi={type:"ICD10_CODE",regex:/\b([A-Z]\d{2}(?:\.\d{1,2})?)\b/g,placeholder:"[ICD10_{n}]",priority:70,severity:"medium",description:"ICD-10 diagnosis codes",validator:(t,e)=>{let r=/diagnos|condition|disease|disorder|icd|code/i.test(e),i=/^[A-TV-Z]/.test(t);return r&&i}},Oi={type:"CPT_CODE",regex:/\b(?:CPT[-\s]?(?:CODE)?[-\s]?[:#]?\s*)?([0-9]{5})\b/g,placeholder:"[CPT_{n}]",priority:70,severity:"medium",description:"CPT medical procedure codes",validator:(t,e)=>{let r=parseInt(t),i=r>=100&&r<=99499,s=/procedure|cpt|billing|treatment|service/i.test(e);return i&&s}},Di={type:"PRESCRIPTION_NUMBER",regex:/\b(?:RX|PRESC(?:RIPTION)?|SCRIPT)[-\s]?(?:NO|NUM(?:BER)?|REF|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[RX_{n}]",priority:80,severity:"high",description:"Prescription reference numbers"},Mi={type:"HEALTH_INSURANCE_CLAIM",regex:/\b(?:CLAIM|CLM)[-\s]?(?:NO|NUM(?:BER)?|REF|ID)?[-\s]?[:#]?\s*([A-Z0-9]{8,16})\b/gi,placeholder:"[CLAIM_{n}]",priority:80,severity:"high",description:"Health insurance claim numbers",validator:(t,e)=>/insurance|claim|medical|health|policy/i.test(e)},xi={type:"HEALTH_PLAN_NUMBER",regex:/\b(?:HEALTH[-\s]?PLAN|BENEFICIARY|MEMBER)[-\s]?(?:NO|NUM(?:BER)?|ID)?[-\s]?[:#]?\s*([A-Z0-9]{8,15})\b/gi,placeholder:"[HEALTH_PLAN_{n}]",priority:85,severity:"high",description:"Health plan beneficiary/member numbers"},Li={type:"MEDICAL_DEVICE_SERIAL",regex:/\b(?:DEVICE|IMPLANT|PACEMAKER|DEFIBRILLATOR)[-\s]?(?:SERIAL|SN|S\/N)[-\s]?[:#]?\s*([A-Z0-9]{8,20})\b/gi,placeholder:"[DEVICE_{n}]",priority:75,severity:"high",description:"Medical device serial numbers"},Ui={type:"LAB_TEST_ID",regex:/\b(?:LAB|TEST|SAMPLE)[-\s]?(?:ID|NUM(?:BER)?|REF)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[LAB_{n}]",priority:75,severity:"medium",description:"Laboratory test and sample IDs",validator:(t,e)=>/lab|test|sample|specimen|pathology/i.test(e)},wi={type:"TRIAL_PARTICIPANT_ID",regex:/\b(?:PARTICIPANT|SUBJECT|TRIAL)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z]{1,2}[-]?\d{4,6})\b/gi,placeholder:"[TRIAL_PART_{n}]",priority:85,severity:"high",description:"Clinical trial participant identifiers"},Bi={type:"PROTOCOL_NUMBER",regex:/\b(?:PROTOCOL|STUDY)[-\s]?(?:NO|NUM(?:BER)?|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,15})\b/gi,placeholder:"[PROTOCOL_{n}]",priority:75,severity:"medium",description:"Clinical trial protocol numbers",validator:(t,e)=>/trial|study|protocol|research|clinical/i.test(e)},ki={type:"GENETIC_MARKER",regex:/\b(rs\d{6,10})\b/gi,placeholder:"[SNP_{n}]",priority:80,severity:"high",description:"Genetic markers (dbSNP rs numbers)",validator:(t,e)=>/genetic|gene|snp|marker|genome|dna|variant|allele/i.test(e)},Hi={type:"BIOBANK_SAMPLE_ID",regex:/\b(?:BIOBANK|SAMPLE|SPECIMEN)[-\s]?(?:ID|NO)?[-\s]?[:#]?\s*([A-Z0-9]{8,15})\b/gi,placeholder:"[BIOBANK_{n}]",priority:85,severity:"high",description:"Biobank sample identifiers",validator:(t,e)=>/biobank|specimen|sample|tissue|blood|genetic/i.test(e)},Fi={type:"PROVIDER_LICENSE",regex:/\b(?:MEDICAL|PHYSICIAN|DOCTOR|NURSE|PROVIDER)[-\s\u00A0]*(?:LICENSE|LICENCE|LIC)[-\s\u00A0]*(?:NO|NUM(?:BER)?)?[-\s\u00A0.:#]*((?:[A-Z0-9]{2,6}[\s\u00A0./-]?){1,3}[A-Z0-9]{2,6})\b/gi,placeholder:"[PROVIDER_LIC_{n}]",priority:80,severity:"high",description:"Healthcare provider license numbers",validator:t=>{let e=t.replace(/[^A-Za-z0-9]/g,"");return e.length<6||e.length>18?false:/[A-Z]/i.test(e)&&/\d/.test(e)}},Zi={type:"NPI_NUMBER",regex:/\b(?:NPI[-\s\u00A0]*(?:NO|NUM(?:BER)?)?[-\s\u00A0.:#]*)?((?:\d[\s\u00A0.-]?){10})\b/g,placeholder:"[NPI_{n}]",priority:85,severity:"high",description:"US National Provider Identifier",validator:(t,e)=>{if(!/provider|npi|physician|doctor|clinic|hospital|practice/i.test(e))return false;let r=t.replace(/\D/g,"").split("").map(Number);if(r.length!==10)return false;let i=0;for(let s=r.length-2;s>=0;s--){let n=r[s];(r.length-s)%2===0&&(n*=2,n>9&&(n-=9)),i+=n;}return (10-i%10)%10===r[r.length-1]}},Gi={type:"DEA_NUMBER",regex:/\b(?:DEA[-\s\u00A0]*(?:NO|NUM(?:BER)?)?[-\s\u00A0.:#]*)?([A-Z]{2}(?:[\s\u00A0.-]?\d){7})\b/gi,placeholder:"[DEA_{n}]",priority:90,severity:"high",description:"DEA registration number for controlled substances",validator:(t,e)=>{let r=t.replace(/[^A-Za-z0-9]/g,"").toUpperCase();if(r.length!==9||!["A","B","C","D","E","F","G","H","J","K","L","M","P","R","S","T","U"].includes(r[0]))return false;let i=r.substring(2).split("").map(Number);return (i[0]+i[2]+i[4]+(i[1]+i[3]+i[5])*2)%10===i[6]}},$i={type:"HOSPITAL_ACCOUNT",regex:/\b(?:HOSPITAL|H|HAR)[-\s]?(?:ACCOUNT|ACCT|A\/C)[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,14})\b/gi,placeholder:"[H_ACCT_{n}]",priority:80,severity:"high",description:"Hospital account numbers"},Ki={type:"EMERGENCY_CONTACT",regex:/(?:emergency\s+contact|next\s+of\s+kin|ice|in\s+case\s+of\s+emergency)[:\s]+([A-Z][a-z]+(?:\s+[A-Z][a-z]+){1,3})/gi,placeholder:"[EMERGENCY_CONTACT_{n}]",priority:85,severity:"high",description:"Emergency contact person names"},Wi={type:"BIOMETRIC_ID",regex:/\b(?:FINGERPRINT|RETINAL?[-\s\u00A0]?SCAN|IRIS[-\s\u00A0]?SCAN|VOICE[-\s\u00A0]?PRINT|FACIAL[-\s\u00A0]?RECOGNITION|BIOMETRIC)[-\s\u00A0]?(?:ID|DATA|TEMPLATE|HASH)?[-\s\u00A0.:#]*([A-Z0-9][A-Z0-9._-]{7,39})\b/gi,placeholder:"[BIOMETRIC_{n}]",priority:95,severity:"high",description:"Biometric identifier references",validator:t=>{let e=t.replace(/[^A-Za-z0-9]/g,"");return e.length<8||e.length>40?false:/[A-Z]/i.test(e)&&/\d/.test(e)}},Yi={type:"DNA_SEQUENCE",regex:/\b([ATCG]{20,})\b/g,placeholder:"[DNA_{n}]",priority:90,severity:"high",description:"DNA sequence patterns",validator:(t,e)=>{let r=/dna|genetic|sequence|genome|nucleotide|gene/i.test(e),i=t.length>=20,s=/^[ATCGRYSWKMBDHVN]+$/i.test(t);return r&&i&&s}},zi={type:"DRUG_DOSAGE",regex:/\b([A-Z][a-z]+(?:ine|ol|azole|mycin|cillin|pril|olol|mab|pam|tab|pine|done|ide|tide|ase|statin))\s+(\d+(?:\.\d+)?)\s?(mg|mcg|g|ml|units?|IU)\b/gi,placeholder:"[DRUG_DOSAGE_{n}]",priority:75,severity:"medium",description:"Drug names with dosages",validator:(t,e)=>/medication|prescription|drug|dose|treatment|therapy/i.test(e)},Vi={type:"MEDICAL_IMAGE_REF",regex:/\b(?:X[-\s\u00A0]?RAY|MRI|CT[-\s\u00A0]?SCAN|PET[-\s\u00A0]?SCAN|ULTRASOUND|MAMMOGRAM)[-\s\u00A0]?(?:IMAGE|FILE|ID)?[-\s\u00A0.:#]*([A-Z0-9][A-Z0-9_.-]{5,23})\b/gi,placeholder:"[IMAGE_{n}]",priority:80,severity:"high",description:"Medical imaging file references"},ji={type:"BLOOD_TYPE",regex:/\b(?:blood\s+type|blood\s+group)[:\s]+(A|B|AB|O)[+-]?\b/gi,placeholder:"[BLOOD_TYPE_{n}]",priority:80,severity:"medium",description:"Patient blood type information"},qi={type:"ALLERGY_INFO",regex:/\b(?:allergic\s+to|allergy)[:\s]+([A-Za-z\s,]+(?:penicillin|peanuts|latex|aspirin|shellfish|eggs|dairy|soy|wheat))/gi,placeholder:"[ALLERGY_{n}]",priority:85,severity:"high",description:"Patient allergy information"},Xi={type:"VACCINATION_ID",regex:/\b(?:VACCINE|VACCINATION|IMMUNIZATION)[-\s]?(?:ID|RECORD|NO)?[-\s]?[:#]?\s*([A-Z0-9]{6,15})\b/gi,placeholder:"[VAX_{n}]",priority:80,severity:"high",description:"Vaccination record identifiers",validator:(t,e)=>/vaccine|vaccination|immunization|shot|dose/i.test(e)},Ji={type:"CHI_NUMBER",regex:/\b(?:CHI|community health index)[-\s]?(?:number|no)?[-\s]?[:#]?\s*(\d{6}[-\s]?\d{4})\b/gi,placeholder:"[CHI_{n}]",priority:95,severity:"high",description:"Scottish Community Health Index number",validator:t=>{let e=t.replace(/\D/g,"");if(e.length!==10)return false;let r=parseInt(e.substring(0,2)),i=parseInt(e.substring(2,4));if(r<1||r>31||i<1||i>12)return false;let s=0,n=[10,9,8,7,6,5,4,3,2];for(let o=0;o<9;o++)s+=parseInt(e[o])*n[o];let a=11-s%11;return (a===11||a===10?0:a)===parseInt(e[9])}},Qi={type:"EHIC_NUMBER",regex:/\b(?:EHIC|european health insurance|health card)[-\s]?(?:number|no)?[-\s]?[:#]?\s*([A-Z]{2}\s?\d{12,16})\b/gi,placeholder:"[EHIC_{n}]",priority:90,severity:"high",description:"European Health Insurance Card number",validator:t=>{let e=t.replace(/\s/g,""),r=e.substring(0,2).toUpperCase();if(!["AT","BE","BG","HR","CY","CZ","DK","EE","FI","FR","DE","GR","HU","IS","IE","IT","LV","LI","LT","LU","MT","NL","NO","PL","PT","RO","SK","SI","ES","SE","CH","GB"].includes(r))return false;let i=e.substring(2);return /^\d{12,16}$/.test(i)}},Tt=[Ci,vi,Si,Pi,Oi,Di,Mi,xi,Li,Ui,wi,Bi,ki,Hi,Fi,Zi,Gi,$i,Ki,Wi,Yi,zi,Vi,ji,qi,Xi,Ji,Qi],es={type:"SWIFT_BIC",regex:/\b([A-Z]{6}[A-Z0-9]{2}(?:[A-Z0-9]{3})?)\b/g,placeholder:"[SWIFT_{n}]",priority:85,severity:"high",description:"SWIFT/BIC codes for international transfers",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"").toUpperCase(),i=/swift|bic|bank|transfer|wire|international|payment/i.test(e),s=r.length===8||r.length===11,n=/^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$/.test(r);return i&&s&&n}},ts={type:"TRANSACTION_ID",regex:/\b(?:TXN|TX|TRANS(?:ACTION)?)[-\s]?(?:ID|NO|NUM(?:BER)?|REF)?[-\s]?[:#]?\s*([A-Z0-9]{8,20})\b/gi,placeholder:"[TXN_{n}]",priority:80,severity:"medium",description:"Financial transaction identifiers"},rs={type:"INVESTMENT_ACCOUNT",regex:/\b(?:ISA|SIPP|INV(?:ESTMENT)?|PENSION|401K|IRA)[-\s\u00A0]*(?:ACCOUNT|ACCT|A\/C)?[-\s\u00A0]*(?:NO|NUM(?:BER)?)?[-\s\u00A0.:#]*([A-Z0-9](?:[A-Z0-9][\s\u00A0./-]?){5,18}[A-Z0-9])\b/gi,placeholder:"[INV_ACCT_{n}]",priority:85,severity:"high",description:"Investment and pension account numbers",validator:(t,e)=>{let r=t.replace(/[\s\u00A0./-]/g,""),i=/\d{4,}/.test(r),s=r.length>=6&&r.length<=15,n=/isa|sipp|invest|pension|401k|ira|account|fund/i.test(e);return i&&s&&n}},is={type:"WIRE_TRANSFER_REF",regex:/\b(?:WIRE|TRANSFER|REMITTANCE)[-\s]?(?:REF(?:ERENCE)?|NO|NUM(?:BER)?|ID)?[-\s]?[:#]?\s*([A-Z0-9]{8,20})\b/gi,placeholder:"[WIRE_{n}]",priority:85,severity:"high",description:"Wire transfer reference numbers"},ss={type:"DD_MANDATE",regex:/\b(?:DD|DIRECT[-\s]?DEBIT)[-\s]?(?:MANDATE|REF(?:ERENCE)?|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,18})\b/gi,placeholder:"[DD_MANDATE_{n}]",priority:80,severity:"high",description:"Direct Debit mandate reference numbers"},ns={type:"CHEQUE_NUMBER",regex:/\b(?:CHE(?:QUE|CK))[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*(\d{6,10})\b/gi,placeholder:"[CHEQUE_{n}]",priority:75,severity:"medium",description:"Cheque/check numbers",validator:(t,e)=>/cheque|check|payment/i.test(e)},as={type:"TRADING_ACCOUNT",regex:/\b(?:TRADING|BROKERAGE|STOCK)[-\s]?(?:ACCOUNT|ACCT|A\/C)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,14})\b/gi,placeholder:"[TRADE_ACCT_{n}]",priority:85,severity:"high",description:"Stock trading and brokerage account numbers"},os={type:"LOAN_ACCOUNT",regex:/\b(?:LOAN|MORTGAGE|CREDIT)[-\s]?(?:ACCOUNT|ACCT|A\/C)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,16})\b/gi,placeholder:"[LOAN_{n}]",priority:85,severity:"high",description:"Loan and mortgage account numbers"},cs={type:"BITCOIN_ADDRESS",regex:/\b([13][a-km-zA-HJ-NP-Z1-9]{25,34}|bc1[a-z0-9]{39,59})\b/g,placeholder:"[BTC_ADDR_{n}]",priority:90,severity:"high",description:"Bitcoin cryptocurrency addresses",validator:(t,e)=>{if(t.startsWith("bc1"))return t.length>=42&&t.length<=62;{let r=/[a-km-z]/.test(t),i=/[A-HJ-NP-Z]/.test(t);return r||i}}},ls={type:"ETHEREUM_ADDRESS",regex:/\b(0x[a-fA-F0-9]{40})\b/g,placeholder:"[ETH_ADDR_{n}]",priority:90,severity:"high",description:"Ethereum cryptocurrency addresses"},ds={type:"LITECOIN_ADDRESS",regex:/\b([LM][a-km-zA-HJ-NP-Z1-9]{26,33}|ltc1[a-z0-9]{39,59})\b/g,placeholder:"[LTC_ADDR_{n}]",priority:90,severity:"high",description:"Litecoin cryptocurrency addresses",validator:(t,e)=>/crypto|litecoin|ltc|wallet|address/i.test(e)||t.startsWith("ltc1")},us={type:"MONERO_ADDRESS",regex:/\b([48][a-km-zA-HJ-NP-Z1-9]{94})\b/g,placeholder:"[XMR_ADDR_{n}]",priority:90,severity:"high",description:"Monero cryptocurrency addresses",validator:(t,e)=>/crypto|monero|xmr|wallet|address/i.test(e)&&t.length===95},ps={type:"RIPPLE_ADDRESS",regex:/\b(r[a-km-zA-HJ-NP-Z1-9]{24,34})\b/g,placeholder:"[XRP_ADDR_{n}]",priority:90,severity:"high",description:"Ripple (XRP) cryptocurrency addresses",validator:(t,e)=>/crypto|ripple|xrp|wallet|address/i.test(e)&&t.length>=25&&t.length<=35},hs={type:"CARDANO_ADDRESS",regex:/\b(addr1[a-z0-9]{58,104})\b/g,placeholder:"[ADA_ADDR_{n}]",priority:90,severity:"high",description:"Cardano (ADA) cryptocurrency addresses"},gs={type:"CRYPTO_TX_HASH",regex:/\b(?:TX|TXID|TRANSACTION[-\s]?HASH)[:\s]+([a-fA-F0-9]{64})\b/gi,placeholder:"[CRYPTO_TX_{n}]",priority:85,severity:"high",description:"Cryptocurrency transaction hashes",validator:(t,e)=>/crypto|bitcoin|ethereum|blockchain|transaction|tx|txid/i.test(e)},ms={type:"CARD_TRACK1_DATA",regex:/%B\d{13,19}\^[^^]+\^\d{4}\d{3}[^?]+\?/g,placeholder:"[TRACK1_{n}]",priority:95,severity:"high",description:"Payment card Track 1 magnetic stripe data"},Es={type:"CARD_TRACK2_DATA",regex:/;\d{13,19}=\d{4}\d{3}[^?]+\?/g,placeholder:"[TRACK2_{n}]",priority:95,severity:"high",description:"Payment card Track 2 magnetic stripe data"},fs={type:"CVV_CODE",regex:/\b(?:CVV|CVC|CVV2|CID|CSC)[:\s]+(\d{3,4})\b/gi,placeholder:"[CVV_{n}]",priority:95,severity:"high",description:"Card verification value (CVV/CVC) codes",validator:(t,e)=>t.length>=3&&t.length<=4},As={type:"CARD_EXPIRY",regex:/\b(?:EXP(?:IRY|IRATION)?|VALID\s+THRU)[:\s]+(\d{2}[\/\-]\d{2,4}|\d{4})\b/gi,placeholder:"[EXPIRY_{n}]",priority:90,severity:"high",description:"Card expiration dates",validator:(t,e)=>{let r=/card|payment|credit|debit|visa|mastercard|amex/i.test(e);if(t.includes("/")||t.includes("-")){let i=t.split(/[\/\-]/),s=parseInt(i[0]);return r&&s>=1&&s<=12}return r}},ys={type:"STOCK_TRADE",regex:/\b([A-Z]{1,5})\s+(?:BUY|SELL|SOLD|BOUGHT)\s+(\d+(?:,\d{3})*(?:\.\d{2})?)\s+(?:@|at)\s+\$?(\d+(?:\.\d{2,4})?)\b/gi,placeholder:"[TRADE_{n}]",priority:85,severity:"high",description:"Stock trade details with ticker, quantity, and price",validator:(t,e)=>/stock|trade|buy|sell|shares|equity|portfolio/i.test(e)},Is={type:"WIRE_TRANSFER_DETAILS",regex:/\b(?:WIRE\s+TO|TRANSFER\s+TO|BENEFICIARY)[:\s]+([A-Z0-9\s,.-]{20,100})/gi,placeholder:"[WIRE_DETAILS_{n}]",priority:90,severity:"high",description:"Bank wire transfer beneficiary details",validator:(t,e)=>/wire|transfer|beneficiary|recipient|iban|swift|aba|routing/i.test(e)},_s={type:"PAYMENT_TOKEN",regex:/\b(?:tok|card|pm|src)_[a-zA-Z0-9]{24,}/g,placeholder:"[PAY_TOKEN_{n}]",priority:90,severity:"high",description:"Payment gateway tokens (Stripe, etc.)"},Ns={type:"PAYMENT_CUSTOMER_ID",regex:/\b(cus_[a-zA-Z0-9]{14,})/g,placeholder:"[CUST_ID_{n}]",priority:85,severity:"high",description:"Payment gateway customer IDs"},Rs={type:"SUBSCRIPTION_ID",regex:/\b(sub_[a-zA-Z0-9]{14,})/g,placeholder:"[SUB_ID_{n}]",priority:80,severity:"medium",description:"Payment subscription IDs"},Ts={type:"STATEMENT_REF",regex:/\b(?:STATEMENT|STMT)[-\s]?(?:REF(?:ERENCE)?|NO|NUM(?:BER)?|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,15})\b/gi,placeholder:"[STMT_{n}]",priority:75,severity:"medium",description:"Account statement reference numbers"},bs={type:"STANDING_ORDER_REF",regex:/\b(?:STANDING[-\s]?ORDER|SO)[-\s]?(?:REF(?:ERENCE)?|NO|NUM(?:BER)?|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,15})\b/gi,placeholder:"[SO_{n}]",priority:75,severity:"medium",description:"Standing order reference numbers"},Cs={type:"PAYMENT_REFERENCE",regex:/\b(?:PAYMENT|PAY)[-\s]?(?:REF(?:ERENCE)?|NO|NUM(?:BER)?|ID)?[-\s]?[:#]?\s*([A-Z0-9]{8,20})\b/gi,placeholder:"[PAY_REF_{n}]",priority:75,severity:"medium",description:"Generic payment reference numbers"},vs={type:"CARD_AUTH_CODE",regex:/\b(?:AUTH(?:ORIZATION)?|APPROVAL)[-\s]?(?:CODE|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[AUTH_{n}]",priority:80,severity:"high",description:"Card authorization codes",validator:(t,e)=>/payment|card|transaction|auth|approval/i.test(e)},Ss={type:"MERCHANT_ID",regex:/\b(?:MERCHANT|MID)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,20})\b/gi,placeholder:"[MERCHANT_{n}]",priority:75,severity:"medium",description:"Merchant identification numbers",validator:(t,e)=>/merchant|terminal|pos|payment|processor/i.test(e)},Ps={type:"TERMINAL_ID",regex:/\b(?:TERMINAL|TID|POS)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,16})\b/gi,placeholder:"[TERMINAL_{n}]",priority:75,severity:"medium",description:"Point of sale terminal IDs",validator:(t,e)=>/terminal|pos|point.of.sale|card.reader/i.test(e)},Os={type:"UK_BANK_ACCOUNT_IBAN",regex:/\b(GB\d{2}[\s\u00A0.-]?[A-Z]{4}[\s\u00A0.-]?\d{14})\b/gi,placeholder:"[UK_IBAN_{n}]",priority:95,severity:"high",description:"UK bank account numbers in IBAN format",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"").toUpperCase();return !(!r.startsWith("GB")||r.length!==22||!Et(r)||!/iban|account|bank|uk|gb|financial|payment|transfer/i.test(e)||/example\s+iban|test\s+iban|sample\s+iban|demo\s+iban|fake\s+iban/i.test(e))}},Ds={type:"UK_SORT_CODE_ACCOUNT",regex:/\b(\d{2}[\s\u00A0-]?\d{2}[\s\u00A0-]?\d{2}[\s\u00A0]?\d{8})\b/g,placeholder:"[UK_ACCOUNT_{n}]",priority:95,severity:"high",description:"UK sort code and account number combination",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");if(!/^\d{14}$/.test(r))return false;let i=r.substring(0,6);return !(r.substring(6).length!==8||!ft(i)||!/sort\s+code|account|bank|uk|gb|financial|payment|transfer/i.test(e)||/example\s+account|test\s+account|sample\s+account|demo\s+account|fake\s+account/i.test(e))}},bt=[es,ts,rs,is,Is,ss,ns,as,os,cs,ls,ds,us,ps,hs,gs,ms,Es,fs,As,ys,_s,Ns,Rs,Ts,bs,Cs,vs,Ss,Ps,Os,Ds],Ms={type:"AWS_ACCESS_KEY",regex:/\b(AKIA[0-9A-Z]{16})\b/g,placeholder:"[AWS_KEY_{n}]",priority:95,severity:"high",description:"AWS Access Key ID"},xs={type:"OPENAI_API_KEY",regex:/\b(sk-proj-[A-Za-z0-9_-]{100,200}|sk-[A-Za-z0-9_-]{48,52})\b/g,placeholder:"[OPENAI_API_KEY_{n}]",priority:99,severity:"high",description:"OpenAI API Key"},Ls={type:"AWS_SECRET_KEY",regex:/(?:aws.{0,20})?(?:secret.{0,20})?([a-zA-Z0-9/+=]{40})/gi,placeholder:"[AWS_SECRET_{n}]",priority:98,severity:"high",description:"AWS Secret Access Key",validator:(t,e)=>/aws|amazon|secret|access.key/i.test(e)},Us={type:"GOOGLE_API_KEY",regex:/\b(AIza[0-9A-Za-z\-_]{35})\b/g,placeholder:"[GOOGLE_API_{n}]",priority:95,severity:"high",description:"Google API Key"},ws={type:"STRIPE_API_KEY",regex:/\b((sk|pk)_(live|test)_[0-9a-zA-Z]{24,})\b/g,placeholder:"[STRIPE_KEY_{n}]",priority:95,severity:"high",description:"Stripe API Keys"},Bs={type:"GITHUB_TOKEN",regex:/\b(gh[pousr]_[A-Za-z0-9]{36,})\b/g,placeholder:"[GITHUB_TOKEN_{n}]",priority:95,severity:"high",description:"GitHub Personal Access Token"},ks={type:"JWT_TOKEN",regex:/\b(eyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+)\b/g,placeholder:"[JWT_{n}]",priority:90,severity:"high",description:"JSON Web Token (JWT)"},Hs={type:"GENERIC_API_KEY",regex:/\b(?:api.{0,5}key|apikey|api.token)[:\s=]+([a-zA-Z0-9_\-]{20,})\b/gi,placeholder:"[API_KEY_{n}]",priority:85,severity:"high",description:"Generic API key pattern",validator:(t,e)=>{let r=/example|sample|test|fake|demo|placeholder|xxx/i;return !r.test(t)&&!r.test(e)}},Fs={type:"GENERIC_SECRET",regex:/\b(?:password|passwd|pwd|secret)[:\s=]+([a-zA-Z0-9!@#$%^&*()_+\-=\[\]{}|;:,.<>?]{8,})\b/gi,placeholder:"[SECRET_{n}]",priority:90,severity:"high",description:"Generic passwords and secrets",validator:(t,e)=>!/example|sample|test|fake|demo|placeholder|xxx|password|secret|\*+/i.test(t)&&t.length>=8},Zs={type:"PRIVATE_KEY",regex:/-----BEGIN (?:RSA |EC )?PRIVATE KEY-----[\s\S]{20,}?-----END (?:RSA |EC )?PRIVATE KEY-----/g,placeholder:"[PRIVATE_KEY_{n}]",priority:98,severity:"high",description:"RSA/EC Private Keys"},Gs={type:"SSH_PRIVATE_KEY",regex:/-----BEGIN OPENSSH PRIVATE KEY-----[\s\S]{20,}?-----END OPENSSH PRIVATE KEY-----/g,placeholder:"[SSH_KEY_{n}]",priority:98,severity:"high",description:"SSH Private Keys"},$s={type:"DATABASE_CONNECTION",regex:/(?:postgres|mysql|mongodb|redis|sqlite):\/\/[^\s:]+:[^\s@]+@[^\s]+/gi,placeholder:"[DB_CONN_{n}]",priority:95,severity:"high",description:"Database connection strings with credentials"},Ks={type:"AWS_ARN",regex:/\b(arn:aws:[a-z0-9\-]+:[a-z0-9\-]*:[0-9]{12}:[a-zA-Z0-9\/\-_:]+)\b/g,placeholder:"[AWS_ARN_{n}]",priority:75,severity:"medium",description:"AWS Amazon Resource Name",validator:(t,e)=>/aws|amazon|cloud|arn|resource/i.test(e)},Ws={type:"DOCKER_AUTH",regex:/\{[^}]*"auth"\s*:\s*"([A-Za-z0-9+/=]{20,})"[^}]*\}/g,placeholder:"[DOCKER_AUTH_{n}]",priority:90,severity:"high",description:"Docker authentication tokens"},Ys={type:"SLACK_WEBHOOK",regex:/https:\/\/hooks\.slack\.com\/services\/[A-Z0-9]+\/[A-Z0-9]+\/[A-Za-z0-9]+/g,placeholder:"[SLACK_WEBHOOK_{n}]",priority:90,severity:"high",description:"Slack incoming webhook URLs"},zs={type:"SLACK_TOKEN",regex:/\b(xox[baprs]-[0-9a-zA-Z\-]{10,})\b/g,placeholder:"[SLACK_TOKEN_{n}]",priority:95,severity:"high",description:"Slack API tokens"},Vs={type:"TWILIO_API_KEY",regex:/\b(SK[a-z0-9]{32})\b/g,placeholder:"[TWILIO_KEY_{n}]",priority:90,severity:"high",description:"Twilio API Keys",validator:(t,e)=>/twilio|sms|phone|messaging/i.test(e)},js={type:"MAILGUN_API_KEY",regex:/\b(key-[a-z0-9]{32})\b/g,placeholder:"[MAILGUN_KEY_{n}]",priority:85,severity:"high",description:"Mailgun API Keys",validator:(t,e)=>/mailgun|email|mail/i.test(e)},qs={type:"SENDGRID_API_KEY",regex:/\b(SG\.[a-zA-Z0-9_\-]{22}\.[a-zA-Z0-9_\-]{43})\b/g,placeholder:"[SENDGRID_KEY_{n}]",priority:90,severity:"high",description:"SendGrid API Keys"},Xs={type:"SESSION_ID",regex:/\b(?:session|sess|sid)[:\s=]+([a-f0-9]{32,})\b/gi,placeholder:"[SESSION_{n}]",priority:80,severity:"medium",description:"Session identifiers",validator:(t,e)=>t.length>=32&&/^[a-f0-9]+$/.test(t)},Js={type:"BEARER_TOKEN",regex:/\bBearer\s+([a-zA-Z0-9_\-\.]{20,})/g,placeholder:"[BEARER_{n}]",priority:90,severity:"high",description:"Bearer authentication tokens"},Qs={type:"AZURE_RESOURCE_ID",regex:/\/subscriptions\/[a-f0-9\-]{36}\/resourceGroups\/[a-zA-Z0-9\-_]+\/providers\/[a-zA-Z0-9\.\-_\/]+/gi,placeholder:"[AZURE_RES_{n}]",priority:75,severity:"medium",description:"Azure Resource IDs",validator:(t,e)=>/azure|microsoft|cloud|resource/i.test(e)},en={type:"AZURE_STORAGE_KEY",regex:/\b(?:DefaultEndpointsProtocol|AccountKey)=([a-zA-Z0-9+/=]{88})/g,placeholder:"[AZURE_KEY_{n}]",priority:95,severity:"high",description:"Azure Storage Account Keys",validator:(t,e)=>/azure|storage|account|connection/i.test(e)},tn={type:"GCP_SERVICE_ACCOUNT",regex:/\{[^}]*"type"\s*:\s*"service_account"[^}]*"private_key_id"\s*:\s*"([a-z0-9]{40})"[^}]*\}/gi,placeholder:"[GCP_SA_{n}]",priority:95,severity:"high",description:"GCP Service Account Keys"},rn={type:"KUBERNETES_SECRET",regex:/\b(?:kind:\s*Secret|apiVersion:\s*v1)\s[\s\S]{0,500}?data:\s*\n\s+[a-zA-Z0-9\-_]+:\s*([A-Za-z0-9+/=]{20,})/g,placeholder:"[K8S_SECRET_{n}]",priority:90,severity:"high",description:"Kubernetes Secret data",validator:(t,e)=>/kubernetes|k8s|secret|configmap/i.test(e)},sn={type:"COOKIE_SESSION",regex:/\b(?:set-cookie|cookie):\s*(?:session|sessid|sid|auth)=([a-zA-Z0-9_\-\.]{20,})/gi,placeholder:"[COOKIE_{n}]",priority:85,severity:"medium",description:"HTTP session cookies"},nn={type:"NPM_TOKEN",regex:/\b(npm_[A-Za-z0-9]{36})\b/g,placeholder:"[NPM_TOKEN_{n}]",priority:90,severity:"high",description:"NPM authentication tokens"},an={type:"PYPI_TOKEN",regex:/\b(pypi-[A-Za-z0-9_\-]{100,})\b/g,placeholder:"[PYPI_TOKEN_{n}]",priority:90,severity:"high",description:"Python PyPI tokens"},on={type:"HEROKU_API_KEY",regex:/\b([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})\b/g,placeholder:"[HEROKU_KEY_{n}]",priority:80,severity:"high",description:"Heroku API keys",validator:(t,e)=>/heroku|api.key|auth/i.test(e)},cn={type:"FIREBASE_API_KEY",regex:/\b(AIza[0-9A-Za-z\-_]{35})\b/g,placeholder:"[FIREBASE_KEY_{n}]",priority:90,severity:"high",description:"Firebase API keys",validator:(t,e)=>/firebase|google|cloud/i.test(e)},ln={type:"OAUTH_CLIENT_SECRET",regex:/\b(?:client.?secret|consumer.?secret)[:=\s]+([a-zA-Z0-9_\-]{20,})/gi,placeholder:"[OAUTH_SECRET_{n}]",priority:95,severity:"high",description:"OAuth client secrets",validator:(t,e)=>!/example|sample|test|fake|demo|placeholder/i.test(t)},dn={type:"OAUTH_TOKEN",regex:/\b(?:oauth.?token|access.?token)[:=\s]+([a-zA-Z0-9_\-\.]{20,})/gi,placeholder:"[OAUTH_TOKEN_{n}]",priority:85,severity:"high",description:"OAuth access tokens",validator:(t,e)=>!/example|sample|test|fake|demo|placeholder/i.test(t)&&t.length>=20},Ct=[Ms,xs,Ls,Us,ws,Bs,ks,Hs,Fs,Zs,Gs,$s,Ks,Ws,Ys,zs,Vs,js,qs,Xs,Js,Qs,en,tn,rn,sn,nn,an,on,cn,ln,dn],un={type:"CASE_NUMBER",regex:/\b(?:CASE|DOCKET|FILE)[-\s]?(?:NO|NUM(?:BER)?|REF)?[-\s]?[:#]?\s*([A-Z]{1,3}[-]?\d{2,4}[-]?[A-Z]{0,3}[-]?\d{4,8})\b/gi,placeholder:"[CASE_{n}]",priority:85,severity:"high",description:"Court case and docket numbers"},pn={type:"MATTER_NUMBER",regex:/\b(?:MATTER|ENGAGEMENT|CLIENT[-\s]?MATTER)[-\s]?(?:NO|NUM(?:BER)?|REF|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,15})\b/gi,placeholder:"[MATTER_{n}]",priority:80,severity:"high",description:"Law firm matter and engagement numbers",validator:(t,e)=>/legal|matter|client|engagement|firm|attorney|counsel/i.test(e)},hn={type:"BAR_NUMBER",regex:/\b(?:BAR|ATTORNEY|LAWYER)[-\s]?(?:NO|NUM(?:BER)?|REG(?:ISTRATION)?|LIC(?:ENSE)?)?[-\s]?[:#]?\s*([A-Z0-9]{5,12})\b/gi,placeholder:"[BAR_{n}]",priority:85,severity:"high",description:"Attorney bar registration numbers"},gn={type:"EXHIBIT_NUMBER",regex:/\bEXHIBIT[-\s]?([A-Z]{1,2}[-]?\d{1,4})\b/gi,placeholder:"[EXHIBIT_{n}]",priority:70,severity:"medium",description:"Legal exhibit reference numbers",validator:(t,e)=>/exhibit|evidence|document|trial|hearing|deposition/i.test(e)},mn={type:"DEPOSITION_REF",regex:/\b(?:DEPOSITION|DEPO|DEP)[-\s]?(?:NO|NUM(?:BER)?|REF|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[DEPO_{n}]",priority:75,severity:"medium",description:"Deposition reference numbers",validator:(t,e)=>/deposition|depo|testimony|transcript|witness/i.test(e)},En={type:"DISCOVERY_NUMBER",regex:/\b(?:DISCOVERY|INTERROGATORY|REQUEST|RFP|RFA)[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{1,4}[-]?\d{1,4})\b/gi,placeholder:"[DISCOVERY_{n}]",priority:75,severity:"medium",description:"Discovery request, interrogatory, and production numbers"},fn={type:"COURT_REPORTER_LICENSE",regex:/\b(?:COURT[-\s]?REPORTER|CSR|RPR)[-\s]?(?:LIC(?:ENSE)?|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z]{2,3}[-]?\d{4,8})\b/gi,placeholder:"[CSR_{n}]",priority:75,severity:"medium",description:"Court reporter license numbers"},An={type:"SUBPOENA_NUMBER",regex:/\b(?:SUBPOENA|SUMMONS)[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,15})\b/gi,placeholder:"[SUBPOENA_{n}]",priority:80,severity:"high",description:"Subpoena and summons numbers"},yn={type:"JUDGMENT_NUMBER",regex:/\b(?:JUDGMENT|ORDER|DECREE)[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[JUDGMENT_{n}]",priority:80,severity:"high",description:"Court judgment and order numbers",validator:(t,e)=>/judgment|order|decree|ruling|decision|court/i.test(e)},In={type:"PATENT_NUMBER",regex:/\b(?:(?:US|EP|WO|PCT)[-\s]?)?(?:PATENT|PAT)[-\s]?(?:NO|NUM(?:BER)?|APPL(?:ICATION)?)?[-\s]?[:#]?\s*([A-Z]{0,2}\d{6,10}[A-Z0-9]{0,3})\b/gi,placeholder:"[PATENT_{n}]",priority:75,severity:"medium",description:"Patent and trademark application numbers"},_n={type:"SETTLEMENT_ID",regex:/\b(?:SETTLEMENT|AGREEMENT)[-\s]?(?:ID|NO|NUM(?:BER)?|REF)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[SETTLEMENT_{n}]",priority:85,severity:"high",description:"Settlement agreement identifiers",validator:(t,e)=>/settlement|agreement|resolution|mediation|arbitration/i.test(e)},Nn={type:"CLIENT_ID",regex:/\b(?:CLIENT)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[CLIENT_{n}]",priority:90,severity:"high",description:"Law firm client identifiers",validator:(t,e)=>/client|legal|matter|billing|invoice|retainer/i.test(e)},Rn={type:"RETAINER_NUMBER",regex:/\b(?:RETAINER)[-\s]?(?:NO|NUM(?:BER)?|AGREEMENT)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[RETAINER_{n}]",priority:80,severity:"high",description:"Retainer agreement numbers"},Tn={type:"NOTARY_LICENSE",regex:/\b(?:NOTARY|NOTARIAL)[-\s]?(?:LIC(?:ENSE)?|COMMISSION|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[NOTARY_{n}]",priority:75,severity:"medium",description:"Notary public license and commission numbers"},bn={type:"BANKRUPTCY_CASE",regex:/\b(?:BK|BANKRUPTCY)[-\s]?(?:NO|NUM(?:BER)?|CASE)?[-\s]?[:#]?\s*(\d{2}[-]?\d{5}[-]?[A-Z]{0,3})\b/gi,placeholder:"[BK_{n}]",priority:85,severity:"high",description:"Bankruptcy case numbers"},Cn={type:"PROBATE_CASE",regex:/\b(?:PROBATE|ESTATE)[-\s]?(?:NO|NUM(?:BER)?|CASE)?[-\s]?[:#]?\s*([A-Z]{1,2}\d{6,10})\b/gi,placeholder:"[PROBATE_{n}]",priority:85,severity:"high",description:"Probate and estate case numbers",validator:(t,e)=>/probate|estate|will|trust|inheritance|decedent/i.test(e)},vn={type:"NDA_ID",regex:/\b(?:NDA|CONFIDENTIALITY|NON[-\s]?DISCLOSURE)[-\s]?(?:AGREEMENT)?[-\s]?(?:NO|NUM(?:BER)?|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[NDA_{n}]",priority:75,severity:"high",description:"Non-disclosure and confidentiality agreement numbers"},Sn={type:"CONTRACT_REFERENCE",regex:/\bCNTR[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*(\d{8})\b/gi,placeholder:"[CONTRACT_{n}]",priority:85,severity:"high",description:"Contract reference codes"},vt=[un,pn,hn,gn,mn,En,fn,An,yn,In,_n,Nn,Rn,Tn,bn,Cn,vn,Sn],Pn={type:"STUDENT_ID",regex:/\b(?:STUDENT|PUPIL|SCHOLAR)[-\s]?(?:ID|NUM(?:BER)?|NO)?[-\s]?[:#]?\s*([A-Z]{0,2}\d{6,10})\b/gi,placeholder:"[STUDENT_ID_{n}]",priority:90,severity:"high",description:"Student identification numbers"},On={type:"UNIVERSITY_ID",regex:/\b(?:UNIVERSITY|COLLEGE|UNI)[-\s]?(?:ID|NUM(?:BER)?|NO)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[UNI_ID_{n}]",priority:90,severity:"high",description:"University and college ID numbers",validator:(t,e)=>/university|college|campus|student|enrollment|registr/i.test(e)},Dn={type:"COURSE_CODE",regex:/\b([A-Z]{2,4}\s?\d{3,4}[A-Z]?)\b/g,placeholder:"[COURSE_{n}]",priority:60,severity:"low",description:"Course codes and numbers",validator:(t,e)=>{let r=/course|class|section|semester|quarter|curriculum|syllabus/i.test(e),i=/^[A-Z]{2,4}\s?\d{3,4}[A-Z]?$/.test(t);return r&&i}},Mn={type:"GRADE_REFERENCE",regex:/\b(?:GPA|GRADE[-\s]?POINT[-\s]?AVERAGE)[-\s]?[:#]?\s*((?:[0-4]\.\d{1,2})|(?:\d\.\d{2}))\b/gi,placeholder:"[GPA_{n}]",priority:80,severity:"high",description:"Grade Point Average (GPA) references"},xn={type:"TRANSCRIPT_ID",regex:/\b(?:TRANSCRIPT)[-\s]?(?:ID|NUM(?:BER)?|NO|REF)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[TRANSCRIPT_{n}]",priority:85,severity:"high",description:"Academic transcript identifiers"},Ln={type:"LIBRARY_CARD",regex:/\b(?:LIBRARY)[-\s]?(?:CARD|ID|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,14})\b/gi,placeholder:"[LIBRARY_{n}]",priority:70,severity:"medium",description:"Library card numbers"},Un={type:"FACULTY_ID",regex:/\b(?:FACULTY|TEACHER|INSTRUCTOR|PROFESSOR|STAFF)[-\s]?(?:ID|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z]{1,2}\d{6,10})\b/gi,placeholder:"[FACULTY_{n}]",priority:85,severity:"high",description:"Faculty and teacher identification numbers",validator:(t,e)=>/faculty|teacher|instructor|professor|staff|employee|personnel/i.test(e)},wn={type:"ENROLLMENT_NUMBER",regex:/\b(?:ENROLLMENT|REGISTRATION)[-\s]?(?:NO|NUM(?:BER)?|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[ENROLLMENT_{n}]",priority:80,severity:"high",description:"Course enrollment and registration numbers"},Bn={type:"FINANCIAL_AID_ID",regex:/\b(?:FINANCIAL[-\s]?AID|FAFSA|AID[-\s]?APPLICATION)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,14})\b/gi,placeholder:"[AID_{n}]",priority:90,severity:"high",description:"Financial aid and FAFSA identifiers"},kn={type:"DEGREE_NUMBER",regex:/\b(?:DEGREE|DIPLOMA|CERTIFICATE)[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,14})\b/gi,placeholder:"[DEGREE_{n}]",priority:80,severity:"high",description:"Degree and certificate numbers",validator:(t,e)=>/degree|diploma|certificate|graduation|credential/i.test(e)},Hn={type:"EXAM_ID",regex:/\b(?:EXAM|TEST|QUIZ|ASSESSMENT)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[EXAM_{n}]",priority:75,severity:"medium",description:"Examination and test identifiers",validator:(t,e)=>/exam|test|quiz|assessment|midterm|final|score/i.test(e)},Fn={type:"EXAM_REGISTRATION_NUMBER",regex:/\bEXAM[-\s]?(\d{4}[-]\d{4})\b/gi,placeholder:"[EXAM_REG_{n}]",priority:80,severity:"high",description:"Exam registration numbers (standardized format)"},Zn={type:"HOUSING_ASSIGNMENT",regex:/\b(?:DORM|ROOM|HOUSING)[-\s]?(?:NO|NUM(?:BER)?|ASSIGNMENT)?[-\s]?[:#]?\s*([A-Z0-9]{4,10})\b/gi,placeholder:"[HOUSING_{n}]",priority:75,severity:"medium",description:"Dormitory and housing assignments",validator:(t,e)=>/dorm|housing|residence|room|building|floor|suite/i.test(e)},Gn={type:"MEAL_PLAN_ID",regex:/\b(?:MEAL[-\s]?PLAN|DINING)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[MEAL_{n}]",priority:70,severity:"medium",description:"Meal plan and dining identifiers"},$n={type:"PARKING_PERMIT",regex:/\b(?:PARKING)[-\s]?(?:PERMIT|PASS|DECAL)[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[PARKING_{n}]",priority:70,severity:"low",description:"Parking permit numbers"},Kn={type:"SCHOLARSHIP_ID",regex:/\b(?:SCHOLARSHIP|GRANT|AWARD)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[SCHOLARSHIP_{n}]",priority:80,severity:"high",description:"Scholarship and grant award numbers",validator:(t,e)=>/scholarship|grant|award|fellowship|stipend|financial/i.test(e)},Wn={type:"GRADUATION_YEAR",regex:/\b(?:CLASS[-\s]?OF|GRADUATING[-\s]?CLASS|GRAD(?:UATION)?[-\s]?YEAR)[-\s]?[:#]?\s*(['']?\d{2}|[12]\d{3})\b/gi,placeholder:"[GRAD_YEAR_{n}]",priority:65,severity:"low",description:"Graduation year references"},Yn={type:"APPLICATION_ID",regex:/\b(?:APPLICATION|ADMISSION|APPLICANT)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,14})\b/gi,placeholder:"[APPLICATION_{n}]",priority:85,severity:"high",description:"Admissions application identifiers",validator:(t,e)=>/application|admission|applicant|prospective|admit|enroll/i.test(e)},zn={type:"ALUMNI_ID",regex:/\b(?:ALUMNI|ALUMNUS|ALUMNA)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[ALUMNI_{n}]",priority:75,severity:"medium",description:"Alumni identification numbers"},Vn={type:"RESEARCH_GRANT",regex:/\b(?:GRANT|RESEARCH|FUNDING)[-\s]?(?:NO|NUM(?:BER)?|ID|REF)?[-\s]?[:#]?\s*([A-Z]{2,4}[-]?\d{6,10})\b/gi,placeholder:"[GRANT_{n}]",priority:75,severity:"medium",description:"Research grant and funding numbers",validator:(t,e)=>/grant|research|funding|nsf|nih|award|project/i.test(e)},jn={type:"DEPARTMENT_CODE",regex:/\b(?:DEPT|DEPARTMENT)[-\s]?(?:CODE)?[-\s]?[:#]?\s*([A-Z]{3,6})\b/g,placeholder:"[DEPT_{n}]",priority:55,severity:"low",description:"Academic department codes",validator:(t,e)=>{let r=/department|college|school|faculty|division/i.test(e),i=t.length>=3;return r&&i}},St=[Pn,On,Dn,Mn,xn,Ln,Un,wn,Bn,kn,Hn,Fn,Zn,Gn,$n,Kn,Wn,Yn,zn,Vn,jn],qn={type:"EMPLOYEE_ID",regex:/\b(?:EMPLOYEE|EMP|STAFF|PERSONNEL|WORKER)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z]{0,2}\d{4,10})\b/gi,placeholder:"[EMP_ID_{n}]",priority:90,severity:"high",description:"Employee identification numbers"},Xn={type:"PAYROLL_NUMBER",regex:/\b(?:PAYROLL|PAY)[-\s]?(?:NO|NUM(?:BER)?|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[PAYROLL_{n}]",priority:90,severity:"high",description:"Payroll identification numbers",validator:(t,e)=>/payroll|salary|compensation|pay|wage|earning/i.test(e)},Jn={type:"SALARY_AMOUNT",regex:/\b(?:SALARY|COMPENSATION|PAY|WAGE|EARNING)[-\s]?[:#]?\s*(?:[$£€¥]\s?)?(\d{1,3}(?:[,\s]\d{3})*(?:\.\d{2})?)\b/gi,placeholder:"[SALARY_{n}]",priority:85,severity:"high",description:"Salary and compensation amounts",validator:(t,e)=>{let r=/salary|compensation|pay|wage|earning|income|annual|hourly/i.test(e),i=parseInt(t.replace(/[,\s]/g,""));return r&&i>=1e3}},Qn={type:"PERFORMANCE_REVIEW_ID",regex:/\b(?:PERFORMANCE|REVIEW|APPRAISAL|EVALUATION)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[REVIEW_{n}]",priority:80,severity:"high",description:"Performance review and appraisal identifiers",validator:(t,e)=>/performance|review|appraisal|evaluation|rating|assessment/i.test(e)},ea={type:"JOB_APPLICATION_ID",regex:/\b(?:APPLICATION|CANDIDATE|APPLICANT)[-\s]?(?:ID|NO|NUM(?:BER)?|REF)?[-\s]?[:#]?\s*([A-Z0-9]{6,14})\b/gi,placeholder:"[APPLICATION_{n}]",priority:85,severity:"high",description:"Job application and candidate identifiers",validator:(t,e)=>/application|candidate|applicant|job|position|recruit|hiring/i.test(e)},ta={type:"RESUME_ID",regex:/\b(?:RESUME|CV|CURRICULUM[-\s]?VITAE)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[RESUME_{n}]",priority:75,severity:"medium",description:"Resume and CV identifiers"},ra={type:"BENEFITS_PLAN_NUMBER",regex:/\b(?:BENEFITS?|INSURANCE|HEALTH[-\s\u00A0]?PLAN)[-\s\u00A0]*(?:PLAN)?[-\s\u00A0]*(?:NO|NUM(?:BER)?|ID)?[-\s\u00A0.:#]*([A-Z0-9](?:[A-Z0-9][\s\u00A0./-]?){5,15}[A-Z0-9])\b/gi,placeholder:"[BENEFITS_{n}]",priority:85,severity:"high",description:"Employee benefits and insurance plan numbers",validator:(t,e)=>{let r=t.replace(/[\s\u00A0./-]/g,""),i=/\d{4,}/.test(r),s=r.length>=6&&r.length<=14,n=/benefit|insurance|health|dental|vision|plan|policy|enrollment/i.test(e);return i&&s&&n}},ia={type:"RETIREMENT_ACCOUNT",regex:/\b(?:401K|403B|IRA|RETIREMENT|PENSION)[-\s]?(?:ACCOUNT)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,16})\b/gi,placeholder:"[RETIREMENT_{n}]",priority:90,severity:"high",description:"401(k), IRA, and retirement account numbers",validator:(t,e)=>/401k|403b|ira|retirement|pension|fund|invest|contribution/i.test(e)},sa={type:"DIRECT_DEPOSIT_REF",regex:/\b(?:DIRECT[-\s]?DEPOSIT|DD|ROUTING)[-\s]?(?:NO|NUM(?:BER)?|ID)?[-\s]?[:#]?\s*(\d{9})\b/g,placeholder:"[DD_{n}]",priority:90,severity:"high",description:"Direct deposit and routing numbers",validator:(t,e)=>/direct[-\s]?deposit|routing|bank|account|payroll|pay/i.test(e)},na={type:"BACKGROUND_CHECK_ID",regex:/\b(?:BACKGROUND[-\s]?CHECK|BGC|SCREENING)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,14})\b/gi,placeholder:"[BGC_{n}]",priority:85,severity:"high",description:"Background check and screening identifiers"},aa={type:"DRUG_TEST_ID",regex:/\b(?:DRUG[-\s]?TEST|SCREENING|URINALYSIS)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,14})\b/gi,placeholder:"[DRUG_TEST_{n}]",priority:85,severity:"high",description:"Drug test and screening identifiers",validator:(t,e)=>/drug|test|screening|urinalysis|specimen|sample/i.test(e)},oa={type:"TIMESHEET_NUMBER",regex:/\b(?:TIMESHEET|TIMECARD|TIME[-\s]?ENTRY)[-\s]?(?:NO|NUM(?:BER)?|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[TIMESHEET_{n}]",priority:75,severity:"medium",description:"Timesheet and timecard numbers"},ca={type:"TRAINING_CERT_ID",regex:/\b(?:TRAINING|CERTIFICATION|CERT)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[TRAINING_{n}]",priority:70,severity:"medium",description:"Training and certification identifiers",validator:(t,e)=>/training|certification|cert|course|completion|credential/i.test(e)},la={type:"EXPENSE_REPORT_NUMBER",regex:/\b(?:EXPENSE|REIMBURSEMENT)[-\s]?(?:REPORT)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[EXPENSE_{n}]",priority:75,severity:"medium",description:"Expense report and reimbursement numbers",validator:(t,e)=>/expense|reimbursement|travel|claim|receipt/i.test(e)},da={type:"LEAVE_REQUEST_ID",regex:/\b(?:PTO|LEAVE|VACATION|TIME[-\s]?OFF)[-\s]?(?:REQUEST)?[-\s]?(?:NO|NUM(?:BER)?|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[LEAVE_{n}]",priority:75,severity:"medium",description:"Leave request and time-off identifiers",validator:(t,e)=>/pto|leave|vacation|time[-\s]?off|absence|sick|personal/i.test(e)},ua={type:"EXIT_INTERVIEW_ID",regex:/\b(?:EXIT|TERMINATION|SEPARATION)[-\s]?(?:INTERVIEW)?[-\s]?(?:NO|NUM(?:BER)?|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[EXIT_{n}]",priority:80,severity:"high",description:"Exit interview and termination identifiers",validator:(t,e)=>/exit|termination|separation|offboard|departure|resign/i.test(e)},pa={type:"DISCIPLINARY_ACTION_ID",regex:/\b(?:DISCIPLINARY|INCIDENT|WARNING|VIOLATION)[-\s\u00A0]*(?:ACTION)?[-\s\u00A0]*(?:NO|NUM(?:BER)?|ID)?[-\s\u00A0.:#]*([A-Z0-9](?:[A-Z0-9][\s\u00A0./-]?){5,15}[A-Z0-9])\b/gi,placeholder:"[DISCIPLINE_{n}]",priority:85,severity:"high",description:"Disciplinary action and incident identifiers",validator:(t,e)=>{let r=t.replace(/[\s\u00A0./-]/g,""),i=/\d{3,}/.test(r),s=r.length>=6&&r.length<=12;return i&&s&&/disciplinary|incident|warning|violation|misconduct|investigation/i.test(e)}},ha={type:"EMERGENCY_CONTACT_REF",regex:/\b(?:EMERGENCY[-\s]?CONTACT|ICE)[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[EMERGENCY_{n}]",priority:85,severity:"high",description:"Emergency contact reference numbers",validator:(t,e)=>/emergency|contact|ice|next[-\s]?of[-\s]?kin/i.test(e)},ga={type:"WORK_PERMIT",regex:/\b(?:WORK[-\s]?PERMIT|VISA|H1B|GREEN[-\s]?CARD|EAD)[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,15})\b/gi,placeholder:"[WORK_PERMIT_{n}]",priority:90,severity:"high",description:"Work permits, visas, and immigration documents"},ma={type:"SECURITY_CLEARANCE",regex:/\b(?:CLEARANCE|SECURITY[-\s]?LEVEL)[-\s]?[:#]?\s*(TOP[-\s]?SECRET|SECRET|CONFIDENTIAL|[A-Z]{2,3}\/SCI)\b/gi,placeholder:"[CLEARANCE_{n}]",priority:90,severity:"high",description:"Security clearance levels and classifications"},Ea={type:"RECRUITER_REF",regex:/\b(?:RECRUITER|AGENCY)[-\s]?(?:REF|ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[RECRUITER_{n}]",priority:70,severity:"medium",description:"Recruitment agency reference numbers",validator:(t,e)=>/recruiter|agency|headhunter|placement|referral/i.test(e)},Pt=[qn,Xn,Jn,Qn,ea,ta,ra,ia,sa,na,aa,oa,ca,la,da,ua,pa,ha,ga,ma,Ea],fa={type:"CLAIM_ID",regex:/\bCLAIM[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*(\d{8,12})\b/gi,placeholder:"[CLAIM_{n}]",priority:90,severity:"high",description:"Insurance claim identification numbers",validator:(t,e)=>/claim|insurance|policy|accident|loss|damage|settlement/i.test(e)},Aa={type:"POLICY_NUMBER",regex:/\bPOLICY[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z]{2,4}\d{6,10})\b/gi,placeholder:"[POLICY_{n}]",priority:90,severity:"high",description:"Insurance policy numbers"},ya={type:"POLICY_HOLDER_ID",regex:/\b(?:POLICY[-\s]?HOLDER|INSURED|POLICYHOLDER)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9-]{8,14})\b/gi,placeholder:"[HOLDER_{n}]",priority:85,severity:"high",description:"Policy holder identification numbers"},Ia={type:"QUOTE_REFERENCE",regex:/\b(?:QUOTE|QTE)[-\s]?(?:REF(?:ERENCE)?|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,14})\b/gi,placeholder:"[QUOTE_{n}]",priority:75,severity:"medium",description:"Insurance quote reference numbers",validator:(t,e)=>/quote|quotation|estimate|premium|insurance/i.test(e)},_a={type:"INSURANCE_CERTIFICATE",regex:/\b(?:CERTIFICATE|CERT)[-\s]?(?:OF[-\s]?INSURANCE)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,14})\b/gi,placeholder:"[CERT_{n}]",priority:80,severity:"high",description:"Insurance certificate numbers",validator:(t,e)=>/certificate|insurance|coverage|proof/i.test(e)},Na={type:"ADJUSTER_ID",regex:/\b(?:ADJUSTER|ADJ)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[ADJUSTER_{n}]",priority:75,severity:"medium",description:"Insurance adjuster identification numbers",validator:(t,e)=>/adjuster|claims|inspector|evaluator/i.test(e)},Ra={type:"UNDERWRITER_ID",regex:/\b(?:UNDERWRITER|UW)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[UW_{n}]",priority:75,severity:"medium",description:"Insurance underwriter identification numbers",validator:(t,e)=>/underwriter|underwriting|policy|risk|assessment/i.test(e)},Ta={type:"INCIDENT_REPORT_NUMBER",regex:/\b(?:INCIDENT|ACCIDENT)[-\s]?(?:REPORT)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,14})\b/gi,placeholder:"[INCIDENT_{n}]",priority:85,severity:"high",description:"Incident and accident report numbers",validator:(t,e)=>/incident|accident|report|event|occurrence|loss/i.test(e)},ba={type:"PREMIUM_PAYMENT_REF",regex:/\b(?:PREMIUM)[-\s]?(?:PAYMENT)?[-\s]?(?:REF(?:ERENCE)?|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,14})\b/gi,placeholder:"[PREMIUM_{n}]",priority:80,severity:"medium",description:"Premium payment reference numbers"},Ca={type:"REINSURANCE_TREATY",regex:/\b(?:REINSURANCE|TREATY)[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,14})\b/gi,placeholder:"[TREATY_{n}]",priority:75,severity:"medium",description:"Reinsurance treaty numbers",validator:(t,e)=>/reinsurance|treaty|cession|facultative/i.test(e)},Ot=[fa,Aa,ya,Ia,_a,Na,Ra,Ta,ba,Ca],va={type:"ORDER_NUMBER",regex:/\b(?:ORD(?:ER)?[-\s](?:NO|NUM(?:BER)?)?[-\s:#]?\s*|ORDER\s+(?:NO|NUM(?:BER)?)?[:\s]+)([A-Z0-9-]{8,14})\b/gi,placeholder:"[ORDER_{n}]",priority:90,severity:"medium",description:"E-commerce order numbers",validator:(t,e)=>/\d/.test(t)},Sa={type:"LOYALTY_CARD_NUMBER",regex:/\bLOYALTY[-\s]?(?:CARD)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*(\d{10,16})\b/gi,placeholder:"[LOYALTY_{n}]",priority:80,severity:"medium",description:"Customer loyalty card numbers",validator:(t,e)=>/loyalty|rewards|points|membership|customer/i.test(e)},Pa={type:"CUSTOMER_ID",regex:/\b(?:CUSTOMER|CUST)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,14})\b/gi,placeholder:"[CUSTOMER_{n}]",priority:85,severity:"high",description:"Customer identification numbers",validator:(t,e)=>/customer|account|profile|user|buyer/i.test(e)},Oa={type:"DEVICE_ID_TAG",regex:/\bDEVID:([A-F0-9]{16})\b/gi,placeholder:"[DEVICE_{n}]",priority:75,severity:"medium",description:"Device identification tags"},Da={type:"GIFT_CARD_NUMBER",regex:/\b(?:GIFT[-\s]?CARD|GC)[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*(\d{12,19})\b/gi,placeholder:"[GIFTCARD_{n}]",priority:85,severity:"high",description:"Gift card numbers",validator:(t,e)=>/gift|card|voucher|coupon|certificate/i.test(e)},Ma={type:"RMA_NUMBER",regex:/\b(?:RMA|RETURN)[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,14})\b/gi,placeholder:"[RMA_{n}]",priority:80,severity:"medium",description:"Return merchandise authorization numbers",validator:(t,e)=>/rma|return|refund|exchange|merchandise/i.test(e)},xa={type:"SHIPPING_TRACKING",regex:/\b(?:TRACKING|TRACK)[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{10,30})\b/gi,placeholder:"[TRACKING_{n}]",priority:75,severity:"medium",description:"Shipping and delivery tracking numbers",validator:(t,e)=>/tracking|shipment|delivery|package|parcel|courier/i.test(e)},La={type:"INVOICE_NUMBER",regex:/\b(?:INVOICE|INV)[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,14})\b/gi,placeholder:"[INVOICE_{n}]",priority:80,severity:"medium",description:"Invoice numbers",validator:(t,e)=>/invoice|bill|payment|receipt|purchase/i.test(e)},Ua={type:"CART_SESSION_ID",regex:/\b(?:CART|SESSION)[-\s]?(?:ID)?[-\s]?[:#]?\s*([a-f0-9]{32,64})\b/gi,placeholder:"[CART_{n}]",priority:70,severity:"low",description:"Shopping cart session identifiers",validator:(t,e)=>/cart|session|basket|checkout/i.test(e)},wa={type:"PROMO_CODE",regex:/\b(?:PROMO|COUPON|DISCOUNT)[-\s]?(?:CODE)?[-\s]?[:#]?\s*([A-Z0-9]{6,16})\b/gi,placeholder:"[PROMO_{n}]",priority:65,severity:"low",description:"Promotional and coupon codes",validator:(t,e)=>/promo|coupon|discount|code|voucher|offer/i.test(e)},Ba={type:"WISHLIST_ID",regex:/\b(?:WISHLIST|WISH[-\s]?LIST)[-\s]?(?:ID)?[-\s]?[:#]?\s*([A-Z0-9]{8,16})\b/gi,placeholder:"[WISHLIST_{n}]",priority:70,severity:"low",description:"Customer wishlist identifiers",validator:(t,e)=>/wishlist|wish|list|saved|favorite/i.test(e)},ka={type:"PRODUCT_SKU",regex:/\bSKU[-\s]?[:#]?\s*([A-Z0-9]{6,16})\b/gi,placeholder:"[SKU_{n}]",priority:60,severity:"low",description:"Product stock keeping units"},Dt=[va,Sa,Pa,Oa,Da,Ma,xa,La,Ua,wa,Ba,ka],Ha={type:"TELECOMS_ACCOUNT_NUMBER",regex:/\bACC(?:OUNT)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*(\d{8,12})\b/gi,placeholder:"[ACCOUNT_{n}]",priority:90,severity:"high",description:"Telecommunications customer account numbers",validator:(t,e)=>/account|customer|subscriber|service|utility|telecom/i.test(e)},Fa={type:"METER_SERIAL_NUMBER",regex:/\bMTR[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*(\d{8,12})\b/gi,placeholder:"[METER_{n}]",priority:85,severity:"high",description:"Utility meter serial numbers"},Za={type:"IMSI_NUMBER",regex:/\bIMSI[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*(\d{15})\b/gi,placeholder:"[IMSI_{n}]",priority:90,severity:"high",description:"International Mobile Subscriber Identity numbers"},Ga={type:"IMEI_NUMBER",regex:/\bIMEI[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*(\d{15})\b/gi,placeholder:"[IMEI_{n}]",priority:90,severity:"high",description:"International Mobile Equipment Identity numbers"},$a={type:"SIM_CARD_NUMBER",regex:/\bSIM[-\s]?(?:CARD)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*(\d{19,20})\b/gi,placeholder:"[SIM_{n}]",priority:85,severity:"high",description:"SIM card identification numbers",validator:(t,e)=>/sim|card|mobile|cellular|phone/i.test(e)},Ka={type:"SERVICE_REQUEST_NUMBER",regex:/\b(?:SERVICE|SR)[-\s]?(?:REQUEST)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,14})\b/gi,placeholder:"[SERVICE_{n}]",priority:80,severity:"medium",description:"Service request and ticket numbers",validator:(t,e)=>/service|request|ticket|support|maintenance|repair/i.test(e)},Wa={type:"UTILITY_BILL_ACCOUNT",regex:/\b(?:BILL|BILLING)[-\s]?(?:ACCOUNT)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*(\d{8,14})\b/gi,placeholder:"[BILL_{n}]",priority:85,severity:"high",description:"Utility billing account numbers",validator:(t,e)=>/bill|billing|utility|electric|gas|water|energy/i.test(e)},Ya={type:"INSTALLATION_REF",regex:/\b(?:INSTALLATION|INSTALL)[-\s]?(?:REF(?:ERENCE)?|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,14})\b/gi,placeholder:"[INSTALL_{n}]",priority:75,severity:"medium",description:"Installation reference numbers",validator:(t,e)=>/installation|install|setup|deployment|activation/i.test(e)},za={type:"PHONE_LINE_NUMBER",regex:/\b(?:LINE|NUMBER)[-\s]?(?:NO)?[-\s]?[:#]?\s*(\d{3}[-\s]?\d{3}[-\s]?\d{4})\b/g,placeholder:"[PHONE_{n}]",priority:90,severity:"high",description:"Phone line numbers",validator:(t,e)=>/phone|line|number|mobile|landline|telephone/i.test(e)},Va={type:"BROADBAND_SERVICE_ID",regex:/\b(?:BROADBAND|INTERNET|ISP)[-\s]?(?:SERVICE)?[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,16})\b/gi,placeholder:"[BROADBAND_{n}]",priority:80,severity:"high",description:"Broadband and internet service identifiers",validator:(t,e)=>/broadband|internet|isp|connection|service/i.test(e)},ja={type:"EQUIPMENT_SERIAL",regex:/\b(?:EQUIPMENT|DEVICE|ROUTER|MODEM)[-\s]?(?:SERIAL)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{10,16})\b/gi,placeholder:"[EQUIPMENT_{n}]",priority:75,severity:"medium",description:"Equipment and device serial numbers",validator:(t,e)=>/equipment|device|router|modem|serial|hardware/i.test(e)},qa={type:"SMART_METER_ID",regex:/\b(?:SMART[-\s]?METER)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{10,16})\b/gi,placeholder:"[SMART_METER_{n}]",priority:85,severity:"high",description:"Smart meter identification numbers",validator:(t,e)=>/smart|meter|energy|electric|gas|monitoring/i.test(e)},Mt=[Ha,Fa,Za,Ga,$a,Ka,Wa,Ya,za,Va,ja,qa],Xa={type:"SUPPLIER_ID",regex:/\bSUPP(?:LIER)?[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z]{2}\d{5,8})\b/gi,placeholder:"[SUPPLIER_{n}]",priority:80,severity:"medium",description:"Supplier identification numbers"},Ja={type:"PART_NUMBER",regex:/\bP(?:ART)?N[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([0-9A-Z]{6,12})\b/gi,placeholder:"[PART_{n}]",priority:70,severity:"low",description:"Part numbers and component identifiers",validator:(t,e)=>/part|component|item|sku|product|inventory/i.test(e)},Qa={type:"PURCHASE_ORDER_NUMBER",regex:/\bP(?:URCHASE[-\s]?)?O(?:RDER)?[-\s]+(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,14})\b/gi,placeholder:"[PO_{n}]",priority:85,severity:"medium",description:"Purchase order numbers"},eo={type:"WORK_ORDER_NUMBER",regex:/\bW(?:ORK[-\s]?)?O(?:RDER)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[WO_{n}]",priority:80,severity:"medium",description:"Work order numbers",validator:(t,e)=>/work|order|job|task|production/i.test(e)},to={type:"BATCH_LOT_NUMBER",regex:/\b(?:BATCH|LOT)[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,14})\b/gi,placeholder:"[BATCH_{n}]",priority:75,severity:"medium",description:"Batch and lot numbers for manufacturing traceability",validator:(t,e)=>/batch|lot|production|manufacturing|quality/i.test(e)},ro={type:"MANUFACTURING_SERIAL",regex:/\b(?:SERIAL|SN)[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,16})\b/gi,placeholder:"[SERIAL_{n}]",priority:80,severity:"medium",description:"Product and component serial numbers",validator:(t,e)=>/serial|sn|product|device|unit|item/i.test(e)},io={type:"VENDOR_CODE",regex:/\bVEND(?:OR)?[-\s]?(?:CODE)?[-\s]?[:#]?\s*([A-Z0-9]{4,10})\b/gi,placeholder:"[VENDOR_{n}]",priority:75,severity:"medium",description:"Vendor codes and identifiers",validator:(t,e)=>/vendor|supplier|partner|contractor/i.test(e)},so={type:"BOM_NUMBER",regex:/\bBOM[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[BOM_{n}]",priority:75,severity:"medium",description:"Bill of materials numbers",validator:(t,e)=>/bom|bill|materials|assembly|component/i.test(e)},no={type:"QC_CERTIFICATE_NUMBER",regex:/\b(?:QC|QUALITY)[-\s]?(?:CERT(?:IFICATE)?)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,14})\b/gi,placeholder:"[QC_{n}]",priority:80,severity:"medium",description:"Quality control certificate numbers",validator:(t,e)=>/quality|qc|certificate|inspection|test|compliance/i.test(e)},ao={type:"CONTAINER_NUMBER",regex:/\b(?:CONTAINER|CNTR)[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z]{4}\d{7})\b/gi,placeholder:"[CONTAINER_{n}]",priority:80,severity:"medium",description:"Shipping container numbers (ISO 6346 format)",validator:t=>/^[A-Z]{4}\d{7}$/.test(t)},oo={type:"PALLET_ID",regex:/\bPALLET[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,14})\b/gi,placeholder:"[PALLET_{n}]",priority:70,severity:"low",description:"Pallet identification numbers",validator:(t,e)=>/pallet|shipping|warehouse|logistics/i.test(e)},co={type:"ROUTING_NUMBER_MFG",regex:/\bROUTING[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[ROUTING_{n}]",priority:75,severity:"medium",description:"Manufacturing routing numbers",validator:(t,e)=>/routing|manufacturing|process|production|workflow/i.test(e)},lo={type:"RFQ_NUMBER",regex:/\bRFQ[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[RFQ_{n}]",priority:75,severity:"medium",description:"Request for quote numbers",validator:(t,e)=>/rfq|quote|quotation|request|procurement/i.test(e)},uo={type:"PROJECT_CODE",regex:/\b(?:PROJECT|PROJ)[-\s]+(?:CODE)?[-\s]?[:#]?\s*([A-Z0-9]{4,10})\b/gi,placeholder:"[PROJECT_{n}]",priority:70,severity:"low",description:"Internal project codes",validator:(t,e)=>/project|proj|initiative|program|code\s*[:#]/i.test(e)},xt=[Xa,Ja,Qa,eo,to,ro,io,so,no,ao,oo,co,lo,uo],po={type:"VIN",regex:/\bVIN[-\s]?[:#]?\s*([A-HJ-NPR-Z0-9]{17})\b/gi,placeholder:"[VIN_{n}]",priority:90,severity:"high",description:"Vehicle Identification Number",validator:t=>t.length===17&&/^[A-HJ-NPR-Z0-9]{17}$/.test(t)},ho={type:"LICENSE_PLATE",regex:/\b(?:LICENSE|PLATE|REG(?:ISTRATION)?)[-\s]?(?:NO|NUM(?:BER)?|PLATE)?[-\s]?[:#]?\s*([A-Z0-9]{2,8})\b/gi,placeholder:"[PLATE_{n}]",priority:85,severity:"high",description:"Vehicle license plate numbers",validator:(t,e)=>/license|plate|registration|vehicle|car|auto/i.test(e)},go={type:"FLEET_VEHICLE_ID",regex:/\b(?:FLEET|VEHICLE)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[FLEET_{n}]",priority:80,severity:"medium",description:"Fleet vehicle identification numbers",validator:(t,e)=>/fleet|vehicle|car|truck|van|unit/i.test(e)},mo={type:"TELEMATICS_DEVICE_ID",regex:/\b(?:TELEMATICS|GPS[-\s]?DEVICE)[-\s]?(?:ID)?[-\s]?[:#]?\s*([A-Z0-9]{10,16})\b/gi,placeholder:"[TELEMATICS_{n}]",priority:80,severity:"medium",description:"Telematics and GPS device identifiers",validator:(t,e)=>/telematics|gps|tracking|device|monitor/i.test(e)},Eo={type:"BOOKING_NUMBER",regex:/\b(?:BOOKING|RESERVATION|RES)[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[BOOKING_{n}]",priority:80,severity:"medium",description:"Transportation booking and reservation numbers",validator:(t,e)=>/booking|reservation|ticket|travel|flight|train|bus/i.test(e)},fo={type:"DRIVER_ID",regex:/\bDRIVER[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[DRIVER_{n}]",priority:85,severity:"high",description:"Driver identification numbers",validator:(t,e)=>/driver|operator|chauffeur/i.test(e)},Ao={type:"SHIPMENT_TRACKING",regex:/\b(?:SHIPMENT|TRACKING)[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{10,30})\b/gi,placeholder:"[SHIPMENT_{n}]",priority:75,severity:"medium",description:"Shipment tracking numbers",validator:(t,e)=>/shipment|tracking|delivery|freight|cargo/i.test(e)},yo={type:"TOLL_TAG_ID",regex:/\b(?:TOLL[-\s]?TAG|E[-]?ZPASS|TRANSPONDER)[-\s]?(?:ID)?[-\s]?[:#]?\s*([A-Z0-9]{8,16})\b/gi,placeholder:"[TOLL_{n}]",priority:80,severity:"medium",description:"Toll tag and transponder identifiers",validator:(t,e)=>/toll|tag|ezpass|transponder|fastrak/i.test(e)},Io={type:"INSPECTION_CERTIFICATE",regex:/\b(?:INSPECTION|INSP)[-\s]?(?:CERT(?:IFICATE)?)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,14})\b/gi,placeholder:"[INSPECTION_{n}]",priority:75,severity:"medium",description:"Vehicle inspection certificate numbers",validator:(t,e)=>/inspection|certificate|safety|emissions|test/i.test(e)},_o={type:"ODOMETER_READING_REF",regex:/\b(?:ODOMETER|MILEAGE)[-\s]?[:#]?\s*(\d{1,7})\s*(?:KM|MILES|MI)\b/gi,placeholder:"[ODO_{n}]",priority:70,severity:"low",description:"Odometer readings",validator:(t,e)=>/odometer|mileage|miles|km|reading/i.test(e)},No={type:"VEHICLE_INSURANCE_POLICY",regex:/\b(?:AUTO|VEHICLE|CAR)[-\s]?(?:INSURANCE)?[-\s]?(?:POLICY)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z]{2,4}\d{6,10})\b/gi,placeholder:"[AUTO_POLICY_{n}]",priority:85,severity:"high",description:"Vehicle insurance policy numbers",validator:(t,e)=>/auto|vehicle|car|insurance|policy|coverage/i.test(e)},Ro={type:"TRIP_ID",regex:/\b(?:TRIP|RIDE)[-\s]?(?:ID)?[-\s]?[:#]?\s*([A-Z0-9]{8,20})\b/gi,placeholder:"[TRIP_{n}]",priority:80,severity:"medium",description:"Trip and ride identification numbers",validator:(t,e)=>/trip|ride|journey|fare|taxi|uber|lyft/i.test(e)},Lt=[po,ho,go,mo,Eo,fo,Ao,yo,Io,_o,No,Ro],To={type:"INTERVIEWEE_ID",regex:/\bINTV[-\s]?([A-Z]{1}\d{5})\b/gi,placeholder:"[INTERVIEWEE_{n}]",priority:85,severity:"high",description:"Interviewee identification numbers for anonymity"},bo={type:"SOURCE_ID",regex:/\bSOURCE[-\s]?(?:ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[SOURCE_{n}]",priority:90,severity:"high",description:"Confidential source identifiers",validator:(t,e)=>/source|informant|confidential|anonymous|whistleblower/i.test(e)},Co={type:"ARTICLE_ID",regex:/\b(?:ARTICLE|STORY)[-\s]?(?:ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[ARTICLE_{n}]",priority:70,severity:"low",description:"Article and story identification numbers",validator:(t,e)=>/article|story|piece|content|publication/i.test(e)},vo={type:"MANUSCRIPT_ID",regex:/\b(?:MANUSCRIPT|MS)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[MANUSCRIPT_{n}]",priority:75,severity:"medium",description:"Manuscript identification numbers",validator:(t,e)=>/manuscript|ms|draft|submission|review/i.test(e)},So={type:"PRESS_PASS_ID",regex:/\b(?:PRESS[-\s]?PASS|MEDIA[-\s]?CREDENTIAL)[-\s]?(?:ID|NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[PRESS_{n}]",priority:80,severity:"medium",description:"Press pass and media credential numbers",validator:(t,e)=>/press|media|credential|pass|journalist|reporter/i.test(e)},Po={type:"CONTRIBUTOR_ID",regex:/\b(?:CONTRIBUTOR|FREELANCER|WRITER)[-\s]?(?:ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[CONTRIBUTOR_{n}]",priority:75,severity:"medium",description:"Contributor and freelancer identification numbers",validator:(t,e)=>/contributor|freelancer|writer|author|journalist/i.test(e)},Oo={type:"PUBLISHING_CONTRACT",regex:/\b(?:PUBLISHING|PUB)[-\s]?(?:CONTRACT)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z0-9]{8,14})\b/gi,placeholder:"[PUB_CONTRACT_{n}]",priority:80,severity:"high",description:"Publishing contract numbers",validator:(t,e)=>/publishing|contract|agreement|deal|rights/i.test(e)},Do={type:"EDITORIAL_TICKET",regex:/\b(?:EDITORIAL|EDIT)[-\s]?(?:TICKET|TASK)?[-\s]?(?:ID|NO)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[EDIT_{n}]",priority:70,severity:"low",description:"Editorial ticket and task identifiers",validator:(t,e)=>/editorial|edit|task|ticket|assignment/i.test(e)},Mo={type:"SUBSCRIBER_ID",regex:/\bSUBSCRIBER[-\s]?(?:ID)?[-\s]?[:#]?\s*([A-Z0-9]{8,16})\b/gi,placeholder:"[SUBSCRIBER_{n}]",priority:85,severity:"high",description:"Subscriber identification numbers",validator:(t,e)=>/subscriber|subscription|member|account|reader/i.test(e)},xo={type:"ISBN",regex:/\bISBN[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*(\d{3}[-\s]?\d{1,5}[-\s]?\d{1,7}[-\s]?\d{1,7}[-\s]?\d{1})\b/gi,placeholder:"[ISBN_{n}]",priority:65,severity:"low",description:"International Standard Book Numbers"},Lo={type:"COPYRIGHT_REG",regex:/\b(?:COPYRIGHT|©)[-\s]?(?:REG(?:ISTRATION)?)?[-\s]?(?:NO|NUM(?:BER)?)?[-\s]?[:#]?\s*([A-Z]{2,3}\d{6,10})\b/gi,placeholder:"[COPYRIGHT_{n}]",priority:75,severity:"medium",description:"Copyright registration numbers",validator:(t,e)=>/copyright|registration|intellectual|property|rights/i.test(e)},Uo={type:"PRODUCTION_ID",regex:/\b(?:PRODUCTION|PROD)[-\s]?(?:ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[PRODUCTION_{n}]",priority:70,severity:"low",description:"Film and video production identifiers",validator:(t,e)=>/production|film|video|shoot|project/i.test(e)},Ut=[To,bo,Co,vo,So,Po,Oo,Do,Mo,xo,Lo,Uo],wo={type:"DONOR_ID",regex:/\b(?:DONOR|DON|D)[-_]?\d{6,10}\b/gi,placeholder:"[DONOR_ID_{n}]",priority:85,severity:"high",description:"Charitable donor identification numbers",validator:(t,e)=>/donor|donation|charitable|contribution|gift|philanthrop/i.test(e)},Bo={type:"DONATION_REFERENCE",regex:/\b(?:DONATION|DN|GIFT|CONTRIB)[-_]?\d{6,12}\b/gi,placeholder:"[DONATION_REF_{n}]",priority:80,severity:"medium",description:"Donation and contribution reference numbers"},ko={type:"UK_CHARITY_NUMBER",regex:/\b(?:Charity\s+(?:No|Number|Registration|Reg)\.?\s*:?\s*)?(\d{6,7}(?:-\d)?)\b/gi,placeholder:"[UK_CHARITY_{n}]",priority:75,severity:"low",description:"UK charity registration numbers",validator:(t,e)=>{let r=t.replace(/\D/g,"");return r.length>=6&&r.length<=8&&/charity|charitable|commission/i.test(e)}},Ho={type:"US_EIN",regex:/\b(?:EIN|Tax\s+ID|Federal\s+Tax\s+ID)\.?\s*:?\s*(\d{2}-\d{7})\b/gi,placeholder:"[EIN_{n}]",priority:90,severity:"high",description:"US Employer Identification Numbers (nonprofit tax IDs)",validator:(t,e)=>t.replace(/\D/g,"").length===9&&/nonprofit|charity|501\(c\)|tax[-\s]exempt|foundation/i.test(e)},Fo={type:"GRANT_REFERENCE",regex:/\b(?:GRANT|GR|G)[-_]?\d{6,12}\b/gi,placeholder:"[GRANT_REF_{n}]",priority:75,severity:"medium",description:"Grant and funding reference numbers",validator:(t,e)=>/grant|funding|award|endowment|foundation/i.test(e)},Zo={type:"BENEFICIARY_ID",regex:/\b(?:BENEFICIARY|BENEF|BEN|B)[-_]?\d{6,10}\b/gi,placeholder:"[BENEFICIARY_ID_{n}]",priority:90,severity:"high",description:"Charitable beneficiary identification numbers",validator:(t,e)=>/beneficiary|recipient|aid|assistance|service\s+user/i.test(e)},Go={type:"CAMPAIGN_CODE",regex:/\b(?:CAMPAIGN|CAMP|FC)[-_]?[A-Z0-9]{4,12}\b/gi,placeholder:"[CAMPAIGN_{n}]",priority:60,severity:"low",description:"Fundraising campaign reference codes"},$o={type:"GIFT_AID_REFERENCE",regex:/\b(?:GIFT\s*AID|GA)[-_]?\d{6,10}\b/gi,placeholder:"[GIFT_AID_{n}]",priority:80,severity:"medium",description:"UK Gift Aid declaration reference numbers",validator:(t,e)=>/gift\s*aid|tax\s+relief|declaration/i.test(e)},Ko={type:"VOLUNTEER_ID",regex:/\b(?:VOLUNTEER|VOL|V)[-_]?\d{6,10}\b/gi,placeholder:"[VOLUNTEER_ID_{n}]",priority:75,severity:"medium",description:"Volunteer identification numbers",validator:(t,e)=>/volunteer|volunteering|community\s+service/i.test(e)},Wo={type:"MEMBERSHIP_NUMBER",regex:/\b(?:MEMBER(?:SHIP)?|MEM|M)[-_]?\d{6,10}\b/gi,placeholder:"[MEMBER_{n}]",priority:70,severity:"medium",description:"Charity and association membership numbers",validator:(t,e)=>/member|membership|association|society|club/i.test(e)},Yo={type:"LEGACY_REFERENCE",regex:/\b(?:LEGACY|LEG|BEQUEST|BEQ)[-_]?\d{6,10}\b/gi,placeholder:"[LEGACY_{n}]",priority:85,severity:"high",description:"Legacy and bequest reference numbers",validator:(t,e)=>/legacy|bequest|will|estate|inheritance|in\s+memory/i.test(e)},wt=[wo,Bo,ko,Ho,Fo,Zo,Go,$o,Ko,Wo,Yo],zo={type:"PURCHASE_ORDER",regex:/\b(?:PO|Purchase\s+Order)[-#\s]?(\d{6,12})\b/gi,placeholder:"[PO_{n}]",priority:75,severity:"medium",description:"Purchase order numbers",validator:(t,e)=>/purchase|order|procurement|buying/i.test(e)},Vo={type:"RFQ_NUMBER",regex:/\b(?:RFQ|Request\s+for\s+Quotation)[-#\s]?(\d{6,12})\b/gi,placeholder:"[RFQ_{n}]",priority:70,severity:"medium",description:"Request for Quotation reference numbers"},jo={type:"RFP_NUMBER",regex:/\b(?:RFP|Request\s+for\s+Proposal)[-#\s]?(\d{6,12})\b/gi,placeholder:"[RFP_{n}]",priority:70,severity:"medium",description:"Request for Proposal reference numbers"},qo={type:"TENDER_REFERENCE",regex:/\b(?:TENDER|TN|T)[-_]?\d{6,12}\b/gi,placeholder:"[TENDER_{n}]",priority:75,severity:"medium",description:"Tender and bidding reference numbers",validator:(t,e)=>/tender|bid|bidding|procurement|competition/i.test(e)},Xo={type:"SUPPLIER_ID",regex:/\b(?:SUPPLIER|SUP|VENDOR|VEN)[-_]?\d{6,10}\b/gi,placeholder:"[SUPPLIER_ID_{n}]",priority:70,severity:"medium",description:"Supplier and vendor identification numbers",validator:(t,e)=>/supplier|vendor|provider|contractor/i.test(e)},Jo={type:"CONTRACT_REFERENCE",regex:/\b(?:CONTRACT|CON|C)[-_]?\d{6,12}\b/gi,placeholder:"[CONTRACT_{n}]",priority:80,severity:"medium",description:"Procurement contract reference numbers",validator:(t,e)=>/contract|agreement|procurement|supply/i.test(e)},Qo={type:"REQUISITION_NUMBER",regex:/\b(?:REQ|REQUISITION|PR|Purchase\s+Requisition)[-#\s]?(\d{6,12})\b/gi,placeholder:"[REQ_{n}]",priority:70,severity:"medium",description:"Purchase requisition numbers"},ec={type:"PCARD_REFERENCE",regex:/\b(?:P[-\s]?Card|Procurement\s+Card).*?(?:ending|last\s+4|XXXX)[-\s]?(\d{4})\b/gi,placeholder:"[PCARD_{n}]",priority:90,severity:"high",description:"Procurement card references (partial numbers)"},tc={type:"CATALOG_NUMBER",regex:/\b(?:CATALOG|CAT|PART|PN)[-#]?[A-Z0-9]{6,15}\b/gi,placeholder:"[CATALOG_{n}]",priority:60,severity:"low",description:"Catalog and part numbers",validator:(t,e)=>/catalog|part|sku|item|product/i.test(e)},rc={type:"QUOTATION_REFERENCE",regex:/\b(?:QUOTATION|QUOTE|QUO|Q)[-_]?\d{6,12}\b/gi,placeholder:"[QUOTE_{n}]",priority:70,severity:"medium",description:"Quotation reference numbers",validator:(t,e)=>/quot|price|estimate|proposal/i.test(e)},ic={type:"GOODS_RECEIPT",regex:/\b(?:GRN|Goods\s+Receipt)[-#\s]?(\d{6,12})\b/gi,placeholder:"[GRN_{n}]",priority:65,severity:"low",description:"Goods receipt note numbers"},sc={type:"FRAMEWORK_AGREEMENT",regex:/\b(?:FRAMEWORK|FWK|FA)[-_]?\d{6,12}\b/gi,placeholder:"[FRAMEWORK_{n}]",priority:75,severity:"medium",description:"Framework agreement reference numbers",validator:(t,e)=>/framework|agreement|procurement/i.test(e)},nc={type:"BLANKET_ORDER",regex:/\b(?:BLANKET|BO|Blanket\s+Order)[-#\s]?(\d{6,12})\b/gi,placeholder:"[BLANKET_ORDER_{n}]",priority:70,severity:"medium",description:"Blanket purchase order numbers"},Bt=[zo,Vo,jo,qo,Xo,Jo,Qo,ec,tc,rc,ic,sc,nc],ac={type:"EMERGENCY_CALL_REF",regex:/\b(?:EMERGENCY|INCIDENT|CALL|CAD|DISPATCH|EVENT)[-\s]?(?:REF|NO|NUM|NUMBER|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,15})\b/gi,placeholder:"[EMERGENCY_REF_{n}]",priority:95,severity:"high",description:"Emergency services call reference numbers",validator:(t,e)=>/emergency|911|999|112|ambulance|fire|police|dispatch|incident|call[- ]?center/i.test(e)},oc={type:"POLICE_REPORT_NUMBER",regex:/\b(?:POLICE|PR|RPT|REPORT|CASE)[-\s\u00A0]*(?:NO|NUM|NUMBER|ID)?[-\s\u00A0.:#]*((?:[A-Z]{2,4}[\s\u00A0./-]?\d{2,4}[\s\u00A0./-]?\d{4,10})|\d{4}[\s\u00A0./-]?\d{5,10})\b/gi,placeholder:"[POLICE_RPT_{n}]",priority:95,severity:"high",description:"Police report and case numbers",validator:(t,e)=>/police|officer|citation|arrest|detective|sheriff|trooper|constable|case[- ]?number/i.test(e)},cc={type:"FIRE_INCIDENT_NUMBER",regex:/\b(?:FIRE|FI|FD)[-\s\u00A0]*(?:INCIDENT|INC|NO|NUM|NUMBER|ID)?[-\s\u00A0.:#]*((?:[A-Z]{2,4}[\s\u00A0./-]?\d{2,4}[\s\u00A0./-]?\d{4,10})|\d{4}[\s\u00A0./-]?\d{4,8})\b/gi,placeholder:"[FIRE_INC_{n}]",priority:95,severity:"high",description:"Fire department incident numbers",validator:(t,e)=>/fire|firefighter|dept|department|incident|response|station|alarm/i.test(e)},lc={type:"AMBULANCE_CALL_ID",regex:/\b(?:AMBULANCE|AMB|EMS|PARAMEDIC)[-\s]?(?:CALL|ID|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,15})\b/gi,placeholder:"[AMB_CALL_{n}]",priority:90,severity:"high",description:"Ambulance and EMS call identifiers",validator:(t,e)=>/ambulance|ems|paramedic|emergency[- ]?medical|transport|patient[- ]?care/i.test(e)},dc={type:"PARAMEDIC_CERTIFICATION",regex:/\b(?:NREMT|EMT|PARAMEDIC)[-\s]?(?:P|B|A|I)?[-\s]?(?:CERT|LICENSE|LIC)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[PARAMEDIC_CERT_{n}]",priority:85,severity:"medium",description:"Paramedic and EMT certification numbers",validator:(t,e)=>/paramedic|emt|nremt|emergency[- ]?medical[- ]?tech|certification|license|certified|medic/i.test(e)},uc={type:"EMERGENCY_SHELTER_ID",regex:/\b(?:SHELTER|EVACUATION|REFUGE)[-\s]?(?:REG|ID|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{5,12})\b/gi,placeholder:"[SHELTER_ID_{n}]",priority:90,severity:"high",description:"Emergency shelter registration identifiers",validator:(t,e)=>/shelter|evacuation|refuge|displaced|disaster|emergency[- ]?housing/i.test(e)},pc={type:"DISASTER_VICTIM_ID",regex:/\b(?:DVI|VICTIM)[-\s]?(?:ID|NO|NUMBER)?[-\s]?[:#]?\s*(\d{4}[-\s]?\d{4,8})\b/gi,placeholder:"[DVI_{n}]",priority:95,severity:"high",description:"Disaster victim identification numbers",validator:(t,e)=>/disaster|victim|dvi|casualty|identification|mass[- ]?casualty|morgue/i.test(e)},hc={type:"SEARCH_RESCUE_MISSION_ID",regex:/\b(?:SAR|SEARCH|RESCUE|MISSION)[-\s]?(?:ID|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,15})\b/gi,placeholder:"[SAR_MISSION_{n}]",priority:90,severity:"high",description:"Search and rescue mission identifiers",validator:(t,e)=>/search|rescue|sar|mission|lost|missing|coast[- ]?guard/i.test(e)},gc={type:"EMERGENCY_MEDICAL_INCIDENT",regex:/\b(?:MEDICAL|MED|MI)[-\s]?(?:INCIDENT|INC|EMERGENCY|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,15})\b/gi,placeholder:"[MED_INC_{n}]",priority:90,severity:"high",description:"Emergency medical incident numbers",validator:(t,e)=>/medical|emergency|incident|patient|treatment|hospital|trauma/i.test(e)},mc={type:"FIREFIGHTER_BADGE",regex:/\b(?:BADGE|FF|FIREFIGHTER)[-\s]?(?:NO|NUM|NUMBER|ID)?[-\s]?[:#]?\s*(\d{3,6})\b/gi,placeholder:"[FF_BADGE_{n}]",priority:80,severity:"medium",description:"Firefighter badge numbers",validator:(t,e)=>/firefighter|fire[- ]?dept|badge|ff|station|apparatus/i.test(e)},Ec={type:"POLICE_BADGE",regex:/\b(?:BADGE|SHIELD|OFFICER)[-\s]?(?:NO|NUM|NUMBER|ID)?[-\s]?[:#]?\s*(\d{3,6})\b/gi,placeholder:"[POLICE_BADGE_{n}]",priority:80,severity:"medium",description:"Police officer badge numbers",validator:(t,e)=>/police|officer|badge|shield|dept|department|patrol/i.test(e)},fc={type:"MISSING_PERSON_CASE",regex:/\b(?:MISSING|MP|AMBER)[-\s]?(?:PERSON|CASE|ALERT)?[-\s]?(?:NO|NUMBER|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,15})\b/gi,placeholder:"[MISSING_CASE_{n}]",priority:95,severity:"high",description:"Missing person case numbers",validator:(t,e)=>/missing|amber|alert|person|child|endangered|located|found/i.test(e)},Ac={type:"DISPATCHER_ID",regex:/\b(?:DISPATCHER|DISP)[-\s]?(?:ID|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{3,8})\b/gi,placeholder:"[DISPATCHER_{n}]",priority:80,severity:"medium",description:"Emergency dispatcher identification numbers",validator:(t,e)=>/dispatcher|911|999|112|emergency|operator|call[- ]?center/i.test(e)},yc={type:"HAZMAT_INCIDENT",regex:/\b(?:HAZMAT|HM)[-\s]?(?:INCIDENT|INC|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,15})\b/gi,placeholder:"[HAZMAT_{n}]",priority:90,severity:"high",description:"Hazardous materials incident numbers",validator:(t,e)=>/hazmat|hazardous|material|chemical|spill|containment|decontamination/i.test(e)},kt=[ac,oc,cc,lc,dc,uc,pc,hc,gc,mc,Ec,fc,Ac,yc],Ic={type:"PROPERTY_PARCEL_NUMBER",regex:/\b(?:APN|PARCEL|ASSESSOR)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{3}[-\s]?\d{3}[-\s]?\d{3}(?:[-\s]?\d{1,3})?)\b/gi,placeholder:"[APN_{n}]",priority:85,severity:"high",description:"Property assessor parcel numbers",validator:(t,e)=>/property|parcel|assessor|land|real[- ]?estate|apn|tax|deed/i.test(e)},_c={type:"MLS_LISTING_NUMBER",regex:/\bMLS[-\s]?(?:NO|NUM|NUMBER|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[MLS_{n}]",priority:80,severity:"medium",description:"MLS (Multiple Listing Service) property listing numbers",validator:(t,e)=>/mls|listing|real[- ]?estate|property|broker|agent|sale|for[- ]sale/i.test(e)},Nc={type:"MORTGAGE_LOAN_NUMBER",regex:/\b(?:MORTGAGE|LOAN|MTG)[-\s]?(?:NO|NUM|NUMBER|ID|ACCOUNT)?[-\s]?[:#]?\s*([A-Z0-9]{8,14})\b/gi,placeholder:"[MORTGAGE_{n}]",priority:90,severity:"high",description:"Mortgage and home loan account numbers",validator:(t,e)=>/mortgage|loan|lender|lending|home[- ]?loan|refinance|foreclosure|escrow/i.test(e)},Rc={type:"PROPERTY_TAX_ACCOUNT",regex:/\b(?:PROPERTY[- ]?TAX|TAX|MUNICIPAL)[-\s]?(?:ACCOUNT|ACCT|NO|NUMBER|ID)?[-\s]?[:#]?\s*(\d{6,12})\b/gi,placeholder:"[TAX_ACCT_{n}]",priority:85,severity:"high",description:"Property tax account numbers",validator:(t,e)=>/property[- ]?tax|municipal|county|city|tax[- ]?bill|assessment|levy/i.test(e)},Tc={type:"HOA_ACCOUNT_NUMBER",regex:/\bHOA[-\s]?(?:ACCOUNT|ACCT|NO|NUMBER|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[HOA_{n}]",priority:80,severity:"medium",description:"HOA (Homeowners Association) account numbers",validator:(t,e)=>/hoa|homeowners|association|condo|dues|fee|community/i.test(e)},bc={type:"TITLE_DEED_NUMBER",regex:/\b(?:TITLE|DEED)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,14})\b/gi,placeholder:"[DEED_{n}]",priority:85,severity:"high",description:"Property title and deed numbers",validator:(t,e)=>/title|deed|recording|recorder|registry|land[- ]?registry|conveyance/i.test(e)},Cc={type:"REAL_ESTATE_LICENSE",regex:/\b(?:REAL[- ]?ESTATE|RE|BROKER)[-\s]?(?:LICENSE|LIC)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[RE_LIC_{n}]",priority:80,severity:"medium",description:"Real estate agent/broker license numbers",validator:(t,e)=>/real[- ]?estate|broker|agent|license|realtor|certified/i.test(e)},vc={type:"APPRAISAL_REFERENCE",regex:/\b(?:APPRAISAL|APPR)[-\s]?(?:NO|NUM|NUMBER|REF|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[APPR_{n}]",priority:75,severity:"medium",description:"Property appraisal reference numbers",validator:(t,e)=>/appraisal|appraiser|valuation|value|assessment|market[- ]?value/i.test(e)},Sc={type:"ESCROW_NUMBER",regex:/\bESCROW[-\s]?(?:NO|NUM|NUMBER|ACCOUNT|ACCT|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[ESCROW_{n}]",priority:85,severity:"high",description:"Escrow account numbers",validator:(t,e)=>/escrow|closing|settlement|title[- ]?company|transaction/i.test(e)},Pc={type:"LEASE_AGREEMENT_NUMBER",regex:/\b(?:LEASE|RENTAL)[-\s]?(?:AGREEMENT|CONTRACT|NO|NUM|NUMBER|ID)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[LEASE_{n}]",priority:75,severity:"medium",description:"Lease and rental agreement numbers",validator:(t,e)=>/lease|rental|tenant|landlord|rent|renter|apartment|unit/i.test(e)},Ht=[Ic,_c,Nc,Rc,Tc,bc,Cc,vc,Sc,Pc],Oc={type:"UBER_TRIP_ID",regex:/\bUBER[-\s]?(?:TRIP|RIDE)[-\s]?(?:ID|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{8,24})\b/gi,placeholder:"[UBER_TRIP_{n}]",priority:85,severity:"medium",description:"Uber trip/ride identifier",validator:(t,e)=>/uber|rideshare|ride|trip|driver|passenger/i.test(e)},Dc={type:"LYFT_RIDE_ID",regex:/\bLYFT[-\s]?(?:RIDE|TRIP)[-\s]?(?:ID|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{8,24})\b/gi,placeholder:"[LYFT_RIDE_{n}]",priority:85,severity:"medium",description:"Lyft ride identifier",validator:(t,e)=>/lyft|rideshare|ride|trip|driver|passenger/i.test(e)},Mc={type:"DOORDASH_ORDER_ID",regex:/\b(?:DOORDASH|DD)[-\s]?(?:ORDER|DELIVERY)[-\s]?(?:ID|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,20})\b/gi,placeholder:"[DD_ORDER_{n}]",priority:80,severity:"medium",description:"DoorDash order identifier",validator:(t,e)=>/doordash|dasher|delivery|order|food[- ]?delivery/i.test(e)},xc={type:"UBEREATS_ORDER_ID",regex:/\bUBER[-\s]?EATS[-\s]?(?:ORDER|DELIVERY)[-\s]?(?:ID|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,20})\b/gi,placeholder:"[UE_ORDER_{n}]",priority:80,severity:"medium",description:"Uber Eats order identifier",validator:(t,e)=>/uber[- ]?eats|delivery|order|food[- ]?delivery/i.test(e)},Lc={type:"GRUBHUB_ORDER_ID",regex:/\bGRUBHUB[-\s]?(?:ORDER)[-\s]?(?:ID|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,20})\b/gi,placeholder:"[GH_ORDER_{n}]",priority:80,severity:"medium",description:"Grubhub order identifier",validator:(t,e)=>/grubhub|delivery|order|food[- ]?delivery|restaurant/i.test(e)},Uc={type:"AIRBNB_RESERVATION_ID",regex:/\bAIRBNB[-\s]?(?:RESERVATION|BOOKING|CONF(?:IRMATION)?)[-\s]?(?:ID|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{9,16})\b/gi,placeholder:"[AIRBNB_RES_{n}]",priority:85,severity:"medium",description:"Airbnb reservation/booking identifier",validator:(t,e)=>/airbnb|reservation|booking|host|guest|stay|accommodation/i.test(e)},wc={type:"INSTACART_ORDER_ID",regex:/\bINSTACART[-\s]?(?:ORDER|DELIVERY)[-\s]?(?:ID|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,20})\b/gi,placeholder:"[IC_ORDER_{n}]",priority:80,severity:"medium",description:"Instacart order identifier",validator:(t,e)=>/instacart|shopper|grocery|delivery|order/i.test(e)},Bc={type:"TASKRABBIT_TASK_ID",regex:/\b(?:TASKRABBIT|TR)[-\s]?(?:TASK|JOB)[-\s]?(?:ID|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,16})\b/gi,placeholder:"[TR_TASK_{n}]",priority:75,severity:"medium",description:"TaskRabbit task identifier",validator:(t,e)=>/taskrabbit|tasker|task|job|service|handyman/i.test(e)},kc={type:"UPWORK_JOB_ID",regex:/\bUPWORK[-\s]?(?:JOB|CONTRACT|PROJECT)[-\s]?(?:ID|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{8,20})\b/gi,placeholder:"[UW_JOB_{n}]",priority:80,severity:"medium",description:"Upwork job/contract identifier",validator:(t,e)=>/upwork|freelance|contract|job|project|client|proposal/i.test(e)},Hc={type:"FIVERR_ORDER_ID",regex:/\bFIVERR[-\s]?(?:ORDER|GIG)[-\s]?(?:ID|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,16})\b/gi,placeholder:"[FV_ORDER_{n}]",priority:75,severity:"medium",description:"Fiverr order/gig identifier",validator:(t,e)=>/fiverr|seller|buyer|gig|order|freelance/i.test(e)},Fc={type:"POSTMATES_DELIVERY_ID",regex:/\bPOSTMATES[-\s]?(?:DELIVERY|ORDER)[-\s]?(?:ID|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,20})\b/gi,placeholder:"[PM_DEL_{n}]",priority:75,severity:"medium",description:"Postmates delivery identifier",validator:(t,e)=>/postmates|delivery|order|courier|food/i.test(e)},Zc={type:"GIG_PLATFORM_USER_ID",regex:/\b(?:DRIVER|DASHER|SHOPPER|TASKER|COURIER|RIDER)[-\s]?(?:ID|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,16})\b/gi,placeholder:"[GIG_USER_{n}]",priority:70,severity:"medium",description:"Gig economy platform user identifier",validator:(t,e)=>/driver|dasher|shopper|tasker|courier|rider|delivery|gig[- ]?economy|platform/i.test(e)},Gc={type:"GIG_PLATFORM_ORDER_ID",regex:/\b(?:ORDER|TRIP|DELIVERY|BOOKING)[-\s]?[:#]\s*([A-Z0-9]{8,20})\b/gi,placeholder:"[GIG_ORDER_{n}]",priority:65,severity:"medium",description:"Generic gig platform order/trip identifier",validator:(t,e)=>{let r=/uber|lyft|doordash|airbnb|instacart|taskrabbit|postmates|grubhub|delivery|rideshare/i.test(e),i=/order|trip|delivery|booking|ride|reservation/i.test(e);return r&&i&&t.length>=8}},Ft=[Oc,Dc,Mc,xc,Lc,Uc,wc,Bc,kc,Hc,Fc,Zc,Gc],$c={type:"AIRLINE_PNR",regex:/\b(?:PNR|BOOKING|CONFIRMATION)[-\s]?(?:NO|NUM|NUMBER|CODE)?[-\s]?[:#]?\s*([A-Z0-9]{6})\b/gi,placeholder:"[PNR_{n}]",priority:85,severity:"medium",description:"Airline Passenger Name Record (PNR)",validator:(t,e)=>t.length!==6?false:/airline|flight|booking|reservation|pnr|travel|passenger|ticket/i.test(e)},Kc={type:"HOTEL_RESERVATION",regex:/\b(?:HOTEL|RESERVATION|CONF(?:IRMATION)?|BOOKING)[-\s]?(?:NO|NUM|NUMBER|CODE)?[-\s]?[:#]?\s*([A-Z0-9]{6,14})\b/gi,placeholder:"[HOTEL_RES_{n}]",priority:80,severity:"medium",description:"Hotel reservation/confirmation number",validator:(t,e)=>/hotel|reservation|booking|room|accommodation|stay|check[-\s]?in|lodging/i.test(e)},Wc={type:"FREQUENT_FLYER_NUMBER",regex:/\b(?:FREQUENT[- ]?FLYER|FF|MILEAGE|LOYALTY)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[FF_NUM_{n}]",priority:75,severity:"medium",description:"Frequent flyer/loyalty program number",validator:(t,e)=>/frequent[- ]?flyer|miles|mileage|loyalty|rewards|member|airline/i.test(e)},Yc={type:"HOTEL_LOYALTY_NUMBER",regex:/\b(?:MEMBER|LOYALTY|REWARDS)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[HOTEL_LOYALTY_{n}]",priority:75,severity:"medium",description:"Hotel loyalty/rewards program number",validator:(t,e)=>/hotel|marriott|hilton|hyatt|ihg|loyalty|rewards|points|member/i.test(e)},zc={type:"CRUISE_BOOKING_NUMBER",regex:/\b(?:CRUISE|BOOKING|RESERVATION)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[CRUISE_{n}]",priority:75,severity:"medium",description:"Cruise line booking number",validator:(t,e)=>/cruise|ship|sailing|voyage|cabin|carnival|royal[- ]?caribbean|norwegian/i.test(e)},Vc={type:"TRAVEL_AGENCY_BOOKING",regex:/\b(?:TRAVEL|AGENCY|BOOKING|TRIP)[-\s]?(?:REF|REFERENCE|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[TRAVEL_REF_{n}]",priority:70,severity:"medium",description:"Travel agency booking reference",validator:(t,e)=>/travel[- ]?agency|tour|package|itinerary|booking|vacation/i.test(e)},jc={type:"RENTAL_CAR_CONFIRMATION",regex:/\b(?:RENTAL|CAR|VEHICLE)[-\s]?(?:CONF(?:IRMATION)?|RESERVATION|BOOKING)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[CAR_RENTAL_{n}]",priority:75,severity:"medium",description:"Rental car confirmation number",validator:(t,e)=>/rental|car|vehicle|hertz|enterprise|avis|budget|rent/i.test(e)},qc={type:"THEME_PARK_TICKET",regex:/\b(?:TICKET|PASS|ADMISSION)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{8,16})\b/gi,placeholder:"[TICKET_{n}]",priority:70,severity:"low",description:"Theme park or attraction ticket number",validator:(t,e)=>t.length<8?false:/theme[- ]?park|disney|universal|attraction|admission|ticket|pass|entry/i.test(e)},Xc={type:"TSA_PRECHECK_NUMBER",regex:/\b(?:TSA|PRECHECK|KTN|KNOWN[- ]?TRAVELER)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{9,10})\b/gi,placeholder:"[TSA_{n}]",priority:85,severity:"medium",description:"TSA PreCheck / Known Traveler Number",validator:(t,e)=>{let r=t.length;return r<9||r>10?false:/tsa|precheck|pre[- ]?check|ktn|known[- ]?traveler|security|screening/i.test(e)}},Jc={type:"GLOBAL_ENTRY_NUMBER",regex:/\b(?:GLOBAL[- ]?ENTRY|PASS[- ]?ID)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{9})\b/gi,placeholder:"[GLOBAL_ENTRY_{n}]",priority:85,severity:"medium",description:"Global Entry / PASS ID number",validator:(t,e)=>t.length!==9?false:/global[- ]?entry|pass[- ]?id|customs|immigration|cbp|trusted[- ]?traveler/i.test(e)},Zt=[$c,Kc,Wc,Yc,zc,Vc,jc,qc,Xc,Jc],Qc={type:"PMP_CERTIFICATION",regex:/\bPMP[-\s]?(?:ID|NO|NUM|NUMBER|CERT(?:IFICATION)?)?[-\s]?[:#]?\s*(\d{7,9})\b/gi,placeholder:"[PMP_{n}]",priority:80,severity:"medium",description:"PMP (Project Management Professional) certification number",validator:(t,e)=>{let r=t.length;return r<7||r>9?false:/pmp|project[- ]?management|pmi|certification|certified/i.test(e)}},el={type:"CPA_LICENSE",regex:/\bCPA[-\s]?(?:LICENSE|LIC|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{5,10})\b/gi,placeholder:"[CPA_{n}]",priority:85,severity:"medium",description:"CPA (Certified Public Accountant) license number",validator:(t,e)=>/cpa|certified[- ]?public[- ]?accountant|accountancy|license|accounting/i.test(e)},tl={type:"PE_LICENSE",regex:/\bPE[-\s]?(?:LICENSE|LIC|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{5,10})\b/gi,placeholder:"[PE_{n}]",priority:80,severity:"medium",description:"PE (Professional Engineer) license number",validator:(t,e)=>/professional[- ]?engineer|engineering|pe[- ]?license|registered[- ]?engineer/i.test(e)},rl={type:"NURSING_LICENSE",regex:/\b(?:RN|LPN|NP|NURSING)[-\s]?(?:LICENSE|LIC|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[RN_{n}]",priority:85,severity:"high",description:"Nursing license number (RN, LPN, NP)",validator:(t,e)=>/nurse|nursing|rn|lpn|registered[- ]?nurse|license|practitioner/i.test(e)},il={type:"TEACHING_LICENSE",regex:/\b(?:TEACHING|TEACHER|EDUCATOR)[-\s]?(?:LICENSE|LIC|CERT(?:IFICATE)?|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[TEACHER_{n}]",priority:80,severity:"medium",description:"Teaching certificate/license number",validator:(t,e)=>/teacher|teaching|educator|education|certificate|license|certified/i.test(e)},sl={type:"AWS_CERTIFICATION",regex:/\bAWS[-\s]?(?:CERT(?:IFICATION)?|ID|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{8,16})\b/gi,placeholder:"[AWS_CERT_{n}]",priority:75,severity:"low",description:"AWS (Amazon Web Services) certification ID",validator:(t,e)=>/aws|amazon[- ]?web[- ]?services|cloud|certification|certified|solutions[- ]?architect/i.test(e)},nl={type:"MICROSOFT_CERTIFICATION",regex:/\b(?:MICROSOFT|MCID|MS)[-\s]?(?:CERT(?:IFICATION)?|ID|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{8,16})\b/gi,placeholder:"[MS_CERT_{n}]",priority:75,severity:"low",description:"Microsoft certification ID (MCID)",validator:(t,e)=>/microsoft|mcid|azure|certification|certified|mcsa|mcse/i.test(e)},al={type:"CISCO_CERTIFICATION",regex:/\b(?:CISCO|CSCO)[-\s]?(?:CERT(?:IFICATION)?|ID|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{8,16})\b/gi,placeholder:"[CISCO_CERT_{n}]",priority:75,severity:"low",description:"Cisco certification ID",validator:(t,e)=>/cisco|ccna|ccnp|ccie|networking|certification|certified/i.test(e)},ol={type:"COMPTIA_CERTIFICATION",regex:/\bCOMPTIA[-\s]?(?:CERT(?:IFICATION)?|ID|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{8,16})\b/gi,placeholder:"[COMPTIA_{n}]",priority:75,severity:"low",description:"CompTIA certification ID",validator:(t,e)=>/comptia|a\+|security\+|network\+|certification|certified/i.test(e)},cl={type:"FINRA_LICENSE",regex:/\b(?:CRD|SERIES|FINRA)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{6,8})\b/gi,placeholder:"[FINRA_{n}]",priority:85,severity:"high",description:"FINRA license number (CRD, Series licenses)",validator:(t,e)=>{let r=t.length;return r<6||r>8?false:/finra|crd|series|broker|dealer|securities|license|registered/i.test(e)}},Gt=[Qc,el,tl,rl,il,sl,nl,al,ol,cl],ll={type:"RIOT_ID",regex:/\b([a-zA-Z0-9_]{3,16})#([a-zA-Z0-9]{3,5})\b/g,placeholder:"[RIOT_ID_{n}]",priority:80,severity:"medium",description:"Riot Games account ID (Riot ID)",validator:(t,e)=>{if(!t.includes("#"))return false;let[r,i]=t.split("#");return r.length<3||r.length>16||i.length<3||i.length>5?false:/riot|league[- ]?of[- ]?legends|valorant|tft|teamfight[- ]?tactics|gaming/i.test(e)}},dl={type:"TWITCH_USERNAME",regex:/\bTWITCH[-\s]?(?:USER|NAME|ID)?[-\s]?[:#]?\s*([a-zA-Z0-9_]{4,25})\b/gi,placeholder:"[TWITCH_{n}]",priority:75,severity:"medium",description:"Twitch username",validator:(t,e)=>{let r=t.length;return r<4||r>25?false:/twitch|streaming|streamer|channel|live|broadcast/i.test(e)}},ul={type:"ESPORTS_PLAYER_ID",regex:/\b(?:PLAYER|COMPETITOR|PARTICIPANT)[-\s]?(?:ID|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[PLAYER_ID_{n}]",priority:75,severity:"medium",description:"Esports player/competitor ID",validator:(t,e)=>/esports|tournament|competition|player|competitor|gaming|league/i.test(e)},pl={type:"TOURNAMENT_REGISTRATION_ID",regex:/\b(?:TOURNAMENT|BRACKET|REGISTRATION|REG)[-\s]?(?:ID|NO|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[TOURNEY_{n}]",priority:75,severity:"medium",description:"Gaming tournament registration ID",validator:(t,e)=>/tournament|bracket|registration|competition|event|gaming|esports/i.test(e)},hl={type:"ROBLOX_USER_ID",regex:/\bROBLOX[-\s]?(?:USER|ID)?[-\s]?[:#]?\s*(\d{1,12})\b/gi,placeholder:"[ROBLOX_{n}]",priority:80,severity:"medium",description:"Roblox user ID",validator:(t,e)=>{let r=t.length;return r<1||r>12?false:/roblox|robux|user|player|gaming/i.test(e)}},gl={type:"MINECRAFT_UUID",regex:/\b([0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12})\b/gi,placeholder:"[MC_UUID_{n}]",priority:80,severity:"medium",description:"Minecraft player UUID",validator:(t,e)=>{let r=t.replace(/-/g,"");return r.length!==32||!/^[0-9a-f]+$/i.test(r)?false:/minecraft|mc|mojang|player|uuid|server/i.test(e)}},ml={type:"FORTNITE_ACCOUNT_ID",regex:/\b(?:FORTNITE|FN)[-\s]?(?:ACCOUNT|USER|ID)?[-\s]?[:#]?\s*([a-f0-9]{32})\b/gi,placeholder:"[FN_ID_{n}]",priority:75,severity:"medium",description:"Fortnite account ID",validator:(t,e)=>t.length!==32||!/^[a-f0-9]+$/i.test(t)?false:/fortnite|epic[- ]?games|battle[- ]?royale|gaming/i.test(e)},El={type:"COD_PLAYER_ID",regex:/\b([a-zA-Z0-9_]{3,16})#(\d{7})\b/g,placeholder:"[COD_ID_{n}]",priority:75,severity:"medium",description:"Call of Duty / Activision player ID",validator:(t,e)=>{if(!t.includes("#"))return false;let[r,i]=t.split("#");return r.length<3||r.length>16||i.length!==7?false:/call[- ]?of[- ]?duty|cod|warzone|activision|gaming/i.test(e)}},fl={type:"APEX_PLAYER_ID",regex:/\b(?:APEX|EA)[-\s]?(?:ID|PLAYER)?[-\s]?[:#]?\s*([A-Z0-9]{10,16})\b/gi,placeholder:"[APEX_ID_{n}]",priority:70,severity:"medium",description:"Apex Legends player ID",validator:(t,e)=>/apex[- ]?legends|apex|ea|respawn|gaming|player/i.test(e)},Al={type:"DOTA_FRIEND_ID",regex:/\bDOTA[-\s]?(?:ID|FRIEND)?[-\s]?[:#]?\s*(\d{9,10})\b/gi,placeholder:"[DOTA_ID_{n}]",priority:70,severity:"medium",description:"Dota 2 friend ID",validator:(t,e)=>{let r=t.length;return r<9||r>10?false:/dota|steam|valve|gaming|player|moba/i.test(e)}},yl={type:"CSGO_FRIEND_CODE",regex:/\b(?:CS:?GO|COUNTER[- ]?STRIKE)[-\s]?(?:FRIEND[- ]?CODE|CODE)?[-\s]?[:#]?\s*([A-Z0-9]{5}-[A-Z0-9]{5})\b/gi,placeholder:"[CSGO_CODE_{n}]",priority:75,severity:"medium",description:"CS:GO friend code",validator:(t,e)=>/^[A-Z0-9]{5}-[A-Z0-9]{5}$/.test(t)?/cs:?go|counter[- ]?strike|steam|valve|gaming/i.test(e):false},Il={type:"OVERWATCH_BATTLETAG",regex:/\b([a-zA-Z][a-zA-Z0-9]{2,11})#(\d{4,5})\b/g,placeholder:"[OW_TAG_{n}]",priority:75,severity:"medium",description:"Overwatch BattleTag",validator:(t,e)=>{let r=t.split("#");return r.length!==2||r[0].length<3||r[0].length>12||r[1].length<4||r[1].length>5?false:/overwatch|ow2|blizzard|gaming|player/i.test(e)}},$t=[ll,dl,ul,pl,hl,gl,ml,El,fl,Al,yl,Il],_l={type:"VIN_NUMBER",regex:/\bVIN[-\s\u00A0]?(?:NO|NUM|NUMBER)?[-\s\u00A0]?[:#]?\s*([A-HJ-NPR-Z0-9]{17})\b/gi,placeholder:"[VIN_{n}]",priority:85,severity:"medium",description:"Vehicle Identification Number (VIN)",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"").toUpperCase();return r.length!==17||/[IOQ]/.test(r)?false:/vin|vehicle|car|auto|motor|registration|title|insurance/i.test(e)}},Nl={type:"US_LICENSE_PLATE",regex:/\b(?:PLATE|LICENSE|TAG)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{3,8})\b/gi,placeholder:"[PLATE_{n}]",priority:75,severity:"medium",description:"US License Plate",validator:(t,e)=>!(!/plate|license|tag|vehicle|car|registration|dmv/i.test(e)||/^\d+$/.test(t)||t.length<3)},Rl={type:"CALIFORNIA_LICENSE_PLATE",regex:/\b(\d[A-Z]{3}\d{3})\b/g,placeholder:"[CA_PLATE_{n}]",priority:80,severity:"medium",description:"California License Plate",validator:(t,e)=>/california|ca\s|plate|license|dmv|vehicle/i.test(e)},Tl={type:"NEW_YORK_LICENSE_PLATE",regex:/\b([A-Z]{3}-?\d{4})\b/g,placeholder:"[NY_PLATE_{n}]",priority:80,severity:"medium",description:"New York License Plate",validator:(t,e)=>/new\s?york|ny\s|plate|license|dmv|vehicle/i.test(e)},bl={type:"TEXAS_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{4}|[A-Z]{2}\d-[A-Z]\d{3})\b/g,placeholder:"[TX_PLATE_{n}]",priority:80,severity:"medium",description:"Texas License Plate",validator:(t,e)=>/texas|tx\s|plate|license|dmv|vehicle/i.test(e)},Cl={type:"FLORIDA_LICENSE_PLATE",regex:/\b([A-Z]{3,4}\s[A-Z]?\d{2})\b/g,placeholder:"[FL_PLATE_{n}]",priority:80,severity:"medium",description:"Florida License Plate",validator:(t,e)=>/florida|fl\s|plate|license|dmv|vehicle/i.test(e)},vl={type:"ILLINOIS_LICENSE_PLATE",regex:/\b([A-Z]{2}\d{5})\b/g,placeholder:"[IL_PLATE_{n}]",priority:80,severity:"medium",description:"Illinois License Plate",validator:(t,e)=>/illinois|il\s|plate|license|dmv|vehicle/i.test(e)},Sl={type:"PENNSYLVANIA_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{4})\b/g,placeholder:"[PA_PLATE_{n}]",priority:80,severity:"medium",description:"Pennsylvania License Plate",validator:(t,e)=>/pennsylvania|pa\s|plate|license|dmv|vehicle/i.test(e)},Pl={type:"OHIO_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{4})\b/g,placeholder:"[OH_PLATE_{n}]",priority:80,severity:"medium",description:"Ohio License Plate",validator:(t,e)=>/ohio|oh\s|plate|license|dmv|vehicle/i.test(e)},Ol={type:"MICHIGAN_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{4})\b/g,placeholder:"[MI_PLATE_{n}]",priority:80,severity:"medium",description:"Michigan License Plate",validator:(t,e)=>/michigan|mi\s|plate|license|dmv|vehicle/i.test(e)},Dl={type:"GEORGIA_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{4})\b/g,placeholder:"[GA_PLATE_{n}]",priority:80,severity:"medium",description:"Georgia License Plate",validator:(t,e)=>/georgia|ga\s|plate|license|dmv|vehicle/i.test(e)},Ml={type:"NORTH_CAROLINA_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{4})\b/g,placeholder:"[NC_PLATE_{n}]",priority:80,severity:"medium",description:"North Carolina License Plate",validator:(t,e)=>/north\s?carolina|nc\s|plate|license|dmv|vehicle/i.test(e)},xl={type:"NEW_JERSEY_LICENSE_PLATE",regex:/\b([A-Z]\d{2}[A-Z]{3})\b/g,placeholder:"[NJ_PLATE_{n}]",priority:80,severity:"medium",description:"New Jersey License Plate",validator:(t,e)=>/new\s?jersey|nj\s|plate|license|dmv|vehicle/i.test(e)},Ll={type:"VIRGINIA_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{4})\b/g,placeholder:"[VA_PLATE_{n}]",priority:80,severity:"medium",description:"Virginia License Plate",validator:(t,e)=>/virginia|va\s|plate|license|dmv|vehicle/i.test(e)},Ul={type:"WASHINGTON_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{4})\b/g,placeholder:"[WA_PLATE_{n}]",priority:80,severity:"medium",description:"Washington License Plate",validator:(t,e)=>/washington|wa\s|plate|license|dmv|vehicle/i.test(e)},wl={type:"MASSACHUSETTS_LICENSE_PLATE",regex:/\b(\d[A-Z]{3}\d{2})\b/g,placeholder:"[MA_PLATE_{n}]",priority:80,severity:"medium",description:"Massachusetts License Plate",validator:(t,e)=>/massachusetts|ma\s|plate|license|dmv|vehicle/i.test(e)},Bl={type:"ARIZONA_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{4})\b/g,placeholder:"[AZ_PLATE_{n}]",priority:80,severity:"medium",description:"Arizona License Plate",validator:(t,e)=>/arizona|az\s|plate|license|dmv|vehicle/i.test(e)},kl={type:"TENNESSEE_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{3})\b/g,placeholder:"[TN_PLATE_{n}]",priority:80,severity:"medium",description:"Tennessee License Plate",validator:(t,e)=>/tennessee|tn\s|plate|license|dmv|vehicle/i.test(e)},Hl={type:"INDIANA_LICENSE_PLATE",regex:/\b(\d{3}[A-Z]{3})\b/g,placeholder:"[IN_PLATE_{n}]",priority:80,severity:"medium",description:"Indiana License Plate",validator:(t,e)=>/indiana|in\s|plate|license|dmv|vehicle/i.test(e)},Fl={type:"MISSOURI_LICENSE_PLATE",regex:/\b([A-Z]{2}\d[A-Z]\d[A-Z])\b/g,placeholder:"[MO_PLATE_{n}]",priority:80,severity:"medium",description:"Missouri License Plate",validator:(t,e)=>/missouri|mo\s|plate|license|dmv|vehicle/i.test(e)},Zl={type:"MARYLAND_LICENSE_PLATE",regex:/\b(\d[A-Z]{2}\d{4})\b/g,placeholder:"[MD_PLATE_{n}]",priority:80,severity:"medium",description:"Maryland License Plate",validator:(t,e)=>/maryland|md\s|plate|license|dmv|vehicle/i.test(e)},Gl={type:"WISCONSIN_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{4})\b/g,placeholder:"[WI_PLATE_{n}]",priority:80,severity:"medium",description:"Wisconsin License Plate",validator:(t,e)=>/wisconsin|wi\s|plate|license|dmv|vehicle/i.test(e)},$l={type:"COLORADO_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{3})\b/g,placeholder:"[CO_PLATE_{n}]",priority:80,severity:"medium",description:"Colorado License Plate",validator:(t,e)=>/colorado|co\s|plate|license|dmv|vehicle/i.test(e)},Kl={type:"MINNESOTA_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{3})\b/g,placeholder:"[MN_PLATE_{n}]",priority:80,severity:"medium",description:"Minnesota License Plate",validator:(t,e)=>/minnesota|mn\s|plate|license|dmv|vehicle/i.test(e)},Wl={type:"SOUTH_CAROLINA_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{3})\b/g,placeholder:"[SC_PLATE_{n}]",priority:80,severity:"medium",description:"South Carolina License Plate",validator:(t,e)=>/south\s?carolina|sc\s|plate|license|dmv|vehicle/i.test(e)},Yl={type:"ALABAMA_LICENSE_PLATE",regex:/\b(\d{2}[A-Z]{2}\d{3})\b/g,placeholder:"[AL_PLATE_{n}]",priority:80,severity:"medium",description:"Alabama License Plate",validator:(t,e)=>/alabama|al\s|plate|license|dmv|vehicle/i.test(e)},zl={type:"LOUISIANA_LICENSE_PLATE",regex:/\b(\d{3}[A-Z]{3})\b/g,placeholder:"[LA_PLATE_{n}]",priority:80,severity:"medium",description:"Louisiana License Plate",validator:(t,e)=>/louisiana|la\s|plate|license|dmv|vehicle/i.test(e)},Vl={type:"KENTUCKY_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{3})\b/g,placeholder:"[KY_PLATE_{n}]",priority:80,severity:"medium",description:"Kentucky License Plate",validator:(t,e)=>/kentucky|ky\s|plate|license|dmv|vehicle/i.test(e)},jl={type:"OREGON_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{3})\b/g,placeholder:"[OR_PLATE_{n}]",priority:80,severity:"medium",description:"Oregon License Plate",validator:(t,e)=>/oregon|or\s|plate|license|dmv|vehicle/i.test(e)},ql={type:"OKLAHOMA_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{3})\b/g,placeholder:"[OK_PLATE_{n}]",priority:80,severity:"medium",description:"Oklahoma License Plate",validator:(t,e)=>/oklahoma|ok\s|plate|license|dmv|vehicle/i.test(e)},Xl={type:"CONNECTICUT_LICENSE_PLATE",regex:/\b(\d{3}[A-Z]{3}|[A-Z]{3}\d{3})\b/g,placeholder:"[CT_PLATE_{n}]",priority:80,severity:"medium",description:"Connecticut License Plate",validator:(t,e)=>/connecticut|ct\s|plate|license|dmv|vehicle/i.test(e)},Jl={type:"UTAH_LICENSE_PLATE",regex:/\b([A-Z]\d{2}[A-Z]{3})\b/g,placeholder:"[UT_PLATE_{n}]",priority:80,severity:"medium",description:"Utah License Plate",validator:(t,e)=>/utah|ut\s|plate|license|dmv|vehicle/i.test(e)},Ql={type:"IOWA_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{3})\b/g,placeholder:"[IA_PLATE_{n}]",priority:80,severity:"medium",description:"Iowa License Plate",validator:(t,e)=>/iowa|ia\s|plate|license|dmv|vehicle/i.test(e)},ed={type:"NEVADA_LICENSE_PLATE",regex:/\b(\d{2}[A-Z]\d{3})\b/g,placeholder:"[NV_PLATE_{n}]",priority:80,severity:"medium",description:"Nevada License Plate",validator:(t,e)=>/nevada|nv\s|plate|license|dmv|vehicle/i.test(e)},td={type:"ARKANSAS_LICENSE_PLATE",regex:/\b(\d{3}[A-Z]{3})\b/g,placeholder:"[AR_PLATE_{n}]",priority:80,severity:"medium",description:"Arkansas License Plate",validator:(t,e)=>/arkansas|ar\s|plate|license|dmv|vehicle/i.test(e)},rd={type:"MISSISSIPPI_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{3})\b/g,placeholder:"[MS_PLATE_{n}]",priority:80,severity:"medium",description:"Mississippi License Plate",validator:(t,e)=>/mississippi|ms\s|plate|license|dmv|vehicle/i.test(e)},id={type:"KANSAS_LICENSE_PLATE",regex:/\b(\d{3}[A-Z]{3})\b/g,placeholder:"[KS_PLATE_{n}]",priority:80,severity:"medium",description:"Kansas License Plate",validator:(t,e)=>/kansas|ks\s|plate|license|dmv|vehicle/i.test(e)},sd={type:"NEW_MEXICO_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{3})\b/g,placeholder:"[NM_PLATE_{n}]",priority:80,severity:"medium",description:"New Mexico License Plate",validator:(t,e)=>/new\s?mexico|nm\s|plate|license|dmv|vehicle/i.test(e)},nd={type:"NEBRASKA_LICENSE_PLATE",regex:/\b([A-Z]\d{5})\b/g,placeholder:"[NE_PLATE_{n}]",priority:80,severity:"medium",description:"Nebraska License Plate",validator:(t,e)=>/nebraska|ne\s|plate|license|dmv|vehicle/i.test(e)},ad={type:"WEST_VIRGINIA_LICENSE_PLATE",regex:/\b(\d[A-Z]{2}\d{3})\b/g,placeholder:"[WV_PLATE_{n}]",priority:80,severity:"medium",description:"West Virginia License Plate",validator:(t,e)=>/west\s?virginia|wv\s|plate|license|dmv|vehicle/i.test(e)},od={type:"IDAHO_LICENSE_PLATE",regex:/\b(\d[A-Z]\d{5})\b/g,placeholder:"[ID_PLATE_{n}]",priority:80,severity:"medium",description:"Idaho License Plate",validator:(t,e)=>/idaho|id\s|plate|license|dmv|vehicle/i.test(e)},cd={type:"HAWAII_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{3})\b/g,placeholder:"[HI_PLATE_{n}]",priority:80,severity:"medium",description:"Hawaii License Plate",validator:(t,e)=>/hawaii|hi\s|plate|license|dmv|vehicle/i.test(e)},ld={type:"NEW_HAMPSHIRE_LICENSE_PLATE",regex:/\b(\d{3,4}[A-Z]{2})\b/g,placeholder:"[NH_PLATE_{n}]",priority:80,severity:"medium",description:"New Hampshire License Plate",validator:(t,e)=>/new\s?hampshire|nh\s|plate|license|dmv|vehicle/i.test(e)},dd={type:"MAINE_LICENSE_PLATE",regex:/\b(\d{4}[A-Z]{2})\b/g,placeholder:"[ME_PLATE_{n}]",priority:80,severity:"medium",description:"Maine License Plate",validator:(t,e)=>/maine|me\s|plate|license|dmv|vehicle/i.test(e)},ud={type:"MONTANA_LICENSE_PLATE",regex:/\b(\d-\d{5}[A-Z])\b/g,placeholder:"[MT_PLATE_{n}]",priority:80,severity:"medium",description:"Montana License Plate",validator:(t,e)=>/montana|mt\s|plate|license|dmv|vehicle/i.test(e)},pd={type:"RHODE_ISLAND_LICENSE_PLATE",regex:/\b(\d{6})\b/g,placeholder:"[RI_PLATE_{n}]",priority:75,severity:"medium",description:"Rhode Island License Plate",validator:(t,e)=>/rhode\s?island|ri\s|plate|license|dmv|vehicle/i.test(e)},hd={type:"DELAWARE_LICENSE_PLATE",regex:/\b(\d{6})\b/g,placeholder:"[DE_PLATE_{n}]",priority:75,severity:"medium",description:"Delaware License Plate",validator:(t,e)=>/delaware|de\s|plate|license|dmv|vehicle/i.test(e)},gd={type:"SOUTH_DAKOTA_LICENSE_PLATE",regex:/\b(\d{2}[A-Z]\d{3})\b/g,placeholder:"[SD_PLATE_{n}]",priority:80,severity:"medium",description:"South Dakota License Plate",validator:(t,e)=>/south\s?dakota|sd\s|plate|license|dmv|vehicle/i.test(e)},md={type:"NORTH_DAKOTA_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{3})\b/g,placeholder:"[ND_PLATE_{n}]",priority:80,severity:"medium",description:"North Dakota License Plate",validator:(t,e)=>/north\s?dakota|nd\s|plate|license|dmv|vehicle/i.test(e)},Ed={type:"ALASKA_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{3})\b/g,placeholder:"[AK_PLATE_{n}]",priority:80,severity:"medium",description:"Alaska License Plate",validator:(t,e)=>/alaska|ak\s|plate|license|dmv|vehicle/i.test(e)},fd={type:"VERMONT_LICENSE_PLATE",regex:/\b([A-Z]{3}\d{3})\b/g,placeholder:"[VT_PLATE_{n}]",priority:80,severity:"medium",description:"Vermont License Plate",validator:(t,e)=>/vermont|vt\s|plate|license|dmv|vehicle/i.test(e)},Ad={type:"WYOMING_LICENSE_PLATE",regex:/\b(\d{5})\b/g,placeholder:"[WY_PLATE_{n}]",priority:75,severity:"medium",description:"Wyoming License Plate",validator:(t,e)=>/wyoming|wy\s|plate|license|dmv|vehicle/i.test(e)},yd={type:"UK_LICENSE_PLATE",regex:/\b([A-Z]{2}\d{2}\s?[A-Z]{3})\b/g,placeholder:"[UK_PLATE_{n}]",priority:85,severity:"medium",description:"UK Vehicle Registration Plate",validator:(t,e)=>/uk|british|britain|registration|number\s?plate|vehicle|dvla/i.test(e)},Id={type:"GERMAN_LICENSE_PLATE",regex:/\b([A-ZÄÖÜ]{1,3}[-\s][A-ZÄÖÜ]{1,2}\s?\d{1,4})\b/gi,placeholder:"[DE_PLATE_{n}]",priority:85,severity:"medium",description:"German License Plate (Kennzeichen)",validator:(t,e)=>/german|deutschland|kennzeichen|license|plate|vehicle|kfz/i.test(e)},_d={type:"FRENCH_LICENSE_PLATE",regex:/\b([A-Z]{2}-\d{3}-[A-Z]{2})\b/gi,placeholder:"[FR_PLATE_{n}]",priority:85,severity:"medium",description:"French License Plate (Plaque d'immatriculation)",validator:(t,e)=>/french|france|immatriculation|license|plate|vehicle/i.test(e)},Nd={type:"CANADIAN_LICENSE_PLATE",regex:/\b([A-Z]{3,4}[-\s]?\d{3,4})\b/g,placeholder:"[CA_PLATE_{n}]",priority:80,severity:"medium",description:"Canadian License Plate",validator:(t,e)=>/canad|ontario|quebec|british\s?columbia|alberta|plate|license|vehicle/i.test(e)},Rd={type:"AUSTRALIAN_LICENSE_PLATE",regex:/\b([A-Z]{2,3}[-\s]?\d{2,4})\b/g,placeholder:"[AU_PLATE_{n}]",priority:80,severity:"medium",description:"Australian License Plate",validator:(t,e)=>/australia|nsw|victoria|queensland|south\s?australia|plate|license|rego|registration/i.test(e)},Td={type:"JAPANESE_LICENSE_PLATE",regex:/\b([あ-ん]{1}\s?\d{2}-\d{2}|\d{2,3}\s?[あ-ん]\s?\d{2}-\d{2})\b/g,placeholder:"[JP_PLATE_{n}]",priority:85,severity:"medium",description:"Japanese License Plate (\u30CA\u30F3\u30D0\u30FC\u30D7\u30EC\u30FC\u30C8)",validator:(t,e)=>/japan|japanese|ナンバー|車両|plate|license|vehicle/i.test(e)},bd={type:"INTERNATIONAL_LICENSE_PLATE",regex:/\b(?:PLATE|REGISTRATION|TAG)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{4,10})\b/gi,placeholder:"[PLATE_{n}]",priority:70,severity:"medium",description:"International License Plate",validator:(t,e)=>/plate|registration|license|vehicle|car|motor/i.test(e)},Kt=[_l,Nl,Rl,Tl,bl,Cl,vl,Sl,Pl,Ol,Dl,Ml,xl,Ll,Ul,wl,Bl,kl,Hl,Fl,Zl,Gl,$l,Kl,Wl,Yl,zl,Vl,jl,ql,Xl,Jl,Ql,ed,td,rd,id,sd,nd,ad,od,cd,ld,dd,ud,pd,hd,gd,md,Ed,fd,Ad,yd,Id,_d,Nd,Rd,Td,bd],Cd={type:"FEDEX_TRACKING",regex:/\b(?:FEDEX|FDX)[-\s]?(?:TRACK(?:ING)?|NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{12}|\d{15}|\d{20})\b/gi,placeholder:"[FEDEX_TRACK_{n}]",priority:85,severity:"low",description:"FedEx tracking number",validator:(t,e)=>{let r=t.length;return r!==12&&r!==15&&r!==20?false:/fedex|fed\s?ex|fdx|tracking|shipment|package|delivery/i.test(e)}},vd={type:"UPS_TRACKING",regex:/\b(?:UPS[-\s]?)?(?:TRACK(?:ING)?|NO|NUM|NUMBER)?[-\s]?[:#]?\s*(1Z[A-Z0-9]{16})\b/gi,placeholder:"[UPS_TRACK_{n}]",priority:90,severity:"low",description:"UPS tracking number",validator:(t,e)=>!t.startsWith("1Z")||t.length!==18?false:/ups|tracking|shipment|package|delivery/i.test(e)},Sd={type:"USPS_TRACKING",regex:/\b(?:USPS|US\s?MAIL)[-\s]?(?:TRACK(?:ING)?|NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{20,22}|[A-Z]{2}\d{9}US)\b/gi,placeholder:"[USPS_TRACK_{n}]",priority:85,severity:"low",description:"USPS tracking number",validator:(t,e)=>{if(t.includes("US"))return t.length===13&&/^[A-Z]{2}\d{9}US$/.test(t);let r=t.length;return r<20||r>22?false:/usps|us\s?mail|postal|tracking|shipment|package|delivery/i.test(e)}},Pd={type:"DHL_TRACKING",regex:/\b(?:DHL[-\s]?)?(?:TRACK(?:ING)?|NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{10,11})\b/gi,placeholder:"[DHL_TRACK_{n}]",priority:85,severity:"low",description:"DHL tracking number",validator:(t,e)=>{let r=t.length;return r!==10&&r!==11?false:/dhl|tracking|shipment|package|delivery|express/i.test(e)}},Od={type:"AMAZON_TRACKING",regex:/\b(TBA\d{12})\b/gi,placeholder:"[AMAZON_TRACK_{n}]",priority:90,severity:"low",description:"Amazon tracking number",validator:(t,e)=>t.startsWith("TBA")&&t.length===15},Dd={type:"TNT_TRACKING",regex:/\b(?:TNT[-\s]?)?(?:TRACK(?:ING)?|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{9}|[A-Z0-9]{13})\b/gi,placeholder:"[TNT_TRACK_{n}]",priority:85,severity:"low",description:"TNT Express tracking number",validator:(t,e)=>{let r=t.length;return r!==9&&r!==13?false:/tnt|tracking|shipment|package|delivery|express/i.test(e)}},Md={type:"CHINA_POST_TRACKING",regex:/\b(?:CHINA\s?POST[-\s]?)?(?:TRACK(?:ING)?|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([RC][A-Z]\d{9}CN)\b/gi,placeholder:"[CHINA_POST_{n}]",priority:85,severity:"low",description:"China Post tracking number",validator:(t,e)=>t.length!==13||!t.endsWith("CN")||!/^[RC]/.test(t)?false:/china\s?post|tracking|shipment|package|delivery/i.test(e)},xd={type:"JAPAN_POST_TRACKING",regex:/\b(?:JAPAN\s?POST[-\s]?)?(?:TRACK(?:ING)?|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z]{2}\d{9}JP)\b/gi,placeholder:"[JAPAN_POST_{n}]",priority:85,severity:"low",description:"Japan Post tracking number",validator:(t,e)=>t.length!==13||!t.endsWith("JP")?false:/japan\s?post|tracking|shipment|package|delivery/i.test(e)},Ld={type:"ROYAL_MAIL_TRACKING",regex:/\b(?:ROYAL\s?MAIL[-\s]?)?(?:TRACK(?:ING)?|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z]{2}\d{9}GB)\b/gi,placeholder:"[ROYAL_MAIL_{n}]",priority:85,severity:"low",description:"Royal Mail tracking number",validator:(t,e)=>t.length!==13||!t.endsWith("GB")?false:/royal\s?mail|tracking|shipment|package|delivery|post\s?office/i.test(e)},Ud={type:"CANADA_POST_TRACKING",regex:/\b(?:CANADA\s?POST[-\s]?)?(?:TRACK(?:ING)?|NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{16})\b/gi,placeholder:"[CANADA_POST_{n}]",priority:85,severity:"low",description:"Canada Post tracking number",validator:(t,e)=>t.length!==16?false:/canada\s?post|tracking|shipment|package|delivery|postes|canada/i.test(e)},wd={type:"AUSTRALIA_POST_TRACKING",regex:/\b(?:AUSTRALIA\s?POST[-\s]?)?(?:TRACK(?:ING)?|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z]{2}\d{9}AU)\b/gi,placeholder:"[AUSTRALIA_POST_{n}]",priority:85,severity:"low",description:"Australia Post tracking number",validator:(t,e)=>t.length!==13||!t.endsWith("AU")?false:/australia\s?post|aus\s?post|tracking|shipment|package|delivery/i.test(e)},Bd={type:"PUROLATOR_TRACKING",regex:/\b(?:PUROLATOR[-\s]?)?(?:TRACK(?:ING)?|NO|NUM|NUMBER|PIN)?[-\s]?[:#]?\s*(\d{12}|P\d{10})\b/gi,placeholder:"[PUROLATOR_{n}]",priority:85,severity:"low",description:"Purolator tracking number",validator:(t,e)=>t.startsWith("P")?t.length===11:t.length!==12?false:/purolator|tracking|shipment|package|delivery/i.test(e)},kd={type:"ONTRAC_TRACKING",regex:/\b(?:ONTRAC|ON\s?TRAC|LASERSHIP)[-\s]?(?:TRACK(?:ING)?|NO|NUM|NUMBER)?[-\s]?[:#]?\s*(C\d{14})\b/gi,placeholder:"[ONTRAC_{n}]",priority:85,severity:"low",description:"OnTrac/LaserShip tracking number",validator:(t,e)=>!t.startsWith("C")||t.length!==15?false:/ontrac|on\s?trac|lasership|tracking|shipment|package|delivery/i.test(e)},Hd={type:"GLS_TRACKING",regex:/\b(?:GLS[-\s]?)?(?:TRACK(?:ING)?|NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{11,13})\b/gi,placeholder:"[GLS_{n}]",priority:80,severity:"low",description:"GLS tracking number (Europe)",validator:(t,e)=>{let r=t.length;return r<11||r>13?false:/gls|general\s?logistics|tracking|shipment|package|delivery/i.test(e)}},Fd={type:"ARAMEX_TRACKING",regex:/\b(?:ARAMEX[-\s]?)?(?:TRACK(?:ING)?|NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{11,12})\b/gi,placeholder:"[ARAMEX_{n}]",priority:85,severity:"low",description:"Aramex tracking number",validator:(t,e)=>{let r=t.length;return r!==11&&r!==12?false:/aramex|tracking|shipment|package|delivery|express/i.test(e)}},Zd={type:"GENERIC_TRACKING_NUMBER",regex:/\b(?:TRACK(?:ING)?|SHIPMENT|PACKAGE)[-\s]?(?:ID|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{10,25})\b/gi,placeholder:"[TRACKING_{n}]",priority:70,severity:"low",description:"Generic tracking number",validator:(t,e)=>{if(!/track|ship|package|delivery|carrier|freight/i.test(e))return false;let r=t.length;return r>=10&&r<=25}},Gd={type:"BILL_OF_LADING",regex:/\b(?:BOL|B\/L|BILL\s?OF\s?LADING)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,20})\b/gi,placeholder:"[BOL_{n}]",priority:85,severity:"medium",description:"Bill of Lading number",validator:(t,e)=>/bill\s?of\s?lading|bol|b\/l|shipping|freight|cargo|shipment/i.test(e)},$d={type:"SHIPPING_CONTAINER_NUMBER",regex:/\b([A-Z]{4}\d{7})\b/g,placeholder:"[CONTAINER_{n}]",priority:85,severity:"medium",description:"Shipping container number (ISO 6346)",validator:(t,e)=>/^[A-Z]{3}[UJZ]\d{7}$/.test(t)?/container|shipping|freight|cargo|iso\s?6346/i.test(e):false},Kd={type:"AIR_WAYBILL_NUMBER",regex:/\b(?:AWB|AIR\s?WAYBILL)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{3}[-\s]?\d{8})\b/gi,placeholder:"[AWB_{n}]",priority:85,severity:"medium",description:"Air Waybill number",validator:(t,e)=>t.replace(/\D/g,"").length!==11?false:/awb|air\s?waybill|air\s?freight|cargo|shipment/i.test(e)},Wd={type:"PRO_NUMBER",regex:/\bPRO[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{9,10})\b/gi,placeholder:"[PRO_{n}]",priority:85,severity:"low",description:"PRO number (freight)",validator:(t,e)=>{let r=t.length;return r!==9&&r!==10?false:/pro\s?number|freight|ltl|shipment|carrier/i.test(e)}},Yd={type:"MASTER_AIRWAY_BILL",regex:/\bMAWB[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{3}[-\s]?\d{8})\b/gi,placeholder:"[MAWB_{n}]",priority:85,severity:"medium",description:"Master Airway Bill",validator:(t,e)=>t.replace(/\D/g,"").length!==11?false:/mawb|master\s?airway|consolidation|freight|cargo/i.test(e)},Wt=[Cd,vd,Sd,Pd,Od,Dd,Md,xd,Ld,Ud,wd,Bd,kd,Hd,Fd,Zd,Gd,$d,Kd,Wd,Yd],zd={type:"IATA_AIRPORT_CODE",regex:/\b(?:AIRPORT|FROM|TO|VIA|IATA)[-\s]?(?:CODE)?[-\s]?[:#]?\s*([A-Z]{3})\b/gi,placeholder:"[AIRPORT_{n}]",priority:75,severity:"low",description:"IATA Airport Code",validator:(t,e)=>/airport|iata|flight|departure|arrival|terminal/i.test(e)},Vd={type:"FLIGHT_NUMBER",regex:/\b(?:FLIGHT|FLT)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z]{2,3}\s?\d{1,4})\b/gi,placeholder:"[FLIGHT_{n}]",priority:80,severity:"low",description:"Flight Number",validator:(t,e)=>{let r=t.replace(/\s/g,"");return /^[A-Z]{2,3}\d{1,4}$/.test(r)?/flight|airline|departure|arrival|boarding|gate/i.test(e):false}},jd={type:"AIRCRAFT_TAIL_NUMBER",regex:/\b(N[1-9][0-9]{0,4}[A-Z]{0,2})\b/g,placeholder:"[TAIL_{n}]",priority:85,severity:"medium",description:"Aircraft Tail Number (US N-Number)",validator:(t,e)=>!(!t.startsWith("N")||t.length<2||t.length>6||t[1]==="0")},qd={type:"AIRCRAFT_REGISTRATION",regex:/\b(?:REGISTRATION|REG|TAIL)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z]{1,2}-[A-Z0-9]{3,5})\b/gi,placeholder:"[AIRCRAFT_REG_{n}]",priority:85,severity:"medium",description:"International Aircraft Registration",validator:(t,e)=>/aircraft|plane|aviation|registration|tail\s?number/i.test(e)},Xd={type:"FAA_AIRMAN_CERTIFICATE",regex:/\b(?:FAA|AIRMAN|PILOT)[-\s]?(?:CERT(?:IFICATE)?|LICENSE)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{7,8})\b/gi,placeholder:"[FAA_CERT_{n}]",priority:85,severity:"medium",description:"FAA Airman Certificate Number",validator:(t,e)=>{let r=t.length;return r!==7&&r!==8?false:/faa|airman|pilot|certificate|license|aviation/i.test(e)}},Jd={type:"ICAO_AIRCRAFT_TYPE",regex:/\b(?:AIRCRAFT|TYPE|ICAO)[-\s]?(?:CODE|DESIGNATOR)?[-\s]?[:#]?\s*([A-Z][0-9][A-Z0-9]{1,2})\b/gi,placeholder:"[AIRCRAFT_TYPE_{n}]",priority:70,severity:"low",description:"ICAO Aircraft Type Designator",validator:(t,e)=>/aircraft|type|icao|model|boeing|airbus/i.test(e)},Qd={type:"AIRCRAFT_MODE_S",regex:/\b(?:MODE\s?S|ICAO\s?ADDRESS)[-\s]?[:#]?\s*([A-F0-9]{6})\b/gi,placeholder:"[MODE_S_{n}]",priority:85,severity:"medium",description:"Aircraft Mode S Code (ICAO 24-bit address)",validator:(t,e)=>t.length!==6||!/^[A-F0-9]{6}$/i.test(t)?false:/mode\s?s|icao|aircraft|transponder|adsb/i.test(e)},eu={type:"AIRLINE_BOOKING_REFERENCE",regex:/\b(?:BOOKING|RESERVATION|LOCATOR|REFERENCE)[-\s]?(?:CODE|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6})\b/gi,placeholder:"[BOOKING_REF_{n}]",priority:85,severity:"medium",description:"Airline Booking Reference/Locator",validator:(t,e)=>/booking|reservation|locator|reference|pnr|airline|flight/i.test(e)},tu={type:"IATA_AIRLINE_CODE",regex:/\b(?:AIRLINE|CARRIER)[-\s]?(?:CODE|IATA)?[-\s]?[:#]?\s*([A-Z]{2})\b/gi,placeholder:"[AIRLINE_{n}]",priority:70,severity:"low",description:"IATA Airline Code",validator:(t,e)=>/airline|carrier|iata|flight|aviation/i.test(e)},Yt=[zd,Vd,jd,qd,Xd,Jd,Qd,eu,tu],ru={type:"IMO_NUMBER",regex:/\bIMO[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{7})\b/gi,placeholder:"[IMO_{n}]",priority:90,severity:"medium",description:"IMO Ship Identification Number",validator:(t,e)=>{if(t.length!==7)return false;let r=t.split("").map(Number),i=0;for(let s=0;s<6;s++)i+=r[s]*(7-s);return i%10!==r[6]?false:/imo|ship|vessel|maritime|shipping|marine/i.test(e)}},iu={type:"MMSI_NUMBER",regex:/\bMMSI[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{9})\b/gi,placeholder:"[MMSI_{n}]",priority:90,severity:"medium",description:"MMSI (Maritime Mobile Service Identity)",validator:(t,e)=>{if(t.length!==9)return false;let r=parseInt(t.substring(0,3));return r<200||r>799?false:/mmsi|maritime|ship|vessel|ais|vhf|radio/i.test(e)}},su={type:"MARITIME_CALLSIGN",regex:/\b(?:CALLSIGN|CALL\s?SIGN)[-\s]?[:#]?\s*([A-Z0-9]{3,7})\b/gi,placeholder:"[CALLSIGN_{n}]",priority:85,severity:"low",description:"Maritime Radio Callsign",validator:(t,e)=>/callsign|call\s?sign|radio|maritime|vessel|ship|vhf/i.test(e)},nu={type:"OFFICIAL_SHIP_NUMBER",regex:/\b(?:OFFICIAL|SHIP)[-\s]?(?:NO|NUM|NUMBER)[-\s]?[:#]?\s*([A-Z0-9]{5,12})\b/gi,placeholder:"[SHIP_NUM_{n}]",priority:80,severity:"medium",description:"Official Ship Number",validator:(t,e)=>/official|ship|vessel|registration|registry|flag\s?state/i.test(e)},au={type:"PSC_INSPECTION_ID",regex:/\b(?:PSC|INSPECTION)[-\s]?(?:ID|NO|NUM|NUMBER)[-\s]?[:#]?\s*([A-Z0-9]{6,15})\b/gi,placeholder:"[PSC_{n}]",priority:80,severity:"low",description:"Port State Control Inspection ID",validator:(t,e)=>/psc|port\s?state|inspection|maritime|vessel|ship|compliance/i.test(e)},ou={type:"SEAFARER_ID",regex:/\b(?:SEAFARER|MARINER|SID)[-\s]?(?:ID|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z]{2,3}[A-Z0-9]{9})\b/gi,placeholder:"[SEAFARER_{n}]",priority:85,severity:"high",description:"Seafarer Identification Number",validator:(t,e)=>t.length<11||t.length>12?false:/seafarer|mariner|sid|maritime|crew|seaman|sailor/i.test(e)},cu={type:"LLOYDS_REGISTER_NUMBER",regex:/\b(?:LLOYD'?S?|LR)[-\s]?(?:REG(?:ISTER)?|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{7})\b/gi,placeholder:"[LR_NUM_{n}]",priority:85,severity:"low",description:"Lloyd's Register Number",validator:(t,e)=>/lloyd|lr|register|classification|ship|vessel|maritime/i.test(e)},zt=[ru,iu,su,nu,au,ou,cu],lu={type:"EPA_ID_NUMBER",regex:/\bEPA[-\s]?(?:ID|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z]{2}[A-Z0-9]{9})\b/gi,placeholder:"[EPA_ID_{n}]",priority:85,severity:"medium",description:"EPA Identification Number",validator:(t,e)=>{if(t.length!==11)return false;let r=t.substring(0,2);return /^[A-Z]{2}$/.test(r)?/epa|environmental|hazardous|waste|rcra|generator/i.test(e):false}},du={type:"NPDES_PERMIT",regex:/\bNPDES[-\s]?(?:PERMIT|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z]{2}[A-Z0-9]{7,9})\b/gi,placeholder:"[NPDES_{n}]",priority:85,severity:"medium",description:"NPDES Permit Number",validator:(t,e)=>/npdes|permit|discharge|wastewater|water\s?quality/i.test(e)},uu={type:"HAZARDOUS_WASTE_MANIFEST",regex:/\b(?:MANIFEST|WASTE)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{9})\b/gi,placeholder:"[MANIFEST_{n}]",priority:80,severity:"medium",description:"Hazardous Waste Manifest Number",validator:(t,e)=>t.length!==9?false:/manifest|hazardous|waste|rcra|generator|transporter/i.test(e)},pu={type:"AIR_QUALITY_PERMIT",regex:/\b(?:AIR|EMISSION)[-\s]?PERMIT[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[AIR_PERMIT_{n}]",priority:80,severity:"low",description:"Air Quality Permit Number",validator:(t,e)=>/air|emission|permit|quality|pollution|stack/i.test(e)},hu={type:"WATER_QUALITY_CERTIFICATE",regex:/\bWATER[-\s]?(?:QUALITY|CERT(?:IFICATE)?)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[WATER_CERT_{n}]",priority:80,severity:"low",description:"Water Quality Certificate Number",validator:(t,e)=>/water|quality|certificate|permit|discharge|wetland/i.test(e)},gu={type:"STORM_WATER_PERMIT",regex:/\bSTORM\s?WATER[-\s]?PERMIT[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z]{2}[A-Z0-9]{6,10})\b/gi,placeholder:"[STORM_PERMIT_{n}]",priority:80,severity:"low",description:"Storm Water Permit Number",validator:(t,e)=>/storm|water|runoff|permit|npdes|swppp/i.test(e)},mu={type:"UST_ID",regex:/\bUST[-\s]?(?:ID|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,12})\b/gi,placeholder:"[UST_{n}]",priority:80,severity:"medium",description:"Underground Storage Tank ID",validator:(t,e)=>/ust|underground|storage|tank|petroleum|fuel/i.test(e)},Eu={type:"FACILITY_ID",regex:/\bFACILITY[-\s]?ID[-\s]?[:#]?\s*([A-Z0-9]{6,15})\b/gi,placeholder:"[FACILITY_{n}]",priority:75,severity:"low",description:"Environmental Facility ID",validator:(t,e)=>/facility|plant|site|environmental|epa|compliance/i.test(e)},fu={type:"TRI_FACILITY_ID",regex:/\bTRI[-\s]?(?:FACILITY|ID)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{11})\b/gi,placeholder:"[TRI_FAC_{n}]",priority:85,severity:"low",description:"TRI Facility ID Number",validator:(t,e)=>t.length!==11?false:/tri|toxic\s?release|inventory|facility|epa|emissions/i.test(e)},Au={type:"SPILL_REPORT_NUMBER",regex:/\bSPILL[-\s]?(?:REPORT|NO|NUM|NUMBER)[-\s]?[:#]?\s*([A-Z0-9]{6,15})\b/gi,placeholder:"[SPILL_{n}]",priority:80,severity:"medium",description:"Environmental Spill Report Number",validator:(t,e)=>/spill|release|incident|environmental|response|cleanup/i.test(e)},yu={type:"REMEDIATION_SITE_ID",regex:/\b(?:REMEDIATION|CLEANUP)[-\s]?SITE[-\s]?(?:ID|NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,15})\b/gi,placeholder:"[REMEDIATION_{n}]",priority:80,severity:"low",description:"Remediation Site ID",validator:(t,e)=>/remediation|cleanup|site|superfund|brownfield|contamination/i.test(e)},Iu={type:"ENVIRONMENTAL_CERTIFICATE",regex:/\bENVIRONMENTAL[-\s]?(?:CERT(?:IFICATE)?|COMPLIANCE)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z0-9]{6,15})\b/gi,placeholder:"[ENV_CERT_{n}]",priority:75,severity:"low",description:"Environmental Compliance Certificate",validator:(t,e)=>/environmental|compliance|certificate|permit|authorization/i.test(e)},Vt=[lu,du,uu,pu,hu,gu,mu,Eu,fu,Au,yu,Iu],_u={type:"UAE_EMIRATES_ID",regex:/\b(784[-\s]?\d{4}[-\s]?\d{7}[-\s]?\d)\b/g,placeholder:"[UAE_ID_{n}]",priority:95,severity:"high",description:"UAE Emirates ID (15 digits starting with 784)",validator:(t,e)=>{let r=t.replace(/\D/g,"");return r.length!==15||!r.startsWith("784")?false:/uae|emirates|dubai|abu[- ]?dhabi|national[- ]?id|emirates[- ]?id/i.test(e)}},Nu={type:"SAUDI_NATIONAL_ID",regex:/\b([12]\d{9})\b/g,placeholder:"[SA_ID_{n}]",priority:95,severity:"high",description:"Saudi Arabia National ID or Iqama (10 digits)",validator:(t,e)=>t.length!==10||!/^[12]/.test(t)?false:/saudi|ksa|kingdom|iqama|national[- ]?id|muqeem/i.test(e)},Ru={type:"ISRAEL_ID",regex:/\b(\d{9})\b/g,placeholder:"[IL_ID_{n}]",priority:95,severity:"high",description:"Israel Teudat Zehut ID number (9 digits with checksum)",validator:(t,e)=>t.length!==9?false:/israel|teudat|zehut|israeli|national[- ]?id/i.test(e)},Tu={type:"TURKEY_ID",regex:/\b([1-9]\d{10})\b/g,placeholder:"[TR_ID_{n}]",priority:95,severity:"high",description:"Turkey TC Kimlik No (11 digits with checksum)",validator:(t,e)=>t.length!==11||t[0]==="0"?false:/turkey|turkish|tc|kimlik|national[- ]?id/i.test(e)},bu={type:"QATAR_ID",regex:/\b(\d{11})\b/g,placeholder:"[QA_ID_{n}]",priority:90,severity:"high",description:"Qatar ID (QID) - 11 digits",validator:(t,e)=>t.length!==11?false:/qatar|qid|doha|national[- ]?id|resident[- ]?permit/i.test(e)},Cu={type:"KUWAIT_CIVIL_ID",regex:/\b(\d{12})\b/g,placeholder:"[KW_ID_{n}]",priority:90,severity:"high",description:"Kuwait Civil ID (12 digits)",validator:(t,e)=>{if(t.length!==12||!/kuwait|civil[- ]?id|national[- ]?id/i.test(e))return false;let r=parseInt(t.substring(2,4)),i=parseInt(t.substring(4,6));return !(r<1||r>12||i<1||i>31)}},vu={type:"BAHRAIN_CPR",regex:/\b(\d{9})\b/g,placeholder:"[BH_CPR_{n}]",priority:85,severity:"high",description:"Bahrain CPR (Central Population Register) - 9 digits",validator:(t,e)=>{if(t.length!==9||!/bahrain|cpr|central[- ]?population|national[- ]?id/i.test(e))return false;let r=parseInt(t.substring(2,4)),i=parseInt(t.substring(4,6));return !(r<1||r>12||i<1||i>31)}},Su={type:"OMAN_CIVIL_ID",regex:/\b(\d{8})\b/g,placeholder:"[OM_ID_{n}]",priority:85,severity:"high",description:"Oman Civil ID (8 digits)",validator:(t,e)=>t.length!==8?false:/oman|muscat|civil[- ]?id|national[- ]?id/i.test(e)},Pu={type:"JORDAN_NATIONAL_ID",regex:/\b(\d{10})\b/g,placeholder:"[JO_ID_{n}]",priority:85,severity:"high",description:"Jordan National ID (10 digits)",validator:(t,e)=>t.length!==10?false:/jordan|amman|national[- ]?id|jordanian/i.test(e)},Ou={type:"LEBANON_NATIONAL_ID",regex:/\b(\d{7,8})\b/g,placeholder:"[LB_ID_{n}]",priority:85,severity:"high",description:"Lebanon National ID (7-8 digits)",validator:(t,e)=>{let r=t.length;return r!==7&&r!==8?false:/lebanon|lebanese|beirut|national[- ]?id/i.test(e)}},Du=[_u,Nu,Ru,Tu,bu,Cu,vu,Su,Pu,Ou],Mu={type:"SOUTH_AFRICA_ID",regex:/\b(\d{13})\b/g,placeholder:"[ZA_ID_{n}]",priority:95,severity:"high",description:"South African ID number (13 digits with date and checksum)",validator:(t,e)=>{if(t.length!==13||!/south[- ]?africa|rsa|za|national[- ]?id|identity|id[- ]?number/i.test(e))return false;let r=parseInt(t.substring(2,4)),i=parseInt(t.substring(4,6));return !(r<1||r>12||i<1||i>31)}},xu={type:"NIGERIA_NIN",regex:/\b(\d{11})\b/g,placeholder:"[NG_NIN_{n}]",priority:95,severity:"high",description:"Nigeria National Identification Number (11 digits)",validator:(t,e)=>t.length!==11?false:/nigeria|nin|national[- ]?id|identity|nigerian/i.test(e)},Lu={type:"NIGERIA_BVN",regex:/\bBVN[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{11})\b/gi,placeholder:"[NG_BVN_{n}]",priority:90,severity:"high",description:"Nigeria Bank Verification Number",validator:(t,e)=>t.length!==11?false:/bvn|bank[- ]?verification|nigeria|nigerian|banking/i.test(e)},Uu={type:"KENYA_NATIONAL_ID",regex:/\b(\d{7,8})\b/g,placeholder:"[KE_ID_{n}]",priority:90,severity:"high",description:"Kenya National ID number (7-8 digits)",validator:(t,e)=>{let r=t.length;return r<7||r>8?false:/kenya|kenyan|national[- ]?id|identity/i.test(e)}},wu={type:"KENYA_KRA_PIN",regex:/\b(A\d{9}[A-Z])\b/g,placeholder:"[KRA_PIN_{n}]",priority:90,severity:"high",description:"Kenya Revenue Authority PIN (tax number)",validator:(t,e)=>t.length!==11||!t.startsWith("A")?false:/kra|kenya|revenue|authority|tax|pin|taxpayer/i.test(e)},Bu={type:"EGYPT_NATIONAL_ID",regex:/\b([12]\d{13})\b/g,placeholder:"[EG_ID_{n}]",priority:90,severity:"high",description:"Egypt National ID (14 digits)",validator:(t,e)=>{if(t.length!==14||!/egypt|egyptian|national[- ]?id|identity/i.test(e))return false;let r=parseInt(t[0]);if(r!==1&&r!==2)return false;let i=parseInt(t.substring(5,7)),s=parseInt(t.substring(7,9));return !(i<1||i>12||s<1||s>31)}},ku={type:"GHANA_CARD",regex:/\b(GHA-\d{9}-\d)\b/g,placeholder:"[GH_CARD_{n}]",priority:90,severity:"high",description:"Ghana Card national ID",validator:(t,e)=>t.length!==15||!t.startsWith("GHA-")?false:/ghana|ghanaian|ghana[- ]?card|national[- ]?id|identity/i.test(e)},Hu={type:"MOROCCO_NATIONAL_ID",regex:/\b(?:CNIE|ID)[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*([A-Z]{1,2}\d{6,8}|\d{8})\b/gi,placeholder:"[MA_ID_{n}]",priority:85,severity:"high",description:"Morocco National ID (CNIE)",validator:(t,e)=>{let r=t.length;return r<6||r>10?false:/morocco|moroccan|cnie|national[- ]?id|identity/i.test(e)}},Fu=[Mu,xu,Lu,Uu,wu,Bu,ku,Hu],Zu={type:"INDONESIA_NIK",regex:/\b(\d{16})\b/g,placeholder:"[ID_NIK_{n}]",priority:90,severity:"high",description:"Indonesia NIK (National ID number, 16 digits)",validator:(t,e)=>t.length!==16?false:/indonesia|indonesian|nik|nomor[- ]?induk|ktp|national[- ]?id/i.test(e)},Gu={type:"INDONESIA_NPWP",regex:/\b(\d{2}\.?\d{3}\.?\d{3}\.?\d[-\.]?\d{3}\.?\d{3})\b/g,placeholder:"[ID_NPWP_{n}]",priority:90,severity:"high",description:"Indonesia NPWP (Tax ID number)",validator:(t,e)=>t.replace(/[.\-]/g,"").length!==15?false:/indonesia|npwp|tax|pajak|wajib[- ]?pajak/i.test(e)},$u={type:"THAILAND_NATIONAL_ID",regex:/\b(\d{13})\b/g,placeholder:"[TH_ID_{n}]",priority:90,severity:"high",description:"Thailand National ID (13 digits with checksum)",validator:(t,e)=>{if(t.length!==13||!/thailand|thai|national[- ]?id|บัตร|ประชาชน/i.test(e))return false;let r=t.split("").map(Number),i=0;for(let s=0;s<12;s++)i+=r[s]*(13-s);return (11-i%11)%10===r[12]}},Ku={type:"MALAYSIA_MYKAD",regex:/\b(\d{6}[-\s]?\d{2}[-\s]?\d{4})\b/g,placeholder:"[MY_IC_{n}]",priority:90,severity:"high",description:"Malaysia MyKad/IC number (12 digits)",validator:(t,e)=>{let r=t.replace(/[-\s]/g,"");if(r.length!==12||!/malaysia|malaysian|mykad|ic[- ]?number|kad[- ]?pengenalan/i.test(e))return false;let i=parseInt(r.substring(2,4)),s=parseInt(r.substring(4,6));return !(i<1||i>12||s<1||s>31)}},Wu={type:"PHILIPPINES_UMID",regex:/\b(\d{4}[-\s]?\d{7}[-\s]?\d)\b/g,placeholder:"[PH_UMID_{n}]",priority:85,severity:"high",description:"Philippines UMID number (12 digits)",validator:(t,e)=>t.replace(/[-\s]/g,"").length!==12?false:/philippines|filipino|umid|unified|multipurpose|national[- ]?id/i.test(e)},Yu={type:"VIETNAM_CCCD",regex:/\b(\d{12})\b/g,placeholder:"[VN_CCCD_{n}]",priority:85,severity:"high",description:"Vietnam CCCD (Citizen Identity Card, 12 digits)",validator:(t,e)=>t.length!==12?false:/vietnam|vietnamese|cccd|citizen[- ]?identity|cmnd|national[- ]?id/i.test(e)},zu={type:"MYANMAR_NRC",regex:/\b(\d{1,2}\/[A-Z][a-z]+\([NC]\)\d{6})\b/g,placeholder:"[MM_NRC_{n}]",priority:85,severity:"high",description:"Myanmar NRC (National Registration Card)",validator:(t,e)=>/\([NC]\)/.test(t)?/myanmar|burmese|nrc|national[- ]?registration|identity/i.test(e):false},Vu=[Zu,Gu,$u,Ku,Wu,Yu,zu],ju={type:"ARGENTINA_DNI",regex:/\b(\d{7,8})\b/g,placeholder:"[AR_DNI_{n}]",priority:90,severity:"high",description:"Argentina National ID (DNI)",validator:(t,e)=>{let r=t.length;return r!==7&&r!==8?false:/argentina|argentin|dni|documento\s?nacional|identidad/i.test(e)}},qu={type:"ARGENTINA_CUIT",regex:/\b(\d{2}-\d{8}-\d{1})\b/g,placeholder:"[AR_CUIT_{n}]",priority:90,severity:"high",description:"Argentina CUIT/CUIL (Tax ID)",validator:(t,e)=>t.replace(/-/g,"").length!==11?false:/argentina|cuit|cuil|tax|impuesto|tributario/i.test(e)},Xu={type:"CHILE_RUT",regex:/\b(\d{1,2}\.\d{3}\.\d{3}-[\dKk])\b/g,placeholder:"[CL_RUT_{n}]",priority:95,severity:"high",description:"Chile RUT (National ID/Tax ID)",validator:(t,e)=>{let r=t.replace(/[.\-]/g,"");if(r.length<8||r.length>9)return false;let i=r.slice(0,-1),s=r.slice(-1).toUpperCase(),n=0,a=2;for(let c=i.length-1;c>=0;c--)n+=parseInt(i[c])*a,a=a===7?2:a+1;let o=n%11;return s!==(o===0?"0":o===1?"K":String(11-o))?false:/chile|chilean|rut|rol\s?único|tributario|cédula/i.test(e)}},Ju={type:"COLOMBIA_CEDULA",regex:/\b(?:CC|CÉDULA|CEDULA)[-\s]?(?:NO|NUM)?[-\s]?[:#]?\s*(\d{6,10})\b/gi,placeholder:"[CO_CC_{n}]",priority:90,severity:"high",description:"Colombia C\xE9dula de Ciudadan\xEDa",validator:(t,e)=>{let r=t.length;return r<6||r>10?false:/colombia|colombian|cédula|cedula|ciudadanía|cc\s/i.test(e)}},Qu={type:"COLOMBIA_NIT",regex:/\bNIT[-\s]?(?:NO|NUM)?[-\s]?[:#]?\s*(\d{9}-\d{1})\b/gi,placeholder:"[CO_NIT_{n}]",priority:85,severity:"high",description:"Colombia NIT (Tax ID)",validator:(t,e)=>t.replace(/-/g,"").length!==10?false:/colombia|nit|tax|impuesto|tributario|empresa/i.test(e)},ep={type:"PERU_DNI",regex:/\b(\d{8})\b/g,placeholder:"[PE_DNI_{n}]",priority:90,severity:"high",description:"Peru National ID (DNI)",validator:(t,e)=>t.length!==8?false:/peru|peruvian|perú|peruano|dni|documento\s?nacional|identidad|reniec/i.test(e)},tp={type:"PERU_RUC",regex:/\bRUC[-\s]?(?:NO|NUM)?[-\s]?[:#]?\s*(\d{11})\b/gi,placeholder:"[PE_RUC_{n}]",priority:90,severity:"high",description:"Peru RUC (Tax ID)",validator:(t,e)=>{if(t.length!==11)return false;let r=t.substring(0,2);return ["10","15","17","20"].includes(r)?/peru|perú|ruc|tax|sunat|tributario/i.test(e):false}},rp={type:"VENEZUELA_CEDULA",regex:/\b([VE]-\d{1,8})\b/gi,placeholder:"[VE_CI_{n}]",priority:90,severity:"high",description:"Venezuela C\xE9dula de Identidad",validator:(t,e)=>!t.toUpperCase().startsWith("V-")&&!t.toUpperCase().startsWith("E-")?false:/venezuela|venezuelan|cédula|cedula|identidad|ci\s/i.test(e)},ip={type:"VENEZUELA_RIF",regex:/\b([VEJG]-\d{8,9}-\d{1})\b/gi,placeholder:"[VE_RIF_{n}]",priority:90,severity:"high",description:"Venezuela RIF (Tax ID)",validator:(t,e)=>{let r=t[0].toUpperCase();return ["V","E","J","G"].includes(r)?/venezuela|rif|tax|seniat|tributario/i.test(e):false}},sp={type:"ECUADOR_CEDULA",regex:/\b(\d{10})\b/g,placeholder:"[EC_CI_{n}]",priority:90,severity:"high",description:"Ecuador C\xE9dula de Identidad",validator:(t,e)=>{if(t.length!==10)return false;let r=parseInt(t.substring(0,2));if(r<1||r>24)return false;let i=parseInt(t[2]);return i>6&&i!==9?false:/ecuador|ecuadorian|cédula|cedula|identidad/i.test(e)}},np={type:"URUGUAY_CEDULA",regex:/\b(\d{1}\.\d{3}\.\d{3}-\d{1})\b/g,placeholder:"[UY_CI_{n}]",priority:90,severity:"high",description:"Uruguay C\xE9dula de Identidad",validator:(t,e)=>t.replace(/[.\-]/g,"").length!==8?false:/uruguay|uruguayan|cédula|cedula|identidad/i.test(e)},ap=[ju,qu,Xu,Ju,Qu,ep,tp,rp,ip,sp,np],op={type:"RUSSIAN_PASSPORT",regex:/\b(\d{4}\s?\d{6})\b/g,placeholder:"[RU_PASSPORT_{n}]",priority:90,severity:"high",description:"Russian Passport Number",validator:(t,e)=>t.replace(/\s/g,"").length!==10?false:/russia|russian|passport|паспорт|российский/i.test(e)},cp={type:"RUSSIAN_SNILS",regex:/\b(\d{3}-\d{3}-\d{3}\s?\d{2})\b/g,placeholder:"[RU_SNILS_{n}]",priority:90,severity:"high",description:"Russian SNILS (Pension Fund Number)",validator:(t,e)=>t.replace(/[-\s]/g,"").length!==11?false:/russia|russian|snils|снилс|pension|пенсионный/i.test(e)},lp={type:"UKRAINIAN_PASSPORT",regex:/\b([A-Z]{2}\d{6})\b/g,placeholder:"[UA_PASSPORT_{n}]",priority:90,severity:"high",description:"Ukrainian Passport Number",validator:(t,e)=>t.length!==8?false:/ukrain|passport|паспорт|український/i.test(e)},dp={type:"UKRAINIAN_INN",regex:/\bINN[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{10})\b/gi,placeholder:"[UA_INN_{n}]",priority:90,severity:"high",description:"Ukrainian Tax ID (INN)",validator:(t,e)=>t.length!==10?false:/ukrain|inn|tax|податковий|інн/i.test(e)},up={type:"CZECH_NATIONAL_ID",regex:/\b(\d{6}\/\d{4})\b/g,placeholder:"[CZ_ID_{n}]",priority:95,severity:"high",description:"Czech Republic National ID (Rodn\xE9 \u010D\xEDslo)",validator:(t,e)=>{let r=t.split("/");if(r.length!==2)return false;let i=r[0],s=r[1];if(i.length!==6||s.length!==4)return false;let n=parseInt(i.substring(2,4)),a=parseInt(i.substring(4,6)),o=n>50?n-50:n;return o<1||o>12||a<1||a>31?false:/czech|czechia|republic|rodné|číslo|national\s?id/i.test(e)}},pp={type:"ROMANIAN_CNP",regex:/\bCNP[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{13})\b/gi,placeholder:"[RO_CNP_{n}]",priority:95,severity:"high",description:"Romanian Personal Numeric Code (CNP)",validator:(t,e)=>{if(t.length!==13)return false;let r=parseInt(t[0]);if(r<1||r>9)return false;let i=parseInt(t.substring(3,5)),s=parseInt(t.substring(5,7));return i<1||i>12||s<1||s>31?false:/romania|romanian|cnp|cod\s?numeric|personal/i.test(e)}},hp={type:"HUNGARIAN_PERSONAL_ID",regex:/\b(\d{6}[A-Z]{2})\b/g,placeholder:"[HU_ID_{n}]",priority:90,severity:"high",description:"Hungarian Personal ID",validator:(t,e)=>t.length!==8?false:/hungar|magyar|személyi|igazolvány|personal\s?id/i.test(e)},gp={type:"HUNGARIAN_TAX_ID",regex:/\b(\d{10})\b/g,placeholder:"[HU_TAX_{n}]",priority:85,severity:"high",description:"Hungarian Tax ID (Ad\xF3azonos\xEDt\xF3 jel)",validator:(t,e)=>t.length!==10?false:/hungar|magyar|adó|tax|adóazonosító/i.test(e)},mp={type:"BULGARIAN_PERSONAL_NUMBER",regex:/\b(\d{10})\b/g,placeholder:"[BG_EGN_{n}]",priority:90,severity:"high",description:"Bulgarian Personal Number (EGN)",validator:(t,e)=>{if(t.length!==10)return false;let r=parseInt(t.substring(2,4)),i=parseInt(t.substring(4,6)),s=r>40?r-40:r>20?r-20:r;return s<1||s>12||i<1||i>31?false:/bulgaria|bulgarian|егн|personal\s?number|единен/i.test(e)}},Ep={type:"SERBIAN_JMBG",regex:/\b(\d{13})\b/g,placeholder:"[RS_JMBG_{n}]",priority:90,severity:"high",description:"Serbian Personal ID (JMBG)",validator:(t,e)=>{if(t.length!==13)return false;let r=parseInt(t.substring(0,2)),i=parseInt(t.substring(2,4));return r<1||r>31||i<1||i>12?false:/serb|serbia|jmbg|jedinstveni|matični|personal/i.test(e)}},fp=[op,cp,lp,dp,up,pp,hp,gp,mp,Ep],Ap={type:"NEW_ZEALAND_DRIVER_LICENSE",regex:/\b([A-Z]{2}\d{6})\b/g,placeholder:"[NZ_DL_{n}]",priority:90,severity:"high",description:"New Zealand Driver License Number",validator:(t,e)=>t.length!==8?false:/new\s?zealand|nz|kiwi|driver|license|licence/i.test(e)},yp={type:"NEW_ZEALAND_IRD",regex:/\bIRD[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{8,9})\b/gi,placeholder:"[NZ_IRD_{n}]",priority:90,severity:"high",description:"New Zealand IRD Number (Tax ID)",validator:(t,e)=>{let r=t.length;return r!==8&&r!==9?false:/new\s?zealand|nz|ird|tax|inland\s?revenue/i.test(e)}},Ip={type:"NEW_ZEALAND_PASSPORT",regex:/\b([A-Z]{2}\d{6})\b/g,placeholder:"[NZ_PASSPORT_{n}]",priority:85,severity:"high",description:"New Zealand Passport Number",validator:(t,e)=>t.length!==8?false:/new\s?zealand|nz|passport|travel\s?document/i.test(e)},_p={type:"FIJI_NATIONAL_ID",regex:/\b(?:FIJI|FJ)[-\s]?(?:ID|NATIONAL\s?ID)[-\s]?[:#]?\s*([A-Z0-9]{8,10})\b/gi,placeholder:"[FJ_ID_{n}]",priority:85,severity:"high",description:"Fiji National ID",validator:(t,e)=>/fiji|fijian|national\s?id|identity/i.test(e)},Np={type:"PNG_NATIONAL_ID",regex:/\b(?:PNG|PAPUA)[-\s]?(?:ID|NATIONAL\s?ID)[-\s]?[:#]?\s*([A-Z0-9]{8,12})\b/gi,placeholder:"[PNG_ID_{n}]",priority:85,severity:"high",description:"Papua New Guinea National ID",validator:(t,e)=>/papua|png|new\s?guinea|national\s?id|identity/i.test(e)},Rp={type:"SAMOA_NATIONAL_ID",regex:/\b(?:SAMOA|WS)[-\s]?(?:ID|NATIONAL\s?ID)[-\s]?[:#]?\s*(\d{8,10})\b/gi,placeholder:"[WS_ID_{n}]",priority:85,severity:"high",description:"Samoa National ID",validator:(t,e)=>/samoa|samoan|national\s?id|identity/i.test(e)},Tp={type:"TONGA_NATIONAL_ID",regex:/\b(?:TONGA|TO)[-\s]?(?:ID|NATIONAL\s?ID)[-\s]?[:#]?\s*([A-Z0-9]{8,10})\b/gi,placeholder:"[TO_ID_{n}]",priority:85,severity:"high",description:"Tonga National ID",validator:(t,e)=>/tonga|tongan|national\s?id|identity/i.test(e)},bp=[Ap,yp,Ip,_p,Np,Rp,Tp],Cp={type:"KAZAKHSTAN_IIN",regex:/\bIIN[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{12})\b/gi,placeholder:"[KZ_IIN_{n}]",priority:90,severity:"high",description:"Kazakhstan Individual Identification Number (IIN)",validator:(t,e)=>{if(t.length!==12)return false;parseInt(t.substring(0,2));let r=parseInt(t.substring(2,4)),i=parseInt(t.substring(4,6));return r<1||r>12||i<1||i>31?false:/kazakh|kazakhstan|iin|жсн|individual\s?identification/i.test(e)}},vp={type:"UZBEKISTAN_PASSPORT",regex:/\b([A-Z]{2}\d{7})\b/g,placeholder:"[UZ_PASSPORT_{n}]",priority:90,severity:"high",description:"Uzbekistan Passport Number",validator:(t,e)=>t.length!==9?false:/uzbek|uzbekistan|passport|pasport/i.test(e)},Sp={type:"UZBEKISTAN_STIR",regex:/\bSTIR[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{9})\b/gi,placeholder:"[UZ_STIR_{n}]",priority:90,severity:"high",description:"Uzbekistan Tax ID (STIR)",validator:(t,e)=>t.length!==9?false:/uzbek|uzbekistan|stir|tax|inn|soliq/i.test(e)},Pp={type:"KYRGYZSTAN_PIN",regex:/\bPIN[-\s]?(?:NO|NUM|NUMBER)?[-\s]?[:#]?\s*(\d{14})\b/gi,placeholder:"[KG_PIN_{n}]",priority:90,severity:"high",description:"Kyrgyzstan Personal ID Number (PIN)",validator:(t,e)=>t.length!==14?false:/kyrgyz|kyrgyzstan|pin|личный|номер/i.test(e)},Op={type:"TAJIKISTAN_NATIONAL_ID",regex:/\b(?:TAJIK|TJ)[-\s]?(?:ID|NATIONAL\s?ID)[-\s]?[:#]?\s*(\d{9,10})\b/gi,placeholder:"[TJ_ID_{n}]",priority:85,severity:"high",description:"Tajikistan National ID",validator:(t,e)=>{let r=t.length;return r!==9&&r!==10?false:/tajik|tajikistan|national\s?id|identity/i.test(e)}},Dp={type:"TURKMENISTAN_PASSPORT",regex:/\b([A-Z]\d{7})\b/g,placeholder:"[TM_PASSPORT_{n}]",priority:90,severity:"high",description:"Turkmenistan Passport Number",validator:(t,e)=>t.length!==8?false:/turkmen|turkmenistan|passport|pasport/i.test(e)},Mp=[Cp,vp,Sp,Pp,Op,Dp],xp={type:"GERMAN_TAX_ID",regex:/\b(\d{11})\b/g,placeholder:"[DE_TAX_ID_{n}]",priority:85,severity:"high",description:"German Tax Identification Number (Steueridentifikationsnummer)",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");if(!/^\d{11}$/.test(r)||!/steuer|tax|german|deutschland|finanzamt/i.test(e))return false;let i=r.split("").map(Number),s=new Map;i.forEach(c=>s.set(c,(s.get(c)||0)+1));let n=Array.from(s.values()),a=n.some(c=>c===2||c===3),o=n.every(c=>c<=3);return a&&o}},Lp={type:"FRENCH_SOCIAL_SECURITY",regex:/\b([12]\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{3}\s?\d{3}\s?\d{2})\b/g,placeholder:"[FR_SSN_{n}]",priority:90,severity:"high",description:"French Social Security Number",validator:(t,e)=>{let r=t.replace(/\s/g,"");if(!/^[12]/.test(r)||parseInt(r.substring(1,3))>99)return false;let i=parseInt(r.substring(3,5));return !(i<1||i>20)}},Up={type:"SPANISH_DNI",regex:/\b([0-9]{8}[-\s]?[A-Z]|[XYZ][-\s]?[0-9]{7}[-\s]?[A-Z])\b/gi,placeholder:"[ES_DNI_{n}]",priority:90,severity:"high",description:"Spanish National ID (DNI) or Foreigner ID (NIE)",validator:(t,e)=>{let r=t.replace(/[-\s]/g,"").toUpperCase(),i="TRWAGMYFPDXBNJZSQVHLCKE",s,n;/^[XYZ]/.test(r)?(s=r.substring(1,8),n=r[8],s=(r[0]==="X"?"0":r[0]==="Y"?"1":"2")+s):(s=r.substring(0,8),n=r[8]);let a=i[parseInt(s)%23];return n===a}},wp={type:"ITALIAN_FISCAL_CODE",regex:/\b([A-Z]{6}\d{2}[A-Z]\d{2}[A-Z]\d{3}[A-Z])\b/gi,placeholder:"[IT_CF_{n}]",priority:90,severity:"high",description:"Italian Fiscal Code (Codice Fiscale)",validator:(t,e)=>{let r=t.toUpperCase(),i=r[8];if(!"ABCDEHLMPRST".includes(i))return false;let s=parseInt(r.substring(9,11));if((s<1||s>31)&&(s<41||s>71))return false;let n={0:1,1:0,2:5,3:7,4:9,5:13,6:15,7:17,8:19,9:21,A:1,B:0,C:5,D:7,E:9,F:13,G:15,H:17,I:19,J:21,K:2,L:4,M:18,N:20,O:11,P:3,Q:6,R:8,S:12,T:14,U:16,V:10,W:22,X:25,Y:24,Z:23},a={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25},o=0;for(let c=0;c<15;c++){let l=r[c];o+=c%2===0?n[l]:a[l];}return String.fromCharCode(65+o%26)===r[15]}},Bp={type:"DUTCH_BSN",regex:/\b(\d{9})\b/g,placeholder:"[NL_BSN_{n}]",priority:90,severity:"high",description:"Dutch Citizen Service Number (BSN)",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");if(!/^\d{9}$/.test(r)||!/bsn|dutch|netherlands|nederland|burger/i.test(e))return false;let i=r.split("").map(Number),s=0;for(let n=0;n<8;n++)s+=i[n]*(9-n);return s-=i[8],s%11===0}},kp={type:"POLISH_PESEL",regex:/\b(\d{11})\b/g,placeholder:"[PL_PESEL_{n}]",priority:90,severity:"high",description:"Polish National Identification Number (PESEL)",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");if(!/^\d{11}$/.test(r)||!/pesel|polish|poland|polska/i.test(e))return false;let i=[1,3,7,9,1,3,7,9,1,3],s=r.split("").map(Number),n=0;for(let a=0;a<10;a++)n+=s[a]*i[a];return (10-n%10)%10===s[10]}},Hp={type:"INDIAN_AADHAAR",regex:/\b(\d{4}\s?\d{4}\s?\d{4})\b/g,placeholder:"[IN_AADHAAR_{n}]",priority:95,severity:"high",description:"Indian Aadhaar Number",validator:(t,e)=>{let r=t.replace(/\s/g,"");return /aadhaar|aadhar|india|indian|uid/i.test(e)?r.length===12&&/^\d{12}$/.test(r):false}},Fp={type:"AUSTRALIAN_MEDICARE",regex:/\b([2-6]\d{3}\s?\d{5}\s?\d)\b/g,placeholder:"[AU_MEDICARE_{n}]",priority:90,severity:"high",description:"Australian Medicare Number",validator:(t,e)=>{let r=t.replace(/\s/g,"");if(!/^[2-6]/.test(r))return false;let i=[1,3,7,9,1,3,7,9],s=r.split("").map(Number),n=0;for(let a=0;a<8;a++)n+=s[a]*i[a];return n%10===s[8]}},Zp={type:"AUSTRALIAN_TFN",regex:/\b(\d{3}\s?\d{3}\s?\d{3})\b/g,placeholder:"[AU_TFN_{n}]",priority:95,severity:"high",description:"Australian Tax File Number",validator:(t,e)=>{let r=t.replace(/\s/g,"");if(!/tfn|tax.file|australian|australia/i.test(e))return false;let i=[1,4,3,7,5,8,6,9,10],s=r.split("").map(Number),n=0;for(let a=0;a<9;a++)n+=s[a]*i[a];return n%11===0}},Gp={type:"SINGAPORE_NRIC",regex:/\b([STFGM]\d{7}[A-Z])\b/gi,placeholder:"[SG_NRIC_{n}]",priority:90,severity:"high",description:"Singapore NRIC/FIN",validator:(t,e)=>{let r=t.toUpperCase(),i=r[0],s=r.substring(1,8).split("").map(Number),n=r[8],a=[2,7,6,5,4,3,2],o=0;for(let p=0;p<7;p++)o+=s[p]*a[p];let c="JZIHGFEDCBA",l="XWUTRQPNMLK",d="KMLKJIHGFEDCBA",u;return i==="S"||i==="T"?u=c[o%11]:i==="F"||i==="G"?u=l[o%11]:u=d[o%11],n===u}},$p={type:"JAPANESE_MY_NUMBER",regex:/\b(\d{4}\s?\d{4}\s?\d{4})\b/g,placeholder:"[JP_MY_NUMBER_{n}]",priority:95,severity:"high",description:"Japanese My Number",validator:(t,e)=>{let r=t.replace(/\s/g,"");if(!/my.number|japan|japanese|マイナンバー/i.test(e))return false;let i=r.split("").map(Number),s=[1,2,1,2,1,2,1,2,1,2,1],n=0;for(let a=0;a<11;a++){let o=i[a]*s[a];n+=Math.floor(o/10)+o%10;}return (10-n%10)%10===i[11]}},Kp={type:"SOUTH_KOREAN_RRN",regex:/\b(\d{6}[-\s]?[1-4]\d{6})\b/g,placeholder:"[KR_RRN_{n}]",priority:95,severity:"high",description:"South Korean Resident Registration Number",validator:(t,e)=>{let r=t.replace(/[-\s]/g,"");if(!/rrn|korean|korea|주민등록번호/i.test(e))return false;let i=parseInt(r[6]);if(i<1||i>4)return false;let s=[2,3,4,5,6,7,8,9,2,3,4,5],n=r.split("").map(Number),a=0;for(let o=0;o<12;o++)a+=n[o]*s[o];return (11-a%11)%10===n[12]}},Wp={type:"CANADIAN_SIN",regex:/\b(\d{3}[-\s]?\d{3}[-\s]?\d{3})\b/g,placeholder:"[CA_SIN_{n}]",priority:95,severity:"high",description:"Canadian Social Insurance Number",validator:(t,e)=>{let r=t.replace(/[-\s]/g,"");if(!/sin|social.insurance|canadian|canada/i.test(e))return false;let i=r.split("").map(Number),s=0;for(let n=0;n<9;n++){let a=i[n];n%2===1&&(a*=2,a>9&&(a-=9)),s+=a;}return s%10===0}},Yp={type:"BRAZILIAN_CPF",regex:/\b(\d{3}\.?\d{3}\.?\d{3}-?\d{2})\b/g,placeholder:"[BR_CPF_{n}]",priority:90,severity:"high",description:"Brazilian CPF (Individual Taxpayer ID)",validator:(t,e)=>{let r=t.replace(/[.\-]/g,"").split("").map(Number);if(new Set(r).size===1)return false;let i=0;for(let a=0;a<9;a++)i+=r[a]*(10-a);let s=11-i%11;if(s>=10&&(s=0),s!==r[9])return false;i=0;for(let a=0;a<10;a++)i+=r[a]*(11-a);let n=11-i%11;return n>=10&&(n=0),n===r[10]}},zp={type:"BRAZILIAN_CNPJ",regex:/\b(\d{2}\.?\d{3}\.?\d{3}\/?\d{4}-?\d{2})\b/g,placeholder:"[BR_CNPJ_{n}]",priority:85,severity:"high",description:"Brazilian CNPJ (Company Tax ID)",validator:(t,e)=>{let r=t.replace(/[.\-\/]/g,"").split("").map(Number),i=[5,4,3,2,9,8,7,6,5,4,3,2],s=0;for(let c=0;c<12;c++)s+=r[c]*i[c];let n=s%11;if(n=n<2?0:11-n,n!==r[12])return false;let a=[6,5,4,3,2,9,8,7,6,5,4,3,2];s=0;for(let c=0;c<13;c++)s+=r[c]*a[c];let o=s%11;return o=o<2?0:11-o,o===r[13]}},Vp={type:"MEXICAN_CURP",regex:/\b([A-Z]{4}\d{6}[HM][A-Z]{5}[0-9A-Z]\d)\b/gi,placeholder:"[MX_CURP_{n}]",priority:90,severity:"high",description:"Mexican CURP (Population Registry Code)",validator:(t,e)=>{let r=t.toUpperCase(),i=r[10];if(i!=="H"&&i!=="M")return false;let s=["AS","BC","BS","CC","CL","CM","CS","CH","DF","DG","GT","GR","HG","JC","MC","MN","MS","NT","NL","OC","PL","QT","QR","SP","SL","SR","TC","TS","TL","VZ","YN","ZS","NE"],n=r.substring(11,13);return s.includes(n)}},jp={type:"MEXICAN_RFC",regex:/\b([A-Z&Ñ]{3,4}\d{6}[A-Z0-9]{2,3})\b/gi,placeholder:"[MX_RFC_{n}]",priority:90,severity:"high",description:"Mexican RFC (Tax ID)",validator:(t,e)=>{let r=t.toUpperCase();if(!/rfc|mexican|mexico|impuesto|contribuyente/i.test(e)||r.length!==12&&r.length!==13)return false;let i=parseInt(r.substring(6,8)),s=parseInt(r.substring(8,10));return !(i<1||i>12||s<1||s>31)}},jt=[xp,Lp,Up,wp,Bp,kp,Hp,Fp,Zp,Gp,$p,Kp,Wp,Yp,zp,Vp,jp,...Du,...Fu,...Vu,...ap,...fp,...bp,...Mp],qp={type:"DISCORD_USER_ID",regex:/\b(\d{17,19})\b/g,placeholder:"[DISCORD_ID_{n}]",priority:85,severity:"medium",description:"Discord user ID (Snowflake format)",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");return r.length<17||r.length>19?false:/discord|snowflake|user[-_]?id|server|guild/i.test(e)}},Xp={type:"STEAM_ID64",regex:/\b(765\d{14})\b/g,placeholder:"[STEAM_ID_{n}]",priority:85,severity:"medium",description:"Steam 64-bit user ID",validator:(t,e)=>{let r=t.replace(/[\s\u00A0.-]/g,"");return !r.startsWith("765")||r.length!==17?false:/steam|gaming|player|profile|valve|community/i.test(e)}},Jp={type:"SOCIAL_MEDIA_HANDLE",regex:/@([a-zA-Z0-9_]{3,30})\b/g,placeholder:"[@HANDLE_{n}]",priority:75,severity:"medium",description:"Social media handle/username",validator:(t,e)=>t.length<3||t.length>30?false:/twitter|instagram|tiktok|social|handle|profile|mention|tag/i.test(e)},Qp={type:"TWITTER_USER_ID",regex:/\b(\d{5,19})\b/g,placeholder:"[TWITTER_ID_{n}]",priority:75,severity:"medium",description:"Twitter/X numeric user ID",validator:(t,e)=>{let r=t.length;return r<5||r>19?false:/twitter|tweet|@|user[-_]?id|x\.com/i.test(e)}},eh={type:"FACEBOOK_ID",regex:/\b(\d{15,17})\b/g,placeholder:"[FB_ID_{n}]",priority:75,severity:"medium",description:"Facebook numeric profile ID",validator:(t,e)=>{let r=t.length;return r<15||r>17?false:/facebook|fb|profile|meta|user[-_]?id/i.test(e)}},th={type:"INSTAGRAM_USERNAME",regex:/\b([a-zA-Z0-9._]{3,30})\b/g,placeholder:"[IG_USER_{n}]",priority:70,severity:"medium",description:"Instagram username",validator:(t,e)=>t.length<3||t.length>30||!/^[a-zA-Z0-9._]+$/.test(t)?false:/instagram|ig|insta|profile|handle|username|follow/i.test(e)},rh={type:"TIKTOK_USERNAME",regex:/@([a-zA-Z0-9._]{2,24})\b/g,placeholder:"[@TIKTOK_{n}]",priority:75,severity:"medium",description:"TikTok username",validator:(t,e)=>t.length<2||t.length>24?false:/tiktok|tt|video|profile|creator/i.test(e)},ih={type:"LINKEDIN_PROFILE",regex:/\/in\/([a-zA-Z0-9-]{3,100})\/?/g,placeholder:"[LINKEDIN_{n}]",priority:80,severity:"medium",description:"LinkedIn profile URL identifier",validator:(t,e)=>t.length<3||t.length>100?false:/linkedin|profile|professional|connection|network/i.test(e)},sh={type:"YOUTUBE_CHANNEL_ID",regex:/\b(UC[a-zA-Z0-9_-]{22})\b/g,placeholder:"[YT_CHANNEL_{n}]",priority:75,severity:"low",description:"YouTube channel ID",validator:(t,e)=>!t.startsWith("UC")||t.length!==24?false:/youtube|yt|channel|video|creator|subscriber/i.test(e)},nh={type:"REDDIT_USERNAME",regex:/u\/([a-zA-Z0-9_-]{3,20})\b/g,placeholder:"[REDDIT_{n}]",priority:75,severity:"medium",description:"Reddit username",validator:(t,e)=>t.length<3||t.length>20?false:/reddit|subreddit|post|comment|karma/i.test(e)},ah={type:"XBOX_GAMERTAG",regex:/\b([a-zA-Z][a-zA-Z0-9 ]{2,14})\b/g,placeholder:"[XBOX_TAG_{n}]",priority:70,severity:"medium",description:"Xbox Live Gamertag",validator:(t,e)=>t.length<3||t.length>15||!/^[a-zA-Z]/.test(t)?false:/xbox|gamertag|live|microsoft|gaming|player/i.test(e)},oh={type:"PSN_ID",regex:/\b([a-zA-Z][a-zA-Z0-9_-]{2,15})\b/g,placeholder:"[PSN_{n}]",priority:70,severity:"medium",description:"PlayStation Network ID",validator:(t,e)=>t.length<3||t.length>16||!/^[a-zA-Z]/.test(t)?false:/playstation|psn|sony|ps4|ps5|gamer|player/i.test(e)},ch={type:"NINTENDO_FRIEND_CODE",regex:/\bSW[-\s]?(\d{4}[-\s]?\d{4}[-\s]?\d{4})\b/gi,placeholder:"[NINTENDO_FC_{n}]",priority:90,severity:"medium",description:"Nintendo Switch Friend Code",validator:(t,e)=>t.replace(/\D/g,"").length!==12?false:/nintendo|switch|friend[- ]?code|gaming/i.test(e)},lh={type:"BATTLETAG",regex:/\b([a-zA-Z][a-zA-Z0-9]{2,11}#\d{4,5})\b/g,placeholder:"[BTAG_{n}]",priority:80,severity:"medium",description:"Battle.net BattleTag",validator:(t,e)=>{let r=t.split("#");return r.length!==2||r[0].length<3||r[0].length>12||r[1].length<4||r[1].length>5?false:/battle|battletag|blizzard|overwatch|warcraft|diablo/i.test(e)}},dh={type:"EPIC_GAMES_ID",regex:/\b([a-f0-9]{32})\b/gi,placeholder:"[EPIC_ID_{n}]",priority:75,severity:"medium",description:"Epic Games account ID",validator:(t,e)=>t.length!==32||!/^[a-f0-9]+$/i.test(t)?false:/epic|fortnite|unreal|games|launcher|account/i.test(e)},uh={type:"TELEGRAM_USER_ID",regex:/\b(\d{6,10})\b/g,placeholder:"[TG_ID_{n}]",priority:70,severity:"medium",description:"Telegram user ID",validator:(t,e)=>{let r=t.length;return r<6||r>10?false:/telegram|tg|chat|user[-_]?id|messenger/i.test(e)}},qt=[qp,Xp,Jp,Qp,eh,th,rh,ih,sh,nh,ah,oh,ch,lh,dh,uh],dt=[...At,...yt,...Rt,...It,..._t,...Nt,...Tt,...bt,...Ct,...vt,...St,...Pt,...Ot,...Dt,...Ht,...Ft,...Zt,...Gt,...$t,...Kt,...Wt,...Yt,...zt,...Vt,...Mt,...xt,...Lt,...Ut,...wt,...Bt,...kt,...jt,...qt];function U(t){switch(t){case "personal":return At;case "financial":case "crypto":case "cryptocurrency":return [...yt,...Rt,...bt];case "government":return [...It,...jt];case "contact":return _t;case "network":return Nt;case "healthcare":return Tt;case "legal":return vt;case "education":return St;case "hr":case "recruitment":return Pt;case "credentials":case "technology":return Ct;case "insurance":return Ot;case "retail":case "ecommerce":return Dt;case "telecoms":case "telecommunications":case "utilities":return Mt;case "manufacturing":return xt;case "transportation":case "automotive":return Lt;case "media":case "publishing":return Ut;case "charitable":case "charity":case "nonprofit":case "ngo":return wt;case "procurement":case "purchasing":case "supply-chain":return Bt;case "emergency":case "emergency-services":case "public-safety":case "911":case "first-responders":return kt;case "digital-identity":case "social-media":case "gaming":case "online-identity":return qt;case "real-estate":case "property":case "realestate":return Ht;case "gig-economy":case "gig":case "rideshare":case "delivery":case "freelance":return Ft;case "hospitality":case "tourism":case "travel":case "hotel":case "airline":return Zt;case "certifications":case "professional-certifications":case "licenses":return Gt;case "esports":case "videogames":case "gamers":return $t;case "vehicles":case "license-plates":case "vin":return Kt;case "logistics":case "shipping":case "tracking":case "freight":return Wt;case "aviation":case "flight":case "aircraft":return Yt;case "maritime":case "vessel":case "marine":case "ship":return zt;case "environmental":case "regulatory":case "epa":case "compliance":case "permits":return Vt;default:return []}}function ph(t){let e=2166136261;for(let r=0;r<t.length;r++)e^=t.charCodeAt(r),e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24);return e>>>0}function hh(t,e){return (ph(`${e}:${t.toLowerCase()}`)%1e4).toString().padStart(4,"0")}var gh={includeNames:true,includeEmails:true,includePhones:true,includeAddresses:true,patterns:["EMAIL","NAME","PHONE_UK","PHONE_UK_MOBILE","PHONE_INTERNATIONAL","IPV4","IPV6","POSTCODE_UK","ADDRESS_STREET","NATIONAL_INSURANCE_UK","NHS_NUMBER","PASSPORT_UK","DRIVING_LICENSE_UK","IBAN","CREDIT_CARD"]},mh={includeNames:true,includeEmails:true,includePhones:true,includeAddresses:true,patterns:["EMAIL","NAME","SSN","PHONE_US","ZIP_CODE_US","ADDRESS_STREET","DATE_OF_BIRTH","PASSPORT_US","DRIVING_LICENSE_US","CREDIT_CARD","BANK_ACCOUNT_UK","IPV4","IPV6","EMPLOYEE_ID"]},Eh={includeNames:true,includeEmails:true,includePhones:true,includeAddresses:true,patterns:["EMAIL","NAME","SSN","PHONE_US","ZIP_CODE_US","ADDRESS_STREET","IPV4","IPV6","CREDIT_CARD","PASSPORT_US","DRIVING_LICENSE_US","USERNAME"]},fh={includeNames:true,includeEmails:true,includePhones:true,includeAddresses:true,categories:["personal","contact","healthcare","insurance","government"]},Ah={includeNames:true,includeEmails:true,includePhones:true,includeAddresses:true,categories:["personal","contact","healthcare","insurance","government"]},yh={includeNames:true,includeEmails:true,includePhones:true,includeAddresses:true,categories:["personal","contact","financial","government","network"]},Ih={includeNames:true,includeEmails:true,includePhones:true,includeAddresses:true,categories:["personal","contact","education","government","network"]},_h={includeNames:true,includeEmails:true,includePhones:true,includeAddresses:true,categories:["personal","contact","transportation","logistics","vehicles","network"]},Nh={includeNames:true,includeEmails:true,includePhones:true,includeAddresses:true,categories:["personal","contact","financial","network"]},Rh={includeNames:true,includeEmails:true,includePhones:true,includeAddresses:true,categories:["personal","contact","financial","government","network","digital-identity"]};function Th(t){switch(t.toLowerCase()){case "gdpr":return gh;case "hipaa":return mh;case "ccpa":return Eh;case "healthcare":case "healthcare-provider":return fh;case "healthcare-research":return Ah;case "finance":case "financial-services":return yh;case "education":return Ih;case "transport-logistics":case "transportation":case "logistics":return _h;case "pci-dss":case "pci_dss":return Nh;case "soc2":case "soc-2":return Rh;default:return {}}}function bh(t,e,r,i){switch(r){case "placeholder":return i;case "mask-middle":return Ch(t,e);case "mask-all":return "*".repeat(t.length);case "format-preserving":return vh(t);case "token-replace":return Sh(t,e);default:return i}}function Ch(t,e){if(e.includes("EMAIL")){let a=t.indexOf("@");if(a>0){let o=t.substring(0,a),c=t.substring(a);return (o.length<=2?"*".repeat(o.length):o[0]+"*".repeat(o.length-1))+c}}if(e.includes("PHONE")){let a=t.replace(/\D/g,"");if(a.length>=10){let o=a.substring(0,3),c=a.substring(a.length-4),l=a.length-7;return `${o}-${"*".repeat(l>0?l:2)}-${c}`}}if(e==="SSN"){let a=t.replace(/\D/g,"");if(a.length===9)return `***-**-${a.substring(5)}`}if(e==="CREDIT_CARD"){let a=t.replace(/\D/g,"");if(a.length>=13){let o=a.substring(0,4),c=a.substring(a.length-4),l=Math.floor((a.length-8)/4);return `${o}-${("****-".repeat(l)+"****").substring(0,a.length-8)}-${c}`}}if(t.length<=4)return "*".repeat(t.length);let r=Math.min(2,Math.floor(t.length*.2)),i=t.substring(0,r),s=t.substring(t.length-r),n=t.length-r*2;return `${i}${"*".repeat(n)}${s}`}function vh(t,e){let r="";for(let i=0;i<t.length;i++){let s=t[i];/[a-zA-Z0-9]/.test(s)?/[a-zA-Z]/.test(s)?r+=s===s.toUpperCase()?"X":"x":r+="X":r+=s;}return r}function Sh(t,e){let r=Ph(t);if(e.includes("EMAIL")){let i=["example.com","test.com","sample.org","demo.net"],s=["user","john.doe","jane.smith","test.account"];return `${s[r%s.length]}${r%100}@${i[r%i.length]}`}if(e.includes("PHONE"))return `(555) ${r%900+100}-${r%9e3+1e3}`;if(e==="SSN")return `${r%899+100}-${(r%99+1).toString().padStart(2,"0")}-${(r%9999+1).toString().padStart(4,"0")}`;if(e==="CREDIT_CARD")return `4532-${[(r%9e3+1e3).toString(),(r%9e3+1e3).toString(),(r%9e3+1e3).toString()].join("-")}`;if(e.includes("NAME")){let i=["John","Jane","Alex","Sam","Chris","Pat"],s=["Smith","Johnson","Williams","Brown","Jones","Davis"];return `${i[r%i.length]} ${s[(r>>4)%s.length]}`}return `[REDACTED_${e}]`}function Ph(t){let e=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);e=(e<<5)-e+i,e=e&e;}return Math.abs(e)}var Oh=class{constructor(t=".openredaction/learnings.json",e={}){this.filePath=t,this.autoSave=e.autoSave??true,this.confidenceThreshold=e.confidenceThreshold??.85,this.data=this.load();}load(){try{if(l(this.filePath)){let t=k$1(this.filePath,"utf-8");return JSON.parse(t)}}catch{}return {version:"1.0",whitelist:[],patternAdjustments:[],stats:{totalDetections:0,falsePositives:0,falseNegatives:0,accuracy:1,lastUpdated:Date.now()}}}save(){try{let t=h(this.filePath);l(t)||(void 0)(t,{recursive:!0}),this.data.stats.lastUpdated=Date.now(),(void 0)(this.filePath,JSON.stringify(this.data,null,2));}catch(t){console.error("Failed to save learning data:",t);}}recordFalsePositive(t,e,r){this.data.stats.falsePositives++,this.data.stats.totalDetections++,this.updateAccuracy();let i=this.data.whitelist.find(s=>s.pattern===t);i?(i.occurrences++,i.lastSeen=Date.now(),i.contexts.includes(r)||i.contexts.push(r),i.confidence=Math.min(.99,i.confidence+.05)):(i={pattern:t,confidence:.5,occurrences:1,firstSeen:Date.now(),lastSeen:Date.now(),contexts:[r]},this.data.whitelist.push(i)),this.autoSave&&this.save();}recordFalseNegative(t,e,r){this.data.stats.falseNegatives++,this.data.stats.totalDetections++,this.updateAccuracy();let i=this.data.patternAdjustments.find(s=>s.type===e&&s.examples.includes(t));i?(i.occurrences++,i.confidence=Math.min(.99,i.confidence+.05)):(i={type:e,issue:"Pattern not detected",suggestion:`Consider adding pattern for: ${t}`,confidence:.5,examples:[t],occurrences:1},this.data.patternAdjustments.push(i)),this.autoSave&&this.save();}recordCorrectDetection(){this.data.stats.totalDetections++,this.updateAccuracy(),this.autoSave&&this.save();}updateAccuracy(){let t=this.data.stats.totalDetections;if(t===0){this.data.stats.accuracy=1;return}let e=this.data.stats.falsePositives+this.data.stats.falseNegatives;this.data.stats.accuracy=(t-e)/t;}getWhitelist(){return this.data.whitelist.filter(t=>t.confidence>=this.confidenceThreshold).map(t=>t.pattern)}getWhitelistEntries(){return this.data.whitelist}getPatternAdjustments(){return this.data.patternAdjustments.filter(t=>t.confidence>=this.confidenceThreshold).sort((t,e)=>e.occurrences-t.occurrences)}getAllPatternAdjustments(){return this.data.patternAdjustments}getStats(){return {...this.data.stats}}getConfidence(t){return this.data.whitelist.find(e=>e.pattern===t)?.confidence??0}getOccurrences(t){return this.data.whitelist.find(e=>e.pattern===t)?.occurrences??0}addToWhitelist(t,e=.9){let r=this.data.whitelist.find(i=>i.pattern===t);r?(r.confidence=e,r.occurrences++,r.lastSeen=Date.now()):this.data.whitelist.push({pattern:t,confidence:e,occurrences:1,firstSeen:Date.now(),lastSeen:Date.now(),contexts:[]}),this.autoSave&&this.save();}removeFromWhitelist(t){this.data.whitelist=this.data.whitelist.filter(e=>e.pattern!==t),this.autoSave&&this.save();}clear(){this.data={version:"1.0",whitelist:[],patternAdjustments:[],stats:{totalDetections:0,falsePositives:0,falseNegatives:0,accuracy:1,lastUpdated:Date.now()}},this.autoSave&&this.save();}export(t={}){let e=t.minConfidence??.7,r=t.includeContexts??false;return {version:this.data.version,whitelist:this.data.whitelist.filter(i=>i.confidence>=e).map(i=>({...i,contexts:r?i.contexts:[]})),patternAdjustments:this.data.patternAdjustments.filter(i=>i.confidence>=e),stats:this.data.stats}}import(t,e=true){if(!e){this.data=t,this.save();return}for(let r of t.whitelist){let i=this.data.whitelist.find(s=>s.pattern===r.pattern);i?(i.confidence=Math.max(i.confidence,r.confidence),i.occurrences+=r.occurrences,i.lastSeen=Math.max(i.lastSeen,r.lastSeen),i.contexts=[...new Set([...i.contexts,...r.contexts])]):this.data.whitelist.push(r);}for(let r of t.patternAdjustments){let i=this.data.patternAdjustments.find(s=>s.type===r.type&&s.issue===r.issue);i?(i.confidence=Math.max(i.confidence,r.confidence),i.occurrences+=r.occurrences,i.examples=[...new Set([...i.examples,...r.examples])]):this.data.patternAdjustments.push(r);}this.data.stats.totalDetections+=t.stats.totalDetections,this.data.stats.falsePositives+=t.stats.falsePositives,this.data.stats.falseNegatives+=t.stats.falseNegatives,this.updateAccuracy(),this.autoSave&&this.save();}flush(){this.save();}},Dh=class{constructor(t,e=process.cwd()){this.configPath=t||"",this.searchPaths=[e,f(e,".openredaction"),f(process.env.HOME||"~",".openredaction")];}findConfigFile(){if(this.configPath&&l(this.configPath))return this.configPath;let t=[".openredaction.config.js",".openredaction.config.mjs",".openredaction.config.json","openredaction.config.js","openredaction.config.mjs","openredaction.config.json"];for(let e of this.searchPaths)for(let r of t){let i=f(e,r);if(l(i))return i}return null}async load(){let t=this.findConfigFile();if(!t)return null;try{if(t.endsWith(".json")){let r=k$1(t,"utf-8");return JSON.parse(r)}let e=await import(t);return e.default||e}catch(e){return console.error(`Failed to load config from ${t}:`,e),null}}resolveConfig(t){let e={...t};if(t.extends){let r=Array.isArray(t.extends)?t.extends:[t.extends];for(let i of r){let s=this.loadPreset(i);s&&Object.assign(e,s,t);}}return e}loadPreset(t){if(t==="openredaction:recommended")return {includeNames:true,includeAddresses:true,includePhones:true,includeEmails:true,deterministic:true};if(t==="openredaction:strict")return {includeNames:true,includeAddresses:true,includePhones:true,includeEmails:true,deterministic:true,preset:"gdpr"};if(t==="openredaction:minimal")return {includeNames:false,includeAddresses:false,includePhones:true,includeEmails:true,deterministic:true};if(t.startsWith("openredaction:")){let e=t.replace("openredaction:","");if(["gdpr","hipaa","ccpa","healthcare","healthcare-provider","healthcare-research","finance","financial-services","education","transport-logistics","transportation","logistics"].includes(e))return {preset:e}}return null}static createDefaultConfig(t=".openredaction.config.js"){(void 0)(t,`/**
|
|
53
|
+
* OpenRedaction Configuration
|
|
54
|
+
* @see https://github.com/sam247/openredaction
|
|
55
|
+
*/
|
|
56
|
+
export default {
|
|
57
|
+
// Extend built-in presets
|
|
58
|
+
// Options: 'openredaction:recommended', 'openredaction:strict', 'openredaction:minimal'
|
|
59
|
+
// Or compliance/industry presets: 'openredaction:gdpr', 'openredaction:hipaa', 'openredaction:ccpa',
|
|
60
|
+
// 'openredaction:finance', 'openredaction:education', 'openredaction:healthcare', 'openredaction:transport-logistics'
|
|
61
|
+
extends: ['openredaction:recommended'],
|
|
62
|
+
|
|
63
|
+
// Detection options
|
|
64
|
+
includeNames: true,
|
|
65
|
+
includeAddresses: true,
|
|
66
|
+
includePhones: true,
|
|
67
|
+
includeEmails: true,
|
|
68
|
+
|
|
69
|
+
// Deterministic placeholders (same PII -> same placeholder)
|
|
70
|
+
deterministic: true,
|
|
71
|
+
|
|
72
|
+
// Whitelist - patterns to never redact
|
|
73
|
+
whitelist: [
|
|
74
|
+
'Example Corp',
|
|
75
|
+
'Test User',
|
|
76
|
+
'API'
|
|
77
|
+
],
|
|
78
|
+
|
|
79
|
+
// Custom patterns
|
|
80
|
+
customPatterns: [
|
|
81
|
+
{
|
|
82
|
+
name: 'INTERNAL_ID',
|
|
83
|
+
regex: /INT-\\d{6}/g,
|
|
84
|
+
category: 'personal',
|
|
85
|
+
priority: 90,
|
|
86
|
+
description: 'Internal employee ID'
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
|
|
90
|
+
// Learning options
|
|
91
|
+
learnedPatterns: '.openredaction/learnings.json',
|
|
92
|
+
learningOptions: {
|
|
93
|
+
autoSave: true,
|
|
94
|
+
confidenceThreshold: 0.85
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
`),console.log(`Created config file: ${t}`);}};function Mh(t,e,r,i=5,s=5){let n=t.substring(Math.max(0,e-250),e).split(/\s+/).filter(c=>c.length>0).slice(-i),a=n.join(" "),o=t.substring(r,Math.min(t.length,r+250)).split(/\s+/).filter(c=>c.length>0).slice(0,s);return {before:a,after:o.join(" "),beforeWords:n,afterWords:o,sentence:xh(t,e,r)}}function xh(t,e,r){let i=Lh(t,e),s=Uh(t,r);return t.substring(i,s).trim()}function Lh(t,e){for(let r=e-1;r>=0;r--){let i=t[r];if(i==="."||i==="!"||i==="?"||i===`
|
|
98
|
+
`)return r+1}return 0}function Uh(t,e){for(let r=e;r<t.length;r++){let i=t[r];if(i==="."||i==="!"||i==="?"||i===`
|
|
99
|
+
`)return r+1}return t.length}function wh(t){let e=t.substring(0,Math.min(1e3,t.length)).toLowerCase(),r=(e.match(/\b(from|to|subject|dear|regards|sincerely|cc|bcc):/gi)||[]).length,i=(e.match(/\b(function|const|let|var|class|import|export|return|if|else|for|while)\b/g)||[]).length,s=(e.match(/<.*?>|^\[?\d{1,2}:\d{2}\]?|^>|^@/gm)||[]).length;return i>5?"code":r>2?"email":s>3?"chat":"document"}function Bh(t){let e=t.toLowerCase(),r=(e.match(/\b(api|sdk|cli|gui|json|xml|http|url|database|server|client|endpoint|variable|function|method|class|interface|code|debug|log)\b/g)||[]).length>0,i=(e.match(/\b(company|corporation|corp|ltd|llc|inc|ceo|cto|cfo|manager|director|employee|staff|team|department|office|business)\b/g)||[]).length>0,s=(e.match(/\b(patient|doctor|physician|nurse|hospital|clinic|medical|health|diagnosis|treatment|prescription|medication|surgery|exam|test|lab|specimen)\b/g)||[]).length>0,n=(e.match(/\b(bank|account|payment|transaction|transfer|wire|credit|debit|balance|deposit|withdrawal|loan|mortgage|investment|trading|stock|bond)\b/g)||[]).length>0,a=[/\b(test|testing|dummy|mock|fake)\s+(data|value|example|user|account|email|phone)/i,/\bfor\s+(testing|demonstration|example)\s+purposes/i,/\b(this|here)\s+is\s+(an?\s+)?(example|sample|test)/i,/\bxxx+|000+|111+|123+/i,/\blorem\s+ipsum/i],o=(e.match(/\b(example|sample|test|demo|placeholder|dummy|mock)\b/g)||[]).length;return {hasTechnicalContext:r,hasBusinessContext:i,hasMedicalContext:s,hasFinancialContext:n,hasExampleContext:a.some(c=>c.test(t))||o>=2,relativePosition:0}}function kh(t,e,r){let i=.8;r.documentType==="code"?["API_KEY","JWT","BEARER_TOKEN","AWS_ACCESS_KEY","GITHUB_TOKEN","SECRET"].some(a=>e.includes(a))||(i-=.15):r.documentType==="email"&&["EMAIL","PHONE","NAME","ADDRESS"].includes(e.split("_")[0])&&(i+=.1),r.features.hasExampleContext&&e==="EMAIL"&&(i-=.15),r.features.hasMedicalContext&&["MEDICAL","MRN","PATIENT","NHS","NPI","DEA","ICD","CPT","PRESCRIPTION"].some(a=>e.includes(a))&&(i+=.15),r.features.hasFinancialContext&&["ACCOUNT","TRANSACTION","SWIFT","IBAN","BITCOIN","ETHEREUM","CRYPTO","PAYMENT","CREDIT_CARD"].some(a=>e.includes(a))&&(i+=.15),r.features.hasTechnicalContext&&!["API_KEY","TOKEN","SECRET","AWS","GITHUB","STRIPE","JWT"].some(a=>e.includes(a))&&(i-=.05);let s=r.before.toLowerCase(),n=r.after.toLowerCase();for(let a of [{pattern:/\b(dear|hello|hi|mr|mrs|ms|dr)\s*$/i,boost:.2,types:["NAME"]},{pattern:/^(is|was|wrote|said|told)/i,boost:.15,types:["NAME"]},{pattern:/\b(call|phone|tel|mobile):\s*$/i,boost:.2,types:["PHONE"]},{pattern:/\b(email|e-mail|contact):\s*$/i,boost:.2,types:["EMAIL"]},{pattern:/\b(patient|subject|participant):\s*$/i,boost:.25,types:["NAME","PATIENT_ID","MRN"]},{pattern:/\b(account|acct)[\s#:]*$/i,boost:.2,types:["ACCOUNT","BANK"]}])a.pattern.test(s)&&a.types.some(o=>e.includes(o))&&(i+=a.boost);for(let a of [{pattern:/\b(the|a|an)\s*$/i,penalty:.3,types:["NAME"]},{pattern:/\b(version|v|release)\s*$/i,penalty:.4,types:["PHONE","NUMBER"]},{pattern:/^\s*(street|avenue|road|drive|way)/i,penalty:.2,types:["NAME"]}])(a.pattern.test(s)||a.pattern.test(n))&&a.types.some(o=>e.includes(o))&&(i-=a.penalty);return Math.max(0,Math.min(1,i))}function Ce(t,e,r,i,s){let{before:n,after:a,beforeWords:o,afterWords:c,sentence:l}=Mh(t,i,s),d=wh(t),u=Bh(n+" "+e+" "+a);return u.relativePosition=i/t.length,{beforeWords:o,afterWords:c,sentence:l,documentType:d,confidence:kh(e,r,{before:n,after:a,documentType:d,features:u})}}var Hh=[{patternType:["PHONE","PHONE_UK","PHONE_US"],matcher:(t,e)=>!!(/\b(version|v|ver|release|build)\s*[:\s]*/i.test(e)||/^\d{1,2}\.\d{1,2}\.\d{1,4}$/.test(t.replace(/[\s()-]/g,""))),description:"Version number mistaken for phone number",severity:"high"},{patternType:["PHONE","PHONE_UK","PHONE_US"],matcher:(t,e)=>{if(/\b(date|born|birth|dob|created|updated|on|since|until|before|after)\s*[:\s]*/i.test(e))return true;let r=[/^\d{2}[-/]\d{2}[-/]\d{4}$/,/^\d{4}[-/]\d{2}[-/]\d{2}$/,/^\d{2}[-/]\d{2}[-/]\d{2}$/],i=t.replace(/[\s()]/g,"");return r.some(s=>s.test(i))},description:"Date mistaken for phone number",severity:"high"},{patternType:["PHONE","ACCOUNT","ID"],matcher:(t,e)=>/^(\d{1,3}\.){3}\d{1,3}$/.test(t)?true:/\b(ip|address|server|host|network|subnet)\s*[:\s]*/i.test(e),description:"IP address mistaken for PII",severity:"high"},{patternType:["PHONE","NUMBER"],matcher:(t,e)=>/\b(cm|mm|km|m|ft|in|inch|meter|mile|kg|lb|oz|gram|litre|liter|ml|gb|mb|kb)\s*$/i.test(e+" "+t)||/\b(size|width|height|length|weight|distance|volume|capacity|dimension)\s*[:\s]*/i.test(e),description:"Measurement mistaken for PII",severity:"medium"},{patternType:["PHONE","ID","NUMBER"],matcher:t=>{let e=/^(19|20)\d{2}$/,r=t.replace(/[\s()-]/g,"");return e.test(r)},description:"Year mistaken for PII",severity:"medium"},{patternType:["PHONE","ACCOUNT","NUMBER"],matcher:(t,e)=>/\b(price|cost|amount|total|subtotal|fee|charge|payment|\$|£|€|¥|USD|GBP|EUR)\s*[:\s]*/i.test(e)?true:/^\d{1,6}\.\d{2}$/.test(t.replace(/[\s,]/g,"")),description:"Price mistaken for PII",severity:"medium"},{patternType:["PHONE","ID","NUMBER"],matcher:(t,e)=>/\bport[:\s]*$/i.test(e)&&/^([1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$/.test(t),description:"Port number mistaken for PII",severity:"high"},{patternType:["PHONE","NUMBER"],matcher:(t,e)=>{let r=e+" "+t;return /\d+(\.\d+)?\s*(percent|percentage|%)/i.test(r)},description:"Percentage mistaken for PII",severity:"high"},{patternType:["NAME","EMAIL"],matcher:(t,e)=>/\b(foo|bar|baz|qux|example|test|demo|sample|placeholder|dummy|mock)\b/i.test(t.toLowerCase())?true:/(\/\/|\/\*|\*|#|--|<!--|;)/.test(e),description:"Technical placeholder mistaken for PII",severity:"high"},{patternType:["EMAIL","NAME","PHONE","ADDRESS"],matcher:t=>[/test\d*@/i,/example\.com$/i,/foo@/i,/bar@/i,/johndoe/i,/janedoe/i,/^xxx+$/i,/^000[-\s]*000[-\s]*000/i].some(e=>e.test(t)),description:"Test data mistaken for PII",severity:"high"},{patternType:["NAME"],matcher:(t,e)=>/\b(the|a|an)\s*$/i.test(e),description:"Common word after article, not a name",severity:"medium"},{patternType:["INSTAGRAM_USERNAME","TIKTOK_USERNAME"],matcher:(t,e)=>new Set(["its","and","the","for","are","but","not","you","all","can","had","her","was","one","our","out","has","him","his","how","man","new","now","old","see","way","who","boy","did","get","let","put","say","she","too","use","latest","design","deliver","flexible","personalized","entertainment","experience","powered","portable","projector","designed","announced","launch","global","range","spaces","more","cross","wide"]).has(t.toLowerCase()),description:"Common English word mistaken for social username",severity:"high"},{patternType:["NAME"],matcher:(t,e)=>{let r=["function","const","let","var","class","interface","type","enum","public","private","protected","static","async","await","return","import","export","from","default","extends","implements"],i=t.toLowerCase();return r.includes(i)?true:/\b(def|fn|func|method|prop|attr)\s*[:\s]*/i.test(e)},description:"Programming keyword mistaken for name",severity:"high"},{patternType:["EMAIL"],matcher:t=>{let e=["localhost","example.com","example.org","example.net","test.com","demo.com","sample.com","invalid.com","domain.com"],r=t.split("@")[1]?.toLowerCase();return e.includes(r)},description:"Example email domain",severity:"high"},{patternType:["ACCOUNT","CARD"],matcher:(t,e)=>{if(/^0+$/.test(t.replace(/[\s-]/g,"")))return true;let r=t.replace(/[\s-]/g,"");return !!(/^(\d)\1+$/.test(r)||/^(0123456789|1234567890|9876543210)/.test(r))},description:"Test account/card number",severity:"high"},{patternType:["PHONE","ID","NUMBER"],matcher:(t,e)=>/\b(timestamp|time|epoch|unix|millis|seconds|created.at|updated.at)\s*[:\s]*/i.test(e),description:"Timestamp mistaken for PII",severity:"medium"}];function Xt(t,e,r,i=Hh){for(let s of i)if((Array.isArray(s.patternType)?s.patternType.some(n=>e.includes(n)):e.includes(s.patternType))&&s.matcher(t,r))return {isFalsePositive:true,matchedRule:s,confidence:s.severity==="high"?.9:s.severity==="medium"?.7:.5};return {isFalsePositive:false,confidence:0}}var Fh=[{name:"critical-credentials",minPriority:95,maxPriority:100,includeTypes:["API_KEY","TOKEN","SECRET","PASSWORD","PRIVATE_KEY","AWS","GITHUB","STRIPE","OPENAI"],description:"Critical credentials and API keys (priority 95-100)"},{name:"high-confidence",minPriority:85,maxPriority:94,description:"High-confidence patterns with strong validation (priority 85-94)"},{name:"standard-pii",minPriority:70,maxPriority:84,description:"Standard PII patterns (priority 70-84)"},{name:"low-priority",minPriority:0,maxPriority:69,description:"Low priority patterns (priority 0-69)"}];function Zh(t,e=Fh){let r=new Map;for(let i of e)r.set(i.name,[]);for(let i of t)for(let s of e)if(!(i.priority<s.minPriority||i.priority>s.maxPriority)&&!(s.includeTypes&&s.includeTypes.length>0&&!s.includeTypes.some(n=>i.type.includes(n)))&&!(s.excludeTypes&&s.excludeTypes.length>0&&s.excludeTypes.some(n=>i.type.includes(n)))){r.get(s.name).push(i);break}for(let[i,s]of r.entries())s.sort((n,a)=>a.priority-n.priority),r.set(i,s);return r}function Gh(t,e,r){return r.some(([i,s])=>t>=i&&t<s||e>i&&e<=s||t<=i&&e>=s)}function $h(t,e){let r=[],i=[];for(let s of e){let n=t.get(s.name)||[];for(let a of n){let[o,c]=a.position;Gh(o,c,i)||(r.push(a),i.push([o,c]));}}return r}function Kh(t){let e=Math.min(Math.max(t?.numPasses||3,2),5),i=[],s=0,n=89,a=n-s,o=e-1,c=Math.floor(a/o),l=[];for(let d=0;d<o;d++){let u=s+d*c,p=d===o-1?n:s+(d+1)*c-1;l.push({name:`pass-${d+1}`,minPriority:u,maxPriority:p,description:`Priority ${u}-${p}`});}return i.push(...l.reverse()),i.unshift({name:"credentials",minPriority:90,maxPriority:100,includeTypes:["API_KEY","TOKEN","SECRET","PASSWORD","AWS","GITHUB","STRIPE","JWT","OPENAI"],description:"Credentials and API keys"}),i}var Wh=class{constructor(){this.available=false;try{this.nlp=K("compromise"),this.available=!0;}catch{this.available=false;}}isAvailable(){return this.available}detect(t){if(!this.available||!this.nlp)return [];let e=[];try{let r=this.nlp(t);r.people().forEach(i=>{let s=i.text(),n=t.indexOf(s);n!==-1&&e.push({type:"PERSON",text:s,start:n,end:n+s.length,confidence:.85,context:{sentence:this.getSentence(t,n),tags:i.tags()}});}),r.organizations().forEach(i=>{let s=i.text(),n=t.indexOf(s);n!==-1&&e.push({type:"ORGANIZATION",text:s,start:n,end:n+s.length,confidence:.8,context:{sentence:this.getSentence(t,n),tags:i.tags()}});}),r.places().forEach(i=>{let s=i.text(),n=t.indexOf(s);n!==-1&&e.push({type:"PLACE",text:s,start:n,end:n+s.length,confidence:.75,context:{sentence:this.getSentence(t,n),tags:i.tags()}});}),r.dates().forEach(i=>{let s=i.text(),n=t.indexOf(s);n!==-1&&e.push({type:"DATE",text:s,start:n,end:n+s.length,confidence:.9,context:{sentence:this.getSentence(t,n),tags:i.tags()}});}),r.money().forEach(i=>{let s=i.text(),n=t.indexOf(s);n!==-1&&e.push({type:"MONEY",text:s,start:n,end:n+s.length,confidence:.85,context:{sentence:this.getSentence(t,n),tags:i.tags()}});}),r.match("#Email").forEach(i=>{let s=i.text(),n=t.indexOf(s);n!==-1&&e.push({type:"EMAIL",text:s,start:n,end:n+s.length,confidence:.95,context:{sentence:this.getSentence(t,n)}});}),r.match("#PhoneNumber").forEach(i=>{let s=i.text(),n=t.indexOf(s);n!==-1&&e.push({type:"PHONE",text:s,start:n,end:n+s.length,confidence:.85,context:{sentence:this.getSentence(t,n)}});}),r.match("#Url").forEach(i=>{let s=i.text(),n=t.indexOf(s);n!==-1&&e.push({type:"URL",text:s,start:n,end:n+s.length,confidence:.9,context:{sentence:this.getSentence(t,n)}});});}catch(r){return console.warn("[NERDetector] Detection failed:",r),[]}return this.deduplicateMatches(e)}isConfirmedByNER(t,e){for(let r of e)if(this.calculateOverlap(t.start,t.end,r.start,r.end)>.5)return {confirmed:true,confidence:r.confidence};return {confirmed:false}}hybridDetection(t,e){if(!this.available)return t.map(i=>({...i,nerConfirmed:false}));let r=this.detect(e);return t.map(i=>{let{confirmed:s,confidence:n}=this.isConfirmedByNER(i,r);if(s&&n){let a=Math.min(1,i.confidence*1.3);return {...i,confidence:a,nerConfirmed:true,nerConfidence:n}}return {...i,nerConfirmed:false}})}calculateOverlap(t,e,r,i){let s=Math.max(t,r),n=Math.min(e,i);return s>=n?0:(n-s)/Math.min(e-t,i-r)}deduplicateMatches(t){let e=new Set,r=[];for(let i of t){let s=`${i.type}:${i.start}:${i.end}:${i.text}`;e.has(s)||(e.add(s),r.push(i));}return r}getSentence(t,e){let r=this.findSentenceStart(t,e),i=this.findSentenceEnd(t,e);return t.substring(r,i).trim()}findSentenceStart(t,e){for(let r=e-1;r>=0;r--){let i=t[r];if(i==="."||i==="!"||i==="?"||i===`
|
|
100
|
+
`)return r+1}return 0}findSentenceEnd(t,e){for(let r=e;r<t.length;r++){let i=t[r];if(i==="."||i==="!"||i==="?"||i===`
|
|
101
|
+
`)return r+1}return t.length}extractNEROnly(t,e){let r=[];for(let i of t)e.some(s=>this.calculateOverlap(s.start,s.end,i.start,i.end)>.3)||r.push(i);return r}};var Yh=[{patternType:"EMAIL",keywords:["email","e-mail","contact","reach","write","send to"],proximityWindow:5,confidenceBoost:.2,keywordBefore:true,description:"Email preceded by email-related keywords"},{patternType:"EMAIL",keywords:["example","test","sample","demo"],proximityWindow:8,confidencePenalty:.25,description:"Email near test/example keywords"},{patternType:["PHONE","PHONE_UK","PHONE_US","PHONE_UK_MOBILE"],keywords:["call","phone","tel","telephone","mobile","cell","ring","dial"],proximityWindow:5,confidenceBoost:.2,keywordBefore:true,description:"Phone number preceded by phone-related keywords"},{patternType:["PHONE","PHONE_UK","PHONE_US"],keywords:["fax","fax number"],proximityWindow:5,confidencePenalty:.15,description:"Likely a fax number, not personal phone"},{patternType:"NAME",keywords:["mr","mrs","ms","miss","dr","prof","professor","dear","hello","hi"],proximityWindow:3,confidenceBoost:.25,keywordBefore:true,description:"Name preceded by salutation"},{patternType:"NAME",keywords:["said","wrote","told","asked","replied","mentioned","stated"],proximityWindow:5,confidenceBoost:.15,keywordBefore:true,description:"Name preceded by speech verb"},{patternType:"NAME",keywords:["the","a","an","this","that"],proximityWindow:1,confidencePenalty:.3,keywordBefore:true,description:"Preceded by article - likely not a name"},{patternType:"SSN",keywords:["ssn","social security","social security number","social-security"],proximityWindow:8,confidenceBoost:.25,description:"SSN near SSN-related keywords"},{patternType:"SSN",keywords:["example","test","sample","123-45-6789","000-00-0000"],proximityWindow:10,confidencePenalty:.4,description:"SSN near example/test keywords or obvious test SSN"},{patternType:["BANK_ACCOUNT","ACCOUNT_NUMBER","IBAN","SWIFT"],keywords:["account","acct","account number","account#","bank account"],proximityWindow:8,confidenceBoost:.2,description:"Account number near account-related keywords"},{patternType:"CREDIT_CARD",keywords:["card","credit card","debit card","visa","mastercard","amex","discover","\u30AB\u30FC\u30C9","\u30AF\u30EC\u30B8\u30C3\u30C8","\u756A\u53F7"],proximityWindow:8,confidenceBoost:.2,description:"Card number near card-related keywords"},{patternType:"CREDIT_CARD",keywords:["test","example","4111","4111111111111111"],proximityWindow:10,confidencePenalty:.35,description:"Near test card numbers"},{patternType:["ADDRESS","STREET_ADDRESS"],keywords:["address","street","lives at","located at","residing at"],proximityWindow:8,confidenceBoost:.15,description:"Address near address-related keywords"},{patternType:["MRN","PATIENT_ID","NHS_NUMBER","MEDICAL_RECORD"],keywords:["patient","subject","participant","mrn","medical record"],proximityWindow:8,confidenceBoost:.25,description:"Medical ID near medical keywords"},{patternType:"DATE_OF_BIRTH",keywords:["dob","date of birth","birth date","birthdate","born","birthday"],proximityWindow:8,confidenceBoost:.25,description:"DOB near birth-related keywords"},{patternType:"PASSPORT",keywords:["passport","passport number","passport#"],proximityWindow:8,confidenceBoost:.2,description:"Passport near passport keywords"},{patternType:["DRIVERS_LICENSE","DRIVING_LICENCE"],keywords:["license","licence","driver","driving","dl#","dl number"],proximityWindow:8,confidenceBoost:.2,description:"License near license keywords"}],zh=[{domain:"medical",terms:["patient","doctor","physician","nurse","hospital","clinic","medical","health","diagnosis","treatment","prescription","medication","surgery","exam","test","lab","specimen","chart","record","mrn","hipaa","healthcare","practitioner","provider","pharmacy","radiology"],boostPatterns:["MRN","PATIENT_ID","NHS_NUMBER","NPI","DEA","MEDICAL"],boostAmount:.15},{domain:"legal",terms:["case","court","judge","attorney","lawyer","counsel","plaintiff","defendant","lawsuit","litigation","docket","tribunal","hearing","deposition","subpoena","warrant","verdict","settlement","contract","agreement","legal","law","bar number","case number"],boostPatterns:["CASE_NUMBER","DOCKET","BAR_NUMBER","LEGAL"],boostAmount:.15},{domain:"financial",terms:["bank","account","payment","transaction","transfer","wire","credit","debit","balance","deposit","withdrawal","loan","mortgage","investment","trading","stock","bond","portfolio","iban","swift","routing","bic","ach","financial","finance","money","currency","crypto"],boostPatterns:["BANK_ACCOUNT","IBAN","SWIFT","ROUTING","CREDIT_CARD","BITCOIN"],boostAmount:.15},{domain:"hr",terms:["employee","staff","personnel","workforce","human resources","hr","payroll","salary","compensation","benefits","onboarding","offboarding","termination","resignation","promotion","performance","review","evaluation","disciplinary","complaint","grievance","harassment"],boostPatterns:["EMPLOYEE_ID","PAYROLL","HR"],boostAmount:.15},{domain:"technical",terms:["api","key","token","secret","password","credential","auth","authentication","authorization","oauth","jwt","bearer","session","access","refresh","client","server","endpoint","webhook","sdk"],boostPatterns:["API_KEY","JWT","BEARER_TOKEN","AWS_ACCESS_KEY","SECRET"],boostAmount:.2}],Vh=class{constructor(t){let e=t?.useDefaultRules!==false;this.proximityRules=[...e?Yh:[],...t?.proximityRules||[]],this.domainVocabularies=[...e?zh:[],...t?.domainVocabularies||[]];}applyProximityRules(t,e){let r=t.confidence,i=this.proximityRules.filter(s=>Array.isArray(s.patternType)?s.patternType.some(n=>t.type.includes(n)):t.type.includes(s.patternType));for(let s of i)this.checkProximity(e,t.start,t.end,s.keywords,s.proximityWindow||10,s.keywordBefore,s.keywordAfter)&&(s.confidenceBoost&&(r+=s.confidenceBoost),s.confidencePenalty&&(r-=s.confidencePenalty));return r=Math.max(0,Math.min(1,r)),{...t,confidence:r}}applyDomainBoosting(t,e){let r=this.detectDomains(e);return r.length===0?t:t.map(i=>{let s=false,n=i.confidence;for(let a of r){let o=this.domainVocabularies.find(c=>c.domain===a);o&&o.boostPatterns&&o.boostPatterns.some(c=>i.type.includes(c))&&(n+=o.boostAmount||.15,s=true);}return s?{...i,confidence:Math.min(1,n)}:i})}checkProximity(t,e,r,i,s,n,a){let o=t.substring(Math.max(0,e-500),e),c=t.substring(r,Math.min(t.length,r+500)),l=o.split(/\s+/).filter(E=>E.length>0),d=c.split(/\s+/).filter(E=>E.length>0),u=l.slice(-s),p=d.slice(0,s),h=u.join(" ").toLowerCase(),A=p.join(" ").toLowerCase();for(let E of i){let g=E.toLowerCase();if(n&&h.includes(g)||a&&A.includes(g)||!n&&!a&&(h.includes(g)||A.includes(g)))return true}return false}detectDomains(t){let e=t.toLowerCase(),r=[];for(let i of this.domainVocabularies){let s=0;for(let n of i.terms)e.includes(n.toLowerCase())&&s++;s>=3&&r.push(i.domain);}return r}addProximityRule(t){this.proximityRules.push(t);}addDomainVocabulary(t){this.domainVocabularies.push(t);}getProximityRules(){return [...this.proximityRules]}getDomainVocabularies(){return [...this.domainVocabularies]}};var jh={SSN:"critical",SOCIAL_SECURITY:"critical",CREDIT_CARD:"critical",CVV:"critical",BANK_ACCOUNT:"critical",ROUTING_NUMBER:"critical",PASSPORT:"critical",DRIVERS_LICENSE:"critical",DRIVING_LICENCE:"critical",NHS_NUMBER:"critical",NI_NUMBER:"critical",NATIONAL_INSURANCE:"critical",TAX_ID:"critical",EIN:"critical",ITIN:"critical",SIN:"critical",TFN:"critical",AADHAAR:"critical",MEDICAL_RECORD:"critical",MRN:"critical",PATIENT_ID:"critical",DEA_NUMBER:"critical",NPI:"critical",API_KEY:"critical",SECRET_KEY:"critical",AWS_SECRET_KEY:"critical",PRIVATE_KEY:"critical",SSH_KEY:"critical",JWT:"critical",OAUTH_SECRET:"critical",PASSWORD:"critical",BEARER_TOKEN:"critical",BITCOIN_PRIVATE:"critical",EMAIL:"high",PHONE:"high",PHONE_UK:"high",PHONE_US:"high",PHONE_MOBILE:"high",NAME:"high",FULL_NAME:"high",DATE_OF_BIRTH:"high",DOB:"high",ADDRESS:"high",STREET_ADDRESS:"high",IBAN:"high",SWIFT:"high",BIC:"high",IFSC:"high",CLABE:"high",IP_ADDRESS:"high",MAC_ADDRESS:"high",VEHICLE_VIN:"high",LICENSE_PLATE:"high",GITHUB_TOKEN:"high",AWS_ACCESS_KEY:"high",STRIPE_KEY:"high",GOOGLE_API_KEY:"high",OPENAI_API_KEY:"high",PRESCRIPTION:"high",BIOMETRIC:"high",EMPLOYEE_ID:"medium",USERNAME:"medium",COMPANY_NUMBER:"medium",VAT_NUMBER:"medium",UTR:"medium",ORDER_NUMBER:"medium",INVOICE_NUMBER:"medium",ACCOUNT_NUMBER:"medium",CUSTOMER_ID:"medium",TRANSACTION_ID:"medium",CASE_NUMBER:"medium",DOCKET_NUMBER:"medium",BAR_NUMBER:"medium",TRACKING_NUMBER:"medium",SESSION_ID:"medium",DEVICE_ID:"medium",CERTIFICATE_NUMBER:"medium",POLICY_NUMBER:"medium",MEMBERSHIP_ID:"medium",LOYALTY_CARD:"medium",GIFT_CARD:"medium",BITCOIN_ADDRESS:"medium",ETHEREUM_ADDRESS:"medium",CRYPTOCURRENCY:"medium",POSTCODE:"low",ZIP_CODE:"low",POSTAL_CODE:"low",URL:"low",DOMAIN:"low",ORGANIZATION:"low",COMPANY:"low",PRODUCT_SKU:"low",COUPON_CODE:"low",PROMO_CODE:"low",PLACEHOLDER:"low"},H={critical:10,high:7,medium:4,low:2},qh=class{constructor(t){this.severityMap={...jh,...t||{}};}classify(t){if(this.severityMap[t])return {level:this.severityMap[t],score:H[this.severityMap[t]],reason:`Mapped severity for ${t}`};for(let[e,r]of Object.entries(this.severityMap))if(t.includes(e)||e.includes(t))return {level:r,score:H[r],reason:`Partial match: ${t} \u2248 ${e}`};return {level:"medium",score:H.medium,reason:"Unknown pattern type, defaulting to medium"}}ensurePatternSeverity(t){if(t.severity)return t;let e=this.classify(t.type);return {...t,severity:e.level}}ensureAllSeverity(t){return t.map(e=>this.ensurePatternSeverity(e))}calculateRiskScore(t){if(t.length===0)return {score:0,level:"minimal",factors:{piiCount:0,avgSeverity:0,avgConfidence:0,criticalCount:0,highCount:0}};let e=0,r=0,i=0,s=0,n=0,a=0;for(let g of t)g.severity==="critical"?e++:g.severity==="high"?r++:g.severity==="medium"?i++:g.severity==="low"&&s++,n+=g.confidence||.8,a+=H[g.severity];let o=n/t.length,c=a/t.length,l=Math.min(t.length/10,1),d=c/10,u=Math.min(e/5,1),p=o,h=.3*l+.3*d+.3*u+.1*p,A=Math.max(0,Math.min(1,h)),E;return A>=.8?E="very-high":A>=.6?E="high":A>=.4?E="medium":A>=.2?E="low":E="minimal",{score:A,level:E,factors:{piiCount:t.length,avgSeverity:c,avgConfidence:o,criticalCount:e,highCount:r}}}getSeverity(t){return this.classify(t).level}getSeverityScore(t){return this.classify(t).score}addSeverityMapping(t,e){this.severityMap[t]=e;}getSeverityMap(){return {...this.severityMap}}filterBySeverity(t,e){let r=H[e];return t.filter(i=>H[i.severity]>=r)}groupBySeverity(t){let e={critical:[],high:[],medium:[],low:[]};for(let r of t)e[r.severity].push(r);return e}};var Xh=class{constructor(t=100){this.cache=new Map,this.maxSize=t;}get(t){let e=this.cache.get(t);return e!==void 0&&(this.cache.delete(t),this.cache.set(t,e)),e}set(t,e){if(this.cache.has(t)&&this.cache.delete(t),this.cache.set(t,e),this.cache.size>this.maxSize){let r=this.cache.keys().next().value;this.cache.delete(r);}}has(t){return this.cache.has(t)}clear(){this.cache.clear();}get size(){return this.cache.size}};function ut(t){let e=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);e=(e<<5)-e+i,e=e&e;}return e.toString(36)}var Jh=class{constructor(t){this.detector=t,this.patterns=t.getPatterns();let e=t.options;this.options={enableContextAnalysis:e?.enableContextAnalysis||false,confidenceThreshold:e?.confidenceThreshold||.5,enableFalsePositiveFilter:e?.enableFalsePositiveFilter||false,falsePositiveThreshold:e?.falsePositiveThreshold||.7,whitelist:e?.whitelist||[]};}async explain(t){let e=[],r=[],i=[],s=[];for(let a of this.patterns){let o=new RegExp(a.regex.source,a.regex.flags).exec(t);if(!o){let g={pattern:a,matched:false,reason:"Pattern regex did not match text"};e.push(g),i.push(g);continue}let c=o[1]!==void 0?o[1]:o[0],l=o[0],d,u;if(o[1]!==void 0){let g=l.indexOf(c);d=o.index+g,u=d+c.length;}else d=o.index,u=d+c.length;let p=Math.max(0,d-50),h=Math.min(t.length,u+50),A=t.substring(p,h),E={pattern:a,matched:true,matchedValue:c,position:[d,u]};if(a.validator){let g=a.validator(c,A);if(E.validatorPassed=g,!g){E.reason="Failed pattern validator",e.push(E),s.push(E);continue}}if(this.options.enableFalsePositiveFilter){let g=Xt(c,a.type,A);if(E.falsePositiveCheck={isFalsePositive:g.isFalsePositive,confidence:g.confidence,reason:g.matchedRule?.description},g.isFalsePositive&&g.confidence>=this.options.falsePositiveThreshold){E.reason=`Filtered as false positive: ${g.matchedRule?.description||"Unknown reason"}`,e.push(E),s.push(E);continue}}if(this.options.enableContextAnalysis){let g=Ce(t,c,a.type,d,u);if(E.contextAnalysis=g,g.confidence<this.options.confidenceThreshold){E.reason=`Low confidence (${(g.confidence*100).toFixed(1)}% < ${this.options.confidenceThreshold*100}% threshold)`,e.push(E),s.push(E);continue}}if(this.options.whitelist.some(g=>c.toLowerCase().includes(g.toLowerCase()))){E.reason="Matched whitelist term",e.push(E),s.push(E);continue}e.push(E),r.push(E);}let n=(await this.detector.detect(t)).detections;return {text:t,patternResults:e,matchedPatterns:r,unmatchedPatterns:i,filteredPatterns:s,detections:n,summary:{totalPatternsChecked:this.patterns.length,patternsMatched:r.length,patternsFiltered:s.length,finalDetections:n.length}}}async explainDetection(t,e){let r=this.patterns.find(n=>n.type===t.type),i=[];i.push(`Detected as ${t.type}`),i.push(`Severity: ${t.severity}`),t.confidence!==void 0&&i.push(`Confidence: ${(t.confidence*100).toFixed(1)}%`),r&&(i.push(`Matched pattern: ${r.description||r.type}`),i.push(`Pattern priority: ${r.priority}`));let s;if(t.confidence!==void 0){let[n,a]=t.position;s=Ce(e,t.value,t.type,n,a),s&&(i.push(`Document type: ${s.documentType}`),i.push(`Context confidence: ${(s.confidence*100).toFixed(1)}%`));}return {detection:t,pattern:r,contextAnalysis:s,reasoning:i,suggestions:[]}}async suggestWhy(t,e){let r=[],i=[],s=this.patterns.filter(n=>n.type===e||n.type.includes(e));if(s.length===0)return r.push(`No patterns found for type: ${e}`),r.push("Available types: "+[...new Set(this.patterns.map(n=>n.type))].join(", ")),{text:t,expectedType:e,suggestions:r,similarPatterns:i};for(let n of s){let a=new RegExp(n.regex.source,n.regex.flags).exec(t);if(a){i.push(n);let o=a[1]!==void 0?a[1]:a[0];r.push(`Pattern "${n.type}" matched value: "${o}"`);let c=(await this.explain(t)).filteredPatterns.find(l=>l.pattern.type===n.type);c&&c.reason&&r.push(`But was filtered: ${c.reason}`);}}if(i.length===0&&(r.push(`Text didn't match any ${e} patterns`),r.push("Possible reasons:"),r.push(" - Format doesn't match expected pattern"),r.push(" - Contains invalid characters"),r.push(" - Fails validation checks"),r.push(" - Too short or too long"),s.length>0)){let n=s[0];r.push(`
|
|
102
|
+
Example ${e} pattern: ${n.regex.source.substring(0,100)}...`);}return {text:t,expectedType:e,suggestions:r,similarPatterns:i}}async debug(t){let e=performance.now(),r=await this.explain(t),i=performance.now()-e,s=[];return this.options.enableContextAnalysis&&s.push("Context Analysis"),this.options.enableFalsePositiveFilter&&s.push("False Positive Filter"),this.options.whitelist.length>0&&s.push(`Whitelist (${this.options.whitelist.length} entries)`),{text:t,textLength:t.length,enabledFeatures:s,patternCount:this.patterns.length,explanation:r,performance:{estimatedTime:`${i.toFixed(2)}ms`}}}};function Qh(t){return new Jh(t)}var eg=class{constructor(t){}generate(t,e){let r={format:e.format,type:e.type||"summary",title:e.title||"PII Detection Report",includeOriginalText:e.includeOriginalText??false,includeRedactedText:e.includeRedactedText??true,includeDetectionDetails:e.includeDetectionDetails??true,includeStatistics:e.includeStatistics??true,includeExplanation:e.includeExplanation??false,organizationName:e.organizationName||"Organization",metadata:e.metadata||{}};return r.format==="html"?this.generateHTML(t,r):this.generateMarkdown(t,r)}generateHTML(t,e){let r=new Date().toISOString(),i=this.calculateStatistics(t),s=`<!DOCTYPE html>
|
|
103
|
+
<html lang="en">
|
|
104
|
+
<head>
|
|
105
|
+
<meta charset="UTF-8">
|
|
106
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
107
|
+
<title>${this.escapeHtml(e.title)}</title>
|
|
108
|
+
<style>
|
|
109
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
110
|
+
body {
|
|
111
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
112
|
+
line-height: 1.6;
|
|
113
|
+
color: #333;
|
|
114
|
+
background: #f5f5f5;
|
|
115
|
+
padding: 20px;
|
|
116
|
+
}
|
|
117
|
+
.container {
|
|
118
|
+
max-width: 1200px;
|
|
119
|
+
margin: 0 auto;
|
|
120
|
+
background: white;
|
|
121
|
+
padding: 40px;
|
|
122
|
+
border-radius: 8px;
|
|
123
|
+
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
|
124
|
+
}
|
|
125
|
+
h1 {
|
|
126
|
+
color: #2c3e50;
|
|
127
|
+
border-bottom: 3px solid #3498db;
|
|
128
|
+
padding-bottom: 10px;
|
|
129
|
+
margin-bottom: 20px;
|
|
130
|
+
}
|
|
131
|
+
h2 {
|
|
132
|
+
color: #34495e;
|
|
133
|
+
margin-top: 30px;
|
|
134
|
+
margin-bottom: 15px;
|
|
135
|
+
border-bottom: 2px solid #ecf0f1;
|
|
136
|
+
padding-bottom: 8px;
|
|
137
|
+
}
|
|
138
|
+
h3 {
|
|
139
|
+
color: #7f8c8d;
|
|
140
|
+
margin-top: 20px;
|
|
141
|
+
margin-bottom: 10px;
|
|
142
|
+
}
|
|
143
|
+
.meta {
|
|
144
|
+
background: #ecf0f1;
|
|
145
|
+
padding: 15px;
|
|
146
|
+
border-radius: 4px;
|
|
147
|
+
margin-bottom: 20px;
|
|
148
|
+
font-size: 0.9em;
|
|
149
|
+
}
|
|
150
|
+
.meta-item {
|
|
151
|
+
margin: 5px 0;
|
|
152
|
+
}
|
|
153
|
+
.meta-label {
|
|
154
|
+
font-weight: 600;
|
|
155
|
+
color: #34495e;
|
|
156
|
+
}
|
|
157
|
+
.stats {
|
|
158
|
+
display: grid;
|
|
159
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
160
|
+
gap: 15px;
|
|
161
|
+
margin: 20px 0;
|
|
162
|
+
}
|
|
163
|
+
.stat-card {
|
|
164
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
165
|
+
color: white;
|
|
166
|
+
padding: 20px;
|
|
167
|
+
border-radius: 8px;
|
|
168
|
+
text-align: center;
|
|
169
|
+
}
|
|
170
|
+
.stat-card.warning {
|
|
171
|
+
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
|
|
172
|
+
}
|
|
173
|
+
.stat-card.success {
|
|
174
|
+
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
|
|
175
|
+
}
|
|
176
|
+
.stat-value {
|
|
177
|
+
font-size: 2em;
|
|
178
|
+
font-weight: bold;
|
|
179
|
+
margin-bottom: 5px;
|
|
180
|
+
}
|
|
181
|
+
.stat-label {
|
|
182
|
+
font-size: 0.9em;
|
|
183
|
+
opacity: 0.9;
|
|
184
|
+
}
|
|
185
|
+
.detection-table {
|
|
186
|
+
width: 100%;
|
|
187
|
+
border-collapse: collapse;
|
|
188
|
+
margin: 20px 0;
|
|
189
|
+
}
|
|
190
|
+
.detection-table th,
|
|
191
|
+
.detection-table td {
|
|
192
|
+
padding: 12px;
|
|
193
|
+
text-align: left;
|
|
194
|
+
border-bottom: 1px solid #ecf0f1;
|
|
195
|
+
}
|
|
196
|
+
.detection-table th {
|
|
197
|
+
background: #34495e;
|
|
198
|
+
color: white;
|
|
199
|
+
font-weight: 600;
|
|
200
|
+
}
|
|
201
|
+
.detection-table tr:hover {
|
|
202
|
+
background: #f8f9fa;
|
|
203
|
+
}
|
|
204
|
+
.badge {
|
|
205
|
+
display: inline-block;
|
|
206
|
+
padding: 4px 8px;
|
|
207
|
+
border-radius: 4px;
|
|
208
|
+
font-size: 0.85em;
|
|
209
|
+
font-weight: 600;
|
|
210
|
+
}
|
|
211
|
+
.badge-high {
|
|
212
|
+
background: #e74c3c;
|
|
213
|
+
color: white;
|
|
214
|
+
}
|
|
215
|
+
.badge-medium {
|
|
216
|
+
background: #f39c12;
|
|
217
|
+
color: white;
|
|
218
|
+
}
|
|
219
|
+
.badge-low {
|
|
220
|
+
background: #3498db;
|
|
221
|
+
color: white;
|
|
222
|
+
}
|
|
223
|
+
.text-box {
|
|
224
|
+
background: #2c3e50;
|
|
225
|
+
color: #ecf0f1;
|
|
226
|
+
padding: 20px;
|
|
227
|
+
border-radius: 4px;
|
|
228
|
+
font-family: 'Courier New', monospace;
|
|
229
|
+
font-size: 0.9em;
|
|
230
|
+
overflow-x: auto;
|
|
231
|
+
white-space: pre-wrap;
|
|
232
|
+
word-wrap: break-word;
|
|
233
|
+
}
|
|
234
|
+
.highlight {
|
|
235
|
+
background: #f39c12;
|
|
236
|
+
color: #2c3e50;
|
|
237
|
+
padding: 2px 4px;
|
|
238
|
+
border-radius: 2px;
|
|
239
|
+
font-weight: 600;
|
|
240
|
+
}
|
|
241
|
+
.footer {
|
|
242
|
+
margin-top: 40px;
|
|
243
|
+
padding-top: 20px;
|
|
244
|
+
border-top: 2px solid #ecf0f1;
|
|
245
|
+
text-align: center;
|
|
246
|
+
color: #7f8c8d;
|
|
247
|
+
font-size: 0.9em;
|
|
248
|
+
}
|
|
249
|
+
@media print {
|
|
250
|
+
body { background: white; padding: 0; }
|
|
251
|
+
.container { box-shadow: none; }
|
|
252
|
+
}
|
|
253
|
+
</style>
|
|
254
|
+
</head>
|
|
255
|
+
<body>
|
|
256
|
+
<div class="container">
|
|
257
|
+
<h1>${this.escapeHtml(e.title)}</h1>
|
|
258
|
+
|
|
259
|
+
<div class="meta">
|
|
260
|
+
<div class="meta-item">
|
|
261
|
+
<span class="meta-label">Generated:</span> ${r}
|
|
262
|
+
</div>
|
|
263
|
+
<div class="meta-item">
|
|
264
|
+
<span class="meta-label">Organization:</span> ${this.escapeHtml(e.organizationName)}
|
|
265
|
+
</div>
|
|
266
|
+
`;for(let[n,a]of Object.entries(e.metadata))s+=` <div class="meta-item">
|
|
267
|
+
<span class="meta-label">${this.escapeHtml(n)}:</span> ${this.escapeHtml(a)}
|
|
268
|
+
</div>
|
|
269
|
+
`;if(s+=` </div>
|
|
270
|
+
`,e.includeStatistics){s+=`
|
|
271
|
+
<h2>Summary Statistics</h2>
|
|
272
|
+
<div class="stats">
|
|
273
|
+
<div class="stat-card ${i.totalDetections>0?"warning":"success"}">
|
|
274
|
+
<div class="stat-value">${i.totalDetections}</div>
|
|
275
|
+
<div class="stat-label">PII Detected</div>
|
|
276
|
+
</div>
|
|
277
|
+
<div class="stat-card">
|
|
278
|
+
<div class="stat-value">${i.uniqueTypes}</div>
|
|
279
|
+
<div class="stat-label">Unique Types</div>
|
|
280
|
+
</div>
|
|
281
|
+
<div class="stat-card">
|
|
282
|
+
<div class="stat-value">${i.highSeverity}</div>
|
|
283
|
+
<div class="stat-label">High Severity</div>
|
|
284
|
+
</div>
|
|
285
|
+
${t.stats?.processingTime?`
|
|
286
|
+
<div class="stat-card success">
|
|
287
|
+
<div class="stat-value">${t.stats.processingTime}ms</div>
|
|
288
|
+
<div class="stat-label">Processing Time</div>
|
|
289
|
+
</div>`:""}
|
|
290
|
+
</div>
|
|
291
|
+
`,s+=`
|
|
292
|
+
<h3>Detection Breakdown</h3>
|
|
293
|
+
<table class="detection-table">
|
|
294
|
+
<thead>
|
|
295
|
+
<tr>
|
|
296
|
+
<th>PII Type</th>
|
|
297
|
+
<th>Count</th>
|
|
298
|
+
<th>Percentage</th>
|
|
299
|
+
</tr>
|
|
300
|
+
</thead>
|
|
301
|
+
<tbody>
|
|
302
|
+
`;for(let[n,a]of Object.entries(i.typeBreakdown)){let o=(a/i.totalDetections*100).toFixed(1);s+=` <tr>
|
|
303
|
+
<td>${this.escapeHtml(n)}</td>
|
|
304
|
+
<td>${a}</td>
|
|
305
|
+
<td>${o}%</td>
|
|
306
|
+
</tr>
|
|
307
|
+
`;}s+=` </tbody>
|
|
308
|
+
</table>
|
|
309
|
+
`;}if(e.includeDetectionDetails&&t.detections.length>0){s+=`
|
|
310
|
+
<h2>Detection Details</h2>
|
|
311
|
+
<table class="detection-table">
|
|
312
|
+
<thead>
|
|
313
|
+
<tr>
|
|
314
|
+
<th>Type</th>
|
|
315
|
+
<th>Value</th>
|
|
316
|
+
<th>Position</th>
|
|
317
|
+
<th>Severity</th>
|
|
318
|
+
${t.detections[0].confidence!==void 0?"<th>Confidence</th>":""}
|
|
319
|
+
</tr>
|
|
320
|
+
</thead>
|
|
321
|
+
<tbody>
|
|
322
|
+
`;for(let n of t.detections){let a=n.severity==="high"?"badge-high":n.severity==="medium"?"badge-medium":"badge-low";s+=` <tr>
|
|
323
|
+
<td>${this.escapeHtml(n.type)}</td>
|
|
324
|
+
<td><code>${this.escapeHtml(n.value)}</code></td>
|
|
325
|
+
<td>${n.position[0]}-${n.position[1]}</td>
|
|
326
|
+
<td><span class="badge ${a}">${n.severity.toUpperCase()}</span></td>
|
|
327
|
+
${n.confidence!==void 0?`<td>${(n.confidence*100).toFixed(1)}%</td>`:""}
|
|
328
|
+
</tr>
|
|
329
|
+
`;}s+=` </tbody>
|
|
330
|
+
</table>
|
|
331
|
+
`;}return e.includeRedactedText&&(s+=`
|
|
332
|
+
<h2>Redacted Text</h2>
|
|
333
|
+
<div class="text-box">${this.escapeHtml(t.redacted)}</div>
|
|
334
|
+
`),e.includeOriginalText&&(s+=`
|
|
335
|
+
<h2>Original Text (Sensitive)</h2>
|
|
336
|
+
<div class="text-box">${this.escapeHtml(t.original)}</div>
|
|
337
|
+
`),s+=`
|
|
338
|
+
<div class="footer">
|
|
339
|
+
<p>Generated by OpenRedaction - Production-ready PII detection library</p>
|
|
340
|
+
<p>Report Type: ${e.type.toUpperCase()} | Format: HTML</p>
|
|
341
|
+
</div>
|
|
342
|
+
</div>
|
|
343
|
+
</body>
|
|
344
|
+
</html>`,s}generateMarkdown(t,e){let r=new Date().toISOString(),i=this.calculateStatistics(t),s=`# ${e.title}
|
|
345
|
+
|
|
346
|
+
`;s+=`## Metadata
|
|
347
|
+
|
|
348
|
+
`,s+=`- **Generated:** ${r}
|
|
349
|
+
`,s+=`- **Organization:** ${e.organizationName}
|
|
350
|
+
`;for(let[n,a]of Object.entries(e.metadata))s+=`- **${n}:** ${a}
|
|
351
|
+
`;if(s+=`
|
|
352
|
+
`,e.includeStatistics){s+=`## Summary Statistics
|
|
353
|
+
|
|
354
|
+
`,s+=`| Metric | Value |
|
|
355
|
+
`,s+=`|--------|-------|
|
|
356
|
+
`,s+=`| Total PII Detected | ${i.totalDetections} |
|
|
357
|
+
`,s+=`| Unique Types | ${i.uniqueTypes} |
|
|
358
|
+
`,s+=`| High Severity | ${i.highSeverity} |
|
|
359
|
+
`,t.stats?.processingTime&&(s+=`| Processing Time | ${t.stats.processingTime}ms |
|
|
360
|
+
`),s+=`
|
|
361
|
+
`,s+=`### Detection Breakdown
|
|
362
|
+
|
|
363
|
+
`,s+=`| PII Type | Count | Percentage |
|
|
364
|
+
`,s+=`|----------|-------|------------|
|
|
365
|
+
`;for(let[n,a]of Object.entries(i.typeBreakdown)){let o=(a/i.totalDetections*100).toFixed(1);s+=`| ${n} | ${a} | ${o}% |
|
|
366
|
+
`;}s+=`
|
|
367
|
+
`;}if(e.includeDetectionDetails&&t.detections.length>0){s+=`## Detection Details
|
|
368
|
+
|
|
369
|
+
`,s+=`| Type | Value | Position | Severity |${t.detections[0].confidence!==void 0?" Confidence |":""}
|
|
370
|
+
`,s+=`|------|-------|----------|----------|${t.detections[0].confidence!==void 0?"------------|":""}
|
|
371
|
+
`;for(let n of t.detections)s+=`| ${n.type} | \`${n.value}\` | ${n.position[0]}-${n.position[1]} | ${n.severity.toUpperCase()} |`,n.confidence!==void 0&&(s+=` ${(n.confidence*100).toFixed(1)}% |`),s+=`
|
|
372
|
+
`;s+=`
|
|
373
|
+
`;}return e.includeRedactedText&&(s+=`## Redacted Text
|
|
374
|
+
|
|
375
|
+
`,s+=`\`\`\`
|
|
376
|
+
${t.redacted}
|
|
377
|
+
\`\`\`
|
|
378
|
+
|
|
379
|
+
`),e.includeOriginalText&&(s+=`## Original Text (Sensitive)
|
|
380
|
+
|
|
381
|
+
`,s+=`\u26A0\uFE0F **WARNING:** This section contains unredacted sensitive data.
|
|
382
|
+
|
|
383
|
+
`,s+=`\`\`\`
|
|
384
|
+
${t.original}
|
|
385
|
+
\`\`\`
|
|
386
|
+
|
|
387
|
+
`),s+=`---
|
|
388
|
+
|
|
389
|
+
`,s+=`*Generated by OpenRedaction - Production-ready PII detection library*
|
|
390
|
+
`,s+=`*Report Type: ${e.type.toUpperCase()} | Format: MARKDOWN*
|
|
391
|
+
`,s}calculateStatistics(t){let e={},r=0;for(let i of t.detections)e[i.type]=(e[i.type]||0)+1,i.severity==="high"&&r++;return {totalDetections:t.detections.length,uniqueTypes:Object.keys(e).length,highSeverity:r,typeBreakdown:e}}escapeHtml(t){let e={"&":"&","<":"<",">":">",'"':""","'":"'"};return t.replace(/[&<>"']/g,r=>e[r])}};function tg(t){return new eg(t)}var rg=class{constructor(t,e={}){this.learningStore=t,this.options={learningWeight:e.learningWeight??.3,minSampleSize:e.minSampleSize??10,maxPriorityAdjustment:e.maxPriorityAdjustment??15};}optimizePatterns(t){let e=this.learningStore.getWhitelistEntries(),r=this.learningStore.getAllPatternAdjustments(),i=new Map;for(let a of e){let o=a.occurrences,c=this.inferPatternType(a.pattern);c&&i.set(c,(i.get(c)||0)+o);}let s=new Map;for(let a of r)s.set(a.type,(s.get(a.type)||0)+a.occurrences);let n=new Map;for(let a of t){let o=i.get(a.type)||0,c=s.get(a.type)||0,l=Math.max(o+c+10,1);n.set(a.type,l);}return t.map(a=>{let o=i.get(a.type)||0,c=s.get(a.type)||0,l=n.get(a.type)||1;if(l<this.options.minSampleSize)return a;let d=0,u=o/l;u>.1&&(d-=u*this.options.maxPriorityAdjustment);let p=c/l;p>.1&&(d+=p*this.options.maxPriorityAdjustment),d*=this.options.learningWeight,d=Math.max(-this.options.maxPriorityAdjustment,Math.min(this.options.maxPriorityAdjustment,d));let h=Math.max(0,Math.min(100,a.priority+d));return Math.abs(d)>1?{...a,priority:Math.round(h)}:a})}getPatternStats(t){let e=this.learningStore.getWhitelistEntries(),r=this.learningStore.getAllPatternAdjustments(),i=new Map;for(let n of e){let a=this.inferPatternType(n.pattern);a&&i.set(a,(i.get(a)||0)+n.occurrences);}let s=new Map;for(let n of r)s.set(n.type,(s.get(n.type)||0)+n.occurrences);return t.map(n=>{let a=i.get(n.type)||0,o=s.get(n.type)||0,c=Math.max(a+o+10,1),l=(c-(a+o))/c;return {type:n.type,totalDetections:c,falsePositives:a,falseNegatives:o,accuracy:l,priority:n.priority,adjustedPriority:n.priority}})}inferPatternType(t){return /@/.test(t)?"EMAIL":/^\+?\d[\d\s\-()]{7,}$/.test(t)?"PHONE":/^\d{3}-\d{2}-\d{4}$/.test(t)?"SSN":/^\d{4}[\s\-]?\d{4}[\s\-]?\d{4}[\s\-]?\d{4}$/.test(t)?"CREDIT_CARD":/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(t)?"IP_ADDRESS":/^[A-Z][a-z]+(\s[A-Z][a-z]+){1,3}$/.test(t)?"NAME":null}resetPriorities(t){return t}getOptions(){return {...this.options}}setOptions(t){this.options={...this.options,...t};}};function ig(t,e){return new rg(t,e)}var Jt=class Qt extends Error{constructor(e,r="OPENREDACTION_ERROR",i,s){super(e),this.name="OpenRedactionError",this.code=r,this.suggestion=i,this.context=s,Error.captureStackTrace&&Error.captureStackTrace(this,Qt);}getFormattedMessage(){let e=`[${this.code}] ${this.message}`;return this.suggestion&&(e+=`
|
|
392
|
+
|
|
393
|
+
Suggestion: ${this.suggestion.message}`,this.suggestion.code&&(e+=`
|
|
394
|
+
|
|
395
|
+
Try:
|
|
396
|
+
${this.suggestion.code}`),this.suggestion.docs&&(e+=`
|
|
397
|
+
|
|
398
|
+
Docs: ${this.suggestion.docs}`)),this.context&&Object.keys(this.context).length>0&&(e+=`
|
|
399
|
+
|
|
400
|
+
Context: ${JSON.stringify(this.context,null,2)}`),e}};function be(){return new Jt("Learning system is disabled","LEARNING_DISABLED",{message:"Enable learning to use recordFalsePositive, recordFalseNegative, and other learning features",code:`const redactor = new OpenRedaction({
|
|
401
|
+
enableLearning: true,
|
|
402
|
+
learningStorePath: '.openredaction/learnings.json'
|
|
403
|
+
});`,docs:"https://github.com/sam247/openredaction#learning-system"})}function sg(){return new Jt("Priority optimization is disabled","OPTIMIZATION_DISABLED",{message:"Enable priority optimization to use dynamic priority adjustment features",code:`const redactor = new OpenRedaction({
|
|
404
|
+
enablePriorityOptimization: true,
|
|
405
|
+
optimizerOptions: {
|
|
406
|
+
learningWeight: 0.3,
|
|
407
|
+
minSampleSize: 10,
|
|
408
|
+
maxPriorityAdjustment: 15
|
|
409
|
+
}
|
|
410
|
+
});`,docs:"https://github.com/sam247/openredaction#priority-optimization"})}var ve=class extends Error{constructor(t,e){super(`Regex execution exceeded timeout of ${e}ms: ${t}`),this.name="RegexTimeoutError";}};function ng(t,e,r={}){let i=r.timeout??100,s=performance.now();try{let n=t.exec(e);if(performance.now()-s>i)throw new ve(t.source,i);return n}catch(n){throw n}}function ag(t){return !!(/\*\+|\+\*|\+\+|\*\*/.test(t)||/\(a\+\)\+|\(b\*\)\*|\(c\+\)\+/.test(t))}function og(t){let e=typeof t=="string"?t:t.source;if(e.length>5e3)throw new Error(`Regex pattern too long: ${e.length} chars (max 5000)`);if(ag(e))throw new Error(`Potentially unsafe regex pattern detected: ${e.substring(0,100)}...`);try{new RegExp(e);}catch(r){throw new Error(`Invalid regex pattern: ${r.message}`)}}var cg=Q({ConfigExporter:()=>ee,createConfigPreset:()=>lg,exportForVersionControl:()=>dg});function lg(t,e,r){return ee.exportToString(r,{description:`${t}: ${e}`,tags:[t,"preset"]},true)}function dg(t){return ee.exportToString(t,{description:"OpenRedaction configuration",author:"Generated automatically",tags:["version-control"]},true)}var ee,er=S((()=>{ee=class{static{this.CONFIG_VERSION="1.0";}static exportConfig(t,e){let r={version:this.CONFIG_VERSION,timestamp:new Date().toISOString(),options:{includeNames:t.includeNames,includeAddresses:t.includeAddresses,includePhones:t.includePhones,includeEmails:t.includeEmails,patterns:t.patterns,categories:t.categories,whitelist:t.whitelist,deterministic:t.deterministic,redactionMode:t.redactionMode,preset:t.preset,enableContextAnalysis:t.enableContextAnalysis,confidenceThreshold:t.confidenceThreshold,enableFalsePositiveFilter:t.enableFalsePositiveFilter,falsePositiveThreshold:t.falsePositiveThreshold,enableMultiPass:t.enableMultiPass,multiPassCount:t.multiPassCount,enableCache:t.enableCache,cacheSize:t.cacheSize,maxInputSize:t.maxInputSize,regexTimeout:t.regexTimeout},metadata:e};return t.customPatterns&&t.customPatterns.length>0&&(r.customPatterns=t.customPatterns.map(i=>({type:i.type,regex:i.regex.source,flags:i.regex.flags,priority:i.priority,placeholder:i.placeholder,description:i.description,severity:i.severity}))),JSON.parse(JSON.stringify(r))}static importConfig(t,e){(!t.version||t.version!==this.CONFIG_VERSION)&&console.warn(`[OpenRedaction] Config version mismatch. Expected ${this.CONFIG_VERSION}, got ${t.version}`);let r={...t.options};return t.customPatterns&&(r.customPatterns=t.customPatterns.map(i=>({type:i.type,regex:new RegExp(i.regex,i.flags),priority:i.priority,placeholder:i.placeholder,description:i.description,severity:i.severity}))),r}static exportToString(t,e,r){let i=this.exportConfig(t,e);return JSON.stringify(i,null,r?2:void 0)}static importFromString(t){let e=JSON.parse(t);return this.importConfig(e)}static async exportToFile(t,e,r){let i=await import('./empty-shim-IFLK4AY7.js'),s=this.exportToString(e,r,true);await i.writeFile(t,s,"utf-8");}static async importFromFile(t){let e=await(await import('./empty-shim-IFLK4AY7.js')).readFile(t,"utf-8");return this.importFromString(e)}static validateConfig(t){let e=[];if(t.version||e.push("Missing version field"),t.timestamp||e.push("Missing timestamp field"),t.options||e.push("Missing options field"),t.customPatterns)for(let r of t.customPatterns){(!r.type||!r.regex||!r.placeholder)&&e.push(`Invalid custom pattern: ${r.type}`);try{new RegExp(r.regex,r.flags);}catch(i){e.push(`Invalid regex in pattern ${r.type}: ${i.message}`);}}return {valid:e.length===0,errors:e}}static mergeConfigs(t,e){return {version:this.CONFIG_VERSION,timestamp:new Date().toISOString(),options:{...t.options,...e.options,patterns:e.options.patterns||t.options.patterns,categories:e.options.categories||t.options.categories,whitelist:[...t.options.whitelist||[],...e.options.whitelist||[]]},customPatterns:[...t.customPatterns||[],...e.customPatterns||[]],metadata:{...t.metadata,...e.metadata}}}};})),pt=Q({HealthChecker:()=>te,createHealthChecker:()=>ug,healthCheckMiddleware:()=>pg});function ug(t){return new te(t)}function pg(t){let e=new te(t);return async(r,i)=>{try{let s=await e.check({testDetection:!0,checkPerformance:!0,performanceThreshold:100,memoryThreshold:100}),n=s.status==="healthy"||s.status==="degraded"?200:503;i.status(n).json(s);}catch(s){i.status(503).json({status:"unhealthy",timestamp:new Date().toISOString(),error:s.message});}}}var te,Se=S((()=>{te=class{constructor(t){this.detector=t,this.initTime=Date.now();}async check(t={}){let e={status:"healthy",timestamp:new Date().toISOString(),checks:{detector:{status:"pass",message:"Detector initialized"},patterns:{status:"pass",message:"Patterns loaded"},performance:{status:"pass",message:"Performance acceptable"},memory:{status:"pass",message:"Memory usage normal"}},metrics:{totalPatterns:0,compiledPatterns:0,cacheEnabled:false,uptime:Date.now()-this.initTime},errors:[],warnings:[]};try{e.checks.detector=await this.checkDetector(t),e.checks.patterns=await this.checkPatterns(),t.checkPerformance!==!1&&(e.checks.performance=await this.checkPerformance(t.performanceThreshold)),e.checks.memory=await this.checkMemory(t.memoryThreshold),e.metrics=this.collectMetrics(),e.status=this.determineOverallStatus(e.checks);for(let r of Object.values(e.checks))r.status==="fail"?e.errors.push(r.message):r.status==="warn"&&e.warnings.push(r.message);}catch(r){e.status="unhealthy",e.errors.push(`Health check failed: ${r.message}`);}return e}async checkDetector(t){try{if(t.testDetection!==!1){let e=await this.detector.detect("Test email: test@example.com");if(!e||!e.detections)return {status:"fail",message:"Detector returned invalid result"};if(e.detections.length===0)return {status:"warn",message:"Test detection found no PII (expected at least 1)"}}return {status:"pass",message:"Detector functioning correctly"}}catch(e){return {status:"fail",message:`Detector check failed: ${e.message}`}}}async checkPatterns(){try{let t=this.detector.getPatterns();return !t||t.length===0?{status:"fail",message:"No patterns loaded",value:0,threshold:1}:t.length<10?{status:"warn",message:"Very few patterns loaded (expected more)",value:t.length,threshold:10}:{status:"pass",message:`${t.length} patterns loaded`,value:t.length}}catch(t){return {status:"fail",message:`Pattern check failed: ${t.message}`}}}async checkPerformance(t=100){try{let e="Test: john@example.com, phone: 555-123-4567, IP: 192.168.1.1",r=performance.now();await this.detector.detect(e);let i=performance.now()-r;return i>t*2?{status:"fail",message:`Performance degraded: ${i.toFixed(2)}ms`,value:i,threshold:t}:i>t?{status:"warn",message:`Performance slower than expected: ${i.toFixed(2)}ms`,value:i,threshold:t}:{status:"pass",message:`Performance good: ${i.toFixed(2)}ms`,value:i,threshold:t}}catch(e){return {status:"fail",message:`Performance check failed: ${e.message}`}}}async checkMemory(t=100){try{if(typeof process>"u"||!process.memoryUsage)return {status:"pass",message:"Memory check skipped (not in Node.js)"};let e=process.memoryUsage().heapUsed/1024/1024;return e>t*2?{status:"fail",message:`High memory usage: ${e.toFixed(2)}MB`,value:e,threshold:t}:e>t?{status:"warn",message:`Elevated memory usage: ${e.toFixed(2)}MB`,value:e,threshold:t}:{status:"pass",message:`Memory usage normal: ${e.toFixed(2)}MB`,value:e,threshold:t}}catch(e){return {status:"warn",message:`Memory check skipped: ${e.message}`}}}collectMetrics(){let t=this.detector.getPatterns(),e=this.detector.getCacheStats();return {totalPatterns:t.length,compiledPatterns:t.length,cacheSize:e.size,cacheEnabled:e.enabled,uptime:Date.now()-this.initTime}}determineOverallStatus(t){let e=Object.values(t).map(r=>r.status);return e.includes("fail")?"unhealthy":e.includes("warn")?"degraded":"healthy"}async quickCheck(){try{return this.detector.getPatterns().length===0?{status:"unhealthy",message:"No patterns loaded"}:{status:"healthy",message:"OK"}}catch(t){return {status:"unhealthy",message:`Error: ${t.message}`}}}getSystemInfo(){let t=this.detector.getPatterns(),e=this.detector.getCacheStats();return {version:"1.0.0",patterns:{total:t.length,types:[...new Set(t.map(r=>r.type.split("_")[0]))].length},cache:{enabled:e.enabled,size:e.size,maxSize:e.maxSize},uptime:Date.now()-this.initTime,timestamp:new Date().toISOString()}}};}));function hg(){return new re}var re,tr=S((()=>{re=class{constructor(){try{this.tesseract=K("tesseract.js");}catch{}}async recognizeText(t,e){if(!this.tesseract)throw new Error("[OCRProcessor] OCR support requires tesseract.js. Install with: npm install tesseract.js");let r=performance.now();try{let i=Array.isArray(e?.language)?e.language.join("+"):e?.language||"eng",s=await this.tesseract.createWorker(i,e?.oem||3);e?.psm!==void 0&&await s.setParameters({tessedit_pageseg_mode:e.psm});let n=await s.recognize(t);await s.terminate();let a=performance.now(),o=Math.round((a-r)*100)/100;return {text:n.data.text||"",confidence:n.data.confidence||0,processingTime:o}}catch(i){throw new Error(`[OCRProcessor] OCR recognition failed: ${i.message}`)}}isAvailable(){return !!this.tesseract}async createScheduler(t=4){if(!this.tesseract)throw new Error("[OCRProcessor] OCR support requires tesseract.js. Install with: npm install tesseract.js");this.scheduler&&await this.scheduler.terminate(),this.scheduler=this.tesseract.createScheduler();for(let r=0;r<t;r++){let i=await this.tesseract.createWorker("eng");this.scheduler.addWorker(i);}return this.scheduler}async recognizeBatch(t,e){if(!this.tesseract)throw new Error("[OCRProcessor] OCR support requires tesseract.js. Install with: npm install tesseract.js");let r=await this.createScheduler();try{let i=await Promise.all(t.map(async s=>{let n=performance.now(),a=await r.addJob("recognize",s),o=performance.now();return {text:a.data.text||"",confidence:a.data.confidence||0,processingTime:Math.round((o-n)*100)/100}}));return await r.terminate(),this.scheduler=void 0,i}catch(i){throw r&&(await r.terminate(),this.scheduler=void 0),new Error(`[OCRProcessor] Batch OCR failed: ${i.message}`)}}async cleanup(){this.scheduler&&(await this.scheduler.terminate(),this.scheduler=void 0);}};}));function gg(){return new ie}var ie,rr=S((()=>{ie=class{constructor(){this.defaultOptions={maxDepth:100,scanKeys:false,alwaysRedact:[],skipPaths:[],piiIndicatorKeys:["email","e-mail","mail","phone","tel","telephone","mobile","ssn","social_security","address","street","city","zip","postal","name","firstname","lastname","fullname","password","pwd","secret","token","key","card","credit_card","creditcard","account","iban","swift","passport","license","licence"],preserveStructure:true};}parse(t){try{let e=typeof t=="string"?t:t.toString("utf-8");return JSON.parse(e)}catch(e){throw new Error(`[JsonProcessor] Invalid JSON: ${e.message}`)}}async detect(t,e,r){let i={...this.defaultOptions,...r},s=[],n={},a=[],o=[];this.traverse(t,"",i,(u,p,h)=>{o.push((async()=>{if(this.shouldSkip(u,i.skipPaths))return;if(this.shouldAlwaysRedact(u,i.alwaysRedact)){let g={type:"SENSITIVE_FIELD",value:String(p),placeholder:"[SENSITIVE_FIELD]",position:[0,String(p).length],severity:"high",confidence:1};n[u]=[g],s.push(u),a.push(g);return}if(i.scanKeys&&h){let g=await e.detect(h);if(g.detections.length>0){let _=`${u}.__key__`;n[_]=g.detections,s.push(_),a.push(...g.detections);}}let A=String(p),E=await e.detect(A);if(E.detections.length>0){let g=this.boostConfidenceFromKey(E.detections,h,i.piiIndicatorKeys);n[u]=g,s.push(u),a.push(...g);}})());}),await Promise.all(o);let c=JSON.stringify(t),l=this.redact(t,{original:c,redacted:c,detections:a,redactionMap:{},stats:{piiCount:a.length},pathsDetected:s,matchesByPath:n},i),d={};return a.forEach(u=>{d[u.placeholder]=u.value;}),{original:c,redacted:typeof l=="string"?l:JSON.stringify(l),detections:a,redactionMap:d,stats:{piiCount:a.length},pathsDetected:s,matchesByPath:n}}redact(t,e,r){return {...this.defaultOptions,...r}.preserveStructure?this.redactPreservingStructure(t,e.pathsDetected):this.parse(this.redactText(JSON.stringify(t,null,2),e))}redactPreservingStructure(t,e){let r=new Set(e),i=(s,n)=>{if(r.has(n))return typeof s=="string"?"[REDACTED]":typeof s=="number"?0:typeof s=="boolean"?false:s===null?null:Array.isArray(s)?[]:typeof s=="object"?{}:"[REDACTED]";if(Array.isArray(s))return s.map((a,o)=>i(a,`${n}[${o}]`));if(s!==null&&typeof s=="object"){let a={};for(let[o,c]of Object.entries(s))a[o]=i(c,n?`${n}.${o}`:o);return a}return s};return i(t,"")}redactText(t,e){let r=t,i=[...e.detections].sort((s,n)=>n.position[0]-s.position[0]);for(let s of i){let[n,a]=s.position;r=r.slice(0,n)+s.placeholder+r.slice(a);}return r}traverse(t,e,r,i,s=0){if(s>r.maxDepth)throw new Error(`[JsonProcessor] Maximum depth (${r.maxDepth}) exceeded`);if(t!=null){if(Array.isArray(t)){t.forEach((n,a)=>{let o=e?`${e}[${a}]`:`[${a}]`;this.isPrimitive(n)&&i(o,n),this.traverse(n,o,r,i,s+1);});return}if(typeof t=="object"){for(let[n,a]of Object.entries(t)){let o=e?`${e}.${n}`:n;this.isPrimitive(a)&&i(o,a,n),this.traverse(a,o,r,i,s+1);}return}this.isPrimitive(t)&&i(e,t);}}isPrimitive(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"}shouldSkip(t,e){return e.some(r=>t===r?true:new RegExp("^"+r.replace(/\*/g,"[^.]+")+"$").test(t))}shouldAlwaysRedact(t,e){return e.some(r=>t===r?true:new RegExp("^"+r.replace(/\*/g,"[^.]+")+"$").test(t))}boostConfidenceFromKey(t,e,r){if(!e)return t;let i=e.toLowerCase();return r.some(s=>i.includes(s.toLowerCase()))?t.map(s=>({...s,confidence:Math.min(1,(s.confidence||.5)*1.2)})):t}extractText(t,e){let r={...this.defaultOptions,...e},i=[];return this.traverse(t,"",r,(s,n,a)=>{r.scanKeys&&a&&i.push(a),typeof n=="string"&&i.push(n);}),i.join(" ")}isValid(t){try{return this.parse(t),!0}catch{return false}}parseJsonLines(t){return (typeof t=="string"?t:t.toString("utf-8")).split(`
|
|
411
|
+
`).filter(e=>e.trim().length>0).map((e,r)=>{try{return JSON.parse(e)}catch(i){throw new Error(`[JsonProcessor] Invalid JSON at line ${r+1}: ${i.message}`)}})}async detectJsonLines(t,e,r){let i=this.parseJsonLines(t);return Promise.all(i.map(s=>this.detect(s,e,r)))}};}));function mg(){return new se}var se,ir=S((()=>{se=class{constructor(){this.defaultOptions={quote:'"',escape:'"',skipEmptyLines:true,piiIndicatorNames:["email","e-mail","mail","email_address","phone","tel","telephone","mobile","phone_number","ssn","social_security","social_security_number","address","street","street_address","city","zip","zipcode","postal","postcode","name","firstname","first_name","lastname","last_name","fullname","full_name","password","pwd","secret","token","api_key","card","credit_card","creditcard","card_number","account","account_number","iban","swift","passport","passport_number","license","licence","driver_license","dob","date_of_birth","birth_date","birthdate"],treatFirstRowAsHeader:true};}parse(t,e){let r={...this.defaultOptions,...e},i=typeof t=="string"?t:t.toString("utf-8"),s=r.delimiter||this.detectDelimiter(i),n=i.split(/\r?\n/),a=[],o=0;for(let c=0;c<n.length;c++){let l=n[c];if(r.skipEmptyLines&&l.trim().length===0)continue;if(r.maxRows!==void 0&&o>=r.maxRows)break;let d=this.parseRow(l,s,r.quote,r.escape);a.push({index:o,values:d}),o++;}return a}async detect(t,e,r){let i={...this.defaultOptions,...r},s=this.parse(t,r);if(s.length===0){let f=typeof t=="string"?t:t.toString("utf-8");return {original:f,redacted:f,detections:[],redactionMap:{},stats:{piiCount:0},rowCount:0,columnCount:0,columnStats:{},matchesByCell:[]}}let n=i.hasHeader!==void 0?i.hasHeader:this.detectHeader(s),a=n&&s.length>0?s[0].values:void 0,o=n?s.slice(1):s,c=s[0].values.length,l=new Map;a&&a.forEach((f,y)=>{l.set(f.toLowerCase().trim(),y);});let d=new Set(i.alwaysRedactColumns||[]);i.alwaysRedactColumnNames&&a&&i.alwaysRedactColumnNames.forEach(f=>{let y=l.get(f.toLowerCase().trim());y!==void 0&&d.add(y);});let u=new Set(i.skipColumns||[]),p={},h=[],A=[];for(let f=0;f<c;f++)p[f]={columnIndex:f,columnName:a?.[f],piiCount:0,piiPercentage:0,piiTypes:[]};for(let f of o)for(let y=0;y<f.values.length;y++){if(u.has(y))continue;let I=f.values[y];if(d.has(y)){let R={type:"SENSITIVE_COLUMN",value:I,placeholder:`[SENSITIVE_COLUMN_${y}]`,position:[0,I.length],severity:"high",confidence:1};h.push({row:f.index,column:y,columnName:a?.[y],value:I,matches:[R]}),A.push(R),p[y].piiCount++;continue}let T=await e.detect(I);if(T.detections.length>0){let R=this.boostConfidenceFromColumnName(T.detections,a?.[y],i.piiIndicatorNames||[]);h.push({row:f.index,column:y,columnName:a?.[y],value:I,matches:R}),A.push(...R),p[y].piiCount+=R.length;let P=new Set(p[y].piiTypes);R.forEach(L=>P.add(L.type)),p[y].piiTypes=Array.from(P);}}for(let f=0;f<c;f++){let y=h.filter(I=>I.column===f).length;p[f].piiPercentage=o.length>0?y/o.length*100:0;}let E=typeof t=="string"?t:t.toString("utf-8"),g=this.redact(E,{original:E,redacted:E,detections:A,redactionMap:{},stats:{piiCount:A.length},rowCount:o.length,columnCount:c,headers:a,columnStats:p,matchesByCell:h},i),_={};return A.forEach(f=>{_[f.placeholder]=f.value;}),{original:E,redacted:g,detections:A,redactionMap:_,stats:{piiCount:A.length},rowCount:o.length,columnCount:c,headers:a?.filter(f=>f!==void 0),columnStats:p,matchesByCell:h}}redact(t,e,r){let i={...this.defaultOptions,...r},s=this.parse(t,r);if(s.length===0)return "";let n=i.delimiter||this.detectDelimiter(typeof t=="string"?t:t.toString("utf-8")),a=e.headers!==void 0,o=new Map;for(let l of e.matchesByCell)o.has(l.row)||o.set(l.row,new Map),o.get(l.row).set(l.column,"[REDACTED]");let c=[];for(let l=0;l<s.length;l++){let d=s[l];if(a&&l===0)c.push(this.formatRow(d.values,n,i.quote));else {let u=a?l-1:l,p=d.values.map((h,A)=>o.get(u)?.get(A)||h);c.push(this.formatRow(p,n,i.quote));}}return c.join(`
|
|
412
|
+
`)}parseRow(t,e,r,i){let s=[],n="",a=false,o=0;for(;o<t.length;){let c=t[o],l=t[o+1];c===r?a&&l===r?(n+=r,o+=2):(a=!a,o++):c===e&&!a?(s.push(n),n="",o++):(n+=c,o++);}return s.push(n),s}formatRow(t,e,r){return t.map(i=>i.includes(e)||i.includes(r)||i.includes(`
|
|
413
|
+
`)?`${r}${i.replace(new RegExp(r,"g"),r+r)}${r}`:i).join(e)}detectDelimiter(t){let e=[","," ",";","|"],r=t.split(/\r?\n/).slice(0,5),i=",",s=0;for(let n of e){let a=r.map(o=>{let c=0,l=false;for(let d of o)d==='"'&&(l=!l),d===n&&!l&&c++;return c});if(a.length>0&&a[0]>0){let o=a.reduce((l,d)=>l+d,0)/a.length,c=o/(a.reduce((l,d)=>l+Math.pow(d-o,2),0)/a.length+1);c>s&&(s=c,i=n);}}return i}detectHeader(t){if(t.length<2)return false;let e=t[0].values,r=t[1].values;if(e.reduce((s,n)=>s+n.length,0)/e.length>r.reduce((s,n)=>s+n.length,0)/r.length*1.5)return false;let i=e.filter(s=>!isNaN(Number(s))&&s.trim()!=="").length;return e.length-i>=i}boostConfidenceFromColumnName(t,e,r){if(!e)return t;let i=e.toLowerCase().trim();return r.some(s=>i.includes(s.toLowerCase()))?t.map(s=>({...s,confidence:Math.min(1,(s.confidence||.5)*1.2)})):t}extractText(t,e){let r=this.parse(t,e),i=[];for(let s of r)for(let n of s.values)n.trim().length>0&&i.push(n);return i.join(" ")}getColumnInfo(t,e){let r=this.parse(t,e);if(r.length===0)return {columnCount:0,rowCount:0,sampleRows:[]};let i={...this.defaultOptions,...e},s=i.hasHeader!==void 0?i.hasHeader:this.detectHeader(r),n=s&&r.length>0?r[0].values:void 0,a=s?r.slice(1):r,o=a.slice(0,5).map(c=>c.values);return {columnCount:r[0].values.length,rowCount:a.length,headers:n,sampleRows:o}}};}));function Eg(){return new ne}var ne,sr=S((()=>{ne=class{constructor(){this.defaultOptions={piiIndicatorNames:["email","e-mail","mail","email_address","phone","tel","telephone","mobile","phone_number","ssn","social_security","social_security_number","address","street","street_address","city","zip","zipcode","postal","postcode","name","firstname","first_name","lastname","last_name","fullname","full_name","password","pwd","secret","token","api_key","card","credit_card","creditcard","card_number","account","account_number","iban","swift","passport","passport_number","license","licence","driver_license","dob","date_of_birth","birth_date","birthdate"],preserveFormatting:true,preserveFormulas:true};try{this.xlsx=K("xlsx");}catch{}}isAvailable(){return !!this.xlsx}parse(t){if(!this.xlsx)throw new Error("[XlsxProcessor] XLSX support requires xlsx package. Install with: npm install xlsx");try{return this.xlsx.read(t,{type:"buffer",cellFormula:!0,cellStyles:!0})}catch(e){throw new Error(`[XlsxProcessor] Failed to parse XLSX: ${e.message}`)}}async detect(t,e,r){if(!this.xlsx)throw new Error("[XlsxProcessor] XLSX support requires xlsx package. Install with: npm install xlsx");let i={...this.defaultOptions,...r},s=this.parse(t),n=this.getSheetNamesToProcess(s,i),a=[],o=[],c=new Set;for(let h=0;h<n.length;h++){let A=n[h],E=s.Sheets[A],g=await this.detectSheet(E,A,h,e,i);a.push(g),o.push(...g.matchesByCell.flatMap(_=>_.matches)),g.matchesByCell.forEach(_=>{_.matches.forEach(f=>c.add(f.type));});}let l=this.extractText(t,r),d=this.redact(t,{original:l,redacted:l,detections:o,redactionMap:{},stats:{piiCount:o.length},sheetResults:a,sheetCount:a.length},r),u=this.extractText(d,r),p={};return o.forEach(h=>{p[h.placeholder]=h.value;}),{original:l,redacted:u,detections:o,redactionMap:p,stats:{piiCount:o.length},sheetResults:a,sheetCount:a.length}}async detectSheet(t,e,r,i,s){let n=this.xlsx.utils.decode_range(t["!ref"]||"A1"),a=n.s.r,o=s.maxRows!==void 0?Math.min(n.e.r,a+s.maxRows-1):n.e.r,c=n.s.c,l=n.e.c,d=l-c+1,u=s.hasHeader!==void 0?s.hasHeader:this.detectHeader(t,n),p=u?this.getRowValues(t,a,c,l):void 0,h=u?a+1:a,A=new Map;p&&p.forEach((I,T)=>{I&&A.set(I.toLowerCase().trim(),T);});let E=new Set(s.alwaysRedactColumns||[]);s.alwaysRedactColumnNames&&p&&s.alwaysRedactColumnNames.forEach(I=>{let T=A.get(I.toLowerCase().trim());T!==void 0&&E.add(T);});let g=new Set(s.skipColumns||[]),_={};for(let I=0;I<=l-c;I++)_[I]={columnIndex:I,columnLetter:this.columnToLetter(I),columnName:p?.[I],piiCount:0,piiPercentage:0,piiTypes:[]};let f=[];for(let I=h;I<=o;I++)for(let T=c;T<=l;T++){let R=T-c;if(g.has(R))continue;let P=this.xlsx.utils.encode_cell({r:I,c:T}),L=t[P];if(!L)continue;let O=this.getCellValue(L);if(!O)continue;let N=L.f;if(E.has(R)){let C={type:"SENSITIVE_COLUMN",value:O,placeholder:`[SENSITIVE_COLUMN_${R}]`,position:[0,O.length],severity:"high",confidence:1};f.push({cell:P,row:I+1,column:R,columnLetter:this.columnToLetter(R),columnName:p?.[R],value:O,formula:N,matches:[C]}),_[R].piiCount++;continue}let v=await i.detect(O);if(v.detections.length>0){let C=this.boostConfidenceFromColumnName(v.detections,p?.[R],s.piiIndicatorNames||[]);f.push({cell:P,row:I+1,column:R,columnLetter:this.columnToLetter(R),columnName:p?.[R],value:O,formula:N,matches:C}),_[R].piiCount+=C.length;let W=new Set(_[R].piiTypes);C.forEach(Y=>W.add(Y.type)),_[R].piiTypes=Array.from(W);}}let y=o-h+1;for(let I=0;I<=l-c;I++){let T=f.filter(R=>R.column===I).length;_[I].piiPercentage=y>0?T/y*100:0;}return {sheetName:e,sheetIndex:r,rowCount:y,columnCount:d,headers:p?.filter(I=>I!==void 0),columnStats:_,matchesByCell:f}}redact(t,e,r){if(!this.xlsx)throw new Error("[XlsxProcessor] XLSX support requires xlsx package. Install with: npm install xlsx");let i={...this.defaultOptions,...r},s=this.parse(t);for(let n of e.sheetResults){let a=s.Sheets[n.sheetName];for(let o of n.matchesByCell){let c=a[o.cell];c&&(c.v="[REDACTED]",c.w="[REDACTED]",i.preserveFormulas||delete c.f,c.t="s");}}return this.xlsx.write(s,{type:"buffer",bookType:"xlsx"})}getCellValue(t){return t?t.w!==void 0?String(t.w):t.v!==void 0?String(t.v):"":""}getRowValues(t,e,r,i){let s=[];for(let n=r;n<=i;n++){let a=t[this.xlsx.utils.encode_cell({r:e,c:n})];s.push(a?this.getCellValue(a):void 0);}return s}detectHeader(t,e){let r=this.getRowValues(t,e.s.r,e.s.c,e.e.c),i=e.s.r+1<=e.e.r?this.getRowValues(t,e.s.r+1,e.s.c,e.e.c):null;if(!i)return false;let s=r.filter(o=>o!==void 0),n=i.filter(o=>o!==void 0);if(s.length===0||n.length===0||s.reduce((o,c)=>o+c.length,0)/s.length>n.reduce((o,c)=>o+c.length,0)/n.length*1.5)return false;let a=s.filter(o=>!isNaN(Number(o))&&o.trim()!=="").length;return s.length-a>=a}columnToLetter(t){let e="";for(;t>=0;)e=String.fromCharCode(t%26+65)+e,t=Math.floor(t/26)-1;return e}getSheetNamesToProcess(t,e){let r=t.SheetNames;return e.sheets&&e.sheets.length>0?e.sheets.filter(i=>r.includes(i)):e.sheetIndices&&e.sheetIndices.length>0?e.sheetIndices.filter(i=>i>=0&&i<r.length).map(i=>r[i]):r}boostConfidenceFromColumnName(t,e,r){if(!e)return t;let i=e.toLowerCase().trim();return r.some(s=>i.includes(s.toLowerCase()))?t.map(s=>({...s,confidence:Math.min(1,(s.confidence||.5)*1.2)})):t}extractText(t,e){if(!this.xlsx)throw new Error("[XlsxProcessor] XLSX support requires xlsx package. Install with: npm install xlsx");let r=this.parse(t),i={...this.defaultOptions,...e},s=this.getSheetNamesToProcess(r,i),n=[];for(let a of s){let o=r.Sheets[a],c=this.xlsx.utils.decode_range(o["!ref"]||"A1");for(let l=c.s.r;l<=c.e.r;l++)for(let d=c.s.c;d<=c.e.c;d++){let u=o[this.xlsx.utils.encode_cell({r:l,c:d})];if(u){let p=this.getCellValue(u);p.trim().length>0&&n.push(p);}}}return n.join(" ")}getMetadata(t){if(!this.xlsx)throw new Error("[XlsxProcessor] XLSX support requires xlsx package. Install with: npm install xlsx");let e=this.parse(t);return {sheetNames:e.SheetNames,sheetCount:e.SheetNames.length}}};}));function fg(){return new De}var De,Ag=S((()=>{tr(),rr(),ir(),sr(),De=class{constructor(){try{this.pdfParse=K("pdf-parse");}catch{}try{this.mammoth=K("mammoth");}catch{}this.ocrProcessor=new re,this.jsonProcessor=new ie,this.csvProcessor=new se,this.xlsxProcessor=new ne;}async extractText(t,e){let r=e?.format||this.detectFormat(t);if(!r)throw new Error("[DocumentProcessor] Unable to detect document format. Supported: PDF, DOCX, TXT, images (with OCR)");let i=e?.maxSize||50*1024*1024;if(t.length>i)throw new Error(`[DocumentProcessor] Document size (${t.length} bytes) exceeds maximum (${i} bytes)`);switch(r){case "pdf":return this.extractPdfText(t,e);case "docx":return this.extractDocxText(t,e);case "txt":return t.toString("utf-8");case "image":return this.extractImageText(t,e);case "json":return this.extractJsonText(t,e);case "csv":return this.extractCsvText(t,e);case "xlsx":return this.extractXlsxText(t,e);default:throw new Error(`[DocumentProcessor] Unsupported format: ${r}`)}}async getMetadata(t,e){let r=e?.format||this.detectFormat(t);if(!r)throw new Error("[DocumentProcessor] Unable to detect document format");switch(r){case "pdf":return this.getPdfMetadata(t,e);case "docx":return this.getDocxMetadata(t,e);case "txt":return {format:"txt",pages:void 0};case "image":return this.getImageMetadata(t,e);case "json":return this.getJsonMetadata(t,e);case "csv":return this.getCsvMetadata(t,e);case "xlsx":return this.getXlsxMetadata(t,e);default:throw new Error(`[DocumentProcessor] Unsupported format: ${r}`)}}detectFormat(t){if(t.length<4)return null;if(t.toString("utf-8",0,4)==="%PDF")return "pdf";if(t.length>=8&&t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71||t[0]===255&&t[1]===216&&t[2]===255||t[0]===73&&t[1]===73&&t[2]===42&&t[3]===0||t[0]===77&&t[1]===77&&t[2]===0&&t[3]===42||t[0]===66&&t[1]===77||t.length>=12&&t[0]===82&&t[1]===73&&t[2]===70&&t[3]===70&&t[8]===87&&t[9]===69&&t[10]===66&&t[11]===80)return "image";if(t[0]===80&&t[1]===75){let n=t.toString("utf-8",0,Math.min(500,t.length));if(n.includes("word/")||n.includes("[Content_Types].xml"))return "docx";if(n.includes("xl/"))return "xlsx"}let e=t.toString("utf-8"),r=e.trim();if((r.startsWith("{")&&r.endsWith("}")||r.startsWith("[")&&r.endsWith("]"))&&this.jsonProcessor.isValid(t))return "json";let i=e.split(/\r?\n/).slice(0,5);if(i.length>=2)for(let n of [","," ",";","|"]){let a=i.map(o=>(o.match(new RegExp(n,"g"))||[]).length);if(a[0]>0&&a.every(o=>o===a[0]))return "csv"}let s=t.slice(0,Math.min(1e3,t.length));return s.filter(n=>n<32&&n!==9&&n!==10&&n!==13).length<s.length*.1?"txt":null}isFormatSupported(t){switch(t){case "pdf":return !!this.pdfParse;case "docx":return !!this.mammoth;case "txt":return true;case "image":return this.ocrProcessor.isAvailable();case "json":return true;case "csv":return true;case "xlsx":return this.xlsxProcessor.isAvailable();default:return false}}async extractPdfText(t,e){if(!this.pdfParse)throw new Error("[DocumentProcessor] PDF support requires pdf-parse. Install with: npm install pdf-parse");try{let r=await this.pdfParse(t,{password:e?.password,max:e?.pages?Math.max(...e.pages):void 0});return e?.pages?r.text:r.text||""}catch(r){throw new Error(`[DocumentProcessor] PDF extraction failed: ${r.message}`)}}async extractDocxText(t,e){if(!this.mammoth)throw new Error("[DocumentProcessor] DOCX support requires mammoth. Install with: npm install mammoth");try{return (await this.mammoth.extractRawText({buffer:t})).value||""}catch(r){throw new Error(`[DocumentProcessor] DOCX extraction failed: ${r.message}`)}}async getPdfMetadata(t,e){if(!this.pdfParse)throw new Error("[DocumentProcessor] PDF support requires pdf-parse. Install with: npm install pdf-parse");try{let r=await this.pdfParse(t,{password:e?.password});return {format:"pdf",pages:r.numpages,title:r.info?.Title,author:r.info?.Author,creationDate:r.info?.CreationDate?new Date(r.info.CreationDate):void 0,modifiedDate:r.info?.ModDate?new Date(r.info.ModDate):void 0,custom:r.info}}catch(r){throw new Error(`[DocumentProcessor] PDF metadata extraction failed: ${r.message}`)}}async getDocxMetadata(t,e){return {format:"docx",pages:void 0}}async extractImageText(t,e){if(!this.ocrProcessor.isAvailable())throw new Error("[DocumentProcessor] Image/OCR support requires tesseract.js. Install with: npm install tesseract.js");try{return (await this.ocrProcessor.recognizeText(t,e?.ocrOptions)).text}catch(r){throw new Error(`[DocumentProcessor] Image text extraction failed: ${r.message}`)}}async getImageMetadata(t,e){if(!this.ocrProcessor.isAvailable())return {format:"image",pages:void 0,usedOCR:false};try{return {format:"image",pages:void 0,usedOCR:!0,ocrConfidence:(await this.ocrProcessor.recognizeText(t,e?.ocrOptions)).confidence}}catch{return {format:"image",pages:void 0,usedOCR:false}}}async extractJsonText(t,e){try{return this.jsonProcessor.extractText(t)}catch(r){throw new Error(`[DocumentProcessor] JSON extraction failed: ${r.message}`)}}async extractCsvText(t,e){try{return this.csvProcessor.extractText(t)}catch(r){throw new Error(`[DocumentProcessor] CSV extraction failed: ${r.message}`)}}async extractXlsxText(t,e){if(!this.xlsxProcessor.isAvailable())throw new Error("[DocumentProcessor] XLSX support requires xlsx package. Install with: npm install xlsx");try{return this.xlsxProcessor.extractText(t)}catch(r){throw new Error(`[DocumentProcessor] XLSX extraction failed: ${r.message}`)}}async getJsonMetadata(t,e){try{let r=this.jsonProcessor.parse(t),i=Array.isArray(r);return {format:"json",pages:void 0,custom:{isArray:i,itemCount:i?r.length:Object.keys(r).length}}}catch{return {format:"json",pages:void 0}}}async getCsvMetadata(t,e){try{let r=this.csvProcessor.getColumnInfo(t);return {format:"csv",pages:void 0,custom:{rowCount:r.rowCount,columnCount:r.columnCount,headers:r.headers}}}catch{return {format:"csv",pages:void 0}}}async getXlsxMetadata(t,e){if(!this.xlsxProcessor.isAvailable())return {format:"xlsx",pages:void 0};try{let r=this.xlsxProcessor.getMetadata(t);return {format:"xlsx",pages:void 0,custom:{sheetNames:r.sheetNames,sheetCount:r.sheetCount}}}catch{return {format:"xlsx",pages:void 0}}}getOCRProcessor(){return this.ocrProcessor}getJsonProcessor(){return this.jsonProcessor}getCsvProcessor(){return this.csvProcessor}getXlsxProcessor(){return this.xlsxProcessor}};})),yg=Q({CsvProcessor:()=>se,DocumentProcessor:()=>De,JsonProcessor:()=>ie,OCRProcessor:()=>re,XlsxProcessor:()=>ne,createCsvProcessor:()=>mg,createDocumentProcessor:()=>fg,createJsonProcessor:()=>gg,createOCRProcessor:()=>hg,createXlsxProcessor:()=>Eg}),nr=S((()=>{Ag(),tr(),rr(),ir(),sr();}));function Ig(t){return new Me(t)}var Me,_g=S((()=>{Me=class{constructor(t={}){this.workers=[],this.availableWorkers=[],this.taskQueue=[],this.totalProcessingTime=0,this.config={numWorkers:t.numWorkers||d().length,maxQueueSize:t.maxQueueSize||100,idleTimeout:t.idleTimeout||3e4},this.stats={activeWorkers:0,idleWorkers:0,queueSize:0,totalProcessed:0,totalErrors:0,avgProcessingTime:0},this.workerPath=f(__dirname,"worker.js");}async initialize(){for(let t=0;t<this.config.numWorkers;t++)await this.createWorker();}async createWorker(){let t=new c(this.workerPath);return t.on("message",e=>{this.handleWorkerResult(t,e);}),t.on("error",e=>{console.error("[WorkerPool] Worker error:",e),this.stats.totalErrors++,this.removeWorker(t),this.createWorker();}),t.on("exit",e=>{e!==0&&console.error(`[WorkerPool] Worker exited with code ${e}`),this.removeWorker(t);}),this.workers.push(t),this.availableWorkers.push(t),this.stats.idleWorkers++,t}async execute(t){if(this.taskQueue.length>=this.config.maxQueueSize)throw new Error(`[WorkerPool] Queue is full (max: ${this.config.maxQueueSize})`);return new Promise((e,r)=>{this.taskQueue.push({task:t,resolve:e,reject:r}),this.stats.queueSize=this.taskQueue.length,this.processQueue();})}processQueue(){for(;this.taskQueue.length>0&&this.availableWorkers.length>0;){let t=this.availableWorkers.shift(),{task:e,resolve:r,reject:i}=this.taskQueue.shift();this.stats.idleWorkers--,this.stats.activeWorkers++,this.stats.queueSize=this.taskQueue.length,t.__currentTask={resolve:r,reject:i,startTime:Date.now()},t.postMessage(e);}}handleWorkerResult(t,e){let r=t.__currentTask;r&&(this.stats.activeWorkers--,this.stats.idleWorkers++,this.stats.totalProcessed++,this.totalProcessingTime+=e.processingTime,this.stats.avgProcessingTime=this.totalProcessingTime/this.stats.totalProcessed,this.availableWorkers.push(t),delete t.__currentTask,e.error?(this.stats.totalErrors++,r.reject(new Error(e.error))):r.resolve(e.result),this.processQueue());}removeWorker(t){let e=this.workers.indexOf(t);e!==-1&&this.workers.splice(e,1);let r=this.availableWorkers.indexOf(t);r!==-1&&(this.availableWorkers.splice(r,1),this.stats.idleWorkers--);}getStats(){return {...this.stats}}async terminate(){let t=this.workers.map(e=>e.terminate());await Promise.all(t),this.workers=[],this.availableWorkers=[],this.taskQueue=[],this.stats.activeWorkers=0,this.stats.idleWorkers=0,this.stats.queueSize=0;}};})),ht=Q({WorkerPool:()=>Me,createWorkerPool:()=>Ig}),Pe=S((()=>{_g();})),ar=class Oe{constructor(e={}){if(this.compiledPatterns=new Map,this.valueToPlaceholder=new Map,this.placeholderCounter=new Map,this.options={includeNames:true,includeAddresses:true,includePhones:true,includeEmails:true,patterns:[],categories:[],customPatterns:[],whitelist:[],deterministic:true,redactionMode:"placeholder",enableContextAnalysis:true,confidenceThreshold:.5,enableFalsePositiveFilter:true,falsePositiveThreshold:.7,enableMultiPass:false,multiPassCount:3,enableCache:false,cacheSize:100,enablePriorityOptimization:false,debug:false,maxInputSize:10*1024*1024,regexTimeout:100,...e.preset?Th(e.preset):{},...e,optimizerOptions:{learningWeight:e.optimizerOptions?.learningWeight??.3,minSampleSize:e.optimizerOptions?.minSampleSize??10,maxPriorityAdjustment:e.optimizerOptions?.maxPriorityAdjustment??15}},this.options.enableCache&&(this.resultCache=new Xh(this.options.cacheSize)),this.options.enableMultiPass&&(this.multiPassConfig=Kh({numPasses:this.options.multiPassCount})),this.enableLearning=e.enableLearning??true,this.enableLearning){this.learningStore=new Oh(e.learningStorePath||".openredaction/learnings.json",{autoSave:true,confidenceThreshold:.85});let r=this.learningStore.getWhitelist();this.options.whitelist=[...this.options.whitelist,...r],this.options.enablePriorityOptimization&&(this.priorityOptimizer=ig(this.learningStore,this.options.optimizerOptions));}if(this.patterns=this.buildPatternList(),this.validatePatterns(),this.precompilePatterns(),this.priorityOptimizer&&(this.patterns=this.priorityOptimizer.optimizePatterns(this.patterns)),this.severityClassifier=new qh,this.patterns=this.severityClassifier.ensureAllSeverity(this.patterns),this.patterns.sort((r,i)=>i.priority-r.priority),e.enableAuditLog&&(this.auditLogger=e.auditLogger||new ti,this.auditUser=e.auditUser,this.auditSessionId=e.auditSessionId,this.auditMetadata=e.auditMetadata),e.enableMetrics&&(this.metricsCollector=e.metricsCollector||new ri),e.enableRBAC)if(e.rbacManager)this.rbacManager=e.rbacManager;else if(e.role){let r=oi(e.role);r&&(this.rbacManager=new lt(r));}else this.rbacManager=new lt;e.enableNER&&(this.nerDetector=new Wh,this.nerDetector.isAvailable()||(console.warn("[OpenRedaction] NER enabled but compromise.js not installed. Install with: npm install compromise"),console.warn("[OpenRedaction] Falling back to regex-only detection."),this.nerDetector=void 0)),e.enableContextRules!==false&&(this.contextRulesEngine=new Vh(e.contextRulesConfig));}static async fromConfig(e){let r=new Dh(e),i=await r.load();return i?new Oe({...r.resolveConfig(i),enableLearning:true,learningStorePath:i.learnedPatterns}):new Oe}buildPatternList(){let e;if(this.options.patterns&&this.options.patterns.length>0)e=dt.filter(r=>this.options.patterns.includes(r.type));else if(this.options.categories&&this.options.categories.length>0){e=[];for(let r of this.options.categories){let i=U(r);e.push(...i);}e=Array.from(new Map(e.map(r=>[r.type,r])).values()),this.options.debug&&console.log(`[OpenRedaction] Loaded ${e.length} patterns from categories: ${this.options.categories.join(", ")}`);}else e=dt.filter(r=>!(r.type==="NAME"&&!this.options.includeNames||r.type.startsWith("EMAIL")&&!this.options.includeEmails||r.type.startsWith("PHONE")&&!this.options.includePhones||r.type.startsWith("ADDRESS")&&!this.options.includeAddresses||r.type.startsWith("POSTCODE")&&!this.options.includeAddresses||r.type.startsWith("ZIP")&&!this.options.includeAddresses));return this.options.customPatterns&&this.options.customPatterns.length>0&&e.push(...this.options.customPatterns),e}validatePatterns(){if(!this.options.customPatterns||this.options.customPatterns.length===0){this.options.debug&&console.log(`[OpenRedaction] No custom patterns to validate. ${this.patterns.length} built-in patterns loaded.`);return}for(let e of this.options.customPatterns)try{og(e.regex);}catch(r){let i=`[OpenRedaction] Invalid custom pattern '${e.type}': ${r.message}`;throw new Error(i)}this.options.debug&&console.log(`[OpenRedaction] Validated ${this.options.customPatterns.length} custom patterns. Total patterns: ${this.patterns.length}`);}precompilePatterns(){this.compiledPatterns.clear();for(let e of this.patterns){let r=new RegExp(e.regex.source,e.regex.flags);this.compiledPatterns.set(e,r),this.options.debug&&(e.type==="NINTENDO_FRIEND_CODE"||e.type==="TELECOMS_ACCOUNT_NUMBER")&&console.log(`[OpenRedaction] Compiled pattern '${e.type}': ${r}`);}this.options.debug&&console.log(`[OpenRedaction] Pre-compiled ${this.compiledPatterns.size} regex patterns`);}processPatterns(e,r,i){let s=[];for(let n of r){let a=this.compiledPatterns.get(n);if(!a){this.options.debug&&console.warn(`[OpenRedaction] Pattern '${n.type}' not found in compiled cache, skipping`);continue}this.options.debug&&(n.type==="NINTENDO_FRIEND_CODE"||n.type==="TELECOMS_ACCOUNT_NUMBER")&&console.log(`[OpenRedaction] Processing pattern '${n.type}' with regex: ${a}`);let o,c=0,l=1e4;a.lastIndex=0;try{for(;(o=ng(a,e,{timeout:this.options.regexTimeout}))!==null;){if(this.options.debug&&(n.type==="NINTENDO_FRIEND_CODE"||n.type==="TELECOMS_ACCOUNT_NUMBER")&&console.log(`[OpenRedaction] Pattern '${n.type}' regex match found: '${o[0]}' at position ${o.index}`),c++,c>=l){this.options.debug&&console.warn(`[OpenRedaction] Pattern '${n.type}' exceeded ${l} matches, stopping`);break}let d=o[1]!==void 0?o[1]:o[0],u=o[0],p,h;if(o[1]!==void 0){let y=u.indexOf(d);p=o.index+y,h=p+d.length;}else p=o.index,h=p+d.length;if(this.overlapsWithExisting(p,h,i)){this.options.debug&&console.log(`[OpenRedaction] Pattern '${n.type}' skipped due to overlap at ${p}-${h}`);continue}let A=Math.max(0,p-50),E=Math.min(e.length,h+50),g=e.substring(A,E);if(n.validator&&!n.validator(d,g)){this.options.debug&&console.log(`[OpenRedaction] Pattern '${n.type}' validation failed for value: '${d}' with context: '${g.substring(0,100)}...'`);continue}if(this.options.enableFalsePositiveFilter){let y=Xt(d,n.type,g);if(y.isFalsePositive&&y.confidence>=this.options.falsePositiveThreshold)continue}let _=1;if(this.options.enableContextAnalysis&&(_=Ce(e,d,n.type,p,h).confidence,this.options.debug&&_<this.options.confidenceThreshold&&console.log(`[OpenRedaction] Pattern '${n.type}' failed context analysis. Value: '${d}', Confidence: ${_} < ${this.options.confidenceThreshold}`)),this.contextRulesEngine){let y={type:n.type,value:d,start:p,end:h,confidence:_,context:{before:e.substring(Math.max(0,p-250),p),after:e.substring(h,Math.min(e.length,h+250))}};_=this.contextRulesEngine.applyProximityRules(y,e).confidence;}if(_<this.options.confidenceThreshold||this.options.whitelist.some(y=>d.toLowerCase().includes(y.toLowerCase())))continue;let f=this.generatePlaceholder(d,n);this.options.debug&&console.log(`[OpenRedaction] Pattern '${n.type}' detected: '${d}' at position ${p}-${h}, confidence: ${_}`),s.push({type:n.type,value:d,placeholder:f,position:[p,h],severity:n.severity||"medium",confidence:_}),i.push([p,h]);}}catch(d){if(d instanceof ve){this.options.debug&&console.warn(`[OpenRedaction] ${d.message}`);continue}throw d}}if(this.nerDetector&&this.nerDetector.isAvailable()){let n=this.nerDetector.detect(e),a=s.map(c=>({type:c.type,value:c.value,start:c.position[0],end:c.position[1],confidence:c.confidence||1,context:{before:e.substring(Math.max(0,c.position[0]-50),c.position[0]),after:e.substring(c.position[1],Math.min(e.length,c.position[1]+50))}}));if(s.length>0){let c=this.nerDetector.hybridDetection(a,e);s=s.map((l,d)=>({...l,confidence:c[d].confidence})),a=s.map(l=>({type:l.type,value:l.value,start:l.position[0],end:l.position[1],confidence:l.confidence||1,context:{before:e.substring(Math.max(0,l.position[0]-50),l.position[0]),after:e.substring(l.position[1],Math.min(e.length,l.position[1]+50))}}));}let o=this.nerDetector.extractNEROnly(n,a);for(let c of o){let l={type:`NER_${c.type}`,regex:/.^/,priority:1,placeholder:`[NER_${c.type}_{n}]`,severity:"medium"},d=this.generatePlaceholder(c.text,l);s.push({type:l.type,value:c.text,placeholder:d,position:[c.start,c.end],severity:"medium",confidence:c.confidence});}}if(this.contextRulesEngine&&s.length>0){let n=s.map(o=>({type:o.type,value:o.value,start:o.position[0],end:o.position[1],confidence:o.confidence||1,context:{before:e.substring(Math.max(0,o.position[0]-50),o.position[0]),after:e.substring(o.position[1],Math.min(e.length,o.position[1]+50))}})),a=this.contextRulesEngine.applyDomainBoosting(n,e);s=s.map((o,c)=>({...o,confidence:a[c].confidence}));}return s}async detect(e){if(this.rbacManager&&!this.rbacManager.hasPermission("detection:detect"))throw new Error("[OpenRedaction] Permission denied: detection:detect required");let r=performance.now(),i=new Blob([e]).size;if(i>this.options.maxInputSize)throw new Error(`[OpenRedaction] Input size (${i} bytes) exceeds maximum allowed size (${this.options.maxInputSize} bytes). Set maxInputSize option to increase limit or use streaming/batch processing for large documents.`);if(i>this.options.maxInputSize*.8&&this.options.debug&&console.warn(`[OpenRedaction] Input size (${i} bytes) is approaching maximum limit (${this.options.maxInputSize} bytes)`),this.options.debug&&(console.log(`[OpenRedaction] Detecting PII in ${i} byte text`),console.log(`[OpenRedaction] Active patterns: ${this.patterns.length}`),console.log(`[OpenRedaction] Multi-pass: ${this.options.enableMultiPass?"enabled":"disabled"}`),console.log(`[OpenRedaction] Cache: ${this.options.enableCache?"enabled":"disabled"}`)),this.resultCache){let u=ut(e),p=this.resultCache.get(u);if(p)return this.options.debug&&console.log("[OpenRedaction] Cache hit, returning cached result"),p}this.options.deterministic||(this.placeholderCounter.clear(),this.valueToPlaceholder.clear());let s,n=[];if(this.options.enableMultiPass&&this.multiPassConfig){let u=Zh(this.patterns,this.multiPassConfig),p=new Map;for(let h of this.multiPassConfig){let A=u.get(h.name)||[];if(A.length===0)continue;let E=this.processPatterns(e,A,n);p.set(h.name,E);for(let g of E)n.push(g.position);}s=$h(p,this.multiPassConfig);}else s=this.processPatterns(e,this.patterns,n);s.sort((u,p)=>p.position[0]-u.position[0]);let a=e,o={};for(let u of s){if(!u.value)continue;let p=this.escapeRegex(u.value),h=new RegExp(p,"gi");a=a.replace(h,u.placeholder),o[u.placeholder]=u.value;}let c=performance.now(),l=Math.round((c-r)*100)/100,d={original:e,redacted:a,detections:s.reverse(),redactionMap:o,stats:{processingTime:l,piiCount:s.length}};if(this.options.debug&&(console.log(`[OpenRedaction] Detection complete: ${s.length} PII found in ${l}ms`),s.length>0)){let u={};for(let p of s)u[p.type]=(u[p.type]||0)+1;console.log("[OpenRedaction] Detection breakdown:",u);}if(this.auditLogger)try{let u=[...new Set(s.map(p=>p.type))];this.auditLogger.log({operation:"redact",piiCount:s.length,piiTypes:u,textLength:e.length,processingTimeMs:l,redactionMode:this.options.redactionMode,success:!0,user:this.auditUser,sessionId:this.auditSessionId,metadata:this.auditMetadata});}catch(u){this.options.debug&&console.error("[OpenRedaction] Audit logging failed:",u);}if(this.metricsCollector)try{this.metricsCollector.recordRedaction(d,l,this.options.redactionMode);}catch(u){this.options.debug&&console.error("[OpenRedaction] Metrics recording failed:",u);}if(this.resultCache){let u=ut(e);this.resultCache.set(u,d),this.options.debug&&console.log("[OpenRedaction] Result cached");}return d}restore(e,r){if(this.rbacManager&&!this.rbacManager.hasPermission("detection:restore"))throw new Error("[OpenRedaction] Permission denied: detection:restore required");let i=performance.now(),s=e;for(let[o,c]of Object.entries(r))s=s.replace(new RegExp(this.escapeRegex(o),"g"),c);let n=performance.now(),a=Math.round((n-i)*100)/100;if(this.auditLogger)try{this.auditLogger.log({operation:"restore",piiCount:Object.keys(r).length,piiTypes:[],textLength:e.length,processingTimeMs:a,success:!0,user:this.auditUser,sessionId:this.auditSessionId,metadata:this.auditMetadata});}catch(o){this.options.debug&&console.error("[OpenRedaction] Audit logging failed:",o);}return s}generatePlaceholder(e,r){if(this.options.deterministic&&this.valueToPlaceholder.has(e))return this.valueToPlaceholder.get(e);let i;if(this.options.redactionMode!=="placeholder")return i=bh(e,r.type,this.options.redactionMode,r.placeholder),this.valueToPlaceholder.set(e,i),i;if(this.options.deterministic){let s=hh(e,r.type);i=r.placeholder.replace("{n}",s);}else {let s=(this.placeholderCounter.get(r.type)||0)+1;this.placeholderCounter.set(r.type,s),i=r.placeholder.replace("{n}",s.toString());}return this.valueToPlaceholder.set(e,i),i}overlapsWithExisting(e,r,i){return i.some(([s,n])=>e>=s&&e<n||r>s&&r<=n||e<=s&&r>=n)}escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}getPatterns(){return [...this.patterns]}async scan(e){let r=await this.detect(e);return {high:r.detections.filter(i=>i.severity==="high"),medium:r.detections.filter(i=>i.severity==="medium"),low:r.detections.filter(i=>i.severity==="low"),total:r.detections.length}}recordFalsePositive(e,r){if(!this.learningStore)throw be();let i=r||"";this.learningStore.recordFalsePositive(e.value,e.type,i),this.learningStore.getConfidence(e.value)>=.85&&this.options.whitelist.push(e.value);}recordFalseNegative(e,r,i){if(!this.learningStore)throw be();let s=i||"";this.learningStore.recordFalseNegative(e,r,s);}recordCorrectDetection(){this.learningStore&&this.learningStore.recordCorrectDetection();}getLearningStats(){return this.learningStore?this.learningStore.getStats():null}getLearnedWhitelist(){return this.learningStore?this.learningStore.getWhitelistEntries():[]}getPatternAdjustments(){return this.learningStore?this.learningStore.getPatternAdjustments():[]}exportLearnings(e){return this.learningStore?this.learningStore.export(e):null}importLearnings(e,r=true){if(!this.learningStore)throw be();this.learningStore.import(e,r);let i=this.learningStore.getWhitelist();this.options.whitelist=[...new Set([...this.options.whitelist,...i])];}addToWhitelist(e,r=.9){if(!this.learningStore){this.options.whitelist.push(e);return}this.learningStore.addToWhitelist(e,r),this.options.whitelist.push(e);}removeFromWhitelist(e){this.learningStore&&this.learningStore.removeFromWhitelist(e),this.options.whitelist=this.options.whitelist.filter(r=>r!==e);}getLearningStore(){return this.learningStore}getPriorityOptimizer(){return this.priorityOptimizer}optimizePriorities(){if(!this.priorityOptimizer)throw sg();this.patterns=this.priorityOptimizer.optimizePatterns(this.patterns),this.patterns.sort((e,r)=>r.priority-e.priority),this.resultCache&&this.resultCache.clear();}getPatternStats(){return this.priorityOptimizer?this.priorityOptimizer.getPatternStats(this.patterns):null}clearCache(){this.resultCache&&this.resultCache.clear();}getCacheStats(){return {size:this.resultCache?.size||0,maxSize:this.options.cacheSize,enabled:this.options.enableCache}}getAuditLogger(){if(this.rbacManager&&!this.rbacManager.hasPermission("audit:read"))throw new Error("[OpenRedaction] Permission denied: audit:read required");return this.auditLogger}getMetricsCollector(){if(this.rbacManager&&!this.rbacManager.hasPermission("metrics:read"))throw new Error("[OpenRedaction] Permission denied: metrics:read required");return this.metricsCollector}getRBACManager(){return this.rbacManager}explain(){return Qh(this)}generateReport(e,r){return tg(this).generate(e,r)}exportConfig(e){let{ConfigExporter:r}=(er(),ei(cg));return r.exportToString(this.options,e,true)}async healthCheck(e){let{HealthChecker:r}=await Promise.resolve().then(()=>(Se(),pt));return new r(this).check(e)}async quickHealthCheck(){let{HealthChecker:e}=await Promise.resolve().then(()=>(Se(),pt));return new e(this).quickCheck()}async detectDocument(e,r){if(this.rbacManager&&!this.rbacManager.hasPermission("detection:detect"))throw new Error("[OpenRedaction] Permission denied: detection:detect required");let{createDocumentProcessor:i}=await Promise.resolve().then(()=>(nr(),yg)),s=i(),n=performance.now(),a=await s.extractText(e,r),o=await s.getMetadata(e,r),c=performance.now(),l=Math.round((c-n)*100)/100;return {text:a,metadata:o,detection:await this.detect(a),fileSize:e.length,extractionTime:l}}async detectDocumentFile(e,r){if(this.rbacManager&&!this.rbacManager.hasPermission("detection:detect"))throw new Error("[OpenRedaction] Permission denied: detection:detect required");let i=await(await import('./empty-shim-IFLK4AY7.js')).readFile(e);return this.detectDocument(i,r)}static async detectBatch(e,r){let{createWorkerPool:i}=await Promise.resolve().then(()=>(Pe(),ht)),s=i({numWorkers:r?.numWorkers});try{await s.initialize();let n=e.map((a,o)=>({type:"detect",id:`detect_${o}`,text:a,options:r}));return await Promise.all(n.map(a=>s.execute(a)))}finally{await s.terminate();}}static async detectDocumentsBatch(e,r){let{createWorkerPool:i}=await Promise.resolve().then(()=>(Pe(),ht)),s=i({numWorkers:r?.numWorkers});try{await s.initialize();let n=e.map((a,o)=>({type:"document",id:`document_${o}`,buffer:a,options:r}));return await Promise.all(n.map(a=>s.execute(a)))}finally{await s.terminate();}}};nr();Pe();er();Se();var ae=class{engine;constructor(e={}){let r=[];e.redactPii!==false&&(r.push("EMAIL"),r.push("PHONE_US","PHONE_UK","PHONE_INTERNATIONAL"),r.push(...U("government").map(s=>s.type))),e.redactFinancials!==false&&r.push(...U("financial").map(s=>s.type)),e.redactCredentials!==false&&r.push(...U("credentials").map(s=>s.type)),e.redactMedical!==false&&r.push(...U("healthcare").map(s=>s.type)),e.redactInfrastructure!==false&&r.push(...U("network").map(s=>s.type));let i={patterns:r,includeNames:false,includeAddresses:false,redactionMode:"placeholder",enableContextAnalysis:true,enableFalsePositiveFilter:true,falsePositiveThreshold:.7,deterministic:true};this.engine=new ar(i);}async redact(e){return e&&(await this.engine.detect(e)).redacted}async hasSensitiveInfo(e){return e?(await this.engine.detect(e)).detections.length>0:false}async process(e){if(!e)return {redacted:e,hasSensitiveInfo:false};let r=await this.engine.detect(e);return {redacted:r.redacted,hasSensitiveInfo:r.detections.length>0}}};var Ng=(s=>(s.SENSITIVE_PORTAL="sensitive_portal",s.DIGESTIBLE_ARTICLE="digestible_article",s.NOISE="noise",s.UNKNOWN="unknown",s))(Ng||{}),or={SEMANTIC_TOKEN_CAP:15e3},oe={defaultSemanticTokenCap:or.SEMANTIC_TOKEN_CAP},cr=false;function Rg(t={}){oe={...oe,...t},console.log(`\u{1F6E1}\uFE0F Alete Gate: Ingestion substrate initialized. Semantic cap: ${oe.defaultSemanticTokenCap} tokens. Explore our ecosystem at https://alete.ai/`),cr=true;}function Tg(t){let e=t.trim().split(/\s+/).length;return Math.ceil(e*1.33)}function bg(t,e){if(Tg(t)<=e)return {truncated:t,isTruncated:false};let i=Math.floor(e/1.33);return {truncated:t.trim().split(/\s+/).slice(0,i).join(" ")+`
|
|
414
|
+
|
|
415
|
+
... [Content truncated due to token cap]`,isTruncated:true}}async function zm(t,e={}){cr||Rg();let r=X(t,{hooks:[Re]}),i={},s=X(t,Ne({isolateMain:false,plugins:{tagOverrides:{a:{enter:"",exit:""},img:{enter:"",exit:""},svg:{enter:"",exit:""},canvas:{enter:"",exit:""}},frontmatter:{onExtract:l=>{i=l;}}}})).trim();if(!i.title){let l=s.match(/^# (.*)$/m);l&&(i.title=l[1].replace(/[#*`_]/g,"").trim());}if(!i.description){let l=s.replace(/^# .*$/m,"").trim();if(l){let d=l.replace(/[#*`_]/g,"").trim();i.description=d.slice(0,150).replace(/\n/g," ")+(d.length>150?"...":"");}}let n=e.semanticTokenCap??oe.defaultSemanticTokenCap??or.SEMANTIC_TOKEN_CAP,{truncated:a,isTruncated:o}=bg(s,n);s=a;let c=false;if(e.redact){let l=typeof e.redact=="object"?e.redact:{},u=await new ae(l).process(s);s=u.redacted,c=u.hasSensitiveInfo;}return {structural:Te(r),semantic:s,hasSensitiveInfo:c,metadata:i,isTruncated:o}}export{Ng as GateLabel,ae as Redactor,Rg as initialize,Te as mapToTokens,Re as plugin,zm as processHtml};//# sourceMappingURL=index.browser.js.map
|
|
416
|
+
//# sourceMappingURL=index.browser.js.map
|