/** * @license * Copyright Google LLC * SPDX-License-Identifier: Apache-2.0 */ /** @fileoverview Internal implementations of SafeScript. */ import { UnwrapType } from './trusted_types.js'; import { TrustedScript } from './trusted_types_typings.js'; import '../environment/dev.js'; /** * JavaScript code that is safe to evaluate and use as the content of an HTML * script element. * * @final */ export declare class SafeScript { private readonly privateDoNotAccessOrElseWrappedScript; private constructor(); toString(): string; } /** * Builds a new `SafeScript` from the given string, without enforcing * safety guarantees. It may cause side effects by creating a Trusted Types * policy. This shouldn't be exposed to application developers, and must only be * used as a step towards safe builders or safe constants. */ export declare function createScriptInternal(value: string): SafeScript; /** * An empty `SafeScript` constant. * Unlike the functions above, using this will not create a policy. */ export declare const EMPTY_SCRIPT: SafeScript; /** Checks if the given value is a `SafeScript` instance */ export declare function isScript(value: unknown): value is SafeScript; /** * Returns the value of the passed `SafeScript` object while ensuring it * has the correct type. * Using this function directly is not common. Safe types are not meant to be * unwrapped, but rather passed to other APIs that consume them, like the DOM * wrappers in safevalues/dom. * * Returns a native `TrustedScript` instance typed as {toString(): string} or a string if Trusted Types are disabled. */ export declare function unwrapScript(value: SafeScript): UnwrapType | string;