diff --git a/assets/index-c285d985.js b/assets/index-85eed898.js similarity index 96% rename from assets/index-c285d985.js rename to assets/index-85eed898.js index 2396a0b..837ef85 100644 --- a/assets/index-c285d985.js +++ b/assets/index-85eed898.js @@ -85,7 +85,7 @@ Error generating stack: `+o.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Nl=L,q0=Bm;function H0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Q0=typeof Object.is=="function"?Object.is:H0,W0=q0.useSyncExternalStore,V0=Nl.useRef,K0=Nl.useEffect,G0=Nl.useMemo,Y0=Nl.useDebugValue;Vm.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=V0(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=G0(function(){function a(g){if(!u){if(u=!0,f=g,g=r(g),i!==void 0&&s.hasValue){var y=s.value;if(i(y,g))return h=y}return h=g}if(y=h,Q0(f,g))return y;var S=r(g);return i!==void 0&&i(y,S)?y:(f=g,h=S)}var u=!1,f,h,d=n===void 0?null:n;return[function(){return a(t())},d===null?void 0:function(){return a(d())}]},[t,n,r,i]);var l=W0(e,o[0],o[1]);return K0(function(){s.hasValue=!0,s.value=l},[l]),Y0(l),l};Wm.exports=Vm;var X0=Wm.exports;const J0=al(X0),{useSyncExternalStoreWithSelector:Z0}=J0;function e1(e,t=e.getState,n){const r=Z0(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return L.useDebugValue(r),r}const jd=e=>{const t=typeof e=="function"?$0(e):e,n=(r,i)=>e1(t,r,i);return Object.assign(n,t),n},t1=e=>e?jd(e):jd,bn=4,Zr=2,Ru=[{id:"RUB",title:"Рубль",symbol:"₽",in:"В рублях",decimals:bn,visible_decimals:Zr},{id:"GEL",title:"Лари",symbol:"₾",in:"В лари",decimals:bn,visible_decimals:Zr},{id:"TRY",title:"Лира",symbol:"₺",in:"В лирах",decimals:bn,visible_decimals:Zr},{id:"EUR",title:"Евро",symbol:"€",in:"В евро",decimals:bn,visible_decimals:Zr}],n1=e=>{const t={Ё:"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 e.split("").map(n=>t[n]||"").join("")},r1=e=>({id:Math.round(Math.random()*1e10),first_name:e,last_name:e,username:Math.random()>.2?n1(e):void 0,profile_photo:`https://i.pravatar.cc/48/${Math.round(Math.random()*1e10)}`,_name:e}),i1=()=>{const e=["Александр","Дмитрий","Максим","Сергей","Андрей","Алексей","Артём","Илья","Кирилл","Михаил","Никита","Матвей","Роман","Егор","Арсений","Иван","Денис","Евгений","Тимофей","Владислав","Игорь","Владимир","Павел","Руслан","Марк","Константин","Тимур","Олег","Ярослав","Антон","Николай","Данил","Анастасия","Мария","Анна","Виктория","Екатерина","Наталья","Марина","Полина","София","Дарья","Алиса","Ксения","Александра","Елена"];return e[Math.floor(Math.random()*e.length)]},o1=e=>{const t=[];do{const n=i1();t.includes(n)||t.push(n)}while(t.length!==e);return t},s1=o1(6),Km=s1.map(e=>r1(e)),lo=Km.slice(0,4).map((e,t)=>({person_id:`Person${t}`,normalized_name:e._name,related_user_id:Math.random()>.3?e.id:void 0,is_payer:t==0,amount:Math.round(Math.random()*100)*10**bn}));lo.splice(1,0,{...lo[0],amount:lo[0].amount/3,is_payer:!1});const l1={_id:"1",chat_id:null,is_voice:!0,raw_text:lo.map(e=>`${e.normalized_name} ${e.is_payer?"заплатил":"должен"} ${(e.amount/10**bn).toFixed(0)}`).join(", "),shares:lo,is_confirmed:!1,currency_id:Ru[0].id},Vt=t1((e,t)=>({txId:void 0,setTxId:n=>e({txId:n}),users:[],setUsers:n=>e({users:n}),selectPersonId:null,setSelectPersonId:n=>e({selectPersonId:n}),currencies:Ru,currency:Ru[0],setCurrency:n=>{t().transaction!==void 0&&e({transaction:{...t().transaction,currency_id:n}})},transaction:void 0,setTransaction:n=>e({transaction:n}),isSuccess:null,setSuccess:n=>e({isSuccess:n})})),Al=()=>{const{txId:e,setTxId:t}=Vt(),n=Oc();if(e===void 0){const i=new URLSearchParams(n.search).get("txid");t(i||null)}},Gm=()=>{const e=()=>window.matchMedia("(prefers-color-scheme: dark)").matches,[t,n]=L.useState(e()),r=()=>{n(e())};return window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",r),{isDarkTheme:t}},Il=()=>{const{users:e,transaction:t,setTransaction:n,selectPersonId:r}=Vt(),i=(t==null?void 0:t.shares)||[],o=i.map(h=>h.related_user_id),s=e.filter(h=>!o.includes(h.id)),l=i.every(h=>h.related_user_id);return{users:e,unrelatedUsers:s,isRelationsComplete:l,getUserById:h=>e.find(d=>d.id===h),selectUser:h=>()=>{if(r!==null){const d=[...i],g=d.findIndex(y=>y.related_user_id===h.id);for(let y=0;y()=>{const d=[...i].filter(g=>g.person_id!==h);t&&n({...t,shares:d}),history.back()}}},Ym=({size:e})=>x.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-y-1/2 -translate-x-1/2 w-[50px] h-[50px]",style:{width:e,height:e},children:x.jsx("div",{className:"w-full h-full rounded-full border-[3px] border-button border-l-button/10 border-t-button/10 animate-[spin_0.6s_linear_infinite]"})});function ao({children:e,theme:t="default",disabled:n,isBusy:r,onClick:i}){const o={default:"mx-auto w-full max-w-[500px] md:max-w-[300px] block h-10 bg-button text-buttonText rounded-md text-[14px] leading-[20px] font-semibold enabled:hover:brightness-110 enabled:active:brightness-[1.2] disabled:opacity-40 transition-all",text:"h-6 text-[14px] leading-[24px] text-button hover:brightness-[1.2] active:brightness-[1.4] transition-all"}[t];return x.jsxs("div",{className:"relative",children:[x.jsx("button",{className:o,disabled:n||r,onClick:i,children:e}),r&&x.jsx(Ym,{size:30})]})}const a1=({onClick:e})=>{var t,n,r;const i=typeof window<"u"?(t=window)==null||(n=t.Telegram)==null||(r=n.WebApp)==null?void 0:r.BackButton:null;return i&&(L.useEffect(()=>(i.show(),()=>{i.hide()}),[]),L.useEffect(()=>{if(e)return i.onClick(e),()=>{i.offClick(e)}},[e])),null},u1=e=>L.createElement("svg",{width:12,height:20,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},L.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.53714 19.5928L0.292152 10.6788C-0.097384 10.3036 -0.097384 9.69738 0.292152 9.32117L9.53714 0.407154C10.0995 -0.135718 11.0144 -0.135718 11.5777 0.407154C12.14 0.950026 12.14 1.8311 11.5777 2.37397L3.66913 10.0005L11.5777 17.6251C12.14 18.1689 12.14 19.05 11.5777 19.5928C11.0144 20.1357 10.0995 20.1357 9.53714 19.5928Z",fill:"currentColor"}));function Ml({onBack:e,onCancel:t}){var n,r;return((r=(n=window==null?void 0:window.Telegram)==null?void 0:n.WebApp)==null?void 0:r.platform)!=="unknown"?x.jsx("div",{className:"h-3",children:x.jsx(a1,{onClick:e})}):x.jsxs("header",{className:"relative flex items-center justify-center h-[64px]",children:[t&&x.jsx("button",{className:"absolute left-4 top-1/2 -translate-y-1/2 text-link hover:brightness-[1.2] active:brightness-[1.4] transition-all",onClick:t,children:"Отмена"}),e&&x.jsxs("button",{className:"flex items-center gap-[5px] absolute left-4 top-1/2 -translate-y-1/2 text-link hover:brightness-[1.2] active:brightness-[1.4] transition-all",onClick:e,children:[x.jsx(u1,{}),x.jsx("span",{children:"Назад"})]}),x.jsxs("div",{className:"flex flex-col items-center justify-center gap-0.5",children:[x.jsx("div",{className:"text-[17px] leading-[22px] font-semibold",children:"Split"}),x.jsx("div",{className:"text-hint text-[13px] leading-[18px] font-semibold opacity-70",children:"бот"})]})]})}const c1=e=>{const t=e?e.split(" "):[];return`${t[0]?t[0][0]:""}${t[1]?t[1][0]:""}`},f1=e=>{};function d1({url:e,fullName:t,size:n=40}){const r=f1(t),{isDarkTheme:i}=Gm(),s=!e&&t?r+"22":i?"#9AA6AC":"#EEF0F2",l=!e&&t?c1(t):null;return x.jsx("div",{className:"flex items-center justify-center rounded-full bg-cover bg-center",style:{width:n,height:n,backgroundColor:s,backgroundImage:`url(${e})`},children:l&&x.jsx("div",{className:"uppercase font-semibold text-main",style:{fontSize:.35*n+"px",lineHeight:.6*n+"px",color:r},children:l})})}function Mc({user:e,size:t=40}){const n=[...e!=null&&e.first_name?[e.first_name]:[],...e!=null&&e.last_name?[e.last_name]:[]].join(" ");return x.jsxs("div",{className:"w-full flex gap-2 items-center truncate",children:[x.jsx(d1,{url:e==null?void 0:e.profile_photo,size:t,fullName:n}),x.jsx("div",{className:"flex flex-col -gap-0.5 flex-1 text-left truncate text-[16px] leading-[20px]",children:e?x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"truncate",children:[e.first_name," ",e.last_name]}),e.username&&x.jsxs("div",{className:"text-[14px] leading-[18px] text-hint truncate",children:["@",e.username]})]}):x.jsx("div",{className:"text-hint truncate",children:"(выберите)"})})]})}const uo=e=>(e/10**bn).toFixed(Zr),bd=e=>parseFloat(e)*10**bn||0,h1=(e,t)=>{const n=Zr,r=10,i=/[^0-9.]/,o=t.replace(/,/g,".").replace(i,"");if(!/^\d*.?\d*$/.test(o)||o.length>r)return e;const[l,a]=e.split("."),[u,f]=o.split(".");return l==="0"&&u==="00"||a==="0".repeat(n-1)&&f==="0".repeat(n)||f&&f.length>n?e:e===""&&o==="."?"0.":e==="0."&&o==="0"?"":e!=="0."&&o==="0"?"0.":o};function p1({amount:e,onChange:t}){const[n,r]=L.useState(uo(e));L.useEffect(()=>{const s=bd(n);e!==s&&r(uo(e))},[e,n]);const i=s=>{const l=s.target.value,a=h1(n,l);r(a);const u=bd(a);t(u)},o=()=>{r(uo(e))};return x.jsx("input",{type:"text",className:"w-[117px] h-10 p-2 rounded-md border border-[#DDE2E4] dark:border-[#6E7C87] dark:bg-[#D5DADD] text-right text-[16px] text-text dark:text-[#48535B] leading-[24px] focus:ring-2 focus:ring-button focus:outline-none appearance-none transition-all selection:bg-button selection:text-buttonText",inputMode:"decimal",placeholder:"0",value:n,onFocus:s=>{s.target.select()},onBlur:o,onChange:i})}function zd({related_user_id:e,amount:t,onChange:n}){const{getUserById:r}=Il(),i=e?r(e):void 0;return i?x.jsxs("div",{className:"flex gap-3",children:[x.jsx(Mc,{user:i,size:48}),x.jsx(p1,{amount:t,onChange:n})]}):null}function ai({children:e,className:t}){return x.jsx("div",{className:Yn("panel p-4 pb-6 rounded-3xl bg-bg",t),children:e})}function m1(){var r;const{transaction:e,users:t,txId:n}=Vt();return x.jsxs(ai,{className:"mt-10 text-[12px] break-words opacity-40 overflow-x-auto",children:[x.jsx("h2",{children:"Debug"}),x.jsx("strong",{children:"href = "}),location.href,x.jsx("br",{}),x.jsx("br",{}),x.jsx("strong",{children:"txid = "}),String(n),x.jsx("br",{}),x.jsx("br",{}),x.jsx("strong",{children:"transaction = "}),x.jsx("pre",{children:JSON.stringify(e,null,2)}),x.jsx("br",{}),x.jsx("br",{}),x.jsx("strong",{children:"users = "}),x.jsx("pre",{children:JSON.stringify(t,null,2)}),x.jsx("br",{}),x.jsx("br",{}),x.jsx("strong",{children:"window.Telegram.Webapp = "}),x.jsx("pre",{children:JSON.stringify((r=window.Telegram)==null?void 0:r.WebApp,null,2)})]})}function Ll({children:e,className:t}){return x.jsx("div",{className:Yn("fixed top-0 left-0 w-full h-full overflow-y-auto text-text bg-bg2",t),children:x.jsxs("div",{className:"limiter",children:[e,x.jsx(m1,{})]})})}var gn={DEBUG:!1,LIB_VERSION:"2.47.0"},Ee;if(typeof window>"u"){var Bd={hostname:""};Ee={navigator:{userAgent:""},document:{location:Bd,referrer:""},screen:{width:0,height:0},location:Bd}}else Ee=window;var Ul=Array.prototype,v1=Function.prototype,Xm=Object.prototype,zn=Ul.slice,$o=Xm.toString,Fl=Xm.hasOwnProperty,Pe=Ee.console,Bn=Ee.navigator,de=Ee.document,us=Ee.opera,nl=Ee.screen,tn=Bn.userAgent,ma=v1.bind,$d=Ul.forEach,qd=Ul.indexOf,Hd=Ul.map,g1=Array.isArray,Pu={},c={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},ce={log:function(){if(gn.DEBUG&&!c.isUndefined(Pe)&&Pe)try{Pe.log.apply(Pe,arguments)}catch{c.each(arguments,function(t){Pe.log(t)})}},warn:function(){if(gn.DEBUG&&!c.isUndefined(Pe)&&Pe){var e=["Mixpanel warning:"].concat(c.toArray(arguments));try{Pe.warn.apply(Pe,e)}catch{c.each(e,function(n){Pe.warn(n)})}}},error:function(){if(gn.DEBUG&&!c.isUndefined(Pe)&&Pe){var e=["Mixpanel error:"].concat(c.toArray(arguments));try{Pe.error.apply(Pe,e)}catch{c.each(e,function(n){Pe.error(n)})}}},critical:function(){if(!c.isUndefined(Pe)&&Pe){var e=["Mixpanel error:"].concat(c.toArray(arguments));try{Pe.error.apply(Pe,e)}catch{c.each(e,function(n){Pe.error(n)})}}}},va=function(e,t){return function(){return arguments[0]="["+t+"] "+arguments[0],e.apply(ce,arguments)}},Lc=function(e){return{log:va(ce.log,e),error:va(ce.error,e),critical:va(ce.critical,e)}};c.bind=function(e,t){var n,r;if(ma&&e.bind===ma)return ma.apply(e,zn.call(arguments,1));if(!c.isFunction(e))throw new TypeError;return n=zn.call(arguments,2),r=function(){if(!(this instanceof r))return e.apply(t,n.concat(zn.call(arguments)));var i={};i.prototype=e.prototype;var o=new i;i.prototype=null;var s=e.apply(o,n.concat(zn.call(arguments)));return Object(s)===s?s:o},r};c.each=function(e,t,n){if(e!=null){if($d&&e.forEach===$d)e.forEach(t,n);else if(e.length===+e.length){for(var r=0,i=e.length;r0&&(t[r]=n)}),t};c.truncate=function(e,t){var n;return typeof e=="string"?n=e.slice(0,t):c.isArray(e)?(n=[],c.each(e,function(r){n.push(c.truncate(r,t))})):c.isObject(e)?(n={},c.each(e,function(r,i){n[i]=c.truncate(r,t)})):n=e,n};c.JSONEncode=function(){return function(e){var t=e,n=function(i){var o=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,s={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return o.lastIndex=0,o.test(i)?'"'+i.replace(o,function(l){var a=s[l];return typeof a=="string"?a:"\\u"+("0000"+l.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+i+'"'},r=function(i,o){var s="",l=" ",a=0,u="",f="",h=0,d=s,g=[],y=o[i];switch(y&&typeof y=="object"&&typeof y.toJSON=="function"&&(y=y.toJSON(i)),typeof y){case"string":return n(y);case"number":return isFinite(y)?String(y):"null";case"boolean":case"null":return String(y);case"object":if(!y)return"null";if(s+=l,g=[],$o.apply(y)==="[object Array]"){for(h=y.length,a=0;a{const t=typeof e=="function"?$0(e):e,n=(r,i)=>e1(t,r,i);return Object.assign(n,t),n},t1=e=>e?jd(e):jd,bn=4,Zr=2,Ru=[{id:"RUB",title:"Рубль",symbol:"₽",in:"В рублях",decimals:bn,visible_decimals:Zr},{id:"GEL",title:"Лари",symbol:"₾",in:"В лари",decimals:bn,visible_decimals:Zr},{id:"TRY",title:"Лира",symbol:"₺",in:"В лирах",decimals:bn,visible_decimals:Zr},{id:"EUR",title:"Евро",symbol:"€",in:"В евро",decimals:bn,visible_decimals:Zr}],n1=e=>{const t={Ё:"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 e.split("").map(n=>t[n]||"").join("")},r1=e=>({_id:Math.round(Math.random()*1e10),first_name:e,last_name:e,username:Math.random()>.2?n1(e):void 0,profile_photo:`https://i.pravatar.cc/48/${Math.round(Math.random()*1e10)}`,_name:e}),i1=()=>{const e=["Александр","Дмитрий","Максим","Сергей","Андрей","Алексей","Артём","Илья","Кирилл","Михаил","Никита","Матвей","Роман","Егор","Арсений","Иван","Денис","Евгений","Тимофей","Владислав","Игорь","Владимир","Павел","Руслан","Марк","Константин","Тимур","Олег","Ярослав","Антон","Николай","Данил","Анастасия","Мария","Анна","Виктория","Екатерина","Наталья","Марина","Полина","София","Дарья","Алиса","Ксения","Александра","Елена"];return e[Math.floor(Math.random()*e.length)]},o1=e=>{const t=[];do{const n=i1();t.includes(n)||t.push(n)}while(t.length!==e);return t},s1=o1(6),Km=s1.map(e=>r1(e)),lo=Km.slice(0,4).map((e,t)=>({person_id:`Person${t}`,normalized_name:e._name,related_user_id:Math.random()>.3?e._id:null,is_payer:t==0,amount:Math.round(Math.random()*100)*10**bn}));lo.splice(1,0,{...lo[0],amount:lo[0].amount/3,is_payer:!1});const l1={_id:"1",chat_id:null,is_voice:!0,raw_text:lo.map(e=>`${e.normalized_name} ${e.is_payer?"заплатил":"должен"} ${(e.amount/10**bn).toFixed(0)}`).join(", "),shares:lo,is_confirmed:!1,currency_id:Ru[0].id},Vt=t1((e,t)=>({txId:void 0,setTxId:n=>e({txId:n}),users:[],setUsers:n=>e({users:n}),selectPersonId:null,setSelectPersonId:n=>e({selectPersonId:n}),currencies:Ru,currency:Ru[0],setCurrency:n=>{t().transaction!==void 0&&e({transaction:{...t().transaction,currency_id:n}})},transaction:void 0,setTransaction:n=>e({transaction:n}),isSuccess:null,setSuccess:n=>e({isSuccess:n})})),Al=()=>{const{txId:e,setTxId:t}=Vt(),n=Oc();if(e===void 0){const i=new URLSearchParams(n.search).get("txid");t(i||null)}},Gm=()=>{const e=()=>window.matchMedia("(prefers-color-scheme: dark)").matches,[t,n]=L.useState(e()),r=()=>{n(e())};return window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",r),{isDarkTheme:t}},Il=()=>{const{users:e,transaction:t,setTransaction:n,selectPersonId:r}=Vt(),i=(t==null?void 0:t.shares)||[],o=i.map(h=>h.related_user_id),s=e.filter(h=>!o.includes(h._id)),l=i.every(h=>h.related_user_id);return{users:e,unrelatedUsers:s,isRelationsComplete:l,getUserById:h=>e.find(d=>d._id===h),selectUser:h=>()=>{if(r!==null){const d=[...i],g=d.findIndex(y=>y.related_user_id===h._id);for(let y=0;y()=>{const d=[...i].filter(g=>g.person_id!==h);t&&n({...t,shares:d}),history.back()}}},Ym=({size:e})=>x.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-y-1/2 -translate-x-1/2 w-[50px] h-[50px]",style:{width:e,height:e},children:x.jsx("div",{className:"w-full h-full rounded-full border-[3px] border-button border-l-button/10 border-t-button/10 animate-[spin_0.6s_linear_infinite]"})});function ao({children:e,theme:t="default",disabled:n,isBusy:r,onClick:i}){const o={default:"mx-auto w-full max-w-[500px] md:max-w-[300px] block h-10 bg-button text-buttonText rounded-md text-[14px] leading-[20px] font-semibold enabled:hover:brightness-110 enabled:active:brightness-[1.2] disabled:opacity-40 transition-all",text:"h-6 text-[14px] leading-[24px] text-button hover:brightness-[1.2] active:brightness-[1.4] transition-all"}[t];return x.jsxs("div",{className:"relative",children:[x.jsx("button",{className:o,disabled:n||r,onClick:i,children:e}),r&&x.jsx(Ym,{size:30})]})}const a1=({onClick:e})=>{var t,n,r;const i=typeof window<"u"?(t=window)==null||(n=t.Telegram)==null||(r=n.WebApp)==null?void 0:r.BackButton:null;return i&&(L.useEffect(()=>(i.show(),()=>{i.hide()}),[]),L.useEffect(()=>{if(e)return i.onClick(e),()=>{i.offClick(e)}},[e])),null},u1=e=>L.createElement("svg",{width:12,height:20,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},L.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.53714 19.5928L0.292152 10.6788C-0.097384 10.3036 -0.097384 9.69738 0.292152 9.32117L9.53714 0.407154C10.0995 -0.135718 11.0144 -0.135718 11.5777 0.407154C12.14 0.950026 12.14 1.8311 11.5777 2.37397L3.66913 10.0005L11.5777 17.6251C12.14 18.1689 12.14 19.05 11.5777 19.5928C11.0144 20.1357 10.0995 20.1357 9.53714 19.5928Z",fill:"currentColor"}));function Ml({onBack:e,onCancel:t}){var n,r;return((r=(n=window==null?void 0:window.Telegram)==null?void 0:n.WebApp)==null?void 0:r.platform)!=="unknown"?x.jsx("div",{className:"h-3",children:x.jsx(a1,{onClick:e})}):x.jsxs("header",{className:"relative flex items-center justify-center h-[64px]",children:[t&&x.jsx("button",{className:"absolute left-4 top-1/2 -translate-y-1/2 text-link hover:brightness-[1.2] active:brightness-[1.4] transition-all",onClick:t,children:"Отмена"}),e&&x.jsxs("button",{className:"flex items-center gap-[5px] absolute left-4 top-1/2 -translate-y-1/2 text-link hover:brightness-[1.2] active:brightness-[1.4] transition-all",onClick:e,children:[x.jsx(u1,{}),x.jsx("span",{children:"Назад"})]}),x.jsxs("div",{className:"flex flex-col items-center justify-center gap-0.5",children:[x.jsx("div",{className:"text-[17px] leading-[22px] font-semibold",children:"Split"}),x.jsx("div",{className:"text-hint text-[13px] leading-[18px] font-semibold opacity-70",children:"бот"})]})]})}const c1=e=>{const t=e?e.split(" "):[];return`${t[0]?t[0][0]:""}${t[1]?t[1][0]:""}`},f1=e=>{};function d1({url:e,fullName:t,size:n=40}){const r=f1(t),{isDarkTheme:i}=Gm(),s=!e&&t?r+"22":i?"#9AA6AC":"#EEF0F2",l=!e&&t?c1(t):null;return x.jsx("div",{className:"flex items-center justify-center rounded-full bg-cover bg-center",style:{width:n,height:n,backgroundColor:s,backgroundImage:`url(${e})`},children:l&&x.jsx("div",{className:"uppercase font-semibold text-main",style:{fontSize:.35*n+"px",lineHeight:.6*n+"px",color:r},children:l})})}function Mc({user:e,size:t=40}){const n=[...e!=null&&e.first_name?[e.first_name]:[],...e!=null&&e.last_name?[e.last_name]:[]].join(" ");return x.jsxs("div",{className:"w-full flex gap-2 items-center truncate",children:[x.jsx(d1,{url:e==null?void 0:e.profile_photo,size:t,fullName:n}),x.jsx("div",{className:"flex flex-col -gap-0.5 flex-1 text-left truncate text-[16px] leading-[20px]",children:e?x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"truncate",children:[e.first_name," ",e.last_name]}),e.username&&x.jsxs("div",{className:"text-[14px] leading-[18px] text-hint truncate",children:["@",e.username]})]}):x.jsx("div",{className:"text-hint truncate",children:"(выберите)"})})]})}const uo=e=>(e/10**bn).toFixed(Zr),bd=e=>parseFloat(e)*10**bn||0,h1=(e,t)=>{const n=Zr,r=10,i=/[^0-9.]/,o=t.replace(/,/g,".").replace(i,"");if(!/^\d*.?\d*$/.test(o)||o.length>r)return e;const[l,a]=e.split("."),[u,f]=o.split(".");return l==="0"&&u==="00"||a==="0".repeat(n-1)&&f==="0".repeat(n)||f&&f.length>n?e:e===""&&o==="."?"0.":e==="0."&&o==="0"?"":e!=="0."&&o==="0"?"0.":o};function p1({amount:e,onChange:t}){const[n,r]=L.useState(uo(e));L.useEffect(()=>{const s=bd(n);e!==s&&r(uo(e))},[e,n]);const i=s=>{const l=s.target.value,a=h1(n,l);r(a);const u=bd(a);t(u)},o=()=>{r(uo(e))};return x.jsx("input",{type:"text",className:"w-[117px] h-10 p-2 rounded-md border border-[#DDE2E4] dark:border-[#6E7C87] dark:bg-[#D5DADD] text-right text-[16px] text-text dark:text-[#48535B] leading-[24px] focus:ring-2 focus:ring-button focus:outline-none appearance-none transition-all selection:bg-button selection:text-buttonText",inputMode:"decimal",placeholder:"0",value:n,onFocus:s=>{s.target.select()},onBlur:o,onChange:i})}function zd({related_user_id:e,amount:t,onChange:n}){const{getUserById:r}=Il(),i=e?r(e):void 0;return i?x.jsxs("div",{className:"flex gap-3",children:[x.jsx(Mc,{user:i,size:48}),x.jsx(p1,{amount:t,onChange:n})]}):null}function ai({children:e,className:t}){return x.jsx("div",{className:Yn("panel p-4 pb-6 rounded-3xl bg-bg",t),children:e})}function m1(){var r;const{transaction:e,users:t,txId:n}=Vt();return x.jsxs(ai,{className:"mt-10 text-[12px] break-words opacity-40 overflow-x-auto",children:[x.jsx("h2",{children:"Debug"}),x.jsx("strong",{children:"href = "}),location.href,x.jsx("br",{}),x.jsx("br",{}),x.jsx("strong",{children:"txid = "}),String(n),x.jsx("br",{}),x.jsx("br",{}),x.jsx("strong",{children:"transaction = "}),x.jsx("pre",{children:JSON.stringify(e,null,2)}),x.jsx("br",{}),x.jsx("br",{}),x.jsx("strong",{children:"users = "}),x.jsx("pre",{children:JSON.stringify(t,null,2)}),x.jsx("br",{}),x.jsx("br",{}),x.jsx("strong",{children:"window.Telegram.Webapp = "}),x.jsx("pre",{children:JSON.stringify((r=window.Telegram)==null?void 0:r.WebApp,null,2)})]})}function Ll({children:e,className:t}){return x.jsx("div",{className:Yn("fixed top-0 left-0 w-full h-full overflow-y-auto text-text bg-bg2",t),children:x.jsxs("div",{className:"limiter",children:[e,x.jsx(m1,{})]})})}var gn={DEBUG:!1,LIB_VERSION:"2.47.0"},Ee;if(typeof window>"u"){var Bd={hostname:""};Ee={navigator:{userAgent:""},document:{location:Bd,referrer:""},screen:{width:0,height:0},location:Bd}}else Ee=window;var Ul=Array.prototype,v1=Function.prototype,Xm=Object.prototype,zn=Ul.slice,$o=Xm.toString,Fl=Xm.hasOwnProperty,Pe=Ee.console,Bn=Ee.navigator,de=Ee.document,us=Ee.opera,nl=Ee.screen,tn=Bn.userAgent,ma=v1.bind,$d=Ul.forEach,qd=Ul.indexOf,Hd=Ul.map,g1=Array.isArray,Pu={},c={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},ce={log:function(){if(gn.DEBUG&&!c.isUndefined(Pe)&&Pe)try{Pe.log.apply(Pe,arguments)}catch{c.each(arguments,function(t){Pe.log(t)})}},warn:function(){if(gn.DEBUG&&!c.isUndefined(Pe)&&Pe){var e=["Mixpanel warning:"].concat(c.toArray(arguments));try{Pe.warn.apply(Pe,e)}catch{c.each(e,function(n){Pe.warn(n)})}}},error:function(){if(gn.DEBUG&&!c.isUndefined(Pe)&&Pe){var e=["Mixpanel error:"].concat(c.toArray(arguments));try{Pe.error.apply(Pe,e)}catch{c.each(e,function(n){Pe.error(n)})}}},critical:function(){if(!c.isUndefined(Pe)&&Pe){var e=["Mixpanel error:"].concat(c.toArray(arguments));try{Pe.error.apply(Pe,e)}catch{c.each(e,function(n){Pe.error(n)})}}}},va=function(e,t){return function(){return arguments[0]="["+t+"] "+arguments[0],e.apply(ce,arguments)}},Lc=function(e){return{log:va(ce.log,e),error:va(ce.error,e),critical:va(ce.critical,e)}};c.bind=function(e,t){var n,r;if(ma&&e.bind===ma)return ma.apply(e,zn.call(arguments,1));if(!c.isFunction(e))throw new TypeError;return n=zn.call(arguments,2),r=function(){if(!(this instanceof r))return e.apply(t,n.concat(zn.call(arguments)));var i={};i.prototype=e.prototype;var o=new i;i.prototype=null;var s=e.apply(o,n.concat(zn.call(arguments)));return Object(s)===s?s:o},r};c.each=function(e,t,n){if(e!=null){if($d&&e.forEach===$d)e.forEach(t,n);else if(e.length===+e.length){for(var r=0,i=e.length;r0&&(t[r]=n)}),t};c.truncate=function(e,t){var n;return typeof e=="string"?n=e.slice(0,t):c.isArray(e)?(n=[],c.each(e,function(r){n.push(c.truncate(r,t))})):c.isObject(e)?(n={},c.each(e,function(r,i){n[i]=c.truncate(r,t)})):n=e,n};c.JSONEncode=function(){return function(e){var t=e,n=function(i){var o=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,s={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return o.lastIndex=0,o.test(i)?'"'+i.replace(o,function(l){var a=s[l];return typeof a=="string"?a:"\\u"+("0000"+l.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+i+'"'},r=function(i,o){var s="",l=" ",a=0,u="",f="",h=0,d=s,g=[],y=o[i];switch(y&&typeof y=="object"&&typeof y.toJSON=="function"&&(y=y.toJSON(i)),typeof y){case"string":return n(y);case"number":return isFinite(y)?String(y):"null";case"boolean":case"null":return String(y);case"object":if(!y)return"null";if(s+=l,g=[],$o.apply(y)==="[object Array]"){for(h=y.length,a=0;a - +