@nodatachat/mcp 1.5.7 → 1.5.10

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/dist/gate.js CHANGED
@@ -1,54 +1,60 @@
1
- /*! @nodatachat/mcp 1.5.7 | Copyright 2026 Capsule Ltd. | FSL-1.1-ALv2 | see LICENSE.md */
2
- import{appendFileSync as ao,copyFileSync as Bd,existsSync as yr,mkdirSync as co,readdirSync as lo,readFileSync as uo,statSync as Zt,writeFileSync as zd}from"node:fs";import{homedir as ue}from"node:os";import{basename as Xt,extname as br,isAbsolute as fe,join as tt,relative as fo,resolve as C}from"node:path";import{TextDecoder as Hn}from"node:util";var P={text:[],header:[],secrets:[],table:null,amounts:null,severity:null};function ut(e){e.table&&(P.table=e.table),e.severity&&(P.severity=e.severity),e.amounts&&(P.amounts=e.amounts);for(let t of e.text??[])P.text.some(r=>r.kind===t.kind)||P.text.push(t);e.header&&!P.header.includes(e.header)&&P.header.push(e.header);for(let t of e.secrets??[])P.secrets.some(r=>r.id===t.id)||P.secrets.push(t)}function ft(){return P.amounts?.()===!0}function Ae(){return P.text}function en(){return P.header}function ge(){return P.table}function tn(){return P.secrets}var $e=[{id:"aws-access-key",name:"AWS Access Key",pattern:/(?:^|[^A-Z0-9])AKIA[A-Z2-7]{16}(?:[^A-Z2-7]|$)/,severity:"critical"},{id:"aws-secret-key",name:"AWS Secret Key",pattern:/(?:aws_secret_access_key|aws_secret_key|secret_access_key)\s*[=:]\s*['"]?[A-Za-z0-9/+=]{40}['"]?/,severity:"critical"},{id:"gcp-api-key",name:"GCP API Key",pattern:/AIza[0-9A-Za-z_-]{35}/,severity:"critical"},{id:"gcp-service-account",name:"GCP Service Account",pattern:/"type"\s*:\s*"service_account"/,severity:"critical"},{id:"github-token",name:"GitHub Token",pattern:/gh[pousr]_[0-9a-zA-Z]{36,}/,severity:"critical"},{id:"github-fine-grained",name:"GitHub Fine-Grained Token",pattern:/github_pat_[0-9a-zA-Z_]{22,}/,severity:"critical"},{id:"gitlab-token",name:"GitLab Token",pattern:/glpat-[0-9a-zA-Z_-]{20,}/,severity:"critical"},{id:"stripe-secret",name:"Stripe Secret Key",pattern:/sk_live_[0-9a-zA-Z]{24,}/,severity:"critical"},{id:"stripe-restricted",name:"Stripe Restricted Key",pattern:/rk_live_[0-9a-zA-Z]{24,}/,severity:"critical"},{id:"slack-token",name:"Slack Token",pattern:/xox[baprs]-[0-9a-zA-Z-]{10,}/,severity:"high"},{id:"slack-webhook",name:"Slack Webhook",pattern:/hooks\.slack\.com\/services\/T[0-9A-Z]{8,}\/B[0-9A-Z]{8,}\/[0-9a-zA-Z]{24}/,severity:"high"},{id:"twilio-api-key",name:"Twilio API Key",pattern:/SK[0-9a-fA-F]{32}/,severity:"high"},{id:"sendgrid-api-key",name:"SendGrid API Key",pattern:/SG\.[0-9a-zA-Z_-]{22}\.[0-9a-zA-Z_-]{43}/,severity:"critical"},{id:"postgres-uri",name:"PostgreSQL Connection String",pattern:/postgres(?:ql)?:\/\/[^\s'"]{10,}/,severity:"critical"},{id:"mongodb-uri",name:"MongoDB Connection String",pattern:/mongodb(?:\+srv)?:\/\/[^\s'"]{10,}/,severity:"critical"},{id:"redis-uri",name:"Redis Connection String",pattern:/redis(?:s)?:\/\/[^\s'"]{10,}/,severity:"high"},{id:"openai-key",name:"OpenAI API Key",pattern:/sk-[0-9a-zA-Z]{20,}T3BlbkFJ[0-9a-zA-Z]{20,}/,severity:"critical"},{id:"openai-project-key",name:"OpenAI API Key",pattern:/sk-(?:proj|svcacct|admin)-[0-9A-Za-z_-]{40,}/,severity:"critical"},{id:"anthropic-key",name:"Anthropic API Key",pattern:/sk-ant-[0-9a-zA-Z_-]{40,}/,severity:"critical"},{id:"firebase-key",name:"Firebase API Key",pattern:/AIza[0-9A-Za-z_-]{35}/,severity:"high"},{id:"supabase-key",name:"Supabase Service Key",pattern:/eyJ[0-9a-zA-Z_-]{100,}/,severity:"critical"},{id:"supabase-access-token",name:"Supabase Access Token",pattern:/\bsbp_[0-9a-f]{40}\b/,severity:"critical"},{id:"supabase-secret-key",name:"Supabase Secret Key",pattern:/\bsb_secret_[0-9A-Za-z_-]{20,}/,severity:"critical"},{id:"private-key",name:"Private Key",pattern:/-----BEGIN (?:RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----/,severity:"critical"},{id:"jwt-secret",name:"JWT/Generic Secret",pattern:/(?:jwt_secret|JWT_SECRET|secret_key|SECRET_KEY|api_secret|API_SECRET)\s*[=:]\s*['"][^'"]{8,}['"]/,severity:"high"},{id:"password-in-code",name:"Password in Code",pattern:/(?:password|passwd|pwd)\s*[=:]\s*['"][^'"]{8,}['"]/,severity:"high"},{id:"bearer-token",name:"Bearer Token in Code",pattern:/['"]Bearer\s+[0-9a-zA-Z._-]{20,}['"]/,severity:"high"}];function ye(){let e=tn().filter(t=>!$e.some(r=>r.id===t.id));return[...$e,...e]}var Vr=[{pattern:/^(full_?name|first_?name|last_?name|spouse_?name|beneficiary_?name)$/i,type:"name",label:"Person name"},{pattern:/^(email|e_?mail|email_?address)$/i,type:"email",label:"Email address"},{pattern:/^(phone|mobile|telephone|phone_?number|cell_?phone)$/i,type:"phone",label:"Phone number"},{pattern:/^(id_?number|identity|ssn|social_?security|national_?id|teudat_?zehut)$/i,type:"id",label:"ID number"},{pattern:/^(address|street_?address|home_?address)$/i,type:"address",label:"Address"},{pattern:/^(date_?of_?birth|dob|birth_?date|birthday)$/i,type:"dob",label:"Date of birth"},{pattern:/^(bank_?account|iban|account_?number|bank_?details|routing_?number)$/i,type:"financial",label:"Bank account"},{pattern:/^(credit_?card|card_?number|cvv|cc_?number)$/i,type:"financial",label:"Credit card"},{pattern:/^(salary|income|commission|premium|compensation)$/i,type:"financial",label:"Salary / income"},{pattern:/^(medical_?info|health_?conditions|diagnosis|medication|prescription)$/i,type:"medical",label:"Medical"},{pattern:/^(passport|passport_?number|passport_?id)$/i,type:"id",label:"Passport"},{pattern:/^(driver_?license|drivers_?license|dl_?number)$/i,type:"id",label:"Driver license"},{pattern:/^(tax_?id|tin|vat_?number|ein)$/i,type:"financial",label:"Tax ID"},{pattern:/^(insurance_?number|policy_?number|member_?id)$/i,type:"id",label:"Insurance/Policy"},{pattern:/^(biometric|fingerprint|face_?id|retina)$/i,type:"biometric",label:"Biometric"},{pattern:/^(latitude|longitude|lat|lng|geo_?location|coordinates)$/i,type:"location",label:"Geolocation"}],Gr=[{pattern:/^(?:שם|שם_מלא|שם פרטי|שם_פרטי|שם משפחה|שם_משפחה|שם הלקוח|שם בן זוג|שם המבוטח|שם המוטב|שם הילד|שם הקטין)$/i,type:"name",label:"\u05E9\u05DD \u05D0\u05D3\u05DD"},{pattern:/^(?:ת"ז|ת\.ז|ת ז|תז|תעודת זהות|תעודת_זהות|מספר זהות|מס' זהות|teudat_zehut|tz|israeli_id|il_id)$/i,type:"id",label:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA"},{pattern:/^(?:דרכון|מספר דרכון|רישיון נהיגה|רישיון_נהיגה|רשיון נהיגה)$/i,type:"id",label:"\u05D3\u05E8\u05DB\u05D5\u05DF/\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF"},{pattern:/^(?:מייל|דוא"ל|דוא_ל|דואר אלקטרוני|אימייל|כתובת מייל)$/i,type:"email",label:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9"},{pattern:/^(?:טלפון|טל'|נייד|פלאפון|סלולרי|מספר טלפון|טלפון נייד)$/i,type:"phone",label:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF"},{pattern:/^(?:כתובת|כתובת מגורים|רחוב|מס בית|עיר|ישוב|יישוב|מיקוד|כתובת מלאה|מען)$/i,type:"address",label:"\u05DB\u05EA\u05D5\u05D1\u05EA"},{pattern:/^(?:תאריך לידה|ת לידה|תאריך הולדת|יום הולדת|גיל)$/i,type:"dob",label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"},{pattern:/^(?:חשבון בנק|מספר חשבון|מס חשבון|סניף|iban|iban_il)$/i,type:"financial",label:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7"},{pattern:/^(?:כרטיס אשראי|מספר אשראי|cvv|אשראי)$/i,type:"financial",label:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"},{pattern:/^(?:שכר|משכורת|הכנסה|פרמיה|שכר ברוטו|שכר נטו|תגמול|בונוס|פיצוי)$/i,type:"financial",label:"\u05E9\u05DB\u05E8/\u05D4\u05DB\u05E0\u05E1\u05D4"},{pattern:/^(?:אבחון|אבחנה|מחלה|תרופה|מרשם|בדיקה רפואית|מצב רפואי|חיסון|רגישות|אלרגיה|סוג דם)$/i,type:"medical",label:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(?:מספר פוליסה|מס פוליסה|פוליסה|מספר חבר|מספר ביטוח)$/i,type:"id",label:"\u05E4\u05D5\u05DC\u05D9\u05E1\u05D4/\u05D7\u05D1\u05E8\u05D5\u05EA"},{pattern:/^(?:שם הילד|תעודת זהות של ילד|ילדים|קטין|מספר ילדים|תעודת לידה)$/i,type:"minor_data",label:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF"},{pattern:/^(?:דת|לאום|מין|נטייה מינית|השקפה פוליטית|מצב משפחתי|עדה|מוצא)$/i,type:"sensitive_personal",label:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9"},{pattern:/^(?:מספר רכב|מס רכב|לוחית רישוי|מספר רישוי)$/i,type:"tracking",label:"\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"}],Kr=/^(id|uuid|created_?at|updated_?at|deleted_?at|status|type|category|description|title|slug|url|path|key|value|enabled|active|public|version|metadata|config|settings|data|content|note|comment|label|color|icon)$/i,Zr=/^שם[ _](?:ה)?(?:קובץ|מוצר|פריט|חברה|ארגון|עסק|פרויקט|גיליון|טבלה|שדה|קטגוריה|סניף|בנק|עיר|רחוב|ישוב|יישוב|מסמך|תוכנית|חבילה|קורס|מחלקה|אתר|דומיין|מותג|ספק|שירות|תפקיד)$|^(file|product|item|company|org|organization|project|sheet|table|field|category|branch|bank|city|street|document|plan|course|department|site|domain|brand|vendor|service|role)[ _-]?name$/i;function be(e){if(!e)return null;let t=e.trim();if(Kr.test(t)||/^name$/i.test(t)||/^\[[A-Z_]+(?:-\d+)?\]$/.test(t))return null;let r=t.replace(/[\s-]+/g,"_");for(let n of[...Gr,...Vr])if(n.pattern.test(t)||n.pattern.test(r))return{type:n.type,label:n.label};if(Zr.test(t))return null;if(/^שם[ _][\u0590-\u05FF"'׳ ]{2,20}$/.test(t))return{type:"name",label:"\u05E9\u05DD \u05D0\u05D3\u05DD"};if(/^(customer|client|employee|inspector|supervisor|contact|person|patient|user|owner|manager|agent|member|driver|tenant|student|parent|beneficiary|insured)_?(full_?)?name$/i.test(r))return{type:"name",label:"Person name"};for(let n of en()){let i=n(t);if(i)return{type:i.type,label:i.label}}return null}function nn(e){let t=String(e??"").replace(/\D/g,"");if(t.length===0||t.length>9)return!1;let r=t.padStart(9,"0"),n=0;for(let i=0;i<9;i++){let s=parseInt(r[i]??"0",10)*(i%2+1);s>9&&(s-=9),n+=s}return n%10===0&&parseInt(r,10)>0}function Xr(e){let t=String(e??"").replace(/\D/g,"");if(t.length<12||t.length>19)return!1;let r=0,n=!1;for(let i=t.length-1;i>=0;i-=1){let s=parseInt(t[i]??"0",10);n&&(s*=2,s>9&&(s-=9)),r+=s,n=!n}return r%10===0}function Jr(e){let t=String(e??"").replace(/\s/g,"").toUpperCase();if(!/^[A-Z]{2}\d{2}[A-Z0-9]{10,30}$/.test(t))return!1;let r=t.slice(4)+t.slice(0,4),n=0;for(let i of r){let s=i>="A"&&i<="Z"?String(i.charCodeAt(0)-55):i;for(let o of s)n=(n*10+Number(o))%97}return n===1}var pt="(?<!\\d)(?<!\\d[.,])",ht="(?!\\d)(?![.,]\\d)",mt=[{subkind:"israeli_id",severity:"high",pattern:new RegExp(`${pt}\\d{9}${ht}`,"g"),validate:nn,hint:"Israeli national ID (check digit verified) in plaintext. Encrypt the column or mask it at rest."},{subkind:"credit_card",severity:"critical",pattern:new RegExp(`${pt}[2-6][ -]?(?:\\d[ -]?){11,17}\\d${ht}`,"g"),validate:Xr,hint:"Payment card number (Luhn verified) in plaintext. This is PCI scope."},{subkind:"iban",severity:"high",pattern:/\b[A-Z]{2}\d{2}(?: ?[A-Z0-9]{4}){2,7}(?: ?[A-Z0-9]{1,4})?\b/g,validate:Jr,hint:"Bank account in IBAN form (mod-97 verified) in plaintext."},{subkind:"israeli_phone",severity:"medium",pattern:new RegExp(`${pt}(?:\\+972[- ]?|0)(?:[57]\\d|[2-489])[- ]?\\d{3}[- ]?\\d{4}${ht}`,"g"),validate:e=>{let t=e.replace(/\D/g,"").replace(/^972/,"0");return/^0[57]\d{8}$/.test(t)?!0:/^0[2-489]\d{7}$/.test(t)&&(/[- ]/.test(e)||e.startsWith("+972"))},hint:"Israeli phone number in plaintext."}];function Ie(e,t){let r=[],n="",i=!1;for(let s=0;s<e.length;s++){let o=e[s];i?o==='"'&&e[s+1]==='"'?(n+='"',s++):o==='"'?i=!1:n+=o:o==='"'?i=!0:o===t?(r.push(n),n=""):n+=o}return r.push(n),r}import{inflateRawSync as Ci}from"node:zlib";import{inflateSync as qr}from"node:zlib";var Te=new Set([".pdf"]),rn=8*1024*1024;function cn(e){let t=e.toString("latin1"),r=new Map,n=/(\d+)\s+(\d+)\s+obj\b/g,i;for(;(i=n.exec(t))!==null;){let s=Number(i[1]),o=n.lastIndex,a=t.indexOf("endobj",o);if(a<0)continue;let l=t.indexOf("stream",o),c,u=null;if(l>=0&&l<a){c=t.slice(o,l);let d=l+6;t[d]==="\r"&&(d+=1),t[d]===`
3
- `&&(d+=1);let f=t.indexOf("endstream",d);f>d&&(u=e.subarray(d,f))}else c=t.slice(o,a);r.set(s,{num:s,dict:c,stream:u})}for(let s of[...r.values()]){if(!s.stream||!/\/Type\s*\/ObjStm\b/.test(s.dict))continue;let o=Re(s),a=Number(/\/N\s+(\d+)/.exec(s.dict)?.[1]??0),l=Number(/\/First\s+(\d+)/.exec(s.dict)?.[1]??-1);if(o===null||!a||l<0)continue;let c=o.slice(0,l).trim().split(/\s+/).map(Number);for(let u=0;u<a;u+=1){let d=c[2*u],f=c[2*u+1];if(d===void 0||f===void 0||Number.isNaN(d)||Number.isNaN(f))break;let h=u+1<a?c[2*(u+1)+1]:void 0,m=o.slice(l+f,h!==void 0?l+h:void 0);r.has(d)||r.set(d,{num:d,dict:m,stream:null})}}return r}function gt(e){let t=[...e.replace(/\s+/g,"")];if(t.length<40)return!1;let r=0,n=0;for(let i of t){let s=i.codePointAt(0)??0;s<32||s>=127&&s<=191||s===65533||s>=57344&&s<=63743?r+=1:/[\p{L}\p{N}]/u.test(i)&&(n+=1)}return r/t.length>.2||n/t.length<.25}function Yr(e){let t=e.toString("latin1").replace(/\s/g,"");t.startsWith("<~")&&(t=t.slice(2));let r=t.indexOf("~>");r>=0&&(t=t.slice(0,r));let n=[],i=0,s=0;for(let o of t){if(o==="z"&&s===0){n.push(0,0,0,0);continue}let a=o.charCodeAt(0)-33;if(a<0||a>84)return null;i=i*85+a,s+=1,s===5&&(n.push(i>>>24&255,i>>>16&255,i>>>8&255,i&255),i=0,s=0)}if(s>0){for(let a=s;a<5;a+=1)i=i*85+84;let o=[i>>>24&255,i>>>16&255,i>>>8&255,i&255];for(let a=0;a<s-1;a+=1)n.push(o[a]??0)}return Buffer.from(n)}function Qr(e){let t=e.toString("latin1").replace(/\s/g,"").split(">")[0]??"",r=t.length%2?t+"0":t;return/^[0-9A-Fa-f]*$/.test(r)?Buffer.from(r,"hex"):null}function ei(e){let t=/\/Filter\s*(\[[^\]]*\]|\/\w+)/.exec(e);return!t||!t[1]?[]:[...t[1].matchAll(/\/(\w+)/g)].map(r=>r[1]??"")}function Re(e){if(!e.stream)return null;let t=e.stream;for(let r of ei(e.dict)){let n=null;if(r==="FlateDecode")try{n=qr(t)}catch{return null}else if(r==="ASCII85Decode")n=Yr(t);else if(r==="ASCIIHexDecode")n=Qr(t);else return null;if(n===null)return null;t=n}return t.toString("latin1")}function ti(e){let t=new Map,r=1,n=/begincodespacerange([\s\S]*?)endcodespacerange/.exec(e);if(n&&n[1]){let l=/<([0-9A-Fa-f]+)>/.exec(n[1]);l&&l[1]&&l[1].length>=4&&(r=2)}let i=l=>{let c="";for(let u=0;u+3<l.length+1;u+=4){let d=parseInt(l.slice(u,u+4),16);Number.isFinite(d)&&d>0&&(c+=String.fromCharCode(d))}return c},s=/beginbfchar([\s\S]*?)endbfchar/g,o;for(;(o=s.exec(e))!==null;){let l=/<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]*)>/g,c;for(;(c=l.exec(o[1]??""))!==null;)t.set(parseInt(c[1]??"0",16),i(c[2]??""))}let a=/beginbfrange([\s\S]*?)endbfrange/g;for(;(o=a.exec(e))!==null;){let l=o[1]??"",c=/<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]*)>/g,u;for(;(u=c.exec(l))!==null;){let d=parseInt(u[1]??"0",16),f=parseInt(u[2]??"0",16),h=parseInt((u[3]??"0").slice(0,4)||"0",16);if(!(f-d>65535))for(let m=d;m<=f;m+=1)t.set(m,String.fromCharCode(h+(m-d)))}}return{map:t,bytes:r}}function ni(e){let t=new Map,r=[],n=[];for(let s of e.values()){for(let o of s.dict.matchAll(/\/Font\s*<<([\s\S]*?)>>/g))o[1]&&n.push(o[1]);for(let o of s.dict.matchAll(/\/Font\s+(\d+)\s+\d+\s+R/g)){let a=e.get(Number(o[1]));a&&n.push(a.dict)}}let i=new Set;for(let s of n){let o=/\/([^\s/<>[\]()]+)\s+(\d+)\s+\d+\s+R/g,a;for(;(a=o.exec(s))!==null;){let l=`${a[1]}#${a[2]}`;i.has(l)||(i.add(l),r.push([a[1]??"",Number(a[2])]))}}for(let[s,o]of r){let a=e.get(o);if(!a)continue;let l=null,c=/\/ToUnicode\s+(\d+)\s+\d+\s+R/.exec(a.dict);if(c){let d=e.get(Number(c[1])),f=d?Re(d):null;f&&(l=ti(f))}if(l||(l=si(a.dict,e)),!l)continue;let u=t.get(s)??[];u.push(l),t.set(s,u)}return t}var ri=["alef","bet","gimel","dalet","he","vav","zayin","het","tet","yod","finalkaf","kaf","lamed","finalmem","mem","finalnun","nun","samekh","ayin","finalpe","pe","finaltsadi","tsadi","qof","resh","shin","tav"];function ii(e){let t=/^uni([0-9A-Fa-f]{4})$/.exec(e)??/^u([0-9A-Fa-f]{4,6})$/.exec(e);if(t)return String.fromCodePoint(parseInt(t[1],16));let r=/^afii(\d{5})$/.exec(e);if(r){let s=Number(r[1]);if(s>=57664&&s<=57690)return String.fromCharCode(1488+(s-57664))}let n=ri.indexOf(e.replace(/hebrew$/,""));return n>=0?String.fromCharCode(1488+n):e==="space"?" ":/^[A-Za-z]$/.test(e)?e:{zero:"0",one:"1",two:"2",three:"3",four:"4",five:"5",six:"6",seven:"7",eight:"8",nine:"9",period:".",comma:",",hyphen:"-",colon:":",slash:"/",at:"@"}[e]??null}function si(e,t){let r=e,n=/\/Encoding\s+(\d+)\s+\d+\s+R/.exec(e);n&&(r=t.get(Number(n[1]))?.dict??"");let i=/\/Differences\s*\[([^\]]*)\]/.exec(r);if(!i?.[1])return null;let s=new Map,o=0;for(let a of i[1].match(/\d+|\/[^\s/[\]]+/g)??[]){if(/^\d+$/.test(a)){o=Number(a);continue}let l=ii(a.slice(1));l!==null&&s.set(o,l),o+=1}return s.size?{map:s,bytes:1}:null}function ln(e){let t=[];for(let r=0;r<e.length;r+=1){let n=e[r];if(n!=="\\"){t.push(n.charCodeAt(0)&255);continue}let i=e[r+1];if(i===void 0)break;if(i>="0"&&i<="7"){let o="",a=r+1;for(;a<e.length&&o.length<3&&e[a]>="0"&&e[a]<="7";)o+=e[a],a+=1;t.push(parseInt(o,8)&255),r=a-1;continue}let s={n:10,r:13,t:9,b:8,f:12};t.push(s[i]??i.charCodeAt(0)&255),r+=1}return t}function dn(e){if(e.length<2||e[0]!==254||e[1]!==255)return null;let t="";for(let r=2;r+1<e.length;r+=2)t+=String.fromCharCode((e[r]??0)<<8|(e[r+1]??0));return t}function sn(e,t){let r=dn(e);if(r!==null)return r;if(!t)return e.map(i=>String.fromCharCode(i)).join("");let n="";if(t.bytes===2)for(let i=0;i+1<e.length;i+=2){let s=(e[i]??0)<<8|(e[i+1]??0);n+=t.map.get(s)??""}else for(let i of e)n+=t.map.get(i)??String.fromCharCode(i);return n}function oi(e){let t=0;for(let r of e){let n=r.codePointAt(0)??0;/[\p{L}\p{N}]/u.test(r)?t+=1:(n<32||n>=127&&n<=191||n===65533)&&(t-=2)}return t}function on(e,t){if(!t||t.length<=1)return sn(e,t?.[0]);let r="",n=-1/0;for(let i of t){let s=sn(e,i),o=oi(s);o>n&&(r=s,n=o)}return r}function ai(e,t){let r="",n="",i,s=!1,o="",a=0,l=null,c=()=>{n.trim()&&(r+=n+`
4
- `),n="",a=0},u=()=>{n&&!n.endsWith(" ")&&a>1&&(n+=" ")},d=/\/([^\s/<>[\]()]+)\s+-?[\d.]+\s+Tf|(-?[\d.]+)\s+(-?[\d.]+)\s+T[dD]\b|(?:-?[\d.]+\s+){5}(-?[\d.]+)\s+Tm\b|T\*|\((?:\\.|[^\\)])*\)|<[0-9A-Fa-f\s]*>|\[|\]|-?\d+(?:\.\d+)?|TJ|Tj|'|"/g,f;for(;(f=d.exec(e))!==null;){let h=f[0];if(f[1]!==void 0&&h.endsWith("Tf")){i=t.get(f[1]);continue}if(f[2]!==void 0){Math.abs(Number(f[3]))>.01?c():Number(f[2])!==0&&u();continue}if(f[4]!==void 0){let m=Number(f[4]);l!==null&&Math.abs(m-l)>.01?c():l!==null&&u(),l=m;continue}if(h==="T*"){c();continue}if(h==="["){s=!0;continue}if(h==="]"){s=!1;continue}if(h==="TJ"||h==="Tj"||h==="'"||h==='"'){(h==="'"||h==='"')&&c(),o&&(n+=o,a=o.trim().length,o="");continue}if(h.startsWith("("))o+=on(ln(h.slice(1,-1)),i);else if(h.startsWith("<")){let m=h.slice(1,-1).replace(/\s+/g,""),g=[];for(let b=0;b+1<m.length;b+=2)g.push(parseInt(m.slice(b,b+2),16));o+=on(g,i)}else s&&Number(h)<-200&&o&&!o.endsWith(" ")&&(o+=" ")}return o&&(n+=o),c(),r}function ci(e,t){let r=e.toString("latin1"),n=/\/Info\s+(\d+)\s+\d+\s+R/.exec(r),i=n?t.get(Number(n[1]))?.dict:void 0;if(!i)return"";let s=[],o=/\/(Author|Title|Subject|Keywords|Creator|Producer)\s*(\((?:\\.|[^\\)])*\)|<[0-9A-Fa-f\s]*>)/g,a;for(;(a=o.exec(i))!==null;){let l=a[2]??"";if(l.startsWith("(")){let c=ln(l.slice(1,-1));s.push(dn(c)??c.map(u=>String.fromCharCode(u)).join(""))}else{let c=l.slice(1,-1).replace(/\s+/g,""),u="";if(c.toUpperCase().startsWith("FEFF"))for(let d=4;d+3<c.length+1;d+=4)u+=String.fromCharCode(parseInt(c.slice(d,d+4),16));else for(let d=0;d+1<c.length;d+=2)u+=String.fromCharCode(parseInt(c.slice(d,d+2),16));s.push(u)}}return s.join(`
5
- `)}var an="\u05DD\u05DF\u05E5\u05E3\u05DA";function Ce(e){let t=0,r=0;for(let n of e.match(/[\u05D0-\u05EA]{2,}/g)??[])an.includes(n[0])&&(t+=1),an.includes(n[n.length-1])&&(r+=1);return t>=3&&t>r*2}var li={"(":")",")":"(","[":"]","]":"[","<":">",">":"<","{":"}","}":"{"};function Pe(e){return/[\u05D0-\u05EA]/.test(e)?[...e].reverse().map(r=>li[r]??r).join("").replace(/[A-Za-z0-9](?:[A-Za-z0-9@._\-/:+]*[A-Za-z0-9])?/g,r=>[...r].reverse().join("")):e}function yt(e){if(!e.subarray(0,8).toString("latin1").startsWith("%PDF-")||e.toString("latin1",0,Math.min(e.length,4096)).includes("/Encrypt"))return null;let r=cn(e);if(r.size===0)return null;let n=ni(r),i=[];i.push(ci(e,r));let s=0,o=0,a=!1;for(let c of r.values()){if(!c.stream||!/\/Subtype\s*\/Form\b/.test(c.dict)&&/\/Subtype|\/Type\s*\/(XObject|Font|Metadata|ObjStm|XRef)|\/FontFile/.test(c.dict))continue;let d=Re(c);if(d===null||!/(TJ|Tj)\b/.test(d))continue;let f=ai(d,n);if(f.trim().length!==0){if(o+=1,s+f.length>rn){i.push(f.slice(0,Math.max(0,rn-s))),a=!0;break}i.push(f),s+=f.length}}if(o===0)return null;let l=i.slice(1).join(`
6
- `);return gt(l)?null:(Ce(l)&&(l=l.split(`
7
- `).map(Pe).join(`
8
- `)),{text:[i[0]??"",l].join(`
9
- `),truncated:a,streams:o})}function un(e){if(!e.subarray(0,8).toString("latin1").startsWith("%PDF-"))return"not a valid PDF";if(e.toString("latin1",0,Math.min(e.length,4096)).includes("/Encrypt"))return"encrypted (password or copy protection)";let r=cn(e),n=0,i=0,s=0;for(let o of r.values()){if(!o.stream)continue;if(/\/Subtype\s*\/Image\b/.test(o.dict)){i+=1;continue}let a=Re(o);if(a===null){/\/Type\s*\/(Font|Metadata|XRef)|\/FontFile|\/Length1/.test(o.dict)||(s+=1);continue}/(TJ|Tj)\b/.test(a)&&(n+=1)}return n===0&&i>0?"no text layer \u2014 a scanned image (needs OCR, which NoData does not do)":n===0&&s>0?"its pages are compressed in a way NoData cannot open":n===0?"no text in it":"its fonts have no usable letter map \u2014 the text decodes to symbols"}import{execFileSync as di}from"node:child_process";import{existsSync as ui,mkdtempSync as fi,readFileSync as pn,readdirSync as Ne,rmSync as pi,statSync as hi,writeFileSync as hn}from"node:fs";import{tmpdir as mi}from"node:os";import{delimiter as gi,join as T}from"node:path";var ee="install the free tools once (they run only on this computer): winget install oschwartz10612.Poppler and winget install UB-Mannheim.TesseractOCR (tick Hebrew in its installer)",Le=null;function fn(e){try{return hi(e).isFile()}catch{return!1}}function yi(){let e=[],t=[process.env.ProgramFiles,process.env["ProgramFiles(x86)"]].filter(Boolean),r=process.env.LOCALAPPDATA;for(let n of t)e.push(T(n,"Tesseract-OCR"));if(r){e.push(T(r,"Programs","Tesseract-OCR"),T(r,"Microsoft","WinGet","Links"));let n=T(r,"Microsoft","WinGet","Packages");try{for(let i of Ne(n))if(/^oschwartz10612\.Poppler/i.test(i))for(let s of Ne(T(n,i)))e.push(T(n,i,s,"Library","bin"))}catch{}}for(let n of t)try{for(let i of Ne(n))/^poppler/i.test(i)&&e.push(T(n,i,"Library","bin"),T(n,i,"bin"))}catch{}return e}function De(e,t){let r=process.env[t];if(r)return fn(r)?r:void 0;let n=process.platform==="win32",i=n?[`${e}.exe`,e]:[e],s=(process.env.PATH??"").split(gi).filter(Boolean);n&&s.push(...yi());for(let o of s)for(let a of i)if(fn(T(o,a)))return T(o,a)}function V(e,t,r){try{return di(e,t,{encoding:"utf8",timeout:r,maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"],windowsHide:!0})}catch{return null}}function te(){if(Le)return Le;if(/^(0|off|false|no)$/i.test(process.env.NODATA_PDF_TOOLS??""))return Le={ocrLangs:[],osd:!1};let e={pdftotext:De("pdftotext","NODATA_PDFTOTEXT"),pdftoppm:De("pdftoppm","NODATA_PDFTOPPM"),tesseract:De("tesseract","NODATA_TESSERACT"),ocrmypdf:De("ocrmypdf","NODATA_OCRMYPDF"),ocrLangs:[],osd:!1};if(e.tesseract){let t=new Set((V(e.tesseract,["--list-langs"],15e3)??"").split(/\r?\n/).map(r=>r.trim()));e.ocrLangs=["heb","eng"].filter(r=>t.has(r)),e.osd=t.has("osd")}return Le=e}function _t(e,t,r=".pdf"){let n=fi(T(mi(),"nd-read-"));try{let i=T(n,`in${r}`);return hn(i,e,{mode:384}),t(n,i)}finally{pi(n,{recursive:!0,force:!0})}}function xt(e){let t=e.replace(/[\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,"").replace(/\f/g,`
1
+ /*! @nodatachat/mcp 1.5.10 | Copyright 2026 Capsule Ltd. | FSL-1.1-ALv2 | see LICENSE.md */
2
+ import{appendFileSync as Go,copyFileSync as Uu,existsSync as Ur,mkdirSync as Br,readdirSync as Vo,readFileSync as zr,statSync as un,writeFileSync as Ko}from"node:fs";import{homedir as U}from"node:os";import{basename as at,extname as Wr,isAbsolute as K,join as me,relative as Gr,resolve as O}from"node:path";import{TextDecoder as ir}from"node:util";var D={text:[],header:[],secrets:[],table:null,amounts:null,severity:null};function mt(e){e.table&&(D.table=e.table),e.severity&&(D.severity=e.severity),e.amounts&&(D.amounts=e.amounts);for(let t of e.text??[])D.text.some(r=>r.kind===t.kind)||D.text.push(t);e.header&&!D.header.includes(e.header)&&D.header.push(e.header);for(let t of e.secrets??[])D.secrets.some(r=>r.id===t.id)||D.secrets.push(t)}function gt(){return D.amounts?.()===!0}function Ie(){return D.text}function _n(){return D.header}function be(){return D.table}function xn(){return D.secrets}var Te=[{id:"aws-access-key",name:"AWS Access Key",pattern:/(?:^|[^A-Z0-9])AKIA[A-Z2-7]{16}(?:[^A-Z2-7]|$)/,severity:"critical"},{id:"aws-secret-key",name:"AWS Secret Key",pattern:/(?:aws_secret_access_key|aws_secret_key|secret_access_key)\s*[=:]\s*['"]?[A-Za-z0-9/+=]{40}['"]?/,severity:"critical"},{id:"gcp-api-key",name:"GCP API Key",pattern:/AIza[0-9A-Za-z_-]{35}/,severity:"critical"},{id:"gcp-service-account",name:"GCP Service Account",pattern:/"type"\s*:\s*"service_account"/,severity:"critical"},{id:"github-token",name:"GitHub Token",pattern:/gh[pousr]_[0-9a-zA-Z]{36,}/,severity:"critical"},{id:"github-fine-grained",name:"GitHub Fine-Grained Token",pattern:/github_pat_[0-9a-zA-Z_]{22,}/,severity:"critical"},{id:"gitlab-token",name:"GitLab Token",pattern:/glpat-[0-9a-zA-Z_-]{20,}/,severity:"critical"},{id:"stripe-secret",name:"Stripe Secret Key",pattern:/sk_live_[0-9a-zA-Z]{24,}/,severity:"critical"},{id:"stripe-restricted",name:"Stripe Restricted Key",pattern:/rk_live_[0-9a-zA-Z]{24,}/,severity:"critical"},{id:"slack-token",name:"Slack Token",pattern:/xox[baprs]-[0-9a-zA-Z-]{10,}/,severity:"high"},{id:"slack-webhook",name:"Slack Webhook",pattern:/hooks\.slack\.com\/services\/T[0-9A-Z]{8,}\/B[0-9A-Z]{8,}\/[0-9a-zA-Z]{24}/,severity:"high"},{id:"twilio-api-key",name:"Twilio API Key",pattern:/SK[0-9a-fA-F]{32}/,severity:"high"},{id:"sendgrid-api-key",name:"SendGrid API Key",pattern:/SG\.[0-9a-zA-Z_-]{22}\.[0-9a-zA-Z_-]{43}/,severity:"critical"},{id:"postgres-uri",name:"PostgreSQL Connection String",pattern:/postgres(?:ql)?:\/\/[^\s'"]{10,}/,severity:"critical"},{id:"mongodb-uri",name:"MongoDB Connection String",pattern:/mongodb(?:\+srv)?:\/\/[^\s'"]{10,}/,severity:"critical"},{id:"redis-uri",name:"Redis Connection String",pattern:/redis(?:s)?:\/\/[^\s'"]{10,}/,severity:"high"},{id:"openai-key",name:"OpenAI API Key",pattern:/sk-[0-9a-zA-Z]{20,}T3BlbkFJ[0-9a-zA-Z]{20,}/,severity:"critical"},{id:"openai-project-key",name:"OpenAI API Key",pattern:/sk-(?:proj|svcacct|admin)-[0-9A-Za-z_-]{40,}/,severity:"critical"},{id:"anthropic-key",name:"Anthropic API Key",pattern:/sk-ant-[0-9a-zA-Z_-]{40,}/,severity:"critical"},{id:"firebase-key",name:"Firebase API Key",pattern:/AIza[0-9A-Za-z_-]{35}/,severity:"high"},{id:"supabase-key",name:"Supabase Service Key",pattern:/eyJ[0-9a-zA-Z_-]{100,}/,severity:"critical"},{id:"supabase-access-token",name:"Supabase Access Token",pattern:/\bsbp_[0-9a-f]{40}\b/,severity:"critical"},{id:"supabase-secret-key",name:"Supabase Secret Key",pattern:/\bsb_secret_[0-9A-Za-z_-]{20,}/,severity:"critical"},{id:"private-key",name:"Private Key",pattern:/-----BEGIN (?:RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----/,severity:"critical"},{id:"jwt-secret",name:"JWT/Generic Secret",pattern:/(?:jwt_secret|JWT_SECRET|secret_key|SECRET_KEY|api_secret|API_SECRET)\s*[=:]\s*['"][^'"]{8,}['"]/,severity:"high"},{id:"password-in-code",name:"Password in Code",pattern:/(?:password|passwd|pwd)\s*[=:]\s*['"][^'"]{8,}['"]/,severity:"high"},{id:"bearer-token",name:"Bearer Token in Code",pattern:/['"]Bearer\s+[0-9a-zA-Z._-]{20,}['"]/,severity:"high"}];function _e(){let e=xn().filter(t=>!Te.some(r=>r.id===t.id));return[...Te,...e]}var _i=[{pattern:/^(full_?name|first_?name|last_?name|spouse_?name|beneficiary_?name)$/i,type:"name",label:"Person name"},{pattern:/^(email|e_?mail|email_?address)$/i,type:"email",label:"Email address"},{pattern:/^(phone|mobile|telephone|phone_?number|cell_?phone)$/i,type:"phone",label:"Phone number"},{pattern:/^(id_?number|identity|ssn|social_?security|national_?id|teudat_?zehut)$/i,type:"id",label:"ID number"},{pattern:/^(address|street_?address|home_?address)$/i,type:"address",label:"Address"},{pattern:/^(date_?of_?birth|dob|birth_?date|birthday)$/i,type:"dob",label:"Date of birth"},{pattern:/^(bank_?account|iban|account_?number|bank_?details|routing_?number)$/i,type:"financial",label:"Bank account"},{pattern:/^(credit_?card|card_?number|cvv|cc_?number)$/i,type:"financial",label:"Credit card"},{pattern:/^(salary|income|commission|premium|compensation)$/i,type:"financial",label:"Salary / income"},{pattern:/^(medical_?info|health_?conditions|diagnosis|medication|prescription)$/i,type:"medical",label:"Medical"},{pattern:/^(passport|passport_?number|passport_?id)$/i,type:"id",label:"Passport"},{pattern:/^(driver_?license|drivers_?license|dl_?number)$/i,type:"id",label:"Driver license"},{pattern:/^(tax_?id|tin|vat_?number|ein)$/i,type:"financial",label:"Tax ID"},{pattern:/^(insurance_?number|policy_?number|member_?id)$/i,type:"id",label:"Insurance/Policy"},{pattern:/^(biometric|fingerprint|face_?id|retina)$/i,type:"biometric",label:"Biometric"},{pattern:/^(latitude|longitude|lat|lng|geo_?location|coordinates)$/i,type:"location",label:"Geolocation"}],xi=[{pattern:/^(?:שם|שם_מלא|שם פרטי|שם_פרטי|שם משפחה|שם_משפחה|שם הלקוח|שם בן זוג|שם המבוטח|שם המוטב|שם הילד|שם הקטין)$/i,type:"name",label:"\u05E9\u05DD \u05D0\u05D3\u05DD"},{pattern:/^(?:ת"ז|ת\.ז|ת ז|תז|תעודת זהות|תעודת_זהות|מספר זהות|מס' זהות|teudat_zehut|tz|israeli_id|il_id)$/i,type:"id",label:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA"},{pattern:/^(?:דרכון|מספר דרכון|רישיון נהיגה|רישיון_נהיגה|רשיון נהיגה)$/i,type:"id",label:"\u05D3\u05E8\u05DB\u05D5\u05DF/\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF"},{pattern:/^(?:מייל|דוא"ל|דוא_ל|דואר אלקטרוני|אימייל|כתובת מייל)$/i,type:"email",label:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9"},{pattern:/^(?:טלפון|טל'|נייד|פלאפון|סלולרי|מספר טלפון|טלפון נייד)$/i,type:"phone",label:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF"},{pattern:/^(?:כתובת|כתובת מגורים|רחוב|מס בית|עיר|ישוב|יישוב|מיקוד|כתובת מלאה|מען)$/i,type:"address",label:"\u05DB\u05EA\u05D5\u05D1\u05EA"},{pattern:/^(?:תאריך לידה|ת לידה|תאריך הולדת|יום הולדת|גיל)$/i,type:"dob",label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"},{pattern:/^(?:חשבון בנק|מספר חשבון|מס חשבון|סניף|iban|iban_il)$/i,type:"financial",label:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7"},{pattern:/^(?:כרטיס אשראי|מספר אשראי|cvv|אשראי)$/i,type:"financial",label:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"},{pattern:/^(?:שכר|משכורת|הכנסה|פרמיה|שכר ברוטו|שכר נטו|תגמול|בונוס|פיצוי)$/i,type:"financial",label:"\u05E9\u05DB\u05E8/\u05D4\u05DB\u05E0\u05E1\u05D4"},{pattern:/^(?:אבחון|אבחנה|מחלה|תרופה|מרשם|בדיקה רפואית|מצב רפואי|חיסון|רגישות|אלרגיה|סוג דם)$/i,type:"medical",label:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(?:מספר פוליסה|מס פוליסה|פוליסה|מספר חבר|מספר ביטוח)$/i,type:"id",label:"\u05E4\u05D5\u05DC\u05D9\u05E1\u05D4/\u05D7\u05D1\u05E8\u05D5\u05EA"},{pattern:/^(?:שם הילד|תעודת זהות של ילד|ילדים|קטין|מספר ילדים|תעודת לידה)$/i,type:"minor_data",label:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF"},{pattern:/^(?:דת|לאום|מין|נטייה מינית|השקפה פוליטית|מצב משפחתי|עדה|מוצא)$/i,type:"sensitive_personal",label:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9"},{pattern:/^(?:מספר רכב|מס רכב|לוחית רישוי|מספר רישוי)$/i,type:"tracking",label:"\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"}],ki=/^(id|uuid|created_?at|updated_?at|deleted_?at|status|type|category|description|title|slug|url|path|key|value|enabled|active|public|version|metadata|config|settings|data|content|note|comment|label|color|icon)$/i,wi=/^שם[ _](?:ה)?(?:קובץ|מוצר|פריט|חברה|ארגון|עסק|פרויקט|גיליון|טבלה|שדה|קטגוריה|סניף|בנק|עיר|רחוב|ישוב|יישוב|מסמך|תוכנית|חבילה|קורס|מחלקה|אתר|דומיין|מותג|ספק|שירות|תפקיד)$|^(file|product|item|company|org|organization|project|sheet|table|field|category|branch|bank|city|street|document|plan|course|department|site|domain|brand|vendor|service|role)[ _-]?name$/i;function xe(e){if(!e)return null;let t=e.trim();if(ki.test(t)||/^name$/i.test(t)||/^\[[A-Z_]+(?:-\d+)?\]$/.test(t))return null;let r=t.replace(/[\s-]+/g,"_");for(let n of[...xi,..._i])if(n.pattern.test(t)||n.pattern.test(r))return{type:n.type,label:n.label};if(wi.test(t))return null;if(/^שם[ _][\u0590-\u05FF"'׳ ]{2,20}$/.test(t))return{type:"name",label:"\u05E9\u05DD \u05D0\u05D3\u05DD"};if(/^(customer|client|employee|inspector|supervisor|contact|person|patient|user|owner|manager|agent|member|driver|tenant|student|parent|beneficiary|insured)_?(full_?)?name$/i.test(r))return{type:"name",label:"Person name"};for(let n of _n()){let i=n(t);if(i)return{type:i.type,label:i.label}}return null}function kn(e){let t=String(e??"").replace(/\D/g,"");if(t.length===0||t.length>9)return!1;let r=t.padStart(9,"0"),n=0;for(let i=0;i<9;i++){let s=parseInt(r[i]??"0",10)*(i%2+1);s>9&&(s-=9),n+=s}return n%10===0&&parseInt(r,10)>0}function vi(e){let t=String(e??"").replace(/\D/g,"");if(t.length<12||t.length>19)return!1;let r=0,n=!1;for(let i=t.length-1;i>=0;i-=1){let s=parseInt(t[i]??"0",10);n&&(s*=2,s>9&&(s-=9)),r+=s,n=!n}return r%10===0}function Si(e){let t=String(e??"").replace(/\s/g,"").toUpperCase();if(!/^[A-Z]{2}\d{2}[A-Z0-9]{10,30}$/.test(t))return!1;let r=t.slice(4)+t.slice(0,4),n=0;for(let i of r){let s=i>="A"&&i<="Z"?String(i.charCodeAt(0)-55):i;for(let o of s)n=(n*10+Number(o))%97}return n===1}var yt="(?<!\\d)(?<!\\d[.,])",bt="(?!\\d)(?![.,]\\d)",_t=[{subkind:"israeli_id",severity:"high",pattern:new RegExp(`${yt}\\d{9}${bt}`,"g"),validate:kn,hint:"Israeli national ID (check digit verified) in plaintext. Encrypt the column or mask it at rest."},{subkind:"credit_card",severity:"critical",pattern:new RegExp(`${yt}[2-6][ -]?(?:\\d[ -]?){11,17}\\d${bt}`,"g"),validate:vi,hint:"Payment card number (Luhn verified) in plaintext. This is PCI scope."},{subkind:"iban",severity:"high",pattern:/\b[A-Z]{2}\d{2}(?: ?[A-Z0-9]{4}){2,7}(?: ?[A-Z0-9]{1,4})?\b/g,validate:Si,hint:"Bank account in IBAN form (mod-97 verified) in plaintext."},{subkind:"israeli_phone",severity:"medium",pattern:new RegExp(`${yt}(?:\\+972[- ]?|0)(?:[57]\\d|[2-489])[- ]?\\d{3}[- ]?\\d{4}${bt}`,"g"),validate:e=>{let t=e.replace(/\D/g,"").replace(/^972/,"0");return/^0[57]\d{8}$/.test(t)?!0:/^0[2-489]\d{7}$/.test(t)&&(/[- ]/.test(e)||e.startsWith("+972"))},hint:"Israeli phone number in plaintext."}];function Re(e,t){let r=[],n="",i=!1;for(let s=0;s<e.length;s++){let o=e[s];i?o==='"'&&e[s+1]==='"'?(n+='"',s++):o==='"'?i=!1:n+=o:o==='"'?i=!0:o===t?(r.push(n),n=""):n+=o}return r.push(n),r}import{inflateRawSync as ss}from"node:zlib";import{inflateSync as Ei}from"node:zlib";var Ce=new Set([".pdf"]),wn=8*1024*1024;function An(e){let t=e.toString("latin1"),r=new Map,n=/(\d+)\s+(\d+)\s+obj\b/g,i;for(;(i=n.exec(t))!==null;){let s=Number(i[1]),o=n.lastIndex,a=t.indexOf("endobj",o);if(a<0)continue;let c=t.indexOf("stream",o),l,u=null;if(c>=0&&c<a){l=t.slice(o,c);let d=c+6;t[d]==="\r"&&(d+=1),t[d]===`
3
+ `&&(d+=1);let f=t.indexOf("endstream",d);f>d&&(u=e.subarray(d,f))}else l=t.slice(o,a);r.set(s,{num:s,dict:l,stream:u})}for(let s of[...r.values()]){if(!s.stream||!/\/Type\s*\/ObjStm\b/.test(s.dict))continue;let o=Pe(s),a=Number(/\/N\s+(\d+)/.exec(s.dict)?.[1]??0),c=Number(/\/First\s+(\d+)/.exec(s.dict)?.[1]??-1);if(o===null||!a||c<0)continue;let l=o.slice(0,c).trim().split(/\s+/).map(Number);for(let u=0;u<a;u+=1){let d=l[2*u],f=l[2*u+1];if(d===void 0||f===void 0||Number.isNaN(d)||Number.isNaN(f))break;let m=u+1<a?l[2*(u+1)+1]:void 0,g=o.slice(c+f,m!==void 0?c+m:void 0);r.has(d)||r.set(d,{num:d,dict:g,stream:null})}}return r}function xt(e){let t=[...e.replace(/\s+/g,"")];if(t.length<40)return!1;let r=0,n=0;for(let i of t){let s=i.codePointAt(0)??0;s<32||s>=127&&s<=191||s===65533||s>=57344&&s<=63743?r+=1:/[\p{L}\p{N}]/u.test(i)&&(n+=1)}return r/t.length>.2||n/t.length<.25}function Ai(e){let t=e.toString("latin1").replace(/\s/g,"");t.startsWith("<~")&&(t=t.slice(2));let r=t.indexOf("~>");r>=0&&(t=t.slice(0,r));let n=[],i=0,s=0;for(let o of t){if(o==="z"&&s===0){n.push(0,0,0,0);continue}let a=o.charCodeAt(0)-33;if(a<0||a>84)return null;i=i*85+a,s+=1,s===5&&(n.push(i>>>24&255,i>>>16&255,i>>>8&255,i&255),i=0,s=0)}if(s>0){for(let a=s;a<5;a+=1)i=i*85+84;let o=[i>>>24&255,i>>>16&255,i>>>8&255,i&255];for(let a=0;a<s-1;a+=1)n.push(o[a]??0)}return Buffer.from(n)}function $i(e){let t=e.toString("latin1").replace(/\s/g,"").split(">")[0]??"",r=t.length%2?t+"0":t;return/^[0-9A-Fa-f]*$/.test(r)?Buffer.from(r,"hex"):null}function Ii(e){let t=/\/Filter\s*(\[[^\]]*\]|\/\w+)/.exec(e);return!t||!t[1]?[]:[...t[1].matchAll(/\/(\w+)/g)].map(r=>r[1]??"")}function Pe(e){if(!e.stream)return null;let t=e.stream;for(let r of Ii(e.dict)){let n=null;if(r==="FlateDecode")try{n=Ei(t)}catch{return null}else if(r==="ASCII85Decode")n=Ai(t);else if(r==="ASCIIHexDecode")n=$i(t);else return null;if(n===null)return null;t=n}return t.toString("latin1")}function Ti(e){let t=new Map,r=1,n=/begincodespacerange([\s\S]*?)endcodespacerange/.exec(e);if(n&&n[1]){let c=/<([0-9A-Fa-f]+)>/.exec(n[1]);c&&c[1]&&c[1].length>=4&&(r=2)}let i=c=>{let l="";for(let u=0;u+3<c.length+1;u+=4){let d=parseInt(c.slice(u,u+4),16);Number.isFinite(d)&&d>0&&(l+=String.fromCharCode(d))}return l},s=/beginbfchar([\s\S]*?)endbfchar/g,o;for(;(o=s.exec(e))!==null;){let c=/<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]*)>/g,l;for(;(l=c.exec(o[1]??""))!==null;)t.set(parseInt(l[1]??"0",16),i(l[2]??""))}let a=/beginbfrange([\s\S]*?)endbfrange/g;for(;(o=a.exec(e))!==null;){let c=o[1]??"",l=/<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]*)>/g,u;for(;(u=l.exec(c))!==null;){let d=parseInt(u[1]??"0",16),f=parseInt(u[2]??"0",16),m=parseInt((u[3]??"0").slice(0,4)||"0",16);if(!(f-d>65535))for(let g=d;g<=f;g+=1)t.set(g,String.fromCharCode(m+(g-d)))}}return{map:t,bytes:r}}function Ri(e){let t=new Map,r=[],n=[];for(let s of e.values()){for(let o of s.dict.matchAll(/\/Font\s*<<([\s\S]*?)>>/g))o[1]&&n.push(o[1]);for(let o of s.dict.matchAll(/\/Font\s+(\d+)\s+\d+\s+R/g)){let a=e.get(Number(o[1]));a&&n.push(a.dict)}}let i=new Set;for(let s of n){let o=/\/([^\s/<>[\]()]+)\s+(\d+)\s+\d+\s+R/g,a;for(;(a=o.exec(s))!==null;){let c=`${a[1]}#${a[2]}`;i.has(c)||(i.add(c),r.push([a[1]??"",Number(a[2])]))}}for(let[s,o]of r){let a=e.get(o);if(!a)continue;let c=null,l=/\/ToUnicode\s+(\d+)\s+\d+\s+R/.exec(a.dict);if(l){let d=e.get(Number(l[1])),f=d?Pe(d):null;f&&(c=Ti(f))}if(c||(c=Li(a.dict,e)),!c)continue;let u=t.get(s)??[];u.push(c),t.set(s,u)}return t}var Ci=["alef","bet","gimel","dalet","he","vav","zayin","het","tet","yod","finalkaf","kaf","lamed","finalmem","mem","finalnun","nun","samekh","ayin","finalpe","pe","finaltsadi","tsadi","qof","resh","shin","tav"];function Pi(e){let t=/^uni([0-9A-Fa-f]{4})$/.exec(e)??/^u([0-9A-Fa-f]{4,6})$/.exec(e);if(t)return String.fromCodePoint(parseInt(t[1],16));let r=/^afii(\d{5})$/.exec(e);if(r){let s=Number(r[1]);if(s>=57664&&s<=57690)return String.fromCharCode(1488+(s-57664))}let n=Ci.indexOf(e.replace(/hebrew$/,""));return n>=0?String.fromCharCode(1488+n):e==="space"?" ":/^[A-Za-z]$/.test(e)?e:{zero:"0",one:"1",two:"2",three:"3",four:"4",five:"5",six:"6",seven:"7",eight:"8",nine:"9",period:".",comma:",",hyphen:"-",colon:":",slash:"/",at:"@"}[e]??null}function Li(e,t){let r=e,n=/\/Encoding\s+(\d+)\s+\d+\s+R/.exec(e);n&&(r=t.get(Number(n[1]))?.dict??"");let i=/\/Differences\s*\[([^\]]*)\]/.exec(r);if(!i?.[1])return null;let s=new Map,o=0;for(let a of i[1].match(/\d+|\/[^\s/[\]]+/g)??[]){if(/^\d+$/.test(a)){o=Number(a);continue}let c=Pi(a.slice(1));c!==null&&s.set(o,c),o+=1}return s.size?{map:s,bytes:1}:null}function $n(e){let t=[];for(let r=0;r<e.length;r+=1){let n=e[r];if(n!=="\\"){t.push(n.charCodeAt(0)&255);continue}let i=e[r+1];if(i===void 0)break;if(i>="0"&&i<="7"){let o="",a=r+1;for(;a<e.length&&o.length<3&&e[a]>="0"&&e[a]<="7";)o+=e[a],a+=1;t.push(parseInt(o,8)&255),r=a-1;continue}let s={n:10,r:13,t:9,b:8,f:12};t.push(s[i]??i.charCodeAt(0)&255),r+=1}return t}function In(e){if(e.length<2||e[0]!==254||e[1]!==255)return null;let t="";for(let r=2;r+1<e.length;r+=2)t+=String.fromCharCode((e[r]??0)<<8|(e[r+1]??0));return t}function vn(e,t){let r=In(e);if(r!==null)return r;if(!t)return e.map(i=>String.fromCharCode(i)).join("");let n="";if(t.bytes===2)for(let i=0;i+1<e.length;i+=2){let s=(e[i]??0)<<8|(e[i+1]??0);n+=t.map.get(s)??""}else for(let i of e)n+=t.map.get(i)??String.fromCharCode(i);return n}function Oi(e){let t=0;for(let r of e){let n=r.codePointAt(0)??0;/[\p{L}\p{N}]/u.test(r)?t+=1:(n<32||n>=127&&n<=191||n===65533)&&(t-=2)}return t}function Sn(e,t){if(!t||t.length<=1)return vn(e,t?.[0]);let r="",n=-1/0;for(let i of t){let s=vn(e,i),o=Oi(s);o>n&&(r=s,n=o)}return r}function Di(e,t){let r="",n="",i,s=!1,o="",a=0,c=null,l=()=>{n.trim()&&(r+=n+`
4
+ `),n="",a=0},u=()=>{n&&!n.endsWith(" ")&&a>1&&(n+=" ")},d=/\/([^\s/<>[\]()]+)\s+-?[\d.]+\s+Tf|(-?[\d.]+)\s+(-?[\d.]+)\s+T[dD]\b|(?:-?[\d.]+\s+){5}(-?[\d.]+)\s+Tm\b|T\*|\((?:\\.|[^\\)])*\)|<[0-9A-Fa-f\s]*>|\[|\]|-?\d+(?:\.\d+)?|TJ|Tj|'|"/g,f;for(;(f=d.exec(e))!==null;){let m=f[0];if(f[1]!==void 0&&m.endsWith("Tf")){i=t.get(f[1]);continue}if(f[2]!==void 0){Math.abs(Number(f[3]))>.01?l():Number(f[2])!==0&&u();continue}if(f[4]!==void 0){let g=Number(f[4]);c!==null&&Math.abs(g-c)>.01?l():c!==null&&u(),c=g;continue}if(m==="T*"){l();continue}if(m==="["){s=!0;continue}if(m==="]"){s=!1;continue}if(m==="TJ"||m==="Tj"||m==="'"||m==='"'){(m==="'"||m==='"')&&l(),o&&(n+=o,a=o.trim().length,o="");continue}if(m.startsWith("("))o+=Sn($n(m.slice(1,-1)),i);else if(m.startsWith("<")){let g=m.slice(1,-1).replace(/\s+/g,""),h=[];for(let _=0;_+1<g.length;_+=2)h.push(parseInt(g.slice(_,_+2),16));o+=Sn(h,i)}else s&&Number(m)<-200&&o&&!o.endsWith(" ")&&(o+=" ")}return o&&(n+=o),l(),r}function Ni(e,t){let r=e.toString("latin1"),n=/\/Info\s+(\d+)\s+\d+\s+R/.exec(r),i=n?t.get(Number(n[1]))?.dict:void 0;if(!i)return"";let s=[],o=/\/(Author|Title|Subject|Keywords|Creator|Producer)\s*(\((?:\\.|[^\\)])*\)|<[0-9A-Fa-f\s]*>)/g,a;for(;(a=o.exec(i))!==null;){let c=a[2]??"";if(c.startsWith("(")){let l=$n(c.slice(1,-1));s.push(In(l)??l.map(u=>String.fromCharCode(u)).join(""))}else{let l=c.slice(1,-1).replace(/\s+/g,""),u="";if(l.toUpperCase().startsWith("FEFF"))for(let d=4;d+3<l.length+1;d+=4)u+=String.fromCharCode(parseInt(l.slice(d,d+4),16));else for(let d=0;d+1<l.length;d+=2)u+=String.fromCharCode(parseInt(l.slice(d,d+2),16));s.push(u)}}return s.join(`
5
+ `)}var En="\u05DD\u05DF\u05E5\u05E3\u05DA";function Le(e){let t=0,r=0;for(let n of e.match(/[\u05D0-\u05EA]{2,}/g)??[])En.includes(n[0])&&(t+=1),En.includes(n[n.length-1])&&(r+=1);return t>=3&&t>r*2}var Fi={"(":")",")":"(","[":"]","]":"[","<":">",">":"<","{":"}","}":"{"};function Oe(e){return/[\u05D0-\u05EA]/.test(e)?[...e].reverse().map(r=>Fi[r]??r).join("").replace(/[A-Za-z0-9](?:[A-Za-z0-9@._\-/:+]*[A-Za-z0-9])?/g,r=>[...r].reverse().join("")):e}function kt(e){if(!e.subarray(0,8).toString("latin1").startsWith("%PDF-")||e.toString("latin1",0,Math.min(e.length,4096)).includes("/Encrypt"))return null;let r=An(e);if(r.size===0)return null;let n=Ri(r),i=[];i.push(Ni(e,r));let s=0,o=0,a=!1;for(let l of r.values()){if(!l.stream||!/\/Subtype\s*\/Form\b/.test(l.dict)&&/\/Subtype|\/Type\s*\/(XObject|Font|Metadata|ObjStm|XRef)|\/FontFile/.test(l.dict))continue;let d=Pe(l);if(d===null||!/(TJ|Tj)\b/.test(d))continue;let f=Di(d,n);if(f.trim().length!==0){if(o+=1,s+f.length>wn){i.push(f.slice(0,Math.max(0,wn-s))),a=!0;break}i.push(f),s+=f.length}}if(o===0)return null;let c=i.slice(1).join(`
6
+ `);return xt(c)?null:(Le(c)&&(c=c.split(`
7
+ `).map(Oe).join(`
8
+ `)),{text:[i[0]??"",c].join(`
9
+ `),truncated:a,streams:o})}function Tn(e){if(!e.subarray(0,8).toString("latin1").startsWith("%PDF-"))return"not a valid PDF";if(e.toString("latin1",0,Math.min(e.length,4096)).includes("/Encrypt"))return"encrypted (password or copy protection)";let r=An(e),n=0,i=0,s=0;for(let o of r.values()){if(!o.stream)continue;if(/\/Subtype\s*\/Image\b/.test(o.dict)){i+=1;continue}let a=Pe(o);if(a===null){/\/Type\s*\/(Font|Metadata|XRef)|\/FontFile|\/Length1/.test(o.dict)||(s+=1);continue}/(TJ|Tj)\b/.test(a)&&(n+=1)}return n===0&&i>0?"no text layer \u2014 a scanned image (needs OCR, which NoData does not do)":n===0&&s>0?"its pages are compressed in a way NoData cannot open":n===0?"no text in it":"its fonts have no usable letter map \u2014 the text decodes to symbols"}import{execFileSync as ji}from"node:child_process";import{existsSync as Mi,mkdtempSync as Hi,readFileSync as Cn,readdirSync as Fe,rmSync as Ui,statSync as Bi,writeFileSync as Pn}from"node:fs";import{tmpdir as zi}from"node:os";import{delimiter as Wi,join as L}from"node:path";var ie="install the free tools once (they run only on this computer): winget install oschwartz10612.Poppler and winget install UB-Mannheim.TesseractOCR (tick Hebrew in its installer)",De=null;function Rn(e){try{return Bi(e).isFile()}catch{return!1}}function Gi(){let e=[],t=[process.env.ProgramFiles,process.env["ProgramFiles(x86)"]].filter(Boolean),r=process.env.LOCALAPPDATA;for(let n of t)e.push(L(n,"Tesseract-OCR"));if(r){e.push(L(r,"Programs","Tesseract-OCR"),L(r,"Microsoft","WinGet","Links"));let n=L(r,"Microsoft","WinGet","Packages");try{for(let i of Fe(n))if(/^oschwartz10612\.Poppler/i.test(i))for(let s of Fe(L(n,i)))e.push(L(n,i,s,"Library","bin"))}catch{}}for(let n of t)try{for(let i of Fe(n))/^poppler/i.test(i)&&e.push(L(n,i,"Library","bin"),L(n,i,"bin"))}catch{}return e}function Ne(e,t){let r=process.env[t];if(r)return Rn(r)?r:void 0;let n=process.platform==="win32",i=n?[`${e}.exe`,e]:[e],s=(process.env.PATH??"").split(Wi).filter(Boolean);n&&s.push(...Gi());for(let o of s)for(let a of i)if(Rn(L(o,a)))return L(o,a)}function X(e,t,r){try{return ji(e,t,{encoding:"utf8",timeout:r,maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"],windowsHide:!0})}catch{return null}}function se(){if(De)return De;if(/^(0|off|false|no)$/i.test(process.env.NODATA_PDF_TOOLS??""))return De={ocrLangs:[],osd:!1};let e={pdftotext:Ne("pdftotext","NODATA_PDFTOTEXT"),pdftoppm:Ne("pdftoppm","NODATA_PDFTOPPM"),tesseract:Ne("tesseract","NODATA_TESSERACT"),ocrmypdf:Ne("ocrmypdf","NODATA_OCRMYPDF"),ocrLangs:[],osd:!1};if(e.tesseract){let t=new Set((X(e.tesseract,["--list-langs"],15e3)??"").split(/\r?\n/).map(r=>r.trim()));e.ocrLangs=["heb","eng"].filter(r=>t.has(r)),e.osd=t.has("osd")}return De=e}function vt(e,t,r=".pdf"){let n=Hi(L(zi(),"nd-read-"));try{let i=L(n,`in${r}`);return Pn(i,e,{mode:384}),t(n,i)}finally{Ui(n,{recursive:!0,force:!0})}}function St(e){let t=e.replace(/[\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,"").replace(/\f/g,`
10
10
  `).replace(/[ \t]+\n/g,`
11
- `).trim();return t.replace(/\s/g,"").length<2||gt(t)?null:Ce(t)?t.split(`
12
- `).map(Pe).join(`
13
- `):t}function mn(e){let t=te().pdftotext;if(!t)return null;let r=_t(e,(n,i)=>V(t,["-enc","UTF-8","-q",i,"-"],6e4));return r===null?null:xt(r)}var bi=()=>Math.max(1,Number(process.env.NODATA_OCR_MAX_PAGES)||10);function gn(e){let t=e.toString("latin1",0,64).match(/^P5\s+(\d+)\s+(\d+)\s+255\s/);return t?{w:Number(t[1]),h:Number(t[2]),at:t[0].length}:null}function _i(e,t){let r=gn(e);if(!r)return null;let{w:n,h:i,at:s}=r,o=e.subarray(s),[a,l]=t===180?[n,i]:[i,n],c=Buffer.alloc(a*l);for(let u=0;u<i;u++)for(let d=0;d<n;d++){let f=o[u*n+d];t===180?c[(i-1-u)*n+(n-1-d)]=f:t===90?c[d*a+(i-1-u)]=f:c[(n-1-d)*a+u]=f}return Buffer.concat([Buffer.from(`P5
14
- ${a} ${l}
11
+ `).trim();return t.replace(/\s/g,"").length<2||xt(t)?null:Le(t)?t.split(`
12
+ `).map(Oe).join(`
13
+ `):t}function Ln(e){let t=se().pdftotext;if(!t)return null;let r=vt(e,(n,i)=>X(t,["-enc","UTF-8","-q",i,"-"],6e4));return r===null?null:St(r)}var Vi=()=>Math.max(1,Number(process.env.NODATA_OCR_MAX_PAGES)||10);function On(e){let t=e.toString("latin1",0,64).match(/^P5\s+(\d+)\s+(\d+)\s+255\s/);return t?{w:Number(t[1]),h:Number(t[2]),at:t[0].length}:null}function Ki(e,t){let r=On(e);if(!r)return null;let{w:n,h:i,at:s}=r,o=e.subarray(s),[a,c]=t===180?[n,i]:[i,n],l=Buffer.alloc(a*c);for(let u=0;u<i;u++)for(let d=0;d<n;d++){let f=o[u*n+d];t===180?l[(i-1-u)*n+(n-1-d)]=f:t===90?l[d*a+(i-1-u)]=f:l[(n-1-d)*a+u]=f}return Buffer.concat([Buffer.from(`P5
14
+ ${a} ${c}
15
15
  255
16
- `,"latin1"),c])}function yn(e,t){if(!e.osd)return;let r=V(e.tesseract,[t,"-","--psm","0"],6e4)??"",n=Number(r.match(/Rotate:\s*(\d+)/)?.[1]??0),i=Number(r.match(/Orientation confidence:\s*([\d.]+)/)?.[1]??0);if(!(n===90||n===180||n===270)||i<2)return;let s=_i(pn(t),n);s&&hn(t,s,{mode:384})}function xi(e,t,r){if(!e.ocrmypdf||e.ocrLangs.length===0)return null;let n=T(t,"side.txt");return V(e.ocrmypdf,["-q","-l",e.ocrLangs.join("+"),"--rotate-pages","--deskew","--force-ocr","--sidecar",n,r,T(t,"out.pdf")],3e5),ui(n)?xt(pn(n,"utf8")):null}function ki(e){let t=te();if(!t.pdftoppm||!t.tesseract||t.ocrLangs.length===0)return null;let r=bi();return _t(e,(n,i)=>{if(V(t.pdftoppm,["-r","300","-gray","-f","1","-l",String(r+1),i,T(n,"p")],12e4)===null)return null;let s=Ne(n).filter(c=>/^p-\d+\.pgm$/.test(c)).sort((c,u)=>Number(c.match(/\d+/)[0])-Number(u.match(/\d+/)[0])),o=s.length>r,a=[];for(let c of s.slice(0,r)){yn(t,T(n,c));let u=V(t.tesseract,[T(n,c),"stdout","-l",t.ocrLangs.join("+"),"--psm","3"],12e4);u&&a.push(u)}let l=xt(a.join(`
17
- `))??xi(t,n,i);return l===null?null:{text:l,truncated:o,pages:Math.min(s.length,r)}})}function bt(e){return new Set(e.match(/[\p{L}\p{N}]{2,}/gu)??[])}function Oe(e,t={}){let r=yt(e),n=mn(e);if(r){if(n===null)return{...r,engine:"builtin",uncertain:!1};let s=bt(r.text),o=n.split(`
18
- `).filter(u=>[...bt(u)].some(d=>!s.has(d))),a=bt(n),l=[...a].filter(u=>!s.has(u)),c=l.length>Math.max(3,a.size*.1)||l.some(u=>/^\d{5,}$/.test(u));return o.length===0?{...r,engine:"builtin",uncertain:!1}:{...r,text:r.text+`
16
+ `,"latin1"),l])}function Dn(e,t){if(!e.osd)return;let r=X(e.tesseract,[t,"-","--psm","0"],6e4)??"",n=Number(r.match(/Rotate:\s*(\d+)/)?.[1]??0),i=Number(r.match(/Orientation confidence:\s*([\d.]+)/)?.[1]??0);if(!(n===90||n===180||n===270)||i<2)return;let s=Ki(Cn(t),n);s&&Pn(t,s,{mode:384})}function Zi(e,t,r){if(!e.ocrmypdf||e.ocrLangs.length===0)return null;let n=L(t,"side.txt");return X(e.ocrmypdf,["-q","-l",e.ocrLangs.join("+"),"--rotate-pages","--deskew","--force-ocr","--sidecar",n,r,L(t,"out.pdf")],3e5),Mi(n)?St(Cn(n,"utf8")):null}function Xi(e){let t=se();if(!t.pdftoppm||!t.tesseract||t.ocrLangs.length===0)return null;let r=Vi();return vt(e,(n,i)=>{if(X(t.pdftoppm,["-r","300","-gray","-f","1","-l",String(r+1),i,L(n,"p")],12e4)===null)return null;let s=Fe(n).filter(l=>/^p-\d+\.pgm$/.test(l)).sort((l,u)=>Number(l.match(/\d+/)[0])-Number(u.match(/\d+/)[0])),o=s.length>r,a=[];for(let l of s.slice(0,r)){Dn(t,L(n,l));let u=X(t.tesseract,[L(n,l),"stdout","-l",t.ocrLangs.join("+"),"--psm","3"],12e4);u&&a.push(u)}let c=St(a.join(`
17
+ `))??Zi(t,n,i);return c===null?null:{text:c,truncated:o,pages:Math.min(s.length,r)}})}function wt(e){return new Set(e.match(/[\p{L}\p{N}]{2,}/gu)??[])}function je(e,t={}){let r=kt(e),n=Ln(e);if(r){if(n===null)return{...r,engine:"builtin",uncertain:!1};let s=wt(r.text),o=n.split(`
18
+ `).filter(u=>[...wt(u)].some(d=>!s.has(d))),a=wt(n),c=[...a].filter(u=>!s.has(u)),l=c.length>Math.max(3,a.size*.1)||c.some(u=>/^\d{5,}$/.test(u));return o.length===0?{...r,engine:"builtin",uncertain:!1}:{...r,text:r.text+`
19
19
  `+o.join(`
20
- `),engine:"builtin",uncertain:c}}if(!e.subarray(0,8).toString("latin1").startsWith("%PDF-"))return null;if(n!==null)return{text:n,truncated:!1,streams:0,engine:"pdftotext",uncertain:!1};if(!t.ocr)return null;let i=ki(e);return i?{text:i.text,truncated:i.truncated,streams:0,engine:"ocr",uncertain:!1}:null}function bn(e){let t=un(e),r=te();return/scanned image/.test(t)?r.tesseract&&r.pdftoppm&&r.ocrLangs.length?"no text layer \u2014 a scanned image; the folder scan reads it with OCR on this computer, the read gate does not wait for OCR":`no text layer \u2014 a scanned image. To read it: ${ee}`:/encrypted/.test(t)?t+(r.pdftotext?"":` \u2014 if it opens without a password, the second reader can read it: ${ee}`):/letter map|compressed/.test(t)&&!r.pdftotext?`${t}. A second reader may read it: ${ee}`:/letter map|compressed/.test(t)?`${t} (the second reader, pdftotext, could not read it either)`:t}var _n=[208,207,17,224,161,177,26,225],kt=4294967294,Fe=4294967295,wi=64*1024*1024;function _e(e){if(e.length<512)return!1;for(let t=0;t<_n.length;t+=1)if(e[t]!==_n[t])return!1;return!0}function wt(e){if(!_e(e))return null;try{let t=e.readUInt16LE(30),r=e.readUInt16LE(32);if(t!==9&&t!==12)return null;let n=1<<t,i=1<<r,s=e.readUInt32LE(44),o=e.readUInt32LE(48),a=e.readUInt32LE(56),l=e.readUInt32LE(60),c=e.readUInt32LE(68),u=e.readUInt32LE(72),d=Math.floor((e.length-n)/n)+1,f=y=>{let _=(y+1)*n;return y>=d||_>=e.length?null:e.subarray(_,Math.min(_+n,e.length))},h=[];for(let y=0;y<109&&h.length<s;y+=1){let _=e.readUInt32LE(76+y*4);_!==Fe&&h.push(_)}let m=c;for(let y=0;y<u&&m!==kt&&m!==Fe;y+=1){let _=f(m);if(!_)return null;let v=n/4-1;for(let E=0;E<v&&h.length<s;E+=1){let w=_.readUInt32LE(E*4);w!==Fe&&h.push(w)}m=_.readUInt32LE(v*4)}let g=[];for(let y of h){let _=f(y);if(!_)return null;for(let v=0;v+4<=_.length;v+=4)g.push(_.readUInt32LE(v))}let b=(y,_,v)=>{let E=[],w=y;for(;w!==kt&&w!==Fe;){if(w>=_.length||E.length>v)return null;E.push(w),w=_[w]}return E},p=(y,_)=>{let v=b(y,g,d);if(!v)return null;let E=[];for(let W of v){let me=f(W);if(!me)return null;E.push(me)}let w=Buffer.concat(E);return _>=0?w.subarray(0,Math.min(_,w.length)):w},x=p(o,-1);if(!x)return null;let k=[],$=new Map;for(let y=0,_=0;y+128<=x.length;y+=128,_+=1){let v=x.readUInt16LE(y+64),E=x[y+66];if(E===0||v<2||v>64)continue;let w=x.subarray(y,y+v-2).toString("utf16le"),W={id:_,name:w,type:E,left:x.readUInt32LE(y+68),right:x.readUInt32LE(y+72),child:x.readUInt32LE(y+76),start:x.readUInt32LE(y+116),size:x.readUInt32LE(y+120),path:w};k.push(W),$.set(_,W)}let L=new Set,M=(y,_)=>{let v=[y];for(;v.length;){let E=v.pop(),w=$.get(E);!w||L.has(E)||(L.add(E),w.path=_?`${_}/${w.name}`:w.name,v.push(w.left,w.right),w.type===1&&M(w.child,w.path))}},H=k.find(y=>y.type===5);H&&M(H.child,"");let F=k.find(y=>y.type===5);if(!F)return null;let Y=null,R=[];if(k.some(y=>y.type===2&&y.size<a&&y.size>0)){Y=p(F.start,F.size);let y=l!==kt?p(l,-1):null;if(y)for(let _=0;_+4<=y.length;_+=4)R.push(y.readUInt32LE(_));else R=[]}let z=new Map,Q=new Map,U=(y,_)=>{z.has(y.name)||z.set(y.name,_),Q.set(y.path,_)};for(let y of k)if(y.type===2&&!(y.size>wi)){if(y.size===0){U(y,Buffer.alloc(0));continue}if(y.size<a){if(!Y)continue;let _=b(y.start,R,Math.ceil(Y.length/i)+1);if(!_)continue;let v=_.map(E=>Y.subarray(E*i,E*i+i));U(y,Buffer.concat(v).subarray(0,y.size))}else{let _=p(y.start,y.size);_&&U(y,_)}}return{streams:z,paths:Q}}catch{return null}}import{TextDecoder as xn}from"node:util";var xe="password-protected: open it with its password, or check it by hand";function vi(e){let t=e.streams;return t.has("EncryptionInfo")&&t.has("EncryptedPackage")?"encrypted-ooxml":t.has("WordDocument")?"doc":t.has("Workbook")||t.has("Book")?"xls":t.has("PowerPoint Document")?"ppt":[...t.keys()].some(r=>r.startsWith("__substg1.0_"))?"msg":null}var Sn=e=>{try{return new xn(e)}catch{return new xn("latin1")}},ne=Sn("windows-1252");function ke(e){return e.replace(/[\r\x07\x0b\x0c]/g,`
20
+ `),engine:"builtin",uncertain:l}}if(!e.subarray(0,8).toString("latin1").startsWith("%PDF-"))return null;if(n!==null)return{text:n,truncated:!1,streams:0,engine:"pdftotext",uncertain:!1};if(!t.ocr)return null;let i=Xi(e);return i?{text:i.text,truncated:i.truncated,streams:0,engine:"ocr",uncertain:!1}:null}function Nn(e){let t=Tn(e),r=se();return/scanned image/.test(t)?r.tesseract&&r.pdftoppm&&r.ocrLangs.length?"no text layer \u2014 a scanned image; the folder scan reads it with OCR on this computer, the read gate does not wait for OCR":`no text layer \u2014 a scanned image. To read it: ${ie}`:/encrypted/.test(t)?t+(r.pdftotext?"":` \u2014 if it opens without a password, the second reader can read it: ${ie}`):/letter map|compressed/.test(t)&&!r.pdftotext?`${t}. A second reader may read it: ${ie}`:/letter map|compressed/.test(t)?`${t} (the second reader, pdftotext, could not read it either)`:t}var Fn=[208,207,17,224,161,177,26,225],Et=4294967294,Me=4294967295,Ji=64*1024*1024;function ke(e){if(e.length<512)return!1;for(let t=0;t<Fn.length;t+=1)if(e[t]!==Fn[t])return!1;return!0}function At(e){if(!ke(e))return null;try{let t=e.readUInt16LE(30),r=e.readUInt16LE(32);if(t!==9&&t!==12)return null;let n=1<<t,i=1<<r,s=e.readUInt32LE(44),o=e.readUInt32LE(48),a=e.readUInt32LE(56),c=e.readUInt32LE(60),l=e.readUInt32LE(68),u=e.readUInt32LE(72),d=Math.floor((e.length-n)/n)+1,f=y=>{let x=(y+1)*n;return y>=d||x>=e.length?null:e.subarray(x,Math.min(x+n,e.length))},m=[];for(let y=0;y<109&&m.length<s;y+=1){let x=e.readUInt32LE(76+y*4);x!==Me&&m.push(x)}let g=l;for(let y=0;y<u&&g!==Et&&g!==Me;y+=1){let x=f(g);if(!x)return null;let S=n/4-1;for(let A=0;A<S&&m.length<s;A+=1){let v=x.readUInt32LE(A*4);v!==Me&&m.push(v)}g=x.readUInt32LE(S*4)}let h=[];for(let y of m){let x=f(y);if(!x)return null;for(let S=0;S+4<=x.length;S+=4)h.push(x.readUInt32LE(S))}let _=(y,x,S)=>{let A=[],v=y;for(;v!==Et&&v!==Me;){if(v>=x.length||A.length>S)return null;A.push(v),v=x[v]}return A},p=(y,x)=>{let S=_(y,h,d);if(!S)return null;let A=[];for(let Z of S){let ye=f(Z);if(!ye)return null;A.push(ye)}let v=Buffer.concat(A);return x>=0?v.subarray(0,Math.min(x,v.length)):v},b=p(o,-1);if(!b)return null;let k=[],R=new Map;for(let y=0,x=0;y+128<=b.length;y+=128,x+=1){let S=b.readUInt16LE(y+64),A=b[y+66];if(A===0||S<2||S>64)continue;let v=b.subarray(y,y+S-2).toString("utf16le"),Z={id:x,name:v,type:A,left:b.readUInt32LE(y+68),right:b.readUInt32LE(y+72),child:b.readUInt32LE(y+76),start:b.readUInt32LE(y+116),size:b.readUInt32LE(y+120),path:v};k.push(Z),R.set(x,Z)}let w=new Set,N=(y,x)=>{let S=[y];for(;S.length;){let A=S.pop(),v=R.get(A);!v||w.has(A)||(w.add(A),v.path=x?`${x}/${v.name}`:v.name,S.push(v.left,v.right),v.type===1&&N(v.child,v.path))}},H=k.find(y=>y.type===5);H&&N(H.child,"");let C=k.find(y=>y.type===5);if(!C)return null;let z=null,T=[];if(k.some(y=>y.type===2&&y.size<a&&y.size>0)){z=p(C.start,C.size);let y=c!==Et?p(c,-1):null;if(y)for(let x=0;x+4<=y.length;x+=4)T.push(y.readUInt32LE(x));else T=[]}let F=new Map,re=new Map,W=(y,x)=>{F.has(y.name)||F.set(y.name,x),re.set(y.path,x)};for(let y of k)if(y.type===2&&!(y.size>Ji)){if(y.size===0){W(y,Buffer.alloc(0));continue}if(y.size<a){if(!z)continue;let x=_(y.start,T,Math.ceil(z.length/i)+1);if(!x)continue;let S=x.map(A=>z.subarray(A*i,A*i+i));W(y,Buffer.concat(S).subarray(0,y.size))}else{let x=p(y.start,y.size);x&&W(y,x)}}return{streams:F,paths:re}}catch{return null}}import{TextDecoder as jn}from"node:util";var we="password-protected: open it with its password, or check it by hand";function qi(e){let t=e.streams;return t.has("EncryptionInfo")&&t.has("EncryptedPackage")?"encrypted-ooxml":t.has("WordDocument")?"doc":t.has("Workbook")||t.has("Book")?"xls":t.has("PowerPoint Document")?"ppt":[...t.keys()].some(r=>r.startsWith("__substg1.0_"))?"msg":null}var Bn=e=>{try{return new jn(e)}catch{return new jn("latin1")}},oe=Bn("windows-1252");function ve(e){return e.replace(/[\r\x07\x0b\x0c]/g,`
21
21
  `).replace(/[\x13\x14\x15]/g," ").replace(/[\x00-\x08\x0e-\x1f]/g,"").replace(/\n{3,}/g,`
22
22
 
23
- `)}function Si(e,t){return e.length>t?{text:e.slice(0,t),truncated:!0}:{text:e,truncated:!1}}function Ei(e){let t=e.streams.get("WordDocument");if(t.length<512)return{kind:"doc",reason:"damaged Word file"};let r=t.readUInt16LE(10);if(r&256||r&32768)return{kind:"doc",reason:xe};if(t.readUInt16LE(2)<101){let m=t.readUInt32LE(24),g=t.readUInt32LE(28);return g<=m||g>t.length?{kind:"doc",reason:"damaged Word file"}:ke(ne.decode(t.subarray(m,g)))}let i=e.streams.get(r&512?"1Table":"0Table");if(!i)return{kind:"doc",reason:"damaged Word file (no table stream)"};let s=32;s+=2+t.readUInt16LE(s)*2,s+=2+t.readUInt16LE(s)*4;let o=s+2,a=t.readUInt32LE(o+264),l=t.readUInt32LE(o+264+4);if(!l||a+l>i.length)return{kind:"doc",reason:"damaged Word file (no piece table)"};let c=a,u=a+l,d=null;for(;c<u;){let m=i[c];if(m===1)c+=3+i.readInt16LE(c+1);else if(m===2){let g=i.readUInt32LE(c+1);d=i.subarray(c+5,Math.min(c+5+g,i.length));break}else break}if(!d||d.length<16)return{kind:"doc",reason:"damaged Word file (no piece table)"};let f=Math.floor((d.length-4)/12),h=[];for(let m=0;m<f;m+=1){let g=d.readUInt32LE(m*4),p=d.readUInt32LE((m+1)*4)-g;if(p<=0||p>t.length)continue;let x=d.readUInt32LE(4*(f+1)+m*8+2);if(x&1073741824){let k=(x&1073741823)/2;h.push(ne.decode(t.subarray(k,Math.min(k+p,t.length))))}else h.push(t.subarray(x,Math.min(x+p*2,t.length)).toString("utf16le"))}return ke(h.join(""))}var vt=class{segs;i=0;p=0;constructor(t){this.segs=t}here(){for(;this.i<this.segs.length&&this.p>=this.segs[this.i].length;)this.i+=1,this.p=0;return this.i<this.segs.length?this.segs[this.i]:null}get done(){return this.here()===null}atSeam(){return this.p===0&&this.i>0}u8(){let t=this.here();if(!t)throw new Error("eof");return t[this.p++]}u16(){return this.u8()|this.u8()<<8}u32(){return(this.u16()|this.u16()<<16)>>>0}skip(t){for(let r=0;r<t;r+=1)this.u8()}chars(t,r){let n="",i=t,s=r;for(;i>0&&this.here();){this.p===0&&n.length>0&&(s=(this.u8()&1)===1);let a=this.here();if(!a)break;let l=Math.floor((a.length-this.p)/(s?2:1)),c=Math.min(i,l);if(c<=0){this.p=a.length;continue}let u=a.subarray(this.p,this.p+c*(s?2:1));n+=s?u.toString("utf16le"):u.toString("latin1"),this.p+=u.length,i-=c}return n}};function Ai(e){let t=new vt(e),r=[];try{t.u32();let n=t.u32();for(let i=0;i<n&&!t.done;i+=1){let s=t.u16(),o=t.u8(),a=o&8?t.u16():0,l=o&4?t.u32():0;r.push(t.chars(s,(o&1)===1)),t.skip(a*4+l)}}catch{}return r}function kn(e,t,r,n){if(t+2>e.length)return"";let i=e.readUInt16LE(t);if(!r)return n.decode(e.subarray(t+2,t+2+i));let s=e[t+2],o=t+3;return s&8&&(o+=2),s&4&&(o+=4),s&1?e.subarray(o,o+i*2).toString("utf16le"):e.subarray(o,o+i).toString("latin1")}function wn(e){let t;if(e&2)t=e>>2;else{let r=Buffer.alloc(8);r.writeUInt32LE(0,0),r.writeUInt32LE((e&4294967292)>>>0,4),t=r.readDoubleLE(0)}return e&1?t/100:t}var je=e=>Number.isFinite(e)?String(e):"";function $i(e){let t=e.streams.get("Workbook")??e.streams.get("Book"),r=!0,n=ne,i=[],s=new Set,o=[],a=[],l=-1,c=null,u=0,d=(g,b,p)=>{if(l<0||!p)return;let x=a[l],k=x.get(g)??new Map;k.set(b,p),x.set(g,k)},f=0;for(;f+4<=t.length;){let g=t.readUInt16LE(f),b=t.readUInt16LE(f+2),p=t.subarray(f+4,Math.min(f+4+b,t.length)),x=f+4+b;switch(g){case 2057:u+=1,p.length>=4&&(r=p.readUInt16LE(0)===1536),u===1&&p.length>=4&&p.readUInt16LE(2)!==5&&(l=a.length,a.push(new Map));break;case 10:u=Math.max(0,u-1);break;case 47:return{kind:"xls",reason:xe};case 66:if(p.length>=2&&!r){let k=p.readUInt16LE(0);n=k===1200?ne:Sn(`windows-${k}`)}break;case 133:if(p.length>6){let k=p[6];if(r){let $=p[7]&1;o.push($?p.subarray(8,8+k*2).toString("utf16le"):p.subarray(8,8+k).toString("latin1"))}else o.push(n.decode(p.subarray(7,7+k)))}break;case 252:{let k=[p];for(;x+4<=t.length&&t.readUInt16LE(x)===60;){let $=t.readUInt16LE(x+2);k.push(t.subarray(x+4,Math.min(x+4+$,t.length))),x+=4+$}i=Ai(k);break}case 253:if(p.length>=10){let k=p.readUInt32LE(6);s.add(k),d(p.readUInt16LE(0),p.readUInt16LE(2),i[k]??"")}break;case 516:case 214:p.length>=8&&d(p.readUInt16LE(0),p.readUInt16LE(2),kn(p,6,r,n));break;case 515:p.length>=14&&d(p.readUInt16LE(0),p.readUInt16LE(2),je(p.readDoubleLE(6)));break;case 638:p.length>=10&&d(p.readUInt16LE(0),p.readUInt16LE(2),je(wn(p.readUInt32LE(6))));break;case 189:{if(p.length>=6){let k=p.readUInt16LE(0),$=p.readUInt16LE(2);for(let L=4;L+6<=p.length-2;L+=6)d(k,$++,je(wn(p.readUInt32LE(L+2))))}break}case 6:if(p.length>=14){let k=p.readUInt16LE(0),$=p.readUInt16LE(2);p.readUInt16LE(12)===65535?c=p[6]===0?[k,$]:null:d(k,$,je(p.readDoubleLE(6)))}break;case 519:c&&d(c[0],c[1],kn(p,0,r,n)),c=null;break}f=x}let h=[];a.forEach((g,b)=>{h.push(o[b]??"");for(let p of[...g.keys()].sort((x,k)=>x-k)){let x=g.get(p);h.push([...x.keys()].sort((k,$)=>k-$).map(k=>x.get(k)).join(" "))}h.push("")});let m=i.filter((g,b)=>!s.has(b));return m.length&&h.push(...m),ke(h.join(`
24
- `))}function Ii(e){if(e.streams.has("EncryptedSummary"))return{kind:"ppt",reason:xe};let t=e.streams.get("PowerPoint Document"),r=[],n=0;for(;n+8<=t.length;){let i=t.readUInt16LE(n)&15,s=t.readUInt16LE(n+2),o=t.readUInt32LE(n+4);if(s===12052)return{kind:"ppt",reason:xe};if(i===15){n+=8;continue}let a=t.subarray(n+8,Math.min(n+8+o,t.length));s===4e3||s===4026?r.push(a.toString("utf16le")):s===4008&&r.push(ne.decode(a)),n+=8+o}return ke(r.join(`
25
- `))}function Ti(e){let t=[];for(let[r,n]of e.paths){if(r.startsWith("__attach_"))continue;let i=/(?:^|\/)__substg1\.0_([0-9A-F]{4})(001F|001E)$/i.exec(r);i&&t.push(i[2].toUpperCase()==="001F"?n.toString("utf16le"):ne.decode(n))}return ke(t.join(`
26
- `))}function vn(e){let t=new Map;for(let[r,n]of e.paths){let i=/^(__attach_version1\.0_#[0-9A-F]{8})\/__substg1\.0_(3707|3704|3701)(001F|0102)$/i.exec(r);if(!i)continue;let s=t.get(i[1])??{};i[2]==="3701"&&i[3]==="0102"?s.data=n:i[2]==="3707"?s.name=n.toString("utf16le").replace(/\0+$/,""):i[2]==="3704"&&(s.short=n.toString("utf16le").replace(/\0+$/,"")),t.set(i[1],s)}return[...t.values()].filter(r=>r.data).map((r,n)=>({name:r.name||r.short||`attachment-${n+1}`,data:r.data}))}function St(e,t){let r=wt(e);if(!r)return{kind:null,reason:"damaged Office 97-2003 file"};let n=vi(r);if(!n)return{kind:null,reason:"a compound file that is not a Word, Excel, PowerPoint or Outlook file"};if(n==="encrypted-ooxml")return{kind:n,reason:xe};let i;try{i=n==="doc"?Ei(r):n==="xls"?$i(r):n==="ppt"?Ii(r):Ti(r)}catch{i={kind:n,reason:"damaged Office 97-2003 file"}}if(typeof i!="string")return i;if(!i.trim()&&!(n==="msg"&&vn(r).length))return{kind:n,reason:"no text inside (an empty file, or only pictures)"};let s=Si(i,t),o=n==="msg"?vn(r):[];return{kind:n,text:s.text,truncated:s.truncated,parts:[`cfb:${n}`],...o.length?{attachments:o}:{}}}import{TextDecoder as En}from"node:util";var Ri=new Set(["fonttbl","colortbl","stylesheet","listtable","listoverridetable","rsidtbl","generator","pict","object","objdata","themedata","colorschememapping","datastore","latentstyles","xmlnstbl","mmathpr","filetbl","revtbl","pgdsctbl","bkmkstart","bkmkend","fldinst","shppict","nonshppict","blipuid","panose","falt","wgrffmtfilter","defchp","defpap"]),An=e=>{try{return new En(e===65001?"utf-8":`windows-${e}`)}catch{return new En("windows-1252")}};function Me(e){return e.length>=5&&e.subarray(0,5).toString("latin1")==="{\\rtf"}function Et(e){let t=An(1252),r=[],n=[],i=()=>{n.length&&(r.push(t.decode(Uint8Array.from(n))),n=[])},s=[],o=!1,a=1,l=0,c=0,u=e.length;for(;c<u;){let d=e[c];if(d==="{"){i(),s.push({skip:o,uc:a}),c+=1,e.startsWith("\\*",c)&&(o=!0);continue}if(d==="}"){i();let f=s.pop();f&&(o=f.skip,a=f.uc),c+=1;continue}if(d==="\\"){let f=e[c+1];if(f==="'"){let b=parseInt(e.substr(c+2,2),16);if(c+=4,l>0){l-=1;continue}!o&&Number.isFinite(b)&&n.push(b);continue}if(f==="\\"||f==="{"||f==="}"){o||(i(),r.push(f)),c+=2;continue}if(f==="~"){o||r.push(" "),c+=2;continue}let h=/^([a-zA-Z]+)(-?\d+)? ?/.exec(e.slice(c+1,c+40));if(!h){c+=2;continue}c+=1+h[0].length;let m=h[1].toLowerCase(),g=h[2]!==void 0?Number(h[2]):null;if(Ri.has(m)){o=!0;continue}m==="ansicpg"&&g?t=An(g):m==="uc"&&g!==null?a=g:m==="u"&&g!==null?(i(),o||r.push(String.fromCharCode(g<0?g+65536:g)),l=a):!o&&(m==="par"||m==="line"||m==="row"||m==="sect"||m==="page")?(i(),r.push(`
27
- `)):!o&&(m==="tab"||m==="cell")&&(i(),r.push(" "));continue}if(d==="\r"||d===`
28
- `){c+=1;continue}if(l>0){l-=1,c+=1;continue}o||(i(),r.push(d)),c+=1}return i(),r.join("").replace(/\n{3,}/g,`
23
+ `)}function Yi(e,t){return e.length>t?{text:e.slice(0,t),truncated:!0}:{text:e,truncated:!1}}function Qi(e){let t=e.streams.get("WordDocument");if(t.length<512)return{kind:"doc",reason:"damaged Word file"};let r=t.readUInt16LE(10);if(r&256||r&32768)return{kind:"doc",reason:we};if(t.readUInt16LE(2)<101){let g=t.readUInt32LE(24),h=t.readUInt32LE(28);return h<=g||h>t.length?{kind:"doc",reason:"damaged Word file"}:ve(oe.decode(t.subarray(g,h)))}let i=e.streams.get(r&512?"1Table":"0Table");if(!i)return{kind:"doc",reason:"damaged Word file (no table stream)"};let s=32;s+=2+t.readUInt16LE(s)*2,s+=2+t.readUInt16LE(s)*4;let o=s+2,a=t.readUInt32LE(o+264),c=t.readUInt32LE(o+264+4);if(!c||a+c>i.length)return{kind:"doc",reason:"damaged Word file (no piece table)"};let l=a,u=a+c,d=null;for(;l<u;){let g=i[l];if(g===1)l+=3+i.readInt16LE(l+1);else if(g===2){let h=i.readUInt32LE(l+1);d=i.subarray(l+5,Math.min(l+5+h,i.length));break}else break}if(!d||d.length<16)return{kind:"doc",reason:"damaged Word file (no piece table)"};let f=Math.floor((d.length-4)/12),m=[];for(let g=0;g<f;g+=1){let h=d.readUInt32LE(g*4),p=d.readUInt32LE((g+1)*4)-h;if(p<=0||p>t.length)continue;let b=d.readUInt32LE(4*(f+1)+g*8+2);if(b&1073741824){let k=(b&1073741823)/2;m.push(oe.decode(t.subarray(k,Math.min(k+p,t.length))))}else m.push(t.subarray(b,Math.min(b+p*2,t.length)).toString("utf16le"))}return ve(m.join(""))}var $t=class{segs;i=0;p=0;constructor(t){this.segs=t}here(){for(;this.i<this.segs.length&&this.p>=this.segs[this.i].length;)this.i+=1,this.p=0;return this.i<this.segs.length?this.segs[this.i]:null}get done(){return this.here()===null}atSeam(){return this.p===0&&this.i>0}u8(){let t=this.here();if(!t)throw new Error("eof");return t[this.p++]}u16(){return this.u8()|this.u8()<<8}u32(){return(this.u16()|this.u16()<<16)>>>0}skip(t){for(let r=0;r<t;r+=1)this.u8()}chars(t,r){let n="",i=t,s=r;for(;i>0&&this.here();){this.p===0&&n.length>0&&(s=(this.u8()&1)===1);let a=this.here();if(!a)break;let c=Math.floor((a.length-this.p)/(s?2:1)),l=Math.min(i,c);if(l<=0){this.p=a.length;continue}let u=a.subarray(this.p,this.p+l*(s?2:1));n+=s?u.toString("utf16le"):u.toString("latin1"),this.p+=u.length,i-=l}return n}};function es(e){let t=new $t(e),r=[];try{t.u32();let n=t.u32();for(let i=0;i<n&&!t.done;i+=1){let s=t.u16(),o=t.u8(),a=o&8?t.u16():0,c=o&4?t.u32():0;r.push(t.chars(s,(o&1)===1)),t.skip(a*4+c)}}catch{}return r}function Mn(e,t,r,n){if(t+2>e.length)return"";let i=e.readUInt16LE(t);if(!r)return n.decode(e.subarray(t+2,t+2+i));let s=e[t+2],o=t+3;return s&8&&(o+=2),s&4&&(o+=4),s&1?e.subarray(o,o+i*2).toString("utf16le"):e.subarray(o,o+i).toString("latin1")}function Hn(e){let t;if(e&2)t=e>>2;else{let r=Buffer.alloc(8);r.writeUInt32LE(0,0),r.writeUInt32LE((e&4294967292)>>>0,4),t=r.readDoubleLE(0)}return e&1?t/100:t}var He=e=>Number.isFinite(e)?String(e):"";function ts(e){let t=e.streams.get("Workbook")??e.streams.get("Book"),r=!0,n=oe,i=[],s=new Set,o=[],a=[],c=-1,l=null,u=0,d=(h,_,p)=>{if(c<0||!p)return;let b=a[c],k=b.get(h)??new Map;k.set(_,p),b.set(h,k)},f=0;for(;f+4<=t.length;){let h=t.readUInt16LE(f),_=t.readUInt16LE(f+2),p=t.subarray(f+4,Math.min(f+4+_,t.length)),b=f+4+_;switch(h){case 2057:u+=1,p.length>=4&&(r=p.readUInt16LE(0)===1536),u===1&&p.length>=4&&p.readUInt16LE(2)!==5&&(c=a.length,a.push(new Map));break;case 10:u=Math.max(0,u-1);break;case 47:return{kind:"xls",reason:we};case 66:if(p.length>=2&&!r){let k=p.readUInt16LE(0);n=k===1200?oe:Bn(`windows-${k}`)}break;case 133:if(p.length>6){let k=p[6];if(r){let R=p[7]&1;o.push(R?p.subarray(8,8+k*2).toString("utf16le"):p.subarray(8,8+k).toString("latin1"))}else o.push(n.decode(p.subarray(7,7+k)))}break;case 252:{let k=[p];for(;b+4<=t.length&&t.readUInt16LE(b)===60;){let R=t.readUInt16LE(b+2);k.push(t.subarray(b+4,Math.min(b+4+R,t.length))),b+=4+R}i=es(k);break}case 253:if(p.length>=10){let k=p.readUInt32LE(6);s.add(k),d(p.readUInt16LE(0),p.readUInt16LE(2),i[k]??"")}break;case 516:case 214:p.length>=8&&d(p.readUInt16LE(0),p.readUInt16LE(2),Mn(p,6,r,n));break;case 515:p.length>=14&&d(p.readUInt16LE(0),p.readUInt16LE(2),He(p.readDoubleLE(6)));break;case 638:p.length>=10&&d(p.readUInt16LE(0),p.readUInt16LE(2),He(Hn(p.readUInt32LE(6))));break;case 189:{if(p.length>=6){let k=p.readUInt16LE(0),R=p.readUInt16LE(2);for(let w=4;w+6<=p.length-2;w+=6)d(k,R++,He(Hn(p.readUInt32LE(w+2))))}break}case 6:if(p.length>=14){let k=p.readUInt16LE(0),R=p.readUInt16LE(2);p.readUInt16LE(12)===65535?l=p[6]===0?[k,R]:null:d(k,R,He(p.readDoubleLE(6)))}break;case 519:l&&d(l[0],l[1],Mn(p,0,r,n)),l=null;break}f=b}let m=[];a.forEach((h,_)=>{m.push(o[_]??"");for(let p of[...h.keys()].sort((b,k)=>b-k)){let b=h.get(p);m.push([...b.keys()].sort((k,R)=>k-R).map(k=>b.get(k)).join(" "))}m.push("")});let g=i.filter((h,_)=>!s.has(_));return g.length&&m.push(...g),ve(m.join(`
24
+ `))}function ns(e){if(e.streams.has("EncryptedSummary"))return{kind:"ppt",reason:we};let t=e.streams.get("PowerPoint Document"),r=[],n=0;for(;n+8<=t.length;){let i=t.readUInt16LE(n)&15,s=t.readUInt16LE(n+2),o=t.readUInt32LE(n+4);if(s===12052)return{kind:"ppt",reason:we};if(i===15){n+=8;continue}let a=t.subarray(n+8,Math.min(n+8+o,t.length));s===4e3||s===4026?r.push(a.toString("utf16le")):s===4008&&r.push(oe.decode(a)),n+=8+o}return ve(r.join(`
25
+ `))}function rs(e){let t=[];for(let[r,n]of e.paths){if(r.startsWith("__attach_"))continue;let i=/(?:^|\/)__substg1\.0_([0-9A-F]{4})(001F|001E)$/i.exec(r);i&&t.push(i[2].toUpperCase()==="001F"?n.toString("utf16le"):oe.decode(n))}return ve(t.join(`
26
+ `))}function Un(e){let t=new Map;for(let[r,n]of e.paths){let i=/^(__attach_version1\.0_#[0-9A-F]{8})\/__substg1\.0_(3707|3704|3701)(001F|0102)$/i.exec(r);if(!i)continue;let s=t.get(i[1])??{};i[2]==="3701"&&i[3]==="0102"?s.data=n:i[2]==="3707"?s.name=n.toString("utf16le").replace(/\0+$/,""):i[2]==="3704"&&(s.short=n.toString("utf16le").replace(/\0+$/,"")),t.set(i[1],s)}return[...t.values()].filter(r=>r.data).map((r,n)=>({name:r.name||r.short||`attachment-${n+1}`,data:r.data}))}function It(e,t){let r=At(e);if(!r)return{kind:null,reason:"damaged Office 97-2003 file"};let n=qi(r);if(!n)return{kind:null,reason:"a compound file that is not a Word, Excel, PowerPoint or Outlook file"};if(n==="encrypted-ooxml")return{kind:n,reason:we};let i;try{i=n==="doc"?Qi(r):n==="xls"?ts(r):n==="ppt"?ns(r):rs(r)}catch{i={kind:n,reason:"damaged Office 97-2003 file"}}if(typeof i!="string")return i;if(!i.trim()&&!(n==="msg"&&Un(r).length))return{kind:n,reason:"no text inside (an empty file, or only pictures)"};let s=Yi(i,t),o=n==="msg"?Un(r):[];return{kind:n,text:s.text,truncated:s.truncated,parts:[`cfb:${n}`],...o.length?{attachments:o}:{}}}import{TextDecoder as zn}from"node:util";var is=new Set(["fonttbl","colortbl","stylesheet","listtable","listoverridetable","rsidtbl","generator","pict","object","objdata","themedata","colorschememapping","datastore","latentstyles","xmlnstbl","mmathpr","filetbl","revtbl","pgdsctbl","bkmkstart","bkmkend","fldinst","shppict","nonshppict","blipuid","panose","falt","wgrffmtfilter","defchp","defpap"]),Wn=e=>{try{return new zn(e===65001?"utf-8":`windows-${e}`)}catch{return new zn("windows-1252")}};function Ue(e){return e.length>=5&&e.subarray(0,5).toString("latin1")==="{\\rtf"}function Tt(e){let t=Wn(1252),r=[],n=[],i=()=>{n.length&&(r.push(t.decode(Uint8Array.from(n))),n=[])},s=[],o=!1,a=1,c=0,l=0,u=e.length;for(;l<u;){let d=e[l];if(d==="{"){i(),s.push({skip:o,uc:a}),l+=1,e.startsWith("\\*",l)&&(o=!0);continue}if(d==="}"){i();let f=s.pop();f&&(o=f.skip,a=f.uc),l+=1;continue}if(d==="\\"){let f=e[l+1];if(f==="'"){let _=parseInt(e.substr(l+2,2),16);if(l+=4,c>0){c-=1;continue}!o&&Number.isFinite(_)&&n.push(_);continue}if(f==="\\"||f==="{"||f==="}"){o||(i(),r.push(f)),l+=2;continue}if(f==="~"){o||r.push(" "),l+=2;continue}let m=/^([a-zA-Z]+)(-?\d+)? ?/.exec(e.slice(l+1,l+40));if(!m){l+=2;continue}l+=1+m[0].length;let g=m[1].toLowerCase(),h=m[2]!==void 0?Number(m[2]):null;if(is.has(g)){o=!0;continue}g==="ansicpg"&&h?t=Wn(h):g==="uc"&&h!==null?a=h:g==="u"&&h!==null?(i(),o||r.push(String.fromCharCode(h<0?h+65536:h)),c=a):!o&&(g==="par"||g==="line"||g==="row"||g==="sect"||g==="page")?(i(),r.push(`
27
+ `)):!o&&(g==="tab"||g==="cell")&&(i(),r.push(" "));continue}if(d==="\r"||d===`
28
+ `){l+=1;continue}if(c>0){c-=1,l+=1;continue}o||(i(),r.push(d)),l+=1}return i(),r.join("").replace(/\n{3,}/g,`
29
29
 
30
- `)}var At=new Set([".xlsx",".xlsm",".xltx",".xltm",".docx",".docm",".dotx",".dotm",".pptx",".pptm",".ppsx",".ppsm",".potx"]),He=new Set([".odt",".ods",".odp",".ott",".ots",".otp"]),$t=new Set([".doc",".dot",".xls",".xlt",".ppt",".pps",".pot",".msg"]),$n=new Set([".rtf"]);function Pi(e){return/^\.(xls[xm]|xlt[xm])$/.test(e)?".xlsx":/^\.(doc[xm]|dot[xm])$/.test(e)?".docx":/^\.(ppt[xm]|pps[xm]|potx)$/.test(e)?".pptx":e}var re=8*1024*1024,Li=101010256,Di=33639248,Ni=67324752;function ie(e){let t=Math.min(e.length,67584),r=-1;for(let o=e.length-22;o>=e.length-t&&o>=0;o-=1)if(e.readUInt32LE(o)===Li){r=o;break}if(r<0)return null;let n=e.readUInt16LE(r+10),i=e.readUInt32LE(r+16);if(i>=e.length)return null;let s=[];for(let o=0;o<n&&!(i+46>e.length||e.readUInt32LE(i)!==Di);o+=1){let a=e.readUInt16LE(i+8),l=e.readUInt16LE(i+10),c=e.readUInt32LE(i+20),u=e.readUInt32LE(i+24),d=e.readUInt16LE(i+28),f=e.readUInt16LE(i+30),h=e.readUInt16LE(i+32),m=e.readUInt32LE(i+42),g=e.subarray(i+46,i+46+d).toString("utf8");s.push({name:g,flags:a,method:l,compSize:c,uncompSize:u,localHeaderOffset:m}),i+=46+d+f+h}return s}function se(e,t,r=256*1024*1024){let n=t.localHeaderOffset;if(n+30>e.length||e.readUInt32LE(n)!==Ni)return null;let i=e.readUInt16LE(n+26),s=e.readUInt16LE(n+28),o=n+30+i+s,a=o+t.compSize;if(a>e.length)return null;let l=e.subarray(o,a);try{if(t.method===0)return l.length<=r?Buffer.from(l):null;if(t.method===8)return Ci(l,{maxOutputLength:r})}catch{return null}return null}function Oi(e,t){return se(e,t)?.toString("utf8")??null}var Fi={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&apos;":"'"};function B(e){return e.replace(/&(amp|lt|gt|quot|apos);/g,t=>Fi[t]??t).replace(/&#(\d+);/g,(t,r)=>{let n=Number(r);return n>0&&n<1114112?String.fromCodePoint(n):""}).replace(/&#x([0-9a-fA-F]+);/g,(t,r)=>{let n=parseInt(r,16);return n>0&&n<1114112?String.fromCodePoint(n):""})}function ji(e){return B(e.replace(/<[^>]*>/g,`
30
+ `)}var Rt=new Set([".xlsx",".xlsm",".xltx",".xltm",".docx",".docm",".dotx",".dotm",".pptx",".pptm",".ppsx",".ppsm",".potx"]),Be=new Set([".odt",".ods",".odp",".ott",".ots",".otp"]),Ct=new Set([".doc",".dot",".xls",".xlt",".ppt",".pps",".pot",".msg"]),Gn=new Set([".rtf"]);function os(e){return/^\.(xls[xm]|xlt[xm])$/.test(e)?".xlsx":/^\.(doc[xm]|dot[xm])$/.test(e)?".docx":/^\.(ppt[xm]|pps[xm]|potx)$/.test(e)?".pptx":e}var ae=8*1024*1024,as=101010256,cs=33639248,ls=67324752;function ce(e){let t=Math.min(e.length,67584),r=-1;for(let o=e.length-22;o>=e.length-t&&o>=0;o-=1)if(e.readUInt32LE(o)===as){r=o;break}if(r<0)return null;let n=e.readUInt16LE(r+10),i=e.readUInt32LE(r+16);if(i>=e.length)return null;let s=[];for(let o=0;o<n&&!(i+46>e.length||e.readUInt32LE(i)!==cs);o+=1){let a=e.readUInt16LE(i+8),c=e.readUInt16LE(i+10),l=e.readUInt32LE(i+20),u=e.readUInt32LE(i+24),d=e.readUInt16LE(i+28),f=e.readUInt16LE(i+30),m=e.readUInt16LE(i+32),g=e.readUInt32LE(i+42),h=e.subarray(i+46,i+46+d).toString("utf8");s.push({name:h,flags:a,method:c,compSize:l,uncompSize:u,localHeaderOffset:g}),i+=46+d+f+m}return s}function le(e,t,r=256*1024*1024){let n=t.localHeaderOffset;if(n+30>e.length||e.readUInt32LE(n)!==ls)return null;let i=e.readUInt16LE(n+26),s=e.readUInt16LE(n+28),o=n+30+i+s,a=o+t.compSize;if(a>e.length)return null;let c=e.subarray(o,a);try{if(t.method===0)return c.length<=r?Buffer.from(c):null;if(t.method===8)return ss(c,{maxOutputLength:r})}catch{return null}return null}function ds(e,t){return le(e,t)?.toString("utf8")??null}var us={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&apos;":"'"};function G(e){return e.replace(/&(amp|lt|gt|quot|apos);/g,t=>us[t]??t).replace(/&#(\d+);/g,(t,r)=>{let n=Number(r);return n>0&&n<1114112?String.fromCodePoint(n):""}).replace(/&#x([0-9a-fA-F]+);/g,(t,r)=>{let n=parseInt(r,16);return n>0&&n<1114112?String.fromCodePoint(n):""})}function fs(e){return G(e.replace(/<[^>]*>/g,`
31
31
  `)).replace(/\n{2,}/g,`
32
- `)}function Mi(e,t,r){let n=new RegExp(`<${t}\\b[^>]*\\b${r}="([^"]*)"`,"g"),i=[],s;for(;(s=n.exec(e))!==null;)s[1]&&i.push(B(s[1]));return i}function Hi(e,t){let r=[];if(He.has(e)){for(let n of t)(n==="content.xml"||n==="styles.xml"||n==="meta.xml")&&r.push(n);return r}e=Pi(e);for(let n of t)(n==="docProps/core.xml"||n==="docProps/app.xml")&&r.push(n);if(e===".xlsx"||e===".xlsm")for(let n of t)(n==="xl/sharedStrings.xml"||n==="xl/workbook.xml"||/^xl\/worksheets\/sheet\d+\.xml$/.test(n)||/^xl\/comments\d*\.xml$/.test(n))&&r.push(n);else if(e===".docx")for(let n of t)(n==="word/document.xml"||/^word\/(header|footer|footnotes|endnotes|comments)\d*\.xml$/.test(n))&&r.push(n);else if(e===".pptx")for(let n of t)/^ppt\/(slides|notesSlides)\/(slide|notesSlide)\d+\.xml$/.test(n)&&r.push(n);return r}function Ui(e,t){let r=ie(e);if(!r||r.length===0)return null;let n=new Map(r.map(c=>[c.name,c])),i=Hi(t,r.map(c=>c.name));if(i.length===0)return null;let s=[],o=[],a=0,l=!1;for(let c of i){if(a>=re){l=!0;break}let u=n.get(c);if(!u)continue;let d=Oi(e,u);if(d===null)continue;let f=ji(d);if(c==="xl/workbook.xml"){let h=Mi(d,"sheet","name");h.length&&(f+=`
33
- `+h.join(`
34
- `))}a+f.length>re&&(f=f.slice(0,Math.max(0,re-a)),l=!0),f.trim().length!==0&&(s.push(f),o.push(c),a+=f.length)}return s.length===0?null:{text:s.join(`
35
- `),truncated:l,parts:o}}function In(e,t,r={}){if(_e(e)){let n=St(e,re);return"text"in n?{ok:!0,result:{text:n.text,truncated:n.truncated,parts:n.parts,attachments:n.attachments}}:{ok:!1,reason:n.reason}}if(Me(e)){let n=Et(e.toString("latin1"));if(!n.trim())return{ok:!1,reason:"no text inside (an empty file, or only pictures)"};let i=n.length>re;return{ok:!0,result:{text:i?n.slice(0,re):n,truncated:i,parts:["rtf"]}}}if(At.has(t)||He.has(t)){let n=Ui(e,t);return n?{ok:!0,result:n}:{ok:!1,reason:"damaged, or not really an Office file"}}if(Te.has(t)){let n=Oe(e,r);return n?{ok:!0,result:{text:n.text,truncated:n.truncated,parts:[`pdf:${n.engine}`],engine:n.engine,uncertain:n.uncertain}}:{ok:!1,reason:bn(e)}}return $t.has(t)?{ok:!1,reason:"not a Word, Excel, PowerPoint or Outlook file inside, despite its name"}:{ok:!1,reason:"unsupported format"}}function It(e,t,r={}){let n=In(e,t,r);return n.ok?n.result:null}var Tt=new Set([...At,...He,...$t,...$n,...Te]);var tc=5*6e4,nc=2*6e4;import{deflateRawSync as Ki}from"node:zlib";var Tn={israeli_id:"[ID]",credit_card:"[CARD]",iban:"[IBAN]",israeli_phone:"[PHONE]",email:"[EMAIL]"},Bi=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,zi=[...mt].sort((e,t)=>+(t.subkind==="iban")-+(e.subkind==="iban"));function G(e,t,r=1){e[t]=(e[t]??0)+r}var Rn=null,K=e=>{let t=e.trim();Rn&&t&&Rn.add(t)};function N(e,t={},r){let n=e;for(let s of ye()){let o=new RegExp(s.pattern.source,s.pattern.flags.includes("g")?s.pattern.flags:s.pattern.flags+"g");n=n.replace(o,a=>(G(t,"secret"),K(a),"[SECRET]"))}for(let s of zi)s.pattern.lastIndex=0,n=n.replace(s.pattern,o=>s.validate(o)?(G(t,s.subkind),K(o),Tn[s.subkind]??`[${s.subkind.toUpperCase()}]`):o);n=n.replace(Bi,s=>(G(t,"email"),K(s),Tn.email));let i=r??new Set;for(let s of Ae()){let o=s.find(n).sort((a,l)=>l.start-a.start);for(let a of o){let l=n.slice(a.start,a.end);K(l),s.kind==="name"&&i.add(l.trim()),n=n.slice(0,a.start)+`[${s.kind.toUpperCase()}]`+n.slice(a.end),G(t,s.kind)}}return i.size&&(n=Vi(n,i,t)),{text:n,counts:t,columnsHidden:[]}}var Wi=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function Vi(e,t,r){let n=new Set;for(let s of t){n.add(s);let o=s.split(/\s+/)[0]??"";o.length>=3&&o!==s&&n.add(o)}let i=e;for(let s of[...n].sort((o,a)=>a.length-o.length)){let o=new RegExp(`(?<![\\p{L}\\p{N}@.\\[-])${Wi(s)}(?![\\p{L}\\p{N}@\\]-])`,"gu");i=i.replace(o,a=>(G(r,"name"),K(a),"[NAME]"))}return i}function oe(e,t,r={}){let n=e;for(let[i,s]of[...t].sort((o,a)=>a[0].length-o[0].length))n.includes(i)&&(n=n.split(i).join(`[${s.toUpperCase()}]`),G(r,s),K(i));return n}function Rt(){let e=new Map,t={};return(r,n)=>{K(n);let i=`${r}\0${n.trim()}`,s=e.get(i);return s===void 0&&(s=t[r]=(t[r]??0)+1,e.set(i,s)),`[${r.toUpperCase()}-${s}]`}}function Ue(e){let t=e.trim();return/^\[[A-Z_]+(?:-\d+)?\]$/.test(t)||/^[\d]{0,4}[*•xX]{3,}[\d]{0,4}$/.test(t)}var Pn=/^\s*-?\d+(?:\.\d+)?\s*$/;function Ct(e){let t=new Set;for(let[r,n]of e){let i=n.filter(o=>Pn.test(o));if(i.length<3)continue;i.filter(o=>N(o).text!==o).length/i.length<.5&&t.add(r)}return t}function Cn(e,t){return e.includes(t)||e.includes('"')||e.includes(`
36
- `)?`"${e.replace(/"/g,'""')}"`:e}function Gi(e){let t=(e.match(/\t/g)??[]).length,r=(e.match(/;/g)??[]).length,n=(e.match(/,/g)??[]).length;return t>n&&t>=r?" ":r>n?";":","}function Pt(e,t){let r=e.split(/\r?\n/),n=t??Gi(r[0]??""),i=Ie(r[0]??"",n),s=i.map(h=>be(h)),o={},a=Rt(),l=r.slice(1).map(h=>h===""?null:Ie(h,n)),c=new Map;for(let h of l)h?.forEach((m,g)=>c.set(g,[...c.get(g)??[],m]));let u=Ct(c),d=ge();if(d){let h=l.filter(m=>m!==null).slice(0,200);for(let m of d({name:"table",headers:i,rows:h})){let g=i.indexOf(m.column);g>=0&&!(m.how==="header"&&u.has(g))&&(s[g]={type:m.type,label:m.category})}}let f=[i.map(h=>Cn(h,n)).join(n)];for(let h of l){if(h===null){f.push("");continue}let m=h.map((g,b)=>{let p=s[b];return p&&g.trim()!==""&&!Ue(g)?(G(o,`column:${p.type}`),a(p.type,g)):u.has(b)&&Pn.test(g)?g:N(g,o).text});f.push(m.map(g=>Cn(g,n)).join(n))}return{text:f.join(`
37
- `),counts:o,columnsHidden:i.filter((h,m)=>s[m])}}var Zi=/^xl\/(pivotCache|charts|externalLinks)\//,Nn=10;function Ln(e,t,r=1){e[t]=(e[t]??0)+r}function On(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Fn(e){let t=e.replace(/<rPh\b[\s\S]*?<\/rPh>/g,""),r="";for(let n of t.matchAll(/<t(?:\s[^>]*)?>([\s\S]*?)<\/t>/g))r+=n[1];return B(r)}function Xi(e){return e?[...e.matchAll(/<si\b[^>]*>([\s\S]*?)<\/si>|<si\b[^>]*\/>/g)].map(t=>Fn(t[1]??"")):[]}var jn=/<c\b([^>]*?)(?:\/>|>([\s\S]*?)<\/c>)/g;function Be(e,t){let r=new RegExp(`\\b${t}="([^"]*)"`).exec(e);return r?r[1]:null}function ae(e,t){if(e.type==="s"){let n=/<v>([^<]*)<\/v>/.exec(e.inner);return n?t[Number(n[1])]??null:null}if(e.type==="inlineStr"){let n=/<is>([\s\S]*?)<\/is>/.exec(e.inner);return n?Fn(n[1]):null}if(e.type==="b"||e.type==="e")return null;let r=/<v>([^<]*)<\/v>/.exec(e.inner);return r?B(r[1]):null}function Ji(e){let t=[];for(let r of e.matchAll(jn)){let n=Be(r[1],"r"),i=n?/^([A-Z]+)(\d+)$/.exec(n):null;if(!i)return null;t.push({full:r[0],attrs:r[1],inner:r[2]??"",col:i[1],row:Number(i[2]),type:Be(r[1],"t")??"n"})}return t}function qi(e,t){let r=[...new Set(e.map(n=>n.row))].sort((n,i)=>n-i).slice(0,Nn);for(let n of r){let i=new Map;for(let s of e.filter(o=>o.row===n)){let o=ae(s,t),a=o?be(o):null;a&&i.set(s.col,{type:a.type,header:o.trim()})}if(i.size>0)return{row:n,cols:i}}return{row:-1,cols:new Map}}var Yi=/^xl\/worksheets\/sheet\d+\.xml$/,Qi=200;function es(e){let t=e.trim();return/^[\d.,\-+/:%$₪€\s]+$/.test(t)||t.length>60}function ts(e,t){let r=[...new Set(e.map(s=>s.row))].sort((s,o)=>s-o).slice(0,Nn),n=-1,i=-1/0;for(let s of r){let o=e.filter(c=>c.row===s).map(c=>(ae(c,t)??"").trim()).filter(Boolean);if(o.length<2)continue;let a=o.filter(c=>!es(c)).length,l=a*2-(o.length-a);l>i&&(i=l,n=s)}return n}function ns(e,t,r){let n=qi(t,r),i=ge();if(!i)return n;let s=n.row>=0?n.row:ts(t,r);if(s<0)return n;let o=t.filter(d=>d.row===s).map(d=>({col:d.col,text:(ae(d,r)??"").trim()})).filter(d=>d.text),a=new Map(o.map((d,f)=>[d.col,f])),l=new Map;for(let d of t){if(d.row<=s)continue;let f=a.get(d.col);if(f!==void 0){if(!l.has(d.row)){if(l.size>=Qi)continue;l.set(d.row,o.map(()=>""))}l.get(d.row)[f]=ae(d,r)??""}}let c=new Map(s===n.row?n.cols:[]),u=o.map(d=>d.text);for(let d of i({name:e,headers:u,rows:[...l.values()]})){let f=u.indexOf(d.column);f<0||c.set(o[f].col,{type:d.type,header:d.column,category:d.category,severity:d.severity,how:d.how})}return{row:s,cols:c}}function Lt(e,t){return`<c${e.replace(/\s*\bt="[^"]*"/,"")} t="inlineStr"><is><t xml:space="preserve">${On(t)}</t></is></c>`}var rs=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let r=t;for(let n=0;n<8;n+=1)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r>>>0}return e})();function is(e){let t=4294967295;for(let r=0;r<e.length;r+=1)t=rs[(t^e[r])&255]^t>>>8;return(t^4294967295)>>>0}var Dn=33;function Dt(e){let t=[],r=[],n=0;for(let o of e){let a=Buffer.from(o.name,"utf8"),l=o.name.endsWith("/"),c=l?Buffer.alloc(0):Ki(o.data),u=l?0:8,d=l?0:is(o.data),f=Buffer.alloc(30);f.writeUInt32LE(67324752,0),f.writeUInt16LE(20,4),f.writeUInt16LE(2048,6),f.writeUInt16LE(u,8),f.writeUInt16LE(Dn,12),f.writeUInt32LE(d,14),f.writeUInt32LE(c.length,18),f.writeUInt32LE(o.data.length,22),f.writeUInt16LE(a.length,26),t.push(f,a,c);let h=Buffer.alloc(46);h.writeUInt32LE(33639248,0),h.writeUInt16LE(20,4),h.writeUInt16LE(20,6),h.writeUInt16LE(2048,8),h.writeUInt16LE(u,10),h.writeUInt16LE(Dn,14),h.writeUInt32LE(d,16),h.writeUInt32LE(c.length,20),h.writeUInt32LE(o.data.length,24),h.writeUInt16LE(a.length,28),h.writeUInt32LE(n,42),r.push(h,a),n+=f.length+a.length+c.length}let i=Buffer.concat(r),s=Buffer.alloc(22);return s.writeUInt32LE(101010256,0),s.writeUInt16LE(e.length,8),s.writeUInt16LE(e.length,10),s.writeUInt32LE(i.length,12),s.writeUInt32LE(n,16),Buffer.concat([...t,i,s])}function Nt(e,t){let r=ie(e);if(!r||r.length===0||r.some(p=>Zi.test(p.name)))return null;let n=new Map;for(let p of r){if(p.name.endsWith("/")){n.set(p.name,Buffer.alloc(0));continue}let x=se(e,p);if(!x)return null;n.set(p.name,x)}let i=[...n.keys()].filter(p=>Yi.test(p));if(i.length===0)return null;let s=n.get("xl/sharedStrings.xml")?.toString("utf8")??null,o=Xi(s),a=new Set,l={},c=new Set,u=Rt(),d=ft();for(let p of i){let x=n.get(p).toString("utf8"),k=Ji(x);if(!k)return null;let $=ns(p.replace(/^xl\/worksheets\//,"").replace(/\.xml$/,""),k,o),L=$.row,M=new Map;for(let R of k){if(R.type!=="n"||R.row<=L)continue;let D=ae(R,o);D!==null&&M.set(R.col,[...M.get(R.col)??[],D])}let H=Ct(M),F=new Map;for(let[R,{type:D,header:z,how:Q}]of $.cols)Q==="header"&&H.has(R)||(F.set(R,D),c.add(z));let Y=x.replace(jn,(R,D,z)=>{let Q=Be(D,"r"),[,U,y]=/^([A-Z]+)(\d+)$/.exec(Q),_={full:R,attrs:D,inner:z??"",col:U,row:Number(y),type:Be(D,"t")??"n"},v=ae(_,o),E=()=>{if(_.type==="s"){let Qt=/<v>([^<]*)<\/v>/.exec(_.inner);Qt&&a.add(Number(Qt[1]))}return R};if(v===null||v.trim()==="")return E();if(d&&_.type==="n"&&H.has(U)&&_.row>L)return Ln(l,"amount"),Lt(D,"[AMOUNT]");let w=F.get(U);if(w&&_.row>L&&!Ue(v))return Ln(l,`column:${w}`),Lt(D,u(w,v));if(_.type==="n"&&H.has(U))return E();let W=N(v,l),me=t?.size?oe(W.text,t,l):W.text;return me===v?E():Lt(D,me)});n.set(p,Buffer.from(Y,"utf8"))}if(s){let p=-1,x=s.replace(/<si\b[^>]*>[\s\S]*?<\/si>|<si\b[^>]*\/>/g,k=>(p+=1,a.has(p)?k:"<si><t>[HIDDEN]</t></si>"));n.set("xl/sharedStrings.xml",Buffer.from(x,"utf8"))}for(let p of[...n.keys()].filter(x=>/^xl\/comments\d*\.xml$/.test(x))){let k=n.get(p).toString("utf8").replace(/(<t(?:\s[^>]*)?>)([\s\S]*?)(<\/t>)/g,($,L,M,H)=>{let F=N(B(M),l);return`${L}${On(t?.size?oe(F.text,t,l):F.text)}${H}`});n.set(p,Buffer.from(k,"utf8"))}let f=n.get("docProps/core.xml");if(f){let p=f.toString("utf8").replace(/(<dc:creator>)[\s\S]*?(<\/dc:creator>)/,"$1$2").replace(/(<cp:lastModifiedBy>)[\s\S]*?(<\/cp:lastModifiedBy>)/,"$1$2");n.set("docProps/core.xml",Buffer.from(p,"utf8"))}let h=n.get("xl/workbook.xml");if(h){let p=h.toString("utf8").replace(/<(\w+:)?absPath\b[^>]*\/>|<(\w+:)?absPath\b[^>]*>[\s\S]*?<\/(\w+:)?absPath>/g,"");n.set("xl/workbook.xml",Buffer.from(p,"utf8"))}let m=n.get("docProps/app.xml");if(m){let p=m.toString("utf8").replace(/(<Company>)[\s\S]*?(<\/Company>)/,"$1$2").replace(/(<Manager>)[\s\S]*?(<\/Manager>)/,"$1$2");n.set("docProps/app.xml",Buffer.from(p,"utf8"))}let g=n.has("xl/calcChain.xml"),b=r.map(p=>p.name).filter(p=>!(g&&p==="xl/calcChain.xml"));if(g)for(let p of["[Content_Types].xml","xl/_rels/workbook.xml.rels"]){let x=n.get(p);x&&n.set(p,Buffer.from(x.toString("utf8").replace(/<(Override|Relationship)\b[^>]*calcChain[^>]*\/>/g,""),"utf8"))}return{bytes:Dt(b.map(p=>({name:p,data:n.get(p)}))),counts:l,columnsHidden:[...c]}}var ce=/(^|\/)(\.env(\.[\w.-]+)?|[\w.-]+\.env(\.[\w.-]+)?)$/i,ss=/(SECRET|PASSWORD|PASSWD|PASS|PWD|TOKEN|PRIVATE|CREDENTIAL|API_?KEY|_KEY|KEY_ID|DSN|DATABASE_URL|_URI|POOLER_URL|SALT|PEPPER)$/i,os=/(^NEXT_PUBLIC_|^VITE_|^EXPO_PUBLIC_|ANON_KEY$|PUBLISHABLE_KEY$|PUBLIC_KEY$)/i;function Ot(e){let t=0;for(let r of e.split(/\r?\n/)){let n=/^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/.exec(r);if(!n||!ss.test(n[1])||os.test(n[1]))continue;let i=n[2].trim().replace(/^(['"])(.*)\1$/,"$2");i.length>=8&&!/^\$\{?[A-Z_]+\}?$/.test(i)&&t++}return t}var Bc=64*1024*1024,zc=4*1024*1024;var Wc=512*1024*1024,Vc=1024*1024*1024;var Gc=256*1024*1024;var Kc=new Hn("utf-8",{fatal:!0}),Zc=new Hn("windows-1255");var Xc=new Set([".cache",".cargo",".rustup",".npm",".pnpm-store",".yarn",".gradle",".m2",".nuget",".conda",".pyenv",".rbenv",".nvm",".volta",".bun",".deno",".docker",".android",".vscode-server",".agents",".agent",".codeium",".continue","antigravity",".antigravity","__pycache__",".venv","venv","site-packages",".next",".turbo",".expo",".nx",".parcel-cache",".svelte-kit","appdata",".trash","$recycle.bin"].map(e=>e.toLowerCase()));var al=Buffer.from("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=","base64");var bs=["Put the new key where the app reads it (for a developer machine: the NoData vault + nodata_run, not a .env file).","Check that the app still works with the new key.","Only then delete / revoke the OLD key \u2014 until you do, whoever copied it can still use it."],S=(e,t,r)=>({provider:e,url:t,steps:[...r,...bs]}),_s={"aws-access-key":S("AWS","https://console.aws.amazon.com/iam/home#/security_credentials",["Open IAM \u2192 your user \u2192 Security credentials.","Create a NEW access key (you see its secret once \u2014 keep it only in the vault)."]),"aws-secret-key":S("AWS","https://console.aws.amazon.com/iam/home#/security_credentials",["Open IAM \u2192 your user \u2192 Security credentials.","Create a NEW access key (you see its secret once \u2014 keep it only in the vault).","Mark the old key Inactive before deleting it."]),"gcp-api-key":S("Google Cloud","https://console.cloud.google.com/apis/credentials",["Open APIs & Services \u2192 Credentials.","Pick the key \u2192 Regenerate key (or create a new one and restrict it to the APIs you use)."]),"gcp-service-account":S("Google Cloud (service account)","https://console.cloud.google.com/iam-admin/serviceaccounts",["Open IAM & Admin \u2192 Service accounts \u2192 the account \u2192 Keys.","Add key \u2192 Create new key (JSON). Keep the file out of Git and out of shared folders."]),"firebase-key":S("Firebase / Google Cloud","https://console.cloud.google.com/apis/credentials",["A Firebase web key is meant to be public \u2014 restrict it instead: Credentials \u2192 the key \u2192 Application restrictions (your domains only).","If it is not a web key, regenerate it."]),"github-token":S("GitHub","https://github.com/settings/tokens",["Open Settings \u2192 Developer settings \u2192 Personal access tokens.","Generate a new token with only the scopes you need."]),"github-fine-grained":S("GitHub","https://github.com/settings/tokens?type=beta",["Open Fine-grained tokens.","Regenerate the token (or create a new one for only the repositories you need)."]),"gitlab-token":S("GitLab","https://gitlab.com/-/user_settings/personal_access_tokens",["Open Access tokens.","Create a new token with only the scopes you need."]),"stripe-secret":S("Stripe","https://dashboard.stripe.com/apikeys",["Open Developers \u2192 API keys.","Roll the secret key (Stripe can keep the old one alive for a short overlap)."]),"stripe-restricted":S("Stripe","https://dashboard.stripe.com/apikeys",["Open Developers \u2192 API keys \u2192 Restricted keys.","Roll the key, or create a new restricted key."]),"slack-token":S("Slack","https://api.slack.com/apps",["Open your app \u2192 OAuth & Permissions.","Rotate / reinstall to get a new token."]),"slack-webhook":S("Slack","https://api.slack.com/apps",["Open your app \u2192 Incoming Webhooks.","Add a new webhook URL for the channel."]),"twilio-api-key":S("Twilio","https://console.twilio.com/us1/account/keys-credentials/api-keys",["Open Account \u2192 API keys & tokens.","Create a new API key."]),"sendgrid-api-key":S("SendGrid","https://app.sendgrid.com/settings/api_keys",["Open Settings \u2192 API Keys.","Create a new key with only the permissions you need."]),"openai-key":S("OpenAI","https://platform.openai.com/api-keys",["Open API keys.","Create a new secret key."]),"openai-project-key":S("OpenAI","https://platform.openai.com/api-keys",["Open API keys (per project).","Create a new secret key for the same project."]),"anthropic-key":S("Anthropic","https://console.anthropic.com/settings/keys",["Open Settings \u2192 API keys.","Create a new key."]),"supabase-key":S("Supabase","https://supabase.com/dashboard/project/_/settings/api-keys",["Open the project \u2192 Project Settings \u2192 API Keys.","Create a new SECRET key (a service_role / secret key bypasses every database rule \u2014 treat it like a root password).","Older projects with JWT keys: rotating the JWT secret replaces every key and signs everyone out \u2014 plan it."]),"supabase-access-token":S("Supabase (personal access token \u2014 reaches every project of the account)","https://supabase.com/dashboard/account/tokens",["Open Account \u2192 Access Tokens.","Revoke this token, then generate a new one only where it is needed (CLI, MCP) \u2014 prefer a read-only MCP."]),"supabase-secret-key":S("Supabase","https://supabase.com/dashboard/project/_/settings/api-keys",["Open the project \u2192 Project Settings \u2192 API Keys.","Create a new secret key, switch your servers to it, then delete this one."]),"postgres-uri":S("PostgreSQL (the password in the connection string)","https://supabase.com/dashboard/project/_/settings/database",["Change the database user's password: in Supabase \u2192 Project Settings \u2192 Database \u2192 Reset password; elsewhere, your host's console or ALTER USER \u2026 WITH PASSWORD.","Update the connection string with the new password."]),"mongodb-uri":S("MongoDB","https://cloud.mongodb.com/",["Open Atlas \u2192 Database Access \u2192 the user \u2192 Edit \u2192 Edit password.","Update the connection string."]),"redis-uri":S("Redis","",["Reset the password in your Redis host's console (or CONFIG SET requirepass on your own server).","Update the connection string."]),"private-key":S("Private key (SSH / TLS / signing)","",["Generate a new key pair.","Register the new PUBLIC key where the old one was trusted (server authorized_keys, certificate, service settings)."]),"jwt-secret":S("Your app's JWT secret","",["Set a new long random secret in the app's configuration.","Every signed-in user will be signed out \u2014 plan the moment."]),"password-in-code":S("A password in code","",["Change the password in the system it belongs to."]),"bearer-token":S("An access token","",["Revoke the token in the service that issued it and issue a new one."])},xs=S("A credential","",["Find the service it belongs to and issue a new credential there."]);function Ft(e){return _s[e]??xs}function Wn(e){return/\.ndc$/i.test(e)||/\.clean\.[A-Za-z0-9]+$/.test(e)||ks(e)}function ks(e){return/(^|[\\/])\.nodata[\\/]/.test(e)}import{existsSync as ws,mkdirSync as pd,readFileSync as vs,statSync as jt,writeFileSync as hd}from"node:fs";import{homedir as Ss}from"node:os";import{join as Es}from"node:path";var As=()=>Es(Ss(),".nodata","flagged.json");var Vn="unread";function Gn(e){let t=e.replace(/\\/g,"/");return process.platform==="win32"?t.toLowerCase():t}var we=null;function Kn(){let e=As();try{if(!ws(e))return{};let t=jt(e).mtimeMs;if(we&&we.path===e&&we.mtimeMs===t)return we.store;let r=JSON.parse(vs(e,"utf8"));return we={path:e,mtimeMs:t,store:r},r}catch{return{}}}function ze(e){let t=Kn()[Gn(e)];if(!t)return null;try{if(jt(e).mtimeMs>t.mtimeMs+1e3)return null}catch{return null}let r=Object.fromEntries(Object.entries(t.kinds).filter(([n])=>n!==Vn));return Object.keys(r).length?r:null}function We(e){let t=Kn()[Gn(e)];if(!t||!t.kinds[Vn])return null;try{return{changed:jt(e).mtimeMs>t.mtimeMs+1e3}}catch{return null}}import{existsSync as Zn,mkdirSync as _d,readFileSync as Xn,writeFileSync as xd}from"node:fs";import{homedir as $s}from"node:os";import{join as Is}from"node:path";var Ve=()=>Is($s(),".nodata","prefs.json");function Ts(){try{let e=Zn(Ve())?JSON.parse(Xn(Ve(),"utf8")).lang:null;return e==="he"||e==="en"?e:null}catch{return null}}function Rs(){let t=process.env.LC_ALL||process.env.LC_MESSAGES||process.env.LANG||"";try{t||=Intl.DateTimeFormat().resolvedOptions().locale}catch{}return/^(he|iw)(?:[-_.@]|$)/i.test(t)?"he":"en"}function le(){return Ts()??Rs()}function Jn(){try{return Zn(Ve())&&JSON.parse(Xn(Ve(),"utf8")).amounts_sensitive===!0}catch{return!1}}function I(e,t,r=le()){return r==="he"?e:t}import{createHmac as Vs,randomBytes as Gs}from"node:crypto";import{existsSync as zt,mkdirSync as Ks,readdirSync as Zs,readFileSync as Wt,writeFileSync as Xs}from"node:fs";import{homedir as qe}from"node:os";import{basename as Js,extname as qs,isAbsolute as Ys,join as Ye,relative as Qs,resolve as eo}from"node:path";function Z(e){return typeof e=="number"&&Number.isFinite(e)?e:typeof e=="string"&&e.trim()!==""&&!Number.isNaN(Number(e))?Number(e):null}function Cs(e,t,r){return t===null||r===null?!1:t<=r?e>=t&&e<=r:e>=t||e<=r}function qn(e,t,r){switch(t){case"eq":return e===r;case"ne":return e!==r;case"in":return Array.isArray(r)&&r.includes(e);case"not_in":return Array.isArray(r)&&!r.includes(e);case"prefix":return typeof e=="string"&&typeof r=="string"&&e.toLowerCase().startsWith(r.toLowerCase());case"gte":{let n=Z(e),i=Z(r);return n!==null&&i!==null&&n>=i}case"lte":{let n=Z(e),i=Z(r);return n!==null&&i!==null&&n<=i}case"between":{let n=Z(e);return n!==null&&Array.isArray(r)&&r.length===2&&Cs(n,Z(r[0]),Z(r[1]))}default:return!1}}function Yn(e,t,r){switch(t){case"in":return Array.isArray(r)&&e.some(n=>r.includes(n));case"not_in":return Array.isArray(r)&&!e.some(n=>r.includes(n));default:return!1}}import{existsSync as Ge,mkdirSync as Ad,readdirSync as Qn,readFileSync as Ps,rmSync as $d,writeFileSync as Id,chmodSync as Td}from"node:fs";import{homedir as er}from"node:os";import{basename as Pd,isAbsolute as Ls,join as X,relative as Ds,resolve as Ns}from"node:path";var Xe=()=>X(er(),".nodata"),Os=()=>X(Xe(),"credentials.json"),Ke=()=>X(Xe(),"orgs"),Fs=()=>X(Xe(),"bindings.json"),js=/^[A-Za-z0-9_.-]{1,80}$/,Mt=e=>js.test(e)&&e!=="."&&e!=="..";function tr(e){try{return Ge(e)?JSON.parse(Ps(e,"utf8")):null}catch{return null}}function Ms(e){return e?e.device?.org_id?e.device.org_id:e.api_key?`key-${(e.key_prefix??e.api_key.slice(0,12)).replace(/[^A-Za-z0-9_-]/g,"")}`:null:null}function nr(){return Ms(tr(Os()))}function Ht(){let e=[],t=nr();t&&e.push(t);try{for(let r of Qn(Ke()))Mt(r)&&!e.includes(r)&&Ge(X(Ke(),r,"credentials.json"))&&e.push(r)}catch{}return e}var Hs=e=>process.platform==="win32"||process.platform==="darwin"?e.toLowerCase():e,Ze=e=>Hs(Ns(e.replace(/^~(?=[\\/]|$)/,er())));function Us(e,t){let r=Ds(Ze(e),Ze(t));return r===""||!r.startsWith("..")&&!Ls(r)}function J(){let e=tr(Fs());return(Array.isArray(e?.bindings)?e.bindings:[]).filter(r=>!!r&&typeof r.folder=="string"&&typeof r.org_id=="string"&&Mt(r.org_id)).map(r=>r.project===void 0||Ws(r.project)===r.project?r:{...r,project:void 0}).map(r=>r.client===void 0||typeof r.client?.org_id=="string"&&Bs.test(r.client.org_id)?r:{...r,client:void 0})}var Bs=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function rr(e,t=J()){let r=null;for(let n of t)Us(n.folder,e)&&(!r||Ze(n.folder).length>Ze(r.folder).length)&&(r=n);return r}function zs(e,t=Ht(),r=J()){if(t.length===0)return{kind:"none"};let n=rr(e,r.filter(i=>t.includes(i.org_id)));return n?{kind:"bound",org_id:n.org_id,folder:n.folder}:t.length===1?{kind:"only",org_id:t[0]}:{kind:"unbound",orgs:t}}function ir(e){let t=zs(e);return t.kind==="bound"||t.kind==="only"?t.org_id:null}function Ws(e){if(typeof e!="string")return null;let t=e.trim();return t&&t.length<=120&&!/[\u0000-\u001f\\/]/.test(t)?t:null}function sr(){let e=[],t=X(Xe(),"org-mandate.json");Ge(t)&&e.push({owner:nr(),file:t});try{for(let r of Qn(Ke())){let n=X(Ke(),r,"org-mandate.json");Mt(r)&&Ge(n)&&e.push({owner:r,file:n})}}catch{}return e}function Ut(e,t,r=J()){if(!e)return!0;let n=rr(t,r);return!n||n.org_id===e}var or=()=>Ye(qe(),".nodata","rules.json"),Je=()=>Ye(qe(),".nodata","rules-key"),ar={allow:0,ask:1,clean_copy:2,deny:3},to=["claude-code","cursor","windsurf","codex","gemini","vscode","claude-desktop"],Bt=e=>typeof e=="string"&&e.trim()?e.trim().toLowerCase():void 0,no={action:{cardinality:"scalar",ops:["eq","ne","in","not_in"],enumValues:["read","search","run","write"],label:"what the agent does (read, search, run, write)",extract:e=>e.action},"time.hour":{cardinality:"scalar",ops:["between","gte","lte","eq"],label:"hour on this computer (0-23; 18..6 wraps overnight)",extract:e=>e.now.getHours()},"time.weekday":{cardinality:"scalar",ops:["in","not_in","between","eq"],label:"weekday on this computer (0 Sunday \u2026 6 Saturday)",extract:e=>e.now.getDay()},"file.ext":{cardinality:"scalar",ops:["eq","ne","in","not_in"],label:"file type (.xlsx, .pdf, .env \u2026)",extract:e=>qs(e.path).toLowerCase()||void 0},"file.name":{cardinality:"scalar",ops:["eq","in","prefix"],label:"file name",extract:e=>Js(e.path).toLowerCase()},agent:{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:`which agent (${to.join(", ")} \u2026)`,extract:e=>Bt(e.who?.host)},"agent.type":{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:"sub-agent type inside the agent (main = the main conversation; general-purpose, explore \u2026)",extract:e=>Bt(e.who?.type)},org:{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:"which organisation the agent works for (the one its folder is bound to)",extract:e=>Bt(e.who?.org)}};function ro(){try{if(zt(Je())){let t=Wt(Je(),"utf8").trim();if(/^[0-9a-f]{64}$/.test(t))return Buffer.from(t,"hex")}}catch{}let e=Gs(32);return Ks(Ye(qe(),".nodata"),{recursive:!0}),Xs(Je(),e.toString("hex")+`
38
- `,{mode:384}),e}var io=(e,t)=>Vs("sha256",t).update(JSON.stringify(e)).digest("hex");function cr(){if(!zt(or()))return{rules:[],tampered:!1};try{let e=JSON.parse(Wt(or(),"utf8")),t=Array.isArray(e.rules)?e.rules:[],r=zt(Je())&&typeof e.mac=="string"&&e.mac===io(t,ro());return{rules:t,tampered:!r}}catch{return{rules:[],tampered:!0}}}var ve=e=>{let t=eo(e.replace(/^~(?=[\\/]|$)/,qe())).replace(/\\/g,"/");return process.platform==="win32"?t.toLowerCase():t};function q(e,t){if(e.startsWith("**/")){let n=e.slice(3).replace(/\\/g,"/").replace(/\/+$/,"").toLowerCase(),i=ve(t).toLowerCase();return i.endsWith("/"+n)||i.includes("/"+n+"/")}let r=Qs(ve(e),ve(t));return r===""||!r.startsWith("..")&&!Ys(r)}function lr(e,t,r){let n=no[e.field];if(!n)return!1;let i=n.extract(t);return n.agentScope&&i===void 0?r!=="allow":e.op==="exists"?i!==void 0&&i!=="":i===void 0?!1:n.cardinality==="set"?Yn(Array.isArray(i)?i:[],e.op,e.value):qn(i,e.op,e.value)}function Qe(e,t){let r=e.map((n,i)=>({rule:n,n:i+1})).filter(n=>q(n.rule.path,t.path)).sort((n,i)=>ve(i.rule.path).length-ve(n.rule.path).length||n.n-i.n);for(let n of r)if((n.rule.when??[]).every(i=>lr(i,t,n.rule.effect)))return{...n,touched:t.path};return null}function et(e,t,r,n,i){let s=null;for(let[o,a]of e.entries())q(a.path,t)||(a.path.startsWith("**/")?!so(t,a.path):!q(t,a.path))||(a.when??[]).every(l=>lr(l,{action:r,path:a.path,now:n,who:i},a.effect))&&(!s||ar[a.effect]>ar[s.rule.effect])&&(s={rule:a,n:o+1,touched:a.path});return s}function so(e,t){let r=0,n=(i,s)=>{if(s>5||r>4e3)return!1;let o;try{o=Zs(i,{withFileTypes:!0})}catch{return!1}for(let a of o){if(++r>4e3||!a.isDirectory()||a.name==="node_modules"||a.name===".git")continue;let l=Ye(i,a.name);if(q(t,l)||n(l,s+1))return!0}return!1};return n(e,0)}var oo={allow:["allowed","\u05DE\u05D5\u05EA\u05E8"],ask:["ask the person","\u05DC\u05E9\u05D0\u05D5\u05DC \u05D0\u05D5\u05EA\u05DA"],clean_copy:["clean copy only","\u05E8\u05E7 \u05E2\u05D5\u05EA\u05E7 \u05E0\u05E7\u05D9"],deny:["not allowed","\u05D0\u05E1\u05D5\u05E8"]};var dr=(e,t=!1)=>oo[e][t?1:0];function ur(){let e=[];for(let{owner:t,file:r}of sr())try{let n=JSON.parse(Wt(r,"utf8"));Array.isArray(n?.folder_rules)&&n.folder_rules.length&&e.push({owner:t,rules:n.folder_rules})}catch{}return e}function fr(){let e=Ht();return e.length<2?[]:J().filter(t=>e.includes(t.org_id)).map(t=>({path:t.folder,effect:"deny",when:[{field:"org",op:"ne",value:t.org_id.toLowerCase()}],note:`works for organisation ${t.org_id}; another organisation's agent does not touch it`}))}var po=new Set([".csv",".tsv",".txt",".md",".json",".log",".xml",".sql",".yaml",".yml",".eml",...Tt]),ho=50*1024*1024,pr=8,mo={israeli_id:"Israeli ID",credit_card:"card",iban:"IBAN",israeli_phone:"phone",email:"email",secret:"secret"};function Jt(e){let t=Xt(e).toLowerCase();return po.has(br(t))||ce.test(t)}var go=/^(reports|receipts)(\/|$)|^(prefs|consent|flagged|statusline-prev|key-backup|connection)\.json$|^(gate|status)\.mjs$|^(gate|answers)\.log$/i,yo=/\.nodata[\\/]+(device-key\.json|secrets\.json|credentials\.json|issuer-ed25519\.json|capsule\.json|capsule-key|shares|approvals|fabric-key\.json|machine-salt|pending-link\.json|api-shares\.json|secret-shares\.json|quarantine|bindings\.json|orgs)\b/i;function de(e){let t=tt(ue(),".nodata").replace(/\\/g,"/").toLowerCase();if(!e.replace(/\\/g,"/").toLowerCase().startsWith(t+"/"))return!1;let n=e.replace(/\\/g,"/").slice(t.length+1);return n!==""&&!go.test(n)}function bo(e){return yo.test(e)}var pe=e=>e.startsWith("mcp__"),_r=e=>/^mcp__.+__nodata_[a-z0-9_]+$/i.test(e),_o=/(path|file|dir|folder|root|uri|target|source|destination|cwd)/i,xo=/(write|edit|create|save|update|delete|remove|move|rename|append|put|upload|patch|insert|mkdir)/i,ko=/(search|grep|find|glob|list|tree|director|query)/i,hr=16;function it(e){let t=e.split("__").slice(2).join("__");return xo.test(t)?"write":ko.test(t)?"search":"read"}function Ee(e,t){let r=[],n=(s,o)=>{let a=s.trim();if(/^file:\/\//i.test(a))try{a=decodeURIComponent(new URL(a).pathname).replace(/^\/([a-zA-Z]:)/,"$1")}catch{return}else if(!(o||/^(~[\\/]|\/|[a-zA-Z]:[\\/])/.test(a)))return;if(!a||a.length>1024||/[\n\r]/.test(a)||/^[a-z][a-z0-9+.-]*:\/\//i.test(a))return;let l=C(t,a.replace(/^~(?=[\\/]|$)/,ue()));!r.includes(l)&&r.length<hr&&r.push(l)},i=(s,o,a)=>{if(!(a>3||r.length>=hr)){if(typeof s=="string")n(s,_o.test(o));else if(Array.isArray(s))for(let l of s.slice(0,50))i(l,o,a+1);else if(s&&typeof s=="object")for(let[l,c]of Object.entries(s))i(c,l,a+1)}};return i(e,"",0),r}var Vt=/(\.claude[\\/]+settings(\.local)?\.json|node_modules[\\/]+@nodatachat[\\/])/i,wo=/(>|\bsed\s+-i|\btee\b|\b(rm|del|erase|mv|move|cp|copy|ren|rename)\b|Set-Content|Add-Content|Out-File|Remove-Item|Move-Item|Copy-Item|Rename-Item|WriteAllText|writeFileSync|unlinkSync)/i;function vo(e,t,r){if(e==="Bash"||e==="PowerShell"){let i=typeof t.command=="string"?t.command:"";return Vt.test(i)&&wo.test(i)}if(pe(e))return it(e)==="write"&&Ee(t,r).some(i=>Vt.test(i.replace(/\\/g,"/")));let n=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";return n?Vt.test((fe(n)?n:C(r,n)).replace(/\\/g,"/")):!1}function So(e){return Jt(e)||ze(e)!==null||We(e)!==null}var nt=class extends Error{};function Eo(e){let t=br(e).toLowerCase(),r=uo(e),n,i;if(t===".csv"||t===".tsv")i=r.toString("utf8"),n=Pt(i,t===".tsv"?" ":void 0).counts;else if(Tt.has(t)){let o=t===".xlsx"||t===".xlsm"?Nt(r):null,a=It(r,t);if(!a&&!o)throw new nt;i=a?.text??"",n=o?o.counts:N(i).counts}else i=r.toString("utf8"),n=N(i).counts;let s=$e.filter(o=>o.pattern.test(i)).length;return ce.test(Xt(e).toLowerCase())&&(s=Math.max(s,Ot(i))),s&&(n.secret=Math.max(n.secret??0,s)),n}var Ao={israeli_id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",credit_card:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9",iban:"IBAN",israeli_phone:"\u05D8\u05DC\u05E4\u05D5\u05DF",phone:"\u05D8\u05DC\u05E4\u05D5\u05DF",email:'\u05D3\u05D5\u05D0"\u05DC',secret:"\u05E1\u05D5\u05D3",name:"\u05E9\u05DD",address:"\u05DB\u05EA\u05D5\u05D1\u05EA",policy:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4",agent_id:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF",financial:"\u05DE\u05D9\u05D3\u05E2 \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9",medical:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9",dob:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4",bank_account:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7",plate:"\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"};function xr(e){let t=le()==="he",r=n=>(t?Ao[n]:mo[n])??n;return Object.entries(e).sort((n,i)=>i[1]-n[1]).map(([n,i])=>`${i} ${n.startsWith("column:")?`${r(n.slice(7))} (${t?"\u05E2\u05DE\u05D5\u05D3\u05D4":"column"})`:r(n)}`).join(", ")}function $o(e){return xr(e)}function kr(e,t,r){let n=s=>fe(s)?s:C(r,s),i=s=>{try{return Zt(s).isFile()}catch{return!1}};if(e==="Read"&&typeof t.file_path=="string")return[n(t.file_path)];if(e==="Grep"&&typeof t.path=="string"&&i(n(t.path)))return[n(t.path)];if(pe(e))return it(e)==="write"?[]:Ee(t,r).filter(i).slice(0,pr);if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"){let s=t.command,o=[...[...s.matchAll(/"([^"]*)"/g)].map(l=>l[1]),...[...s.matchAll(/'([^']*)'/g)].map(l=>l[1]),...s.split(/[\s|;&<>(),=`]+/)],a=[];for(let l of o){let c=l.trim().replace(/^['"]|['"]$/g,"").replace(/\\\\/g,"\\").replace(/^~(?=[\\/])/,ue()).replace(/^\/([a-zA-Z])\//,(d,f)=>process.platform==="win32"?`${f}:/`:d);if(!c)continue;let u=n(c);if(!(!Jt(c)&&!de(u)&&ze(u)===null&&We(u)===null)&&(i(u)&&!a.includes(u)&&a.push(u),a.length>=pr))break}return a}return[]}function O(e){return e.replace(/\\+/g,"/")}function Io(e){let t=e.trim();return/[;|&\n]|`|\$\(/.test(t.replace(/^cmd(?:\.exe)?\s+\/c\s+/i,""))?!1:/^(?:cmd(?:\.exe)?\s+\/c\s+)?(?:explorer(?:\.exe)?|start|invoke-item|ii|start-process|open|xdg-open)\b/i.test(t)}function mr(e,t){return`${O(e)}: ${t?I("\u05D4\u05E1\u05E8\u05D9\u05E7\u05D4 \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D4 \u05DC\u05D0 \u05D4\u05E6\u05DC\u05D9\u05D7\u05D4 \u05DC\u05E7\u05E8\u05D5\u05D0 \u05D0\u05D5\u05EA\u05D5, \u05D5\u05D4\u05D5\u05D0 \u05D4\u05E9\u05EA\u05E0\u05D4 \u05DE\u05D0\u05D6 \u2014 \u05DC\u05D0 \u05E0\u05D1\u05D3\u05E7, \u05D4\u05EA\u05D9\u05D9\u05D7\u05E1 \u05D0\u05DC\u05D9\u05D5 \u05DB\u05E8\u05D2\u05D9\u05E9","your last scan could not read it, and it changed since \u2014 NOT checked, treat it as sensitive"):I("\u05D4\u05E1\u05E8\u05D9\u05E7\u05D4 \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D4 \u05DC\u05D0 \u05D4\u05E6\u05DC\u05D9\u05D7\u05D4 \u05DC\u05E7\u05E8\u05D5\u05D0 \u05D0\u05D5\u05EA\u05D5 \u2014 \u05DC\u05D0 \u05E0\u05D1\u05D3\u05E7, \u05D4\u05EA\u05D9\u05D9\u05D7\u05E1 \u05D0\u05DC\u05D9\u05D5 \u05DB\u05E8\u05D2\u05D9\u05E9","your last scan could not read it \u2014 NOT checked, treat it as sensitive")}`}function wr(e,t,r){let n=[];if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"&&Io(t.command))return n;for(let i of kr(e,t,r)){if(!So(i)||Wn(i)||!yr(i))continue;let s=We(i);if(!Jt(i)){let o=ze(i);o?n.push({line:`${O(i)}: ${I("\u05E7\u05D5\u05D3 \u05E9\u05D4\u05E1\u05E8\u05D9\u05E7\u05D4 \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D4 \u05E1\u05D9\u05DE\u05E0\u05D4","code your last scan flagged")} \u2014 ${$o(o)}`,kind:"flagged_code"}):s&&n.push({line:mr(i,s.changed),kind:"unread"});continue}try{if(Zt(i).size>ho)n.push({line:`${O(i)}: too large to check here (over 50 MB)`,kind:"too_large"});else{let o=Eo(i);Object.keys(o).length?n.push({line:`${O(i)}: ${xr(o)}`,kind:"data_file"}):s&&!s.changed&&n.push({line:mr(i,!1),kind:"unread"})}}catch(o){n.push(o instanceof nt?{line:`${O(i)}: ${I("\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05DC\u05E7\u05E8\u05D5\u05D0 \u05D0\u05EA \u05D4\u05D8\u05E7\u05E1\u05D8 (\u05E1\u05E8\u05D9\u05E7\u05D4, \u05D4\u05E6\u05E4\u05E0\u05D4 \u05D0\u05D5 \u05D2\u05D5\u05E4\u05DF \u05DC\u05D0 \u05E0\u05EA\u05DE\u05DA) \u2014 \u05DC\u05D0 \u05E0\u05D1\u05D3\u05E7, \u05D4\u05EA\u05D9\u05D9\u05D7\u05E1 \u05D0\u05DC\u05D9\u05D5 \u05DB\u05E8\u05D2\u05D9\u05E9","its text could not be read (a scan, encryption or an unsupported font) \u2014 NOT checked, treat it as sensitive")}`,kind:"unreadable"}:{line:`${O(i)}: could not be checked`,kind:"unreadable"})}}return n}var Kt=/(?:\.aws[\\/]+credentials|\.npmrc|\.yarnrc\.yml|\.pypirc|[._]netrc|\.git-credentials|\.pgpass|\.docker[\\/]+config\.json|\.kube[\\/]+config|gh[\\/]+hosts\.yml|\.supabase[\\/]+access-token|application_default_credentials\.json|gcloud[\\/]+(?:credentials|access_tokens)\.db|\.azure[\\/]+(?:msal_token_cache|accessTokens)|com\.vercel\.cli[\\/]+auth\.json|\.ssh[\\/]+id_(?:rsa|ed25519|ecdsa|dsa)(?![\w.]))/i,rt=/(?:TOKEN|SECRET|PASSW(?:OR)?D|API_?KEY|PRIVATE_?KEY|ACCESS_?KEY|CREDENTIAL|SERVICE_ROLE|_KEY$)/i,vr="the vault's secrets, outside nodata_run's per-command approval",To=/(?:^|[^\w.@-])(?:npx|pnpx|bunx|npm|pnpm|yarn|bun|node|nodejs|deno|nodata-mcp)(?:\.cmd|\.exe|\.ps1|\.js)?(?![\w-])[\s\S]*?(?<![\w-])secrets-(?:run|login|set|import|share)(?![\w-])/i;function Ro(e){return To.test(e)}var Co=[[/^(?:env|set|export\s+-p|declare\s+-x|get-childitem\s+env:\S*|gci\s+env:\S*|dir\s+env:\S*|ls\s+env:\S*)\s*$/i,"every environment variable"],[/^gh\s+auth\s+(?:token\b|status\b.*(?:\s-t\b|--show-token))/i,"the GitHub login token"],[/^gcloud\s+auth\s+(?:application-default\s+)?print-(?:access|identity)-token\b/i,"a Google Cloud access token"],[/^az\s+account\s+get-access-token\b/i,"an Azure access token"],[/^aws\s+(?:configure\s+(?:get\s+\S*(?:secret|token)\S*|export-credentials)|sts\s+get-session-token|ecr\s+get-login-password)\b/i,"AWS credentials"],[/^supabase\s+projects\s+api-keys\b/i,"the project's Supabase keys (incl. service_role)"],[/^heroku\s+auth:token\b/i,"the Heroku login token"],[/^op\s+(?:read|item\s+get)\b/i,"a 1Password secret"],[/^vault\s+(?:kv\s+get|read)\b/i,"a Vault secret"],[/^doppler\s+secrets\b/i,"Doppler secrets"],[/^security\s+find-(?:generic|internet)-password\b.*\s-w\b/i,"a keychain password"],[/^git\s+credential\s+fill\b/i,"a saved Git password"],[/^node\s+\S*nodata-pull\.mjs\b/i,vr],[/^kubectl\s+get\s+secrets?\b.*\s-o\b/i,"Kubernetes secrets"]],Po=/^(?:echo|printf|print|write-output|write-host|say)\b/i,Sr=/^(?:cat|type|get-content|gc|more|less|head|tail|bat|nl|strings|xxd|od|hexdump|grep|egrep|rg|select-string|sls|awk|sed|jq|yq|python\d*|py|node|ruby|perl)\b/i,Lo=/\$\{?env:([A-Za-z_][\w]*)|\$\{?([A-Za-z_][\w]*)|%([A-Za-z_][\w]*)%|GetEnvironmentVariable\(\s*['"]([^'"]+)['"]/g;function Do(e,t,r){let n=e==="Read"&&typeof t.file_path=="string"?t.file_path:e==="Grep"&&typeof t.path=="string"?t.path:"";if(n&&Kt.test((fe(n)?n:C(r,n)).replace(/\\/g,"/")))return`a saved login (${Xt(n)})`;if(e!=="Bash"&&e!=="PowerShell"||typeof t.command!="string")return null;let i=t.command.split(/(\|\||&&|[;|\n])/);for(let s=0;s<i.length;s+=2){let o=i[s+1]==="|",a=i[s].trim().replace(/^(?:sudo\s+|cmd(?:\.exe)?\s+\/c\s+|powershell(?:\.exe)?\s+(?:-command\s+)?|pwsh\s+(?:-c(?:ommand)?\s+)?)+/i,"").replace(/^["']|["']$/g,"");if(Sr.test(a)&&Kt.test(a))return"a saved login file";if(Ro(a))return vr;for(let[c,u]of Co)if(c.test(a))return u;let l=a.match(/^printenv(?:\s+(\S+))?\s*$/i);if(l&&(!l[1]||rt.test(l[1])))return l[1]?`the variable ${l[1]}`:"every environment variable";if(!o&&(Po.test(a)||/GetEnvironmentVariable/i.test(a)))for(let c of a.matchAll(Lo)){let u=c[1]??c[2]??c[3]??c[4]??"";if(rt.test(u))return`the variable ${u}`}}return null}var Er=/^(?:grep|egrep|fgrep|rg|ag|ack|git\s+grep|findstr|select-string|sls)\b/i,No=/(?:^|\s)(?:-[a-zA-Z]*[rR][a-zA-Z]*|--recursive|--dereference-recursive|\/s|-recurse)(?=\s|$)/i,Oo=new Set(["node_modules",".git",".next","dist","build",".venv","venv","__pycache__",".cache"]),gr=4e3,Fo=5;function jo(e){let t=0,r=0,n=(i,s)=>{if(s>Fo||t>gr)return;let o;try{o=lo(i,{withFileTypes:!0})}catch{return}for(let a of o){if(++t>gr)return;let l=tt(i,a.name);a.isDirectory()?Oo.has(a.name)||n(l,s+1):(ce.test(a.name.toLowerCase())||Kt.test(l.replace(/\\/g,"/"))||de(l))&&r++}};return n(e,0),r}var Se=e=>{try{return Zt(e).isDirectory()}catch{return!1}};function Mo(e,t){let r=fo(C(t),C(e));return r===""||!r.startsWith("..")&&!fe(r)}function Ho(e,t,r){let n=s=>C(r,s.replace(/^~(?=[\\/]|$)/,ue())),i=[];if(e==="Grep"){let s=typeof t.path=="string"&&t.path?n(t.path):C(r);if(Se(s)){let o=[t.pattern,t.glob,t.type].filter(a=>typeof a=="string").join(" ");i.push({roots:[s],bySecret:rt.test(o)||/\.env|env\b/i.test(String(t.glob??""))})}}else if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string")for(let s of t.command.split(/\|\||&&|[;|\n]/)){let o=s.trim().replace(/^(?:sudo\s+|xargs\s+(?:-\S+\s+)*)/i,"");if(!/^find\b.*-exec\s+(?:grep|egrep|rg|cat)\b/i.test(o)&&!(Er.test(o)&&(No.test(o)||/^(?:rg|ag|ack|git\s+grep)\b/i.test(o))))continue;let c=o.split(/\s+/).slice(1).map(u=>u.replace(/^['"]|['"]$/g,"")).filter(u=>u&&!u.startsWith("-")&&!/^\/[a-z]$/i.test(u)).map(n).filter(Se);i.push({roots:c.length?c:[C(r)],bySecret:rt.test(o)||/\.env\b/i.test(o)})}for(let s of i)for(let o of s.roots){if(!s.bySecret&&Mo(o,r))continue;let a=jo(o);if(a>0)return{why:s.bySecret?"by_name":"outside",root:o,keyFiles:a}}return null}var Ar=new Set(["Write","Edit","MultiEdit","NotebookEdit"]),Gt=e=>Ar.has(e)||pe(e)&&it(e)==="write";function $r(e,t,r){let n=i=>C(r,i.replace(/^~(?=[\\/]|$)/,ue()));if(e==="Read"&&typeof t.file_path=="string")return{action:"read",paths:[n(t.file_path)],roots:[]};if(Ar.has(e)){let i=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";return i?{action:"write",paths:[n(i)],roots:[]}:null}if(e==="Grep"||e==="Glob"){let i=typeof t.path=="string"&&t.path?n(t.path):C(r);return{action:"search",paths:[i],roots:Se(i)?[i]:[]}}if(pe(e)){let i=Ee(t,r);if(!i.length)return null;let s=it(e);return{action:s,paths:i,roots:s==="search"?i.filter(Se):[]}}if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"){let i=t.command,o=[...[...i.matchAll(/"([^"]*)"/g)].map(c=>c[1]),...[...i.matchAll(/'([^']*)'/g)].map(c=>c[1]),...i.split(/[\s|;&<>(),=`]+/)].map(c=>c.trim()).filter(c=>c&&!c.startsWith("-")&&/[\\/.~]/.test(c)).map(n).filter(c=>yr(c)),a=i.split(/\|\||&&|[;|\n]/).some(c=>Er.test(c.trim())||/^find\b/i.test(c.trim())),l=o.filter(Se);return{action:a?"search":Sr.test(i.trim())?"read":"run",paths:[C(r),...o],roots:a?l.length?l:[C(r)]:[]}}return null}function Uo(e,t,r,n=new Date,i){let s=$r(e,t,r);if(!s)return null;let{rules:o,tampered:a}=cr(),l=ur();if(!o.length&&!l.length)return null;let c={allow:0,ask:1,clean_copy:2,deny:3},u=J(),d=null;for(let{owner:h,rules:m}of l){for(let g of s.paths){if(!Ut(h,g,u))continue;let b=Qe(m,{action:s.action,path:g,now:n,who:i});b&&(!d||c[b.rule.effect]>c[d.rule.effect])&&(d={...b,org:!0})}for(let g of s.roots){if(!Ut(h,g,u))continue;let b=et(m,g,s.action,n,i);b&&b.rule.effect!=="allow"&&(!d||c[b.rule.effect]>c[d.rule.effect])&&(d={...b,org:!0})}}let f=Bo(o,a,s,n,c,i);return d&&(!f||c[d.rule.effect]>=c[f.rule.effect])?d:f}function Bo(e,t,r,n,i,s){if(!e.length)return null;if(t){for(let a of r.paths){let l=e.find(c=>q(c.path,a)||q(a,c.path));if(l)return{rule:{...l,effect:"deny",when:[]},n:e.indexOf(l)+1,touched:a,tampered:!0}}return null}let o=null;for(let a of r.paths){let l=Qe(e,{action:r.action,path:a,now:n,who:s});l&&(!o||i[l.rule.effect]>i[o.rule.effect])&&(o=l)}for(let a of r.roots){let l=et(e,a,r.action,n,s);l&&l.rule.effect!=="allow"&&(!o||i[l.rule.effect]>i[o.rule.effect])&&(o=l)}return o}function zo(e){let t;try{t=typeof e=="string"?e:JSON.stringify(e??"")}catch{return{}}if(!t)return{};t=t.slice(0,2*1024*1024);let r={};for(let n of ye()){let i=new RegExp(n.pattern.source,n.pattern.flags.includes("g")?n.pattern.flags:n.pattern.flags+"g"),s=(t.match(i)??[]).length;s&&(r[n.id]=(r[n.id]??0)+s)}return r}function Wo(e){let t=Object.keys(e);if(t.length===0)return null;let r=t.reduce((i,s)=>i+e[s],0),n=[...new Set(t.map(i=>{let s=Ft(i);return s.url?`${s.provider}: ${s.url}`:s.provider}))];return`NoData \xB7 A CREDENTIAL IS IN THIS OUTPUT (${r}: ${t.join(", ")}). It is now in this conversation and was sent to the AI model. Do not repeat, quote, shorten, mask-by-hand or reuse it \u2014 not in your answer, not in a command, not in a file. Tell the user in one line that a key was shown here and should be replaced at its provider (${n.join(" \xB7 ")}); nodata_scan_folder gives the full steps. Next time, run commands that need secrets through nodata_run: the output comes back with every value blanked.`+(le()==="he"?" Answer the user in Hebrew.":"")}function Vo(e,t,r,n){let i=fr();if(!i.length)return null;let s=$r(e,t,r);if(!s)return null;let o=new Date,a=s.paths.map(c=>Qe(i,{action:s.action,path:c,now:o,who:n})).find(Boolean)??s.roots.map(c=>et(i,c,s.action,o,n)).find(Boolean);if(!a)return null;let l=String(a.rule.when?.[0]?.value??"");return I(`NoData \u05D7\u05E1\u05DD: ${O(a.rule.path)} \u05E2\u05D5\u05D1\u05D3\u05EA \u05E2\u05D1\u05D5\u05E8 \u05D0\u05E8\u05D2\u05D5\u05DF \u05D0\u05D7\u05E8 (${l}) \u05DE\u05D6\u05D4 \u05E9\u05DC \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D6\u05D5. \u05E1\u05D5\u05DB\u05DF \u05E9\u05E2\u05D5\u05D1\u05D3 \u05DB\u05D0\u05DF \u05E2\u05D1\u05D5\u05E8 \u05D0\u05E8\u05D2\u05D5\u05DF \u05D0\u05D7\u05D3 \u05DC\u05D0 \u05E0\u05D5\u05D2\u05E2 \u05D1\u05E7\u05D1\u05E6\u05D9\u05DD \u05E9\u05DC \u05D0\u05E8\u05D2\u05D5\u05DF \u05D0\u05D7\u05E8 \u2014 \u05D2\u05DD \u05DC\u05D0 \u05D1\u05D0\u05D9\u05E9\u05D5\u05E8. \u05DC\u05E2\u05D1\u05D5\u05D3\u05D4 \u05E9\u05DD: \u05DC\u05E4\u05EA\u05D5\u05D7 \u05D0\u05EA \u05D4\u05E1\u05D5\u05DB\u05DF \u05D1\u05EA\u05D5\u05DA \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D4\u05D9\u05D0.`,`NoData refused: ${O(a.rule.path)} works for another organisation (${l}) than this folder. An agent working here for one organisation does not touch another organisation's files \u2014 not even with approval. To work there, start the agent inside that folder.`)}function Go(e,t,r){let n=(e==="Bash"||e==="PowerShell")&&typeof t.command=="string"?t.command:"",i=(e==="Grep"||e==="Glob")&&typeof t.path=="string"?t.path:e==="Read"&&typeof t.file_path=="string"?t.file_path:"";return n&&bo(n)||i&&de(fe(i)?i:C(r,i))||pe(e)&&Ee(t,r).some(de)||kr(e,t,r).some(de)?I("NoData \u05D7\u05E1\u05DD: \u05D6\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05DE\u05E4\u05EA\u05D7 \u05E9\u05DC NoData (\u05DE\u05E4\u05EA\u05D7 \u05D4\u05DE\u05DB\u05E9\u05D9\u05E8, \u05D4\u05DB\u05E1\u05E4\u05EA \u05D0\u05D5 \u05D4\u05D0\u05E8\u05D2\u05D5\u05DF). \u05DE\u05D9 \u05E9\u05E7\u05D5\u05E8\u05D0 \u05D0\u05D5\u05EA\u05D5 \u05D9\u05DB\u05D5\u05DC \u05DC\u05E4\u05EA\u05D5\u05D7 \u05DB\u05DC \u05E7\u05D5\u05D1\u05E5 \u05E0\u05E2\u05D5\u05DC, \u05D5\u05DC\u05DB\u05DF \u05D0\u05E3 \u05E1\u05D5\u05DB\u05DF \u05DC\u05D0 \u05E7\u05D5\u05E8\u05D0 \u05D0\u05D5\u05EA\u05D5 \u2014 \u05D2\u05DD \u05DC\u05D0 \u05D1\u05D0\u05D9\u05E9\u05D5\u05E8. \u05DC-NoData \u05D0\u05D9\u05DF \u05E2\u05D5\u05EA\u05E7 \u05E9\u05DC \u05D4\u05DE\u05E4\u05EA\u05D7 \u05D5\u05D0\u05D9\u05DF \u05D3\u05E8\u05DA \u05DC\u05E9\u05D7\u05D6\u05E8 \u05D0\u05D5\u05EA\u05D5: \u05D4\u05D2\u05D9\u05D1\u05D5\u05D9 \u05E9\u05DC\u05DA \u05D4\u05D5\u05D0 \u05D4\u05D3\u05E8\u05DA \u05D4\u05D9\u05D7\u05D9\u05D3\u05D4. \u05DC\u05D2\u05D9\u05D1\u05D5\u05D9, \u05D1\u05D8\u05E8\u05DE\u05D9\u05E0\u05DC \u05D5\u05DC\u05D0 \u05D1\u05E6'\u05D0\u05D8: npx -y @nodatachat/mcp@latest key-backup E: (E: = \u05D4\u05D3\u05D9\u05E1\u05E7-\u05D0\u05D5\u05DF-\u05E7\u05D9).","NoData refused: this is one of NoData's own key files (the device key, the vault login or the org credential). Whoever reads it can open every sealed file, so no agent reads it \u2014 not even with approval. NoData holds no copy of this key and cannot recover it: your backup is the only recovery. To back it up, in a terminal (not the chat): npx -y @nodatachat/mcp@latest key-backup E: (E: = your USB drive). Do not suggest other recovery routes \u2014 there are none."):null}function Ko(e,t,r,n,i){if(_r(e))return{decision:"allow"};let s=ir(r),o={...i,org:s??void 0},a=Go(e,t,r);if(a)return{decision:"deny",reason:a,kind:"nodata_key"};let l=Vo(e,t,r,o);if(l)return{decision:"deny",reason:l,kind:"org_wall"};let c=Do(e,t,r);if(c){let b=I(`NoData: \u05D4\u05E4\u05E7\u05D5\u05D3\u05D4 \u05D4\u05D6\u05D5 \u05DE\u05E6\u05D9\u05D2\u05D4 ${c}. \u05DE\u05D4 \u05E9\u05D4\u05D9\u05D0 \u05DE\u05D3\u05E4\u05D9\u05E1\u05D4 \u05E0\u05DB\u05E0\u05E1 \u05DC\u05E9\u05D9\u05D7\u05D4 \u05D5\u05E0\u05E9\u05DC\u05D7 \u05DC\u05DE\u05D5\u05D3\u05DC \u05D4\u05D1\u05D9\u05E0\u05D4 \u05D4\u05DE\u05DC\u05D0\u05DB\u05D5\u05EA\u05D9\u05EA, \u05D5\u05DE\u05E4\u05EA\u05D7 \u05E9\u05E0\u05E8\u05D0\u05D4 \u05DB\u05D0\u05DF \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D7\u05DC\u05D9\u05E3.
39
- \u05D1\u05DE\u05E7\u05D5\u05DD \u05D6\u05D4: \u05DC\u05D4\u05E8\u05D9\u05E5 \u05D0\u05D5\u05EA\u05D4 \u05D1\u05E2\u05E6\u05DE\u05DA \u05D1\u05D8\u05E8\u05DE\u05D9\u05E0\u05DC (\u05DC\u05D0 \u05D1\u05E6'\u05D0\u05D8), \u05D0\u05D5 nodata_run \u2014 \u05E9\u05DE\u05E8\u05D9\u05E5 \u05E4\u05E7\u05D5\u05D3\u05D4 \u05E2\u05DD \u05D4\u05E1\u05D5\u05D3\u05D5\u05EA \u05D5\u05DE\u05D7\u05D6\u05D9\u05E8 \u05D0\u05EA \u05D4\u05E4\u05DC\u05D8 \u05DB\u05E9\u05DB\u05DC \u05E2\u05E8\u05DA \u05DE\u05D5\u05E1\u05EA\u05E8.`+(n?"":" \u05DC\u05D0\u05E9\u05E8 \u05D1\u05DB\u05DC \u05D6\u05D0\u05EA?"),`NoData: this shows ${c}. Whatever it prints enters the conversation and goes to the AI model, and a key seen there has to be replaced.
40
- Instead: run it yourself in a terminal (not the chat), or nodata_run \u2014 it runs a command with the secrets and returns the output with every value blanked.`+(n?"":" Allow anyway?"));return{decision:n?"deny":"ask",reason:b,kind:"credential_print"}}if((Gt(e)||e==="Bash"||e==="PowerShell")&&vo(e,t,r))return{decision:"ask",kind:"gate_holder",reason:I("NoData: \u05D4\u05E4\u05E2\u05D5\u05DC\u05D4 \u05D4\u05D6\u05D5 \u05DE\u05E9\u05E0\u05D4 \u05D0\u05EA \u05DE\u05D4 \u05E9\u05DE\u05E4\u05E2\u05D9\u05DC \u05D0\u05EA \u05D4\u05E9\u05E2\u05E8 \u2014 \u05D4\u05D4\u05D2\u05D3\u05E8\u05D5\u05EA \u05E9\u05DC Claude Code \u05D0\u05D5 \u05D4\u05E7\u05D5\u05D3 \u05D4\u05DE\u05D5\u05EA\u05E7\u05DF \u05E9\u05DC NoData. \u05D0\u05D7\u05E8\u05D9 \u05E9\u05D9\u05E0\u05D5\u05D9 \u05DB\u05D6\u05D4 \u05D9\u05D9\u05EA\u05DB\u05DF \u05E9\u05D4\u05E9\u05E2\u05E8 \u05DC\u05D0 \u05D9\u05D1\u05D3\u05D5\u05E7 \u05D9\u05D5\u05EA\u05E8. \u05DC\u05D0\u05E9\u05E8 \u05E8\u05E7 \u05D0\u05DD \u05D0\u05EA\u05D4 \u05D1\u05D9\u05E7\u05E9\u05EA \u05D0\u05EA \u05D6\u05D4.","NoData: this changes what runs the gate \u2014 Claude Code's settings or NoData's installed code. After such a change the gate may stop checking. Approve only if you asked for it.")};if(Gt(e)){let b=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";if((pe(e)?Ee(t,r):b?[fe(b)?b:C(r,b)]:[]).some(de))return{decision:"deny",kind:"nodata_write",reason:I("NoData \u05D7\u05E1\u05DD: \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 ~/.nodata \u05E1\u05D2\u05D5\u05E8\u05D4 \u05DC\u05E1\u05D5\u05DB\u05E0\u05D9\u05DD, \u05D2\u05DD \u05DC\u05DB\u05EA\u05D9\u05D1\u05D4 (\u05DB\u05DC\u05DC\u05D9\u05DD, \u05DE\u05E4\u05EA\u05D7\u05D5\u05EA, \u05D0\u05D9\u05E9\u05D5\u05E8\u05D9\u05DD).","NoData refused: ~/.nodata is closed to agents, writes included (rules, keys, approvals).")}}let u=Uo(e,t,r,new Date,o);if(u&&u.rule.effect!=="allow"){let b=le()==="he",p=u.tampered?I("\u05E7\u05D5\u05D1\u05E5 \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05E9\u05D5\u05E0\u05D4 \u05E9\u05DC\u05D0 \u05D3\u05E8\u05DA nodata_rules, \u05D5\u05DC\u05DB\u05DF \u05DB\u05DC \u05E0\u05EA\u05D9\u05D1 \u05E9\u05D4\u05D5\u05D0 \u05DE\u05D6\u05DB\u05D9\u05E8 \u05E1\u05D2\u05D5\u05E8 \u05E2\u05D3 \u05E9\u05EA\u05E9\u05DE\u05D5\u05E8 \u05D0\u05EA \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05DE\u05D7\u05D3\u05E9.","the rules file was changed outside nodata_rules, so every path it names is closed until you save the rules again."):`${u.org?I("\u05DB\u05DC\u05DC \u05E9\u05DC \u05D4\u05D0\u05E8\u05D2\u05D5\u05DF","organisation rule"):I("\u05DB\u05DC\u05DC","rule")} ${u.n}: ${u.rule.path.startsWith("**/")?u.rule.path:O(u.rule.path)} \u2192 ${dr(u.rule.effect,b)}${u.rule.note?` (${u.rule.note})`:""}`,x=u.rule.effect==="clean_copy"?I(`NoData: ${p}. \u05D4\u05E1\u05D5\u05DB\u05DF \u05E2\u05D5\u05D1\u05D3 \u05DB\u05D0\u05DF \u05E8\u05E7 \u05E2\u05DC \u05E2\u05D5\u05EA\u05E7 \u05E0\u05E7\u05D9: nodata_redact \u05D9\u05D5\u05E6\u05E8 \u05D0\u05D5\u05EA\u05D5 (\u05DE\u05D6\u05D4\u05D9\u05DD \u05DE\u05D5\u05D7\u05DC\u05E4\u05D9\u05DD, \u05E0\u05D1\u05D3\u05E7 \u05DC\u05E4\u05E0\u05D9 \u05E9\u05D9\u05DE\u05D5\u05E9).`,`NoData: ${p}. The agent works here on a clean copy only: nodata_redact makes one (identifiers replaced, checked before use).`):u.rule.effect==="ask"?I(`NoData: ${p}. \u05DC\u05D0\u05E9\u05E8?`,`NoData: ${p}. Allow?`):I(`NoData: ${p}. \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05E9\u05DC \u05D4\u05E7\u05D1\u05E6\u05D9\u05DD \u05D5\u05D4\u05EA\u05D9\u05E7\u05D9\u05D5\u05EA \u05E9\u05DC\u05DA: nodata_rules.`,`NoData: ${p}. Your file and folder rules: nodata_rules.`);return{decision:u.rule.effect==="ask"?"ask":"deny",reason:x,kind:"rule"}}if(Gt(e))return{decision:"allow"};let d=Ho(e,t,r);if(d){let b=O(d.root),p=I(`NoData: \u05D6\u05D4 ${d.why==="by_name"?"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E1\u05D5\u05D3 \u05DC\u05E4\u05D9 \u05E9\u05DD":"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05DE\u05D7\u05D5\u05E5 \u05DC\u05E4\u05E8\u05D5\u05D9\u05E7\u05D8"}, \u05D1\u05EA\u05D5\u05DA ${b}, \u05E9\u05D9\u05E9 \u05D1\u05D4 ${d.keyFiles} \u05E7\u05D1\u05E6\u05D9 \u05DE\u05E4\u05EA\u05D7\u05D5\u05EA (.env, \u05D4\u05EA\u05D7\u05D1\u05E8\u05D5\u05D9\u05D5\u05EA). \u05DE\u05D4 \u05E9\u05D4\u05D7\u05D9\u05E4\u05D5\u05E9 \u05D9\u05DE\u05E6\u05D0 \u05E0\u05DB\u05E0\u05E1 \u05DC\u05E9\u05D9\u05D7\u05D4, \u05D5\u05DE\u05E4\u05EA\u05D7 \u05E9\u05E0\u05DE\u05E6\u05D0 \u05DB\u05DA \u05D9\u05DB\u05D5\u05DC \u05DC\u05E9\u05DE\u05E9 \u05D0\u05EA \u05D4\u05E1\u05D5\u05DB\u05DF \u2014 \u05D2\u05DD \u05DC\u05E4\u05E2\u05D5\u05DC\u05D5\u05EA \u05E9\u05E2\u05D5\u05DC\u05D5\u05EA \u05DB\u05E1\u05E3 \u2014 \u05D1\u05DC\u05D9 \u05E9\u05D0\u05D9\u05E9\u05E8\u05EA \u05D0\u05D5\u05EA\u05D5.
41
- \u05D1\u05DE\u05E7\u05D5\u05DD \u05D6\u05D4: \u05DC\u05D7\u05E4\u05E9 \u05D1\u05EA\u05D5\u05DA \u05D4\u05E4\u05E8\u05D5\u05D9\u05E7\u05D8, \u05D0\u05D5 nodata_run \u05E2\u05DD \u05D4\u05DE\u05E4\u05EA\u05D7\u05D5\u05EA \u05DE\u05D4\u05DB\u05E1\u05E4\u05EA (\u05DB\u05DC \u05E4\u05E7\u05D5\u05D3\u05D4 \u05DE\u05D0\u05D5\u05E9\u05E8\u05EA \u05DB\u05DE\u05D5 \u05E9\u05D4\u05D9\u05D0).`+(n?"":" \u05DC\u05D0\u05E9\u05E8 \u05D1\u05DB\u05DC \u05D6\u05D0\u05EA?"),`NoData: this is ${d.why==="by_name"?"a search for a secret by name":"a search outside this project"}, over ${b}, where ${d.keyFiles} key file(s) (.env, logins) are. Whatever it finds enters the conversation, and a key found this way can be used by the agent \u2014 for paid calls too \u2014 without you approving it.
42
- Instead: search inside the project, or nodata_run with the keys from the vault (each command approved as written).`+(n?"":" Allow anyway?"));return{decision:n?"deny":"ask",reason:p,kind:"secret_search"}}if(u?.rule.effect==="allow")return{decision:"allow"};let f=wr(e,t,r);if(f.length===0)return{decision:"allow"};let h=f.map(b=>b.line),m=I(`NoData \u05E1\u05E8\u05E7 \u05D0\u05EA \u05D4\u05E7\u05D5\u05D1\u05E5 \u05D1\u05DE\u05D7\u05E9\u05D1 \u05E9\u05DC\u05DA \u2014 \u05E9\u05D5\u05DD \u05D3\u05D1\u05E8 \u05DC\u05D0 \u05D9\u05E6\u05D0:
43
- ${h.join(`
32
+ `)}function ps(e,t,r){let n=new RegExp(`<${t}\\b[^>]*\\b${r}="([^"]*)"`,"g"),i=[],s;for(;(s=n.exec(e))!==null;)s[1]&&i.push(G(s[1]));return i}function hs(e,t){let r=[];if(Be.has(e)){for(let n of t)(n==="content.xml"||n==="styles.xml"||n==="meta.xml")&&r.push(n);return r}e=os(e);for(let n of t)(n==="docProps/core.xml"||n==="docProps/app.xml")&&r.push(n);if(e===".xlsx"||e===".xlsm")for(let n of t)(n==="xl/sharedStrings.xml"||n==="xl/workbook.xml"||/^xl\/worksheets\/sheet\d+\.xml$/.test(n)||/^xl\/comments\d*\.xml$/.test(n))&&r.push(n);else if(e===".docx")for(let n of t)(n==="word/document.xml"||/^word\/(header|footer|footnotes|endnotes|comments)\d*\.xml$/.test(n))&&r.push(n);else if(e===".pptx")for(let n of t)/^ppt\/(slides|notesSlides)\/(slide|notesSlide)\d+\.xml$/.test(n)&&r.push(n);return r}function ms(e,t){let r=ce(e);if(!r||r.length===0)return null;let n=new Map(r.map(l=>[l.name,l])),i=hs(t,r.map(l=>l.name));if(i.length===0)return null;let s=[],o=[],a=0,c=!1;for(let l of i){if(a>=ae){c=!0;break}let u=n.get(l);if(!u)continue;let d=ds(e,u);if(d===null)continue;let f=fs(d);if(l==="xl/workbook.xml"){let m=ps(d,"sheet","name");m.length&&(f+=`
33
+ `+m.join(`
34
+ `))}a+f.length>ae&&(f=f.slice(0,Math.max(0,ae-a)),c=!0),f.trim().length!==0&&(s.push(f),o.push(l),a+=f.length)}return s.length===0?null:{text:s.join(`
35
+ `),truncated:c,parts:o}}function Vn(e,t,r={}){if(ke(e)){let n=It(e,ae);return"text"in n?{ok:!0,result:{text:n.text,truncated:n.truncated,parts:n.parts,attachments:n.attachments}}:{ok:!1,reason:n.reason}}if(Ue(e)){let n=Tt(e.toString("latin1"));if(!n.trim())return{ok:!1,reason:"no text inside (an empty file, or only pictures)"};let i=n.length>ae;return{ok:!0,result:{text:i?n.slice(0,ae):n,truncated:i,parts:["rtf"]}}}if(Rt.has(t)||Be.has(t)){let n=ms(e,t);return n?{ok:!0,result:n}:{ok:!1,reason:"damaged, or not really an Office file"}}if(Ce.has(t)){let n=je(e,r);return n?{ok:!0,result:{text:n.text,truncated:n.truncated,parts:[`pdf:${n.engine}`],engine:n.engine,uncertain:n.uncertain}}:{ok:!1,reason:Nn(e)}}return Ct.has(t)?{ok:!1,reason:"not a Word, Excel, PowerPoint or Outlook file inside, despite its name"}:{ok:!1,reason:"unsupported format"}}function Pt(e,t,r={}){let n=Vn(e,t,r);return n.ok?n.result:null}var Lt=new Set([...Rt,...Be,...Ct,...Gn,...Ce]);var Xc=5*6e4,Jc=2*6e4;import{deflateRawSync as ks}from"node:zlib";var Kn={israeli_id:"[ID]",credit_card:"[CARD]",iban:"[IBAN]",israeli_phone:"[PHONE]",email:"[EMAIL]"},gs=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,ys=[..._t].sort((e,t)=>+(t.subkind==="iban")-+(e.subkind==="iban"));function J(e,t,r=1){e[t]=(e[t]??0)+r}var Zn=null,q=e=>{let t=e.trim();Zn&&t&&Zn.add(t)};function j(e,t={},r){let n=e;for(let s of _e()){let o=new RegExp(s.pattern.source,s.pattern.flags.includes("g")?s.pattern.flags:s.pattern.flags+"g");n=n.replace(o,a=>(J(t,"secret"),q(a),"[SECRET]"))}for(let s of ys)s.pattern.lastIndex=0,n=n.replace(s.pattern,o=>s.validate(o)?(J(t,s.subkind),q(o),Kn[s.subkind]??`[${s.subkind.toUpperCase()}]`):o);n=n.replace(gs,s=>(J(t,"email"),q(s),Kn.email));let i=r??new Set;for(let s of Ie()){let o=s.find(n).sort((a,c)=>c.start-a.start);for(let a of o){let c=n.slice(a.start,a.end);q(c),s.kind==="name"&&i.add(c.trim()),n=n.slice(0,a.start)+`[${s.kind.toUpperCase()}]`+n.slice(a.end),J(t,s.kind)}}return i.size&&(n=_s(n,i,t)),{text:n,counts:t,columnsHidden:[]}}var bs=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function _s(e,t,r){let n=new Set;for(let s of t){n.add(s);let o=s.split(/\s+/)[0]??"";o.length>=3&&o!==s&&n.add(o)}let i=e;for(let s of[...n].sort((o,a)=>a.length-o.length)){let o=new RegExp(`(?<![\\p{L}\\p{N}@.\\[-])${bs(s)}(?![\\p{L}\\p{N}@\\]-])`,"gu");i=i.replace(o,a=>(J(r,"name"),q(a),"[NAME]"))}return i}function de(e,t,r={}){let n=e;for(let[i,s]of[...t].sort((o,a)=>a[0].length-o[0].length))n.includes(i)&&(n=n.split(i).join(`[${s.toUpperCase()}]`),J(r,s),q(i));return n}function Ot(){let e=new Map,t={};return(r,n)=>{q(n);let i=`${r}\0${n.trim()}`,s=e.get(i);return s===void 0&&(s=t[r]=(t[r]??0)+1,e.set(i,s)),`[${r.toUpperCase()}-${s}]`}}function ze(e){let t=e.trim();return/^\[[A-Z_]+(?:-\d+)?\]$/.test(t)||/^[\d]{0,4}[*•xX]{3,}[\d]{0,4}$/.test(t)}var Jn=/^\s*-?\d+(?:\.\d+)?\s*$/;function Dt(e){let t=new Set;for(let[r,n]of e){let i=n.filter(o=>Jn.test(o));if(i.length<3)continue;i.filter(o=>j(o).text!==o).length/i.length<.5&&t.add(r)}return t}function Xn(e,t){return e.includes(t)||e.includes('"')||e.includes(`
36
+ `)?`"${e.replace(/"/g,'""')}"`:e}function xs(e){let t=(e.match(/\t/g)??[]).length,r=(e.match(/;/g)??[]).length,n=(e.match(/,/g)??[]).length;return t>n&&t>=r?" ":r>n?";":","}function Nt(e,t){let r=e.split(/\r?\n/),n=t??xs(r[0]??""),i=Re(r[0]??"",n),s=i.map(m=>xe(m)),o={},a=Ot(),c=r.slice(1).map(m=>m===""?null:Re(m,n)),l=new Map;for(let m of c)m?.forEach((g,h)=>l.set(h,[...l.get(h)??[],g]));let u=Dt(l),d=be();if(d){let m=c.filter(g=>g!==null).slice(0,200);for(let g of d({name:"table",headers:i,rows:m})){let h=i.indexOf(g.column);h>=0&&!(g.how==="header"&&u.has(h))&&(s[h]={type:g.type,label:g.category})}}let f=[i.map(m=>Xn(m,n)).join(n)];for(let m of c){if(m===null){f.push("");continue}let g=m.map((h,_)=>{let p=s[_];return p&&h.trim()!==""&&!ze(h)?(J(o,`column:${p.type}`),a(p.type,h)):u.has(_)&&Jn.test(h)?h:j(h,o).text});f.push(g.map(h=>Xn(h,n)).join(n))}return{text:f.join(`
37
+ `),counts:o,columnsHidden:i.filter((m,g)=>s[g])}}var ws=/^xl\/(pivotCache|charts|externalLinks)\//,Qn=10;function qn(e,t,r=1){e[t]=(e[t]??0)+r}function er(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function tr(e){let t=e.replace(/<rPh\b[\s\S]*?<\/rPh>/g,""),r="";for(let n of t.matchAll(/<t(?:\s[^>]*)?>([\s\S]*?)<\/t>/g))r+=n[1];return G(r)}function vs(e){return e?[...e.matchAll(/<si\b[^>]*>([\s\S]*?)<\/si>|<si\b[^>]*\/>/g)].map(t=>tr(t[1]??"")):[]}var nr=/<c\b([^>]*?)(?:\/>|>([\s\S]*?)<\/c>)/g;function We(e,t){let r=new RegExp(`\\b${t}="([^"]*)"`).exec(e);return r?r[1]:null}function ue(e,t){if(e.type==="s"){let n=/<v>([^<]*)<\/v>/.exec(e.inner);return n?t[Number(n[1])]??null:null}if(e.type==="inlineStr"){let n=/<is>([\s\S]*?)<\/is>/.exec(e.inner);return n?tr(n[1]):null}if(e.type==="b"||e.type==="e")return null;let r=/<v>([^<]*)<\/v>/.exec(e.inner);return r?G(r[1]):null}function Ss(e){let t=[];for(let r of e.matchAll(nr)){let n=We(r[1],"r"),i=n?/^([A-Z]+)(\d+)$/.exec(n):null;if(!i)return null;t.push({full:r[0],attrs:r[1],inner:r[2]??"",col:i[1],row:Number(i[2]),type:We(r[1],"t")??"n"})}return t}function Es(e,t){let r=[...new Set(e.map(n=>n.row))].sort((n,i)=>n-i).slice(0,Qn);for(let n of r){let i=new Map;for(let s of e.filter(o=>o.row===n)){let o=ue(s,t),a=o?xe(o):null;a&&i.set(s.col,{type:a.type,header:o.trim()})}if(i.size>0)return{row:n,cols:i}}return{row:-1,cols:new Map}}var As=/^xl\/worksheets\/sheet\d+\.xml$/,$s=200;function Is(e){let t=e.trim();return/^[\d.,\-+/:%$₪€\s]+$/.test(t)||t.length>60}function Ts(e,t){let r=[...new Set(e.map(s=>s.row))].sort((s,o)=>s-o).slice(0,Qn),n=-1,i=-1/0;for(let s of r){let o=e.filter(l=>l.row===s).map(l=>(ue(l,t)??"").trim()).filter(Boolean);if(o.length<2)continue;let a=o.filter(l=>!Is(l)).length,c=a*2-(o.length-a);c>i&&(i=c,n=s)}return n}function Rs(e,t,r){let n=Es(t,r),i=be();if(!i)return n;let s=n.row>=0?n.row:Ts(t,r);if(s<0)return n;let o=t.filter(d=>d.row===s).map(d=>({col:d.col,text:(ue(d,r)??"").trim()})).filter(d=>d.text),a=new Map(o.map((d,f)=>[d.col,f])),c=new Map;for(let d of t){if(d.row<=s)continue;let f=a.get(d.col);if(f!==void 0){if(!c.has(d.row)){if(c.size>=$s)continue;c.set(d.row,o.map(()=>""))}c.get(d.row)[f]=ue(d,r)??""}}let l=new Map(s===n.row?n.cols:[]),u=o.map(d=>d.text);for(let d of i({name:e,headers:u,rows:[...c.values()]})){let f=u.indexOf(d.column);f<0||l.set(o[f].col,{type:d.type,header:d.column,category:d.category,severity:d.severity,how:d.how})}return{row:s,cols:l}}function Ft(e,t){return`<c${e.replace(/\s*\bt="[^"]*"/,"")} t="inlineStr"><is><t xml:space="preserve">${er(t)}</t></is></c>`}var Cs=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let r=t;for(let n=0;n<8;n+=1)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r>>>0}return e})();function Ps(e){let t=4294967295;for(let r=0;r<e.length;r+=1)t=Cs[(t^e[r])&255]^t>>>8;return(t^4294967295)>>>0}var Yn=33;function jt(e){let t=[],r=[],n=0;for(let o of e){let a=Buffer.from(o.name,"utf8"),c=o.name.endsWith("/"),l=c?Buffer.alloc(0):ks(o.data),u=c?0:8,d=c?0:Ps(o.data),f=Buffer.alloc(30);f.writeUInt32LE(67324752,0),f.writeUInt16LE(20,4),f.writeUInt16LE(2048,6),f.writeUInt16LE(u,8),f.writeUInt16LE(Yn,12),f.writeUInt32LE(d,14),f.writeUInt32LE(l.length,18),f.writeUInt32LE(o.data.length,22),f.writeUInt16LE(a.length,26),t.push(f,a,l);let m=Buffer.alloc(46);m.writeUInt32LE(33639248,0),m.writeUInt16LE(20,4),m.writeUInt16LE(20,6),m.writeUInt16LE(2048,8),m.writeUInt16LE(u,10),m.writeUInt16LE(Yn,14),m.writeUInt32LE(d,16),m.writeUInt32LE(l.length,20),m.writeUInt32LE(o.data.length,24),m.writeUInt16LE(a.length,28),m.writeUInt32LE(n,42),r.push(m,a),n+=f.length+a.length+l.length}let i=Buffer.concat(r),s=Buffer.alloc(22);return s.writeUInt32LE(101010256,0),s.writeUInt16LE(e.length,8),s.writeUInt16LE(e.length,10),s.writeUInt32LE(i.length,12),s.writeUInt32LE(n,16),Buffer.concat([...t,i,s])}function Mt(e,t){let r=ce(e);if(!r||r.length===0||r.some(p=>ws.test(p.name)))return null;let n=new Map;for(let p of r){if(p.name.endsWith("/")){n.set(p.name,Buffer.alloc(0));continue}let b=le(e,p);if(!b)return null;n.set(p.name,b)}let i=[...n.keys()].filter(p=>As.test(p));if(i.length===0)return null;let s=n.get("xl/sharedStrings.xml")?.toString("utf8")??null,o=vs(s),a=new Set,c={},l=new Set,u=Ot(),d=gt();for(let p of i){let b=n.get(p).toString("utf8"),k=Ss(b);if(!k)return null;let R=Rs(p.replace(/^xl\/worksheets\//,"").replace(/\.xml$/,""),k,o),w=R.row,N=new Map;for(let T of k){if(T.type!=="n"||T.row<=w)continue;let P=ue(T,o);P!==null&&N.set(T.col,[...N.get(T.col)??[],P])}let H=Dt(N),C=new Map;for(let[T,{type:P,header:F,how:re}]of R.cols)re==="header"&&H.has(T)||(C.set(T,P),l.add(F));let z=b.replace(nr,(T,P,F)=>{let re=We(P,"r"),[,W,y]=/^([A-Z]+)(\d+)$/.exec(re),x={full:T,attrs:P,inner:F??"",col:W,row:Number(y),type:We(P,"t")??"n"},S=ue(x,o),A=()=>{if(x.type==="s"){let bn=/<v>([^<]*)<\/v>/.exec(x.inner);bn&&a.add(Number(bn[1]))}return T};if(S===null||S.trim()==="")return A();if(d&&x.type==="n"&&H.has(W)&&x.row>w)return qn(c,"amount"),Ft(P,"[AMOUNT]");let v=C.get(W);if(v&&x.row>w&&!ze(S))return qn(c,`column:${v}`),Ft(P,u(v,S));if(x.type==="n"&&H.has(W))return A();let Z=j(S,c),ye=t?.size?de(Z.text,t,c):Z.text;return ye===S?A():Ft(P,ye)});n.set(p,Buffer.from(z,"utf8"))}if(s){let p=-1,b=s.replace(/<si\b[^>]*>[\s\S]*?<\/si>|<si\b[^>]*\/>/g,k=>(p+=1,a.has(p)?k:"<si><t>[HIDDEN]</t></si>"));n.set("xl/sharedStrings.xml",Buffer.from(b,"utf8"))}for(let p of[...n.keys()].filter(b=>/^xl\/comments\d*\.xml$/.test(b))){let k=n.get(p).toString("utf8").replace(/(<t(?:\s[^>]*)?>)([\s\S]*?)(<\/t>)/g,(R,w,N,H)=>{let C=j(G(N),c);return`${w}${er(t?.size?de(C.text,t,c):C.text)}${H}`});n.set(p,Buffer.from(k,"utf8"))}let f=n.get("docProps/core.xml");if(f){let p=f.toString("utf8").replace(/(<dc:creator>)[\s\S]*?(<\/dc:creator>)/,"$1$2").replace(/(<cp:lastModifiedBy>)[\s\S]*?(<\/cp:lastModifiedBy>)/,"$1$2");n.set("docProps/core.xml",Buffer.from(p,"utf8"))}let m=n.get("xl/workbook.xml");if(m){let p=m.toString("utf8").replace(/<(\w+:)?absPath\b[^>]*\/>|<(\w+:)?absPath\b[^>]*>[\s\S]*?<\/(\w+:)?absPath>/g,"");n.set("xl/workbook.xml",Buffer.from(p,"utf8"))}let g=n.get("docProps/app.xml");if(g){let p=g.toString("utf8").replace(/(<Company>)[\s\S]*?(<\/Company>)/,"$1$2").replace(/(<Manager>)[\s\S]*?(<\/Manager>)/,"$1$2");n.set("docProps/app.xml",Buffer.from(p,"utf8"))}let h=n.has("xl/calcChain.xml"),_=r.map(p=>p.name).filter(p=>!(h&&p==="xl/calcChain.xml"));if(h)for(let p of["[Content_Types].xml","xl/_rels/workbook.xml.rels"]){let b=n.get(p);b&&n.set(p,Buffer.from(b.toString("utf8").replace(/<(Override|Relationship)\b[^>]*calcChain[^>]*\/>/g,""),"utf8"))}return{bytes:jt(_.map(p=>({name:p,data:n.get(p)}))),counts:c,columnsHidden:[...l]}}var fe=/(^|\/)(\.env(\.[\w.-]+)?|[\w.-]+\.env(\.[\w.-]+)?)$/i,Ls=/(SECRET|PASSWORD|PASSWD|PASS|PWD|TOKEN|PRIVATE|CREDENTIAL|API_?KEY|_KEY|KEY_ID|DSN|DATABASE_URL|_URI|POOLER_URL|SALT|PEPPER)$/i,Os=/(^NEXT_PUBLIC_|^VITE_|^EXPO_PUBLIC_|ANON_KEY$|PUBLISHABLE_KEY$|PUBLIC_KEY$)/i;function Ht(e){let t=0;for(let r of e.split(/\r?\n/)){let n=/^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/.exec(r);if(!n||!Ls.test(n[1])||Os.test(n[1]))continue;let i=n[2].trim().replace(/^(['"])(.*)\1$/,"$2");i.length>=8&&!/^\$\{?[A-Z_]+\}?$/.test(i)&&t++}return t}var Nl=64*1024*1024,Fl=4*1024*1024;var jl=512*1024*1024,Ml=1024*1024*1024;var Hl=256*1024*1024;var Ul=new ir("utf-8",{fatal:!0}),Bl=new ir("windows-1255");var zl=new Set([".cache",".cargo",".rustup",".npm",".pnpm-store",".yarn",".gradle",".m2",".nuget",".conda",".pyenv",".rbenv",".nvm",".volta",".bun",".deno",".docker",".android",".vscode-server",".agents",".agent",".codeium",".continue","antigravity",".antigravity","__pycache__",".venv","venv","site-packages",".next",".turbo",".expo",".nx",".parcel-cache",".svelte-kit","appdata",".trash","$recycle.bin"].map(e=>e.toLowerCase()));var td=Buffer.from("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=","base64");var Vs=["Put the new key where the app reads it (for a developer machine: the NoData vault + nodata_run, not a .env file).","Check that the app still works with the new key.","Only then delete / revoke the OLD key \u2014 until you do, whoever copied it can still use it."],E=(e,t,r)=>({provider:e,url:t,steps:[...r,...Vs]}),Ks={"aws-access-key":E("AWS","https://console.aws.amazon.com/iam/home#/security_credentials",["Open IAM \u2192 your user \u2192 Security credentials.","Create a NEW access key (you see its secret once \u2014 keep it only in the vault)."]),"aws-secret-key":E("AWS","https://console.aws.amazon.com/iam/home#/security_credentials",["Open IAM \u2192 your user \u2192 Security credentials.","Create a NEW access key (you see its secret once \u2014 keep it only in the vault).","Mark the old key Inactive before deleting it."]),"gcp-api-key":E("Google Cloud","https://console.cloud.google.com/apis/credentials",["Open APIs & Services \u2192 Credentials.","Pick the key \u2192 Regenerate key (or create a new one and restrict it to the APIs you use)."]),"gcp-service-account":E("Google Cloud (service account)","https://console.cloud.google.com/iam-admin/serviceaccounts",["Open IAM & Admin \u2192 Service accounts \u2192 the account \u2192 Keys.","Add key \u2192 Create new key (JSON). Keep the file out of Git and out of shared folders."]),"firebase-key":E("Firebase / Google Cloud","https://console.cloud.google.com/apis/credentials",["A Firebase web key is meant to be public \u2014 restrict it instead: Credentials \u2192 the key \u2192 Application restrictions (your domains only).","If it is not a web key, regenerate it."]),"github-token":E("GitHub","https://github.com/settings/tokens",["Open Settings \u2192 Developer settings \u2192 Personal access tokens.","Generate a new token with only the scopes you need."]),"github-fine-grained":E("GitHub","https://github.com/settings/tokens?type=beta",["Open Fine-grained tokens.","Regenerate the token (or create a new one for only the repositories you need)."]),"gitlab-token":E("GitLab","https://gitlab.com/-/user_settings/personal_access_tokens",["Open Access tokens.","Create a new token with only the scopes you need."]),"stripe-secret":E("Stripe","https://dashboard.stripe.com/apikeys",["Open Developers \u2192 API keys.","Roll the secret key (Stripe can keep the old one alive for a short overlap)."]),"stripe-restricted":E("Stripe","https://dashboard.stripe.com/apikeys",["Open Developers \u2192 API keys \u2192 Restricted keys.","Roll the key, or create a new restricted key."]),"slack-token":E("Slack","https://api.slack.com/apps",["Open your app \u2192 OAuth & Permissions.","Rotate / reinstall to get a new token."]),"slack-webhook":E("Slack","https://api.slack.com/apps",["Open your app \u2192 Incoming Webhooks.","Add a new webhook URL for the channel."]),"twilio-api-key":E("Twilio","https://console.twilio.com/us1/account/keys-credentials/api-keys",["Open Account \u2192 API keys & tokens.","Create a new API key."]),"sendgrid-api-key":E("SendGrid","https://app.sendgrid.com/settings/api_keys",["Open Settings \u2192 API Keys.","Create a new key with only the permissions you need."]),"openai-key":E("OpenAI","https://platform.openai.com/api-keys",["Open API keys.","Create a new secret key."]),"openai-project-key":E("OpenAI","https://platform.openai.com/api-keys",["Open API keys (per project).","Create a new secret key for the same project."]),"anthropic-key":E("Anthropic","https://console.anthropic.com/settings/keys",["Open Settings \u2192 API keys.","Create a new key."]),"supabase-key":E("Supabase","https://supabase.com/dashboard/project/_/settings/api-keys",["Open the project \u2192 Project Settings \u2192 API Keys.","Create a new SECRET key (a service_role / secret key bypasses every database rule \u2014 treat it like a root password).","Older projects with JWT keys: rotating the JWT secret replaces every key and signs everyone out \u2014 plan it."]),"supabase-access-token":E("Supabase (personal access token \u2014 reaches every project of the account)","https://supabase.com/dashboard/account/tokens",["Open Account \u2192 Access Tokens.","Revoke this token, then generate a new one only where it is needed (CLI, MCP) \u2014 prefer a read-only MCP."]),"supabase-secret-key":E("Supabase","https://supabase.com/dashboard/project/_/settings/api-keys",["Open the project \u2192 Project Settings \u2192 API Keys.","Create a new secret key, switch your servers to it, then delete this one."]),"postgres-uri":E("PostgreSQL (the password in the connection string)","https://supabase.com/dashboard/project/_/settings/database",["Change the database user's password: in Supabase \u2192 Project Settings \u2192 Database \u2192 Reset password; elsewhere, your host's console or ALTER USER \u2026 WITH PASSWORD.","Update the connection string with the new password."]),"mongodb-uri":E("MongoDB","https://cloud.mongodb.com/",["Open Atlas \u2192 Database Access \u2192 the user \u2192 Edit \u2192 Edit password.","Update the connection string."]),"redis-uri":E("Redis","",["Reset the password in your Redis host's console (or CONFIG SET requirepass on your own server).","Update the connection string."]),"private-key":E("Private key (SSH / TLS / signing)","",["Generate a new key pair.","Register the new PUBLIC key where the old one was trusted (server authorized_keys, certificate, service settings)."]),"jwt-secret":E("Your app's JWT secret","",["Set a new long random secret in the app's configuration.","Every signed-in user will be signed out \u2014 plan the moment."]),"password-in-code":E("A password in code","",["Change the password in the system it belongs to."]),"bearer-token":E("An access token","",["Revoke the token in the service that issued it and issue a new one."])},Zs=E("A credential","",["Find the service it belongs to and issue a new credential there."]);function Ut(e){return Ks[e]??Zs}function cr(e){return/\.ndc$/i.test(e)||/\.clean\.[A-Za-z0-9]+$/.test(e)||Xs(e)}function Xs(e){return/(^|[\\/])\.nodata[\\/]/.test(e)}import{existsSync as Js,mkdirSync as au,readFileSync as qs,statSync as Bt,writeFileSync as cu}from"node:fs";import{homedir as Ys}from"node:os";import{join as Qs}from"node:path";var eo=()=>Qs(Ys(),".nodata","flagged.json");var lr="unread";function dr(e){let t=e.replace(/\\/g,"/");return process.platform==="win32"?t.toLowerCase():t}var Se=null;function ur(){let e=eo();try{if(!Js(e))return{};let t=Bt(e).mtimeMs;if(Se&&Se.path===e&&Se.mtimeMs===t)return Se.store;let r=JSON.parse(qs(e,"utf8"));return Se={path:e,mtimeMs:t,store:r},r}catch{return{}}}function Ge(e){let t=ur()[dr(e)];if(!t)return null;try{if(Bt(e).mtimeMs>t.mtimeMs+1e3)return null}catch{return null}let r=Object.fromEntries(Object.entries(t.kinds).filter(([n])=>n!==lr));return Object.keys(r).length?r:null}function Ve(e){let t=ur()[dr(e)];if(!t||!t.kinds[lr])return null;try{return{changed:Bt(e).mtimeMs>t.mtimeMs+1e3}}catch{return null}}import{existsSync as fr,mkdirSync as pu,readFileSync as pr,writeFileSync as hu}from"node:fs";import{homedir as to}from"node:os";import{join as no}from"node:path";var Ke=()=>no(to(),".nodata","prefs.json");function ro(){try{let e=fr(Ke())?JSON.parse(pr(Ke(),"utf8")).lang:null;return e==="he"||e==="en"?e:null}catch{return null}}function io(){let t=process.env.LC_ALL||process.env.LC_MESSAGES||process.env.LANG||"";try{t||=Intl.DateTimeFormat().resolvedOptions().locale}catch{}return/^(he|iw)(?:[-_.@]|$)/i.test(t)?"he":"en"}function pe(){return ro()??io()}function hr(){try{return fr(Ke())&&JSON.parse(pr(Ke(),"utf8")).amounts_sensitive===!0}catch{return!1}}function $(e,t,r=pe()){return r==="he"?e:t}import{createHmac as xo,randomBytes as ko}from"node:crypto";import{existsSync as Vt,mkdirSync as wo,readdirSync as vo,readFileSync as Kt,writeFileSync as So}from"node:fs";import{homedir as tt}from"node:os";import{basename as Eo,extname as Ao,isAbsolute as $o,join as nt,relative as Io,resolve as To}from"node:path";function Y(e){return typeof e=="number"&&Number.isFinite(e)?e:typeof e=="string"&&e.trim()!==""&&!Number.isNaN(Number(e))?Number(e):null}function so(e,t,r){return t===null||r===null?!1:t<=r?e>=t&&e<=r:e>=t||e<=r}function mr(e,t,r){switch(t){case"eq":return e===r;case"ne":return e!==r;case"in":return Array.isArray(r)&&r.includes(e);case"not_in":return Array.isArray(r)&&!r.includes(e);case"prefix":return typeof e=="string"&&typeof r=="string"&&e.toLowerCase().startsWith(r.toLowerCase());case"gte":{let n=Y(e),i=Y(r);return n!==null&&i!==null&&n>=i}case"lte":{let n=Y(e),i=Y(r);return n!==null&&i!==null&&n<=i}case"between":{let n=Y(e);return n!==null&&Array.isArray(r)&&r.length===2&&so(n,Y(r[0]),Y(r[1]))}default:return!1}}function gr(e,t,r){switch(t){case"in":return Array.isArray(r)&&e.some(n=>r.includes(n));case"not_in":return Array.isArray(r)&&!e.some(n=>r.includes(n));default:return!1}}import{existsSync as Ze,mkdirSync as xu,readdirSync as yr,readFileSync as oo,rmSync as ku,writeFileSync as wu,chmodSync as vu}from"node:fs";import{homedir as br}from"node:os";import{basename as Au,isAbsolute as ao,join as Q,relative as co,resolve as lo}from"node:path";var qe=()=>Q(br(),".nodata"),uo=()=>Q(qe(),"credentials.json"),Xe=()=>Q(qe(),"orgs"),fo=()=>Q(qe(),"bindings.json"),po=/^[A-Za-z0-9_.-]{1,80}$/,zt=e=>po.test(e)&&e!=="."&&e!=="..";function _r(e){try{return Ze(e)?JSON.parse(oo(e,"utf8")):null}catch{return null}}function ho(e){return e?e.device?.org_id?e.device.org_id:e.api_key?`key-${(e.key_prefix??e.api_key.slice(0,12)).replace(/[^A-Za-z0-9_-]/g,"")}`:null:null}function xr(){return ho(_r(uo()))}function Wt(){let e=[],t=xr();t&&e.push(t);try{for(let r of yr(Xe()))zt(r)&&!e.includes(r)&&Ze(Q(Xe(),r,"credentials.json"))&&e.push(r)}catch{}return e}var mo=e=>process.platform==="win32"||process.platform==="darwin"?e.toLowerCase():e,Je=e=>mo(lo(e.replace(/^~(?=[\\/]|$)/,br())));function go(e,t){let r=co(Je(e),Je(t));return r===""||!r.startsWith("..")&&!ao(r)}function V(){let e=_r(fo());return(Array.isArray(e?.bindings)?e.bindings:[]).filter(r=>!!r&&typeof r.folder=="string"&&typeof r.org_id=="string"&&zt(r.org_id)).map(r=>r.project===void 0||_o(r.project)===r.project?r:{...r,project:void 0}).map(r=>r.client===void 0||typeof r.client?.org_id=="string"&&yo.test(r.client.org_id)?r:{...r,client:void 0})}var yo=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function kr(e,t=V()){let r=null;for(let n of t)go(n.folder,e)&&(!r||Je(n.folder).length>Je(r.folder).length)&&(r=n);return r}function bo(e,t=Wt(),r=V()){if(t.length===0)return{kind:"none"};let n=kr(e,r.filter(i=>t.includes(i.org_id)));return n?{kind:"bound",org_id:n.org_id,folder:n.folder}:t.length===1?{kind:"only",org_id:t[0]}:{kind:"unbound",orgs:t}}function wr(e){let t=bo(e);return t.kind==="bound"||t.kind==="only"?t.org_id:null}function _o(e){if(typeof e!="string")return null;let t=e.trim();return t&&t.length<=120&&!/[\u0000-\u001f\\/]/.test(t)?t:null}function vr(){let e=[],t=Q(qe(),"org-mandate.json");Ze(t)&&e.push({owner:xr(),file:t});try{for(let r of yr(Xe())){let n=Q(Xe(),r,"org-mandate.json");zt(r)&&Ze(n)&&e.push({owner:r,file:n})}}catch{}return e}function Ye(e,t,r=V()){if(!e)return!0;let n=kr(t,r);return!n||n.org_id===e}var Sr=()=>nt(tt(),".nodata","rules.json"),Qe=()=>nt(tt(),".nodata","rules-key"),ee={allow:0,ask:1,clean_copy:2,deny:3},Ro=["claude-code","cursor","windsurf","codex","gemini","vscode","claude-desktop"],Gt=e=>typeof e=="string"&&e.trim()?e.trim().toLowerCase():void 0,Co={action:{cardinality:"scalar",ops:["eq","ne","in","not_in"],enumValues:["read","search","run","write","browse","interact"],label:"what the agent does (read, search, run, write; on a site: browse, interact)",extract:e=>e.action},"time.hour":{cardinality:"scalar",ops:["between","gte","lte","eq"],label:"hour on this computer (0-23; 18..6 wraps overnight)",extract:e=>e.now.getHours()},"time.weekday":{cardinality:"scalar",ops:["in","not_in","between","eq"],label:"weekday on this computer (0 Sunday \u2026 6 Saturday)",extract:e=>e.now.getDay()},"file.ext":{cardinality:"scalar",ops:["eq","ne","in","not_in"],label:"file type (.xlsx, .pdf, .env \u2026)",extract:e=>Ao(e.path).toLowerCase()||void 0},"file.name":{cardinality:"scalar",ops:["eq","in","prefix"],label:"file name",extract:e=>Eo(e.path).toLowerCase()},agent:{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:`which agent (${Ro.join(", ")} \u2026)`,extract:e=>Gt(e.who?.host)},"agent.type":{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:"sub-agent type inside the agent (main = the main conversation; general-purpose, explore \u2026)",extract:e=>Gt(e.who?.type)},org:{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:"which organisation the agent works for (the one its folder is bound to)",extract:e=>Gt(e.who?.org)}};function Po(){try{if(Vt(Qe())){let t=Kt(Qe(),"utf8").trim();if(/^[0-9a-f]{64}$/.test(t))return Buffer.from(t,"hex")}}catch{}let e=ko(32);return wo(nt(tt(),".nodata"),{recursive:!0}),So(Qe(),e.toString("hex")+`
38
+ `,{mode:384}),e}var Lo=(e,t)=>xo("sha256",t).update(JSON.stringify(e)).digest("hex");function Zt(){if(!Vt(Sr()))return{rules:[],tampered:!1};try{let e=JSON.parse(Kt(Sr(),"utf8")),t=Array.isArray(e.rules)?e.rules:[],r=Vt(Qe())&&typeof e.mac=="string"&&e.mac===Lo(t,Po());return{rules:t,tampered:!r}}catch{return{rules:[],tampered:!0}}}var Ee=e=>{let t=To(e.replace(/^~(?=[\\/]|$)/,tt())).replace(/\\/g,"/");return process.platform==="win32"?t.toLowerCase():t};function te(e,t){if(Er(e)||Er(t))return!1;if(e.startsWith("**/")){let n=e.slice(3).replace(/\\/g,"/").replace(/\/+$/,"").toLowerCase(),i=Ee(t).toLowerCase();return i.endsWith("/"+n)||i.includes("/"+n+"/")}let r=Io(Ee(e),Ee(t));return r===""||!r.startsWith("..")&&!$o(r)}var Oo="site:",Er=e=>e.startsWith(Oo);function Xt(e){try{let t=new URL(e.trim());return(t.protocol==="http:"||t.protocol==="https:")&&t.hostname.toLowerCase().replace(/\.$/,"")||null}catch{return null}}function Jt(e,t){return e==="*"?!0:t===e||t.endsWith("."+e)}function et(e,t,r){let n=Co[e.field];if(!n)return!1;let i=n.extract(t);return n.agentScope&&i===void 0?r!=="allow":e.op==="exists"?i!==void 0&&i!=="":i===void 0?!1:n.cardinality==="set"?gr(Array.isArray(i)?i:[],e.op,e.value):mr(i,e.op,e.value)}function rt(e,t){let r=e.map((n,i)=>({rule:n,n:i+1})).filter(n=>te(n.rule.path,t.path)).sort((n,i)=>Ee(i.rule.path).length-Ee(n.rule.path).length||n.n-i.n);for(let n of r)if((n.rule.when??[]).every(i=>et(i,t,n.rule.effect)))return{...n,touched:t.path};return null}function it(e,t,r,n,i){let s=null;for(let[o,a]of e.entries())te(a.path,t)||(a.path.startsWith("**/")?!Do(t,a.path):!te(t,a.path))||(a.when??[]).every(c=>et(c,{action:r,path:a.path,now:n,who:i},a.effect))&&(!s||ee[a.effect]>ee[s.rule.effect])&&(s={rule:a,n:o+1,touched:a.path});return s}function qt(e,t){let r=s=>s==="*"?0:s.length,n=t.site,i=e.map((s,o)=>({rule:s,n:o+1})).filter(s=>s.rule.site&&(n===void 0||Jt(s.rule.site,n))).sort((s,o)=>r(o.rule.site)-r(s.rule.site)||s.n-o.n);if(n===void 0){let s=null;for(let o of i)o.rule.effect==="allow"||!(o.rule.when??[]).every(a=>et(a,t,o.rule.effect))||(!s||ee[o.rule.effect]>ee[s.rule.effect])&&(s=o);return s?{...s,touched:""}:null}for(let s of i)if((s.rule.when??[]).every(o=>et(o,t,s.rule.effect)))return{...s,touched:n};return null}function Do(e,t){let r=0,n=(i,s)=>{if(s>5||r>4e3)return!1;let o;try{o=vo(i,{withFileTypes:!0})}catch{return!1}for(let a of o){if(++r>4e3||!a.isDirectory()||a.name==="node_modules"||a.name===".git")continue;let c=nt(i,a.name);if(te(t,c)||n(c,s+1))return!0}return!1};return n(e,0)}var No={allow:["allowed","\u05DE\u05D5\u05EA\u05E8"],ask:["ask the person","\u05DC\u05E9\u05D0\u05D5\u05DC \u05D0\u05D5\u05EA\u05DA"],clean_copy:["clean copy only","\u05E8\u05E7 \u05E2\u05D5\u05EA\u05E7 \u05E0\u05E7\u05D9"],deny:["not allowed","\u05D0\u05E1\u05D5\u05E8"]};function Ar(e,t=!1){return e.site?e.site==="*"?t?"\u05DB\u05DC \u05D0\u05EA\u05E8":"every site":`${t?"\u05D0\u05EA\u05E8":"site"} ${e.site}`:e.path}var $r=(e,t=!1)=>No[e][t?1:0];function Yt(){let e=[];for(let{owner:t,file:r}of vr())try{let n=JSON.parse(Kt(r,"utf8"));Array.isArray(n?.folder_rules)&&n.folder_rules.length&&e.push({owner:t,rules:n.folder_rules})}catch{}return e}function Ir(){let e=Wt();return e.length<2?[]:V().filter(t=>e.includes(t.org_id)).map(t=>({path:t.folder,effect:"deny",when:[{field:"org",op:"ne",value:t.org_id.toLowerCase()}],note:`works for organisation ${t.org_id}; another organisation's agent does not touch it`}))}import{createHash as Fo}from"node:crypto";import{existsSync as jo,mkdirSync as Mo,readFileSync as Rr,writeFileSync as Ho}from"node:fs";import{homedir as en}from"node:os";import{join as tn}from"node:path";var Cr=()=>tn(en(),".nodata","checkpoints.json"),Tr=()=>tn(en(),".nodata","connection.json"),Uo=900*1e3,Bo=300*1e3,zo=100;function Qt(e){return Array.isArray(e)?e.map(Qt):e&&typeof e=="object"?Object.fromEntries(Object.keys(e).sort().map(t=>[t,Qt(e[t])])):e}function nn(e,t,r,n){return Fo("sha256").update(JSON.stringify([e,t,r,Qt(n)])).digest("hex").slice(0,12)}var Wo=/^(element|selector|ref|uid|target|name|label|button|key|role|title|description|link|url|href|uri|startUrl|start_url|page_url)$/i;function rn(e){let t=[];for(let[r,n]of Object.entries(e)){if(!Wo.test(r)||typeof n!="string"&&typeof n!="number")continue;let i=String(n);if(/^https?:\/\//i.test(i))try{let s=new URL(i);i=`${s.origin}${s.pathname}`}catch{continue}if(t.push(`${r}: ${i.replace(/[\r\n]+/g," ").slice(0,120)}`),t.length>=4)break}return t.join(" \xB7 ").slice(0,300)}function Pr(){try{let e=JSON.parse(Rr(Cr(),"utf8")),t=Date.now(),r={};for(let[n,i]of Object.entries(e??{})){if(!i||typeof i.at!="number")continue;(i.passed_at?t-i.passed_at<Bo:t-i.at<Uo)&&(r[n]=i)}return r}catch{return{}}}function Lr(e){let t=Object.entries(e).sort((r,n)=>n[1].at-r[1].at).slice(0,zo);Mo(tn(en(),".nodata"),{recursive:!0}),Ho(Cr(),JSON.stringify(Object.fromEntries(t))+`
39
+ `,{mode:384})}function sn(e){try{let t=Pr(),r=t[e.id];t[e.id]={...r,...e,at:r&&!r.passed_at?r.at:Date.now()},Lr(t)}catch{}}function on(e){try{let t=Pr();return t[e]?.passed_at?(delete t[e],Lr(t),!0):!1}catch{return!1}}function an(){try{if(!jo(Tr()))return!1;let e=JSON.parse(Rr(Tr(),"utf8")).state;return e==="connected"||e==="reconnecting"||e==="restart"}catch{return!1}}var Zo=new Set([".csv",".tsv",".txt",".md",".json",".log",".xml",".sql",".yaml",".yml",".eml",...Lt]),Xo=50*1024*1024,Or=8,Jo={israeli_id:"Israeli ID",credit_card:"card",iban:"IBAN",israeli_phone:"phone",email:"email",secret:"secret"};function fn(e){let t=at(e).toLowerCase();return Zo.has(Wr(t))||fe.test(t)}var Vr=/^(reports|receipts)(\/|$)|^(prefs|consent|flagged|statusline-prev|key-backup|connection)\.json$|^(gate|status)\.mjs$|^(gate|answers)\.log$/i,qo=/\.nodata[\\/]+(device-key\.json|secrets\.json|credentials\.json|issuer-ed25519\.json|capsule\.json|capsule-key|shares|approvals|fabric-key\.json|machine-salt|pending-link\.json|api-shares\.json|secret-shares\.json|quarantine|bindings\.json|orgs)\b/i;function he(e){let t=me(U(),".nodata").replace(/\\/g,"/").toLowerCase();if(!e.replace(/\\/g,"/").toLowerCase().startsWith(t+"/"))return!1;let n=e.replace(/\\/g,"/").slice(t.length+1);return n!==""&&!Vr.test(n)}var Yo=["~","$home","${home}","%userprofile%","$env:userprofile","${env:userprofile}","$env:home","%homedrive%%homepath%"],Qo=/\.nodata(?=$|[\\/\s"'`|;&<>()])(?:[\\/]+([^\s"'`|;&<>()]*))?/gi,ea=/^\s*(ls|dir|tree|Get-ChildItem|gci)\b[^|;&]*$/i;function ta(e){let t=(e.split(/[\s"'`=(|;&<>]/).pop()??"").replace(/\\/g,"/").replace(/\/+$/,"").toLowerCase(),r=U().replace(/\\/g,"/").replace(/\/+$/,"").toLowerCase();return t===r||Yo.includes(t)}function na(e){if(qo.test(e))return!0;for(let t of e.matchAll(Qo)){if(!ta(e.slice(0,t.index).replace(/[\\/]+$/,"")))continue;let r=(t[1]??"").replace(/\\/g,"/").replace(/\/+$/,"");if(r===""){if(!ea.test(e))return!0;continue}if(/[*?[\]{}]/.test(r)||!Vr.test(r))return!0}return!1}var ne=e=>e.startsWith("mcp__"),pn=e=>/^mcp__.+__nodata_[a-z0-9_]+$/i.test(e),ra=/(path|file|dir|folder|root|uri|target|source|destination|cwd)/i,ia=/(write|edit|create|save|update|delete|remove|move|rename|append|put|upload|patch|insert|mkdir)/i,sa=/(search|grep|find|glob|list|tree|director|query)/i,Dr=16;function ct(e){let t=e.split("__").slice(2).join("__");return ia.test(t)?"write":sa.test(t)?"search":"read"}function $e(e,t){let r=[],n=(s,o)=>{let a=s.trim();if(/^file:\/\//i.test(a))try{a=decodeURIComponent(new URL(a).pathname).replace(/^\/([a-zA-Z]:)/,"$1")}catch{return}else if(!(o||/^(~[\\/]|\/|[a-zA-Z]:[\\/])/.test(a)))return;if(!a||a.length>1024||/[\n\r]/.test(a)||/^[a-z][a-z0-9+.-]*:\/\//i.test(a))return;let c=O(t,a.replace(/^~(?=[\\/]|$)/,U()));!r.includes(c)&&r.length<Dr&&r.push(c)},i=(s,o,a)=>{if(!(a>3||r.length>=Dr)){if(typeof s=="string")n(s,ra.test(o));else if(Array.isArray(s))for(let c of s.slice(0,50))i(c,o,a+1);else if(s&&typeof s=="object")for(let[c,l]of Object.entries(s))i(l,c,a+1)}};return i(e,"",0),r}var cn=/(\.claude[\\/]+settings(\.local)?\.json|node_modules[\\/]+@nodatachat[\\/])/i,oa=/(>|\bsed\s+-i|\btee\b|\b(rm|del|erase|mv|move|cp|copy|ren|rename)\b|Set-Content|Add-Content|Out-File|Remove-Item|Move-Item|Copy-Item|Rename-Item|WriteAllText|writeFileSync|unlinkSync)/i;function aa(e,t,r){if(e==="Bash"||e==="PowerShell"){let i=typeof t.command=="string"?t.command:"";return cn.test(i)&&oa.test(i)}if(ne(e))return ct(e)==="write"&&$e(t,r).some(i=>cn.test(i.replace(/\\/g,"/")));let n=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";return n?cn.test((K(n)?n:O(r,n)).replace(/\\/g,"/")):!1}function ca(e){return fn(e)||Ge(e)!==null||Ve(e)!==null}var st=class extends Error{};function la(e){let t=Wr(e).toLowerCase(),r=zr(e),n,i;if(t===".csv"||t===".tsv")i=r.toString("utf8"),n=Nt(i,t===".tsv"?" ":void 0).counts;else if(Lt.has(t)){let o=t===".xlsx"||t===".xlsm"?Mt(r):null,a=Pt(r,t);if(!a&&!o)throw new st;i=a?.text??"",n=o?o.counts:j(i).counts}else i=r.toString("utf8"),n=j(i).counts;let s=Te.filter(o=>o.pattern.test(i)).length;return fe.test(at(e).toLowerCase())&&(s=Math.max(s,Ht(i))),s&&(n.secret=Math.max(n.secret??0,s)),n}var da={israeli_id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",credit_card:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9",iban:"IBAN",israeli_phone:"\u05D8\u05DC\u05E4\u05D5\u05DF",phone:"\u05D8\u05DC\u05E4\u05D5\u05DF",email:'\u05D3\u05D5\u05D0"\u05DC',secret:"\u05E1\u05D5\u05D3",name:"\u05E9\u05DD",address:"\u05DB\u05EA\u05D5\u05D1\u05EA",policy:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4",agent_id:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF",financial:"\u05DE\u05D9\u05D3\u05E2 \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9",medical:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9",dob:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4",bank_account:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7",plate:"\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"};function Kr(e){let t=pe()==="he",r=n=>(t?da[n]:Jo[n])??n;return Object.entries(e).sort((n,i)=>i[1]-n[1]).map(([n,i])=>`${i} ${n.startsWith("column:")?`${r(n.slice(7))} (${t?"\u05E2\u05DE\u05D5\u05D3\u05D4":"column"})`:r(n)}`).join(", ")}function ua(e){return Kr(e)}function Zr(e,t,r){let n=s=>K(s)?s:O(r,s),i=s=>{try{return un(s).isFile()}catch{return!1}};if(e==="Read"&&typeof t.file_path=="string")return[n(t.file_path)];if(e==="Grep"&&typeof t.path=="string"&&i(n(t.path)))return[n(t.path)];if(ne(e))return ct(e)==="write"?[]:$e(t,r).filter(i).slice(0,Or);if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"){let s=t.command,o=[...[...s.matchAll(/"([^"]*)"/g)].map(c=>c[1]),...[...s.matchAll(/'([^']*)'/g)].map(c=>c[1]),...s.split(/[\s|;&<>(),=`]+/)],a=[];for(let c of o){let l=c.trim().replace(/^['"]|['"]$/g,"").replace(/\\\\/g,"\\").replace(/^~(?=[\\/])/,U()).replace(/^\/([a-zA-Z])\//,(d,f)=>process.platform==="win32"?`${f}:/`:d);if(!l)continue;let u=n(l);if(!(!fn(l)&&!he(u)&&Ge(u)===null&&Ve(u)===null)&&(i(u)&&!a.includes(u)&&a.push(u),a.length>=Or))break}return a}return[]}function M(e){return e.replace(/\\+/g,"/")}function fa(e){let t=e.trim();return/[;|&\n]|`|\$\(/.test(t.replace(/^cmd(?:\.exe)?\s+\/c\s+/i,""))?!1:/^(?:cmd(?:\.exe)?\s+\/c\s+)?(?:explorer(?:\.exe)?|start|invoke-item|ii|start-process|open|xdg-open)\b/i.test(t)}function Nr(e,t){return`${M(e)}: ${t?$("\u05D4\u05E1\u05E8\u05D9\u05E7\u05D4 \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D4 \u05DC\u05D0 \u05D4\u05E6\u05DC\u05D9\u05D7\u05D4 \u05DC\u05E7\u05E8\u05D5\u05D0 \u05D0\u05D5\u05EA\u05D5, \u05D5\u05D4\u05D5\u05D0 \u05D4\u05E9\u05EA\u05E0\u05D4 \u05DE\u05D0\u05D6 \u2014 \u05DC\u05D0 \u05E0\u05D1\u05D3\u05E7, \u05D4\u05EA\u05D9\u05D9\u05D7\u05E1 \u05D0\u05DC\u05D9\u05D5 \u05DB\u05E8\u05D2\u05D9\u05E9","your last scan could not read it, and it changed since \u2014 NOT checked, treat it as sensitive"):$("\u05D4\u05E1\u05E8\u05D9\u05E7\u05D4 \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D4 \u05DC\u05D0 \u05D4\u05E6\u05DC\u05D9\u05D7\u05D4 \u05DC\u05E7\u05E8\u05D5\u05D0 \u05D0\u05D5\u05EA\u05D5 \u2014 \u05DC\u05D0 \u05E0\u05D1\u05D3\u05E7, \u05D4\u05EA\u05D9\u05D9\u05D7\u05E1 \u05D0\u05DC\u05D9\u05D5 \u05DB\u05E8\u05D2\u05D9\u05E9","your last scan could not read it \u2014 NOT checked, treat it as sensitive")}`}function Xr(e,t,r){let n=[];if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"&&fa(t.command))return n;for(let i of Zr(e,t,r)){if(!ca(i)||cr(i)||!Ur(i))continue;let s=Ve(i);if(!fn(i)){let o=Ge(i);o?n.push({line:`${M(i)}: ${$("\u05E7\u05D5\u05D3 \u05E9\u05D4\u05E1\u05E8\u05D9\u05E7\u05D4 \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D4 \u05E1\u05D9\u05DE\u05E0\u05D4","code your last scan flagged")} \u2014 ${ua(o)}`,kind:"flagged_code"}):s&&n.push({line:Nr(i,s.changed),kind:"unread"});continue}try{if(un(i).size>Xo)n.push({line:`${M(i)}: too large to check here (over 50 MB)`,kind:"too_large"});else{let o=la(i);Object.keys(o).length?n.push({line:`${M(i)}: ${Kr(o)}`,kind:"data_file"}):s&&!s.changed&&n.push({line:Nr(i,!1),kind:"unread"})}}catch(o){n.push(o instanceof st?{line:`${M(i)}: ${$("\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05DC\u05E7\u05E8\u05D5\u05D0 \u05D0\u05EA \u05D4\u05D8\u05E7\u05E1\u05D8 (\u05E1\u05E8\u05D9\u05E7\u05D4, \u05D4\u05E6\u05E4\u05E0\u05D4 \u05D0\u05D5 \u05D2\u05D5\u05E4\u05DF \u05DC\u05D0 \u05E0\u05EA\u05DE\u05DA) \u2014 \u05DC\u05D0 \u05E0\u05D1\u05D3\u05E7, \u05D4\u05EA\u05D9\u05D9\u05D7\u05E1 \u05D0\u05DC\u05D9\u05D5 \u05DB\u05E8\u05D2\u05D9\u05E9","its text could not be read (a scan, encryption or an unsupported font) \u2014 NOT checked, treat it as sensitive")}`,kind:"unreadable"}:{line:`${M(i)}: could not be checked`,kind:"unreadable"})}}return n}var dn=/(?:\.aws[\\/]+credentials|\.npmrc|\.yarnrc\.yml|\.pypirc|[._]netrc|\.git-credentials|\.pgpass|\.docker[\\/]+config\.json|\.kube[\\/]+config|gh[\\/]+hosts\.yml|\.supabase[\\/]+access-token|application_default_credentials\.json|gcloud[\\/]+(?:credentials|access_tokens)\.db|\.azure[\\/]+(?:msal_token_cache|accessTokens)|com\.vercel\.cli[\\/]+auth\.json|\.ssh[\\/]+id_(?:rsa|ed25519|ecdsa|dsa)(?![\w.]))/i,ot=/(?:TOKEN|SECRET|PASSW(?:OR)?D|API_?KEY|PRIVATE_?KEY|ACCESS_?KEY|CREDENTIAL|SERVICE_ROLE|_KEY$)/i,Jr="the vault's secrets, outside nodata_run's per-command approval",pa=/(?:^|[^\w.@-])(?:npx|pnpx|bunx|npm|pnpm|yarn|bun|node|nodejs|deno|nodata-mcp)(?:\.cmd|\.exe|\.ps1|\.js)?(?![\w-])[\s\S]*?(?<![\w-])secrets-(?:run|login|set|import|share)(?![\w-])/i;function ha(e){return pa.test(e)}var ma=[[/^(?:env|set|export\s+-p|declare\s+-x|get-childitem\s+env:\S*|gci\s+env:\S*|dir\s+env:\S*|ls\s+env:\S*)\s*$/i,"every environment variable"],[/^gh\s+auth\s+(?:token\b|status\b.*(?:\s-t\b|--show-token))/i,"the GitHub login token"],[/^gcloud\s+auth\s+(?:application-default\s+)?print-(?:access|identity)-token\b/i,"a Google Cloud access token"],[/^az\s+account\s+get-access-token\b/i,"an Azure access token"],[/^aws\s+(?:configure\s+(?:get\s+\S*(?:secret|token)\S*|export-credentials)|sts\s+get-session-token|ecr\s+get-login-password)\b/i,"AWS credentials"],[/^supabase\s+projects\s+api-keys\b/i,"the project's Supabase keys (incl. service_role)"],[/^heroku\s+auth:token\b/i,"the Heroku login token"],[/^op\s+(?:read|item\s+get)\b/i,"a 1Password secret"],[/^vault\s+(?:kv\s+get|read)\b/i,"a Vault secret"],[/^doppler\s+secrets\b/i,"Doppler secrets"],[/^security\s+find-(?:generic|internet)-password\b.*\s-w\b/i,"a keychain password"],[/^git\s+credential\s+fill\b/i,"a saved Git password"],[/^node\s+\S*nodata-pull\.mjs\b/i,Jr],[/^kubectl\s+get\s+secrets?\b.*\s-o\b/i,"Kubernetes secrets"]],ga=/^(?:echo|printf|print|write-output|write-host|say)\b/i,qr=/^(?:cat|type|get-content|gc|more|less|head|tail|bat|nl|strings|xxd|od|hexdump|grep|egrep|rg|select-string|sls|awk|sed|jq|yq|python\d*|py|node|ruby|perl)\b/i,ya=/\$\{?env:([A-Za-z_][\w]*)|\$\{?([A-Za-z_][\w]*)|%([A-Za-z_][\w]*)%|GetEnvironmentVariable\(\s*['"]([^'"]+)['"]/g;function ba(e,t,r){let n=e==="Read"&&typeof t.file_path=="string"?t.file_path:e==="Grep"&&typeof t.path=="string"?t.path:"";if(n&&dn.test((K(n)?n:O(r,n)).replace(/\\/g,"/")))return`a saved login (${at(n)})`;if(e!=="Bash"&&e!=="PowerShell"||typeof t.command!="string")return null;let i=t.command.split(/(\|\||&&|[;|\n])/);for(let s=0;s<i.length;s+=2){let o=i[s+1]==="|",a=i[s].trim().replace(/^(?:sudo\s+|cmd(?:\.exe)?\s+\/c\s+|powershell(?:\.exe)?\s+(?:-command\s+)?|pwsh\s+(?:-c(?:ommand)?\s+)?)+/i,"").replace(/^["']|["']$/g,"");if(qr.test(a)&&dn.test(a))return"a saved login file";if(ha(a))return Jr;for(let[l,u]of ma)if(l.test(a))return u;let c=a.match(/^printenv(?:\s+(\S+))?\s*$/i);if(c&&(!c[1]||ot.test(c[1])))return c[1]?`the variable ${c[1]}`:"every environment variable";if(!o&&(ga.test(a)||/GetEnvironmentVariable/i.test(a)))for(let l of a.matchAll(ya)){let u=l[1]??l[2]??l[3]??l[4]??"";if(ot.test(u))return`the variable ${u}`}}return null}var Yr=/^(?:grep|egrep|fgrep|rg|ag|ack|git\s+grep|findstr|select-string|sls)\b/i,_a=/(?:^|\s)(?:-[a-zA-Z]*[rR][a-zA-Z]*|--recursive|--dereference-recursive|\/s|-recurse)(?=\s|$)/i,xa=new Set(["node_modules",".git",".next","dist","build",".venv","venv","__pycache__",".cache"]),Fr=4e3,ka=5;function wa(e){let t=0,r=0,n=(i,s)=>{if(s>ka||t>Fr)return;let o;try{o=Vo(i,{withFileTypes:!0})}catch{return}for(let a of o){if(++t>Fr)return;let c=me(i,a.name);a.isDirectory()?xa.has(a.name)||n(c,s+1):(fe.test(a.name.toLowerCase())||dn.test(c.replace(/\\/g,"/"))||he(c))&&r++}};return n(e,0),r}var Ae=e=>{try{return un(e).isDirectory()}catch{return!1}};function va(e,t){let r=Gr(O(t),O(e));return r===""||!r.startsWith("..")&&!K(r)}function Sa(e,t,r){let n=s=>O(r,s.replace(/^~(?=[\\/]|$)/,U())),i=[];if(e==="Grep"){let s=typeof t.path=="string"&&t.path?n(t.path):O(r);if(Ae(s)){let o=[t.pattern,t.glob,t.type].filter(a=>typeof a=="string").join(" ");i.push({roots:[s],bySecret:ot.test(o)||/\.env|env\b/i.test(String(t.glob??""))})}}else if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string")for(let s of t.command.split(/\|\||&&|[;|\n]/)){let o=s.trim().replace(/^(?:sudo\s+|xargs\s+(?:-\S+\s+)*)/i,"");if(!/^find\b.*-exec\s+(?:grep|egrep|rg|cat)\b/i.test(o)&&!(Yr.test(o)&&(_a.test(o)||/^(?:rg|ag|ack|git\s+grep)\b/i.test(o))))continue;let l=o.split(/\s+/).slice(1).map(u=>u.replace(/^['"]|['"]$/g,"")).filter(u=>u&&!u.startsWith("-")&&!/^\/[a-z]$/i.test(u)).map(n).filter(Ae);i.push({roots:l.length?l:[O(r)],bySecret:ot.test(o)||/\.env\b/i.test(o)})}for(let s of i)for(let o of s.roots){if(!s.bySecret&&va(o,r))continue;let a=wa(o);if(a>0)return{why:s.bySecret?"by_name":"outside",root:o,keyFiles:a}}return null}var Qr=new Set(["Write","Edit","MultiEdit","NotebookEdit"]),ln=e=>Qr.has(e)||ne(e)&&ct(e)==="write";function hn(e,t,r){let n=i=>O(r,i.replace(/^~(?=[\\/]|$)/,U()));if(e==="Read"&&typeof t.file_path=="string")return{action:"read",paths:[n(t.file_path)],roots:[]};if(Qr.has(e)){let i=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";return i?{action:"write",paths:[n(i)],roots:[]}:null}if(e==="Grep"||e==="Glob"){let i=typeof t.path=="string"&&t.path?n(t.path):O(r);return{action:"search",paths:[i],roots:Ae(i)?[i]:[]}}if(ne(e)){let i=$e(t,r);if(!i.length)return null;let s=ct(e);return{action:s,paths:i,roots:s==="search"?i.filter(Ae):[]}}if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"){let i=t.command,o=[...[...i.matchAll(/"([^"]*)"/g)].map(l=>l[1]),...[...i.matchAll(/'([^']*)'/g)].map(l=>l[1]),...i.split(/[\s|;&<>(),=`]+/)].map(l=>l.trim()).filter(l=>l&&!l.startsWith("-")&&/[\\/.~]/.test(l)).filter(l=>e==="PowerShell"||!/^\\+$/.test(l)).map(n).filter(l=>Ur(l)),a=i.split(/\|\||&&|[;|\n]/).some(l=>Yr.test(l.trim())||/^find\b/i.test(l.trim())),c=o.filter(Ae);return{action:a?"search":qr.test(i.trim())?"read":"run",paths:[O(r),...o],roots:a?c.length?c:[O(r)]:[]}}return null}var Ea=/(browser|playwright|puppeteer|chrome|chromium|stagehand|browserbase|selenium|webdriver)/i,Aa=/(click|type|fill|press|select|submit|hover|drag|drop|upload|form|key|input|check|scroll|evaluate|dialog|tap|act\b|execute)/i,$a=/^(url|uri|href|link|address|page_?url|start_?url)$/i,ei=()=>me(U(),".nodata","gate-sites.json"),Ia=720*60*1e3,Ta=50;function Ra(e,t){let r,n,i=(s,o,a)=>{if(!(a>3||r)){if(typeof s=="string"){let c=s.trim();if(!/^https?:\/\//i.test(c)||c.length>4096)return;$a.test(o)?r=c:n??=c}else if(Array.isArray(s))for(let c of s.slice(0,50))i(c,o,a+1);else if(s&&typeof s=="object")for(let[c,l]of Object.entries(s))i(l,c,a+1)}};return i(e,"",0),r??(t?n:void 0)}function mn(e,t){if(e==="WebFetch")return typeof t.url=="string"?{action:"browse",url:t.url}:null;if(!ne(e)||pn(e))return null;let r=e.split("__").slice(2).join("__"),n=Ea.test(e),i=Ra(t,n);return!i&&!n?null:{action:Aa.test(r)?"interact":"browse",...i?{url:i}:{}}}function ti(){try{let e=JSON.parse(zr(ei(),"utf8")),t=Date.now(),r={};for(let[n,i]of Object.entries(e??{}))typeof i?.host=="string"&&typeof i.at=="number"&&t-i.at<Ia&&(r[n]={host:i.host,at:i.at});return r}catch{return{}}}function Ca(e){return e?ti()[e]?.host:void 0}function Pa(e,t,r,n){if(!e||t==="WebFetch")return;let i=mn(t,r);if(!i)return;let s="";try{s=typeof n=="string"?n:JSON.stringify(n??"")}catch{}let o=/Page URL:\s*(https?:\/\/[^\s"\\]+)/i.exec(s)?.[1]??/"(?:url|pageUrl|page_url)"\s*:\s*"(https?:\/\/[^"\\]+)"/i.exec(s)?.[1],a=Xt(o??i.url??"");if(a)try{let c=ti();c[e]={host:a,at:Date.now()};let l=Object.entries(c).sort((u,d)=>d[1].at-u[1].at).slice(0,Ta);Br(me(U(),".nodata"),{recursive:!0}),Ko(ei(),JSON.stringify(Object.fromEntries(l))+`
40
+ `,{mode:384})}catch{}}function La(e,t,r,n=new Date,i,s){let o=mn(e,t);if(!o)return null;let a;if(o.url){let _=Xt(o.url);if(!_)return null;a=_}else a=Ca(s);let{rules:c,tampered:l}=Zt(),u=Yt(),d={allow:0,ask:1,clean_copy:2,deny:3},f={action:o.action,path:"",now:n,who:i,site:a},m=V(),g=null;for(let{owner:_,rules:p}of u){if(!Ye(_,O(r),m))continue;let b=qt(p,f);b&&(!g||d[b.rule.effect]>d[g.rule.effect])&&(g={...b,org:!0})}let h=null;if(l){let _=c.find(p=>p.site&&(a===void 0||Jt(p.site,a)));_&&(h={rule:{..._,effect:"deny",when:[]},n:c.indexOf(_)+1,touched:a??"",tampered:!0})}else h=qt(c,f);return g&&(!h||d[g.rule.effect]>=d[h.rule.effect])?g:h}function Oa(e,t,r,n=new Date,i){let s=hn(e,t,r);if(!s)return null;let{rules:o,tampered:a}=Zt(),c=Yt();if(!o.length&&!c.length)return null;let l={allow:0,ask:1,clean_copy:2,deny:3},u=V(),d=null;for(let{owner:m,rules:g}of c){for(let h of s.paths){if(!Ye(m,h,u))continue;let _=rt(g,{action:s.action,path:h,now:n,who:i});_&&(!d||l[_.rule.effect]>l[d.rule.effect])&&(d={..._,org:!0})}for(let h of s.roots){if(!Ye(m,h,u))continue;let _=it(g,h,s.action,n,i);_&&_.rule.effect!=="allow"&&(!d||l[_.rule.effect]>l[d.rule.effect])&&(d={..._,org:!0})}}let f=Da(o,a,s,n,l,i);return d&&(!f||l[d.rule.effect]>=l[f.rule.effect])?d:f}function Da(e,t,r,n,i,s){if(!e.length)return null;if(t){for(let a of r.paths){let c=e.find(l=>te(l.path,a)||te(a,l.path));if(c)return{rule:{...c,effect:"deny",when:[]},n:e.indexOf(c)+1,touched:a,tampered:!0}}return null}let o=null;for(let a of r.paths){let c=rt(e,{action:r.action,path:a,now:n,who:s});c&&(!o||i[c.rule.effect]>i[o.rule.effect])&&(o=c)}for(let a of r.roots){let c=it(e,a,r.action,n,s);c&&c.rule.effect!=="allow"&&(!o||i[c.rule.effect]>i[o.rule.effect])&&(o=c)}return o}function Na(e){let t;try{t=typeof e=="string"?e:JSON.stringify(e??"")}catch{return{}}if(!t)return{};t=t.slice(0,2*1024*1024);let r={};for(let n of _e()){let i=new RegExp(n.pattern.source,n.pattern.flags.includes("g")?n.pattern.flags:n.pattern.flags+"g"),s=(t.match(i)??[]).length;s&&(r[n.id]=(r[n.id]??0)+s)}return r}function Fa(e){let t=Object.keys(e);if(t.length===0)return null;let r=t.reduce((i,s)=>i+e[s],0),n=[...new Set(t.map(i=>{let s=Ut(i);return s.url?`${s.provider}: ${s.url}`:s.provider}))];return`NoData \xB7 A CREDENTIAL IS IN THIS OUTPUT (${r}: ${t.join(", ")}). It is now in this conversation and was sent to the AI model. Do not repeat, quote, shorten, mask-by-hand or reuse it \u2014 not in your answer, not in a command, not in a file. Tell the user in one line that a key was shown here and should be replaced at its provider (${n.join(" \xB7 ")}); nodata_scan_folder gives the full steps. Next time, run commands that need secrets through nodata_run: the output comes back with every value blanked.`+(pe()==="he"?" Answer the user in Hebrew.":"")}function ja(e,t,r,n){let i=Ir();if(!i.length)return null;let s=hn(e,t,r);if(!s)return null;let o=new Date,a=s.paths.map(l=>rt(i,{action:s.action,path:l,now:o,who:n})).find(Boolean)??s.roots.map(l=>it(i,l,s.action,o,n)).find(Boolean);if(!a)return null;let c=String(a.rule.when?.[0]?.value??"");return $(`NoData \u05D7\u05E1\u05DD: ${M(a.rule.path)} \u05E2\u05D5\u05D1\u05D3\u05EA \u05E2\u05D1\u05D5\u05E8 \u05D0\u05E8\u05D2\u05D5\u05DF \u05D0\u05D7\u05E8 (${c}) \u05DE\u05D6\u05D4 \u05E9\u05DC \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D6\u05D5. \u05E1\u05D5\u05DB\u05DF \u05E9\u05E2\u05D5\u05D1\u05D3 \u05DB\u05D0\u05DF \u05E2\u05D1\u05D5\u05E8 \u05D0\u05E8\u05D2\u05D5\u05DF \u05D0\u05D7\u05D3 \u05DC\u05D0 \u05E0\u05D5\u05D2\u05E2 \u05D1\u05E7\u05D1\u05E6\u05D9\u05DD \u05E9\u05DC \u05D0\u05E8\u05D2\u05D5\u05DF \u05D0\u05D7\u05E8 \u2014 \u05D2\u05DD \u05DC\u05D0 \u05D1\u05D0\u05D9\u05E9\u05D5\u05E8. \u05DC\u05E2\u05D1\u05D5\u05D3\u05D4 \u05E9\u05DD: \u05DC\u05E4\u05EA\u05D5\u05D7 \u05D0\u05EA \u05D4\u05E1\u05D5\u05DB\u05DF \u05D1\u05EA\u05D5\u05DA \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D4\u05D9\u05D0.`,`NoData refused: ${M(a.rule.path)} works for another organisation (${c}) than this folder. An agent working here for one organisation does not touch another organisation's files \u2014 not even with approval. To work there, start the agent inside that folder.`)}function Ma(e,t,r){let n=(e==="Bash"||e==="PowerShell")&&typeof t.command=="string"?t.command:"",i=(e==="Grep"||e==="Glob")&&typeof t.path=="string"?t.path:e==="Read"&&typeof t.file_path=="string"?t.file_path:"";return n&&na(n)||i&&he(K(i)?i:O(r,i))||ne(e)&&$e(t,r).some(he)||Zr(e,t,r).some(he)?$("NoData \u05D7\u05E1\u05DD: \u05D6\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05DE\u05E4\u05EA\u05D7 \u05E9\u05DC NoData (\u05DE\u05E4\u05EA\u05D7 \u05D4\u05DE\u05DB\u05E9\u05D9\u05E8, \u05D4\u05DB\u05E1\u05E4\u05EA \u05D0\u05D5 \u05D4\u05D0\u05E8\u05D2\u05D5\u05DF). \u05DE\u05D9 \u05E9\u05E7\u05D5\u05E8\u05D0 \u05D0\u05D5\u05EA\u05D5 \u05D9\u05DB\u05D5\u05DC \u05DC\u05E4\u05EA\u05D5\u05D7 \u05DB\u05DC \u05E7\u05D5\u05D1\u05E5 \u05E0\u05E2\u05D5\u05DC, \u05D5\u05DC\u05DB\u05DF \u05D0\u05E3 \u05E1\u05D5\u05DB\u05DF \u05DC\u05D0 \u05E7\u05D5\u05E8\u05D0 \u05D0\u05D5\u05EA\u05D5 \u2014 \u05D2\u05DD \u05DC\u05D0 \u05D1\u05D0\u05D9\u05E9\u05D5\u05E8. \u05DC-NoData \u05D0\u05D9\u05DF \u05E2\u05D5\u05EA\u05E7 \u05E9\u05DC \u05D4\u05DE\u05E4\u05EA\u05D7 \u05D5\u05D0\u05D9\u05DF \u05D3\u05E8\u05DA \u05DC\u05E9\u05D7\u05D6\u05E8 \u05D0\u05D5\u05EA\u05D5: \u05D4\u05D2\u05D9\u05D1\u05D5\u05D9 \u05E9\u05DC\u05DA \u05D4\u05D5\u05D0 \u05D4\u05D3\u05E8\u05DA \u05D4\u05D9\u05D7\u05D9\u05D3\u05D4. \u05DC\u05D2\u05D9\u05D1\u05D5\u05D9, \u05D1\u05D8\u05E8\u05DE\u05D9\u05E0\u05DC \u05D5\u05DC\u05D0 \u05D1\u05E6'\u05D0\u05D8: npx -y @nodatachat/mcp@latest key-backup E: (E: = \u05D4\u05D3\u05D9\u05E1\u05E7-\u05D0\u05D5\u05DF-\u05E7\u05D9).","NoData refused: this is one of NoData's own key files (the device key, the vault login or the org credential). Whoever reads it can open every sealed file, so no agent reads it \u2014 not even with approval. NoData holds no copy of this key and cannot recover it: your backup is the only recovery. To back it up, in a terminal (not the chat): npx -y @nodatachat/mcp@latest key-backup E: (E: = your USB drive). Do not suggest other recovery routes \u2014 there are none."):null}var Ha=new Set(["auto","bypassPermissions"]),jr=e=>!!e&&Ha.has(e);function Mr(e,t){let r=Gr(t,e);return r&&!r.startsWith("..")&&!K(r)?M(r):at(e)}function Hr(e,t,r,n,i,s){if(!an())return{decision:"deny",kind:"checkpoint",reason:$(`NoData: ${i}. \u05D4\u05E1\u05E9\u05DF \u05D4\u05D6\u05D4 \u05E8\u05E5 \u05D1\u05DE\u05E6\u05D1 ${s}, \u05E9\u05D1\u05D5 Claude Code \u05E2\u05D5\u05E0\u05D4 \u05D1\u05E2\u05E6\u05DE\u05D5 \u05E2\u05DC \u05D1\u05E7\u05E9\u05EA \u05D0\u05D9\u05E9\u05D5\u05E8, \u05D5\u05D4\u05DE\u05D7\u05E9\u05D1 \u05DC\u05D0 \u05DE\u05D7\u05D5\u05D1\u05E8 \u05DC-NoData \u05DB\u05D3\u05D9 \u05DC\u05E9\u05D0\u05D5\u05DC \u05D0\u05EA \u05D4\u05D1\u05E2\u05DC\u05D9\u05DD \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF. \u05DC\u05DB\u05DF \u05D4\u05E6\u05E2\u05D3 \u05E0\u05D7\u05E1\u05DD. \u05D0\u05E4\u05E9\u05E8 \u05DC\u05D7\u05D1\u05E8 \u05D0\u05EA \u05D4\u05DE\u05D7\u05E9\u05D1 (nodata_connect), \u05D0\u05D5 \u05E9\u05D4\u05D0\u05D3\u05DD \u05D9\u05E2\u05E9\u05D4 \u05D0\u05EA \u05D4\u05E6\u05E2\u05D3 \u05D1\u05E2\u05E6\u05DE\u05D5.`,`NoData: ${i}. This session runs in ${s} mode, where Claude Code answers its own approval dialog, and this computer is not connected to NoData to ask its owner in the browser. So the step is refused. Connect the computer (nodata_connect), or the person takes this step themselves.`)};let o=nn(e,t,r,n);return on(o)?{decision:"allow"}:(sn({id:o,site:"",file:e,action:t,tool:r,what:rn(n)}),{decision:"deny",kind:"checkpoint",reason:$(`NoData: ${i}. \u05D4\u05E1\u05E9\u05DF \u05E8\u05E5 \u05D1\u05DE\u05E6\u05D1 ${s}, \u05E9\u05D1\u05D5 \u05D0\u05E3 \u05D0\u05D7\u05D3 \u05DC\u05D0 \u05E2\u05D5\u05E0\u05D4 \u05DB\u05D0\u05DF, \u05D5\u05DC\u05DB\u05DF \u05D4\u05E6\u05E2\u05D3 \u05DE\u05D7\u05DB\u05D4 \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8 \u05E9\u05DC \u05D1\u05E2\u05DC\u05D9 \u05D4\u05DE\u05D7\u05E9\u05D1 \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF.
41
+ \u05DB\u05D3\u05D9 \u05DC\u05D1\u05E7\u05E9: nodata_rules {action:"approve", checkpoint:"${o}"}. \u05D4\u05D5\u05D0 \u05E4\u05D5\u05EA\u05D7 \u05D0\u05EA \u05D3\u05E3 \u05D4\u05D0\u05D9\u05E9\u05D5\u05E8 \u05D5\u05DE\u05D7\u05DB\u05D4. \u05D0\u05D7\u05E8\u05D9 \u05D4\u05D0\u05D9\u05E9\u05D5\u05E8, \u05D7\u05D6\u05D5\u05E8 \u05E2\u05DC \u05D0\u05D5\u05EA\u05D4 \u05E7\u05E8\u05D9\u05D0\u05D4 \u05D1\u05D3\u05D9\u05D5\u05E7 (\u05E4\u05E2\u05DD \u05D0\u05D7\u05EA, \u05EA\u05D5\u05DA 5 \u05D3\u05E7\u05D5\u05EA). \u05D0\u05EA\u05D4 \u05DC\u05D0 \u05D9\u05DB\u05D5\u05DC \u05DC\u05D0\u05E9\u05E8 \u05D1\u05E2\u05E6\u05DE\u05DA.`,`NoData: ${i}. This session runs in ${s} mode, where nobody answers here, so the step waits for the computer's owner to approve it in the browser.
42
+ To ask: nodata_rules {action:"approve", checkpoint:"${o}"}. It opens the approval page and waits. Once approved, repeat exactly the same call (once, within 5 minutes). You cannot approve it yourself.`)})}function Ua(e,t,r,n,i,s,o){if(pn(e))return{decision:"allow"};let a=wr(r),c={...i,org:a??void 0},l=Ma(e,t,r);if(l)return{decision:"deny",reason:l,kind:"nodata_key"};let u=ja(e,t,r,c);if(u)return{decision:"deny",reason:u,kind:"org_wall"};let d=ba(e,t,r);if(d){let w=$(`NoData: \u05D4\u05E4\u05E7\u05D5\u05D3\u05D4 \u05D4\u05D6\u05D5 \u05DE\u05E6\u05D9\u05D2\u05D4 ${d}. \u05DE\u05D4 \u05E9\u05D4\u05D9\u05D0 \u05DE\u05D3\u05E4\u05D9\u05E1\u05D4 \u05E0\u05DB\u05E0\u05E1 \u05DC\u05E9\u05D9\u05D7\u05D4 \u05D5\u05E0\u05E9\u05DC\u05D7 \u05DC\u05DE\u05D5\u05D3\u05DC \u05D4\u05D1\u05D9\u05E0\u05D4 \u05D4\u05DE\u05DC\u05D0\u05DB\u05D5\u05EA\u05D9\u05EA, \u05D5\u05DE\u05E4\u05EA\u05D7 \u05E9\u05E0\u05E8\u05D0\u05D4 \u05DB\u05D0\u05DF \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D7\u05DC\u05D9\u05E3.
43
+ \u05D1\u05DE\u05E7\u05D5\u05DD \u05D6\u05D4: \u05DC\u05D4\u05E8\u05D9\u05E5 \u05D0\u05D5\u05EA\u05D4 \u05D1\u05E2\u05E6\u05DE\u05DA \u05D1\u05D8\u05E8\u05DE\u05D9\u05E0\u05DC (\u05DC\u05D0 \u05D1\u05E6'\u05D0\u05D8), \u05D0\u05D5 nodata_run \u2014 \u05E9\u05DE\u05E8\u05D9\u05E5 \u05E4\u05E7\u05D5\u05D3\u05D4 \u05E2\u05DD \u05D4\u05E1\u05D5\u05D3\u05D5\u05EA \u05D5\u05DE\u05D7\u05D6\u05D9\u05E8 \u05D0\u05EA \u05D4\u05E4\u05DC\u05D8 \u05DB\u05E9\u05DB\u05DC \u05E2\u05E8\u05DA \u05DE\u05D5\u05E1\u05EA\u05E8.`+(n?"":" \u05DC\u05D0\u05E9\u05E8 \u05D1\u05DB\u05DC \u05D6\u05D0\u05EA?"),`NoData: this shows ${d}. Whatever it prints enters the conversation and goes to the AI model, and a key seen there has to be replaced.
44
+ Instead: run it yourself in a terminal (not the chat), or nodata_run \u2014 it runs a command with the secrets and returns the output with every value blanked.`+(n?"":" Allow anyway?"));return{decision:n?"deny":"ask",reason:w,kind:"credential_print"}}if((ln(e)||e==="Bash"||e==="PowerShell")&&aa(e,t,r)){if(jr(o)){let w=typeof t.file_path=="string"?Mr(K(t.file_path)?t.file_path:O(r,t.file_path),r):$("\u05D4\u05D4\u05D2\u05D3\u05E8\u05D5\u05EA \u05E9\u05DC Claude Code \u05D0\u05D5 \u05D4\u05E9\u05E2\u05E8 \u05E9\u05DC NoData","Claude Code's settings or NoData's gate");return Hr(w,"write",e,t,$("\u05D4\u05E4\u05E2\u05D5\u05DC\u05D4 \u05DE\u05E9\u05E0\u05D4 \u05D0\u05EA \u05DE\u05D4 \u05E9\u05DE\u05E4\u05E2\u05D9\u05DC \u05D0\u05EA \u05D4\u05E9\u05E2\u05E8","this changes what runs the gate"),o)}return{decision:"ask",kind:"gate_holder",reason:$("NoData: \u05D4\u05E4\u05E2\u05D5\u05DC\u05D4 \u05D4\u05D6\u05D5 \u05DE\u05E9\u05E0\u05D4 \u05D0\u05EA \u05DE\u05D4 \u05E9\u05DE\u05E4\u05E2\u05D9\u05DC \u05D0\u05EA \u05D4\u05E9\u05E2\u05E8 \u2014 \u05D4\u05D4\u05D2\u05D3\u05E8\u05D5\u05EA \u05E9\u05DC Claude Code \u05D0\u05D5 \u05D4\u05E7\u05D5\u05D3 \u05D4\u05DE\u05D5\u05EA\u05E7\u05DF \u05E9\u05DC NoData. \u05D0\u05D7\u05E8\u05D9 \u05E9\u05D9\u05E0\u05D5\u05D9 \u05DB\u05D6\u05D4 \u05D9\u05D9\u05EA\u05DB\u05DF \u05E9\u05D4\u05E9\u05E2\u05E8 \u05DC\u05D0 \u05D9\u05D1\u05D3\u05D5\u05E7 \u05D9\u05D5\u05EA\u05E8. \u05DC\u05D0\u05E9\u05E8 \u05E8\u05E7 \u05D0\u05DD \u05D0\u05EA\u05D4 \u05D1\u05D9\u05E7\u05E9\u05EA \u05D0\u05EA \u05D6\u05D4.","NoData: this changes what runs the gate \u2014 Claude Code's settings or NoData's installed code. After such a change the gate may stop checking. Approve only if you asked for it.")}}if(ln(e)){let w=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";if((ne(e)?$e(t,r):w?[K(w)?w:O(r,w)]:[]).some(he))return{decision:"deny",kind:"nodata_write",reason:$("NoData \u05D7\u05E1\u05DD: \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 ~/.nodata \u05E1\u05D2\u05D5\u05E8\u05D4 \u05DC\u05E1\u05D5\u05DB\u05E0\u05D9\u05DD, \u05D2\u05DD \u05DC\u05DB\u05EA\u05D9\u05D1\u05D4 (\u05DB\u05DC\u05DC\u05D9\u05DD, \u05DE\u05E4\u05EA\u05D7\u05D5\u05EA, \u05D0\u05D9\u05E9\u05D5\u05E8\u05D9\u05DD).","NoData refused: ~/.nodata is closed to agents, writes included (rules, keys, approvals).")}}let f=new Date,m=Oa(e,t,r,f,c),g=La(e,t,r,f,c,s),h=g&&(!m||ee[g.rule.effect]>ee[m.rule.effect])?g:m;if(h&&h.rule.effect!=="allow"){let w=pe()==="he",N=h.rule.site?Ar(h.rule,w):h.rule.path.startsWith("**/")?h.rule.path:M(h.rule.path),H=h.rule.site&&!h.touched?$(" (NoData \u05DC\u05D0 \u05D9\u05D5\u05D3\u05E2 \u05D1\u05D0\u05D9\u05D6\u05D4 \u05D0\u05EA\u05E8 \u05D4\u05D3\u05E3 \u05D4\u05D6\u05D4, \u05D5\u05DC\u05DB\u05DF \u05D4\u05DB\u05DC\u05DC \u05D4\u05DE\u05D7\u05DE\u05D9\u05E8 \u05DE\u05D1\u05D9\u05DF \u05DB\u05DC\u05DC\u05D9 \u05D4\u05D0\u05EA\u05E8\u05D9\u05DD \u05D7\u05DC)"," (NoData does not know which site this page is on, so the strictest site rule applies)"):"",C=h.tampered?$("\u05E7\u05D5\u05D1\u05E5 \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05E9\u05D5\u05E0\u05D4 \u05E9\u05DC\u05D0 \u05D3\u05E8\u05DA nodata_rules, \u05D5\u05DC\u05DB\u05DF \u05DB\u05DC \u05E0\u05EA\u05D9\u05D1 \u05D5\u05D0\u05EA\u05E8 \u05E9\u05D4\u05D5\u05D0 \u05DE\u05D6\u05DB\u05D9\u05E8 \u05E1\u05D2\u05D5\u05E8\u05D9\u05DD \u05E2\u05D3 \u05E9\u05EA\u05E9\u05DE\u05D5\u05E8 \u05D0\u05EA \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05DE\u05D7\u05D3\u05E9.","the rules file was changed outside nodata_rules, so every path and site it names is closed until you save the rules again."):`${h.org?$("\u05DB\u05DC\u05DC \u05E9\u05DC \u05D4\u05D0\u05E8\u05D2\u05D5\u05DF","organisation rule"):$("\u05DB\u05DC\u05DC","rule")} ${h.n}: ${N} \u2192 ${$r(h.rule.effect,w)}${h.rule.note?` (${h.rule.note})`:""}${H}`;if(h.rule.site&&h.rule.effect==="ask"&&!h.tampered&&an()){let T=mn(e,t),P=h.touched,F=nn(P,T.action,e,t);return on(F)?{decision:"allow"}:(sn({id:F,site:P,action:T.action,tool:e,what:rn(t)}),{decision:"deny",kind:"checkpoint",reason:$(`NoData: ${C}. \u05D4\u05E6\u05E2\u05D3 \u05D4\u05D6\u05D4 \u05DE\u05D7\u05DB\u05D4 \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8 \u05E9\u05DC \u05D1\u05E2\u05DC\u05D9 \u05D4\u05DE\u05D7\u05E9\u05D1 \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF, \u05DC\u05D0 \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8 \u05DB\u05D0\u05DF.
45
+ \u05DB\u05D3\u05D9 \u05DC\u05D1\u05E7\u05E9: nodata_rules {action:"approve", checkpoint:"${F}"} \u2014 \u05D4\u05D5\u05D0 \u05E4\u05D5\u05EA\u05D7 \u05D0\u05EA \u05D3\u05E3 \u05D4\u05D0\u05D9\u05E9\u05D5\u05E8 \u05D5\u05DE\u05D7\u05DB\u05D4. \u05D0\u05D7\u05E8\u05D9 \u05D4\u05D0\u05D9\u05E9\u05D5\u05E8, \u05D7\u05D6\u05D5\u05E8 \u05E2\u05DC \u05D0\u05D5\u05EA\u05D4 \u05E7\u05E8\u05D9\u05D0\u05D4 \u05D1\u05D3\u05D9\u05D5\u05E7 (\u05E4\u05E2\u05DD \u05D0\u05D7\u05EA, \u05EA\u05D5\u05DA 5 \u05D3\u05E7\u05D5\u05EA). \u05D0\u05EA\u05D4 \u05DC\u05D0 \u05D9\u05DB\u05D5\u05DC \u05DC\u05D0\u05E9\u05E8 \u05D1\u05E2\u05E6\u05DE\u05DA.`,`NoData: ${C}. This step waits for the computer's owner to approve it in the browser, not here.
46
+ To ask: nodata_rules {action:"approve", checkpoint:"${F}"} \u2014 it opens the approval page and waits. Once approved, repeat exactly the same call (once, within 5 minutes). You cannot approve it yourself.`)})}if(!h.rule.site&&h.rule.effect==="ask"&&!h.tampered&&jr(o)){let T=hn(e,t,r)?.action,P=T==="read"||T==="search"||T==="run"?T:"write";return Hr(Mr(h.touched,r),P,e,t,C,o)}let z=h.rule.effect==="clean_copy"?$(`NoData: ${C}. \u05D4\u05E1\u05D5\u05DB\u05DF \u05E2\u05D5\u05D1\u05D3 \u05DB\u05D0\u05DF \u05E8\u05E7 \u05E2\u05DC \u05E2\u05D5\u05EA\u05E7 \u05E0\u05E7\u05D9: nodata_redact \u05D9\u05D5\u05E6\u05E8 \u05D0\u05D5\u05EA\u05D5 (\u05DE\u05D6\u05D4\u05D9\u05DD \u05DE\u05D5\u05D7\u05DC\u05E4\u05D9\u05DD, \u05E0\u05D1\u05D3\u05E7 \u05DC\u05E4\u05E0\u05D9 \u05E9\u05D9\u05DE\u05D5\u05E9).`,`NoData: ${C}. The agent works here on a clean copy only: nodata_redact makes one (identifiers replaced, checked before use).`):h.rule.effect==="ask"?$(`NoData: ${C}. \u05DC\u05D0\u05E9\u05E8?`,`NoData: ${C}. Allow?`):$(`NoData: ${C}. \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05E9\u05DC \u05D4\u05E7\u05D1\u05E6\u05D9\u05DD, \u05D4\u05EA\u05D9\u05E7\u05D9\u05D5\u05EA \u05D5\u05D4\u05D0\u05EA\u05E8\u05D9\u05DD \u05E9\u05DC\u05DA: nodata_rules.`,`NoData: ${C}. Your file, folder and site rules: nodata_rules.`);return{decision:h.rule.effect==="ask"?"ask":"deny",reason:z,kind:"rule"}}if(ln(e))return{decision:"allow"};let _=Sa(e,t,r);if(_){let w=M(_.root),N=$(`NoData: \u05D6\u05D4 ${_.why==="by_name"?"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E1\u05D5\u05D3 \u05DC\u05E4\u05D9 \u05E9\u05DD":"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05DE\u05D7\u05D5\u05E5 \u05DC\u05E4\u05E8\u05D5\u05D9\u05E7\u05D8"}, \u05D1\u05EA\u05D5\u05DA ${w}, \u05E9\u05D9\u05E9 \u05D1\u05D4 ${_.keyFiles} \u05E7\u05D1\u05E6\u05D9 \u05DE\u05E4\u05EA\u05D7\u05D5\u05EA (.env, \u05D4\u05EA\u05D7\u05D1\u05E8\u05D5\u05D9\u05D5\u05EA). \u05DE\u05D4 \u05E9\u05D4\u05D7\u05D9\u05E4\u05D5\u05E9 \u05D9\u05DE\u05E6\u05D0 \u05E0\u05DB\u05E0\u05E1 \u05DC\u05E9\u05D9\u05D7\u05D4, \u05D5\u05DE\u05E4\u05EA\u05D7 \u05E9\u05E0\u05DE\u05E6\u05D0 \u05DB\u05DA \u05D9\u05DB\u05D5\u05DC \u05DC\u05E9\u05DE\u05E9 \u05D0\u05EA \u05D4\u05E1\u05D5\u05DB\u05DF \u2014 \u05D2\u05DD \u05DC\u05E4\u05E2\u05D5\u05DC\u05D5\u05EA \u05E9\u05E2\u05D5\u05DC\u05D5\u05EA \u05DB\u05E1\u05E3 \u2014 \u05D1\u05DC\u05D9 \u05E9\u05D0\u05D9\u05E9\u05E8\u05EA \u05D0\u05D5\u05EA\u05D5.
47
+ \u05D1\u05DE\u05E7\u05D5\u05DD \u05D6\u05D4: \u05DC\u05D7\u05E4\u05E9 \u05D1\u05EA\u05D5\u05DA \u05D4\u05E4\u05E8\u05D5\u05D9\u05E7\u05D8, \u05D0\u05D5 nodata_run \u05E2\u05DD \u05D4\u05DE\u05E4\u05EA\u05D7\u05D5\u05EA \u05DE\u05D4\u05DB\u05E1\u05E4\u05EA (\u05DB\u05DC \u05E4\u05E7\u05D5\u05D3\u05D4 \u05DE\u05D0\u05D5\u05E9\u05E8\u05EA \u05DB\u05DE\u05D5 \u05E9\u05D4\u05D9\u05D0).`+(n?"":" \u05DC\u05D0\u05E9\u05E8 \u05D1\u05DB\u05DC \u05D6\u05D0\u05EA?"),`NoData: this is ${_.why==="by_name"?"a search for a secret by name":"a search outside this project"}, over ${w}, where ${_.keyFiles} key file(s) (.env, logins) are. Whatever it finds enters the conversation, and a key found this way can be used by the agent \u2014 for paid calls too \u2014 without you approving it.
48
+ Instead: search inside the project, or nodata_run with the keys from the vault (each command approved as written).`+(n?"":" Allow anyway?"));return{decision:n?"deny":"ask",reason:N,kind:"secret_search"}}if(h?.rule.effect==="allow")return{decision:"allow"};let p=Xr(e,t,r);if(p.length===0)return{decision:"allow"};let b=p.map(w=>w.line),k=$(`NoData \u05E1\u05E8\u05E7 \u05D0\u05EA \u05D4\u05E7\u05D5\u05D1\u05E5 \u05D1\u05DE\u05D7\u05E9\u05D1 \u05E9\u05DC\u05DA \u2014 \u05E9\u05D5\u05DD \u05D3\u05D1\u05E8 \u05DC\u05D0 \u05D9\u05E6\u05D0:
49
+ ${b.join(`
44
50
  `)}
45
51
  `+(n?"\u05D4\u05E7\u05E8\u05D9\u05D0\u05D4 \u05E0\u05D7\u05E1\u05DE\u05D4: Claude \u05DC\u05D0 \u05D9\u05E7\u05E8\u05D0 \u05D0\u05EA \u05D4\u05DE\u05E7\u05D5\u05E8. \u05D1\u05DE\u05E7\u05D5\u05DD \u05D6\u05D4: nodata_redact (\u05E2\u05D5\u05EA\u05E7 \u05E0\u05E7\u05D9 \u05DC\u05E2\u05D1\u05D5\u05D3\u05D4) \u05D0\u05D5 nodata_protect (\u05E0\u05E2\u05D9\u05DC\u05D4).":"\u05D0\u05DD \u05EA\u05D0\u05E9\u05E8, Claude \u05D9\u05E7\u05E8\u05D0 \u05D0\u05EA \u05D4\u05E7\u05D5\u05D1\u05E5 \u05E2\u05E6\u05DE\u05D5 \u05D5\u05D4\u05EA\u05D5\u05DB\u05DF \u05D9\u05D9\u05E9\u05DC\u05D7 \u05DC\u05DE\u05D5\u05D3\u05DC \u05D4\u05D1\u05D9\u05E0\u05D4 \u05D4\u05DE\u05DC\u05D0\u05DB\u05D5\u05EA\u05D9\u05EA. \u05D1\u05DE\u05E7\u05D5\u05DD \u05D6\u05D4: nodata_redact (\u05E2\u05D5\u05EA\u05E7 \u05E0\u05E7\u05D9 \u05DC\u05E2\u05D1\u05D5\u05D3\u05D4) \u05D0\u05D5 nodata_protect (\u05E0\u05E2\u05D9\u05DC\u05D4). \u05DC\u05D0\u05E9\u05E8 \u05D1\u05DB\u05DC \u05D6\u05D0\u05EA?"),`NoData scanned this file on your machine \u2014 nothing left it:
46
- ${h.join(`
52
+ ${b.join(`
47
53
  `)}
48
- `+(n?"Read refused: Claude will not read the original. Instead: nodata_redact (a clean copy to work on) or nodata_protect (lock it).":"If you allow it, Claude reads the file itself and its content goes to the AI model. Instead: nodata_redact (a clean copy to work on) or nodata_protect (lock it). Allow anyway?")),g=[...new Set(f.map(b=>b.kind))];return{decision:n?"deny":"ask",reason:m,kind:g[0],...g.length>1?{kinds:g}:{}}}function Zo(e,t,r){let n=wr(e,t,r).map(i=>i.line);return n.length===0?null:`NoData \xB7 ON SCREEN rule. What you just read holds personal data:
54
+ `+(n?"Read refused: Claude will not read the original. Instead: nodata_redact (a clean copy to work on) or nodata_protect (lock it).":"If you allow it, Claude reads the file itself and its content goes to the AI model. Instead: nodata_redact (a clean copy to work on) or nodata_protect (lock it). Allow anyway?")),R=[...new Set(p.map(w=>w.kind))];return{decision:n?"deny":"ask",reason:k,kind:R[0],...R.length>1?{kinds:R}:{}}}function Ba(e,t,r){let n=Xr(e,t,r).map(i=>i.line);return n.length===0?null:`NoData \xB7 ON SCREEN rule. What you just read holds personal data:
49
55
  ${n.join(`
50
56
  `)}
51
- The user's screen is not private \u2014 someone may be beside them. Answer with totals, counts, groupings and trends. Do not print names, ID / policy / account numbers, addresses, phones, or amounts tied to a person \u2014 not in a table, not as an "example" \u2014 unless the user explicitly asks to see those values. For a clean, anonymised or shareable version use nodata_redact \u2014 never your own script: it verifies the copy and records a proof.`+(le()==="he"?" Answer the user in Hebrew.":"")}function Ir(e){try{let t=tt(ue(),".nodata");co(t,{recursive:!0}),ao(tt(t,"gate.log"),JSON.stringify({at:new Date().toISOString(),...e})+`
52
- `,{mode:384})}catch{}}function Xo(e,t){Ir({tool:e,decision:t.decision,...t.kind?{kind:t.kind}:{},...t.kinds?.length?{kinds:t.kinds}:{}})}function Jo(e,t){let r=typeof e=="string"&&e.trim()?e.trim().toLowerCase():void 0,n=typeof t.agent_type=="string"&&t.agent_type.trim()?t.agent_type.trim().toLowerCase():r==="claude-code"?"main":void 0;return{host:r,type:n}}async function Tr(e){let t=e.includes("--block"),r=e.includes("--post"),n=e.indexOf("--host"),i=n>=0&&e[n+1]&&!e[n+1].startsWith("--")?e[n+1]:void 0,s="";for await(let c of process.stdin)s+=c;let o;try{o=JSON.parse(s)}catch{return}let a=o.tool_name??"";if(_r(a))return;if(r){let c=zo(o.tool_response);Object.keys(c).length&&Ir({tool:a,leaked:Object.values(c).reduce((d,f)=>d+f,0)});let u=[Wo(c),Zo(a,o.tool_input??{},o.cwd??process.cwd())].filter(Boolean).join(`
57
+ The user's screen is not private \u2014 someone may be beside them. Answer with totals, counts, groupings and trends. Do not print names, ID / policy / account numbers, addresses, phones, or amounts tied to a person \u2014 not in a table, not as an "example" \u2014 unless the user explicitly asks to see those values. For a clean, anonymised or shareable version use nodata_redact \u2014 never your own script: it verifies the copy and records a proof.`+(pe()==="he"?" Answer the user in Hebrew.":"")}function ni(e){try{let t=me(U(),".nodata");Br(t,{recursive:!0}),Go(me(t,"gate.log"),JSON.stringify({at:new Date().toISOString(),...e})+`
58
+ `,{mode:384})}catch{}}function za(e,t){ni({tool:e,decision:t.decision,...t.kind?{kind:t.kind}:{},...t.kinds?.length?{kinds:t.kinds}:{}})}function Wa(e,t){let r=typeof e=="string"&&e.trim()?e.trim().toLowerCase():void 0,n=typeof t.agent_type=="string"&&t.agent_type.trim()?t.agent_type.trim().toLowerCase():r==="claude-code"?"main":void 0;return{host:r,type:n}}async function ri(e){let t=e.includes("--block"),r=e.includes("--post"),n=e.indexOf("--host"),i=n>=0&&e[n+1]&&!e[n+1].startsWith("--")?e[n+1]:void 0,s="";for await(let l of process.stdin)s+=l;let o;try{o=JSON.parse(s)}catch{return}let a=o.tool_name??"";if(pn(a))return;if(r){Pa(o.session_id,a,o.tool_input??{},o.tool_response);let l=Na(o.tool_response);Object.keys(l).length&&ni({tool:a,leaked:Object.values(l).reduce((d,f)=>d+f,0)});let u=[Fa(l),Ba(a,o.tool_input??{},o.cwd??process.cwd())].filter(Boolean).join(`
53
59
 
54
- `);u&&process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PostToolUse",additionalContext:u}}));return}let l=Ko(a,o.tool_input??{},o.cwd??process.cwd(),t,Jo(i,o));l.decision!=="allow"&&(Xo(a,l),process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:l.decision,permissionDecisionReason:l.reason}})))}var qo="claude-code",Yd=` --host ${qo}`;var Yo=[{type:"id_number",patterns:[/\b\d{9}\b/g,/ת\.?ז\.?\s*:?\s*(\d{9})/g,/זהות\s*:?\s*(\d{9})/g],confidence:.9,replacement:()=>"[\u05EA.\u05D6. \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"phone",patterns:[/\b0[2-9]\d[\s\-]?\d{7}\b/g,/\b05[0-9][\s\-]?\d{7}\b/g,/\+972[\s\-]?[2-9]\d[\s\-]?\d{7}\b/g],confidence:.95,replacement:()=>"[\u05D8\u05DC\u05E4\u05D5\u05DF \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"email",patterns:[/[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}/g],confidence:.99,replacement:e=>{let[,t]=e.split("@");return`[\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC: ***@${t}]`}},{type:"full_name",patterns:[/(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק)[:\s]+([א-ת][א-ת"'\-\s]{2,30}?)(?=[,\n\d]|ת\.ז)/g,/(?:עו"ד|ד"ר|פרופ'|מר|גברת)\s+([א-ת][א-ת"'\-\s]{2,25}?)(?=[,\n])/g],confidence:.75,replacement:()=>"[\u05E9\u05DD \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"bank_account",patterns:[/\b\d{2}[\-]\d{5,9}[\-]\d{2,3}\b/g,/(?:חשבון|ח-ן)\s*:?\s*(\d[\d\-]{8,15})/g],confidence:.88,replacement:()=>"[\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"medical",patterns:[/(?<![א-ת])[בהוכלמש]{0,2}(?:סוכרת|יתר לחץ דם|אסתמה|דיכאון|חרדה|סרטן|אי ספיקת לב|אפילפסיה)(?![א-ת])/g,/\b(?:Metformin|Lisinopril|Atorvastatin|Amlodipine|Sertraline|Fluoxetine|Omeprazole|Warfarin|Aspirin|Insulin)\b/gi,/\bHbA1c\s*:?\s*[\d.]+%?/g,/\bBMI\s*:?\s*[\d.]+/g,/(?<![א-ת])[בהוכלמש]{0,2}אבחנ[הות]\s*:?\s*[^,\n.]{2,40}/g],confidence:.85,replacement:()=>"[\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"financial_amount",patterns:[/[\d,]+(?:\.\d{2})?\s*(?:₪|ש"ח|NIS|שקל(?:ים)?)/g,/(?:₪|NIS)\s*[\d,]+(?:\.\d{2})?/g],confidence:.92,replacement:()=>"[\u05E1\u05DB\u05D5\u05DD \u05DB\u05E1\u05E4\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"birth_date",patterns:[/(?:תאריך לידה|נולד|נולדה|ד\.ל\.)\s*:?\s*\d{1,2}[\/\.\-]\d{1,2}[\/\.\-]\d{2,4}/g,/(?<![א-ת])[בהוכלמש]{0,2}גיל\s*:?\s*\d{1,3}\b/g],confidence:.88,replacement:()=>"[\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"address",patterns:[/רחוב\s+[א-ת][א-ת\s"'\-]{2,30}\s+\d{1,5}/g,/(?:רח'|רח\.)\s+[א-ת][א-ת\s"'\-]{2,30}\d{1,5}/g],confidence:.72,replacement:()=>"[\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D5\u05E1\u05EA\u05E8\u05EA]"},{type:"license_plate",patterns:[/\b\d{2,3}[\-]\d{2,3}[\-]\d{2,3}\b/g],confidence:.8,replacement:()=>"[\u05DC\u05D5\u05D7\u05D9\u05EA \u05E8\u05D9\u05E9\u05D5\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8\u05EA]"}];function Qo(e){if(e.length!==9)return!1;let t=e.split("").map(Number),r=0;for(let n=0;n<9;n++){let i=t[n]*(n%2===0?1:2);i>9&&(i-=9),r+=i}return r%10===0}var he=class{constructor(t){this.enabledTypes=new Set(t)}detect(t){let r=[],n=new Set;for(let s of Yo)if(this.enabledTypes.has(s.type))for(let o of s.patterns){let a=new RegExp(o.source,o.flags),l;for(;(l=a.exec(t))!==null;){let c=l[0],u=`${s.type}:${l.index}`;if(!n.has(u)){if(n.add(u),s.type==="id_number"){let d=c.replace(/\D/g,"");if(/^\d{9}$/.test(c)&&d.length===9&&!Qo(d))continue}r.push({type:s.type,value:c,startIndex:l.index,endIndex:l.index+c.length,confidence:s.confidence,replacement:s.replacement(c,s.type)})}}}r.sort((s,o)=>s.startIndex-o.startIndex||o.confidence-s.confidence);let i=[];for(let s of r)i.some(a=>s.startIndex<a.endIndex&&s.endIndex>a.startIndex)||i.push(s);return i}};var A=["GDPR","CPRA","PPL"],ea=["GDPR-9","CPRA","PPL"],ta=[{id:"person_name",type:"name",sensitivity:"high",regulations:[...A],en:["firstname","lastname","fname","lname","middle name","maiden name","birth name","preferred name","display name","nickname","surname","given name","full name"],he:["\u05E9\u05DD \u05E4\u05E8\u05D8\u05D9","\u05E9\u05DD \u05DE\u05E9\u05E4\u05D7\u05D4","\u05E9\u05DD \u05DE\u05DC\u05D0","\u05DB\u05D9\u05E0\u05D5\u05D9","\u05E9\u05DD \u05E0\u05E2\u05D5\u05E8\u05D9\u05DD"],ar:["\u0627\u0644\u0627\u0633\u0645","\u0627\u0633\u0645 \u0627\u0644\u0639\u0627\u0626\u0644\u0629","\u0627\u0644\u0627\u0633\u0645 \u0627\u0644\u0643\u0627\u0645\u0644"],ru:["\u0438\u043C\u044F","\u0444\u0430\u043C\u0438\u043B\u0438\u044F","\u043E\u0442\u0447\u0435\u0441\u0442\u0432\u043E","\u0444\u0438\u043E"]},{id:"birth_place",type:"location",sensitivity:"medium",regulations:[...A],en:["birth place","birthplace","place of birth"],he:["\u05DE\u05E7\u05D5\u05DD \u05DC\u05D9\u05D3\u05D4","\u05D0\u05E8\u05E5 \u05DC\u05D9\u05D3\u05D4"],ar:["\u0645\u0643\u0627\u0646 \u0627\u0644\u0645\u064A\u0644\u0627\u062F"],ru:["\u043C\u0435\u0441\u0442\u043E \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F"]},{id:"citizenship",type:"sensitive_personal",sensitivity:"high",regulations:[...A],en:["citizenship","nationality"],he:["\u05D0\u05D6\u05E8\u05D7\u05D5\u05EA","\u05DC\u05D0\u05D5\u05DD"],ar:["\u0627\u0644\u062C\u0646\u0633\u064A\u0629"],ru:["\u0433\u0440\u0430\u0436\u0434\u0430\u043D\u0441\u0442\u0432\u043E"]},{id:"marital_status",type:"sensitive_personal",sensitivity:"high",regulations:[...A],en:["marital status"],he:["\u05DE\u05E6\u05D1 \u05DE\u05E9\u05E4\u05D7\u05EA\u05D9"],ar:["\u0627\u0644\u062D\u0627\u0644\u0629 \u0627\u0644\u0627\u062C\u062A\u0645\u0627\u0639\u064A\u0629"],ru:["\u0441\u0435\u043C\u0435\u0439\u043D\u043E\u0435 \u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435"]},{id:"government_id",type:"id",sensitivity:"critical",regulations:[...A],en:["ssn","national id","passport","driver license","drivers license","tax id","social security","national insurance","military id","voter id","resident id","residence permit","visa number"],he:["\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA","\u05D3\u05E8\u05DB\u05D5\u05DF","\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4","\u05DE\u05E1\u05E4\u05E8 \u05D1\u05D9\u05D8\u05D5\u05D7 \u05DC\u05D0\u05D5\u05DE\u05D9","\u05DE\u05E1\u05E4\u05E8 \u05D0\u05D9\u05E9\u05D9","\u05DE\u05E1\u05E4\u05E8 \u05D5\u05D9\u05D6\u05D4","\u05EA\u05E2\u05D5\u05D3\u05EA \u05EA\u05D5\u05E9\u05D1","\u05DE\u05E1\u05E4\u05E8 \u05E2\u05D5\u05E1\u05E7"],ar:["\u0631\u0642\u0645 \u0627\u0644\u0647\u0648\u064A\u0629","\u062C\u0648\u0627\u0632 \u0627\u0644\u0633\u0641\u0631","\u0631\u062E\u0635\u0629 \u0627\u0644\u0642\u064A\u0627\u062F\u0629"],ru:["\u043F\u0430\u0441\u043F\u043E\u0440\u0442","\u0441\u043D\u0438\u043B\u0441","\u0438\u043D\u043D","\u0432\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0435 \u0443\u0434\u043E\u0441\u0442\u043E\u0432\u0435\u0440\u0435\u043D\u0438\u0435"]},{id:"institution_person_id",type:"tracking",sensitivity:"medium",regulations:[...A],en:["employee id","employee number","employee no","student id","student number","user id","userid","customer id","customer number","customer no","client id","member id","subscriber id","participant id","profile id","person id","person uuid","lead id","crm contact","account id"],he:["\u05DE\u05E1\u05E4\u05E8 \u05E2\u05D5\u05D1\u05D3","\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D8\u05D5\u05D3\u05E0\u05D8","\u05DE\u05E1\u05E4\u05E8 \u05DC\u05E7\u05D5\u05D7","\u05DE\u05D6\u05D4\u05D4 \u05DC\u05E7\u05D5\u05D7","\u05DE\u05E1\u05E4\u05E8 \u05DE\u05E0\u05D5\u05D9","\u05DE\u05D6\u05D4\u05D4 \u05DE\u05E9\u05EA\u05DE\u05E9"],ar:["\u0631\u0642\u0645 \u0627\u0644\u0645\u0648\u0638\u0641","\u0631\u0642\u0645 \u0627\u0644\u0639\u0645\u064A\u0644"],ru:["\u0442\u0430\u0431\u0435\u043B\u044C\u043D\u044B\u0439 \u043D\u043E\u043C\u0435\u0440","\u043D\u043E\u043C\u0435\u0440 \u043A\u043B\u0438\u0435\u043D\u0442\u0430"]},{id:"patient_id",type:"medical",sensitivity:"critical",regulations:["GDPR-9","HIPAA","PPL"],en:["patient id","patient number","mrn","medical record number"],he:["\u05DE\u05E1\u05E4\u05E8 \u05DE\u05D8\u05D5\u05E4\u05DC","\u05DE\u05E1\u05E4\u05E8 \u05EA\u05D9\u05E7 \u05E8\u05E4\u05D5\u05D0\u05D9"],ar:["\u0631\u0642\u0645 \u0627\u0644\u0645\u0631\u064A\u0636"],ru:["\u043D\u043E\u043C\u0435\u0440 \u043F\u0430\u0446\u0438\u0435\u043D\u0442\u0430"]},{id:"email",type:"email",sensitivity:"high",regulations:[...A],en:["emailaddress","e mail","recovery email","contact email"],he:["\u05D3\u05D5\u05D0\u05DC","\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC"],ar:["\u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A"],ru:["\u043F\u043E\u0447\u0442\u0430","\u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430","email"]},{id:"phone",type:"phone",sensitivity:"high",regulations:[...A],en:["cellphone","contact number","work phone","home phone","whatsapp","recovery phone","telephone"],he:["\u05D8\u05DC\u05E4\u05D5\u05DF \u05D1\u05D9\u05EA","\u05D8\u05DC\u05E4\u05D5\u05DF \u05E2\u05D1\u05D5\u05D3\u05D4","\u05D5\u05D5\u05D8\u05E1\u05D0\u05E4","\u05DE\u05E1\u05E4\u05E8 \u05E0\u05D9\u05D9\u05D3"],ar:["\u0647\u0627\u062A\u0641","\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062A\u0641","\u062C\u0648\u0627\u0644"],ru:["\u0442\u0435\u043B\u0435\u0444\u043E\u043D","\u043C\u043E\u0431\u0438\u043B\u044C\u043D\u044B\u0439"]},{id:"social_handle",type:"tracking",sensitivity:"medium",regulations:[...A],en:["telegram","linkedin","facebook","twitter","instagram","tiktok","social profile"],he:["\u05D8\u05DC\u05D2\u05E8\u05DD","\u05DC\u05D9\u05E0\u05E7\u05D3\u05D0\u05D9\u05DF","\u05E4\u05D9\u05D9\u05E1\u05D1\u05D5\u05E7","\u05D0\u05D9\u05E0\u05E1\u05D8\u05D2\u05E8\u05DD"]},{id:"address",type:"address",sensitivity:"high",regulations:[...A],en:["house number","apartment","apt","billing address","shipping address","postal code","zip code","postcode","street"],he:["\u05DE\u05E1\u05E4\u05E8 \u05D1\u05D9\u05EA","\u05D3\u05D9\u05E8\u05D4","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DC\u05DE\u05E9\u05DC\u05D5\u05D7","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DC\u05D7\u05D9\u05D5\u05D1","\u05EA.\u05D3","\u05EA\u05D0 \u05D3\u05D5\u05D0\u05E8"],ar:["\u0627\u0644\u0639\u0646\u0648\u0627\u0646","\u0627\u0644\u0634\u0627\u0631\u0639","\u0627\u0644\u0631\u0645\u0632 \u0627\u0644\u0628\u0631\u064A\u062F\u064A"],ru:["\u0430\u0434\u0440\u0435\u0441","\u0443\u043B\u0438\u0446\u0430","\u0438\u043D\u0434\u0435\u043A\u0441","\u043A\u0432\u0430\u0440\u0442\u0438\u0440\u0430"]},{id:"geo",type:"location",sensitivity:"high",regulations:[...A],en:["geo location","geolocation","latitude","longitude","coordinates","home location","current location"],he:["\u05DE\u05D9\u05E7\u05D5\u05DD","\u05E7\u05D5\u05D0\u05D5\u05E8\u05D3\u05D9\u05E0\u05D8\u05D5\u05EA"],ar:["\u0627\u0644\u0645\u0648\u0642\u0639"],ru:["\u043C\u0435\u0441\u0442\u043E\u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435","\u043A\u043E\u043E\u0440\u0434\u0438\u043D\u0430\u0442\u044B"]},{id:"bank_card",type:"financial",sensitivity:"critical",regulations:[...A],en:["bank account","iban","swift","bic","routing number","credit card","creditcard","card number","cvv","card expiry","cc exp","paypal","wallet address","crypto wallet","bitcoin address"],he:["\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7","\u05DE\u05E1\u05E4\u05E8 \u05D7\u05E9\u05D1\u05D5\u05DF","\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9","\u05D0\u05E8\u05E0\u05E7 \u05E7\u05E8\u05D9\u05E4\u05D8\u05D5","\u05D0\u05E8\u05E0\u05E7 \u05D3\u05D9\u05D2\u05D9\u05D8\u05DC\u05D9"],ar:["\u062D\u0633\u0627\u0628 \u0628\u0646\u0643\u064A","\u0631\u0642\u0645 \u0627\u0644\u062D\u0633\u0627\u0628","\u0628\u0637\u0627\u0642\u0629 \u0627\u0626\u062A\u0645\u0627\u0646"],ru:["\u0440\u0430\u0441\u0447\u0435\u0442\u043D\u044B\u0439 \u0441\u0447\u0435\u0442","\u043D\u043E\u043C\u0435\u0440 \u0441\u0447\u0435\u0442\u0430","\u043D\u043E\u043C\u0435\u0440 \u043A\u0430\u0440\u0442\u044B","\u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430\u044F \u043A\u0430\u0440\u0442\u0430"]},{id:"income_tax",type:"financial",sensitivity:"high",regulations:[...A],en:["salary","income","wage","tax record","tax return","payment history","credit score","net worth","salary grade"],he:["\u05E9\u05DB\u05E8","\u05DE\u05E9\u05DB\u05D5\u05E8\u05EA","\u05D4\u05DB\u05E0\u05E1\u05D4","\u05EA\u05DC\u05D5\u05E9 \u05E9\u05DB\u05E8","\u05D3\u05D5\u05D7 \u05DE\u05E1","\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05EA\u05E9\u05DC\u05D5\u05DE\u05D9\u05DD","\u05D3\u05D9\u05E8\u05D5\u05D2 \u05D0\u05E9\u05E8\u05D0\u05D9","\u05E9\u05D5\u05D5\u05D9 \u05E0\u05E7\u05D9","\u05D3\u05E8\u05D2\u05EA \u05E9\u05DB\u05E8"],ar:["\u0627\u0644\u0631\u0627\u062A\u0628","\u0627\u0644\u062F\u062E\u0644"],ru:["\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430","\u0434\u043E\u0445\u043E\u0434"]},{id:"assets",type:"financial",sensitivity:"high",regulations:[...A],en:["property id","land record","ownership record","title deed","holdings"],he:["\u05D2\u05D5\u05E9 \u05D7\u05DC\u05E7\u05D4","\u05E0\u05E1\u05D7 \u05D8\u05D0\u05D1\u05D5","\u05E8\u05D9\u05E9\u05D5\u05DD \u05DE\u05E7\u05E8\u05E7\u05E2\u05D9\u05DF","\u05D1\u05E2\u05DC\u05D5\u05EA","\u05D0\u05D7\u05D6\u05E7\u05D5\u05EA"],ru:["\u0441\u043E\u0431\u0441\u0442\u0432\u0435\u043D\u043D\u043E\u0441\u0442\u044C","\u043D\u0435\u0434\u0432\u0438\u0436\u0438\u043C\u043E\u0441\u0442\u044C"]},{id:"vehicle",type:"tracking",sensitivity:"medium",regulations:[...A],en:["vin","vehicle id","license plate","registration number","plate number"],he:["\u05DE\u05E1\u05E4\u05E8 \u05E9\u05DC\u05D3\u05D4","\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1","\u05DC\u05D5\u05D7\u05D9\u05EA \u05E8\u05D9\u05E9\u05D5\u05D9"],ru:["\u043D\u043E\u043C\u0435\u0440 \u0430\u0432\u0442\u043E\u043C\u043E\u0431\u0438\u043B\u044F","vin"]},{id:"health",type:"medical",sensitivity:"critical",regulations:["GDPR-9","HIPAA","PPL"],en:["medical record","health condition","health data","lab result","lab results","vaccination","mental health","hospitalization","hospitalisation","disability","insurance number","diagnosis","allergy","prescription","medication","blood type"],he:["\u05EA\u05D9\u05E7 \u05E8\u05E4\u05D5\u05D0\u05D9","\u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05DE\u05E2\u05D1\u05D3\u05D4","\u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05D1\u05D3\u05D9\u05E7\u05D4","\u05D7\u05D9\u05E1\u05D5\u05E0\u05D9\u05DD","\u05D1\u05E8\u05D9\u05D0\u05D5\u05EA \u05E0\u05E4\u05E9","\u05D0\u05E9\u05E4\u05D5\u05D6","\u05E0\u05DB\u05D5\u05EA","\u05DE\u05E6\u05D1 \u05D1\u05E8\u05D9\u05D0\u05D5\u05EA\u05D9"],ar:["\u0627\u0644\u062A\u0634\u062E\u064A\u0635","\u0627\u0644\u0633\u062C\u0644 \u0627\u0644\u0637\u0628\u064A","\u0627\u0644\u0623\u062F\u0648\u064A\u0629"],ru:["\u0434\u0438\u0430\u0433\u043D\u043E\u0437","\u043C\u0435\u0434\u0438\u0446\u0438\u043D\u0441\u043A\u0430\u044F \u043A\u0430\u0440\u0442\u0430","\u0430\u043D\u0430\u043B\u0438\u0437\u044B"]},{id:"biometric",type:"biometric",sensitivity:"critical",regulations:["GDPR-9","CPRA","PPL"],en:["face embedding","face scan","iris scan","retina scan","voice print","voiceprint","voice signature","hand geometry","biometric template","biometric data","dna","genetic data","genome"],he:["\u05D8\u05D1\u05D9\u05E2\u05EA \u05E7\u05D5\u05DC","\u05E1\u05E8\u05D9\u05E7\u05EA \u05E4\u05E0\u05D9\u05DD","\u05E1\u05E8\u05D9\u05E7\u05EA \u05E7\u05E9\u05EA\u05D9\u05EA","\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05D2\u05E0\u05D8\u05D9\u05D9\u05DD",'\u05D3\u05E0"\u05D0'],ar:["\u0628\u0635\u0645\u0629"],ru:["\u0431\u0438\u043E\u043C\u0435\u0442\u0440\u0438\u044F","\u043E\u0442\u043F\u0435\u0447\u0430\u0442\u043E\u043A"]},{id:"employment",type:"employment",sensitivity:"medium",regulations:[...A],en:["employer","job title","employment status","hire date","start date of employment","termination date","performance review","disciplinary"],he:["\u05DE\u05E2\u05E1\u05D9\u05E7","\u05DE\u05E7\u05D5\u05DD \u05E2\u05D1\u05D5\u05D3\u05D4","\u05EA\u05E4\u05E7\u05D9\u05D3 \u05D4\u05E2\u05D5\u05D1\u05D3","\u05EA\u05D0\u05E8\u05D9\u05DA \u05EA\u05D7\u05D9\u05DC\u05EA \u05E2\u05D1\u05D5\u05D3\u05D4","\u05EA\u05D0\u05E8\u05D9\u05DA \u05E1\u05D9\u05D5\u05DD \u05E2\u05D1\u05D5\u05D3\u05D4","\u05D4\u05E2\u05E8\u05DB\u05EA \u05D1\u05D9\u05E6\u05D5\u05E2\u05D9\u05DD","\u05E9\u05D9\u05DE\u05D5\u05E2"],ar:["\u062C\u0647\u0629 \u0627\u0644\u0639\u0645\u0644","\u0627\u0644\u0645\u0633\u0645\u0649 \u0627\u0644\u0648\u0638\u064A\u0641\u064A"],ru:["\u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044C","\u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C"]},{id:"manager",type:"name",sensitivity:"medium",regulations:[...A],en:["manager","supervisor"],he:["\u05DE\u05E0\u05D4\u05DC \u05D9\u05E9\u05D9\u05E8"]},{id:"education",type:"education",sensitivity:"medium",regulations:[...A],en:["school","university","college","degree","transcript","education history","gpa"],he:["\u05D1\u05D9\u05EA \u05E1\u05E4\u05E8","\u05D0\u05D5\u05E0\u05D9\u05D1\u05E8\u05E1\u05D9\u05D8\u05D4","\u05DE\u05DB\u05DC\u05DC\u05D4","\u05D2\u05D9\u05DC\u05D9\u05D5\u05DF \u05E6\u05D9\u05D5\u05E0\u05D9\u05DD","\u05D4\u05E9\u05DB\u05DC\u05D4","\u05EA\u05D5\u05D0\u05E8 \u05D0\u05E7\u05D3\u05DE\u05D9"],ar:["\u0627\u0644\u062C\u0627\u0645\u0639\u0629","\u0627\u0644\u0645\u062F\u0631\u0633\u0629"],ru:["\u043E\u0431\u0440\u0430\u0437\u043E\u0432\u0430\u043D\u0438\u0435","\u0443\u043D\u0438\u0432\u0435\u0440\u0441\u0438\u0442\u0435\u0442"]},{id:"device_online",type:"tracking",sensitivity:"medium",regulations:[...A],en:["ip","ipaddress","ip address","mac address","device id","deviceid","advertising id","idfa","gaid","android id","apple id","cookie id","cookieid","browser fingerprint","user agent","imei"],he:["\u05DB\u05EA\u05D5\u05D1\u05EA ip","\u05DE\u05D6\u05D4\u05D4 \u05DE\u05DB\u05E9\u05D9\u05E8"],ru:["ip \u0430\u0434\u0440\u0435\u0441"]},{id:"account",type:"tracking",sensitivity:"medium",regulations:[...A],en:["username","user name","login","screen name"],he:["\u05E9\u05DD \u05DE\u05E9\u05EA\u05DE\u05E9"],ru:["\u043B\u043E\u0433\u0438\u043D"]},{id:"credential",type:"auth",sensitivity:"critical",regulations:[...A],en:["password","password hash","mfa secret","otp secret","security question","security answer","session id","session token","api key"],he:["\u05E1\u05D9\u05E1\u05DE\u05D4","\u05E1\u05D9\u05E1\u05DE\u05D0","\u05E9\u05D0\u05DC\u05EA \u05D0\u05D1\u05D8\u05D7\u05D4"],ar:["\u0643\u0644\u0645\u0629 \u0627\u0644\u0645\u0631\u0648\u0631"],ru:["\u043F\u0430\u0440\u043E\u043B\u044C"]},{id:"behavior",type:"behavior",sensitivity:"high",regulations:[...A],en:["purchase history","search history","browsing history","clickstream","usage pattern","behavior profile","behaviour profile"],he:["\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05E8\u05DB\u05D9\u05E9\u05D5\u05EA","\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05D7\u05D9\u05E4\u05D5\u05E9","\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05D2\u05DC\u05D9\u05E9\u05D4","\u05E4\u05E8\u05D5\u05E4\u05D9\u05DC \u05D4\u05EA\u05E0\u05D4\u05D2\u05D5\u05EA"]},{id:"special_category",type:"sensitive_personal",sensitivity:"critical",regulations:[...ea],en:["race","ethnicity","religion","political opinion","political party","union membership","trade union","sexual orientation","gender identity","criminal record"],he:["\u05D2\u05D6\u05E2","\u05D3\u05EA","\u05D4\u05E9\u05E7\u05E4\u05D4 \u05E4\u05D5\u05DC\u05D9\u05D8\u05D9\u05EA","\u05D7\u05D1\u05E8\u05D5\u05EA \u05D1\u05D0\u05D9\u05D2\u05D5\u05D3","\u05E0\u05D8\u05D9\u05D9\u05D4 \u05DE\u05D9\u05E0\u05D9\u05EA","\u05D6\u05D4\u05D5\u05EA \u05DE\u05D2\u05D3\u05E8\u05D9\u05EA","\u05E8\u05D9\u05E9\u05D5\u05DD \u05E4\u05DC\u05D9\u05DC\u05D9"],ar:["\u0627\u0644\u062F\u064A\u0627\u0646\u0629","\u0627\u0644\u0639\u0631\u0642"],ru:["\u0440\u0435\u043B\u0438\u0433\u0438\u044F","\u043D\u0430\u0446\u0438\u043E\u043D\u0430\u043B\u044C\u043D\u043E\u0441\u0442\u044C"]},{id:"family_names",type:"name",sensitivity:"high",regulations:[...A],en:["mother name","father name","spouse","partner name","emergency contact","next of kin","family member","guardian","beneficiary"],he:["\u05E9\u05DD \u05D4\u05D0\u05DD","\u05E9\u05DD \u05D4\u05D0\u05D1","\u05D1\u05DF \u05D6\u05D5\u05D2","\u05D1\u05EA \u05D6\u05D5\u05D2","\u05D0\u05D9\u05E9 \u05E7\u05E9\u05E8 \u05DC\u05D7\u05D9\u05E8\u05D5\u05DD","\u05E7\u05E8\u05D5\u05D1 \u05DE\u05E9\u05E4\u05D7\u05D4","\u05D0\u05E4\u05D5\u05D8\u05E8\u05D5\u05E4\u05D5\u05E1","\u05DE\u05D5\u05D8\u05D1"],ar:["\u0627\u0633\u0645 \u0627\u0644\u0623\u0645","\u0627\u0633\u0645 \u0627\u0644\u0623\u0628","\u0627\u0644\u0632\u0648\u062C"],ru:["\u0441\u0443\u043F\u0440\u0443\u0433","\u043E\u043F\u0435\u043A\u0443\u043D"]},{id:"children",type:"minor_data",sensitivity:"critical",regulations:[...A],en:["children","child name","dependents","dependants"],he:["\u05D9\u05DC\u05D3\u05D9\u05DD","\u05E9\u05DE\u05D5\u05EA \u05D4\u05D9\u05DC\u05D3\u05D9\u05DD"],ar:["\u0627\u0644\u0623\u0637\u0641\u0627\u0644"],ru:["\u0434\u0435\u0442\u0438"]}];function na(e){return e.trim().toLowerCase().replace(/["'`׳״]/g,"").replace(/[_\-.]+/g," ").replace(/\s+/g," ").trim()}function Rr(){return ta.map(e=>{let t=[...e.en,...e.he??[],...e.ar??[],...e.ru??[]].map(na).filter(Boolean);return{type:e.type,tokens:t.filter(r=>!r.includes(" ")),phrases:t.filter(r=>r.includes(" "))}})}var ra=[{pattern:/^(?:שם|שם_מלא|שם פרטי|שם_פרטי|שם משפחה|שם_משפחה|שם_אדם|שם הלקוח|שם_הלקוח|שם בן זוג|שם בן_זוג|שם המבוטח|שם_המבוטח|שם המוטב|שם_המוטב|שם מבוטח|שם_מבוטח|שם מוטב|שם_מוטב|שם הילד|שם_הילד|שם הקטין|שם_הקטין|firstname_he|lastname_he|shem|shem_mishpacha|shem_prati)$/i,type:"name",label:"Person name (Hebrew)",labelHe:"\u05E9\u05DD \u05D0\u05D3\u05DD"},{pattern:/^(?:ת"ז|ת\.ז|ת ז|תז|תעודת זהות|תעודת_זהות|מספר זהות|מספר_זהות|מס' זהות|מס_זהות|מס' ת"ז|teudat_zehut|tz|t_z|israeli_id|il_id)$/i,type:"id",label:"Israeli ID",labelHe:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA"},{pattern:/^(?:דרכון|מספר דרכון|מס דרכון|רישיון נהיגה|רישיון_נהיגה|רשיון נהיגה|מס רישיון|דרכון_מספר)$/i,type:"id",label:"Passport / DL (Hebrew)",labelHe:"\u05D3\u05E8\u05DB\u05D5\u05DF/\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF"},{pattern:/^(?:מייל|דוא"ל|דוא_ל|דואר אלקטרוני|דואר_אלקטרוני|אימייל|כתובת מייל|כתובת_מייל|כתובת דואר|כתובת_דואר)$/i,type:"email",label:"Email (Hebrew)",labelHe:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9"},{pattern:/^(?:טלפון|טל'|נייד|פלאפון|סלולרי|מספר טלפון|מספר_טלפון|טלפון נייד|טלפון_נייד|מס נייד|מס_נייד|מס' טל)$/i,type:"phone",label:"Phone (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF"},{pattern:/^(?:כתובת|כתובת מגורים|כתובת_מגורים|רחוב|מס בית|מספר בית|עיר|ישוב|יישוב|מיקוד|כתובת מלאה|כתובת_מלאה|מען)$/i,type:"address",label:"Address (Hebrew)",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA"},{pattern:/^(?:תאריך לידה|תאריך_לידה|ת לידה|תאריך הולדת|תאריך_הולדת|יום הולדת|יום_הולדת|גיל)$/i,type:"dob",label:"Date of birth (Hebrew)",labelHe:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"},{pattern:/^(?:חשבון בנק|חשבון_בנק|מספר חשבון|מספר_חשבון|מס חשבון|מס' חשבון|בנק|סניף|מס סניף|iban|iban_il)$/i,type:"financial",label:"Bank account (Hebrew)",labelHe:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7"},{pattern:/^(?:כרטיס אשראי|כרטיס_אשראי|מספר אשראי|מס אשראי|מס' אשראי|cvv|אשראי|מס כרטיס|מס_כרטיס)$/i,type:"financial",label:"Credit card (Hebrew)",labelHe:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"},{pattern:/^(?:שכר|משכורת|הכנסה|פרמיה|שכר ברוטו|שכר_ברוטו|שכר נטו|שכר_נטו|תגמול|בונוס|פיצוי)$/i,type:"financial",label:"Salary / income (Hebrew)",labelHe:"\u05E9\u05DB\u05E8/\u05D4\u05DB\u05E0\u05E1\u05D4"},{pattern:/^(?:אבחון|אבחנה|מחלה|תרופה|מרשם|בדיקה רפואית|בדיקה_רפואית|מצב רפואי|מצב_רפואי|חיסון|תוצאת בדיקה|תוצאת_בדיקה|רופא|רגישות|אלרגיה|סוג דם|סוג_דם)$/i,type:"medical",label:"Medical (Hebrew)",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(?:מספר פוליסה|מספר_פוליסה|מס פוליסה|מס' פוליסה|פוליסה|מספר חבר|מספר_חבר|מס חבר|מספר ביטוח|מספר_ביטוח|policy_?number|policy_?no|policy_?id)$/i,type:"policy",label:"Insurance policy number (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"},{pattern:/^(?:מספר סוכן|מספר_סוכן|מס סוכן|מס' סוכן|מס_סוכן|קוד סוכן|קוד_סוכן|מספר משווק|מספר_משווק|מספר יצרן|סוכן ביטוח|agent_?number|agent_?no|agent_?id|agent_?code|broker_?id|broker_?number)$/i,type:"agent_id",label:"Insurance agent / broker number (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF"},{pattern:/^(?:שם הילד|שם_הילד|תעודת זהות של ילד|ילדים|קטין|מספר ילדים|מספר_ילדים|תעודת לידה|ת לידה ילד)$/i,type:"minor_data",label:"Minor data (Hebrew)",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF"},{pattern:/^(?:דת|לאום|מין|נטייה מינית|נטייה_מינית|השקפה פוליטית|השקפה_פוליטית|מצב משפחתי|מצב_משפחתי|עדה|מוצא)$/i,type:"sensitive_personal",label:"Sensitive personal (Hebrew)",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9"},{pattern:/^(?:מספר רכב|מספר_רכב|מס רכב|מס' רכב|לוחית רישוי|לוחית_רישוי|מספר רישוי|מספר_רישוי)$/i,type:"tracking",label:"Vehicle ID (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"}];function qt(e){let t=String(e??"").replace(/\D/g,"");if(t.length===0||t.length>9)return!1;let r=t.padStart(9,"0"),n=0;for(let i=0;i<9;i++){let s=parseInt(r[i]??"0",10)*(i%2+1);s>9&&(s-=9),n+=s}return n%10===0&&parseInt(r,10)>0}var st=/(?:\+972[\s-]?|0)(?:5[0-9]|[2-4]|[89])(?:[\s-]?\d){7}/g,ot=/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}/gi,at=/\bIL\d{2}\s?(?:\d{4}\s?){4}\d{3}\b/g;function Cr(e){let t=String(e??"").replace(/\D/g,"");if(t.length<13||t.length>19)return!1;let r=0,n=!1;for(let i=t.length-1;i>=0;i--){let s=t.charCodeAt(i)-48;if(s<0||s>9)return!1;n&&(s*=2,s>9&&(s-=9)),r+=s,n=!n}return r%10===0}function Pr(e){if(!e)return null;let t=e.trim();for(let r of ra)if(r.pattern.test(t))return{type:r.type,label:r.label,labelHe:r.labelHe};return null}var ia=[{type:"biometric",tokens:["biometric","fingerprint","\u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9"],phrases:["face id","\u05D8\u05D1\u05D9\u05E2\u05EA \u05D0\u05E6\u05D1\u05E2"]},{type:"medical",tokens:["diagnosis","medical","disease","medication","prescription","allergy","vaccine","\u05D0\u05D1\u05D7\u05D5\u05DF","\u05D0\u05D1\u05D7\u05E0\u05D4","\u05DE\u05D7\u05DC\u05D4","\u05EA\u05E8\u05D5\u05E4\u05D4","\u05DE\u05E8\u05E9\u05DD","\u05D7\u05D9\u05E1\u05D5\u05DF","\u05D0\u05DC\u05E8\u05D2\u05D9\u05D4"],phrases:["medical record","blood type","\u05DE\u05E6\u05D1 \u05E8\u05E4\u05D5\u05D0\u05D9","\u05E1\u05D5\u05D2 \u05D3\u05DD"]},{type:"sensitive_personal",tokens:["religion","ethnicity","nationality","\u05D3\u05EA","\u05DC\u05D0\u05D5\u05DD","\u05E2\u05D3\u05D4","\u05DE\u05D5\u05E6\u05D0"],phrases:["sexual orientation","marital status","\u05DE\u05E6\u05D1 \u05DE\u05E9\u05E4\u05D7\u05EA\u05D9","\u05E0\u05D8\u05D9\u05D9\u05D4 \u05DE\u05D9\u05E0\u05D9\u05EA"]},{type:"minor_data",tokens:["minor","\u05E7\u05D8\u05D9\u05DF"],phrases:["child name","\u05E9\u05DD \u05D4\u05D9\u05DC\u05D3","\u05E9\u05DD \u05D4\u05E7\u05D8\u05D9\u05DF"]},{type:"id",tokens:["ssn","passport","\u05D6\u05D4\u05D5\u05EA","\u05D3\u05E8\u05DB\u05D5\u05DF"],phrases:["national id","id number","identity number","social security","driver license","driving license","drivers license","passport number","tax id","\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA","\u05DE\u05E1\u05E4\u05E8 \u05D6\u05D4\u05D5\u05EA","\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4"]},{type:"financial",tokens:["iban","swift","bic","salary","income","wage","\u05D0\u05E9\u05E8\u05D0\u05D9","\u05E9\u05DB\u05E8","\u05DE\u05E9\u05DB\u05D5\u05E8\u05EA","\u05D4\u05DB\u05E0\u05E1\u05D4"],phrases:["bank account","account number","credit card","card number","routing number","sort code","\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7","\u05DE\u05E1\u05E4\u05E8 \u05D7\u05E9\u05D1\u05D5\u05DF","\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"]},{type:"policy",tokens:["policy","\u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"],phrases:["policy number","member number","\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"]},{type:"agent_id",tokens:["\u05DE\u05E9\u05D5\u05D5\u05E7"],phrases:["agent number","agent code","broker id","\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF"]},{type:"dob",tokens:["dob","birthdate","birthday","\u05DC\u05D9\u05D3\u05D4","\u05D4\u05D5\u05DC\u05D3\u05EA","\u05D2\u05D9\u05DC"],phrases:["date of birth","birth date","\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"]},{type:"phone",tokens:["phone","tel","mobile","cell","fax","\u05D8\u05DC\u05E4\u05D5\u05DF","\u05E0\u05D9\u05D9\u05D3","\u05E4\u05DC\u05D0\u05E4\u05D5\u05DF","\u05E1\u05DC\u05D5\u05DC\u05E8\u05D9"],phrases:["phone number","mobile number","cell phone","\u05D8\u05DC\u05E4\u05D5\u05DF \u05E0\u05D9\u05D9\u05D3"]},{type:"email",tokens:["email","mail","\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC","\u05DE\u05D9\u05D9\u05DC","\u05D3\u05D5\u05D0\u05DC"],phrases:["email address","e mail","\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D9\u05D9\u05DC"]},{type:"address",tokens:["address","street","city","zipcode","zip","postcode","\u05DB\u05EA\u05D5\u05D1\u05EA","\u05E8\u05D7\u05D5\u05D1","\u05E2\u05D9\u05E8","\u05D9\u05E9\u05D5\u05D1","\u05D9\u05D9\u05E9\u05D5\u05D1","\u05DE\u05D9\u05E7\u05D5\u05D3","\u05DE\u05E2\u05DF"],phrases:["home address","postal code","street address","zip code","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D2\u05D5\u05E8\u05D9\u05DD"]},{type:"location",tokens:["gps","latitude","longitude","geolocation","\u05DE\u05D9\u05E7\u05D5\u05DD"],phrases:["gps coordinates"]},{type:"tracking",tokens:["plate","vehicle","\u05E8\u05DB\u05D1","\u05E8\u05D9\u05E9\u05D5\u05D9"],phrases:["license plate","vehicle number","plate number","\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"]},...Rr(),{type:"name",tokens:["name","\u05E9\u05DD"],phrases:["first name","last name","full name","family name","given name","surname","\u05E9\u05DD \u05E4\u05E8\u05D8\u05D9","\u05E9\u05DD \u05DE\u05E9\u05E4\u05D7\u05D4","\u05E9\u05DD \u05DE\u05DC\u05D0"]}];function ct(e){if(!e||/^\[[A-Z_]+(?:-\d+)?\]$/.test(e.trim()))return null;let t=e.trim().toLowerCase().replace(/["'`׳״]/g,"").replace(/[_\-.]+/g," ").replace(/\s+/g," ").trim();if(!t)return null;let r=new Set(t.match(/[\p{L}\p{N}]+/gu)??[]);for(let n of ia)if(n.phrases?.some(s=>t.includes(s))||n.tokens?.some(s=>r.has(s)))return{type:n.type,label:n.type,labelHe:lt(n.type)};return null}function lt(e){return{id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",agent_id:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF",employment:"\u05E4\u05E8\u05D8\u05D9 \u05EA\u05E2\u05E1\u05D5\u05E7\u05D4",education:"\u05D4\u05E9\u05DB\u05DC\u05D4",behavior:"\u05E4\u05E8\u05D5\u05E4\u05D9\u05DC \u05D4\u05EA\u05E0\u05D4\u05D2\u05D5\u05EA",policy:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4",name:"\u05E9\u05DD \u05D0\u05D3\u05DD",email:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9",phone:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF",address:"\u05DB\u05EA\u05D5\u05D1\u05EA",dob:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4",financial:"\u05E4\u05E8\u05D8\u05D9\u05DD \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9\u05D9\u05DD",medical:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9",minor_data:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF",sensitive_personal:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9",biometric:"\u05DE\u05D9\u05D3\u05E2 \u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9",auth:"\u05E1\u05D9\u05E1\u05DE\u05D0\u05D5\u05EA/\u05E1\u05D5\u05D3\u05D5\u05EA",tracking:"\u05DE\u05D6\u05D4\u05D9 \u05DE\u05E2\u05E7\u05D1",location:"\u05DE\u05D9\u05E7\u05D5\u05DD"}[e]??"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9"}function Lr(e){let t=0,r=0,n=0,i=0,s=0;for(let a of e)typeof a=="string"&&(qt(a)&&t++,st.lastIndex=0,st.test(a)&&r++,ot.lastIndex=0,ot.test(a)&&n++,at.lastIndex=0,at.test(a)&&i++,Cr(a)&&s++);let o=e.length||1;return t/o>=.3?{type:"id",label:"Israeli ID (sniffed)",matchedSample:t}:i/o>=.3?{type:"financial",label:"IBAN-IL (sniffed)",matchedSample:i}:r/o>=.3?{type:"phone",label:"IL phone (sniffed)",matchedSample:r}:n/o>=.3?{type:"email",label:"Email (sniffed)",matchedSample:n}:s/o>=.3?{type:"financial",label:"Credit card (sniffed)",matchedSample:s}:null}var sa=[{type:"full_name",kind:"name",severity:"medium",hint:`A person's name in free text (after a role word such as \u05DC\u05E7\u05D5\u05D7 / \u05DE\u05E8 / \u05E2\u05D5"\u05D3, or Client: / Mr.).`},{type:"bank_account",kind:"bank_account",severity:"high",hint:"An Israeli bank account number (branch-account-check form) in plaintext."},{type:"medical",kind:"medical",severity:"high",hint:"Medical information (diagnosis, medication, lab value) in plaintext."},{type:"birth_date",kind:"dob",severity:"medium",hint:"A date of birth in plaintext."},{type:"address",kind:"address",severity:"medium",hint:"A street address in plaintext."},{type:"license_plate",kind:"plate",severity:"low",hint:"A vehicle licence plate in plaintext."}],oa=/^(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק|עו"ד|ד"ר|פרופ'|מר|גברת|חשבון|ח-ן|[בהוכלמש]{0,2}אבחנ[הות]|תאריך לידה|נולד|נולדה|ד\.ל\.|[בהוכלמש]{0,2}גיל)\s*:?\s*/;function aa(e,t,r,n){if(n==="address")return{start:t,end:r};let i=oa.exec(e.slice(t,r));return i&&t+i[0].length<r?{start:t+i[0].length,end:r}:{start:t,end:r}}function j(e,t,r=()=>!0){let n=[],i=new RegExp(e.source,e.flags.includes("g")?e.flags:e.flags+"g");for(let s of t.matchAll(i)){let o=s[1];if(!o||!r(o))continue;let a=(s.index??0)+s[0].indexOf(o);n.push({start:a,end:a+o.length})}return n}var Dr=String.raw`[A-Z][a-z']+(?:-[A-Z]?[a-z']+)*`,Yt=String.raw`${Dr}(?:[ \t]+${Dr}){0,2}`,ca=new RegExp(String.raw`\b(?:Mr|Mrs|Ms|Miss|Dr|Prof)\.?[ \t]+(${Yt})`),la=new RegExp(String.raw`\b(?:Client|Customer|Patient|Name|Full name|Beneficiary|Insured|Applicant|Tenant|Employee|Holder|Investor)[ \t]*:[ \t]*(${Yt})`),da=new RegExp(String.raw`\b(${Yt})(?=,[ \t]*\d{1,3}[ \t]*,|[ \t]*\(\d{1,3}\))`,"g"),ua=/^(?:Figure|Fig|Table|Step|Section|Chapter|Page|Shot|Scene|Part|Item|Note|Appendix|Version|Level|Phase|Round|Room|Floor|Line|Act|Episode|Season|Slide|Clip|Take)$/,fa=/\b(\d{1,5}[ \t]+(?:[A-Z][A-Za-z'-]*[ \t]+){1,3}(?:Street|St|Road|Rd|Avenue|Ave|Boulevard|Blvd|Lane|Ln|Drive|Way|Court|Ct|Place|Pl)\b\.?)/,pa=/\b(?:policy|claim|account|member|customer|client|contract|case|reference|ref|company|registration)[ \t]+(?:number|no\.?|num\.?|#)[ \t]*:?[ \t]*([A-Z]{0,4}-?\d[\d-]{3,}\d[A-Z]?)\b/i,ha=String.raw`\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4}|\d{4}[\/\-.]\d{1,2}[\/\-.]\d{1,2}|\d{1,2}\s+[A-Z][a-z]{2,8}\s+\d{4}|[A-Z][a-z]{2,8}\s+\d{1,2},?\s+\d{4}`,ma=new RegExp(String.raw`\b(?:date\s+of\s+birth|birth\s*date|d\.?o\.?b\.?|born(?:\s+on)?)\s*[:\-]?\s*(${ha})`,"i"),ga=/\b((?!000|666|9\d\d)\d{3}-(?!00)\d{2}-(?!0000)\d{4})\b/,ya=/\b((?!BG|GB|NK|KN|TN|NT|ZZ)[A-CEGHJ-PR-TW-Z][A-CEGHJ-NPR-TW-Z]\s?\d{2}\s?\d{2}\s?\d{2}\s?[A-D])\b/,ba=/(?<![\w+])(\+(?!972)[1-9][\d\s().-]{7,20}\d)/,Nr=e=>e.replace(/\D/g,"").length,_a=[{kind:"name",severity:"medium",hint:"A person's name in free text (after Mr. / Dr. / Client: \u2026, or with an age beside it).",find:e=>[...j(ca,e),...j(la,e),...j(da,e,t=>!ua.test(t.split(/[ \t]/).pop()??""))]},{kind:"address",severity:"medium",hint:"A street address in plaintext.",find:e=>j(fa,e)},{kind:"reference",severity:"medium",hint:"A policy, claim, account or company number in plaintext.",find:e=>j(pa,e)},{kind:"dob",severity:"medium",hint:"A date of birth in plaintext.",find:e=>j(ma,e)},{kind:"national_id",severity:"high",hint:"A national ID number (US SSN, UK NINO) in plaintext.",find:e=>[...j(ga,e),...j(ya,e)]},{kind:"phone",severity:"high",hint:"A phone number in international form in plaintext.",find:e=>j(ba,e,t=>Nr(t)>=8&&Nr(t)<=15)}];function xa(e){let t=new Map;for(let r of e){let n=t.get(r.kind);t.set(r.kind,n?{...n,find:i=>[...n.find(i),...r.find(i)]}:r)}return[...t.values()]}function Or(){let e=sa.map(({type:t,kind:r,severity:n,hint:i})=>{let s=new he([t]);return{kind:r,severity:n,hint:i,find:o=>s.detect(o).map(a=>aa(o,a.startIndex,a.endIndex,r))}});return xa([...e,..._a])}var dt={_comment:"CANONICAL secret ruleset \u2014 the SINGLE SOURCE OF TRUTH for hardcoded-secret detection, loaded by BOTH the web scanner (lib/soc/exposure-map.ts) and the installed Capsule agent (apps/desktop/src-tauri/src/scanner.rs, via include_str!). Patterns are written in the regex subset both JavaScript and the Rust `regex` crate accept (no lookaround, no backreferences). A connection string counts only WITH credentials (user:pass@). Edit here once and both engines stay aligned.",rules:[{id:"aws-access-key",subkind:"aws_access_key",name:"AWS Access Key",severity:"critical",pattern:"(?:^|[^A-Z0-9])AKIA[A-Z2-7]{16}(?:[^A-Z2-7]|$)",hint:"AWS access key id detected. Rotate via IAM and move to an environment variable."},{id:"aws-secret-key",subkind:"aws_secret_key",name:"AWS Secret Key",severity:"critical",pattern:`(?:aws_secret_access_key|aws_secret_key|secret_access_key)\\s*[=:]\\s*['"]?[A-Za-z0-9/+=]{40}['"]?`,hint:"AWS secret access key detected. Rotate immediately."},{id:"gcp-api-key",subkind:"gcp_api_key",name:"GCP API Key",severity:"critical",pattern:"AIza[0-9A-Za-z_-]{35}",hint:"Google API key detected. Restrict or rotate it in the Google Cloud console."},{id:"gcp-service-account",subkind:"gcp_service_account",name:"GCP Service Account",severity:"critical",pattern:'"type"\\s*:\\s*"service_account"',hint:"GCP service-account JSON detected. Move it out of the repo and rotate the key."},{id:"github-token",subkind:"github_token",name:"GitHub Token",severity:"critical",pattern:"gh[pousr]_[0-9a-zA-Z]{36,}",hint:"GitHub token detected. Revoke at https://github.com/settings/tokens."},{id:"github-fine-grained",subkind:"github_fine_grained_token",name:"GitHub Fine-Grained Token",severity:"critical",pattern:"github_pat_[0-9a-zA-Z_]{22,}",hint:"GitHub fine-grained token detected. Revoke it in GitHub settings."},{id:"gitlab-token",subkind:"gitlab_token",name:"GitLab Token",severity:"critical",pattern:"glpat-[0-9a-zA-Z_-]{20,}",hint:"GitLab token detected. Revoke it in GitLab access tokens."},{id:"stripe-secret",subkind:"stripe_key",name:"Stripe Secret Key",severity:"critical",pattern:"sk_live_[0-9a-zA-Z]{24,}",hint:"Stripe live secret key detected. Roll it in the Stripe dashboard."},{id:"stripe-restricted",subkind:"stripe_restricted_key",name:"Stripe Restricted Key",severity:"critical",pattern:"rk_live_[0-9a-zA-Z]{24,}",hint:"Stripe restricted key detected. Roll it in the Stripe dashboard."},{id:"slack-token",subkind:"slack_token",name:"Slack Token",severity:"high",pattern:"xox[baprs]-[0-9a-zA-Z-]{10,}",hint:"Slack token detected. Revoke it in the Slack app settings."},{id:"slack-webhook",subkind:"slack_webhook",name:"Slack Webhook",severity:"high",pattern:"hooks\\.slack\\.com/services/T[0-9A-Z]{8,}/B[0-9A-Z]{8,}/[0-9a-zA-Z]{24}",hint:"Slack incoming-webhook URL detected. Regenerate it."},{id:"twilio-api-key",subkind:"twilio_api_key",name:"Twilio API Key",severity:"high",pattern:"SK[0-9a-fA-F]{32}",hint:"Twilio API key detected. Rotate it in the Twilio console."},{id:"sendgrid-api-key",subkind:"sendgrid_api_key",name:"SendGrid API Key",severity:"critical",pattern:"SG\\.[0-9a-zA-Z_-]{22}\\.[0-9a-zA-Z_-]{43}",hint:"SendGrid API key detected. Rotate it in the SendGrid console."},{id:"postgres-uri",subkind:"postgres_uri",name:"PostgreSQL Connection String",severity:"critical",pattern:`postgres(?:ql)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"PostgreSQL connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"mongodb-uri",subkind:"mongodb_uri",name:"MongoDB Connection String",severity:"critical",pattern:`mongodb(?:\\+srv)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"MongoDB connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"redis-uri",subkind:"redis_uri",name:"Redis Connection String",severity:"high",pattern:`redis(?:s)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"Redis connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"openai-key",subkind:"openai_key",name:"OpenAI API Key",severity:"critical",pattern:"sk-[0-9a-zA-Z]{20,}T3BlbkFJ[0-9a-zA-Z]{20,}",hint:"OpenAI API key detected. Rotate at https://platform.openai.com/api-keys."},{id:"anthropic-key",subkind:"anthropic_key",name:"Anthropic API Key",severity:"critical",pattern:"sk-ant-[0-9a-zA-Z_-]{40,}",hint:"Anthropic API key detected. Rotate at https://console.anthropic.com/."},{id:"firebase-key",subkind:"firebase_key",name:"Firebase API Key",severity:"high",pattern:"AIza[0-9A-Za-z_-]{35}",hint:"Firebase API key detected. Restrict it in the Firebase console."},{id:"supabase-key",subkind:"supabase_key",name:"Supabase Service Key",severity:"critical",pattern:"eyJ[0-9a-zA-Z_-]{100,}",hint:"Long JWT (possible Supabase service key) detected. Rotate it and keep it server-side only."},{id:"private-key",subkind:"private_key",name:"Private Key",severity:"critical",pattern:"-----BEGIN (?:RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----",hint:"Private key material in plaintext. Rotate immediately and move to a key manager (KMS/Vault).",skipPlaceholder:!0},{id:"jwt-secret",subkind:"jwt_secret",name:"JWT/Generic Secret",severity:"high",pattern:`(?:jwt_secret|JWT_SECRET|secret_key|SECRET_KEY|api_secret|API_SECRET)\\s*[=:]\\s*['"][^'"]{8,}['"]`,hint:"Hardcoded signing/API secret detected. Move it to an environment variable and rotate it."},{id:"password-in-code",subkind:"password_in_code",name:"Password in Code",severity:"high",pattern:`(?:password|passwd|pwd)\\s*[=:]\\s*['"][^'"]{8,}['"]`,hint:"Hardcoded password detected. Move it to a secret manager and rotate it."},{id:"bearer-token",subkind:"bearer_token",name:"Bearer Token in Code",severity:"high",pattern:`['"]Bearer\\s+[0-9a-zA-Z._-]{20,}['"]`,hint:"Hardcoded bearer token detected. Move it to a secret manager and rotate it."},{id:"hex-secret-32",subkind:"hex_secret",name:"Hardcoded 32+ Hex Secret",severity:"medium",pattern:`['"][0-9a-f]{32,}['"]`,hint:"Long hex string that looks like a secret/hash. Confirm it is not a live credential."},{id:"base64-secret",subkind:"base64_secret",name:"Hardcoded Base64 Secret (long)",severity:"medium",pattern:`['"][A-Za-z0-9+/]{64,}={0,2}['"]`,hint:"Long base64 blob that looks like an embedded secret. Confirm it is not a live credential."}]};var va=[{pattern:/^(full_?name|first_?name|last_?name|spouse_?name|beneficiary_?name)$/i,type:"name",label:"Person name",labelHe:"\u05E9\u05DD \u05D0\u05D3\u05DD"},{pattern:/^(email|e_?mail|email_?address)$/i,type:"email",label:"Email address",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC"},{pattern:/^(phone|mobile|telephone|phone_?number|cell_?phone)$/i,type:"phone",label:"Phone number",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF"},{pattern:/^(id_?number|identity|ssn|social_?security|national_?id|teudat_?zehut)$/i,type:"id",label:"ID number",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05DE\u05D6\u05D4\u05D4"},{pattern:/^(address|street_?address|home_?address)$/i,type:"address",label:"Address",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA"},{pattern:/^(date_?of_?birth|dob|birth_?date|birthday)$/i,type:"dob",label:"Date of birth",labelHe:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"},{pattern:/^(bank_?account|iban|account_?number|bank_?details|routing_?number)$/i,type:"financial",label:"Bank account",labelHe:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7"},{pattern:/^(credit_?card|card_?number|cvv|cc_?number)$/i,type:"financial",label:"Credit card",labelHe:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"},{pattern:/^(salary|income|commission|premium|compensation)$/i,type:"financial",label:"Financial data",labelHe:"\u05E0\u05EA\u05D5\u05DF \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9"},{pattern:/^(medical_?info|health_?conditions|diagnosis|medication)$/i,type:"medical",label:"Medical data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(ip_?address)$/i,type:"tracking",label:"IP address",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA IP"},{pattern:/^(passport|passport_?number|passport_?id)$/i,type:"id",label:"Passport number",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D3\u05E8\u05DB\u05D5\u05DF"},{pattern:/^(driver_?license|drivers_?license|dl_?number)$/i,type:"id",label:"Driver license",labelHe:"\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4"},{pattern:/^(iban|swift_?code|bic)$/i,type:"financial",label:"Banking code",labelHe:"\u05E7\u05D5\u05D3 \u05D1\u05E0\u05E7\u05D0\u05D9"},{pattern:/^(tax_?id|tin|vat_?number|ein)$/i,type:"financial",label:"Tax ID",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05DE\u05E1"},{pattern:/^(insurance_?number|policy_?number|member_?id)$/i,type:"id",label:"Insurance/Member ID",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D1\u05D9\u05D8\u05D5\u05D7/\u05D7\u05D1\u05E8"},{pattern:/^(blood_?type|allergy|allergies|prescription)$/i,type:"medical",label:"Medical data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(biometric|fingerprint|face_?id|retina)$/i,type:"biometric",label:"Biometric data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9"},{pattern:/^(latitude|longitude|lat|lng|geo_?location|coordinates)$/i,type:"location",label:"Geolocation",labelHe:"\u05DE\u05D9\u05E7\u05D5\u05DD \u05D2\u05D9\u05D0\u05D5\u05D2\u05E8\u05E4\u05D9"},{pattern:/^(mac_?address|device_?fingerprint|imei|serial_?number)$/i,type:"tracking",label:"Device identifier",labelHe:"\u05DE\u05D6\u05D4\u05D4 \u05DE\u05DB\u05E9\u05D9\u05E8"},{pattern:/^(ethnicity|race|religion|political_?affiliation|sexual_?orientation)$/i,type:"sensitive_personal",label:"Sensitive personal",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9"},{pattern:/^(minor|child_?name|child_?age|dependent)$/i,type:"minor_data",label:"Minor data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05E0\u05D9\u05DD"},{pattern:/^(signature|digital_?signature)$/i,type:"id",label:"Signature",labelHe:"\u05D7\u05EA\u05D9\u05DE\u05D4"},{pattern:/^(vehicle_?number|license_?plate|plate_?number)$/i,type:"tracking",label:"Vehicle ID",labelHe:"\u05DE\u05D6\u05D4\u05D4 \u05E8\u05DB\u05D1"}],Sa=/^(id|uuid|created_?at|updated_?at|deleted_?at|status|type|category|description|title|slug|url|path|key|value|sort_?order|position|enabled|active|public|version|metadata|config|settings|options|data|content|body|raw|json|text|note|comment|label|color|icon|image|avatar|logo|thumbnail|preview|template|schema|format|mode|level|priority|severity|source|target|parent|child|owner|creator|modifier|assignee|project|workspace|organization|team|group|channel|thread|room|session|device|platform|browser|locale|timezone|currency|country|region|city|zip|postal|state|province|name|display_?name|user_?agent|password_?hash|secret|token|private_?key|auth_?token|constraint|index|sequence|trigger|function|procedure|database|namespace|migration|revision)$/i,Ea=/^(beacon_?registr|device_?config|hardware|sensor|firmware|telemetry|metric|analytic|log_?event|audit_?log|system_?config|cache|queue|job|migration|schema_?version|spatial_?ref)/i,Aa=/^(minor|major|uuid|rssi|tx_?power|beacon_?id|device_?type|firmware_?version|batch_?id|zone_?id)$/i;function Fr(e,t){if(Sa.test(e)||/^name$/i.test(e)||t&&Ea.test(t)||Aa.test(e))return null;for(let n of va)if(n.pattern.test(e))return n.type;let r=Pr(e);return r?r.type:null}var lu=dt.rules.map(e=>({id:e.id,name:e.name,pattern:new RegExp(e.pattern),severity:e.severity}));var du=512*1024,uu=50*1024*1024;var Mr={id:"critical",agent_id:"high",policy:"high",financial:"critical",medical:"critical",sensitive_personal:"critical",minor_data:"critical",biometric:"critical",auth:"critical",name:"high",email:"high",phone:"high",address:"high",dob:"high",location:"high",tracking:"medium",employment:"medium",education:"medium",behavior:"high"};function Hr(e){return Mr[e]}function $a(e){return Mr[e]??"low"}function Ur(e,t){let r=[];for(let n of t){let i=n.rows.length;for(let s=0;s<n.headers.length;s++){let o=n.headers[s]??"",a=o?Fr(o.trim().replace(/["'`׳״:]/g,"").replace(/\s+/g,"_"),n.name)??ct(o)?.type??null:null,l=[];for(let u of n.rows){let d=u[s];typeof d=="string"&&d.length>0&&l.push(d)}let c=l.length>0?Lr(l):null;c?r.push(jr(e,n.name,o,c.type,c.label,"value",c.matchedSample,i)):a&&r.push(jr(e,n.name,o,a,lt(a),"header",0,i))}}return r}function jr(e,t,r,n,i,s,o,a){return{file:e,location:t,column:r,type:n,label:i,category:lt(n),severity:$a(n),matchKind:s,hits:o,sampleSize:a}}var Ia=new Set(["hex-secret-32","base64-secret"]),Ta=[/(?:[$€£]|USD|EUR|GBP)\s?\d[\d,]*(?:\.\d+)?/g,/\d[\d,]*(?:\.\d+)?\s?(?:[$€£]|USD|EUR|GBP|דולר|יורו)/g,/\b\d{1,3}(?:,\d{3})+(?:\.\d+)?\b/g];function Ra(e){let t=new he(["financial_amount"]);return{kind:"amount",severity:"medium",hint:"A money amount (the amounts dial is on: amounts are treated as sensitive here).",find:r=>{if(!e())return[];let n=t.detect(r).map(s=>({start:s.startIndex,end:s.endIndex}));for(let s of Ta){s.lastIndex=0;for(let o of r.matchAll(s))n.push({start:o.index,end:o.index+o[0].length})}n.sort((s,o)=>s.start-o.start||o.end-s.end);let i=[];for(let s of n){let o=i[i.length-1];o&&s.start<o.end?o.end=Math.max(o.end,s.end):i.push({...s})}return i}}}function Br(e={}){let t=e.amounts??(()=>!1),r=[...Or(),Ra(t)],n=dt.rules.filter(i=>!Ia.has(i.id)).map(i=>({id:i.id,name:i.name,severity:i.severity,pattern:new RegExp(i.pattern)}));return{text:r,amounts:t,header:i=>{let s=ct(i);return s?{type:s.type,label:s.labelHe||s.label}:null},secrets:n,table:i=>Ur("",[i]).filter(s=>s.column).map(s=>({column:s.column,type:s.type,category:s.category,severity:s.severity,hits:s.hits,how:s.matchKind==="value"?"value":"header"})),severity:i=>Hr(i)}}var zr=!1;function Wr(){zr||(zr=!0,ut(Br({amounts:Jn})))}Wr();Tr(process.argv.slice(2)).catch(()=>{process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"ask",permissionDecisionReason:"NoData could not check this file before it is read. Allow anyway?"}}))});
60
+ `);u&&process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PostToolUse",additionalContext:u}}));return}let c=Ua(a,o.tool_input??{},o.cwd??process.cwd(),t,Wa(i,o),o.session_id,o.permission_mode);c.decision!=="allow"&&(za(a,c),process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:c.decision,permissionDecisionReason:c.reason}})))}var Ga="claude-code",qu=` --host ${Ga}`;var Va=[{type:"id_number",patterns:[/\b\d{9}\b/g,/ת\.?ז\.?\s*:?\s*(\d{9})/g,/זהות\s*:?\s*(\d{9})/g],confidence:.9,replacement:()=>"[\u05EA.\u05D6. \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"phone",patterns:[/\b0[2-9]\d[\s\-]?\d{7}\b/g,/\b05[0-9][\s\-]?\d{7}\b/g,/\+972[\s\-]?[2-9]\d[\s\-]?\d{7}\b/g],confidence:.95,replacement:()=>"[\u05D8\u05DC\u05E4\u05D5\u05DF \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"email",patterns:[/[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}/g],confidence:.99,replacement:e=>{let[,t]=e.split("@");return`[\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC: ***@${t}]`}},{type:"full_name",patterns:[/(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק)[:\s]+([א-ת][א-ת"'\-\s]{2,30}?)(?=[,\n\d]|ת\.ז)/g,/(?:עו"ד|ד"ר|פרופ'|מר|גברת)\s+([א-ת][א-ת"'\-\s]{2,25}?)(?=[,\n])/g],confidence:.75,replacement:()=>"[\u05E9\u05DD \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"bank_account",patterns:[/\b\d{2}[\-]\d{5,9}[\-]\d{2,3}\b/g,/(?:חשבון|ח-ן)\s*:?\s*(\d[\d\-]{8,15})/g],confidence:.88,replacement:()=>"[\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"medical",patterns:[/(?<![א-ת])[בהוכלמש]{0,2}(?:סוכרת|יתר לחץ דם|אסתמה|דיכאון|חרדה|סרטן|אי ספיקת לב|אפילפסיה)(?![א-ת])/g,/\b(?:Metformin|Lisinopril|Atorvastatin|Amlodipine|Sertraline|Fluoxetine|Omeprazole|Warfarin|Aspirin|Insulin)\b/gi,/\bHbA1c\s*:?\s*[\d.]+%?/g,/\bBMI\s*:?\s*[\d.]+/g,/(?<![א-ת])[בהוכלמש]{0,2}אבחנ[הות]\s*:?\s*[^,\n.]{2,40}/g],confidence:.85,replacement:()=>"[\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"financial_amount",patterns:[/[\d,]+(?:\.\d{2})?\s*(?:₪|ש"ח|NIS|שקל(?:ים)?)/g,/(?:₪|NIS)\s*[\d,]+(?:\.\d{2})?/g],confidence:.92,replacement:()=>"[\u05E1\u05DB\u05D5\u05DD \u05DB\u05E1\u05E4\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"birth_date",patterns:[/(?:תאריך לידה|נולד|נולדה|ד\.ל\.)\s*:?\s*\d{1,2}[\/\.\-]\d{1,2}[\/\.\-]\d{2,4}/g,/(?<![א-ת])[בהוכלמש]{0,2}גיל\s*:?\s*\d{1,3}\b/g],confidence:.88,replacement:()=>"[\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"address",patterns:[/רחוב\s+[א-ת][א-ת\s"'\-]{2,30}\s+\d{1,5}/g,/(?:רח'|רח\.)\s+[א-ת][א-ת\s"'\-]{2,30}\d{1,5}/g],confidence:.72,replacement:()=>"[\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D5\u05E1\u05EA\u05E8\u05EA]"},{type:"license_plate",patterns:[/\b\d{2,3}[\-]\d{2,3}[\-]\d{2,3}\b/g],confidence:.8,replacement:()=>"[\u05DC\u05D5\u05D7\u05D9\u05EA \u05E8\u05D9\u05E9\u05D5\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8\u05EA]"}];function Ka(e){if(e.length!==9)return!1;let t=e.split("").map(Number),r=0;for(let n=0;n<9;n++){let i=t[n]*(n%2===0?1:2);i>9&&(i-=9),r+=i}return r%10===0}var ge=class{constructor(t){this.enabledTypes=new Set(t)}detect(t){let r=[],n=new Set;for(let s of Va)if(this.enabledTypes.has(s.type))for(let o of s.patterns){let a=new RegExp(o.source,o.flags),c;for(;(c=a.exec(t))!==null;){let l=c[0],u=`${s.type}:${c.index}`;if(!n.has(u)){if(n.add(u),s.type==="id_number"){let d=l.replace(/\D/g,"");if(/^\d{9}$/.test(l)&&d.length===9&&!Ka(d))continue}r.push({type:s.type,value:l,startIndex:c.index,endIndex:c.index+l.length,confidence:s.confidence,replacement:s.replacement(l,s.type)})}}}r.sort((s,o)=>s.startIndex-o.startIndex||o.confidence-s.confidence);let i=[];for(let s of r)i.some(a=>s.startIndex<a.endIndex&&s.endIndex>a.startIndex)||i.push(s);return i}};var I=["GDPR","CPRA","PPL"],Za=["GDPR-9","CPRA","PPL"],Xa=[{id:"person_name",type:"name",sensitivity:"high",regulations:[...I],en:["firstname","lastname","fname","lname","middle name","maiden name","birth name","preferred name","display name","nickname","surname","given name","full name"],he:["\u05E9\u05DD \u05E4\u05E8\u05D8\u05D9","\u05E9\u05DD \u05DE\u05E9\u05E4\u05D7\u05D4","\u05E9\u05DD \u05DE\u05DC\u05D0","\u05DB\u05D9\u05E0\u05D5\u05D9","\u05E9\u05DD \u05E0\u05E2\u05D5\u05E8\u05D9\u05DD"],ar:["\u0627\u0644\u0627\u0633\u0645","\u0627\u0633\u0645 \u0627\u0644\u0639\u0627\u0626\u0644\u0629","\u0627\u0644\u0627\u0633\u0645 \u0627\u0644\u0643\u0627\u0645\u0644"],ru:["\u0438\u043C\u044F","\u0444\u0430\u043C\u0438\u043B\u0438\u044F","\u043E\u0442\u0447\u0435\u0441\u0442\u0432\u043E","\u0444\u0438\u043E"]},{id:"birth_place",type:"location",sensitivity:"medium",regulations:[...I],en:["birth place","birthplace","place of birth"],he:["\u05DE\u05E7\u05D5\u05DD \u05DC\u05D9\u05D3\u05D4","\u05D0\u05E8\u05E5 \u05DC\u05D9\u05D3\u05D4"],ar:["\u0645\u0643\u0627\u0646 \u0627\u0644\u0645\u064A\u0644\u0627\u062F"],ru:["\u043C\u0435\u0441\u0442\u043E \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F"]},{id:"citizenship",type:"sensitive_personal",sensitivity:"high",regulations:[...I],en:["citizenship","nationality"],he:["\u05D0\u05D6\u05E8\u05D7\u05D5\u05EA","\u05DC\u05D0\u05D5\u05DD"],ar:["\u0627\u0644\u062C\u0646\u0633\u064A\u0629"],ru:["\u0433\u0440\u0430\u0436\u0434\u0430\u043D\u0441\u0442\u0432\u043E"]},{id:"marital_status",type:"sensitive_personal",sensitivity:"high",regulations:[...I],en:["marital status"],he:["\u05DE\u05E6\u05D1 \u05DE\u05E9\u05E4\u05D7\u05EA\u05D9"],ar:["\u0627\u0644\u062D\u0627\u0644\u0629 \u0627\u0644\u0627\u062C\u062A\u0645\u0627\u0639\u064A\u0629"],ru:["\u0441\u0435\u043C\u0435\u0439\u043D\u043E\u0435 \u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435"]},{id:"government_id",type:"id",sensitivity:"critical",regulations:[...I],en:["ssn","national id","passport","driver license","drivers license","tax id","social security","national insurance","military id","voter id","resident id","residence permit","visa number"],he:["\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA","\u05D3\u05E8\u05DB\u05D5\u05DF","\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4","\u05DE\u05E1\u05E4\u05E8 \u05D1\u05D9\u05D8\u05D5\u05D7 \u05DC\u05D0\u05D5\u05DE\u05D9","\u05DE\u05E1\u05E4\u05E8 \u05D0\u05D9\u05E9\u05D9","\u05DE\u05E1\u05E4\u05E8 \u05D5\u05D9\u05D6\u05D4","\u05EA\u05E2\u05D5\u05D3\u05EA \u05EA\u05D5\u05E9\u05D1","\u05DE\u05E1\u05E4\u05E8 \u05E2\u05D5\u05E1\u05E7"],ar:["\u0631\u0642\u0645 \u0627\u0644\u0647\u0648\u064A\u0629","\u062C\u0648\u0627\u0632 \u0627\u0644\u0633\u0641\u0631","\u0631\u062E\u0635\u0629 \u0627\u0644\u0642\u064A\u0627\u062F\u0629"],ru:["\u043F\u0430\u0441\u043F\u043E\u0440\u0442","\u0441\u043D\u0438\u043B\u0441","\u0438\u043D\u043D","\u0432\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0435 \u0443\u0434\u043E\u0441\u0442\u043E\u0432\u0435\u0440\u0435\u043D\u0438\u0435"]},{id:"institution_person_id",type:"tracking",sensitivity:"medium",regulations:[...I],en:["employee id","employee number","employee no","student id","student number","user id","userid","customer id","customer number","customer no","client id","member id","subscriber id","participant id","profile id","person id","person uuid","lead id","crm contact","account id"],he:["\u05DE\u05E1\u05E4\u05E8 \u05E2\u05D5\u05D1\u05D3","\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D8\u05D5\u05D3\u05E0\u05D8","\u05DE\u05E1\u05E4\u05E8 \u05DC\u05E7\u05D5\u05D7","\u05DE\u05D6\u05D4\u05D4 \u05DC\u05E7\u05D5\u05D7","\u05DE\u05E1\u05E4\u05E8 \u05DE\u05E0\u05D5\u05D9","\u05DE\u05D6\u05D4\u05D4 \u05DE\u05E9\u05EA\u05DE\u05E9"],ar:["\u0631\u0642\u0645 \u0627\u0644\u0645\u0648\u0638\u0641","\u0631\u0642\u0645 \u0627\u0644\u0639\u0645\u064A\u0644"],ru:["\u0442\u0430\u0431\u0435\u043B\u044C\u043D\u044B\u0439 \u043D\u043E\u043C\u0435\u0440","\u043D\u043E\u043C\u0435\u0440 \u043A\u043B\u0438\u0435\u043D\u0442\u0430"]},{id:"patient_id",type:"medical",sensitivity:"critical",regulations:["GDPR-9","HIPAA","PPL"],en:["patient id","patient number","mrn","medical record number"],he:["\u05DE\u05E1\u05E4\u05E8 \u05DE\u05D8\u05D5\u05E4\u05DC","\u05DE\u05E1\u05E4\u05E8 \u05EA\u05D9\u05E7 \u05E8\u05E4\u05D5\u05D0\u05D9"],ar:["\u0631\u0642\u0645 \u0627\u0644\u0645\u0631\u064A\u0636"],ru:["\u043D\u043E\u043C\u0435\u0440 \u043F\u0430\u0446\u0438\u0435\u043D\u0442\u0430"]},{id:"email",type:"email",sensitivity:"high",regulations:[...I],en:["emailaddress","e mail","recovery email","contact email"],he:["\u05D3\u05D5\u05D0\u05DC","\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC"],ar:["\u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A"],ru:["\u043F\u043E\u0447\u0442\u0430","\u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430","email"]},{id:"phone",type:"phone",sensitivity:"high",regulations:[...I],en:["cellphone","contact number","work phone","home phone","whatsapp","recovery phone","telephone"],he:["\u05D8\u05DC\u05E4\u05D5\u05DF \u05D1\u05D9\u05EA","\u05D8\u05DC\u05E4\u05D5\u05DF \u05E2\u05D1\u05D5\u05D3\u05D4","\u05D5\u05D5\u05D8\u05E1\u05D0\u05E4","\u05DE\u05E1\u05E4\u05E8 \u05E0\u05D9\u05D9\u05D3"],ar:["\u0647\u0627\u062A\u0641","\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062A\u0641","\u062C\u0648\u0627\u0644"],ru:["\u0442\u0435\u043B\u0435\u0444\u043E\u043D","\u043C\u043E\u0431\u0438\u043B\u044C\u043D\u044B\u0439"]},{id:"social_handle",type:"tracking",sensitivity:"medium",regulations:[...I],en:["telegram","linkedin","facebook","twitter","instagram","tiktok","social profile"],he:["\u05D8\u05DC\u05D2\u05E8\u05DD","\u05DC\u05D9\u05E0\u05E7\u05D3\u05D0\u05D9\u05DF","\u05E4\u05D9\u05D9\u05E1\u05D1\u05D5\u05E7","\u05D0\u05D9\u05E0\u05E1\u05D8\u05D2\u05E8\u05DD"]},{id:"address",type:"address",sensitivity:"high",regulations:[...I],en:["house number","apartment","apt","billing address","shipping address","postal code","zip code","postcode","street"],he:["\u05DE\u05E1\u05E4\u05E8 \u05D1\u05D9\u05EA","\u05D3\u05D9\u05E8\u05D4","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DC\u05DE\u05E9\u05DC\u05D5\u05D7","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DC\u05D7\u05D9\u05D5\u05D1","\u05EA.\u05D3","\u05EA\u05D0 \u05D3\u05D5\u05D0\u05E8"],ar:["\u0627\u0644\u0639\u0646\u0648\u0627\u0646","\u0627\u0644\u0634\u0627\u0631\u0639","\u0627\u0644\u0631\u0645\u0632 \u0627\u0644\u0628\u0631\u064A\u062F\u064A"],ru:["\u0430\u0434\u0440\u0435\u0441","\u0443\u043B\u0438\u0446\u0430","\u0438\u043D\u0434\u0435\u043A\u0441","\u043A\u0432\u0430\u0440\u0442\u0438\u0440\u0430"]},{id:"geo",type:"location",sensitivity:"high",regulations:[...I],en:["geo location","geolocation","latitude","longitude","coordinates","home location","current location"],he:["\u05DE\u05D9\u05E7\u05D5\u05DD","\u05E7\u05D5\u05D0\u05D5\u05E8\u05D3\u05D9\u05E0\u05D8\u05D5\u05EA"],ar:["\u0627\u0644\u0645\u0648\u0642\u0639"],ru:["\u043C\u0435\u0441\u0442\u043E\u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435","\u043A\u043E\u043E\u0440\u0434\u0438\u043D\u0430\u0442\u044B"]},{id:"bank_card",type:"financial",sensitivity:"critical",regulations:[...I],en:["bank account","iban","swift","bic","routing number","credit card","creditcard","card number","cvv","card expiry","cc exp","paypal","wallet address","crypto wallet","bitcoin address"],he:["\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7","\u05DE\u05E1\u05E4\u05E8 \u05D7\u05E9\u05D1\u05D5\u05DF","\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9","\u05D0\u05E8\u05E0\u05E7 \u05E7\u05E8\u05D9\u05E4\u05D8\u05D5","\u05D0\u05E8\u05E0\u05E7 \u05D3\u05D9\u05D2\u05D9\u05D8\u05DC\u05D9"],ar:["\u062D\u0633\u0627\u0628 \u0628\u0646\u0643\u064A","\u0631\u0642\u0645 \u0627\u0644\u062D\u0633\u0627\u0628","\u0628\u0637\u0627\u0642\u0629 \u0627\u0626\u062A\u0645\u0627\u0646"],ru:["\u0440\u0430\u0441\u0447\u0435\u0442\u043D\u044B\u0439 \u0441\u0447\u0435\u0442","\u043D\u043E\u043C\u0435\u0440 \u0441\u0447\u0435\u0442\u0430","\u043D\u043E\u043C\u0435\u0440 \u043A\u0430\u0440\u0442\u044B","\u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430\u044F \u043A\u0430\u0440\u0442\u0430"]},{id:"income_tax",type:"financial",sensitivity:"high",regulations:[...I],en:["salary","income","wage","tax record","tax return","payment history","credit score","net worth","salary grade"],he:["\u05E9\u05DB\u05E8","\u05DE\u05E9\u05DB\u05D5\u05E8\u05EA","\u05D4\u05DB\u05E0\u05E1\u05D4","\u05EA\u05DC\u05D5\u05E9 \u05E9\u05DB\u05E8","\u05D3\u05D5\u05D7 \u05DE\u05E1","\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05EA\u05E9\u05DC\u05D5\u05DE\u05D9\u05DD","\u05D3\u05D9\u05E8\u05D5\u05D2 \u05D0\u05E9\u05E8\u05D0\u05D9","\u05E9\u05D5\u05D5\u05D9 \u05E0\u05E7\u05D9","\u05D3\u05E8\u05D2\u05EA \u05E9\u05DB\u05E8"],ar:["\u0627\u0644\u0631\u0627\u062A\u0628","\u0627\u0644\u062F\u062E\u0644"],ru:["\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430","\u0434\u043E\u0445\u043E\u0434"]},{id:"assets",type:"financial",sensitivity:"high",regulations:[...I],en:["property id","land record","ownership record","title deed","holdings"],he:["\u05D2\u05D5\u05E9 \u05D7\u05DC\u05E7\u05D4","\u05E0\u05E1\u05D7 \u05D8\u05D0\u05D1\u05D5","\u05E8\u05D9\u05E9\u05D5\u05DD \u05DE\u05E7\u05E8\u05E7\u05E2\u05D9\u05DF","\u05D1\u05E2\u05DC\u05D5\u05EA","\u05D0\u05D7\u05D6\u05E7\u05D5\u05EA"],ru:["\u0441\u043E\u0431\u0441\u0442\u0432\u0435\u043D\u043D\u043E\u0441\u0442\u044C","\u043D\u0435\u0434\u0432\u0438\u0436\u0438\u043C\u043E\u0441\u0442\u044C"]},{id:"vehicle",type:"tracking",sensitivity:"medium",regulations:[...I],en:["vin","vehicle id","license plate","registration number","plate number"],he:["\u05DE\u05E1\u05E4\u05E8 \u05E9\u05DC\u05D3\u05D4","\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1","\u05DC\u05D5\u05D7\u05D9\u05EA \u05E8\u05D9\u05E9\u05D5\u05D9"],ru:["\u043D\u043E\u043C\u0435\u0440 \u0430\u0432\u0442\u043E\u043C\u043E\u0431\u0438\u043B\u044F","vin"]},{id:"health",type:"medical",sensitivity:"critical",regulations:["GDPR-9","HIPAA","PPL"],en:["medical record","health condition","health data","lab result","lab results","vaccination","mental health","hospitalization","hospitalisation","disability","insurance number","diagnosis","allergy","prescription","medication","blood type"],he:["\u05EA\u05D9\u05E7 \u05E8\u05E4\u05D5\u05D0\u05D9","\u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05DE\u05E2\u05D1\u05D3\u05D4","\u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05D1\u05D3\u05D9\u05E7\u05D4","\u05D7\u05D9\u05E1\u05D5\u05E0\u05D9\u05DD","\u05D1\u05E8\u05D9\u05D0\u05D5\u05EA \u05E0\u05E4\u05E9","\u05D0\u05E9\u05E4\u05D5\u05D6","\u05E0\u05DB\u05D5\u05EA","\u05DE\u05E6\u05D1 \u05D1\u05E8\u05D9\u05D0\u05D5\u05EA\u05D9"],ar:["\u0627\u0644\u062A\u0634\u062E\u064A\u0635","\u0627\u0644\u0633\u062C\u0644 \u0627\u0644\u0637\u0628\u064A","\u0627\u0644\u0623\u062F\u0648\u064A\u0629"],ru:["\u0434\u0438\u0430\u0433\u043D\u043E\u0437","\u043C\u0435\u0434\u0438\u0446\u0438\u043D\u0441\u043A\u0430\u044F \u043A\u0430\u0440\u0442\u0430","\u0430\u043D\u0430\u043B\u0438\u0437\u044B"]},{id:"biometric",type:"biometric",sensitivity:"critical",regulations:["GDPR-9","CPRA","PPL"],en:["face embedding","face scan","iris scan","retina scan","voice print","voiceprint","voice signature","hand geometry","biometric template","biometric data","dna","genetic data","genome"],he:["\u05D8\u05D1\u05D9\u05E2\u05EA \u05E7\u05D5\u05DC","\u05E1\u05E8\u05D9\u05E7\u05EA \u05E4\u05E0\u05D9\u05DD","\u05E1\u05E8\u05D9\u05E7\u05EA \u05E7\u05E9\u05EA\u05D9\u05EA","\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05D2\u05E0\u05D8\u05D9\u05D9\u05DD",'\u05D3\u05E0"\u05D0'],ar:["\u0628\u0635\u0645\u0629"],ru:["\u0431\u0438\u043E\u043C\u0435\u0442\u0440\u0438\u044F","\u043E\u0442\u043F\u0435\u0447\u0430\u0442\u043E\u043A"]},{id:"employment",type:"employment",sensitivity:"medium",regulations:[...I],en:["employer","job title","employment status","hire date","start date of employment","termination date","performance review","disciplinary"],he:["\u05DE\u05E2\u05E1\u05D9\u05E7","\u05DE\u05E7\u05D5\u05DD \u05E2\u05D1\u05D5\u05D3\u05D4","\u05EA\u05E4\u05E7\u05D9\u05D3 \u05D4\u05E2\u05D5\u05D1\u05D3","\u05EA\u05D0\u05E8\u05D9\u05DA \u05EA\u05D7\u05D9\u05DC\u05EA \u05E2\u05D1\u05D5\u05D3\u05D4","\u05EA\u05D0\u05E8\u05D9\u05DA \u05E1\u05D9\u05D5\u05DD \u05E2\u05D1\u05D5\u05D3\u05D4","\u05D4\u05E2\u05E8\u05DB\u05EA \u05D1\u05D9\u05E6\u05D5\u05E2\u05D9\u05DD","\u05E9\u05D9\u05DE\u05D5\u05E2"],ar:["\u062C\u0647\u0629 \u0627\u0644\u0639\u0645\u0644","\u0627\u0644\u0645\u0633\u0645\u0649 \u0627\u0644\u0648\u0638\u064A\u0641\u064A"],ru:["\u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044C","\u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C"]},{id:"manager",type:"name",sensitivity:"medium",regulations:[...I],en:["manager","supervisor"],he:["\u05DE\u05E0\u05D4\u05DC \u05D9\u05E9\u05D9\u05E8"]},{id:"education",type:"education",sensitivity:"medium",regulations:[...I],en:["school","university","college","degree","transcript","education history","gpa"],he:["\u05D1\u05D9\u05EA \u05E1\u05E4\u05E8","\u05D0\u05D5\u05E0\u05D9\u05D1\u05E8\u05E1\u05D9\u05D8\u05D4","\u05DE\u05DB\u05DC\u05DC\u05D4","\u05D2\u05D9\u05DC\u05D9\u05D5\u05DF \u05E6\u05D9\u05D5\u05E0\u05D9\u05DD","\u05D4\u05E9\u05DB\u05DC\u05D4","\u05EA\u05D5\u05D0\u05E8 \u05D0\u05E7\u05D3\u05DE\u05D9"],ar:["\u0627\u0644\u062C\u0627\u0645\u0639\u0629","\u0627\u0644\u0645\u062F\u0631\u0633\u0629"],ru:["\u043E\u0431\u0440\u0430\u0437\u043E\u0432\u0430\u043D\u0438\u0435","\u0443\u043D\u0438\u0432\u0435\u0440\u0441\u0438\u0442\u0435\u0442"]},{id:"device_online",type:"tracking",sensitivity:"medium",regulations:[...I],en:["ip","ipaddress","ip address","mac address","device id","deviceid","advertising id","idfa","gaid","android id","apple id","cookie id","cookieid","browser fingerprint","user agent","imei"],he:["\u05DB\u05EA\u05D5\u05D1\u05EA ip","\u05DE\u05D6\u05D4\u05D4 \u05DE\u05DB\u05E9\u05D9\u05E8"],ru:["ip \u0430\u0434\u0440\u0435\u0441"]},{id:"account",type:"tracking",sensitivity:"medium",regulations:[...I],en:["username","user name","login","screen name"],he:["\u05E9\u05DD \u05DE\u05E9\u05EA\u05DE\u05E9"],ru:["\u043B\u043E\u0433\u0438\u043D"]},{id:"credential",type:"auth",sensitivity:"critical",regulations:[...I],en:["password","password hash","mfa secret","otp secret","security question","security answer","session id","session token","api key"],he:["\u05E1\u05D9\u05E1\u05DE\u05D4","\u05E1\u05D9\u05E1\u05DE\u05D0","\u05E9\u05D0\u05DC\u05EA \u05D0\u05D1\u05D8\u05D7\u05D4"],ar:["\u0643\u0644\u0645\u0629 \u0627\u0644\u0645\u0631\u0648\u0631"],ru:["\u043F\u0430\u0440\u043E\u043B\u044C"]},{id:"behavior",type:"behavior",sensitivity:"high",regulations:[...I],en:["purchase history","search history","browsing history","clickstream","usage pattern","behavior profile","behaviour profile"],he:["\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05E8\u05DB\u05D9\u05E9\u05D5\u05EA","\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05D7\u05D9\u05E4\u05D5\u05E9","\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05D2\u05DC\u05D9\u05E9\u05D4","\u05E4\u05E8\u05D5\u05E4\u05D9\u05DC \u05D4\u05EA\u05E0\u05D4\u05D2\u05D5\u05EA"]},{id:"special_category",type:"sensitive_personal",sensitivity:"critical",regulations:[...Za],en:["race","ethnicity","religion","political opinion","political party","union membership","trade union","sexual orientation","gender identity","criminal record"],he:["\u05D2\u05D6\u05E2","\u05D3\u05EA","\u05D4\u05E9\u05E7\u05E4\u05D4 \u05E4\u05D5\u05DC\u05D9\u05D8\u05D9\u05EA","\u05D7\u05D1\u05E8\u05D5\u05EA \u05D1\u05D0\u05D9\u05D2\u05D5\u05D3","\u05E0\u05D8\u05D9\u05D9\u05D4 \u05DE\u05D9\u05E0\u05D9\u05EA","\u05D6\u05D4\u05D5\u05EA \u05DE\u05D2\u05D3\u05E8\u05D9\u05EA","\u05E8\u05D9\u05E9\u05D5\u05DD \u05E4\u05DC\u05D9\u05DC\u05D9"],ar:["\u0627\u0644\u062F\u064A\u0627\u0646\u0629","\u0627\u0644\u0639\u0631\u0642"],ru:["\u0440\u0435\u043B\u0438\u0433\u0438\u044F","\u043D\u0430\u0446\u0438\u043E\u043D\u0430\u043B\u044C\u043D\u043E\u0441\u0442\u044C"]},{id:"family_names",type:"name",sensitivity:"high",regulations:[...I],en:["mother name","father name","spouse","partner name","emergency contact","next of kin","family member","guardian","beneficiary"],he:["\u05E9\u05DD \u05D4\u05D0\u05DD","\u05E9\u05DD \u05D4\u05D0\u05D1","\u05D1\u05DF \u05D6\u05D5\u05D2","\u05D1\u05EA \u05D6\u05D5\u05D2","\u05D0\u05D9\u05E9 \u05E7\u05E9\u05E8 \u05DC\u05D7\u05D9\u05E8\u05D5\u05DD","\u05E7\u05E8\u05D5\u05D1 \u05DE\u05E9\u05E4\u05D7\u05D4","\u05D0\u05E4\u05D5\u05D8\u05E8\u05D5\u05E4\u05D5\u05E1","\u05DE\u05D5\u05D8\u05D1"],ar:["\u0627\u0633\u0645 \u0627\u0644\u0623\u0645","\u0627\u0633\u0645 \u0627\u0644\u0623\u0628","\u0627\u0644\u0632\u0648\u062C"],ru:["\u0441\u0443\u043F\u0440\u0443\u0433","\u043E\u043F\u0435\u043A\u0443\u043D"]},{id:"children",type:"minor_data",sensitivity:"critical",regulations:[...I],en:["children","child name","dependents","dependants"],he:["\u05D9\u05DC\u05D3\u05D9\u05DD","\u05E9\u05DE\u05D5\u05EA \u05D4\u05D9\u05DC\u05D3\u05D9\u05DD"],ar:["\u0627\u0644\u0623\u0637\u0641\u0627\u0644"],ru:["\u0434\u0435\u0442\u0438"]}];function Ja(e){return e.trim().toLowerCase().replace(/["'`׳״]/g,"").replace(/[_\-.]+/g," ").replace(/\s+/g," ").trim()}function ii(){return Xa.map(e=>{let t=[...e.en,...e.he??[],...e.ar??[],...e.ru??[]].map(Ja).filter(Boolean);return{type:e.type,tokens:t.filter(r=>!r.includes(" ")),phrases:t.filter(r=>r.includes(" "))}})}var qa=[{pattern:/^(?:שם|שם_מלא|שם פרטי|שם_פרטי|שם משפחה|שם_משפחה|שם_אדם|שם הלקוח|שם_הלקוח|שם בן זוג|שם בן_זוג|שם המבוטח|שם_המבוטח|שם המוטב|שם_המוטב|שם מבוטח|שם_מבוטח|שם מוטב|שם_מוטב|שם הילד|שם_הילד|שם הקטין|שם_הקטין|firstname_he|lastname_he|shem|shem_mishpacha|shem_prati)$/i,type:"name",label:"Person name (Hebrew)",labelHe:"\u05E9\u05DD \u05D0\u05D3\u05DD"},{pattern:/^(?:ת"ז|ת\.ז|ת ז|תז|תעודת זהות|תעודת_זהות|מספר זהות|מספר_זהות|מס' זהות|מס_זהות|מס' ת"ז|teudat_zehut|tz|t_z|israeli_id|il_id)$/i,type:"id",label:"Israeli ID",labelHe:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA"},{pattern:/^(?:דרכון|מספר דרכון|מס דרכון|רישיון נהיגה|רישיון_נהיגה|רשיון נהיגה|מס רישיון|דרכון_מספר)$/i,type:"id",label:"Passport / DL (Hebrew)",labelHe:"\u05D3\u05E8\u05DB\u05D5\u05DF/\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF"},{pattern:/^(?:מייל|דוא"ל|דוא_ל|דואר אלקטרוני|דואר_אלקטרוני|אימייל|כתובת מייל|כתובת_מייל|כתובת דואר|כתובת_דואר)$/i,type:"email",label:"Email (Hebrew)",labelHe:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9"},{pattern:/^(?:טלפון|טל'|נייד|פלאפון|סלולרי|מספר טלפון|מספר_טלפון|טלפון נייד|טלפון_נייד|מס נייד|מס_נייד|מס' טל)$/i,type:"phone",label:"Phone (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF"},{pattern:/^(?:כתובת|כתובת מגורים|כתובת_מגורים|רחוב|מס בית|מספר בית|עיר|ישוב|יישוב|מיקוד|כתובת מלאה|כתובת_מלאה|מען)$/i,type:"address",label:"Address (Hebrew)",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA"},{pattern:/^(?:תאריך לידה|תאריך_לידה|ת לידה|תאריך הולדת|תאריך_הולדת|יום הולדת|יום_הולדת|גיל)$/i,type:"dob",label:"Date of birth (Hebrew)",labelHe:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"},{pattern:/^(?:חשבון בנק|חשבון_בנק|מספר חשבון|מספר_חשבון|מס חשבון|מס' חשבון|בנק|סניף|מס סניף|iban|iban_il)$/i,type:"financial",label:"Bank account (Hebrew)",labelHe:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7"},{pattern:/^(?:כרטיס אשראי|כרטיס_אשראי|מספר אשראי|מס אשראי|מס' אשראי|cvv|אשראי|מס כרטיס|מס_כרטיס)$/i,type:"financial",label:"Credit card (Hebrew)",labelHe:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"},{pattern:/^(?:שכר|משכורת|הכנסה|פרמיה|שכר ברוטו|שכר_ברוטו|שכר נטו|שכר_נטו|תגמול|בונוס|פיצוי)$/i,type:"financial",label:"Salary / income (Hebrew)",labelHe:"\u05E9\u05DB\u05E8/\u05D4\u05DB\u05E0\u05E1\u05D4"},{pattern:/^(?:אבחון|אבחנה|מחלה|תרופה|מרשם|בדיקה רפואית|בדיקה_רפואית|מצב רפואי|מצב_רפואי|חיסון|תוצאת בדיקה|תוצאת_בדיקה|רופא|רגישות|אלרגיה|סוג דם|סוג_דם)$/i,type:"medical",label:"Medical (Hebrew)",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(?:מספר פוליסה|מספר_פוליסה|מס פוליסה|מס' פוליסה|פוליסה|מספר חבר|מספר_חבר|מס חבר|מספר ביטוח|מספר_ביטוח|policy_?number|policy_?no|policy_?id)$/i,type:"policy",label:"Insurance policy number (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"},{pattern:/^(?:מספר סוכן|מספר_סוכן|מס סוכן|מס' סוכן|מס_סוכן|קוד סוכן|קוד_סוכן|מספר משווק|מספר_משווק|מספר יצרן|סוכן ביטוח|agent_?number|agent_?no|agent_?id|agent_?code|broker_?id|broker_?number)$/i,type:"agent_id",label:"Insurance agent / broker number (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF"},{pattern:/^(?:שם הילד|שם_הילד|תעודת זהות של ילד|ילדים|קטין|מספר ילדים|מספר_ילדים|תעודת לידה|ת לידה ילד)$/i,type:"minor_data",label:"Minor data (Hebrew)",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF"},{pattern:/^(?:דת|לאום|מין|נטייה מינית|נטייה_מינית|השקפה פוליטית|השקפה_פוליטית|מצב משפחתי|מצב_משפחתי|עדה|מוצא)$/i,type:"sensitive_personal",label:"Sensitive personal (Hebrew)",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9"},{pattern:/^(?:מספר רכב|מספר_רכב|מס רכב|מס' רכב|לוחית רישוי|לוחית_רישוי|מספר רישוי|מספר_רישוי)$/i,type:"tracking",label:"Vehicle ID (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"}];function gn(e){let t=String(e??"").replace(/\D/g,"");if(t.length===0||t.length>9)return!1;let r=t.padStart(9,"0"),n=0;for(let i=0;i<9;i++){let s=parseInt(r[i]??"0",10)*(i%2+1);s>9&&(s-=9),n+=s}return n%10===0&&parseInt(r,10)>0}var lt=/(?:\+972[\s-]?|0)(?:5[0-9]|[2-4]|[89])(?:[\s-]?\d){7}/g,dt=/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}/gi,ut=/\bIL\d{2}\s?(?:\d{4}\s?){4}\d{3}\b/g;function si(e){let t=String(e??"").replace(/\D/g,"");if(t.length<13||t.length>19)return!1;let r=0,n=!1;for(let i=t.length-1;i>=0;i--){let s=t.charCodeAt(i)-48;if(s<0||s>9)return!1;n&&(s*=2,s>9&&(s-=9)),r+=s,n=!n}return r%10===0}function oi(e){if(!e)return null;let t=e.trim();for(let r of qa)if(r.pattern.test(t))return{type:r.type,label:r.label,labelHe:r.labelHe};return null}var Ya=[{type:"biometric",tokens:["biometric","fingerprint","\u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9"],phrases:["face id","\u05D8\u05D1\u05D9\u05E2\u05EA \u05D0\u05E6\u05D1\u05E2"]},{type:"medical",tokens:["diagnosis","medical","disease","medication","prescription","allergy","vaccine","\u05D0\u05D1\u05D7\u05D5\u05DF","\u05D0\u05D1\u05D7\u05E0\u05D4","\u05DE\u05D7\u05DC\u05D4","\u05EA\u05E8\u05D5\u05E4\u05D4","\u05DE\u05E8\u05E9\u05DD","\u05D7\u05D9\u05E1\u05D5\u05DF","\u05D0\u05DC\u05E8\u05D2\u05D9\u05D4"],phrases:["medical record","blood type","\u05DE\u05E6\u05D1 \u05E8\u05E4\u05D5\u05D0\u05D9","\u05E1\u05D5\u05D2 \u05D3\u05DD"]},{type:"sensitive_personal",tokens:["religion","ethnicity","nationality","\u05D3\u05EA","\u05DC\u05D0\u05D5\u05DD","\u05E2\u05D3\u05D4","\u05DE\u05D5\u05E6\u05D0"],phrases:["sexual orientation","marital status","\u05DE\u05E6\u05D1 \u05DE\u05E9\u05E4\u05D7\u05EA\u05D9","\u05E0\u05D8\u05D9\u05D9\u05D4 \u05DE\u05D9\u05E0\u05D9\u05EA"]},{type:"minor_data",tokens:["minor","\u05E7\u05D8\u05D9\u05DF"],phrases:["child name","\u05E9\u05DD \u05D4\u05D9\u05DC\u05D3","\u05E9\u05DD \u05D4\u05E7\u05D8\u05D9\u05DF"]},{type:"id",tokens:["ssn","passport","\u05D6\u05D4\u05D5\u05EA","\u05D3\u05E8\u05DB\u05D5\u05DF"],phrases:["national id","id number","identity number","social security","driver license","driving license","drivers license","passport number","tax id","\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA","\u05DE\u05E1\u05E4\u05E8 \u05D6\u05D4\u05D5\u05EA","\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4"]},{type:"financial",tokens:["iban","swift","bic","salary","income","wage","\u05D0\u05E9\u05E8\u05D0\u05D9","\u05E9\u05DB\u05E8","\u05DE\u05E9\u05DB\u05D5\u05E8\u05EA","\u05D4\u05DB\u05E0\u05E1\u05D4"],phrases:["bank account","account number","credit card","card number","routing number","sort code","\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7","\u05DE\u05E1\u05E4\u05E8 \u05D7\u05E9\u05D1\u05D5\u05DF","\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"]},{type:"policy",tokens:["policy","\u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"],phrases:["policy number","member number","\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"]},{type:"agent_id",tokens:["\u05DE\u05E9\u05D5\u05D5\u05E7"],phrases:["agent number","agent code","broker id","\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF"]},{type:"dob",tokens:["dob","birthdate","birthday","\u05DC\u05D9\u05D3\u05D4","\u05D4\u05D5\u05DC\u05D3\u05EA","\u05D2\u05D9\u05DC"],phrases:["date of birth","birth date","\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"]},{type:"phone",tokens:["phone","tel","mobile","cell","fax","\u05D8\u05DC\u05E4\u05D5\u05DF","\u05E0\u05D9\u05D9\u05D3","\u05E4\u05DC\u05D0\u05E4\u05D5\u05DF","\u05E1\u05DC\u05D5\u05DC\u05E8\u05D9"],phrases:["phone number","mobile number","cell phone","\u05D8\u05DC\u05E4\u05D5\u05DF \u05E0\u05D9\u05D9\u05D3"]},{type:"email",tokens:["email","mail","\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC","\u05DE\u05D9\u05D9\u05DC","\u05D3\u05D5\u05D0\u05DC"],phrases:["email address","e mail","\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D9\u05D9\u05DC"]},{type:"address",tokens:["address","street","city","zipcode","zip","postcode","\u05DB\u05EA\u05D5\u05D1\u05EA","\u05E8\u05D7\u05D5\u05D1","\u05E2\u05D9\u05E8","\u05D9\u05E9\u05D5\u05D1","\u05D9\u05D9\u05E9\u05D5\u05D1","\u05DE\u05D9\u05E7\u05D5\u05D3","\u05DE\u05E2\u05DF"],phrases:["home address","postal code","street address","zip code","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D2\u05D5\u05E8\u05D9\u05DD"]},{type:"location",tokens:["gps","latitude","longitude","geolocation","\u05DE\u05D9\u05E7\u05D5\u05DD"],phrases:["gps coordinates"]},{type:"tracking",tokens:["plate","vehicle","\u05E8\u05DB\u05D1","\u05E8\u05D9\u05E9\u05D5\u05D9"],phrases:["license plate","vehicle number","plate number","\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"]},...ii(),{type:"name",tokens:["name","\u05E9\u05DD"],phrases:["first name","last name","full name","family name","given name","surname","\u05E9\u05DD \u05E4\u05E8\u05D8\u05D9","\u05E9\u05DD \u05DE\u05E9\u05E4\u05D7\u05D4","\u05E9\u05DD \u05DE\u05DC\u05D0"]}];function ft(e){if(!e||/^\[[A-Z_]+(?:-\d+)?\]$/.test(e.trim()))return null;let t=e.trim().toLowerCase().replace(/["'`׳״]/g,"").replace(/[_\-.]+/g," ").replace(/\s+/g," ").trim();if(!t)return null;let r=new Set(t.match(/[\p{L}\p{N}]+/gu)??[]);for(let n of Ya)if(n.phrases?.some(s=>t.includes(s))||n.tokens?.some(s=>r.has(s)))return{type:n.type,label:n.type,labelHe:pt(n.type)};return null}function pt(e){return{id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",agent_id:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF",employment:"\u05E4\u05E8\u05D8\u05D9 \u05EA\u05E2\u05E1\u05D5\u05E7\u05D4",education:"\u05D4\u05E9\u05DB\u05DC\u05D4",behavior:"\u05E4\u05E8\u05D5\u05E4\u05D9\u05DC \u05D4\u05EA\u05E0\u05D4\u05D2\u05D5\u05EA",policy:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4",name:"\u05E9\u05DD \u05D0\u05D3\u05DD",email:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9",phone:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF",address:"\u05DB\u05EA\u05D5\u05D1\u05EA",dob:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4",financial:"\u05E4\u05E8\u05D8\u05D9\u05DD \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9\u05D9\u05DD",medical:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9",minor_data:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF",sensitive_personal:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9",biometric:"\u05DE\u05D9\u05D3\u05E2 \u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9",auth:"\u05E1\u05D9\u05E1\u05DE\u05D0\u05D5\u05EA/\u05E1\u05D5\u05D3\u05D5\u05EA",tracking:"\u05DE\u05D6\u05D4\u05D9 \u05DE\u05E2\u05E7\u05D1",location:"\u05DE\u05D9\u05E7\u05D5\u05DD"}[e]??"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9"}function ai(e){let t=0,r=0,n=0,i=0,s=0;for(let a of e)typeof a=="string"&&(gn(a)&&t++,lt.lastIndex=0,lt.test(a)&&r++,dt.lastIndex=0,dt.test(a)&&n++,ut.lastIndex=0,ut.test(a)&&i++,si(a)&&s++);let o=e.length||1;return t/o>=.3?{type:"id",label:"Israeli ID (sniffed)",matchedSample:t}:i/o>=.3?{type:"financial",label:"IBAN-IL (sniffed)",matchedSample:i}:r/o>=.3?{type:"phone",label:"IL phone (sniffed)",matchedSample:r}:n/o>=.3?{type:"email",label:"Email (sniffed)",matchedSample:n}:s/o>=.3?{type:"financial",label:"Credit card (sniffed)",matchedSample:s}:null}var Qa=[{type:"full_name",kind:"name",severity:"medium",hint:`A person's name in free text (after a role word such as \u05DC\u05E7\u05D5\u05D7 / \u05DE\u05E8 / \u05E2\u05D5"\u05D3, or Client: / Mr.).`},{type:"bank_account",kind:"bank_account",severity:"high",hint:"An Israeli bank account number (branch-account-check form) in plaintext."},{type:"medical",kind:"medical",severity:"high",hint:"Medical information (diagnosis, medication, lab value) in plaintext."},{type:"birth_date",kind:"dob",severity:"medium",hint:"A date of birth in plaintext."},{type:"address",kind:"address",severity:"medium",hint:"A street address in plaintext."},{type:"license_plate",kind:"plate",severity:"low",hint:"A vehicle licence plate in plaintext."}],ec=/^(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק|עו"ד|ד"ר|פרופ'|מר|גברת|חשבון|ח-ן|[בהוכלמש]{0,2}אבחנ[הות]|תאריך לידה|נולד|נולדה|ד\.ל\.|[בהוכלמש]{0,2}גיל)\s*:?\s*/;function tc(e,t,r,n){if(n==="address")return{start:t,end:r};let i=ec.exec(e.slice(t,r));return i&&t+i[0].length<r?{start:t+i[0].length,end:r}:{start:t,end:r}}function B(e,t,r=()=>!0){let n=[],i=new RegExp(e.source,e.flags.includes("g")?e.flags:e.flags+"g");for(let s of t.matchAll(i)){let o=s[1];if(!o||!r(o))continue;let a=(s.index??0)+s[0].indexOf(o);n.push({start:a,end:a+o.length})}return n}var ci=String.raw`[A-Z][a-z']+(?:-[A-Z]?[a-z']+)*`,yn=String.raw`${ci}(?:[ \t]+${ci}){0,2}`,nc=new RegExp(String.raw`\b(?:Mr|Mrs|Ms|Miss|Dr|Prof)\.?[ \t]+(${yn})`),rc=new RegExp(String.raw`\b(?:Client|Customer|Patient|Name|Full name|Beneficiary|Insured|Applicant|Tenant|Employee|Holder|Investor)[ \t]*:[ \t]*(${yn})`),ic=new RegExp(String.raw`\b(${yn})(?=,[ \t]*\d{1,3}[ \t]*,|[ \t]*\(\d{1,3}\))`,"g"),sc=/^(?:Figure|Fig|Table|Step|Section|Chapter|Page|Shot|Scene|Part|Item|Note|Appendix|Version|Level|Phase|Round|Room|Floor|Line|Act|Episode|Season|Slide|Clip|Take)$/,oc=/\b(\d{1,5}[ \t]+(?:[A-Z][A-Za-z'-]*[ \t]+){1,3}(?:Street|St|Road|Rd|Avenue|Ave|Boulevard|Blvd|Lane|Ln|Drive|Way|Court|Ct|Place|Pl)\b\.?)/,ac=/\b(?:policy|claim|account|member|customer|client|contract|case|reference|ref|company|registration)[ \t]+(?:number|no\.?|num\.?|#)[ \t]*:?[ \t]*([A-Z]{0,4}-?\d[\d-]{3,}\d[A-Z]?)\b/i,cc=String.raw`\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4}|\d{4}[\/\-.]\d{1,2}[\/\-.]\d{1,2}|\d{1,2}\s+[A-Z][a-z]{2,8}\s+\d{4}|[A-Z][a-z]{2,8}\s+\d{1,2},?\s+\d{4}`,lc=new RegExp(String.raw`\b(?:date\s+of\s+birth|birth\s*date|d\.?o\.?b\.?|born(?:\s+on)?)\s*[:\-]?\s*(${cc})`,"i"),dc=/\b((?!000|666|9\d\d)\d{3}-(?!00)\d{2}-(?!0000)\d{4})\b/,uc=/\b((?!BG|GB|NK|KN|TN|NT|ZZ)[A-CEGHJ-PR-TW-Z][A-CEGHJ-NPR-TW-Z]\s?\d{2}\s?\d{2}\s?\d{2}\s?[A-D])\b/,fc=/(?<![\w+])(\+(?!972)[1-9][\d\s().-]{7,20}\d)/,li=e=>e.replace(/\D/g,"").length,pc=[{kind:"name",severity:"medium",hint:"A person's name in free text (after Mr. / Dr. / Client: \u2026, or with an age beside it).",find:e=>[...B(nc,e),...B(rc,e),...B(ic,e,t=>!sc.test(t.split(/[ \t]/).pop()??""))]},{kind:"address",severity:"medium",hint:"A street address in plaintext.",find:e=>B(oc,e)},{kind:"reference",severity:"medium",hint:"A policy, claim, account or company number in plaintext.",find:e=>B(ac,e)},{kind:"dob",severity:"medium",hint:"A date of birth in plaintext.",find:e=>B(lc,e)},{kind:"national_id",severity:"high",hint:"A national ID number (US SSN, UK NINO) in plaintext.",find:e=>[...B(dc,e),...B(uc,e)]},{kind:"phone",severity:"high",hint:"A phone number in international form in plaintext.",find:e=>B(fc,e,t=>li(t)>=8&&li(t)<=15)}];function hc(e){let t=new Map;for(let r of e){let n=t.get(r.kind);t.set(r.kind,n?{...n,find:i=>[...n.find(i),...r.find(i)]}:r)}return[...t.values()]}function di(){let e=Qa.map(({type:t,kind:r,severity:n,hint:i})=>{let s=new ge([t]);return{kind:r,severity:n,hint:i,find:o=>s.detect(o).map(a=>tc(o,a.startIndex,a.endIndex,r))}});return hc([...e,...pc])}var ht={_comment:"CANONICAL secret ruleset \u2014 the SINGLE SOURCE OF TRUTH for hardcoded-secret detection, loaded by BOTH the web scanner (lib/soc/exposure-map.ts) and the installed Capsule agent (apps/desktop/src-tauri/src/scanner.rs, via include_str!). Patterns are written in the regex subset both JavaScript and the Rust `regex` crate accept (no lookaround, no backreferences). A connection string counts only WITH credentials (user:pass@). Edit here once and both engines stay aligned.",rules:[{id:"aws-access-key",subkind:"aws_access_key",name:"AWS Access Key",severity:"critical",pattern:"(?:^|[^A-Z0-9])AKIA[A-Z2-7]{16}(?:[^A-Z2-7]|$)",hint:"AWS access key id detected. Rotate via IAM and move to an environment variable."},{id:"aws-secret-key",subkind:"aws_secret_key",name:"AWS Secret Key",severity:"critical",pattern:`(?:aws_secret_access_key|aws_secret_key|secret_access_key)\\s*[=:]\\s*['"]?[A-Za-z0-9/+=]{40}['"]?`,hint:"AWS secret access key detected. Rotate immediately."},{id:"gcp-api-key",subkind:"gcp_api_key",name:"GCP API Key",severity:"critical",pattern:"AIza[0-9A-Za-z_-]{35}",hint:"Google API key detected. Restrict or rotate it in the Google Cloud console."},{id:"gcp-service-account",subkind:"gcp_service_account",name:"GCP Service Account",severity:"critical",pattern:'"type"\\s*:\\s*"service_account"',hint:"GCP service-account JSON detected. Move it out of the repo and rotate the key."},{id:"github-token",subkind:"github_token",name:"GitHub Token",severity:"critical",pattern:"gh[pousr]_[0-9a-zA-Z]{36,}",hint:"GitHub token detected. Revoke at https://github.com/settings/tokens."},{id:"github-fine-grained",subkind:"github_fine_grained_token",name:"GitHub Fine-Grained Token",severity:"critical",pattern:"github_pat_[0-9a-zA-Z_]{22,}",hint:"GitHub fine-grained token detected. Revoke it in GitHub settings."},{id:"gitlab-token",subkind:"gitlab_token",name:"GitLab Token",severity:"critical",pattern:"glpat-[0-9a-zA-Z_-]{20,}",hint:"GitLab token detected. Revoke it in GitLab access tokens."},{id:"stripe-secret",subkind:"stripe_key",name:"Stripe Secret Key",severity:"critical",pattern:"sk_live_[0-9a-zA-Z]{24,}",hint:"Stripe live secret key detected. Roll it in the Stripe dashboard."},{id:"stripe-restricted",subkind:"stripe_restricted_key",name:"Stripe Restricted Key",severity:"critical",pattern:"rk_live_[0-9a-zA-Z]{24,}",hint:"Stripe restricted key detected. Roll it in the Stripe dashboard."},{id:"slack-token",subkind:"slack_token",name:"Slack Token",severity:"high",pattern:"xox[baprs]-[0-9a-zA-Z-]{10,}",hint:"Slack token detected. Revoke it in the Slack app settings."},{id:"slack-webhook",subkind:"slack_webhook",name:"Slack Webhook",severity:"high",pattern:"hooks\\.slack\\.com/services/T[0-9A-Z]{8,}/B[0-9A-Z]{8,}/[0-9a-zA-Z]{24}",hint:"Slack incoming-webhook URL detected. Regenerate it."},{id:"twilio-api-key",subkind:"twilio_api_key",name:"Twilio API Key",severity:"high",pattern:"SK[0-9a-fA-F]{32}",hint:"Twilio API key detected. Rotate it in the Twilio console."},{id:"sendgrid-api-key",subkind:"sendgrid_api_key",name:"SendGrid API Key",severity:"critical",pattern:"SG\\.[0-9a-zA-Z_-]{22}\\.[0-9a-zA-Z_-]{43}",hint:"SendGrid API key detected. Rotate it in the SendGrid console."},{id:"postgres-uri",subkind:"postgres_uri",name:"PostgreSQL Connection String",severity:"critical",pattern:`postgres(?:ql)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"PostgreSQL connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"mongodb-uri",subkind:"mongodb_uri",name:"MongoDB Connection String",severity:"critical",pattern:`mongodb(?:\\+srv)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"MongoDB connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"redis-uri",subkind:"redis_uri",name:"Redis Connection String",severity:"high",pattern:`redis(?:s)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"Redis connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"openai-key",subkind:"openai_key",name:"OpenAI API Key",severity:"critical",pattern:"sk-[0-9a-zA-Z]{20,}T3BlbkFJ[0-9a-zA-Z]{20,}",hint:"OpenAI API key detected. Rotate at https://platform.openai.com/api-keys."},{id:"anthropic-key",subkind:"anthropic_key",name:"Anthropic API Key",severity:"critical",pattern:"sk-ant-[0-9a-zA-Z_-]{40,}",hint:"Anthropic API key detected. Rotate at https://console.anthropic.com/."},{id:"firebase-key",subkind:"firebase_key",name:"Firebase API Key",severity:"high",pattern:"AIza[0-9A-Za-z_-]{35}",hint:"Firebase API key detected. Restrict it in the Firebase console."},{id:"supabase-key",subkind:"supabase_key",name:"Supabase Service Key",severity:"critical",pattern:"eyJ[0-9a-zA-Z_-]{100,}",hint:"Long JWT (possible Supabase service key) detected. Rotate it and keep it server-side only."},{id:"private-key",subkind:"private_key",name:"Private Key",severity:"critical",pattern:"-----BEGIN (?:RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----",hint:"Private key material in plaintext. Rotate immediately and move to a key manager (KMS/Vault).",skipPlaceholder:!0},{id:"jwt-secret",subkind:"jwt_secret",name:"JWT/Generic Secret",severity:"high",pattern:`(?:jwt_secret|JWT_SECRET|secret_key|SECRET_KEY|api_secret|API_SECRET)\\s*[=:]\\s*['"][^'"]{8,}['"]`,hint:"Hardcoded signing/API secret detected. Move it to an environment variable and rotate it."},{id:"password-in-code",subkind:"password_in_code",name:"Password in Code",severity:"high",pattern:`(?:password|passwd|pwd)\\s*[=:]\\s*['"][^'"]{8,}['"]`,hint:"Hardcoded password detected. Move it to a secret manager and rotate it."},{id:"bearer-token",subkind:"bearer_token",name:"Bearer Token in Code",severity:"high",pattern:`['"]Bearer\\s+[0-9a-zA-Z._-]{20,}['"]`,hint:"Hardcoded bearer token detected. Move it to a secret manager and rotate it."},{id:"hex-secret-32",subkind:"hex_secret",name:"Hardcoded 32+ Hex Secret",severity:"medium",pattern:`['"][0-9a-f]{32,}['"]`,hint:"Long hex string that looks like a secret/hash. Confirm it is not a live credential."},{id:"base64-secret",subkind:"base64_secret",name:"Hardcoded Base64 Secret (long)",severity:"medium",pattern:`['"][A-Za-z0-9+/]{64,}={0,2}['"]`,hint:"Long base64 blob that looks like an embedded secret. Confirm it is not a live credential."}]};var yc=[{pattern:/^(full_?name|first_?name|last_?name|spouse_?name|beneficiary_?name)$/i,type:"name",label:"Person name",labelHe:"\u05E9\u05DD \u05D0\u05D3\u05DD"},{pattern:/^(email|e_?mail|email_?address)$/i,type:"email",label:"Email address",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC"},{pattern:/^(phone|mobile|telephone|phone_?number|cell_?phone)$/i,type:"phone",label:"Phone number",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF"},{pattern:/^(id_?number|identity|ssn|social_?security|national_?id|teudat_?zehut)$/i,type:"id",label:"ID number",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05DE\u05D6\u05D4\u05D4"},{pattern:/^(address|street_?address|home_?address)$/i,type:"address",label:"Address",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA"},{pattern:/^(date_?of_?birth|dob|birth_?date|birthday)$/i,type:"dob",label:"Date of birth",labelHe:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"},{pattern:/^(bank_?account|iban|account_?number|bank_?details|routing_?number)$/i,type:"financial",label:"Bank account",labelHe:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7"},{pattern:/^(credit_?card|card_?number|cvv|cc_?number)$/i,type:"financial",label:"Credit card",labelHe:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"},{pattern:/^(salary|income|commission|premium|compensation)$/i,type:"financial",label:"Financial data",labelHe:"\u05E0\u05EA\u05D5\u05DF \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9"},{pattern:/^(medical_?info|health_?conditions|diagnosis|medication)$/i,type:"medical",label:"Medical data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(ip_?address)$/i,type:"tracking",label:"IP address",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA IP"},{pattern:/^(passport|passport_?number|passport_?id)$/i,type:"id",label:"Passport number",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D3\u05E8\u05DB\u05D5\u05DF"},{pattern:/^(driver_?license|drivers_?license|dl_?number)$/i,type:"id",label:"Driver license",labelHe:"\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4"},{pattern:/^(iban|swift_?code|bic)$/i,type:"financial",label:"Banking code",labelHe:"\u05E7\u05D5\u05D3 \u05D1\u05E0\u05E7\u05D0\u05D9"},{pattern:/^(tax_?id|tin|vat_?number|ein)$/i,type:"financial",label:"Tax ID",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05DE\u05E1"},{pattern:/^(insurance_?number|policy_?number|member_?id)$/i,type:"id",label:"Insurance/Member ID",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D1\u05D9\u05D8\u05D5\u05D7/\u05D7\u05D1\u05E8"},{pattern:/^(blood_?type|allergy|allergies|prescription)$/i,type:"medical",label:"Medical data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(biometric|fingerprint|face_?id|retina)$/i,type:"biometric",label:"Biometric data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9"},{pattern:/^(latitude|longitude|lat|lng|geo_?location|coordinates)$/i,type:"location",label:"Geolocation",labelHe:"\u05DE\u05D9\u05E7\u05D5\u05DD \u05D2\u05D9\u05D0\u05D5\u05D2\u05E8\u05E4\u05D9"},{pattern:/^(mac_?address|device_?fingerprint|imei|serial_?number)$/i,type:"tracking",label:"Device identifier",labelHe:"\u05DE\u05D6\u05D4\u05D4 \u05DE\u05DB\u05E9\u05D9\u05E8"},{pattern:/^(ethnicity|race|religion|political_?affiliation|sexual_?orientation)$/i,type:"sensitive_personal",label:"Sensitive personal",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9"},{pattern:/^(minor|child_?name|child_?age|dependent)$/i,type:"minor_data",label:"Minor data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05E0\u05D9\u05DD"},{pattern:/^(signature|digital_?signature)$/i,type:"id",label:"Signature",labelHe:"\u05D7\u05EA\u05D9\u05DE\u05D4"},{pattern:/^(vehicle_?number|license_?plate|plate_?number)$/i,type:"tracking",label:"Vehicle ID",labelHe:"\u05DE\u05D6\u05D4\u05D4 \u05E8\u05DB\u05D1"}],bc=/^(id|uuid|created_?at|updated_?at|deleted_?at|status|type|category|description|title|slug|url|path|key|value|sort_?order|position|enabled|active|public|version|metadata|config|settings|options|data|content|body|raw|json|text|note|comment|label|color|icon|image|avatar|logo|thumbnail|preview|template|schema|format|mode|level|priority|severity|source|target|parent|child|owner|creator|modifier|assignee|project|workspace|organization|team|group|channel|thread|room|session|device|platform|browser|locale|timezone|currency|country|region|city|zip|postal|state|province|name|display_?name|user_?agent|password_?hash|secret|token|private_?key|auth_?token|constraint|index|sequence|trigger|function|procedure|database|namespace|migration|revision)$/i,_c=/^(beacon_?registr|device_?config|hardware|sensor|firmware|telemetry|metric|analytic|log_?event|audit_?log|system_?config|cache|queue|job|migration|schema_?version|spatial_?ref)/i,xc=/^(minor|major|uuid|rssi|tx_?power|beacon_?id|device_?type|firmware_?version|batch_?id|zone_?id)$/i;function ui(e,t){if(bc.test(e)||/^name$/i.test(e)||t&&_c.test(t)||xc.test(e))return null;for(let n of yc)if(n.pattern.test(e))return n.type;let r=oi(e);return r?r.type:null}var hf=ht.rules.map(e=>({id:e.id,name:e.name,pattern:new RegExp(e.pattern),severity:e.severity}));var mf=512*1024,gf=50*1024*1024;var pi={id:"critical",agent_id:"high",policy:"high",financial:"critical",medical:"critical",sensitive_personal:"critical",minor_data:"critical",biometric:"critical",auth:"critical",name:"high",email:"high",phone:"high",address:"high",dob:"high",location:"high",tracking:"medium",employment:"medium",education:"medium",behavior:"high"};function hi(e){return pi[e]}function kc(e){return pi[e]??"low"}function mi(e,t){let r=[];for(let n of t){let i=n.rows.length;for(let s=0;s<n.headers.length;s++){let o=n.headers[s]??"",a=o?ui(o.trim().replace(/["'`׳״:]/g,"").replace(/\s+/g,"_"),n.name)??ft(o)?.type??null:null,c=[];for(let u of n.rows){let d=u[s];typeof d=="string"&&d.length>0&&c.push(d)}let l=c.length>0?ai(c):null;l?r.push(fi(e,n.name,o,l.type,l.label,"value",l.matchedSample,i)):a&&r.push(fi(e,n.name,o,a,pt(a),"header",0,i))}}return r}function fi(e,t,r,n,i,s,o,a){return{file:e,location:t,column:r,type:n,label:i,category:pt(n),severity:kc(n),matchKind:s,hits:o,sampleSize:a}}var wc=new Set(["hex-secret-32","base64-secret"]),vc=[/(?:[$€£]|USD|EUR|GBP)\s?\d[\d,]*(?:\.\d+)?/g,/\d[\d,]*(?:\.\d+)?\s?(?:[$€£]|USD|EUR|GBP|דולר|יורו)/g,/\b\d{1,3}(?:,\d{3})+(?:\.\d+)?\b/g];function Sc(e){let t=new ge(["financial_amount"]);return{kind:"amount",severity:"medium",hint:"A money amount (the amounts dial is on: amounts are treated as sensitive here).",find:r=>{if(!e())return[];let n=t.detect(r).map(s=>({start:s.startIndex,end:s.endIndex}));for(let s of vc){s.lastIndex=0;for(let o of r.matchAll(s))n.push({start:o.index,end:o.index+o[0].length})}n.sort((s,o)=>s.start-o.start||o.end-s.end);let i=[];for(let s of n){let o=i[i.length-1];o&&s.start<o.end?o.end=Math.max(o.end,s.end):i.push({...s})}return i}}}function gi(e={}){let t=e.amounts??(()=>!1),r=[...di(),Sc(t)],n=ht.rules.filter(i=>!wc.has(i.id)).map(i=>({id:i.id,name:i.name,severity:i.severity,pattern:new RegExp(i.pattern)}));return{text:r,amounts:t,header:i=>{let s=ft(i);return s?{type:s.type,label:s.labelHe||s.label}:null},secrets:n,table:i=>mi("",[i]).filter(s=>s.column).map(s=>({column:s.column,type:s.type,category:s.category,severity:s.severity,hits:s.hits,how:s.matchKind==="value"?"value":"header"})),severity:i=>hi(i)}}var yi=!1;function bi(){yi||(yi=!0,mt(gi({amounts:hr})))}bi();ri(process.argv.slice(2)).catch(()=>{process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"ask",permissionDecisionReason:"NoData could not check this file before it is read. Allow anyway?"}}))});