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/*! @license DOMPurify 3.4.13 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.13/LICENSE */2 3import { TrustedTypePolicy, TrustedTypesWindow, TrustedHTML } from 'trusted-types/lib/index.js';4 5/**6 * Configuration to control DOMPurify behavior.7 */8interface Config {9 /**10 * Extend the existing array of allowed attributes.11 * Can be an array of attribute names, or a function that receives12 * the attribute name and tag name to determine if the attribute is allowed.13 */14 ADD_ATTR?: string[] | ((attributeName: string, tagName: string) => boolean) | undefined;15 /**16 * Extend the existing array of elements that can use Data URIs.17 */18 ADD_DATA_URI_TAGS?: string[] | undefined;19 /**20 * Extend the existing array of allowed tags.21 * Can be an array of tag names, or a function that receives22 * the tag name to determine if the tag is allowed.23 */24 ADD_TAGS?: string[] | ((tagName: string) => boolean) | undefined;25 /**26 * Extend the existing array of elements that are safe for URI-like values (be careful, XSS risk).27 */28 ADD_URI_SAFE_ATTR?: string[] | undefined;29 /**30 * Allow ARIA attributes, leave other safe HTML as is (default is true).31 */32 ALLOW_ARIA_ATTR?: boolean | undefined;33 /**34 * Allow HTML5 data attributes, leave other safe HTML as is (default is true).35 */36 ALLOW_DATA_ATTR?: boolean | undefined;37 /**38 * Allow external protocol handlers in URL attributes (default is false, be careful, XSS risk).39 * By default only `http`, `https`, `ftp`, `ftps`, `tel`, `mailto`, `callto`, `sms`, `cid` and `xmpp` are allowed.40 */41 ALLOW_UNKNOWN_PROTOCOLS?: boolean | undefined;42 /**43 * Decide if self-closing tags in attributes are allowed.44 * Usually removed due to a mXSS issue in jQuery 3.0.45 */46 ALLOW_SELF_CLOSE_IN_ATTR?: boolean | undefined;47 /**48 * Allow only specific attributes.49 */50 ALLOWED_ATTR?: string[] | undefined;51 /**52 * Allow only specific elements.53 */54 ALLOWED_TAGS?: string[] | undefined;55 /**56 * Allow only specific namespaces. Defaults to:57 * - `http://www.w3.org/1999/xhtml`58 * - `http://www.w3.org/2000/svg`59 * - `http://www.w3.org/1998/Math/MathML`60 */61 ALLOWED_NAMESPACES?: string[] | undefined;62 /**63 * Allow specific protocols handlers in URL attributes via regex (be careful, XSS risk).64 * Default RegExp:65 * ```66 * /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i;67 * ```68 */69 ALLOWED_URI_REGEXP?: RegExp | undefined;70 /**71 * Define how custom elements are handled.72 */73 CUSTOM_ELEMENT_HANDLING?: {74 /**75 * Regular expression or function to match to allowed elements.76 * Default is null (disallow any custom elements).77 */78 tagNameCheck?: RegExp | ((tagName: string) => boolean) | null | undefined;79 /**80 * Regular expression or function to match to allowed attributes.81 * Default is null (disallow any attributes not on the allow list).82 */83 attributeNameCheck?: RegExp | ((attributeName: string, tagName?: string) => boolean) | null | undefined;84 /**85 * Allow custom elements derived from built-ins if they pass `tagNameCheck`. Default is false.86 */87 allowCustomizedBuiltInElements?: boolean | undefined;88 };89 /**90 * Add attributes to block-list.91 */92 FORBID_ATTR?: string[] | undefined;93 /**94 * Add child elements to be removed when their parent is removed.95 */96 FORBID_CONTENTS?: string[] | undefined;97 /**98 * Extend the existing or default array of forbidden content elements.99 */100 ADD_FORBID_CONTENTS?: string[] | undefined;101 /**102 * Add elements to block-list.103 */104 FORBID_TAGS?: string[] | undefined;105 /**106 * Glue elements like style, script or others to `document.body` and prevent unintuitive browser behavior in several edge-cases (default is false).107 */108 FORCE_BODY?: boolean | undefined;109 /**110 * Map of non-standard HTML element names to support. Map to true to enable support. For example:111 *112 * ```113 * HTML_INTEGRATION_POINTS: { foreignobject: true }114 * ```115 */116 HTML_INTEGRATION_POINTS?: Record<string, boolean> | undefined;117 /**118 * Sanitize a node "in place", which is much faster depending on how you use DOMPurify.119 */120 IN_PLACE?: boolean | undefined;121 /**122 * Keep an element's content when the element is removed (default is true).123 */124 KEEP_CONTENT?: boolean | undefined;125 /**126 * Map of MathML element names to support. Map to true to enable support. For example:127 *128 * ```129 * MATHML_TEXT_INTEGRATION_POINTS: { mtext: true }130 * ```131 */132 MATHML_TEXT_INTEGRATION_POINTS?: Record<string, boolean> | undefined;133 /**134 * Change the default namespace from HTML to something different.135 */136 NAMESPACE?: string | undefined;137 /**138 * Change the parser type so sanitized data is treated as XML and not as HTML, which is the default.139 */140 PARSER_MEDIA_TYPE?: DOMParserSupportedType | undefined;141 /**142 * Return a DOM `DocumentFragment` instead of an HTML string (default is false).143 */144 RETURN_DOM_FRAGMENT?: boolean | undefined;145 /**146 * Return a DOM `HTMLBodyElement` instead of an HTML string (default is false).147 */148 RETURN_DOM?: boolean | undefined;149 /**150 * Return a TrustedHTML object instead of a string if possible.151 */152 RETURN_TRUSTED_TYPE?: boolean | undefined;153 /**154 * Strip `{{ ... }}`, `${ ... }` and `<% ... %>` to make output safe for template systems.155 * Be careful please, this mode is not recommended for production usage.156 * Allowing template parsing in user-controlled HTML is not advised at all.157 * Only use this mode if there is really no alternative.158 */159 SAFE_FOR_TEMPLATES?: boolean | undefined;160 /**161 * Change how e.g. comments containing risky HTML characters are treated.162 * Be very careful, this setting should only be set to `false` if you really only handle163 * HTML and nothing else, no SVG, MathML or the like.164 * Otherwise, changing from `true` to `false` will lead to XSS in this or some other way.165 */166 SAFE_FOR_XML?: boolean | undefined;167 /**168 * Use DOM Clobbering protection on output (default is true, handle with care, minor XSS risks here).169 */170 SANITIZE_DOM?: boolean | undefined;171 /**172 * Enforce strict DOM Clobbering protection via namespace isolation (default is false).173 * When enabled, isolates the namespace of named properties (i.e., `id` and `name` attributes)174 * from JS variables by prefixing them with the string `user-content-`175 */176 SANITIZE_NAMED_PROPS?: boolean | undefined;177 /**178 * Supplied policy must define `createHTML` and `createScriptURL`.179 */180 TRUSTED_TYPES_POLICY?: TrustedTypePolicy | null | undefined;181 /**182 * Controls categories of allowed elements.183 *184 * Note that the `USE_PROFILES` setting will override the `ALLOWED_TAGS` setting185 * so don't use them together.186 */187 USE_PROFILES?: false | UseProfilesConfig | undefined;188 /**189 * Return entire document including <html> tags (default is false).190 */191 WHOLE_DOCUMENT?: boolean | undefined;192}193/**194 * Defines categories of allowed elements.195 */196interface UseProfilesConfig {197 /**198 * Allow all safe MathML elements.199 */200 mathMl?: boolean | undefined;201 /**202 * Allow all safe SVG elements.203 */204 svg?: boolean | undefined;205 /**206 * Allow all safe SVG Filters.207 */208 svgFilters?: boolean | undefined;209 /**210 * Allow all safe HTML elements.211 */212 html?: boolean | undefined;213}214 215interface DOMPurify {216 /**217 * Creates a DOMPurify instance using the given window-like object. Defaults to `window`.218 */219 (root?: WindowLike): DOMPurify;220 /**221 * Version label, exposed for easier checks222 * if DOMPurify is up to date or not223 */224 version: string;225 /**226 * Array of elements that DOMPurify removed during sanitation.227 * Empty if nothing was removed.228 */229 removed: Array<RemovedElement | RemovedAttribute>;230 /**231 * Expose whether this browser supports running the full DOMPurify.232 */233 isSupported: boolean;234 /**235 * Set the configuration once.236 *237 * @param cfg configuration object238 */239 setConfig(cfg?: Config): void;240 /**241 * Removes the configuration.242 */243 clearConfig(): void;244 /**245 * Provides core sanitation functionality.246 *247 * @param dirty string or DOM node248 * @param cfg object249 * @returns Sanitized TrustedHTML.250 */251 sanitize(dirty: string | Node, cfg: Config & {252 RETURN_TRUSTED_TYPE: true;253 }): TrustedHTML;254 /**255 * Provides core sanitation functionality.256 *257 * @param dirty DOM node258 * @param cfg object259 * @returns Sanitized DOM node.260 */261 sanitize(dirty: Node, cfg: Config & {262 IN_PLACE: true;263 }): Node;264 /**265 * Provides core sanitation functionality.266 *267 * @param dirty string or DOM node268 * @param cfg object269 * @returns Sanitized DOM node.270 */271 sanitize(dirty: string | Node, cfg: Config & {272 RETURN_DOM: true;273 }): Node;274 /**275 * Provides core sanitation functionality.276 *277 * @param dirty string or DOM node278 * @param cfg object279 * @returns Sanitized document fragment.280 */281 sanitize(dirty: string | Node, cfg: Config & {282 RETURN_DOM_FRAGMENT: true;283 }): DocumentFragment;284 /**285 * Provides core sanitation functionality.286 *287 * @param dirty string or DOM node288 * @param cfg object289 * @returns Sanitized string.290 */291 sanitize(dirty: string | Node, cfg?: Config): string;292 /**293 * Checks if an attribute value is valid.294 * Uses last set config, if any. Otherwise, uses config defaults.295 *296 * @param tag Tag name of containing element.297 * @param attr Attribute name.298 * @param value Attribute value.299 * @returns Returns true if `value` is valid. Otherwise, returns false.300 */301 isValidAttribute(tag: string, attr: string, value: string): boolean;302 /**303 * Adds a DOMPurify hook.304 *305 * @param entryPoint entry point for the hook to add306 * @param hookFunction function to execute307 */308 addHook(entryPoint: BasicHookName, hookFunction: NodeHook): void;309 /**310 * Adds a DOMPurify hook.311 *312 * @param entryPoint entry point for the hook to add313 * @param hookFunction function to execute314 */315 addHook(entryPoint: ElementHookName, hookFunction: ElementHook): void;316 /**317 * Adds a DOMPurify hook.318 *319 * @param entryPoint entry point for the hook to add320 * @param hookFunction function to execute321 */322 addHook(entryPoint: DocumentFragmentHookName, hookFunction: DocumentFragmentHook): void;323 /**324 * Adds a DOMPurify hook.325 *326 * @param entryPoint entry point for the hook to add327 * @param hookFunction function to execute328 */329 addHook(entryPoint: 'uponSanitizeElement', hookFunction: UponSanitizeElementHook): void;330 /**331 * Adds a DOMPurify hook.332 *333 * @param entryPoint entry point for the hook to add334 * @param hookFunction function to execute335 */336 addHook(entryPoint: 'uponSanitizeAttribute', hookFunction: UponSanitizeAttributeHook): void;337 /**338 * Remove a DOMPurify hook at a given entryPoint339 * (pops it from the stack of hooks if hook not specified)340 *341 * @param entryPoint entry point for the hook to remove342 * @param hookFunction optional specific hook to remove343 * @returns removed hook344 */345 removeHook(entryPoint: BasicHookName, hookFunction?: NodeHook): NodeHook | undefined;346 /**347 * Remove a DOMPurify hook at a given entryPoint348 * (pops it from the stack of hooks if hook not specified)349 *350 * @param entryPoint entry point for the hook to remove351 * @param hookFunction optional specific hook to remove352 * @returns removed hook353 */354 removeHook(entryPoint: ElementHookName, hookFunction?: ElementHook): ElementHook | undefined;355 /**356 * Remove a DOMPurify hook at a given entryPoint357 * (pops it from the stack of hooks if hook not specified)358 *359 * @param entryPoint entry point for the hook to remove360 * @param hookFunction optional specific hook to remove361 * @returns removed hook362 */363 removeHook(entryPoint: DocumentFragmentHookName, hookFunction?: DocumentFragmentHook): DocumentFragmentHook | undefined;364 /**365 * Remove a DOMPurify hook at a given entryPoint366 * (pops it from the stack of hooks if hook not specified)367 *368 * @param entryPoint entry point for the hook to remove369 * @param hookFunction optional specific hook to remove370 * @returns removed hook371 */372 removeHook(entryPoint: 'uponSanitizeElement', hookFunction?: UponSanitizeElementHook): UponSanitizeElementHook | undefined;373 /**374 * Remove a DOMPurify hook at a given entryPoint375 * (pops it from the stack of hooks if hook not specified)376 *377 * @param entryPoint entry point for the hook to remove378 * @param hookFunction optional specific hook to remove379 * @returns removed hook380 */381 removeHook(entryPoint: 'uponSanitizeAttribute', hookFunction?: UponSanitizeAttributeHook): UponSanitizeAttributeHook | undefined;382 /**383 * Removes all DOMPurify hooks at a given entryPoint384 *385 * @param entryPoint entry point for the hooks to remove386 */387 removeHooks(entryPoint: HookName): void;388 /**389 * Removes all DOMPurify hooks.390 */391 removeAllHooks(): void;392}393/**394 * An element removed by DOMPurify.395 */396interface RemovedElement {397 /**398 * The element that was removed.399 */400 element: Node;401}402/**403 * An element removed by DOMPurify.404 */405interface RemovedAttribute {406 /**407 * The attribute that was removed.408 */409 attribute: Attr | null;410 /**411 * The element that the attribute was removed.412 */413 from: Node;414}415type BasicHookName = 'beforeSanitizeElements' | 'afterSanitizeElements' | 'uponSanitizeShadowNode';416type ElementHookName = 'beforeSanitizeAttributes' | 'afterSanitizeAttributes';417type DocumentFragmentHookName = 'beforeSanitizeShadowDOM' | 'afterSanitizeShadowDOM';418type UponSanitizeElementHookName = 'uponSanitizeElement';419type UponSanitizeAttributeHookName = 'uponSanitizeAttribute';420type HookName = BasicHookName | ElementHookName | DocumentFragmentHookName | UponSanitizeElementHookName | UponSanitizeAttributeHookName;421type NodeHook = (this: DOMPurify, currentNode: Node, hookEvent: null, config: Config) => void;422type ElementHook = (this: DOMPurify, currentNode: Element, hookEvent: null, config: Config) => void;423type DocumentFragmentHook = (this: DOMPurify, currentNode: DocumentFragment, hookEvent: null, config: Config) => void;424type UponSanitizeElementHook = (this: DOMPurify, currentNode: Node, hookEvent: UponSanitizeElementHookEvent, config: Config) => void;425type UponSanitizeAttributeHook = (this: DOMPurify, currentNode: Element, hookEvent: UponSanitizeAttributeHookEvent, config: Config) => void;426interface UponSanitizeElementHookEvent {427 tagName: string;428 allowedTags: Record<string, boolean>;429}430interface UponSanitizeAttributeHookEvent {431 attrName: string;432 attrValue: string;433 keepAttr: boolean;434 allowedAttributes: Record<string, boolean>;435 forceKeepAttr: boolean | undefined;436}437/**438 * A `Window`-like object containing the properties and types that DOMPurify requires.439 */440type WindowLike = Pick<typeof globalThis, 'DocumentFragment' | 'HTMLTemplateElement' | 'Node' | 'Element' | 'NodeFilter' | 'NamedNodeMap' | 'HTMLFormElement' | 'DOMParser'> & {441 document?: Document;442 MozNamedAttrMap?: typeof window.NamedNodeMap;443} & Pick<TrustedTypesWindow, 'trustedTypes'>;444 445declare const _default: DOMPurify;446 447export { _default as default };448export type { Config, DOMPurify, DocumentFragmentHook, ElementHook, HookName, NodeHook, RemovedAttribute, RemovedElement, UponSanitizeAttributeHook, UponSanitizeAttributeHookEvent, UponSanitizeElementHook, UponSanitizeElementHookEvent, WindowLike };449 450// @ts-ignore451export = _default;452 