huggingworld commited on
Commit
e3aec01
·
verified ·
1 Parent(s): e9f1b1f

Upload 78 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +4 -0
  2. LICENSE +201 -0
  3. VectorSearch-min.js +16 -0
  4. demo/assets/1.25.0-dev/dist/ort-wasm-simd-threaded.asyncify.mjs +112 -0
  5. demo/assets/1.25.0-dev/dist/ort-wasm-simd-threaded.asyncify.wasm +3 -0
  6. demo/assets/1.25.0-dev/dist/ort-wasm-simd-threaded.jsep.mjs +106 -0
  7. demo/assets/1.25.0-dev/dist/ort-wasm-simd-threaded.jsep.wasm +3 -0
  8. demo/assets/1.25.0-dev/dist/ort-wasm-simd-threaded.mjs +59 -0
  9. demo/assets/1.25.0-dev/dist/ort-wasm-simd-threaded.wasm +3 -0
  10. demo/assets/VectorSearch-min.js +16 -0
  11. demo/assets/fonts.css +567 -0
  12. demo/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkAnkaSTbQWt4N.woff2 +0 -0
  13. demo/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkBXkaSTbQWt4N.woff2 +0 -0
  14. demo/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkBnkaSTbQWg.woff2 +0 -0
  15. demo/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkC3kaSTbQWt4N.woff2 +0 -0
  16. demo/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCHkaSTbQWt4N.woff2 +0 -0
  17. demo/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCXkaSTbQWt4N.woff2 +0 -0
  18. demo/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCnkaSTbQWt4N.woff2 +0 -0
  19. demo/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkaHkaSTbQWt4N.woff2 +0 -0
  20. demo/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkenkaSTbQWt4N.woff2 +0 -0
  21. demo/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3-UBHMdazTgWw.woff2 +0 -0
  22. demo/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3CUBHMdazTgWw.woff2 +0 -0
  23. demo/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3GUBHMdazTgWw.woff2 +0 -0
  24. demo/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3KUBHMdazTgWw.woff2 +0 -0
  25. demo/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3OUBHMdazTgWw.woff2 +0 -0
  26. demo/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3iUBHMdazTgWw.woff2 +0 -0
  27. demo/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3yUBHMdazQ.woff2 +0 -0
  28. demo/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMawCUBHMdazTgWw.woff2 +0 -0
  29. demo/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMaxKUBHMdazTgWw.woff2 +0 -0
  30. demo/assets/litertjs-core-0.2.1_esm.js +43 -0
  31. demo/assets/litertjs-core-0.2.1_esm.js.map +1 -0
  32. demo/assets/litertjs-tfjs-interop-1.0.1_esm.js +8 -0
  33. demo/assets/litertjs-tfjs-interop-1.0.1_esm.js.map +1 -0
  34. demo/assets/litertjs-wasm-utils.js +8 -0
  35. demo/assets/litertjs-wasm-utils.js.map +1 -0
  36. demo/assets/litertjs/core/0.2.1/wasm/litert_wasm_compat_internal.js +0 -0
  37. demo/assets/litertjs/core/0.2.1/wasm/litert_wasm_compat_internal.wasm +3 -0
  38. demo/assets/litertjs/core/0.2.1/wasm/litert_wasm_internal.js +0 -0
  39. demo/assets/litertjs/core/0.2.1/wasm/litert_wasm_internal.wasm +3 -0
  40. demo/assets/litertjs/core/0.2.1/wasm/litert_wasm_threaded_internal.js +0 -0
  41. demo/assets/litertjs/core/0.2.1/wasm/litert_wasm_threaded_internal.wasm +3 -0
  42. demo/assets/long-4.0.0_esm.js +8 -0
  43. demo/assets/long-4.0.0_esm.js.map +1 -0
  44. demo/assets/script.js +188 -0
  45. demo/assets/seedrandom-3.0.5_esm.js +8 -0
  46. demo/assets/seedrandom-3.0.5_esm.js.map +1 -0
  47. demo/assets/style.css +339 -0
  48. demo/assets/tf-backend-webgpu.js +0 -0
  49. demo/assets/tf-backend-webgpu.js.map +0 -0
  50. demo/assets/tf.min.js +0 -0
.gitattributes CHANGED
@@ -33,3 +33,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ demo/assets/tf.min.js.map filter=lfs diff=lfs merge=lfs -text
37
+ demo/demo.gif filter=lfs diff=lfs merge=lfs -text
38
+ demo/demo.jpg filter=lfs diff=lfs merge=lfs -text
39
+ demo/models/onnx-community/embeddinggemma-300m-ONNX/tokenizer.json filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
VectorSearch-min.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*********************************************************************
2
+ * Client side vector search using EmbeddingGemma or all-Mini-L6-v2,
3
+ * Accelerated with WebGPU via LiteRT.js or Transformers.js.
4
+ * Tokenizer via Transformers.js, and pre/post processing via
5
+ * TensorFlow.js - all accelerated via WebGPU for speed.
6
+ * Version: 1.1.2
7
+ * Coded by Jason Mayes 2026.
8
+ *--------------------------------------------------------------------
9
+ * Connect with me on social if aquestions or comments:
10
+ *
11
+ * LinkedIn: https://www.linkedin.com/in/webai/
12
+ * Twitter / X: https://x.com/jason_mayes
13
+ * Github: https://github.com/jasonmayes
14
+ * CodePen: https://codepen.io/jasonmayes
15
+ *********************************************************************/
16
+ import"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs/dist/tf.min.js";import"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgpu/dist/tf-backend-webgpu.js";import*as T from"https://cdn.jsdelivr.net/npm/@litertjs/core@0.2.1/+esm";var f=class{constructor(e="unnamed"){this.dbName=e,this.db=null}setDb(e){this.dbName!==e&&(this.dbName=e,this.db&&(this.db.close(),this.db=null))}async initDb(){return this.db?this.db:new Promise((e,s)=>{let i=indexedDB.open(this.dbName,1);i.onupgradeneeded=n=>{let t=n.target.result;t.objectStoreNames.contains("embeddings")||t.createObjectStore("embeddings",{keyPath:"id",autoIncrement:!0})},i.onsuccess=n=>{this.db=n.target.result,e(this.db)},i.onerror=n=>s(n.target.error)})}async storeBatch(e){let i=(await this.initDb()).transaction(["embeddings"],"readwrite"),n=i.objectStore("embeddings");return new Promise((t,o)=>{i.oncomplete=()=>t(),i.onerror=r=>o(r.target.error);for(let r of e)n.add({text:r.text,embedding:r.embedding})})}async getAllVectors(){let e=await this.initDb();return new Promise((s,i)=>{let t=e.transaction(["embeddings"],"readonly").objectStore("embeddings"),o=[],r=t.openCursor();r.onsuccess=a=>{let c=a.target.result;c?(o.push({id:c.value.id,embedding:c.value.embedding}),c.continue()):s(o)},r.onerror=a=>i(a.target.error)})}async getTextByID(e){let s=await this.initDb();return new Promise((i,n)=>{let r=s.transaction(["embeddings"],"readonly").objectStore("embeddings").get(e);r.onsuccess=()=>{i(r.result?r.result.text:null)},r.onerror=a=>n(a.target.error)})}};var b=class{constructor(){this.cachedMatrix=void 0}async deleteGPUVectorCache(){this.cachedMatrix&&(this.cachedMatrix.dispose(),this.cachedMatrix=void 0)}async calculateCosineSimilarity(e,s){return tf.tidy(()=>{let i=e.squeeze(),n=s.squeeze(),t=tf.dot(i,n),o=tf.norm(i),r=tf.norm(n);return t.div(o.mul(r)).dataSync()[0]})}async cosineSimilarityTFJSGPUMatrix(e,s,i){this.cachedMatrix||(console.log("Rebuilding GPU VectorDB Matrix"),this.cachedMatrix=tf.tensor2d(e));let n=tf.tidy(()=>{let a=tf.tensor1d(s),c=1e-9,l=this.cachedMatrix.norm(2,1,!0),m=this.cachedMatrix.div(l.add(c)),d=a.norm(2),h=a.div(d.add(c)),g;try{g=tf.matMul(m,h.reshape([-1,1]))}catch(R){console.error("VectorDB you are trying to use was encoded using embedding model that generated different number of dimensions. Please re-encode DB or use correct Embedding Model",R)}return g.squeeze()}),t=tf.topk(n,i,!1),o=await t.values.data(),r=await t.indices.data();return{values:o,indices:r}}};import*as D from"https://cdn.jsdelivr.net/npm/@litertjs/core@0.2.1/+esm";import*as M from"https://cdn.jsdelivr.net/npm/@litertjs/tfjs-interop@1.0.1/+esm";import{pipeline as k}from"https://cdn.jsdelivr.net/npm/@xenova/transformers@2.17.2";var p=class{constructor(e){this.model=void 0,this.runtime=e}async load(e){this.runtime==="litertjs"?this.model=await D.loadAndCompile(e,{accelerator:"webgpu"}):this.model=await k("feature-extraction",e)}async getEmbeddingLiteRTJS(e,s){if(!this.model)throw new Error("Model not loaded. Call load() first.");if(this.runtime==="litertjs"){let i=tf.tensor1d(e,"int32");e.length<s?i=i.pad([[0,s-e.length]]):e.length>s&&(i=i.slice([0],[s]));let n=i.expandDims(0),t=M.runWithTfjsTensors(this.model,n);return i.dispose(),n.dispose(),{embedding:t[0],tokens:e}}}async getEmbeddingTransformers(e){if(this.runtime==="transformersjs"){let s=await this.model(e,{pooling:"mean",normalize:!0});return{embedding:Array.from(s.data)}}}};import{AutoTokenizer as N}from"https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.3.0";var w=class{constructor(){this.tokenizer=void 0}async load(e){this.tokenizer=await N.from_pretrained(e)}async encode(e){if(!this.tokenizer)throw new Error("Tokenizer not loaded. Call load() first.");return await this.tokenizer.encode(e)}};var y=class{render(e,s,i){s.innerHTML="",e.forEach(t=>{let o=document.createElement("div");o.className="token-chip",o.innerText=t,s.appendChild(o)});let n=Math.min(20,i-e.length);for(let t=0;t<n;t++){let o=document.createElement("div");o.className="token-chip padded",o.innerText="0",s.appendChild(o)}if(e.length<i){let t=document.createElement("div");t.className="mini-subtitle",t.innerText=`... and ${i-e.length-n} more padding tokens`,s.appendChild(t)}}};var x=class{async render(e,s,i){let n=e instanceof tf.Tensor?await e.data():e;s.innerHTML="";for(let t=0;t<n.length;t++){let o=n[t],r=document.createElement("div");r.className="viz-cell";let a=Math.max(0,Math.min(255,(o+.1)*1e3+128));r.style.backgroundColor=`rgb(${a}, ${a/2}, 255)`,r.title=`Dim ${t}: ${o.toFixed(4)}`,s.appendChild(r)}i.innerText="Full Vector: ["+Array.from(n).map(t=>t.toFixed(4)).join(", ")+"]"}};var v=class{constructor(e){this.modelUrl=e.url,this.modelRuntime=e.runtime,this.litertHostedWasmUrl=e.litertjsWasmUrl?e.litertjsWasmUrl:"https://cdn.jsdelivr.net/npm/@litertjs/core@0.2.1/wasm/",this.tokenizerId=e.tokenizer,this.seqLength=e.sequenceLength,this.vectorStore=new f,this.cosineSimilarity=new b,this.embeddingModel=new p(this.modelRuntime),this.tokenizer=new w,this.visualizeTokens=new y,this.visualizeEmbedding=new x,this.allStoredData=void 0,this.lastDBName=""}async load(e){if(e&&(e.innerText="Setting WebGPU Backend for TFJS..."),await tf.setBackend("webgpu"),e&&(e.innerText="Initializing Model Runtime..."),this.modelRuntime==="litertjs"){let s=this.litertHostedWasmUrl;await T.loadLiteRt(s);let i=tf.backend();T.setWebGpuDevice(i.device)}e&&(e.innerText="Loading Tokenizer & Embedding Model..."),await this.embeddingModel.load(this.modelUrl,this.modelRuntime),e&&(e.innerText="Loading Tokenizer..."),this.modelRuntime==="litertjs"&&await this.tokenizer.load(this.tokenizerId)}setDb(e){this.vectorStore.setDb(e)}async getEmbedding(e){if(this.modelRuntime==="litertjs"){let s=await this.tokenizer.encode(e),{embedding:i}=await this.embeddingModel.getEmbeddingLiteRTJS(s,this.seqLength),n=await i.array();return i.dispose(),{embedding:n[0],tokens:s}}else{let{embedding:s}=await this.embeddingModel.getEmbeddingTransformers(e);return{embedding:s}}}renderTokens(e,s){this.visualizeTokens.render(e,s,this.seqLength)}async renderEmbedding(e,s,i){await this.visualizeEmbedding.render(e,s,i)}async deleteGPUVectorCache(){await this.cosineSimilarity.deleteGPUVectorCache()}async search(e,s,i,n=5){let t;if(this.lastDBName!==i?(await this.deleteGPUVectorCache(),this.lastDBName=i,this.allStoredData=await this.vectorStore.getAllVectors(),t=this.allStoredData.map(d=>d.embedding)):t=this.allStoredData.map(d=>d.embedding),t.length===0)return console.warn("No data in chosen vector store. Store some data first before searching"),{results:[],bestScore:0,bestIndex:0};let{values:o,indices:r}=await this.cosineSimilarity.cosineSimilarityTFJSGPUMatrix(t,e,n),a=[],c=0,l=0;for(let d=0;d<o.length;d++)o[d]>=s&&a.length<n&&(a.push({id:this.allStoredData[r[d]].id,score:o[d],vector:this.allStoredData[r[d]].embedding}),o[d]>l&&(c=a.length-1,l=o[d]));let m=[];for(let d of a){let h=await this.vectorStore.getTextByID(d.id);m.push({...d,text:h})}return{results:m,bestScore:l,bestIndex:c}}async storeBatch(e){await this.vectorStore.storeBatch(e)}async storeTexts(e,s,i,n=2){this.setDb(s);let t=[],o=[];for(let r=0;r<e.length;r++)if(i&&(i.innerText=`Embedding paragraph ${r+1} of ${e.length}...`),this.modelRuntime==="litertjs"){let a=await this.tokenizer.encode(e[r]),{embedding:c}=await this.embeddingModel.getEmbeddingLiteRTJS(a,this.seqLength);if(o.push(c),t.push(e[r]),o.length>=n||r===e.length-1){let l=tf.stack(o),d=(await l.array()).map((h,g)=>({embedding:h[0],text:t[g]}));await this.vectorStore.storeBatch(d),o.forEach(h=>h.dispose()),l.dispose(),o=[],t=[]}}else if(t.push(e[r]),t.length>=n||r===e.length-1){let{embedding:a}=await this.embeddingModel.getEmbeddingTransformers(t),c=a.length/n;for(let l=0;l<a.length/c;l++){let m={embedding:a.slice(l*c,(l+1)*c),text:t[l]};await this.vectorStore.storeBatch([m])}t=[]}await this.deleteGPUVectorCache()}};export{v as VectorSearch};
demo/assets/1.25.0-dev/dist/ort-wasm-simd-threaded.asyncify.mjs ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ async function ortWasmThreaded(moduleArg={}){var moduleRtn;var g=moduleArg,aa=!!globalThis.window,ba=!!globalThis.WorkerGlobalScope,l=globalThis.process?.versions?.node&&"renderer"!=globalThis.process?.type,n=ba&&self.name?.startsWith("em-pthread");if(l){const {createRequire:a}=await import("module");var require=a(import.meta.url),ca=require("worker_threads");global.Worker=ca.Worker;n=(ba=!ca.ne)&&"em-pthread"==ca.workerData}g.mountExternalData=(a,b)=>{a.startsWith("./")&&(a=a.substring(2));(g.Uc||(g.Uc=new Map)).set(a,b)};
2
+ g.unmountExternalData=()=>{delete g.Uc};var SharedArrayBuffer=globalThis.SharedArrayBuffer??(new WebAssembly.Memory({initial:0,maximum:0,Be:!0})).buffer.constructor;
3
+ let ea=()=>{const a=b=>(...c)=>{const d=r;c=b(...c);return r!=d?da():c};(b=>{for(const c of b)g[c]=a(g[c])})(["_OrtAppendExecutionProvider","_OrtCreateSession","_OrtRun","_OrtRunWithBinding","_OrtBindInput"]);"undefined"!==typeof jsepRunAsync&&(g._OrtRun=jsepRunAsync(g._OrtRun),g._OrtRunWithBinding=jsepRunAsync(g._OrtRunWithBinding));ea=void 0};g.asyncInit=()=>{ea?.()};var fa="./this.program",ha=(a,b)=>{throw b;},ia=import.meta.url,ja="",ka,la;
4
+ if(l){var fs=require("fs");ia.startsWith("file:")&&(ja=require("path").dirname(require("url").fileURLToPath(ia))+"/");la=a=>{a=ma(a)?new URL(a):a;return fs.readFileSync(a)};ka=async a=>{a=ma(a)?new URL(a):a;return fs.readFileSync(a,void 0)};1<process.argv.length&&(fa=process.argv[1].replace(/\\/g,"/"));process.argv.slice(2);ha=(a,b)=>{process.exitCode=a;throw b;}}else if(aa||ba){try{ja=(new URL(".",ia)).href}catch{}l||(ba&&(la=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";
5
+ b.send(null);return new Uint8Array(b.response)}),ka=async a=>{if(ma(a))return new Promise((c,d)=>{var e=new XMLHttpRequest;e.open("GET",a,!0);e.responseType="arraybuffer";e.onload=()=>{200==e.status||0==e.status&&e.response?c(e.response):d(e.status)};e.onerror=d;e.send(null)});var b=await fetch(a,{credentials:"same-origin"});if(b.ok)return b.arrayBuffer();throw Error(b.status+" : "+b.url);})}var na=console.log.bind(console),oa=console.error.bind(console);
6
+ if(l){var pa=require("util"),qa=a=>"object"==typeof a?pa.inspect(a):a;na=(...a)=>fs.writeSync(1,a.map(qa).join(" ")+"\n");oa=(...a)=>fs.writeSync(2,a.map(qa).join(" ")+"\n")}var ra=na,t=oa,sa,ta,ua=!1,va,ma=a=>a.startsWith("file://");function u(){v.buffer!=w.buffer&&wa()}var xa,ya;
7
+ if(l&&n){var Aa=ca.parentPort;Aa.on("message",a=>global.onmessage?.({data:a}));Object.assign(globalThis,{self:global,postMessage:a=>Aa.postMessage(a)});process.on("uncaughtException",a=>{postMessage({Oc:"uncaughtException",error:a});process.exit(1)})}var Ba;
8
+ if(n){var Ca=!1;self.onunhandledrejection=b=>{throw b.reason||b;};function a(b){try{var c=b.data,d=c.Oc;if("load"===d){let e=[];self.onmessage=f=>e.push(f);Ba=()=>{postMessage({Oc:"loaded"});for(let f of e)a(f);self.onmessage=a};for(const f of c.de)if(!g[f]||g[f].proxy)g[f]=(...h)=>{postMessage({Oc:"callHandler",ce:f,args:h})},"print"==f&&(ra=g[f]),"printErr"==f&&(t=g[f]);v=c.je;wa();ta=c.ke;Da();Ea()}else if("run"===d){Fa(c.Nc);Ga(c.Nc,0,0,1,0,0);Ha();Ia(c.Nc);Ca||(Ja(),Ca=!0);try{Ka(c.he,c.Wc)}catch(e){if("unwind"!=
9
+ e)throw e;}}else"setimmediate"!==c.target&&("checkMailbox"===d?Ca&&La():d&&(t(`worker: received unknown command ${d}`),t(c)))}catch(e){throw Ma(),e;}}self.onmessage=a}var w,x,Na,Oa,A,B,Pa,E,F,Qa,Ra=!1;function wa(){var a=v.buffer;g.HEAP8=w=new Int8Array(a);Na=new Int16Array(a);g.HEAPU8=x=new Uint8Array(a);Oa=new Uint16Array(a);g.HEAP32=A=new Int32Array(a);g.HEAPU32=B=new Uint32Array(a);Pa=new Float32Array(a);E=new Float64Array(a);F=new BigInt64Array(a);Qa=new BigUint64Array(a)}
10
+ function Sa(){Ra=!0;n?Ba():G._b()}function Ta(a){a="Aborted("+a+")";t(a);ua=!0;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");ya?.(a);throw a;}var Ua;async function Va(a){if(!sa)try{var b=await ka(a);return new Uint8Array(b)}catch{}if(a==Ua&&sa)a=new Uint8Array(sa);else if(la)a=la(a);else throw"both async and sync fetching of the wasm failed";return a}
11
+ async function Wa(a,b){try{var c=await Va(a);return await WebAssembly.instantiate(c,b)}catch(d){t(`failed to asynchronously prepare wasm: ${d}`),Ta(d)}}async function Xa(a){var b=Ua;if(!sa&&!ma(b)&&!l)try{var c=fetch(b,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(c,a)}catch(d){t(`wasm streaming compile failed: ${d}`),t("falling back to ArrayBuffer instantiation")}return Wa(b,a)}
12
+ function Ya(){Za={f:$a,J:ab,k:bb,p:cb,l:db,ta:eb,b:fb,ca:gb,Ka:hb,q:ib,da:jb,_a:kb,Ga:lb,Ia:mb,$a:nb,Ya:ob,Ra:pb,Xa:qb,pa:rb,Ha:sb,Yb:tb,Za:ub,Fa:vb,eb:wb,Da:xb,Tb:zb,Rb:Ab,Ca:Cb,M:Db,I:Eb,Sb:Fb,ka:Gb,Ub:Hb,Ua:Ib,Wb:Jb,La:Kb,Pb:Lb,la:Mb,Ta:Ia,bb:Nb,U:Ob,n:Pb,c:Qb,sb:Rb,w:Sb,L:Tb,z:Ub,j:Vb,o:Wb,tb:Xb,G:Yb,T:Zb,h:$b,u:ac,m:bc,i:cc,Oa:dc,Pa:ec,Qa:fc,Ma:gc,Na:hc,Qb:ic,fb:jc,db:kc,Y:lc,rb:mc,ma:nc,cb:oc,gb:pc,ab:qc,Xb:rc,N:sc,hb:tc,X:uc,Vb:vc,ob:wc,C:xc,sa:yc,ra:zc,qb:Ac,W:Bc,v:Cc,nb:Dc,mb:Ec,lb:Fc,pb:Gc,
13
+ kb:Hc,jb:Ic,ib:Jc,Va:Kc,Wa:Lc,Ja:Mc,ea:Nc,oa:Oc,Sa:Pc,na:Qc,Db:Rc,xa:Sc,Eb:Tc,ya:Uc,F:Vc,e:Wc,s:Xc,x:Yc,D:Zc,Ib:$c,ba:ad,B:bd,za:cd,$:dd,ha:ed,Fb:fd,Gb:gd,Ba:hd,Aa:jd,Jb:kd,wa:ld,aa:md,d:nd,A:od,r:pd,Cb:qd,t:rd,y:sd,H:td,E:ud,K:vd,S:wd,ja:xd,_:yd,Kb:zd,Lb:Ad,P:Bd,g:Cd,a:v,Ob:Dd,Hb:Ed,ia:Fd,O:Gd,qa:Hd,Mb:Id,Q:Jd,zb:Kd,Ab:Ld,ua:Md,fa:Nd,R:Od,Ea:Pd,va:Qd,Z:Rd,xb:Sd,Zb:Td,V:Ud,Bb:Vd,ub:Wd,vb:Xd,wb:Yd,ga:Zd,yb:$d,Nb:ae};return{a:Za}}
14
+ async function Da(){function a(d,e){var f=G=d.exports;d={};for(let [h,k]of Object.entries(f))"function"==typeof k?(f=be(k),d[h]=f):d[h]=k;G=d;G=ce();de.push(G.id);d=G;ee=d.$b;Ja=d.ac;g._OrtInit=d.bc;g._OrtGetLastError=d.cc;g._OrtCreateSessionOptions=d.dc;g._OrtAppendExecutionProvider=d.ec;g._OrtAddFreeDimensionOverride=d.fc;g._OrtAddSessionConfigEntry=d.gc;g._OrtReleaseSessionOptions=d.hc;g._OrtCreateSession=d.ic;g._OrtReleaseSession=d.jc;g._OrtGetInputOutputCount=d.kc;g._OrtGetInputOutputMetadata=
15
+ d.lc;g._OrtFree=d.mc;g._OrtCreateTensor=d.nc;g._OrtGetTensorData=d.oc;g._OrtReleaseTensor=d.pc;g._OrtCreateRunOptions=d.qc;g._OrtAddRunConfigEntry=d.rc;g._OrtReleaseRunOptions=d.sc;g._OrtCreateBinding=d.tc;g._OrtBindInput=d.uc;g._OrtBindOutput=d.vc;g._OrtClearBoundOutputs=d.wc;g._OrtReleaseBinding=d.xc;g._OrtRunWithBinding=d.yc;g._OrtRun=d.zc;g._OrtEndProfiling=d.Ac;fe=g._OrtGetWebGpuDevice=d.Bc;ge=d.Cc;H=g._free=d.Dc;he=g._malloc=d.Ec;ie=g._wgpuBufferRelease=d.Fc;je=g._wgpuCreateInstance=d.Gc;ke=
16
+ d.Hc;le=d.Ic;me=d.Jc;ne=d.Kc;oe=d.Lc;pe=d.Pc;qe=d.Zc;re=d._c;se=d.$c;te=d.bd;ue=d.cd;ve=d.dd;we=d.ed;xe=d.fd;ye=d.gd;ze=d.hd;Ga=d.kd;Ma=d.ld;Ae=d.md;Be=d.nd;Ce=d.od;De=d.pd;Ee=d.qd;Fe=d.rd;I=d.sd;Ge=d.td;He=d.ud;J=d.vd;Ie=d.wd;K=d.xd;Je=d.yd;Ke=d.zd;Le=d.Ad;Me=d.Bd;dynCall_vii=d.Cd;Ne=d.Dd;dynCall_v=d.Ed;Oe=d.Fd;Pe=d.Gd;Qe=d.Hd;dynCall_iii=d.Id;Re=d.Jd;Se=d.Kd;Te=d.Ld;dynCall_vi=d.Md;Ue=d.Nd;Ve=d.Od;We=d.Pd;Xe=d.Qd;Ye=d.Rd;Ze=d.Td;$e=d.Ud;af=d.Vd;bf=d.Wd;cf=d.Yd;df=d.Zd;ef=d._d;ff=d.$d;gf=d.ae;hf=
17
+ d.be;jf=d.pe;kf=d.qe;lf=d.re;mf=d.se;nf=d.te;of=d.ue;pf=d.ve;qf=d.we;rf=d.xe;sf=d.ye;tf=d.ze;uf=d.Xe;vf=d.Ye;wf=d.Ze;xf=d._e;ta=e;return G}var b=Ya();if(g.instantiateWasm)return new Promise(d=>{g.instantiateWasm(b,(e,f)=>{d(a(e,f))})});if(n){var c=new WebAssembly.Instance(ta,Ya());return a(c,ta)}Ua??=g.locateFile?g.locateFile?g.locateFile("ort-wasm-simd-threaded.asyncify.wasm",ja):ja+"ort-wasm-simd-threaded.asyncify.wasm":(new URL("ort-wasm-simd-threaded.asyncify.wasm",import.meta.url)).href;
18
+ return function(d){return a(d.instance,d.module)}(await Xa(b))}class yf{name="ExitStatus";constructor(a){this.message=`Program terminated with exit(${a})`;this.status=a}}
19
+ var zf=a=>{a.terminate();a.onmessage=()=>{}},Af=[],Bf=0,Cf=null,If=a=>{0==Df.length&&(Ef(),Ff(Df[0]));var b=Df.pop();if(!b)return 6;Gf.push(b);Hf[a.Nc]=b;b.Nc=a.Nc;var c={Oc:"run",he:a.ge,Wc:a.Wc,Nc:a.Nc};l&&b.unref();b.postMessage(c,a.Yc);return 0},L=0,M=(a,b,...c)=>{var d=16*c.length,e=K(),f=Ie(d),h=f>>>3,k;for(k of c)"bigint"==typeof k?((u(),F)[h++>>>0]=1n,(u(),F)[h++>>>0]=k):((u(),F)[h++>>>0]=0n,(u(),E)[h++>>>0]=k);a=Ae(a,0,d,f,b);J(e);return a};
20
+ function Dd(a){if(n)return M(0,1,a);va=a;if(!(0<L)){for(var b of Gf)zf(b);for(b of Df)zf(b);Df=[];Gf=[];Hf={};ua=!0}ha(a,new yf(a))}function Jf(a){if(n)return M(1,0,a);Mc(a)}var Mc=a=>{va=a;if(n)throw Jf(a),"unwind";Dd(a)},Df=[],Gf=[],de=[],Hf={};function Kf(){for(var a=g.numThreads-1;a--;)Ef();Af.push(async()=>{var b=Lf();Bf++;await b;Bf--;0==Bf&&Cf&&(b=Cf,Cf=null,b())})}var Mf=a=>{var b=a.Nc;delete Hf[b];Df.push(a);Gf.splice(Gf.indexOf(a),1);a.Nc=0;Be(b)};function Ha(){de.forEach(a=>a())}
21
+ var Ff=a=>new Promise(b=>{a.onmessage=f=>{var h=f.data;f=h.Oc;if(h.Vc&&h.Vc!=ge()){var k=Hf[h.Vc];k?k.postMessage(h,h.Yc):t(`Internal error! Worker sent a message "${f}" to target pthread ${h.Vc}, but that thread no longer exists!`)}else if("checkMailbox"===f)La();else if("spawnThread"===f)If(h);else if("cleanupThread"===f)N(()=>{Mf(Hf[h.ie])});else if("loaded"===f)a.loaded=!0,l&&!a.Nc&&a.unref(),b(a);else if("setimmediate"===h.target)a.postMessage(h);else if("uncaughtException"===f)a.onerror(h.error);
22
+ else if("callHandler"===f)g[h.ce](...h.args);else f&&t(`worker sent an unknown command ${f}`)};a.onerror=f=>{t(`${"worker sent an error!"} ${f.filename}:${f.lineno}: ${f.message}`);throw f;};l&&(a.on("message",f=>a.onmessage({data:f})),a.on("error",f=>a.onerror(f)));var c=[],d=[],e;for(e of d)g.propertyIsEnumerable(e)&&c.push(e);a.postMessage({Oc:"load",de:c,je:v,ke:ta})});async function Lf(){if(!n)return Promise.all(Df.map(Ff))}
23
+ function Ef(){var a=new Worker(new URL(import.meta.url),{type:"module",workerData:"em-pthread",name:"em-pthread"});Df.push(a)}function Fa(a){var b=(u(),B)[a+52>>>2>>>0];a=(u(),B)[a+56>>>2>>>0];He(b,b-a);J(b)}var Ka=(a,b)=>{L=0;a=Ne(a,b);0<L?va=a:Ce(a)},v,Nf=[],Of=0,O=a=>-9007199254740992>a||9007199254740992<a?NaN:Number(a);function $a(a){a>>>=0;var b=new Pf(a);0==(u(),w)[b.Qc+12>>>0]&&(Qf(b,!0),Of--);Rf(b,!1);Nf.push(b);return Me(a)}
24
+ var Sf=0,ab=()=>{I(0,0);var a=Nf.pop();Je(a.Xc);Sf=0};function Qf(a,b){b=b?1:0;(u(),w)[a.Qc+12>>>0]=b}function Rf(a,b){b=b?1:0;(u(),w)[a.Qc+13>>>0]=b}class Pf{constructor(a){this.Xc=a;this.Qc=a-24}}var Tf=a=>{var b=Sf;if(!b)return Ge(0),0;var c=new Pf(b);(u(),B)[c.Qc+16>>>2>>>0]=b;var d=(u(),B)[c.Qc+4>>>2>>>0];if(!d)return Ge(0),b;for(var e of a){if(0===e||e===d)break;if(Le(e,d,c.Qc+16))return Ge(e),b}Ge(d);return b};function bb(){return Tf([])}function cb(a){return Tf([a>>>0])}
25
+ function db(a,b,c,d){return Tf([a>>>0,b>>>0,c>>>0,d>>>0])}var eb=()=>{var a=Nf.pop();a||Ta("no exception to throw");var b=a.Xc;0==(u(),w)[a.Qc+13>>>0]&&(Nf.push(a),Rf(a,!0),Qf(a,!1),Of++);Ke(b);Sf=b;throw Sf;};function fb(a,b,c){a>>>=0;var d=new Pf(a);b>>>=0;c>>>=0;(u(),B)[d.Qc+16>>>2>>>0]=0;(u(),B)[d.Qc+4>>>2>>>0]=b;(u(),B)[d.Qc+8>>>2>>>0]=c;Ke(a);Sf=a;Of++;throw Sf;}var gb=()=>Of;function Uf(a,b,c,d){return n?M(2,1,a,b,c,d):hb(a,b,c,d)}
26
+ function hb(a,b,c,d){a>>>=0;b>>>=0;c>>>=0;d>>>=0;if(!globalThis.SharedArrayBuffer)return 6;var e=[];if(n&&0===e.length)return Uf(a,b,c,d);a={ge:c,Nc:a,Wc:d,Yc:e};return n?(a.Oc="spawnThread",postMessage(a,e),0):If(a)}function ib(a){Sf||=a>>>0;throw Sf;}
27
+ var Vf=globalThis.TextDecoder&&new TextDecoder,Wf=(a,b,c,d)=>{c=b+c;if(d)return c;for(;a[b]&&!(b>=c);)++b;return b},Xf=(a,b=0,c,d)=>{b>>>=0;c=Wf(a,b,c,d);if(16<c-b&&a.buffer&&Vf)return Vf.decode(a.buffer instanceof ArrayBuffer?a.subarray(b,c):a.slice(b,c));for(d="";b<c;){var e=a[b++];if(e&128){var f=a[b++]&63;if(192==(e&224))d+=String.fromCharCode((e&31)<<6|f);else{var h=a[b++]&63;e=224==(e&240)?(e&15)<<12|f<<6|h:(e&7)<<18|f<<12|h<<6|a[b++]&63;65536>e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|
28
+ e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d},Yf=(a,b,c)=>(a>>>=0)?Xf((u(),x),a,b,c):"";function jb(a,b,c){return n?M(3,1,a,b,c):0}function kb(a,b){if(n)return M(4,1,a,b)}function lb(a,b){if(n)return M(5,1,a,b)}function mb(a,b,c){if(n)return M(6,1,a,b,c)}function nb(a,b,c){return n?M(7,1,a,b,c):0}function ob(a,b){if(n)return M(8,1,a,b)}function pb(a,b,c){if(n)return M(9,1,a,b,c)}function qb(a,b,c,d){if(n)return M(10,1,a,b,c,d)}function rb(a,b,c,d){if(n)return M(11,1,a,b,c,d)}
29
+ function sb(a,b,c,d){if(n)return M(12,1,a,b,c,d)}function tb(a){if(n)return M(13,1,a)}function ub(a,b){if(n)return M(14,1,a,b)}function vb(a,b,c){if(n)return M(15,1,a,b,c)}var wb=()=>Ta(""),P=a=>{a>>>=0;for(var b="";;){var c=(u(),x)[a++>>>0];if(!c)return b;b+=String.fromCharCode(c)}},Zf={},$f={},ag={},bg=class extends Error{constructor(a){super(a);this.name="BindingError"}};
30
+ function cg(a,b,c={}){var d=b.name;if(!a)throw new bg(`type "${d}" must have a positive integer typeid pointer`);if($f.hasOwnProperty(a)){if(c.ee)return;throw new bg(`Cannot register type '${d}' twice`);}$f[a]=b;delete ag[a];Zf.hasOwnProperty(a)&&(b=Zf[a],delete Zf[a],b.forEach(e=>e()))}function Q(a,b,c={}){return cg(a,b,c)}
31
+ var dg=(a,b,c)=>{switch(b){case 1:return c?d=>(u(),w)[d>>>0]:d=>(u(),x)[d>>>0];case 2:return c?d=>(u(),Na)[d>>>1>>>0]:d=>(u(),Oa)[d>>>1>>>0];case 4:return c?d=>(u(),A)[d>>>2>>>0]:d=>(u(),B)[d>>>2>>>0];case 8:return c?d=>(u(),F)[d>>>3>>>0]:d=>(u(),Qa)[d>>>3>>>0];default:throw new TypeError(`invalid integer width (${b}): ${a}`);}};
32
+ function xb(a,b,c,d,e){a>>>=0;c>>>=0;b=P(b>>>0);d=0n===d;let f=h=>h;if(d){const h=8*c;f=k=>BigInt.asUintN(h,k);e=f(e)}Q(a,{name:b,Mc:f,Sc:(h,k)=>{"number"==typeof k&&(k=BigInt(k));return k},Rc:dg(b,c,!d),Tc:null})}function zb(a,b,c,d){a>>>=0;b=P(b>>>0);Q(a,{name:b,Mc:function(e){return!!e},Sc:function(e,f){return f?c:d},Rc:function(e){return this.Mc((u(),x)[e>>>0])},Tc:null})}var eg=[],fg=[0,1,,1,null,1,!0,1,!1,1];function Qb(a){a>>>=0;9<a&&0===--fg[a+1]&&(fg[a]=void 0,eg.push(a))}
33
+ var R=a=>{if(!a)throw new bg(`Cannot use deleted val. handle = ${a}`);return fg[a]},S=a=>{switch(a){case void 0:return 2;case null:return 4;case !0:return 6;case !1:return 8;default:const b=eg.pop()||fg.length;fg[b]=a;fg[b+1]=1;return b}};function gg(a){return this.Mc((u(),B)[a>>>2>>>0])}var hg={name:"emscripten::val",Mc:a=>{var b=R(a);Qb(a);return b},Sc:(a,b)=>S(b),Rc:gg,Tc:null};function Ab(a){return Q(a>>>0,hg)}
34
+ var ig=(a,b)=>{switch(b){case 4:return function(c){return this.Mc((u(),Pa)[c>>>2>>>0])};case 8:return function(c){return this.Mc((u(),E)[c>>>3>>>0])};default:throw new TypeError(`invalid float width (${b}): ${a}`);}};function Cb(a,b,c){a>>>=0;c>>>=0;b=P(b>>>0);Q(a,{name:b,Mc:d=>d,Sc:(d,e)=>e,Rc:ig(b,c),Tc:null})}function Db(a,b,c,d,e){a>>>=0;c>>>=0;b=P(b>>>0);let f=k=>k;if(0===d){var h=32-8*c;f=k=>k<<h>>>h;e=f(e)}Q(a,{name:b,Mc:f,Sc:(k,m)=>m,Rc:dg(b,c,0!==d),Tc:null})}
35
+ function Eb(a,b,c){function d(f){var h=(u(),B)[f>>>2>>>0];f=(u(),B)[f+4>>>2>>>0];return new e((u(),w).buffer,f,h)}a>>>=0;var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][b];c=P(c>>>0);Q(a,{name:c,Mc:d,Rc:d},{ee:!0})}
36
+ var T=(a,b,c)=>{var d=(u(),x);b>>>=0;if(0<c){var e=b;c=b+c-1;for(var f=0;f<a.length;++f){var h=a.codePointAt(f);if(127>=h){if(b>=c)break;d[b++>>>0]=h}else if(2047>=h){if(b+1>=c)break;d[b++>>>0]=192|h>>6;d[b++>>>0]=128|h&63}else if(65535>=h){if(b+2>=c)break;d[b++>>>0]=224|h>>12;d[b++>>>0]=128|h>>6&63;d[b++>>>0]=128|h&63}else{if(b+3>=c)break;d[b++>>>0]=240|h>>18;d[b++>>>0]=128|h>>12&63;d[b++>>>0]=128|h>>6&63;d[b++>>>0]=128|h&63;f++}}d[b>>>0]=0;a=b-e}else a=0;return a},U=a=>{for(var b=0,c=0;c<a.length;++c){var d=
37
+ a.charCodeAt(c);127>=d?b++:2047>=d?b+=2:55296<=d&&57343>=d?(b+=4,++c):b+=3}return b};
38
+ function Fb(a,b){a>>>=0;b=P(b>>>0);Q(a,{name:b,Mc(c){var d=(u(),B)[c>>>2>>>0];d=Yf(c+4,d,!0);H(c);return d},Sc(c,d){d instanceof ArrayBuffer&&(d=new Uint8Array(d));var e="string"==typeof d;if(!(e||ArrayBuffer.isView(d)&&1==d.BYTES_PER_ELEMENT))throw new bg("Cannot pass non-string to std::string");var f=e?U(d):d.length;var h=he(4+f+1),k=h+4;(u(),B)[h>>>2>>>0]=f;e?T(d,k,f+1):(u(),x).set(d,k>>>0);null!==c&&c.push(H,h);return h},Rc:gg,Tc(c){H(c)}})}
39
+ var jg=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,kg=(a,b,c)=>{a>>>=1;b=Wf((u(),Oa),a,b/2,c);if(16<b-a&&jg)return jg.decode((u(),Oa).slice(a,b));for(c="";a<b;++a){var d=(u(),Oa)[a>>>0];c+=String.fromCharCode(d)}return c},lg=(a,b,c)=>{c??=2147483647;if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var e=0;e<c;++e){var f=a.charCodeAt(e);(u(),Na)[b>>>1>>>0]=f;b+=2}(u(),Na)[b>>>1>>>0]=0;return b-d},mg=a=>2*a.length,ng=(a,b,c)=>{var d="";a>>>=2;for(var e=0;!(e>=b/4);e++){var f=
40
+ (u(),B)[a+e>>>0];if(!f&&!c)break;d+=String.fromCodePoint(f)}return d},og=(a,b,c)=>{b>>>=0;c??=2147483647;if(4>c)return 0;var d=b;c=d+c-4;for(var e=0;e<a.length;++e){var f=a.codePointAt(e);65535<f&&e++;(u(),A)[b>>>2>>>0]=f;b+=4;if(b+4>c)break}(u(),A)[b>>>2>>>0]=0;return b-d},pg=a=>{for(var b=0,c=0;c<a.length;++c)65535<a.codePointAt(c)&&c++,b+=4;return b};
41
+ function Gb(a,b,c){a>>>=0;b>>>=0;c>>>=0;c=P(c);if(2===b){var d=kg;var e=lg;var f=mg}else d=ng,e=og,f=pg;Q(a,{name:c,Mc:h=>{var k=(u(),B)[h>>>2>>>0];k=d(h+4,k*b,!0);H(h);return k},Sc:(h,k)=>{if("string"!=typeof k)throw new bg(`Cannot pass non-string to C++ string type ${c}`);var m=f(k),p=he(4+m+b);(u(),B)[p>>>2>>>0]=m/b;e(k,p+4,m+b);null!==h&&h.push(H,p);return p},Rc:gg,Tc(h){H(h)}})}function Hb(a,b){a>>>=0;b=P(b>>>0);Q(a,{fe:!0,name:b,Mc:()=>{},Sc:()=>{}})}
42
+ function Ib(a){Ga(a>>>0,!ba,1,!aa,131072,!1);Ha()}var N=a=>{if(!ua)try{if(a(),!(0<L))try{n?ge()&&Ce(va):Mc(va)}catch(b){b instanceof yf||"unwind"==b||ha(1,b)}}catch(b){b instanceof yf||"unwind"==b||ha(1,b)}},qg=!Atomics.waitAsync||globalThis.navigator?.userAgent&&91>Number((navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)||[])[2]);function Ia(a){a>>>=0;qg||(Atomics.waitAsync((u(),A),a>>>2,a).value.then(La),a+=128,Atomics.store((u(),A),a>>>2,1))}var La=()=>N(()=>{var a=ge();a&&(Ia(a),Ee())});
43
+ function Jb(a,b){a>>>=0;a==b>>>0?setTimeout(La):n?postMessage({Vc:a,Oc:"checkMailbox"}):(a=Hf[a])&&a.postMessage({Oc:"checkMailbox"})}var rg=[];function Kb(a,b,c,d,e){b>>>=0;e>>>=0;rg.length=0;c=e>>>3;for(d=e+d>>>3;c<d;){var f;(u(),F)[c++>>>0]?f=(u(),F)[c++>>>0]:f=(u(),E)[c++>>>0];rg.push(f)}return(b?sg[b]:tg[a])(...rg)}var Lb=()=>{L=0};function Mb(a){a>>>=0;n?postMessage({Oc:"cleanupThread",ie:a}):Mf(Hf[a])}function Nb(a){l&&Hf[a>>>0].ref()}var ug=a=>{try{a()}catch(b){Ta(b)}};
44
+ function be(a){var b=(...c)=>{vg.push(a);try{return a(...c)}finally{ua||(vg.pop(),r&&1===wg&&0===vg.length&&(wg=0,L+=1,ug(vf),"undefined"!=typeof Fibers&&Fibers.De()))}};xg.set(a,b);return b}var wg=0,r=null,yg=0,vg=[],zg=new Map,Ag=new Map,xg=new Map,Bg=0,Cg=null,Dg=[];function da(){return new Promise((a,b)=>{Cg={resolve:a,reject:b}})}
45
+ function Eg(){var a=he(65548),b=a+12;(u(),B)[a>>>2>>>0]=b;(u(),B)[a+4>>>2>>>0]=b+65536;b=vg[0];if(!zg.has(b)){var c=Bg++;zg.set(b,c);Ag.set(c,b)}b=zg.get(b);(u(),A)[a+8>>>2>>>0]=b;return a}function Fg(){var a=(u(),A)[r+8>>>2>>>0];a=Ag.get(a);a=xg.get(a);--L;return a()}
46
+ function Gg(a){if(!ua){if(0===wg){var b=!1,c=!1;a((d=0)=>{if(!ua&&(yg=d,b=!0,c)){wg=2;ug(()=>wf(r));"undefined"!=typeof MainLoop&&MainLoop.Xd&&MainLoop.resume();d=!1;try{var e=Fg()}catch(k){e=k,d=!0}var f=!1;if(!r){var h=Cg;h&&(Cg=null,(d?h.reject:h.resolve)(e),f=!0)}if(d&&!f)throw e;}});c=!0;b||(wg=1,r=Eg(),"undefined"!=typeof MainLoop&&MainLoop.Xd&&MainLoop.pause(),ug(()=>uf(r)))}else 2===wg?(wg=0,ug(xf),H(r),r=null,Dg.forEach(N)):Ta(`invalid state: ${wg}`);return yg}}var Hg=a=>Gg(b=>{a().then(b)});
47
+ function Ob(a){a>>>=0;return Hg(async()=>{var b=await R(a);return S(b)})}var Ig=[],Jg=a=>{var b=Ig.length;Ig.push(a);return b},Kg=(a,b)=>{for(var c=Array(a),d=0;d<a;++d){var e=d,f=(u(),B)[b+4*d>>>2>>>0],h=$f[f];if(void 0===h)throw a=`parameter ${d}`,f=ee(f),b=P(f),H(f),new bg(`${a} has unknown type ${b}`);c[e]=h}return c},Lg=(a,b,c)=>{var d=[];a=a(d,c);d.length&&((u(),B)[b>>>2>>>0]=S(d));return a},Mg={},Ng=a=>{var b=Mg[a];return void 0===b?P(a):b};
48
+ function Pb(a,b,c){var [d,...e]=Kg(a,b>>>0);b=d.Sc.bind(d);var f=e.map(m=>m.Rc.bind(m));a--;var h={toValue:R};a=f.map((m,p)=>{var C=`argFromPtr${p}`;h[C]=m;return`${C}(args${p?"+"+8*p:""})`});switch(c){case 0:var k="toValue(handle)";break;case 2:k="new (toValue(handle))";break;case 3:k="";break;case 1:h.getStringOrSymbol=Ng,k="toValue(handle)[getStringOrSymbol(methodName)]"}k+=`(${a})`;d.fe||(h.toReturnWire=b,h.emval_returnValue=Lg,k=`return emval_returnValue(toReturnWire, destructorsRef, ${k})`);
49
+ k=`return function (handle, methodName, destructorsRef, args) {\n ${k}\n }`;c=(new Function(Object.keys(h),k))(...Object.values(h));k=`methodCaller<(${e.map(m=>m.name)}) => ${d.name}>`;return Jg(Object.defineProperty(c,"name",{value:k}))}function Rb(a,b){b>>>=0;a=R(a>>>0);b=R(b);return a==b}function Sb(a){a>>>=0;if(!a)return S(globalThis);a=Ng(a);return S(globalThis[a])}function Tb(a){a=Ng(a>>>0);return S(g[a])}function Ub(a,b){b>>>=0;a=R(a>>>0);b=R(b);return S(a[b])}
50
+ function Vb(a){a>>>=0;9<a&&(fg[a+1]+=1)}function Wb(a,b,c,d,e){return Ig[a>>>0](b>>>0,c>>>0,d>>>0,e>>>0)}function Xb(a,b,c,d,e){return Wb(a>>>0,b>>>0,c>>>0,d>>>0,e>>>0)}function Yb(){return S([])}function Zb(a){a=R(a>>>0);for(var b=Array(a.length),c=0;c<a.length;c++)b[c]=a[c];return S(b)}function $b(a){return S(Ng(a>>>0))}function ac(){return S({})}function bc(a){a>>>=0;for(var b=R(a);b.length;){var c=b.pop();b.pop()(c)}Qb(a)}function cc(a,b,c){b>>>=0;c>>>=0;a=R(a>>>0);b=R(b);c=R(c);a[b]=c}
51
+ function dc(a,b){a=O(a);b>>>=0;a=new Date(1E3*a);(u(),A)[b>>>2>>>0]=a.getUTCSeconds();(u(),A)[b+4>>>2>>>0]=a.getUTCMinutes();(u(),A)[b+8>>>2>>>0]=a.getUTCHours();(u(),A)[b+12>>>2>>>0]=a.getUTCDate();(u(),A)[b+16>>>2>>>0]=a.getUTCMonth();(u(),A)[b+20>>>2>>>0]=a.getUTCFullYear()-1900;(u(),A)[b+24>>>2>>>0]=a.getUTCDay();a=(a.getTime()-Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0))/864E5|0;(u(),A)[b+28>>>2>>>0]=a}
52
+ var Og=a=>0===a%4&&(0!==a%100||0===a%400),Pg=[0,31,60,91,121,152,182,213,244,274,305,335],Qg=[0,31,59,90,120,151,181,212,243,273,304,334];
53
+ function ec(a,b){a=O(a);b>>>=0;a=new Date(1E3*a);(u(),A)[b>>>2>>>0]=a.getSeconds();(u(),A)[b+4>>>2>>>0]=a.getMinutes();(u(),A)[b+8>>>2>>>0]=a.getHours();(u(),A)[b+12>>>2>>>0]=a.getDate();(u(),A)[b+16>>>2>>>0]=a.getMonth();(u(),A)[b+20>>>2>>>0]=a.getFullYear()-1900;(u(),A)[b+24>>>2>>>0]=a.getDay();var c=(Og(a.getFullYear())?Pg:Qg)[a.getMonth()]+a.getDate()-1|0;(u(),A)[b+28>>>2>>>0]=c;(u(),A)[b+36>>>2>>>0]=-(60*a.getTimezoneOffset());c=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var d=(new Date(a.getFullYear(),
54
+ 0,1)).getTimezoneOffset();a=(c!=d&&a.getTimezoneOffset()==Math.min(d,c))|0;(u(),A)[b+32>>>2>>>0]=a}
55
+ function fc(a){a>>>=0;var b=new Date((u(),A)[a+20>>>2>>>0]+1900,(u(),A)[a+16>>>2>>>0],(u(),A)[a+12>>>2>>>0],(u(),A)[a+8>>>2>>>0],(u(),A)[a+4>>>2>>>0],(u(),A)[a>>>2>>>0],0),c=(u(),A)[a+32>>>2>>>0],d=b.getTimezoneOffset(),e=(new Date(b.getFullYear(),6,1)).getTimezoneOffset(),f=(new Date(b.getFullYear(),0,1)).getTimezoneOffset(),h=Math.min(f,e);0>c?(u(),A)[a+32>>>2>>>0]=Number(e!=f&&h==d):0<c!=(h==d)&&(e=Math.max(f,e),b.setTime(b.getTime()+6E4*((0<c?h:e)-d)));(u(),A)[a+24>>>2>>>0]=b.getDay();c=(Og(b.getFullYear())?
56
+ Pg:Qg)[b.getMonth()]+b.getDate()-1|0;(u(),A)[a+28>>>2>>>0]=c;(u(),A)[a>>>2>>>0]=b.getSeconds();(u(),A)[a+4>>>2>>>0]=b.getMinutes();(u(),A)[a+8>>>2>>>0]=b.getHours();(u(),A)[a+12>>>2>>>0]=b.getDate();(u(),A)[a+16>>>2>>>0]=b.getMonth();(u(),A)[a+20>>>2>>>0]=b.getYear();a=b.getTime();return BigInt(isNaN(a)?-1:a/1E3)}function gc(a,b,c,d,e,f,h){return n?M(16,1,a,b,c,d,e,f,h):-52}function hc(a,b,c,d,e,f){if(n)return M(17,1,a,b,c,d,e,f)}var Rg={},sc=()=>performance.timeOrigin+performance.now();
57
+ function ic(a,b){if(n)return M(18,1,a,b);Rg[a]&&(clearTimeout(Rg[a].id),delete Rg[a]);if(!b)return 0;var c=setTimeout(()=>{delete Rg[a];N(()=>De(a,performance.timeOrigin+performance.now()))},b);Rg[a]={id:c,Ce:b};return 0}
58
+ function jc(a,b,c,d){a>>>=0;b>>>=0;c>>>=0;d>>>=0;var e=(new Date).getFullYear(),f=(new Date(e,0,1)).getTimezoneOffset();e=(new Date(e,6,1)).getTimezoneOffset();var h=Math.max(f,e);(u(),B)[a>>>2>>>0]=60*h;(u(),A)[b>>>2>>>0]=Number(f!=e);b=k=>{var m=Math.abs(k);return`UTC${0<=k?"-":"+"}${String(Math.floor(m/60)).padStart(2,"0")}${String(m%60).padStart(2,"0")}`};a=b(f);b=b(e);e<f?(T(a,c,17),T(b,d,17)):(T(a,d,17),T(b,c,17))}var oc=()=>Date.now(),Sg=1;
59
+ function kc(a,b,c){c>>>=0;if(!(0<=a&&3>=a))return 28;if(0===a)a=Date.now();else if(Sg)a=performance.timeOrigin+performance.now();else return 52;a=Math.round(1E6*a);(u(),F)[c>>>3>>>0]=BigInt(a);return 0}var Tg=[],Ug=(a,b)=>{Tg.length=0;for(var c;c=(u(),x)[a++>>>0];){var d=105!=c;d&=112!=c;b+=d&&b%8?4:0;Tg.push(112==c?(u(),B)[b>>>2>>>0]:106==c?(u(),F)[b>>>3>>>0]:105==c?(u(),A)[b>>>2>>>0]:(u(),E)[b>>>3>>>0]);b+=d?8:4}return Tg};function lc(a,b,c){a>>>=0;b=Ug(b>>>0,c>>>0);return sg[a](...b)}
60
+ function mc(a,b,c){a>>>=0;b=Ug(b>>>0,c>>>0);return sg[a](...b)}var nc=()=>{};function pc(a,b){return t(Yf(a>>>0,b>>>0))}var qc=()=>{L+=1;throw"unwind";};function rc(){return 4294901760}var tc=()=>1,uc=()=>l?require("os").cpus().length:navigator.hardwareConcurrency;
61
+ function vc(a){a>>>=0;var b=(u(),x).length;if(a<=b||4294901760<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);a:{d=(Math.min(4294901760,65536*Math.ceil(Math.max(a,d)/65536))-v.buffer.byteLength+65535)/65536|0;try{v.grow(d);wa();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1}
62
+ var V=a=>{var b=U(a)+1,c=Ie(b);T(a,c,b);return c},Vg=(a,b)=>{(u(),B)[a>>>2>>>0]=b;var c=(u(),B)[a>>>2>>>0];(u(),B)[a+4>>>2>>>0]=(b-c)/4294967296},Wg=a=>(u(),B)[a>>>2>>>0]+4294967296*(u(),A)[a+4>>>2>>>0],W=[],Xg=(a,b)=>{W[a>>>0]=b},X=[],Yg=[],Zg=(a,b)=>{Yg[a]=new Promise(c=>b.finally(()=>c(a)))},Y=a=>{if(a)return W[a>>>0]},$g=(a,b=0)=>{"unmapped"===a.mapState||Ta();b=qe(b);W[b>>>0]=a;return b},ah=(a,b=0)=>{var c=se(b);b=re(b,c);W[c>>>0]=a.queue;W[b>>>0]=a;return b},bh=(a,b)=>{for(a=(u(),B)[a>>>2>>>
63
+ 0];a;a=(u(),B)[a>>>2>>>0]){var c=(u(),A)[a+4>>>2>>>0];b[c](a)}},ch=(a,b,c)=>{(u(),B)[a>>>2>>>0]=b;(u(),B)[a+4>>>2>>>0]=c},dh=a=>{var b=(u(),B)[a>>>2>>>0];a=(u(),B)[a+4>>>2>>>0];return Yf(b,a)},Z=a=>{var b=(u(),B)[a>>>2>>>0];a=(u(),B)[a+4>>>2>>>0];if(b)return Yf(b,a);if(0===a)return""},eh=a=>{var b=Z(a+4);var c=(c=(u(),B)[a+12>>>2>>>0])?Y(c):"auto";if(a+=16){var d=Y((u(),B)[a+4>>>2>>>0]);var e=(u(),B)[a+16>>>2>>>0];var f=(u(),B)[a+20>>>2>>>0];if(e){for(var h={},k=0;k<e;++k){var m=f+24*k,p=dh(m+4);
64
+ h[p]=(u(),E)[m+16>>>3>>>0]}e=h}else e=void 0;a={module:d,constants:e,entryPoint:Z(a+8)}}else a=void 0;return{label:b,layout:c,compute:a}},fh=(a,b)=>{function c(d,e){d=a[d];(u(),B)[b+e>>>2>>>0]=d}c("maxTextureDimension1D",4);c("maxTextureDimension2D",8);c("maxTextureDimension3D",12);c("maxTextureArrayLayers",16);c("maxBindGroups",20);c("maxBindGroupsPlusVertexBuffers",24);c("maxBindingsPerBindGroup",28);c("maxDynamicUniformBuffersPerPipelineLayout",32);c("maxDynamicStorageBuffersPerPipelineLayout",
65
+ 36);c("maxSampledTexturesPerShaderStage",40);c("maxSamplersPerShaderStage",44);c("maxStorageBuffersPerShaderStage",48);c("maxStorageTexturesPerShaderStage",52);c("maxUniformBuffersPerShaderStage",56);c("minUniformBufferOffsetAlignment",80);c("minStorageBufferOffsetAlignment",84);Vg(b+64,a.maxUniformBufferBindingSize);Vg(b+72,a.maxStorageBufferBindingSize);c("maxVertexBuffers",88);Vg(b+96,a.maxBufferSize);c("maxVertexAttributes",104);c("maxVertexBufferArrayStride",108);c("maxInterStageShaderVariables",
66
+ 112);c("maxColorAttachments",116);c("maxColorAttachmentBytesPerSample",120);c("maxComputeWorkgroupStorageSize",124);c("maxComputeInvocationsPerWorkgroup",128);c("maxComputeWorkgroupSizeX",132);c("maxComputeWorkgroupSizeY",136);c("maxComputeWorkgroupSizeZ",140);c("maxComputeWorkgroupsPerDimension",144);void 0!==a.Ae&&c("maxImmediateSize",148)},gh=[,"validation","out-of-memory","internal"],hh=[,"compatibility","core"],ih={1:"core-features-and-limits",2:"depth-clip-control",3:"depth32float-stencil8",
67
+ 4:"texture-compression-bc",5:"texture-compression-bc-sliced-3d",6:"texture-compression-etc2",7:"texture-compression-astc",8:"texture-compression-astc-sliced-3d",9:"timestamp-query",10:"indirect-first-instance",11:"shader-f16",12:"rg11b10ufloat-renderable",13:"bgra8unorm-storage",14:"float32-filterable",15:"float32-blendable",16:"clip-distances",17:"dual-source-blending",18:"subgroups",19:"texture-formats-tier1",20:"texture-formats-tier2",21:"primitive-index",22:"texture-component-swizzle",327692:"chromium-experimental-unorm16-texture-formats",
68
+ 327729:"chromium-experimental-multi-draw-indirect"},jh=[,"low-power","high-performance"],kh=[,"occlusion","timestamp"],lh={undefined:1,unknown:1,destroyed:2};
69
+ function wc(a,b,c,d,e,f){b=O(b);c=O(c);d>>>=0;e>>>=0;f>>>=0;var h=Y(a>>>0);a={};if(f){var k=(u(),B)[f+12>>>2>>>0];if(k){var m=(u(),B)[f+16>>>2>>>0];a.requiredFeatures=Array.from((u(),B).subarray(m>>>2>>>0,m+4*k>>>2>>>0),q=>ih[q])}var p=(u(),B)[f+20>>>2>>>0];if(p){var C={};function q(z,D,za=!1){D=p+D;D=(u(),B)[D>>>2>>>0];4294967295==D||za&&0==D||(C[z]=D)}function y(z,D){D=p+D;var za=(u(),B)[D>>>2>>>0],yb=(u(),B)[D+4>>>2>>>0];if(4294967295!=za||4294967295!=yb)C[z]=Wg(D)}q("maxTextureDimension1D",4);
70
+ q("maxTextureDimension2D",8);q("maxTextureDimension3D",12);q("maxTextureArrayLayers",16);q("maxBindGroups",20);q("maxBindGroupsPlusVertexBuffers",24);q("maxDynamicUniformBuffersPerPipelineLayout",32);q("maxDynamicStorageBuffersPerPipelineLayout",36);q("maxSampledTexturesPerShaderStage",40);q("maxSamplersPerShaderStage",44);q("maxStorageBuffersPerShaderStage",48);q("maxStorageTexturesPerShaderStage",52);q("maxUniformBuffersPerShaderStage",56);q("minUniformBufferOffsetAlignment",80);q("minStorageBufferOffsetAlignment",
71
+ 84);y("maxUniformBufferBindingSize",64);y("maxStorageBufferBindingSize",72);q("maxVertexBuffers",88);y("maxBufferSize",96);q("maxVertexAttributes",104);q("maxVertexBufferArrayStride",108);q("maxInterStageShaderVariables",112);q("maxColorAttachments",116);q("maxColorAttachmentBytesPerSample",120);q("maxComputeWorkgroupStorageSize",124);q("maxComputeInvocationsPerWorkgroup",128);q("maxComputeWorkgroupSizeX",132);q("maxComputeWorkgroupSizeY",136);q("maxComputeWorkgroupSizeZ",140);q("maxComputeWorkgroupsPerDimension",
72
+ 144);q("maxImmediateSize",148,!0);a.requiredLimits=C}if(k=(u(),B)[f+24>>>2>>>0])k={label:Z(k+4)},a.defaultQueue=k;a.label=Z(f+4)}L+=1;Zg(b,h.requestDevice(a).then(q=>{--L;N(()=>{W[e>>>0]=q.queue;W[d>>>0]=q;L+=1;Zg(c,q.lost.then(y=>{N(()=>{q.onuncapturederror=()=>{};var z=K(),D=V(y.message);ue(c,lh[y.reason],D);J(z)});--L}));q.onuncapturederror=y=>{var z=5;y.error instanceof GPUValidationError?z=2:y.error instanceof GPUOutOfMemoryError?z=3:y.error instanceof GPUInternalError&&(z=4);var D=K();y=V(y.error.message);
73
+ ze(d,z,y);J(D)};"adapterInfo"in q||(q.adapterInfo=h.info);ye(b,1,d,0)})},q=>{--L;N(()=>{var y=K(),z=V(q.message);ye(b,3,d,z);c&&ue(c,4,z);J(y)})}))}function xc(a){a>>>=0;var b=Y(a),c=X[a];if(c){for(var d=0;d<c.length;++d)c[d]();delete X[a]}b.destroy()}function yc(a,b,c){a>>>=0;c>>>=0;var d=Y(a);4294967295==c&&(c=void 0);try{var e=d.getMappedRange(b>>>0,c)}catch(h){return 0}var f=Fe(16,e.byteLength);(u(),x).set(new Uint8Array(e),f>>>0);X[a].push(()=>H(f));return f}
74
+ function zc(a,b,c){a>>>=0;c>>>=0;var d=Y(a);4294967295==c&&(c=void 0);try{var e=d.getMappedRange(b>>>0,c)}catch(h){return 0}var f=Fe(16,e.byteLength);(u(),x).fill(0,f,e.byteLength);X[a].push(()=>{(new Uint8Array(e)).set((u(),x).subarray(f>>>0,f+e.byteLength>>>0));H(f)});return f}
75
+ function Ac(a,b,c,d,e){a>>>=0;b=O(b);c=O(c);e>>>=0;var f=Y(a);X[a]=[];4294967295==e&&(e=void 0);L+=1;Zg(b,f.mapAsync(c,d>>>0,e).then(()=>{--L;N(()=>{ve(b,1,0)})},h=>{--L;N(()=>{K();var k=V(h.message);ve(b,"AbortError"===h.name?4:"OperationError"===h.name?3:0,k);delete X[a]})}))}function Bc(a){a>>>=0;var b=Y(a),c=X[a];if(c){for(var d=0;d<c.length;++d)c[d]();delete X[a];b.unmap()}}function Cc(a){delete W[a>>>0]}
76
+ function Dc(a,b,c){a>>>=0;b>>>=0;c>>>=0;var d=!!(u(),B)[b+32>>>2>>>0];b={label:Z(b+4),usage:(u(),B)[b+16>>>2>>>0],size:Wg(b+24),mappedAtCreation:d};a=Y(a);try{var e=a.createBuffer(b)}catch(f){return!1}W[c>>>0]=e;d&&(X[c]=[]);return!0}function Ec(a,b,c,d){a>>>=0;b=O(b);d>>>=0;c=eh(c>>>0);a=Y(a);L+=1;Zg(b,a.createComputePipelineAsync(c).then(e=>{--L;N(()=>{W[d>>>0]=e;te(b,1,d,0)})},e=>{--L;N(()=>{var f=K(),h=V(e.message);te(b,"validation"===e.reason?3:"internal"===e.reason?4:0,d,h);J(f)})}))}
77
+ function Fc(a,b,c){a>>>=0;b>>>=0;c>>>=0;var d=(u(),B)[b>>>2>>>0],e=(u(),A)[d+4>>>2>>>0];b={label:Z(b+4),code:""};switch(e){case 2:b.code=dh(d+8)}a=Y(a).createShaderModule(b);W[c>>>0]=a}var Gc=a=>{a=Y(a);a.onuncapturederror=null;a.destroy()};
78
+ function Hc(a,b){b=O(b);a=Y(a>>>0);L+=1;Zg(b,a.popErrorScope().then(c=>{--L;N(()=>{var d=5;c?c instanceof GPUValidationError?d=2:c instanceof GPUOutOfMemoryError?d=3:c instanceof GPUInternalError&&(d=4):d=1;var e=K(),f=c?V(c.message):0;we(b,1,d,f);J(e)})},c=>{--L;N(()=>{var d=K(),e=V(c.message);we(b,1,5,e);J(d)})}))}
79
+ function Ic(a,b,c,d){b=O(b);c>>>=0;d>>>=0;if(c){var e={featureLevel:hh[(u(),A)[c+4>>>2>>>0]],powerPreference:jh[(u(),A)[c+8>>>2>>>0]],forceFallbackAdapter:!!(u(),B)[c+12>>>2>>>0]};a=(u(),B)[c>>>2>>>0];0!==a&&(u(),e.Fe=!!(u(),B)[a+8>>>2>>>0])}"gpu"in navigator?(L+=1,Zg(b,navigator.gpu.requestAdapter(e).then(f=>{--L;N(()=>{if(f)W[d>>>0]=f,xe(b,1,d,0);else{var h=K(),k=V("WebGPU not available on this browser (requestAdapter returned null)");xe(b,3,d,k);J(h)}})},f=>{--L;N(()=>{var h=K(),k=V(f.message);
80
+ xe(b,4,d,k);J(h)})}))):(e=K(),a=V("WebGPU not available on this browser (navigator.gpu is not available)"),xe(b,3,d,a),J(e))}function Jc(a,b,c){a>>>=0;b>>>=0;c>>>=0;return Hg(async()=>{var d=[];if(c){var e=(u(),A)[c>>>2>>>0];d.length=b+1;d[b]=new Promise(k=>setTimeout(k,e,0))}else d.length=b;for(var f=0;f<b;++f){var h=Wg(a+8*f);if(!(h in Yg))return h;d[f]=Yg[h]}d=await Promise.race(d);delete Yg[d];return d})}
81
+ var mh={},oh=()=>{if(!nh){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",_:fa||"./this.program"},b;for(b in mh)void 0===mh[b]?delete a[b]:a[b]=mh[b];var c=[];for(b in a)c.push(`${b}=${a[b]}`);nh=c}return nh},nh;function Kc(a,b){if(n)return M(19,1,a,b);a>>>=0;b>>>=0;var c=0,d=0,e;for(e of oh()){var f=b+c;(u(),B)[a+d>>>2>>>0]=f;c+=T(e,f,Infinity)+1;d+=4}return 0}
82
+ function Lc(a,b){if(n)return M(20,1,a,b);a>>>=0;b>>>=0;var c=oh();(u(),B)[a>>>2>>>0]=c.length;a=0;for(var d of c)a+=U(d)+1;(u(),B)[b>>>2>>>0]=a;return 0}function Nc(a){return n?M(21,1,a):52}function Oc(a,b,c,d){return n?M(22,1,a,b,c,d):52}function Pc(a,b,c,d){return n?M(23,1,a,b,c,d):70}var ph=[null,[],[]];
83
+ function Qc(a,b,c,d){if(n)return M(24,1,a,b,c,d);b>>>=0;c>>>=0;d>>>=0;for(var e=0,f=0;f<c;f++){var h=(u(),B)[b>>>2>>>0],k=(u(),B)[b+4>>>2>>>0];b+=8;for(var m=0;m<k;m++){var p=a,C=(u(),x)[h+m>>>0],q=ph[p];0===C||10===C?((1===p?ra:t)(Xf(q)),q.length=0):q.push(C)}e+=k}(u(),B)[d>>>2>>>0]=e;return 0}function Cd(a){return a>>>0}function Ed(a,b){fh(Y(a>>>0).limits,b>>>0);return 1}function Fd(a,b){return Y(a>>>0).features.has(ih[b])}function Gd(a){return BigInt(Y(a>>>0).size)}
84
+ function Hd(a){return BigInt(Y(a>>>0).usage)}function Id(a,b){a>>>=0;b>>>=0;if(b){var c=Z(b+4);b=(u(),B)[b+12>>>2>>>0];b=0!==b?{querySet:Y((u(),B)[b+4>>>2>>>0]),beginningOfPassWriteIndex:(u(),B)[b+8>>>2>>>0],endOfPassWriteIndex:(u(),B)[b+12>>>2>>>0]}:void 0;c={label:c,timestampWrites:b}}b=Y(a);a=oe(0);c=b.beginComputePass(c);W[a>>>0]=c;return a}function Jd(a,b,c,d,e,f){c=O(c);e=O(e);f=O(f);Y(a>>>0).copyBufferToBuffer(Y(b>>>0),c,Y(d>>>0),e,f)}
85
+ function Kd(a){var b=Y(a>>>0);a=me(0);b=b.finish();W[a>>>0]=b;return a}function Ld(a,b,c,d,e,f){f=O(f);Y(a>>>0).resolveQuerySet(Y(b>>>0),c,d,Y(e>>>0),f)}function Md(a,b,c,d){Y(a>>>0).dispatchWorkgroups(b,c,d)}function Nd(a,b,c){c=O(c);Y(a>>>0).dispatchWorkgroupsIndirect(Y(b>>>0),c)}function Od(a){Y(a>>>0).end()}function Pd(a,b,c,d,e){d>>>=0;e>>>=0;a=Y(a>>>0);c=Y(c>>>0);0==d?a.setBindGroup(b,c):a.setBindGroup(b,c,(u(),B),e>>>2,d)}function Qd(a,b){Y(a>>>0).setPipeline(Y(b>>>0))}
86
+ function Rd(a,b,c){Y(a>>>0).Ee(Y(b>>>0),c)}function Sd(a,b){var c=Y(a>>>0);a=le(0);b=c.getBindGroupLayout(b);W[a>>>0]=b;return a}
87
+ function Td(a,b){function c(e){var f=(u(),B)[e+8>>>2>>>0],h=(u(),B)[e+32>>>2>>>0],k=(u(),B)[e+36>>>2>>>0],m=0;bh(e,{327681:p=>{m=(u(),B)[p+8>>>2>>>0]}});f?(h=Wg(e+24),-1==h&&(h=void 0),f={buffer:Y(f),offset:Wg(e+16),size:h}):f=Y(h||k||m);return{binding:(u(),B)[e+4>>>2>>>0],resource:f}}a>>>=0;b>>>=0;b={label:Z(b+4),layout:Y((u(),B)[b+12>>>2>>>0]),entries:function(e,f){for(var h=[],k=0;k<e;++k)h.push(c(f+40*k));return h}((u(),B)[b+16>>>2>>>0],(u(),B)[b+20>>>2>>>0])};a=Y(a);var d=ke(0);Xg(d,a.createBindGroup(b));
88
+ return d}function Ud(a,b){a>>>=0;b>>>=0;var c;b&&(c={label:Z(b+4)});b=Y(a);a=ne(0);c=b.createCommandEncoder(c);W[a>>>0]=c;return a}function Vd(a,b){a>>>=0;b>>>=0;b={type:kh[(u(),A)[b+12>>>2>>>0]],count:(u(),B)[b+16>>>2>>>0]};var c=Y(a);a=pe(0);b=c.createQuerySet(b);W[a>>>0]=b;return a}
89
+ function Wd(a,b){a=Y(a>>>0).adapterInfo;b>>>=0;(u(),B)[b+52>>>2>>>0]=a.subgroupMinSize;(u(),B)[b+56>>>2>>>0]=a.subgroupMaxSize;var c=a.vendor+a.architecture+a.device+a.description;var d=U(c)+1,e=he(d);e&&T(c,e,d);c=e;d=U(a.vendor);ch(b+4,c,d);c+=d;d=U(a.architecture);ch(b+12,c,d);c+=d;d=U(a.device);ch(b+20,c,d);ch(b+28,c+d,U(a.description));(u(),A)[b+36>>>2>>>0]=2;a=a.isFallbackAdapter?3:4;(u(),A)[b+40>>>2>>>0]=a;(u(),B)[b+44>>>2>>>0]=0;(u(),B)[b+48>>>2>>>0]=0;return 1}
90
+ var qh={"core-features-and-limits":1,"depth-clip-control":2,"depth32float-stencil8":3,"texture-compression-bc":4,"texture-compression-bc-sliced-3d":5,"texture-compression-etc2":6,"texture-compression-astc":7,"texture-compression-astc-sliced-3d":8,"timestamp-query":9,"indirect-first-instance":10,"shader-f16":11,"rg11b10ufloat-renderable":12,"bgra8unorm-storage":13,"float32-filterable":14,"float32-blendable":15,"clip-distances":16,"dual-source-blending":17,subgroups:18,"texture-formats-tier1":19,"texture-formats-tier2":20,
91
+ "primitive-index":21,"texture-component-swizzle":22,"chromium-experimental-unorm16-texture-formats":327692,"chromium-experimental-multi-draw-indirect":327729};function Xd(a,b){b>>>=0;var c=Y(a>>>0);a=he(4*c.features.size);var d=0,e=0;for(const f of c.features)c=qh[f],0<=c&&((u(),A)[a+d>>>2>>>0]=c,d+=4,e++);(u(),B)[b+4>>>2>>>0]=a;(u(),B)[b>>>2>>>0]=e}function Yd(a,b){fh(Y(a>>>0).limits,b>>>0);return 1}function Zd(a,b){Y(a>>>0).pushErrorScope(gh[b])}
92
+ function $d(a,b,c){b>>>=0;c>>>=0;a=Y(a>>>0);b=Array.from((u(),A).subarray(c>>>2>>>0,c+4*b>>>2>>>0),d=>Y(d));a.submit(b)}function ae(a,b,c,d,e){c=O(c);d>>>=0;e>>>=0;a=Y(a>>>0);b=Y(b>>>0);d=(u(),x).subarray(d>>>0,d+e>>>0);a.writeBuffer(b,c,d,0,e)}n||Kf();n||(v=new WebAssembly.Memory({initial:256,maximum:65536,shared:!0}),wa());g.wasmBinary&&(sa=g.wasmBinary);g.stackSave=()=>K();g.stackRestore=a=>J(a);g.stackAlloc=a=>Ie(a);
93
+ g.setValue=function(a,b,c="i8"){c.endsWith("*")&&(c="*");switch(c){case "i1":(u(),w)[a>>>0]=b;break;case "i8":(u(),w)[a>>>0]=b;break;case "i16":(u(),Na)[a>>>1>>>0]=b;break;case "i32":(u(),A)[a>>>2>>>0]=b;break;case "i64":(u(),F)[a>>>3>>>0]=BigInt(b);break;case "float":(u(),Pa)[a>>>2>>>0]=b;break;case "double":(u(),E)[a>>>3>>>0]=b;break;case "*":(u(),B)[a>>>2>>>0]=b;break;default:Ta(`invalid type for setValue: ${c}`)}};
94
+ g.getValue=function(a,b="i8"){b.endsWith("*")&&(b="*");switch(b){case "i1":return(u(),w)[a>>>0];case "i8":return(u(),w)[a>>>0];case "i16":return(u(),Na)[a>>>1>>>0];case "i32":return(u(),A)[a>>>2>>>0];case "i64":return(u(),F)[a>>>3>>>0];case "float":return(u(),Pa)[a>>>2>>>0];case "double":return(u(),E)[a>>>3>>>0];case "*":return(u(),B)[a>>>2>>>0];default:Ta(`invalid type for getValue: ${b}`)}};g.UTF8ToString=Yf;g.stringToUTF8=T;g.lengthBytesUTF8=U;
95
+ var tg=[Dd,Jf,Uf,jb,kb,lb,mb,nb,ob,pb,qb,rb,sb,tb,ub,vb,gc,hc,ic,Kc,Lc,Nc,Oc,Pc,Qc],sg={937012:(a,b,c,d,e)=>{if("undefined"==typeof g||!g.Uc)return 1;a=Yf(Number(a>>>0));a.startsWith("./")&&(a=a.substring(2));a=g.Uc.get(a);if(!a)return 2;b=Number(b>>>0);c=Number(c>>>0);d=Number(d>>>0);if(b+c>a.byteLength)return 3;try{const f=a.subarray(b,b+c);switch(e){case 0:(u(),x).set(f,d>>>0);break;case 1:g.ad?g.ad(d,f):g.oe(d,f);break;default:return 4}return 0}catch{return 4}},937836:(a,b,c)=>{g.Sd(a,(u(),x).subarray(b>>>
96
+ 0,b+c>>>0))},937900:()=>g.me(),937942:a=>{g.jd(a)},937979:()=>"undefined"!==typeof wasmOffsetConverter},ee,Ja,fe,ge,H,he,ie,je,ke,le,me,ne,oe,pe,qe,re,se,te,ue,ve,we,xe,ye,ze,Ga,Ma,Ae,Be,Ce,De,Ee,Fe,I,Ge,He,J,Ie,K,Je,Ke,Le,Me,dynCall_vii,Ne,dynCall_v,Oe,Pe,Qe,dynCall_iii,Re,Se,Te,dynCall_vi,Ue,Ve,We,Xe,Ye,Ze,$e,af,bf,cf,df,ef,ff,gf,hf,jf,kf,lf,mf,nf,of,pf,qf,rf,sf,tf,uf,vf,wf,xf,Za;function Yc(a,b,c,d){var e=K();try{return Te(a,b,c,d)}catch(f){J(e);if(f!==f+0)throw f;I(1,0)}}
97
+ function Xc(a,b,c){var d=K();try{return dynCall_iii(a,b,c)}catch(e){J(d);if(e!==e+0)throw e;I(1,0)}}function nd(a){var b=K();try{dynCall_v(a)}catch(c){J(b);if(c!==c+0)throw c;I(1,0)}}function Wc(a,b){var c=K();try{return Ne(a,b)}catch(d){J(c);if(d!==d+0)throw d;I(1,0)}}function pd(a,b,c){var d=K();try{dynCall_vii(a,b,c)}catch(e){J(d);if(e!==e+0)throw e;I(1,0)}}function od(a,b){var c=K();try{dynCall_vi(a,b)}catch(d){J(c);if(d!==d+0)throw d;I(1,0)}}
98
+ function bd(a,b,c,d,e,f,h){var k=K();try{return Qe(a,b,c,d,e,f,h)}catch(m){J(k);if(m!==m+0)throw m;I(1,0)}}function td(a,b,c,d,e,f){var h=K();try{Oe(a,b,c,d,e,f)}catch(k){J(h);if(k!==k+0)throw k;I(1,0)}}function rd(a,b,c,d){var e=K();try{Se(a,b,c,d)}catch(f){J(e);if(f!==f+0)throw f;I(1,0)}}function ud(a,b,c,d,e,f,h){var k=K();try{Ve(a,b,c,d,e,f,h)}catch(m){J(k);if(m!==m+0)throw m;I(1,0)}}function Ad(a,b,c,d,e,f,h){var k=K();try{We(a,b,c,d,e,f,h)}catch(m){J(k);if(m!==m+0)throw m;I(1,0)}}
99
+ function zd(a,b,c,d,e,f,h,k){var m=K();try{ef(a,b,c,d,e,f,h,k)}catch(p){J(m);if(p!==p+0)throw p;I(1,0)}}function xd(a,b,c,d,e,f,h,k,m,p,C,q){var y=K();try{Xe(a,b,c,d,e,f,h,k,m,p,C,q)}catch(z){J(y);if(z!==z+0)throw z;I(1,0)}}function Zc(a,b,c,d,e){var f=K();try{return Ue(a,b,c,d,e)}catch(h){J(f);if(h!==h+0)throw h;I(1,0)}}function sd(a,b,c,d,e){var f=K();try{Pe(a,b,c,d,e)}catch(h){J(f);if(h!==h+0)throw h;I(1,0)}}
100
+ function vd(a,b,c,d,e,f,h,k){var m=K();try{Re(a,b,c,d,e,f,h,k)}catch(p){J(m);if(p!==p+0)throw p;I(1,0)}}function Vc(a){var b=K();try{return ff(a)}catch(c){J(b);if(c!==c+0)throw c;I(1,0)}}function hd(a,b,c){var d=K();try{return gf(a,b,c)}catch(e){J(d);if(e!==e+0)throw e;I(1,0)}}function kd(a,b){var c=K();try{return tf(a,b)}catch(d){J(c);if(d!==d+0)throw d;I(1,0);return 0n}}function Bd(a,b,c,d,e){var f=K();try{hf(a,b,c,d,e)}catch(h){J(f);if(h!==h+0)throw h;I(1,0)}}
101
+ function jd(a){var b=K();try{return Ye(a)}catch(c){J(b);if(c!==c+0)throw c;I(1,0);return 0n}}function ad(a,b,c,d,e,f){var h=K();try{return cf(a,b,c,d,e,f)}catch(k){J(h);if(k!==k+0)throw k;I(1,0)}}function ed(a,b,c,d,e,f){var h=K();try{return jf(a,b,c,d,e,f)}catch(k){J(h);if(k!==k+0)throw k;I(1,0)}}function $c(a,b,c,d,e,f){var h=K();try{return kf(a,b,c,d,e,f)}catch(k){J(h);if(k!==k+0)throw k;I(1,0)}}
102
+ function cd(a,b,c,d,e,f,h,k){var m=K();try{return df(a,b,c,d,e,f,h,k)}catch(p){J(m);if(p!==p+0)throw p;I(1,0)}}function md(a,b,c,d,e){var f=K();try{return lf(a,b,c,d,e)}catch(h){J(f);if(h!==h+0)throw h;I(1,0);return 0n}}function Uc(a,b,c,d){var e=K();try{return mf(a,b,c,d)}catch(f){J(e);if(f!==f+0)throw f;I(1,0)}}function Sc(a,b,c,d){var e=K();try{return nf(a,b,c,d)}catch(f){J(e);if(f!==f+0)throw f;I(1,0)}}
103
+ function dd(a,b,c,d,e,f,h,k,m,p,C,q){var y=K();try{return of(a,b,c,d,e,f,h,k,m,p,C,q)}catch(z){J(y);if(z!==z+0)throw z;I(1,0)}}function wd(a,b,c,d,e,f,h,k,m,p,C){var q=K();try{pf(a,b,c,d,e,f,h,k,m,p,C)}catch(y){J(q);if(y!==y+0)throw y;I(1,0)}}function yd(a,b,c,d,e,f,h,k,m,p,C,q,y,z,D,za){var yb=K();try{qf(a,b,c,d,e,f,h,k,m,p,C,q,y,z,D,za)}catch(Bb){J(yb);if(Bb!==Bb+0)throw Bb;I(1,0)}}function gd(a,b,c,d){var e=K();try{return rf(a,b,c,d)}catch(f){J(e);if(f!==f+0)throw f;I(1,0)}}
104
+ function fd(a,b,c,d,e){var f=K();try{return sf(a,b,c,d,e)}catch(h){J(f);if(h!==h+0)throw h;I(1,0)}}function ld(a,b,c){var d=K();try{return $e(a,b,c)}catch(e){J(d);if(e!==e+0)throw e;I(1,0);return 0n}}function Tc(a,b,c){var d=K();try{return Ze(a,b,c)}catch(e){J(d);if(e!==e+0)throw e;I(1,0)}}function Rc(a,b,c){var d=K();try{return af(a,b,c)}catch(e){J(d);if(e!==e+0)throw e;I(1,0)}}function qd(a,b,c,d){var e=K();try{bf(a,b,c,d)}catch(f){J(e);if(f!==f+0)throw f;I(1,0)}}
105
+ function ce(){var a=G;a=Object.assign({},a);var b=d=>e=>d(e)>>>0,c=d=>()=>d()>>>0;a.$b=b(a.$b);a.Cc=c(a.Cc);a.Ec=b(a.Ec);a.rd=(d=>(e,f)=>d(e,f)>>>0)(a.rd);a.wd=b(a.wd);a.xd=c(a.xd);a.Bd=b(a.Bd);return a}function Ea(){if(0<Bf)Cf=Ea;else if(n)xa?.(g),Sa();else{for(var a=Af;0<a.length;)a.shift()(g);0<Bf?Cf=Ea:(g.calledRun=!0,ua||(Sa(),xa?.(g)))}}var G;n||(G=await (Da()),Ea());g.PTR_SIZE=4;
106
+ g.webgpuInit=a=>{const b=new WeakMap;let c=1,d=void 0,e=void 0;g.webgpuRegisterDevice=k=>{if(void 0!==e)throw Error("another WebGPU EP inference session is being created.");if(k){var m=b.get(k);if(!m){m=je(0);const p=ah(k,m);m=[c++,m,p];b.set(k,m)}d=k;e=m[0];return m}d=void 0;e=0};const f=new Map;g.webgpuOnCreateSession=k=>{if(void 0!==e){var m=e;e=void 0;if(k){const p=fe(m);f.set(k,p);0===m&&a(d??Y(p))}d=void 0}};g.webgpuOnReleaseSession=k=>{f.delete(k)};const h=Symbol("gpuBufferMetadata");g.webgpuRegisterBuffer=
107
+ (k,m,p)=>{if(p)return k[h]=[p,NaN],p;if(p=k[h])return p[1]++,p[0];m=f.get(m);if(void 0===m)throw Error("Invalid session handle passed to webgpuRegisterBuffer");m=$g(k,m);k[h]=[m,1];return m};g.webgpuUnregisterBuffer=k=>{const m=k[h];if(!m)throw Error("Buffer is not registered");m[1]--;0===m[1]&&(ie(m[0]),delete k[h])};g.webgpuGetBuffer=k=>Y(k);g.webgpuCreateDownloader=(k,m,p)=>{p=f.get(p);if(void 0===p)throw Error("Invalid session handle passed to webgpuRegisterBuffer");const C=Y(p),q=16*Math.ceil(Number(m)/
108
+ 16);return async()=>{const y=C.createBuffer({size:q,usage:9});try{const z=C.createCommandEncoder();z.copyBufferToBuffer(k,0,y,0,q);C.queue.submit([z.finish()]);await y.mapAsync(GPUMapMode.READ);return y.getMappedRange().slice(0,m)}finally{y.destroy()}}};g.ad=(k,m)=>{var p=m.buffer;const C=m.byteOffset,q=m.byteLength;m=16*Math.ceil(Number(q)/16);k=Y(k);if(!d){var y=fe(e);d=Y(y)}y=d.createBuffer({mappedAtCreation:!0,size:m,usage:6});const z=y.getMappedRange();(new Uint8Array(z)).set(new Uint8Array(p,
109
+ C,q));y.unmap();p=d.createCommandEncoder();p.copyBufferToBuffer(y,0,k,0,m);d.queue.submit([p.finish()]);y.destroy()}};
110
+ g.webnnInit=a=>{const b=a[0];[g.me,g.jd,g.webnnEnsureTensor,g.Sd,g.webnnDownloadTensor,g.le,g.webnnEnableTraceEvent]=a.slice(1);g.webnnReleaseTensorId=g.jd;g.webnnUploadTensor=g.Sd;g.webnnRegisterMLContext=g.le;g.webnnOnRunStart=c=>b.onRunStart(c);g.webnnOnRunEnd=b.onRunEnd.bind(b);g.webnnOnReleaseSession=c=>{b.onReleaseSession(c)};g.webnnCreateMLTensorDownloader=(c,d)=>b.createMLTensorDownloader(c,d);g.webnnRegisterMLTensor=(c,d,e,f)=>b.registerMLTensor(c,d,e,f);g.webnnCreateMLContext=c=>b.createMLContext(c);
111
+ g.webnnRegisterMLConstant=(c,d,e,f,h,k)=>b.registerMLConstant(c,d,e,f,h,g.Uc,k);g.webnnRegisterGraphInput=b.registerGraphInput.bind(b);g.webnnIsGraphInput=b.isGraphInput.bind(b);g.webnnRegisterGraphOutput=b.registerGraphOutput.bind(b);g.webnnIsGraphOutput=b.isGraphOutput.bind(b);g.webnnCreateTemporaryTensor=b.createTemporaryTensor.bind(b);g.webnnIsGraphInputOutputTypeSupported=b.isGraphInputOutputTypeSupported.bind(b)};Ra?moduleRtn=g:moduleRtn=new Promise((a,b)=>{xa=a;ya=b});
112
+ ;return moduleRtn}export default ortWasmThreaded;var isPthread=globalThis.self?.name?.startsWith("em-pthread");var isNode=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";if(isNode)isPthread=(await import("worker_threads")).workerData==="em-pthread";isPthread&&ortWasmThreaded();
demo/assets/1.25.0-dev/dist/ort-wasm-simd-threaded.asyncify.wasm ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c166156008397d88143e635d70f92482b2b2f60dcedf6d0ebf8a239b39c1b73
3
+ size 22817308
demo/assets/1.25.0-dev/dist/ort-wasm-simd-threaded.jsep.mjs ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ async function ortWasmThreaded(moduleArg={}){var moduleRtn;var f=moduleArg,aa=!!globalThis.window,ba=!!globalThis.WorkerGlobalScope,h=globalThis.process?.versions?.node&&"renderer"!=globalThis.process?.type,m=ba&&self.name?.startsWith("em-pthread");if(h){const {createRequire:a}=await import("module");var require=a(import.meta.url),ca=require("worker_threads");global.Worker=ca.Worker;m=(ba=!ca.$d)&&"em-pthread"==ca.workerData}f.mountExternalData=(a,b)=>{a.startsWith("./")&&(a=a.substring(2));(f.Zc||(f.Zc=new Map)).set(a,b)};
2
+ f.unmountExternalData=()=>{delete f.Zc};var SharedArrayBuffer=globalThis.SharedArrayBuffer??(new WebAssembly.Memory({initial:0,maximum:0,ae:!0})).buffer.constructor;const da=a=>async(...b)=>{try{if(f.$c)throw Error("Session already started");const d=f.$c={Nd:b[0],errors:[]},c=await a(...b);if(f.$c!==d)throw Error("Session mismatch");f.gd?.flush();const e=d.errors;if(0<e.length){let g=await Promise.all(e);g=g.filter(k=>k);if(0<g.length)throw Error(g.join("\n"));}return c}finally{f.$c=null}};
3
+ f.jsepInit=(a,b)=>{if("webgpu"===a){[f.gd,f.Dd,f.Hd,f.jd,f.Gd,f.ac,f.Id,f.Kd,f.Ed,f.Fd,f.Jd]=b;const d=f.gd;f.jsepRegisterBuffer=(c,e,g,k)=>d.registerBuffer(c,e,g,k);f.jsepGetBuffer=c=>d.getBuffer(c);f.jsepCreateDownloader=(c,e,g)=>d.createDownloader(c,e,g);f.jsepOnCreateSession=c=>{d.onCreateSession(c)};f.jsepOnReleaseSession=c=>{d.onReleaseSession(c)};f.jsepOnRunStart=c=>d.onRunStart(c);f.Ld=(c,e)=>{d.upload(c,e)}}else if("webnn"===a){const d=b[0];[f.Zd,f.vd,f.webnnEnsureTensor,f.wd,f.webnnDownloadTensor,
4
+ f.Yd,f.webnnEnableTraceEvent]=b.slice(1);f.webnnReleaseTensorId=f.vd;f.webnnUploadTensor=f.wd;f.webnnRegisterMLContext=f.Yd;f.webnnOnRunStart=c=>d.onRunStart(c);f.webnnOnRunEnd=d.onRunEnd.bind(d);f.webnnOnReleaseSession=c=>{d.onReleaseSession(c)};f.webnnCreateMLTensorDownloader=(c,e)=>d.createMLTensorDownloader(c,e);f.webnnRegisterMLTensor=(c,e,g,k)=>d.registerMLTensor(c,e,g,k);f.webnnCreateMLContext=c=>d.createMLContext(c);f.webnnRegisterMLConstant=(c,e,g,k,l,n)=>d.registerMLConstant(c,e,g,k,l,f.Zc,
5
+ n);f.webnnRegisterGraphInput=d.registerGraphInput.bind(d);f.webnnIsGraphInput=d.isGraphInput.bind(d);f.webnnRegisterGraphOutput=d.registerGraphOutput.bind(d);f.webnnIsGraphOutput=d.isGraphOutput.bind(d);f.webnnCreateTemporaryTensor=d.createTemporaryTensor.bind(d);f.webnnIsGraphInputOutputTypeSupported=d.isGraphInputOutputTypeSupported.bind(d)}};
6
+ let fa=()=>{const a=b=>(...d)=>{const c=q;d=b(...d);return q!=c?ea():d};(b=>{for(const d of b)f[d]=a(f[d])})(["_OrtAppendExecutionProvider","_OrtCreateSession","_OrtRun","_OrtRunWithBinding","_OrtBindInput"]);"undefined"!==typeof da&&(f._OrtRun=da(f._OrtRun),f._OrtRunWithBinding=da(f._OrtRunWithBinding));fa=void 0};f.asyncInit=()=>{fa?.()};var ha="./this.program",ia=(a,b)=>{throw b;},ja=import.meta.url,ka="",la,ma;
7
+ if(h){var fs=require("fs");ja.startsWith("file:")&&(ka=require("path").dirname(require("url").fileURLToPath(ja))+"/");ma=a=>{a=na(a)?new URL(a):a;return fs.readFileSync(a)};la=async a=>{a=na(a)?new URL(a):a;return fs.readFileSync(a,void 0)};1<process.argv.length&&(ha=process.argv[1].replace(/\\/g,"/"));process.argv.slice(2);ia=(a,b)=>{process.exitCode=a;throw b;}}else if(aa||ba){try{ka=(new URL(".",ja)).href}catch{}h||(ba&&(ma=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";
8
+ b.send(null);return new Uint8Array(b.response)}),la=async a=>{if(na(a))return new Promise((d,c)=>{var e=new XMLHttpRequest;e.open("GET",a,!0);e.responseType="arraybuffer";e.onload=()=>{200==e.status||0==e.status&&e.response?d(e.response):c(e.status)};e.onerror=c;e.send(null)});var b=await fetch(a,{credentials:"same-origin"});if(b.ok)return b.arrayBuffer();throw Error(b.status+" : "+b.url);})}var oa=console.log.bind(console),pa=console.error.bind(console);
9
+ if(h){var qa=require("util"),ra=a=>"object"==typeof a?qa.inspect(a):a;oa=(...a)=>fs.writeSync(1,a.map(ra).join(" ")+"\n");pa=(...a)=>fs.writeSync(2,a.map(ra).join(" ")+"\n")}var sa=oa,r=pa,ta,ua,t=!1,va,na=a=>a.startsWith("file://");function u(){x.buffer!=A.buffer&&wa()}var xa,ya;
10
+ if(h&&m){var za=ca.parentPort;za.on("message",a=>global.onmessage?.({data:a}));Object.assign(globalThis,{self:global,postMessage:a=>za.postMessage(a)});process.on("uncaughtException",a=>{postMessage({Uc:"uncaughtException",error:a});process.exit(1)})}var Aa;
11
+ if(m){var Ba=!1;self.onunhandledrejection=b=>{throw b.reason||b;};function a(b){try{var d=b.data,c=d.Uc;if("load"===c){let e=[];self.onmessage=g=>e.push(g);Aa=()=>{postMessage({Uc:"loaded"});for(let g of e)a(g);self.onmessage=a};for(const g of d.Ad)if(!f[g]||f[g].proxy)f[g]=(...k)=>{postMessage({Uc:"callHandler",zd:g,args:k})},"print"==g&&(sa=f[g]),"printErr"==g&&(r=f[g]);x=d.Vd;wa();ua=d.Wd;Ca();Da()}else if("run"===c){Ea(d.Tc);Fa(d.Tc,0,0,1,0,0);Ga();Ha(d.Tc);Ba||(Ia(),Ba=!0);try{Ja(d.Pd,d.dd)}catch(e){if("unwind"!=
12
+ e)throw e;}}else"setimmediate"!==d.target&&("checkMailbox"===c?Ba&&Ka():c&&(r(`worker: received unknown command ${c}`),r(d)))}catch(e){throw La(),e;}}self.onmessage=a}var A,B,Ma,Na,C,D,Oa,E,F,Pa,Qa=!1;function wa(){var a=x.buffer;f.HEAP8=A=new Int8Array(a);Ma=new Int16Array(a);f.HEAPU8=B=new Uint8Array(a);Na=new Uint16Array(a);f.HEAP32=C=new Int32Array(a);f.HEAPU32=D=new Uint32Array(a);Oa=new Float32Array(a);E=new Float64Array(a);F=new BigInt64Array(a);Pa=new BigUint64Array(a)}
13
+ function Ra(){Qa=!0;m?Aa():G.tb()}function H(a){a="Aborted("+a+")";r(a);t=!0;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");ya?.(a);throw a;}var Sa;async function Ta(a){if(!ta)try{var b=await la(a);return new Uint8Array(b)}catch{}if(a==Sa&&ta)a=new Uint8Array(ta);else if(ma)a=ma(a);else throw"both async and sync fetching of the wasm failed";return a}
14
+ async function Ua(a,b){try{var d=await Ta(a);return await WebAssembly.instantiate(d,b)}catch(c){r(`failed to asynchronously prepare wasm: ${c}`),H(c)}}async function Va(a){var b=Sa;if(!ta&&!na(b)&&!h)try{var d=fetch(b,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(d,a)}catch(c){r(`wasm streaming compile failed: ${c}`),r("falling back to ArrayBuffer instantiation")}return Ua(b,a)}
15
+ function Wa(){Xa={ma:Ya,hb:Za,g:$a,J:ab,f:bb,o:cb,h:db,ha:eb,b:fb,T:gb,Ia:hb,n:ib,_:jb,Ya:mb,Ea:nb,Ga:ob,Za:pb,Wa:qb,Pa:rb,Va:sb,ka:tb,Fa:ub,Ca:vb,Xa:wb,Da:xb,cb:yb,ea:zb,xa:Ab,va:Bb,da:Cb,O:Db,H:Eb,wa:Fb,Z:Gb,ya:Hb,Sa:Ib,Aa:Jb,Ja:Kb,ta:Lb,fa:Mb,Ra:Ha,$a:Nb,R:Ob,r:Pb,c:Qb,ib:Rb,y:Sb,M:Tb,D:Ub,l:Vb,s:Wb,jb:Xb,I:Yb,S:Zb,j:$b,u:ac,q:bc,k:cc,Ma:dc,Na:ec,Oa:fc,Ka:gc,La:hc,ua:ic,eb:jc,bb:kc,v:lc,aa:mc,ga:nc,ab:oc,V:pc,_a:qc,Ba:rc,F:sc,U:tc,la:uc,za:vc,gb:wc,fb:xc,Ta:yc,Ua:zc,Ha:Ac,$:Bc,ja:Cc,Qa:Dc,ia:Ec,
16
+ lb:Fc,na:Gc,mb:Hc,oa:Ic,G:Jc,d:Kc,t:Lc,w:Mc,B:Nc,pb:Oc,K:Pc,x:Qc,pa:Rc,X:Sc,ba:Tc,nb:Uc,ob:Vc,ra:Wc,qa:Xc,qb:Yc,N:Zc,Y:$c,e:ad,A:bd,m:cd,kb:dd,p:ed,z:fd,C:gd,E:hd,L:jd,rb:kd,Q:ld,ca:md,W:nd,sb:od,sa:pd,P:qd,i:rd,a:x,db:sd};return{a:Xa}}
17
+ async function Ca(){function a(c,e){var g=G=c.exports;c={};for(let [k,l]of Object.entries(g))"function"==typeof l?(g=td(l),c[k]=g):c[k]=l;G=c;G=ud();vd.push(G.$b);c=G;wd=c.ub;Ia=c.vb;f._OrtInit=c.wb;f._OrtGetLastError=c.xb;f._OrtCreateSessionOptions=c.yb;f._OrtAppendExecutionProvider=c.zb;f._OrtAddFreeDimensionOverride=c.Ab;f._OrtAddSessionConfigEntry=c.Bb;f._OrtReleaseSessionOptions=c.Cb;f._OrtCreateSession=c.Db;f._OrtReleaseSession=c.Eb;f._OrtGetInputOutputCount=c.Fb;f._OrtGetInputOutputMetadata=
18
+ c.Gb;f._OrtFree=c.Hb;f._OrtCreateTensor=c.Ib;f._OrtGetTensorData=c.Jb;f._OrtReleaseTensor=c.Kb;f._OrtCreateRunOptions=c.Lb;f._OrtAddRunConfigEntry=c.Mb;f._OrtReleaseRunOptions=c.Nb;f._OrtCreateBinding=c.Ob;f._OrtBindInput=c.Pb;f._OrtBindOutput=c.Qb;f._OrtClearBoundOutputs=c.Rb;f._OrtReleaseBinding=c.Sb;f._OrtRunWithBinding=c.Tb;f._OrtRun=c.Ub;f._OrtEndProfiling=c.Vb;f._JsepOutput=c.Wb;f._JsepGetNodeName=c.Xb;xd=c.Yb;I=f._free=c.Zb;yd=f._malloc=c._b;Fa=c.bc;La=c.cc;zd=c.dc;Ad=c.ec;Bd=c.fc;Cd=c.gc;
19
+ Dd=c.hc;J=c.ic;Ed=c.jc;Fd=c.kc;K=c.lc;Gd=c.mc;L=c.nc;Hd=c.oc;Id=c.pc;Jd=c.qc;Kd=c.rc;dynCall_vii=c.sc;Ld=c.tc;dynCall_v=c.uc;Md=c.vc;Nd=c.wc;dynCall_iii=c.xc;Od=c.yc;Pd=c.zc;Qd=c.Ac;Rd=c.Bc;dynCall_vi=c.Cc;Sd=c.Dc;Td=c.Ec;Ud=c.Fc;Vd=c.Gc;Wd=c.Hc;Xd=c.Ic;Yd=c.Jc;Zd=c.Kc;$d=c.Lc;ae=c.Mc;be=c.Nc;ce=c.Oc;de=c.Pc;ee=c.Rc;fe=c.Sc;ge=c.bd;he=c.cd;ie=c.hd;je=c.ld;ke=c.md;le=c.nd;me=c.od;ne=c.pd;oe=c.qd;pe=c.rd;qe=c.sd;re=c.xd;se=c.Rd;te=c.Sd;ue=c.Td;ve=c.Ud;ua=e;return G}var b=Wa();if(f.instantiateWasm)return new Promise(c=>
20
+ {f.instantiateWasm(b,(e,g)=>{c(a(e,g))})});if(m){var d=new WebAssembly.Instance(ua,Wa());return a(d,ua)}Sa??=f.locateFile?f.locateFile?f.locateFile("ort-wasm-simd-threaded.jsep.wasm",ka):ka+"ort-wasm-simd-threaded.jsep.wasm":(new URL("ort-wasm-simd-threaded.jsep.wasm",import.meta.url)).href;return function(c){return a(c.instance,c.module)}(await Va(b))}class we{name="ExitStatus";constructor(a){this.message=`Program terminated with exit(${a})`;this.status=a}}
21
+ var xe=a=>{a.terminate();a.onmessage=()=>{}},ye=[],ze=0,Ae=null,Ee=a=>{0==M.length&&(Be(),Ce(M[0]));var b=M.pop();if(!b)return 6;De.push(b);N[a.Tc]=b;b.Tc=a.Tc;var d={Uc:"run",Pd:a.Od,dd:a.dd,Tc:a.Tc};h&&b.unref();b.postMessage(d,a.ud);return 0},O=0,P=(a,b,...d)=>{var c=16*d.length,e=L(),g=Gd(c),k=g>>>3,l;for(l of d)"bigint"==typeof l?((u(),F)[k++>>>0]=1n,(u(),F)[k++>>>0]=l):((u(),F)[k++>>>0]=0n,(u(),E)[k++>>>0]=l);a=zd(a,0,c,g,b);K(e);return a};
22
+ function sd(a){if(m)return P(0,1,a);va=a;if(!(0<O)){for(var b of De)xe(b);for(b of M)xe(b);M=[];De=[];N={};t=!0}ia(a,new we(a))}function Fe(a){if(m)return P(1,0,a);Ac(a)}var Ac=a=>{va=a;if(m)throw Fe(a),"unwind";sd(a)},M=[],De=[],vd=[],N={};function Ge(){for(var a=f.numThreads-1;a--;)Be();ye.push(async()=>{var b=He();ze++;await b;ze--;0==ze&&Ae&&(b=Ae,Ae=null,b())})}var Ie=a=>{var b=a.Tc;delete N[b];M.push(a);De.splice(De.indexOf(a),1);a.Tc=0;Ad(b)};function Ga(){vd.forEach(a=>a())}
23
+ var Ce=a=>new Promise(b=>{a.onmessage=g=>{var k=g.data;g=k.Uc;if(k.ad&&k.ad!=xd()){var l=N[k.ad];l?l.postMessage(k,k.ud):r(`Internal error! Worker sent a message "${g}" to target pthread ${k.ad}, but that thread no longer exists!`)}else if("checkMailbox"===g)Ka();else if("spawnThread"===g)Ee(k);else if("cleanupThread"===g)Je(()=>{Ie(N[k.Qd])});else if("loaded"===g)a.loaded=!0,h&&!a.Tc&&a.unref(),b(a);else if("setimmediate"===k.target)a.postMessage(k);else if("uncaughtException"===g)a.onerror(k.error);
24
+ else if("callHandler"===g)f[k.zd](...k.args);else g&&r(`worker sent an unknown command ${g}`)};a.onerror=g=>{r(`${"worker sent an error!"} ${g.filename}:${g.lineno}: ${g.message}`);throw g;};h&&(a.on("message",g=>a.onmessage({data:g})),a.on("error",g=>a.onerror(g)));var d=[],c=[],e;for(e of c)f.propertyIsEnumerable(e)&&d.push(e);a.postMessage({Uc:"load",Ad:d,Vd:x,Wd:ua})});async function He(){if(!m)return Promise.all(M.map(Ce))}
25
+ function Be(){var a=new Worker(new URL(import.meta.url),{type:"module",workerData:"em-pthread",name:"em-pthread"});M.push(a)}function Ea(a){var b=(u(),D)[a+52>>>2>>>0];a=(u(),D)[a+56>>>2>>>0];Fd(b,b-a);K(b)}var Ja=(a,b)=>{O=0;a=Ld(a,b);0<O?va=a:Bd(a)},x,Ke=[],Le=0;function $a(a){a>>>=0;var b=new Me(a);0==(u(),A)[b.Vc+12>>>0]&&(Ne(b,!0),Le--);Oe(b,!1);Ke.push(b);return Kd(a)}var Q=0,ab=()=>{J(0,0);var a=Ke.pop();Hd(a.ed);Q=0};
26
+ function Ne(a,b){b=b?1:0;(u(),A)[a.Vc+12>>>0]=b}function Oe(a,b){b=b?1:0;(u(),A)[a.Vc+13>>>0]=b}class Me{constructor(a){this.ed=a;this.Vc=a-24}}var Pe=a=>{var b=Q;if(!b)return Ed(0),0;var d=new Me(b);(u(),D)[d.Vc+16>>>2>>>0]=b;var c=(u(),D)[d.Vc+4>>>2>>>0];if(!c)return Ed(0),b;for(var e of a){if(0===e||e===c)break;if(Jd(e,c,d.Vc+16))return Ed(e),b}Ed(c);return b};function bb(){return Pe([])}function cb(a){return Pe([a>>>0])}function db(a,b,d,c){return Pe([a>>>0,b>>>0,d>>>0,c>>>0])}
27
+ var eb=()=>{var a=Ke.pop();a||H("no exception to throw");var b=a.ed;0==(u(),A)[a.Vc+13>>>0]&&(Ke.push(a),Oe(a,!0),Ne(a,!1),Le++);Id(b);Q=b;throw Q;};function fb(a,b,d){a>>>=0;var c=new Me(a);b>>>=0;d>>>=0;(u(),D)[c.Vc+16>>>2>>>0]=0;(u(),D)[c.Vc+4>>>2>>>0]=b;(u(),D)[c.Vc+8>>>2>>>0]=d;Id(a);Q=a;Le++;throw Q;}var gb=()=>Le;function Qe(a,b,d,c){return m?P(2,1,a,b,d,c):hb(a,b,d,c)}
28
+ function hb(a,b,d,c){a>>>=0;b>>>=0;d>>>=0;c>>>=0;if(!globalThis.SharedArrayBuffer)return 6;var e=[];if(m&&0===e.length)return Qe(a,b,d,c);a={Od:d,Tc:a,dd:c,ud:e};return m?(a.Uc="spawnThread",postMessage(a,e),0):Ee(a)}function ib(a){Q||=a>>>0;throw Q;}
29
+ var Re=globalThis.TextDecoder&&new TextDecoder,Se=(a,b,d,c)=>{d=b+d;if(c)return d;for(;a[b]&&!(b>=d);)++b;return b},Te=(a,b=0,d,c)=>{b>>>=0;d=Se(a,b,d,c);if(16<d-b&&a.buffer&&Re)return Re.decode(a.buffer instanceof ArrayBuffer?a.subarray(b,d):a.slice(b,d));for(c="";b<d;){var e=a[b++];if(e&128){var g=a[b++]&63;if(192==(e&224))c+=String.fromCharCode((e&31)<<6|g);else{var k=a[b++]&63;e=224==(e&240)?(e&15)<<12|g<<6|k:(e&7)<<18|g<<12|k<<6|a[b++]&63;65536>e?c+=String.fromCharCode(e):(e-=65536,c+=String.fromCharCode(55296|
30
+ e>>10,56320|e&1023))}}else c+=String.fromCharCode(e)}return c},R=(a,b,d)=>(a>>>=0)?Te((u(),B),a,b,d):"";function jb(a,b,d){return m?P(3,1,a,b,d):0}function mb(a,b){if(m)return P(4,1,a,b)}function nb(a,b){if(m)return P(5,1,a,b)}function ob(a,b,d){if(m)return P(6,1,a,b,d)}function pb(a,b,d){return m?P(7,1,a,b,d):0}function qb(a,b){if(m)return P(8,1,a,b)}function rb(a,b,d){if(m)return P(9,1,a,b,d)}function sb(a,b,d,c){if(m)return P(10,1,a,b,d,c)}function tb(a,b,d,c){if(m)return P(11,1,a,b,d,c)}
31
+ function ub(a,b,d,c){if(m)return P(12,1,a,b,d,c)}function vb(a){if(m)return P(13,1,a)}function wb(a,b){if(m)return P(14,1,a,b)}function xb(a,b,d){if(m)return P(15,1,a,b,d)}var yb=()=>H(""),S=a=>{a>>>=0;for(var b="";;){var d=(u(),B)[a++>>>0];if(!d)return b;b+=String.fromCharCode(d)}},Ue={},Ve={},We={},Xe=class extends Error{constructor(a){super(a);this.name="BindingError"}};
32
+ function Ye(a,b,d={}){var c=b.name;if(!a)throw new Xe(`type "${c}" must have a positive integer typeid pointer`);if(Ve.hasOwnProperty(a)){if(d.Bd)return;throw new Xe(`Cannot register type '${c}' twice`);}Ve[a]=b;delete We[a];Ue.hasOwnProperty(a)&&(b=Ue[a],delete Ue[a],b.forEach(e=>e()))}function T(a,b,d={}){return Ye(a,b,d)}
33
+ var Ze=(a,b,d)=>{switch(b){case 1:return d?c=>(u(),A)[c>>>0]:c=>(u(),B)[c>>>0];case 2:return d?c=>(u(),Ma)[c>>>1>>>0]:c=>(u(),Na)[c>>>1>>>0];case 4:return d?c=>(u(),C)[c>>>2>>>0]:c=>(u(),D)[c>>>2>>>0];case 8:return d?c=>(u(),F)[c>>>3>>>0]:c=>(u(),Pa)[c>>>3>>>0];default:throw new TypeError(`invalid integer width (${b}): ${a}`);}};
34
+ function zb(a,b,d,c,e){a>>>=0;d>>>=0;b=S(b>>>0);c=0n===c;let g=k=>k;if(c){const k=8*d;g=l=>BigInt.asUintN(k,l);e=g(e)}T(a,{name:b,Qc:g,Xc:(k,l)=>{"number"==typeof l&&(l=BigInt(l));return l},Wc:Ze(b,d,!c),Yc:null})}function Ab(a,b,d,c){a>>>=0;b=S(b>>>0);T(a,{name:b,Qc:function(e){return!!e},Xc:function(e,g){return g?d:c},Wc:function(e){return this.Qc((u(),B)[e>>>0])},Yc:null})}var $e=[],U=[0,1,,1,null,1,!0,1,!1,1];function Qb(a){a>>>=0;9<a&&0===--U[a+1]&&(U[a]=void 0,$e.push(a))}
35
+ var V=a=>{if(!a)throw new Xe(`Cannot use deleted val. handle = ${a}`);return U[a]},X=a=>{switch(a){case void 0:return 2;case null:return 4;case !0:return 6;case !1:return 8;default:const b=$e.pop()||U.length;U[b]=a;U[b+1]=1;return b}};function af(a){return this.Qc((u(),D)[a>>>2>>>0])}var bf={name:"emscripten::val",Qc:a=>{var b=V(a);Qb(a);return b},Xc:(a,b)=>X(b),Wc:af,Yc:null};function Bb(a){return T(a>>>0,bf)}
36
+ var cf=(a,b)=>{switch(b){case 4:return function(d){return this.Qc((u(),Oa)[d>>>2>>>0])};case 8:return function(d){return this.Qc((u(),E)[d>>>3>>>0])};default:throw new TypeError(`invalid float width (${b}): ${a}`);}};function Cb(a,b,d){a>>>=0;d>>>=0;b=S(b>>>0);T(a,{name:b,Qc:c=>c,Xc:(c,e)=>e,Wc:cf(b,d),Yc:null})}function Db(a,b,d,c,e){a>>>=0;d>>>=0;b=S(b>>>0);let g=l=>l;if(0===c){var k=32-8*d;g=l=>l<<k>>>k;e=g(e)}T(a,{name:b,Qc:g,Xc:(l,n)=>n,Wc:Ze(b,d,0!==c),Yc:null})}
37
+ function Eb(a,b,d){function c(g){var k=(u(),D)[g>>>2>>>0];g=(u(),D)[g+4>>>2>>>0];return new e((u(),A).buffer,g,k)}a>>>=0;var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][b];d=S(d>>>0);T(a,{name:d,Qc:c,Wc:c},{Bd:!0})}
38
+ var Y=(a,b,d)=>{var c=(u(),B);b>>>=0;if(0<d){var e=b;d=b+d-1;for(var g=0;g<a.length;++g){var k=a.codePointAt(g);if(127>=k){if(b>=d)break;c[b++>>>0]=k}else if(2047>=k){if(b+1>=d)break;c[b++>>>0]=192|k>>6;c[b++>>>0]=128|k&63}else if(65535>=k){if(b+2>=d)break;c[b++>>>0]=224|k>>12;c[b++>>>0]=128|k>>6&63;c[b++>>>0]=128|k&63}else{if(b+3>=d)break;c[b++>>>0]=240|k>>18;c[b++>>>0]=128|k>>12&63;c[b++>>>0]=128|k>>6&63;c[b++>>>0]=128|k&63;g++}}c[b>>>0]=0;a=b-e}else a=0;return a},df=a=>{for(var b=0,d=0;d<a.length;++d){var c=
39
+ a.charCodeAt(d);127>=c?b++:2047>=c?b+=2:55296<=c&&57343>=c?(b+=4,++d):b+=3}return b};
40
+ function Fb(a,b){a>>>=0;b=S(b>>>0);T(a,{name:b,Qc(d){var c=(u(),D)[d>>>2>>>0];c=R(d+4,c,!0);I(d);return c},Xc(d,c){c instanceof ArrayBuffer&&(c=new Uint8Array(c));var e="string"==typeof c;if(!(e||ArrayBuffer.isView(c)&&1==c.BYTES_PER_ELEMENT))throw new Xe("Cannot pass non-string to std::string");var g=e?df(c):c.length;var k=yd(4+g+1),l=k+4;(u(),D)[k>>>2>>>0]=g;e?Y(c,l,g+1):(u(),B).set(c,l>>>0);null!==d&&d.push(I,k);return k},Wc:af,Yc(d){I(d)}})}
41
+ var ef=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,ff=(a,b,d)=>{a>>>=1;b=Se((u(),Na),a,b/2,d);if(16<b-a&&ef)return ef.decode((u(),Na).slice(a,b));for(d="";a<b;++a){var c=(u(),Na)[a>>>0];d+=String.fromCharCode(c)}return d},gf=(a,b,d)=>{d??=2147483647;if(2>d)return 0;d-=2;var c=b;d=d<2*a.length?d/2:a.length;for(var e=0;e<d;++e){var g=a.charCodeAt(e);(u(),Ma)[b>>>1>>>0]=g;b+=2}(u(),Ma)[b>>>1>>>0]=0;return b-c},hf=a=>2*a.length,jf=(a,b,d)=>{var c="";a>>>=2;for(var e=0;!(e>=b/4);e++){var g=
42
+ (u(),D)[a+e>>>0];if(!g&&!d)break;c+=String.fromCodePoint(g)}return c},kf=(a,b,d)=>{b>>>=0;d??=2147483647;if(4>d)return 0;var c=b;d=c+d-4;for(var e=0;e<a.length;++e){var g=a.codePointAt(e);65535<g&&e++;(u(),C)[b>>>2>>>0]=g;b+=4;if(b+4>d)break}(u(),C)[b>>>2>>>0]=0;return b-c},lf=a=>{for(var b=0,d=0;d<a.length;++d)65535<a.codePointAt(d)&&d++,b+=4;return b};
43
+ function Gb(a,b,d){a>>>=0;b>>>=0;d>>>=0;d=S(d);if(2===b){var c=ff;var e=gf;var g=hf}else c=jf,e=kf,g=lf;T(a,{name:d,Qc:k=>{var l=(u(),D)[k>>>2>>>0];l=c(k+4,l*b,!0);I(k);return l},Xc:(k,l)=>{if("string"!=typeof l)throw new Xe(`Cannot pass non-string to C++ string type ${d}`);var n=g(l),p=yd(4+n+b);(u(),D)[p>>>2>>>0]=n/b;e(l,p+4,n+b);null!==k&&k.push(I,p);return p},Wc:af,Yc(k){I(k)}})}function Hb(a,b){a>>>=0;b=S(b>>>0);T(a,{Cd:!0,name:b,Qc:()=>{},Xc:()=>{}})}
44
+ function Ib(a){Fa(a>>>0,!ba,1,!aa,131072,!1);Ga()}var Je=a=>{if(!t)try{if(a(),!(0<O))try{m?xd()&&Bd(va):Ac(va)}catch(b){b instanceof we||"unwind"==b||ia(1,b)}}catch(b){b instanceof we||"unwind"==b||ia(1,b)}},mf=!Atomics.waitAsync||globalThis.navigator?.userAgent&&91>Number((navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)||[])[2]);function Ha(a){a>>>=0;mf||(Atomics.waitAsync((u(),C),a>>>2,a).value.then(Ka),a+=128,Atomics.store((u(),C),a>>>2,1))}var Ka=()=>Je(()=>{var a=xd();a&&(Ha(a),Dd())});
45
+ function Jb(a,b){a>>>=0;a==b>>>0?setTimeout(Ka):m?postMessage({ad:a,Uc:"checkMailbox"}):(a=N[a])&&a.postMessage({Uc:"checkMailbox"})}var nf=[];function Kb(a,b,d,c,e){b>>>=0;e>>>=0;nf.length=0;d=e>>>3;for(c=e+c>>>3;d<c;){var g;(u(),F)[d++>>>0]?g=(u(),F)[d++>>>0]:g=(u(),E)[d++>>>0];nf.push(g)}return(b?of[b]:pf[a])(...nf)}var Lb=()=>{O=0};function Mb(a){a>>>=0;m?postMessage({Uc:"cleanupThread",Qd:a}):Ie(N[a])}function Nb(a){h&&N[a>>>0].ref()}var qf=a=>{try{a()}catch(b){H(b)}};
46
+ function td(a){var b=(...d)=>{rf.push(a);try{return a(...d)}finally{t||(rf.pop(),q&&1===Z&&0===rf.length&&(Z=0,O+=1,qf(te),"undefined"!=typeof Fibers&&Fibers.ce()))}};sf.set(a,b);return b}var Z=0,q=null,tf=0,rf=[],uf=new Map,vf=new Map,sf=new Map,wf=0,xf=null,yf=[];function ea(){return new Promise((a,b)=>{xf={resolve:a,reject:b}})}
47
+ function zf(){var a=yd(65548),b=a+12;(u(),D)[a>>>2>>>0]=b;(u(),D)[a+4>>>2>>>0]=b+65536;b=rf[0];if(!uf.has(b)){var d=wf++;uf.set(b,d);vf.set(d,b)}b=uf.get(b);(u(),C)[a+8>>>2>>>0]=b;return a}function Af(){var a=(u(),C)[q+8>>>2>>>0];a=vf.get(a);a=sf.get(a);--O;return a()}
48
+ function Bf(a){if(!t){if(0===Z){var b=!1,d=!1;a((c=0)=>{if(!t&&(tf=c,b=!0,d)){Z=2;qf(()=>ue(q));"undefined"!=typeof MainLoop&&MainLoop.yd&&MainLoop.resume();c=!1;try{var e=Af()}catch(l){e=l,c=!0}var g=!1;if(!q){var k=xf;k&&(xf=null,(c?k.reject:k.resolve)(e),g=!0)}if(c&&!g)throw e;}});d=!0;b||(Z=1,q=zf(),"undefined"!=typeof MainLoop&&MainLoop.yd&&MainLoop.pause(),qf(()=>se(q)))}else 2===Z?(Z=0,qf(ve),I(q),q=null,yf.forEach(Je)):H(`invalid state: ${Z}`);return tf}}var Cf=a=>Bf(b=>{a().then(b)});
49
+ function Ob(a){a>>>=0;return Cf(async()=>{var b=await V(a);return X(b)})}var Df=[],Ef=a=>{var b=Df.length;Df.push(a);return b},Ff=(a,b)=>{for(var d=Array(a),c=0;c<a;++c){var e=c,g=(u(),D)[b+4*c>>>2>>>0],k=Ve[g];if(void 0===k)throw a=`parameter ${c}`,g=wd(g),b=S(g),I(g),new Xe(`${a} has unknown type ${b}`);d[e]=k}return d},Gf=(a,b,d)=>{var c=[];a=a(c,d);c.length&&((u(),D)[b>>>2>>>0]=X(c));return a},Hf={},If=a=>{var b=Hf[a];return void 0===b?S(a):b};
50
+ function Pb(a,b,d){var [c,...e]=Ff(a,b>>>0);b=c.Xc.bind(c);var g=e.map(n=>n.Wc.bind(n));a--;var k={toValue:V};a=g.map((n,p)=>{var v=`argFromPtr${p}`;k[v]=n;return`${v}(args${p?"+"+8*p:""})`});switch(d){case 0:var l="toValue(handle)";break;case 2:l="new (toValue(handle))";break;case 3:l="";break;case 1:k.getStringOrSymbol=If,l="toValue(handle)[getStringOrSymbol(methodName)]"}l+=`(${a})`;c.Cd||(k.toReturnWire=b,k.emval_returnValue=Gf,l=`return emval_returnValue(toReturnWire, destructorsRef, ${l})`);
51
+ l=`return function (handle, methodName, destructorsRef, args) {\n ${l}\n }`;d=(new Function(Object.keys(k),l))(...Object.values(k));l=`methodCaller<(${e.map(n=>n.name)}) => ${c.name}>`;return Ef(Object.defineProperty(d,"name",{value:l}))}function Rb(a,b){b>>>=0;a=V(a>>>0);b=V(b);return a==b}function Sb(a){a>>>=0;if(!a)return X(globalThis);a=If(a);return X(globalThis[a])}function Tb(a){a=If(a>>>0);return X(f[a])}function Ub(a,b){b>>>=0;a=V(a>>>0);b=V(b);return X(a[b])}
52
+ function Vb(a){a>>>=0;9<a&&(U[a+1]+=1)}function Wb(a,b,d,c,e){return Df[a>>>0](b>>>0,d>>>0,c>>>0,e>>>0)}function Xb(a,b,d,c,e){return Wb(a>>>0,b>>>0,d>>>0,c>>>0,e>>>0)}function Yb(){return X([])}function Zb(a){a=V(a>>>0);for(var b=Array(a.length),d=0;d<a.length;d++)b[d]=a[d];return X(b)}function $b(a){return X(If(a>>>0))}function ac(){return X({})}function bc(a){a>>>=0;for(var b=V(a);b.length;){var d=b.pop();b.pop()(d)}Qb(a)}function cc(a,b,d){b>>>=0;d>>>=0;a=V(a>>>0);b=V(b);d=V(d);a[b]=d}
53
+ function dc(a,b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);b>>>=0;a=new Date(1E3*a);(u(),C)[b>>>2>>>0]=a.getUTCSeconds();(u(),C)[b+4>>>2>>>0]=a.getUTCMinutes();(u(),C)[b+8>>>2>>>0]=a.getUTCHours();(u(),C)[b+12>>>2>>>0]=a.getUTCDate();(u(),C)[b+16>>>2>>>0]=a.getUTCMonth();(u(),C)[b+20>>>2>>>0]=a.getUTCFullYear()-1900;(u(),C)[b+24>>>2>>>0]=a.getUTCDay();a=(a.getTime()-Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0))/864E5|0;(u(),C)[b+28>>>2>>>0]=a}
54
+ var Jf=a=>0===a%4&&(0!==a%100||0===a%400),Kf=[0,31,60,91,121,152,182,213,244,274,305,335],Lf=[0,31,59,90,120,151,181,212,243,273,304,334];
55
+ function ec(a,b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);b>>>=0;a=new Date(1E3*a);(u(),C)[b>>>2>>>0]=a.getSeconds();(u(),C)[b+4>>>2>>>0]=a.getMinutes();(u(),C)[b+8>>>2>>>0]=a.getHours();(u(),C)[b+12>>>2>>>0]=a.getDate();(u(),C)[b+16>>>2>>>0]=a.getMonth();(u(),C)[b+20>>>2>>>0]=a.getFullYear()-1900;(u(),C)[b+24>>>2>>>0]=a.getDay();var d=(Jf(a.getFullYear())?Kf:Lf)[a.getMonth()]+a.getDate()-1|0;(u(),C)[b+28>>>2>>>0]=d;(u(),C)[b+36>>>2>>>0]=-(60*a.getTimezoneOffset());d=(new Date(a.getFullYear(),
56
+ 6,1)).getTimezoneOffset();var c=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();a=(d!=c&&a.getTimezoneOffset()==Math.min(c,d))|0;(u(),C)[b+32>>>2>>>0]=a}
57
+ function fc(a){a>>>=0;var b=new Date((u(),C)[a+20>>>2>>>0]+1900,(u(),C)[a+16>>>2>>>0],(u(),C)[a+12>>>2>>>0],(u(),C)[a+8>>>2>>>0],(u(),C)[a+4>>>2>>>0],(u(),C)[a>>>2>>>0],0),d=(u(),C)[a+32>>>2>>>0],c=b.getTimezoneOffset(),e=(new Date(b.getFullYear(),6,1)).getTimezoneOffset(),g=(new Date(b.getFullYear(),0,1)).getTimezoneOffset(),k=Math.min(g,e);0>d?(u(),C)[a+32>>>2>>>0]=Number(e!=g&&k==c):0<d!=(k==c)&&(e=Math.max(g,e),b.setTime(b.getTime()+6E4*((0<d?k:e)-c)));(u(),C)[a+24>>>2>>>0]=b.getDay();d=(Jf(b.getFullYear())?
58
+ Kf:Lf)[b.getMonth()]+b.getDate()-1|0;(u(),C)[a+28>>>2>>>0]=d;(u(),C)[a>>>2>>>0]=b.getSeconds();(u(),C)[a+4>>>2>>>0]=b.getMinutes();(u(),C)[a+8>>>2>>>0]=b.getHours();(u(),C)[a+12>>>2>>>0]=b.getDate();(u(),C)[a+16>>>2>>>0]=b.getMonth();(u(),C)[a+20>>>2>>>0]=b.getYear();a=b.getTime();return BigInt(isNaN(a)?-1:a/1E3)}function gc(a,b,d,c,e,g,k){return m?P(16,1,a,b,d,c,e,g,k):-52}function hc(a,b,d,c,e,g){if(m)return P(17,1,a,b,d,c,e,g)}var Mf={},sc=()=>performance.timeOrigin+performance.now();
59
+ function ic(a,b){if(m)return P(18,1,a,b);Mf[a]&&(clearTimeout(Mf[a].id),delete Mf[a]);if(!b)return 0;var d=setTimeout(()=>{delete Mf[a];Je(()=>Cd(a,performance.timeOrigin+performance.now()))},b);Mf[a]={id:d,be:b};return 0}
60
+ function jc(a,b,d,c){a>>>=0;b>>>=0;d>>>=0;c>>>=0;var e=(new Date).getFullYear(),g=(new Date(e,0,1)).getTimezoneOffset();e=(new Date(e,6,1)).getTimezoneOffset();var k=Math.max(g,e);(u(),D)[a>>>2>>>0]=60*k;(u(),C)[b>>>2>>>0]=Number(g!=e);b=l=>{var n=Math.abs(l);return`UTC${0<=l?"-":"+"}${String(Math.floor(n/60)).padStart(2,"0")}${String(n%60).padStart(2,"0")}`};a=b(g);b=b(e);e<g?(Y(a,d,17),Y(b,c,17)):(Y(a,c,17),Y(b,d,17))}var oc=()=>Date.now(),Nf=1;
61
+ function kc(a,b,d){d>>>=0;if(!(0<=a&&3>=a))return 28;if(0===a)a=Date.now();else if(Nf)a=performance.timeOrigin+performance.now();else return 52;a=Math.round(1E6*a);(u(),F)[d>>>3>>>0]=BigInt(a);return 0}var Of=[],Pf=(a,b)=>{Of.length=0;for(var d;d=(u(),B)[a++>>>0];){var c=105!=d;c&=112!=d;b+=c&&b%8?4:0;Of.push(112==d?(u(),D)[b>>>2>>>0]:106==d?(u(),F)[b>>>3>>>0]:105==d?(u(),C)[b>>>2>>>0]:(u(),E)[b>>>3>>>0]);b+=c?8:4}return Of};function lc(a,b,d){a>>>=0;b=Pf(b>>>0,d>>>0);return of[a](...b)}
62
+ function mc(a,b,d){a>>>=0;b=Pf(b>>>0,d>>>0);return of[a](...b)}var nc=()=>{};function pc(a,b){return r(R(a>>>0,b>>>0))}var qc=()=>{O+=1;throw"unwind";};function rc(){return 4294901760}var tc=()=>h?require("os").cpus().length:navigator.hardwareConcurrency,Qf={},Rf=a=>{var b;return(b=/\bwasm-function\[\d+\]:(0x[0-9a-f]+)/.exec(a))?+b[1]:(b=/:(\d+):\d+(?:\)|$)/.exec(a))?2147483648|+b[1]:0},Sf=a=>{for(var b of a)(a=Rf(b))&&(Qf[a]=b)};
63
+ function wc(){var a=Error().stack.toString().split("\n");"Error"==a[0]&&a.shift();Sf(a);Qf.kd=Rf(a[3]);Qf.Md=a;return Qf.kd}function uc(a){a=Qf[a>>>0];if(!a)return 0;var b;if(b=/^\s+at .*\.wasm\.(.*) \(.*\)$/.exec(a))a=b[1];else if(b=/^\s+at (.*) \(.*\)$/.exec(a))a=b[1];else if(b=/^(.+?)@/.exec(a))a=b[1];else return 0;I(uc.td??0);b=df(a)+1;var d=yd(b);d&&Y(a,d,b);uc.td=d;return uc.td}
64
+ function vc(a){a>>>=0;var b=(u(),B).length;if(a<=b||4294901760<a)return!1;for(var d=1;4>=d;d*=2){var c=b*(1+.2/d);c=Math.min(c,a+100663296);a:{c=(Math.min(4294901760,65536*Math.ceil(Math.max(a,c)/65536))-x.buffer.byteLength+65535)/65536|0;try{x.grow(c);wa();var e=1;break a}catch(g){}e=void 0}if(e)return!0}return!1}
65
+ function xc(a,b,d){a>>>=0;b>>>=0;if(Qf.kd==a)var c=Qf.Md;else c=Error().stack.toString().split("\n"),"Error"==c[0]&&c.shift(),Sf(c);for(var e=3;c[e]&&Rf(c[e])!=a;)++e;for(a=0;a<d&&c[a+e];++a)(u(),C)[b+4*a>>>2>>>0]=Rf(c[a+e]);return a}
66
+ var Tf={},Vf=()=>{if(!Uf){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",_:ha||"./this.program"},b;for(b in Tf)void 0===Tf[b]?delete a[b]:a[b]=Tf[b];var d=[];for(b in a)d.push(`${b}=${a[b]}`);Uf=d}return Uf},Uf;function yc(a,b){if(m)return P(19,1,a,b);a>>>=0;b>>>=0;var d=0,c=0,e;for(e of Vf()){var g=b+d;(u(),D)[a+c>>>2>>>0]=g;d+=Y(e,g,Infinity)+1;c+=4}return 0}
67
+ function zc(a,b){if(m)return P(20,1,a,b);a>>>=0;b>>>=0;var d=Vf();(u(),D)[a>>>2>>>0]=d.length;a=0;for(var c of d)a+=df(c)+1;(u(),D)[b>>>2>>>0]=a;return 0}function Bc(a){return m?P(21,1,a):52}function Cc(a,b,d,c){return m?P(22,1,a,b,d,c):52}function Dc(a,b,d,c){return m?P(23,1,a,b,d,c):70}var Wf=[null,[],[]];
68
+ function Ec(a,b,d,c){if(m)return P(24,1,a,b,d,c);b>>>=0;d>>>=0;c>>>=0;for(var e=0,g=0;g<d;g++){var k=(u(),D)[b>>>2>>>0],l=(u(),D)[b+4>>>2>>>0];b+=8;for(var n=0;n<l;n++){var p=a,v=(u(),B)[k+n>>>0],w=Wf[p];0===v||10===v?((1===p?sa:r)(Te(w)),w.length=0):w.push(v)}e+=l}(u(),D)[c>>>2>>>0]=e;return 0}function rd(a){return a>>>0}m||Ge();m||(x=new WebAssembly.Memory({initial:256,maximum:65536,shared:!0}),wa());f.wasmBinary&&(ta=f.wasmBinary);f.stackSave=()=>L();f.stackRestore=a=>K(a);f.stackAlloc=a=>Gd(a);
69
+ f.setValue=function(a,b,d="i8"){d.endsWith("*")&&(d="*");switch(d){case "i1":(u(),A)[a>>>0]=b;break;case "i8":(u(),A)[a>>>0]=b;break;case "i16":(u(),Ma)[a>>>1>>>0]=b;break;case "i32":(u(),C)[a>>>2>>>0]=b;break;case "i64":(u(),F)[a>>>3>>>0]=BigInt(b);break;case "float":(u(),Oa)[a>>>2>>>0]=b;break;case "double":(u(),E)[a>>>3>>>0]=b;break;case "*":(u(),D)[a>>>2>>>0]=b;break;default:H(`invalid type for setValue: ${d}`)}};
70
+ f.getValue=function(a,b="i8"){b.endsWith("*")&&(b="*");switch(b){case "i1":return(u(),A)[a>>>0];case "i8":return(u(),A)[a>>>0];case "i16":return(u(),Ma)[a>>>1>>>0];case "i32":return(u(),C)[a>>>2>>>0];case "i64":return(u(),F)[a>>>3>>>0];case "float":return(u(),Oa)[a>>>2>>>0];case "double":return(u(),E)[a>>>3>>>0];case "*":return(u(),D)[a>>>2>>>0];default:H(`invalid type for getValue: ${b}`)}};f.UTF8ToString=R;f.stringToUTF8=Y;f.lengthBytesUTF8=df;
71
+ var pf=[sd,Fe,Qe,jb,mb,nb,ob,pb,qb,rb,sb,tb,ub,vb,wb,xb,gc,hc,ic,yc,zc,Bc,Cc,Dc,Ec],of={946460:(a,b,d,c,e)=>{if("undefined"==typeof f||!f.Zc)return 1;a=R(Number(a>>>0));a.startsWith("./")&&(a=a.substring(2));a=f.Zc.get(a);if(!a)return 2;b=Number(b>>>0);d=Number(d>>>0);c=Number(c>>>0);if(b+d>a.byteLength)return 3;try{const g=a.subarray(b,b+d);switch(e){case 0:(u(),B).set(g,c>>>0);break;case 1:f.Xd?f.Xd(c,g):f.Ld(c,g);break;default:return 4}return 0}catch{return 4}},947284:(a,b,d)=>{f.wd(a,(u(),B).subarray(b>>>
72
+ 0,b+d>>>0))},947348:()=>f.Zd(),947390:a=>{f.vd(a)},947427:()=>{f.Ed()},947458:()=>{f.Fd()},947487:()=>{f.Jd()},947512:a=>f.Dd(a),947545:a=>f.Hd(a),947577:(a,b,d)=>{f.jd(Number(a),Number(b),Number(d),!0)},947640:(a,b,d)=>{f.jd(Number(a),Number(b),Number(d))},947697:()=>"undefined"!==typeof wasmOffsetConverter,947754:a=>{f.ac("Abs",a,void 0)},947805:a=>{f.ac("Neg",a,void 0)},947856:a=>{f.ac("Floor",a,void 0)},947909:a=>{f.ac("Ceil",a,void 0)},947961:a=>{f.ac("Reciprocal",a,void 0)},948019:a=>{f.ac("Sqrt",
73
+ a,void 0)},948071:a=>{f.ac("Exp",a,void 0)},948122:a=>{f.ac("Erf",a,void 0)},948173:a=>{f.ac("Sigmoid",a,void 0)},948228:(a,b,d)=>{f.ac("HardSigmoid",a,{alpha:b,beta:d})},948307:a=>{f.ac("Log",a,void 0)},948358:a=>{f.ac("Sin",a,void 0)},948409:a=>{f.ac("Cos",a,void 0)},948460:a=>{f.ac("Tan",a,void 0)},948511:a=>{f.ac("Asin",a,void 0)},948563:a=>{f.ac("Acos",a,void 0)},948615:a=>{f.ac("Atan",a,void 0)},948667:a=>{f.ac("Sinh",a,void 0)},948719:a=>{f.ac("Cosh",a,void 0)},948771:a=>{f.ac("Asinh",a,void 0)},
74
+ 948824:a=>{f.ac("Acosh",a,void 0)},948877:a=>{f.ac("Atanh",a,void 0)},948930:a=>{f.ac("Tanh",a,void 0)},948982:a=>{f.ac("Not",a,void 0)},949033:(a,b,d)=>{f.ac("Clip",a,{min:b,max:d})},949102:a=>{f.ac("Clip",a,void 0)},949154:(a,b)=>{f.ac("Elu",a,{alpha:b})},949212:a=>{f.ac("Gelu",a,void 0)},949264:a=>{f.ac("Relu",a,void 0)},949316:(a,b)=>{f.ac("LeakyRelu",a,{alpha:b})},949380:(a,b)=>{f.ac("ThresholdedRelu",a,{alpha:b})},949450:(a,b)=>{f.ac("Cast",a,{to:b})},949508:a=>{f.ac("Add",a,void 0)},949559:a=>
75
+ {f.ac("Sub",a,void 0)},949610:a=>{f.ac("Mul",a,void 0)},949661:a=>{f.ac("Div",a,void 0)},949712:a=>{f.ac("Pow",a,void 0)},949763:a=>{f.ac("Equal",a,void 0)},949816:a=>{f.ac("Greater",a,void 0)},949871:a=>{f.ac("GreaterOrEqual",a,void 0)},949933:a=>{f.ac("Less",a,void 0)},949985:a=>{f.ac("LessOrEqual",a,void 0)},950044:(a,b,d,c,e)=>{f.ac("ReduceMean",a,{keepDims:!!b,noopWithEmptyAxes:!!d,axes:c?Array.from((u(),C).subarray(Number(c)>>>0,Number(e)>>>0)):[]})},950219:(a,b,d,c,e)=>{f.ac("ReduceMax",a,
76
+ {keepDims:!!b,noopWithEmptyAxes:!!d,axes:c?Array.from((u(),C).subarray(Number(c)>>>0,Number(e)>>>0)):[]})},950393:(a,b,d,c,e)=>{f.ac("ReduceMin",a,{keepDims:!!b,noopWithEmptyAxes:!!d,axes:c?Array.from((u(),C).subarray(Number(c)>>>0,Number(e)>>>0)):[]})},950567:(a,b,d,c,e)=>{f.ac("ReduceProd",a,{keepDims:!!b,noopWithEmptyAxes:!!d,axes:c?Array.from((u(),C).subarray(Number(c)>>>0,Number(e)>>>0)):[]})},950742:(a,b,d,c,e)=>{f.ac("ReduceSum",a,{keepDims:!!b,noopWithEmptyAxes:!!d,axes:c?Array.from((u(),
77
+ C).subarray(Number(c)>>>0,Number(e)>>>0)):[]})},950916:(a,b,d,c,e)=>{f.ac("ReduceL1",a,{keepDims:!!b,noopWithEmptyAxes:!!d,axes:c?Array.from((u(),C).subarray(Number(c)>>>0,Number(e)>>>0)):[]})},951089:(a,b,d,c,e)=>{f.ac("ReduceL2",a,{keepDims:!!b,noopWithEmptyAxes:!!d,axes:c?Array.from((u(),C).subarray(Number(c)>>>0,Number(e)>>>0)):[]})},951262:(a,b,d,c,e)=>{f.ac("ReduceLogSum",a,{keepDims:!!b,noopWithEmptyAxes:!!d,axes:c?Array.from((u(),C).subarray(Number(c)>>>0,Number(e)>>>0)):[]})},951439:(a,b,
78
+ d,c,e)=>{f.ac("ReduceSumSquare",a,{keepDims:!!b,noopWithEmptyAxes:!!d,axes:c?Array.from((u(),C).subarray(Number(c)>>>0,Number(e)>>>0)):[]})},951619:(a,b,d,c,e)=>{f.ac("ReduceLogSumExp",a,{keepDims:!!b,noopWithEmptyAxes:!!d,axes:c?Array.from((u(),C).subarray(Number(c)>>>0,Number(e)>>>0)):[]})},951799:a=>{f.ac("Where",a,void 0)},951852:(a,b,d)=>{f.ac("Transpose",a,{perm:b?Array.from((u(),C).subarray(Number(b)>>>0,Number(d)>>>0)):[]})},951976:(a,b,d,c)=>{f.ac("DepthToSpace",a,{blocksize:b,mode:R(d),
79
+ format:c?"NHWC":"NCHW"})},952109:(a,b,d,c)=>{f.ac("DepthToSpace",a,{blocksize:b,mode:R(d),format:c?"NHWC":"NCHW"})},952242:(a,b,d,c,e,g,k,l,n,p,v,w,y,z,W)=>{f.ac("ConvTranspose",a,{format:n?"NHWC":"NCHW",autoPad:b,dilations:[d],group:c,kernelShape:[e],pads:[g,k],strides:[l],wIsConst:()=>!!(u(),A)[p>>>0],outputPadding:v?Array.from((u(),C).subarray(Number(v)>>>0,Number(w)>>>0)):[],outputShape:y?Array.from((u(),C).subarray(Number(y)>>>0,Number(z)>>>0)):[],activation:R(W)})},952675:(a,b,d,c,e,g,k,l,n,
80
+ p,v,w,y,z)=>{f.ac("ConvTranspose",a,{format:l?"NHWC":"NCHW",autoPad:b,dilations:Array.from((u(),C).subarray(Number(d)>>>0,(Number(d)>>>0)+2>>>0)),group:c,kernelShape:Array.from((u(),C).subarray(Number(e)>>>0,(Number(e)>>>0)+2>>>0)),pads:Array.from((u(),C).subarray(Number(g)>>>0,(Number(g)>>>0)+4>>>0)),strides:Array.from((u(),C).subarray(Number(k)>>>0,(Number(k)>>>0)+2>>>0)),wIsConst:()=>!!(u(),A)[n>>>0],outputPadding:p?Array.from((u(),C).subarray(Number(p)>>>0,Number(v)>>>0)):[],outputShape:w?Array.from((u(),
81
+ C).subarray(Number(w)>>>0,Number(y)>>>0)):[],activation:R(z)})},953336:(a,b,d,c,e,g,k,l,n,p,v,w,y,z,W)=>{f.ac("ConvTranspose",a,{format:n?"NHWC":"NCHW",autoPad:b,dilations:[d],group:c,kernelShape:[e],pads:[g,k],strides:[l],wIsConst:()=>!!(u(),A)[p>>>0],outputPadding:v?Array.from((u(),C).subarray(Number(v)>>>0,Number(w)>>>0)):[],outputShape:y?Array.from((u(),C).subarray(Number(y)>>>0,Number(z)>>>0)):[],activation:R(W)})},953769:(a,b,d,c,e,g,k,l,n,p,v,w,y,z)=>{f.ac("ConvTranspose",a,{format:l?"NHWC":
82
+ "NCHW",autoPad:b,dilations:Array.from((u(),C).subarray(Number(d)>>>0,(Number(d)>>>0)+2>>>0)),group:c,kernelShape:Array.from((u(),C).subarray(Number(e)>>>0,(Number(e)>>>0)+2>>>0)),pads:Array.from((u(),C).subarray(Number(g)>>>0,(Number(g)>>>0)+4>>>0)),strides:Array.from((u(),C).subarray(Number(k)>>>0,(Number(k)>>>0)+2>>>0)),wIsConst:()=>!!(u(),A)[n>>>0],outputPadding:p?Array.from((u(),C).subarray(Number(p)>>>0,Number(v)>>>0)):[],outputShape:w?Array.from((u(),C).subarray(Number(w)>>>0,Number(y)>>>0)):
83
+ [],activation:R(z)})},954430:(a,b)=>{f.ac("GlobalAveragePool",a,{format:b?"NHWC":"NCHW"})},954521:(a,b,d,c,e,g,k,l,n,p,v,w,y,z)=>{f.ac("AveragePool",a,{format:z?"NHWC":"NCHW",auto_pad:b,ceil_mode:d,count_include_pad:c,storage_order:e,dilations:g?Array.from((u(),C).subarray(Number(g)>>>0,Number(k)>>>0)):[],kernel_shape:l?Array.from((u(),C).subarray(Number(l)>>>0,Number(n)>>>0)):[],pads:p?Array.from((u(),C).subarray(Number(p)>>>0,Number(v)>>>0)):[],strides:w?Array.from((u(),C).subarray(Number(w)>>>
84
+ 0,Number(y)>>>0)):[]})},955E3:(a,b)=>{f.ac("GlobalAveragePool",a,{format:b?"NHWC":"NCHW"})},955091:(a,b,d,c,e,g,k,l,n,p,v,w,y,z)=>{f.ac("AveragePool",a,{format:z?"NHWC":"NCHW",auto_pad:b,ceil_mode:d,count_include_pad:c,storage_order:e,dilations:g?Array.from((u(),C).subarray(Number(g)>>>0,Number(k)>>>0)):[],kernel_shape:l?Array.from((u(),C).subarray(Number(l)>>>0,Number(n)>>>0)):[],pads:p?Array.from((u(),C).subarray(Number(p)>>>0,Number(v)>>>0)):[],strides:w?Array.from((u(),C).subarray(Number(w)>>>
85
+ 0,Number(y)>>>0)):[]})},955570:(a,b)=>{f.ac("GlobalMaxPool",a,{format:b?"NHWC":"NCHW"})},955657:(a,b,d,c,e,g,k,l,n,p,v,w,y,z)=>{f.ac("MaxPool",a,{format:z?"NHWC":"NCHW",auto_pad:b,ceil_mode:d,count_include_pad:c,storage_order:e,dilations:g?Array.from((u(),C).subarray(Number(g)>>>0,Number(k)>>>0)):[],kernel_shape:l?Array.from((u(),C).subarray(Number(l)>>>0,Number(n)>>>0)):[],pads:p?Array.from((u(),C).subarray(Number(p)>>>0,Number(v)>>>0)):[],strides:w?Array.from((u(),C).subarray(Number(w)>>>0,Number(y)>>>
86
+ 0)):[]})},956132:(a,b)=>{f.ac("GlobalMaxPool",a,{format:b?"NHWC":"NCHW"})},956219:(a,b,d,c,e,g,k,l,n,p,v,w,y,z)=>{f.ac("MaxPool",a,{format:z?"NHWC":"NCHW",auto_pad:b,ceil_mode:d,count_include_pad:c,storage_order:e,dilations:g?Array.from((u(),C).subarray(Number(g)>>>0,Number(k)>>>0)):[],kernel_shape:l?Array.from((u(),C).subarray(Number(l)>>>0,Number(n)>>>0)):[],pads:p?Array.from((u(),C).subarray(Number(p)>>>0,Number(v)>>>0)):[],strides:w?Array.from((u(),C).subarray(Number(w)>>>0,Number(y)>>>0)):[]})},
87
+ 956694:(a,b,d,c,e)=>{f.ac("Gemm",a,{alpha:b,beta:d,transA:c,transB:e})},956798:a=>{f.ac("MatMul",a,void 0)},956852:(a,b,d,c)=>{f.ac("ArgMax",a,{keepDims:!!b,selectLastIndex:!!d,axis:c})},956960:(a,b,d,c)=>{f.ac("ArgMin",a,{keepDims:!!b,selectLastIndex:!!d,axis:c})},957068:(a,b)=>{f.ac("Softmax",a,{axis:b})},957131:(a,b)=>{f.ac("Concat",a,{axis:b})},957191:(a,b,d,c,e)=>{f.ac("Split",a,{axis:b,numOutputs:d,splitSizes:c?Array.from((u(),C).subarray(Number(c)>>>0,Number(e)>>>0)):[]})},957347:a=>{f.ac("Expand",
88
+ a,void 0)},957401:(a,b)=>{f.ac("Gather",a,{axis:Number(b)})},957472:(a,b)=>{f.ac("GatherElements",a,{axis:Number(b)})},957551:(a,b)=>{f.ac("GatherND",a,{batch_dims:Number(b)})},957630:(a,b,d,c,e,g,k,l,n,p,v)=>{f.ac("Resize",a,{antialias:b,axes:d?Array.from((u(),C).subarray(Number(d)>>>0,Number(c)>>>0)):[],coordinateTransformMode:R(e),cubicCoeffA:g,excludeOutside:k,extrapolationValue:l,keepAspectRatioPolicy:R(n),mode:R(p),nearestMode:R(v)})},957992:(a,b,d,c,e,g,k)=>{f.ac("Slice",a,{starts:b?Array.from((u(),
89
+ C).subarray(Number(b)>>>0,Number(d)>>>0)):[],ends:c?Array.from((u(),C).subarray(Number(c)>>>0,Number(e)>>>0)):[],axes:g?Array.from((u(),C).subarray(Number(g)>>>0,Number(k)>>>0)):[]})},958256:a=>{f.ac("Tile",a,void 0)},958308:(a,b,d)=>{f.ac("InstanceNormalization",a,{epsilon:b,format:d?"NHWC":"NCHW"})},958422:(a,b,d)=>{f.ac("InstanceNormalization",a,{epsilon:b,format:d?"NHWC":"NCHW"})},958536:a=>{f.ac("Range",a,void 0)},958589:(a,b)=>{f.ac("Einsum",a,{equation:R(b)})},958670:(a,b,d,c,e)=>{f.ac("Pad",
90
+ a,{mode:b,value:d,pads:c?Array.from((u(),C).subarray(Number(c)>>>0,Number(e)>>>0)):[]})},958813:(a,b,d,c,e,g)=>{f.ac("BatchNormalization",a,{epsilon:b,momentum:d,spatial:!!e,trainingMode:!!c,format:g?"NHWC":"NCHW"})},958982:(a,b,d,c,e,g)=>{f.ac("BatchNormalization",a,{epsilon:b,momentum:d,spatial:!!e,trainingMode:!!c,format:g?"NHWC":"NCHW"})},959151:(a,b,d)=>{f.ac("CumSum",a,{exclusive:Number(b),reverse:Number(d)})},959248:(a,b,d)=>{f.ac("DequantizeLinear",a,{axis:b,blockSize:d})},959338:(a,b,d,c,
91
+ e)=>{f.ac("GridSample",a,{align_corners:b,mode:R(d),padding_mode:R(c),format:e?"NHWC":"NCHW"})},959508:(a,b,d,c,e)=>{f.ac("GridSample",a,{align_corners:b,mode:R(d),padding_mode:R(c),format:e?"NHWC":"NCHW"})},959678:(a,b)=>{f.ac("ScatterND",a,{reduction:R(b)})},959763:(a,b,d,c,e,g,k,l,n)=>{f.ac("Attention",a,{numHeads:b,isUnidirectional:d,maskFilterValue:c,scale:e,doRotary:g,qkvHiddenSizes:k?Array.from((u(),C).subarray(Number(l)>>>0,Number(l)+k>>>0)):[],pastPresentShareBuffer:!!n})},960035:a=>{f.ac("BiasAdd",
92
+ a,void 0)},960090:a=>{f.ac("BiasSplitGelu",a,void 0)},960151:a=>{f.ac("FastGelu",a,void 0)},960207:(a,b,d,c,e,g,k,l,n,p,v,w,y,z,W,kb)=>{f.ac("Conv",a,{format:w?"NHWC":"NCHW",auto_pad:b,dilations:d?Array.from((u(),C).subarray(Number(d)>>>0,Number(c)>>>0)):[],group:e,kernel_shape:g?Array.from((u(),C).subarray(Number(g)>>>0,Number(k)>>>0)):[],pads:l?Array.from((u(),C).subarray(Number(l)>>>0,Number(n)>>>0)):[],strides:p?Array.from((u(),C).subarray(Number(p)>>>0,Number(v)>>>0)):[],w_is_const:()=>!!(u(),
93
+ A)[Number(y)>>>0],activation:R(z),activation_params:W?Array.from((u(),Oa).subarray(Number(W)>>>0,Number(kb)>>>0)):[]})},960791:a=>{f.ac("Gelu",a,void 0)},960843:(a,b,d,c,e,g,k,l,n)=>{f.ac("GroupQueryAttention",a,{numHeads:b,kvNumHeads:d,scale:c,softcap:e,doRotary:g,rotaryInterleaved:k,smoothSoftmax:l,localWindowSize:n})},961060:(a,b,d,c)=>{f.ac("LayerNormalization",a,{axis:b,epsilon:d,simplified:!!c})},961171:(a,b,d,c)=>{f.ac("LayerNormalization",a,{axis:b,epsilon:d,simplified:!!c})},961282:(a,b,
94
+ d,c,e,g)=>{f.ac("MatMulNBits",a,{k:b,n:d,accuracyLevel:c,bits:e,blockSize:g})},961409:(a,b,d,c,e,g)=>{f.ac("MultiHeadAttention",a,{numHeads:b,isUnidirectional:d,maskFilterValue:c,scale:e,doRotary:g})},961568:(a,b)=>{f.ac("QuickGelu",a,{alpha:b})},961632:(a,b,d,c,e)=>{f.ac("RotaryEmbedding",a,{interleaved:!!b,numHeads:d,rotaryEmbeddingDim:c,scale:e})},961771:(a,b,d)=>{f.ac("SkipLayerNormalization",a,{epsilon:b,simplified:!!d})},961873:(a,b,d)=>{f.ac("SkipLayerNormalization",a,{epsilon:b,simplified:!!d})},
95
+ 961975:(a,b,d,c)=>{f.ac("GatherBlockQuantized",a,{gatherAxis:b,quantizeAxis:d,blockSize:c})},962096:a=>{f.Id(a)},962130:(a,b)=>f.Kd(Number(a),Number(b),f.$c.Nd,f.$c.errors)};function Za(a,b,d){return Cf(async()=>{await f.Gd(Number(a),Number(b),Number(d))})}function Ya(){return"undefined"!==typeof wasmOffsetConverter}
96
+ var wd,Ia,xd,I,yd,Fa,La,zd,Ad,Bd,Cd,Dd,J,Ed,Fd,K,Gd,L,Hd,Id,Jd,Kd,dynCall_vii,Ld,dynCall_v,Md,Nd,dynCall_iii,Od,Pd,Qd,Rd,dynCall_vi,Sd,Td,Ud,Vd,Wd,Xd,Yd,Zd,$d,ae,be,ce,de,ee,fe,ge,he,ie,je,ke,le,me,ne,oe,pe,qe,re,se,te,ue,ve,Xa;function Mc(a,b,d,c){var e=L();try{return Rd(a,b,d,c)}catch(g){K(e);if(g!==g+0)throw g;J(1,0)}}function Lc(a,b,d){var c=L();try{return dynCall_iii(a,b,d)}catch(e){K(c);if(e!==e+0)throw e;J(1,0)}}
97
+ function ad(a){var b=L();try{dynCall_v(a)}catch(d){K(b);if(d!==d+0)throw d;J(1,0)}}function Kc(a,b){var d=L();try{return Ld(a,b)}catch(c){K(d);if(c!==c+0)throw c;J(1,0)}}function cd(a,b,d){var c=L();try{dynCall_vii(a,b,d)}catch(e){K(c);if(e!==e+0)throw e;J(1,0)}}function bd(a,b){var d=L();try{dynCall_vi(a,b)}catch(c){K(d);if(c!==c+0)throw c;J(1,0)}}function Qc(a,b,d,c,e,g,k){var l=L();try{return Pd(a,b,d,c,e,g,k)}catch(n){K(l);if(n!==n+0)throw n;J(1,0)}}
98
+ function gd(a,b,d,c,e,g){var k=L();try{Md(a,b,d,c,e,g)}catch(l){K(k);if(l!==l+0)throw l;J(1,0)}}function ed(a,b,d,c){var e=L();try{Qd(a,b,d,c)}catch(g){K(e);if(g!==g+0)throw g;J(1,0)}}function fd(a,b,d,c,e){var g=L();try{Nd(a,b,d,c,e)}catch(k){K(g);if(k!==k+0)throw k;J(1,0)}}function hd(a,b,d,c,e,g,k){var l=L();try{Td(a,b,d,c,e,g,k)}catch(n){K(l);if(n!==n+0)throw n;J(1,0)}}function pd(a,b,d,c,e,g,k){var l=L();try{Ud(a,b,d,c,e,g,k)}catch(n){K(l);if(n!==n+0)throw n;J(1,0)}}
99
+ function od(a,b,d,c,e,g,k,l){var n=L();try{Yd(a,b,d,c,e,g,k,l)}catch(p){K(n);if(p!==p+0)throw p;J(1,0)}}function Nc(a,b,d,c,e){var g=L();try{return Sd(a,b,d,c,e)}catch(k){K(g);if(k!==k+0)throw k;J(1,0)}}function jd(a,b,d,c,e,g,k,l){var n=L();try{Zd(a,b,d,c,e,g,k,l)}catch(p){K(n);if(p!==p+0)throw p;J(1,0)}}function md(a,b,d,c,e,g,k,l,n,p,v,w){var y=L();try{Vd(a,b,d,c,e,g,k,l,n,p,v,w)}catch(z){K(y);if(z!==z+0)throw z;J(1,0)}}
100
+ function Pc(a,b,d,c,e,g){var k=L();try{return Wd(a,b,d,c,e,g)}catch(l){K(k);if(l!==l+0)throw l;J(1,0)}}function Zc(a,b,d){var c=L();try{return $d(a,b,d)}catch(e){K(c);if(e!==e+0)throw e;J(1,0);return 0n}}function kd(a,b,d,c,e,g,k,l,n){var p=L();try{Od(a,b,d,c,e,g,k,l,n)}catch(v){K(p);if(v!==v+0)throw v;J(1,0)}}function Jc(a){var b=L();try{return ae(a)}catch(d){K(b);if(d!==d+0)throw d;J(1,0)}}function Wc(a,b,d){var c=L();try{return be(a,b,d)}catch(e){K(c);if(e!==e+0)throw e;J(1,0)}}
101
+ function Yc(a,b){var d=L();try{return re(a,b)}catch(c){K(d);if(c!==c+0)throw c;J(1,0);return 0n}}function qd(a,b,d,c,e){var g=L();try{ce(a,b,d,c,e)}catch(k){K(g);if(k!==k+0)throw k;J(1,0)}}function Xc(a){var b=L();try{return de(a)}catch(d){K(b);if(d!==d+0)throw d;J(1,0);return 0n}}function Tc(a,b,d,c,e,g){var k=L();try{return je(a,b,d,c,e,g)}catch(l){K(k);if(l!==l+0)throw l;J(1,0)}}function Oc(a,b,d,c,e,g){var k=L();try{return ke(a,b,d,c,e,g)}catch(l){K(k);if(l!==l+0)throw l;J(1,0)}}
102
+ function Rc(a,b,d,c,e,g,k,l){var n=L();try{return Xd(a,b,d,c,e,g,k,l)}catch(p){K(n);if(p!==p+0)throw p;J(1,0)}}function $c(a,b,d,c,e){var g=L();try{return le(a,b,d,c,e)}catch(k){K(g);if(k!==k+0)throw k;J(1,0);return 0n}}function Ic(a,b,d,c){var e=L();try{return me(a,b,d,c)}catch(g){K(e);if(g!==g+0)throw g;J(1,0)}}function Gc(a,b,d,c){var e=L();try{return ne(a,b,d,c)}catch(g){K(e);if(g!==g+0)throw g;J(1,0)}}
103
+ function Sc(a,b,d,c,e,g,k,l,n,p,v,w){var y=L();try{return oe(a,b,d,c,e,g,k,l,n,p,v,w)}catch(z){K(y);if(z!==z+0)throw z;J(1,0)}}function ld(a,b,d,c,e,g,k,l,n,p,v){var w=L();try{he(a,b,d,c,e,g,k,l,n,p,v)}catch(y){K(w);if(y!==y+0)throw y;J(1,0)}}function nd(a,b,d,c,e,g,k,l,n,p,v,w,y,z,W,kb){var Xf=L();try{ie(a,b,d,c,e,g,k,l,n,p,v,w,y,z,W,kb)}catch(lb){K(Xf);if(lb!==lb+0)throw lb;J(1,0)}}function Vc(a,b,d,c){var e=L();try{return pe(a,b,d,c)}catch(g){K(e);if(g!==g+0)throw g;J(1,0)}}
104
+ function Uc(a,b,d,c,e){var g=L();try{return qe(a,b,d,c,e)}catch(k){K(g);if(k!==k+0)throw k;J(1,0)}}function Hc(a,b,d){var c=L();try{return ee(a,b,d)}catch(e){K(c);if(e!==e+0)throw e;J(1,0)}}function Fc(a,b,d){var c=L();try{return fe(a,b,d)}catch(e){K(c);if(e!==e+0)throw e;J(1,0)}}function dd(a,b,d,c){var e=L();try{ge(a,b,d,c)}catch(g){K(e);if(g!==g+0)throw g;J(1,0)}}
105
+ function ud(){var a=G;a=Object.assign({},a);var b=c=>e=>c(e)>>>0,d=c=>()=>c()>>>0;a.ub=b(a.ub);a.Yb=d(a.Yb);a._b=b(a._b);a.mc=b(a.mc);a.nc=d(a.nc);a.rc=b(a.rc);return a}function Da(){if(0<ze)Ae=Da;else if(m)xa?.(f),Ra();else{for(var a=ye;0<a.length;)a.shift()(f);0<ze?Ae=Da:(f.calledRun=!0,t||(Ra(),xa?.(f)))}}var G;m||(G=await (Ca()),Da());f.PTR_SIZE=4;Qa?moduleRtn=f:moduleRtn=new Promise((a,b)=>{xa=a;ya=b});
106
+ ;return moduleRtn}export default ortWasmThreaded;var isPthread=globalThis.self?.name?.startsWith("em-pthread");var isNode=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";if(isNode)isPthread=(await import("worker_threads")).workerData==="em-pthread";isPthread&&ortWasmThreaded();
demo/assets/1.25.0-dev/dist/ort-wasm-simd-threaded.jsep.wasm ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:79db297d01a00f582d1f64d5a0dcee78ef52ea574f194d62148989be312388d7
3
+ size 25406787
demo/assets/1.25.0-dev/dist/ort-wasm-simd-threaded.mjs ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ async function ortWasmThreaded(moduleArg={}){var moduleRtn;var h=moduleArg,aa=!!globalThis.window,k=!!globalThis.WorkerGlobalScope,m=globalThis.process?.versions?.node&&"renderer"!=globalThis.process?.type,n=k&&self.name?.startsWith("em-pthread");if(m){const {createRequire:a}=await import("module");var require=a(import.meta.url),ba=require("worker_threads");global.Worker=ba.Worker;n=(k=!ba.ic)&&"em-pthread"==ba.workerData}h.mountExternalData=(a,b)=>{a.startsWith("./")&&(a=a.substring(2));(h.Sb||(h.Sb=new Map)).set(a,b)};
2
+ h.unmountExternalData=()=>{delete h.Sb};var SharedArrayBuffer=globalThis.SharedArrayBuffer??(new WebAssembly.Memory({initial:0,maximum:0,kc:!0})).buffer.constructor,ca="./this.program",da=(a,b)=>{throw b;},ea=import.meta.url,fa="",ha,ia;
3
+ if(m){var fs=require("fs");ea.startsWith("file:")&&(fa=require("path").dirname(require("url").fileURLToPath(ea))+"/");ia=a=>{a=ja(a)?new URL(a):a;return fs.readFileSync(a)};ha=async a=>{a=ja(a)?new URL(a):a;return fs.readFileSync(a,void 0)};1<process.argv.length&&(ca=process.argv[1].replace(/\\/g,"/"));process.argv.slice(2);da=(a,b)=>{process.exitCode=a;throw b;}}else if(aa||k){try{fa=(new URL(".",ea)).href}catch{}m||(k&&(ia=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";
4
+ b.send(null);return new Uint8Array(b.response)}),ha=async a=>{if(ja(a))return new Promise((d,c)=>{var e=new XMLHttpRequest;e.open("GET",a,!0);e.responseType="arraybuffer";e.onload=()=>{200==e.status||0==e.status&&e.response?d(e.response):c(e.status)};e.onerror=c;e.send(null)});var b=await fetch(a,{credentials:"same-origin"});if(b.ok)return b.arrayBuffer();throw Error(b.status+" : "+b.url);})}var ka=console.log.bind(console),la=console.error.bind(console);
5
+ if(m){var ma=require("util"),na=a=>"object"==typeof a?ma.inspect(a):a;ka=(...a)=>fs.writeSync(1,a.map(na).join(" ")+"\n");la=(...a)=>fs.writeSync(2,a.map(na).join(" ")+"\n")}var oa=ka,p=la,q,r,pa=!1,t,ja=a=>a.startsWith("file://");function v(){x.buffer!=z.buffer&&qa()}var ra,sa;
6
+ if(m&&n){var ta=ba.parentPort;ta.on("message",a=>global.onmessage?.({data:a}));Object.assign(globalThis,{self:global,postMessage:a=>ta.postMessage(a)});process.on("uncaughtException",a=>{postMessage({Qb:"uncaughtException",error:a});process.exit(1)})}var ua;
7
+ if(n){var va=!1;self.onunhandledrejection=b=>{throw b.reason||b;};function a(b){try{var d=b.data,c=d.Qb;if("load"===c){let e=[];self.onmessage=f=>e.push(f);ua=()=>{postMessage({Qb:"loaded"});for(let f of e)a(f);self.onmessage=a};for(const f of d.$b)if(!h[f]||h[f].proxy)h[f]=(...g)=>{postMessage({Qb:"callHandler",Zb:f,args:g})},"print"==f&&(oa=h[f]),"printErr"==f&&(p=h[f]);x=d.ec;qa();r=d.fc;wa();xa()}else if("run"===c){ya(d.Pb);za(d.Pb,0,0,1,0,0);Aa();Ba(d.Pb);va||=!0;try{Ca(d.cc,d.Ub)}catch(e){if("unwind"!=
8
+ e)throw e;}}else"setimmediate"!==d.target&&("checkMailbox"===c?va&&Da():c&&(p(`worker: received unknown command ${c}`),p(d)))}catch(e){throw Ea(),e;}}self.onmessage=a}var z,A,Fa,C,D,Ga,G,H,Ha=!1;function qa(){var a=x.buffer;h.HEAP8=z=new Int8Array(a);Fa=new Int16Array(a);h.HEAPU8=A=new Uint8Array(a);new Uint16Array(a);h.HEAP32=C=new Int32Array(a);h.HEAPU32=D=new Uint32Array(a);Ga=new Float32Array(a);G=new Float64Array(a);H=new BigInt64Array(a);new BigUint64Array(a)}
9
+ function Ia(){Ha=!0;n?ua():I.Ua()}function J(a){a="Aborted("+a+")";p(a);pa=!0;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");sa?.(a);throw a;}var Ja;async function Ka(a){if(!q)try{var b=await ha(a);return new Uint8Array(b)}catch{}if(a==Ja&&q)a=new Uint8Array(q);else if(ia)a=ia(a);else throw"both async and sync fetching of the wasm failed";return a}
10
+ async function La(a,b){try{var d=await Ka(a);return await WebAssembly.instantiate(d,b)}catch(c){p(`failed to asynchronously prepare wasm: ${c}`),J(c)}}async function Na(a){var b=Ja;if(!q&&!ja(b)&&!m)try{var d=fetch(b,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(d,a)}catch(c){p(`wasm streaming compile failed: ${c}`),p("falling back to ArrayBuffer instantiation")}return La(b,a)}
11
+ function Oa(){Pa={S:Qa,f:Ra,w:Sa,e:Ta,k:Ua,g:Va,T:Wa,b:Xa,G:Ya,ua:Za,j:$a,K:ab,Ka:bb,qa:cb,sa:db,La:eb,Ia:fb,Ba:gb,Ha:hb,Z:ib,ra:jb,oa:kb,Ja:lb,pa:mb,Qa:nb,Ea:ob,ma:pb,va:qb,ja:rb,U:sb,Da:Ba,Na:tb,ya:ub,za:vb,Aa:wb,wa:xb,xa:yb,ka:zb,Sa:Ab,Pa:Bb,W:Cb,V:Db,Oa:Eb,F:Fb,Ma:Gb,na:Hb,u:Ib,H:Jb,R:Kb,la:Lb,da:Mb,Ta:Nb,Fa:Ob,Ga:Pb,ta:Qb,L:Rb,Y:Sb,Ca:Tb,X:Ub,$:Vb,M:Wb,aa:Xb,N:Yb,v:Zb,c:$b,m:ac,n:bc,r:cc,ea:dc,x:ec,o:fc,O:gc,D:hc,I:ic,ba:jc,ca:kc,Q:lc,P:mc,fa:nc,z:oc,E:pc,d:qc,q:rc,i:sc,_:tc,l:uc,p:vc,s:wc,t:xc,
12
+ y:yc,ga:zc,B:Ac,J:Bc,C:Cc,ha:Dc,ia:Ec,A:Fc,h:Gc,a:x,Ra:Hc};return{a:Pa}}
13
+ async function wa(){function a(c,e){I=c.exports;I=Ic();Jc.push(I.wb);c=I;h._OrtInit=c.Va;h._OrtGetLastError=c.Wa;h._OrtCreateSessionOptions=c.Xa;h._OrtAppendExecutionProvider=c.Ya;h._OrtAddFreeDimensionOverride=c.Za;h._OrtAddSessionConfigEntry=c._a;h._OrtReleaseSessionOptions=c.$a;h._OrtCreateSession=c.ab;h._OrtReleaseSession=c.bb;h._OrtGetInputOutputCount=c.cb;h._OrtGetInputOutputMetadata=c.db;h._OrtFree=c.eb;h._OrtCreateTensor=c.fb;h._OrtGetTensorData=c.gb;h._OrtReleaseTensor=c.hb;h._OrtCreateRunOptions=
14
+ c.ib;h._OrtAddRunConfigEntry=c.jb;h._OrtReleaseRunOptions=c.kb;h._OrtCreateBinding=c.lb;h._OrtBindInput=c.mb;h._OrtBindOutput=c.nb;h._OrtClearBoundOutputs=c.ob;h._OrtReleaseBinding=c.pb;h._OrtRunWithBinding=c.qb;h._OrtRun=c.rb;h._OrtEndProfiling=c.sb;Kc=c.tb;Lc=h._free=c.ub;Mc=h._malloc=c.vb;za=c.yb;Ea=c.zb;Nc=c.Ab;Oc=c.Bb;Pc=c.Cb;Qc=c.Db;Rc=c.Eb;K=c.Fb;L=c.Gb;Sc=c.Hb;M=c.Ib;Tc=c.Jb;N=c.Kb;Uc=c.Lb;Vc=c.Mb;Wc=c.Nb;Xc=c.Ob;Yc=c.xb;r=e;return I}var b=Oa();if(h.instantiateWasm)return new Promise(c=>{h.instantiateWasm(b,
15
+ (e,f)=>{c(a(e,f))})});if(n){var d=new WebAssembly.Instance(r,Oa());return a(d,r)}Ja??=h.locateFile?h.locateFile?h.locateFile("ort-wasm-simd-threaded.wasm",fa):fa+"ort-wasm-simd-threaded.wasm":(new URL("ort-wasm-simd-threaded.wasm",import.meta.url)).href;return function(c){return a(c.instance,c.module)}(await Na(b))}class Zc{name="ExitStatus";constructor(a){this.message=`Program terminated with exit(${a})`;this.status=a}}
16
+ var $c=a=>{a.terminate();a.onmessage=()=>{}},ad=[],O=0,P=null,dd=a=>{0==Q.length&&(bd(),cd(Q[0]));var b=Q.pop();if(!b)return 6;R.push(b);S[a.Pb]=b;b.Pb=a.Pb;var d={Qb:"run",cc:a.bc,Ub:a.Ub,Pb:a.Pb};m&&b.unref();b.postMessage(d,a.Yb);return 0},T=0,U=(a,b,...d)=>{var c=16*d.length,e=N(),f=Tc(c),g=f>>>3,l;for(l of d)"bigint"==typeof l?((v(),H)[g++>>>0]=1n,(v(),H)[g++>>>0]=l):((v(),H)[g++>>>0]=0n,(v(),G)[g++>>>0]=l);a=Nc(a,0,c,f,b);M(e);return a};
17
+ function Hc(a){if(n)return U(0,1,a);t=a;if(!(0<T)){for(var b of R)$c(b);for(b of Q)$c(b);Q=[];R=[];S={};pa=!0}da(a,new Zc(a))}function ed(a){if(n)return U(1,0,a);Qb(a)}var Qb=a=>{t=a;if(n)throw ed(a),"unwind";Hc(a)},Q=[],R=[],Jc=[],S={};function fd(){for(var a=h.numThreads-1;a--;)bd();ad.push(async()=>{var b=gd();O++;await b;O--;0==O&&P&&(b=P,P=null,b())})}var hd=a=>{var b=a.Pb;delete S[b];Q.push(a);R.splice(R.indexOf(a),1);a.Pb=0;Oc(b)};function Aa(){Jc.forEach(a=>a())}
18
+ var cd=a=>new Promise(b=>{a.onmessage=f=>{var g=f.data;f=g.Qb;if(g.Tb&&g.Tb!=Kc()){var l=S[g.Tb];l?l.postMessage(g,g.Yb):p(`Internal error! Worker sent a message "${f}" to target pthread ${g.Tb}, but that thread no longer exists!`)}else if("checkMailbox"===f)Da();else if("spawnThread"===f)dd(g);else if("cleanupThread"===f)jd(()=>{hd(S[g.dc])});else if("loaded"===f)a.loaded=!0,m&&!a.Pb&&a.unref(),b(a);else if("setimmediate"===g.target)a.postMessage(g);else if("uncaughtException"===f)a.onerror(g.error);
19
+ else if("callHandler"===f)h[g.Zb](...g.args);else f&&p(`worker sent an unknown command ${f}`)};a.onerror=f=>{p(`${"worker sent an error!"} ${f.filename}:${f.lineno}: ${f.message}`);throw f;};m&&(a.on("message",f=>a.onmessage({data:f})),a.on("error",f=>a.onerror(f)));var d=[],c=[],e;for(e of c)h.propertyIsEnumerable(e)&&d.push(e);a.postMessage({Qb:"load",$b:d,ec:x,fc:r})});async function gd(){if(!n)return Promise.all(Q.map(cd))}
20
+ function bd(){var a=new Worker(new URL(import.meta.url),{type:"module",workerData:"em-pthread",name:"em-pthread"});Q.push(a)}function ya(a){var b=(v(),D)[a+52>>>2>>>0];a=(v(),D)[a+56>>>2>>>0];Sc(b,b-a);M(b)}var kd=[],V=a=>{var b=kd[a];b||(kd[a]=b=Yc.get(a));return b},Ca=(a,b)=>{T=0;a=V(a)(b);0<T?t=a:Pc(a)},x,ld=[],md=0;function Ra(a){a>>>=0;var b=new nd(a);0==(v(),z)[b.Rb+12>>>0]&&(od(b,!0),md--);pd(b,!1);ld.push(b);return Xc(a)}
21
+ var W=0,Sa=()=>{K(0,0);var a=ld.pop();Uc(a.Vb);W=0};function od(a,b){b=b?1:0;(v(),z)[a.Rb+12>>>0]=b}function pd(a,b){b=b?1:0;(v(),z)[a.Rb+13>>>0]=b}class nd{constructor(a){this.Vb=a;this.Rb=a-24}}var qd=a=>{var b=W;if(!b)return L(0),0;var d=new nd(b);(v(),D)[d.Rb+16>>>2>>>0]=b;var c=(v(),D)[d.Rb+4>>>2>>>0];if(!c)return L(0),b;for(var e of a){if(0===e||e===c)break;if(Wc(e,c,d.Rb+16))return L(e),b}L(c);return b};function Ta(){return qd([])}function Ua(a){return qd([a>>>0])}
22
+ function Va(a,b,d,c){return qd([a>>>0,b>>>0,d>>>0,c>>>0])}var Wa=()=>{var a=ld.pop();a||J("no exception to throw");var b=a.Vb;0==(v(),z)[a.Rb+13>>>0]&&(ld.push(a),pd(a,!0),od(a,!1),md++);Vc(b);W=b;throw W;};function Xa(a,b,d){a>>>=0;var c=new nd(a);b>>>=0;d>>>=0;(v(),D)[c.Rb+16>>>2>>>0]=0;(v(),D)[c.Rb+4>>>2>>>0]=b;(v(),D)[c.Rb+8>>>2>>>0]=d;Vc(a);W=a;md++;throw W;}var Ya=()=>md;function rd(a,b,d,c){return n?U(2,1,a,b,d,c):Za(a,b,d,c)}
23
+ function Za(a,b,d,c){a>>>=0;b>>>=0;d>>>=0;c>>>=0;if(!globalThis.SharedArrayBuffer)return 6;var e=[];if(n&&0===e.length)return rd(a,b,d,c);a={bc:d,Pb:a,Ub:c,Yb:e};return n?(a.Qb="spawnThread",postMessage(a,e),0):dd(a)}function $a(a){W||=a>>>0;throw W;}
24
+ var sd=globalThis.TextDecoder&&new TextDecoder,td=(a,b=0,d,c)=>{b>>>=0;var e=b;d=e+d;if(c)c=d;else{for(;a[e]&&!(e>=d);)++e;c=e}if(16<c-b&&a.buffer&&sd)return sd.decode(a.buffer instanceof ArrayBuffer?a.subarray(b,c):a.slice(b,c));for(e="";b<c;)if(d=a[b++],d&128){var f=a[b++]&63;if(192==(d&224))e+=String.fromCharCode((d&31)<<6|f);else{var g=a[b++]&63;d=224==(d&240)?(d&15)<<12|f<<6|g:(d&7)<<18|f<<12|g<<6|a[b++]&63;65536>d?e+=String.fromCharCode(d):(d-=65536,e+=String.fromCharCode(55296|d>>10,56320|
25
+ d&1023))}}else e+=String.fromCharCode(d);return e},ud=(a,b,d)=>(a>>>=0)?td((v(),A),a,b,d):"";function ab(a,b,d){return n?U(3,1,a,b,d):0}function bb(a,b){if(n)return U(4,1,a,b)}function cb(a,b){if(n)return U(5,1,a,b)}function db(a,b,d){if(n)return U(6,1,a,b,d)}function eb(a,b,d){return n?U(7,1,a,b,d):0}function fb(a,b){if(n)return U(8,1,a,b)}function gb(a,b,d){if(n)return U(9,1,a,b,d)}function hb(a,b,d,c){if(n)return U(10,1,a,b,d,c)}function ib(a,b,d,c){if(n)return U(11,1,a,b,d,c)}
26
+ function jb(a,b,d,c){if(n)return U(12,1,a,b,d,c)}function kb(a){if(n)return U(13,1,a)}function lb(a,b){if(n)return U(14,1,a,b)}function mb(a,b,d){if(n)return U(15,1,a,b,d)}var nb=()=>J("");function ob(a){za(a>>>0,!k,1,!aa,131072,!1);Aa()}
27
+ var jd=a=>{if(!pa)try{if(a(),!(0<T))try{n?Kc()&&Pc(t):Qb(t)}catch(b){b instanceof Zc||"unwind"==b||da(1,b)}}catch(b){b instanceof Zc||"unwind"==b||da(1,b)}},vd=!Atomics.waitAsync||globalThis.navigator?.userAgent&&91>Number((navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)||[])[2]);function Ba(a){a>>>=0;vd||(Atomics.waitAsync((v(),C),a>>>2,a).value.then(Da),a+=128,Atomics.store((v(),C),a>>>2,1))}var Da=()=>jd(()=>{var a=Kc();a&&(Ba(a),Rc())});
28
+ function pb(a,b){a>>>=0;a==b>>>0?setTimeout(Da):n?postMessage({Tb:a,Qb:"checkMailbox"}):(a=S[a])&&a.postMessage({Qb:"checkMailbox"})}var wd=[];function qb(a,b,d,c,e){b>>>=0;e>>>=0;wd.length=0;d=e>>>3;for(c=e+c>>>3;d<c;){var f;(v(),H)[d++>>>0]?f=(v(),H)[d++>>>0]:f=(v(),G)[d++>>>0];wd.push(f)}return(b?xd[b]:yd[a])(...wd)}var rb=()=>{T=0};function sb(a){a>>>=0;n?postMessage({Qb:"cleanupThread",dc:a}):hd(S[a])}function tb(a){m&&S[a>>>0].ref()}
29
+ function ub(a,b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);b>>>=0;a=new Date(1E3*a);(v(),C)[b>>>2>>>0]=a.getUTCSeconds();(v(),C)[b+4>>>2>>>0]=a.getUTCMinutes();(v(),C)[b+8>>>2>>>0]=a.getUTCHours();(v(),C)[b+12>>>2>>>0]=a.getUTCDate();(v(),C)[b+16>>>2>>>0]=a.getUTCMonth();(v(),C)[b+20>>>2>>>0]=a.getUTCFullYear()-1900;(v(),C)[b+24>>>2>>>0]=a.getUTCDay();a=(a.getTime()-Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0))/864E5|0;(v(),C)[b+28>>>2>>>0]=a}
30
+ var zd=a=>0===a%4&&(0!==a%100||0===a%400),Ad=[0,31,60,91,121,152,182,213,244,274,305,335],Bd=[0,31,59,90,120,151,181,212,243,273,304,334];
31
+ function vb(a,b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);b>>>=0;a=new Date(1E3*a);(v(),C)[b>>>2>>>0]=a.getSeconds();(v(),C)[b+4>>>2>>>0]=a.getMinutes();(v(),C)[b+8>>>2>>>0]=a.getHours();(v(),C)[b+12>>>2>>>0]=a.getDate();(v(),C)[b+16>>>2>>>0]=a.getMonth();(v(),C)[b+20>>>2>>>0]=a.getFullYear()-1900;(v(),C)[b+24>>>2>>>0]=a.getDay();var d=(zd(a.getFullYear())?Ad:Bd)[a.getMonth()]+a.getDate()-1|0;(v(),C)[b+28>>>2>>>0]=d;(v(),C)[b+36>>>2>>>0]=-(60*a.getTimezoneOffset());d=(new Date(a.getFullYear(),
32
+ 6,1)).getTimezoneOffset();var c=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();a=(d!=c&&a.getTimezoneOffset()==Math.min(c,d))|0;(v(),C)[b+32>>>2>>>0]=a}
33
+ function wb(a){a>>>=0;var b=new Date((v(),C)[a+20>>>2>>>0]+1900,(v(),C)[a+16>>>2>>>0],(v(),C)[a+12>>>2>>>0],(v(),C)[a+8>>>2>>>0],(v(),C)[a+4>>>2>>>0],(v(),C)[a>>>2>>>0],0),d=(v(),C)[a+32>>>2>>>0],c=b.getTimezoneOffset(),e=(new Date(b.getFullYear(),6,1)).getTimezoneOffset(),f=(new Date(b.getFullYear(),0,1)).getTimezoneOffset(),g=Math.min(f,e);0>d?(v(),C)[a+32>>>2>>>0]=Number(e!=f&&g==c):0<d!=(g==c)&&(e=Math.max(f,e),b.setTime(b.getTime()+6E4*((0<d?g:e)-c)));(v(),C)[a+24>>>2>>>0]=b.getDay();d=(zd(b.getFullYear())?
34
+ Ad:Bd)[b.getMonth()]+b.getDate()-1|0;(v(),C)[a+28>>>2>>>0]=d;(v(),C)[a>>>2>>>0]=b.getSeconds();(v(),C)[a+4>>>2>>>0]=b.getMinutes();(v(),C)[a+8>>>2>>>0]=b.getHours();(v(),C)[a+12>>>2>>>0]=b.getDate();(v(),C)[a+16>>>2>>>0]=b.getMonth();(v(),C)[a+20>>>2>>>0]=b.getYear();a=b.getTime();return BigInt(isNaN(a)?-1:a/1E3)}function xb(a,b,d,c,e,f,g){return n?U(16,1,a,b,d,c,e,f,g):-52}function yb(a,b,d,c,e,f){if(n)return U(17,1,a,b,d,c,e,f)}var X={},Ib=()=>performance.timeOrigin+performance.now();
35
+ function zb(a,b){if(n)return U(18,1,a,b);X[a]&&(clearTimeout(X[a].id),delete X[a]);if(!b)return 0;var d=setTimeout(()=>{delete X[a];jd(()=>Qc(a,performance.timeOrigin+performance.now()))},b);X[a]={id:d,lc:b};return 0}
36
+ var Y=(a,b,d)=>{var c=(v(),A);b>>>=0;if(0<d){var e=b;d=b+d-1;for(var f=0;f<a.length;++f){var g=a.codePointAt(f);if(127>=g){if(b>=d)break;c[b++>>>0]=g}else if(2047>=g){if(b+1>=d)break;c[b++>>>0]=192|g>>6;c[b++>>>0]=128|g&63}else if(65535>=g){if(b+2>=d)break;c[b++>>>0]=224|g>>12;c[b++>>>0]=128|g>>6&63;c[b++>>>0]=128|g&63}else{if(b+3>=d)break;c[b++>>>0]=240|g>>18;c[b++>>>0]=128|g>>12&63;c[b++>>>0]=128|g>>6&63;c[b++>>>0]=128|g&63;f++}}c[b>>>0]=0;a=b-e}else a=0;return a};
37
+ function Ab(a,b,d,c){a>>>=0;b>>>=0;d>>>=0;c>>>=0;var e=(new Date).getFullYear(),f=(new Date(e,0,1)).getTimezoneOffset();e=(new Date(e,6,1)).getTimezoneOffset();var g=Math.max(f,e);(v(),D)[a>>>2>>>0]=60*g;(v(),C)[b>>>2>>>0]=Number(f!=e);b=l=>{var u=Math.abs(l);return`UTC${0<=l?"-":"+"}${String(Math.floor(u/60)).padStart(2,"0")}${String(u%60).padStart(2,"0")}`};a=b(f);b=b(e);e<f?(Y(a,d,17),Y(b,c,17)):(Y(a,c,17),Y(b,d,17))}var Eb=()=>Date.now(),Cd=1;
38
+ function Bb(a,b,d){d>>>=0;if(!(0<=a&&3>=a))return 28;if(0===a)a=Date.now();else if(Cd)a=performance.timeOrigin+performance.now();else return 52;a=Math.round(1E6*a);(v(),H)[d>>>3>>>0]=BigInt(a);return 0}var Dd=[];function Cb(a,b,d){a>>>=0;b>>>=0;d>>>=0;Dd.length=0;for(var c;c=(v(),A)[b++>>>0];){var e=105!=c;e&=112!=c;d+=e&&d%8?4:0;Dd.push(112==c?(v(),D)[d>>>2>>>0]:106==c?(v(),H)[d>>>3>>>0]:105==c?(v(),C)[d>>>2>>>0]:(v(),G)[d>>>3>>>0]);d+=e?8:4}return xd[a](...Dd)}var Db=()=>{};
39
+ function Fb(a,b){return p(ud(a>>>0,b>>>0))}var Gb=()=>{T+=1;throw"unwind";};function Hb(){return 4294901760}var Jb=()=>m?require("os").cpus().length:navigator.hardwareConcurrency,Z={},Ed=a=>{for(var b=0,d=0;d<a.length;++d){var c=a.charCodeAt(d);127>=c?b++:2047>=c?b+=2:55296<=c&&57343>=c?(b+=4,++d):b+=3}return b},Fd=a=>{var b;return(b=/\bwasm-function\[\d+\]:(0x[0-9a-f]+)/.exec(a))?+b[1]:(b=/:(\d+):\d+(?:\)|$)/.exec(a))?2147483648|+b[1]:0},Gd=a=>{for(var b of a)(a=Fd(b))&&(Z[a]=b)};
40
+ function Mb(){var a=Error().stack.toString().split("\n");"Error"==a[0]&&a.shift();Gd(a);Z.Wb=Fd(a[3]);Z.ac=a;return Z.Wb}function Kb(a){a=Z[a>>>0];if(!a)return 0;var b;if(b=/^\s+at .*\.wasm\.(.*) \(.*\)$/.exec(a))a=b[1];else if(b=/^\s+at (.*) \(.*\)$/.exec(a))a=b[1];else if(b=/^(.+?)@/.exec(a))a=b[1];else return 0;Lc(Kb.Xb??0);b=Ed(a)+1;var d=Mc(b);d&&Y(a,d,b);Kb.Xb=d;return Kb.Xb}
41
+ function Lb(a){a>>>=0;var b=(v(),A).length;if(a<=b||4294901760<a)return!1;for(var d=1;4>=d;d*=2){var c=b*(1+.2/d);c=Math.min(c,a+100663296);a:{c=(Math.min(4294901760,65536*Math.ceil(Math.max(a,c)/65536))-x.buffer.byteLength+65535)/65536|0;try{x.grow(c);qa();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1}
42
+ function Nb(a,b,d){a>>>=0;b>>>=0;if(Z.Wb==a)var c=Z.ac;else c=Error().stack.toString().split("\n"),"Error"==c[0]&&c.shift(),Gd(c);for(var e=3;c[e]&&Fd(c[e])!=a;)++e;for(a=0;a<d&&c[a+e];++a)(v(),C)[b+4*a>>>2>>>0]=Fd(c[a+e]);return a}
43
+ var Hd={},Jd=()=>{if(!Id){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",_:ca||"./this.program"},b;for(b in Hd)void 0===Hd[b]?delete a[b]:a[b]=Hd[b];var d=[];for(b in a)d.push(`${b}=${a[b]}`);Id=d}return Id},Id;function Ob(a,b){if(n)return U(19,1,a,b);a>>>=0;b>>>=0;var d=0,c=0,e;for(e of Jd()){var f=b+d;(v(),D)[a+c>>>2>>>0]=f;d+=Y(e,f,Infinity)+1;c+=4}return 0}
44
+ function Pb(a,b){if(n)return U(20,1,a,b);a>>>=0;b>>>=0;var d=Jd();(v(),D)[a>>>2>>>0]=d.length;a=0;for(var c of d)a+=Ed(c)+1;(v(),D)[b>>>2>>>0]=a;return 0}function Rb(a){return n?U(21,1,a):52}function Sb(a,b,d,c){return n?U(22,1,a,b,d,c):52}function Tb(a,b,d,c){return n?U(23,1,a,b,d,c):70}var Kd=[null,[],[]];
45
+ function Ub(a,b,d,c){if(n)return U(24,1,a,b,d,c);b>>>=0;d>>>=0;c>>>=0;for(var e=0,f=0;f<d;f++){var g=(v(),D)[b>>>2>>>0],l=(v(),D)[b+4>>>2>>>0];b+=8;for(var u=0;u<l;u++){var w=a,y=(v(),A)[g+u>>>0],B=Kd[w];0===y||10===y?((1===w?oa:p)(td(B)),B.length=0):B.push(y)}e+=l}(v(),D)[c>>>2>>>0]=e;return 0}function Gc(a){return a>>>0}n||fd();n||(x=new WebAssembly.Memory({initial:256,maximum:65536,shared:!0}),qa());h.wasmBinary&&(q=h.wasmBinary);h.stackSave=()=>N();h.stackRestore=a=>M(a);h.stackAlloc=a=>Tc(a);
46
+ h.setValue=function(a,b,d="i8"){d.endsWith("*")&&(d="*");switch(d){case "i1":(v(),z)[a>>>0]=b;break;case "i8":(v(),z)[a>>>0]=b;break;case "i16":(v(),Fa)[a>>>1>>>0]=b;break;case "i32":(v(),C)[a>>>2>>>0]=b;break;case "i64":(v(),H)[a>>>3>>>0]=BigInt(b);break;case "float":(v(),Ga)[a>>>2>>>0]=b;break;case "double":(v(),G)[a>>>3>>>0]=b;break;case "*":(v(),D)[a>>>2>>>0]=b;break;default:J(`invalid type for setValue: ${d}`)}};
47
+ h.getValue=function(a,b="i8"){b.endsWith("*")&&(b="*");switch(b){case "i1":return(v(),z)[a>>>0];case "i8":return(v(),z)[a>>>0];case "i16":return(v(),Fa)[a>>>1>>>0];case "i32":return(v(),C)[a>>>2>>>0];case "i64":return(v(),H)[a>>>3>>>0];case "float":return(v(),Ga)[a>>>2>>>0];case "double":return(v(),G)[a>>>3>>>0];case "*":return(v(),D)[a>>>2>>>0];default:J(`invalid type for getValue: ${b}`)}};h.UTF8ToString=ud;h.stringToUTF8=Y;h.lengthBytesUTF8=Ed;
48
+ var yd=[Hc,ed,rd,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,mb,xb,yb,zb,Ob,Pb,Rb,Sb,Tb,Ub],xd={903788:(a,b,d,c,e)=>{if("undefined"==typeof h||!h.Sb)return 1;a=ud(Number(a>>>0));a.startsWith("./")&&(a=a.substring(2));a=h.Sb.get(a);if(!a)return 2;b=Number(b>>>0);d=Number(d>>>0);c=Number(c>>>0);if(b+d>a.byteLength)return 3;try{const f=a.subarray(b,b+d);switch(e){case 0:(v(),A).set(f,c>>>0);break;case 1:h.hc?h.hc(c,f):h.jc(c,f);break;default:return 4}return 0}catch{return 4}},904612:()=>"undefined"!==typeof wasmOffsetConverter};
49
+ function Qa(){return"undefined"!==typeof wasmOffsetConverter}var Kc,Lc,Mc,za,Ea,Nc,Oc,Pc,Qc,Rc,K,L,Sc,M,Tc,N,Uc,Vc,Wc,Xc,Yc,Pa;function bc(a,b,d,c){var e=N();try{return V(a)(b,d,c)}catch(f){M(e);if(f!==f+0)throw f;K(1,0)}}function ac(a,b,d){var c=N();try{return V(a)(b,d)}catch(e){M(c);if(e!==e+0)throw e;K(1,0)}}function qc(a){var b=N();try{V(a)()}catch(d){M(b);if(d!==d+0)throw d;K(1,0)}}function $b(a,b){var d=N();try{return V(a)(b)}catch(c){M(d);if(c!==c+0)throw c;K(1,0)}}
50
+ function sc(a,b,d){var c=N();try{V(a)(b,d)}catch(e){M(c);if(e!==e+0)throw e;K(1,0)}}function rc(a,b){var d=N();try{V(a)(b)}catch(c){M(d);if(c!==c+0)throw c;K(1,0)}}function fc(a,b,d,c,e,f,g){var l=N();try{return V(a)(b,d,c,e,f,g)}catch(u){M(l);if(u!==u+0)throw u;K(1,0)}}function wc(a,b,d,c,e,f){var g=N();try{V(a)(b,d,c,e,f)}catch(l){M(g);if(l!==l+0)throw l;K(1,0)}}function uc(a,b,d,c){var e=N();try{V(a)(b,d,c)}catch(f){M(e);if(f!==f+0)throw f;K(1,0)}}
51
+ function vc(a,b,d,c,e){var f=N();try{V(a)(b,d,c,e)}catch(g){M(f);if(g!==g+0)throw g;K(1,0)}}function xc(a,b,d,c,e,f,g){var l=N();try{V(a)(b,d,c,e,f,g)}catch(u){M(l);if(u!==u+0)throw u;K(1,0)}}function Ec(a,b,d,c,e,f,g){var l=N();try{V(a)(b,d,c,e,f,g)}catch(u){M(l);if(u!==u+0)throw u;K(1,0)}}function Dc(a,b,d,c,e,f,g,l){var u=N();try{V(a)(b,d,c,e,f,g,l)}catch(w){M(u);if(w!==w+0)throw w;K(1,0)}}function cc(a,b,d,c,e){var f=N();try{return V(a)(b,d,c,e)}catch(g){M(f);if(g!==g+0)throw g;K(1,0)}}
52
+ function yc(a,b,d,c,e,f,g,l){var u=N();try{V(a)(b,d,c,e,f,g,l)}catch(w){M(u);if(w!==w+0)throw w;K(1,0)}}function Bc(a,b,d,c,e,f,g,l,u,w,y,B){var E=N();try{V(a)(b,d,c,e,f,g,l,u,w,y,B)}catch(F){M(E);if(F!==F+0)throw F;K(1,0)}}function ec(a,b,d,c,e,f){var g=N();try{return V(a)(b,d,c,e,f)}catch(l){M(g);if(l!==l+0)throw l;K(1,0)}}function oc(a,b,d){var c=N();try{return V(a)(b,d)}catch(e){M(c);if(e!==e+0)throw e;K(1,0);return 0n}}
53
+ function zc(a,b,d,c,e,f,g,l,u){var w=N();try{V(a)(b,d,c,e,f,g,l,u)}catch(y){M(w);if(y!==y+0)throw y;K(1,0)}}function Zb(a){var b=N();try{return V(a)()}catch(d){M(b);if(d!==d+0)throw d;K(1,0)}}function lc(a,b,d){var c=N();try{return V(a)(b,d)}catch(e){M(c);if(e!==e+0)throw e;K(1,0)}}function nc(a,b){var d=N();try{return V(a)(b)}catch(c){M(d);if(c!==c+0)throw c;K(1,0);return 0n}}function Fc(a,b,d,c,e){var f=N();try{V(a)(b,d,c,e)}catch(g){M(f);if(g!==g+0)throw g;K(1,0)}}
54
+ function mc(a){var b=N();try{return V(a)()}catch(d){M(b);if(d!==d+0)throw d;K(1,0);return 0n}}function ic(a,b,d,c,e,f){var g=N();try{return V(a)(b,d,c,e,f)}catch(l){M(g);if(l!==l+0)throw l;K(1,0)}}function dc(a,b,d,c,e,f){var g=N();try{return V(a)(b,d,c,e,f)}catch(l){M(g);if(l!==l+0)throw l;K(1,0)}}function gc(a,b,d,c,e,f,g,l){var u=N();try{return V(a)(b,d,c,e,f,g,l)}catch(w){M(u);if(w!==w+0)throw w;K(1,0)}}
55
+ function pc(a,b,d,c,e){var f=N();try{return V(a)(b,d,c,e)}catch(g){M(f);if(g!==g+0)throw g;K(1,0);return 0n}}function Yb(a,b,d,c){var e=N();try{return V(a)(b,d,c)}catch(f){M(e);if(f!==f+0)throw f;K(1,0)}}function Wb(a,b,d,c){var e=N();try{return V(a)(b,d,c)}catch(f){M(e);if(f!==f+0)throw f;K(1,0)}}function hc(a,b,d,c,e,f,g,l,u,w,y,B){var E=N();try{return V(a)(b,d,c,e,f,g,l,u,w,y,B)}catch(F){M(E);if(F!==F+0)throw F;K(1,0)}}
56
+ function Ac(a,b,d,c,e,f,g,l,u,w,y){var B=N();try{V(a)(b,d,c,e,f,g,l,u,w,y)}catch(E){M(B);if(E!==E+0)throw E;K(1,0)}}function Cc(a,b,d,c,e,f,g,l,u,w,y,B,E,F,Ld,Md){var Nd=N();try{V(a)(b,d,c,e,f,g,l,u,w,y,B,E,F,Ld,Md)}catch(Ma){M(Nd);if(Ma!==Ma+0)throw Ma;K(1,0)}}function kc(a,b,d,c){var e=N();try{return V(a)(b,d,c)}catch(f){M(e);if(f!==f+0)throw f;K(1,0)}}function jc(a,b,d,c,e){var f=N();try{return V(a)(b,d,c,e)}catch(g){M(f);if(g!==g+0)throw g;K(1,0)}}
57
+ function Xb(a,b,d){var c=N();try{return V(a)(b,d)}catch(e){M(c);if(e!==e+0)throw e;K(1,0)}}function Vb(a,b,d){var c=N();try{return V(a)(b,d)}catch(e){M(c);if(e!==e+0)throw e;K(1,0)}}function tc(a,b,d,c){var e=N();try{V(a)(b,d,c)}catch(f){M(e);if(f!==f+0)throw f;K(1,0)}}function Ic(){var a=I;a=Object.assign({},a);var b=c=>()=>c()>>>0,d=c=>e=>c(e)>>>0;a.tb=b(a.tb);a.vb=d(a.vb);a.Jb=d(a.Jb);a.Kb=b(a.Kb);a.Ob=d(a.Ob);return a}
58
+ function xa(){if(0<O)P=xa;else if(n)ra?.(h),Ia();else{for(var a=ad;0<a.length;)a.shift()(h);0<O?P=xa:(h.calledRun=!0,pa||(Ia(),ra?.(h)))}}var I;n||(I=await (wa()),xa());h.PTR_SIZE=4;Ha?moduleRtn=h:moduleRtn=new Promise((a,b)=>{ra=a;sa=b});
59
+ ;return moduleRtn}export default ortWasmThreaded;var isPthread=globalThis.self?.name?.startsWith("em-pthread");var isNode=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";if(isNode)isPthread=(await import("worker_threads")).workerData==="em-pthread";isPthread&&ortWasmThreaded();
demo/assets/1.25.0-dev/dist/ort-wasm-simd-threaded.wasm ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:752eb7d52315443f063799f37aec133cf5cbf042b7c43031ee06649e5604e8a5
3
+ size 12524814
demo/assets/VectorSearch-min.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*********************************************************************
2
+ * Client side vector search using EmbeddingGemma or all-Mini-L6-v2,
3
+ * Accelerated with WebGPU via LiteRT.js or Transformers.js.
4
+ * Tokenizer via Transformers.js, and pre/post processing via
5
+ * TensorFlow.js - all accelerated via WebGPU for speed.
6
+ * Version: 1.1.2
7
+ * Coded by Jason Mayes 2026.
8
+ *--------------------------------------------------------------------
9
+ * Connect with me on social if aquestions or comments:
10
+ *
11
+ * LinkedIn: https://www.linkedin.com/in/webai/
12
+ * Twitter / X: https://x.com/jason_mayes
13
+ * Github: https://github.com/jasonmayes
14
+ * CodePen: https://codepen.io/jasonmayes
15
+ *********************************************************************/
16
+ import"/assets/tf.min.js";import"/assets/tf-backend-webgpu.js";import*as T from"/assets/litertjs-core-0.2.1_esm.js";var f=class{constructor(e="unnamed"){this.dbName=e,this.db=null}setDb(e){this.dbName!==e&&(this.dbName=e,this.db&&(this.db.close(),this.db=null))}async initDb(){return this.db?this.db:new Promise((e,s)=>{let i=indexedDB.open(this.dbName,1);i.onupgradeneeded=n=>{let t=n.target.result;t.objectStoreNames.contains("embeddings")||t.createObjectStore("embeddings",{keyPath:"id",autoIncrement:!0})},i.onsuccess=n=>{this.db=n.target.result,e(this.db)},i.onerror=n=>s(n.target.error)})}async storeBatch(e){let i=(await this.initDb()).transaction(["embeddings"],"readwrite"),n=i.objectStore("embeddings");return new Promise((t,o)=>{i.oncomplete=()=>t(),i.onerror=r=>o(r.target.error);for(let r of e)n.add({text:r.text,embedding:r.embedding})})}async getAllVectors(){let e=await this.initDb();return new Promise((s,i)=>{let t=e.transaction(["embeddings"],"readonly").objectStore("embeddings"),o=[],r=t.openCursor();r.onsuccess=a=>{let c=a.target.result;c?(o.push({id:c.value.id,embedding:c.value.embedding}),c.continue()):s(o)},r.onerror=a=>i(a.target.error)})}async getTextByID(e){let s=await this.initDb();return new Promise((i,n)=>{let r=s.transaction(["embeddings"],"readonly").objectStore("embeddings").get(e);r.onsuccess=()=>{i(r.result?r.result.text:null)},r.onerror=a=>n(a.target.error)})}};var b=class{constructor(){this.cachedMatrix=void 0}async deleteGPUVectorCache(){this.cachedMatrix&&(this.cachedMatrix.dispose(),this.cachedMatrix=void 0)}async calculateCosineSimilarity(e,s){return tf.tidy(()=>{let i=e.squeeze(),n=s.squeeze(),t=tf.dot(i,n),o=tf.norm(i),r=tf.norm(n);return t.div(o.mul(r)).dataSync()[0]})}async cosineSimilarityTFJSGPUMatrix(e,s,i){this.cachedMatrix||(console.log("Rebuilding GPU VectorDB Matrix"),this.cachedMatrix=tf.tensor2d(e));let n=tf.tidy(()=>{let a=tf.tensor1d(s),c=1e-9,l=this.cachedMatrix.norm(2,1,!0),m=this.cachedMatrix.div(l.add(c)),d=a.norm(2),h=a.div(d.add(c)),g;try{g=tf.matMul(m,h.reshape([-1,1]))}catch(R){console.error("VectorDB you are trying to use was encoded using embedding model that generated different number of dimensions. Please re-encode DB or use correct Embedding Model",R)}return g.squeeze()}),t=tf.topk(n,i,!1),o=await t.values.data(),r=await t.indices.data();return{values:o,indices:r}}};import*as D from"/assets/litertjs-core-0.2.1_esm.js";import*as M from"/assets/litertjs-tfjs-interop-1.0.1_esm.js";import{pipeline as k}from"/assets/transformers.min.js";var p=class{constructor(e){this.model=void 0,this.runtime=e}async load(e){this.runtime==="litertjs"?this.model=await D.loadAndCompile(e,{accelerator:"webgpu"}):this.model=await k("feature-extraction",e)}async getEmbeddingLiteRTJS(e,s){if(!this.model)throw new Error("Model not loaded. Call load() first.");if(this.runtime==="litertjs"){let i=tf.tensor1d(e,"int32");e.length<s?i=i.pad([[0,s-e.length]]):e.length>s&&(i=i.slice([0],[s]));let n=i.expandDims(0),t=M.runWithTfjsTensors(this.model,n);return i.dispose(),n.dispose(),{embedding:t[0],tokens:e}}}async getEmbeddingTransformers(e){if(this.runtime==="transformersjs"){let s=await this.model(e,{pooling:"mean",normalize:!0});return{embedding:Array.from(s.data)}}}};import{AutoTokenizer as N}from"/assets/transformers.min.js";var w=class{constructor(){this.tokenizer=void 0}async load(e){this.tokenizer=await N.from_pretrained(e)}async encode(e){if(!this.tokenizer)throw new Error("Tokenizer not loaded. Call load() first.");return await this.tokenizer.encode(e)}};var y=class{render(e,s,i){s.innerHTML="",e.forEach(t=>{let o=document.createElement("div");o.className="token-chip",o.innerText=t,s.appendChild(o)});let n=Math.min(20,i-e.length);for(let t=0;t<n;t++){let o=document.createElement("div");o.className="token-chip padded",o.innerText="0",s.appendChild(o)}if(e.length<i){let t=document.createElement("div");t.className="mini-subtitle",t.innerText=`... and ${i-e.length-n} more padding tokens`,s.appendChild(t)}}};var x=class{async render(e,s,i){let n=e instanceof tf.Tensor?await e.data():e;s.innerHTML="";for(let t=0;t<n.length;t++){let o=n[t],r=document.createElement("div");r.className="viz-cell";let a=Math.max(0,Math.min(255,(o+.1)*1e3+128));r.style.backgroundColor=`rgb(${a}, ${a/2}, 255)`,r.title=`Dim ${t}: ${o.toFixed(4)}`,s.appendChild(r)}i.innerText="Full Vector: ["+Array.from(n).map(t=>t.toFixed(4)).join(", ")+"]"}};var v=class{constructor(e){this.modelUrl=e.url,this.modelRuntime=e.runtime,this.litertHostedWasmUrl=e.litertjsWasmUrl?e.litertjsWasmUrl:"/assets/litertjs/core/0.2.1/wasm/",this.tokenizerId=e.tokenizer,this.seqLength=e.sequenceLength,this.vectorStore=new f,this.cosineSimilarity=new b,this.embeddingModel=new p(this.modelRuntime),this.tokenizer=new w,this.visualizeTokens=new y,this.visualizeEmbedding=new x,this.allStoredData=void 0,this.lastDBName=""}async load(e){if(e&&(e.innerText="Setting WebGPU Backend for TFJS..."),await tf.setBackend("webgpu"),e&&(e.innerText="Initializing Model Runtime..."),this.modelRuntime==="litertjs"){let s=this.litertHostedWasmUrl;await T.loadLiteRt(s);let i=tf.backend();T.setWebGpuDevice(i.device)}e&&(e.innerText="Loading Tokenizer & Embedding Model..."),await this.embeddingModel.load(this.modelUrl,this.modelRuntime),e&&(e.innerText="Loading Tokenizer..."),this.modelRuntime==="litertjs"&&await this.tokenizer.load(this.tokenizerId)}setDb(e){this.vectorStore.setDb(e)}async getEmbedding(e){if(this.modelRuntime==="litertjs"){let s=await this.tokenizer.encode(e),{embedding:i}=await this.embeddingModel.getEmbeddingLiteRTJS(s,this.seqLength),n=await i.array();return i.dispose(),{embedding:n[0],tokens:s}}else{let{embedding:s}=await this.embeddingModel.getEmbeddingTransformers(e);return{embedding:s}}}renderTokens(e,s){this.visualizeTokens.render(e,s,this.seqLength)}async renderEmbedding(e,s,i){await this.visualizeEmbedding.render(e,s,i)}async deleteGPUVectorCache(){await this.cosineSimilarity.deleteGPUVectorCache()}async search(e,s,i,n=5){let t;if(this.lastDBName!==i?(await this.deleteGPUVectorCache(),this.lastDBName=i,this.allStoredData=await this.vectorStore.getAllVectors(),t=this.allStoredData.map(d=>d.embedding)):t=this.allStoredData.map(d=>d.embedding),t.length===0)return console.warn("No data in chosen vector store. Store some data first before searching"),{results:[],bestScore:0,bestIndex:0};let{values:o,indices:r}=await this.cosineSimilarity.cosineSimilarityTFJSGPUMatrix(t,e,n),a=[],c=0,l=0;for(let d=0;d<o.length;d++)o[d]>=s&&a.length<n&&(a.push({id:this.allStoredData[r[d]].id,score:o[d],vector:this.allStoredData[r[d]].embedding}),o[d]>l&&(c=a.length-1,l=o[d]));let m=[];for(let d of a){let h=await this.vectorStore.getTextByID(d.id);m.push({...d,text:h})}return{results:m,bestScore:l,bestIndex:c}}async storeBatch(e){await this.vectorStore.storeBatch(e)}async storeTexts(e,s,i,n=2){this.setDb(s);let t=[],o=[];for(let r=0;r<e.length;r++)if(i&&(i.innerText=`Embedding paragraph ${r+1} of ${e.length}...`),this.modelRuntime==="litertjs"){let a=await this.tokenizer.encode(e[r]),{embedding:c}=await this.embeddingModel.getEmbeddingLiteRTJS(a,this.seqLength);if(o.push(c),t.push(e[r]),o.length>=n||r===e.length-1){let l=tf.stack(o),d=(await l.array()).map((h,g)=>({embedding:h[0],text:t[g]}));await this.vectorStore.storeBatch(d),o.forEach(h=>h.dispose()),l.dispose(),o=[],t=[]}}else if(t.push(e[r]),t.length>=n||r===e.length-1){let{embedding:a}=await this.embeddingModel.getEmbeddingTransformers(t),c=a.length/n;for(let l=0;l<a.length/c;l++){let m={embedding:a.slice(l*c,(l+1)*c),text:t[l]};await this.vectorStore.storeBatch([m])}t=[]}await this.deleteGPUVectorCache()}};export{v as VectorSearch};
demo/assets/fonts.css ADDED
@@ -0,0 +1,567 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
9
+ }
10
+ /* cyrillic */
11
+ @font-face {
12
+ font-family: 'Roboto';
13
+ font-style: italic;
14
+ font-weight: 300;
15
+ font-stretch: 100%;
16
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkAnkaSTbQWt4N.woff2) format('woff2');
17
+ unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
18
+ }
19
+ /* greek-ext */
20
+ @font-face {
21
+ font-family: 'Roboto';
22
+ font-style: italic;
23
+ font-weight: 300;
24
+ font-stretch: 100%;
25
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCnkaSTbQWt4N.woff2) format('woff2');
26
+ unicode-range: U+1F00-1FFF;
27
+ }
28
+ /* greek */
29
+ @font-face {
30
+ font-family: 'Roboto';
31
+ font-style: italic;
32
+ font-weight: 300;
33
+ font-stretch: 100%;
34
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkBXkaSTbQWt4N.woff2) format('woff2');
35
+ unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
36
+ }
37
+ /* math */
38
+ @font-face {
39
+ font-family: 'Roboto';
40
+ font-style: italic;
41
+ font-weight: 300;
42
+ font-stretch: 100%;
43
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkenkaSTbQWt4N.woff2) format('woff2');
44
+ unicode-range: U+0302-0303, U+0305, U+0307-0308, U+0310, U+0312, U+0315, U+031A, U+0326-0327, U+032C, U+032F-0330, U+0332-0333, U+0338, U+033A, U+0346, U+034D, U+0391-03A1, U+03A3-03A9, U+03B1-03C9, U+03D1, U+03D5-03D6, U+03F0-03F1, U+03F4-03F5, U+2016-2017, U+2034-2038, U+203C, U+2040, U+2043, U+2047, U+2050, U+2057, U+205F, U+2070-2071, U+2074-208E, U+2090-209C, U+20D0-20DC, U+20E1, U+20E5-20EF, U+2100-2112, U+2114-2115, U+2117-2121, U+2123-214F, U+2190, U+2192, U+2194-21AE, U+21B0-21E5, U+21F1-21F2, U+21F4-2211, U+2213-2214, U+2216-22FF, U+2308-230B, U+2310, U+2319, U+231C-2321, U+2336-237A, U+237C, U+2395, U+239B-23B7, U+23D0, U+23DC-23E1, U+2474-2475, U+25AF, U+25B3, U+25B7, U+25BD, U+25C1, U+25CA, U+25CC, U+25FB, U+266D-266F, U+27C0-27FF, U+2900-2AFF, U+2B0E-2B11, U+2B30-2B4C, U+2BFE, U+3030, U+FF5B, U+FF5D, U+1D400-1D7FF, U+1EE00-1EEFF;
45
+ }
46
+ /* symbols */
47
+ @font-face {
48
+ font-family: 'Roboto';
49
+ font-style: italic;
50
+ font-weight: 300;
51
+ font-stretch: 100%;
52
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkaHkaSTbQWt4N.woff2) format('woff2');
53
+ unicode-range: U+0001-000C, U+000E-001F, U+007F-009F, U+20DD-20E0, U+20E2-20E4, U+2150-218F, U+2190, U+2192, U+2194-2199, U+21AF, U+21E6-21F0, U+21F3, U+2218-2219, U+2299, U+22C4-22C6, U+2300-243F, U+2440-244A, U+2460-24FF, U+25A0-27BF, U+2800-28FF, U+2921-2922, U+2981, U+29BF, U+29EB, U+2B00-2BFF, U+4DC0-4DFF, U+FFF9-FFFB, U+10140-1018E, U+10190-1019C, U+101A0, U+101D0-101FD, U+102E0-102FB, U+10E60-10E7E, U+1D2C0-1D2D3, U+1D2E0-1D37F, U+1F000-1F0FF, U+1F100-1F1AD, U+1F1E6-1F1FF, U+1F30D-1F30F, U+1F315, U+1F31C, U+1F31E, U+1F320-1F32C, U+1F336, U+1F378, U+1F37D, U+1F382, U+1F393-1F39F, U+1F3A7-1F3A8, U+1F3AC-1F3AF, U+1F3C2, U+1F3C4-1F3C6, U+1F3CA-1F3CE, U+1F3D4-1F3E0, U+1F3ED, U+1F3F1-1F3F3, U+1F3F5-1F3F7, U+1F408, U+1F415, U+1F41F, U+1F426, U+1F43F, U+1F441-1F442, U+1F444, U+1F446-1F449, U+1F44C-1F44E, U+1F453, U+1F46A, U+1F47D, U+1F4A3, U+1F4B0, U+1F4B3, U+1F4B9, U+1F4BB, U+1F4BF, U+1F4C8-1F4CB, U+1F4D6, U+1F4DA, U+1F4DF, U+1F4E3-1F4E6, U+1F4EA-1F4ED, U+1F4F7, U+1F4F9-1F4FB, U+1F4FD-1F4FE, U+1F503, U+1F507-1F50B, U+1F50D, U+1F512-1F513, U+1F53E-1F54A, U+1F54F-1F5FA, U+1F610, U+1F650-1F67F, U+1F687, U+1F68D, U+1F691, U+1F694, U+1F698, U+1F6AD, U+1F6B2, U+1F6B9-1F6BA, U+1F6BC, U+1F6C6-1F6CF, U+1F6D3-1F6D7, U+1F6E0-1F6EA, U+1F6F0-1F6F3, U+1F6F7-1F6FC, U+1F700-1F7FF, U+1F800-1F80B, U+1F810-1F847, U+1F850-1F859, U+1F860-1F887, U+1F890-1F8AD, U+1F8B0-1F8BB, U+1F8C0-1F8C1, U+1F900-1F90B, U+1F93B, U+1F946, U+1F984, U+1F996, U+1F9E9, U+1FA00-1FA6F, U+1FA70-1FA7C, U+1FA80-1FA89, U+1FA8F-1FAC6, U+1FACE-1FADC, U+1FADF-1FAE9, U+1FAF0-1FAF8, U+1FB00-1FBFF;
54
+ }
55
+ /* vietnamese */
56
+ @font-face {
57
+ font-family: 'Roboto';
58
+ font-style: italic;
59
+ font-weight: 300;
60
+ font-stretch: 100%;
61
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCXkaSTbQWt4N.woff2) format('woff2');
62
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
63
+ }
64
+ /* latin-ext */
65
+ @font-face {
66
+ font-family: 'Roboto';
67
+ font-style: italic;
68
+ font-weight: 300;
69
+ font-stretch: 100%;
70
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCHkaSTbQWt4N.woff2) format('woff2');
71
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
72
+ }
73
+ /* latin */
74
+ @font-face {
75
+ font-family: 'Roboto';
76
+ font-style: italic;
77
+ font-weight: 300;
78
+ font-stretch: 100%;
79
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkBnkaSTbQWg.woff2) format('woff2');
80
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
81
+ }
82
+ /* cyrillic-ext */
83
+ @font-face {
84
+ font-family: 'Roboto';
85
+ font-style: italic;
86
+ font-weight: 400;
87
+ font-stretch: 100%;
88
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkC3kaSTbQWt4N.woff2) format('woff2');
89
+ unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
90
+ }
91
+ /* cyrillic */
92
+ @font-face {
93
+ font-family: 'Roboto';
94
+ font-style: italic;
95
+ font-weight: 400;
96
+ font-stretch: 100%;
97
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkAnkaSTbQWt4N.woff2) format('woff2');
98
+ unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
99
+ }
100
+ /* greek-ext */
101
+ @font-face {
102
+ font-family: 'Roboto';
103
+ font-style: italic;
104
+ font-weight: 400;
105
+ font-stretch: 100%;
106
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCnkaSTbQWt4N.woff2) format('woff2');
107
+ unicode-range: U+1F00-1FFF;
108
+ }
109
+ /* greek */
110
+ @font-face {
111
+ font-family: 'Roboto';
112
+ font-style: italic;
113
+ font-weight: 400;
114
+ font-stretch: 100%;
115
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkBXkaSTbQWt4N.woff2) format('woff2');
116
+ unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
117
+ }
118
+ /* math */
119
+ @font-face {
120
+ font-family: 'Roboto';
121
+ font-style: italic;
122
+ font-weight: 400;
123
+ font-stretch: 100%;
124
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkenkaSTbQWt4N.woff2) format('woff2');
125
+ unicode-range: U+0302-0303, U+0305, U+0307-0308, U+0310, U+0312, U+0315, U+031A, U+0326-0327, U+032C, U+032F-0330, U+0332-0333, U+0338, U+033A, U+0346, U+034D, U+0391-03A1, U+03A3-03A9, U+03B1-03C9, U+03D1, U+03D5-03D6, U+03F0-03F1, U+03F4-03F5, U+2016-2017, U+2034-2038, U+203C, U+2040, U+2043, U+2047, U+2050, U+2057, U+205F, U+2070-2071, U+2074-208E, U+2090-209C, U+20D0-20DC, U+20E1, U+20E5-20EF, U+2100-2112, U+2114-2115, U+2117-2121, U+2123-214F, U+2190, U+2192, U+2194-21AE, U+21B0-21E5, U+21F1-21F2, U+21F4-2211, U+2213-2214, U+2216-22FF, U+2308-230B, U+2310, U+2319, U+231C-2321, U+2336-237A, U+237C, U+2395, U+239B-23B7, U+23D0, U+23DC-23E1, U+2474-2475, U+25AF, U+25B3, U+25B7, U+25BD, U+25C1, U+25CA, U+25CC, U+25FB, U+266D-266F, U+27C0-27FF, U+2900-2AFF, U+2B0E-2B11, U+2B30-2B4C, U+2BFE, U+3030, U+FF5B, U+FF5D, U+1D400-1D7FF, U+1EE00-1EEFF;
126
+ }
127
+ /* symbols */
128
+ @font-face {
129
+ font-family: 'Roboto';
130
+ font-style: italic;
131
+ font-weight: 400;
132
+ font-stretch: 100%;
133
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkaHkaSTbQWt4N.woff2) format('woff2');
134
+ unicode-range: U+0001-000C, U+000E-001F, U+007F-009F, U+20DD-20E0, U+20E2-20E4, U+2150-218F, U+2190, U+2192, U+2194-2199, U+21AF, U+21E6-21F0, U+21F3, U+2218-2219, U+2299, U+22C4-22C6, U+2300-243F, U+2440-244A, U+2460-24FF, U+25A0-27BF, U+2800-28FF, U+2921-2922, U+2981, U+29BF, U+29EB, U+2B00-2BFF, U+4DC0-4DFF, U+FFF9-FFFB, U+10140-1018E, U+10190-1019C, U+101A0, U+101D0-101FD, U+102E0-102FB, U+10E60-10E7E, U+1D2C0-1D2D3, U+1D2E0-1D37F, U+1F000-1F0FF, U+1F100-1F1AD, U+1F1E6-1F1FF, U+1F30D-1F30F, U+1F315, U+1F31C, U+1F31E, U+1F320-1F32C, U+1F336, U+1F378, U+1F37D, U+1F382, U+1F393-1F39F, U+1F3A7-1F3A8, U+1F3AC-1F3AF, U+1F3C2, U+1F3C4-1F3C6, U+1F3CA-1F3CE, U+1F3D4-1F3E0, U+1F3ED, U+1F3F1-1F3F3, U+1F3F5-1F3F7, U+1F408, U+1F415, U+1F41F, U+1F426, U+1F43F, U+1F441-1F442, U+1F444, U+1F446-1F449, U+1F44C-1F44E, U+1F453, U+1F46A, U+1F47D, U+1F4A3, U+1F4B0, U+1F4B3, U+1F4B9, U+1F4BB, U+1F4BF, U+1F4C8-1F4CB, U+1F4D6, U+1F4DA, U+1F4DF, U+1F4E3-1F4E6, U+1F4EA-1F4ED, U+1F4F7, U+1F4F9-1F4FB, U+1F4FD-1F4FE, U+1F503, U+1F507-1F50B, U+1F50D, U+1F512-1F513, U+1F53E-1F54A, U+1F54F-1F5FA, U+1F610, U+1F650-1F67F, U+1F687, U+1F68D, U+1F691, U+1F694, U+1F698, U+1F6AD, U+1F6B2, U+1F6B9-1F6BA, U+1F6BC, U+1F6C6-1F6CF, U+1F6D3-1F6D7, U+1F6E0-1F6EA, U+1F6F0-1F6F3, U+1F6F7-1F6FC, U+1F700-1F7FF, U+1F800-1F80B, U+1F810-1F847, U+1F850-1F859, U+1F860-1F887, U+1F890-1F8AD, U+1F8B0-1F8BB, U+1F8C0-1F8C1, U+1F900-1F90B, U+1F93B, U+1F946, U+1F984, U+1F996, U+1F9E9, U+1FA00-1FA6F, U+1FA70-1FA7C, U+1FA80-1FA89, U+1FA8F-1FAC6, U+1FACE-1FADC, U+1FADF-1FAE9, U+1FAF0-1FAF8, U+1FB00-1FBFF;
135
+ }
136
+ /* vietnamese */
137
+ @font-face {
138
+ font-family: 'Roboto';
139
+ font-style: italic;
140
+ font-weight: 400;
141
+ font-stretch: 100%;
142
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCXkaSTbQWt4N.woff2) format('woff2');
143
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
144
+ }
145
+ /* latin-ext */
146
+ @font-face {
147
+ font-family: 'Roboto';
148
+ font-style: italic;
149
+ font-weight: 400;
150
+ font-stretch: 100%;
151
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCHkaSTbQWt4N.woff2) format('woff2');
152
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
153
+ }
154
+ /* latin */
155
+ @font-face {
156
+ font-family: 'Roboto';
157
+ font-style: italic;
158
+ font-weight: 400;
159
+ font-stretch: 100%;
160
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkBnkaSTbQWg.woff2) format('woff2');
161
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
162
+ }
163
+ /* cyrillic-ext */
164
+ @font-face {
165
+ font-family: 'Roboto';
166
+ font-style: italic;
167
+ font-weight: 500;
168
+ font-stretch: 100%;
169
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkC3kaSTbQWt4N.woff2) format('woff2');
170
+ unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
171
+ }
172
+ /* cyrillic */
173
+ @font-face {
174
+ font-family: 'Roboto';
175
+ font-style: italic;
176
+ font-weight: 500;
177
+ font-stretch: 100%;
178
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkAnkaSTbQWt4N.woff2) format('woff2');
179
+ unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
180
+ }
181
+ /* greek-ext */
182
+ @font-face {
183
+ font-family: 'Roboto';
184
+ font-style: italic;
185
+ font-weight: 500;
186
+ font-stretch: 100%;
187
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCnkaSTbQWt4N.woff2) format('woff2');
188
+ unicode-range: U+1F00-1FFF;
189
+ }
190
+ /* greek */
191
+ @font-face {
192
+ font-family: 'Roboto';
193
+ font-style: italic;
194
+ font-weight: 500;
195
+ font-stretch: 100%;
196
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkBXkaSTbQWt4N.woff2) format('woff2');
197
+ unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
198
+ }
199
+ /* math */
200
+ @font-face {
201
+ font-family: 'Roboto';
202
+ font-style: italic;
203
+ font-weight: 500;
204
+ font-stretch: 100%;
205
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkenkaSTbQWt4N.woff2) format('woff2');
206
+ unicode-range: U+0302-0303, U+0305, U+0307-0308, U+0310, U+0312, U+0315, U+031A, U+0326-0327, U+032C, U+032F-0330, U+0332-0333, U+0338, U+033A, U+0346, U+034D, U+0391-03A1, U+03A3-03A9, U+03B1-03C9, U+03D1, U+03D5-03D6, U+03F0-03F1, U+03F4-03F5, U+2016-2017, U+2034-2038, U+203C, U+2040, U+2043, U+2047, U+2050, U+2057, U+205F, U+2070-2071, U+2074-208E, U+2090-209C, U+20D0-20DC, U+20E1, U+20E5-20EF, U+2100-2112, U+2114-2115, U+2117-2121, U+2123-214F, U+2190, U+2192, U+2194-21AE, U+21B0-21E5, U+21F1-21F2, U+21F4-2211, U+2213-2214, U+2216-22FF, U+2308-230B, U+2310, U+2319, U+231C-2321, U+2336-237A, U+237C, U+2395, U+239B-23B7, U+23D0, U+23DC-23E1, U+2474-2475, U+25AF, U+25B3, U+25B7, U+25BD, U+25C1, U+25CA, U+25CC, U+25FB, U+266D-266F, U+27C0-27FF, U+2900-2AFF, U+2B0E-2B11, U+2B30-2B4C, U+2BFE, U+3030, U+FF5B, U+FF5D, U+1D400-1D7FF, U+1EE00-1EEFF;
207
+ }
208
+ /* symbols */
209
+ @font-face {
210
+ font-family: 'Roboto';
211
+ font-style: italic;
212
+ font-weight: 500;
213
+ font-stretch: 100%;
214
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkaHkaSTbQWt4N.woff2) format('woff2');
215
+ unicode-range: U+0001-000C, U+000E-001F, U+007F-009F, U+20DD-20E0, U+20E2-20E4, U+2150-218F, U+2190, U+2192, U+2194-2199, U+21AF, U+21E6-21F0, U+21F3, U+2218-2219, U+2299, U+22C4-22C6, U+2300-243F, U+2440-244A, U+2460-24FF, U+25A0-27BF, U+2800-28FF, U+2921-2922, U+2981, U+29BF, U+29EB, U+2B00-2BFF, U+4DC0-4DFF, U+FFF9-FFFB, U+10140-1018E, U+10190-1019C, U+101A0, U+101D0-101FD, U+102E0-102FB, U+10E60-10E7E, U+1D2C0-1D2D3, U+1D2E0-1D37F, U+1F000-1F0FF, U+1F100-1F1AD, U+1F1E6-1F1FF, U+1F30D-1F30F, U+1F315, U+1F31C, U+1F31E, U+1F320-1F32C, U+1F336, U+1F378, U+1F37D, U+1F382, U+1F393-1F39F, U+1F3A7-1F3A8, U+1F3AC-1F3AF, U+1F3C2, U+1F3C4-1F3C6, U+1F3CA-1F3CE, U+1F3D4-1F3E0, U+1F3ED, U+1F3F1-1F3F3, U+1F3F5-1F3F7, U+1F408, U+1F415, U+1F41F, U+1F426, U+1F43F, U+1F441-1F442, U+1F444, U+1F446-1F449, U+1F44C-1F44E, U+1F453, U+1F46A, U+1F47D, U+1F4A3, U+1F4B0, U+1F4B3, U+1F4B9, U+1F4BB, U+1F4BF, U+1F4C8-1F4CB, U+1F4D6, U+1F4DA, U+1F4DF, U+1F4E3-1F4E6, U+1F4EA-1F4ED, U+1F4F7, U+1F4F9-1F4FB, U+1F4FD-1F4FE, U+1F503, U+1F507-1F50B, U+1F50D, U+1F512-1F513, U+1F53E-1F54A, U+1F54F-1F5FA, U+1F610, U+1F650-1F67F, U+1F687, U+1F68D, U+1F691, U+1F694, U+1F698, U+1F6AD, U+1F6B2, U+1F6B9-1F6BA, U+1F6BC, U+1F6C6-1F6CF, U+1F6D3-1F6D7, U+1F6E0-1F6EA, U+1F6F0-1F6F3, U+1F6F7-1F6FC, U+1F700-1F7FF, U+1F800-1F80B, U+1F810-1F847, U+1F850-1F859, U+1F860-1F887, U+1F890-1F8AD, U+1F8B0-1F8BB, U+1F8C0-1F8C1, U+1F900-1F90B, U+1F93B, U+1F946, U+1F984, U+1F996, U+1F9E9, U+1FA00-1FA6F, U+1FA70-1FA7C, U+1FA80-1FA89, U+1FA8F-1FAC6, U+1FACE-1FADC, U+1FADF-1FAE9, U+1FAF0-1FAF8, U+1FB00-1FBFF;
216
+ }
217
+ /* vietnamese */
218
+ @font-face {
219
+ font-family: 'Roboto';
220
+ font-style: italic;
221
+ font-weight: 500;
222
+ font-stretch: 100%;
223
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCXkaSTbQWt4N.woff2) format('woff2');
224
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
225
+ }
226
+ /* latin-ext */
227
+ @font-face {
228
+ font-family: 'Roboto';
229
+ font-style: italic;
230
+ font-weight: 500;
231
+ font-stretch: 100%;
232
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCHkaSTbQWt4N.woff2) format('woff2');
233
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
234
+ }
235
+ /* latin */
236
+ @font-face {
237
+ font-family: 'Roboto';
238
+ font-style: italic;
239
+ font-weight: 500;
240
+ font-stretch: 100%;
241
+ src: url(/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkBnkaSTbQWg.woff2) format('woff2');
242
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
243
+ }
244
+ /* cyrillic-ext */
245
+ @font-face {
246
+ font-family: 'Roboto';
247
+ font-style: normal;
248
+ font-weight: 300;
249
+ font-stretch: 100%;
250
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3GUBHMdazTgWw.woff2) format('woff2');
251
+ unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
252
+ }
253
+ /* cyrillic */
254
+ @font-face {
255
+ font-family: 'Roboto';
256
+ font-style: normal;
257
+ font-weight: 300;
258
+ font-stretch: 100%;
259
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3iUBHMdazTgWw.woff2) format('woff2');
260
+ unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
261
+ }
262
+ /* greek-ext */
263
+ @font-face {
264
+ font-family: 'Roboto';
265
+ font-style: normal;
266
+ font-weight: 300;
267
+ font-stretch: 100%;
268
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3CUBHMdazTgWw.woff2) format('woff2');
269
+ unicode-range: U+1F00-1FFF;
270
+ }
271
+ /* greek */
272
+ @font-face {
273
+ font-family: 'Roboto';
274
+ font-style: normal;
275
+ font-weight: 300;
276
+ font-stretch: 100%;
277
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3-UBHMdazTgWw.woff2) format('woff2');
278
+ unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
279
+ }
280
+ /* math */
281
+ @font-face {
282
+ font-family: 'Roboto';
283
+ font-style: normal;
284
+ font-weight: 300;
285
+ font-stretch: 100%;
286
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMawCUBHMdazTgWw.woff2) format('woff2');
287
+ unicode-range: U+0302-0303, U+0305, U+0307-0308, U+0310, U+0312, U+0315, U+031A, U+0326-0327, U+032C, U+032F-0330, U+0332-0333, U+0338, U+033A, U+0346, U+034D, U+0391-03A1, U+03A3-03A9, U+03B1-03C9, U+03D1, U+03D5-03D6, U+03F0-03F1, U+03F4-03F5, U+2016-2017, U+2034-2038, U+203C, U+2040, U+2043, U+2047, U+2050, U+2057, U+205F, U+2070-2071, U+2074-208E, U+2090-209C, U+20D0-20DC, U+20E1, U+20E5-20EF, U+2100-2112, U+2114-2115, U+2117-2121, U+2123-214F, U+2190, U+2192, U+2194-21AE, U+21B0-21E5, U+21F1-21F2, U+21F4-2211, U+2213-2214, U+2216-22FF, U+2308-230B, U+2310, U+2319, U+231C-2321, U+2336-237A, U+237C, U+2395, U+239B-23B7, U+23D0, U+23DC-23E1, U+2474-2475, U+25AF, U+25B3, U+25B7, U+25BD, U+25C1, U+25CA, U+25CC, U+25FB, U+266D-266F, U+27C0-27FF, U+2900-2AFF, U+2B0E-2B11, U+2B30-2B4C, U+2BFE, U+3030, U+FF5B, U+FF5D, U+1D400-1D7FF, U+1EE00-1EEFF;
288
+ }
289
+ /* symbols */
290
+ @font-face {
291
+ font-family: 'Roboto';
292
+ font-style: normal;
293
+ font-weight: 300;
294
+ font-stretch: 100%;
295
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMaxKUBHMdazTgWw.woff2) format('woff2');
296
+ unicode-range: U+0001-000C, U+000E-001F, U+007F-009F, U+20DD-20E0, U+20E2-20E4, U+2150-218F, U+2190, U+2192, U+2194-2199, U+21AF, U+21E6-21F0, U+21F3, U+2218-2219, U+2299, U+22C4-22C6, U+2300-243F, U+2440-244A, U+2460-24FF, U+25A0-27BF, U+2800-28FF, U+2921-2922, U+2981, U+29BF, U+29EB, U+2B00-2BFF, U+4DC0-4DFF, U+FFF9-FFFB, U+10140-1018E, U+10190-1019C, U+101A0, U+101D0-101FD, U+102E0-102FB, U+10E60-10E7E, U+1D2C0-1D2D3, U+1D2E0-1D37F, U+1F000-1F0FF, U+1F100-1F1AD, U+1F1E6-1F1FF, U+1F30D-1F30F, U+1F315, U+1F31C, U+1F31E, U+1F320-1F32C, U+1F336, U+1F378, U+1F37D, U+1F382, U+1F393-1F39F, U+1F3A7-1F3A8, U+1F3AC-1F3AF, U+1F3C2, U+1F3C4-1F3C6, U+1F3CA-1F3CE, U+1F3D4-1F3E0, U+1F3ED, U+1F3F1-1F3F3, U+1F3F5-1F3F7, U+1F408, U+1F415, U+1F41F, U+1F426, U+1F43F, U+1F441-1F442, U+1F444, U+1F446-1F449, U+1F44C-1F44E, U+1F453, U+1F46A, U+1F47D, U+1F4A3, U+1F4B0, U+1F4B3, U+1F4B9, U+1F4BB, U+1F4BF, U+1F4C8-1F4CB, U+1F4D6, U+1F4DA, U+1F4DF, U+1F4E3-1F4E6, U+1F4EA-1F4ED, U+1F4F7, U+1F4F9-1F4FB, U+1F4FD-1F4FE, U+1F503, U+1F507-1F50B, U+1F50D, U+1F512-1F513, U+1F53E-1F54A, U+1F54F-1F5FA, U+1F610, U+1F650-1F67F, U+1F687, U+1F68D, U+1F691, U+1F694, U+1F698, U+1F6AD, U+1F6B2, U+1F6B9-1F6BA, U+1F6BC, U+1F6C6-1F6CF, U+1F6D3-1F6D7, U+1F6E0-1F6EA, U+1F6F0-1F6F3, U+1F6F7-1F6FC, U+1F700-1F7FF, U+1F800-1F80B, U+1F810-1F847, U+1F850-1F859, U+1F860-1F887, U+1F890-1F8AD, U+1F8B0-1F8BB, U+1F8C0-1F8C1, U+1F900-1F90B, U+1F93B, U+1F946, U+1F984, U+1F996, U+1F9E9, U+1FA00-1FA6F, U+1FA70-1FA7C, U+1FA80-1FA89, U+1FA8F-1FAC6, U+1FACE-1FADC, U+1FADF-1FAE9, U+1FAF0-1FAF8, U+1FB00-1FBFF;
297
+ }
298
+ /* vietnamese */
299
+ @font-face {
300
+ font-family: 'Roboto';
301
+ font-style: normal;
302
+ font-weight: 300;
303
+ font-stretch: 100%;
304
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3OUBHMdazTgWw.woff2) format('woff2');
305
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
306
+ }
307
+ /* latin-ext */
308
+ @font-face {
309
+ font-family: 'Roboto';
310
+ font-style: normal;
311
+ font-weight: 300;
312
+ font-stretch: 100%;
313
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3KUBHMdazTgWw.woff2) format('woff2');
314
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
315
+ }
316
+ /* latin */
317
+ @font-face {
318
+ font-family: 'Roboto';
319
+ font-style: normal;
320
+ font-weight: 300;
321
+ font-stretch: 100%;
322
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3yUBHMdazQ.woff2) format('woff2');
323
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
324
+ }
325
+ /* cyrillic-ext */
326
+ @font-face {
327
+ font-family: 'Roboto';
328
+ font-style: normal;
329
+ font-weight: 400;
330
+ font-stretch: 100%;
331
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3GUBHMdazTgWw.woff2) format('woff2');
332
+ unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
333
+ }
334
+ /* cyrillic */
335
+ @font-face {
336
+ font-family: 'Roboto';
337
+ font-style: normal;
338
+ font-weight: 400;
339
+ font-stretch: 100%;
340
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3iUBHMdazTgWw.woff2) format('woff2');
341
+ unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
342
+ }
343
+ /* greek-ext */
344
+ @font-face {
345
+ font-family: 'Roboto';
346
+ font-style: normal;
347
+ font-weight: 400;
348
+ font-stretch: 100%;
349
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3CUBHMdazTgWw.woff2) format('woff2');
350
+ unicode-range: U+1F00-1FFF;
351
+ }
352
+ /* greek */
353
+ @font-face {
354
+ font-family: 'Roboto';
355
+ font-style: normal;
356
+ font-weight: 400;
357
+ font-stretch: 100%;
358
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3-UBHMdazTgWw.woff2) format('woff2');
359
+ unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
360
+ }
361
+ /* math */
362
+ @font-face {
363
+ font-family: 'Roboto';
364
+ font-style: normal;
365
+ font-weight: 400;
366
+ font-stretch: 100%;
367
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMawCUBHMdazTgWw.woff2) format('woff2');
368
+ unicode-range: U+0302-0303, U+0305, U+0307-0308, U+0310, U+0312, U+0315, U+031A, U+0326-0327, U+032C, U+032F-0330, U+0332-0333, U+0338, U+033A, U+0346, U+034D, U+0391-03A1, U+03A3-03A9, U+03B1-03C9, U+03D1, U+03D5-03D6, U+03F0-03F1, U+03F4-03F5, U+2016-2017, U+2034-2038, U+203C, U+2040, U+2043, U+2047, U+2050, U+2057, U+205F, U+2070-2071, U+2074-208E, U+2090-209C, U+20D0-20DC, U+20E1, U+20E5-20EF, U+2100-2112, U+2114-2115, U+2117-2121, U+2123-214F, U+2190, U+2192, U+2194-21AE, U+21B0-21E5, U+21F1-21F2, U+21F4-2211, U+2213-2214, U+2216-22FF, U+2308-230B, U+2310, U+2319, U+231C-2321, U+2336-237A, U+237C, U+2395, U+239B-23B7, U+23D0, U+23DC-23E1, U+2474-2475, U+25AF, U+25B3, U+25B7, U+25BD, U+25C1, U+25CA, U+25CC, U+25FB, U+266D-266F, U+27C0-27FF, U+2900-2AFF, U+2B0E-2B11, U+2B30-2B4C, U+2BFE, U+3030, U+FF5B, U+FF5D, U+1D400-1D7FF, U+1EE00-1EEFF;
369
+ }
370
+ /* symbols */
371
+ @font-face {
372
+ font-family: 'Roboto';
373
+ font-style: normal;
374
+ font-weight: 400;
375
+ font-stretch: 100%;
376
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMaxKUBHMdazTgWw.woff2) format('woff2');
377
+ unicode-range: U+0001-000C, U+000E-001F, U+007F-009F, U+20DD-20E0, U+20E2-20E4, U+2150-218F, U+2190, U+2192, U+2194-2199, U+21AF, U+21E6-21F0, U+21F3, U+2218-2219, U+2299, U+22C4-22C6, U+2300-243F, U+2440-244A, U+2460-24FF, U+25A0-27BF, U+2800-28FF, U+2921-2922, U+2981, U+29BF, U+29EB, U+2B00-2BFF, U+4DC0-4DFF, U+FFF9-FFFB, U+10140-1018E, U+10190-1019C, U+101A0, U+101D0-101FD, U+102E0-102FB, U+10E60-10E7E, U+1D2C0-1D2D3, U+1D2E0-1D37F, U+1F000-1F0FF, U+1F100-1F1AD, U+1F1E6-1F1FF, U+1F30D-1F30F, U+1F315, U+1F31C, U+1F31E, U+1F320-1F32C, U+1F336, U+1F378, U+1F37D, U+1F382, U+1F393-1F39F, U+1F3A7-1F3A8, U+1F3AC-1F3AF, U+1F3C2, U+1F3C4-1F3C6, U+1F3CA-1F3CE, U+1F3D4-1F3E0, U+1F3ED, U+1F3F1-1F3F3, U+1F3F5-1F3F7, U+1F408, U+1F415, U+1F41F, U+1F426, U+1F43F, U+1F441-1F442, U+1F444, U+1F446-1F449, U+1F44C-1F44E, U+1F453, U+1F46A, U+1F47D, U+1F4A3, U+1F4B0, U+1F4B3, U+1F4B9, U+1F4BB, U+1F4BF, U+1F4C8-1F4CB, U+1F4D6, U+1F4DA, U+1F4DF, U+1F4E3-1F4E6, U+1F4EA-1F4ED, U+1F4F7, U+1F4F9-1F4FB, U+1F4FD-1F4FE, U+1F503, U+1F507-1F50B, U+1F50D, U+1F512-1F513, U+1F53E-1F54A, U+1F54F-1F5FA, U+1F610, U+1F650-1F67F, U+1F687, U+1F68D, U+1F691, U+1F694, U+1F698, U+1F6AD, U+1F6B2, U+1F6B9-1F6BA, U+1F6BC, U+1F6C6-1F6CF, U+1F6D3-1F6D7, U+1F6E0-1F6EA, U+1F6F0-1F6F3, U+1F6F7-1F6FC, U+1F700-1F7FF, U+1F800-1F80B, U+1F810-1F847, U+1F850-1F859, U+1F860-1F887, U+1F890-1F8AD, U+1F8B0-1F8BB, U+1F8C0-1F8C1, U+1F900-1F90B, U+1F93B, U+1F946, U+1F984, U+1F996, U+1F9E9, U+1FA00-1FA6F, U+1FA70-1FA7C, U+1FA80-1FA89, U+1FA8F-1FAC6, U+1FACE-1FADC, U+1FADF-1FAE9, U+1FAF0-1FAF8, U+1FB00-1FBFF;
378
+ }
379
+ /* vietnamese */
380
+ @font-face {
381
+ font-family: 'Roboto';
382
+ font-style: normal;
383
+ font-weight: 400;
384
+ font-stretch: 100%;
385
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3OUBHMdazTgWw.woff2) format('woff2');
386
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
387
+ }
388
+ /* latin-ext */
389
+ @font-face {
390
+ font-family: 'Roboto';
391
+ font-style: normal;
392
+ font-weight: 400;
393
+ font-stretch: 100%;
394
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3KUBHMdazTgWw.woff2) format('woff2');
395
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
396
+ }
397
+ /* latin */
398
+ @font-face {
399
+ font-family: 'Roboto';
400
+ font-style: normal;
401
+ font-weight: 400;
402
+ font-stretch: 100%;
403
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3yUBHMdazQ.woff2) format('woff2');
404
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
405
+ }
406
+ /* cyrillic-ext */
407
+ @font-face {
408
+ font-family: 'Roboto';
409
+ font-style: normal;
410
+ font-weight: 500;
411
+ font-stretch: 100%;
412
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3GUBHMdazTgWw.woff2) format('woff2');
413
+ unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
414
+ }
415
+ /* cyrillic */
416
+ @font-face {
417
+ font-family: 'Roboto';
418
+ font-style: normal;
419
+ font-weight: 500;
420
+ font-stretch: 100%;
421
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3iUBHMdazTgWw.woff2) format('woff2');
422
+ unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
423
+ }
424
+ /* greek-ext */
425
+ @font-face {
426
+ font-family: 'Roboto';
427
+ font-style: normal;
428
+ font-weight: 500;
429
+ font-stretch: 100%;
430
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3CUBHMdazTgWw.woff2) format('woff2');
431
+ unicode-range: U+1F00-1FFF;
432
+ }
433
+ /* greek */
434
+ @font-face {
435
+ font-family: 'Roboto';
436
+ font-style: normal;
437
+ font-weight: 500;
438
+ font-stretch: 100%;
439
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3-UBHMdazTgWw.woff2) format('woff2');
440
+ unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
441
+ }
442
+ /* math */
443
+ @font-face {
444
+ font-family: 'Roboto';
445
+ font-style: normal;
446
+ font-weight: 500;
447
+ font-stretch: 100%;
448
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMawCUBHMdazTgWw.woff2) format('woff2');
449
+ unicode-range: U+0302-0303, U+0305, U+0307-0308, U+0310, U+0312, U+0315, U+031A, U+0326-0327, U+032C, U+032F-0330, U+0332-0333, U+0338, U+033A, U+0346, U+034D, U+0391-03A1, U+03A3-03A9, U+03B1-03C9, U+03D1, U+03D5-03D6, U+03F0-03F1, U+03F4-03F5, U+2016-2017, U+2034-2038, U+203C, U+2040, U+2043, U+2047, U+2050, U+2057, U+205F, U+2070-2071, U+2074-208E, U+2090-209C, U+20D0-20DC, U+20E1, U+20E5-20EF, U+2100-2112, U+2114-2115, U+2117-2121, U+2123-214F, U+2190, U+2192, U+2194-21AE, U+21B0-21E5, U+21F1-21F2, U+21F4-2211, U+2213-2214, U+2216-22FF, U+2308-230B, U+2310, U+2319, U+231C-2321, U+2336-237A, U+237C, U+2395, U+239B-23B7, U+23D0, U+23DC-23E1, U+2474-2475, U+25AF, U+25B3, U+25B7, U+25BD, U+25C1, U+25CA, U+25CC, U+25FB, U+266D-266F, U+27C0-27FF, U+2900-2AFF, U+2B0E-2B11, U+2B30-2B4C, U+2BFE, U+3030, U+FF5B, U+FF5D, U+1D400-1D7FF, U+1EE00-1EEFF;
450
+ }
451
+ /* symbols */
452
+ @font-face {
453
+ font-family: 'Roboto';
454
+ font-style: normal;
455
+ font-weight: 500;
456
+ font-stretch: 100%;
457
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMaxKUBHMdazTgWw.woff2) format('woff2');
458
+ unicode-range: U+0001-000C, U+000E-001F, U+007F-009F, U+20DD-20E0, U+20E2-20E4, U+2150-218F, U+2190, U+2192, U+2194-2199, U+21AF, U+21E6-21F0, U+21F3, U+2218-2219, U+2299, U+22C4-22C6, U+2300-243F, U+2440-244A, U+2460-24FF, U+25A0-27BF, U+2800-28FF, U+2921-2922, U+2981, U+29BF, U+29EB, U+2B00-2BFF, U+4DC0-4DFF, U+FFF9-FFFB, U+10140-1018E, U+10190-1019C, U+101A0, U+101D0-101FD, U+102E0-102FB, U+10E60-10E7E, U+1D2C0-1D2D3, U+1D2E0-1D37F, U+1F000-1F0FF, U+1F100-1F1AD, U+1F1E6-1F1FF, U+1F30D-1F30F, U+1F315, U+1F31C, U+1F31E, U+1F320-1F32C, U+1F336, U+1F378, U+1F37D, U+1F382, U+1F393-1F39F, U+1F3A7-1F3A8, U+1F3AC-1F3AF, U+1F3C2, U+1F3C4-1F3C6, U+1F3CA-1F3CE, U+1F3D4-1F3E0, U+1F3ED, U+1F3F1-1F3F3, U+1F3F5-1F3F7, U+1F408, U+1F415, U+1F41F, U+1F426, U+1F43F, U+1F441-1F442, U+1F444, U+1F446-1F449, U+1F44C-1F44E, U+1F453, U+1F46A, U+1F47D, U+1F4A3, U+1F4B0, U+1F4B3, U+1F4B9, U+1F4BB, U+1F4BF, U+1F4C8-1F4CB, U+1F4D6, U+1F4DA, U+1F4DF, U+1F4E3-1F4E6, U+1F4EA-1F4ED, U+1F4F7, U+1F4F9-1F4FB, U+1F4FD-1F4FE, U+1F503, U+1F507-1F50B, U+1F50D, U+1F512-1F513, U+1F53E-1F54A, U+1F54F-1F5FA, U+1F610, U+1F650-1F67F, U+1F687, U+1F68D, U+1F691, U+1F694, U+1F698, U+1F6AD, U+1F6B2, U+1F6B9-1F6BA, U+1F6BC, U+1F6C6-1F6CF, U+1F6D3-1F6D7, U+1F6E0-1F6EA, U+1F6F0-1F6F3, U+1F6F7-1F6FC, U+1F700-1F7FF, U+1F800-1F80B, U+1F810-1F847, U+1F850-1F859, U+1F860-1F887, U+1F890-1F8AD, U+1F8B0-1F8BB, U+1F8C0-1F8C1, U+1F900-1F90B, U+1F93B, U+1F946, U+1F984, U+1F996, U+1F9E9, U+1FA00-1FA6F, U+1FA70-1FA7C, U+1FA80-1FA89, U+1FA8F-1FAC6, U+1FACE-1FADC, U+1FADF-1FAE9, U+1FAF0-1FAF8, U+1FB00-1FBFF;
459
+ }
460
+ /* vietnamese */
461
+ @font-face {
462
+ font-family: 'Roboto';
463
+ font-style: normal;
464
+ font-weight: 500;
465
+ font-stretch: 100%;
466
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3OUBHMdazTgWw.woff2) format('woff2');
467
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
468
+ }
469
+ /* latin-ext */
470
+ @font-face {
471
+ font-family: 'Roboto';
472
+ font-style: normal;
473
+ font-weight: 500;
474
+ font-stretch: 100%;
475
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3KUBHMdazTgWw.woff2) format('woff2');
476
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
477
+ }
478
+ /* latin */
479
+ @font-face {
480
+ font-family: 'Roboto';
481
+ font-style: normal;
482
+ font-weight: 500;
483
+ font-stretch: 100%;
484
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3yUBHMdazQ.woff2) format('woff2');
485
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
486
+ }
487
+ /* cyrillic-ext */
488
+ @font-face {
489
+ font-family: 'Roboto';
490
+ font-style: normal;
491
+ font-weight: 700;
492
+ font-stretch: 100%;
493
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3GUBHMdazTgWw.woff2) format('woff2');
494
+ unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
495
+ }
496
+ /* cyrillic */
497
+ @font-face {
498
+ font-family: 'Roboto';
499
+ font-style: normal;
500
+ font-weight: 700;
501
+ font-stretch: 100%;
502
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3iUBHMdazTgWw.woff2) format('woff2');
503
+ unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
504
+ }
505
+ /* greek-ext */
506
+ @font-face {
507
+ font-family: 'Roboto';
508
+ font-style: normal;
509
+ font-weight: 700;
510
+ font-stretch: 100%;
511
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3CUBHMdazTgWw.woff2) format('woff2');
512
+ unicode-range: U+1F00-1FFF;
513
+ }
514
+ /* greek */
515
+ @font-face {
516
+ font-family: 'Roboto';
517
+ font-style: normal;
518
+ font-weight: 700;
519
+ font-stretch: 100%;
520
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3-UBHMdazTgWw.woff2) format('woff2');
521
+ unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
522
+ }
523
+ /* math */
524
+ @font-face {
525
+ font-family: 'Roboto';
526
+ font-style: normal;
527
+ font-weight: 700;
528
+ font-stretch: 100%;
529
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMawCUBHMdazTgWw.woff2) format('woff2');
530
+ unicode-range: U+0302-0303, U+0305, U+0307-0308, U+0310, U+0312, U+0315, U+031A, U+0326-0327, U+032C, U+032F-0330, U+0332-0333, U+0338, U+033A, U+0346, U+034D, U+0391-03A1, U+03A3-03A9, U+03B1-03C9, U+03D1, U+03D5-03D6, U+03F0-03F1, U+03F4-03F5, U+2016-2017, U+2034-2038, U+203C, U+2040, U+2043, U+2047, U+2050, U+2057, U+205F, U+2070-2071, U+2074-208E, U+2090-209C, U+20D0-20DC, U+20E1, U+20E5-20EF, U+2100-2112, U+2114-2115, U+2117-2121, U+2123-214F, U+2190, U+2192, U+2194-21AE, U+21B0-21E5, U+21F1-21F2, U+21F4-2211, U+2213-2214, U+2216-22FF, U+2308-230B, U+2310, U+2319, U+231C-2321, U+2336-237A, U+237C, U+2395, U+239B-23B7, U+23D0, U+23DC-23E1, U+2474-2475, U+25AF, U+25B3, U+25B7, U+25BD, U+25C1, U+25CA, U+25CC, U+25FB, U+266D-266F, U+27C0-27FF, U+2900-2AFF, U+2B0E-2B11, U+2B30-2B4C, U+2BFE, U+3030, U+FF5B, U+FF5D, U+1D400-1D7FF, U+1EE00-1EEFF;
531
+ }
532
+ /* symbols */
533
+ @font-face {
534
+ font-family: 'Roboto';
535
+ font-style: normal;
536
+ font-weight: 700;
537
+ font-stretch: 100%;
538
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMaxKUBHMdazTgWw.woff2) format('woff2');
539
+ unicode-range: U+0001-000C, U+000E-001F, U+007F-009F, U+20DD-20E0, U+20E2-20E4, U+2150-218F, U+2190, U+2192, U+2194-2199, U+21AF, U+21E6-21F0, U+21F3, U+2218-2219, U+2299, U+22C4-22C6, U+2300-243F, U+2440-244A, U+2460-24FF, U+25A0-27BF, U+2800-28FF, U+2921-2922, U+2981, U+29BF, U+29EB, U+2B00-2BFF, U+4DC0-4DFF, U+FFF9-FFFB, U+10140-1018E, U+10190-1019C, U+101A0, U+101D0-101FD, U+102E0-102FB, U+10E60-10E7E, U+1D2C0-1D2D3, U+1D2E0-1D37F, U+1F000-1F0FF, U+1F100-1F1AD, U+1F1E6-1F1FF, U+1F30D-1F30F, U+1F315, U+1F31C, U+1F31E, U+1F320-1F32C, U+1F336, U+1F378, U+1F37D, U+1F382, U+1F393-1F39F, U+1F3A7-1F3A8, U+1F3AC-1F3AF, U+1F3C2, U+1F3C4-1F3C6, U+1F3CA-1F3CE, U+1F3D4-1F3E0, U+1F3ED, U+1F3F1-1F3F3, U+1F3F5-1F3F7, U+1F408, U+1F415, U+1F41F, U+1F426, U+1F43F, U+1F441-1F442, U+1F444, U+1F446-1F449, U+1F44C-1F44E, U+1F453, U+1F46A, U+1F47D, U+1F4A3, U+1F4B0, U+1F4B3, U+1F4B9, U+1F4BB, U+1F4BF, U+1F4C8-1F4CB, U+1F4D6, U+1F4DA, U+1F4DF, U+1F4E3-1F4E6, U+1F4EA-1F4ED, U+1F4F7, U+1F4F9-1F4FB, U+1F4FD-1F4FE, U+1F503, U+1F507-1F50B, U+1F50D, U+1F512-1F513, U+1F53E-1F54A, U+1F54F-1F5FA, U+1F610, U+1F650-1F67F, U+1F687, U+1F68D, U+1F691, U+1F694, U+1F698, U+1F6AD, U+1F6B2, U+1F6B9-1F6BA, U+1F6BC, U+1F6C6-1F6CF, U+1F6D3-1F6D7, U+1F6E0-1F6EA, U+1F6F0-1F6F3, U+1F6F7-1F6FC, U+1F700-1F7FF, U+1F800-1F80B, U+1F810-1F847, U+1F850-1F859, U+1F860-1F887, U+1F890-1F8AD, U+1F8B0-1F8BB, U+1F8C0-1F8C1, U+1F900-1F90B, U+1F93B, U+1F946, U+1F984, U+1F996, U+1F9E9, U+1FA00-1FA6F, U+1FA70-1FA7C, U+1FA80-1FA89, U+1FA8F-1FAC6, U+1FACE-1FADC, U+1FADF-1FAE9, U+1FAF0-1FAF8, U+1FB00-1FBFF;
540
+ }
541
+ /* vietnamese */
542
+ @font-face {
543
+ font-family: 'Roboto';
544
+ font-style: normal;
545
+ font-weight: 700;
546
+ font-stretch: 100%;
547
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3OUBHMdazTgWw.woff2) format('woff2');
548
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
549
+ }
550
+ /* latin-ext */
551
+ @font-face {
552
+ font-family: 'Roboto';
553
+ font-style: normal;
554
+ font-weight: 700;
555
+ font-stretch: 100%;
556
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3KUBHMdazTgWw.woff2) format('woff2');
557
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
558
+ }
559
+ /* latin */
560
+ @font-face {
561
+ font-family: 'Roboto';
562
+ font-style: normal;
563
+ font-weight: 700;
564
+ font-stretch: 100%;
565
+ src: url(/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3yUBHMdazQ.woff2) format('woff2');
566
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
567
+ }
demo/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkAnkaSTbQWt4N.woff2 ADDED
Binary file (21.6 kB). View file
 
demo/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkBXkaSTbQWt4N.woff2 ADDED
Binary file (15.1 kB). View file
 
demo/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkBnkaSTbQWg.woff2 ADDED
Binary file (41.7 kB). View file
 
demo/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkC3kaSTbQWt4N.woff2 ADDED
Binary file (35.4 kB). View file
 
demo/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCHkaSTbQWt4N.woff2 ADDED
Binary file (26.8 kB). View file
 
demo/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCXkaSTbQWt4N.woff2 ADDED
Binary file (11.6 kB). View file
 
demo/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCnkaSTbQWt4N.woff2 ADDED
Binary file (1.72 kB). View file
 
demo/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkaHkaSTbQWt4N.woff2 ADDED
Binary file (18.5 kB). View file
 
demo/assets/fonts/s/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkenkaSTbQWt4N.woff2 ADDED
Binary file (40.2 kB). View file
 
demo/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3-UBHMdazTgWw.woff2 ADDED
Binary file (14 kB). View file
 
demo/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3CUBHMdazTgWw.woff2 ADDED
Binary file (1.63 kB). View file
 
demo/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3GUBHMdazTgWw.woff2 ADDED
Binary file (31.5 kB). View file
 
demo/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3KUBHMdazTgWw.woff2 ADDED
Binary file (24.4 kB). View file
 
demo/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3OUBHMdazTgWw.woff2 ADDED
Binary file (10.6 kB). View file
 
demo/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3iUBHMdazTgWw.woff2 ADDED
Binary file (19.6 kB). View file
 
demo/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3yUBHMdazQ.woff2 ADDED
Binary file (37.5 kB). View file
 
demo/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMawCUBHMdazTgWw.woff2 ADDED
Binary file (36.3 kB). View file
 
demo/assets/fonts/s/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMaxKUBHMdazTgWw.woff2 ADDED
Binary file (16.7 kB). View file
 
demo/assets/litertjs-core-0.2.1_esm.js ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.
3
+ * Original file: /npm/@litertjs/core@0.2.1/dist/index.js
4
+ *
5
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6
+ */
7
+ import{createWasmLib as e}from"/assets/litertjs-wasm-utils.js";var t=class{constructor(e,t,r){this.liteRtInterpreter=e,this.onDelete=r;const s=this.liteRtInterpreter.inputs();for(let e=0;e<s.size();++e){const t=s.get(e);this.inputTensors.set(t.name(),t)}const o=this.liteRtInterpreter.listSignatures();for(let e=0;e<o.size();++e){const r=o.get(e);this.signatures[r]=t(this.liteRtInterpreter.getSignatureRunner(r))}this.primarySignature=t(e),this.accelerator=this.primarySignature.accelerator}inputTensors=new Map;outputTensors=new Map;signatures={};primarySignature;accelerator;deleted=!1;checkDeleted(){if(this.deleted)throw new Error("Model has been deleted. Please reload the model.")}run(e,t){if(this.checkDeleted(),"string"==typeof e){const r=e,s=t,o=this.signatures[r];if(!o){const e=Object.keys(this.signatures).join(", ");throw new Error(`Signature '${r}' not found in the model. Available signatures: ${e}`)}if(!s)throw new Error(`No input provided for signature '${r}'.`);return o.run(s)}return this.primarySignature.run(e)}getInputDetails(){return this.checkDeleted(),this.primarySignature.getInputDetails()}getOutputDetails(){return this.checkDeleted(),this.primarySignature.getOutputDetails()}delete(){if(!this.deleted){this.deleted=!0;for(const e of Object.values(this.signatures))e.delete();this.primarySignature.delete();for(const e of this.inputTensors.values())e.delete();for(const e of this.outputTensors.values())e.delete();this.liteRtInterpreter.delete(),this.onDelete()}}},r=["webgpu","wasm"],s=Object.freeze({float32:Float32Array,int32:Int32Array}),o=new Set(Object.keys(s));function n(e){if(e instanceof Float32Array)return"float32";if(e instanceof Int32Array)return"int32";throw new Error(`Unsupported typed array type ${e.constructor.name}.`)}var i=class extends Error{constructor(){super("LiteRT is not initialized yet. Please call loadLiteRt() and wait for its promise to resolve to load the LiteRT WASM module.")}},a=void 0,c=void 0;function u(){if(!a)throw new i;return a}function p(){return Boolean(a)}function h(e){a=e}function l(){return c}function d(){return Boolean(c)}function f(e){c=e}var w=class e{static copyFunctions={};tensorReferenceData;deletedInternal=!1;constructor(e,t){!function(e){const t=e;return void 0!==t&&"object"==typeof t&&"object"==typeof t.type&&"string"==typeof t.accelerator&&"object"==typeof t.reference}(e)?this.tensorReferenceData={type:{dtype:n(e),layout:{dimensions:t??[e.length]}},accelerator:"wasm",reference:y(e)}:this.tensorReferenceData=e}get type(){return this.tensorReferenceData.type}get accelerator(){return this.tensorReferenceData.accelerator}get reference(){return this.tensorReferenceData.reference}static fromTypedArray(t,r){return new e(t,r)}toTypedArray(){if("wasm"!==this.accelerator)throw new Error("Tensor must be on Wasm to be converted to a TypedArray.");const e=s[this.type.dtype],t=this.reference.data();return new e(t.buffer,t.byteOffset,t.length/e.BYTES_PER_ELEMENT).slice()}async copyTo(t){const r=e.copyFunctions[this.accelerator];if(!r)throw new Error(`Accelerator ${this.accelerator} does not support copying`);const s=r[t];if(!s||!s.copyTo){const e=Object.entries(r).filter((([e,t])=>t.copyTo)).map((([e,t])=>e));throw new Error(`Accelerator ${this.accelerator} does not support copying to ${t}. It supports copying to the following accelerators: [${e.join(", ")}].`)}return s.copyTo(this)}async moveTo(t){const r=e.copyFunctions[this.accelerator];if(!r)throw new Error(`Accelerator ${this.accelerator} does not support moving`);const s=r[t];if(!s||!s.moveTo){const e=Object.entries(r).filter((([e,t])=>t.moveTo)).map((([e,t])=>e));throw new Error(`Accelerator ${this.accelerator} does not support moving to ${t}. It supports moving to the following accelerators: [${e.join(", ")}].`)}return s.moveTo(this)}get deleted(){return this.deletedInternal}delete(){this.tensorReferenceData.reference.delete?.(),this.deletedInternal=!0}},m=class extends Error{constructor(e,t,r,s){super(`Input tensor for ${e} at position ${t} has type ${s}, but signature expects ${r}.`)}},g=class extends Error{constructor(e,t,r){const s=`[${t.join(", ")}]`;super(`Input tensor for ${e} has shape ${`[${r.join(", ")}]`}, but signature expects ${s}.`)}};function y(e){const t=u(),r=e.constructor,s=new t.liteRtWasm.CpuTensor(e.length*r.BYTES_PER_ELEMENT),o=s.data();return new r(o.buffer,o.byteOffset,e.length).set(e),s}var v=class{constructor(e){this.signatureRunnerWrapper=e,this.inputTensorsVector=this.signatureRunnerWrapper.inputs();for(let e=0;e<this.inputTensorsVector.size();++e){const t=this.inputTensorsVector.get(e);this.inputTensors.set(t.name(),t)}this.outputTensorsVector=this.signatureRunnerWrapper.outputs();for(let e=0;e<this.outputTensorsVector.size();++e){const t=this.outputTensorsVector.get(e);this.outputTensors.set(t.name(),t)}}inputTensors=new Map;inputTensorsVector;outputTensors=new Map;outputTensorsVector;deleted=!1;checkTypes(e){const t=[...this.inputTensors.values()];for(let r=0;r<t.length;++r){const s=t[r],o=e[r],n=s.type();if(n!==o.type.dtype)throw new m(s.name(),r,n,o.type.dtype)}}run(e){if(this.deleted)throw new Error("Signature has been deleted. Please reload the model.");let t,r=!0;if(Array.isArray(e)){if(e.length!==this.inputTensors.size)throw new Error(`run() called with ${e.length} inputs, but signature expects ${this.inputTensors.size} inputs`);t=e}else if(e instanceof w){if(1!==this.inputTensors.size)throw new Error(`run() called with a single tensor, but signature expects ${this.inputTensors.size} inputs`);t=[e]}else{r=!1,t=[];for(const r of this.inputTensors.keys()){const s=e[r];if(!s)throw new Error(`Expected input tensor with name '${r}', but none was provided.`);t.push(s)}}this.checkTypes(t);const s=this.runWithArray(t);if(r)return s;const o={},n=[...this.outputTensors.keys()];for(let e=0;e<n.length;e++)o[n[e]]=s[e];return o}pushErrorScopes(){}popErrorScopes(e){}runWithArray(e){const t=this.signatureRunnerWrapper.makeTensorVector();for(const r of e)t.push_back(r.reference);this.pushErrorScopes(),this.signatureRunnerWrapper.copyInputs(t),this.popErrorScopes("copyInputs"),t.delete(),this.pushErrorScopes(),this.signatureRunnerWrapper.invoke(),this.popErrorScopes("invoke"),this.pushErrorScopes();const r=this.signatureRunnerWrapper.copyOutputs();this.popErrorScopes("copyOutputs");const s=[];for(let e=0;e<this.outputTensorsVector.size();++e){const t=this.outputTensorsVector.get(e),o=r.get(e);s.push(new w({type:{dtype:t.type(),layout:{dimensions:t.shape()}},accelerator:t.accelerator(),reference:o})),t.delete()}return r.delete(),s}getInputDetails(){return T(this.inputTensors)}getOutputDetails(){return T(this.outputTensors)}delete(){if(!this.deleted){for(const e of this.inputTensors.values())e.delete();this.inputTensors.clear(),this.inputTensorsVector.delete();for(const e of this.outputTensors.values())e.delete();this.outputTensors.clear(),this.outputTensorsVector.delete(),this.deleted=!0}}};function T(e){return[...e.entries()].map((([e,t],r)=>({name:e,index:r,shape:t.shape(),dtype:t.type()})))}var b=class extends v{accelerator="wasm";constructor(e){super(e)}checkShapes(e){let t=0;for(const r of this.inputTensors.values()){const s=e[t++].type.layout.dimensions,o=r.shape();if(o.length!==s.length)throw new g(r.name(),o,s);for(let e=0;e<s.length;++e)if(s[e]!==o[e])throw new g(r.name(),o,s)}}runWithArray(e){return this.checkShapes(e),super.runWithArray(e)}};function E(){return!("undefined"==typeof globalThis||!globalThis.navigator||!globalThis.navigator.gpu)}var R=["internal","out-of-memory","validation"];function W(e){for(const t of R)e.pushErrorScope(t)}function S(e,t,r){for(let s=0;s<R.length;++s)e.popErrorScope().then((e=>{e&&r(e,t)}))}async function D(e){const t=await u().getWebGpuDevice(),r=u().getConverterFactory().makeConverterToTfjs(e.reference).convertToTfjs(e.reference),s=t.createBuffer({size:r.size,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST,mappedAtCreation:!1}),o=t.createCommandEncoder();o.copyBufferToBuffer(r,0,s,0,r.size),t.queue.submit([o.finish()]),await s.mapAsync(GPUMapMode.READ);const n=s.getMappedRange(),i=new Uint8Array(n),a=new(0,u().liteRtWasm.CpuTensor)(i.byteLength);return a.data().set(i),s.unmap(),s.destroy(),new w({type:e.type,accelerator:"wasm",reference:a})}async function A(e){const t=await u().getWebGpuDevice(),r=e.reference.data(),o=new(0,s[e.type.dtype])(r.buffer,r.byteOffset,r.length),n=t.createBuffer({size:o.byteLength,usage:GPUBufferUsage.MAP_WRITE|GPUBufferUsage.COPY_SRC,mappedAtCreation:!0}),i=await n.getMappedRange();if(o instanceof Float32Array){new Float32Array(i).set(o)}else{if(!(o instanceof Int32Array))throw new Error("Unsupported typed array type: "+o.constructor.name);new Int32Array(i).set(o)}n.unmap();const a=t.createBuffer({size:n.size,usage:GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.STORAGE}),c=t.createCommandEncoder();c.copyBufferToBuffer(n,0,a,0,n.size),t.queue.submit([c.finish()]),n.destroy();const p=function(e){const t=[1,1,1,1];switch(e.length){case 1:t[3]=e[0];break;case 2:t[3]=e[1],t[2]=e[0];break;case 3:t[3]=e[2],t[2]=e[1],t[1]=e[0];break;case 4:t[3]=e[3],t[2]=e[2],t[1]=e[1],t[0]=e[0];break;default:throw new Error("Only 1D~4D tensors are supported, but got shape: "+e.toString()+".")}return t}(e.type.layout.dimensions),h=u().getConverterFactory().makeConverterFromTfjs(e.type.dtype,...p).convertFromTfjs(a);return a.destroy(),new w({type:e.type,accelerator:"webgpu",reference:h})}var U=class e extends Map{val;constructor(){super()}getMap(t,r=!1){let s=this;for(let o=0;o<t.length;o++){if(!s.has(t[o])){if(!r)return;s.set(t[o],new e)}s=s.get(t[o])}return s}getPath(e){return this.getMap(e)?.val}hasPath(e){return void 0!==this.getMap(e)}setPath(e,t){this.getMap(e,!0).val=t}};function P(e,t=e=>e){const r=new U;return(...s)=>{const o=t(s);return r.hasPath(o)||r.setPath(o,e(...s)),r.getPath(o)}}var G=class{constructor(e,t,r){this.converter=e,this.wasm=t,this.gpuErrorReporter=r}convertFromTfjs(e){W(this.wasm.preinitializedWebGPUDevice);const t=this.wasm.WebGPU.importJsBuffer(e),r=this.converter.convertFromTfjs(t);return S(this.wasm.preinitializedWebGPUDevice,"convertFromTfjs",this.gpuErrorReporter.val),r}delete(){this.converter.delete()}},C=class{constructor(e,t,r){this.converter=e,this.wasm=t,this.gpuErrorReporter=r}convertToTfjs(e){W(this.wasm.preinitializedWebGPUDevice);const t=this.converter.convertToTfjs(e),r=this.wasm.WebGPU.getJsObject(t);return S(this.wasm.preinitializedWebGPUDevice,"convertToTfjs",this.gpuErrorReporter.val),r}delete(){this.converter.delete()}},j=class{constructor(e,t){this.wasm=e,this.gpuErrorReporter=t}isWebGpuDeviceCompatible(e){return e===this.wasm.preinitializedWebGPUDevice}makeConverterFromTfjs=P(this.makeConverterFromTfjsInternal.bind(this));makeConverterFromTfjsInternal(e,t,r,s,o){W(this.wasm.preinitializedWebGPUDevice);const n=this.wasm.makeConverterFromTfjs(e,t,r,s,o);return S(this.wasm.preinitializedWebGPUDevice,"makeConverterFromTfjs",this.gpuErrorReporter.val),new G(n,this.wasm,this.gpuErrorReporter)}makeConverterToTfjs=P(this.makeConverterToTfjsInternal.bind(this),(([e])=>e.getCacheKey()));makeConverterToTfjsInternal(e){W(this.wasm.preinitializedWebGPUDevice);const t=this.wasm.makeConverterToTfjs(e);return S(this.wasm.preinitializedWebGPUDevice,"makeConverterToTfjs",this.gpuErrorReporter.val),new C(t,this.wasm,this.gpuErrorReporter)}},z=class extends v{constructor(e,t,r){super(e),this.device=t,this.gpuErrorReporter=r}accelerator="webgpu";pushErrorScopes(){W(this.device)}popErrorScopes(e){S(this.device,e,this.gpuErrorReporter.val)}},k=["shader-f16","subgroups","subgroups-f16"];function I(e){u().setErrorReporter(e)}function x(e){u().setGpuErrorReporter(e)}function M(e,t){u().setWebGpuDevice(e,t)}function B(){return u().getWebGpuDevice()}function $(){return u().getAdapterInfo()}function F(e,t){return u().loadAndCompile(e,t)}var L=class e{liteRtWasm;device;gpuErrorReporter={val:(e,t)=>{console.error("GPU error:",e,"at:",t)}};loadAndCompileWebGpuWasCalled=!1;loadedModels=new Set;converterFactory;constructor(e){if(this.liteRtWasm=e,!this.liteRtWasm.loadAndCompileWebGpu)throw new Error("loadAndCompileWebGpu is not defined.");this.liteRtWasm.setupLogging()}pushErrorScopes(){if(!this.device)throw new Error("No GPU device provided.");W(this.device)}popErrorScopes(e){if(!this.device)throw new Error("No GPU device provided.");S(this.device,e,this.gpuErrorReporter.val)}static async urlToUint8Array(e){const t=await fetch(e);return new Uint8Array(await t.arrayBuffer())}static async readableStreamToUint8Array(e){let t=0,r=new Uint8Array(1024);const s=2e9;for(;;){const{done:o,value:n}=await e.read();if(n){if(r.byteLength<t+n.byteLength){if(t+n.byteLength>s)throw new Error("Model is too large (> 2000000000 bytes");const e=new Uint8Array(Math.min(s,2*Math.max(r.byteLength,n.byteLength)));e.set(r),r=e}r.set(n,t),t+=n.byteLength}if(o)break}return r.slice(0,t)}async initializeDefaultWebGpuDevice(){if(this.device)return void console.warn("WebGPU device is already initialized.");if(!E())throw new Error("This browser does not support WebGPU.");const e=await navigator.gpu.requestAdapter({powerPreference:"high-performance"});if(!e)throw new Error("No GPU adapter found.");const t=e.info,r={maxBufferSize:e.limits.maxBufferSize,maxStorageBufferBindingSize:e.limits.maxStorageBufferBindingSize,maxStorageBuffersPerShaderStage:e.limits.maxStorageBuffersPerShaderStage,maxTextureDimension2D:e.limits.maxTextureDimension2D},s=[];for(const t of k)e.features.has(t)&&s.push(t);const o=await e.requestDevice({requiredFeatures:s,requiredLimits:r});this.setWebGpuDevice(o,t)}setErrorReporter(e){this.liteRtWasm.setErrorReporter(e)}setGpuErrorReporter(e){this.gpuErrorReporter.val=e}setWebGpuDevice(e,t){if(this.loadAndCompileWebGpuWasCalled)throw new Error("The WebGPU device cannot be set after loading a WebGPU model.");if(this.device=e,!this.device.adapterInfo){if(!t)throw new Error("The device does not have adapter info, so adapterInfo must be provided.");this.device.adapterInfo=t}this.liteRtWasm.preinitializedWebGPUDevice=this.device}async getWebGpuDevice(){return this.device||await this.initializeDefaultWebGpuDevice(),this.device}async getAdapterInfo(){return this.device||await this.initializeDefaultWebGpuDevice(),this.device.adapterInfo}async loadAndCompile(r,s){let o;if("string"==typeof r||r instanceof URL)o=await e.urlToUint8Array(r);else if(r instanceof Uint8Array)o=r;else{if(!(r instanceof ReadableStreamDefaultReader))throw new Error("Unsupported model type.");o=await e.readableStreamToUint8Array(r)}const n=this.liteRtWasm._malloc(o.byteLength);let i;this.liteRtWasm.HEAPU8.set(o,n);const a=()=>{this.liteRtWasm._free(n),this.loadedModels.delete(i)};if("webgpu"===s.accelerator){this.liteRtWasm.preinitializedWebGPUDevice||await this.initializeDefaultWebGpuDevice(),this.pushErrorScopes(),this.loadAndCompileWebGpuWasCalled=!0;const e=this.liteRtWasm.loadAndCompileWebGpu(n,o.byteLength);this.popErrorScopes("loadAndCompile"),i=new t(e,(e=>{if(!this.device)throw new Error("No GPU device provided.");return new z(e,this.device,this.gpuErrorReporter)}),a)}else{const e=this.liteRtWasm.loadAndCompileCpu(n,o.byteLength);i=new t(e,(e=>new b(e)),a)}return this.loadedModels.add(i),i}getConverterFactory(){return this.converterFactory||(this.converterFactory=new j(this.liteRtWasm,this.gpuErrorReporter)),this.converterFactory}delete(){for(const e of this.loadedModels)e.delete()}};var O=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,15,1,13,0,65,1,253,15,65,2,253,15,253,128,2,11]),_=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]),V={relaxedSimd:void 0,threads:void 0};async function N(e){try{return await WebAssembly.instantiate(e),{supported:!0}}catch(e){return{supported:!1,error:e}}}var q={relaxedSimd:()=>(void 0===V.relaxedSimd&&(V.relaxedSimd=N(O)),V.relaxedSimd),threads:()=>{if(void 0===V.threads)try{"undefined"!=typeof MessageChannel&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),V.threads=N(_)}catch(e){V.threads=Promise.resolve({supported:!1,error:e})}return V.threads}};async function Y(t,r){const s=t,o=s.endsWith(".wasm")||s.endsWith(".js"),n=await async function(e){const t=q[e]?.();if(!t)throw new Error(`Unknown feature: ${e}`);return(await t).supported}("relaxedSimd");if(r?.threads){if(o&&console.warn(`The \`threads\` option was specified, but the wasm path ${s} is a full file path. Whether threads are available or not will depend on the loaded file. To allow LiteRT.js to load the threaded wasm file, use a directory path instead of a full file path.`),!n)throw new Error("Threads are only supported with relaxed SIMD, and the current browser does not support relaxed SIMD.");await async function(e){const t=q[e]?.();if(!t)throw new Error(`Unknown feature: ${e}`);const r=await t;if(!r.supported)throw r.error}("threads")}let i="litert_wasm_compat_internal.js";n&&(i=r?.threads?"litert_wasm_threaded_internal.js":"litert_wasm_internal.js");let a=t;if(s.endsWith(".wasm"))throw new Error("Please load the `.js` file corresponding to the `.wasm` file, or load the directory containing it.");return s.endsWith(".js")||(a=function(e,t){return e?t?(e.endsWith("/")?e:e+"/")+(t.startsWith("/")?t.substring(1):t):e:t}(t,i)),e(L,a)}function J(e,t){if(d())throw new Error("LiteRT is already loading / loaded.");return f(Y(e,t).then((e=>(h(e),e))).catch((e=>{throw f(void 0),e}))),l()}function H(){if(d()&&!p())throw new Error("LiteRT is loading and can not be unloaded or canceled until it is finished loading.");p()&&(u().delete(),h(void 0)),f(void 0)}w.copyFunctions.wasm={webgpu:{copyTo:A,moveTo:async e=>{const t=await A(e);return e.delete(),t}}},w.copyFunctions.webgpu={wasm:{copyTo:D,moveTo:async e=>{const t=await D(e);return e.delete(),t}}};
8
+ /**
9
+ * @fileoverview A memoization utility for JavaScript.
10
+ *
11
+ * This utility provides a function `memoize` that can be used to memoize
12
+ * functions. A memoized function will only be called once for each unique set
13
+ * of arguments, and the result will be cached and returned on subsequent calls.
14
+ *
15
+ * Example usage:
16
+ *
17
+ * ```typescript
18
+ * const memoizedAdd = memoize((a, b) => a + b);
19
+ * console.log(memoizedAdd(1, 2)); // Output: 3
20
+ * console.log(memoizedAdd(1, 2)); // Output: 3
21
+ * ```
22
+ *
23
+ * In this example, the `memoizedAdd` function will only be called once, even
24
+ * though it is called twice. The result of the first call will be cached and
25
+ * returned on the second call.
26
+ *
27
+ * @license
28
+ * Copyright 2025 Google LLC
29
+ *
30
+ * Licensed under the Apache License, Version 2.0 (the "License");
31
+ * you may not use this file except in compliance with the License.
32
+ * You may obtain a copy of the License at
33
+ *
34
+ * http://www.apache.org/licenses/LICENSE-2.0
35
+ *
36
+ * Unless required by applicable law or agreed to in writing, software
37
+ * distributed under the License is distributed on an "AS IS" BASIS,
38
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39
+ * See the License for the specific language governing permissions and
40
+ * limitations under the License.
41
+ */
42
+ export{r as ACCELERATORS,t as CompiledModel,j as ConverterFactory,b as CpuSignatureRunner,s as DTYPE_TO_ARRAY_TYPE,z as GpuSignatureRunner,G as InputConverter,L as LiteRt,i as LiteRtNotLoadedError,C as OutputConverter,o as SUPPORTED_DTYPES,v as SignatureRunner,w as Tensor,g as TensorShapeError,m as TensorTypeError,$ as getAdapterInfo,u as getGlobalLiteRt,l as getGlobalLiteRtPromise,B as getWebGpuDevice,E as isWebGPUSupported,F as loadAndCompile,J as loadLiteRt,I as setErrorReporter,x as setGpuErrorReporter,M as setWebGpuDevice,n as typedArrayToDtype,H as unloadLiteRt};export default null;
43
+ //# sourceMappingURL=litertjs-core-0.2.1_esm.js.map
demo/assets/litertjs-core-0.2.1_esm.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"sources":["jsdelivr-header.js","/npm/@litertjs/core@0.2.1/src/compiled_model.ts","/npm/@litertjs/core@0.2.1/src/constants.ts","/npm/@litertjs/core@0.2.1/src/global_litert.ts","/npm/@litertjs/core@0.2.1/src/tensor.ts","/npm/@litertjs/core@0.2.1/src/signature_runner.ts","/npm/@litertjs/core@0.2.1/src/cpu_signature_runner.ts","/npm/@litertjs/core@0.2.1/src/gpu_utils.ts","/npm/@litertjs/core@0.2.1/src/memoize.ts","/npm/@litertjs/core@0.2.1/src/gpu_conversion.ts","/npm/@litertjs/core@0.2.1/src/gpu_signature_runner.ts","/npm/@litertjs/core@0.2.1/src/litert_web.ts","/npm/@litertjs/core@0.2.1/src/wasm_feature_detect.ts","/npm/@litertjs/core@0.2.1/src/load.ts","/npm/@litertjs/core@0.2.1/src/url_path_utils.ts","/npm/@litertjs/core@0.2.1/src/load_litert.ts","/npm/@litertjs/core@0.2.1/src/tensor_copy_functions.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,qECmBO,IAAM,EAAN,MAQL,WAAA,CACuB,EACnB,EAEiB,GAHE,KAAA,oBAGF,KAAA,WACb,MAAA,EAAe,KAAK,kBAAkB,SAC5C,QAAS,EAAI,EAAG,EAAI,EAAa,SAAU,EAAG,CACtC,MAAA,EAAS,EAAa,IAAI,GAChC,KAAK,aAAa,IAAI,EAAO,OAAQ,EAAM,CAGvC,MAAA,EAAmB,KAAK,kBAAkB,iBAChD,QAAS,EAAI,EAAG,EAAI,EAAiB,SAAU,EAAG,CAC1C,MAAA,EAAgB,EAAiB,IAAI,GACtC,KAAA,WAAW,GAAiB,EAC7B,KAAK,kBAAkB,mBAAmB,GAAc,CAEzD,KAAA,iBAAmB,EAAoB,GACvC,KAAA,YAAc,KAAK,iBAAiB,WAAA,CAzBjC,aAAA,IAAmB,IACnB,cAAA,IAAoB,IACrB,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/B,MAAM,IAAI,MACN,uFAIF,MACF,IAAkB,SAClB,OAAgB,IAElB,OAAuB,EACzB,CC9DS,EAAA,cAAoB,KAAI,CAC7B,OAAU,CACR,OAAQ,EACR,OAAQ,MAAO,IACP,MAAA,QAAkB,EAAqB,GAEtC,OADP,EAAO,SACA,CAAA,IAIN,EAAA,cAAsB,OAAI,CAC/B,KAAQ,CACN,OAAQ,EACR,OAAQ,MAAO,IACP,MAAA,QAAkB,EAAqB,GAEtC,OADP,EAAO,SACA,CAAA","file":"/npm/@litertjs/core@0.2.1/dist/index.js/+esm","sourceRoot":"","sourcesContent":["/**\n * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.\n * Original file: /npm/@litertjs/core@0.2.1/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Accelerator} from './constants';\nimport {SignatureRunner} from './signature_runner';\nimport {Tensor} from './tensor';\nimport type {SignatureRunnerWrapper, TensorWrapper} from './wasm_binding_types';\nimport {LiteRtInterpreter} from './wasm_binding_types';\n\n/**\n * Represents a loaded LiteRt model.\n */\nexport class CompiledModel {\n protected inputTensors = new Map<string, TensorWrapper>();\n protected outputTensors = new Map<string, TensorWrapper>();\n readonly signatures: Record<string, SignatureRunner> = {};\n protected readonly primarySignature: SignatureRunner;\n readonly accelerator: Accelerator;\n deleted = false;\n\n constructor(\n protected readonly liteRtInterpreter: LiteRtInterpreter,\n makeSignatureRunner:\n (signatureRunnerWrapper: SignatureRunnerWrapper) => SignatureRunner,\n private readonly onDelete: () => void) {\n const tfliteInputs = this.liteRtInterpreter.inputs();\n for (let i = 0; i < tfliteInputs.size(); ++i) {\n const tensor = tfliteInputs.get(i);\n this.inputTensors.set(tensor.name(), tensor);\n }\n\n const signaturesVector = this.liteRtInterpreter.listSignatures();\n for (let i = 0; i < signaturesVector.size(); ++i) {\n const signatureName = signaturesVector.get(i);\n this.signatures[signatureName] = makeSignatureRunner(\n this.liteRtInterpreter.getSignatureRunner(signatureName));\n }\n this.primarySignature = makeSignatureRunner(liteRtInterpreter);\n this.accelerator = this.primarySignature.accelerator;\n }\n\n private checkDeleted() {\n if (this.deleted) {\n throw new Error('Model has been deleted. Please reload the model.');\n }\n }\n\n /**\n * Runs the model with the given input tensors and returns the outputs.\n *\n * If the first argument is a string, it is interpreted as a signature name\n * and the second argument is interpreted as the input tensors for that\n * signature. Otherwise, the first argument is interpreted as the input\n * tensors for the primary signature.\n */\n run(input: Tensor|Tensor[]): Tensor[];\n run(input: Record<string, Tensor>): Record<string, Tensor>;\n run(signatureName: string, input: Tensor|Tensor[]): Tensor[];\n run(signatureName: string,\n input: Record<string, Tensor>): Record<string, Tensor>;\n // Typescript won't automatically distribute a union over the above\n // signatures, so we need to explicitly declare them below.\n // https://github.com/microsoft/TypeScript/issues/14107\n run(input: Tensor|Tensor[]|\n Record<string, Tensor>): Tensor[]|Record<string, Tensor>;\n run(signatureName: string, input: Tensor|Tensor[]|Record<string, Tensor>):\n Tensor[]|Record<string, Tensor>;\n run(inputOrSignatureName: string|Tensor|Tensor[]|Record<string, Tensor>,\n maybeInput?: Tensor|Tensor[]|Record<string, Tensor>) {\n this.checkDeleted();\n if (typeof inputOrSignatureName === 'string') {\n const signatureName = inputOrSignatureName;\n const input = maybeInput;\n const signature = this.signatures[signatureName];\n if (!signature) {\n const signatures = Object.keys(this.signatures).join(', ');\n throw new Error(`Signature '${\n signatureName}' not found in the model. Available signatures: ${\n signatures}`);\n }\n if (!input) {\n throw new Error(`No input provided for signature '${signatureName}'.`);\n }\n\n return signature.run(input);\n } else {\n return this.primarySignature.run(inputOrSignatureName);\n }\n }\n\n /**\n * Returns the input details for the primary signature.\n */\n getInputDetails() {\n this.checkDeleted();\n return this.primarySignature.getInputDetails();\n }\n\n /**\n * Returns the output details for the primary signature.\n */\n getOutputDetails() {\n this.checkDeleted();\n return this.primarySignature.getOutputDetails();\n }\n\n delete() {\n if (this.deleted) {\n return;\n }\n // Set this now to prevent reentry, although that shouldn't happen.\n this.deleted = true;\n\n for (const signature of Object.values(this.signatures)) {\n signature.delete();\n }\n\n // This is separate from the other signatures\n this.primarySignature.delete();\n\n for (const input of this.inputTensors.values()) {\n input.delete();\n }\n for (const output of this.outputTensors.values()) {\n output.delete();\n }\n\n this.liteRtInterpreter.delete();\n this.onDelete();\n }\n}\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * The accelerators that LiteRt Web supports.\n */\nexport const ACCELERATORS = ['webgpu', 'wasm'] as const;\n/**\n * The type for accelerators that LiteRt Web supports.\n */\nexport type Accelerator = (typeof ACCELERATORS)[number];\n\n/**\n * A map from data types to the corresponding JavaScript array type.\n */\nexport const DTYPE_TO_ARRAY_TYPE = Object.freeze({\n // noType is not supported.\n 'float32': Float32Array,\n 'int32': Int32Array,\n\n // The following types are disabled until we support them in C++.\n /*\n 'uint8': Uint8Array,\n // TODO(msoulanille): int64 is not supported yet because BigInt64Array makes\n // TFJS integration more complicated.\n // 'int64': BigInt64Array,\n // String is not supported.\n // TODO(msoulanille): bool will require special handling in C++.\n // TFJS WebGPU stores bool in a 32 bit integer.\n // However, tf.data() returns a Uint8Array.\n // Unclear if we should follow TFJS or whatever LiteRt xnnpack does.\n 'bool': Uint8Array,\n 'int16': Int16Array,\n // Complex64 is not supported.\n 'int8': Int8Array,\n // JS does not have a Float16Array.\n // TODO(msoulanille): This will require special handling in C++.\n 'float16': Float32Array,\n 'float64': Float64Array,\n // Complex128 is not supported.\n // TODO(msoulanille): uint64 is not supported yet because BigInt64Array makes\n // TFJS integration more complicated.\n // 'uint64': BigInt64Array,\n // Resource and Variant are not supported.\n 'uint32': Uint32Array,\n 'uint16': Uint16Array,\n // TODO(msoulanille): This will require special handling in C++.\n 'int4': Uint8Array,\n // TODO(msoulanille): This will require special handling in C++.\n 'bfloat16': Float32Array,\n */\n} as const);\n\n/**\n * The data type of a Tensor.\n */\nexport type DType = keyof typeof DTYPE_TO_ARRAY_TYPE;\n\n// This is intentionally not typed as `ReadonlySet<DType>` because we want to\n// make it easy to call 'has' on this set with strings.\n/**\n * The set of supported data types in LiteRt Web. These are represented by\n * strings.\n */\nexport const SUPPORTED_DTYPES: ReadonlySet<string> =\n new Set(Object.keys(DTYPE_TO_ARRAY_TYPE));\n\n/**\n * The dimensions, or shape, of a Tensor.\n */\nexport type Dimensions = Int32Array|number[];\n\n/**\n * The constructor for a TypedArray.\n */\nexport type TypedArrayConstructor = (typeof DTYPE_TO_ARRAY_TYPE)[DType];\n\n/**\n * A TypedArray.\n */\nexport type TypedArray = InstanceType<TypedArrayConstructor>;\n\ndeclare global {\n // TypeScript is missing some signatures for these constructor types.\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array/Int32Array\n interface Int32ArrayConstructor {\n new(buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array;\n }\n\n interface Float32ArrayConstructor {\n new(buffer: ArrayBuffer, byteOffset?: number,\n length?: number): Float32Array;\n }\n}\n\n/**\n * Converts a TypedArray to its corresponding DType.\n */\nexport function typedArrayToDtype(data: TypedArray): DType {\n if (data instanceof Float32Array) {\n return 'float32';\n } else if (data instanceof Int32Array) {\n return 'int32';\n }\n throw new Error(\n `Unsupported typed array type ${(data as Uint8Array).constructor.name}.`);\n}\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {LiteRt} from './litert_web';\n\n/**\n * An error thrown when LiteRT is not loaded.\n */\nexport class LiteRtNotLoadedError extends Error {\n constructor() {\n super(\n 'LiteRT is not initialized yet. Please call loadLiteRt() and wait for its ' +\n 'promise to resolve to load the LiteRT WASM module.');\n }\n}\n\nlet globalLiteRt: LiteRt|undefined = undefined;\nlet globalLiteRtPromise: Promise<LiteRt>|undefined = undefined;\n\n/**\n * Get the global LiteRT instance.\n *\n * In most cases, you can call the functions exported by this module that wrap\n * the global LiteRT instance instead.\n */\nexport function getGlobalLiteRt(): LiteRt {\n if (!globalLiteRt) {\n throw new LiteRtNotLoadedError();\n }\n return globalLiteRt;\n}\n\n/**\n * Check if the global LiteRT instance is defined.\n *\n * Only exposed internally.\n */\nexport function hasGlobalLiteRt(): boolean {\n return Boolean(globalLiteRt);\n}\n\n/**\n * Set the global LiteRT instance.\n *\n * Only exposed internally.\n */\nexport function setGlobalLiteRt(liteRt: LiteRt|undefined) {\n globalLiteRt = liteRt;\n}\n\n/**\n * Resolves when the currently loading / loaded LiteRT instance is loaded.\n *\n * If `loadLiteRt()` has been called, this function returns a promise that\n * resolves when the LiteRT instance is loaded. Otherwise, it returns undefined.\n *\n * If LiteRT has failed to load before this function is called or has been\n * manually unloaded with `unloadLiteRt()`, this function also returns\n * undefined.\n */\nexport function getGlobalLiteRtPromise(): Promise<LiteRt>|undefined {\n return globalLiteRtPromise;\n}\n\n/**\n * Check if the global LiteRT instance promise is defined.\n *\n * Only exposed internally.\n */\nexport function hasGlobalLiteRtPromise(): boolean {\n return Boolean(globalLiteRtPromise);\n}\n\n/**\n * Set the global LiteRT instance promise.\n *\n * Only exposed internally.\n */\nexport function setGlobalLiteRtPromise(promise: Promise<LiteRt>|undefined) {\n globalLiteRtPromise = promise;\n}\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Accelerator, Dimensions, DType, DTYPE_TO_ARRAY_TYPE, TypedArray, TypedArrayConstructor, typedArrayToDtype} from './constants';\nimport {getGlobalLiteRt} from './global_litert';\nimport {CpuTensorReference, OpaqueTensorReference} from './wasm_binding_types';\n\n/**\n * Metadata about a Tensor including its type and layout.\n *\n * This type only includes information about the tensor itself, not the\n * accelerator it is on.\n */\nexport interface TensorType {\n dtype: DType;\n layout: {dimensions: Dimensions};\n}\n\n// Functions for copying tensors between accelerators.\ninterface CopyFunctionSet {\n moveTo?: (tensor: Tensor) => Tensor | Promise<Tensor>;\n copyTo?: (tensor: Tensor) => Tensor | Promise<Tensor>;\n}\n\ntype TensorCopyFunctions = Partial<Record<\n Accelerator /* from */,\n Partial<Record<Accelerator /* to */, CopyFunctionSet>>>>;\n\n\n\n/**\n * Data for constructing a Tensor directly from an OpaqueTensorReference.\n *\n * Most users should not need to construct a Tensor this way. They should\n * instead construct their tensors from TypedArrays or other data sources.\n */\nexport interface TensorReferenceData {\n type: TensorType;\n accelerator: Accelerator;\n reference: OpaqueTensorReference;\n}\n\nfunction isTensorReferenceData(data: unknown): data is TensorReferenceData {\n const maybeData = data as TensorReferenceData;\n return (\n maybeData !== undefined && typeof maybeData === 'object' &&\n typeof maybeData.type === 'object' &&\n typeof maybeData.accelerator === 'string' &&\n typeof maybeData.reference === 'object');\n}\n\n/**\n * A tensor that is passed to or from a model.\n *\n * Tensors may be on the CPU (`wasm` accelerator), on the GPU (`webgpu`\n * accelerator), or on another LiteRt-specific accelerator.\n * They can be converted between accelerators with `copyTo` and `moveTo`.\n * Tensors on the `wasm` accelerator can be converted to the TypedArray\n * corresponding to their data type.\n */\nexport class Tensor {\n // This contains properties of TensorWrapper but organized in a more\n // JS-friendly way. Some properties may be missing, such as when the user\n // creates their own Tensor.\n //\n // Additionally, instances of this interface are not associated with a\n // specific TfLite Interpreter.\n\n static copyFunctions: TensorCopyFunctions = {};\n private readonly tensorReferenceData: TensorReferenceData;\n private deletedInternal = false;\n\n constructor(data: TensorReferenceData);\n constructor(data: TypedArray, shape?: Dimensions);\n constructor(\n dataOrTypedArray: TensorReferenceData|TypedArray, shape?: Dimensions) {\n if (isTensorReferenceData(dataOrTypedArray)) {\n this.tensorReferenceData = dataOrTypedArray;\n } else {\n this.tensorReferenceData = {\n type: {\n dtype: typedArrayToDtype(dataOrTypedArray),\n layout: {\n dimensions: shape ?? [dataOrTypedArray.length],\n }\n },\n accelerator: 'wasm',\n reference: typedArrayToCpuTensorReference(dataOrTypedArray),\n };\n }\n }\n\n /**\n * Returns the datatype of the tensor.\n */\n get type(): TensorType {\n return this.tensorReferenceData.type;\n }\n\n /**\n * Returns the accelerator the tensor is stored on.\n */\n get accelerator(): Accelerator {\n return this.tensorReferenceData.accelerator;\n }\n\n /**\n * Returns the internal reference to the tensor data.\n *\n * Users should not rely on this call, and should use `toTypedArray` instead\n * if they are trying to view Tensor data.\n */\n get reference(): OpaqueTensorReference {\n return this.tensorReferenceData.reference;\n }\n\n static fromTypedArray(data: TypedArray, shape?: Dimensions): Tensor {\n return new Tensor(data, shape);\n }\n\n /**\n * Returns the data of the tensor as a TypedArray.\n *\n * The returned TypedArray is a copy of the data, and this method does not\n * delete the original tensor.\n * @throws An error if the tensor is not on Wasm.\n */\n toTypedArray(): TypedArray {\n if (this.accelerator !== 'wasm') {\n throw new Error(\n 'Tensor must be on Wasm to be converted to a TypedArray.');\n }\n\n const typedArrayConstructor = DTYPE_TO_ARRAY_TYPE[this.type.dtype];\n const cpuTensorReference = this.reference as CpuTensorReference;\n const data = cpuTensorReference.data();\n return new typedArrayConstructor(\n // Cast is needed to avoid 'SharedArrayBuffer' in the type.\n data.buffer as ArrayBuffer, data.byteOffset,\n data.length / typedArrayConstructor.BYTES_PER_ELEMENT)\n .slice();\n }\n\n /**\n * Copies the tensor to the given accelerator.\n *\n * @param accelerator The accelerator to copy to.\n * @return A promise that resolves to the copied tensor.\n */\n async copyTo(accelerator: Accelerator): Promise<Tensor> {\n const copyFunctions = Tensor.copyFunctions[this.accelerator];\n if (!copyFunctions) {\n throw new Error(\n `Accelerator ${this.accelerator} does not support copying`);\n }\n const copyFunctionSet = copyFunctions[accelerator];\n if (!copyFunctionSet || !copyFunctionSet.copyTo) {\n const supportedCopyDestinations =\n Object.entries(copyFunctions)\n .filter(([key, value]) => value.copyTo)\n .map(([key, value]) => key);\n throw new Error(`Accelerator ${\n this.accelerator} does not support copying to ${\n accelerator}. It supports copying to the following accelerators: [${\n supportedCopyDestinations.join(', ')}].`);\n }\n return copyFunctionSet.copyTo(this);\n }\n\n /**\n * Moves the tensor to the given accelerator, deleting the original.\n *\n * @param accelerator The accelerator to move to.\n * @return A promise that resolves to the moved tensor.\n */\n async moveTo(accelerator: Accelerator): Promise<Tensor> {\n const copyFunctions = Tensor.copyFunctions[this.accelerator];\n if (!copyFunctions) {\n throw new Error(\n `Accelerator ${this.accelerator} does not support moving`);\n }\n const copyFunctionSet = copyFunctions[accelerator];\n if (!copyFunctionSet || !copyFunctionSet.moveTo) {\n const supportedMoveDestinations =\n Object.entries(copyFunctions)\n .filter(([key, value]) => value.moveTo)\n .map(([key, value]) => key);\n throw new Error(`Accelerator ${\n this.accelerator} does not support moving to ${\n accelerator}. It supports moving to the following accelerators: [${\n supportedMoveDestinations.join(', ')}].`);\n }\n return copyFunctionSet.moveTo(this);\n }\n\n get deleted(): boolean {\n return this.deletedInternal;\n }\n\n delete() {\n this.tensorReferenceData.reference.delete?.();\n this.deletedInternal = true;\n }\n}\n\n/**\n * An error thrown when a tensor of the wrong type is passed to a model.\n */\nexport class TensorTypeError extends Error {\n constructor(\n name: string,\n index: number,\n expected: DType,\n actual: DType,\n ) {\n super(`Input tensor for ${name} at position ${index} has type ${\n actual}, but signature expects ${expected}.`);\n }\n}\n\n/**\n * An error thrown when a tensor of the wrong shape is passed to a model.\n */\nexport class TensorShapeError extends Error {\n constructor(\n name: string,\n expected: {join(joinWith: string): string;},\n actual: {join(joinWith: string): string;},\n ) {\n const expectedShapeString = `[${expected.join(', ')}]`;\n const actualShapeString = `[${actual.join(', ')}]`;\n super(\n `Input tensor for ${name} has shape ${actualShapeString}, but ` +\n `signature expects ${expectedShapeString}.`);\n }\n}\n\nfunction typedArrayToCpuTensorReference(data: TypedArray):\n OpaqueTensorReference {\n const globalLiteRt = getGlobalLiteRt();\n\n const arrayType = data.constructor as TypedArrayConstructor;\n const cpuTensor = new globalLiteRt.liteRtWasm.CpuTensor(\n data.length * arrayType.BYTES_PER_ELEMENT);\n const cpuTensorUint8Array = cpuTensor.data();\n\n const cpuTensorArray = new arrayType(\n // Cast is needed to avoid 'SharedArrayBuffer' in the type.\n cpuTensorUint8Array.buffer as ArrayBuffer, cpuTensorUint8Array.byteOffset,\n data.length);\n cpuTensorArray.set(data);\n\n return cpuTensor;\n}\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {Accelerator} from './constants';\nimport {Tensor, TensorTypeError} from './tensor';\nimport type {EmscriptenVector, SignatureRunnerWrapper, TensorWrapper} from './wasm_binding_types';\n\n/**\n * A signature of a LiteRT model that can be run like the CompiledModel itself.\n * Every model has at least one signature, but some models have multiple\n * signatures.\n */\nexport abstract class SignatureRunner {\n protected inputTensors = new Map<string, TensorWrapper>();\n protected inputTensorsVector: EmscriptenVector<TensorWrapper>;\n protected outputTensors = new Map<string, TensorWrapper>();\n protected outputTensorsVector: EmscriptenVector<TensorWrapper>;\n abstract readonly accelerator: Accelerator;\n deleted = false;\n\n constructor(\n protected readonly signatureRunnerWrapper: SignatureRunnerWrapper) {\n this.inputTensorsVector = this.signatureRunnerWrapper.inputs();\n for (let i = 0; i < this.inputTensorsVector.size(); ++i) {\n const tensor = this.inputTensorsVector.get(i);\n this.inputTensors.set(tensor.name(), tensor);\n }\n\n this.outputTensorsVector = this.signatureRunnerWrapper.outputs();\n for (let i = 0; i < this.outputTensorsVector.size(); ++i) {\n const tensor = this.outputTensorsVector.get(i);\n this.outputTensors.set(tensor.name(), tensor);\n }\n }\n\n private checkTypes(inputs: Tensor[]): void {\n const inputTensorsList = [...this.inputTensors.values()];\n for (let i = 0; i < inputTensorsList.length; ++i) {\n const tensorWrapper = inputTensorsList[i];\n const tensor = inputs[i];\n const expectedDType = tensorWrapper.type();\n if (expectedDType !== tensor.type.dtype) {\n throw new TensorTypeError(\n tensorWrapper.name(), i, expectedDType, tensor.type.dtype);\n }\n }\n }\n\n /**\n * Runs the signature with the given input tensors and returns the outputs.\n */\n run(input: Tensor|Tensor[]): Tensor[];\n run(input: Record<string, Tensor>): Record<string, Tensor>;\n // Typescript won't automatically distribute a union over the above\n // signatures, so we need to explicitly declare it below.\n // https://github.com/microsoft/TypeScript/issues/14107\n run(input: Tensor|Tensor[]|\n Record<string, Tensor>): Tensor[]|Record<string, Tensor>;\n run(input: Tensor|Tensor[]|\n Record<string, Tensor>): Tensor[]|Record<string, Tensor> {\n if (this.deleted) {\n throw new Error('Signature has been deleted. Please reload the model.');\n }\n let inputArray: Tensor[];\n let shouldReturnArray = true;\n if (Array.isArray(input)) {\n if (input.length !== this.inputTensors.size) {\n throw new Error(\n `run() called with ${input.length} ` +\n `inputs, but signature expects ${this.inputTensors.size} inputs`);\n }\n inputArray = input;\n } else if (input instanceof Tensor) {\n if (this.inputTensors.size !== 1) {\n throw new Error(\n `run() called with a single tensor, but signature expects ${\n this.inputTensors.size} inputs`);\n }\n inputArray = [input];\n } else {\n shouldReturnArray = false;\n // Must insert in the same order as the inputTensors map.\n inputArray = [];\n for (const name of this.inputTensors.keys()) {\n const tensor = input[name];\n if (!tensor) {\n throw new Error(`Expected input tensor with name '${\n name}', but none was provided.`);\n }\n inputArray.push(tensor);\n }\n }\n\n this.checkTypes(inputArray);\n const outputArray = this.runWithArray(inputArray);\n\n // In most cases, we return an array of tensors.\n if (shouldReturnArray) {\n return outputArray;\n }\n\n // If the input was a record, we need to return a record of outputs.\n const output: Record<string, Tensor> = {};\n\n // This order of outputTensors.keys() is the same as in the\n // outputTensorsVector (see the constructor) because `Map.prototype.keys`\n // iterates in insertion order.\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map\n const names = [...this.outputTensors.keys()];\n for (let i = 0; i < names.length; i++) {\n output[names[i]] = outputArray[i];\n }\n return output;\n }\n\n protected pushErrorScopes() {\n // Only implemented by subclasses that use the GPU.\n }\n\n protected popErrorScopes(callsite: string) {\n // Only implemented by subclasses that use the GPU.\n }\n\n /**\n * Runs the default signature of the model with the given input tensors and\n * returns the outputs.\n */\n protected runWithArray(input: Tensor[]): Tensor[] {\n const tensors = this.signatureRunnerWrapper.makeTensorVector();\n for (const tensor of input) {\n // TODO: Assert this is a DriftTensor.\n tensors.push_back(tensor.reference);\n }\n\n // Perform input copy.\n this.pushErrorScopes();\n this.signatureRunnerWrapper.copyInputs(tensors);\n this.popErrorScopes('copyInputs');\n\n tensors.delete();\n\n // Actually run the signature.\n this.pushErrorScopes();\n this.signatureRunnerWrapper.invoke();\n this.popErrorScopes('invoke');\n\n // Copy tensors from the interpreter.\n this.pushErrorScopes();\n const outputTensorReferences = this.signatureRunnerWrapper.copyOutputs();\n this.popErrorScopes('copyOutputs');\n\n const output: Tensor[] = [];\n for (let i = 0; i < this.outputTensorsVector.size(); ++i) {\n const tensorWrapper = this.outputTensorsVector.get(i);\n const tensorReference = outputTensorReferences.get(i);\n output.push(new Tensor({\n type: {\n dtype: tensorWrapper.type(),\n layout: {dimensions: tensorWrapper.shape()}\n },\n accelerator: tensorWrapper.accelerator(),\n reference: tensorReference,\n }));\n tensorWrapper.delete(); // Free this copy from the `.get` call.\n // Do not free the tensorReference here since it has been passed to the\n // output Tensor. It will be freed when the Tensor is freed.\n }\n outputTensorReferences.delete();\n\n return output;\n }\n\n /**\n * Get details about each input tensor.\n */\n getInputDetails() {\n return getTensorMapDetails(this.inputTensors);\n }\n\n /**\n * Get details about each output tensor.\n */\n getOutputDetails() {\n return getTensorMapDetails(this.outputTensors);\n }\n\n delete() {\n if (this.deleted) {\n return;\n }\n // Delete all the copies\n for (const tensor of this.inputTensors.values()) {\n tensor.delete();\n }\n this.inputTensors.clear();\n this.inputTensorsVector.delete();\n\n for (const tensor of this.outputTensors.values()) {\n tensor.delete();\n }\n this.outputTensors.clear();\n this.outputTensorsVector.delete();\n\n this.deleted = true;\n // Note that we don't delete the signatureRunnerWrapper here since it's a\n // reference owned by the interpreter.\n }\n}\n\nfunction getTensorMapDetails(tensors: Map<string, TensorWrapper>) {\n return [...tensors.entries()].map(\n ([name, tensor], index) =>\n ({name, index, shape: tensor.shape(), dtype: tensor.type()}));\n}\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Accelerator} from './constants';\nimport {SignatureRunner} from './signature_runner';\nimport {Tensor, TensorShapeError} from './tensor';\nimport type {SignatureRunnerWrapper} from './wasm_binding_types';\n\n/**\n * A signature runner that runs on the CPU.\n */\nexport class CpuSignatureRunner extends SignatureRunner {\n accelerator: Accelerator = 'wasm';\n\n constructor(signatureRunnerWrapper: SignatureRunnerWrapper) {\n super(signatureRunnerWrapper);\n }\n\n /**\n * Throws an error if the input tensors have different shapes than the\n * signature.\n *\n * Note that this may be overrestrictive since it doesn't account for\n * automatically expanding / contracting dimensions (e.g. [1, 1, 224, 224] vs\n * [224, 224]).\n */\n protected checkShapes(input: Tensor[]): void {\n // TODO: b/393137695 - Write a version that can be applied to the GPU side\n // as well so error messages can be consistent?\n\n let i = 0;\n for (const tensorWrapper of this.inputTensors.values()) {\n const tensor = input[i++];\n const shape = tensor.type.layout.dimensions;\n const expectedShape = tensorWrapper.shape();\n if (expectedShape.length !== shape.length) {\n throw new TensorShapeError(tensorWrapper.name(), expectedShape, shape);\n }\n for (let j = 0; j < shape.length; ++j) {\n if (shape[j] !== expectedShape[j]) {\n throw new TensorShapeError(\n tensorWrapper.name(), expectedShape, shape);\n }\n }\n }\n }\n\n protected override runWithArray(input: Tensor[]): Tensor[] {\n // Since we are not using MLDrift, we need to manually check shapes.\n this.checkShapes(input);\n return super.runWithArray(input);\n }\n}\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Dimensions, DTYPE_TO_ARRAY_TYPE} from './constants';\nimport {getGlobalLiteRt} from './global_litert';\nimport {Tensor} from './tensor';\nimport {CpuTensorReference} from './wasm_binding_types';\n\n/**\n * A box for passing a reference around. This is useful for changing the value\n * of the reference without having to update all the references.\n */\nexport interface Box<T> {\n val: T;\n}\n\n/**\n * Check if the browser supports WebGPU.\n */\nexport function isWebGPUSupported(): boolean {\n return !!(\n typeof globalThis !== 'undefined' && (globalThis.navigator) &&\n (globalThis.navigator.gpu));\n}\n\n/**\n * A callback for reporting GPU errors.\n */\nexport type GpuErrorReporter = (error: GPUError, callsite: string) => void;\n\nconst ERROR_SCOPES = ['internal', 'out-of-memory', 'validation'] as const;\n\n/**\n * Push error scopes for the given device.\n */\nexport function pushErrorScopes(device: GPUDevice) {\n for (const scopeType of ERROR_SCOPES) {\n device.pushErrorScope(scopeType);\n }\n}\n\n/**\n * Pop error scopes for the given device.\n */\nexport function popErrorScopes(\n device: GPUDevice, callsite: string, reportError: GpuErrorReporter) {\n for (let i = 0; i < ERROR_SCOPES.length; ++i) {\n device.popErrorScope().then(error => {\n if (error) {\n reportError(error, callsite);\n }\n });\n }\n}\n\n/**\n * A GPUDevice with the adapterInfo property.\n */\nexport declare interface GPUDeviceWithAdapterInfo extends GPUDevice {\n // TODO: b/423997093 - Update WebGPU types so we don't have to do this.\n adapterInfo: GPUAdapterInfo;\n}\n\n/**\n * Converts a LiteRT tensor shape to a WebGPU tensor shape.\n */\nexport function getBhwcShapeFromInputShape(shape: Dimensions):\n [number, number, number, number] {\n const shape4d: [number, number, number, number] = [1, 1, 1, 1];\n switch (shape.length) {\n case 1:\n shape4d[3] = shape[0];\n break;\n case 2:\n shape4d[3] = shape[1];\n shape4d[2] = shape[0];\n break;\n case 3:\n shape4d[3] = shape[2];\n shape4d[2] = shape[1];\n shape4d[1] = shape[0];\n break;\n case 4:\n shape4d[3] = shape[3];\n shape4d[2] = shape[2];\n shape4d[1] = shape[1];\n shape4d[0] = shape[0];\n break;\n default:\n // TODO: Support higher rank tensors for WebGPU inference, once ML Drift\n // supports it.\n // ML Drift currently only supports 1D~4D tensors for the converted TFLite\n // model inference. LiteRT-Web won't be able to support higher rank\n // tensors for WebGPU accelerator until ML Drift supports it.\n throw new Error(\n 'Only 1D~4D tensors are supported, but got shape: ' +\n shape.toString() + '.');\n }\n return shape4d;\n}\n\n/**\n * Internal helper function for converting a GPU backed tensor to a CPU backed\n * tensor.\n */\nexport async function gpuTensorToCpuTensor(gpuTensor: Tensor): Promise<Tensor> {\n const device = await getGlobalLiteRt().getWebGpuDevice();\n\n // Convert from MLDrift format to a more standard format.\n const converter = getGlobalLiteRt().getConverterFactory().makeConverterToTfjs(\n gpuTensor.reference);\n const buffer: GPUBuffer = converter.convertToTfjs(gpuTensor.reference);\n\n // Create a staging buffer we can read from.\n const stagingBuffer = device.createBuffer({\n size: buffer.size,\n usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST,\n mappedAtCreation: false,\n });\n\n // Copy the GPU buffer to the staging buffer.\n const commandEncoder = device.createCommandEncoder();\n commandEncoder.copyBufferToBuffer(buffer, 0, stagingBuffer, 0, buffer.size);\n device.queue.submit([commandEncoder.finish()]);\n\n // Map the staging buffer to an array buffer.\n await stagingBuffer.mapAsync(GPUMapMode.READ);\n const mappedBuffer = stagingBuffer.getMappedRange();\n const mappedArray = new Uint8Array(mappedBuffer);\n\n // Set the data on the CPU tensor.\n const cpuTensorConstructor = getGlobalLiteRt().liteRtWasm.CpuTensor;\n const cpuTensorReference = new cpuTensorConstructor(mappedArray.byteLength);\n cpuTensorReference.data().set(mappedArray);\n\n stagingBuffer.unmap();\n stagingBuffer.destroy();\n\n return new Tensor({\n type: gpuTensor.type,\n accelerator: 'wasm',\n reference: cpuTensorReference\n });\n}\n\n\n/**\n * Internal helper function for converting a CPU backed tensor to a WebGPU\n * backed tensor.\n */\nexport async function cpuTensorToGpuTensor(\n cpuTensor: Tensor,\n ): Promise<Tensor> {\n // TODO: b/431839967 - Avoid the two staging buffers and make this more\n // efficient.\n // TODO: Make this synchronous.\n const device = await getGlobalLiteRt().getWebGpuDevice();\n\n const cpuTensorData = (cpuTensor.reference as CpuTensorReference).data();\n const typedArrayConstructor = DTYPE_TO_ARRAY_TYPE[cpuTensor.type.dtype];\n const typedArray = new typedArrayConstructor(\n // Cast is needed to avoid 'SharedArrayBuffer' in the type.\n cpuTensorData.buffer as ArrayBuffer,\n cpuTensorData.byteOffset,\n cpuTensorData.length,\n );\n\n // Create a staging buffer we can write to.\n const stagingBuffer = device.createBuffer({\n size: typedArray.byteLength,\n usage: GPUBufferUsage.MAP_WRITE | GPUBufferUsage.COPY_SRC,\n mappedAtCreation: true,\n });\n const mappedBuffer = await stagingBuffer.getMappedRange();\n\n if (typedArray instanceof Float32Array) {\n const mappedArray = new Float32Array(mappedBuffer);\n mappedArray.set(typedArray);\n } else if (typedArray instanceof Int32Array) {\n const mappedArray = new Int32Array(mappedBuffer);\n mappedArray.set(typedArray);\n } else {\n throw new Error(\n 'Unsupported typed array type: ' +\n (typedArray as Uint8Array).constructor.name);\n }\n stagingBuffer.unmap();\n\n // Copy the staging buffer to a temporary buffer that MLDrift can read from.\n const tempBuffer = device.createBuffer({\n size: stagingBuffer.size,\n usage: GPUBufferUsage.COPY_SRC | GPUBufferUsage.COPY_DST |\n GPUBufferUsage.STORAGE,\n });\n const commandEncoder = device.createCommandEncoder();\n commandEncoder.copyBufferToBuffer(\n stagingBuffer, 0, tempBuffer, 0, stagingBuffer.size);\n device.queue.submit([commandEncoder.finish()]);\n stagingBuffer.destroy();\n\n // Copy the temporary buffer to a new WebGPU Tensor.\n const mlDriftShape =\n getBhwcShapeFromInputShape(cpuTensor.type.layout.dimensions);\n const converter =\n getGlobalLiteRt().getConverterFactory().makeConverterFromTfjs(\n cpuTensor.type.dtype, ...mlDriftShape);\n // This submits the command queue, so it's safe to destroy the staging\n // buffer after.\n const gpuTensorReference = converter.convertFromTfjs(tempBuffer);\n tempBuffer.destroy();\n\n return new Tensor({\n type: cpuTensor.type,\n accelerator: 'webgpu',\n reference: gpuTensorReference,\n });\n}\n","/**\n * @fileoverview A memoization utility for JavaScript.\n *\n * This utility provides a function `memoize` that can be used to memoize\n * functions. A memoized function will only be called once for each unique set\n * of arguments, and the result will be cached and returned on subsequent calls.\n *\n * Example usage:\n *\n * ```typescript\n * const memoizedAdd = memoize((a, b) => a + b);\n * console.log(memoizedAdd(1, 2)); // Output: 3\n * console.log(memoizedAdd(1, 2)); // Output: 3\n * ```\n *\n * In this example, the `memoizedAdd` function will only be called once, even\n * though it is called twice. The result of the first call will be cached and\n * returned on the second call.\n *\n * @license\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nclass TreeMap<K, V> extends Map<K, TreeMap<K, V>> {\n val?: V;\n\n constructor() {\n super();\n }\n\n private getMap(key: K[]): TreeMap<K, V>|undefined;\n private getMap(key: K[], createIfMissing: false): TreeMap<K, V>|undefined;\n private getMap(key: K[], createIfMissing: true): TreeMap<K, V>;\n private getMap(key: K[], createIfMissing = false): TreeMap<K, V>|undefined {\n let map: TreeMap<K, V> = this;\n for (let i = 0; i < key.length; i++) {\n if (!map.has(key[i])) {\n if (!createIfMissing) {\n return undefined;\n }\n map.set(key[i], new TreeMap<K, V>());\n }\n map = map.get(key[i])!;\n }\n return map;\n }\n\n getPath(key: K[]): V|undefined {\n return this.getMap(key)?.val;\n }\n\n hasPath(key: K[]): boolean {\n return this.getMap(key) !== undefined;\n }\n\n setPath(key: K[], val: V) {\n const map = this.getMap(key, /* createIfMissing= */ true);\n map.val = val;\n }\n}\n\n/**\n * Memoize a function.\n * @param f The function to memoize.\n * @param getKey A function that takes the arguments to the function and returns\n * a key that uniquely identifies the function call.\n * @returns A memoized function that will only be called once for each unique\n * key.\n */\nexport function memoize<T, Args extends unknown[]>(\n f: (...args: Args) => T,\n getKey: (args: Args) => unknown[] = x => x): (...args: Args) => T {\n const cache = new TreeMap<unknown, T>();\n return (...args: Args): T => {\n const key = getKey(args);\n if (!cache.hasPath(key)) {\n cache.setPath(key, f(...args));\n }\n return cache.getPath(key)!;\n };\n}\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Box, GpuErrorReporter, popErrorScopes, pushErrorScopes} from './gpu_utils';\nimport {memoize} from './memoize';\nimport type {DriftTensor, NativeInputConverter, NativeOutputConverter, OpaqueTensorReference, WebgpuConversionWasm} from './wasm_binding_types';\n\n/**\n * Converter from WebGPU buffers in TF.js tensor format to LiteRT Tensors.\n * Can be made using the ConverterFactory class.\n */\nexport class InputConverter {\n constructor(\n private readonly converter: NativeInputConverter,\n private readonly wasm: WebgpuConversionWasm,\n private readonly gpuErrorReporter: Box<GpuErrorReporter>) {}\n\n convertFromTfjs(buffer: GPUBuffer): OpaqueTensorReference {\n pushErrorScopes(this.wasm.preinitializedWebGPUDevice);\n const bufferPtr = this.wasm.WebGPU.importJsBuffer(buffer);\n const tensor = this.converter.convertFromTfjs(bufferPtr);\n popErrorScopes(\n this.wasm.preinitializedWebGPUDevice, 'convertFromTfjs',\n this.gpuErrorReporter.val);\n return tensor;\n }\n\n delete() {\n this.converter.delete();\n }\n}\n\n/**\n * Converter from LiteRT Tensors to WebGPU buffers in TF.js tensor format.\n * Can be made using the ConverterFactory class.\n */\nexport class OutputConverter {\n constructor(\n private readonly converter: NativeOutputConverter,\n private readonly wasm: WebgpuConversionWasm,\n private readonly gpuErrorReporter: Box<GpuErrorReporter>) {}\n\n convertToTfjs(tensor: OpaqueTensorReference): GPUBuffer {\n pushErrorScopes(this.wasm.preinitializedWebGPUDevice);\n const bufferPtr = this.converter.convertToTfjs(tensor);\n const buffer = this.wasm.WebGPU.getJsObject(bufferPtr);\n popErrorScopes(\n this.wasm.preinitializedWebGPUDevice, 'convertToTfjs',\n this.gpuErrorReporter.val);\n return buffer;\n }\n\n delete() {\n this.converter.delete();\n }\n}\n\n/**\n * Factory for LiteRT WebGPU-based tensor converters.\n */\nexport class ConverterFactory {\n constructor(\n readonly wasm: WebgpuConversionWasm,\n private readonly gpuErrorReporter: Box<GpuErrorReporter>) {}\n\n /**\n * Returns true if this ConverterFactory uses the same WebGPU device as the\n * one passed in.\n */\n isWebGpuDeviceCompatible(device: GPUDevice) {\n return (device === this.wasm.preinitializedWebGPUDevice);\n }\n\n /**\n * Returns an InputConverter for quickly converting WebGPU buffers in TF.js\n * tensor format into the corresponding LiteRT Tensors. Each InputConverter is\n * created for a given type and [B,H,W,C] shape, so the converter can be\n * reused, but only for tensors of the same type and shape.\n */\n makeConverterFromTfjs =\n memoize(this.makeConverterFromTfjsInternal.bind(this));\n\n private makeConverterFromTfjsInternal(\n type: string, b: number, h: number, w: number,\n c: number): InputConverter {\n pushErrorScopes(this.wasm.preinitializedWebGPUDevice);\n const nativeConverter = this.wasm.makeConverterFromTfjs(type, b, h, w, c);\n popErrorScopes(\n this.wasm.preinitializedWebGPUDevice, 'makeConverterFromTfjs',\n this.gpuErrorReporter.val);\n return new InputConverter(\n nativeConverter, this.wasm, this.gpuErrorReporter);\n }\n\n /**\n * Returns an OutputConverter for quickly converting LiteRT Tensors into the\n * the corresponding WebGPU buffer in TF.js tensor format. Each\n * OutputConverter is created to match the specifications of the given Tensor\n * (type and [B,H,W,C] shape), so the converter can be reused, but only for\n * Tensors of the same type and shape.\n */\n makeConverterToTfjs = memoize(\n this.makeConverterToTfjsInternal.bind(this), ([opaqueReference]) => {\n const driftTensor = opaqueReference as DriftTensor;\n return driftTensor.getCacheKey();\n });\n\n private makeConverterToTfjsInternal(tensorReference: OpaqueTensorReference):\n OutputConverter {\n pushErrorScopes(this.wasm.preinitializedWebGPUDevice);\n const nativeConverter = this.wasm.makeConverterToTfjs(tensorReference);\n popErrorScopes(\n this.wasm.preinitializedWebGPUDevice, 'makeConverterToTfjs',\n this.gpuErrorReporter.val);\n return new OutputConverter(\n nativeConverter, this.wasm, this.gpuErrorReporter);\n }\n}\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Accelerator} from './constants';\nimport {Box, GpuErrorReporter, popErrorScopes, pushErrorScopes} from './gpu_utils';\nimport {SignatureRunner} from './signature_runner';\nimport type {SignatureRunnerWrapper} from './wasm_binding_types';\n\n/**\n * A signature runner that runs on the GPU.\n */\nexport class GpuSignatureRunner extends SignatureRunner {\n accelerator: Accelerator = 'webgpu';\n\n constructor(\n signatureRunnerWrapper: SignatureRunnerWrapper,\n // TODO: Remove Interpreter from the constructor. It's only here so we can\n // access utilities for GPU input/output copying and making vectors.\n private readonly device: GPUDevice,\n private readonly gpuErrorReporter: Box<GpuErrorReporter>) {\n super(signatureRunnerWrapper);\n }\n\n protected override pushErrorScopes() {\n pushErrorScopes(this.device);\n }\n\n protected override popErrorScopes(callsite: string) {\n popErrorScopes(this.device, callsite, this.gpuErrorReporter.val);\n }\n}\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {WasmModule} from '@litertjs/wasm-utils';\n\nimport {CompiledModel} from './compiled_model';\nimport {Accelerator} from './constants';\nimport {CpuSignatureRunner} from './cpu_signature_runner';\nimport {getGlobalLiteRt} from './global_litert';\nimport {ConverterFactory} from './gpu_conversion';\nimport {GpuSignatureRunner} from './gpu_signature_runner';\nimport {Box, GpuErrorReporter, isWebGPUSupported, popErrorScopes, pushErrorScopes} from './gpu_utils';\nimport type {GPUDeviceWithAdapterInfo} from './gpu_utils';\nimport {ErrorReporter, LiteRtWasm} from './wasm_binding_types';\n\n// These functions wrap the global LiteRT instance's methods and make it easier\n// to call them.\n\n/**\n * WebGPU features that LiteRT.js can use for improved performance.\n */\nconst DESIRED_WEBGPU_FEATURES = [\n 'shader-f16',\n 'subgroups' as GPUFeatureName, // In origin trial\n 'subgroups-f16' as GPUFeatureName, // In origin trial\n] satisfies GPUFeatureName[];\n\n/**\n * Set the error reporter for the global LiteRT instance.\n */\nexport function setErrorReporter(errorReporter: ErrorReporter) {\n getGlobalLiteRt().setErrorReporter(errorReporter);\n}\n\n/**\n * Set the WebGPU error reporter for the global LiteRT instance.\n */\nexport function setGpuErrorReporter(errorReporter: GpuErrorReporter) {\n getGlobalLiteRt().setGpuErrorReporter(errorReporter);\n}\n\n/**\n * Set the WebGPU device for the global LiteRT instance.\n */\nexport function setWebGpuDevice(\n device: GPUDevice, adapterInfo?: GPUAdapterInfo) {\n getGlobalLiteRt().setWebGpuDevice(device, adapterInfo);\n}\n\n/**\n * Get the WebGPU device for the global LiteRT instance.\n */\nexport function getWebGpuDevice(): Promise<GPUDevice> {\n return getGlobalLiteRt().getWebGpuDevice();\n}\n\n/**\n * Get the WebGPU adapter info for the global LiteRT instance.\n */\nexport function getAdapterInfo(): Promise<GPUAdapterInfo> {\n return getGlobalLiteRt().getAdapterInfo();\n}\n\n/**\n * Loads a LiteRt model.\n *\n * @param model The model data. This can be a string (the model url), a URL\n * object, a Uint8Array (the model bytes), or a\n * ReadableStreamDefaultReader (for streaming model loading).\n * @param compileOptions The options for compiling the model. This includes\n * the accelerator to use ('webgpu' or 'wasm') and the WebGPU device\n * (for direct GPU model inputs / outputs).\n * @returns A promise that resolves to the CompiledModel.\n */\nexport function loadAndCompile(\n model: string|URL|Uint8Array|ReadableStreamDefaultReader,\n compileOptions: CompileOptions,\n ): Promise<CompiledModel> {\n return getGlobalLiteRt().loadAndCompile(model, compileOptions);\n}\n\n/**\n * The options for compiling a LiteRt model.\n */\nexport interface CompileOptions {\n accelerator: Accelerator;\n}\n\n/**\n * Run LiteRt models in the browser.\n */\nexport class LiteRt {\n readonly liteRtWasm: LiteRtWasm;\n private device?: GPUDeviceWithAdapterInfo;\n // Boxed so it can be passed as a reference to the signatures and updated\n // later.\n private readonly gpuErrorReporter: Box<GpuErrorReporter> = {\n val: (error, callsite) => {\n console.error('GPU error:', error, 'at:', callsite);\n },\n };\n private loadAndCompileWebGpuWasCalled = false;\n private loadedModels = new Set<CompiledModel>();\n private converterFactory?: ConverterFactory;\n\n constructor(wasmModule: WasmModule) {\n this.liteRtWasm = wasmModule as LiteRtWasm;\n if (!this.liteRtWasm.loadAndCompileWebGpu) {\n throw new Error('loadAndCompileWebGpu is not defined.');\n }\n this.liteRtWasm.setupLogging();\n }\n\n private pushErrorScopes() {\n if (!this.device) {\n throw new Error('No GPU device provided.');\n }\n pushErrorScopes(this.device);\n }\n\n private popErrorScopes(callsite: string) {\n if (!this.device) {\n throw new Error('No GPU device provided.');\n }\n popErrorScopes(this.device, callsite, this.gpuErrorReporter.val);\n }\n\n private static async urlToUint8Array(url: string|URL): Promise<Uint8Array> {\n // TODO(msoulanille): Streaming support for model loading once C++ supports\n // it.\n const response = await fetch(url);\n return new Uint8Array(await response.arrayBuffer());\n }\n\n private static async readableStreamToUint8Array(\n reader: ReadableStreamDefaultReader<Uint8Array>): Promise<Uint8Array> {\n // TODO(msoulanille): Rewrite this when we support streaming directly to\n // WebGPU memory.\n let byteOffset = 0;\n let array = new Uint8Array(1024 /* arbitrary starting size */);\n const MAX_ARRAY_SIZE = 2e9; // Chrome gets flaky with sizes > 2GB.\n\n // Collecting all the chunks and then copying them would be easier, but this\n // is more memory efficient.\n while (true) {\n const {done, value} = await reader.read();\n if (value) {\n if (array.byteLength < byteOffset + value.byteLength) {\n if (byteOffset + value.byteLength > MAX_ARRAY_SIZE) {\n throw new Error(`Model is too large (> ${MAX_ARRAY_SIZE} bytes`);\n }\n\n // Allocate more space, but double the size to avoid reallocating too\n // often.\n // Note: This will not work with huge models since we store everything\n // in one ArrayBuffer, but more things will need to be refactored for\n // those anyway.\n const newArray = new Uint8Array(Math.min(\n MAX_ARRAY_SIZE,\n Math.max(array.byteLength, value.byteLength) * 2));\n newArray.set(array);\n array = newArray;\n }\n array.set(value, byteOffset);\n byteOffset += value.byteLength;\n }\n if (done) {\n break;\n }\n }\n\n // Resize to the exact byte length. Could use `.subarray`, but we'd like to\n // avoid keeping the extra bytes allocated.\n return array.slice(0, byteOffset);\n }\n\n /**\n * Initialize the WebGPU device for LiteRT.\n */\n private async initializeDefaultWebGpuDevice() {\n if (this.device) {\n console.warn('WebGPU device is already initialized.');\n return;\n }\n if (!isWebGPUSupported()) {\n throw new Error('This browser does not support WebGPU.');\n }\n const adapterDescriptor: GPURequestAdapterOptions = {\n powerPreference: 'high-performance',\n };\n const adapter = await navigator.gpu.requestAdapter(adapterDescriptor);\n if (!adapter) {\n throw new Error('No GPU adapter found.');\n }\n const adapterInfo = adapter.info;\n const requiredLimits = {\n maxBufferSize: adapter.limits.maxBufferSize,\n maxStorageBufferBindingSize: adapter.limits.maxStorageBufferBindingSize,\n maxStorageBuffersPerShaderStage:\n adapter.limits.maxStorageBuffersPerShaderStage,\n maxTextureDimension2D: adapter.limits.maxTextureDimension2D,\n };\n\n const requiredFeatures: GPUFeatureName[] = [];\n for (const feature of DESIRED_WEBGPU_FEATURES) {\n if (adapter.features.has(feature)) {\n requiredFeatures.push(feature);\n }\n }\n const device = await adapter.requestDevice({\n requiredFeatures,\n requiredLimits,\n });\n\n // TODO: Remove adapterInfo from the api, as the latest GPUDevice type\n // should have adapterInfo.\n this.setWebGpuDevice(device, adapterInfo);\n }\n /**\n * Set the error reporter for LiteRt.\n */\n setErrorReporter(errorReporter: ErrorReporter) {\n this.liteRtWasm.setErrorReporter(errorReporter);\n }\n\n /**\n * Set the WebGPU error reporter for LiteRt.\n */\n setGpuErrorReporter(errorReporter: GpuErrorReporter) {\n this.gpuErrorReporter.val = errorReporter;\n }\n\n /**\n * Set the WebGPU device and adapter info for LiteRT.\n */\n // TODO: Remove adapterInfo from the api, as the latest GPUDevice type should\n // have adapterInfo.\n setWebGpuDevice(device: GPUDevice, adapterInfo?: GPUAdapterInfo) {\n if (this.loadAndCompileWebGpuWasCalled) {\n throw new Error(\n 'The WebGPU device cannot be set after loading a WebGPU model.');\n }\n\n // TODO: P0, for EAP, Handle GPUDevice error events.\n this.device = device as GPUDeviceWithAdapterInfo;\n // Depending on version of WebGPU/browser, some devices will have\n // readonly adapterInfo, and some will not have this property at all.\n if (!this.device.adapterInfo) {\n if (!adapterInfo) {\n throw new Error(\n 'The device does not have adapter info, so adapterInfo must be provided.');\n }\n this.device.adapterInfo = adapterInfo;\n }\n this.liteRtWasm.preinitializedWebGPUDevice = this.device;\n }\n\n /**\n * Get the WebGPU device that LiteRT is using. If the device is not set,\n * initialize it.\n */\n async getWebGpuDevice(): Promise<GPUDevice> {\n if (!this.device) {\n await this.initializeDefaultWebGpuDevice();\n }\n return this.device!;\n }\n\n /**\n * Get the WebGPU adapter info that LiteRT is using. If the WebGPU device is\n * not set, initialize it.\n */\n async getAdapterInfo(): Promise<GPUAdapterInfo> {\n if (!this.device) {\n await this.initializeDefaultWebGpuDevice();\n }\n return this.device!.adapterInfo!;\n }\n\n /**\n * Loads a LiteRt model.\n *\n * @param model The model data. This can be a string (the model url), a URL\n * object, a Uint8Array (the model bytes), or a\n * ReadableStreamDefaultReader (for streaming model loading).\n * @param compileOptions The options for compiling the model. This includes\n * the accelerator to use ('webgpu' or 'wasm') and the WebGPU device\n * (for direct GPU model inputs / outputs).\n * @returns A promise that resolves to the CompiledModel.\n */\n async loadAndCompile(\n model: string|URL|Uint8Array|ReadableStreamDefaultReader<Uint8Array>,\n compileOptions: CompileOptions): Promise<CompiledModel> {\n // TODO: make `compileOptions` parameter optional.\n // Note: This will definitely be async in the future and will likely change.\n let modelData: Uint8Array;\n if (typeof model === 'string' || model instanceof URL) {\n modelData = await LiteRt.urlToUint8Array(model);\n } else if (model instanceof Uint8Array) {\n modelData = model;\n } else if (model instanceof ReadableStreamDefaultReader) {\n modelData = await LiteRt.readableStreamToUint8Array(model);\n } else {\n throw new Error('Unsupported model type.');\n }\n\n const ptr = this.liteRtWasm._malloc(modelData.byteLength);\n this.liteRtWasm.HEAPU8.set(modelData, ptr);\n let compiledModel: CompiledModel;\n const onDelete = () => {\n this.liteRtWasm._free(ptr);\n this.loadedModels.delete(compiledModel);\n };\n // Pipe WebGPU device into the Wasm module.\n if (compileOptions.accelerator === 'webgpu') {\n if (!this.liteRtWasm.preinitializedWebGPUDevice) {\n await this.initializeDefaultWebGpuDevice();\n }\n\n this.pushErrorScopes();\n this.loadAndCompileWebGpuWasCalled = true;\n const liteRtInterpreter =\n this.liteRtWasm.loadAndCompileWebGpu(ptr, modelData.byteLength);\n this.popErrorScopes('loadAndCompile');\n compiledModel =\n new CompiledModel(liteRtInterpreter, (signatureRunnerWrapper) => {\n if (!this.device) {\n throw new Error('No GPU device provided.');\n }\n return new GpuSignatureRunner(\n signatureRunnerWrapper, this.device, this.gpuErrorReporter);\n }, onDelete);\n } else {\n const liteRtInterpreter =\n this.liteRtWasm.loadAndCompileCpu(ptr, modelData.byteLength);\n compiledModel =\n new CompiledModel(liteRtInterpreter, (signatureRunnerWrapper) => {\n return new CpuSignatureRunner(signatureRunnerWrapper);\n }, onDelete);\n }\n\n this.loadedModels.add(compiledModel);\n return compiledModel;\n }\n\n /**\n * Gets or creates a ConverterFactory for our tensor converters.\n */\n getConverterFactory(): ConverterFactory {\n if (!this.converterFactory) {\n this.converterFactory =\n new ConverterFactory(this.liteRtWasm, this.gpuErrorReporter);\n }\n return this.converterFactory;\n }\n\n /**\n * Delete the LiteRt wasm module and all loaded models.\n */\n delete() {\n for (const model of this.loadedModels) {\n model.delete();\n } // models automatically remove themselves from the loadedModels set.\n }\n}\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Checks for relaxed SIMD support.\n *\n * (module\n * (func (result v128)\n * i32.const 1\n * i8x16.splat\n * i32.const 2\n * i8x16.splat\n * i8x16.relaxed_swizzle\n * )\n * )\n */\nconst WASM_RELAXED_SIMD_CHECK = new Uint8Array([\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1,\n 0, 10, 15, 1, 13, 0, 65, 1, 253, 15, 65, 2, 253, 15, 253, 128, 2, 11\n]);\n\n/**\n * Checks for WebAssembly Pthreads emulation.\n *\n * (module\n * (memory 1 1 shared)\n * (func\n * i32.const 0\n * i32.atomic.load\n * drop\n * )\n * )\n */\nconst WASM_THREADS_CHECK = new Uint8Array([\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5,\n 4, 1, 3, 1, 1, 10, 11, 1, 9, 0, 65, 0, 254, 16, 2, 0, 26, 11\n]);\n\ninterface SupportStatus {\n supported: boolean;\n error?: Error;\n}\n\n// This must use 'declare' to prevent property renaming since string keys are\n// used to access these properties.\ndeclare interface WasmFeatureValues {\n relaxedSimd: Promise<SupportStatus>|undefined;\n threads: Promise<SupportStatus>|undefined;\n}\n\nconst WASM_FEATURE_VALUES: WasmFeatureValues = {\n 'relaxedSimd': undefined,\n 'threads': undefined,\n};\n\nasync function tryWasm(wasm: Uint8Array): Promise<SupportStatus> {\n try {\n await WebAssembly.instantiate(wasm);\n return {supported: true};\n } catch (e) {\n return {supported: false, error: e as Error};\n }\n}\n\nconst WASM_FEATURE_CHECKS:\n Record<keyof typeof WASM_FEATURE_VALUES, () => Promise<SupportStatus>> = {\n 'relaxedSimd': () => {\n if (WASM_FEATURE_VALUES.relaxedSimd === undefined) {\n WASM_FEATURE_VALUES.relaxedSimd = tryWasm(WASM_RELAXED_SIMD_CHECK);\n }\n return WASM_FEATURE_VALUES.relaxedSimd!;\n },\n 'threads': () => {\n if (WASM_FEATURE_VALUES.threads === undefined) {\n try {\n if (typeof MessageChannel !== 'undefined') {\n new MessageChannel().port1.postMessage(new SharedArrayBuffer(1));\n }\n WASM_FEATURE_VALUES.threads = tryWasm(WASM_THREADS_CHECK);\n } catch (e) {\n WASM_FEATURE_VALUES.threads =\n Promise.resolve({supported: false, error: e as Error});\n }\n }\n return WASM_FEATURE_VALUES.threads!;\n },\n };\n\n/**\n * Check if a given WASM feature is supported.\n *\n * @param feature The feature to check.\n * @return A promise that resolves to true if the feature is supported,\n * false otherwise.\n */\nexport async function supportsFeature(\n feature: keyof typeof WASM_FEATURE_CHECKS): Promise<boolean> {\n const check = WASM_FEATURE_CHECKS[feature]?.();\n if (!check) {\n // Then we don't know how to check for this feature.\n throw new Error(`Unknown feature: ${feature}`);\n }\n return (await check).supported;\n}\n\n/**\n * Throw an error if a given WASM feature is not supported.\n *\n * @param feature The feature to check.\n * @throws An error if the feature is not supported.\n */\nexport async function throwIfFeatureNotSupported(\n feature: keyof typeof WASM_FEATURE_CHECKS): Promise<void> {\n const check = WASM_FEATURE_CHECKS[feature]?.();\n if (!check) {\n // Then we don't know how to check for this feature.\n throw new Error(`Unknown feature: ${feature}`);\n }\n const result = await check;\n if (!result.supported) {\n throw result.error!;\n }\n}\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {createWasmLib} from '@litertjs/wasm-utils';\n\nimport {LiteRt} from './litert_web';\nimport {appendPathSegment, pathToString, UrlPath} from './url_path_utils';\nimport {supportsFeature, throwIfFeatureNotSupported} from './wasm_feature_detect';\n\nconst WASM_JS_FILE_NAME = 'litert_wasm_internal.js';\nconst WASM_JS_COMPAT_FILE_NAME = 'litert_wasm_compat_internal.js';\nconst WASM_JS_THREADED_FILE_NAME = 'litert_wasm_threaded_internal.js';\n\n/**\n * Options for loading LiteRT's Wasm module.\n *\n * @property threads Whether to load the threaded version of the Wasm module.\n * Defaults to false. Unused when specifying a .js file directly instead of\n * a directory containing the Wasm files.\n **/\nexport interface LoadOptions {\n threads?: boolean;\n}\n\n/**\n * Load the LiteRt library with WASM from the given URL. Does not set the\n * global LiteRT instance.\n */\nexport async function load(\n path: UrlPath, options?: LoadOptions): Promise<LiteRt> {\n const pathString = pathToString(path);\n const isFullFilePath =\n pathString.endsWith('.wasm') || pathString.endsWith('.js');\n\n const relaxedSimd = await supportsFeature('relaxedSimd');\n if (options?.threads) {\n if (isFullFilePath) {\n console.warn(\n `The \\`threads\\` option was specified, but the wasm path ${\n pathString} is a full ` +\n `file path. Whether threads are available or not will depend on the ` +\n `loaded file. To allow LiteRT.js to load the threaded wasm file, ` +\n `use a directory path instead of a full file path.`);\n }\n if (!relaxedSimd) {\n throw new Error(\n 'Threads are only supported with relaxed SIMD, and the current ' +\n 'browser does not support relaxed SIMD.');\n }\n await throwIfFeatureNotSupported('threads');\n }\n\n let fileName = WASM_JS_COMPAT_FILE_NAME;\n if (relaxedSimd) {\n if (options?.threads) {\n fileName = WASM_JS_THREADED_FILE_NAME;\n } else {\n fileName = WASM_JS_FILE_NAME;\n }\n }\n\n let jsFilePath = path;\n if (pathString.endsWith('.wasm')) {\n throw new Error(\n 'Please load the `.js` file corresponding to the `.wasm` file, or ' +\n 'load the directory containing it.');\n } else if (!pathString.endsWith('.js')) {\n jsFilePath = appendPathSegment(path, fileName);\n }\n\n return createWasmLib(LiteRt, jsFilePath);\n}","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Type for a path to a resource.\n */\nexport type UrlPath = string;\n\n/**\n * Returns the string representation of the given url path.\n */\nexport function pathToString(path: UrlPath): string {\n return path;\n}\n\n/**\n * Appends a path segment to the given url path.\n */\nexport function appendPathSegment(path: UrlPath, segment: string): string {\n if (!path) return segment;\n if (!segment) return path;\n\n const pathWithSlash = path.endsWith('/') ? path : path + '/';\n const segmentWithoutSlash =\n segment.startsWith('/') ? segment.substring(1) : segment;\n return pathWithSlash + segmentWithoutSlash;\n}","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Placeholder for internal dependency on trusted resource url type\n\nimport {getGlobalLiteRt, getGlobalLiteRtPromise, hasGlobalLiteRt, hasGlobalLiteRtPromise, setGlobalLiteRt, setGlobalLiteRtPromise} from './global_litert';\nimport {LiteRt} from './litert_web';\nimport {load, LoadOptions} from './load';\n\ntype UrlString = string;\n\n/**\n * Options for loading LiteRT.\n *\n * @property threads Whether to load the threaded version of the Wasm module.\n * Defaults to false. Unused when specifying a .js file directly instead of\n * a directory containing the Wasm files.\n **/\nexport interface LoadLiteRtOptions extends LoadOptions {}\n\n/**\n * Load LiteRT.js Wasm files from the given URL. This needs to be called before\n * calling any other LiteRT functions.\n *\n * The URL can be:\n *\n * - A directory containing the LiteRT Wasm files (e.g. `.../wasm/`), or\n * - The LiteRT Wasm's js file (e.g. `.../litert_wasm_internal.js`)\n *\n * If the URL is to a directory, LiteRT.js will detect what WASM features are\n * available in the browser and load the compatible WASM file. If the URL is\n * to a file, it will be loaded as is.\n *\n * @param path The path to the directory containing the LiteRT Wasm files, or\n * the full URL of the LiteRT Wasm .js file.\n */\nexport function loadLiteRt(\n path: UrlString, options?: LoadLiteRtOptions): Promise<LiteRt> {\n if (hasGlobalLiteRtPromise()) {\n throw new Error('LiteRT is already loading / loaded.');\n }\n setGlobalLiteRtPromise(load(path, options)\n .then(liteRt => {\n setGlobalLiteRt(liteRt);\n return liteRt;\n })\n .catch(error => {\n setGlobalLiteRtPromise(undefined);\n throw error;\n }));\n return getGlobalLiteRtPromise()!;\n}\n\n/**\n * Unload the LiteRt WASM module.\n *\n * This deletes the global LiteRT instance and invalidate any models,\n * signatures, and tensors associated with it. You will need to call\n * loadLiteRt() again to reload the module.\n */\nexport function unloadLiteRt(): void {\n if (hasGlobalLiteRtPromise() && !hasGlobalLiteRt()) {\n throw new Error(\n 'LiteRT is loading and can not be unloaded or canceled ' +\n 'until it is finished loading.');\n }\n\n if (hasGlobalLiteRt()) {\n getGlobalLiteRt().delete();\n setGlobalLiteRt(undefined);\n }\n setGlobalLiteRtPromise(undefined);\n}\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {cpuTensorToGpuTensor, gpuTensorToCpuTensor} from './gpu_utils';\nimport {Tensor} from './tensor';\n\n/**\n * Registers functions to copy tensors between the CPU and WebGPU accelerators.\n */\nexport function registerCopyFunctions() {\n Tensor.copyFunctions['wasm'] = {\n 'webgpu': {\n copyTo: cpuTensorToGpuTensor,\n moveTo: async (tensor: Tensor) => {\n const gpuTensor = await cpuTensorToGpuTensor(tensor);\n tensor.delete();\n return gpuTensor;\n },\n },\n };\n Tensor.copyFunctions['webgpu'] = {\n 'wasm': {\n copyTo: gpuTensorToCpuTensor,\n moveTo: async (tensor: Tensor) => {\n const cpuTensor = await gpuTensorToCpuTensor(tensor);\n tensor.delete();\n return cpuTensor;\n }\n },\n };\n}\n"]}
demo/assets/litertjs-tfjs-interop-1.0.1_esm.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.
3
+ * Original file: /npm/@litertjs/tfjs-interop@1.0.1/dist/index.js
4
+ *
5
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6
+ */
7
+ import{DTYPE_TO_ARRAY_TYPE as e,Tensor as t,SUPPORTED_DTYPES as r,SignatureRunner as n,getGlobalLiteRt as o,LiteRtNotLoadedError as s}from"/assets/litertjs-core-0.2.1_esm.js";import*as a from"/assets/tfjs-core-4.22.0_esm.js";var i=class extends Error{tensor;originalMessage;constructor(e){super(e),this.originalMessage=e}setTensor(e){this.message=`For tensor ${e}: ${this.originalMessage}`,this.tensor=e}};function c(){try{return o().getConverterFactory()}catch(e){if(e instanceof s)throw console.error("You must load a global LiteRT instance before calling conversion functions without a liteRt parameter."),e;throw e}}function u(e){switch(e){case"float32":return"float32";case"int32":return"int32";default:throw new Error(`Unsupported type: ${e}. You may need to cast to int32 or float32.`)}}function f(n,o="webgpu",s){if("wasm"===o)return function(r,n){const o=u(r.dtype),s=e[o];if("webgpu"===a.getBackend()){const e=a.backend();if(e.tensorMap.has(r.dataId)){if(!e.tensorMap.get(r.dataId).values)throw new i("TFJS tensor data is on WebGPU but not on CPU. You must first call `await tensor.data();` to cache the tensor on CPU. Then, you can use the tensor with the LiteRT.js Wasm backend.")}}const c=r.dataSync(),f=new n.wasm.CpuTensor(c.length*s.BYTES_PER_ELEMENT),p=f.data();return new s(p.buffer,p.byteOffset,c.length).set(c),new t({type:{dtype:o,layout:{dimensions:r.shape}},accelerator:"wasm",reference:f})}(n,s?s.getConverterFactory():c());if("webgpu"===o)return function(e,n){if("webgpu"!==a.getBackend())throw new i("Only the TFJS WebGPU backend is supported when converting to WebGPU LiteRT tensors.");const o=a.backend();if(!n.isWebGpuDeviceCompatible(o.device))throw new Error("In order to convert from TFJS to LiteRT, both libraries must be initialized to use the same WebGPU device.");o.tensorMap.get(e.dataId)?.resource||o.uploadToGPU(e.dataId);const s=e.dataToGPU(),c=s.buffer;if(!c)throw new i("TFJS tensor did not have a GPU buffer.");if(!r.has(e.dtype))throw new i("Unsupported type: "+e.dtype+".");const f=function(e){const t=[1,1,1,1];switch(e.shape.length){case 1:t[3]=e.shape[0];break;case 2:t[3]=e.shape[1],t[2]=e.shape[0];break;case 3:t[3]=e.shape[2],t[2]=e.shape[1],t[1]=e.shape[0];break;case 4:t[3]=e.shape[3],t[2]=e.shape[2],t[1]=e.shape[1],t[0]=e.shape[0];break;default:throw new Error("Only 1D~4D tensors are supported, but got shape: "+e.shape.toString()+".")}return t}(e),p=n.makeConverterFromTfjs(e.dtype,f[0],f[1],f[2],f[3]),d=p.convertFromTfjs(c);return s.tensorRef.dispose(),new t({type:{dtype:u(e.dtype),layout:{dimensions:f}},accelerator:"webgpu",reference:d})}(n,s?s.getConverterFactory():c());throw new Error("Unsupported accelerator: "+o)}function p(t,r){if("webgpu"===t.accelerator)return function(e,t){if("webgpu"!==a.getBackend())throw new Error("Only WebGPU backend is supported.");const r=a.backend();if(!t.isWebGpuDeviceCompatible(r.device))throw new Error("In order to convert from LiteRT to TFJS, both libraries must be initialized to use the same WebGPU device.");const n=t.makeConverterToTfjs(e.reference),o=n.convertToTfjs(e.reference),s=a.tensor({buffer:o},[...e.type.layout.dimensions],e.type.dtype);return s}(t,r?r.getConverterFactory():c());if("wasm"===t.accelerator)return function(t,r){const n=t.reference;if(!(n instanceof r.wasm.CpuTensor))throw new i("Tensor reference is not a CpuTensor.");const o=n.data(),s=e[t.type.dtype],c=new s(o.buffer,o.byteOffset,o.length/s.BYTES_PER_ELEMENT);return a.tensor(c.slice(),[...t.type.layout.dimensions],t.type.dtype)}(t,r?r.getConverterFactory():c());throw new Error("Unsupported accelerator: "+t.accelerator)}function d(e,t,r){return r(e)?t(e):Array.isArray(e)?e.map(t):Object.fromEntries(Object.entries(e).map((([e,r])=>[e,t(r,e)])))}function h(e,r){return d(e,r,(e=>e instanceof t))}function l(e,t,r,o){let s,c,u;"string"==typeof t?(s=t,c=r,u=o):(c=t,u=r);const l=d(c,((t,r)=>{try{return f(t,e.accelerator,u)}catch(e){throw e instanceof i&&void 0!==r&&e.setTensor(r),e}}),(e=>e instanceof a.Tensor));let w;if(s){if(e instanceof n)throw new Error("Signature specified but a SignatureRunner was passed instead of a model");w=e.run(s,l)}else w=e.run(l);return h(l,(e=>{e.delete()})),h(w,((e,t)=>{let r;try{r=p(e,u)}catch(e){throw e instanceof i&&void 0!==t&&e.setTensor(t),e}finally{e.delete()}return r}))}export{i as TensorConversionError,p as litertToTfjs,l as runWithTfjsTensors,f as tfjsToLitert};export default null;
8
+ //# sourceMappingURL=litertjs-tfjs-interop-1.0.1_esm.js.map
demo/assets/litertjs-tfjs-interop-1.0.1_esm.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"sources":["jsdelivr-header.js","/npm/@litertjs/tfjs-interop@1.0.1/src/tfjs_interop.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,oOCiBa,IAAA,EAAN,cAAoC,MACzC,OACQ,gBAER,WAAA,CAAY,GACV,MAAM,GACN,KAAK,gBAAkB,CAAA,CAGzB,SAAA,CAAU,GACR,KAAK,QAAU,cAAc,MAAW,KAAK,kBAC7C,KAAK,OAAS,CAAA,GAIlB,SAAS,IACH,IACK,OAAA,IAAkB,qBAAoB,OACtC,GACP,GAAI,aAAa,EAIT,MAHE,QAAA,MACJ,0GAEE,EAEF,MAAA,CAAA,CAEV,CAEA,SAAS,EAAkB,GACzB,OAAQ,GACN,IAAK,UACI,gBACT,IAAK,QACI,cACT,QACE,MAAM,IAAI,MACN,qBAAqB,gDAG/B,CAgDO,SAAS,EACZ,EAAuB,EAA2B,SAClD,GACF,GAAoB,SAAhB,EACK,OAYX,SACI,EAAuB,GAOnB,MAAA,EAAQ,EAAkB,EAAW,OACrC,EAAY,EAAoB,GAE/B,GAAiB,WAAjB,EAAA,aAA2B,CAChC,MAAM,EAAa,EAAQ,UAC3B,GAAI,EAAQ,UAAU,IAAI,EAAW,QAAS,CAExC,IADe,E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MAAM,IAAI,MAAM,4BAA8B,EAAO,YAEzD,CA4EA,SAAS,EACL,EAAM,EACN,GACE,OAAA,EAAI,GACC,EAAE,GACA,MAAM,QAAQ,GAChB,EAAE,IAAI,GAEN,OAAO,YAAY,OAAO,QAAQ,GACV,KAAI,EAAE,EAAK,KAAO,CAAC,EAAK,EAAE,EAAG,MAGhE,CAsBA,SAAS,EACL,EAAM,GAER,OAAO,EAAe,EAAG,GAAI,GAAQ,aAAe,GACtD,CAoCO,SAAS,EACZ,EACA,EAEA,EACA,GACE,IAAA,EACA,EACA,EACgC,iBAAzB,GACG,EAAA,EACC,EAAA,EACJ,EAAA,IAEI,EAAA,EACJ,EAAA,GAIX,MAAM,EArEC,EAqEkB,GAAY,CAAC,EAAY,KAC5C,IACF,OAAO,EAAa,EAAY,EAAM,YAAa,EAAM,OAClD,GAID,MAHF,aAAa,QAAwC,IAAf,GACxC,EAAE,UAAU,GAER,CAAA,KA5EmB,GAAQ,aAAkB,EAAM,SAiFzD,IAAA,EACJ,GAAI,EAAW,CACb,GAAI,aAAiB,EACnB,MAAM,IAAI,MACN,2EAGI,EAAA,EAAM,IAAI,EAAW,EAAM,MAE3B,EAAA,EAAM,IAAI,GAStB,OALY,EAAA,GAAQ,IAClB,EAAO,QAAO,IAIT,EAAY,GAAS,CAAC,EAAQ,KAC/B,IAAA,EACA,IACW,EAAA,EAAa,EAAQ,EAAM,OACjC,GAID,MAHF,aAAa,QAAwC,IAAf,GACxC,EAAE,UAAU,GAER,CAAA,CACN,QAGA,EAAO,QAAO,CAET,OAAA,CAAA,GAEX,Q","file":"/npm/@litertjs/tfjs-interop@1.0.1/dist/index.js/+esm","sourceRoot":"","sourcesContent":["/**\n * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.\n * Original file: /npm/@litertjs/tfjs-interop@1.0.1/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Accelerator, CompiledModel, ConverterFactory, CpuTensorReference, DType, DTYPE_TO_ARRAY_TYPE, getGlobalLiteRt, LiteRt, LiteRtNotLoadedError, SignatureRunner, SUPPORTED_DTYPES, Tensor} from '@litertjs/core';\nimport type {WebGPUBackend} from '@tensorflow/tfjs-backend-webgpu';\nimport * as tf from '@tensorflow/tfjs-core';\n\n/**\n * Error thrown when a tensor can not be converted between TFJS and LiteRT.\n */\nexport class TensorConversionError extends Error {\n tensor?: string|number;\n private originalMessage: string;\n\n constructor(message: string) {\n super(message);\n this.originalMessage = message;\n }\n\n setTensor(tensor: string|number) {\n this.message = `For tensor ${tensor}: ${this.originalMessage}`;\n this.tensor = tensor;\n }\n}\n\nfunction getConverterFactory(): ConverterFactory {\n try {\n return getGlobalLiteRt().getConverterFactory();\n } catch (e) {\n if (e instanceof LiteRtNotLoadedError) {\n console.error(\n `You must load a global LiteRT instance before calling ` +\n `conversion functions without a liteRt parameter.`);\n throw e;\n }\n throw e;\n }\n}\n\nfunction tfjsDtypeToLiteRt(tfjsDtype: tf.DataType): DType {\n switch (tfjsDtype) {\n case 'float32':\n return 'float32';\n case 'int32':\n return 'int32';\n default:\n throw new Error(\n `Unsupported type: ${tfjsDtype}. You may need to cast ` +\n 'to int32 or float32.');\n }\n}\n\nfunction getBhwcShapeForTfjs(tfjsTensor: tf.Tensor):\n [number, number, number, number] {\n const shape4d: [number, number, number, number] = [1, 1, 1, 1];\n switch (tfjsTensor.shape.length) {\n case 1:\n shape4d[3] = tfjsTensor.shape[0];\n break;\n case 2:\n shape4d[3] = tfjsTensor.shape[1];\n shape4d[2] = tfjsTensor.shape[0];\n break;\n case 3:\n shape4d[3] = tfjsTensor.shape[2];\n shape4d[2] = tfjsTensor.shape[1];\n shape4d[1] = tfjsTensor.shape[0];\n break;\n case 4:\n shape4d[3] = tfjsTensor.shape[3];\n shape4d[2] = tfjsTensor.shape[2];\n shape4d[1] = tfjsTensor.shape[1];\n shape4d[0] = tfjsTensor.shape[0];\n break;\n default:\n // TODO: Support higher rank tensors for WebGPU inference, once ML Drift\n // supports it.\n // ML Drift currently only supports 1D~4D tensors for the converted TFLite\n // model inference. LiteRT-Web won't be able to support higher rank\n // tensors for WebGPU accelerator until ML Drift supports it.\n throw new Error(\n 'Only 1D~4D tensors are supported, but got shape: ' +\n tfjsTensor.shape.toString() + '.');\n }\n return shape4d;\n}\n\n/**\n * Convert a TFJS tensor to a LiteRT tensor on the given accelerator.\n *\n * When converting from TFJS WebGPU to LiteRT Wasm CPU, first call\n * `await tensor.data()` to make sure the data is on CPU.\n *\n * Converting from TFJS to LiteRT WebGPU is only supported when using the TFJS\n * WebGPU backend. If you need to create WebGPU tensors from another TFJS\n * backend, copy them to the `wasm` accelerator and then convert them with\n * `litertTensor.moveTo('webgpu');`.\n */\nexport function tfjsToLitert(\n tfjsTensor: tf.Tensor, accelerator: Accelerator = 'webgpu',\n liteRt?: LiteRt): Tensor {\n if (accelerator === 'wasm') {\n return tfjsToLitertCpu(\n tfjsTensor,\n liteRt ? liteRt.getConverterFactory() : getConverterFactory());\n } else if (accelerator === 'webgpu') {\n return tfjsToLitertWebGpu(\n tfjsTensor,\n liteRt ? liteRt.getConverterFactory() : getConverterFactory());\n } else {\n throw new Error('Unsupported accelerator: ' + accelerator);\n }\n}\n\nfunction tfjsToLitertCpu(\n tfjsTensor: tf.Tensor, converterFactory: ConverterFactory): Tensor {\n // TODO: Warn the user that, if they're using the WebGPU backend, they should\n // run `await tensor.data()` on the tensors that aren't already on CPU.\n // Otherwise, this will be expensive.\n // In most cases, the data is already on CPU, but if it comes from another\n // model or a complex preprocessing pipeline, it may be on GPU.\n\n const dtype = tfjsDtypeToLiteRt(tfjsTensor.dtype);\n const arrayType = DTYPE_TO_ARRAY_TYPE[dtype];\n\n if (tf.getBackend() === 'webgpu') {\n const backend = tf.backend() as WebGPUBackend;\n if (backend.tensorMap.has(tfjsTensor.dataId)) {\n const tensorData = backend.tensorMap.get(tfjsTensor.dataId)!;\n if (!tensorData.values) {\n throw new TensorConversionError(\n 'TFJS tensor data is on WebGPU but not on CPU. You must first ' +\n 'call `await tensor.data();` to cache the tensor on CPU. Then, ' +\n 'you can use the tensor with the LiteRT.js Wasm backend.');\n }\n }\n }\n\n const tfjsData = tfjsTensor.dataSync();\n\n const cpuTensor = new converterFactory.wasm.CpuTensor(\n tfjsData.length * arrayType.BYTES_PER_ELEMENT);\n const cpuTensorUint8Array = cpuTensor.data();\n\n const cpuTensorArray = new arrayType(\n cpuTensorUint8Array.buffer as ArrayBuffer,\n cpuTensorUint8Array.byteOffset,\n tfjsData.length);\n cpuTensorArray.set(tfjsData);\n\n return new Tensor({\n type: {\n dtype,\n layout: {\n dimensions: tfjsTensor.shape,\n }\n },\n accelerator: 'wasm',\n reference: cpuTensor,\n });\n}\n\nfunction tfjsToLitertWebGpu(\n tfjsTensor: tf.Tensor, converterFactory: ConverterFactory): Tensor {\n if (tf.getBackend() !== 'webgpu') {\n throw new TensorConversionError(\n 'Only the TFJS WebGPU backend is supported when converting to WebGPU LiteRT tensors.');\n }\n\n const backend = tf.backend() as WebGPUBackend;\n if (!converterFactory.isWebGpuDeviceCompatible(backend.device)) {\n throw new Error(\n 'In order to convert from TFJS to LiteRT, both libraries must ' +\n 'be initialized to use the same WebGPU device.');\n }\n\n // dataToGPU is currently bugged and doesn't work if data is on CPU.\n // TODO(msoulanille): Remove this when dataToGPU is fixed.\n if (!backend.tensorMap.get(tfjsTensor.dataId)?.resource) {\n // Then the data is on CPU. Upload it.\n backend.uploadToGPU(tfjsTensor.dataId);\n }\n\n const gpuData = tfjsTensor.dataToGPU();\n const buffer = gpuData.buffer;\n if (!buffer) {\n throw new TensorConversionError('TFJS tensor did not have a GPU buffer.');\n }\n\n if (!SUPPORTED_DTYPES.has(tfjsTensor.dtype)) {\n throw new TensorConversionError(\n 'Unsupported type: ' + tfjsTensor.dtype + '.');\n }\n const shape4d = getBhwcShapeForTfjs(tfjsTensor);\n const converter = converterFactory.makeConverterFromTfjs(\n tfjsTensor.dtype, shape4d[0], shape4d[1], shape4d[2], shape4d[3]);\n const tensorReference = converter.convertFromTfjs(buffer);\n // Dispose the gpuData tensor to free the buffer it controls. This is okay\n // since `convertFromTfjs` has already submitted the command queue.\n gpuData.tensorRef.dispose();\n\n return new Tensor({\n type: {\n dtype: tfjsDtypeToLiteRt(tfjsTensor.dtype),\n layout: {\n dimensions: shape4d,\n }\n },\n accelerator: 'webgpu',\n reference: tensorReference,\n });\n}\n\n/**\n * Convert a LiteRT tensor to a TFJS tensor.\n *\n * The tensor is copied to the respective TFJS backend.\n * - Wasm CPU tensors will be copied to the TFJS tensor's CPU cache. This is\n * supported on all TFJS backends.\n * - WebGPU tensors will be copied to the TFJS WebGPU backend. This is only\n * supported on the TFJS WebGPU backend.\n */\nexport function litertToTfjs(tensor: Tensor, liteRt?: LiteRt): tf.Tensor {\n if (tensor.accelerator === 'webgpu') {\n return litertToTfjsWebGpu(\n tensor, liteRt ? liteRt.getConverterFactory() : getConverterFactory());\n } else if (tensor.accelerator === 'wasm') {\n return litertToTfjsCpu(\n tensor, liteRt ? liteRt.getConverterFactory() : getConverterFactory());\n } else {\n throw new Error('Unsupported accelerator: ' + tensor.accelerator);\n }\n}\n\nfunction litertToTfjsCpu(\n tensor: Tensor, converterFactory: ConverterFactory): tf.Tensor {\n const cpuTensor = tensor.reference as CpuTensorReference;\n if (!(cpuTensor instanceof converterFactory.wasm.CpuTensor)) {\n throw new TensorConversionError('Tensor reference is not a CpuTensor.');\n }\n\n const cpuTensorUint8Array = cpuTensor.data();\n const arrayType = DTYPE_TO_ARRAY_TYPE[tensor.type.dtype];\n\n const cpuTensorArray = new arrayType(\n cpuTensorUint8Array.buffer as ArrayBuffer, cpuTensorUint8Array.byteOffset,\n cpuTensorUint8Array.length / arrayType.BYTES_PER_ELEMENT);\n\n return tf.tensor(\n // We don't want to share the buffer since TFJS and LiteRT tensors can\n // have different lifetimes.\n cpuTensorArray.slice(),\n /* shape= */[...tensor.type.layout.dimensions],\n /* dtype= */ tensor.type.dtype);\n}\n\nfunction litertToTfjsWebGpu(\n tensor: Tensor, converterFactory: ConverterFactory): tf.Tensor {\n if (tf.getBackend() !== 'webgpu') {\n throw new Error('Only WebGPU backend is supported.');\n }\n\n const backend = tf.backend() as WebGPUBackend;\n if (!converterFactory.isWebGpuDeviceCompatible(backend.device)) {\n throw new Error(\n 'In order to convert from LiteRT to TFJS, both libraries must ' +\n 'be initialized to use the same WebGPU device.');\n }\n\n const converter = converterFactory.makeConverterToTfjs(tensor.reference);\n const buffer = converter.convertToTfjs(tensor.reference);\n\n // Solution could be: (1) fix TFJS's data() API. The size of buffer (MLD may\n // add paddings for stride-4) could be different from the size of the tensor,\n // but TFJS's data() returns an array of the size of the buffer, rather than\n // the size of the tensor. (2) use TFJS ops to strip out the paddings, but it\n // performs an extra GPU operation and has an extra intermdiate buffer.\n const tfjsTensor = tf.tensor(\n {buffer},\n /* shape= */[...tensor.type.layout.dimensions],\n /* dtype= */ tensor.type.dtype);\n\n return tfjsTensor;\n}\n\n/** Container types for tensors passed to / from the model. */\ntype Container<T> = T|Record<string, T>|T[];\n\n// clang-format off\n/**\n * Maps the type for a Container of one value type to a type for a Container of\n * another value type.\n */\ntype MapContainer<T extends Container<unknown>, NewVal> = T extends Array<infer _> ? NewVal[]\n : T extends Record<string, infer _> ? Record<string, NewVal>\n : NewVal;\n// clang-format on\n\n/**\n * Map a Container of one value type to the same Container type of another value\n * type.\n *\n * This is similar to a functor.\n *\n * @param t The Container to map.\n * @param f The function to map each value in the Container.\n * @param isA The function to check if the value is of type A.\n */\nfunction mapOnContainer<A, T extends Container<A>, B>(\n t: T, f: (a: A, keyOrIndex?: string|number) => B,\n isA: (val: unknown) => val is A): MapContainer<T, B> {\n if (isA(t)) {\n return f(t) as MapContainer<T, B>;\n } else if (Array.isArray(t)) {\n return t.map(f) as MapContainer<T, B>;\n } else {\n return Object.fromEntries(Object.entries(t as Record<string, A>)\n .map(([key, a]) => [key, f(a, key)])) as\n MapContainer<T, B>;\n }\n}\n\n/**\n * Map a Container of TFJS tensors to the same Container type but with new\n * values from f.\n *\n * @param t The Container to map.\n * @param f The function to map each value in the Container.\n */\nfunction mapOnTfjs<T extends Container<tf.Tensor>, NewVal>(\n t: T, f: (tfjsTensor: tf.Tensor, keyOrIndex?: string|number) => NewVal):\n MapContainer<T, NewVal> {\n return mapOnContainer(t, f, (val) => val instanceof tf.Tensor);\n}\n\n/**\n * Map a Container of LiteRT tensors to the same Container type but with new\n * values from f.\n *\n * @param t The Container to map.\n * @param f The function to map each value in the Container.\n */\nfunction mapOnLiteRt<T extends Container<Tensor>, NewVal>(\n t: T, f: (liteRtTensor: Tensor, keyOrIndex?: string|number) => NewVal):\n MapContainer<T, NewVal> {\n return mapOnContainer(t, f, (val) => val instanceof Tensor);\n}\n\n/**\n * Run a LiteRT CompiledModel with TFJS inputs and outputs.\n *\n * If a signature name is not provided, the default signature will be used.\n *\n * When calling a Wasm CPU LiteRT model with WebGPU TFJS tensors, please first\n * call `await tensor.data()` on each tensor to more efficiently copy the\n * tensors to CPU.\n */\n// Without signature name\nexport function runWithTfjsTensors(\n model: CompiledModel|SignatureRunner, input: tf.Tensor|tf.Tensor[],\n liteRt?: LiteRt): tf.Tensor[];\nexport function runWithTfjsTensors(\n model: CompiledModel|SignatureRunner, input: Record<string, tf.Tensor>,\n liteRt?: LiteRt): Record<string, tf.Tensor>;\n// With signature name\nexport function runWithTfjsTensors(\n model: CompiledModel, signature: string, input: tf.Tensor|tf.Tensor[],\n liteRt?: LiteRt): tf.Tensor[];\nexport function runWithTfjsTensors(\n model: CompiledModel, signature: string, input: Record<string, tf.Tensor>,\n liteRt?: LiteRt): Record<string, tf.Tensor>;\n// The following signatures are needed since TS won't automatically distribute\n// a union type across the above function signatures.\n// https://github.com/microsoft/TypeScript/issues/14107\nexport function runWithTfjsTensors(\n model: CompiledModel|SignatureRunner,\n input: tf.Tensor|tf.Tensor[]|Record<string, tf.Tensor>,\n liteRt?: LiteRt): tf.Tensor[]|Record<string, tf.Tensor>;\nexport function runWithTfjsTensors(\n model: CompiledModel, signature: string,\n input: tf.Tensor|tf.Tensor[]|Record<string, tf.Tensor>,\n liteRt?: LiteRt): tf.Tensor[]|Record<string, tf.Tensor>;\nexport function runWithTfjsTensors(\n model: CompiledModel|SignatureRunner,\n inputOrSignatureName: string|tf.Tensor|tf.Tensor[]|\n Record<string, tf.Tensor>,\n maybeInputOrLiteRt?: tf.Tensor|tf.Tensor[]|Record<string, tf.Tensor>|LiteRt,\n maybeLiteRt?: LiteRt): tf.Tensor[]|Record<string, tf.Tensor> {\n let signature: string|undefined;\n let tfjsInputs: Record<string, tf.Tensor>|tf.Tensor[]|tf.Tensor;\n let liteRt: LiteRt|undefined;\n if (typeof inputOrSignatureName === 'string') {\n signature = inputOrSignatureName;\n tfjsInputs = maybeInputOrLiteRt as Container<tf.Tensor>;\n liteRt = maybeLiteRt;\n } else {\n tfjsInputs = inputOrSignatureName;\n liteRt = maybeInputOrLiteRt as LiteRt | undefined;\n }\n\n // Convert TFJS inputs to LiteRT tensors.\n const inputs = mapOnTfjs(tfjsInputs, (tfjsTensor, keyOrIndex) => {\n try {\n return tfjsToLitert(tfjsTensor, model.accelerator, liteRt);\n } catch (e) {\n if (e instanceof TensorConversionError && keyOrIndex !== undefined) {\n e.setTensor(keyOrIndex);\n }\n throw e;\n }\n });\n\n // Run the model.\n let outputs: Record<string, Tensor>|Tensor[];\n if (signature) {\n if (model instanceof SignatureRunner) {\n throw new Error(\n 'Signature specified but a SignatureRunner was passed instead of a' +\n ' model');\n }\n outputs = model.run(signature, inputs);\n } else {\n outputs = model.run(inputs);\n }\n\n // Delete all the LiteRT inputs that we created to pass to the model.\n mapOnLiteRt(inputs, tensor => {\n tensor.delete();\n });\n\n // Convert LiteRT outputs to TFJS tensors.\n return mapOnLiteRt(outputs, (tensor, keyOrIndex) => {\n let tfjsTensor: tf.Tensor;\n try {\n tfjsTensor = litertToTfjs(tensor, liteRt);\n } catch (e) {\n if (e instanceof TensorConversionError && keyOrIndex !== undefined) {\n e.setTensor(keyOrIndex);\n }\n throw e;\n } finally {\n // Two outputs will never share the same buffer since we always make\n // a copy.\n tensor.delete();\n }\n return tfjsTensor;\n });\n}\n"]}
demo/assets/litertjs-wasm-utils.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.
3
+ * Original file: /npm/@litertjs/wasm-utils@0.2.1/dist/index.js
4
+ *
5
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6
+ */
7
+ async function e(e){if("function"!=typeof importScripts){const o=document.createElement("script");return o.src=e.toString(),o.crossOrigin="anonymous",new Promise(((e,t)=>{o.addEventListener("load",(()=>{e()}),!1),o.addEventListener("error",(e=>{t(e)}),!1),document.body.appendChild(o)}))}importScripts(e.toString())}var o=async(o,t,r,l,n)=>{if(t&&await e(t),!self.ModuleFactory)throw new Error("ModuleFactory not set.");if(r&&(await e(r),!self.ModuleFactory))throw new Error("ModuleFactory not set.");if(self.Module&&n){const e=self.Module;e.locateFile=n.locateFile,n.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=n.mainScriptUrlOrBlob)}const i=await self.ModuleFactory(self.Module||n);return self.ModuleFactory=self.Module=void 0,new o(i,l)};export{o as createWasmLib};export default null;
8
+ //# sourceMappingURL=litertjs-wasm-utils.js.map
demo/assets/litertjs-wasm-utils.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"sources":["jsdelivr-header.js","/npm/@litertjs/wasm-utils@0.2.0/src/run_script_helper.ts","/npm/@litertjs/wasm-utils@0.2.0/src/wasm_loader.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACmBA,eAAsB,EAAU,GAC1B,GAAyB,mBAAlB,cAEJ,CACC,MAAA,EAAS,SAAS,cAAc,UAGtC,OAFC,EAAwB,IAAM,EAAU,WACzC,EAAO,YAAc,YACd,IAAI,SAAc,CAAC,EAAS,KAC1B,EAAA,iBAAiB,QAAQ,KACtB,GAAA,IACP,GACI,EAAA,iBAAiB,SAAc,IACpC,EAAO,EAAC,IACP,GAGM,SAAA,KAAK,YAAY,EAAM,GACjC,CAfa,cAAA,EAAU,WAiB5B,CC8BO,IAAM,EAAkC,MAC3C,EAA0C,EAC1C,EACA,EACA,KAME,GAJA,SACI,EAAU,IAGb,KAAK,cACF,UAAI,MAAM,0BAKlB,GAAI,UACI,EAAU,IACX,KAAK,eACF,UAAI,MAAM,0BAOhB,GAAA,KAAK,QAAU,EAAa,CAC9B,MAAM,EAAoB,KAAK,OAC/B,EAAkB,WAAa,EAAY,WACvC,EAAY,sBACd,EAAkB,oBAAsB,EAAY,oBACtD,CAIF,MAAM,QACI,KAAK,cAAc,KAAK,QAAyB,GAGpD,OADF,KAAA,cAAgB,KAAK,YAAS,EAC5B,IAAI,EAAe,EAAQ,EAAQ,S","file":"/npm/@litertjs/wasm-utils@0.2.0/dist/index.js/+esm","sourceRoot":"","sourcesContent":["/**\n * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.\n * Original file: /npm/@litertjs/wasm-utils@0.2.0/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Fetches each URL in urls, executes them one-by-one in the order they are\n * passed, and then returns (or throws if something went amiss).\n */\ndeclare function importScripts(...urls: Array<string|URL>): void;\n\n/**\n * Load a script from the given URL.\n */\nexport async function runScript(scriptUrl: string) {\n if (typeof importScripts === 'function') {\n importScripts(scriptUrl.toString());\n } else {\n const script = document.createElement('script');\n (script as {src:string}).src = scriptUrl.toString();\n script.crossOrigin = 'anonymous';\n return new Promise<void>((resolve, revoke) => {\n script.addEventListener('load', () => {\n resolve();\n }, false);\n script.addEventListener('error', e => {\n revoke(e);\n }, false);\n // TODO: b/424626721 - Remove scripts from the DOM after they have\n // loaded.\n document.body.appendChild(script);\n });\n }\n}\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Placeholder for internal dependency on trusted resource url type\n\nimport {runScript} from './run_script_helper';\nimport {WasmModule} from './wasm_module';\n\ntype UrlString = string;\n\n/**\n * Internal type of constructors used for initializing wasm modules.\n */\nexport type WasmConstructor<LibType> =\n (new (\n module: WasmModule, canvas?: HTMLCanvasElement|OffscreenCanvas|null) =>\n LibType);\n\n/**\n * Simple interface for allowing users to set the directory where internal\n * wasm-loading and asset-loading code looks (e.g. for .wasm and .data file\n * locations).\n */\nexport declare interface FileLocator {\n locateFile: (filename: string) => string;\n mainScriptUrlOrBlob?: string;\n}\n\n/**\n * Global function interface to initialize Wasm blob and load runtime assets for\n * a specialized Wasm library. Standard implementation is\n * `createWasmLib<LibType>`.\n * @param constructorFcn The name of the class to instantiate via \"new\".\n * @param wasmLoaderScript Url for the wasm-runner script; produced by the build\n * process.\n * @param assetLoaderScript Url for the asset-loading script; produced by the\n * build process.\n * @param fileLocator A function to override the file locations for assets\n * loaded by the Wasm library.\n * @return promise A promise which will resolve when initialization has\n * completed successfully.\n */\nexport interface CreateWasmLibApi {\n <LibType>(\n constructorFcn: WasmConstructor<LibType>,\n wasmLoaderScript?: UrlString|null, assetLoaderScript?: UrlString|null,\n glCanvas?: HTMLCanvasElement|OffscreenCanvas|null,\n fileLocator?: FileLocator): Promise<LibType>;\n}\n\n// Global declarations, for tapping into Window for Wasm blob running\ndeclare global {\n interface Window {\n // Created by us using wasm-runner script\n Module?: WasmModule|FileLocator;\n // Created by wasm-runner script\n ModuleFactory?: (fileLocator: FileLocator) => Promise<WasmModule>;\n }\n}\n\n/** {@override CreateWasmLibApi} */\nexport const createWasmLib: CreateWasmLibApi = async<LibType>(\n constructorFcn: WasmConstructor<LibType>, wasmLoaderScript?: UrlString|null,\n assetLoaderScript?: UrlString|null,\n glCanvas?: HTMLCanvasElement|OffscreenCanvas|null,\n fileLocator?: FileLocator): Promise<LibType> => {\n // Run wasm-loader script here\n if (wasmLoaderScript) {\n await runScript(wasmLoaderScript);\n }\n\n if (!self.ModuleFactory) {\n throw new Error('ModuleFactory not set.');\n }\n\n // Run asset-loader script here; must be run after wasm-loader script if we\n // are re-wrapping the existing MODULARIZE export.\n if (assetLoaderScript) {\n await runScript(assetLoaderScript);\n if (!self.ModuleFactory) {\n throw new Error('ModuleFactory not set.');\n }\n }\n\n // Until asset scripts work nicely with MODULARIZE, when we are given both\n // self.Module and a fileLocator, we manually merge them into self.Module and\n // use that. TODO(b/277980571): Remove this when asset scripts are fixed.\n if (self.Module && fileLocator) {\n const moduleFileLocator = self.Module as FileLocator;\n moduleFileLocator.locateFile = fileLocator.locateFile;\n if (fileLocator.mainScriptUrlOrBlob) {\n moduleFileLocator.mainScriptUrlOrBlob = fileLocator.mainScriptUrlOrBlob;\n }\n }\n // TODO(mrschmidt): Ensure that fileLocator is passed in by all users\n // and make it required\n const module =\n await self.ModuleFactory(self.Module as FileLocator || fileLocator);\n // Don't reuse factory or module seed\n self.ModuleFactory = self.Module = undefined;\n return new constructorFcn(module, glCanvas);\n};\n"]}
demo/assets/litertjs/core/0.2.1/wasm/litert_wasm_compat_internal.js ADDED
The diff for this file is too large to render. See raw diff
 
demo/assets/litertjs/core/0.2.1/wasm/litert_wasm_compat_internal.wasm ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b99648b360ce3d25ebece235db69b03f5653ad3c4a6ed18be7f136941f690cdb
3
+ size 7589558
demo/assets/litertjs/core/0.2.1/wasm/litert_wasm_internal.js ADDED
The diff for this file is too large to render. See raw diff
 
demo/assets/litertjs/core/0.2.1/wasm/litert_wasm_internal.wasm ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:afd06dd26bd55c66764195689fc9ca988ace9fe6be80159d6dffc50f50053473
3
+ size 7624088
demo/assets/litertjs/core/0.2.1/wasm/litert_wasm_threaded_internal.js ADDED
The diff for this file is too large to render. See raw diff
 
demo/assets/litertjs/core/0.2.1/wasm/litert_wasm_threaded_internal.wasm ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2486ee067ac6b767011a8691f5e5bca5733a64e4db5f75b97359f7cb09a0afde
3
+ size 7674183
demo/assets/long-4.0.0_esm.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.
3
+ * Original file: /npm/long@4.0.0/src/long.js
4
+ *
5
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6
+ */
7
+ var i=n,t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(i){}function n(i,t,n){this.low=0|i,this.high=0|t,this.unsigned=!!n}function s(i){return!0===(i&&i.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=s;var h={},e={};function r(i,t){var n,s,r;return t?(r=0<=(i>>>=0)&&i<256)&&(s=e[i])?s:(n=o(i,(0|i)<0?-1:0,!0),r&&(e[i]=n),n):(r=-128<=(i|=0)&&i<128)&&(s=h[i])?s:(n=o(i,i<0?-1:0,!1),r&&(h[i]=n),n)}function u(i,t){if(isNaN(i))return t?w:v;if(t){if(i<0)return w;if(i>=d)return b}else{if(i<=-m)return q;if(i+1>=m)return y}return i<0?u(-i,t).neg():o(i%l|0,i/l|0,t)}function o(i,t,s){return new n(i,t,s)}n.fromInt=r,n.fromNumber=u,n.fromBits=o;var g=Math.pow;function f(i,t,n){if(0===i.length)throw Error("empty string");if("NaN"===i||"Infinity"===i||"+Infinity"===i||"-Infinity"===i)return v;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||36<n)throw RangeError("radix");var s;if((s=i.indexOf("-"))>0)throw Error("interior hyphen");if(0===s)return f(i.substring(1),t,n).neg();for(var h=u(g(n,8)),e=v,r=0;r<i.length;r+=8){var o=Math.min(8,i.length-r),a=parseInt(i.substring(r,r+o),n);if(o<8){var l=u(g(n,o));e=e.mul(l).add(u(a))}else e=(e=e.mul(h)).add(u(a))}return e.unsigned=t,e}function a(i,t){return"number"==typeof i?u(i,t):"string"==typeof i?f(i,t):o(i.low,i.high,"boolean"==typeof t?t:i.unsigned)}n.fromString=f,n.fromValue=a;var l=4294967296,d=l*l,m=d/2,c=r(1<<24),v=r(0);n.ZERO=v;var w=r(0,!0);n.UZERO=w;var E=r(1);n.ONE=E;var N=r(1,!0);n.UONE=N;var _=r(-1);n.NEG_ONE=_;var y=o(-1,2147483647,!1);n.MAX_VALUE=y;var b=o(-1,-1,!0);n.MAX_UNSIGNED_VALUE=b;var q=o(0,-2147483648,!1);n.MIN_VALUE=q;var B=n.prototype;B.toInt=function(){return this.unsigned?this.low>>>0:this.low},B.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},B.toString=function(i){if((i=i||10)<2||36<i)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(q)){var t=u(i),n=this.div(t),s=n.mul(t).sub(this);return n.toString(i)+s.toInt().toString(i)}return"-"+this.neg().toString(i)}for(var h=u(g(i,6),this.unsigned),e=this,r="";;){var o=e.div(h),f=(e.sub(o.mul(h)).toInt()>>>0).toString(i);if((e=o).isZero())return f+r;for(;f.length<6;)f="0"+f;r=""+f+r}},B.getHighBits=function(){return this.high},B.getHighBitsUnsigned=function(){return this.high>>>0},B.getLowBits=function(){return this.low},B.getLowBitsUnsigned=function(){return this.low>>>0},B.getNumBitsAbs=function(){if(this.isNegative())return this.eq(q)?64:this.neg().getNumBitsAbs();for(var i=0!=this.high?this.high:this.low,t=31;t>0&&!(i&1<<t);t--);return 0!=this.high?t+33:t+1},B.isZero=function(){return 0===this.high&&0===this.low},B.eqz=B.isZero,B.isNegative=function(){return!this.unsigned&&this.high<0},B.isPositive=function(){return this.unsigned||this.high>=0},B.isOdd=function(){return!(1&~this.low)},B.isEven=function(){return!(1&this.low)},B.equals=function(i){return s(i)||(i=a(i)),(this.unsigned===i.unsigned||this.high>>>31!=1||i.high>>>31!=1)&&(this.high===i.high&&this.low===i.low)},B.eq=B.equals,B.notEquals=function(i){return!this.eq(i)},B.neq=B.notEquals,B.ne=B.notEquals,B.lessThan=function(i){return this.comp(i)<0},B.lt=B.lessThan,B.lessThanOrEqual=function(i){return this.comp(i)<=0},B.lte=B.lessThanOrEqual,B.le=B.lessThanOrEqual,B.greaterThan=function(i){return this.comp(i)>0},B.gt=B.greaterThan,B.greaterThanOrEqual=function(i){return this.comp(i)>=0},B.gte=B.greaterThanOrEqual,B.ge=B.greaterThanOrEqual,B.compare=function(i){if(s(i)||(i=a(i)),this.eq(i))return 0;var t=this.isNegative(),n=i.isNegative();return t&&!n?-1:!t&&n?1:this.unsigned?i.high>>>0>this.high>>>0||i.high===this.high&&i.low>>>0>this.low>>>0?-1:1:this.sub(i).isNegative()?-1:1},B.comp=B.compare,B.negate=function(){return!this.unsigned&&this.eq(q)?q:this.not().add(E)},B.neg=B.negate,B.add=function(i){s(i)||(i=a(i));var t=this.high>>>16,n=65535&this.high,h=this.low>>>16,e=65535&this.low,r=i.high>>>16,u=65535&i.high,g=i.low>>>16,f=0,l=0,d=0,m=0;return d+=(m+=e+(65535&i.low))>>>16,l+=(d+=h+g)>>>16,f+=(l+=n+u)>>>16,f+=t+r,o((d&=65535)<<16|(m&=65535),(f&=65535)<<16|(l&=65535),this.unsigned)},B.subtract=function(i){return s(i)||(i=a(i)),this.add(i.neg())},B.sub=B.subtract,B.multiply=function(i){if(this.isZero())return v;if(s(i)||(i=a(i)),t)return o(t.mul(this.low,this.high,i.low,i.high),t.get_high(),this.unsigned);if(i.isZero())return v;if(this.eq(q))return i.isOdd()?q:v;if(i.eq(q))return this.isOdd()?q:v;if(this.isNegative())return i.isNegative()?this.neg().mul(i.neg()):this.neg().mul(i).neg();if(i.isNegative())return this.mul(i.neg()).neg();if(this.lt(c)&&i.lt(c))return u(this.toNumber()*i.toNumber(),this.unsigned);var n=this.high>>>16,h=65535&this.high,e=this.low>>>16,r=65535&this.low,g=i.high>>>16,f=65535&i.high,l=i.low>>>16,d=65535&i.low,m=0,w=0,E=0,N=0;return E+=(N+=r*d)>>>16,w+=(E+=e*d)>>>16,E&=65535,w+=(E+=r*l)>>>16,m+=(w+=h*d)>>>16,w&=65535,m+=(w+=e*l)>>>16,w&=65535,m+=(w+=r*f)>>>16,m+=n*d+h*l+e*f+r*g,o((E&=65535)<<16|(N&=65535),(m&=65535)<<16|(w&=65535),this.unsigned)},B.mul=B.multiply,B.divide=function(i){if(s(i)||(i=a(i)),i.isZero())throw Error("division by zero");var n,h,e;if(t)return this.unsigned||-2147483648!==this.high||-1!==i.low||-1!==i.high?o((this.unsigned?t.div_u:t.div_s)(this.low,this.high,i.low,i.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?w:v;if(this.unsigned){if(i.unsigned||(i=i.toUnsigned()),i.gt(this))return w;if(i.gt(this.shru(1)))return N;e=w}else{if(this.eq(q))return i.eq(E)||i.eq(_)?q:i.eq(q)?E:(n=this.shr(1).div(i).shl(1)).eq(v)?i.isNegative()?E:_:(h=this.sub(i.mul(n)),e=n.add(h.div(i)));if(i.eq(q))return this.unsigned?w:v;if(this.isNegative())return i.isNegative()?this.neg().div(i.neg()):this.neg().div(i).neg();if(i.isNegative())return this.div(i.neg()).neg();e=v}for(h=this;h.gte(i);){n=Math.max(1,Math.floor(h.toNumber()/i.toNumber()));for(var r=Math.ceil(Math.log(n)/Math.LN2),f=r<=48?1:g(2,r-48),l=u(n),d=l.mul(i);d.isNegative()||d.gt(h);)d=(l=u(n-=f,this.unsigned)).mul(i);l.isZero()&&(l=E),e=e.add(l),h=h.sub(d)}return e},B.div=B.divide,B.modulo=function(i){return s(i)||(i=a(i)),t?o((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,i.low,i.high),t.get_high(),this.unsigned):this.sub(this.div(i).mul(i))},B.mod=B.modulo,B.rem=B.modulo,B.not=function(){return o(~this.low,~this.high,this.unsigned)},B.and=function(i){return s(i)||(i=a(i)),o(this.low&i.low,this.high&i.high,this.unsigned)},B.or=function(i){return s(i)||(i=a(i)),o(this.low|i.low,this.high|i.high,this.unsigned)},B.xor=function(i){return s(i)||(i=a(i)),o(this.low^i.low,this.high^i.high,this.unsigned)},B.shiftLeft=function(i){return s(i)&&(i=i.toInt()),0==(i&=63)?this:i<32?o(this.low<<i,this.high<<i|this.low>>>32-i,this.unsigned):o(0,this.low<<i-32,this.unsigned)},B.shl=B.shiftLeft,B.shiftRight=function(i){return s(i)&&(i=i.toInt()),0==(i&=63)?this:i<32?o(this.low>>>i|this.high<<32-i,this.high>>i,this.unsigned):o(this.high>>i-32,this.high>=0?0:-1,this.unsigned)},B.shr=B.shiftRight,B.shiftRightUnsigned=function(i){if(s(i)&&(i=i.toInt()),0===(i&=63))return this;var t=this.high;return i<32?o(this.low>>>i|t<<32-i,t>>>i,this.unsigned):o(32===i?t:t>>>i-32,0,this.unsigned)},B.shru=B.shiftRightUnsigned,B.shr_u=B.shiftRightUnsigned,B.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},B.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},B.toBytes=function(i){return i?this.toBytesLE():this.toBytesBE()},B.toBytesLE=function(){var i=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&i,i>>>8&255,i>>>16&255,i>>>24]},B.toBytesBE=function(){var i=this.high,t=this.low;return[i>>>24,i>>>16&255,i>>>8&255,255&i,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(i,t,s){return s?n.fromBytesLE(i,t):n.fromBytesBE(i,t)},n.fromBytesLE=function(i,t){return new n(i[0]|i[1]<<8|i[2]<<16|i[3]<<24,i[4]|i[5]<<8|i[6]<<16|i[7]<<24,t)},n.fromBytesBE=function(i,t){return new n(i[4]<<24|i[5]<<16|i[6]<<8|i[7],i[0]<<24|i[1]<<16|i[2]<<8|i[3],t)};var p=i.MAX_UNSIGNED_VALUE,O=i.MAX_VALUE,U=i.MIN_VALUE,L=i.NEG_ONE,A=i.ONE,I=i.UONE,M=i.UZERO,Z=i.ZERO,R=i.fromBits,S=i.fromBytes,V=i.fromBytesBE,T=i.fromBytesLE,x=i.fromInt,G=i.fromNumber,X=i.fromString,D=i.fromValue,z=i.isLong;export{p as MAX_UNSIGNED_VALUE,O as MAX_VALUE,U as MIN_VALUE,L as NEG_ONE,A as ONE,I as UONE,M as UZERO,Z as ZERO,i as default,R as fromBits,S as fromBytes,V as fromBytesBE,T as fromBytesLE,x as fromInt,G as fromNumber,X as fromString,D as fromValue,z as isLong};
8
+ //# sourceMappingURL=long-4.0.0_esm.js.map
demo/assets/long-4.0.0_esm.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"sources":["jsdelivr-header.js","/npm/long@4.0.0/src/long.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ICNA,EAAiB,EAKb,EAAO,KAEX,IACE,EAAO,IAAI,YAAY,SAAS,IAAI,YAAY,OAAO,IAAI,WAAW,CACpE,EAAG,GAAI,IAAK,IAAK,EAAG,EAAG,EAAG,EAAG,EAAG,GAAI,EAAG,GAAI,EAAG,EAAG,IAAK,GAAI,EAAG,IAAK,IAAK,IAAK,IAAK,EAAG,IAAK,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,E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,IAAO,GAAK,IACZ,IAAO,GAEf,EAMA,EAAc,UAAY,WACtB,IAAI,EAAK,KAAK,KACV,EAAK,KAAK,IACd,MAAO,CACH,IAAO,GACP,IAAO,GAAK,IACZ,IAAQ,EAAI,IACA,IAAZ,EACA,IAAO,GACP,IAAO,GAAK,IACZ,IAAQ,EAAI,IACA,IAAZ,EAER,EASA,EAAK,UAAY,SAAmB,EAAO,EAAU,GACjD,OAAO,EAAK,EAAK,YAAY,EAAO,GAAY,EAAK,YAAY,EAAO,EAC5E,EAQA,EAAK,YAAc,SAAqB,EAAO,GAC3C,OAAO,IAAI,EACP,EAAM,GACN,EAAM,IAAO,EACb,EAAM,IAAM,GACZ,EAAM,IAAM,GACZ,EAAM,GACN,EAAM,IAAO,EACb,EAAM,IAAM,GACZ,EAAM,IAAM,GACZ,EAER,EAQA,EAAK,YAAc,SAAqB,EAAO,GAC3C,OAAO,IAAI,EACP,EAAM,IAAM,GACZ,EAAM,IAAM,GACZ,EAAM,IAAO,EACb,EAAM,GACN,EAAM,IAAM,GACZ,EAAM,IAAM,GACZ,EAAM,IAAO,EACb,EAAM,GACN,EAER,E","file":"/npm/long@4.0.0/src/long.js/+esm","sourceRoot":"","sourcesContent":["/**\n * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.\n * Original file: /npm/long@4.0.0/src/long.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","module.exports = Long;\r\n\r\n/**\r\n * wasm optimizations, to do native i64 multiplication and divide\r\n */\r\nvar wasm = null;\r\n\r\ntry {\r\n wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([\r\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11\r\n ])), {}).exports;\r\n} catch (e) {\r\n // no wasm support :(\r\n}\r\n\r\n/**\r\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\r\n * See the from* functions below for more convenient ways of constructing Longs.\r\n * @exports Long\r\n * @class A Long class for representing a 64 bit two's-complement integer value.\r\n * @param {number} low The low (signed) 32 bits of the long\r\n * @param {number} high The high (signed) 32 bits of the long\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @constructor\r\n */\r\nfunction Long(low, high, unsigned) {\r\n\r\n /**\r\n * The low 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.low = low | 0;\r\n\r\n /**\r\n * The high 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.high = high | 0;\r\n\r\n /**\r\n * Whether unsigned or not.\r\n * @type {boolean}\r\n */\r\n this.unsigned = !!unsigned;\r\n}\r\n\r\n// The internal representation of a long is the two given signed, 32-bit values.\r\n// We use 32-bit pieces because these are the size of integers on which\r\n// Javascript performs bit-operations. For operations like addition and\r\n// multiplication, we split each number into 16 bit pieces, which can easily be\r\n// multiplied within Javascript's floating-point representation without overflow\r\n// or change in sign.\r\n//\r\n// In the algorithms below, we frequently reduce the negative case to the\r\n// positive case by negating the input(s) and then post-processing the result.\r\n// Note that we must ALWAYS check specially whether those values are MIN_VALUE\r\n// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\r\n// a positive number, it overflows back into a negative). Not handling this\r\n// case would often result in infinite recursion.\r\n//\r\n// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\r\n// methods on which they depend.\r\n\r\n/**\r\n * An indicator used to reliably determine if an object is a Long or not.\r\n * @type {boolean}\r\n * @const\r\n * @private\r\n */\r\nLong.prototype.__isLong__;\r\n\r\nObject.defineProperty(Long.prototype, \"__isLong__\", { value: true });\r\n\r\n/**\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n * @inner\r\n */\r\nfunction isLong(obj) {\r\n return (obj && obj[\"__isLong__\"]) === true;\r\n}\r\n\r\n/**\r\n * Tests if the specified object is a Long.\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n */\r\nLong.isLong = isLong;\r\n\r\n/**\r\n * A cache of the Long representations of small integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar INT_CACHE = {};\r\n\r\n/**\r\n * A cache of the Long representations of small unsigned integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar UINT_CACHE = {};\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromInt(value, unsigned) {\r\n var obj, cachedObj, cache;\r\n if (unsigned) {\r\n value >>>= 0;\r\n if (cache = (0 <= value && value < 256)) {\r\n cachedObj = UINT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);\r\n if (cache)\r\n UINT_CACHE[value] = obj;\r\n return obj;\r\n } else {\r\n value |= 0;\r\n if (cache = (-128 <= value && value < 128)) {\r\n cachedObj = INT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, value < 0 ? -1 : 0, false);\r\n if (cache)\r\n INT_CACHE[value] = obj;\r\n return obj;\r\n }\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given 32 bit integer value.\r\n * @function\r\n * @param {number} value The 32 bit integer in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromInt = fromInt;\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromNumber(value, unsigned) {\r\n if (isNaN(value))\r\n return unsigned ? UZERO : ZERO;\r\n if (unsigned) {\r\n if (value < 0)\r\n return UZERO;\r\n if (value >= TWO_PWR_64_DBL)\r\n return MAX_UNSIGNED_VALUE;\r\n } else {\r\n if (value <= -TWO_PWR_63_DBL)\r\n return MIN_VALUE;\r\n if (value + 1 >= TWO_PWR_63_DBL)\r\n return MAX_VALUE;\r\n }\r\n if (value < 0)\r\n return fromNumber(-value, unsigned).neg();\r\n return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\r\n * @function\r\n * @param {number} value The number in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromNumber = fromNumber;\r\n\r\n/**\r\n * @param {number} lowBits\r\n * @param {number} highBits\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromBits(lowBits, highBits, unsigned) {\r\n return new Long(lowBits, highBits, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\r\n * assumed to use 32 bits.\r\n * @function\r\n * @param {number} lowBits The low 32 bits\r\n * @param {number} highBits The high 32 bits\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromBits = fromBits;\r\n\r\n/**\r\n * @function\r\n * @param {number} base\r\n * @param {number} exponent\r\n * @returns {number}\r\n * @inner\r\n */\r\nvar pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)\r\n\r\n/**\r\n * @param {string} str\r\n * @param {(boolean|number)=} unsigned\r\n * @param {number=} radix\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromString(str, unsigned, radix) {\r\n if (str.length === 0)\r\n throw Error('empty string');\r\n if (str === \"NaN\" || str === \"Infinity\" || str === \"+Infinity\" || str === \"-Infinity\")\r\n return ZERO;\r\n if (typeof unsigned === 'number') {\r\n // For goog.math.long compatibility\r\n radix = unsigned,\r\n unsigned = false;\r\n } else {\r\n unsigned = !! unsigned;\r\n }\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n\r\n var p;\r\n if ((p = str.indexOf('-')) > 0)\r\n throw Error('interior hyphen');\r\n else if (p === 0) {\r\n return fromString(str.substring(1), unsigned, radix).neg();\r\n }\r\n\r\n // Do several (8) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 8));\r\n\r\n var result = ZERO;\r\n for (var i = 0; i < str.length; i += 8) {\r\n var size = Math.min(8, str.length - i),\r\n value = parseInt(str.substring(i, i + size), radix);\r\n if (size < 8) {\r\n var power = fromNumber(pow_dbl(radix, size));\r\n result = result.mul(power).add(fromNumber(value));\r\n } else {\r\n result = result.mul(radixToPower);\r\n result = result.add(fromNumber(value));\r\n }\r\n }\r\n result.unsigned = unsigned;\r\n return result;\r\n}\r\n\r\n/**\r\n * Returns a Long representation of the given string, written using the specified radix.\r\n * @function\r\n * @param {string} str The textual representation of the Long\r\n * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromString = fromString;\r\n\r\n/**\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromValue(val, unsigned) {\r\n if (typeof val === 'number')\r\n return fromNumber(val, unsigned);\r\n if (typeof val === 'string')\r\n return fromString(val, unsigned);\r\n // Throws for non-objects, converts non-instanceof Long:\r\n return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);\r\n}\r\n\r\n/**\r\n * Converts the specified value to a Long using the appropriate from* function for its type.\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long}\r\n */\r\nLong.fromValue = fromValue;\r\n\r\n// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\r\n// no runtime penalty for these.\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_16_DBL = 1 << 16;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24_DBL = 1 << 24;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\r\n\r\n/**\r\n * @type {!Long}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ZERO = fromInt(0);\r\n\r\n/**\r\n * Signed zero.\r\n * @type {!Long}\r\n */\r\nLong.ZERO = ZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UZERO = fromInt(0, true);\r\n\r\n/**\r\n * Unsigned zero.\r\n * @type {!Long}\r\n */\r\nLong.UZERO = UZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ONE = fromInt(1);\r\n\r\n/**\r\n * Signed one.\r\n * @type {!Long}\r\n */\r\nLong.ONE = ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UONE = fromInt(1, true);\r\n\r\n/**\r\n * Unsigned one.\r\n * @type {!Long}\r\n */\r\nLong.UONE = UONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar NEG_ONE = fromInt(-1);\r\n\r\n/**\r\n * Signed negative one.\r\n * @type {!Long}\r\n */\r\nLong.NEG_ONE = NEG_ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);\r\n\r\n/**\r\n * Maximum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_VALUE = MAX_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);\r\n\r\n/**\r\n * Maximum unsigned value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MIN_VALUE = fromBits(0, 0x80000000|0, false);\r\n\r\n/**\r\n * Minimum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MIN_VALUE = MIN_VALUE;\r\n\r\n/**\r\n * @alias Long.prototype\r\n * @inner\r\n */\r\nvar LongPrototype = Long.prototype;\r\n\r\n/**\r\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\r\n * @returns {number}\r\n */\r\nLongPrototype.toInt = function toInt() {\r\n return this.unsigned ? this.low >>> 0 : this.low;\r\n};\r\n\r\n/**\r\n * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\r\n * @returns {number}\r\n */\r\nLongPrototype.toNumber = function toNumber() {\r\n if (this.unsigned)\r\n return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\r\n return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\r\n};\r\n\r\n/**\r\n * Converts the Long to a string written in the specified radix.\r\n * @param {number=} radix Radix (2-36), defaults to 10\r\n * @returns {string}\r\n * @override\r\n * @throws {RangeError} If `radix` is out of range\r\n */\r\nLongPrototype.toString = function toString(radix) {\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n if (this.isZero())\r\n return '0';\r\n if (this.isNegative()) { // Unsigned Longs are never negative\r\n if (this.eq(MIN_VALUE)) {\r\n // We need to change the Long value before it can be negated, so we remove\r\n // the bottom-most digit in this base and then recurse to do the rest.\r\n var radixLong = fromNumber(radix),\r\n div = this.div(radixLong),\r\n rem1 = div.mul(radixLong).sub(this);\r\n return div.toString(radix) + rem1.toInt().toString(radix);\r\n } else\r\n return '-' + this.neg().toString(radix);\r\n }\r\n\r\n // Do several (6) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),\r\n rem = this;\r\n var result = '';\r\n while (true) {\r\n var remDiv = rem.div(radixToPower),\r\n intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,\r\n digits = intval.toString(radix);\r\n rem = remDiv;\r\n if (rem.isZero())\r\n return digits + result;\r\n else {\r\n while (digits.length < 6)\r\n digits = '0' + digits;\r\n result = '' + digits + result;\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as a signed integer.\r\n * @returns {number} Signed high bits\r\n */\r\nLongPrototype.getHighBits = function getHighBits() {\r\n return this.high;\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned high bits\r\n */\r\nLongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\r\n return this.high >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as a signed integer.\r\n * @returns {number} Signed low bits\r\n */\r\nLongPrototype.getLowBits = function getLowBits() {\r\n return this.low;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned low bits\r\n */\r\nLongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\r\n return this.low >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the number of bits needed to represent the absolute value of this Long.\r\n * @returns {number}\r\n */\r\nLongPrototype.getNumBitsAbs = function getNumBitsAbs() {\r\n if (this.isNegative()) // Unsigned Longs are never negative\r\n return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();\r\n var val = this.high != 0 ? this.high : this.low;\r\n for (var bit = 31; bit > 0; bit--)\r\n if ((val & (1 << bit)) != 0)\r\n break;\r\n return this.high != 0 ? bit + 33 : bit + 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isZero = function isZero() {\r\n return this.high === 0 && this.low === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eqz = LongPrototype.isZero;\r\n\r\n/**\r\n * Tests if this Long's value is negative.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isNegative = function isNegative() {\r\n return !this.unsigned && this.high < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is positive.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isPositive = function isPositive() {\r\n return this.unsigned || this.high >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is odd.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isOdd = function isOdd() {\r\n return (this.low & 1) === 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is even.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isEven = function isEven() {\r\n return (this.low & 1) === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.equals = function equals(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\r\n return false;\r\n return this.high === other.high && this.low === other.low;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eq = LongPrototype.equals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.notEquals = function notEquals(other) {\r\n return !this.eq(/* validates */ other);\r\n};\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.neq = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ne = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThan = function lessThan(other) {\r\n return this.comp(/* validates */ other) < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lt = LongPrototype.lessThan;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {\r\n return this.comp(/* validates */ other) <= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lte = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.le = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThan = function greaterThan(other) {\r\n return this.comp(/* validates */ other) > 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gt = LongPrototype.greaterThan;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\r\n return this.comp(/* validates */ other) >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gte = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ge = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Compares this Long's value with the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.compare = function compare(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.eq(other))\r\n return 0;\r\n var thisNeg = this.isNegative(),\r\n otherNeg = other.isNegative();\r\n if (thisNeg && !otherNeg)\r\n return -1;\r\n if (!thisNeg && otherNeg)\r\n return 1;\r\n // At this point the sign bits are the same\r\n if (!this.unsigned)\r\n return this.sub(other).isNegative() ? -1 : 1;\r\n // Both are positive if at least one is unsigned\r\n return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\r\n};\r\n\r\n/**\r\n * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.comp = LongPrototype.compare;\r\n\r\n/**\r\n * Negates this Long's value.\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.negate = function negate() {\r\n if (!this.unsigned && this.eq(MIN_VALUE))\r\n return MIN_VALUE;\r\n return this.not().add(ONE);\r\n};\r\n\r\n/**\r\n * Negates this Long's value. This is an alias of {@link Long#negate}.\r\n * @function\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.neg = LongPrototype.negate;\r\n\r\n/**\r\n * Returns the sum of this and the specified Long.\r\n * @param {!Long|number|string} addend Addend\r\n * @returns {!Long} Sum\r\n */\r\nLongPrototype.add = function add(addend) {\r\n if (!isLong(addend))\r\n addend = fromValue(addend);\r\n\r\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = addend.high >>> 16;\r\n var b32 = addend.high & 0xFFFF;\r\n var b16 = addend.low >>> 16;\r\n var b00 = addend.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 + b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 + b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 + b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 + b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long.\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.subtract = function subtract(subtrahend) {\r\n if (!isLong(subtrahend))\r\n subtrahend = fromValue(subtrahend);\r\n return this.add(subtrahend.neg());\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\r\n * @function\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.sub = LongPrototype.subtract;\r\n\r\n/**\r\n * Returns the product of this and the specified Long.\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.multiply = function multiply(multiplier) {\r\n if (this.isZero())\r\n return ZERO;\r\n if (!isLong(multiplier))\r\n multiplier = fromValue(multiplier);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = wasm.mul(this.low,\r\n this.high,\r\n multiplier.low,\r\n multiplier.high);\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (multiplier.isZero())\r\n return ZERO;\r\n if (this.eq(MIN_VALUE))\r\n return multiplier.isOdd() ? MIN_VALUE : ZERO;\r\n if (multiplier.eq(MIN_VALUE))\r\n return this.isOdd() ? MIN_VALUE : ZERO;\r\n\r\n if (this.isNegative()) {\r\n if (multiplier.isNegative())\r\n return this.neg().mul(multiplier.neg());\r\n else\r\n return this.neg().mul(multiplier).neg();\r\n } else if (multiplier.isNegative())\r\n return this.mul(multiplier.neg()).neg();\r\n\r\n // If both longs are small, use float multiplication\r\n if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))\r\n return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\r\n\r\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\r\n // We can skip products that would overflow.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = multiplier.high >>> 16;\r\n var b32 = multiplier.high & 0xFFFF;\r\n var b16 = multiplier.low >>> 16;\r\n var b00 = multiplier.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 * b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 * b00;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c16 += a00 * b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 * b00;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a16 * b16;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a00 * b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\r\n * @function\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.mul = LongPrototype.multiply;\r\n\r\n/**\r\n * Returns this Long divided by the specified. The result is signed if this Long is signed or\r\n * unsigned if this Long is unsigned.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.divide = function divide(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n if (divisor.isZero())\r\n throw Error('division by zero');\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n // guard against signed division overflow: the largest\r\n // negative number / -1 would be 1 larger than the largest\r\n // positive number, due to two's complement.\r\n if (!this.unsigned &&\r\n this.high === -0x80000000 &&\r\n divisor.low === -1 && divisor.high === -1) {\r\n // be consistent with non-wasm code path\r\n return this;\r\n }\r\n var low = (this.unsigned ? wasm.div_u : wasm.div_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (this.isZero())\r\n return this.unsigned ? UZERO : ZERO;\r\n var approx, rem, res;\r\n if (!this.unsigned) {\r\n // This section is only relevant for signed longs and is derived from the\r\n // closure library as a whole.\r\n if (this.eq(MIN_VALUE)) {\r\n if (divisor.eq(ONE) || divisor.eq(NEG_ONE))\r\n return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\r\n else if (divisor.eq(MIN_VALUE))\r\n return ONE;\r\n else {\r\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\r\n var halfThis = this.shr(1);\r\n approx = halfThis.div(divisor).shl(1);\r\n if (approx.eq(ZERO)) {\r\n return divisor.isNegative() ? ONE : NEG_ONE;\r\n } else {\r\n rem = this.sub(divisor.mul(approx));\r\n res = approx.add(rem.div(divisor));\r\n return res;\r\n }\r\n }\r\n } else if (divisor.eq(MIN_VALUE))\r\n return this.unsigned ? UZERO : ZERO;\r\n if (this.isNegative()) {\r\n if (divisor.isNegative())\r\n return this.neg().div(divisor.neg());\r\n return this.neg().div(divisor).neg();\r\n } else if (divisor.isNegative())\r\n return this.div(divisor.neg()).neg();\r\n res = ZERO;\r\n } else {\r\n // The algorithm below has not been made for unsigned longs. It's therefore\r\n // required to take special care of the MSB prior to running it.\r\n if (!divisor.unsigned)\r\n divisor = divisor.toUnsigned();\r\n if (divisor.gt(this))\r\n return UZERO;\r\n if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true\r\n return UONE;\r\n res = UZERO;\r\n }\r\n\r\n // Repeat the following until the remainder is less than other: find a\r\n // floating-point that approximates remainder / other *from below*, add this\r\n // into the result, and subtract it from the remainder. It is critical that\r\n // the approximate value is less than or equal to the real value so that the\r\n // remainder never becomes negative.\r\n rem = this;\r\n while (rem.gte(divisor)) {\r\n // Approximate the result of division. This may be a little greater or\r\n // smaller than the actual value.\r\n approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\r\n\r\n // We will tweak the approximate result by changing it in the 48-th digit or\r\n // the smallest non-fractional digit, whichever is larger.\r\n var log2 = Math.ceil(Math.log(approx) / Math.LN2),\r\n delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),\r\n\r\n // Decrease the approximation until it is smaller than the remainder. Note\r\n // that if it is too large, the product overflows and is negative.\r\n approxRes = fromNumber(approx),\r\n approxRem = approxRes.mul(divisor);\r\n while (approxRem.isNegative() || approxRem.gt(rem)) {\r\n approx -= delta;\r\n approxRes = fromNumber(approx, this.unsigned);\r\n approxRem = approxRes.mul(divisor);\r\n }\r\n\r\n // We know the answer can't be zero... and actually, zero would cause\r\n // infinite recursion since we would make no progress.\r\n if (approxRes.isZero())\r\n approxRes = ONE;\r\n\r\n res = res.add(approxRes);\r\n rem = rem.sub(approxRem);\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.div = LongPrototype.divide;\r\n\r\n/**\r\n * Returns this Long modulo the specified.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.modulo = function modulo(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n return this.sub(this.div(divisor).mul(divisor));\r\n};\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.mod = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.rem = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns the bitwise NOT of this Long.\r\n * @returns {!Long}\r\n */\r\nLongPrototype.not = function not() {\r\n return fromBits(~this.low, ~this.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise AND of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.and = function and(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low & other.low, this.high & other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise OR of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.or = function or(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low | other.low, this.high | other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise XOR of this Long and the given one.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.xor = function xor(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftLeft = function shiftLeft(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\r\n else\r\n return fromBits(0, this.low << (numBits - 32), this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shl = LongPrototype.shiftLeft;\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRight = function shiftRight(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\r\n else\r\n return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr = LongPrototype.shiftRight;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n numBits &= 63;\r\n if (numBits === 0)\r\n return this;\r\n else {\r\n var high = this.high;\r\n if (numBits < 32) {\r\n var low = this.low;\r\n return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);\r\n } else if (numBits === 32)\r\n return fromBits(high, 0, this.unsigned);\r\n else\r\n return fromBits(high >>> (numBits - 32), 0, this.unsigned);\r\n }\r\n};\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shru = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr_u = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Converts this Long to signed.\r\n * @returns {!Long} Signed long\r\n */\r\nLongPrototype.toSigned = function toSigned() {\r\n if (!this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, false);\r\n};\r\n\r\n/**\r\n * Converts this Long to unsigned.\r\n * @returns {!Long} Unsigned long\r\n */\r\nLongPrototype.toUnsigned = function toUnsigned() {\r\n if (this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, true);\r\n};\r\n\r\n/**\r\n * Converts this Long to its byte representation.\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {!Array.<number>} Byte representation\r\n */\r\nLongPrototype.toBytes = function toBytes(le) {\r\n return le ? this.toBytesLE() : this.toBytesBE();\r\n};\r\n\r\n/**\r\n * Converts this Long to its little endian byte representation.\r\n * @returns {!Array.<number>} Little endian byte representation\r\n */\r\nLongPrototype.toBytesLE = function toBytesLE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n lo & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo >>> 16 & 0xff,\r\n lo >>> 24 ,\r\n hi & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi >>> 16 & 0xff,\r\n hi >>> 24\r\n ];\r\n};\r\n\r\n/**\r\n * Converts this Long to its big endian byte representation.\r\n * @returns {!Array.<number>} Big endian byte representation\r\n */\r\nLongPrototype.toBytesBE = function toBytesBE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n hi >>> 24 ,\r\n hi >>> 16 & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi & 0xff,\r\n lo >>> 24 ,\r\n lo >>> 16 & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo & 0xff\r\n ];\r\n};\r\n\r\n/**\r\n * Creates a Long from its byte representation.\r\n * @param {!Array.<number>} bytes Byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytes = function fromBytes(bytes, unsigned, le) {\r\n return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);\r\n};\r\n\r\n/**\r\n * Creates a Long from its little endian byte representation.\r\n * @param {!Array.<number>} bytes Little endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesLE = function fromBytesLE(bytes, unsigned) {\r\n return new Long(\r\n bytes[0] |\r\n bytes[1] << 8 |\r\n bytes[2] << 16 |\r\n bytes[3] << 24,\r\n bytes[4] |\r\n bytes[5] << 8 |\r\n bytes[6] << 16 |\r\n bytes[7] << 24,\r\n unsigned\r\n );\r\n};\r\n\r\n/**\r\n * Creates a Long from its big endian byte representation.\r\n * @param {!Array.<number>} bytes Big endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesBE = function fromBytesBE(bytes, unsigned) {\r\n return new Long(\r\n bytes[4] << 24 |\r\n bytes[5] << 16 |\r\n bytes[6] << 8 |\r\n bytes[7],\r\n bytes[0] << 24 |\r\n bytes[1] << 16 |\r\n bytes[2] << 8 |\r\n bytes[3],\r\n unsigned\r\n );\r\n};\r\n"]}
demo/assets/script.js ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { VectorSearch } from '/assets/VectorSearch-min.js';
2
+
3
+ // DOM references.
4
+ const DB_NAME_INPUT = document.getElementById('db-name-input');
5
+ const DB_SELECT = document.getElementById('db-select');
6
+ const STATUS_EL = document.getElementById('status');
7
+ const QUERY_EMBEDDING_TEXT = document.getElementById('query-embedding-text');
8
+ const QUERY_TOKENS_OUTPUT = document.getElementById('query-tokens-output');
9
+ const QUERY_EMBEDDING_VIZ = document.getElementById('query-embedding-viz');
10
+ const BEST_MATCH_EMBEDDING_VIZ = document.getElementById('best-match-embedding-viz');
11
+ const BEST_MATCH_EMBEDDING_TEXT = document.getElementById('best-match-embedding-text');
12
+ const INPUT_TEXT = document.getElementById('input-text');
13
+ const TARGET_TEXT = document.getElementById('target-text');
14
+ const STORE_BTN = document.getElementById('store-btn');
15
+ const PREDICT_BTN = document.getElementById('predict-btn');
16
+ const THRESHOLD_INPUT = document.getElementById('threshold-input');
17
+ const THRESHOLD_VALUE = document.getElementById('threshold-value');
18
+ const RESULTS_TEXT = document.getElementById('results-text');
19
+ const SIMILARITY_CONTAINER = document.getElementById('similarity-container');
20
+ const SIMILARITY_SCORE_EL = document.getElementById('similarity-score');
21
+ const SIMILARITY_LABEL_EL = document.getElementById('similarity-label');
22
+
23
+
24
+ // Embedding Model Configuration.
25
+ const MODEL_RUNTIME = 'litertjs'; // OR 'transformersjs'
26
+ const MODEL_URL = 'model/embeddinggemma-300M_seq1024_mixed-precision.tflite'; // OR 'Xenova/all-MiniLM-L6-v2' if transformersjs runtime.
27
+ const SEQ_LENGTH = 1024;
28
+ const TOKENIZER = 'onnx-community/embeddinggemma-300m-ONNX';
29
+ const EMBEDDING_MODEL_CONFIG = {
30
+ runtime: MODEL_RUNTIME,
31
+ url: MODEL_URL,
32
+ sequenceLength: SEQ_LENGTH,
33
+ tokenizer: TOKENIZER
34
+ };
35
+
36
+ // Instantiate VectorSearch Master Class.
37
+ const VECTOR_SEARCH = new VectorSearch(EMBEDDING_MODEL_CONFIG);
38
+
39
+
40
+ async function predictBtnClickHandler() {
41
+ const QUERY_TEXT_VALUE = TARGET_TEXT.value;
42
+ const THRESHOLD = parseFloat(THRESHOLD_INPUT.value) || 0.5;
43
+ const SELECTED_DB = DB_SELECT.value;
44
+
45
+ if (QUERY_TEXT_VALUE && SELECTED_DB) {
46
+ VECTOR_SEARCH.setDb(SELECTED_DB);
47
+ PREDICT_BTN.disabled = true;
48
+ STATUS_EL.innerText = `Searching VectorDB (${SELECTED_DB})...`;
49
+ const t0 = performance.now();
50
+ await predict(QUERY_TEXT_VALUE, THRESHOLD);
51
+ const t1 = performance.now();
52
+ console.log(`Total search time (query embedding + vector search) took ${t1 - t0} milliseconds.`);
53
+ STATUS_EL.innerText = 'Search complete';
54
+ PREDICT_BTN.disabled = false;
55
+ }
56
+ }
57
+
58
+
59
+ async function storeBtnClickHandler() {
60
+ const text = INPUT_TEXT.value.trim();
61
+ const dbName = DB_NAME_INPUT.value.trim();
62
+ if (!text || !dbName) return;
63
+
64
+ STORE_BTN.disabled = true;
65
+
66
+ const paragraphs = text.split(/\n\s*\n/).map(p => p.trim()).filter(p => p.length > 0);
67
+
68
+ await VECTOR_SEARCH.storeTexts(paragraphs, dbName, STATUS_EL);
69
+
70
+ STATUS_EL.innerText = `Stored ${paragraphs.length} paragraphs.`;
71
+ STORE_BTN.disabled = false;
72
+ INPUT_TEXT.value = '';
73
+
74
+ await updateDbList();
75
+ }
76
+
77
+
78
+ async function load() {
79
+ try {
80
+ await updateDbList();
81
+
82
+ // Actually load the runtime and model so ready to use.
83
+ await VECTOR_SEARCH.load(STATUS_EL);
84
+
85
+ STATUS_EL.innerText = 'Ready to store and search';
86
+ STORE_BTN.disabled = false;
87
+ PREDICT_BTN.disabled = false;
88
+
89
+ STORE_BTN.addEventListener('click', storeBtnClickHandler);
90
+ PREDICT_BTN.addEventListener('click', predictBtnClickHandler);
91
+ THRESHOLD_INPUT.addEventListener('input', () => {
92
+ THRESHOLD_VALUE.innerText = THRESHOLD_INPUT.value;
93
+ });
94
+ } catch (e) {
95
+ console.error(e);
96
+ STATUS_EL.innerText = 'Error: ' + e.message;
97
+ }
98
+ }
99
+
100
+
101
+ async function predict(queryText, threshold) {
102
+ // Visualize embeddings and tokens for the search query text.
103
+ const { embedding: EMBEDDING_DATA, tokens: TOKENS } = await VECTOR_SEARCH.getEmbedding(queryText);
104
+ if (TOKENS) {
105
+ VECTOR_SEARCH.renderTokens(TOKENS, QUERY_TOKENS_OUTPUT);
106
+ }
107
+ await VECTOR_SEARCH.renderEmbedding(EMBEDDING_DATA, QUERY_EMBEDDING_VIZ, QUERY_EMBEDDING_TEXT);
108
+
109
+ // Now actually search the vector database.
110
+ const { results: RESULTS, bestScore: BEST_SCORE, bestIndex: BEST_INDEX } = await VECTOR_SEARCH.search(EMBEDDING_DATA, threshold, DB_SELECT.value);
111
+
112
+ if (RESULTS.length > 0) {
113
+ RESULTS_TEXT.value = RESULTS.map(m => `[Score: ${m.score.toFixed(4)}]\n${m.text}`).join('\n\n');
114
+ updateSimilarityUI(BEST_SCORE);
115
+
116
+ const bestMatchVector = RESULTS[BEST_INDEX].vector;
117
+ if (bestMatchVector) {
118
+ await VECTOR_SEARCH.renderEmbedding(bestMatchVector, BEST_MATCH_EMBEDDING_VIZ, BEST_MATCH_EMBEDDING_TEXT);
119
+ }
120
+ } else {
121
+ RESULTS_TEXT.value = "No matches found above threshold.";
122
+ SIMILARITY_CONTAINER.classList.add('hidden');
123
+ BEST_MATCH_EMBEDDING_VIZ.innerHTML = '';
124
+ BEST_MATCH_EMBEDDING_TEXT.innerText = '';
125
+ }
126
+ }
127
+
128
+
129
+ function updateSimilarityUI(score) {
130
+ SIMILARITY_CONTAINER.classList.remove('hidden');
131
+ SIMILARITY_SCORE_EL.innerText = score.toFixed(4);
132
+
133
+ const HUE = Math.max(0, Math.min(120, score * 120));
134
+ const BACKGROUND_COLOUR = `hsla(${HUE}, 70%, 20%, 0.4)`;
135
+ const BORDER_COLOUR = `hsla(${HUE}, 70%, 50%, 0.6)`;
136
+
137
+ SIMILARITY_CONTAINER.style.backgroundColor = BACKGROUND_COLOUR;
138
+ SIMILARITY_CONTAINER.style.borderColor = BORDER_COLOUR;
139
+
140
+ let label = 'Low Similarity';
141
+ if (score > 0.8) {
142
+ label = 'Very High Similarity';
143
+ } else if (score > 0.6) {
144
+ label = 'High Similarity';
145
+ } else if (score > 0.4) {
146
+ label = 'Moderate Similarity';
147
+ }
148
+
149
+ SIMILARITY_LABEL_EL.innerText = label;
150
+ }
151
+
152
+
153
+ async function updateDbList() {
154
+ if (!window.indexedDB.databases) {
155
+ console.warn('indexedDB.databases() is not supported in this browser.');
156
+ return;
157
+ }
158
+
159
+ try {
160
+ const dbs = await window.indexedDB.databases();
161
+ const currentSelection = DB_SELECT.value;
162
+
163
+ DB_SELECT.innerHTML = '';
164
+ const currentInputName = DB_NAME_INPUT.value.trim();
165
+ let names = dbs.map(db => db.name).filter(name => name !== undefined);
166
+
167
+ if (currentInputName && !names.includes(currentInputName)) {
168
+ names.push(currentInputName);
169
+ }
170
+
171
+ names.sort();
172
+
173
+ names.forEach(name => {
174
+ const option = document.createElement('option');
175
+ option.value = name;
176
+ option.text = name;
177
+ if (name === currentSelection || (currentSelection === '' && name === currentInputName)) {
178
+ option.selected = true;
179
+ }
180
+ DB_SELECT.appendChild(option);
181
+ });
182
+ } catch (e) {
183
+ console.error('Error fetching databases:', e);
184
+ }
185
+ }
186
+
187
+
188
+ load();
demo/assets/seedrandom-3.0.5_esm.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.
3
+ * Original file: /npm/seedrandom@3.0.5/index.js
4
+ *
5
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6
+ */
7
+ var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n={exports:{}};!function(t,n,r){function e(t){var n=this,r=function(){var t=4022871197,n=function(n){n=String(n);for(var r=0;r<n.length;r++){var e=.02519603282416938*(t+=n.charCodeAt(r));e-=t=e>>>0,t=(e*=t)>>>0,t+=4294967296*(e-=t)}return 2.3283064365386963e-10*(t>>>0)};return n}();n.next=function(){var t=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=t-(n.c=0|t)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(t),n.s0<0&&(n.s0+=1),n.s1-=r(t),n.s1<0&&(n.s1+=1),n.s2-=r(t),n.s2<0&&(n.s2+=1),r=null}function o(t,n){return n.c=t.c,n.s0=t.s0,n.s1=t.s1,n.s2=t.s2,n}function u(t,n){var r=new e(t),u=n&&n.state,i=r.next;return i.int32=function(){return 4294967296*r.next()|0},i.double=function(){return i()+11102230246251565e-32*(2097152*i()|0)},i.quick=i,u&&("object"==typeof u&&o(u,r),i.state=function(){return o(r,{})}),i}n&&n.exports?n.exports=u:r&&r.amd?r((function(){return u})):this.alea=u}(0,n,!1);var r={exports:{}};!function(t,n,r){function e(t){var n=this,r="";n.x=0,n.y=0,n.z=0,n.w=0,n.next=function(){var t=n.x^n.x<<11;return n.x=n.y,n.y=n.z,n.z=n.w,n.w^=n.w>>>19^t^t>>>8},t===(0|t)?n.x=t:r+=t;for(var e=0;e<r.length+64;e++)n.x^=0|r.charCodeAt(e),n.next()}function o(t,n){return n.x=t.x,n.y=t.y,n.z=t.z,n.w=t.w,n}function u(t,n){var r=new e(t),u=n&&n.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var t=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},i.int32=r.next,i.quick=i,u&&("object"==typeof u&&o(u,r),i.state=function(){return o(r,{})}),i}n&&n.exports?n.exports=u:r&&r.amd?r((function(){return u})):this.xor128=u}(0,r,!1);var e={exports:{}};!function(t,n,r){function e(t){var n=this,r="";n.next=function(){var t=n.x^n.x>>>2;return n.x=n.y,n.y=n.z,n.z=n.w,n.w=n.v,(n.d=n.d+362437|0)+(n.v=n.v^n.v<<4^t^t<<1)|0},n.x=0,n.y=0,n.z=0,n.w=0,n.v=0,t===(0|t)?n.x=t:r+=t;for(var e=0;e<r.length+64;e++)n.x^=0|r.charCodeAt(e),e==r.length&&(n.d=n.x<<10^n.x>>>4),n.next()}function o(t,n){return n.x=t.x,n.y=t.y,n.z=t.z,n.w=t.w,n.v=t.v,n.d=t.d,n}function u(t,n){var r=new e(t),u=n&&n.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var t=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},i.int32=r.next,i.quick=i,u&&("object"==typeof u&&o(u,r),i.state=function(){return o(r,{})}),i}n&&n.exports?n.exports=u:r&&r.amd?r((function(){return u})):this.xorwow=u}(0,e,!1);var o={exports:{}};!function(t,n,r){function e(t){var n=this;n.next=function(){var t,r,e=n.x,o=n.i;return t=e[o],r=(t^=t>>>7)^t<<24,r^=(t=e[o+1&7])^t>>>10,r^=(t=e[o+3&7])^t>>>3,r^=(t=e[o+4&7])^t<<7,t=e[o+7&7],r^=(t^=t<<13)^t<<9,e[o]=r,n.i=o+1&7,r},function(t,n){var r,e=[];if(n===(0|n))e[0]=n;else for(n=""+n,r=0;r<n.length;++r)e[7&r]=e[7&r]<<15^n.charCodeAt(r)+e[r+1&7]<<13;for(;e.length<8;)e.push(0);for(r=0;r<8&&0===e[r];++r);for(8==r?e[7]=-1:e[r],t.x=e,t.i=0,r=256;r>0;--r)t.next()}(n,t)}function o(t,n){return n.x=t.x.slice(),n.i=t.i,n}function u(t,n){null==t&&(t=+new Date);var r=new e(t),u=n&&n.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var t=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},i.int32=r.next,i.quick=i,u&&(u.x&&o(u,r),i.state=function(){return o(r,{})}),i}n&&n.exports?n.exports=u:r&&r.amd?r((function(){return u})):this.xorshift7=u}(0,o,!1);var u={exports:{}};!function(t,n,r){function e(t){var n=this;n.next=function(){var t,r,e=n.w,o=n.X,u=n.i;return n.w=e=e+1640531527|0,r=o[u+34&127],t=o[u=u+1&127],r^=r<<13,t^=t<<17,r^=r>>>15,t^=t>>>12,r=o[u]=r^t,n.i=u,r+(e^e>>>16)|0},function(t,n){var r,e,o,u,i,f=[],a=128;for(n===(0|n)?(e=n,n=null):(n+="\0",e=0,a=Math.max(a,n.length)),o=0,u=-32;u<a;++u)n&&(e^=n.charCodeAt((u+32)%n.length)),0===u&&(i=e),e^=e<<10,e^=e>>>15,e^=e<<4,e^=e>>>13,u>=0&&(i=i+1640531527|0,o=0==(r=f[127&u]^=e+i)?o+1:0);for(o>=128&&(f[127&(n&&n.length||0)]=-1),o=127,u=512;u>0;--u)e=f[o+34&127],r=f[o=o+1&127],e^=e<<13,r^=r<<17,e^=e>>>15,r^=r>>>12,f[o]=e^r;t.w=i,t.X=f,t.i=o}(n,t)}function o(t,n){return n.i=t.i,n.w=t.w,n.X=t.X.slice(),n}function u(t,n){null==t&&(t=+new Date);var r=new e(t),u=n&&n.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var t=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},i.int32=r.next,i.quick=i,u&&(u.X&&o(u,r),i.state=function(){return o(r,{})}),i}n&&n.exports?n.exports=u:r&&r.amd?r((function(){return u})):this.xor4096=u}(0,u,!1);var i={exports:{}};!function(t,n,r){function e(t){var n=this,r="";n.next=function(){var t=n.b,r=n.c,e=n.d,o=n.a;return t=t<<25^t>>>7^r,r=r-e|0,e=e<<24^e>>>8^o,o=o-t|0,n.b=t=t<<20^t>>>12^r,n.c=r=r-e|0,n.d=e<<16^r>>>16^o,n.a=o-t|0},n.a=0,n.b=0,n.c=-1640531527,n.d=1367130551,t===Math.floor(t)?(n.a=t/4294967296|0,n.b=0|t):r+=t;for(var e=0;e<r.length+20;e++)n.b^=0|r.charCodeAt(e),n.next()}function o(t,n){return n.a=t.a,n.b=t.b,n.c=t.c,n.d=t.d,n}function u(t,n){var r=new e(t),u=n&&n.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var t=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},i.int32=r.next,i.quick=i,u&&("object"==typeof u&&o(u,r),i.state=function(){return o(r,{})}),i}n&&n.exports?n.exports=u:r&&r.amd?r((function(){return u})):this.tychei=u}(0,i,!1);var f,a={exports:{}};f=a,function(t,n,r){var e,o=256,u="random",i=r.pow(o,6),a=r.pow(2,52),c=2*a,s=255;function x(f,s,x){var w=[],y=h(d((s=1==s?{entropy:!0}:s||{}).entropy?[f,p(n)]:null==f?function(){try{var r;return e&&(r=e.randomBytes)?r=r(o):(r=new Uint8Array(o),(t.crypto||t.msCrypto).getRandomValues(r)),p(r)}catch(r){var u=t.navigator,i=u&&u.plugins;return[+new Date,t,i,t.screen,p(n)]}}():f,3),w),g=new l(w),b=function(){for(var t=g.g(6),n=i,r=0;t<a;)t=(t+r)*o,n*=o,r=g.g(1);for(;t>=c;)t/=2,n/=2,r>>>=1;return(t+r)/n};return b.int32=function(){return 0|g.g(4)},b.quick=function(){return g.g(4)/4294967296},b.double=b,h(p(g.S),n),(s.pass||x||function(t,n,e,o){return o&&(o.S&&v(o,g),t.state=function(){return v(g,{})}),e?(r[u]=t,n):t})(b,y,"global"in s?s.global:this==r,s.state)}function l(t){var n,r=t.length,e=this,u=0,i=e.i=e.j=0,f=e.S=[];for(r||(t=[r++]);u<o;)f[u]=u++;for(u=0;u<o;u++)f[u]=f[i=s&i+t[u%r]+(n=f[u])],f[i]=n;(e.g=function(t){for(var n,r=0,u=e.i,i=e.j,f=e.S;t--;)n=f[u=s&u+1],r=r*o+f[s&(f[u]=f[i=s&i+n])+(f[i]=n)];return e.i=u,e.j=i,r})(o)}function v(t,n){return n.i=t.i,n.j=t.j,n.S=t.S.slice(),n}function d(t,n){var r,e=[],o=typeof t;if(n&&"object"==o)for(r in t)try{e.push(d(t[r],n-1))}catch(t){}return e.length?e:"string"==o?t:t+"\0"}function h(t,n){for(var r,e=t+"",o=0;o<e.length;)n[s&o]=s&(r^=19*n[s&o])+e.charCodeAt(o++);return p(n)}function p(t){return String.fromCharCode.apply(0,t)}if(h(r.random(),n),f.exports){f.exports=x;try{e=require("crypto")}catch(t){}}else r["seed"+u]=x}("undefined"!=typeof self?self:t,[],Math);var c=n.exports,s=r.exports,x=e.exports,l=o.exports,v=u.exports,d=i.exports,h=a.exports;h.alea=c,h.xor128=s,h.xorwow=x,h.xorshift7=l,h.xor4096=v,h.tychei=d;var p=h;export{p as default};
8
+ //# sourceMappingURL=seedrandom-3.0.5_esm.js.map
demo/assets/seedrandom-3.0.5_esm.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"sources":["jsdelivr-header.js","/npm/seedrandom@3.0.5/lib/alea.js","/npm/seedrandom@3.0.5/lib/xor128.js","/npm/seedrandom@3.0.5/lib/xorwow.js","/npm/seedrandom@3.0.5/lib/xorshift7.js","/npm/seedrandom@3.0.5/lib/xor4096.js","/npm/seedrandom@3.0.5/lib/tychei.js","/npm/seedrandom@3.0.5/seedrandom.js","/npm/seedrandom@3.0.5/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,qKCqBA,SAAU,EAAQ,EAAQ,GAE1B,SAAS,EAAK,GACZ,IAAI,EAAK,KAAM,EA+CjB,WACE,IAAI,EAAI,WAEJ,EAAO,SAAS,GAClB,EAAO,OAAO,GACd,IAAK,IAAI,EAAI,EAAG,EAAI,EAAK,OAAQ,IAAK,CAEpC,IAAI,EAAI,oBADR,GAAK,EAAK,WAAW,IAGrB,GADA,EAAI,IAAM,EAGV,GADA,GAAK,KACK,EAEV,GAAS,YADT,GAAK,EAEX,CACI,OAAmB,wBAAX,IAAM,EAClB,EAEE,OAAO,CACT,CAlEwB,GAEtB,EAAG,KAAO,WACR,IAAI,EAAI,QAAU,EAAG,GAAY,uBAAP,EAAG,EAG7B,OAFA,EAAG,GAAK,EAAG,G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,EAAK,OAAS,GAAW,CAK1B,CA9ND,CAiOmB,oBAAT,KAAwB,KAAO,EACvC,GACA,MC/OF,IAAI,EAAO,UAKP,EAAS,UAKT,EAAS,UAQT,EAAY,UASZ,EAAU,UAOV,EAAS,UAIT,EAAK,UAET,EAAG,KAAO,EACV,EAAG,OAAS,EACZ,EAAG,OAAS,EACZ,EAAG,UAAY,EACf,EAAG,QAAU,EACb,EAAG,OAAS,EAEZ,IAAA,EAAiB,S","file":"/npm/seedrandom@3.0.5/index.js/+esm","sourceRoot":"","sourcesContent":["/**\n * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.\n * Original file: /npm/seedrandom@3.0.5/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","// A port of an algorithm by Johannes Baagøe <baagoe@baagoe.com>, 2010\n// http://baagoe.com/en/RandomMusings/javascript/\n// https://github.com/nquinlan/better-random-numbers-for-javascript-mirror\n// Original work is under MIT license -\n\n// Copyright (C) 2010 by Johannes Baagøe <baagoe@baagoe.org>\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n\n\n(function(global, module, define) {\n\nfunction Alea(seed) {\n var me = this, mash = Mash();\n\n me.next = function() {\n var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32\n me.s0 = me.s1;\n me.s1 = me.s2;\n return me.s2 = t - (me.c = t | 0);\n };\n\n // Apply the seeding algorithm from Baagoe.\n me.c = 1;\n me.s0 = mash(' ');\n me.s1 = mash(' ');\n me.s2 = mash(' ');\n me.s0 -= mash(seed);\n if (me.s0 < 0) { me.s0 += 1; }\n me.s1 -= mash(seed);\n if (me.s1 < 0) { me.s1 += 1; }\n me.s2 -= mash(seed);\n if (me.s2 < 0) { me.s2 += 1; }\n mash = null;\n}\n\nfunction copy(f, t) {\n t.c = f.c;\n t.s0 = f.s0;\n t.s1 = f.s1;\n t.s2 = f.s2;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new Alea(seed),\n state = opts && opts.state,\n prng = xg.next;\n prng.int32 = function() { return (xg.next() * 0x100000000) | 0; }\n prng.double = function() {\n return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53\n };\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nfunction Mash() {\n var n = 0xefc8249d;\n\n var mash = function(data) {\n data = String(data);\n for (var i = 0; i < data.length; i++) {\n n += data.charCodeAt(i);\n var h = 0.02519603282416938 * n;\n n = h >>> 0;\n h -= n;\n h *= n;\n n = h >>> 0;\n h -= n;\n n += h * 0x100000000; // 2^32\n }\n return (n >>> 0) * 2.3283064365386963e-10; // 2^-32\n };\n\n return mash;\n}\n\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.alea = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","// A Javascript implementaion of the \"xor128\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n\n // Set up generator function.\n me.next = function() {\n var t = me.x ^ (me.x << 11);\n me.x = me.y;\n me.y = me.z;\n me.z = me.w;\n return me.w ^= (me.w >>> 19) ^ t ^ (t >>> 8);\n };\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor128 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","// A Javascript implementaion of the \"xorwow\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var t = (me.x ^ (me.x >>> 2));\n me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v;\n return (me.d = (me.d + 362437 | 0)) +\n (me.v = (me.v ^ (me.v << 4)) ^ (t ^ (t << 1))) | 0;\n };\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n me.v = 0;\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n if (k == strseed.length) {\n me.d = me.x << 10 ^ me.x >>> 4;\n }\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n t.v = f.v;\n t.d = f.d;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorwow = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","// A Javascript implementaion of the \"xorshift7\" algorithm by\n// François Panneton and Pierre L'ecuyer:\n// \"On the Xorgshift Random Number Generators\"\n// http://saluc.engr.uconn.edu/refs/crypto/rng/panneton05onthexorshift.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n // Update xor generator.\n var X = me.x, i = me.i, t, v, w;\n t = X[i]; t ^= (t >>> 7); v = t ^ (t << 24);\n t = X[(i + 1) & 7]; v ^= t ^ (t >>> 10);\n t = X[(i + 3) & 7]; v ^= t ^ (t >>> 3);\n t = X[(i + 4) & 7]; v ^= t ^ (t << 7);\n t = X[(i + 7) & 7]; t = t ^ (t << 13); v ^= t ^ (t << 9);\n X[i] = v;\n me.i = (i + 1) & 7;\n return v;\n };\n\n function init(me, seed) {\n var j, w, X = [];\n\n if (seed === (seed | 0)) {\n // Seed state array using a 32-bit integer.\n w = X[0] = seed;\n } else {\n // Seed state using a string.\n seed = '' + seed;\n for (j = 0; j < seed.length; ++j) {\n X[j & 7] = (X[j & 7] << 15) ^\n (seed.charCodeAt(j) + X[(j + 1) & 7] << 13);\n }\n }\n // Enforce an array length of 8, not all zeroes.\n while (X.length < 8) X.push(0);\n for (j = 0; j < 8 && X[j] === 0; ++j);\n if (j == 8) w = X[7] = -1; else w = X[j];\n\n me.x = X;\n me.i = 0;\n\n // Discard an initial 256 values.\n for (j = 256; j > 0; --j) {\n me.next();\n }\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.x = f.x.slice();\n t.i = f.i;\n return t;\n}\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.x) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorshift7 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n","// A Javascript implementaion of Richard Brent's Xorgens xor4096 algorithm.\n//\n// This fast non-cryptographic random number generator is designed for\n// use in Monte-Carlo algorithms. It combines a long-period xorshift\n// generator with a Weyl generator, and it passes all common batteries\n// of stasticial tests for randomness while consuming only a few nanoseconds\n// for each prng generated. For background on the generator, see Brent's\n// paper: \"Some long-period random number generators using shifts and xors.\"\n// http://arxiv.org/pdf/1004.3115v1.pdf\n//\n// Usage:\n//\n// var xor4096 = require('xor4096');\n// random = xor4096(1); // Seed with int32 or string.\n// assert.equal(random(), 0.1520436450538547); // (0, 1) range, 53 bits.\n// assert.equal(random.int32(), 1806534897); // signed int32, 32 bits.\n//\n// For nonzero numeric keys, this impelementation provides a sequence\n// identical to that by Brent's xorgens 3 implementaion in C. This\n// implementation also provides for initalizing the generator with\n// string seeds, or for saving and restoring the state of the generator.\n//\n// On Chrome, this prng benchmarks about 2.1 times slower than\n// Javascript's built-in Math.random().\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n var w = me.w,\n X = me.X, i = me.i, t, v;\n // Update Weyl generator.\n me.w = w = (w + 0x61c88647) | 0;\n // Update xor generator.\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n // Update Xor generator array state.\n v = X[i] = v ^ t;\n me.i = i;\n // Result is the combination.\n return (v + (w ^ (w >>> 16))) | 0;\n };\n\n function init(me, seed) {\n var t, v, i, j, w, X = [], limit = 128;\n if (seed === (seed | 0)) {\n // Numeric seeds initialize v, which is used to generates X.\n v = seed;\n seed = null;\n } else {\n // String seeds are mixed into v and X one character at a time.\n seed = seed + '\\0';\n v = 0;\n limit = Math.max(limit, seed.length);\n }\n // Initialize circular array and weyl value.\n for (i = 0, j = -32; j < limit; ++j) {\n // Put the unicode characters into the array, and shuffle them.\n if (seed) v ^= seed.charCodeAt((j + 32) % seed.length);\n // After 32 shuffles, take v as the starting w value.\n if (j === 0) w = v;\n v ^= v << 10;\n v ^= v >>> 15;\n v ^= v << 4;\n v ^= v >>> 13;\n if (j >= 0) {\n w = (w + 0x61c88647) | 0; // Weyl.\n t = (X[j & 127] ^= (v + w)); // Combine xor and weyl to init array.\n i = (0 == t) ? i + 1 : 0; // Count zeroes.\n }\n }\n // We have detected all zeroes; make the key nonzero.\n if (i >= 128) {\n X[(seed && seed.length || 0) & 127] = -1;\n }\n // Run the generator 512 times to further mix the state before using it.\n // Factoring this as a function slows the main generator, so it is just\n // unrolled here. The weyl generator is not advanced while warming up.\n i = 127;\n for (j = 4 * 128; j > 0; --j) {\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n X[i] = v ^ t;\n }\n // Storing state as object members is faster than using closure variables.\n me.w = w;\n me.X = X;\n me.i = i;\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.i = f.i;\n t.w = f.w;\n t.X = f.X.slice();\n return t;\n};\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.X) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor4096 = impl;\n}\n\n})(\n this, // window object or global\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n","// A Javascript implementaion of the \"Tyche-i\" prng algorithm by\n// Samuel Neves and Filipe Araujo.\n// See https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var b = me.b, c = me.c, d = me.d, a = me.a;\n b = (b << 25) ^ (b >>> 7) ^ c;\n c = (c - d) | 0;\n d = (d << 24) ^ (d >>> 8) ^ a;\n a = (a - b) | 0;\n me.b = b = (b << 20) ^ (b >>> 12) ^ c;\n me.c = c = (c - d) | 0;\n me.d = (d << 16) ^ (c >>> 16) ^ a;\n return me.a = (a - b) | 0;\n };\n\n /* The following is non-inverted tyche, which has better internal\n * bit diffusion, but which is about 25% slower than tyche-i in JS.\n me.next = function() {\n var a = me.a, b = me.b, c = me.c, d = me.d;\n a = (me.a + me.b | 0) >>> 0;\n d = me.d ^ a; d = d << 16 ^ d >>> 16;\n c = me.c + d | 0;\n b = me.b ^ c; b = b << 12 ^ d >>> 20;\n me.a = a = a + b | 0;\n d = d ^ a; me.d = d = d << 8 ^ d >>> 24;\n me.c = c = c + d | 0;\n b = b ^ c;\n return me.b = (b << 7 ^ b >>> 25);\n }\n */\n\n me.a = 0;\n me.b = 0;\n me.c = 2654435769 | 0;\n me.d = 1367130551;\n\n if (seed === Math.floor(seed)) {\n // Integer seed.\n me.a = (seed / 0x100000000) | 0;\n me.b = seed | 0;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 20; k++) {\n me.b ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.a = f.a;\n t.b = f.b;\n t.c = f.c;\n t.d = f.d;\n return t;\n};\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.tychei = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","/*\nCopyright 2019 David Bau.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n*/\n\n(function (global, pool, math) {\n//\n// The following constants are related to IEEE 754 limits.\n//\n\nvar width = 256, // each RC4 output is 0 <= x < 256\n chunks = 6, // at least six RC4 outputs for each double\n digits = 52, // there are 52 significant digits in a double\n rngname = 'random', // rngname: name for Math.random and Math.seedrandom\n startdenom = math.pow(width, chunks),\n significance = math.pow(2, digits),\n overflow = significance * 2,\n mask = width - 1,\n nodecrypto; // node.js crypto module, initialized at the bottom.\n\n//\n// seedrandom()\n// This is the seedrandom function described above.\n//\nfunction seedrandom(seed, options, callback) {\n var key = [];\n options = (options == true) ? { entropy: true } : (options || {});\n\n // Flatten the seed string or build one from local entropy if needed.\n var shortseed = mixkey(flatten(\n options.entropy ? [seed, tostring(pool)] :\n (seed == null) ? autoseed() : seed, 3), key);\n\n // Use the seed to initialize an ARC4 generator.\n var arc4 = new ARC4(key);\n\n // This function returns a random double in [0, 1) that contains\n // randomness in every bit of the mantissa of the IEEE 754 value.\n var prng = function() {\n var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48\n d = startdenom, // and denominator d = 2 ^ 48.\n x = 0; // and no 'extra last byte'.\n while (n < significance) { // Fill up all significant digits by\n n = (n + x) * width; // shifting numerator and\n d *= width; // denominator and generating a\n x = arc4.g(1); // new least-significant-byte.\n }\n while (n >= overflow) { // To avoid rounding up, before adding\n n /= 2; // last byte, shift everything\n d /= 2; // right using integer math until\n x >>>= 1; // we have exactly the desired bits.\n }\n return (n + x) / d; // Form the number within [0, 1).\n };\n\n prng.int32 = function() { return arc4.g(4) | 0; }\n prng.quick = function() { return arc4.g(4) / 0x100000000; }\n prng.double = prng;\n\n // Mix the randomness into accumulated entropy.\n mixkey(tostring(arc4.S), pool);\n\n // Calling convention: what to return as a function of prng, seed, is_math.\n return (options.pass || callback ||\n function(prng, seed, is_math_call, state) {\n if (state) {\n // Load the arc4 state from the given state if it has an S array.\n if (state.S) { copy(state, arc4); }\n // Only provide the .state method if requested via options.state.\n prng.state = function() { return copy(arc4, {}); }\n }\n\n // If called as a method of Math (Math.seedrandom()), mutate\n // Math.random because that is how seedrandom.js has worked since v1.0.\n if (is_math_call) { math[rngname] = prng; return seed; }\n\n // Otherwise, it is a newer calling convention, so return the\n // prng directly.\n else return prng;\n })(\n prng,\n shortseed,\n 'global' in options ? options.global : (this == math),\n options.state);\n}\n\n//\n// ARC4\n//\n// An ARC4 implementation. The constructor takes a key in the form of\n// an array of at most (width) integers that should be 0 <= x < (width).\n//\n// The g(count) method returns a pseudorandom integer that concatenates\n// the next (count) outputs from ARC4. Its return value is a number x\n// that is in the range 0 <= x < (width ^ count).\n//\nfunction ARC4(key) {\n var t, keylen = key.length,\n me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];\n\n // The empty key [] is treated as [0].\n if (!keylen) { key = [keylen++]; }\n\n // Set up S using the standard key scheduling algorithm.\n while (i < width) {\n s[i] = i++;\n }\n for (i = 0; i < width; i++) {\n s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];\n s[j] = t;\n }\n\n // The \"g\" method returns the next (count) outputs as one number.\n (me.g = function(count) {\n // Using instance members instead of closure state nearly doubles speed.\n var t, r = 0,\n i = me.i, j = me.j, s = me.S;\n while (count--) {\n t = s[i = mask & (i + 1)];\n r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];\n }\n me.i = i; me.j = j;\n return r;\n // For robust unpredictability, the function call below automatically\n // discards an initial batch of values. This is called RC4-drop[256].\n // See http://google.com/search?q=rsa+fluhrer+response&btnI\n })(width);\n}\n\n//\n// copy()\n// Copies internal state of ARC4 to or from a plain object.\n//\nfunction copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n};\n\n//\n// flatten()\n// Converts an object tree to nested arrays of strings.\n//\nfunction flatten(obj, depth) {\n var result = [], typ = (typeof obj), prop;\n if (depth && typ == 'object') {\n for (prop in obj) {\n try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}\n }\n }\n return (result.length ? result : typ == 'string' ? obj : obj + '\\0');\n}\n\n//\n// mixkey()\n// Mixes a string seed into a key that is an array of integers, and\n// returns a shortened string seed that is equivalent to the result key.\n//\nfunction mixkey(seed, key) {\n var stringseed = seed + '', smear, j = 0;\n while (j < stringseed.length) {\n key[mask & j] =\n mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));\n }\n return tostring(key);\n}\n\n//\n// autoseed()\n// Returns an object for autoseeding, using window.crypto and Node crypto\n// module if available.\n//\nfunction autoseed() {\n try {\n var out;\n if (nodecrypto && (out = nodecrypto.randomBytes)) {\n // The use of 'out' to remember randomBytes makes tight minified code.\n out = out(width);\n } else {\n out = new Uint8Array(width);\n (global.crypto || global.msCrypto).getRandomValues(out);\n }\n return tostring(out);\n } catch (e) {\n var browser = global.navigator,\n plugins = browser && browser.plugins;\n return [+new Date, global, plugins, global.screen, tostring(pool)];\n }\n}\n\n//\n// tostring()\n// Converts an array of charcodes to a string\n//\nfunction tostring(a) {\n return String.fromCharCode.apply(0, a);\n}\n\n//\n// When seedrandom.js is loaded, we immediately mix a few bits\n// from the built-in RNG into the entropy pool. Because we do\n// not want to interfere with deterministic PRNG state later,\n// seedrandom will not call math.random on its own again after\n// initialization.\n//\nmixkey(math.random(), pool);\n\n//\n// Nodejs and AMD support: export the implementation as a module using\n// either convention.\n//\nif ((typeof module) == 'object' && module.exports) {\n module.exports = seedrandom;\n // When in node.js, try using crypto package for autoseeding.\n try {\n nodecrypto = require('crypto');\n } catch (ex) {}\n} else if ((typeof define) == 'function' && define.amd) {\n define(function() { return seedrandom; });\n} else {\n // When included as a plain script, set up Math.seedrandom global.\n math['seed' + rngname] = seedrandom;\n}\n\n\n// End anonymous scope, and pass initial values.\n})(\n // global: `self` in browsers (including strict mode and web workers),\n // otherwise `this` in Node and other environments\n (typeof self !== 'undefined') ? self : this,\n [], // pool: entropy pool starts empty\n Math // math: package containing random, pow, and seedrandom\n);\n","// A library of seedable RNGs implemented in Javascript.\n//\n// Usage:\n//\n// var seedrandom = require('seedrandom');\n// var random = seedrandom(1); // or any seed.\n// var x = random(); // 0 <= x < 1. Every bit is random.\n// var x = random.quick(); // 0 <= x < 1. 32 bits of randomness.\n\n// alea, a 53-bit multiply-with-carry generator by Johannes Baagøe.\n// Period: ~2^116\n// Reported to pass all BigCrush tests.\nvar alea = require('./lib/alea');\n\n// xor128, a pure xor-shift generator by George Marsaglia.\n// Period: 2^128-1.\n// Reported to fail: MatrixRank and LinearComp.\nvar xor128 = require('./lib/xor128');\n\n// xorwow, George Marsaglia's 160-bit xor-shift combined plus weyl.\n// Period: 2^192-2^32\n// Reported to fail: CollisionOver, SimpPoker, and LinearComp.\nvar xorwow = require('./lib/xorwow');\n\n// xorshift7, by François Panneton and Pierre L'ecuyer, takes\n// a different approach: it adds robustness by allowing more shifts\n// than Marsaglia's original three. It is a 7-shift generator\n// with 256 bits, that passes BigCrush with no systmatic failures.\n// Period 2^256-1.\n// No systematic BigCrush failures reported.\nvar xorshift7 = require('./lib/xorshift7');\n\n// xor4096, by Richard Brent, is a 4096-bit xor-shift with a\n// very long period that also adds a Weyl generator. It also passes\n// BigCrush with no systematic failures. Its long period may\n// be useful if you have many generators and need to avoid\n// collisions.\n// Period: 2^4128-2^32.\n// No systematic BigCrush failures reported.\nvar xor4096 = require('./lib/xor4096');\n\n// Tyche-i, by Samuel Neves and Filipe Araujo, is a bit-shifting random\n// number generator derived from ChaCha, a modern stream cipher.\n// https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n// Period: ~2^127\n// No systematic BigCrush failures reported.\nvar tychei = require('./lib/tychei');\n\n// The original ARC4-based prng included in this library.\n// Period: ~2^1600\nvar sr = require('./seedrandom');\n\nsr.alea = alea;\nsr.xor128 = xor128;\nsr.xorwow = xorwow;\nsr.xorshift7 = xorshift7;\nsr.xor4096 = xor4096;\nsr.tychei = tychei;\n\nmodule.exports = sr;\n"]}
demo/assets/style.css ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ --primary: #4285f4;
3
+ --bg: #0b0e14;
4
+ --card-bg: rgba(255, 255, 255, 0.05);
5
+ --border: rgba(255, 255, 255, 0.12);
6
+ --text-main: #e8eaed;
7
+ --text-sub: #9aa0a6;
8
+ --accent: #8ab4f8;
9
+ }
10
+
11
+ body {
12
+ margin: 0;
13
+ padding: 0;
14
+ font-family: "Roboto", "Inter", system-ui, -apple-system, sans-serif;
15
+ background-color: var(--bg);
16
+ color: var(--text-main);
17
+ display: flex;
18
+ justify-content: center;
19
+ align-items: center;
20
+ min-height: 100vh;
21
+ overflow-x: hidden;
22
+ }
23
+
24
+ #container {
25
+ max-width: 1600px;
26
+ width: 95%;
27
+ padding: 40px 20px;
28
+ }
29
+
30
+ header {
31
+ text-align: center;
32
+ margin-bottom: 40px;
33
+ }
34
+
35
+ h1 {
36
+ font-size: 2.5rem;
37
+ font-weight: 700;
38
+ margin: 0 0 10px 0;
39
+ background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
40
+ -webkit-background-clip: text;
41
+ background-clip: text;
42
+ -webkit-text-fill-color: transparent;
43
+ }
44
+
45
+ header p {
46
+ color: var(--text-sub);
47
+ font-size: 1.1rem;
48
+ }
49
+
50
+ .card {
51
+ background: var(--card-bg);
52
+ backdrop-filter: blur(10px);
53
+ border: 1px solid var(--border);
54
+ border-radius: 20px;
55
+ padding: 24px;
56
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
57
+ }
58
+
59
+ .input-section {
60
+ margin-bottom: 24px;
61
+ }
62
+
63
+ details {
64
+ background: rgba(255, 255, 255, 0.03);
65
+ border: 1px solid var(--border);
66
+ border-radius: 12px;
67
+ overflow: hidden;
68
+ transition: background 0.3s;
69
+ }
70
+
71
+ details[open] {
72
+ background: rgba(255, 255, 255, 0.05);
73
+ padding-bottom: 20px;
74
+ }
75
+
76
+ summary {
77
+ padding: 16px 20px;
78
+ cursor: pointer;
79
+ font-weight: 600;
80
+ color: var(--accent);
81
+ list-style: none;
82
+ display: flex;
83
+ justify-content: space-between;
84
+ align-items: center;
85
+ user-select: none;
86
+ }
87
+
88
+ summary::-webkit-details-marker {
89
+ display: none;
90
+ }
91
+
92
+ summary::after {
93
+ content: "▼";
94
+ font-size: 0.8rem;
95
+ transition: transform 0.3s;
96
+ }
97
+
98
+ details[open] summary::after {
99
+ transform: rotate(180deg);
100
+ }
101
+
102
+ summary:hover {
103
+ background: rgba(255, 255, 255, 0.08);
104
+ }
105
+
106
+ .accordion-content {
107
+ padding: 0 20px;
108
+ display: flex;
109
+ flex-direction: column;
110
+ gap: 20px;
111
+ }
112
+
113
+ .input-group-vertical {
114
+ display: flex;
115
+ flex-direction: column;
116
+ gap: 20px;
117
+ }
118
+
119
+ .input-wrapper {
120
+ display: flex;
121
+ flex-direction: column;
122
+ gap: 8px;
123
+ }
124
+
125
+ input[type="text"] {
126
+ background: rgba(0, 0, 0, 0.2);
127
+ border: 1px solid var(--border);
128
+ border-radius: 12px;
129
+ padding: 14px 20px;
130
+ color: #fff;
131
+ font-size: 1rem;
132
+ transition: border-color 0.3s;
133
+ }
134
+
135
+ input[type="text"]:focus {
136
+ outline: none;
137
+ border-color: var(--accent);
138
+ }
139
+
140
+ button {
141
+ background: var(--primary);
142
+ color: #fff;
143
+ border: none;
144
+ border-radius: 12px;
145
+ padding: 18px 24px;
146
+ font-weight: 600;
147
+ font-size: 1rem;
148
+ cursor: pointer;
149
+ transition: transform 0.2s, background 0.3s;
150
+ }
151
+
152
+ button:hover {
153
+ background: #3367d6;
154
+ transform: translateY(-1px);
155
+ }
156
+
157
+ button:active {
158
+ transform: translateY(1px);
159
+ }
160
+
161
+ button:disabled {
162
+ background: #3c4043;
163
+ cursor: not-allowed;
164
+ transform: none;
165
+ }
166
+
167
+ .status {
168
+ margin: 24px auto 0 auto;
169
+ font-size: 0.9rem;
170
+ color: #fff;
171
+ text-align: center;
172
+ background: rgba(251, 188, 4, 0.15);
173
+ border: 1px solid rgba(251, 188, 4, 0.4);
174
+ padding: 8px 24px;
175
+ border-radius: 50px;
176
+ display: block;
177
+ width: fit-content;
178
+ font-weight: 500;
179
+ box-shadow: 0 4px 12px rgba(251, 188, 4, 0.15);
180
+ }
181
+
182
+ #similarity-container {
183
+ text-align: center;
184
+ padding: 24px;
185
+ border-radius: 12px;
186
+ transition: background-color 0.5s ease, border-color 0.5s ease;
187
+ border: 1px solid transparent;
188
+ }
189
+
190
+ .score-display {
191
+ font-size: 4rem;
192
+ font-weight: 800;
193
+ font-family: "Roboto Mono", monospace;
194
+ margin: 10px 0;
195
+ letter-spacing: -0.05em;
196
+ text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
197
+ }
198
+
199
+ .main-layout {
200
+ display: flex;
201
+ gap: 32px;
202
+ align-items: flex-start;
203
+ }
204
+
205
+ .side-panel {
206
+ flex: 0 0 450px;
207
+ display: flex;
208
+ flex-direction: column;
209
+ gap: 24px;
210
+ }
211
+
212
+ .main-panel {
213
+ flex: 1;
214
+ min-width: 0;
215
+ }
216
+
217
+ .comparison-grid {
218
+ display: flex;
219
+ gap: 24px;
220
+ }
221
+
222
+ .comparison-grid .visual-sub-section {
223
+ flex: 1;
224
+ min-width: 0;
225
+ }
226
+
227
+ .results-grid {
228
+ display: flex;
229
+ flex-direction: column;
230
+ gap: 24px;
231
+ }
232
+
233
+ .result-card h3 {
234
+ margin-top: 0;
235
+ font-size: 1.5rem;
236
+ font-weight: 700;
237
+ color: var(--accent);
238
+ margin-bottom: 4px;
239
+ }
240
+
241
+ .visual-sub-section {
242
+ margin-top: 24px;
243
+ padding-top: 24px;
244
+ border-top: 1px solid var(--border);
245
+ }
246
+
247
+ .visual-sub-section h4 {
248
+ margin: 0;
249
+ font-size: 1.1rem;
250
+ font-weight: 600;
251
+ }
252
+
253
+ .mini-subtitle {
254
+ color: var(--text-sub);
255
+ font-size: 0.8rem;
256
+ margin-bottom: 16px;
257
+ }
258
+
259
+ .subtitle {
260
+ color: var(--text-sub);
261
+ font-size: 0.9rem;
262
+ margin-bottom: 24px;
263
+ }
264
+
265
+ .tokens-list {
266
+ display: flex;
267
+ flex-wrap: wrap;
268
+ gap: 6px;
269
+ max-height: 200px;
270
+ overflow-y: auto;
271
+ padding-right: 8px;
272
+ }
273
+
274
+ .token-chip {
275
+ background: rgba(138, 180, 248, 0.15);
276
+ border: 1px solid rgba(138, 180, 248, 0.3);
277
+ color: var(--accent);
278
+ padding: 4px 10px;
279
+ border-radius: 8px;
280
+ font-size: 0.85rem;
281
+ font-family: "Roboto Mono", monospace;
282
+ }
283
+
284
+ .token-chip.padded {
285
+ opacity: 0.3;
286
+ background: rgba(255, 255, 255, 0.05);
287
+ border-color: transparent;
288
+ color: #fff;
289
+ }
290
+
291
+ .embedding-viz {
292
+ display: grid;
293
+ grid-template-columns: repeat(32, 1fr);
294
+ gap: 1px;
295
+ }
296
+
297
+ .viz-cell {
298
+ aspect-ratio: 1;
299
+ border-radius: 2px;
300
+ }
301
+
302
+ .embedding-text {
303
+ margin-top: 20px;
304
+ font-family: "Roboto Mono", monospace;
305
+ font-size: 0.8rem;
306
+ color: var(--text-sub);
307
+ line-height: 1.5;
308
+ word-break: break-all;
309
+ }
310
+
311
+ /* Scrollbar styling */
312
+ ::-webkit-scrollbar {
313
+ width: 6px;
314
+ }
315
+ ::-webkit-scrollbar-track {
316
+ background: rgba(0, 0, 0, 0.1);
317
+ }
318
+ ::-webkit-scrollbar-thumb {
319
+ background: var(--border);
320
+ border-radius: 3px;
321
+ }
322
+ ::-webkit-scrollbar-thumb:hover {
323
+ background: var(--text-sub);
324
+ }
325
+
326
+ #results-text {
327
+ width: calc(100% - 18px);
328
+ margin-top: 10px;
329
+ font-family: inherit;
330
+ padding: 10px;
331
+ border-radius: 8px;
332
+ border: 1px solid #ccc;
333
+ background: rgba(255, 255, 255, 0.05);
334
+ color: inherit;
335
+ }
336
+
337
+ .hidden {
338
+ display: none;
339
+ }
demo/assets/tf-backend-webgpu.js ADDED
The diff for this file is too large to render. See raw diff
 
demo/assets/tf-backend-webgpu.js.map ADDED
The diff for this file is too large to render. See raw diff
 
demo/assets/tf.min.js ADDED
The diff for this file is too large to render. See raw diff