diff --git a/.gitattributes b/.gitattributes index 1ef325f1b111266a6b26e0196871bd78baa8c2f3..f3877d8340b08261997a11187fea4cb69914033a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,17 @@ *.7z filter=lfs diff=lfs merge=lfs -text +*.icns filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +**/data/img/*.txt filter=lfs diff=lfs merge=lfs -text +src/WeChatOcrCpp/wco_data/**/* filter=lfs diff=lfs merge=lfs -text +*.aps filter=lfs diff=lfs merge=lfs -text +*.ico filter=lfs diff=lfs merge=lfs -text +*.pgm filter=lfs diff=lfs merge=lfs -text +*.exe filter=lfs diff=lfs merge=lfs -text +*.dll filter=lfs diff=lfs merge=lfs -text +*.lib filter=lfs diff=lfs merge=lfs -text +*.exp filter=lfs diff=lfs merge=lfs -text +data/img/*.txt filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text *.arrow filter=lfs diff=lfs merge=lfs -text *.bin filter=lfs diff=lfs merge=lfs -text *.bz2 filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..9504c14bebaaf084abe311c0596d300f857136c5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +Debug/ +node_modules/ +output/ +package-lock.json +Release/ +x64/ +bin/ +imrad.dir/ +build/ +.vs/ +*.user +*.filters +*.exe +!src/WeChatOcrCpp/wco_data/WeChatOCR.exe +*.pdb +*obj +*.log +*.tlog +*.recipe +*.ilk +out.json +tmp.jpg +config.py +config.json +# *dll +imgui.ini +7e644cf859a5e100a21ff67a63486ae0.txt +7e644cf859a5e100a21ff67a63486ae0.json +__pycache__/ diff --git a/csharp/mdict/App.xaml b/csharp/mdict/App.xaml new file mode 100644 index 0000000000000000000000000000000000000000..41af17559bff6fa51ec3b2db39c2b0b33049ba7e --- /dev/null +++ b/csharp/mdict/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/csharp/mdict/App.xaml.cs b/csharp/mdict/App.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..e56de4c227064754694a283a128a276cac3aab69 --- /dev/null +++ b/csharp/mdict/App.xaml.cs @@ -0,0 +1,14 @@ +using System.Configuration; +using System.Data; +using System.Windows; + +namespace mdict +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } + +} diff --git a/csharp/mdict/AssemblyInfo.cs b/csharp/mdict/AssemblyInfo.cs new file mode 100644 index 0000000000000000000000000000000000000000..a8dc727fe2c17db37d6c18ae3f093c5cd9cb6f62 --- /dev/null +++ b/csharp/mdict/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/csharp/mdict/MainWindow.xaml b/csharp/mdict/MainWindow.xaml new file mode 100644 index 0000000000000000000000000000000000000000..05df60fecfbadfeae3125717bf3577996fc2ca60 --- /dev/null +++ b/csharp/mdict/MainWindow.xaml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/csharp/mdict/MainWindow.xaml.cs b/csharp/mdict/MainWindow.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..3bac2ea18b85749a1ec6cff2900eadc78b4b2f66 --- /dev/null +++ b/csharp/mdict/MainWindow.xaml.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; +using System.Windows; +using System.Windows.Controls; +using mdict.Views; + +namespace mdict +{ + public partial class MainWindow : Window + { + private readonly Dictionary _views = new Dictionary(); + + public MainWindow() + { + InitializeComponent(); + NavigateTo("Search"); + } + + private void Nav_Click(object sender, RoutedEventArgs e) + { + if (sender is RadioButton rb && rb.CommandParameter is string viewName) + { + NavigateTo(viewName); + } + } + + private void NavigateTo(string viewName) + { + if (!_views.ContainsKey(viewName)) + { + switch (viewName) + { + case "Search": + _views[viewName] = new SearchView(); + break; + case "Library": + _views[viewName] = new LibraryView(); + break; + case "History": + _views[viewName] = new HistoryView(); + break; + case "Favorites": + _views[viewName] = new FavoritesView(); + break; + case "Settings": + _views[viewName] = new SettingsView(); + break; + } + } + + if (_views.TryGetValue(viewName, out var view)) + { + MainContent.Content = view; + } + } + } +} diff --git a/csharp/mdict/Views/FavoritesView.xaml b/csharp/mdict/Views/FavoritesView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..c490c9d588db47d1d9240a983ba72705f46412cf --- /dev/null +++ b/csharp/mdict/Views/FavoritesView.xaml @@ -0,0 +1,15 @@ + + + + + + + + + diff --git a/csharp/mdict/Views/FavoritesView.xaml.cs b/csharp/mdict/Views/FavoritesView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..dc59f9a9c5ea6f973de2f65b4635c1bee437e77d --- /dev/null +++ b/csharp/mdict/Views/FavoritesView.xaml.cs @@ -0,0 +1,12 @@ +using System.Windows.Controls; + +namespace mdict.Views +{ + public partial class FavoritesView : UserControl + { + public FavoritesView() + { + InitializeComponent(); + } + } +} diff --git a/csharp/mdict/Views/HistoryView.xaml b/csharp/mdict/Views/HistoryView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..52f41426f3e378678e4d38e729ed232b7e47b66a --- /dev/null +++ b/csharp/mdict/Views/HistoryView.xaml @@ -0,0 +1,15 @@ + + + + + + + + + diff --git a/csharp/mdict/Views/HistoryView.xaml.cs b/csharp/mdict/Views/HistoryView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..b18ebb4d539df01d2cbb42a3edd0f3b72933a068 --- /dev/null +++ b/csharp/mdict/Views/HistoryView.xaml.cs @@ -0,0 +1,12 @@ +using System.Windows.Controls; + +namespace mdict.Views +{ + public partial class HistoryView : UserControl + { + public HistoryView() + { + InitializeComponent(); + } + } +} diff --git a/csharp/mdict/Views/LibraryView.xaml b/csharp/mdict/Views/LibraryView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..400f06d63e782344ebb0457aa806d78b4ebc429f --- /dev/null +++ b/csharp/mdict/Views/LibraryView.xaml @@ -0,0 +1,15 @@ + + + + + + + + + diff --git a/csharp/mdict/Views/LibraryView.xaml.cs b/csharp/mdict/Views/LibraryView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..eff8a60f1b90aaff866bb674822a14699fc3b3c3 --- /dev/null +++ b/csharp/mdict/Views/LibraryView.xaml.cs @@ -0,0 +1,12 @@ +using System.Windows.Controls; + +namespace mdict.Views +{ + public partial class LibraryView : UserControl + { + public LibraryView() + { + InitializeComponent(); + } + } +} diff --git a/csharp/mdict/Views/SearchView.xaml b/csharp/mdict/Views/SearchView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..d6d8b8f12344b3889104bbcee52a2bcb77650351 --- /dev/null +++ b/csharp/mdict/Views/SearchView.xaml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Analysis + Dictionary + Rust + WPF + Implementation + + + + + + + + + + + + diff --git a/csharp/mdict/Views/SearchView.xaml.cs b/csharp/mdict/Views/SearchView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..86ff79a3bd488c2768192fae55c6511a57b1ff90 --- /dev/null +++ b/csharp/mdict/Views/SearchView.xaml.cs @@ -0,0 +1,22 @@ +using System.Windows.Controls; + +namespace mdict.Views +{ + public partial class SearchView : UserControl + { + public SearchView() + { + InitializeComponent(); + } + + private void ResultList_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (ResultList.SelectedItem is ListBoxItem item) + { + ContentText.Text = $"Definition for: {item.Content}"; + ContentText.FontSize = 24; + ContentText.Foreground = System.Windows.Media.Brushes.Black; + } + } + } +} diff --git a/csharp/mdict/Views/SettingsView.xaml b/csharp/mdict/Views/SettingsView.xaml new file mode 100644 index 0000000000000000000000000000000000000000..04073a405af501fd027477959673ec2515da84b3 --- /dev/null +++ b/csharp/mdict/Views/SettingsView.xaml @@ -0,0 +1,15 @@ + + + + + + + + + diff --git a/csharp/mdict/Views/SettingsView.xaml.cs b/csharp/mdict/Views/SettingsView.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..1d7676c496b68ba092956c68ce9d0b9bb1e4222c --- /dev/null +++ b/csharp/mdict/Views/SettingsView.xaml.cs @@ -0,0 +1,12 @@ +using System.Windows.Controls; + +namespace mdict.Views +{ + public partial class SettingsView : UserControl + { + public SettingsView() + { + InitializeComponent(); + } + } +} diff --git a/csharp/mdict/mdict.csproj b/csharp/mdict/mdict.csproj new file mode 100644 index 0000000000000000000000000000000000000000..e3e33e3b1cfb2a9c9e171036fdc8c9220d55f3b0 --- /dev/null +++ b/csharp/mdict/mdict.csproj @@ -0,0 +1,11 @@ + + + + WinExe + net8.0-windows + enable + enable + true + + + diff --git a/csharp/mdict/mdict.sln b/csharp/mdict/mdict.sln new file mode 100644 index 0000000000000000000000000000000000000000..9cf291367a82f32451125c10bd64e6be181efdf5 --- /dev/null +++ b/csharp/mdict/mdict.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.35806.103 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mdict", "mdict.csproj", "{592AD3B7-0007-43A6-957B-3C7F90741A85}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {592AD3B7-0007-43A6-957B-3C7F90741A85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {592AD3B7-0007-43A6-957B-3C7F90741A85}.Debug|Any CPU.Build.0 = Debug|Any CPU + {592AD3B7-0007-43A6-957B-3C7F90741A85}.Release|Any CPU.ActiveCfg = Release|Any CPU + {592AD3B7-0007-43A6-957B-3C7F90741A85}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {373B9879-FCFA-4937-9FD5-A914F768CECA} + EndGlobalSection +EndGlobal diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..a464b2601a52812e62486261c24bbb1d13e6d3c9 --- /dev/null +++ b/readme.txt @@ -0,0 +1,31 @@ + +`f:\t\mdict\rust` 分析这个 rust 项目, `f:\t\mdict\csharp\mdict` 然后在这个 wpf 实现和它一样的 UI,功能可以没有,但是 UI 交互要一样。自已写入代码,不要让我动手 + +已分析 f:\t\mdict\rust 项目(基于 Tauri + React/Ionic),并在 f:\t\mdict\csharp\mdict 中实现了相同的 WPF UI 结构和交互。 + +### 分析结果 (Rust/Tauri) +- 架构 : Tauri 后端 + React 前端,使用 Ionic 组件库。 +- 导航 : 侧边栏/底部标签栏导航 (Adaptive Tabs),包含 Search, Library, History, Favorites, Settings。 +- 主要视图 (SearchView) : 使用 Allotment 实现的左右分栏布局。左侧为搜索框和结果列表,右侧为字典内容显示。 +### WPF 实现结果 +我已经为您编写了完整的 WPF 代码,复刻了上述 UI 结构和交互逻辑。 + +主要改动: + +1. MainWindow.xaml : + + - 实现了 侧边栏导航 ,使用 RadioButton 模拟标签切换,样式仿照现代扁平化设计。 + - 使用了 Segoe MDL2 Assets 字体图标,无需额外图片资源。 + - 包含 ContentControl 用于动态切换视图。 +2. Views (新建) : + + - SearchView.xaml : 核心视图。实现了 左右分栏 (GridSplitter) 。 + - 左侧 : 搜索框 + ListBox 结果列表。 + - 右侧 : 内容展示区域。 + - 交互 : 点击左侧列表项,右侧内容会相应更新(模拟了 displayByKey 的交互)。 + - LibraryView.xaml , HistoryView.xaml , FavoritesView.xaml , SettingsView.xaml : 创建了对应的占位视图,保持了导航结构的完整性。 +3. 逻辑 (Code-Behind) : + + - MainWindow.xaml.cs : 实现了视图缓存和导航逻辑,点击侧边栏按钮切换不同的 UserControl。 + - SearchView.xaml.cs : 实现了列表选择事件,更新右侧显示内容。 +项目现已构建通过 ,您可以直接运行 f:\t\mdict\csharp\mdict 项目查看效果。UI 交互(点击导航、点击列表项)已按要求复刻。 \ No newline at end of file diff --git a/rust/LICENSE b/rust/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..0ad25db4bd1d86c452db3f9602ccdbe172438f52 --- /dev/null +++ b/rust/LICENSE @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/rust/README.md b/rust/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f822522487d3fae5fe5106b7ba0fc55d043144cc --- /dev/null +++ b/rust/README.md @@ -0,0 +1,12 @@ +# MDict App +这是一份用Tauri 2.0 编写的App,已经完成了最基本常用的功能,目前只是PC版本,仅在MacOS和Windows上测试过,Linux理论上能用,但没有试过。将来也可以在此基础上添加Android/iOS支持。由于是第一次写Rust和前端代码,特别是前端部分,大量借助AI辅助编写,所以实现的有点乱。界面样式更是比较原始,仅供作为参考了。 + +请先参考Tauri的开发准备环境。并在工作目录下执行以下命令 + +``` +git clone https://github.com/raymanzhang/mdx.git +git clone https://github.com/raymanzhang/mdict.git +git clone https://github.com/raymanzhang/mdx_util.git #可选 +cd mdict +npm run tauri dev +``` diff --git a/rust/i18next-scanner.config.cjs b/rust/i18next-scanner.config.cjs new file mode 100644 index 0000000000000000000000000000000000000000..5000d6edc17b1cf44e0bdc30c2f3353293ce0a80 --- /dev/null +++ b/rust/i18next-scanner.config.cjs @@ -0,0 +1,41 @@ +const fs = require('fs'); +const path = require('path'); + +module.exports = { + input: [ + 'src/**/*.{ts,tsx}', + '!src/**/*.spec.{ts,tsx}', + '!src/**/*.test.{ts,tsx}', + '!**/node_modules/**', + ], + output: './', + options: { + debug: false, + removeUnusedKeys: false, + sort: false, + func: { + list: ['t'], + extensions: ['.ts', '.tsx'], + }, + lngs: ['en-US', 'zh-CN'], + ns: ['translation'], + defaultLng: 'en-US', + defaultNs: 'translation', + defaultValue: (lng, ns, key) => { + return lng === 'en-US' ? key : ''; + }, + resource: { + loadPath: 'src/locales/{{lng}}/{{ns}}.json', + savePath: 'src/locales/{{lng}}/{{ns}}.new.json', + jsonIndent: 2, + lineEnding: '\n', + }, + interpolation: { + prefix: '{{', + suffix: '}}', + }, + // Custom parser to handle TypeScript + keySeparator: false, + nsSeparator: false, + }, +}; diff --git a/rust/index.html b/rust/index.html new file mode 100644 index 0000000000000000000000000000000000000000..ff93803bbc0ac572a2b1503c045251b309e05275 --- /dev/null +++ b/rust/index.html @@ -0,0 +1,14 @@ + + + + + + + Tauri + React + Typescript + + + +
+ + + diff --git a/rust/package.json b/rust/package.json new file mode 100644 index 0000000000000000000000000000000000000000..1de146030a35042115fc294015510d2d529c6c2c --- /dev/null +++ b/rust/package.json @@ -0,0 +1,53 @@ +{ + "name": "mdict-app", + "private": true, + "version": "0.1.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "postbuild": "npm run i18n:extract || true", + "preview": "vite preview", + "tauri": "tauri", + "i18n:extract": "i18next-scanner --config i18next-scanner.config.cjs", + "i18n:check": "i18next-scanner --config i18next-scanner.config.cjs && echo '\nCheck src/locales/**/translation.new.json for new keys'" + }, + "dependencies": { + "@ionic/react": "^8.7.6", + "@ionic/react-router": "^8.7.6", + "@tauri-apps/api": "2.9.0", + "@tauri-apps/plugin-clipboard-manager": "2.3.2", + "@tauri-apps/plugin-dialog": "2.4.2", + "@tauri-apps/plugin-opener": "2.5.2", + "@types/mark.js": "^8.11.12", + "@uiw/react-color": "2.9.2", + "allotment": "^1.20.4", + "i18next": "^25.6.0", + "immer": "10.2.0", + "ionicons": "^8.0.13", + "lru-cache": "^11.2.2", + "lucide-react": "0.548.0", + "mark.js": "^8.11.1", + "react": "^18.3.0", + "react-dom": "^18.3.0", + "react-i18next": "^16.1.4", + "react-router": "^5.3.4", + "react-router-dom": "^5.3.4", + "react-window": "2.2.1", + "react-window-infinite-loader": "^2.0.0", + "zustand": "^5.0.8" + }, + "devDependencies": { + "@babel/core": "^7.28.4", + "@tauri-apps/cli": "2.9.1", + "@types/node": "24.9.2", + "@types/react": "^18.3.0", + "@types/react-dom": "^18.3.0", + "@types/react-router-dom": "^5.3.3", + "@vitejs/plugin-react": "5.1.0", + "babel-plugin-macros": "^3.1.0", + "i18next-scanner": "^4.6.0", + "typescript": "5.9.3", + "vite": "7.1.12" + } +} diff --git a/rust/src-tauri/.gitignore b/rust/src-tauri/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..b21bd681d99748c046b14202ab79bd8da0143302 --- /dev/null +++ b/rust/src-tauri/.gitignore @@ -0,0 +1,7 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ + +# Generated by Tauri +# will have schema files for capabilities auto-completion +/gen/schemas diff --git a/rust/src-tauri/Cargo.lock b/rust/src-tauri/Cargo.lock new file mode 100644 index 0000000000000000000000000000000000000000..858ceea49634698d7fae5b19aa4c529569e07ff7 --- /dev/null +++ b/rust/src-tauri/Cargo.lock @@ -0,0 +1,7387 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" +dependencies = [ + "windows-sys 0.60.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.60.2", +] + +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + +[[package]] +name = "arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" +dependencies = [ + "derive_arbitrary", +] + +[[package]] +name = "arboard" +version = "3.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0348a1c054491f4bfe6ab86a7b6ab1e44e45d899005de92f58b3df180b36ddaf" +dependencies = [ + "clipboard-win", + "image", + "log", + "objc2 0.6.3", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "parking_lot", + "percent-encoding", + "windows-sys 0.60.2", + "wl-clipboard-rs", + "x11rb", +] + +[[package]] +name = "arc-swap" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" + +[[package]] +name = "ashpd" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cbdf310d77fd3aaee6ea2093db7011dc2d35d2eb3481e5607f1f8d942ed99df" +dependencies = [ + "enumflags2", + "futures-channel", + "futures-util", + "rand 0.9.2", + "raw-window-handle", + "serde", + "serde_repr", + "tokio", + "url", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "zbus", +] + +[[package]] +name = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-channel" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497c00e0fd83a72a79a39fcbd8e3e2f055d6f6c7e025f3b3d91f4f8e76527fb8" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "pin-project-lite", + "slab", +] + +[[package]] +name = "async-io" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" +dependencies = [ + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix 1.1.2", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-lock" +version = "3.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd03604047cee9b6ce9de9f70c6cd540a0520c813cbd49bae61f33ab80ed1dc" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-process" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" +dependencies = [ + "async-channel", + "async-io", + "async-lock", + "async-signal", + "async-task", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "rustix 1.1.2", +] + +[[package]] +name = "async-recursion" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "async-signal" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43c070bbf59cd3570b6b2dd54cd772527c7c3620fce8be898406dd3ed6adc64c" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix 1.1.2", + "signal-hook-registry", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "async-trait" +version = "0.1.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "atk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "241b621213072e993be4f6f3a9e4b45f65b7e6faad43001be957184b7bb1824b" +dependencies = [ + "atk-sys", + "glib", + "libc", +] + +[[package]] +name = "atk-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e48b684b0ca77d2bbadeef17424c2ea3c897d44d566a1617e7e8f30614d086" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" +dependencies = [ + "serde", +] + +[[package]] +name = "bitpacking" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c1d3e2bfd8d06048a179f7b17afc3188effa10385e7b00dc65af6aae732ea92" +dependencies = [ + "crunchy", +] + +[[package]] +name = "block-buffer" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +dependencies = [ + "block-padding", + "byte-tools", + "byteorder", + "generic-array 0.12.4", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", +] + +[[package]] +name = "block2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" +dependencies = [ + "objc2 0.5.2", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2 0.6.3", +] + +[[package]] +name = "blocking" +version = "1.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e83f8d02be6967315521be875afa792a316e28d57b5a2d401897e2a7921b7f21" +dependencies = [ + "async-channel", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + +[[package]] +name = "bon" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebeb9aaf9329dff6ceb65c689ca3db33dbf15f324909c60e4e5eef5701ce31b1" +dependencies = [ + "bon-macros", + "rustversion", +] + +[[package]] +name = "bon-macros" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77e9d642a7e3a318e37c2c9427b5a6a48aa1ad55dcd986f3034ab2239045a645" +dependencies = [ + "darling", + "ident_case", + "prettyplease", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.106", +] + +[[package]] +name = "brotli" +version = "8.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bd8b9603c7aa97359dbd97ecf258968c95f3adddd6db2f7e7a5bef101c84560" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "874bb8112abecc98cbd6d81ea4fa7e94fb9449648c93cc89aa40c81c24d7de03" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bumpalo" +version = "3.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" + +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + +[[package]] +name = "bytemuck" +version = "1.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "byteorder-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + +[[package]] +name = "bytes" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" +dependencies = [ + "serde", +] + +[[package]] +name = "bzip2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bea8dcd42434048e4f7a304411d9273a411f647446c1234a65ce0554923f4cff" +dependencies = [ + "libbz2-rs-sys", +] + +[[package]] +name = "cairo-rs" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ca26ef0159422fb77631dc9d17b102f253b876fe1586b03b803e63a309b4ee2" +dependencies = [ + "bitflags 2.9.4", + "cairo-sys-rs", + "glib", + "libc", + "once_cell", + "thiserror 1.0.69", +] + +[[package]] +name = "cairo-sys-rs" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685c9fa8e590b8b3d678873528d83411db17242a73fccaed827770ea0fedda51" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "calendrical_calculations" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a0b39595c6ee54a8d0900204ba4c401d0ab4eb45adaf07178e8d017541529e7" +dependencies = [ + "core_maths", + "displaydoc", +] + +[[package]] +name = "camino" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "276a59bf2b2c967788139340c9f0c5b12d7fd6630315c15c217e559de85d2609" +dependencies = [ + "serde_core", +] + +[[package]] +name = "cargo-platform" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror 2.0.17", +] + +[[package]] +name = "cargo_toml" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "374b7c592d9c00c1f4972ea58390ac6b18cbb6ab79011f3bdc90a0b82ca06b77" +dependencies = [ + "serde", + "toml 0.9.8", +] + +[[package]] +name = "cc" +version = "1.2.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac9fe6cdbb24b6ade63616c0a0688e45bb56732262c158df3c0c4bea4ca47cb7" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "census" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f4c707c6a209cbe82d10abd08e1ea8995e9ea937d2550646e02798948992be0" + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cfb" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f" +dependencies = [ + "byteorder", + "fnv", + "uuid", +] + +[[package]] +name = "cfg-expr" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" +dependencies = [ + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cfg-if" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chrono" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link 0.2.1", +] + +[[package]] +name = "clipboard-win" +version = "5.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4" +dependencies = [ + "error-code", +] + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "colored" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fde0e0ec90c9dfb3b4b1a0891a7dcd0e2bffde2f7efed5fe7c9bb00e5bfb915e" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "cookie" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" +dependencies = [ + "time", + "version_check", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1" +dependencies = [ + "bitflags 2.9.4", + "core-foundation", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +dependencies = [ + "bitflags 2.9.4", + "core-foundation", + "libc", +] + +[[package]] +name = "core_maths" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30" +dependencies = [ + "libm", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array 0.14.7", + "typenum", +] + +[[package]] +name = "cssparser" +version = "0.29.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93d03419cb5950ccfd3daf3ff1c7a36ace64609a1a8746d493df1ca0afde0fa" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "matches", + "phf 0.10.1", + "proc-macro2", + "quote", + "smallvec", + "syn 1.0.109", +] + +[[package]] +name = "cssparser" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e901edd733a1472f944a45116df3f846f54d37e67e68640ac8bb69689aca2aa" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "phf 0.11.3", + "smallvec", +] + +[[package]] +name = "cssparser-macros" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" +dependencies = [ + "quote", + "syn 2.0.106", +] + +[[package]] +name = "ctor" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501" +dependencies = [ + "quote", + "syn 2.0.106", +] + +[[package]] +name = "darling" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.106", +] + +[[package]] +name = "darling_macro" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "deranged" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a41953f86f8a05768a6cda24def994fd2f424b04ec5c719cf89989779f199071" +dependencies = [ + "powerfmt", + "serde_core", +] + +[[package]] +name = "derive_arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "derive_more" +version = "0.99.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6edb4b64a43d977b8e99788fe3a04d483834fba1215a7e02caa415b626497f7f" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.106", +] + +[[package]] +name = "derive_more" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "crypto-common", +] + +[[package]] +name = "dirs" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.61.2", +] + +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "dispatch2" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec" +dependencies = [ + "bitflags 2.9.4", + "block2 0.6.2", + "libc", + "objc2 0.6.3", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "dlib" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" +dependencies = [ + "libloading 0.8.9", +] + +[[package]] +name = "dlopen2" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b54f373ccf864bf587a89e880fb7610f8d73f3045f13580948ccbcaff26febff" +dependencies = [ + "dlopen2_derive", + "libc", + "once_cell", + "winapi", +] + +[[package]] +name = "dlopen2_derive" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "788160fb30de9cdd857af31c6a2675904b16ece8fc2737b2c7127ba368c9d0f4" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "downcast-rs" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "117240f60069e65410b3ae1bb213295bd828f707b5bec6596a1afc8793ce0cbc" + +[[package]] +name = "dpi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" +dependencies = [ + "serde", +] + +[[package]] +name = "dtoa" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6add3b8cff394282be81f3fc1a0605db594ed69890078ca6e2cab1c408bcf04" + +[[package]] +name = "dtoa-short" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" +dependencies = [ + "dtoa", +] + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "embed-resource" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55a075fc573c64510038d7ee9abc7990635863992f83ebc52c8b433b8411a02e" +dependencies = [ + "cc", + "memchr", + "rustc_version", + "toml 0.9.8", + "vswhom", + "winreg", +] + +[[package]] +name = "embed_plist" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "endi" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d8a32ae18130a3c84dd492d4215c3d913c3b07c6b63c2eb3eb7ff1101ab7bf" + +[[package]] +name = "enumflags2" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "env_filter" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "erased-serde" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "259d404d09818dec19332e31d94558aeb442fea04c817006456c24b5460bbd4b" +dependencies = [ + "serde", + "serde_core", + "typeid", +] + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "error-code" +version = "3.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59" + +[[package]] +name = "event-listener" +version = "5.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fallible-streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" + +[[package]] +name = "fastdivide" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afc2bd4d5a73106dd53d10d73d3401c2f32730ba2c0b93ddb888a8983680471" + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "fax" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f05de7d48f37cd6730705cbca900770cab77a89f413d23e100ad7fad7795a0ab" +dependencies = [ + "fax_derive", +] + +[[package]] +name = "fax_derive" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0aca10fb742cb43f9e7bb8467c91aa9bcb8e3ffbc6a6f7389bb93ffc920577d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "fern" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4316185f709b23713e41e3195f90edef7fb00c3ed4adc79769cf09cc762a3b29" +dependencies = [ + "log", +] + +[[package]] +name = "field-offset" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" +dependencies = [ + "memoffset", + "rustc_version", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" + +[[package]] +name = "fixed_decimal" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35943d22b2f19c0cb198ecf915910a8158e94541c89dcc63300d7799d46c2c5e" +dependencies = [ + "displaydoc", + "smallvec", + "writeable", +] + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "flate2" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc5a4e564e38c699f2880d3fda590bedc2e69f3f84cd48b457bd892ce61d0aa9" +dependencies = [ + "crc32fast", + "libz-rs-sys", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs4" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8640e34b88f7652208ce9e88b1a37a2ae95227d84abec377ccd3c5cfeb141ed4" +dependencies = [ + "rustix 1.1.2", + "windows-sys 0.59.0", +] + +[[package]] +name = "futf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" +dependencies = [ + "mac", + "new_debug_unreachable", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-lite" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "gdk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9f245958c627ac99d8e529166f9823fb3b838d1d41fd2b297af3075093c2691" +dependencies = [ + "cairo-rs", + "gdk-pixbuf", + "gdk-sys", + "gio", + "glib", + "libc", + "pango", +] + +[[package]] +name = "gdk-pixbuf" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e1f5f1b0bfb830d6ccc8066d18db35c487b1b2b1e8589b5dfe9f07e8defaec" +dependencies = [ + "gdk-pixbuf-sys", + "gio", + "glib", + "libc", + "once_cell", +] + +[[package]] +name = "gdk-pixbuf-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9839ea644ed9c97a34d129ad56d38a25e6756f99f3a88e15cd39c20629caf7" +dependencies = [ + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gdk-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c2d13f38594ac1e66619e188c6d5a1adb98d11b2fcf7894fc416ad76aa2f3f7" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "pkg-config", + "system-deps", +] + +[[package]] +name = "gdkwayland-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "140071d506d223f7572b9f09b5e155afbd77428cd5cc7af8f2694c41d98dfe69" +dependencies = [ + "gdk-sys", + "glib-sys", + "gobject-sys", + "libc", + "pkg-config", + "system-deps", +] + +[[package]] +name = "gdkx11" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3caa00e14351bebbc8183b3c36690327eb77c49abc2268dd4bd36b856db3fbfe" +dependencies = [ + "gdk", + "gdkx11-sys", + "gio", + "glib", + "libc", + "x11", +] + +[[package]] +name = "gdkx11-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e7445fe01ac26f11601db260dd8608fe172514eb63b3b5e261ea6b0f4428d" +dependencies = [ + "gdk-sys", + "glib-sys", + "libc", + "system-deps", + "x11", +] + +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "gethostname" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" +dependencies = [ + "rustix 1.1.2", + "windows-link 0.2.1", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.7+wasi-0.2.4", +] + +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + +[[package]] +name = "gio" +version = "0.18.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fc8f532f87b79cbc51a79748f16a6828fb784be93145a322fa14d06d354c73" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "gio-sys", + "glib", + "libc", + "once_cell", + "pin-project-lite", + "smallvec", + "thiserror 1.0.69", +] + +[[package]] +name = "gio-sys" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37566df850baf5e4cb0dfb78af2e4b9898d817ed9263d1090a2df958c64737d2" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", + "winapi", +] + +[[package]] +name = "glib" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233daaf6e83ae6a12a52055f568f9d7cf4671dabb78ff9560ab6da230ce00ee5" +dependencies = [ + "bitflags 2.9.4", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "futures-util", + "gio-sys", + "glib-macros", + "glib-sys", + "gobject-sys", + "libc", + "memchr", + "once_cell", + "smallvec", + "thiserror 1.0.69", +] + +[[package]] +name = "glib-macros" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb0228f477c0900c880fd78c8759b95c7636dbd7842707f49e132378aa2acdc" +dependencies = [ + "heck 0.4.1", + "proc-macro-crate 2.0.2", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "glib-sys" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063ce2eb6a8d0ea93d2bf8ba1957e78dbab6be1c2220dd3daca57d5a9d869898" +dependencies = [ + "libc", + "system-deps", +] + +[[package]] +name = "glob" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" + +[[package]] +name = "global-hotkey" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9247516746aa8e53411a0db9b62b0e24efbcf6a76e0ba73e5a91b512ddabed7" +dependencies = [ + "crossbeam-channel", + "keyboard-types", + "objc2 0.6.3", + "objc2-app-kit", + "once_cell", + "thiserror 2.0.17", + "windows-sys 0.59.0", + "x11rb", + "xkeysym", +] + +[[package]] +name = "gobject-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0850127b514d1c4a4654ead6dedadb18198999985908e6ffe4436f53c785ce44" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gtk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd56fb197bfc42bd5d2751f4f017d44ff59fbb58140c6b49f9b3b2bdab08506a" +dependencies = [ + "atk", + "cairo-rs", + "field-offset", + "futures-channel", + "gdk", + "gdk-pixbuf", + "gio", + "glib", + "gtk-sys", + "gtk3-macros", + "libc", + "pango", + "pkg-config", +] + +[[package]] +name = "gtk-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f29a1c21c59553eb7dd40e918be54dccd60c52b049b75119d5d96ce6b624414" +dependencies = [ + "atk-sys", + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "system-deps", +] + +[[package]] +name = "gtk3-macros" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ff3c5b21f14f0736fed6dcfc0bfb4225ebf5725f3c0209edeec181e4d73e9d" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "zerocopy", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] + +[[package]] +name = "hashlink" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" +dependencies = [ + "hashbrown 0.15.5", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "html5ever" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b7410cae13cbc75623c98ac4cbfd1f0bedddf3227afc24f370cf0f50a44a11c" +dependencies = [ + "log", + "mac", + "markup5ever", + "match_token", +] + +[[package]] +name = "htmlescape" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9025058dae765dee5070ec375f591e2ba14638c63feff74f13805a72e523163" + +[[package]] +name = "http" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "http-range" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573" + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "humantime" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" + +[[package]] +name = "hyper" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb3aa54a13a0dfe7fbe3a59e0c76093041720fdc77b110cc0fc260fafb4dc51e" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "pin-utils", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-util" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c6995591a8f1380fcb4ba966a252a4b29188d51d2b89e3a252f5305be65aea8" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "hyperloglogplus" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "621debdf94dcac33e50475fdd76d34d5ea9c0362a834b9db08c3024696c1fbe3" +dependencies = [ + "serde", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core 0.62.2", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ico" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc50b891e4acf8fe0e71ef88ec43ad82ee07b3810ad09de10f1d01f072ed4b98" +dependencies = [ + "byteorder", + "png 0.17.16", +] + +[[package]] +name = "icu" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ab713dd86fa032cb5487f9ac3a85d47b5dcf4c7b8c7dd00210b3cadd6a6551" +dependencies = [ + "icu_calendar", + "icu_casemap", + "icu_collator", + "icu_collections", + "icu_datetime", + "icu_decimal", + "icu_experimental", + "icu_list", + "icu_locale", + "icu_normalizer", + "icu_pattern", + "icu_plurals", + "icu_properties", + "icu_provider", + "icu_segmenter", + "icu_time", +] + +[[package]] +name = "icu_calendar" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f0e52e009b6b16ba9c0693578796f2dd4aaa59a7f8f920423706714a89ac4e" +dependencies = [ + "calendrical_calculations", + "displaydoc", + "icu_calendar_data", + "icu_locale", + "icu_locale_core", + "icu_provider", + "ixdtf", + "serde", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_calendar_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527f04223b17edfe0bd43baf14a0cb1b017830db65f3950dc00224860a9a446d" + +[[package]] +name = "icu_casemap" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4ca9983e8bf51223c2f89014fa4eaa9e9b336c47f3af0d000538f86f841fba1" +dependencies = [ + "icu_casemap_data", + "icu_collections", + "icu_locale_core", + "icu_properties", + "icu_provider", + "potential_utf", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_casemap_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98d4663d0f99b301033a19e0acf94e9d2fa4b107638580165e5a6ccc49ad1450" + +[[package]] +name = "icu_collator" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32eed11a5572f1088b63fa21dc2e70d4a865e5739fc2d10abc05be93bae97019" +dependencies = [ + "icu_collator_data", + "icu_collections", + "icu_locale", + "icu_locale_core", + "icu_normalizer", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "zerovec", +] + +[[package]] +name = "icu_collator_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ab06f0e83a613efddba3e4913e00e43ed4001fae651cb7d40fc7e66b83b6fb9" + +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "serde", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_datetime" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9d49f41ded8e63761b6b4c3120dfdc289415a1ed10107db6198eb311057ca5" +dependencies = [ + "displaydoc", + "fixed_decimal", + "icu_calendar", + "icu_datetime_data", + "icu_decimal", + "icu_locale", + "icu_locale_core", + "icu_pattern", + "icu_plurals", + "icu_provider", + "icu_time", + "potential_utf", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_datetime_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf2a384725c67fcd32d27737bc7ba9dc5fe21311dfe3ba530f4b4d53e72bacc" + +[[package]] +name = "icu_decimal" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a38c52231bc348f9b982c1868a2af3195199623007ba2c7650f432038f5b3e8e" +dependencies = [ + "fixed_decimal", + "icu_decimal_data", + "icu_locale", + "icu_locale_core", + "icu_provider", + "serde", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_decimal_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2905b4044eab2dd848fe84199f9195567b63ab3a93094711501363f63546fef7" + +[[package]] +name = "icu_experimental" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4ffa4d60b9cb8b024082afaf9e94d853184e483ec69322c74dc437bf8a882a5" +dependencies = [ + "displaydoc", + "either", + "fixed_decimal", + "icu_casemap", + "icu_collections", + "icu_decimal", + "icu_experimental_data", + "icu_list", + "icu_locale", + "icu_locale_core", + "icu_normalizer", + "icu_pattern", + "icu_plurals", + "icu_properties", + "icu_provider", + "litemap", + "num-bigint", + "num-rational", + "num-traits", + "potential_utf", + "smallvec", + "tinystr", + "writeable", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_experimental_data" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2578ea93f0373bb28800f7d1100e7e771c4d248d0d3759250fed08fa27694139" + +[[package]] +name = "icu_list" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3a0b7b126e2fc42777d3c348611553d540bd3683caa39b387c5dd1036bb21a8" +dependencies = [ + "icu_list_data", + "icu_locale", + "icu_provider", + "regex-automata", + "serde", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_list_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51044c242fe2a882cc0a464314bbdb9f441556a1cb238fb527fc47355ec2827b" + +[[package]] +name = "icu_locale" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "532b11722e350ab6bf916ba6eb0efe3ee54b932666afec989465f9243fe6dd60" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_locale_data", + "icu_provider", + "potential_utf", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "serde", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locale_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f03e2fcaefecdf05619f3d6f91740e79ab969b4dd54f77cbf546b1d0d28e3147" + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_pattern" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a7ff8c0ff6f61cdce299dcb54f557b0a251adbc78f6f0c35a21332c452b4a1b" +dependencies = [ + "displaydoc", + "either", + "serde", + "writeable", + "yoke", + "zerovec", +] + +[[package]] +name = "icu_plurals" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f9cfe49f5b1d1163cc58db451562339916a9ca5cbcaae83924d41a0bf839474" +dependencies = [ + "fixed_decimal", + "icu_locale", + "icu_plurals_data", + "icu_provider", + "zerovec", +] + +[[package]] +name = "icu_plurals_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f018a98dccf7f0eb02ba06ac0ff67d102d8ded80734724305e924de304e12ff0" + +[[package]] +name = "icu_properties" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "serde", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "serde", + "stable_deref_trait", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_segmenter" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43da5e7e9b540df15e53ca27f69b50e36e01b652584b40b3335ed65d18303834" +dependencies = [ + "core_maths", + "icu_collections", + "icu_locale", + "icu_provider", + "icu_segmenter_data", + "potential_utf", + "utf8_iter", + "zerovec", +] + +[[package]] +name = "icu_segmenter_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ebbb7321d9e21d25f5660366cb6c08201d0175898a3a6f7a41ee9685af21c80" + +[[package]] +name = "icu_time" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8242b00da3b3b6678f731437a11c8833a43c821ae081eca60ba1b7579d45b6d8" +dependencies = [ + "calendrical_calculations", + "displaydoc", + "icu_calendar", + "icu_locale_core", + "icu_provider", + "icu_time_data", + "ixdtf", + "serde", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_time_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e10b0e5e87a2c84bd5fa407705732052edebe69291d347d0c3033785470edbf" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "image" +version = "0.25.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "529feb3e6769d234375c4cf1ee2ce713682b8e76538cb13f9fc23e1400a591e7" +dependencies = [ + "bytemuck", + "byteorder-lite", + "moxcms", + "num-traits", + "png 0.18.0", + "tiff", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" +dependencies = [ + "equivalent", + "hashbrown 0.16.0", + "serde", + "serde_core", +] + +[[package]] +name = "infer" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a588916bfdfd92e71cacef98a63d9b1f0d74d6599980d11894290e7ddefffcf7" +dependencies = [ + "cfb", +] + +[[package]] +name = "io-uring" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b" +dependencies = [ + "bitflags 2.9.4", + "cfg-if", + "libc", +] + +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + +[[package]] +name = "iri-string" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc5ebe9c3a1a7a5127f920a418f7585e9e758e911d0466ed004f393b0e380b2" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "is-docker" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3" +dependencies = [ + "once_cell", +] + +[[package]] +name = "is-wsl" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5" +dependencies = [ + "is-docker", + "once_cell", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "ixdtf" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84de9d95a6d2547d9b77ee3f25fa0ee32e3c3a6484d47a55adebc0439c077992" + +[[package]] +name = "javascriptcore-rs" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca5671e9ffce8ffba57afc24070e906da7fc4b1ba66f2cabebf61bf2ea257fcc" +dependencies = [ + "bitflags 1.3.2", + "glib", + "javascriptcore-rs-sys", +] + +[[package]] +name = "javascriptcore-rs-sys" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1be78d14ffa4b75b66df31840478fef72b51f8c2465d4ca7c194da9f7a5124" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "jiff" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde", +] + +[[package]] +name = "jiff-static" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "json-patch" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "863726d7afb6bc2590eeff7135d923545e5e964f004c2ccf8716c25e70a86f08" +dependencies = [ + "jsonptr", + "serde", + "serde_json", + "thiserror 1.0.69", +] + +[[package]] +name = "jsonptr" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dea2b27dd239b2556ed7a25ba842fe47fd602e7fc7433c2a8d6106d4d9edd70" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "keyboard-types" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b750dcadc39a09dbadd74e118f6dd6598df77fa01df0cfcdc52c28dece74528a" +dependencies = [ + "bitflags 2.9.4", + "serde", + "unicode-segmentation", +] + +[[package]] +name = "kuchikiki" +version = "0.8.8-speedreader" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02cb977175687f33fa4afa0c95c112b987ea1443e5a51c8f8ff27dc618270cc2" +dependencies = [ + "cssparser 0.29.6", + "html5ever", + "indexmap 2.11.4", + "selectors 0.24.0", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "levenshtein_automata" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c2cdeb66e45e9f36bfad5bbdb4d2384e70936afbee843c6f6543f0c551ebb25" + +[[package]] +name = "libappindicator" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03589b9607c868cc7ae54c0b2a22c8dc03dd41692d48f2d7df73615c6a95dc0a" +dependencies = [ + "glib", + "gtk", + "gtk-sys", + "libappindicator-sys", + "log", +] + +[[package]] +name = "libappindicator-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9ec52138abedcc58dc17a7c6c0c00a2bdb4f3427c7f63fa97fd0d859155caf" +dependencies = [ + "gtk-sys", + "libloading 0.7.4", + "once_cell", +] + +[[package]] +name = "libbz2-rs-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4a545a15244c7d945065b5d392b2d2d7f21526fba56ce51467b06ed445e8f7" + +[[package]] +name = "libc" +version = "0.2.177" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" + +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link 0.2.1", +] + +[[package]] +name = "libm" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" + +[[package]] +name = "libredox" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" +dependencies = [ + "bitflags 2.9.4", + "libc", +] + +[[package]] +name = "libsqlite3-sys" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "133c182a6a2c87864fe97778797e46c7e999672690dc9fa3ee8e241aa4a9c13f" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "libz-rs-sys" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "840db8cf39d9ec4dd794376f38acc40d0fc65eec2a8f484f7fd375b84602becd" +dependencies = [ + "zlib-rs", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[package]] +name = "litemap" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" + +[[package]] +name = "lol_html" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a7ce8821eadcb5cb5c64dd0c9876a90f2676424020b41272e36c1dd04d20c59" +dependencies = [ + "bitflags 2.9.4", + "cfg-if", + "cssparser 0.35.0", + "encoding_rs", + "hashbrown 0.16.0", + "memchr", + "mime", + "precomputed-hash", + "selectors 0.32.0", + "thiserror 2.0.17", +] + +[[package]] +name = "lru" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" +dependencies = [ + "hashbrown 0.15.5", +] + +[[package]] +name = "lru" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfe949189f46fabb938b3a9a0be30fdd93fd8a09260da863399a8cf3db756ec8" +dependencies = [ + "hashbrown 0.15.5", +] + +[[package]] +name = "lz4" +version = "1.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a20b523e860d03443e98350ceaac5e71c6ba89aea7d960769ec3ce37f4de5af4" +dependencies = [ + "lz4-sys", +] + +[[package]] +name = "lz4-sys" +version = "1.11.1+lz4-1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bd8c0d6c6ed0cd30b3652886bb8711dc4bb01d637a68105a3d5158039b418e6" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "lz4_flex" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08ab2867e3eeeca90e844d1940eab391c9dc5228783db2ed999acbc0a9ed375a" + +[[package]] +name = "lzma-rs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "297e814c836ae64db86b36cf2a557ba54368d03f6afcd7d947c266692f71115e" +dependencies = [ + "byteorder", + "crc", +] + +[[package]] +name = "mac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" + +[[package]] +name = "markup5ever" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7a7213d12e1864c0f002f52c2923d4556935a43dec5e71355c2760e0f6e7a18" +dependencies = [ + "log", + "phf 0.11.3", + "phf_codegen 0.11.3", + "string_cache", + "string_cache_codegen", + "tendril", +] + +[[package]] +name = "match_token" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88a9689d8d44bf9964484516275f5cd4c9b59457a6940c1d5d0ecbb94510a36b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "matches" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" + +[[package]] +name = "mdict-app" +version = "0.5.0" +dependencies = [ + "chrono", + "colored", + "encoding_rs", + "fern", + "glob", + "global-hotkey", + "humantime", + "icu_collator", + "icu_locale", + "icu_provider", + "log", + "mdx", + "mime_guess", + "once_cell", + "percent-encoding", + "regex", + "rusqlite", + "serde", + "serde_json", + "tauri", + "tauri-build", + "tauri-plugin-clipboard-manager", + "tauri-plugin-dialog", + "tauri-plugin-opener", + "url", + "walkdir", +] + +[[package]] +name = "mdx" +version = "0.5.0" +dependencies = [ + "adler", + "bytemuck", + "byteorder", + "bzip2", + "chrono", + "encoding_rs", + "env_logger", + "flate2", + "hex", + "htmlescape", + "icu", + "icu_collator", + "icu_locale", + "icu_provider", + "indexmap 2.11.4", + "lazy_static", + "log", + "lol_html", + "lru 0.16.1", + "lz4", + "lzma-rs", + "mime_guess", + "once_cell", + "percent-encoding", + "quick-xml 0.38.3", + "rand 0.9.2", + "regex", + "ripemd128", + "rust-lzo", + "serde", + "serde-xml-rs", + "serde_json", + "shellexpand", + "snafu", + "tantivy", + "url", + "uuid", + "walkdir", + "xxhash-rust", + "zip", +] + +[[package]] +name = "measure_time" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51c55d61e72fc3ab704396c5fa16f4c184db37978ae4e94ca8959693a235fc0e" +dependencies = [ + "log", +] + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "memmap2" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843a98750cd611cc2965a8213b53b43e715f13c37a9e096c6408e69990961db7" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +dependencies = [ + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "windows-sys 0.59.0", +] + +[[package]] +name = "moxcms" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c588e11a3082784af229e23e8e4ecf5bcc6fbe4f69101e0421ce8d79da7f0b40" +dependencies = [ + "num-traits", + "pxfm", +] + +[[package]] +name = "muda" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c1738382f66ed56b3b9c8119e794a2e23148ac8ea214eda86622d4cb9d415a" +dependencies = [ + "crossbeam-channel", + "dpi", + "gtk", + "keyboard-types", + "objc2 0.6.3", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "once_cell", + "png 0.17.16", + "serde", + "thiserror 2.0.17", + "windows-sys 0.60.2", +] + +[[package]] +name = "murmurhash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2195bf6aa996a481483b29d62a7663eed3fe39600c460e323f8ff41e90bdd89b" + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags 2.9.4", + "jni-sys", + "log", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "nix" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" +dependencies = [ + "bitflags 2.9.4", + "cfg-if", + "cfg_aliases", + "libc", + "memoffset", +] + +[[package]] +name = "nodrop" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_enum" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a973b4e44ce6cad84ce69d797acf9a044532e4184c4f267913d1b546a0727b7a" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d" +dependencies = [ + "proc-macro-crate 3.4.0", + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "objc-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" + +[[package]] +name = "objc2" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804" +dependencies = [ + "objc-sys", + "objc2-encode", +] + +[[package]] +name = "objc2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c2599ce0ec54857b29ce62166b0ed9b4f6f1a70ccc9a71165b6154caca8c05" +dependencies = [ + "objc2-encode", + "objc2-exception-helper", +] + +[[package]] +name = "objc2-app-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" +dependencies = [ + "bitflags 2.9.4", + "block2 0.6.2", + "libc", + "objc2 0.6.3", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-core-image", + "objc2-core-text", + "objc2-core-video", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ad74d880bb43877038da939b7427bba67e9dd42004a18b809ba7d87cee241c" +dependencies = [ + "bitflags 2.9.4", + "objc2 0.6.3", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-core-data" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b402a653efbb5e82ce4df10683b6b28027616a2715e90009947d50b8dd298fa" +dependencies = [ + "bitflags 2.9.4", + "objc2 0.6.3", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.9.4", + "dispatch2", + "objc2 0.6.3", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "bitflags 2.9.4", + "dispatch2", + "objc2 0.6.3", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-image" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d563b38d2b97209f8e861173de434bd0214cf020e3423a52624cd1d989f006" +dependencies = [ + "objc2 0.6.3", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-core-text" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" +dependencies = [ + "bitflags 2.9.4", + "objc2 0.6.3", + "objc2-core-foundation", + "objc2-core-graphics", +] + +[[package]] +name = "objc2-core-video" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d425caf1df73233f29fd8a5c3e5edbc30d2d4307870f802d18f00d83dc5141a6" +dependencies = [ + "bitflags 2.9.4", + "objc2 0.6.3", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-io-surface", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-exception-helper" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7a1c5fbb72d7735b076bb47b578523aedc40f3c439bea6dfd595c089d79d98a" +dependencies = [ + "cc", +] + +[[package]] +name = "objc2-foundation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" +dependencies = [ + "bitflags 2.9.4", + "block2 0.5.1", + "libc", + "objc2 0.5.2", +] + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.9.4", + "block2 0.6.2", + "libc", + "objc2 0.6.3", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags 2.9.4", + "objc2 0.6.3", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-javascript-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a1e6550c4caed348956ce3370c9ffeca70bb1dbed4fa96112e7c6170e074586" +dependencies = [ + "objc2 0.6.3", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-metal" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" +dependencies = [ + "bitflags 2.9.4", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" +dependencies = [ + "bitflags 2.9.4", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", + "objc2-metal", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags 2.9.4", + "objc2 0.6.3", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-security" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe137109bd1e8b5a99390f77a7d8b2961dafc1a1c5db8f2e60329ad6d895a" +dependencies = [ + "bitflags 2.9.4", + "objc2 0.6.3", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" +dependencies = [ + "bitflags 2.9.4", + "objc2 0.6.3", + "objc2-core-foundation", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-web-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2e5aaab980c433cf470df9d7af96a7b46a9d892d521a2cbbb2f8a4c16751e7f" +dependencies = [ + "bitflags 2.9.4", + "block2 0.6.2", + "objc2 0.6.3", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-javascript-core", + "objc2-security", +] + +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + +[[package]] +name = "oneshot" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ce411919553d3f9fa53a0880544cda985a112117a0444d5ff1e870a893d6ea" + +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + +[[package]] +name = "open" +version = "5.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2483562e62ea94312f3576a7aca397306df7990b8d89033e18766744377ef95" +dependencies = [ + "dunce", + "is-wsl", + "libc", + "pathdiff", +] + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "ordered-stream" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" +dependencies = [ + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "os_pipe" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "ownedbytes" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fbd56f7631767e61784dc43f8580f403f4475bd4aaa4da003e6295e1bab4a7e" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "pango" +version = "0.18.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ca27ec1eb0457ab26f3036ea52229edbdb74dee1edd29063f5b9b010e7ebee4" +dependencies = [ + "gio", + "glib", + "libc", + "once_cell", + "pango-sys", +] + +[[package]] +name = "pango-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436737e391a843e5933d6d9aa102cb126d501e815b83601365a948a518555dc5" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link 0.2.1", +] + +[[package]] +name = "pathdiff" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap 2.11.4", +] + +[[package]] +name = "phf" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" +dependencies = [ + "phf_shared 0.8.0", +] + +[[package]] +name = "phf" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +dependencies = [ + "phf_macros 0.10.0", + "phf_shared 0.10.0", + "proc-macro-hack", +] + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros 0.11.3", + "phf_shared 0.11.3", +] + +[[package]] +name = "phf_codegen" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815" +dependencies = [ + "phf_generator 0.8.0", + "phf_shared 0.8.0", +] + +[[package]] +name = "phf_codegen" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", +] + +[[package]] +name = "phf_generator" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" +dependencies = [ + "phf_shared 0.8.0", + "rand 0.7.3", +] + +[[package]] +name = "phf_generator" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +dependencies = [ + "phf_shared 0.10.0", + "rand 0.8.5", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared 0.11.3", + "rand 0.8.5", +] + +[[package]] +name = "phf_macros" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "phf_shared" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" +dependencies = [ + "siphasher 0.3.11", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher 0.3.11", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher 1.0.1", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "piper" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "plist" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "740ebea15c5d1428f910cd1a5f52cebf8d25006245ed8ade92702f4943d91e07" +dependencies = [ + "base64 0.22.1", + "indexmap 2.11.4", + "quick-xml 0.38.3", + "serde", + "time", +] + +[[package]] +name = "png" +version = "0.17.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" +dependencies = [ + "bitflags 1.3.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide", +] + +[[package]] +name = "png" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97baced388464909d42d89643fe4361939af9b7ce7a31ee32a168f832a70f2a0" +dependencies = [ + "bitflags 2.9.4", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide", +] + +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix 1.1.2", + "windows-sys 0.61.2", +] + +[[package]] +name = "portable-atomic" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "potential_utf" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a" +dependencies = [ + "serde", + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.106", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit 0.19.15", +] + +[[package]] +name = "proc-macro-crate" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24" +dependencies = [ + "toml_datetime 0.6.3", + "toml_edit 0.20.2", +] + +[[package]] +name = "proc-macro-crate" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" +dependencies = [ + "toml_edit 0.23.7", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + +[[package]] +name = "proc-macro2" +version = "1.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "pxfm" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3cbdf373972bf78df4d3b518d07003938e2c7d1fb5891e55f9cb6df57009d84" +dependencies = [ + "num-traits", +] + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] +name = "quick-xml" +version = "0.37.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "331e97a1af0bf59823e6eadffe373d7b27f485be8748f71471c662c1f269b7fb" +dependencies = [ + "memchr", +] + +[[package]] +name = "quick-xml" +version = "0.38.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42a232e7487fc2ef313d96dde7948e7a3c05101870d8985e4fd8d26aedd27b89" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", + "rand_pcg", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] + +[[package]] +name = "rand_distr" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_pcg" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.9.4", +] + +[[package]] +name = "redox_users" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" +dependencies = [ + "getrandom 0.2.16", + "libredox", + "thiserror 2.0.17", +] + +[[package]] +name = "ref-cast" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "regex" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" + +[[package]] +name = "reqwest" +version = "0.12.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d429f34c8092b2d42c7c93cec323bb4adeb7c67698f70839adec842ec10c7ceb" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-util", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", +] + +[[package]] +name = "rfd" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2bee61e6cffa4635c72d7d81a84294e28f0930db0ddcb0f66d10244674ebed" +dependencies = [ + "ashpd", + "block2 0.6.2", + "dispatch2", + "glib-sys", + "gobject-sys", + "gtk-sys", + "js-sys", + "log", + "objc2 0.6.3", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "raw-window-handle", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows-sys 0.59.0", +] + +[[package]] +name = "ripemd128" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d8e339a48ac3f2a387d17474665caf044def2095f63845d8b37bd3faa480134" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "opaque-debug", +] + +[[package]] +name = "rusqlite" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "165ca6e57b20e1351573e3729b958bc62f0e48025386970b6e4d29e7a7e71f3f" +dependencies = [ + "bitflags 2.9.4", + "fallible-iterator", + "fallible-streaming-iterator", + "hashlink", + "libsqlite3-sys", + "smallvec", +] + +[[package]] +name = "rust-lzo" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf191ab1b954757cb5bb7f366e17d80daaa06010f1fdde7a3a7db052c1ecd1a8" +dependencies = [ + "libc", +] + +[[package]] +name = "rust-stemmers" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e46a2036019fdb888131db7a4c847a1063a7493f971ed94ea82c67eada63ca54" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.9.4", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +dependencies = [ + "bitflags 2.9.4", + "errno", + "libc", + "linux-raw-sys 0.11.0", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schemars" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" +dependencies = [ + "dyn-clone", + "indexmap 1.9.3", + "schemars_derive", + "serde", + "serde_json", + "url", + "uuid", +] + +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 2.0.106", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "selectors" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c37578180969d00692904465fb7f6b3d50b9a2b952b87c23d0e2e5cb5013416" +dependencies = [ + "bitflags 1.3.2", + "cssparser 0.29.6", + "derive_more 0.99.20", + "fxhash", + "log", + "phf 0.8.0", + "phf_codegen 0.8.0", + "precomputed-hash", + "servo_arc 0.2.0", + "smallvec", +] + +[[package]] +name = "selectors" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09975d3195f34dce9c7b381cb0f00c3c13381d4d3735c0f1a9c894b283b302ab" +dependencies = [ + "bitflags 2.9.4", + "cssparser 0.35.0", + "derive_more 2.0.1", + "log", + "new_debug_unreachable", + "phf 0.11.3", + "phf_codegen 0.11.3", + "precomputed-hash", + "rustc-hash", + "servo_arc 0.4.1", + "smallvec", +] + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde-untagged" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9faf48a4a2d2693be24c6289dbe26552776eb7737074e6722891fadbe6c5058" +dependencies = [ + "erased-serde", + "serde", + "serde_core", + "typeid", +] + +[[package]] +name = "serde-xml-rs" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53630160a98edebde0123eb4dfd0fce6adff091b2305db3154a9e920206eb510" +dependencies = [ + "log", + "serde", + "thiserror 1.0.69", + "xml-rs", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "serde_derive_internals" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "serde_json" +version = "1.0.145" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", + "serde_core", +] + +[[package]] +name = "serde_repr" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_spanned" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e24345aa0fe688594e73770a5f6d1b216508b4f93484c0026d521acd30134392" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6093cd8c01b25262b84927e0f7151692158fab02d961e04c979d3903eba7ecc5" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.11.4", + "schemars 0.9.0", + "schemars 1.0.4", + "serde_core", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7e6c180db0816026a61afa1cff5344fb7ebded7e4d3062772179f2501481c27" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "serialize-to-javascript" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04f3666a07a197cdb77cdf306c32be9b7f598d7060d50cfd4d5aa04bfd92f6c5" +dependencies = [ + "serde", + "serde_json", + "serialize-to-javascript-impl", +] + +[[package]] +name = "serialize-to-javascript-impl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772ee033c0916d670af7860b6e1ef7d658a4629a6d0b4c8c3e67f09b3765b75d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "servo_arc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52aa42f8fdf0fed91e5ce7f23d8138441002fa31dca008acf47e6fd4721f741" +dependencies = [ + "nodrop", + "stable_deref_trait", +] + +[[package]] +name = "servo_arc" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "204ea332803bd95a0b60388590d59cf6468ec9becf626e2451f1d26a1d972de4" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "shellexpand" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b1fdf65dd6331831494dd616b30351c38e96e45921a27745cf98490458b90bb" +dependencies = [ + "dirs", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" +dependencies = [ + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + +[[package]] +name = "sketches-ddsketch" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1e9a774a6c28142ac54bb25d25562e6bcf957493a184f15ad4eebccb23e410a" +dependencies = [ + "serde", +] + +[[package]] +name = "slab" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "snafu" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e84b3f4eacbf3a1ce05eac6763b4d629d60cbc94d632e4092c54ade71f1e1a2" +dependencies = [ + "backtrace", + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1c97747dbf44bb1ca44a561ece23508e99cb592e862f22222dcf42f51d1e451" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "socket2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "softbuffer" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18051cdd562e792cad055119e0cdb2cfc137e44e3987532e0f9659a77931bb08" +dependencies = [ + "bytemuck", + "cfg_aliases", + "core-graphics", + "foreign-types", + "js-sys", + "log", + "objc2 0.5.2", + "objc2-foundation 0.2.2", + "objc2-quartz-core 0.2.2", + "raw-window-handle", + "redox_syscall", + "wasm-bindgen", + "web-sys", + "windows-sys 0.59.0", +] + +[[package]] +name = "soup3" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "471f924a40f31251afc77450e781cb26d55c0b650842efafc9c6cbd2f7cc4f9f" +dependencies = [ + "futures-channel", + "gio", + "glib", + "libc", + "soup3-sys", +] + +[[package]] +name = "soup3-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebe8950a680a12f24f15ebe1bf70db7af98ad242d9db43596ad3108aab86c27" +dependencies = [ + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "string_cache" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared 0.11.3", + "precomputed-hash", + "serde", +] + +[[package]] +name = "string_cache_codegen" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c711928715f1fe0fe509c53b43e993a9a557babc2d0a3567d0a3006f1ac931a0" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", + "proc-macro2", + "quote", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "swift-rs" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4057c98e2e852d51fdcfca832aac7b571f6b351ad159f9eda5db1655f8d0c4d7" +dependencies = [ + "base64 0.21.7", + "serde", + "serde_json", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "system-deps" +version = "6.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" +dependencies = [ + "cfg-expr", + "heck 0.5.0", + "pkg-config", + "toml 0.8.2", + "version-compare", +] + +[[package]] +name = "tantivy" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "502915c7381c5cb2d2781503962610cb880ad8f1a0ca95df1bae645d5ebf2545" +dependencies = [ + "aho-corasick", + "arc-swap", + "base64 0.22.1", + "bitpacking", + "bon", + "byteorder", + "census", + "crc32fast", + "crossbeam-channel", + "downcast-rs 2.0.2", + "fastdivide", + "fnv", + "fs4", + "htmlescape", + "hyperloglogplus", + "itertools", + "levenshtein_automata", + "log", + "lru 0.12.5", + "lz4_flex", + "measure_time", + "memmap2", + "once_cell", + "oneshot", + "rayon", + "regex", + "rust-stemmers", + "rustc-hash", + "serde", + "serde_json", + "sketches-ddsketch", + "smallvec", + "tantivy-bitpacker", + "tantivy-columnar", + "tantivy-common", + "tantivy-fst", + "tantivy-query-grammar", + "tantivy-stacker", + "tantivy-tokenizer-api", + "tempfile", + "thiserror 2.0.17", + "time", + "uuid", + "winapi", +] + +[[package]] +name = "tantivy-bitpacker" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3b04eed5108d8283607da6710fe17a7663523440eaf7ea5a1a440d19a1448b6" +dependencies = [ + "bitpacking", +] + +[[package]] +name = "tantivy-columnar" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b628488ae936c83e92b5c4056833054ca56f76c0e616aee8339e24ac89119cd" +dependencies = [ + "downcast-rs 2.0.2", + "fastdivide", + "itertools", + "serde", + "tantivy-bitpacker", + "tantivy-common", + "tantivy-sstable", + "tantivy-stacker", +] + +[[package]] +name = "tantivy-common" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f880aa7cab0c063a47b62596d10991cdd0b6e0e0575d9c5eeb298b307a25de55" +dependencies = [ + "async-trait", + "byteorder", + "ownedbytes", + "serde", + "time", +] + +[[package]] +name = "tantivy-fst" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d60769b80ad7953d8a7b2c70cdfe722bbcdcac6bccc8ac934c40c034d866fc18" +dependencies = [ + "byteorder", + "regex-syntax", + "utf8-ranges", +] + +[[package]] +name = "tantivy-query-grammar" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "768fccdc84d60d86235d42d7e4c33acf43c418258ff5952abf07bd7837fcd26b" +dependencies = [ + "nom", + "serde", + "serde_json", +] + +[[package]] +name = "tantivy-sstable" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8292095d1a8a2c2b36380ec455f910ab52dde516af36321af332c93f20ab7d5" +dependencies = [ + "futures-util", + "itertools", + "tantivy-bitpacker", + "tantivy-common", + "tantivy-fst", + "zstd", +] + +[[package]] +name = "tantivy-stacker" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d38a379411169f0b3002c9cba61cdfe315f757e9d4f239c00c282497a0749d" +dependencies = [ + "murmurhash32", + "rand_distr", + "tantivy-common", +] + +[[package]] +name = "tantivy-tokenizer-api" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23024f6aeb25ceb1a0e27740c84bdb0fae52626737b7e9a9de6ad5aa25c7b038" +dependencies = [ + "serde", +] + +[[package]] +name = "tao" +version = "0.34.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a753bdc39c07b192151523a3f77cd0394aa75413802c883a0f6f6a0e5ee2e7" +dependencies = [ + "bitflags 2.9.4", + "block2 0.6.2", + "core-foundation", + "core-graphics", + "crossbeam-channel", + "dispatch", + "dlopen2", + "dpi", + "gdkwayland-sys", + "gdkx11-sys", + "gtk", + "jni", + "lazy_static", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "objc2 0.6.3", + "objc2-app-kit", + "objc2-foundation 0.3.2", + "once_cell", + "parking_lot", + "raw-window-handle", + "scopeguard", + "tao-macros", + "unicode-segmentation", + "url", + "windows", + "windows-core 0.61.2", + "windows-version", + "x11-dl", +] + +[[package]] +name = "tao-macros" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4e16beb8b2ac17db28eab8bca40e62dbfbb34c0fcdc6d9826b11b7b5d047dfd" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "target-lexicon" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + +[[package]] +name = "tauri" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9871670c6711f50fddd4e20350be6b9dd6e6c2b5d77d8ee8900eb0d58cd837a" +dependencies = [ + "anyhow", + "bytes", + "cookie", + "dirs", + "dunce", + "embed_plist", + "getrandom 0.3.3", + "glob", + "gtk", + "heck 0.5.0", + "http", + "http-range", + "jni", + "libc", + "log", + "mime", + "muda", + "objc2 0.6.3", + "objc2-app-kit", + "objc2-foundation 0.3.2", + "objc2-ui-kit", + "objc2-web-kit", + "percent-encoding", + "plist", + "raw-window-handle", + "reqwest", + "serde", + "serde_json", + "serde_repr", + "serialize-to-javascript", + "swift-rs", + "tauri-build", + "tauri-macros", + "tauri-runtime", + "tauri-runtime-wry", + "tauri-utils", + "thiserror 2.0.17", + "tokio", + "tray-icon", + "url", + "webkit2gtk", + "webview2-com", + "window-vibrancy", + "windows", +] + +[[package]] +name = "tauri-build" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a924b6c50fe83193f0f8b14072afa7c25b7a72752a2a73d9549b463f5fe91a38" +dependencies = [ + "anyhow", + "cargo_toml", + "dirs", + "glob", + "heck 0.5.0", + "json-patch", + "schemars 0.8.22", + "semver", + "serde", + "serde_json", + "tauri-utils", + "tauri-winres", + "toml 0.9.8", + "walkdir", +] + +[[package]] +name = "tauri-codegen" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c1fe64c74cc40f90848281a90058a6db931eb400b60205840e09801ee30f190" +dependencies = [ + "base64 0.22.1", + "brotli", + "ico", + "json-patch", + "plist", + "png 0.17.16", + "proc-macro2", + "quote", + "semver", + "serde", + "serde_json", + "sha2", + "syn 2.0.106", + "tauri-utils", + "thiserror 2.0.17", + "time", + "url", + "uuid", + "walkdir", +] + +[[package]] +name = "tauri-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "260c5d2eb036b76206b9fca20b7be3614cfd21046c5396f7959e0e64a4b07f2f" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.106", + "tauri-codegen", + "tauri-utils", +] + +[[package]] +name = "tauri-plugin" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9946a3cede302eac0c6eb6c6070ac47b1768e326092d32efbb91f21ed58d978f" +dependencies = [ + "anyhow", + "glob", + "plist", + "schemars 0.8.22", + "serde", + "serde_json", + "tauri-utils", + "toml 0.9.8", + "walkdir", +] + +[[package]] +name = "tauri-plugin-clipboard-manager" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "206dc20af4ed210748ba945c2774e60fd0acd52b9a73a028402caf809e9b6ecf" +dependencies = [ + "arboard", + "log", + "serde", + "serde_json", + "tauri", + "tauri-plugin", + "thiserror 2.0.17", +] + +[[package]] +name = "tauri-plugin-dialog" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "313f8138692ddc4a2127c4c9607d616a46f5c042e77b3722450866da0aad2f19" +dependencies = [ + "log", + "raw-window-handle", + "rfd", + "serde", + "serde_json", + "tauri", + "tauri-plugin", + "tauri-plugin-fs", + "thiserror 2.0.17", + "url", +] + +[[package]] +name = "tauri-plugin-fs" +version = "2.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47df422695255ecbe7bac7012440eddaeefd026656171eac9559f5243d3230d9" +dependencies = [ + "anyhow", + "dunce", + "glob", + "percent-encoding", + "schemars 0.8.22", + "serde", + "serde_json", + "serde_repr", + "tauri", + "tauri-plugin", + "tauri-utils", + "thiserror 2.0.17", + "toml 0.9.8", + "url", +] + +[[package]] +name = "tauri-plugin-opener" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c26b72571d25dee25667940027114e60f569fc3974f8cefbe50c2cbc5fd65e3b" +dependencies = [ + "dunce", + "glob", + "objc2-app-kit", + "objc2-foundation 0.3.2", + "open", + "schemars 0.8.22", + "serde", + "serde_json", + "tauri", + "tauri-plugin", + "thiserror 2.0.17", + "url", + "windows", + "zbus", +] + +[[package]] +name = "tauri-runtime" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9368f09358496f2229313fccb37682ad116b7f46fa76981efe116994a0628926" +dependencies = [ + "cookie", + "dpi", + "gtk", + "http", + "jni", + "objc2 0.6.3", + "objc2-ui-kit", + "objc2-web-kit", + "raw-window-handle", + "serde", + "serde_json", + "tauri-utils", + "thiserror 2.0.17", + "url", + "webkit2gtk", + "webview2-com", + "windows", +] + +[[package]] +name = "tauri-runtime-wry" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "929f5df216f5c02a9e894554401bcdab6eec3e39ec6a4a7731c7067fc8688a93" +dependencies = [ + "gtk", + "http", + "jni", + "log", + "objc2 0.6.3", + "objc2-app-kit", + "objc2-foundation 0.3.2", + "once_cell", + "percent-encoding", + "raw-window-handle", + "softbuffer", + "tao", + "tauri-runtime", + "tauri-utils", + "url", + "webkit2gtk", + "webview2-com", + "windows", + "wry", +] + +[[package]] +name = "tauri-utils" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b8bbe426abdbf52d050e52ed693130dbd68375b9ad82a3fb17efb4c8d85673" +dependencies = [ + "anyhow", + "brotli", + "cargo_metadata", + "ctor", + "dunce", + "glob", + "html5ever", + "http", + "infer", + "json-patch", + "kuchikiki", + "log", + "memchr", + "phf 0.11.3", + "proc-macro2", + "quote", + "regex", + "schemars 0.8.22", + "semver", + "serde", + "serde-untagged", + "serde_json", + "serde_with", + "swift-rs", + "thiserror 2.0.17", + "toml 0.9.8", + "url", + "urlpattern", + "uuid", + "walkdir", +] + +[[package]] +name = "tauri-winres" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd21509dd1fa9bd355dc29894a6ff10635880732396aa38c0066c1e6c1ab8074" +dependencies = [ + "embed-resource", + "toml 0.9.8", +] + +[[package]] +name = "tempfile" +version = "3.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" +dependencies = [ + "fastrand", + "getrandom 0.3.3", + "once_cell", + "rustix 1.1.2", + "windows-sys 0.61.2", +] + +[[package]] +name = "tendril" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" +dependencies = [ + "futf", + "mac", + "utf-8", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +dependencies = [ + "thiserror-impl 2.0.17", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "tiff" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af9605de7fee8d9551863fd692cce7637f548dbd9db9180fcc07ccc6d26c336f" +dependencies = [ + "fax", + "flate2", + "half", + "quick-error", + "weezl", + "zune-jpeg", +] + +[[package]] +name = "time" +version = "0.3.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" + +[[package]] +name = "time-macros" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.47.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" +dependencies = [ + "backtrace", + "bytes", + "io-uring", + "libc", + "mio", + "pin-project-lite", + "signal-hook-registry", + "slab", + "socket2", + "tracing", + "windows-sys 0.59.0", +] + +[[package]] +name = "tokio-util" +version = "0.7.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" +dependencies = [ + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.3", + "toml_edit 0.20.2", +] + +[[package]] +name = "toml" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dc8b1fb61449e27716ec0e1bdf0f6b8f3e8f6b05391e8497b8b6d7804ea6d8" +dependencies = [ + "indexmap 2.11.4", + "serde_core", + "serde_spanned 1.0.3", + "toml_datetime 0.7.3", + "toml_parser", + "toml_writer", + "winnow 0.7.13", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.11.4", + "toml_datetime 0.6.3", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +dependencies = [ + "indexmap 2.11.4", + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.3", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.23.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d" +dependencies = [ + "indexmap 2.11.4", + "toml_datetime 0.7.3", + "toml_parser", + "winnow 0.7.13", +] + +[[package]] +name = "toml_parser" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e" +dependencies = [ + "winnow 0.7.13", +] + +[[package]] +name = "toml_writer" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df8b2b54733674ad286d16267dcfc7a71ed5c776e4ac7aa3c3e2561f7c637bf2" + +[[package]] +name = "tower" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" +dependencies = [ + "bitflags 2.9.4", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "tracing-core" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tray-icon" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0d92153331e7d02ec09137538996a7786fe679c629c279e82a6be762b7e6fe2" +dependencies = [ + "crossbeam-channel", + "dirs", + "libappindicator", + "muda", + "objc2 0.6.3", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "once_cell", + "png 0.17.16", + "serde", + "thiserror 2.0.17", + "windows-sys 0.59.0", +] + +[[package]] +name = "tree_magic_mini" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f943391d896cdfe8eec03a04d7110332d445be7df856db382dd96a730667562c" +dependencies = [ + "memchr", + "nom", + "once_cell", + "petgraph", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typeid" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "uds_windows" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9" +dependencies = [ + "memoffset", + "tempfile", + "winapi", +] + +[[package]] +name = "unic-char-property" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" +dependencies = [ + "unic-char-range", +] + +[[package]] +name = "unic-char-range" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" + +[[package]] +name = "unic-common" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" + +[[package]] +name = "unic-ucd-ident" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e230a37c0381caa9219d67cf063aa3a375ffed5bf541a452db16e744bdab6987" +dependencies = [ + "unic-char-property", + "unic-char-range", + "unic-ucd-version", +] + +[[package]] +name = "unic-ucd-version" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" +dependencies = [ + "unic-common", +] + +[[package]] +name = "unicase" +version = "2.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" + +[[package]] +name = "unicode-ident" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "url" +version = "2.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "urlpattern" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70acd30e3aa1450bc2eece896ce2ad0d178e9c079493819301573dae3c37ba6d" +dependencies = [ + "regex", + "serde", + "unic-ucd-ident", + "url", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8-ranges" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcfc827f90e53a02eaef5e535ee14266c1d569214c6aa70133a624d8a3164ba" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" +dependencies = [ + "getrandom 0.3.3", + "js-sys", + "serde", + "wasm-bindgen", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version-compare" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vswhom" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" +dependencies = [ + "libc", + "vswhom-sys", +] + +[[package]] +name = "vswhom-sys" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb067e4cbd1ff067d1df46c9194b5de0e98efd2810bbc95c5d5e5f25a3231150" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasi" +version = "0.14.7+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c" +dependencies = [ + "wasip2", +] + +[[package]] +name = "wasip2" +version = "1.0.1+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn 2.0.106", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e038d41e478cc73bae0ff9b36c60cff1c98b8f38f8d7e8061e79ee63608ac5c" +dependencies = [ + "cfg-if", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-streams" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "wayland-backend" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673a33c33048a5ade91a6b139580fa174e19fb0d23f396dca9fa15f2e1e49b35" +dependencies = [ + "cc", + "downcast-rs 1.2.1", + "rustix 1.1.2", + "scoped-tls", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-client" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c66a47e840dc20793f2264eb4b3e4ecb4b75d91c0dd4af04b456128e0bdd449d" +dependencies = [ + "bitflags 2.9.4", + "rustix 1.1.2", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols" +version = "0.32.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efa790ed75fbfd71283bd2521a1cfdc022aabcc28bdcff00851f9e4ae88d9901" +dependencies = [ + "bitflags 2.9.4", + "wayland-backend", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd94963ed43cf9938a090ca4f7da58eb55325ec8200c3848963e98dc25b78ec" +dependencies = [ + "bitflags 2.9.4", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.31.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54cb1e9dc49da91950bdfd8b848c49330536d9d1fb03d4bfec8cae50caa50ae3" +dependencies = [ + "proc-macro2", + "quick-xml 0.37.5", + "quote", +] + +[[package]] +name = "wayland-sys" +version = "0.31.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34949b42822155826b41db8e5d0c1be3a2bd296c747577a43a3e6daefc296142" +dependencies = [ + "dlib", + "log", + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9367c417a924a74cae129e6a2ae3b47fabb1f8995595ab474029da749a8be120" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webkit2gtk" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76b1bc1e54c581da1e9f179d0b38512ba358fb1af2d634a1affe42e37172361a" +dependencies = [ + "bitflags 1.3.2", + "cairo-rs", + "gdk", + "gdk-sys", + "gio", + "gio-sys", + "glib", + "glib-sys", + "gobject-sys", + "gtk", + "gtk-sys", + "javascriptcore-rs", + "libc", + "once_cell", + "soup3", + "webkit2gtk-sys", +] + +[[package]] +name = "webkit2gtk-sys" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62daa38afc514d1f8f12b8693d30d5993ff77ced33ce30cd04deebc267a6d57c" +dependencies = [ + "bitflags 1.3.2", + "cairo-sys-rs", + "gdk-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "gtk-sys", + "javascriptcore-rs-sys", + "libc", + "pkg-config", + "soup3-sys", + "system-deps", +] + +[[package]] +name = "webview2-com" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4ba622a989277ef3886dd5afb3e280e3dd6d974b766118950a08f8f678ad6a4" +dependencies = [ + "webview2-com-macros", + "webview2-com-sys", + "windows", + "windows-core 0.61.2", + "windows-implement", + "windows-interface", +] + +[[package]] +name = "webview2-com-macros" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d228f15bba3b9d56dde8bddbee66fa24545bd17b48d5128ccf4a8742b18e431" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "webview2-com-sys" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36695906a1b53a3bf5c4289621efedac12b73eeb0b89e7e1a89b517302d5d75c" +dependencies = [ + "thiserror 2.0.17", + "windows", + "windows-core 0.61.2", +] + +[[package]] +name = "weezl" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a751b3277700db47d3e574514de2eced5e54dc8a5436a3bf7a0b248b2cee16f3" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "window-vibrancy" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9bec5a31f3f9362f2258fd0e9c9dd61a9ca432e7306cc78c444258f0dce9a9c" +dependencies = [ + "objc2 0.6.3", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "raw-window-handle", + "windows-sys 0.59.0", + "windows-version", +] + +[[package]] +name = "windows" +version = "0.61.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" +dependencies = [ + "windows-collections", + "windows-core 0.61.2", + "windows-future", + "windows-link 0.1.3", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core 0.61.2", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.1.3", + "windows-result 0.3.4", + "windows-strings 0.4.2", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-future" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link 0.2.1", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-version" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4060a1da109b9d0326b7262c8e12c84df67cc0dbc9e33cf49e01ccc2eb63631" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.55.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb5a765337c50e9ec252c2069be9bf91c7df47afb103b642ba3a53bf8101be97" +dependencies = [ + "cfg-if", + "windows-sys 0.59.0", +] + +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" + +[[package]] +name = "wl-clipboard-rs" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5ff8d0e60065f549fafd9d6cb626203ea64a798186c80d8e7df4f8af56baeb" +dependencies = [ + "libc", + "log", + "os_pipe", + "rustix 0.38.44", + "tempfile", + "thiserror 2.0.17", + "tree_magic_mini", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-wlr", +] + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" +dependencies = [ + "either", +] + +[[package]] +name = "wry" +version = "0.53.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d78ec082b80fa088569a970d043bb3050abaabf4454101d44514ee8d9a8c9f6" +dependencies = [ + "base64 0.22.1", + "block2 0.6.2", + "cookie", + "crossbeam-channel", + "dirs", + "dpi", + "dunce", + "gdkx11", + "gtk", + "html5ever", + "http", + "javascriptcore-rs", + "jni", + "kuchikiki", + "libc", + "ndk", + "objc2 0.6.3", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-ui-kit", + "objc2-web-kit", + "once_cell", + "percent-encoding", + "raw-window-handle", + "sha2", + "soup3", + "tao-macros", + "thiserror 2.0.17", + "url", + "webkit2gtk", + "webkit2gtk-sys", + "webview2-com", + "windows", + "windows-core 0.61.2", + "windows-version", + "x11-dl", +] + +[[package]] +name = "x11" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "x11rb" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" +dependencies = [ + "gethostname", + "rustix 1.1.2", + "x11rb-protocol", +] + +[[package]] +name = "x11rb-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" + +[[package]] +name = "xkeysym" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" + +[[package]] +name = "xml-rs" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fd8403733700263c6eb89f192880191f1b83e332f7a20371ddcf421c4a337c7" + +[[package]] +name = "xxhash-rust" +version = "0.8.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdd20c5420375476fbd4394763288da7eb0cc0b8c11deed431a91562af7335d3" + +[[package]] +name = "yoke" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", + "synstructure", +] + +[[package]] +name = "zbus" +version = "5.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d07e46d035fb8e375b2ce63ba4e4ff90a7f73cf2ffb0138b29e1158d2eaadf7" +dependencies = [ + "async-broadcast", + "async-executor", + "async-io", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "enumflags2", + "event-listener", + "futures-core", + "futures-lite", + "hex", + "nix", + "ordered-stream", + "serde", + "serde_repr", + "tokio", + "tracing", + "uds_windows", + "windows-sys 0.60.2", + "winnow 0.7.13", + "zbus_macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "5.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57e797a9c847ed3ccc5b6254e8bcce056494b375b511b3d6edcec0aeb4defaca" +dependencies = [ + "proc-macro-crate 3.4.0", + "proc-macro2", + "quote", + "syn 2.0.106", + "zbus_names", + "zvariant", + "zvariant_utils", +] + +[[package]] +name = "zbus_names" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7be68e64bf6ce8db94f63e72f0c7eb9a60d733f7e0499e628dfab0f84d6bcb97" +dependencies = [ + "serde", + "static_assertions", + "winnow 0.7.13", + "zvariant", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "zip" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb2a05c7c36fde6c09b08576c9f7fb4cda705990f73b58fe011abf7dfb24168b" +dependencies = [ + "arbitrary", + "crc32fast", + "flate2", + "indexmap 2.11.4", + "memchr", + "zopfli", +] + +[[package]] +name = "zlib-rs" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f06ae92f42f5e5c42443fd094f245eb656abf56dd7cce9b8b263236565e00f2" + +[[package]] +name = "zopfli" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edfc5ee405f504cd4984ecc6f14d02d55cfda60fa4b689434ef4102aae150cd7" +dependencies = [ + "bumpalo", + "crc32fast", + "log", + "simd-adler32", +] + +[[package]] +name = "zstd" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.16+zstd.1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748" +dependencies = [ + "cc", + "pkg-config", +] + +[[package]] +name = "zune-core" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a" + +[[package]] +name = "zune-jpeg" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29ce2c8a9384ad323cf564b67da86e21d3cfdff87908bc1223ed5c99bc792713" +dependencies = [ + "zune-core", +] + +[[package]] +name = "zvariant" +version = "5.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "999dd3be73c52b1fccd109a4a81e4fcd20fab1d3599c8121b38d04e1419498db" +dependencies = [ + "endi", + "enumflags2", + "serde", + "url", + "winnow 0.7.13", + "zvariant_derive", + "zvariant_utils", +] + +[[package]] +name = "zvariant_derive" +version = "5.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6643fd0b26a46d226bd90d3f07c1b5321fe9bb7f04673cb37ac6d6883885b68e" +dependencies = [ + "proc-macro-crate 3.4.0", + "proc-macro2", + "quote", + "syn 2.0.106", + "zvariant_utils", +] + +[[package]] +name = "zvariant_utils" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6949d142f89f6916deca2232cf26a8afacf2b9fdc35ce766105e104478be599" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "syn 2.0.106", + "winnow 0.7.13", +] diff --git a/rust/src-tauri/Cargo.toml b/rust/src-tauri/Cargo.toml new file mode 100644 index 0000000000000000000000000000000000000000..5c23cf294182bf54ea0cf0d3c86b2cc062853f02 --- /dev/null +++ b/rust/src-tauri/Cargo.toml @@ -0,0 +1,54 @@ +[package] +name = "mdict-app" +version = "0.5.0" +description = "Mdict App" +authors = ["Rayman Zhang"] +edition = "2024" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lib] +# The `_lib` suffix may seem redundant but it is necessary +# to make the lib name unique and wouldn't conflict with the bin name. +# This seems to be only an issue on Windows, see https://github.com/rust-lang/cargo/issues/8519 +name = "mdict_app_lib" +crate-type = ["staticlib", "cdylib", "rlib"] + +[build-dependencies] +tauri-build = { version = "2.5.1", features = [] } + +[dependencies] +tauri = { version = "2.9.1", features = ["protocol-asset", "devtools"] } +tauri-plugin-opener = "2.5.2" +tauri-plugin-dialog = "2.4.2" +# global-hotkey is only needed for desktop platforms (not mobile) +global-hotkey = { version = "0.7.0", optional = true } +tauri-plugin-clipboard-manager = "2.3.2" +serde = { version = "1.0.225", features = ["derive"] } +serde_json = "1.0.145" +# tokio = { version = "1", features = ["sync", "fs"] } +once_cell = "1.19" +url = "2.5" +fern = "0.7.1" +log = "0.4.28" +glob = "^0.3.1" +regex = "1.12.2" +walkdir = "2.5" +#mdx = { path = "/Volumes/ExtMacOS/Users/rayman/source/mdictx/mdx" } +mdx = { path = "../../mdictx/mdx", features = ["icu"] } +percent-encoding = "^2.3.0" +encoding_rs = "0.8.35" +mime_guess = "2.0" +colored = "3.0.0" +humantime = "2.3.0" +rusqlite = { version = "0.37.0", features = ["bundled"] } +chrono = "0.4" +icu_collator = "2.1.1" +icu_locale = "2.1.1" +icu_provider = "2.1.1" + +[features] +# Default feature includes global-hotkey for desktop platforms +default = ["global-hotkey"] + +[profile.dev] +debug = true diff --git a/rust/src-tauri/build.rs b/rust/src-tauri/build.rs new file mode 100644 index 0000000000000000000000000000000000000000..d860e1e6a7cac333c3cc0bc9cb67faf286b07d69 --- /dev/null +++ b/rust/src-tauri/build.rs @@ -0,0 +1,3 @@ +fn main() { + tauri_build::build() +} diff --git a/rust/src-tauri/capabilities/default.json b/rust/src-tauri/capabilities/default.json new file mode 100644 index 0000000000000000000000000000000000000000..c9f7c4c8a934e53c0359c5e1235a035edbf576b1 --- /dev/null +++ b/rust/src-tauri/capabilities/default.json @@ -0,0 +1,12 @@ +{ + "$schema": "../gen/schemas/desktop-schema.json", + "identifier": "default", + "description": "Capability for the main window", + "windows": ["main"], + "permissions": [ + "core:default", + "opener:default", + "dialog:default", + "clipboard-manager:allow-read-text" + ] +} diff --git a/rust/src-tauri/icons/128x128.png b/rust/src-tauri/icons/128x128.png new file mode 100644 index 0000000000000000000000000000000000000000..c27c6ee01a537753554b239a1e99d482bcea965f --- /dev/null +++ b/rust/src-tauri/icons/128x128.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b1dcde796719090aad463724d96342f3e0b04da43765bee1fa84239fdcbde4b +size 9313 diff --git a/rust/src-tauri/icons/128x128@2x.png b/rust/src-tauri/icons/128x128@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..fbbe5bc3a27a42e22314bf013bef2f624bddf44f --- /dev/null +++ b/rust/src-tauri/icons/128x128@2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cac63f59e3a1852046b11ca504830f79214458fa34ee0365acc9141b26263ec8 +size 20557 diff --git a/rust/src-tauri/icons/32x32.png b/rust/src-tauri/icons/32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..0f9e284ebbb74ef2a0f7d83798bed9925797b407 --- /dev/null +++ b/rust/src-tauri/icons/32x32.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fa489ee2a43ddfc372b16984d8342c6f87e44d0bc3735e7396caeb288cc6cd41 +size 2210 diff --git a/rust/src-tauri/icons/Square107x107Logo.png b/rust/src-tauri/icons/Square107x107Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..d7870e827b40b757ff2457b907ed6f9777f0e3ab --- /dev/null +++ b/rust/src-tauri/icons/Square107x107Logo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5036a816880e417ad5b40ee159653e5edfef2b5e91e443e0fdf42b2439b3bcf4 +size 7564 diff --git a/rust/src-tauri/icons/Square142x142Logo.png b/rust/src-tauri/icons/Square142x142Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..f4d8fef806cdfcc3b8efc281a6009c8cc0b3484d --- /dev/null +++ b/rust/src-tauri/icons/Square142x142Logo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd5642638773b804be2ce717fefc7c949aca7c136a3b246458a2d6144a0fec85 +size 10619 diff --git a/rust/src-tauri/icons/Square150x150Logo.png b/rust/src-tauri/icons/Square150x150Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..b5ab3d6ed687e219600e02b5d397945133c31aa0 --- /dev/null +++ b/rust/src-tauri/icons/Square150x150Logo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f076082f79998fa87a5500be5f31c69d71b2f91000046cba815b9512efbad867 +size 11165 diff --git a/rust/src-tauri/icons/Square284x284Logo.png b/rust/src-tauri/icons/Square284x284Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..c493e9696a5f017eed8b613e28f8e72f038ac116 --- /dev/null +++ b/rust/src-tauri/icons/Square284x284Logo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9d3bba94f75534df21234a4219af1492e527e3d951642c9c604b5b948c427818 +size 23162 diff --git a/rust/src-tauri/icons/Square30x30Logo.png b/rust/src-tauri/icons/Square30x30Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..2816cb2b15b64003189a56fd6bdea4b4fc92af6a --- /dev/null +++ b/rust/src-tauri/icons/Square30x30Logo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:246c285334136f6e61ddee3fd17079ab109b9c0a9a34c7988eea0fe1c9903b9a +size 1988 diff --git a/rust/src-tauri/icons/Square310x310Logo.png b/rust/src-tauri/icons/Square310x310Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..3344c76ea8becb1cc58046b38d2feff727032536 --- /dev/null +++ b/rust/src-tauri/icons/Square310x310Logo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8abd133b72d4045189b6587549d37cc342acf9d873a3bb8a943cf9090c8ee240 +size 25504 diff --git a/rust/src-tauri/icons/Square44x44Logo.png b/rust/src-tauri/icons/Square44x44Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..b1fae232f35e959244a5c3da25a3c0f290c3be71 --- /dev/null +++ b/rust/src-tauri/icons/Square44x44Logo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e861d1be95b44f2bbf1a9d81ecbf791d9f60e4c3b93e47d77ce6c97dc95aa1ed +size 2951 diff --git a/rust/src-tauri/icons/Square71x71Logo.png b/rust/src-tauri/icons/Square71x71Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..2957275e5b87e28dc42107777178e6adeaeb7c92 --- /dev/null +++ b/rust/src-tauri/icons/Square71x71Logo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:73c0da1fc57cbcb9253c3c0346a1cf9dd7badf871aee2415b94be0397efbad54 +size 4788 diff --git a/rust/src-tauri/icons/Square89x89Logo.png b/rust/src-tauri/icons/Square89x89Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..bdba677bf407f0d18d620154119e0f7559187174 --- /dev/null +++ b/rust/src-tauri/icons/Square89x89Logo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:afab62f85c567698a4d6331f582b64abdaf46a9762721ba6930ac11134f7638c +size 6131 diff --git a/rust/src-tauri/icons/StoreLogo.png b/rust/src-tauri/icons/StoreLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..b5ab3d6ed687e219600e02b5d397945133c31aa0 --- /dev/null +++ b/rust/src-tauri/icons/StoreLogo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f076082f79998fa87a5500be5f31c69d71b2f91000046cba815b9512efbad867 +size 11165 diff --git a/rust/src-tauri/icons/icon.icns b/rust/src-tauri/icons/icon.icns new file mode 100644 index 0000000000000000000000000000000000000000..f97963d1c633147b998fe7965ca1c48aab0249ef --- /dev/null +++ b/rust/src-tauri/icons/icon.icns @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5e50798b28671b2b4eb733e4411acd094944073a41772f9880eaf4107d60360 +size 312732 diff --git a/rust/src-tauri/icons/icon.ico b/rust/src-tauri/icons/icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..8e14d61192f3d8d8a790d397e1814ca94e144a09 --- /dev/null +++ b/rust/src-tauri/icons/icon.ico @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:111ced207954404daf8bcc2422d078c06bde9791047dd0719dfe40bf28278162 +size 121856 diff --git a/rust/src-tauri/icons/icon.png b/rust/src-tauri/icons/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..c489dc9c0046a203cd96db08594550ca97c73153 --- /dev/null +++ b/rust/src-tauri/icons/icon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f0b8f4a9890a15d32cd15a27c5369a7664a524759deb5e588f26dad3c7b0f83 +size 46357 diff --git a/rust/src-tauri/src/action_handlers.rs b/rust/src-tauri/src/action_handlers.rs new file mode 100644 index 0000000000000000000000000000000000000000..b2331b056d748478a2a320cf99cdcb1981d12b21 --- /dev/null +++ b/rust/src-tauri/src/action_handlers.rs @@ -0,0 +1,250 @@ +use percent_encoding::percent_decode_str; +use tauri::http::{Response, StatusCode}; +use url::Url; + +use mdx::storage::{EntryNo, KeyIndex}; + +use crate::error::{Result, ZdbError}; +use crate::mdict_app::{with_read_access, with_write_access}; +use crate::mdx_db::MdxIndex; +use crate::mdx_profile::ProfileId; +use crate::mdx_url_parser::MdxAction; + +/// Action handler trait +pub trait ActionHandler { + fn handle(&self, url: &Url, action: MdxAction) -> Result>>; +} + +/// 获取URL查询参数的辅助函数 +fn get_param(url: &Url, key: &str) -> Result { + for (k, v) in url.query_pairs() { + if k == key { + return Ok(v.to_string()); + } + } + Err(ZdbError::invalid_parameter(format!("Parameter {} not found", key))) +} + +/// 根据文件扩展名确定MIME类型 +fn get_mime_type(file_path: &str) -> String { + use mime_guess::{from_path, mime}; + + let mime_type = from_path(file_path).first_or_octet_stream(); + + // 对于HTML文件,确保包含charset=utf-8 + if mime_type.type_() == mime::TEXT && mime_type.subtype() == mime::HTML { + "text/html; charset=utf-8".to_string() + } else { + mime_type.to_string() + } +} + +/// 构建 HTTP Response 的辅助函数 +fn build_response(status_code: StatusCode, content_type: &str, data: Vec) -> Response> { + let mut response = Response::new(data); + *response.status_mut() = status_code; + response.headers_mut().insert("Content-Type", content_type.parse().unwrap()); + response +} + +/// 获取单个条目的HTML内容 +pub fn get_entry_html_by_index(index:&MdxIndex) -> Result { + with_write_access(|app| app.get_entry_html_by_index(index)) +} + +/// 获取MDD数据 +pub fn get_mdd_data(profile_id: &ProfileId, filename: &str) -> Result, String)>> { + with_write_access(|app| app.get_mdd_data(profile_id, filename)) +} + +/// 获取asset文件内容(二进制) +pub fn get_asset(filename: &str) -> Result>> { + with_read_access(|app| app.get_asset(filename).map(|opt| opt.cloned())) +} + +/// 资源文件处理器 (Res, EncryptedRes) +pub struct ResHandler; + +impl ActionHandler for ResHandler { + fn handle(&self, url: &Url, _action: MdxAction) -> Result>> { + let path_with_action = url.path().strip_prefix("/service/").unwrap_or(url.path()); + let action_str = path_with_action.split('/').next().unwrap_or(path_with_action); + let real_path = path_with_action.strip_prefix(action_str).unwrap_or(path_with_action).to_string(); + + let decoded_path = percent_decode_str(&real_path).decode_utf8()?.to_string(); + let content_type = get_mime_type(&decoded_path); + let data = get_asset(&decoded_path)?; + + match data { + Some(data) => Ok(build_response(StatusCode::OK, &content_type, data)), + None => Ok(build_response(StatusCode::NOT_FOUND, "text/plain", "Not found".as_bytes().to_vec())), + } + } +} + +/// 词条索引处理器 (EntryX, ProgEntryX, HProgEntryX) +pub struct EntryXHandler; + +impl ActionHandler for EntryXHandler { + fn handle(&self, url: &Url, _action: MdxAction) -> Result>> { + let profile_id = get_param(url, "profile_id")?.parse::()?; + let entry_no = get_param(url, "entry_no")?.parse::()?; + + let mdx_index = MdxIndex { + profile_id, + key_index: KeyIndex { + entry_no, + key: String::new(), + content_offset_in_source: 0, + key_raw: String::new().into_bytes(), + sort_key: String::new().into_bytes(), + }, + }; + + let html = get_entry_html_by_index(&mdx_index)?; + + Ok(build_response(StatusCode::OK, "text/html; charset=utf-8", html.into_bytes())) + } +} + +/// MDD文件处理器 (Mdd, File) +pub struct MddHandler; + +impl ActionHandler for MddHandler { + fn handle(&self, url: &Url, action: MdxAction) -> Result>> { + let (profile_id, filename) = if action == MdxAction::File { + // file:// URL + let profile_id = 0; // 默认profile_id,可能需要调整 + let filename = url.path().to_string(); + (profile_id, filename) + } else { + // mdx:// URL + let profile_id = get_param(url, "profile_id")?.parse::()?; + let key = get_param(url, "key")?; + let decoded_key = percent_decode_str(&key).decode_utf8()?.to_string(); + (profile_id, decoded_key) + }; + + let data = get_mdd_data(&profile_id, &filename)?; + if let Some((data, content_type)) = data { + Ok(build_response(StatusCode::OK, &content_type, data)) + } else { + Ok(build_response(StatusCode::NOT_FOUND, "text/plain", "Not found".as_bytes().to_vec())) + } + } +} + +/// IFrame处理器 +pub struct IFrameHandler; + +impl ActionHandler for IFrameHandler { + fn handle(&self, url: &Url, _action: MdxAction) -> Result>> { + let profile_id = get_param(url, "profile_id")?.parse::()?; + let entry_no = get_param(url, "entry_no")?.parse::()?; + + let mdx_index = MdxIndex { + profile_id, + key_index: KeyIndex { + entry_no, + key: String::new(), + content_offset_in_source: 0, + key_raw: String::new().into_bytes(), + sort_key: String::new().into_bytes(), + }, + }; + + let html = get_entry_html_by_index(&mdx_index)?; + + Ok(build_response(StatusCode::OK, "text/html; charset=utf-8", html.into_bytes())) + } +} + +/// 调试信息处理器 (Debug, Notify, Info) +pub struct DebugHandler; + +impl ActionHandler for DebugHandler { + fn handle(&self, url: &Url, action: MdxAction) -> Result>> { + let message = get_param(url, "message").unwrap_or_else(|_| "No message".to_string()); + let decoded_message = percent_decode_str(&message).decode_utf8()?.to_string(); + + log::info!("{:?}: {}", action, decoded_message); + + Ok(build_response(StatusCode::OK, "text/html; charset=utf-8", "{}".as_bytes().to_vec())) + } +} + +/// Launch处理器 +pub struct LaunchHandler; + +impl ActionHandler for LaunchHandler { + fn handle(&self, url: &Url, _action: MdxAction) -> Result>> { + let _x = get_param(url, "x")?.parse::()?; + let _y = get_param(url, "y")?.parse::()?; + let _width = get_param(url, "width")?.parse::()?; + let _height = get_param(url, "height")?.parse::()?; + let key = get_param(url, "key")?; + let decoded_key = percent_decode_str(&key).decode_utf8()?.to_string(); + + // 这里可以根据需要使用位置和尺寸信息 + // 暂时返回简单的响应 + let response_html = format!("

