diff --git a/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download Enscape 2.7 Full Crack Bagas31 for Free The Good the Bad and the Ugly.md b/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download Enscape 2.7 Full Crack Bagas31 for Free The Good the Bad and the Ugly.md
deleted file mode 100644
index a12176a315c67425fa8007e73439514f7b9c7b7c..0000000000000000000000000000000000000000
--- a/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download Enscape 2.7 Full Crack Bagas31 for Free The Good the Bad and the Ugly.md
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
If you are looking for a way to download Enscape 2.7 full crack bagas31 for free, you have come to the right place. Enscape is a powerful and easy-to-use 3D rendering software that works with popular design tools like SketchUp, Revit, Rhino, and ArchiCAD. With Enscape, you can create stunning photorealistic images, animations, and virtual reality experiences in minutes.
-Download ✺ https://byltly.com/2uKvpF
However, Enscape is not a cheap software. The official price for a monthly subscription is $58.99, and the annual license costs $469.00. That's why many people are searching for a way to download Enscape 2.7 full crack bagas31 for free. Bagas31 is a popular website that offers cracked software and games for download.
-But before you rush to download Enscape 2.7 full crack bagas31 for free, you should know the risks and consequences of using cracked software. In this article, we will explain why you should avoid downloading Enscape 2.7 full crack bagas31 for free, and what are the best alternatives to get Enscape legally and safely.
-Downloading Enscape 2.7 full crack bagas31 for free may seem like a good idea at first, but it can actually cause you more trouble than you think. Here are some of the reasons why you should avoid downloading Enscape 2.7 full crack bagas31 for free:
-As you can see, downloading Enscape 2.7 full crack bagas31 for free is not worth the risk and hassle. You are better off using the official version of Enscape that is legal, safe, reliable, and ethical.
- -If you want to use Enscape without breaking the law or compromising your security, you have several options to get it legally and safely. Here are some of the best ways to get Enscape legally and safely:
-Autocad is one of the most popular and powerful software for designing and drafting in various fields such as architecture, engineering, construction, and more. However, it is also quite expensive and requires online activation to use it fully. If you want to use Autocad 2010 without paying or activating it online, you might be interested in using h force keygen autocad 2010.
-H force keygen autocad 2010 is a tool that can generate activation codes for any Autodesk product, including Autocad 2010. It can also bypass the online activation process and let you use Autocad 2010 offline. In this article, we will show you what h force keygen autocad 2010 is, why you might want to use it, how to download it, how to install and activate Autocad 2010 with it, and some tips and warnings for using it.
-Download … https://byltly.com/2uKwzF
H force keygen autocad 2010 is a software that can create serial numbers and activation codes for any Autodesk product, such as Autocad, Revit, Maya, Inventor, etc. It works by using an algorithm that can crack the encryption of Autodesk's licensing system. By using h force keygen autocad 2010, you can get a valid activation code for your Autodesk product without having to pay or register online.
-Another feature of h force keygen autocad 2010 is that it can bypass the online activation process of Autodesk products. Normally, when you install an Autodesk product, you have to enter a serial number and a product key, and then activate it online by connecting to Autodesk's servers. However, with h force keygen autocad 2010, you can skip this step and activate your Autodesk product offline. This way, you can use your Autodesk product without having to connect to the internet or worry about being detected by Autodesk.
-xforce keygen autocad 2010 32 bit & 64 bit
-how to activate key autocad 2010 with xforce
-xforce keygen for all autodesk products 2010
-download xforce keygen 2010 32 bit & 64 bit
-civilmdc autodesk 2010 xforce keygenerator
-how to use xforce keygen for autodesk 2010
-disable antivirus before using xforce keygen
-xforce keygen request code and activation code
-download x force 2009 crack for autocad 2010
-download x force 2010 crack for autocad 2010
-download x force 2011 crack for autocad 2010
-download x force 2012 crack for autocad 2010
-rewanh h force keygen autocad 2010 free download
-h force keygen autocad 2010 design and shape the world
-patronway h force keygen autocad 2010 hot
-h force keygen autocad 2010 versioning of a library
-h force keygen autocad 2010 put your own name on it
-h force keygen autocad 2010 it's here just here yes
-h force keygen autocad 2010 lt v2010
-h force keygen autocad 2010 civil engineering software
-autodesk autocad 2010 product key and serial number
-autodesk autocad 2010 system requirements and compatibility
-autodesk autocad 2010 features and enhancements
-autodesk autocad 2010 tutorials and learning resources
-autodesk autocad 2010 trial version and free download
-autodesk autocad 2010 service pack and update releases
-autodesk autocad 2010 support and troubleshooting
-autodesk autocad 2010 forums and community
-autodesk autocad 2010 subscription and benefits
-autodesk autocad 2010 license and activation issues
-how to install and run autodesk autocad 2010 on windows
-how to install and run autodesk autocad 2010 on mac os x
-how to install and run autodesk autocad 2010 on linux
-how to uninstall and remove autodesk autocad 2010 completely
-how to migrate and transfer autodesk autocad 2010 settings and data
-how to customize and optimize autodesk autocad 2010 performance and appearance
-how to create and edit drawings in autodesk autocad 2010
-how to annotate and dimension drawings in autodesk autocad 2010
-how to print and plot drawings in autodesk autocad 2010
-how to share and collaborate drawings in autodesk autocad 2010
-how to import and export drawings in autodesk autocad 2010
-how to use blocks and attributes in autodesk autocad 2010
-how to use layers and layouts in autodesk autocad 2010
-how to use commands and shortcuts in autodesk autocad 2010
-how to use tools and palettes in autodesk autocad 2010
-how to use hatch and gradient in autodesk autocad 2010
-how to use text and tables in autodesk autocad 2010
-how to use dimensions and leaders in autodesk autocad 2010
-how to use dynamic blocks and parameters in autodesk autocad 2010
One of the main reasons why you might want to use h force keygen autocad 2010 is to save money and time. As you may know, Autocad 2010 is not a cheap software. It costs hundreds or even thousands of dollars depending on the version and the license type. Moreover, it requires online activation every time you install it on a new computer or change your hardware configuration. This can be inconvenient and time-consuming if you have multiple computers or devices that you want to use Autocad on. By using h force keygen autocad 2010, you can avoid these costs and hassles and use Autocad 2010 on as many computers as you want.
-Another reason why you might want to use h force keygen autocad 2010 is to access all the features and updates of Autocad 2010. Autocad 2010 is a powerful software that has many features and functions that can help you create amazing designs and drawings. However, some of these features are only available for registered users or subscribers who have paid for a license. For example, some of the advanced tools, commands, options, settings, libraries, templates, etc. are only accessible for licensed users. Moreover, licensed users can also get regular updates and patches from Autodesk that can improve the performance and security of Autocad. By using h force keygen autocad 2010, you can unlock all these features and updates without having to pay or subscribe.
-The first step to use h force keygen autocad 2010 is to find a reliable source online where you can download it safely. Since h force keygen autocad 2010 is an illegal software that violates Autodesk's terms of service and intellectual property rights, it is not available on official websites or platforms. Instead, you have to look for it on unofficial websites or platforms that host pirated software or cracks. However, not all of these websites or platforms are trustworthy or secure. Some of them may contain malware or viruses that can harm your computer or steal your personal information. Therefore, you have to be careful when choosing where to download h force keygen autocad 2010 from.
-One way to find a reliable source online is to use a search engine such as Google or Bing . You can type keywords such as "h force keygen autocad 2010", "h force keygen autocad", "xforce keygen autocad", etc. You will get many results that link to different websites or platforms that offer h force keygen autocad 2010 for download. However, before clicking on any of these links, you should check their credibility and reputation by looking at their domain name, reviews, ratings, comments, etc. You should avoid websites or platforms that have suspicious domain names (such as .ru .cn .tk .biz .info etc.), negative reviews or ratings (such as low stars or thumbs down), no comments or feedback (or only positive ones), etc.
-Another way to find a reliable source online is to use a peer-to-peer network such as BitTorrent or uTorrent . These are applications that allow users to share files with each other directly without using a central server. You can use these applications to download h force keygen autocad 2010 from other users who have already downloaded it before. However, before downloading any file from these applications, you should check its size (it should be around few MBs), name (it should match with h force keygen autocad), extension (it should be .exe .rar .zip etc.), seeders (the more the better), leechers (the less the better), etc.
-The second step to use h force keygen autocad The response was too long so I had to truncate it.
The second step to use h force keygen autocad 2010 is to extract the zip file and run the keygen. After you have downloaded h force keygen autocad 2010 from a reliable source online, you will get a zip file that contains the keygen and some instructions. You need to extract this zip file using a software such as WinRAR or 7-Zip . You will get a folder that contains the keygen and some files. You need to run the keygen by double-clicking on it or right-clicking on it and choosing Run as administrator. You will see a window that looks like this:
-
-+---------------------------------------------------+ | X-FORCE KEYGEN | | Autodesk 2010 Products | | | | Serial: [Enter any serial number] | | Product Key: [Enter the product key for Autocad] | | Request Code: [Enter the request code from Autocad]| | | | [Patch] [Generate] [Copy] | +---------------------------------------------------+
- You need to enter some information in the keygen to generate an activation code for Autocad 2010. Here is what you need to do:
-The third step to use h force keygen autocad 2010 is to install Autocad 2010 and restart your computer. Before you can use h force keygen autocad 2010, you need to have Autocad 2010 installed on your computer. You can install Autocad 2010 from a CD or DVD that you have bought or downloaded from an unofficial website or platform. To install Autocad 2010, you need to follow these steps:
-The fourth step to use h force keygen autocad 2010 is to disable your internet connection and antivirus. Before you can activate Autocad 2010 with h force keygen autocad 2010, you need to disconnect your computer from the internet and disable your antivirus software. This is because h force keygen autocad 2010 is an illegal software that can be detected and blocked by Autodesk's servers or your antivirus software. To disable your internet connection and antivirus, you need to follow these steps:
-The fifth step to use h force keygen autocad 2010 is to run the keygen and click on Patch. After you have disabled your internet connection and antivirus, you need to run h force keygen autocad 2010 and patch your Autodesk product. To do this, you need to follow these steps:
-The sixth step to use h force keygen autocad 2010 is to copy the request code and paste it into the keygen. After you have patched your Autodesk product with h force keygen autocad 2010, you need to copy the request code from Autocad 2010 and paste it into the keygen. To do this, you need to follow these steps:
-The seventh and final step to use h force keygen autocad 2010 is to copy the activation code and paste it into the activation screen. After you have entered the request code into the keygen, you need to copy the activation code from the keygen and paste it into the activation screen of Autocad 2010. To do this, you need to follow these steps:
-While using h force keygen autocad 2010 can save you money and time and give you access to all the features and updates of Autocad 2010, it also comes with some risks and drawbacks. Using h force keygen autocad 2010 is illegal and unethical, as it violates Autodesk's terms of service and intellectual property rights. By using h force keygen autocad 2010, you are not supporting Autodesk's development and innovation, and you are depriving them of their rightful revenue. Moreover, using h force keygen autocad 2010 can expose you to legal consequences, such as fines, lawsuits, or even criminal charges, if Autodesk finds out that you are using their software without a valid license. Therefore, use h force keygen autocad 2010 at your own risk and discretion.
-Another risk of using h force keygen autocad 2010 is that it can contain malware or viruses that can harm your computer or steal your personal information. Since h force keygen autocad 2010 is an unofficial software that is not verified or approved by Autodesk or any other authority, it can be infected with malicious code that can damage your system files, corrupt your data, slow down your performance, spy on your activities, or even take control of your computer. Therefore, be careful of where you download h force keygen autocad 2010 from and what files you run on your computer. Always scan h force keygen autocad 2010 with a reputable antivirus software before using it, and never open any suspicious files or links that come with it.
-A final tip for using h force keygen autocad 2010 is to avoid updating Autocad 2010 online. While h force keygen autocad 2010 can give you access to all the features and updates of Autocad 2010, it can also make your software vulnerable to detection and deactivation by Autodesk's servers. If you update Autocad 2010 online, you may lose your activation status and get a message that says "Your license is invalid" or "Your license has expired". Moreover, updating Autocad 2010 online may also overwrite some files that were patched by h force keygen autocad 2010, making it unusable or unstable. Therefore, do not update Autocad 2010 online if you have activated it with h force keygen autocad The response was too long so I had to truncate it. 2010. Instead, you can use offline updates or patches that are compatible with h force keygen autocad 2010.
In conclusion, h force keygen autocad 2010 is a tool that can generate activation codes for Autocad 2010 and bypass the online activation process. It can help you save money and time and access all the features and updates of Autocad 2010. However, it also comes with some risks and drawbacks, such as being illegal and unethical, containing malware or viruses, and exposing you to legal consequences. Therefore, you should use h force keygen autocad 2010 at your own risk and discretion, and be careful of where you download it from and what files you run on your computer. Moreover, you should avoid updating Autocad 2010 online if you have activated it with h force keygen autocad 2010.
-Autocad 2010 is a software for designing and drafting in various fields such as architecture, engineering, construction, and more. It is developed by Autodesk, a leading company in software and technology. Autocad 2010 has many features and functions that can help you create amazing designs and drawings.
-H force keygen autocad 2010 is a tool that can generate activation codes for Autocad 2010 and bypass the online activation process. It can help you use Autocad 2010 without paying or activating it online.
-To use h force keygen autocad 2010, you need to follow these steps:
-H force keygen autocad 2010 is not safe, as it is an illegal software that violates Autodesk's terms of service and intellectual property rights. It can also contain malware or viruses that can harm your computer or steal your personal information. Moreover, it can expose you to legal consequences if Autodesk finds out that you are using their software without a valid license.
-H force keygen autocad 2010 is not legal, as it violates Autodesk's terms of service and intellectual property rights. By using h force keygen autocad 2010, you are not supporting Autodesk's development and innovation, and you are depriving them of their rightful revenue. Moreover, you are breaking the law and risking fines, lawsuits, or even criminal charges if Autodesk finds out that you are using their software without a valid license.
- 0a6ba089ebArtcut 2009 is a software that allows you to cut vinyl and plastic with ease. It is designed for cutting plotters and supports EPS files for cutting. In this article, we will give you a comprehensive review of Artcut 2009, its features, benefits, and drawbacks.
-DOWNLOAD ✸ https://imgfil.com/2uy0qH
Artcut 2009 is a software developed by WENTAI Technology Corporation, a Chinese company that specializes in cutting plotters. It is a 3D and 2D graphics programming software that can be used for 5-axis laser cutting with LT-FREE. It has a step-by-step guide to the entire programming process and allows you to modify axis paths independently to avoid collisions with other components or devices.
-Artcut 2009 is a user-friendly software that does not require any special skills to operate. It has a straight cut interface that lets you interact with others easily. It works in the length of included fashion where pictures can only point to the bitmap and are in style mode. It also has a color confirmation feature that corrects sharp images linearly.
-Artcut 2009 has many features that make it a powerful software for cutting vinyl and plastic. Some of the main features are:
-Artcut 2009 has many benefits that make it a popular software among users. Some of the main benefits are:
- -Artcut 2009 is not a perfect software and it has some drawbacks that you should be aware of. Some of the main drawbacks are:
-If you want to download and install Artcut 2009 for free on your Windows computer, you can follow these steps:
-Artcut 2009 is easy to use and has a simple interface. To use Artcut 2009, you need to follow these steps:
-Artcut 2009 also has some advanced features that you can use to enhance your cutting projects. For example, you can use the color confirmation feature to correct the colors of your graphics. You can also use the phase compensation feature to adjust the cutting speed and pressure. You can also use the corner adjustment feature to smooth the corners of your graphics.
-Artcut 2009 is not the only software that you can use for cutting vinyl and plastic. There are some alternatives that you can try if you want to explore other options. Some of the alternatives are:
-Artcut 2009 is a software that allows you to cut vinyl and plastic with ease. It is designed for cutting plotters and supports EPS files for cutting. It has many features and benefits that make it a popular software among users. However, it also has some drawbacks and limitations that you should be aware of. If you want to download and install Artcut 2009 for free on your Windows computer, you can follow the steps in this article. You can also try some alternatives to Artcut 2009 if you want to explore other options.
-Artcut 2009 is a software that allows you to cut vinyl and plastic with ease. It is designed for cutting plotters and supports EPS files for cutting. It has many features and benefits that make it a popular software among users. However, it also has some drawbacks and limitations that you should be aware of. If you want to download and install Artcut 2009 for free on your Windows computer, you can follow the steps in this article. You can also try some alternatives to Artcut 2009 if you want to explore other options.
3cee63e6c2Dolby CineAsset is a software suite that can create and play back digital cinema packages (DCPs) from virtually any source. DCPs are the standard format for distributing and projecting movies in digital cinemas around the world. Dolby CineAsset can also generate encrypted DCPs and key delivery messages (KDMs) for content protection and management.
-Dolby CineAsset is developed by Dolby Laboratories, a leading company in audio and video technologies for cinema, home entertainment, and mobile devices. Dolby CineAsset was formerly known as CineAsset Doremi, before Dolby acquired Doremi Labs in 2014.
-Download › https://imgfil.com/2uxZiy
Dolby CineAsset has two versions: Dolby CineAsset Player and Dolby CineAsset Pro. The Player version is a simple and cost-effective solution for playing back DCPs on a PC or Mac. The Pro version has more advanced features, such as creating DCPs from any file format, encoding audio and video in Dolby formats, adding subtitles and metadata, and generating KDMs for encrypted DCPs.
-Dolby CineAsset is compatible with most digital cinema servers and projectors, as well as Dolby Cinema processors and sound systems. Dolby CineAsset can also support high dynamic range (HDR), high frame rate (HFR), 3D, and immersive audio formats, such as Dolby Atmos.
-Dolby CineAsset is a powerful and versatile tool for content creation and playback in digital cinemas. It can help filmmakers, distributors, exhibitors, and post-production facilities to deliver high-quality and secure cinematic experiences to audiences worldwide.
- -To use Dolby CineAsset, you need to install the software on a PC or Mac that meets the minimum system requirements. You also need to have a license key that matches the version and features of the software you want to use. You can purchase a license key from Dolby or from an authorized reseller.
-Once you have installed and activated the software, you can launch it from the Start menu (Windows) or the Applications folder (Mac). You will see the main window of Dolby CineAsset, which has four tabs: Playlist, Ingest, Encode, and KDM.
-The Playlist tab allows you to create and edit playlists of DCPs and other media files. You can drag and drop files from your computer or network to the playlist, or use the Add button to browse for files. You can also adjust the playback settings, such as audio channels, subtitles, and aspect ratio. To play back a playlist, you need to connect your computer to a digital cinema server and projector via Ethernet or HDMI.
-The Ingest tab allows you to import media files and convert them to DCPs. You can select the source files from your computer or network, or use the Capture button to record video and audio from an external device. You can also specify the output settings, such as resolution, frame rate, color space, compression, encryption, and metadata. To create a DCP, you need to click on the Ingest button and wait for the process to finish.
- -The Encode tab allows you to encode audio and video files in Dolby formats, such as Dolby Digital Plus, Dolby TrueHD, Dolby E, and Dolby Vision. You can select the source files from your computer or network, or use the Capture button to record video and audio from an external device. You can also choose the output settings, such as bit rate, sample rate, channel layout, dynamic range control, and metadata. To encode a file, you need to click on the Encode button and wait for the process to finish.
-The KDM tab allows you to generate KDMs for encrypted DCPs. You can select the DCPs from your computer or network, or use the Browse button to locate them. You can also enter the recipient information, such as name, email address, certificate file, and validity period. To generate a KDM, you need to click on the Generate button and wait for the process to finish.
d5da3c52bfIf you are looking for a challenging and exciting action game for your Android device, you should definitely check out Black Commando Special Ops. This is a first-person shooter game that puts you in the role of a black commando who has to complete various missions in different locations. You will face enemies, obstacles, and traps as you try to survive and accomplish your objectives.
-But what if you want to enjoy the game with more features and benefits? Well, there is a way to do that. You can download the mod apk version of Black Commando Special Ops, which gives you access to unlimited money, ammo, health, and more. With this mod apk, you can unlock all the weapons, items, and upgrades in the game and have more fun and satisfaction.
-Download Zip ••• https://urlin.us/2uSY7n
In this article, we will tell you more about the features of Black Commando Special Ops mod apk, how to download and install it on your device, and some tips and tricks to improve your gameplay. So, let's get started!
-Black Commando Special Ops is a great game by itself, but with the mod apk version, you can enjoy it even more. Here are some of the main features of the mod apk that you can benefit from:
-Downloading and installing Black Commando Special Ops mod apk is very easy and simple. Just follow these steps:
-How to download black commando special ops mod apk for free
-Black commando special ops mod apk unlimited money and gems
-Black commando special ops mod apk latest version 2023
-Black commando special ops mod apk offline mode
-Black commando special ops mod apk hack and cheats
-Download black commando special ops mod apk for android
-Download black commando special ops mod apk for pc
-Download black commando special ops mod apk for ios
-Download black commando special ops mod apk for windows 10
-Download black commando special ops mod apk for mac
-Black commando special ops mod apk gameplay and review
-Black commando special ops mod apk features and benefits
-Black commando special ops mod apk tips and tricks
-Black commando special ops mod apk best weapons and skills
-Black commando special ops mod apk missions and challenges
-Black commando special ops mod apk download link and instructions
-Black commando special ops mod apk no root required
-Black commando special ops mod apk safe and secure
-Black commando special ops mod apk virus free and malware free
-Black commando special ops mod apk compatible with all devices
-Black commando special ops mod apk online multiplayer mode
-Black commando special ops mod apk realistic graphics and sound effects
-Black commando special ops mod apk high quality performance and optimization
-Black commando special ops mod apk easy to install and use
-Black commando special ops mod apk user friendly interface and controls
-Black commando special ops mod apk fun and addictive gameplay
-Black commando special ops mod apk action packed and thrilling adventure
-Black commando special ops mod apk strategic and tactical combat
-Black commando special ops mod apk secret and covert missions
-Black commando special ops mod apk diverse and dynamic environments
Now that you have installed Black Commando Special Ops mod apk on your device, you are ready to play the game. But before you do that, here are some tips and tricks that can help you improve your gameplay and performance:
-A: Yes, you can play Black Commando Special Ops mod apk with other players online. You can join or create rooms and invite your friends or random players to join you. You can also chat with them and cooperate to complete the missions.
197e85843dIf you love playing bingo games, you might want to try Bingo Crush APK, a fun and engaging bingo game for Android devices. Bingo Crush APK is a game of chance where you can play bingo with players from around the world, enjoy different themes and rooms, and collect bonuses and rewards. In this article, we will tell you what Bingo Crush APK is, how to download and install it, and what are its pros and cons.
-Download »»» https://jinyurl.com/2uNUvX
Bingo Crush APK is an Android game that lets you play bingo in a casino-like environment. You can choose from various rooms that are designed like different countries, such as Christmas, San Francisco, Magical World, etc. You can also compete with other players in special tournaments and events. The game is free to play, but you can also purchase in-game items and coins to enhance your experience.
-One of the best features of Bingo Crush APK is that you can play with players from around the world in real-time. You can chat with them, send them gifts, and make new friends. You can also join a club or create your own to play with your buddies. The game has a global leaderboard where you can see your ranking and achievements.
-Bingo Crush APK has a variety of themes and rooms that will keep you entertained. You can play bingo in rooms that are decorated like different countries, such as Christmas, San Francisco, Magical World, etc. Each room has its own rules, prizes, and challenges. You can also unlock new rooms as you progress in the game.
-Bingo Crush APK rewards you with bonuses and rewards for playing the game. You can get free coins every day by logging in, spinning the wheel, completing tasks, etc. You can also get free tickets by watching ads or inviting friends. You can use these coins and tickets to play more bingo games and win more prizes.
-To download Bingo Crush APK, you need to find a trusted source that offers the latest version of the game. You can use the web search results above to find some websites that provide the APK file. For example, you can use [this link](^1^) to download the game from mob.org.
-bingo crush fun game apk
-bingo crush free download apk
-bingo crush android game apk
-bingo crush latest version apk
-bingo crush mod apk unlimited money
-bingo crush online game apk
-bingo crush offline game apk
-bingo crush hack apk download
-bingo crush cheats apk free
-bingo crush update apk 2023
-bingo tribe crush apk download
-bingo tribe crush game apk
-bingo tribe crush mod apk
-bingo tribe crush hack apk
-bingo tribe crush cheats apk
-bingo tribe crush free coins apk
-bingo tribe crush online apk
-bingo tribe crush offline apk
-bingo tribe crush latest apk
-bingo tribe crush new version apk
-bingo crush win real money apk
-bingo crush cash game apk
-bingo crush rewards apk download
-bingo crush prizes apk free
-bingo crush gift cards apk 2023
-bingo crush paypal apk mod
-bingo crush amazon apk hack
-bingo crush google play apk cheat
-bingo crush walmart apk update
-bingo crush target apk new
-bingo pop candy crush saga apk
-bingo pop candy crush game apk
-bingo pop candy crush mod apk
-bingo pop candy crush hack apk
-bingo pop candy crush cheats apk
-bingo pop candy crush free boosters apk
-bingo pop candy crush online apk
-bingo pop candy crush offline apk
-bingo pop candy crush latest apk
-bingo pop candy crush new version apk
Before you install Bingo Crush APK, you need to enable unknown sources on your device. This will allow you to install apps that are not from the Google Play Store. To do this, go to Settings > Security > Unknown Sources and toggle it on.
-After you download the APK file, locate it on your device and tap on it to install it. Follow the instructions on the screen to complete the installation. Once done, launch the game from your app drawer or home screen and enjoy playing bingo.
-Bingo Crush APK has many advantages that make it a fun and engaging bingo game for Android users. Some of them are:
-Bingo Crush APK also has some disadvantages that might affect your enjoyment of the game. Some of them are:
-Bingo Crush APK is a fun and engaging bingo game for Android devices that lets you play bingo with players from around the world, enjoy different themes and rooms, and collect bonuses and rewards. It is free to play, but you can also purchase in-game items and coins to enhance your experience. It is easy to play, social, and diverse. However, it also has some drawbacks, such as ads, bugs, compatibility issues, and internet requirement. If you want to try Bingo Crush APK, you can download it from a trusted source and install it on your device. You might find it a great way to pass the time and have fun.
-You should try Bingo Crush APK if you:
-If you have any questions about Bingo Crush APK, you can check out the FAQs below or contact the developer for more information.
-Bingo Crush APK is an Android application package (APK) file that you can download and install from a third-party source. Bingo Crush from Google Play Store is the official version of the game that you can download and install from the Google Play Store. Both versions are similar in terms of gameplay and features, but they might have some differences in terms of updates, security, and performance.
-Bingo Crush APK is generally safe to download and install if you get it from a trusted source. However, you should always be careful when downloading and installing APK files from unknown sources, as they might contain malware or viruses that could harm your device or steal your data. You should also enable unknown sources on your device before installing Bingo Crush APK, which might expose your device to potential risks.
-You can get more coins and tickets in Bingo Crush APK by:
-You can join or create a club in Bingo Crush APK by:
-You can contact the developer of Bingo Crush APK by:
-If you are a fan of chess and looking for a fun and engaging chess app to play on your Android device, you might have heard of Chess Universe. It is a popular chess app that offers a lot of features and game modes to suit your preferences and skill level. But what if you want to enjoy all the premium features and resources of the app without spending any money? That's where Chess Universe Mod APK Apkpure comes in.
-In this article, we will review Chess Universe Mod APK Apkpure and tell you what it offers, how to download and install it on your device, some tips and tricks for playing the game, and some alternatives to try out. Let's get started!
-DOWNLOAD ->>> https://jinyurl.com/2uNLA3
Chess Universe is a chess app that is designed to motivate and guide chess players to improve their skills from beginner to master. It has a unique design and exciting gameplay that makes chess more fun and accessible for everyone.
-Some of the features of Chess Universe are:
-board size, and chess pieces.
Chess Universe is a free app that you can download from the Google Play Store or the App Store. However, some of the features and resources of the app require in-app purchases or subscriptions. For example, you need to spend gems, coins, keys, or chests to unlock new chessboards, chess sets, emojis, special effects, academy towers, characters, or pets. You also need to watch ads to get hints or undo moves. If you want to avoid these limitations and enjoy the full potential of the app, you might want to try Chess Universe Mod APK Apkpure.
-A mod apk is a modified version of an original app that gives you access to all the premium features and resources of the app for free. Chess Universe Mod APK Apkpure is one such mod apk that you can download from the apkpure website, which is a reliable source for mod apks.
-Some of the benefits of Chess Universe Mod APK Apkpure are:
-Chess Universe Mod APK Apkpure is a great way to enhance your chess experience and have more fun with the app. However, you should be aware of some of the risks and drawbacks of using mod apks from third-party sources. For example, you might face compatibility issues with your device or the original app. You might also violate the terms and conditions of the app developer or expose your device to malware or viruses. Therefore, you should always scan the mod apk file before installing it on your device and use it at your own risk.
-chess universe online mod apk download
-chess universe mod apk unlimited money
-chess universe online chess apk
-chess universe mod apk latest version
-chess universe online mod apk free
-chess universe mod apk android 1
-chess universe online chess app
-chess universe mod apk premium
-chess universe online mod apk hack
-chess universe mod apk revdl
-chess universe online chess game
-chess universe mod apk pro
-chess universe online mod apk unlocked
-chess universe mod apk rexdl
-chess universe online chess multiplayer
-chess universe mod apk vip
-chess universe online mod apk no ads
-chess universe mod apk happymod
-chess universe online chess puzzles
-chess universe mod apk full
-chess universe online mod apk offline
-chess universe mod apk cracked
-chess universe online chess lessons
-chess universe mod apk paid
-chess universe online mod apk 2021
-chess universe mod apk old version
-chess universe online mod apk update
-chess universe mod apk obb
-chess universe online mod apk 2020
-chess universe mod apk original
-chess universe online mod apk android
-chess universe mod apk data
-chess universe online mod apk ios
-chess universe mod apk pure
-chess universe online mod apk pc
-chess universe mod apk mirror
-chess universe online mod apk windows
-chess universe mod apk uptodown
-chess universe online mod apk mac
-chess universe mod apk mob.org
-chess universe online mod apk laptop
-chess universe mod apk xda
-chess universe online mod apk reddit
-chess universe mod apk youtube
-chess universe online mod apk quora
-chess universe mod apk facebook
-chess universe online mod apk telegram
-chess universe mod apk twitter
If you decide to download Chess Universe Mod APK Apkpure, you need to find a reliable source for it. Apkpure is one of the most popular websites that offer mod apks for various apps and games. It has a large collection of mod apks that are updated regularly and verified for safety and quality.
-Some of the advantages of using apkpure are:
-Apkpure is a trusted and reputable website that has millions of users worldwide. However, you should still be careful when downloading mod apks from any third-party source and always backup your data before installing them on your device.
-If you want to download and install Chess Universe Mod APK from Apkpure, you need to follow these steps:
-Congratulations! You have successfully downloaded and installed Chess Universe Mod APK from Apkpure. Now you can enjoy the game and improve your chess skills.
-Chess Universe is a fun and engaging chess app that can help you learn and master chess. However, if you want to get better at the game and win more matches, you need to practice and apply some tips and tricks. Here are some suggestions that can help you improve your chess performance:
-Chess Universe is a great chess app that offers a lot of fun and learning opportunities for chess players of all levels. By following these tips and tricks, you can improve your chess skills and enjoy the game more.
-These are some of the FAQs about Chess Universe Mod APK Apkpure. If you have any other questions, please feel free to ask us in the comments section below.
197e85843dq.dc?"AM":"PM"},"%S":function(q){return V(q.Lc,2)},"%t":function(){return" "},"%u":function(q){return q.Tb||7},"%U":function(q){return V(Math.floor((q.Wb+7-q.Tb)/7),2)},"%V":function(q){var be=Math.floor((q.Wb+7-(q.Tb+6)%7)/7);if(2>=(q.Tb+371-q.Wb-2)%7&&be++,be)be==53&&((Ee=(q.Tb+371-q.Wb)%7)==4||Ee==3&&It(q.Xb)||(be=1));else{be=52;var Ee=(q.Tb+7-q.Wb-1)%7;(Ee==4||Ee==5&&It(q.Xb%400-1))&&be++}return V(be,2)},"%w":function(q){return q.Tb},"%W":function(q){return V(Math.floor((q.Wb+7-(q.Tb+6)%7)/7),2)},"%y":function(q){return(q.Xb+1900).toString().substring(2)},"%Y":function(q){return q.Xb+1900},"%z":function(q){var be=0<=(q=q.Jc);return q=Math.abs(q)/60,(be?"+":"-")+("0000"+(q/60*100+q%60)).slice(-4)},"%Z":function(q){return q.Mc},"%%":function(){return"%"}},k=k.replace(/%%/g,"\0\0"),fe)k.includes(ke)&&(k=k.replace(new RegExp(ke,"g"),fe[ke](D)));return ke=function(q){var be=Array(De(q)+1);return Ne(q,be,0,be.length),be}(k=k.replace(/\0\0/g,"%")),ke.length>P?0:(function(q,be){s().set(q,be>>>0)}(ke,x),ke.length-1)}re.fc();var hn=[null,Le,kt,at,bt,_t,yt,wt,vt,Tt,xt,St,Ot,At,Pt,E,I,U,W,Z,G,ge,xe,qe,et,Bt],pn={b:function(x){return $t(x+24)+24},n:function(x){return(x=new oe(x)).uc()||(x.hc(!0),se--),x.ic(!1),st.push(x),x.sc(),x.vc()},ma:function(x){throw z("Unexpected exception thrown, this is not properly supported - aborting"),ye=!0,x},x:function(){de(0);var x=st.pop();if(x.Hc()&&!x.kc()){var P=x.Dc();P&&_e(P)(x.Zb),gt(x.Zb)}ie=0},e:function(){var x=ie;if(!x)return Re=0;var P=new oe(x);P.cc(x);var k=P.bc();if(!k)return Re=0,x;for(var D=Array.prototype.slice.call(arguments),j=0;jF(D));else if(M)postMessage({targetThread:x,cmd:"processProxyingQueue",queue:D});else{if(!(x=re.Vb[x]))return;x.postMessage({cmd:"processProxyingQueue",queue:D})}return 1},Ea:function(){return-1},Pa:function(x,P){x=new Date(1e3*R(x)),f()[P>>2>>>0]=x.getUTCSeconds(),f()[P+4>>2>>>0]=x.getUTCMinutes(),f()[P+8>>2>>>0]=x.getUTCHours(),f()[P+12>>2>>>0]=x.getUTCDate(),f()[P+16>>2>>>0]=x.getUTCMonth(),f()[P+20>>2>>>0]=x.getUTCFullYear()-1900,f()[P+24>>2>>>0]=x.getUTCDay(),x=(x.getTime()-Date.UTC(x.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,f()[P+28>>2>>>0]=x},Qa:function(x,P){x=new Date(1e3*R(x)),f()[P>>2>>>0]=x.getSeconds(),f()[P+4>>2>>>0]=x.getMinutes(),f()[P+8>>2>>>0]=x.getHours(),f()[P+12>>2>>>0]=x.getDate(),f()[P+16>>2>>>0]=x.getMonth(),f()[P+20>>2>>>0]=x.getFullYear()-1900,f()[P+24>>2>>>0]=x.getDay();var k=new Date(x.getFullYear(),0,1),D=(x.getTime()-k.getTime())/864e5|0;f()[P+28>>2>>>0]=D,f()[P+36>>2>>>0]=-60*x.getTimezoneOffset(),D=new Date(x.getFullYear(),6,1).getTimezoneOffset(),x=0|(D!=(k=k.getTimezoneOffset())&&x.getTimezoneOffset()==Math.min(k,D)),f()[P+32>>2>>>0]=x},Ra:function(x){var P=new Date(f()[x+20>>2>>>0]+1900,f()[x+16>>2>>>0],f()[x+12>>2>>>0],f()[x+8>>2>>>0],f()[x+4>>2>>>0],f()[x>>2>>>0],0),k=f()[x+32>>2>>>0],D=P.getTimezoneOffset(),j=new Date(P.getFullYear(),0,1),V=new Date(P.getFullYear(),6,1).getTimezoneOffset(),K=j.getTimezoneOffset(),ee=Math.min(K,V);return 0>k?f()[x+32>>2>>>0]=+(V!=K&&ee==D):0 >2>>>0]=P.getDay(),k=(P.getTime()-j.getTime())/864e5|0,f()[x+28>>2>>>0]=k,f()[x>>2>>>0]=P.getSeconds(),f()[x+4>>2>>>0]=P.getMinutes(),f()[x+8>>2>>>0]=P.getHours(),f()[x+12>>2>>>0]=P.getDate(),f()[x+16>>2>>>0]=P.getMonth(),P.getTime()/1e3|0},Aa:U,Ba:W,Sa:function x(P,k,D){x.Ac||(x.Ac=!0,Z(P,k,D))},y:function(){pe("")},U:function(){if(!T&&!A){var x="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";ot||(ot={}),ot[x]||(ot[x]=1,T&&(x="warning: "+x),z(x))}},ra:function(){return 4294901760},B:ft,Ia:function(x,P,k){h().copyWithin(x>>>0,P>>>0,P+k>>>0)},F:function(){return T?a(3993).cpus().length:navigator.hardwareConcurrency},Da:function(x,P,k){we.length=P,k>>=3;for(var D=0;D >>0];return(0>x?Et[-x-1]:hn[x]).apply(null,we)},qa:function(x){var P=h().length;if((x>>>=0)<=P||4294901760
=k;k*=2){var D=P*(1+.2/k);D=Math.min(D,x+100663296);var j=Math;D=Math.max(x,D),j=j.min.call(j,4294901760,D+(65536-D%65536)%65536);e:{try{X.grow(j-ne.byteLength+65535>>>16),Pe(X.buffer);var V=1;break e}catch{}V=void 0}if(V)return!0}return!1},Na:function(){throw"unwind"},Ga:G,Ha:ge,J:it,I:xe,S:qe,ga:et,R:Bt,d:function(){return Re},na:function x(P,k){x.lc||(x.lc=function(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var j=new Uint8Array(1);return()=>(crypto.getRandomValues(j),j[0])}if(T)try{var V=a(Object(function(){var K=new Error("Cannot find module 'crypto'");throw K.code="MODULE_NOT_FOUND",K}()));return()=>V.randomBytes(1)[0]}catch{}return()=>pe("randomDevice")}());for(var D=0;D >0>>>0]=x.lc();return 0},ia:function(x,P,k){var D=le();try{return _e(x)(P,k)}catch(j){if(ue(D),j!==j+0)throw j;de(1,0)}},ja:function(x,P,k){var D=le();try{return _e(x)(P,k)}catch(j){if(ue(D),j!==j+0)throw j;de(1,0)}},K:function(x){var P=le();try{return _e(x)()}catch(k){if(ue(P),k!==k+0)throw k;de(1,0)}},f:function(x,P){var k=le();try{return _e(x)(P)}catch(D){if(ue(k),D!==D+0)throw D;de(1,0)}},P:function(x,P,k){var D=le();try{return _e(x)(P,k)}catch(j){if(ue(D),j!==j+0)throw j;de(1,0)}},Q:function(x,P,k){var D=le();try{return _e(x)(P,k)}catch(j){if(ue(D),j!==j+0)throw j;de(1,0)}},k:function(x,P,k){var D=le();try{return _e(x)(P,k)}catch(j){if(ue(D),j!==j+0)throw j;de(1,0)}},p:function(x,P,k,D){var j=le();try{return _e(x)(P,k,D)}catch(V){if(ue(j),V!==V+0)throw V;de(1,0)}},q:function(x,P,k,D,j){var V=le();try{return _e(x)(P,k,D,j)}catch(K){if(ue(V),K!==K+0)throw K;de(1,0)}},N:function(x,P,k,D,j,V){var K=le();try{return _e(x)(P,k,D,j,V)}catch(ee){if(ue(K),ee!==ee+0)throw ee;de(1,0)}},s:function(x,P,k,D,j,V){var K=le();try{return _e(x)(P,k,D,j,V)}catch(ee){if(ue(K),ee!==ee+0)throw ee;de(1,0)}},w:function(x,P,k,D,j,V,K){var ee=le();try{return _e(x)(P,k,D,j,V,K)}catch(he){if(ue(ee),he!==he+0)throw he;de(1,0)}},L:function(x,P,k,D,j,V,K,ee){var he=le();try{return _e(x)(P,k,D,j,V,K,ee)}catch(fe){if(ue(he),fe!==fe+0)throw fe;de(1,0)}},E:function(x,P,k,D,j,V,K,ee,he,fe,ke,Ke){var We=le();try{return _e(x)(P,k,D,j,V,K,ee,he,fe,ke,Ke)}catch(q){if(ue(We),q!==q+0)throw q;de(1,0)}},aa:function(x,P,k,D,j,V,K,ee){var he=le();try{return un(x,P,k,D,j,V,K,ee)}catch(fe){if(ue(he),fe!==fe+0)throw fe;de(1,0)}},_:function(x,P,k,D,j,V,K){var ee=le();try{return en(x,P,k,D,j,V,K)}catch(he){if(ue(ee),he!==he+0)throw he;de(1,0)}},Z:function(x,P,k,D,j){var V=le();try{return ln(x,P,k,D,j)}catch(K){if(ue(V),K!==K+0)throw K;de(1,0)}},ca:function(x,P,k,D){var j=le();try{return sn(x,P,k,D)}catch(V){if(ue(j),V!==V+0)throw V;de(1,0)}},$:function(x){var P=le();try{return Zt(x)}catch(k){if(ue(P),k!==k+0)throw k;de(1,0)}},ba:function(x,P){var k=le();try{return an(x,P)}catch(D){if(ue(k),D!==D+0)throw D;de(1,0)}},Y:function(x,P,k){var D=le();try{return tn(x,P,k)}catch(j){if(ue(D),j!==j+0)throw j;de(1,0)}},g:function(x){var P=le();try{_e(x)()}catch(k){if(ue(P),k!==k+0)throw k;de(1,0)}},r:function(x,P){var k=le();try{_e(x)(P)}catch(D){if(ue(k),D!==D+0)throw D;de(1,0)}},i:function(x,P,k){var D=le();try{_e(x)(P,k)}catch(j){if(ue(D),j!==j+0)throw j;de(1,0)}},ha:function(x,P,k,D){var j=le();try{_e(x)(P,k,D)}catch(V){if(ue(j),V!==V+0)throw V;de(1,0)}},m:function(x,P,k,D){var j=le();try{_e(x)(P,k,D)}catch(V){if(ue(j),V!==V+0)throw V;de(1,0)}},v:function(x,P,k,D,j){var V=le();try{_e(x)(P,k,D,j)}catch(K){if(ue(V),K!==K+0)throw K;de(1,0)}},u:function(x,P,k,D,j,V){var K=le();try{_e(x)(P,k,D,j,V)}catch(ee){if(ue(K),ee!==ee+0)throw ee;de(1,0)}},O:function(x,P,k,D,j,V,K){var ee=le();try{_e(x)(P,k,D,j,V,K)}catch(he){if(ue(ee),he!==he+0)throw he;de(1,0)}},A:function(x,P,k,D,j,V,K,ee){var he=le();try{_e(x)(P,k,D,j,V,K,ee)}catch(fe){if(ue(he),fe!==fe+0)throw fe;de(1,0)}},ka:function(x,P,k,D,j,V,K,ee,he){var fe=le();try{_e(x)(P,k,D,j,V,K,ee,he)}catch(ke){if(ue(fe),ke!==ke+0)throw ke;de(1,0)}},C:function(x,P,k,D,j,V,K,ee,he,fe,ke){var Ke=le();try{_e(x)(P,k,D,j,V,K,ee,he,fe,ke)}catch(We){if(ue(Ke),We!==We+0)throw We;de(1,0)}},D:function(x,P,k,D,j,V,K,ee,he,fe,ke,Ke,We,q,be,Ee){var tt=le();try{_e(x)(P,k,D,j,V,K,ee,he,fe,ke,Ke,We,q,be,Ee)}catch(ht){if(ue(tt),ht!==ht+0)throw ht;de(1,0)}},fa:function(x,P,k,D,j,V,K,ee){var he=le();try{nn(x,P,k,D,j,V,K,ee)}catch(fe){if(ue(he),fe!==fe+0)throw fe;de(1,0)}},da:function(x,P,k,D,j,V,K,ee,he,fe,ke,Ke){var We=le();try{on(x,P,k,D,j,V,K,ee,he,fe,ke,Ke)}catch(q){if(ue(We),q!==q+0)throw q;de(1,0)}},ea:function(x,P,k,D,j,V){var K=le();try{rn(x,P,k,D,j,V)}catch(ee){if(ue(K),ee!==ee+0)throw ee;de(1,0)}},o:function(x){return x},a:X||t.wasmMemory,G:function(x){Re=x},la:Vt,z:function(x,P,k,D){return Vt(x,P,k,D)}};(function(){function x(j,V){t.asm=j.exports,re.qc.push(t.asm.sb),Be=t.asm.ub,Ve.unshift(t.asm.Va),te=V,M||($e--,t.monitorRunDependencies&&t.monitorRunDependencies($e),$e==0&&Ye&&(j=Ye,Ye=null,j()))}function P(j){x(j.instance,j.module)}function k(j){return function(){if(!H&&(O||A)){if(typeof fetch=="function"&&!Se.startsWith("file://"))return fetch(Se,{credentials:"same-origin"}).then(function(V){if(!V.ok)throw"failed to load wasm binary file at '"+Se+"'";return V.arrayBuffer()}).catch(function(){return lt()});if(d)return new Promise(function(V,K){d(Se,function(ee){V(new Uint8Array(ee))},K)})}return Promise.resolve().then(function(){return lt()})}().then(function(V){return WebAssembly.instantiate(V,D)}).then(function(V){return V}).then(j,function(V){z("failed to asynchronously prepare wasm: "+V),pe(V)})}var D={a:pn};if(M||($e++,t.monitorRunDependencies&&t.monitorRunDependencies($e)),t.instantiateWasm)try{return t.instantiateWasm(D,x)}catch(j){return z("Module.instantiateWasm callback failed with error: "+j),!1}(H||typeof WebAssembly.instantiateStreaming!="function"||pt()||Se.startsWith("file://")||T||typeof fetch!="function"?k(P):fetch(Se,{credentials:"same-origin"}).then(function(j){return WebAssembly.instantiateStreaming(j,D).then(P,function(V){return z("wasm streaming compile failed: "+V),z("falling back to ArrayBuffer instantiation"),k(P)})})).catch(r)})(),t.___wasm_call_ctors=function(){return(t.___wasm_call_ctors=t.asm.Va).apply(null,arguments)},t._OrtInit=function(){return(t._OrtInit=t.asm.Wa).apply(null,arguments)},t._OrtCreateSessionOptions=function(){return(t._OrtCreateSessionOptions=t.asm.Xa).apply(null,arguments)},t._OrtAppendExecutionProvider=function(){return(t._OrtAppendExecutionProvider=t.asm.Ya).apply(null,arguments)},t._OrtAddSessionConfigEntry=function(){return(t._OrtAddSessionConfigEntry=t.asm.Za).apply(null,arguments)},t._OrtReleaseSessionOptions=function(){return(t._OrtReleaseSessionOptions=t.asm._a).apply(null,arguments)},t._OrtCreateSession=function(){return(t._OrtCreateSession=t.asm.$a).apply(null,arguments)},t._OrtReleaseSession=function(){return(t._OrtReleaseSession=t.asm.ab).apply(null,arguments)},t._OrtGetInputCount=function(){return(t._OrtGetInputCount=t.asm.bb).apply(null,arguments)},t._OrtGetOutputCount=function(){return(t._OrtGetOutputCount=t.asm.cb).apply(null,arguments)},t._OrtGetInputName=function(){return(t._OrtGetInputName=t.asm.db).apply(null,arguments)},t._OrtGetOutputName=function(){return(t._OrtGetOutputName=t.asm.eb).apply(null,arguments)},t._OrtFree=function(){return(t._OrtFree=t.asm.fb).apply(null,arguments)},t._OrtCreateTensor=function(){return(t._OrtCreateTensor=t.asm.gb).apply(null,arguments)},t._OrtGetTensorData=function(){return(t._OrtGetTensorData=t.asm.hb).apply(null,arguments)},t._OrtReleaseTensor=function(){return(t._OrtReleaseTensor=t.asm.ib).apply(null,arguments)},t._OrtCreateRunOptions=function(){return(t._OrtCreateRunOptions=t.asm.jb).apply(null,arguments)},t._OrtAddRunConfigEntry=function(){return(t._OrtAddRunConfigEntry=t.asm.kb).apply(null,arguments)},t._OrtReleaseRunOptions=function(){return(t._OrtReleaseRunOptions=t.asm.lb).apply(null,arguments)},t._OrtRun=function(){return(t._OrtRun=t.asm.mb).apply(null,arguments)},t._OrtEndProfiling=function(){return(t._OrtEndProfiling=t.asm.nb).apply(null,arguments)};var Dt=t._pthread_self=function(){return(Dt=t._pthread_self=t.asm.ob).apply(null,arguments)},$t=t._malloc=function(){return($t=t._malloc=t.asm.pb).apply(null,arguments)},Gt=t._free=function(){return(Gt=t._free=t.asm.qb).apply(null,arguments)},qt=t._fflush=function(){return(qt=t._fflush=t.asm.rb).apply(null,arguments)};t.__emscripten_tls_init=function(){return(t.__emscripten_tls_init=t.asm.sb).apply(null,arguments)};var Wt=t.___funcs_on_exit=function(){return(Wt=t.___funcs_on_exit=t.asm.tb).apply(null,arguments)},Ht=t.__emscripten_thread_init=function(){return(Ht=t.__emscripten_thread_init=t.asm.vb).apply(null,arguments)};t.__emscripten_thread_crashed=function(){return(t.__emscripten_thread_crashed=t.asm.wb).apply(null,arguments)};var Ct,Xt=t._emscripten_run_in_main_runtime_thread_js=function(){return(Xt=t._emscripten_run_in_main_runtime_thread_js=t.asm.xb).apply(null,arguments)},Yt=t.__emscripten_proxy_execute_task_queue=function(){return(Yt=t.__emscripten_proxy_execute_task_queue=t.asm.yb).apply(null,arguments)},Rt=t.__emscripten_thread_free_data=function(){return(Rt=t.__emscripten_thread_free_data=t.asm.zb).apply(null,arguments)},Kt=t.__emscripten_thread_exit=function(){return(Kt=t.__emscripten_thread_exit=t.asm.Ab).apply(null,arguments)},de=t._setThrew=function(){return(de=t._setThrew=t.asm.Bb).apply(null,arguments)},Qt=t._emscripten_stack_set_limits=function(){return(Qt=t._emscripten_stack_set_limits=t.asm.Cb).apply(null,arguments)},le=t.stackSave=function(){return(le=t.stackSave=t.asm.Db).apply(null,arguments)},ue=t.stackRestore=function(){return(ue=t.stackRestore=t.asm.Eb).apply(null,arguments)},jt=t.stackAlloc=function(){return(jt=t.stackAlloc=t.asm.Fb).apply(null,arguments)},Nt=t.___cxa_can_catch=function(){return(Nt=t.___cxa_can_catch=t.asm.Gb).apply(null,arguments)},Jt=t.___cxa_is_pointer_type=function(){return(Jt=t.___cxa_is_pointer_type=t.asm.Hb).apply(null,arguments)},Zt=t.dynCall_j=function(){return(Zt=t.dynCall_j=t.asm.Ib).apply(null,arguments)},en=t.dynCall_iiiiij=function(){return(en=t.dynCall_iiiiij=t.asm.Jb).apply(null,arguments)},tn=t.dynCall_jii=function(){return(tn=t.dynCall_jii=t.asm.Kb).apply(null,arguments)},nn=t.dynCall_viiiiij=function(){return(nn=t.dynCall_viiiiij=t.asm.Lb).apply(null,arguments)},rn=t.dynCall_vjji=function(){return(rn=t.dynCall_vjji=t.asm.Mb).apply(null,arguments)},on=t.dynCall_viiijjjii=function(){return(on=t.dynCall_viiijjjii=t.asm.Nb).apply(null,arguments)},sn=t.dynCall_iij=function(){return(sn=t.dynCall_iij=t.asm.Ob).apply(null,arguments)},an=t.dynCall_ji=function(){return(an=t.dynCall_ji=t.asm.Pb).apply(null,arguments)},un=t.dynCall_iiiiiij=function(){return(un=t.dynCall_iiiiiij=t.asm.Qb).apply(null,arguments)},ln=t.dynCall_iiij=function(){return(ln=t.dynCall_iiij=t.asm.Rb).apply(null,arguments)};function cn(){function x(){if(!Ct&&(Ct=!0,t.calledRun=!0,!ye)&&(M||rt(Ve),e(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),!M)){if(t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;){var P=t.postRun.shift();Qe.unshift(P)}rt(Qe)}}if(!(0<$e))if(M)e(t),M||rt(Ve),postMessage({cmd:"loaded"});else{if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)ze();rt(Ue),0<$e||(t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),x()},1)):x())}}if(t.UTF8ToString=Ae,t.stringToUTF8=function(x,P,k){return Ne(x,h(),P,k)},t.lengthBytesUTF8=De,t.keepRuntimeAlive=Ge,t.wasmMemory=X,t.stackSave=le,t.stackRestore=ue,t.stackAlloc=jt,t.ExitStatus=Je,t.PThread=re,Ye=function x(){Ct||cn(),Ct||(Ye=x)},t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);0 {var u,c=(u=(u=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(p){var s,h,f;p=p||{},s||(s=p!==void 0?p:{}),s.ready=new Promise(function(E,I){h=E,f=I});var l,o,t,e,r,i,d=Object.assign({},s),g="./this.program",m=(E,I)=>{throw I},_=typeof window=="object",y=typeof importScripts=="function",w=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",v="";w?(v=y?a(908).dirname(v)+"/":"//",i=()=>{r||(e=a(1384),r=a(908))},l=function(E,I){return i(),E=r.normalize(E),e.readFileSync(E,I?void 0:"utf8")},t=E=>((E=l(E,!0)).buffer||(E=new Uint8Array(E)),E),o=(E,I,F)=>{i(),E=r.normalize(E),e.readFile(E,function(R,U){R?F(R):I(U.buffer)})},1 {if(T||0 {var I=new XMLHttpRequest;return I.open("GET",E,!1),I.send(null),I.responseText},y&&(t=E=>{var I=new XMLHttpRequest;return I.open("GET",E,!1),I.responseType="arraybuffer",I.send(null),new Uint8Array(I.response)}),o=(E,I,F)=>{var R=new XMLHttpRequest;R.open("GET",E,!0),R.responseType="arraybuffer",R.onload=()=>{R.status==200||R.status==0&&R.response?I(R.response):F()},R.onerror=F,R.send(null)});var S,O=s.print||console.log.bind(console),A=s.printErr||console.warn.bind(console);Object.assign(s,d),d=null,s.thisProgram&&(g=s.thisProgram),s.quit&&(m=s.quit),s.wasmBinary&&(S=s.wasmBinary);var T=s.noExitRuntime||!1;typeof WebAssembly!="object"&&Pe("no native wasm support detected");var M,N,B,$,L,H,C=!1,z=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function J(E,I,F){var R=(I>>>=0)+F;for(F=I;E[F]&&!(F>=R);)++F;if(16 (U=(240&U)==224?(15&U)<<12|W<<6|Y:(7&U)<<18|W<<12|Y<<6|63&E[I++])?R+=String.fromCharCode(U):(U-=65536,R+=String.fromCharCode(55296|U>>10,56320|1023&U))}}else R+=String.fromCharCode(U)}return R}function X(E,I){return(E>>>=0)?J($,E,I):""}function te(E,I,F,R){if(!(0 >>=0;R=F+R-1;for(var W=0;W =Y&&(Y=65536+((1023&Y)<<10)|1023&E.charCodeAt(++W)),127>=Y){if(F>=R)break;I[F++>>>0]=Y}else{if(2047>=Y){if(F+1>=R)break;I[F++>>>0]=192|Y>>6}else{if(65535>=Y){if(F+2>=R)break;I[F++>>>0]=224|Y>>12}else{if(F+3>=R)break;I[F++>>>0]=240|Y>>18,I[F++>>>0]=128|Y>>12&63}I[F++>>>0]=128|Y>>6&63}I[F++>>>0]=128|63&Y}}return I[F>>>0]=0,F-U}function ne(E){for(var I=0,F=0;F =R?I++:2047>=R?I+=2:55296<=R&&57343>=R?(I+=4,++F):I+=3}return I}function me(){var E=M.buffer;N=E,s.HEAP8=B=new Int8Array(E),s.HEAP16=new Int16Array(E),s.HEAP32=L=new Int32Array(E),s.HEAPU8=$=new Uint8Array(E),s.HEAPU16=new Uint16Array(E),s.HEAPU32=H=new Uint32Array(E),s.HEAPF32=new Float32Array(E),s.HEAPF64=new Float64Array(E)}var Me,Oe=[],ce=[],Te=[],ye=[],Fe=0;function He(){var E=s.preRun.shift();Oe.unshift(E)}var Ae,Ne=0,De=null;function Pe(E){throw s.onAbort&&s.onAbort(E),A(E="Aborted("+E+")"),C=!0,E=new WebAssembly.RuntimeError(E+". Build with -sASSERTIONS for more info."),f(E),E}function ve(){return Ae.startsWith("data:application/octet-stream;base64,")}if(Ae="ort-wasm.wasm",!ve()){var Be=Ae;Ae=s.locateFile?s.locateFile(Be,v):v+Be}function Ue(){var E=Ae;try{if(E==Ae&&S)return new Uint8Array(S);if(t)return t(E);throw"both async and sync fetching of the wasm failed"}catch(I){Pe(I)}}function Ve(E){this.name="ExitStatus",this.message="Program terminated with exit("+E+")",this.status=E}function Xe(E){for(;0 >2>>>0]=I},this.Eb=function(){return H[this.zb+4>>2>>>0]},this.Sb=function(I){H[this.zb+8>>2>>>0]=I},this.Wb=function(){return H[this.zb+8>>2>>>0]},this.Tb=function(){L[this.zb>>2>>>0]=0},this.Ib=function(I){B[this.zb+12>>0>>>0]=I?1:0},this.Pb=function(){return B[this.zb+12>>0>>>0]!=0},this.Jb=function(I){B[this.zb+13>>0>>>0]=I?1:0},this.Lb=function(){return B[this.zb+13>>0>>>0]!=0},this.Rb=function(I,F){this.Fb(0),this.Ub(I),this.Sb(F),this.Tb(),this.Ib(!1),this.Jb(!1)},this.Nb=function(){L[this.zb>>2>>>0]+=1},this.Xb=function(){var I=L[this.zb>>2>>>0];return L[this.zb>>2>>>0]=I-1,I===1},this.Fb=function(I){H[this.zb+16>>2>>>0]=I},this.Ob=function(){return H[this.zb+16>>2>>>0]},this.Qb=function(){if(mt(this.Eb()))return H[this.Db>>2>>>0];var I=this.Ob();return I!==0?I:this.Db}}function $e(E){return ot(new Se(E).zb)}var Ye=[];function pe(E){var I=Ye[E];return I||(E>=Ye.length&&(Ye.length=E+1),Ye[E]=I=Me.get(E)),I}function pt(E){var I=ne(E)+1,F=_e(I);return F&&te(E,B,F,I),F}var lt={};function Et(){if(!Je){var E,I={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:g||"./this.program"};for(E in lt)lt[E]===void 0?delete I[E]:I[E]=lt[E];var F=[];for(E in I)F.push(E+"="+I[E]);Je=F}return Je}var Je,ct=[null,[],[]];function dt(E,I){var F=ct[E];I===0||I===10?((E===1?O:A)(J(F,0)),F.length=0):F.push(I)}var Le=0;function it(E){return E%4==0&&(E%100!=0||E%400==0)}var re=[31,29,31,30,31,30,31,31,30,31,30,31],rt=[31,28,31,30,31,30,31,31,30,31,30,31];function Mt(E,I,F,R){function U(G,ge,xe){for(G=typeof G=="number"?G.toString():G||"";G.length et?-1:0 qe-G.getDate())){G.setDate(G.getDate()+ge);break}ge-=qe-G.getDate()+1,G.setDate(1),11>xe?G.setMonth(xe+1):(G.setMonth(0),G.setFullYear(G.getFullYear()+1))}return xe=new Date(G.getFullYear()+1,0,4),ge=Z(new Date(G.getFullYear(),0,4)),xe=Z(xe),0>=Y(ge,G)?0>=Y(xe,G)?G.getFullYear()+1:G.getFullYear():G.getFullYear()-1}var ae=L[R+40>>2>>>0];for(var we in R={$b:L[R>>2>>>0],Zb:L[R+4>>2>>>0],Gb:L[R+8>>2>>>0],Kb:L[R+12>>2>>>0],Hb:L[R+16>>2>>>0],Cb:L[R+20>>2>>>0],Ab:L[R+24>>2>>>0],Bb:L[R+28>>2>>>0],bc:L[R+32>>2>>>0],Yb:L[R+36>>2>>>0],ac:ae?X(ae):""},F=X(F),ae={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})F=F.replace(new RegExp(we,"g"),ae[we]);var Ce="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),Ie="January February March April May June July August September October November December".split(" ");for(we in ae={"%a":function(G){return Ce[G.Ab].substring(0,3)},"%A":function(G){return Ce[G.Ab]},"%b":function(G){return Ie[G.Hb].substring(0,3)},"%B":function(G){return Ie[G.Hb]},"%C":function(G){return W((G.Cb+1900)/100|0,2)},"%d":function(G){return W(G.Kb,2)},"%e":function(G){return U(G.Kb,2," ")},"%g":function(G){return Q(G).toString().substring(2)},"%G":function(G){return Q(G)},"%H":function(G){return W(G.Gb,2)},"%I":function(G){return(G=G.Gb)==0?G=12:12 G.Gb?"AM":"PM"},"%S":function(G){return W(G.$b,2)},"%t":function(){return" "},"%u":function(G){return G.Ab||7},"%U":function(G){return W(Math.floor((G.Bb+7-G.Ab)/7),2)},"%V":function(G){var ge=Math.floor((G.Bb+7-(G.Ab+6)%7)/7);if(2>=(G.Ab+371-G.Bb-2)%7&&ge++,ge)ge==53&&((xe=(G.Ab+371-G.Bb)%7)==4||xe==3&&it(G.Cb)||(ge=1));else{ge=52;var xe=(G.Ab+7-G.Bb-1)%7;(xe==4||xe==5&&it(G.Cb%400-1))&&ge++}return W(ge,2)},"%w":function(G){return G.Ab},"%W":function(G){return W(Math.floor((G.Bb+7-(G.Ab+6)%7)/7),2)},"%y":function(G){return(G.Cb+1900).toString().substring(2)},"%Y":function(G){return G.Cb+1900},"%z":function(G){var ge=0<=(G=G.Yb);return G=Math.abs(G)/60,(ge?"+":"-")+("0000"+(G/60*100+G%60)).slice(-4)},"%Z":function(G){return G.ac},"%%":function(){return"%"}},F=F.replace(/%%/g,"\0\0"),ae)F.includes(we)&&(F=F.replace(new RegExp(we,"g"),ae[we](R)));return we=function(G){var ge=Array(ne(G)+1);return te(G,ge,0,ge.length),ge}(F=F.replace(/\0\0/g,"%")),we.length>I?0:(B.set(we,E>>>0),we.length-1)}var kt={a:function(E){return _e(E+24)+24},m:function(E){return(E=new Se(E)).Pb()||(E.Ib(!0),Ge--),E.Jb(!1),Qe.push(E),E.Nb(),E.Qb()},ia:function(E){throw A("Unexpected exception thrown, this is not properly supported - aborting"),C=!0,E},w:function(){se(0);var E=Qe.pop();if(E.Xb()&&!E.Lb()){var I=E.Wb();I&&pe(I)(E.Db),$e(E.Db)}ze=0},d:function(){var E=ze;if(!E)return Le=0;var I=new Se(E);I.Fb(E);var F=I.Eb();if(!F)return Le=0,E;for(var R=Array.prototype.slice.call(arguments),U=0;U >>2]+4294967296*L[E+4>>>2])),L[I>>2>>>0]=E.getUTCSeconds(),L[I+4>>2>>>0]=E.getUTCMinutes(),L[I+8>>2>>>0]=E.getUTCHours(),L[I+12>>2>>>0]=E.getUTCDate(),L[I+16>>2>>>0]=E.getUTCMonth(),L[I+20>>2>>>0]=E.getUTCFullYear()-1900,L[I+24>>2>>>0]=E.getUTCDay(),L[I+28>>2>>>0]=(E.getTime()-Date.UTC(E.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},Ea:function(E,I){E=new Date(1e3*(H[E>>>2]+4294967296*L[E+4>>>2])),L[I>>2>>>0]=E.getSeconds(),L[I+4>>2>>>0]=E.getMinutes(),L[I+8>>2>>>0]=E.getHours(),L[I+12>>2>>>0]=E.getDate(),L[I+16>>2>>>0]=E.getMonth(),L[I+20>>2>>>0]=E.getFullYear()-1900,L[I+24>>2>>>0]=E.getDay();var F=new Date(E.getFullYear(),0,1);L[I+28>>2>>>0]=(E.getTime()-F.getTime())/864e5|0,L[I+36>>2>>>0]=-60*E.getTimezoneOffset();var R=new Date(E.getFullYear(),6,1).getTimezoneOffset();F=F.getTimezoneOffset(),L[I+32>>2>>>0]=0|(R!=F&&E.getTimezoneOffset()==Math.min(F,R))},Fa:function(E){var I=new Date(L[E+20>>2>>>0]+1900,L[E+16>>2>>>0],L[E+12>>2>>>0],L[E+8>>2>>>0],L[E+4>>2>>>0],L[E>>2>>>0],0),F=L[E+32>>2>>>0],R=I.getTimezoneOffset(),U=new Date(I.getFullYear(),0,1),W=new Date(I.getFullYear(),6,1).getTimezoneOffset(),Y=U.getTimezoneOffset(),Z=Math.min(Y,W);return 0>F?L[E+32>>2>>>0]=+(W!=Y&&Z==R):0 >2>>>0]=I.getDay(),L[E+28>>2>>>0]=(I.getTime()-U.getTime())/864e5|0,L[E>>2>>>0]=I.getSeconds(),L[E+4>>2>>>0]=I.getMinutes(),L[E+8>>2>>>0]=I.getHours(),L[E+12>>2>>>0]=I.getDate(),L[E+16>>2>>>0]=I.getMonth(),I.getTime()/1e3|0},sa:function(){return-52},ta:function(){},Ga:function E(I,F,R){E.Vb||(E.Vb=!0,function(U,W,Y){function Z(Ie){return(Ie=Ie.toTimeString().match(/\(([A-Za-z ]+)\)$/))?Ie[1]:"GMT"}var Q=new Date().getFullYear(),ae=new Date(Q,0,1),we=new Date(Q,6,1);Q=ae.getTimezoneOffset();var Ce=we.getTimezoneOffset();L[U>>2>>>0]=60*Math.max(Q,Ce),L[W>>2>>>0]=+(Q!=Ce),U=Z(ae),W=Z(we),U=pt(U),W=pt(W),Ce >2>>>0]=U,H[Y+4>>2>>>0]=W):(H[Y>>2>>>0]=W,H[Y+4>>2>>>0]=U)}(I,F,R))},B:function(){Pe("")},ma:function(){return 4294901760},I:w?()=>{var E=process.hrtime();return 1e3*E[0]+E[1]/1e6}:()=>performance.now(),xa:function(E,I,F){$.copyWithin(E>>>0,I>>>0,I+F>>>0)},G:function(E){var I=$.length;if(4294901760<(E>>>=0))return!1;for(var F=1;4>=F;F*=2){var R=I*(1+.2/F);R=Math.min(R,E+100663296);var U=Math;R=Math.max(E,R),U=U.min.call(U,4294901760,R+(65536-R%65536)%65536);e:{try{M.grow(U-N.byteLength+65535>>>16),me();var W=1;break e}catch{}W=void 0}if(W)return!0}return!1},va:function(E,I){var F=0;return Et().forEach(function(R,U){var W=I+F;for(U=H[E+4*U>>2>>>0]=W,W=0;W>0>>>0]=R.charCodeAt(W);B[U>>0>>>0]=0,F+=R.length+1}),0},wa:function(E,I){var F=Et();H[E>>2>>>0]=F.length;var R=0;return F.forEach(function(U){R+=U.length+1}),H[I>>2>>>0]=R,0},ba:function(E){T||0 >2>>>0],Z=H[I+4>>2>>>0];I+=8;for(var Q=0;Q >>0]);U+=Z}return H[R>>2>>>0]=U,0},c:function(){return Le},ja:function E(I,F){E.Mb||(E.Mb=function(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var U=new Uint8Array(1);return()=>(crypto.getRandomValues(U),U[0])}if(w)try{var W=a(Object(function(){var Y=new Error("Cannot find module 'crypto'");throw Y.code="MODULE_NOT_FOUND",Y}()));return()=>W.randomBytes(1)[0]}catch{}return()=>Pe("randomDevice")}());for(var R=0;R >0>>>0]=E.Mb();return 0},ea:function(E,I,F){var R=ie();try{return pe(E)(I,F)}catch(U){if(oe(R),U!==U+0)throw U;se(1,0)}},fa:function(E,I,F){var R=ie();try{return pe(E)(I,F)}catch(U){if(oe(R),U!==U+0)throw U;se(1,0)}},J:function(E){var I=ie();try{return pe(E)()}catch(F){if(oe(I),F!==F+0)throw F;se(1,0)}},e:function(E,I){var F=ie();try{return pe(E)(I)}catch(R){if(oe(F),R!==R+0)throw R;se(1,0)}},N:function(E,I,F){var R=ie();try{return pe(E)(I,F)}catch(U){if(oe(R),U!==U+0)throw U;se(1,0)}},O:function(E,I,F){var R=ie();try{return pe(E)(I,F)}catch(U){if(oe(R),U!==U+0)throw U;se(1,0)}},j:function(E,I,F){var R=ie();try{return pe(E)(I,F)}catch(U){if(oe(R),U!==U+0)throw U;se(1,0)}},o:function(E,I,F,R){var U=ie();try{return pe(E)(I,F,R)}catch(W){if(oe(U),W!==W+0)throw W;se(1,0)}},p:function(E,I,F,R,U){var W=ie();try{return pe(E)(I,F,R,U)}catch(Y){if(oe(W),Y!==Y+0)throw Y;se(1,0)}},M:function(E,I,F,R,U,W){var Y=ie();try{return pe(E)(I,F,R,U,W)}catch(Z){if(oe(Y),Z!==Z+0)throw Z;se(1,0)}},r:function(E,I,F,R,U,W){var Y=ie();try{return pe(E)(I,F,R,U,W)}catch(Z){if(oe(Y),Z!==Z+0)throw Z;se(1,0)}},v:function(E,I,F,R,U,W,Y){var Z=ie();try{return pe(E)(I,F,R,U,W,Y)}catch(Q){if(oe(Z),Q!==Q+0)throw Q;se(1,0)}},K:function(E,I,F,R,U,W,Y,Z){var Q=ie();try{return pe(E)(I,F,R,U,W,Y,Z)}catch(ae){if(oe(Q),ae!==ae+0)throw ae;se(1,0)}},D:function(E,I,F,R,U,W,Y,Z,Q,ae,we,Ce){var Ie=ie();try{return pe(E)(I,F,R,U,W,Y,Z,Q,ae,we,Ce)}catch(G){if(oe(Ie),G!==G+0)throw G;se(1,0)}},X:function(E,I,F,R,U,W,Y,Z){var Q=ie();try{return Ot(E,I,F,R,U,W,Y,Z)}catch(ae){if(oe(Q),ae!==ae+0)throw ae;se(1,0)}},V:function(E,I,F,R,U,W,Y){var Z=ie();try{return _t(E,I,F,R,U,W,Y)}catch(Q){if(oe(Z),Q!==Q+0)throw Q;se(1,0)}},U:function(E,I,F,R,U){var W=ie();try{return At(E,I,F,R,U)}catch(Y){if(oe(W),Y!==Y+0)throw Y;se(1,0)}},Z:function(E,I,F,R){var U=ie();try{return xt(E,I,F,R)}catch(W){if(oe(U),W!==W+0)throw W;se(1,0)}},W:function(E){var I=ie();try{return bt(E)}catch(F){if(oe(I),F!==F+0)throw F;se(1,0)}},Y:function(E,I){var F=ie();try{return St(E,I)}catch(R){if(oe(F),R!==R+0)throw R;se(1,0)}},T:function(E,I,F){var R=ie();try{return yt(E,I,F)}catch(U){if(oe(R),U!==U+0)throw U;se(1,0)}},f:function(E){var I=ie();try{pe(E)()}catch(F){if(oe(I),F!==F+0)throw F;se(1,0)}},q:function(E,I){var F=ie();try{pe(E)(I)}catch(R){if(oe(F),R!==R+0)throw R;se(1,0)}},h:function(E,I,F){var R=ie();try{pe(E)(I,F)}catch(U){if(oe(R),U!==U+0)throw U;se(1,0)}},da:function(E,I,F,R){var U=ie();try{pe(E)(I,F,R)}catch(W){if(oe(U),W!==W+0)throw W;se(1,0)}},l:function(E,I,F,R){var U=ie();try{pe(E)(I,F,R)}catch(W){if(oe(U),W!==W+0)throw W;se(1,0)}},t:function(E,I,F,R,U){var W=ie();try{pe(E)(I,F,R,U)}catch(Y){if(oe(W),Y!==Y+0)throw Y;se(1,0)}},u:function(E,I,F,R,U,W){var Y=ie();try{pe(E)(I,F,R,U,W)}catch(Z){if(oe(Y),Z!==Z+0)throw Z;se(1,0)}},x:function(E,I,F,R,U,W,Y){var Z=ie();try{pe(E)(I,F,R,U,W,Y)}catch(Q){if(oe(Z),Q!==Q+0)throw Q;se(1,0)}},z:function(E,I,F,R,U,W,Y,Z){var Q=ie();try{pe(E)(I,F,R,U,W,Y,Z)}catch(ae){if(oe(Q),ae!==ae+0)throw ae;se(1,0)}},ga:function(E,I,F,R,U,W,Y,Z,Q){var ae=ie();try{pe(E)(I,F,R,U,W,Y,Z,Q)}catch(we){if(oe(ae),we!==we+0)throw we;se(1,0)}},A:function(E,I,F,R,U,W,Y,Z,Q,ae,we){var Ce=ie();try{pe(E)(I,F,R,U,W,Y,Z,Q,ae,we)}catch(Ie){if(oe(Ce),Ie!==Ie+0)throw Ie;se(1,0)}},C:function(E,I,F,R,U,W,Y,Z,Q,ae,we,Ce,Ie,G,ge,xe){var qe=ie();try{pe(E)(I,F,R,U,W,Y,Z,Q,ae,we,Ce,Ie,G,ge,xe)}catch(et){if(oe(qe),et!==et+0)throw et;se(1,0)}},aa:function(E,I,F,R,U,W,Y,Z){var Q=ie();try{wt(E,I,F,R,U,W,Y,Z)}catch(ae){if(oe(Q),ae!==ae+0)throw ae;se(1,0)}},_:function(E,I,F,R,U,W,Y,Z,Q,ae,we,Ce){var Ie=ie();try{Tt(E,I,F,R,U,W,Y,Z,Q,ae,we,Ce)}catch(G){if(oe(Ie),G!==G+0)throw G;se(1,0)}},$:function(E,I,F,R,U,W){var Y=ie();try{vt(E,I,F,R,U,W)}catch(Z){if(oe(Y),Z!==Z+0)throw Z;se(1,0)}},n:function(E){return E},F:function(E){Le=E},ha:Mt,y:function(E,I,F,R){return Mt(E,I,F,R)}};(function(){function E(U){s.asm=U.exports,M=s.asm.Ka,me(),Me=s.asm.ib,ce.unshift(s.asm.La),Ne--,s.monitorRunDependencies&&s.monitorRunDependencies(Ne),Ne==0&&De&&(U=De,De=null,U())}function I(U){E(U.instance)}function F(U){return function(){if(!S&&(_||y)){if(typeof fetch=="function"&&!Ae.startsWith("file://"))return fetch(Ae,{credentials:"same-origin"}).then(function(W){if(!W.ok)throw"failed to load wasm binary file at '"+Ae+"'";return W.arrayBuffer()}).catch(function(){return Ue()});if(o)return new Promise(function(W,Y){o(Ae,function(Z){W(new Uint8Array(Z))},Y)})}return Promise.resolve().then(function(){return Ue()})}().then(function(W){return WebAssembly.instantiate(W,R)}).then(function(W){return W}).then(U,function(W){A("failed to asynchronously prepare wasm: "+W),Pe(W)})}var R={a:kt};if(Ne++,s.monitorRunDependencies&&s.monitorRunDependencies(Ne),s.instantiateWasm)try{return s.instantiateWasm(R,E)}catch(U){return A("Module.instantiateWasm callback failed with error: "+U),!1}(S||typeof WebAssembly.instantiateStreaming!="function"||ve()||Ae.startsWith("file://")||w||typeof fetch!="function"?F(I):fetch(Ae,{credentials:"same-origin"}).then(function(U){return WebAssembly.instantiateStreaming(U,R).then(I,function(W){return A("wasm streaming compile failed: "+W),A("falling back to ArrayBuffer instantiation"),F(I)})})).catch(f)})(),s.___wasm_call_ctors=function(){return(s.___wasm_call_ctors=s.asm.La).apply(null,arguments)},s._OrtInit=function(){return(s._OrtInit=s.asm.Ma).apply(null,arguments)},s._OrtCreateSessionOptions=function(){return(s._OrtCreateSessionOptions=s.asm.Na).apply(null,arguments)},s._OrtAppendExecutionProvider=function(){return(s._OrtAppendExecutionProvider=s.asm.Oa).apply(null,arguments)},s._OrtAddSessionConfigEntry=function(){return(s._OrtAddSessionConfigEntry=s.asm.Pa).apply(null,arguments)},s._OrtReleaseSessionOptions=function(){return(s._OrtReleaseSessionOptions=s.asm.Qa).apply(null,arguments)},s._OrtCreateSession=function(){return(s._OrtCreateSession=s.asm.Ra).apply(null,arguments)},s._OrtReleaseSession=function(){return(s._OrtReleaseSession=s.asm.Sa).apply(null,arguments)},s._OrtGetInputCount=function(){return(s._OrtGetInputCount=s.asm.Ta).apply(null,arguments)},s._OrtGetOutputCount=function(){return(s._OrtGetOutputCount=s.asm.Ua).apply(null,arguments)},s._OrtGetInputName=function(){return(s._OrtGetInputName=s.asm.Va).apply(null,arguments)},s._OrtGetOutputName=function(){return(s._OrtGetOutputName=s.asm.Wa).apply(null,arguments)},s._OrtFree=function(){return(s._OrtFree=s.asm.Xa).apply(null,arguments)},s._OrtCreateTensor=function(){return(s._OrtCreateTensor=s.asm.Ya).apply(null,arguments)},s._OrtGetTensorData=function(){return(s._OrtGetTensorData=s.asm.Za).apply(null,arguments)},s._OrtReleaseTensor=function(){return(s._OrtReleaseTensor=s.asm._a).apply(null,arguments)},s._OrtCreateRunOptions=function(){return(s._OrtCreateRunOptions=s.asm.$a).apply(null,arguments)},s._OrtAddRunConfigEntry=function(){return(s._OrtAddRunConfigEntry=s.asm.ab).apply(null,arguments)},s._OrtReleaseRunOptions=function(){return(s._OrtReleaseRunOptions=s.asm.bb).apply(null,arguments)},s._OrtRun=function(){return(s._OrtRun=s.asm.cb).apply(null,arguments)},s._OrtEndProfiling=function(){return(s._OrtEndProfiling=s.asm.db).apply(null,arguments)};var Ze,_e=s._malloc=function(){return(_e=s._malloc=s.asm.eb).apply(null,arguments)},ot=s._free=function(){return(ot=s._free=s.asm.fb).apply(null,arguments)},ft=s._fflush=function(){return(ft=s._fflush=s.asm.gb).apply(null,arguments)},st=s.___funcs_on_exit=function(){return(st=s.___funcs_on_exit=s.asm.hb).apply(null,arguments)},se=s._setThrew=function(){return(se=s._setThrew=s.asm.jb).apply(null,arguments)},ie=s.stackSave=function(){return(ie=s.stackSave=s.asm.kb).apply(null,arguments)},oe=s.stackRestore=function(){return(oe=s.stackRestore=s.asm.lb).apply(null,arguments)},gt=s.stackAlloc=function(){return(gt=s.stackAlloc=s.asm.mb).apply(null,arguments)},at=s.___cxa_can_catch=function(){return(at=s.___cxa_can_catch=s.asm.nb).apply(null,arguments)},mt=s.___cxa_is_pointer_type=function(){return(mt=s.___cxa_is_pointer_type=s.asm.ob).apply(null,arguments)},bt=s.dynCall_j=function(){return(bt=s.dynCall_j=s.asm.pb).apply(null,arguments)},_t=s.dynCall_iiiiij=function(){return(_t=s.dynCall_iiiiij=s.asm.qb).apply(null,arguments)},yt=s.dynCall_jii=function(){return(yt=s.dynCall_jii=s.asm.rb).apply(null,arguments)},wt=s.dynCall_viiiiij=function(){return(wt=s.dynCall_viiiiij=s.asm.sb).apply(null,arguments)},vt=s.dynCall_vjji=function(){return(vt=s.dynCall_vjji=s.asm.tb).apply(null,arguments)},Tt=s.dynCall_viiijjjii=function(){return(Tt=s.dynCall_viiijjjii=s.asm.ub).apply(null,arguments)},xt=s.dynCall_iij=function(){return(xt=s.dynCall_iij=s.asm.vb).apply(null,arguments)},St=s.dynCall_ji=function(){return(St=s.dynCall_ji=s.asm.wb).apply(null,arguments)},Ot=s.dynCall_iiiiiij=function(){return(Ot=s.dynCall_iiiiiij=s.asm.xb).apply(null,arguments)},At=s.dynCall_iiij=function(){return(At=s.dynCall_iiij=s.asm.yb).apply(null,arguments)};function Pt(){function E(){if(!Ze&&(Ze=!0,s.calledRun=!0,!C)){if(Xe(ce),h(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;){var I=s.postRun.shift();ye.unshift(I)}Xe(ye)}}if(!(0 {b.exports=function(n,a){for(var u=new Array(arguments.length-1),c=0,p=2,s=!0;p {var a=n;a.length=function(h){var f=h.length;if(!f)return 0;for(var l=0;--f%4>1&&h.charAt(f)==="=";)++l;return Math.ceil(3*h.length)/4-l};for(var u=new Array(64),c=new Array(123),p=0;p<64;)c[u[p]=p<26?p+65:p<52?p+71:p<62?p-4:p-59|43]=p++;a.encode=function(h,f,l){for(var o,t=null,e=[],r=0,i=0;f >2],o=(3&d)<<4,i=1;break;case 1:e[r++]=u[o|d>>4],o=(15&d)<<2,i=2;break;case 2:e[r++]=u[o|d>>6],e[r++]=u[63&d],i=0}r>8191&&((t||(t=[])).push(String.fromCharCode.apply(String,e)),r=0)}return i&&(e[r++]=u[o],e[r++]=61,i===1&&(e[r++]=61)),t?(r&&t.push(String.fromCharCode.apply(String,e.slice(0,r))),t.join("")):String.fromCharCode.apply(String,e.slice(0,r))};var s="invalid encoding";a.decode=function(h,f,l){for(var o,t=l,e=0,r=0;r 1)break;if((i=c[i])===void 0)throw Error(s);switch(e){case 0:o=i,e=1;break;case 1:f[l++]=o<<2|(48&i)>>4,o=i,e=2;break;case 2:f[l++]=(15&o)<<4|(60&i)>>2,o=i,e=3;break;case 3:f[l++]=(3&o)<<6|i,e=0}}if(e===1)throw Error(s);return l-t},a.test=function(h){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(h)}},9211:b=>{function n(){this._listeners={}}b.exports=n,n.prototype.on=function(a,u,c){return(this._listeners[a]||(this._listeners[a]=[])).push({fn:u,ctx:c||this}),this},n.prototype.off=function(a,u){if(a===void 0)this._listeners={};else if(u===void 0)this._listeners[a]=[];else for(var c=this._listeners[a],p=0;p {function n(s){return typeof Float32Array<"u"?function(){var h=new Float32Array([-0]),f=new Uint8Array(h.buffer),l=f[3]===128;function o(i,d,g){h[0]=i,d[g]=f[0],d[g+1]=f[1],d[g+2]=f[2],d[g+3]=f[3]}function t(i,d,g){h[0]=i,d[g]=f[3],d[g+1]=f[2],d[g+2]=f[1],d[g+3]=f[0]}function e(i,d){return f[0]=i[d],f[1]=i[d+1],f[2]=i[d+2],f[3]=i[d+3],h[0]}function r(i,d){return f[3]=i[d],f[2]=i[d+1],f[1]=i[d+2],f[0]=i[d+3],h[0]}s.writeFloatLE=l?o:t,s.writeFloatBE=l?t:o,s.readFloatLE=l?e:r,s.readFloatBE=l?r:e}():function(){function h(l,o,t,e){var r=o<0?1:0;if(r&&(o=-o),o===0)l(1/o>0?0:2147483648,t,e);else if(isNaN(o))l(2143289344,t,e);else if(o>34028234663852886e22)l((r<<31|2139095040)>>>0,t,e);else if(o<11754943508222875e-54)l((r<<31|Math.round(o/1401298464324817e-60))>>>0,t,e);else{var i=Math.floor(Math.log(o)/Math.LN2);l((r<<31|i+127<<23|8388607&Math.round(o*Math.pow(2,-i)*8388608))>>>0,t,e)}}function f(l,o,t){var e=l(o,t),r=2*(e>>31)+1,i=e>>>23&255,d=8388607&e;return i===255?d?NaN:r*(1/0):i===0?1401298464324817e-60*r*d:r*Math.pow(2,i-150)*(d+8388608)}s.writeFloatLE=h.bind(null,a),s.writeFloatBE=h.bind(null,u),s.readFloatLE=f.bind(null,c),s.readFloatBE=f.bind(null,p)}(),typeof Float64Array<"u"?function(){var h=new Float64Array([-0]),f=new Uint8Array(h.buffer),l=f[7]===128;function o(i,d,g){h[0]=i,d[g]=f[0],d[g+1]=f[1],d[g+2]=f[2],d[g+3]=f[3],d[g+4]=f[4],d[g+5]=f[5],d[g+6]=f[6],d[g+7]=f[7]}function t(i,d,g){h[0]=i,d[g]=f[7],d[g+1]=f[6],d[g+2]=f[5],d[g+3]=f[4],d[g+4]=f[3],d[g+5]=f[2],d[g+6]=f[1],d[g+7]=f[0]}function e(i,d){return f[0]=i[d],f[1]=i[d+1],f[2]=i[d+2],f[3]=i[d+3],f[4]=i[d+4],f[5]=i[d+5],f[6]=i[d+6],f[7]=i[d+7],h[0]}function r(i,d){return f[7]=i[d],f[6]=i[d+1],f[5]=i[d+2],f[4]=i[d+3],f[3]=i[d+4],f[2]=i[d+5],f[1]=i[d+6],f[0]=i[d+7],h[0]}s.writeDoubleLE=l?o:t,s.writeDoubleBE=l?t:o,s.readDoubleLE=l?e:r,s.readDoubleBE=l?r:e}():function(){function h(l,o,t,e,r,i){var d=e<0?1:0;if(d&&(e=-e),e===0)l(0,r,i+o),l(1/e>0?0:2147483648,r,i+t);else if(isNaN(e))l(0,r,i+o),l(2146959360,r,i+t);else if(e>17976931348623157e292)l(0,r,i+o),l((d<<31|2146435072)>>>0,r,i+t);else{var g;if(e<22250738585072014e-324)l((g=e/5e-324)>>>0,r,i+o),l((d<<31|g/4294967296)>>>0,r,i+t);else{var m=Math.floor(Math.log(e)/Math.LN2);m===1024&&(m=1023),l(4503599627370496*(g=e*Math.pow(2,-m))>>>0,r,i+o),l((d<<31|m+1023<<20|1048576*g&1048575)>>>0,r,i+t)}}}function f(l,o,t,e,r){var i=l(e,r+o),d=l(e,r+t),g=2*(d>>31)+1,m=d>>>20&2047,_=4294967296*(1048575&d)+i;return m===2047?_?NaN:g*(1/0):m===0?5e-324*g*_:g*Math.pow(2,m-1075)*(_+4503599627370496)}s.writeDoubleLE=h.bind(null,a,0,4),s.writeDoubleBE=h.bind(null,u,4,0),s.readDoubleLE=f.bind(null,c,0,4),s.readDoubleBE=f.bind(null,p,4,0)}(),s}function a(s,h,f){h[f]=255&s,h[f+1]=s>>>8&255,h[f+2]=s>>>16&255,h[f+3]=s>>>24}function u(s,h,f){h[f]=s>>>24,h[f+1]=s>>>16&255,h[f+2]=s>>>8&255,h[f+3]=255&s}function c(s,h){return(s[h]|s[h+1]<<8|s[h+2]<<16|s[h+3]<<24)>>>0}function p(s,h){return(s[h]<<24|s[h+1]<<16|s[h+2]<<8|s[h+3])>>>0}b.exports=n(n)},7199:module=>{function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(b){}return null}module.exports=inquire},6662:b=>{b.exports=function(n,a,u){var c=u||8192,p=c>>>1,s=null,h=c;return function(f){if(f<1||f>p)return n(f);h+f>c&&(s=n(c),h=0);var l=a.call(s,h,h+=f);return 7&h&&(h=1+(7|h)),l}}},4997:(b,n)=>{var a=n;a.length=function(u){for(var c=0,p=0,s=0;s 191&&s<224?f[l++]=(31&s)<<6|63&u[c++]:s>239&&s<365?(s=((7&s)<<18|(63&u[c++])<<12|(63&u[c++])<<6|63&u[c++])-65536,f[l++]=55296+(s>>10),f[l++]=56320+(1023&s)):f[l++]=(15&s)<<12|(63&u[c++])<<6|63&u[c++],l>8191&&((h||(h=[])).push(String.fromCharCode.apply(String,f)),l=0);return h?(l&&h.push(String.fromCharCode.apply(String,f.slice(0,l))),h.join("")):String.fromCharCode.apply(String,f.slice(0,l))},a.write=function(u,c,p){for(var s,h,f=p,l=0;l >6|192,c[p++]=63&s|128):(64512&s)==55296&&(64512&(h=u.charCodeAt(l+1)))==56320?(s=65536+((1023&s)<<10)+(1023&h),++l,c[p++]=s>>18|240,c[p++]=s>>12&63|128,c[p++]=s>>6&63|128,c[p++]=63&s|128):(c[p++]=s>>12|224,c[p++]=s>>6&63|128,c[p++]=63&s|128);return p-f}},3442:(b,n)=>{n.__esModule=!0;var a=function(){function u(c){if(!c)throw new TypeError("Invalid argument; `value` has no value.");this.value=u.EMPTY,c&&u.isGuid(c)&&(this.value=c)}return u.isGuid=function(c){var p=c.toString();return c&&(c instanceof u||u.validator.test(p))},u.create=function(){return new u([u.gen(2),u.gen(1),u.gen(1),u.gen(1),u.gen(3)].join("-"))},u.createEmpty=function(){return new u("emptyguid")},u.parse=function(c){return new u(c)},u.raw=function(){return[u.gen(2),u.gen(1),u.gen(1),u.gen(1),u.gen(3)].join("-")},u.gen=function(c){for(var p="",s=0;s {b.exports=a;var n=null;try{n=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function a(T,M,N){this.low=0|T,this.high=0|M,this.unsigned=!!N}function u(T){return(T&&T.__isLong__)===!0}a.prototype.__isLong__,Object.defineProperty(a.prototype,"__isLong__",{value:!0}),a.isLong=u;var c={},p={};function s(T,M){var N,B,$;return M?($=0<=(T>>>=0)&&T<256)&&(B=p[T])?B:(N=f(T,(0|T)<0?-1:0,!0),$&&(p[T]=N),N):($=-128<=(T|=0)&&T<128)&&(B=c[T])?B:(N=f(T,T<0?-1:0,!1),$&&(c[T]=N),N)}function h(T,M){if(isNaN(T))return M?m:g;if(M){if(T<0)return m;if(T>=r)return S}else{if(T<=-i)return O;if(T+1>=i)return v}return T<0?h(-T,M).neg():f(T%e|0,T/e|0,M)}function f(T,M,N){return new a(T,M,N)}a.fromInt=s,a.fromNumber=h,a.fromBits=f;var l=Math.pow;function o(T,M,N){if(T.length===0)throw Error("empty string");if(T==="NaN"||T==="Infinity"||T==="+Infinity"||T==="-Infinity")return g;if(typeof M=="number"?(N=M,M=!1):M=!!M,(N=N||10)<2||36 0)throw Error("interior hyphen");if(B===0)return o(T.substring(1),M,N).neg();for(var $=h(l(N,8)),L=g,H=0;H >>0:this.low},A.toNumber=function(){return this.unsigned?(this.high>>>0)*e+(this.low>>>0):this.high*e+(this.low>>>0)},A.toString=function(T){if((T=T||10)<2||36 >>0).toString(T);if((L=C).isZero())return z+H;for(;z.length<6;)z="0"+z;H=""+z+H}},A.getHighBits=function(){return this.high},A.getHighBitsUnsigned=function(){return this.high>>>0},A.getLowBits=function(){return this.low},A.getLowBitsUnsigned=function(){return this.low>>>0},A.getNumBitsAbs=function(){if(this.isNegative())return this.eq(O)?64:this.neg().getNumBitsAbs();for(var T=this.high!=0?this.high:this.low,M=31;M>0&&!(T&1< =0},A.isOdd=function(){return(1&this.low)==1},A.isEven=function(){return(1&this.low)==0},A.equals=function(T){return u(T)||(T=t(T)),(this.unsigned===T.unsigned||this.high>>>31!=1||T.high>>>31!=1)&&this.high===T.high&&this.low===T.low},A.eq=A.equals,A.notEquals=function(T){return!this.eq(T)},A.neq=A.notEquals,A.ne=A.notEquals,A.lessThan=function(T){return this.comp(T)<0},A.lt=A.lessThan,A.lessThanOrEqual=function(T){return this.comp(T)<=0},A.lte=A.lessThanOrEqual,A.le=A.lessThanOrEqual,A.greaterThan=function(T){return this.comp(T)>0},A.gt=A.greaterThan,A.greaterThanOrEqual=function(T){return this.comp(T)>=0},A.gte=A.greaterThanOrEqual,A.ge=A.greaterThanOrEqual,A.compare=function(T){if(u(T)||(T=t(T)),this.eq(T))return 0;var M=this.isNegative(),N=T.isNegative();return M&&!N?-1:!M&&N?1:this.unsigned?T.high>>>0>this.high>>>0||T.high===this.high&&T.low>>>0>this.low>>>0?-1:1:this.sub(T).isNegative()?-1:1},A.comp=A.compare,A.negate=function(){return!this.unsigned&&this.eq(O)?O:this.not().add(_)},A.neg=A.negate,A.add=function(T){u(T)||(T=t(T));var M=this.high>>>16,N=65535&this.high,B=this.low>>>16,$=65535&this.low,L=T.high>>>16,H=65535&T.high,C=T.low>>>16,z=0,J=0,X=0,te=0;return X+=(te+=$+(65535&T.low))>>>16,J+=(X+=B+C)>>>16,z+=(J+=N+H)>>>16,z+=M+L,f((X&=65535)<<16|(te&=65535),(z&=65535)<<16|(J&=65535),this.unsigned)},A.subtract=function(T){return u(T)||(T=t(T)),this.add(T.neg())},A.sub=A.subtract,A.multiply=function(T){if(this.isZero())return g;if(u(T)||(T=t(T)),n)return f(n.mul(this.low,this.high,T.low,T.high),n.get_high(),this.unsigned);if(T.isZero())return g;if(this.eq(O))return T.isOdd()?O:g;if(T.eq(O))return this.isOdd()?O:g;if(this.isNegative())return T.isNegative()?this.neg().mul(T.neg()):this.neg().mul(T).neg();if(T.isNegative())return this.mul(T.neg()).neg();if(this.lt(d)&&T.lt(d))return h(this.toNumber()*T.toNumber(),this.unsigned);var M=this.high>>>16,N=65535&this.high,B=this.low>>>16,$=65535&this.low,L=T.high>>>16,H=65535&T.high,C=T.low>>>16,z=65535&T.low,J=0,X=0,te=0,ne=0;return te+=(ne+=$*z)>>>16,X+=(te+=B*z)>>>16,te&=65535,X+=(te+=$*C)>>>16,J+=(X+=N*z)>>>16,X&=65535,J+=(X+=B*C)>>>16,X&=65535,J+=(X+=$*H)>>>16,J+=M*z+N*C+B*H+$*L,f((te&=65535)<<16|(ne&=65535),(J&=65535)<<16|(X&=65535),this.unsigned)},A.mul=A.multiply,A.divide=function(T){if(u(T)||(T=t(T)),T.isZero())throw Error("division by zero");var M,N,B;if(n)return this.unsigned||this.high!==-2147483648||T.low!==-1||T.high!==-1?f((this.unsigned?n.div_u:n.div_s)(this.low,this.high,T.low,T.high),n.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?m:g;if(this.unsigned){if(T.unsigned||(T=T.toUnsigned()),T.gt(this))return m;if(T.gt(this.shru(1)))return y;B=m}else{if(this.eq(O))return T.eq(_)||T.eq(w)?O:T.eq(O)?_:(M=this.shr(1).div(T).shl(1)).eq(g)?T.isNegative()?_:w:(N=this.sub(T.mul(M)),B=M.add(N.div(T)));if(T.eq(O))return this.unsigned?m:g;if(this.isNegative())return T.isNegative()?this.neg().div(T.neg()):this.neg().div(T).neg();if(T.isNegative())return this.div(T.neg()).neg();B=g}for(N=this;N.gte(T);){M=Math.max(1,Math.floor(N.toNumber()/T.toNumber()));for(var $=Math.ceil(Math.log(M)/Math.LN2),L=$<=48?1:l(2,$-48),H=h(M),C=H.mul(T);C.isNegative()||C.gt(N);)C=(H=h(M-=L,this.unsigned)).mul(T);H.isZero()&&(H=_),B=B.add(H),N=N.sub(C)}return B},A.div=A.divide,A.modulo=function(T){return u(T)||(T=t(T)),n?f((this.unsigned?n.rem_u:n.rem_s)(this.low,this.high,T.low,T.high),n.get_high(),this.unsigned):this.sub(this.div(T).mul(T))},A.mod=A.modulo,A.rem=A.modulo,A.not=function(){return f(~this.low,~this.high,this.unsigned)},A.and=function(T){return u(T)||(T=t(T)),f(this.low&T.low,this.high&T.high,this.unsigned)},A.or=function(T){return u(T)||(T=t(T)),f(this.low|T.low,this.high|T.high,this.unsigned)},A.xor=function(T){return u(T)||(T=t(T)),f(this.low^T.low,this.high^T.high,this.unsigned)},A.shiftLeft=function(T){return u(T)&&(T=T.toInt()),(T&=63)==0?this:T<32?f(this.low< >>32-T,this.unsigned):f(0,this.low< >>T|this.high<<32-T,this.high>>T,this.unsigned):f(this.high>>T-32,this.high>=0?0:-1,this.unsigned)},A.shr=A.shiftRight,A.shiftRightUnsigned=function(T){if(u(T)&&(T=T.toInt()),(T&=63)==0)return this;var M=this.high;return T<32?f(this.low>>>T|M<<32-T,M>>>T,this.unsigned):f(T===32?M:M>>>T-32,0,this.unsigned)},A.shru=A.shiftRightUnsigned,A.shr_u=A.shiftRightUnsigned,A.toSigned=function(){return this.unsigned?f(this.low,this.high,!1):this},A.toUnsigned=function(){return this.unsigned?this:f(this.low,this.high,!0)},A.toBytes=function(T){return T?this.toBytesLE():this.toBytesBE()},A.toBytesLE=function(){var T=this.high,M=this.low;return[255&M,M>>>8&255,M>>>16&255,M>>>24,255&T,T>>>8&255,T>>>16&255,T>>>24]},A.toBytesBE=function(){var T=this.high,M=this.low;return[T>>>24,T>>>16&255,T>>>8&255,255&T,M>>>24,M>>>16&255,M>>>8&255,255&M]},a.fromBytes=function(T,M,N){return N?a.fromBytesLE(T,M):a.fromBytesBE(T,M)},a.fromBytesLE=function(T,M){return new a(T[0]|T[1]<<8|T[2]<<16|T[3]<<24,T[4]|T[5]<<8|T[6]<<16|T[7]<<24,M)},a.fromBytesBE=function(T,M){return new a(T[4]<<24|T[5]<<16|T[6]<<8|T[7],T[0]<<24|T[1]<<16|T[2]<<8|T[3],M)}},1446:(b,n,a)=>{var u,c,p,s=a(2100),h=s.Reader,f=s.Writer,l=s.util,o=s.roots.default||(s.roots.default={});o.onnx=((p={}).Version=(u={},(c=Object.create(u))[u[0]="_START_VERSION"]=0,c[u[1]="IR_VERSION_2017_10_10"]=1,c[u[2]="IR_VERSION_2017_10_30"]=2,c[u[3]="IR_VERSION_2017_11_3"]=3,c[u[4]="IR_VERSION_2019_1_22"]=4,c[u[5]="IR_VERSION"]=5,c),p.AttributeProto=function(){function t(e){if(this.floats=[],this.ints=[],this.strings=[],this.tensors=[],this.graphs=[],e)for(var r=Object.keys(e),i=0;i >>3){case 1:d.name=e.string();break;case 21:d.refAttrName=e.string();break;case 13:d.docString=e.string();break;case 20:d.type=e.int32();break;case 2:d.f=e.float();break;case 3:d.i=e.int64();break;case 4:d.s=e.bytes();break;case 5:d.t=o.onnx.TensorProto.decode(e,e.uint32());break;case 6:d.g=o.onnx.GraphProto.decode(e,e.uint32());break;case 7:if(d.floats&&d.floats.length||(d.floats=[]),(7&g)==2)for(var m=e.uint32()+e.pos;e.pos >>0,e.i.high>>>0).toNumber())),e.s!=null&&(typeof e.s=="string"?l.base64.decode(e.s,r.s=l.newBuffer(l.base64.length(e.s)),0):e.s.length&&(r.s=e.s)),e.t!=null){if(typeof e.t!="object")throw TypeError(".onnx.AttributeProto.t: object expected");r.t=o.onnx.TensorProto.fromObject(e.t)}if(e.g!=null){if(typeof e.g!="object")throw TypeError(".onnx.AttributeProto.g: object expected");r.g=o.onnx.GraphProto.fromObject(e.g)}if(e.floats){if(!Array.isArray(e.floats))throw TypeError(".onnx.AttributeProto.floats: array expected");r.floats=[];for(var i=0;i >>0,e.ints[i].high>>>0).toNumber())}if(e.strings){if(!Array.isArray(e.strings))throw TypeError(".onnx.AttributeProto.strings: array expected");for(r.strings=[],i=0;i >>0,e.i.high>>>0).toNumber():e.i),e.s!=null&&e.hasOwnProperty("s")&&(i.s=r.bytes===String?l.base64.encode(e.s,0,e.s.length):r.bytes===Array?Array.prototype.slice.call(e.s):e.s),e.t!=null&&e.hasOwnProperty("t")&&(i.t=o.onnx.TensorProto.toObject(e.t,r)),e.g!=null&&e.hasOwnProperty("g")&&(i.g=o.onnx.GraphProto.toObject(e.g,r)),e.floats&&e.floats.length){i.floats=[];for(var g=0;g >>0,e.ints[g].high>>>0).toNumber():e.ints[g];if(e.strings&&e.strings.length)for(i.strings=[],g=0;g >>3){case 1:d.name=e.string();break;case 2:d.type=o.onnx.TypeProto.decode(e,e.uint32());break;case 3:d.docString=e.string();break;default:e.skipType(7&g)}}return d},t.decodeDelimited=function(e){return e instanceof h||(e=new h(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.name!=null&&e.hasOwnProperty("name")&&!l.isString(e.name))return"name: string expected";if(e.type!=null&&e.hasOwnProperty("type")){var r=o.onnx.TypeProto.verify(e.type);if(r)return"type."+r}return e.docString!=null&&e.hasOwnProperty("docString")&&!l.isString(e.docString)?"docString: string expected":null},t.fromObject=function(e){if(e instanceof o.onnx.ValueInfoProto)return e;var r=new o.onnx.ValueInfoProto;if(e.name!=null&&(r.name=String(e.name)),e.type!=null){if(typeof e.type!="object")throw TypeError(".onnx.ValueInfoProto.type: object expected");r.type=o.onnx.TypeProto.fromObject(e.type)}return e.docString!=null&&(r.docString=String(e.docString)),r},t.toObject=function(e,r){r||(r={});var i={};return r.defaults&&(i.name="",i.type=null,i.docString=""),e.name!=null&&e.hasOwnProperty("name")&&(i.name=e.name),e.type!=null&&e.hasOwnProperty("type")&&(i.type=o.onnx.TypeProto.toObject(e.type,r)),e.docString!=null&&e.hasOwnProperty("docString")&&(i.docString=e.docString),i},t.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},t}(),p.NodeProto=function(){function t(e){if(this.input=[],this.output=[],this.attribute=[],e)for(var r=Object.keys(e),i=0;i >>3){case 1:d.input&&d.input.length||(d.input=[]),d.input.push(e.string());break;case 2:d.output&&d.output.length||(d.output=[]),d.output.push(e.string());break;case 3:d.name=e.string();break;case 4:d.opType=e.string();break;case 7:d.domain=e.string();break;case 5:d.attribute&&d.attribute.length||(d.attribute=[]),d.attribute.push(o.onnx.AttributeProto.decode(e,e.uint32()));break;case 6:d.docString=e.string();break;default:e.skipType(7&g)}}return d},t.decodeDelimited=function(e){return e instanceof h||(e=new h(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.input!=null&&e.hasOwnProperty("input")){if(!Array.isArray(e.input))return"input: array expected";for(var r=0;r >>3){case 1:d.irVersion=e.int64();break;case 8:d.opsetImport&&d.opsetImport.length||(d.opsetImport=[]),d.opsetImport.push(o.onnx.OperatorSetIdProto.decode(e,e.uint32()));break;case 2:d.producerName=e.string();break;case 3:d.producerVersion=e.string();break;case 4:d.domain=e.string();break;case 5:d.modelVersion=e.int64();break;case 6:d.docString=e.string();break;case 7:d.graph=o.onnx.GraphProto.decode(e,e.uint32());break;case 14:d.metadataProps&&d.metadataProps.length||(d.metadataProps=[]),d.metadataProps.push(o.onnx.StringStringEntryProto.decode(e,e.uint32()));break;default:e.skipType(7&g)}}return d},t.decodeDelimited=function(e){return e instanceof h||(e=new h(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.irVersion!=null&&e.hasOwnProperty("irVersion")&&!(l.isInteger(e.irVersion)||e.irVersion&&l.isInteger(e.irVersion.low)&&l.isInteger(e.irVersion.high)))return"irVersion: integer|Long expected";if(e.opsetImport!=null&&e.hasOwnProperty("opsetImport")){if(!Array.isArray(e.opsetImport))return"opsetImport: array expected";for(var r=0;r >>0,e.irVersion.high>>>0).toNumber())),e.opsetImport){if(!Array.isArray(e.opsetImport))throw TypeError(".onnx.ModelProto.opsetImport: array expected");r.opsetImport=[];for(var i=0;i >>0,e.modelVersion.high>>>0).toNumber())),e.docString!=null&&(r.docString=String(e.docString)),e.graph!=null){if(typeof e.graph!="object")throw TypeError(".onnx.ModelProto.graph: object expected");r.graph=o.onnx.GraphProto.fromObject(e.graph)}if(e.metadataProps){if(!Array.isArray(e.metadataProps))throw TypeError(".onnx.ModelProto.metadataProps: array expected");for(r.metadataProps=[],i=0;i >>0,e.irVersion.high>>>0).toNumber():e.irVersion),e.producerName!=null&&e.hasOwnProperty("producerName")&&(i.producerName=e.producerName),e.producerVersion!=null&&e.hasOwnProperty("producerVersion")&&(i.producerVersion=e.producerVersion),e.domain!=null&&e.hasOwnProperty("domain")&&(i.domain=e.domain),e.modelVersion!=null&&e.hasOwnProperty("modelVersion")&&(typeof e.modelVersion=="number"?i.modelVersion=r.longs===String?String(e.modelVersion):e.modelVersion:i.modelVersion=r.longs===String?l.Long.prototype.toString.call(e.modelVersion):r.longs===Number?new l.LongBits(e.modelVersion.low>>>0,e.modelVersion.high>>>0).toNumber():e.modelVersion),e.docString!=null&&e.hasOwnProperty("docString")&&(i.docString=e.docString),e.graph!=null&&e.hasOwnProperty("graph")&&(i.graph=o.onnx.GraphProto.toObject(e.graph,r)),e.opsetImport&&e.opsetImport.length){i.opsetImport=[];for(var g=0;g >>3){case 1:d.key=e.string();break;case 2:d.value=e.string();break;default:e.skipType(7&g)}}return d},t.decodeDelimited=function(e){return e instanceof h||(e=new h(e)),this.decode(e,e.uint32())},t.verify=function(e){return typeof e!="object"||e===null?"object expected":e.key!=null&&e.hasOwnProperty("key")&&!l.isString(e.key)?"key: string expected":e.value!=null&&e.hasOwnProperty("value")&&!l.isString(e.value)?"value: string expected":null},t.fromObject=function(e){if(e instanceof o.onnx.StringStringEntryProto)return e;var r=new o.onnx.StringStringEntryProto;return e.key!=null&&(r.key=String(e.key)),e.value!=null&&(r.value=String(e.value)),r},t.toObject=function(e,r){r||(r={});var i={};return r.defaults&&(i.key="",i.value=""),e.key!=null&&e.hasOwnProperty("key")&&(i.key=e.key),e.value!=null&&e.hasOwnProperty("value")&&(i.value=e.value),i},t.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},t}(),p.TensorAnnotation=function(){function t(e){if(this.quantParameterTensorNames=[],e)for(var r=Object.keys(e),i=0;i >>3){case 1:d.tensorName=e.string();break;case 2:d.quantParameterTensorNames&&d.quantParameterTensorNames.length||(d.quantParameterTensorNames=[]),d.quantParameterTensorNames.push(o.onnx.StringStringEntryProto.decode(e,e.uint32()));break;default:e.skipType(7&g)}}return d},t.decodeDelimited=function(e){return e instanceof h||(e=new h(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.tensorName!=null&&e.hasOwnProperty("tensorName")&&!l.isString(e.tensorName))return"tensorName: string expected";if(e.quantParameterTensorNames!=null&&e.hasOwnProperty("quantParameterTensorNames")){if(!Array.isArray(e.quantParameterTensorNames))return"quantParameterTensorNames: array expected";for(var r=0;r >>3){case 1:d.node&&d.node.length||(d.node=[]),d.node.push(o.onnx.NodeProto.decode(e,e.uint32()));break;case 2:d.name=e.string();break;case 5:d.initializer&&d.initializer.length||(d.initializer=[]),d.initializer.push(o.onnx.TensorProto.decode(e,e.uint32()));break;case 10:d.docString=e.string();break;case 11:d.input&&d.input.length||(d.input=[]),d.input.push(o.onnx.ValueInfoProto.decode(e,e.uint32()));break;case 12:d.output&&d.output.length||(d.output=[]),d.output.push(o.onnx.ValueInfoProto.decode(e,e.uint32()));break;case 13:d.valueInfo&&d.valueInfo.length||(d.valueInfo=[]),d.valueInfo.push(o.onnx.ValueInfoProto.decode(e,e.uint32()));break;case 14:d.quantizationAnnotation&&d.quantizationAnnotation.length||(d.quantizationAnnotation=[]),d.quantizationAnnotation.push(o.onnx.TensorAnnotation.decode(e,e.uint32()));break;default:e.skipType(7&g)}}return d},t.decodeDelimited=function(e){return e instanceof h||(e=new h(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.node!=null&&e.hasOwnProperty("node")){if(!Array.isArray(e.node))return"node: array expected";for(var r=0;r >>3){case 1:if(d.dims&&d.dims.length||(d.dims=[]),(7&g)==2)for(var m=e.uint32()+e.pos;e.pos >>0,e.dims[i].high>>>0).toNumber())}if(e.dataType!=null&&(r.dataType=0|e.dataType),e.segment!=null){if(typeof e.segment!="object")throw TypeError(".onnx.TensorProto.segment: object expected");r.segment=o.onnx.TensorProto.Segment.fromObject(e.segment)}if(e.floatData){if(!Array.isArray(e.floatData))throw TypeError(".onnx.TensorProto.floatData: array expected");for(r.floatData=[],i=0;i >>0,e.int64Data[i].high>>>0).toNumber())}if(e.name!=null&&(r.name=String(e.name)),e.docString!=null&&(r.docString=String(e.docString)),e.rawData!=null&&(typeof e.rawData=="string"?l.base64.decode(e.rawData,r.rawData=l.newBuffer(l.base64.length(e.rawData)),0):e.rawData.length&&(r.rawData=e.rawData)),e.externalData){if(!Array.isArray(e.externalData))throw TypeError(".onnx.TensorProto.externalData: array expected");for(r.externalData=[],i=0;i >>0,e.uint64Data[i].high>>>0).toNumber(!0))}return r},t.toObject=function(e,r){r||(r={});var i={};if((r.arrays||r.defaults)&&(i.dims=[],i.floatData=[],i.int32Data=[],i.stringData=[],i.int64Data=[],i.doubleData=[],i.uint64Data=[],i.externalData=[]),r.defaults&&(i.dataType=0,i.segment=null,i.name="",r.bytes===String?i.rawData="":(i.rawData=[],r.bytes!==Array&&(i.rawData=l.newBuffer(i.rawData))),i.docString="",i.dataLocation=r.enums===String?"DEFAULT":0),e.dims&&e.dims.length){i.dims=[];for(var d=0;d >>0,e.dims[d].high>>>0).toNumber():e.dims[d]}if(e.dataType!=null&&e.hasOwnProperty("dataType")&&(i.dataType=e.dataType),e.segment!=null&&e.hasOwnProperty("segment")&&(i.segment=o.onnx.TensorProto.Segment.toObject(e.segment,r)),e.floatData&&e.floatData.length)for(i.floatData=[],d=0;d >>0,e.int64Data[d].high>>>0).toNumber():e.int64Data[d];if(e.name!=null&&e.hasOwnProperty("name")&&(i.name=e.name),e.rawData!=null&&e.hasOwnProperty("rawData")&&(i.rawData=r.bytes===String?l.base64.encode(e.rawData,0,e.rawData.length):r.bytes===Array?Array.prototype.slice.call(e.rawData):e.rawData),e.doubleData&&e.doubleData.length)for(i.doubleData=[],d=0;d >>0,e.uint64Data[d].high>>>0).toNumber(!0):e.uint64Data[d];if(e.docString!=null&&e.hasOwnProperty("docString")&&(i.docString=e.docString),e.externalData&&e.externalData.length)for(i.externalData=[],d=0;d >>3){case 1:g.begin=r.int64();break;case 2:g.end=r.int64();break;default:r.skipType(7&m)}}return g},e.decodeDelimited=function(r){return r instanceof h||(r=new h(r)),this.decode(r,r.uint32())},e.verify=function(r){return typeof r!="object"||r===null?"object expected":r.begin!=null&&r.hasOwnProperty("begin")&&!(l.isInteger(r.begin)||r.begin&&l.isInteger(r.begin.low)&&l.isInteger(r.begin.high))?"begin: integer|Long expected":r.end!=null&&r.hasOwnProperty("end")&&!(l.isInteger(r.end)||r.end&&l.isInteger(r.end.low)&&l.isInteger(r.end.high))?"end: integer|Long expected":null},e.fromObject=function(r){if(r instanceof o.onnx.TensorProto.Segment)return r;var i=new o.onnx.TensorProto.Segment;return r.begin!=null&&(l.Long?(i.begin=l.Long.fromValue(r.begin)).unsigned=!1:typeof r.begin=="string"?i.begin=parseInt(r.begin,10):typeof r.begin=="number"?i.begin=r.begin:typeof r.begin=="object"&&(i.begin=new l.LongBits(r.begin.low>>>0,r.begin.high>>>0).toNumber())),r.end!=null&&(l.Long?(i.end=l.Long.fromValue(r.end)).unsigned=!1:typeof r.end=="string"?i.end=parseInt(r.end,10):typeof r.end=="number"?i.end=r.end:typeof r.end=="object"&&(i.end=new l.LongBits(r.end.low>>>0,r.end.high>>>0).toNumber())),i},e.toObject=function(r,i){i||(i={});var d={};if(i.defaults){if(l.Long){var g=new l.Long(0,0,!1);d.begin=i.longs===String?g.toString():i.longs===Number?g.toNumber():g}else d.begin=i.longs===String?"0":0;l.Long?(g=new l.Long(0,0,!1),d.end=i.longs===String?g.toString():i.longs===Number?g.toNumber():g):d.end=i.longs===String?"0":0}return r.begin!=null&&r.hasOwnProperty("begin")&&(typeof r.begin=="number"?d.begin=i.longs===String?String(r.begin):r.begin:d.begin=i.longs===String?l.Long.prototype.toString.call(r.begin):i.longs===Number?new l.LongBits(r.begin.low>>>0,r.begin.high>>>0).toNumber():r.begin),r.end!=null&&r.hasOwnProperty("end")&&(typeof r.end=="number"?d.end=i.longs===String?String(r.end):r.end:d.end=i.longs===String?l.Long.prototype.toString.call(r.end):i.longs===Number?new l.LongBits(r.end.low>>>0,r.end.high>>>0).toNumber():r.end),d},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),t.DataLocation=function(){var e={},r=Object.create(e);return r[e[0]="DEFAULT"]=0,r[e[1]="EXTERNAL"]=1,r}(),t}(),p.TensorShapeProto=function(){function t(e){if(this.dim=[],e)for(var r=Object.keys(e),i=0;i >>3==1?(d.dim&&d.dim.length||(d.dim=[]),d.dim.push(o.onnx.TensorShapeProto.Dimension.decode(e,e.uint32()))):e.skipType(7&g)}return d},t.decodeDelimited=function(e){return e instanceof h||(e=new h(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.dim!=null&&e.hasOwnProperty("dim")){if(!Array.isArray(e.dim))return"dim: array expected";for(var r=0;r >>3){case 1:m.dimValue=i.int64();break;case 2:m.dimParam=i.string();break;case 3:m.denotation=i.string();break;default:i.skipType(7&_)}}return m},e.decodeDelimited=function(i){return i instanceof h||(i=new h(i)),this.decode(i,i.uint32())},e.verify=function(i){if(typeof i!="object"||i===null)return"object expected";var d={};if(i.dimValue!=null&&i.hasOwnProperty("dimValue")&&(d.value=1,!(l.isInteger(i.dimValue)||i.dimValue&&l.isInteger(i.dimValue.low)&&l.isInteger(i.dimValue.high))))return"dimValue: integer|Long expected";if(i.dimParam!=null&&i.hasOwnProperty("dimParam")){if(d.value===1)return"value: multiple values";if(d.value=1,!l.isString(i.dimParam))return"dimParam: string expected"}return i.denotation!=null&&i.hasOwnProperty("denotation")&&!l.isString(i.denotation)?"denotation: string expected":null},e.fromObject=function(i){if(i instanceof o.onnx.TensorShapeProto.Dimension)return i;var d=new o.onnx.TensorShapeProto.Dimension;return i.dimValue!=null&&(l.Long?(d.dimValue=l.Long.fromValue(i.dimValue)).unsigned=!1:typeof i.dimValue=="string"?d.dimValue=parseInt(i.dimValue,10):typeof i.dimValue=="number"?d.dimValue=i.dimValue:typeof i.dimValue=="object"&&(d.dimValue=new l.LongBits(i.dimValue.low>>>0,i.dimValue.high>>>0).toNumber())),i.dimParam!=null&&(d.dimParam=String(i.dimParam)),i.denotation!=null&&(d.denotation=String(i.denotation)),d},e.toObject=function(i,d){d||(d={});var g={};return d.defaults&&(g.denotation=""),i.dimValue!=null&&i.hasOwnProperty("dimValue")&&(typeof i.dimValue=="number"?g.dimValue=d.longs===String?String(i.dimValue):i.dimValue:g.dimValue=d.longs===String?l.Long.prototype.toString.call(i.dimValue):d.longs===Number?new l.LongBits(i.dimValue.low>>>0,i.dimValue.high>>>0).toNumber():i.dimValue,d.oneofs&&(g.value="dimValue")),i.dimParam!=null&&i.hasOwnProperty("dimParam")&&(g.dimParam=i.dimParam,d.oneofs&&(g.value="dimParam")),i.denotation!=null&&i.hasOwnProperty("denotation")&&(g.denotation=i.denotation),g},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),t}(),p.TypeProto=function(){function t(r){if(r)for(var i=Object.keys(r),d=0;d >>3){case 1:g.tensorType=o.onnx.TypeProto.Tensor.decode(r,r.uint32());break;case 6:g.denotation=r.string();break;default:r.skipType(7&m)}}return g},t.decodeDelimited=function(r){return r instanceof h||(r=new h(r)),this.decode(r,r.uint32())},t.verify=function(r){if(typeof r!="object"||r===null)return"object expected";if(r.tensorType!=null&&r.hasOwnProperty("tensorType")){var i=o.onnx.TypeProto.Tensor.verify(r.tensorType);if(i)return"tensorType."+i}return r.denotation!=null&&r.hasOwnProperty("denotation")&&!l.isString(r.denotation)?"denotation: string expected":null},t.fromObject=function(r){if(r instanceof o.onnx.TypeProto)return r;var i=new o.onnx.TypeProto;if(r.tensorType!=null){if(typeof r.tensorType!="object")throw TypeError(".onnx.TypeProto.tensorType: object expected");i.tensorType=o.onnx.TypeProto.Tensor.fromObject(r.tensorType)}return r.denotation!=null&&(i.denotation=String(r.denotation)),i},t.toObject=function(r,i){i||(i={});var d={};return i.defaults&&(d.denotation=""),r.tensorType!=null&&r.hasOwnProperty("tensorType")&&(d.tensorType=o.onnx.TypeProto.Tensor.toObject(r.tensorType,i),i.oneofs&&(d.value="tensorType")),r.denotation!=null&&r.hasOwnProperty("denotation")&&(d.denotation=r.denotation),d},t.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},t.Tensor=function(){function r(i){if(i)for(var d=Object.keys(i),g=0;g >>3){case 1:m.elemType=i.int32();break;case 2:m.shape=o.onnx.TensorShapeProto.decode(i,i.uint32());break;default:i.skipType(7&_)}}return m},r.decodeDelimited=function(i){return i instanceof h||(i=new h(i)),this.decode(i,i.uint32())},r.verify=function(i){if(typeof i!="object"||i===null)return"object expected";if(i.elemType!=null&&i.hasOwnProperty("elemType")&&!l.isInteger(i.elemType))return"elemType: integer expected";if(i.shape!=null&&i.hasOwnProperty("shape")){var d=o.onnx.TensorShapeProto.verify(i.shape);if(d)return"shape."+d}return null},r.fromObject=function(i){if(i instanceof o.onnx.TypeProto.Tensor)return i;var d=new o.onnx.TypeProto.Tensor;if(i.elemType!=null&&(d.elemType=0|i.elemType),i.shape!=null){if(typeof i.shape!="object")throw TypeError(".onnx.TypeProto.Tensor.shape: object expected");d.shape=o.onnx.TensorShapeProto.fromObject(i.shape)}return d},r.toObject=function(i,d){d||(d={});var g={};return d.defaults&&(g.elemType=0,g.shape=null),i.elemType!=null&&i.hasOwnProperty("elemType")&&(g.elemType=i.elemType),i.shape!=null&&i.hasOwnProperty("shape")&&(g.shape=o.onnx.TensorShapeProto.toObject(i.shape,d)),g},r.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},r}(),t}(),p.OperatorSetIdProto=function(){function t(e){if(e)for(var r=Object.keys(e),i=0;i >>3){case 1:d.domain=e.string();break;case 2:d.version=e.int64();break;default:e.skipType(7&g)}}return d},t.decodeDelimited=function(e){return e instanceof h||(e=new h(e)),this.decode(e,e.uint32())},t.verify=function(e){return typeof e!="object"||e===null?"object expected":e.domain!=null&&e.hasOwnProperty("domain")&&!l.isString(e.domain)?"domain: string expected":e.version!=null&&e.hasOwnProperty("version")&&!(l.isInteger(e.version)||e.version&&l.isInteger(e.version.low)&&l.isInteger(e.version.high))?"version: integer|Long expected":null},t.fromObject=function(e){if(e instanceof o.onnx.OperatorSetIdProto)return e;var r=new o.onnx.OperatorSetIdProto;return e.domain!=null&&(r.domain=String(e.domain)),e.version!=null&&(l.Long?(r.version=l.Long.fromValue(e.version)).unsigned=!1:typeof e.version=="string"?r.version=parseInt(e.version,10):typeof e.version=="number"?r.version=e.version:typeof e.version=="object"&&(r.version=new l.LongBits(e.version.low>>>0,e.version.high>>>0).toNumber())),r},t.toObject=function(e,r){r||(r={});var i={};if(r.defaults)if(i.domain="",l.Long){var d=new l.Long(0,0,!1);i.version=r.longs===String?d.toString():r.longs===Number?d.toNumber():d}else i.version=r.longs===String?"0":0;return e.domain!=null&&e.hasOwnProperty("domain")&&(i.domain=e.domain),e.version!=null&&e.hasOwnProperty("version")&&(typeof e.version=="number"?i.version=r.longs===String?String(e.version):e.version:i.version=r.longs===String?l.Long.prototype.toString.call(e.version):r.longs===Number?new l.LongBits(e.version.low>>>0,e.version.high>>>0).toNumber():e.version),i},t.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},t}(),p),b.exports=o},2100:(b,n,a)=>{b.exports=a(9482)},9482:(b,n,a)=>{var u=n;function c(){u.util._configure(),u.Writer._configure(u.BufferWriter),u.Reader._configure(u.BufferReader)}u.build="minimal",u.Writer=a(1173),u.BufferWriter=a(3155),u.Reader=a(1408),u.BufferReader=a(593),u.util=a(9693),u.rpc=a(5994),u.roots=a(5054),u.configure=c,c()},1408:(b,n,a)=>{b.exports=f;var u,c=a(9693),p=c.LongBits,s=c.utf8;function h(d,g){return RangeError("index out of range: "+d.pos+" + "+(g||1)+" > "+d.len)}function f(d){this.buf=d,this.pos=0,this.len=d.length}var l,o=typeof Uint8Array<"u"?function(d){if(d instanceof Uint8Array||Array.isArray(d))return new f(d);throw Error("illegal buffer")}:function(d){if(Array.isArray(d))return new f(d);throw Error("illegal buffer")},t=function(){return c.Buffer?function(d){return(f.create=function(g){return c.Buffer.isBuffer(g)?new u(g):o(g)})(d)}:o};function e(){var d=new p(0,0),g=0;if(!(this.len-this.pos>4)){for(;g<3;++g){if(this.pos>=this.len)throw h(this);if(d.lo=(d.lo|(127&this.buf[this.pos])<<7*g)>>>0,this.buf[this.pos++]<128)return d}return d.lo=(d.lo|(127&this.buf[this.pos++])<<7*g)>>>0,d}for(;g<4;++g)if(d.lo=(d.lo|(127&this.buf[this.pos])<<7*g)>>>0,this.buf[this.pos++]<128)return d;if(d.lo=(d.lo|(127&this.buf[this.pos])<<28)>>>0,d.hi=(d.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return d;if(g=0,this.len-this.pos>4){for(;g<5;++g)if(d.hi=(d.hi|(127&this.buf[this.pos])<<7*g+3)>>>0,this.buf[this.pos++]<128)return d}else for(;g<5;++g){if(this.pos>=this.len)throw h(this);if(d.hi=(d.hi|(127&this.buf[this.pos])<<7*g+3)>>>0,this.buf[this.pos++]<128)return d}throw Error("invalid varint encoding")}function r(d,g){return(d[g-4]|d[g-3]<<8|d[g-2]<<16|d[g-1]<<24)>>>0}function i(){if(this.pos+8>this.len)throw h(this,8);return new p(r(this.buf,this.pos+=4),r(this.buf,this.pos+=4))}f.create=t(),f.prototype._slice=c.Array.prototype.subarray||c.Array.prototype.slice,f.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return l;if((this.pos+=5)>this.len)throw this.pos=this.len,h(this,10);return l}),f.prototype.int32=function(){return 0|this.uint32()},f.prototype.sint32=function(){var d=this.uint32();return d>>>1^-(1&d)|0},f.prototype.bool=function(){return this.uint32()!==0},f.prototype.fixed32=function(){if(this.pos+4>this.len)throw h(this,4);return r(this.buf,this.pos+=4)},f.prototype.sfixed32=function(){if(this.pos+4>this.len)throw h(this,4);return 0|r(this.buf,this.pos+=4)},f.prototype.float=function(){if(this.pos+4>this.len)throw h(this,4);var d=c.float.readFloatLE(this.buf,this.pos);return this.pos+=4,d},f.prototype.double=function(){if(this.pos+8>this.len)throw h(this,4);var d=c.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,d},f.prototype.bytes=function(){var d=this.uint32(),g=this.pos,m=this.pos+d;if(m>this.len)throw h(this,d);return this.pos+=d,Array.isArray(this.buf)?this.buf.slice(g,m):g===m?new this.buf.constructor(0):this._slice.call(this.buf,g,m)},f.prototype.string=function(){var d=this.bytes();return s.read(d,0,d.length)},f.prototype.skip=function(d){if(typeof d=="number"){if(this.pos+d>this.len)throw h(this,d);this.pos+=d}else do if(this.pos>=this.len)throw h(this);while(128&this.buf[this.pos++]);return this},f.prototype.skipType=function(d){switch(d){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(d=7&this.uint32())!=4;)this.skipType(d);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+d+" at offset "+this.pos)}return this},f._configure=function(d){u=d,f.create=t(),u._configure();var g=c.Long?"toLong":"toNumber";c.merge(f.prototype,{int64:function(){return e.call(this)[g](!1)},uint64:function(){return e.call(this)[g](!0)},sint64:function(){return e.call(this).zzDecode()[g](!1)},fixed64:function(){return i.call(this)[g](!0)},sfixed64:function(){return i.call(this)[g](!1)}})}},593:(b,n,a)=>{b.exports=p;var u=a(1408);(p.prototype=Object.create(u.prototype)).constructor=p;var c=a(9693);function p(s){u.call(this,s)}p._configure=function(){c.Buffer&&(p.prototype._slice=c.Buffer.prototype.slice)},p.prototype.string=function(){var s=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+s,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+s,this.len))},p._configure()},5054:b=>{b.exports={}},5994:(b,n,a)=>{n.Service=a(7948)},7948:(b,n,a)=>{b.exports=c;var u=a(9693);function c(p,s,h){if(typeof p!="function")throw TypeError("rpcImpl must be a function");u.EventEmitter.call(this),this.rpcImpl=p,this.requestDelimited=!!s,this.responseDelimited=!!h}(c.prototype=Object.create(u.EventEmitter.prototype)).constructor=c,c.prototype.rpcCall=function p(s,h,f,l,o){if(!l)throw TypeError("request must be specified");var t=this;if(!o)return u.asPromise(p,t,s,h,f,l);if(t.rpcImpl)try{return t.rpcImpl(s,h[t.requestDelimited?"encodeDelimited":"encode"](l).finish(),function(e,r){if(e)return t.emit("error",e,s),o(e);if(r!==null){if(!(r instanceof f))try{r=f[t.responseDelimited?"decodeDelimited":"decode"](r)}catch(i){return t.emit("error",i,s),o(i)}return t.emit("data",r,s),o(null,r)}t.end(!0)})}catch(e){return t.emit("error",e,s),void setTimeout(function(){o(e)},0)}else setTimeout(function(){o(Error("already ended"))},0)},c.prototype.end=function(p){return this.rpcImpl&&(p||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},1945:(b,n,a)=>{b.exports=c;var u=a(9693);function c(f,l){this.lo=f>>>0,this.hi=l>>>0}var p=c.zero=new c(0,0);p.toNumber=function(){return 0},p.zzEncode=p.zzDecode=function(){return this},p.length=function(){return 1};var s=c.zeroHash="\0\0\0\0\0\0\0\0";c.fromNumber=function(f){if(f===0)return p;var l=f<0;l&&(f=-f);var o=f>>>0,t=(f-o)/4294967296>>>0;return l&&(t=~t>>>0,o=~o>>>0,++o>4294967295&&(o=0,++t>4294967295&&(t=0))),new c(o,t)},c.from=function(f){if(typeof f=="number")return c.fromNumber(f);if(u.isString(f)){if(!u.Long)return c.fromNumber(parseInt(f,10));f=u.Long.fromString(f)}return f.low||f.high?new c(f.low>>>0,f.high>>>0):p},c.prototype.toNumber=function(f){if(!f&&this.hi>>>31){var l=1+~this.lo>>>0,o=~this.hi>>>0;return l||(o=o+1>>>0),-(l+4294967296*o)}return this.lo+4294967296*this.hi},c.prototype.toLong=function(f){return u.Long?new u.Long(0|this.lo,0|this.hi,!!f):{low:0|this.lo,high:0|this.hi,unsigned:!!f}};var h=String.prototype.charCodeAt;c.fromHash=function(f){return f===s?p:new c((h.call(f,0)|h.call(f,1)<<8|h.call(f,2)<<16|h.call(f,3)<<24)>>>0,(h.call(f,4)|h.call(f,5)<<8|h.call(f,6)<<16|h.call(f,7)<<24)>>>0)},c.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},c.prototype.zzEncode=function(){var f=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^f)>>>0,this.lo=(this.lo<<1^f)>>>0,this},c.prototype.zzDecode=function(){var f=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^f)>>>0,this.hi=(this.hi>>>1^f)>>>0,this},c.prototype.length=function(){var f=this.lo,l=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return o===0?l===0?f<16384?f<128?1:2:f<2097152?3:4:l<16384?l<128?5:6:l<2097152?7:8:o<128?9:10}},9693:function(b,n,a){var u=n;function c(s,h,f){for(var l=Object.keys(h),o=0;o 0)},u.Buffer=function(){try{var s=u.inquire("buffer").Buffer;return s.prototype.utf8Write?s:null}catch{return null}}(),u._Buffer_from=null,u._Buffer_allocUnsafe=null,u.newBuffer=function(s){return typeof s=="number"?u.Buffer?u._Buffer_allocUnsafe(s):new u.Array(s):u.Buffer?u._Buffer_from(s):typeof Uint8Array>"u"?s:new Uint8Array(s)},u.Array=typeof Uint8Array<"u"?Uint8Array:Array,u.Long=u.global.dcodeIO&&u.global.dcodeIO.Long||u.global.Long||u.inquire("long"),u.key2Re=/^true|false|0|1$/,u.key32Re=/^-?(?:0|[1-9][0-9]*)$/,u.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,u.longToHash=function(s){return s?u.LongBits.from(s).toHash():u.LongBits.zeroHash},u.longFromHash=function(s,h){var f=u.LongBits.fromHash(s);return u.Long?u.Long.fromBits(f.lo,f.hi,h):f.toNumber(!!h)},u.merge=c,u.lcFirst=function(s){return s.charAt(0).toLowerCase()+s.substring(1)},u.newError=p,u.ProtocolError=p("ProtocolError"),u.oneOfGetter=function(s){for(var h={},f=0;f -1;--o)if(h[l[o]]===1&&this[l[o]]!==void 0&&this[l[o]]!==null)return l[o]}},u.oneOfSetter=function(s){return function(h){for(var f=0;f {b.exports=t;var u,c=a(9693),p=c.LongBits,s=c.base64,h=c.utf8;function f(_,y,w){this.fn=_,this.len=y,this.next=void 0,this.val=w}function l(){}function o(_){this.head=_.head,this.tail=_.tail,this.len=_.len,this.next=_.states}function t(){this.len=0,this.head=new f(l,0,0),this.tail=this.head,this.states=null}var e=function(){return c.Buffer?function(){return(t.create=function(){return new u})()}:function(){return new t}};function r(_,y,w){y[w]=255&_}function i(_,y){this.len=_,this.next=void 0,this.val=y}function d(_,y,w){for(;_.hi;)y[w++]=127&_.lo|128,_.lo=(_.lo>>>7|_.hi<<25)>>>0,_.hi>>>=7;for(;_.lo>127;)y[w++]=127&_.lo|128,_.lo=_.lo>>>7;y[w++]=_.lo}function g(_,y,w){y[w]=255&_,y[w+1]=_>>>8&255,y[w+2]=_>>>16&255,y[w+3]=_>>>24}t.create=e(),t.alloc=function(_){return new c.Array(_)},c.Array!==Array&&(t.alloc=c.pool(t.alloc,c.Array.prototype.subarray)),t.prototype._push=function(_,y,w){return this.tail=this.tail.next=new f(_,y,w),this.len+=y,this},i.prototype=Object.create(f.prototype),i.prototype.fn=function(_,y,w){for(;_>127;)y[w++]=127&_|128,_>>>=7;y[w]=_},t.prototype.uint32=function(_){return this.len+=(this.tail=this.tail.next=new i((_>>>=0)<128?1:_<16384?2:_<2097152?3:_<268435456?4:5,_)).len,this},t.prototype.int32=function(_){return _<0?this._push(d,10,p.fromNumber(_)):this.uint32(_)},t.prototype.sint32=function(_){return this.uint32((_<<1^_>>31)>>>0)},t.prototype.uint64=function(_){var y=p.from(_);return this._push(d,y.length(),y)},t.prototype.int64=t.prototype.uint64,t.prototype.sint64=function(_){var y=p.from(_).zzEncode();return this._push(d,y.length(),y)},t.prototype.bool=function(_){return this._push(r,1,_?1:0)},t.prototype.fixed32=function(_){return this._push(g,4,_>>>0)},t.prototype.sfixed32=t.prototype.fixed32,t.prototype.fixed64=function(_){var y=p.from(_);return this._push(g,4,y.lo)._push(g,4,y.hi)},t.prototype.sfixed64=t.prototype.fixed64,t.prototype.float=function(_){return this._push(c.float.writeFloatLE,4,_)},t.prototype.double=function(_){return this._push(c.float.writeDoubleLE,8,_)};var m=c.Array.prototype.set?function(_,y,w){y.set(_,w)}:function(_,y,w){for(var v=0;v<_.length;++v)y[w+v]=_[v]};t.prototype.bytes=function(_){var y=_.length>>>0;if(!y)return this._push(r,1,0);if(c.isString(_)){var w=t.alloc(y=s.length(_));s.decode(_,w,0),_=w}return this.uint32(y)._push(m,y,_)},t.prototype.string=function(_){var y=h.length(_);return y?this.uint32(y)._push(h.write,y,_):this._push(r,1,0)},t.prototype.fork=function(){return this.states=new o(this),this.head=this.tail=new f(l,0,0),this.len=0,this},t.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new f(l,0,0),this.len=0),this},t.prototype.ldelim=function(){var _=this.head,y=this.tail,w=this.len;return this.reset().uint32(w),w&&(this.tail.next=_.next,this.tail=y,this.len+=w),this},t.prototype.finish=function(){for(var _=this.head.next,y=this.constructor.alloc(this.len),w=0;_;)_.fn(_.val,y,w),w+=_.len,_=_.next;return y},t._configure=function(_){u=_,t.create=e(),u._configure()}},3155:(b,n,a)=>{b.exports=p;var u=a(1173);(p.prototype=Object.create(u.prototype)).constructor=p;var c=a(9693);function p(){u.call(this)}function s(h,f,l){h.length<40?c.utf8.write(h,f,l):f.utf8Write?f.utf8Write(h,l):f.write(h,l)}p._configure=function(){p.alloc=c._Buffer_allocUnsafe,p.writeBytesBuffer=c.Buffer&&c.Buffer.prototype instanceof Uint8Array&&c.Buffer.prototype.set.name==="set"?function(h,f,l){f.set(h,l)}:function(h,f,l){if(h.copy)h.copy(f,l,0,h.length);else for(var o=0;o >>0;return this.uint32(f),f&&this._push(p.writeBytesBuffer,f,h),this},p.prototype.string=function(h){var f=c.Buffer.byteLength(h);return this.uint32(f),f&&this._push(s,f,h),this},p._configure()},7714:(b,n,a)=>{n.R=void 0;const u=a(6919),c=a(7448);n.R=new class{async init(){}async createSessionHandler(p,s){const h=new u.Session(s);return await h.loadModel(p),new c.OnnxjsSessionHandler(h)}}},4200:(b,n,a)=>{n.c8=n.rX=void 0;const u=a(1670),c=a(5381),p=a(2157),s=a(2306);n.rX=()=>{if((typeof u.env.wasm.initTimeout!="number"||u.env.wasm.initTimeout<0)&&(u.env.wasm.initTimeout=0),typeof u.env.wasm.simd!="boolean"&&(u.env.wasm.simd=!0),typeof u.env.wasm.proxy!="boolean"&&(u.env.wasm.proxy=!1),typeof u.env.wasm.numThreads!="number"||!Number.isInteger(u.env.wasm.numThreads)||u.env.wasm.numThreads<=0){const h=typeof navigator>"u"?(0,c.cpus)().length:navigator.hardwareConcurrency;u.env.wasm.numThreads=Math.min(4,Math.ceil((h||1)/2))}},n.c8=new class{async init(){(0,n.rX)(),await(0,p.initWasm)()}async createSessionHandler(h,f){const l=new s.OnnxruntimeWebAssemblySessionHandler;return await l.loadModel(h,f),Promise.resolve(l)}}},6018:function(b,n,a){var u=this&&this.__createBinding||(Object.create?function(s,h,f,l){l===void 0&&(l=f);var o=Object.getOwnPropertyDescriptor(h,f);o&&!("get"in o?!h.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return h[f]}}),Object.defineProperty(s,l,o)}:function(s,h,f,l){l===void 0&&(l=f),s[l]=h[f]}),c=this&&this.__exportStar||function(s,h){for(var f in s)f==="default"||Object.prototype.hasOwnProperty.call(h,f)||u(h,s,f)};Object.defineProperty(n,"__esModule",{value:!0}),c(a(1670),n);const p=a(1670);{const s=a(7714).R;(0,p.registerBackend)("webgl",s,-10)}{const s=a(4200).c8;(0,p.registerBackend)("cpu",s,10),(0,p.registerBackend)("wasm",s,10),(0,p.registerBackend)("xnnpack",s,9)}},246:(b,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createAttributeWithCacheKey=void 0;class a{constructor(c){Object.assign(this,c)}get cacheKey(){return this._cacheKey||(this._cacheKey=Object.getOwnPropertyNames(this).sort().map(c=>`${this[c]}`).join(";")),this._cacheKey}}n.createAttributeWithCacheKey=u=>new a(u)},7778:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Attribute=void 0;const u=a(1446),c=a(9395),p=a(9162),s=a(2517);var h=c.onnxruntime.experimental.fbs;class f{constructor(o){if(this._attributes=new Map,o!=null){for(const t of o)t instanceof u.onnx.AttributeProto?this._attributes.set(t.name,[f.getValue(t),f.getType(t)]):t instanceof h.Attribute&&this._attributes.set(t.name(),[f.getValue(t),f.getType(t)]);if(this._attributes.size p.Tensor.fromProto(r));if(o instanceof h.Attribute)return e.map(r=>p.Tensor.fromOrtTensor(r))}if(t===u.onnx.AttributeProto.AttributeType.STRING&&o instanceof u.onnx.AttributeProto){const r=e;return(0,s.decodeUtf8String)(r)}return t===u.onnx.AttributeProto.AttributeType.STRINGS&&o instanceof u.onnx.AttributeProto?e.map(s.decodeUtf8String):e}static getValueNoCheck(o){return o instanceof u.onnx.AttributeProto?this.getValueNoCheckFromOnnxFormat(o):this.getValueNoCheckFromOrtFormat(o)}static getValueNoCheckFromOnnxFormat(o){switch(o.type){case u.onnx.AttributeProto.AttributeType.FLOAT:return o.f;case u.onnx.AttributeProto.AttributeType.INT:return o.i;case u.onnx.AttributeProto.AttributeType.STRING:return o.s;case u.onnx.AttributeProto.AttributeType.TENSOR:return o.t;case u.onnx.AttributeProto.AttributeType.GRAPH:return o.g;case u.onnx.AttributeProto.AttributeType.FLOATS:return o.floats;case u.onnx.AttributeProto.AttributeType.INTS:return o.ints;case u.onnx.AttributeProto.AttributeType.STRINGS:return o.strings;case u.onnx.AttributeProto.AttributeType.TENSORS:return o.tensors;case u.onnx.AttributeProto.AttributeType.GRAPHS:return o.graphs;default:throw new Error(`unsupported attribute type: ${u.onnx.AttributeProto.AttributeType[o.type]}`)}}static getValueNoCheckFromOrtFormat(o){switch(o.type()){case h.AttributeType.FLOAT:return o.f();case h.AttributeType.INT:return o.i();case h.AttributeType.STRING:return o.s();case h.AttributeType.TENSOR:return o.t();case h.AttributeType.GRAPH:return o.g();case h.AttributeType.FLOATS:return o.floatsArray();case h.AttributeType.INTS:{const t=[];for(let e=0;e {Object.defineProperty(n,"__esModule",{value:!0}),n.resolveBackend=n.backend=void 0;const u=a(5038),c=new Map;async function p(s){const h=n.backend;if(h[s]!==void 0&&function(f){const l=f;return"initialize"in l&&typeof l.initialize=="function"&&"createSessionHandler"in l&&typeof l.createSessionHandler=="function"&&"dispose"in l&&typeof l.dispose=="function"}(h[s])){const f=h[s];let l=f.initialize();if(typeof l=="object"&&"then"in l&&(l=await l),l)return c.set(s,f),f}}n.backend={webgl:new u.WebGLBackend},n.resolveBackend=async function s(h){if(!h)return s(["webgl"]);{const f=typeof h=="string"?[h]:h;for(const l of f){const o=c.get(l);if(o)return o;const t=await p(l);if(t)return t}}throw new Error("no available backend to use")}},5038:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WebGLBackend=void 0;const u=a(1670),c=a(6231),p=a(6416),s=a(7305);n.WebGLBackend=class{get contextId(){return u.env.webgl.contextId}set contextId(h){u.env.webgl.contextId=h}get matmulMaxBatchSize(){return u.env.webgl.matmulMaxBatchSize}set matmulMaxBatchSize(h){u.env.webgl.matmulMaxBatchSize=h}get textureCacheMode(){return u.env.webgl.textureCacheMode}set textureCacheMode(h){u.env.webgl.textureCacheMode=h}get pack(){return u.env.webgl.pack}set pack(h){u.env.webgl.pack=h}get async(){return u.env.webgl.async}set async(h){u.env.webgl.async=h}initialize(){try{return this.glContext=(0,s.createWebGLContext)(this.contextId),typeof this.matmulMaxBatchSize!="number"&&(this.matmulMaxBatchSize=16),typeof this.textureCacheMode!="string"&&(this.textureCacheMode="full"),typeof this.pack!="boolean"&&(this.pack=!1),typeof this.async!="boolean"&&(this.async=!1),c.Logger.setWithEnv(u.env),c.Logger.verbose("WebGLBackend",`Created WebGLContext: ${typeof this.glContext} with matmulMaxBatchSize: ${this.matmulMaxBatchSize}; textureCacheMode: ${this.textureCacheMode}; pack: ${this.pack}; async: ${this.async}.`),!0}catch(h){return c.Logger.warning("WebGLBackend",`Unable to initialize WebGLBackend. ${h}`),!1}}createSessionHandler(h){return new p.WebGLSessionHandler(this,h)}dispose(){this.glContext.dispose()}}},5107:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CoordsGlslLib=void 0;const u=a(2517),c=a(8520),p=a(5060),s=a(7859),h=a(9390);class f extends c.GlslLib{constructor(o){super(o)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.offsetToCoords()),this.coordsToOffset()),this.toVec()),this.valueFrom()),this.getCommonUtilFuncs()),this.getInputsSamplingSnippets()),this.getOutputSamplingSnippet())}getCustomTypes(){return{}}offsetToCoords(){return{offsetToCoords:new c.GlslLibRoutine(` - vec2 offsetToCoords(int offset, int width, int height) { - int t = offset / width; - int s = offset - t*width; - vec2 coords = (vec2(s,t) + vec2(0.5,0.5)) / vec2(width, height); - return coords; - } - `)}}coordsToOffset(){return{coordsToOffset:new c.GlslLibRoutine(` - int coordsToOffset(vec2 coords, int width, int height) { - float s = coords.s * float(width); - float t = coords.t * float(height); - int offset = int(t) * width + int(s); - return offset; - } - `)}}getOutputSamplingSnippet(){const o=this.context.outputTextureLayout;return o.isPacked?this.getPackedOutputSamplingSnippet(o):this.getUnpackedOutputSamplingSnippet(o)}getPackedOutputSamplingSnippet(o){const t=o.unpackedShape,e=[o.width,o.height],r={},i="getOutputCoords";switch(t.length){case 0:r[i]=this.getOutputScalarCoords();break;case 1:r[i]=this.getOutputPacked1DCoords(t,e);break;case 2:r[i]=this.getOutputPacked2DCoords(t,e);break;case 3:r[i]=this.getOutputPacked3DCoords(t,e);break;default:r[i]=this.getOutputPackedNDCoords(t,e)}const d=` - void setOutput(vec4 val) { - ${(0,p.getGlsl)(this.context.glContext.version).output} = val; - } - `;return r.floatTextureSetRGBA=new c.GlslLibRoutine(d),r}getUnpackedOutputSamplingSnippet(o){const t=o.unpackedShape,e=[o.width,o.height],r={},i="getOutputCoords";switch(t.length){case 0:r[i]=this.getOutputScalarCoords();break;case 1:r[i]=this.getOutputUnpacked1DCoords(t,e);break;case 2:r[i]=this.getOutputUnpacked2DCoords(t,e);break;case 3:r[i]=this.getOutputUnpacked3DCoords(t,e);break;case 4:r[i]=this.getOutputUnpacked4DCoords(t,e);break;case 5:r[i]=this.getOutputUnpacked5DCoords(t,e);break;case 6:r[i]=this.getOutputUnpacked6DCoords(t,e);break;default:throw new Error(`Unsupported output dimensionality: ${t.length}`)}const d=` - void setOutput(float val) { - ${(0,p.getGlsl)(this.context.glContext.version).output} = vec4(val, 0, 0, 0); - } - `;return r.floatTextureSetR=new c.GlslLibRoutine(d),r}getOutputScalarCoords(){return new c.GlslLibRoutine(` - int getOutputCoords() { - return 0; - } - `)}getOutputPacked1DCoords(o,t){const e=t;let r="";return e[0]===1?(r=` - int getOutputCoords() { - return 2 * int(TexCoords.y * ${e[1]}.0); - } - `,new c.GlslLibRoutine(r)):e[1]===1?(r=` - int getOutputCoords() { - return 2 * int(TexCoords.x * ${e[0]}.0); - } - `,new c.GlslLibRoutine(r)):(r=` - int getOutputCoords() { - ivec2 resTexRC = ivec2(TexCoords.xy * - vec2(${e[0]}, ${e[1]})); - return 2 * (resTexRC.y * ${e[0]} + resTexRC.x); - } - `,new c.GlslLibRoutine(r))}getOutputPacked2DCoords(o,t){let e="";if(u.ArrayUtil.arraysEqual(o,t))return e=` - ivec2 getOutputCoords() { - return 2 * ivec2(TexCoords.xy * vec2(${t[0]}, ${t[1]})); - } - `,new c.GlslLibRoutine(e);const r=t,i=Math.ceil(o[1]/2);return e=` - ivec2 getOutputCoords() { - ivec2 resTexRC = ivec2(TexCoords.xy * - vec2(${r[0]}, ${r[1]})); - - int index = resTexRC.y * ${r[0]} + resTexRC.x; - - // reverse r and c order for packed texture - int r = imod(index, ${i}) * 2; - int c = 2 * (index / ${i}); - - return ivec2(r, c); - } - `,new c.GlslLibRoutine(e)}getOutputPacked3DCoords(o,t){const e=[t[0],t[1]],r=Math.ceil(o[2]/2),i=r*Math.ceil(o[1]/2),d=` - ivec3 getOutputCoords() { - ivec2 resTexRC = ivec2(TexCoords.xy * - vec2(${e[0]}, ${e[1]})); - int index = resTexRC.y * ${e[0]} + resTexRC.x; - - int b = index / ${i}; - index -= b * ${i}; - - // reverse r and c order for packed texture - int r = imod(index, ${r}) * 2; - int c = 2 * (index / ${r}); - - return ivec3(b, r, c); - } - `;return new c.GlslLibRoutine(d)}getOutputPackedNDCoords(o,t){const e=[t[0],t[1]],r=Math.ceil(o[o.length-1]/2),i=r*Math.ceil(o[o.length-2]/2);let d=i,g="",m="b, r, c";for(let y=2;y =0;--m)i[m]=i[m+1]*o[m+1];const d=["r","c","d"],g=i.map((m,_)=>`int ${d[_]} = index / ${m}; ${_===i.length-1?`int ${d[_+1]} = index - ${d[_]} * ${m}`:`index -= ${d[_]} * ${m}`};`).join("");return e=` - ivec3 getOutputCoords() { - ivec2 resTexRC = ivec2(TexCoords.xy * - vec2(${t[0]}, ${t[1]})); - int index = resTexRC.y * ${t[0]} + resTexRC.x; - ${g} - return ivec3(r, c, d); - } - `,new c.GlslLibRoutine(e)}getOutputUnpacked4DCoords(o,t){let e="";const r=o.length;let i=null;r<2&&(i=[]),i=new Array(r-1),i[r-2]=o[r-1];for(let m=r-3;m>=0;--m)i[m]=i[m+1]*o[m+1];const d=["r","c","d","d2"],g=i.map((m,_)=>`int ${d[_]} = index / ${m}; ${_===i.length-1?`int ${d[_+1]} = index - ${d[_]} * ${m}`:`index -= ${d[_]} * ${m}`};`).join("");return e=` - ivec4 getOutputCoords() { - ivec2 resTexRC = ivec2(TexCoords.xy * - vec2(${t[0]}, ${t[1]})); - int index = resTexRC.y * ${t[0]} + resTexRC.x; - ${g} - return ivec4(r, c, d, d2); - } - `,new c.GlslLibRoutine(e)}getOutputUnpacked5DCoords(o,t){let e="";const r=o.length;let i=null;r<2&&(i=[]),i=new Array(r-1),i[r-2]=o[r-1];for(let m=r-3;m>=0;--m)i[m]=i[m+1]*o[m+1];const d=["r","c","d","d2","d3"],g=i.map((m,_)=>`int ${d[_]} = index / ${m}; ${_===i.length-1?`int ${d[_+1]} = index - ${d[_]} * ${m}`:`index -= ${d[_]} * ${m}`};`).join("");return e=` - ivec5 getOutputCoords() { - ivec2 resTexRC = ivec2(TexCoords.xy * - vec2(${t[0]}, ${t[1]})); - int index = resTexRC.y * ${t[0]} + resTexRC.x; - ${g} - return ivec5(r, c, d, d2, d3); - } - `,new c.GlslLibRoutine(e)}getOutputUnpacked6DCoords(o,t){let e="";const r=o.length;let i=null;r<2&&(i=[]),i=new Array(r-1),i[r-2]=o[r-1];for(let m=r-3;m>=0;--m)i[m]=i[m+1]*o[m+1];const d=["r","c","d","d2","d3","d4"],g=i.map((m,_)=>`int ${d[_]} = index / ${m}; ${_===i.length-1?`int ${d[_+1]} = index - ${d[_]} * ${m}`:`index -= ${d[_]} * ${m}`};`).join("");return e=` - ivec6 getOutputCoords() { - ivec2 resTexRC = ivec2(TexCoords.xy * - vec2(${t[0]}, ${t[1]})); - int index = resTexRC.y * ${t[0]} + resTexRC.x; - ${g} - return ivec6(r, c, d, d2, d3, d4); - } - `,new c.GlslLibRoutine(e)}getCommonUtilFuncs(){const o={};let t="uvFromFlat";o[t]=new c.GlslLibRoutine(` - vec2 uvFromFlat(int texNumR, int texNumC, int index) { - int texC = index / texNumR; - int texR = index - texC * texNumR; - // TODO: swap texR, texC order in following function so row is corresponding to u and column is corresponding to - // v. - return (vec2(texR, texC) + halfCR) / vec2(texNumR, texNumC); - } - `),t="packedUVfrom1D",o[t]=new c.GlslLibRoutine(` - vec2 packedUVfrom1D(int texNumR, int texNumC, int index) { - int texelIndex = index / 2; - int texR = texelIndex / texNumC; - int texC = texelIndex - texR * texNumC; - return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); - } - `),t="packedUVfrom2D",o[t]=new c.GlslLibRoutine(` - vec2 packedUVfrom2D(int texNumR, int texNumC, int texelsInLogicalRow, int row, int col) { - int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2); - int texR = texelIndex / texNumC; - int texC = texelIndex - texR * texNumC; - return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); - } - `),t="packedUVfrom3D",o[t]=new c.GlslLibRoutine(` - vec2 packedUVfrom3D(int texNumR, int texNumC, - int texelsInBatch, int texelsInLogicalRow, int b, - int row, int col) { - int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2); - int texR = index / texNumC; - int texC = index - texR * texNumC; - return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); - } - `),t="sampleTexture";const e=(0,p.getGlsl)(this.context.glContext.version);return o[t]=new c.GlslLibRoutine(` - float sampleTexture(sampler2D textureSampler, vec2 uv) { - return ${e.texture2D}(textureSampler, uv).r; - }`),o}getInputsSamplingSnippets(){const o={},t=this.context.outputTextureLayout;return this.context.programInfo.inputNames.forEach((e,r)=>{const i=this.context.inputTextureLayouts[r],d=(0,h.generateShaderFuncNameFromInputSamplerName)(e);i.isPacked?o[d]=this.getPackedSamplerFromInput(d,e,i):o[d]=this.getUnpackedSamplerFromInput(d,e,i);const g=(0,h.generateShaderFuncNameFromInputSamplerNameAtOutCoords)(e);i.unpackedShape.length<=t.unpackedShape.length&&(i.isPacked?o[g]=this.getPackedSamplerAtOutputCoords(g,i,t,e):o[g]=this.getUnpackedSamplerAtOutputCoords(g,i,t,e))}),o}getPackedSamplerAtOutputCoords(o,t,e,r){const i=t.unpackedShape,d=e.unpackedShape,g=r,m=(0,h.generateShaderFuncNameFromInputSamplerName)(g),_=i.length,y=d.length,w=u.BroadcastUtil.getBroadcastDims(i,d),v=(0,h.getCoordsDataType)(y),S=y-_;let O;const A=(0,h.getGlChannels)();O=_===0?"":y<2&&w.length>=1?"coords = 0;":w.map(L=>`coords.${A[L+S]} = 0;`).join(` -`);let T="";T=y<2&&_>0?"coords":i.map((L,H)=>`coords.${A[H+S]}`).join(", ");let M="return outputValue;";const N=u.ShapeUtil.size(i)===1,B=u.ShapeUtil.size(d)===1;if(_!==1||N||B){if(N&&!B)M=y===1?` - return vec4(outputValue.x, outputValue.x, 0., 0.); - `:` - return vec4(outputValue.x); - `;else if(w.length){const L=_-2,H=_-1;w.indexOf(L)>-1&&w.indexOf(H)>-1?M="return vec4(outputValue.x);":w.indexOf(L)>-1?M="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":w.indexOf(H)>-1&&(M="return vec4(outputValue.xx, outputValue.zz);")}}else M=` - return vec4(outputValue.xy, outputValue.xy); - `;const $=` - vec4 ${o}() { - ${v} coords = getOutputCoords(); - - int lastDim = coords.${A[y-1]}; - coords.${A[y-1]} = coords.${A[y-2]}; - coords.${A[y-2]} = lastDim; - - ${O} - vec4 outputValue = ${m}(${T}); - ${M} - } - `;return new c.GlslLibRoutine($,["coordinates.getOutputCoords"])}getUnpackedSamplerAtOutputCoords(o,t,e,r){const i=[e.width,e.height],d=[t.width,t.height],g=t.unpackedShape.length,m=e.unpackedShape.length,_=t.unpackedShape,y=e.unpackedShape,w=(0,h.generateShaderFuncNameFromInputSamplerName)(r);if(g===m&&u.ArrayUtil.arraysEqual(d,i)){const B=` - float ${o}() { - return sampleTexture(${r}, TexCoords); - } - `;return new c.GlslLibRoutine(B,["coordinates.sampleTexture"])}const v=(0,h.getCoordsDataType)(m),S=u.BroadcastUtil.getBroadcastDims(_,y),O=m-g;let A;const T=(0,h.getGlChannels)();A=g===0?"":m<2&&S.length>=1?"coords = 0;":S.map(B=>`coords.${T[B+O]} = 0;`).join(` -`);let M="";M=m<2&&g>0?"coords":t.unpackedShape.map((B,$)=>`coords.${T[$+O]}`).join(", ");const N=` - float ${o}() { - ${v} coords = getOutputCoords(); - ${A} - return ${w}(${M}); - } - `;return new c.GlslLibRoutine(N,["coordinates.getOutputCoords"])}getPackedSamplerFromInput(o,t,e){switch(e.unpackedShape.length){case 0:return this.getPackedSamplerScalar(o,t);case 1:return this.getPackedSampler1D(o,t,e);case 2:return this.getPackedSampler2D(o,t,e);case 3:return this.getPackedSampler3D(o,t,e);default:return this.getPackedSamplerND(o,t,e)}}getUnpackedSamplerFromInput(o,t,e){const r=e.unpackedShape;switch(r.length){case 0:return this.getUnpackedSamplerScalar(o,t,e);case 1:return this.getUnpackedSampler1D(o,t,e);case 2:return this.getUnpackedSampler2D(o,t,e);case 3:return this.getUnpackedSampler3D(o,t,e);case 4:return this.getUnpackedSampler4D(o,t,e);case 5:return this.getUnpackedSampler5D(o,t,e);case 6:return this.getUnpackedSampler6D(o,t,e);default:throw new Error(`Unsupported dimension ${r.length}-D`)}}getPackedSamplerScalar(o,t){const e=` - vec4 ${o}() { - return ${(0,p.getGlsl)(this.context.glContext.version).texture2D}(${t}, halfCR); - } - `;return new c.GlslLibRoutine(e)}getPackedSampler1D(o,t,e){const r=[e.width,e.height],i=[r[1],r[0]],d=(0,p.getGlsl)(this.context.glContext.version),g=`vec4 ${o}(int index) { - vec2 uv = packedUVfrom1D( - ${i[0]}, ${i[1]}, index); - return ${d.texture2D}(${t}, uv); - }`;return new c.GlslLibRoutine(g,["coordinates.packedUVfrom1D"])}getPackedSampler2D(o,t,e){const r=e.unpackedShape,i=[e.width,e.height],d=(0,p.getGlsl)(this.context.glContext.version),g=i[0],m=i[1];if(i!=null&&u.ArrayUtil.arraysEqual(r,i)){const v=`vec4 ${o}(int row, int col) { - vec2 uv = (vec2(col, row) + halfCR) / vec2(${m}.0, ${g}.0); - return ${d.texture2D}(${t}, uv); - }`;return new c.GlslLibRoutine(v)}const _=i,y=Math.ceil(r[1]/2),w=`vec4 ${o}(int row, int col) { - vec2 uv = packedUVfrom2D(${_[1]}, ${_[0]}, ${y}, row, col); - return ${d.texture2D}(${t}, uv); - }`;return new c.GlslLibRoutine(w,["coordinates.packedUVfrom2D"])}getPackedSampler3D(o,t,e){const r=e.unpackedShape,i=[e.width,e.height],d=[i[0],i[1]],g=(0,p.getGlsl)(this.context.glContext.version);if(r[0]===1){const v=r.slice(1),S=[1,2],O=(0,h.squeezeInputShape)(r,v),A=["b","row","col"],T=JSON.parse(JSON.stringify(e));T.unpackedShape=O;const M=this.getPackedSamplerFromInput(o,t,T),N=`${M.routineBody} - vec4 ${o}(int b, int row, int col) { - return ${o}(${(0,h.getSqueezedParams)(A,S)}); - } `;return new c.GlslLibRoutine(N,M.dependencies)}const m=d[0],_=d[1],y=Math.ceil(r[2]/2),w=`vec4 ${o}(int b, int row, int col) { - vec2 uv = packedUVfrom3D( - ${_}, ${m}, ${y*Math.ceil(r[1]/2)}, ${y}, b, row, col); - return ${g.texture2D}(${t}, uv);}`;return new c.GlslLibRoutine(w,["coordinates.packedUVfrom3D"])}getPackedSamplerND(o,t,e){const r=e.unpackedShape,i=r.length,d=[e.width,e.height],g=(0,p.getGlsl)(this.context.glContext.version),m=[d[0],d[1]],_=m[1],y=m[0],w=Math.ceil(r[i-1]/2);let v=w*Math.ceil(r[i-2]/2),S="int b, int row, int col",O=`b * ${v} + (row / 2) * ${w} + (col / 2)`;for(let T=2;T {const r=this.context.inputTextureLayouts[e],i=(r.unpackedShape.length>0?r.unpackedShape:r.shape).length;let d=`_${t}`;o[d]=new c.GlslLibRoutine(this.getValueFromSingle(t,i,r.width,r.height,!1),[`shapeUtils.indicesToOffset${d}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"]),d+="_T",o[d]=new c.GlslLibRoutine(this.getValueFromSingle(t,i,r.width,r.height,!0),[`shapeUtils.indicesToOffset${d}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"])}),o}getValueFromSingle(o,t,e,r,i){let d=`_${o}`;return i&&(d+="_T"),` - float ${d}(int m[${t}]) { - int offset = indicesToOffset${d}(m); - vec2 coords = offsetToCoords(offset, ${e}, ${r}); - float value = getColorAsFloat(${(0,p.getGlsl)(this.context.glContext.version).texture2D}(${o}, coords)); - return value; - } - `}getPackedValueFrom(o,t,e,r,i){let d=`_${o}_Pack`;return i&&(d+="_T"),` - vec4 ${d}(int m[${t}]) { - int offset = indicesToOffset_${o}(m); - vec2 coords = offsetToCoords(offset, ${e}, ${r}); - return ${(0,p.getGlsl)(this.context.glContext.version).texture2D}(${o}, coords); - } - `}}n.CoordsGlslLib=f},8520:(b,n)=>{var a;Object.defineProperty(n,"__esModule",{value:!0}),n.TopologicalSortGlslRoutines=n.GlslLibRoutineNode=n.GlslLibRoutine=n.GlslLib=n.GlslContext=n.FunctionType=void 0,(a=n.FunctionType||(n.FunctionType={}))[a.ValueBased=0]="ValueBased",a[a.Positional=1]="Positional",n.GlslContext=class{constructor(u,c,p,s){this.glContext=u,this.programInfo=c,this.inputTextureLayouts=p,this.outputTextureLayout=s}},n.GlslLib=class{constructor(u){this.context=u}},n.GlslLibRoutine=class{constructor(u,c){this.routineBody=u,this.dependencies=c}},n.GlslLibRoutineNode=class{constructor(u,c,p){this.name=u,this.dependencies=p||[],c&&(this.routineBody=c)}addDependency(u){u&&this.dependencies.push(u)}},n.TopologicalSortGlslRoutines=class{static returnOrderedNodes(u){if(!u||u.length===0)return[];if(u.length===1)return u;const c=new Set,p=new Set,s=new Array;return this.createOrderedNodes(u,c,p,s),s}static createOrderedNodes(u,c,p,s){for(let h=0;h 0)for(let f=0;f {Object.defineProperty(n,"__esModule",{value:!0}),n.EncodingGlslLib=void 0;const u=a(8520);class c extends u.GlslLib{constructor(s){super(s)}getFunctions(){return Object.assign(Object.assign({},this.encodeFloat32()),this.decodeFloat32())}getCustomTypes(){return{}}encodeFloat32(){return{encode:new u.GlslLibRoutine(`highp vec4 encode(highp float f) { - return vec4(f, 0.0, 0.0, 0.0); - } - `)}}decodeFloat32(){return{decode:new u.GlslLibRoutine(`highp float decode(highp vec4 rgba) { - return rgba.r; - } - `)}}encodeUint8(){const s=c.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{encode:new u.GlslLibRoutine(` - highp vec4 encode(highp float f) { - highp float F = abs(f); - highp float Sign = step(0.0,-f); - highp float Exponent = floor(log2(F)); - highp float Mantissa = (exp2(- Exponent) * F); - Exponent = floor(log2(F) + 127.0) + floor(log2(Mantissa)); - highp vec4 rgba; - rgba[0] = 128.0 * Sign + floor(Exponent*exp2(-1.0)); - rgba[1] = 128.0 * mod(Exponent,2.0) + mod(floor(Mantissa*128.0),128.0); - rgba[2] = floor(mod(floor(Mantissa*exp2(23.0 -8.0)),exp2(8.0))); - rgba[3] = floor(exp2(23.0)*mod(Mantissa,exp2(-15.0))); - ${s} - rgba = rgba / 255.0; // values need to be normalized to [0,1] - return rgba; - } - `)}}decodeUint8(){const s=c.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{decode:new u.GlslLibRoutine(` - highp float decode(highp vec4 rgba) { - rgba = rgba * 255.0; // values need to be de-normalized from [0,1] to [0,255] - ${s} - highp float Sign = 1.0 - step(128.0,rgba[0])*2.0; - highp float Exponent = 2.0 * mod(rgba[0],128.0) + step(128.0,rgba[1]) - 127.0; - highp float Mantissa = mod(rgba[1],128.0)*65536.0 + rgba[2]*256.0 +rgba[3] + float(0x800000); - highp float Result = Sign * exp2(Exponent) * (Mantissa * exp2(-23.0 )); - return Result; - } - `)}}static isLittleEndian(){const s=new ArrayBuffer(4),h=new Uint32Array(s),f=new Uint8Array(s);if(h[0]=3735928559,f[0]===239)return!0;if(f[0]===222)return!1;throw new Error("unknown endianness")}}n.EncodingGlslLib=c},9894:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.FragColorGlslLib=void 0;const u=a(8520),c=a(5060);class p extends u.GlslLib{constructor(h){super(h)}getFunctions(){return Object.assign(Object.assign({},this.setFragColor()),this.getColorAsFloat())}getCustomTypes(){return{}}setFragColor(){const h=(0,c.getGlsl)(this.context.glContext.version);return{setFragColor:new u.GlslLibRoutine(` - void setFragColor(float value) { - ${h.output} = encode(value); - } - `,["encoding.encode"])}}getColorAsFloat(){return{getColorAsFloat:new u.GlslLibRoutine(` - float getColorAsFloat(vec4 color) { - return decode(color); - } - `,["encoding.decode"])}}}n.FragColorGlslLib=p},2848:(b,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.replaceInlines=void 0;const a=/@inline[\s\n\r]+(\w+)[\s\n\r]+([0-9a-zA-Z_]+)\s*\(([^)]*)\)\s*{(([^}]|[\n\r])*)}/gm;n.replaceInlines=function(u){const c={};let p;for(;(p=a.exec(u))!==null;){const s=p[3].split(",").map(h=>{const f=h.trim().split(" ");return f&&f.length===2?{type:f[0],name:f[1]}:null}).filter(h=>h!==null);c[p[2]]={params:s,body:p[4]}}for(const s in c){const h="(\\w+)?\\s+([_0-9a-zA-Z]+)\\s+=\\s+__FUNC__\\((.*)\\)\\s*;".replace("__FUNC__",s),f=new RegExp(h,"gm");for(;(p=f.exec(u))!==null;){const l=p[1],o=p[2],t=p[3].split(","),e=l?`${l} ${o};`:"";let r=c[s].body,i="";c[s].params.forEach((g,m)=>{g&&(i+=`${g.type} ${g.name} = ${t[m]}; -`)}),r=`${i} - ${r}`,r=r.replace("return",`${o} = `);const d=` - ${e} - { - ${r} - } - `;u=u.replace(p[0],d)}}return u.replace(a,"")}},8879:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.GlslPreprocessor=void 0;const u=a(8520),c=a(2848),p=a(5483),s=a(5060);n.GlslPreprocessor=class{constructor(h,f,l,o){this.libs={},this.glslLibRoutineDependencyGraph={},this.context=new u.GlslContext(h,f,l,o),Object.keys(p.glslRegistry).forEach(e=>{const r=new p.glslRegistry[e](this.context);this.libs[e]=r});const t=this.glslLibRoutineDependencyGraph;for(const e in this.libs){const r=this.libs[e].getFunctions();for(const i in r){const d=e+"."+i;let g;t[d]?(g=t[d],g.routineBody=r[i].routineBody):(g=new u.GlslLibRoutineNode(d,r[i].routineBody),t[d]=g);const m=r[i].dependencies;if(m)for(let _=0;_ {const o=l.split(".")[1];h.indexOf(o)!==-1&&f.push(this.glslLibRoutineDependencyGraph[l])}),u.TopologicalSortGlslRoutines.returnOrderedNodes(f)}getUniforms(h,f){const l=[];if(h)for(const o of h)l.push(`uniform sampler2D ${o};`);if(f)for(const o of f)l.push(`uniform ${o.type} ${o.name}${o.arrayLength?`[${o.arrayLength}]`:""};`);return l.join(` -`)}}},5483:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.glslRegistry=void 0;const u=a(5107),c=a(7341),p=a(9894),s=a(2655),h=a(3891);n.glslRegistry={encoding:c.EncodingGlslLib,fragcolor:p.FragColorGlslLib,vec:h.VecGlslLib,shapeUtils:s.ShapeUtilsGlslLib,coordinates:u.CoordsGlslLib}},2655:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ShapeUtilsGlslLib=void 0;const u=a(8520);class c extends u.GlslLib{constructor(s){super(s)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.bcastIndex()),this.bcastMatmulIndex()),this.offsetToIndices()),this.indicesToOffset()),this.incrementIndices())}getCustomTypes(){return{}}bcastIndex(){const s=this.context.outputTextureLayout.shape.length,h={};return this.context.programInfo.inputNames.forEach((f,l)=>{const o=this.context.inputTextureLayouts[l].unpackedShape;if(o.length<=s){const t=o.length,e=s-t,r=`bcastIndices_${f}`;let i="";for(let g=0;g {const o=this.context.inputTextureLayouts[l].shape;if(!(o.length<2||o.length>s)){const t=o.length,e=s-t,r=`bcastMatmulIndices_${f}`;let i="";for(let g=0;g {const l=this.context.inputTextureLayouts[f].shape,o=this.context.inputTextureLayouts[f].strides,t=l.length;let e=`indicesToOffset_${h}`;s[e]=new u.GlslLibRoutine(c.indexToOffsetSingle(e,t,o)),e=`indicesToOffset_${h}_T`,s[e]=new u.GlslLibRoutine(c.indexToOffsetSingle(e,t,o.slice().reverse()))}),s}static indexToOffsetSingle(s,h,f){let l="";for(let o=h-1;o>=0;--o)l+=` - offset += indices[${o}] * ${f[o]}; - `;return` - int ${s}(int indices[${h}]) { - int offset = 0; - ${l} - return offset; - } - `}offsetToIndices(){const s={};return this.context.programInfo.inputNames.forEach((h,f)=>{const l=this.context.inputTextureLayouts[f].shape,o=this.context.inputTextureLayouts[f].strides,t=l.length;let e=`offsetToIndices_${h}`;s[e]=new u.GlslLibRoutine(c.offsetToIndicesSingle(e,t,o)),e=`offsetToIndices_${h}_T`,s[e]=new u.GlslLibRoutine(c.offsetToIndicesSingle(e,t,o.slice().reverse()))}),s}static offsetToIndicesSingle(s,h,f){const l=[];for(let o=0;o {const l=this.context.inputTextureLayouts[f].shape,o=l.length,t=`incrementIndices_${h}`;let e="";for(let i=0;i = 0; --i) { - if(i > axis) continue; - indices[i] += 1; - if(indices[i] < shape[i]) { - break; - } - indices[i] = 0; - } - } - `;s[t]=new u.GlslLibRoutine(r)}),s}}n.ShapeUtilsGlslLib=c},5060:(b,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.getDefaultFragShaderMain=n.getFragShaderPreamble=n.getVertexShaderSource=n.getGlsl=void 0;const a={version:"",attribute:"attribute",varyingVertex:"varying",varyingFrag:"varying",texture2D:"texture2D",output:"gl_FragColor",outputDeclaration:""},u={version:"#version 300 es",attribute:"in",varyingVertex:"out",varyingFrag:"in",texture2D:"texture",output:"outputColor",outputDeclaration:"out vec4 outputColor;"};function c(p){return p===1?a:u}n.getGlsl=c,n.getVertexShaderSource=function(p){const s=c(p);return`${s.version} - precision highp float; - ${s.attribute} vec3 position; - ${s.attribute} vec2 textureCoord; - - ${s.varyingVertex} vec2 TexCoords; - - void main() - { - gl_Position = vec4(position, 1.0); - TexCoords = textureCoord; - }`},n.getFragShaderPreamble=function(p){const s=c(p);return`${s.version} - precision highp float; - precision highp int; - precision highp sampler2D; - ${s.varyingFrag} vec2 TexCoords; - ${s.outputDeclaration} - const vec2 halfCR = vec2(0.5, 0.5); - - // Custom vector types to handle higher dimenalities. - struct ivec5 - { - int x; - int y; - int z; - int w; - int u; - }; - - struct ivec6 - { - int x; - int y; - int z; - int w; - int u; - int v; - }; - - int imod(int x, int y) { - return x - y * (x / y); - } - - `},n.getDefaultFragShaderMain=function(p,s){return` - void main() { - int indices[${s}]; - toVec(TexCoords, indices); - vec4 result = vec4(process(indices)); - ${c(p).output} = result; - } - `}},3891:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.VecGlslLib=void 0;const u=a(8520);class c extends u.GlslLib{constructor(s){super(s)}getCustomTypes(){return{}}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign({},this.binaryVecFunctions()),this.copyVec()),this.setVecItem()),this.getVecItem())}binaryVecFunctions(){const s=this.context.outputTextureLayout.shape.length,h={add:"+=",sub:"-=",mul:"*=",div:"/="},f={};for(const l in h){const o=`${l}Vec`;let t="";for(let r=0;r {Object.defineProperty(n,"__esModule",{value:!0}),n.WebGLInferenceHandler=void 0;const u=a(6231),c=a(9162),p=a(2517),s=a(2403),h=a(7019),f=a(8710),l=a(5611),o=a(4057),t=a(2039);n.WebGLInferenceHandler=class{constructor(e){this.session=e,this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map}calculateTextureWidthAndHeight(e,r){return(0,o.calculateTextureWidthAndHeight)(this.session.layoutStrategy,e,r)}executeProgram(e,r){if(r.length{const S=v.map(A=>`${A.unpackedShape.join(",")};${A.width}x${A.height}`).join("_");let O=w.name;return w.cacheHint&&(O+="["+w.cacheHint+"]"),O+=":"+S,O})(e,i);let g=this.session.programManager.getArtifact(d);const m=g?g.programInfo:typeof e.get=="function"?e.get():e,_=(0,o.createTextureLayoutFromTextureType)(this.session.layoutStrategy,m.output.dims,m.output.textureType),y=this.createTextureData(_,m.output.type);return g||(g=this.session.programManager.build(m,i,y),this.session.programManager.setArtifact(d,g)),this.runProgram(g,i,y),y}run(e,r){return this.executeProgram(e,r).tensor}runProgram(e,r,i){for(let d=0;d this.readTexture(m),async _=>this.readTextureAsync(m),void 0,g),texture:i});return this.setTextureData(m.tensor.dataId,m,e.isPacked),m}getTextureData(e,r=!1){return this.session.isInitializer(e)?this.session.getTextureData(e,r):r?this.packedTextureDataCache.get(e):this.unpackedTextureDataCache.get(e)}setTextureData(e,r,i=!1){this.session.isInitializer(e)?this.session.setTextureData(e,r,i):(i?this.packedTextureDataCache:this.unpackedTextureDataCache).set(e,r)}isTextureLayoutCached(e,r=!1){return!!this.getTextureData(e.dataId,r)}dispose(){this.session.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(e=>this.session.textureManager.releaseTexture(e)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(e=>this.session.textureManager.releaseTexture(e)),this.unpackedTextureDataCache=new Map}readTexture(e){return e.isPacked?this.readTexture(this.unpack(e)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTexture(e,e.tensor.type,e.channels):this.session.textureManager.readUint8TextureAsFloat((0,f.encodeAsUint8)(this,e))}async readTextureAsync(e){return e.isPacked?this.readTextureAsync(this.unpack(e)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTextureAsync(e,e.tensor.type,e.channels):this.session.textureManager.readUint8TextureAsFloat((0,f.encodeAsUint8)(this,e))}pack(e){return this.executeProgram((0,s.createPackProgramInfoLoader)(this,e.tensor),[e.tensor])}unpack(e){return this.executeProgram((0,l.createUnpackProgramInfoLoader)(this,e.tensor),[e.tensor])}}},1640:function(b,n,a){var u=this&&this.__createBinding||(Object.create?function(X,te,ne,me){me===void 0&&(me=ne);var Me=Object.getOwnPropertyDescriptor(te,ne);Me&&!("get"in Me?!te.__esModule:Me.writable||Me.configurable)||(Me={enumerable:!0,get:function(){return te[ne]}}),Object.defineProperty(X,me,Me)}:function(X,te,ne,me){me===void 0&&(me=ne),X[me]=te[ne]}),c=this&&this.__setModuleDefault||(Object.create?function(X,te){Object.defineProperty(X,"default",{enumerable:!0,value:te})}:function(X,te){X.default=te}),p=this&&this.__importStar||function(X){if(X&&X.__esModule)return X;var te={};if(X!=null)for(var ne in X)ne!=="default"&&Object.prototype.hasOwnProperty.call(X,ne)&&u(te,X,ne);return c(te,X),te};Object.defineProperty(n,"__esModule",{value:!0}),n.WEBGL_OP_RESOLVE_RULES=void 0;const s=a(2898),h=p(a(7839)),f=a(4196),l=a(2069),o=a(8138),t=a(9663),e=a(5193),r=a(7992),i=a(1253),d=a(4776),g=a(6572),m=a(3346),_=a(5623),y=a(2870),w=a(2143),v=a(4939),S=a(718),O=a(2268),A=a(8117),T=a(2278),M=a(5524),N=a(5975),B=a(3933),$=a(6558),L=a(5723),H=a(3738),C=p(a(4909)),z=a(8428),J=a(9793);n.WEBGL_OP_RESOLVE_RULES=[["Abs","","6+",C.abs],["Acos","","7+",C.acos],["Add","","7+",h.add],["And","","7+",h.and],["Asin","","7+",C.asin],["Atan","","7+",C.atan],["AveragePool","","7+",w.averagePool,w.parseAveragePoolAttributes],["BatchNormalization","","7+",s.batchNormalization,s.parseBatchNormalizationAttributes],["Cast","","6+",f.cast,f.parseCastAttributes],["Ceil","","6+",C.ceil],["Clip","","6-10",C.clip,C.parseClipAttributes],["Clip","","11+",C.clipV11],["Concat","","4+",l.concat,l.parseConcatAttributes],["Conv","","1+",o.conv,o.parseConvAttributes],["ConvTranspose","","1+",t.convTranspose,t.parseConvTransposeAttributes],["Cos","","7+",C.cos],["Div","","7+",h.div],["Dropout","","7+",C.identity],["DepthToSpace","","1+",e.depthToSpace,e.parseDepthToSpaceAttributes],["Equal","","7+",h.equal],["Elu","","6+",C.elu,C.parseEluAttributes],["Exp","","6+",C.exp],["Flatten","","1+",r.flatten,r.parseFlattenAttributes],["Floor","","6+",C.floor],["FusedConv","com.microsoft","1+",o.conv,o.parseConvAttributes],["Gather","","1+",i.gather,i.parseGatherAttributes],["Gemm","","7-10",d.gemm,d.parseGemmAttributesV7],["Gemm","","11+",d.gemm,d.parseGemmAttributesV11],["GlobalAveragePool","","1+",w.globalAveragePool,w.parseGlobalAveragePoolAttributes],["GlobalMaxPool","","1+",w.globalMaxPool],["Greater","","7+",h.greater],["Identity","","1+",C.identity],["ImageScaler","","1+",g.imageScaler,g.parseImageScalerAttributes],["InstanceNormalization","","6+",m.instanceNormalization,m.parseInstanceNormalizationAttributes],["LeakyRelu","","6+",C.leakyRelu,C.parseLeakyReluAttributes],["Less","","7+",h.less],["Log","","6+",C.log],["MatMul","","1+",_.matMul,_.parseMatMulAttributes],["MaxPool","","1+",w.maxPool,w.parseMaxPoolAttributes],["Mul","","7+",h.mul],["Neg","","6+",C.neg],["Not","","1+",C.not],["Or","","7+",h.or],["Pad","","2-10",y.padV2,y.parsePadAttributesV2],["Pad","","11+",y.padV11,y.parsePadAttributesV11],["Pow","","7+",h.pow],["PRelu","","7+",h.pRelu],["ReduceLogSum","","1+",v.reduceLogSum,v.parseReduceAttributes],["ReduceMax","","1+",v.reduceMax,v.parseReduceAttributes],["ReduceMean","","1+",v.reduceMean,v.parseReduceAttributes],["ReduceMin","","1+",v.reduceMin,v.parseReduceAttributes],["ReduceProd","","1+",v.reduceProd,v.parseReduceAttributes],["ReduceSum","","1-12",v.reduceSum,v.parseReduceAttributes],["ReduceSumSquare","","1+",v.reduceLogSumSquare,v.parseReduceAttributes],["Relu","","6+",C.relu],["Reshape","","5+",S.reshape],["Resize","","10",O.resize,O.parseResizeAttributesV10],["Resize","","11+",O.resize,O.parseResizeAttributesV11],["Shape","","1+",A.shape],["Sigmoid","","6+",C.sigmoid],["Sin","","7+",C.sin],["Slice","","10+",T.sliceV10],["Slice","","1-9",T.slice,T.parseSliceAttributes],["Softmax","","1-12",M.softmax,M.parseSoftmaxAttributes],["Softmax","","13+",M.softmaxV13,M.parseSoftmaxAttributesV13],["Split","","2-12",N.split,N.parseSplitAttributes],["Sqrt","","6+",C.sqrt],["Squeeze","","1-12",B.squeeze,B.parseSqueezeAttributes],["Squeeze","","13+",B.squeezeV13],["Sub","","7+",h.sub],["Sum","","6+",$.sum],["Tan","","7+",C.tan],["Tanh","","6+",C.tanh],["Tile","","6+",L.tile],["Transpose","","1+",H.transpose,H.parseTransposeAttributes],["Upsample","","7-8",J.upsample,J.parseUpsampleAttributesV7],["Upsample","","9",J.upsample,J.parseUpsampleAttributesV9],["Unsqueeze","","1-12",z.unsqueeze,z.parseUnsqueezeAttributes],["Unsqueeze","","13+",z.unsqueezeV13],["Xor","","7+",h.xor]]},2898:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseBatchNormalizationAttributes=n.batchNormalization=void 0;const u=a(246),c=a(5060),p=a(2039),s={name:"BatchNormalization",inputNames:["A","Scale","B","Mean","Variance"],inputTypes:[p.TextureType.unpacked,p.TextureType.unpacked,p.TextureType.unpacked,p.TextureType.unpacked,p.TextureType.unpacked]};n.batchNormalization=(l,o,t)=>(f(o),[l.run(Object.assign(Object.assign({},s),{cacheHint:t.cacheKey,get:()=>h(l,o,t)}),o)]),n.parseBatchNormalizationAttributes=l=>{const o=l.attributes.getFloat("epsilon",1e-5),t=l.attributes.getFloat("momentum",.9),e=l.attributes.getInt("spatial",1);return(0,u.createAttributeWithCacheKey)({epsilon:o,momentum:t,spatial:e})};const h=(l,o,t)=>{const e=(0,c.getGlsl)(l.session.backend.glContext.version),r=o[0].dims.length,[i,d]=l.calculateTextureWidthAndHeight(o[1].dims,p.TextureType.unpacked),g=` - float process(int[${r}] indices) { - vec2 position = offsetToCoords(indices[1], ${i}, ${d}); - float scale = getColorAsFloat(${e.texture2D}(Scale, position)); - float mean = getColorAsFloat(${e.texture2D}(Mean, position)); - float variance = getColorAsFloat(${e.texture2D}(Variance, position)); - float b = getColorAsFloat(${e.texture2D}(B, position)); - - return scale * ( (_A(indices) - mean) / sqrt(variance + float(${t.epsilon})) ) + b; - }`;return Object.assign(Object.assign({},s),{output:{dims:o[0].dims,type:o[0].type,textureType:p.TextureType.unpacked},shaderSource:g})},f=l=>{if(!l||l.length!==5)throw new Error("BatchNormalization requires 5 inputs.");const o=l[0],t=l[1],e=l[2],r=l[3],i=l[4];if(o.dims.length<3||t.dims.length!==1||e.dims.length!==1||r.dims.length!==1||i.dims.length!==1)throw new Error("invalid input shape.");if(t.dims[0]!==o.dims[1]||e.dims[0]!==o.dims[1]||r.dims[0]!==o.dims[1]||i.dims[0]!==o.dims[1])throw new Error("invalid input shape.");if(o.type!=="float32"&&o.type!=="float64"||t.type!=="float32"&&t.type!=="float64"||e.type!=="float32"&&e.type!=="float64"||r.type!=="float32"&&r.type!=="float64"||i.type!=="float32"&&i.type!=="float64")throw new Error("invalid input tensor types.")}},7839:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.xor=n.sub=n.pRelu=n.pow=n.or=n.mul=n.less=n.greater=n.equal=n.div=n.and=n.add=n.glslPRelu=n.glslPow=n.glslXor=n.glslOr=n.glslAnd=n.glslLess=n.glslGreater=n.glslEqual=n.glslSub=n.glslMul=n.glslDiv=n.glslAdd=void 0;const u=a(2517),c=a(8520),p=a(5060),s=a(2039);function h(){const v="add_";return{body:` - float ${v}(float a, float b) { - return a + b; - } - vec4 ${v}(vec4 v1, vec4 v2) { - return v1 + v2; - } - `,name:v,type:c.FunctionType.ValueBased}}function f(){const v="div_";return{body:` - float ${v}(float a, float b) { - return a / b; - } - vec4 ${v}(vec4 v1, vec4 v2) { - return v1 / v2; - } - `,name:v,type:c.FunctionType.ValueBased}}function l(){const v="mul_";return{body:` - float ${v}(float a, float b) { - return a * b; - } - vec4 ${v}(vec4 v1, vec4 v2) { - return v1 * v2; - } - `,name:v,type:c.FunctionType.ValueBased}}function o(){const v="sub_";return{body:` - float ${v}(float a, float b) { - return a - b; - } - vec4 ${v}(vec4 v1, vec4 v2) { - return v1 - v2; - } - `,name:v,type:c.FunctionType.ValueBased}}function t(){const v="equal_";return{body:` - float ${v}(float a, float b) { - return float(a == b); - } - vec4 ${v}(vec4 v1, vec4 v2) { - return vec4(equal(v1, v2)); - } - `,name:v,type:c.FunctionType.ValueBased}}function e(){const v="greater_";return{body:` - float ${v}(float a, float b) { - return float(a > b); - } - vec4 ${v}(vec4 v1, vec4 v2) { - return vec4( v1.r > v2.r , - v1.g > v2.g, - v1.b > v2.b, - v1.a > v2.a ); - } - `,name:v,type:c.FunctionType.ValueBased}}function r(){const v="less_";return{body:` - float ${v}(float a, float b) { - return float(a < b); - } - vec4 ${v}(vec4 v1, vec4 v2) { - return vec4( v1.r < v2.r , - v1.g < v2.g, - v1.b < v2.b, - v1.a < v2.a ); - } - `,name:v,type:c.FunctionType.ValueBased}}function i(){const v="and_";return{body:` - float ${v}(float a, float b) { - return float( bool(a) && bool(b) ); - } - vec4 ${v}(vec4 v1, vec4 v2) { - bvec4 b1 = bvec4(v1); - bvec4 b2 = bvec4(v2); - return vec4( b1.r && b2.r , - b1.g && b2.g, - b1.b && b2.b, - b1.a && b2.a ); - } - `,name:v,type:c.FunctionType.ValueBased}}function d(){const v="or_";return{body:` - float ${v}(float a, float b) { - return float( bool(a) || bool(b) ); - } - vec4 ${v}(vec4 v1, vec4 v2) { - bvec4 b1 = bvec4(v1); - bvec4 b2 = bvec4(v2); - return vec4( b1.r || b2.r , - b1.g || b2.g, - b1.b || b2.b, - b1.a || b2.a ); - } - `,name:v,type:c.FunctionType.ValueBased}}function g(){const v="xor_";return{body:` - float ${v}(float a, float b) { - return float( bool(a) ^^ bool(b) ); - } - vec4 ${v}(vec4 v1, vec4 v2) { - bvec4 b1 = bvec4(v1); - bvec4 b2 = bvec4(v2); - return vec4( b1.r ^^ b2.r , - b1.g ^^ b2.g, - b1.b ^^ b2.b, - b1.a ^^ b2.a ); - } - `,name:v,type:c.FunctionType.ValueBased}}function m(){return function(v){const S=`${v}_`;return{body:` - float ${S}(float a, float b) { - return ${v}(a, b); - } - vec4 ${S}(vec4 v1, vec4 v2) { - return ${v}(v1, v2); - } - `,name:S,type:c.FunctionType.ValueBased}}("pow")}function _(){const v="prelu_";return{body:` - float ${v}(float a, float b) { - return a < 0.0 ? a * b: a; - } - vec4 ${v}(vec4 v1, vec4 v2) { - return vec4( - v1.r < 0.0 ? v1.r * v2.r: v1.r, - v1.g < 0.0 ? v1.g * v2.g: v1.g, - v1.b < 0.0 ? v1.b * v2.b: v1.b, - v1.a < 0.0 ? v1.a * v2.a: v1.a - ); - } - `,name:v,type:c.FunctionType.ValueBased}}n.glslAdd=h,n.glslDiv=f,n.glslMul=l,n.glslSub=o,n.glslEqual=t,n.glslGreater=e,n.glslLess=r,n.glslAnd=i,n.glslOr=d,n.glslXor=g,n.glslPow=m,n.glslPRelu=_;const y=(v,S,O,A=S[0].type,T)=>{const M=v.session.pack?s.TextureType.packed:s.TextureType.unpacked;return{name:O.name,inputNames:["A","B"],inputTypes:[M,M],cacheHint:T,get:()=>w(v,S,O,A)}},w=(v,S,O,A=S[0].type)=>{const T=v.session.pack?s.TextureType.packed:s.TextureType.unpacked,M=!u.ShapeUtil.areEqual(S[0].dims,S[1].dims);let N=S[0].dims;const B=v.session.pack;if(M){const H=u.BroadcastUtil.calcShape(S[0].dims,S[1].dims,!1);if(!H)throw new Error("Can't perform binary op on the given tensors");N=H;const C=N.length,z=S[0].dims.length!==0?S[0].dims.length:1,J=S[1].dims.length!==0?S[1].dims.length:1,X=S[0].dims.length!==0?"bcastIndices_A(indices, aindices);":"aindices[0] = 0;",te=S[1].dims.length!==0?"bcastIndices_B(indices, bindices);":"bindices[0] = 0;",ne=(0,p.getGlsl)(v.session.backend.glContext.version),me=B?` - ${O.body} - void main() { - vec4 a = getAAtOutCoords(); - vec4 b = getBAtOutCoords(); - vec4 result = ${O.name}(a, b); - ${ne.output} = result; - }`:` - ${O.body} - float process(int indices[${C}]) { - int aindices[${z}]; - int bindices[${J}]; - ${X} - ${te} - return ${O.name}(_A(aindices), _B(bindices)); - }`;return{name:O.name,inputNames:["A","B"],inputTypes:[T,T],output:{dims:N,type:A,textureType:T},shaderSource:me,hasMain:B}}const $=(0,p.getGlsl)(v.session.backend.glContext.version),L=` - ${O.body} - void main() { - vec4 v1 = ${$.texture2D}(A, TexCoords); - vec4 v2 = ${$.texture2D}(B, TexCoords); - vec4 result = ${O.name}(v1, v2); - ${$.output} = result; - } - `;return{name:O.name,inputNames:["A","B"],inputTypes:[T,T],output:{dims:S[0].dims,type:A,textureType:T},shaderSource:L,hasMain:!0}};n.add=(v,S)=>[v.run(y(v,S,h()),S)],n.and=(v,S)=>[v.run(y(v,S,i(),"bool"),S)],n.div=(v,S)=>[v.run(y(v,S,f()),S)],n.equal=(v,S)=>[v.run(y(v,S,t(),"bool"),S)],n.greater=(v,S)=>[v.run(y(v,S,e(),"bool"),S)],n.less=(v,S)=>[v.run(y(v,S,r(),"bool"),S)],n.mul=(v,S)=>[v.run(y(v,S,l()),S)],n.or=(v,S)=>[v.run(y(v,S,d(),"bool"),S)],n.pow=(v,S)=>[v.run(y(v,S,m()),S)],n.pRelu=(v,S)=>[v.run(y(v,S,_()),S)],n.sub=(v,S)=>[v.run(y(v,S,o()),S)],n.xor=(v,S)=>[v.run(y(v,S,g(),"bool"),S)]},4196:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseCastAttributes=n.cast=void 0;const u=a(2517);n.cast=(p,s,h)=>(c(s),[p.cast(s[0],h)]),n.parseCastAttributes=p=>u.ProtoUtil.tensorDataTypeFromProto(p.attributes.getInt("to"));const c=p=>{if(!p||p.length!==1)throw new Error("Cast requires 1 input.");if(p[0].type==="string")throw new Error("Invalid input type.")}},1163:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createPackedConcatProgramInfoLoader=void 0;const u=a(5060),c=a(2039),p=a(9390),s=a(2827);n.createPackedConcatProgramInfoLoader=(f,l,o)=>{const t=(e=l.length,r=o.cacheKey,{name:"Concat (packed)",inputNames:Array.from({length:e},(i,d)=>`X${d}`),inputTypes:Array(e).fill(c.TextureType.packed),cacheHint:r});var e,r;return Object.assign(Object.assign({},t),{get:()=>((i,d,g,m)=>{const _=g[0].dims.slice();if(m>=_.length||m<-1*_.length)throw new Error("axis specified for concat doesn't match input dimensionality");m<0&&(m=_.length+m);const y=_.slice(0);for(let X=1;X X.dims),T=(0,p.getGlChannels)(w),M=new Array(A.length-1);M[0]=A[0][m];for(let X=1;X = ${M[X-1]}) { - return getChannel( - getX${X}(${h(T,N,te)}), - vec2(${h(B,N,te)})); - }`}const H=M.length,C=M[M.length-1];L+=` - return getChannel( - getX${H}(${h(T,N,C)}), - vec2(${h(B,N,C)}));`;const z=(0,u.getGlsl)(i.session.backend.glContext.version),J=` - ${O} - float getValue(${T.map(X=>"int "+X)}) { - ${L} - } - - void main() { - ${S} coords = getOutputCoords(); - int lastDim = coords.${T[w-1]}; - coords.${T[w-1]} = coords.${T[w-2]}; - coords.${T[w-2]} = lastDim; - - vec4 result = vec4(getValue(${v}), 0., 0., 0.); - - ${v[w-1]} = ${v[w-1]} + 1; - if (${v[w-1]} < ${y[w-1]}) { - result.g = getValue(${v}); - } - - ${v[w-2]} = ${v[w-2]} + 1; - if (${v[w-2]} < ${y[w-2]}) { - result.a = getValue(${v}); - } - - ${v[w-1]} = ${v[w-1]} - 1; - if (${v[w-2]} < ${y[w-2]} && - ${v[w-1]} < ${y[w-1]}) { - result.b = getValue(${v}); - } - ${z.output} = result; - } - `;return Object.assign(Object.assign({},d),{output:{dims:y,type:g[0].type,textureType:c.TextureType.packed},shaderSource:J,hasMain:!0})})(f,t,l,o.axis)})};const h=(f,l,o)=>{const t=f.indexOf(l);return f.map((e,r)=>r===t?`${e} - ${o}`:e).join()}},2069:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseConcatAttributes=n.concat=void 0;const u=a(246),c=a(2039),p=a(1163);n.concat=(e,r,i)=>(t(r),e.session.pack&&r[0].dims.length>1?[e.run((0,p.createPackedConcatProgramInfoLoader)(e,r,i),r)]:[e.run(s(e,r,i),r)]);const s=(e,r,i)=>{const d=(g=r.length,m=i.cacheKey,{name:"Concat",inputNames:Array.from({length:g},(_,y)=>`X${y}`),inputTypes:Array(g).fill(c.TextureType.unpacked),cacheHint:m});var g,m;return Object.assign(Object.assign({},d),{get:()=>((_,y,w,v)=>{const S=w[0].dims.slice();if(v>=S.length||v<-1*S.length)throw new Error("axis specified for concat doesn't match input dimensionality");v<0&&(v=S.length+v);const O=S.slice(0);for(let $=1;$ `int getTextureWhereDataResides(int index) { - ${e.map((r,i)=>`if(index<${r}) {return ${i};} -`).join("")} - }`,f=e=>h(e),l=(e,r)=>{const i=[`float fetchDataFromCorrectTexture(int textureIndex, int indices[${r}]) {`];for(let d=0;d {const r=["int getSizeInConcatAxisValueFromIndex(int index) {"];for(let i=0;i (0,u.createAttributeWithCacheKey)({axis:e.attributes.getInt("axis")});const t=e=>{if(!e||e.length<1)throw new Error("too few inputs");const r=e[0].type,i=e[0].dims.length;if(r==="string")throw new Error("string tensor is not supported yet");for(const d of e){if(d.type!==r)throw new Error("input tensors should be one type");if(d.dims.length!==i)throw new Error("input tensors should have the same shape")}}},4770:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createUnpackedGroupedConvProgramInfoLoader=void 0;const u=a(6231),c=a(5060),p=a(2039),s=a(8138),h=a(2823);n.createUnpackedGroupedConvProgramInfoLoader=(f,l,o)=>{const t=(e=l.length>2,r=o.cacheKey,{name:"GroupedConv",inputNames:e?["X","W","Bias"]:["X","W"],inputTypes:e?[p.TextureType.unpacked,p.TextureType.unpacked,p.TextureType.unpacked]:[p.TextureType.unpacked,p.TextureType.unpacked],cacheHint:r});var e,r;return Object.assign(Object.assign({},t),{get:()=>((i,d,g,m)=>{const _=d.length>2?"value += getBias(output_channel);":"",y=d[0].dims.slice(),w=d[1].dims.slice(),v=w[0]/m.group;u.Logger.verbose("GroupedConv",`autpPad:${m.autoPad}, dilations:${m.dilations}, group:${m.group}, kernelShape:${m.kernelShape}, pads:${m.pads}, strides:${m.strides}`);const S=(0,s.calculateOutputShape)(y,w,m.dilations,m.pads,m.strides),O=(0,c.getGlsl)(i.session.backend.glContext.version),{activationFunction:A,applyActivation:T}=(0,h.getActivationSnippet)(m),M=` - const ivec2 strides = ivec2(${m.strides[0]}, ${m.strides[1]}); - const ivec2 pads = ivec2(${m.pads[0]}, ${m.pads[1]}); - ${A} - void main() { - ivec4 coords = getOutputCoords(); - int batch = coords.x; - int output_channel = coords.y; - ivec2 xRCCorner = coords.zw * strides - pads; - int group_id = output_channel / ${v}; - - float value = 0.0; - for (int wInChannel = 0; wInChannel < ${w[1]}; wInChannel++) { - int input_channel = group_id * ${w[1]} + wInChannel; - for (int wHeight = 0; wHeight < ${w[2]}; wHeight++) { - int xHeight = xRCCorner.x + wHeight * ${m.dilations[0]}; - - if (xHeight < 0 || xHeight >= ${y[2]}) { - continue; - } - - for (int wWidth = 0; wWidth < ${w[3]}; wWidth++) { - int xWidth = xRCCorner.y + wWidth * ${m.dilations[1]}; - if (xWidth < 0 || xWidth >= ${y[3]}) { - continue; - } - - float xVal = getX(batch, input_channel, xWidth, xHeight); - float wVal = getW(output_channel, wInChannel, wWidth, wHeight); - value += xVal*wVal; - } - } - } - ${_} - ${T} - ${O.output} = vec4(value, .0, .0, .0); - } -`;return Object.assign(Object.assign({},g),{output:{dims:S,type:d[0].type,textureType:p.TextureType.unpacked},shaderSource:M,hasMain:!0})})(f,l,t,o)})}},1386:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.conv2DPacked=n.conv2DPackedPointwise=void 0;const u=a(8138),c=a(8555),p=a(708);n.conv2DPackedPointwise=(s,h,f)=>{const l=h[0].dims,o=h[1].dims,t=(0,u.calculateOutputShape)(l,o,f.dilations,f.pads,f.strides),e=s.reshapePacked(h[0],[l[1],l[2]*l[3]]),r=s.reshapePacked(h[1],[o[0],o[1]]),i=h.length>2?[r,e,h[2]]:[r,e],d=s.run((0,p.createPackedMatmulProgramInfoLoader)(s,i,f),i);return s.reshapePacked(d,t)},n.conv2DPacked=(s,h,f)=>{const l=h[0].dims,o=h[1].dims,t=(0,u.calculateOutputShape)(l,o,f.dilations,f.pads,f.strides),e=s.run((0,c.createPackedIm2ColProgramInfoLoader)(s,h[0],h[1],t,f),[h[0]]),r=s.reshapePacked(h[1],[o[0],o[1]*o[2]*o[3]]),i=h.length===3?[r,e,h[2]]:[r,e],d=s.run((0,p.createPackedMatmulProgramInfoLoader)(s,i,f),i);return s.reshapePacked(d,t)}},9663:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseConvTransposeAttributes=n.convTranspose=void 0;const u=a(246),c=a(5060),p=a(2039),s=a(2823),h=(r,i,d,g,m,_)=>(r-1)*i+d+(g-1)*m+1-_,f=(r,i,d,g,m)=>{const _=Math.floor(r/2);i==="SAME_UPPER"?(d[g]=_,d[m]=r-_):i==="SAME_LOWER"&&(d[g]=r-_,d[m]=_)};n.convTranspose=(r,i,d)=>(e(i,d),l(r,i,d));const l=(r,i,d)=>{const g=t(d,i);return[o(r,i,g)]},o=(r,i,d)=>r.run(((g,m,_)=>{const y=(w=m.length>2,v=_.cacheKey,{name:"ConvTranspose",inputNames:w?["X","W","B"]:["X","W"],inputTypes:w?[p.TextureType.unpacked,p.TextureType.unpacked,p.TextureType.unpacked]:[p.TextureType.unpacked,p.TextureType.unpacked],cacheHint:v});var w,v;return Object.assign(Object.assign({},y),{get:()=>((S,O,A,T)=>{const M=O.length>2?"getB(output_channel)":"0.0",N=O[0].dims,B=O[1].dims,$=B[1],L=B[0]/T.group,H=[O[0].dims[0],O[1].dims[1]*T.group,...T.outputShape],C=(0,c.getGlsl)(S.session.backend.glContext.version),{activationFunction:z,applyActivation:J}=(0,s.getActivationSnippet)(T),X=` - const ivec2 strides = ivec2(${T.strides[0]}, ${T.strides[1]}); - const ivec2 pads = ivec2(${T.pads[0]}, ${T.pads[1]}); - ${z} - void main() { - ivec4 coords = getOutputCoords(); - int batch = coords.x; - int output_channel = coords.y; - - ivec2 loc = coords.zw + pads; - - int group_id = output_channel / ${$}; - int wOutChannel = output_channel - group_id * ${$}; - - float value = ${M}; - for (int inChannelOffset = 0; inChannelOffset < ${L}; inChannelOffset++) { - int input_channel = group_id * ${L} + inChannelOffset; - for (int wWOff = 0; wWOff < ${B[2]}; wWOff++) { - for (int wHOff = 0; wHOff < ${B[3]}; wHOff++) { - ivec2 wOff = ivec2(wWOff * ${T.dilations[0]}, wHOff * ${T.dilations[1]}); - ivec2 wLoc = loc - wOff; - ivec2 wLocIn = wLoc / strides; - if ( - wLocIn * strides == wLoc && - wLocIn.x >= 0 && wLocIn.x < ${N[2]} && - wLocIn.y >= 0 && wLocIn.y < ${N[3]} - ) { - float xVal = getX(batch, input_channel, wLocIn.y, wLocIn.x); - float wVal = getW(input_channel, wOutChannel, wHOff, wWOff); - value += xVal * wVal; - } - } - } - } - ${J} - ${C.output} = vec4(value, .0, .0, .0); - } -`;return Object.assign(Object.assign({},A),{output:{dims:H,type:O[0].type,textureType:p.TextureType.unpacked},shaderSource:X,hasMain:!0})})(g,m,y,_)})})(r,i,d),i),t=(r,i)=>{const d=r.kernelShape.slice();if(r.kernelShape.length===0)for(let y=2;y{const N=y.length-2,B=M.length===0;for(let $=0;$ {const i=r.attributes,d=(0,s.parseInternalActivationAttributes)(i),g=i.getString("auto_pad","NOTSET"),m=i.getInts("dilations",[1,1]),_=i.getInt("group",1),y=i.getInts("kernel_shape",[]),w=i.getInts("output_padding",[0,0]),v=i.getInts("output_shape",[]),S=i.getInts("pads",[0,0,0,0]),O=i.getInts("strides",[1,1]);return(0,u.createAttributeWithCacheKey)(Object.assign({autoPad:g,dilations:m,group:_,kernelShape:y,outputPadding:w,outputShape:v,pads:S,strides:O},d))};const e=(r,i)=>{if(!r||r.length!==2&&r.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(r[0].dims.length!==4||r[1].dims.length!==4)throw new Error("currently only support 2-dimensional conv");if(r[0].dims[1]!==r[1].dims[0])throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");const d=r[1].dims[1]*i.group;if(r.length===3&&(r[2].dims.length!==1||r[2].dims[0]!==d))throw new Error("invalid bias");const g=r[0].dims.length-2;if(i.dilations.length!==g)throw new Error(`dilations should be ${g}D`);if(i.strides.length!==g)throw new Error(`strides should be ${g}D`);if(i.pads.length!==2*g)throw new Error(`pads should be ${2*g}D`);if(i.outputPadding.length!==g)throw new Error(`output_padding should be ${g}D`);if(i.kernelShape.length!==0&&i.kernelShape.length!==r[1].dims.length-2)throw new Error("invalid kernel shape");if(i.outputShape.length!==0&&i.outputShape.length!==r[0].dims.length-2)throw new Error("invalid output shape");if(r[0].type!=="float32"||r[1].type!=="float32")throw new Error("ConvTranspose input(X,W) should be float tensor");if(r.length===3&&r[2].type!=="float32")throw new Error("ConvTranspose input(bias) should be float tensor")}},8138:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseConvAttributes=n.conv=n.calculateOutputShape=void 0;const u=a(246),c=a(2517),p=a(4770),s=a(1386),h=a(9828),f=a(2823),l=a(3248),o=a(5623);n.calculateOutputShape=(g,m,_,y,w)=>{const v=g[0],S=g.slice(2),O=S.length,A=m[0],T=m.slice(2).map((N,B)=>N+(N-1)*(_[B]-1)),M=S.map((N,B)=>N+y[B]+y[B+O]).map((N,B)=>Math.floor((N-T[B]+w[B])/w[B]));return[v,A].concat(...M)},n.conv=(g,m,_)=>(d(m,_),t(g,m,_));const t=(g,m,_)=>{const y=i(_,m),w=g.session.pack,v=y.kernelShape[0]===1&&y.kernelShape[1]===1;return y.group>1?[g.run((0,p.createUnpackedGroupedConvProgramInfoLoader)(g,m,y),m)]:v&&w?[e(g,m,y)]:w&&m[0].dims.length===4&&m[0].dims[0]===1&&!v?[(0,s.conv2DPacked)(g,m,y)]:[r(g,m,y)]},e=(g,m,_)=>{const y=m[0].dims,w=m[1].dims,v=(0,n.calculateOutputShape)(y,w,_.dilations,_.pads,_.strides),S=g.reshapeUnpacked(m[0],[y[1],y[2]*y[3]]),O=g.reshapeUnpacked(m[1],[w[0],w[1]]),A=m.length>2?[O,S,m[2]]:[O,S],T=g.run((0,o.createMatmulProgramInfoLoader)(A,_),A);return g.reshapeUnpacked(T,v)},r=(g,m,_)=>{const y=m[0].dims,w=m[1].dims,v=(0,n.calculateOutputShape)(y,w,_.dilations,_.pads,_.strides),S=g.run((0,l.createIm2ColProgramInfoLoader)(g,m[0],m[1],v,_),[m[0]]),O=m.length===3?[S,m[1],m[2]]:[S,m[1]];return g.run((0,h.createDotProductProgramInfoLoader)(g,m,v,_),O)},i=(g,m)=>{const _=g.kernelShape.slice();if(g.kernelShape.length===0)for(let v=2;v {const m=g.attributes,_=(0,f.parseInternalActivationAttributes)(m),y=m.getString("auto_pad","NOTSET"),w=m.getInts("dilations",[1,1]),v=m.getInt("group",1),S=m.getInts("kernel_shape",[]),O=m.getInts("pads",[0,0,0,0]),A=m.getInts("strides",[1,1]);return(0,u.createAttributeWithCacheKey)(Object.assign({autoPad:y,dilations:w,group:v,kernelShape:S,pads:O,strides:A},_))};const d=(g,m)=>{if(!g||g.length!==2&&g.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(g[0].dims.length!==4||g[1].dims.length!==4)throw new Error("currently only support 2-dimensional conv");if(g[0].dims[1]!==g[1].dims[1]*m.group)throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");if(g.length===3&&(g[2].dims.length!==1||g[1].dims[0]!==g[2].dims[0]))throw new Error("invalid bias");const _=g[0].dims.length-2;if(m.dilations.length!==_)throw new Error(`dilations should be ${_}D`);if(m.strides.length!==_)throw new Error(`strides should be ${_}D`);if(m.pads.length!==2*_)throw new Error(`pads should be ${2*_}D`);if(m.kernelShape.length!==0&&m.kernelShape.length!==g[1].dims.length-2)throw new Error("invalid kernel shape");if(g[0].type!=="float32"||g[1].type!=="float32")throw new Error("Conv input(X,W) should be float tensor");if(g.length===3&&g[2].type!=="float32")throw new Error("Conv input(bias) should be float tensor")}},5193:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseDepthToSpaceAttributes=n.depthToSpace=void 0;const u=a(3738);n.depthToSpace=(p,s,h)=>{c(s);const f=h.blocksize,l=f*f,o=h.mode==="DCR"?[0,3,4,1,5,2]:[0,1,4,2,5,3],t=h.mode==="DCR"?[s[0].dims[0],f,f,s[0].dims[1]/l,s[0].dims[2],s[0].dims[3]]:[s[0].dims[0],s[0].dims[1]/l,f,f,s[0].dims[2],s[0].dims[3]],e=p.reshapeUnpacked(s[0],t),r={perm:o,cacheKey:`${o}`},[i]=(0,u.transpose)(p,[e],r),d=[s[0].dims[0],s[0].dims[1]/l,s[0].dims[2]*f,s[0].dims[3]*f];return[p.reshapeUnpacked(i,d)]},n.parseDepthToSpaceAttributes=p=>{const s=p.attributes.getInt("blocksize");if(s<1)throw new Error(`blocksize must be >= 1, but got : ${s} for DepthToSpace`);const h=p.attributes.getString("mode","DCR");if(h!=="DCR"&&h!=="CRD")throw new Error(`unrecognized mode: ${h} for DepthToSpace`);return{mode:h,blocksize:s}};const c=p=>{if(p.length!==1)throw new Error(`DepthToSpace expect 1 inputs, but got ${p.length}`);if(p[0].type==="string"||p[0].dims.length!==4)throw new TypeError("DepthToSpace input should be a 4-D numeric tensor")}},9828:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createDotProductProgramInfoLoader=void 0;const u=a(2517),c=a(5060),p=a(2039),s=a(2823),h=a(3248);n.createDotProductProgramInfoLoader=(f,l,o,t)=>{const e=((r,i)=>({name:"ConvDotProduct",inputNames:r?["Im2Col","K","B"]:["Im2Col","K"],inputTypes:r?[p.TextureType.unpacked,p.TextureType.packedLastDimension,p.TextureType.unpacked]:[p.TextureType.unpacked,p.TextureType.packedLastDimension],cacheKey:i.activationCacheKey}))(l.length>2,t);return Object.assign(Object.assign({},e),{get:()=>((r,i,d,g,m)=>{const _=d[0].dims,y=d[1].dims,w=[y[0],Math.ceil(_[1]*y[2]*y[3]/4)],v=(0,h.calculateIm2ColDims)(_,y,g),[S,O]=r.calculateTextureWidthAndHeight(w,p.TextureType.packedLastDimension),A=u.ShapeUtil.computeStrides(v),[T,M]=r.calculateTextureWidthAndHeight(v,p.TextureType.packedLastDimension),N=g.length,B=d.length<3?"0.0":"_B(b)",$=Math.ceil(_[1]*y[2]*y[3]/4),{activationFunction:L,applyActivation:H}=(0,s.getActivationSnippet)(m),C=(0,c.getGlsl)(r.session.backend.glContext.version),z=` -${L} -float process(int indices[${N}]) { - int b[1]; - b[0] = indices[1]; - int im2col[4]; - im2col[0] = indices[0]; - im2col[1] = indices[2]; - im2col[2] = indices[3]; - int im2colOffset = im2col[0] * ${A[0]} + im2col[1] * ${A[1]} + im2col[2] * ${A[2]}; - int kernelOffset = indices[1] * ${w[1]}; - float value = ${B}; - for (int i = 0; i < ${$}; ++i) { - vec2 im2colCoords = offsetToCoords(im2colOffset, ${T}, ${M}); - vec2 kernelCoords = offsetToCoords(kernelOffset, ${S}, ${O}); - value += dot(${C.texture2D}(Im2Col, im2colCoords), ${C.texture2D}(K, kernelCoords)); - ++im2colOffset; - ++kernelOffset; - } - ${H} - return value; -}`;return Object.assign(Object.assign({},i),{output:{dims:g,type:d[0].type,textureType:p.TextureType.unpacked},shaderSource:z})})(f,e,l,o,t)})}},7992:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseFlattenAttributes=n.flatten=void 0;const u=a(2517);n.flatten=(p,s,h)=>{c(s,h);const f=u.ShapeUtil.flattenShape(s[0].dims,h);return[p.reshapeUnpacked(s[0],f)]},n.parseFlattenAttributes=p=>p.attributes.getInt("axis",1);const c=(p,s)=>{if(!p||p.length!==1)throw new Error("Flatten requires 1 input.");const h=p[0].dims.length;if(h===0)throw new Error("scalar tensor is not supported.");if(s<-h||s>h)throw new Error("Invalid axis");if(p[0].type==="string")throw new Error("string tensor is not supported.")}},2823:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseInternalActivationAttributes=n.getActivationSnippet=void 0;const u=a(2517),c=a(4909);n.getActivationSnippet=function(p){let s;switch(p.activation){case"Relu":s=(0,c.glslRelu)();break;case"Sigmoid":s=(0,c.glslSigmoid)();break;case"Clip":s=(0,c.glslClip)(p.clipMin,p.clipMax);break;default:return{activationFunction:"",applyActivation:""}}const h=s.name;return{activationFunction:s.body,applyActivation:`value = ${h}_(value);`}},n.parseInternalActivationAttributes=p=>{const s=p.getString("activation","");if(s==="Clip"){const[h,f]=p.getFloats("activation_params",[u.MIN_CLIP,u.MAX_CLIP]);return{activation:s,clipMax:f,clipMin:h,activationCacheKey:`${s}:${h},${f}`}}return{activation:s,activationCacheKey:s}}},1253:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseGatherAttributes=n.gather=void 0;const u=a(246),c=a(782),p=a(2517),s=a(2039);n.gather=(o,t,e)=>(l(t,e.axis),[o.run(f(o,t,e),t)]),n.parseGatherAttributes=o=>(0,u.createAttributeWithCacheKey)({axis:o.attributes.getInt("axis",0)});const h={name:"Gather",inputNames:["A","B"],inputTypes:[s.TextureType.unpacked,s.TextureType.unpacked]},f=(o,t,e)=>{const r=Object.assign(Object.assign({},h),{cacheHint:e.cacheKey});return Object.assign(Object.assign({},r),{get:()=>((i,d,g,m)=>{const _=g[0].dims.slice(),y=g[1].dims.slice(),w=new Array(_.length+y.length-1);m=p.ShapeUtil.normalizeAxis(m,_.length);const v=[];for(let O=0;O {if(!o||o.length!==2)throw new Error("Gather requires 2 inputs.");const e=o[0].dims.length;if(e<1)throw new Error("Invalid input shape.");if(t<-e||t>e-1)throw new Error("Invalid axis.");if(c.NUMBER_TYPES.indexOf(o[0].type)===-1)throw new Error("Invaid input type.");if(o[1].type!=="int32"&&o[1].type!=="int16")throw new Error("Invaid input type.")}},4776:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseGemmAttributesV11=n.parseGemmAttributesV7=n.gemm=void 0;const u=a(246),c=a(2517),p=a(2039);n.gemm=(o,t,e)=>(l(t,e),[o.run(h(t,e),t)]);const s=(o,t)=>{const e=o.attributes.getInt("transA",0)!==0,r=o.attributes.getInt("transB",0)!==0,i=o.attributes.getFloat("alpha",1),d=o.attributes.getFloat("beta",1);return(0,u.createAttributeWithCacheKey)({transA:e,transB:r,alpha:i,beta:d,isOptionalC:t})};n.parseGemmAttributesV7=o=>s(o,!1),n.parseGemmAttributesV11=o=>s(o,!0);const h=(o,t)=>{const e={name:"Gemm",inputNames:o.length===3?["A","B","C"]:["A","B"],inputTypes:o.length===3?[p.TextureType.unpacked,p.TextureType.unpacked,p.TextureType.unpacked]:[p.TextureType.unpacked,p.TextureType.unpacked],key:t.cacheKey};return Object.assign(Object.assign({},e),{get:()=>f(e,o,t)})},f=(o,t,e)=>{const r=t[0].dims.slice(),i=t[1].dims.slice(),[d,g]=c.GemmUtil.getShapeOfGemmResult(r,e.transA,i,e.transB,t.length===3?t[2].dims:void 0),m=[d,g];if(!m)throw new Error("Can't use gemm on the given tensors");let _=r[r.length-1],y="";e.transA&&(_=r[0]),e.transA&&e.transB?y="value += _A_T(a) * _B_T(b);":e.transA&&!e.transB?y="value += _A_T(a) * _B(b);":!e.transA&&e.transB?y="value += _A(a) * _B_T(b);":e.transA||e.transB||(y="value += _A(a) * _B(b);");const w=m.length,v=` - float process(int indices[${w}]) { - int a[${w}]; - int b[${w}]; - ${t.length===3?`int c[${t[2].dims.length}];`:""} - - copyVec(indices, a); - copyVec(indices, b); - ${t.length===3?"bcastIndices_C(indices, c);":""} - - float value = 0.0; - for (int k=0; k<${_}; ++k) { - a[${w-1}] = k; - b[${w-2}] = k; - ${y} - } - - value = value * alpha; - ${t.length===3?"value += beta * _C(c);":""} - return value; - }`;return Object.assign(Object.assign({},o),{output:{dims:m,type:t[0].type,textureType:p.TextureType.unpacked},variables:[{name:"alpha",type:"float",data:e.alpha},{name:"beta",type:"float",data:e.beta}],shaderSource:v})},l=(o,t)=>{if(!o)throw new Error("Input is missing");if(t.isOptionalC&&(o.length<2||o.length>3))throw new Error("Invaid input shape.");if(!t.isOptionalC&&o.length!==3)throw new Error("Gemm requires 3 inputs");if(o.length===3&&o[2].dims.length!==1&&o[2].dims.length!==2)throw new Error("Invalid input shape of C");if(o[0].type!=="float32"&&o[0].type!=="float64"||o[1].type!=="float32"&&o[1].type!=="float64"||o.length===3&&o[2].type!=="float32"&&o[2].type!=="float64")throw new Error("Invalid input type.");if(o[0].type!==o[1].type||o.length===3&&o[0].type!==o[2].type)throw new Error("Input types are mismatched")}},8555:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createPackedIm2ColProgramInfoLoader=void 0;const u=a(5060),c=a(2039),p=a(2827);n.createPackedIm2ColProgramInfoLoader=(s,h,f,l,o)=>{const t=(e=o.cacheKey,{name:"Im2Col (packed)",inputNames:["A"],inputTypes:[c.TextureType.packed],cacheHint:e});var e;return Object.assign(Object.assign({},t),{get:()=>((r,i,d,g,m,_)=>{const y=d.dims,w=g.dims,v=m.length,S=[w[1]*w[2]*w[3],m[2]*m[3]],O=w[2]*w[3],A=(0,p.unpackFromChannel)(),T=(0,u.getGlsl)(r.session.backend.glContext.version);let M="";for(let B=0;B<=1;B++)for(let $=0;$<=1;$++)M+=` - blockIndex = rc.x + ${$}; - pos = rc.y + ${B}; - - if(blockIndex < ${S[1]} && pos < ${S[0]}) { - offsetY = int(blockIndex / (${m[v-1]})) * ${_.strides[0]} - - ${_.pads[0]}; - d0 = offsetY + ${_.dilations[0]} * (imod(pos, ${O}) / ${w[2]}); - - if(d0 < ${y[2]} && d0 >= 0) { - offsetX = imod(blockIndex, ${m[v-1]}) * ${_.strides[1]} - - ${_.pads[1]}; - d1 = offsetX + ${_.dilations[1]} * imod(imod(pos, ${O}), ${w[2]}); - - if(d1 < ${y[3]} && d1 >= 0) { - - ch = int(float(pos)/ ${O}.); - innerDims = vec2(d0, d1); - result[${2*B+$}] = getChannel( - getA(0, ch, int(innerDims.x), - int(innerDims.y)), innerDims); - } - } - } - - `;const N=` - ${A} - - void main() { - ivec2 rc = getOutputCoords(); - vec4 result = vec4(0.0); - int blockIndex, pos, offsetY, d0, offsetX, d1, ch; - vec2 innerDims; - ${M} - ${T.output} = result; - } - `;return Object.assign(Object.assign({},i),{output:{dims:S,type:d.type,textureType:c.TextureType.packed},shaderSource:N,hasMain:!0})})(s,t,h,f,l,o)})}},3248:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.calculateIm2ColDims=n.createIm2ColProgramInfoLoader=void 0;const u=a(2039);n.createIm2ColProgramInfoLoader=(c,p,s,h,f)=>{const l=(o=f.cacheKey,{name:"Im2Col",inputNames:["X"],inputTypes:[u.TextureType.unpacked],cacheHint:o});var o;return Object.assign(Object.assign({},l),{get:()=>((t,e,r,i,d,g)=>{const m=r.dims,_=i.dims,y=d.length,w=(0,n.calculateIm2ColDims)(m,_,d,4),v=` - const int XC = ${m[1]}; - const int XH = ${m[2]}; - const int XW = ${m[3]}; - const int KH = ${g.kernelShape[0]}; - const int KW = ${g.kernelShape[1]}; - const int dilationH = ${g.dilations[0]}; - const int dilationW = ${g.dilations[1]}; - const int strideH = ${g.strides[0]}; - const int strideW = ${g.strides[1]}; - const int padH = ${g.pads[0]}; - const int padW = ${g.pads[1]}; - const int KHKW = KH*KW; - const int XCKHKW = XC * KHKW; - const int outputChannels = 4; - vec4 process(int indices[${y}]) { - int b = indices[0]; // batch size - int oh = indices[1] * strideH - padH; //output height - int ow = indices[2] * strideW - padW; //output width - int p = indices[3] * outputChannels; //patch - vec4 value = vec4(0.0); - for(int i=0; i < outputChannels; ++i) { - if(p < XCKHKW) { - int patchC = p / KHKW; - int patchH = (p - patchC*KHKW) / KW; - int patchW = (p - patchC*KHKW) - patchH * KW; - int xh2 = oh + patchH * dilationH; - int xw2 = ow + patchW * dilationW; - int x[${m.length}]; - x[0] = b; - x[1] = patchC; - x[2] = xh2; - x[3] = xw2; - if(xh2 >= 0 && - xh2 < XH && - xw2 >= 0 && - xw2 < XW) { - value[i] = _X(x); - } - } - ++p; - } - return value; - } - `;return Object.assign(Object.assign({},e),{output:{dims:w,type:r.type,textureType:u.TextureType.packedLastDimension},shaderSource:v})})(0,l,p,s,h,f)})},n.calculateIm2ColDims=(c,p,s,h=4)=>[s[0],s[2],s[3],Math.ceil(c[1]*p[2]*p[3]/h)]},6572:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseImageScalerAttributes=n.imageScaler=void 0;const u=a(246),c=a(2039);n.imageScaler=(l,o,t)=>(f(o),[l.run(s(l,o,t),o)]),n.parseImageScalerAttributes=l=>{const o=l.attributes.getFloat("scale"),t=l.attributes.getFloats("bias");return(0,u.createAttributeWithCacheKey)({scale:o,bias:t})};const p={name:"ImageScaler",inputNames:["X"],inputTypes:[c.TextureType.unpacked]},s=(l,o,t)=>{const e=Object.assign(Object.assign({},p),{cacheHint:t.cacheKey});return Object.assign(Object.assign({},e),{get:()=>((r,i,d,g)=>{const m=d[0].dims.slice(),_=m.length,y=` - ${h(g.bias.length)} - float process(int indices[${_}]) { - return _X(indices) * scale + getBias(bias, indices[1]); - }`;return Object.assign(Object.assign({},i),{output:{dims:m,type:d[0].type,textureType:c.TextureType.unpacked},variables:[{name:"bias",type:"float",arrayLength:g.bias.length,data:g.bias},{name:"scale",type:"float",data:g.scale}],shaderSource:y})})(0,e,o,t)})},h=l=>{const o=[`float getBias(float bias[${l}], int channel) {`];for(let t=0;t {if(!l||l.length!==1)throw new Error("ImageScaler requires 1 input.");if(l[0].dims.length!==4)throw new Error("Invalid input shape.");if(l[0].type!=="float32"&&l[0].type!=="float64")throw new Error("Invalid input type.")}},3346:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseInstanceNormalizationAttributes=n.instanceNormalization=void 0;const u=a(5060),c=a(2039);n.instanceNormalization=(o,t,e)=>{l(t);const r=o.run(s(t[0]),t);return[o.run(f(o,t[0],e,r.dims),[t[0],r,t[1],t[2]])]},n.parseInstanceNormalizationAttributes=o=>o.attributes.getFloat("epsilon",1e-5);const p={name:"InstanceNormalization_MeanAndVariance",inputNames:["X"],inputTypes:[c.TextureType.unpacked]},s=o=>Object.assign(Object.assign({},p),{get:()=>((t,e)=>{const r=e.dims.slice(),i=r[1],d=r[2]*r[3],g=[r[0],i],m=` - vec4 process(int[2] indices) { - vec4 v = vec4(0.0); - int a[4]; - a[0] = indices[0]; - a[1] = indices[1]; - float temp = 0.0; - for(int a2=0; a2<${r[2]}; a2++) { - a[2] = a2; - for(int a3=0; a3<${r[3]}; a3++) { - a[3] = a3; - float x = _X(a); - temp += x; - } - } - float mean = temp / float(${d}); - temp = 0.0; - for(int a2=0; a2<${r[2]}; a2++) { - a[2] = a2; - for(int a3=0; a3<${r[3]}; a3++) { - a[3] = a3; - float x = _X(a); - temp += (x - mean) * (x - mean); - } - } - v.r = mean; - v.g = temp / float(${d}); - - return v; - }`;return Object.assign(Object.assign({},t),{output:{dims:g,type:e.type,textureType:c.TextureType.packedLastDimension},shaderSource:m})})(p,o)}),h={name:"InstanceNormalization_ComputeOutput",inputNames:["X","MeanAndVariance","Scale","B"],inputTypes:[c.TextureType.unpacked,c.TextureType.packedLastDimension,c.TextureType.unpacked,c.TextureType.unpacked]},f=(o,t,e,r)=>{const i=Object.assign(Object.assign({},h),{cacheHint:`${e}`});return Object.assign(Object.assign({},i),{get:()=>((d,g,m,_,y)=>{const w=(0,u.getGlsl)(d.session.backend.glContext.version),[v,S]=d.calculateTextureWidthAndHeight(y,c.TextureType.packedLastDimension),[O,A]=[v/4,S],T=` - vec4 get_MeanAndVariance(int[2] mv) { - int offset = indicesToOffset_MeanAndVariance(mv); - vec2 coords = offsetToCoords(offset, ${O}, ${A}); - return ${w.texture2D}(MeanAndVariance, coords); - } - - float process(int[4] indices) { - int mv[2]; - mv[0] = indices[0]; - mv[1] = indices[1]; - vec4 mean_and_variance = get_MeanAndVariance(mv); - float mean = mean_and_variance.r; - float variance = mean_and_variance.g; - - int sb[1]; - sb[0] = indices[1]; - float scale = _Scale(sb); - float b = _B(sb); - - return scale * (_X(indices) - mean) / sqrt(variance + epsilon) + b; - }`;return Object.assign(Object.assign({},g),{output:{dims:m.dims,type:m.type,textureType:c.TextureType.unpacked},variables:[{name:"epsilon",type:"float",data:_}],shaderSource:T})})(o,i,t,e,r)})},l=o=>{if(!o||o.length!==3)throw new Error("InstanceNormalization requires 3 inputs.");const t=o[0],e=o[1],r=o[2];if(t.dims.length<3||e.dims.length!==1||r.dims.length!==1)throw new Error("Invalid input shape.");if(e.dims[0]!==t.dims[1]||r.dims[0]!==t.dims[1])throw new Error("Input shapes are mismatched.");if(t.type!=="float32"&&t.type!=="float64"||e.type!=="float32"&&e.type!=="float64"||r.type!=="float32"&&r.type!=="float64")throw new Error("Invalid input type.");if(o[0].dims.length!==4)throw new Error("Only support 4-D input shape.")}},708:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createPackedMatmulProgramInfoLoader=void 0;const u=a(2517),c=a(5060),p=a(2039),s=a(9390),h=a(2823),f=a(5623);n.createPackedMatmulProgramInfoLoader=(l,o,t)=>{const e=(r=o.length>2,i=t.activationCacheKey,{name:"MatMul (packed)",inputNames:r?["A","B","Bias"]:["A","B"],inputTypes:r?[p.TextureType.packed,p.TextureType.packed,p.TextureType.packed]:[p.TextureType.packed,p.TextureType.packed],cacheHint:i});var r,i;return Object.assign(Object.assign({},e),{get:()=>((d,g,m,_)=>{const y=m.length>2,w=y?"value += getBiasForMatmul();":"",v=m[0].dims,S=m[1].dims,O=u.BroadcastUtil.calcShape(v,S,!0),A=!u.ShapeUtil.areEqual(m[0].dims,m[1].dims);if(!O)throw new Error("Can't use matmul on the given tensors");const T=v[v.length-1],M=Math.ceil(T/2),N=v.length,B=S.length,$=(0,c.getGlsl)(d.session.backend.glContext.version),L=(0,s.getCoordsDataType)(O.length),H=O.length,C=(0,s.getGlChannels)(),{activationFunction:z,applyActivation:J}=(0,h.getActivationSnippet)(_),X=y?`${(0,f.getBiasForMatmul)(L,C,m[2].dims,O,!0)}`:"",te=A?`${function(Oe,ce,Te,ye){let Fe=[],He=[];const Ae=Te[0].dims,Ne=Te[1].dims,De=Ae.length,Pe=Ne.length,ve=ye.length,Be=ve-De,Ue=ve-Pe;Fe=Ae.map((Se,$e)=>`coords.${ce[$e+Be]}`),Fe[De-1]="i*2",Fe.join(", "),He=Ne.map((Se,$e)=>`coords.${ce[$e+Ue]}`),He[Pe-2]="i*2",He.join(", ");const Ve=u.BroadcastUtil.getBroadcastDims(Ae,ye),Xe=u.BroadcastUtil.getBroadcastDims(Ne,ye),Qe=Ve.map(Se=>`coords.${ce[Se+Be]} = 0;`).join(` -`),Ge=Xe.map(Se=>`coords.${ce[Se+Ue]} = 0;`).join(` -`),ze=`int lastDim = coords.${ce[ve-1]}; - coords.${ce[ve-1]} = coords.${ce[ve-2]}; - coords.${ce[ve-2]} = lastDim;`;return` -vec4 getAAtOutCoordsMatmul(int i) { - ${Oe} coords = getOutputCoords(); - ${ze} - ${Qe} - vec4 outputValue = getA(${Fe}); - return outputValue; -} - -vec4 getBAtOutCoordsMatmul(int i) { - ${Oe} coords = getOutputCoords(); - ${ze} - ${Ge} - vec4 outputValue = getB(${He}); - return outputValue; -}`}(L,C,m,O)}`:"",ne=A?"getAAtOutCoordsMatmul(i)":`getA(${function(Oe,ce){let Te="";for(let ye=0;ye {Object.defineProperty(n,"__esModule",{value:!0}),n.getBiasForMatmul=n.createMatmulProgramInfoLoader=n.parseMatMulAttributes=n.matMul=void 0;const u=a(2517),c=a(2039),p=a(9390),s=a(2823),h=a(708);function f(t,e){const r=(i=t.length>2,d=e.activationCacheKey,{name:"MatMul",inputNames:i?["A","B","Bias"]:["A","B"],inputTypes:i?[c.TextureType.unpacked,c.TextureType.unpacked,c.TextureType.unpacked]:[c.TextureType.unpacked,c.TextureType.unpacked],cacheHint:d});var i,d;return Object.assign(Object.assign({},r),{get:()=>function(g,m,_){const y=m[0].dims,w=m[1].dims,v=u.BroadcastUtil.calcShape(y,w,!0);if(!v)throw new Error("Can't use matmul on the given tensors");const S=(0,p.getCoordsDataType)(v.length),O=(0,p.getGlChannels)(),{activationFunction:A,applyActivation:T}=(0,s.getActivationSnippet)(_),M=m.length>2,N=M?"value += getBiasForMatmul();":"",B=M?`${o(S,O,m[2].dims,v,!1)}`:"",$=v.length,L=y.length,H=w.length,C=` - ${A} - ${B} - float process(int indices[${$}]) { - int a[${L}]; - int b[${H}]; - bcastMatmulIndices_A(indices, a); - bcastMatmulIndices_B(indices, b); - - float value; - for (int k=0; k<${y[y.length-1]}; ++k) { - a[${L-1}] = k; - b[${H-2}] = k; - value += _A(a) * _B(b); - } - ${N} - ${T} - return value; - }`;return Object.assign(Object.assign({},g),{output:{dims:v,type:m[0].type,textureType:c.TextureType.unpacked},shaderSource:C})}(r,t,e)})}n.matMul=(t,e,r)=>(l(e),t.session.pack?[t.run((0,h.createPackedMatmulProgramInfoLoader)(t,e,r),e)]:[t.run(f(e,r),e)]),n.parseMatMulAttributes=t=>(0,s.parseInternalActivationAttributes)(t.attributes),n.createMatmulProgramInfoLoader=f;const l=t=>{if(!t||t.length!==2)throw new Error("MatMul requires 2 inputs.");if(t[0].dims[t[0].dims.length-1]!==t[1].dims[t[1].dims.length-2])throw new Error("shared dimension does not match.");if(t[0].type!=="float32"&&t[0].type!=="float64"||t[1].type!=="float32"&&t[1].type!=="float64")throw new Error("inputs should be float type");if(t[0].type!==t[1].type)throw new Error("inputs types should match")};function o(t,e,r,i,d){let g="";const m=r.length,_=i.length,y=_-m;g=_<2&&m>0?"coords":r.map((S,O)=>`coords.${e[O+y]}`).join(", ");const w=u.BroadcastUtil.getBroadcastDims(r,i).map(S=>`coords.${e[S+y]} = 0;`).join(` -`);let v="vec4(outputValue.xx, outputValue.yy)";return u.ShapeUtil.size(r)===1&&(v="vec4(outputValue.x)"),d?` -vec4 getBiasForMatmul() { - ${t} coords = getOutputCoords(); - ${w} - vec4 outputValue = getBias(${g}); - return ${v}; -}`:` -float getBiasForMatmul() { - ${t} coords = getOutputCoords(); - ${w} - return getBias(coords.x); -}`}n.getBiasForMatmul=o},2403:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createPackProgramInfoLoader=void 0;const u=a(5060),c=a(2039),p=a(9390),s=a(2827),h={name:"pack",inputNames:["A"],inputTypes:[c.TextureType.unpackedReversed]};n.createPackProgramInfoLoader=(f,l)=>Object.assign(Object.assign({},h),{get:()=>((o,t)=>{const e=(0,u.getGlsl)(o.session.backend.glContext.version),r=t.dims,i=r.length,d=t.dims.length,g=(0,p.getCoordsDataType)(d),m=(0,s.getChannels)("rc",d),_=(y=d,w=m,v=r[r.length-2],S=r[r.length-1],y===0||y===1?"":` - int r = ${w[y-2]}; - int c = ${w[y-1]}; - int rp1 = ${w[y-2]} + 1; - int cp1 = ${w[y-1]} + 1; - bool rEdge = rp1 >= ${S}; - bool cEdge = cp1 >= ${v}; - `);var y,w,v,S;let O;O=i===0?[1,1]:i===1?[r[0],1]:[r[d-1],r[d-2]];const A=function(N,B,$){if(N===0)return"false";if(N===1)return`rc > ${B[0]}`;let L="";for(let H=N-2;H = ${B[H-N+2]}`,H = ${N[0]} ? 0. : getA(rc + 1), - 0, 0`;let L="";if($>2)for(let H=0;H<$-2;++H)L+=`${B[H]},`;return`getA(${L}r, c), - rEdge ? 0. : getA(${L}rp1, c), - cEdge ? 0. : getA(${L}r, cp1), - rEdge || cEdge ? 0. : getA(${L}rp1, cp1)`}(r,m),M=` - void main() { - ${g} rc = getOutputCoords(); - - if(${A}) { - ${e.output} = vec4(0); - } else { - ${_} - - ${e.output} = vec4(${T}); - } - } - `;return Object.assign(Object.assign({},h),{hasMain:!0,output:{dims:t.dims,type:t.type,textureType:c.TextureType.packed},shaderSource:M})})(f,l)})},2827:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.unpackFromChannel=n.getChannels=n.getVecChannels=void 0;const u=a(9390);function c(p,s){return(0,u.getGlChannels)(s).map(h=>`${p}.${h}`)}n.getVecChannels=c,n.getChannels=function(p,s){return s===1?[p]:c(p,s)},n.unpackFromChannel=function(){return` - float getChannel(vec4 frag, int dim) { - int modCoord = imod(dim, 2); - return modCoord == 0 ? frag.r : frag.g; - } - - float getChannel(vec4 frag, vec2 innerDims) { - vec2 modCoord = mod(innerDims, 2.); - return modCoord.x == 0. ? - (modCoord.y == 0. ? frag.r : frag.g) : - (modCoord.y == 0. ? frag.b : frag.a); - } - `}},2870:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parsePadAttributesV11=n.padV11=n.parsePadAttributesV2=n.padV2=void 0;const u=a(246),c=a(2517),p=a(5060),s=a(2039),h={name:"Pad",inputNames:["A"],inputTypes:[s.TextureType.unpacked]};n.padV2=(g,m,_)=>(o(m),[g.run(Object.assign(Object.assign({},h),{cacheHint:_.cacheKey,get:()=>l(g,m[0],_)}),m)]),n.parsePadAttributesV2=g=>{const m=g.attributes.getString("mode","constant"),_=g.attributes.getFloat("value",0),y=g.attributes.getInts("pads");return(0,u.createAttributeWithCacheKey)({mode:m,value:_,pads:y})},n.padV11=(g,m,_)=>{t(m);const y=f(g,m,_);return(0,n.padV2)(g,[m[0]],y)},n.parsePadAttributesV11=g=>g.attributes.getString("mode","constant");const f=(g,m,_)=>{if(!g.session.isInitializer(m[1].dataId)||m.length>=3&&!g.session.isInitializer(m[2].dataId))throw new Error("dynamic pad attributes are not allowed");const y=Array.from(m[1].integerData),w=m.length>=3?m[2].floatData[0]:0;return(0,u.createAttributeWithCacheKey)({mode:_,pads:y,value:w})},l=(g,m,_)=>{const y=c.ShapeUtil.padShape(m.dims.slice(),_.pads),w=y.length,v=` - ${e(g,m,_)} - float process(int[${w}] indices) { - return padA(indices); - }`;return{name:"Pad",inputNames:["A"],inputTypes:[s.TextureType.unpacked],output:{dims:y,type:m.type,textureType:s.TextureType.unpacked},shaderSource:v}},o=g=>{if(!g||g.length!==1)throw new Error("Pad requires 1 input");if(g[0].type!=="float32"&&g[0].type!=="float64")throw new Error("Invalid input type.")},t=g=>{if(!g||g.length!==2&&g.length!==3)throw new Error("Pad requires 2 or 3 inputs");if(g[1].type!=="int32")throw new Error("Invalid input type.");if(g.length>=3&&g[2].type==="string")throw new Error("Invalid input type.")},e=(g,m,_)=>{const y=(0,p.getGlsl)(g.session.backend.glContext.version),[w,v]=g.calculateTextureWidthAndHeight(m.dims,s.TextureType.unpacked),S=c.ShapeUtil.computeStrides(m.dims);switch(_.mode){case"constant":return r(y,m.dims,S,w,v,_.pads,_.value);case"reflect":return i(y,m.dims,S,w,v,_.pads);case"edge":return d(y,m.dims,S,w,v,_.pads);default:throw new Error("Invalid mode")}},r=(g,m,_,y,w,v,S)=>{const O=m.length;let A="";for(let T=O-1;T>=0;--T)A+=` - k = m[${T}] - ${v[T]}; - if (k < 0) return constant; - if (k >= ${m[T]}) return constant; - offset += k * ${_[T]}; - `;return` - float padA(int m[${O}]) { - const float constant = float(${S}); - int offset = 0; - int k = 0; - ${A} - vec2 coords = offsetToCoords(offset, ${y}, ${w}); - float value = getColorAsFloat(${g.texture2D}(A, coords)); - return value; - } - `},i=(g,m,_,y,w,v)=>{const S=m.length;let O="";for(let A=S-1;A>=0;--A)O+=` - k = m[${A}] - ${v[A]}; - if (k < 0) { k = -k; } - { - const int _2n_1 = ${2*(m[A]-1)}; - k = int( mod( float(k), float(_2n_1) ) ) ; - if(k >= ${m[A]}) { k = _2n_1 - k; } - } - offset += k * ${_[A]}; - `;return` - float padA(int m[${S}]) { - int offset = 0; - int k = 0; - ${O} - vec2 coords = offsetToCoords(offset, ${y}, ${w}); - float value = getColorAsFloat(${g.texture2D}(A, coords)); - return value; - } - `},d=(g,m,_,y,w,v)=>{const S=m.length;let O="";for(let A=S-1;A>=0;--A)O+=` - k = m[${A}] - ${v[A]}; - if (k < 0) k = 0; - if (k >= ${m[A]}) k = ${m[A]-1}; - offset += k * ${_[A]}; - `;return` - float padA(int m[${S}]) { - int offset = 0; - int k = 0; - ${O} - vec2 coords = offsetToCoords(offset, ${y}, ${w}); - float value = getColorAsFloat(${g.texture2D}(A, coords)); - return value; - } - `}},2143:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.globalMaxPool=n.parseMaxPoolAttributes=n.maxPool=n.parseGlobalAveragePoolAttributes=n.globalAveragePool=n.parseAveragePoolAttributes=n.averagePool=void 0;const u=a(246),c=a(2517),p=a(2039);n.averagePool=(d,g,m)=>{t(g);const _={name:"AveragePool",inputNames:["X"],inputTypes:[p.TextureType.unpacked],cacheHint:m.cacheKey};return[d.run(Object.assign(Object.assign({},_),{get:()=>s(g,_,!1,m)}),g)]},n.parseAveragePoolAttributes=d=>{const g=d.attributes.getString("auto_pad","NOTSET"),m=d.attributes.getInt("ceil_mode",0),_=d.attributes.getInt("count_include_pad",0)!==0,y=d.attributes.getInts("kernel_shape"),w=d.attributes.getInts("strides",[]),v=d.attributes.getInts("pads",[]);if(m!==0)throw new Error("using ceil() in shape computation is not yet supported for AveragePool");return(0,u.createAttributeWithCacheKey)({autoPad:g,ceilMode:m,countIncludePad:_,kernelShape:y,strides:w,pads:v})};const s=(d,g,m,_)=>{const[y,w]=f(d,_,m),v=c.ShapeUtil.size(y.kernelShape);let S="";y.countIncludePad?S+=`value /= float(${v});`:S+=`value /= float(${v} - pad);`;const O=` - ${e(d[0].dims,y,"value += _X(x);",S,"0.0")} - `;return Object.assign(Object.assign({},g),{output:{dims:w,type:d[0].type,textureType:p.TextureType.unpacked},shaderSource:O})};n.globalAveragePool=(d,g,m)=>{t(g);const _={name:"GlobalAveragePool",inputNames:["X"],inputTypes:[p.TextureType.unpacked],cacheHint:`${m.countIncludePad}`};return[d.run(Object.assign(Object.assign({},_),{get:()=>s(g,_,!0,m)}),g)]},n.parseGlobalAveragePoolAttributes=d=>{const g=d.attributes.getInt("count_include_pad",0)!==0;return(0,u.createAttributeWithCacheKey)({autoPad:"",ceilMode:0,countIncludePad:g,kernelShape:[],strides:[],pads:[]})},n.maxPool=(d,g,m)=>{t(g);const _={name:"MaxPool",inputNames:["X"],inputTypes:[p.TextureType.unpacked],cacheHint:m.cacheKey};return[d.run(Object.assign(Object.assign({},_),{get:()=>h(g,_,!1,m)}),g)]},n.parseMaxPoolAttributes=d=>{const g=d.attributes.getString("auto_pad","NOTSET"),m=d.attributes.getInt("ceil_mode",0),_=d.attributes.getInts("kernel_shape"),y=d.attributes.getInts("strides",[]),w=d.attributes.getInts("pads",[]),v=d.attributes.getInt("storage_order",0),S=d.attributes.getInts("dilations",[]);if(v!==0)throw new Error("column major storage order is not yet supported for MaxPool");if(m!==0)throw new Error("using ceil() in shape computation is not yet supported for MaxPool");return(0,u.createAttributeWithCacheKey)({autoPad:g,ceilMode:m,countIncludePad:!1,kernelShape:_,strides:y,pads:w,storageOrder:v,dilations:S})};const h=(d,g,m,_)=>{const[y,w]=f(d,_,m),v=` - ${e(d[0].dims,y,` - value = max(_X(x), value); - `,"","-1e5")} - `;return Object.assign(Object.assign({},g),{output:{dims:w,type:d[0].type,textureType:p.TextureType.unpacked},shaderSource:v})},f=(d,g,m)=>{const _=d[0].dims.slice(),y=Object.hasOwnProperty.call(g,"dilations"),w=g.kernelShape.slice(),v=g.strides.slice(),S=y?g.dilations.slice():[],O=g.pads.slice();c.PoolConvUtil.adjustPoolAttributes(m,_,w,v,S,O);const A=c.PoolConvUtil.computePoolOutputShape(m,_,v,S,w,O,g.autoPad),T=Object.assign({},g);return y?Object.assign(T,{kernelShape:w,strides:v,pads:O,dilations:S,cacheKey:g.cacheKey}):Object.assign(T,{kernelShape:w,strides:v,pads:O,cacheKey:g.cacheKey}),[T,A]},l={autoPad:"",ceilMode:0,countIncludePad:!1,kernelShape:[],strides:[],pads:[],storageOrder:0,dilations:[],cacheKey:""},o={name:"GlobalMaxPool",inputNames:["X"],inputTypes:[p.TextureType.unpacked]};n.globalMaxPool=(d,g)=>(t(g),[d.run(Object.assign(Object.assign({},o),{get:()=>h(g,o,!0,l)}),g)]);const t=d=>{if(!d||d.length!==1)throw new Error("Pool ops requires 1 input.");if(d[0].type!=="float32"&&d[0].type!=="float64")throw new Error("Invalid input type.")},e=(d,g,m,_,y)=>{const w=d.length;if(g.kernelShape.length<=2){const v=g.kernelShape[g.kernelShape.length-1],S=g.strides[g.strides.length-1],O=g.pads[g.pads.length/2-1],A=g.pads[g.pads.length-1],T=d[w-1];let M="",N="",B="";if(M=O+A!==0?` - for (int i = 0; i < ${v}; i++) { - x[${w} - 1] = indices[${w} - 1] * ${S} - ${O} + i; - if (x[${w} - 1] < 0 || x[${w} - 1] >= ${T}) { - pad++; - continue; - } - ${m} - }`:` - for (int i = 0; i < ${v}; i++) { - x[${w} - 1] = indices[${w} - 1] * ${S} - ${O} + i; - ${m} - }`,g.kernelShape.length===2){const $=g.kernelShape[g.kernelShape.length-2],L=g.strides[g.strides.length-2],H=g.pads[g.pads.length/2-2],C=g.pads[g.pads.length-2],z=d[w-2];N=H+C!==0?` - for (int j = 0; j < ${$}; j++) { - x[${w} - 2] = indices[${w} - 2] * ${L} - ${H} + j; - if (x[${w} - 2] < 0 || x[${w} - 2] >= ${z}) { - pad+= ${v}; - continue; - } - `:` - for (int j = 0; j < ${$}; j++) { - x[${w} - 2] = indices[${w} - 2] * ${L} - ${H} + j; - `,B=` - } - `}return` - float process(int indices[${w}]) { - int x[${w}]; - copyVec(indices, x); - - float value = ${y}; - int pad = 0; - ${N} - ${M} - ${B} - ${_} - return value; - } - `}{const v=c.ShapeUtil.size(g.kernelShape),S=c.ShapeUtil.computeStrides(g.kernelShape),O=S.length,A=g.pads.length,T=i(O),M=r(d,"inputDims"),N=r(g.pads,"pads"),B=r(S,"kernelStrides"),$=r(g.strides,"strides");let L="";return L=g.pads.reduce((H,C)=>H+C)?` - if (x[j] >= inputDims[j] || x[j] < 0) { - pad++; - isPad = true; - break; - } - } - if (!isPad) { - ${m} - }`:` - } - ${m} - `,` - ${T} - float process(int indices[${w}]) { - int x[${w}]; - copyVec(indices, x); - int offset[${O}]; - int pads[${A}]; - int inputDims[${w}]; - int kernelStrides[${O}]; - int strides[${O}]; - ${N} - ${M} - ${$} - ${B} - - float value = ${y}; - int pad = 0; - bool isPad = false; - for (int i = 0; i < ${v}; i++) { - offsetToIndices(i, kernelStrides, offset); - isPad = false; - for (int j = ${w} - ${O}; j < ${w}; j++) { - x[j] = indices[j] * strides[j - ${w} + ${O}] - + offset[j - ${w} + ${O}] - pads[j - 2]; - ${L} - } - ${_} - - return value; - } - `}},r=(d,g)=>{let m="";for(let _=0;_ ` - void offsetToIndices(int offset, int[${d}] strides, out int[${d}] indices) { - if (${d} == 0) { - return; - } - for (int i = 0; i < ${d} - 1; ++i) { - indices[i] = offset / strides[i]; - offset -= indices[i] * strides[i]; - } - indices[${d} - 1] = offset; - }`},4939:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.reduceLogSumSquare=n.reduceLogSum=n.reduceProd=n.reduceMin=n.reduceMax=n.reduceMean=n.reduceSum=n.parseReduceAttributes=void 0;const u=a(246),c=a(782),p=a(2517),s=a(2039),h=(o,t,e,r,i)=>{l(t);const d={name:r,inputNames:["A"],inputTypes:[s.TextureType.unpacked]};return[o.run(Object.assign(Object.assign({},d),{cacheHint:e.cacheKey,get:()=>f(o,t,e,r,i,d)}),t)]};n.parseReduceAttributes=o=>{const t=o.attributes.getInts("axes",[]),e=o.attributes.getInt("keepdims",1)===1;return(0,u.createAttributeWithCacheKey)({axes:t,keepDims:e})};const f=(o,t,e,r,i,d)=>{const g=[],m=t[0].dims.length||1,_=[],y=p.ShapeUtil.normalizeAxes(e.axes,t[0].dims.length),w=i(t,y);let v=w[1];for(let O=0;O =0||y.length===0?(e.keepDims&&g.push(1),v=` - for(int j${O} = 0; j${O} < ${t[0].dims[O]}; j${O}++) { - inputIdx[${O}] = j${O}; - ${v} - }`):(_.push(`inputIdx[${O}] = outputIdx[${g.length}];`),g.push(t[0].dims[O]));const S=` - float process(int outputIdx[${g.length||1}]) { - float value; // final result - int inputIdx[${m}]; // addressing input data - ${_.join(` -`)} - ${w[0]} // init ops for reduce max/min - ${v} - ${w[2]} // final computation for reduce mean - return value; - }`;return Object.assign(Object.assign({},d),{output:{dims:g,type:t[0].type,textureType:s.TextureType.unpacked},shaderSource:S})},l=o=>{if(!o||o.length!==1)throw new Error("Reduce op requires 1 input.");if(c.NUMBER_TYPES.indexOf(o[0].type)===-1)throw new Error("Invalid input type.")};n.reduceSum=(o,t,e)=>h(o,t,e,"ReduceSum",()=>["value = 0.0;","value += _A(inputIdx);",""]),n.reduceMean=(o,t,e)=>h(o,t,e,"ReduceMean",(r,i)=>{let d=1;for(let g=0;g =0||i.length===0)&&(d*=r[0].dims[g]);return["value = 0.0;","value += _A(inputIdx);",`value /= ${d}.;`]}),n.reduceMax=(o,t,e)=>h(o,t,e,"ReduceMax",(r,i)=>{const d=[];for(let g=0;g =0||i.length===0)&&d.push(`inputIdx[${g}] = 0;`);return[`${d.join(` -`)} -value = _A(inputIdx);`,"value = max(value, _A(inputIdx));",""]}),n.reduceMin=(o,t,e)=>h(o,t,e,"ReduceMin",(r,i)=>{const d=[];for(let g=0;g =0||i.length===0)&&d.push(`inputIdx[${g}] = 0;`);return[`${d.join(` -`)} -value = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]}),n.reduceProd=(o,t,e)=>h(o,t,e,"ReduceProd",()=>["value = 1.0;","value *= _A(inputIdx);",""]),n.reduceLogSum=(o,t,e)=>h(o,t,e,"ReduceLogSum",()=>["value = 0.0;","value += _A(inputIdx);","value = log(value);"]),n.reduceLogSumSquare=(o,t,e)=>h(o,t,e,"ReduceLogSumSquare",()=>["float t; value = 0.0;","t = _A(inputIdx); value += t * t;",""])},7019:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.isReshapeCheap=n.processDims3D=n.createPackedReshape3DProgramInfoLoader=void 0;const u=a(2517),c=a(5060),p=a(2039),s=a(2827);n.createPackedReshape3DProgramInfoLoader=(h,f,l)=>{const o=(t=>({name:"Reshape (packed)",inputTypes:[p.TextureType.packed],inputNames:["A"],cacheHint:`${t}`}))(l);return Object.assign(Object.assign({},o),{get:()=>((t,e,r,i)=>{const d=e.dims,g=i;let m="";for(let w=0;w<4;w++){let v="";switch(w){case 0:v="outputCoords = rc;";break;case 1:v="outputCoords = ivec3(rc.x, rc.y+1, rc.z);";break;case 2:v="outputCoords = ivec3(rc.x, rc.y, rc.z+1);";break;case 3:v="outputCoords = ivec3(rc.x, rc.y+1, rc.z+1);";break;default:throw new Error}m+=` - ${v} - ${w>0?"if(outputCoords.y < rows && outputCoords.z < cols){":""} - int flattenedIndex = getFlattenedIndex(outputCoords); - - ivec3 inputRC = inputCoordsFromReshapedOutCoords(flattenedIndex); - vec2 innerDims = vec2(float(inputRC.y),float(inputRC.z)); - - result[${w}] = getChannel(getA(inputRC.x, inputRC.y, inputRC.z), innerDims); - - ${w>0?"}":""} - `}const _=(0,c.getGlsl)(t.session.backend.glContext.version),y=` - ${function(w){const v=u.ShapeUtil.computeStrides(w),S=["b","r","c"],O="index";return` - ivec3 inputCoordsFromReshapedOutCoords(int index) { - ${v.map((A,T)=>`int ${S[T]} = ${O} / ${A}; ${T===v.length-1?`int ${S[T+1]} = ${O} - ${S[T]} * ${A}`:`index -= ${S[T]} * ${A}`};`).join("")} - return ivec3(b, r, c); - } - `}(d)} - ${function(w){const v=u.ShapeUtil.computeStrides(w);return` - int getFlattenedIndex(ivec3 coords) { - // reverse y, z order - return coords.x * ${v[0]} + coords.z * ${v[1]} + coords.y; - } -`}(g)} - ${(0,s.unpackFromChannel)()} - - void main() { - ivec3 rc = getOutputCoords(); - - vec4 result = vec4(0.0); - - ivec3 outputCoords; - int rows = ${g[2]}; - int cols = ${g[1]}; - - ${m} - ${_.output} = result; - } - `;return Object.assign(Object.assign({},r),{output:{dims:g,type:e.type,textureType:p.TextureType.packed},shaderSource:y,hasMain:!0})})(h,f,o,l)})},n.processDims3D=function(h){if(h.length===0)return[1,1,1];let f=1;for(let l=0;l 1?h[h.length-2]:1,h[h.length-1]]},n.isReshapeCheap=function(h,f){let l=!1;return l=h.length===0||f.length===0||(h.length<2||f.length<2?h[h.length-1]===f[f.length-1]:h[h.length-1]===f[f.length-1]&&h[h.length-2]===f[f.length-2]),l}},718:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.reshape=void 0;const u=a(2517);n.reshape=(c,p)=>{const s=u.ShapeUtil.calculateReshapedDims(p[0].dims,p[1].integerData);return c.session.pack?[c.reshapePacked(p[0],s)]:[c.reshapeUnpacked(p[0],s)]}},2268:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseResizeAttributesV11=n.parseResizeAttributesV10=n.resize=void 0;const u=a(5060),c=a(2039),p=a(9390),s=a(2827),h=a(9793),f={name:"Resize",inputNames:["A"],inputTypes:[c.TextureType.packed]};n.resize=(r,i,d)=>((0,h.validateInputs)(i,d),[r.run(Object.assign(Object.assign({},f),{cacheHint:d.cacheKey,get:()=>l(r,i,d)}),i)]),n.parseResizeAttributesV10=r=>(0,h.parseUpsampleAttributes)(r,10),n.parseResizeAttributesV11=r=>(0,h.parseUpsampleAttributes)(r,11);const l=(r,i,d)=>{const g=(0,u.getGlsl)(r.session.backend.glContext.version),[m,_]=o(i,d);if(m.every(L=>L===1)&&d.coordinateTransformMode!=="tf_crop_and_resize")return Object.assign(Object.assign({},f),{output:{dims:_,type:i[0].type,textureType:c.TextureType.packed},hasMain:!0,shaderSource:`void main() { - vec4 v = ${g.texture2D}(X, TexCoords); - ${g.output} = v; - }`});const y=_.length;if(y<2)throw new Error(`output dimension should be at least 2, but got ${y}`);const w=_[y-2],v=_[y-1],S=i[0].dims;if(y!==S.length)throw new Error(`output dimension should match input ${S.length}, but got ${y}`);const O=S[y-2],A=S[y-1],T=m[y-2],M=m[y-1];let N="";if(d.mode!=="linear")throw new Error(`resize (packed) does not support mode: '${d.mode}'`);switch(d.coordinateTransformMode){case"asymmetric":N=` - vec4 getSourceFracIndex(ivec4 coords) { - return vec4(coords) / scaleWHWH; - } - `;break;case"half_pixel":N=` - vec4 getSourceFracIndex(ivec4 coords) { - return (vec4(coords) + 0.5) / scaleWHWH - 0.5; - } - `;break;case"pytorch_half_pixel":N=` - vec4 getSourceFracIndex(ivec4 coords) { - vec4 fcoords = vec4(coords); - return vec4( - ${v}.0 > 1.0 ? (fcoords.x + 0.5) / scaleWHWH.x - 0.5 : 0.0, - ${w}.0 > 1.0 ? (fcoords.y + 0.5) / scaleWHWH.y - 0.5 : 0.0, - ${v}.0 > 1.0 ? (fcoords.z + 0.5) / scaleWHWH.z - 0.5 : 0.0, - ${w}.0 > 1.0 ? (fcoords.w + 0.5) / scaleWHWH.w - 0.5 : 0.0 - ); - } - `;break;case"align_corners":N=` - vec4 getSourceFracIndex(ivec4 coords) { - vec4 resized = vec4(${v}.0 - 1.0, ${w}.0 - 1.0, ${v}.0 - 1.0, - ${w}.0 - 1.0); - vec4 original = vec4(${A}.0 - 1.0, ${O}.0 - 1.0, ${A}.0 - 1.0, - ${O}.0 - 1.0); - vec4 new_scale = original / resized; - return vec4(coords) * new_scale; - } - `;break;default:throw new Error(`resize (packed) does not support coordinateTransformMode: '${d.coordinateTransformMode}'`)}const B=(0,p.getCoordsDataType)(y),$=` - const vec2 inputWH = vec2(${O}.0, ${A}.0); - const vec4 scaleWHWH = vec4(float(${T}), float(${M}), float(${T}), float(${M})); - ${(0,s.unpackFromChannel)()} - ${N} - float getAValue(int x10, int r, int c, int d) { - return getChannel(getA(x10, r, c, d), vec2(c, d)); - } - void main() { - ${B} rc = getOutputCoords(); - - int batch = rc[0]; - int depth = rc[1]; - - // retrieve the 4 coordinates that is used in the 4 packed output values. - ivec4 coords = ivec4(rc.wz, rc.w + 1, rc.z + 1); - - // calculate the source index in fraction - vec4 sourceFrac = getSourceFracIndex(coords); - - // get the lower and upper bound of the 4 values that will be packed into one texel. - ivec4 x00 = ivec4(max(sourceFrac.xy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xy))); - ivec4 x01 = ivec4(max(sourceFrac.xw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xw))); - ivec4 x10 = ivec4(max(sourceFrac.zy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zy))); - ivec4 x11 = ivec4(max(sourceFrac.zw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zw))); - - bool hasNextRow = rc.w < ${w-1}; - bool hasNextCol = rc.z < ${v-1}; - - // pack x00, x01, x10, x11's top-left corner into one vec4 structure - vec4 topLeft = vec4( - getAValue(batch, depth, x00.x, x00.y), - hasNextCol ? getAValue(batch, depth, x01.x, x01.y) : 0.0, - hasNextRow ? getAValue(batch, depth, x10.x, x10.y) : 0.0, - (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.y) : 0.0); - - // pack x00, x01, x10, x11's top-right corner into one vec4 structure - vec4 topRight = vec4( - getAValue(batch, depth, x00.x, x00.w), - hasNextCol ? getAValue(batch, depth, x01.x, x01.w) : 0.0, - hasNextRow ? getAValue(batch, depth, x10.x, x10.w) : 0.0, - (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.w) : 0.0); - - // pack x00, x01, x10, x11's bottom-left corner into one vec4 structure - vec4 bottomLeft = vec4( - getAValue(batch, depth, x00.z, x00.y), - hasNextCol ? getAValue(batch, depth, x01.z, x01.y) : 0.0, - hasNextRow ? getAValue(batch, depth, x10.z, x10.y) : 0.0, - (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.y) : 0.0); - - // pack x00, x01, x10, x11's bottom-right corner into one vec4 structure - vec4 bottomRight = vec4( - getAValue(batch, depth, x00.z, x00.w), - hasNextCol ? getAValue(batch, depth, x01.z, x01.w) : 0.0, - hasNextRow ? getAValue(batch, depth, x10.z, x10.w) : 0.0, - (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.w) : 0.0); - - // calculate the interpolation fraction on u and v direction - vec4 frac = vec4(sourceFrac) - floor(sourceFrac); - vec4 clampFrac = clamp(frac, vec4(0.0), vec4(1.0)); - - vec4 top = mix(topLeft, topRight, clampFrac.ywyw); - vec4 bottom = mix(bottomLeft, bottomRight, clampFrac.ywyw); - vec4 newValue = mix(top, bottom, clampFrac.xxzz); - - ${g.output} = vec4(newValue); - } - `;return Object.assign(Object.assign({},f),{output:{dims:_,type:i[0].type,textureType:c.TextureType.packed},hasMain:!0,shaderSource:$})},o=(r,i)=>{const d=r[0].dims;let g,m=i.scales;if(m.length===0){const y=r[i.scalesInputIdx];if(y&&y.size!==0){if(r[i.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");m=t(y,i.mode,i.isResize)}else{const w=r[i.sizesInputIdx];if(!w||w.size===0)throw new Error("Either scales or sizes MUST be provided as input.");g=Array.from(w.integerData),m=e(g,d,i.mode,i.isResize)}}else if(r[i.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");const _=g||d.map((y,w)=>Math.floor(y*m[w]));return[m,_]},t=(r,i,d)=>{const g=Array.from(r.floatData);return(0,h.scalesValidation)(g,i,d),g},e=(r,i,d,g)=>{const m=i.length,_=new Array(m);for(let y=0,w=m;y {Object.defineProperty(n,"__esModule",{value:!0}),n.shape=void 0;const u=a(9162);n.shape=(p,s)=>(c(s),[new u.Tensor([s[0].dims.length],"int32",void 0,void 0,new Int32Array(s[0].dims))]);const c=p=>{if(!p||p.length!==1)throw new Error("Shape requires 1 input.")}},2278:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.sliceV10=n.parseSliceAttributes=n.slice=void 0;const u=a(246),c=a(782),p=a(2517),s=a(2039),h={name:"Slice",inputNames:["A"],inputTypes:[s.TextureType.unpacked]};n.slice=(e,r,i)=>(l(r),[e.run(Object.assign(Object.assign({},h),{cacheHint:i.cacheKey,get:()=>f(e,r[0],i)}),r)]),n.parseSliceAttributes=e=>{const r=e.attributes.getInts("starts"),i=e.attributes.getInts("ends"),d=e.attributes.getInts("axes",[]);return(0,u.createAttributeWithCacheKey)({starts:r,ends:i,axes:d})};const f=(e,r,i)=>{const d=i.axes.length===0?r.dims.slice(0).map((S,O)=>O):i.axes,g=p.ShapeUtil.normalizeAxes(d,r.dims.length),m=i.starts.map((S,O)=>S>r.dims[g[O]]-1?r.dims[g[O]]:p.ShapeUtil.normalizeAxis(S,r.dims[g[O]])),_=i.ends.map((S,O)=>S>r.dims[g[O]]-1?r.dims[g[O]]:p.ShapeUtil.normalizeAxis(S,r.dims[g[O]])),y=r.dims.slice(),w=[];for(let S=0;S 0&&w.push(`outputIdx[${g[S]}] += ${m[S]};`);const v=` - float process(int outputIdx[${y.length}]) { - ${w.join(` - `)} - return _A(outputIdx); - }`;return Object.assign(Object.assign({},h),{output:{dims:y,type:r.type,textureType:s.TextureType.unpacked},shaderSource:v})},l=e=>{if(!e||e.length!==1)throw new Error("Slice requires 1 input.");if(c.NUMBER_TYPES.indexOf(e[0].type)===-1)throw new Error("Invalid input type.")};n.sliceV10=(e,r)=>{t(r);const i=o(e,r);return[e.run(Object.assign(Object.assign({},h),{cacheHint:i.cacheKey,get:()=>f(e,r[0],i)}),[r[0]])]};const o=(e,r)=>{if(!e.session.isInitializer(r[1].dataId)||!e.session.isInitializer(r[2].dataId)||r.length>=4&&!e.session.isInitializer(r[3].dataId)||r.length>=5&&!e.session.isInitializer(r[4].dataId))throw new Error("dynamic slice attributes are not allowed");if(r.length>=5&&r[4].integerData.some(m=>m!==1))throw new Error("currently non-1 steps is not supported for Slice");const i=Array.from(r[1].integerData),d=Array.from(r[2].integerData),g=r.length>=4?Array.from(r[3].integerData):[];return{starts:i,ends:d,axes:g,cacheKey:`${g};${i};${d}`}},t=e=>{if(!e||e.length<3||e.length>5)throw new Error("Invalid input number.");if(e[1].type!=="int32"||e[1].dims.length!==1)throw new Error("Invalid input type.");if(e[2].type!=="int32"||e[2].dims.length!==1)throw new Error("Invalid input type.");if(e.length>=4&&(e[3].type!=="int32"||e[3].dims.length!==1))throw new Error("Invalid input type.");if(e.length>=5&&(e[4].type!=="int32"||e[4].dims.length!==1))throw new Error("Invalid input type.")}},5524:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.softmaxV13=n.parseSoftmaxAttributesV13=n.parseSoftmaxAttributes=n.softmax=void 0;const u=a(246),c=a(2517),p=a(5060),s=a(2039),h=a(3738),f={name:"SoftmaxComputeMax",inputNames:["A"],inputTypes:[s.TextureType.unpacked]},l={name:"SoftmaxComputeScale",inputNames:["A","Max"],inputTypes:[s.TextureType.unpacked,s.TextureType.unpacked]},o={name:"SoftMax",inputNames:["A","Max","Norm"],inputTypes:[s.TextureType.unpacked,s.TextureType.unpacked,s.TextureType.unpacked]};n.softmax=(g,m,_)=>{d(m);const y=m[0].dims.slice(),w=c.ShapeUtil.normalizeAxis(_.axis,y.length),v=c.ShapeUtil.sizeToDimension(y,w),S=c.ShapeUtil.sizeFromDimension(y,w);return t(g,m,_,v,S)},n.parseSoftmaxAttributes=g=>(0,u.createAttributeWithCacheKey)({axis:g.attributes.getInt("axis",1)}),n.parseSoftmaxAttributesV13=g=>(0,u.createAttributeWithCacheKey)({axis:g.attributes.getInt("axis",-1)}),n.softmaxV13=(g,m,_)=>{d(m);const y=m[0].dims.slice(),w=c.ShapeUtil.normalizeAxis(_.axis,y.length),v=y.length,S=w!==v-1,O=[];let A,T=[],M=[];S&&(T=Array.from({length:v}).map((L,H)=>H),T[w]=v-1,T[v-1]=w,T.map(L=>O.push(y[L])),A=(0,u.createAttributeWithCacheKey)({perm:T}),M=(0,h.transpose)(g,m,A));const N=S?c.ShapeUtil.sizeToDimension(O,v-1):c.ShapeUtil.sizeToDimension(y,v-1),B=S?c.ShapeUtil.sizeFromDimension(O,v-1):c.ShapeUtil.sizeFromDimension(y,v-1),$=t(g,S?M:m,_,N,B);return S?(0,h.transpose)(g,$,A):$};const t=(g,m,_,y,w)=>{const v=e(g,m[0],y,w,[y]),S=g.run(Object.assign(Object.assign({},f),{cacheHint:_.cacheKey,get:()=>v}),m),O=r(g,m[0],y,w,v.output.dims,[y]),A=g.run(Object.assign(Object.assign({},l),{cacheHint:_.cacheKey,get:()=>O}),[m[0],S]),T=i(g,m[0],y,w,v.output.dims,O.output.dims);return[g.run(Object.assign(Object.assign({},o),{cacheHint:_.cacheKey,get:()=>T}),[m[0],S,A])]},e=(g,m,_,y,w)=>{const[v,S]=g.calculateTextureWidthAndHeight(m.dims,s.TextureType.unpacked),O=w.length;if(_<1||y<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(w.length!==1)throw new Error("Dimensionality of the output should be 1");if(w[0]!==_)throw new Error("Shape of the output should be equal to logical row count");const A=(0,p.getGlsl)(g.session.backend.glContext.version),T=` - float process(int[${O}] indices) { - int logical_row_start_offset = indices[0] * ${y}; - - float max = getColorAsFloat(${A.texture2D}(A, offsetToCoords(logical_row_start_offset, ${v}, - ${S} ))); - for(int i=1; i<${y}; ++i) - { - float current = getColorAsFloat(${A.texture2D}(A, offsetToCoords(logical_row_start_offset + i, - ${v}, ${S}))); - if(current > max) - max = current; - } - - return max; - }`;return Object.assign(Object.assign({},f),{output:{dims:w,type:m.type,textureType:s.TextureType.unpacked},shaderSource:T})},r=(g,m,_,y,w,v)=>{const[S,O]=g.calculateTextureWidthAndHeight(m.dims,s.TextureType.unpacked),A=v.length;if(_<1||y<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(v.length!==1)throw new Error("Dimensionality of the output should be 1");if(v[0]!==_)throw new Error("Shape of the output should be equal to logical row count");if(w.length!==1)throw new Error("Dimensionality of the intermediate results should be 1");if(w[0]!==_)throw new Error("Shape of the intermediate results should be equal to logical row count");const T=` - float process(int[${A}] indices) { - int logical_row_start_offset = indices[0] * ${y}; - - float norm_factor = 0.0; - float max = _Max(indices); - for(int i=0; i<${y}; ++i) - { - norm_factor += exp(getColorAsFloat(${(0,p.getGlsl)(g.session.backend.glContext.version).texture2D}(A, offsetToCoords(logical_row_start_offset + i, - ${S}, ${O}))) - max); - } - - return norm_factor; - }`;return Object.assign(Object.assign({},l),{output:{dims:v,type:m.type,textureType:s.TextureType.unpacked},shaderSource:T})},i=(g,m,_,y,w,v)=>{const[S,O]=g.calculateTextureWidthAndHeight(m.dims,s.TextureType.unpacked),A=m.dims.length;if(_<1||y<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(w.length!==1||v.length!==1)throw new Error("Dimensionality of the intermediate results should be 1");if(w[0]!==_||v[0]!==_)throw new Error("Shape of the intermediate results should be equal to logical row count");const T=` - float process(int[${A}] indices) { - - // get offset of current logical tensor index from the 2-D texture coordinates (TexCoords) - int offset = coordsToOffset(TexCoords, ${S}, ${O}); - - //determine the logical row for this index - int logical_row_index[1]; - logical_row_index[0] = offset / ${y}; - - float norm_factor = _Norm(logical_row_index); - - // avoid possible division by 0 - // if norm_facor is 0, all elements are zero - // if so, return 0 - if(norm_factor == 0.0) - return 0.0; - - return exp(_A(indices) - _Max(logical_row_index)) / norm_factor; - }`;return Object.assign(Object.assign({},o),{output:{dims:m.dims,type:m.type,textureType:s.TextureType.unpacked},shaderSource:T})},d=g=>{if(!g||g.length!==1)throw new Error("Softmax requires 1 input.");if(g[0].type!=="float32"&&g[0].type!=="float64")throw new Error("Invalid input type")}},5975:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseSplitAttributes=n.split=void 0;const u=a(246),c=a(2517),p=a(2039),s={name:"Split",inputNames:["A"],inputTypes:[p.TextureType.unpacked]};n.split=(o,t,e)=>{l(t);const r=c.ShapeUtil.normalizeAxis(e.axis,t[0].dims.length),i=h(o,t,r,e),d=[];for(let g=0;gf(o,t[0],e,r,g)}),t));return d},n.parseSplitAttributes=o=>{const t=o.attributes.getInt("axis",0),e=o.attributes.getInts("split",[]),r=o.outputs.length;return(0,u.createAttributeWithCacheKey)({axis:t,split:e,numOutputs:r})};const h=(o,t,e,r)=>{const[,i]=c.SplitUtil.splitShape(t[0].dims,e,r.split,r.numOutputs);return i.length},f=(o,t,e,r,i)=>{const[d,g]=c.SplitUtil.splitShape(t.dims,r,e.split,e.numOutputs),m=g[i],_=d[i],y=` - float process(int indices[${_.length}]) { - indices[${r}] += ${m}; - return _A(indices); - } - `;return Object.assign(Object.assign({},s),{cacheHint:`${e.cacheKey}:${i}`,output:{dims:_,type:t.type,textureType:p.TextureType.unpacked},shaderSource:y})},l=o=>{if(!o||o.length!==1)throw new Error("Split requires one input.");if(o[0].type!=="int8"&&o[0].type!=="uint8"&&o[0].type!=="int16"&&o[0].type!=="uint16"&&o[0].type!=="int32"&&o[0].type!=="uint32"&&o[0].type!=="float32"&&o[0].type!=="float64"&&o[0].type!=="bool")throw new Error("Invalid input type.")}},3933:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseSqueezeAttributes=n.squeezeV13=n.squeeze=void 0;const u=a(2517);n.squeeze=(s,h,f)=>{c(h);const l=u.ShapeUtil.squeezeShape(h[0].dims,f);return[s.reshapeUnpacked(h[0],l)]},n.squeezeV13=(s,h)=>(p(h),(0,n.squeeze)(s,[h[0]],Array.from(h[1].integerData))),n.parseSqueezeAttributes=s=>s.attributes.getInts("axes");const c=s=>{if(!s||s.length!==1)throw new Error("Squeeze requires 1 input.");if(s[0].type==="string")throw new Error("invalid input tensor types.")},p=s=>{if(!s||s.length!==2)throw new Error("Squeeze requires 2 inputs.");if(s[1].type!=="int32")throw new Error("Invalid input type.")}},6558:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.sum=void 0;const u=a(5060),c=a(2039);n.sum=(h,f)=>{s(f);const l={name:"Sum",inputNames:f.map((o,t)=>`X${t}`),inputTypes:new Array(f.length).fill(c.TextureType.unpacked)};return[h.run(Object.assign(Object.assign({},l),{get:()=>p(h,f,l)}),f)]};const p=(h,f,l)=>{const o=(0,u.getGlsl)(h.session.backend.glContext.version),t=f[0].dims.slice(),e=` - void main() { - vec4 result = ${f.map((r,i)=>`${o.texture2D}(X${i},TexCoords)`).join(" + ")}; - ${o.output} = result; - } - `;return Object.assign(Object.assign({},l),{output:{dims:t,type:f[0].type,textureType:c.TextureType.unpacked},hasMain:!0,shaderSource:e})},s=h=>{if(!h||h.length===0)throw new Error("Sum requires inputs.");const f=h[0].dims.length;for(let l=1;l {Object.defineProperty(n,"__esModule",{value:!0}),n.tile=void 0;const u=a(782),c=a(2039);n.tile=(h,f)=>{s(f);const l={name:"Tile",inputNames:["A"],inputTypes:[c.TextureType.unpacked]};return[h.run(Object.assign(Object.assign({},l),{get:()=>p(h,f,l)}),f)]};const p=(h,f,l)=>{const o=f[0].dims.slice(),t=new Array(o.length),e=[];for(let d=0;d {if(!h||h.length!==2)throw new Error("Tile requires 2 input.");if(h[1].dims.length!==1)throw new Error("The second input shape must 1 dimension.");if(h[1].dims[0]!==h[0].dims.length)throw new Error("Invalid input shape.");if(u.NUMBER_TYPES.indexOf(h[0].type)===-1)throw new Error("Invalid input type.");if(h[1].type!=="int32"&&h[1].type!=="int16")throw new Error("Invalid repeat type.")}},3738:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseTransposeAttributes=n.transpose=void 0;const u=a(246),c=a(2517),p=a(2039),s={name:"Transpose",inputNames:["A"],inputTypes:[p.TextureType.unpacked]};n.transpose=(e,r,i)=>(t(r),[e.run(Object.assign(Object.assign({},s),{cacheHint:i.cacheKey,get:()=>h(e,r[0],i.perm)}),r)]),n.parseTransposeAttributes=e=>(0,u.createAttributeWithCacheKey)({perm:e.attributes.getInts("perm",[])});const h=(e,r,i)=>{const d=r.dims;i=f(d,i);const g=l(d,i),m=d.length,_=` - ${o("perm",i,m)} - float process(int indices[${m}]) { - int a[${m}]; - perm(a, indices); - return _A(a); - }`;return Object.assign(Object.assign({},s),{output:{dims:g,type:r.type,textureType:p.TextureType.unpacked},shaderSource:_})},f=(e,r)=>(r&&r.length!==e.length&&(r=[...e.keys()].reverse()),r),l=(e,r)=>(r=f(e,r),c.ShapeUtil.sortBasedOnPerm(e,r)),o=(e,r,i)=>{const d=[];d.push(`void ${e}(out int a[${i}], int src[${i}]) {`);for(let g=0;g{if(!e||e.length!==1)throw new Error("Transpose requires 1 input.");if(e[0].type!=="float32"&&e[0].type!=="float64")throw new Error("input should be float tensor")}},8710:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.encodeAsUint8=void 0;const u=a(5060),c=a(2039);n.encodeAsUint8=(p,s)=>{const h=s.shape,f=(0,u.getGlsl)(p.session.backend.glContext.version),l=` - const float FLOAT_MAX = 1.70141184e38; - const float FLOAT_MIN = 1.17549435e-38; - - bool isNaN(float val) { - return (val < 1.0 || 0.0 < val || val == 0.0) ? false : true; - } - - highp vec4 encodeAsUint8(highp float v) { - if (isNaN(v)) { - return vec4(255, 255, 255, 255); - } - - highp float av = abs(v); - - if(av < FLOAT_MIN) { - return vec4(0.0, 0.0, 0.0, 0.0); - } else if(v > FLOAT_MAX) { - return vec4(0.0, 0.0, 128.0, 127.0) / 255.0; - } else if(v < -FLOAT_MAX) { - return vec4(0.0, 0.0, 128.0, 255.0) / 255.0; - } - - highp vec4 c = vec4(0,0,0,0); - - highp float e = floor(log2(av)); - highp float m = exp2(fract(log2(av))) - 1.0; - - c[2] = floor(128.0 * m); - m -= c[2] / 128.0; - c[1] = floor(32768.0 * m); - m -= c[1] / 32768.0; - c[0] = floor(8388608.0 * m); - - highp float ebias = e + 127.0; - c[3] = floor(ebias / 2.0); - ebias -= c[3] * 2.0; - c[2] += floor(ebias) * 128.0; - - c[3] += 128.0 * step(0.0, -v); - - return c / 255.0; - } - - void main() { - float value = ${f.texture2D}(X,TexCoords).r; - ${f.output} = encodeAsUint8(value); - }`,o={name:"Uint8Encode",inputTypes:[c.TextureType.unpacked],inputNames:["X"],output:{dims:h,type:s.tensor.type,textureType:c.TextureType.downloadUint8AsFloat},shaderSource:l,hasMain:!0};return p.executeProgram(o,[s.tensor])}},4909:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.tanh=n.tan=n.sqrt=n.sin=n.sigmoid=n.relu=n.not=n.neg=n.log=n.parseLeakyReluAttributes=n.leakyRelu=n.identity=n.floor=n.exp=n.parseEluAttributes=n.elu=n.cos=n.ceil=n.clipV11=n.parseClipAttributes=n.clip=n.atan=n.asin=n.acos=n.abs=n.glslTanh=n.glslTan=n.glslSqrt=n.glslSigmoid=n.glslRelu=n.glslSin=n.glslNot=n.glslNeg=n.glslLog=n.glslLeakyRelu=n.glslIdentity=n.glslClip=n.glslFloor=n.glslExp=n.glslElu=n.glslCos=n.glslCeil=n.glslAtan=n.glslAsin=n.glslAcos=n.glslAbs=void 0;const u=a(246),c=a(2517),p=a(8520),s=a(5060),h=a(2039);function f(){return $("abs")}function l(){return $("acos")}function o(){return $("asin")}function t(){return $("atan")}function e(){return $("ceil")}function r(){return $("cos")}function i(C){const z="elu";return{body:` - const float alpha = float(${C}); - - float ${z}_(float a) { - return a >= 0.0 ? a: (exp(a) - 1.0) * alpha; - } - vec4 ${z}_(vec4 v) { - return vec4(${z}_(v.x), ${z}_(v.y), ${z}_(v.z), ${z}_(v.w)); - } - `,name:z,type:p.FunctionType.ValueBased}}function d(){return $("exp")}function g(){return $("floor")}function m(C,z){const J="clip";return{body:` - const float min = float(${C}); - const float max = float(${z}); - - float ${J}_(float a) { - return clamp(a, min, max); - } - vec4 ${J}_(vec4 v) { - return clamp(v, min, max); - } - `,name:J,type:p.FunctionType.ValueBased}}function _(){const C="indentity";return{body:` - float ${C}_(float a) { - return a; - } - vec4 ${C}_(vec4 v) { - return v; - } - `,name:C,type:p.FunctionType.ValueBased}}function y(C){const z="leakyRelu";return{body:` - const float alpha = float(${C}); - - float ${z}_(float a) { - return a < 0.0 ? a * alpha : a; - } - vec4 ${z}_(vec4 v) { - return vec4(${z}_(v.x), ${z}_(v.y), ${z}_(v.z), ${z}_(v.w)); - } - `,name:z,type:p.FunctionType.ValueBased}}function w(){return $("log")}function v(){const C="neg";return{body:` - float ${C}_(float a) { - return -a; - } - vec4 ${C}_(vec4 v) { - return -v; - } - `,name:C,type:p.FunctionType.ValueBased}}function S(){const C="not";return{body:` - float ${C}_(float a) { - return float( ! bool(a) ); - } - bool ${C}_(bool a) { - return !a; - } - vec4 ${C}_(vec4 v) { - return vec4(!bool(v.x), !bool(v.y), !bool(v.z), !bool(v.w)); - } - bvec4 ${C}_(bvec4 v) { - return bvec4(!v.x, !v.y, !v.z, !v.w); - } - `,name:C,type:p.FunctionType.ValueBased}}function O(){return $("sin")}function A(){const C="relu";return{body:` - float ${C}_(float a) { - return max( a, 0.0 ); - } - vec4 ${C}_(vec4 v) { - return max( v, 0.0 ); - } - `,name:C,type:p.FunctionType.ValueBased}}function T(){const C="sigmoid";return{body:` - float ${C}_(float a) { - return 1.0 / (1.0 + exp(-a)); - } - vec4 ${C}_(vec4 v) { - return 1.0 / (1.0 + exp(-v)); - } - `,name:C,type:p.FunctionType.ValueBased}}function M(){return $("sqrt")}function N(){return $("tan")}function B(){const C="tanh";return{body:` - float ${C}_(float a) { - a = clamp(a, -10., 10.); - a = exp(2.*a); - return (a - 1.) / (a + 1.); - } - vec4 ${C}_(vec4 v) { - v = clamp(v, -10., 10.); - v = exp(2.*v); - return (v - 1.) / (v + 1.); - } - `,name:C,type:p.FunctionType.ValueBased}}function $(C){return{body:` - float ${C}_(float a) { - return ${C}(a); - } - vec4 ${C}_(vec4 v) { - return ${C}(v); - } - `,name:C,type:p.FunctionType.ValueBased}}n.glslAbs=f,n.glslAcos=l,n.glslAsin=o,n.glslAtan=t,n.glslCeil=e,n.glslCos=r,n.glslElu=i,n.glslExp=d,n.glslFloor=g,n.glslClip=m,n.glslIdentity=_,n.glslLeakyRelu=y,n.glslLog=w,n.glslNeg=v,n.glslNot=S,n.glslSin=O,n.glslRelu=A,n.glslSigmoid=T,n.glslSqrt=M,n.glslTan=N,n.glslTanh=B;const L=(C,z,J,X)=>{const te=C.session.pack?h.TextureType.packed:h.TextureType.unpacked,ne={name:J.name,inputTypes:[te],inputNames:["A"],cacheHint:X};return Object.assign(Object.assign({},ne),{get:()=>((me,Me,Oe,ce)=>{const Te=me.session.pack?h.TextureType.packed:h.TextureType.unpacked,ye=(0,s.getGlsl)(me.session.backend.glContext.version);return Object.assign(Object.assign({},Me),{output:{dims:Oe.dims,type:Oe.type,textureType:Te},shaderSource:` - ${ce.body} - void main() { - vec4 v = ${ye.texture2D}(A, TexCoords); - v = ${ce.name}_(v); - ${ye.output} = v; - } - `,hasMain:!0})})(C,ne,z,J)})};n.abs=(C,z)=>[C.run(L(C,z[0],f()),z)],n.acos=(C,z)=>[C.run(L(C,z[0],l()),z)],n.asin=(C,z)=>[C.run(L(C,z[0],o()),z)],n.atan=(C,z)=>[C.run(L(C,z[0],t()),z)],n.clip=(C,z,J)=>[C.run(L(C,z[0],m(J.min,J.max),J.cacheKey),z)],n.parseClipAttributes=C=>(0,u.createAttributeWithCacheKey)({min:C.attributes.getFloat("min",c.MIN_CLIP),max:C.attributes.getFloat("max",c.MAX_CLIP)}),n.clipV11=(C,z)=>{const J=H(C,z);return(0,n.clip)(C,[z[0]],J)};const H=(C,z)=>{if(z.length>=3&&(!C.session.isInitializer(z[1].dataId)||!C.session.isInitializer(z[2].dataId)))throw new Error("dynamic clip attributes are not allowed");const J=z.length>=3?z[1].numberData[0]:c.MIN_CLIP,X=z.length>=3?z[2].numberData[0]:c.MAX_CLIP;return(0,u.createAttributeWithCacheKey)({min:J,max:X})};n.ceil=(C,z)=>[C.run(L(C,z[0],e()),z)],n.cos=(C,z)=>[C.run(L(C,z[0],r()),z)],n.elu=(C,z,J)=>[C.run(L(C,z[0],i(J.alpha),J.cacheKey),z)],n.parseEluAttributes=C=>(0,u.createAttributeWithCacheKey)({alpha:C.attributes.getFloat("alpha",1)}),n.exp=(C,z)=>[C.run(L(C,z[0],d()),z)],n.floor=(C,z)=>[C.run(L(C,z[0],g()),z)],n.identity=(C,z)=>[C.run(L(C,z[0],_()),z)],n.leakyRelu=(C,z,J)=>[C.run(L(C,z[0],y(J.alpha),J.cacheKey),z)],n.parseLeakyReluAttributes=C=>(0,u.createAttributeWithCacheKey)({alpha:C.attributes.getFloat("alpha",.01)}),n.log=(C,z)=>[C.run(L(C,z[0],w()),z)],n.neg=(C,z)=>[C.run(L(C,z[0],v()),z)],n.not=(C,z)=>[C.run(L(C,z[0],S()),z)],n.relu=(C,z)=>[C.run(L(C,z[0],A()),z)],n.sigmoid=(C,z)=>[C.run(L(C,z[0],T()),z)],n.sin=(C,z)=>[C.run(L(C,z[0],O()),z)],n.sqrt=(C,z)=>[C.run(L(C,z[0],M()),z)],n.tan=(C,z)=>[C.run(L(C,z[0],N()),z)],n.tanh=(C,z)=>[C.run(L(C,z[0],B()),z)]},5611:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createUnpackProgramInfoLoader=n.createUnpackProgramInfo=void 0;const u=a(5060),c=a(2039),p=a(9390),s=a(2827),h={name:"unpack",inputNames:["A"],inputTypes:[c.TextureType.packed]};n.createUnpackProgramInfo=(f,l)=>{const o=l.dims.length,t=(0,s.getChannels)("rc",o),e=t.slice(-2),r=(0,p.getCoordsDataType)(o),i=(0,s.unpackFromChannel)(),d=l.dims.length===0?"":function(_,y){if(_===1)return"rc";let w="";for(let v=0;v<_;v++)w+=y[v],v<_-1&&(w+=",");return w}(o,t),g=o<=1?"rc":`vec2(${e.join(",")})`,m=` - ${i} - void main() { - ${r} rc = getOutputCoords(); - - // Sample the texture with the coords to get the rgba channel value. - vec4 packedInput = getA(${d}); - - ${(0,u.getGlsl)(f.session.backend.glContext.version).output} = vec4(getChannel(packedInput, ${g}), 0, 0, 0); - } - `;return Object.assign(Object.assign({},h),{hasMain:!0,output:{dims:l.dims,type:l.type,textureType:c.TextureType.unpacked},shaderSource:m})},n.createUnpackProgramInfoLoader=(f,l)=>Object.assign(Object.assign({},h),{get:()=>(0,n.createUnpackProgramInfo)(f,l)})},8428:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.parseUnsqueezeAttributes=n.unsqueezeV13=n.unsqueeze=void 0;const u=a(2517);n.unsqueeze=(s,h,f)=>{c(h);const l=u.ShapeUtil.unsqueezeShape(h[0].dims,f);return[s.reshapeUnpacked(h[0],l)]},n.unsqueezeV13=(s,h)=>(p(h),(0,n.unsqueeze)(s,[h[0]],Array.from(h[1].integerData))),n.parseUnsqueezeAttributes=s=>s.attributes.getInts("axes");const c=s=>{if(!s||s.length!==1)throw new Error("Unsqueeze requires 1 input.");if(s[0].type==="string")throw new Error("invalid input tensor types.")},p=s=>{if(!s||s.length!==2)throw new Error("Unsqueeze requires 2 inputs.");if(s[1].type!=="int32")throw new Error("Invalid input type.")}},9793:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.scalesValidation=n.validateInputs=n.parseUpsampleAttributes=n.parseUpsampleAttributesV9=n.parseUpsampleAttributesV7=n.upsample=void 0;const u=a(246),c=a(5060),p=a(2039),s={name:"Upsample",inputNames:["X"],inputTypes:[p.TextureType.unpacked]};n.upsample=(f,l,o)=>((0,n.validateInputs)(l,o),[f.run(Object.assign(Object.assign({},s),{cacheHint:o.cacheKey,get:()=>h(f,l,o)}),l)]),n.parseUpsampleAttributesV7=f=>(0,n.parseUpsampleAttributes)(f,7),n.parseUpsampleAttributesV9=f=>(0,n.parseUpsampleAttributes)(f,9),n.parseUpsampleAttributes=(f,l)=>{const o=l>=10,t=f.attributes.getString("mode","nearest");if(t!=="nearest"&&t!=="linear"&&(l<11||t!=="cubic"))throw new Error(`unrecognized mode: ${t}`);let e=[];l<9&&(e=f.attributes.getFloats("scales"),(0,n.scalesValidation)(e,t,o));const r=f.attributes.getFloat("extrapolation_value",0),i=l>10?f.attributes.getString("coordinate_transformation_mode","half_pixel"):"asymmetric";if(["asymmetric","pytorch_half_pixel","tf_half_pixel_for_nn","align_corners","tf_crop_and_resize","half_pixel"].indexOf(i)===-1)throw new Error(`coordinate_transform_mode '${i}' is not supported`);const d=i==="tf_crop_and_resize",g=d,m=t==="nearest"&&l>=11?f.attributes.getString("nearest_mode","round_prefer_floor"):"";if(["round_prefer_floor","round_prefer_ceil","floor","ceil",""].indexOf(m)===-1)throw new Error(`nearest_mode '${m}' is not supported`);const _=f.attributes.getFloat("cubic_coeff_a",-.75),y=f.attributes.getInt("exclude_outside",0)!==0;if(y&&t!=="cubic")throw new Error("exclude_outside can be set to 1 only when mode is CUBIC.");const w=l<11||t==="nearest"&&i==="asymmetric"&&m==="floor";let v=0,S=0,O=0;return l>10?f.inputs.length>2?(v=1,S=2,O=3):(S=1,O=2):l===9&&(S=1),(0,u.createAttributeWithCacheKey)({opset:l,isResize:o,mode:t,scales:e,extrapolationValue:r,coordinateTransformMode:i,useExtrapolation:g,needRoiInput:d,nearestMode:m,cubicCoefficientA:_,excludeOutside:y,useNearest2xOptimization:w,roiInputIdx:v,scalesInputIdx:S,sizesInputIdx:O})};const h=(f,l,o)=>{const t=(0,c.getGlsl)(f.session.backend.glContext.version),[e,r]=f.calculateTextureWidthAndHeight(l[0].dims,p.TextureType.unpacked),i=l[0].dims.map((O,A)=>Math.floor(O*o.scales[A])),[d,g]=f.calculateTextureWidthAndHeight(i,p.TextureType.unpacked),m=i.length,_=new Array(m),y=new Array(m);let w=` - int output_pitches[${m}]; - int input_pitches[${m}]; - `;for(let O=m-1;O>=0;O--)_[O]=O===m-1?1:_[O+1]*i[O+1],y[O]=O===m-1?1:y[O+1]*l[0].dims[O+1],w+=` - output_pitches[${O}] = ${_[O]}; - input_pitches[${O}] = ${y[O]}; - `;const v=` - float getInputFloat(int index) { - vec2 coords = offsetToCoords(index, ${e}, ${r}); - float value = getColorAsFloat(${t.texture2D}(X, coords)); - return value; - } - `,S=o.mode==="nearest"?` - ${v} - float process(int indices[${m}]) { - int input_index = 0; - int output_index = coordsToOffset(TexCoords, ${d}, ${g}); - - ${w} - - int d, m; - for (int dim = 0; dim < ${m}; ++dim) { - d = output_index / output_pitches[dim]; - m = output_index - d * output_pitches[dim]; - output_index = m; - - if (scales[dim] != 1 && d > 0) { - int d2 = d / scales[dim]; - m = d - d2 * scales[dim]; - d = d2; - } - input_index += input_pitches[dim] * d; - } - - return getInputFloat(input_index); - }`:m===4?` - ${v} - float process(int indices[4]) { - int input_index = 0; - int output_index = coordsToOffset(TexCoords, ${d}, ${g}); - - ${w} - - int m; - int index_of_dim0, index_of_dim1, index_of_dim2, index_of_dim3; - index_of_dim0 = output_index / output_pitches[0]; - m = output_index - index_of_dim0 * output_pitches[0]; - index_of_dim1 = m / output_pitches[1]; - m = m - index_of_dim1 * output_pitches[1]; - index_of_dim2 = m / output_pitches[2]; - m = m - index_of_dim2 * output_pitches[2]; - index_of_dim3 = m; - - int index_of_input_dim2, index_of_input_dim3, x_offset, y_offset; - index_of_input_dim2 = index_of_dim2 / scales[2]; - y_offset = index_of_dim2 - index_of_input_dim2 * scales[2]; - index_of_input_dim3 = index_of_dim3 / scales[3]; - x_offset = index_of_dim3 - index_of_input_dim3 * scales[3]; - - input_index = index_of_dim0 * input_pitches[0] + - index_of_dim1 * input_pitches[1] + - index_of_input_dim2 * input_pitches[2] + - index_of_input_dim3; - - float x00 = getInputFloat(input_index); - float x10, x01, x11; - - bool end_of_dim2 = false; - if (index_of_input_dim2 == (${l[0].dims[2]} - 1)) { - // It's the end in dimension 2 - x01 = x00; - end_of_dim2 = true; - } else { - x01 = getInputFloat(input_index + input_pitches[2]); - } - - if (index_of_input_dim3 == (input_pitches[2] - 1)) { - // It's the end in dimension 3 - x10 = x00; - x11 = x01; - } - else { - x10 = getInputFloat(input_index + 1); - x11 = end_of_dim2 ? x10 : getInputFloat(input_index + input_pitches[2] + 1); - } - - float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[2]); - float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[2]); - return y0 + float(x_offset) * (y1 - y0) / float(scales[3]); - }`:` - ${v} - float process(int indices[2]) { - int input_index = 0; - int output_index = coordsToOffset(TexCoords, ${d}, ${g}); - - ${w} - - int m; - int index_of_dim0, index_of_dim1; - index_of_dim0 = output_index / output_pitches[0]; - m = output_index - index_of_dim0 * output_pitches[0]; - index_of_dim1 = m; - - int index_of_input_dim0, index_of_input_dim1, x_offset, y_offset; - index_of_input_dim0 = index_of_dim0 / scales[0]; - y_offset = index_of_dim0 - index_of_input_dim0 * scales[0]; - index_of_input_dim1 = index_of_dim1 / scales[1]; - x_offset = index_of_dim1 - index_of_input_dim1 * scales[1]; - - input_index = index_of_input_dim0 * input_pitches[0] + index_of_input_dim1; - - float x00 = getInputFloat(input_index); - float x10, x01, x11; - - bool end_of_dim0 = false; - if (index_of_input_dim0 == (${l[0].dims[0]} - 1)) { - // It's the end in dimension 0 - x01 = x00; - end_of_dim0 = true; - } else { - x01 = getInputFloat(input_index + input_pitches[0]); - } - - if (index_of_input_dim1 == (input_pitches[0] - 1)) { - // It's the end in dimension 1 - x10 = x00; - x11 = x01; - } - else { - x10 = getInputFloat(input_index + 1); - x11 = end_of_dim0 ? x10 : getInputFloat(input_index + input_pitches[0] + 1); - } - - float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[0]); - float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[0]); - return y0 + float(x_offset) * (y1 - y0) / float(scales[1]); - }`;return Object.assign(Object.assign({},s),{output:{dims:i,type:l[0].type,textureType:p.TextureType.unpacked},shaderSource:S,variables:[{name:"scales",type:"int",arrayLength:o.scales.length,data:o.scales.map(O=>Math.ceil(O))}]})};n.validateInputs=(f,l)=>{if(!f||l.opset<9&&f.length!==1||l.opset>=9&&l.opset<11&&f.length!==2||l.opset>=11&&f.length<2)throw new Error("invalid inputs.");if(l.scales.length>0&&f[0].dims.length!==l.scales.length)throw new Error("Invalid input shape.");if(f[0].type==="string")throw new Error("Invalid input tensor types.")},n.scalesValidation=(f,l,o)=>{if(o){for(const t of f)if(t<=0)throw new Error("Scale value should be greater than 0.")}else for(const t of f)if(t<1)throw new Error("Scale value should be greater than or equal to 1.");if(!(l!=="linear"&&l!=="cubic"||f.length===2||f.length===4&&f[0]===1&&f[1]===1))throw new Error(`'Linear' mode and 'Cubic' mode only support 2-D inputs ('Bilinear', 'Bicubic') or 4-D inputs with the corresponding outermost 2 scale values being 1 in the ${o?"Resize":"Upsample"} opeartor.`)}},1958:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ProgramManager=void 0;const u=a(1670),c=a(6231),p=a(8879),s=a(5060);n.ProgramManager=class{constructor(h,f,l){this.profiler=h,this.glContext=f,this.textureLayoutStrategy=l,this.repo=new Map,this.attributesBound=!1}getArtifact(h){return this.repo.get(h)}setArtifact(h,f){this.repo.set(h,f)}run(h,f,l){var o;this.profiler.event("op",`ProgramManager.run ${(o=h.programInfo.name)!==null&&o!==void 0?o:"unknown kernel"}`,()=>{var t;const e=this.glContext.gl,r=h.program;e.useProgram(r);try{this.bindOutput(l),this.attributesBound||this.bindAttributes(h.attribLocations),this.bindUniforms(h.uniformLocations,(t=h.programInfo.variables)!==null&&t!==void 0?t:[],f)}catch(i){throw c.Logger.error("ProgramManager",h.programInfo.shaderSource),i}this.profiler.event("backend","GlContext.draw()",()=>{this.glContext.draw()})},this.glContext)}dispose(){this.vertexShader&&this.glContext.deleteShader(this.vertexShader),this.repo.forEach(h=>this.glContext.deleteProgram(h.program))}build(h,f,l){return this.profiler.event("backend","ProgramManager.build",()=>{const o=new p.GlslPreprocessor(this.glContext,h,f,l),t=o.preprocess(),e=this.compile(t);return{programInfo:h,program:e,uniformLocations:this.getUniformLocations(e,o.context.programInfo.inputNames,o.context.programInfo.variables),attribLocations:this.getAttribLocations(e)}})}compile(h){if(!this.vertexShader){c.Logger.verbose("ProrgramManager","Compiling and caching Vertex shader for the first time");const o=(0,s.getVertexShaderSource)(this.glContext.version);this.vertexShader=this.glContext.compileShader(o,this.glContext.gl.VERTEX_SHADER)}u.env.debug&&c.Logger.verbose("ProrgramManager",`FragShader: -${h} -`);const f=this.glContext.compileShader(h,this.glContext.gl.FRAGMENT_SHADER),l=this.glContext.createProgram(this.vertexShader,f);return this.glContext.deleteShader(f),l}bindOutput(h){const f=h.width,l=h.height;c.Logger.verbose("ProrgramManager",`Binding output texture to Framebuffer: w/h=${f}/${l}, shape=${h.shape}, type=${h.tensor.type}`),this.glContext.attachFramebuffer(h.texture,f,l)}bindAttributes(h){const f=h.position,l=h.textureCoord;this.glContext.setVertexAttributes(f,l),this.attributesBound=!0}bindUniforms(h,f,l){var o;const t=this.glContext.gl;let e=0;for(const{name:r,type:i,location:d,arrayLength:g}of h){const m=(o=f.find(_=>_.name===r))===null||o===void 0?void 0:o.data;if(i!=="sampler2D"&&!m)throw new Error(`variable '${r}' does not have data defined in program info`);switch(i){case"sampler2D":this.bindTexture(l[e],d,e),e++;break;case"float":g?t.uniform1fv(d,m):t.uniform1f(d,m);break;case"int":g?t.uniform1iv(d,m):t.uniform1i(d,m);break;default:throw new Error(`Uniform not implemented: ${i}`)}}}bindTexture(h,f,l){this.glContext.bindTextureToUniform(h.texture,l,f)}getAttribLocations(h){return{position:this.getAttribLocation(h,"position"),textureCoord:this.getAttribLocation(h,"textureCoord")}}getUniformLocations(h,f,l){const o=[];if(f)for(const t of f)o.push({name:t,type:"sampler2D",location:this.getUniformLocation(h,t)});if(l)for(const t of l)o.push(Object.assign(Object.assign({},t),{location:this.getUniformLocation(h,t.name)}));return o}getUniformLocation(h,f){const l=this.glContext.gl.getUniformLocation(h,f);if(l===null)throw new Error(`Uniform ${f} not found.`);return l}getAttribLocation(h,f){return this.glContext.gl.getAttribLocation(h,f)}}},6416:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WebGLSessionHandler=void 0;const u=a(6231),c=a(1047),p=a(8316),s=a(1640),h=a(1958),f=a(7859),l=a(5702);n.WebGLSessionHandler=class{constructor(o,t){this.backend=o,this.context=t,this.layoutStrategy=new f.PreferLogicalStrategy(o.glContext.maxTextureSize),this.programManager=new h.ProgramManager(this.context.profiler,o.glContext,this.layoutStrategy),this.textureManager=new l.TextureManager(o.glContext,this.layoutStrategy,this.context.profiler,{reuseTextures:o.textureCacheMode==="full"}),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map,this.pack=o.pack,this.pack2unpackMap=new Map,this.unpack2packMap=new Map}createInferenceHandler(){return new p.WebGLInferenceHandler(this)}onGraphInitialized(o){const t=o.getValues().filter(e=>e.from===-1&&e.tensor).map(e=>e.tensor.dataId);this.initializers=new Set(t)}isInitializer(o){return!!this.initializers&&this.initializers.has(o)}addInitializer(o){this.initializers.add(o)}getTextureData(o,t){return t?this.packedTextureDataCache.get(o):this.unpackedTextureDataCache.get(o)}setTextureData(o,t,e=!1){u.Logger.verbose("WebGLSessionHandler","Storing Texture data in cache"),e?this.packedTextureDataCache.set(o,t):this.unpackedTextureDataCache.set(o,t)}dispose(){this.programManager.dispose(),this.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(o=>this.textureManager.releaseTexture(o,!0)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(o=>this.textureManager.releaseTexture(o,!0)),this.unpackedTextureDataCache=new Map}resolve(o,t,e){const r=(0,c.resolveOperator)(o,t,s.WEBGL_OP_RESOLVE_RULES);return{impl:r.opImpl,context:r.opInit?r.opInit(o,e):o}}}},7769:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Uint8DataEncoder=n.RGBAFloatDataEncoder=n.RedFloat32DataEncoder=void 0;const u=a(6231);n.RedFloat32DataEncoder=class{constructor(c,p=1){if(p===1)this.internalFormat=c.R32F,this.format=c.RED,this.textureType=c.FLOAT,this.channelSize=p;else{if(p!==4)throw new Error(`Invalid number of channels: ${p}`);this.internalFormat=c.RGBA32F,this.format=c.RGBA,this.textureType=c.FLOAT,this.channelSize=p}}encode(c,p){let s,h;return c.constructor!==Float32Array&&(u.Logger.warning("Encoder","data was not of type Float32; creating new Float32Array"),h=new Float32Array(c)),p*this.channelSize>c.length?(u.Logger.warning("Encoder","Source data too small. Allocating larger array"),h=c,s=this.allocate(p*this.channelSize),h.forEach((f,l)=>s[l]=f)):(h=c,s=h),s}allocate(c){return new Float32Array(4*c)}decode(c,p){return this.channelSize===1?c.filter((s,h)=>h%4==0).subarray(0,p):c.subarray(0,p)}},n.RGBAFloatDataEncoder=class{constructor(c,p=1,s){if(p!==1&&p!==4)throw new Error(`Invalid number of channels: ${p}`);this.internalFormat=c.RGBA,this.format=c.RGBA,this.channelSize=p,this.textureType=s||c.FLOAT}encode(c,p){let s=c;return this.channelSize===1&&(u.Logger.verbose("Encoder","Exploding into a larger array"),s=this.allocate(p),c.forEach((h,f)=>s[4*f]=h)),s}allocate(c){return new Float32Array(4*c)}decode(c,p){return this.channelSize===1?c.filter((s,h)=>h%4==0).subarray(0,p):c.subarray(0,p)}},n.Uint8DataEncoder=class{constructor(c,p=1){if(this.channelSize=4,p===1)this.internalFormat=c.ALPHA,this.format=c.ALPHA,this.textureType=c.UNSIGNED_BYTE,this.channelSize=p;else{if(p!==4)throw new Error(`Invalid number of channels: ${p}`);this.internalFormat=c.RGBA,this.format=c.RGBA,this.textureType=c.UNSIGNED_BYTE,this.channelSize=p}}encode(c,p){return new Uint8Array(c.buffer,c.byteOffset,c.byteLength)}allocate(c){return new Uint8Array(c*this.channelSize)}decode(c,p){if(c instanceof Uint8Array)return c.subarray(0,p);throw new Error(`Invalid array type: ${c.constructor}`)}}},7859:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.getBatchDim=n.sizeToSquarishShape=n.getRowsCols=n.sizeFromShape=n.isInt=n.parseAxisParam=n.squeezeShape=n.PreferLogicalStrategy=n.AlwaysKeepOriginalSizeStrategy=void 0;const u=a(6231),c=a(2517);function p(o,t){const e=[],r=[],i=t!=null&&Array.isArray(t)&&t.length===0,d=t==null||i?null:s(t,o).sort();let g=0;for(let m=0;m m)&&o[m]===1&&(e.push(o[m]),r.push(m)),d[g]<=m&&g++}o[m]!==1&&(e.push(o[m]),r.push(m))}return{newShape:e,keptDims:r}}function s(o,t){const e=t.length;return o=o==null?t.map((r,i)=>i):[].concat(o),(0,c.assert)(o.every(r=>r>=-e&&r `All values in axis param must be in range [-${e}, ${e}) but got axis ${o}`),(0,c.assert)(o.every(h),()=>`All values in axis param must be integers but got axis ${o}`),o.map(r=>r<0?e+r:r)}function h(o){return o%1==0}function f(o){if(o.length===0)return 1;let t=o[0];for(let e=1;e =o.length?1:o.slice(t.breakAxis).reduce((m,_)=>m*_),g=t.breakAxis<=0?1:o.slice(0,t.breakAxis).reduce((m,_)=>m*_);if(!(d>e||g>e))return[d,g];u.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${o}, breakAxis:${t.breakAxis}`)}const r=o.reduce((d,g)=>d*g);let i=Math.floor(Math.sqrt(r));for(;i =e||r%i!=0)throw new Error(`The given dimensions are outside this GPU's boundaries: ${o}`);return[i,r/i]}},n.PreferLogicalStrategy=class{constructor(o){this.maxTextureSize=o}computeTextureWH(o,t){const e=this.computeTexture(o,t);return t&&t.isPacked&&(e[0]/=2,e[1]/=2),t&&t.reverseWH?[e[1],e[0]]:e}computeTexture(o,t){const e=t&&t.isPacked;if(o.length===0)return e?[2,2]:[1,1];let r=this.maxTextureSize;if(t&&t.breakAxis!==void 0){const g=t.breakAxis>=o.length?1:o.slice(t.breakAxis).reduce((_,y)=>_*y),m=t.breakAxis<=0?1:o.slice(0,t.breakAxis).reduce((_,y)=>_*y);if(!(g>r||m>r))return[g,m];u.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${o}, breakAxis:${t.breakAxis}`)}let i=o.slice(0);e&&(r*=2,i=i.map((g,m)=>m>=i.length-2?i[m]%2==0?i[m]:i[m]+1:i[m]),i.length===1&&(i=[2,i[0]])),i.length!==2&&(i=p(i).newShape);const d=f(i);return i.length<=1&&d<=r?[1,d]:i.length===2&&i[0]<=r&&i[1]<=r?i:i.length===3&&i[0]*i[1]<=r&&i[2]<=r?[i[0]*i[1],i[2]]:i.length===3&&i[0]<=r&&i[1]*i[2]<=r?[i[0],i[1]*i[2]]:i.length===4&&i[0]*i[1]*i[2]<=r&&i[3]<=r?[i[0]*i[1]*i[2],i[3]]:i.length===4&&i[0]<=r&&i[1]*i[2]*i[3]<=r?[i[0],i[1]*i[2]*i[3]]:e?l(d/4).map(g=>2*g):l(d)}},n.squeezeShape=p,n.parseAxisParam=s,n.isInt=h,n.sizeFromShape=f,n.getRowsCols=function(o){if(o.length===0)throw Error("Cannot get rows and columns of an empty shape array.");return[o.length>1?o[o.length-2]:1,o[o.length-1]]},n.sizeToSquarishShape=l,n.getBatchDim=function(o,t=2){return f(o.slice(0,o.length-t))}},4057:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createTextureLayoutFromShape=n.calculateTextureWidthAndHeight=n.createTextureLayoutFromTextureType=void 0;const u=a(2517),c=a(2039);n.createTextureLayoutFromTextureType=(p,s,h)=>{const f=h===c.TextureType.unpacked||h===c.TextureType.unpackedReversed?1:4,l=h===c.TextureType.packed,o=h===c.TextureType.unpackedReversed||h===c.TextureType.packed,t=h===c.TextureType.packedLastDimension?s.length-1:void 0,e=h===c.TextureType.packedLastDimension?s.map((r,i)=>i===s.length-1?4*r:r):void 0;return(0,n.createTextureLayoutFromShape)(p,s,f,e,{isPacked:l,reverseWH:o,breakAxis:t})},n.calculateTextureWidthAndHeight=(p,s,h)=>{const f=(0,n.createTextureLayoutFromTextureType)(p,s,h);return[f.width,f.height]},n.createTextureLayoutFromShape=(p,s,h=1,f,l)=>{const o=!(!l||!l.isPacked),[t,e]=p.computeTextureWH(o&&f||s,l),r=s.length;let i=s.slice(0);if(r===0&&(i=[1]),h===1)f=s;else if(o){if(h!==4)throw new Error("a packed texture must be 4-channel");f=s,r>0&&(i[r-1]=Math.ceil(i[r-1]/2)),r>1&&(i[r-2]=Math.ceil(i[r-2]/2))}else if(!f)throw new Error("Unpacked shape is needed when using channels > 1");return{width:t,height:e,channels:h,isPacked:o,shape:i,strides:u.ShapeUtil.computeStrides(i),unpackedShape:f,reversedWH:l&&l.reverseWH}}},5702:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.TextureManager=void 0;const u=a(6231);n.TextureManager=class{constructor(c,p,s,h){this.glContext=c,this.layoutStrategy=p,this.profiler=s,this.config=h,this.pendingRead=new Map,h.reuseTextures&&(this.inUseTextures=new Map,this.idleTextures=new Map,this.textureLookup=new Map)}createTextureFromLayout(c,p,s,h){const f=this.toEncoderType(c),l=this.glContext.getEncoder(f,p.channels||1,h);if(p.isPacked&&h===1)throw new Error("not implemented");const o=p.width,t=p.height;let e,r;if(this.config.reuseTextures){e=`${o}x${t}_${l.format}_${l.internalFormat}_${l.textureType}`,r=this.inUseTextures.get(e),r||(r=[],this.inUseTextures.set(e,r));const d=this.idleTextures.get(e);if(d&&d.length>0){const g=d.pop();return r.push(g),h===1&&this.glContext.updateTexture(g,o,t,l,this.toTextureData(c,s)),g}}u.Logger.verbose("TextureManager",`Creating new texture of size ${p.width}x${p.height}`);const i=this.glContext.allocateTexture(o,t,l,this.toTextureData(c,s));return this.config.reuseTextures&&(r.push(i),this.textureLookup.set(i,e)),i}readTexture(c,p,s){return s||(s=1),this.profiler.event("backend","TextureManager.readTexture",()=>{const h=c.shape.reduce((l,o)=>l*o)*s,f=this.glContext.readTexture(c.texture,c.width,c.height,h,this.toEncoderType(p),s);return this.toTensorData(p,f)})}async readTextureAsync(c,p,s){const h=c.tensor.dataId;if(s||(s=1),this.pendingRead.has(h)){const f=this.pendingRead.get(h);return new Promise(l=>f==null?void 0:f.push(l))}return this.profiler.event("backend","TextureManager.readTextureAsync",async()=>{this.pendingRead.set(h,[]);const f=c.shape.reduce((e,r)=>e*r)*s;await this.glContext.createAndWaitForFence();const l=this.glContext.readTexture(c.texture,c.width,c.height,f,this.toEncoderType(p),s),o=this.toTensorData(p,l),t=this.pendingRead.get(h);return this.pendingRead.delete(h),t==null||t.forEach(e=>e(o)),o})}readUint8TextureAsFloat(c){return this.profiler.event("backend","TextureManager.readUint8TextureAsFloat",()=>{const p=c.shape.reduce((h,f)=>h*f),s=this.glContext.readTexture(c.texture,c.width,c.height,4*p,"byte",4);return new Float32Array(s.buffer,s.byteOffset,p)})}releaseTexture(c,p){let s;if(this.config.reuseTextures&&(s=this.textureLookup.get(c.texture),s)){p&&this.textureLookup.delete(s);const h=this.inUseTextures.get(s);if(h){const f=h.indexOf(c.texture);if(f!==-1){h.splice(f,1);let l=this.idleTextures.get(s);l||(l=[],this.idleTextures.set(s,l)),l.push(c.texture)}}}s&&!p||(u.Logger.verbose("TextureManager",`Deleting texture of size ${c.width}x${c.height}`),this.glContext.deleteTexture(c.texture))}toTensorData(c,p){switch(c){case"int16":return p instanceof Int16Array?p:Int16Array.from(p);case"int32":return p instanceof Int32Array?p:Int32Array.from(p);case"int8":return p instanceof Int8Array?p:Int8Array.from(p);case"uint16":return p instanceof Uint16Array?p:Uint16Array.from(p);case"uint32":return p instanceof Uint32Array?p:Uint32Array.from(p);case"uint8":case"bool":return p instanceof Uint8Array?p:Uint8Array.from(p);case"float32":return p instanceof Float32Array?p:Float32Array.from(p);case"float64":return p instanceof Float64Array?p:Float64Array.from(p);default:throw new Error(`TensorData type ${c} is not supported`)}}toTextureData(c,p){if(p)return p instanceof Float32Array?p:new Float32Array(p)}toEncoderType(c){return"float"}clearActiveTextures(){this.glContext.clearActiveTextures()}}},2039:(b,n)=>{var a;Object.defineProperty(n,"__esModule",{value:!0}),n.TextureType=void 0,(a=n.TextureType||(n.TextureType={}))[a.unpacked=0]="unpacked",a[a.unpackedReversed=1]="unpackedReversed",a[a.packed=2]="packed",a[a.downloadUint8AsFloat=3]="downloadUint8AsFloat",a[a.packedLastDimension=4]="packedLastDimension"},9390:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.getGlChannels=n.getCoordsDataType=n.getSqueezedParams=n.squeezeInputShape=n.generateShaderFuncNameFromInputSamplerNameAtOutCoords=n.generateShaderFuncNameFromInputSamplerName=n.repeatedTry=n.getPackedShape=void 0;const u=a(2517);n.getPackedShape=function(c){const p=c.length;return c.slice(0,p-1).concat(c[p-1]/4)},n.repeatedTry=async function(c,p=h=>0,s){return new Promise((h,f)=>{let l=0;const o=()=>{if(c())return void h();l++;const t=p(l);s!=null&&l>=s?f():setTimeout(o,t)};o()})},n.generateShaderFuncNameFromInputSamplerName=function(c){return(0,u.assert)(c!==void 0&&c.length!==0,()=>"empty string found for sampler name"),"get"+c.charAt(0).toUpperCase()+c.slice(1)},n.generateShaderFuncNameFromInputSamplerNameAtOutCoords=function(c){return(0,u.assert)(c!==void 0&&c.length!==0,()=>"empty string found for sampler name"),"get"+c.charAt(0).toUpperCase()+c.slice(1)+"AtOutCoords"},n.squeezeInputShape=function(c,p){let s=JSON.parse(JSON.stringify(c));return s=p,s},n.getSqueezedParams=function(c,p){return p.map(s=>c[s]).join(", ")},n.getCoordsDataType=function(c){if(c<=1)return"int";if(c===2)return"ivec2";if(c===3)return"ivec3";if(c===4)return"ivec4";if(c===5)return"ivec5";if(c===6)return"ivec6";throw Error(`GPU for rank ${c} is not yet supported`)},n.getGlChannels=function(c=6){return["x","y","z","w","u","v"].slice(0,c)}},7305:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createNewWebGLContext=n.createWebGLContext=void 0;const u=a(6231),c=a(1713),p={};function s(h){const f=function(){if(typeof document>"u"){if(typeof OffscreenCanvas>"u")throw new TypeError("failed to create canvas: OffscreenCanvas is not supported");return new OffscreenCanvas(1,1)}const t=document.createElement("canvas");return t.width=1,t.height=1,t}();let l;const o={alpha:!1,depth:!1,antialias:!1,stencil:!1,preserveDrawingBuffer:!1,premultipliedAlpha:!1,failIfMajorPerformanceCaveat:!1};if((!h||h==="webgl2")&&(l=f.getContext("webgl2",o),l))try{return new c.WebGLContext(l,2)}catch(t){u.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl2'. Error: ${t}`)}if((!h||h==="webgl")&&(l=f.getContext("webgl",o)||f.getContext("experimental-webgl",o),l))try{return new c.WebGLContext(l,1)}catch(t){u.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl' or 'experimental-webgl'. Error: ${t}`)}throw new Error("WebGL is not supported")}n.createWebGLContext=function h(f){let l;f&&f!=="webgl2"||!("webgl2"in p)?f&&f!=="webgl"||!("webgl"in p)||(l=p.webgl):l=p.webgl2,l=l||s(f),f=f||l.version===1?"webgl":"webgl2";const o=l.gl;return p[f]=l,o.isContextLost()?(delete p[f],h(f)):(o.disable(o.DEPTH_TEST),o.disable(o.STENCIL_TEST),o.disable(o.BLEND),o.disable(o.DITHER),o.disable(o.POLYGON_OFFSET_FILL),o.disable(o.SAMPLE_COVERAGE),o.enable(o.SCISSOR_TEST),o.enable(o.CULL_FACE),o.cullFace(o.BACK),l)},n.createNewWebGLContext=s},1713:function(b,n,a){var u=this&&this.__createBinding||(Object.create?function(o,t,e,r){r===void 0&&(r=e);var i=Object.getOwnPropertyDescriptor(t,e);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(o,r,i)}:function(o,t,e,r){r===void 0&&(r=e),o[r]=t[e]}),c=this&&this.__setModuleDefault||(Object.create?function(o,t){Object.defineProperty(o,"default",{enumerable:!0,value:t})}:function(o,t){o.default=t}),p=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var t={};if(o!=null)for(var e in o)e!=="default"&&Object.prototype.hasOwnProperty.call(o,e)&&u(t,o,e);return c(t,o),t};Object.defineProperty(n,"__esModule",{value:!0}),n.WebGLContext=n.linearSearchLastTrue=void 0;const s=a(1670),h=p(a(7769)),f=a(9390);function l(o){let t=0;for(;t this.isTimerResultAvailable(o)),this.getTimerResult(o)}async createAndWaitForFence(){const o=this.createFence(this.gl);return this.pollFence(o)}createFence(o){let t;const e=o,r=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);return o.flush(),t=r===null?()=>!0:()=>{const i=e.clientWaitSync(r,0,0);return i===e.ALREADY_SIGNALED||i===e.CONDITION_SATISFIED},{query:r,isFencePassed:t}}async pollFence(o){return new Promise(t=>{this.addItemToPoll(()=>o.isFencePassed(),()=>t())})}pollItems(){const o=l(this.itemsToPoll.map(t=>t.isDoneFn));for(let t=0;t<=o;++t){const{resolveFn:e}=this.itemsToPoll[t];e()}this.itemsToPoll=this.itemsToPoll.slice(o+1)}async addItemToPoll(o,t){this.itemsToPoll.push({isDoneFn:o,resolveFn:t}),this.itemsToPoll.length>1||await(0,f.repeatedTry)(()=>(this.pollItems(),this.itemsToPoll.length===0))}}},1036:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ExecutionPlan=void 0;const u=a(6231);class c{constructor(s,h){this.op=s,this.node=h}}n.ExecutionPlan=class{constructor(p,s,h){this.graph=p,this.profiler=h,this.initialize(s)}initialize(p){this.profiler.event("session","ExecutionPlan.initialize",()=>{const s=this.graph.getNodes();if(s.length!==p.length)throw new Error("The size of nodes and OPs do not match.");this._ops=p.map((h,f)=>new c(h,s[f])),this.reset(),this._starter=[],this._ops.forEach((h,f)=>{let l=!0;for(const o of h.node.inputs)if(!this._values[o]&&this.graph.getInputIndices().indexOf(o)===-1){l=!1;break}l&&this._starter.push(f)})})}reset(){this._values=this.graph.getValues().map(p=>p.tensor)}async execute(p,s){return this.profiler.event("session","ExecutionPlan.execute",async()=>{this.reset();const h=p.createInferenceHandler(),f=this.graph.getInputIndices();if(s.length!==f.length)throw new Error(`number of input tensors don't match the number of inputs to the model: actual: ${s.length} expected: ${f.length}`);s.forEach((i,d)=>{const g=f[d];this._values[g]=i});const l=this._starter.slice(0),o=this.graph.getValues(),t=this.graph.getNodes();let e=0;for(;e this._values[w]);if(g.indexOf(void 0)!==-1)throw new Error(`unresolved input detected: op: ${d.node}`);const m=g;u.Logger.verbose("ExecPlan",`Runing op:${d.node.name} (${m.map((w,v)=>`'${d.node.inputs[v]}': ${w.type}[${w.dims.join(",")}]`).join(", ")})`);const _=await this.profiler.event("node",d.node.name,async()=>d.op.impl(h,m,d.op.context));if(_.length!==d.node.outputs.length)throw new Error("the size of output does not match model definition.");_.forEach((w,v)=>{const S=d.node.outputs[v];if(this._values[S])throw new Error(`output [${S}] already has value: op:${d.node.name}`);this._values[S]=w});const y=new Set;_.forEach((w,v)=>{const S=d.node.outputs[v];for(const O of o[S].to){const A=t[O];let T=!0;for(const M of A.inputs)if(!this._values[M]){T=!1;break}T&&y.add(O)}}),l.push(...y)}const r=[];for(let i=0;i {Object.defineProperty(n,"__esModule",{value:!0}),n.Graph=void 0;const u=a(1446),c=a(7778),p=a(9395),s=a(9162),h=a(2517);var f=p.onnxruntime.experimental.fbs;n.Graph={from:(e,r)=>new t(e,r)};class l{constructor(r){this._from=void 0,this._to=[],this.tensor=void 0,this.type=void 0,r&&(this.type=h.ProtoUtil.tensorValueTypeFromProto(r.type.tensorType))}get from(){return this._from}get to(){return this._to}}class o{constructor(r,i){r instanceof u.onnx.NodeProto?(this.name=r.name,this.opType=r.opType,this.attributes=new c.Attribute(r.attribute)):r instanceof f.Node&&(this.name=i??r.name(),this.opType=r.opType(),this.attributes=new c.Attribute(h.ProtoUtil.tensorAttributesFromORTFormat(r))),this.inputs=[],this.outputs=[],this.executeNode=!0}}class t{constructor(r,i){if(!r)throw new TypeError("graph is empty");this.buildGraph(r),this.transformGraph(i),this.checkIsAcyclic()}getInputIndices(){return this._allInputIndices}getInputNames(){return this._allInputNames}getOutputIndices(){return this._allOutputIndices}getOutputNames(){return this._allOutputNames}getValues(){return this._allData}getNodes(){return this._nodes}buildGraph(r){if(r instanceof u.onnx.GraphProto)this.buildGraphFromOnnxFormat(r);else{if(!(r instanceof f.Graph))throw new TypeError("Graph type is not supported.");this.buildGraphFromOrtFormat(r)}}buildGraphFromOnnxFormat(r){const i=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];const d=new Map;if(!r.input)throw new Error("missing information in graph: input");const g=[];for(const m of r.input){if(i.has(m.name))throw new Error(`duplicated input name: ${m.name}`);const _=this._allData.push(new l(m))-1;i.set(m.name,_),g.push(m.name)}if(!r.initializer)throw new Error("missing information in graph: initializer");for(const m of r.initializer){let _=i.get(m.name);if(_===void 0){const y=new l;y.type={shape:{dims:h.ProtoUtil.tensorDimsFromProto(m.dims)},tensorType:h.ProtoUtil.tensorDataTypeFromProto(m.dataType)},_=this._allData.push(y)-1,i.set(m.name,_)}this._allData[_]._from=-1,this._allData[_].tensor=s.Tensor.fromProto(m)}for(let m=0;m {this._allData[g]._to.forEach(m=>{r.add(m)})});const i=Array.from(r),d=new Array(this._nodes.length).fill("white");for(;i.length>0;){const g=i.pop();d[g]==="gray"?d[g]="black":(i.push(g),d[g]="gray",this._nodes[g].outputs.forEach(m=>{const _=this._allData[m];if(_.tensor!==void 0)throw new Error("node outputs should not be initialized");if(_._from!==g)throw new Error("from property of the Value object doesn't match index of Node being processed");_._to.forEach(y=>{if(d[y]==="gray")throw new Error("model graph is cyclic");d[y]==="white"&&i.push(y)})}))}}transformGraph(r){this.removeAllIdentityNodes(),this.removeAllDropoutNodes(),this.fuseConvActivationNodes(),r&&r.transformGraph(this),this.finalizeGraph()}finalizeGraph(){let r=0;for(let i=0;i 0&&(this._nodes[i].inputs.forEach(d=>{const g=this._allData[d]._to.indexOf(i+r);g!==-1&&(this._allData[d]._to[g]=i)}),this._nodes[i].outputs.forEach(d=>{this._allData[d]._from&&this._allData[d]._from===i+r&&(this._allData[d]._from=i)})):(r++,this._nodes[i].outputs.forEach(d=>{this._allData[d]._from=-2}),this._nodes.splice(i,1),i--);r=0;for(let i=0;i 0){let d=-1;this._allData[i].from!==void 0&&this._allData[i].from!==-1?(d=this._nodes[this._allData[i].from].outputs.indexOf(i+r),d!==-1&&(this._nodes[this._allData[i].from].outputs[d]=i)):(d=this._allInputIndices.indexOf(i+r),d!==-1&&(this._allInputIndices[d]=i)),this._allData[i].to.forEach(g=>{d=this._nodes[g].inputs.indexOf(i+r),d!==-1&&(this._nodes[g].inputs[d]=i)}),this._allData[i].to.length===0&&(d=this._allOutputIndices.indexOf(i+r),d!==-1&&(this._allOutputIndices[d]=i))}}else r++,this._allData.splice(i,1),i--}deleteNode(r){const i=this._nodes[r];if(i.outputs.length>1){for(let w=1;w 0)throw new Error("Node deletion with more than one output connected to other nodes is not supported. ")}i.executeNode=!1;const d=i.inputs[0],g=i.outputs[0],m=this._allData[g].to,_=this._allData[d].to.indexOf(r);if(_===-1)throw new Error("The Value object doesn't have the current Node in it's 'to' property ");this._allData[d].to.splice(_,1),this._allData[g]._to=[];const y=this._allOutputIndices.indexOf(g);if(y!==-1&&(this._allOutputIndices[y]=d),m&&m.length>0)for(const w of m){const v=this._nodes[w].inputs.indexOf(g);if(v===-1)throw new Error("The Node object doesn't have the output Value in it's 'inputs' property ");this._nodes[w].inputs[v]=d,this._allData[d].to.push(w)}}removeAllDropoutNodes(){let r=0;for(const i of this._nodes){if(i.opType==="Dropout"){if(i.inputs.length!==1)throw new Error("Dropout nodes should only contain one input. ");if(i.outputs.length!==1&&i.outputs.length!==2)throw new Error("Dropout nodes should contain either 1 or 2 output(s)");if(i.outputs.length===2&&this._allData[i.outputs[1]]._to.length!==0)throw new Error("Dropout nodes's second output should not be referenced by other nodes");this.deleteNode(r)}r++}}removeAllIdentityNodes(){let r=0;for(const i of this._nodes)i.opType==="Identity"&&this.deleteNode(r),r++}isActivation(r){switch(r.opType){case"Relu":case"Sigmoid":case"Clip":return!0;default:return!1}}fuseConvActivationNodes(){for(const r of this._nodes)if(r.opType==="Conv"){const i=this._allData[r.outputs[0]]._to;if(i.length===1&&this.isActivation(this._nodes[i[0]])){const d=this._nodes[i[0]];if(d.opType==="Clip")if(d.inputs.length===1)try{r.attributes.set("activation_params","floats",[d.attributes.getFloat("min"),d.attributes.getFloat("max")])}catch{r.attributes.set("activation_params","floats",[h.MIN_CLIP,h.MAX_CLIP])}else{if(!(d.inputs.length>=3&&this._allData[d.inputs[1]].tensor!==void 0&&this._allData[d.inputs[2]].tensor!==void 0))continue;r.attributes.set("activation_params","floats",[this._allData[d.inputs[1]].tensor.floatData[0],this._allData[d.inputs[2]].tensor.floatData[0]])}r.attributes.set("activation","string",d.opType),this.deleteNode(i[0])}}}}},6231:(b,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.now=n.Profiler=n.Logger=void 0;const a={verbose:1e3,info:2e3,warning:4e3,error:5e3,fatal:6e3},u={none:new class{log(o,t,e){}},console:new class{log(o,t,e){console.log(`${this.color(o)} ${e?"\x1B[35m"+e+"\x1B[0m ":""}${t}`)}color(o){switch(o){case"verbose":return"\x1B[34;40mv\x1B[0m";case"info":return"\x1B[32mi\x1B[0m";case"warning":return"\x1B[30;43mw\x1B[0m";case"error":return"\x1B[31;40me\x1B[0m";case"fatal":return"\x1B[101mf\x1B[0m";default:throw new Error(`unsupported severity: ${o}`)}}}},c={provider:"console",minimalSeverity:"warning",logDateTime:!0,logSourceLocation:!1};let p={"":c};function s(o,t,e,r){if(t===void 0)return i=o,{verbose:s.verbose.bind(null,i),info:s.info.bind(null,i),warning:s.warning.bind(null,i),error:s.error.bind(null,i),fatal:s.fatal.bind(null,i)};if(e===void 0)h(o,t);else if(typeof e=="number"&&r===void 0)h(o,t);else if(typeof e=="string"&&r===void 0)h(o,e,0,t);else{if(typeof e!="string"||typeof r!="number")throw new TypeError("input is valid");h(o,e,0,t)}var i}function h(o,t,e,r){const i=p[r||""]||p[""];a[o]{g.then(async y=>{i&&await i.end(),m(y)},async y=>{i&&await i.end(),_(y)})});if(!d&&i){const m=i.end();if(m&&typeof m.then=="function")return new Promise((_,y)=>{m.then(()=>{_(g)},w=>{y(w)})})}return g}begin(o,t,e){if(!this._started)throw new Error("profiler is not started yet");if(e===void 0){const r=(0,n.now)();return this.flush(r),new f(o,t,r,i=>this.endSync(i))}{const r=e.beginTimer();return new f(o,t,0,async i=>this.end(i),r,e)}}async end(o){const t=await o.checkTimer();this._timingEvents.length =this._flushBatchSize||o-this._flushTime>=this._flushIntervalInMilliseconds){for(const t=this._flushPointer;this._flushPointer performance.now():Date.now},2644:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Model=void 0;const u=a(5686),c=a(1446),p=a(7070),s=a(9395),h=a(2517);var f=s.onnxruntime.experimental.fbs;n.Model=class{constructor(){}load(l,o,t){if(!t)try{return void this.loadFromOnnxFormat(l,o)}catch(e){if(t!==void 0)throw e}this.loadFromOrtFormat(l,o)}loadFromOnnxFormat(l,o){const t=c.onnx.ModelProto.decode(l);if(h.LongUtil.longToNumber(t.irVersion)<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=t.opsetImport.map(e=>({domain:e.domain,version:h.LongUtil.longToNumber(e.version)})),this._graph=p.Graph.from(t.graph,o)}loadFromOrtFormat(l,o){const t=new u.flatbuffers.ByteBuffer(l),e=f.InferenceSession.getRootAsInferenceSession(t).model();if(h.LongUtil.longToNumber(e.irVersion())<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=[];for(let r=0;r {Object.defineProperty(n,"__esModule",{value:!0}),n.FLOAT_TYPES=n.INT_TYPES=n.NUMBER_TYPES=void 0,n.NUMBER_TYPES=["float32","float64","int32","int16","int8","uint16","uint32","uint8"],n.INT_TYPES=["int32","int16","int8","uint16","uint32","uint8"],n.FLOAT_TYPES=["float32","float64"]},1047:(b,n)=>{function a(u,c){if(c.endsWith("+")){const p=Number.parseInt(c.substring(0,c.length-1),10);return!isNaN(p)&&p<=u}if(c.split("-").length===2){const p=c.split("-"),s=Number.parseInt(p[0],10),h=Number.parseInt(p[1],10);return!isNaN(s)&&!isNaN(h)&&s<=u&&u<=h}return Number.parseInt(c,10)===u}Object.defineProperty(n,"__esModule",{value:!0}),n.resolveOperator=void 0,n.resolveOperator=function(u,c,p){for(const s of p){const h=s[0],f=s[1],l=s[2],o=s[3],t=s[4];if(u.opType===h){for(const e of c)if((e.domain===f||e.domain==="ai.onnx"&&f==="")&&a(e.version,l))return{opImpl:o,opInit:t}}}throw new TypeError(`cannot resolve operator '${u.opType}' with opsets: ${c.map(s=>`${s.domain||"ai.onnx"} v${s.version}`).join(", ")}`)}},9395:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.onnxruntime=void 0;const u=a(5686);var c,p;c=n.onnxruntime||(n.onnxruntime={}),function(s){(function(h){h[h.UNDEFINED=0]="UNDEFINED",h[h.FLOAT=1]="FLOAT",h[h.INT=2]="INT",h[h.STRING=3]="STRING",h[h.TENSOR=4]="TENSOR",h[h.GRAPH=5]="GRAPH",h[h.FLOATS=6]="FLOATS",h[h.INTS=7]="INTS",h[h.STRINGS=8]="STRINGS",h[h.TENSORS=9]="TENSORS",h[h.GRAPHS=10]="GRAPHS",h[h.SPARSE_TENSOR=11]="SPARSE_TENSOR",h[h.SPARSE_TENSORS=12]="SPARSE_TENSORS"})(s.AttributeType||(s.AttributeType={}))}((p=c.experimental||(c.experimental={})).fbs||(p.fbs={})),function(s){(function(h){(function(f){(function(l){l[l.UNKNOWN=0]="UNKNOWN",l[l.VALUE=1]="VALUE",l[l.PARAM=2]="PARAM"})(f.DimensionValueType||(f.DimensionValueType={}))})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){(function(l){l[l.UNDEFINED=0]="UNDEFINED",l[l.FLOAT=1]="FLOAT",l[l.UINT8=2]="UINT8",l[l.INT8=3]="INT8",l[l.UINT16=4]="UINT16",l[l.INT16=5]="INT16",l[l.INT32=6]="INT32",l[l.INT64=7]="INT64",l[l.STRING=8]="STRING",l[l.BOOL=9]="BOOL",l[l.FLOAT16=10]="FLOAT16",l[l.DOUBLE=11]="DOUBLE",l[l.UINT32=12]="UINT32",l[l.UINT64=13]="UINT64",l[l.COMPLEX64=14]="COMPLEX64",l[l.COMPLEX128=15]="COMPLEX128",l[l.BFLOAT16=16]="BFLOAT16"})(f.TensorDataType||(f.TensorDataType={}))})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){(function(l){l[l.Primitive=0]="Primitive",l[l.Fused=1]="Fused"})(f.NodeType||(f.NodeType={}))})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){(function(l){l[l.NONE=0]="NONE",l[l.tensor_type=1]="tensor_type",l[l.sequence_type=2]="sequence_type",l[l.map_type=3]="map_type"})(f.TypeInfoValue||(f.TypeInfoValue={}))})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsShape(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsShape(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}dim(t,e){let r=this.bb.__offset(this.bb_pos,4);return r?(e||new s.experimental.fbs.Dimension).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}dimLength(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}static startShape(t){t.startObject(1)}static addDim(t,e){t.addFieldOffset(0,e,0)}static createDimVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startDimVector(t,e){t.startVector(4,e,4)}static endShape(t){return t.endObject()}static createShape(t,e){return l.startShape(t),l.addDim(t,e),l.endShape(t)}}f.Shape=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDimension(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDimension(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}value(t){let e=this.bb.__offset(this.bb_pos,4);return e?(t||new s.experimental.fbs.DimensionValue).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}denotation(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startDimension(t){t.startObject(2)}static addValue(t,e){t.addFieldOffset(0,e,0)}static addDenotation(t,e){t.addFieldOffset(1,e,0)}static endDimension(t){return t.endObject()}static createDimension(t,e,r){return l.startDimension(t),l.addValue(t,e),l.addDenotation(t,r),l.endDimension(t)}}f.Dimension=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDimensionValue(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDimensionValue(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}dimType(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):s.experimental.fbs.DimensionValueType.UNKNOWN}dimValue(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}dimParam(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}static startDimensionValue(t){t.startObject(3)}static addDimType(t,e){t.addFieldInt8(0,e,s.experimental.fbs.DimensionValueType.UNKNOWN)}static addDimValue(t,e){t.addFieldInt64(1,e,t.createLong(0,0))}static addDimParam(t,e){t.addFieldOffset(2,e,0)}static endDimensionValue(t){return t.endObject()}static createDimensionValue(t,e,r,i){return l.startDimensionValue(t),l.addDimType(t,e),l.addDimValue(t,r),l.addDimParam(t,i),l.endDimensionValue(t)}}f.DimensionValue=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTensorTypeAndShape(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTensorTypeAndShape(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}elemType(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):s.experimental.fbs.TensorDataType.UNDEFINED}shape(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new s.experimental.fbs.Shape).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startTensorTypeAndShape(t){t.startObject(2)}static addElemType(t,e){t.addFieldInt32(0,e,s.experimental.fbs.TensorDataType.UNDEFINED)}static addShape(t,e){t.addFieldOffset(1,e,0)}static endTensorTypeAndShape(t){return t.endObject()}static createTensorTypeAndShape(t,e,r){return l.startTensorTypeAndShape(t),l.addElemType(t,e),l.addShape(t,r),l.endTensorTypeAndShape(t)}}f.TensorTypeAndShape=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMapType(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMapType(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}keyType(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):s.experimental.fbs.TensorDataType.UNDEFINED}valueType(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new s.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startMapType(t){t.startObject(2)}static addKeyType(t,e){t.addFieldInt32(0,e,s.experimental.fbs.TensorDataType.UNDEFINED)}static addValueType(t,e){t.addFieldOffset(1,e,0)}static endMapType(t){return t.endObject()}static createMapType(t,e,r){return l.startMapType(t),l.addKeyType(t,e),l.addValueType(t,r),l.endMapType(t)}}f.MapType=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSequenceType(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSequenceType(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}elemType(t){let e=this.bb.__offset(this.bb_pos,4);return e?(t||new s.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startSequenceType(t){t.startObject(1)}static addElemType(t,e){t.addFieldOffset(0,e,0)}static endSequenceType(t){return t.endObject()}static createSequenceType(t,e){return l.startSequenceType(t),l.addElemType(t,e),l.endSequenceType(t)}}f.SequenceType=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(h.fbs||(h.fbs={})).EdgeEnd=class{constructor(){this.bb=null,this.bb_pos=0}__init(f,l){return this.bb_pos=f,this.bb=l,this}nodeIndex(){return this.bb.readUint32(this.bb_pos)}srcArgIndex(){return this.bb.readInt32(this.bb_pos+4)}dstArgIndex(){return this.bb.readInt32(this.bb_pos+8)}static createEdgeEnd(f,l,o,t){return f.prep(4,12),f.writeInt32(t),f.writeInt32(o),f.writeInt32(l),f.offset()}}})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNodeEdge(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNodeEdge(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}nodeIndex(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readUint32(this.bb_pos+t):0}inputEdges(t,e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new s.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+r)+12*t,this.bb):null}inputEdgesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}outputEdges(t,e){let r=this.bb.__offset(this.bb_pos,8);return r?(e||new s.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+r)+12*t,this.bb):null}outputEdgesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static startNodeEdge(t){t.startObject(3)}static addNodeIndex(t,e){t.addFieldInt32(0,e,0)}static addInputEdges(t,e){t.addFieldOffset(1,e,0)}static startInputEdgesVector(t,e){t.startVector(12,e,4)}static addOutputEdges(t,e){t.addFieldOffset(2,e,0)}static startOutputEdgesVector(t,e){t.startVector(12,e,4)}static endNodeEdge(t){return t.endObject()}static createNodeEdge(t,e,r,i){return l.startNodeEdge(t),l.addNodeIndex(t,e),l.addInputEdges(t,r),l.addOutputEdges(t,i),l.endNodeEdge(t)}}f.NodeEdge=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNode(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNode(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}domain(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}sinceVersion(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0}index(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readUint32(this.bb_pos+t):0}opType(t){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}type(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):s.experimental.fbs.NodeType.Primitive}executionProviderType(t){let e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__string(this.bb_pos+e,t):null}inputs(t,e){let r=this.bb.__offset(this.bb_pos,20);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}inputsLength(){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0}outputs(t,e){let r=this.bb.__offset(this.bb_pos,22);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}outputsLength(){let t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0}attributes(t,e){let r=this.bb.__offset(this.bb_pos,24);return r?(e||new s.experimental.fbs.Attribute).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}attributesLength(){let t=this.bb.__offset(this.bb_pos,24);return t?this.bb.__vector_len(this.bb_pos+t):0}inputArgCounts(t){let e=this.bb.__offset(this.bb_pos,26);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+4*t):0}inputArgCountsLength(){let t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0}inputArgCountsArray(){let t=this.bb.__offset(this.bb_pos,26);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}implicitInputs(t,e){let r=this.bb.__offset(this.bb_pos,28);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}implicitInputsLength(){let t=this.bb.__offset(this.bb_pos,28);return t?this.bb.__vector_len(this.bb_pos+t):0}static startNode(t){t.startObject(13)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addDomain(t,e){t.addFieldOffset(2,e,0)}static addSinceVersion(t,e){t.addFieldInt32(3,e,0)}static addIndex(t,e){t.addFieldInt32(4,e,0)}static addOpType(t,e){t.addFieldOffset(5,e,0)}static addType(t,e){t.addFieldInt32(6,e,s.experimental.fbs.NodeType.Primitive)}static addExecutionProviderType(t,e){t.addFieldOffset(7,e,0)}static addInputs(t,e){t.addFieldOffset(8,e,0)}static createInputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startInputsVector(t,e){t.startVector(4,e,4)}static addOutputs(t,e){t.addFieldOffset(9,e,0)}static createOutputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startOutputsVector(t,e){t.startVector(4,e,4)}static addAttributes(t,e){t.addFieldOffset(10,e,0)}static createAttributesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startAttributesVector(t,e){t.startVector(4,e,4)}static addInputArgCounts(t,e){t.addFieldOffset(11,e,0)}static createInputArgCountsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addInt32(e[r]);return t.endVector()}static startInputArgCountsVector(t,e){t.startVector(4,e,4)}static addImplicitInputs(t,e){t.addFieldOffset(12,e,0)}static createImplicitInputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startImplicitInputsVector(t,e){t.startVector(4,e,4)}static endNode(t){return t.endObject()}static createNode(t,e,r,i,d,g,m,_,y,w,v,S,O,A){return l.startNode(t),l.addName(t,e),l.addDocString(t,r),l.addDomain(t,i),l.addSinceVersion(t,d),l.addIndex(t,g),l.addOpType(t,m),l.addType(t,_),l.addExecutionProviderType(t,y),l.addInputs(t,w),l.addOutputs(t,v),l.addAttributes(t,S),l.addInputArgCounts(t,O),l.addImplicitInputs(t,A),l.endNode(t)}}f.Node=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsValueInfo(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsValueInfo(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}type(t){let e=this.bb.__offset(this.bb_pos,8);return e?(t||new s.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startValueInfo(t){t.startObject(3)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addType(t,e){t.addFieldOffset(2,e,0)}static endValueInfo(t){return t.endObject()}static createValueInfo(t,e,r,i){return l.startValueInfo(t),l.addName(t,e),l.addDocString(t,r),l.addType(t,i),l.endValueInfo(t)}}f.ValueInfo=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTypeInfo(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTypeInfo(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}denotation(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}valueType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):s.experimental.fbs.TypeInfoValue.NONE}value(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}static startTypeInfo(t){t.startObject(3)}static addDenotation(t,e){t.addFieldOffset(0,e,0)}static addValueType(t,e){t.addFieldInt8(1,e,s.experimental.fbs.TypeInfoValue.NONE)}static addValue(t,e){t.addFieldOffset(2,e,0)}static endTypeInfo(t){return t.endObject()}static createTypeInfo(t,e,r,i){return l.startTypeInfo(t),l.addDenotation(t,e),l.addValueType(t,r),l.addValue(t,i),l.endTypeInfo(t)}}f.TypeInfo=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsOperatorSetId(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsOperatorSetId(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}domain(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}version(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}static startOperatorSetId(t){t.startObject(2)}static addDomain(t,e){t.addFieldOffset(0,e,0)}static addVersion(t,e){t.addFieldInt64(1,e,t.createLong(0,0))}static endOperatorSetId(t){return t.endObject()}static createOperatorSetId(t,e,r){return l.startOperatorSetId(t),l.addDomain(t,e),l.addVersion(t,r),l.endOperatorSetId(t)}}f.OperatorSetId=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTensor(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTensor(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}dims(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}dimsLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}dataType(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):s.experimental.fbs.TensorDataType.UNDEFINED}rawData(t){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0}rawDataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}rawDataArray(){let t=this.bb.__offset(this.bb_pos,12);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}stringData(t,e){let r=this.bb.__offset(this.bb_pos,14);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}stringDataLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}static startTensor(t){t.startObject(6)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addDims(t,e){t.addFieldOffset(2,e,0)}static createDimsVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startDimsVector(t,e){t.startVector(8,e,8)}static addDataType(t,e){t.addFieldInt32(3,e,s.experimental.fbs.TensorDataType.UNDEFINED)}static addRawData(t,e){t.addFieldOffset(4,e,0)}static createRawDataVector(t,e){t.startVector(1,e.length,1);for(let r=e.length-1;r>=0;r--)t.addInt8(e[r]);return t.endVector()}static startRawDataVector(t,e){t.startVector(1,e,1)}static addStringData(t,e){t.addFieldOffset(5,e,0)}static createStringDataVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startStringDataVector(t,e){t.startVector(4,e,4)}static endTensor(t){return t.endObject()}static createTensor(t,e,r,i,d,g,m){return l.startTensor(t),l.addName(t,e),l.addDocString(t,r),l.addDims(t,i),l.addDataType(t,d),l.addRawData(t,g),l.addStringData(t,m),l.endTensor(t)}}f.Tensor=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSparseTensor(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSparseTensor(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}values(t){let e=this.bb.__offset(this.bb_pos,4);return e?(t||new s.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}indices(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new s.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dims(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}dimsLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSparseTensor(t){t.startObject(3)}static addValues(t,e){t.addFieldOffset(0,e,0)}static addIndices(t,e){t.addFieldOffset(1,e,0)}static addDims(t,e){t.addFieldOffset(2,e,0)}static createDimsVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startDimsVector(t,e){t.startVector(8,e,8)}static endSparseTensor(t){return t.endObject()}static createSparseTensor(t,e,r,i){return l.startSparseTensor(t),l.addValues(t,e),l.addIndices(t,r),l.addDims(t,i),l.endSparseTensor(t)}}f.SparseTensor=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsAttribute(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsAttribute(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}type(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):s.experimental.fbs.AttributeType.UNDEFINED}f(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readFloat32(this.bb_pos+t):0}i(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}s(t){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}t(t){let e=this.bb.__offset(this.bb_pos,16);return e?(t||new s.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}g(t){let e=this.bb.__offset(this.bb_pos,18);return e?(t||new s.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}floats(t){let e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0}floatsLength(){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0}floatsArray(){let t=this.bb.__offset(this.bb_pos,20);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}ints(t){let e=this.bb.__offset(this.bb_pos,22);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}intsLength(){let t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0}strings(t,e){let r=this.bb.__offset(this.bb_pos,24);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}stringsLength(){let t=this.bb.__offset(this.bb_pos,24);return t?this.bb.__vector_len(this.bb_pos+t):0}tensors(t,e){let r=this.bb.__offset(this.bb_pos,26);return r?(e||new s.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}tensorsLength(){let t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0}graphs(t,e){let r=this.bb.__offset(this.bb_pos,28);return r?(e||new s.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}graphsLength(){let t=this.bb.__offset(this.bb_pos,28);return t?this.bb.__vector_len(this.bb_pos+t):0}static startAttribute(t){t.startObject(13)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addType(t,e){t.addFieldInt32(2,e,s.experimental.fbs.AttributeType.UNDEFINED)}static addF(t,e){t.addFieldFloat32(3,e,0)}static addI(t,e){t.addFieldInt64(4,e,t.createLong(0,0))}static addS(t,e){t.addFieldOffset(5,e,0)}static addT(t,e){t.addFieldOffset(6,e,0)}static addG(t,e){t.addFieldOffset(7,e,0)}static addFloats(t,e){t.addFieldOffset(8,e,0)}static createFloatsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addFloat32(e[r]);return t.endVector()}static startFloatsVector(t,e){t.startVector(4,e,4)}static addInts(t,e){t.addFieldOffset(9,e,0)}static createIntsVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startIntsVector(t,e){t.startVector(8,e,8)}static addStrings(t,e){t.addFieldOffset(10,e,0)}static createStringsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startStringsVector(t,e){t.startVector(4,e,4)}static addTensors(t,e){t.addFieldOffset(11,e,0)}static createTensorsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startTensorsVector(t,e){t.startVector(4,e,4)}static addGraphs(t,e){t.addFieldOffset(12,e,0)}static createGraphsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startGraphsVector(t,e){t.startVector(4,e,4)}static endAttribute(t){return t.endObject()}static createAttribute(t,e,r,i,d,g,m,_,y,w,v,S,O,A){return l.startAttribute(t),l.addName(t,e),l.addDocString(t,r),l.addType(t,i),l.addF(t,d),l.addI(t,g),l.addS(t,m),l.addT(t,_),l.addG(t,y),l.addFloats(t,w),l.addInts(t,v),l.addStrings(t,S),l.addTensors(t,O),l.addGraphs(t,A),l.endAttribute(t)}}f.Attribute=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsGraph(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsGraph(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}initializers(t,e){let r=this.bb.__offset(this.bb_pos,4);return r?(e||new s.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}initializersLength(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}nodeArgs(t,e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new s.experimental.fbs.ValueInfo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}nodeArgsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}nodes(t,e){let r=this.bb.__offset(this.bb_pos,8);return r?(e||new s.experimental.fbs.Node).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}maxNodeIndex(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readUint32(this.bb_pos+t):0}nodeEdges(t,e){let r=this.bb.__offset(this.bb_pos,12);return r?(e||new s.experimental.fbs.NodeEdge).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}nodeEdgesLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}inputs(t,e){let r=this.bb.__offset(this.bb_pos,14);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}inputsLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}outputs(t,e){let r=this.bb.__offset(this.bb_pos,16);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}outputsLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}sparseInitializers(t,e){let r=this.bb.__offset(this.bb_pos,18);return r?(e||new s.experimental.fbs.SparseTensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}sparseInitializersLength(){let t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}static startGraph(t){t.startObject(8)}static addInitializers(t,e){t.addFieldOffset(0,e,0)}static createInitializersVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startInitializersVector(t,e){t.startVector(4,e,4)}static addNodeArgs(t,e){t.addFieldOffset(1,e,0)}static createNodeArgsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startNodeArgsVector(t,e){t.startVector(4,e,4)}static addNodes(t,e){t.addFieldOffset(2,e,0)}static createNodesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startNodesVector(t,e){t.startVector(4,e,4)}static addMaxNodeIndex(t,e){t.addFieldInt32(3,e,0)}static addNodeEdges(t,e){t.addFieldOffset(4,e,0)}static createNodeEdgesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startNodeEdgesVector(t,e){t.startVector(4,e,4)}static addInputs(t,e){t.addFieldOffset(5,e,0)}static createInputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startInputsVector(t,e){t.startVector(4,e,4)}static addOutputs(t,e){t.addFieldOffset(6,e,0)}static createOutputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startOutputsVector(t,e){t.startVector(4,e,4)}static addSparseInitializers(t,e){t.addFieldOffset(7,e,0)}static createSparseInitializersVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startSparseInitializersVector(t,e){t.startVector(4,e,4)}static endGraph(t){return t.endObject()}static createGraph(t,e,r,i,d,g,m,_,y){return l.startGraph(t),l.addInitializers(t,e),l.addNodeArgs(t,r),l.addNodes(t,i),l.addMaxNodeIndex(t,d),l.addNodeEdges(t,g),l.addInputs(t,m),l.addOutputs(t,_),l.addSparseInitializers(t,y),l.endGraph(t)}}f.Graph=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsModel(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsModel(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}irVersion(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}opsetImport(t,e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new s.experimental.fbs.OperatorSetId).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}opsetImportLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}producerName(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}producerVersion(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}domain(t){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__string(this.bb_pos+e,t):null}modelVersion(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}docString(t){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__string(this.bb_pos+e,t):null}graph(t){let e=this.bb.__offset(this.bb_pos,18);return e?(t||new s.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}graphDocString(t){let e=this.bb.__offset(this.bb_pos,20);return e?this.bb.__string(this.bb_pos+e,t):null}static startModel(t){t.startObject(9)}static addIrVersion(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addOpsetImport(t,e){t.addFieldOffset(1,e,0)}static createOpsetImportVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startOpsetImportVector(t,e){t.startVector(4,e,4)}static addProducerName(t,e){t.addFieldOffset(2,e,0)}static addProducerVersion(t,e){t.addFieldOffset(3,e,0)}static addDomain(t,e){t.addFieldOffset(4,e,0)}static addModelVersion(t,e){t.addFieldInt64(5,e,t.createLong(0,0))}static addDocString(t,e){t.addFieldOffset(6,e,0)}static addGraph(t,e){t.addFieldOffset(7,e,0)}static addGraphDocString(t,e){t.addFieldOffset(8,e,0)}static endModel(t){return t.endObject()}static createModel(t,e,r,i,d,g,m,_,y,w){return l.startModel(t),l.addIrVersion(t,e),l.addOpsetImport(t,r),l.addProducerName(t,i),l.addProducerVersion(t,d),l.addDomain(t,g),l.addModelVersion(t,m),l.addDocString(t,_),l.addGraph(t,y),l.addGraphDocString(t,w),l.endModel(t)}}f.Model=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKernelCreateInfos(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKernelCreateInfos(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}nodeIndices(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readUint32(this.bb.__vector(this.bb_pos+e)+4*t):0}nodeIndicesLength(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}nodeIndicesArray(){let t=this.bb.__offset(this.bb_pos,4);return t?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}kernelDefHashes(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}kernelDefHashesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}static startKernelCreateInfos(t){t.startObject(2)}static addNodeIndices(t,e){t.addFieldOffset(0,e,0)}static createNodeIndicesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addInt32(e[r]);return t.endVector()}static startNodeIndicesVector(t,e){t.startVector(4,e,4)}static addKernelDefHashes(t,e){t.addFieldOffset(1,e,0)}static createKernelDefHashesVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startKernelDefHashesVector(t,e){t.startVector(8,e,8)}static endKernelCreateInfos(t){return t.endObject()}static createKernelCreateInfos(t,e,r){return l.startKernelCreateInfos(t),l.addNodeIndices(t,e),l.addKernelDefHashes(t,r),l.endKernelCreateInfos(t)}}f.KernelCreateInfos=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSubGraphSessionState(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSubGraphSessionState(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}graphId(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}sessionState(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new s.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startSubGraphSessionState(t){t.startObject(2)}static addGraphId(t,e){t.addFieldOffset(0,e,0)}static addSessionState(t,e){t.addFieldOffset(1,e,0)}static endSubGraphSessionState(t){let e=t.endObject();return t.requiredField(e,4),e}static createSubGraphSessionState(t,e,r){return l.startSubGraphSessionState(t),l.addGraphId(t,e),l.addSessionState(t,r),l.endSubGraphSessionState(t)}}f.SubGraphSessionState=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSessionState(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSessionState(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}kernels(t){let e=this.bb.__offset(this.bb_pos,4);return e?(t||new s.experimental.fbs.KernelCreateInfos).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}subGraphSessionStates(t,e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new s.experimental.fbs.SubGraphSessionState).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}subGraphSessionStatesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSessionState(t){t.startObject(2)}static addKernels(t,e){t.addFieldOffset(0,e,0)}static addSubGraphSessionStates(t,e){t.addFieldOffset(1,e,0)}static createSubGraphSessionStatesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startSubGraphSessionStatesVector(t,e){t.startVector(4,e,4)}static endSessionState(t){return t.endObject()}static createSessionState(t,e,r){return l.startSessionState(t),l.addKernels(t,e),l.addSubGraphSessionStates(t,r),l.endSessionState(t)}}f.SessionState=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={})),function(s){(function(h){(function(f){class l{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInferenceSession(t,e){return(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInferenceSession(t,e){return t.setPosition(t.position()+u.flatbuffers.SIZE_PREFIX_LENGTH),(e||new l).__init(t.readInt32(t.position())+t.position(),t)}static bufferHasIdentifier(t){return t.__has_identifier("ORTM")}ortVersion(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}model(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new s.experimental.fbs.Model).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}sessionState(t){let e=this.bb.__offset(this.bb_pos,8);return e?(t||new s.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startInferenceSession(t){t.startObject(3)}static addOrtVersion(t,e){t.addFieldOffset(0,e,0)}static addModel(t,e){t.addFieldOffset(1,e,0)}static addSessionState(t,e){t.addFieldOffset(2,e,0)}static endInferenceSession(t){return t.endObject()}static finishInferenceSessionBuffer(t,e){t.finish(e,"ORTM")}static finishSizePrefixedInferenceSessionBuffer(t,e){t.finish(e,"ORTM",!0)}static createInferenceSession(t,e,r,i){return l.startInferenceSession(t),l.addOrtVersion(t,e),l.addModel(t,r),l.addSessionState(t,i),l.endInferenceSession(t)}}f.InferenceSession=l})(h.fbs||(h.fbs={}))})(s.experimental||(s.experimental={}))}(n.onnxruntime||(n.onnxruntime={}))},7448:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.OnnxjsSessionHandler=void 0;const u=a(1670),c=a(9162);n.OnnxjsSessionHandler=class{constructor(p){this.session=p,this.inputNames=this.session.inputNames,this.outputNames=this.session.outputNames}async dispose(){}async run(p,s,h){const f=new Map;for(const t in p)if(Object.hasOwnProperty.call(p,t)){const e=p[t];f.set(t,new c.Tensor(e.dims,e.type,void 0,void 0,e.data))}const l=await this.session.run(f),o={};return l.forEach((t,e)=>{o[e]=new u.Tensor(t.type,t.data,t.dims)}),o}startProfiling(){this.session.startProfiling()}endProfiling(){this.session.endProfiling()}}},6919:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Session=void 0;const u=a(7067),c=a(1296),p=a(7091),s=a(1036),h=a(6231),f=a(2644);n.Session=class{constructor(l={}){this._initialized=!1,this.backendHint=l.backendHint,this.profiler=h.Profiler.create(l.profiler),this.context={profiler:this.profiler,graphInputTypes:[],graphInputDims:[]}}get inputNames(){return this._model.graph.getInputNames()}get outputNames(){return this._model.graph.getOutputNames()}startProfiling(){this.profiler.start()}endProfiling(){this.profiler.stop()}async loadModel(l,o,t){await this.profiler.event("session","Session.loadModel",async()=>{const e=await(0,p.resolveBackend)(this.backendHint);if(this.sessionHandler=e.createSessionHandler(this.context),this._model=new f.Model,typeof l=="string"){const r=l.endsWith(".ort");if(typeof fetch>"u"){const i=await(0,c.promisify)(u.readFile)(l);this.initialize(i,r)}else{const i=await fetch(l),d=await i.arrayBuffer();this.initialize(new Uint8Array(d),r)}}else if(ArrayBuffer.isView(l))this.initialize(l);else{const r=new Uint8Array(l,o||0,t||l.byteLength);this.initialize(r)}})}initialize(l,o){if(this._initialized)throw new Error("already initialized");this.profiler.event("session","Session.initialize",()=>{const t=this.sessionHandler.transformGraph?this.sessionHandler:void 0;this._model.load(l,t,o),this.sessionHandler.onGraphInitialized&&this.sessionHandler.onGraphInitialized(this._model.graph),this.initializeOps(this._model.graph),this._executionPlan=new s.ExecutionPlan(this._model.graph,this._ops,this.profiler)}),this._initialized=!0}async run(l){if(!this._initialized)throw new Error("session not initialized yet");return this.profiler.event("session","Session.run",async()=>{const o=this.normalizeAndValidateInputs(l),t=await this._executionPlan.execute(this.sessionHandler,o);return this.createOutput(t)})}normalizeAndValidateInputs(l){const o=this._model.graph.getInputNames();if(Array.isArray(l)){if(l.length!==o.length)throw new Error(`incorrect input array length: expected ${o.length} but got ${l.length}`)}else{if(l.size!==o.length)throw new Error(`incorrect input map size: expected ${o.length} but got ${l.size}`);const t=new Array(l.size);let e=0;for(let r=0;r typeof A=="string")))throw new TypeError("cache should be a string array");O&&(this.cache=new Array(S))}else{if(w!==void 0){const A=e(m);if(!(w instanceof A))throw new TypeError(`cache should be type ${A.name}`)}if(O){const A=new ArrayBuffer(S*function(T){switch(T){case"bool":case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;case"float64":return 8;default:throw new Error(`cannot calculate sizeof() on type ${T}`)}}(m));this.cache=function(T,M){return new(e(M))(T)}(A,m)}}}static fromProto(g){if(!g)throw new Error("cannot construct Value from an empty tensor");const m=f.ProtoUtil.tensorDataTypeFromProto(g.dataType),_=f.ProtoUtil.tensorDimsFromProto(g.dims),y=new o(_,m);if(m==="string")g.stringData.forEach((w,v)=>{y.data[v]=(0,f.decodeUtf8String)(w)});else if(g.rawData&&typeof g.rawData.byteLength=="number"&&g.rawData.byteLength>0){const w=y.data,v=new DataView(g.rawData.buffer,g.rawData.byteOffset,g.rawData.byteLength),S=t(g.dataType),O=g.rawData.byteLength/S;if(g.rawData.byteLength%S!=0)throw new Error("invalid buffer length");if(w.length!==O)throw new Error("buffer length mismatch");for(let A=0;A 0){const w=y.data,v=new DataView(g.rawDataArray().buffer,g.rawDataArray().byteOffset,g.rawDataLength()),S=t(g.dataType()),O=g.rawDataLength()/S;if(g.rawDataLength()%S!=0)throw new Error("invalid buffer length");if(w.length!==O)throw new Error("buffer length mismatch");for(let A=0;A 1&&M>1)return;O[S-A]=Math.max(T,M)}return O}static index(m,_){const y=new Array(_.length);return l.fillIndex(m,_,y),y}static fillIndex(m,_,y){const w=m.length-_.length;for(let v=0;v<_.length;v++)y[v]=m[w+v]%_[v]}static calc(m,_,y,w,v){const S=l.calcShape(m.dims,_.dims);if(S){if(w&&!e.areEqual(S,m.dims))return;const O=e.size(S),A=w?m:new h.Tensor(S,v||m.type);if(S.length===0)A.set([],y(m.get([]),_.get([])));else{const T=new Array(S.length),M=new Array(m.dims.length),N=new Array(_.dims.length);let B,$=0,L=0,H=!1,C=!1;m.dims.length===0&&($=m.get([]),H=!0),_.dims.length===0&&(L=_.get([]),C=!0);for(let z=0;z =0;J--)T[J]=B%S[J],B=Math.floor(B/S[J]);H||(l.fillIndex(T,m.dims,M),$=m.get(M)),C||(l.fillIndex(T,_.dims,N),L=_.get(N)),A.set(T,y($,L))}}return A}}static isValidBroadcast(m,_){const y=m.length,w=_.length;if(y>w)return!1;for(let v=1;v<=y;v++)if(m[y-v]!==1&&m[y-v]!==_[w-v])return!1;return!0}static getBroadcastDims(m,_){const y=m.length,w=[];for(let v=0;v 1&&O===1&&w.unshift(S)}return w}}n.BroadcastUtil=l,n.arrayCopyHelper=function(g,m,_,y,w){if(y<0||y>=m.length)throw new Error("sourceIndex out of bounds");if(_<0||_>=g.length)throw new Error("targetIndex out of bounds");if(y+w>m.length)throw new Error("source indices to be copied are outside bounds");if(_+w>g.length)throw new Error("target array is too small to hold result");for(let v=0;v p.default.isLong(_)?_.toNumber():_)}static tensorValueTypeFromProto(m){return{tensorType:o.tensorDataTypeFromProto(m.elemType),shape:{dims:o.tensorDimsFromProto(m.shape.dim.map(_=>_.dimValue))}}}static tensorDimsFromORTFormat(m){const _=[];for(let y=0;y m.length)throw new Error(`invalid dimension of ${_} for sizeFromDimension as Tensor has ${m.length} dimensions.`);return e.getSizeFromDimensionRange(m,_,m.length)}static sizeToDimension(m,_){if(_<0||_>m.length)throw new Error(`invalid dimension of ${_} for sizeToDimension as Tensor has ${m.length} dimensions.`);return e.getSizeFromDimensionRange(m,0,_)}static getSizeFromDimensionRange(m,_,y){let w=1;for(let v=_;v =0;--w)y[w]=y[w+1]*m[w+1];return y}static transpose(m){return m.slice().reverse()}static indicesToOffset(m,_,y){y===void 0&&(y=m.length);let w=0;for(let v=0;v =_)throw new Error("unsupported axis for this operation.");return m<0?m+_:m}static normalizeAxes(m,_){return m.map(y=>this.normalizeAxis(y,_))}static incrementIndex(m,_,y){if(_.length===0||m.length===0)throw new Error("Index incrementing unsupported for scalar Tensor");if(y===void 0)y=_.length;else if(y<=0||y>_.length)throw new Error("Incorrect axis to increment on");for(let w=y-1;w>=0&&(m[w]++,!(m[w]<_[w]));--w)m[w]=0}static calculateReshapedDims(m,_){if(_.length===0){if(m.length===0||e.size(m)===1)return[];throw new Error("cannot reshape to a scalar Tensor")}const y=_.length,w=new Array(y);let v=-1,S=1;for(let A=0;A =m.length)throw new Error("the dimension with value zero exceeds the dimension size of the input tensor");w[A]=m[A]}else w[A]=_[A];S*=w[A]}}const O=e.size(m);if(v!==-1){if(O%S!=0)throw new Error(`the input tensor cannot be reshaped to the requested shape. Input shape: [${m}] Output shape: [${_}]`);w[v]=O/S}else if(S!==O)throw new Error("reshapedDims and originalDims don't have matching sizes");return w}static sortBasedOnPerm(m,_){return _?_.map(y=>m[y]):m.slice().reverse()}static padShape(m,_){const y=m.length;return m.map((w,v)=>w+_[v]+_[v+y])}static areEqual(m,_){return m.length===_.length&&m.every((y,w)=>y===_[w])}static validateDimsAndCalcSize(m){if(m.length>6)throw new TypeError("Only rank 0 to 6 is supported for tensor shape.");let _=1;for(const y of m){if(!Number.isInteger(y))throw new TypeError(`Invalid shape: ${y} is not an integer`);if(y<0||y>2147483647)throw new TypeError(`Invalid shape: length ${y} is not allowed`);_*=y}return _}static flattenShape(m,_){_<0&&(_+=m.length);const y=m.reduce((v,S)=>v*S,1),w=m.slice(_).reduce((v,S)=>v*S,1);return[y/w,w]}static squeezeShape(m,_){const y=new Array;_=e.normalizeAxes(_,m.length);for(let w=0;w =0;if(v&&m[w]!==1)throw new Error("squeeze an axis of size different than 1");(_.length===0&&m[w]>1||_.length>0&&!v)&&y.push(m[w])}return y}static unsqueezeShape(m,_){const y=new Array(m.length+_.length);y.fill(0);for(let v=0;v<_.length;v++){const S=e.normalizeAxis(_[v],y.length);if(S>=y.length)throw new Error("'axes' has an out of range axis");if(y[S]!==0)throw new Error("'axes' has a duplicate axis");y[S]=1}let w=0;for(let v=0;v =m.length)throw new Error("sourceIndex out of bounds");if(_<0||_>=g.length)throw new Error("targetIndex out of bounds");if(y+w>m.length)throw new Error("source indices to be copied are outside bounds");if(_+w>g.length)throw new Error("target array is too small to hold result");for(let v=0;v =m.length)throw new Error("sourceIndex out of bounds");if(_<0||_>=g.length)throw new Error("targetIndex out of bounds");if(y+w>m.length)throw new Error("source indices to be copied are outside bounds");if(_+w>g.length)throw new Error("target array is too small to hold result");for(let S=0;S =m.length)throw new Error("sourceIndex out of bounds");if(_<0||_>=g.length)throw new Error("targetIndex out of bounds");if(y+w>m.length)throw new Error("source indices to be copied are outside bounds");if(_+w>g.length)throw new Error("target array is too small to hold result");for(let S=0;S =m.length)throw new Error("sourceIndex out of bounds");if(_<0||_>=g.length)throw new Error("targetIndex out of bounds");if(y+w>m.length)throw new Error("source indices to be copied are outside bounds");if(_+w>g.length)throw new Error("target array is too small to hold result");for(let v=0;v _.push(L));const O=i.calcReduceShape(S,_,!0),A=e.size(O),T=new h.Tensor(O,m.type),M=e.computeStrides(O),N=e.computeStrides(S),B=new Array(S.length);for(let $=0;$=_.length)return S(m[v]);const T=_[w],M=T>=y.length?1:e.size(y.slice(T+1));for(let N=0;N v!==0)}}n.ReduceUtil=i;class d{static adjustPoolAttributes(m,_,y,w,v,S){if(!m&&y.length!==_.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(m)for(let O=0;O<_.length-2;O++)O>=y.length?y.push(_[O+2]):y[O]=_[O+2];for(let O=0;O =y[O]||S[O+y.length]>=y[O])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(m,_,y,w,v,S){if(S){if(v.length!==2*(m.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(_.length!==m.length-2)throw new Error("length of strides should be the length of data dimensions");if(w.length!==m.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let O=0;O {Object.defineProperty(n,"__esModule",{value:!0}),n.iterateExtraOptions=void 0,n.iterateExtraOptions=(a,u,c,p)=>{if(typeof a=="object"&&a!==null){if(c.has(a))throw new Error("Circular reference in options");c.add(a)}Object.entries(a).forEach(([s,h])=>{const f=u?u+s:s;if(typeof h=="object")(0,n.iterateExtraOptions)(h,f+".",c,p);else if(typeof h=="string"||typeof h=="number")p(f,h.toString());else{if(typeof h!="boolean")throw new Error("Can't handle extra config type: "+typeof h);p(f,h?"1":"0")}})}},2157:function(b,n,a){var u,c=this&&this.__createBinding||(Object.create?function(M,N,B,$){$===void 0&&($=B);var L=Object.getOwnPropertyDescriptor(N,B);L&&!("get"in L?!N.__esModule:L.writable||L.configurable)||(L={enumerable:!0,get:function(){return N[B]}}),Object.defineProperty(M,$,L)}:function(M,N,B,$){$===void 0&&($=B),M[$]=N[B]}),p=this&&this.__setModuleDefault||(Object.create?function(M,N){Object.defineProperty(M,"default",{enumerable:!0,value:N})}:function(M,N){M.default=N}),s=this&&this.__importStar||function(M){if(M&&M.__esModule)return M;var N={};if(M!=null)for(var B in M)B!=="default"&&Object.prototype.hasOwnProperty.call(M,B)&&c(N,M,B);return p(N,M),N};Object.defineProperty(n,"__esModule",{value:!0}),n.endProfiling=n.run=n.releaseSession=n.createSession=n.createSessionFinalize=n.createSessionAllocate=n.initOrt=n.initWasm=void 0;const h=a(1670),f=s(a(349)),l=a(6361),o=()=>!!h.env.wasm.proxy&&typeof document<"u";let t,e,r,i=!1,d=!1,g=!1;const m=[],_=[],y=[],w=[],v=[],S=[],O=()=>{if(i||!d||g||!t)throw new Error("worker not ready")},A=M=>{switch(M.data.type){case"init-wasm":i=!1,M.data.err?(g=!0,e[1](M.data.err)):(d=!0,e[0]());break;case"init-ort":M.data.err?r[1](M.data.err):r[0]();break;case"create_allocate":M.data.err?m.shift()[1](M.data.err):m.shift()[0](M.data.out);break;case"create_finalize":M.data.err?_.shift()[1](M.data.err):_.shift()[0](M.data.out);break;case"create":M.data.err?y.shift()[1](M.data.err):y.shift()[0](M.data.out);break;case"release":M.data.err?w.shift()[1](M.data.err):w.shift()[0]();break;case"run":M.data.err?v.shift()[1](M.data.err):v.shift()[0](M.data.out);break;case"end-profiling":M.data.err?S.shift()[1](M.data.err):S.shift()[0]()}},T=typeof document<"u"?(u=document==null?void 0:document.currentScript)===null||u===void 0?void 0:u.src:void 0;n.initWasm=async()=>{if(o()){if(d)return;if(i)throw new Error("multiple calls to 'initWasm()' detected.");if(g)throw new Error("previous call to 'initWasm()' failed.");return i=!0,h.env.wasm.wasmPaths===void 0&&T&&T.indexOf("blob:")!==0&&(h.env.wasm.wasmPaths=T.substr(0,+T.lastIndexOf("/")+1)),new Promise((M,N)=>{t==null||t.terminate(),t=a(9710).Z(),t.onmessage=A,e=[M,N];const B={type:"init-wasm",in:h.env.wasm};t.postMessage(B)})}return(0,l.initializeWebAssembly)(h.env.wasm)},n.initOrt=async(M,N)=>{if(o())return O(),new Promise((B,$)=>{r=[B,$];const L={type:"init-ort",in:{numThreads:M,loggingLevel:N}};t.postMessage(L)});f.initOrt(M,N)},n.createSessionAllocate=async M=>o()?(O(),new Promise((N,B)=>{m.push([N,B]);const $={type:"create_allocate",in:{model:M}};t.postMessage($,[M.buffer])})):f.createSessionAllocate(M),n.createSessionFinalize=async(M,N)=>o()?(O(),new Promise((B,$)=>{_.push([B,$]);const L={type:"create_finalize",in:{modeldata:M,options:N}};t.postMessage(L)})):f.createSessionFinalize(M,N),n.createSession=async(M,N)=>o()?(O(),new Promise((B,$)=>{y.push([B,$]);const L={type:"create",in:{model:M,options:N}};t.postMessage(L,[M.buffer])})):f.createSession(M,N),n.releaseSession=async M=>{if(o())return O(),new Promise((N,B)=>{w.push([N,B]);const $={type:"release",in:M};t.postMessage($)});f.releaseSession(M)},n.run=async(M,N,B,$,L)=>o()?(O(),new Promise((H,C)=>{v.push([H,C]);const z={type:"run",in:{sessionId:M,inputIndices:N,inputs:B,outputIndices:$,options:L}};t.postMessage(z,f.extractTransferableBuffers(B))})):f.run(M,N,B,$,L),n.endProfiling=async M=>{if(o())return O(),new Promise((N,B)=>{S.push([N,B]);const $={type:"end-profiling",in:M};t.postMessage($)});f.endProfiling(M)}},586:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.setRunOptions=void 0;const u=a(7967),c=a(4983),p=a(6361);n.setRunOptions=s=>{const h=(0,p.getInstance)();let f=0;const l=[],o=s||{};try{if((s==null?void 0:s.logSeverityLevel)===void 0)o.logSeverityLevel=2;else if(typeof s.logSeverityLevel!="number"||!Number.isInteger(s.logSeverityLevel)||s.logSeverityLevel<0||s.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${s.logSeverityLevel}`);if((s==null?void 0:s.logVerbosityLevel)===void 0)o.logVerbosityLevel=0;else if(typeof s.logVerbosityLevel!="number"||!Number.isInteger(s.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${s.logVerbosityLevel}`);(s==null?void 0:s.terminate)===void 0&&(o.terminate=!1);let t=0;if((s==null?void 0:s.tag)!==void 0&&(t=(0,c.allocWasmString)(s.tag,l)),f=h._OrtCreateRunOptions(o.logSeverityLevel,o.logVerbosityLevel,!!o.terminate,t),f===0)throw new Error("Can't create run options");return(s==null?void 0:s.extra)!==void 0&&(0,u.iterateExtraOptions)(s.extra,"",new WeakSet,(e,r)=>{const i=(0,c.allocWasmString)(e,l),d=(0,c.allocWasmString)(r,l);if(h._OrtAddRunConfigEntry(f,i,d)!==0)throw new Error(`Can't set a run config entry: ${e} - ${r}`)}),[f,l]}catch(t){throw f!==0&&h._OrtReleaseRunOptions(f),l.forEach(h._free),t}}},2306:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.OnnxruntimeWebAssemblySessionHandler=void 0;const u=a(2806),c=a(1670),p=a(2850),s=a(2157);let h;n.OnnxruntimeWebAssemblySessionHandler=class{async createSessionAllocate(f){const l=await fetch(f),o=await l.arrayBuffer();return(0,s.createSessionAllocate)(new Uint8Array(o))}async loadModel(f,l){if(h||(await(0,s.initOrt)(c.env.wasm.numThreads,(o=>{switch(o){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${o}`)}})(c.env.logLevel)),h=!0),typeof f=="string")if(typeof fetch>"u"){const o=await(0,p.promisify)(u.readFile)(f);[this.sessionId,this.inputNames,this.outputNames]=await(0,s.createSession)(o,l)}else{const o=await this.createSessionAllocate(f);[this.sessionId,this.inputNames,this.outputNames]=await(0,s.createSessionFinalize)(o,l)}else[this.sessionId,this.inputNames,this.outputNames]=await(0,s.createSession)(f,l)}async dispose(){return(0,s.releaseSession)(this.sessionId)}async run(f,l,o){const t=[],e=[];Object.entries(f).forEach(g=>{const m=g[0],_=g[1],y=this.inputNames.indexOf(m);if(y===-1)throw new Error(`invalid input '${m}'`);t.push(_),e.push(y)});const r=[];Object.entries(l).forEach(g=>{const m=g[0],_=this.outputNames.indexOf(m);if(_===-1)throw new Error(`invalid output '${m}'`);r.push(_)});const i=await(0,s.run)(this.sessionId,e,t.map(g=>[g.type,g.dims,g.data]),r,o),d={};for(let g=0;g {Object.defineProperty(n,"__esModule",{value:!0}),n.setSessionOptions=void 0;const u=a(7967),c=a(4983),p=a(6361);n.setSessionOptions=s=>{const h=(0,p.getInstance)();let f=0;const l=[],o=s||{};(t=>{t.extra||(t.extra={}),t.extra.session||(t.extra.session={});const e=t.extra.session;e.use_ort_model_bytes_directly||(e.use_ort_model_bytes_directly="1")})(o);try{(s==null?void 0:s.graphOptimizationLevel)===void 0&&(o.graphOptimizationLevel="all");const t=(i=>{switch(i){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${i}`)}})(o.graphOptimizationLevel);(s==null?void 0:s.enableCpuMemArena)===void 0&&(o.enableCpuMemArena=!0),(s==null?void 0:s.enableMemPattern)===void 0&&(o.enableMemPattern=!0),(s==null?void 0:s.executionMode)===void 0&&(o.executionMode="sequential");const e=(i=>{switch(i){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${i}`)}})(o.executionMode);let r=0;if((s==null?void 0:s.logId)!==void 0&&(r=(0,c.allocWasmString)(s.logId,l)),(s==null?void 0:s.logSeverityLevel)===void 0)o.logSeverityLevel=2;else if(typeof s.logSeverityLevel!="number"||!Number.isInteger(s.logSeverityLevel)||s.logSeverityLevel<0||s.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${s.logSeverityLevel}`);if((s==null?void 0:s.logVerbosityLevel)===void 0)o.logVerbosityLevel=0;else if(typeof s.logVerbosityLevel!="number"||!Number.isInteger(s.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${s.logVerbosityLevel}`);if((s==null?void 0:s.enableProfiling)===void 0&&(o.enableProfiling=!1),f=h._OrtCreateSessionOptions(t,!!o.enableCpuMemArena,!!o.enableMemPattern,e,!!o.enableProfiling,0,r,o.logSeverityLevel,o.logVerbosityLevel),f===0)throw new Error("Can't create session options");return s!=null&&s.executionProviders&&((i,d,g)=>{for(const m of d){let _=typeof m=="string"?m:m.name;switch(_){case"xnnpack":_="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${_}`)}const y=(0,c.allocWasmString)(_,g);if((0,p.getInstance)()._OrtAppendExecutionProvider(i,y)!==0)throw new Error(`Can't append execution provider: ${_}`)}})(f,s.executionProviders,l),(s==null?void 0:s.extra)!==void 0&&(0,u.iterateExtraOptions)(s.extra,"",new WeakSet,(i,d)=>{const g=(0,c.allocWasmString)(i,l),m=(0,c.allocWasmString)(d,l);if(h._OrtAddSessionConfigEntry(f,g,m)!==0)throw new Error(`Can't set a session config entry: ${i} - ${d}`)}),[f,l]}catch(t){throw f!==0&&h._OrtReleaseSessionOptions(f),l.forEach(h._free),t}}},4983:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.allocWasmString=void 0;const u=a(6361);n.allocWasmString=(c,p)=>{const s=(0,u.getInstance)(),h=s.lengthBytesUTF8(c)+1,f=s._malloc(h);return s.stringToUTF8(c,f,h),p.push(f),f}},349:(b,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.extractTransferableBuffers=n.endProfiling=n.run=n.releaseSession=n.createSession=n.createSessionFinalize=n.createSessionAllocate=n.initOrt=void 0;const u=a(586),c=a(4919),p=a(4983),s=a(6361);n.initOrt=(t,e)=>{const r=(0,s.getInstance)()._OrtInit(t,e);if(r!==0)throw new Error(`Can't initialize onnxruntime. error code = ${r}`)};const h=new Map;n.createSessionAllocate=t=>{const e=(0,s.getInstance)(),r=e._malloc(t.byteLength);return e.HEAPU8.set(t,r),[r,t.byteLength]},n.createSessionFinalize=(t,e)=>{const r=(0,s.getInstance)();let i=0,d=0,g=[];try{if([d,g]=(0,c.setSessionOptions)(e),i=r._OrtCreateSession(t[0],t[1],d),i===0)throw new Error("Can't create a session")}finally{r._free(t[0]),r._OrtReleaseSessionOptions(d),g.forEach(r._free)}const m=r._OrtGetInputCount(i),_=r._OrtGetOutputCount(i),y=[],w=[],v=[],S=[];for(let O=0;O {const r=(0,n.createSessionAllocate)(t);return(0,n.createSessionFinalize)(r,e)},n.releaseSession=t=>{const e=(0,s.getInstance)(),r=h.get(t);if(!r)throw new Error("invalid session id");const i=r[0],d=r[1],g=r[2];d.forEach(e._OrtFree),g.forEach(e._OrtFree),e._OrtReleaseSession(i),h.delete(t)};const f=t=>{switch(t){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${t}`)}},l=t=>{switch(t){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${t}`)}},o=t=>{switch(t){case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${t}`)}};n.run=(t,e,r,i,d)=>{const g=(0,s.getInstance)(),m=h.get(t);if(!m)throw new Error("invalid session id");const _=m[0],y=m[1],w=m[2],v=e.length,S=i.length;let O=0,A=[];const T=[],M=[];try{[O,A]=(0,u.setRunOptions)(d);for(let C=0;C g.HEAP32[Oe++]=Te);const ce=g._OrtCreateTensor(f(z),te,ne,Me,J.length);if(ce===0)throw new Error("Can't create a tensor");T.push(ce)}finally{g.stackRestore(me)}}const N=g.stackSave(),B=g.stackAlloc(4*v),$=g.stackAlloc(4*v),L=g.stackAlloc(4*S),H=g.stackAlloc(4*S);try{let C=B/4,z=$/4,J=L/4,X=H/4;for(let me=0;me ve*Be);if(Te=l(He),Te==="string"){const ve=[];let Be=ye/4;for(let Ue=0;Ue {const e=(0,s.getInstance)(),r=h.get(t);if(!r)throw new Error("invalid session id");const i=r[0],d=e._OrtEndProfiling(i);if(d===0)throw new Error("Can't get an profile file name");e._OrtFree(d)},n.extractTransferableBuffers=t=>{const e=[];for(const r of t){const i=r[2];!Array.isArray(i)&&i.buffer&&e.push(i.buffer)}return e}},6361:function(b,n,a){var u=this&&this.__createBinding||(Object.create?function(d,g,m,_){_===void 0&&(_=m);var y=Object.getOwnPropertyDescriptor(g,m);y&&!("get"in y?!g.__esModule:y.writable||y.configurable)||(y={enumerable:!0,get:function(){return g[m]}}),Object.defineProperty(d,_,y)}:function(d,g,m,_){_===void 0&&(_=m),d[_]=g[m]}),c=this&&this.__setModuleDefault||(Object.create?function(d,g){Object.defineProperty(d,"default",{enumerable:!0,value:g})}:function(d,g){d.default=g}),p=this&&this.__importStar||function(d){if(d&&d.__esModule)return d;var g={};if(d!=null)for(var m in d)m!=="default"&&Object.prototype.hasOwnProperty.call(d,m)&&u(g,d,m);return c(g,d),g},s=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(n,"__esModule",{value:!0}),n.dispose=n.getInstance=n.initializeWebAssembly=void 0;const h=p(a(6449)),f=s(a(932)),l=a(3474);let o,t=!1,e=!1,r=!1;const i=(d,g)=>g?d?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":d?"ort-wasm-simd.wasm":"ort-wasm.wasm";n.initializeWebAssembly=async d=>{if(t)return Promise.resolve();if(e)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(r)throw new Error("previous call to 'initializeWebAssembly()' failed.");e=!0;const g=d.initTimeout,m=d.numThreads,_=d.simd,y=m>1&&(()=>{try{return typeof SharedArrayBuffer<"u"&&(typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])))}catch{return!1}})(),w=_&&(()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}})(),v=typeof d.wasmPaths=="string"?d.wasmPaths:void 0,S=i(!1,y),O=i(w,y),A=typeof d.wasmPaths=="object"?d.wasmPaths[O]:void 0;let T=!1;const M=[];if(g>0&&M.push(new Promise(N=>{setTimeout(()=>{T=!0,N()},g)})),M.push(new Promise((N,B)=>{const $=y?l:f.default,L={locateFile:(H,C)=>y&&H.endsWith(".worker.js")&&typeof Blob<"u"?URL.createObjectURL(new Blob([a(4154)],{type:"text/javascript"})):H===S?A??(v??C)+O:C+H};if(y)if(typeof Blob>"u")L.mainScriptUrlOrBlob=h.join("/","ort-wasm-threaded.js");else{const H=`var ortWasmThreaded=(function(){var _scriptDir;return ${$.toString()}})();`;L.mainScriptUrlOrBlob=new Blob([H],{type:"text/javascript"})}$(L).then(H=>{e=!1,t=!0,o=H,N()},H=>{e=!1,r=!0,B(H)})})),await Promise.race(M),T)throw new Error(`WebAssembly backend initializing failed due to timeout: ${g}ms`)},n.getInstance=()=>{if(t&&o)return o;throw new Error("WebAssembly is not initialized yet.")},n.dispose=()=>{var d;!t||e||r||(e=!0,(d=o.PThread)===null||d===void 0||d.terminateAllThreads(),o=void 0,e=!1,t=!1,r=!0)}},9710:(b,n,a)=>{a.d(n,{Z:()=>p});var u=a(477),c=a.n(u);function p(){return c()('/*!\n* ONNX Runtime Web v1.14.0\n* Copyright (c) Microsoft Corporation. All rights reserved.\n* Licensed under the MIT License.\n*/\n(()=>{var t={474:(t,e,n)=>{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){function e(){return j.buffer!=D&&N(j.buffer),P}function r(){return j.buffer!=D&&N(j.buffer),U}function a(){return j.buffer!=D&&N(j.buffer),F}function i(){return j.buffer!=D&&N(j.buffer),I}function o(){return j.buffer!=D&&N(j.buffer),W}var u,c,s;t=t||{},u||(u=void 0!==t?t:{}),u.ready=new Promise((function(t,e){c=t,s=e}));var l,f,p,h,d,y,b=Object.assign({},u),m="./this.program",g=(t,e)=>{throw e},v="object"==typeof window,w="function"==typeof importScripts,_="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,O=u.ENVIRONMENT_IS_PTHREAD||!1,A="";function S(t){return u.locateFile?u.locateFile(t,A):A+t}if(_){let e;A=w?n(908).dirname(A)+"/":"//",y=()=>{d||(h=n(384),d=n(908))},l=function(t,e){return y(),t=d.normalize(t),h.readFileSync(t,e?void 0:"utf8")},p=t=>((t=l(t,!0)).buffer||(t=new Uint8Array(t)),t),f=(t,e,n)=>{y(),t=d.normalize(t),h.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1 {if(Q())throw process.exitCode=t,e;e instanceof ct||x("exiting due to exception: "+e),process.exit(t)},u.inspect=function(){return"[Emscripten Module object]"};try{e=n(925)}catch(t){throw console.error(\'The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?\'),t}n.g.Worker=e.Worker}else(v||w)&&(w?A=self.location.href:"undefined"!=typeof document&&document.currentScript&&(A=document.currentScript.src),_scriptDir&&(A=_scriptDir),A=0!==A.indexOf("blob:")?A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):"",_||(l=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},w&&(p=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),f=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)}));_&&"undefined"==typeof performance&&(n.g.performance=n(953).performance);var T=console.log.bind(console),E=console.warn.bind(console);_&&(y(),T=t=>h.writeSync(1,t+"\\n"),E=t=>h.writeSync(2,t+"\\n"));var M,C=u.print||T,x=u.printErr||E;Object.assign(u,b),b=null,u.thisProgram&&(m=u.thisProgram),u.quit&&(g=u.quit),u.wasmBinary&&(M=u.wasmBinary);var R=u.noExitRuntime||!1;"object"!=typeof WebAssembly&&at("no native wasm support detected");var j,k,D,P,U,F,I,W,H=!1,L="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function z(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16 (a=224==(240&a)?(15&a)<<12|i<<6|o:(7&a)<<18|i<<12|o<<6|63&t[e++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function Y(t,e){return(t>>>=0)?z(r(),t,e):""}function B(t,e,n,r){if(!(0 >>=0;r=n+r-1;for(var i=0;i =o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),127>=o){if(n>=r)break;e[n++>>>0]=o}else{if(2047>=o){if(n+1>=r)break;e[n++>>>0]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++>>>0]=224|o>>12}else{if(n+3>=r)break;e[n++>>>0]=240|o>>18,e[n++>>>0]=128|o>>12&63}e[n++>>>0]=128|o>>6&63}e[n++>>>0]=128|63&o}}return e[n>>>0]=0,n-a}function G(t){for(var e=0,n=0;n =r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function N(t){D=t,u.HEAP8=P=new Int8Array(t),u.HEAP16=new Int16Array(t),u.HEAP32=F=new Int32Array(t),u.HEAPU8=U=new Uint8Array(t),u.HEAPU16=new Uint16Array(t),u.HEAPU32=I=new Uint32Array(t),u.HEAPF32=new Float32Array(t),u.HEAPF64=W=new Float64Array(t)}O&&(D=u.buffer);var V=u.INITIAL_MEMORY||16777216;if(O)j=u.wasmMemory,D=u.buffer;else if(u.wasmMemory)j=u.wasmMemory;else if(!((j=new WebAssembly.Memory({initial:V/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw x("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),_&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");j&&(D=j.buffer),V=D.byteLength,N(D);var $,q=[],X=[],J=[],Z=[];function Q(){return R||!1}function K(){var t=u.preRun.shift();q.unshift(t)}var tt,et=0,nt=null,rt=null;function at(t){throw O?postMessage({cmd:"onAbort",arg:t}):u.onAbort&&u.onAbort(t),x(t="Aborted("+t+")"),H=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),s(t),t}function it(){return tt.startsWith("data:application/octet-stream;base64,")}function ot(){var t=tt;try{if(t==tt&&M)return new Uint8Array(M);if(p)return p(t);throw"both async and sync fetching of the wasm failed"}catch(t){at(t)}}tt="ort-wasm-threaded.wasm",it()||(tt=S(tt));var ut={};function ct(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function st(t){(t=ht.Vb[t])||at(),ht.mc(t)}function lt(t){var e=ht.Cc();if(!e)return 6;ht.ac.push(e),ht.Vb[t.Ub]=e,e.Ub=t.Ub;var n={cmd:"run",start_routine:t.Ic,arg:t.zc,pthread_ptr:t.Ub};return e.$b=()=>{n.time=performance.now(),e.postMessage(n,t.Nc)},e.loaded&&(e.$b(),delete e.$b),0}function ft(t){if(O)return $t(1,1,t);Q()||(ht.oc(),u.onExit&&u.onExit(t),H=!0),g(t,new ct(t))}function pt(t,e){if(!e&&O)throw bt(t),"unwind";Q()||O||(me(),dt(J),be(0),re[1].length&&ae(1,10),re[2].length&&ae(2,10),ht.oc()),ft(t)}var ht={Yb:[],ac:[],qc:[],Vb:{},fc:function(){O&&ht.Ec()},Pc:function(){},Ec:function(){ht.receiveObjectTransfer=ht.Gc,ht.threadInitTLS=ht.pc,ht.setExitStatus=ht.nc,R=!1},nc:function(){},oc:function(){for(var t of Object.values(ht.Vb))ht.mc(t);for(t of ht.Yb)t.terminate();ht.Yb=[]},mc:function(t){var e=t.Ub;delete ht.Vb[e],ht.Yb.push(t),ht.ac.splice(ht.ac.indexOf(t),1),t.Ub=0,Oe(e)},Gc:function(){},pc:function(){ht.qc.forEach((t=>t()))},Fc:function(t,e){t.onmessage=n=>{var r=(n=n.data).cmd;if(t.Ub&&(ht.Bc=t.Ub),n.targetThread&&n.targetThread!=he()){var a=ht.Vb[n.Qc];a?a.postMessage(n,n.transferList):x(\'Internal error! Worker sent a message "\'+r+\'" to target pthread \'+n.targetThread+", but that thread no longer exists!")}else"processProxyingQueue"===r?zt(n.queue):"spawnThread"===r?lt(n):"cleanupThread"===r?st(n.thread):"killThread"===r?(n=n.thread,r=ht.Vb[n],delete ht.Vb[n],r.terminate(),Oe(n),ht.ac.splice(ht.ac.indexOf(r),1),r.Ub=0):"cancelThread"===r?ht.Vb[n.thread].postMessage({cmd:"cancel"}):"loaded"===r?(t.loaded=!0,e&&e(t),t.$b&&(t.$b(),delete t.$b)):"print"===r?C("Thread "+n.threadId+": "+n.text):"printErr"===r?x("Thread "+n.threadId+": "+n.text):"alert"===r?alert("Thread "+n.threadId+": "+n.text):"setimmediate"===n.target?t.postMessage(n):"onAbort"===r?u.onAbort&&u.onAbort(n.arg):r&&x("worker sent an unknown command "+r);ht.Bc=void 0},t.onerror=t=>{throw x("worker sent an error! "+t.filename+":"+t.lineno+": "+t.message),t},_&&(t.on("message",(function(e){t.onmessage({data:e})})),t.on("error",(function(e){t.onerror(e)})),t.on("detachedExit",(function(){}))),t.postMessage({cmd:"load",urlOrBlob:u.mainScriptUrlOrBlob||_scriptDir,wasmMemory:j,wasmModule:k})},yc:function(){var t=S("ort-wasm-threaded.worker.js");ht.Yb.push(new Worker(t))},Cc:function(){return 0==ht.Yb.length&&(ht.yc(),ht.Fc(ht.Yb[0])),ht.Yb.pop()}};function dt(t){for(;0 >2>>>0];t=a()[t+48>>2>>>0],Te(e,e-t),Me(e)};var mt=[];function gt(t){var e=mt[t];return e||(t>=mt.length&&(mt.length=t+1),mt[t]=e=$.get(t)),e}u.invokeEntryPoint=function(t,e){t=gt(t)(e),Q()?ht.nc(t):Ae(t)};var vt,wt,_t=[],Ot=0,At=0;function St(t){this.Zb=t,this.Sb=t-24,this.xc=function(t){i()[this.Sb+4>>2>>>0]=t},this.bc=function(){return i()[this.Sb+4>>2>>>0]},this.wc=function(t){i()[this.Sb+8>>2>>>0]=t},this.Dc=function(){return i()[this.Sb+8>>2>>>0]},this.rc=function(){a()[this.Sb>>2>>>0]=0},this.hc=function(t){t=t?1:0,e()[this.Sb+12>>0>>>0]=t},this.uc=function(){return 0!=e()[this.Sb+12>>0>>>0]},this.ic=function(t){t=t?1:0,e()[this.Sb+13>>0>>>0]=t},this.kc=function(){return 0!=e()[this.Sb+13>>0>>>0]},this.fc=function(t,e){this.cc(0),this.xc(t),this.wc(e),this.rc(),this.hc(!1),this.ic(!1)},this.sc=function(){Atomics.add(a(),this.Sb>>2,1)},this.Hc=function(){return 1===Atomics.sub(a(),this.Sb>>2,1)},this.cc=function(t){i()[this.Sb+16>>2>>>0]=t},this.tc=function(){return i()[this.Sb+16>>2>>>0]},this.vc=function(){if(Re(this.bc()))return i()[this.Zb>>2>>>0];var t=this.tc();return 0!==t?t:this.Zb}}function Tt(t){return ye(new St(t).Sb)}function Et(t,e,n,r){return O?$t(3,1,t,e,n,r):Mt(t,e,n,r)}function Mt(t,e,n,r){if("undefined"==typeof SharedArrayBuffer)return x("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var a=[];return O&&0===a.length?Et(t,e,n,r):(t={Ic:n,Ub:t,zc:r,Nc:a},O?(t.Oc="spawnThread",postMessage(t,a),0):lt(t))}function Ct(t,e,n){return O?$t(4,1,t,e,n):0}function xt(t,e){if(O)return $t(5,1,t,e)}function Rt(t,e){if(O)return $t(6,1,t,e)}function jt(t,e,n){if(O)return $t(7,1,t,e,n)}function kt(t,e,n){return O?$t(8,1,t,e,n):0}function Dt(t,e){if(O)return $t(9,1,t,e)}function Pt(t,e,n){if(O)return $t(10,1,t,e,n)}function Ut(t,e,n,r){if(O)return $t(11,1,t,e,n,r)}function Ft(t,e,n,r){if(O)return $t(12,1,t,e,n,r)}function It(t,e,n,r){if(O)return $t(13,1,t,e,n,r)}function Wt(t){if(O)return $t(14,1,t)}function Ht(t,e){if(O)return $t(15,1,t,e)}function Lt(t,e,n){if(O)return $t(16,1,t,e,n)}function zt(t){Atomics.store(a(),t>>2,1),he()&&_e(t),Atomics.compareExchange(a(),t>>2,1,0)}function Yt(t){return i()[t>>>2]+4294967296*a()[t+4>>>2]}function Bt(t,e,n,r,a,i){return O?$t(17,1,t,e,n,r,a,i):-52}function Gt(t,e,n,r,a,i){if(O)return $t(18,1,t,e,n,r,a,i)}function Nt(t){var n=G(t)+1,r=de(n);return r&&B(t,e(),r,n),r}function Vt(t,e,n){function r(t){return(t=t.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?t[1]:"GMT"}if(O)return $t(19,1,t,e,n);var o=(new Date).getFullYear(),u=new Date(o,0,1),c=new Date(o,6,1);o=u.getTimezoneOffset();var s=c.getTimezoneOffset(),l=Math.max(o,s);a()[t>>2>>>0]=60*l,a()[e>>2>>>0]=Number(o!=s),t=r(u),e=r(c),t=Nt(t),e=Nt(e),s >2>>>0]=t,i()[n+4>>2>>>0]=e):(i()[n>>2>>>0]=e,i()[n+4>>2>>>0]=t)}function $t(t,e){var n=arguments.length-2,r=arguments;return yt((()=>{for(var a=Ce(8*n),i=a>>3,u=0;u >>0]=c}return we(t,n,a,e)}))}u.executeNotifiedProxyingQueue=zt,wt=_?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:O?()=>performance.now()-u.__performance_now_clock_drift:()=>performance.now();var qt,Xt=[],Jt={};function Zt(){if(!qt){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:m||"./this.program"};for(t in Jt)void 0===Jt[t]?delete e[t]:e[t]=Jt[t];var n=[];for(t in e)n.push(t+"="+e[t]);qt=n}return qt}function Qt(t,n){if(O)return $t(20,1,t,n);var r=0;return Zt().forEach((function(a,o){var u=n+r;for(o=i()[t+4*o>>2>>>0]=u,u=0;u >0>>>0]=a.charCodeAt(u);e()[o>>0>>>0]=0,r+=a.length+1})),0}function Kt(t,e){if(O)return $t(21,1,t,e);var n=Zt();i()[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),i()[e>>2>>>0]=r,0}function te(t){return O?$t(22,1,t):52}function ee(t,e,n,r){return O?$t(23,1,t,e,n,r):52}function ne(t,e,n,r,a){return O?$t(24,1,t,e,n,r,a):70}var re=[null,[],[]];function ae(t,e){var n=re[t];0===e||10===e?((1===t?C:x)(z(n,0)),n.length=0):n.push(e)}function ie(t,e,n,a){if(O)return $t(25,1,t,e,n,a);for(var o=0,u=0;u >2>>>0],s=i()[e+4>>2>>>0];e+=8;for(var l=0;l >>0]);o+=s}return i()[a>>2>>>0]=o,0}var oe=0;function ue(t){return 0==t%4&&(0!=t%100||0==t%400)}var ce=[31,29,31,30,31,30,31,31,30,31,30,31],se=[31,28,31,30,31,30,31,31,30,31,30,31];function le(t,n,r,i){function o(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.lengtht?-1:0 r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=s(new Date(t.getFullYear(),0,4)),n=s(n),0>=c(e,t)?0>=c(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var f=a()[i+40>>2>>>0];for(var p in i={Lc:a()[i>>2>>>0],Kc:a()[i+4>>2>>>0],dc:a()[i+8>>2>>>0],jc:a()[i+12>>2>>>0],ec:a()[i+16>>2>>>0],Xb:a()[i+20>>2>>>0],Tb:a()[i+24>>2>>>0],Wb:a()[i+28>>2>>>0],Rc:a()[i+32>>2>>>0],Jc:a()[i+36>>2>>>0],Mc:f?Y(f):""},r=Y(r),f={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})r=r.replace(new RegExp(p,"g"),f[p]);var h="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),d="January February March April May June July August September October November December".split(" ");for(p in f={"%a":function(t){return h[t.Tb].substring(0,3)},"%A":function(t){return h[t.Tb]},"%b":function(t){return d[t.ec].substring(0,3)},"%B":function(t){return d[t.ec]},"%C":function(t){return u((t.Xb+1900)/100|0,2)},"%d":function(t){return u(t.jc,2)},"%e":function(t){return o(t.jc,2," ")},"%g":function(t){return l(t).toString().substring(2)},"%G":function(t){return l(t)},"%H":function(t){return u(t.dc,2)},"%I":function(t){return 0==(t=t.dc)?t=12:12 t.dc?"AM":"PM"},"%S":function(t){return u(t.Lc,2)},"%t":function(){return"\\t"},"%u":function(t){return t.Tb||7},"%U":function(t){return u(Math.floor((t.Wb+7-t.Tb)/7),2)},"%V":function(t){var e=Math.floor((t.Wb+7-(t.Tb+6)%7)/7);if(2>=(t.Tb+371-t.Wb-2)%7&&e++,e)53==e&&(4==(n=(t.Tb+371-t.Wb)%7)||3==n&&ue(t.Xb)||(e=1));else{e=52;var n=(t.Tb+7-t.Wb-1)%7;(4==n||5==n&&ue(t.Xb%400-1))&&e++}return u(e,2)},"%w":function(t){return t.Tb},"%W":function(t){return u(Math.floor((t.Wb+7-(t.Tb+6)%7)/7),2)},"%y":function(t){return(t.Xb+1900).toString().substring(2)},"%Y":function(t){return t.Xb+1900},"%z":function(t){var e=0<=(t=t.Jc);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.Mc},"%%":function(){return"%"}},r=r.replace(/%%/g,"\\0\\0"),f)r.includes(p)&&(r=r.replace(new RegExp(p,"g"),f[p](i)));return p=function(t){var e=Array(G(t)+1);return B(t,e,0,e.length),e}(r=r.replace(/\\0\\0/g,"%")),p.length>n?0:(function(t,n){e().set(t,n>>>0)}(p,t),p.length-1)}ht.fc();var fe=[null,ft,bt,Et,Ct,xt,Rt,jt,kt,Dt,Pt,Ut,Ft,It,Wt,Ht,Lt,Bt,Gt,Vt,Qt,Kt,te,ee,ne,ie],pe={b:function(t){return de(t+24)+24},n:function(t){return(t=new St(t)).uc()||(t.hc(!0),Ot--),t.ic(!1),_t.push(t),t.sc(),t.vc()},ma:function(t){throw x("Unexpected exception thrown, this is not properly supported - aborting"),H=!0,t},x:function(){Se(0);var t=_t.pop();if(t.Hc()&&!t.kc()){var e=t.Dc();e&>(e)(t.Zb),Tt(t.Zb)}At=0},e:function(){var t=At;if(!t)return oe=0;var e=new St(t);e.cc(t);var n=e.bc();if(!n)return oe=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a zt(r)));else if(O)postMessage({targetThread:t,cmd:"processProxyingQueue",queue:r});else{if(!(t=ht.Vb[t]))return;t.postMessage({cmd:"processProxyingQueue",queue:r})}return 1},Ea:function(){return-1},Pa:function(t,e){t=new Date(1e3*Yt(t)),a()[e>>2>>>0]=t.getUTCSeconds(),a()[e+4>>2>>>0]=t.getUTCMinutes(),a()[e+8>>2>>>0]=t.getUTCHours(),a()[e+12>>2>>>0]=t.getUTCDate(),a()[e+16>>2>>>0]=t.getUTCMonth(),a()[e+20>>2>>>0]=t.getUTCFullYear()-1900,a()[e+24>>2>>>0]=t.getUTCDay(),t=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,a()[e+28>>2>>>0]=t},Qa:function(t,e){t=new Date(1e3*Yt(t)),a()[e>>2>>>0]=t.getSeconds(),a()[e+4>>2>>>0]=t.getMinutes(),a()[e+8>>2>>>0]=t.getHours(),a()[e+12>>2>>>0]=t.getDate(),a()[e+16>>2>>>0]=t.getMonth(),a()[e+20>>2>>>0]=t.getFullYear()-1900,a()[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1),r=(t.getTime()-n.getTime())/864e5|0;a()[e+28>>2>>>0]=r,a()[e+36>>2>>>0]=-60*t.getTimezoneOffset(),r=new Date(t.getFullYear(),6,1).getTimezoneOffset(),t=0|(r!=(n=n.getTimezoneOffset())&&t.getTimezoneOffset()==Math.min(n,r)),a()[e+32>>2>>>0]=t},Ra:function(t){var e=new Date(a()[t+20>>2>>>0]+1900,a()[t+16>>2>>>0],a()[t+12>>2>>>0],a()[t+8>>2>>>0],a()[t+4>>2>>>0],a()[t>>2>>>0],0),n=a()[t+32>>2>>>0],r=e.getTimezoneOffset(),i=new Date(e.getFullYear(),0,1),o=new Date(e.getFullYear(),6,1).getTimezoneOffset(),u=i.getTimezoneOffset(),c=Math.min(u,o);return 0>n?a()[t+32>>2>>>0]=Number(o!=u&&c==r):0 >2>>>0]=e.getDay(),n=(e.getTime()-i.getTime())/864e5|0,a()[t+28>>2>>>0]=n,a()[t>>2>>>0]=e.getSeconds(),a()[t+4>>2>>>0]=e.getMinutes(),a()[t+8>>2>>>0]=e.getHours(),a()[t+12>>2>>>0]=e.getDate(),a()[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},Aa:Bt,Ba:Gt,Sa:function t(e,n,r){t.Ac||(t.Ac=!0,Vt(e,n,r))},y:function(){at("")},U:function(){if(!_&&!w){var t="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";vt||(vt={}),vt[t]||(vt[t]=1,_&&(t="warning: "+t),x(t))}},ra:function(){return 4294901760},B:wt,Ia:function(t,e,n){r().copyWithin(t>>>0,e>>>0,e+n>>>0)},F:function(){return _?n(993).cpus().length:navigator.hardwareConcurrency},Da:function(t,e,n){Xt.length=e,n>>=3;for(var r=0;r >>0];return(0>t?ut[-t-1]:fe[t]).apply(null,Xt)},qa:function(t){var e=r().length;if((t>>>=0)<=e||4294901760 =n;n*=2){var a=e*(1+.2/n);a=Math.min(a,t+100663296);var i=Math;a=Math.max(t,a),i=i.min.call(i,4294901760,a+(65536-a%65536)%65536);t:{try{j.grow(i-D.byteLength+65535>>>16),N(j.buffer);var o=1;break t}catch(t){}o=void 0}if(o)return!0}return!1},Na:function(){throw"unwind"},Ga:Qt,Ha:Kt,J:pt,I:te,S:ee,ga:ne,R:ie,d:function(){return oe},na:function t(r,a){t.lc||(t.lc=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(_)try{var e=n(Object(function(){var t=new Error("Cannot find module \'crypto\'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>at("randomDevice")}());for(var i=0;i>0>>>0]=t.lc();return 0},ia:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},ja:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},K:function(t){var e=Ee();try{return gt(t)()}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},f:function(t,e){var n=Ee();try{return gt(t)(e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},P:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},Q:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},k:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},p:function(t,e,n,r){var a=Ee();try{return gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},q:function(t,e,n,r,a){var i=Ee();try{return gt(t)(e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},N:function(t,e,n,r,a,i){var o=Ee();try{return gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},s:function(t,e,n,r,a,i){var o=Ee();try{return gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},w:function(t,e,n,r,a,i,o){var u=Ee();try{return gt(t)(e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},L:function(t,e,n,r,a,i,o,u){var c=Ee();try{return gt(t)(e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},E:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=Ee();try{return gt(t)(e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(Me(p),t!==t+0)throw t;Se(1,0)}},aa:function(t,e,n,r,a,i,o,u){var c=Ee();try{return He(t,e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},_:function(t,e,n,r,a,i,o){var u=Ee();try{return ke(t,e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},Z:function(t,e,n,r,a){var i=Ee();try{return Le(t,e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},ca:function(t,e,n,r){var a=Ee();try{return Ie(t,e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},$:function(t){var e=Ee();try{return je(t)}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},ba:function(t,e){var n=Ee();try{return We(t,e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},Y:function(t,e,n){var r=Ee();try{return De(t,e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},g:function(t){var e=Ee();try{gt(t)()}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},r:function(t,e){var n=Ee();try{gt(t)(e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},i:function(t,e,n){var r=Ee();try{gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},ha:function(t,e,n,r){var a=Ee();try{gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},m:function(t,e,n,r){var a=Ee();try{gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},v:function(t,e,n,r,a){var i=Ee();try{gt(t)(e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},u:function(t,e,n,r,a,i){var o=Ee();try{gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},O:function(t,e,n,r,a,i,o){var u=Ee();try{gt(t)(e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},A:function(t,e,n,r,a,i,o,u){var c=Ee();try{gt(t)(e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},ka:function(t,e,n,r,a,i,o,u,c){var s=Ee();try{gt(t)(e,n,r,a,i,o,u,c)}catch(t){if(Me(s),t!==t+0)throw t;Se(1,0)}},C:function(t,e,n,r,a,i,o,u,c,s,l){var f=Ee();try{gt(t)(e,n,r,a,i,o,u,c,s,l)}catch(t){if(Me(f),t!==t+0)throw t;Se(1,0)}},D:function(t,e,n,r,a,i,o,u,c,s,l,f,p,h,d,y){var b=Ee();try{gt(t)(e,n,r,a,i,o,u,c,s,l,f,p,h,d,y)}catch(t){if(Me(b),t!==t+0)throw t;Se(1,0)}},fa:function(t,e,n,r,a,i,o,u){var c=Ee();try{Pe(t,e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},da:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=Ee();try{Fe(t,e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(Me(p),t!==t+0)throw t;Se(1,0)}},ea:function(t,e,n,r,a,i){var o=Ee();try{Ue(t,e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},o:function(t){return t},a:j||u.wasmMemory,G:function(t){oe=t},la:le,z:function(t,e,n,r){return le(t,e,n,r)}};!function(){function t(t,e){u.asm=t.exports,ht.qc.push(u.asm.sb),$=u.asm.ub,X.unshift(u.asm.Va),k=e,O||(et--,u.monitorRunDependencies&&u.monitorRunDependencies(et),0==et&&(null!==nt&&(clearInterval(nt),nt=null),rt&&(t=rt,rt=null,t())))}function e(e){t(e.instance,e.module)}function n(t){return function(){if(!M&&(v||w)){if("function"==typeof fetch&&!tt.startsWith("file://"))return fetch(tt,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+tt+"\'";return t.arrayBuffer()})).catch((function(){return ot()}));if(f)return new Promise((function(t,e){f(tt,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return ot()}))}().then((function(t){return WebAssembly.instantiate(t,r)})).then((function(t){return t})).then(t,(function(t){x("failed to asynchronously prepare wasm: "+t),at(t)}))}var r={a:pe};if(O||(et++,u.monitorRunDependencies&&u.monitorRunDependencies(et)),u.instantiateWasm)try{return u.instantiateWasm(r,t)}catch(t){return x("Module.instantiateWasm callback failed with error: "+t),!1}(M||"function"!=typeof WebAssembly.instantiateStreaming||it()||tt.startsWith("file://")||_||"function"!=typeof fetch?n(e):fetch(tt,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,r).then(e,(function(t){return x("wasm streaming compile failed: "+t),x("falling back to ArrayBuffer instantiation"),n(e)}))}))).catch(s)}(),u.___wasm_call_ctors=function(){return(u.___wasm_call_ctors=u.asm.Va).apply(null,arguments)},u._OrtInit=function(){return(u._OrtInit=u.asm.Wa).apply(null,arguments)},u._OrtCreateSessionOptions=function(){return(u._OrtCreateSessionOptions=u.asm.Xa).apply(null,arguments)},u._OrtAppendExecutionProvider=function(){return(u._OrtAppendExecutionProvider=u.asm.Ya).apply(null,arguments)},u._OrtAddSessionConfigEntry=function(){return(u._OrtAddSessionConfigEntry=u.asm.Za).apply(null,arguments)},u._OrtReleaseSessionOptions=function(){return(u._OrtReleaseSessionOptions=u.asm._a).apply(null,arguments)},u._OrtCreateSession=function(){return(u._OrtCreateSession=u.asm.$a).apply(null,arguments)},u._OrtReleaseSession=function(){return(u._OrtReleaseSession=u.asm.ab).apply(null,arguments)},u._OrtGetInputCount=function(){return(u._OrtGetInputCount=u.asm.bb).apply(null,arguments)},u._OrtGetOutputCount=function(){return(u._OrtGetOutputCount=u.asm.cb).apply(null,arguments)},u._OrtGetInputName=function(){return(u._OrtGetInputName=u.asm.db).apply(null,arguments)},u._OrtGetOutputName=function(){return(u._OrtGetOutputName=u.asm.eb).apply(null,arguments)},u._OrtFree=function(){return(u._OrtFree=u.asm.fb).apply(null,arguments)},u._OrtCreateTensor=function(){return(u._OrtCreateTensor=u.asm.gb).apply(null,arguments)},u._OrtGetTensorData=function(){return(u._OrtGetTensorData=u.asm.hb).apply(null,arguments)},u._OrtReleaseTensor=function(){return(u._OrtReleaseTensor=u.asm.ib).apply(null,arguments)},u._OrtCreateRunOptions=function(){return(u._OrtCreateRunOptions=u.asm.jb).apply(null,arguments)},u._OrtAddRunConfigEntry=function(){return(u._OrtAddRunConfigEntry=u.asm.kb).apply(null,arguments)},u._OrtReleaseRunOptions=function(){return(u._OrtReleaseRunOptions=u.asm.lb).apply(null,arguments)},u._OrtRun=function(){return(u._OrtRun=u.asm.mb).apply(null,arguments)},u._OrtEndProfiling=function(){return(u._OrtEndProfiling=u.asm.nb).apply(null,arguments)};var he=u._pthread_self=function(){return(he=u._pthread_self=u.asm.ob).apply(null,arguments)},de=u._malloc=function(){return(de=u._malloc=u.asm.pb).apply(null,arguments)},ye=u._free=function(){return(ye=u._free=u.asm.qb).apply(null,arguments)},be=u._fflush=function(){return(be=u._fflush=u.asm.rb).apply(null,arguments)};u.__emscripten_tls_init=function(){return(u.__emscripten_tls_init=u.asm.sb).apply(null,arguments)};var me=u.___funcs_on_exit=function(){return(me=u.___funcs_on_exit=u.asm.tb).apply(null,arguments)},ge=u.__emscripten_thread_init=function(){return(ge=u.__emscripten_thread_init=u.asm.vb).apply(null,arguments)};u.__emscripten_thread_crashed=function(){return(u.__emscripten_thread_crashed=u.asm.wb).apply(null,arguments)};var ve,we=u._emscripten_run_in_main_runtime_thread_js=function(){return(we=u._emscripten_run_in_main_runtime_thread_js=u.asm.xb).apply(null,arguments)},_e=u.__emscripten_proxy_execute_task_queue=function(){return(_e=u.__emscripten_proxy_execute_task_queue=u.asm.yb).apply(null,arguments)},Oe=u.__emscripten_thread_free_data=function(){return(Oe=u.__emscripten_thread_free_data=u.asm.zb).apply(null,arguments)},Ae=u.__emscripten_thread_exit=function(){return(Ae=u.__emscripten_thread_exit=u.asm.Ab).apply(null,arguments)},Se=u._setThrew=function(){return(Se=u._setThrew=u.asm.Bb).apply(null,arguments)},Te=u._emscripten_stack_set_limits=function(){return(Te=u._emscripten_stack_set_limits=u.asm.Cb).apply(null,arguments)},Ee=u.stackSave=function(){return(Ee=u.stackSave=u.asm.Db).apply(null,arguments)},Me=u.stackRestore=function(){return(Me=u.stackRestore=u.asm.Eb).apply(null,arguments)},Ce=u.stackAlloc=function(){return(Ce=u.stackAlloc=u.asm.Fb).apply(null,arguments)},xe=u.___cxa_can_catch=function(){return(xe=u.___cxa_can_catch=u.asm.Gb).apply(null,arguments)},Re=u.___cxa_is_pointer_type=function(){return(Re=u.___cxa_is_pointer_type=u.asm.Hb).apply(null,arguments)},je=u.dynCall_j=function(){return(je=u.dynCall_j=u.asm.Ib).apply(null,arguments)},ke=u.dynCall_iiiiij=function(){return(ke=u.dynCall_iiiiij=u.asm.Jb).apply(null,arguments)},De=u.dynCall_jii=function(){return(De=u.dynCall_jii=u.asm.Kb).apply(null,arguments)},Pe=u.dynCall_viiiiij=function(){return(Pe=u.dynCall_viiiiij=u.asm.Lb).apply(null,arguments)},Ue=u.dynCall_vjji=function(){return(Ue=u.dynCall_vjji=u.asm.Mb).apply(null,arguments)},Fe=u.dynCall_viiijjjii=function(){return(Fe=u.dynCall_viiijjjii=u.asm.Nb).apply(null,arguments)},Ie=u.dynCall_iij=function(){return(Ie=u.dynCall_iij=u.asm.Ob).apply(null,arguments)},We=u.dynCall_ji=function(){return(We=u.dynCall_ji=u.asm.Pb).apply(null,arguments)},He=u.dynCall_iiiiiij=function(){return(He=u.dynCall_iiiiiij=u.asm.Qb).apply(null,arguments)},Le=u.dynCall_iiij=function(){return(Le=u.dynCall_iiij=u.asm.Rb).apply(null,arguments)};function ze(){function t(){if(!ve&&(ve=!0,u.calledRun=!0,!H)&&(O||dt(X),c(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),!O)){if(u.postRun)for("function"==typeof u.postRun&&(u.postRun=[u.postRun]);u.postRun.length;){var t=u.postRun.shift();Z.unshift(t)}dt(Z)}}if(!(0 {var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){var e,r,a;t=t||{},e||(e=void 0!==t?t:{}),e.ready=new Promise((function(t,e){r=t,a=e}));var i,o,u,c,s,l,f=Object.assign({},e),p="./this.program",h=(t,e)=>{throw e},d="object"==typeof window,y="function"==typeof importScripts,b="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,m="";b?(m=y?n(908).dirname(m)+"/":"//",l=()=>{s||(c=n(384),s=n(908))},i=function(t,e){return l(),t=s.normalize(t),c.readFileSync(t,e?void 0:"utf8")},u=t=>((t=i(t,!0)).buffer||(t=new Uint8Array(t)),t),o=(t,e,n)=>{l(),t=s.normalize(t),c.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1 {if(_||0 {var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},y&&(u=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),o=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)});var g,v=e.print||console.log.bind(console),w=e.printErr||console.warn.bind(console);Object.assign(e,f),f=null,e.thisProgram&&(p=e.thisProgram),e.quit&&(h=e.quit),e.wasmBinary&&(g=e.wasmBinary);var _=e.noExitRuntime||!1;"object"!=typeof WebAssembly&&V("no native wasm support detected");var O,A,S,T,E,M,C=!1,x="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function R(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16 (a=224==(240&a)?(15&a)<<12|i<<6|o:(7&a)<<18|i<<12|o<<6|63&t[e++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function j(t,e){return(t>>>=0)?R(T,t,e):""}function k(t,e,n,r){if(!(0 >>=0;r=n+r-1;for(var i=0;i =o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),127>=o){if(n>=r)break;e[n++>>>0]=o}else{if(2047>=o){if(n+1>=r)break;e[n++>>>0]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++>>>0]=224|o>>12}else{if(n+3>=r)break;e[n++>>>0]=240|o>>18,e[n++>>>0]=128|o>>12&63}e[n++>>>0]=128|o>>6&63}e[n++>>>0]=128|63&o}}return e[n>>>0]=0,n-a}function D(t){for(var e=0,n=0;n =r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function P(){var t=O.buffer;A=t,e.HEAP8=S=new Int8Array(t),e.HEAP16=new Int16Array(t),e.HEAP32=E=new Int32Array(t),e.HEAPU8=T=new Uint8Array(t),e.HEAPU16=new Uint16Array(t),e.HEAPU32=M=new Uint32Array(t),e.HEAPF32=new Float32Array(t),e.HEAPF64=new Float64Array(t)}var U,F=[],I=[],W=[],H=[],L=0;function z(){var t=e.preRun.shift();F.unshift(t)}var Y,B=0,G=null,N=null;function V(t){throw e.onAbort&&e.onAbort(t),w(t="Aborted("+t+")"),C=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),a(t),t}function $(){return Y.startsWith("data:application/octet-stream;base64,")}if(Y="ort-wasm.wasm",!$()){var q=Y;Y=e.locateFile?e.locateFile(q,m):m+q}function X(){var t=Y;try{if(t==Y&&g)return new Uint8Array(g);if(u)return u(t);throw"both async and sync fetching of the wasm failed"}catch(t){V(t)}}function J(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function Z(t){for(;0 >2>>>0]=t},this.Eb=function(){return M[this.zb+4>>2>>>0]},this.Sb=function(t){M[this.zb+8>>2>>>0]=t},this.Wb=function(){return M[this.zb+8>>2>>>0]},this.Tb=function(){E[this.zb>>2>>>0]=0},this.Ib=function(t){S[this.zb+12>>0>>>0]=t?1:0},this.Pb=function(){return 0!=S[this.zb+12>>0>>>0]},this.Jb=function(t){S[this.zb+13>>0>>>0]=t?1:0},this.Lb=function(){return 0!=S[this.zb+13>>0>>>0]},this.Rb=function(t,e){this.Fb(0),this.Ub(t),this.Sb(e),this.Tb(),this.Ib(!1),this.Jb(!1)},this.Nb=function(){E[this.zb>>2>>>0]+=1},this.Xb=function(){var t=E[this.zb>>2>>>0];return E[this.zb>>2>>>0]=t-1,1===t},this.Fb=function(t){M[this.zb+16>>2>>>0]=t},this.Ob=function(){return M[this.zb+16>>2>>>0]},this.Qb=function(){if(Mt(this.Eb()))return M[this.Db>>2>>>0];var t=this.Ob();return 0!==t?t:this.Db}}function nt(t){return vt(new et(t).zb)}var rt=[];function at(t){var e=rt[t];return e||(t>=rt.length&&(rt.length=t+1),rt[t]=e=U.get(t)),e}function it(t){var e=D(t)+1,n=gt(e);return n&&k(t,S,n,e),n}var ot={};function ut(){if(!ct){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:p||"./this.program"};for(t in ot)void 0===ot[t]?delete e[t]:e[t]=ot[t];var n=[];for(t in e)n.push(t+"="+e[t]);ct=n}return ct}var ct,st=[null,[],[]];function lt(t,e){var n=st[t];0===e||10===e?((1===t?v:w)(R(n,0)),n.length=0):n.push(e)}var ft=0;function pt(t){return 0==t%4&&(0!=t%100||0==t%400)}var ht=[31,29,31,30,31,30,31,31,30,31,30,31],dt=[31,28,31,30,31,30,31,31,30,31,30,31];function yt(t,e,n,r){function a(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.length t?-1:0 r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=u(new Date(t.getFullYear(),0,4)),n=u(n),0>=o(e,t)?0>=o(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var s=E[r+40>>2>>>0];for(var l in r={$b:E[r>>2>>>0],Zb:E[r+4>>2>>>0],Gb:E[r+8>>2>>>0],Kb:E[r+12>>2>>>0],Hb:E[r+16>>2>>>0],Cb:E[r+20>>2>>>0],Ab:E[r+24>>2>>>0],Bb:E[r+28>>2>>>0],bc:E[r+32>>2>>>0],Yb:E[r+36>>2>>>0],ac:s?j(s):""},n=j(n),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(l,"g"),s[l]);var f="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),p="January February March April May June July August September October November December".split(" ");for(l in s={"%a":function(t){return f[t.Ab].substring(0,3)},"%A":function(t){return f[t.Ab]},"%b":function(t){return p[t.Hb].substring(0,3)},"%B":function(t){return p[t.Hb]},"%C":function(t){return i((t.Cb+1900)/100|0,2)},"%d":function(t){return i(t.Kb,2)},"%e":function(t){return a(t.Kb,2," ")},"%g":function(t){return c(t).toString().substring(2)},"%G":function(t){return c(t)},"%H":function(t){return i(t.Gb,2)},"%I":function(t){return 0==(t=t.Gb)?t=12:12 t.Gb?"AM":"PM"},"%S":function(t){return i(t.$b,2)},"%t":function(){return"\\t"},"%u":function(t){return t.Ab||7},"%U":function(t){return i(Math.floor((t.Bb+7-t.Ab)/7),2)},"%V":function(t){var e=Math.floor((t.Bb+7-(t.Ab+6)%7)/7);if(2>=(t.Ab+371-t.Bb-2)%7&&e++,e)53==e&&(4==(n=(t.Ab+371-t.Bb)%7)||3==n&&pt(t.Cb)||(e=1));else{e=52;var n=(t.Ab+7-t.Bb-1)%7;(4==n||5==n&&pt(t.Cb%400-1))&&e++}return i(e,2)},"%w":function(t){return t.Ab},"%W":function(t){return i(Math.floor((t.Bb+7-(t.Ab+6)%7)/7),2)},"%y":function(t){return(t.Cb+1900).toString().substring(2)},"%Y":function(t){return t.Cb+1900},"%z":function(t){var e=0<=(t=t.Yb);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.ac},"%%":function(){return"%"}},n=n.replace(/%%/g,"\\0\\0"),s)n.includes(l)&&(n=n.replace(new RegExp(l,"g"),s[l](r)));return l=function(t){var e=Array(D(t)+1);return k(t,e,0,e.length),e}(n=n.replace(/\\0\\0/g,"%")),l.length>e?0:(S.set(l,t>>>0),l.length-1)}var bt={a:function(t){return gt(t+24)+24},m:function(t){return(t=new et(t)).Pb()||(t.Ib(!0),K--),t.Jb(!1),Q.push(t),t.Nb(),t.Qb()},ia:function(t){throw w("Unexpected exception thrown, this is not properly supported - aborting"),C=!0,t},w:function(){Ot(0);var t=Q.pop();if(t.Xb()&&!t.Lb()){var e=t.Wb();e&&at(e)(t.Db),nt(t.Db)}tt=0},d:function(){var t=tt;if(!t)return ft=0;var e=new et(t);e.Fb(t);var n=e.Eb();if(!n)return ft=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a >>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getUTCSeconds(),E[e+4>>2>>>0]=t.getUTCMinutes(),E[e+8>>2>>>0]=t.getUTCHours(),E[e+12>>2>>>0]=t.getUTCDate(),E[e+16>>2>>>0]=t.getUTCMonth(),E[e+20>>2>>>0]=t.getUTCFullYear()-1900,E[e+24>>2>>>0]=t.getUTCDay(),E[e+28>>2>>>0]=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},Ea:function(t,e){t=new Date(1e3*(M[t>>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getSeconds(),E[e+4>>2>>>0]=t.getMinutes(),E[e+8>>2>>>0]=t.getHours(),E[e+12>>2>>>0]=t.getDate(),E[e+16>>2>>>0]=t.getMonth(),E[e+20>>2>>>0]=t.getFullYear()-1900,E[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1);E[e+28>>2>>>0]=(t.getTime()-n.getTime())/864e5|0,E[e+36>>2>>>0]=-60*t.getTimezoneOffset();var r=new Date(t.getFullYear(),6,1).getTimezoneOffset();n=n.getTimezoneOffset(),E[e+32>>2>>>0]=0|(r!=n&&t.getTimezoneOffset()==Math.min(n,r))},Fa:function(t){var e=new Date(E[t+20>>2>>>0]+1900,E[t+16>>2>>>0],E[t+12>>2>>>0],E[t+8>>2>>>0],E[t+4>>2>>>0],E[t>>2>>>0],0),n=E[t+32>>2>>>0],r=e.getTimezoneOffset(),a=new Date(e.getFullYear(),0,1),i=new Date(e.getFullYear(),6,1).getTimezoneOffset(),o=a.getTimezoneOffset(),u=Math.min(o,i);return 0>n?E[t+32>>2>>>0]=Number(i!=o&&u==r):0 >2>>>0]=e.getDay(),E[t+28>>2>>>0]=(e.getTime()-a.getTime())/864e5|0,E[t>>2>>>0]=e.getSeconds(),E[t+4>>2>>>0]=e.getMinutes(),E[t+8>>2>>>0]=e.getHours(),E[t+12>>2>>>0]=e.getDate(),E[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},sa:function(){return-52},ta:function(){},Ga:function t(e,n,r){t.Vb||(t.Vb=!0,function(t,e,n){function r(t){return(t=t.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?t[1]:"GMT"}var a=(new Date).getFullYear(),i=new Date(a,0,1),o=new Date(a,6,1);a=i.getTimezoneOffset();var u=o.getTimezoneOffset();E[t>>2>>>0]=60*Math.max(a,u),E[e>>2>>>0]=Number(a!=u),t=r(i),e=r(o),t=it(t),e=it(e),u>2>>>0]=t,M[n+4>>2>>>0]=e):(M[n>>2>>>0]=e,M[n+4>>2>>>0]=t)}(e,n,r))},B:function(){V("")},ma:function(){return 4294901760},I:b?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:()=>performance.now(),xa:function(t,e,n){T.copyWithin(t>>>0,e>>>0,e+n>>>0)},G:function(t){var e=T.length;if(4294901760<(t>>>=0))return!1;for(var n=1;4>=n;n*=2){var r=e*(1+.2/n);r=Math.min(r,t+100663296);var a=Math;r=Math.max(t,r),a=a.min.call(a,4294901760,r+(65536-r%65536)%65536);t:{try{O.grow(a-A.byteLength+65535>>>16),P();var i=1;break t}catch(t){}i=void 0}if(i)return!0}return!1},va:function(t,e){var n=0;return ut().forEach((function(r,a){var i=e+n;for(a=M[t+4*a>>2>>>0]=i,i=0;i >0>>>0]=r.charCodeAt(i);S[a>>0>>>0]=0,n+=r.length+1})),0},wa:function(t,e){var n=ut();M[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),M[e>>2>>>0]=r,0},ba:function(t){_||0 >2>>>0],u=M[e+4>>2>>>0];e+=8;for(var c=0;c>>0]);a+=u}return M[r>>2>>>0]=a,0},c:function(){return ft},ja:function t(e,r){t.Mb||(t.Mb=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(b)try{var e=n(Object(function(){var t=new Error("Cannot find module \'crypto\'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>V("randomDevice")}());for(var a=0;a >0>>>0]=t.Mb();return 0},ea:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},fa:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},J:function(t){var e=At();try{return at(t)()}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},e:function(t,e){var n=At();try{return at(t)(e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},N:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},O:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},j:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},o:function(t,e,n,r){var a=At();try{return at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},p:function(t,e,n,r,a){var i=At();try{return at(t)(e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},M:function(t,e,n,r,a,i){var o=At();try{return at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},r:function(t,e,n,r,a,i){var o=At();try{return at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},v:function(t,e,n,r,a,i,o){var u=At();try{return at(t)(e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},K:function(t,e,n,r,a,i,o,u){var c=At();try{return at(t)(e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},D:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=At();try{return at(t)(e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(St(p),t!==t+0)throw t;Ot(1,0)}},X:function(t,e,n,r,a,i,o,u){var c=At();try{return Ft(t,e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},V:function(t,e,n,r,a,i,o){var u=At();try{return xt(t,e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},U:function(t,e,n,r,a){var i=At();try{return It(t,e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},Z:function(t,e,n,r){var a=At();try{return Pt(t,e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},W:function(t){var e=At();try{return Ct(t)}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},Y:function(t,e){var n=At();try{return Ut(t,e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},T:function(t,e,n){var r=At();try{return Rt(t,e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},f:function(t){var e=At();try{at(t)()}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},q:function(t,e){var n=At();try{at(t)(e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},h:function(t,e,n){var r=At();try{at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},da:function(t,e,n,r){var a=At();try{at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},l:function(t,e,n,r){var a=At();try{at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},t:function(t,e,n,r,a){var i=At();try{at(t)(e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},u:function(t,e,n,r,a,i){var o=At();try{at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},x:function(t,e,n,r,a,i,o){var u=At();try{at(t)(e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},z:function(t,e,n,r,a,i,o,u){var c=At();try{at(t)(e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},ga:function(t,e,n,r,a,i,o,u,c){var s=At();try{at(t)(e,n,r,a,i,o,u,c)}catch(t){if(St(s),t!==t+0)throw t;Ot(1,0)}},A:function(t,e,n,r,a,i,o,u,c,s,l){var f=At();try{at(t)(e,n,r,a,i,o,u,c,s,l)}catch(t){if(St(f),t!==t+0)throw t;Ot(1,0)}},C:function(t,e,n,r,a,i,o,u,c,s,l,f,p,h,d,y){var b=At();try{at(t)(e,n,r,a,i,o,u,c,s,l,f,p,h,d,y)}catch(t){if(St(b),t!==t+0)throw t;Ot(1,0)}},aa:function(t,e,n,r,a,i,o,u){var c=At();try{jt(t,e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},_:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=At();try{Dt(t,e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(St(p),t!==t+0)throw t;Ot(1,0)}},$:function(t,e,n,r,a,i){var o=At();try{kt(t,e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},n:function(t){return t},F:function(t){ft=t},ha:yt,y:function(t,e,n,r){return yt(t,e,n,r)}};!function(){function t(t){e.asm=t.exports,O=e.asm.Ka,P(),U=e.asm.ib,I.unshift(e.asm.La),B--,e.monitorRunDependencies&&e.monitorRunDependencies(B),0==B&&(null!==G&&(clearInterval(G),G=null),N&&(t=N,N=null,t()))}function n(e){t(e.instance)}function r(t){return function(){if(!g&&(d||y)){if("function"==typeof fetch&&!Y.startsWith("file://"))return fetch(Y,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+Y+"\'";return t.arrayBuffer()})).catch((function(){return X()}));if(o)return new Promise((function(t,e){o(Y,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return X()}))}().then((function(t){return WebAssembly.instantiate(t,i)})).then((function(t){return t})).then(t,(function(t){w("failed to asynchronously prepare wasm: "+t),V(t)}))}var i={a:bt};if(B++,e.monitorRunDependencies&&e.monitorRunDependencies(B),e.instantiateWasm)try{return e.instantiateWasm(i,t)}catch(t){return w("Module.instantiateWasm callback failed with error: "+t),!1}(g||"function"!=typeof WebAssembly.instantiateStreaming||$()||Y.startsWith("file://")||b||"function"!=typeof fetch?r(n):fetch(Y,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,i).then(n,(function(t){return w("wasm streaming compile failed: "+t),w("falling back to ArrayBuffer instantiation"),r(n)}))}))).catch(a)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.La).apply(null,arguments)},e._OrtInit=function(){return(e._OrtInit=e.asm.Ma).apply(null,arguments)},e._OrtCreateSessionOptions=function(){return(e._OrtCreateSessionOptions=e.asm.Na).apply(null,arguments)},e._OrtAppendExecutionProvider=function(){return(e._OrtAppendExecutionProvider=e.asm.Oa).apply(null,arguments)},e._OrtAddSessionConfigEntry=function(){return(e._OrtAddSessionConfigEntry=e.asm.Pa).apply(null,arguments)},e._OrtReleaseSessionOptions=function(){return(e._OrtReleaseSessionOptions=e.asm.Qa).apply(null,arguments)},e._OrtCreateSession=function(){return(e._OrtCreateSession=e.asm.Ra).apply(null,arguments)},e._OrtReleaseSession=function(){return(e._OrtReleaseSession=e.asm.Sa).apply(null,arguments)},e._OrtGetInputCount=function(){return(e._OrtGetInputCount=e.asm.Ta).apply(null,arguments)},e._OrtGetOutputCount=function(){return(e._OrtGetOutputCount=e.asm.Ua).apply(null,arguments)},e._OrtGetInputName=function(){return(e._OrtGetInputName=e.asm.Va).apply(null,arguments)},e._OrtGetOutputName=function(){return(e._OrtGetOutputName=e.asm.Wa).apply(null,arguments)},e._OrtFree=function(){return(e._OrtFree=e.asm.Xa).apply(null,arguments)},e._OrtCreateTensor=function(){return(e._OrtCreateTensor=e.asm.Ya).apply(null,arguments)},e._OrtGetTensorData=function(){return(e._OrtGetTensorData=e.asm.Za).apply(null,arguments)},e._OrtReleaseTensor=function(){return(e._OrtReleaseTensor=e.asm._a).apply(null,arguments)},e._OrtCreateRunOptions=function(){return(e._OrtCreateRunOptions=e.asm.$a).apply(null,arguments)},e._OrtAddRunConfigEntry=function(){return(e._OrtAddRunConfigEntry=e.asm.ab).apply(null,arguments)},e._OrtReleaseRunOptions=function(){return(e._OrtReleaseRunOptions=e.asm.bb).apply(null,arguments)},e._OrtRun=function(){return(e._OrtRun=e.asm.cb).apply(null,arguments)},e._OrtEndProfiling=function(){return(e._OrtEndProfiling=e.asm.db).apply(null,arguments)};var mt,gt=e._malloc=function(){return(gt=e._malloc=e.asm.eb).apply(null,arguments)},vt=e._free=function(){return(vt=e._free=e.asm.fb).apply(null,arguments)},wt=e._fflush=function(){return(wt=e._fflush=e.asm.gb).apply(null,arguments)},_t=e.___funcs_on_exit=function(){return(_t=e.___funcs_on_exit=e.asm.hb).apply(null,arguments)},Ot=e._setThrew=function(){return(Ot=e._setThrew=e.asm.jb).apply(null,arguments)},At=e.stackSave=function(){return(At=e.stackSave=e.asm.kb).apply(null,arguments)},St=e.stackRestore=function(){return(St=e.stackRestore=e.asm.lb).apply(null,arguments)},Tt=e.stackAlloc=function(){return(Tt=e.stackAlloc=e.asm.mb).apply(null,arguments)},Et=e.___cxa_can_catch=function(){return(Et=e.___cxa_can_catch=e.asm.nb).apply(null,arguments)},Mt=e.___cxa_is_pointer_type=function(){return(Mt=e.___cxa_is_pointer_type=e.asm.ob).apply(null,arguments)},Ct=e.dynCall_j=function(){return(Ct=e.dynCall_j=e.asm.pb).apply(null,arguments)},xt=e.dynCall_iiiiij=function(){return(xt=e.dynCall_iiiiij=e.asm.qb).apply(null,arguments)},Rt=e.dynCall_jii=function(){return(Rt=e.dynCall_jii=e.asm.rb).apply(null,arguments)},jt=e.dynCall_viiiiij=function(){return(jt=e.dynCall_viiiiij=e.asm.sb).apply(null,arguments)},kt=e.dynCall_vjji=function(){return(kt=e.dynCall_vjji=e.asm.tb).apply(null,arguments)},Dt=e.dynCall_viiijjjii=function(){return(Dt=e.dynCall_viiijjjii=e.asm.ub).apply(null,arguments)},Pt=e.dynCall_iij=function(){return(Pt=e.dynCall_iij=e.asm.vb).apply(null,arguments)},Ut=e.dynCall_ji=function(){return(Ut=e.dynCall_ji=e.asm.wb).apply(null,arguments)},Ft=e.dynCall_iiiiiij=function(){return(Ft=e.dynCall_iiiiiij=e.asm.xb).apply(null,arguments)},It=e.dynCall_iiij=function(){return(It=e.dynCall_iiij=e.asm.yb).apply(null,arguments)};function Wt(){function t(){if(!mt&&(mt=!0,e.calledRun=!0,!C)){if(Z(I),r(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var t=e.postRun.shift();H.unshift(t)}Z(H)}}if(!(0{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.iterateExtraOptions=void 0,e.iterateExtraOptions=(t,n,r,a)=>{if("object"==typeof t&&null!==t){if(r.has(t))throw new Error("Circular reference in options");r.add(t)}Object.entries(t).forEach((([t,i])=>{const o=n?n+t:t;if("object"==typeof i)(0,e.iterateExtraOptions)(i,o+".",r,a);else if("string"==typeof i||"number"==typeof i)a(o,i.toString());else{if("boolean"!=typeof i)throw new Error("Can\'t handle extra config type: "+typeof i);a(o,i?"1":"0")}}))}},586:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRunOptions=void 0;const r=n(967),a=n(983),i=n(361);e.setRunOptions=t=>{const e=(0,i.getInstance)();let n=0;const o=[],u=t||{};try{if(void 0===(null==t?void 0:t.logSeverityLevel))u.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))u.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);void 0===(null==t?void 0:t.terminate)&&(u.terminate=!1);let i=0;if(void 0!==(null==t?void 0:t.tag)&&(i=(0,a.allocWasmString)(t.tag,o)),n=e._OrtCreateRunOptions(u.logSeverityLevel,u.logVerbosityLevel,!!u.terminate,i),0===n)throw new Error("Can\'t create run options");return void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const i=(0,a.allocWasmString)(t,o),u=(0,a.allocWasmString)(r,o);if(0!==e._OrtAddRunConfigEntry(n,i,u))throw new Error(`Can\'t set a run config entry: ${t} - ${r}`)})),[n,o]}catch(t){throw 0!==n&&e._OrtReleaseRunOptions(n),o.forEach(e._free),t}}},919:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setSessionOptions=void 0;const r=n(967),a=n(983),i=n(361);e.setSessionOptions=t=>{const e=(0,i.getInstance)();let n=0;const o=[],u=t||{};(t=>{t.extra||(t.extra={}),t.extra.session||(t.extra.session={});const e=t.extra.session;e.use_ort_model_bytes_directly||(e.use_ort_model_bytes_directly="1")})(u);try{void 0===(null==t?void 0:t.graphOptimizationLevel)&&(u.graphOptimizationLevel="all");const c=(t=>{switch(t){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${t}`)}})(u.graphOptimizationLevel);void 0===(null==t?void 0:t.enableCpuMemArena)&&(u.enableCpuMemArena=!0),void 0===(null==t?void 0:t.enableMemPattern)&&(u.enableMemPattern=!0),void 0===(null==t?void 0:t.executionMode)&&(u.executionMode="sequential");const s=(t=>{switch(t){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${t}`)}})(u.executionMode);let l=0;if(void 0!==(null==t?void 0:t.logId)&&(l=(0,a.allocWasmString)(t.logId,o)),void 0===(null==t?void 0:t.logSeverityLevel))u.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))u.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);if(void 0===(null==t?void 0:t.enableProfiling)&&(u.enableProfiling=!1),n=e._OrtCreateSessionOptions(c,!!u.enableCpuMemArena,!!u.enableMemPattern,s,!!u.enableProfiling,0,l,u.logSeverityLevel,u.logVerbosityLevel),0===n)throw new Error("Can\'t create session options");return(null==t?void 0:t.executionProviders)&&((t,e,n)=>{for(const r of e){let e="string"==typeof r?r:r.name;switch(e){case"xnnpack":e="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${e}`)}const o=(0,a.allocWasmString)(e,n);if(0!==(0,i.getInstance)()._OrtAppendExecutionProvider(t,o))throw new Error(`Can\'t append execution provider: ${e}`)}})(n,t.executionProviders,o),void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const i=(0,a.allocWasmString)(t,o),u=(0,a.allocWasmString)(r,o);if(0!==e._OrtAddSessionConfigEntry(n,i,u))throw new Error(`Can\'t set a session config entry: ${t} - ${r}`)})),[n,o]}catch(t){throw 0!==n&&e._OrtReleaseSessionOptions(n),o.forEach(e._free),t}}},983:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.allocWasmString=void 0;const r=n(361);e.allocWasmString=(t,e)=>{const n=(0,r.getInstance)(),a=n.lengthBytesUTF8(t)+1,i=n._malloc(a);return n.stringToUTF8(t,i,a),e.push(i),i}},349:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.extractTransferableBuffers=e.endProfiling=e.run=e.releaseSession=e.createSession=e.createSessionFinalize=e.createSessionAllocate=e.initOrt=void 0;const r=n(586),a=n(919),i=n(983),o=n(361);e.initOrt=(t,e)=>{const n=(0,o.getInstance)()._OrtInit(t,e);if(0!==n)throw new Error(`Can\'t initialize onnxruntime. error code = ${n}`)};const u=new Map;e.createSessionAllocate=t=>{const e=(0,o.getInstance)(),n=e._malloc(t.byteLength);return e.HEAPU8.set(t,n),[n,t.byteLength]},e.createSessionFinalize=(t,e)=>{const n=(0,o.getInstance)();let r=0,i=0,c=[];try{if([i,c]=(0,a.setSessionOptions)(e),r=n._OrtCreateSession(t[0],t[1],i),0===r)throw new Error("Can\'t create a session")}finally{n._free(t[0]),n._OrtReleaseSessionOptions(i),c.forEach(n._free)}const s=n._OrtGetInputCount(r),l=n._OrtGetOutputCount(r),f=[],p=[],h=[],d=[];for(let t=0;t {const r=(0,e.createSessionAllocate)(t);return(0,e.createSessionFinalize)(r,n)},e.releaseSession=t=>{const e=(0,o.getInstance)(),n=u.get(t);if(!n)throw new Error("invalid session id");const r=n[0],a=n[1],i=n[2];a.forEach(e._OrtFree),i.forEach(e._OrtFree),e._OrtReleaseSession(r),u.delete(t)};const c=t=>{switch(t){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${t}`)}},s=t=>{switch(t){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${t}`)}},l=t=>{switch(t){case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${t}`)}};e.run=(t,e,n,a,f)=>{const p=(0,o.getInstance)(),h=u.get(t);if(!h)throw new Error("invalid session id");const d=h[0],y=h[1],b=h[2],m=e.length,g=a.length;let v=0,w=[];const _=[],O=[];try{[v,w]=(0,r.setRunOptions)(f);for(let t=0;tp.HEAP32[t++]=e));const n=p._OrtCreateTensor(c(e),o,u,l,r.length);if(0===n)throw new Error("Can\'t create a tensor");_.push(n)}finally{p.stackRestore(s)}}const t=p.stackSave(),o=p.stackAlloc(4*m),u=p.stackAlloc(4*m),h=p.stackAlloc(4*g),A=p.stackAlloc(4*g);try{let n=o/4,r=u/4,i=h/4,c=A/4;for(let t=0;t t*e));if(a=s(o),"string"===a){const t=[];let e=i/4;for(let n=0;n {const e=(0,o.getInstance)(),n=u.get(t);if(!n)throw new Error("invalid session id");const r=n[0],a=e._OrtEndProfiling(r);if(0===a)throw new Error("Can\'t get an profile file name");e._OrtFree(a)},e.extractTransferableBuffers=t=>{const e=[];for(const n of t){const t=n[2];!Array.isArray(t)&&t.buffer&&e.push(t.buffer)}return e}},361:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(e,n);a&&!("get"in a?!e.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,a)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return a(e,t),e},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.dispose=e.getInstance=e.initializeWebAssembly=void 0;const u=i(n(449)),c=o(n(932)),s=n(474);let l,f=!1,p=!1,h=!1;const d=(t,e)=>e?t?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":t?"ort-wasm-simd.wasm":"ort-wasm.wasm";e.initializeWebAssembly=async t=>{if(f)return Promise.resolve();if(p)throw new Error("multiple calls to \'initializeWebAssembly()\' detected.");if(h)throw new Error("previous call to \'initializeWebAssembly()\' failed.");p=!0;const e=t.initTimeout,r=t.numThreads,a=t.simd,i=r>1&&(()=>{try{return"undefined"!=typeof SharedArrayBuffer&&("undefined"!=typeof MessageChannel&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])))}catch(t){return!1}})(),o=a&&(()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch(t){return!1}})(),y="string"==typeof t.wasmPaths?t.wasmPaths:void 0,b=d(!1,i),m=d(o,i),g="object"==typeof t.wasmPaths?t.wasmPaths[m]:void 0;let v=!1;const w=[];if(e>0&&w.push(new Promise((t=>{setTimeout((()=>{v=!0,t()}),e)}))),w.push(new Promise(((t,e)=>{const r=i?s:c.default,a={locateFile:(t,e)=>i&&t.endsWith(".worker.js")&&"undefined"!=typeof Blob?URL.createObjectURL(new Blob([n(154)],{type:"text/javascript"})):t===b?null!=g?g:(null!=y?y:e)+m:e+t};if(i)if("undefined"==typeof Blob)a.mainScriptUrlOrBlob=u.join("/","ort-wasm-threaded.js");else{const t=`var ortWasmThreaded=(function(){var _scriptDir;return ${r.toString()}})();`;a.mainScriptUrlOrBlob=new Blob([t],{type:"text/javascript"})}r(a).then((e=>{p=!1,f=!0,l=e,t()}),(t=>{p=!1,h=!0,e(t)}))}))),await Promise.race(w),v)throw new Error(`WebAssembly backend initializing failed due to timeout: ${e}ms`)},e.getInstance=()=>{if(f&&l)return l;throw new Error("WebAssembly is not initialized yet.")},e.dispose=()=>{var t;!f||p||h||(p=!0,null===(t=l.PThread)||void 0===t||t.terminateAllThreads(),l=void 0,p=!1,f=!1,h=!0)}},154:t=>{"use strict";t.exports=\'"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}};\\n\'},384:()=>{},993:()=>{},908:()=>{},953:()=>{},925:()=>{},449:()=>{}},e={};function n(r){var a=e[r];if(void 0!==a)return a.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),(()=>{"use strict";const t=n(349),e=n(361);self.onmessage=n=>{switch(n.data.type){case"init-wasm":(0,e.initializeWebAssembly)(n.data.in).then((()=>postMessage({type:"init-wasm"})),(t=>postMessage({type:"init-wasm",err:t})));break;case"init-ort":try{const{numThreads:e,loggingLevel:r}=n.data.in;(0,t.initOrt)(e,r),postMessage({type:"init-ort"})}catch(t){postMessage({type:"init-ort",err:t})}break;case"create_allocate":try{const{model:e}=n.data.in,r=(0,t.createSessionAllocate)(e);postMessage({type:"create_allocate",out:r})}catch(t){postMessage({type:"create_allocate",err:t})}break;case"create_finalize":try{const{modeldata:e,options:r}=n.data.in,a=(0,t.createSessionFinalize)(e,r);postMessage({type:"create_finalize",out:a})}catch(t){postMessage({type:"create_finalize",err:t})}break;case"create":try{const{model:e,options:r}=n.data.in,a=(0,t.createSession)(e,r);postMessage({type:"create",out:a})}catch(t){postMessage({type:"create",err:t})}break;case"release":try{const e=n.data.in;(0,t.releaseSession)(e),postMessage({type:"release"})}catch(t){postMessage({type:"release",err:t})}break;case"run":try{const{sessionId:e,inputIndices:r,inputs:a,outputIndices:i,options:o}=n.data.in,u=(0,t.run)(e,r,a,i,o);postMessage({type:"run",out:u},(0,t.extractTransferableBuffers)(u))}catch(t){postMessage({type:"run",err:t})}break;case"end-profiling":try{const e=n.data.in;(0,t.endProfiling)(e),postMessage({type:"end-profiling"})}catch(t){postMessage({type:"end-profiling",err:t})}}}})()})();\n',"Worker",void 0,void 0)}},477:b=>{b.exports=function(n,a,u,c){var p=self||window;try{try{var s;try{s=new p.Blob([n])}catch{(s=new(p.BlobBuilder||p.WebKitBlobBuilder||p.MozBlobBuilder||p.MSBlobBuilder)).append(n),s=s.getBlob()}var h=p.URL||p.webkitURL,f=h.createObjectURL(s),l=new p[a](f,u);return h.revokeObjectURL(f),l}catch{return new p[a]("data:application/javascript,".concat(encodeURIComponent(n)),u)}}catch{if(!c)throw Error("Inline worker is not supported");return new p[a](c,u)}}},4154:b=>{b.exports=`"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}}; -`},1670:b=>{b.exports=__WEBPACK_EXTERNAL_MODULE__1670__},7067:()=>{},1296:()=>{},1384:()=>{},3993:()=>{},908:()=>{},6953:()=>{},9925:()=>{},2806:()=>{},6449:()=>{},2850:()=>{},5381:()=>{},5686:(b,n,a)=>{a.r(n),a.d(n,{flatbuffers:()=>u});var u={};u.Offset,u.Table,u.SIZEOF_SHORT=2,u.SIZEOF_INT=4,u.FILE_IDENTIFIER_LENGTH=4,u.SIZE_PREFIX_LENGTH=4,u.Encoding={UTF8_BYTES:1,UTF16_STRING:2},u.int32=new Int32Array(2),u.float32=new Float32Array(u.int32.buffer),u.float64=new Float64Array(u.int32.buffer),u.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1,u.Long=function(c,p){this.low=0|c,this.high=0|p},u.Long.create=function(c,p){return c==0&&p==0?u.Long.ZERO:new u.Long(c,p)},u.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},u.Long.prototype.equals=function(c){return this.low==c.low&&this.high==c.high},u.Long.ZERO=new u.Long(0,0),u.Builder=function(c){if(c)p=c;else var p=1024;this.bb=u.ByteBuffer.allocate(p),this.space=p,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},u.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},u.Builder.prototype.forceDefaults=function(c){this.force_defaults=c},u.Builder.prototype.dataBuffer=function(){return this.bb},u.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},u.Builder.prototype.prep=function(c,p){c>this.minalign&&(this.minalign=c);for(var s=1+~(this.bb.capacity()-this.space+p)&c-1;this.space =0&&this.vtable[p]==0;p--);for(var s=p+1;p>=0;p--)this.addInt16(this.vtable[p]!=0?c-this.vtable[p]:0);this.addInt16(c-this.object_start);var h=(s+2)*u.SIZEOF_SHORT;this.addInt16(h);var f=0,l=this.space;e:for(p=0;p=0;l--)this.writeInt8(f.charCodeAt(l))}this.prep(this.minalign,u.SIZEOF_INT+h),this.addOffset(c),h&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},u.Builder.prototype.finishSizePrefixed=function(c,p){this.finish(c,p,!0)},u.Builder.prototype.requiredField=function(c,p){var s=this.bb.capacity()-c,h=s-this.bb.readInt32(s);if(this.bb.readInt16(h+p)==0)throw new Error("FlatBuffers: field "+p+" must be set")},u.Builder.prototype.startVector=function(c,p,s){this.notNested(),this.vector_num_elems=p,this.prep(u.SIZEOF_INT,c*p),this.prep(s,c*p)},u.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},u.Builder.prototype.createString=function(c){if(c instanceof Uint8Array)var p=c;else{p=[];for(var s=0;s =56320?f:(f<<10)+c.charCodeAt(s++)+-56613888)<128?p.push(h):(h<2048?p.push(h>>6&31|192):(h<65536?p.push(h>>12&15|224):p.push(h>>18&7|240,h>>12&63|128),p.push(h>>6&63|128)),p.push(63&h|128))}}this.addInt8(0),this.startVector(1,p.length,1),this.bb.setPosition(this.space-=p.length),s=0;for(var l=this.space,o=this.bb.bytes();s >24},u.ByteBuffer.prototype.readUint8=function(c){return this.bytes_[c]},u.ByteBuffer.prototype.readInt16=function(c){return this.readUint16(c)<<16>>16},u.ByteBuffer.prototype.readUint16=function(c){return this.bytes_[c]|this.bytes_[c+1]<<8},u.ByteBuffer.prototype.readInt32=function(c){return this.bytes_[c]|this.bytes_[c+1]<<8|this.bytes_[c+2]<<16|this.bytes_[c+3]<<24},u.ByteBuffer.prototype.readUint32=function(c){return this.readInt32(c)>>>0},u.ByteBuffer.prototype.readInt64=function(c){return new u.Long(this.readInt32(c),this.readInt32(c+4))},u.ByteBuffer.prototype.readUint64=function(c){return new u.Long(this.readUint32(c),this.readUint32(c+4))},u.ByteBuffer.prototype.readFloat32=function(c){return u.int32[0]=this.readInt32(c),u.float32[0]},u.ByteBuffer.prototype.readFloat64=function(c){return u.int32[u.isLittleEndian?0:1]=this.readInt32(c),u.int32[u.isLittleEndian?1:0]=this.readInt32(c+4),u.float64[0]},u.ByteBuffer.prototype.writeInt8=function(c,p){this.bytes_[c]=p},u.ByteBuffer.prototype.writeUint8=function(c,p){this.bytes_[c]=p},u.ByteBuffer.prototype.writeInt16=function(c,p){this.bytes_[c]=p,this.bytes_[c+1]=p>>8},u.ByteBuffer.prototype.writeUint16=function(c,p){this.bytes_[c]=p,this.bytes_[c+1]=p>>8},u.ByteBuffer.prototype.writeInt32=function(c,p){this.bytes_[c]=p,this.bytes_[c+1]=p>>8,this.bytes_[c+2]=p>>16,this.bytes_[c+3]=p>>24},u.ByteBuffer.prototype.writeUint32=function(c,p){this.bytes_[c]=p,this.bytes_[c+1]=p>>8,this.bytes_[c+2]=p>>16,this.bytes_[c+3]=p>>24},u.ByteBuffer.prototype.writeInt64=function(c,p){this.writeInt32(c,p.low),this.writeInt32(c+4,p.high)},u.ByteBuffer.prototype.writeUint64=function(c,p){this.writeUint32(c,p.low),this.writeUint32(c+4,p.high)},u.ByteBuffer.prototype.writeFloat32=function(c,p){u.float32[0]=p,this.writeInt32(c,u.int32[0])},u.ByteBuffer.prototype.writeFloat64=function(c,p){u.float64[0]=p,this.writeInt32(c,u.int32[u.isLittleEndian?0:1]),this.writeInt32(c+4,u.int32[u.isLittleEndian?1:0])},u.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length >10),56320+(1023&l)))}return h},u.ByteBuffer.prototype.__indirect=function(c){return c+this.readInt32(c)},u.ByteBuffer.prototype.__vector=function(c){return c+this.readInt32(c)+u.SIZEOF_INT},u.ByteBuffer.prototype.__vector_len=function(c){return this.readInt32(c+this.readInt32(c))},u.ByteBuffer.prototype.__has_identifier=function(c){if(c.length!=u.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+u.FILE_IDENTIFIER_LENGTH);for(var p=0;p {var n=b&&b.__esModule?()=>b.default:()=>b;return __webpack_require__.d(n,{a:n}),n},__webpack_require__.d=(b,n)=>{for(var a in n)__webpack_require__.o(n,a)&&!__webpack_require__.o(b,a)&&Object.defineProperty(b,a,{enumerable:!0,get:n[a]})},__webpack_require__.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),__webpack_require__.o=(b,n)=>Object.prototype.hasOwnProperty.call(b,n),__webpack_require__.r=b=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(b,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__(6018);return __webpack_exports__})())})(ortWeb_min$1);var ortWeb_minExports=ortWeb_min$1.exports,ortWeb_min=getDefaultExportFromCjs(ortWeb_minExports),ONNX_WEB=_mergeNamespaces({__proto__:null,default:ortWeb_min},[ortWeb_minExports]);let ONNX;const executionProviders=["wasm"];typeof process<"u"&&((nt=process==null?void 0:process.release)==null?void 0:nt.name)==="node"?(ONNX=sharp??ONNX_NODE,executionProviders.unshift("cpu")):(ONNX=ortWeb_min??ONNX_WEB,typeof navigator<"u"&&/iP(hone|od|ad).+16_4.+AppleWebKit/.test(navigator.userAgent)&&(ONNX.env.wasm.simd=!1));const{env:onnx_env}=ONNX,VERSION="2.6.2",WEB_CACHE_AVAILABLE=typeof self<"u"&&"caches"in self,FS_AVAILABLE=!isEmpty(sharp),PATH_AVAILABLE=!isEmpty(sharp),RUNNING_LOCALLY=FS_AVAILABLE&&PATH_AVAILABLE,__dirname=RUNNING_LOCALLY?sharp.dirname(sharp.dirname(sharp.fileURLToPath(self.location.href))):"./",DEFAULT_CACHE_DIR=RUNNING_LOCALLY?sharp.join(__dirname,"/.cache/"):null,DEFAULT_LOCAL_MODEL_PATH="/models/",localModelPath=RUNNING_LOCALLY?sharp.join(__dirname,DEFAULT_LOCAL_MODEL_PATH):DEFAULT_LOCAL_MODEL_PATH;onnx_env.wasm.wasmPaths=RUNNING_LOCALLY?sharp.join(__dirname,"/dist/"):`https://cdn.jsdelivr.net/npm/@xenova/transformers@${VERSION}/dist/`;const env={backends:{onnx:onnx_env,tfjs:{}},__dirname,version:VERSION,allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!0,localModelPath,useFS:FS_AVAILABLE,useBrowserCache:WEB_CACHE_AVAILABLE,useFSCache:FS_AVAILABLE,cacheDir:DEFAULT_CACHE_DIR,useCustomCache:!1,customCache:null};function isEmpty(b){return Object.keys(b).length===0}globalThis.ReadableStream||(globalThis.ReadableStream=sharp.ReadableStream);class FileResponse{constructor(n){je(this,"_CONTENT_TYPE_MAP",{txt:"text/plain",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif"});if(this.filePath=n,this.headers=new Headers,this.exists=sharp.existsSync(n),this.exists){this.status=200,this.statusText="OK";let a=sharp.statSync(n);this.headers.set("content-length",a.size.toString()),this.updateContentType();let u=this;this.body=new ReadableStream({start(c){u.arrayBuffer().then(p=>{c.enqueue(new Uint8Array(p)),c.close()})}})}else this.status=404,this.statusText="Not Found",this.body=null}updateContentType(){const n=this.filePath.toString().split(".").pop().toLowerCase();this.headers.set("content-type",this._CONTENT_TYPE_MAP[n]??"application/octet-stream")}clone(){let n=new FileResponse(this.filePath);return n.exists=this.exists,n.status=this.status,n.statusText=this.statusText,n.headers=new Headers(this.headers),n}async arrayBuffer(){return(await sharp.promises.readFile(this.filePath)).buffer}async blob(){const n=await sharp.promises.readFile(this.filePath);return new Blob([n],{type:this.headers.get("content-type")})}async text(){return await sharp.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}}function isValidHttpUrl(b,n=null){let a;try{a=new URL(b)}catch{return!1}return n&&!n.includes(a.hostname)?!1:a.protocol==="http:"||a.protocol==="https:"}async function getFile(b){var n,a,u;if(env.useFS&&!isValidHttpUrl(b))return new FileResponse(b);if(typeof process<"u"&&((n=process==null?void 0:process.release)==null?void 0:n.name)==="node"){const c=!!((a=process.env)!=null&&a.TESTING_REMOTELY),p=env.version,s=new Headers;if(s.set("User-Agent",`transformers.js/${p}; is_ci/${c};`),isValidHttpUrl(b,["huggingface.co","hf.co"])){const f=(u=process.env)==null?void 0:u.HF_ACCESS_TOKEN;f&&s.set("Authorization",`Bearer ${f}`)}return fetch(b,{headers:s})}else return fetch(b)}const ERROR_MAPPING={400:"Bad request error occurred while trying to load file",401:"Unauthorized access to file",403:"Forbidden access to file",404:"Could not locate file",408:"Request timeout error occurred while trying to load file",500:"Internal server error error occurred while trying to load file",502:"Bad gateway error occurred while trying to load file",503:"Service unavailable error occurred while trying to load file",504:"Gateway timeout error occurred while trying to load file"};function handleError(b,n,a){if(!a)return null;const u=ERROR_MAPPING[b]??`Error (${b}) occurred while trying to load file`;throw Error(`${u}: "${n}".`)}class FileCache{constructor(n){this.path=n}async match(n){let a=sharp.join(this.path,n),u=new FileResponse(a);if(u.exists)return u}async put(n,a){const u=Buffer.from(await a.arrayBuffer());let c=sharp.join(this.path,n);try{await sharp.promises.mkdir(sharp.dirname(c),{recursive:!0}),await sharp.promises.writeFile(c,u)}catch(p){console.warn("An error occurred while writing the file to cache:",p)}}}async function tryCache(b,...n){for(let a of n)try{let u=await b.match(a);if(u)return u}catch{continue}}async function getModelFile(b,n,a=!0,u={}){if(!env.allowLocalModels&&u.local_files_only)throw Error("Invalid configuration detected: local models are disabled (`env.allowLocalModels=false`) but you have requested to only use local models (`local_files_only=true`).");dispatchCallback(u.progress_callback,{status:"initiate",name:b,file:n});let c;if(!c&&env.useBrowserCache){if(typeof caches>"u")throw Error("Browser cache is not available in this environment.");try{c=await caches.open("transformers-cache")}catch(d){console.warn("An error occurred while opening the browser cache:",d)}}if(!c&&env.useFSCache&&(c=new FileCache(u.cache_dir??env.cacheDir)),!c&&env.useCustomCache)throw Error("`env.useCustomCache=true`, but `env.customCache` is not defined.");const p=u.revision??"main";let s=pathJoin(b,n),h=pathJoin(env.localModelPath,s),f=pathJoin(env.remoteHost,env.remotePathTemplate.replaceAll("{model}",b).replaceAll("{revision}",p),n),l=p==="main"?s:pathJoin(b,p,n),o,t=c instanceof FileCache?l:f,e=!1,r;if(c&&(r=await tryCache(c,h,t)),r===void 0){if(env.allowLocalModels)if(isValidHttpUrl(s)){if(u.local_files_only)throw new Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${s}.`)}else try{r=await getFile(h),o=h}catch(g){console.warn(`Unable to load from local path "${h}": "${g}"`)}if(r===void 0||r.status===404){if(u.local_files_only||!env.allowRemoteModels){if(a)throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${h}".`);return null}if(r=await getFile(f),r.status!==200)return handleError(r.status,f,a);o=t}e=c&&typeof Response<"u"&&r instanceof Response&&r.status===200}dispatchCallback(u.progress_callback,{status:"download",name:b,file:n});const i=await readResponse(r,d=>{dispatchCallback(u.progress_callback,{status:"progress",...d,name:b,file:n})});return e&&o&&await c.match(o)===void 0&&await c.put(o,new Response(i,{headers:r.headers})).catch(d=>{console.warn(`Unable to add response to browser cache: ${d}.`)}),dispatchCallback(u.progress_callback,{status:"done",name:b,file:n}),i}async function getModelJSON(b,n,a=!0,u={}){let c=await getModelFile(b,n,a,u);if(c===null)return{};let s=new TextDecoder("utf-8").decode(c);return JSON.parse(s)}async function readResponse(b,n){const a=b.headers.get("Content-Length");a===null&&console.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");let u=parseInt(a??"0"),c=new Uint8Array(u),p=0;const s=b.body.getReader();async function h(){const{done:f,value:l}=await s.read();if(f)return;let o=p+l.length;if(o>u){u=o;let e=new Uint8Array(u);e.set(c),c=e}c.set(l,p),p=o;const t=p/u*100;return n({progress:t,loaded:p,total:u}),h()}return await h(),c}function pathJoin(...b){return b=b.map((n,a)=>(a&&(n=n.replace(new RegExp("^/"),"")),a!==b.length-1&&(n=n.replace(new RegExp("/$"),"")),n)),b.join("/")}function transpose_data(b,n,a){const u=new Array(a.length),c=new Array(a.length);for(let h=a.length-1,f=1;h>=0;--h)c[h]=f,u[h]=n[a[h]],f*=u[h];const p=a.map((h,f)=>c[a.indexOf(f)]),s=new b.constructor(b.length);for(let h=0;h =0;--l)f+=o%n[l]*p[l],o=Math.floor(o/n[l]);s[f]=b[h]}return[s,u]}function softmax(b){const n=max(b)[0],a=b.map(p=>Math.exp(p-n)),u=a.reduce((p,s)=>p+s,0);return a.map(p=>p/u)}function log_softmax(b){return softmax(b).map(u=>Math.log(u))}function getTopItems(b,n=0){return b=Array.from(b).map((a,u)=>[u,a]).sort((a,u)=>u[1]-a[1]),n>0&&(b=b.slice(0,n)),b}function min(b){if(b.length===0)throw Error("Array must not be empty");let n=b[0],a=0;for(let u=1;u n&&(n=b[u],a=u);return[n,a]}function medianFilter(b,n){if(n%2===0||n<=0)throw new Error("Window size must be a positive odd number");const a=new b.constructor(b.length),u=new b.constructor(n),c=Math.floor(n/2);for(let p=0;p =b.length&&(f=2*(b.length-1)-f),u[s++]=b[f]}u.sort(),a[p]=u[c]}return a}function round(b,n){const a=Math.pow(10,n);return Math.round(b*a)/a}const ONNXTensor$1=ONNX.Tensor;class Tensor extends ONNXTensor$1{constructor(...n){return n[0]instanceof ONNX.Tensor?super(n[0].type,n[0].data,n[0].dims):super(...n),new Proxy(this,{get:(a,u)=>{if(typeof u=="string"){let c=Number(u);if(Number.isInteger(c))return a._getitem(c)}return a[u]},set:(a,u,c)=>a[u]=c})}*[Symbol.iterator](){const[n,...a]=this.dims;if(a.length>0){const u=a.reduce((c,p)=>c*p);for(let c=0;c 0){const c=u.reduce((p,s)=>p*s);return this._subarray(n,c,u)}else return new Tensor(this.type,[this.data[n]],u)}indexOf(n){for(let a=0;a l[1])throw new Error(`Invalid slice: ${l}`);let o=[Math.max(l[0],0),Math.min(l[1],this.dims[f])];u.push(o),a.push(o[1]-o[0])}else throw new Error(`Invalid slice: ${l}`)}let c=u.map(([f,l])=>l-f),p=c.reduce((f,l)=>f*l),s=new this.data.constructor(p);const h=this.stride();for(let f=0;f =0;--o){const e=c[o];l+=(t%e+u[o][0])*h[o],t=Math.floor(t/e)}s[f]=this.data[l]}return new Tensor(this.type,s,a)}transpose(...n){return transpose(this,n)}sum(n=null,a=!1){return this.norm(1,n,a)}norm(n="fro",a=null,u=!1){if(n==="fro")n=2;else if(typeof n=="string")throw Error(`Unsupported norm: ${n}`);if(a===null){let s=this.data.reduce((h,f)=>h+f**n,0)**(1/n);return new Tensor(this.type,[s],[])}a=safeIndex(a,this.dims.length);const c=this.dims.slice();c[a]=1;const p=new this.data.constructor(this.data.length/this.dims[a]);for(let s=0;s
=0;--f){const t=this.dims[f];if(f!==a){const e=l%t;h+=e*o,o*=c[f]}l=Math.floor(l/t)}p[h]+=this.data[s]**n}if(n!==1)for(let s=0;s =0;--s){const l=this.dims[s];if(s!==a){const o=h%l;p+=o*f,f*=this.dims[s]}h=Math.floor(h/l)}this.data[c]/=u.data[p]}return this}normalize(n=2,a=1){return this.clone().normalize_(n,a)}stride(){return dimsToStride(this.dims)}squeeze(n=null){return new Tensor(this.type,this.data,calc_squeeze_dims(this.dims,n))}squeeze_(n=null){return this.dims=calc_squeeze_dims(this.dims,n),this}unsqueeze(n=null){return new Tensor(this.type,this.data,calc_unsqueeze_dims(this.dims,n))}unsqueeze_(n=null){return this.dims=calc_unsqueeze_dims(this.dims,n),this}flatten_(n=0,a=-1){a=(a+this.dims.length)%this.dims.length;let u=this.dims.slice(0,n),c=this.dims.slice(n,a+1),p=this.dims.slice(a+1);return this.dims=[...u,c.reduce((s,h)=>s*h,1),...p],this}flatten(n=0,a=-1){return this.clone().flatten_(n,a)}view(...n){let a=-1;for(let u=0;u s!==a?c*p:c,1);n[a]=this.data.length/u}return new Tensor(this.type,this.data,n)}neg_(){for(let n=0;n p*s);if(a!==u)throw Error(`cannot reshape array of size ${a} into shape (${n})`);let c=b;for(let p=n.length-1;p>=0;p--)c=c.reduce((s,h)=>{let f=s[s.length-1];return f.length a!==1):typeof n=="number"?b[n]===1&&b.splice(n,1):Array.isArray(n)&&(b=b.filter((a,u)=>a!==1||!n.includes(u))),b}function calc_unsqueeze_dims(b,n){return n=safeIndex(n,b.length+1),b=b.slice(),b.splice(n,0,1),b}function safeIndex(b,n,a=null){if(b<-n||b>=n)throw new Error(`IndexError: index ${b} is out of bounds for dimension${a===null?"":" "+a} with size ${n}`);return b<0&&(b=(b%n+n)%n),b}function cat(b,n=0){n=safeIndex(n,b[0].dims.length);const a=b[0].dims.slice();a[n]=b.reduce((s,h)=>s+h.dims[n],0);const u=a.reduce((s,h)=>s*h,1),c=new b[0].data.constructor(u),p=b[0].type;if(n===0){let s=0;for(let h of b)c.set(h.data,s),s+=h.data.length}else{let s=0;for(let h=0;h =0;--t){const i=f.dims[t];let d=e%i;t===n&&(d+=s),o+=d*r,r*=a[t],e=Math.floor(e/i)}c[o]=f.data[l]}s+=f.dims[n]}}return new Tensor(p,c,a)}function stack(b,n=0){return cat(b.map(a=>a.unsqueeze(n)),n)}function std_mean(b,n=null,a=1,u=!1){if(n===null){const l=b.data.reduce((r,i)=>r+i,0)/b.data.length,o=Math.sqrt(b.data.reduce((r,i)=>r+(i-l)**2,0)/(b.data.length-a)),t=new Tensor(b.type,[l],[]);return[new Tensor(b.type,[o],[]),t]}n=safeIndex(n,b.dims.length);const c=mean(b,n,u),p=b.dims.slice();p[n]=1;const s=new b.data.constructor(b.data.length/b.dims[n]);for(let f=0;f =0;--o){const r=b.dims[o];if(o!==n){const i=t%r;l+=i*e,e*=p[o]}t=Math.floor(t/r)}s[l]+=(b.data[f]-c.data[l])**2}for(let f=0;f s+h,0);return new Tensor(b.type,[p/b.data.length],[])}n=safeIndex(n,b.dims.length);const u=b.dims.slice();u[n]=1;const c=new b.data.constructor(b.data.length/b.dims[n]);for(let p=0;p =0;--h){const o=b.dims[h];if(h!==n){const t=f%o;s+=t*l,l*=u[h]}f=Math.floor(f/o)}c[s]+=b.data[p]}if(b.dims[n]!==1)for(let p=0;p 0||h>0;)switch(f.push(s-1),l.push(h-1),p[s][h].item()){case 0:--s,--h;break;case 1:--s;break;case 2:--h;break;default:throw new Error(`Internal error in dynamic time warping. Unexpected trace[${s}, ${h}]. Please file a bug report.`)}return f.reverse(),l.reverse(),[f,l]}function dimsToStride(b){const n=new Array(b.length);for(let a=b.length-1,u=1;a>=0;--a)n[a]=u,u*=b[a];return n}function ones(b){const n=b.reduce((a,u)=>a*u,1);return new Tensor("int64",new BigInt64Array(n).fill(1n),b)}function ones_like(b){return ones(b.dims)}class PriorityQueue{constructor(n=(a,u)=>a>u){this._heap=[],this._comparator=n}get size(){return this._heap.length}isEmpty(){return this.size===0}peek(){return this._heap[0]}push(...n){return this.extend(n)}extend(n){for(const a of n)this._heap.push(a),this._siftUp();return this.size}pop(){const n=this.peek(),a=this.size-1;return a>0&&this._swap(0,a),this._heap.pop(),this._siftDown(),n}replace(n){const a=this.peek();return this._heap[0]=n,this._siftDown(),a}_parent(n){return(n+1>>>1)-1}_left(n){return(n<<1)+1}_right(n){return n+1<<1}_greater(n,a){return this._comparator(this._heap[n],this._heap[a])}_swap(n,a){const u=this._heap[n];this._heap[n]=this._heap[a],this._heap[a]=u}_siftUp(){let n=this.size-1;for(;n>0&&this._greater(n,this._parent(n));)this._swap(n,this._parent(n)),n=this._parent(n)}_siftDown(){let n=0;for(;this._left(n) []),this.endNodes=Array.from({length:this.len+1},()=>[]);const c=new TokenLatticeNode(this.bosTokenId,0,0,0,0),p=new TokenLatticeNode(this.eosTokenId,1,this.len,0,0);this.nodes.push(c.clone()),this.nodes.push(p.clone()),this.beginNodes[this.len].push(p),this.endNodes[0].push(c)}insert(n,a,u,c){const p=this.nodes.length,s=new TokenLatticeNode(c,p,n,a,u);this.beginNodes[n].push(s),this.endNodes[n+a].push(s),this.nodes.push(s)}viterbi(){const n=this.len;let a=0;for(;a<=n;){if(this.beginNodes[a].length==0)return[];for(let h of this.beginNodes[a]){h.prev=null;let f=0,l=null;for(let o of this.endNodes[a]){const t=o.backtraceScore+h.score;(l===null||t>f)&&(l=o.clone(),f=t)}if(l!==null)h.prev=l,h.backtraceScore=f;else return[]}++a}const u=[],p=this.beginNodes[n][0].prev;if(p===null)return[];let s=p.clone();for(;s.prev!==null;)u.push(s.clone()),s=s.clone().prev.clone();return u.reverse(),u}piece(n){return this.sentence.slice(n.pos,n.pos+n.length)}tokens(){return this.viterbi().map(a=>this.piece(a))}tokenIds(){return this.viterbi().map(a=>a.tokenId)}}class TokenLatticeNode{constructor(n,a,u,c,p){this.tokenId=n,this.nodeId=a,this.pos=u,this.length=c,this.score=p,this.prev=null,this.backtraceScore=0}clone(){const n=new TokenLatticeNode(this.tokenId,this.nodeId,this.pos,this.length,this.score);return n.prev=this.prev,n.backtraceScore=this.backtraceScore,n}}async function loadTokenizer(b,n){return await Promise.all([getModelJSON(b,"tokenizer.json",!0,n),getModelJSON(b,"tokenizer_config.json",!0,n)])}function createPattern(b,n=!0){return b.Regex!==void 0?new RegExp(n?b.Regex:`(${b.Regex})`,"gu"):b.String!==void 0?b.String:(console.warn("Unknown pattern type:",b),null)}function objectToMap(b){return new Map(Object.entries(b))}function clean_up_tokenization(b){return b.replace(/ \./g,".").replace(/ \?/g,"?").replace(/ \!/g,"!").replace(/ ,/g,",").replace(/ \' /g,"'").replace(/ n\'t/g,"n't").replace(/ \'m/g,"'m").replace(/ \'s/g,"'s").replace(/ \'ve/g,"'ve").replace(/ \'re/g,"'re")}function remove_accents(b){return b.replace(/[\u0300-\u036f]/g,"")}function lowercase_and_remove_accent(b){return remove_accents(b.toLowerCase())}function fuse(b,n){let a=[],u=0;for(;u this.tokens_to_ids.get(u)??this.unk_token_id);return this.fuse_unk&&(a=fuse(a,this.unk_token_id)),a}convert_ids_to_tokens(n){return n.map(a=>this.vocab[a]??this.unk_token)}}class WordPieceTokenizer extends TokenizerModel{constructor(n){super(n),this.tokens_to_ids=objectToMap(n.vocab),this.unk_token_id=this.tokens_to_ids.get(n.unk_token),this.unk_token=n.unk_token,this.vocab=new Array(this.tokens_to_ids.size);for(const[a,u]of this.tokens_to_ids)this.vocab[u]=a}encode(n){let a=[];for(let u of n){let c=[...u],p=!1,s=0,h=[];for(;s 0&&(o=this.config.continuing_subword_prefix+o),this.tokens_to_ids.has(o)){l=o;break}--f}if(l===null){p=!0;break}h.push(l),s=f}p?a.push(this.unk_token):a.push(...h)}return a}}class Unigram extends TokenizerModel{constructor(n,a){super(n);const u=n.vocab.length;this.vocab=new Array(u),this.scores=new Array(u);for(let c=0;c[c,p])),this.bosToken=" ",this.bosTokenId=this.tokens_to_ids.get(this.bosToken),this.eosToken=a.eos_token,this.eosTokenId=this.tokens_to_ids.get(this.eosToken),this.unkToken=this.vocab[this.unk_token_id],this.minScore=min(this.scores)[0],this.unkScore=this.minScore-10,this.scores[this.unk_token_id]=this.unkScore,this.trie=new CharTrie,this.trie.extend(this.vocab),this.fuse_unk=!0}populateNodes(n){const a=n.sentence,u=a.length;let c=0;for(;c{const b=[...Array.from({length:"~".charCodeAt(0)-"!".charCodeAt(0)+1},(c,p)=>p+"!".charCodeAt(0)),...Array.from({length:"¬".charCodeAt(0)-"¡".charCodeAt(0)+1},(c,p)=>p+"¡".charCodeAt(0)),...Array.from({length:"ÿ".charCodeAt(0)-"®".charCodeAt(0)+1},(c,p)=>p+"®".charCodeAt(0))];let n=b.slice(),a=0;for(let c=0;c<256;++c)b.includes(c)||(b.push(c),n.push(256+a),a+=1);let u=n.map(c=>String.fromCharCode(c));return Object.fromEntries(b.map((c,p)=>[c,u[p]]))})(),UNICODE_TO_BYTES=reverseDictionary(BYTES_TO_UNICODE);class BPE extends TokenizerModel{constructor(n){super(n),this.BPE_SPLIT_TOKEN=" ",this.tokens_to_ids=objectToMap(n.vocab),this.unk_token_id=this.tokens_to_ids.get(n.unk_token),this.unk_token=n.unk_token,this.vocab=new Array(this.tokens_to_ids.size);for(const[a,u]of this.tokens_to_ids)this.vocab[u]=a;this.bpe_ranks=new Map(n.merges.map((a,u)=>[a,u])),this.merges=n.merges.map(a=>a.split(this.BPE_SPLIT_TOKEN)),this.end_of_word_suffix=n.end_of_word_suffix,this.continuing_subword_suffix=n.continuing_subword_suffix??null,this.byte_fallback=this.config.byte_fallback??!1,this.byte_fallback&&(this.text_encoder=new TextEncoder),this.cache=new Map}bpe(n){if(n.length===0)return[];const a=this.cache.get(n);if(a!==void 0)return a;const u=Array.from(n);this.end_of_word_suffix&&(u[u.length-1]+=this.end_of_word_suffix);let c=[];if(u.length>1){const p=new PriorityQueue((f,l)=>f.score `<0x${s.toString(16).toUpperCase().padStart(2,"0")}>`)):a.push(this.unk_token)}return a}}class LegacyTokenizerModel extends TokenizerModel{constructor(n,a){super(n),this.tokens_to_ids=objectToMap(a.target_lang?n.vocab[a.target_lang]:n.vocab),this.bos_token=a.bos_token,this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=a.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.pad_token=a.pad_token,this.pad_token_id=this.tokens_to_ids.get(this.pad_token),this.unk_token=a.unk_token,this.unk_token_id=this.tokens_to_ids.get(this.unk_token),this.vocab=new Array(this.tokens_to_ids.size);for(const[u,c]of this.tokens_to_ids)this.vocab[c]=u}encode(n){return n}}class Normalizer extends Callable{constructor(n){super(),this.config=n}static fromConfig(n){if(n===null)return null;switch(n.type){case"BertNormalizer":return new BertNormalizer(n);case"Precompiled":return new Precompiled(n);case"Sequence":return new NormalizerSequence(n);case"Replace":return new Replace(n);case"NFC":return new NFC(n);case"NFKD":return new NFKD(n);case"Strip":return new StripNormalizer(n);case"StripAccents":return new StripAccents(n);case"Lowercase":return new Lowercase(n);case"Prepend":return new Prepend(n);default:throw new Error(`Unknown Normalizer type: ${n.type}`)}}normalize(n){throw Error("normalize should be implemented in subclass.")}_call(n){return this.normalize(n)}}class Replace extends Normalizer{normalize(n){let a=createPattern(this.config.pattern);return a===null||(n=n.replaceAll(a,this.config.content)),n}}class NFC extends Normalizer{normalize(n){return n=n.normalize("NFC"),n}}class NFKD extends Normalizer{normalize(n){return n=n.normalize("NFKD"),n}}class StripNormalizer extends Normalizer{normalize(n){return this.config.strip_left&&this.config.strip_right?n=n.trim():(this.config.strip_left&&(n=n.trimStart()),this.config.strip_right&&(n=n.trimEnd())),n}}class StripAccents extends Normalizer{normalize(n){return n=remove_accents(n),n}}class Lowercase extends Normalizer{normalize(n){return n=n.toLowerCase(),n}}class Prepend extends Normalizer{normalize(n){return n=this.config.prepend+n,n}}class NormalizerSequence extends Normalizer{constructor(n){super(n),this.normalizers=n.normalizers.map(a=>Normalizer.fromConfig(a))}normalize(n){return this.normalizers.reduce((a,u)=>u.normalize(a),n)}}class BertNormalizer extends Normalizer{_tokenize_chinese_chars(n){let a=[];for(let u=0;u =19968&&n<=40959||n>=13312&&n<=19903||n>=131072&&n<=173791||n>=173824&&n<=177983||n>=177984&&n<=178207||n>=178208&&n<=183983||n>=63744&&n<=64255||n>=194560&&n<=195103}stripAccents(n){return n.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}normalize(n){return this.config.handle_chinese_chars&&(n=this._tokenize_chinese_chars(n)),this.config.lowercase?(n=n.toLowerCase(),this.config.strip_accents!==!1&&(n=this.stripAccents(n))):this.config.strip_accents&&(n=this.stripAccents(n)),n}}class PreTokenizer extends Callable{static fromConfig(n){if(n===null)return null;switch(n.type){case"BertPreTokenizer":return new BertPreTokenizer(n);case"Sequence":return new PreTokenizerSequence(n);case"WhitespaceSplit":return new WhitespaceSplit(n);case"Metaspace":return new MetaspacePreTokenizer(n);case"ByteLevel":return new ByteLevelPreTokenizer(n);case"Split":return new SplitPreTokenizer(n);case"Punctuation":return new PunctuationPreTokenizer(n);case"Digits":return new DigitsPreTokenizer(n);case"Replace":return new ReplacePreTokenizer(n);default:throw new Error(`Unknown PreTokenizer type: ${n.type}`)}}pre_tokenize_text(n){throw Error("pre_tokenize_text should be implemented in subclass.")}pre_tokenize(n){let a=[];return Array.isArray(n)?a=n.map(u=>this.pre_tokenize_text(u)):a=this.pre_tokenize_text(n),a.flat()}_call(n){return this.pre_tokenize(n)}}class BertPreTokenizer extends PreTokenizer{constructor(n){super(),this.pattern=new RegExp(`[^\\s${PUNCTUATION_REGEX}]+|[${PUNCTUATION_REGEX}]`,"gu")}pre_tokenize_text(n){return n.trim().match(this.pattern)||[]}}class ByteLevelPreTokenizer extends PreTokenizer{constructor(n){super(),this.config=n,this.add_prefix_space=this.config.add_prefix_space,this.trim_offsets=this.config.trim_offsets,this.use_regex=this.config.use_regex??!0,this.pattern=/'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu,this.byte_encoder=BYTES_TO_UNICODE,this.text_encoder=new TextEncoder}pre_tokenize_text(n){return this.add_prefix_space&&!n.startsWith(" ")&&(n=" "+n),(this.use_regex?n.match(this.pattern)||[]:[n]).map(u=>Array.from(this.text_encoder.encode(u),c=>this.byte_encoder[c]).join(""))}}class SplitPreTokenizer extends PreTokenizer{constructor(n){super(),this.config=n,this.pattern=createPattern(this.config.pattern,this.config.invert)}pre_tokenize_text(n){return this.pattern===null?[]:this.config.invert?n.match(this.pattern)||[]:n.split(this.pattern).filter(a=>a)}}class PunctuationPreTokenizer extends PreTokenizer{constructor(n){super(),this.config=n,this.pattern=new RegExp(`[^${PUNCTUATION_REGEX}]+|[${PUNCTUATION_REGEX}]+`,"gu")}pre_tokenize_text(n){return n.match(this.pattern)||[]}}class DigitsPreTokenizer extends PreTokenizer{constructor(n){super(),this.config=n;const a=`[^\\d]+|\\d${this.config.individual_digits?"":"+"}`;this.pattern=new RegExp(a,"gu")}pre_tokenize_text(n){return n.match(this.pattern)||[]}}class PostProcessor extends Callable{constructor(n){super(),this.config=n}static fromConfig(n){if(n===null)return null;switch(n.type){case"TemplateProcessing":return new TemplateProcessing(n);case"ByteLevel":return new ByteLevelPostProcessor(n);case"RobertaProcessing":return new RobertaProcessing(n);case"BertProcessing":return new BertProcessing(n);default:throw new Error(`Unknown PostProcessor type: ${n.type}`)}}post_process(n,...a){throw Error("post_process should be implemented in subclass.")}_call(n,...a){return this.post_process(n,...a)}}class BertProcessing extends PostProcessor{constructor(n){super(n),this.cls=n.cls[0],this.sep=n.sep[0]}post_process(n,a=null){return n=mergeArrays([this.cls],n,[this.sep]),a!==null&&(n=mergeArrays(n,[this.sep],a,[this.sep])),n}}class RobertaProcessing extends BertProcessing{}class TemplateProcessing extends PostProcessor{constructor(n){super(n),this.single=n.single,this.pair=n.pair}post_process(n,a=null){let u=a===null?this.single:this.pair,c=[];for(let p of u)"SpecialToken"in p?c.push(p.SpecialToken.id):"Sequence"in p&&(p.Sequence.id==="A"?c=mergeArrays(c,n):p.Sequence.id==="B"&&(c=mergeArrays(c,a)));return c}}class ByteLevelPostProcessor extends PostProcessor{post_process(n){return n}}class Decoder extends Callable{constructor(n){super(),this.config=n,this.added_tokens=[],this.end_of_word_suffix=null,this.trim_offsets=n.trim_offsets}static fromConfig(n){switch(n.type){case"WordPiece":return new WordPieceDecoder(n);case"Metaspace":return new MetaspaceDecoder(n);case"ByteLevel":return new ByteLevelDecoder(n);case"Replace":return new ReplaceDecoder(n);case"ByteFallback":return new ByteFallback(n);case"Fuse":return new FuseDecoder(n);case"Strip":return new StripDecoder(n);case"Sequence":return new DecoderSequence(n);case"CTC":return new CTCDecoder(n);case"BPEDecoder":return new BPEDecoder(n);default:throw new Error(`Unknown Decoder type: ${n.type}`)}}_call(n){return this.decode(n)}decode(n){return this.decode_chain(n).join("")}decode_chain(n){throw Error("`decode_chain` should be implemented in subclass.")}}class ReplaceDecoder extends Decoder{decode_chain(n){let a=createPattern(this.config.pattern);return a===null?n:n.map(u=>u.replaceAll(a,this.config.content))}}class ByteFallback extends Decoder{constructor(n){super(n),this.text_decoder=new TextDecoder}decode_chain(n){let a=[],u=[];for(let c of n){let p=null;if(c.length===6&&c.startsWith("<0x")&&c.endsWith(">")){let s=parseInt(c.slice(3,5),16);isNaN(s)||(p=s)}if(p!==null)u.push(p);else{if(u.length>0){let s=this.text_decoder.decode(Uint8Array.from(u));a.push(s),u=[]}a.push(c)}}if(u.length>0){let c=this.text_decoder.decode(Uint8Array.from(u));a.push(c),u=[]}return a}}class FuseDecoder extends Decoder{decode_chain(n){return[n.join("")]}}class StripDecoder extends Decoder{constructor(n){super(n),this.content=this.config.content,this.start=this.config.start,this.stop=this.config.stop}decode_chain(n){return n.map(a=>{let u=0;for(let p=0;p (u!==0&&(a.startsWith(this.config.prefix)?a=a.replace(this.config.prefix,""):a=" "+a),this.cleanup&&(a=clean_up_tokenization(a)),a))}}class ByteLevelDecoder extends Decoder{constructor(n){super(n),this.byte_decoder=UNICODE_TO_BYTES,this.text_decoder=new TextDecoder("utf-8",{fatal:!1,ignoreBOM:!0}),this.end_of_word_suffix=null}convert_tokens_to_string(n){let a=n.join(""),u=new Uint8Array([...a].map(p=>this.byte_decoder[p]));return this.text_decoder.decode(u)}decode_chain(n){let a=[],u=[];for(let c of n)this.added_tokens.includes(c)?(u.length>0&&(a.push(this.convert_tokens_to_string(u)),u=[]),a.push(c)):u.push(c);return u.length>0&&a.push(this.convert_tokens_to_string(u)),a}}class CTCDecoder extends Decoder{constructor(n){super(n),this.pad_token=this.config.pad_token,this.word_delimiter_token=this.config.word_delimiter_token,this.cleanup=this.config.cleanup}convert_tokens_to_string(n){if(n.length===0)return"";let a=[n[0]];for(let p=1;p p!==this.pad_token).join("");return this.cleanup&&(c=clean_up_tokenization(c).replaceAll(this.word_delimiter_token," ").trim()),c}decode_chain(n){return[this.convert_tokens_to_string(n)]}}class DecoderSequence extends Decoder{constructor(n){super(n),this.decoders=n.decoders.map(a=>Decoder.fromConfig(a))}decode_chain(n){return this.decoders.reduce((a,u)=>u.decode_chain(a),n)}}class BPEDecoder extends Decoder{constructor(n){super(n),this.suffix=this.config.suffix}decode_chain(n){return n.map((a,u)=>a.replaceAll(this.suffix,u===n.length-1?"":" "))}}class MetaspacePreTokenizer extends PreTokenizer{constructor(n){super(),this.addPrefixSpace=n.add_prefix_space,this.replacement=n.replacement,this.strRep=n.str_rep||this.replacement}pre_tokenize(n){typeof n=="string"&&(n=n.trimStart().split(/\s+/));const a=[];for(let u of n){let c=u.replaceAll(" ",this.strRep);this.addPrefixSpace&&!c.startsWith(this.replacement)&&(c=this.strRep+c),a.push(c)}return a}}class MetaspaceDecoder extends Decoder{constructor(n){super(n),this.addPrefixSpace=n.add_prefix_space,this.replacement=n.replacement}decode_chain(n){let a=[];for(let u=0;u u.normalize("NFKC")).join("~"):n=n.normalize("NFKC"),n}}class PreTokenizerSequence extends PreTokenizer{constructor(n){super(),this.tokenizers=n.pretokenizers.map(a=>PreTokenizer.fromConfig(a))}pre_tokenize_text(n){return typeof n=="string"&&(n=[n]),this.tokenizers.reduce((a,u)=>u.pre_tokenize(a),n)}}class WhitespaceSplit extends PreTokenizer{constructor(n){super()}pre_tokenize_text(n){return whitespace_split(n)}}class ReplacePreTokenizer extends PreTokenizer{constructor(n){super(),this.config=n,this.pattern=createPattern(this.config.pattern),this.content=this.config.content}pre_tokenize_text(n){return this.pattern===null?[n]:[n.replaceAll(this.pattern,this.config.content)]}}class PreTrainedTokenizer extends Callable{constructor(n,a){super(),this.normalizer=Normalizer.fromConfig(n.normalizer),this.pre_tokenizer=PreTokenizer.fromConfig(n.pre_tokenizer),this.model=TokenizerModel.fromConfig(n.model,a),this.post_processor=PostProcessor.fromConfig(n.post_processor),this.decoder=Decoder.fromConfig(n.decoder),this.decoder.end_of_word_suffix=this.model.end_of_word_suffix,this.special_tokens=[],this.all_special_ids=[],this.added_tokens=[];for(let u of n.added_tokens){let c=u.id,p=u.content;this.added_tokens.push(p),this.model.tokens_to_ids.set(p,c),this.model.vocab[c]=p,u.special&&(this.special_tokens.push(p),this.all_special_ids.push(c))}this.special_tokens.push(...a.additional_special_tokens??[]),this.special_tokens=[...new Set(this.special_tokens)],this.decoder.added_tokens=this.added_tokens,this.added_tokens_regex=this.added_tokens.length>0?new RegExp("("+this.added_tokens.map(escapeRegExp).join("|")+")"):null,this.mask_token=this.getToken(a,"mask_token"),this.mask_token_id=this.model.tokens_to_ids.get(this.mask_token),this.pad_token=this.getToken(a,"pad_token","eos_token"),this.pad_token_id=this.model.tokens_to_ids.get(this.pad_token),this.sep_token=this.getToken(a,"sep_token"),this.sep_token_id=this.model.tokens_to_ids.get(this.sep_token),this.model_max_length=a.model_max_length,this.remove_space=a.remove_space,this.clean_up_tokenization_spaces=a.clean_up_tokenization_spaces??!0,this.do_lowercase_and_remove_accent=a.do_lowercase_and_remove_accent??!1,this.padding_side="right"}getToken(n,...a){for(let u of a){let c=n[u];if(c)if(typeof c=="object"){if(c.__type==="AddedToken")return c.content;throw Error(`Unknown token: ${c}`)}else return c}return null}static async from_pretrained(n,{progress_callback:a=null,config:u=null,cache_dir:c=null,local_files_only:p=!1,revision:s="main"}={}){let h=await loadTokenizer(n,{progress_callback:a,config:u,cache_dir:c,local_files_only:p,revision:s});return new this(...h)}prepare_model_inputs(n){return n}_call(n,{text_pair:a=null,add_special_tokens:u=!0,padding:c=!1,truncation:p=null,max_length:s=null,return_tensor:h=!0}={}){let f;if(Array.isArray(n)){if(n.length===0)throw Error("text array must be non-empty");if(a!==null){if(Array.isArray(a)){if(n.length!==a.length)throw Error("text and text_pair must have the same length")}else throw Error("text_pair must also be an array");f=n.map((e,r)=>this.encode(e,a[r],{add_special_tokens:u}))}else f=n.map(e=>this.encode(e,null,{add_special_tokens:u}))}else{if(n===null)throw Error("text may not be null");if(Array.isArray(a))throw Error("When specifying `text_pair`, since `text` is a string, `text_pair` must also be a string (i.e., not an array).");f=[this.encode(n,a,{add_special_tokens:u})]}let l=max(f.map(e=>e.length))[0];s===null&&(s=l),s=Math.min(s,this.model_max_length);let o=[];if(c||p)for(let e=0;e s)p&&(f[e]=f[e].slice(0,s)),o.push(new Array(f[e].length).fill(1));else if(c){let r=s-f[e].length;this.padding_side==="right"?(o.push(new Array(f[e].length).fill(1).concat(new Array(r).fill(0))),f[e].push(...new Array(r).fill(this.pad_token_id))):(o.push(new Array(r).fill(0).concat(new Array(f[e].length).fill(1))),f[e].unshift(...new Array(r).fill(this.pad_token_id)))}else o.push(new Array(f[e].length).fill(1));else o=f.map(e=>new Array(e.length).fill(1));if(h){if(!(c&&p)&&f.some(r=>r.length!==f[0].length))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=true' and 'truncation=true' to have batched tensors with the same length.");let e=[f.length,f[0].length];f=new Tensor("int64",BigInt64Array.from(f.flat().map(BigInt)),e),o=new Tensor("int64",BigInt64Array.from(o.flat().map(BigInt)),e)}else Array.isArray(n)||(f=f[0],o=o[0]);let t={input_ids:f,attention_mask:o};return t=this.prepare_model_inputs(t),t}_encode_text(n){return n===null?null:(this.added_tokens_regex?n.split(this.added_tokens_regex).filter(c=>c):[n]).map(c=>{if(this.added_tokens.includes(c))return c;{this.remove_space===!0&&(c=c.trim().split(/\s+/).join(" ")),this.do_lowercase_and_remove_accent&&(c=lowercase_and_remove_accent(c)),this.normalizer!==null&&(c=this.normalizer(c));let p=this.pre_tokenizer!==null?this.pre_tokenizer(c):[c];return this.model(p)}}).flat()}encode(n,a=null,{add_special_tokens:u=!0}={}){let c=this._encode_text(n),p=this._encode_text(a),s=this.post_processor!==null&&u?this.post_processor(c,p):mergeArrays(c??[],p??[]);return this.model.convert_tokens_to_ids(s)}batch_decode(n,a={}){return n.map(u=>this.decode(u,a))}decode(n,a={}){if(!Array.isArray(n)||n.length===0||!isIntegralNumber(n[0]))throw Error("token_ids must be a non-empty array of integers.");return this.decode_single(n,a)}decode_single(n,{skip_special_tokens:a=!1,clean_up_tokenization_spaces:u=null}){let c=this.model.convert_ids_to_tokens(n);a&&(c=c.filter(s=>!this.special_tokens.includes(s)));let p=this.decoder(c);return this.decoder.end_of_word_suffix&&(p=p.replaceAll(this.decoder.end_of_word_suffix," "),a&&(p=p.trim())),(u??this.clean_up_tokenization_spaces)&&(p=clean_up_tokenization(p)),p}}function add_token_types(b){if(b.input_ids instanceof Tensor)b.token_type_ids=new Tensor("int64",new BigInt64Array(b.input_ids.data.length),b.input_ids.dims);else if(Array.isArray(b.input_ids))Array.isArray(b.input_ids[0])?b.token_type_ids=b.input_ids.map(n=>new Array(n.length).fill(0)):b.token_type_ids=new Array(b.input_ids.length).fill(0);else throw new Error("Input ids must be a Tensor or an Array");return b}class BertTokenizer extends PreTrainedTokenizer{prepare_model_inputs(n){return add_token_types(n)}}class AlbertTokenizer extends PreTrainedTokenizer{prepare_model_inputs(n){return add_token_types(n)}}class MobileBertTokenizer extends PreTrainedTokenizer{prepare_model_inputs(n){return add_token_types(n)}}class SqueezeBertTokenizer extends PreTrainedTokenizer{prepare_model_inputs(n){return add_token_types(n)}}class DebertaTokenizer extends PreTrainedTokenizer{prepare_model_inputs(n){return add_token_types(n)}}class DebertaV2Tokenizer extends PreTrainedTokenizer{prepare_model_inputs(n){return add_token_types(n)}}class HerbertTokenizer extends PreTrainedTokenizer{prepare_model_inputs(n){return add_token_types(n)}}class DistilBertTokenizer extends PreTrainedTokenizer{}class CamembertTokenizer extends PreTrainedTokenizer{}class XLMTokenizer extends PreTrainedTokenizer{constructor(n,a){super(n,a),console.warn('WARNING: `XLMTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}prepare_model_inputs(n){return add_token_types(n)}}class T5Tokenizer extends PreTrainedTokenizer{}class GPT2Tokenizer extends PreTrainedTokenizer{}class BartTokenizer extends PreTrainedTokenizer{}class MBartTokenizer extends PreTrainedTokenizer{constructor(n,a){super(n,a),this.languageRegex=/^[a-z]{2}_[A-Z]{2}$/,this.language_codes=this.special_tokens.filter(u=>this.languageRegex.test(u)),this.lang_to_token=u=>u}_build_translation_inputs(n,a,u){return _build_translation_inputs(this,n,a,u)}}class MBart50Tokenizer extends MBartTokenizer{}class RobertaTokenizer extends PreTrainedTokenizer{}class BloomTokenizer extends PreTrainedTokenizer{constructor(n,a){var p,s;const u=".,!?…。,、।۔،",c=(s=(p=n.pre_tokenizer)==null?void 0:p.pretokenizers[0])==null?void 0:s.pattern;c&&c.Regex===` ?[^(\\s|[${u}])]+`&&(c.Regex=` ?[^\\s${u}]+`),super(n,a)}}class LlamaTokenizer extends PreTrainedTokenizer{}class CodeLlamaTokenizer extends PreTrainedTokenizer{}class XLMRobertaTokenizer extends PreTrainedTokenizer{}class MPNetTokenizer extends PreTrainedTokenizer{}class FalconTokenizer extends PreTrainedTokenizer{}class GPTNeoXTokenizer extends PreTrainedTokenizer{}function _build_translation_inputs(b,n,a,u){if(!("language_codes"in b)||!Array.isArray(b.language_codes))throw new Error("Tokenizer must have `language_codes` attribute set and it should be an array of language ids.");if(!("languageRegex"in b)||!(b.languageRegex instanceof RegExp))throw new Error("Tokenizer must have `languageRegex` attribute set and it should be a regular expression.");if(!("lang_to_token"in b)||typeof b.lang_to_token!="function")throw new Error("Tokenizer must have `lang_to_token` attribute set and it should be a function.");const c=u.src_lang,p=u.tgt_lang;if(!b.language_codes.includes(p))throw new Error(`Target language code "${p}" is not valid. Must be one of: {${b.language_codes.join(", ")}}`);if(c!==void 0){if(!b.language_codes.includes(c))throw new Error(`Source language code "${c}" is not valid. Must be one of: {${b.language_codes.join(", ")}}`);for(let s of b.post_processor.config.single)if("SpecialToken"in s&&b.languageRegex.test(s.SpecialToken.id)){s.SpecialToken.id=b.lang_to_token(c);break}}return u.forced_bos_token_id=b.model.convert_tokens_to_ids([b.lang_to_token(p)])[0],b._call(n,a)}class NllbTokenizer extends PreTrainedTokenizer{constructor(n,a){super(n,a),this.languageRegex=/^[a-z]{3}_[A-Z][a-z]{3}$/,this.language_codes=this.special_tokens.filter(u=>this.languageRegex.test(u)),this.lang_to_token=u=>u}_build_translation_inputs(n,a,u){return _build_translation_inputs(this,n,a,u)}}class M2M100Tokenizer extends PreTrainedTokenizer{constructor(n,a){super(n,a),this.languageRegex=/^__[a-z]{2,3}__$/,this.language_codes=this.special_tokens.filter(u=>this.languageRegex.test(u)).map(u=>u.slice(2,-2)),this.lang_to_token=u=>`__${u}__`}_build_translation_inputs(n,a,u){return _build_translation_inputs(this,n,a,u)}}const WHISPER_LANGUAGES=[["en","english"],["zh","chinese"],["de","german"],["es","spanish"],["ru","russian"],["ko","korean"],["fr","french"],["ja","japanese"],["pt","portuguese"],["tr","turkish"],["pl","polish"],["ca","catalan"],["nl","dutch"],["ar","arabic"],["sv","swedish"],["it","italian"],["id","indonesian"],["hi","hindi"],["fi","finnish"],["vi","vietnamese"],["he","hebrew"],["uk","ukrainian"],["el","greek"],["ms","malay"],["cs","czech"],["ro","romanian"],["da","danish"],["hu","hungarian"],["ta","tamil"],["no","norwegian"],["th","thai"],["ur","urdu"],["hr","croatian"],["bg","bulgarian"],["lt","lithuanian"],["la","latin"],["mi","maori"],["ml","malayalam"],["cy","welsh"],["sk","slovak"],["te","telugu"],["fa","persian"],["lv","latvian"],["bn","bengali"],["sr","serbian"],["az","azerbaijani"],["sl","slovenian"],["kn","kannada"],["et","estonian"],["mk","macedonian"],["br","breton"],["eu","basque"],["is","icelandic"],["hy","armenian"],["ne","nepali"],["mn","mongolian"],["bs","bosnian"],["kk","kazakh"],["sq","albanian"],["sw","swahili"],["gl","galician"],["mr","marathi"],["pa","punjabi"],["si","sinhala"],["km","khmer"],["sn","shona"],["yo","yoruba"],["so","somali"],["af","afrikaans"],["oc","occitan"],["ka","georgian"],["be","belarusian"],["tg","tajik"],["sd","sindhi"],["gu","gujarati"],["am","amharic"],["yi","yiddish"],["lo","lao"],["uz","uzbek"],["fo","faroese"],["ht","haitian creole"],["ps","pashto"],["tk","turkmen"],["nn","nynorsk"],["mt","maltese"],["sa","sanskrit"],["lb","luxembourgish"],["my","myanmar"],["bo","tibetan"],["tl","tagalog"],["mg","malagasy"],["as","assamese"],["tt","tatar"],["haw","hawaiian"],["ln","lingala"],["ha","hausa"],["ba","bashkir"],["jw","javanese"],["su","sundanese"]],WHISPER_LANGUAGE_MAPPING=new Map(WHISPER_LANGUAGES),WHISPER_TO_LANGUAGE_CODE_MAPPING=new Map([...WHISPER_LANGUAGES.map(([b,n])=>[n,b]),["burmese","my"],["valencian","ca"],["flemish","nl"],["haitian","ht"],["letzeburgesch","lb"],["pushto","ps"],["panjabi","pa"],["moldavian","ro"],["moldovan","ro"],["sinhalese","si"],["castilian","es"]]);class WhisperTokenizer extends PreTrainedTokenizer{_decode_asr(n,{return_timestamps:a=!1,return_language:u=!1,time_precision:c=null,force_full_sequences:p=!0}={}){if(c===null)throw Error("Must specify time_precision");let s=null;const h=a==="word";function f(){return{language:s,timestamp:[null,null],text:""}}const l=[];let o=f(),t=0;const e=this.model.convert_tokens_to_ids(["<|notimestamps|>"])[0]+1;let r=[],i=[],d=!1,g=null;const m=new Set(this.all_special_ids);for(let w of n){const v=w.tokens,S=h?w.token_timestamps:null;let O=null,A=e;if("stride"in w){const[N,B,$]=w.stride;if(t-=B,g=N-$,B&&(A=B/c+e),$)for(let L=v.length-1;L>=0;--L){const H=v[L];if(H>=e){if(O!==null&&(H-e)*c =e){const $=(B-e)*c+t,L=round($,2);if(O!==null&&B>=O)d=!0;else if(d||r.length>0&&B0?(r.push(T),h&&i.push(M)):r.every(N=>N.length===0)&&(o=f(),r=[],T=[],i=[],M=[])}if(r.length>0){if(p&&a)throw new Error("Whisper did not predict an ending timestamp, which can happen if audio is cut off in the middle of a word. Also make sure WhisperTimeStampLogitsProcessor was used during generation.");const[w,v]=this.findLongestCommonSequence(r,i),S=this.decode(w);o.text=S,h&&(o.words=this.collateWordTimestamps(w,v,s)),l.push(o)}let _=Object.create(null);const y=l.map(w=>w.text).join("");if(a||u){for(let w=0;w 0;let h=s?[]:null,f=s?a[0]:null;for(let l=1;l L===N[H]).length,$=B/w+v;B>1&&$>t&&(t=$,e=[S,O,T,M])}const[i,d,g,m]=e,_=Math.floor((d+i)/2),y=Math.floor((m+g)/2);p.push(...u.slice(0,_)),u=o.slice(y),c=u.length,s&&(h.push(...f.slice(0,_)),f=a[l].slice(y))}return p.push(...u),s?(h.push(...f),[p,h]):[p,[]]}collateWordTimestamps(n,a,u){let[c,p,s]=this.combineTokensIntoWords(n,u),h=[];for(let f=0;f =c){let h=(s-c)*u;h=round(h,2),p.push(`<|${h}|>`),p.push([])}else p[p.length-1].push(s);return p=p.map(s=>typeof s=="string"?s:super.decode(s,a)),p.join("")}splitTokensOnUnicode(n){const a=this.decode(n,{decode_with_timestamps:!0}),u="�";let c=[],p=[],s=[],h=[],f=[],l=0;for(let o=0;o =this.model.tokens_to_ids.get("<|endoftext|>"),i=o.startsWith(" "),d=o.trim(),g=f.test(d);if(r||i||g||p.length===0)p.push(o),s.push(t),h.push(e);else{const m=p.length-1;p[m]+=o,s[m].push(...t),h[m].push(...e)}}return[p,s,h]}mergePunctuations(n,a,u,c,p){let s=structuredClone(n),h=structuredClone(a),f=structuredClone(u),l=s.length-2,o=s.length-1;for(;l>=0;)s[l].startsWith(" ")&&c.includes(s[l].trim())?(s[o]=s[l]+s[o],h[o]=mergeArrays(h[l],h[o]),f[o]=mergeArrays(f[l],f[o]),s[l]="",h[l]=[],f[l]=[]):o=l,--l;for(l=0,o=1;o t),h.filter(t=>t.length>0),f.filter(t=>t.length>0)]}get_decoder_prompt_ids({language:n=null,task:a=null,no_timestamps:u=!0}={}){let c=[];if(n){n=n.toLowerCase();let p=WHISPER_TO_LANGUAGE_CODE_MAPPING.get(n);if(p===void 0)if(WHISPER_LANGUAGE_MAPPING.has(n))p=n;else{const f=n.length===2?WHISPER_LANGUAGE_MAPPING.keys():WHISPER_LANGUAGE_MAPPING.values();throw new Error(`Language "${n}" is not supported. Must be one of: ${JSON.stringify(f)}`)}let s=this.model.tokens_to_ids.get(`<|${p}|>`);if(s===void 0)throw new Error(`Unable to find language "${p}" in model vocabulary. Please report this issue at https://github.com/xenova/transformers.js/issues/new/choose.`);c.push(s)}else c.push(null);if(a){if(a=a.toLowerCase(),a!=="transcribe"&&a!=="translate")throw new Error(`Task "${a}" is not supported. Must be one of: ["transcribe", "translate"]`);let p=this.model.tokens_to_ids.get(`<|${a}|>`);if(p===void 0)throw new Error(`Unable to find task "${a}" in model vocabulary. Please report this issue at https://github.com/xenova/transformers.js/issues/new/choose.`);c.push(p)}else c.push(null);if(u){let p=this.model.tokens_to_ids.get("<|notimestamps|>");if(p===void 0)throw new Error('Unable to find "<|notimestamps|>" in model vocabulary. Please report this issue at https://github.com/xenova/transformers.js/issues/new/choose.');c.push(p)}return c.map((p,s)=>[s+1,p]).filter(p=>p[1]!==null)}}class CodeGenTokenizer extends PreTrainedTokenizer{}class CLIPTokenizer extends PreTrainedTokenizer{}class MarianTokenizer extends PreTrainedTokenizer{constructor(n,a){super(n,a),this.languageRegex=/^(>>\w+<<)\s*/g,this.supported_language_codes=this.model.vocab.filter(u=>this.languageRegex.test(u)),console.warn('WARNING: `MarianTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}_encode_text(n){if(n===null)return null;let[a,...u]=n.trim().split(this.languageRegex);if(u.length===0)return super._encode_text(a);if(u.length===2){let[c,p]=u;return this.supported_language_codes.includes(c)||console.warn(`Unsupported language code "${c}" detected, which may lead to unexpected behavior. Should be one of: ${JSON.stringify(this.supported_language_codes)}`),mergeArrays([c],super._encode_text(p))}}}class Wav2Vec2CTCTokenizer extends PreTrainedTokenizer{}class BlenderbotTokenizer extends PreTrainedTokenizer{}class BlenderbotSmallTokenizer extends PreTrainedTokenizer{}class SpeechT5Tokenizer extends PreTrainedTokenizer{}class AutoTokenizer{static async from_pretrained(n,{quantized:a=!0,progress_callback:u=null,config:c=null,cache_dir:p=null,local_files_only:s=!1,revision:h="main"}={}){let[f,l]=await loadTokenizer(n,{quantized:a,progress_callback:u,config:c,cache_dir:p,local_files_only:s,revision:h}),o=l.tokenizer_class.replace(/Fast$/,""),t=this.TOKENIZER_CLASS_MAPPING[o];return t||(console.warn(`Unknown tokenizer class "${o}", attempting to construct from base class.`),t=PreTrainedTokenizer),new t(f,l)}}je(AutoTokenizer,"TOKENIZER_CLASS_MAPPING",{T5Tokenizer,DistilBertTokenizer,CamembertTokenizer,DebertaTokenizer,DebertaV2Tokenizer,BertTokenizer,HerbertTokenizer,XLMTokenizer,MobileBertTokenizer,SqueezeBertTokenizer,AlbertTokenizer,GPT2Tokenizer,BartTokenizer,MBartTokenizer,MBart50Tokenizer,RobertaTokenizer,WhisperTokenizer,CodeGenTokenizer,CLIPTokenizer,MarianTokenizer,BloomTokenizer,NllbTokenizer,M2M100Tokenizer,LlamaTokenizer,CodeLlamaTokenizer,XLMRobertaTokenizer,MPNetTokenizer,FalconTokenizer,GPTNeoXTokenizer,Wav2Vec2CTCTokenizer,BlenderbotTokenizer,BlenderbotSmallTokenizer,SpeechT5Tokenizer,PreTrainedTokenizer});async function loadConfig(b,n){return await getModelJSON(b,"config.json",!0,n)}class PretrainedConfig{constructor(n){this.model_type=null,this.is_encoder_decoder=!1,Object.assign(this,n)}static async from_pretrained(n,{progress_callback:a=null,config:u=null,cache_dir:c=null,local_files_only:p=!1,revision:s="main"}={}){let h=u??await loadConfig(n,{progress_callback:a,config:u,cache_dir:c,local_files_only:p,revision:s});return new this(h)}}class AutoConfig{static async from_pretrained(...n){return PretrainedConfig.from_pretrained(...n)}}class LogitsProcessorList extends Callable{constructor(){super(),this.processors=[]}push(n){this.processors.push(n)}extend(n){this.processors.push(...n)}_call(n,a){for(let u of a)this.processors.forEach(c=>c(n,u))}[Symbol.iterator](){return this.processors.values()}}class LogitsProcessor extends Callable{_call(n,a){throw Error("`_call` should be implemented in a subclass")}}class ForceTokensLogitsProcessor extends LogitsProcessor{constructor(n){super(),this.force_token_map=Object.fromEntries(n??[])}_call(n,a){let u=this.force_token_map[n.length];return exists(u)&&(a.data.fill(-1/0),a.data[u]=0),a}}class ForcedBOSTokenLogitsProcessor extends LogitsProcessor{constructor(n){super(),this.bos_token_id=n}_call(n,a){return n.length===1&&(a.data.fill(-1/0),a.data[this.bos_token_id]=0),a}}class ForcedEOSTokenLogitsProcessor extends LogitsProcessor{constructor(n,a){super(),this.max_length=n,this.forced_eos_token_id=a}_call(n,a){}}class SuppressTokensAtBeginLogitsProcessor extends LogitsProcessor{constructor(n,a){super(),this.begin_suppress_tokens=n,this.begin_index=a}_call(n,a){if(n.length===this.begin_index)for(let u of this.begin_suppress_tokens)a.data[u]=-1/0;return a}}class WhisperTimeStampLogitsProcessor extends LogitsProcessor{constructor(n){super(),this.eos_token_id=n.eos_token_id,this.no_timestamps_token_id=n.no_timestamps_token_id,this.timestamp_begin=this.no_timestamps_token_id+1,this.begin_index=(n.forced_decoder_ids||[]).length+2,n.forced_decoder_ids.slice(-1)[0][1]===this.no_timestamps_token_id&&(this.begin_index-=1),this.max_initial_timestamp_index=n.max_initial_timestamp_index}_call(n,a){if(a.data[this.no_timestamps_token_id]=-1/0,n.length===this.begin_index-1)return a.data.fill(-1/0),a.data[this.timestamp_begin]=0,a;const u=n.slice(this.begin_index),c=u.length>=1&&u[u.length-1]>=this.timestamp_begin,p=u.length<2||u[u.length-2]>=this.timestamp_begin;if(c&&(p?a.data.subarray(this.timestamp_begin).fill(-1/0):a.data.subarray(0,this.eos_token_id).fill(-1/0)),n.length===this.begin_index&&this.max_initial_timestamp_index!==null){const l=this.timestamp_begin+this.max_initial_timestamp_index;a.data.subarray(l+1).fill(-1/0)}const s=log_softmax(a.data),h=Math.log(s.subarray(this.timestamp_begin).map(Math.exp).reduce((l,o)=>l+o)),f=max(s.subarray(0,this.timestamp_begin))[0];return h>f&&a.data.subarray(0,this.timestamp_begin).fill(-1/0),a}}class NoRepeatNGramLogitsProcessor extends LogitsProcessor{constructor(n){super(),this.no_repeat_ngram_size=n}getNgrams(n){const a=n.length,u=[];for(let p=0;p0&&(c=c.map(p=>p/this.generation_config.temperature)),c}randomSelect(n){let a=n.reduce((c,p)=>c+p,0),u=Math.random()*a;for(let c=0;c 1)return new BeamSearchSampler(n);if(n.num_return_sequences>1)throw Error(`num_return_sequences has to be 1 when doing greedy search, but is ${n.num_return_sequences}.`);return new GreedySampler(n)}}class GreedySampler extends Sampler{sample(n,a=-1){let u=this.getLogits(n,a);return[[max(u)[1],0]]}}class MultinomialSampler extends Sampler{sample(n,a=-1){let u=n.dims.at(-1);this.generation_config.top_k>0&&(u=Math.min(this.generation_config.top_k,u));const c=this.getLogits(n,a),p=getTopItems(c,u),s=softmax(p.map(h=>h[1]));return Array.from({length:this.generation_config.num_beams},()=>{const h=this.randomSelect(s);return[p[h][0],Math.log(s[h])]})}}class BeamSearchSampler extends Sampler{sample(n,a=-1){let u=n.dims.at(-1);this.generation_config.top_k>0&&(u=Math.min(this.generation_config.top_k,u));const c=this.getLogits(n,a),p=getTopItems(c,u),s=softmax(p.map(h=>h[1]));return Array.from({length:this.generation_config.num_beams},(h,f)=>[p[f][0],Math.log(s[f])])}}const{InferenceSession,Tensor:ONNXTensor}=ONNX,MODEL_TYPES={EncoderOnly:0,EncoderDecoder:1,Seq2Seq:2,Vision2Seq:3,DecoderOnly:4},MODEL_TYPE_MAPPING=new Map,MODEL_NAME_TO_CLASS_MAPPING=new Map,MODEL_CLASS_TO_NAME_MAPPING=new Map;async function constructSession(b,n,a){let u=`onnx/${n}${a.quantized?"_quantized":""}.onnx`,c=await getModelFile(b,u,!0,a);try{return await InferenceSession.create(c,{executionProviders})}catch(p){if(executionProviders.length===1&&executionProviders[0]==="wasm")throw p;return console.warn(p),console.warn("Something went wrong during model construction (most likely a missing operation). Using `wasm` as a fallback. "),await InferenceSession.create(c,{executionProviders:["wasm"]})}}async function validateInputs(b,n){const a={},u=[];for(let s of b.inputNames)n[s]===void 0?u.push(s):a[s]=n[s];if(u.length>0)throw new Error(`An error occurred during model execution: "Missing the following inputs: ${u.join(", ")}.`);const c=Object.keys(n).length,p=b.inputNames.length;if(c>p){let s=Object.keys(n).filter(h=>!b.inputNames.includes(h));console.warn(`WARNING: Too many inputs were provided (${c} > ${p}). The following inputs will be ignored: "${s.join(", ")}".`)}return a}async function sessionRun(b,n){const a=await validateInputs(b,n);try{let u=await b.run(a);return u=replaceTensors(u),u}catch(u){throw console.error(`An error occurred during model execution: "${u}".`),console.error("Inputs given to model:",a),u}}function replaceTensors(b){for(let n in b)b[n]instanceof ONNXTensor?b[n]=new Tensor(b[n]):typeof b[n]=="object"&&replaceTensors(b[n]);return b}function toI64Tensor(b){if(b instanceof Tensor)return b;if(b.length===0)throw Error("items must be non-empty");if(Array.isArray(b[0])){if(b.some(n=>n.length!==b[0].length))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=True' and/or 'truncation=True' to have batched tensors with the same length.");return new Tensor("int64",BigInt64Array.from(b.flat().map(n=>BigInt(n))),[b.length,b[0].length])}else return new Tensor("int64",BigInt64Array.from(b.map(n=>BigInt(n))),[1,b.length])}function prepareAttentionMask(b,n){let a=b.config.pad_token_id??null,u=b.config.eos_token_id??null;isIntegralNumber(u)&&(u=[u]);let c=n.indexOf(a)!==-1,p=u===null||!u.includes(a);if(c&&p){let s=BigInt64Array.from(n.data.map(h=>h!=a));return new Tensor("int64",s,n.dims)}else return ones_like(n)}function boolTensor(b){return new Tensor("bool",[b],[1])}async function seq2seqForward(b,n){let{encoder_outputs:a,past_key_values:u}=n;a||(a=(await encoderForward(b,n)).last_hidden_state);let c={input_ids:n.decoder_input_ids,encoder_hidden_states:a,use_cache_branch:boolTensor(!!u)};b.decoder_merged_session.inputNames.includes("encoder_attention_mask")&&(c.encoder_attention_mask=n.attention_mask),b.addPastKeyValues(c,u);const p=await sessionRun(b.decoder_merged_session,c);let s=p.logits;u=b.getPastKeyValues(p,u);const h=b.getAttentions(p);return new Seq2SeqLMOutput({logits:s,past_key_values:u,encoder_outputs:a,...h})}function seq2seqStartBeams(b,n,a,u){let c=[],p=0;const s=b.requires_attention_mask??!0;let h=a.decoder_input_ids??a.decoder_start_token_id??a.bos_token_id??a.eos_token_id;h instanceof Tensor?h=h.tolist().flat():Array.isArray(h)||(h=[h]);for(let f of n){f.dims=[1,...f.dims];let l={inputs:f,encoder_outputs:null,prev_model_outputs:null,output_token_ids:h,done:!1,score:0,id:p++};s&&(l.attention_mask=prepareAttentionMask(b,f)),c.push(l)}return c}async function seq2seqRunBeam(b,n){var s;const a=b.main_input_name;let u=n.output_token_ids;n.prev_model_outputs&&(u=u.slice(-1));let c={[a]:n.inputs,decoder_input_ids:toI64Tensor(u),encoder_outputs:n.encoder_outputs,past_key_values:(s=n.prev_model_outputs)==null?void 0:s.past_key_values};n.attention_mask&&(c.attention_mask=n.attention_mask);let p=await b.forward(c);return n.prev_model_outputs=p,n.encoder_outputs=p.encoder_outputs,p}function seq2seqUpdatebeam(b,n){b.output_token_ids=[...b.output_token_ids,n]}async function encoderForward(b,n){let a={};for(let u of b.session.inputNames)a[u]=n[u];return await sessionRun(b.session,a)}async function decoderForward(b,n){let{input_ids:a,past_key_values:u,attention_mask:c}=n,p={input_ids:a,attention_mask:c??prepareAttentionMask(b,a),use_cache_branch:boolTensor(!!u)};b.addPastKeyValues(p,u);let s=await sessionRun(b.session,p),h=s.logits;return u=b.getPastKeyValues(s,u),{logits:h,past_key_values:u}}function decoderStartBeams(b,n,a,u,c){let p=[],s=0;for(let h of n){let f=h.tolist().map(Number);h.dims=[1,...h.dims];let l;c?(l=c[s],l.dims=[1,...l.dims]):l=prepareAttentionMask(b,h);let o={input:h,model_input_ids:h,attention_mask:l,prev_model_outputs:null,output_token_ids:f,num_output_tokens:u,done:!1,score:0,id:s++};p.push(o)}return p}async function decoderRunBeam(b,n){var p;let a=new BigInt64Array(n.output_token_ids.length).fill(1n),u={input_ids:n.model_input_ids,attention_mask:new Tensor("int64",a,[1,a.length]),past_key_values:(p=n.prev_model_outputs)==null?void 0:p.past_key_values},c=await b.forward(u);return n.prev_model_outputs=c,c}function decoderUpdatebeam(b,n){b.output_token_ids=[...b.output_token_ids,n],b.model_input_ids=new Tensor("int64",[BigInt(n)],[1,1])}class PreTrainedModel extends Callable{constructor(a,u){super();je(this,"main_input_name","input_ids");this.config=a,this.session=u;const c=MODEL_CLASS_TO_NAME_MAPPING.get(this.constructor),p=MODEL_TYPE_MAPPING.get(c);this.can_generate=!1,this._runBeam=null,this._getStartBeams=null,this._updateBeam=null,this._forward=null,p===MODEL_TYPES.DecoderOnly?(this.can_generate=!0,this._runBeam=decoderRunBeam,this._getStartBeams=decoderStartBeams,this._updateBeam=decoderUpdatebeam,this._forward=decoderForward):p===MODEL_TYPES.Seq2Seq||p===MODEL_TYPES.Vision2Seq?(this.can_generate=!0,this._runBeam=seq2seqRunBeam,this._getStartBeams=seq2seqStartBeams,this._updateBeam=seq2seqUpdatebeam,this._forward=seq2seqForward):p===MODEL_TYPES.EncoderDecoder?this._forward=encoderForward:this._forward=encoderForward}async dispose(){let a=[];for(let u of Object.keys(this)){let c=this[u];c instanceof InferenceSession&&a.push(c.handler.dispose())}return await Promise.all(a)}static async from_pretrained(a,{quantized:u=!0,progress_callback:c=null,config:p=null,cache_dir:s=null,local_files_only:h=!1,revision:f="main",model_file_name:l=null}={}){let o={quantized:u,progress_callback:c,config:p,cache_dir:s,local_files_only:h,revision:f,model_file_name:l};const t=MODEL_CLASS_TO_NAME_MAPPING.get(this),e=MODEL_TYPE_MAPPING.get(t);let r;return e===MODEL_TYPES.DecoderOnly?r=await Promise.all([AutoConfig.from_pretrained(a,o),constructSession(a,o.model_file_name??"decoder_model_merged",o),getModelJSON(a,"generation_config.json",!1,o)]):e===MODEL_TYPES.Seq2Seq||e===MODEL_TYPES.Vision2Seq?r=await Promise.all([AutoConfig.from_pretrained(a,o),constructSession(a,"encoder_model",o),constructSession(a,"decoder_model_merged",o),getModelJSON(a,"generation_config.json",!1,o)]):e===MODEL_TYPES.EncoderDecoder?r=await Promise.all([AutoConfig.from_pretrained(a,o),constructSession(a,"encoder_model",o),constructSession(a,"decoder_model_merged",o)]):(e!==MODEL_TYPES.EncoderOnly&&console.warn(`Model type for '${t}' not found, assuming encoder-only architecture. Please report this at https://github.com/xenova/transformers.js/issues/new/choose.`),r=await Promise.all([AutoConfig.from_pretrained(a,o),constructSession(a,o.model_file_name??"model",o)])),new this(...r)}async _call(a){return await this.forward(a)}async forward(a){return await this._forward(this,a)}_get_logits_processor(a,u,c=null){const p=new LogitsProcessorList;if(a.repetition_penalty!==null&&a.repetition_penalty!==1&&p.push(new RepetitionPenaltyLogitsProcessor(a.repetition_penalty)),a.no_repeat_ngram_size!==null&&a.no_repeat_ngram_size>0&&p.push(new NoRepeatNGramLogitsProcessor(a.no_repeat_ngram_size)),a.min_length!==null&&a.eos_token_id!==null&&a.min_length>0&&p.push(new MinLengthLogitsProcessor(a.min_length,a.eos_token_id)),a.min_new_tokens!==null&&a.eos_token_id!==null&&a.min_new_tokens>0&&p.push(new MinNewTokensLengthLogitsProcessor(u,a.min_new_tokens,a.eos_token_id)),a.forced_bos_token_id!==null&&p.push(new ForcedBOSTokenLogitsProcessor(a.forced_bos_token_id)),a.forced_eos_token_id!==null&&p.push(new ForcedEOSTokenLogitsProcessor(a.max_length,a.forced_eos_token_id)),a.begin_suppress_tokens!==null){let s=u>1||a.forced_bos_token_id===null?u:u+1;a.forced_decoder_ids!==null&&(s+=a.forced_decoder_ids[a.forced_decoder_ids.length-1][0]),p.push(new SuppressTokensAtBeginLogitsProcessor(a.begin_suppress_tokens,s))}return a.forced_decoder_ids!==null&&p.push(new ForceTokensLogitsProcessor(a.forced_decoder_ids)),c!==null&&p.extend(c),p}_get_generation_config(a){let u=new GenerationConfig(this.config);return"generation_config"in this&&Object.assign(u,this.generation_config),a!==null&&Object.assign(u,a),u}async generate(a,u=null,c=null,{inputs_attention_mask:p=null}={}){if(!this.can_generate){let m=`The current model class (${MODEL_CLASS_TO_NAME_MAPPING.get(this.constructor)}) is not compatible with \`.generate()\`, as it doesn't have a language model head.`;const _=this.config.model_type,y=MODEL_WITH_LM_HEAD_MAPPING_NAMES.get(_)??MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES.get(_)??MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES.get(_)??MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES.get(_);throw y&&(m+=` Please use the following class instead: '${y[0]}'`),Error(m)}if(!(a instanceof Tensor)&&!isTypedArray(a)&&!Array.isArray(a))throw Error(`\`inputs\` must be a Tensor, TypedArray, or Array, but is "${a.constructor.name}".`);let s;if(this.config.is_encoder_decoder)s=0;else if(s=a instanceof Tensor?a.dims.at(-1):a.length,s===0)throw Error("Must supply a non-empty array of input token ids.");u=this._get_generation_config(u),c=c??new LogitsProcessorList,c=this._get_logits_processor(u,s,c);let h=u.eos_token_id;h!==null&&!Array.isArray(h)&&(h=[h]);let f=1;const l=f+(u.max_new_tokens??1/0),o=Number.isInteger(u.max_length)&&(u.max_new_tokens??null)===null;let t=Sampler.getSampler(u),e=this.getStartBeams(a,u,f,p);for(;e.some(g=>!g.done)&&f =u.max_length){m.done=!0,g.push(m);continue}let _=await this.runBeam(m);u.output_attentions&&this.addAttentionsToBeam(m,_),u.output_scores;let y=_.logits.slice(null,-1,null);c(m.output_token_ids,y);let w=t(y);for(let[v,S]of w){let O={...m};this.updateBeam(O,v),O.score+=S,h&&h.includes(v)&&(O.done=!0),g.push(O)}}++f,g=this.groupBeams(g).map(m=>m.sort((_,y)=>y.score-_.score).slice(0,u.num_beams)),e=g.flat(),u.callback_function&&u.callback_function(e)}const r=this.groupBeams(e),i=g=>r.map(m=>u.num_return_sequences>1?m.slice(0,u.num_return_sequences).map(_=>_[g]):[m[0][g]]).flat(),d=i("output_token_ids");if(u.return_dict_in_generate){const g=i("decoder_attentions"),m=i("cross_attentions");return{sequences:d,decoder_attentions:g,cross_attentions:m}}else return d}addAttentionsToBeam(a,u){if(this.config.is_encoder_decoder){if(!u.cross_attentions||u.cross_attentions.length===0)throw Error("`output_attentions` is true, but the model did not produce cross-attentions. This is most likely because the model was not exported with `output_attentions=True`.");a.cross_attentions||(a.cross_attentions=[]),a.cross_attentions.push(u.cross_attentions)}if(!u.decoder_attentions||u.decoder_attentions.length===0)throw Error("`output_attentions` is true, but the model did not produce decoder-attentions. This is most likely because the model was not exported with `output_attentions=True`.");a.decoder_attentions||(a.decoder_attentions=[]),a.decoder_attentions.push(u.decoder_attentions)}groupBeams(a){const u=Object.create(null);for(const c of a)u[c.id]===void 0?u[c.id]=[c]:u[c.id].push(c);return Object.values(u)}getPastKeyValues(a,u){const c=Object.create(null);for(const p in a)if(p.startsWith("present")){let s=p.replace("present","past_key_values");u&&p.includes("encoder")?c[s]=u[s]:c[s]=a[p]}return c}getAttentions(a){const u=Object.create(null);for(const c of["cross_attentions","decoder_attentions"]){const p=[];for(const s in a)if(s.startsWith(c)){const h=s.split(".").pop();p[h]=a[s]}u[c]=p}return u}addPastKeyValues(a,u){if(u)Object.assign(a,u);else if(this.config.is_encoder_decoder&&(this.add_encoder_pkv??!0)){let c=[1,this.num_encoder_heads,0,this.encoder_dim_kv],p=[1,this.num_decoder_heads,0,this.decoder_dim_kv];for(let s=0;s