/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/saslprep@1.0.3/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";const{unassigned_code_points:unassigned_code_points,commonly_mapped_to_nothing:commonly_mapped_to_nothing,non_ASCII_space_characters:non_ASCII_space_characters,prohibited_characters:prohibited_characters,bidirectional_r_al:bidirectional_r_al,bidirectional_l:bidirectional_l}=require("./lib/memory-code-points");module.exports=saslprep;const mapping2space=non_ASCII_space_characters,mapping2nothing=commonly_mapped_to_nothing,getCodePoint=t=>t.codePointAt(0),first=t=>t[0],last=t=>t[t.length-1];function toCodePoints(t){const e=[],o=t.length;for(let n=0;n<o;n+=1){const i=t.charCodeAt(n);if(i>=55296&&i<=56319&&o>n+1){const o=t.charCodeAt(n+1);if(o>=56320&&o<=57343){e.push(1024*(i-55296)+o-56320+65536),n+=1;continue}}e.push(i)}return e}function saslprep(t,e={}){if("string"!=typeof t)throw new TypeError("Expected string.");if(0===t.length)return"";const o=toCodePoints(t).map((t=>mapping2space.get(t)?32:t)).filter((t=>!mapping2nothing.get(t))),n=String.fromCodePoint.apply(null,o).normalize("NFKC"),i=toCodePoints(n);if(i.some((t=>prohibited_characters.get(t))))throw new Error("Prohibited character, see https://tools.ietf.org/html/rfc4013#section-2.3");if(!0!==e.allowUnassigned){if(i.some((t=>unassigned_code_points.get(t))))throw new Error("Unassigned code point, see https://tools.ietf.org/html/rfc4013#section-2.5")}const r=i.some((t=>bidirectional_r_al.get(t))),s=i.some((t=>bidirectional_l.get(t)));if(r&&s)throw new Error("String must not contain RandALCat and LCat at the same time, see https://tools.ietf.org/html/rfc3454#section-6");const a=bidirectional_r_al.get(getCodePoint(first(n))),c=bidirectional_r_al.get(getCodePoint(last(n)));if(r&&(!a||!c))throw new Error("Bidirectional RandALCat character must be the first and the last character of the string, see https://tools.ietf.org/html/rfc3454#section-6");return n}
//# sourceMappingURL=/sm/7d6600d1acb631c6d85a7e739b23015ed886f1c767d2d1f3abcc75e3549fbd0b.map