{"version":3,"file":"image-Dslx1wAK.js","names":[],"sources":["../../node_modules/.pnpm/@tauri-apps+api@2.11.1/node_modules/@tauri-apps/api/image.js"],"sourcesContent":["import { Resource, invoke } from './core.js';\n\n// Copyright 2019-2024 Tauri Programme within The Commons Conservancy\n// SPDX-License-Identifier: Apache-2.0\n// SPDX-License-Identifier: MIT\n/** An RGBA Image in row-major order from top to bottom. */\nclass Image extends Resource {\n    /**\n     * Creates an Image from a resource ID. For internal use only.\n     *\n     * @ignore\n     */\n    constructor(rid) {\n        super(rid);\n    }\n    /** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */\n    static async new(rgba, width, height) {\n        return invoke('plugin:image|new', {\n            rgba: transformImage(rgba),\n            width,\n            height\n        }).then((rid) => new Image(rid));\n    }\n    /**\n     * Creates a new image using the provided bytes by inferring the file format.\n     * If the format is known, prefer [@link Image.fromPngBytes] or [@link Image.fromIcoBytes].\n     *\n     * Only `ico` and `png` are supported (based on activated feature flag).\n     *\n     * Note that you need the `image-ico` or `image-png` Cargo features to use this API.\n     * To enable it, change your Cargo.toml file:\n     * ```toml\n     * [dependencies]\n     * tauri = { version = \"...\", features = [\"...\", \"image-png\"] }\n     * ```\n     */\n    static async fromBytes(bytes) {\n        return invoke('plugin:image|from_bytes', {\n            bytes: transformImage(bytes)\n        }).then((rid) => new Image(rid));\n    }\n    /**\n     * Creates a new image using the provided path.\n     *\n     * Only `ico` and `png` are supported (based on activated feature flag).\n     *\n     * Note that you need the `image-ico` or `image-png` Cargo features to use this API.\n     * To enable it, change your Cargo.toml file:\n     * ```toml\n     * [dependencies]\n     * tauri = { version = \"...\", features = [\"...\", \"image-png\"] }\n     * ```\n     */\n    static async fromPath(path) {\n        return invoke('plugin:image|from_path', { path }).then((rid) => new Image(rid));\n    }\n    /** Returns the RGBA data for this image, in row-major order from top to bottom.  */\n    async rgba() {\n        return invoke('plugin:image|rgba', {\n            rid: this.rid\n        }).then((buffer) => new Uint8Array(buffer));\n    }\n    /** Returns the size of this image.  */\n    async size() {\n        return invoke('plugin:image|size', { rid: this.rid });\n    }\n}\n/**\n * Transforms image from various types into a type acceptable by Rust.\n *\n * See [tauri::image::JsImage](https://docs.rs/tauri/2/tauri/image/enum.JsImage.html) for more information.\n * Note the API signature is not stable and might change.\n */\nfunction transformImage(image) {\n    const ret = image == null\n        ? null\n        : typeof image === 'string'\n            ? image\n            : image instanceof Image\n                ? image.rid\n                : image;\n    return ret;\n}\n\nexport { Image, transformImage };\n"],"x_google_ignoreList":[0],"mappings":"6IAMM,EAAN,MAAM,UAAc,CAAS,CAMzB,YAAY,EAAK,CACb,MAAM,CAAG,CACb,CAEA,aAAa,IAAI,EAAM,EAAO,EAAQ,CAClC,OAAO,EAAO,mBAAoB,CAC9B,KAAM,EAAe,CAAI,EACzB,QACA,QACJ,CAAC,CAAC,CAAC,KAAM,GAAQ,IAAI,EAAM,CAAG,CAAC,CACnC,CAcA,aAAa,UAAU,EAAO,CAC1B,OAAO,EAAO,0BAA2B,CACrC,MAAO,EAAe,CAAK,CAC/B,CAAC,CAAC,CAAC,KAAM,GAAQ,IAAI,EAAM,CAAG,CAAC,CACnC,CAaA,aAAa,SAAS,EAAM,CACxB,OAAO,EAAO,yBAA0B,CAAE,MAAK,CAAC,CAAC,CAAC,KAAM,GAAQ,IAAI,EAAM,CAAG,CAAC,CAClF,CAEA,MAAM,MAAO,CACT,OAAO,EAAO,oBAAqB,CAC/B,IAAK,KAAK,GACd,CAAC,CAAC,CAAC,KAAM,GAAW,IAAI,WAAW,CAAM,CAAC,CAC9C,CAEA,MAAM,MAAO,CACT,OAAO,EAAO,oBAAqB,CAAE,IAAK,KAAK,GAAI,CAAC,CACxD,CACJ,EAOA,SAAS,EAAe,EAAO,CAQ3B,OAPY,GAAS,KACf,KACA,OAAO,GAAU,SACb,EACA,aAAiB,EACb,EAAM,IACN,CAElB"}