Team Ai
Datasetpublic

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.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3.1kdownloads
utils.js505 linesDownload Raw Back to src
1const regex_return_characters = /\r/g;2 3/**4 * @param {string} str5 * @returns {string}6 */7export function hash(str) {8	str = str.replace(regex_return_characters, '');9	let hash = 5381;10	let i = str.length;11 12	while (i--) hash = ((hash << 5) - hash) ^ str.charCodeAt(i);13	return (hash >>> 0).toString(36);14}15 16const VOID_ELEMENT_NAMES = [17	'area',18	'base',19	'br',20	'col',21	'command',22	'embed',23	'hr',24	'img',25	'input',26	'keygen',27	'link',28	'meta',29	'param',30	'source',31	'track',32	'wbr'33];34 35/**36 * Returns `true` if `name` is of a void element37 * @param {string} name38 */39export function is_void(name) {40	return VOID_ELEMENT_NAMES.includes(name) || name.toLowerCase() === '!doctype';41}42 43const RESERVED_WORDS = [44	'arguments',45	'await',46	'break',47	'case',48	'catch',49	'class',50	'const',51	'continue',52	'debugger',53	'default',54	'delete',55	'do',56	'else',57	'enum',58	'eval',59	'export',60	'extends',61	'false',62	'finally',63	'for',64	'function',65	'if',66	'implements',67	'import',68	'in',69	'instanceof',70	'interface',71	'let',72	'new',73	'null',74	'package',75	'private',76	'protected',77	'public',78	'return',79	'static',80	'super',81	'switch',82	'this',83	'throw',84	'true',85	'try',86	'typeof',87	'var',88	'void',89	'while',90	'with',91	'yield'92];93 94/**95 * Returns `true` if `word` is a reserved JavaScript keyword96 * @param {string} word97 */98export function is_reserved(word) {99	return RESERVED_WORDS.includes(word);100}101 102/**103 * @param {string} name104 */105export function is_capture_event(name) {106	return name.endsWith('capture') && name !== 'gotpointercapture' && name !== 'lostpointercapture';107}108 109/** List of Element events that will be delegated */110const DELEGATED_EVENTS = [111	'beforeinput',112	'click',113	'change',114	'dblclick',115	'contextmenu',116	'focusin',117	'focusout',118	'input',119	'keydown',120	'keyup',121	'mousedown',122	'mousemove',123	'mouseout',124	'mouseover',125	'mouseup',126	'pointerdown',127	'pointermove',128	'pointerout',129	'pointerover',130	'pointerup',131	'touchend',132	'touchmove',133	'touchstart'134];135 136/**137 * Returns `true` if `event_name` is a delegated event138 * @param {string} event_name139 */140export function can_delegate_event(event_name) {141	return DELEGATED_EVENTS.includes(event_name);142}143 144/**145 * Attributes that are boolean, i.e. they are present or not present.146 */147const DOM_BOOLEAN_ATTRIBUTES = [148	'allowfullscreen',149	'async',150	'autofocus',151	'autoplay',152	'checked',153	'controls',154	'default',155	'disabled',156	'formnovalidate',157	'indeterminate',158	'inert',159	'ismap',160	'loop',161	'multiple',162	'muted',163	'nomodule',164	'novalidate',165	'open',166	'playsinline',167	'readonly',168	'required',169	'reversed',170	'seamless',171	'selected',172	'webkitdirectory',173	'defer',174	'disablepictureinpicture',175	'disableremoteplayback'176];177 178/**179 * Returns `true` if `name` is a boolean attribute180 * @param {string} name181 */182export function is_boolean_attribute(name) {183	return DOM_BOOLEAN_ATTRIBUTES.includes(name);184}185 186/**187 * @type {Record<string, string>}188 * List of attribute names that should be aliased to their property names189 * because they behave differently between setting them as an attribute and190 * setting them as a property.191 */192const ATTRIBUTE_ALIASES = {193	// no `class: 'className'` because we handle that separately194	formnovalidate: 'formNoValidate',195	ismap: 'isMap',196	nomodule: 'noModule',197	playsinline: 'playsInline',198	readonly: 'readOnly',199	defaultvalue: 'defaultValue',200	defaultchecked: 'defaultChecked',201	srcobject: 'srcObject',202	novalidate: 'noValidate',203	allowfullscreen: 'allowFullscreen',204	disablepictureinpicture: 'disablePictureInPicture',205	disableremoteplayback: 'disableRemotePlayback'206};207 208/**209 * @param {string} name210 */211export function normalize_attribute(name) {212	name = name.toLowerCase();213	return ATTRIBUTE_ALIASES[name] ?? name;214}215 216const DOM_PROPERTIES = [217	...DOM_BOOLEAN_ATTRIBUTES,218	'formNoValidate',219	'isMap',220	'noModule',221	'playsInline',222	'readOnly',223	'value',224	'volume',225	'defaultValue',226	'defaultChecked',227	'srcObject',228	'noValidate',229	'allowFullscreen',230	'disablePictureInPicture',231	'disableRemotePlayback'232];233 234/**235 * @param {string} name236 */237export function is_dom_property(name) {238	return DOM_PROPERTIES.includes(name);239}240 241const NON_STATIC_PROPERTIES = ['autofocus', 'muted', 'defaultValue', 'defaultChecked'];242 243/**244 * Returns `true` if the given attribute cannot be set through the template245 * string, i.e. needs some kind of JavaScript handling to work.246 * @param {string} name247 */248export function cannot_be_set_statically(name) {249	return NON_STATIC_PROPERTIES.includes(name);250}251 252/**253 * Subset of delegated events which should be passive by default.254 * These two are already passive via browser defaults on window, document and body.255 * But since256 * - we're delegating them257 * - they happen often258 * - they apply to mobile which is generally less performant259 * we're marking them as passive by default for other elements, too.260 */261const PASSIVE_EVENTS = ['touchstart', 'touchmove'];262 263/**264 * Returns `true` if `name` is a passive event265 * @param {string} name266 */267export function is_passive_event(name) {268	return PASSIVE_EVENTS.includes(name);269}270 271const CONTENT_EDITABLE_BINDINGS = ['textContent', 'innerHTML', 'innerText'];272 273/** @param {string} name */274export function is_content_editable_binding(name) {275	return CONTENT_EDITABLE_BINDINGS.includes(name);276}277 278const LOAD_ERROR_ELEMENTS = [279	'body',280	'embed',281	'iframe',282	'img',283	'link',284	'object',285	'script',286	'style',287	'track'288];289 290/**291 * Returns `true` if the element emits `load` and `error` events292 * @param {string} name293 */294export function is_load_error_element(name) {295	return LOAD_ERROR_ELEMENTS.includes(name);296}297 298const SVG_ELEMENTS = [299	'altGlyph',300	'altGlyphDef',301	'altGlyphItem',302	'animate',303	'animateColor',304	'animateMotion',305	'animateTransform',306	'circle',307	'clipPath',308	'color-profile',309	'cursor',310	'defs',311	'desc',312	'discard',313	'ellipse',314	'feBlend',315	'feColorMatrix',316	'feComponentTransfer',317	'feComposite',318	'feConvolveMatrix',319	'feDiffuseLighting',320	'feDisplacementMap',321	'feDistantLight',322	'feDropShadow',323	'feFlood',324	'feFuncA',325	'feFuncB',326	'feFuncG',327	'feFuncR',328	'feGaussianBlur',329	'feImage',330	'feMerge',331	'feMergeNode',332	'feMorphology',333	'feOffset',334	'fePointLight',335	'feSpecularLighting',336	'feSpotLight',337	'feTile',338	'feTurbulence',339	'filter',340	'font',341	'font-face',342	'font-face-format',343	'font-face-name',344	'font-face-src',345	'font-face-uri',346	'foreignObject',347	'g',348	'glyph',349	'glyphRef',350	'hatch',351	'hatchpath',352	'hkern',353	'image',354	'line',355	'linearGradient',356	'marker',357	'mask',358	'mesh',359	'meshgradient',360	'meshpatch',361	'meshrow',362	'metadata',363	'missing-glyph',364	'mpath',365	'path',366	'pattern',367	'polygon',368	'polyline',369	'radialGradient',370	'rect',371	'set',372	'solidcolor',373	'stop',374	'svg',375	'switch',376	'symbol',377	'text',378	'textPath',379	'tref',380	'tspan',381	'unknown',382	'use',383	'view',384	'vkern'385];386 387/** @param {string} name */388export function is_svg(name) {389	return SVG_ELEMENTS.includes(name);390}391 392const MATHML_ELEMENTS = [393	'annotation',394	'annotation-xml',395	'maction',396	'math',397	'merror',398	'mfrac',399	'mi',400	'mmultiscripts',401	'mn',402	'mo',403	'mover',404	'mpadded',405	'mphantom',406	'mprescripts',407	'mroot',408	'mrow',409	'ms',410	'mspace',411	'msqrt',412	'mstyle',413	'msub',414	'msubsup',415	'msup',416	'mtable',417	'mtd',418	'mtext',419	'mtr',420	'munder',421	'munderover',422	'semantics'423];424 425/** @param {string} name */426export function is_mathml(name) {427	return MATHML_ELEMENTS.includes(name);428}429 430const STATE_CREATION_RUNES = /** @type {const} */ ([431	'$state',432	'$state.raw',433	'$derived',434	'$derived.by'435]);436 437export const RUNES = /** @type {const} */ ([438	...STATE_CREATION_RUNES,439	'$state.eager',440	'$state.snapshot',441	'$props',442	'$props.id',443	'$bindable',444	'$effect',445	'$effect.pre',446	'$effect.tracking',447	'$effect.root',448	'$effect.pending',449	'$inspect',450	'$inspect().with',451	'$inspect.trace',452	'$host'453]);454 455/** @typedef {typeof RUNES[number]} RuneName */456 457/**458 * @param {string} name459 * @returns {name is RuneName}460 */461export function is_rune(name) {462	return RUNES.includes(/** @type {RuneName} */ (name));463}464 465/** @typedef {typeof STATE_CREATION_RUNES[number]} StateCreationRuneName */466 467/**468 * @param {string} name469 * @returns {name is StateCreationRuneName}470 */471export function is_state_creation_rune(name) {472	return STATE_CREATION_RUNES.includes(/** @type {StateCreationRuneName} */ (name));473}474 475/** List of elements that require raw contents and should not have SSR comments put in them */476const RAW_TEXT_ELEMENTS = /** @type {const} */ (['textarea', 'script', 'style', 'title']);477 478/** @param {string} name */479export function is_raw_text_element(name) {480	return RAW_TEXT_ELEMENTS.includes(/** @type {typeof RAW_TEXT_ELEMENTS[number]} */ (name));481}482 483// Matches valid HTML/SVG/MathML element names and custom element names.484// https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name485//486// Standard elements: ASCII alpha start, followed by ASCII alphanumerics.487// Custom elements: ASCII alpha start, followed by any mix of PCENChar (which488// includes ASCII alphanumerics, `-`, `.`, `_`, and specified Unicode ranges),489// with at least one hyphen required somewhere after the first character.490//491// Rejects strings containing whitespace, quotes, angle brackets, slashes, equals,492// or other characters that could break out of a tag-name token and enable markup injection.493export const REGEX_VALID_TAG_NAME =494	/^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9.\-_\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}]*)?$/u;495 496/**497 * Prevent devtools trying to make `location` a clickable link by inserting a zero-width space498 * @template {string | undefined} T499 * @param {T} location500 * @returns {T};501 */502export function sanitize_location(location) {503	return /** @type {T} */ (location?.replace(/\//g, '/\u200b'));504}505