Launch: {}

", decoded_key); + + Ok(build_response(StatusCode::OK, "text/html; charset=utf-8", response_html.into_bytes())) + } +} + +/// Sound处理器 +pub struct SoundHandler; + +impl ActionHandler for SoundHandler { + fn handle(&self, url: &Url, _action: MdxAction) -> Result>> { + let profile_id = get_param(url, "profile_id")?.parse::()?; + let key = get_param(url, "key")?; + let decoded_key = percent_decode_str(&key).decode_utf8()?.to_string(); + + // 音频文件通常通过MDD处理 + let data = get_mdd_data(&profile_id, &decoded_key)?; + if let Some((data, content_type)) = data { + Ok(build_response(StatusCode::OK, &content_type, data)) + } else { + Ok(build_response(StatusCode::NOT_FOUND, "text/plain", "Not found".as_bytes().to_vec())) + } + + } +} + +/// ViewImage处理器 +pub struct ViewImageHandler; + +impl ActionHandler for ViewImageHandler { + fn handle(&self, url: &Url, _action: MdxAction) -> Result>> { + let path_with_action = url.path().strip_prefix("/service/").unwrap_or(url.path()); + let action_str = path_with_action.split('/').next().unwrap_or(path_with_action); + let real_path = path_with_action.strip_prefix(action_str).unwrap_or(path_with_action).to_string(); + + let decoded_path = percent_decode_str(&real_path).decode_utf8()?.to_string(); + let content_type = get_mime_type(&decoded_path); + let data = get_asset(&decoded_path)?; + + match data { + Some(data) => Ok(build_response(StatusCode::OK, &content_type, data)), + None => Ok(build_response(StatusCode::NOT_FOUND, "text/plain", "Not found".as_bytes().to_vec())), + } + } +} + + +/// 获取action handler +pub fn get_action_handler(action: MdxAction) -> Option> { + match action { + MdxAction::Res | MdxAction::EncryptedRes => Some(Box::new(ResHandler)), + MdxAction::ViewImage => Some(Box::new(ViewImageHandler)), + MdxAction::Sound => Some(Box::new(SoundHandler)), + MdxAction::EntryX | MdxAction::ProgEntryX | MdxAction::HProgEntryX => Some(Box::new(EntryXHandler)), + MdxAction::Mdd | MdxAction::File => Some(Box::new(MddHandler)), + MdxAction::IFrame => Some(Box::new(IFrameHandler)), + MdxAction::Debug | MdxAction::Notify | MdxAction::Info => Some(Box::new(DebugHandler)), + MdxAction::Launch => Some(Box::new(LaunchHandler)), + _ => None, + } +} diff --git a/rust/src-tauri/src/app_config.rs b/rust/src-tauri/src/app_config.rs new file mode 100644 index 0000000000000000000000000000000000000000..ed8dd1431b0f25ef1dcc4f577fe857cca2fc80cc --- /dev/null +++ b/rust/src-tauri/src/app_config.rs @@ -0,0 +1,377 @@ +use std::path::{Path, PathBuf}; +use serde::{Deserialize, Serialize}; +use serde_json::Value; + +use crate::error::{Result, ZdbError}; + +/// 外观模式枚举 +#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)] +pub enum AppearanceMode { + Auto, + Light, + Dark, +} + +pub enum Language { + Auto, + English, + Chinese, +} + +/// 配置键枚举,用于防止拼写错误 +#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)] +pub enum ConfigKey { + // 全局设置键 + AppOwner, + AudioLibPath, + ExtraLibSearchPath, + CustomFontPath, + AutoLookupClipboard, + MonitorClipboard, + AutoLookupSelection, + HotkeyLetter, + HotkeyModifier, + UsePopoverForLookup, + LastMainProfileId, + + // 视图设置键 + GuiLanguage, + AppearanceMode, + FontFace, + FontColor, + BackgroundColor, + AutoResizeImage, +} + +impl ConfigKey { + /// 获取配置键对应的字符串 + pub fn as_str(&self) -> &'static str { + match self { + // 全局设置 + ConfigKey::AppOwner => "app_owner", + ConfigKey::AudioLibPath => "audio_lib_path", + ConfigKey::CustomFontPath => "custom_font_path", + ConfigKey::ExtraLibSearchPath => "extra_lib_search_path", + ConfigKey::GuiLanguage => "gui_language", + ConfigKey::AutoLookupClipboard => "auto_lookup_clipboard", + ConfigKey::MonitorClipboard => "monitor_clipboard", + ConfigKey::AutoLookupSelection => "auto_lookup_selection", + ConfigKey::HotkeyLetter => "hotkey_letter", + ConfigKey::HotkeyModifier => "hotkey_modifier", + ConfigKey::UsePopoverForLookup => "use_popover_for_lookup", + ConfigKey::LastMainProfileId => "last_main_profile_id", + + // 视图设置 + ConfigKey::AppearanceMode => "appearance_mode", + ConfigKey::FontFace => "font_face", + ConfigKey::FontColor => "font_color", + ConfigKey::BackgroundColor => "background_color", + ConfigKey::AutoResizeImage => "auto_resize_image", + } + } + + /// 从字符串创建配置键 + pub fn from_str(s: &str) -> Option { + match s { + // 全局设置 + "app_owner" => Some(ConfigKey::AppOwner), + "audio_lib_path" => Some(ConfigKey::AudioLibPath), + "custom_font_path" => Some(ConfigKey::CustomFontPath), + "extra_lib_search_path" => Some(ConfigKey::ExtraLibSearchPath), + "gui_language" => Some(ConfigKey::GuiLanguage), + "auto_lookup_clipboard" => Some(ConfigKey::AutoLookupClipboard), + "monitor_clipboard" => Some(ConfigKey::MonitorClipboard), + "auto_lookup_selection" => Some(ConfigKey::AutoLookupSelection), + "hotkey_letter" => Some(ConfigKey::HotkeyLetter), + "hotkey_modifier" => Some(ConfigKey::HotkeyModifier), + "use_popover_for_lookup" => Some(ConfigKey::UsePopoverForLookup), + "last_main_profile_id" => Some(ConfigKey::LastMainProfileId), + + // 视图设置 + "appearance_mode" => Some(ConfigKey::AppearanceMode), + "font_face" => Some(ConfigKey::FontFace), + "font_color" => Some(ConfigKey::FontColor), + "background_color" => Some(ConfigKey::BackgroundColor), + "auto_resize_image" => Some(ConfigKey::AutoResizeImage), + + _ => None, + } + } +} + +/// 配置段落枚举,用于明确指定配置所属的段落 +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum ConfigSection { + Global, + View, +} + +/// 应用配置结构体 +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct AppConfig { + /// 全局设置(JSON对象) + pub global_settings: Value, + /// 视图设置(JSON对象) + pub view_settings: Value, + /// 配置文件路径(不序列化) + #[serde(skip)] + pub config_path: Option, +} + +impl Default for AppConfig { + fn default() -> Self { + // 注意:为了简化配置管理,已移除了 GlobalSettings 和 ViewSettings 结构体 + // 现在直接使用 JSON 字符串定义默认配置,更加简洁和灵活 + // 使用JSON字符串定义默认的全局设置 + let global_settings_json = r#"{ + "config_version": "1.0", + "app_owner": "", + "audio_lib_path": "", + "gui_language": "", + "auto_sip": true, + "auto_lookup_clipboard": true, + "monitor_clipboard": true, + "auto_lookup_selection": false, + "hotkey_letter": "", + "hotkey_modifier": "", + "use_popover_for_lookup": true, + "use_tts": true, + "tts_engine_id": "", + "extra_lib_search_path": "" + }"#; + + // 使用JSON字符串定义默认的视图设置 + let view_settings_json = r#"{ + "font_size": "", + "appearance_mode": "Auto", + "font_face": "", + "font_color": "", + "background_color": "", + "auto_resize_image": false, + "background_image": "", + "custom_font_path": "", + }"#; + + let global_settings = serde_json::from_str(global_settings_json) + .unwrap_or(Value::Object(serde_json::Map::new())); + let view_settings = serde_json::from_str(view_settings_json) + .unwrap_or(Value::Object(serde_json::Map::new())); + + Self { + global_settings, + view_settings, + config_path: None, + } + } +} + +impl AppConfig { + /// 创建新的配置实例,从文件加载或使用默认配置 + pub fn new>(config_path: P) -> Result { + let config_path = config_path.as_ref().to_path_buf(); + + // 尝试从文件加载配置,如果文件不存在则使用默认配置 + let mut config = if config_path.exists() { + Self::from_file(&config_path)? + } else { + // 使用默认配置并保存到文件 + let default_config = Self::default(); + default_config.to_file(&config_path)?; + default_config + }; + + // 设置配置文件路径 + config.config_path = Some(config_path); + Ok(config) + } + + /// 从文件加载配置 + pub fn from_file>(path: P) -> Result { + let path_buf = path.as_ref().to_path_buf(); + let content = std::fs::read_to_string(&path_buf)?; + + let mut config: AppConfig = serde_json::from_str(&content)?; + + // 设置配置文件路径 + config.config_path = Some(path_buf); + + Ok(config) + } + + /// 保存配置到文件 + pub fn to_file>(&self, path: P) -> Result<()> { + let content = serde_json::to_string_pretty(self)?; + + std::fs::write(path, content)?; + + Ok(()) + } + + /// 保存当前配置到其配置文件路径 + pub fn save(&self) -> Result<()> { + if let Some(config_path) = &self.config_path { + self.to_file(config_path) + } else { + Err(ZdbError::invalid_parameter("配置文件路径未设置".to_string())) + } + } + + /// 重新加载配置文件 + pub fn reload(&mut self) -> Result<()> { + if let Some(config_path) = &self.config_path { + let new_config = Self::from_file(config_path)?; + self.global_settings = new_config.global_settings; + self.view_settings = new_config.view_settings; + Ok(()) + } else { + Err(ZdbError::invalid_parameter("配置文件路径未设置".to_string())) + } + } + + /// 通用配置获取方法 + pub fn get_config(&self, section: ConfigSection, config_key: ConfigKey) -> Result + where + T: serde::de::DeserializeOwned, + { + let settings = match section { + ConfigSection::Global => &self.global_settings, + ConfigSection::View => &self.view_settings, + }; + + let key_str = config_key.as_str(); + if let Some(value) = settings.get(key_str) { + Ok(serde_json::from_value(value.clone())?) + } else { + Err(ZdbError::invalid_parameter(format!("配置项 {}.{} 不存在", + match section { ConfigSection::Global => "global", ConfigSection::View => "view" }, + key_str))) + } + } + + /// 通用配置获取方法(带默认值) + pub fn get_config_with_default(&self, section: ConfigSection, config_key: ConfigKey, default: T) -> T + where + T: serde::de::DeserializeOwned + Default, + { + self.get_config(section, config_key).unwrap_or(default) + } + + /// 通用配置设置方法 + pub fn set_config(&mut self, section: ConfigSection, config_key: ConfigKey, value: T) -> Result<()> + where + T: serde::Serialize, + { + let key_str = config_key.as_str(); + let json_value = serde_json::to_value(value)?; + + let settings = match section { + ConfigSection::Global => &mut self.global_settings, + ConfigSection::View => &mut self.view_settings, + }; + + if let Some(obj) = settings.as_object_mut() { + obj.insert(key_str.to_string(), json_value); + Ok(()) + } else { + Err(ZdbError::invalid_parameter(format!("配置分组 {:?} 不是有效的对象", section))) + } + } + +} + + +#[cfg(test)] +mod tests { + use super::*; + use std::env; + + #[test] + fn test_default_config() { + let config = AppConfig::default(); + let appearance_mode: AppearanceMode = config.get_config(ConfigSection::View, ConfigKey::AppearanceMode).unwrap(); + + assert_eq!(appearance_mode, AppearanceMode::Auto); + } + + #[test] + fn test_config_serialization() { + let config = AppConfig::default(); + let json = serde_json::to_string(&config).unwrap(); + let deserialized: AppConfig = serde_json::from_str(&json).unwrap(); + + let original_clipboard: bool = config.get_config(ConfigSection::Global, ConfigKey::MonitorClipboard).unwrap(); + let deserialized_clipboard: bool = deserialized.get_config(ConfigSection::Global, ConfigKey::MonitorClipboard).unwrap(); + + assert_eq!(original_clipboard, deserialized_clipboard); + } + + #[test] + fn test_config_new_and_save() { + let temp_dir = env::temp_dir(); + let config_path = temp_dir.join("test_app_config.json"); + + // 清理之前的测试文件 + if config_path.exists() { + std::fs::remove_file(&config_path).unwrap(); + } + + // 创建新配置 + let mut config = AppConfig::new(&config_path).unwrap(); + + // 测试获取配置 + let lib_path: String = config.get_config(ConfigSection::Global, ConfigKey::ExtraLibSearchPath).unwrap(); + assert_eq!(lib_path, ""); + + // 测试更新配置 + config.set_config(ConfigSection::Global, ConfigKey::ExtraLibSearchPath, "/test/path".to_string()).unwrap(); + config.set_config(ConfigSection::Global, ConfigKey::MonitorClipboard, false).unwrap(); + config.save().unwrap(); + + // 验证文件存在 + assert!(config_path.exists()); + + // 从文件重新加载验证保存 + let loaded_config = AppConfig::from_file(&config_path).unwrap(); + let loaded_lib_path: String = loaded_config.get_config(ConfigSection::Global, ConfigKey::ExtraLibSearchPath).unwrap(); + let loaded_clipboard: bool = loaded_config.get_config(ConfigSection::Global, ConfigKey::MonitorClipboard).unwrap(); + assert_eq!(loaded_lib_path, "/test/path"); + assert_eq!(loaded_clipboard, false); + + // 清理测试文件 + std::fs::remove_file(&config_path).unwrap(); + } + + + #[test] + fn test_generic_config_methods() { + let mut config = AppConfig::default(); + + // 测试get_config + let monitor_clipboard: bool = config.get_config(ConfigSection::Global, ConfigKey::MonitorClipboard).unwrap(); + assert_eq!(monitor_clipboard, true); + + // 测试set_config + config.set_config(ConfigSection::Global, ConfigKey::MonitorClipboard, false).unwrap(); + let updated_clipboard: bool = config.get_config(ConfigSection::Global, ConfigKey::MonitorClipboard).unwrap(); + assert_eq!(updated_clipboard, false); + + // 测试get_config_with_default + let default_lib_path: String = config.get_config_with_default(ConfigSection::Global, ConfigKey::ExtraLibSearchPath, "default_path".to_string()); + assert_eq!(default_lib_path, ""); + + // 测试设置和获取字符串配置 + config.set_config(ConfigSection::Global, ConfigKey::GuiLanguage, "zh-CN".to_string()).unwrap(); + let language: String = config.get_config(ConfigSection::Global, ConfigKey::GuiLanguage).unwrap(); + assert_eq!(language, "zh-CN"); + + // 测试设置和获取枚举配置 + config.set_config(ConfigSection::View, ConfigKey::AppearanceMode, AppearanceMode::Auto).unwrap(); + let appearance_mode: AppearanceMode = config.get_config(ConfigSection::View, ConfigKey::AppearanceMode).unwrap(); + assert_eq!(appearance_mode, AppearanceMode::Auto); + + // 测试通用配置方法:恢复剪贴板设置并验证 + config.set_config(ConfigSection::Global, ConfigKey::MonitorClipboard, true).unwrap(); + let clipboard_enabled: bool = config.get_config_with_default(ConfigSection::Global, ConfigKey::MonitorClipboard, false); + assert!(clipboard_enabled); + } +} \ No newline at end of file diff --git a/rust/src-tauri/src/config_cmd.rs b/rust/src-tauri/src/config_cmd.rs new file mode 100644 index 0000000000000000000000000000000000000000..aadc8efa11c30154e206b410959b8bbe8a9955b9 --- /dev/null +++ b/rust/src-tauri/src/config_cmd.rs @@ -0,0 +1,127 @@ +// Config commands module - Tauri command implementations for configuration management +use serde_json::Value; +use tauri::command; + +use crate::app_config::{AppConfig, ConfigSection, ConfigKey}; +use crate::error::IntoStringResult; +use crate::mdict_app::{with_config_read, with_config_write}; + +/// Get app configuration +#[command] +pub async fn config_get_app_config() -> std::result::Result { + with_config_read(|config| Ok(config.clone())).into_string_result() +} + +// ============ Generic Config Commands ============ + +/// Generic get config value +/// +/// # Arguments +/// * `section` - "global" or "view" +/// * `key` - config key string +#[command] +pub async fn config_get_value(section: String, key: String) -> std::result::Result { + with_config_read(|config| { + let config_section = match section.as_str() { + "global" => ConfigSection::Global, + "view" => ConfigSection::View, + _ => return Err(crate::error::ZdbError::invalid_parameter(format!("Invalid section: {}", section))), + }; + + let config_key = ConfigKey::from_str(&key) + .ok_or_else(|| crate::error::ZdbError::invalid_parameter(format!("Invalid config key: {}", key)))?; + + config.get_config::(config_section, config_key) + }).into_string_result() +} + +/// Generic set config value +/// +/// # Arguments +/// * `section` - "global" or "view" +/// * `key` - config key string +/// * `value` - JSON value to set +#[command] +pub async fn config_set_value(section: String, key: String, value: Value) -> std::result::Result<(), String> { + with_config_write(|config| { + let config_section = match section.as_str() { + "global" => ConfigSection::Global, + "view" => ConfigSection::View, + _ => return Err(crate::error::ZdbError::invalid_parameter(format!("Invalid section: {}", section))), + }; + + let config_key = ConfigKey::from_str(&key) + .ok_or_else(|| crate::error::ZdbError::invalid_parameter(format!("Invalid config key: {}", key)))?; + + config.set_config(config_section, config_key, value)?; + config.save() + }).into_string_result() +} + +/// Get all global settings +#[command] +pub async fn config_get_global_settings() -> std::result::Result { + with_config_read(|config| Ok(config.global_settings.clone())).into_string_result() +} + +/// Get all view settings +#[command] +pub async fn config_get_view_settings() -> std::result::Result { + with_config_read(|config| Ok(config.view_settings.clone())).into_string_result() +} + +/// Update multiple view settings at once +#[command] +pub async fn config_update_view_settings(settings: Value) -> std::result::Result<(), String> { + with_config_write(|config| { + config.view_settings = settings; + config.save() + }).into_string_result() +} + +// ============ Utility Commands ============ + +/// List font files in a directory +#[command] +pub async fn config_list_fonts_in_directory(path: String) -> std::result::Result, String> { + use std::fs; + + let mut fonts = Vec::new(); + + if let Ok(entries) = fs::read_dir(&path) { + for entry in entries.flatten() { + if let Some(file_name) = entry.file_name().to_str() { + let lower = file_name.to_lowercase(); + if lower.ends_with(".ttf") || lower.ends_with(".otf") || lower.ends_with(".ttc") { + // Remove extension and add to list + if let Some(name) = file_name.rsplitn(2, '.').nth(1) { + fonts.push(name.to_string()); + } + } + } + } + } + + fonts.sort(); + Ok(fonts) +} + +/// Save app configuration to disk +#[command] +pub async fn config_save_app_config() -> std::result::Result<(), String> { + with_config_read(|config| config.save()).into_string_result() +} + +/// Reload app configuration from disk +#[command] +pub async fn config_reload_app_config() -> std::result::Result<(), String> { + with_config_write(|config| config.reload()).into_string_result() +} + +/// Reload resources +#[command] +pub async fn config_reload_resources() -> std::result::Result<(), String> { + crate::mdict_app::with_write_access(|app| app.reload_resources()).into_string_result() +} + + diff --git a/rust/src-tauri/src/conversion_cmd.rs b/rust/src-tauri/src/conversion_cmd.rs new file mode 100644 index 0000000000000000000000000000000000000000..ae95f9f835dd138a0a778c64c430419fbc45bcf7 --- /dev/null +++ b/rust/src-tauri/src/conversion_cmd.rs @@ -0,0 +1,369 @@ +// Conversion commands module - Tauri command implementations for MDX/MDD conversion and indexing +use std::sync::{Arc, Mutex}; +use std::sync::atomic::{AtomicBool, Ordering}; +use log::*; +use once_cell::sync::Lazy; +use serde::{Deserialize, Serialize}; +use tauri::{command, AppHandle, Emitter}; +use url::Url; + +use mdx::builder::{ZDBBuilder, BuilderConfig, SourceType, make_index}; +use mdx::utils::ProgressState; + +use crate::error::{ZdbError, IntoStringResult}; +use crate::error_printer::format_error; +use crate::mdict_app::with_read_access; +use crate::mdx_profile::ProfileId; + +/// Progress information for conversion/indexing +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ConversionProgress { + pub stage: String, // "mdx", "mdd", or "idx" + pub sub_stage: String, // Sub-stage name from ProgressState.state_id + pub current: u64, + pub total: u64, + pub message: Option, +} + +/// Global state for progress reporting and cancellation +struct GlobalConversionState { + app_handle: Option, + current_stage: String, + cancelled: AtomicBool, +} + +impl GlobalConversionState { + fn new() -> Self { + Self { + app_handle: None, + current_stage: String::new(), + cancelled: AtomicBool::new(false), + } + } + + fn set_app_handle(&mut self, handle: AppHandle) { + self.app_handle = Some(handle); + } + + fn set_stage(&mut self, stage: String) { + self.current_stage = stage; + } + + fn is_cancelled(&self) -> bool { + self.cancelled.load(Ordering::Relaxed) + } + + fn cancel(&self) { + self.cancelled.store(true, Ordering::Relaxed); + } + + fn reset(&mut self) { + self.cancelled.store(false, Ordering::Relaxed); + self.current_stage.clear(); + } + + fn report_progress(&self, sub_stage: &str, current: u64, total: u64, message: Option) { + if let Some(ref handle) = self.app_handle { + let progress = ConversionProgress { + stage: self.current_stage.clone(), + sub_stage: sub_stage.to_string(), + current, + total, + message, + }; + let _ = handle.emit("conversion-progress", &progress); + info!("Progress [{}:{}]: {}/{}", self.current_stage, sub_stage, current, total); + } + } +} + +static CONVERSION_STATE: Lazy>> = + Lazy::new(|| Arc::new(Mutex::new(GlobalConversionState::new()))); + +/// Progress reporter function that uses global state +/// Returns true to cancel the operation, false to continue +fn progress_reporter(state: &mut ProgressState) -> bool { + let global_state = CONVERSION_STATE.lock().unwrap(); + + // Check if cancelled + if global_state.is_cancelled() { + state.error_msg = "Conversion cancelled by user".to_string(); + return true; // true means stop the operation + } + + // Report progress with state_id as sub_stage + global_state.report_progress(&state.state_id, state.current, state.total, None); + + false // false means continue +} + + +/// Result of database conversion +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ConversionResult { + pub new_mdx_path: String, + pub new_mdd_path: Option, +} + +/// Convert MDX or MDD file to new format +#[command] +pub async fn library_convert_db( + app_handle: AppHandle, + profile_id: ProfileId, + collation_locale: String, + remove_old_files: bool, +) -> std::result::Result { + info!("Starting file conversion for profile: {}", profile_id); + + // Initialize global state + { + let mut state = CONVERSION_STATE.lock().unwrap(); + state.reset(); + state.set_app_handle(app_handle.clone()); + } + + // Get profile information + let profile = with_read_access(|app| { + app.library_manager.find_profile(profile_id) + .ok_or_else(|| ZdbError::invalid_parameter(format!("Profile {} not found", profile_id))) + .map(|p| p.clone()) + }).into_string_result()?; + + if profile.is_group() { + return Err("Cannot convert a group".to_string()); + } + + // Parse URL to get file path + let url = Url::parse(&profile.url) + .map_err(|e| format!("Invalid profile URL: {}", e))?; + + let mdx_path = url.to_file_path() + .map_err(|_| format!("Cannot convert URL to file path: {}", profile.url))?; + + if !mdx_path.exists() { + return Err(format!("MDX file not found: {:?}", mdx_path)); + } + + // Generate output paths + let mut new_mdx_path = mdx_path.clone(); + let new_filename = format!( + "{}.new.mdx", + mdx_path.file_stem().and_then(|s| s.to_str()).unwrap_or("dict") + ); + new_mdx_path.set_file_name(new_filename); + + // Check for MDD file + let mdd_path = mdx_path.with_extension("mdd"); + let has_mdd = mdd_path.exists(); + let mut new_mdd_path = mdd_path.clone(); + if has_mdd { + let mdd_filename = format!( + "{}.new.mdd", + mdd_path.file_stem().and_then(|s| s.to_str()).unwrap_or("dict") + ); + new_mdd_path.set_file_name(mdd_filename); + } + + // Spawn blocking task for conversion + let collation_locale_clone = collation_locale.clone(); + let result = tauri::async_runtime::spawn_blocking(move || { + // Step 1: Convert MDX file + { + let mut state = CONVERSION_STATE.lock().unwrap(); + state.set_stage("mdx".to_string()); + } + + info!("Converting MDX file: {:?}", mdx_path); + let mut config = BuilderConfig::default(); + config.input_path = mdx_path.to_string_lossy().to_string(); + config.output_file = new_mdx_path.to_string_lossy().to_string(); + config.data_source_format = SourceType::Zdb; + config.default_sorting_locale = collation_locale_clone.clone(); + config.build_mdd = false; + + if let Err(e) = ZDBBuilder::build_with_config(&config, Some(progress_reporter)) { + let _ = std::fs::remove_file(&new_mdx_path); + return Err(format!("MDX conversion failed: {}", e)); + } + + // Report MDX stage completion + { + let state = CONVERSION_STATE.lock().unwrap(); + state.report_progress("completed", 100, 100, Some("MDX conversion completed".to_string())); + } + + // Step 2: Convert MDD file if exists + if has_mdd { + // Check for cancellation + { + let state = CONVERSION_STATE.lock().unwrap(); + if state.is_cancelled() { + let _ = std::fs::remove_file(&new_mdx_path); + return Err("Conversion cancelled".to_string()); + } + + drop(state); + let mut state = CONVERSION_STATE.lock().unwrap(); + state.set_stage("mdd".to_string()); + } + + info!("Converting MDD file: {:?}", mdd_path); + let mut mdd_config = BuilderConfig::default(); + + mdd_config.input_path = mdd_path.to_string_lossy().to_string(); + mdd_config.output_file = new_mdd_path.to_string_lossy().to_string(); + mdd_config.data_source_format = SourceType::Zdb; + mdd_config.content_type = "Binary".to_string(); // MDD files typically contain resources + mdd_config.default_sorting_locale = "".to_string(); + mdd_config.build_mdd = true; + + if let Err(e) = ZDBBuilder::build_with_config(&mdd_config, Some(progress_reporter)) { + let _ = std::fs::remove_file(&new_mdx_path); + let _ = std::fs::remove_file(&new_mdd_path); + debug!("MDD conversion failed:\n{}", format_error(&e)); + return Err(format!("MDD conversion failed: {}", e)); + } + + // Report MDD stage completion + { + let state = CONVERSION_STATE.lock().unwrap(); + state.report_progress("completed", 100, 100, Some("MDD conversion completed".to_string())); + } + } else { + // No MDD file, report MDD stage as skipped/completed + { + let mut state = CONVERSION_STATE.lock().unwrap(); + state.set_stage("mdd".to_string()); + state.report_progress("skipped", 100, 100, Some("No MDD file".to_string())); + } + } + + // Step 3: Replace old files with new ones or keep both + let (final_mdx_path, final_mdd_path) = if remove_old_files { + info!("Replacing old files with new ones"); + + // Delete old MDX + if let Err(e) = std::fs::remove_file(&mdx_path) { + error!("Failed to delete old MDX file: {}", e); + let _ = std::fs::remove_file(&new_mdx_path); + if has_mdd { + let _ = std::fs::remove_file(&new_mdd_path); + } + return Err(format!("Failed to delete old MDX file: {}", e)); + } + + // Rename new MDX to original name + if let Err(e) = std::fs::rename(&new_mdx_path, &mdx_path) { + error!("Failed to rename new MDX file: {}", e); + return Err(format!("Failed to rename new MDX file: {}", e)); + } + + // Handle MDD file + let final_mdd = if has_mdd { + if let Err(e) = std::fs::remove_file(&mdd_path) { + error!("Failed to delete old MDD file: {}", e); + } + + if let Err(e) = std::fs::rename(&new_mdd_path, &mdd_path) { + error!("Failed to rename new MDD file: {}", e); + } + Some(mdd_path.to_string_lossy().to_string()) + } else { + None + }; + + (mdx_path.to_string_lossy().to_string(), final_mdd) + } else { + info!("Keeping both old and new files (old files not removed)"); + // New files remain with .new.mdx and .new.mdd extensions + let final_mdd = if has_mdd { + Some(new_mdd_path.to_string_lossy().to_string()) + } else { + None + }; + (new_mdx_path.to_string_lossy().to_string(), final_mdd) + }; + + info!("File conversion completed successfully"); + Ok(ConversionResult { + new_mdx_path: final_mdx_path, + new_mdd_path: final_mdd_path, + }) + }).await; + + match result { + Ok(inner_result) => inner_result, + Err(e) => Err(format!("Task execution failed: {}", e)), + } +} + +/// Generate fulltext index for MDX file +#[command] +pub async fn library_create_fts_index( + app_handle: AppHandle, + mdx_file_path: String, +) -> std::result::Result<(), String> { + info!("Starting FTS index creation for: {}", mdx_file_path); + + // Initialize stage + { + let mut state = CONVERSION_STATE.lock().unwrap(); + state.set_app_handle(app_handle.clone()); + state.set_stage("idx".to_string()); + } + + // Get MDX file path from parameter + let mdx_path = std::path::PathBuf::from(mdx_file_path); + + if !mdx_path.exists() { + return Err(format!("MDX file not found: {:?}", mdx_path)); + } + + // Spawn blocking task for index creation + let result = tauri::async_runtime::spawn_blocking(move || { + // Check for cancellation + { + let state = CONVERSION_STATE.lock().unwrap(); + if state.is_cancelled() { + return Err("Index creation cancelled".to_string()); + } + } + + info!("Creating FTS index for: {:?}", mdx_path); + + if let Err(e) = make_index(&mdx_path, Some(progress_reporter)) { + error!("Failed to create FTS index: {}", e); + // Delete FTS index files if they exist + let fts_dir = mdx_path.with_extension("mdx.idx"); + if fts_dir.exists() { + let _ = std::fs::remove_dir_all(fts_dir); + } + return Err(format!("FTS index generation failed: {}", e)); + } + + // Report completion + { + let state = CONVERSION_STATE.lock().unwrap(); + state.report_progress("completed", 100, 100, Some("Index created successfully".to_string())); + } + + info!("FTS index creation completed successfully"); + Ok(()) + }).await; + + match result { + Ok(inner_result) => inner_result, + Err(e) => Err(format!("Task execution failed: {}", e)), + } +} + +/// Cancel ongoing conversion/indexing +#[command] +pub async fn library_cancel_conversion() -> std::result::Result<(), String> { + let state = CONVERSION_STATE.lock().unwrap(); + state.cancel(); + info!("Cancellation requested"); + Ok(()) +} diff --git a/rust/src-tauri/src/error.rs b/rust/src-tauri/src/error.rs new file mode 100644 index 0000000000000000000000000000000000000000..f66d98fd0faf991b0ae9263ae4990d3ed1db1262 --- /dev/null +++ b/rust/src-tauri/src/error.rs @@ -0,0 +1,17 @@ +// Re-export ZdbError for convenience +pub use mdx::{ZdbError, Result}; + +// Type alias for backward compatibility +pub type MdictAppError = ZdbError; + +/// Helper trait for converting Result to Result +/// Used by Tauri commands to convert errors to strings +pub trait IntoStringResult { + fn into_string_result(self) -> std::result::Result; +} + +impl IntoStringResult for Result { + fn into_string_result(self) -> std::result::Result { + self.map_err(|e| crate::error_printer::format_error(&e)) + } +} \ No newline at end of file diff --git a/rust/src-tauri/src/error_printer.rs b/rust/src-tauri/src/error_printer.rs new file mode 100644 index 0000000000000000000000000000000000000000..7d125d5ff2dfc601af878cae9d70aa140482731c --- /dev/null +++ b/rust/src-tauri/src/error_printer.rs @@ -0,0 +1,37 @@ +use colored::Colorize; +pub fn format_error(error: &mdx::ZdbError) -> String{ + let mut output = String::new(); + output.push_str(&format!("Error: {}\n", error.to_string().red().bold())); + if let Some(backtrace) = mdx::snafu::ErrorCompat::backtrace(error){ + + // Add backtrace header in red, mimicking color-backtrace + output.push_str(&format!("{}:\n", "BACKTRACE")); + + // Convert backtrace to string and split into lines + let backtrace_str = format!("{}", backtrace); + for line in backtrace_str.lines() { + let line = line.trim(); + if line.is_empty() { + continue; + } + + if line.starts_with("at ") { + if let Some((_, file_info)) = line.split_once("at ") { + let file_info = file_info.trim().green(); + output.push_str(&format!(" at {}\n", file_info)); + } else { + output.push_str(&format!(" {}\n", line.white())); + } + }else{ + // Check if line starts with a frame number (e.g., "0:", "1:") + if let Some((frame_num, rest)) = line.split_once(':') { + output.push_str(&format!("{}: {}\n", frame_num.trim().yellow().bold(), rest.cyan())); + } else { + // Fallback for unexpected line formats + output.push_str(&format!("{}\n", line.white())); + } + } + } + } + output +} diff --git a/rust/src-tauri/src/favorites.rs b/rust/src-tauri/src/favorites.rs new file mode 100644 index 0000000000000000000000000000000000000000..e58892133386e667f2d2b6db254bcae8dfe19e40 --- /dev/null +++ b/rust/src-tauri/src/favorites.rs @@ -0,0 +1,384 @@ +// Favorites management module +// Provides data management for favorite entries with SQLite persistence + +use std::sync::{Arc, Mutex}; +use rusqlite::{Connection, params, Result as SqlResult}; +use serde::{Deserialize, Serialize}; + +use crate::error::{Result, ZdbError}; +use crate::mdx_profile::ProfileId; + +/// Favorite entry structure matching frontend FavoriteEntry +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct FavoriteEntry { + pub id: String, + pub keyword: String, + pub group_index: serde_json::Value, // LinkedList as JSON array + pub profile_id: ProfileId, + pub profile_name: String, + pub added_at: i64, // Unix timestamp in milliseconds +} + +/// Sort order for favorites +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum FavoriteSortBy { + Name, + Time, +} + +/// Favorites manager with SQLite persistence +/// Now uses a shared database connection from DataManager +pub struct FavoritesManager { + conn: Arc>, +} + +impl FavoritesManager { + /// Create a new FavoritesManager with a shared database connection + pub fn new(conn: Arc>) -> Result { + // Create table and indexes if not exists + { + let c = conn.lock() + .map_err(|_| ZdbError::invalid_parameter("Failed to lock database connection".to_string()))?; + + c.execute( + "CREATE TABLE IF NOT EXISTS favorites ( + id TEXT PRIMARY KEY, + keyword TEXT NOT NULL, + group_index TEXT NOT NULL, + profile_id INTEGER NOT NULL, + profile_name TEXT NOT NULL, + added_at INTEGER NOT NULL + )", + [], + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to create favorites table: {}", e)))?; + + c.execute( + "CREATE INDEX IF NOT EXISTS idx_favorites_added_at ON favorites(added_at DESC)", + [], + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to create favorites index on added_at: {}", e)))?; + + c.execute( + "CREATE INDEX IF NOT EXISTS idx_favorites_keyword ON favorites(keyword COLLATE NOCASE)", + [], + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to create favorites index on keyword: {}", e)))?; + + c.execute( + "CREATE INDEX IF NOT EXISTS idx_favorites_profile_id ON favorites(profile_id)", + [], + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to create favorites index on profile_id: {}", e)))?; + } + + Ok(Self { conn }) + } + + /// Add a favorite entry + pub fn add_favorite( + &mut self, + keyword: String, + group_index: serde_json::Value, + profile_id: ProfileId, + profile_name: String, + ) -> Result { + // Check if already exists + if self.is_favorited(&keyword, profile_id)? { + return Err(ZdbError::invalid_parameter(format!( + "Favorite already exists: {} (profile: {})", + keyword, profile_id + ))); + } + + let id = format!("{}-{}-{}", profile_id, keyword, chrono::Utc::now().timestamp_millis()); + let added_at = chrono::Utc::now().timestamp_millis(); + + let entry = FavoriteEntry { + id: id.clone(), + keyword: keyword.clone(), + group_index: group_index.clone(), + profile_id, + profile_name: profile_name.clone(), + added_at, + }; + + // Serialize group_index to JSON string for storage + let group_index_str = serde_json::to_string(&group_index) + .map_err(|e| ZdbError::invalid_data_format(format!("Failed to serialize group_index: {}", e)))?; + + let conn = self.conn.lock() + .map_err(|_| ZdbError::invalid_parameter("Failed to lock database connection".to_string()))?; + + conn.execute( + "INSERT INTO favorites (id, keyword, group_index, profile_id, profile_name, added_at) + VALUES (?1, ?2, ?3, ?4, ?5, ?6)", + params![id, keyword, group_index_str, profile_id, profile_name, added_at], + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to insert favorite entry: {}", e)))?; + + Ok(entry) + } + + /// Remove a favorite entry by ID + pub fn remove_favorite(&mut self, id: &str) -> Result { + let conn = self.conn.lock() + .map_err(|_| ZdbError::invalid_parameter("Failed to lock database connection".to_string()))?; + + let affected = conn.execute( + "DELETE FROM favorites WHERE id = ?1", + params![id], + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to delete favorite entry: {}", e)))?; + + Ok(affected > 0) + } + + /// Toggle favorite (add if not exists, remove if exists) - returns the favorite that was added/removed + pub fn toggle_favorite( + &mut self, + keyword: String, + group_index: serde_json::Value, + profile_id: ProfileId, + profile_name: String, + ) -> Result<(bool, Option)> { + // Check if exists + if let Some(existing) = self.find_favorite(&keyword, profile_id)? { + self.remove_favorite(&existing.id)?; + Ok((false, Some(existing))) + } else { + let entry = self.add_favorite(keyword, group_index, profile_id, profile_name)?; + Ok((true, Some(entry))) + } + } + + /// Check if favorited + pub fn is_favorited(&self, keyword: &str, profile_id: ProfileId) -> Result { + let conn = self.conn.lock() + .map_err(|_| ZdbError::invalid_parameter("Failed to lock database connection".to_string()))?; + + let count: i64 = conn.query_row( + "SELECT COUNT(*) FROM favorites WHERE keyword = ?1 AND profile_id = ?2", + params![keyword, profile_id], + |row| row.get(0), + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to check if favorited: {}", e)))?; + + Ok(count > 0) + } + + /// Find a favorite entry by keyword and profile_id + fn find_favorite(&self, keyword: &str, profile_id: ProfileId) -> Result> { + let conn = self.conn.lock() + .map_err(|_| ZdbError::invalid_parameter("Failed to lock database connection".to_string()))?; + + let mut stmt = conn.prepare( + "SELECT id, keyword, group_index, profile_id, profile_name, added_at + FROM favorites WHERE keyword = ?1 AND profile_id = ?2" + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to prepare query: {}", e)))?; + + let entry = stmt.query_row(params![keyword, profile_id], |row| { + let group_index_str: String = row.get(2)?; + let group_index = serde_json::from_str(&group_index_str) + .map_err(|e| rusqlite::Error::FromSqlConversionFailure( + 2, + rusqlite::types::Type::Text, + Box::new(e) + ))?; + + Ok(FavoriteEntry { + id: row.get(0)?, + keyword: row.get(1)?, + group_index, + profile_id: row.get(3)?, + profile_name: row.get(4)?, + added_at: row.get(5)?, + }) + }); + + match entry { + Ok(e) => Ok(Some(e)), + Err(rusqlite::Error::QueryReturnedNoRows) => Ok(None), + Err(e) => Err(ZdbError::invalid_data_format(format!("Failed to find favorite: {}", e))), + } + } + + /// Get sorted and filtered favorites + pub fn get_sorted_and_filtered_favorites( + &self, + sort_by: FavoriteSortBy, + filter_profile_id: Option, + ) -> Result> { + let conn = self.conn.lock() + .map_err(|_| ZdbError::invalid_parameter("Failed to lock database connection".to_string()))?; + + let (query, params): (String, Vec>) = match filter_profile_id { + Some(profile_id) => { + let sql = format!( + "SELECT id, keyword, group_index, profile_id, profile_name, added_at + FROM favorites WHERE profile_id = ?1 ORDER BY {}", + match sort_by { + FavoriteSortBy::Name => "keyword COLLATE NOCASE ASC", + FavoriteSortBy::Time => "added_at DESC", + } + ); + (sql, vec![Box::new(profile_id)]) + } + None => { + let sql = format!( + "SELECT id, keyword, group_index, profile_id, profile_name, added_at + FROM favorites ORDER BY {}", + match sort_by { + FavoriteSortBy::Name => "keyword COLLATE NOCASE ASC", + FavoriteSortBy::Time => "added_at DESC", + } + ); + (sql, vec![]) + } + }; + + let mut stmt = conn.prepare(&query) + .map_err(|e| ZdbError::invalid_data_format(format!("Failed to prepare query: {}", e)))?; + + let param_refs: Vec<&dyn rusqlite::ToSql> = params.iter().map(|p| p.as_ref()).collect(); + + let entries = stmt.query_map(param_refs.as_slice(), |row| { + let group_index_str: String = row.get(2)?; + let group_index = serde_json::from_str(&group_index_str) + .map_err(|e| rusqlite::Error::FromSqlConversionFailure( + 2, + rusqlite::types::Type::Text, + Box::new(e) + ))?; + + Ok(FavoriteEntry { + id: row.get(0)?, + keyword: row.get(1)?, + group_index, + profile_id: row.get(3)?, + profile_name: row.get(4)?, + added_at: row.get(5)?, + }) + }).map_err(|e| ZdbError::invalid_data_format(format!("Failed to query favorites: {}", e)))? + .collect::>>() + .map_err(|e| ZdbError::invalid_data_format(format!("Failed to collect favorites: {}", e)))?; + + Ok(entries) + } + + /// Get all favorites (no sorting or filtering) + pub fn get_all_favorites(&self) -> Result> { + self.get_sorted_and_filtered_favorites(FavoriteSortBy::Time, None) + } + + /// Clear all favorites + pub fn clear_all_favorites(&mut self) -> Result<()> { + let conn = self.conn.lock() + .map_err(|_| ZdbError::invalid_parameter("Failed to lock database connection".to_string()))?; + + conn.execute("DELETE FROM favorites", []) + .map_err(|e| ZdbError::invalid_data_format(format!("Failed to clear favorites: {}", e)))?; + Ok(()) + } + + /// Import favorites (for backup/restore) + pub fn import_favorites(&mut self, entries: Vec) -> Result<()> { + // Clear existing favorites first + self.clear_all_favorites()?; + + let conn = self.conn.lock() + .map_err(|_| ZdbError::invalid_parameter("Failed to lock database connection".to_string()))?; + + // Insert all entries + for entry in entries { + let group_index_str = serde_json::to_string(&entry.group_index) + .map_err(|e| ZdbError::invalid_data_format(format!("Failed to serialize group_index: {}", e)))?; + + conn.execute( + "INSERT INTO favorites (id, keyword, group_index, profile_id, profile_name, added_at) + VALUES (?1, ?2, ?3, ?4, ?5, ?6)", + params![ + entry.id, + entry.keyword, + group_index_str, + entry.profile_id, + entry.profile_name, + entry.added_at + ], + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to import favorite entry: {}", e)))?; + } + + Ok(()) + } + + /// Get favorites count + pub fn get_favorites_count(&self) -> Result { + let conn = self.conn.lock() + .map_err(|_| ZdbError::invalid_parameter("Failed to lock database connection".to_string()))?; + + let count: i64 = conn.query_row( + "SELECT COUNT(*) FROM favorites", + [], + |row| row.get(0), + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to get favorites count: {}", e)))?; + + Ok(count as usize) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_favorites_manager() { + use std::sync::{Arc, Mutex}; + let conn = Arc::new(Mutex::new(rusqlite::Connection::open(":memory:").unwrap())); + + // Create favorites table for testing + { + let c = conn.lock().unwrap(); + c.execute( + "CREATE TABLE IF NOT EXISTS favorites ( + id TEXT PRIMARY KEY, + keyword TEXT NOT NULL, + group_index TEXT NOT NULL, + profile_id INTEGER NOT NULL, + profile_name TEXT NOT NULL, + added_at INTEGER NOT NULL + )", + [], + ).unwrap(); + } + + let mut manager = FavoritesManager::new(conn).unwrap(); + + let group_index = serde_json::json!([{ + "profile_id": 1, + "primary_key": "test", + "indexes": [] + }]); + + // Test add + let entry = manager.add_favorite( + "test".to_string(), + group_index.clone(), + 1, + "Test Profile".to_string(), + ).unwrap(); + + assert_eq!(entry.keyword, "test"); + + // Test is_favorited + assert!(manager.is_favorited("test", 1).unwrap()); + + // Test toggle (should remove) + let (added, _) = manager.toggle_favorite( + "test".to_string(), + group_index.clone(), + 1, + "Test Profile".to_string(), + ).unwrap(); + assert!(!added); + + // Test count after toggle + let count = manager.get_favorites_count().unwrap(); + assert_eq!(count, 0); + } +} + diff --git a/rust/src-tauri/src/favorites_cmd.rs b/rust/src-tauri/src/favorites_cmd.rs new file mode 100644 index 0000000000000000000000000000000000000000..0dad66e66e8949ba09474f37c548c550fb366702 --- /dev/null +++ b/rust/src-tauri/src/favorites_cmd.rs @@ -0,0 +1,100 @@ +// Favorites commands module - Tauri command implementations for favorites management +use tauri::command; + +use crate::error::IntoStringResult; +use crate::favorites::{FavoriteEntry, FavoriteSortBy}; +use crate::mdict_app::{with_favorites_read, with_favorites_write}; + +/// Add a favorite entry +#[command] +pub async fn favorites_add_favorite( + keyword: String, + group_index: serde_json::Value, + profile_id: i32, + profile_name: String, +) -> std::result::Result { + with_favorites_write(|manager| { + manager.add_favorite(keyword, group_index, profile_id, profile_name) + }).into_string_result() +} + +/// Remove a favorite entry by ID +#[command] +pub async fn favorites_remove_favorite( + id: String, +) -> std::result::Result { + with_favorites_write(|manager| { + manager.remove_favorite(&id) + }).into_string_result() +} + +/// Toggle favorite (add if not exists, remove if exists) +#[command] +pub async fn favorites_toggle_favorite( + keyword: String, + group_index: serde_json::Value, + profile_id: i32, + profile_name: String, +) -> std::result::Result { + with_favorites_write(|manager| { + let (added, _) = manager.toggle_favorite(keyword, group_index, profile_id, profile_name)?; + Ok(added) + }).into_string_result() +} + +/// Check if favorited +#[command] +pub async fn favorites_is_favorited( + keyword: String, + profile_id: i32, +) -> std::result::Result { + with_favorites_read(|manager| { + manager.is_favorited(&keyword, profile_id) + }).into_string_result() +} + +/// Get sorted and filtered favorites +#[command] +pub async fn favorites_get_sorted_and_filtered_favorites( + sort_by: FavoriteSortBy, + filter_profile_id: Option, +) -> std::result::Result, String> { + with_favorites_read(|manager| { + manager.get_sorted_and_filtered_favorites(sort_by, filter_profile_id) + }).into_string_result() +} + +/// Get all favorites +#[command] +pub async fn favorites_get_all_favorites() -> std::result::Result, String> { + with_favorites_read(|manager| { + manager.get_all_favorites() + }).into_string_result() +} + +/// Clear all favorites +#[command] +pub async fn favorites_clear_all_favorites() -> std::result::Result<(), String> { + with_favorites_write(|manager| { + manager.clear_all_favorites() + }).into_string_result() +} + +/// Import favorites (for backup/restore) +#[command] +pub async fn favorites_import_favorites( + entries: Vec, +) -> std::result::Result<(), String> { + with_favorites_write(|manager| { + manager.import_favorites(entries) + }).into_string_result() +} + +/// Get favorites count +#[command] +pub async fn favorites_get_favorites_count() -> std::result::Result { + with_favorites_read(|manager| { + manager.get_favorites_count() + }).into_string_result() +} + diff --git a/rust/src-tauri/src/history.rs b/rust/src-tauri/src/history.rs new file mode 100644 index 0000000000000000000000000000000000000000..e6861619f8cd10ec9a163275ed6f90df13d64276 --- /dev/null +++ b/rust/src-tauri/src/history.rs @@ -0,0 +1,328 @@ +// History management module +// Provides data management for history entries with SQLite persistence + +use std::sync::{Arc, Mutex}; +use rusqlite::{Connection, params, Result as SqlResult}; +use serde::{Deserialize, Serialize}; + +use crate::error::{Result, ZdbError}; +use crate::mdx_profile::ProfileId; + +/// History entry structure matching frontend HistoryEntry +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct HistoryEntry { + pub id: String, + pub keyword: String, + pub group_index: serde_json::Value, // LinkedList as JSON array + pub profile_id: ProfileId, + pub profile_name: String, + pub visited_at: i64, // Unix timestamp in milliseconds +} + +/// History manager with SQLite persistence +/// Now uses a shared database connection from DataManager +pub struct HistoryManager { + conn: Arc>, + max_history_size: usize, +} + +impl HistoryManager { + /// Create a new HistoryManager with a shared database connection + pub fn new(conn: Arc>) -> Result { + // Create table and indexes if not exists + { + let c = conn.lock() + .map_err(|_| ZdbError::invalid_parameter("Failed to lock database connection".to_string()))?; + + c.execute( + "CREATE TABLE IF NOT EXISTS history ( + id TEXT PRIMARY KEY, + keyword TEXT NOT NULL, + group_index TEXT NOT NULL, + profile_id INTEGER NOT NULL, + profile_name TEXT NOT NULL, + visited_at INTEGER NOT NULL + )", + [], + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to create history table: {}", e)))?; + + c.execute( + "CREATE INDEX IF NOT EXISTS idx_history_visited_at ON history(visited_at DESC)", + [], + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to create history index: {}", e)))?; + } + + Ok(Self { + conn, + max_history_size: 1000, + }) + } + + /// Add a history entry + pub fn add_to_history( + &mut self, + keyword: String, + group_index: serde_json::Value, + profile_id: ProfileId, + profile_name: String, + ) -> Result { + let id = format!("{}-{}-{}", profile_id, keyword, chrono::Utc::now().timestamp_millis()); + let visited_at = chrono::Utc::now().timestamp_millis(); + + let entry = HistoryEntry { + id: id.clone(), + keyword: keyword.clone(), + group_index: group_index.clone(), + profile_id, + profile_name: profile_name.clone(), + visited_at, + }; + + // Serialize group_index to JSON string for storage + let group_index_str = serde_json::to_string(&group_index) + .map_err(|e| ZdbError::invalid_data_format(format!("Failed to serialize group_index: {}", e)))?; + + let conn = self.conn.lock() + .map_err(|_| ZdbError::invalid_parameter("Failed to lock database connection".to_string()))?; + + conn.execute( + "INSERT INTO history (id, keyword, group_index, profile_id, profile_name, visited_at) + VALUES (?1, ?2, ?3, ?4, ?5, ?6)", + params![id, keyword, group_index_str, profile_id, profile_name, visited_at], + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to insert history entry: {}", e)))?; + + // Release lock before trimming + drop(conn); + + // Trim history if exceeds max size + self.trim_history()?; + + Ok(entry) + } + + /// Get all history entries, ordered by visited_at descending + pub fn get_all_history(&self) -> Result> { + let conn = self.conn.lock() + .map_err(|_| ZdbError::invalid_parameter("Failed to lock database connection".to_string()))?; + + let mut stmt = conn.prepare( + "SELECT id, keyword, group_index, profile_id, profile_name, visited_at + FROM history ORDER BY visited_at DESC" + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to prepare query: {}", e)))?; + + let entries = stmt.query_map([], |row| { + let group_index_str: String = row.get(2)?; + let group_index = serde_json::from_str(&group_index_str) + .map_err(|e| rusqlite::Error::FromSqlConversionFailure( + 2, + rusqlite::types::Type::Text, + Box::new(e) + ))?; + + Ok(HistoryEntry { + id: row.get(0)?, + keyword: row.get(1)?, + group_index, + profile_id: row.get(3)?, + profile_name: row.get(4)?, + visited_at: row.get(5)?, + }) + }).map_err(|e| ZdbError::invalid_data_format(format!("Failed to query history: {}", e)))? + .collect::>>() + .map_err(|e| ZdbError::invalid_data_format(format!("Failed to collect history entries: {}", e)))?; + + Ok(entries) + } + + /// Get history entry by ID + pub fn get_entry_by_id(&self, id: &str) -> Result> { + let conn = self.conn.lock() + .map_err(|_| ZdbError::invalid_parameter("Failed to lock database connection".to_string()))?; + + let mut stmt = conn.prepare( + "SELECT id, keyword, group_index, profile_id, profile_name, visited_at + FROM history WHERE id = ?1" + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to prepare query: {}", e)))?; + + let entry = stmt.query_row([id], |row| { + let group_index_str: String = row.get(2)?; + let group_index = serde_json::from_str(&group_index_str) + .map_err(|e| rusqlite::Error::FromSqlConversionFailure( + 2, + rusqlite::types::Type::Text, + Box::new(e) + ))?; + + Ok(HistoryEntry { + id: row.get(0)?, + keyword: row.get(1)?, + group_index, + profile_id: row.get(3)?, + profile_name: row.get(4)?, + visited_at: row.get(5)?, + }) + }); + + match entry { + Ok(e) => Ok(Some(e)), + Err(rusqlite::Error::QueryReturnedNoRows) => Ok(None), + Err(e) => Err(ZdbError::invalid_data_format(format!("Failed to get history entry: {}", e))), + } + } + + /// Remove a history entry by ID + pub fn remove_from_history(&mut self, id: &str) -> Result { + let conn = self.conn.lock() + .map_err(|_| ZdbError::invalid_parameter("Failed to lock database connection".to_string()))?; + + let affected = conn.execute( + "DELETE FROM history WHERE id = ?1", + params![id], + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to delete history entry: {}", e)))?; + + Ok(affected > 0) + } + + /// Clear all history + pub fn clear_history(&mut self) -> Result<()> { + let conn = self.conn.lock() + .map_err(|_| ZdbError::invalid_parameter("Failed to lock database connection".to_string()))?; + + conn.execute("DELETE FROM history", []) + .map_err(|e| ZdbError::invalid_data_format(format!("Failed to clear history: {}", e)))?; + Ok(()) + } + + /// Get history count + pub fn get_history_count(&self) -> Result { + let conn = self.conn.lock() + .map_err(|_| ZdbError::invalid_parameter("Failed to lock database connection".to_string()))?; + + let count: i64 = conn.query_row( + "SELECT COUNT(*) FROM history", + [], + |row| row.get(0), + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to get history count: {}", e)))?; + + Ok(count as usize) + } + + /// Set maximum history size + pub fn set_max_history_size(&mut self, size: usize) -> Result<()> { + self.max_history_size = size; + self.trim_history() + } + + /// Get maximum history size + pub fn get_max_history_size(&self) -> usize { + self.max_history_size + } + + /// Trim history to max size (keep most recent entries) + fn trim_history(&mut self) -> Result<()> { + let count = self.get_history_count()?; + if count > self.max_history_size { + let remove_count = count - self.max_history_size; + + let conn = self.conn.lock() + .map_err(|_| ZdbError::invalid_parameter("Failed to lock database connection".to_string()))?; + + conn.execute( + "DELETE FROM history WHERE id IN ( + SELECT id FROM history ORDER BY visited_at ASC LIMIT ?1 + )", + params![remove_count], + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to trim history: {}", e)))?; + } + Ok(()) + } + + /// Import history entries (for backup/restore) + pub fn import_history(&mut self, entries: Vec) -> Result<()> { + // Clear existing history first + self.clear_history()?; + + let conn = self.conn.lock() + .map_err(|_| ZdbError::invalid_parameter("Failed to lock database connection".to_string()))?; + + // Insert all entries + for entry in entries { + let group_index_str = serde_json::to_string(&entry.group_index) + .map_err(|e| ZdbError::invalid_data_format(format!("Failed to serialize group_index: {}", e)))?; + + conn.execute( + "INSERT INTO history (id, keyword, group_index, profile_id, profile_name, visited_at) + VALUES (?1, ?2, ?3, ?4, ?5, ?6)", + params![ + entry.id, + entry.keyword, + group_index_str, + entry.profile_id, + entry.profile_name, + entry.visited_at + ], + ).map_err(|e| ZdbError::invalid_data_format(format!("Failed to import history entry: {}", e)))?; + } + + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_history_manager() { + use std::sync::{Arc, Mutex}; + let conn = Arc::new(Mutex::new(rusqlite::Connection::open(":memory:").unwrap())); + + // Create history table for testing + { + let c = conn.lock().unwrap(); + c.execute( + "CREATE TABLE IF NOT EXISTS history ( + id TEXT PRIMARY KEY, + keyword TEXT NOT NULL, + group_index TEXT NOT NULL, + profile_id INTEGER NOT NULL, + profile_name TEXT NOT NULL, + visited_at INTEGER NOT NULL + )", + [], + ).unwrap(); + } + + let mut manager = HistoryManager::new(conn).unwrap(); + + let group_index = serde_json::json!([{ + "profile_id": 1, + "primary_key": "test", + "indexes": [] + }]); + + // Test add + let entry = manager.add_to_history( + "test".to_string(), + group_index.clone(), + 1, + "Test Profile".to_string(), + ).unwrap(); + + assert_eq!(entry.keyword, "test"); + + // Test get all + let all = manager.get_all_history().unwrap(); + assert_eq!(all.len(), 1); + + // Test remove + let removed = manager.remove_from_history(&entry.id).unwrap(); + assert!(removed); + + // Test count after removal + let count = manager.get_history_count().unwrap(); + assert_eq!(count, 0); + } +} + diff --git a/rust/src-tauri/src/history_cmd.rs b/rust/src-tauri/src/history_cmd.rs new file mode 100644 index 0000000000000000000000000000000000000000..a00ae9a32638fbeab36f88e655321f6f9f8c0df3 --- /dev/null +++ b/rust/src-tauri/src/history_cmd.rs @@ -0,0 +1,91 @@ +// History commands module - Tauri command implementations for history management +use tauri::command; + +use crate::error::IntoStringResult; +use crate::history::HistoryEntry; +use crate::mdict_app::{with_history_read, with_history_write}; + +/// Add a history entry +#[command] +pub async fn history_add_to_history( + keyword: String, + group_index: serde_json::Value, + profile_id: i32, + profile_name: String, +) -> std::result::Result { + with_history_write(|manager| { + manager.add_to_history(keyword, group_index, profile_id, profile_name) + }).into_string_result() +} + +/// Get all history entries +#[command] +pub async fn history_get_all_history() -> std::result::Result, String> { + with_history_read(|manager| { + manager.get_all_history() + }).into_string_result() +} + +/// Get history entry by ID +#[command] +pub async fn history_get_history_entry_by_id( + id: String, +) -> std::result::Result, String> { + with_history_read(|manager| { + manager.get_entry_by_id(&id) + }).into_string_result() +} + +/// Remove a history entry by ID +#[command] +pub async fn history_remove_from_history( + id: String, +) -> std::result::Result { + with_history_write(|manager| { + manager.remove_from_history(&id) + }).into_string_result() +} + +/// Clear all history +#[command] +pub async fn history_clear_history() -> std::result::Result<(), String> { + with_history_write(|manager| { + manager.clear_history() + }).into_string_result() +} + +/// Get history count +#[command] +pub async fn history_get_history_count() -> std::result::Result { + with_history_read(|manager| { + manager.get_history_count() + }).into_string_result() +} + +/// Set maximum history size +#[command] +pub async fn history_set_max_history_size( + size: usize, +) -> std::result::Result<(), String> { + with_history_write(|manager| { + manager.set_max_history_size(size) + }).into_string_result() +} + +/// Get maximum history size +#[command] +pub async fn history_get_max_history_size() -> std::result::Result { + with_history_read(|manager| { + Ok(manager.get_max_history_size()) + }).into_string_result() +} + +/// Import history entries (for backup/restore) +#[command] +pub async fn history_import_history( + entries: Vec, +) -> std::result::Result<(), String> { + with_history_write(|manager| { + manager.import_history(entries) + }).into_string_result() +} \ No newline at end of file diff --git a/rust/src-tauri/src/hotkey_cmd.rs b/rust/src-tauri/src/hotkey_cmd.rs new file mode 100644 index 0000000000000000000000000000000000000000..dadbb7574082f14a6b53259b55e278b6ce213976 --- /dev/null +++ b/rust/src-tauri/src/hotkey_cmd.rs @@ -0,0 +1,22 @@ +// Hotkey commands module +// This module is only available on desktop platforms (Windows, macOS, Linux) +// Mobile platforms (iOS, Android) do not support global hotkeys +#![cfg(all(not(target_os = "android"), not(target_os = "ios"), feature = "global-hotkey"))] + +use log::info; +use tauri::{AppHandle, command}; + +/// Register a global hotkey +#[command] +pub fn hotkey_register(app_handle: AppHandle, letter: String, modifier: String) -> Result<(), String> { + info!("Command: hotkey_register - letter: {}, modifier: {}", letter, modifier); + crate::hotkey_manager::register_hotkey(app_handle, &letter, &modifier) +} + +/// Unregister the current global hotkey +#[command] +pub fn hotkey_unregister() -> Result<(), String> { + info!("Command: hotkey_unregister"); + crate::hotkey_manager::unregister_hotkey() +} + diff --git a/rust/src-tauri/src/hotkey_manager.rs b/rust/src-tauri/src/hotkey_manager.rs new file mode 100644 index 0000000000000000000000000000000000000000..5a42c3f9cd991927fd3d1f2465a4eb4081b65963 --- /dev/null +++ b/rust/src-tauri/src/hotkey_manager.rs @@ -0,0 +1,206 @@ +// Hotkey manager module +// This module is only available on desktop platforms (Windows, macOS, Linux) +// Mobile platforms (iOS, Android) do not support global hotkeys +#![cfg(all(not(target_os = "android"), not(target_os = "ios"), feature = "global-hotkey"))] + +use std::sync::Mutex; +use global_hotkey::{GlobalHotKeyManager, GlobalHotKeyEvent, hotkey::{HotKey, Modifiers, Code}}; +use log::{error, info}; +use once_cell::sync::Lazy; +use tauri::{AppHandle, Manager, Emitter}; + +/// Wrapper around GlobalHotKeyManager to make it Send + Sync +/// This is safe because: +/// 1. The manager is always protected by a Mutex +/// 2. The raw pointer inside GlobalHotKeyManager is managed by the OS +/// 3. The global-hotkey library handles internal synchronization +struct SendableHotKeyManager(GlobalHotKeyManager); + +// SAFETY: GlobalHotKeyManager is only accessed through Mutex protection, +// and the underlying OS resources are thread-safe +unsafe impl Send for SendableHotKeyManager {} +unsafe impl Sync for SendableHotKeyManager {} + +impl SendableHotKeyManager { + fn new() -> Result { + GlobalHotKeyManager::new().map(SendableHotKeyManager) + } + + fn register(&self, hotkey: HotKey) -> Result<(), global_hotkey::Error> { + self.0.register(hotkey) + } + + fn unregister(&self, hotkey: HotKey) -> Result<(), global_hotkey::Error> { + self.0.unregister(hotkey) + } +} + +/// Global hotkey manager state +static HOTKEY_MANAGER: Lazy>> = Lazy::new(|| Mutex::new(None)); +static REGISTERED_HOTKEY: Lazy>> = Lazy::new(|| Mutex::new(None)); +static APP_HANDLE: Lazy>> = Lazy::new(|| Mutex::new(None)); + +/// Parse modifier string to Modifiers +fn parse_modifier(modifier: &str) -> Option { + let modifier = modifier.to_lowercase(); + let parts = modifier.split('+').collect::>(); + if parts.is_empty() { + return None; + } + + let mut result = Modifiers::empty(); + for part in parts { + match part.trim() { + "ctrl" | "control" => result |= Modifiers::CONTROL, + "shift" => result |= Modifiers::SHIFT, + "alt" | "option" => result |= Modifiers::ALT, + "super" | "cmd" | "command" | "meta" => result |= Modifiers::SUPER, + _ => return None, + } + } + + Some(result) +} + +/// Parse key letter to Code +fn parse_key_code(letter: &str) -> Option { + if letter.len() == 1 { + let ch = letter.chars().next().unwrap().to_ascii_uppercase(); + match ch { + 'A'..='Z' => { + let offset = (ch as u32 - 'A' as u32) as usize; + let codes = [ + Code::KeyA, Code::KeyB, Code::KeyC, Code::KeyD, Code::KeyE, + Code::KeyF, Code::KeyG, Code::KeyH, Code::KeyI, Code::KeyJ, + Code::KeyK, Code::KeyL, Code::KeyM, Code::KeyN, Code::KeyO, + Code::KeyP, Code::KeyQ, Code::KeyR, Code::KeyS, Code::KeyT, + Code::KeyU, Code::KeyV, Code::KeyW, Code::KeyX, Code::KeyY, + Code::KeyZ, + ]; + codes.get(offset).copied() + } + '0'..='9' => { + let offset = (ch as u32 - '0' as u32) as usize; + let codes = [ + Code::Digit0, Code::Digit1, Code::Digit2, Code::Digit3, Code::Digit4, + Code::Digit5, Code::Digit6, Code::Digit7, Code::Digit8, Code::Digit9, + ]; + codes.get(offset).copied() + } + _ => None, + } + } else { + None + } +} + +/// Initialize the hotkey manager +pub fn init_hotkey_manager(app_handle: AppHandle) -> Result<(), String> { + let mut manager = HOTKEY_MANAGER.lock().unwrap(); + if manager.is_none() { + *manager = Some(SendableHotKeyManager::new().map_err(|e| format!("Failed to create GlobalHotKeyManager: {}", e))?); + info!("GlobalHotKeyManager initialized"); + } + + // Store app handle + let mut handle = APP_HANDLE.lock().unwrap(); + *handle = Some(app_handle); + + Ok(()) +} + +/// Register a global hotkey +pub fn register_hotkey(app_handle: AppHandle, letter: &str, modifier: &str) -> Result<(), String> { + // Initialize if not already done + init_hotkey_manager(app_handle)?; + + // Unregister existing hotkey if any + unregister_hotkey()?; + + // Check if both letter and modifier are empty + if letter.is_empty() || modifier.is_empty() { + info!("Hotkey is empty, skipping registration"); + return Ok(()); + } + + // Parse modifier and key code + let modifiers = parse_modifier(modifier) + .ok_or_else(|| format!("Invalid modifier: {}", modifier))?; + let code = parse_key_code(letter) + .ok_or_else(|| format!("Invalid key letter: {}", letter))?; + + info!("Registering hotkey: {} + {:?}", modifier, letter); + + // Create hotkey + let hotkey = HotKey::new(Some(modifiers), code); + + // Register the hotkey + let manager = HOTKEY_MANAGER.lock().unwrap(); + if let Some(mgr) = manager.as_ref() { + mgr.register(hotkey).map_err(|e| format!("Failed to register hotkey: {}", e))?; + info!("Hotkey registered successfully"); + + // Store the registered hotkey + let mut registered = REGISTERED_HOTKEY.lock().unwrap(); + *registered = Some(hotkey); + + Ok(()) + } else { + Err("GlobalHotKeyManager not initialized".to_string()) + } +} + +/// Unregister the current global hotkey +pub fn unregister_hotkey() -> Result<(), String> { + let mut registered = REGISTERED_HOTKEY.lock().unwrap(); + + if let Some(hotkey) = registered.take() { + info!("Unregistering hotkey"); + let manager = HOTKEY_MANAGER.lock().unwrap(); + if let Some(mgr) = manager.as_ref() { + mgr.unregister(hotkey).map_err(|e| format!("Failed to unregister hotkey: {}", e))?; + info!("Hotkey unregistered successfully"); + Ok(()) + } else { + Err("GlobalHotKeyManager not initialized".to_string()) + } + } else { + // No hotkey registered, nothing to do + Ok(()) + } +} + +/// Check for hotkey events and handle them +/// This should be called from a loop or event handler +pub fn check_hotkey_events() { + if let Ok(event) = GlobalHotKeyEvent::receiver().try_recv() { + info!("Hotkey event received: {:?}", event); + + // Get the app handle + let app_handle_lock = APP_HANDLE.lock().unwrap(); + if let Some(app_handle) = app_handle_lock.as_ref() { + info!("Hotkey pressed, bringing window to front"); + + // Get the main window and bring it to front + if let Some(window) = app_handle.get_webview_window("main") { + if let Err(e) = window.set_focus() { + error!("Failed to focus window: {}", e); + } + if let Err(e) = window.show() { + error!("Failed to show window: {}", e); + } + if let Err(e) = window.unminimize() { + error!("Failed to unminimize window: {}", e); + } + + // Emit window-focus event to frontend + if let Err(e) = app_handle.emit("window-focus", ()) { + error!("Failed to emit window-focus event: {}", e); + } + } else { + error!("Failed to get main window"); + } + } + } +} + diff --git a/rust/src-tauri/src/lib.rs b/rust/src-tauri/src/lib.rs new file mode 100644 index 0000000000000000000000000000000000000000..ec27c710888e63f3e91eef75cf8c33d21e3644c1 --- /dev/null +++ b/rust/src-tauri/src/lib.rs @@ -0,0 +1,276 @@ +// Error types module +pub mod error; +// Error printer module +pub mod error_printer; +// App configuration module +pub mod app_config; +// MDict app singleton module +pub mod mdict_app; +// Library manager module +pub mod library_mgr; +// Commands module - contains all Tauri command implementations (deprecated, use plugins instead) +// Commented out to avoid conflicts with plugin commands +// pub mod commands; +// History management module +pub mod history; +// History commands plugin +mod history_cmd; +// Favorites management module +pub mod favorites; +// Favorites commands plugin +mod favorites_cmd; +// Config commands plugin +mod config_cmd; +// Library commands plugin +mod library_cmd; +// Conversion commands plugin +mod conversion_cmd; +// Search commands plugin +mod search_cmd; +// System commands plugin +mod system_cmd; +mod mdx_profile; +mod mdx_db; +mod mdx_db_group; +mod request_handler; +mod mdx_url_parser; +mod action_handlers; +// Hotkey manager and commands are only available on desktop platforms +#[cfg(all(not(target_os = "android"), not(target_os = "ios"), feature = "global-hotkey"))] +mod hotkey_manager; +#[cfg(all(not(target_os = "android"), not(target_os = "ios"), feature = "global-hotkey"))] +mod hotkey_cmd; +mod utils; + +use humantime::format_rfc3339; +use log::{LevelFilter, error, info, debug}; +use tauri::Manager; +use tauri::http::{Response, StatusCode}; + +use crate::utils::log_if_err; + +// Import all command functions +use crate::config_cmd::*; +use crate::conversion_cmd::*; +use crate::favorites_cmd::*; +use crate::history_cmd::*; +#[cfg(all(not(target_os = "android"), not(target_os = "ios"), feature = "global-hotkey"))] +use crate::hotkey_cmd::*; +use crate::library_cmd::*; +use crate::search_cmd::*; +use crate::system_cmd::*; + +/// Macro to generate the invoke handler with all commands +/// +/// This macro centralizes all command registration by including all command functions +/// from all modules. When adding new commands, you need to: +/// 1. Add the command function to the appropriate module +/// 2. Add the command name to the module's COMMANDS array +/// 3. Add the function name to this macro +/// +/// The macro ensures that all commands are registered consistently and makes it +/// easy to see all available commands in one place. +macro_rules! generate_all_commands_handler { + () => { + tauri::generate_handler![ + // Search commands + search_search_incremental, + search_get_content_url, + search_get_entry_count, + search_find_index, + search_fulltext_search, + search_get_result_key_list, + search_get_group_indexes, + // History commands + history_add_to_history, + history_get_all_history, + history_get_history_entry_by_id, + history_remove_from_history, + history_clear_history, + history_get_history_count, + history_set_max_history_size, + history_get_max_history_size, + history_import_history, + // Favorites commands + favorites_add_favorite, + favorites_remove_favorite, + favorites_toggle_favorite, + favorites_is_favorited, + favorites_get_sorted_and_filtered_favorites, + favorites_get_all_favorites, + favorites_clear_all_favorites, + favorites_import_favorites, + favorites_get_favorites_count, + // Config commands - Generic interface + config_get_app_config, + config_get_value, + config_set_value, + config_get_global_settings, + config_get_view_settings, + config_update_view_settings, + config_list_fonts_in_directory, + config_save_app_config, + config_reload_app_config, + config_reload_resources, + // Library commands + library_create_dict_group, + library_delete_dict_group, + library_rename_dict_group, + library_refresh_library, + library_get_group, + library_get_profile, + library_list_groups, + library_update_profile_disabled_status, + library_adjust_profile_order, + library_adjust_group_order, + library_open_main_database, + library_get_current_main_profile_id, + library_get_main_db_profile, + library_rebuild_index, + // Conversion commands + library_convert_db, + library_create_fts_index, + library_cancel_conversion, + // System commands + system_set_base_url, + // Hotkey commands (desktop only) + #[cfg(all(not(target_os = "android"), not(target_os = "ios"), feature = "global-hotkey"))] + hotkey_register, + #[cfg(all(not(target_os = "android"), not(target_os = "ios"), feature = "global-hotkey"))] + hotkey_unregister, + ] + }; +} + + +#[cfg_attr(mobile, tauri::mobile_entry_point)] +pub fn run() { + unsafe { std::env::set_var("RUST_BACKTRACE", "1"); } + + tauri::Builder::default() + .setup(|app| { + let app_handle = app.handle(); + let data_dir = app_handle.path().app_data_dir().map_err(|e| e.to_string())?; + + // Setup logging + fern::Dispatch::new() + .format(|out, message, record| { + out.finish(format_args!( + "[{} {} {}] {}", + format_rfc3339(std::time::SystemTime::now()), + record.level(), + record.target(), + message + )) + }) + .level(LevelFilter::Debug) + .chain(std::io::stdout()) + .apply().unwrap(); + + // Initialize main app (includes history and favorites managers) + log_if_err(&mdict_app::init_mdict_app(data_dir.clone(), Vec::new(), &app_handle)); + + // Setup window event handler for focus detection + let window = app.get_webview_window("main").expect("Failed to get main window"); + let app_handle_clone = app_handle.clone(); + window.on_window_event(move |event| { + if let tauri::WindowEvent::Focused(focused) = event { + if *focused { + info!("Window gained focus, notifying frontend"); + // Emit event to frontend + // Frontend will check autoLookupSelection setting and handle clipboard accordingly + use tauri::Emitter; + if let Err(e) = app_handle_clone.emit("window-focus", ()) { + error!("Failed to emit window-focus event: {}", e); + } + } + } + }); + + // Initialize hotkey manager (desktop only) + #[cfg(all(not(target_os = "android"), not(target_os = "ios"), feature = "global-hotkey"))] + { + if let Err(e) = hotkey_manager::init_hotkey_manager(app_handle.clone()) { + error!("Failed to initialize hotkey manager: {}", e); + } + + // Load hotkey configuration from settings + let app_handle_for_hotkey = app_handle.clone(); + tauri::async_runtime::spawn(async move { + if let Ok(config) = mdict_app::with_config_read(|config| Ok(config.clone())) { + let hotkey_letter = config.global_settings.get("hotkey_letter") + .and_then(|v| v.as_str()) + .unwrap_or(""); + let hotkey_modifier = config.global_settings.get("hotkey_modifier") + .and_then(|v| v.as_str()) + .unwrap_or(""); + + if !hotkey_letter.is_empty() && !hotkey_modifier.is_empty() { + info!("Registering hotkey from config: {} + {}", hotkey_modifier, hotkey_letter); + if let Err(e) = hotkey_manager::register_hotkey(app_handle_for_hotkey, hotkey_letter, hotkey_modifier) { + error!("Failed to register hotkey on startup: {}", e); + } + } else { + info!("No hotkey configured"); + } + } + }); + + // Spawn a task to check for hotkey events periodically + let _hotkey_task = std::thread::spawn(move || { + loop { + hotkey_manager::check_hotkey_events(); + std::thread::sleep(std::time::Duration::from_millis(100)); + } + }); + } + + Ok(()) + }) + // Register protocol scheme based on platform + // Windows: use "http" scheme + // Non-Windows (macOS, Linux): use "mdx" scheme + .register_asynchronous_uri_scheme_protocol( + #[cfg(target_os = "windows")] + "http", + #[cfg(not(target_os = "windows"))] + "mdx", + |_app, request, responder| { + tauri::async_runtime::spawn(async move { + let uri = request.uri().to_string(); + + // Check if the request matches the configured base_url + // Only handle requests that start with base_url, otherwise let webview handle them + let base_url = mdict_app::with_read_access(|app| { + Ok(app.get_base_url().to_string()) + }).unwrap_or("mdx://mdict.cn/service/".to_string()); + + if !uri.starts_with(&base_url.replace("http.localhost", "localhost")) { + if uri.contains("/service/") { + debug!("Request does not match base_url, skipping: {}", uri); + } + return; + } + + // Handle the request using our custom handler + match request_handler::handle_request(&request, &base_url) { + Ok(response) => responder.respond(response), + Err(err) => { + error!("Error in protocol handler: {}", err); + let error_html = format!("

