function load(content, options, isDocument) {
        if (isDocument === void 0) { isDocument = true; }
        if (content == null) {
            throw new Error('cheerio.load() expects a string');
        }
        var internalOpts = __assign(__assign({}, options_js_1.default), (0, options_js_1.flatten)(options));
        var initialRoot = parse(content, internalOpts, isDocument, null);
        /** Create an extended class here, so that extensions only live on one instance. */
        var LoadedCheerio = /** @class */ (function (_super) {
            __extends(LoadedCheerio, _super);
            function LoadedCheerio() {
                return _super !== null && _super.apply(this, arguments) || this;
            }
            LoadedCheerio.prototype._make = function (selector, context) {
                var cheerio = initialize(selector, context);
                cheerio.prevObject = this;
                return cheerio;
            };
            LoadedCheerio.prototype._parse = function (content, options, isDocument, context) {
                return parse(content, options, isDocument, context);
            };
            LoadedCheerio.prototype._render = function (dom) {
                return render(dom, this.options);
            };
            return LoadedCheerio;
        }(cheerio_js_1.Cheerio));
        function initialize(selector, context, root, opts) {
            if (root === void 0) { root = initialRoot; }
            // $($)
            if (selector && (0, utils_js_1.isCheerio)(selector))
                return selector;
            var options = __assign(__assign({}, internalOpts), (0, options_js_1.flatten)(opts));
            var r = typeof root === 'string'
                ? [parse(root, options, false, null)]
                : 'length' in root
                    ? root
                    : [root];
            var rootInstance = (0, utils_js_1.isCheerio)(r)
                ? r
                : new LoadedCheerio(r, null, options);
            // Add a cyclic reference, so that calling methods on `_root` never fails.
            rootInstance._root = rootInstance;
            // $(), $(null), $(undefined), $(false)
            if (!selector) {
                return new LoadedCheerio(undefined, rootInstance, options);
            }
            var elements = typeof selector === 'string' && (0, utils_js_1.isHtml)(selector)
                ? // $(<html>)
                    parse(selector, options, false, null).children
                : isNode(selector)
                    ? // $(dom)
                        [selector]
                    : Array.isArray(selector)
                        ? // $([dom])
                            selector
                        : undefined;
            var instance = new LoadedCheerio(elements, rootInstance, options);
            if (elements) {
                return instance;
            }
            if (typeof selector !== 'string') {
                throw new Error('Unexpected type of selector');
            }
            // We know that our selector is a string now.
            var search = selector;
            var searchContext = !context
                ? // If we don't have a context, maybe we have a root, from loading
                    rootInstance
                : typeof context === 'string'
                    ? (0, utils_js_1.isHtml)(context)
                        ? // $('li', '<ul>...</ul>')
                            new LoadedCheerio([parse(context, options, false, null)], rootInstance, options)
                        : // $('li', 'ul')
                            ((search = "".concat(context, " ").concat(search)), rootInstance)
                    : (0, utils_js_1.isCheerio)(context)
                        ? // $('li', $)
                            context
                        : // $('li', node), $('li', [nodes])
                            new LoadedCheerio(Array.isArray(context) ? context : [context], rootInstance, options);
            // If we still don't have a context, return
            if (!searchContext)
                return instance;
            /*
             * #id, .class, tag
             */
            return searchContext.find(search);
        }
        // Add in static methods & properties
        Object.assign(initialize, staticMethods, {
            load: load,
            // `_root` and `_options` are used in static methods.
            _root: initialRoot,
            _options: internalOpts,
            // Add `fn` for plugins
            fn: LoadedCheerio.prototype,
            // Add the prototype here to maintain `instanceof` behavior.
            prototype: LoadedCheerio.prototype,
        });
        return initialize;
    }
