From 930b3f9f2171ed34a35ff70a8707bf4042d42d32 Mon Sep 17 00:00:00 2001 From: iower Date: Mon, 14 Oct 2024 22:59:59 +0500 Subject: [PATCH] Updates --- assets/{index-b6e408f9.js => index-727e6083.js} | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename assets/{index-b6e408f9.js => index-727e6083.js} (99%) diff --git a/assets/index-b6e408f9.js b/assets/index-727e6083.js similarity index 99% rename from assets/index-b6e408f9.js rename to assets/index-727e6083.js index dc4d9a6..d03e513 100644 --- a/assets/index-b6e408f9.js +++ b/assets/index-727e6083.js @@ -79,7 +79,7 @@ You can still add expenses via the 'Add Expense' button in the app.`,slide1_titl Вы по-прежнему можете внести расходы через кнопку «Добавить трату» в приложении.`,slide1_title$1="Революционная запись трат",slide1_text$1="Просто добавь меня в ваш чат, чтобы начать пользоваться ботом. Траты можно записывать как текстом, так и голосовыми сообщениями! Я найду эти сообщения в чате и всё учту.",slide1_button$1="ТОП-3 проблемы группового расчёта",slide2_title$1="Надоело переводить друг другу деньги после каждой общей оплаты?",slide2_text$1="Достаточно, чтобы кто-то один написал о трате в чат – Билли это увидит и запишет в историю. В конце периода он просуммирует все траты и скажет, кто кому сколько должен.",slide2_button$1="Согласны?",slide3_title$1="Никто не хочет брать ответственность за оплату общих расходов?",slide3_text$1="Плати за друзей - получай кэшбэк в Билли реальными деньгами!",slide3_button$1="Узнали?",slide4_title$1="Не встанем из-за стола, пока не посчитаем, кто сколько съел?",slide4_text$1="Запиши трату сейчас, а друзья заполнят свои доли потом.",slide4_button$1="Это всё?",slide5_title$1="Самое удобное ведение группового бюджета!",slide5_subtitle1$1="Конвертация валют",slide5_text1$1="Упростит финальные расчёты, пересчитав все траты в выбранную валюту. Особенно актуально в путешествиях!",slide5_subtitle2$1="Бот чистит свои сообщения в чате",slide5_text2$1="Билли подчищает все служебные сообщения в чате, оставляя всю важную информацию в интерфейсе приложения",slide5_button$1="Узнать о Billy Pro",slide6_title$1="Преимущества с подпиской Billy Pro",slide6_subtitle1$1="Безлимитный ввод трат голосом или текстом",slide6_text1$1="В бесплатной версии доступно только 4 записи голосом или текстом в общих чатах. При этом вводить траты внутри бота ты всегда можешь без ограничений.",slide6_subtitle2$1="Категории",slide6_text2$1="Билли автоматически определит и проставит категорию для каждой траты, а в конце предоставит анализ самых больших из них.",slide6_subtitle3$1="Кешбэк",slide6_text3$1="Получай кешбэк, оплачивая общие траты.",slide6_button$1="Хочу Billy Pro",errorForbidden$1="Ой, а мне не разрешили показывать тебе эти циферки. Скорее всего, потому что тебя нет в чате.",errorOther$1="Что-то не сработало, но я уже исправляю. Попробуй обновить страницу.",translationRu={demoMode:demoMode$1,bot:bot$1,cancel:cancel$1,back:back$1,close:close$1,delete:"Удалить",addEveryone:addEveryone$1,apply:apply$2,save:save$1,buyProForSave:buyProForSave$1,reset:reset$1,ok:ok$1,addComment:addComment$1,yourComment:yourComment$1,message:message$1,category:category$1,paid:paid$1,owes:owes$1,select:select$1,author:author$1,added:added$1,addUser:addUser$1,pleaseMatchUsers:pleaseMatchUsers$1,pleaseAddUsers:pleaseAddUsers$1,selectWhoIs:selectWhoIs$1,selectUser:selectUser$1,notSelectedUsers:notSelectedUsers$1,selectedUsers:selectedUsers$1,recentCurrencies:recentCurrencies$1,allCurrencies:allCurrencies$1,checkout:checkout$1,selectCurrency:selectCurrency$1,whoPaid:whoPaid$1,forWhom:forWhom$1,add:add$1,selectAll:selectAll$1,unselectAll:unselectAll$1,splitEqually:splitEqually$1,nobodyHere:nobodyHere$1,checkAmounts:checkAmounts$1,cancelTransaction:cancelTransaction$1,sureToCancelTransaction:sureToCancelTransaction$1,selectCategory:selectCategory$1,noCategory:noCategory$1,balance:balance$1,totalTransactions:totalTransactions$1,settleUpBy:settleUpBy$1,balanceBy:balanceBy$1,settleUp:settleUp$1,settleUpSaved:settleUpSaved$1,allSettledUp:allSettledUp$1,showInCurrency:showInCurrency$1,featureSoon:featureSoon$1,okay:okay$1,unlockCategories:unlockCategories$1,analyzeCategories:analyzeCategories$1,unlock:unlock$1,total:total$1,myTotal:myTotal$1,subtitleAllTime:subtitleAllTime$1,filter:filter$2,spending:spending$1,allChat:allChat$1,onlyMine:onlyMine$1,period:period$1,allTime:allTime$1,month:month$1,week:week$1,custom:custom$1,transactions:transactions$1,myBalance:myBalance$1,statusUnconfirmed:statusUnconfirmed$1,statusCanceled:statusCanceled$1,statusEditedBy:statusEditedBy$1,statusCreatedBy:statusCreatedBy$1,detailedSummary:detailedSummary$1,addTransaction:addTransaction$1,chatType:chatType$1,chatTypeDescription:chatTypeDescription$1,personalExpenses:personalExpenses$1,splittingBills:splittingBills$1,currency:currency$1,language:language$1,cashback:cashback$1,setCashback:setCashback$1,monthlyLimit:monthlyLimit$1,setLimit:setLimit$1,setCashbackTitle:setCashbackTitle$1,setLimitTitle:setLimitTitle$1,soon:soon$1,chooseCurrency:chooseCurrency$1,chooseLanguage:chooseLanguage$1,leaveMessages:leaveMessages$1,forAdmin:forAdmin$1,manageExpensesWith:manageExpensesWith$1,featureExpenses:featureExpenses$1,featureCategories:featureCategories$1,featureCashback:featureCashback$1,days_:days_$1,days:days$1,month_:month_$1,months:months$1,forWeekend:forWeekend$1,profitable:profitable$1,buyFor:buyFor$1,stars:stars$1,discount:discount$1,voiceLimitTitle:voiceLimitTitle$1,voiceLimitMessage:voiceLimitMessage$1,slide1_title:slide1_title$1,slide1_text:slide1_text$1,slide1_button:slide1_button$1,slide2_title:slide2_title$1,slide2_text:slide2_text$1,slide2_button:slide2_button$1,slide3_title:slide3_title$1,slide3_text:slide3_text$1,slide3_button:slide3_button$1,slide4_title:slide4_title$1,slide4_text:slide4_text$1,slide4_button:slide4_button$1,slide5_title:slide5_title$1,slide5_subtitle1:slide5_subtitle1$1,slide5_text1:slide5_text1$1,slide5_subtitle2:slide5_subtitle2$1,slide5_text2:slide5_text2$1,slide5_button:slide5_button$1,slide6_title:slide6_title$1,slide6_subtitle1:slide6_subtitle1$1,slide6_text1:slide6_text1$1,slide6_subtitle2:slide6_subtitle2$1,slide6_text2:slide6_text2$1,slide6_subtitle3:slide6_subtitle3$1,slide6_text3:slide6_text3$1,slide6_button:slide6_button$1,errorForbidden:errorForbidden$1,errorOther:errorOther$1},demoMode="Демо-режим",bot="бот",cancel="Відміна",back="Назад",close="Закрити",addEveryone="Додати всіх",apply$1="Застосувати",save="Зберегти",buyProForSave="Купити Billy Pro для підтвердження",reset="Скинути",ok="OK",addComment="Додати коментар",yourComment="Ваш коментар...",message="Повідомлення",category="Категорія",paid="оплатив",owes="повинен",select="Оберіть…",author="автор",added="дод.",addUser="Додати людину",pleaseMatchUsers="Виберіть людей",pleaseAddUsers="Додати людей",selectWhoIs="Оберіть хто",selectUser="Оберіть",notSelectedUsers="Ще не вибрані",selectedUsers="Всі інші",recentCurrencies="Недавні",allCurrencies="Всі",checkout="Перевірити витрати",selectCurrency="Оберіть валюту",whoPaid="Хто платив",forWhom="За кого платили",add="Додати",selectAll="Вибрати всіх",unselectAll="Очистити вибір",splitEqually="Розділити порівну",nobodyHere="(Пусто)",checkAmounts="Перевірте витрати",cancelTransaction="Видалити витрати",sureToCancelTransaction="Ви впевнені, що хочете видалити витрати? Її можна буде повернути через список витрат.",selectCategory="Оберіть категорію",noCategory="Без категорії",balance="Баланс",totalTransactions="Витрати",settleUpBy="Розрахуватись по",balanceBy="Баланс по",settleUp="Розрахуватися",settleUpSaved="Транзакцію успішно збережено!",allSettledUp="Усі розрахувалися у цій групі",showInCurrency="Показати в валюті...",featureSoon="Ця функція незабаром стане доступною",okay="Добре",unlockCategories="Розблокуйте аналіз за категоріями",analyzeCategories="Аналізуйте кожну категорію та керуйте фінансами",unlock="Розблокувати",total="Всього",myTotal="Моя сума",subtitleAllTime="За все время",filter$1="Фільтр",spending="Витрати",allChat="Весь чат",onlyMine="Тільки мої",period="Період",allTime="Весь час",month="Місяць",week="Тиждень",custom="Вибрати",transactions="Витрати",myBalance="Мій баланс",statusUnconfirmed="Не підтверджено",statusCanceled="Скасовано",statusEditedBy="Ред.:",statusCreatedBy="Створено:",detailedSummary="Деталізація",addTransaction="Додати витрату",chatType="Тип чату",chatTypeDescription="Для особистого бюджету у вас є щомісячні ліміти, для розподілу чеків є кешбек",personalExpenses="Особистий бюджет",splittingBills="Розподіл чеків",currency="Валюта",language="Мова",cashback="Кешбек",setCashback="Встановити кешбек",monthlyLimit="Місячний ліміт",setLimit="Встановіть",setCashbackTitle="Встановити кешбек чату",setLimitTitle="Встановіть місячний максимум",soon="(скоро)",chooseCurrency="Виберіть валюту",chooseLanguage="Виберіть мову",leaveMessages="Оставляти повідомлення Billy в чате",forAdmin="(Админ.)",manageExpensesWith="Керуй витратами з",featureExpenses="Безлімітне додавання витрат",featureCategories="Визначення та аналіз витрат за категоріями",featureCashback="Кешбек за оплату загальних витрат",days_="дні",days="днів",month_="місяць",months="місяців",forWeekend="На вихідні",profitable="Вигідний",buyFor="Купити за",stars="зірок",discount="Знижка",voiceLimitTitle="Перевищено ліміт",voiceLimitMessage=`У вас закінчився ліміт на запис витрат голосом та текстом у цьому чаті (4 безкоштовні введення для одного учасника). Купуйте Billy Pro, щоб продовжити. -Ви, як і раніше, можете внести витрати через кнопку «Додати витрату» у додатку.`,slide1_title="Революційний запис витрат",slide1_text="Просто додай мене до вашого чату, щоб почати користуватися ботом. Витрати можна записувати як текстом, так і голосовими повідомленнями! Я знайду ці повідомлення в чаті і все врахую.",slide1_button="ТОП-3 проблеми групового розрахунку",slide2_title="Набридло переказувати один одному гроші після кожної загальної оплати?",slide2_text="Досить, щоб хтось один написав про витрату в чат - Біллі це побачить і запише в історію. Наприкінці періоду він підсумує всі витрати і скаже, хто кому скільки винен.",slide2_button="Згодні?",slide3_title="Ніхто не хоче брати відповідальність за оплату загальних витрат?",slide3_text="Плати за друзів - отримуй кешбек у Біллі реальними грошима!",slide3_button="Дізналися?",slide4_title="Не встанемо з-за столу, доки не порахуємо, хто скільки з'їв?",slide4_text="Запиши витрати зараз, а друзі заповнять свої частки потім.",slide4_button="Це все?",slide5_title="Найзручніше ведення групового бюджету!",slide5_subtitle1="Конвертація валют",slide5_text1="Спростить фінальні розрахунки, перерахувавши всі витрати у вибрану валюту. Особливо актуально у подорожах!",slide5_subtitle2="От чистить свої повідомлення в чаті",slide5_text2="Біллі підчищає всі службові повідомлення в чаті, залишаючи всю важливу інформацію в інтерфейсі програми",slide5_button="Дізнатися про Billy Pro",slide6_title="Переваги з підпискою Billy Pro",slide6_subtitle1="Безлімітне введення витрат голосом або текстом",slide6_text1="У безкоштовній версії доступно лише 4 записи голосом або текстом у спільних чатах. При цьому вводити витрати всередині бота ти завжди можеш без обмежень.",slide6_subtitle2="Категорії",slide6_text2="Біллі автоматично визначить і проставить категорію для кожної витрати, а в кінці надасть аналіз найбільших з них.",slide6_subtitle3="Кешбек",slide6_text3="Отримуй кешбек, оплачуючи загальні витрати.",slide6_button="Хочу Billy Pro",errorForbidden="Ой, а мені не дозволили показувати тобі ці циферки. Швидше за все, бо тебе нема в чаті.",errorOther="Щось не спрацювало, але вже виправляю. Спробуй поновити сторінку.",translationUk={demoMode,bot,cancel,back,close,delete:"Видалити",addEveryone,apply:apply$1,save,buyProForSave,reset,ok,addComment,yourComment,message,category,paid,owes,select,author,added,addUser,pleaseMatchUsers,pleaseAddUsers,selectWhoIs,selectUser,notSelectedUsers,selectedUsers,recentCurrencies,allCurrencies,checkout,selectCurrency,whoPaid,forWhom,add,selectAll,unselectAll,splitEqually,nobodyHere,checkAmounts,cancelTransaction,sureToCancelTransaction,selectCategory,noCategory,balance,totalTransactions,settleUpBy,balanceBy,settleUp,settleUpSaved,allSettledUp,showInCurrency,featureSoon,okay,unlockCategories,analyzeCategories,unlock,total,myTotal,subtitleAllTime,filter:filter$1,spending,allChat,onlyMine,period,allTime,month,week,custom,transactions,myBalance,statusUnconfirmed,statusCanceled,statusEditedBy,statusCreatedBy,detailedSummary,addTransaction,chatType,chatTypeDescription,personalExpenses,splittingBills,currency,language,cashback,setCashback,monthlyLimit,setLimit,setCashbackTitle,setLimitTitle,soon,chooseCurrency,chooseLanguage,leaveMessages,forAdmin,manageExpensesWith,featureExpenses,featureCategories,featureCashback,days_,days,month_,months,forWeekend,profitable,buyFor,stars,discount,voiceLimitTitle,voiceLimitMessage,slide1_title,slide1_text,slide1_button,slide2_title,slide2_text,slide2_button,slide3_title,slide3_text,slide3_button,slide4_title,slide4_text,slide4_button,slide5_title,slide5_subtitle1,slide5_text1,slide5_subtitle2,slide5_text2,slide5_button,slide6_title,slide6_subtitle1,slide6_text1,slide6_subtitle2,slide6_text2,slide6_subtitle3,slide6_text3,slide6_button,errorForbidden,errorOther},langs=["en","ru","uk"];instance.use(initReactI18next).init({lng:langs[0],fallbackLng:langs,supportedLngs:langs,debug:!1,resources:{en:{translation:translationEn},ru:{translation:translationRu},uk:{translation:translationUk}}});const avatar0="/Billy-webapp/assets/avatar-0-6b7a4992.jpg",avatar1="/Billy-webapp/assets/avatar-1-07738e43.jpg",avatar2="/Billy-webapp/assets/avatar-2-e805addc.jpg",avatar3="/Billy-webapp/assets/avatar-3-43e75752.jpg",avatar4="/Billy-webapp/assets/avatar-4-12297858.jpg",transliterate=i=>{const o={Ё:"YO",Й:"I",Ц:"TS",У:"U",К:"K",Е:"E",Н:"N",Г:"G",Ш:"SH",Щ:"SCH",З:"Z",Х:"H",Ъ:"",ё:"yo",й:"i",ц:"ts",у:"u",к:"k",е:"e",н:"n",г:"g",ш:"sh",щ:"sch",з:"z",х:"h",ъ:"",Ф:"F",Ы:"I",В:"V",А:"A",П:"P",Р:"R",О:"O",Л:"L",Д:"D",Ж:"ZH",Э:"E",ф:"f",ы:"i",в:"v",а:"a",п:"p",р:"r",о:"o",л:"l",д:"d",ж:"zh",э:"e",Я:"Ya",Ч:"CH",С:"S",М:"M",И:"I",Т:"T",Ь:"",Б:"B",Ю:"YU",я:"ya",ч:"ch",с:"s",м:"m",и:"i",т:"t",ь:"",б:"b",ю:"yu"};return i.split("").map(j=>o[j]||j).join("")},generateUser=i=>({_id:Math.round(Math.random()*1e10),first_name:i,last_name:i,username:Math.random()>.2?transliterate(i).toLowerCase():void 0,profile_photo:Math.random()<.5?null:`https://i.pravatar.cc/48/${Math.round(Math.random()*1e10)}`,_name:i}),generateName=()=>{const i=instance.language==="ru"?["Александр","Дмитрий","Максим","Сергей","Андрей","Алексей","Артём","Илья","Кирилл","Михаил","Никита","Матвей","Роман","Егор","Арсений","Иван","Денис","Евгений","Тимофей","Владислав","Игорь","Владимир","Павел","Руслан","Марк","Константин","Тимур","Олег","Ярослав","Антон","Николай","Данил","Анастасия","Мария","Анна","Виктория","Екатерина","Наталья","Марина","Полина","София","Дарья","Алиса","Ксения","Александра","Елена"]:["Isabelle","Louis","Tariq","Joyce","Zaid","Mary","Rufus","Ishaq","Lucy","Vinnie","Amelie","Jaydon","Beth","Zackary","Scott","Rhonda","Gilbert","Ayla","Dale","Moshe","Jon","Sylvie","Grover","Neil","Lukas","Amber","Shreya","Evan","Lucinda","Kareem","Reid","Owain","Liberty","Cordelia","Tony","Ophelia","Maeve","Yasir","Gary","Daniella","Keira","Umar","Sally","Oskar","Lucia","Dewi","Bethany","Marco","Amna","Micheal"];return i[Math.floor(Math.random()*i.length)]},generateNames=i=>{const o=[];do{const j=generateName();o.includes(j)||o.push(j)}while(o.length!==i);return o},_names=generateNames(6),_mockUsers=_names.map(i=>generateUser(i)),shares=_mockUsers.slice(0,4).map((i,o)=>({person_id:`Person${o}`,raw_name:i._name||"",normalized_name:i._name||"",related_user_id:Math.random()>.3?i._id:null,is_payer:o==0,amount:parseFloat((Math.round(Math.random()*1e4)/10**decimals).toFixed(decimals)),is_fixed_amount:!0}));shares.splice(1,0,{...shares[0],amount:parseFloat((shares[0].amount/3).toFixed(decimals)),is_payer:!1});shares.map(i=>`${i.normalized_name} ${i.is_payer?instance.t("paid"):instance.t("owes")} ${i.amount}`).join(", "),shares.map(i=>`${i.normalized_name} ${i.is_payer?instance.t("paid"):instance.t("owes")} ${i.amount}`).join(", "),new Date().toISOString();const mockRates=mockCurrencies.reduce((i,o)=>(i[`USD${o._id}`]=1,i),{});var Zr,Xr;const tgLanguageCode=(Xr=(Zr=window.Telegram)==null?void 0:Zr.WebApp.initDataUnsafe.user)==null?void 0:Xr.language_code,demoLanguage=tgLanguageCode&&instance.languages.includes(tgLanguageCode)?tgLanguageCode:"en",isRus=demoLanguage==="ru"||demoLanguage==="uk",demoUsers=[{_id:1e3,first_name:isRus?"Павел":"Pavel",last_name:isRus?"Дуров":"Durov",username:"underdog",profile_photo:avatar0},{_id:1001,first_name:isRus?"Антон":"Anton",last_name:isRus?"Костин":"Kostin",username:"ceo_of_everything",profile_photo:avatar1},{_id:1002,first_name:isRus?"Егор":"George",last_name:isRus?"Корепанов":"Korepanov",username:"gkor",profile_photo:avatar2},{_id:1003,first_name:isRus?"Даша":"Daria",last_name:isRus?"Турилова":"Turilova",username:"dariadesign",profile_photo:avatar3},{_id:1004,first_name:isRus?"Карим":"Karim",last_name:isRus?"Искаков":"Iskakov",username:"karim_official",profile_photo:avatar4}],demoTransaction={_id:"demo-tx",chat_id:0,creator_user_id:null,editor_user_id:null,is_voice:!0,raw_text:isRus?"Антон заплатил 4500 рублей за Пашу, Егора, Дашу и Карима в ресторане. Егор оставил 700 рублей чаевыми. Делим счёт поровну.":"Anton paid 45 dollars for Pavel, George, Dasha and Karim in restaurant. George left 10 dollars tips. Split bill equally.",formatted_text:isRus?"Антон заплатил 4500 рублей за Пашу, Егора, Дашу и Карима в ресторане. Егор оставил 700 рублей чаевыми. Делим счёт поровну.":"Anton paid 45 dollars for Pavel, George, Dasha and Karim in restaurant. George left 10 dollars tips. Split bill equally.",is_confirmed:!1,is_canceled:!1,is_equally:!0,currency_id:isRus?"RUB":"USD",shares:[{person_id:"Person-1",raw_name:demoUsers[1].first_name,normalized_name:demoUsers[1].first_name,related_user_id:demoUsers[1]._id,is_payer:!0,amount:isRus?4500:45,is_fixed_amount:!1},{person_id:"Person-2",raw_name:demoUsers[2].first_name,normalized_name:demoUsers[2].first_name,related_user_id:demoUsers[2]._id,is_payer:!0,amount:isRus?700:10,is_fixed_amount:!1},{person_id:"Person-0",raw_name:demoUsers[0].first_name,normalized_name:demoUsers[0].first_name,related_user_id:demoUsers[0]._id,is_payer:!1,amount:isRus?1040:11,is_fixed_amount:!1},{person_id:"Person-2",raw_name:demoUsers[2].first_name,normalized_name:demoUsers[2].first_name,related_user_id:demoUsers[2]._id,is_payer:!1,amount:isRus?1040:11,is_fixed_amount:!1},{person_id:"Person-3",raw_name:demoUsers[3].first_name,normalized_name:demoUsers[3].first_name,related_user_id:demoUsers[3]._id,is_payer:!1,amount:isRus?1040:11,is_fixed_amount:!1},{person_id:"Person-4",raw_name:demoUsers[4].first_name,normalized_name:demoUsers[4].first_name,related_user_id:demoUsers[4]._id,is_payer:!1,amount:isRus?1040:11,is_fixed_amount:!1},{person_id:"Person-1",raw_name:demoUsers[1].first_name,normalized_name:demoUsers[1].first_name,related_user_id:demoUsers[1]._id,is_payer:!1,amount:isRus?1040:11,is_fixed_amount:!1}],time_created:new Date().toISOString(),nutshell:null,category:null,is_settleup:!1,cashback:null},demoCurrencyId=isRus?"RUB":"USD",demoChat={default_currency:demoCurrencyId,language_code:demoLanguage,is_admin:!1,silent_mode:!1,rates:mockRates,mode:"family",cashback:0,monthly_limit:0},mockUsers=demoUsers,mockTransaction=demoTransaction,mockChat=demoChat,mockSummary={chat_id:0,url:"https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit",debts:mockUsers.map((i,o,j)=>({from_user:i,to_user:j[o===j.length-1?0:o+1],amount:parseFloat((Math.round(Math.random()*(isRus?1e6:1e5))/10**decimals).toFixed(decimals)),currency_id:demoCurrencyId}))},mockTransactions=mockSummary.debts.map((i,o)=>({_id:`demo-tx-${o}`,chat_id:0,creator_user_id:null,editor_user_id:null,is_voice:!1,raw_text:"",formatted_text:"",is_confirmed:!0,is_canceled:!1,is_equally:!0,currency_id:i.currency_id,shares:[{person_id:"Person-1",raw_name:i.to_user.first_name,normalized_name:i.to_user.first_name,related_user_id:i.to_user._id,is_payer:!0,amount:i.amount,is_fixed_amount:!1},{person_id:"Person-2",raw_name:i.from_user.first_name,normalized_name:i.from_user.first_name,related_user_id:i.from_user._id,is_payer:!1,amount:i.amount,is_fixed_amount:!1}],time_created:new Date(+new Date-o).toISOString(),nutshell:o===0?isRus?"Расчёт":"Settle up":isRus?"Демо-трата":"Demo transaction",category:o===0?"paid":["financial_expenses","food_drinks","housing","income","investments","life_entertainment","shopping","transportation","utilities"][Math.floor(Math.random()*10)],is_settleup:!1,cashback:o===0?.05:null})),apiUrl$1="https://api.billy.money",staleTime=5*60*1e3,handleJsonResponse=i=>{if(!i.ok)throw new Error(`[${i.status}] ${i.statusText}`);return i.json()},useGetTx=()=>{const{authString:i}=useAuth(),{setTransaction:o,txId:j}=useStore(),{newTx:$}=useNewTx();return console.log("useGetTx txId",j),useQuery({queryKey:["tx",`tx-${j}`],queryFn:()=>j!=null&&j.includes("demo")?mockTransactions.find(_e=>_e._id===j)||mockTransaction:j==="NEW"?$:fetch(`${apiUrl$1}/transactions/${j}`,{method:"GET",headers:{Authorization:i}}).then(handleJsonResponse),onSuccess:_e=>{console.log("useApi onSuccess useGetTx",_e),o(_e)},enabled:j!==void 0,staleTime})},useGetUsers=i=>{const{authString:o}=useAuth(),{setUsers:j}=useStore();return useQuery({queryKey:["users",`chat-${i}`],queryFn:i===0?()=>mockUsers:()=>fetch(`${apiUrl$1}/chat/${i}/users`,{method:"GET",headers:{Authorization:o}}).then(handleJsonResponse),onSuccess:$=>{console.log("useApi onSuccess useGetUsers",$),j($)},enabled:i!==void 0,staleTime})},useGetUser=i=>{const{authString:o,userId:j}=useAuth(),$=i||j;return useQuery({queryKey:["user",`user-${$}`],queryFn:()=>fetch(`${apiUrl$1}/user/${$}`,{method:"GET",headers:{Authorization:o}}).then(handleJsonResponse),enabled:!!$,staleTime})},useGetChat=i=>{const{authString:o}=useAuth(),{setChat:j}=useStore();return useQuery({queryKey:["chat",`chat-${i}`],queryFn:i===0?()=>mockChat:()=>fetch(`${apiUrl$1}/chat/${i}/settings`,{method:"GET",headers:{Authorization:o}}).then(handleJsonResponse),onSuccess:$=>{console.log("useGetChat onSuccess useGetChat",$),j($)},enabled:i!==void 0,staleTime})},useGetCurrencies=i=>{const{authString:o}=useAuth(),{setCurrencies:j}=useStore();return useQuery({queryKey:["currencies",`chat-${i}`],queryFn:i===0?()=>mockCurrencies:()=>fetch(`${apiUrl$1}/currencies/?chat_id=${i}`,{method:"GET",headers:{Authorization:o}}).then(handleJsonResponse),onSuccess:$=>{console.log("useApi onSuccess useGetCurrencies",$),j($)},enabled:i!==void 0,staleTime})},usePutTransaction=()=>{const{authString:i}=useAuth(),{txId:o}=useStore(),j=o!=null&&o.includes("demo")?"https://jsonplaceholder.typicode.com/posts/1":`${apiUrl$1}/transactions/${o}`;return $=>fetch(j,{method:"PUT",body:JSON.stringify($),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},usePostTransaction=()=>{const{authString:i}=useAuth(),{summaryId:o}=useStore(),j=o!=null&&o.includes("demo")?"https://jsonplaceholder.typicode.com/posts":`${apiUrl$1}/transactions/`;return $=>fetch(j,{method:"POST",body:JSON.stringify({...$,_id:void 0}),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},useGetSummary=()=>{const{authString:i}=useAuth(),{summaryId:o,summaryCurrencyId:j}=useStore();console.log("useGetSummary summaryId",o,j);const $=`${apiUrl$1}/summary/${o}`+(j?`?${new URLSearchParams({target_currency_id:String(j)})}`:"");return useQuery({queryKey:["summary",`summary-${o}-${j}`],queryFn:o!=null&&o.includes("demo")?()=>mockSummary:()=>fetch($,{method:"GET",headers:{Authorization:i}}).then(handleJsonResponse),enabled:o!==void 0,staleTime})},useGetCategories=()=>{const{authString:i}=useAuth(),{setCategories:o}=useStore();return useQuery({queryKey:["categories"],queryFn:()=>fetch(`${apiUrl$1}/general/categories`,{method:"GET",headers:{Authorization:i}}).then(handleJsonResponse),onSuccess:j=>{console.log("useApi onSuccess useGetCategories",j),o(j)},staleTime})},useGetTransactions=i=>{const{authString:o}=useAuth(),{setTransactions:j,summaryId:$}=useStore();return useQuery({queryKey:["transactions",`chat-${i}`],queryFn:i===0||$!=null&&$.includes("demo")?()=>mockTransactions:()=>fetch(`${apiUrl$1}/chat/${i}/transactions`,{method:"GET",headers:{Authorization:o}}).then(handleJsonResponse),onSuccess:_e=>{console.log("useApi onSuccess useGetTransactions",_e),j(_e)},enabled:i!==void 0&&$!==void 0,staleTime})},usePostChatMode=()=>{const{authString:i}=useAuth(),{chatId:o}=useChatId(),j=o===0?"https://jsonplaceholder.typicode.com/posts":`${apiUrl$1}/chat/${o}/mode`;return $=>fetch(j,{method:"POST",body:JSON.stringify({mode:$}),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},usePostChatCurrency=()=>{const{authString:i}=useAuth(),{chatId:o}=useChatId(),j=o===0?"https://jsonplaceholder.typicode.com/posts":`${apiUrl$1}/chat/${o}/currency`;return $=>fetch(j,{method:"POST",body:JSON.stringify({currency_id:$}),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},usePostChatLanguage=()=>{const{authString:i}=useAuth(),{chatId:o}=useChatId(),j=o===0?"https://jsonplaceholder.typicode.com/posts":`${apiUrl$1}/chat/${o}/language`;return $=>fetch(j,{method:"POST",body:JSON.stringify({language_code:$}),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},usePostChatSilent=()=>{const{authString:i}=useAuth(),{chatId:o}=useChatId(),j=o===0?"https://jsonplaceholder.typicode.com/posts":`${apiUrl$1}/chat/${o}/silent`;return $=>fetch(j,{method:"POST",body:JSON.stringify({silent_mode:$}),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},usePostChatMonthlyLimit=()=>{const{authString:i}=useAuth(),{chatId:o}=useChatId(),j=o===0?"https://jsonplaceholder.typicode.com/posts":`${apiUrl$1}/chat/${o}/monthly_limit`;return $=>fetch(j,{method:"POST",body:JSON.stringify({monthly_limit:$}),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},usePostChatCashback=()=>{const{authString:i}=useAuth(),{chatId:o}=useChatId(),j=o===0?"https://jsonplaceholder.typicode.com/posts":`${apiUrl$1}/chat/${o}/cashback`;return $=>fetch(j,{method:"POST",body:JSON.stringify({cashback:$}),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},useGetSummarySheetRebuild=()=>{const{authString:i}=useAuth(),{summaryId:o}=useStore(),j=!o||o!=null&&o.includes("demo")?"https://jsonplaceholder.typicode.com/posts":`${apiUrl$1}/summary/${o}/gsheet`;return()=>fetch(j,{method:"GET",headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},usePostUserOnboarding=()=>{const[i]=M(),{authString:o}=useAuth(),j=i.user?`${apiUrl$1}/users/${i.user.id}/start_onb`:"https://jsonplaceholder.typicode.com/posts";return({ref:$})=>fetch(j,{method:"POST",body:JSON.stringify({user:i.user,ref:$}),headers:{"Content-type":"application/json",Authorization:o}}).then(handleJsonResponse)},usePostPayment=()=>{const{authString:i}=useAuth(),{pwTxId:o}=useStore();return({amount:j,productKey:$})=>{const _e=`${apiUrl$1}/payments/`;return fetch(_e,{method:"POST",body:JSON.stringify({amount:String(j),product_key:$,pw_txid:o}),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)}},useChatId=()=>{const{data:i}=useGetTx(),{data:o}=useGetSummary(),{chatIdStart:j}=useStore();return{chatId:j||(i?i.chat_id:void 0)||(o?o.chat_id:void 0)}};var reactClarity=function(i){(function(o,j,$,_e,et,tt,st){o[$]=o[$]||function(){(o[$].q=o[$].q||[]).push(arguments)},tt=j.createElement(_e),tt.async=1,tt.src="https://www.clarity.ms/tag/"+et,st=j.getElementsByTagName(_e)[0],st.parentNode.insertBefore(tt,st)})(window,document,"clarity","script",i)},clarityInit=reactClarity;function clarity(){var i=Array.prototype.slice.call(arguments);if(!window.clarity)throw new Error("Clarity is not initialized");window.clarity.apply(void 0,i)}function init(i){clarityInit(i)}function hasStarted(){return typeof window.clarity=="function"}function identify(i,o){clarity("identify",i,o)}function consent(){clarity("consent")}function setTag(i,o){clarity("set",i,o)}function upgrade(i){clarity("upgrade",i)}var reactMicrosoftClarity={clarity:{init,hasStarted,identify,consent,setTag,upgrade}};const CLARITY_ID="nye7e7t3v1",useClarity=()=>{const{userId:i}=useAuth();reactMicrosoftClarity.clarity.init(CLARITY_ID),i&&reactMicrosoftClarity.clarity.identify(String(i),{})},useCurrencies=()=>{const{currencies:i}=useStore();return{getCurrencyById:j=>i.find($=>$._id===j)}};var Config={DEBUG:!1,LIB_VERSION:"2.47.0"},window$1;if(typeof window>"u"){var loc={hostname:""};window$1={navigator:{userAgent:""},document:{location:loc,referrer:""},screen:{width:0,height:0},location:loc}}else window$1=window;var ArrayProto=Array.prototype,FuncProto=Function.prototype,ObjProto=Object.prototype,slice=ArrayProto.slice,toString=ObjProto.toString,hasOwnProperty=ObjProto.hasOwnProperty,windowConsole=window$1.console,navigator$1=window$1.navigator,document$1=window$1.document,windowOpera=window$1.opera,screen=window$1.screen,userAgent=navigator$1.userAgent,nativeBind=FuncProto.bind,nativeForEach=ArrayProto.forEach,nativeIndexOf=ArrayProto.indexOf,nativeMap=ArrayProto.map,nativeIsArray=Array.isArray,breaker={},_={trim:function(i){return i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},console$1={log:function(){if(Config.DEBUG&&!_.isUndefined(windowConsole)&&windowConsole)try{windowConsole.log.apply(windowConsole,arguments)}catch{_.each(arguments,function(o){windowConsole.log(o)})}},warn:function(){if(Config.DEBUG&&!_.isUndefined(windowConsole)&&windowConsole){var i=["Mixpanel warning:"].concat(_.toArray(arguments));try{windowConsole.warn.apply(windowConsole,i)}catch{_.each(i,function(j){windowConsole.warn(j)})}}},error:function(){if(Config.DEBUG&&!_.isUndefined(windowConsole)&&windowConsole){var i=["Mixpanel error:"].concat(_.toArray(arguments));try{windowConsole.error.apply(windowConsole,i)}catch{_.each(i,function(j){windowConsole.error(j)})}}},critical:function(){if(!_.isUndefined(windowConsole)&&windowConsole){var i=["Mixpanel error:"].concat(_.toArray(arguments));try{windowConsole.error.apply(windowConsole,i)}catch{_.each(i,function(j){windowConsole.error(j)})}}}},log_func_with_prefix=function(i,o){return function(){return arguments[0]="["+o+"] "+arguments[0],i.apply(console$1,arguments)}},console_with_prefix=function(i){return{log:log_func_with_prefix(console$1.log,i),error:log_func_with_prefix(console$1.error,i),critical:log_func_with_prefix(console$1.critical,i)}};_.bind=function(i,o){var j,$;if(nativeBind&&i.bind===nativeBind)return nativeBind.apply(i,slice.call(arguments,1));if(!_.isFunction(i))throw new TypeError;return j=slice.call(arguments,2),$=function(){if(!(this instanceof $))return i.apply(o,j.concat(slice.call(arguments)));var _e={};_e.prototype=i.prototype;var et=new _e;_e.prototype=null;var tt=i.apply(et,j.concat(slice.call(arguments)));return Object(tt)===tt?tt:et},$};_.each=function(i,o,j){if(i!=null){if(nativeForEach&&i.forEach===nativeForEach)i.forEach(o,j);else if(i.length===+i.length){for(var $=0,_e=i.length;$<_e;$++)if($ in i&&o.call(j,i[$],$,i)===breaker)return}else for(var et in i)if(hasOwnProperty.call(i,et)&&o.call(j,i[et],et,i)===breaker)return}};_.extend=function(i){return _.each(slice.call(arguments,1),function(o){for(var j in o)o[j]!==void 0&&(i[j]=o[j])}),i};_.isArray=nativeIsArray||function(i){return toString.call(i)==="[object Array]"};_.isFunction=function(i){try{return/^\s*\bfunction\b/.test(i)}catch{return!1}};_.isArguments=function(i){return!!(i&&hasOwnProperty.call(i,"callee"))};_.toArray=function(i){return i?i.toArray?i.toArray():_.isArray(i)||_.isArguments(i)?slice.call(i):_.values(i):[]};_.map=function(i,o,j){if(nativeMap&&i.map===nativeMap)return i.map(o,j);var $=[];return _.each(i,function(_e){$.push(o.call(j,_e))}),$};_.keys=function(i){var o=[];return i===null||_.each(i,function(j,$){o[o.length]=$}),o};_.values=function(i){var o=[];return i===null||_.each(i,function(j){o[o.length]=j}),o};_.include=function(i,o){var j=!1;return i===null?j:nativeIndexOf&&i.indexOf===nativeIndexOf?i.indexOf(o)!=-1:(_.each(i,function($){if(j||(j=$===o))return breaker}),j)};_.includes=function(i,o){return i.indexOf(o)!==-1};_.inherit=function(i,o){return i.prototype=new o,i.prototype.constructor=i,i.superclass=o.prototype,i};_.isObject=function(i){return i===Object(i)&&!_.isArray(i)};_.isEmptyObject=function(i){if(_.isObject(i)){for(var o in i)if(hasOwnProperty.call(i,o))return!1;return!0}return!1};_.isUndefined=function(i){return i===void 0};_.isString=function(i){return toString.call(i)=="[object String]"};_.isDate=function(i){return toString.call(i)=="[object Date]"};_.isNumber=function(i){return toString.call(i)=="[object Number]"};_.isElement=function(i){return!!(i&&i.nodeType===1)};_.encodeDates=function(i){return _.each(i,function(o,j){_.isDate(o)?i[j]=_.formatDate(o):_.isObject(o)&&(i[j]=_.encodeDates(o))}),i};_.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()};_.formatDate=function(i){function o(j){return j<10?"0"+j:j}return i.getUTCFullYear()+"-"+o(i.getUTCMonth()+1)+"-"+o(i.getUTCDate())+"T"+o(i.getUTCHours())+":"+o(i.getUTCMinutes())+":"+o(i.getUTCSeconds())};_.strip_empty_properties=function(i){var o={};return _.each(i,function(j,$){_.isString(j)&&j.length>0&&(o[$]=j)}),o};_.truncate=function(i,o){var j;return typeof i=="string"?j=i.slice(0,o):_.isArray(i)?(j=[],_.each(i,function($){j.push(_.truncate($,o))})):_.isObject(i)?(j={},_.each(i,function($,_e){j[_e]=_.truncate($,o)})):j=i,j};_.JSONEncode=function(){return function(i){var o=i,j=function(_e){var et=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,tt={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return et.lastIndex=0,et.test(_e)?'"'+_e.replace(et,function(st){var rt=tt[st];return typeof rt=="string"?rt:"\\u"+("0000"+st.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+_e+'"'},$=function(_e,et){var tt="",st=" ",rt=0,nt="",at="",ht=0,it=tt,dt=[],ct=et[_e];switch(ct&&typeof ct=="object"&&typeof ct.toJSON=="function"&&(ct=ct.toJSON(_e)),typeof ct){case"string":return j(ct);case"number":return isFinite(ct)?String(ct):"null";case"boolean":case"null":return String(ct);case"object":if(!ct)return"null";if(tt+=st,dt=[],toString.apply(ct)==="[object Array]"){for(ht=ct.length,rt=0;rt{const o={Ё:"YO",Й:"I",Ц:"TS",У:"U",К:"K",Е:"E",Н:"N",Г:"G",Ш:"SH",Щ:"SCH",З:"Z",Х:"H",Ъ:"",ё:"yo",й:"i",ц:"ts",у:"u",к:"k",е:"e",н:"n",г:"g",ш:"sh",щ:"sch",з:"z",х:"h",ъ:"",Ф:"F",Ы:"I",В:"V",А:"A",П:"P",Р:"R",О:"O",Л:"L",Д:"D",Ж:"ZH",Э:"E",ф:"f",ы:"i",в:"v",а:"a",п:"p",р:"r",о:"o",л:"l",д:"d",ж:"zh",э:"e",Я:"Ya",Ч:"CH",С:"S",М:"M",И:"I",Т:"T",Ь:"",Б:"B",Ю:"YU",я:"ya",ч:"ch",с:"s",м:"m",и:"i",т:"t",ь:"",б:"b",ю:"yu"};return i.split("").map(j=>o[j]||j).join("")},generateUser=i=>({_id:Math.round(Math.random()*1e10),first_name:i,last_name:i,username:Math.random()>.2?transliterate(i).toLowerCase():void 0,profile_photo:Math.random()<.5?null:`https://i.pravatar.cc/48/${Math.round(Math.random()*1e10)}`,_name:i}),generateName=()=>{const i=instance.language==="ru"?["Александр","Дмитрий","Максим","Сергей","Андрей","Алексей","Артём","Илья","Кирилл","Михаил","Никита","Матвей","Роман","Егор","Арсений","Иван","Денис","Евгений","Тимофей","Владислав","Игорь","Владимир","Павел","Руслан","Марк","Константин","Тимур","Олег","Ярослав","Антон","Николай","Данил","Анастасия","Мария","Анна","Виктория","Екатерина","Наталья","Марина","Полина","София","Дарья","Алиса","Ксения","Александра","Елена"]:["Isabelle","Louis","Tariq","Joyce","Zaid","Mary","Rufus","Ishaq","Lucy","Vinnie","Amelie","Jaydon","Beth","Zackary","Scott","Rhonda","Gilbert","Ayla","Dale","Moshe","Jon","Sylvie","Grover","Neil","Lukas","Amber","Shreya","Evan","Lucinda","Kareem","Reid","Owain","Liberty","Cordelia","Tony","Ophelia","Maeve","Yasir","Gary","Daniella","Keira","Umar","Sally","Oskar","Lucia","Dewi","Bethany","Marco","Amna","Micheal"];return i[Math.floor(Math.random()*i.length)]},generateNames=i=>{const o=[];do{const j=generateName();o.includes(j)||o.push(j)}while(o.length!==i);return o},_names=generateNames(6),_mockUsers=_names.map(i=>generateUser(i)),shares=_mockUsers.slice(0,4).map((i,o)=>({person_id:`Person${o}`,raw_name:i._name||"",normalized_name:i._name||"",related_user_id:Math.random()>.3?i._id:null,is_payer:o==0,amount:parseFloat((Math.round(Math.random()*1e4)/10**decimals).toFixed(decimals)),is_fixed_amount:!0}));shares.splice(1,0,{...shares[0],amount:parseFloat((shares[0].amount/3).toFixed(decimals)),is_payer:!1});shares.map(i=>`${i.normalized_name} ${i.is_payer?instance.t("paid"):instance.t("owes")} ${i.amount}`).join(", "),shares.map(i=>`${i.normalized_name} ${i.is_payer?instance.t("paid"):instance.t("owes")} ${i.amount}`).join(", "),new Date().toISOString();const mockRates=mockCurrencies.reduce((i,o)=>(i[`USD${o._id}`]=1,i),{});var Zr,Xr;const tgLanguageCode=(Xr=(Zr=window.Telegram)==null?void 0:Zr.WebApp.initDataUnsafe.user)==null?void 0:Xr.language_code,demoLanguage=tgLanguageCode&&instance.languages.includes(tgLanguageCode)?tgLanguageCode:"en",isRus=demoLanguage==="ru"||demoLanguage==="uk",demoUsers=[{_id:1e3,first_name:isRus?"Павел":"Pavel",last_name:isRus?"Дуров":"Durov",username:"underdog",profile_photo:avatar0},{_id:1001,first_name:isRus?"Антон":"Anton",last_name:isRus?"Костин":"Kostin",username:"ceo_of_everything",profile_photo:avatar1},{_id:1002,first_name:isRus?"Егор":"George",last_name:isRus?"Корепанов":"Korepanov",username:"gkor",profile_photo:avatar2},{_id:1003,first_name:isRus?"Даша":"Daria",last_name:isRus?"Турилова":"Turilova",username:"dariadesign",profile_photo:avatar3},{_id:1004,first_name:isRus?"Карим":"Karim",last_name:isRus?"Искаков":"Iskakov",username:"karim_official",profile_photo:avatar4}],demoTransaction={_id:"demo-tx",chat_id:0,creator_user_id:null,editor_user_id:null,is_voice:!0,raw_text:isRus?"Антон заплатил 4500 рублей за Пашу, Егора, Дашу и Карима в ресторане. Егор оставил 700 рублей чаевыми. Делим счёт поровну.":"Anton paid 45 dollars for Pavel, George, Dasha and Karim in restaurant. George left 10 dollars tips. Split bill equally.",formatted_text:isRus?"Антон заплатил 4500 рублей за Пашу, Егора, Дашу и Карима в ресторане. Егор оставил 700 рублей чаевыми. Делим счёт поровну.":"Anton paid 45 dollars for Pavel, George, Dasha and Karim in restaurant. George left 10 dollars tips. Split bill equally.",is_confirmed:!1,is_canceled:!1,is_equally:!0,currency_id:isRus?"RUB":"USD",shares:[{person_id:"Person-1",raw_name:demoUsers[1].first_name,normalized_name:demoUsers[1].first_name,related_user_id:demoUsers[1]._id,is_payer:!0,amount:isRus?4500:45,is_fixed_amount:!1},{person_id:"Person-2",raw_name:demoUsers[2].first_name,normalized_name:demoUsers[2].first_name,related_user_id:demoUsers[2]._id,is_payer:!0,amount:isRus?700:10,is_fixed_amount:!1},{person_id:"Person-0",raw_name:demoUsers[0].first_name,normalized_name:demoUsers[0].first_name,related_user_id:demoUsers[0]._id,is_payer:!1,amount:isRus?1040:11,is_fixed_amount:!1},{person_id:"Person-2",raw_name:demoUsers[2].first_name,normalized_name:demoUsers[2].first_name,related_user_id:demoUsers[2]._id,is_payer:!1,amount:isRus?1040:11,is_fixed_amount:!1},{person_id:"Person-3",raw_name:demoUsers[3].first_name,normalized_name:demoUsers[3].first_name,related_user_id:demoUsers[3]._id,is_payer:!1,amount:isRus?1040:11,is_fixed_amount:!1},{person_id:"Person-4",raw_name:demoUsers[4].first_name,normalized_name:demoUsers[4].first_name,related_user_id:demoUsers[4]._id,is_payer:!1,amount:isRus?1040:11,is_fixed_amount:!1},{person_id:"Person-1",raw_name:demoUsers[1].first_name,normalized_name:demoUsers[1].first_name,related_user_id:demoUsers[1]._id,is_payer:!1,amount:isRus?1040:11,is_fixed_amount:!1}],time_created:new Date().toISOString(),nutshell:null,category:null,is_settleup:!1,cashback:null},demoCurrencyId=isRus?"RUB":"USD",demoChat={default_currency:demoCurrencyId,language_code:demoLanguage,is_admin:!1,silent_mode:!1,rates:mockRates,mode:"family",cashback:0,monthly_limit:0},mockUsers=demoUsers,mockTransaction=demoTransaction,mockChat=demoChat,mockSummary={chat_id:0,url:"https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit",debts:mockUsers.map((i,o,j)=>({from_user:i,to_user:j[o===j.length-1?0:o+1],amount:parseFloat((Math.round(Math.random()*(isRus?1e6:1e5))/10**decimals).toFixed(decimals)),currency_id:demoCurrencyId}))},mockTransactions=mockSummary.debts.map((i,o)=>({_id:`demo-tx-${o}`,chat_id:0,creator_user_id:null,editor_user_id:null,is_voice:!1,raw_text:"",formatted_text:"",is_confirmed:!0,is_canceled:!1,is_equally:!0,currency_id:i.currency_id,shares:[{person_id:"Person-1",raw_name:i.to_user.first_name,normalized_name:i.to_user.first_name,related_user_id:i.to_user._id,is_payer:!0,amount:i.amount,is_fixed_amount:!1},{person_id:"Person-2",raw_name:i.from_user.first_name,normalized_name:i.from_user.first_name,related_user_id:i.from_user._id,is_payer:!1,amount:i.amount,is_fixed_amount:!1}],time_created:new Date(+new Date-o).toISOString(),nutshell:o===0?isRus?"Расчёт":"Settle up":isRus?"Демо-трата":"Demo transaction",category:o===0?"paid":["financial_expenses","food_drinks","housing","income","investments","life_entertainment","shopping","transportation","utilities"][Math.floor(Math.random()*10)],is_settleup:!1,cashback:o===0?.05:null})),apiUrl$1="https://api.billy.money",staleTime=5*60*1e3,handleJsonResponse=i=>{if(!i.ok)throw new Error(`[${i.status}] ${i.statusText}`);return i.json()},useGetTx=()=>{const{authString:i}=useAuth(),{setTransaction:o,txId:j}=useStore(),{newTx:$}=useNewTx();return console.log("useGetTx txId",j),useQuery({queryKey:["tx",`tx-${j}`],queryFn:()=>j!=null&&j.includes("demo")?mockTransactions.find(_e=>_e._id===j)||mockTransaction:j==="NEW"?$:fetch(`${apiUrl$1}/transactions/${j}`,{method:"GET",headers:{Authorization:i}}).then(handleJsonResponse),onSuccess:_e=>{console.log("useApi onSuccess useGetTx",_e),o(_e)},enabled:j!==void 0,staleTime})},useGetUsers=i=>{const{authString:o}=useAuth(),{setUsers:j}=useStore();return useQuery({queryKey:["users",`chat-${i}`],queryFn:i===0?()=>mockUsers:()=>fetch(`${apiUrl$1}/chat/${i}/users`,{method:"GET",headers:{Authorization:o}}).then(handleJsonResponse),onSuccess:$=>{console.log("useApi onSuccess useGetUsers",$),j($)},enabled:i!==void 0,staleTime})},useGetUser=i=>{const{authString:o,userId:j}=useAuth(),$=i||j;return useQuery({queryKey:["user",`user-${$}`],queryFn:()=>fetch(`${apiUrl$1}/users/${$}`,{method:"GET",headers:{Authorization:o}}).then(handleJsonResponse),enabled:!!$,staleTime})},useGetChat=i=>{const{authString:o}=useAuth(),{setChat:j}=useStore();return useQuery({queryKey:["chat",`chat-${i}`],queryFn:i===0?()=>mockChat:()=>fetch(`${apiUrl$1}/chat/${i}/settings`,{method:"GET",headers:{Authorization:o}}).then(handleJsonResponse),onSuccess:$=>{console.log("useGetChat onSuccess useGetChat",$),j($)},enabled:i!==void 0,staleTime})},useGetCurrencies=i=>{const{authString:o}=useAuth(),{setCurrencies:j}=useStore();return useQuery({queryKey:["currencies",`chat-${i}`],queryFn:i===0?()=>mockCurrencies:()=>fetch(`${apiUrl$1}/currencies/?chat_id=${i}`,{method:"GET",headers:{Authorization:o}}).then(handleJsonResponse),onSuccess:$=>{console.log("useApi onSuccess useGetCurrencies",$),j($)},enabled:i!==void 0,staleTime})},usePutTransaction=()=>{const{authString:i}=useAuth(),{txId:o}=useStore(),j=o!=null&&o.includes("demo")?"https://jsonplaceholder.typicode.com/posts/1":`${apiUrl$1}/transactions/${o}`;return $=>fetch(j,{method:"PUT",body:JSON.stringify($),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},usePostTransaction=()=>{const{authString:i}=useAuth(),{summaryId:o}=useStore(),j=o!=null&&o.includes("demo")?"https://jsonplaceholder.typicode.com/posts":`${apiUrl$1}/transactions/`;return $=>fetch(j,{method:"POST",body:JSON.stringify({...$,_id:void 0}),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},useGetSummary=()=>{const{authString:i}=useAuth(),{summaryId:o,summaryCurrencyId:j}=useStore();console.log("useGetSummary summaryId",o,j);const $=`${apiUrl$1}/summary/${o}`+(j?`?${new URLSearchParams({target_currency_id:String(j)})}`:"");return useQuery({queryKey:["summary",`summary-${o}-${j}`],queryFn:o!=null&&o.includes("demo")?()=>mockSummary:()=>fetch($,{method:"GET",headers:{Authorization:i}}).then(handleJsonResponse),enabled:o!==void 0,staleTime})},useGetCategories=()=>{const{authString:i}=useAuth(),{setCategories:o}=useStore();return useQuery({queryKey:["categories"],queryFn:()=>fetch(`${apiUrl$1}/general/categories`,{method:"GET",headers:{Authorization:i}}).then(handleJsonResponse),onSuccess:j=>{console.log("useApi onSuccess useGetCategories",j),o(j)},staleTime})},useGetTransactions=i=>{const{authString:o}=useAuth(),{setTransactions:j,summaryId:$}=useStore();return useQuery({queryKey:["transactions",`chat-${i}`],queryFn:i===0||$!=null&&$.includes("demo")?()=>mockTransactions:()=>fetch(`${apiUrl$1}/chat/${i}/transactions`,{method:"GET",headers:{Authorization:o}}).then(handleJsonResponse),onSuccess:_e=>{console.log("useApi onSuccess useGetTransactions",_e),j(_e)},enabled:i!==void 0&&$!==void 0,staleTime})},usePostChatMode=()=>{const{authString:i}=useAuth(),{chatId:o}=useChatId(),j=o===0?"https://jsonplaceholder.typicode.com/posts":`${apiUrl$1}/chat/${o}/mode`;return $=>fetch(j,{method:"POST",body:JSON.stringify({mode:$}),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},usePostChatCurrency=()=>{const{authString:i}=useAuth(),{chatId:o}=useChatId(),j=o===0?"https://jsonplaceholder.typicode.com/posts":`${apiUrl$1}/chat/${o}/currency`;return $=>fetch(j,{method:"POST",body:JSON.stringify({currency_id:$}),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},usePostChatLanguage=()=>{const{authString:i}=useAuth(),{chatId:o}=useChatId(),j=o===0?"https://jsonplaceholder.typicode.com/posts":`${apiUrl$1}/chat/${o}/language`;return $=>fetch(j,{method:"POST",body:JSON.stringify({language_code:$}),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},usePostChatSilent=()=>{const{authString:i}=useAuth(),{chatId:o}=useChatId(),j=o===0?"https://jsonplaceholder.typicode.com/posts":`${apiUrl$1}/chat/${o}/silent`;return $=>fetch(j,{method:"POST",body:JSON.stringify({silent_mode:$}),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},usePostChatMonthlyLimit=()=>{const{authString:i}=useAuth(),{chatId:o}=useChatId(),j=o===0?"https://jsonplaceholder.typicode.com/posts":`${apiUrl$1}/chat/${o}/monthly_limit`;return $=>fetch(j,{method:"POST",body:JSON.stringify({monthly_limit:$}),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},usePostChatCashback=()=>{const{authString:i}=useAuth(),{chatId:o}=useChatId(),j=o===0?"https://jsonplaceholder.typicode.com/posts":`${apiUrl$1}/chat/${o}/cashback`;return $=>fetch(j,{method:"POST",body:JSON.stringify({cashback:$}),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},useGetSummarySheetRebuild=()=>{const{authString:i}=useAuth(),{summaryId:o}=useStore(),j=!o||o!=null&&o.includes("demo")?"https://jsonplaceholder.typicode.com/posts":`${apiUrl$1}/summary/${o}/gsheet`;return()=>fetch(j,{method:"GET",headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},usePostUserOnboarding=()=>{const[i]=M(),{authString:o}=useAuth(),j=i.user?`${apiUrl$1}/users/${i.user.id}/start_onb`:"https://jsonplaceholder.typicode.com/posts";return({ref:$})=>fetch(j,{method:"POST",body:JSON.stringify({user:i.user,ref:$}),headers:{"Content-type":"application/json",Authorization:o}}).then(handleJsonResponse)},usePostPayment=()=>{const{authString:i}=useAuth(),{pwTxId:o}=useStore();return({amount:j,productKey:$})=>{const _e=`${apiUrl$1}/payments/`;return fetch(_e,{method:"POST",body:JSON.stringify({amount:String(j),product_key:$,pw_txid:o}),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)}},useChatId=()=>{const{data:i}=useGetTx(),{data:o}=useGetSummary(),{chatIdStart:j}=useStore();return{chatId:j||(i?i.chat_id:void 0)||(o?o.chat_id:void 0)}};var reactClarity=function(i){(function(o,j,$,_e,et,tt,st){o[$]=o[$]||function(){(o[$].q=o[$].q||[]).push(arguments)},tt=j.createElement(_e),tt.async=1,tt.src="https://www.clarity.ms/tag/"+et,st=j.getElementsByTagName(_e)[0],st.parentNode.insertBefore(tt,st)})(window,document,"clarity","script",i)},clarityInit=reactClarity;function clarity(){var i=Array.prototype.slice.call(arguments);if(!window.clarity)throw new Error("Clarity is not initialized");window.clarity.apply(void 0,i)}function init(i){clarityInit(i)}function hasStarted(){return typeof window.clarity=="function"}function identify(i,o){clarity("identify",i,o)}function consent(){clarity("consent")}function setTag(i,o){clarity("set",i,o)}function upgrade(i){clarity("upgrade",i)}var reactMicrosoftClarity={clarity:{init,hasStarted,identify,consent,setTag,upgrade}};const CLARITY_ID="nye7e7t3v1",useClarity=()=>{const{userId:i}=useAuth();reactMicrosoftClarity.clarity.init(CLARITY_ID),i&&reactMicrosoftClarity.clarity.identify(String(i),{})},useCurrencies=()=>{const{currencies:i}=useStore();return{getCurrencyById:j=>i.find($=>$._id===j)}};var Config={DEBUG:!1,LIB_VERSION:"2.47.0"},window$1;if(typeof window>"u"){var loc={hostname:""};window$1={navigator:{userAgent:""},document:{location:loc,referrer:""},screen:{width:0,height:0},location:loc}}else window$1=window;var ArrayProto=Array.prototype,FuncProto=Function.prototype,ObjProto=Object.prototype,slice=ArrayProto.slice,toString=ObjProto.toString,hasOwnProperty=ObjProto.hasOwnProperty,windowConsole=window$1.console,navigator$1=window$1.navigator,document$1=window$1.document,windowOpera=window$1.opera,screen=window$1.screen,userAgent=navigator$1.userAgent,nativeBind=FuncProto.bind,nativeForEach=ArrayProto.forEach,nativeIndexOf=ArrayProto.indexOf,nativeMap=ArrayProto.map,nativeIsArray=Array.isArray,breaker={},_={trim:function(i){return i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},console$1={log:function(){if(Config.DEBUG&&!_.isUndefined(windowConsole)&&windowConsole)try{windowConsole.log.apply(windowConsole,arguments)}catch{_.each(arguments,function(o){windowConsole.log(o)})}},warn:function(){if(Config.DEBUG&&!_.isUndefined(windowConsole)&&windowConsole){var i=["Mixpanel warning:"].concat(_.toArray(arguments));try{windowConsole.warn.apply(windowConsole,i)}catch{_.each(i,function(j){windowConsole.warn(j)})}}},error:function(){if(Config.DEBUG&&!_.isUndefined(windowConsole)&&windowConsole){var i=["Mixpanel error:"].concat(_.toArray(arguments));try{windowConsole.error.apply(windowConsole,i)}catch{_.each(i,function(j){windowConsole.error(j)})}}},critical:function(){if(!_.isUndefined(windowConsole)&&windowConsole){var i=["Mixpanel error:"].concat(_.toArray(arguments));try{windowConsole.error.apply(windowConsole,i)}catch{_.each(i,function(j){windowConsole.error(j)})}}}},log_func_with_prefix=function(i,o){return function(){return arguments[0]="["+o+"] "+arguments[0],i.apply(console$1,arguments)}},console_with_prefix=function(i){return{log:log_func_with_prefix(console$1.log,i),error:log_func_with_prefix(console$1.error,i),critical:log_func_with_prefix(console$1.critical,i)}};_.bind=function(i,o){var j,$;if(nativeBind&&i.bind===nativeBind)return nativeBind.apply(i,slice.call(arguments,1));if(!_.isFunction(i))throw new TypeError;return j=slice.call(arguments,2),$=function(){if(!(this instanceof $))return i.apply(o,j.concat(slice.call(arguments)));var _e={};_e.prototype=i.prototype;var et=new _e;_e.prototype=null;var tt=i.apply(et,j.concat(slice.call(arguments)));return Object(tt)===tt?tt:et},$};_.each=function(i,o,j){if(i!=null){if(nativeForEach&&i.forEach===nativeForEach)i.forEach(o,j);else if(i.length===+i.length){for(var $=0,_e=i.length;$<_e;$++)if($ in i&&o.call(j,i[$],$,i)===breaker)return}else for(var et in i)if(hasOwnProperty.call(i,et)&&o.call(j,i[et],et,i)===breaker)return}};_.extend=function(i){return _.each(slice.call(arguments,1),function(o){for(var j in o)o[j]!==void 0&&(i[j]=o[j])}),i};_.isArray=nativeIsArray||function(i){return toString.call(i)==="[object Array]"};_.isFunction=function(i){try{return/^\s*\bfunction\b/.test(i)}catch{return!1}};_.isArguments=function(i){return!!(i&&hasOwnProperty.call(i,"callee"))};_.toArray=function(i){return i?i.toArray?i.toArray():_.isArray(i)||_.isArguments(i)?slice.call(i):_.values(i):[]};_.map=function(i,o,j){if(nativeMap&&i.map===nativeMap)return i.map(o,j);var $=[];return _.each(i,function(_e){$.push(o.call(j,_e))}),$};_.keys=function(i){var o=[];return i===null||_.each(i,function(j,$){o[o.length]=$}),o};_.values=function(i){var o=[];return i===null||_.each(i,function(j){o[o.length]=j}),o};_.include=function(i,o){var j=!1;return i===null?j:nativeIndexOf&&i.indexOf===nativeIndexOf?i.indexOf(o)!=-1:(_.each(i,function($){if(j||(j=$===o))return breaker}),j)};_.includes=function(i,o){return i.indexOf(o)!==-1};_.inherit=function(i,o){return i.prototype=new o,i.prototype.constructor=i,i.superclass=o.prototype,i};_.isObject=function(i){return i===Object(i)&&!_.isArray(i)};_.isEmptyObject=function(i){if(_.isObject(i)){for(var o in i)if(hasOwnProperty.call(i,o))return!1;return!0}return!1};_.isUndefined=function(i){return i===void 0};_.isString=function(i){return toString.call(i)=="[object String]"};_.isDate=function(i){return toString.call(i)=="[object Date]"};_.isNumber=function(i){return toString.call(i)=="[object Number]"};_.isElement=function(i){return!!(i&&i.nodeType===1)};_.encodeDates=function(i){return _.each(i,function(o,j){_.isDate(o)?i[j]=_.formatDate(o):_.isObject(o)&&(i[j]=_.encodeDates(o))}),i};_.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()};_.formatDate=function(i){function o(j){return j<10?"0"+j:j}return i.getUTCFullYear()+"-"+o(i.getUTCMonth()+1)+"-"+o(i.getUTCDate())+"T"+o(i.getUTCHours())+":"+o(i.getUTCMinutes())+":"+o(i.getUTCSeconds())};_.strip_empty_properties=function(i){var o={};return _.each(i,function(j,$){_.isString(j)&&j.length>0&&(o[$]=j)}),o};_.truncate=function(i,o){var j;return typeof i=="string"?j=i.slice(0,o):_.isArray(i)?(j=[],_.each(i,function($){j.push(_.truncate($,o))})):_.isObject(i)?(j={},_.each(i,function($,_e){j[_e]=_.truncate($,o)})):j=i,j};_.JSONEncode=function(){return function(i){var o=i,j=function(_e){var et=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,tt={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return et.lastIndex=0,et.test(_e)?'"'+_e.replace(et,function(st){var rt=tt[st];return typeof rt=="string"?rt:"\\u"+("0000"+st.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+_e+'"'},$=function(_e,et){var tt="",st=" ",rt=0,nt="",at="",ht=0,it=tt,dt=[],ct=et[_e];switch(ct&&typeof ct=="object"&&typeof ct.toJSON=="function"&&(ct=ct.toJSON(_e)),typeof ct){case"string":return j(ct);case"number":return isFinite(ct)?String(ct):"null";case"boolean":case"null":return String(ct);case"object":if(!ct)return"null";if(tt+=st,dt=[],toString.apply(ct)==="[object Array]"){for(ht=ct.length,rt=0;rt - +