Protocol Error

{}

", err); + let mut error_response = Response::new(error_html.into_bytes()); + *error_response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR; + error_response.headers_mut().insert("Content-Type", "text/html; charset=utf-8".parse().unwrap()); + responder.respond(error_response); + } + } + }); + } + ) + .plugin(tauri_plugin_opener::init()) + .plugin(tauri_plugin_dialog::init()) + .plugin(tauri_plugin_clipboard_manager::init()) + .invoke_handler(generate_all_commands_handler!()) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} \ No newline at end of file diff --git a/rust/src-tauri/src/library_cmd.rs b/rust/src-tauri/src/library_cmd.rs new file mode 100644 index 0000000000000000000000000000000000000000..082c57797547f1dd8106e0260266a59abf348993 --- /dev/null +++ b/rust/src-tauri/src/library_cmd.rs @@ -0,0 +1,257 @@ +// Library commands module - Tauri command implementations for library and group management +use serde::{Deserialize, Serialize}; +use tauri::command; + +use crate::error::{IntoStringResult, ZdbError}; +use crate::mdict_app::{with_read_access, with_write_access}; +use crate::mdx_profile::ProfileId; + +/// Collation options for rebuilding index +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CollationOptions { + pub language: String, + pub collation_type: Option, + pub strength: String, + pub alternate_handling: String, + pub case_level: String, + pub case_first: String, +} + +/// Create a dictionary group +#[command] +pub async fn library_create_dict_group(group_name: String) -> std::result::Result { + with_write_access(|app| { + let group = app.library_manager.create_group(group_name); + let group_id = group.profile_id; + // Save to file + app.library_manager.save_library()?; + Ok(group_id) + }).into_string_result() +} + +/// Delete a dictionary group +#[command] +pub async fn library_delete_dict_group(group_id: ProfileId) -> std::result::Result { + with_write_access(|app| { + if app.library_manager.remove_profile(group_id) { + app.library_manager.save_library()?; + Ok(true) + } else { + Ok(false) + } + }).into_string_result() +} + +/// Rename a dictionary group +#[command] +pub async fn library_rename_dict_group(group_id: ProfileId, new_name: String) -> std::result::Result<(), String> { + with_write_access(|app| { + if let Some(profile) = app.library_manager.get_group_mut(group_id) { + profile.title = new_name; + // Save to file + app.library_manager.save_library()?; + Ok(()) + } else { + Err(ZdbError::invalid_parameter("配置文件或组不存在".to_string())) + } + }).into_string_result() +} + +/// Scan dictionary directory +#[command] +pub async fn library_refresh_library() -> std::result::Result<(), String> { + with_write_access(|app| { + let search_paths = app.get_lib_search_paths()?.to_vec(); + app.library_manager.refresh_library(&search_paths)?; + Ok(()) + }).into_string_result() +} + +/// Get group for a given group_id +#[command] +pub async fn library_get_group(group_id: ProfileId) -> std::result::Result { + with_read_access(|app| { + if let Some(group) = app.library_manager.get_group(group_id) { + let group_value = serde_json::to_value(group) + .map_err(|e| ZdbError::invalid_data_format(e.to_string()))?; + Ok(group_value) + } else { + Err(ZdbError::invalid_parameter("词典组不存在".to_string())) + } + }).into_string_result() +} + +/// Get profile for a given group_id and profile_id +#[command] +pub async fn library_get_profile(parent_group_id: ProfileId, profile_id: ProfileId) -> std::result::Result { + with_read_access(|app| { + if let Some(profile) = app.library_manager.get_profile(parent_group_id, profile_id) { + let profile_value = serde_json::to_value(profile) + .map_err(|e| ZdbError::invalid_data_format(e.to_string()))?; + Ok(profile_value) + } else { + Err(ZdbError::invalid_parameter("词典不存在".to_string())) + } + }).into_string_result() +} + +/// List all dictionary groups +#[command] +pub async fn library_list_groups() -> std::result::Result { + with_read_access(|app| { + // Get current main profile ID from main_db + let current_main_profile_id = app.get_current_main_profile_id()?; + + let groups = app.library_manager.get_groups(); + let mut enhanced_groups = Vec::new(); + + for group in groups.iter() { + let mut group_value = serde_json::to_value(group) + .map_err(|e| ZdbError::invalid_data_format(e.to_string()))?; + + // Add is_active flag based on current main profile + if let Some(obj) = group_value.as_object_mut() { + obj.insert("isActive".to_string(), + serde_json::Value::Bool(group.profile_id == current_main_profile_id)); + } + enhanced_groups.push(group_value); + } + + Ok(serde_json::Value::Array(enhanced_groups)) + }).into_string_result() +} + +/// Update profile disabled status +#[command] +pub async fn library_update_profile_disabled_status( + parent_group_id: ProfileId, + profile_id: ProfileId, + disabled: bool +) -> std::result::Result<(), String> { + with_write_access(|app| { + if let Some(group) = app.library_manager.get_group_mut(parent_group_id) { + if let Some(profile) = group.get_profile_mut(profile_id) { + profile.disabled = disabled; + // Save to file + app.library_manager.save_library()?; + Ok(()) + } else { + Err(ZdbError::invalid_parameter("词典配置不存在".to_string())) + } + } else { + Err(ZdbError::invalid_parameter("词典组不存在".to_string())) + } + }).into_string_result() +} + +/// Adjust profile order within a group +#[command] +pub async fn library_adjust_profile_order( + parent_group_id: ProfileId, + profile_id: ProfileId, + new_index: usize +) -> std::result::Result<(), String> { + with_write_access(|app| { + app.library_manager.adjust_profile_order(parent_group_id, profile_id, new_index); + // Save to file + app.library_manager.save_library()?; + Ok(()) + }).into_string_result() +} + +/// Adjust group order +#[command] +pub async fn library_adjust_group_order(group_id: ProfileId, new_index: usize) -> std::result::Result<(), String> { + with_write_access(|app| { + app.library_manager.adjust_group_order(group_id, new_index); + // Save to file + app.library_manager.save_library()?; + Ok(()) + }).into_string_result() +} + +/// Open main database with the given profile +#[command] +pub async fn library_open_main_database(profile_id: ProfileId) -> std::result::Result<(), String> { + with_write_access(|app| app.open_main_db(profile_id)).into_string_result() +} + +/// Get current main profile ID +#[command] +pub async fn library_get_current_main_profile_id() -> std::result::Result { + with_read_access(|app| app.get_current_main_profile_id()).into_string_result() +} + +/// Get main database profile (complete object) +#[command] +pub async fn library_get_main_db_profile() -> std::result::Result, String> { + with_read_access(|app| { + match app.get_current_main_profile()? { + Some(profile) => { + let profile_json = serde_json::to_value(profile) + .map_err(|e| ZdbError::invalid_data_format(format!("Failed to serialize profile: {}", e)))?; + Ok(Some(profile_json)) + }, + None => Ok(None) + } + }).into_string_result() +} + +/// Rebuild dictionary index with collation options +#[command] +pub async fn library_rebuild_index( + profile_id: ProfileId, + options: CollationOptions +) -> std::result::Result<(), String> { + with_write_access(|_app| { + log::info!("Rebuilding index for profile {} with options: {:?}", profile_id, options); + + // Build BCP 47 locale string with collation extensions + let mut locale_str = options.language.clone(); + + // Add Unicode extension for collation + let mut extensions = vec![]; + + // Collation type (e.g., pinyin, stroke, traditional) + if let Some(ref collation_type) = options.collation_type { + if collation_type != "standard" { + extensions.push(format!("co-{}", collation_type)); + } + } + + // Strength level (ks = collation strength) + let strength = match options.strength.as_str() { + "level1" => "level1", + "level2" => "level2", + "level3" => "level3", + "level4" => "level4", + _ => "level1", + }; + extensions.push(format!("ks-{}", strength)); + + // Alternate handling (ka = alternate handling) + if options.alternate_handling == "shifted" { + extensions.push("ka-shifted".to_string()); + } + + // Case level (kc = case level) + if options.case_level == "true" { + extensions.push("kc-true".to_string()); + } + + // Case first (kf = case first) + if options.case_first != "off" { + extensions.push(format!("kf-{}", options.case_first)); + } + + if !extensions.is_empty() { + locale_str.push_str("-u-"); + locale_str.push_str(&extensions.join("-")); + } + + log::info!("Generated BCP 47 locale string: {}", locale_str); + Ok(()) + }).into_string_result() +} + diff --git a/rust/src-tauri/src/library_mgr.rs b/rust/src-tauri/src/library_mgr.rs new file mode 100644 index 0000000000000000000000000000000000000000..6b698734ea252d0e87bac36868604af549ec38cd --- /dev/null +++ b/rust/src-tauri/src/library_mgr.rs @@ -0,0 +1,390 @@ +use std::collections::{LinkedList, HashMap}; +use std::path::{Path, PathBuf}; +use mime_guess::MimeGuess; +use regex::Regex; +use serde::{Deserialize, Serialize}; +use url::Url; + +use mdx::ZdbError; +use mdx::utils::{scan_dir, get_decoded_path, replace_url_path, with_extension}; + +use crate::error::Result; +use crate::mdx_profile::{self, MdxOptions, MdxProfile, ProfileId, DEFAULT_GROUP_ID}; + +/// MDX库管理器 +/// 基于mdx_manager的简化版本 +#[derive(Deserialize, Serialize)] +pub struct LibraryManager { + mdx_groups: LinkedList, + /// 默认MDX选项 + #[serde(skip)] + default_mdx_options: MdxOptions, + + #[serde(skip)] + library_file_path: String, + + #[serde(skip)] + icon_cache: HashMap, String)>, +} + +impl LibraryManager { + pub fn new() -> Self { + let mut manager = Self { + mdx_groups: LinkedList::new(), + default_mdx_options: MdxOptions::default(), + library_file_path: String::new(), + icon_cache: HashMap::new(), + }; + manager.ensure_default_group(); + manager + } + + pub fn get_next_profile_id(&self) -> ProfileId { + let mut ids = Vec::new(); + for group in &self.mdx_groups { + ids.push(group.profile_id); + if let Some(profiles) = &group.profiles { + for profile in profiles { + ids.push(profile.profile_id); + } + } + } + let max_id = ids.into_iter().max().unwrap_or(0); + max_id + 1 + } + + /// Ensure the default "All" group exists + fn ensure_default_group(&mut self) { + // Check if the default group already exists + if self.get_group(DEFAULT_GROUP_ID).is_none() { + let root_group = MdxProfile::new_group("All databases".to_string(), DEFAULT_GROUP_ID); + self.replace_group_profile(&root_group); + } + } + + /// 通过profile_id查找任意profile(可能是group或individual profile) + pub fn find_profile(&self, profile_id: ProfileId) -> Option<&MdxProfile> { + // First try to find it in groups + if let Some(group) = self.mdx_groups.iter().find(|p| p.profile_id == profile_id) { + return Some(group); + } + //If profile_id can't be found in groups, then only try find it in default group + return self.mdx_groups.iter().find(|p| p.profile_id == DEFAULT_GROUP_ID).and_then(|g| g.get_profile(profile_id)); + } + + pub fn get_groups(&self) -> &LinkedList { + &self.mdx_groups + } + + /// 获取组(向后兼容) + pub fn get_group(&self, group_id: ProfileId) -> Option<&MdxProfile> { + self.find_profile(group_id).filter(|p| p.is_group()) + } + + /// 获取可变组(向后兼容) + pub fn get_group_mut(&mut self, group_id: ProfileId) -> Option<&mut MdxProfile> { + // 直接在顶级groups中查找,避免调用find_profile_mut造成递归 + self.mdx_groups.iter_mut().find(|p| p.profile_id == group_id && p.is_group()) + } + + /// 获取配置文件(在指定group中查找) + pub fn get_profile(&self, parent_group_id: ProfileId, profile_id: ProfileId) -> Option<&MdxProfile> { + self.get_group(parent_group_id)?.get_profile(profile_id) + } + + /// 创建新组 + pub fn create_group(&mut self, title: String) -> MdxProfile { + let mut new_group = MdxProfile::new_group(title, self.get_next_profile_id()); + new_group.options = self.default_mdx_options.clone(); + if let Some(default_group) = self.get_group(DEFAULT_GROUP_ID) { + if let Some(profiles) = &default_group.profiles { + new_group.profiles = Some(profiles.clone()); + } + } + self.replace_group_profile(&new_group); + new_group + } + + /// 移除profile或group + pub fn remove_profile(&mut self, profile_id: ProfileId) -> bool { + // 尝试从顶级groups中移除 + let original_len = self.mdx_groups.len(); + let mut new_groups = LinkedList::new(); + while let Some(group) = self.mdx_groups.pop_front() { + if group.profile_id != profile_id { + new_groups.push_back(group); + } + } + self.mdx_groups = new_groups; + + if self.mdx_groups.len() != original_len { + return true; + } + + // 如果没在顶级找到,在各group的子profiles中查找 + for group in &mut self.mdx_groups { + if let Some(profiles) = &mut group.profiles { + let original_len = profiles.len(); + let mut new_profiles = LinkedList::new(); + while let Some(profile) = profiles.pop_front() { + if profile.profile_id != profile_id { + new_profiles.push_back(profile); + } + } + *profiles = new_profiles; + if profiles.len() != original_len { + return true; + } + } + } + false + } + + /// 移除组(向后兼容) + pub fn remove_group(&mut self, group_id: ProfileId) -> bool { + self.remove_profile(group_id) + } + + pub fn adjust_profile_order(&mut self, parent_group_id: ProfileId, profile_id: ProfileId, new_index: usize) { + if let Some(group) = self.get_group_mut(parent_group_id) { + group.adjust_profile_order(profile_id, new_index); + } + } + + /// 调整组的顺序 + pub fn adjust_group_order(&mut self, group_id: ProfileId, new_index: usize) { + // 找到要移动的组 + let mut target_group = None; + let mut new_groups = LinkedList::new(); + + // 先移除目标组 + while let Some(group) = self.mdx_groups.pop_front() { + if group.profile_id == group_id { + target_group = Some(group); + } else { + new_groups.push_back(group); + } + } + + // 如果找到了目标组,将其插入到新位置 + if let Some(group) = target_group { + let mut final_groups = LinkedList::new(); + let mut current_index = 0; + + // 先添加新位置之前的组 + while let Some(g) = new_groups.pop_front() { + if current_index == new_index { + final_groups.push_back(group.clone()); + } + final_groups.push_back(g); + current_index += 1; + } + + // 如果新位置在最后,添加目标组 + if current_index <= new_index { + final_groups.push_back(group); + } + + self.mdx_groups = final_groups; + } else { + // 如果没找到目标组,恢复原状态 + self.mdx_groups = new_groups; + } + } + + // Replace the existing group profile with the same profile_id, or add a new one if not found. + pub fn replace_group_profile(&mut self, group_profile: &MdxProfile) { + let profile_id = group_profile.profile_id; + + if let Some(existing_profile) = self.mdx_groups.iter_mut().find(|p| p.profile_id == profile_id) { + *existing_profile = group_profile.clone(); + } else { + self.mdx_groups.push_back(group_profile.clone()); + } + } + + // scan the directory url to find all "*.mdx" files recursively + // create a new mdx_group with profile_id is DEFAULT_GROUP_ID, and generate every mdx file into a MdxProfile, and add it to this mdx_group object + pub fn scan_dir(&self, dir_url: &Url) -> std::result::Result { + let mut mdx_group = MdxProfile::new_group("Scanned".to_string(), DEFAULT_GROUP_ID); + // Match .mdx files (case-insensitive) that don't start with a dot + let pattern = Regex::new(r"(?i)^[^.].*\.mdx$").map_err(|e| ZdbError::invalid_parameter(format!("Regex pattern error: {}", e)))?; + let mut files = LinkedList::::new(); + let target_path = get_decoded_path(dir_url)?; + log::info!("scan_dir: {:?}", target_path); + scan_dir(&target_path, &pattern, true, &mut files)?; + + let base_url= dir_url.clone(); + let mut temp_id = 1000; // Use temporary IDs for scanning, will be replaced during merge + for file_path in files { + let mdx_file_url = replace_url_path(&base_url, &file_path)?; + let mut mdx_profile= MdxProfile::new(mdx_file_url.to_string(), mdx_profile::INVALID_PROFILE_ID, false); + mdx_profile.options = self.default_mdx_options.clone(); + mdx_group.replace_profile(&mdx_profile, temp_id); + temp_id += 1; + } + Ok(mdx_group) + } + /// 扫描词典目录并更新MDX管理器 + pub fn scan_directories(&self, search_paths: &[String]) -> Result { + let mut mdx_group = MdxProfile::new_group("Scanned Directories".to_string(), DEFAULT_GROUP_ID); + for search_path in search_paths { + let url = Url::from_file_path(search_path) + .map_err(|_| ZdbError::invalid_parameter(format!("无效的目录路径: {}", search_path)))?; + let new_group = self.scan_dir(&url)?; + if let Some(new_profiles) = new_group.profiles { + if mdx_group.profiles.is_none() { + mdx_group.profiles = Some(LinkedList::new()); + } + mdx_group.profiles.as_mut().unwrap().extend(new_profiles); + } + } + Ok(mdx_group) + } + + /// Merge profiles from source_group into target_group by URL + /// Keeps profiles that exist in source_group, adds new ones, and removes profiles not in source_group + /// + /// # Arguments + /// * `target_group` - The group to merge into + /// * `source_group` - The group to merge from + /// * `next_id` - Starting ID for new profiles, will be incremented for each new profile added + fn merge_profiles_by_url(&self, target_group: &mut MdxProfile, source_group: &MdxProfile, next_id: &mut ProfileId) { + if let Some(source_profiles) = &source_group.profiles { + if target_group.profiles.is_none() { + target_group.profiles = Some(LinkedList::new()); + } + + let mut new_merged_profiles = LinkedList::new(); + let current_profiles = target_group.profiles.as_ref().unwrap(); + + // Iterate through source_group's profiles to build the new merged list + for source_profile in source_profiles.iter() { + // Check if this profile exists in current profiles + if let Some(existing_profile) = current_profiles.iter().find(|p| p.url == source_profile.url) { + // Keep the existing profile (preserve its profile_id and other settings) + new_merged_profiles.push_back(existing_profile.clone()); + } else { + // Add new profile from source_group with a globally unique profile_id + let mut new_profile = source_profile.clone(); + new_profile.profile_id = *next_id; + *next_id += 1; // Increment for next new profile + new_merged_profiles.push_back(new_profile); + } + } + + // Replace the current profiles with the merged list + target_group.profiles = Some(new_merged_profiles); + } else { + // If source_group has no profiles, clear all profiles from target_group + target_group.profiles = Some(LinkedList::new()); + } + } + + pub fn refresh_library(&mut self, search_paths:&[String])->Result<()> { + let new_group = self.scan_directories(search_paths)?; + + // Get the next available ID before we start modifying groups + let mut next_id = self.get_next_profile_id(); + + // Clone the groups to avoid borrow checker issues + let mut updated_groups = LinkedList::new(); + while let Some(mut group) = self.mdx_groups.pop_front() { + log::info!("group id: {}, title: {}", group.profile_id, group.title); + self.merge_profiles_by_url(&mut group, &new_group, &mut next_id); + updated_groups.push_back(group); + } + self.mdx_groups = updated_groups; + + for profile in self.mdx_groups.front().unwrap().profiles.as_ref().unwrap().iter() { + log::info!("profile id: {}, title: {}", profile.profile_id, profile.title); + } + Ok(()) + } + + pub fn from_file>(file_path: P) -> std::result::Result { + let mut manager = if file_path.as_ref().exists() { + let json = std::fs::read_to_string(&file_path)?; + if !json.is_empty() { + Self::from_json(&json)? + } else { + Self::new() + } + }else{ + Self::new() + }; + + // Ensure the default group exists regardless of how the manager was created + manager.ensure_default_group(); + manager.library_file_path = file_path.as_ref().to_string_lossy().to_string(); + Ok(manager) + } + + pub fn save_library(&self) -> Result<()> { + self.to_file(&self.library_file_path)?; + Ok(()) + } + + pub fn to_file>(&self, file_path: P) -> std::result::Result<(), ZdbError> { + let json = self.to_json()?; + std::fs::write(file_path, json)?; + Ok(()) + } + + pub fn from_json(json: &str) -> std::result::Result { + let mdx_groups: LinkedList = serde_json::from_str(json)?; + let mut manager = Self { + mdx_groups, + default_mdx_options: MdxOptions::default(), + library_file_path: String::new(), + icon_cache: HashMap::new(), + }; + + // Ensure the default "All" group exists + manager.ensure_default_group(); + + Ok(manager) + } + + pub fn to_json(&self) -> std::result::Result { + let json = serde_json::to_string(&self.mdx_groups)?; + Ok(json) + } + + pub fn get_icon_for_profile(&mut self, profile_id: ProfileId) -> Result, String)>> { + let profile = self.find_profile(profile_id).ok_or_else(|| ZdbError::invalid_parameter(format!("Profile {} not found", profile_id)))?; + let icon_data = self.icon_cache.get(&profile_id); + if icon_data.is_none() { + let data = load_logo_for_profile(profile)?; + if !data.0.is_empty() { + self.icon_cache.insert(profile_id, data.clone()); + } + return Ok(Some(data.clone())); + } + Ok(None) + } +} + +impl Default for LibraryManager { + fn default() -> Self { + Self::new() + } +} + +fn load_logo_for_profile(profile: &MdxProfile) -> Result<(Vec, String)> { + const LOGO_EXTENSIONS: &[&str] = &["png", "jpg", "jpeg", "gif", "bmp", "tiff", "ico", "webp"]; + + // First try to load logo from the same directory as the MDX file + let db_url = Url::parse(&profile.url)?; + // Fallback: try to find DictIcon.* in the root + for &ext in LOGO_EXTENSIONS { + // Build a resource url path like file:///DictIcon.png + let logo_url = with_extension(&db_url, ext)?; + let logo_path = logo_url.to_file_path().map_err(|_| ZdbError::invalid_parameter(format!("Invalid logo url: {}", &logo_url)))?; + if logo_path.is_file() && logo_path.exists() { + let logo_bytes=std::fs::read(logo_path)?; + return Ok((logo_bytes, MimeGuess::from_ext(ext).first_or_octet_stream().to_string())); + } + } + Ok((Vec::new(), String::new())) +} \ No newline at end of file diff --git a/rust/src-tauri/src/main.rs b/rust/src-tauri/src/main.rs new file mode 100644 index 0000000000000000000000000000000000000000..eaf0db04d21bfb15ca0a0139c81a2c510cc51ce7 --- /dev/null +++ b/rust/src-tauri/src/main.rs @@ -0,0 +1,7 @@ +// Prevents additional console window on Windows in release, DO NOT REMOVE!! +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] + +use mdict_app_lib; +fn main() { + mdict_app_lib::run() +} diff --git a/rust/src-tauri/src/mdict_app.rs b/rust/src-tauri/src/mdict_app.rs new file mode 100644 index 0000000000000000000000000000000000000000..f04273f51cf87ee0e09e7b955a31a614d8aad859 --- /dev/null +++ b/rust/src-tauri/src/mdict_app.rs @@ -0,0 +1,849 @@ +use std::path::Path; +use std::sync::{RwLock, Arc, Mutex}; +use std::collections::{HashMap, LinkedList}; +use once_cell::sync::OnceCell; +use rusqlite::Connection; +use tauri::{Manager, path::BaseDirectory, Emitter}; + +use mdx::storage::EntryNo; +use mdx::utils::fix_windows_path_buf; + +use crate::app_config::{AppConfig, ConfigSection, ConfigKey}; +use crate::error::{Result, ZdbError}; +use crate::favorites::FavoritesManager; +use crate::history::HistoryManager; +use crate::library_mgr::LibraryManager; +use crate::mdx_db::{MdxIndex, MdxDb}; +use crate::mdx_db_group::{MdxDbGroup, MdxGroupIndex}; +use crate::mdx_profile::{ProfileId, DEFAULT_GROUP_ID, INVALID_PROFILE_ID, MdxProfile}; +use crate::utils::log_if_err; +pub enum DbType { + MdxDb(MdxDb), + MdxDbGroup(MdxDbGroup), +} + +/// MDict应用全局单例结构体 +/// 参考libmdx中的MDictApp实现 +pub struct MdictApp { + /// 应用配置 + pub config: AppConfig, + /// 库管理器 + pub library_manager: LibraryManager, + /// 统一数据库连接池 (shared by history and favorites managers) + /// Kept for managing database connection lifecycle + #[allow(dead_code)] + db_connection: Arc>, + /// 历史记录管理器 + pub history_manager: HistoryManager, + /// 收藏管理器 + pub favorites_manager: FavoritesManager, + /// 主数据库 + pub main_db: Option, + + /// Tauri app handle for emitting events + app_handle: tauri::AppHandle, + + /// 程序数据根目录 + data_home_dir: String, + /// 文档目录 + _doc_dir: String, + /// 资源目录 + _res_dir: String, + /// 字体目录 + _font_dir: String, + /// 音频库目录 + _audio_lib_dir: String, + /// 临时文件目录 + tmp_dir: String, + + /// 库搜索路径列表 + lib_search_paths: Vec, + + /// Cached search results for group mode (normalized_key, display_key, group_indexes) + group_search_results: LinkedList<(String, String, LinkedList)>, + /// Asset files loaded into memory (filename -> content) + assets: HashMap>, + + base_url: String, + +} + +// SAFETY: MdictApp is protected by RwLock, and we ensure single-threaded access to MDX readers +unsafe impl Send for MdictApp {} +unsafe impl Sync for MdictApp {} + +impl MdictApp { + + /// 使用主目录初始化应用 + pub fn init_app_with_home_dir>( + data_home_dir: P, + extra_search_paths: Vec, + app_handle: &tauri::AppHandle + ) -> Result { + + let home_dir = fix_windows_path_buf(data_home_dir.as_ref().to_path_buf()).to_string_lossy().into_owned(); + log::info!("init_app_with_home_dir: {:?}", home_dir); + let doc_dir = format!("{}/doc", home_dir); + let audio_lib_dir = format!("{}/audiolib", home_dir); + let font_dir = format!("{}/fonts", home_dir); + let res_dir = format!("{}/res", home_dir); + let tmp_dir = format!("{}/tmp", home_dir); + + Self::init_app(home_dir, doc_dir, audio_lib_dir, font_dir, res_dir, tmp_dir, extra_search_paths, app_handle) + } + + /// 初始化应用 + pub fn init_app( + data_home_dir: String, + doc_dir: String, + audio_lib_dir: String, + font_dir: String, + res_dir: String, + tmp_dir: String, + extra_search_paths: Vec, + app_handle: &tauri::AppHandle, + ) -> Result { + let data_home_dir = Self::normalize_dir_path(data_home_dir); + let doc_dir = Self::normalize_dir_path(doc_dir); + let audio_lib_dir = Self::normalize_dir_path(audio_lib_dir); + let font_dir = Self::normalize_dir_path(font_dir); + let res_dir = Self::normalize_dir_path(res_dir); + let tmp_dir = Self::normalize_dir_path(tmp_dir); + + // 默认添加doc目录到搜索路径 + let mut lib_search_paths = Vec::new(); + lib_search_paths.push(doc_dir.clone()); + lib_search_paths.extend(extra_search_paths); + + let dirs = [ + &doc_dir, + &tmp_dir, + &audio_lib_dir, + &font_dir, + ]; + // 创建必要的目录 + Self::create_directories(&dirs)?; + + // 清理临时文件 + Self::cleanup_tmp(&tmp_dir)?; + + let config_file_path = doc_dir.clone() + "/config.json"; + let config = AppConfig::new(&config_file_path)?; + + // 加载词典列表 + let extra_library_path = config.get_config_with_default(ConfigSection::Global, ConfigKey::ExtraLibSearchPath, String::new()); + if !extra_library_path.is_empty() { + lib_search_paths.push(extra_library_path); + } + let library_file_path = doc_dir.clone() + "/library.json"; + let mut library_manager = LibraryManager::from_file(&library_file_path)?; + + // 自动扫描词典目录变化 + library_manager.refresh_library(&lib_search_paths)?; + library_manager.save_library()?; + + // Initialize unified database connection with mdict.db + let mdict_db_path = format!("{}mdict.db", doc_dir); + let conn = Connection::open(&mdict_db_path) + .map_err(|e| ZdbError::invalid_data_format(format!("Failed to open database: {}", e)))?; + + // Enable WAL mode for better concurrent access (ignore error for compatibility) + let _ = conn.query_row("PRAGMA journal_mode=WAL", [], |_| Ok(())); + + // Set busy timeout to handle lock contention + let _ = conn.query_row("PRAGMA busy_timeout=5000", [], |_| Ok(())); + + let db_connection = Arc::new(Mutex::new(conn)); + + // Initialize history and favorites managers with shared connection + let history_manager = HistoryManager::new(db_connection.clone())?; + let favorites_manager = FavoritesManager::new(db_connection.clone())?; + + let mut app = Self { + config, + library_manager, + db_connection, + history_manager, + favorites_manager, + data_home_dir, + _doc_dir: doc_dir, + tmp_dir, + _res_dir: res_dir, + _font_dir: font_dir, + _audio_lib_dir: audio_lib_dir, + lib_search_paths, + main_db: None, + group_search_results: LinkedList::new(), + assets: HashMap::new(), + app_handle: app_handle.clone(), + base_url: "mdx://mdict.cn/service/".to_string(), + }; + + // Load asset files into memory + app.load_assets(app_handle)?; + + // Auto-open last used profile or default group + log_if_err(&app.auto_open_startup_profile()); + Ok(app) + } + + /// 规范化目录路径,确保以/结尾 + fn normalize_dir_path(mut path: String) -> String { + if !path.is_empty() && !path.ends_with('/') && !path.ends_with('\\') { + path.push('/'); + } + path + } + + /// 创建必要的目录 + fn create_directories(dirs: &[&String]) -> Result<()> { + for dir in dirs.iter() { + if !dir.is_empty() && !std::path::Path::new(dir).exists() { + std::fs::create_dir_all(dir)?; + } + } + + Ok(()) + } + + /// 清理临时文件 + fn cleanup_tmp(tmp_dir: &String) -> Result<()> { + if !tmp_dir.is_empty() && std::path::Path::new(&tmp_dir).exists() { + if let Ok(entries) = std::fs::read_dir(&tmp_dir) { + for entry in entries.flatten() { + let _ = std::fs::remove_file(entry.path()); + } + } + } + Ok(()) + } + + /// 加载assets目录下的文件到内存 + fn load_assets(&mut self, app_handle: &tauri::AppHandle) -> Result<()> { + // 使用tauri的路径解析来获取assets目录 + let assets_dir = match app_handle.path().resolve("assets", BaseDirectory::Resource) { + Ok(path) => path, + Err(_) => { + // 如果无法解析resource目录,回退到传统方法 + let fallback_dir = if let Ok(exe_path) = std::env::current_exe() { + if let Some(exe_dir) = exe_path.parent() { + exe_dir.join("assets") + } else { + std::path::PathBuf::from("assets") + } + } else { + std::path::PathBuf::from("assets") + }; + + // 如果回退目录也不存在,尝试开发环境路径 + if !fallback_dir.exists() { + let dev_assets_dir = std::path::PathBuf::from("src-tauri/assets"); + if dev_assets_dir.exists() { + dev_assets_dir + } else { + return Err(ZdbError::invalid_parameter(format!("Assets directory not found: {:?}", fallback_dir))); + } + } else { + fallback_dir + } + } + }; + + // 确保assets目录存在 + if assets_dir.exists() { + // 递归读取目录下的所有文件 + self.load_assets_recursive(&assets_dir, &assets_dir)?; + log::info!("Loaded {} assets from {:?}", self.assets.len(), assets_dir); + }else{ + log::warn!("Assets directory not found: {:?}", assets_dir); + } + Ok(()) + } + + /// 递归加载assets目录下的文件 + fn load_assets_recursive(&mut self, current_dir: &std::path::Path, assets_root: &std::path::Path) -> Result<()> { + let entries = std::fs::read_dir(current_dir)?; + + for entry in entries { + let entry = entry?; + let file_path = entry.path(); + + if file_path.is_file() { + // 计算相对于assets根目录的路径 + let relative_path = file_path.strip_prefix(assets_root) + .map_err(|_| ZdbError::invalid_parameter(format!("无法计算相对路径: {:?}", file_path)))?; + + match std::fs::read(&file_path) { + Ok(content) => { + // 使用包含完整相对路径的key格式,例如"/subdir/file.html" + let asset_key = format!("/{}", relative_path.to_string_lossy().replace('\\', "/")); + self.assets.insert(asset_key.clone(), content); + log::info!("Loaded asset: {} ({} bytes)", asset_key, self.assets.get(&asset_key).unwrap().len()); + } + Err(e) => { + log::warn!("Failed to load asset {:?}: {}", relative_path, e); + } + } + } else if file_path.is_dir() { + // 递归处理子目录 + self.load_assets_recursive(&file_path, assets_root)?; + } + } + + Ok(()) + } + + pub fn open_main_db(&mut self, profile_id: ProfileId) -> Result<()> { + self.main_db = None; + // Clear cached search results when switching databases + self.group_search_results.clear(); + if profile_id != INVALID_PROFILE_ID { + let profile = self.library_manager.find_profile(profile_id).ok_or_else(|| ZdbError::invalid_parameter(format!("Profile {} not found", profile_id)))?; + if profile.is_group() { + let db = MdxDbGroup::new(&profile, &self.data_home_dir).map_err(|e| ZdbError::invalid_data_format(format!("Failed to open group database: {}: {}", profile_id, e)))?; + self.main_db = Some(DbType::MdxDbGroup(db)); + } else { + let db = MdxDb::new(&profile, &self.data_home_dir).map_err(|e| ZdbError::invalid_data_format(format!("Failed to open database: {}: {}", profile_id, e)))?; + self.main_db = Some(DbType::MdxDb(db)); + } + }else{ + return Err(ZdbError::invalid_parameter(format!("Invalid profile ID: {}", profile_id))); + } + // Update last_main_profile_id in config + self.config.set_config(ConfigSection::Global, ConfigKey::LastMainProfileId, profile_id)?; + self.config.save()?; + + Ok(()) + } + + /// Search for words in group mode and cache results + pub fn incremental_search(&mut self, query: &str, max_results_per_lib: usize) -> Result> { + // Clear cached grouped results for fresh incremental search + self.group_search_results.clear(); + if let Some(DbType::MdxDb(ref mut db)) = self.main_db { + // Find best matching entry + if let Some(best_match) = db.find_index(query, true, true, true)? { + // Get a list of entries starting from the best match + let start_entry = best_match.key_index.entry_no; + Ok(Some((start_entry, db.get_entry_count() as usize))) + } else { + Ok(None) + } + } else if let Some(DbType::MdxDbGroup(ref mut group_db)) = self.main_db { + // Delegate grouped search to MdxDbGroup and cache results + let cached_results = group_db.find_best_match_indexes(query, max_results_per_lib)?; + self.group_search_results = cached_results; + if self.group_search_results.is_empty() { + Ok(None) + } else { + Ok(Some((0, self.group_search_results.len()))) + } + } else { + Err(ZdbError::invalid_parameter("No database opened".to_string())) + } + } + + /// Perform full-text search and cache grouped results + /// Returns total result count + pub fn fulltext_search(&mut self, query: &str, max_results_per_lib: usize) -> Result { + // Reset previous cached results + self.group_search_results.clear(); + + match &mut self.main_db { + Some(DbType::MdxDb(db)) => { + let mut group_results : LinkedList<(String, String, LinkedList)> = LinkedList::new(); + let results = db.fulltext_find(query, max_results_per_lib)?; + for (_score, index) in results.into_iter() { + let mut group_index=MdxGroupIndex { + profile_id: index.profile_id, + primary_key: index.key_index.key.clone(), + indexes: LinkedList::new(), + }; + group_index.indexes.push_back(index.clone()); + let mut group_indexes = LinkedList::new(); + group_indexes.push_back(group_index); + group_results.push_back((MdxDb::normalize_keyword(&index.key_index.key), index.key_index.key.clone(), group_indexes)); + } + + self.group_search_results = group_results; + Ok(self.group_search_results.len()) + } + Some(DbType::MdxDbGroup(group_db)) => { + // Group dictionary mode: delegate to group's fulltext_find + let results = group_db.fulltext_find(query, max_results_per_lib)?; + self.group_search_results = results; + Ok(self.group_search_results.len()) + } + None => Err(ZdbError::invalid_parameter("No database opened".to_string())), + } + } + + /// Get HTML content for a single entry + pub fn get_entry_html_by_index(&mut self, index:&MdxIndex) -> Result { + match &mut self.main_db { + Some(DbType::MdxDb(db)) => { + let index = db.get_index(index.key_index.entry_no)?; + return db.get_html(&index, &self.base_url); + } + Some(DbType::MdxDbGroup(group_db)) => { + if let Some(mdx_db) = group_db.mdx_dbs.get_mut(&index.profile_id) { + let index = mdx_db.get_index(index.key_index.entry_no)?; + return mdx_db.get_html(&index, &self.base_url); + } else { + return Err(ZdbError::invalid_parameter(format!("Library with profile_id {} not found in group", index.profile_id))); + } + } + None => return Err(ZdbError::invalid_parameter("No database opened".to_string())) + } + } + + /// Get binary data from MDD file, returns (data, mime_type) + pub fn get_mdd_data(&mut self, profile_id: &ProfileId, file_path: &str) -> Result, String)>> { + if file_path=="/$MdxDictIcon" { + return self.library_manager.get_icon_for_profile(*profile_id); + } + + match &mut self.main_db { + Some(DbType::MdxDb(db)) => { + if db.profile.profile_id != *profile_id { + Err(ZdbError::invalid_parameter(format!("Library id not match {}", profile_id))) + } else { + db.get_data(file_path) + } + } + Some(DbType::MdxDbGroup(group_db)) => { + if let Some(mdx_db) = group_db.mdx_dbs.get_mut(&profile_id) { + mdx_db.get_data(file_path) + } else { + Err(ZdbError::invalid_parameter(format!("Library with profile_id {} not found in group", profile_id))) + } + } + None => Err(ZdbError::invalid_parameter("No database opened".to_string())) + } + } + + // NOTE: is_single_library_mode and is_group_mode methods have been moved to lib.rs + // and are now computed from main_db_profile instead of being implemented here + + /// Auto-open profile on startup based on configuration + fn auto_open_startup_profile(&mut self) -> Result<()> { + // Get last_main_profile_id from config + let mut last_profile_id: ProfileId = self.config.get_config_with_default( + ConfigSection::Global, + ConfigKey::LastMainProfileId, + INVALID_PROFILE_ID + ); + + if last_profile_id == INVALID_PROFILE_ID { + last_profile_id = DEFAULT_GROUP_ID; + } + let profile= self.library_manager.find_profile(last_profile_id); + if profile.is_some() { + let profile= profile.unwrap(); + if profile.is_group() && (profile.get_profiles().is_none() || profile.get_profiles().unwrap().is_empty()) { + last_profile_id = INVALID_PROFILE_ID; + } + }else{ + last_profile_id = INVALID_PROFILE_ID; + } + + if last_profile_id != INVALID_PROFILE_ID { + self.open_main_db(last_profile_id)?; + } + Ok(()) + } + + /// 结束应用 + pub fn term_app(&mut self) -> Result<()> { + // 保存所有配置 + self.config.save()?; + + // 保存词典列表 + let library_path = self.config.get_config_with_default(ConfigSection::Global, ConfigKey::ExtraLibSearchPath, String::new()); + self.library_manager.to_file(&library_path)?; + + // 清理临时文件 + Self::cleanup_tmp(&self.tmp_dir)?; + + Ok(()) + } + + /// 获取base URL + pub fn get_base_url(&self) -> &str { + &self.base_url + } + + /// 设置base URL + pub fn set_base_url(&mut self, base_url: String) -> Result<()> { + log::info!("Setting base URL: {}", base_url); + self.base_url = base_url; + Ok(()) + } + + /// 获取库搜索路径 + pub fn get_lib_search_paths(&self) -> Result<&[String]> { + Ok(&self.lib_search_paths) + } + + /// 添加库搜索路径 + pub fn add_lib_search_path(&mut self, path: String) -> Result<()> { + self.lib_search_paths.push(path); + Ok(()) + } + + /// 清空库搜索路径 + pub fn clear_lib_search_paths(&mut self) -> Result<()> { + self.lib_search_paths.clear(); + Ok(()) + } + + /// 获取asset文件内容(二进制) + pub fn get_asset(&self, filename: &str) -> Result>> { + Ok(self.assets.get(filename)) + } + + /// 获取asset文件内容(文本) + pub fn get_asset_text(&self, filename: &str) -> Result> { + Ok(self.assets.get(filename).and_then(|bytes| String::from_utf8(bytes.clone()).ok())) + } + + /// 获取当前主数据库的profile_id,如果没有则返回INVALID_PROFILE_ID + pub fn get_current_main_profile_id(&self) -> Result { + Ok(match &self.main_db { + Some(DbType::MdxDb(db)) => db.profile.profile_id, + Some(DbType::MdxDbGroup(db)) => db.profile.profile_id, + None => INVALID_PROFILE_ID, + }) + } + + /// 获取当前主数据库的profile对象 + pub fn get_current_main_profile(&self) -> Result> { + Ok(match &self.main_db { + Some(DbType::MdxDb(db)) => Some(db.profile.clone()), + Some(DbType::MdxDbGroup(db)) => Some(db.profile.clone()), + None => None, + }) + } + + pub fn get_content_url(&self, index_no: usize) -> Result { + if let Some(DbType::MdxDb(db)) = &self.main_db { + Ok(format!("{}entryx?profile_id={}&entry_no={}", self.base_url, db.profile.profile_id, index_no )) + } else if let Some(DbType::MdxDbGroup(_group_db)) = &self.main_db { + Ok(format!("{}union?index_no={}", self.base_url, index_no)) + } else { + Err(ZdbError::invalid_parameter("No database opened".to_string())) + } + } + + /// Get the total entry count for the current database + pub fn get_entry_count(&self) -> Result { + // Prefer cached grouped results if available (e.g., full-text/group searches) + if !self.group_search_results.is_empty() { + return Ok(self.group_search_results.len()); + } + + match &self.main_db { + Some(DbType::MdxDb(db)) => { + Ok(db.get_entry_count() as usize) + } + Some(DbType::MdxDbGroup(_group_db)) => { + // For group mode, return the count of cached search results + Ok(self.group_search_results.len()) + } + None => Err(ZdbError::invalid_parameter("No database opened".to_string())) + } + } + + /// Find the best matching entry index for a given key + /// Returns LinkedList where: + /// - Single dictionary mode: returns single MdxGroupIndex with one result + /// - Group mode: returns MdxGroupIndex entries grouped by profile_id + pub fn find_index(&mut self, key: &str) -> Result> { + let mut result = LinkedList::new(); + + match &mut self.main_db { + Some(DbType::MdxDb(db)) => { + // Single dictionary mode: wrap MdxIndex in MdxGroupIndex and put in LinkedList + if let Some(mdx_index) = db.find_index(key, false, false, true)? { + let mut group_index = MdxGroupIndex::default(); + group_index.profile_id = db.profile.profile_id; + group_index.primary_key = key.to_string(); + group_index.indexes = LinkedList::new(); + group_index.indexes.push_back(mdx_index); + result.push_back(group_index); + } + Ok(result) + } + Some(DbType::MdxDbGroup(group_db)) => { + // Group mode: search across all dictionaries and group by profile_id + let mut profile_groups = std::collections::HashMap::::new(); + + for mdx_db in group_db.mdx_dbs.values_mut() { + if let Some(mdx_index) = mdx_db.find_index(key, false, false, true)? { + let profile_id = mdx_index.profile_id; + + // Get or create MdxGroupIndex for this profile_id + let group_index = profile_groups.entry(profile_id).or_insert_with(|| { + MdxGroupIndex { + profile_id, + primary_key: key.to_string(), + indexes: LinkedList::new(), + } + }); + + // Add the found index to this profile's group + group_index.indexes.push_back(mdx_index); + } + } + + // Convert HashMap to LinkedList, sorted by profile order + if let Some(profiles) = group_db.profile.get_profiles() { + for profile in profiles.iter() { + if let Some(group_index) = profile_groups.remove(&profile.profile_id) { + result.push_back(group_index); + } + } + } + + Ok(result) + } + None => Ok(result), + } + } + + + /// Get entries starting from a specific index + /// Unified method that works for both single dictionary and group modes + /// Returns Vec of (keyword, entry_count) + pub fn get_result_key_list(&mut self, start_index: i64, max_count: usize) -> Result> { + // If we have cached grouped results (e.g., from full-text or grouped search), use them regardless of mode + if !self.group_search_results.is_empty() { + if start_index >= self.group_search_results.len() as i64 { + return Err(ZdbError::invalid_parameter(format!("Start index out of range: {} >= {}", start_index, self.group_search_results.len()))); + } + let mut results = LinkedList::new(); + for (_, display_key, group_indexes) in self.group_search_results.iter().skip(start_index as usize) { + // Entry count equals number of dictionaries (profile groups) contributing to this key + let group_count = group_indexes.len(); + results.push_back((display_key.clone(), group_count)); + if results.len() >= max_count { + break; + } + } + return Ok(results); + } + + match &mut self.main_db { + Some(DbType::MdxDb(db)) => { + // Single dictionary mode: get entries directly from the dictionary + let indexes = db.get_indexes(start_index, max_count as u64)?; + let mut results = LinkedList::new(); + for index in indexes { + let keyword = index.key_index.key.clone(); + // For single dictionary mode, group count is always 1 + results.push_back((keyword, 1)); + } + Ok(results) + } + Some(DbType::MdxDbGroup(_group_db)) => { + // Group mode: get entries from cached search results + // If we reached here, it means we have no cached grouped results + return Ok(LinkedList::new()); + } + None => Err(ZdbError::invalid_parameter("No database opened".to_string())), + } + } + + /// Navigate to a URL by emitting an event to the frontend + pub fn navigate_to(&self, url: &str) -> Result<()> { + log::info!("Navigating to URL: {}", url); + self.app_handle.emit("navigate_to", url).map_err(|e| ZdbError::invalid_data_format(format!("Failed to emit navigate_to event: {}", e)))?; + Ok(()) + } + + /// Reload resources (assets and HTML templates) + pub fn reload_resources(&mut self) -> Result<()> { + log::info!("Reloading resources..."); + + // Clear existing assets and templates + self.assets.clear(); + + // Reload assets + self.load_assets(&self.app_handle.clone())?; + log::info!("Resources reloaded successfully. {} assets", self.assets.len()); + Ok(()) + } + + /// Get indexes for a specific entry position, returning grouped data + /// Returns LinkedList + pub fn get_group_indexes(&mut self, index_no: usize) -> Result> { + // If we have cached grouped results, return from cache regardless of mode + if !self.group_search_results.is_empty() { + if index_no >= self.group_search_results.len() { + return Err(ZdbError::invalid_parameter(format!("Index out of range: {} >= {}", index_no, self.group_search_results.len()))); + } + return Ok(self.group_search_results.iter().nth(index_no).unwrap().2.clone()); + } + + match &mut self.main_db { + Some(DbType::MdxDb(db)) => { + // Single dictionary mode: return one MdxGroupIndex with single index + if index_no >= db.get_entry_count() as usize { + return Err(ZdbError::invalid_parameter(format!("Index out of range: {} >= {}", index_no, db.get_entry_count() as usize))); + } + + let mdx_index = db.get_index(index_no as i64)?; + let mut indexes = LinkedList::new(); + indexes.push_back(mdx_index.clone()); + + let group_index = MdxGroupIndex { + profile_id: db.profile.profile_id, + primary_key: mdx_index.key_index.key.clone(), + indexes, + }; + let mut result = LinkedList::new(); + result.push_back(group_index); + return Ok(result); + } + Some(DbType::MdxDbGroup(_group_db)) => { + // Group mode without cache + return Err(ZdbError::invalid_parameter("No grouped search results available".to_string())); + } + None => return Err(ZdbError::invalid_parameter("No database opened".to_string())) + } + } +} + +/// 全局MdictApp实例 +static GLOBAL_MDICT_APP: OnceCell> = OnceCell::new(); + +/// 初始化全局MdictApp +pub fn init_mdict_app>(app_home_dir: P, extra_search_paths: Vec, app_handle: &tauri::AppHandle) -> Result<()> { + let app = MdictApp::init_app_with_home_dir( app_home_dir, extra_search_paths, app_handle)?; + let app_lock = RwLock::new(app); + + GLOBAL_MDICT_APP.set(app_lock) + .map_err(|_| ZdbError::invalid_parameter("全局MdictApp已经初始化".to_string()))?; + + Ok(()) +} + +/// 获取全局MdictApp +fn get_mdict_app() -> Result<&'static RwLock> { + GLOBAL_MDICT_APP.get() + .ok_or_else(|| ZdbError::invalid_parameter("全局MdictApp尚未初始化".to_string())) +} + +fn mdict_app() -> Result<&'static RwLock> { + get_mdict_app() +} + +/// 简化的模板方法:统一处理读操作的访问模式 +pub fn with_read_access(operation: F) -> Result +where + F: FnOnce(&MdictApp) -> Result, +{ + let app_lock = mdict_app()?; + let app = app_lock.read() + .map_err(|_| ZdbError::invalid_parameter("无法获取MdictApp读锁".to_string()))?; + operation(&app) +} + +/// 简化的模板方法:统一处理写操作的访问模式 +pub fn with_write_access(operation: F) -> Result +where + F: FnOnce(&mut MdictApp) -> Result, +{ + let app_lock = mdict_app()?; + let mut app = app_lock.write() + .map_err(|_| ZdbError::invalid_parameter("无法获取MdictApp写锁".to_string()))?; + operation(&mut app) +} + +/// 简化的模板方法:统一处理配置相关的读操作 +pub fn with_config_read(operation: F) -> Result +where + F: FnOnce(&AppConfig) -> Result, +{ + let app_lock = mdict_app()?; + let app = app_lock.read() + .map_err(|_| ZdbError::invalid_parameter("无法获取MdictApp读锁".to_string()))?; + operation(&app.config) +} + +/// 简化的模板方法:统一处理配置相关的写操作 +pub fn with_config_write(operation: F) -> Result +where + F: FnOnce(&mut AppConfig) -> Result, +{ + let app_lock = mdict_app()?; + let mut app = app_lock.write() + .map_err(|_| ZdbError::invalid_parameter("无法获取MdictApp写锁".to_string()))?; + operation(&mut app.config) +} + +/// 简化的模板方法:统一处理库管理器相关的读操作 +pub fn with_library_read(operation: F) -> Result +where + F: FnOnce(&LibraryManager) -> Result, +{ + let app_lock = mdict_app()?; + let app = app_lock.read() + .map_err(|_| ZdbError::invalid_parameter("无法获取MdictApp读锁".to_string()))?; + operation(&app.library_manager) +} + +/// 简化的模板方法:统一处理库管理器相关的写操作 +pub fn with_library_write(operation: F) -> Result +where + F: FnOnce(&mut LibraryManager) -> Result, +{ + let app_lock = mdict_app()?; + let mut app = app_lock.write() + .map_err(|_| ZdbError::invalid_parameter("无法获取MdictApp写锁".to_string()))?; + operation(&mut app.library_manager) +} + +/// 简化的模板方法:统一处理历史记录相关的读操作 +pub fn with_history_read(operation: F) -> Result +where + F: FnOnce(&HistoryManager) -> Result, +{ + let app_lock = mdict_app()?; + let app = app_lock.read() + .map_err(|_| ZdbError::invalid_parameter("无法获取MdictApp读锁".to_string()))?; + operation(&app.history_manager) +} + +/// 简化的模板方法:统一处理历史记录相关的写操作 +pub fn with_history_write(operation: F) -> Result +where + F: FnOnce(&mut HistoryManager) -> Result, +{ + let app_lock = mdict_app()?; + let mut app = app_lock.write() + .map_err(|_| ZdbError::invalid_parameter("无法获取MdictApp写锁".to_string()))?; + operation(&mut app.history_manager) +} + +/// 简化的模板方法:统一处理收藏相关的读操作 +pub fn with_favorites_read(operation: F) -> Result +where + F: FnOnce(&FavoritesManager) -> Result, +{ + let app_lock = mdict_app()?; + let app = app_lock.read() + .map_err(|_| ZdbError::invalid_parameter("无法获取MdictApp读锁".to_string()))?; + operation(&app.favorites_manager) +} + +/// 简化的模板方法:统一处理收藏相关的写操作 +pub fn with_favorites_write(operation: F) -> Result +where + F: FnOnce(&mut FavoritesManager) -> Result, +{ + let app_lock = mdict_app()?; + let mut app = app_lock.write() + .map_err(|_| ZdbError::invalid_parameter("无法获取MdictApp写锁".to_string()))?; + operation(&mut app.favorites_manager) +} diff --git a/rust/src-tauri/src/mdx_db.rs b/rust/src-tauri/src/mdx_db.rs new file mode 100644 index 0000000000000000000000000000000000000000..ad56bbad443544c75bdeeb375ef08ddd6c7dd9ed --- /dev/null +++ b/rust/src-tauri/src/mdx_db.rs @@ -0,0 +1,143 @@ +use std::collections::LinkedList; +use serde::{Serialize, Deserialize}; +use url::Url; + +use mdx::{Result, MdxReader}; +use mdx::storage::{KeyIndex, EntryNo}; +use mdx::utils::MdxHtmlRewriter; + +use crate::mdx_profile::{MdxProfile, ProfileId}; + + +#[derive(Clone, Debug, Default, Serialize, Deserialize)] +pub struct MdxIndex { + pub profile_id: ProfileId, + pub key_index: KeyIndex, +} + +pub struct MdxDb { + pub profile: MdxProfile, + pub mdx_reader: MdxReader, + +} + +impl MdxDb { + pub fn new(profile: &MdxProfile, device_id: &str) -> Result { + let mdx_reader = MdxReader::from_url( + &Url::parse(&profile.url)?, + device_id, + )?; + + Ok(Self { + profile: profile.clone(), + mdx_reader, + }) + } + + pub fn get_title(&self) -> &String{ + &self.mdx_reader.db_name + } + + pub fn get_description(&self) -> String{ + self.mdx_reader.content_db.meta.db_info.description.clone() + } + + pub fn get_entry_count(&self) -> u64 { + self.mdx_reader.get_entry_count() + } + + pub fn get_index(&mut self, entry_no: EntryNo) -> Result { + Ok(MdxIndex { + profile_id: self.profile.profile_id, + key_index: self.mdx_reader.get_index(entry_no)?.into(), + }) + } + + pub fn get_indexes(&mut self, start_entry_no: EntryNo, max_count: u64) -> Result> { + let indexes = self.mdx_reader.get_indexes(start_entry_no, max_count)?; + let mut mdx_indexes = LinkedList::new(); + for index in indexes { + mdx_indexes.push_back(MdxIndex { + profile_id: self.profile.profile_id, + key_index: index.into(), + }); + } + Ok(mdx_indexes) + } + + pub fn find_index(&mut self, key: &str, prefix_match: bool, partial_match: bool, best_match: bool) -> Result> { + let key_index = self.mdx_reader.find_index(key, prefix_match, partial_match, best_match)?; + if let Some(key_index) = key_index { + Ok(Some(MdxIndex { + profile_id: self.profile.profile_id, + key_index: key_index.into(), + })) + } else { + Ok(None) + } + } + + pub fn normalize_keyword(keyword: &str) -> String { + keyword.chars() + .filter(|c| c.is_alphabetic()) + .map(|c| c.to_lowercase().collect::()) + .collect::() + } + + pub fn find_similar_index(&mut self, key: &str, prefix_match: bool, partial_match: bool, best_match: bool, max_results: usize) -> Result> { + let key_index = self.mdx_reader.find_index(key, prefix_match, partial_match, best_match)?; + let mut mdx_indexes = LinkedList::new(); + if let Some(key_index) = key_index { + mdx_indexes.push_back(MdxIndex { + profile_id: self.profile.profile_id, + key_index: key_index.clone(), + }); + let normalized_key = Self::normalize_keyword(&key_index.key); + for i in 1 .. std::cmp::min(max_results as u64, self.get_entry_count() - key_index.entry_no as u64) { + let index = self.mdx_reader.get_index(key_index.entry_no + i as EntryNo)?; + if normalized_key == Self::normalize_keyword(&index.key) { + mdx_indexes.push_back(MdxIndex { + profile_id: self.profile.profile_id, + key_index: index.into(), + }); + }else { + break; + } + } + } + Ok(mdx_indexes) + } + + //Get the contents of the entry + pub fn get_html(&mut self, entry: &MdxIndex, base_url:&str)->Result { + let key_index: KeyIndex = entry.key_index.clone().into(); + MdxHtmlRewriter::rewrite_html_with_base_url(&self.mdx_reader.get_html(&key_index)?, self.profile.profile_id, base_url) + } + + pub fn get_data(&mut self, file_path:&str) -> Result, String)>> { + self.mdx_reader.get_data(file_path) + } + + /// Perform full-text search on the database content + /// Returns a vector of MdxIndex results with their search scores + pub fn fulltext_find(&mut self, query: &str, max_results: usize) -> Result> { + let search_results = self.mdx_reader.fts_search(query, max_results)?; + let mut mdx_results = Vec::new(); + + for (score, entry_no, _key) in search_results { + let key_index = self.mdx_reader.get_index(entry_no)?; + let mdx_index = MdxIndex { + profile_id: self.profile.profile_id, + key_index: key_index.into(), + }; + mdx_results.push((score, mdx_index)); + } + + Ok(mdx_results) + } + + /// Check if full-text search is available for this database + pub fn is_fts_available(&self) -> bool { + self.mdx_reader.is_fts_available() + } +} \ No newline at end of file diff --git a/rust/src-tauri/src/mdx_db_group.rs b/rust/src-tauri/src/mdx_db_group.rs new file mode 100644 index 0000000000000000000000000000000000000000..a657a07d0e43877e0dba3e688b582206e2a7d284 --- /dev/null +++ b/rust/src-tauri/src/mdx_db_group.rs @@ -0,0 +1,188 @@ +use std::collections::{HashMap, LinkedList}; + +use mdx::{Result, ZdbError}; + +use crate::mdx_db::{MdxDb, MdxIndex}; +use crate::mdx_profile::{MdxProfile, ProfileId}; + +#[derive(Default, Debug, Clone, serde::Serialize)] +pub struct MdxGroupIndex { + pub profile_id: ProfileId, + pub primary_key: String, + pub indexes: LinkedList, +} + +pub struct MdxDbGroup { + pub profile: MdxProfile, + pub mdx_dbs: HashMap, +} + +impl MdxDbGroup { + pub fn new(profile: &MdxProfile, device_id: &str) -> Result { + if !profile.as_union || profile.get_profiles().is_none() { + return Err(ZdbError::invalid_parameter("Not a union group or no sub profiles")); + } + let mut mdx_dbs = HashMap::new(); + for profile in profile.get_profiles().unwrap().iter() { + if !profile.disabled { + let mdx_db = MdxDb::new(profile, device_id)?; + mdx_dbs.insert(profile.profile_id, mdx_db); + } + } + Ok(Self { profile: profile.clone(), mdx_dbs }) + } + + pub fn find_best_match_indexes(&mut self, query: &str, max_results_per_lib: usize) -> Result)>> { + // Map normalized_key -> (display_key, Map>) + let mut merged_results = std::collections::BTreeMap::< + String, + ( + String, + std::collections::BTreeMap>, + ), + >::new(); + + let normalized_query = MdxDb::normalize_keyword(query); + // Search in each library within the group + for mdx_db in self.mdx_dbs.values_mut() { + if let Some(best_match) = mdx_db.find_index(query, true, true, true)? { + let start_entry = best_match.key_index.entry_no; + if let Ok(indexes) = mdx_db.get_indexes(start_entry, max_results_per_lib as u64) { + for index in indexes { + // Normalize keyword for merging (ignore case and non-alphabetic characters) + let normalized_key = MdxDb::normalize_keyword(&index.key_index.key); + let original_key = index.key_index.key.clone(); + + if normalized_key max_results_per_lib && &normalized_key>merged_results.last_entry().unwrap().key() { + break; + } + // Ensure entry for normalized key exists with display key + let entry = merged_results + .entry(normalized_key) + .or_insert_with(|| (original_key, std::collections::BTreeMap::new())); + + // Group indexes by profile_id under this key + let per_profile_indexes = entry + .1 + .entry(index.profile_id) + .or_insert_with(|| LinkedList::new()); + per_profile_indexes.push_back(index); + + if merged_results.len() > max_results_per_lib{ + merged_results.pop_last(); + } + } + } + } + } + + // Build results: each key maps to a LinkedList of MdxGroupIndex, + // where each MdxGroupIndex contains indexes from a single profile_id + // Sort by profile order in the group's profile list + let mut results = LinkedList::new(); + for (normalized_key, (display_key, per_profile_map)) in merged_results { + let mut group_index_list = LinkedList::new(); + + // Sort profile_ids by their order in the group's profiles list + if let Some(profiles) = self.profile.get_profiles() { + for profile in profiles.iter() { + if let Some(indexes) = per_profile_map.get(&profile.profile_id) { + let group_index = MdxGroupIndex { + profile_id: profile.profile_id, + primary_key: display_key.clone(), + indexes: indexes.clone(), + }; + group_index_list.push_back(group_index); + } + } + } + + results.push_back((normalized_key, display_key, group_index_list)); + } + + Ok(results) + } + + /// Perform full-text search across all libraries in the group + /// Behavior is similar to `MdxDbGroup::find_index`, but uses `MdxDb::search_fulltext` + /// to collect results per library, then merges them by normalized key + pub fn fulltext_find(&mut self, query: &str, max_results_per_lib: usize) -> Result)>> { + // Map normalized_key -> (display_key, Map>) + let mut merged_results = std::collections::BTreeMap::< + String, + ( + String, + std::collections::BTreeMap>, + ), + >::new(); + + // Search in each library within the group using full-text search when available + for mdx_db in self.mdx_dbs.values_mut() { + if !mdx_db.is_fts_available() { continue; } + + if let Ok(results) = mdx_db.fulltext_find(query, max_results_per_lib) { + for (_score, index) in results { + // Normalize keyword for merging (ignore case and non-alphabetic characters) + let normalized_key = MdxDb::normalize_keyword(&index.key_index.key); + let original_key = index.key_index.key.clone(); + + // Ensure entry for normalized key exists with display key + let entry = merged_results + .entry(normalized_key) + .or_insert_with(|| (original_key, std::collections::BTreeMap::new())); + + // Group indexes by profile_id under this key + let per_profile_indexes = entry + .1 + .entry(index.profile_id) + .or_insert_with(|| LinkedList::new()); + per_profile_indexes.push_back(index); + } + } + } + + // Build results: each key maps to a LinkedList of MdxGroupIndex, + // where each MdxGroupIndex contains indexes from a single profile_id + // Sort by profile order in the group's profile list + let mut results = LinkedList::new(); + for (_normalized_key, (display_key, per_profile_map)) in merged_results { + let mut group_index_list = LinkedList::new(); + + // Sort profile_ids by their order in the group's profiles list + if let Some(profiles) = self.profile.get_profiles() { + for profile in profiles.iter() { + if let Some(indexes) = per_profile_map.get(&profile.profile_id) { + let group_index = MdxGroupIndex { + profile_id: profile.profile_id, + primary_key: display_key.clone(), + indexes: indexes.clone(), + }; + group_index_list.push_back(group_index); + } + } + } + + // Use normalized value of display_key as the map key similar to find_index + let normalized_key = MdxDb::normalize_keyword(&display_key); + results.push_back((normalized_key, display_key, group_index_list)); + } + + Ok(results) + } + + pub fn get_html(&mut self, entry: &MdxIndex, base_url: &str)->Result { + let mdx_db = self.mdx_dbs.get_mut(&entry.profile_id).unwrap(); + mdx_db.get_html(entry, base_url) + } + + pub fn is_fts_available(&self) -> bool { + for mdx_db in self.mdx_dbs.values() { + if mdx_db.is_fts_available() { + return true; + } + } + false + } +} \ No newline at end of file diff --git a/rust/src-tauri/src/mdx_profile.rs b/rust/src-tauri/src/mdx_profile.rs new file mode 100644 index 0000000000000000000000000000000000000000..686a3c90f0c52cd7c2734c8cfe9da468b7a1312d --- /dev/null +++ b/rust/src-tauri/src/mdx_profile.rs @@ -0,0 +1,202 @@ +use std::collections::LinkedList; +use serde::{Deserialize, Serialize}; +use url::Url; + +use mdx::utils::{get_decoded_file_stem, with_extension}; + + +pub type ProfileId = i32; + +pub const DEFAULT_GROUP_ID: ProfileId = 1; +pub const INVALID_PROFILE_ID: ProfileId = -1; + + +#[derive(Serialize, Deserialize, Default, Clone)] +#[serde(rename_all = "camelCase")] +pub struct MdxOptions { + pub font_file_path: String, +} + +#[derive(Deserialize, Default, Clone)] +#[serde(rename_all = "camelCase")] +pub struct MdxProfile { + pub title: String, + pub description: String, + pub url: String, + pub disabled: bool, + pub profile_id: ProfileId, + pub options: MdxOptions, + + // Group-related fields (when this profile acts as a group) + #[serde(default)] + pub profiles: Option>, + #[serde(default)] + pub as_union: bool, +} + +// Custom Serialize implementation to include computed is_fts_enabled field +impl Serialize for MdxProfile { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + + let mut state = serializer.serialize_struct("MdxProfile", 9)?; + state.serialize_field("title", &self.title)?; + state.serialize_field("description", &self.description)?; + state.serialize_field("url", &self.url)?; + state.serialize_field("disabled", &self.disabled)?; + state.serialize_field("profileId", &self.profile_id)?; + state.serialize_field("options", &self.options)?; + state.serialize_field("profiles", &self.profiles)?; + state.serialize_field("asUnion", &self.as_union)?; + state.serialize_field("isFtsEnabled", &self.is_fts_enabled())?; + state.end() + } +} + +impl MdxProfile { + /// Check if this profile acts as a group + pub fn is_group(&self) -> bool { + self.profiles.is_some() + } + + pub fn is_fts_enabled(&self) -> bool { + if let Some(profiles) = &self.profiles { + return profiles.iter().any(|p| p.is_fts_enabled()); + }else{ + let idx_url = with_extension(&Url::parse(&self.url).unwrap(), "idx").unwrap(); + return idx_url.to_file_path().unwrap().exists(); + } + } + + /// Get profiles if this is a group + pub fn get_profiles(&self) -> Option<&LinkedList> { + self.profiles.as_ref() + } + + /// Get mutable profiles if this is a group + pub fn get_profiles_mut(&mut self) -> Option<&mut LinkedList> { + self.profiles.as_mut() + } + + + /// Get a profile by ID if this is a group + pub fn get_profile(&self, profile_id: ProfileId) -> Option<&MdxProfile> { + self.profiles.as_ref()?.iter().find(|p| p.profile_id == profile_id) + } + + /// Get a mutable profile by ID if this is a group + pub fn get_profile_mut(&mut self, profile_id: ProfileId) -> Option<&mut MdxProfile> { + self.profiles.as_mut()?.iter_mut().find(|p| p.profile_id == profile_id) + } + + /// Replace or add a profile in this group + /// + /// # Arguments + /// * `mdx_profile` - The profile to add or replace + /// * `next_id` - The ID to assign if this is a new profile + pub fn replace_profile(&mut self, mdx_profile: &MdxProfile, next_id: ProfileId) { + if self.profiles.is_none() { + self.profiles = Some(LinkedList::new()); + } + + let profiles = self.profiles.as_mut().unwrap(); + let profile = profiles.iter_mut().find(|p| p.profile_id == mdx_profile.profile_id); + if let Some(profile) = profile { + *profile = mdx_profile.clone(); + } else { + let mut new_profile = mdx_profile.clone(); + new_profile.profile_id = next_id; + profiles.push_back(new_profile); + } + } + + + /// Adjust profile order within this group + pub fn adjust_profile_order(&mut self, profile_id: ProfileId, new_index: usize) { + if let Some(profiles) = &mut self.profiles { + let mut target_profile: Option = None; + let mut new_profiles = LinkedList::new(); + + // Collect all profiles except the target + for profile in profiles.iter() { + if profile.profile_id != profile_id { + new_profiles.push_back(profile.clone()); + } else { + target_profile = Some(profile.clone()); + } + } + + // Insert the target profile at the new position + if let Some(profile) = target_profile { + let mut result_profiles = LinkedList::new(); + let mut current_index = 0; + + for existing_profile in new_profiles.iter() { + if current_index == new_index { + result_profiles.push_back(profile.clone()); + } + result_profiles.push_back(existing_profile.clone()); + current_index += 1; + } + + // If new_index is beyond the range, add the profile at the end + if new_index >= new_profiles.len() { + result_profiles.push_back(profile); + } + + *profiles = result_profiles; + } + } + } + + /// Create a new profile (group or individual) + /// + /// # Arguments + /// * `title_or_url` - For groups: the title; For individual profiles: the URL + /// * `profile_id` - The unique ID for this profile + /// * `is_group` - If true, creates a group profile; if false, creates an individual profile + pub fn new(title_or_url: String, profile_id: ProfileId, is_group: bool) -> Self { + if is_group { + // For groups: title_or_url is the title, url is empty + Self { + title: title_or_url, + description: String::new(), + url: String::new(), + disabled: false, + profile_id, + options: MdxOptions::default(), + profiles: Some(LinkedList::new()), + as_union: true, + } + } else { + // For individual profiles: title_or_url is the URL, title is derived from URL + let url = Url::parse(&title_or_url).unwrap_or(Url::parse("file://").unwrap()); + let title = get_decoded_file_stem(&url).unwrap_or_default(); + Self { + title, + description: String::new(), + url: title_or_url, + disabled: false, + profile_id, + options: MdxOptions::default(), + profiles: None, + as_union: false, + } + } + } + + /// Create a new group profile (convenience method) + pub fn new_group(title: String, profile_id: ProfileId) -> Self { + Self::new(title, profile_id, true) + } + + /// Create a new individual profile (convenience method) + pub fn new_profile(title: String, url: String, profile_id: ProfileId) -> Self { + let mut profile = Self::new(url, profile_id, false); + profile.title = title; // Override the auto-derived title with the provided one + profile + } +} \ No newline at end of file diff --git a/rust/src-tauri/src/mdx_url_parser.rs b/rust/src-tauri/src/mdx_url_parser.rs new file mode 100644 index 0000000000000000000000000000000000000000..f7d136aff8851f23ba4a528de8f83c2d2e097aa9 --- /dev/null +++ b/rust/src-tauri/src/mdx_url_parser.rs @@ -0,0 +1,72 @@ +use crate::error::{Result, ZdbError}; + +#[derive(Debug, PartialEq, Eq, Clone, Copy, Default, Hash)] +#[repr(i32)] +pub enum MdxAction { + #[default] + Unknown, + Entry, + EntryX, + HProgEntry, + HProgEntryX, + ProgEntry, + ProgEntryX, + IFrame, + Mdd, + Res, + EncryptedRes, + File, + Sound, + Launch, + Debug, + ViewImage, + Info, + Notify, +} + +impl MdxAction { + pub fn from_str(s: &str) -> MdxAction { + match s { + "iframe" => MdxAction::IFrame, + "res" => MdxAction::Res, + "eres" => MdxAction::EncryptedRes, + "file" => MdxAction::File, + "view_image" => MdxAction::ViewImage, + "sound" => MdxAction::Sound, + "entry" => MdxAction::Entry, + "prog_entry" => MdxAction::ProgEntry, + "h_prog_entry" => MdxAction::HProgEntry, + "entryx" => MdxAction::EntryX, + "prog_entryx" => MdxAction::ProgEntryX, + "h_prog_entryx" => MdxAction::HProgEntryX, + "mdd" => MdxAction::Mdd, + "launch" => MdxAction::Launch, + "debug" => MdxAction::Debug, + "notify" => MdxAction::Notify, + "info" => MdxAction::Info, + _ => MdxAction::Unknown, + } + } +} + +/// Mdx url is like http://mdict.cn/service/action?parameters +/// 只解析action部分,参数解析留给具体的handler处理 +pub fn parse_mdx_url(url: &str, base_url: &str) -> Result { + let base_url = base_url.replace("http.localhost", "localhost"); + let path_with_action = url.strip_prefix(&base_url).unwrap_or(""); + // 只获取去掉base_path后的第一层路径 + let action_str = path_with_action + .split('?') + .next() + .unwrap_or(path_with_action); + + let action = MdxAction::from_str(action_str); + + + if action != MdxAction::Unknown { + // 只返回解析到的action + Ok(action) + } else { + Err(ZdbError::invalid_parameter(format!("Invalid action: {}", action_str))) + } +} diff --git a/rust/src-tauri/src/request_handler.rs b/rust/src-tauri/src/request_handler.rs new file mode 100644 index 0000000000000000000000000000000000000000..ec9c30c4e2244037d4dfe87b6df47bf3005ec622 --- /dev/null +++ b/rust/src-tauri/src/request_handler.rs @@ -0,0 +1,66 @@ +// 处理webview的URL请求 +use log::debug; +use tauri::http::{Request, Response, StatusCode}; +use url::Url; + +use crate::action_handlers::get_action_handler; +use crate::error::{Result, ZdbError}; +use crate::error_printer::format_error; +use crate::mdx_url_parser::parse_mdx_url; + +/// 处理MDX URL请求的函数 +fn handle_mdx_url(url: &str, base_url: &str) -> Result>> { + + let action = parse_mdx_url(&url, base_url)?; + + // 使用action handler处理请求 + let handler = get_action_handler(action) + .ok_or_else(|| ZdbError::invalid_parameter(format!("Unsupported action: {:?}", action)))?; + + let response = handler.handle(&Url::parse(url)?, action)?; + + Ok(response) +} + +/// 为响应添加 CORS headers +fn add_cors_headers(response: &mut Response>) { + response.headers_mut().insert("Access-Control-Allow-Origin", "*".parse().unwrap()); + response.headers_mut().insert("Access-Control-Allow-Methods", "*".parse().unwrap()); + response.headers_mut().insert("Access-Control-Allow-Headers", "*".parse().unwrap()); +} + +pub fn handle_request(request: &Request>, base_url: &str) -> std::result::Result>, Box> { + let uri = request.uri().to_string(); + debug!("Handling request: {}", uri); + match handle_mdx_url(&uri, base_url) { + Ok(mut response) => { + // 统一添加 CORS headers + add_cors_headers(&mut response); + Ok(response) + }, + Err(error) => { + let error_message = format_error(&error); + + // Determine HTTP status code based on error type + let status_code = if let ZdbError::KeyNotFound { .. } = &error { + log::info!("Key not found: {}", uri); + StatusCode::NOT_FOUND + } else { + log::error!("Error handling MDX URL {}: {}", uri, error_message); + StatusCode::INTERNAL_SERVER_ERROR + }; + + let error_html = format!( + "

