Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1import { escape_html } from '../../escaping.js';2import { clsx as _clsx } from 'clsx';3import { has_own_property } from './utils.js';4 5/**6 * `<div translate={false}>` should be rendered as `<div translate="no">` and _not_7 * `<div translate="false">`, which is equivalent to `<div translate="yes">`. There8 * may be other odd cases that need to be added to this list in future9 * @type {Record<string, Map<any, string>>}10 */11const replacements = {12 translate: new Map([13 [true, 'yes'],14 [false, 'no']15 ])16};17 18/**19 * @template V20 * @param {string} name21 * @param {V} value22 * @param {boolean} [is_boolean]23 * @returns {string}24 */25export function attr(name, value, is_boolean = false) {26 // attribute hidden for values other than "until-found" behaves like a boolean attribute27 if (name === 'hidden' && value !== 'until-found') {28 is_boolean = true;29 }30 if (value == null || (!value && is_boolean)) return '';31 const normalized =32 (has_own_property.call(replacements, name) && replacements[name].get(value)) || value;33 const assignment = is_boolean ? `=""` : `="${escape_html(normalized, true)}"`;34 return ` ${name}${assignment}`;35}36 37/**38 * Small wrapper around clsx to preserve Svelte's (weird) handling of falsy values.39 * TODO Svelte 6 revisit this, and likely turn all falsy values into the empty string (what clsx also does)40 * @param {any} value41 */42export function clsx(value) {43 if (typeof value === 'object') {44 return _clsx(value);45 } else {46 return value ?? '';47 }48}49 50const whitespace = [...' \t\n\r\f\u00a0\u000b\ufeff'];51 52/**53 * @param {any} value54 * @param {string | null} [hash]55 * @param {Record<string, boolean>} [directives]56 * @returns {string | null}57 */58export function to_class(value, hash, directives) {59 var classname = value == null ? '' : '' + value;60 61 if (hash) {62 classname = classname ? classname + ' ' + hash : hash;63 }64 65 if (directives) {66 for (var key of Object.keys(directives)) {67 if (directives[key]) {68 classname = classname ? classname + ' ' + key : key;69 } else if (classname.length) {70 var len = key.length;71 var a = 0;72 73 while ((a = classname.indexOf(key, a)) >= 0) {74 var b = a + len;75 76 if (77 (a === 0 || whitespace.includes(classname[a - 1])) &&78 (b === classname.length || whitespace.includes(classname[b]))79 ) {80 classname = (a === 0 ? '' : classname.substring(0, a)) + classname.substring(b + 1);81 } else {82 a = b;83 }84 }85 }86 }87 }88 89 return classname === '' ? null : classname;90}91 92/**93 *94 * @param {Record<string,any>} styles95 * @param {boolean} important96 */97function append_styles(styles, important = false) {98 var separator = important ? ' !important;' : ';';99 var css = '';100 101 for (var key of Object.keys(styles)) {102 var value = styles[key];103 if (value != null && value !== '') {104 css += ' ' + key + ': ' + value + separator;105 }106 }107 108 return css;109}110 111/**112 * @param {string} name113 * @returns {string}114 */115function to_css_name(name) {116 if (name[0] !== '-' || name[1] !== '-') {117 return name.toLowerCase();118 }119 return name;120}121 122/**123 * @param {any} value124 * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [styles]125 * @returns {string | null}126 */127export function to_style(value, styles) {128 if (styles) {129 var new_style = '';130 131 /** @type {Record<string,any> | undefined} */132 var normal_styles;133 134 /** @type {Record<string,any> | undefined} */135 var important_styles;136 137 if (Array.isArray(styles)) {138 normal_styles = styles[0];139 important_styles = styles[1];140 } else {141 normal_styles = styles;142 }143 144 if (value) {145 value = String(value)146 .replaceAll(/\s*\/\*.*?\*\/\s*/g, '')147 .trim();148 149 /** @type {boolean | '"' | "'"} */150 var in_str = false;151 var in_apo = 0;152 var in_comment = false;153 154 var reserved_names = [];155 156 if (normal_styles) {157 reserved_names.push(...Object.keys(normal_styles).map(to_css_name));158 }159 if (important_styles) {160 reserved_names.push(...Object.keys(important_styles).map(to_css_name));161 }162 163 var start_index = 0;164 var name_index = -1;165 166 const len = value.length;167 for (var i = 0; i < len; i++) {168 var c = value[i];169 170 if (in_comment) {171 if (c === '/' && value[i - 1] === '*') {172 in_comment = false;173 }174 } else if (in_str) {175 if (in_str === c) {176 in_str = false;177 }178 } else if (c === '/' && value[i + 1] === '*') {179 in_comment = true;180 } else if (c === '"' || c === "'") {181 in_str = c;182 } else if (c === '(') {183 in_apo++;184 } else if (c === ')') {185 in_apo--;186 }187 188 if (!in_comment && in_str === false && in_apo === 0) {189 if (c === ':' && name_index === -1) {190 name_index = i;191 } else if (c === ';' || i === len - 1) {192 if (name_index !== -1) {193 var name = to_css_name(value.substring(start_index, name_index).trim());194 195 if (!reserved_names.includes(name)) {196 if (c !== ';') {197 i++;198 }199 200 var property = value.substring(start_index, i).trim();201 new_style += ' ' + property + ';';202 }203 }204 205 start_index = i + 1;206 name_index = -1;207 }208 }209 }210 }211 212 if (normal_styles) {213 new_style += append_styles(normal_styles);214 }215 216 if (important_styles) {217 new_style += append_styles(important_styles, true);218 }219 220 new_style = new_style.trim();221 return new_style === '' ? null : new_style;222 }223 224 return value == null ? null : String(value);225}226 