efficient-shell 16.4.1 → 16.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/{Browser-LCX3F2VY.js → Browser-UHT6QSUN.js} +16 -16
  2. package/dist/{Calculator-ZCDSQCRN.js → Calculator-ZG5RX2HX.js} +22 -22
  3. package/dist/{CurrencyConverter-ZLHZOLYE.js → CurrencyConverter-AHGYTGKM.js} +9 -9
  4. package/dist/{Files-TMEV736Q.js → Files-4HJWEYDE.js} +49 -49
  5. package/dist/{Notepad-EWLJWILB.js → Notepad-GXKGVTNG.js} +8 -8
  6. package/dist/{PomodoroTimer-DIIU6KRF.js → PomodoroTimer-GN2OSLJ6.js} +65 -65
  7. package/dist/{Preview-CG2KGNSM.js → Preview-EN4YCUH5.js} +9 -9
  8. package/dist/Sidebar-JJ35JBFL.js +44 -0
  9. package/dist/{Stock-VW2AUUD6.js → Stock-44BSCZOL.js} +4 -4
  10. package/dist/{Weather-ZGQHMHNW.js → Weather-GNGUF6A4.js} +20 -20
  11. package/dist/{WorldClock-GYRJWYQM.js → WorldClock-EBZJRH5F.js} +7 -7
  12. package/dist/apps/index.js +1 -1
  13. package/dist/bin/browser-check.js +1 -1
  14. package/dist/bin/media-host-check.js +1 -1
  15. package/dist/bin/ui-check.js +1 -1
  16. package/dist/chunk-2NHYLLHO.js +15 -0
  17. package/dist/{chunk-JIHDUZJZ.js → chunk-4BB5DHFX.js} +2 -2
  18. package/dist/{chunk-IXGJTYOG.js → chunk-DX24Q5OR.js} +3 -3
  19. package/dist/chunk-EJTAPBGB.js +89 -0
  20. package/dist/{chunk-HHGSWUGI.js → chunk-H6JJAVYL.js} +1 -1
  21. package/dist/{chunk-UJ5772FB.js → chunk-HOTIZZXC.js} +1 -1
  22. package/dist/{chunk-3UCJ6SGP.js → chunk-MS6IZF6E.js} +1 -1
  23. package/dist/{chunk-5MJO7RMB.js → chunk-N7EZ2BFE.js} +3 -3
  24. package/dist/chunk-OHC6Q4QD.js +1 -0
  25. package/dist/{chunk-KGRJSTPM.js → chunk-ST6FPYJ7.js} +9 -9
  26. package/dist/chunk-VIPNHDD3.js +1 -0
  27. package/dist/{chunk-CUNYWXUT.js → chunk-WAUD3BFJ.js} +1 -1
  28. package/dist/{chunk-QD7IODP2.js → chunk-WD3S3ATX.js} +1 -1
  29. package/dist/chunk-YVXF7L66.js +1 -0
  30. package/dist/engine-4U3WOFMO.js +1 -0
  31. package/dist/forms/MediaLibrary.js +1 -1
  32. package/dist/index.js +80 -80
  33. package/dist/model-stage/index.d.ts +69 -5
  34. package/dist/model-stage/index.js +3 -3
  35. package/dist/routine-index.json +1 -1
  36. package/dist/shell/HelpCenter.d.ts +7 -0
  37. package/dist/shell/HelpCenter.js +1 -1
  38. package/dist/shell/SidebarNav.js +1 -1
  39. package/dist/telemetry/index.js +1 -1
  40. package/dist/ui/index.js +1 -1
  41. package/dist/value-index.json +1 -1
  42. package/dist/version.js +1 -1
  43. package/package.json +1 -1
  44. package/dist/Sidebar-ZSVEL4ZU.js +0 -44
  45. package/dist/chunk-4LXCCZDM.js +0 -1
  46. package/dist/chunk-4MYFHXU7.js +0 -1
  47. package/dist/chunk-KT57MRN4.js +0 -1
  48. package/dist/chunk-RBOGLXMV.js +0 -21
  49. package/dist/chunk-S5JX4IAP.js +0 -89
  50. package/dist/engine-T4D3AZOO.js +0 -1
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{execFileSync as e}from"child_process";import{fileURLToPath as t}from"url";import{createRequire as n}from"module";import{join as i,resolve as s,dirname as o}from"path";import{existsSync as r,readFileSync as a,writeFileSync as l,mkdirSync as c,statSync as d,lstatSync as u,readdirSync as p}from"fs";import{createHash as f}from"crypto";function h(e){return function(e,t){for(const s of[i(process.cwd(),"package.json"),t])try{return n(s)(e)}catch{}throw new Error(`${e} is not installed; add it to this repository's devDependencies`)}("typescript",e)}var m=[2,4,8,12,16,20,24,32,40,48];function g(e){if("0"===e||"px"===e)return!0;const t=Number(e);return!!Number.isFinite(t)&&m.includes(4*t)}var x=["button","input","range","textarea","select","dialog","title","portal","native","dark","hex","radius","spacing","font-size","z-index","shadow","kit","icon","svg","kit-dep","chart","chart-dep","ellipsis-label","colour","gutter-literal","view-line-literal","route-literal","root-zone-literal","phone-query","sizes-literal","money-cents","local-helper","deprecated-undated","dialog-frame","scaled-frame","own-text","own-badge","hand-motion","shell-part-copy","copied-value","copied-routine","option-read"],w=e=>"string"==typeof e&&x.includes(e),$=["kit-dep","chart-dep"],y=e=>$.includes(e),b=x.filter(e=>!y(e)),k=["colour","own-text","hand-motion"],v=e=>e.some(e=>k.includes(e)),S=["hex","colour","radius","spacing","font-size","shadow","hand-motion"],E=e=>S.includes(e),T=["gutter-literal","view-line-literal","route-literal","root-zone-literal","phone-query","sizes-literal","money-cents","local-helper","deprecated-undated","copied-value","copied-routine","option-read"],j=e=>T.includes(e),z={button:{counts:"a raw <button>",instead:"Button or IconButton from efficient-shell/ui"},input:{counts:"a raw <input> (not hidden, not a range)",instead:"Input, InputNumber, Checkbox, Radio or Switch from efficient-shell/ui"},range:{counts:'a raw <input type="range">',instead:"Slider from efficient-shell/ui"},textarea:{counts:"a raw <textarea>",instead:"Textarea from efficient-shell/ui"},select:{counts:"a raw <select>",instead:"Select or SearchableSelect from efficient-shell/ui"},dialog:{counts:'a raw <dialog>, or role="dialog" / role="alertdialog" on a raw element',instead:"Dialog or Modal from efficient-shell"},title:{counts:"a title= on a raw element (the browser's own tooltip)",instead:"Tooltip from efficient-shell/ui (harness UI-17)"},portal:{counts:"a createPortal(…) call (a layer the file floats itself)",instead:"Popover, PopupMenu, DropdownMenu, Tooltip or Dialog from efficient-shell/ui"},native:{counts:"window.confirm / alert / prompt, or a bare call that resolves to one",instead:"confirm, confirmDestructive, prompt or toast from efficient-shell (harness UI-20)"},dark:{counts:"a dark: variant in a class string",instead:"the light Tailwind class alone; the shell remaps it in dark mode (harness UI-7)"},hex:{counts:"a hex colour literal in a .tsx string",instead:"a colour role from efficient-shell: its utility or var(--role), COLOUR_ROLES lists them (harness FT-1; the colour kind counts palette classes too)"},radius:{counts:"a literal corner radius (an arbitrary-value radius class, or an inline borderRadius)",instead:"a radius utility from the scale or a role token such as rounded-(--radius-control); the theme sets how round they are (harness UI-7)"},spacing:{counts:"a padding, margin or gap off the scale (6px, 10px, 14px …) or written as a literal length (an arbitrary-value class, an inline style)",instead:"a step of the scale 2/4/8/12/16/20/24/32/40/48 — a Tailwind step, or a role such as var(--space-control-x) (owner ruling 2026-10-12)"},"font-size":{counts:"a literal font size (an arbitrary-value text class, an inline fontSize)",instead:"a type step 9/11/12/14/16/18/20/24/30 — Tailwind's 3xs … 3xl text steps (owner ruling 2026-10-12)"},"z-index":{counts:"a stack order above 30 written as a number (a z utility, an arbitrary value, an inline zIndex)",instead:"a named layer: Z_LAYERS (efficient-shell/ui) in code, its --z-* custom property in markup"},shadow:{counts:"a literal shadow, or a shadow size that is not an elevation level (md, 2xl, xs)",instead:"an elevation: the sm / lg / xl utilities, or var(--elevation-panel) and its siblings (owner ruling 2026-10-12)"},kit:{counts:"an import of a second UI kit",instead:"the component from efficient-shell/ui, or fold it into the shell (harness FT-3)"},icon:{counts:"an import of an icon package",instead:"<Icon name> from efficient-shell/icons, drawn by the one set (harness UI-24)"},svg:{counts:"an <svg> element written in JSX: an icon drawn in place",instead:"<Icon name> from efficient-shell/icons, drawn by the one set (harness UI-24). A chart, an illustration or a mark a host supplies stays on the baseline"},"kit-dep":{counts:"a UI kit or icon package declared in package.json (not one the shell entries imported here need)",instead:"remove the dependency once nothing imports it (harness FT-3)"},chart:{counts:"an import of a second chart library",instead:"a chart from efficient-shell/ui (ChartFrame, TimeSeriesChart, ColumnChart, RankedBars, PieChart, FunnelChart, ScatterChart, …), or add the chart there: one chart system (harness FT-3)"},"chart-dep":{counts:"a chart library declared in package.json",instead:"remove the dependency once nothing imports it (harness FT-3)"},"ellipsis-label":{counts:'a button, link or menu label that ends in "…" or "..."',instead:'the label without the dots, saying what it does ("Extend trial"): "…" means only "the words are cut" (owner ruling 2026-10-14)'},colour:{counts:"a literal colour, in a script string or a stylesheet: a hex, an rgb() / hsl() / oklch() value, a Tailwind palette class (a hue and a step, or white / black), a --color-<hue>-<step> variable, or a named colour in a colour property — a var() fallback included",instead:"a colour role from efficient-shell: its utility (the text, background or border utility of ink, ink-faint, surface, line, accent-fill, accent-text, danger-text, status-danger-line …) or var(--role); COLOUR_ROLES lists them. A merchant site reads the site theme (owner ruling 2026-10-23)"},"gutter-literal":{counts:"the site gutter typed with its own fallback, var(--sf-site-gutter, 40px), in script source (stylesheets are not read)",instead:"SITE_GUTTER_CLASS from efficient-web-builder (lib/content/page-width): the whole class, because Tailwind reads only whole literals; SITE_GUTTER_CAP for the number"},"view-line-literal":{counts:"the 960px written as a length in script source (a max-/min- variant, a media query; a sizes string counts here too)",instead:"the view-lines table in efficient-web-builder (lib/content/view-lines, lib/content/box-stack-line)"},"route-literal":{counts:"a page path typed by hand before a slug: /wheels/, /journal/, /tyres/",instead:"pagePath, postPath or wheelPath from efficient-web-builder (lib/links/page-link-rules), tyrePagePath from efficient-storefront-blocks (render/lib/tyres/tyre-page-path)"},"root-zone-literal":{counts:'the easel root zone key typed as a string ("root:default-zone")',instead:"ROOT_ZONE from efficient-easel (screen/lib/document/content-tree)"},"phone-query":{counts:"the app phone line typed as a media query in script source: (max-width: 767px)",instead:"useIsMobile from efficient-shell: ask the hook, do not write the query"},"sizes-literal":{counts:"a hand-written responsive sizes string (a sizes attribute or sizes: entry with a media condition)",instead:"a named sizes shape from efficient-web-builder (lib/sized-image), built from the view lines"},"money-cents":{counts:"a money amount (amount, price, total, cents, fee, cost, balance) multiplied or divided by 100 by hand",instead:"createMoneyFormatter / useCurrency from efficient-storefront-blocks (render/components/CurrencyContext) for a shopper; formatMoney / currencyDecimals from efficient-shell for the ERP"},"local-helper":{counts:"a local definition (function or const) of a helper a package exports, by name: escapeHtml, deepEqual, timeAgo, formatBytes, hexToRgb and the rest of LOCAL_HELPERS",instead:"import the helper from its home (LOCAL_HELPERS in efficient-shell src/ui-check/kinds.ts names each one)"},"dialog-frame":{counts:"a className on a shell Dialog, PopupForm or ConfirmDialog that redraws its frame: a zero padding, no width or height cap, or a screen-sized or calc() width or height",instead:'a Dialog size: size="full" for a chooser laid out like a window (head bar, body that fills and scrolls), with headerActions for buttons beside the cross'},"scaled-frame":{counts:"a drawing scaled from the top left by hand: a top-left transform origin as a style key or a DOM write (transformOrigin = top left, left top, 0 0, 0% 0%, 0px 0px), in CSS text inside a string, or as the Tailwind origin class for the top left (named or an arbitrary zero)",instead:"FitFrame (a preview drawn at a logical size), or fitScale / fitBoxScale / fitFrameStyle, from efficient-shell/ui: the one home of the fit (harness ARCH-3)"},"own-text":{counts:"text drawn with its own type: a raw <h1>…<h6>; a raw <p> or <span> with a type class (a text size step or an arbitrary size, a font weight) or an inline fontSize / fontWeight; in a stylesheet, a rule that sets its own font-size or font",instead:"Title (headings, with as=), Paragraph or Text from efficient-shell/ui: the shell owns the type of every text an operator reads (re-check 2026-11-19)"},"own-badge":{counts:"a pill drawn by hand: a raw element whose classes give it a rounded corner, a background colour, a text colour and its own side padding",instead:"ColoredBadge (a tone: success, warning, danger, info, neutral) or StatusBadge from efficient-shell/ui"},"hand-motion":{counts:"a typed time, weight or length where the shell has a token: a time in a transition or animation, a numeric font-weight, a literal border width, a literal padding, margin or gap in a stylesheet, a custom property set to one literal length or time, or the same as a duration / delay / arbitrary weight class or an inline style",instead:`the shell token: ${Object.keys({fast:120,base:160}).map(e=>`--motion-${e}`).join(", ")}; ${Object.keys({body:400,control:500,heading:600,figure:700}).map(e=>`--weight-${e}`).join(", ")}; ${Object.keys({hairline:1,strong:2,accent:4}).map(e=>`--border-${e}`).join(", ")}; --space-<step> (${m.join("/")}) and the --row-height-* / --control-height-* ladder (re-check 2026-11-19)`},"shell-part-copy":{counts:"a component defined here (a function, a class, or a const set to a function, forwardRef() or memo()) under the name of a component efficient-shell exports: the names are read from the installed shell's own export list, so a new shell part is covered by the next shell release",instead:"import the part from efficient-shell (or efficient-shell/ui) and delete the copy; a part the shell lacks gets its own name, or goes into the shell"},"deprecated-undated":{counts:'a @deprecated note (a block comment, or a run of whole-line comments) that does not say "delete by YYYY-MM-DD" with a real day from today to 6 months out, or that still says "next major"',instead:'write the day the thing goes ("Delete by 2026-12-15, after <the move>") and a backlog line that owns the move; on that day delete it, or set a new day with the reason'},"copied-value":{counts:"a top-level const whose literal value (a slug or key of 8 or more characters, an array of 3 or more items with a long one, an object of 3 or more keys) is the same as a const that a package the repository declares exports (its copy index)",instead:"the export named after each line, imported from its package"},"copied-routine":{counts:"a function that reads no module state of its own file and whose body (25 or more syntax nodes, local names and types aside) is the same as a function that a package the repository declares exports (its copy index)",instead:"the export named after each line, imported from its package"},"option-read":{counts:"a stored option read by a conditional typed by hand: a test of a value against one option, an || chain of options or a list (includes / has), that answers the same value, else a default (the closed list is in ui-check/optionRead.ts)",instead:"parseOption(options, fallback, value) from efficient-shell/format; a conditional that is not an option read with a default is an allow entry with its reason"}},A={escapeHtml:"efficient-shell (utils/escapeHtml)",deepEqual:"efficient-easel (data)",draftsEqual:"efficient-easel deepEqual (data)",timeAgo:"efficient-shell (format)",formatBytes:"efficient-shell (format)",formatFileSize:"efficient-shell formatBytes (format)",fileSize:"efficient-shell formatBytes (format)",humanSize:"efficient-shell formatBytes (format)",hexToRgb:"efficient-shell (forms/color)",parseHex:"efficient-shell parseHexColor (forms/color)",parseHexColor:"efficient-shell (forms/color)",parseOption:"efficient-shell (format)",hexOf:"efficient-shell parseHexColor (forms/color)",withAlpha:"efficient-shell hexWithAlpha (forms/colorMix)",isDarkInk:"efficient-shell readableInk (forms/color)",relativeLuminance:"efficient-shell (forms/color)",contrastRatio:"efficient-shell (forms/color)"},N=["@headlessui/","@radix-ui/","@mui/","@chakra-ui/","@mantine/","@floating-ui/","antd","react-aria","react-aria-","react-bootstrap","react-select","react-colorful","react-tooltip","react-hot-toast","react-toastify","sonner","efficient-shell-checker"],I=["@heroicons/","@tabler/icons","@tabler/icons-","@phosphor-icons/","@fortawesome/","@iconify/","@radix-ui/react-icons","@mui/icons-material","lucide","lucide-react","simple-icons","react-icons","react-feather"],C=["recharts","chart.js","react-chartjs-2","d3","d3-","@nivo/","victory","victory-","echarts","echarts-for-react","apexcharts","react-apexcharts","@visx/","highcharts","highcharts-react-official","plotly.js","plotly.js-dist","react-plotly.js","lightweight-charts","@antv/g2","@antv/g2plot","chartist","billboard.js","c3","uplot"],L={"efficient-shell":["@headlessui/react"]};function D(e,t){return t.some(t=>t.endsWith("/")||t.endsWith("-")?e.startsWith(t):e===t||e.startsWith(`${t}/`))}function R(e){return D(e,I)?"icon":D(e,N)?"kit":D(e,C)?"chart":null}function M(e){const t=R(e);return"kit"===t||"icon"===t?"kit-dep":"chart"===t?"chart-dep":null}var O=/[.+^$()|[\]\\]/g;function B(e){let t="",n=0;for(let i=0;i<e.length;i++){const s=e[i];"*"===s?"*"===e[i+1]?"/"===e[i+2]?(t+="(?:[^/]+/)*",i+=2):(t+=".*",i+=1):t+="[^/]*":"?"===s?t+="[^/]":"{"===s?(t+="(?:",n+=1):"}"===s&&n>0?(t+=")",n-=1):t+=","===s&&n>0?"|":s.replace(O,"\\$&")}if(0!==n)throw new Error(`unbalanced { in glob "${e}"`);return new RegExp(`^${t}$`)}function F(e){const t=e.map(B);return e=>t.some(t=>t.test(e))}var P=new Set(["node_modules",".git"]),W=new Set(["dist","coverage",".next",".turbo"]);function U(e){const t=e.search(/[*?{]/),n=-1===t?e:e.slice(0,t),i=n.lastIndexOf("/");return-1===i?"":n.slice(0,i)}function J(e,t){const n=F(t),s=[...new Set(t.map(U))].sort(),o=s.filter(e=>!s.some(t=>t!==e&&(""===t||e.startsWith(`${t}/`)))),r=new Set,a=t=>{let s;try{s=p(i(e,t),{withFileTypes:!0})}catch{return}for(const e of s){const i=t?`${t}/${e.name}`:e.name;e.isDirectory()?P.has(e.name)||""===t&&W.has(e.name)||a(i):e.isFile()&&n(i)&&r.add(i)}};for(const e of o)a(e);return[...r].sort(_)}var _=(e,t)=>e<t?-1:e>t?1:0,q=class extends Error{},K=(e,t)=>`${e}:${t}`;function H(e){const t=e.lastIndexOf(":");return{file:e.slice(0,t),kind:e.slice(t+1)}}var V=e=>x.indexOf(e);function G(e,t){const n=H(e),i=H(t);return _(n.file,i.file)||V(n.kind)-V(i.kind)}function Y(e,t="ui-kit.baseline.json"){let n;try{n=JSON.parse(e)}catch(e){throw new q(`${t} is not valid JSON: ${e.message}`)}const i=e=>{throw new q(`${t}: ${e}. The tool writes this file; do not edit it by hand.`)};if("object"!=typeof n||null===n||Array.isArray(n))return i("must be a JSON object");const s=n;if(1!==s.schema)return i("number"==typeof s.schema&&s.schema>1?`"schema": ${s.schema} is newer than this efficient-shell reads (1); upgrade efficient-shell`:'"schema" must be 1');if(!Array.isArray(s.kinds)||s.kinds.some(e=>"string"!=typeof e))return i('"kinds" must be a list');const o=s.kinds.filter(w);if("object"!=typeof s.counts||null===s.counts||Array.isArray(s.counts))return i('"counts" must be an object');const r=new Map;for(const[e,t]of Object.entries(s.counts)){const{file:n,kind:s}=H(e);if(!n||!s)return i(`"${e}" is not "<file>:<kind>"`);if("number"!=typeof t||!Number.isInteger(t)||t<1)return i(`"${e}" must be a whole number, 1 or more (a line that reaches 0 is deleted)`);w(s)&&r.set(e,t)}return{kinds:o,counts:r}}function Z(e){const t=x.filter(t=>e.kinds.includes(t)),n=[...e.counts.keys()].filter(t=>(e.counts.get(t)??0)>0).sort(G).map(t=>` ${JSON.stringify(t)}: ${e.counts.get(t)}`);return["{",' "schema": 1,',` "kinds": [${t.map(e=>JSON.stringify(e)).join(", ")}],`,n.length?` "counts": {\n${n.join(",\n")}\n }`:' "counts": {}',"}",""].join("\n")}function Q(e){const t={};for(const[n,i]of e){const{kind:e}=H(n);w(e)&&(t[e]=(t[e]??0)+i)}return t}var X=class extends Error{},ee=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),te=new Set(["$schema","schema","kinds","include","exclude","includeImporting","output","includeCopies","includeValues","allow"]);function ne(e,t="ui-kit.config.json"){const n=[],i=e=>{n.push(e)},s=(e,t,{required:n=!1}={})=>{if(void 0===e&&!n)return[];if(!Array.isArray(e)||e.some(e=>"string"!=typeof e||""===e))return i(`${t} must be a list of non-empty strings`),[];n&&0===e.length&&i(`${t} must name at least one entry`);for(const n of e)(n.startsWith("/")||n.startsWith("./")||n.includes("\\")||n.split("/").includes(".."))&&i(`${t}: "${n}" must be a path from the repository root, written with / (no ./, .. or \\)`);return e},o=(e,t)=>"string"!=typeof e||e.trim().length<10?(i(`${t} needs a "reason" a reviewer can read (a sentence, not a word)`),""):e,r=(e,t)=>void 0===e?[]:!Array.isArray(e)||e.some(e=>!ee(e))?(i(`${t} must be a list of objects`),[]):e;if(!ee(e))throw new X(`${t}: must be a JSON object`);for(const t of Object.keys(e))te.has(t)||i(`unknown key "${t}"`);1!==e.schema&&i("number"==typeof e.schema&&e.schema>1?`"schema": ${e.schema} is newer than this efficient-shell reads (1); upgrade efficient-shell`:'"schema" must be 1');const a=[];if(Array.isArray(e.kinds)&&0!==e.kinds.length)for(const t of e.kinds)w(t)?a.includes(t)?i(`"kinds": "${t}" is listed twice`):a.push(t):i(`"kinds": unknown kind ${JSON.stringify(t)} (this efficient-shell knows: ${x.join(", ")})`);else i(`"kinds" must list the kinds this repository checks, from: ${x.join(", ")}`);const l=s(e.include,'"include"'),c=s(e.exclude,'"exclude"'),d=r(e.includeImporting,'"includeImporting"').map((e,t)=>({files:s(e.files,`"includeImporting"[${t}].files`,{required:!0}),modules:s(e.modules,`"includeImporting"[${t}].modules`,{required:!0}),reason:o(e.reason,`"includeImporting"[${t}]`)}));0===l.length&&0===d.length&&i('"include" must name the files that are operator UI (for example ["src/**/*.tsx"])');const u=r(e.output,'"output"').map((e,t)=>({files:s(e.files,`"output"[${t}].files`,{required:!0}),reason:o(e.reason,`"output"[${t}]`)})),p=s(e.includeCopies,'"includeCopies"');p.length&&!a.some(j)&&i(`"includeCopies" is read only by the copied-value kinds (${T.join(", ")}), and "kinds" names none of them`);const f=s(e.includeValues,'"includeValues"');f.length&&!a.some(E)&&i(`"includeValues" is read only by the design-value kinds (${S.join(", ")}), and "kinds" names none of them`);const h=[],m=new Set;if(r(e.allow,'"allow"').forEach((e,t)=>{const n=`"allow"[${t}]`,[r]=s([e.file],`${n}.file`),l=o(e.reason,n);if(!w(e.kind))return void i(`${n}.kind must be one of: ${x.join(", ")}`);if(a.includes(e.kind)||i(`${n}: kind "${e.kind}" is not in "kinds"`),"number"!=typeof e.count||!Number.isInteger(e.count)||e.count<1)return void i(`${n}.count must be a whole number, 1 or more`);if(!r)return;const c=`${r}:${e.kind}`;m.has(c)&&i(`${n}: ${r} already has an allow entry for "${e.kind}"`),m.add(c),h.push({file:r,kind:e.kind,count:e.count,reason:l})}),n.length)throw new X(`${t}:\n - ${n.join("\n - ")}`);return{schema:1,kinds:x.filter(e=>a.includes(e)),include:l,exclude:c,includeImporting:d,output:u,includeCopies:p,includeValues:f,allow:h}}var ie="package.json",se="value-index.json",oe="routine-index.json",re=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,ae=e=>f("sha256").update(e).digest("hex").slice(0,20);function le(e,t){if(t){if(e.isAsExpression(t)||e.isSatisfiesExpression(t)||e.isParenthesizedExpression(t)||e.isTypeAssertionExpression(t))return le(e,t.expression);if(e.isStringLiteral(t)||e.isNoSubstitutionTemplateLiteral(t))return t.text;if(e.isNumericLiteral(t))return Number(t.text);if(e.isPrefixUnaryExpression(t)&&t.operator===e.SyntaxKind.MinusToken&&e.isNumericLiteral(t.operand))return-Number(t.operand.text);if(t.kind===e.SyntaxKind.TrueKeyword)return!0;if(t.kind===e.SyntaxKind.FalseKeyword)return!1;if(t.kind===e.SyntaxKind.NullKeyword)return null;if(e.isArrayLiteralExpression(t)){const n=[];for(const i of t.elements){const t=le(e,i);if(void 0===t)return;n.push(t)}return n}if(e.isObjectLiteralExpression(t)){const n={};for(const i of t.properties){if(!e.isPropertyAssignment(i))return;const t=e.isIdentifier(i.name)||e.isStringLiteral(i.name)||e.isNumericLiteral(i.name)?i.name.text:void 0,s=le(e,i.initializer);if(void 0===t||void 0===s)return;n[t]=s}return n}}}function ce(e,t){const n=le(e,t);return void 0!==n&&function(e){return"string"==typeof e?e.length>=8&&/[^A-Za-z]/.test(e)&&!re.test(e):Array.isArray(e)?e.length>=3&&e.some(e=>"string"==typeof e?e.length>=8:null!==e&&"object"==typeof e):null!==e&&"object"==typeof e&&Object.keys(e).length>=3}(n)?ae(`value:${(e=>JSON.stringify(e,(e,t)=>t&&"object"==typeof t&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).sort(([e],[t])=>e<t?-1:e>t?1:0)):t))(n)}`):null}var de=new WeakMap;function ue(e,t){let n=de.get(e);if(!n){n=new Map;for(const[t,i]of Object.entries(e.SyntaxKind)){if("number"!=typeof i)continue;const e=n.get(i);(void 0===e||/^(First|Last)[A-Z]/.test(e)&&!/^(First|Last)[A-Z]/.test(t))&&n.set(i,t)}de.set(e,n)}return n.get(t)??String(t)}var pe=(e,t)=>(e.isFunctionDeclaration(t)||e.isFunctionExpression(t)||e.isArrowFunction(t)||e.isMethodDeclaration(t))&&void 0!==t.body;function fe(e,t){const n=new Map,i=e=>{n.has(e)||n.set(e,`$${n.size}`)},s=n=>{(e.isParameter(n)||e.isVariableDeclaration(n)||e.isBindingElement(n))&&e.isIdentifier(n.name)&&i(n.name.text),(e.isFunctionDeclaration(n)||e.isFunctionExpression(n))&&n.name&&n!==t&&i(n.name.text),e.forEachChild(n,s)};s(t);let o=0;const r=[],a=t=>{((e,t)=>e.isTypeNode(t)||e.isTypeParameterDeclaration(t)||e.isInterfaceDeclaration(t)||e.isTypeAliasDeclaration(t))(e,t)||(e.isAsExpression(t)||e.isNonNullExpression(t)||e.isSatisfiesExpression(t)||e.isParenthesizedExpression(t)||e.isTypeAssertionExpression(t)?a(t.expression):(o+=1,e.isShorthandPropertyAssignment(t)?r.push(`{.${t.name.text}=${n.get(t.name.text)??t.name.text}}`):e.isIdentifier(t)&&e.isBindingElement(t.parent)&&e.isObjectBindingPattern(t.parent.parent)&&t.parent.name===t&&!t.parent.propertyName?r.push(`{.${t.text}=${n.get(t.text)??t.text}}`):e.isIdentifier(t)||e.isPrivateIdentifier(t)?r.push(function(e,t){const n=t.parent;return!!n&&((e.isPropertyAccessExpression(n)||e.isPropertyAssignment(n)||e.isMethodDeclaration(n)||e.isPropertyDeclaration(n)||e.isGetAccessorDeclaration(n)||e.isSetAccessorDeclaration(n)||e.isEnumMember(n)||e.isJsxAttribute(n))&&n.name===t||e.isBindingElement(n)&&n.propertyName===t||e.isQualifiedName(n)&&n.right===t)}(e,t)?`.${t.text}`:n.get(t.text)??t.text):e.isLiteralExpression(t)||e.isTemplateHead(t)||e.isTemplateMiddle(t)||e.isTemplateTail(t)||e.isJsxText(t)?r.push(`${ue(e,t.kind)}:${JSON.stringify(t.text)}`):(r.push(`(${ue(e,t.kind)}`),e.forEachChild(t,a),r.push(")"))))};for(const e of t.parameters)a(e);return t.body&&a(t.body),{hash:ae(`routine:${r.join(" ")}`),nodes:o}}function he(e,t,n){const i=new Set;for(const t of n.statements){if(!e.isVariableStatement(t))continue;const n=t.declarationList,s=(n.flags&(e.NodeFlags.Let|e.NodeFlags.Const))!==e.NodeFlags.Const;for(const t of n.declarations){if(!e.isIdentifier(t.name))continue;let n=t.initializer;for(;n&&(e.isAsExpression(n)||e.isSatisfiesExpression(n)||e.isParenthesizedExpression(n));)n=n.expression;(s||n&&(e.isNewExpression(n)||e.isCallExpression(n)))&&i.add(t.name.text)}}if(0===i.size)return!1;const s=function(e,t){const n=new Set,i=s=>{(e.isParameter(s)||e.isVariableDeclaration(s)||e.isBindingElement(s))&&e.isIdentifier(s.name)&&n.add(s.name.text),(e.isFunctionDeclaration(s)||e.isFunctionExpression(s)||e.isClassDeclaration(s))&&s.name&&s!==t&&n.add(s.name.text),e.forEachChild(s,i)};return i(t),n}(e,t);let o=!1;const r=t=>{if(!o){if(e.isIdentifier(t)&&i.has(t.text)&&!s.has(t.text)){const n=t.parent;return void(e.isPropertyAccessExpression(n)&&n.name===t||e.isPropertyAssignment(n)&&n.name===t||(o=!0))}e.forEachChild(t,r)}};for(const e of t.parameters)r(e);return t.body&&r(t.body),o}var me=e=>[...new Set(e.map(e=>`\`${e.name}\` from ${e.entry}`))].slice(0,3).join(" or ");function ge(e,t){const n={values:new Map,routines:new Map,packages:[]},i=[],s=new Set;for(const{text:o,path:r}of e){let e;try{e=JSON.parse(o)}catch{i.push(`${r} is not valid JSON. Reinstall the package that ships it.`);continue}if(1!==e.schema||"string"!=typeof e.package||!Array.isArray(e.entries)){i.push(`${r} is not a copy index this check reads (schema 1). Upgrade efficient-shell.`);continue}const a=r.endsWith(oe)?"routines":"values",l=`${e.package}:${a}`;if(s.has(l))continue;if(s.add(l),n.packages.includes(e.package)||n.packages.push(e.package),!t.has(e.package))continue;const c=n[a];for(const t of e.entries){const e=c.get(t.hash);e?e.push(t):c.set(t.hash,[t])}}return{index:n,problems:i}}function xe(e,t,n,i){const s=new Map,o=t=>{if(!s.has(t)){const i=n(t);s.set(t,null===i?null:e.createSourceFile(t,i,e.ScriptTarget.Latest,!0,/\.[jt]sx$/.test(t)?e.ScriptKind.TSX:e.ScriptKind.TS))}return s.get(t)??null},r=t=>e.canHaveModifiers(t)&&(e.getModifiers(t)??[]).some(t=>t.kind===e.SyntaxKind.ExportKeyword),a=(t,n,s)=>{const r=o(t);if(!r||s>40)return null;for(const o of r.statements){if(e.isFunctionDeclaration(o)&&o.name?.text===n&&o.body)return{node:o,file:r};if(e.isVariableStatement(o))for(const t of o.declarationList.declarations)if(e.isIdentifier(t.name)&&t.name.text===n)return{node:t,file:r};if(e.isImportDeclaration(o)&&e.isStringLiteral(o.moduleSpecifier)&&o.importClause&&!o.importClause.isTypeOnly){const r=o.importClause.namedBindings;if(r&&e.isNamedImports(r))for(const e of r.elements){if(e.name.text!==n||e.isTypeOnly)continue;const r=i(t,o.moduleSpecifier.text);return r?l(r,(e.propertyName??e.name).text,s+1):null}}}return null},l=(t,n,s)=>{const c=o(t);if(!c||s>40)return null;const d=[];for(const o of c.statements)if(e.isExportDeclaration(o)){if(o.isTypeOnly)continue;const r=o.moduleSpecifier&&e.isStringLiteral(o.moduleSpecifier)?o.moduleSpecifier.text:void 0;if(!o.exportClause){r&&d.push(r);continue}if(!e.isNamedExports(o.exportClause))continue;for(const e of o.exportClause.elements){if(e.name.text!==n||e.isTypeOnly)continue;const o=(e.propertyName??e.name).text;if(!r)return a(t,o,s+1);const c=i(t,r);return c?l(c,o,s+1):null}}else if(r(o)){if(e.isFunctionDeclaration(o)&&o.name?.text===n&&o.body)return{node:o,file:c};if(e.isVariableStatement(o))for(const t of o.declarationList.declarations)if(e.isIdentifier(t.name)&&t.name.text===n)return{node:t,file:c}}for(const e of d){const o=i(t,e),r=o?l(o,n,s+1):null;if(r)return r}return null},c=(t,n)=>{if(n.has(t))return[];n.add(t);const s=o(t);if(!s)return[];const a=[];for(const o of s.statements)if(e.isExportDeclaration(o)){if(o.isTypeOnly)continue;if(o.exportClause){if(e.isNamedExports(o.exportClause))for(const e of o.exportClause.elements)e.isTypeOnly||a.push(e.name.text)}else{const s=o.moduleSpecifier&&e.isStringLiteral(o.moduleSpecifier)?o.moduleSpecifier.text:void 0,r=s?i(t,s):null;r&&a.push(...c(r,n).filter(e=>"default"!==e))}}else if(r(o)&&(e.isFunctionDeclaration(o)&&o.name&&a.push(o.name.text),e.isVariableStatement(o)))for(const t of o.declarationList.declarations)e.isIdentifier(t.name)&&a.push(t.name.text);return a},d=[],u=[],p=[],f=new Set;for(const{entry:n,file:i}of t)if(o(i))for(const t of[...new Set(c(i,new Set))].sort()){const s=l(i,t,0);if(!s)continue;const{node:o}=s;let r,a=null;if(e.isFunctionDeclaration(o))r=o;else if(e.isVariableDeclaration(o)){let t=o.initializer;for(;t&&(e.isAsExpression(t)||e.isSatisfiesExpression(t)||e.isParenthesizedExpression(t));)t=t.expression;t&&pe(e,t)?r=t:0!==(o.parent.flags&e.NodeFlags.Const)&&(a=ce(e,o.initializer))}const c=`${s.file.fileName}:${o.pos}`;if(!f.has(c))if(f.add(c),r){const i=fe(e,r);i.nodes>=25&&u.push({entry:n,name:t,hash:i.hash,nodes:i.nodes})}else a&&d.push({entry:n,name:t,hash:a})}else p.push(`${n}: its source ${i} could not be read.`);return{values:d,routines:u,problems:p}}function we(e,t){const n=t=>{let n=t;for(;e.isParenthesizedExpression(n)||e.isAsExpression(n)||e.isSatisfiesExpression(n)||e.isTypeAssertionExpression(n)||e.isNonNullExpression(n);)n=n.expression;return n},i=t=>{const i=n(t);return e.isStringLiteral(i)||e.isNoSubstitutionTemplateLiteral(i)?i.text:void 0},s=(e,i)=>n(e).getText(t).replace(/\s+/g,"")===n(i).getText(t).replace(/\s+/g,""),o=t=>t===e.SyntaxKind.EqualsEqualsEqualsToken||t===e.SyntaxKind.EqualsEqualsToken,r=t=>t===e.SyntaxKind.ExclamationEqualsEqualsToken||t===e.SyntaxKind.ExclamationEqualsToken,a=(t,s)=>{const a=n(t);if(e.isBinaryExpression(a)&&(s?o:r)(a.operatorToken.kind))for(const[e,t]of[[a.right,a.left],[a.left,a.right]]){const n=i(e);if(void 0!==n&&void 0===i(t))return{value:t,text:n}}},l=(e,t)=>i(e)===t.text||s(e,t.value),c=(t,i)=>{const o=n(t);if(!e.isCallExpression(o)||1!==o.arguments.length)return!1;const r=o.expression;return e.isPropertyAccessExpression(r)&&("includes"===r.name.text||"has"===r.name.text)&&s(i,o.arguments[0])},d=t=>{const i=n(t);return e.isBinaryExpression(i)&&i.operatorToken.kind===e.SyntaxKind.BarBarToken?[...d(i.left),...d(i.right)]:[i]},u=[],p=i=>{e.isConditionalExpression(i)&&(t=>{const i=n(t.condition),o=a(i,!0);if(o&&l(t.whenTrue,o))return!0;const r=a(i,!1);if(r&&l(t.whenFalse,r))return!0;if(e.isPrefixUnaryExpression(i)&&i.operator===e.SyntaxKind.ExclamationToken){const e=a(i.operand,!0);if(e&&l(t.whenFalse,e))return!0;if(c(i.operand,t.whenFalse))return!0}if(c(i,t.whenTrue))return!0;const u=d(i);if(u.length>1){const e=u.map(e=>a(e,!0));if(e.every(e=>void 0!==e)&&e.every(t=>s(t.value,e[0].value))&&s(t.whenTrue,e[0].value))return!0}return!1})(i)?u.push(i.getStart(t)):e.forEachChild(i,p)};return p(t),u}var $e=e=>String(e).padStart(2,"0"),ye=/^(\d{4})-(\d{2})-(\d{2})$/;function be(e){return`${function(e){return`${e.getFullYear()}-${$e(e.getMonth()+1)}`}(e)}-${$e(e.getDate())}`}function ke(e){const t="string"==typeof e?ye.exec(e):null;if(!t)return null;const n=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return be(n)===e?n:null}var ve=new Set(["iframe","frame","object","embed"]),Se=new Set(["href","xlinkHref","to","id","key","htmlFor"]),Ee=/(?<![&\w])(?<!url\()#(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{6}|[0-9a-fA-F]{3,4})(?![\w-])/g,Te=/(?<![\w-])rounded(?:-(?:[trblse]|tl|tr|br|bl|ss|se|ee|es))?-\[([^\]]*)\]/g,je=/^border(?:(?:Top|Bottom)(?:Left|Right)|(?:Start|End)(?:Start|End))?Radius$/,ze=/^(?:inherit|initial|unset|revert)$|var\(|^(?:50|100)%$|^(?:999|9999)(?:px)?$/,Ae=/(?<![\w-])-?(?:p|px|py|pt|pr|pb|pl|ps|pe|m|mx|my|mt|mr|mb|ml|ms|me|gap|gap-x|gap-y|space-x|space-y)-(\d+(?:\.\d+)?|px|\[[^\]]*\])(?![\w.[/-])/g,Ne=/(?<![\w-])text-\[(?:length:)?(\d*\.?\d+(?:px|rem|em|%))\]/g,Ie=/(?<![\w-])z-(\d+|\[[^\]]*\])(?![\w.[/-])/g,Ce=/(?<![\w-])shadow-(xs|2xs|md|2xl|\[[^\]]*\])(?![\w.[/-])/g,Le=/var\(|^(?:inherit|initial|unset|revert|revert-layer|none|auto)$/,De=/^(?:(?:padding|margin)(?:Top|Right|Bottom|Left|Inline|Block|InlineStart|InlineEnd|BlockStart|BlockEnd)?|gap|rowGap|columnGap)$/,Re=new Set([0,...m]),Me=/var\(\s*--sf-site-gutter\s*,\s*-?\d/g,Oe=/(?<![\w.-])960px(?![\w-])/g,Be=/(?:^|[^\w-])\/(?:wheels|journal|tyres)\/$/,Fe=/root:default-zone/g,Pe="top left|left top|0 0|0% 0%|0px 0px",We=new RegExp(`^\\s*(?:${Pe})\\s*$`),Ue=(...e)=>["origin",...e].join("-"),Je=new RegExp([`(?:transformOrigin|transform-origin)\\s*[:=]\\s*["'\`]?\\s*(?:${Pe})(?![\\w%-])`,`(?<![\\w-])!?${Ue("top","left")}(?![\\w-])`,`(?<![\\w-])!?${Ue("\\[0_0\\]")}`].join("|")),_e=/max-width:\s*767px(?![\w-])/g,qe=/\((?:max|min)-width/,Ke=/(?:^|[a-z0-9_])(?:amount|price|total|subtotal|cents|fee|fees|cost|balance)$|(?:Amount|Price|Total|Subtotal|Cents|Fee|Fees|Cost|Balance)$/,He=/(?<![\w-])dark:(?=[\w[\-!@*(])/g,Ve="slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose",Ge="(?:50|[1-9]00|950)",Ye=new RegExp(`(?<![\\w-])(?:bg|text|border(?:-[xytrblse])?|ring(?:-offset)?|inset-ring|outline|divide|fill|stroke|from|via|to|shadow|inset-shadow|drop-shadow|accent|caret|decoration|placeholder)-(?:(?:${Ve})-${Ge}|white|black)(?:\\/[\\w.]+)?(?![\\w-])`,"g"),Ze=new RegExp(`--color-(?:(?:${Ve})-${Ge}|white|black)(?![\\w-])`,"g"),Qe=/(?<![\w-])(?:rgba?|hsla?|hwb|oklch|oklab|lab|lch)\(\s*[\d.]/g,Xe=/(?<![\w-])(?:white|black|red|green|blue|yellow|orange|purple|pink|gray|grey|silver|maroon|navy|teal|olive|lime|aqua|fuchsia|brown|gold|beige|ivory|tan|crimson|coral|salmon|indigo|violet)(?![\w-])/gi,et=/^(?:color|background(?:Color)?|border(?:Top|Right|Bottom|Left|Inline|Block)?(?:Color)?|outline(?:Color)?|fill|stroke|caretColor|accentColor|textDecorationColor|boxShadow|textShadow)$/,tt=/(?<![&a-zA-Z0-9])(?<!url\()#(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{6}|[0-9a-fA-F]{3,4})(?![\w-])/g,nt=e=>[...e.matchAll(tt)].length+[...e.matchAll(Qe)].length+[...e.matchAll(Ye)].length+[...e.matchAll(Ze)].length,it=(...e)=>e.join(""),st=/^h[1-6]$/,ot=new Set(["p","span"]),rt=new Set(["span","div","small","strong","b","em","i","p","mark","label","li"]),at="3xs|2xs|xs|sm|base|lg|xl|[2-9]xl",lt=new RegExp(`(?<![\\w-])!?(?:${it("te","xt-")}(?:(?:${at})(?:\\/[\\w.()-]+)?|\\[(?:length:)?[\\d.]+(?:px|rem|em)\\])|${it("fo","nt-")}(?:thin|extralight|light|normal|medium|semibold|bold|extrabold|black|\\[\\d+\\]))(?![\\w-])`),ct=new RegExp(`(?<![\\w-])${it("round","ed")}(?:-(?:full|sm|md|lg|xl|[23]xl|[trblse]|tl|tr|br|bl|\\([^)]*\\)|\\[[^\\]]*\\]))*(?![\\w-])`),dt=new RegExp(`(?<![\\w-])${it("b","g-")}(?!(?:none|transparent|current|inherit|cover|contain|auto|fixed|local|scroll|center|top|bottom|left|right|repeat|no-repeat|clip|origin|blend|linear|radial|conic|gradient|position|size|image)(?![\\w]))[\\w\\[(#][^\\s'"\`]*`),ut=`${at}|left|center|right|justify|start|end|wrap|nowrap|balance|pretty|ellipsis|clip|transparent|current|inherit|shadow`,pt=new RegExp(`(?<![\\w-])${it("te","xt-")}(?!(?:${ut})(?![\\w]))(?!\\[[\\d.]+(?:px|rem|em)\\])(?!\\[length:)[\\w\\[(#][^\\s'"\`]*`),ft=new RegExp(`(?<![\\w-])${it("p","[xs]?-")}(?:\\d|\\[|\\()`),ht=new RegExp(`(?<![\\w-])${it("p","y-")}(?:0|px|0\\.5|\\[[0-3](?:\\.\\d+)?px\\])(?![\\w.-])`),mt=new RegExp(`(?<![\\w-])${it("round","ed-full")}(?![\\w-])`),gt=new RegExp(`(?<![\\w-])${it("te","xt-")}(?:xs|2xs|3xs|\\[(?:9|10|11|12)px\\])(?![\\w-])`),xt=new RegExp(`(?<![\\w-])${it("p","y-")}`),wt=/(?<![\w.-])(?:\d*\.)?\d+m?s(?![\w-])/g,$t=e=>[...e.matchAll(wt)].some(e=>0!==parseFloat(e[0])),yt=/(?<![\w.#-])-?(?:\d*\.)?\d+(?:px|rem|em)(?![\w-])/g,bt=e=>[...e.matchAll(yt)].some(e=>0!==parseFloat(e[0])),kt=new RegExp(`(?<![\\w-])!?(?:${it("dura","tion-")}|${it("del","ay-")})(?:\\d+|\\[[^\\]]+\\])(?![\\w-])|(?<![\\w-])!?${it("fo","nt-")}\\[\\d+\\](?![\\w-])|(?<![\\w-])!?${it("bor","der")}(?:-[xytrblse])?-\\[[\\d.]+px\\](?![\\w-])`,"g"),vt=/^(?:transition|transitionDuration|transitionDelay|animation|animationDuration|animationDelay)$/,St=/^border(?:Top|Right|Bottom|Left|Inline|Block)?(?:Start|End)?(?:Width)?$/,Et=/^(?:transition|transition-duration|transition-delay|animation|animation-duration|animation-delay)$/,Tt=/^border(?:-(?:top|right|bottom|left|inline|block)(?:-(?:start|end))?)?(?:-width)?$/,jt=/^(?:padding|margin)(?:-(?:top|right|bottom|left|inline|block)(?:-(?:start|end))?)?$|^(?:gap|row-gap|column-gap)$/,zt=/^\s*-?(?:\d*\.)?\d+(?:px|rem|em|ms|s)\s*$/,At=/^\s*(?:inherit|initial|unset|revert|revert-layer|100%|1em)\s*(?:!important)?\s*$/,Nt=new Set(["button","a","option","Button","IconButton","SplitButton","Link","NavLink","PopupMenuItem","PopupMenuLabel","DropdownMenuItem","MenuItem","ContextMenuItem"]),It=/(?:…|\.\.\.|&hellip;)\s*$/,Ct=new RegExp("\\p{L}","u"),Lt=new RegExp("\\p{L}[\\p{L}-]*","u"),Dt={busy:{words:["Accepting","Adding","Applying","Approving","Arranging","Asking","Assigning","Booking","Building","Calculating","Cancelling","Capturing","Changing","Checking","Choosing","Closing","Combining","Comparing","Completing","Confirming","Connecting","Converting","Copying","Correcting","Counting","Creating","Deleting","Detaching","Downloading","Drawing","Duplicating","Emailing","Ending","Exporting","Fetching","Filing","Finding","Flushing","Generating","Grouping","Importing","Linking","Loading","Locating","Looking","Making","Marking","Matching","Measuring","Merging","Moving","Opening","Ordering","Paying","Pending","Posting","Preparing","Previewing","Pricing","Processing","Provisioning","Publishing","Purging","Pushing","Queued","Queuing","Quoting","Re-booking","Re-importing","Re-opening","Reading","Rebooting","Rebuilding","Receiving","Reconciling","Reconnecting","Recording","Refreshing","Refunding","Regenerating","Registering","Reinstating","Rejecting","Removing","Reopening","Requesting","Resending","Resetting","Resolving","Restarting","Restoring","Resuming","Retrying","Reversing","Reverting","Running","Saving","Searching","Sending","Setting","Settling","Sharing","Signing","Splitting","Starting","Submitting","Suggesting","Switching","Syncing","Taking","Testing","Transferring","Typing","Updating","Uploading","Verifying","Waiting","Withdrawing","Working"],zhStarts:["正在"],zhEnds:["中"]},placeholder:{},prompt:{}},Rt=new Set((Dt.busy?.words??[]).map(e=>e.toLowerCase())),Mt=new Set(["label","aria-label",...Dt.placeholder?[]:["placeholder","searchPlaceholder","emptyOptionLabel","blankLabel"]]),Ot=(e,t)=>{if(!It.test(t)||!Ct.test(e))return!1;const n=e.match(Lt)?.[0]?.toLowerCase();if(n&&Rt.has(n))return!1;const i=e.replace(It,"").trim(),s=Dt.busy;return!(s&&(s.zhStarts.some(e=>i.startsWith(e))||s.zhEnds.some(e=>i.endsWith(e))))},Bt=new Set(["confirm","alert","prompt"]),Ft=new Set(["window","globalThis","self"]),Pt=/^(?:\w+\.)?(?:Dialog|PopupForm|ConfirmDialog)$/,Wt=(...e)=>e.join("-"),Ut="vw|vh|dvw|dvh|svw|svh|lvw|lvh",Jt=[`${Wt("p[xytrblse]?","")}(?:0|\\[0(?:px)?\\])`,`${Wt("max","[wh]","")}(?:none|screen|full|\\[[^\\]]+\\])`,`${Wt("h","")}(?:full|screen|${Ut})`,`${Wt("w","")}(?:screen|${Ut})`,`${Wt("[wh]","")}\\[[^\\]]*(?:\\d(?:${Ut}|%)|calc\\()[^\\]]*\\]`,`${Wt("min","h","")}(?:screen|${Ut}|\\[[^\\]]+\\])`],_t=new RegExp(`(?<![\\w-])!?(?:${Jt.join("|")})(?![\\w.-])`);var qt=e=>/\.(?:[cm]?[jt]s|[jt]sx)$/.test(e)&&!e.endsWith(".d.ts"),Kt=e=>/\.(?:css|scss)$/.test(e),Ht=/^(?:color|background(?:-color)?|border(?:-(?:top|right|bottom|left|inline|block)(?:-(?:start|end))?)?(?:-color)?|outline(?:-color)?|fill|stroke|caret-color|accent-color|text-decoration(?:-color)?|box-shadow|text-shadow|column-rule(?:-color)?)$/;function Vt(e,t){const n=new Set(t);if(!n.has("colour")&&!n.has("own-text")&&!n.has("hand-motion"))return{};const i=e.replace(/\/\*[\s\S]*?\*\//g,e=>e.replace(/[^\n]/g," ")),s={},o=(e,t)=>{n.has(e)&&(s[e]??=[]).push(t)},r=e=>i.slice(0,e).split("\n").length,a=[];let l=0;for(let e=0;e<i.length;e++){const t=i[e];if("{"===t||"}"===t||";"===t){const n=i.slice(l,e),s=l+(n.length-n.trimStart().length);if("{"!==t&&a.length>0){const e=n.trim(),t=e.indexOf(":");if(e.startsWith("@apply"))for(let t=[...e.matchAll(Ye)].length;t>0;t--)o("colour",r(s));else if(t>0){const n=e.slice(0,t).trim(),i=n.toLowerCase(),l=e.slice(t+1);if(!/^(?:-webkit-)?mask/.test(i)){const e=nt(l)+(Ht.test(i)?[...l.matchAll(Xe)].length:0);for(let t=0;t<e;t++)o("colour",r(s))}const c=a[a.length-1];"font-size"!==i&&"font"!==i||At.test(l)||c.text||(c.text=!0,o("own-text",c.line));(n.startsWith("--")?zt.test(l)&&0!==parseFloat(l):Et.test(i)?$t(l):"font-weight"===i?/^\s*(?:\d+|bold|bolder)\s*(?:!important)?\s*$/.test(l):!(!Tt.test(i)&&!jt.test(i))&&bt(l))&&o("hand-motion",r(s))}}"{"===t?a.push({line:r(s),text:!1}):"}"===t&&a.pop(),l=e+1}}return s}function Gt(e,t,n,i,s,o,r){const a=new Set(i),l=e.createSourceFile(t,n,e.ScriptTarget.Latest,!0,function(e,t){return t.endsWith(".tsx")?e.ScriptKind.TSX:t.endsWith(".jsx")?e.ScriptKind.JSX:/\.[cm]?js$/.test(t)?e.ScriptKind.JS:e.ScriptKind.TS}(e,t)),c={},d=/\.[jt]sx$/.test(t),u=e=>l.getLineAndCharacterOfPosition(e).line+1,p=(e,t)=>{a.has(e)&&(c[e]??=[]).push(u(t.getStart(l)))},f=(t,n)=>t.attributes.properties.find(t=>e.isJsxAttribute(t)&&t.name.getText(l)===n),h=t=>{const n=t?.initializer;if(n)return e.isStringLiteral(n)?n.text:e.isJsxExpression(n)&&n.expression&&e.isStringLiteralLike(n.expression)?n.expression.text:void 0},m=new Set;if(a.has("native")){const t=n=>{if(n)if(e.isIdentifier(n))Bt.has(n.text)&&m.add(n.text);else if(e.isObjectBindingPattern(n)||e.isArrayBindingPattern(n))for(const i of n.elements)e.isBindingElement(i)&&t(i.name)},n=i=>{(e.isImportClause(i)||e.isImportSpecifier(i)||e.isNamespaceImport(i)||e.isVariableDeclaration(i)||e.isParameter(i)||e.isFunctionDeclaration(i))&&t(i.name),e.forEachChild(i,n)};n(l)}const x=t=>t&&e.isStringLiteralLike(t)?t.text:void 0,w=(e,t)=>{e&&("efficient-shell"===e||e.startsWith("efficient-shell/"))&&s?.add(e);const n=e?R(e):null;n&&p(n,t)},$=(e,t,n)=>{if(a.has("dark"))for(const n of e.matchAll(He))p("dark",t);if(a.has("radius"))for(const n of e.matchAll(Te))ze.test(n[1].trim())||p("radius",t);if(n&&d&&a.has("hex"))for(const n of e.matchAll(Ee))p("hex",t);if(n&&a.has("colour"))for(let n=nt(e);n>0;n--)p("colour",t);if(a.has("spacing"))for(const n of e.matchAll(Ae)){const e=n[1];(e.startsWith("[")?Le.test(e.slice(1,-1).trim()):g(e))||p("spacing",t)}if(a.has("font-size"))for(const n of e.matchAll(Ne))p("font-size",t);if(a.has("z-index"))for(const n of e.matchAll(Ie)){const e=n[1].startsWith("[")?n[1].slice(1,-1).trim():n[1];/^\d+$/.test(e)&&Number(e)>30&&p("z-index",t)}if(a.has("shadow"))for(const n of e.matchAll(Ce))n[1].startsWith("[")&&Le.test(n[1].slice(1,-1).trim())||p("shadow",t);if(a.has("gutter-literal"))for(const n of e.matchAll(Me))p("gutter-literal",t);if(a.has("view-line-literal"))for(const n of e.matchAll(Oe))p("view-line-literal",t);if(a.has("route-literal")&&Be.test(e)&&p("route-literal",t),a.has("root-zone-literal"))for(const n of e.matchAll(Fe))p("root-zone-literal",t);if(a.has("phone-query"))for(const n of e.matchAll(_e))p("phone-query",t);if(a.has("scaled-frame")&&Je.test(e)&&p("scaled-frame",t),a.has("hand-motion"))for(const n of e.matchAll(kt))p("hand-motion",t)},y=t=>{if(t)return e.isJsxExpression(t)?y(t.expression):e.isStringLiteralLike(t)?t.text:e.isTemplateExpression(t)?[t.head.text,...t.templateSpans.map(e=>e.literal.text)].join(" "):void 0},b=t=>e.isNumericLiteral(t)&&100===Number(t.text),k=(t,n,i)=>{const s=e.isStringLiteralLike(n)?n.text.trim():void 0;if(a.has("hand-motion")){("fontWeight"===t?e.isNumericLiteral(n)||void 0!==s&&/^(?:\d+|bold)$/.test(s):vt.test(t)?void 0!==s&&$t(s):!!St.test(t)&&(e.isNumericLiteral(n)&&0!==Number(n.text)||void 0!==s&&bt(s)))&&p("hand-motion",i)}if(a.has("colour")&&void 0!==s&&et.test(t))for(const e of s.matchAll(Xe))p("colour",i);if(a.has("spacing")&&De.test(t))e.isNumericLiteral(n)?Re.has(Number(n.text))||p("spacing",i):void 0!==s&&!Le.test(s)&&(e=>[...e.matchAll(/(-?\d*\.?\d+)(px|rem|em)\b/g)].map(e=>Math.abs(Number(e[1]))*("px"===e[2]?1:16)))(s).some(e=>!Re.has(e))&&p("spacing",i);else if(a.has("font-size")&&"fontSize"===t)(e.isNumericLiteral(n)||void 0!==s&&!Le.test(s)&&!/^(?:smaller|larger)$/.test(s))&&p("font-size",i);else if(a.has("z-index")&&"zIndex"===t){const t=[],s=n=>{e.isNumericLiteral(n)||e.isStringLiteralLike(n)&&/^\d+$/.test(n.text.trim())?t.push(Number(n.text)):e.forEachChild(n,s)};s(n);for(const e of t)e>30&&p("z-index",i)}else a.has("shadow")&&"boxShadow"===t&&(void 0===s||""===s||Le.test(s)||p("shadow",i))},v=(t,n)=>{if(o&&a.has("shell-part-copy")){const n=e.isFunctionDeclaration(t)&&void 0!==t.body||e.isClassDeclaration(t)||e.isVariableDeclaration(t)&&(t=>{if(!t)return!1;if(e.isArrowFunction(t)||e.isFunctionExpression(t)||e.isClassExpression(t))return!0;if(e.isCallExpression(t)){const n=t.expression,i=e.isIdentifier(n)?n.text:e.isPropertyAccessExpression(n)?n.name.text:"";return"forwardRef"===i||"memo"===i}return!1})(t.initializer)?t.name:void 0;n&&e.isIdentifier(n)&&o.has(n.text)&&p("shell-part-copy",n)}if(e.isJsxOpeningElement(t)||e.isJsxSelfClosingElement(t)){const n=t.tagName.getText(l);if(a.has("sizes-literal")){const e=y(f(t,"sizes")?.initializer);void 0!==e&&qe.test(e)&&p("sizes-literal",t)}if(a.has("dialog-frame")&&Pt.test(n)){const e=f(t,"className")?.initializer?.getText(l);void 0!==e&&_t.test(e)&&p("dialog-frame",t)}if(/^[a-z]/.test(n)){const i=h(f(t,"type"));"svg"===n&&p("svg",t),"button"===n?p("button",t):"select"===n?p("select",t):"textarea"===n?p("textarea",t):"input"===n&&("range"===i?p("range",t):"hidden"!==i&&p("input",t));const s=h(f(t,"role"));if("dialog"!==n&&"dialog"!==s&&"alertdialog"!==s||p("dialog",t),!ve.has(n)&&f(t,"title")&&p("title",t),a.has("own-text")||a.has("own-badge")){const i=(t=>{const n=(f(t,"className")??f(t,"class"))?.initializer;if(!n)return"";const i=[],s=t=>{if(e.isStringLiteralLike(t))i.push(t.text);else if(e.isTemplateExpression(t)){i.push(t.head.text);for(const e of t.templateSpans)s(e.expression),i.push(e.literal.text)}else e.forEachChild(t,s)};return s(n),i.join(" ")})(t),s=rt.has(n)&&ct.test(i)&&dt.test(i)&&pt.test(i)&&ft.test(i)&&(e=>ht.test(e)||!xt.test(e)&&mt.test(e)&&gt.test(e))(i);s?p("own-badge",t):(st.test(n)||ot.has(n)&&(lt.test(i)||(t=>{const n=f(t,"style")?.initializer,i=n&&e.isJsxExpression(n)?n.expression:void 0;return!(!i||!e.isObjectLiteralExpression(i))&&i.properties.some(t=>{if(!e.isPropertyAssignment(t))return!1;const n=e.isIdentifier(t.name)||e.isStringLiteralLike(t.name)?t.name.text:"";return"fontSize"===n||"fontWeight"===n||"font"===n})})(t)))&&p("own-text",t)}}}else if(e.isCallExpression(t)){const n=t.expression;e.isIdentifier(n)?"createPortal"===n.text?p("portal",t):Bt.has(n.text)&&!m.has(n.text)?p("native",t):"require"===n.text&&w(x(t.arguments[0]),t):e.isPropertyAccessExpression(n)?"createPortal"===n.name.text?p("portal",t):Bt.has(n.name.text)&&e.isIdentifier(n.expression)&&Ft.has(n.expression.text)&&p("native",t):n.kind===e.SyntaxKind.ImportKeyword&&w(x(t.arguments[0]),t)}else{if(e.isImportDeclaration(t)||e.isExportDeclaration(t))return void w(x(t.moduleSpecifier),t);if(e.isPropertyAssignment(t)){const n=e.isIdentifier(t.name)||e.isStringLiteralLike(t.name)?t.name.text:"",i=t.initializer;if(k(n,i,t),a.has("scaled-frame")&&"transformOrigin"===n){const e=y(i);void 0!==e&&We.test(e)&&p("scaled-frame",t)}if(a.has("sizes-literal")&&"sizes"===n){const e=y(i);void 0!==e&&qe.test(e)&&p("sizes-literal",t)}a.has("radius")&&je.test(n)&&(e.isNumericLiteral(i)?ze.test(i.text)||p("radius",t):e.isStringLiteralLike(i)&&!ze.test(i.text.trim())&&p("radius",t))}else if(e.isBinaryExpression(t)){const n=t.operatorToken.kind;if(a.has("scaled-frame")&&n===e.SyntaxKind.EqualsToken&&e.isPropertyAccessExpression(t.left)&&"transformOrigin"===t.left.name.text){const e=y(t.right);void 0!==e&&We.test(e)&&p("scaled-frame",t)}if(a.has("money-cents")&&(n===e.SyntaxKind.AsteriskToken||n===e.SyntaxKind.SlashToken)){const i=b(t.right)?t.left:b(t.left)&&n===e.SyntaxKind.AsteriskToken?t.right:void 0,s=i&&(t=>{let n=t;for(;e.isParenthesizedExpression(n)||e.isNonNullExpression(n)||e.isAsExpression(n);)n=n.expression;return e.isCallExpression(n)&&(n=n.expression),e.isIdentifier(n)?n.text:e.isPropertyAccessExpression(n)?n.name.text:e.isElementAccessExpression(n)&&e.isStringLiteralLike(n.argumentExpression)?n.argumentExpression.text:void 0})(i);s&&Ke.test(s)&&p("money-cents",t)}}else if(a.has("local-helper")&&(e.isFunctionDeclaration(t)||e.isVariableDeclaration(t))&&t.name&&e.isIdentifier(t.name)&&Object.prototype.hasOwnProperty.call(A,t.name.text)&&(e.isFunctionDeclaration(t)?void 0!==t.body:void 0!==t.initializer&&(e.isArrowFunction(t.initializer)||e.isFunctionExpression(t.initializer))))p("local-helper",t);else if(e.isStringLiteralLike(t))$(t.text,t,n);else if(e.isTemplateExpression(t)){$(t.head.text,t.head,n);for(const e of t.templateSpans)$(e.literal.text,e.literal,n)}}e.isJsxAttribute(t)&&Se.has(t.name.getText(l))?e.forEachChild(t,e=>v(e,!1)):e.forEachChild(t,e=>v(e,n))};if(v(l,!0),a.has("ellipsis-label")&&function(e,t,n){const i=new Set,s=(e,t)=>{i.has(e)||(i.add(e),n(t))},o=n=>{if(n)if(e.isStringLiteralLike(n))Ot(n.text,n.text)&&s(n,n.getStart(t));else if(e.isTemplateExpression(n)){const e=[n.head.text,...n.templateSpans.map(e=>e.literal.text)];Ot(e.join(" "),e[e.length-1])&&s(n,n.getStart(t))}else e.isConditionalExpression(n)?(o(n.whenTrue),o(n.whenFalse)):e.isBinaryExpression(n)?(o(n.left),o(n.right)):e.isParenthesizedExpression(n)||e.isAsExpression(n)||e.isJsxExpression(n)?o(n.expression):e.isCallExpression(n)&&en.has(tn(n.expression))&&n.arguments[0]&&o(n.arguments[0])},r=n=>{for(const i of n)if(e.isJsxText(i)){const e=i.getText(t);Ot(e,e)&&s(i,i.getStart(t)+(e.length-e.trimStart().length))}else e.isJsxExpression(i)?o(i.expression):(e.isJsxElement(i)||e.isJsxFragment(i))&&r(i.children)},a=(n,i)=>{const s=n.attributes.properties.find(n=>e.isJsxAttribute(n)&&n.name.getText(t)===i),o=s?.initializer;return o&&e.isStringLiteral(o)?o.text:o&&e.isJsxExpression(o)&&o.expression&&e.isStringLiteralLike(o.expression)?o.expression.text:void 0},l=t=>t.properties.some(t=>e.isPropertyAssignment(t)&&(e.isIdentifier(t.name)||e.isStringLiteralLike(t.name))&&"value"===t.name.text&&e.isStringLiteralLike(t.initializer)&&""===t.initializer.text),c=n=>{if(e.isJsxElement(n)){const e=n.openingElement,i=e.tagName.getText(t),s="option"===i&&Dt.prompt&&""===a(e,"value");Nt.has(i)&&!s&&r(n.children)}else if(e.isJsxAttribute(n))Mt.has(n.name.getText(t))&&o(n.initializer);else if(e.isPropertyAssignment(n)){const t=e.isIdentifier(n.name)||e.isStringLiteralLike(n.name)?n.name.text:"",i=Dt.prompt&&e.isObjectLiteralExpression(n.parent)&&l(n.parent);Mt.has(t)&&!i&&o(n.initializer)}e.forEachChild(n,c)};c(t)}(e,l,e=>(c["ellipsis-label"]??=[]).push(u(e))),a.has("option-read"))for(const t of we(e,l))(c["option-read"]??=[]).push(u(t));if(a.has("deprecated-undated")){const t=be(new Date);for(const n of function(e,t){const n=t.text,i=new Map,s=e=>e?.forEach(e=>i.set(e.pos,e)),o=t=>{s(e.getLeadingCommentRanges(n,t.pos)),s(e.getTrailingCommentRanges(n,t.end)),e.forEachChild(t,o)};o(t),s(e.getLeadingCommentRanges(n,t.endOfFileToken.pos));const r=[],a=e=>/^[ \t]*$/.test(n.slice(n.lastIndexOf("\n",e-1)+1,e));for(const t of[...i.values()].sort((e,t)=>e.pos-t.pos)){const i=n.slice(t.pos,t.end);if(t.kind===e.SyntaxKind.MultiLineCommentTrivia){r.push({pos:t.pos,text:i,end:t.end,run:!1});continue}const s=a(t.pos),o=r[r.length-1];s&&o?.run&&/^[ \t]*\r?\n[ \t]*$/.test(n.slice(o.end,t.pos))?(o.text+="\n"+i,o.end=t.end):r.push({pos:t.pos,text:i,end:t.end,run:s})}return r}(e,l)){const e=n.text.indexOf("@deprecated");e>=0&&Xt(n.text,t)&&(c["deprecated-undated"]??=[]).push(u(n.pos+e))}}if(r&&(a.has("copied-value")||a.has("copied-routine"))){const t=function(e,t,n,i){const s=[];if(i.value&&n.values.size)for(const i of t.statements)if(e.isVariableStatement(i)&&0!==(i.declarationList.flags&e.NodeFlags.Const))for(const t of i.declarationList.declarations){const i=ce(e,t.initializer),o=i?n.values.get(i):void 0;o&&s.push({kind:"copied-value",node:t,instead:me(o)})}if(i.routine&&n.routines.size){const i=o=>{if(pe(e,o)){const{hash:i,nodes:r}=fe(e,o),a=r>=25?n.routines.get(i):void 0;if(a&&!he(e,o,t))return void s.push({kind:"copied-routine",node:o,instead:me(a)})}e.forEachChild(o,i)};i(t)}return s}(e,l,r.index,{value:a.has("copied-value"),routine:a.has("copied-routine")});for(const e of t)p(e.kind,e.node),r.instead?.(e.kind,u(e.node.getStart(l)),e.instead)}return c}var Yt=/\b(?:delete|deleted|remove|removed|goes|go)\s+(?:[\w`'.-]+\s+){0,2}?by\s+(\d{4}-\d{2}-\d{2})\b/i,Zt=/next\s+major|major\s+after/i,Qt=6;function Xt(e,t){const n=e.replace(/^\s*(?:\/\*\*?|\*\/|\*|\/\/)\s?/gm,"");if(Zt.test(n))return'it still says "next major": the delete day is the only promise';const i=Yt.exec(n);if(!i)return'no delete day ("delete by YYYY-MM-DD")';const s=ke(i[1]);if(!s)return`${i[1]} is not a day`;const o=ke(t);if(!o)throw new Error(`today must be YYYY-MM-DD, got ${t}`);if(s<o)return`its delete day ${i[1]} is past`;const r=function(e,t){const n=new Date(e.getFullYear(),e.getMonth()+t,1),i=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();return new Date(n.getFullYear(),n.getMonth(),Math.min(e.getDate(),i))}(o,Qt);return s>r?`its delete day ${i[1]} is more than ${Qt} months out (last ${be(r)})`:void 0}var en=new Set(["say","t"]),tn=e=>{const t=e.getText();return t.slice(t.lastIndexOf(".")+1)};function nn(e){const t={};for(const[n,i]of Object.entries(e))i.length&&(t[n]=i.length);return t}var sn=(e,t,n,i)=>function(e,t,n){const i=e.createSourceFile(t,n,e.ScriptTarget.Latest,!1),s=[];for(const t of i.statements)(e.isImportDeclaration(t)||e.isExportDeclaration(t))&&t.moduleSpecifier&&e.isStringLiteralLike(t.moduleSpecifier)&&s.push(t.moduleSpecifier.text);return s}(e,t,n).some(e=>i.some(t=>t.endsWith("/*")?e.startsWith(t.slice(0,-1)):e===t));var on=e=>new Map(e.allow.map(e=>[K(e.file,e.kind),e.count]));function rn(e,t){return e.kinds.filter(e=>t.kinds.includes(e))}var an=(e,t,n)=>{if("kit-dep"===n)return` (${e.kitDeps.join(", ")})`;if("chart-dep"===n)return` (${e.chartDeps.join(", ")})`;const i=e.hits.get(t)?.[n]??[];if(0===i.length)return"";const s=e.instead?.get(K(t,n));if(s?.size){return` (${i.slice(0,12).map(e=>`line ${e}: ${s.get(e)??"?"}`).join("; ")}${i.length>12?"; …":""})`}const o=i.slice(0,12).join(", ");return` (line${1===i.length?"":"s"} ${o}${i.length>12?", …":""})`};function ln(e,t,n){const i=on(e),s=new Map;for(const[e,o]of t.counts){const{kind:t}=H(e);if(!w(t)||!n.includes(t))continue;const r=o-(i.get(e)??0);r>0&&s.set(e,r)}return{kinds:x.filter(e=>n.includes(e)),counts:s}}function cn(e,t){let n=0;for(const i of new Set([...e.keys(),...t.keys()]))(e.get(i)??0)!==(t.get(i)??0)&&(n+=1);return n}var dn=/^[A-Z][a-z0-9]+(?:[A-Z][a-z0-9]*|[0-9]+)*$/;function un(e,t,n,u,f){const h=i(e,ie);if(!r(h))return{problems:[`no ${ie} in ${e}.`],summary:""};const m=JSON.parse(a(h,"utf8"));if(!m.name)return{problems:[`${ie} has no "name".`],summary:""};let g;try{g=f()}catch{return{problems:['found no "typescript" package here. Install it as a devDependency.'],summary:""}}const x=new Map(u.map(e=>{const t=e.indexOf("=");return[e.slice(0,t),e.slice(t+1)]})),w=t=>{try{return d(i(e,t)).isFile()}catch{return!1}},{entries:$,problems:y}=function(e,t,n,i,s){const o=[],r=[],a=e.name??"",l="string"==typeof e.exports?{".":e.exports}:e.exports??{},c=e=>{if("string"==typeof e)return e;if(e&&"object"==typeof e){const t=e;return c(t.import??t.default??t.require)}},d=e=>[".ts",".tsx","/index.ts","/index.tsx"].map(n=>`${t}/${e}${n}`).find(n)??null;for(const[e,u]of Object.entries(l)){const l="."===e?a:`${a}/${e.replace(/^\.\//,"")}`,p=e=>/\.tsx?$/.test(e)&&!/\.(test|spec)\./.test(e)&&!e.endsWith(".d.ts"),f=(e,t)=>i(e).flatMap(n=>n.endsWith("/")?f(`${e}/${n.slice(0,-1)}`,`${t}${n}`):p(n)?[{entry:l.replace("*",`${t}${n.replace(/\.tsx?$/,"")}`),file:`${e}/${n}`}]:[]),h=e=>{if(e.endsWith("/**"))return f(e.slice(0,-3),"");const t=e.lastIndexOf("/"),[n,s]=[e.slice(0,t),e.slice(t+1)],[o,r=""]=s.split("*");return i(n).filter(e=>e.startsWith(o)&&e.endsWith(r)&&e.length>o.length+r.length).filter(p).map(e=>({entry:l.replace("*",e.slice(o.length,e.length-r.length).replace(/\.tsx?$/,"")),file:`${n}/${e}`}))},m=s.get(e);if(m){if(e.includes("*"))if(m.includes("*")){const t=h(m),i=c(u),[s,a]=l.split("*"),d=e=>!i?.includes("*")||n(i.replace(/^\.\//,"").replace("*",e.entry.slice(s.length,e.entry.length-a.length))),p=t.filter(d);p.length?o.push(...p):t.length?r.push(`--entry ${e}=${m}: no source it matches is built at ${i}. Build first.`):r.push(`--entry ${e}=${m}: the pattern matches no source file.`)}else r.push(`--entry ${e}=${m}: a "*" subpath takes a pattern ("dir/*.tsx" or "dir/**").`);else o.push({entry:l,file:m});continue}const g=c(u);if(!g||!/\.m?js$/.test(g))continue;const x=/^\.\/[^/]+\/(.+)\.m?js$/.exec(g);if(!x){r.push(`exports "${e}" points at ${g}, not into a build folder. Name its source: --entry ${e}=<file>.`);continue}const w=x[1];if(w.includes("*")){const n=w.slice(0,w.lastIndexOf("/")),i=w.endsWith("/*")&&!n.includes("*")?h(`${t}/${n}/*`):[];i.length?o.push(...i):r.push(`exports "${e}" (${g}) has no source files at ${t}/${n}/. Name them: --entry ${e}=<folder>/*.tsx.`);continue}const $=d(w);$?o.push({entry:l,file:$}):r.push(`exports "${e}" (${g}) has no source at ${t}/${w}.ts(x). Name it: --entry ${e}=<file>.`)}return{entries:o,problems:r}}(m,n,w,t=>{try{return p(i(e,t),{withFileTypes:!0}).map(e=>e.isDirectory()?`${e.name}/`:e.name).sort()}catch{return[]}},x);for(const[e,t]of x)t.includes("*")||w(t)||y.push(`--entry ${e}=${t}: no such file.`);if(0===$.length&&y.push(`${ie} "exports" names no script entry, so the index would be empty.`),y.length)return{problems:y,summary:""};const b=xe(g,$,t=>{try{return a(i(e,t),"utf8")}catch{return null}},(e,t)=>{if(!t.startsWith("."))return null;const n=i(o(e),t).replace(/\\/g,"/"),s=n.replace(/\.(m?js|jsx)$/,"");return[n,`${s}.ts`,`${s}.tsx`,`${n}.ts`,`${n}.tsx`,`${n}/index.ts`,`${n}/index.tsx`].find(e=>/\.tsx?$/.test(e)&&w(e))??null});if(b.problems.length)return{problems:b.problems,summary:""};const k=(e,t)=>e.entry<t.entry?-1:e.entry>t.entry?1:e.name<t.name?-1:e.name>t.name?1:0,v=e=>({schema:1,package:m.name,version:m.version??"",entries:[...e].sort(k)}),S=s(e,t);return c(S,{recursive:!0}),l(i(S,se),`${JSON.stringify(v(b.values))}\n`),l(i(S,oe),`${JSON.stringify(v(b.routines))}\n`),{problems:[],summary:`${m.name}: copy index of ${$.length} entries written to ${t}: ${b.values.length} values, ${b.routines.length} routines.`}}var pn="\n// <button> in a comment is not a button, and <svg> in one is not a drawing\n/* nor is <input title=\"x\"> in this one, or dark:bg-black, or #fff */\nimport { createPortal } from 'react-dom';\nimport { Dialog } from '@headlessui/react';\nimport { TrashIcon } from '@heroicons/react/24/outline';\nimport type { Icon } from 'lucide-react';\nimport { Button, confirm } from 'efficient-shell';\nexport { Slot } from '@radix-ui/react-slot';\nexport { CheckIcon } from '@radix-ui/react-icons';\nimport { LineChart } from 'recharts';\nimport 'd3-scale';\nexport { VictoryPie } from 'victory';\nimport { BarChart } from '@mui/x-charts';\nimport Tree from 'react-d3-tree';\nimport { TimeSeriesChart } from 'efficient-shell/ui';\n// import 'chart.js' in a comment is not an import, and 'echarts' in a string is not one either\nconst chartLabel = 'd3-array';\n\nconst a = <button title=\"Says what it does\">x</button>;\nconst b = <input type=\"range\" />;\nconst c = <input type=\"text\" />;\nconst c2 = <input type={\"hidden\"} name=\"csrf\" />;\nconst c3 = <input type=\"hidden\" />;\nconst c4 = <input type={kind} />;\nconst d = <select />;\nconst d2 = <textarea />;\nconst e = <div role=\"dialog\" />;\nconst e2 = <dialog open />;\nconst e3 = <section role={'alertdialog'} />;\nconst f = <iframe title=\"Preview\" />;\nconst f2 = <object title=\"Chart\" />;\nconst g = <Button title=\"a prop, not a tooltip\" role=\"dialog\" />;\nconst g2 = (\n <button\n type=\"button\"\n title={hint}\n >\n y\n </button>\n);\nconst h = ReactDOM.createPortal(a, document.body);\nconst i = createPortal(a, document.body);\n\nasync function leave() {\n if (window.confirm('Sure?')) return;\n globalThis.alert('No');\n alert('native: nothing binds the name');\n prompt('native too');\n await confirm('the shell: the import binds it');\n record.confirm('a method, not the popup');\n}\n\nconst j = <div className=\"bg-white dark:bg-black dark:hover:text-white is-dark:no\" />;\nconst k = clsx('text-gray-900', on && 'dark:text-gray-100');\nconst l = <span style={{ color: '#fff', background: \"#12ab34\" }} className={`border-[#0a0b0c80] ${x}`} />;\nconst m = <a href=\"#faded\" id=\"#bad\" key=\"#abc\" to=\"#face\">skip</a>;\nconst n = <label htmlFor={'#dead'}>skip</label>;\nconst o = <span>&#1234; and BG#00340 and #12345 and #added are not colours</span>;\nconst p = 'entity &#x1f; ref BG#00340';\nconst q = <use xlinkHref=\"#abc\" fill=\"url(#fed)\" />;\nconst t = <div className=\"rounded-[4px] rounded-t-[0.5rem] hover:rounded-[2px] rounded-lg rounded-(--radius-card) rounded-[inherit] rounded-[var(--r)]\" />;\nconst u = <div style={{ borderRadius: 6, borderTopLeftRadius: '3px', borderBottomRightRadius: '50%', borderEndEndRadius: 'var(--radius-card)' }} />;\nconst v = <i style={{ borderRadius: 9999 }} />;\nconst w = <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M4 4h16\" /></svg>;\nconst w2 = <Svg viewBox=\"0 0 24 24\" />;\nconst w3 = '<svg viewBox=\"0 0 1 1\"></svg> in a string is not an element';\nconst r = lazy(() => import('@mui/material'));\nconst s = require('react-select');\nconst s2 = require('chart.js/auto');\nconst s3 = import('@nivo/line');\n",fn={button:2,input:2,range:1,textarea:1,select:1,dialog:3,title:2,portal:2,native:4,dark:3,hex:3,radius:5,kit:5,icon:3,svg:1,chart:5,colour:8},hn={kit:1,dark:1,portal:1,radius:2,chart:1,colour:2},mn=(...e)=>e.join("-"),gn=`\nconst s1 = <i className="${[mn("px","2.5"),mn("py","1.5"),"md:"+mn("gap","1.5"),"-"+mn("mt","1.5"),mn("p","[10px]")].join(" ")}" />;\nconst s2 = <i className="${[mn("p","0"),mn("px","px"),mn("p","0.5"),mn("p","3"),mn("gap-x","4"),mn("p","12"),mn("p","(--space-12)"),mn("p","[var(--space-12)]"),mn("space-x","reverse"),mn("top","1.5")].join(" ")}" />;\nconst s3 = <i style={{ padding: 6, marginTop: '10px', gap: 8, margin: '0 auto', paddingInline: 'var(--space-12)' }} />;\nconst f1 = <i className="${[mn("text","[11px]"),mn("text","[0.8rem]"),mn("text","xs"),mn("text","[#fff]"),mn("text","(--text-2xs)")].join(" ")}" />;\nconst f2 = <i style={{ fontSize: 12 }} />;\nconst f3 = { fontSize: 'var(--x)', font: 'inherit' };\nconst z1 = <i className="${[mn("z","[9999]"),mn("z","50"),mn("z","10"),mn("z","30"),"-"+mn("z","10"),mn("z","auto"),mn("z","(--z-popup)"),mn("z","[var(--z-popup)]")].join(" ")}" />;\nconst z2 = { zIndex: on ? 2020 : 2010 };\nconst z3 = { zIndex: Z_LAYERS.popup, top: 9999 };\nconst h1 = <i className="${[mn("shadow","[0_1px_2px_#000]"),mn("shadow","md"),"shadow",mn("shadow","lg"),mn("shadow","(--elevation-panel)"),mn("shadow","black/20"),mn("drop-shadow","md")].join(" ")}" />;\nconst h2 = { boxShadow: '0 1px 2px rgba(0,0,0,.1)' };\nconst h3 = { boxShadow: 'none', outline: 'var(--elevation-raised)' };\n`,xn={spacing:7,"font-size":3,"z-index":4,shadow:3,hex:1,colour:4},wn={colour:4,"hand-motion":1},$n=`\nconst t1 = <h3 className="sf-title">Pages</h3>;\nconst t2 = <h1>Title</h1>;\nconst t3 = <p className="${[mn("mt","2"),mn("text","[12px]")].join(" ")}">warn</p>;\nconst t4 = <span className="${mn("text","sm")}">x</span>;\nconst t5 = <span className={cn('a', on && '${mn("font","semibold")}')}>x</span>;\nconst t6 = <p style={{ fontWeight: 600 }}>x</p>;\nconst n1 = <p>plain</p>;\nconst n2 = <span className="${mn("text","gray","500")}">x</span>;\nconst n3 = <Title level={2}>x</Title>;\nconst n4 = <div className="${mn("text","sm")}">x</div>;\nconst b1 = <span className="${[mn("rounded","full"),mn("bg","amber","100"),mn("px","2"),mn("text","xs"),mn("text","amber","800")].join(" ")}">x</span>;\nconst b2 = <span className={\`${["rounded",mn("px","2"),mn("py","0.5")].join(" ")} \${on ? '${[mn("bg","green","100"),mn("text","green","800")].join(" ")}' : 'x'}\`}>x</span>;\nconst b3 = <span className="${[mn("rounded","full"),mn("bg","(--surface)"),mn("px","2")].join(" ")}">x</span>;\nconst b4 = <ColoredBadge tone="success">x</ColoredBadge>;\nconst b5 = <div className="${[mn("rounded","md"),mn("bg","amber","100"),mn("px","4"),mn("py","2"),mn("text","amber","800")].join(" ")}">a box, not a pill</div>;\nconst m1 = <i className="${[mn("duration","150"),mn("delay","[40ms]"),mn("font","[600]"),mn("border","[1px]"),mn("duration","(--motion-fast)")].join(" ")}" />;\nconst m2 = <i style={{ transition: 'opacity 0.12s', borderWidth: 1, fontWeight: 'bold', transitionDuration: 'var(--motion-fast)' }} />;\n`,yn={"own-text":6,"own-badge":2,"hand-motion":8,"font-size":1,colour:7},bn={"own-text":3,"hand-motion":6},kn=new Set(["Title","ColoredBadge"]),vn={"shell-part-copy":8},Sn={"ellipsis-label":9},En=`\nconst d1 = <Dialog open size="2xl" className="${[mn("p","0"),mn("max-w","none")].join(" ")}" />;\nconst d2 = <PopupForm open className={\`${mn("w","[calc(100vw")}-2rem)] \${x}\`} />;\nconst d3 = <ui.Dialog open className="${mn("h","screen")}" />;\nconst d4 = <ConfirmDialog open className="${"!"+mn("max-h","none")}" />;\nconst d5 = <Dialog open className="${mn("w","[100vw]")}" />;\nconst d6 = <Dialog open className="${mn("h","[90vh]")}" />;\nconst d7 = <Dialog open className="${mn("max-w","[95vw]")}" />;\nconst d8 = <Dialog open className="${mn("h","dvh")}" />;\nconst d9 = <Dialog open className="${[mn("px","0"),mn("py","0")].join(" ")}" />;\nconst d10 = <Dialog open className="${mn("p","[0px]")}" />;\nconst k1 = <Dialog open size="full" headerActions={<Help />} />;\nconst k5 = <Dialog open className="${[mn("w","full"),mn("px","4")].join(" ")}" />;\nconst k2 = <Dialog open className="${[mn("p","0.5"),mn("max-w","md"),mn("p","0-x")].join(" ")}" />;\nconst k3 = <Panel className="${mn("p","0")}" />;\nconst k4 = <div className="${mn("max-w","none")}" />;\n`,Tn={"dialog-frame":10,spacing:1},jn=`\n// "root:default-zone" and \`/wheels/\${slug}\` in a comment are not copies\nimport { escapeHtml } from 'efficient-shell/format';\nconst c1 = "${mn("pl","[var(--sf-site-gutter,40px)]")}";\nconst c2 = "var(--sf-site-gutter)";\nconst c3 = <i className="${mn("max","[960px]")}:hidden" />;\nconst c4 = "1960px";\nconst c5 = \`/wheels/\${slug}\`;\nconst c6 = "/tyres/" + slug;\nconst c7 = wheelPath(slug);\nconst c8 = { zone: "root:default-zone" };\nconst c9 = "(max-width: 767px)";\nconst c10 = <img sizes="(max-width: 800px) 100vw, 50vw" />;\nconst c11 = <img sizes={CONTENT_SIZES} />;\nconst c12 = Math.round(price * 100) / 100;\nconst c13 = ratio * 100;\nfunction escapeHtml(s: string) { return s; }\nconst c14 = timeAgo(when);\n/** @deprecated Remove at the next major. */\nconst c15 = 1;\nconst c16 = "@deprecated in a string";\n`,zn={"gutter-literal":1,"view-line-literal":1,"route-literal":2,"root-zone-literal":1,"phone-query":1,"sizes-literal":1,"money-cents":1,"local-helper":1,"deprecated-undated":1},An=["transform","Origin"].join(""),Nn=`\nconst s1 = { ${An}: 'top left' };\nel.style.${An} = "0 0";\nconst s3 = { ${An}: \`0% 0%\` };\nconst s4 = \`.frame { ${["transform","origin"].join("-")}: left top; }\`;\nconst s5 = <div className="${[mn("origin","top","left"),mn("scale","50")].join(" ")}" />;\nconst s6 = <div className="${mn("origin","[0_0]")}" />;\nconst n1 = { ${An}: 'center' };\nconst n2 = { ${An}: origin };\nconst n3 = <div className="${mn("origin","top")}" />;\nconst n4 = "top left";\n`,In={"scaled-frame":6},Cn={"option-read":11},Ln={"pkg/index.ts":"\nexport { clampAll as clamp, settle } from './lib';\nexport const PAGE_SLUG = 'site-footer-page';\nexport const SHORT_WORDS = ['left', 'center', 'right'];\nexport const ORDER = ['home', 'products', 'gallery'];\nexport const LABELS = { top: 'Top', middle: 'Middle', bottom: 'Bottom' };\nexport const WORD = 'Direction';\n","pkg/lib.ts":"\nexport function clampAll(values: number[], low: number, high: number): number[] {\n const out: number[] = [];\n for (const value of values) {\n out.push(Math.min(high, Math.max(low, value)));\n }\n return out;\n}\nconst pending = new Map<string, (ok: boolean) => void>();\nexport function settle(id: string, ok: boolean): boolean {\n const done = pending.get(id);\n if (!done) return false;\n pending.delete(id);\n done(ok);\n return true;\n}\n"},Dn={"copied-value":2,"copied-routine":1};var Rn=e=>x.filter(t=>e[t]).map(t=>`${t} ${e[t]}`).join(", ")||"nothing";function Mn(e){const t=[],n=b,i=[["fixture.tsx",pn,fn],["fixture.ts","\nimport { toast } from 'sonner';\nimport { extent } from 'd3-array';\nexport const tone = { warn: '#f59e0b' };\nexport const cls = 'ring-1 dark:ring-white rounded-[3px]';\nexport const box = { borderRadius: '0.25rem', radius: 4 };\nexport function ask(confirm: (message: string) => boolean) {\n return confirm('a parameter binds the name');\n}\nexport const mount = (node: unknown) => ReactDOM.createPortal(node, document.body);\n",hn],["tokens.tsx",gn,xn],["labels.tsx","\n// <Button>Save…</Button> in a comment is not a label\nconst l1 = <Button>Extend trial…</Button>;\nconst l2 = <PopupMenuItem onClick={go}><span>Read from a PDF...</span></PopupMenuItem>;\nconst l3 = <Button>{busy ? 'Saving…' : 'Duplicate site…'}</Button>;\nconst l4 = <Item label=\"Translate…\" aria-label={'More…'} />;\nconst l5 = [{ label: 'Reject…' }, { value: CUSTOM, label: 'Custom…' }];\nconst l6 = <option value={CUSTOM}>Different address…</option>;\nconst l7 = <PopupMenuLabel>{say(\"Duplicate to page…\")}</PopupMenuLabel>;\nconst n7 = <Button>{t('team:menu.remove')}</Button>;\nconst n1 = <Button>{`${name.slice(0, 9)}…`}</Button>;\nconst n2 = <p>Loading weather…</p>;\nconst n3 = <Input placeholder=\"Search…\" />;\nconst n4 = <option value=\"\">Pick a carrier…</option>;\nconst n5 = [{ value: '', label: 'Select…' }];\nconst n6 = <Button>Extend trial</Button>;\n",Sn],["copies.tsx",jn,zn],["frames.tsx",En,Tn],["scaled.tsx",Nn,In],["own.tsx",$n,yn],["option-read.tsx","\nconst LIST = ['a', 'b'] as const;\nconst SET = new Set(['a']);\nconst r1 = (v: unknown) => v === 'x' ? 'x' : 'y';\nconst r2 = (v: unknown) => 'x' == v ? v : 'y';\nconst r3 = (p?: { m?: string }) => (p?.m as string) === \"x\" ? (p?.m satisfies string | undefined) : \"y\";\nconst r4 = (v?: string) => v! !== 'x' ? 'y' : v!;\nconst r5 = (v: unknown) => !(v === 'x') ? 'y' : ('x' as const);\nconst r6 = (v: string) => (LIST as readonly string[]).includes(v) ? (v as 'a') : 'a';\nconst r7 = (v: string) => SET?.has(v) ? v : 'a';\nconst r8 = (v: string) => !LIST.includes(v as never) ? 'a' : v;\nconst r9 = (p: { s?: string }) => p.s === 'a' || p.s === 'b' ? p.s : undefined;\nconst r10 = (v: unknown) =>\n v === 'a'\n ? 'a'\n : v === 'b'\n ? 'b'\n : 'c';\nconst r11 = (p: { m?: string }) => <i data-m={p.m === `x` ? `x` : 'y'} />;\nconst n1 = (v: unknown) => v === 'x' ? 'y' : 'z';\nconst n2 = (v: unknown, w: string) => v === 'x' ? w : 'z';\nconst n3 = (v: string, w: string) => LIST.includes(v as never) ? w : 'a';\nconst n4 = (v?: string) => (v ?? 'left') === 'center';\ntype N5<T> = T extends 'x' ? 'x' : never;\nconst n6 = 'x' === 'x' ? 'x' : 'y';\nconst n7 = (v: unknown, w: unknown) => v === 'a' || w === 'b' ? v : 'c';\nconst n8 = (v: unknown) => parseOption(['x', 'y'], 'y', v);\n",Cn]];for(const[s,o,r]of i){const i=nn(Gt(e,s,o,n));n.some(e=>(i[e]??0)!==(r[e]??0))&&t.push(`${s}: read ${Rn(i)}; it holds ${Rn(r)}`)}const s=[["style.css",'\n/* #fff in a comment */\n.a:hover { color: #111; border: 1px solid white; }\n[data-x="#fff"] { mask-image: linear-gradient(#000, transparent); color: var(--ink); }\n.b { --mine: rgb(0 0 0 / .5); background: var(--surface, #fff); }\n',wn],["own.css","\n.title { margin: 0; font-size: var(--text-xl); font-weight: 600; }\n.reset { font: inherit; }\n.sub { margin: var(--space-8) 0; font-size: 14px; }\n.card { border: 1px solid var(--line); padding: 10px; gap: 0; }\n.fade { transition: opacity 0.12s; transition-duration: var(--motion-fast); animation: none 0s; }\n.rail { --rail-w: 44px; --rail-r: var(--radius-xl); --ratio: 1.5; --t: 120ms; }\n@media (min-width: 600px) { .x { font-size: 12px; font-size: 14px; } }\n",bn]];for(const[e,i,o]of s){const s=nn(Vt(i,n));n.some(e=>(s[e]??0)!==(o[e]??0))&&t.push(`${e}: read ${Rn(s)}; it holds ${Rn(o)}`)}const o=nn(Gt(e,"parts.tsx","\nimport { Title as ShellTitle } from 'efficient-shell/ui';\nexport function Title(props: { text: string }) { return <h2>{props.text}</h2>; }\nclass ColoredBadge {}\nconst a = () => { const Title = () => null; return Title; };\nconst b = function () { const ColoredBadge = function () { return null; }; return ColoredBadge; };\nconst c = () => { const Title = forwardRef(() => null); const ColoredBadge = React.memo(() => null); return [Title, ColoredBadge]; };\ndeclare function Title2(): void;\nfunction Heading() { return null; }\nconst d = () => { const Title = 'title'; return Title; };\nconst e = () => { const Title = memo(Inner); const ColoredBadge = forwardRef(Inner); return [Title, ColoredBadge]; };\nconst f = () => { const Title = useMemo(() => 1, []); return Title; };\nexport { ShellTitle };\n",["shell-part-copy"],void 0,kn));(o["shell-part-copy"]??0)!==vn["shell-part-copy"]&&t.push(`parts.tsx: read ${Rn(o)}; it holds ${Rn(vn)}`);const r=function(e){const t=xe(e,[{entry:"fixture-pkg",file:"pkg/index.ts"}],e=>Ln[e]??null,(e,t)=>"./lib"===t?"pkg/lib.ts":null),n=(e,t)=>({path:t,text:JSON.stringify({schema:1,package:"fixture-pkg",version:"0.0.0",entries:e})}),{index:i}=ge([n(t.values,"value-index.json"),n(t.routines,"routine-index.json")],new Set(["fixture-pkg"]));return{index:i,values:t.values.map(e=>e.name),routines:t.routines.map(e=>e.name)}}(e);"LABELS,ORDER,PAGE_SLUG"===r.values.join()&&"clamp,settle"===r.routines.join()||t.push(`the copy index of its fixture package holds values ${r.values.join(", ")||"none"} and routines ${r.routines.join(", ")||"none"}; it should hold values LABELS, ORDER, PAGE_SLUG and routines clamp, settle`);const a=nn(Gt(e,"copied.ts","\nconst FOOTER = 'site-footer-page';\nconst SORT = { bottom: 'Bottom', middle: 'Middle', top: 'Top' };\nconst ALIGN = ['left', 'center', 'right'];\nconst W = 'Direction';\nlet ORDER2 = ['home', 'products', 'gallery'];\nfunction limit(xs: readonly number[], lo: number, hi: number) {\n const r: number[] = [];\n for (const x of xs) {\n r.push(Math.min(hi, Math.max(lo, x)));\n }\n return r;\n}\nconst pending = new Map<string, (ok: boolean) => void>();\nfunction settle(key: string, ok: boolean): boolean {\n const done = pending.get(key);\n if (!done) return false;\n pending.delete(key);\n done(ok);\n return true;\n}\n",["copied-value","copied-routine"],void 0,void 0,{index:r.index}));x.some(e=>(a[e]??0)!==(Dn[e]??0))&&t.push(`copied.ts: read ${Rn(a)}; it holds ${Rn(Dn)}`);const l=nn(Gt(e,"fixture.tsx",pn,["button"]));return"button"!==Object.keys(l).join()&&t.push(`asked for button alone, the reader reported ${Rn(l)}`),t}var On="ui-kit.config.json",Bn="ui-kit.baseline.json",Fn="efficient-shell-ui-check",Pn=`${Fn}: every surface a person operates takes its UI from efficient-shell (harness UI-24).\n\n ${Fn} check this repository against ${Bn}\n ${Fn} --print print today's counts as a baseline, and change nothing\n ${Fn} --summary print totals per kind and per folder, as Markdown\n ${Fn} --json print the result as JSON\n ${Fn} --update lower the lines whose counts fell, and delete the ones at zero\n ${Fn} --update --allow-move also follow a renamed or split file (no total may rise)\n ${Fn} --init write the first ${Bn}\n ${Fn} --init --kind <kind> take the baseline for a kind just added to "kinds"\n ${Fn} --no-base do not compare with the base branch (refused on a pull request)\n ${Fn} --base-lock run only on a release with the base-branch lock (an older one fails on the flag)\n ${Fn} --write-index <dir> write this package's copy index into <dir> (a package's build; reads package.json "exports")\n [--src <dir>] where the source is (default src)\n [--entry <subpath>=<file>] the source of an "exports" subpath the default does not find\n\nKinds: ${x.join(", ")}\nReads ${On} in the current directory.`;var Wn=(e,t)=>`${e} ${t}${1===e?"":"s"}`,Un=(e,t)=>{const n=Q(e);return t.map(e=>`${e} ${n[e]??0}`).join(" · ")};var Jn=[5e3,15e3];function _n(e,t,n,i){const s=[];for(let o=0;o<n;o++){o>0&&e.sleep?.(Jn[Math.min(o-1,Jn.length-1)]);const n=e.gitDetail?e.gitDetail(t,12e4):{out:e.git(t),error:"git failed (no reason given)"};if(i())return s;s.push(`try ${o+1}: ${null===n.out?n.error:"git ran, and the commit is still not there"}`)}return s}function qn(e,t){const n=t.env.RUNNER_NAME?`runner ${t.env.RUNNER_NAME}`:"a runner with no RUNNER_NAME";return`git fetch was tried ${e.length} times on ${n}: ${e.join("; ")}.`}function Kn(e,t,n,s,o,l,c){const d=c?{index:c}:void 0,p=e.env.GITHUB_BASE_REF,f=!p&&"push"===e.env.GITHUB_EVENT_NAME;if(!p&&!f)return{problems:[],note:"",warnings:[]};const h=p?`GITHUB_BASE_REF is "${p}"`:'GITHUB_EVENT_NAME is "push"',m=(e,t)=>({problems:[e],note:t,warnings:[]}),g=e.git(["rev-parse","--show-prefix"]);if(null===g)return m(`${h}, and git could not read this checkout, so the base branch could not be compared. The comparison is the lock: run the check in the git checkout, with git installed and the folder trusted (git config --global --add safe.directory <path>).`,"git could not read this checkout");let x=p?`origin/${p}`:"HEAD^1";const $=t=>null!==e.git(["rev-parse","--verify","--quiet",`${t}^{commit}`]);if(!$(x)){const t=_n(e,p?["fetch","--no-tags","--depth=1","origin",`+refs/heads/${p}:refs/remotes/origin/${p}`]:["fetch","--no-tags","--deepen=1"],3,()=>$(x));if(!$(x)&&p)return m(`${h}, and ${x} could not be fetched, so the base branch could not be compared. On a pull request the comparison is the lock: give the job the base branch (git fetch origin ${p}). `+qn(t,e),`${x} could not be fetched`);if(!$(x)){const n=function(e){const t=e.env.GITHUB_EVENT_PATH;if(!t)return null;try{const e=JSON.parse(a(t,"utf8")).before;return"string"!=typeof e||!/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(e)||/^0+$/.test(e)?null:e}catch{return null}}(e);let i=[];if(null!==n&&(i=_n(e,["fetch","--no-tags","--depth=1","origin",n],2,()=>$(n))),null===n||!$(n))return m(`${h}, and ${x} (the commit before this one) could not be read, so it could not be compared. On a push the comparison is the lock: give the job that commit (fetch-depth: 2). `+qn(t,e)+(null===n?" The push event names no commit before this push (GITHUB_EVENT_PATH), so none was fetched in its place.":` The push's before commit ${n} could not be fetched either: ${i.join("; ")}.`),`${x} could not be fetched`);x=n}}const y=g.trim(),b=i(e.cwd,...y.split("/").filter(Boolean).map(()=>"..")),k=[],S=e.git(["show",`${x}:${y}${Bn}`]);if(null===S){const t=e.git(["ls-tree","-r","--full-tree","--name-only","-z",x]);if(null===t)return m(`${x} has no ${Bn} in this folder, and git could not list ${x}'s files, so a check that moved here cannot be told from an adoption.`,"adoption not confirmed");const n=t.split("\0").filter(e=>(e===Bn||e.endsWith(`/${Bn}`))&&!r(i(b,e)));return n.length?m(`${n.join(", ")} ${1===n.length?"is":"are"} on ${x} and gone here, and ${x} has no ${Bn} in this folder (${y||"the repository root"}): the check moved. Its lines would be taken as an adoption and never compared: keep the config and the baseline in the folder they were in.`,"the check moved"):{problems:[],note:`${x} has no ${Bn} yet (adoption)`,warnings:k}}const T=e=>`${x}'s ${e} could not be parsed, and this change replaces it with one that parses, so ${e===Bn?"the base branch was not compared":"no scope was checked for shrinking"}. The next change is compared against it as usual.`;let A;try{A=Y(S,`${x}:${Bn}`)}catch{return{problems:[],note:`${x}'s ${Bn} could not be read; the base branch was not compared`,warnings:[T(Bn)]}}const N=new Map,I=t=>(N.has(t)||N.set(t,e.git(["show",`${x}:${y}${t}`])),N.get(t)??null);let C=null;try{const e=I(On);null!==e&&(C=ne(JSON.parse(e),`${x}:${On}`))}catch{C=null}null===C&&k.push(T(On));const L=[],D=new Set(s.kinds.filter(e=>n.kinds.includes(e)));for(const e of A.kinds)D.has(e)||L.push(`"${e}" is checked on ${x}, and not here ("kinds" in ${On}, or ${Bn}). Its lines would never be counted again: keep the kind.`);const R=t=>{const n=t.split("/");for(let t=1;t<=n.length;t++)try{if(u(i(e.cwd,...n.slice(0,t))).isSymbolicLink())return!0}catch{return!1}return!1},M=new Set(o.copyOnly),O=new Set(o.files.filter(e=>!M.has(e))),B=(e,t)=>O.has(e)||w(t)&&(o.partial.get(e)??[]).includes(t),P=new Set([...A.counts.keys()].map(e=>H(e)).filter(({file:e,kind:t})=>e!==ie&&!B(e,t)).map(({file:e})=>e));for(const e of P)R(e)&&L.push(`${e} is under a symbolic link now (the file or a folder above it), and ${x} counted it. The walk does not follow it for every kind counted there, so those lines would never be counted again: keep the real file here.`);const W=on(s),U=C?on(C):W,_=e=>(A.counts.get(e)??0)+(U.get(e)??0),q=new Map;for(const e of new Set([...A.counts.keys(),...U.keys()])){const{file:t,kind:n}=H(e);t!==ie&&0!==_(e)&&((q.get(t)??[]).includes(n)||q.set(t,[...q.get(t)??[],n]))}const V=e=>(q.get(e)??[]).filter(t=>{return i=`${e}:${t}`,(n.counts.get(i)??0)+(W.get(i)??0)<_(`${e}:${t}`);var i}),G=[...q.keys()].filter(t=>!r(i(e.cwd,t))&&!R(t)),Z=[...q.keys()].filter(e=>!G.includes(e)&&!R(e)&&V(e).length>0),X=[...G,...Z];if(X.length){const n=e.git(["diff","-M30%","-C30%","--find-copies-harder","-l0","--no-relative","--name-status","-z",x]);if(null===n)L.push(`${Wn(X.length,"file")} that ${x} counted ${1===X.length?"is":"are"} gone or count less (${X.slice(0,3).join(", ")}${X.length>3?", …":""}), and git could not list the renames, so a move out of the check cannot be told from a delete.`);else{const e=new Map,s=n.split("\0");for(let t=0;t<s.length;){const n=s[t]??"";if(n.startsWith("R")||n.startsWith("C")){const[n,i]=[s[t+1],s[t+2]];n&&i&&e.set(n,[...e.get(n)??[],i]),t+=3}else t+=n?2:1}const o=(e,n,s)=>{const o=s.filter(w),r=Kt(e)&&Kt(n);if(!qt(e)&&!r)return o;let c;try{c=a(i(b,e),"utf8")}catch{return o}if(r){const e=Vt(c,o);return o.filter(t=>(e[t]?.length??0)>0)}const u=Gt(t,e,c,o,void 0,l,d),p=Gt(t,n,c,o,void 0,l,d);return o.filter(e=>(u[e]?.length??0)+(p[e]?.length??0)>0)};for(const t of X){const n=G.includes(t)?"moved to":"counts less, and git lists a copy of it at";for(const i of e.get(`${y}${t}`)??[]){const e=o(i,t,G.includes(t)?q.get(t)??[]:V(t));if(!e.length)continue;if(!i.startsWith(y)){L.push(`${t} ${n} ${i}, outside the folder the check runs in, and it holds ${e.map(e=>`"${e}"`).join(", ")} that ${x} counted. Those lines would never be counted again: keep it in this folder, in a scope.`);continue}const s=i.slice(y.length),r=e.filter(e=>!B(s,e));r.length&&L.push(`${t} ${n} ${s}, and no scope reads it there for ${r.map(e=>`"${e}"`).join(", ")}. ${x} counted it, so those lines would never be counted again: move it into a scope, or widen one to it.`)}}}}if(C){const n=F(C.exclude),i=v(C.kinds),r=e=>(qt(e)||i&&Kt(e))&&!n(e),a=t=>J(e.cwd,[t]).some(r),l="keep the line; delete it only when the files it matches are gone.",c=(e,t,n)=>t.filter(e=>!n.includes(e)&&a(e)).map(t=>`"${e}" drops "${t}", which ${x} reads. Those files would never be counted again: ${l}`),d=(e,t,n)=>n.filter(e=>!t.includes(e)&&a(e)).map(t=>`"${e}" adds "${t}", which takes files ${x} reads out of the check. Those files would never be counted again.`),u=e=>e.flatMap(e=>e.files.flatMap(t=>e.modules.map(e=>({glob:t,module:e})))),p=new Set(u(s.includeImporting).map(({glob:e,module:t})=>`${e}\n${t}`));L.push(...c("include",C.include,s.include),...u(C.includeImporting).filter(({glob:e,module:t})=>!p.has(`${e}\n${t}`)&&a(e)).map(({glob:e,module:t})=>`"includeImporting" drops "${e}" (${t}), which ${x} reads. Those files would never be counted again: ${l}`),...c("includeCopies",C.includeCopies,s.includeCopies),...c("includeValues",C.includeValues,s.includeValues),...d("exclude",C.exclude,s.exclude),...d("output",C.output.flatMap(e=>e.files),s.output.flatMap(e=>e.files)));const f=new Set(o.copyOnly),h=new Set(o.files.filter(e=>!f.has(e))),m=F(C.include),g=F(C.output.flatMap(e=>e.files)),w=new Set;for(const i of C.includeImporting)for(const s of J(e.cwd,i.files)){if(!qt(s)||n(s)||g(s)||m(s))continue;if(h.has(s)||w.has(s))continue;const e=I(s);null!==e&&sn(t,s,e,i.modules)&&(w.add(s),L.push(`${s} no longer imports ${i.modules.join(", ")}, so "includeImporting" stops reading it, and ${x} reads it. Keep the import, or read the file with "include".`))}}const ee=[],te=new Set,se={};if(C){const e=F(C.exclude),n=F(C.include),i=F(C.output.flatMap(e=>e.files)),r=F(C.includeCopies),a=F(C.includeValues),c=C.includeImporting.map(e=>({files:F(e.files),modules:e.modules})),u=s=>{if(e(s))return!1;if(n(s)&&!i(s))return!0;const o=c.filter(e=>e.files(s));if(!o.length||!qt(s))return!1;const r=I(s);return null!==r&&o.some(e=>sn(t,s,r,e.modules))};for(const n of o.files){if(u(n))continue;const i=o.partial.get(n)??s.kinds,c=!e(n)&&qt(n)&&r(n),p=!e(n)&&a(n),f=i.filter(e=>!(c&&j(e)||p&&E(e)));if(!f.length)continue;ee.push(n);for(const e of f)te.add(e);if(!qt(n))continue;const h=I(n);if(null===h)continue;const m=Gt(t,n,h,f,void 0,l,d);for(const e of f){const t=Math.min(m[e]?.length??0,o.counts.get(`${n}:${e}`)??0);t>0&&(se[e]=(se[e]??0)+t)}}}const oe={},re=[];if(C){const e=new Set(ee);for(const n of o.files){if(e.has(n))continue;const i=(o.partial.get(n)??s.kinds).filter(e=>{if(!A.kinds.includes(e))return!1;const t=(A.counts.get(K(n,e))??0)+(U.get(K(n,e))??0);return(o.counts.get(K(n,e))??0)>t});if(!i.length)continue;const r=I(n);if(null===r)continue;const a=Kt(n)?Vt(r,i):Gt(t,n,r,i,void 0,l,d);let c=!1;for(const e of i){const t=(A.counts.get(K(n,e))??0)+(U.get(K(n,e))??0),i=Math.min(a[e]?.length??0,o.counts.get(K(n,e))??0)-t;i>0&&(oe[e]=(oe[e]??0)+i,c=!0)}c&&re.push(n)}}const ae=Q(A.counts),le=Q(n.counts),ce=Q(W),de=Q(U),ue=(e,t,n)=>(e[n]??0)+(t[n]??0);if(L.push(...s.kinds.filter(e=>A.kinds.includes(e)&&ue(le,ce,e)>ue(ae,de,e)+(se[e]??0)+(oe[e]??0)).map(e=>{const t=(ce[e]??0)||(de[e]??0),n=n=>t?` (and ${n[e]??0} in "allow")`:"";return`${Bn} holds ${le[e]??0} of "${e}"${n(ce)}, and ${x} holds ${ae[e]??0}${n(de)}${ee.length?` (and ${se[e]??0} in the files new to a scope)`:""}${re.length?` (and ${oe[e]??0} this checker counts in the base files and their baseline did not)`:""}. The baseline only goes down, and "allow" with it: use ${z[e].instead}. A count that must stay goes in "allow" in ${On}, with its reason, and the same count of that kind is burned down in this change.`})),C)for(const e of s.allow){const t=U.get(K(e.file,e.kind));void 0!==t&&e.count<=t||k.push(`"allow" in ${On} ${void 0===t?"adds":`raises from ${t}`} ${e.file} (${e.kind}) at ${e.count}: ${e.reason}`)}const pe=[`compared with ${x}`];return null===C&&pe.push(`${x}'s ${On} could not be read, so every line was compared and no scope was checked for shrinking`),ee.length&&pe.push(`${[...te].every(j)?'"includeCopies" changed: ':[...te].every(E)?'"includeValues" changed: ':""}${ee.length} file${1===ee.length?"":"s"} new to a scope, so ${1===ee.length?"its":"their"} ${s.kinds.filter(e=>te.has(e)).join(", ")} lines may hold what ${1===ee.length?"it":"they"} held on ${x}`),re.length&&pe.push(`${re.length} file${1===re.length?" holds":"s hold"} what this checker counts and the base branch's baseline did not (${re.join(", ")}: ${s.kinds.filter(e=>(oe[e]??0)>0).map(e=>`${e} ${oe[e]}`).join(", ")}), measured in the base files themselves`),{problems:L,note:pe.join("; "),warnings:k}}process.exitCode=function(e,t){const n=function(e){const t={print:!1,summary:!1,json:!1,update:!1,allowMove:!1,init:!1,noBase:!1,help:!1,version:!1,kinds:[],entries:[]};for(let n=0;n<e.length;n++){const i=e[n];if("--print"===i)t.print=!0;else if("--summary"===i)t.summary=!0;else if("--json"===i)t.json=!0;else if("--update"===i)t.update=!0;else if("--allow-move"===i)t.allowMove=!0;else if("--init"===i)t.init=!0;else if("--no-base"===i)t.noBase=!0;else{if("--base-lock"===i)continue;if("--help"===i||"-h"===i)t.help=!0;else if("--version"===i||"-v"===i)t.version=!0;else if("--kind"===i){const i=e[++n];if(!i)return"--kind needs a kind after it";t.kinds.push(...i.split(","))}else if(i.startsWith("--kind="))t.kinds.push(...i.slice(7).split(","));else{if("--write-index"!==i&&"--src"!==i&&"--entry"!==i)return`unknown argument "${i}"`;{const s=e[++n];if(!s||s.startsWith("--"))return`${i} needs a value after it`;if("--write-index"===i)t.writeIndex=s;else if("--src"===i)t.src=s;else{if(!/^\.[^=]*=.+$/.test(s))return"--entry takes <subpath>=<file>, as in --entry ./hooks=src/hooks/index.ts";t.entries.push(s)}}}}}return t.allowMove&&!t.update?"--allow-move goes with --update":t.kinds.length&&!t.init?"--kind goes with --init":!t.src&&!t.entries.length||t.writeIndex?t.writeIndex&&(t.print||t.summary||t.update||t.init||t.json||t.noBase)?"--write-index goes alone":[t.print,t.summary,t.update,t.init].filter(Boolean).length>1?"choose one of --print, --summary, --update and --init":t:"--src and --entry go with --write-index"}(e);if("string"==typeof n)return t.err(`${Fn}: ${n}\n\n${Pn}`),2;if(n.help)return t.out(Pn),0;if(n.version)return t.out(t.version),0;const s=e=>(n.json?t.out(JSON.stringify({tool:Fn,version:t.version,ok:!1,failures:[e]},null,2)):t.err(`${Fn}: ${e}`),1);if(n.writeIndex){const e=un(t.cwd,n.writeIndex,n.src??"src",n.entries,()=>t.loadTypeScript());return e.problems.length?s(`--write-index:\n - ${e.problems.join("\n - ")}`):(t.out(e.summary),0)}if(n.noBase&&t.env.GITHUB_BASE_REF)return s("--no-base is refused on a pull request (GITHUB_BASE_REF is set): the base-branch comparison is what stops a pull request lowering its own baseline.");const c=i(t.cwd,On);if(!r(c))return s(`no ${On} in ${t.cwd}. Run it from the repository root; the harness has the template.`);let d,u;try{d=ne(JSON.parse(a(c,"utf8")),On)}catch(e){return s(e instanceof X?e.message:`${On} is not valid JSON: ${e.message}`)}try{u=t.loadTypeScript()}catch{return s('this check reads the TypeScript AST and found no "typescript" package here. Install it as a devDependency.')}const p=Mn(u);if(p.length)return s(`the reader misread its own fixtures with typescript ${u.version}, so nothing it says about this repository can be trusted:\n - `+p.join("\n - "));let f,h;if(d.kinds.includes("shell-part-copy")){const e=e=>{try{return a(e,"utf8")}catch{return null}};f=function(e,t,n,i){const s=new Set,o=new Set;let r=!1;const a=t=>{if(o.has(t))return!0;const r=n(t);if(null===r)return!1;o.add(t);const{names:l,starFrom:c}=function(e,t,n){const i=e.createSourceFile(t,n,e.ScriptTarget.Latest,!1),s=[],o=[],r=t=>e.canHaveModifiers(t)&&(e.getModifiers(t)??[]).some(t=>t.kind===e.SyntaxKind.ExportKeyword);for(const t of i.statements)if(e.isExportDeclaration(t)){if(t.isTypeOnly)continue;const n=t.exportClause;if(n){if(e.isNamedExports(n))for(const e of n.elements)e.isTypeOnly||s.push(e.name.text)}else t.moduleSpecifier&&e.isStringLiteralLike(t.moduleSpecifier)&&o.push(t.moduleSpecifier.text)}else if((e.isFunctionDeclaration(t)||e.isClassDeclaration(t))&&t.name&&r(t))s.push(t.name.text);else if(e.isVariableStatement(t)&&r(t))for(const n of t.declarationList.declarations)e.isIdentifier(n.name)&&s.push(n.name.text);return{names:s,starFrom:o}}(e,t,r);for(const e of l)dn.test(e)&&s.add(e);for(const e of c){if(!e.startsWith("."))continue;const n=i(t,e);[n,`${n}.js`,`${n}.ts`,`${n}.tsx`,`${n}/index.js`,`${n}/index.ts`].some(e=>a(e))}return!0};for(const e of t)a(e)&&(r=!0);return r?s:null}(u,t.shellPartFiles??[],e,(e,t)=>i(o(e),t))??void 0}if(d.kinds.includes("copied-value")||d.kinds.includes("copied-routine")){const e=new Set;try{const n=JSON.parse(a(i(t.cwd,ie),"utf8")),s=["dependencies","peerDependencies","optionalDependencies"];!0===n.private&&s.push("devDependencies");for(const t of s)for(const i of Object.keys(n[t]??{}))e.add(i)}catch{}const n=[],o=e=>{try{n.push({text:a(e,"utf8"),path:e})}catch{}},l=e=>r(i(t.cwd,"node_modules",e,ie));for(const n of[...e].sort())if(l(n))for(const e of[se,oe])o(i(t.cwd,"node_modules",n,"dist",e));for(const e of t.copyIndexFiles??[]){let t;try{t=JSON.parse(a(e,"utf8")).package}catch{t=void 0}t&&l(t)||o(e)}const c=ge(n,e);if(c.problems.length)return s(c.problems.join("\n "));h=c.index}const m=function(e,t,n,s,o){const l=[],c=F(n.exclude),d=F(n.output.flatMap(e=>e.files)),u=new Map,p=e=>{let n=u.get(e);return void 0===n&&u.set(e,n=a(i(t,e),"utf8")),n},f=(e,n)=>{for(const i of e)0===J(t,[i]).length&&l.push(`${n}: "${i}" matches no file. Delete the line, or fix the path.`)};f(n.include,'"include"'),n.output.forEach((e,t)=>f(e.files,`"output"[${t}]`)),n.includeImporting.forEach((e,t)=>f(e.files,`"includeImporting"[${t}]`)),f(n.includeCopies,'"includeCopies"'),f(n.includeValues,'"includeValues"'),!n.kinds.includes("shell-part-copy")||s&&0!==s.size||l.push('"kinds" includes "shell-part-copy", and the shell\'s export list could not be read beside this command. Reinstall efficient-shell.');for(const e of["copied-value","copied-routine"])!n.kinds.includes(e)||o&&0!==o.packages.length||l.push(`"kinds" includes "${e}", and no package this repository declares ships a copy index (dist/value-index.json, dist/routine-index.json) that could be read. Upgrade the package, or take the kind out.`);const h=new Set,m=v(n.kinds),g=e=>(qt(e)||m&&Kt(e))&&!c(e)&&!d(e);for(const e of J(t,n.include))g(e)&&h.add(e);for(const i of n.includeImporting)for(const n of J(t,i.files))g(n)&&qt(n)&&!h.has(n)&&sn(e,n,p(n),i.modules)&&h.add(n);const x=n.kinds.filter(j),w=new Map,$=(e,t)=>w.set(e,n.kinds.filter(n=>t.includes(n)||(w.get(e)??[]).includes(n)));if(x.length)for(const e of J(t,n.includeCopies))!qt(e)||c(e)||h.has(e)||$(e,x);const b=n.kinds.filter(E);if(b.length){const e=v(b);for(const i of J(t,n.includeValues))!(qt(i)||e&&Kt(i))||c(i)||h.has(i)||$(i,b)}const k=new Set(w.keys()),S=[...h,...k].sort(),T=n.kinds.filter(e=>!y(e)),z=new Map,A=new Map,N=new Set,I=new Map;for(const t of S){const n=w.get(t),i=n??T,r=Kt(t)?Vt(p(t),i):Gt(e,t,p(t),i,n?void 0:N,s??void 0,o?{index:o,instead:(e,n,i)=>{const s=K(t,e);I.has(s)||I.set(s,new Map),I.get(s).set(n,i)}}:void 0);let a=!1;for(const e of i){const n=r[e]?.length??0;n&&(A.set(K(t,e),n),a=!0)}a&&z.set(t,r)}let C=[],D=[],R=[];const O=n.kinds.filter(y);if(O.length){const e=i(t,ie);if(r(e)){const t=JSON.parse(a(e,"utf8")),i=["dependencies","peerDependencies","optionalDependencies"].flatMap(e=>Object.keys(t[e]??{})),s=new Set([...N].flatMap(e=>L[e]??[])),o=[...new Set(i)].sort();if(n.kinds.includes("kit-dep")){const e=o.filter(e=>"kit-dep"===M(e));C=e.filter(e=>!s.has(e)),D=e.filter(e=>s.has(e)),C.length&&A.set(K(ie,"kit-dep"),C.length)}n.kinds.includes("chart-dep")&&(R=o.filter(e=>"chart-dep"===M(e)),R.length&&A.set(K(ie,"chart-dep"),R.length))}else for(const e of O)l.push(`"kinds" includes "${e}", and there is no ${ie} here to read.`)}for(const e of n.allow)(y(e.kind)?e.file===ie:h.has(e.file)||(w.get(e.file)??[]).includes(e.kind))||l.push(`"allow": ${e.file} (${e.kind}) is not a file this check reads. Delete the entry, or fix the path.`);return{files:S,copyOnly:[...k].sort(),partial:w,hits:z,counts:A,kitDeps:C,shellPeers:D,chartDeps:R,problems:l,instead:I}}(u,t.cwd,d,f,h);if(0===m.files.length)return s(`read no files. "include" in ${On} matches nothing, so a pass would mean nothing.`);const g=i(t.cwd,Bn),x=n.json,$=e=>{x||t.out(e)};if(n.print)return t.out(Z(ln(d,m,d.kinds)).trimEnd()),0;if(n.summary){for(const e of function(e,t){const n=new Map,i=new Map;for(const[e,s]of t.counts){const{file:t,kind:o}=H(e);if(!w(o))continue;const r=n.get(o)??{count:0,files:new Set};r.count+=s,r.files.add(t),n.set(o,r);const a=t.split("/"),l=a.length>2?a.slice(0,2).join("/"):2===a.length?a[0]:".",c=i.get(l)??{};c[o]=(c[o]??0)+s,i.set(l,c)}const s=e.kinds.filter(e=>n.has(e)),o=[`**UI kit check (harness UI-24):** ${new Set([...t.counts.keys()].map(e=>H(e).file)).size} of ${Wn(t.files.length,"file")} still draw UI of their own.`,"","| Kind | Count | Files | The shell has |","|---|---:|---:|---|",...e.kinds.map(e=>{const t=n.get(e);return`| \`${e}\` | ${t?.count??0} | ${t?.files.size??0} | ${z[e].instead} |`})];if(s.length&&i.size){const e=e=>s.reduce((t,n)=>t+(e[n]??0),0),t=[...i].sort((t,n)=>e(n[1])-e(t[1])||(t[0]<n[0]?-1:1));o.push("",`| Folder | ${s.map(e=>`\`${e}\``).join(" | ")} | Total |`,`|---|${s.map(()=>"---:").join("|")}|---:|`,...t.map(([t,n])=>`| \`${t}\` | ${s.map(e=>n[e]??0).join(" | ")} | ${e(n)} |`))}return o}(d,m))t.out(e);return 0}let b=null;if(r(g))try{b=Y(a(g,"utf8"),Bn)}catch(e){return s(e instanceof q?e.message:String(e))}if(n.init){const e=n.kinds.filter(e=>!w(e)||!d.kinds.includes(e));if(e.length)return s(`--kind ${e.join(", ")}: not in "kinds" in ${On}. Add it there first.`);const t=n.kinds;if(b){if(0===t.length)return s(`${Bn} already exists, and --init would overwrite what it holds. It is for the adoption pull request only. To start checking a kind, add it to "kinds" and run --init --kind <kind>.`);const e=t.filter(e=>b.kinds.includes(e));if(e.length)return s(`the baseline was already taken for ${e.join(", ")}. Its lines only go down; use --update.`);const n=ln(d,m,t);b={kinds:[...b.kinds,...t],counts:new Map([...b.counts,...n.counts])}}else{if(t.length)return s(`there is no ${Bn} yet. Run --init on its own first.`);b=ln(d,m,d.kinds)}l(g,Z(b)),$(`${Fn}: wrote ${Bn} (${Wn(b.counts.size,"line")}: ${Un(b.counts,b.kinds)})`)}if(!b)return s(`no ${Bn}. This repository has not adopted the check yet: run ${Fn} --init, and commit the file.`);if(n.update){const e=function(e,t,n,{allowMove:i=!1}={}){const s=rn(e,t),o=ln(e,n,s),r=new Map([...t.counts].filter(([e])=>s.includes(H(e).kind)));if(i){const e=Q(r),n=Q(o.counts),i=s.filter(t=>(n[t]??0)>(e[t]??0)).map(t=>`${t}: ${n[t]??0} across the repository, and the baseline holds ${e[t]??0}`);return i.length?{baseline:t,lowered:0,refused:i}:{baseline:o,lowered:cn(r,o.counts),refused:[]}}const a=new Map;for(const[e,t]of r){const n=Math.min(t,o.counts.get(e)??0);n>0&&a.set(e,n)}return{baseline:{kinds:s,counts:a},lowered:cn(r,a),refused:[]}}(d,b,m,{allowMove:n.allowMove});if(e.refused.length)return s(`--allow-move follows code that moved, and this is more of it than before:\n - ${e.refused.join("\n - ")}\nNothing was written.`);b=e.baseline,l(g,Z(b)),$(`${Fn}: ${e.lowered?`changed ${Wn(e.lowered,"line")} in`:"nothing to change in"} ${Bn}`)}const k=function(e,t,n){const i=[],s=[],o=[...n.problems],r=on(e),a=new Set(rn(e,t)),l=e.kinds.filter(e=>!t.kinds.includes(e));l.length&&o.push(`"kinds" names ${l.map(e=>`"${e}"`).join(", ")}, and the baseline was never taken for ${1===l.length?"it":"them"}. Run: efficient-shell-ui-check --init ${l.map(e=>`--kind ${e}`).join(" ")}`);const c=t.kinds.filter(t=>!e.kinds.includes(t));c.length&&s.push(`the baseline still carries ${c.map(e=>`"${e}"`).join(", ")}, which "kinds" no longer names`);const d=new Set([...n.counts.keys(),...t.counts.keys(),...r.keys()]);for(const e of[...d].sort(G)){const{file:l,kind:c}=H(e);if(!w(c)||!a.has(c))continue;const d=n.counts.get(e)??0,u=r.get(e)??0,p=t.counts.get(e)??0;d>u+p?i.push(`${l}: ${c} ${d}, and its line allows ${u+p}${an(n,l,c)}. ${z[c].counts} is counted; use ${z[c].instead}.`):d<u?o.push(`${l}: ${c} ${d}, and "allow" in ui-kit.config.json says ${u}. ${0===d?"Delete the entry":`Lower its count to ${d}`}: an exception does not outlive what it excused.`):d<u+p&&s.push(`${l}: ${c} ${d}, and its line says ${u+p}`)}return{grown:i,shrunk:s,other:o,updateFixes:0===i.length&&0===o.length&&s.length>0}}(d,b,m),S=n.noBase?{problems:[],note:"",warnings:[]}:Kn(t,u,b,d,m,f,h),T=d.kinds.filter(e=>b.kinds.includes(e)),A=`${Fn} --update`,N=[...k.other,...k.grown,...k.shrunk.map(e=>`${e}. Run: ${A}`),...S.problems],I=0===N.length;if(n.json){const e=on(d);return t.out(JSON.stringify({tool:Fn,version:t.version,ok:I,schema:d.schema,kinds:d.kinds,files:m.files.length,counts:Q(m.counts),baseline:Q(b.counts),allowed:Q(e),kitDeps:m.kitDeps,shellPeers:m.shellPeers,chartDeps:m.chartDeps,failures:N,warnings:S.warnings},null,2)),I?0:1}t.out(`UI kit check (harness UI-24), efficient-shell ${t.version}\n`);const C=(e,n,i="")=>{if(0===n.length)return t.out(` ok ${e}`);t.err(` FAIL ${e}`);for(const e of n)t.err(` ${e}`);i&&t.err(` ${i}`)};t.out(` ok the reader reads its own fixtures (typescript ${u.version})`),t.out(` ok read ${Wn(m.files.length,"file")}`),C(`${On} and ${Bn} describe this repository`,k.other),C("no file draws more of its own UI than its line allows",k.grown),C("every line is exact: a count that fell is a line to lower",k.shrunk,`Run: ${A}${k.updateFixes?"":" (after the failures above are fixed)"}`),S.note&&C(`the baseline is no higher than the base branch (${S.note})`,S.problems);for(const e of S.warnings)t.err(`::warning title=${Fn}::${e}`);const D=new Set([...m.counts.keys()].map(e=>H(e).file));return t.out(` ok PROGRESS: ${D.size} of ${Wn(m.files.length,"file")} still draw UI of their own: `+Un(m.counts,T)),t.out(""),I?t.out("UI kit check: ok"):t.err(`UI kit check: FAILED (${Wn(N.length,"problem")})`),I?0:1}(process.argv.slice(2),{cwd:process.cwd(),env:process.env,out:e=>console.log(e),err:e=>console.error(e),loadTypeScript:()=>h(import.meta.url),git:function(t){try{return e("git",t,{cwd:process.cwd(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:6e4,maxBuffer:67108864})}catch{return null}},gitDetail:function(t,n){try{return{out:e("git",t,{cwd:process.cwd(),encoding:"utf8",stdio:["ignore","pipe","pipe"],timeout:n,maxBuffer:67108864}),error:""}}catch(e){const t=e;if("ETIMEDOUT"===t.code||"SIGTERM"===t.signal)return{out:null,error:`timed out after ${Math.round(n/1e3)} s`};return{out:null,error:(String(t.stderr??"").trim().replace(/\s+/g," ")||t.message||"git failed").slice(-500)}}},sleep:function(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},shellPartFiles:["../index.js","../ui/index.js"].map(e=>t(new URL(e,import.meta.url))),copyIndexFiles:["../value-index.json","../routine-index.json"].map(e=>t(new URL(e,import.meta.url))),version:"16.4.1"});
2
+ import{execFileSync as e}from"child_process";import{fileURLToPath as t}from"url";import{createRequire as n}from"module";import{join as i,resolve as s,dirname as o}from"path";import{existsSync as r,readFileSync as a,writeFileSync as l,mkdirSync as c,statSync as d,lstatSync as u,readdirSync as p}from"fs";import{createHash as f}from"crypto";function h(e){return function(e,t){for(const s of[i(process.cwd(),"package.json"),t])try{return n(s)(e)}catch{}throw new Error(`${e} is not installed; add it to this repository's devDependencies`)}("typescript",e)}var m=[2,4,8,12,16,20,24,32,40,48];function g(e){if("0"===e||"px"===e)return!0;const t=Number(e);return!!Number.isFinite(t)&&m.includes(4*t)}var x=["button","input","range","textarea","select","dialog","title","portal","native","dark","hex","radius","spacing","font-size","z-index","shadow","kit","icon","svg","kit-dep","chart","chart-dep","ellipsis-label","colour","gutter-literal","view-line-literal","route-literal","root-zone-literal","phone-query","sizes-literal","money-cents","local-helper","deprecated-undated","dialog-frame","scaled-frame","own-text","own-badge","hand-motion","shell-part-copy","copied-value","copied-routine","option-read"],w=e=>"string"==typeof e&&x.includes(e),$=["kit-dep","chart-dep"],y=e=>$.includes(e),b=x.filter(e=>!y(e)),k=["colour","own-text","hand-motion"],v=e=>e.some(e=>k.includes(e)),S=["hex","colour","radius","spacing","font-size","shadow","hand-motion"],E=e=>S.includes(e),T=["gutter-literal","view-line-literal","route-literal","root-zone-literal","phone-query","sizes-literal","money-cents","local-helper","deprecated-undated","copied-value","copied-routine","option-read"],j=e=>T.includes(e),z={button:{counts:"a raw <button>",instead:"Button or IconButton from efficient-shell/ui"},input:{counts:"a raw <input> (not hidden, not a range)",instead:"Input, InputNumber, Checkbox, Radio or Switch from efficient-shell/ui"},range:{counts:'a raw <input type="range">',instead:"Slider from efficient-shell/ui"},textarea:{counts:"a raw <textarea>",instead:"Textarea from efficient-shell/ui"},select:{counts:"a raw <select>",instead:"Select or SearchableSelect from efficient-shell/ui"},dialog:{counts:'a raw <dialog>, or role="dialog" / role="alertdialog" on a raw element',instead:"Dialog or Modal from efficient-shell"},title:{counts:"a title= on a raw element (the browser's own tooltip)",instead:"Tooltip from efficient-shell/ui (harness UI-17)"},portal:{counts:"a createPortal(…) call (a layer the file floats itself)",instead:"Popover, PopupMenu, DropdownMenu, Tooltip or Dialog from efficient-shell/ui"},native:{counts:"window.confirm / alert / prompt, or a bare call that resolves to one",instead:"confirm, confirmDestructive, prompt or toast from efficient-shell (harness UI-20)"},dark:{counts:"a dark: variant in a class string",instead:"the light Tailwind class alone; the shell remaps it in dark mode (harness UI-7)"},hex:{counts:"a hex colour literal in a .tsx string",instead:"a colour role from efficient-shell: its utility or var(--role), COLOUR_ROLES lists them (harness FT-1; the colour kind counts palette classes too)"},radius:{counts:"a literal corner radius (an arbitrary-value radius class, or an inline borderRadius)",instead:"a radius utility from the scale or a role token such as rounded-(--radius-control); the theme sets how round they are (harness UI-7)"},spacing:{counts:"a padding, margin or gap off the scale (6px, 10px, 14px …) or written as a literal length (an arbitrary-value class, an inline style)",instead:"a step of the scale 2/4/8/12/16/20/24/32/40/48 — a Tailwind step, or a role such as var(--space-control-x) (owner ruling 2026-10-12)"},"font-size":{counts:"a literal font size (an arbitrary-value text class, an inline fontSize)",instead:"a type step 9/11/12/14/16/18/20/24/30 — Tailwind's 3xs … 3xl text steps (owner ruling 2026-10-12)"},"z-index":{counts:"a stack order above 30 written as a number (a z utility, an arbitrary value, an inline zIndex)",instead:"a named layer: Z_LAYERS (efficient-shell/ui) in code, its --z-* custom property in markup"},shadow:{counts:"a literal shadow, or a shadow size that is not an elevation level (md, 2xl, xs)",instead:"an elevation: the sm / lg / xl utilities, or var(--elevation-panel) and its siblings (owner ruling 2026-10-12)"},kit:{counts:"an import of a second UI kit",instead:"the component from efficient-shell/ui, or fold it into the shell (harness FT-3)"},icon:{counts:"an import of an icon package",instead:"<Icon name> from efficient-shell/icons, drawn by the one set (harness UI-24)"},svg:{counts:"an <svg> element written in JSX: an icon drawn in place",instead:"<Icon name> from efficient-shell/icons, drawn by the one set (harness UI-24). A chart, an illustration or a mark a host supplies stays on the baseline"},"kit-dep":{counts:"a UI kit or icon package declared in package.json (not one the shell entries imported here need)",instead:"remove the dependency once nothing imports it (harness FT-3)"},chart:{counts:"an import of a second chart library",instead:"a chart from efficient-shell/ui (ChartFrame, TimeSeriesChart, ColumnChart, RankedBars, PieChart, FunnelChart, ScatterChart, …), or add the chart there: one chart system (harness FT-3)"},"chart-dep":{counts:"a chart library declared in package.json",instead:"remove the dependency once nothing imports it (harness FT-3)"},"ellipsis-label":{counts:'a button, link or menu label that ends in "…" or "..."',instead:'the label without the dots, saying what it does ("Extend trial"): "…" means only "the words are cut" (owner ruling 2026-10-14)'},colour:{counts:"a literal colour, in a script string or a stylesheet: a hex, an rgb() / hsl() / oklch() value, a Tailwind palette class (a hue and a step, or white / black), a --color-<hue>-<step> variable, or a named colour in a colour property — a var() fallback included",instead:"a colour role from efficient-shell: its utility (the text, background or border utility of ink, ink-faint, surface, line, accent-fill, accent-text, danger-text, status-danger-line …) or var(--role); COLOUR_ROLES lists them. A merchant site reads the site theme (owner ruling 2026-10-23)"},"gutter-literal":{counts:"the site gutter typed with its own fallback, var(--sf-site-gutter, 40px), in script source (stylesheets are not read)",instead:"SITE_GUTTER_CLASS from efficient-web-builder (lib/content/page-width): the whole class, because Tailwind reads only whole literals; SITE_GUTTER_CAP for the number"},"view-line-literal":{counts:"the 960px written as a length in script source (a max-/min- variant, a media query; a sizes string counts here too)",instead:"the view-lines table in efficient-web-builder (lib/content/view-lines, lib/content/box-stack-line)"},"route-literal":{counts:"a page path typed by hand before a slug: /wheels/, /journal/, /tyres/",instead:"pagePath, postPath or wheelPath from efficient-web-builder (lib/links/page-link-rules), tyrePagePath from efficient-storefront-blocks (render/lib/tyres/tyre-page-path)"},"root-zone-literal":{counts:'the easel root zone key typed as a string ("root:default-zone")',instead:"ROOT_ZONE from efficient-easel (screen/lib/document/content-tree)"},"phone-query":{counts:"the app phone line typed as a media query in script source: (max-width: 767px)",instead:"useIsMobile from efficient-shell: ask the hook, do not write the query"},"sizes-literal":{counts:"a hand-written responsive sizes string (a sizes attribute or sizes: entry with a media condition)",instead:"a named sizes shape from efficient-web-builder (lib/sized-image), built from the view lines"},"money-cents":{counts:"a money amount (amount, price, total, cents, fee, cost, balance) multiplied or divided by 100 by hand",instead:"createMoneyFormatter / useCurrency from efficient-storefront-blocks (render/components/CurrencyContext) for a shopper; formatMoney / currencyDecimals from efficient-shell for the ERP"},"local-helper":{counts:"a local definition (function or const) of a helper a package exports, by name: escapeHtml, deepEqual, timeAgo, formatBytes, hexToRgb and the rest of LOCAL_HELPERS",instead:"import the helper from its home (LOCAL_HELPERS in efficient-shell src/ui-check/kinds.ts names each one)"},"dialog-frame":{counts:"a className on a shell Dialog, PopupForm or ConfirmDialog that redraws its frame: a zero padding, no width or height cap, or a screen-sized or calc() width or height",instead:'a Dialog size: size="full" for a chooser laid out like a window (head bar, body that fills and scrolls), with headerActions for buttons beside the cross'},"scaled-frame":{counts:"a drawing scaled from the top left by hand: a top-left transform origin as a style key or a DOM write (transformOrigin = top left, left top, 0 0, 0% 0%, 0px 0px), in CSS text inside a string, or as the Tailwind origin class for the top left (named or an arbitrary zero)",instead:"FitFrame (a preview drawn at a logical size), or fitScale / fitBoxScale / fitFrameStyle, from efficient-shell/ui: the one home of the fit (harness ARCH-3)"},"own-text":{counts:"text drawn with its own type: a raw <h1>…<h6>; a raw <p> or <span> with a type class (a text size step or an arbitrary size, a font weight) or an inline fontSize / fontWeight; in a stylesheet, a rule that sets its own font-size or font",instead:"Title (headings, with as=), Paragraph or Text from efficient-shell/ui: the shell owns the type of every text an operator reads (re-check 2026-11-19)"},"own-badge":{counts:"a pill drawn by hand: a raw element whose classes give it a rounded corner, a background colour, a text colour and its own side padding",instead:"ColoredBadge (a tone: success, warning, danger, info, neutral) or StatusBadge from efficient-shell/ui"},"hand-motion":{counts:"a typed time, weight or length where the shell has a token: a time in a transition or animation, a numeric font-weight, a literal border width, a literal padding, margin or gap in a stylesheet, a custom property set to one literal length or time, or the same as a duration / delay / arbitrary weight class or an inline style",instead:`the shell token: ${Object.keys({fast:120,base:160}).map(e=>`--motion-${e}`).join(", ")}; ${Object.keys({body:400,control:500,heading:600,figure:700}).map(e=>`--weight-${e}`).join(", ")}; ${Object.keys({hairline:1,strong:2,accent:4}).map(e=>`--border-${e}`).join(", ")}; --space-<step> (${m.join("/")}) and the --row-height-* / --control-height-* ladder (re-check 2026-11-19)`},"shell-part-copy":{counts:"a component defined here (a function, a class, or a const set to a function, forwardRef() or memo()) under the name of a component efficient-shell exports: the names are read from the installed shell's own export list, so a new shell part is covered by the next shell release",instead:"import the part from efficient-shell (or efficient-shell/ui) and delete the copy; a part the shell lacks gets its own name, or goes into the shell"},"deprecated-undated":{counts:'a @deprecated note (a block comment, or a run of whole-line comments) that does not say "delete by YYYY-MM-DD" with a real day from today to 6 months out, or that still says "next major"',instead:'write the day the thing goes ("Delete by 2026-12-15, after <the move>") and a backlog line that owns the move; on that day delete it, or set a new day with the reason'},"copied-value":{counts:"a top-level const whose literal value (a slug or key of 8 or more characters, an array of 3 or more items with a long one, an object of 3 or more keys) is the same as a const that a package the repository declares exports (its copy index)",instead:"the export named after each line, imported from its package"},"copied-routine":{counts:"a function that reads no module state of its own file and whose body (25 or more syntax nodes, local names and types aside) is the same as a function that a package the repository declares exports (its copy index)",instead:"the export named after each line, imported from its package"},"option-read":{counts:"a stored option read by a conditional typed by hand: a test of a value against one option, an || chain of options or a list (includes / has), that answers the same value, else a default (the closed list is in ui-check/optionRead.ts)",instead:"parseOption(options, fallback, value) from efficient-shell/format; a conditional that is not an option read with a default is an allow entry with its reason"}},A={escapeHtml:"efficient-shell (utils/escapeHtml)",deepEqual:"efficient-easel (data)",draftsEqual:"efficient-easel deepEqual (data)",timeAgo:"efficient-shell (format)",formatBytes:"efficient-shell (format)",formatFileSize:"efficient-shell formatBytes (format)",fileSize:"efficient-shell formatBytes (format)",humanSize:"efficient-shell formatBytes (format)",hexToRgb:"efficient-shell (forms/color)",parseHex:"efficient-shell parseHexColor (forms/color)",parseHexColor:"efficient-shell (forms/color)",parseOption:"efficient-shell (format)",hexOf:"efficient-shell parseHexColor (forms/color)",withAlpha:"efficient-shell hexWithAlpha (forms/colorMix)",isDarkInk:"efficient-shell readableInk (forms/color)",relativeLuminance:"efficient-shell (forms/color)",contrastRatio:"efficient-shell (forms/color)"},N=["@headlessui/","@radix-ui/","@mui/","@chakra-ui/","@mantine/","@floating-ui/","antd","react-aria","react-aria-","react-bootstrap","react-select","react-colorful","react-tooltip","react-hot-toast","react-toastify","sonner","efficient-shell-checker"],I=["@heroicons/","@tabler/icons","@tabler/icons-","@phosphor-icons/","@fortawesome/","@iconify/","@radix-ui/react-icons","@mui/icons-material","lucide","lucide-react","simple-icons","react-icons","react-feather"],C=["recharts","chart.js","react-chartjs-2","d3","d3-","@nivo/","victory","victory-","echarts","echarts-for-react","apexcharts","react-apexcharts","@visx/","highcharts","highcharts-react-official","plotly.js","plotly.js-dist","react-plotly.js","lightweight-charts","@antv/g2","@antv/g2plot","chartist","billboard.js","c3","uplot"],L={"efficient-shell":["@headlessui/react"]};function D(e,t){return t.some(t=>t.endsWith("/")||t.endsWith("-")?e.startsWith(t):e===t||e.startsWith(`${t}/`))}function R(e){return D(e,I)?"icon":D(e,N)?"kit":D(e,C)?"chart":null}function M(e){const t=R(e);return"kit"===t||"icon"===t?"kit-dep":"chart"===t?"chart-dep":null}var O=/[.+^$()|[\]\\]/g;function B(e){let t="",n=0;for(let i=0;i<e.length;i++){const s=e[i];"*"===s?"*"===e[i+1]?"/"===e[i+2]?(t+="(?:[^/]+/)*",i+=2):(t+=".*",i+=1):t+="[^/]*":"?"===s?t+="[^/]":"{"===s?(t+="(?:",n+=1):"}"===s&&n>0?(t+=")",n-=1):t+=","===s&&n>0?"|":s.replace(O,"\\$&")}if(0!==n)throw new Error(`unbalanced { in glob "${e}"`);return new RegExp(`^${t}$`)}function F(e){const t=e.map(B);return e=>t.some(t=>t.test(e))}var P=new Set(["node_modules",".git"]),W=new Set(["dist","coverage",".next",".turbo"]);function U(e){const t=e.search(/[*?{]/),n=-1===t?e:e.slice(0,t),i=n.lastIndexOf("/");return-1===i?"":n.slice(0,i)}function J(e,t){const n=F(t),s=[...new Set(t.map(U))].sort(),o=s.filter(e=>!s.some(t=>t!==e&&(""===t||e.startsWith(`${t}/`)))),r=new Set,a=t=>{let s;try{s=p(i(e,t),{withFileTypes:!0})}catch{return}for(const e of s){const i=t?`${t}/${e.name}`:e.name;e.isDirectory()?P.has(e.name)||""===t&&W.has(e.name)||a(i):e.isFile()&&n(i)&&r.add(i)}};for(const e of o)a(e);return[...r].sort(_)}var _=(e,t)=>e<t?-1:e>t?1:0,q=class extends Error{},K=(e,t)=>`${e}:${t}`;function H(e){const t=e.lastIndexOf(":");return{file:e.slice(0,t),kind:e.slice(t+1)}}var V=e=>x.indexOf(e);function G(e,t){const n=H(e),i=H(t);return _(n.file,i.file)||V(n.kind)-V(i.kind)}function Y(e,t="ui-kit.baseline.json"){let n;try{n=JSON.parse(e)}catch(e){throw new q(`${t} is not valid JSON: ${e.message}`)}const i=e=>{throw new q(`${t}: ${e}. The tool writes this file; do not edit it by hand.`)};if("object"!=typeof n||null===n||Array.isArray(n))return i("must be a JSON object");const s=n;if(1!==s.schema)return i("number"==typeof s.schema&&s.schema>1?`"schema": ${s.schema} is newer than this efficient-shell reads (1); upgrade efficient-shell`:'"schema" must be 1');if(!Array.isArray(s.kinds)||s.kinds.some(e=>"string"!=typeof e))return i('"kinds" must be a list');const o=s.kinds.filter(w);if("object"!=typeof s.counts||null===s.counts||Array.isArray(s.counts))return i('"counts" must be an object');const r=new Map;for(const[e,t]of Object.entries(s.counts)){const{file:n,kind:s}=H(e);if(!n||!s)return i(`"${e}" is not "<file>:<kind>"`);if("number"!=typeof t||!Number.isInteger(t)||t<1)return i(`"${e}" must be a whole number, 1 or more (a line that reaches 0 is deleted)`);w(s)&&r.set(e,t)}return{kinds:o,counts:r}}function Z(e){const t=x.filter(t=>e.kinds.includes(t)),n=[...e.counts.keys()].filter(t=>(e.counts.get(t)??0)>0).sort(G).map(t=>` ${JSON.stringify(t)}: ${e.counts.get(t)}`);return["{",' "schema": 1,',` "kinds": [${t.map(e=>JSON.stringify(e)).join(", ")}],`,n.length?` "counts": {\n${n.join(",\n")}\n }`:' "counts": {}',"}",""].join("\n")}function Q(e){const t={};for(const[n,i]of e){const{kind:e}=H(n);w(e)&&(t[e]=(t[e]??0)+i)}return t}var X=class extends Error{},ee=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),te=new Set(["$schema","schema","kinds","include","exclude","includeImporting","output","includeCopies","includeValues","allow"]);function ne(e,t="ui-kit.config.json"){const n=[],i=e=>{n.push(e)},s=(e,t,{required:n=!1}={})=>{if(void 0===e&&!n)return[];if(!Array.isArray(e)||e.some(e=>"string"!=typeof e||""===e))return i(`${t} must be a list of non-empty strings`),[];n&&0===e.length&&i(`${t} must name at least one entry`);for(const n of e)(n.startsWith("/")||n.startsWith("./")||n.includes("\\")||n.split("/").includes(".."))&&i(`${t}: "${n}" must be a path from the repository root, written with / (no ./, .. or \\)`);return e},o=(e,t)=>"string"!=typeof e||e.trim().length<10?(i(`${t} needs a "reason" a reviewer can read (a sentence, not a word)`),""):e,r=(e,t)=>void 0===e?[]:!Array.isArray(e)||e.some(e=>!ee(e))?(i(`${t} must be a list of objects`),[]):e;if(!ee(e))throw new X(`${t}: must be a JSON object`);for(const t of Object.keys(e))te.has(t)||i(`unknown key "${t}"`);1!==e.schema&&i("number"==typeof e.schema&&e.schema>1?`"schema": ${e.schema} is newer than this efficient-shell reads (1); upgrade efficient-shell`:'"schema" must be 1');const a=[];if(Array.isArray(e.kinds)&&0!==e.kinds.length)for(const t of e.kinds)w(t)?a.includes(t)?i(`"kinds": "${t}" is listed twice`):a.push(t):i(`"kinds": unknown kind ${JSON.stringify(t)} (this efficient-shell knows: ${x.join(", ")})`);else i(`"kinds" must list the kinds this repository checks, from: ${x.join(", ")}`);const l=s(e.include,'"include"'),c=s(e.exclude,'"exclude"'),d=r(e.includeImporting,'"includeImporting"').map((e,t)=>({files:s(e.files,`"includeImporting"[${t}].files`,{required:!0}),modules:s(e.modules,`"includeImporting"[${t}].modules`,{required:!0}),reason:o(e.reason,`"includeImporting"[${t}]`)}));0===l.length&&0===d.length&&i('"include" must name the files that are operator UI (for example ["src/**/*.tsx"])');const u=r(e.output,'"output"').map((e,t)=>({files:s(e.files,`"output"[${t}].files`,{required:!0}),reason:o(e.reason,`"output"[${t}]`)})),p=s(e.includeCopies,'"includeCopies"');p.length&&!a.some(j)&&i(`"includeCopies" is read only by the copied-value kinds (${T.join(", ")}), and "kinds" names none of them`);const f=s(e.includeValues,'"includeValues"');f.length&&!a.some(E)&&i(`"includeValues" is read only by the design-value kinds (${S.join(", ")}), and "kinds" names none of them`);const h=[],m=new Set;if(r(e.allow,'"allow"').forEach((e,t)=>{const n=`"allow"[${t}]`,[r]=s([e.file],`${n}.file`),l=o(e.reason,n);if(!w(e.kind))return void i(`${n}.kind must be one of: ${x.join(", ")}`);if(a.includes(e.kind)||i(`${n}: kind "${e.kind}" is not in "kinds"`),"number"!=typeof e.count||!Number.isInteger(e.count)||e.count<1)return void i(`${n}.count must be a whole number, 1 or more`);if(!r)return;const c=`${r}:${e.kind}`;m.has(c)&&i(`${n}: ${r} already has an allow entry for "${e.kind}"`),m.add(c),h.push({file:r,kind:e.kind,count:e.count,reason:l})}),n.length)throw new X(`${t}:\n - ${n.join("\n - ")}`);return{schema:1,kinds:x.filter(e=>a.includes(e)),include:l,exclude:c,includeImporting:d,output:u,includeCopies:p,includeValues:f,allow:h}}var ie="package.json",se="value-index.json",oe="routine-index.json",re=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,ae=e=>f("sha256").update(e).digest("hex").slice(0,20);function le(e,t){if(t){if(e.isAsExpression(t)||e.isSatisfiesExpression(t)||e.isParenthesizedExpression(t)||e.isTypeAssertionExpression(t))return le(e,t.expression);if(e.isStringLiteral(t)||e.isNoSubstitutionTemplateLiteral(t))return t.text;if(e.isNumericLiteral(t))return Number(t.text);if(e.isPrefixUnaryExpression(t)&&t.operator===e.SyntaxKind.MinusToken&&e.isNumericLiteral(t.operand))return-Number(t.operand.text);if(t.kind===e.SyntaxKind.TrueKeyword)return!0;if(t.kind===e.SyntaxKind.FalseKeyword)return!1;if(t.kind===e.SyntaxKind.NullKeyword)return null;if(e.isArrayLiteralExpression(t)){const n=[];for(const i of t.elements){const t=le(e,i);if(void 0===t)return;n.push(t)}return n}if(e.isObjectLiteralExpression(t)){const n={};for(const i of t.properties){if(!e.isPropertyAssignment(i))return;const t=e.isIdentifier(i.name)||e.isStringLiteral(i.name)||e.isNumericLiteral(i.name)?i.name.text:void 0,s=le(e,i.initializer);if(void 0===t||void 0===s)return;n[t]=s}return n}}}function ce(e,t){const n=le(e,t);return void 0!==n&&function(e){return"string"==typeof e?e.length>=8&&/[^A-Za-z]/.test(e)&&!re.test(e):Array.isArray(e)?e.length>=3&&e.some(e=>"string"==typeof e?e.length>=8:null!==e&&"object"==typeof e):null!==e&&"object"==typeof e&&Object.keys(e).length>=3}(n)?ae(`value:${(e=>JSON.stringify(e,(e,t)=>t&&"object"==typeof t&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).sort(([e],[t])=>e<t?-1:e>t?1:0)):t))(n)}`):null}var de=new WeakMap;function ue(e,t){let n=de.get(e);if(!n){n=new Map;for(const[t,i]of Object.entries(e.SyntaxKind)){if("number"!=typeof i)continue;const e=n.get(i);(void 0===e||/^(First|Last)[A-Z]/.test(e)&&!/^(First|Last)[A-Z]/.test(t))&&n.set(i,t)}de.set(e,n)}return n.get(t)??String(t)}var pe=(e,t)=>(e.isFunctionDeclaration(t)||e.isFunctionExpression(t)||e.isArrowFunction(t)||e.isMethodDeclaration(t))&&void 0!==t.body;function fe(e,t){const n=new Map,i=e=>{n.has(e)||n.set(e,`$${n.size}`)},s=n=>{(e.isParameter(n)||e.isVariableDeclaration(n)||e.isBindingElement(n))&&e.isIdentifier(n.name)&&i(n.name.text),(e.isFunctionDeclaration(n)||e.isFunctionExpression(n))&&n.name&&n!==t&&i(n.name.text),e.forEachChild(n,s)};s(t);let o=0;const r=[],a=t=>{((e,t)=>e.isTypeNode(t)||e.isTypeParameterDeclaration(t)||e.isInterfaceDeclaration(t)||e.isTypeAliasDeclaration(t))(e,t)||(e.isAsExpression(t)||e.isNonNullExpression(t)||e.isSatisfiesExpression(t)||e.isParenthesizedExpression(t)||e.isTypeAssertionExpression(t)?a(t.expression):(o+=1,e.isShorthandPropertyAssignment(t)?r.push(`{.${t.name.text}=${n.get(t.name.text)??t.name.text}}`):e.isIdentifier(t)&&e.isBindingElement(t.parent)&&e.isObjectBindingPattern(t.parent.parent)&&t.parent.name===t&&!t.parent.propertyName?r.push(`{.${t.text}=${n.get(t.text)??t.text}}`):e.isIdentifier(t)||e.isPrivateIdentifier(t)?r.push(function(e,t){const n=t.parent;return!!n&&((e.isPropertyAccessExpression(n)||e.isPropertyAssignment(n)||e.isMethodDeclaration(n)||e.isPropertyDeclaration(n)||e.isGetAccessorDeclaration(n)||e.isSetAccessorDeclaration(n)||e.isEnumMember(n)||e.isJsxAttribute(n))&&n.name===t||e.isBindingElement(n)&&n.propertyName===t||e.isQualifiedName(n)&&n.right===t)}(e,t)?`.${t.text}`:n.get(t.text)??t.text):e.isLiteralExpression(t)||e.isTemplateHead(t)||e.isTemplateMiddle(t)||e.isTemplateTail(t)||e.isJsxText(t)?r.push(`${ue(e,t.kind)}:${JSON.stringify(t.text)}`):(r.push(`(${ue(e,t.kind)}`),e.forEachChild(t,a),r.push(")"))))};for(const e of t.parameters)a(e);return t.body&&a(t.body),{hash:ae(`routine:${r.join(" ")}`),nodes:o}}function he(e,t,n){const i=new Set;for(const t of n.statements){if(!e.isVariableStatement(t))continue;const n=t.declarationList,s=(n.flags&(e.NodeFlags.Let|e.NodeFlags.Const))!==e.NodeFlags.Const;for(const t of n.declarations){if(!e.isIdentifier(t.name))continue;let n=t.initializer;for(;n&&(e.isAsExpression(n)||e.isSatisfiesExpression(n)||e.isParenthesizedExpression(n));)n=n.expression;(s||n&&(e.isNewExpression(n)||e.isCallExpression(n)))&&i.add(t.name.text)}}if(0===i.size)return!1;const s=function(e,t){const n=new Set,i=s=>{(e.isParameter(s)||e.isVariableDeclaration(s)||e.isBindingElement(s))&&e.isIdentifier(s.name)&&n.add(s.name.text),(e.isFunctionDeclaration(s)||e.isFunctionExpression(s)||e.isClassDeclaration(s))&&s.name&&s!==t&&n.add(s.name.text),e.forEachChild(s,i)};return i(t),n}(e,t);let o=!1;const r=t=>{if(!o){if(e.isIdentifier(t)&&i.has(t.text)&&!s.has(t.text)){const n=t.parent;return void(e.isPropertyAccessExpression(n)&&n.name===t||e.isPropertyAssignment(n)&&n.name===t||(o=!0))}e.forEachChild(t,r)}};for(const e of t.parameters)r(e);return t.body&&r(t.body),o}var me=e=>[...new Set(e.map(e=>`\`${e.name}\` from ${e.entry}`))].slice(0,3).join(" or ");function ge(e,t){const n={values:new Map,routines:new Map,packages:[]},i=[],s=new Set;for(const{text:o,path:r}of e){let e;try{e=JSON.parse(o)}catch{i.push(`${r} is not valid JSON. Reinstall the package that ships it.`);continue}if(1!==e.schema||"string"!=typeof e.package||!Array.isArray(e.entries)){i.push(`${r} is not a copy index this check reads (schema 1). Upgrade efficient-shell.`);continue}const a=r.endsWith(oe)?"routines":"values",l=`${e.package}:${a}`;if(s.has(l))continue;if(s.add(l),n.packages.includes(e.package)||n.packages.push(e.package),!t.has(e.package))continue;const c=n[a];for(const t of e.entries){const e=c.get(t.hash);e?e.push(t):c.set(t.hash,[t])}}return{index:n,problems:i}}function xe(e,t,n,i){const s=new Map,o=t=>{if(!s.has(t)){const i=n(t);s.set(t,null===i?null:e.createSourceFile(t,i,e.ScriptTarget.Latest,!0,/\.[jt]sx$/.test(t)?e.ScriptKind.TSX:e.ScriptKind.TS))}return s.get(t)??null},r=t=>e.canHaveModifiers(t)&&(e.getModifiers(t)??[]).some(t=>t.kind===e.SyntaxKind.ExportKeyword),a=(t,n,s)=>{const r=o(t);if(!r||s>40)return null;for(const o of r.statements){if(e.isFunctionDeclaration(o)&&o.name?.text===n&&o.body)return{node:o,file:r};if(e.isVariableStatement(o))for(const t of o.declarationList.declarations)if(e.isIdentifier(t.name)&&t.name.text===n)return{node:t,file:r};if(e.isImportDeclaration(o)&&e.isStringLiteral(o.moduleSpecifier)&&o.importClause&&!o.importClause.isTypeOnly){const r=o.importClause.namedBindings;if(r&&e.isNamedImports(r))for(const e of r.elements){if(e.name.text!==n||e.isTypeOnly)continue;const r=i(t,o.moduleSpecifier.text);return r?l(r,(e.propertyName??e.name).text,s+1):null}}}return null},l=(t,n,s)=>{const c=o(t);if(!c||s>40)return null;const d=[];for(const o of c.statements)if(e.isExportDeclaration(o)){if(o.isTypeOnly)continue;const r=o.moduleSpecifier&&e.isStringLiteral(o.moduleSpecifier)?o.moduleSpecifier.text:void 0;if(!o.exportClause){r&&d.push(r);continue}if(!e.isNamedExports(o.exportClause))continue;for(const e of o.exportClause.elements){if(e.name.text!==n||e.isTypeOnly)continue;const o=(e.propertyName??e.name).text;if(!r)return a(t,o,s+1);const c=i(t,r);return c?l(c,o,s+1):null}}else if(r(o)){if(e.isFunctionDeclaration(o)&&o.name?.text===n&&o.body)return{node:o,file:c};if(e.isVariableStatement(o))for(const t of o.declarationList.declarations)if(e.isIdentifier(t.name)&&t.name.text===n)return{node:t,file:c}}for(const e of d){const o=i(t,e),r=o?l(o,n,s+1):null;if(r)return r}return null},c=(t,n)=>{if(n.has(t))return[];n.add(t);const s=o(t);if(!s)return[];const a=[];for(const o of s.statements)if(e.isExportDeclaration(o)){if(o.isTypeOnly)continue;if(o.exportClause){if(e.isNamedExports(o.exportClause))for(const e of o.exportClause.elements)e.isTypeOnly||a.push(e.name.text)}else{const s=o.moduleSpecifier&&e.isStringLiteral(o.moduleSpecifier)?o.moduleSpecifier.text:void 0,r=s?i(t,s):null;r&&a.push(...c(r,n).filter(e=>"default"!==e))}}else if(r(o)&&(e.isFunctionDeclaration(o)&&o.name&&a.push(o.name.text),e.isVariableStatement(o)))for(const t of o.declarationList.declarations)e.isIdentifier(t.name)&&a.push(t.name.text);return a},d=[],u=[],p=[],f=new Set;for(const{entry:n,file:i}of t)if(o(i))for(const t of[...new Set(c(i,new Set))].sort()){const s=l(i,t,0);if(!s)continue;const{node:o}=s;let r,a=null;if(e.isFunctionDeclaration(o))r=o;else if(e.isVariableDeclaration(o)){let t=o.initializer;for(;t&&(e.isAsExpression(t)||e.isSatisfiesExpression(t)||e.isParenthesizedExpression(t));)t=t.expression;t&&pe(e,t)?r=t:0!==(o.parent.flags&e.NodeFlags.Const)&&(a=ce(e,o.initializer))}const c=`${s.file.fileName}:${o.pos}`;if(!f.has(c))if(f.add(c),r){const i=fe(e,r);i.nodes>=25&&u.push({entry:n,name:t,hash:i.hash,nodes:i.nodes})}else a&&d.push({entry:n,name:t,hash:a})}else p.push(`${n}: its source ${i} could not be read.`);return{values:d,routines:u,problems:p}}function we(e,t){const n=t=>{let n=t;for(;e.isParenthesizedExpression(n)||e.isAsExpression(n)||e.isSatisfiesExpression(n)||e.isTypeAssertionExpression(n)||e.isNonNullExpression(n);)n=n.expression;return n},i=t=>{const i=n(t);return e.isStringLiteral(i)||e.isNoSubstitutionTemplateLiteral(i)?i.text:void 0},s=(e,i)=>n(e).getText(t).replace(/\s+/g,"")===n(i).getText(t).replace(/\s+/g,""),o=t=>t===e.SyntaxKind.EqualsEqualsEqualsToken||t===e.SyntaxKind.EqualsEqualsToken,r=t=>t===e.SyntaxKind.ExclamationEqualsEqualsToken||t===e.SyntaxKind.ExclamationEqualsToken,a=(t,s)=>{const a=n(t);if(e.isBinaryExpression(a)&&(s?o:r)(a.operatorToken.kind))for(const[e,t]of[[a.right,a.left],[a.left,a.right]]){const n=i(e);if(void 0!==n&&void 0===i(t))return{value:t,text:n}}},l=(e,t)=>i(e)===t.text||s(e,t.value),c=(t,i)=>{const o=n(t);if(!e.isCallExpression(o)||1!==o.arguments.length)return!1;const r=o.expression;return e.isPropertyAccessExpression(r)&&("includes"===r.name.text||"has"===r.name.text)&&s(i,o.arguments[0])},d=t=>{const i=n(t);return e.isBinaryExpression(i)&&i.operatorToken.kind===e.SyntaxKind.BarBarToken?[...d(i.left),...d(i.right)]:[i]},u=[],p=i=>{e.isConditionalExpression(i)&&(t=>{const i=n(t.condition),o=a(i,!0);if(o&&l(t.whenTrue,o))return!0;const r=a(i,!1);if(r&&l(t.whenFalse,r))return!0;if(e.isPrefixUnaryExpression(i)&&i.operator===e.SyntaxKind.ExclamationToken){const e=a(i.operand,!0);if(e&&l(t.whenFalse,e))return!0;if(c(i.operand,t.whenFalse))return!0}if(c(i,t.whenTrue))return!0;const u=d(i);if(u.length>1){const e=u.map(e=>a(e,!0));if(e.every(e=>void 0!==e)&&e.every(t=>s(t.value,e[0].value))&&s(t.whenTrue,e[0].value))return!0}return!1})(i)?u.push(i.getStart(t)):e.forEachChild(i,p)};return p(t),u}var $e=e=>String(e).padStart(2,"0"),ye=/^(\d{4})-(\d{2})-(\d{2})$/;function be(e){return`${function(e){return`${e.getFullYear()}-${$e(e.getMonth()+1)}`}(e)}-${$e(e.getDate())}`}function ke(e){const t="string"==typeof e?ye.exec(e):null;if(!t)return null;const n=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return be(n)===e?n:null}var ve=new Set(["iframe","frame","object","embed"]),Se=new Set(["href","xlinkHref","to","id","key","htmlFor"]),Ee=/(?<![&\w])(?<!url\()#(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{6}|[0-9a-fA-F]{3,4})(?![\w-])/g,Te=/(?<![\w-])rounded(?:-(?:[trblse]|tl|tr|br|bl|ss|se|ee|es))?-\[([^\]]*)\]/g,je=/^border(?:(?:Top|Bottom)(?:Left|Right)|(?:Start|End)(?:Start|End))?Radius$/,ze=/^(?:inherit|initial|unset|revert)$|var\(|^(?:50|100)%$|^(?:999|9999)(?:px)?$/,Ae=/(?<![\w-])-?(?:p|px|py|pt|pr|pb|pl|ps|pe|m|mx|my|mt|mr|mb|ml|ms|me|gap|gap-x|gap-y|space-x|space-y)-(\d+(?:\.\d+)?|px|\[[^\]]*\])(?![\w.[/-])/g,Ne=/(?<![\w-])text-\[(?:length:)?(\d*\.?\d+(?:px|rem|em|%))\]/g,Ie=/(?<![\w-])z-(\d+|\[[^\]]*\])(?![\w.[/-])/g,Ce=/(?<![\w-])shadow-(xs|2xs|md|2xl|\[[^\]]*\])(?![\w.[/-])/g,Le=/var\(|^(?:inherit|initial|unset|revert|revert-layer|none|auto)$/,De=/^(?:(?:padding|margin)(?:Top|Right|Bottom|Left|Inline|Block|InlineStart|InlineEnd|BlockStart|BlockEnd)?|gap|rowGap|columnGap)$/,Re=new Set([0,...m]),Me=/var\(\s*--sf-site-gutter\s*,\s*-?\d/g,Oe=/(?<![\w.-])960px(?![\w-])/g,Be=/(?:^|[^\w-])\/(?:wheels|journal|tyres)\/$/,Fe=/root:default-zone/g,Pe="top left|left top|0 0|0% 0%|0px 0px",We=new RegExp(`^\\s*(?:${Pe})\\s*$`),Ue=(...e)=>["origin",...e].join("-"),Je=new RegExp([`(?:transformOrigin|transform-origin)\\s*[:=]\\s*["'\`]?\\s*(?:${Pe})(?![\\w%-])`,`(?<![\\w-])!?${Ue("top","left")}(?![\\w-])`,`(?<![\\w-])!?${Ue("\\[0_0\\]")}`].join("|")),_e=/max-width:\s*767px(?![\w-])/g,qe=/\((?:max|min)-width/,Ke=/(?:^|[a-z0-9_])(?:amount|price|total|subtotal|cents|fee|fees|cost|balance)$|(?:Amount|Price|Total|Subtotal|Cents|Fee|Fees|Cost|Balance)$/,He=/(?<![\w-])dark:(?=[\w[\-!@*(])/g,Ve="slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose",Ge="(?:50|[1-9]00|950)",Ye=new RegExp(`(?<![\\w-])(?:bg|text|border(?:-[xytrblse])?|ring(?:-offset)?|inset-ring|outline|divide|fill|stroke|from|via|to|shadow|inset-shadow|drop-shadow|accent|caret|decoration|placeholder)-(?:(?:${Ve})-${Ge}|white|black)(?:\\/[\\w.]+)?(?![\\w-])`,"g"),Ze=new RegExp(`--color-(?:(?:${Ve})-${Ge}|white|black)(?![\\w-])`,"g"),Qe=/(?<![\w-])(?:rgba?|hsla?|hwb|oklch|oklab|lab|lch)\(\s*[\d.]/g,Xe=/(?<![\w-])(?:white|black|red|green|blue|yellow|orange|purple|pink|gray|grey|silver|maroon|navy|teal|olive|lime|aqua|fuchsia|brown|gold|beige|ivory|tan|crimson|coral|salmon|indigo|violet)(?![\w-])/gi,et=/^(?:color|background(?:Color)?|border(?:Top|Right|Bottom|Left|Inline|Block)?(?:Color)?|outline(?:Color)?|fill|stroke|caretColor|accentColor|textDecorationColor|boxShadow|textShadow)$/,tt=/(?<![&a-zA-Z0-9])(?<!url\()#(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{6}|[0-9a-fA-F]{3,4})(?![\w-])/g,nt=e=>[...e.matchAll(tt)].length+[...e.matchAll(Qe)].length+[...e.matchAll(Ye)].length+[...e.matchAll(Ze)].length,it=(...e)=>e.join(""),st=/^h[1-6]$/,ot=new Set(["p","span"]),rt=new Set(["span","div","small","strong","b","em","i","p","mark","label","li"]),at="3xs|2xs|xs|sm|base|lg|xl|[2-9]xl",lt=new RegExp(`(?<![\\w-])!?(?:${it("te","xt-")}(?:(?:${at})(?:\\/[\\w.()-]+)?|\\[(?:length:)?[\\d.]+(?:px|rem|em)\\])|${it("fo","nt-")}(?:thin|extralight|light|normal|medium|semibold|bold|extrabold|black|\\[\\d+\\]))(?![\\w-])`),ct=new RegExp(`(?<![\\w-])${it("round","ed")}(?:-(?:full|sm|md|lg|xl|[23]xl|[trblse]|tl|tr|br|bl|\\([^)]*\\)|\\[[^\\]]*\\]))*(?![\\w-])`),dt=new RegExp(`(?<![\\w-])${it("b","g-")}(?!(?:none|transparent|current|inherit|cover|contain|auto|fixed|local|scroll|center|top|bottom|left|right|repeat|no-repeat|clip|origin|blend|linear|radial|conic|gradient|position|size|image)(?![\\w]))[\\w\\[(#][^\\s'"\`]*`),ut=`${at}|left|center|right|justify|start|end|wrap|nowrap|balance|pretty|ellipsis|clip|transparent|current|inherit|shadow`,pt=new RegExp(`(?<![\\w-])${it("te","xt-")}(?!(?:${ut})(?![\\w]))(?!\\[[\\d.]+(?:px|rem|em)\\])(?!\\[length:)[\\w\\[(#][^\\s'"\`]*`),ft=new RegExp(`(?<![\\w-])${it("p","[xs]?-")}(?:\\d|\\[|\\()`),ht=new RegExp(`(?<![\\w-])${it("p","y-")}(?:0|px|0\\.5|\\[[0-3](?:\\.\\d+)?px\\])(?![\\w.-])`),mt=new RegExp(`(?<![\\w-])${it("round","ed-full")}(?![\\w-])`),gt=new RegExp(`(?<![\\w-])${it("te","xt-")}(?:xs|2xs|3xs|\\[(?:9|10|11|12)px\\])(?![\\w-])`),xt=new RegExp(`(?<![\\w-])${it("p","y-")}`),wt=/(?<![\w.-])(?:\d*\.)?\d+m?s(?![\w-])/g,$t=e=>[...e.matchAll(wt)].some(e=>0!==parseFloat(e[0])),yt=/(?<![\w.#-])-?(?:\d*\.)?\d+(?:px|rem|em)(?![\w-])/g,bt=e=>[...e.matchAll(yt)].some(e=>0!==parseFloat(e[0])),kt=new RegExp(`(?<![\\w-])!?(?:${it("dura","tion-")}|${it("del","ay-")})(?:\\d+|\\[[^\\]]+\\])(?![\\w-])|(?<![\\w-])!?${it("fo","nt-")}\\[\\d+\\](?![\\w-])|(?<![\\w-])!?${it("bor","der")}(?:-[xytrblse])?-\\[[\\d.]+px\\](?![\\w-])`,"g"),vt=/^(?:transition|transitionDuration|transitionDelay|animation|animationDuration|animationDelay)$/,St=/^border(?:Top|Right|Bottom|Left|Inline|Block)?(?:Start|End)?(?:Width)?$/,Et=/^(?:transition|transition-duration|transition-delay|animation|animation-duration|animation-delay)$/,Tt=/^border(?:-(?:top|right|bottom|left|inline|block)(?:-(?:start|end))?)?(?:-width)?$/,jt=/^(?:padding|margin)(?:-(?:top|right|bottom|left|inline|block)(?:-(?:start|end))?)?$|^(?:gap|row-gap|column-gap)$/,zt=/^\s*-?(?:\d*\.)?\d+(?:px|rem|em|ms|s)\s*$/,At=/^\s*(?:inherit|initial|unset|revert|revert-layer|100%|1em)\s*(?:!important)?\s*$/,Nt=new Set(["button","a","option","Button","IconButton","SplitButton","Link","NavLink","PopupMenuItem","PopupMenuLabel","DropdownMenuItem","MenuItem","ContextMenuItem"]),It=/(?:…|\.\.\.|&hellip;)\s*$/,Ct=new RegExp("\\p{L}","u"),Lt=new RegExp("\\p{L}[\\p{L}-]*","u"),Dt={busy:{words:["Accepting","Adding","Applying","Approving","Arranging","Asking","Assigning","Booking","Building","Calculating","Cancelling","Capturing","Changing","Checking","Choosing","Closing","Combining","Comparing","Completing","Confirming","Connecting","Converting","Copying","Correcting","Counting","Creating","Deleting","Detaching","Downloading","Drawing","Duplicating","Emailing","Ending","Exporting","Fetching","Filing","Finding","Flushing","Generating","Grouping","Importing","Linking","Loading","Locating","Looking","Making","Marking","Matching","Measuring","Merging","Moving","Opening","Ordering","Paying","Pending","Posting","Preparing","Previewing","Pricing","Processing","Provisioning","Publishing","Purging","Pushing","Queued","Queuing","Quoting","Re-booking","Re-importing","Re-opening","Reading","Rebooting","Rebuilding","Receiving","Reconciling","Reconnecting","Recording","Refreshing","Refunding","Regenerating","Registering","Reinstating","Rejecting","Removing","Reopening","Requesting","Resending","Resetting","Resolving","Restarting","Restoring","Resuming","Retrying","Reversing","Reverting","Running","Saving","Searching","Sending","Setting","Settling","Sharing","Signing","Splitting","Starting","Submitting","Suggesting","Switching","Syncing","Taking","Testing","Transferring","Typing","Updating","Uploading","Verifying","Waiting","Withdrawing","Working"],zhStarts:["正在"],zhEnds:["中"]},placeholder:{},prompt:{}},Rt=new Set((Dt.busy?.words??[]).map(e=>e.toLowerCase())),Mt=new Set(["label","aria-label",...Dt.placeholder?[]:["placeholder","searchPlaceholder","emptyOptionLabel","blankLabel"]]),Ot=(e,t)=>{if(!It.test(t)||!Ct.test(e))return!1;const n=e.match(Lt)?.[0]?.toLowerCase();if(n&&Rt.has(n))return!1;const i=e.replace(It,"").trim(),s=Dt.busy;return!(s&&(s.zhStarts.some(e=>i.startsWith(e))||s.zhEnds.some(e=>i.endsWith(e))))},Bt=new Set(["confirm","alert","prompt"]),Ft=new Set(["window","globalThis","self"]),Pt=/^(?:\w+\.)?(?:Dialog|PopupForm|ConfirmDialog)$/,Wt=(...e)=>e.join("-"),Ut="vw|vh|dvw|dvh|svw|svh|lvw|lvh",Jt=[`${Wt("p[xytrblse]?","")}(?:0|\\[0(?:px)?\\])`,`${Wt("max","[wh]","")}(?:none|screen|full|\\[[^\\]]+\\])`,`${Wt("h","")}(?:full|screen|${Ut})`,`${Wt("w","")}(?:screen|${Ut})`,`${Wt("[wh]","")}\\[[^\\]]*(?:\\d(?:${Ut}|%)|calc\\()[^\\]]*\\]`,`${Wt("min","h","")}(?:screen|${Ut}|\\[[^\\]]+\\])`],_t=new RegExp(`(?<![\\w-])!?(?:${Jt.join("|")})(?![\\w.-])`);var qt=e=>/\.(?:[cm]?[jt]s|[jt]sx)$/.test(e)&&!e.endsWith(".d.ts"),Kt=e=>/\.(?:css|scss)$/.test(e),Ht=/^(?:color|background(?:-color)?|border(?:-(?:top|right|bottom|left|inline|block)(?:-(?:start|end))?)?(?:-color)?|outline(?:-color)?|fill|stroke|caret-color|accent-color|text-decoration(?:-color)?|box-shadow|text-shadow|column-rule(?:-color)?)$/;function Vt(e,t){const n=new Set(t);if(!n.has("colour")&&!n.has("own-text")&&!n.has("hand-motion"))return{};const i=e.replace(/\/\*[\s\S]*?\*\//g,e=>e.replace(/[^\n]/g," ")),s={},o=(e,t)=>{n.has(e)&&(s[e]??=[]).push(t)},r=e=>i.slice(0,e).split("\n").length,a=[];let l=0;for(let e=0;e<i.length;e++){const t=i[e];if("{"===t||"}"===t||";"===t){const n=i.slice(l,e),s=l+(n.length-n.trimStart().length);if("{"!==t&&a.length>0){const e=n.trim(),t=e.indexOf(":");if(e.startsWith("@apply"))for(let t=[...e.matchAll(Ye)].length;t>0;t--)o("colour",r(s));else if(t>0){const n=e.slice(0,t).trim(),i=n.toLowerCase(),l=e.slice(t+1);if(!/^(?:-webkit-)?mask/.test(i)){const e=nt(l)+(Ht.test(i)?[...l.matchAll(Xe)].length:0);for(let t=0;t<e;t++)o("colour",r(s))}const c=a[a.length-1];"font-size"!==i&&"font"!==i||At.test(l)||c.text||(c.text=!0,o("own-text",c.line));(n.startsWith("--")?zt.test(l)&&0!==parseFloat(l):Et.test(i)?$t(l):"font-weight"===i?/^\s*(?:\d+|bold|bolder)\s*(?:!important)?\s*$/.test(l):!(!Tt.test(i)&&!jt.test(i))&&bt(l))&&o("hand-motion",r(s))}}"{"===t?a.push({line:r(s),text:!1}):"}"===t&&a.pop(),l=e+1}}return s}function Gt(e,t,n,i,s,o,r){const a=new Set(i),l=e.createSourceFile(t,n,e.ScriptTarget.Latest,!0,function(e,t){return t.endsWith(".tsx")?e.ScriptKind.TSX:t.endsWith(".jsx")?e.ScriptKind.JSX:/\.[cm]?js$/.test(t)?e.ScriptKind.JS:e.ScriptKind.TS}(e,t)),c={},d=/\.[jt]sx$/.test(t),u=e=>l.getLineAndCharacterOfPosition(e).line+1,p=(e,t)=>{a.has(e)&&(c[e]??=[]).push(u(t.getStart(l)))},f=(t,n)=>t.attributes.properties.find(t=>e.isJsxAttribute(t)&&t.name.getText(l)===n),h=t=>{const n=t?.initializer;if(n)return e.isStringLiteral(n)?n.text:e.isJsxExpression(n)&&n.expression&&e.isStringLiteralLike(n.expression)?n.expression.text:void 0},m=new Set;if(a.has("native")){const t=n=>{if(n)if(e.isIdentifier(n))Bt.has(n.text)&&m.add(n.text);else if(e.isObjectBindingPattern(n)||e.isArrayBindingPattern(n))for(const i of n.elements)e.isBindingElement(i)&&t(i.name)},n=i=>{(e.isImportClause(i)||e.isImportSpecifier(i)||e.isNamespaceImport(i)||e.isVariableDeclaration(i)||e.isParameter(i)||e.isFunctionDeclaration(i))&&t(i.name),e.forEachChild(i,n)};n(l)}const x=t=>t&&e.isStringLiteralLike(t)?t.text:void 0,w=(e,t)=>{e&&("efficient-shell"===e||e.startsWith("efficient-shell/"))&&s?.add(e);const n=e?R(e):null;n&&p(n,t)},$=(e,t,n)=>{if(a.has("dark"))for(const n of e.matchAll(He))p("dark",t);if(a.has("radius"))for(const n of e.matchAll(Te))ze.test(n[1].trim())||p("radius",t);if(n&&d&&a.has("hex"))for(const n of e.matchAll(Ee))p("hex",t);if(n&&a.has("colour"))for(let n=nt(e);n>0;n--)p("colour",t);if(a.has("spacing"))for(const n of e.matchAll(Ae)){const e=n[1];(e.startsWith("[")?Le.test(e.slice(1,-1).trim()):g(e))||p("spacing",t)}if(a.has("font-size"))for(const n of e.matchAll(Ne))p("font-size",t);if(a.has("z-index"))for(const n of e.matchAll(Ie)){const e=n[1].startsWith("[")?n[1].slice(1,-1).trim():n[1];/^\d+$/.test(e)&&Number(e)>30&&p("z-index",t)}if(a.has("shadow"))for(const n of e.matchAll(Ce))n[1].startsWith("[")&&Le.test(n[1].slice(1,-1).trim())||p("shadow",t);if(a.has("gutter-literal"))for(const n of e.matchAll(Me))p("gutter-literal",t);if(a.has("view-line-literal"))for(const n of e.matchAll(Oe))p("view-line-literal",t);if(a.has("route-literal")&&Be.test(e)&&p("route-literal",t),a.has("root-zone-literal"))for(const n of e.matchAll(Fe))p("root-zone-literal",t);if(a.has("phone-query"))for(const n of e.matchAll(_e))p("phone-query",t);if(a.has("scaled-frame")&&Je.test(e)&&p("scaled-frame",t),a.has("hand-motion"))for(const n of e.matchAll(kt))p("hand-motion",t)},y=t=>{if(t)return e.isJsxExpression(t)?y(t.expression):e.isStringLiteralLike(t)?t.text:e.isTemplateExpression(t)?[t.head.text,...t.templateSpans.map(e=>e.literal.text)].join(" "):void 0},b=t=>e.isNumericLiteral(t)&&100===Number(t.text),k=(t,n,i)=>{const s=e.isStringLiteralLike(n)?n.text.trim():void 0;if(a.has("hand-motion")){("fontWeight"===t?e.isNumericLiteral(n)||void 0!==s&&/^(?:\d+|bold)$/.test(s):vt.test(t)?void 0!==s&&$t(s):!!St.test(t)&&(e.isNumericLiteral(n)&&0!==Number(n.text)||void 0!==s&&bt(s)))&&p("hand-motion",i)}if(a.has("colour")&&void 0!==s&&et.test(t))for(const e of s.matchAll(Xe))p("colour",i);if(a.has("spacing")&&De.test(t))e.isNumericLiteral(n)?Re.has(Number(n.text))||p("spacing",i):void 0!==s&&!Le.test(s)&&(e=>[...e.matchAll(/(-?\d*\.?\d+)(px|rem|em)\b/g)].map(e=>Math.abs(Number(e[1]))*("px"===e[2]?1:16)))(s).some(e=>!Re.has(e))&&p("spacing",i);else if(a.has("font-size")&&"fontSize"===t)(e.isNumericLiteral(n)||void 0!==s&&!Le.test(s)&&!/^(?:smaller|larger)$/.test(s))&&p("font-size",i);else if(a.has("z-index")&&"zIndex"===t){const t=[],s=n=>{e.isNumericLiteral(n)||e.isStringLiteralLike(n)&&/^\d+$/.test(n.text.trim())?t.push(Number(n.text)):e.forEachChild(n,s)};s(n);for(const e of t)e>30&&p("z-index",i)}else a.has("shadow")&&"boxShadow"===t&&(void 0===s||""===s||Le.test(s)||p("shadow",i))},v=(t,n)=>{if(o&&a.has("shell-part-copy")){const n=e.isFunctionDeclaration(t)&&void 0!==t.body||e.isClassDeclaration(t)||e.isVariableDeclaration(t)&&(t=>{if(!t)return!1;if(e.isArrowFunction(t)||e.isFunctionExpression(t)||e.isClassExpression(t))return!0;if(e.isCallExpression(t)){const n=t.expression,i=e.isIdentifier(n)?n.text:e.isPropertyAccessExpression(n)?n.name.text:"";return"forwardRef"===i||"memo"===i}return!1})(t.initializer)?t.name:void 0;n&&e.isIdentifier(n)&&o.has(n.text)&&p("shell-part-copy",n)}if(e.isJsxOpeningElement(t)||e.isJsxSelfClosingElement(t)){const n=t.tagName.getText(l);if(a.has("sizes-literal")){const e=y(f(t,"sizes")?.initializer);void 0!==e&&qe.test(e)&&p("sizes-literal",t)}if(a.has("dialog-frame")&&Pt.test(n)){const e=f(t,"className")?.initializer?.getText(l);void 0!==e&&_t.test(e)&&p("dialog-frame",t)}if(/^[a-z]/.test(n)){const i=h(f(t,"type"));"svg"===n&&p("svg",t),"button"===n?p("button",t):"select"===n?p("select",t):"textarea"===n?p("textarea",t):"input"===n&&("range"===i?p("range",t):"hidden"!==i&&p("input",t));const s=h(f(t,"role"));if("dialog"!==n&&"dialog"!==s&&"alertdialog"!==s||p("dialog",t),!ve.has(n)&&f(t,"title")&&p("title",t),a.has("own-text")||a.has("own-badge")){const i=(t=>{const n=(f(t,"className")??f(t,"class"))?.initializer;if(!n)return"";const i=[],s=t=>{if(e.isStringLiteralLike(t))i.push(t.text);else if(e.isTemplateExpression(t)){i.push(t.head.text);for(const e of t.templateSpans)s(e.expression),i.push(e.literal.text)}else e.forEachChild(t,s)};return s(n),i.join(" ")})(t),s=rt.has(n)&&ct.test(i)&&dt.test(i)&&pt.test(i)&&ft.test(i)&&(e=>ht.test(e)||!xt.test(e)&&mt.test(e)&&gt.test(e))(i);s?p("own-badge",t):(st.test(n)||ot.has(n)&&(lt.test(i)||(t=>{const n=f(t,"style")?.initializer,i=n&&e.isJsxExpression(n)?n.expression:void 0;return!(!i||!e.isObjectLiteralExpression(i))&&i.properties.some(t=>{if(!e.isPropertyAssignment(t))return!1;const n=e.isIdentifier(t.name)||e.isStringLiteralLike(t.name)?t.name.text:"";return"fontSize"===n||"fontWeight"===n||"font"===n})})(t)))&&p("own-text",t)}}}else if(e.isCallExpression(t)){const n=t.expression;e.isIdentifier(n)?"createPortal"===n.text?p("portal",t):Bt.has(n.text)&&!m.has(n.text)?p("native",t):"require"===n.text&&w(x(t.arguments[0]),t):e.isPropertyAccessExpression(n)?"createPortal"===n.name.text?p("portal",t):Bt.has(n.name.text)&&e.isIdentifier(n.expression)&&Ft.has(n.expression.text)&&p("native",t):n.kind===e.SyntaxKind.ImportKeyword&&w(x(t.arguments[0]),t)}else{if(e.isImportDeclaration(t)||e.isExportDeclaration(t))return void w(x(t.moduleSpecifier),t);if(e.isPropertyAssignment(t)){const n=e.isIdentifier(t.name)||e.isStringLiteralLike(t.name)?t.name.text:"",i=t.initializer;if(k(n,i,t),a.has("scaled-frame")&&"transformOrigin"===n){const e=y(i);void 0!==e&&We.test(e)&&p("scaled-frame",t)}if(a.has("sizes-literal")&&"sizes"===n){const e=y(i);void 0!==e&&qe.test(e)&&p("sizes-literal",t)}a.has("radius")&&je.test(n)&&(e.isNumericLiteral(i)?ze.test(i.text)||p("radius",t):e.isStringLiteralLike(i)&&!ze.test(i.text.trim())&&p("radius",t))}else if(e.isBinaryExpression(t)){const n=t.operatorToken.kind;if(a.has("scaled-frame")&&n===e.SyntaxKind.EqualsToken&&e.isPropertyAccessExpression(t.left)&&"transformOrigin"===t.left.name.text){const e=y(t.right);void 0!==e&&We.test(e)&&p("scaled-frame",t)}if(a.has("money-cents")&&(n===e.SyntaxKind.AsteriskToken||n===e.SyntaxKind.SlashToken)){const i=b(t.right)?t.left:b(t.left)&&n===e.SyntaxKind.AsteriskToken?t.right:void 0,s=i&&(t=>{let n=t;for(;e.isParenthesizedExpression(n)||e.isNonNullExpression(n)||e.isAsExpression(n);)n=n.expression;return e.isCallExpression(n)&&(n=n.expression),e.isIdentifier(n)?n.text:e.isPropertyAccessExpression(n)?n.name.text:e.isElementAccessExpression(n)&&e.isStringLiteralLike(n.argumentExpression)?n.argumentExpression.text:void 0})(i);s&&Ke.test(s)&&p("money-cents",t)}}else if(a.has("local-helper")&&(e.isFunctionDeclaration(t)||e.isVariableDeclaration(t))&&t.name&&e.isIdentifier(t.name)&&Object.prototype.hasOwnProperty.call(A,t.name.text)&&(e.isFunctionDeclaration(t)?void 0!==t.body:void 0!==t.initializer&&(e.isArrowFunction(t.initializer)||e.isFunctionExpression(t.initializer))))p("local-helper",t);else if(e.isStringLiteralLike(t))$(t.text,t,n);else if(e.isTemplateExpression(t)){$(t.head.text,t.head,n);for(const e of t.templateSpans)$(e.literal.text,e.literal,n)}}e.isJsxAttribute(t)&&Se.has(t.name.getText(l))?e.forEachChild(t,e=>v(e,!1)):e.forEachChild(t,e=>v(e,n))};if(v(l,!0),a.has("ellipsis-label")&&function(e,t,n){const i=new Set,s=(e,t)=>{i.has(e)||(i.add(e),n(t))},o=n=>{if(n)if(e.isStringLiteralLike(n))Ot(n.text,n.text)&&s(n,n.getStart(t));else if(e.isTemplateExpression(n)){const e=[n.head.text,...n.templateSpans.map(e=>e.literal.text)];Ot(e.join(" "),e[e.length-1])&&s(n,n.getStart(t))}else e.isConditionalExpression(n)?(o(n.whenTrue),o(n.whenFalse)):e.isBinaryExpression(n)?(o(n.left),o(n.right)):e.isParenthesizedExpression(n)||e.isAsExpression(n)||e.isJsxExpression(n)?o(n.expression):e.isCallExpression(n)&&en.has(tn(n.expression))&&n.arguments[0]&&o(n.arguments[0])},r=n=>{for(const i of n)if(e.isJsxText(i)){const e=i.getText(t);Ot(e,e)&&s(i,i.getStart(t)+(e.length-e.trimStart().length))}else e.isJsxExpression(i)?o(i.expression):(e.isJsxElement(i)||e.isJsxFragment(i))&&r(i.children)},a=(n,i)=>{const s=n.attributes.properties.find(n=>e.isJsxAttribute(n)&&n.name.getText(t)===i),o=s?.initializer;return o&&e.isStringLiteral(o)?o.text:o&&e.isJsxExpression(o)&&o.expression&&e.isStringLiteralLike(o.expression)?o.expression.text:void 0},l=t=>t.properties.some(t=>e.isPropertyAssignment(t)&&(e.isIdentifier(t.name)||e.isStringLiteralLike(t.name))&&"value"===t.name.text&&e.isStringLiteralLike(t.initializer)&&""===t.initializer.text),c=n=>{if(e.isJsxElement(n)){const e=n.openingElement,i=e.tagName.getText(t),s="option"===i&&Dt.prompt&&""===a(e,"value");Nt.has(i)&&!s&&r(n.children)}else if(e.isJsxAttribute(n))Mt.has(n.name.getText(t))&&o(n.initializer);else if(e.isPropertyAssignment(n)){const t=e.isIdentifier(n.name)||e.isStringLiteralLike(n.name)?n.name.text:"",i=Dt.prompt&&e.isObjectLiteralExpression(n.parent)&&l(n.parent);Mt.has(t)&&!i&&o(n.initializer)}e.forEachChild(n,c)};c(t)}(e,l,e=>(c["ellipsis-label"]??=[]).push(u(e))),a.has("option-read"))for(const t of we(e,l))(c["option-read"]??=[]).push(u(t));if(a.has("deprecated-undated")){const t=be(new Date);for(const n of function(e,t){const n=t.text,i=new Map,s=e=>e?.forEach(e=>i.set(e.pos,e)),o=t=>{s(e.getLeadingCommentRanges(n,t.pos)),s(e.getTrailingCommentRanges(n,t.end)),e.forEachChild(t,o)};o(t),s(e.getLeadingCommentRanges(n,t.endOfFileToken.pos));const r=[],a=e=>/^[ \t]*$/.test(n.slice(n.lastIndexOf("\n",e-1)+1,e));for(const t of[...i.values()].sort((e,t)=>e.pos-t.pos)){const i=n.slice(t.pos,t.end);if(t.kind===e.SyntaxKind.MultiLineCommentTrivia){r.push({pos:t.pos,text:i,end:t.end,run:!1});continue}const s=a(t.pos),o=r[r.length-1];s&&o?.run&&/^[ \t]*\r?\n[ \t]*$/.test(n.slice(o.end,t.pos))?(o.text+="\n"+i,o.end=t.end):r.push({pos:t.pos,text:i,end:t.end,run:s})}return r}(e,l)){const e=n.text.indexOf("@deprecated");e>=0&&Xt(n.text,t)&&(c["deprecated-undated"]??=[]).push(u(n.pos+e))}}if(r&&(a.has("copied-value")||a.has("copied-routine"))){const t=function(e,t,n,i){const s=[];if(i.value&&n.values.size)for(const i of t.statements)if(e.isVariableStatement(i)&&0!==(i.declarationList.flags&e.NodeFlags.Const))for(const t of i.declarationList.declarations){const i=ce(e,t.initializer),o=i?n.values.get(i):void 0;o&&s.push({kind:"copied-value",node:t,instead:me(o)})}if(i.routine&&n.routines.size){const i=o=>{if(pe(e,o)){const{hash:i,nodes:r}=fe(e,o),a=r>=25?n.routines.get(i):void 0;if(a&&!he(e,o,t))return void s.push({kind:"copied-routine",node:o,instead:me(a)})}e.forEachChild(o,i)};i(t)}return s}(e,l,r.index,{value:a.has("copied-value"),routine:a.has("copied-routine")});for(const e of t)p(e.kind,e.node),r.instead?.(e.kind,u(e.node.getStart(l)),e.instead)}return c}var Yt=/\b(?:delete|deleted|remove|removed|goes|go)\s+(?:[\w`'.-]+\s+){0,2}?by\s+(\d{4}-\d{2}-\d{2})\b/i,Zt=/next\s+major|major\s+after/i,Qt=6;function Xt(e,t){const n=e.replace(/^\s*(?:\/\*\*?|\*\/|\*|\/\/)\s?/gm,"");if(Zt.test(n))return'it still says "next major": the delete day is the only promise';const i=Yt.exec(n);if(!i)return'no delete day ("delete by YYYY-MM-DD")';const s=ke(i[1]);if(!s)return`${i[1]} is not a day`;const o=ke(t);if(!o)throw new Error(`today must be YYYY-MM-DD, got ${t}`);if(s<o)return`its delete day ${i[1]} is past`;const r=function(e,t){const n=new Date(e.getFullYear(),e.getMonth()+t,1),i=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();return new Date(n.getFullYear(),n.getMonth(),Math.min(e.getDate(),i))}(o,Qt);return s>r?`its delete day ${i[1]} is more than ${Qt} months out (last ${be(r)})`:void 0}var en=new Set(["say","t"]),tn=e=>{const t=e.getText();return t.slice(t.lastIndexOf(".")+1)};function nn(e){const t={};for(const[n,i]of Object.entries(e))i.length&&(t[n]=i.length);return t}var sn=(e,t,n,i)=>function(e,t,n){const i=e.createSourceFile(t,n,e.ScriptTarget.Latest,!1),s=[];for(const t of i.statements)(e.isImportDeclaration(t)||e.isExportDeclaration(t))&&t.moduleSpecifier&&e.isStringLiteralLike(t.moduleSpecifier)&&s.push(t.moduleSpecifier.text);return s}(e,t,n).some(e=>i.some(t=>t.endsWith("/*")?e.startsWith(t.slice(0,-1)):e===t));var on=e=>new Map(e.allow.map(e=>[K(e.file,e.kind),e.count]));function rn(e,t){return e.kinds.filter(e=>t.kinds.includes(e))}var an=(e,t,n)=>{if("kit-dep"===n)return` (${e.kitDeps.join(", ")})`;if("chart-dep"===n)return` (${e.chartDeps.join(", ")})`;const i=e.hits.get(t)?.[n]??[];if(0===i.length)return"";const s=e.instead?.get(K(t,n));if(s?.size){return` (${i.slice(0,12).map(e=>`line ${e}: ${s.get(e)??"?"}`).join("; ")}${i.length>12?"; …":""})`}const o=i.slice(0,12).join(", ");return` (line${1===i.length?"":"s"} ${o}${i.length>12?", …":""})`};function ln(e,t,n){const i=on(e),s=new Map;for(const[e,o]of t.counts){const{kind:t}=H(e);if(!w(t)||!n.includes(t))continue;const r=o-(i.get(e)??0);r>0&&s.set(e,r)}return{kinds:x.filter(e=>n.includes(e)),counts:s}}function cn(e,t){let n=0;for(const i of new Set([...e.keys(),...t.keys()]))(e.get(i)??0)!==(t.get(i)??0)&&(n+=1);return n}var dn=/^[A-Z][a-z0-9]+(?:[A-Z][a-z0-9]*|[0-9]+)*$/;function un(e,t,n,u,f){const h=i(e,ie);if(!r(h))return{problems:[`no ${ie} in ${e}.`],summary:""};const m=JSON.parse(a(h,"utf8"));if(!m.name)return{problems:[`${ie} has no "name".`],summary:""};let g;try{g=f()}catch{return{problems:['found no "typescript" package here. Install it as a devDependency.'],summary:""}}const x=new Map(u.map(e=>{const t=e.indexOf("=");return[e.slice(0,t),e.slice(t+1)]})),w=t=>{try{return d(i(e,t)).isFile()}catch{return!1}},{entries:$,problems:y}=function(e,t,n,i,s){const o=[],r=[],a=e.name??"",l="string"==typeof e.exports?{".":e.exports}:e.exports??{},c=e=>{if("string"==typeof e)return e;if(e&&"object"==typeof e){const t=e;return c(t.import??t.default??t.require)}},d=e=>[".ts",".tsx","/index.ts","/index.tsx"].map(n=>`${t}/${e}${n}`).find(n)??null;for(const[e,u]of Object.entries(l)){const l="."===e?a:`${a}/${e.replace(/^\.\//,"")}`,p=e=>/\.tsx?$/.test(e)&&!/\.(test|spec)\./.test(e)&&!e.endsWith(".d.ts"),f=(e,t)=>i(e).flatMap(n=>n.endsWith("/")?f(`${e}/${n.slice(0,-1)}`,`${t}${n}`):p(n)?[{entry:l.replace("*",`${t}${n.replace(/\.tsx?$/,"")}`),file:`${e}/${n}`}]:[]),h=e=>{if(e.endsWith("/**"))return f(e.slice(0,-3),"");const t=e.lastIndexOf("/"),[n,s]=[e.slice(0,t),e.slice(t+1)],[o,r=""]=s.split("*");return i(n).filter(e=>e.startsWith(o)&&e.endsWith(r)&&e.length>o.length+r.length).filter(p).map(e=>({entry:l.replace("*",e.slice(o.length,e.length-r.length).replace(/\.tsx?$/,"")),file:`${n}/${e}`}))},m=s.get(e);if(m){if(e.includes("*"))if(m.includes("*")){const t=h(m),i=c(u),[s,a]=l.split("*"),d=e=>!i?.includes("*")||n(i.replace(/^\.\//,"").replace("*",e.entry.slice(s.length,e.entry.length-a.length))),p=t.filter(d);p.length?o.push(...p):t.length?r.push(`--entry ${e}=${m}: no source it matches is built at ${i}. Build first.`):r.push(`--entry ${e}=${m}: the pattern matches no source file.`)}else r.push(`--entry ${e}=${m}: a "*" subpath takes a pattern ("dir/*.tsx" or "dir/**").`);else o.push({entry:l,file:m});continue}const g=c(u);if(!g||!/\.m?js$/.test(g))continue;const x=/^\.\/[^/]+\/(.+)\.m?js$/.exec(g);if(!x){r.push(`exports "${e}" points at ${g}, not into a build folder. Name its source: --entry ${e}=<file>.`);continue}const w=x[1];if(w.includes("*")){const n=w.slice(0,w.lastIndexOf("/")),i=w.endsWith("/*")&&!n.includes("*")?h(`${t}/${n}/*`):[];i.length?o.push(...i):r.push(`exports "${e}" (${g}) has no source files at ${t}/${n}/. Name them: --entry ${e}=<folder>/*.tsx.`);continue}const $=d(w);$?o.push({entry:l,file:$}):r.push(`exports "${e}" (${g}) has no source at ${t}/${w}.ts(x). Name it: --entry ${e}=<file>.`)}return{entries:o,problems:r}}(m,n,w,t=>{try{return p(i(e,t),{withFileTypes:!0}).map(e=>e.isDirectory()?`${e.name}/`:e.name).sort()}catch{return[]}},x);for(const[e,t]of x)t.includes("*")||w(t)||y.push(`--entry ${e}=${t}: no such file.`);if(0===$.length&&y.push(`${ie} "exports" names no script entry, so the index would be empty.`),y.length)return{problems:y,summary:""};const b=xe(g,$,t=>{try{return a(i(e,t),"utf8")}catch{return null}},(e,t)=>{if(!t.startsWith("."))return null;const n=i(o(e),t).replace(/\\/g,"/"),s=n.replace(/\.(m?js|jsx)$/,"");return[n,`${s}.ts`,`${s}.tsx`,`${n}.ts`,`${n}.tsx`,`${n}/index.ts`,`${n}/index.tsx`].find(e=>/\.tsx?$/.test(e)&&w(e))??null});if(b.problems.length)return{problems:b.problems,summary:""};const k=(e,t)=>e.entry<t.entry?-1:e.entry>t.entry?1:e.name<t.name?-1:e.name>t.name?1:0,v=e=>({schema:1,package:m.name,version:m.version??"",entries:[...e].sort(k)}),S=s(e,t);return c(S,{recursive:!0}),l(i(S,se),`${JSON.stringify(v(b.values))}\n`),l(i(S,oe),`${JSON.stringify(v(b.routines))}\n`),{problems:[],summary:`${m.name}: copy index of ${$.length} entries written to ${t}: ${b.values.length} values, ${b.routines.length} routines.`}}var pn="\n// <button> in a comment is not a button, and <svg> in one is not a drawing\n/* nor is <input title=\"x\"> in this one, or dark:bg-black, or #fff */\nimport { createPortal } from 'react-dom';\nimport { Dialog } from '@headlessui/react';\nimport { TrashIcon } from '@heroicons/react/24/outline';\nimport type { Icon } from 'lucide-react';\nimport { Button, confirm } from 'efficient-shell';\nexport { Slot } from '@radix-ui/react-slot';\nexport { CheckIcon } from '@radix-ui/react-icons';\nimport { LineChart } from 'recharts';\nimport 'd3-scale';\nexport { VictoryPie } from 'victory';\nimport { BarChart } from '@mui/x-charts';\nimport Tree from 'react-d3-tree';\nimport { TimeSeriesChart } from 'efficient-shell/ui';\n// import 'chart.js' in a comment is not an import, and 'echarts' in a string is not one either\nconst chartLabel = 'd3-array';\n\nconst a = <button title=\"Says what it does\">x</button>;\nconst b = <input type=\"range\" />;\nconst c = <input type=\"text\" />;\nconst c2 = <input type={\"hidden\"} name=\"csrf\" />;\nconst c3 = <input type=\"hidden\" />;\nconst c4 = <input type={kind} />;\nconst d = <select />;\nconst d2 = <textarea />;\nconst e = <div role=\"dialog\" />;\nconst e2 = <dialog open />;\nconst e3 = <section role={'alertdialog'} />;\nconst f = <iframe title=\"Preview\" />;\nconst f2 = <object title=\"Chart\" />;\nconst g = <Button title=\"a prop, not a tooltip\" role=\"dialog\" />;\nconst g2 = (\n <button\n type=\"button\"\n title={hint}\n >\n y\n </button>\n);\nconst h = ReactDOM.createPortal(a, document.body);\nconst i = createPortal(a, document.body);\n\nasync function leave() {\n if (window.confirm('Sure?')) return;\n globalThis.alert('No');\n alert('native: nothing binds the name');\n prompt('native too');\n await confirm('the shell: the import binds it');\n record.confirm('a method, not the popup');\n}\n\nconst j = <div className=\"bg-white dark:bg-black dark:hover:text-white is-dark:no\" />;\nconst k = clsx('text-gray-900', on && 'dark:text-gray-100');\nconst l = <span style={{ color: '#fff', background: \"#12ab34\" }} className={`border-[#0a0b0c80] ${x}`} />;\nconst m = <a href=\"#faded\" id=\"#bad\" key=\"#abc\" to=\"#face\">skip</a>;\nconst n = <label htmlFor={'#dead'}>skip</label>;\nconst o = <span>&#1234; and BG#00340 and #12345 and #added are not colours</span>;\nconst p = 'entity &#x1f; ref BG#00340';\nconst q = <use xlinkHref=\"#abc\" fill=\"url(#fed)\" />;\nconst t = <div className=\"rounded-[4px] rounded-t-[0.5rem] hover:rounded-[2px] rounded-lg rounded-(--radius-card) rounded-[inherit] rounded-[var(--r)]\" />;\nconst u = <div style={{ borderRadius: 6, borderTopLeftRadius: '3px', borderBottomRightRadius: '50%', borderEndEndRadius: 'var(--radius-card)' }} />;\nconst v = <i style={{ borderRadius: 9999 }} />;\nconst w = <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M4 4h16\" /></svg>;\nconst w2 = <Svg viewBox=\"0 0 24 24\" />;\nconst w3 = '<svg viewBox=\"0 0 1 1\"></svg> in a string is not an element';\nconst r = lazy(() => import('@mui/material'));\nconst s = require('react-select');\nconst s2 = require('chart.js/auto');\nconst s3 = import('@nivo/line');\n",fn={button:2,input:2,range:1,textarea:1,select:1,dialog:3,title:2,portal:2,native:4,dark:3,hex:3,radius:5,kit:5,icon:3,svg:1,chart:5,colour:8},hn={kit:1,dark:1,portal:1,radius:2,chart:1,colour:2},mn=(...e)=>e.join("-"),gn=`\nconst s1 = <i className="${[mn("px","2.5"),mn("py","1.5"),"md:"+mn("gap","1.5"),"-"+mn("mt","1.5"),mn("p","[10px]")].join(" ")}" />;\nconst s2 = <i className="${[mn("p","0"),mn("px","px"),mn("p","0.5"),mn("p","3"),mn("gap-x","4"),mn("p","12"),mn("p","(--space-12)"),mn("p","[var(--space-12)]"),mn("space-x","reverse"),mn("top","1.5")].join(" ")}" />;\nconst s3 = <i style={{ padding: 6, marginTop: '10px', gap: 8, margin: '0 auto', paddingInline: 'var(--space-12)' }} />;\nconst f1 = <i className="${[mn("text","[11px]"),mn("text","[0.8rem]"),mn("text","xs"),mn("text","[#fff]"),mn("text","(--text-2xs)")].join(" ")}" />;\nconst f2 = <i style={{ fontSize: 12 }} />;\nconst f3 = { fontSize: 'var(--x)', font: 'inherit' };\nconst z1 = <i className="${[mn("z","[9999]"),mn("z","50"),mn("z","10"),mn("z","30"),"-"+mn("z","10"),mn("z","auto"),mn("z","(--z-popup)"),mn("z","[var(--z-popup)]")].join(" ")}" />;\nconst z2 = { zIndex: on ? 2020 : 2010 };\nconst z3 = { zIndex: Z_LAYERS.popup, top: 9999 };\nconst h1 = <i className="${[mn("shadow","[0_1px_2px_#000]"),mn("shadow","md"),"shadow",mn("shadow","lg"),mn("shadow","(--elevation-panel)"),mn("shadow","black/20"),mn("drop-shadow","md")].join(" ")}" />;\nconst h2 = { boxShadow: '0 1px 2px rgba(0,0,0,.1)' };\nconst h3 = { boxShadow: 'none', outline: 'var(--elevation-raised)' };\n`,xn={spacing:7,"font-size":3,"z-index":4,shadow:3,hex:1,colour:4},wn={colour:4,"hand-motion":1},$n=`\nconst t1 = <h3 className="sf-title">Pages</h3>;\nconst t2 = <h1>Title</h1>;\nconst t3 = <p className="${[mn("mt","2"),mn("text","[12px]")].join(" ")}">warn</p>;\nconst t4 = <span className="${mn("text","sm")}">x</span>;\nconst t5 = <span className={cn('a', on && '${mn("font","semibold")}')}>x</span>;\nconst t6 = <p style={{ fontWeight: 600 }}>x</p>;\nconst n1 = <p>plain</p>;\nconst n2 = <span className="${mn("text","gray","500")}">x</span>;\nconst n3 = <Title level={2}>x</Title>;\nconst n4 = <div className="${mn("text","sm")}">x</div>;\nconst b1 = <span className="${[mn("rounded","full"),mn("bg","amber","100"),mn("px","2"),mn("text","xs"),mn("text","amber","800")].join(" ")}">x</span>;\nconst b2 = <span className={\`${["rounded",mn("px","2"),mn("py","0.5")].join(" ")} \${on ? '${[mn("bg","green","100"),mn("text","green","800")].join(" ")}' : 'x'}\`}>x</span>;\nconst b3 = <span className="${[mn("rounded","full"),mn("bg","(--surface)"),mn("px","2")].join(" ")}">x</span>;\nconst b4 = <ColoredBadge tone="success">x</ColoredBadge>;\nconst b5 = <div className="${[mn("rounded","md"),mn("bg","amber","100"),mn("px","4"),mn("py","2"),mn("text","amber","800")].join(" ")}">a box, not a pill</div>;\nconst m1 = <i className="${[mn("duration","150"),mn("delay","[40ms]"),mn("font","[600]"),mn("border","[1px]"),mn("duration","(--motion-fast)")].join(" ")}" />;\nconst m2 = <i style={{ transition: 'opacity 0.12s', borderWidth: 1, fontWeight: 'bold', transitionDuration: 'var(--motion-fast)' }} />;\n`,yn={"own-text":6,"own-badge":2,"hand-motion":8,"font-size":1,colour:7},bn={"own-text":3,"hand-motion":6},kn=new Set(["Title","ColoredBadge"]),vn={"shell-part-copy":8},Sn={"ellipsis-label":9},En=`\nconst d1 = <Dialog open size="2xl" className="${[mn("p","0"),mn("max-w","none")].join(" ")}" />;\nconst d2 = <PopupForm open className={\`${mn("w","[calc(100vw")}-2rem)] \${x}\`} />;\nconst d3 = <ui.Dialog open className="${mn("h","screen")}" />;\nconst d4 = <ConfirmDialog open className="${"!"+mn("max-h","none")}" />;\nconst d5 = <Dialog open className="${mn("w","[100vw]")}" />;\nconst d6 = <Dialog open className="${mn("h","[90vh]")}" />;\nconst d7 = <Dialog open className="${mn("max-w","[95vw]")}" />;\nconst d8 = <Dialog open className="${mn("h","dvh")}" />;\nconst d9 = <Dialog open className="${[mn("px","0"),mn("py","0")].join(" ")}" />;\nconst d10 = <Dialog open className="${mn("p","[0px]")}" />;\nconst k1 = <Dialog open size="full" headerActions={<Help />} />;\nconst k5 = <Dialog open className="${[mn("w","full"),mn("px","4")].join(" ")}" />;\nconst k2 = <Dialog open className="${[mn("p","0.5"),mn("max-w","md"),mn("p","0-x")].join(" ")}" />;\nconst k3 = <Panel className="${mn("p","0")}" />;\nconst k4 = <div className="${mn("max-w","none")}" />;\n`,Tn={"dialog-frame":10,spacing:1},jn=`\n// "root:default-zone" and \`/wheels/\${slug}\` in a comment are not copies\nimport { escapeHtml } from 'efficient-shell/format';\nconst c1 = "${mn("pl","[var(--sf-site-gutter,40px)]")}";\nconst c2 = "var(--sf-site-gutter)";\nconst c3 = <i className="${mn("max","[960px]")}:hidden" />;\nconst c4 = "1960px";\nconst c5 = \`/wheels/\${slug}\`;\nconst c6 = "/tyres/" + slug;\nconst c7 = wheelPath(slug);\nconst c8 = { zone: "root:default-zone" };\nconst c9 = "(max-width: 767px)";\nconst c10 = <img sizes="(max-width: 800px) 100vw, 50vw" />;\nconst c11 = <img sizes={CONTENT_SIZES} />;\nconst c12 = Math.round(price * 100) / 100;\nconst c13 = ratio * 100;\nfunction escapeHtml(s: string) { return s; }\nconst c14 = timeAgo(when);\n/** @deprecated Remove at the next major. */\nconst c15 = 1;\nconst c16 = "@deprecated in a string";\n`,zn={"gutter-literal":1,"view-line-literal":1,"route-literal":2,"root-zone-literal":1,"phone-query":1,"sizes-literal":1,"money-cents":1,"local-helper":1,"deprecated-undated":1},An=["transform","Origin"].join(""),Nn=`\nconst s1 = { ${An}: 'top left' };\nel.style.${An} = "0 0";\nconst s3 = { ${An}: \`0% 0%\` };\nconst s4 = \`.frame { ${["transform","origin"].join("-")}: left top; }\`;\nconst s5 = <div className="${[mn("origin","top","left"),mn("scale","50")].join(" ")}" />;\nconst s6 = <div className="${mn("origin","[0_0]")}" />;\nconst n1 = { ${An}: 'center' };\nconst n2 = { ${An}: origin };\nconst n3 = <div className="${mn("origin","top")}" />;\nconst n4 = "top left";\n`,In={"scaled-frame":6},Cn={"option-read":11},Ln={"pkg/index.ts":"\nexport { clampAll as clamp, settle } from './lib';\nexport const PAGE_SLUG = 'site-footer-page';\nexport const SHORT_WORDS = ['left', 'center', 'right'];\nexport const ORDER = ['home', 'products', 'gallery'];\nexport const LABELS = { top: 'Top', middle: 'Middle', bottom: 'Bottom' };\nexport const WORD = 'Direction';\n","pkg/lib.ts":"\nexport function clampAll(values: number[], low: number, high: number): number[] {\n const out: number[] = [];\n for (const value of values) {\n out.push(Math.min(high, Math.max(low, value)));\n }\n return out;\n}\nconst pending = new Map<string, (ok: boolean) => void>();\nexport function settle(id: string, ok: boolean): boolean {\n const done = pending.get(id);\n if (!done) return false;\n pending.delete(id);\n done(ok);\n return true;\n}\n"},Dn={"copied-value":2,"copied-routine":1};var Rn=e=>x.filter(t=>e[t]).map(t=>`${t} ${e[t]}`).join(", ")||"nothing";function Mn(e){const t=[],n=b,i=[["fixture.tsx",pn,fn],["fixture.ts","\nimport { toast } from 'sonner';\nimport { extent } from 'd3-array';\nexport const tone = { warn: '#f59e0b' };\nexport const cls = 'ring-1 dark:ring-white rounded-[3px]';\nexport const box = { borderRadius: '0.25rem', radius: 4 };\nexport function ask(confirm: (message: string) => boolean) {\n return confirm('a parameter binds the name');\n}\nexport const mount = (node: unknown) => ReactDOM.createPortal(node, document.body);\n",hn],["tokens.tsx",gn,xn],["labels.tsx","\n// <Button>Save…</Button> in a comment is not a label\nconst l1 = <Button>Extend trial…</Button>;\nconst l2 = <PopupMenuItem onClick={go}><span>Read from a PDF...</span></PopupMenuItem>;\nconst l3 = <Button>{busy ? 'Saving…' : 'Duplicate site…'}</Button>;\nconst l4 = <Item label=\"Translate…\" aria-label={'More…'} />;\nconst l5 = [{ label: 'Reject…' }, { value: CUSTOM, label: 'Custom…' }];\nconst l6 = <option value={CUSTOM}>Different address…</option>;\nconst l7 = <PopupMenuLabel>{say(\"Duplicate to page…\")}</PopupMenuLabel>;\nconst n7 = <Button>{t('team:menu.remove')}</Button>;\nconst n1 = <Button>{`${name.slice(0, 9)}…`}</Button>;\nconst n2 = <p>Loading weather…</p>;\nconst n3 = <Input placeholder=\"Search…\" />;\nconst n4 = <option value=\"\">Pick a carrier…</option>;\nconst n5 = [{ value: '', label: 'Select…' }];\nconst n6 = <Button>Extend trial</Button>;\n",Sn],["copies.tsx",jn,zn],["frames.tsx",En,Tn],["scaled.tsx",Nn,In],["own.tsx",$n,yn],["option-read.tsx","\nconst LIST = ['a', 'b'] as const;\nconst SET = new Set(['a']);\nconst r1 = (v: unknown) => v === 'x' ? 'x' : 'y';\nconst r2 = (v: unknown) => 'x' == v ? v : 'y';\nconst r3 = (p?: { m?: string }) => (p?.m as string) === \"x\" ? (p?.m satisfies string | undefined) : \"y\";\nconst r4 = (v?: string) => v! !== 'x' ? 'y' : v!;\nconst r5 = (v: unknown) => !(v === 'x') ? 'y' : ('x' as const);\nconst r6 = (v: string) => (LIST as readonly string[]).includes(v) ? (v as 'a') : 'a';\nconst r7 = (v: string) => SET?.has(v) ? v : 'a';\nconst r8 = (v: string) => !LIST.includes(v as never) ? 'a' : v;\nconst r9 = (p: { s?: string }) => p.s === 'a' || p.s === 'b' ? p.s : undefined;\nconst r10 = (v: unknown) =>\n v === 'a'\n ? 'a'\n : v === 'b'\n ? 'b'\n : 'c';\nconst r11 = (p: { m?: string }) => <i data-m={p.m === `x` ? `x` : 'y'} />;\nconst n1 = (v: unknown) => v === 'x' ? 'y' : 'z';\nconst n2 = (v: unknown, w: string) => v === 'x' ? w : 'z';\nconst n3 = (v: string, w: string) => LIST.includes(v as never) ? w : 'a';\nconst n4 = (v?: string) => (v ?? 'left') === 'center';\ntype N5<T> = T extends 'x' ? 'x' : never;\nconst n6 = 'x' === 'x' ? 'x' : 'y';\nconst n7 = (v: unknown, w: unknown) => v === 'a' || w === 'b' ? v : 'c';\nconst n8 = (v: unknown) => parseOption(['x', 'y'], 'y', v);\n",Cn]];for(const[s,o,r]of i){const i=nn(Gt(e,s,o,n));n.some(e=>(i[e]??0)!==(r[e]??0))&&t.push(`${s}: read ${Rn(i)}; it holds ${Rn(r)}`)}const s=[["style.css",'\n/* #fff in a comment */\n.a:hover { color: #111; border: 1px solid white; }\n[data-x="#fff"] { mask-image: linear-gradient(#000, transparent); color: var(--ink); }\n.b { --mine: rgb(0 0 0 / .5); background: var(--surface, #fff); }\n',wn],["own.css","\n.title { margin: 0; font-size: var(--text-xl); font-weight: 600; }\n.reset { font: inherit; }\n.sub { margin: var(--space-8) 0; font-size: 14px; }\n.card { border: 1px solid var(--line); padding: 10px; gap: 0; }\n.fade { transition: opacity 0.12s; transition-duration: var(--motion-fast); animation: none 0s; }\n.rail { --rail-w: 44px; --rail-r: var(--radius-xl); --ratio: 1.5; --t: 120ms; }\n@media (min-width: 600px) { .x { font-size: 12px; font-size: 14px; } }\n",bn]];for(const[e,i,o]of s){const s=nn(Vt(i,n));n.some(e=>(s[e]??0)!==(o[e]??0))&&t.push(`${e}: read ${Rn(s)}; it holds ${Rn(o)}`)}const o=nn(Gt(e,"parts.tsx","\nimport { Title as ShellTitle } from 'efficient-shell/ui';\nexport function Title(props: { text: string }) { return <h2>{props.text}</h2>; }\nclass ColoredBadge {}\nconst a = () => { const Title = () => null; return Title; };\nconst b = function () { const ColoredBadge = function () { return null; }; return ColoredBadge; };\nconst c = () => { const Title = forwardRef(() => null); const ColoredBadge = React.memo(() => null); return [Title, ColoredBadge]; };\ndeclare function Title2(): void;\nfunction Heading() { return null; }\nconst d = () => { const Title = 'title'; return Title; };\nconst e = () => { const Title = memo(Inner); const ColoredBadge = forwardRef(Inner); return [Title, ColoredBadge]; };\nconst f = () => { const Title = useMemo(() => 1, []); return Title; };\nexport { ShellTitle };\n",["shell-part-copy"],void 0,kn));(o["shell-part-copy"]??0)!==vn["shell-part-copy"]&&t.push(`parts.tsx: read ${Rn(o)}; it holds ${Rn(vn)}`);const r=function(e){const t=xe(e,[{entry:"fixture-pkg",file:"pkg/index.ts"}],e=>Ln[e]??null,(e,t)=>"./lib"===t?"pkg/lib.ts":null),n=(e,t)=>({path:t,text:JSON.stringify({schema:1,package:"fixture-pkg",version:"0.0.0",entries:e})}),{index:i}=ge([n(t.values,"value-index.json"),n(t.routines,"routine-index.json")],new Set(["fixture-pkg"]));return{index:i,values:t.values.map(e=>e.name),routines:t.routines.map(e=>e.name)}}(e);"LABELS,ORDER,PAGE_SLUG"===r.values.join()&&"clamp,settle"===r.routines.join()||t.push(`the copy index of its fixture package holds values ${r.values.join(", ")||"none"} and routines ${r.routines.join(", ")||"none"}; it should hold values LABELS, ORDER, PAGE_SLUG and routines clamp, settle`);const a=nn(Gt(e,"copied.ts","\nconst FOOTER = 'site-footer-page';\nconst SORT = { bottom: 'Bottom', middle: 'Middle', top: 'Top' };\nconst ALIGN = ['left', 'center', 'right'];\nconst W = 'Direction';\nlet ORDER2 = ['home', 'products', 'gallery'];\nfunction limit(xs: readonly number[], lo: number, hi: number) {\n const r: number[] = [];\n for (const x of xs) {\n r.push(Math.min(hi, Math.max(lo, x)));\n }\n return r;\n}\nconst pending = new Map<string, (ok: boolean) => void>();\nfunction settle(key: string, ok: boolean): boolean {\n const done = pending.get(key);\n if (!done) return false;\n pending.delete(key);\n done(ok);\n return true;\n}\n",["copied-value","copied-routine"],void 0,void 0,{index:r.index}));x.some(e=>(a[e]??0)!==(Dn[e]??0))&&t.push(`copied.ts: read ${Rn(a)}; it holds ${Rn(Dn)}`);const l=nn(Gt(e,"fixture.tsx",pn,["button"]));return"button"!==Object.keys(l).join()&&t.push(`asked for button alone, the reader reported ${Rn(l)}`),t}var On="ui-kit.config.json",Bn="ui-kit.baseline.json",Fn="efficient-shell-ui-check",Pn=`${Fn}: every surface a person operates takes its UI from efficient-shell (harness UI-24).\n\n ${Fn} check this repository against ${Bn}\n ${Fn} --print print today's counts as a baseline, and change nothing\n ${Fn} --summary print totals per kind and per folder, as Markdown\n ${Fn} --json print the result as JSON\n ${Fn} --update lower the lines whose counts fell, and delete the ones at zero\n ${Fn} --update --allow-move also follow a renamed or split file (no total may rise)\n ${Fn} --init write the first ${Bn}\n ${Fn} --init --kind <kind> take the baseline for a kind just added to "kinds"\n ${Fn} --no-base do not compare with the base branch (refused on a pull request)\n ${Fn} --base-lock run only on a release with the base-branch lock (an older one fails on the flag)\n ${Fn} --write-index <dir> write this package's copy index into <dir> (a package's build; reads package.json "exports")\n [--src <dir>] where the source is (default src)\n [--entry <subpath>=<file>] the source of an "exports" subpath the default does not find\n\nKinds: ${x.join(", ")}\nReads ${On} in the current directory.`;var Wn=(e,t)=>`${e} ${t}${1===e?"":"s"}`,Un=(e,t)=>{const n=Q(e);return t.map(e=>`${e} ${n[e]??0}`).join(" · ")};var Jn=[5e3,15e3];function _n(e,t,n,i){const s=[];for(let o=0;o<n;o++){o>0&&e.sleep?.(Jn[Math.min(o-1,Jn.length-1)]);const n=e.gitDetail?e.gitDetail(t,12e4):{out:e.git(t),error:"git failed (no reason given)"};if(i())return s;s.push(`try ${o+1}: ${null===n.out?n.error:"git ran, and the commit is still not there"}`)}return s}function qn(e,t){const n=t.env.RUNNER_NAME?`runner ${t.env.RUNNER_NAME}`:"a runner with no RUNNER_NAME";return`git fetch was tried ${e.length} times on ${n}: ${e.join("; ")}.`}function Kn(e,t,n,s,o,l,c){const d=c?{index:c}:void 0,p=e.env.GITHUB_BASE_REF,f=!p&&"push"===e.env.GITHUB_EVENT_NAME;if(!p&&!f)return{problems:[],note:"",warnings:[]};const h=p?`GITHUB_BASE_REF is "${p}"`:'GITHUB_EVENT_NAME is "push"',m=(e,t)=>({problems:[e],note:t,warnings:[]}),g=e.git(["rev-parse","--show-prefix"]);if(null===g)return m(`${h}, and git could not read this checkout, so the base branch could not be compared. The comparison is the lock: run the check in the git checkout, with git installed and the folder trusted (git config --global --add safe.directory <path>).`,"git could not read this checkout");let x=p?`origin/${p}`:"HEAD^1";const $=t=>null!==e.git(["rev-parse","--verify","--quiet",`${t}^{commit}`]);if(!$(x)){const t=_n(e,p?["fetch","--no-tags","--depth=1","origin",`+refs/heads/${p}:refs/remotes/origin/${p}`]:["fetch","--no-tags","--deepen=1"],3,()=>$(x));if(!$(x)&&p)return m(`${h}, and ${x} could not be fetched, so the base branch could not be compared. On a pull request the comparison is the lock: give the job the base branch (git fetch origin ${p}). `+qn(t,e),`${x} could not be fetched`);if(!$(x)){const n=function(e){const t=e.env.GITHUB_EVENT_PATH;if(!t)return null;try{const e=JSON.parse(a(t,"utf8")).before;return"string"!=typeof e||!/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(e)||/^0+$/.test(e)?null:e}catch{return null}}(e);let i=[];if(null!==n&&(i=_n(e,["fetch","--no-tags","--depth=1","origin",n],2,()=>$(n))),null===n||!$(n))return m(`${h}, and ${x} (the commit before this one) could not be read, so it could not be compared. On a push the comparison is the lock: give the job that commit (fetch-depth: 2). `+qn(t,e)+(null===n?" The push event names no commit before this push (GITHUB_EVENT_PATH), so none was fetched in its place.":` The push's before commit ${n} could not be fetched either: ${i.join("; ")}.`),`${x} could not be fetched`);x=n}}const y=g.trim(),b=i(e.cwd,...y.split("/").filter(Boolean).map(()=>"..")),k=[],S=e.git(["show",`${x}:${y}${Bn}`]);if(null===S){const t=e.git(["ls-tree","-r","--full-tree","--name-only","-z",x]);if(null===t)return m(`${x} has no ${Bn} in this folder, and git could not list ${x}'s files, so a check that moved here cannot be told from an adoption.`,"adoption not confirmed");const n=t.split("\0").filter(e=>(e===Bn||e.endsWith(`/${Bn}`))&&!r(i(b,e)));return n.length?m(`${n.join(", ")} ${1===n.length?"is":"are"} on ${x} and gone here, and ${x} has no ${Bn} in this folder (${y||"the repository root"}): the check moved. Its lines would be taken as an adoption and never compared: keep the config and the baseline in the folder they were in.`,"the check moved"):{problems:[],note:`${x} has no ${Bn} yet (adoption)`,warnings:k}}const T=e=>`${x}'s ${e} could not be parsed, and this change replaces it with one that parses, so ${e===Bn?"the base branch was not compared":"no scope was checked for shrinking"}. The next change is compared against it as usual.`;let A;try{A=Y(S,`${x}:${Bn}`)}catch{return{problems:[],note:`${x}'s ${Bn} could not be read; the base branch was not compared`,warnings:[T(Bn)]}}const N=new Map,I=t=>(N.has(t)||N.set(t,e.git(["show",`${x}:${y}${t}`])),N.get(t)??null);let C=null;try{const e=I(On);null!==e&&(C=ne(JSON.parse(e),`${x}:${On}`))}catch{C=null}null===C&&k.push(T(On));const L=[],D=new Set(s.kinds.filter(e=>n.kinds.includes(e)));for(const e of A.kinds)D.has(e)||L.push(`"${e}" is checked on ${x}, and not here ("kinds" in ${On}, or ${Bn}). Its lines would never be counted again: keep the kind.`);const R=t=>{const n=t.split("/");for(let t=1;t<=n.length;t++)try{if(u(i(e.cwd,...n.slice(0,t))).isSymbolicLink())return!0}catch{return!1}return!1},M=new Set(o.copyOnly),O=new Set(o.files.filter(e=>!M.has(e))),B=(e,t)=>O.has(e)||w(t)&&(o.partial.get(e)??[]).includes(t),P=new Set([...A.counts.keys()].map(e=>H(e)).filter(({file:e,kind:t})=>e!==ie&&!B(e,t)).map(({file:e})=>e));for(const e of P)R(e)&&L.push(`${e} is under a symbolic link now (the file or a folder above it), and ${x} counted it. The walk does not follow it for every kind counted there, so those lines would never be counted again: keep the real file here.`);const W=on(s),U=C?on(C):W,_=e=>(A.counts.get(e)??0)+(U.get(e)??0),q=new Map;for(const e of new Set([...A.counts.keys(),...U.keys()])){const{file:t,kind:n}=H(e);t!==ie&&0!==_(e)&&((q.get(t)??[]).includes(n)||q.set(t,[...q.get(t)??[],n]))}const V=e=>(q.get(e)??[]).filter(t=>{return i=`${e}:${t}`,(n.counts.get(i)??0)+(W.get(i)??0)<_(`${e}:${t}`);var i}),G=[...q.keys()].filter(t=>!r(i(e.cwd,t))&&!R(t)),Z=[...q.keys()].filter(e=>!G.includes(e)&&!R(e)&&V(e).length>0),X=[...G,...Z];if(X.length){const n=e.git(["diff","-M30%","-C30%","--find-copies-harder","-l0","--no-relative","--name-status","-z",x]);if(null===n)L.push(`${Wn(X.length,"file")} that ${x} counted ${1===X.length?"is":"are"} gone or count less (${X.slice(0,3).join(", ")}${X.length>3?", …":""}), and git could not list the renames, so a move out of the check cannot be told from a delete.`);else{const e=new Map,s=n.split("\0");for(let t=0;t<s.length;){const n=s[t]??"";if(n.startsWith("R")||n.startsWith("C")){const[n,i]=[s[t+1],s[t+2]];n&&i&&e.set(n,[...e.get(n)??[],i]),t+=3}else t+=n?2:1}const o=(e,n,s)=>{const o=s.filter(w),r=Kt(e)&&Kt(n);if(!qt(e)&&!r)return o;let c;try{c=a(i(b,e),"utf8")}catch{return o}if(r){const e=Vt(c,o);return o.filter(t=>(e[t]?.length??0)>0)}const u=Gt(t,e,c,o,void 0,l,d),p=Gt(t,n,c,o,void 0,l,d);return o.filter(e=>(u[e]?.length??0)+(p[e]?.length??0)>0)};for(const t of X){const n=G.includes(t)?"moved to":"counts less, and git lists a copy of it at";for(const i of e.get(`${y}${t}`)??[]){const e=o(i,t,G.includes(t)?q.get(t)??[]:V(t));if(!e.length)continue;if(!i.startsWith(y)){L.push(`${t} ${n} ${i}, outside the folder the check runs in, and it holds ${e.map(e=>`"${e}"`).join(", ")} that ${x} counted. Those lines would never be counted again: keep it in this folder, in a scope.`);continue}const s=i.slice(y.length),r=e.filter(e=>!B(s,e));r.length&&L.push(`${t} ${n} ${s}, and no scope reads it there for ${r.map(e=>`"${e}"`).join(", ")}. ${x} counted it, so those lines would never be counted again: move it into a scope, or widen one to it.`)}}}}if(C){const n=F(C.exclude),i=v(C.kinds),r=e=>(qt(e)||i&&Kt(e))&&!n(e),a=t=>J(e.cwd,[t]).some(r),l="keep the line; delete it only when the files it matches are gone.",c=(e,t,n)=>t.filter(e=>!n.includes(e)&&a(e)).map(t=>`"${e}" drops "${t}", which ${x} reads. Those files would never be counted again: ${l}`),d=(e,t,n)=>n.filter(e=>!t.includes(e)&&a(e)).map(t=>`"${e}" adds "${t}", which takes files ${x} reads out of the check. Those files would never be counted again.`),u=e=>e.flatMap(e=>e.files.flatMap(t=>e.modules.map(e=>({glob:t,module:e})))),p=new Set(u(s.includeImporting).map(({glob:e,module:t})=>`${e}\n${t}`));L.push(...c("include",C.include,s.include),...u(C.includeImporting).filter(({glob:e,module:t})=>!p.has(`${e}\n${t}`)&&a(e)).map(({glob:e,module:t})=>`"includeImporting" drops "${e}" (${t}), which ${x} reads. Those files would never be counted again: ${l}`),...c("includeCopies",C.includeCopies,s.includeCopies),...c("includeValues",C.includeValues,s.includeValues),...d("exclude",C.exclude,s.exclude),...d("output",C.output.flatMap(e=>e.files),s.output.flatMap(e=>e.files)));const f=new Set(o.copyOnly),h=new Set(o.files.filter(e=>!f.has(e))),m=F(C.include),g=F(C.output.flatMap(e=>e.files)),w=new Set;for(const i of C.includeImporting)for(const s of J(e.cwd,i.files)){if(!qt(s)||n(s)||g(s)||m(s))continue;if(h.has(s)||w.has(s))continue;const e=I(s);null!==e&&sn(t,s,e,i.modules)&&(w.add(s),L.push(`${s} no longer imports ${i.modules.join(", ")}, so "includeImporting" stops reading it, and ${x} reads it. Keep the import, or read the file with "include".`))}}const ee=[],te=new Set,se={};if(C){const e=F(C.exclude),n=F(C.include),i=F(C.output.flatMap(e=>e.files)),r=F(C.includeCopies),a=F(C.includeValues),c=C.includeImporting.map(e=>({files:F(e.files),modules:e.modules})),u=s=>{if(e(s))return!1;if(n(s)&&!i(s))return!0;const o=c.filter(e=>e.files(s));if(!o.length||!qt(s))return!1;const r=I(s);return null!==r&&o.some(e=>sn(t,s,r,e.modules))};for(const n of o.files){if(u(n))continue;const i=o.partial.get(n)??s.kinds,c=!e(n)&&qt(n)&&r(n),p=!e(n)&&a(n),f=i.filter(e=>!(c&&j(e)||p&&E(e)));if(!f.length)continue;ee.push(n);for(const e of f)te.add(e);if(!qt(n))continue;const h=I(n);if(null===h)continue;const m=Gt(t,n,h,f,void 0,l,d);for(const e of f){const t=Math.min(m[e]?.length??0,o.counts.get(`${n}:${e}`)??0);t>0&&(se[e]=(se[e]??0)+t)}}}const oe={},re=[];if(C){const e=new Set(ee);for(const n of o.files){if(e.has(n))continue;const i=(o.partial.get(n)??s.kinds).filter(e=>{if(!A.kinds.includes(e))return!1;const t=(A.counts.get(K(n,e))??0)+(U.get(K(n,e))??0);return(o.counts.get(K(n,e))??0)>t});if(!i.length)continue;const r=I(n);if(null===r)continue;const a=Kt(n)?Vt(r,i):Gt(t,n,r,i,void 0,l,d);let c=!1;for(const e of i){const t=(A.counts.get(K(n,e))??0)+(U.get(K(n,e))??0),i=Math.min(a[e]?.length??0,o.counts.get(K(n,e))??0)-t;i>0&&(oe[e]=(oe[e]??0)+i,c=!0)}c&&re.push(n)}}const ae=Q(A.counts),le=Q(n.counts),ce=Q(W),de=Q(U),ue=(e,t,n)=>(e[n]??0)+(t[n]??0);if(L.push(...s.kinds.filter(e=>A.kinds.includes(e)&&ue(le,ce,e)>ue(ae,de,e)+(se[e]??0)+(oe[e]??0)).map(e=>{const t=(ce[e]??0)||(de[e]??0),n=n=>t?` (and ${n[e]??0} in "allow")`:"";return`${Bn} holds ${le[e]??0} of "${e}"${n(ce)}, and ${x} holds ${ae[e]??0}${n(de)}${ee.length?` (and ${se[e]??0} in the files new to a scope)`:""}${re.length?` (and ${oe[e]??0} this checker counts in the base files and their baseline did not)`:""}. The baseline only goes down, and "allow" with it: use ${z[e].instead}. A count that must stay goes in "allow" in ${On}, with its reason, and the same count of that kind is burned down in this change.`})),C)for(const e of s.allow){const t=U.get(K(e.file,e.kind));void 0!==t&&e.count<=t||k.push(`"allow" in ${On} ${void 0===t?"adds":`raises from ${t}`} ${e.file} (${e.kind}) at ${e.count}: ${e.reason}`)}const pe=[`compared with ${x}`];return null===C&&pe.push(`${x}'s ${On} could not be read, so every line was compared and no scope was checked for shrinking`),ee.length&&pe.push(`${[...te].every(j)?'"includeCopies" changed: ':[...te].every(E)?'"includeValues" changed: ':""}${ee.length} file${1===ee.length?"":"s"} new to a scope, so ${1===ee.length?"its":"their"} ${s.kinds.filter(e=>te.has(e)).join(", ")} lines may hold what ${1===ee.length?"it":"they"} held on ${x}`),re.length&&pe.push(`${re.length} file${1===re.length?" holds":"s hold"} what this checker counts and the base branch's baseline did not (${re.join(", ")}: ${s.kinds.filter(e=>(oe[e]??0)>0).map(e=>`${e} ${oe[e]}`).join(", ")}), measured in the base files themselves`),{problems:L,note:pe.join("; "),warnings:k}}process.exitCode=function(e,t){const n=function(e){const t={print:!1,summary:!1,json:!1,update:!1,allowMove:!1,init:!1,noBase:!1,help:!1,version:!1,kinds:[],entries:[]};for(let n=0;n<e.length;n++){const i=e[n];if("--print"===i)t.print=!0;else if("--summary"===i)t.summary=!0;else if("--json"===i)t.json=!0;else if("--update"===i)t.update=!0;else if("--allow-move"===i)t.allowMove=!0;else if("--init"===i)t.init=!0;else if("--no-base"===i)t.noBase=!0;else{if("--base-lock"===i)continue;if("--help"===i||"-h"===i)t.help=!0;else if("--version"===i||"-v"===i)t.version=!0;else if("--kind"===i){const i=e[++n];if(!i)return"--kind needs a kind after it";t.kinds.push(...i.split(","))}else if(i.startsWith("--kind="))t.kinds.push(...i.slice(7).split(","));else{if("--write-index"!==i&&"--src"!==i&&"--entry"!==i)return`unknown argument "${i}"`;{const s=e[++n];if(!s||s.startsWith("--"))return`${i} needs a value after it`;if("--write-index"===i)t.writeIndex=s;else if("--src"===i)t.src=s;else{if(!/^\.[^=]*=.+$/.test(s))return"--entry takes <subpath>=<file>, as in --entry ./hooks=src/hooks/index.ts";t.entries.push(s)}}}}}return t.allowMove&&!t.update?"--allow-move goes with --update":t.kinds.length&&!t.init?"--kind goes with --init":!t.src&&!t.entries.length||t.writeIndex?t.writeIndex&&(t.print||t.summary||t.update||t.init||t.json||t.noBase)?"--write-index goes alone":[t.print,t.summary,t.update,t.init].filter(Boolean).length>1?"choose one of --print, --summary, --update and --init":t:"--src and --entry go with --write-index"}(e);if("string"==typeof n)return t.err(`${Fn}: ${n}\n\n${Pn}`),2;if(n.help)return t.out(Pn),0;if(n.version)return t.out(t.version),0;const s=e=>(n.json?t.out(JSON.stringify({tool:Fn,version:t.version,ok:!1,failures:[e]},null,2)):t.err(`${Fn}: ${e}`),1);if(n.writeIndex){const e=un(t.cwd,n.writeIndex,n.src??"src",n.entries,()=>t.loadTypeScript());return e.problems.length?s(`--write-index:\n - ${e.problems.join("\n - ")}`):(t.out(e.summary),0)}if(n.noBase&&t.env.GITHUB_BASE_REF)return s("--no-base is refused on a pull request (GITHUB_BASE_REF is set): the base-branch comparison is what stops a pull request lowering its own baseline.");const c=i(t.cwd,On);if(!r(c))return s(`no ${On} in ${t.cwd}. Run it from the repository root; the harness has the template.`);let d,u;try{d=ne(JSON.parse(a(c,"utf8")),On)}catch(e){return s(e instanceof X?e.message:`${On} is not valid JSON: ${e.message}`)}try{u=t.loadTypeScript()}catch{return s('this check reads the TypeScript AST and found no "typescript" package here. Install it as a devDependency.')}const p=Mn(u);if(p.length)return s(`the reader misread its own fixtures with typescript ${u.version}, so nothing it says about this repository can be trusted:\n - `+p.join("\n - "));let f,h;if(d.kinds.includes("shell-part-copy")){const e=e=>{try{return a(e,"utf8")}catch{return null}};f=function(e,t,n,i){const s=new Set,o=new Set;let r=!1;const a=t=>{if(o.has(t))return!0;const r=n(t);if(null===r)return!1;o.add(t);const{names:l,starFrom:c}=function(e,t,n){const i=e.createSourceFile(t,n,e.ScriptTarget.Latest,!1),s=[],o=[],r=t=>e.canHaveModifiers(t)&&(e.getModifiers(t)??[]).some(t=>t.kind===e.SyntaxKind.ExportKeyword);for(const t of i.statements)if(e.isExportDeclaration(t)){if(t.isTypeOnly)continue;const n=t.exportClause;if(n){if(e.isNamedExports(n))for(const e of n.elements)e.isTypeOnly||s.push(e.name.text)}else t.moduleSpecifier&&e.isStringLiteralLike(t.moduleSpecifier)&&o.push(t.moduleSpecifier.text)}else if((e.isFunctionDeclaration(t)||e.isClassDeclaration(t))&&t.name&&r(t))s.push(t.name.text);else if(e.isVariableStatement(t)&&r(t))for(const n of t.declarationList.declarations)e.isIdentifier(n.name)&&s.push(n.name.text);return{names:s,starFrom:o}}(e,t,r);for(const e of l)dn.test(e)&&s.add(e);for(const e of c){if(!e.startsWith("."))continue;const n=i(t,e);[n,`${n}.js`,`${n}.ts`,`${n}.tsx`,`${n}/index.js`,`${n}/index.ts`].some(e=>a(e))}return!0};for(const e of t)a(e)&&(r=!0);return r?s:null}(u,t.shellPartFiles??[],e,(e,t)=>i(o(e),t))??void 0}if(d.kinds.includes("copied-value")||d.kinds.includes("copied-routine")){const e=new Set;try{const n=JSON.parse(a(i(t.cwd,ie),"utf8")),s=["dependencies","peerDependencies","optionalDependencies"];!0===n.private&&s.push("devDependencies");for(const t of s)for(const i of Object.keys(n[t]??{}))e.add(i)}catch{}const n=[],o=e=>{try{n.push({text:a(e,"utf8"),path:e})}catch{}},l=e=>r(i(t.cwd,"node_modules",e,ie));for(const n of[...e].sort())if(l(n))for(const e of[se,oe])o(i(t.cwd,"node_modules",n,"dist",e));for(const e of t.copyIndexFiles??[]){let t;try{t=JSON.parse(a(e,"utf8")).package}catch{t=void 0}t&&l(t)||o(e)}const c=ge(n,e);if(c.problems.length)return s(c.problems.join("\n "));h=c.index}const m=function(e,t,n,s,o){const l=[],c=F(n.exclude),d=F(n.output.flatMap(e=>e.files)),u=new Map,p=e=>{let n=u.get(e);return void 0===n&&u.set(e,n=a(i(t,e),"utf8")),n},f=(e,n)=>{for(const i of e)0===J(t,[i]).length&&l.push(`${n}: "${i}" matches no file. Delete the line, or fix the path.`)};f(n.include,'"include"'),n.output.forEach((e,t)=>f(e.files,`"output"[${t}]`)),n.includeImporting.forEach((e,t)=>f(e.files,`"includeImporting"[${t}]`)),f(n.includeCopies,'"includeCopies"'),f(n.includeValues,'"includeValues"'),!n.kinds.includes("shell-part-copy")||s&&0!==s.size||l.push('"kinds" includes "shell-part-copy", and the shell\'s export list could not be read beside this command. Reinstall efficient-shell.');for(const e of["copied-value","copied-routine"])!n.kinds.includes(e)||o&&0!==o.packages.length||l.push(`"kinds" includes "${e}", and no package this repository declares ships a copy index (dist/value-index.json, dist/routine-index.json) that could be read. Upgrade the package, or take the kind out.`);const h=new Set,m=v(n.kinds),g=e=>(qt(e)||m&&Kt(e))&&!c(e)&&!d(e);for(const e of J(t,n.include))g(e)&&h.add(e);for(const i of n.includeImporting)for(const n of J(t,i.files))g(n)&&qt(n)&&!h.has(n)&&sn(e,n,p(n),i.modules)&&h.add(n);const x=n.kinds.filter(j),w=new Map,$=(e,t)=>w.set(e,n.kinds.filter(n=>t.includes(n)||(w.get(e)??[]).includes(n)));if(x.length)for(const e of J(t,n.includeCopies))!qt(e)||c(e)||h.has(e)||$(e,x);const b=n.kinds.filter(E);if(b.length){const e=v(b);for(const i of J(t,n.includeValues))!(qt(i)||e&&Kt(i))||c(i)||h.has(i)||$(i,b)}const k=new Set(w.keys()),S=[...h,...k].sort(),T=n.kinds.filter(e=>!y(e)),z=new Map,A=new Map,N=new Set,I=new Map;for(const t of S){const n=w.get(t),i=n??T,r=Kt(t)?Vt(p(t),i):Gt(e,t,p(t),i,n?void 0:N,s??void 0,o?{index:o,instead:(e,n,i)=>{const s=K(t,e);I.has(s)||I.set(s,new Map),I.get(s).set(n,i)}}:void 0);let a=!1;for(const e of i){const n=r[e]?.length??0;n&&(A.set(K(t,e),n),a=!0)}a&&z.set(t,r)}let C=[],D=[],R=[];const O=n.kinds.filter(y);if(O.length){const e=i(t,ie);if(r(e)){const t=JSON.parse(a(e,"utf8")),i=["dependencies","peerDependencies","optionalDependencies"].flatMap(e=>Object.keys(t[e]??{})),s=new Set([...N].flatMap(e=>L[e]??[])),o=[...new Set(i)].sort();if(n.kinds.includes("kit-dep")){const e=o.filter(e=>"kit-dep"===M(e));C=e.filter(e=>!s.has(e)),D=e.filter(e=>s.has(e)),C.length&&A.set(K(ie,"kit-dep"),C.length)}n.kinds.includes("chart-dep")&&(R=o.filter(e=>"chart-dep"===M(e)),R.length&&A.set(K(ie,"chart-dep"),R.length))}else for(const e of O)l.push(`"kinds" includes "${e}", and there is no ${ie} here to read.`)}for(const e of n.allow)(y(e.kind)?e.file===ie:h.has(e.file)||(w.get(e.file)??[]).includes(e.kind))||l.push(`"allow": ${e.file} (${e.kind}) is not a file this check reads. Delete the entry, or fix the path.`);return{files:S,copyOnly:[...k].sort(),partial:w,hits:z,counts:A,kitDeps:C,shellPeers:D,chartDeps:R,problems:l,instead:I}}(u,t.cwd,d,f,h);if(0===m.files.length)return s(`read no files. "include" in ${On} matches nothing, so a pass would mean nothing.`);const g=i(t.cwd,Bn),x=n.json,$=e=>{x||t.out(e)};if(n.print)return t.out(Z(ln(d,m,d.kinds)).trimEnd()),0;if(n.summary){for(const e of function(e,t){const n=new Map,i=new Map;for(const[e,s]of t.counts){const{file:t,kind:o}=H(e);if(!w(o))continue;const r=n.get(o)??{count:0,files:new Set};r.count+=s,r.files.add(t),n.set(o,r);const a=t.split("/"),l=a.length>2?a.slice(0,2).join("/"):2===a.length?a[0]:".",c=i.get(l)??{};c[o]=(c[o]??0)+s,i.set(l,c)}const s=e.kinds.filter(e=>n.has(e)),o=[`**UI kit check (harness UI-24):** ${new Set([...t.counts.keys()].map(e=>H(e).file)).size} of ${Wn(t.files.length,"file")} still draw UI of their own.`,"","| Kind | Count | Files | The shell has |","|---|---:|---:|---|",...e.kinds.map(e=>{const t=n.get(e);return`| \`${e}\` | ${t?.count??0} | ${t?.files.size??0} | ${z[e].instead} |`})];if(s.length&&i.size){const e=e=>s.reduce((t,n)=>t+(e[n]??0),0),t=[...i].sort((t,n)=>e(n[1])-e(t[1])||(t[0]<n[0]?-1:1));o.push("",`| Folder | ${s.map(e=>`\`${e}\``).join(" | ")} | Total |`,`|---|${s.map(()=>"---:").join("|")}|---:|`,...t.map(([t,n])=>`| \`${t}\` | ${s.map(e=>n[e]??0).join(" | ")} | ${e(n)} |`))}return o}(d,m))t.out(e);return 0}let b=null;if(r(g))try{b=Y(a(g,"utf8"),Bn)}catch(e){return s(e instanceof q?e.message:String(e))}if(n.init){const e=n.kinds.filter(e=>!w(e)||!d.kinds.includes(e));if(e.length)return s(`--kind ${e.join(", ")}: not in "kinds" in ${On}. Add it there first.`);const t=n.kinds;if(b){if(0===t.length)return s(`${Bn} already exists, and --init would overwrite what it holds. It is for the adoption pull request only. To start checking a kind, add it to "kinds" and run --init --kind <kind>.`);const e=t.filter(e=>b.kinds.includes(e));if(e.length)return s(`the baseline was already taken for ${e.join(", ")}. Its lines only go down; use --update.`);const n=ln(d,m,t);b={kinds:[...b.kinds,...t],counts:new Map([...b.counts,...n.counts])}}else{if(t.length)return s(`there is no ${Bn} yet. Run --init on its own first.`);b=ln(d,m,d.kinds)}l(g,Z(b)),$(`${Fn}: wrote ${Bn} (${Wn(b.counts.size,"line")}: ${Un(b.counts,b.kinds)})`)}if(!b)return s(`no ${Bn}. This repository has not adopted the check yet: run ${Fn} --init, and commit the file.`);if(n.update){const e=function(e,t,n,{allowMove:i=!1}={}){const s=rn(e,t),o=ln(e,n,s),r=new Map([...t.counts].filter(([e])=>s.includes(H(e).kind)));if(i){const e=Q(r),n=Q(o.counts),i=s.filter(t=>(n[t]??0)>(e[t]??0)).map(t=>`${t}: ${n[t]??0} across the repository, and the baseline holds ${e[t]??0}`);return i.length?{baseline:t,lowered:0,refused:i}:{baseline:o,lowered:cn(r,o.counts),refused:[]}}const a=new Map;for(const[e,t]of r){const n=Math.min(t,o.counts.get(e)??0);n>0&&a.set(e,n)}return{baseline:{kinds:s,counts:a},lowered:cn(r,a),refused:[]}}(d,b,m,{allowMove:n.allowMove});if(e.refused.length)return s(`--allow-move follows code that moved, and this is more of it than before:\n - ${e.refused.join("\n - ")}\nNothing was written.`);b=e.baseline,l(g,Z(b)),$(`${Fn}: ${e.lowered?`changed ${Wn(e.lowered,"line")} in`:"nothing to change in"} ${Bn}`)}const k=function(e,t,n){const i=[],s=[],o=[...n.problems],r=on(e),a=new Set(rn(e,t)),l=e.kinds.filter(e=>!t.kinds.includes(e));l.length&&o.push(`"kinds" names ${l.map(e=>`"${e}"`).join(", ")}, and the baseline was never taken for ${1===l.length?"it":"them"}. Run: efficient-shell-ui-check --init ${l.map(e=>`--kind ${e}`).join(" ")}`);const c=t.kinds.filter(t=>!e.kinds.includes(t));c.length&&s.push(`the baseline still carries ${c.map(e=>`"${e}"`).join(", ")}, which "kinds" no longer names`);const d=new Set([...n.counts.keys(),...t.counts.keys(),...r.keys()]);for(const e of[...d].sort(G)){const{file:l,kind:c}=H(e);if(!w(c)||!a.has(c))continue;const d=n.counts.get(e)??0,u=r.get(e)??0,p=t.counts.get(e)??0;d>u+p?i.push(`${l}: ${c} ${d}, and its line allows ${u+p}${an(n,l,c)}. ${z[c].counts} is counted; use ${z[c].instead}.`):d<u?o.push(`${l}: ${c} ${d}, and "allow" in ui-kit.config.json says ${u}. ${0===d?"Delete the entry":`Lower its count to ${d}`}: an exception does not outlive what it excused.`):d<u+p&&s.push(`${l}: ${c} ${d}, and its line says ${u+p}`)}return{grown:i,shrunk:s,other:o,updateFixes:0===i.length&&0===o.length&&s.length>0}}(d,b,m),S=n.noBase?{problems:[],note:"",warnings:[]}:Kn(t,u,b,d,m,f,h),T=d.kinds.filter(e=>b.kinds.includes(e)),A=`${Fn} --update`,N=[...k.other,...k.grown,...k.shrunk.map(e=>`${e}. Run: ${A}`),...S.problems],I=0===N.length;if(n.json){const e=on(d);return t.out(JSON.stringify({tool:Fn,version:t.version,ok:I,schema:d.schema,kinds:d.kinds,files:m.files.length,counts:Q(m.counts),baseline:Q(b.counts),allowed:Q(e),kitDeps:m.kitDeps,shellPeers:m.shellPeers,chartDeps:m.chartDeps,failures:N,warnings:S.warnings},null,2)),I?0:1}t.out(`UI kit check (harness UI-24), efficient-shell ${t.version}\n`);const C=(e,n,i="")=>{if(0===n.length)return t.out(` ok ${e}`);t.err(` FAIL ${e}`);for(const e of n)t.err(` ${e}`);i&&t.err(` ${i}`)};t.out(` ok the reader reads its own fixtures (typescript ${u.version})`),t.out(` ok read ${Wn(m.files.length,"file")}`),C(`${On} and ${Bn} describe this repository`,k.other),C("no file draws more of its own UI than its line allows",k.grown),C("every line is exact: a count that fell is a line to lower",k.shrunk,`Run: ${A}${k.updateFixes?"":" (after the failures above are fixed)"}`),S.note&&C(`the baseline is no higher than the base branch (${S.note})`,S.problems);for(const e of S.warnings)t.err(`::warning title=${Fn}::${e}`);const D=new Set([...m.counts.keys()].map(e=>H(e).file));return t.out(` ok PROGRESS: ${D.size} of ${Wn(m.files.length,"file")} still draw UI of their own: `+Un(m.counts,T)),t.out(""),I?t.out("UI kit check: ok"):t.err(`UI kit check: FAILED (${Wn(N.length,"problem")})`),I?0:1}(process.argv.slice(2),{cwd:process.cwd(),env:process.env,out:e=>console.log(e),err:e=>console.error(e),loadTypeScript:()=>h(import.meta.url),git:function(t){try{return e("git",t,{cwd:process.cwd(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:6e4,maxBuffer:67108864})}catch{return null}},gitDetail:function(t,n){try{return{out:e("git",t,{cwd:process.cwd(),encoding:"utf8",stdio:["ignore","pipe","pipe"],timeout:n,maxBuffer:67108864}),error:""}}catch(e){const t=e;if("ETIMEDOUT"===t.code||"SIGTERM"===t.signal)return{out:null,error:`timed out after ${Math.round(n/1e3)} s`};return{out:null,error:(String(t.stderr??"").trim().replace(/\s+/g," ")||t.message||"git failed").slice(-500)}}},sleep:function(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},shellPartFiles:["../index.js","../ui/index.js"].map(e=>t(new URL(e,import.meta.url))),copyIndexFiles:["../value-index.json","../routine-index.json"].map(e=>t(new URL(e,import.meta.url))),version:"16.6.0"});