Error

Failed to load content: {}

", + error_message + ); + let mut response = Response::new(error_html.into_bytes()); + *response.status_mut() = status_code; + response.headers_mut().insert("Content-Type", "text/html; charset=utf-8".parse().unwrap()); + // 错误响应也添加 CORS headers + add_cors_headers(&mut response); + Ok(response) + } + } +} + diff --git a/rust/src-tauri/src/search_cmd.rs b/rust/src-tauri/src/search_cmd.rs new file mode 100644 index 0000000000000000000000000000000000000000..55cb04425963ad456e55f3d5bb71482bbd1f1c0a --- /dev/null +++ b/rust/src-tauri/src/search_cmd.rs @@ -0,0 +1,110 @@ +// Search commands module - Tauri command implementations for search and content retrieval +use std::collections::LinkedList; +use tauri::command; + +use crate::error::IntoStringResult; +use crate::mdict_app::{with_read_access, with_write_access}; + +/// Incremental search (index search) +#[command] +pub async fn search_search_incremental(query: String, max_results: Option) -> std::result::Result { + let max_results = max_results.unwrap_or(50); + + with_write_access(|app| { + match app.incremental_search(&query, max_results)? { + Some((start_entry, total_count)) => { + Ok(serde_json::json!({ + "start_entry_no": start_entry, + "total_count": total_count + })) + } + None => { + // Return {start_entry_no: -1, total_count: 0} to indicate no results found + Ok(serde_json::json!({ + "start_entry_no": -1, + "total_count": 0 + })) + } + } + }).into_string_result() +} + +/// Get content URL for an entry by index number +#[command] +pub async fn search_get_content_url(index_no: usize) -> std::result::Result { + with_read_access(|app| app.get_content_url(index_no)).into_string_result() +} + +/// Get total entry count +#[command] +pub async fn search_get_entry_count() -> std::result::Result { + with_read_access(|app| app.get_entry_count()).into_string_result() +} + +/// Find index by keyword +#[command] +pub async fn search_find_index(key: String) -> std::result::Result { + with_write_access(|app| { + let group_indexes = app.find_index(&key)?; + + // Convert LinkedList to JSON array + let mut result = Vec::new(); + for group_index in group_indexes { + result.push(serde_json::json!({ + "profile_id": group_index.profile_id, + "primary_key": group_index.primary_key, + "indexes": group_index.indexes.iter().map(|idx| serde_json::json!({ + "profile_id": idx.profile_id, + "entry_no": idx.key_index.entry_no, + "key": idx.key_index.key + })).collect::>() + })); + } + + Ok(serde_json::Value::Array(result)) + }).into_string_result() +} + +/// Fulltext search (across single database or dictionary group) +#[command] +pub async fn search_fulltext_search(query: String, max_results: Option) -> std::result::Result { + let max_results = max_results.unwrap_or(200); + with_write_access(|app| { + let total = app.fulltext_search(&query, max_results)?; + Ok(serde_json::json!({ + "start_entry_no": 0, + "total_count": total + })) + }).into_string_result() +} + +/// Get result key list (paginated search results) +#[command] +pub async fn search_get_result_key_list(start_index_no: i64, max_count: usize) -> std::result::Result, String> { + with_write_access(|app| app.get_result_key_list(start_index_no, max_count)).into_string_result() +} + +/// Get group indexes for a given index number +#[command] +pub async fn search_get_group_indexes(index_no: usize) -> std::result::Result { + with_write_access(|app| { + let group_indexes = app.get_group_indexes(index_no)?; + + // Convert LinkedList to JSON array + let mut result = Vec::new(); + for group_index in group_indexes { + result.push(serde_json::json!({ + "profile_id": group_index.profile_id, + "primary_key": group_index.primary_key, + "indexes": group_index.indexes.iter().map(|idx| serde_json::json!({ + "profile_id": idx.profile_id, + "entry_no": idx.key_index.entry_no, + "key": idx.key_index.key + })).collect::>() + })); + } + + Ok(serde_json::Value::Array(result)) + }).into_string_result() +} + diff --git a/rust/src-tauri/src/system_cmd.rs b/rust/src-tauri/src/system_cmd.rs new file mode 100644 index 0000000000000000000000000000000000000000..119a31a57711f4547db0de65ab8a8bc362340a4c --- /dev/null +++ b/rust/src-tauri/src/system_cmd.rs @@ -0,0 +1,11 @@ +// System commands module - Tauri command implementations for system-level operations +use tauri::command; + +use crate::error::IntoStringResult; +use crate::mdict_app::with_write_access; + +/// Set base URL for MDX protocol +#[command] +pub async fn system_set_base_url(base_url: String) -> std::result::Result<(), String> { + with_write_access(|app| app.set_base_url(base_url)).into_string_result() +} diff --git a/rust/src-tauri/src/utils.rs b/rust/src-tauri/src/utils.rs new file mode 100644 index 0000000000000000000000000000000000000000..c098efb90bbcd5803c97a731c136752b2cd9c0af --- /dev/null +++ b/rust/src-tauri/src/utils.rs @@ -0,0 +1,11 @@ +use log::error; + +use mdx::Result; + +use crate::error_printer; + +pub fn log_if_err(e: &Result<()>) { + if let Err(e) = e { + error!("{}", error_printer::format_error(&e)); + } +} \ No newline at end of file diff --git a/rust/src-tauri/tauri.conf.json b/rust/src-tauri/tauri.conf.json new file mode 100644 index 0000000000000000000000000000000000000000..fa9d1c5fe3a44c15ef3c5bdd835589b49a85fc4d --- /dev/null +++ b/rust/src-tauri/tauri.conf.json @@ -0,0 +1,44 @@ +{ + "$schema": "https://schema.tauri.app/config/2", + "productName": "词典", + "version": "0.1.0", + "identifier": "cn.mdict.mdict-app", + "build": { + "beforeDevCommand": "yarn dev", + "devUrl": "http://localhost:1420", + "beforeBuildCommand": "yarn build", + "frontendDist": "../dist" + }, + "app": { + "windows": [ + { + "title": "词典", + "width": 1200, + "height": 800, + "minWidth": 800, + "minHeight": 600, + "resizable": true, + "fullscreen": false + } + ], + "security": { + "csp": null, + "assetProtocol": { + "enable": true, + "scope": ["**"] + } + } + }, + "bundle": { + "active": true, + "targets": "all", + "resources": [], + "icon": [ + "icons/32x32.png", + "icons/128x128.png", + "icons/128x128@2x.png", + "icons/icon.icns", + "icons/icon.ico" + ] + } +} diff --git a/rust/src/App.tsx b/rust/src/App.tsx new file mode 100644 index 0000000000000000000000000000000000000000..30ec6354c361d703f67a07720a59dfe3abaf2195 --- /dev/null +++ b/rust/src/App.tsx @@ -0,0 +1,339 @@ +import { useState, useEffect, useRef, useCallback } from 'react'; +import { useTranslation } from 'react-i18next'; +import { MdxGroupIndex } from './types'; +import { useSearchStore, useSettingsStore } from './store'; +import { LibraryView } from './pages/LibraryView'; +import { SearchView, SearchViewRef } from './pages/SearchView'; +import { HistoryView } from './pages/HistoryView'; +import { FavoritesView } from './pages/FavoritesView'; +import { SettingsView } from './pages/SettingsView'; +import { + IonApp, + IonIcon, + IonLabel, + IonRouterOutlet, + IonTabs, + IonTabBar, + IonTabButton, + IonAlert, + setupIonicReact, +} from '@ionic/react'; +import { IonReactRouter } from '@ionic/react-router'; +import { Redirect, Route } from 'react-router-dom'; +import { + searchOutline, + libraryOutline, + timeOutline, + heartOutline, + settingsOutline, +} from 'ionicons/icons'; +import { + applyIonicTheme, + getEffectiveThemeMode, + getEffectiveThemePreset, +} from './ionicTheme'; +import { listen } from '@tauri-apps/api/event'; +import { readText as tauriReadText } from '@tauri-apps/plugin-clipboard-manager'; + +// Initialize Ionic - mode will be set dynamically +// We need to get the initial theme preset from the store before setupIonicReact is called +const getInitialThemePreset = (): 'ios' | 'md' => { + const stored = localStorage.getItem('settings-storage'); + if (stored) { + try { + const parsed = JSON.parse(stored); + const themePreset = parsed.state?.themePreset || 'auto'; + return getEffectiveThemePreset(themePreset); + } catch (e) { + return getEffectiveThemePreset('auto'); + } + } + return getEffectiveThemePreset('auto'); +}; + +setupIonicReact({ + rippleEffect: true, + mode: getInitialThemePreset(), +}); +/** + * Tab item configuration + */ +interface TabItem { + id: string; + titleKey: string; + icon: string; + path: string; +} + +const tabItems: TabItem[] = [ + { id: 'search', titleKey: 'Search', icon: searchOutline, path: '/search' }, + { id: 'library', titleKey: 'Library', icon: libraryOutline, path: '/library' }, + { id: 'history', titleKey: 'History', icon: timeOutline, path: '/history' }, + { id: 'favorites', titleKey: 'Favorites', icon: heartOutline, path: '/favorites' }, + { id: 'settings', titleKey: 'Settings', icon: settingsOutline, path: '/settings' }, +]; + +/** + * App Component + * + * Main application component with Ionic React navigation and layout. + * Uses Zustand stores for state management. + * + * Architecture: + * - Layout: IonTabs with adaptive positioning (side on desktop, bottom on mobile) + * - Navigation: React Router with IonReactRouter + * - State: Theme preferences, error handling + * - Store usage: Direct store imports, no provider needed + */ +function App() { + const { t } = useTranslation(); + + // Use Zustand stores - separate actions from state to reduce re-renders + const useProfile = useSearchStore((state) => state.useProfile); + const performSearch = useSearchStore ((state) => state.performSearch); + const searchTerm = useSearchStore ((state) => state.searchTerm); + + // Subscribe to theme settings from store + const themePreset = useSettingsStore((state) => state.themePreset); + const themeMode = useSettingsStore((state) => state.themeMode);// const location = useLocation(); + + // Get effective theme preset (resolves 'auto' to actual platform) + const effectiveThemePreset = getEffectiveThemePreset(themePreset); + + const [errorAlert, setErrorAlert] = useState<{ open: boolean; message: string }>({ + open: false, + message: '' + }); + + // Effective theme mode (derived from themeMode) + const [effectiveThemeMode, setEffectiveThemeMode] = useState<'light' | 'dark'>(() => + getEffectiveThemeMode(themeMode) + ); + + // Ref for SearchView + const searchViewRef = useRef(null); + + const setActiveTab = (tab: string) => { + const tabElement = document.querySelector(`[tab="${tab}"]`) as HTMLElement; + if (tab) { + tabElement.click(); + } + }; + + // Handle library selection + const handleSelectLibrary = useCallback(async (profileId?: number) => { + try { + if (profileId) { + const lastSearchTerm = searchTerm; + await useProfile(profileId); + if (lastSearchTerm) { + performSearch(lastSearchTerm); + } + // Trigger search tab click + setActiveTab('search'); + } + //TODO: Should recreate useSearchStore here. + } catch (error) { + console.error('Failed to open library:', error); + setErrorAlert({ + open: true, + message: t('Failed to open library. Please check if the dictionary file exists or try again.') + }); + } + }, [useProfile, performSearch, searchTerm]); + + + // Handle entry selection from history/favorites + const handleEntrySelect = useCallback((groupIndexes: MdxGroupIndex[], addToHistory: boolean = true) => { + if (searchViewRef.current) { + searchViewRef.current.displayByEntry(groupIndexes, addToHistory); + } + setActiveTab('search'); + }, [searchViewRef]); + + + const handleCloseErrorAlert = useCallback(() => { + setErrorAlert({ open: false, message: '' }); + }, [setErrorAlert]); + + + // Update effective theme mode when themeMode changes + useEffect(() => { + const newEffectiveMode = getEffectiveThemeMode(themeMode); + setEffectiveThemeMode(newEffectiveMode); + }, [themeMode]); + + // Apply Ionic theme when preset or mode changes + useEffect(() => { + applyIonicTheme({ preset: effectiveThemePreset, mode: effectiveThemeMode }); + }, [effectiveThemePreset, effectiveThemeMode]); + + // Listen for system theme changes when in auto mode + useEffect(() => { + if (themeMode !== 'auto') return; + + const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)'); + const handleChange = (e: MediaQueryListEvent) => { + const newMode = e.matches ? 'dark' : 'light'; + setEffectiveThemeMode(newMode); + }; + + // Modern browsers + if (mediaQuery.addEventListener) { + mediaQuery.addEventListener('change', handleChange); + return () => mediaQuery.removeEventListener('change', handleChange); + } + // Fallback for older browsers + else if (mediaQuery.addListener) { + mediaQuery.addListener(handleChange); + return () => mediaQuery.removeListener(handleChange); + } + }, [themeMode]); + + + // Auto lookup clipboard on window focus + const autoLookupClipboard = useSettingsStore((state) => state.globalSettings.autoLookupClipboard); + + // Listen for window focus event from backend and check clipboard changes + useEffect(() => { + let unlisten: (() => void) | undefined; + let lastClipboardText: string | null = null; + + const setupWindowFocusListener = async () => { + try { + // Initialize last clipboard text + try { + lastClipboardText = await tauriReadText(); + } catch (error) { + console.error('Failed to read initial clipboard:', error); + } + + // Listen for window-focus event from backend + unlisten = await listen('window-focus', async () => { + + // Only proceed if autoLookupClipboard is enabled + if (!autoLookupClipboard) { + return; + } + + try { + // Read current clipboard content + const currentClipboardText = await tauriReadText(); + + // Check if clipboard content has changed + if (currentClipboardText && + currentClipboardText.trim() && + currentClipboardText !== lastClipboardText) { + + // Update last clipboard text + lastClipboardText = currentClipboardText; + + // Perform lookup + if (searchViewRef.current) { + searchViewRef.current.displayByKey(currentClipboardText.trim(), true); + } + setActiveTab('search'); + } + } catch (error) { + console.error('Failed to read clipboard on window focus:', error); + } + }); + } catch (error) { + console.error('Failed to setup window focus listener:', error); + } + }; + setupWindowFocusListener(); + + // Cleanup listener on unmount + return () => { + if (unlisten) { + unlisten(); + } + }; + }, [searchViewRef, autoLookupClipboard]); + + return ( + + + + {/* Main Content */} + + } + exact + /> + + } + exact + /> + + handleEntrySelect(groupIndexes, false)} + />} + exact + /> + + handleEntrySelect(groupIndexes, true)} + />} + exact + /> + + console.log('Setting changed:', setting, value)} + />} + exact + /> + + + + + + + {/* Tab Bar - adaptive positioning */} + + {tabItems.map((item) => ( + + + {t(item.titleKey)} + + ))} + + + + {/* Error Alert */} + + + + {/* Global portal container for imperative dialogs */} +
+ + ); +} + +export default App; diff --git a/rust/src/AppLoader.tsx b/rust/src/AppLoader.tsx new file mode 100644 index 0000000000000000000000000000000000000000..603dc66941ee43774405dbec00e974a5328dc901 --- /dev/null +++ b/rust/src/AppLoader.tsx @@ -0,0 +1,170 @@ +import { useState, useEffect } from 'react'; +import { useTranslation, I18nextProvider } from 'react-i18next'; +import { useLibraryStore, useSearchStore, useSettingsStore } from './store'; +import { + IonApp, + IonContent, + IonSpinner, + IonAlert, + setupIonicReact, +} from '@ionic/react'; +import { + getEffectiveThemePreset, +} from './ionicTheme'; +import i18n from './i18n/i18n'; +import App from './App'; +import { useSystemStore } from './store/useSystemStore'; +import { setBaseUrl } from './api/system'; +import { isWindowsPlatform } from './utils/platformUtils'; + +// Initialize Ionic - mode will be set dynamically +const getInitialThemePreset = (): 'ios' | 'md' => { + const stored = localStorage.getItem('settings-storage'); + if (stored) { + try { + const parsed = JSON.parse(stored); + const themePreset = parsed.state?.themePreset || 'auto'; + return getEffectiveThemePreset(themePreset); + } catch (e) { + return getEffectiveThemePreset('auto'); + } + } + return getEffectiveThemePreset('auto'); +}; + +setupIonicReact({ + rippleEffect: true, + mode: getInitialThemePreset(), +}); + +interface AppLoaderState { + isLoading: boolean; + error: string | null; + isInitialized: boolean; +} + +const AppLoaderContent = () => { + const { t, i18n: i18nInstance } = useTranslation(); + const guiLanguage = useSettingsStore((state) => state.viewSettings?.guiLanguage); + const [state, setState] = useState({ + isLoading: true, + error: null, + isInitialized: false, + }); + + // Handle language changes from settings + useEffect(() => { + if (guiLanguage) { + i18nInstance.changeLanguage(guiLanguage); + } + }, [guiLanguage, i18nInstance]); + + useEffect(() => { + const initializeStores = async () => { + try { + setState(prev => ({ ...prev, isLoading: true, error: null })); + + // Determine base URL based on platform + // Windows: use http protocol with window.location.origin + // Non-Windows: use mdx:// custom protocol + let baseUrl: string; + if (isWindowsPlatform()) { + // On Windows, use http protocol from window.location.origin + baseUrl = window.location.origin + '/service/'; + } else { + // On non-Windows platforms (macOS, Linux), use mdx:// custom protocol + baseUrl = 'mdx://mdict.cn/service/'; + } + console.log('Setting base URL:', baseUrl); + + // Set base URL before initializing other stores + useSystemStore.getState().setBaseUrl(baseUrl); + await setBaseUrl(baseUrl); + + // Initialize all stores + await Promise.all([ + useLibraryStore.getState().loadGroups(), + useSearchStore.getState().init(), + useSettingsStore.getState().loadAllSettings(), + ]); + + setState({ + isLoading: false, + error: null, + isInitialized: true, + }); + + console.log('All stores initialized successfully'); + } catch (error) { + console.error('Failed to initialize stores:', error); + setState({ + isLoading: false, + error: error instanceof Error ? error.message : t('Initialization failed, please try again'), + isInitialized: false, + }); + } + }; + + initializeStores(); + }, [t]); + + const handleRetry = () => { + setState(prev => ({ ...prev, isLoading: true, error: null })); + // Trigger re-initialization by changing a dependency (we'll restart the effect) + window.location.reload(); + }; + + // Show error alert + if (state.error) { + return ( + + + + ); + } + + // Show loading spinner + if (state.isLoading) { + return ( + + +
+ +

