Lines 1-32javascript
2"use strict";const{readJson}=require("../lib/readjson");let chromium=null,pwDevices={};try{const e=require("playwright");chromium=e.chromium,pwDevices=e.devices||{}}catch{}const fs=require("fs"),path=require("path"),crypto=require("crypto"),{pathToFileURL}=require("url");let PNG=null;try{PNG=require("pngjs").PNG}catch{}const os=require("os"),license=require("../lib/license.js"),usageMeter=require("../lib/usage-meter.js"),ENV=Object.freeze({NAVIAN_TRUST_PUBKEY:process.env.NAVIAN_TRUST_PUBKEY,NAVIAN_ALLOW_TRUST_OVERRIDE:process.env.NAVIAN_ALLOW_TRUST_OVERRIDE,NAVIAN_LICENSE:process.env.NAVIAN_LI ...
3 navian-designcheck: this trial ended`+(s?" on "+s:"")+" and has stopped working."+r+`
4 Contact Navian for a full license.
5`),process.exit(2)}if(t.valid&&t.posture==="Full"){const s=t.claims&&(t.claims.licensee||t.claims.sub)||"this install",d=t.claims&&t.claims.expires_at?" \xB7 valid to "+new Date(t.claims.expires_at*1e3).toISOString().slice(0,10):"",u=t.claims&&t.claims.env?" \xB7 "+t.claims.env:"";return console.error(" \u25C6 Running under license \u2014 "+s+d+u+" [navian-designcheck v"+PKG.version+"]"),t}if(t.valid&&t.posture==="WarnBanner")return console.error(" \u26A0 LICENSE: in grace \u2014 "+t.daysLeft+" day(s) left. Renew to avoid the UNLICENSED watermark."+r),t;if(t.valid&&t.posture==="WatermarkUnl ...
6 navian-designcheck: `+o+`.
7 This build requires a valid per-customer license (NAVIAN_LICENSE_ENFORCE=1).
8`),process.exit(2)),console.error(" \u26A0 UNLICENSED (advisory): "+o+". Running anyway \u2014 set NAVIAN_LICENSE_ENFORCE=1 to require one."),t}function printLicenseStatus(){const e=license.checkLicense({env:ENV,anchor:configuredTrustAnchor()}),t=licenseSummary(e);return console.log("navian-designcheck \u2014 license status"),console.log(" status : "+(e.hardDisabled
9 Next: npx playwright install chromium (one-time browser), then ask your agent to audit a page.`),process.exit(e.fail.length?1:0)}const installLicFlag=flags.find(e=>e.startsWith("--install-license"));if(installLicFlag){const e=argv[argv.indexOf(installLicFlag)+1],t=installLicFlag.indexOf("=")>=0?installLicFlag.split("=").slice(1).join("="):e&&e.indexOf("--")!==0?e:"";try{const r=require("../lib/setup.js").installLicense(t);console.log(" \u2714 license installed \u2192 "+r+`
10 Verify: designcheck --license-status`),process.exit(0)}catch(r){console.error(" \u26A0 could not install license \u2014 "+(r&&r.message||r)),process.exit(2)}}const installVlmFlag=flags.find(e=>e.startsWith("--install-vlm-key"));if(installVlmFlag){const e=argv[argv.indexOf(installVlmFlag)+1],t=installVlmFlag.indexOf("=")>=0?installVlmFlag.split("=").slice(1).join("="):e&&e.indexOf("--")!==0?e:"";try{const r=require("../lib/setup.js").installVlmKey(t);console.log(" \u2714 VLM key installed \u2192 "+r+`
11 Now --vision works with no env var.`),process.exit(0)}catch(r){console.error(" \u26A0 could not install VLM key \u2014 "+(r&&r.message||r)),process.exit(2)}}if(flags.includes("--license-status")&&process.exit(printLicenseStatus()?0:1),evidenceVerifyFlag){const e=evidenceVerifyFlag.slice(evidenceVerifyFlag.indexOf("=")+1);try{const t=JSON.parse(fs.readFileSync(e,"utf8")),r=Array.isArray(t)?t:[t],o=d=>"'"+String(d).replace(/'/g,"'\\''")+"'";let s=!0;r.forEach((d,u)=>{const l=evidence.verifyEvidence(d&&d.bundle,d&&d.attestation),y=!l.signed&&l.attestation==="unsigned"&&l.integrityOk,c=l.veri ...
13 `):"")),d&&d.bundle&&d.bundle.trace&&d.bundle.trace[0]){const k=d.bundle.trace[0];console.log(" re-execute: designcheck "+o(k.url)+(Number.isFinite(k.width)?" --width="+Number(k.width):"")+
14Reply ONLY compact JSON: {"text_in_image": true|false, "decorative": true|false, "alt_ok": true|false, "better_alt": "improved alt or empty", "confidence": 0.0-1.0}.
15- text_in_image: does the image itself contain rendered words/letters that carry meaning (a wordmark logo counts).
16- decorative: purely decorative (spacer, bullet, background flourish) conveying no information.
17- alt_ok: does the CURRENT alt accurately and concisely convey the image to a blind user (empty or absent alt on a NON-decorative image is not ok).`;let _;try{_=await vlmFetch("https://api.anthropic.com/v1/messages",{method:"POST",headers:{"x-api-key":t,"anthropic-version":"2023-06-01","content-type":"application/json"},body:JSON.stringify({model:VISION_MODEL,max_tokens:400,messages:[{role:"user",content:[{type:"image",source:{type:"base64",media_type:"image/png",data:v}},{type:"text",text:S}]}]})})}catch(m){y=m;continue}if(_.status===401||_.status===403){let m="";try{const x=await _.json();m= ...
18 if (globalThis.__dcQS) return;
19 var calls = 0, elements = 0;
20 // DISTINCT elements is the number the reader actually wants: 61,994 examinations spread over 1,300 elements is a
21 // different statement from 61,994 spread over 61,994. A WeakSet cannot report its own size, so a seen-marker plus
22 // a counter does the job without holding the nodes alive past the page.
23 var distinct = 0, MARK = '__dcSeen';
24 var D = Document.prototype.querySelectorAll, E = Element.prototype.querySelectorAll;
25 // The wrapper MUST be indistinguishable from the native function, or it changes the page it is measuring.
27 // jQuery (and other libraries) feature-detect native methods by reading .length/.name and by checking that
28 // Function.prototype.toString returns "[native code]". A plain wrapper fails those tests, so jQuery took a
29 // different internal path and threw "Syntax error, unrecognized expression" on a selector it otherwise
30 // handles \u2014 on a real bank site, on nine of ten pages. We then reported that error as the site's defect.
32 // An instrument that changes the thing it measures does not produce a weaker finding; it produces a false
Long lines were clipped for display.