@vbotma/sdk 3.3.4 → 3.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var Pc=Object.defineProperty;var Rc=(u,ee,Be)=>ee in u?Pc(u,ee,{enumerable:!0,configurable:!0,writable:!0,value:Be}):u[ee]=Be;var s=(u,ee,Be)=>Rc(u,typeof ee!="symbol"?ee+"":ee,Be);this.tmajs=this.tmajs||{};this.tmajs.sdk=(function(u){"use strict";let ee;function Be(t,e){ee?ee.set(t,e):e()}function et(t){if(ee)return t();ee=new Map;try{t()}finally{ee.forEach(e=>e()),ee=void 0}}function D(t,e){e||(e={});const n=e.equals||Object.is;let r=[],o=t;const i=p=>{if(!n(o,p)){const h=o;o=p,Be(l,()=>{[...r].forEach(([f,g])=>{f(p,h),g&&c(f,!0)})})}};function a(p){const h=typeof p!="object"?{once:p}:p;return{once:h.once||!1,signal:h.signal||!1}}const c=(p,h)=>{const f=a(h),g=r.findIndex(([v,F])=>v===p&&F.once===f.once&&F.signal===f.signal);g>=0&&r.splice(g,1)},l=Object.assign(function(){return ro(l),o},{destroy(){r=[]},set:i,reset(){i(t)},sub(p,h){return r.push([p,a(h)]),()=>c(p,h)},unsub:c,unsubAll(){r=r.filter(p=>p[1].signal)}});return l}const je=[];function ro(t){je.length&&je[je.length-1].add(t)}function C(t,e){let n=new Set,r;function o(){return r||(r=D(a(),e))}function i(){o().set(a())}function a(){n.forEach(p=>{p.unsub(i,{signal:!0})});const c=new Set;let l;je.push(c);try{l=t()}finally{je.pop()}return c.forEach(p=>{p.sub(i,{signal:!0})}),n=c,l}return Object.assign(function(){return o()()},{destroy(){o().destroy()},sub(...c){return o().sub(...c)},unsub(...c){o().unsub(...c)},unsubAll(...c){o().unsubAll(...c)}})}var so=function(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))};function oo(t){return t}function An(t,e,n,r,o,i,a,c,l){switch(arguments.length){case 1:return t;case 2:return function(){return e(t.apply(this,arguments))};case 3:return function(){return n(e(t.apply(this,arguments)))};case 4:return function(){return r(n(e(t.apply(this,arguments))))};case 5:return function(){return o(r(n(e(t.apply(this,arguments)))))};case 6:return function(){return i(o(r(n(e(t.apply(this,arguments))))))};case 7:return function(){return a(i(o(r(n(e(t.apply(this,arguments)))))))};case 8:return function(){return c(a(i(o(r(n(e(t.apply(this,arguments))))))))};case 9:return function(){return l(c(a(i(o(r(n(e(t.apply(this,arguments)))))))))}}}function d(t,e,n,r,o,i,a,c,l){switch(arguments.length){case 1:return t;case 2:return e(t);case 3:return n(e(t));case 4:return r(n(e(t)));case 5:return o(r(n(e(t))));case 6:return i(o(r(n(e(t)))));case 7:return a(i(o(r(n(e(t))))));case 8:return c(a(i(o(r(n(e(t)))))));case 9:return l(c(a(i(o(r(n(e(t))))))));default:{for(var p=arguments[0],h=1;h<arguments.length;h++)p=arguments[h](p);return p}}}var He=function(t,e){var n=typeof t=="number"?function(r){return r.length>=t}:t;return function(){var r=Array.from(arguments);return n(arguments)?e.apply(this,r):function(o){return e.apply(void 0,so([o],r,!1))}}},io={_tag:"None"},ao=function(t){return{_tag:"Some",value:t}},uo=function(t){return t._tag==="Left"},In=function(t){return{_tag:"Left",left:t}},Bn=function(t){return{_tag:"Right",right:t}},gt={};function co(t,e){return function(n){return function(r){return t.ap(t.map(r,function(o){return function(i){return e.ap(o,i)}}),n)}}}function lo(t,e){return function(n){return function(r){return t.map(r,function(o){return e.map(o,n)})}}}function wt(t){return function(e,n){return function(r){return t.chain(r,function(o){return t.map(n(o),function(i){var a;return Object.assign({},o,(a={},a[e]=i,a))})})}}}var Fe=io,$e=ao,po=function(t,e){return d(t,_o(e))},ho=function(t,e){return d(t,mo(e))},fo="Option",_o=function(t){return function(e){return De(e)?Fe:$e(t(e.value))}},bo=$e,mo=function(t){return function(e){return De(e)||De(t)?Fe:$e(e.value(t.value))}},go=He(2,function(t,e){return De(t)?Fe:e(t.value)}),wo={URI:fo,map:po,ap:ho,chain:go},De=function(t){return t._tag==="None"},vo=function(t,e){return function(n){return De(n)?t():e(n.value)}},vt=vo,yo=bo(gt),$n=wt(wo),P=In,E=Bn,yt=He(2,function(t,e){return me(t)?t:e(t.right)}),St=function(t,e){return d(t,K(e))},Mn=function(t,e){return d(t,ko(e))},Ft="Either",K=function(t){return function(e){return me(e)?e:E(t(e.right))}},So={URI:Ft,map:St},Fo=E,Co=function(t){return function(e){return me(e)?e:me(t)?t:E(e.right(t.right))}},ko=Co,Eo={URI:Ft,map:St,ap:Mn},qo={URI:Ft,map:St,ap:Mn,chain:yt},Ao=function(t,e){return function(n){return me(n)?P(t(n.left)):E(e(n.right))}},Io=function(t){return function(e){return me(e)?P(t(e.left)):e}},me=uo,Ct=function(t,e){return function(n){return me(n)?t(n.left):e(n.right)}},Bo=Ct,le=Ct,$o=le,Me=function(t,e){try{return E(t())}catch(n){return P(e(n))}},Mo=Fo(gt),Po=wt(qo),Pn=Po,Ro=yt,To=yt;function Lo(t){return An(E,t.of)}function Vo(t){return An(P,t.of)}function Oo(t){return lo(t,So)}function jo(t){return co(t,Eo)}function Ho(t){return function(e,n){return t.chain(e,function(r){return me(r)?t.of(r):n(r.right)})}}function Do(t){return function(e,n,r){return t.map(e,Ao(n,r))}}function Wo(t){return function(e,n){return function(r){return t.map(r,le(e,n))}}}var Uo=function(t){return Me(function(){return JSON.parse(t)},oo)},kt=function(t,e){return d(t,No(e))},Rn=function(t,e){return d(t,Go(e))},No=function(t){return function(e){return function(){return Promise.resolve().then(e).then(t)}}},Go=function(t){return function(e){return function(){return Promise.all([Promise.resolve().then(e),Promise.resolve().then(t)]).then(function(n){var r=n[0],o=n[1];return r(o)})}}},Et=function(t){return function(){return Promise.resolve(t)}},zo=He(2,function(t,e){return function(){return Promise.resolve().then(t).then(function(n){return e(n)()})}}),qt="Task",At={URI:qt,map:kt},Tn={of:Et},Jo={URI:qt,map:kt,ap:Rn},Ko={URI:qt,map:kt,of:Et,ap:Rn,chain:zo},Qo=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function c(h){try{p(r.next(h))}catch(f){a(f)}}function l(h){try{p(r.throw(h))}catch(f){a(f)}}function p(h){h.done?i(h.value):o(h.value).then(c,l)}p((r=r.apply(t,e||[])).next())})},Zo=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(p){return function(h){return l([p,h])}}function l(p){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,p[0]&&(n=0)),n;)try{if(r=1,o&&(i=p[0]&2?o.return:p[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,p[1])).done)return i;switch(o=0,i&&(p=[p[0]&2,i.value]),p[0]){case 0:case 1:i=p;break;case 4:return n.label++,{value:p[1],done:!1};case 5:n.label++,o=p[1],p=[0];continue;case 7:p=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!i||p[1]>i[0]&&p[1]<i[3])){n.label=p[1];break}if(p[0]===6&&n.label<i[1]){n.label=i[1],i=p;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(p);break}i[2]&&n.ops.pop(),n.trys.pop();continue}p=e.call(t,n)}catch(h){p=[6,h],o=0}finally{r=i=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},W=Vo(Tn),T=Lo(Tn),We=Et,tt=Wo(At),Yo=tt,Ln=function(t,e){return function(){return Qo(void 0,void 0,void 0,function(){var n;return Zo(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t().then(Bn)];case 1:return[2,r.sent()];case 2:return n=r.sent(),[2,In(e(n))];case 3:return[2]}})})}},Xo=function(t,e){return d(t,I(e))},xo=function(t,e){return d(t,ei(e))},I=Oo(At),Ue=He(3,Do(At)),ei=jo(Jo),It=He(2,Ho(Ko)),ti=T,ni="TaskEither",ri={URI:ni,map:Xo,ap:xo,chain:It},si=ti(gt),oi=wt(ri),nt=oi,ne=It,pe=It;function te(t){return typeof t=="function"?t():t}class Ne{constructor({onMounted:e,restoreState:n,initialState:r,onUnmounted:o,isPageReload:i}){s(this,"_isMounted",D(!1));s(this,"isMounted",C(this._isMounted));s(this,"mount");s(this,"unmount");this.mount=()=>{if(this.isMounted())return E(void 0);const a=te(i)?n():void 0,c=a?E(a):typeof r=="function"?r():E(r);return d(c,K(l=>{et(()=>{this._isMounted.set(!0),e==null||e(l)})}))},this.unmount=()=>{this._isMounted()&&et(()=>{this._isMounted.set(!1),o==null||o()})}}}function Bt(t){const e={};for(const n in t){const r=t[n];r!==void 0&&(e[n]=r)}return e}function $t(t,e){const n=Object.keys(t),r=Object.keys(e);return n.length!==r.length?!1:n.every(o=>Object.prototype.hasOwnProperty.call(e,o)&&t[o]===e[o])}class ge{constructor({initialState:e,onChange:n}){s(this,"_state");s(this,"state");s(this,"setState",e=>{const n={...this.state(),...Bt(e)};$t(n,this.state())||this._state.set(n)});this._state=D(e,{equals:$t}),this.state=C(this._state),this.state.sub(n)}getter(e){return C(()=>this._state()[e])}hasDiff(e){return!$t({...this.state(),...Bt(e)},this.state())}}let de;function Mt(t){return{lang:(t==null?void 0:t.lang)??(de==null?void 0:de.lang),message:t==null?void 0:t.message,abortEarly:(t==null?void 0:t.abortEarly)??(de==null?void 0:de.abortEarly),abortPipeEarly:(t==null?void 0:t.abortPipeEarly)??(de==null?void 0:de.abortPipeEarly)}}let Pt;function ii(t){return Pt==null?void 0:Pt.get(t)}let Rt;function ai(t){return Rt==null?void 0:Rt.get(t)}let Tt;function ui(t,e){var n;return(n=Tt==null?void 0:Tt.get(t))==null?void 0:n.get(e)}function ci(t){var n,r;const e=typeof t;return e==="string"?`"${t}"`:e==="number"||e==="bigint"||e==="boolean"?`${t}`:e==="object"||e==="function"?(t&&((r=(n=Object.getPrototypeOf(t))==null?void 0:n.constructor)==null?void 0:r.name))??"null":e}function Z(t,e,n,r,o){const i=o&&"input"in o?o.input:n.value,a=(o==null?void 0:o.expected)??t.expects??null,c=(o==null?void 0:o.received)??ci(i),l={kind:t.kind,type:t.type,input:i,expected:a,received:c,message:`Invalid ${e}: ${a?`Expected ${a} but r`:"R"}eceived ${c}`,requirement:t.requirement,path:o==null?void 0:o.path,issues:o==null?void 0:o.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},p=t.kind==="schema",h=(o==null?void 0:o.message)??t.message??ui(t.reference,l.lang)??(p?ai(l.lang):null)??r.message??ii(l.lang);h!==void 0&&(l.message=typeof h=="function"?h(l):h),p&&(n.typed=!1),n.issues?n.issues.push(l):n.issues=[l]}function Y(t){return{version:1,vendor:"valibot",validate(e){return t["~run"]({value:e},Mt())}}}function Vn(t,e){return Object.hasOwn(t,e)&&e!=="__proto__"&&e!=="prototype"&&e!=="constructor"}function li(t,e){const n=[...new Set(t)];return n.length>1?`(${n.join(` ${e} `)})`:n[0]??"never"}var pi=class extends Error{constructor(t){super(t[0].message),this.name="ValiError",this.issues=t}};function rt(t,e){return{kind:"validation",type:"check",reference:rt,async:!1,expects:null,requirement:t,message:e,"~run"(n,r){return n.typed&&!this.requirement(n.value)&&Z(this,"input",n,r),n}}}function Lt(t){return{kind:"validation",type:"integer",reference:Lt,async:!1,expects:null,requirement:Number.isInteger,message:t,"~run"(e,n){return e.typed&&!this.requirement(e.value)&&Z(this,"integer",e,n),e}}}function he(t){return{kind:"transformation",type:"transform",reference:he,async:!1,operation:t,"~run"(e){return e.value=this.operation(e.value),e}}}function di(t,e,n){return typeof t.fallback=="function"?t.fallback(e,n):t.fallback}function Vt(t,e,n){return typeof t.default=="function"?t.default(e,n):t.default}function Ot(t,e){return!t["~run"]({value:e},{abortEarly:!0}).issues}function On(){return{kind:"schema",type:"any",reference:On,expects:"any",async:!1,get"~standard"(){return Y(this)},"~run"(t){return t.typed=!0,t}}}function jn(t,e){return{kind:"schema",type:"array",reference:jn,expects:"Array",async:!1,item:t,message:e,get"~standard"(){return Y(this)},"~run"(n,r){var i;const o=n.value;if(Array.isArray(o)){n.typed=!0,n.value=[];for(let a=0;a<o.length;a++){const c=o[a],l=this.item["~run"]({value:c},r);if(l.issues){const p={type:"array",origin:"value",input:o,key:a,value:c};for(const h of l.issues)h.path?h.path.unshift(p):h.path=[p],(i=n.issues)==null||i.push(h);if(n.issues||(n.issues=l.issues),r.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value.push(l.value)}}else Z(this,"type",n,r);return n}}}function Ce(t){return{kind:"schema",type:"boolean",reference:Ce,expects:"boolean",async:!1,message:t,get"~standard"(){return Y(this)},"~run"(e,n){return typeof e.value=="boolean"?e.typed=!0:Z(this,"type",e,n),e}}}function st(t){return{kind:"schema",type:"date",reference:st,expects:"Date",async:!1,message:t,get"~standard"(){return Y(this)},"~run"(e,n){return e.value instanceof Date?isNaN(e.value)?Z(this,"type",e,n,{received:'"Invalid Date"'}):e.typed=!0:Z(this,"type",e,n),e}}}function jt(t){return{kind:"schema",type:"function",reference:jt,expects:"Function",async:!1,message:t,get"~standard"(){return Y(this)},"~run"(e,n){return typeof e.value=="function"?e.typed=!0:Z(this,"type",e,n),e}}}function Ht(t,e){return{kind:"schema",type:"instance",reference:Ht,expects:t.name,async:!1,class:t,message:e,get"~standard"(){return Y(this)},"~run"(n,r){return n.value instanceof this.class?n.typed=!0:Z(this,"type",n,r),n}}}function N(t,e){return{kind:"schema",type:"loose_object",reference:N,expects:"Object",async:!1,entries:t,message:e,get"~standard"(){return Y(this)},"~run"(n,r){var i;const o=n.value;if(o&&typeof o=="object"){n.typed=!0,n.value={};for(const a in this.entries){const c=this.entries[a];if(a in o||(c.type==="exact_optional"||c.type==="optional"||c.type==="nullish")&&c.default!==void 0){const l=a in o?o[a]:Vt(c),p=c["~run"]({value:l},r);if(p.issues){const h={type:"object",origin:"value",input:o,key:a,value:l};for(const f of p.issues)f.path?f.path.unshift(h):f.path=[h],(i=n.issues)==null||i.push(f);if(n.issues||(n.issues=p.issues),r.abortEarly){n.typed=!1;break}}p.typed||(n.typed=!1),n.value[a]=p.value}else if(c.fallback!==void 0)n.value[a]=di(c);else if(c.type!=="exact_optional"&&c.type!=="optional"&&c.type!=="nullish"&&(Z(this,"key",n,r,{input:void 0,expected:`"${a}"`,path:[{type:"object",origin:"key",input:o,key:a,value:o[a]}]}),r.abortEarly))break}if(!n.issues||!r.abortEarly)for(const a in o)Vn(o,a)&&!(a in this.entries)&&(n.value[a]=o[a])}else Z(this,"type",n,r);return n}}}function Pe(t,e){return{kind:"schema",type:"nullish",reference:Pe,expects:`(${t.expects} | null | undefined)`,async:!1,wrapped:t,default:e,get"~standard"(){return Y(this)},"~run"(n,r){return(n.value===null||n.value===void 0)&&(this.default!==void 0&&(n.value=Vt(this,n,r)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function we(t){return{kind:"schema",type:"number",reference:we,expects:"number",async:!1,message:t,get"~standard"(){return Y(this)},"~run"(e,n){return typeof e.value=="number"&&!isNaN(e.value)?e.typed=!0:Z(this,"type",e,n),e}}}function B(t,e){return{kind:"schema",type:"optional",reference:B,expects:`(${t.expects} | undefined)`,async:!1,wrapped:t,default:e,get"~standard"(){return Y(this)},"~run"(n,r){return n.value===void 0&&(this.default!==void 0&&(n.value=Vt(this,n,r)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function Dt(t,e,n){return{kind:"schema",type:"record",reference:Dt,expects:"Object",async:!1,key:t,value:e,message:n,get"~standard"(){return Y(this)},"~run"(r,o){var a,c;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(const l in i)if(Vn(i,l)){const p=i[l],h=this.key["~run"]({value:l},o);if(h.issues){const g={type:"object",origin:"key",input:i,key:l,value:p};for(const v of h.issues)v.path=[g],(a=r.issues)==null||a.push(v);if(r.issues||(r.issues=h.issues),o.abortEarly){r.typed=!1;break}}const f=this.value["~run"]({value:p},o);if(f.issues){const g={type:"object",origin:"value",input:i,key:l,value:p};for(const v of f.issues)v.path?v.path.unshift(g):v.path=[g],(c=r.issues)==null||c.push(v);if(r.issues||(r.issues=f.issues),o.abortEarly){r.typed=!1;break}}(!h.typed||!f.typed)&&(r.typed=!1),h.typed&&(r.value[h.value]=f.value)}}else Z(this,"type",r,o);return r}}}function S(t){return{kind:"schema",type:"string",reference:S,expects:"string",async:!1,message:t,get"~standard"(){return Y(this)},"~run"(e,n){return typeof e.value=="string"?e.typed=!0:Z(this,"type",e,n),e}}}function Hn(t){let e;if(t)for(const n of t)e?e.push(...n.issues):e=n.issues;return e}function ot(t,e){return{kind:"schema",type:"union",reference:ot,expects:li(t.map(n=>n.expects),"|"),async:!1,options:t,message:e,get"~standard"(){return Y(this)},"~run"(n,r){let o,i,a;for(const c of this.options){const l=c["~run"]({value:n.value},r);if(l.typed)if(l.issues)i?i.push(l):i=[l];else{o=l;break}else a?a.push(l):a=[l]}if(o)return o;if(i){if(i.length===1)return i[0];Z(this,"type",n,r,{issues:Hn(i)}),n.typed=!0}else{if((a==null?void 0:a.length)===1)return a[0];Z(this,"type",n,r,{issues:Hn(a)})}return n}}}function Wt(){return{kind:"schema",type:"unknown",reference:Wt,expects:"unknown",async:!1,get"~standard"(){return Y(this)},"~run"(t){return t.typed=!0,t}}}function fe(t,e,n){const r=t["~run"]({value:e},Mt(n));if(r.issues)throw new pi(r.issues);return r.value}function ae(...t){return{...t[0],pipe:t,get"~standard"(){return Y(this)},"~run"(e,n){for(const r of t)if(r.kind!=="metadata"){if(e.issues&&(r.kind==="schema"||r.kind==="transformation")){e.typed=!1;break}(!e.issues||!n.abortEarly&&!n.abortPipeEarly)&&(e=r["~run"](e,n))}return e}}}function Ut(t,e,n){const r=t["~run"]({value:e},Mt(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}var hi=Object.defineProperty,fi=(t,e,n)=>e in t?hi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Dn=(t,e,n)=>fi(t,typeof e!="symbol"?e+"":e,n),_i=Object.defineProperty,bi=(t,e,n)=>e in t?_i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Nt=(t,e,n)=>bi(t,typeof e!="symbol"?e+"":e,n);function Wn(t){return e=>e instanceof t}function Un(t,e){const n=class extends Error{constructor(...o){const i=typeof e=="function"?e(...o):typeof e=="string"?[e]:e||[];super(...i),this.name=t}};Nt(n,"is",Wn(n));let r=n;return Object.defineProperty(r,"name",{value:t}),r}function mi(t,e,n){const r=class extends Un(t,n){constructor(...i){super(...i),Nt(this,"data"),this.data=e(...i)}};Nt(r,"is",Wn(r));let o=r;return Object.defineProperty(o,"name",{value:t}),o}let Nn=class extends Un("CancelledError","Promise was canceled"){},Gt=class extends mi("TimeoutError",e=>({timeout:e}),(e,n)=>[`Timeout reached: ${e}ms`,{cause:n}]){};const gi=Symbol("resolved");function wi(t){return{tag:gi,value:t}}function Gn(t,e){return t.reject=e.reject,t.resolve=e.resolve,t}let Ge=class qn extends Promise{constructor(e,n){let r,o,i,a;typeof e=="function"?(i=e,a=n||{}):a=e||{};let c,l;const p=()=>!!l,h=()=>!!c;let f={};const g=[],v=()=>{g.forEach(w=>w()),g.splice(0,g.length),f={}},F=new AbortController,k=()=>h()||p();super((w,y)=>{const{abortOnResolve:m=!0,abortOnReject:j=!0}=a;o=A=>{var O,L;k()||(w(A),c=[A],(O=f.resolved)==null||O.forEach(G=>G(A)),(L=f.finalized)==null||L.forEach(G=>G({kind:"resolved",result:A})),v(),m&&F.abort(wi(A)))},r=A=>{var O,L;k()||(y(A),l=[A],(O=f.rejected)==null||O.forEach(G=>G(A)),(L=f.finalized)==null||L.forEach(G=>G({kind:"rejected",reason:A})),v(),j&&F.abort(A))};const{abortSignal:H}=a;if(H){if(H.aborted)return r(H.reason);const A=()=>{r(H.reason)};H.addEventListener("abort",A,!0),g.push(()=>{H.removeEventListener("abort",A,!0)})}const{timeout:U}=a;if(U){const A=setTimeout(()=>{r(new Gt(U))},U);g.push(()=>{clearTimeout(A)})}try{const A=()=>{},O=i&&i(o,r,{abortSignal:F.signal,get isRejected(){return p()},get isResolved(){return h()},on(L,G){if(c||l){if(L==="finalized"){const Oe=c?{kind:"resolved",result:c[0]}:{kind:"rejected",reason:l[0]};G(Oe)}else L==="resolved"&&c?G(c[0]):L==="rejected"&&l&&G(l[0]);return A}return f[L]||(f[L]=[]),f[L].push(G),()=>{const Oe=f[L]||[],xe=Oe.indexOf(G);xe>=0&&Oe.splice(xe,1)}},get result(){return c==null?void 0:c[0]},get rejectReason(){return l==null?void 0:l[0]},throwIfRejected(){if(l)throw l[0]}});O instanceof Promise&&O.catch(r)}catch(A){r(A)}}),Dn(this,"reject"),Dn(this,"resolve"),this.reject=r,this.resolve=o}static fn(e,n){return new qn(async(r,o,i)=>{try{r(await e(i))}catch(a){o(a)}},n)}static resolve(e){return this.fn(()=>e)}static reject(e){return new qn((n,r)=>{r(e)})}cancel(){this.reject(new Nn)}catch(e){return this.then(void 0,e)}finally(e){return Gn(super.finally(e),this)}then(e,n){return Gn(super.then(e,n),this)}};function zn(t){return t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function vi(t){return t.replace(/_[a-z]/g,e=>e[1].toUpperCase())}function yi(t){return Object.entries(t).reduce((e,[n,r])=>(e[vi(n)]=r,e),{})}function zt(t){const e=yi(t);for(const n in e){const r=e[n];r&&typeof r=="object"&&!(r instanceof Date)&&(e[n]=Array.isArray(r)?r.map(zt):zt(r))}return e}function Si(t){return t.replace(/_([a-z])/g,(e,n)=>`-${n.toLowerCase()}`)}function Jn(t){return`tapps/${t}`}function it(t,e){sessionStorage.setItem(Jn(t),JSON.stringify(e))}function Kn(t){const e=sessionStorage.getItem(Jn(t));try{return e?JSON.parse(e):void 0}catch{}}function ze(...t){const e=t.flat(1);return[e.push.bind(e),()=>{e.forEach(n=>{n()})}]}function Qn(t,e){e||(e={});const{textColor:n,bgColor:r,shouldLog:o}=e,i=o===void 0?!0:o,a=typeof i=="boolean"?()=>i:i,c=(l,p,...h)=>{if(p||a()){const f="font-weight:bold;padding:0 5px;border-radius:100px",[g,v,F]={log:["#0089c3","white","INFO"],error:["#ff0000F0","white","ERR"],warn:["#D38E15","white","WARN"]}[l];console[l](`%c${F} ${Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,timeZone:"UTC"}).format(new Date)}%c %c${t}`,`${f};background-color:${g};color:${v}`,"",`${f};${n?`color:${n};`:""}${r?`background-color:${r}`:""}`,...h)}};return[["log","forceLog"],["warn","forceWarn"],["error","forceError"]].reduce((l,[p,h])=>(l[p]=c.bind(void 0,p,!1),l[h]=c.bind(void 0,p,!0),l),{})}function Je(t){const e=n=>{throw n};return typeof t=="function"?Ge.resolve(d(t,tt(e,n=>n))()):d(t,le(e,n=>n))}function re(t){return Object.assign((...e)=>Je(t(...e)),t)}const Re=Object.assign((t,e)=>d(Ln(()=>new Ge((n,r,o)=>t(i=>n(E(i)),i=>n(P(i)),o),e),n=>n),pe(le(W,T))),{fn:(t,e)=>Re((n,r,o)=>{const i=t(o);d(typeof i=="function"?i:We(i),Yo(r,n))()},e)});var Fi=Object.defineProperty,Ci=(t,e,n)=>e in t?Fi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Jt=(t,e,n)=>Ci(t,typeof e!="symbol"?e+"":e,n);function Zn(t){return e=>e instanceof t}function J(t,e){const n=class extends Error{constructor(...i){const a=typeof e=="function"?e(...i):typeof e=="string"?[e]:e||[];super(...a),this.name=t}};Jt(n,"is",Zn(n));let r=n;return Object.defineProperty(r,"name",{value:t}),r}function at(t,e,n){const r=class extends J(t,n){constructor(...a){super(...a),Jt(this,"data"),this.data=e(...a)}};Jt(r,"is",Zn(r));let o=r;return Object.defineProperty(o,"name",{value:t}),o}function ki(t){const e=n=>{const r={};return new URLSearchParams(n).forEach((o,i)=>{const a=r[i];Array.isArray(a)?a.push(o):a===void 0?r[i]=o:r[i]=[a,o]}),fe(t,r)};return ae(ot([S(),Ht(URLSearchParams)]),rt(n=>{try{return e(n),!0}catch{return!1}},"The value doesn't match required schema"),he(e))}function Ei(t){return ae(S(),rt(e=>{try{return JSON.parse(e),!0}catch{return!1}},"Input is not a valid JSON value"),he(JSON.parse),t)}function ue(t){return ae(S(),Ei(t))}function Kt(t){return ae(ot([S(),Ht(URLSearchParams)]),ki(t))}function ut(t){return e=>t.test(e)}const Yn=ut(/^#[\da-f]{3}$/i),Xn=ut(/^#[\da-f]{4}$/i),Ke=ut(/^#[\da-f]{6}$/i),xn=ut(/^#[\da-f]{8}$/i);function er(t){return[Ke,xn,Yn,Xn].some(e=>e(t))}function tr(t){let e="#";for(let n=0;n<t.length-1;n+=1)e+=t[1+n].repeat(2);return e}function ct(t){const e=t.replace(/\s/g,"").toLowerCase();if(/^#[\da-f]{3}$/i.test(e))return E(tr(e.toLowerCase()+"f"));if(/^#[\da-f]{4}$/i.test(e))return E(tr(e.toLowerCase()));if(/^#[\da-f]{6}$/i.test(e))return E(e.toLowerCase()+"ff");if(/^#[\da-f]{8}$/i.test(e))return E(e.toLowerCase());const n=e.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||e.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(\d{1,3})\)$/);return n?E(n.slice(1).reduce((r,o)=>r+parseInt(o,10).toString(16).padStart(2,"0"),"#").padEnd(9,"f")):P(new Error(`Value "${t}" does not satisfy any of known RGB formats.`))}function nr(t){return d(ct(t),K(e=>e.slice(0,7)))}const qi=re(nr),Ai=re(ct);function Ii(){return N({id:we(),photo_url:B(S()),type:S(),title:S(),username:B(S())})}function rr(){return N({added_to_attachment_menu:B(Ce()),allows_write_to_pm:B(Ce()),first_name:S(),id:we(),is_bot:B(Ce()),is_premium:B(Ce()),last_name:B(S()),language_code:B(S()),photo_url:B(S()),username:B(S())})}function Bi(){return N({projectCode:S(),uid:S(),sessionId:S(),rootToken:S()})}function $i(){return N({auth_date:ae(S(),he(t=>new Date(Number(t)*1e3)),st()),can_send_after:B(ae(S(),he(Number),Lt())),chat:B(ue(Ii())),chat_type:B(S()),chat_instance:B(S()),hash:B(S()),query_id:B(S()),receiver:B(ue(rr())),start_param:B(S()),signature:B(S()),user:B(ue(rr())),auth:B(ue(Bi()))})}function sr(){return Kt($i())}function Qt(){return Dt(S(),ae(ot([S(),we()]),he(t=>typeof t=="number"?`#${(t&16777215).toString(16).padStart(6,"0")}`:t),rt(er)))}function Mi(){const t=B(ae(S(),he(e=>e==="1")));return N({vbWebAppBotInline:t,vbWebAppData:B(sr()),vbWebAppDefaultColors:B(ue(Qt())),vbWebAppFullscreen:t,vbWebAppPlatform:S(),vbWebAppShowSettings:t,vbWebAppStartParam:B(S()),vbWebAppThemeParams:ue(Qt()),vbWebAppVersion:S()})}function Pi(){return Kt(Mi())}function Zt(){return N({eventType:S(),eventData:B(Wt())})}function or(t){return Me(()=>fe(sr(),t),e=>e)}function lt(t){return Me(()=>fe(Pi(),t),e=>e)}const Ri=re(or),Yt=re(lt);function ir(t,e){return e||(e=(n,r)=>JSON.stringify(r)),new URLSearchParams(Object.entries(t).reduce((n,[r,o])=>(Array.isArray(o)?n.push(...o.map(i=>[r,String(i)])):o!=null&&n.push([r,o instanceof Date?(o.getTime()/1e3|0).toString():typeof o=="string"||typeof o=="number"?String(o):typeof o=="boolean"?o?"1":"0":e(r,o)]),n),[])).toString()}function ar(t){return ir(t)}function Xt(t){return ir(t,(e,n)=>e==="vbWebAppData"?ar(n):JSON.stringify(n))}function Ti(t){return{all:t=t||new Map,on:function(e,n){var r=t.get(e);r?r.push(n):t.set(e,[n])},off:function(e,n){var r=t.get(e);r&&(n?r.splice(r.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var r=t.get(e);r&&r.slice().map(function(o){o(n)}),(r=t.get("*"))&&r.slice().map(function(o){o(e,n)})}}}function ur(t){return Ot(N({VBotWebviewProxy:N({postEvent:jt()})}),t)}function xt(){try{return window.self!==window.top}catch{return!0}}class cr extends J("MethodUnsupportedError",(e,n)=>[`Method "${e}" is unsupported in Mini Apps version ${n}`]){}class lr extends J("MethodParameterUnsupportedError",(e,n,r)=>[`Parameter "${n}" of "${e}" method is unsupported in Mini Apps version ${r}`]){}class pr extends at("LaunchParamsRetrieveError",e=>({errors:e}),e=>[["Unable to retrieve launch parameters from any known source. You should pass correct parameters to Mini App","","Collected errors:",...e.map(({source:n,error:r})=>`Source: ${n} / ${r instanceof Error?r.message:String(r)}`)].join(`
2
- `)]){}class en extends J("InvalidLaunchParamsError",(e,n)=>[`Invalid value for launch params: ${e}`,{cause:n}]){}class tn extends J("UnknownEnvError"){}class dr extends J("InvokeCustomMethodError",e=>[`Server returned error: ${e}`]){}const hr="launchParams";function fr(t){return t.replace(/^[^?#]*[?#]/,"").replace(/[?#]/g,"&")}function Te(){return d(Qe(),Ro(lt))}const Li=re(Te);function nn(){return d(Qe(),K(t=>{const e=new URLSearchParams(t).get("vbWebAppData");return e?$e(e):Fe}))}function Vi(){return d(nn(),$o(t=>{throw t},t=>t),vt(()=>{},t=>t))}function Qe(){const t=[];for(const[e,n]of[[()=>fr(window.location.href),"window.location.href"],[()=>{const r=performance.getEntriesByType("navigation")[0];return r&&fr(r.name)},"performance navigation entries"],[()=>Kn(hr),"local storage"]]){const r=e();if(!r){t.push({source:n,error:new Error("Source is empty")});continue}const o=d(lt(r),Bo(i=>i,()=>!0));if(typeof o!="boolean"){t.push({source:n,error:o});continue}return it(hr,r),E(r)}return P(new pr(t))}const Oi=re(Qe);function rn(t,e){const n=new Map,r=Ti(),o=(i,a,c=!1)=>{const l=n.get(i)||new Map;n.set(i,l);const p=l.get(a)||[];l.set(a,p);const h=p.findIndex(f=>f[1]===c);if(h>=0&&(r.off(i,p[h][0]),p.splice(h,1),!p.length&&(l.delete(a),!l.size))){const f=n.size;n.delete(i),f&&!n.size&&e()}};return{on(i,a,c){!n.size&&t();const l=()=>{o(i,a,c)},p=(...g)=>{c&&l(),i==="*"?a({name:g[0],payload:g[1]}):a(...g)};r.on(i,p);const h=n.get(i)||new Map;n.set(i,h);const f=h.get(a)||[];return h.set(a,f),f.push([p,c||!1]),l},off:o,emit:r.emit,clear(){const i=n.size;r.all.clear(),n.clear(),i&&e()}}}function pt(t,e){window.dispatchEvent(new MessageEvent("message",{data:JSON.stringify({eventType:t,eventData:e}),source:window.parent}))}const sn=D(!1),_r=D("https://web.telegram.org"),ji=t=>{ce().log("Event received:",t)},br=C(sn);function Hi(t){t!==sn()&&(sn.set(t),(t?X:Ee)("*",ji))}const mr=C(_r);function Di(t){_r.set(t),ce().log("New target origin set",t)}const ke=D((...t)=>{window.parent.postMessage(...t)}),ce=D(Qn("Bridge",{bgColor:"#9147ff",textColor:"white",shouldLog:br}));function on(t,e,n){const r=[n],o=t[e];typeof o=="function"&&r.push(o);const i=(...c)=>{r.forEach(l=>l(...c))},a=Object.assign((...c)=>{i(...c)},{unwrap(){const{length:c}=r;if(c===1){delete t[e];return}if(c===2){vr(t,e,r[1]);return}r.unshift(1),vr(t,e,i)}});wr(t,e,()=>a,c=>r.push(c))}function gr(t,e){const n=t[e];wr(t,e,()=>n,r=>{Object.entries(r).forEach(([o,i])=>{n[o]=i})})}function wr(t,e,n,r){Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:n,set:r})}function vr(t,e,n){Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n})}const Wi={clipboard_text_received:N({req_id:S(),data:Pe(S())}),custom_method_invoked:N({req_id:S(),result:B(Wt()),error:B(S())}),popup_closed:Pe(N({button_id:Pe(S(),()=>{})}),{}),viewport_changed:Pe(N({height:we(),width:Pe(we(),()=>window.innerWidth),is_state_stable:Ce(),is_expanded:Ce()}),()=>({height:window.innerHeight,is_state_stable:!0,is_expanded:!0})),theme_changed:N({theme_params:Qt()})};function yr(t){if(t.source!==window.parent)return;let e;try{e=fe(ue(Zt()),t.data)}catch{return}const{eventType:n,eventData:r}=e,o=Wi[n];let i;try{i=o?fe(o,r):r}catch(a){return ce().forceError([`An error occurred processing the "${n}" event from the VBot application.`,"Please, file an issue here:","https://github.com/Telegram-Mini-Apps/tma.js/issues/new/choose"].join(`
3
- `),e,a)}Ui(n,i)}const{on:X,off:Ee,emit:Ui,clear:Ni}=rn(()=>{const t=window;!t.TelegramGameProxy&&(t.TelegramGameProxy={}),on(t.TelegramGameProxy,"receiveEvent",pt),gr(t,"TelegramGameProxy"),!t.VBot&&(t.VBot={}),!t.VBot.WebView&&(t.VBot.WebView={}),on(t.VBot.WebView,"receiveEvent",pt),gr(t.VBot,"WebView"),on(t,"TelegramGameProxy_receiveEvent",pt),window.addEventListener("message",yr)},()=>{[["TelegramGameProxy_receiveEvent"],["TelegramGameProxy","receiveEvent"],["VBot","WebView","receiveEvent"]].forEach(t=>{const e=window;let n=[void 0,e];for(const i of t)if(n=[n[1],n[1][i]],!n[1])return;const[r,o]=n;"unwrap"in o&&(o.unwrap(),r&&r!==e&&!Object.keys(r).length&&delete e[t[0]])}),window.removeEventListener("message",yr)}),Gi=(...t)=>ke()(...t);function zi(t,e){d(Le(t,e),Io(n=>{throw n}))}function Le(t,e){ce().log("Posting event:",e?{eventType:t,eventData:e}:{eventType:t});const n=window,r=JSON.stringify({eventType:t,eventData:e});return xt()?(Gi(r,mr()),E(void 0)):ur(n)?(n.VBotWebviewProxy.postEvent(t,JSON.stringify(e)),E(void 0)):Ot(N({external:N({notify:jt()})}),n)?(n.external.notify(r),E(void 0)):P(new tn)}function dt(t,e,n={}){const{capture:r=()=>!0,postEvent:o=Le}=n,i=D(),[a,c]=ze();(Array.isArray(e)?e:[e]).forEach(p=>{a(X(p,h=>{const f=Array.isArray(e);r(f?{event:p,payload:h}:h)&&i.set([f?{event:p,payload:h}:h])}))});const l=p=>(c(),p);return d(async()=>o(t,n.params),pe(()=>Re((p,h,f)=>{const g=i();if(g)return p(g[0]);const v=k=>{k&&p(k[0])},F=()=>{i.unsub(v)};i.sub(v),f.on("finalized",F)},n)),Ue(l,l))}function Ji(t,e){const n=an(t,e);return typeof n=="function"?Ge.fn(()=>Je(n)):n}function an(t,e){const n=ur(window);if(!t)return n||d(Qe(),le(()=>!1,()=>!0));if(n)return T(!0);const{timeout:r=100}=e||{};return d(dt("web_app_request_theme","theme_changed",{...e,timeout:r}),tt(o=>Gt.is(o)||tn.is(o)?E(!1):P(o),()=>E(!0)))}function Ki({launchParams:t,onEvent:e,resetPostMessage:n}={}){if(t){const i=typeof t=="string"||t instanceof URLSearchParams?t.toString():Xt({...t,vbWebAppData:void 0})+(t.vbWebAppData?`&vbWebAppData=${encodeURIComponent(t.vbWebAppData.toString())}`:"");try{Yt(i)}catch(a){throw new en(i,a)}it("launchParams",i)}if(xt()){if(!e)return;n&&ke.reset();const i=ke();ke.set((...a)=>{const[c]=a,l=()=>{i(...a)};try{const p=fe(ue(Zt()),c);e({name:p.eventType,params:p.eventData},l)}catch{l()}});return}const r=window.VBotWebviewProxy||{},o=r.postEvent||(()=>{});window.VBotWebviewProxy={...r,postEvent(i,a){const c=()=>{o(i,a)};e?e({name:i,params:a?JSON.parse(a):void 0},c):c()}},ce().log("Environment was mocked by the mockVBotEnv function")}function Qi({launchParams:t,onEvent:e,resetPostMessage:n}={}){if(t){const i=typeof t=="string"||t instanceof URLSearchParams?t.toString():Xt({...t,vbWebAppData:void 0})+(t.vbWebAppData?`&vbWebAppData=${encodeURIComponent(t.vbWebAppData.toString())}`:"");try{Yt(i)}catch(a){throw new en(i,a)}it("launchParams",i)}if(xt()){if(!e)return;n&&ke.reset();const i=ke();ke.set((...a)=>{const[c]=a,l=()=>{i(...a)};try{const p=fe(ue(Zt()),c);e({name:p.eventType,params:p.eventData},l)}catch{l()}});return}const r=window.VBotWebviewProxy||{},o=r.postEvent||(()=>{});window.VBotWebviewProxy={...r,postEvent(i,a){const c=()=>{o(i,a)};e?e({name:i,params:a?JSON.parse(a):void 0},c):c()}},ce().log("Launch params are injected by the setLaunchParams function")}function Zi(t,e="*"){const n=i=>{if(i.source===t.contentWindow)try{const a=JSON.parse(i.data),{eventType:c,eventData:l}=a;r.emit(c,l)}catch{}},r=rn(()=>{window.addEventListener("message",n)},()=>{window.removeEventListener("message",n)}),o={...r,send:(i,a)=>{if(t.contentWindow){const c=JSON.stringify({eventType:i,eventData:a});t.contentWindow.postMessage(c,e)}},clear:()=>{r.clear(),ve===o&&(ve=void 0)}};return ve=o,o}function Yi(){const t=rn(()=>{},()=>{}),e={...t,send:(n,r)=>{const o=JSON.stringify({eventType:n,eventData:r});window.postMessage(o,window.location.origin||"*")},clear:()=>{var n;t.clear(),ve===e&&(ve=void 0),(n=window.VBotWebviewProxy)!=null&&n.__isWebComponentProxy&&delete window.VBotWebviewProxy}};return window.VBotWebviewProxy={__isWebComponentProxy:!0,postEvent(n,r){let o;try{o=r?JSON.parse(r):void 0}catch{o=r}t.emit(n,o)}},ve=e,e}let ve;function _(){if(!ve)throw new Error("HostBridge not initialized. Call defineHostBridge() or defineWebComponentBridge() first.");return ve}function Sr(t){return({req_id:e})=>e===t}const Fr={"6.0":["iframe_ready","iframe_will_reload","web_app_close","web_app_data_send","web_app_expand","web_app_open_link","web_app_ready","web_app_request_theme","web_app_request_viewport","web_app_setup_main_button","web_app_setup_closing_behavior"],6.1:["web_app_open_tg_link","web_app_open_invoice","web_app_setup_back_button","web_app_set_background_color","web_app_set_header_color","web_app_trigger_haptic_feedback"],6.2:["web_app_open_popup"],6.4:["web_app_close_scan_qr_popup","web_app_open_scan_qr_popup","web_app_read_text_from_clipboard",{method:"web_app_open_link",param:"try_instant_view"}],6.7:["web_app_switch_inline_query"],6.9:["web_app_invoke_custom_method","web_app_request_write_access","web_app_request_phone",{method:"web_app_set_header_color",param:"color"}],"6.10":["web_app_setup_settings_button"],7.2:["web_app_biometry_get_info","web_app_biometry_open_settings","web_app_biometry_request_access","web_app_biometry_request_auth","web_app_biometry_update_token"],7.6:[{method:"web_app_open_link",param:"try_browser"},{method:"web_app_close",param:"return_back"}],7.7:["web_app_setup_swipe_behavior"],7.8:["web_app_share_to_story"],"7.10":["web_app_setup_secondary_button","web_app_set_bottom_bar_color",{method:"web_app_setup_main_button",param:"has_shine_effect"}],"8.0":["web_app_request_safe_area","web_app_request_content_safe_area","web_app_request_fullscreen","web_app_exit_fullscreen","web_app_set_emoji_status","web_app_add_to_home_screen","web_app_check_home_screen","web_app_request_emoji_status_access","web_app_check_location","web_app_open_location_settings","web_app_request_file_download","web_app_request_location","web_app_send_prepared_message","web_app_start_accelerometer","web_app_start_device_orientation","web_app_start_gyroscope","web_app_stop_accelerometer","web_app_stop_device_orientation","web_app_stop_gyroscope","web_app_toggle_orientation_lock"],"9.0":["web_app_device_storage_clear","web_app_device_storage_get_key","web_app_device_storage_save_key","web_app_secure_storage_clear","web_app_secure_storage_get_key","web_app_secure_storage_restore_key","web_app_secure_storage_save_key"],9.1:["web_app_hide_keyboard"],9.2:["web_app_send_notification","web_app_finish_refresh"]};function un(t,e){return Object.keys(Fr).find(n=>Fr[n].some(r=>e?typeof r=="object"&&r.method===t&&r.param===e:r===t))||null}function Cr(t){return t.split(".").map(Number)}function Xi(t,e){const n=Cr(t),r=Cr(e),o=Math.max(n.length,r.length);for(let i=0;i<o;i+=1){const a=n[i]||0,c=r[i]||0;if(a!==c)return a>c?1:-1}return 0}function _e(t,e,n){const r=n?un(t,e):un(t);return r?Xi(r,n||e)<=0:!1}function xi(t,e="strict"){const n=typeof e=="function"?e:r=>{const{method:o,version:i}=r,a="param"in r?new lr(o,r.param,i):new cr(o,i);if(e==="strict")throw a;return ce().forceWarn(a.message)};return((r,o)=>_e(r,t)?r==="web_app_set_header_color"&&Ot(N({color:On()}),o)&&!_e(r,"color",t)?n({version:t,method:r,param:"color"}):zi(r,o):n({version:t,method:r}))}function ea(t,e,n,r){return d(dt("web_app_invoke_custom_method","custom_method_invoked",{...r||{},params:{method:t,params:e,req_id:n},capture:Sr(n)}),ne(({result:o,error:i})=>i?W(new dr(i)):T(o)))}function ta(t,e,n={}){const{capture:r=()=>!0,postEvent:o=Le}=n,i=D(),[a,c]=ze();(Array.isArray(e)?e:[e]).forEach(p=>{a(X(p,h=>{(Array.isArray(e)?r({event:p,payload:h}):r(h))&&i.set([h])}))});const l=p=>(c(),p);return d(async()=>o(t,n.params),pe(()=>Re((p,h,f)=>{const g=i();if(g)return p(g[0]);const v=k=>{k&&p(k[0])},F=()=>{i.unsub(v)};i.sub(v),f.on("finalized",F)},n)),Ue(l,l))}function na(){Object.hasOwn||(Object.hasOwn=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)})}function cn(t){return Me(()=>decodeURIComponent(atob(t.replace(/-/g,"+").replace(/_/g,"/")).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")),e=>e)}const ra=re(cn);function ln(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,n)=>String.fromCharCode(parseInt(`0x${n}`)))).replace(/\+/g,"-").replace(/\//g,"_")}function kr(t){const e=ln(typeof t=="string"?t:JSON.stringify(t));return e.length>512?P(new Error("Value is too long for start parameter")):E(e)}const sa=re(kr);function oa(t,e){return Je(Er(t,typeof e=="function"?n=>Me(()=>e(n),r=>r):e))}function Er(t,e){return d(cn(t),To(n=>e?typeof e=="function"?e(n):Uo(n):E(n)))}function ia(t){return ln(t).length<=512}function se(t,e){return C(()=>_e(t,te(e)))}function b(t){return Object.assign(re(t),{ifAvailable(...e){return d(t.ifAvailable(...e),vt(()=>({ok:!1}),n=>({ok:!0,data:Je(n)})))}})}function qe(t){return[t]}class Ze extends at("ValidationError",(e,n)=>({input:e,issues:n}),"Validation error"){}class ht extends J("CSSVarsBoundError","CSS variables are already bound"){}class qr extends at("DeviceStorageMethodError",e=>({error:e}),e=>[e]){}class Ar extends at("SecureStorageMethodError",e=>({error:e}),e=>[e]){}class Ir extends J("NotAvailableError",qe){}class aa extends J("InvalidEnvError",qe){}class Br extends J("FunctionNotAvailableError",qe){}class oe extends J("InvalidArgumentsError",(e,n)=>[e,{cause:n}]){}class ft extends J("ConcurrentCallError",qe){}class $r extends J("SetEmojiStatusError",e=>[`Failed to set emoji status: ${e}`]){}class pn extends J("AccessDeniedError",qe){}class Mr extends J("FullscreenFailedError",qe){}class Pr extends J("ShareMessageError",qe){}class Rr extends J("UnknownThemeParamsKeyError",e=>[`Unknown theme params key passed: ${e}`]){}function V(t,e){const n=C(()=>te(e.version)||"100"),r=C(()=>te(e.isVBma)),{requires:o,returns:i}=e,a=o?typeof o=="object"?o:{every:[o]}:void 0,c=w=>{if(!e.supports)return!0;const y=e.supports[w];return _e(y.method,y.param,n())},l=()=>{if(!a)return;const[w,y]="every"in a?["every",a.every]:["some",a.some];for(let m=0;m<y.length;m++){const j=y[m],H=typeof j=="function"?j():_e(j,n())?void 0:`it is unsupported in Mini Apps version ${n()}`;if(H&&(w==="every"||m===y.length-1))return H}},p=(...w)=>{for(const y in e.supports)if(e.supports[y].shouldCheck(...w)&&!c(y))return`option ${y} is not supported in Mini Apps version ${n()}`},h=C(()=>!l()),f=C(()=>n()!=="0.0"),g=C(()=>e.isMounted?e.isMounted():!0),v=C(()=>r()&&f()&&h()&&g()),F=w=>{const y=new Br(w);return["task","promise"].includes(e.returns)?W(y):P(y)},k=(...w)=>i==="plain"?Me(()=>t(...w),y=>y):i==="promise"?Ln(()=>t(...w),y=>y):t(...w);return Object.assign((...w)=>{var H;const y="Unable to call function:";if(!r())return F(`${y} it can't be called outside Mini Apps`);if(!f())return F(`${y} the SDK was not initialized. Use the SDK init() function`);const m=l();if(m)return F(`${y} ${m}`);const j=p(...w);if(j)return F(`${y} ${j}`);if(!g()){const U=(H=e.isMounting)!=null&&H.call(e)?"mounting. Wait for the mount completion":"unmounted. Use the mount() method";return F(`${y} the component is ${U}`)}return k(...w)},t,{isAvailable:v,ifAvailable(...w){return v()?$e(k(...w)):Fe}},a?{isSupported:h}:{},e.supports?{supports:c}:{})}function M(t){return e=>V(e,t)}class _t{constructor({isVBma:e,storage:n,onClick:r,offClick:o,initialState:i,isPageReload:a,postEvent:c,payload:l,method:p,version:h}){s(this,"isMounted");s(this,"isSupported");s(this,"state");s(this,"stateSetters");s(this,"stateBoolSetters");s(this,"setStateFp");s(this,"setState");s(this,"onClickFp");s(this,"onClick");s(this,"offClickFp");s(this,"offClick");s(this,"mountFp");s(this,"mount");s(this,"unmount");const f=new ge({initialState:i,onChange(w){n.set(w)}}),g=new Ne({initialState:i,isPageReload:a,onMounted:f.setState,restoreState:n.get}),v={version:h,requires:p,isVBma:e},F=M({...v,returns:"plain"}),k=M({...v,returns:"either",isMounted:g.isMounted});this.isMounted=g.isMounted,this.isSupported=se(p,h),this.state=f.state,this.setStateFp=k(w=>{const y={...this.state(),...Bt(w)};return f.hasDiff(y)?d(c(p,l(y)),K(()=>{f.setState(y)})):E(void 0)}),this.setState=b(this.setStateFp),this.onClickFp=F(r),this.onClick=b(this.onClickFp),this.offClickFp=F(o),this.offClick=b(this.offClickFp),this.mountFp=F(()=>{const w=()=>{};return d(g.mount(),le(w,w))}),this.mount=b(this.mountFp),this.unmount=g.unmount,this.stateSetters=w=>{const y=k(m=>this.setStateFp({[w]:m}));return[b(y),y]},this.stateBoolSetters=w=>{const[,y]=this.stateSetters(w),m=k(()=>y(!1)),j=k(()=>y(!0));return[[b(m),m],[b(j),j]]}}stateGetter(e){return C(()=>this.state()[e])}}class Tr{constructor(e){s(this,"isVisible");s(this,"isMounted");s(this,"isSupported");s(this,"hideFp");s(this,"hide");s(this,"showFp");s(this,"show");s(this,"onClickFp");s(this,"onClick");s(this,"offClickFp");s(this,"offClick");s(this,"mountFp");s(this,"mount");s(this,"unmount");const n=new _t({...e,method:"web_app_setup_back_button",payload:r=>({is_visible:r.isVisible}),initialState:{isVisible:!1}});this.isVisible=n.stateGetter("isVisible"),this.isMounted=n.isMounted,this.isSupported=n.isSupported,[[this.hide,this.hideFp],[this.show,this.showFp]]=n.stateBoolSetters("isVisible"),this.onClick=n.onClick,this.onClickFp=n.onClickFp,this.offClick=n.offClick,this.offClickFp=n.offClickFp,this.mount=n.mount,this.mountFp=n.mountFp,this.unmount=n.unmount}}function q(){return{isVBma:C(()=>an())}}function Ve(t){return e=>({...e,...te(t)})}function Ye(t,e){return D(t,e)}const Lr=Ye(Le),Ae=(...t)=>Lr()(...t),Vr=(...t)=>Je(Ae(...t)),Q=Ve({postEvent:Ae});function ua(t){return{get:()=>Kn(t),set(e){it(t,e)}}}function ca(){return performance.getEntriesByType("navigation")[0]}function la(){const t=ca();return!!t&&t.type==="reload"}function ye(t){return Ve({storage:ua(t),isPageReload:la})}const dn=Ye("0.0"),$=Ve({version:dn});function hn(t,e){return{...d(q(),Q,$,ye(t)),onClick(n,r){return X(e,n,r)},offClick(n,r){Ee(e,n,r)}}}const pa=new Tr(hn("backButton","back_button_pressed"));class fn{constructor({initialState:e,onMounted:n,restoreState:r,onUnmounted:o,isPageReload:i}){s(this,"_isMounted",D(!1));s(this,"isMounted",C(this._isMounted));s(this,"mount");s(this,"unmount");this.mount=a=>{if(this._isMounted())return T(void 0);const c=te(i)?r():void 0;return d(c?T(c):e(a),I(l=>{this._isMounted()||et(()=>{this._isMounted.set(!0),n==null||n(l)})}))},this.unmount=()=>{this._isMounted()&&et(()=>{this._isMounted.set(!1),o==null||o()})}}}function Or(){return new Ir("Biometry is not available")}function _n(t){let e=!1,n=!1,r="",o=!1,i="",a=!1;return t.available&&(e=!0,n=t.token_saved,r=t.device_id,o=t.access_requested,i=t.type,a=t.access_granted),{available:e,tokenSaved:n,deviceId:r,type:i,accessGranted:a,accessRequested:o}}class jr{constructor({version:e,request:n,postEvent:r,storage:o,onInfoReceived:i,offInfoReceived:a,isVBma:c,isPageReload:l}){s(this,"isAvailable");s(this,"isSupported");s(this,"isMounted");s(this,"state");s(this,"authenticateFp");s(this,"authenticate");s(this,"openSettingsFp");s(this,"openSettings");s(this,"requestAccessFp");s(this,"requestAccess");s(this,"updateTokenFp");s(this,"updateToken");s(this,"mountFp");s(this,"mount");s(this,"unmount");const p=w=>{h.setState(_n(w))},h=new ge({initialState:{available:!1,type:"unknown",accessGranted:!1,accessRequested:!1,deviceId:"",tokenSaved:!1},onChange:o.set}),f=new fn({initialState(w){return d(n("web_app_biometry_get_info","biometry_info_received",w),I(_n))},isPageReload:l,onMounted(w){h.setState(w),i(p)},onUnmounted(){a(p)},restoreState:o.get}),g={version:e,requires:"web_app_biometry_request_auth",isVBma:c},v=M({...g,returns:"either"}),F=M({...g,returns:"task"}),k=M({...g,isMounted:f.isMounted,returns:"task"});this.isAvailable=h.getter("available"),this.isMounted=f.isMounted,this.isSupported=se("web_app_biometry_request_auth",e),this.state=h.state,this.unmount=f.unmount,this.mountFp=F(f.mount),this.authenticateFp=k(w=>this.isAvailable()?d(n("web_app_biometry_request_auth","biometry_auth_requested",{...w,params:{reason:((w||{}).reason||"").trim()}}),I(y=>(h.setState({token:y.token}),y))):W(Or())),this.openSettingsFp=v(()=>r("web_app_biometry_open_settings")),this.requestAccessFp=k(w=>d(n("web_app_biometry_request_access","biometry_info_received",{...w,params:{reason:((w||{}).reason||"").trim()}}),ne(y=>{const m=_n(y);return m.available?(h.setState(m),T(m.accessRequested)):W(Or())}))),this.updateTokenFp=k((w={})=>{var y;return d(n("web_app_biometry_update_token","biometry_token_updated",{...w,params:{token:w.token||"",reason:(y=w.reason)==null?void 0:y.trim()}}),I(m=>m.status))}),this.authenticate=b(this.authenticateFp),this.openSettings=b(this.openSettingsFp),this.requestAccess=b(this.requestAccessFp),this.updateToken=b(this.updateTokenFp),this.mount=b(this.mountFp)}}const Hr=(t,e,n)=>ta(t,e,{postEvent:Ae,...n}),bn=(t,e,n)=>dt(t,e,{postEvent:Ae,...n}),da=(...t)=>Ge.fn(()=>Hr(...t)()),ha=(...t)=>Ge.fn(()=>bn(...t)()),x=Ve({request:bn});function fa(){return new jr({...d(q(),Q,$,x,ye("biometry")),offInfoReceived(t){Ee("biometry_info_received",t)},onInfoReceived(t){return X("biometry_info_received",t)}})}const _a=fa();class Dr{constructor({postEvent:e,storage:n,isVBma:r,isPageReload:o}){s(this,"isConfirmationEnabled");s(this,"isMounted");s(this,"mountFp");s(this,"mount");s(this,"unmount");s(this,"disableConfirmationFp");s(this,"disableConfirmation");s(this,"enableConfirmationFp");s(this,"enableConfirmation");const i=new ge({initialState:{isConfirmationEnabled:!1},onChange(f){n.set(f)}}),a=new Ne({onMounted:i.setState,restoreState:n.get,initialState:{isConfirmationEnabled:!1},isPageReload:o}),c={requires:"web_app_setup_closing_behavior",isVBma:r},l=M({...c,returns:"plain"}),p=M({...c,returns:"either",isMounted:a.isMounted}),h=f=>f===this.isConfirmationEnabled()?E(void 0):(i.setState({isConfirmationEnabled:f}),e("web_app_setup_closing_behavior",{need_confirmation:f}));this.isConfirmationEnabled=i.getter("isConfirmationEnabled"),this.isMounted=a.isMounted,this.disableConfirmationFp=p(()=>h(!1)),this.enableConfirmationFp=p(()=>h(!0)),this.mountFp=l(()=>{const f=()=>{};return d(a.mount(),le(f,f))}),this.unmount=a.unmount,this.disableConfirmation=b(this.disableConfirmationFp),this.enableConfirmation=b(this.enableConfirmationFp),this.mount=b(this.mountFp)}}function ba(){return new Dr(d(q(),ye("closingBehavior"),Q))}const ma=ba();class Wr{constructor({version:e,isVBma:n,invokeCustomMethod:r}){s(this,"isSupported");s(this,"deleteItemFp");s(this,"deleteItem");s(this,"getItemFp");s(this,"getItem");s(this,"getItemsFp");s(this,"getItems");s(this,"getKeysFp");s(this,"getKeys");s(this,"setItemFp");s(this,"setItem");s(this,"clearFp");s(this,"clear");const o=M({version:e,requires:"web_app_invoke_custom_method",isVBma:n,returns:"task"});this.isSupported=se("web_app_invoke_custom_method",e),this.deleteItemFp=o((i,a)=>{const c=Array.isArray(i)?i:[i];return d(c.length?r("deleteStorageValues",{keys:c},a):T(void 0),I(()=>{}))}),this.getItemFp=o((i,a)=>d(this.getItemsFp([i],a),I(c=>c[i]||""))),this.getItemsFp=o((i,a)=>d(i.length?r("getStorageValues",{keys:i},a):T({}),I(c=>({...i.reduce((l,p)=>(l[p]="",l),{}),...fe(Dt(S(),S()),c)})))),this.getKeysFp=o(i=>d(r("getStorageKeys",{},i),I(a=>fe(jn(S()),a)))),this.setItemFp=o((i,a,c)=>d(r("saveStorageValue",{key:i,value:a},c),I(()=>{}))),this.clearFp=o(i=>d(this.getKeysFp(i),ne(this.deleteItemFp))),this.deleteItem=b(this.deleteItemFp),this.getItem=b(this.getItemFp),this.getItems=b(this.getItemsFp),this.getKeys=b(this.getKeysFp),this.setItem=b(this.setItemFp),this.clear=b(this.clearFp)}}const mn=Ye(0);function bt(){return mn.set(mn()+1),mn().toString()}function Ur(t,e,n){return ea(t,e,bt(),{...n||{},postEvent:Ae})}const gn=Ve({invokeCustomMethod:Ur});function ga(){return new Wr(d(q(),$,gn))}const wa=ga();class Nr{constructor({isVBma:e,request:n,version:r,createRequestId:o}){s(this,"getItemFp");s(this,"getItem");s(this,"setItemFp");s(this,"setItem");s(this,"deleteItemFp");s(this,"deleteItem");s(this,"clearFp");s(this,"clear");const i=M({version:r,requires:"web_app_device_storage_get_key",isVBma:e,returns:"task"}),a=(c,l,p)=>{const h=o();return d(n(c,["device_storage_failed",l],{params:{...p,req_id:h},capture:(f=>"payload"in f?f.payload.req_id===h:!0)}),ne(f=>f.event==="device_storage_failed"?W(new qr(f.payload.error||"UNKNOWN_ERROR")):T(f.payload)))};this.getItemFp=i(c=>d(a("web_app_device_storage_get_key","device_storage_key_received",{key:c}),I(l=>l.value))),this.setItemFp=i((c,l)=>d(a("web_app_device_storage_save_key","device_storage_key_saved",{key:c,value:l}),I(()=>{}))),this.deleteItemFp=i(c=>this.setItemFp(c,null)),this.clearFp=i(()=>d(a("web_app_device_storage_clear","device_storage_cleared",{}),I(()=>{}))),this.getItem=b(this.getItemFp),this.setItem=b(this.setItemFp),this.deleteItem=b(this.deleteItemFp),this.clear=b(this.clearFp)}}const Gr=Ve({createRequestId:bt});function va(){return new Nr(d(q(),$,x,Gr))}const ya=va();function Sa({request:t,...e}){return V(n=>d(t("web_app_request_emoji_status_access","emoji_status_access_requested",n),I(r=>r.status)),{...e,requires:"web_app_request_emoji_status_access",returns:"task"})}function Fa(){return Sa(d(q(),$,x))}const zr=Fa(),Ca=b(zr);function ka({request:t,...e}){return V((n,r)=>d(t("web_app_set_emoji_status",["emoji_status_set","emoji_status_failed"],{params:{custom_emoji_id:n,duration:(r||{}).duration},...r}),pe(o=>o.event==="emoji_status_failed"?W(new $r(o.payload.error)):T(void 0))),{...e,requires:"web_app_set_emoji_status",returns:"task"})}function Ea(){return ka(d(q(),x,$))}const Jr=Ea(),qa=b(Jr);class Kr{constructor({postEvent:e,isVBma:n,version:r}){s(this,"isSupported");s(this,"impactOccurredFp");s(this,"impactOccurred");s(this,"notificationOccurredFp");s(this,"notificationOccurred");s(this,"selectionChangedFp");s(this,"selectionChanged");const o="web_app_trigger_haptic_feedback",i=M({requires:o,isVBma:n,version:r,returns:"plain"});this.isSupported=se(o,r),this.impactOccurredFp=i(a=>e(o,{type:"impact",impact_style:a})),this.notificationOccurredFp=i(a=>e(o,{type:"notification",notification_type:a})),this.selectionChangedFp=i(()=>e(o,{type:"selection_change"})),this.impactOccurred=b(this.impactOccurredFp),this.notificationOccurred=b(this.notificationOccurredFp),this.selectionChanged=b(this.selectionChangedFp)}}function Aa(){return new Kr(d(q(),Q,$))}const Ia=Aa();function Ba({postEvent:t,...e}){return V(()=>t("web_app_add_to_home_screen"),{...e,requires:"web_app_add_to_home_screen",returns:"either"})}function $a(){return Ba(d(q(),$,Q))}const Qr=$a(),Ma=b(Qr);function Pa({request:t,...e}){return V(n=>d(t("web_app_check_home_screen","home_screen_checked",n),I(r=>r.status||"unknown")),{...e,requires:"web_app_check_home_screen",returns:"task"})}function Ra(){return Pa(d(q(),$,x))}const Zr=Ra(),Ta=b(Zr);class Yr{constructor({retrieveInitData:e}){s(this,"_state",D());s(this,"_raw",D());s(this,"state",C(this._state));s(this,"authDate",this.fromState("auth_date"));s(this,"canSendAfter",this.fromState("can_send_after"));s(this,"canSendAfterDate",C(()=>{const e=this.authDate(),n=this.canSendAfter();return n&&e?new Date(e.getTime()+n*1e3):void 0}));s(this,"chat",this.fromState("chat"));s(this,"chatType",this.fromState("chat_type"));s(this,"chatInstance",this.fromState("chat_instance"));s(this,"hash",this.fromState("hash"));s(this,"queryId",this.fromState("query_id"));s(this,"raw",C(this._raw));s(this,"receiver",this.fromState("receiver"));s(this,"signature",this.fromState("signature"));s(this,"startParam",this.fromState("start_param"));s(this,"auth",this.fromState("auth"));s(this,"user",this.fromState("user"));s(this,"restoreFp");s(this,"restore");this.restoreFp=()=>d(e(),K(vt(()=>{},({raw:n,obj:r})=>{this._state.set(r),this._raw.set(n)}))),this.restore=re(this.restoreFp)}fromState(e){return C(()=>{const n=this._state();return n?n[e]:void 0})}}function La(){return new Yr({retrieveInitData(){return d(Mo,Pn("obj",()=>d(Te(),K(({vbWebAppData:t})=>t?$e(t):Fe))),Pn("raw",nn),K(({obj:t,raw:e})=>d(yo,$n("obj",()=>t),$n("raw",()=>e))))}})}const Va=La();class Xr{constructor({version:e,request:n,isVBma:r}){s(this,"isOpened");s(this,"isSupported");s(this,"openSlugFp");s(this,"openSlug");s(this,"openUrlFp");s(this,"openUrl");const o=M({version:e,isVBma:r,requires:"web_app_open_invoice",returns:"task"}),i=D(!1),a=()=>{i.set(!1)};this.isSupported=se("web_app_open_invoice",e),this.isOpened=C(i),this.openSlugFp=o((c,l)=>d(this.isOpened()?W(new ft("Invoice is already opened")):T(void 0),ne(()=>(i.set(!0),n("web_app_open_invoice","invoice_closed",{...l,params:{slug:c},capture:p=>c===p.slug}))),Ue(p=>(a(),p),p=>(a(),p.status)))),this.openUrlFp=o((c,l)=>{const{hostname:p,pathname:h}=new URL(c,window.location.href);if(p!=="t.me")return W(new oe(`Link has unexpected hostname: ${p}`));const f=h.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);return f?this.openSlugFp(f[2],l):W(new oe('Expected to receive a link with a pathname in format "/invoice/{slug}" or "/${slug}"'))}),this.openUrl=b(this.openUrlFp),this.openSlug=b(this.openSlugFp)}}function Oa(){return new Xr(d(q(),x,$))}const ja=Oa();function Ha({postEvent:t,...e}){return V((n,r={})=>{if(typeof n=="string")try{n=new URL(n)}catch(o){return P(new oe(`"${n.toString()}" is invalid URL`,o))}return t("web_app_open_link",{url:n.toString(),try_browser:r.tryBrowser,try_instant_view:r.tryInstantView})},{...e,returns:"either"})}function Da(){return Ha(d(q(),Q))}const xr=Da(),Wa=b(xr);function Ua({postEvent:t,version:e,...n}){return V(r=>{const o=r.toString();return o.match(/^https:\/\/t.me\/.+/)?_e("web_app_open_tg_link",te(e))?(r=new URL(r),t("web_app_open_tg_link",{path_full:r.pathname+r.search})):(window.location.href=o,E(void 0)):P(new oe(`"${o}" is invalid URL`))},{...n,returns:"either"})}function Na(){return Ua(d(q(),Q,$))}const wn=Na(),Ga=b(wn);function za({openVbotLink:t,...e}){return V((n,r)=>t("https://t.me/share/url?"+new URLSearchParams({url:n,text:r||""}).toString().replace(/\+/g,"%20")),{...e,returns:"either"})}function Ja(){return za({...q(),openVbotLink:wn})}const es=Ja(),Ka=b(es);function Qa(t){let e=!1,n,r;return t.available&&(e=!0,n=t.access_requested,r=t.access_granted),{available:e,accessGranted:r||!1,accessRequested:n||!1}}class ts{constructor({version:e,request:n,postEvent:r,storage:o,isVBma:i,isPageReload:a}){s(this,"state");s(this,"isAvailable");s(this,"isAccessGranted");s(this,"isAccessRequested");s(this,"isMounted");s(this,"isSupported");s(this,"openSettingsFp");s(this,"openSettings");s(this,"requestLocationFp");s(this,"requestLocation");s(this,"mountFp");s(this,"mount");s(this,"unmount");const c=new ge({initialState:{available:!1,accessGranted:!1,accessRequested:!1},onChange:o.set}),l=new fn({isPageReload:a,restoreState:o.get,onMounted:c.setState,initialState(v){return d(n("web_app_check_location","location_checked",v),I(Qa))}}),p={version:e,requires:"web_app_check_location",isVBma:i},h=M({...p,returns:"either"}),f=M({...p,returns:"task"}),g=M({...p,returns:"task",isMounted:l.isMounted});this.isAvailable=c.getter("available"),this.isAccessRequested=c.getter("accessRequested"),this.isAccessGranted=c.getter("accessGranted"),this.isSupported=se("web_app_check_location",e),this.isMounted=l.isMounted,this.state=c.state,this.unmount=l.unmount,this.mountFp=f(l.mount),this.openSettingsFp=h(()=>r("web_app_open_location_settings")),this.requestLocationFp=g(v=>d(n("web_app_request_location","location_requested",v),I(F=>{if(!F.available)return c.setState({available:!1}),null;const{available:k,...w}=F;return w}))),this.mount=b(this.mountFp),this.openSettings=b(this.openSettingsFp),this.requestLocation=b(this.requestLocationFp)}}function Za(){return new ts(d(q(),Q,$,x,ye("locationManager")))}const Ya=Za();class ns{constructor({defaults:e,...n}){s(this,"bgColor");s(this,"hasShineEffect");s(this,"isEnabled");s(this,"isLoaderVisible");s(this,"isVisible");s(this,"isMounted");s(this,"state");s(this,"text");s(this,"textColor");s(this,"showFp");s(this,"show");s(this,"hideFp");s(this,"hide");s(this,"enableFp");s(this,"enable");s(this,"enableShineEffectFp");s(this,"enableShineEffect");s(this,"disableFp");s(this,"disable");s(this,"disableShineEffectFp");s(this,"disableShineEffect");s(this,"setBgColorFp");s(this,"setBgColor");s(this,"setTextColorFp");s(this,"setTextColor");s(this,"setTextFp");s(this,"setText");s(this,"showLoaderFp");s(this,"showLoader");s(this,"hideLoaderFp");s(this,"hideLoader");s(this,"setParamsFp");s(this,"setParams");s(this,"mountFp");s(this,"mount");s(this,"unmount");s(this,"onClickFp");s(this,"onClick");s(this,"offClickFp");s(this,"offClick");const r=new _t({...n,version:"100",initialState:{hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Continue"},method:"web_app_setup_main_button",payload:i=>({has_shine_effect:i.hasShineEffect,is_visible:i.isVisible,is_active:i.isEnabled,is_progress_visible:i.isLoaderVisible,text:i.text,color:i.bgColor,text_color:i.textColor})}),o=(i,a)=>{const c=r.stateGetter(i);return C(()=>c()||te(a))};this.bgColor=o("bgColor",e.bgColor),this.textColor=o("textColor",e.textColor),this.hasShineEffect=r.stateGetter("hasShineEffect"),this.isEnabled=r.stateGetter("isEnabled"),this.isLoaderVisible=r.stateGetter("isLoaderVisible"),this.text=r.stateGetter("text"),this.isVisible=r.stateGetter("isVisible"),this.isMounted=r.isMounted,this.state=r.state,[this.setBgColor,this.setBgColorFp]=r.stateSetters("bgColor"),[this.setTextColor,this.setTextColorFp]=r.stateSetters("textColor"),[[this.disableShineEffect,this.disableShineEffectFp],[this.enableShineEffect,this.enableShineEffectFp]]=r.stateBoolSetters("hasShineEffect"),[[this.disable,this.disableFp],[this.enable,this.enableFp]]=r.stateBoolSetters("isEnabled"),[[this.hideLoader,this.hideLoaderFp],[this.showLoader,this.showLoaderFp]]=r.stateBoolSetters("isLoaderVisible"),[this.setText,this.setTextFp]=r.stateSetters("text"),[[this.hide,this.hideFp],[this.show,this.showFp]]=r.stateBoolSetters("isVisible"),this.setParams=r.setState,this.setParamsFp=r.setStateFp,this.onClick=r.onClick,this.onClickFp=r.onClickFp,this.offClick=r.offClick,this.offClickFp=r.offClickFp,this.mount=r.mount,this.mountFp=r.mountFp,this.unmount=r.unmount}}function vn(t,e){document.documentElement.style.setProperty(t,e)}function yn(t){document.documentElement.style.removeProperty(t)}function rs(t){return d(ct(t),K(e=>Math.sqrt([.299,.587,.114].reduce((n,r,o)=>{const i=parseInt(e.slice(1+o*2,1+(o+1)*2),16);return n+i*i*r},0))<120))}const Sn=re(rs);class ss{constructor({initialState:e,onChange:n,offChange:r,isVBma:o,storage:i,isPageReload:a}){s(this,"accentTextColor");s(this,"bgColor");s(this,"buttonColor");s(this,"buttonTextColor");s(this,"bottomBarBgColor");s(this,"destructiveTextColor");s(this,"headerBgColor");s(this,"hintColor");s(this,"linkColor");s(this,"secondaryBgColor");s(this,"sectionBgColor");s(this,"sectionHeaderTextColor");s(this,"sectionSeparatorColor");s(this,"subtitleTextColor");s(this,"textColor");s(this,"_isCssVarsBound",D(!1));s(this,"isCssVarsBound",C(this._isCssVarsBound));s(this,"bindCssVarsFp");s(this,"bindCssVars");s(this,"state");s(this,"isDark",C(()=>{const e=this.bgColor();return!e||Sn(e)}));s(this,"isMounted");s(this,"mountFp");s(this,"mount");s(this,"unmount");const c=new ge({initialState:{},onChange:i.set}),l=v=>{c.setState(v.theme_params)},p=new Ne({initialState:()=>E(te(e)),isPageReload:a,onMounted(v){c.setState(v),n(l)},onUnmounted(){r(l)},restoreState:i.get}),h={isVBma:o,returns:"either"},f=M(h),g=M({...h,isMounted:p.isMounted});this.accentTextColor=c.getter("accent_text_color"),this.bgColor=c.getter("bg_color"),this.buttonColor=c.getter("button_color"),this.buttonTextColor=c.getter("button_text_color"),this.bottomBarBgColor=c.getter("bottom_bar_bg_color"),this.destructiveTextColor=c.getter("destructive_text_color"),this.headerBgColor=c.getter("header_bg_color"),this.hintColor=c.getter("hint_color"),this.linkColor=c.getter("link_color"),this.secondaryBgColor=c.getter("secondary_bg_color"),this.sectionBgColor=c.getter("section_bg_color"),this.sectionHeaderTextColor=c.getter("section_header_text_color"),this.sectionSeparatorColor=c.getter("section_separator_color"),this.subtitleTextColor=c.getter("subtitle_text_color"),this.textColor=c.getter("text_color"),this.state=c.state,this.isMounted=p.isMounted,this.bindCssVarsFp=g(v=>{if(this._isCssVarsBound())return P(new ht);v||(v=w=>`--vb-theme-${Si(w)}`);const F=w=>{Object.entries(c.state()).forEach(([y,m])=>{m&&w(y,m)})},k=()=>{F((w,y)=>{vn(v(w),y)})};return k(),c.state.sub(k),this._isCssVarsBound.set(!0),E(()=>{F(yn),c.state.unsub(k),this._isCssVarsBound.set(!1)})}),this.mountFp=f(p.mount),this.unmount=p.unmount,this.bindCssVars=b(this.bindCssVarsFp),this.mount=b(this.mountFp)}}const Fn=Ye({});function Xa(){return new ss({...d(q(),ye("themeParams")),offChange(t){Ee("theme_changed",t)},onChange(t){X("theme_changed",t)},initialState:Fn})}const Xe=Xa();function os(t,e,n){return d(hn(t,e),r=>({...r,defaults:n}))}const xa=new ns(os("mainButton","main_button_pressed",{bgColor:C(()=>Xe.buttonColor()||"#2481cc"),textColor:C(()=>Xe.buttonTextColor()||"#ffffff")}));class is{constructor({storage:e,isPageReload:n,version:r,postEvent:o,isVBma:i,theme:a,onVisibilityChanged:c,offVisibilityChanged:l}){s(this,"isSupported");s(this,"isDark",C(()=>{const e=this.bgColorRgb();return e?Sn(e):!1}));s(this,"isActive");s(this,"state");s(this,"isCssVarsBound");s(this,"bindCssVarsFp");s(this,"bindCssVars");s(this,"isMounted");s(this,"mountFp");s(this,"mount");s(this,"unmount");s(this,"bgColor");s(this,"bgColorRgb");s(this,"setBgColorFp");s(this,"setBgColor");s(this,"headerColor");s(this,"headerColorRgb");s(this,"setHeaderColorFp");s(this,"setHeaderColor");s(this,"bottomBarColor");s(this,"bottomBarColorRgb");s(this,"setBottomBarColorFp");s(this,"setBottomBarColor");s(this,"closeFp");s(this,"close");s(this,"readyFp");s(this,"ready");const p=m=>{g.setState({isActive:m.is_visible})},h=m=>{[[this.headerColor,"web_app_set_header_color"],[this.bgColor,"web_app_set_background_color"],[this.bottomBarColor,"web_app_set_bottom_bar_color"]].forEach(([j,H])=>{const U=j();if(!Ke(U)&&(H!=="web_app_set_header_color"||!["bg_color","secondary_bg_color"].includes(U))){const A=m[U];A&&o(H,{color:A})}})},f=new Ne({initialState(){return E({bgColor:"bg_color",headerColor:"header_bg_color",bottomBarColor:"bottom_bar_bg_color",isActive:!0})},isPageReload:n,onMounted:m=>{c(p),a.sub(h),g.setState(m)},onUnmounted(){l(p),a.unsub(h)},restoreState:e.get});this.isMounted=f.isMounted,this.mountFp=V(()=>{const m=()=>{};return d(f.mount(),le(m,m))},{isVBma:i,returns:"plain"}),this.mount=b(this.mountFp),this.unmount=f.unmount;const g=new ge({initialState:{bgColor:"bg_color",bottomBarColor:"bottom_bar_bg_color",headerColor:"bg_color",isActive:!1},onChange:e.set});this.state=g.state;const v=m=>Ke(m)?m:te(a)[m],F=m=>C(()=>v(m()));this.isActive=g.getter("isActive"),this.isSupported=C(()=>["web_app_set_header_color","web_app_set_background_color","web_app_set_bottom_bar_color"].some(m=>_e(m,te(r))));const k=D(!1);this.isCssVarsBound=C(k),this.bindCssVarsFp=V(m=>{if(k())return P(new ht);const[j,H]=ze(()=>{k.set(!1)}),U=(A,O)=>{const L=()=>{vn(A,O()||null)};L(),j(O.sub(L),yn.bind(null,A))};return m||(m=A=>`--tg-${zn(A)}`),U(m("bgColor"),this.bgColorRgb),U(m("bottomBarColor"),this.bottomBarColorRgb),U(m("headerColor"),this.headerColorRgb),k.set(!0),E(H)},{isVBma:i,returns:"either",isMounted:this.isMounted}),this.bindCssVars=b(this.bindCssVarsFp);const w=m=>{const j=g.getter(m),H=F(j),U={headerColor:"web_app_set_header_color",bgColor:"web_app_set_background_color",bottomBarColor:"web_app_set_bottom_bar_color"}[m],A=V(O=>{if(O===j())return E(void 0);if(U==="web_app_set_header_color"&&(O==="bg_color"||O==="secondary_bg_color"))return d(o("web_app_set_header_color",{color_key:O}),K(()=>{g.setState({[m]:O})}));const L=v(O);return d(L?o(U,{color:L}):P(new Rr(O)),K(()=>{g.setState({[m]:O})}))},{isVBma:i,version:r,requires:U,isMounted:this.isMounted,returns:"either",supports:m==="headerColor"?{rgb:{method:"web_app_set_header_color",param:"color",shouldCheck:Ke}}:void 0});return[j,H,b(A),A]};[this.bgColor,this.bgColorRgb,this.setBgColor,this.setBgColorFp]=w("bgColor"),[this.headerColor,this.headerColorRgb,this.setHeaderColor,this.setHeaderColorFp]=w("headerColor"),[this.bottomBarColor,this.bottomBarColorRgb,this.setBottomBarColor,this.setBottomBarColorFp]=w("bottomBarColor");const y=M({isVBma:i,returns:"either"});this.closeFp=y(m=>o("web_app_close",{return_back:m})),this.close=b(this.closeFp),this.readyFp=y(()=>o("web_app_ready")),this.ready=b(this.readyFp)}}function eu(){return new is({...d(q(),Q,$,ye("miniApp")),offVisibilityChanged(t){Ee("visibility_changed",t)},onVisibilityChanged(t){X("visibility_changed",t)},theme:Xe.state})}const as=eu();function tu(){const t=Date.now(),e=Math.random().toString(36).substring(2,9);return`notif_${t}_${e}`}class us{constructor({version:e,isVBma:n}){s(this,"isSupported");s(this,"sendFp");s(this,"send");const r=M({version:e,isVBma:n,requires:"web_app_send_notification",returns:"task"});this.isSupported=se("web_app_send_notification",e),this.sendFp=r(o=>d(We(Le("web_app_send_notification",{id:tu(),message:o.message,title:o.title,type:o.type??"default"})),I(()=>{}))),this.send=o=>this.sendFp(o)().then(a=>{if(a._tag==="Left")throw a.left;return a.right})}}function nu(){return new us($(q()))}const ru=nu();function su(t){const e=t.message.trim(),n=(t.title||"").trim(),r=t.buttons||[];if(n.length>64)return P(new oe(`Invalid title: ${n}`));if(!e||e.length>256)return P(new oe(`Invalid message: ${e}`));if(r.length>3)return P(new oe(`Invalid buttons count: ${r.length}`));const o=[];if(!r.length)o.push({type:"close",id:""});else for(let i=0;i<r.length;i++){const a=r[i],c=a.id||"";if(c.length>64)return P(new oe(`Button with index ${i} has invalid id: ${c}`));if(!a.type||a.type==="default"||a.type==="destructive"){const l=a.text.trim();if(!l||l.length>64)return P(new oe(`Button with index ${i} has invalid text: ${l}`));o.push({type:a.type,text:l,id:c})}else o.push({type:a.type,id:c})}return E({title:n,message:e,buttons:o})}class cs{constructor({version:e,isVBma:n,request:r}){s(this,"isOpened");s(this,"isSupported");s(this,"showFp");s(this,"show");const o=D(!1),i=()=>{o.set(!1)},a=M({version:e,isVBma:n,requires:"web_app_open_popup",returns:"task"});this.isSupported=se("web_app_open_popup",e),this.isOpened=C(o),this.showFp=a(c=>d(this.isOpened()?W(new ft("A popup is already opened")):T(void 0),pe(()=>We(su(c))),ne(l=>(o.set(!0),r("web_app_open_popup","popup_closed",{...c,params:l}))),Ue(l=>(i(),l),l=>(i(),l.button_id)))),this.show=b(this.showFp)}}function ou(){return new cs(d(q(),x,$))}const iu=ou();function au({request:t,...e}){return V(n=>d(t("web_app_request_phone","phone_requested",n),I(r=>r.status)),{...e,requires:"web_app_request_phone",returns:"task"})}function uu(){return au(d(q(),$,x))}const Cn=uu(),cu=b(Cn);function lu({invokeCustomMethod:t,requestPhoneAccess:e,...n}){const r=a=>d(t("getRequestedContact",{},{...a,timeout:(a||{}).timeout||5e3}),pe(c=>{const l=Ut(S(),c);if(!l.success)return W(new Ze(c,l.issues));if(!l.output)return T(void 0);const p=Ut(Kt(N({contact:ue(N({user_id:we(),phone_number:S(),first_name:S(),last_name:B(S())})),auth_date:ae(S(),he(h=>new Date(Number(h)*1e3)),st()),hash:S()})),l.output);return p.success?T({raw:l.output,parsed:p.output}):W(new Ze(l.output,p.issues))})),o=a=>d(r(a),tt(c=>Ze.is(c)?P(c):E(void 0),c=>E(c))),i=a=>Re(async(c,l,p)=>{let h=50;for(;!p.isRejected;){const f=await o(p)();if(f._tag==="Left")return l(f.left);if(f.right)return c(f.right);await new Promise(g=>setTimeout(g,h)),h+=50}},a);return V(a=>Re.fn(c=>d(o(c),ne(l=>l?T(l):d(e(c),pe(p=>p==="sent"?i(c):W(new pn("User denied access")))))),a),{...n,returns:"task",requires:"web_app_request_phone"})}function pu(){return lu({...d(q(),gn,$),requestPhoneAccess:Cn})}function du({requestContact:t,...e}){return V(t,{...e,returns:"task",requires:"web_app_request_phone"})}function hu(){return du({...d(q(),$),requestContact(t){return d(kn(t),I(e=>e.parsed))}})}const kn=pu(),fu=b(kn),ls=hu(),_u=b(ls);function bu({request:t,...e}){return V(n=>d(t("web_app_request_write_access","write_access_requested",n),I(r=>r.status)),{...e,requires:"web_app_request_write_access",returns:"task"})}function mu(){return bu(d(q(),$,x))}const ps=mu(),gu=b(ps);class ds{constructor({version:e,onClosed:n,onTextReceived:r,isVBma:o,postEvent:i}){s(this,"isOpened");s(this,"isSupported");s(this,"captureFp");s(this,"capture");s(this,"closeFp");s(this,"close");s(this,"openFp");s(this,"open");const a={version:e,requires:"web_app_open_scan_qr_popup",isVBma:o},c=M({...a,returns:"either"}),l=M({...a,returns:"task"}),p=D(!1),h=()=>{p.set(!1)};this.isSupported=se("web_app_open_scan_qr_popup",e),this.isOpened=C(p),this.captureFp=l(f=>{let g;return d(this.openFp({...f,onCaptured:v=>{f.capture(v)&&(g=v,this.close())}}),I(()=>g))}),this.closeFp=c(()=>d(i("web_app_close_scan_qr_popup"),K(h))),this.openFp=l(f=>d(p()?W(new ft("The QR Scanner is already opened")):async()=>i("web_app_open_scan_qr_popup",{text:f.text}),pe(()=>{p.set(!0);const[g,v]=ze(),F=k=>(v(),p.set(!1),k);return d(Re(k=>{g(n(k),p.sub(w=>{w||k()}),r(f.onCaptured))},f),Ue(F,F))}))),this.open=b(this.openFp),this.capture=b(this.captureFp),this.close=b(this.closeFp)}}function wu(){return new ds({...d(q(),Q,$),onClosed(t){return X("scan_qr_popup_closed",t)},onTextReceived(t){return X("qr_text_received",e=>{t(e.data)})}})}const vu=wu();class hs{constructor({}){s(this,"isRefreshing");s(this,"finishRefreshFp");s(this,"finishRefresh");s(this,"onRefreshRequest");const e=D(!1);X("refresh_requested",()=>{e.set(!0)}),this.isRefreshing=C(e),this.finishRefreshFp=()=>d(We(Le("web_app_finish_refresh")),I(()=>{e.set(!1)})),this.finishRefresh=()=>this.finishRefreshFp()().then(r=>{if(r._tag==="Left")throw r.left;return r.right}),this.onRefreshRequest=n=>X("refresh_requested",()=>{n()})}}function yu(){return new hs(d(q()))}const Su=yu();class fs{constructor({defaults:e,...n}){s(this,"isSupported");s(this,"position");s(this,"bgColor");s(this,"hasShineEffect");s(this,"isEnabled");s(this,"isLoaderVisible");s(this,"isVisible");s(this,"isMounted");s(this,"state");s(this,"text");s(this,"textColor");s(this,"showFp");s(this,"show");s(this,"hideFp");s(this,"hide");s(this,"enableFp");s(this,"enable");s(this,"enableShineEffectFp");s(this,"enableShineEffect");s(this,"disableFp");s(this,"disable");s(this,"disableShineEffectFp");s(this,"disableShineEffect");s(this,"setBgColorFp");s(this,"setBgColor");s(this,"setTextColorFp");s(this,"setTextColor");s(this,"setTextFp");s(this,"setText");s(this,"setPositionFp");s(this,"setPosition");s(this,"showLoaderFp");s(this,"showLoader");s(this,"hideLoaderFp");s(this,"hideLoader");s(this,"setParamsFp");s(this,"setParams");s(this,"mountFp");s(this,"mount");s(this,"unmount");s(this,"onClickFp");s(this,"onClick");s(this,"offClickFp");s(this,"offClick");const r=new _t({...n,initialState:{hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Cancel",position:"left"},method:"web_app_setup_secondary_button",payload:i=>({has_shine_effect:i.hasShineEffect,is_visible:i.isVisible,is_active:i.isEnabled,is_progress_visible:i.isLoaderVisible,text:i.text,color:i.bgColor,text_color:i.textColor,position:i.position})}),o=(i,a)=>{const c=r.stateGetter(i);return C(()=>c()||te(a))};this.isSupported=se("web_app_setup_secondary_button",n.version),this.bgColor=o("bgColor",e.bgColor),this.textColor=o("textColor",e.textColor),this.position=r.stateGetter("position"),this.hasShineEffect=r.stateGetter("hasShineEffect"),this.isEnabled=r.stateGetter("isEnabled"),this.isLoaderVisible=r.stateGetter("isLoaderVisible"),this.text=r.stateGetter("text"),this.isVisible=r.stateGetter("isVisible"),this.isMounted=r.isMounted,this.state=r.state,[this.setPosition,this.setPositionFp]=r.stateSetters("position"),[this.setBgColor,this.setBgColorFp]=r.stateSetters("bgColor"),[this.setTextColor,this.setTextColorFp]=r.stateSetters("textColor"),[[this.disableShineEffect,this.disableShineEffectFp],[this.enableShineEffect,this.enableShineEffectFp]]=r.stateBoolSetters("hasShineEffect"),[[this.disable,this.disableFp],[this.enable,this.enableFp]]=r.stateBoolSetters("isEnabled"),[[this.hideLoader,this.hideLoaderFp],[this.showLoader,this.showLoaderFp]]=r.stateBoolSetters("isLoaderVisible"),[this.setText,this.setTextFp]=r.stateSetters("text"),[[this.hide,this.hideFp],[this.show,this.showFp]]=r.stateBoolSetters("isVisible"),this.setParams=r.setState,this.setParamsFp=r.setStateFp,this.onClick=r.onClick,this.onClickFp=r.onClickFp,this.offClick=r.offClick,this.offClickFp=r.offClickFp,this.mount=r.mount,this.mountFp=r.mountFp,this.unmount=r.unmount}}function Fu(){return new fs(os("secondaryButton","secondary_button_pressed",{bgColor:C(()=>as.bottomBarColorRgb()||"#000000"),textColor:C(()=>Xe.buttonColor()||"#2481cc")}))}const Cu=Fu();class _s{constructor({isVBma:e,request:n,version:r,createRequestId:o}){s(this,"getItemFp");s(this,"getItem");s(this,"restoreItemFp");s(this,"restoreItem");s(this,"setItemFp");s(this,"setItem");s(this,"deleteItemFp");s(this,"deleteItem");s(this,"clearFp");s(this,"clear");const i=M({version:r,requires:"web_app_secure_storage_get_key",isVBma:e,returns:"task"}),a=(c,l,p)=>{const h=o();return d(n(c,["secure_storage_failed",l],{params:{...p,req_id:h},capture:(f=>"payload"in f?f.payload.req_id===h:!0)}),ne(f=>f.event==="secure_storage_failed"?W(new Ar(f.payload.error||"UNKNOWN_ERROR")):T(f.payload)))};this.getItemFp=i(c=>d(a("web_app_secure_storage_get_key","secure_storage_key_received",{key:c}),I(l=>({value:l.value,canRestore:!!l.can_restore})))),this.setItemFp=i((c,l)=>d(a("web_app_secure_storage_save_key","secure_storage_key_saved",{key:c,value:l}),I(()=>{}))),this.deleteItemFp=i(c=>this.setItemFp(c,null)),this.clearFp=i(()=>d(a("web_app_secure_storage_clear","secure_storage_cleared",{}),I(()=>{}))),this.restoreItemFp=i(c=>d(a("web_app_secure_storage_restore_key","secure_storage_key_restored",{key:c}),I(l=>l.value))),this.getItem=b(this.getItemFp),this.setItem=b(this.setItemFp),this.deleteItem=b(this.deleteItemFp),this.clear=b(this.clearFp),this.restoreItem=b(this.restoreItemFp)}}function ku(){return new _s(d(q(),$,x,Gr))}const Eu=ku();class bs{constructor(e){s(this,"isVisible");s(this,"isMounted");s(this,"isSupported");s(this,"hideFp");s(this,"hide");s(this,"showFp");s(this,"show");s(this,"onClickFp");s(this,"onClick");s(this,"offClickFp");s(this,"offClick");s(this,"mountFp");s(this,"mount");s(this,"unmount");const n=new _t({...e,method:"web_app_setup_settings_button",payload:r=>({is_visible:r.isVisible}),initialState:{isVisible:!1}});this.isVisible=n.stateGetter("isVisible"),this.isMounted=n.isMounted,this.isSupported=n.isSupported,[[this.hide,this.hideFp],[this.show,this.showFp]]=n.stateBoolSetters("isVisible"),this.onClick=n.onClick,this.onClickFp=n.onClickFp,this.offClick=n.offClick,this.offClickFp=n.offClickFp,this.mount=n.mount,this.mountFp=n.mountFp,this.unmount=n.unmount}}const qu=new bs(hn("settingsButton","settings_button_pressed"));class ms{constructor({postEvent:e,storage:n,isVBma:r,isPageReload:o,version:i}){s(this,"isSupported");s(this,"isVerticalEnabled");s(this,"isMounted");s(this,"mountFp");s(this,"mount");s(this,"unmount");s(this,"disableVerticalFp");s(this,"disableVertical");s(this,"enableVerticalFp");s(this,"enableVertical");const a={isVerticalEnabled:!0},c=new ge({initialState:a,onChange(v){n.set(v)}}),l=new Ne({initialState:a,isPageReload:o,onMounted:c.setState,restoreState:n.get}),p={requires:"web_app_setup_swipe_behavior",isVBma:r,version:i},h=M({...p,returns:"plain"}),f=M({...p,isMounted:l.isMounted,returns:"either"}),g=v=>{const F={isVerticalEnabled:v};return c.hasDiff(F)?d(e("web_app_setup_swipe_behavior",{allow_vertical_swipe:v}),K(()=>{c.setState(F)})):E(void 0)};this.isSupported=se("web_app_setup_swipe_behavior",i),this.isVerticalEnabled=c.getter("isVerticalEnabled"),this.isMounted=l.isMounted,this.disableVerticalFp=f(()=>g(!1)),this.enableVerticalFp=f(()=>g(!0)),this.mountFp=h(()=>{const v=()=>{};return d(l.mount(),le(v,v))}),this.unmount=l.unmount,this.disableVertical=b(this.disableVerticalFp),this.enableVertical=b(this.enableVerticalFp),this.mount=b(this.mountFp)}}function Au(){return new ms(d(q(),Q,$,ye("swipeBehavior")))}const Iu=Au();async function Bu(t){try{const{clipboard:n}=navigator;if(n)return await n.writeText(t)}catch{}const e=document.createElement("textarea");e.value=t,e.style.top="0",e.style.left="0",e.style.position="fixed",document.body.appendChild(e),e.focus(),e.select();try{document.execCommand("copy")}finally{document.body.removeChild(e)}}function $u({request:t,...e}){return V((n,r,o)=>d(t("web_app_request_file_download","file_download_requested",{...o,params:{url:n,file_name:r}}),ne(i=>i.status==="downloading"?T(void 0):W(new pn("User denied the action")))),{...e,requires:"web_app_request_file_download",returns:"task"})}function Mu(){return $u(d(q(),x,$))}const gs=Mu(),Pu=b(gs);function Ru({invokeCustomMethod:t,...e}){return V(n=>d(t("getCurrentTime",{},n),ne(r=>{const o=Ut(ae(we(),Lt(),he(i=>new Date(i*1e3)),st()),r);return o.success?T(o.output):W(new Ze(r,o.issues))})),{...e,requires:"web_app_invoke_custom_method",returns:"task"})}function Tu(){return Ru(d(q(),gn,$))}const ws=Tu(),Lu=b(ws);function Vu({postEvent:t,...e}){return V(()=>t("web_app_hide_keyboard"),{...e,returns:"either",requires:"web_app_hide_keyboard"})}function Ou(){return Vu(d(q(),Q,$))}const vs=Ou(),ju=b(vs);function Hu({request:t,createRequestId:e,...n}){return V(r=>{const o=e();return d(t("web_app_read_text_from_clipboard","clipboard_text_received",{...r,params:{req_id:o},capture:Sr(o)}),I(({data:i=null})=>i))},{...n,requires:"web_app_read_text_from_clipboard",returns:"task"})}function Du(){return Hu({...d(q(),$,x),createRequestId:bt})}const ys=Du(),Wu=b(ys);function Ss(t){const e={},n=t.match(/Telegram-Android(?:\/([^ ]+))?(?: (\([^)]+\))?|$)/);if(n){const[,r,o]=n;r&&(e.appVersion=r),o&&o.slice(1,o.length-1).split(";").forEach(i=>{const[a,c]=i.trim().split(" ");if(a==="Android")e.androidVersion=c;else if(a==="SDK"){const l=parseInt(c,10);l&&(e.sdkVersion=l)}else c?(e.manufacturer=a,e.model=c):e.performanceClass=a})}return e}function Uu(){return Ss(navigator.userAgent)}function Nu({postEvent:t,...e}){return V(n=>{const{size:r}=new Blob([n]);return!r||r>4096?P(new oe(r?"Maximum size of data to send is 4096 bytes":"Attempted to send empty data")):t("web_app_data_send",{data:n})},{...e,returns:"either"})}function Gu(){return Nu(d(q(),Q))}const Fs=Gu(),zu=b(Fs);function Ju({request:t,...e}){return V((n,r)=>d(t("web_app_send_prepared_message",["prepared_message_failed","prepared_message_sent"],{...r,params:{id:n}}),ne(o=>o.event==="prepared_message_failed"?W(new Pr(o.payload.error)):T(void 0))),{...e,requires:"web_app_send_prepared_message",returns:"task"})}function Ku(){return Ju(d(q(),x,$))}const Cs=Ku(),Qu=b(Cs);function Zu({postEvent:t,...e}){return V((n,r={})=>t("web_app_share_to_story",{text:r.text,media_url:n,widget_link:r.widgetLink}),{...e,requires:"web_app_share_to_story",returns:"either"})}function Yu(){return Zu(d(q(),Q,$))}const ks=Yu(),Xu=b(ks),En=Ye(!1);function xu({isInlineMode:t,postEvent:e,...n}){return V((r,o)=>e("web_app_switch_inline_query",{query:r,chat_types:o||[]}),{...n,requires:{every:["web_app_switch_inline_query",()=>te(t)?void 0:"The application must be launched in the inline mode"]},returns:"either"})}function ec(){return xu({...d(q(),Q,$),isInlineMode:En})}const Es=ec(),tc=b(Es);class qs{constructor({storage:e,isPageReload:n,onContentSafeAreaInsetsChanged:r,onSafeAreaInsetsChanged:o,onViewportChanged:i,onFullscreenChanged:a,offContentSafeAreaInsetsChanged:c,offFullscreenChanged:l,offSafeAreaInsetsChanged:p,offViewportChanged:h,request:f,isViewportStable:g,isFullscreen:v,isVBma:F,version:k,postEvent:w}){s(this,"state");s(this,"height");s(this,"stableHeight");s(this,"width");s(this,"isExpanded");s(this,"isStable",C(()=>this.height()===this.stableHeight()));s(this,"contentSafeAreaInsets");s(this,"contentSafeAreaInsetTop");s(this,"contentSafeAreaInsetLeft");s(this,"contentSafeAreaInsetRight");s(this,"contentSafeAreaInsetBottom");s(this,"safeAreaInsets");s(this,"safeAreaInsetTop");s(this,"safeAreaInsetLeft");s(this,"safeAreaInsetRight");s(this,"safeAreaInsetBottom");s(this,"isFullscreen");s(this,"requestFullscreenFp");s(this,"requestFullscreen");s(this,"exitFullscreenFp");s(this,"exitFullscreen");s(this,"isCssVarsBound");s(this,"bindCssVarsFp");s(this,"bindCssVars");s(this,"isMounted");s(this,"mountFp");s(this,"mount");s(this,"expandFp");s(this,"expand");const y={top:0,right:0,left:0,bottom:0},m=new ge({initialState:{contentSafeAreaInsets:y,height:0,isExpanded:!1,isFullscreen:!1,safeAreaInsets:y,stableHeight:0,width:0},onChange:e.set}),j=R=>{m.setState({isExpanded:R.is_expanded,height:R.height,width:R.width,stableHeight:R.is_state_stable?R.height:void 0})},H=R=>{m.setState({isFullscreen:R.is_fullscreen})},U=R=>{m.setState({safeAreaInsets:R})},A=R=>{m.setState({contentSafeAreaInsets:R})},O=new fn({initialState(R){const Ie=be=>()=>{const[Se,ie]=be==="safe-area"?["web_app_request_safe_area","safe_area_changed"]:["web_app_request_content_safe_area","content_safe_area_changed"];return _e(Se,te(k))?f(Se,ie,R):T({top:0,left:0,right:0,bottom:0})},z=be=>()=>typeof be=="boolean"?T(be):We(be());return d(si,nt("safeAreaInsets",Ie("safe-area")),nt("contentSafeAreaInsets",Ie("content-safe-area")),nt("isFullscreen",z(v)),nt("isViewportStable",z(g)),pe(({isViewportStable:be,...Se})=>be?T({...Se,height:window.innerHeight,isExpanded:!0,stableHeight:window.innerHeight,width:window.innerWidth}):d(f("web_app_request_viewport","viewport_changed",R),I(ie=>({...Se,height:ie.height,isExpanded:ie.is_expanded,stableHeight:ie.is_state_stable?ie.height:0,width:ie.width})))))},isPageReload:n,onMounted(R){i(j),a(H),o(U),r(A),m.setState(R)},onUnmounted(){h(j),l(H),p(U),c(A)},restoreState:e.get}),L=R=>C(()=>this.safeAreaInsets()[R]),G=R=>C(()=>this.contentSafeAreaInsets()[R]);this.state=m.state,this.height=m.getter("height"),this.stableHeight=m.getter("stableHeight"),this.width=m.getter("width"),this.isExpanded=m.getter("isExpanded"),this.safeAreaInsets=m.getter("safeAreaInsets"),this.safeAreaInsetTop=L("top"),this.safeAreaInsetBottom=L("bottom"),this.safeAreaInsetLeft=L("left"),this.safeAreaInsetRight=L("right"),this.contentSafeAreaInsets=m.getter("contentSafeAreaInsets"),this.contentSafeAreaInsetTop=G("top"),this.contentSafeAreaInsetBottom=G("bottom"),this.contentSafeAreaInsetLeft=G("left"),this.contentSafeAreaInsetRight=G("right");const Oe=M({isVBma:F,returns:"task"}),xe=M({isVBma:F,returns:"either"}),Mc=M({isVBma:F,requires:"web_app_request_fullscreen",version:k,returns:"task"}),to=R=>Mc(Ie=>d(f(R?"web_app_request_fullscreen":"web_app_exit_fullscreen",["fullscreen_changed","fullscreen_failed"],Ie),ne(z=>z.event==="fullscreen_failed"&&z.payload.error!=="ALREADY_FULLSCREEN"?W(new Mr(z.payload.error)):(m.setState({isFullscreen:"is_fullscreen"in z.payload?z.payload.is_fullscreen:!0}),T(void 0)))));this.isMounted=O.isMounted,this.mountFp=Oe(O.mount),this.mount=b(this.mountFp),this.isFullscreen=m.getter("isFullscreen"),this.requestFullscreenFp=to(!0),this.requestFullscreen=b(this.requestFullscreenFp),this.exitFullscreenFp=to(!1),this.exitFullscreen=b(this.exitFullscreenFp);const mt=D(!1);this.isCssVarsBound=C(mt),this.bindCssVarsFp=xe(R=>{if(mt())return P(new ht);R||(R=z=>`--vb-viewport-${zn(z)}`);const Ie=[["height",this.height],["stableHeight",this.stableHeight],["width",this.width],["safeAreaInsetTop",this.safeAreaInsetTop],["safeAreaInsetBottom",this.safeAreaInsetBottom],["safeAreaInsetLeft",this.safeAreaInsetLeft],["safeAreaInsetRight",this.safeAreaInsetRight],["contentSafeAreaInsetTop",this.contentSafeAreaInsetTop],["contentSafeAreaInsetBottom",this.contentSafeAreaInsetBottom],["contentSafeAreaInsetLeft",this.contentSafeAreaInsetLeft],["contentSafeAreaInsetRight",this.contentSafeAreaInsetRight]].reduce((z,[be,Se])=>{const ie=R(be);if(ie){const no=()=>{vn(ie,`${Se()}px`)};z.push({update:no,removeListener:Se.sub(no),cssVar:ie})}return z},[]);return Ie.forEach(z=>{z.update()}),mt.set(!0),E(()=>{Ie.forEach(z=>{z.removeListener(),yn(z.cssVar)}),mt.set(!1)})}),this.bindCssVars=b(this.bindCssVarsFp),this.expandFp=xe(()=>w("web_app_expand")),this.expand=b(this.expandFp)}}function nc(){const t=i=>({on:a=>{X(i,a)},off:a=>{Ee(i,a)}}),e=t("viewport_changed"),n=t("fullscreen_changed"),r=t("safe_area_changed"),o=t("content_safe_area_changed");return new qs({...d(q(),ye("viewport"),$,Q,x),isFullscreen(){return d(Te(),K(i=>!!i.vbWebAppFullscreen))},isViewportStable(){return d(Te(),K(i=>["macos","tdesktop","unigram","webk","weba","web"].includes(i.vbWebAppPlatform)))},offContentSafeAreaInsetsChanged:o.off,offFullscreenChanged:n.off,offSafeAreaInsetsChanged:r.off,offViewportChanged:e.off,onContentSafeAreaInsetsChanged:o.on,onFullscreenChanged:n.on,onSafeAreaInsetsChanged:r.on,onViewportChanged:e.on})}const rc=nc();class As{constructor({request:e}){s(this,"requestAccessFp");s(this,"requestAccess");s(this,"selectFile");s(this,"selectFiles");s(this,"selectFolder");this.requestAccessFp=n=>d(e("web_app_request_storage_access","storage_access_granted",{params:{access_type:n.accessType,multiple:n.multiple,accept:n.accept,max_file_size:n.maxFileSize,read_content:n.readContent}}),I(r=>({accessType:r.access_type,items:r.items.map(o=>({name:o.name,path:o.path,size:o.size,type:o.type,content:o.content,lastModified:o.last_modified}))}))),this.requestAccess=n=>this.requestAccessFp(n)().then(o=>{if(o._tag==="Left")throw o.left;return o.right}),this.selectFile=n=>this.requestAccess({accessType:"file",multiple:!1,...n}),this.selectFiles=n=>this.requestAccess({accessType:"file",multiple:!0,...n}),this.selectFolder=()=>this.requestAccess({accessType:"folder"})}}function sc(){return new As({request:dt})}const oc=sc();class Is{onSetup(e){return _().on("web_app_setup_back_button",r=>{r&&typeof r.is_visible=="boolean"&&e(r.is_visible)})}press(){_().send("back_button_pressed")}}const ic=new Is;class Bs{onSetup(e){return _().on("web_app_setup_main_button",r=>{r&&e(r)})}press(){_().send("main_button_pressed")}}const ac=new Bs;class $s{onSetup(e){return _().on("web_app_setup_secondary_button",r=>{r&&e(r)})}press(){_().send("secondary_button_pressed")}}const uc=new $s;class Ms{onSetup(e){return _().on("web_app_setup_settings_button",r=>{r&&e(r)})}press(){_().send("settings_button_pressed")}}const cc=new Ms;class Ps{onOpen(e){return _().on("web_app_open_popup",r=>{r&&e(r)})}close(e){_().send("popup_closed",{button_id:e})}}const lc=new Ps;class Rs{onExpand(e){return _().on("web_app_expand",()=>{e()})}onRequestContentSafeArea(e){return _().on("web_app_request_content_safe_area",()=>{e()})}onRequestSafeArea(e){return _().on("web_app_request_safe_area",()=>{e()})}onRequestViewport(e){return _().on("web_app_request_viewport",()=>{e()})}onToggleOrientationLock(e){return _().on("web_app_toggle_orientation_lock",r=>{r&&typeof r.locked=="boolean"&&e(r.locked)})}onRequestFullscreen(e){return _().on("web_app_request_fullscreen",()=>{e()})}setFullscreen(e){_().send("fullscreen_changed",{is_fullscreen:e})}setFullscreenFailed(e){_().send("fullscreen_failed",{error:e})}onExitFullscreen(e){return _().on("web_app_exit_fullscreen",()=>{e()})}setContentSafeArea(e){_().send("content_safe_area_changed",e)}setSafeArea(e){_().send("safe_area_changed",e)}setViewport(e){_().send("viewport_changed",e)}}const pc=new Rs;class Ts{onIframeReady(e){return _().on("iframe_ready",r=>{e(r||{})})}onIframeWillReload(e){return _().on("iframe_will_reload",()=>{e()})}onClose(e){return _().on("web_app_close",()=>{e()})}onHideKeyboard(e){return _().on("web_app_hide_keyboard",()=>{e()})}onReady(e){return _().on("web_app_ready",()=>{e()})}onRequestTheme(e){return _().on("web_app_request_theme",()=>{e()})}onBackgroundColorChange(e){return _().on("web_app_set_background_color",r=>{r&&typeof r.color=="string"&&e(r.color)})}onBottomBarColorChange(e){return _().on("web_app_set_bottom_bar_color",r=>{r&&r.color&&e(r.color)})}onHeaderColorChange(e){return _().on("web_app_set_header_color",r=>{r&&("color_key"in r&&r.color_key?e(r.color_key):"color"in r&&r.color&&e(r.color))})}reloadIframe(){_().send("reload_iframe")}setCustomStyle(e){_().send("set_custom_style",e)}setVisibility(e){_().send("visibility_changed",{is_visible:e})}}const dc=new Ts;class Ls{onHapticFeedback(e){return _().on("web_app_trigger_haptic_feedback",r=>{r&&e(r)})}}const hc=new Ls;class Vs{onGetInfo(e){return _().on("web_app_biometry_get_info",()=>{e()})}onOpenSettings(e){return _().on("web_app_biometry_open_settings",()=>{e()})}onRequestAccess(e){return _().on("web_app_biometry_request_access",r=>{e(r||{})})}onRequestAuth(e){return _().on("web_app_biometry_request_auth",r=>{e(r||{})})}onUpdateToken(e){return _().on("web_app_biometry_update_token",r=>{r&&e(r)})}setInfoReceived(e){_().send("biometry_info_received",e)}setAuthRequested(e){_().send("biometry_auth_requested",e)}setTokenUpdated(e){_().send("biometry_token_updated",e)}}const fc=new Vs;class Os{onOpenInvoice(e){return _().on("web_app_open_invoice",r=>{r&&e(r)})}setInvoiceClosed(e){_().send("invoice_closed",e)}}const _c=new Os;class js{onOpenPopup(e){return _().on("web_app_open_scan_qr_popup",r=>{e(r||{})})}onClosePopup(e){return _().on("web_app_close_scan_qr_popup",()=>{e()})}sendQrTextReceived(e){_().send("qr_text_received",e)}closePopup(){_().send("scan_qr_popup_closed")}}const bc=new js;class Hs{onCheckLocation(e){return _().on("web_app_check_location",()=>{e()})}onOpenLocationSettings(e){return _().on("web_app_open_location_settings",()=>{e()})}onRequestLocation(e){return _().on("web_app_request_location",()=>{e()})}setLocationChecked(e){_().send("location_checked",e)}setLocationRequested(e){_().send("location_requested",e)}}const mc=new Hs;class Ds{onOpenLink(e){return _().on("web_app_open_link",r=>{r&&e(r)})}onOpenTgLink(e){return _().on("web_app_open_tg_link",r=>{r&&e(r)})}}const gc=new Ds;class Ws{onRequestAccess(e){return _().on("web_app_request_emoji_status_access",()=>{e()})}onSetEmojiStatus(e){return _().on("web_app_set_emoji_status",r=>{r&&e(r)})}setAccessRequested(e){_().send("emoji_status_access_requested",e)}setEmojiStatusSet(e){_().send("emoji_status_set",e)}setEmojiStatusFailed(e){_().send("emoji_status_failed",e)}}const wc=new Ws;class Us{onAddToHomeScreen(e){return _().on("web_app_add_to_home_screen",()=>{e()})}onCheckHomeScreen(e){return _().on("web_app_check_home_screen",()=>{e()})}setHomeScreenChecked(e){_().send("home_screen_checked",e)}setHomeScreenAdded(){_().send("home_screen_added")}setHomeScreenFailed(e){_().send("home_screen_failed",e)}}const vc=new Us;class Ns{onRequestPhone(e){return _().on("web_app_request_phone",()=>{e()})}onRequestWriteAccess(e){return _().on("web_app_request_write_access",()=>{e()})}setPhoneRequested(e){_().send("phone_requested",e)}setWriteAccessRequested(e){_().send("write_access_requested",e)}}const yc=new Ns;class Gs{onSetupClosingBehavior(e){return _().on("web_app_setup_closing_behavior",r=>{r&&e(r)})}}const Sc=new Gs;class zs{onSetupSwipeBehavior(e){return _().on("web_app_setup_swipe_behavior",r=>{r&&e(r)})}}const Fc=new zs;class Js{onReadText(e){return _().on("web_app_read_text_from_clipboard",r=>{r&&e(r)})}sendTextReceived(e){_().send("clipboard_text_received",e)}}const Cc=new Js;class Ks{onRequestFileDownload(e){return _().on("web_app_request_file_download",r=>{e(r||{})})}setFileDownloadRequested(e){_().send("file_download_requested",e)}}const kc=new Ks;class Qs{onSendPreparedMessage(e){return _().on("web_app_send_prepared_message",r=>{r&&e(r)})}onShareToStory(e){return _().on("web_app_share_to_story",r=>{e(r||{})})}setPreparedMessageFailed(e){_().send("prepared_message_failed",e)}setPreparedMessageSent(){_().send("prepared_message_sent")}}const Ec=new Qs;class Zs{onDataSend(e){return _().on("web_app_data_send",r=>{r&&e(r)})}onSwitchInlineQuery(e){return _().on("web_app_switch_inline_query",r=>{r&&e(r)})}}const qc=new Zs;class Ys{onInvokeCustomMethod(e){return _().on("web_app_invoke_custom_method",r=>{r&&e(r)})}setCustomMethodInvoked(e){_().send("custom_method_invoked",e)}}const Ac=new Ys;class Xs{onSend(e){return _().on("web_app_send_notification",r=>{r&&e(r)})}}const Ic=new Xs;class xs{setTheme(e){_().send("theme_changed",{theme_params:e})}onRequestTheme(e){return _().on("web_app_request_theme",()=>{e()})}}const Bc=new xs;function eo(t={}){const{version:e,isInlineMode:n,themeParams:r}=t;if(e&&typeof n=="boolean"&&r)dn.set(e),En.set(n),Fn.set(r);else{const c=d(Te(),Ct(l=>l,l=>{dn.set(e||l.vbWebAppVersion),En.set(typeof n=="boolean"?n:!!l.vbWebAppBotInline),Fn.set(r||l.vbWebAppThemeParams)}));if(c)return P(c)}t.postEvent&&Lr.set(t.postEvent);const[o,i]=ze(X("reload_iframe",()=>{ce().log("Received a request to reload the page"),Vr("iframe_will_reload"),window.location.reload()})),{acceptCustomStyles:a=!0}=t;if(a){const c=document.createElement("style");c.id="telegram-custom-styles",document.head.appendChild(c),o(X("set_custom_style",l=>{c.innerHTML=l}),()=>{document.head.removeChild(c)})}return d(Ae("iframe_ready",{reload_supported:!0}),K(()=>(ce().log("The package was initialized"),i)))}const $c=re(eo);return u.AccessDeniedError=pn,u.BackButton=Tr,u.Biometry=jr,u.CSSVarsBoundError=ht,u.CancelledError=Nn,u.ClosingBehavior=Dr,u.CloudStorage=Wr,u.ConcurrentCallError=ft,u.DeviceStorage=Nr,u.DeviceStorageMethodError=qr,u.FullscreenFailedError=Mr,u.FunctionUnavailableError=Br,u.HapticFeedback=Kr,u.HostBackButton=Is,u.HostBiometry=Vs,u.HostChat=Zs,u.HostClipboard=Js,u.HostClosingBehavior=Gs,u.HostCustomMethod=Ys,u.HostEmojiStatus=Ws,u.HostFiles=Ks,u.HostHapticFeedback=Ls,u.HostHomeScreen=Us,u.HostInvoice=Os,u.HostLink=Ds,u.HostLocationManager=Hs,u.HostMainButton=Bs,u.HostMiniApp=Ts,u.HostNotification=Xs,u.HostPopup=Ps,u.HostPrivacy=Ns,u.HostQrScanner=js,u.HostSecondaryButton=$s,u.HostSettingsButton=Ms,u.HostSharing=Qs,u.HostSwipeBehavior=zs,u.HostThemeParams=xs,u.HostViewport=Rs,u.InitData=Yr,u.InvalidArgumentsError=oe,u.InvalidEnvError=aa,u.InvalidLaunchParamsError=en,u.Invoice=Xr,u.InvokeCustomMethodFailedError=dr,u.LaunchParamsRetrieveError=pr,u.LocationManager=ts,u.MainButton=ns,u.MethodParameterUnsupportedError=lr,u.MethodUnsupportedError=cr,u.MiniApp=is,u.NotAvailableError=Ir,u.Notification=us,u.Popup=cs,u.QrScanner=ds,u.Refresh=hs,u.SecondaryButton=fs,u.SecureStorage=_s,u.SecureStorageMethodError=Ar,u.SetEmojiStatusError=$r,u.SettingsButton=bs,u.ShareMessageError=Pr,u.StoragePermission=As,u.SwipeBehavior=ms,u.ThemeParams=ss,u.TimeoutError=Gt,u.UnknownEnvError=tn,u.UnknownThemeParamsKeyError=Rr,u.ValidationError=Ze,u.Viewport=qs,u.addToHomeScreen=Ma,u.addToHomeScreenFp=Qr,u.applyPolyfills=na,u.backButton=pa,u.biometry=_a,u.checkHomeScreenStatus=Ta,u.checkHomeScreenStatusFp=Zr,u.closingBehavior=ma,u.cloudStorage=wa,u.copyTextToClipboard=Bu,u.createLogger=Qn,u.createPostEvent=xi,u.createRequestId=bt,u.createStartParam=sa,u.createStartParamFp=kr,u.debug=br,u.decodeBase64Url=ra,u.decodeBase64UrlFp=cn,u.decodeStartParam=oa,u.decodeStartParamFp=Er,u.deepSnakeToCamelObjKeys=zt,u.defineHostBridge=Zi,u.defineWebComponentBridge=Yi,u.deviceStorage=ya,u.downloadFile=Pu,u.downloadFileFp=gs,u.emitEvent=pt,u.encodeBase64Url=ln,u.getCurrentTime=Lu,u.getCurrentTimeFp=ws,u.getHostBridge=_,u.getReleaseVersion=un,u.hapticFeedback=Ia,u.hideKeyboard=ju,u.hideKeyboardFp=vs,u.hostBackButton=ic,u.hostBiometry=fc,u.hostChat=qc,u.hostClipboard=Cc,u.hostClosingBehavior=Sc,u.hostCustomMethod=Ac,u.hostEmojiStatus=wc,u.hostFiles=kc,u.hostHapticFeedback=hc,u.hostHomeScreen=vc,u.hostInvoice=_c,u.hostLink=gc,u.hostLocationManager=mc,u.hostMainButton=ac,u.hostMiniApp=dc,u.hostNotification=Ic,u.hostPopup=lc,u.hostPrivacy=yc,u.hostQrScanner=bc,u.hostSecondaryButton=uc,u.hostSettingsButton=cc,u.hostSharing=Ec,u.hostSwipeBehavior=Fc,u.hostThemeParams=Bc,u.hostViewport=pc,u.init=$c,u.initData=Va,u.initFp=eo,u.invoice=ja,u.invokeCustomMethod=Ur,u.isAnyRGB=er,u.isColorDark=Sn,u.isColorDarkFp=rs,u.isRGB=Ke,u.isRGBA=xn,u.isRGBAShort=Xn,u.isRGBShort=Yn,u.isSafeToCreateStartParam=ia,u.isVBma=Ji,u.isVBmaFp=an,u.locationManager=Ya,u.logger=ce,u.mainButton=xa,u.miniApp=as,u.mockVBotEnv=Ki,u.notification=ru,u.off=Ee,u.offAll=Ni,u.on=X,u.openLink=Wa,u.openLinkFp=xr,u.openVBotLink=Ga,u.openVBotLinkFp=wn,u.parseInitDataQuery=Ri,u.parseInitDataQueryFp=or,u.parseLaunchParamsQuery=Yt,u.parseLaunchParamsQueryFp=lt,u.popup=iu,u.postEvent=Vr,u.postEventFp=Ae,u.qrScanner=vu,u.readTextFromClipboard=Wu,u.readTextFromClipboardFp=ys,u.refresh=Su,u.request=da,u.request2=ha,u.request2Fp=bn,u.requestContact=_u,u.requestContactComplete=fu,u.requestContactCompleteFp=kn,u.requestContactFp=ls,u.requestEmojiStatusAccess=Ca,u.requestEmojiStatusAccessFp=zr,u.requestFp=Hr,u.requestPhoneAccess=cu,u.requestPhoneAccessFp=Cn,u.requestWriteAccess=gu,u.requestWriteAccessFp=ps,u.retrieveAndroidDeviceData=Uu,u.retrieveAndroidDeviceDataFrom=Ss,u.retrieveLaunchParams=Li,u.retrieveLaunchParamsFp=Te,u.retrieveRawInitData=Vi,u.retrieveRawInitDataFp=nn,u.retrieveRawLaunchParams=Oi,u.retrieveRawLaunchParamsFp=Qe,u.secondaryButton=Cu,u.secureStorage=Eu,u.sendData=zu,u.sendDataFp=Fs,u.serializeInitDataQuery=ar,u.serializeLaunchParamsQuery=Xt,u.setDebug=Hi,u.setEmojiStatus=qa,u.setEmojiStatusFp=Jr,u.setLaunchParams=Qi,u.setTargetOrigin=Di,u.settingsButton=qu,u.shareMessage=Qu,u.shareMessageFp=Cs,u.shareStory=Xu,u.shareStoryFp=ks,u.shareURL=Ka,u.shareURLFp=es,u.storagePermission=oc,u.supports=_e,u.swipeBehavior=Iu,u.switchInlineQuery=tc,u.switchInlineQueryFp=Es,u.targetOrigin=mr,u.themeParams=Xe,u.toRGB=qi,u.toRGBFp=nr,u.toRGBFull=Ai,u.toRGBFullFp=ct,u.viewport=rc,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),u})({});
1
+ var Pc=Object.defineProperty;var Rc=(u,ee,Be)=>ee in u?Pc(u,ee,{enumerable:!0,configurable:!0,writable:!0,value:Be}):u[ee]=Be;var s=(u,ee,Be)=>Rc(u,typeof ee!="symbol"?ee+"":ee,Be);this.tmajs=this.tmajs||{};this.tmajs.sdk=(function(u){"use strict";let ee;function Be(t,e){ee?ee.set(t,e):e()}function tt(t){if(ee)return t();ee=new Map;try{t()}finally{ee.forEach(e=>e()),ee=void 0}}function D(t,e){e||(e={});const n=e.equals||Object.is;let r=[],o=t;const i=p=>{if(!n(o,p)){const h=o;o=p,Be(l,()=>{[...r].forEach(([f,g])=>{f(p,h),g&&c(f,!0)})})}};function a(p){const h=typeof p!="object"?{once:p}:p;return{once:h.once||!1,signal:h.signal||!1}}const c=(p,h)=>{const f=a(h),g=r.findIndex(([v,F])=>v===p&&F.once===f.once&&F.signal===f.signal);g>=0&&r.splice(g,1)},l=Object.assign(function(){return ro(l),o},{destroy(){r=[]},set:i,reset(){i(t)},sub(p,h){return r.push([p,a(h)]),()=>c(p,h)},unsub:c,unsubAll(){r=r.filter(p=>p[1].signal)}});return l}const je=[];function ro(t){je.length&&je[je.length-1].add(t)}function C(t,e){let n=new Set,r;function o(){return r||(r=D(a(),e))}function i(){o().set(a())}function a(){n.forEach(p=>{p.unsub(i,{signal:!0})});const c=new Set;let l;je.push(c);try{l=t()}finally{je.pop()}return c.forEach(p=>{p.sub(i,{signal:!0})}),n=c,l}return Object.assign(function(){return o()()},{destroy(){o().destroy()},sub(...c){return o().sub(...c)},unsub(...c){o().unsub(...c)},unsubAll(...c){o().unsubAll(...c)}})}var so=function(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))};function oo(t){return t}function An(t,e,n,r,o,i,a,c,l){switch(arguments.length){case 1:return t;case 2:return function(){return e(t.apply(this,arguments))};case 3:return function(){return n(e(t.apply(this,arguments)))};case 4:return function(){return r(n(e(t.apply(this,arguments))))};case 5:return function(){return o(r(n(e(t.apply(this,arguments)))))};case 6:return function(){return i(o(r(n(e(t.apply(this,arguments))))))};case 7:return function(){return a(i(o(r(n(e(t.apply(this,arguments)))))))};case 8:return function(){return c(a(i(o(r(n(e(t.apply(this,arguments))))))))};case 9:return function(){return l(c(a(i(o(r(n(e(t.apply(this,arguments)))))))))}}}function d(t,e,n,r,o,i,a,c,l){switch(arguments.length){case 1:return t;case 2:return e(t);case 3:return n(e(t));case 4:return r(n(e(t)));case 5:return o(r(n(e(t))));case 6:return i(o(r(n(e(t)))));case 7:return a(i(o(r(n(e(t))))));case 8:return c(a(i(o(r(n(e(t)))))));case 9:return l(c(a(i(o(r(n(e(t))))))));default:{for(var p=arguments[0],h=1;h<arguments.length;h++)p=arguments[h](p);return p}}}var He=function(t,e){var n=typeof t=="number"?function(r){return r.length>=t}:t;return function(){var r=Array.from(arguments);return n(arguments)?e.apply(this,r):function(o){return e.apply(void 0,so([o],r,!1))}}},io={_tag:"None"},ao=function(t){return{_tag:"Some",value:t}},uo=function(t){return t._tag==="Left"},In=function(t){return{_tag:"Left",left:t}},Bn=function(t){return{_tag:"Right",right:t}},gt={};function co(t,e){return function(n){return function(r){return t.ap(t.map(r,function(o){return function(i){return e.ap(o,i)}}),n)}}}function lo(t,e){return function(n){return function(r){return t.map(r,function(o){return e.map(o,n)})}}}function wt(t){return function(e,n){return function(r){return t.chain(r,function(o){return t.map(n(o),function(i){var a;return Object.assign({},o,(a={},a[e]=i,a))})})}}}var Fe=io,$e=ao,po=function(t,e){return d(t,_o(e))},ho=function(t,e){return d(t,mo(e))},fo="Option",_o=function(t){return function(e){return De(e)?Fe:$e(t(e.value))}},bo=$e,mo=function(t){return function(e){return De(e)||De(t)?Fe:$e(e.value(t.value))}},go=He(2,function(t,e){return De(t)?Fe:e(t.value)}),wo={URI:fo,map:po,ap:ho,chain:go},De=function(t){return t._tag==="None"},vo=function(t,e){return function(n){return De(n)?t():e(n.value)}},vt=vo,yo=bo(gt),$n=wt(wo),P=In,E=Bn,yt=He(2,function(t,e){return me(t)?t:e(t.right)}),St=function(t,e){return d(t,K(e))},Mn=function(t,e){return d(t,ko(e))},Ft="Either",K=function(t){return function(e){return me(e)?e:E(t(e.right))}},So={URI:Ft,map:St},Fo=E,Co=function(t){return function(e){return me(e)?e:me(t)?t:E(e.right(t.right))}},ko=Co,Eo={URI:Ft,map:St,ap:Mn},qo={URI:Ft,map:St,ap:Mn,chain:yt},Ao=function(t,e){return function(n){return me(n)?P(t(n.left)):E(e(n.right))}},Io=function(t){return function(e){return me(e)?P(t(e.left)):e}},me=uo,Ct=function(t,e){return function(n){return me(n)?t(n.left):e(n.right)}},Bo=Ct,le=Ct,$o=le,Me=function(t,e){try{return E(t())}catch(n){return P(e(n))}},Mo=Fo(gt),Po=wt(qo),Pn=Po,Ro=yt,Vo=yt;function Lo(t){return An(E,t.of)}function To(t){return An(P,t.of)}function Oo(t){return lo(t,So)}function jo(t){return co(t,Eo)}function Ho(t){return function(e,n){return t.chain(e,function(r){return me(r)?t.of(r):n(r.right)})}}function Do(t){return function(e,n,r){return t.map(e,Ao(n,r))}}function Wo(t){return function(e,n){return function(r){return t.map(r,le(e,n))}}}var Uo=function(t){return Me(function(){return JSON.parse(t)},oo)},kt=function(t,e){return d(t,No(e))},Rn=function(t,e){return d(t,Go(e))},No=function(t){return function(e){return function(){return Promise.resolve().then(e).then(t)}}},Go=function(t){return function(e){return function(){return Promise.all([Promise.resolve().then(e),Promise.resolve().then(t)]).then(function(n){var r=n[0],o=n[1];return r(o)})}}},Et=function(t){return function(){return Promise.resolve(t)}},zo=He(2,function(t,e){return function(){return Promise.resolve().then(t).then(function(n){return e(n)()})}}),qt="Task",At={URI:qt,map:kt},Vn={of:Et},Jo={URI:qt,map:kt,ap:Rn},Ko={URI:qt,map:kt,of:Et,ap:Rn,chain:zo},Qo=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function c(h){try{p(r.next(h))}catch(f){a(f)}}function l(h){try{p(r.throw(h))}catch(f){a(f)}}function p(h){h.done?i(h.value):o(h.value).then(c,l)}p((r=r.apply(t,e||[])).next())})},Zo=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(p){return function(h){return l([p,h])}}function l(p){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,p[0]&&(n=0)),n;)try{if(r=1,o&&(i=p[0]&2?o.return:p[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,p[1])).done)return i;switch(o=0,i&&(p=[p[0]&2,i.value]),p[0]){case 0:case 1:i=p;break;case 4:return n.label++,{value:p[1],done:!1};case 5:n.label++,o=p[1],p=[0];continue;case 7:p=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!i||p[1]>i[0]&&p[1]<i[3])){n.label=p[1];break}if(p[0]===6&&n.label<i[1]){n.label=i[1],i=p;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(p);break}i[2]&&n.ops.pop(),n.trys.pop();continue}p=e.call(t,n)}catch(h){p=[6,h],o=0}finally{r=i=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},W=To(Vn),V=Lo(Vn),We=Et,nt=Wo(At),Yo=nt,Ln=function(t,e){return function(){return Qo(void 0,void 0,void 0,function(){var n;return Zo(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t().then(Bn)];case 1:return[2,r.sent()];case 2:return n=r.sent(),[2,In(e(n))];case 3:return[2]}})})}},Xo=function(t,e){return d(t,I(e))},xo=function(t,e){return d(t,ei(e))},I=Oo(At),Ue=He(3,Do(At)),ei=jo(Jo),It=He(2,Ho(Ko)),ti=V,ni="TaskEither",ri={URI:ni,map:Xo,ap:xo,chain:It},si=ti(gt),oi=wt(ri),rt=oi,ne=It,pe=It;function te(t){return typeof t=="function"?t():t}class Ne{constructor({onMounted:e,restoreState:n,initialState:r,onUnmounted:o,isPageReload:i}){s(this,"_isMounted",D(!1));s(this,"isMounted",C(this._isMounted));s(this,"mount");s(this,"unmount");this.mount=()=>{if(this.isMounted())return E(void 0);const a=te(i)?n():void 0,c=a?E(a):typeof r=="function"?r():E(r);return d(c,K(l=>{tt(()=>{this._isMounted.set(!0),e==null||e(l)})}))},this.unmount=()=>{this._isMounted()&&tt(()=>{this._isMounted.set(!1),o==null||o()})}}}function Bt(t){const e={};for(const n in t){const r=t[n];r!==void 0&&(e[n]=r)}return e}function $t(t,e){const n=Object.keys(t),r=Object.keys(e);return n.length!==r.length?!1:n.every(o=>Object.prototype.hasOwnProperty.call(e,o)&&t[o]===e[o])}class ge{constructor({initialState:e,onChange:n}){s(this,"_state");s(this,"state");s(this,"setState",e=>{const n={...this.state(),...Bt(e)};$t(n,this.state())||this._state.set(n)});this._state=D(e,{equals:$t}),this.state=C(this._state),this.state.sub(n)}getter(e){return C(()=>this._state()[e])}hasDiff(e){return!$t({...this.state(),...Bt(e)},this.state())}}let de;function Mt(t){return{lang:(t==null?void 0:t.lang)??(de==null?void 0:de.lang),message:t==null?void 0:t.message,abortEarly:(t==null?void 0:t.abortEarly)??(de==null?void 0:de.abortEarly),abortPipeEarly:(t==null?void 0:t.abortPipeEarly)??(de==null?void 0:de.abortPipeEarly)}}let Pt;function ii(t){return Pt==null?void 0:Pt.get(t)}let Rt;function ai(t){return Rt==null?void 0:Rt.get(t)}let Vt;function ui(t,e){var n;return(n=Vt==null?void 0:Vt.get(t))==null?void 0:n.get(e)}function ci(t){var n,r;const e=typeof t;return e==="string"?`"${t}"`:e==="number"||e==="bigint"||e==="boolean"?`${t}`:e==="object"||e==="function"?(t&&((r=(n=Object.getPrototypeOf(t))==null?void 0:n.constructor)==null?void 0:r.name))??"null":e}function Z(t,e,n,r,o){const i=o&&"input"in o?o.input:n.value,a=(o==null?void 0:o.expected)??t.expects??null,c=(o==null?void 0:o.received)??ci(i),l={kind:t.kind,type:t.type,input:i,expected:a,received:c,message:`Invalid ${e}: ${a?`Expected ${a} but r`:"R"}eceived ${c}`,requirement:t.requirement,path:o==null?void 0:o.path,issues:o==null?void 0:o.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},p=t.kind==="schema",h=(o==null?void 0:o.message)??t.message??ui(t.reference,l.lang)??(p?ai(l.lang):null)??r.message??ii(l.lang);h!==void 0&&(l.message=typeof h=="function"?h(l):h),p&&(n.typed=!1),n.issues?n.issues.push(l):n.issues=[l]}function Y(t){return{version:1,vendor:"valibot",validate(e){return t["~run"]({value:e},Mt())}}}function Tn(t,e){return Object.hasOwn(t,e)&&e!=="__proto__"&&e!=="prototype"&&e!=="constructor"}function li(t,e){const n=[...new Set(t)];return n.length>1?`(${n.join(` ${e} `)})`:n[0]??"never"}var pi=class extends Error{constructor(t){super(t[0].message),this.name="ValiError",this.issues=t}};function st(t,e){return{kind:"validation",type:"check",reference:st,async:!1,expects:null,requirement:t,message:e,"~run"(n,r){return n.typed&&!this.requirement(n.value)&&Z(this,"input",n,r),n}}}function Lt(t){return{kind:"validation",type:"integer",reference:Lt,async:!1,expects:null,requirement:Number.isInteger,message:t,"~run"(e,n){return e.typed&&!this.requirement(e.value)&&Z(this,"integer",e,n),e}}}function he(t){return{kind:"transformation",type:"transform",reference:he,async:!1,operation:t,"~run"(e){return e.value=this.operation(e.value),e}}}function di(t,e,n){return typeof t.fallback=="function"?t.fallback(e,n):t.fallback}function Tt(t,e,n){return typeof t.default=="function"?t.default(e,n):t.default}function Ot(t,e){return!t["~run"]({value:e},{abortEarly:!0}).issues}function On(){return{kind:"schema",type:"any",reference:On,expects:"any",async:!1,get"~standard"(){return Y(this)},"~run"(t){return t.typed=!0,t}}}function jn(t,e){return{kind:"schema",type:"array",reference:jn,expects:"Array",async:!1,item:t,message:e,get"~standard"(){return Y(this)},"~run"(n,r){var i;const o=n.value;if(Array.isArray(o)){n.typed=!0,n.value=[];for(let a=0;a<o.length;a++){const c=o[a],l=this.item["~run"]({value:c},r);if(l.issues){const p={type:"array",origin:"value",input:o,key:a,value:c};for(const h of l.issues)h.path?h.path.unshift(p):h.path=[p],(i=n.issues)==null||i.push(h);if(n.issues||(n.issues=l.issues),r.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value.push(l.value)}}else Z(this,"type",n,r);return n}}}function Ce(t){return{kind:"schema",type:"boolean",reference:Ce,expects:"boolean",async:!1,message:t,get"~standard"(){return Y(this)},"~run"(e,n){return typeof e.value=="boolean"?e.typed=!0:Z(this,"type",e,n),e}}}function ot(t){return{kind:"schema",type:"date",reference:ot,expects:"Date",async:!1,message:t,get"~standard"(){return Y(this)},"~run"(e,n){return e.value instanceof Date?isNaN(e.value)?Z(this,"type",e,n,{received:'"Invalid Date"'}):e.typed=!0:Z(this,"type",e,n),e}}}function jt(t){return{kind:"schema",type:"function",reference:jt,expects:"Function",async:!1,message:t,get"~standard"(){return Y(this)},"~run"(e,n){return typeof e.value=="function"?e.typed=!0:Z(this,"type",e,n),e}}}function Ht(t,e){return{kind:"schema",type:"instance",reference:Ht,expects:t.name,async:!1,class:t,message:e,get"~standard"(){return Y(this)},"~run"(n,r){return n.value instanceof this.class?n.typed=!0:Z(this,"type",n,r),n}}}function N(t,e){return{kind:"schema",type:"loose_object",reference:N,expects:"Object",async:!1,entries:t,message:e,get"~standard"(){return Y(this)},"~run"(n,r){var i;const o=n.value;if(o&&typeof o=="object"){n.typed=!0,n.value={};for(const a in this.entries){const c=this.entries[a];if(a in o||(c.type==="exact_optional"||c.type==="optional"||c.type==="nullish")&&c.default!==void 0){const l=a in o?o[a]:Tt(c),p=c["~run"]({value:l},r);if(p.issues){const h={type:"object",origin:"value",input:o,key:a,value:l};for(const f of p.issues)f.path?f.path.unshift(h):f.path=[h],(i=n.issues)==null||i.push(f);if(n.issues||(n.issues=p.issues),r.abortEarly){n.typed=!1;break}}p.typed||(n.typed=!1),n.value[a]=p.value}else if(c.fallback!==void 0)n.value[a]=di(c);else if(c.type!=="exact_optional"&&c.type!=="optional"&&c.type!=="nullish"&&(Z(this,"key",n,r,{input:void 0,expected:`"${a}"`,path:[{type:"object",origin:"key",input:o,key:a,value:o[a]}]}),r.abortEarly))break}if(!n.issues||!r.abortEarly)for(const a in o)Tn(o,a)&&!(a in this.entries)&&(n.value[a]=o[a])}else Z(this,"type",n,r);return n}}}function Pe(t,e){return{kind:"schema",type:"nullish",reference:Pe,expects:`(${t.expects} | null | undefined)`,async:!1,wrapped:t,default:e,get"~standard"(){return Y(this)},"~run"(n,r){return(n.value===null||n.value===void 0)&&(this.default!==void 0&&(n.value=Tt(this,n,r)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function we(t){return{kind:"schema",type:"number",reference:we,expects:"number",async:!1,message:t,get"~standard"(){return Y(this)},"~run"(e,n){return typeof e.value=="number"&&!isNaN(e.value)?e.typed=!0:Z(this,"type",e,n),e}}}function B(t,e){return{kind:"schema",type:"optional",reference:B,expects:`(${t.expects} | undefined)`,async:!1,wrapped:t,default:e,get"~standard"(){return Y(this)},"~run"(n,r){return n.value===void 0&&(this.default!==void 0&&(n.value=Tt(this,n,r)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function Dt(t,e,n){return{kind:"schema",type:"record",reference:Dt,expects:"Object",async:!1,key:t,value:e,message:n,get"~standard"(){return Y(this)},"~run"(r,o){var a,c;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(const l in i)if(Tn(i,l)){const p=i[l],h=this.key["~run"]({value:l},o);if(h.issues){const g={type:"object",origin:"key",input:i,key:l,value:p};for(const v of h.issues)v.path=[g],(a=r.issues)==null||a.push(v);if(r.issues||(r.issues=h.issues),o.abortEarly){r.typed=!1;break}}const f=this.value["~run"]({value:p},o);if(f.issues){const g={type:"object",origin:"value",input:i,key:l,value:p};for(const v of f.issues)v.path?v.path.unshift(g):v.path=[g],(c=r.issues)==null||c.push(v);if(r.issues||(r.issues=f.issues),o.abortEarly){r.typed=!1;break}}(!h.typed||!f.typed)&&(r.typed=!1),h.typed&&(r.value[h.value]=f.value)}}else Z(this,"type",r,o);return r}}}function S(t){return{kind:"schema",type:"string",reference:S,expects:"string",async:!1,message:t,get"~standard"(){return Y(this)},"~run"(e,n){return typeof e.value=="string"?e.typed=!0:Z(this,"type",e,n),e}}}function Hn(t){let e;if(t)for(const n of t)e?e.push(...n.issues):e=n.issues;return e}function it(t,e){return{kind:"schema",type:"union",reference:it,expects:li(t.map(n=>n.expects),"|"),async:!1,options:t,message:e,get"~standard"(){return Y(this)},"~run"(n,r){let o,i,a;for(const c of this.options){const l=c["~run"]({value:n.value},r);if(l.typed)if(l.issues)i?i.push(l):i=[l];else{o=l;break}else a?a.push(l):a=[l]}if(o)return o;if(i){if(i.length===1)return i[0];Z(this,"type",n,r,{issues:Hn(i)}),n.typed=!0}else{if((a==null?void 0:a.length)===1)return a[0];Z(this,"type",n,r,{issues:Hn(a)})}return n}}}function Wt(){return{kind:"schema",type:"unknown",reference:Wt,expects:"unknown",async:!1,get"~standard"(){return Y(this)},"~run"(t){return t.typed=!0,t}}}function fe(t,e,n){const r=t["~run"]({value:e},Mt(n));if(r.issues)throw new pi(r.issues);return r.value}function ae(...t){return{...t[0],pipe:t,get"~standard"(){return Y(this)},"~run"(e,n){for(const r of t)if(r.kind!=="metadata"){if(e.issues&&(r.kind==="schema"||r.kind==="transformation")){e.typed=!1;break}(!e.issues||!n.abortEarly&&!n.abortPipeEarly)&&(e=r["~run"](e,n))}return e}}}function Ut(t,e,n){const r=t["~run"]({value:e},Mt(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}var hi=Object.defineProperty,fi=(t,e,n)=>e in t?hi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Dn=(t,e,n)=>fi(t,typeof e!="symbol"?e+"":e,n),_i=Object.defineProperty,bi=(t,e,n)=>e in t?_i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Nt=(t,e,n)=>bi(t,typeof e!="symbol"?e+"":e,n);function Wn(t){return e=>e instanceof t}function Un(t,e){const n=class extends Error{constructor(...o){const i=typeof e=="function"?e(...o):typeof e=="string"?[e]:e||[];super(...i),this.name=t}};Nt(n,"is",Wn(n));let r=n;return Object.defineProperty(r,"name",{value:t}),r}function mi(t,e,n){const r=class extends Un(t,n){constructor(...i){super(...i),Nt(this,"data"),this.data=e(...i)}};Nt(r,"is",Wn(r));let o=r;return Object.defineProperty(o,"name",{value:t}),o}let Nn=class extends Un("CancelledError","Promise was canceled"){},Gt=class extends mi("TimeoutError",e=>({timeout:e}),(e,n)=>[`Timeout reached: ${e}ms`,{cause:n}]){};const gi=Symbol("resolved");function wi(t){return{tag:gi,value:t}}function Gn(t,e){return t.reject=e.reject,t.resolve=e.resolve,t}let Ge=class qn extends Promise{constructor(e,n){let r,o,i,a;typeof e=="function"?(i=e,a=n||{}):a=e||{};let c,l;const p=()=>!!l,h=()=>!!c;let f={};const g=[],v=()=>{g.forEach(w=>w()),g.splice(0,g.length),f={}},F=new AbortController,k=()=>h()||p();super((w,y)=>{const{abortOnResolve:m=!0,abortOnReject:j=!0}=a;o=A=>{var O,L;k()||(w(A),c=[A],(O=f.resolved)==null||O.forEach(G=>G(A)),(L=f.finalized)==null||L.forEach(G=>G({kind:"resolved",result:A})),v(),m&&F.abort(wi(A)))},r=A=>{var O,L;k()||(y(A),l=[A],(O=f.rejected)==null||O.forEach(G=>G(A)),(L=f.finalized)==null||L.forEach(G=>G({kind:"rejected",reason:A})),v(),j&&F.abort(A))};const{abortSignal:H}=a;if(H){if(H.aborted)return r(H.reason);const A=()=>{r(H.reason)};H.addEventListener("abort",A,!0),g.push(()=>{H.removeEventListener("abort",A,!0)})}const{timeout:U}=a;if(U){const A=setTimeout(()=>{r(new Gt(U))},U);g.push(()=>{clearTimeout(A)})}try{const A=()=>{},O=i&&i(o,r,{abortSignal:F.signal,get isRejected(){return p()},get isResolved(){return h()},on(L,G){if(c||l){if(L==="finalized"){const Oe=c?{kind:"resolved",result:c[0]}:{kind:"rejected",reason:l[0]};G(Oe)}else L==="resolved"&&c?G(c[0]):L==="rejected"&&l&&G(l[0]);return A}return f[L]||(f[L]=[]),f[L].push(G),()=>{const Oe=f[L]||[],et=Oe.indexOf(G);et>=0&&Oe.splice(et,1)}},get result(){return c==null?void 0:c[0]},get rejectReason(){return l==null?void 0:l[0]},throwIfRejected(){if(l)throw l[0]}});O instanceof Promise&&O.catch(r)}catch(A){r(A)}}),Dn(this,"reject"),Dn(this,"resolve"),this.reject=r,this.resolve=o}static fn(e,n){return new qn(async(r,o,i)=>{try{r(await e(i))}catch(a){o(a)}},n)}static resolve(e){return this.fn(()=>e)}static reject(e){return new qn((n,r)=>{r(e)})}cancel(){this.reject(new Nn)}catch(e){return this.then(void 0,e)}finally(e){return Gn(super.finally(e),this)}then(e,n){return Gn(super.then(e,n),this)}};function zn(t){return t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function vi(t){return t.replace(/_[a-z]/g,e=>e[1].toUpperCase())}function yi(t){return Object.entries(t).reduce((e,[n,r])=>(e[vi(n)]=r,e),{})}function zt(t){const e=yi(t);for(const n in e){const r=e[n];r&&typeof r=="object"&&!(r instanceof Date)&&(e[n]=Array.isArray(r)?r.map(zt):zt(r))}return e}function Si(t){return t.replace(/_([a-z])/g,(e,n)=>`-${n.toLowerCase()}`)}function Jn(t){return`tapps/${t}`}function at(t,e){sessionStorage.setItem(Jn(t),JSON.stringify(e))}function Kn(t){const e=sessionStorage.getItem(Jn(t));try{return e?JSON.parse(e):void 0}catch{}}function ze(...t){const e=t.flat(1);return[e.push.bind(e),()=>{e.forEach(n=>{n()})}]}function Qn(t,e){e||(e={});const{textColor:n,bgColor:r,shouldLog:o}=e,i=o===void 0?!0:o,a=typeof i=="boolean"?()=>i:i,c=(l,p,...h)=>{if(p||a()){const f="font-weight:bold;padding:0 5px;border-radius:100px",[g,v,F]={log:["#0089c3","white","INFO"],error:["#ff0000F0","white","ERR"],warn:["#D38E15","white","WARN"]}[l];console[l](`%c${F} ${Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,timeZone:"UTC"}).format(new Date)}%c %c${t}`,`${f};background-color:${g};color:${v}`,"",`${f};${n?`color:${n};`:""}${r?`background-color:${r}`:""}`,...h)}};return[["log","forceLog"],["warn","forceWarn"],["error","forceError"]].reduce((l,[p,h])=>(l[p]=c.bind(void 0,p,!1),l[h]=c.bind(void 0,p,!0),l),{})}function Je(t){const e=n=>{throw n};return typeof t=="function"?Ge.resolve(d(t,nt(e,n=>n))()):d(t,le(e,n=>n))}function re(t){return Object.assign((...e)=>Je(t(...e)),t)}const Re=Object.assign((t,e)=>d(Ln(()=>new Ge((n,r,o)=>t(i=>n(E(i)),i=>n(P(i)),o),e),n=>n),pe(le(W,V))),{fn:(t,e)=>Re((n,r,o)=>{const i=t(o);d(typeof i=="function"?i:We(i),Yo(r,n))()},e)});var Fi=Object.defineProperty,Ci=(t,e,n)=>e in t?Fi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Jt=(t,e,n)=>Ci(t,typeof e!="symbol"?e+"":e,n);function Zn(t){return e=>e instanceof t}function J(t,e){const n=class extends Error{constructor(...i){const a=typeof e=="function"?e(...i):typeof e=="string"?[e]:e||[];super(...a),this.name=t}};Jt(n,"is",Zn(n));let r=n;return Object.defineProperty(r,"name",{value:t}),r}function ut(t,e,n){const r=class extends J(t,n){constructor(...a){super(...a),Jt(this,"data"),this.data=e(...a)}};Jt(r,"is",Zn(r));let o=r;return Object.defineProperty(o,"name",{value:t}),o}function ki(t){const e=n=>{const r={};return new URLSearchParams(n).forEach((o,i)=>{const a=r[i];Array.isArray(a)?a.push(o):a===void 0?r[i]=o:r[i]=[a,o]}),fe(t,r)};return ae(it([S(),Ht(URLSearchParams)]),st(n=>{try{return e(n),!0}catch{return!1}},"The value doesn't match required schema"),he(e))}function Ei(t){return ae(S(),st(e=>{try{return JSON.parse(e),!0}catch{return!1}},"Input is not a valid JSON value"),he(JSON.parse),t)}function ue(t){return ae(S(),Ei(t))}function Kt(t){return ae(it([S(),Ht(URLSearchParams)]),ki(t))}function ct(t){return e=>t.test(e)}const Yn=ct(/^#[\da-f]{3}$/i),Xn=ct(/^#[\da-f]{4}$/i),Ke=ct(/^#[\da-f]{6}$/i),xn=ct(/^#[\da-f]{8}$/i);function er(t){return[Ke,xn,Yn,Xn].some(e=>e(t))}function tr(t){let e="#";for(let n=0;n<t.length-1;n+=1)e+=t[1+n].repeat(2);return e}function lt(t){const e=t.replace(/\s/g,"").toLowerCase();if(/^#[\da-f]{3}$/i.test(e))return E(tr(e.toLowerCase()+"f"));if(/^#[\da-f]{4}$/i.test(e))return E(tr(e.toLowerCase()));if(/^#[\da-f]{6}$/i.test(e))return E(e.toLowerCase()+"ff");if(/^#[\da-f]{8}$/i.test(e))return E(e.toLowerCase());const n=e.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||e.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(\d{1,3})\)$/);return n?E(n.slice(1).reduce((r,o)=>r+parseInt(o,10).toString(16).padStart(2,"0"),"#").padEnd(9,"f")):P(new Error(`Value "${t}" does not satisfy any of known RGB formats.`))}function nr(t){return d(lt(t),K(e=>e.slice(0,7)))}const qi=re(nr),Ai=re(lt);function Ii(){return N({id:we(),photo_url:B(S()),type:S(),title:S(),username:B(S())})}function rr(){return N({added_to_attachment_menu:B(Ce()),allows_write_to_pm:B(Ce()),first_name:S(),id:we(),is_bot:B(Ce()),is_premium:B(Ce()),last_name:B(S()),language_code:B(S()),photo_url:B(S()),username:B(S())})}function Bi(){return N({projectCode:S(),uid:S(),sessionId:S(),rootToken:S()})}function $i(){return N({auth_date:ae(S(),he(t=>new Date(Number(t)*1e3)),ot()),can_send_after:B(ae(S(),he(Number),Lt())),chat:B(ue(Ii())),chat_type:B(S()),chat_instance:B(S()),hash:B(S()),query_id:B(S()),receiver:B(ue(rr())),start_param:B(S()),signature:B(S()),user:B(ue(rr())),auth:B(ue(Bi()))})}function sr(){return Kt($i())}function Qt(){return Dt(S(),ae(it([S(),we()]),he(t=>typeof t=="number"?`#${(t&16777215).toString(16).padStart(6,"0")}`:t),st(er)))}function Mi(){const t=B(ae(S(),he(e=>e==="1")));return N({vbWebAppBotInline:t,vbWebAppData:B(sr()),vbWebAppDefaultColors:B(ue(Qt())),vbWebAppFullscreen:t,vbWebAppPlatform:S(),vbWebAppShowSettings:t,vbWebAppStartParam:B(S()),vbWebAppThemeParams:ue(Qt()),vbWebAppVersion:S()})}function Pi(){return Kt(Mi())}function Zt(){return N({eventType:S(),eventData:B(Wt())})}function or(t){return Me(()=>fe(sr(),t),e=>e)}function pt(t){return Me(()=>fe(Pi(),t),e=>e)}const Ri=re(or),Yt=re(pt);function ir(t,e){return e||(e=(n,r)=>JSON.stringify(r)),new URLSearchParams(Object.entries(t).reduce((n,[r,o])=>(Array.isArray(o)?n.push(...o.map(i=>[r,String(i)])):o!=null&&n.push([r,o instanceof Date?(o.getTime()/1e3|0).toString():typeof o=="string"||typeof o=="number"?String(o):typeof o=="boolean"?o?"1":"0":e(r,o)]),n),[])).toString()}function ar(t){return ir(t)}function Xt(t){return ir(t,(e,n)=>e==="vbWebAppData"?ar(n):JSON.stringify(n))}function Vi(t){return{all:t=t||new Map,on:function(e,n){var r=t.get(e);r?r.push(n):t.set(e,[n])},off:function(e,n){var r=t.get(e);r&&(n?r.splice(r.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var r=t.get(e);r&&r.slice().map(function(o){o(n)}),(r=t.get("*"))&&r.slice().map(function(o){o(e,n)})}}}function ur(t){return Ot(N({VBotWebviewProxy:N({postEvent:jt()})}),t)}function xt(){try{return window.self!==window.top}catch{return!0}}class cr extends J("MethodUnsupportedError",(e,n)=>[`Method "${e}" is unsupported in Mini Apps version ${n}`]){}class lr extends J("MethodParameterUnsupportedError",(e,n,r)=>[`Parameter "${n}" of "${e}" method is unsupported in Mini Apps version ${r}`]){}class pr extends ut("LaunchParamsRetrieveError",e=>({errors:e}),e=>[["Unable to retrieve launch parameters from any known source. You should pass correct parameters to Mini App","","Collected errors:",...e.map(({source:n,error:r})=>`Source: ${n} / ${r instanceof Error?r.message:String(r)}`)].join(`
2
+ `)]){}class en extends J("InvalidLaunchParamsError",(e,n)=>[`Invalid value for launch params: ${e}`,{cause:n}]){}class tn extends J("UnknownEnvError"){}class dr extends J("InvokeCustomMethodError",e=>[`Server returned error: ${e}`]){}const hr="launchParams";function fr(t){return t.replace(/^[^?#]*[?#]/,"").replace(/[?#]/g,"&")}function Ve(){return d(Qe(),Ro(pt))}const Li=re(Ve);function nn(){return d(Qe(),K(t=>{const e=new URLSearchParams(t).get("vbWebAppData");return e?$e(e):Fe}))}function Ti(){return d(nn(),$o(t=>{throw t},t=>t),vt(()=>{},t=>t))}function Qe(){const t=[];for(const[e,n]of[[()=>fr(window.location.href),"window.location.href"],[()=>{const r=performance.getEntriesByType("navigation")[0];return r&&fr(r.name)},"performance navigation entries"],[()=>Kn(hr),"local storage"]]){const r=e();if(!r){t.push({source:n,error:new Error("Source is empty")});continue}const o=d(pt(r),Bo(i=>i,()=>!0));if(typeof o!="boolean"){t.push({source:n,error:o});continue}return at(hr,r),E(r)}return P(new pr(t))}const Oi=re(Qe);function rn(t,e){const n=new Map,r=Vi(),o=(i,a,c=!1)=>{const l=n.get(i)||new Map;n.set(i,l);const p=l.get(a)||[];l.set(a,p);const h=p.findIndex(f=>f[1]===c);if(h>=0&&(r.off(i,p[h][0]),p.splice(h,1),!p.length&&(l.delete(a),!l.size))){const f=n.size;n.delete(i),f&&!n.size&&e()}};return{on(i,a,c){!n.size&&t();const l=()=>{o(i,a,c)},p=(...g)=>{c&&l(),i==="*"?a({name:g[0],payload:g[1]}):a(...g)};r.on(i,p);const h=n.get(i)||new Map;n.set(i,h);const f=h.get(a)||[];return h.set(a,f),f.push([p,c||!1]),l},off:o,emit:r.emit,clear(){const i=n.size;r.all.clear(),n.clear(),i&&e()}}}function Ze(t,e){window.dispatchEvent(new MessageEvent("message",{data:JSON.stringify({eventType:t,eventData:e}),source:window.parent}))}const sn=D(!1),_r=D("https://web.vbot.org"),ji=t=>{ce().log("Event received:",t)},br=C(sn);function Hi(t){t!==sn()&&(sn.set(t),(t?X:Ee)("*",ji))}const mr=C(_r);function Di(t){_r.set(t),ce().log("New target origin set",t)}const ke=D((...t)=>{window.parent.postMessage(...t)}),ce=D(Qn("Bridge",{bgColor:"#9147ff",textColor:"white",shouldLog:br}));function on(t,e,n){const r=[n],o=t[e];typeof o=="function"&&r.push(o);const i=(...c)=>{r.forEach(l=>l(...c))},a=Object.assign((...c)=>{i(...c)},{unwrap(){const{length:c}=r;if(c===1){delete t[e];return}if(c===2){vr(t,e,r[1]);return}r.unshift(1),vr(t,e,i)}});wr(t,e,()=>a,c=>r.push(c))}function gr(t,e){const n=t[e];wr(t,e,()=>n,r=>{Object.entries(r).forEach(([o,i])=>{n[o]=i})})}function wr(t,e,n,r){Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:n,set:r})}function vr(t,e,n){Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n})}const Wi={clipboard_text_received:N({req_id:S(),data:Pe(S())}),custom_method_invoked:N({req_id:S(),result:B(Wt()),error:B(S())}),popup_closed:Pe(N({button_id:Pe(S(),()=>{})}),{}),viewport_changed:Pe(N({height:we(),width:Pe(we(),()=>window.innerWidth),is_state_stable:Ce(),is_expanded:Ce()}),()=>({height:window.innerHeight,is_state_stable:!0,is_expanded:!0})),theme_changed:N({theme_params:Qt()})};function yr(t){if(t.source!==window.parent)return;let e;try{e=fe(ue(Zt()),t.data)}catch{return}const{eventType:n,eventData:r}=e,o=Wi[n];let i;try{i=o?fe(o,r):r}catch(a){return ce().forceError([`An error occurred processing the "${n}" event from the VBot application.`,"Please, file an issue here:"].join(`
3
+ `),e,a)}Ui(n,i)}const{on:X,off:Ee,emit:Ui,clear:Ni}=rn(()=>{const t=window;!t.VBotGameProxy&&(t.VBotGameProxy={}),on(t.VBotGameProxy,"receiveEvent",Ze),gr(t,"VBotGameProxy"),!t.VBot&&(t.VBot={}),!t.VBot.WebView&&(t.VBot.WebView={}),on(t.VBot.WebView,"receiveEvent",Ze),gr(t.VBot,"WebView"),on(t,"VBotGameProxy_receiveEvent",Ze),window.addEventListener("message",yr)},()=>{[["VBotGameProxy_receiveEvent"],["VBotGameProxy","receiveEvent"],["VBot","WebView","receiveEvent"]].forEach(t=>{const e=window;let n=[void 0,e];for(const i of t)if(n=[n[1],n[1][i]],!n[1])return;const[r,o]=n;"unwrap"in o&&(o.unwrap(),r&&r!==e&&!Object.keys(r).length&&delete e[t[0]])}),window.removeEventListener("message",yr)}),Gi=(...t)=>ke()(...t);function zi(t,e){d(Le(t,e),Io(n=>{throw n}))}function Le(t,e){ce().log("Posting event:",e?{eventType:t,eventData:e}:{eventType:t});const n=window,r=JSON.stringify({eventType:t,eventData:e});return xt()?(Gi(r,mr()),E(void 0)):ur(n)?(n.VBotWebviewProxy.postEvent(t,JSON.stringify(e)),E(void 0)):Ot(N({external:N({notify:jt()})}),n)?(n.external.notify(r),E(void 0)):P(new tn)}function dt(t,e,n={}){const{capture:r=()=>!0,postEvent:o=Le}=n,i=D(),[a,c]=ze();(Array.isArray(e)?e:[e]).forEach(p=>{a(X(p,h=>{const f=Array.isArray(e);r(f?{event:p,payload:h}:h)&&i.set([f?{event:p,payload:h}:h])}))});const l=p=>(c(),p);return d(async()=>o(t,n.params),pe(()=>Re((p,h,f)=>{const g=i();if(g)return p(g[0]);const v=k=>{k&&p(k[0])},F=()=>{i.unsub(v)};i.sub(v),f.on("finalized",F)},n)),Ue(l,l))}function Ji(t,e){const n=an(t,e);return typeof n=="function"?Ge.fn(()=>Je(n)):n}function an(t,e){const n=ur(window);if(!t)return n||d(Qe(),le(()=>!1,()=>!0));if(n)return V(!0);const{timeout:r=100}=e||{};return d(dt("web_app_request_theme","theme_changed",{...e,timeout:r}),nt(o=>Gt.is(o)||tn.is(o)?E(!1):P(o),()=>E(!0)))}function Ki({launchParams:t,onEvent:e,resetPostMessage:n}={}){if(t){const i=typeof t=="string"||t instanceof URLSearchParams?t.toString():Xt({...t,vbWebAppData:void 0})+(t.vbWebAppData?`&vbWebAppData=${encodeURIComponent(t.vbWebAppData.toString())}`:"");try{Yt(i)}catch(a){throw new en(i,a)}at("launchParams",i)}if(xt()){if(!e)return;n&&ke.reset();const i=ke();ke.set((...a)=>{const[c]=a,l=()=>{i(...a)};try{const p=fe(ue(Zt()),c);e({name:p.eventType,params:p.eventData},l)}catch{l()}});return}const r=window.VBotWebviewProxy||{},o=r.postEvent||(()=>{});window.VBotWebviewProxy={...r,postEvent(i,a){const c=()=>{o(i,a)};e?e({name:i,params:a?JSON.parse(a):void 0},c):c()}},ce().log("Environment was mocked by the mockVBotEnv function")}function Qi({launchParams:t,onEvent:e,resetPostMessage:n}={}){if(t){const i=typeof t=="string"||t instanceof URLSearchParams?t.toString():Xt({...t,vbWebAppData:void 0})+(t.vbWebAppData?`&vbWebAppData=${encodeURIComponent(t.vbWebAppData.toString())}`:"");try{Yt(i)}catch(a){throw new en(i,a)}at("launchParams",i)}if(xt()){if(!e)return;n&&ke.reset();const i=ke();ke.set((...a)=>{const[c]=a,l=()=>{i(...a)};try{const p=fe(ue(Zt()),c);e({name:p.eventType,params:p.eventData},l)}catch{l()}});return}const r=window.VBotWebviewProxy||{},o=r.postEvent||(()=>{});window.VBotWebviewProxy={...r,postEvent(i,a){const c=()=>{o(i,a)};e?e({name:i,params:a?JSON.parse(a):void 0},c):c()}},ce().log("Launch params are injected by the setLaunchParams function")}function Zi(t,e="*"){const n=i=>{if(i.source===t.contentWindow)try{const a=JSON.parse(i.data),{eventType:c,eventData:l}=a;r.emit(c,l)}catch{}},r=rn(()=>{window.addEventListener("message",n)},()=>{window.removeEventListener("message",n)}),o={...r,send:(i,a)=>{if(t.contentWindow){const c=JSON.stringify({eventType:i,eventData:a});t.contentWindow.postMessage(c,e)}},clear:()=>{r.clear(),ve===o&&(ve=void 0)}};return ve=o,o}function Yi(){const t=rn(()=>{},()=>{}),e={...t,send:(n,r)=>{Ze(n,r)},clear:()=>{var n;t.clear(),ve===e&&(ve=void 0),(n=window.VBotWebviewProxy)!=null&&n.__isWebComponentProxy&&delete window.VBotWebviewProxy}};return window.VBotWebviewProxy={__isWebComponentProxy:!0,postEvent(n,r){let o;try{o=r?JSON.parse(r):void 0}catch{o=r}t.emit(n,o)}},ve=e,e}let ve;function _(){if(!ve)throw new Error("HostBridge not initialized. Call defineHostBridge() or defineWebComponentBridge() first.");return ve}function Sr(t){return({req_id:e})=>e===t}const Fr={"6.0":["iframe_ready","iframe_will_reload","web_app_close","web_app_data_send","web_app_expand","web_app_open_link","web_app_ready","web_app_request_theme","web_app_request_viewport","web_app_setup_main_button","web_app_setup_closing_behavior"],6.1:["web_app_open_vb_link","web_app_open_invoice","web_app_setup_back_button","web_app_set_background_color","web_app_set_header_color","web_app_trigger_haptic_feedback"],6.2:["web_app_open_popup"],6.4:["web_app_close_scan_qr_popup","web_app_open_scan_qr_popup","web_app_read_text_from_clipboard",{method:"web_app_open_link",param:"try_instant_view"}],6.7:["web_app_switch_inline_query"],6.9:["web_app_invoke_custom_method","web_app_request_write_access","web_app_request_phone",{method:"web_app_set_header_color",param:"color"}],"6.10":["web_app_setup_settings_button"],7.2:["web_app_biometry_get_info","web_app_biometry_open_settings","web_app_biometry_request_access","web_app_biometry_request_auth","web_app_biometry_update_token"],7.6:[{method:"web_app_open_link",param:"try_browser"},{method:"web_app_close",param:"return_back"}],7.7:["web_app_setup_swipe_behavior"],7.8:["web_app_share_to_story"],"7.10":["web_app_setup_secondary_button","web_app_set_bottom_bar_color",{method:"web_app_setup_main_button",param:"has_shine_effect"}],"8.0":["web_app_request_safe_area","web_app_request_content_safe_area","web_app_request_fullscreen","web_app_exit_fullscreen","web_app_set_emoji_status","web_app_add_to_home_screen","web_app_check_home_screen","web_app_request_emoji_status_access","web_app_check_location","web_app_open_location_settings","web_app_request_file_download","web_app_request_location","web_app_send_prepared_message","web_app_start_accelerometer","web_app_start_device_orientation","web_app_start_gyroscope","web_app_stop_accelerometer","web_app_stop_device_orientation","web_app_stop_gyroscope","web_app_toggle_orientation_lock"],"9.0":["web_app_device_storage_clear","web_app_device_storage_get_key","web_app_device_storage_save_key","web_app_secure_storage_clear","web_app_secure_storage_get_key","web_app_secure_storage_restore_key","web_app_secure_storage_save_key"],9.1:["web_app_hide_keyboard"],9.2:["web_app_send_notification","web_app_finish_refresh"]};function un(t,e){return Object.keys(Fr).find(n=>Fr[n].some(r=>e?typeof r=="object"&&r.method===t&&r.param===e:r===t))||null}function Cr(t){return t.split(".").map(Number)}function Xi(t,e){const n=Cr(t),r=Cr(e),o=Math.max(n.length,r.length);for(let i=0;i<o;i+=1){const a=n[i]||0,c=r[i]||0;if(a!==c)return a>c?1:-1}return 0}function _e(t,e,n){const r=n?un(t,e):un(t);return r?Xi(r,n||e)<=0:!1}function xi(t,e="strict"){const n=typeof e=="function"?e:r=>{const{method:o,version:i}=r,a="param"in r?new lr(o,r.param,i):new cr(o,i);if(e==="strict")throw a;return ce().forceWarn(a.message)};return((r,o)=>_e(r,t)?r==="web_app_set_header_color"&&Ot(N({color:On()}),o)&&!_e(r,"color",t)?n({version:t,method:r,param:"color"}):zi(r,o):n({version:t,method:r}))}function ea(t,e,n,r){return d(dt("web_app_invoke_custom_method","custom_method_invoked",{...r||{},params:{method:t,params:e,req_id:n},capture:Sr(n)}),ne(({result:o,error:i})=>i?W(new dr(i)):V(o)))}function ta(t,e,n={}){const{capture:r=()=>!0,postEvent:o=Le}=n,i=D(),[a,c]=ze();(Array.isArray(e)?e:[e]).forEach(p=>{a(X(p,h=>{(Array.isArray(e)?r({event:p,payload:h}):r(h))&&i.set([h])}))});const l=p=>(c(),p);return d(async()=>o(t,n.params),pe(()=>Re((p,h,f)=>{const g=i();if(g)return p(g[0]);const v=k=>{k&&p(k[0])},F=()=>{i.unsub(v)};i.sub(v),f.on("finalized",F)},n)),Ue(l,l))}function na(){Object.hasOwn||(Object.hasOwn=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)})}function cn(t){return Me(()=>decodeURIComponent(atob(t.replace(/-/g,"+").replace(/_/g,"/")).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")),e=>e)}const ra=re(cn);function ln(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,n)=>String.fromCharCode(parseInt(`0x${n}`)))).replace(/\+/g,"-").replace(/\//g,"_")}function kr(t){const e=ln(typeof t=="string"?t:JSON.stringify(t));return e.length>512?P(new Error("Value is too long for start parameter")):E(e)}const sa=re(kr);function oa(t,e){return Je(Er(t,typeof e=="function"?n=>Me(()=>e(n),r=>r):e))}function Er(t,e){return d(cn(t),Vo(n=>e?typeof e=="function"?e(n):Uo(n):E(n)))}function ia(t){return ln(t).length<=512}function se(t,e){return C(()=>_e(t,te(e)))}function b(t){return Object.assign(re(t),{ifAvailable(...e){return d(t.ifAvailable(...e),vt(()=>({ok:!1}),n=>({ok:!0,data:Je(n)})))}})}function qe(t){return[t]}class Ye extends ut("ValidationError",(e,n)=>({input:e,issues:n}),"Validation error"){}class ht extends J("CSSVarsBoundError","CSS variables are already bound"){}class qr extends ut("DeviceStorageMethodError",e=>({error:e}),e=>[e]){}class Ar extends ut("SecureStorageMethodError",e=>({error:e}),e=>[e]){}class Ir extends J("NotAvailableError",qe){}class aa extends J("InvalidEnvError",qe){}class Br extends J("FunctionNotAvailableError",qe){}class oe extends J("InvalidArgumentsError",(e,n)=>[e,{cause:n}]){}class ft extends J("ConcurrentCallError",qe){}class $r extends J("SetEmojiStatusError",e=>[`Failed to set emoji status: ${e}`]){}class pn extends J("AccessDeniedError",qe){}class Mr extends J("FullscreenFailedError",qe){}class Pr extends J("ShareMessageError",qe){}class Rr extends J("UnknownThemeParamsKeyError",e=>[`Unknown theme params key passed: ${e}`]){}function T(t,e){const n=C(()=>te(e.version)||"100"),r=C(()=>te(e.isVBma)),{requires:o,returns:i}=e,a=o?typeof o=="object"?o:{every:[o]}:void 0,c=w=>{if(!e.supports)return!0;const y=e.supports[w];return _e(y.method,y.param,n())},l=()=>{if(!a)return;const[w,y]="every"in a?["every",a.every]:["some",a.some];for(let m=0;m<y.length;m++){const j=y[m],H=typeof j=="function"?j():_e(j,n())?void 0:`it is unsupported in Mini Apps version ${n()}`;if(H&&(w==="every"||m===y.length-1))return H}},p=(...w)=>{for(const y in e.supports)if(e.supports[y].shouldCheck(...w)&&!c(y))return`option ${y} is not supported in Mini Apps version ${n()}`},h=C(()=>!l()),f=C(()=>n()!=="0.0"),g=C(()=>e.isMounted?e.isMounted():!0),v=C(()=>r()&&f()&&h()&&g()),F=w=>{const y=new Br(w);return["task","promise"].includes(e.returns)?W(y):P(y)},k=(...w)=>i==="plain"?Me(()=>t(...w),y=>y):i==="promise"?Ln(()=>t(...w),y=>y):t(...w);return Object.assign((...w)=>{var H;const y="Unable to call function:";if(!r())return F(`${y} it can't be called outside Mini Apps`);if(!f())return F(`${y} the SDK was not initialized. Use the SDK init() function`);const m=l();if(m)return F(`${y} ${m}`);const j=p(...w);if(j)return F(`${y} ${j}`);if(!g()){const U=(H=e.isMounting)!=null&&H.call(e)?"mounting. Wait for the mount completion":"unmounted. Use the mount() method";return F(`${y} the component is ${U}`)}return k(...w)},t,{isAvailable:v,ifAvailable(...w){return v()?$e(k(...w)):Fe}},a?{isSupported:h}:{},e.supports?{supports:c}:{})}function M(t){return e=>T(e,t)}class _t{constructor({isVBma:e,storage:n,onClick:r,offClick:o,initialState:i,isPageReload:a,postEvent:c,payload:l,method:p,version:h}){s(this,"isMounted");s(this,"isSupported");s(this,"state");s(this,"stateSetters");s(this,"stateBoolSetters");s(this,"setStateFp");s(this,"setState");s(this,"onClickFp");s(this,"onClick");s(this,"offClickFp");s(this,"offClick");s(this,"mountFp");s(this,"mount");s(this,"unmount");const f=new ge({initialState:i,onChange(w){n.set(w)}}),g=new Ne({initialState:i,isPageReload:a,onMounted:f.setState,restoreState:n.get}),v={version:h,requires:p,isVBma:e},F=M({...v,returns:"plain"}),k=M({...v,returns:"either",isMounted:g.isMounted});this.isMounted=g.isMounted,this.isSupported=se(p,h),this.state=f.state,this.setStateFp=k(w=>{const y={...this.state(),...Bt(w)};return f.hasDiff(y)?d(c(p,l(y)),K(()=>{f.setState(y)})):E(void 0)}),this.setState=b(this.setStateFp),this.onClickFp=F(r),this.onClick=b(this.onClickFp),this.offClickFp=F(o),this.offClick=b(this.offClickFp),this.mountFp=F(()=>{const w=()=>{};return d(g.mount(),le(w,w))}),this.mount=b(this.mountFp),this.unmount=g.unmount,this.stateSetters=w=>{const y=k(m=>this.setStateFp({[w]:m}));return[b(y),y]},this.stateBoolSetters=w=>{const[,y]=this.stateSetters(w),m=k(()=>y(!1)),j=k(()=>y(!0));return[[b(m),m],[b(j),j]]}}stateGetter(e){return C(()=>this.state()[e])}}class Vr{constructor(e){s(this,"isVisible");s(this,"isMounted");s(this,"isSupported");s(this,"hideFp");s(this,"hide");s(this,"showFp");s(this,"show");s(this,"onClickFp");s(this,"onClick");s(this,"offClickFp");s(this,"offClick");s(this,"mountFp");s(this,"mount");s(this,"unmount");const n=new _t({...e,method:"web_app_setup_back_button",payload:r=>({is_visible:r.isVisible}),initialState:{isVisible:!1}});this.isVisible=n.stateGetter("isVisible"),this.isMounted=n.isMounted,this.isSupported=n.isSupported,[[this.hide,this.hideFp],[this.show,this.showFp]]=n.stateBoolSetters("isVisible"),this.onClick=n.onClick,this.onClickFp=n.onClickFp,this.offClick=n.offClick,this.offClickFp=n.offClickFp,this.mount=n.mount,this.mountFp=n.mountFp,this.unmount=n.unmount}}function q(){return{isVBma:C(()=>an())}}function Te(t){return e=>({...e,...te(t)})}function Xe(t,e){return D(t,e)}const Lr=Xe(Le),Ae=(...t)=>Lr()(...t),Tr=(...t)=>Je(Ae(...t)),Q=Te({postEvent:Ae});function ua(t){return{get:()=>Kn(t),set(e){at(t,e)}}}function ca(){return performance.getEntriesByType("navigation")[0]}function la(){const t=ca();return!!t&&t.type==="reload"}function ye(t){return Te({storage:ua(t),isPageReload:la})}const dn=Xe("0.0"),$=Te({version:dn});function hn(t,e){return{...d(q(),Q,$,ye(t)),onClick(n,r){return X(e,n,r)},offClick(n,r){Ee(e,n,r)}}}const pa=new Vr(hn("backButton","back_button_pressed"));class fn{constructor({initialState:e,onMounted:n,restoreState:r,onUnmounted:o,isPageReload:i}){s(this,"_isMounted",D(!1));s(this,"isMounted",C(this._isMounted));s(this,"mount");s(this,"unmount");this.mount=a=>{if(this._isMounted())return V(void 0);const c=te(i)?r():void 0;return d(c?V(c):e(a),I(l=>{this._isMounted()||tt(()=>{this._isMounted.set(!0),n==null||n(l)})}))},this.unmount=()=>{this._isMounted()&&tt(()=>{this._isMounted.set(!1),o==null||o()})}}}function Or(){return new Ir("Biometry is not available")}function _n(t){let e=!1,n=!1,r="",o=!1,i="",a=!1;return t.available&&(e=!0,n=t.token_saved,r=t.device_id,o=t.access_requested,i=t.type,a=t.access_granted),{available:e,tokenSaved:n,deviceId:r,type:i,accessGranted:a,accessRequested:o}}class jr{constructor({version:e,request:n,postEvent:r,storage:o,onInfoReceived:i,offInfoReceived:a,isVBma:c,isPageReload:l}){s(this,"isAvailable");s(this,"isSupported");s(this,"isMounted");s(this,"state");s(this,"authenticateFp");s(this,"authenticate");s(this,"openSettingsFp");s(this,"openSettings");s(this,"requestAccessFp");s(this,"requestAccess");s(this,"updateTokenFp");s(this,"updateToken");s(this,"mountFp");s(this,"mount");s(this,"unmount");const p=w=>{h.setState(_n(w))},h=new ge({initialState:{available:!1,type:"unknown",accessGranted:!1,accessRequested:!1,deviceId:"",tokenSaved:!1},onChange:o.set}),f=new fn({initialState(w){return d(n("web_app_biometry_get_info","biometry_info_received",w),I(_n))},isPageReload:l,onMounted(w){h.setState(w),i(p)},onUnmounted(){a(p)},restoreState:o.get}),g={version:e,requires:"web_app_biometry_request_auth",isVBma:c},v=M({...g,returns:"either"}),F=M({...g,returns:"task"}),k=M({...g,isMounted:f.isMounted,returns:"task"});this.isAvailable=h.getter("available"),this.isMounted=f.isMounted,this.isSupported=se("web_app_biometry_request_auth",e),this.state=h.state,this.unmount=f.unmount,this.mountFp=F(f.mount),this.authenticateFp=k(w=>this.isAvailable()?d(n("web_app_biometry_request_auth","biometry_auth_requested",{...w,params:{reason:((w||{}).reason||"").trim()}}),I(y=>(h.setState({token:y.token}),y))):W(Or())),this.openSettingsFp=v(()=>r("web_app_biometry_open_settings")),this.requestAccessFp=k(w=>d(n("web_app_biometry_request_access","biometry_info_received",{...w,params:{reason:((w||{}).reason||"").trim()}}),ne(y=>{const m=_n(y);return m.available?(h.setState(m),V(m.accessRequested)):W(Or())}))),this.updateTokenFp=k((w={})=>{var y;return d(n("web_app_biometry_update_token","biometry_token_updated",{...w,params:{token:w.token||"",reason:(y=w.reason)==null?void 0:y.trim()}}),I(m=>m.status))}),this.authenticate=b(this.authenticateFp),this.openSettings=b(this.openSettingsFp),this.requestAccess=b(this.requestAccessFp),this.updateToken=b(this.updateTokenFp),this.mount=b(this.mountFp)}}const Hr=(t,e,n)=>ta(t,e,{postEvent:Ae,...n}),bn=(t,e,n)=>dt(t,e,{postEvent:Ae,...n}),da=(...t)=>Ge.fn(()=>Hr(...t)()),ha=(...t)=>Ge.fn(()=>bn(...t)()),x=Te({request:bn});function fa(){return new jr({...d(q(),Q,$,x,ye("biometry")),offInfoReceived(t){Ee("biometry_info_received",t)},onInfoReceived(t){return X("biometry_info_received",t)}})}const _a=fa();class Dr{constructor({postEvent:e,storage:n,isVBma:r,isPageReload:o}){s(this,"isConfirmationEnabled");s(this,"isMounted");s(this,"mountFp");s(this,"mount");s(this,"unmount");s(this,"disableConfirmationFp");s(this,"disableConfirmation");s(this,"enableConfirmationFp");s(this,"enableConfirmation");const i=new ge({initialState:{isConfirmationEnabled:!1},onChange(f){n.set(f)}}),a=new Ne({onMounted:i.setState,restoreState:n.get,initialState:{isConfirmationEnabled:!1},isPageReload:o}),c={requires:"web_app_setup_closing_behavior",isVBma:r},l=M({...c,returns:"plain"}),p=M({...c,returns:"either",isMounted:a.isMounted}),h=f=>f===this.isConfirmationEnabled()?E(void 0):(i.setState({isConfirmationEnabled:f}),e("web_app_setup_closing_behavior",{need_confirmation:f}));this.isConfirmationEnabled=i.getter("isConfirmationEnabled"),this.isMounted=a.isMounted,this.disableConfirmationFp=p(()=>h(!1)),this.enableConfirmationFp=p(()=>h(!0)),this.mountFp=l(()=>{const f=()=>{};return d(a.mount(),le(f,f))}),this.unmount=a.unmount,this.disableConfirmation=b(this.disableConfirmationFp),this.enableConfirmation=b(this.enableConfirmationFp),this.mount=b(this.mountFp)}}function ba(){return new Dr(d(q(),ye("closingBehavior"),Q))}const ma=ba();class Wr{constructor({version:e,isVBma:n,invokeCustomMethod:r}){s(this,"isSupported");s(this,"deleteItemFp");s(this,"deleteItem");s(this,"getItemFp");s(this,"getItem");s(this,"getItemsFp");s(this,"getItems");s(this,"getKeysFp");s(this,"getKeys");s(this,"setItemFp");s(this,"setItem");s(this,"clearFp");s(this,"clear");const o=M({version:e,requires:"web_app_invoke_custom_method",isVBma:n,returns:"task"});this.isSupported=se("web_app_invoke_custom_method",e),this.deleteItemFp=o((i,a)=>{const c=Array.isArray(i)?i:[i];return d(c.length?r("deleteStorageValues",{keys:c},a):V(void 0),I(()=>{}))}),this.getItemFp=o((i,a)=>d(this.getItemsFp([i],a),I(c=>c[i]||""))),this.getItemsFp=o((i,a)=>d(i.length?r("getStorageValues",{keys:i},a):V({}),I(c=>({...i.reduce((l,p)=>(l[p]="",l),{}),...fe(Dt(S(),S()),c)})))),this.getKeysFp=o(i=>d(r("getStorageKeys",{},i),I(a=>fe(jn(S()),a)))),this.setItemFp=o((i,a,c)=>d(r("saveStorageValue",{key:i,value:a},c),I(()=>{}))),this.clearFp=o(i=>d(this.getKeysFp(i),ne(this.deleteItemFp))),this.deleteItem=b(this.deleteItemFp),this.getItem=b(this.getItemFp),this.getItems=b(this.getItemsFp),this.getKeys=b(this.getKeysFp),this.setItem=b(this.setItemFp),this.clear=b(this.clearFp)}}const mn=Xe(0);function bt(){return mn.set(mn()+1),mn().toString()}function Ur(t,e,n){return ea(t,e,bt(),{...n||{},postEvent:Ae})}const gn=Te({invokeCustomMethod:Ur});function ga(){return new Wr(d(q(),$,gn))}const wa=ga();class Nr{constructor({isVBma:e,request:n,version:r,createRequestId:o}){s(this,"getItemFp");s(this,"getItem");s(this,"setItemFp");s(this,"setItem");s(this,"deleteItemFp");s(this,"deleteItem");s(this,"clearFp");s(this,"clear");const i=M({version:r,requires:"web_app_device_storage_get_key",isVBma:e,returns:"task"}),a=(c,l,p)=>{const h=o();return d(n(c,["device_storage_failed",l],{params:{...p,req_id:h},capture:(f=>"payload"in f?f.payload.req_id===h:!0)}),ne(f=>f.event==="device_storage_failed"?W(new qr(f.payload.error||"UNKNOWN_ERROR")):V(f.payload)))};this.getItemFp=i(c=>d(a("web_app_device_storage_get_key","device_storage_key_received",{key:c}),I(l=>l.value))),this.setItemFp=i((c,l)=>d(a("web_app_device_storage_save_key","device_storage_key_saved",{key:c,value:l}),I(()=>{}))),this.deleteItemFp=i(c=>this.setItemFp(c,null)),this.clearFp=i(()=>d(a("web_app_device_storage_clear","device_storage_cleared",{}),I(()=>{}))),this.getItem=b(this.getItemFp),this.setItem=b(this.setItemFp),this.deleteItem=b(this.deleteItemFp),this.clear=b(this.clearFp)}}const Gr=Te({createRequestId:bt});function va(){return new Nr(d(q(),$,x,Gr))}const ya=va();function Sa({request:t,...e}){return T(n=>d(t("web_app_request_emoji_status_access","emoji_status_access_requested",n),I(r=>r.status)),{...e,requires:"web_app_request_emoji_status_access",returns:"task"})}function Fa(){return Sa(d(q(),$,x))}const zr=Fa(),Ca=b(zr);function ka({request:t,...e}){return T((n,r)=>d(t("web_app_set_emoji_status",["emoji_status_set","emoji_status_failed"],{params:{custom_emoji_id:n,duration:(r||{}).duration},...r}),pe(o=>o.event==="emoji_status_failed"?W(new $r(o.payload.error)):V(void 0))),{...e,requires:"web_app_set_emoji_status",returns:"task"})}function Ea(){return ka(d(q(),x,$))}const Jr=Ea(),qa=b(Jr);class Kr{constructor({postEvent:e,isVBma:n,version:r}){s(this,"isSupported");s(this,"impactOccurredFp");s(this,"impactOccurred");s(this,"notificationOccurredFp");s(this,"notificationOccurred");s(this,"selectionChangedFp");s(this,"selectionChanged");const o="web_app_trigger_haptic_feedback",i=M({requires:o,isVBma:n,version:r,returns:"plain"});this.isSupported=se(o,r),this.impactOccurredFp=i(a=>e(o,{type:"impact",impact_style:a})),this.notificationOccurredFp=i(a=>e(o,{type:"notification",notification_type:a})),this.selectionChangedFp=i(()=>e(o,{type:"selection_change"})),this.impactOccurred=b(this.impactOccurredFp),this.notificationOccurred=b(this.notificationOccurredFp),this.selectionChanged=b(this.selectionChangedFp)}}function Aa(){return new Kr(d(q(),Q,$))}const Ia=Aa();function Ba({postEvent:t,...e}){return T(()=>t("web_app_add_to_home_screen"),{...e,requires:"web_app_add_to_home_screen",returns:"either"})}function $a(){return Ba(d(q(),$,Q))}const Qr=$a(),Ma=b(Qr);function Pa({request:t,...e}){return T(n=>d(t("web_app_check_home_screen","home_screen_checked",n),I(r=>r.status||"unknown")),{...e,requires:"web_app_check_home_screen",returns:"task"})}function Ra(){return Pa(d(q(),$,x))}const Zr=Ra(),Va=b(Zr);class Yr{constructor({retrieveInitData:e}){s(this,"_state",D());s(this,"_raw",D());s(this,"state",C(this._state));s(this,"authDate",this.fromState("auth_date"));s(this,"canSendAfter",this.fromState("can_send_after"));s(this,"canSendAfterDate",C(()=>{const e=this.authDate(),n=this.canSendAfter();return n&&e?new Date(e.getTime()+n*1e3):void 0}));s(this,"chat",this.fromState("chat"));s(this,"chatType",this.fromState("chat_type"));s(this,"chatInstance",this.fromState("chat_instance"));s(this,"hash",this.fromState("hash"));s(this,"queryId",this.fromState("query_id"));s(this,"raw",C(this._raw));s(this,"receiver",this.fromState("receiver"));s(this,"signature",this.fromState("signature"));s(this,"startParam",this.fromState("start_param"));s(this,"auth",this.fromState("auth"));s(this,"user",this.fromState("user"));s(this,"restoreFp");s(this,"restore");this.restoreFp=()=>d(e(),K(vt(()=>{},({raw:n,obj:r})=>{this._state.set(r),this._raw.set(n)}))),this.restore=re(this.restoreFp)}fromState(e){return C(()=>{const n=this._state();return n?n[e]:void 0})}}function La(){return new Yr({retrieveInitData(){return d(Mo,Pn("obj",()=>d(Ve(),K(({vbWebAppData:t})=>t?$e(t):Fe))),Pn("raw",nn),K(({obj:t,raw:e})=>d(yo,$n("obj",()=>t),$n("raw",()=>e))))}})}const Ta=La();class Xr{constructor({version:e,request:n,isVBma:r}){s(this,"isOpened");s(this,"isSupported");s(this,"openSlugFp");s(this,"openSlug");s(this,"openUrlFp");s(this,"openUrl");const o=M({version:e,isVBma:r,requires:"web_app_open_invoice",returns:"task"}),i=D(!1),a=()=>{i.set(!1)};this.isSupported=se("web_app_open_invoice",e),this.isOpened=C(i),this.openSlugFp=o((c,l)=>d(this.isOpened()?W(new ft("Invoice is already opened")):V(void 0),ne(()=>(i.set(!0),n("web_app_open_invoice","invoice_closed",{...l,params:{slug:c},capture:p=>c===p.slug}))),Ue(p=>(a(),p),p=>(a(),p.status)))),this.openUrlFp=o((c,l)=>{const{hostname:p,pathname:h}=new URL(c,window.location.href);if(p!=="vbot.vn")return W(new oe(`Link has unexpected hostname: ${p}`));const f=h.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);return f?this.openSlugFp(f[2],l):W(new oe('Expected to receive a link with a pathname in format "/invoice/{slug}" or "/${slug}"'))}),this.openUrl=b(this.openUrlFp),this.openSlug=b(this.openSlugFp)}}function Oa(){return new Xr(d(q(),x,$))}const ja=Oa();function Ha({postEvent:t,...e}){return T((n,r={})=>{if(typeof n=="string")try{n=new URL(n)}catch(o){return P(new oe(`"${n.toString()}" is invalid URL`,o))}return t("web_app_open_link",{url:n.toString(),try_browser:r.tryBrowser,try_instant_view:r.tryInstantView})},{...e,returns:"either"})}function Da(){return Ha(d(q(),Q))}const xr=Da(),Wa=b(xr);function Ua({postEvent:t,version:e,...n}){return T(r=>{const o=r.toString();return o.match(/^https:\/\/vbot\.vn\/.+/)?_e("web_app_open_vb_link",te(e))?(r=new URL(r),t("web_app_open_vb_link",{path_full:r.pathname+r.search})):(window.location.href=o,E(void 0)):P(new oe(`"${o}" is invalid URL`))},{...n,returns:"either"})}function Na(){return Ua(d(q(),Q,$))}const wn=Na(),Ga=b(wn);function za({openVbotLink:t,...e}){return T((n,r)=>t("https://vbot.vn/share/url?"+new URLSearchParams({url:n,text:r||""}).toString().replace(/\+/g,"%20")),{...e,returns:"either"})}function Ja(){return za({...q(),openVbotLink:wn})}const es=Ja(),Ka=b(es);function Qa(t){let e=!1,n,r;return t.available&&(e=!0,n=t.access_requested,r=t.access_granted),{available:e,accessGranted:r||!1,accessRequested:n||!1}}class ts{constructor({version:e,request:n,postEvent:r,storage:o,isVBma:i,isPageReload:a}){s(this,"state");s(this,"isAvailable");s(this,"isAccessGranted");s(this,"isAccessRequested");s(this,"isMounted");s(this,"isSupported");s(this,"openSettingsFp");s(this,"openSettings");s(this,"requestLocationFp");s(this,"requestLocation");s(this,"mountFp");s(this,"mount");s(this,"unmount");const c=new ge({initialState:{available:!1,accessGranted:!1,accessRequested:!1},onChange:o.set}),l=new fn({isPageReload:a,restoreState:o.get,onMounted:c.setState,initialState(v){return d(n("web_app_check_location","location_checked",v),I(Qa))}}),p={version:e,requires:"web_app_check_location",isVBma:i},h=M({...p,returns:"either"}),f=M({...p,returns:"task"}),g=M({...p,returns:"task",isMounted:l.isMounted});this.isAvailable=c.getter("available"),this.isAccessRequested=c.getter("accessRequested"),this.isAccessGranted=c.getter("accessGranted"),this.isSupported=se("web_app_check_location",e),this.isMounted=l.isMounted,this.state=c.state,this.unmount=l.unmount,this.mountFp=f(l.mount),this.openSettingsFp=h(()=>r("web_app_open_location_settings")),this.requestLocationFp=g(v=>d(n("web_app_request_location","location_requested",v),I(F=>{if(!F.available)return c.setState({available:!1}),null;const{available:k,...w}=F;return w}))),this.mount=b(this.mountFp),this.openSettings=b(this.openSettingsFp),this.requestLocation=b(this.requestLocationFp)}}function Za(){return new ts(d(q(),Q,$,x,ye("locationManager")))}const Ya=Za();class ns{constructor({defaults:e,...n}){s(this,"bgColor");s(this,"hasShineEffect");s(this,"isEnabled");s(this,"isLoaderVisible");s(this,"isVisible");s(this,"isMounted");s(this,"state");s(this,"text");s(this,"textColor");s(this,"showFp");s(this,"show");s(this,"hideFp");s(this,"hide");s(this,"enableFp");s(this,"enable");s(this,"enableShineEffectFp");s(this,"enableShineEffect");s(this,"disableFp");s(this,"disable");s(this,"disableShineEffectFp");s(this,"disableShineEffect");s(this,"setBgColorFp");s(this,"setBgColor");s(this,"setTextColorFp");s(this,"setTextColor");s(this,"setTextFp");s(this,"setText");s(this,"showLoaderFp");s(this,"showLoader");s(this,"hideLoaderFp");s(this,"hideLoader");s(this,"setParamsFp");s(this,"setParams");s(this,"mountFp");s(this,"mount");s(this,"unmount");s(this,"onClickFp");s(this,"onClick");s(this,"offClickFp");s(this,"offClick");const r=new _t({...n,version:"100",initialState:{hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Continue"},method:"web_app_setup_main_button",payload:i=>({has_shine_effect:i.hasShineEffect,is_visible:i.isVisible,is_active:i.isEnabled,is_progress_visible:i.isLoaderVisible,text:i.text,color:i.bgColor,text_color:i.textColor})}),o=(i,a)=>{const c=r.stateGetter(i);return C(()=>c()||te(a))};this.bgColor=o("bgColor",e.bgColor),this.textColor=o("textColor",e.textColor),this.hasShineEffect=r.stateGetter("hasShineEffect"),this.isEnabled=r.stateGetter("isEnabled"),this.isLoaderVisible=r.stateGetter("isLoaderVisible"),this.text=r.stateGetter("text"),this.isVisible=r.stateGetter("isVisible"),this.isMounted=r.isMounted,this.state=r.state,[this.setBgColor,this.setBgColorFp]=r.stateSetters("bgColor"),[this.setTextColor,this.setTextColorFp]=r.stateSetters("textColor"),[[this.disableShineEffect,this.disableShineEffectFp],[this.enableShineEffect,this.enableShineEffectFp]]=r.stateBoolSetters("hasShineEffect"),[[this.disable,this.disableFp],[this.enable,this.enableFp]]=r.stateBoolSetters("isEnabled"),[[this.hideLoader,this.hideLoaderFp],[this.showLoader,this.showLoaderFp]]=r.stateBoolSetters("isLoaderVisible"),[this.setText,this.setTextFp]=r.stateSetters("text"),[[this.hide,this.hideFp],[this.show,this.showFp]]=r.stateBoolSetters("isVisible"),this.setParams=r.setState,this.setParamsFp=r.setStateFp,this.onClick=r.onClick,this.onClickFp=r.onClickFp,this.offClick=r.offClick,this.offClickFp=r.offClickFp,this.mount=r.mount,this.mountFp=r.mountFp,this.unmount=r.unmount}}function vn(t,e){document.documentElement.style.setProperty(t,e)}function yn(t){document.documentElement.style.removeProperty(t)}function rs(t){return d(lt(t),K(e=>Math.sqrt([.299,.587,.114].reduce((n,r,o)=>{const i=parseInt(e.slice(1+o*2,1+(o+1)*2),16);return n+i*i*r},0))<120))}const Sn=re(rs);class ss{constructor({initialState:e,onChange:n,offChange:r,isVBma:o,storage:i,isPageReload:a}){s(this,"accentTextColor");s(this,"bgColor");s(this,"buttonColor");s(this,"buttonTextColor");s(this,"bottomBarBgColor");s(this,"destructiveTextColor");s(this,"headerBgColor");s(this,"hintColor");s(this,"linkColor");s(this,"secondaryBgColor");s(this,"sectionBgColor");s(this,"sectionHeaderTextColor");s(this,"sectionSeparatorColor");s(this,"subtitleTextColor");s(this,"textColor");s(this,"_isCssVarsBound",D(!1));s(this,"isCssVarsBound",C(this._isCssVarsBound));s(this,"bindCssVarsFp");s(this,"bindCssVars");s(this,"state");s(this,"isDark",C(()=>{const e=this.bgColor();return!e||Sn(e)}));s(this,"isMounted");s(this,"mountFp");s(this,"mount");s(this,"unmount");const c=new ge({initialState:{},onChange:i.set}),l=v=>{c.setState(v.theme_params)},p=new Ne({initialState:()=>E(te(e)),isPageReload:a,onMounted(v){c.setState(v),n(l)},onUnmounted(){r(l)},restoreState:i.get}),h={isVBma:o,returns:"either"},f=M(h),g=M({...h,isMounted:p.isMounted});this.accentTextColor=c.getter("accent_text_color"),this.bgColor=c.getter("bg_color"),this.buttonColor=c.getter("button_color"),this.buttonTextColor=c.getter("button_text_color"),this.bottomBarBgColor=c.getter("bottom_bar_bg_color"),this.destructiveTextColor=c.getter("destructive_text_color"),this.headerBgColor=c.getter("header_bg_color"),this.hintColor=c.getter("hint_color"),this.linkColor=c.getter("link_color"),this.secondaryBgColor=c.getter("secondary_bg_color"),this.sectionBgColor=c.getter("section_bg_color"),this.sectionHeaderTextColor=c.getter("section_header_text_color"),this.sectionSeparatorColor=c.getter("section_separator_color"),this.subtitleTextColor=c.getter("subtitle_text_color"),this.textColor=c.getter("text_color"),this.state=c.state,this.isMounted=p.isMounted,this.bindCssVarsFp=g(v=>{if(this._isCssVarsBound())return P(new ht);v||(v=w=>`--vb-theme-${Si(w)}`);const F=w=>{Object.entries(c.state()).forEach(([y,m])=>{m&&w(y,m)})},k=()=>{F((w,y)=>{vn(v(w),y)})};return k(),c.state.sub(k),this._isCssVarsBound.set(!0),E(()=>{F(yn),c.state.unsub(k),this._isCssVarsBound.set(!1)})}),this.mountFp=f(p.mount),this.unmount=p.unmount,this.bindCssVars=b(this.bindCssVarsFp),this.mount=b(this.mountFp)}}const Fn=Xe({});function Xa(){return new ss({...d(q(),ye("themeParams")),offChange(t){Ee("theme_changed",t)},onChange(t){X("theme_changed",t)},initialState:Fn})}const xe=Xa();function os(t,e,n){return d(hn(t,e),r=>({...r,defaults:n}))}const xa=new ns(os("mainButton","main_button_pressed",{bgColor:C(()=>xe.buttonColor()||"#2481cc"),textColor:C(()=>xe.buttonTextColor()||"#ffffff")}));class is{constructor({storage:e,isPageReload:n,version:r,postEvent:o,isVBma:i,theme:a,onVisibilityChanged:c,offVisibilityChanged:l}){s(this,"isSupported");s(this,"isDark",C(()=>{const e=this.bgColorRgb();return e?Sn(e):!1}));s(this,"isActive");s(this,"state");s(this,"isCssVarsBound");s(this,"bindCssVarsFp");s(this,"bindCssVars");s(this,"isMounted");s(this,"mountFp");s(this,"mount");s(this,"unmount");s(this,"bgColor");s(this,"bgColorRgb");s(this,"setBgColorFp");s(this,"setBgColor");s(this,"headerColor");s(this,"headerColorRgb");s(this,"setHeaderColorFp");s(this,"setHeaderColor");s(this,"bottomBarColor");s(this,"bottomBarColorRgb");s(this,"setBottomBarColorFp");s(this,"setBottomBarColor");s(this,"closeFp");s(this,"close");s(this,"readyFp");s(this,"ready");const p=m=>{g.setState({isActive:m.is_visible})},h=m=>{[[this.headerColor,"web_app_set_header_color"],[this.bgColor,"web_app_set_background_color"],[this.bottomBarColor,"web_app_set_bottom_bar_color"]].forEach(([j,H])=>{const U=j();if(!Ke(U)&&(H!=="web_app_set_header_color"||!["bg_color","secondary_bg_color"].includes(U))){const A=m[U];A&&o(H,{color:A})}})},f=new Ne({initialState(){return E({bgColor:"bg_color",headerColor:"header_bg_color",bottomBarColor:"bottom_bar_bg_color",isActive:!0})},isPageReload:n,onMounted:m=>{c(p),a.sub(h),g.setState(m)},onUnmounted(){l(p),a.unsub(h)},restoreState:e.get});this.isMounted=f.isMounted,this.mountFp=T(()=>{const m=()=>{};return d(f.mount(),le(m,m))},{isVBma:i,returns:"plain"}),this.mount=b(this.mountFp),this.unmount=f.unmount;const g=new ge({initialState:{bgColor:"bg_color",bottomBarColor:"bottom_bar_bg_color",headerColor:"bg_color",isActive:!1},onChange:e.set});this.state=g.state;const v=m=>Ke(m)?m:te(a)[m],F=m=>C(()=>v(m()));this.isActive=g.getter("isActive"),this.isSupported=C(()=>["web_app_set_header_color","web_app_set_background_color","web_app_set_bottom_bar_color"].some(m=>_e(m,te(r))));const k=D(!1);this.isCssVarsBound=C(k),this.bindCssVarsFp=T(m=>{if(k())return P(new ht);const[j,H]=ze(()=>{k.set(!1)}),U=(A,O)=>{const L=()=>{vn(A,O()||null)};L(),j(O.sub(L),yn.bind(null,A))};return m||(m=A=>`--tg-${zn(A)}`),U(m("bgColor"),this.bgColorRgb),U(m("bottomBarColor"),this.bottomBarColorRgb),U(m("headerColor"),this.headerColorRgb),k.set(!0),E(H)},{isVBma:i,returns:"either",isMounted:this.isMounted}),this.bindCssVars=b(this.bindCssVarsFp);const w=m=>{const j=g.getter(m),H=F(j),U={headerColor:"web_app_set_header_color",bgColor:"web_app_set_background_color",bottomBarColor:"web_app_set_bottom_bar_color"}[m],A=T(O=>{if(O===j())return E(void 0);if(U==="web_app_set_header_color"&&(O==="bg_color"||O==="secondary_bg_color"))return d(o("web_app_set_header_color",{color_key:O}),K(()=>{g.setState({[m]:O})}));const L=v(O);return d(L?o(U,{color:L}):P(new Rr(O)),K(()=>{g.setState({[m]:O})}))},{isVBma:i,version:r,requires:U,isMounted:this.isMounted,returns:"either",supports:m==="headerColor"?{rgb:{method:"web_app_set_header_color",param:"color",shouldCheck:Ke}}:void 0});return[j,H,b(A),A]};[this.bgColor,this.bgColorRgb,this.setBgColor,this.setBgColorFp]=w("bgColor"),[this.headerColor,this.headerColorRgb,this.setHeaderColor,this.setHeaderColorFp]=w("headerColor"),[this.bottomBarColor,this.bottomBarColorRgb,this.setBottomBarColor,this.setBottomBarColorFp]=w("bottomBarColor");const y=M({isVBma:i,returns:"either"});this.closeFp=y(m=>o("web_app_close",{return_back:m})),this.close=b(this.closeFp),this.readyFp=y(()=>o("web_app_ready")),this.ready=b(this.readyFp)}}function eu(){return new is({...d(q(),Q,$,ye("miniApp")),offVisibilityChanged(t){Ee("visibility_changed",t)},onVisibilityChanged(t){X("visibility_changed",t)},theme:xe.state})}const as=eu();function tu(){const t=Date.now(),e=Math.random().toString(36).substring(2,9);return`notif_${t}_${e}`}class us{constructor({version:e,isVBma:n}){s(this,"isSupported");s(this,"sendFp");s(this,"send");const r=M({version:e,isVBma:n,requires:"web_app_send_notification",returns:"task"});this.isSupported=se("web_app_send_notification",e),this.sendFp=r(o=>d(We(Le("web_app_send_notification",{id:tu(),message:o.message,title:o.title,type:o.type??"default"})),I(()=>{}))),this.send=o=>this.sendFp(o)().then(a=>{if(a._tag==="Left")throw a.left;return a.right})}}function nu(){return new us($(q()))}const ru=nu();function su(t){const e=t.message.trim(),n=(t.title||"").trim(),r=t.buttons||[];if(n.length>64)return P(new oe(`Invalid title: ${n}`));if(!e||e.length>256)return P(new oe(`Invalid message: ${e}`));if(r.length>3)return P(new oe(`Invalid buttons count: ${r.length}`));const o=[];if(!r.length)o.push({type:"close",id:""});else for(let i=0;i<r.length;i++){const a=r[i],c=a.id||"";if(c.length>64)return P(new oe(`Button with index ${i} has invalid id: ${c}`));if(!a.type||a.type==="default"||a.type==="destructive"){const l=a.text.trim();if(!l||l.length>64)return P(new oe(`Button with index ${i} has invalid text: ${l}`));o.push({type:a.type,text:l,id:c})}else o.push({type:a.type,id:c})}return E({title:n,message:e,buttons:o})}class cs{constructor({version:e,isVBma:n,request:r}){s(this,"isOpened");s(this,"isSupported");s(this,"showFp");s(this,"show");const o=D(!1),i=()=>{o.set(!1)},a=M({version:e,isVBma:n,requires:"web_app_open_popup",returns:"task"});this.isSupported=se("web_app_open_popup",e),this.isOpened=C(o),this.showFp=a(c=>d(this.isOpened()?W(new ft("A popup is already opened")):V(void 0),pe(()=>We(su(c))),ne(l=>(o.set(!0),r("web_app_open_popup","popup_closed",{...c,params:l}))),Ue(l=>(i(),l),l=>(i(),l.button_id)))),this.show=b(this.showFp)}}function ou(){return new cs(d(q(),x,$))}const iu=ou();function au({request:t,...e}){return T(n=>d(t("web_app_request_phone","phone_requested",n),I(r=>r.status)),{...e,requires:"web_app_request_phone",returns:"task"})}function uu(){return au(d(q(),$,x))}const Cn=uu(),cu=b(Cn);function lu({invokeCustomMethod:t,requestPhoneAccess:e,...n}){const r=a=>d(t("getRequestedContact",{},{...a,timeout:(a||{}).timeout||5e3}),pe(c=>{const l=Ut(S(),c);if(!l.success)return W(new Ye(c,l.issues));if(!l.output)return V(void 0);const p=Ut(Kt(N({contact:ue(N({user_id:we(),phone_number:S(),first_name:S(),last_name:B(S())})),auth_date:ae(S(),he(h=>new Date(Number(h)*1e3)),ot()),hash:S()})),l.output);return p.success?V({raw:l.output,parsed:p.output}):W(new Ye(l.output,p.issues))})),o=a=>d(r(a),nt(c=>Ye.is(c)?P(c):E(void 0),c=>E(c))),i=a=>Re(async(c,l,p)=>{let h=50;for(;!p.isRejected;){const f=await o(p)();if(f._tag==="Left")return l(f.left);if(f.right)return c(f.right);await new Promise(g=>setTimeout(g,h)),h+=50}},a);return T(a=>Re.fn(c=>d(o(c),ne(l=>l?V(l):d(e(c),pe(p=>p==="sent"?i(c):W(new pn("User denied access")))))),a),{...n,returns:"task",requires:"web_app_request_phone"})}function pu(){return lu({...d(q(),gn,$),requestPhoneAccess:Cn})}function du({requestContact:t,...e}){return T(t,{...e,returns:"task",requires:"web_app_request_phone"})}function hu(){return du({...d(q(),$),requestContact(t){return d(kn(t),I(e=>e.parsed))}})}const kn=pu(),fu=b(kn),ls=hu(),_u=b(ls);function bu({request:t,...e}){return T(n=>d(t("web_app_request_write_access","write_access_requested",n),I(r=>r.status)),{...e,requires:"web_app_request_write_access",returns:"task"})}function mu(){return bu(d(q(),$,x))}const ps=mu(),gu=b(ps);class ds{constructor({version:e,onClosed:n,onTextReceived:r,isVBma:o,postEvent:i}){s(this,"isOpened");s(this,"isSupported");s(this,"captureFp");s(this,"capture");s(this,"closeFp");s(this,"close");s(this,"openFp");s(this,"open");const a={version:e,requires:"web_app_open_scan_qr_popup",isVBma:o},c=M({...a,returns:"either"}),l=M({...a,returns:"task"}),p=D(!1),h=()=>{p.set(!1)};this.isSupported=se("web_app_open_scan_qr_popup",e),this.isOpened=C(p),this.captureFp=l(f=>{let g;return d(this.openFp({...f,onCaptured:v=>{f.capture(v)&&(g=v,this.close())}}),I(()=>g))}),this.closeFp=c(()=>d(i("web_app_close_scan_qr_popup"),K(h))),this.openFp=l(f=>d(p()?W(new ft("The QR Scanner is already opened")):async()=>i("web_app_open_scan_qr_popup",{text:f.text}),pe(()=>{p.set(!0);const[g,v]=ze(),F=k=>(v(),p.set(!1),k);return d(Re(k=>{g(n(k),p.sub(w=>{w||k()}),r(f.onCaptured))},f),Ue(F,F))}))),this.open=b(this.openFp),this.capture=b(this.captureFp),this.close=b(this.closeFp)}}function wu(){return new ds({...d(q(),Q,$),onClosed(t){return X("scan_qr_popup_closed",t)},onTextReceived(t){return X("qr_text_received",e=>{t(e.data)})}})}const vu=wu();class hs{constructor({}){s(this,"isRefreshing");s(this,"finishRefreshFp");s(this,"finishRefresh");s(this,"onRefreshRequest");const e=D(!1);X("refresh_requested",()=>{e.set(!0)}),this.isRefreshing=C(e),this.finishRefreshFp=()=>d(We(Le("web_app_finish_refresh")),I(()=>{e.set(!1)})),this.finishRefresh=()=>this.finishRefreshFp()().then(r=>{if(r._tag==="Left")throw r.left;return r.right}),this.onRefreshRequest=n=>X("refresh_requested",()=>{n()})}}function yu(){return new hs(d(q()))}const Su=yu();class fs{constructor({defaults:e,...n}){s(this,"isSupported");s(this,"position");s(this,"bgColor");s(this,"hasShineEffect");s(this,"isEnabled");s(this,"isLoaderVisible");s(this,"isVisible");s(this,"isMounted");s(this,"state");s(this,"text");s(this,"textColor");s(this,"showFp");s(this,"show");s(this,"hideFp");s(this,"hide");s(this,"enableFp");s(this,"enable");s(this,"enableShineEffectFp");s(this,"enableShineEffect");s(this,"disableFp");s(this,"disable");s(this,"disableShineEffectFp");s(this,"disableShineEffect");s(this,"setBgColorFp");s(this,"setBgColor");s(this,"setTextColorFp");s(this,"setTextColor");s(this,"setTextFp");s(this,"setText");s(this,"setPositionFp");s(this,"setPosition");s(this,"showLoaderFp");s(this,"showLoader");s(this,"hideLoaderFp");s(this,"hideLoader");s(this,"setParamsFp");s(this,"setParams");s(this,"mountFp");s(this,"mount");s(this,"unmount");s(this,"onClickFp");s(this,"onClick");s(this,"offClickFp");s(this,"offClick");const r=new _t({...n,initialState:{hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Cancel",position:"left"},method:"web_app_setup_secondary_button",payload:i=>({has_shine_effect:i.hasShineEffect,is_visible:i.isVisible,is_active:i.isEnabled,is_progress_visible:i.isLoaderVisible,text:i.text,color:i.bgColor,text_color:i.textColor,position:i.position})}),o=(i,a)=>{const c=r.stateGetter(i);return C(()=>c()||te(a))};this.isSupported=se("web_app_setup_secondary_button",n.version),this.bgColor=o("bgColor",e.bgColor),this.textColor=o("textColor",e.textColor),this.position=r.stateGetter("position"),this.hasShineEffect=r.stateGetter("hasShineEffect"),this.isEnabled=r.stateGetter("isEnabled"),this.isLoaderVisible=r.stateGetter("isLoaderVisible"),this.text=r.stateGetter("text"),this.isVisible=r.stateGetter("isVisible"),this.isMounted=r.isMounted,this.state=r.state,[this.setPosition,this.setPositionFp]=r.stateSetters("position"),[this.setBgColor,this.setBgColorFp]=r.stateSetters("bgColor"),[this.setTextColor,this.setTextColorFp]=r.stateSetters("textColor"),[[this.disableShineEffect,this.disableShineEffectFp],[this.enableShineEffect,this.enableShineEffectFp]]=r.stateBoolSetters("hasShineEffect"),[[this.disable,this.disableFp],[this.enable,this.enableFp]]=r.stateBoolSetters("isEnabled"),[[this.hideLoader,this.hideLoaderFp],[this.showLoader,this.showLoaderFp]]=r.stateBoolSetters("isLoaderVisible"),[this.setText,this.setTextFp]=r.stateSetters("text"),[[this.hide,this.hideFp],[this.show,this.showFp]]=r.stateBoolSetters("isVisible"),this.setParams=r.setState,this.setParamsFp=r.setStateFp,this.onClick=r.onClick,this.onClickFp=r.onClickFp,this.offClick=r.offClick,this.offClickFp=r.offClickFp,this.mount=r.mount,this.mountFp=r.mountFp,this.unmount=r.unmount}}function Fu(){return new fs(os("secondaryButton","secondary_button_pressed",{bgColor:C(()=>as.bottomBarColorRgb()||"#000000"),textColor:C(()=>xe.buttonColor()||"#2481cc")}))}const Cu=Fu();class _s{constructor({isVBma:e,request:n,version:r,createRequestId:o}){s(this,"getItemFp");s(this,"getItem");s(this,"restoreItemFp");s(this,"restoreItem");s(this,"setItemFp");s(this,"setItem");s(this,"deleteItemFp");s(this,"deleteItem");s(this,"clearFp");s(this,"clear");const i=M({version:r,requires:"web_app_secure_storage_get_key",isVBma:e,returns:"task"}),a=(c,l,p)=>{const h=o();return d(n(c,["secure_storage_failed",l],{params:{...p,req_id:h},capture:(f=>"payload"in f?f.payload.req_id===h:!0)}),ne(f=>f.event==="secure_storage_failed"?W(new Ar(f.payload.error||"UNKNOWN_ERROR")):V(f.payload)))};this.getItemFp=i(c=>d(a("web_app_secure_storage_get_key","secure_storage_key_received",{key:c}),I(l=>({value:l.value,canRestore:!!l.can_restore})))),this.setItemFp=i((c,l)=>d(a("web_app_secure_storage_save_key","secure_storage_key_saved",{key:c,value:l}),I(()=>{}))),this.deleteItemFp=i(c=>this.setItemFp(c,null)),this.clearFp=i(()=>d(a("web_app_secure_storage_clear","secure_storage_cleared",{}),I(()=>{}))),this.restoreItemFp=i(c=>d(a("web_app_secure_storage_restore_key","secure_storage_key_restored",{key:c}),I(l=>l.value))),this.getItem=b(this.getItemFp),this.setItem=b(this.setItemFp),this.deleteItem=b(this.deleteItemFp),this.clear=b(this.clearFp),this.restoreItem=b(this.restoreItemFp)}}function ku(){return new _s(d(q(),$,x,Gr))}const Eu=ku();class bs{constructor(e){s(this,"isVisible");s(this,"isMounted");s(this,"isSupported");s(this,"hideFp");s(this,"hide");s(this,"showFp");s(this,"show");s(this,"onClickFp");s(this,"onClick");s(this,"offClickFp");s(this,"offClick");s(this,"mountFp");s(this,"mount");s(this,"unmount");const n=new _t({...e,method:"web_app_setup_settings_button",payload:r=>({is_visible:r.isVisible}),initialState:{isVisible:!1}});this.isVisible=n.stateGetter("isVisible"),this.isMounted=n.isMounted,this.isSupported=n.isSupported,[[this.hide,this.hideFp],[this.show,this.showFp]]=n.stateBoolSetters("isVisible"),this.onClick=n.onClick,this.onClickFp=n.onClickFp,this.offClick=n.offClick,this.offClickFp=n.offClickFp,this.mount=n.mount,this.mountFp=n.mountFp,this.unmount=n.unmount}}const qu=new bs(hn("settingsButton","settings_button_pressed"));class ms{constructor({postEvent:e,storage:n,isVBma:r,isPageReload:o,version:i}){s(this,"isSupported");s(this,"isVerticalEnabled");s(this,"isMounted");s(this,"mountFp");s(this,"mount");s(this,"unmount");s(this,"disableVerticalFp");s(this,"disableVertical");s(this,"enableVerticalFp");s(this,"enableVertical");const a={isVerticalEnabled:!0},c=new ge({initialState:a,onChange(v){n.set(v)}}),l=new Ne({initialState:a,isPageReload:o,onMounted:c.setState,restoreState:n.get}),p={requires:"web_app_setup_swipe_behavior",isVBma:r,version:i},h=M({...p,returns:"plain"}),f=M({...p,isMounted:l.isMounted,returns:"either"}),g=v=>{const F={isVerticalEnabled:v};return c.hasDiff(F)?d(e("web_app_setup_swipe_behavior",{allow_vertical_swipe:v}),K(()=>{c.setState(F)})):E(void 0)};this.isSupported=se("web_app_setup_swipe_behavior",i),this.isVerticalEnabled=c.getter("isVerticalEnabled"),this.isMounted=l.isMounted,this.disableVerticalFp=f(()=>g(!1)),this.enableVerticalFp=f(()=>g(!0)),this.mountFp=h(()=>{const v=()=>{};return d(l.mount(),le(v,v))}),this.unmount=l.unmount,this.disableVertical=b(this.disableVerticalFp),this.enableVertical=b(this.enableVerticalFp),this.mount=b(this.mountFp)}}function Au(){return new ms(d(q(),Q,$,ye("swipeBehavior")))}const Iu=Au();async function Bu(t){try{const{clipboard:n}=navigator;if(n)return await n.writeText(t)}catch{}const e=document.createElement("textarea");e.value=t,e.style.top="0",e.style.left="0",e.style.position="fixed",document.body.appendChild(e),e.focus(),e.select();try{document.execCommand("copy")}finally{document.body.removeChild(e)}}function $u({request:t,...e}){return T((n,r,o)=>d(t("web_app_request_file_download","file_download_requested",{...o,params:{url:n,file_name:r}}),ne(i=>i.status==="downloading"?V(void 0):W(new pn("User denied the action")))),{...e,requires:"web_app_request_file_download",returns:"task"})}function Mu(){return $u(d(q(),x,$))}const gs=Mu(),Pu=b(gs);function Ru({invokeCustomMethod:t,...e}){return T(n=>d(t("getCurrentTime",{},n),ne(r=>{const o=Ut(ae(we(),Lt(),he(i=>new Date(i*1e3)),ot()),r);return o.success?V(o.output):W(new Ye(r,o.issues))})),{...e,requires:"web_app_invoke_custom_method",returns:"task"})}function Vu(){return Ru(d(q(),gn,$))}const ws=Vu(),Lu=b(ws);function Tu({postEvent:t,...e}){return T(()=>t("web_app_hide_keyboard"),{...e,returns:"either",requires:"web_app_hide_keyboard"})}function Ou(){return Tu(d(q(),Q,$))}const vs=Ou(),ju=b(vs);function Hu({request:t,createRequestId:e,...n}){return T(r=>{const o=e();return d(t("web_app_read_text_from_clipboard","clipboard_text_received",{...r,params:{req_id:o},capture:Sr(o)}),I(({data:i=null})=>i))},{...n,requires:"web_app_read_text_from_clipboard",returns:"task"})}function Du(){return Hu({...d(q(),$,x),createRequestId:bt})}const ys=Du(),Wu=b(ys);function Ss(t){const e={},n=t.match(/VBot-Android(?:\/([^ ]+))?(?: (\([^)]+\))?|$)/);if(n){const[,r,o]=n;r&&(e.appVersion=r),o&&o.slice(1,o.length-1).split(";").forEach(i=>{const[a,c]=i.trim().split(" ");if(a==="Android")e.androidVersion=c;else if(a==="SDK"){const l=parseInt(c,10);l&&(e.sdkVersion=l)}else c?(e.manufacturer=a,e.model=c):e.performanceClass=a})}return e}function Uu(){return Ss(navigator.userAgent)}function Nu({postEvent:t,...e}){return T(n=>{const{size:r}=new Blob([n]);return!r||r>4096?P(new oe(r?"Maximum size of data to send is 4096 bytes":"Attempted to send empty data")):t("web_app_data_send",{data:n})},{...e,returns:"either"})}function Gu(){return Nu(d(q(),Q))}const Fs=Gu(),zu=b(Fs);function Ju({request:t,...e}){return T((n,r)=>d(t("web_app_send_prepared_message",["prepared_message_failed","prepared_message_sent"],{...r,params:{id:n}}),ne(o=>o.event==="prepared_message_failed"?W(new Pr(o.payload.error)):V(void 0))),{...e,requires:"web_app_send_prepared_message",returns:"task"})}function Ku(){return Ju(d(q(),x,$))}const Cs=Ku(),Qu=b(Cs);function Zu({postEvent:t,...e}){return T((n,r={})=>t("web_app_share_to_story",{text:r.text,media_url:n,widget_link:r.widgetLink}),{...e,requires:"web_app_share_to_story",returns:"either"})}function Yu(){return Zu(d(q(),Q,$))}const ks=Yu(),Xu=b(ks),En=Xe(!1);function xu({isInlineMode:t,postEvent:e,...n}){return T((r,o)=>e("web_app_switch_inline_query",{query:r,chat_types:o||[]}),{...n,requires:{every:["web_app_switch_inline_query",()=>te(t)?void 0:"The application must be launched in the inline mode"]},returns:"either"})}function ec(){return xu({...d(q(),Q,$),isInlineMode:En})}const Es=ec(),tc=b(Es);class qs{constructor({storage:e,isPageReload:n,onContentSafeAreaInsetsChanged:r,onSafeAreaInsetsChanged:o,onViewportChanged:i,onFullscreenChanged:a,offContentSafeAreaInsetsChanged:c,offFullscreenChanged:l,offSafeAreaInsetsChanged:p,offViewportChanged:h,request:f,isViewportStable:g,isFullscreen:v,isVBma:F,version:k,postEvent:w}){s(this,"state");s(this,"height");s(this,"stableHeight");s(this,"width");s(this,"isExpanded");s(this,"isStable",C(()=>this.height()===this.stableHeight()));s(this,"contentSafeAreaInsets");s(this,"contentSafeAreaInsetTop");s(this,"contentSafeAreaInsetLeft");s(this,"contentSafeAreaInsetRight");s(this,"contentSafeAreaInsetBottom");s(this,"safeAreaInsets");s(this,"safeAreaInsetTop");s(this,"safeAreaInsetLeft");s(this,"safeAreaInsetRight");s(this,"safeAreaInsetBottom");s(this,"isFullscreen");s(this,"requestFullscreenFp");s(this,"requestFullscreen");s(this,"exitFullscreenFp");s(this,"exitFullscreen");s(this,"isCssVarsBound");s(this,"bindCssVarsFp");s(this,"bindCssVars");s(this,"isMounted");s(this,"mountFp");s(this,"mount");s(this,"expandFp");s(this,"expand");const y={top:0,right:0,left:0,bottom:0},m=new ge({initialState:{contentSafeAreaInsets:y,height:0,isExpanded:!1,isFullscreen:!1,safeAreaInsets:y,stableHeight:0,width:0},onChange:e.set}),j=R=>{m.setState({isExpanded:R.is_expanded,height:R.height,width:R.width,stableHeight:R.is_state_stable?R.height:void 0})},H=R=>{m.setState({isFullscreen:R.is_fullscreen})},U=R=>{m.setState({safeAreaInsets:R})},A=R=>{m.setState({contentSafeAreaInsets:R})},O=new fn({initialState(R){const Ie=be=>()=>{const[Se,ie]=be==="safe-area"?["web_app_request_safe_area","safe_area_changed"]:["web_app_request_content_safe_area","content_safe_area_changed"];return _e(Se,te(k))?f(Se,ie,R):V({top:0,left:0,right:0,bottom:0})},z=be=>()=>typeof be=="boolean"?V(be):We(be());return d(si,rt("safeAreaInsets",Ie("safe-area")),rt("contentSafeAreaInsets",Ie("content-safe-area")),rt("isFullscreen",z(v)),rt("isViewportStable",z(g)),pe(({isViewportStable:be,...Se})=>be?V({...Se,height:window.innerHeight,isExpanded:!0,stableHeight:window.innerHeight,width:window.innerWidth}):d(f("web_app_request_viewport","viewport_changed",R),I(ie=>({...Se,height:ie.height,isExpanded:ie.is_expanded,stableHeight:ie.is_state_stable?ie.height:0,width:ie.width})))))},isPageReload:n,onMounted(R){i(j),a(H),o(U),r(A),m.setState(R)},onUnmounted(){h(j),l(H),p(U),c(A)},restoreState:e.get}),L=R=>C(()=>this.safeAreaInsets()[R]),G=R=>C(()=>this.contentSafeAreaInsets()[R]);this.state=m.state,this.height=m.getter("height"),this.stableHeight=m.getter("stableHeight"),this.width=m.getter("width"),this.isExpanded=m.getter("isExpanded"),this.safeAreaInsets=m.getter("safeAreaInsets"),this.safeAreaInsetTop=L("top"),this.safeAreaInsetBottom=L("bottom"),this.safeAreaInsetLeft=L("left"),this.safeAreaInsetRight=L("right"),this.contentSafeAreaInsets=m.getter("contentSafeAreaInsets"),this.contentSafeAreaInsetTop=G("top"),this.contentSafeAreaInsetBottom=G("bottom"),this.contentSafeAreaInsetLeft=G("left"),this.contentSafeAreaInsetRight=G("right");const Oe=M({isVBma:F,returns:"task"}),et=M({isVBma:F,returns:"either"}),Mc=M({isVBma:F,requires:"web_app_request_fullscreen",version:k,returns:"task"}),to=R=>Mc(Ie=>d(f(R?"web_app_request_fullscreen":"web_app_exit_fullscreen",["fullscreen_changed","fullscreen_failed"],Ie),ne(z=>z.event==="fullscreen_failed"&&z.payload.error!=="ALREADY_FULLSCREEN"?W(new Mr(z.payload.error)):(m.setState({isFullscreen:"is_fullscreen"in z.payload?z.payload.is_fullscreen:!0}),V(void 0)))));this.isMounted=O.isMounted,this.mountFp=Oe(O.mount),this.mount=b(this.mountFp),this.isFullscreen=m.getter("isFullscreen"),this.requestFullscreenFp=to(!0),this.requestFullscreen=b(this.requestFullscreenFp),this.exitFullscreenFp=to(!1),this.exitFullscreen=b(this.exitFullscreenFp);const mt=D(!1);this.isCssVarsBound=C(mt),this.bindCssVarsFp=et(R=>{if(mt())return P(new ht);R||(R=z=>`--vb-viewport-${zn(z)}`);const Ie=[["height",this.height],["stableHeight",this.stableHeight],["width",this.width],["safeAreaInsetTop",this.safeAreaInsetTop],["safeAreaInsetBottom",this.safeAreaInsetBottom],["safeAreaInsetLeft",this.safeAreaInsetLeft],["safeAreaInsetRight",this.safeAreaInsetRight],["contentSafeAreaInsetTop",this.contentSafeAreaInsetTop],["contentSafeAreaInsetBottom",this.contentSafeAreaInsetBottom],["contentSafeAreaInsetLeft",this.contentSafeAreaInsetLeft],["contentSafeAreaInsetRight",this.contentSafeAreaInsetRight]].reduce((z,[be,Se])=>{const ie=R(be);if(ie){const no=()=>{vn(ie,`${Se()}px`)};z.push({update:no,removeListener:Se.sub(no),cssVar:ie})}return z},[]);return Ie.forEach(z=>{z.update()}),mt.set(!0),E(()=>{Ie.forEach(z=>{z.removeListener(),yn(z.cssVar)}),mt.set(!1)})}),this.bindCssVars=b(this.bindCssVarsFp),this.expandFp=et(()=>w("web_app_expand")),this.expand=b(this.expandFp)}}function nc(){const t=i=>({on:a=>{X(i,a)},off:a=>{Ee(i,a)}}),e=t("viewport_changed"),n=t("fullscreen_changed"),r=t("safe_area_changed"),o=t("content_safe_area_changed");return new qs({...d(q(),ye("viewport"),$,Q,x),isFullscreen(){return d(Ve(),K(i=>!!i.vbWebAppFullscreen))},isViewportStable(){return d(Ve(),K(i=>["macos","tdesktop","unigram","webk","weba","web"].includes(i.vbWebAppPlatform)))},offContentSafeAreaInsetsChanged:o.off,offFullscreenChanged:n.off,offSafeAreaInsetsChanged:r.off,offViewportChanged:e.off,onContentSafeAreaInsetsChanged:o.on,onFullscreenChanged:n.on,onSafeAreaInsetsChanged:r.on,onViewportChanged:e.on})}const rc=nc();class As{constructor({request:e}){s(this,"requestAccessFp");s(this,"requestAccess");s(this,"selectFile");s(this,"selectFiles");s(this,"selectFolder");this.requestAccessFp=n=>d(e("web_app_request_storage_access","storage_access_granted",{params:{access_type:n.accessType,multiple:n.multiple,accept:n.accept,max_file_size:n.maxFileSize,read_content:n.readContent}}),I(r=>({accessType:r.access_type,items:r.items.map(o=>({name:o.name,path:o.path,size:o.size,type:o.type,content:o.content,lastModified:o.last_modified}))}))),this.requestAccess=n=>this.requestAccessFp(n)().then(o=>{if(o._tag==="Left")throw o.left;return o.right}),this.selectFile=n=>this.requestAccess({accessType:"file",multiple:!1,...n}),this.selectFiles=n=>this.requestAccess({accessType:"file",multiple:!0,...n}),this.selectFolder=()=>this.requestAccess({accessType:"folder"})}}function sc(){return new As({request:dt})}const oc=sc();class Is{onSetup(e){return _().on("web_app_setup_back_button",r=>{r&&typeof r.is_visible=="boolean"&&e(r.is_visible)})}press(){_().send("back_button_pressed")}}const ic=new Is;class Bs{onSetup(e){return _().on("web_app_setup_main_button",r=>{r&&e(r)})}press(){_().send("main_button_pressed")}}const ac=new Bs;class $s{onSetup(e){return _().on("web_app_setup_secondary_button",r=>{r&&e(r)})}press(){_().send("secondary_button_pressed")}}const uc=new $s;class Ms{onSetup(e){return _().on("web_app_setup_settings_button",r=>{r&&e(r)})}press(){_().send("settings_button_pressed")}}const cc=new Ms;class Ps{onOpen(e){return _().on("web_app_open_popup",r=>{r&&e(r)})}close(e){_().send("popup_closed",{button_id:e})}}const lc=new Ps;class Rs{onExpand(e){return _().on("web_app_expand",()=>{e()})}onRequestContentSafeArea(e){return _().on("web_app_request_content_safe_area",()=>{e()})}onRequestSafeArea(e){return _().on("web_app_request_safe_area",()=>{e()})}onRequestViewport(e){return _().on("web_app_request_viewport",()=>{e()})}onToggleOrientationLock(e){return _().on("web_app_toggle_orientation_lock",r=>{r&&typeof r.locked=="boolean"&&e(r.locked)})}onRequestFullscreen(e){return _().on("web_app_request_fullscreen",()=>{e()})}setFullscreen(e){_().send("fullscreen_changed",{is_fullscreen:e})}setFullscreenFailed(e){_().send("fullscreen_failed",{error:e})}onExitFullscreen(e){return _().on("web_app_exit_fullscreen",()=>{e()})}setContentSafeArea(e){_().send("content_safe_area_changed",e)}setSafeArea(e){_().send("safe_area_changed",e)}setViewport(e){_().send("viewport_changed",e)}}const pc=new Rs;class Vs{onIframeReady(e){return _().on("iframe_ready",r=>{e(r||{})})}onIframeWillReload(e){return _().on("iframe_will_reload",()=>{e()})}onClose(e){return _().on("web_app_close",()=>{e()})}onHideKeyboard(e){return _().on("web_app_hide_keyboard",()=>{e()})}onReady(e){return _().on("web_app_ready",()=>{e()})}onRequestTheme(e){return _().on("web_app_request_theme",()=>{e()})}onBackgroundColorChange(e){return _().on("web_app_set_background_color",r=>{r&&typeof r.color=="string"&&e(r.color)})}onBottomBarColorChange(e){return _().on("web_app_set_bottom_bar_color",r=>{r&&r.color&&e(r.color)})}onHeaderColorChange(e){return _().on("web_app_set_header_color",r=>{r&&("color_key"in r&&r.color_key?e(r.color_key):"color"in r&&r.color&&e(r.color))})}reloadIframe(){_().send("reload_iframe")}setCustomStyle(e){_().send("set_custom_style",e)}setVisibility(e){_().send("visibility_changed",{is_visible:e})}}const dc=new Vs;class Ls{onHapticFeedback(e){return _().on("web_app_trigger_haptic_feedback",r=>{r&&e(r)})}}const hc=new Ls;class Ts{onGetInfo(e){return _().on("web_app_biometry_get_info",()=>{e()})}onOpenSettings(e){return _().on("web_app_biometry_open_settings",()=>{e()})}onRequestAccess(e){return _().on("web_app_biometry_request_access",r=>{e(r||{})})}onRequestAuth(e){return _().on("web_app_biometry_request_auth",r=>{e(r||{})})}onUpdateToken(e){return _().on("web_app_biometry_update_token",r=>{r&&e(r)})}setInfoReceived(e){_().send("biometry_info_received",e)}setAuthRequested(e){_().send("biometry_auth_requested",e)}setTokenUpdated(e){_().send("biometry_token_updated",e)}}const fc=new Ts;class Os{onOpenInvoice(e){return _().on("web_app_open_invoice",r=>{r&&e(r)})}setInvoiceClosed(e){_().send("invoice_closed",e)}}const _c=new Os;class js{onOpenPopup(e){return _().on("web_app_open_scan_qr_popup",r=>{e(r||{})})}onClosePopup(e){return _().on("web_app_close_scan_qr_popup",()=>{e()})}sendQrTextReceived(e){_().send("qr_text_received",e)}closePopup(){_().send("scan_qr_popup_closed")}}const bc=new js;class Hs{onCheckLocation(e){return _().on("web_app_check_location",()=>{e()})}onOpenLocationSettings(e){return _().on("web_app_open_location_settings",()=>{e()})}onRequestLocation(e){return _().on("web_app_request_location",()=>{e()})}setLocationChecked(e){_().send("location_checked",e)}setLocationRequested(e){_().send("location_requested",e)}}const mc=new Hs;class Ds{onOpenLink(e){return _().on("web_app_open_link",r=>{r&&e(r)})}onOpenTgLink(e){return _().on("web_app_open_vb_link",r=>{r&&e(r)})}}const gc=new Ds;class Ws{onRequestAccess(e){return _().on("web_app_request_emoji_status_access",()=>{e()})}onSetEmojiStatus(e){return _().on("web_app_set_emoji_status",r=>{r&&e(r)})}setAccessRequested(e){_().send("emoji_status_access_requested",e)}setEmojiStatusSet(e){_().send("emoji_status_set",e)}setEmojiStatusFailed(e){_().send("emoji_status_failed",e)}}const wc=new Ws;class Us{onAddToHomeScreen(e){return _().on("web_app_add_to_home_screen",()=>{e()})}onCheckHomeScreen(e){return _().on("web_app_check_home_screen",()=>{e()})}setHomeScreenChecked(e){_().send("home_screen_checked",e)}setHomeScreenAdded(){_().send("home_screen_added")}setHomeScreenFailed(e){_().send("home_screen_failed",e)}}const vc=new Us;class Ns{onRequestPhone(e){return _().on("web_app_request_phone",()=>{e()})}onRequestWriteAccess(e){return _().on("web_app_request_write_access",()=>{e()})}setPhoneRequested(e){_().send("phone_requested",e)}setWriteAccessRequested(e){_().send("write_access_requested",e)}}const yc=new Ns;class Gs{onSetupClosingBehavior(e){return _().on("web_app_setup_closing_behavior",r=>{r&&e(r)})}}const Sc=new Gs;class zs{onSetupSwipeBehavior(e){return _().on("web_app_setup_swipe_behavior",r=>{r&&e(r)})}}const Fc=new zs;class Js{onReadText(e){return _().on("web_app_read_text_from_clipboard",r=>{r&&e(r)})}sendTextReceived(e){_().send("clipboard_text_received",e)}}const Cc=new Js;class Ks{onRequestFileDownload(e){return _().on("web_app_request_file_download",r=>{e(r||{})})}setFileDownloadRequested(e){_().send("file_download_requested",e)}}const kc=new Ks;class Qs{onSendPreparedMessage(e){return _().on("web_app_send_prepared_message",r=>{r&&e(r)})}onShareToStory(e){return _().on("web_app_share_to_story",r=>{e(r||{})})}setPreparedMessageFailed(e){_().send("prepared_message_failed",e)}setPreparedMessageSent(){_().send("prepared_message_sent")}}const Ec=new Qs;class Zs{onDataSend(e){return _().on("web_app_data_send",r=>{r&&e(r)})}onSwitchInlineQuery(e){return _().on("web_app_switch_inline_query",r=>{r&&e(r)})}}const qc=new Zs;class Ys{onInvokeCustomMethod(e){return _().on("web_app_invoke_custom_method",r=>{r&&e(r)})}setCustomMethodInvoked(e){_().send("custom_method_invoked",e)}}const Ac=new Ys;class Xs{onSend(e){return _().on("web_app_send_notification",r=>{r&&e(r)})}}const Ic=new Xs;class xs{setTheme(e){_().send("theme_changed",{theme_params:e})}onRequestTheme(e){return _().on("web_app_request_theme",()=>{e()})}}const Bc=new xs;function eo(t={}){const{version:e,isInlineMode:n,themeParams:r}=t;if(e&&typeof n=="boolean"&&r)dn.set(e),En.set(n),Fn.set(r);else{const c=d(Ve(),Ct(l=>l,l=>{dn.set(e||l.vbWebAppVersion),En.set(typeof n=="boolean"?n:!!l.vbWebAppBotInline),Fn.set(r||l.vbWebAppThemeParams)}));if(c)return P(c)}t.postEvent&&Lr.set(t.postEvent);const[o,i]=ze(X("reload_iframe",()=>{ce().log("Received a request to reload the page"),Tr("iframe_will_reload"),window.location.reload()})),{acceptCustomStyles:a=!0}=t;if(a){const c=document.createElement("style");c.id="vbot-custom-styles",document.head.appendChild(c),o(X("set_custom_style",l=>{c.innerHTML=l}),()=>{document.head.removeChild(c)})}return d(Ae("iframe_ready",{reload_supported:!0}),K(()=>(ce().log("The package was initialized"),i)))}const $c=re(eo);return u.AccessDeniedError=pn,u.BackButton=Vr,u.Biometry=jr,u.CSSVarsBoundError=ht,u.CancelledError=Nn,u.ClosingBehavior=Dr,u.CloudStorage=Wr,u.ConcurrentCallError=ft,u.DeviceStorage=Nr,u.DeviceStorageMethodError=qr,u.FullscreenFailedError=Mr,u.FunctionUnavailableError=Br,u.HapticFeedback=Kr,u.HostBackButton=Is,u.HostBiometry=Ts,u.HostChat=Zs,u.HostClipboard=Js,u.HostClosingBehavior=Gs,u.HostCustomMethod=Ys,u.HostEmojiStatus=Ws,u.HostFiles=Ks,u.HostHapticFeedback=Ls,u.HostHomeScreen=Us,u.HostInvoice=Os,u.HostLink=Ds,u.HostLocationManager=Hs,u.HostMainButton=Bs,u.HostMiniApp=Vs,u.HostNotification=Xs,u.HostPopup=Ps,u.HostPrivacy=Ns,u.HostQrScanner=js,u.HostSecondaryButton=$s,u.HostSettingsButton=Ms,u.HostSharing=Qs,u.HostSwipeBehavior=zs,u.HostThemeParams=xs,u.HostViewport=Rs,u.InitData=Yr,u.InvalidArgumentsError=oe,u.InvalidEnvError=aa,u.InvalidLaunchParamsError=en,u.Invoice=Xr,u.InvokeCustomMethodFailedError=dr,u.LaunchParamsRetrieveError=pr,u.LocationManager=ts,u.MainButton=ns,u.MethodParameterUnsupportedError=lr,u.MethodUnsupportedError=cr,u.MiniApp=is,u.NotAvailableError=Ir,u.Notification=us,u.Popup=cs,u.QrScanner=ds,u.Refresh=hs,u.SecondaryButton=fs,u.SecureStorage=_s,u.SecureStorageMethodError=Ar,u.SetEmojiStatusError=$r,u.SettingsButton=bs,u.ShareMessageError=Pr,u.StoragePermission=As,u.SwipeBehavior=ms,u.ThemeParams=ss,u.TimeoutError=Gt,u.UnknownEnvError=tn,u.UnknownThemeParamsKeyError=Rr,u.ValidationError=Ye,u.Viewport=qs,u.addToHomeScreen=Ma,u.addToHomeScreenFp=Qr,u.applyPolyfills=na,u.backButton=pa,u.biometry=_a,u.checkHomeScreenStatus=Va,u.checkHomeScreenStatusFp=Zr,u.closingBehavior=ma,u.cloudStorage=wa,u.copyTextToClipboard=Bu,u.createLogger=Qn,u.createPostEvent=xi,u.createRequestId=bt,u.createStartParam=sa,u.createStartParamFp=kr,u.debug=br,u.decodeBase64Url=ra,u.decodeBase64UrlFp=cn,u.decodeStartParam=oa,u.decodeStartParamFp=Er,u.deepSnakeToCamelObjKeys=zt,u.defineHostBridge=Zi,u.defineWebComponentBridge=Yi,u.deviceStorage=ya,u.downloadFile=Pu,u.downloadFileFp=gs,u.emitEvent=Ze,u.encodeBase64Url=ln,u.getCurrentTime=Lu,u.getCurrentTimeFp=ws,u.getHostBridge=_,u.getReleaseVersion=un,u.hapticFeedback=Ia,u.hideKeyboard=ju,u.hideKeyboardFp=vs,u.hostBackButton=ic,u.hostBiometry=fc,u.hostChat=qc,u.hostClipboard=Cc,u.hostClosingBehavior=Sc,u.hostCustomMethod=Ac,u.hostEmojiStatus=wc,u.hostFiles=kc,u.hostHapticFeedback=hc,u.hostHomeScreen=vc,u.hostInvoice=_c,u.hostLink=gc,u.hostLocationManager=mc,u.hostMainButton=ac,u.hostMiniApp=dc,u.hostNotification=Ic,u.hostPopup=lc,u.hostPrivacy=yc,u.hostQrScanner=bc,u.hostSecondaryButton=uc,u.hostSettingsButton=cc,u.hostSharing=Ec,u.hostSwipeBehavior=Fc,u.hostThemeParams=Bc,u.hostViewport=pc,u.init=$c,u.initData=Ta,u.initFp=eo,u.invoice=ja,u.invokeCustomMethod=Ur,u.isAnyRGB=er,u.isColorDark=Sn,u.isColorDarkFp=rs,u.isRGB=Ke,u.isRGBA=xn,u.isRGBAShort=Xn,u.isRGBShort=Yn,u.isSafeToCreateStartParam=ia,u.isVBma=Ji,u.isVBmaFp=an,u.locationManager=Ya,u.logger=ce,u.mainButton=xa,u.miniApp=as,u.mockVBotEnv=Ki,u.notification=ru,u.off=Ee,u.offAll=Ni,u.on=X,u.openLink=Wa,u.openLinkFp=xr,u.openVBotLink=Ga,u.openVBotLinkFp=wn,u.parseInitDataQuery=Ri,u.parseInitDataQueryFp=or,u.parseLaunchParamsQuery=Yt,u.parseLaunchParamsQueryFp=pt,u.popup=iu,u.postEvent=Tr,u.postEventFp=Ae,u.qrScanner=vu,u.readTextFromClipboard=Wu,u.readTextFromClipboardFp=ys,u.refresh=Su,u.request=da,u.request2=ha,u.request2Fp=bn,u.requestContact=_u,u.requestContactComplete=fu,u.requestContactCompleteFp=kn,u.requestContactFp=ls,u.requestEmojiStatusAccess=Ca,u.requestEmojiStatusAccessFp=zr,u.requestFp=Hr,u.requestPhoneAccess=cu,u.requestPhoneAccessFp=Cn,u.requestWriteAccess=gu,u.requestWriteAccessFp=ps,u.retrieveAndroidDeviceData=Uu,u.retrieveAndroidDeviceDataFrom=Ss,u.retrieveLaunchParams=Li,u.retrieveLaunchParamsFp=Ve,u.retrieveRawInitData=Ti,u.retrieveRawInitDataFp=nn,u.retrieveRawLaunchParams=Oi,u.retrieveRawLaunchParamsFp=Qe,u.secondaryButton=Cu,u.secureStorage=Eu,u.sendData=zu,u.sendDataFp=Fs,u.serializeInitDataQuery=ar,u.serializeLaunchParamsQuery=Xt,u.setDebug=Hi,u.setEmojiStatus=qa,u.setEmojiStatusFp=Jr,u.setLaunchParams=Qi,u.setTargetOrigin=Di,u.settingsButton=qu,u.shareMessage=Qu,u.shareMessageFp=Cs,u.shareStory=Xu,u.shareStoryFp=ks,u.shareURL=Ka,u.shareURLFp=es,u.storagePermission=oc,u.supports=_e,u.swipeBehavior=Iu,u.switchInlineQuery=tc,u.switchInlineQueryFp=Es,u.targetOrigin=mr,u.themeParams=xe,u.toRGB=qi,u.toRGBFp=nr,u.toRGBFull=Ai,u.toRGBFullFp=lt,u.viewport=rc,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),u})({});
4
4
  //# sourceMappingURL=index.iife.js.map