+ {t('Initializing application...')} +

+
+
+
+ ); + } + + // Render main app when initialized + return ; +}; + +function AppLoader() { + return ( + + + + ); +} + +export default AppLoader; \ No newline at end of file diff --git a/rust/src/api/config.ts b/rust/src/api/config.ts new file mode 100644 index 0000000000000000000000000000000000000000..160ed733e267b3a14f66fa057fcbfc04a02d57d2 --- /dev/null +++ b/rust/src/api/config.ts @@ -0,0 +1,137 @@ +/** + * Configuration API Module + * + * Provides generic configuration access following app_config.rs pattern. + * + * Following best practices: + * - Generic get/set interface + * - Type-safe config keys + * - Clean API boundary + * - Minimal command surface + */ + +import { invoke } from '@tauri-apps/api/core'; +import { open } from '@tauri-apps/plugin-dialog'; + +/** + * Configuration section type + */ +export type ConfigSection = 'global' | 'view'; + +/** + * Configuration key type - matches ConfigKey enum in Rust + */ +export type ConfigKey = + // Global settings + | 'app_owner' + | 'audio_lib_path' + | 'extra_lib_search_path' + | 'custom_font_path' + | 'auto_lookup_clipboard' + | 'monitor_clipboard' + | 'auto_lookup_selection' + | 'hotkey_letter' + | 'hotkey_modifier' + | 'use_popover_for_lookup' + | 'last_main_profile_id' + // View settings + | 'gui_language' + | 'appearance_mode' + | 'font_face' + | 'font_color' + | 'background_color' + | 'auto_resize_image'; + +// ============ Generic Config API ============ + +/** + * Get app configuration (full config object) + */ +export const getAppConfig = async (): Promise => { + return await invoke('config_get_app_config'); +}; + +/** + * Get a specific config value + */ +export const getConfigValue = async ( + section: ConfigSection, + key: ConfigKey +): Promise => { + return await invoke('config_get_value', { section, key }); +}; + +/** + * Set a specific config value + */ +export const setConfigValue = async ( + section: ConfigSection, + key: ConfigKey, + value: T +): Promise => { + await invoke('config_set_value', { section, key, value }); +}; + +/** + * Get all global settings + */ +export const getGlobalSettings = async (): Promise => { + return await invoke('config_get_global_settings'); +}; + +/** + * Get all view settings + */ +export const getViewSettings = async (): Promise => { + return await invoke('config_get_view_settings'); +}; + +/** + * Update multiple view settings at once + */ +export const updateViewSettings = async (settings: any): Promise => { + await invoke('config_update_view_settings', { settings }); +}; + +/** + * Save app configuration to disk + */ +export const saveAppConfig = async (): Promise => { + await invoke('config_save_app_config'); +}; + +/** + * Reload app configuration from disk + */ +export const reloadAppConfig = async (): Promise => { + await invoke('config_reload_app_config'); +}; + +/** + * Reload resources + */ +export const reloadResources = async (): Promise => { + await invoke('config_reload_resources'); +}; + +/** + * Open directory picker dialog + */ +export const selectDirectory = async (title?: string, defaultPath?: string): Promise => { + const result = await open({ + directory: true, + multiple: false, + title: title || '选择目录', + defaultPath: defaultPath, + }); + + return result as string | null; +}; + +/** + * List font files in a directory + */ +export const listFontsInDirectory = async (path: string): Promise => { + return await invoke('config_list_fonts_in_directory', { path }); +}; + diff --git a/rust/src/api/favorites.ts b/rust/src/api/favorites.ts new file mode 100644 index 0000000000000000000000000000000000000000..4d6bcf803b99678363326d9f5a83614b8b4023e3 --- /dev/null +++ b/rust/src/api/favorites.ts @@ -0,0 +1,105 @@ +/** + * Favorites API Module + * + * Handles all favorites-related operations with backend. + * Uses the favorites plugin for SQLite-based persistence. + * + * Following best practices: + * - Single responsibility (favorites operations only) + * - Clean API boundary + * - Reusable across components + */ + +import { invoke } from '@tauri-apps/api/core'; +import { FavoriteEntry, FavoriteSortBy, MdxGroupIndex } from '../types'; + +/** + * Add a favorite entry + */ +export const addFavorite = async ( + keyword: string, + groupIndex: MdxGroupIndex[], // Array of MdxGroupIndex + profileId: number, + profileName: string +): Promise => { + return await invoke('favorites_add_favorite', { + keyword, + groupIndex, + profileId, + profileName, + }); +}; + +/** + * Remove a favorite entry by ID + */ +export const removeFavorite = async (id: string): Promise => { + return await invoke('favorites_remove_favorite', { id }); +}; + +/** + * Toggle favorite (add if not exists, remove if exists) + * Returns true if added, false if removed + */ +export const toggleFavorite = async ( + keyword: string, + groupIndex: MdxGroupIndex[], // Array of MdxGroupIndex + profileId: number, + profileName: string +): Promise => { + return await invoke('favorites_toggle_favorite', { + keyword, + groupIndex, + profileId, + profileName, + }); +}; + +/** + * Check if favorited + */ +export const isFavorited = async (keyword: string, profileId: number): Promise => { + return await invoke('favorites_is_favorited', { keyword, profileId }); +}; + +/** + * Get sorted and filtered favorites + */ +export const getSortedAndFilteredFavorites = async ( + sortBy: FavoriteSortBy, + filterProfileId: number | null +): Promise => { + return await invoke('favorites_get_sorted_and_filtered_favorites', { + sortBy, + filterProfileId, + }); +}; + +/** + * Get all favorites + */ +export const getAllFavorites = async (): Promise => { + return await invoke('favorites_get_all_favorites'); +}; + +/** + * Clear all favorites + */ +export const clearAllFavorites = async (): Promise => { + await invoke('favorites_clear_all_favorites'); +}; + +/** + * Import favorites (for backup/restore) + */ +export const importFavorites = async (entries: FavoriteEntry[]): Promise => { + await invoke('favorites_import_favorites', { entries }); +}; + +/** + * Get favorites count + */ +export const getFavoritesCount = async (): Promise => { + return await invoke('favorites_get_favorites_count'); +}; + diff --git a/rust/src/api/history.ts b/rust/src/api/history.ts new file mode 100644 index 0000000000000000000000000000000000000000..b94b085141c3a3d4caf5186e7bd12d96684ac04f --- /dev/null +++ b/rust/src/api/history.ts @@ -0,0 +1,88 @@ +/** + * History API Module + * + * Handles all history-related operations with backend. + * Uses the history plugin for SQLite-based persistence. + * + * Following best practices: + * - Single responsibility (history operations only) + * - Clean API boundary + * - Reusable across components + */ + +import { invoke } from '@tauri-apps/api/core'; +import { HistoryEntry, MdxGroupIndex } from '../types'; + +/** + * Add a history entry + */ +export const addToHistory = async ( + keyword: string, + groupIndex: MdxGroupIndex[], // Array of MdxGroupIndex + profileId: number, + profileName: string +): Promise => { + return await invoke('history_add_to_history', { + keyword, + groupIndex, + profileId, + profileName, + }); +}; + +/** + * Get all history entries + */ +export const getAllHistory = async (): Promise => { + return await invoke('history_get_all_history'); +}; + +/** + * Get history entry by ID + */ +export const getHistoryEntryById = async (id: string): Promise => { + return await invoke('history_get_history_entry_by_id', { id }); +}; + +/** + * Remove a history entry by ID + */ +export const removeFromHistory = async (id: string): Promise => { + return await invoke('history_remove_from_history', { id }); +}; + +/** + * Clear all history + */ +export const clearHistory = async (): Promise => { + await invoke('history_clear_history'); +}; + +/** + * Get history count + */ +export const getHistoryCount = async (): Promise => { + return await invoke('history_get_history_count'); +}; + +/** + * Set maximum history size + */ +export const setMaxHistorySize = async (size: number): Promise => { + await invoke('history_set_max_history_size', { size }); +}; + +/** + * Get maximum history size + */ +export const getMaxHistorySize = async (): Promise => { + return await invoke('history_get_max_history_size'); +}; + +/** + * Import history entries (for backup/restore) + */ +export const importHistory = async (entries: HistoryEntry[]): Promise => { + await invoke('history_import_history', { entries }); +}; + diff --git a/rust/src/api/hotkey.ts b/rust/src/api/hotkey.ts new file mode 100644 index 0000000000000000000000000000000000000000..4a825f7ecb16dfdbad70d4d2a0201469a98ace7d --- /dev/null +++ b/rust/src/api/hotkey.ts @@ -0,0 +1,35 @@ +/** + * Hotkey API + * + * Provides functions to register and unregister global hotkeys via Tauri commands. + * Note: Hotkeys are only available on desktop platforms (Windows, macOS, Linux). + * On mobile platforms (iOS, Android), these functions will reject with an error. + */ + +import { invoke } from '@tauri-apps/api/core'; +import { isHotkeyAvailable } from '../utils/platformUtils'; + +/** + * Register a global hotkey + * @param letter - The key letter (e.g., 'A', 'B', etc.) + * @param modifier - The modifier key (e.g., 'Ctrl', 'Shift', 'Alt', 'Super', or combinations like 'Ctrl+Shift') + * @throws Error if hotkeys are not available on the current platform + */ +export async function registerHotkey(letter: string, modifier: string): Promise { + if (!isHotkeyAvailable()) { + throw new Error('Hotkeys are not available on mobile platforms'); + } + await invoke('hotkey_register', { letter, modifier }); +} + +/** + * Unregister the current global hotkey + * @throws Error if hotkeys are not available on the current platform + */ +export async function unregisterHotkey(): Promise { + if (!isHotkeyAvailable()) { + throw new Error('Hotkeys are not available on mobile platforms'); + } + await invoke('hotkey_unregister'); +} + diff --git a/rust/src/api/index.ts b/rust/src/api/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..7ab81e6e625ecf9deefea99385174f030c07ab68 --- /dev/null +++ b/rust/src/api/index.ts @@ -0,0 +1,31 @@ +/** + * API Module Exports + * + * Central export point for all API modules. + * This replaces the old AppContext with modular, focused API modules. + * + * Following best practices: + * - Separation of concerns (each module handles one domain) + * - Clean imports (import { libraryAPI } from '../api') + * - Easy to test and maintain + */ + +// Re-export all library APIs +import * as libraryAPI from './library'; +import * as searchAPI from './search'; +import * as configAPI from './config'; +import * as systemAPI from './system'; +import * as historyAPI from './history'; +import * as favoritesAPI from './favorites'; +import * as hotkeyAPI from './hotkey'; + +export { libraryAPI, searchAPI, configAPI, systemAPI, historyAPI, favoritesAPI, hotkeyAPI }; + +// Also export individual functions for convenience +export * from './library'; +export * from './search'; +export * from './config'; +export * from './system'; +export * from './history'; +export * from './favorites'; +export * from './hotkey'; diff --git a/rust/src/api/library.ts b/rust/src/api/library.ts new file mode 100644 index 0000000000000000000000000000000000000000..9d1174951eff4130735769a5c81754dd110d7214 --- /dev/null +++ b/rust/src/api/library.ts @@ -0,0 +1,158 @@ +/** + * Library API Module + * + * Handles all library and group management operations. + * Extracted from AppContext for better modularity. + * + * Following best practices: + * - Single responsibility (library operations only) + * - Clean API boundary + * - Reusable across components + */ + +import { invoke } from '@tauri-apps/api/core'; +import { MdxProfile } from '../types'; + +/** + * Create a new dictionary group + */ +export const createDictGroup = async (groupName: string): Promise => { + return await invoke('library_create_dict_group', { groupName }); +}; + +/** + * Delete a dictionary group + */ +export const deleteDictGroup = async (groupId: number): Promise => { + await invoke('library_delete_dict_group', { groupId }); +}; + +/** + * Rename a dictionary group + */ +export const renameDictGroup = async (groupId: number, newName: string): Promise => { + await invoke('library_rename_dict_group', { groupId, newName }); +}; + +/** + * Refresh library from disk + */ +export const refreshLibrary = async (): Promise => { + await invoke('library_refresh_library'); +}; + +/** + * Get group for a given group_id + */ +export const getGroup = async (groupId: number): Promise => { + return await invoke('library_get_group', { groupId }); +}; + +/** + * Get profile for a given group_id and profile_id + */ +export const getProfile = async (groupId: number, profileId: number): Promise => { + return await invoke('library_get_profile', { groupId, profileId }); +}; + +/** + * List all groups + */ +export const listGroups = async (): Promise => { + return await invoke('library_list_groups'); +}; + +/** + * Update profile disabled status in a group + */ +export const updateProfileDisabledStatus = async ( + parentGroupId: number, + profileId: number, + disabled: boolean +): Promise => { + await invoke('library_update_profile_disabled_status', { + parentGroupId, + profileId, + disabled, + }); +}; + +/** + * Adjust profile order within a group + */ +export const adjustProfileOrder = async ( + parentGroupId: number, + profileId: number, + newIndex: number +): Promise => { + await invoke('library_adjust_profile_order', { + parentGroupId, + profileId, + newIndex, + }); +}; + +/** + * Adjust group order + */ +export const adjustGroupOrder = async (groupId: number, newIndex: number): Promise => { + await invoke('library_adjust_group_order', { groupId, newIndex }); +}; + +/** + * Open main database with the given profile + */ +export const openMainDatabase = async (profileId: number): Promise => { + await invoke('library_open_main_database', { profileId }); +}; + +/** + * Get current main profile ID + */ +export const getCurrentMainProfileId = async (): Promise => { + return await invoke('library_get_current_main_profile_id'); +}; + +/** + * Get main database profile + */ +export const getMainDbProfile = async (): Promise => { + return await invoke('library_get_main_db_profile'); +}; + +// Export types from ConvertDBDialog +export type { CollationOptions, ConvertOptions } from '../components/ConvertDBDialog'; + +/** + * Result of database conversion + */ +export interface ConversionResult { + newMdxPath: string; + newMddPath?: string; +} + +/** + * Convert MDX/MDD files to new format + */ +export const convertFile = async ( + profileId: number, + collationLocale: string, + removeOldFiles: boolean = true +): Promise => { + return await invoke('library_convert_db', { profileId, collationLocale, removeOldFiles }); +}; + +/** + * Create fulltext search index + */ +export const createFtsIndex = async (mdxFilePath: string): Promise => { + await invoke('library_create_fts_index', { mdxFilePath }); +}; + +/** + * Cancel ongoing conversion + */ +export const cancelConversion = async (): Promise => { + await invoke('library_cancel_conversion'); +}; + diff --git a/rust/src/api/search.ts b/rust/src/api/search.ts new file mode 100644 index 0000000000000000000000000000000000000000..cf286f96c61c0ae5c43a2d884d9583309687138a --- /dev/null +++ b/rust/src/api/search.ts @@ -0,0 +1,93 @@ +/** + * Search API Module + * + * Handles all search and content retrieval operations. + * Extracted from AppContext for better modularity. + * + * Following best practices: + * - Single responsibility (search operations only) + * - Clean API boundary + * - Reusable across components + */ + +import { invoke } from '@tauri-apps/api/core'; +import { MdxGroupIndex, SearchResultEntry, MdxIndex } from '../types'; +import { useSystemStore } from '../store/useSystemStore'; + +/** + * Perform incremental (index) search + * Returns {start_entry_no: -1, total_count: 0} if no results found + */ +export const searchIncremental = async ( + query: string +): Promise<{ start_entry_no: number; total_count: number }> => { + return await invoke('search_search_incremental', { query }); +}; + +/** + * Perform fulltext search + */ +export const fulltextSearch = async ( + query: string +): Promise<{ start_entry_no: number; total_count: number }> => { + return await invoke('search_fulltext_search', { query }); +}; + +/** + * Get content URL for an entry by index number + */ +export const getContentUrl = async (indexNo: number): Promise => { + return await invoke('search_get_content_url', { indexNo }); +}; + +/** + * Get total entry count + */ +export const getEntryCount = async (): Promise => { + return await invoke('search_get_entry_count'); +}; + +/** + * Find index by keyword + */ +export const findIndex = async ( + key: string +): Promise<{ group_index: MdxGroupIndex; total_count: number }> => { + return await invoke('search_find_index', { key }); +}; + +/** + * Get result key list (paginated search results) + */ +export const getResultKeyList = async ( + startIndexNo: number, + maxCount: number +): Promise => { + const results = await invoke<[string, number][]>('search_get_result_key_list', { + startIndexNo, + maxCount, + }); + // Transform tuple array to SearchResultEntry objects + return results.map(([keyword, entry_count]) => ({ + keyword, + entry_count, + })); +}; + +/** + * Get group indexes for a given index number + */ +export const getGroupIndexes = async (indexNo: number): Promise => { + return await invoke('search_get_group_indexes', { indexNo }); +}; + +/** + * Generate URL for an MdxIndex + */ +export const getUrlForIndex = async (mdxIndex: MdxIndex): Promise => { + const url= `${useSystemStore.getState().baseUrl}entryx?profile_id=${mdxIndex.profile_id}&entry_no=${mdxIndex.entry_no}`; + console.log('Generated URL:', url); + return url; +}; + + diff --git a/rust/src/api/system.ts b/rust/src/api/system.ts new file mode 100644 index 0000000000000000000000000000000000000000..d4792ca83cdcf9cec1df77e9159349752ffac8a2 --- /dev/null +++ b/rust/src/api/system.ts @@ -0,0 +1,20 @@ +/** + * System API Module + * + * Handles system-level operations like base URL management. + * + * Following best practices: + * - Single responsibility (system operations only) + * - Clean API boundary + * - Reusable across components + */ + +import { invoke } from '@tauri-apps/api/core'; + +/** + * Set base URL + */ +export const setBaseUrl = async (baseUrl: string): Promise => { + await invoke('system_set_base_url', { baseUrl }); +}; + diff --git a/rust/src/components/ColorPickerDialog.tsx b/rust/src/components/ColorPickerDialog.tsx new file mode 100644 index 0000000000000000000000000000000000000000..d9f79c5abd074b465d4f73f83f095e3138aa3313 --- /dev/null +++ b/rust/src/components/ColorPickerDialog.tsx @@ -0,0 +1,79 @@ +/** + * ColorPickerDialog Component + * + * A reusable color picker dialog component using @uiw/react-color Sketch picker. + * Supports both component-based and imperative Promise-based API. + * + * Features: + * - Interactive color selection with Sketch-style picker + * - Customizable title + * - Confirm/cancel buttons + * - Enter key to confirm, Escape key to cancel + * - Promise-based API for easy async/await usage + */ + +import { showEnhancedDialog } from './EnhancedDialog/'; +import { Sketch } from '@uiw/react-color'; +import type { ColorResult } from '@uiw/react-color'; + +/** + * Options for imperative color picker dialog + */ +export interface ColorPickerDialogOptions { + /** Dialog title */ + title: string; + /** Initial color value (hex format, e.g., "#FF0000") */ + initialColor: string; +} + + +/** + * Imperative API for showing color picker dialog + * + * @param options - Dialog configuration options + * @returns Promise that resolves to the selected color string (hex format), or null if cancelled + * + * @example + * ```tsx + * const color = await colorPickerDialog({ + * title: "选择字体颜色", + * initialColor: "#000000" + * }); + * + * if (color !== null) { + * // User confirmed with color value + * await setFontColor(color); + * } + * ``` + */ +export const colorPickerDialog = (options: ColorPickerDialogOptions): Promise => { + return new Promise((resolve) => { + let selectedColor = options.initialColor; + + const handleColorChange = (colorResult: ColorResult) => { + selectedColor = colorResult.hex; + }; + + showEnhancedDialog({ + children: ( +
+

