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 { ComponentContext, DevStackEntry, Effect } from '#client' */2import { DEV } from 'esm-env';3import * as e from './errors.js';4import { active_effect, active_reaction } from './runtime.js';5import { create_user_effect } from './reactivity/effects.js';6import { async_mode_flag, legacy_mode_flag } from '../flags/index.js';7import { FILENAME } from '../../constants.js';8import { BRANCH_EFFECT } from './constants.js';9 10/** @type {ComponentContext | null} */11export let component_context = null;12 13/** @param {ComponentContext | null} context */14export function set_component_context(context) {15 component_context = context;16}17 18/** @type {DevStackEntry | null} */19export let dev_stack = null;20 21/** @param {DevStackEntry | null} stack */22export function set_dev_stack(stack) {23 dev_stack = stack;24}25 26/**27 * Execute a callback with a new dev stack entry28 * @param {() => any} callback - Function to execute29 * @param {DevStackEntry['type']} type - Type of block/component30 * @param {any} component - Component function31 * @param {number} line - Line number32 * @param {number} column - Column number33 * @param {Record<string, any>} [additional] - Any additional properties to add to the dev stack entry34 * @returns {any}35 */36export function add_svelte_meta(callback, type, component, line, column, additional) {37 const parent = dev_stack;38 39 dev_stack = {40 type,41 file: component[FILENAME],42 line,43 column,44 parent,45 ...additional46 };47 48 try {49 return callback();50 } finally {51 dev_stack = parent;52 }53}54 55/**56 * The current component function. Different from current component context:57 * ```html58 * <!-- App.svelte -->59 * <Foo>60 * <Bar /> <!-- context == Foo.svelte, function == App.svelte -->61 * </Foo>62 * ```63 * @type {ComponentContext['function']}64 */65export let dev_current_component_function = null;66 67/** @param {ComponentContext['function']} fn */68export function set_dev_current_component_function(fn) {69 dev_current_component_function = fn;70}71 72/**73 * Returns a `[get, set]` pair of functions for working with context in a type-safe way.74 *75 * `get` will throw an error if no parent component called `set`.76 *77 * @template T78 * @returns {[() => T, (context: T) => T]}79 * @since 5.40.080 */81export function createContext() {82 const key = {};83 84 return [85 () => {86 if (!hasContext(key)) {87 e.missing_context();88 }89 90 return getContext(key);91 },92 (context) => setContext(key, context)93 ];94}95 96/**97 * Retrieves the context that belongs to the closest parent component with the specified `key`.98 * Must be called during component initialisation.99 *100 * [`createContext`](https://svelte.dev/docs/svelte/svelte#createContext) is a type-safe alternative.101 *102 * @template T103 * @param {any} key104 * @returns {T}105 */106export function getContext(key) {107 const context_map = get_or_init_context_map('getContext');108 const result = /** @type {T} */ (context_map.get(key));109 return result;110}111 112/**113 * Associates an arbitrary `context` object with the current component and the specified `key`114 * and returns that object. The context is then available to children of the component115 * (including slotted content) with `getContext`.116 *117 * Like lifecycle functions, this must be called during component initialisation.118 *119 * [`createContext`](https://svelte.dev/docs/svelte/svelte#createContext) is a type-safe alternative.120 *121 * @template T122 * @param {any} key123 * @param {T} context124 * @returns {T}125 */126export function setContext(key, context) {127 const context_map = get_or_init_context_map('setContext');128 129 if (async_mode_flag) {130 var flags = /** @type {Effect} */ (active_effect).f;131 var valid =132 !active_reaction &&133 (flags & BRANCH_EFFECT) !== 0 &&134 // pop() runs synchronously, so this indicates we're setting context after an await135 !(/** @type {ComponentContext} */ (component_context).i);136 137 if (!valid) {138 e.set_context_after_init();139 }140 }141 142 context_map.set(key, context);143 return context;144}145 146/**147 * Checks whether a given `key` has been set in the context of a parent component.148 * Must be called during component initialisation.149 *150 * @param {any} key151 * @returns {boolean}152 */153export function hasContext(key) {154 const context_map = get_or_init_context_map('hasContext');155 return context_map.has(key);156}157 158/**159 * Retrieves the whole context map that belongs to the closest parent component.160 * Must be called during component initialisation. Useful, for example, if you161 * programmatically create a component and want to pass the existing context to it.162 *163 * @template {Map<any, any>} [T=Map<any, any>]164 * @returns {T}165 */166export function getAllContexts() {167 const context_map = get_or_init_context_map('getAllContexts');168 return /** @type {T} */ (context_map);169}170 171/**172 * @param {Record<string, unknown>} props173 * @param {any} runes174 * @param {Function} [fn]175 * @returns {void}176 */177export function push(props, runes = false, fn) {178 component_context = {179 p: component_context,180 i: false,181 c: null,182 e: null,183 s: props,184 x: null,185 r: /** @type {Effect} */ (active_effect),186 l: legacy_mode_flag && !runes ? { s: null, u: null, $: [] } : null187 };188 189 if (DEV) {190 // component function191 component_context.function = fn;192 dev_current_component_function = fn;193 }194}195 196/**197 * @template {Record<string, any>} T198 * @param {T} [component]199 * @returns {T}200 */201export function pop(component) {202 var context = /** @type {ComponentContext} */ (component_context);203 var effects = context.e;204 205 if (effects !== null) {206 context.e = null;207 208 for (var fn of effects) {209 create_user_effect(fn);210 }211 }212 213 if (component !== undefined) {214 context.x = component;215 }216 217 context.i = true;218 219 component_context = context.p;220 221 if (DEV) {222 dev_current_component_function = component_context?.function ?? null;223 }224 225 return component ?? /** @type {T} */ ({});226}227 228/** @returns {boolean} */229export function is_runes() {230 return !legacy_mode_flag || (component_context !== null && component_context.l === null);231}232 233/**234 * @param {string} name235 * @returns {Map<unknown, unknown>}236 */237function get_or_init_context_map(name) {238 if (component_context === null) {239 e.lifecycle_outside_component(name);240 }241 242 return (component_context.c ??= new Map(get_parent_context(component_context) || undefined));243}244 245/**246 * @param {ComponentContext} component_context247 * @returns {Map<unknown, unknown> | null}248 */249function get_parent_context(component_context) {250 let parent = component_context.p;251 while (parent !== null) {252 const context_map = parent.c;253 if (context_map !== null) {254 return context_map;255 }256 parent = parent.p;257 }258 return null;259}260 