/**
     * Create a querying function, bound to a document created from the provided markup.
     *
     * Note that similar to web browser contexts, this operation may introduce
     * `<html>`, `<head>`, and `<body>` elements; set `isDocument` to `false` to
     * switch to fragment mode and disable this.
     *
     * @param content - Markup to be loaded.
     * @param options - Options for the created instance.
     * @param isDocument - Allows parser to be switched to fragment mode.
     * @returns The loaded document.
     * @see {@link https://cheerio.js.org#loading} for additional usage information.
     */
Create a querying function, bound to a document created from the provided markup.

@param content - Markup to be loaded.
@param options - Options for the created instance.
@param isDocument - Allows parser to be switched to fragment mode.
@returns The loaded document.
Create a querying function bound to a document created from the provided markup . @param content - Markup to be loaded . @param options - Options for the created instance . @param isDocument - Allows parser to be switched to fragment mode . @returns The loaded document .
function load(content, options, isDocument) {
        if (isDocument === void 0) { isDocument = true; }
        if (content == null) {
            throw new Error('cheerio.load() expects a string');
        }
        var internalOpts = __assign(__assign({}, options_js_1.default), (0, options_js_1.flatten)(options));
        var initialRoot = parse(content, internalOpts, isDocument, null);
        var LoadedCheerio =  (function (_super) {
            __extends(LoadedCheerio, _super);
            function LoadedCheerio() {
                return _super !== null && _super.apply(this, arguments) || this;
            }
            LoadedCheerio.prototype._make = function (selector, context) {
                var cheerio = initialize(selector, context);
                cheerio.prevObject = this;
                return cheerio;
            };
            LoadedCheerio.prototype._parse = function (content, options, isDocument, context) {
                return parse(content, options, isDocument, context);
            };
            LoadedCheerio.prototype._render = function (dom) {
                return render(dom, this.options);
            };
            return LoadedCheerio;
        }(cheerio_js_1.Cheerio));
        function initialize(selector, context, root, opts) {
            if (root === void 0) { root = initialRoot; }
            if (selector && (0, utils_js_1.isCheerio)(selector))
                return selector;
            var options = __assign(__assign({}, internalOpts), (0, options_js_1.flatten)(opts));
            var r = typeof root === 'string'
                ? [parse(root, options, false, null)]
                : 'length' in root
                    ? root
                    : [root];
            var rootInstance = (0, utils_js_1.isCheerio)(r)
                ? r
                : new LoadedCheerio(r, null, options);
            rootInstance._root = rootInstance;
            if (!selector) {
                return new LoadedCheerio(undefined, rootInstance, options);
            }
            var elements = typeof selector === 'string' && (0, utils_js_1.isHtml)(selector)
                ? 
                    parse(selector, options, false, null).children
                : isNode(selector)
                    ? 
                        [selector]
                    : Array.isArray(selector)
                        ? 
                            selector
                        : undefined;
            var instance = new LoadedCheerio(elements, rootInstance, options);
            if (elements) {
                return instance;
            }
            if (typeof selector !== 'string') {
                throw new Error('Unexpected type of selector');
            }
            var search = selector;
            var searchContext = !context
                ? 
                    rootInstance
                : typeof context === 'string'
                    ? (0, utils_js_1.isHtml)(context)
                        ? 
                            new LoadedCheerio([parse(context, options, false, null)], rootInstance, options)
                        : 
                            ((search = "".concat(context, " ").concat(search)), rootInstance)
                    : (0, utils_js_1.isCheerio)(context)
                        ? 
                            context
                        : 
                            new LoadedCheerio(Array.isArray(context) ? context : [context], rootInstance, options);
            if (!searchContext)
                return instance;
            return searchContext.find(search);
        }
        Object.assign(initialize, staticMethods, {
            load: load,
            _root: initialRoot,
            _options: internalOpts,
            fn: LoadedCheerio.prototype,
            prototype: LoadedCheerio.prototype,
        });
        return initialize;
    }