{options.title}

+ +
+ ), + confirmLabel: "确定", + cancelLabel: "取消", + className: 'color-picker-dialog', + onConfirm: () => resolve(selectedColor), + onCancel: () => resolve(null), + }); + }); +}; diff --git a/rust/src/components/ConfirmDialog.tsx b/rust/src/components/ConfirmDialog.tsx new file mode 100644 index 0000000000000000000000000000000000000000..40b8b13542fdce99387068743eb766ed4bcf0e6b --- /dev/null +++ b/rust/src/components/ConfirmDialog.tsx @@ -0,0 +1,81 @@ +/** + * ConfirmDialog - Text-based Confirmation Dialog + * + * A simple confirmation dialog that uses EnhancedDialog internally. + * Supports imperative Promise-based API for easy use. + * + * Features: + * - Enter key to confirm + * - Escape key to cancel + * - Customizable title, message, and button labels + * - Danger mode for destructive actions (red confirm button) + */ + +import { showEnhancedDialog } from './EnhancedDialog/'; + +/** + * Options for imperative confirm dialog + */ +export interface ConfirmDialogOptions { + /** Dialog title */ + title: string; + /** Confirmation message */ + message: string; + /** Label for confirm button. Default: "确定" */ + confirmLabel?: string; + /** Label for cancel button. Default: "取消" */ + cancelLabel?: string; + /** Whether this is a dangerous action (uses danger color). Default: false */ + danger?: boolean; +} + +/** + * Imperative API for showing confirmation dialog + * + * @param options - Dialog configuration options + * @returns Promise that resolves to true if confirmed, false if cancelled + * + * @example + * ```tsx + * const confirmed = await confirmDialog({ + * title: "确认删除", + * message: "确定要删除吗?此操作不可撤销。", + * confirmLabel: "删除", + * danger: true + * }); + * + * if (confirmed) { + * // Proceed with deletion + * } + * ``` + */ +export const confirmDialog = (options: ConfirmDialogOptions): Promise => { + return new Promise((resolve) => { + showEnhancedDialog({ + children: ( +
+

+ {options.title} +

+

+ {options.message} +

+
+ ), + confirmLabel: options.confirmLabel, + cancelLabel: options.cancelLabel, + danger: options.danger, + showButtons: true, + onConfirm: () => resolve(true), + onCancel: () => resolve(false), + }); + }); +}; diff --git a/rust/src/components/ContentItem.tsx b/rust/src/components/ContentItem.tsx new file mode 100644 index 0000000000000000000000000000000000000000..1f4281a3e6fb1ba567e8a1cf3828721880a8950c --- /dev/null +++ b/rust/src/components/ContentItem.tsx @@ -0,0 +1,280 @@ +import { useState, useEffect, forwardRef, useImperativeHandle, useRef, useCallback } from 'react'; +import { IonIcon, IonButton, IonText } from '@ionic/react'; +import { chevronDownOutline } from 'ionicons/icons'; +import { useTranslation } from 'react-i18next'; + +import { MdxIndex } from '../types'; +import { scrollToAnchor } from '../utils/iframeTools/utils'; + + + +import { fetchContentFromUrl } from '../utils/iframeTools/mdxHtmlTools'; +import { iframeSetup } from '../utils/iframeTools/iframeSetup'; +import { HighlightAllOccurrencesOfString } from '../utils/iframeTools/highlight'; + + + +// fetchContentFromUrl moved to utils/MdxHtmlTools + +/** + * ContentItem Component + * + * Individual dictionary entry content display with iframe rendering. + * Handles content loading, height adjustment, and in-content navigation. + * Purely presentational component with iframe management. + */ +export interface ContentItemProps { + mdxIndex: MdxIndex; + highlight?: string; + style?: React.CSSProperties; +} + +export interface ContentItemRef { + profileId: number; + entryNo: number; + scrollToAnchor?: (fragment: string) => void; + setHighlight?: (highlight: string) => Promise; + getIframe?: () => HTMLIFrameElement | null; +} + +export const ContentItem = forwardRef(({ + mdxIndex, + highlight, + style, +}, ref) => { + const { t } = useTranslation(); + + console.debug('Calling ContentItem with mdxIndex and highlight:', mdxIndex, highlight); + const [contentHeight, setContentHeight] = useState(200); + const [content, setContent] = useState(''); + const [contentLoading, setContentLoading] = useState(false); + const [contentError, setContentError] = useState(''); + const [url, setUrl] = useState(''); + const containerRef = useRef(null); + const iframeRef = useRef(null); + const defaultHeight = 120; + + // Calculate URL and keyLabel from mdxIndex + // const keyLabel = mdxIndex.key; + const profileId = mdxIndex.profile_id; + const entryNo = mdxIndex.entry_no; + + // Handle iframe onload to initialize height tracking and navigation + const handleIframeLoad = useCallback(() => { + const iframe = iframeRef.current; + if (!iframe || !iframe.contentDocument || !iframe.contentWindow) { + return; + } + + // Initialize iframe content with height tracking and navigation handling + iframeSetup( + iframe, + profileId, + entryNo, + highlight + ); + }, [highlight, profileId, entryNo]); + + // Generate URL when component mounts or mdxIndex changes + useEffect(() => { + const generateUrl = async () => { + try { + const generatedUrl = await searchAPI.getUrlForIndex(mdxIndex); + setUrl(generatedUrl); + } catch (error) { + console.error('Error generating URL for mdxIndex:', mdxIndex, error); + setContentError('URL generation failed'); + } + }; + + generateUrl(); + }, [mdxIndex]); + + // Listen for messages from the specific iframe and handle height updates/navigation + useEffect(() => { + const handleMessage = (event: MessageEvent) => { + // const iframeWindow = iframeRef.current?.contentWindow; + // if (!iframeWindow || event.source !== iframeWindow) { + // return; // Ignore messages not from this iframe + // } + + const data = event.data as any; + if (data && data.type === 'contentHeight' && typeof data.height === 'number') { + event.stopPropagation(); + const baseHeight = data.height as number + 48; + const finalHeight = Math.max(baseHeight, defaultHeight); + setContentHeight(finalHeight); + } + }; + + window.addEventListener('message', handleMessage); + return () => { + window.removeEventListener('message', handleMessage); + }; + }, [defaultHeight]); + + // Function to increase iframe height by 100px + const handleExpandClick = () => { + const currentHeight = contentHeight; + const newHeight = currentHeight + 100; + setContentHeight(newHeight); + }; + + // Expose methods to parent through ref + useImperativeHandle(ref, () => ({ + profileId, + entryNo, + scrollToAnchor: (fragment: string) => { + if (!containerRef.current) { + return; + } + + // Find the iframe element + const iframe = iframeRef.current; + if (iframe) { + scrollToAnchor(iframe.contentDocument as Document, fragment); + } + }, + setHighlight: async (highlight: string) => { + return await HighlightAllOccurrencesOfString(iframeRef.current as HTMLIFrameElement, highlight, 100, false); + }, + getIframe: () => { + return iframeRef.current; + } + }), [profileId, entryNo, defaultHeight]); + + // Fetch content when URL changes + useEffect(() => { + const fetchContent = async () => { + if (!url) { + setContent(''); + setContentError(''); + return; + } + + setContentLoading(true); + setContentError(''); + setContentHeight(defaultHeight); // Reset to default height + + try { + const fetchedContent = await fetchContentFromUrl(url); + setContent(fetchedContent); + setContentError(''); + } catch (error) { + console.error('Failed to fetch content:', error); + setContentError(error instanceof Error ? error.message : 'Failed to load content'); + setContent(''); + } finally { + setContentLoading(false); + } + }; + + fetchContent(); + }, [url]); + + return ( +
+ { contentLoading ? ( +
+ +

{t('Loading...')}

+
+
+ ) : contentError ? ( +
+ +

{t('Load failed')}

+
+ +

{contentError}

+
+
+ ) : content ? ( +