privateuserh commited on
Commit
1ea9ada
·
verified ·
1 Parent(s): b550558

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +1029 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Privfin Vbeta1 03
3
- emoji: 🏃
4
- colorFrom: green
5
- colorTo: blue
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: privfin-vbeta1-03
3
+ emoji: 🐳
4
+ colorFrom: blue
5
+ colorTo: purple
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,1029 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Global Trade Fin. Calculator</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ .floating-btn {
11
+ position: fixed;
12
+ bottom: 30px;
13
+ right: 30px;
14
+ width: 60px;
15
+ height: 60px;
16
+ border-radius: 50%;
17
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
18
+ transition: all 0.3s ease;
19
+ z-index: 1000;
20
+ }
21
+ .floating-btn:hover {
22
+ transform: translateY(-5px) scale(1.05);
23
+ box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
24
+ }
25
+ .floating-btn-secondary {
26
+ position: fixed;
27
+ bottom: 100px;
28
+ right: 30px;
29
+ width: 60px;
30
+ height: 60px;
31
+ border-radius: 50%;
32
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
33
+ transition: all 0.3s ease;
34
+ z-index: 1000;
35
+ }
36
+ .floating-btn-secondary:hover {
37
+ transform: translateY(-5px) scale(1.05);
38
+ box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
39
+ }
40
+ .floating-btn-tertiary {
41
+ position: fixed;
42
+ bottom: 170px;
43
+ right: 30px;
44
+ width: 60px;
45
+ height: 60px;
46
+ border-radius: 50%;
47
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
48
+ transition: all 0.3s ease;
49
+ z-index: 1000;
50
+ }
51
+ .floating-btn-tertiary:hover {
52
+ transform: translateY(-5px) scale(1.05);
53
+ box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
54
+ }
55
+ .modal {
56
+ transition: all 0.3s ease;
57
+ opacity: 0;
58
+ visibility: hidden;
59
+ }
60
+ .modal.active {
61
+ opacity: 1;
62
+ visibility: visible;
63
+ }
64
+ .tariff-slider::-webkit-slider-thumb {
65
+ -webkit-appearance: none;
66
+ width: 20px;
67
+ height: 20px;
68
+ border-radius: 50%;
69
+ background: #3B82F6;
70
+ cursor: pointer;
71
+ }
72
+ .animate-pulse {
73
+ animation: pulse 2s infinite;
74
+ }
75
+ @keyframes pulse {
76
+ 0% { transform: scale(1); }
77
+ 50% { transform: scale(1.05); }
78
+ 100% { transform: scale(1); }
79
+ }
80
+ .market-share-gauge {
81
+ width: 100%;
82
+ height: 20px;
83
+ background: linear-gradient(90deg, #ef4444 0%, #f59e0b 50%, #10b981 100%);
84
+ border-radius: 10px;
85
+ margin-top: 10px;
86
+ position: relative;
87
+ }
88
+ .gauge-pointer {
89
+ position: absolute;
90
+ top: -5px;
91
+ width: 2px;
92
+ height: 30px;
93
+ background: black;
94
+ transform: translateX(-50%);
95
+ }
96
+ .tariff-badge {
97
+ display: inline-block;
98
+ padding: 0.25rem 0.5rem;
99
+ border-radius: 9999px;
100
+ font-size: 0.75rem;
101
+ font-weight: 600;
102
+ }
103
+ .token-progress {
104
+ height: 10px;
105
+ border-radius: 5px;
106
+ background-color: #e5e7eb;
107
+ overflow: hidden;
108
+ }
109
+ .token-progress-bar {
110
+ height: 100%;
111
+ background: linear-gradient(90deg, #8b5cf6, #6366f1);
112
+ transition: width 0.3s ease;
113
+ }
114
+ .yield-farming-card {
115
+ background: linear-gradient(135deg, #f5f7fa 0%, #e4e7eb 100%);
116
+ border-radius: 12px;
117
+ padding: 1.5rem;
118
+ position: relative;
119
+ overflow: hidden;
120
+ }
121
+ .yield-farming-card::before {
122
+ content: "";
123
+ position: absolute;
124
+ top: -50%;
125
+ left: -50%;
126
+ width: 200%;
127
+ height: 200%;
128
+ background: linear-gradient(45deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
129
+ transform: rotate(45deg);
130
+ animation: shine 3s infinite;
131
+ }
132
+ @keyframes shine {
133
+ 0% { transform: translateX(-100%) rotate(45deg); }
134
+ 100% { transform: translateX(100%) rotate(45deg); }
135
+ }
136
+ .bitcoin-address {
137
+ font-family: monospace;
138
+ letter-spacing: 1px;
139
+ }
140
+ .mining-estimate {
141
+ background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
142
+ border-left: 4px solid #f59e0b;
143
+ }
144
+ .country-flag {
145
+ width: 24px;
146
+ height: 16px;
147
+ display: inline-block;
148
+ margin-right: 8px;
149
+ border: 1px solid #e5e7eb;
150
+ vertical-align: middle;
151
+ }
152
+ .tariff-impact-meter {
153
+ height: 8px;
154
+ border-radius: 4px;
155
+ background-color: #e5e7eb;
156
+ margin-top: 8px;
157
+ overflow: hidden;
158
+ }
159
+ .tariff-impact-bar {
160
+ height: 100%;
161
+ background: linear-gradient(90deg, #10b981, #3B82F6);
162
+ }
163
+ .countdown-timer {
164
+ font-family: monospace;
165
+ font-size: 1.2rem;
166
+ color: #ef4444;
167
+ font-weight: bold;
168
+ }
169
+ .market-share-loss-meter {
170
+ height: 12px;
171
+ border-radius: 6px;
172
+ background-color: #f3f4f6;
173
+ margin-top: 8px;
174
+ overflow: hidden;
175
+ position: relative;
176
+ }
177
+ .market-share-loss-bar {
178
+ height: 100%;
179
+ background: linear-gradient(90deg, #10b981, #3B82F6);
180
+ transition: width 0.5s ease;
181
+ }
182
+ .market-share-regain-bar {
183
+ height: 100%;
184
+ background: linear-gradient(90deg, #3B82F6, #8b5cf6);
185
+ transition: width 0.5s ease;
186
+ }
187
+ .market-share-total-loss {
188
+ font-size: 1.5rem;
189
+ font-weight: bold;
190
+ color: #ef4444;
191
+ }
192
+ </style>
193
+ </head>
194
+ <body class="bg-gray-50 min-h-screen">
195
+ <!-- Main Calculator -->
196
+ <div class="container mx-auto px-4 py-8 max-w-4xl">
197
+ <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
198
+ <div class="p-6 bg-gradient-to-r from-blue-600 to-indigo-700 text-white">
199
+ <h1 class="text-2xl font-bold">Global Trade Finance Calculator</h1>
200
+ <p class="opacity-90">Calculate your tariff financing options and market share impact</p>
201
+ </div>
202
+
203
+ <div class="p-6">
204
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
205
+ <div>
206
+ <label class="block text-sm font-medium text-gray-700 mb-1">Import Value (USD)</label>
207
+ <input type="number" id="importValue" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="100,000" value="100000">
208
+ </div>
209
+ <div>
210
+ <label class="block text-sm font-medium text-gray-700 mb-1">Tariff Rate (%)</label>
211
+ <div class="flex items-center">
212
+ <input type="range" id="tariffSlider" min="0" max="30" step="0.5" value="10" class="w-full tariff-slider">
213
+ <span id="tariffValue" class="ml-3 font-medium">10%</span>
214
+ </div>
215
+ </div>
216
+ </div>
217
+
218
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
219
+ <div>
220
+ <label class="block text-sm font-medium text-gray-700 mb-1">Product Category</label>
221
+ <select id="productCategory" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
222
+ <option value="">Select category</option>
223
+ <option value="electronics">Electronics</option>
224
+ <option value="textiles">Textiles</option>
225
+ <option value="automotive">Automotive</option>
226
+ <option value="agriculture">Agriculture</option>
227
+ <option value="chemicals">Chemicals</option>
228
+ </select>
229
+ </div>
230
+ <div>
231
+ <label class="block text-sm font-medium text-gray-700 mb-1">Import Country</label>
232
+ <select id="importCountry" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
233
+ <option value="us">United States</option>
234
+ <option value="eu">European Union</option>
235
+ <option value="china">China</option>
236
+ <option value="japan">Japan</option>
237
+ <option value="canada">Canada</option>
238
+ </select>
239
+ </div>
240
+ <div>
241
+ <label class="block text-sm font-medium text-gray-700 mb-1">Export Country</label>
242
+ <select id="exportCountry" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
243
+ <option value="china">China</option>
244
+ <option value="vietnam">Vietnam</option>
245
+ <option value="india">India</option>
246
+ <option value="mexico">Mexico</option>
247
+ <option value="germany">Germany</option>
248
+ </select>
249
+ </div>
250
+ </div>
251
+
252
+ <div class="flex justify-center">
253
+ <button id="calculateBtn" class="bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-8 rounded-lg transition duration-300 flex items-center">
254
+ <i class="fas fa-calculator mr-2"></i> Calculate Financing
255
+ </button>
256
+ </div>
257
+ </div>
258
+ </div>
259
+
260
+ <!-- Results Section (Initially Hidden) -->
261
+ <div id="resultsSection" class="bg-white rounded-xl shadow-md overflow-hidden mb-8 hidden">
262
+ <div class="p-6 bg-gradient-to-r from-green-600 to-emerald-700 text-white">
263
+ <h2 class="text-xl font-bold">Financing Results</h2>
264
+ <p>Your optimized trade finance solution</p>
265
+ </div>
266
+
267
+ <div class="p-6">
268
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6">
269
+ <div class="border border-gray-200 rounded-lg p-4">
270
+ <div class="text-sm text-gray-500 mb-1">Tariff Amount</div>
271
+ <div class="text-2xl font-bold" id="tariffAmount">$10,000</div>
272
+ </div>
273
+ <div class="border border-gray-200 rounded-lg p-4">
274
+ <div class="text-sm text-gray-500 mb-1">Financing Cost</div>
275
+ <div class="text-2xl font-bold" id="financingCost">$8,500</div>
276
+ </div>
277
+ <div class="border border-gray-200 rounded-lg p-4 bg-blue-50">
278
+ <div class="text-sm text-blue-600 mb-1">Total Savings</div>
279
+ <div class="text-2xl font-bold text-blue-700" id="totalSavings">$1,500</div>
280
+ </div>
281
+ </div>
282
+
283
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
284
+ <div class="border border-gray-200 rounded-lg p-4">
285
+ <div class="flex justify-between items-center mb-2">
286
+ <h3 class="font-medium">Tokenized Financing</h3>
287
+ <span class="text-xs bg-purple-100 text-purple-800 px-2 py-1 rounded">Recommended</span>
288
+ </div>
289
+ <p class="text-sm text-gray-600 mb-3">Mint FFFUND tokens to finance your tariffs with crypto liquidity</p>
290
+ <div class="flex justify-between text-sm mb-2">
291
+ <span>Token Amount:</span>
292
+ <span class="font-medium" id="tokenAmount">850 FFFUND</span>
293
+ </div>
294
+ <div class="flex justify-between text-sm mb-2">
295
+ <span>APY:</span>
296
+ <span class="font-medium">12.5%</span>
297
+ </div>
298
+ <button id="tokenizeBtn" class="w-full mt-3 bg-purple-600 hover:bg-purple-700 text-white font-medium py-2 px-4 rounded-lg transition duration-300">
299
+ Tokenize Now
300
+ </button>
301
+ </div>
302
+
303
+ <div class="border border-gray-200 rounded-lg p-4">
304
+ <h3 class="font-medium mb-2">Traditional Financing</h3>
305
+ <p class="text-sm text-gray-600 mb-3">Standard bank financing options for comparison</p>
306
+ <div class="flex justify-between text-sm mb-2">
307
+ <span>Interest Rate:</span>
308
+ <span class="font-medium">8.75%</span>
309
+ </div>
310
+ <div class="flex justify-between text-sm mb-2">
311
+ <span>Processing Fee:</span>
312
+ <span class="font-medium">1.5%</span>
313
+ </div>
314
+ <button id="traditionalBtn" class="w-full mt-3 bg-gray-600 hover:bg-gray-700 text-white font-medium py-2 px-4 rounded-lg transition duration-300">
315
+ View Details
316
+ </button>
317
+ </div>
318
+ </div>
319
+
320
+ <div class="mt-6">
321
+ <button id="marketShareBtn" class="w-full bg-indigo-600 hover:bg-indigo-700 text-white font-bold py-3 px-4 rounded-lg transition duration-300 flex items-center justify-center">
322
+ <i class="fas fa-chart-line mr-2"></i> Analyze Market Share Impact
323
+ </button>
324
+ </div>
325
+ </div>
326
+ </div>
327
+ </div>
328
+
329
+ <!-- Floating Action Buttons -->
330
+ <button id="tokenMintBtn" class="floating-btn bg-purple-600 text-white flex items-center justify-center">
331
+ <i class="fas fa-coins text-xl"></i>
332
+ </button>
333
+
334
+ <button id="walletBtn" class="floating-btn-secondary bg-blue-600 text-white flex items-center justify-center">
335
+ <i class="fas fa-wallet text-xl"></i>
336
+ </button>
337
+
338
+ <button id="helpBtn" class="floating-btn-tertiary bg-gray-600 text-white flex items-center justify-center">
339
+ <i class="fas fa-question text-xl"></i>
340
+ </button>
341
+
342
+ <!-- Token Mint Modal -->
343
+ <div id="tokenMintModal" class="modal fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4">
344
+ <div class="bg-white rounded-xl shadow-xl p-6 max-w-md w-full">
345
+ <div class="flex justify-between items-center mb-4">
346
+ <h3 class="text-xl font-bold text-gray-800">Mint FFFUND Tokens</h3>
347
+ <button id="closeTokenMintModal" class="text-gray-500 hover:text-gray-700">
348
+ <i class="fas fa-times"></i>
349
+ </button>
350
+ </div>
351
+
352
+ <div class="mb-4">
353
+ <label class="block text-sm font-medium text-gray-700 mb-1">Amount to Mint</label>
354
+ <div class="relative">
355
+ <input type="number" id="mintAmount" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500" placeholder="1000">
356
+ <div class="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none">
357
+ <span class="text-gray-500">FFFUND</span>
358
+ </div>
359
+ </div>
360
+ </div>
361
+
362
+ <div class="mb-4">
363
+ <label class="block text-sm font-medium text-gray-700 mb-1">Equivalent USD</label>
364
+ <div class="relative">
365
+ <input type="number" id="mintUsdValue" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500" placeholder="1000" readonly>
366
+ <div class="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none">
367
+ <span class="text-gray-500">USD</span>
368
+ </div>
369
+ </div>
370
+ </div>
371
+
372
+ <div class="mb-4">
373
+ <div class="flex justify-between text-sm mb-1">
374
+ <span class="text-gray-600">Exchange Rate</span>
375
+ <span class="font-medium">1 FFFUND = $1.00</span>
376
+ </div>
377
+ <div class="flex justify-between text-sm mb-1">
378
+ <span class="text-gray-600">Minting Fee</span>
379
+ <span class="font-medium">0.5%</span>
380
+ </div>
381
+ <div class="flex justify-between text-sm">
382
+ <span class="text-gray-600">APY</span>
383
+ <span class="font-medium text-green-600">12.5%</span>
384
+ </div>
385
+ </div>
386
+
387
+ <div class="bg-blue-50 p-3 rounded-lg mb-4">
388
+ <div class="flex items-center">
389
+ <div class="flex-shrink-0">
390
+ <i class="fas fa-info-circle text-blue-500"></i>
391
+ </div>
392
+ <div class="ml-3">
393
+ <p class="text-sm text-blue-700">
394
+ Minting tokens now will lock in your financing rate and protect against future tariff increases.
395
+ </p>
396
+ </div>
397
+ </div>
398
+ </div>
399
+
400
+ <button id="confirmMintBtn" class="w-full bg-purple-600 hover:bg-purple-700 text-white font-bold py-3 px-4 rounded-lg transition duration-300">
401
+ Confirm Mint
402
+ </button>
403
+ </div>
404
+ </div>
405
+
406
+ <!-- Wallet Modal -->
407
+ <div id="walletModal" class="modal fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4">
408
+ <div class="bg-white rounded-xl shadow-xl p-6 max-w-md w-full">
409
+ <div class="flex justify-between items-center mb-4">
410
+ <h3 class="text-xl font-bold text-gray-800">Your Digital Wallet</h3>
411
+ <button id="closeWalletModal" class="text-gray-500 hover:text-gray-700">
412
+ <i class="fas fa-times"></i>
413
+ </button>
414
+ </div>
415
+
416
+ <div class="border border-gray-200 rounded-lg p-4 mb-4">
417
+ <div class="flex justify-between items-center mb-2">
418
+ <span class="text-sm font-medium text-gray-600">FFFUND Balance</span>
419
+ <span class="text-xs bg-purple-100 text-purple-800 px-2 py-1 rounded">ERC-20</span>
420
+ </div>
421
+ <div class="flex justify-between items-baseline">
422
+ <span class="text-2xl font-bold" id="walletBalance">0</span>
423
+ <span class="text-gray-500">FFFUND</span>
424
+ </div>
425
+ <div class="text-sm text-gray-500 mt-1" id="walletUsdValue">≈ $0.00</span>
426
+ </div>
427
+
428
+ <div class="grid grid-cols-2 gap-3 mb-4">
429
+ <button id="receiveBtn" class="bg-blue-50 hover:bg-blue-100 text-blue-700 font-medium py-2 px-4 rounded-lg transition duration-300 flex items-center justify-center">
430
+ <i class="fas fa-qrcode mr-2"></i> Receive
431
+ </button>
432
+ <button id="sendBtn" class="bg-blue-50 hover:bg-blue-100 text-blue-700 font-medium py-2 px-4 rounded-lg transition duration-300 flex items-center justify-center">
433
+ <i class="fas fa-paper-plane mr-2"></i> Send
434
+ </button>
435
+ </div>
436
+
437
+ <div class="border-t border-gray-200 pt-4">
438
+ <h4 class="font-medium text-gray-700 mb-2">Transaction History</h4>
439
+ <div class="space-y-3">
440
+ <div class="flex items-center justify-between p-2 bg-gray-50 rounded-lg">
441
+ <div class="flex items-center">
442
+ <div class="p-2 rounded-full bg-purple-100 text-purple-600 mr-3">
443
+ <i class="fas fa-coins"></i>
444
+ </div>
445
+ <div>
446
+ <p class="text-sm font-medium">Token Mint</p>
447
+ <p class="text-xs text-gray-500">2 days ago</p>
448
+ </div>
449
+ </div>
450
+ <div class="text-right">
451
+ <p class="text-sm font-medium text-green-600">+1,000 FFFUND</p>
452
+ <p class="text-xs text-gray-500">$1,000.00</p>
453
+ </div>
454
+ </div>
455
+ </div>
456
+ </div>
457
+ </div>
458
+ </div>
459
+
460
+ <!-- Help Modal -->
461
+ <div id="helpModal" class="modal fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4">
462
+ <div class="bg-white rounded-xl shadow-xl p-6 max-w-md w-full">
463
+ <div class="flex justify-between items-center mb-4">
464
+ <h3 class="text-xl font-bold text-gray-800">Help Center</h3>
465
+ <button id="closeHelpModal" class="text-gray-500 hover:text-gray-700">
466
+ <i class="fas fa-times"></i>
467
+ </button>
468
+ </div>
469
+
470
+ <div class="mb-4">
471
+ <h4 class="font-medium text-gray-700 mb-2">How it works</h4>
472
+ <p class="text-sm text-gray-600 mb-3">
473
+ This calculator helps you determine the optimal way to finance import tariffs by comparing traditional financing with tokenized options.
474
+ </p>
475
+
476
+ <div class="space-y-3">
477
+ <div class="flex items-start">
478
+ <div class="flex-shrink-0 mt-1">
479
+ <div class="w-6 h-6 rounded-full bg-blue-100 text-blue-600 flex items-center justify-center">
480
+ <span class="text-xs font-bold">1</span>
481
+ </div>
482
+ </div>
483
+ <div class="ml-3">
484
+ <p class="text-sm font-medium text-gray-700">Enter your import details</p>
485
+ <p class="text-sm text-gray-500">Value, tariff rate, product category, and countries</p>
486
+ </div>
487
+ </div>
488
+
489
+ <div class="flex items-start">
490
+ <div class="flex-shrink-0 mt-1">
491
+ <div class="w-6 h-6 rounded-full bg-blue-100 text-blue-600 flex items-center justify-center">
492
+ <span class="text-xs font-bold">2</span>
493
+ </div>
494
+ </div>
495
+ <div class="ml-3">
496
+ <p class="text-sm font-medium text-gray-700">Calculate financing options</p>
497
+ <p class="text-sm text-gray-500">Compare costs between traditional and tokenized financing</p>
498
+ </div>
499
+ </div>
500
+
501
+ <div class="flex items-start">
502
+ <div class="flex-shrink-0 mt-1">
503
+ <div class="w-6 h-6 rounded-full bg-blue-100 text-blue-600 flex items-center justify-center">
504
+ <span class="text-xs font-bold">3</span>
505
+ </div>
506
+ </div>
507
+ <div class="ml-3">
508
+ <p class="text-sm font-medium text-gray-700">Analyze market impact</p>
509
+ <p class="text-sm text-gray-500">See how tariffs affect your market share over time</p>
510
+ </div>
511
+ </div>
512
+
513
+ <div class="flex items-start">
514
+ <div class="flex-shrink-0 mt-1">
515
+ <div class="w-6 h-6 rounded-full bg-blue-100 text-blue-600 flex items-center justify-center">
516
+ <span class="text-xs font-bold">4</span>
517
+ </div>
518
+ </div>
519
+ <div class="ml-3">
520
+ <p class="text-sm font-medium text-gray-700">Mint tokens to finance</p>
521
+ <p class="text-sm text-gray-500">Lock in rates and potentially recover lost market share</p>
522
+ </div>
523
+ </div>
524
+ </div>
525
+ </div>
526
+
527
+ <div class="border-t border-gray-200 pt-4">
528
+ <h4 class="font-medium text-gray-700 mb-2">Need more help?</h4>
529
+ <button class="w-full bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-lg transition duration-300">
530
+ Contact Support
531
+ </button>
532
+ </div>
533
+ </div>
534
+ </div>
535
+
536
+ <!-- Market Share Modal -->
537
+ <div id="marketShareModal" class="modal fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4">
538
+ <div class="bg-white rounded-xl shadow-xl p-6 max-w-md w-full">
539
+ <div class="flex justify-between items-center mb-4">
540
+ <h3 class="text-xl font-bold text-gray-800">Market Share Impact</h3>
541
+ <button id="closeMarketShareModal" class="text-gray-500 hover:text-gray-700">
542
+ <i class="fas fa-times"></i>
543
+ </button>
544
+ </div>
545
+
546
+ <div class="mb-4">
547
+ <div class="flex justify-between items-center mb-2">
548
+ <span class="font-medium">Live Market Share Loss</span>
549
+ <span class="countdown-timer" id="marketShareTimer">00:00:00</span>
550
+ </div>
551
+ <div class="market-share-loss-meter">
552
+ <div id="marketShareLossBar" class="market-share-loss-bar" style="width: 0%"></div>
553
+ <div id="marketShareRegainBar" class="market-share-regain-bar" style="width: 0%"></div>
554
+ </div>
555
+ <div class="flex justify-between mt-1 text-xs">
556
+ <span>0%</span>
557
+ <span id="currentLossDisplay">0% lost</span>
558
+ <span id="currentRegainDisplay">0% regained</span>
559
+ <span>100%</span>
560
+ </div>
561
+ </div>
562
+
563
+ <div class="grid grid-cols-2 gap-4 mb-4">
564
+ <div class="bg-red-50 p-3 rounded-lg">
565
+ <div class="text-sm text-red-600 font-medium mb-1">5-Year Projection</div>
566
+ <div class="market-share-total-loss" id="fiveYearLoss">0%</div>
567
+ <div class="text-xs text-red-500">Total market share lost</div>
568
+ </div>
569
+ <div class="bg-green-50 p-3 rounded-lg">
570
+ <div class="text-sm text-green-600 font-medium mb-1">Minting Impact</div>
571
+ <div class="text-xl font-bold text-green-800" id="mintingImpact">0%</div>
572
+ <div class="text-xs text-green-600">Market share regained</div>
573
+ </div>
574
+ </div>
575
+
576
+ <div class="mb-4">
577
+ <div class="flex justify-between mb-2">
578
+ <span class="font-medium text-red-600">Market Share Loss Rate</span>
579
+ <span id="marketShareLossRate" class="font-bold">0.5%/month</span>
580
+ </div>
581
+ <div class="flex justify-between mb-4">
582
+ <span class="font-medium text-green-600">Minting Recovery Rate</span>
583
+ <span id="mintingRecoveryRate" class="font-bold">0.25%/month</span>
584
+ </div>
585
+
586
+ <div class="market-share-gauge">
587
+ <div id="gaugePointer" class="gauge-pointer" style="left: 25%;"></div>
588
+ </div>
589
+ <div class="flex justify-between mt-2 text-xs">
590
+ <span>High Loss</span>
591
+ <span>Balanced</span>
592
+ <span>High Savings</span>
593
+ </div>
594
+ </div>
595
+
596
+ <div class="bg-gray-50 p-4 rounded-lg mb-4">
597
+ <p class="text-sm text-gray-700">
598
+ <span class="font-medium">Analysis:</span>
599
+ <span id="marketShareAnalysis">Using tariff financing results in moderate market share impact but significant cost savings.</span>
600
+ </p>
601
+ <p class="text-xs text-gray-500 mt-2" id="marketShareCountdownNote">Market share is being lost at a rate of <span class="font-medium">0.5% per month</span>. Minting FFFUND tokens can help recover lost market share.</p>
602
+ </div>
603
+
604
+ <div class="flex space-x-2">
605
+ <button id="closeMarketShareBtn" class="flex-1 bg-green-600 hover:bg-green-700 text-white font-bold py-3 px-4 rounded-lg transition duration-300">
606
+ Close
607
+ </button>
608
+ <button id="mintFromMarketBtn" class="flex-1 bg-purple-600 hover:bg-purple-700 text-white font-bold py-3 px-4 rounded-lg transition duration-300 flex items-center justify-center">
609
+ <i class="fas fa-coins mr-2"></i> Mint Now
610
+ </button>
611
+ </div>
612
+ </div>
613
+ </div>
614
+
615
+ <!-- Success Toast -->
616
+ <div id="successToast" class="fixed bottom-4 left-4 bg-green-500 text-white px-4 py-2 rounded-lg shadow-lg transform translate-y-16 transition-transform duration-300 z-50 hidden">
617
+ <div class="flex items-center">
618
+ <i class="fas fa-check-circle mr-2"></i>
619
+ <span id="successMessage">Operation completed successfully!</span>
620
+ </div>
621
+ </div>
622
+
623
+ <script>
624
+ // DOM Elements
625
+ const importValueInput = document.getElementById('importValue');
626
+ const tariffSlider = document.getElementById('tariffSlider');
627
+ const tariffValueDisplay = document.getElementById('tariffValue');
628
+ const productCategorySelect = document.getElementById('productCategory');
629
+ const importCountrySelect = document.getElementById('importCountry');
630
+ const exportCountrySelect = document.getElementById('exportCountry');
631
+ const calculateBtn = document.getElementById('calculateBtn');
632
+ const resultsSection = document.getElementById('resultsSection');
633
+ const tariffAmountDisplay = document.getElementById('tariffAmount');
634
+ const financingCostDisplay = document.getElementById('financingCost');
635
+ const totalSavingsDisplay = document.getElementById('totalSavings');
636
+ const tokenAmountDisplay = document.getElementById('tokenAmount');
637
+ const tokenizeBtn = document.getElementById('tokenizeBtn');
638
+ const traditionalBtn = document.getElementById('traditionalBtn');
639
+ const marketShareBtn = document.getElementById('marketShareBtn');
640
+
641
+ // Modal Elements
642
+ const tokenMintModal = document.getElementById('tokenMintModal');
643
+ const closeTokenMintModal = document.getElementById('closeTokenMintModal');
644
+ const tokenMintBtn = document.getElementById('tokenMintBtn');
645
+ const mintAmountInput = document.getElementById('mintAmount');
646
+ const mintUsdValueInput = document.getElementById('mintUsdValue');
647
+ const confirmMintBtn = document.getElementById('confirmMintBtn');
648
+
649
+ const walletModal = document.getElementById('walletModal');
650
+ const closeWalletModal = document.getElementById('closeWalletModal');
651
+ const walletBtn = document.getElementById('walletBtn');
652
+ const walletBalanceDisplay = document.getElementById('walletBalance');
653
+ const walletUsdValueDisplay = document.getElementById('walletUsdValue');
654
+ const receiveBtn = document.getElementById('receiveBtn');
655
+ const sendBtn = document.getElementById('sendBtn');
656
+
657
+ const helpModal = document.getElementById('helpModal');
658
+ const closeHelpModal = document.getElementById('closeHelpModal');
659
+ const helpBtn = document.getElementById('helpBtn');
660
+
661
+ const marketShareModal = document.getElementById('marketShareModal');
662
+ const closeMarketShareModal = document.getElementById('closeMarketShareModal');
663
+ const closeMarketShareBtn = document.getElementById('closeMarketShareBtn');
664
+ const mintFromMarketBtn = document.getElementById('mintFromMarketBtn');
665
+
666
+ const successToast = document.getElementById('successToast');
667
+ const successMessage = document.getElementById('successMessage');
668
+
669
+ // Data
670
+ let currentLoanData = null;
671
+ let tokenData = {
672
+ userBalance: 0,
673
+ exchangeRate: 1.0
674
+ };
675
+ let currentIndustry = null;
676
+
677
+ // Industries data
678
+ const industries = {
679
+ electronics: { name: "Electronics", tariffMultiplier: 1.2 },
680
+ textiles: { name: "Textiles", tariffMultiplier: 1.5 },
681
+ automotive: { name: "Automotive", tariffMultiplier: 1.8 },
682
+ agriculture: { name: "Agriculture", tariffMultiplier: 1.1 },
683
+ chemicals: { name: "Chemicals", tariffMultiplier: 1.3 }
684
+ };
685
+
686
+ // Initialize event listeners
687
+ function initEventListeners() {
688
+ // Input changes
689
+ tariffSlider.addEventListener('input', updateTariffValue);
690
+ importValueInput.addEventListener('input', formatCurrencyInput);
691
+ mintAmountInput.addEventListener('input', updateMintUsdValue);
692
+
693
+ // Button clicks
694
+ calculateBtn.addEventListener('click', calculateFinancing);
695
+ tokenizeBtn.addEventListener('click', openTokenMintModal);
696
+ traditionalBtn.addEventListener('click', showTraditionalDetails);
697
+ marketShareBtn.addEventListener('click', openMarketShareModal);
698
+
699
+ // Modal controls
700
+ tokenMintBtn.addEventListener('click', openTokenMintModal);
701
+ closeTokenMintModal.addEventListener('click', closeTokenMintModalFunc);
702
+ confirmMintBtn.addEventListener('click', confirmMint);
703
+
704
+ walletBtn.addEventListener('click', openWalletModal);
705
+ closeWalletModal.addEventListener('click', closeWalletModalFunc);
706
+ receiveBtn.addEventListener('click', showReceiveAddress);
707
+ sendBtn.addEventListener('click', showSendForm);
708
+
709
+ helpBtn.addEventListener('click', openHelpModal);
710
+ closeHelpModal.addEventListener('click', closeHelpModalFunc);
711
+
712
+ closeMarketShareModal.addEventListener('click', closeMarketShareModalFunc);
713
+ closeMarketShareBtn.addEventListener('click', closeMarketShareModalFunc);
714
+ mintFromMarketBtn.addEventListener('click', openTokenMintModal);
715
+ }
716
+
717
+ // Format currency input
718
+ function formatCurrencyInput(e) {
719
+ let value = e.target.value.replace(/\D/g, '');
720
+ e.target.value = Number(value).toLocaleString();
721
+ }
722
+
723
+ // Update tariff value display
724
+ function updateTariffValue() {
725
+ const value = tariffSlider.value;
726
+ tariffValueDisplay.textContent = `${value}%`;
727
+ }
728
+
729
+ // Calculate financing options
730
+ function calculateFinancing() {
731
+ const importValue = Number(importValueInput.value.replace(/\D/g, ''));
732
+ const tariffRate = Number(tariffSlider.value) / 100;
733
+
734
+ if (!importValue || isNaN(importValue)) {
735
+ showToast("Please enter a valid import value");
736
+ return;
737
+ }
738
+
739
+ // Get product category
740
+ const productCategory = productCategorySelect.value;
741
+ currentIndustry = productCategory ? industries[productCategory] : null;
742
+
743
+ // Calculate tariff amount (with industry multiplier if selected)
744
+ let tariffMultiplier = 1.0;
745
+ if (currentIndustry) {
746
+ tariffMultiplier = currentIndustry.tariffMultiplier;
747
+ }
748
+
749
+ const tariffAmount = importValue * tariffRate * tariffMultiplier;
750
+
751
+ // Calculate financing costs
752
+ const traditionalCost = tariffAmount * 0.85; // 15% savings
753
+ const tokenizedCost = tariffAmount * 0.80; // 20% savings
754
+
755
+ // Calculate savings
756
+ const savings = tariffAmount - tokenizedCost;
757
+
758
+ // Update UI
759
+ tariffAmountDisplay.textContent = `$${tariffAmount.toLocaleString(undefined, {maximumFractionDigits: 2})}`;
760
+ financingCostDisplay.textContent = `$${tokenizedCost.toLocaleString(undefined, {maximumFractionDigits: 2})}`;
761
+ totalSavingsDisplay.textContent = `$${savings.toLocaleString(undefined, {maximumFractionDigits: 2})}`;
762
+ tokenAmountDisplay.textContent = `${Math.round(tokenizedCost)}`;
763
+
764
+ // Store current loan data
765
+ currentLoanData = {
766
+ importValue,
767
+ tariff: tariffRate * 100,
768
+ tariffAmount,
769
+ traditionalCost,
770
+ tokenizedCost,
771
+ savings
772
+ };
773
+
774
+ // Show results
775
+ resultsSection.classList.remove('hidden');
776
+
777
+ // Scroll to results
778
+ resultsSection.scrollIntoView({ behavior: 'smooth' });
779
+
780
+ showToast("Financing options calculated successfully");
781
+ }
782
+
783
+ // Show traditional financing details
784
+ function showTraditionalDetails() {
785
+ if (!currentLoanData) return;
786
+
787
+ // Update the displays to show traditional financing numbers
788
+ financingCostDisplay.textContent = `$${currentLoanData.traditionalCost.toLocaleString(undefined, {maximumFractionDigits: 2})}`;
789
+ totalSavingsDisplay.textContent = `$${(currentLoanData.tariffAmount - currentLoanData.traditionalCost).toLocaleString(undefined, {maximumFractionDigits: 2})}`;
790
+
791
+ showToast("Showing traditional financing details");
792
+ }
793
+
794
+ // Token Mint Modal Functions
795
+ function openTokenMintModal() {
796
+ if (!currentLoanData) {
797
+ showToast("Please calculate financing terms first");
798
+ return;
799
+ }
800
+
801
+ // Set default mint amount to the tokenized cost
802
+ mintAmountInput.value = Math.round(currentLoanData.tokenizedCost);
803
+ updateMintUsdValue();
804
+
805
+ tokenMintModal.classList.add('active');
806
+ }
807
+
808
+ function closeTokenMintModalFunc() {
809
+ tokenMintModal.classList.remove('active');
810
+ }
811
+
812
+ function updateMintUsdValue() {
813
+ const amount = Number(mintAmountInput.value) || 0;
814
+ mintUsdValueInput.value = (amount * tokenData.exchangeRate).toFixed(2);
815
+ }
816
+
817
+ function confirmMint() {
818
+ const amount = Number(mintAmountInput.value) || 0;
819
+
820
+ if (amount <= 0) {
821
+ showToast("Please enter a valid amount to mint");
822
+ return;
823
+ }
824
+
825
+ // Add to user balance
826
+ tokenData.userBalance += amount;
827
+
828
+ // Update wallet display
829
+ walletBalanceDisplay.textContent = tokenData.userBalance.toLocaleString();
830
+ walletUsdValueDisplay.textContent = `≈ $${(tokenData.userBalance * tokenData.exchangeRate).toLocaleString(undefined, {maximumFractionDigits: 2})}`;
831
+
832
+ // Close modal
833
+ closeTokenMintModalFunc();
834
+
835
+ showToast(`${amount.toLocaleString()} FFFUND tokens minted successfully!`);
836
+ }
837
+
838
+ // Wallet Modal Functions
839
+ function openWalletModal() {
840
+ // Update balance display
841
+ walletBalanceDisplay.textContent = tokenData.userBalance.toLocaleString();
842
+ walletUsdValueDisplay.textContent = `≈ $${(tokenData.userBalance * tokenData.exchangeRate).toLocaleString(undefined, {maximumFractionDigits: 2})}`;
843
+
844
+ walletModal.classList.add('active');
845
+ }
846
+
847
+ function closeWalletModalFunc() {
848
+ walletModal.classList.remove('active');
849
+ }
850
+
851
+ function showReceiveAddress() {
852
+ showToast("Receive address copied to clipboard");
853
+ // In a real app, this would show a QR code and address
854
+ }
855
+
856
+ function showSendForm() {
857
+ showToast("Send form would open here");
858
+ // In a real app, this would show a form to send tokens
859
+ }
860
+
861
+ // Help Modal Functions
862
+ function openHelpModal() {
863
+ helpModal.classList.add('active');
864
+ }
865
+
866
+ function closeHelpModalFunc() {
867
+ helpModal.classList.remove('active');
868
+ }
869
+
870
+ // Market Share Timer Variables
871
+ let marketShareTimer;
872
+ let marketShareLossInterval;
873
+ let totalSeconds = 0;
874
+ let currentLossPercentage = 0;
875
+ let currentRegainPercentage = 0;
876
+ let lossRate = 0.5; // % per month
877
+ let recoveryRate = 0.25; // % per month from minting
878
+ let isMarketShareModalOpen = false;
879
+
880
+ // Market Share Modal Functions
881
+ function openMarketShareModal() {
882
+ if (!currentLoanData) {
883
+ showToast("Please calculate financing terms first");
884
+ return;
885
+ }
886
+
887
+ marketShareModal.classList.add('active');
888
+ isMarketShareModalOpen = true;
889
+ updateMarketShareAnalysis();
890
+
891
+ // Start the timer if not already running
892
+ if (!marketShareTimer) {
893
+ startMarketShareTimer();
894
+ }
895
+ }
896
+
897
+ function closeMarketShareModalFunc() {
898
+ marketShareModal.classList.remove('active');
899
+ isMarketShareModalOpen = false;
900
+ }
901
+
902
+ function startMarketShareTimer() {
903
+ // Clear any existing interval
904
+ if (marketShareLossInterval) {
905
+ clearInterval(marketShareLossInterval);
906
+ }
907
+
908
+ // Calculate loss rate based on tariff percentage (higher tariff = faster loss)
909
+ lossRate = Math.min(2, Math.max(0.1, currentLoanData.tariff * 0.05));
910
+
911
+ // Calculate recovery rate based on minted tokens
912
+ recoveryRate = Math.min(1.5, tokenData.userBalance / 1000000 * 0.25);
913
+
914
+ // Update rates display
915
+ document.getElementById('marketShareLossRate').textContent = `${lossRate.toFixed(2)}%/month`;
916
+ document.getElementById('mintingRecoveryRate').textContent = `${recoveryRate.toFixed(2)}%/month`;
917
+
918
+ // Start counting
919
+ marketShareLossInterval = setInterval(updateMarketShareLoss, 1000);
920
+ }
921
+
922
+ function updateMarketShareLoss() {
923
+ // Increment timer
924
+ totalSeconds++;
925
+
926
+ // Update timer display
927
+ const hours = Math.floor(totalSeconds / 3600);
928
+ const minutes = Math.floor((totalSeconds % 3600) / 60);
929
+ const seconds = totalSeconds % 60;
930
+ document.getElementById('marketShareTimer').textContent =
931
+ `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
932
+
933
+ // Calculate loss (simulating real-time loss)
934
+ // Each second represents 1 day in our simulation (30 days = 1 month)
935
+ const daysPassed = totalSeconds / (24 * 60 * 60) * 30; // Convert seconds to simulated months
936
+ const newLoss = Math.min(100, daysPassed * lossRate);
937
+ const newRegain = Math.min(newLoss, daysPassed * recoveryRate);
938
+
939
+ currentLossPercentage = newLoss;
940
+ currentRegainPercentage = newRegain;
941
+
942
+ // Update displays
943
+ document.getElementById('marketShareLossBar').style.width = `${newLoss}%`;
944
+ document.getElementById('marketShareRegainBar').style.width = `${newRegain}%`;
945
+ document.getElementById('currentLossDisplay').textContent = `${newLoss.toFixed(2)}% lost`;
946
+ document.getElementById('currentRegainDisplay').textContent = `${newRegain.toFixed(2)}% regained`;
947
+
948
+ // Update 5-year projection (60 months)
949
+ const fiveYearLoss = Math.min(100, 60 * lossRate);
950
+ const fiveYearRegain = Math.min(fiveYearLoss, 60 * recoveryRate);
951
+ document.getElementById('fiveYearLoss').textContent = `${(fiveYearLoss - fiveYearRegain).toFixed(1)}%`;
952
+ document.getElementById('mintingImpact').textContent = `${fiveYearRegain.toFixed(1)}%`;
953
+
954
+ // Update analysis note
955
+ document.getElementById('marketShareCountdownNote').innerHTML =
956
+ `Market share is being lost at a rate of <span class="font-medium">${lossRate.toFixed(2)}% per month</span>.
957
+ Minting FFFUND tokens can help recover lost market share at <span class="font-medium">${recoveryRate.toFixed(2)}% per month</span>.`;
958
+
959
+ // Update gauge position
960
+ const gaugePosition = 100 - (newLoss / (newLoss + (100 - newLoss)) * 100);
961
+ document.getElementById('gaugePointer').style.left = `${gaugePosition}%`;
962
+ }
963
+
964
+ function updateMarketShareAnalysis() {
965
+ // Calculate market share impact based on tariff percentage
966
+ const tariff = currentLoanData.tariff;
967
+
968
+ // Market share loss increases with higher tariffs (0-20% range)
969
+ const shareLoss = Math.min(20, tariff * 0.4);
970
+
971
+ // Cost savings increase with higher tariffs (0-30% range)
972
+ const savings = Math.min(30, tariff * 0.6);
973
+
974
+ // Calculate position on gauge (0-100% where 0 is all loss, 100 is all savings)
975
+ const gaugePosition = 100 - (shareLoss / (shareLoss + savings) * 100);
976
+
977
+ document.getElementById('gaugePointer').style.left = `${gaugePosition}%`;
978
+
979
+ // Update analysis text with industry-specific context
980
+ let analysisText = "";
981
+ if (!currentIndustry) {
982
+ analysisText = "No product category selected for tariff analysis.";
983
+ } else if (tariff < 10) {
984
+ analysisText = `Low ${currentIndustry.name} tariff (${tariff}%) results in minimal market share impact but limited cost savings.`;
985
+ } else if (tariff < 20) {
986
+ analysisText = `Moderate ${currentIndustry.name} tariff (${tariff}%) provides good balance between market share impact and cost savings.`;
987
+ } else {
988
+ analysisText = `High ${currentIndustry.name} tariff (${tariff}%) provides significant cost savings but may substantially impact market share.`;
989
+ }
990
+
991
+ document.getElementById('marketShareAnalysis').textContent = analysisText;
992
+
993
+ // Update rates based on current tariff
994
+ lossRate = Math.min(2, Math.max(0.1, tariff * 0.05));
995
+ document.getElementById('marketShareLossRate').textContent = `${lossRate.toFixed(2)}%/month`;
996
+
997
+ // Update recovery rate based on minted tokens
998
+ recoveryRate = Math.min(1.5, tokenData.userBalance / 1000000 * 0.25);
999
+ document.getElementById('mintingRecoveryRate').textContent = `${recoveryRate.toFixed(2)}%/month`;
1000
+ document.getElementById('mintingImpact').textContent = `${(60 * recoveryRate).toFixed(1)}%`;
1001
+ }
1002
+
1003
+ // Show toast notification
1004
+ function showToast(message) {
1005
+ successMessage.textContent = message;
1006
+ successToast.classList.remove('hidden');
1007
+ successToast.classList.remove('translate-y-16');
1008
+ successToast.classList.add('translate-y-0');
1009
+
1010
+ setTimeout(() => {
1011
+ successToast.classList.remove('translate-y-0');
1012
+ successToast.classList.add('translate-y-16');
1013
+ setTimeout(() => {
1014
+ successToast.classList.add('hidden');
1015
+ }, 300);
1016
+ }, 3000);
1017
+ }
1018
+
1019
+ // Initialize the app
1020
+ function init() {
1021
+ initEventListeners();
1022
+ updateTariffValue();
1023
+ }
1024
+
1025
+ // Start the app when DOM is loaded
1026
+ document.addEventListener('DOMContentLoaded', init);
1027
+ </script>
1028
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=privateuserh/privfin-vbeta1-03" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
1029
+ </html>