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
1/** @import { Effect, TemplateNode } from '#client' */2import { hydrate_node, hydrating, set_hydrate_node } from './hydration.js';3import { DEV } from 'esm-env';4import { init_array_prototype_warnings } from '../dev/equality.js';5import { get_descriptor, is_extensible } from '../../shared/utils.js';6import { active_effect } from '../runtime.js';7import { async_mode_flag } from '../../flags/index.js';8import {9 ATTRIBUTES_CACHE,10 CLASS_CACHE,11 REACTION_RAN,12 STYLE_CACHE,13 TEXT_CACHE,14 TEXT_NODE15} from '#client/constants';16import { eager_block_effects } from '../reactivity/batch.js';17import { NAMESPACE_HTML } from '../../../constants.js';18 19// export these for reference in the compiled code, making global name deduplication unnecessary20/** @type {Window} */21export var $window;22 23/** @type {Document} */24export var $document;25 26/** @type {boolean} */27export var is_firefox;28 29/** @type {() => Node | null} */30var first_child_getter;31/** @type {() => Node | null} */32var next_sibling_getter;33 34/**35 * Initialize these lazily to avoid issues when using the runtime in a server context36 * where these globals are not available while avoiding a separate server entry point37 */38export function init_operations() {39 if ($window !== undefined) {40 return;41 }42 43 $window = window;44 $document = document;45 is_firefox = /Firefox/.test(navigator.userAgent);46 47 var element_prototype = Element.prototype;48 var node_prototype = Node.prototype;49 var text_prototype = Text.prototype;50 51 // @ts-ignore52 first_child_getter = get_descriptor(node_prototype, 'firstChild').get;53 // @ts-ignore54 next_sibling_getter = get_descriptor(node_prototype, 'nextSibling').get;55 56 if (is_extensible(element_prototype)) {57 // the following assignments improve perf of lookups on DOM nodes58 /** @type {any} */ (element_prototype)[CLASS_CACHE] = undefined;59 /** @type {any} */ (element_prototype)[ATTRIBUTES_CACHE] = null;60 /** @type {any} */ (element_prototype)[STYLE_CACHE] = undefined;61 // @ts-expect-error62 element_prototype.__e = undefined;63 }64 65 if (is_extensible(text_prototype)) {66 /** @type {any} */ (text_prototype)[TEXT_CACHE] = undefined;67 }68 69 if (DEV) {70 // @ts-expect-error71 element_prototype.__svelte_meta = null;72 73 init_array_prototype_warnings();74 }75}76 77/**78 * @param {string} value79 * @returns {Text}80 */81export function create_text(value = '') {82 return document.createTextNode(value);83}84 85/**86 * @template {Node} N87 * @param {N} node88 */89/*@__NO_SIDE_EFFECTS__*/90export function get_first_child(node) {91 return /** @type {TemplateNode | null} */ (first_child_getter.call(node));92}93 94/**95 * @template {Node} N96 * @param {N} node97 */98/*@__NO_SIDE_EFFECTS__*/99export function get_next_sibling(node) {100 return /** @type {TemplateNode | null} */ (next_sibling_getter.call(node));101}102 103/**104 * Don't mark this as side-effect-free, hydration needs to walk all nodes105 * @template {Node} N106 * @param {N} node107 * @param {boolean} is_text108 * @returns {TemplateNode | null}109 */110export function child(node, is_text) {111 if (!hydrating) {112 return get_first_child(node);113 }114 115 var child = get_first_child(hydrate_node);116 117 // Child can be null if we have an element with a single child, like `<p>{text}</p>`, where `text` is empty118 if (child === null) {119 child = hydrate_node.appendChild(create_text());120 } else if (is_text && child.nodeType !== TEXT_NODE) {121 var text = create_text();122 child?.before(text);123 set_hydrate_node(text);124 return text;125 }126 127 if (is_text) {128 merge_text_nodes(/** @type {Text} */ (child));129 }130 131 set_hydrate_node(child);132 return child;133}134 135/**136 * Don't mark this as side-effect-free, hydration needs to walk all nodes137 * @param {TemplateNode} node138 * @param {boolean} [is_text]139 * @returns {TemplateNode | null}140 */141export function first_child(node, is_text = false) {142 if (!hydrating) {143 var first = get_first_child(node);144 145 // TODO prevent user comments with the empty string when preserveComments is true146 if (first instanceof Comment && first.data === '') return get_next_sibling(first);147 148 return first;149 }150 151 if (is_text) {152 // if an {expression} is empty during SSR, there might be no153 // text node to hydrate — we must therefore create one154 if (hydrate_node?.nodeType !== TEXT_NODE) {155 var text = create_text();156 157 hydrate_node?.before(text);158 set_hydrate_node(text);159 return text;160 }161 162 merge_text_nodes(/** @type {Text} */ (hydrate_node));163 }164 165 return hydrate_node;166}167 168/**169 * Don't mark this as side-effect-free, hydration needs to walk all nodes170 * @param {TemplateNode} node171 * @param {number} count172 * @param {boolean} is_text173 * @returns {TemplateNode | null}174 */175export function sibling(node, count = 1, is_text = false) {176 let next_sibling = hydrating ? hydrate_node : node;177 var last_sibling;178 179 while (count--) {180 last_sibling = next_sibling;181 next_sibling = /** @type {TemplateNode} */ (get_next_sibling(next_sibling));182 }183 184 if (!hydrating) {185 return next_sibling;186 }187 188 if (is_text) {189 // if a sibling {expression} is empty during SSR, there might be no190 // text node to hydrate — we must therefore create one191 if (next_sibling?.nodeType !== TEXT_NODE) {192 var text = create_text();193 // If the next sibling is `null` and we're handling text then it's because194 // the SSR content was empty for the text, so we need to generate a new text195 // node and insert it after the last sibling196 if (next_sibling === null) {197 last_sibling?.after(text);198 } else {199 next_sibling.before(text);200 }201 set_hydrate_node(text);202 return text;203 }204 205 merge_text_nodes(/** @type {Text} */ (next_sibling));206 }207 208 set_hydrate_node(next_sibling);209 return next_sibling;210}211 212/**213 * @template {Node} N214 * @param {N} node215 * @returns {void}216 */217export function clear_text_content(node) {218 node.textContent = '';219}220 221/**222 * Returns `true` if we're updating the current block, for example `condition` in223 * an `{#if condition}` block just changed. In this case, the branch should be224 * appended (or removed) at the same time as other updates within the225 * current `<svelte:boundary>`226 */227export function should_defer_append() {228 if (!async_mode_flag) return false;229 if (eager_block_effects !== null) return false;230 231 var flags = /** @type {Effect} */ (active_effect).f;232 return (flags & REACTION_RAN) !== 0;233}234 235/**236 * Branching here is intentional and load-bearing for perf. `createElement(tag)`237 * hits a fast path in Blink that `createElementNS(NAMESPACE_HTML, tag)` doesn't,238 * and passing an explicit `undefined` as the trailing options arg measurably239 * slows both APIs. Funnelling every case through a single `createElementNS(ns,240 * tag, options)` call would be smaller but slower on the HTML path.241 *242 * @template {keyof HTMLElementTagNameMap | string} T243 * @param {T} tag244 * @param {string} [namespace]245 * @param {string} [is]246 * @returns {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element}247 */248export function create_element(tag, namespace, is) {249 if (namespace == null || namespace === NAMESPACE_HTML) {250 return /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */ (251 is ? document.createElement(tag, { is }) : document.createElement(tag)252 );253 }254 return /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */ (255 is ? document.createElementNS(namespace, tag, { is }) : document.createElementNS(namespace, tag)256 );257}258 259export function create_fragment() {260 return document.createDocumentFragment();261}262 263/**264 * @param {string} data265 * @returns266 */267export function create_comment(data = '') {268 return document.createComment(data);269}270 271/**272 * @param {Element} element273 * @param {string} key274 * @param {string} value275 * @returns276 */277export function set_attribute(element, key, value = '') {278 if (key.startsWith('xlink:')) {279 element.setAttributeNS('http://www.w3.org/1999/xlink', key, value);280 return;281 }282 return element.setAttribute(key, value);283}284 285/**286 * Browsers split text nodes larger than 65536 bytes when parsing.287 * For hydration to succeed, we need to stitch them back together288 * @param {Text} text289 */290export function merge_text_nodes(text) {291 if (/** @type {string} */ (text.nodeValue).length < 65536) {292 return;293 }294 295 let next = text.nextSibling;296 297 while (next !== null && next.nodeType === TEXT_NODE) {298 next.remove();299 300 /** @type {string} */ (text.nodeValue) += /** @type {string} */ (next.nodeValue);301 302 next = text.nextSibling;303 }304}305 