@utilix-tech/sdk 0.4.0 → 0.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.
package/dist/index.cjs CHANGED
@@ -1736,13 +1736,7 @@ function generateMd5Hash(password) {
1736
1736
  return "$apr1$" + md5__default.default(password);
1737
1737
  }
1738
1738
  function generateBcryptHash(password, rounds = 10) {
1739
- const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789./";
1740
- let salt = "";
1741
- for (let i = 0; i < 22; i++) salt += chars[Math.floor(Math.random() * chars.length)];
1742
- const roundStr = rounds.toString().padStart(2, "0");
1743
- let hash = "";
1744
- for (let i = 0; i < 31; i++) hash += chars[Math.floor(Math.random() * chars.length)];
1745
- return `$2b$${roundStr}$${salt}${hash}`;
1739
+ return bcrypt__default.default.hashSync(password, rounds);
1746
1740
  }
1747
1741
  function generatePlain(password) {
1748
1742
  return password;
@@ -1751,7 +1745,7 @@ function createEntry(username, password, algorithm = "bcrypt") {
1751
1745
  let hashedPassword;
1752
1746
  switch (algorithm) {
1753
1747
  case "bcrypt":
1754
- hashedPassword = generateBcryptHash();
1748
+ hashedPassword = generateBcryptHash(password);
1755
1749
  break;
1756
1750
  case "sha1":
1757
1751
  hashedPassword = generateSha1Hash(password);
@@ -8894,6 +8888,7 @@ __export(api_exports, {
8894
8888
  parseCspHeader: () => parseCspHeader,
8895
8889
  parseCurl: () => parseCurl,
8896
8890
  parseCurlCommand: () => parseCurlCommand,
8891
+ parseJwks: () => parseJwks,
8897
8892
  parseMetaTags: () => parseMetaTags,
8898
8893
  parseUrl: () => parseUrl,
8899
8894
  removeParam: () => removeParam,
@@ -9343,6 +9338,55 @@ function decodeJwt(token) {
9343
9338
  function formatJwtJson(obj) {
9344
9339
  return JSON.stringify(obj, null, 2);
9345
9340
  }
9341
+ function base64urlByteLength(s) {
9342
+ const clean = s.replace(/=+$/, "");
9343
+ return Math.floor(clean.length * 6 / 8);
9344
+ }
9345
+ function parseJwks(input) {
9346
+ const trimmed = input.trim();
9347
+ if (!trimmed) return { ok: false, error: "No input provided" };
9348
+ let data;
9349
+ try {
9350
+ data = JSON.parse(trimmed);
9351
+ } catch (e) {
9352
+ return { ok: false, error: `Invalid JSON: ${e instanceof Error ? e.message : String(e)}` };
9353
+ }
9354
+ let rawKeys;
9355
+ if (data && typeof data === "object" && Array.isArray(data.keys)) {
9356
+ rawKeys = data.keys;
9357
+ } else if (data && typeof data === "object" && typeof data.kty === "string") {
9358
+ rawKeys = [data];
9359
+ } else {
9360
+ return { ok: false, error: 'Input must be a JWKS object with a "keys" array, or a single JWK object with a "kty" field' };
9361
+ }
9362
+ const keys = rawKeys.map((k) => {
9363
+ const key = k ?? {};
9364
+ const kty = typeof key.kty === "string" ? key.kty : "unknown";
9365
+ let keySize = null;
9366
+ let curve;
9367
+ if (kty === "RSA" && typeof key.n === "string") {
9368
+ keySize = base64urlByteLength(key.n) * 8;
9369
+ } else if ((kty === "EC" || kty === "OKP") && typeof key.crv === "string") {
9370
+ curve = key.crv;
9371
+ } else if (kty === "oct" && typeof key.k === "string") {
9372
+ keySize = base64urlByteLength(key.k) * 8;
9373
+ }
9374
+ return {
9375
+ kty,
9376
+ use: typeof key.use === "string" ? key.use : void 0,
9377
+ keyOps: Array.isArray(key.key_ops) ? key.key_ops.filter((x) => typeof x === "string") : void 0,
9378
+ alg: typeof key.alg === "string" ? key.alg : void 0,
9379
+ kid: typeof key.kid === "string" ? key.kid : void 0,
9380
+ keySize,
9381
+ curve,
9382
+ raw: key
9383
+ };
9384
+ });
9385
+ const kidCounts = /* @__PURE__ */ new Map();
9386
+ for (const k of keys) if (k.kid) kidCounts.set(k.kid, (kidCounts.get(k.kid) ?? 0) + 1);
9387
+ const duplicateKids = [...kidCounts.entries()].filter(([, c]) => c > 1).map(([kid]) => kid);
9388
+ return { ok: true, keys, count: keys.length, duplicateKids };
9389
+ }
9346
9390
  var ALG_TO_NODE_HASH = {
9347
9391
  HS256: "sha256",
9348
9392
  HS384: "sha384",
@@ -16884,7 +16928,9 @@ function summarizeForLlm(text, maxTokens = 200, strategy = "extractive") {
16884
16928
  // src/tools/media.ts
16885
16929
  var media_exports = {};
16886
16930
  __export(media_exports, {
16887
- readImageInfo: () => readImageInfo
16931
+ readExifData: () => readExifData,
16932
+ readImageInfo: () => readImageInfo,
16933
+ readPdfMetadata: () => readPdfMetadata
16888
16934
  });
16889
16935
  function readU32BE(bytes, offset) {
16890
16936
  return (bytes[offset] << 24 | bytes[offset + 1] << 16 | bytes[offset + 2] << 8 | bytes[offset + 3]) >>> 0;
@@ -17011,6 +17057,337 @@ function readImageInfo(bytes) {
17011
17057
  }
17012
17058
  return { error: "Unrecognized image format. Supported formats: PNG, JPEG, GIF, WebP, BMP" };
17013
17059
  }
17060
+ var ORIENTATION_LABELS = {
17061
+ 1: "Normal",
17062
+ 2: "Mirrored horizontal",
17063
+ 3: "Rotated 180\xB0",
17064
+ 4: "Mirrored vertical",
17065
+ 5: "Mirrored horizontal, rotated 90\xB0 CCW",
17066
+ 6: "Rotated 90\xB0 CW",
17067
+ 7: "Mirrored horizontal, rotated 90\xB0 CW",
17068
+ 8: "Rotated 90\xB0 CCW"
17069
+ };
17070
+ function tu16(r, o) {
17071
+ return r.view.getUint16(o, r.little);
17072
+ }
17073
+ function tu32(r, o) {
17074
+ return r.view.getUint32(o, r.little);
17075
+ }
17076
+ function readIfdEntries(r, ifdOffset) {
17077
+ if (ifdOffset < 0 || ifdOffset + 2 > r.bytes.length) return null;
17078
+ const numEntries = tu16(r, ifdOffset);
17079
+ const entries = [];
17080
+ for (let i = 0; i < numEntries; i++) {
17081
+ const entryOffset = ifdOffset + 2 + i * 12;
17082
+ if (entryOffset + 12 > r.bytes.length) break;
17083
+ entries.push({
17084
+ tag: tu16(r, entryOffset),
17085
+ type: tu16(r, entryOffset + 2),
17086
+ count: tu32(r, entryOffset + 4),
17087
+ valueOffsetField: entryOffset + 8
17088
+ });
17089
+ }
17090
+ return { entries };
17091
+ }
17092
+ function findEntry(entries, tag) {
17093
+ return entries.find((e) => e.tag === tag);
17094
+ }
17095
+ function readAscii(r, entry) {
17096
+ const size = entry.count;
17097
+ const inline = size <= 4;
17098
+ const dataOffset = inline ? entry.valueOffsetField : r.tiffStart + tu32(r, entry.valueOffsetField);
17099
+ if (dataOffset < 0 || dataOffset + size > r.bytes.length) return null;
17100
+ let out = "";
17101
+ for (let i = 0; i < size; i++) {
17102
+ const c = r.bytes[dataOffset + i];
17103
+ if (c === 0) break;
17104
+ out += String.fromCharCode(c);
17105
+ }
17106
+ const trimmed = out.trim();
17107
+ return trimmed || null;
17108
+ }
17109
+ function readRational(r, entry) {
17110
+ const dataOffset = r.tiffStart + tu32(r, entry.valueOffsetField);
17111
+ if (dataOffset < 0 || dataOffset + 8 > r.bytes.length) return null;
17112
+ return { num: tu32(r, dataOffset), den: tu32(r, dataOffset + 4) };
17113
+ }
17114
+ function readGpsCoordinate(r, entries, valueTag, refTag) {
17115
+ const valueEntry = findEntry(entries, valueTag);
17116
+ if (!valueEntry) return null;
17117
+ const dataOffset = r.tiffStart + tu32(r, valueEntry.valueOffsetField);
17118
+ if (dataOffset < 0 || dataOffset + 24 > r.bytes.length) return null;
17119
+ const deg = tu32(r, dataOffset) / (tu32(r, dataOffset + 4) || 1);
17120
+ const min = tu32(r, dataOffset + 8) / (tu32(r, dataOffset + 12) || 1);
17121
+ const sec = tu32(r, dataOffset + 16) / (tu32(r, dataOffset + 20) || 1);
17122
+ let decimal = deg + min / 60 + sec / 3600;
17123
+ const refEntry = findEntry(entries, refTag);
17124
+ const ref = refEntry ? readAscii(r, refEntry) : null;
17125
+ if (ref === "S" || ref === "W") decimal = -decimal;
17126
+ return Math.round(decimal * 1e6) / 1e6;
17127
+ }
17128
+ function gcd2(a, b) {
17129
+ return b === 0 ? a : gcd2(b, a % b);
17130
+ }
17131
+ function round2(n) {
17132
+ return Math.round(n * 100) / 100;
17133
+ }
17134
+ function formatExposureTime(num, den) {
17135
+ if (num === 0) return "0s";
17136
+ if (num >= den) return `${round2(num / den)}s`;
17137
+ const divisor = gcd2(num, den) || 1;
17138
+ const n = num / divisor;
17139
+ const d = den / divisor;
17140
+ return `1/${Math.round(d / n)}`;
17141
+ }
17142
+ function readExifData(bytes) {
17143
+ if (bytes.length < 4 || bytes[0] !== 255 || bytes[1] !== 216) {
17144
+ return { error: "Not a JPEG file (EXIF is only read from JPEG files)" };
17145
+ }
17146
+ let offset = 2;
17147
+ let exifStart = -1;
17148
+ while (offset + 4 <= bytes.length) {
17149
+ if (bytes[offset] !== 255) {
17150
+ offset++;
17151
+ continue;
17152
+ }
17153
+ const marker = bytes[offset + 1];
17154
+ if (marker === 216 || marker === 1 || marker >= 208 && marker <= 215) {
17155
+ offset += 2;
17156
+ continue;
17157
+ }
17158
+ if (marker === 217 || marker === 218) break;
17159
+ const segmentLength = bytes[offset + 2] << 8 | bytes[offset + 3];
17160
+ if (marker === 225) {
17161
+ const idOffset = offset + 4;
17162
+ if (idOffset + 6 <= bytes.length && bytes[idOffset] === 69 && bytes[idOffset + 1] === 120 && bytes[idOffset + 2] === 105 && bytes[idOffset + 3] === 102 && bytes[idOffset + 4] === 0 && bytes[idOffset + 5] === 0) {
17163
+ exifStart = idOffset + 6;
17164
+ break;
17165
+ }
17166
+ }
17167
+ offset += 2 + segmentLength;
17168
+ }
17169
+ if (exifStart === -1) return { error: "No EXIF segment found in this JPEG" };
17170
+ if (exifStart + 8 > bytes.length) return { error: "Truncated EXIF segment" };
17171
+ const byteOrder = String.fromCharCode(bytes[exifStart], bytes[exifStart + 1]);
17172
+ if (byteOrder !== "II" && byteOrder !== "MM") return { error: "Invalid TIFF byte order marker in EXIF data" };
17173
+ const little = byteOrder === "II";
17174
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
17175
+ const r = { bytes, view, little, tiffStart: exifStart };
17176
+ if (tu16(r, exifStart + 2) !== 42) return { error: "Invalid TIFF magic number in EXIF data" };
17177
+ const ifd0Offset = exifStart + tu32(r, exifStart + 4);
17178
+ const ifd0 = readIfdEntries(r, ifd0Offset);
17179
+ if (!ifd0) return { error: "Could not read IFD0 from EXIF data" };
17180
+ const result = { tagCount: ifd0.entries.length };
17181
+ const makeEntry = findEntry(ifd0.entries, 271);
17182
+ if (makeEntry) {
17183
+ const v = readAscii(r, makeEntry);
17184
+ if (v) result.make = v;
17185
+ }
17186
+ const modelEntry = findEntry(ifd0.entries, 272);
17187
+ if (modelEntry) {
17188
+ const v = readAscii(r, modelEntry);
17189
+ if (v) result.model = v;
17190
+ }
17191
+ const softwareEntry = findEntry(ifd0.entries, 305);
17192
+ if (softwareEntry) {
17193
+ const v = readAscii(r, softwareEntry);
17194
+ if (v) result.software = v;
17195
+ }
17196
+ const dateTimeEntry = findEntry(ifd0.entries, 306);
17197
+ if (dateTimeEntry) {
17198
+ const v = readAscii(r, dateTimeEntry);
17199
+ if (v) result.dateTime = v;
17200
+ }
17201
+ const orientEntry = findEntry(ifd0.entries, 274);
17202
+ if (orientEntry) {
17203
+ const v = tu16(r, orientEntry.valueOffsetField);
17204
+ result.orientation = v;
17205
+ result.orientationLabel = ORIENTATION_LABELS[v] ?? "Unknown";
17206
+ }
17207
+ const exifIfdPtr = findEntry(ifd0.entries, 34665);
17208
+ if (exifIfdPtr) {
17209
+ const subOffset = exifStart + tu32(r, exifIfdPtr.valueOffsetField);
17210
+ const sub = readIfdEntries(r, subOffset);
17211
+ if (sub) {
17212
+ const dtoEntry = findEntry(sub.entries, 36867);
17213
+ if (dtoEntry) {
17214
+ const v = readAscii(r, dtoEntry);
17215
+ if (v) result.dateTimeOriginal = v;
17216
+ }
17217
+ const expEntry = findEntry(sub.entries, 33434);
17218
+ if (expEntry) {
17219
+ const rat = readRational(r, expEntry);
17220
+ if (rat && rat.den !== 0) result.exposureTime = formatExposureTime(rat.num, rat.den);
17221
+ }
17222
+ const fEntry = findEntry(sub.entries, 33437);
17223
+ if (fEntry) {
17224
+ const rat = readRational(r, fEntry);
17225
+ if (rat && rat.den !== 0) result.fNumber = round2(rat.num / rat.den);
17226
+ }
17227
+ const isoEntry = findEntry(sub.entries, 34855);
17228
+ if (isoEntry) result.isoSpeed = tu16(r, isoEntry.valueOffsetField);
17229
+ const focalEntry = findEntry(sub.entries, 37386);
17230
+ if (focalEntry) {
17231
+ const rat = readRational(r, focalEntry);
17232
+ if (rat && rat.den !== 0) result.focalLength = round2(rat.num / rat.den);
17233
+ }
17234
+ }
17235
+ }
17236
+ const gpsIfdPtr = findEntry(ifd0.entries, 34853);
17237
+ if (gpsIfdPtr) {
17238
+ const gpsOffset = exifStart + tu32(r, gpsIfdPtr.valueOffsetField);
17239
+ const gps = readIfdEntries(r, gpsOffset);
17240
+ if (gps) {
17241
+ const lat = readGpsCoordinate(r, gps.entries, 2, 1);
17242
+ const lon = readGpsCoordinate(r, gps.entries, 4, 3);
17243
+ if (lat !== null) result.gpsLatitude = lat;
17244
+ if (lon !== null) result.gpsLongitude = lon;
17245
+ }
17246
+ }
17247
+ return result;
17248
+ }
17249
+ function bytesToLatin1(bytes) {
17250
+ let out = "";
17251
+ const CHUNK = 32768;
17252
+ for (let i = 0; i < bytes.length; i += CHUNK) {
17253
+ out += String.fromCharCode(...bytes.subarray(i, i + CHUNK));
17254
+ }
17255
+ return out;
17256
+ }
17257
+ function decodePdfString(raw, isHex) {
17258
+ const bytes = [];
17259
+ if (isHex) {
17260
+ const hex = raw.replace(/\s+/g, "");
17261
+ const padded = hex.length % 2 === 0 ? hex : hex + "0";
17262
+ for (let i = 0; i < padded.length; i += 2) bytes.push(parseInt(padded.slice(i, i + 2), 16));
17263
+ } else {
17264
+ const s = raw.replace(/\\\r\n|\\\r|\\\n/g, "");
17265
+ for (let i = 0; i < s.length; i++) {
17266
+ const ch = s[i];
17267
+ if (ch === "\\" && i + 1 < s.length) {
17268
+ const next = s[i + 1];
17269
+ if (next === "n") {
17270
+ bytes.push(10);
17271
+ i++;
17272
+ } else if (next === "r") {
17273
+ bytes.push(13);
17274
+ i++;
17275
+ } else if (next === "t") {
17276
+ bytes.push(9);
17277
+ i++;
17278
+ } else if (next === "b") {
17279
+ bytes.push(8);
17280
+ i++;
17281
+ } else if (next === "f") {
17282
+ bytes.push(12);
17283
+ i++;
17284
+ } else if (next === "(" || next === ")" || next === "\\") {
17285
+ bytes.push(next.charCodeAt(0));
17286
+ i++;
17287
+ } else if (/[0-7]/.test(next)) {
17288
+ let oct = next;
17289
+ i++;
17290
+ for (let k = 0; k < 2 && i + 1 < s.length && /[0-7]/.test(s[i + 1]); k++) {
17291
+ i++;
17292
+ oct += s[i];
17293
+ }
17294
+ bytes.push(parseInt(oct, 8) & 255);
17295
+ } else {
17296
+ bytes.push(next.charCodeAt(0));
17297
+ i++;
17298
+ }
17299
+ } else {
17300
+ bytes.push(ch.charCodeAt(0) & 255);
17301
+ }
17302
+ }
17303
+ }
17304
+ if (bytes.length >= 2 && bytes[0] === 254 && bytes[1] === 255) {
17305
+ let out = "";
17306
+ for (let i = 2; i + 1 < bytes.length; i += 2) out += String.fromCharCode(bytes[i] << 8 | bytes[i + 1]);
17307
+ return out;
17308
+ }
17309
+ return bytes.map((b) => String.fromCharCode(b)).join("");
17310
+ }
17311
+ function extractDictField(dict, key) {
17312
+ const litMatch = dict.match(new RegExp(`/${key}\\s*\\(((?:\\\\.|[^\\\\()])*)\\)`));
17313
+ if (litMatch) return decodePdfString(litMatch[1], false);
17314
+ const hexMatch = dict.match(new RegExp(`/${key}\\s*<([0-9A-Fa-f\\s]*)>`));
17315
+ if (hexMatch) return decodePdfString(hexMatch[1], true);
17316
+ return null;
17317
+ }
17318
+ function findObject(text, objNum, gen) {
17319
+ const m = text.match(new RegExp(`(?:^|[^0-9])${objNum}\\s+${gen}\\s+obj([\\s\\S]*?)endobj`));
17320
+ return m ? m[1] : null;
17321
+ }
17322
+ function parsePdfDate(raw) {
17323
+ const m = raw.match(/^D:(\d{4})(\d{2})?(\d{2})?(\d{2})?(\d{2})?(\d{2})?([Z+-])?(\d{2})?'?(\d{2})?'?/);
17324
+ if (!m) return null;
17325
+ const [, y, mo = "01", d = "01", h = "00", mi = "00", s = "00", tz, tzh, tzm] = m;
17326
+ let iso = `${y}-${mo}-${d}T${h}:${mi}:${s}`;
17327
+ if (tz === "Z") iso += "Z";
17328
+ else if (tz === "+" || tz === "-") iso += `${tz}${tzh ?? "00"}:${tzm ?? "00"}`;
17329
+ return iso;
17330
+ }
17331
+ function readPdfMetadata(bytes) {
17332
+ if (bytes.length < 8) return { error: "File too small to be a PDF" };
17333
+ const header = bytesToLatin1(bytes.subarray(0, 16));
17334
+ const versionMatch = header.match(/%PDF-(\d\.\d)/);
17335
+ if (!versionMatch) return { error: "Not a valid PDF file (missing %PDF header)" };
17336
+ const version2 = versionMatch[1];
17337
+ const text = bytesToLatin1(bytes);
17338
+ const trailerMatches = [...text.matchAll(/trailer\s*<<([\s\S]*?)>>/g)];
17339
+ let infoDict = null;
17340
+ let encrypted = false;
17341
+ if (trailerMatches.length > 0) {
17342
+ const trailer = trailerMatches[trailerMatches.length - 1][1];
17343
+ encrypted = /\/Encrypt\s+\d+\s+\d+\s+R/.test(trailer);
17344
+ const infoRef = trailer.match(/\/Info\s+(\d+)\s+(\d+)\s+R/);
17345
+ if (infoRef) infoDict = findObject(text, Number(infoRef[1]), Number(infoRef[2]));
17346
+ }
17347
+ const objBlocks = [...text.matchAll(/(\d+)\s+(\d+)\s+obj([\s\S]*?)endobj/g)];
17348
+ if (!infoDict) {
17349
+ for (const b of objBlocks) {
17350
+ if (/\/(Title|Author|Producer|Creator|CreationDate)\b/.test(b[3]) && !/\/Type\s*\/(Page|Pages|Catalog|Font)\b/.test(b[3])) {
17351
+ infoDict = b[3];
17352
+ break;
17353
+ }
17354
+ }
17355
+ }
17356
+ const title = infoDict ? extractDictField(infoDict, "Title") : null;
17357
+ const author = infoDict ? extractDictField(infoDict, "Author") : null;
17358
+ const subject = infoDict ? extractDictField(infoDict, "Subject") : null;
17359
+ const keywords = infoDict ? extractDictField(infoDict, "Keywords") : null;
17360
+ const creator = infoDict ? extractDictField(infoDict, "Creator") : null;
17361
+ const producer = infoDict ? extractDictField(infoDict, "Producer") : null;
17362
+ const creationDateRaw = infoDict ? extractDictField(infoDict, "CreationDate") : null;
17363
+ const modDateRaw = infoDict ? extractDictField(infoDict, "ModDate") : null;
17364
+ let pageCount = null;
17365
+ for (const b of objBlocks) {
17366
+ if (!/\/Type\s*\/Pages\b/.test(b[3])) continue;
17367
+ const countMatch = b[3].match(/\/Count\s+(\d+)/);
17368
+ if (countMatch) {
17369
+ const c = Number(countMatch[1]);
17370
+ if (pageCount === null || c > pageCount) pageCount = c;
17371
+ }
17372
+ }
17373
+ if (pageCount === null) {
17374
+ const pageMatches = text.match(/\/Type\s*\/Page(?!s)\b/g);
17375
+ if (pageMatches) pageCount = pageMatches.length;
17376
+ }
17377
+ return {
17378
+ version: version2,
17379
+ pageCount,
17380
+ title,
17381
+ author,
17382
+ subject,
17383
+ keywords,
17384
+ creator,
17385
+ producer,
17386
+ creationDate: creationDateRaw ? parsePdfDate(creationDateRaw) ?? creationDateRaw : null,
17387
+ modDate: modDateRaw ? parsePdfDate(modDateRaw) ?? modDateRaw : null,
17388
+ encrypted
17389
+ };
17390
+ }
17014
17391
 
17015
17392
  // src/index.ts
17016
17393
  var version = "0.1.0";
package/dist/index.d.cts CHANGED
@@ -7,13 +7,13 @@ export { g as generators } from './generators-BGtRGpJZ.cjs';
7
7
  export { t as time } from './time-DbT8fjaF.cjs';
8
8
  export { u as units } from './units-6lwDYBvX.cjs';
9
9
  export { n as network } from './network-DwyAjwJS.cjs';
10
- export { a as api } from './api-8aZtWhSj.cjs';
10
+ export { a as api } from './api-Xl7OzIgq.cjs';
11
11
  export { c as code } from './code-BUqyaofO.cjs';
12
12
  export { c as color } from './color-tPwZCr9H.cjs';
13
13
  export { c as css } from './css-Cf7AMGM-.cjs';
14
14
  export { m as misc } from './misc-CA3N198T.cjs';
15
15
  export { a as ai_agent } from './ai_agent-CcpkV2DR.cjs';
16
- export { m as media } from './media-DF2cx3pK.cjs';
16
+ export { m as media } from './media-CHaBS1dI.cjs';
17
17
 
18
18
  declare const version = "0.1.0";
19
19
 
package/dist/index.d.ts CHANGED
@@ -7,13 +7,13 @@ export { g as generators } from './generators-BGtRGpJZ.js';
7
7
  export { t as time } from './time-DbT8fjaF.js';
8
8
  export { u as units } from './units-6lwDYBvX.js';
9
9
  export { n as network } from './network-DwyAjwJS.js';
10
- export { a as api } from './api-8aZtWhSj.js';
10
+ export { a as api } from './api-Xl7OzIgq.js';
11
11
  export { c as code } from './code-BUqyaofO.js';
12
12
  export { c as color } from './color-tPwZCr9H.js';
13
13
  export { c as css } from './css-Cf7AMGM-.js';
14
14
  export { m as misc } from './misc-CA3N198T.js';
15
15
  export { a as ai_agent } from './ai_agent-CcpkV2DR.js';
16
- export { m as media } from './media-DF2cx3pK.js';
16
+ export { m as media } from './media-CHaBS1dI.js';
17
17
 
18
18
  declare const version = "0.1.0";
19
19
 
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- export { media_exports as media } from './chunk-N7C52YGL.js';
1
+ export { media_exports as media } from './chunk-FXBB7O5A.js';
2
2
  export { units_exports as units } from './chunk-QJE743LY.js';
3
3
  export { network_exports as network } from './chunk-V5JKVDBA.js';
4
- export { api_exports as api } from './chunk-HFRTZE7T.js';
4
+ export { api_exports as api } from './chunk-Q3B3YWOA.js';
5
5
  export { code_exports as code } from './chunk-V5S6OJ4A.js';
6
6
  export { color_exports as color } from './chunk-BPVAB4P2.js';
7
7
  export { css_exports as css } from './chunk-6YPV2AB5.js';
@@ -9,7 +9,7 @@ export { misc_exports as misc } from './chunk-GX7H6TAX.js';
9
9
  export { ai_agent_exports as ai_agent } from './chunk-M35VJETW.js';
10
10
  export { json_exports as json } from './chunk-TSAGO3XP.js';
11
11
  export { encoding_exports as encoding } from './chunk-IPR7FSX4.js';
12
- export { hashing_exports as hashing } from './chunk-FL53T24A.js';
12
+ export { hashing_exports as hashing } from './chunk-GEFVMGZR.js';
13
13
  export { text_exports as text } from './chunk-YBBYFAOV.js';
14
14
  export { data_exports as data } from './chunk-DNCOIO5N.js';
15
15
  export { generators_exports as generators } from './chunk-2CJSLYWI.js';
@@ -0,0 +1,82 @@
1
+ type ImageFormat = 'png' | 'jpeg' | 'gif' | 'webp' | 'bmp';
2
+ interface ImageInfo {
3
+ format: ImageFormat;
4
+ width: number;
5
+ height: number;
6
+ bitDepth?: number;
7
+ colorType?: string;
8
+ hasAlpha?: boolean;
9
+ }
10
+ interface ImageInfoError {
11
+ error: string;
12
+ }
13
+ /**
14
+ * Read image format, dimensions, and basic color info straight from file
15
+ * bytes — no decoding, no image library, no canvas. Supports PNG, JPEG,
16
+ * GIF, WebP, and BMP.
17
+ */
18
+ declare function readImageInfo(bytes: Uint8Array): ImageInfo | ImageInfoError;
19
+ interface ExifData {
20
+ make?: string;
21
+ model?: string;
22
+ software?: string;
23
+ orientation?: number;
24
+ orientationLabel?: string;
25
+ dateTime?: string;
26
+ dateTimeOriginal?: string;
27
+ exposureTime?: string;
28
+ fNumber?: number;
29
+ isoSpeed?: number;
30
+ focalLength?: number;
31
+ gpsLatitude?: number;
32
+ gpsLongitude?: number;
33
+ tagCount: number;
34
+ }
35
+ interface ExifError {
36
+ error: string;
37
+ }
38
+ /**
39
+ * Read common EXIF tags (make, model, orientation, timestamps, exposure
40
+ * settings, GPS coordinates) directly from a JPEG's APP1 segment. Only
41
+ * JPEG is supported: PNG, WebP, and other formats don't carry EXIF the
42
+ * same way and are rejected with an error.
43
+ */
44
+ declare function readExifData(bytes: Uint8Array): ExifData | ExifError;
45
+ interface PdfMetadata {
46
+ version: string | null;
47
+ pageCount: number | null;
48
+ title: string | null;
49
+ author: string | null;
50
+ subject: string | null;
51
+ keywords: string | null;
52
+ creator: string | null;
53
+ producer: string | null;
54
+ creationDate: string | null;
55
+ modDate: string | null;
56
+ encrypted: boolean;
57
+ }
58
+ interface PdfMetadataError {
59
+ error: string;
60
+ }
61
+ /**
62
+ * Read PDF metadata (title, author, dates, page count, encryption flag)
63
+ * straight from the file's trailer/Info dictionary and page tree — no
64
+ * pdf.js or other PDF rendering library required.
65
+ */
66
+ declare function readPdfMetadata(bytes: Uint8Array): PdfMetadata | PdfMetadataError;
67
+
68
+ type media_ExifData = ExifData;
69
+ type media_ExifError = ExifError;
70
+ type media_ImageFormat = ImageFormat;
71
+ type media_ImageInfo = ImageInfo;
72
+ type media_ImageInfoError = ImageInfoError;
73
+ type media_PdfMetadata = PdfMetadata;
74
+ type media_PdfMetadataError = PdfMetadataError;
75
+ declare const media_readExifData: typeof readExifData;
76
+ declare const media_readImageInfo: typeof readImageInfo;
77
+ declare const media_readPdfMetadata: typeof readPdfMetadata;
78
+ declare namespace media {
79
+ export { type media_ExifData as ExifData, type media_ExifError as ExifError, type media_ImageFormat as ImageFormat, type media_ImageInfo as ImageInfo, type media_ImageInfoError as ImageInfoError, type media_PdfMetadata as PdfMetadata, type media_PdfMetadataError as PdfMetadataError, media_readExifData as readExifData, media_readImageInfo as readImageInfo, media_readPdfMetadata as readPdfMetadata };
80
+ }
81
+
82
+ export { type ExifData as E, type ImageFormat as I, type PdfMetadata as P, type ExifError as a, type ImageInfo as b, type ImageInfoError as c, type PdfMetadataError as d, readImageInfo as e, readPdfMetadata as f, media as m, readExifData as r };
@@ -0,0 +1,82 @@
1
+ type ImageFormat = 'png' | 'jpeg' | 'gif' | 'webp' | 'bmp';
2
+ interface ImageInfo {
3
+ format: ImageFormat;
4
+ width: number;
5
+ height: number;
6
+ bitDepth?: number;
7
+ colorType?: string;
8
+ hasAlpha?: boolean;
9
+ }
10
+ interface ImageInfoError {
11
+ error: string;
12
+ }
13
+ /**
14
+ * Read image format, dimensions, and basic color info straight from file
15
+ * bytes — no decoding, no image library, no canvas. Supports PNG, JPEG,
16
+ * GIF, WebP, and BMP.
17
+ */
18
+ declare function readImageInfo(bytes: Uint8Array): ImageInfo | ImageInfoError;
19
+ interface ExifData {
20
+ make?: string;
21
+ model?: string;
22
+ software?: string;
23
+ orientation?: number;
24
+ orientationLabel?: string;
25
+ dateTime?: string;
26
+ dateTimeOriginal?: string;
27
+ exposureTime?: string;
28
+ fNumber?: number;
29
+ isoSpeed?: number;
30
+ focalLength?: number;
31
+ gpsLatitude?: number;
32
+ gpsLongitude?: number;
33
+ tagCount: number;
34
+ }
35
+ interface ExifError {
36
+ error: string;
37
+ }
38
+ /**
39
+ * Read common EXIF tags (make, model, orientation, timestamps, exposure
40
+ * settings, GPS coordinates) directly from a JPEG's APP1 segment. Only
41
+ * JPEG is supported: PNG, WebP, and other formats don't carry EXIF the
42
+ * same way and are rejected with an error.
43
+ */
44
+ declare function readExifData(bytes: Uint8Array): ExifData | ExifError;
45
+ interface PdfMetadata {
46
+ version: string | null;
47
+ pageCount: number | null;
48
+ title: string | null;
49
+ author: string | null;
50
+ subject: string | null;
51
+ keywords: string | null;
52
+ creator: string | null;
53
+ producer: string | null;
54
+ creationDate: string | null;
55
+ modDate: string | null;
56
+ encrypted: boolean;
57
+ }
58
+ interface PdfMetadataError {
59
+ error: string;
60
+ }
61
+ /**
62
+ * Read PDF metadata (title, author, dates, page count, encryption flag)
63
+ * straight from the file's trailer/Info dictionary and page tree — no
64
+ * pdf.js or other PDF rendering library required.
65
+ */
66
+ declare function readPdfMetadata(bytes: Uint8Array): PdfMetadata | PdfMetadataError;
67
+
68
+ type media_ExifData = ExifData;
69
+ type media_ExifError = ExifError;
70
+ type media_ImageFormat = ImageFormat;
71
+ type media_ImageInfo = ImageInfo;
72
+ type media_ImageInfoError = ImageInfoError;
73
+ type media_PdfMetadata = PdfMetadata;
74
+ type media_PdfMetadataError = PdfMetadataError;
75
+ declare const media_readExifData: typeof readExifData;
76
+ declare const media_readImageInfo: typeof readImageInfo;
77
+ declare const media_readPdfMetadata: typeof readPdfMetadata;
78
+ declare namespace media {
79
+ export { type media_ExifData as ExifData, type media_ExifError as ExifError, type media_ImageFormat as ImageFormat, type media_ImageInfo as ImageInfo, type media_ImageInfoError as ImageInfoError, type media_PdfMetadata as PdfMetadata, type media_PdfMetadataError as PdfMetadataError, media_readExifData as readExifData, media_readImageInfo as readImageInfo, media_readPdfMetadata as readPdfMetadata };
80
+ }
81
+
82
+ export { type ExifData as E, type ImageFormat as I, type PdfMetadata as P, type ExifError as a, type ImageInfo as b, type ImageInfoError as c, type PdfMetadataError as d, readImageInfo as e, readPdfMetadata as f, media as m, readExifData as r };