function load ( content , options , isDocument ) { if ( isDocument === void 0 ) { isDocument = true ; } if ( content == null ) { throw new Error ( 'cheerio.load() expects a string' ) ; } var internalOpts = __assign ( __assign ( { } , options_js_1 . default ) , ( 0 , options_js_1 . flatten ) ( options ) ) ; var initialRoot = parse ( content , internalOpts , isDocument , null ) ; var LoadedCheerio = ( function ( _super ) { __extends ( LoadedCheerio , _super ) ; function LoadedCheerio ( ) { return _super !== null && _super . apply ( this , arguments ) || this ; } LoadedCheerio . prototype . _make = function ( selector , context ) { var cheerio = initialize ( selector , context ) ; cheerio . prevObject = this ; return cheerio ; } ; LoadedCheerio . prototype . _parse = function ( content , options , isDocument , context ) { return parse ( content , options , isDocument , context ) ; } ; LoadedCheerio . prototype . _render = function ( dom ) { return render ( dom , this . options ) ; } ; return LoadedCheerio ; } ( cheerio_js_1 . Cheerio ) ) ; function initialize ( selector , context , root , opts ) { if ( root === void 0 ) { root = initialRoot ; } if ( selector && ( 0 , utils_js_1 . isCheerio ) ( selector ) ) return selector ; var options = __assign ( __assign ( { } , internalOpts ) , ( 0 , options_js_1 . flatten ) ( opts ) ) ; var r = typeof root === 'string' ? [ parse ( root , options , false , null ) ] : 'length' in root ? root : [ root ] ; var rootInstance = ( 0 , utils_js_1 . isCheerio ) ( r ) ? r : new LoadedCheerio ( r , null , options ) ; rootInstance . _root = rootInstance ; if ( ! selector ) { return new LoadedCheerio ( undefined , rootInstance , options ) ; } var elements = typeof selector === 'string' && ( 0 , utils_js_1 . isHtml ) ( selector ) ? parse ( selector , options , false , null ) . children : isNode ( selector ) ? [ selector ] : Array . isArray ( selector ) ? selector : undefined ; var instance = new LoadedCheerio ( elements , rootInstance , options ) ; if ( elements ) { return instance ; } if ( typeof selector !== 'string' ) { throw new Error ( 'Unexpected type of selector' ) ; } var search = selector ; var searchContext = ! context ? rootInstance : typeof context === 'string' ? ( 0 , utils_js_1 . isHtml ) ( context ) ? new LoadedCheerio ( [ parse ( context , options , false , null ) ] , rootInstance , options ) : ( ( search = "" . concat ( context , " " ) . concat ( search ) ) , rootInstance ) : ( 0 , utils_js_1 . isCheerio ) ( context ) ? context : new LoadedCheerio ( Array . isArray ( context ) ? context : [ context ] , rootInstance , options ) ; if ( ! searchContext ) return instance ; return searchContext . find ( search ) ; } Object . assign ( initialize , staticMethods , { load : load , _root : initialRoot , _options : internalOpts , fn : LoadedCheerio . prototype , prototype : LoadedCheerio . prototype , } ) ; return initialize ; }
Create a querying function, bound to a document created from the provided markup.
Create a querying function bound to a document created from the provided markup .
/** Create an extended class here, so that extensions only live on one instance. */ /** @class */ // $($) // Add a cyclic reference, so that calling methods on `_root` never fails. // $(), $(null), $(undefined), $(false) // $(<html>) // $(dom) // $([dom]) // We know that our selector is a string now. // If we don't have a context, maybe we have a root, from loading // $('li', '<ul>...</ul>') // $('li', 'ul') // $('li', $) // $('li', node), $('li', [nodes]) // If we still don't have a context, return /*
             * #id, .class, tag
             */ // Add in static methods & properties // `_root` and `_options` are used in static methods. // Add `fn` for plugins // Add the prototype here to maintain `instanceof` behavior.