// 1. Let native line ending be be the code point U+000A LF.
autonative_line_ending="\n"sv;
// 2. If the underlying platform’s conventions are to represent newlines as a carriage return and line feed sequence, set native line ending to the code point U+000D CR followed by the code point U+000A LF.
// NOTE: this step is a no-op since LibWeb does not compile on Windows, which is the only platform we know of that that uses a carriage return and line feed sequence for line endings.
// 3. Set result to the empty string.
StringBuilderresult;
// 4. Let position be a position variable for s, initially pointing at the start of s.
autolexer=GenericLexer{string.view()};
// 5. Let token be the result of collecting a sequence of code points that are not equal to U+000A LF or U+000D CR from s given position.
// 4. Return a Blob object referring to bytes as its associated byte sequence, with its size set to the length of bytes, and its type set to the value of t from the substeps above.
// 1. The optional start parameter is a value for the start point of a slice() call, and must be treated as a byte-order position, with the zeroth position representing the first byte.
// User agents must process slice() with start normalized according to the following:
i64relative_start;
if(!start.has_value()){
// a. If the optional start parameter is not used as a parameter when making this call, let relativeStart be 0.
relative_start=0;
}else{
autostart_value=start.value();
// b. If start is negative, let relativeStart be max((size + start), 0).
if(start_value<0){
relative_start=max((size()+start_value),0);
}
// c. Else, let relativeStart be min(start, size).
else{
relative_start=min(start_value,size());
}
}
// 2. The optional end parameter is a value for the end point of a slice() call. User agents must process slice() with end normalized according to the following:
i64relative_end;
if(!end.has_value()){
// a. If the optional end parameter is not used as a parameter when making this call, let relativeEnd be size.
relative_end=size();
}else{
autoend_value=end.value();
// b. If end is negative, let relativeEnd be max((size + end), 0).
if(end_value<0){
relative_end=max((size()+end_value),0);
}
// c Else, let relativeEnd be min(end, size).
else{
relative_end=min(end_value,size());
}
}
// 3. The optional contentType parameter is used to set the ASCII-encoded string in lower case representing the media type of the Blob.
// User agents must process the slice() with contentType normalized according to the following:
Stringrelative_content_type;
if(!content_type.has_value()){
// a. If the contentType parameter is not provided, let relativeContentType be set to the empty string.
relative_content_type="";
}else{
// b. Else let relativeContentType be set to contentType and run the substeps below:
// FIXME: 1. If relativeContentType contains any characters outside the range of U+0020 to U+007E, then set relativeContentType to the empty string and return from these substeps.
// 2. Convert every character in relativeContentType to ASCII lowercase.