{"version":3,"file":"_randomFormatIdnEmail.mjs","names":[],"sources":["../../src/internal/_randomFormatIdnEmail.ts"],"sourcesContent":["import { _randomString } from \"./_randomString\";\nimport { _ILengthProps, _randomSegmentLength } from \"./_randomStringLength\";\n\n/**\n * Generate an internationalized email address at a length the bounds allow.\n *\n * Samples the ASCII subset with lowercase local/domain labels. Constrained\n * draws reserve five characters around a nonempty local part, so this shape\n * requires at least six characters and throws when the bounds exclude it.\n * Length bounds count code points; all emitted characters are ASCII.\n *\n * @evidence contracts/common.md#principled-implementation The shape mirrors the plain email generator but reserves a two-character top-level label, which the internationalized checker requires, so a constrained draw is accepted by its own validator.\n * @evidence contracts/common.md#clear-and-simple-design One function over the segment-length helper.\n * @evidence contracts/common.md#prohibited-implementation-shortcuts The overhead is the checker's.\n * @evidence contracts/common.md#meaningful-documentation Native prose identifies the sampled ASCII subset, the shortest constrained shape, code-point bounds and failure; the inline comment explains the two-character trailing label.\n */\nexport const _randomFormatIdnEmail = (props?: _ILengthProps): string => {\n  if (props?.minLength === undefined && props?.maxLength === undefined)\n    return `${random(10)}@${random(10)}.${random(3)}`;\n  // `_isFormatIdnEmail` requires a >=2-char TLD (`(…\\.)+[^…]{2,}`), so the fixed\n  // overhead is `@` + domain(1) + `.` + tld(2) = 5 and the local part absorbs the\n  // requested length; a one-character TLD (the non-idn generator's length path)\n  // would be rejected by the idn checker on every draw.\n  return `${_randomSegmentLength(props, 5, 10, 1)}@${random(1)}.${random(2)}`;\n};\n\nconst random = (length: number) =>\n  _randomString({\n    type: \"string\",\n    minLength: length,\n    maxLength: length,\n  });\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAa,yBAAyB,UAAkC;CACtE,IAAI,OAAO,cAAc,KAAA,KAAa,OAAO,cAAc,KAAA,GACzD,OAAO,GAAG,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,EAAE,GAAG,OAAO,CAAC;CAKhD,OAAO,GAAG,qBAAqB,OAAO,GAAG,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,GAAG,OAAO,CAAC;AAC1E;AAEA,MAAM,UAAU,WACd,cAAc;CACZ,MAAM;CACN,WAAW;CACX,WAAW;AACb,CAAC"}