@tma.js/sdk 3.0.5 → 3.0.6

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.
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var cr=Object.defineProperty;var pr=(r,t,s)=>t in r?cr(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var e=(r,t,s)=>pr(r,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("@tma.js/signals"),h=require("@tma.js/bridge"),V=require("@tma.js/toolkit"),lr=require("better-promises"),q=require("@tma.js/transformers"),K=require("error-kid"),y=require("valibot");var hr=function(r,t,s){if(s||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return r.concat(o||Array.prototype.slice.call(t))};function ot(r,t,s,n,i,o,u,a,l){switch(arguments.length){case 1:return r;case 2:return function(){return t(r.apply(this,arguments))};case 3:return function(){return s(t(r.apply(this,arguments)))};case 4:return function(){return n(s(t(r.apply(this,arguments))))};case 5:return function(){return i(n(s(t(r.apply(this,arguments)))))};case 6:return function(){return o(i(n(s(t(r.apply(this,arguments))))))};case 7:return function(){return u(o(i(n(s(t(r.apply(this,arguments)))))))};case 8:return function(){return a(u(o(i(n(s(t(r.apply(this,arguments))))))))};case 9:return function(){return l(a(u(o(i(n(s(t(r.apply(this,arguments)))))))))}}}function c(r,t,s,n,i,o,u,a,l){switch(arguments.length){case 1:return r;case 2:return t(r);case 3:return s(t(r));case 4:return n(s(t(r)));case 5:return i(n(s(t(r))));case 6:return o(i(n(s(t(r)))));case 7:return u(o(i(n(s(t(r))))));case 8:return a(u(o(i(n(s(t(r)))))));case 9:return l(a(u(o(i(n(s(t(r))))))));default:{for(var p=arguments[0],_=1;_<arguments.length;_++)p=arguments[_](p);return p}}}var he=function(r,t){var s=typeof r=="number"?function(n){return n.length>=r}:r;return function(){var n=Array.from(arguments);return s(arguments)?t.apply(this,n):function(i){return t.apply(void 0,hr([i],n,!1))}}},dr={_tag:"None"},fr=function(r){return{_tag:"Some",value:r}},mr=function(r){return r._tag==="Left"},it=function(r){return{_tag:"Left",left:r}},at=function(r){return{_tag:"Right",right:r}},qe={};function br(r,t){return function(s){return function(n){return r.ap(r.map(n,function(i){return function(o){return t.ap(i,o)}}),s)}}}function _r(r,t){return function(s){return function(n){return r.map(n,function(i){return t.map(i,s)})}}}function xe(r){return function(t,s){return function(n){return r.chain(n,function(i){return r.map(s(i),function(o){var u;return Object.assign({},i,(u={},u[t]=o,u))})})}}}var O=it,I=at,gr=he(2,function(r,t){return ne(r)?r:t(r.right)}),Me=function(r,t){return c(r,H(t))},ut=function(r,t){return c(r,Sr(t))},Te="Either",H=function(r){return function(t){return ne(t)?t:I(r(t.right))}},Fr={URI:Te,map:Me},Cr=I,wr=function(r){return function(t){return ne(t)?t:ne(r)?r:I(t.right(r.right))}},Sr=wr,vr={URI:Te,map:Me,ap:ut},yr={URI:Te,map:Me,ap:ut,chain:gr},kr=function(r,t){return function(s){return ne(s)?O(r(s.left)):I(t(s.right))}},ne=mr,ct=function(r,t){return function(s){return ne(s)?r(s.left):t(s.right)}},de=ct,Er=function(r,t){try{return I(r())}catch(s){return O(t(s))}},Ar=Cr(qe),Br=xe(yr),rt=Br;function U(r){return typeof r=="function"?r():r}function Y(r,t){return g.computed(()=>h.supports(r,U(t)))}var ie=dr,fe=fr,Pr=function(r,t){return c(r,xr(t))},Ir=function(r,t){return c(r,Tr(t))},qr="Option",xr=function(r){return function(t){return pe(t)?ie:fe(r(t.value))}},Mr=fe,Tr=function(r){return function(t){return pe(t)||pe(r)?ie:fe(t.value(r.value))}},Lr=he(2,function(r,t){return pe(r)?ie:t(r.value)}),Or={URI:qr,map:Pr,ap:Ir,chain:Lr},pe=function(r){return r._tag==="None"},Vr=function(r,t){return function(s){return pe(s)?r():t(s.value)}},pt=Vr,Rr=Mr(qe),st=xe(Or);function $r(r){return ot(I,r.of)}function jr(r){return ot(O,r.of)}function Dr(r){return _r(r,Fr)}function Ur(r){return br(r,vr)}function Gr(r){return function(t,s){return r.chain(t,function(n){return ne(n)?r.of(n):s(n.right)})}}function Hr(r){return function(t,s,n){return r.map(t,kr(s,n))}}function Qr(r){return function(t,s){return function(n){return r.map(n,de(t,s))}}}var Le=function(r,t){return c(r,Wr(t))},lt=function(r,t){return c(r,Kr(t))},Wr=function(r){return function(t){return function(){return Promise.resolve().then(t).then(r)}}},Kr=function(r){return function(t){return function(){return Promise.all([Promise.resolve().then(t),Promise.resolve().then(r)]).then(function(s){var n=s[0],i=s[1];return n(i)})}}},Oe=function(r){return function(){return Promise.resolve(r)}},zr=he(2,function(r,t){return function(){return Promise.resolve().then(r).then(function(s){return t(s)()})}}),Ve="Task",Re={URI:Ve,map:Le},ht={of:Oe},Nr={URI:Ve,map:Le,ap:lt},Jr={URI:Ve,map:Le,of:Oe,ap:lt,chain:zr},Yr=function(r,t,s,n){function i(o){return o instanceof s?o:new s(function(u){u(o)})}return new(s||(s=Promise))(function(o,u){function a(_){try{p(n.next(_))}catch(b){u(b)}}function l(_){try{p(n.throw(_))}catch(b){u(b)}}function p(_){_.done?o(_.value):i(_.value).then(a,l)}p((n=n.apply(r,t||[])).next())})},Zr=function(r,t){var s={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,u;return u={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(p){return function(_){return l([p,_])}}function l(p){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,p[0]&&(s=0)),s;)try{if(n=1,i&&(o=p[0]&2?i.return:p[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,p[1])).done)return o;switch(i=0,o&&(p=[p[0]&2,o.value]),p[0]){case 0:case 1:o=p;break;case 4:return s.label++,{value:p[1],done:!1};case 5:s.label++,i=p[1],p=[0];continue;case 7:p=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!(o=o.length>0&&o[o.length-1])&&(p[0]===6||p[0]===2)){s=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]<o[3])){s.label=p[1];break}if(p[0]===6&&s.label<o[1]){s.label=o[1],o=p;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(p);break}o[2]&&s.ops.pop(),s.trys.pop();continue}p=t.call(r,s)}catch(_){p=[6,_],i=0}finally{n=o=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},$=jr(ht),T=$r(ht),dt=Oe,Xr=Qr(Re),es=function(r,t){return function(){return Yr(void 0,void 0,void 0,function(){var s;return Zr(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,r().then(at)];case 1:return[2,n.sent()];case 2:return s=n.sent(),[2,it(t(s))];case 3:return[2]}})})}},ts=function(r,t){return c(r,M(t))},rs=function(r,t){return c(r,ss(t))},M=Dr(Re),$e=he(3,Hr(Re)),ss=Ur(Nr),je=he(2,Gr(Jr)),ns=T,os="TaskEither",is={URI:os,map:ts,ap:rs,chain:je},as=ns(qe),us=xe(is),Ce=us,X=je,ae=je;function oe(r){return[r]}class ce extends K.errorClassWithData("ValidationError",(t,s)=>({input:t,issues:s}),"Validation error"){}class we extends K.errorClass("CSSVarsBoundError","CSS variables are already bound"){}class ft extends K.errorClass("NotAvailableError",oe){}class cs extends K.errorClass("InvalidEnvError",oe){}class mt extends K.errorClass("FunctionNotAvailableError",oe){}class J extends K.errorClass("InvalidArgumentsError",(t,s)=>[t,{cause:s}]){}class Se extends K.errorClass("ConcurrentCallError",oe){}class bt extends K.errorClass("SetEmojiStatusError",t=>[`Failed to set emoji status: ${t}`]){}class De extends K.errorClass("AccessDeniedError",oe){}class _t extends K.errorClass("FullscreenFailedError",oe){}class gt extends K.errorClass("ShareMessageError",oe){}class Ft extends K.errorClass("UnknownThemeParamsKeyError",t=>[`Unknown theme params key passed: ${t}`]){}function P(r,t){const s=g.computed(()=>U(t.version)||"100"),n=g.computed(()=>U(t.isTma)),{requires:i,returns:o}=t,u=i?typeof i=="object"?i:{every:[i]}:void 0,a=m=>{if(!t.supports)return!0;const F=t.supports[m];return h.supports(F.method,F.param,s())},l=()=>{if(!u)return;const[m,F]="every"in u?["every",u.every]:["some",u.some];for(let f=0;f<F.length;f++){const x=F[f],D=typeof x=="function"?x():h.supports(x,s())?void 0:`it is unsupported in Mini Apps version ${s()}`;if(D&&(m==="every"||f===F.length-1))return D}},p=(...m)=>{for(const F in t.supports)if(t.supports[F].shouldCheck(...m)&&!a(F))return`option ${F} is not supported in Mini Apps version ${s()}`},_=g.computed(()=>!l()),b=g.computed(()=>s()!=="0.0"),C=g.computed(()=>t.isMounted?t.isMounted():!0),S=g.computed(()=>n()&&b()&&_()&&C()),E=m=>{const F=new mt(m);return["task","promise"].includes(t.returns)?$(F):O(F)},v=(...m)=>o==="plain"?Er(()=>r(...m),F=>F):o==="promise"?es(()=>r(...m),F=>F):r(...m);return Object.assign((...m)=>{var D;const F="Unable to call function:";if(!n())return E(`${F} it can't be called outside Mini Apps`);if(!b())return E(`${F} the SDK was not initialized. Use the SDK init() function`);const f=l();if(f)return E(`${F} ${f}`);const x=p(...m);if(x)return E(`${F} ${x}`);if(!C()){const R=(D=t.isMounting)!=null&&D.call(t)?"mounting. Wait for the mount completion":"unmounted. Use the mount() method";return E(`${F} the component is ${R}`)}return v(...m)},r,{isAvailable:S,ifAvailable(...m){return S()?fe(v(...m)):ie}},u?{isSupported:_}:{},t.supports?{supports:a}:{})}function B(r){return t=>P(t,r)}function d(r){return Object.assign(V.throwifyFpFn(r),{ifAvailable(...t){return c(r.ifAvailable(...t),pt(()=>({ok:!1}),s=>({ok:!0,data:V.throwifyAnyEither(s)})))}})}function Ae(r){const t={};for(const s in r){const n=r[s];n!==void 0&&(t[s]=n)}return t}function ye(r,t){const s=Object.keys(r),n=Object.keys(t);return s.length!==n.length?!1:s.every(i=>Object.prototype.hasOwnProperty.call(t,i)&&r[i]===t[i])}class te{constructor({initialState:t,onChange:s}){e(this,"_state");e(this,"state");e(this,"setState",t=>{const s={...this.state(),...Ae(t)};ye(s,this.state())||this._state.set(s)});this._state=g.signal(t,{equals:ye}),this.state=g.computed(this._state),this.state.sub(s)}getter(t){return g.computed(()=>this._state()[t])}hasDiff(t){return!ye({...this.state(),...Ae(t)},this.state())}}class me{constructor({onMounted:t,restoreState:s,initialState:n,onUnmounted:i,isPageReload:o}){e(this,"_isMounted",g.signal(!1));e(this,"isMounted",g.computed(this._isMounted));e(this,"mount");e(this,"unmount");this.mount=()=>{if(this.isMounted())return I(void 0);const u=U(o)?s():void 0,a=u?I(u):typeof n=="function"?n():I(n);return c(a,H(l=>{g.batch(()=>{this._isMounted.set(!0),t==null||t(l)})}))},this.unmount=()=>{this._isMounted()&&g.batch(()=>{this._isMounted.set(!1),i==null||i()})}}}class ve{constructor({isTma:t,storage:s,onClick:n,offClick:i,initialState:o,isPageReload:u,postEvent:a,payload:l,method:p,version:_}){e(this,"isMounted");e(this,"isSupported");e(this,"state");e(this,"stateSetters");e(this,"stateBoolSetters");e(this,"setStateFp");e(this,"setState");e(this,"onClickFp");e(this,"onClick");e(this,"offClickFp");e(this,"offClick");e(this,"mountFp");e(this,"mount");e(this,"unmount");const b=new te({initialState:o,onChange(m){s.set(m)}}),C=new me({initialState:o,isPageReload:u,onMounted:b.setState,restoreState:s.get}),S={version:_,requires:p,isTma:t},E=B({...S,returns:"plain"}),v=B({...S,returns:"either",isMounted:C.isMounted});this.isMounted=C.isMounted,this.isSupported=Y(p,_),this.state=b.state,this.setStateFp=v(m=>{const F={...this.state(),...Ae(m)};return b.hasDiff(F)?c(a(p,l(F)),H(()=>{b.setState(F)})):I(void 0)}),this.setState=d(this.setStateFp),this.onClickFp=E(n),this.onClick=d(this.onClickFp),this.offClickFp=E(i),this.offClick=d(this.offClickFp),this.mountFp=E(()=>{const m=()=>{};return c(C.mount(),de(m,m))}),this.mount=d(this.mountFp),this.unmount=C.unmount,this.stateSetters=m=>{const F=v(f=>this.setStateFp({[m]:f}));return[d(F),F]},this.stateBoolSetters=m=>{const[,F]=this.stateSetters(m),f=v(()=>F(!1)),x=v(()=>F(!0));return[[d(f),f],[d(x),x]]}}stateGetter(t){return g.computed(()=>this.state()[t])}}class Ct{constructor(t){e(this,"isVisible");e(this,"isMounted");e(this,"isSupported");e(this,"hideFp");e(this,"hide");e(this,"showFp");e(this,"show");e(this,"onClickFp");e(this,"onClick");e(this,"offClickFp");e(this,"offClick");e(this,"mountFp");e(this,"mount");e(this,"unmount");const s=new ve({...t,method:"web_app_setup_back_button",payload:n=>({is_visible:n.isVisible}),initialState:{isVisible:!1}});this.isVisible=s.stateGetter("isVisible"),this.isMounted=s.isMounted,this.isSupported=s.isSupported,[[this.hide,this.hideFp],[this.show,this.showFp]]=s.stateBoolSetters("isVisible"),this.onClick=s.onClick,this.onClickFp=s.onClickFp,this.offClick=s.offClick,this.offClickFp=s.offClickFp,this.mount=s.mount,this.mountFp=s.mountFp,this.unmount=s.unmount}}function w(){return{isTma:g.computed(()=>h.isTMAFp())}}function ps(r){return{get:()=>V.getStorageValue(r),set(t){V.setStorageValue(r,t)}}}function ls(){return performance.getEntriesByType("navigation")[0]}function hs(){const r=ls();return!!r&&r.type==="reload"}function be(r){return t=>({...t,...U(r)})}function re(r){return be({storage:ps(r),isPageReload:hs})}function _e(r,t){return g.signal(r,t)}const wt=_e(h.postEventFp),ue=(...r)=>wt()(...r),St=(...r)=>V.throwifyAnyEither(ue(...r)),j=be({postEvent:ue}),Be=_e("0.0"),k=be({version:Be});function Ue(r,t){return{...c(w(),j,k,re(r)),onClick(s,n){return h.on(t,s,n)},offClick(s,n){h.off(t,s,n)}}}const ds=new Ct(Ue("backButton","back_button_pressed"));class Ge{constructor({initialState:t,onMounted:s,restoreState:n,onUnmounted:i,isPageReload:o}){e(this,"_isMounted",g.signal(!1));e(this,"isMounted",g.computed(this._isMounted));e(this,"mount");e(this,"unmount");this.mount=u=>{if(this._isMounted())return T(void 0);const a=U(o)?n():void 0;return c(a?T(a):t(u),M(l=>{this._isMounted()||g.batch(()=>{this._isMounted.set(!0),s==null||s(l)})}))},this.unmount=()=>{this._isMounted()&&g.batch(()=>{this._isMounted.set(!1),i==null||i()})}}}const nt=new ft("Biometry is not available");function ke(r){let t=!1,s=!1,n="",i=!1,o="",u=!1;return r.available&&(t=!0,s=r.token_saved,n=r.device_id,i=r.access_requested,o=r.type,u=r.access_granted),{available:t,tokenSaved:s,deviceId:n,type:o,accessGranted:u,accessRequested:i}}class vt{constructor({version:t,request:s,postEvent:n,storage:i,onInfoReceived:o,offInfoReceived:u,isTma:a,isPageReload:l}){e(this,"isAvailable");e(this,"isSupported");e(this,"isMounted");e(this,"state");e(this,"authenticateFp");e(this,"authenticate");e(this,"openSettingsFp");e(this,"openSettings");e(this,"requestAccessFp");e(this,"requestAccess");e(this,"updateTokenFp");e(this,"updateToken");e(this,"mountFp");e(this,"mount");e(this,"unmount");const p=m=>{_.setState(ke(m))},_=new te({initialState:{available:!1,type:"unknown",accessGranted:!1,accessRequested:!1,deviceId:"",tokenSaved:!1},onChange:i.set}),b=new Ge({initialState(m){return c(s("web_app_biometry_get_info","biometry_info_received",m),M(ke))},isPageReload:l,onMounted(m){_.setState(m),o(p)},onUnmounted(){u(p)},restoreState:i.get}),C={version:t,requires:"web_app_biometry_request_auth",isTma:a},S=B({...C,returns:"either"}),E=B({...C,returns:"task"}),v=B({...C,isMounted:b.isMounted,returns:"task"});this.isAvailable=_.getter("available"),this.isMounted=b.isMounted,this.isSupported=Y("web_app_biometry_request_auth",t),this.state=_.state,this.unmount=b.unmount,this.mountFp=E(b.mount),this.authenticateFp=v(m=>this.isAvailable()?c(s("web_app_biometry_request_auth","biometry_auth_requested",{...m,params:{reason:((m||{}).reason||"").trim()}}),M(F=>(_.setState({token:F.token}),F))):$(nt)),this.openSettingsFp=S(()=>n("web_app_biometry_open_settings")),this.requestAccessFp=v(m=>c(s("web_app_biometry_request_access","biometry_info_received",{...m,params:{reason:((m||{}).reason||"").trim()}}),X(F=>{const f=ke(F);return f.available?(_.setState(f),T(f.accessRequested)):$(nt)}))),this.updateTokenFp=v((m={})=>{var F;return c(s("web_app_biometry_update_token","biometry_token_updated",{...m,params:{token:m.token||"",reason:(F=m.reason)==null?void 0:F.trim()}}),M(f=>f.status))}),this.authenticate=d(this.authenticateFp),this.openSettings=d(this.openSettingsFp),this.requestAccess=d(this.requestAccessFp),this.updateToken=d(this.updateTokenFp),this.mount=d(this.mountFp)}}const He=(r,t,s)=>h.requestFp(r,t,{postEvent:ue,...s}),fs=(...r)=>lr.BetterPromise.fn(()=>He(...r)()),Q=be({request:He}),ms=new vt({...c(w(),j,k,Q,re("biometry")),offInfoReceived(r){h.off("biometry_info_received",r)},onInfoReceived(r){return h.on("biometry_info_received",r)}});class yt{constructor({postEvent:t,storage:s,isTma:n,isPageReload:i}){e(this,"isConfirmationEnabled");e(this,"isMounted");e(this,"mountFp");e(this,"mount");e(this,"unmount");e(this,"disableConfirmationFp");e(this,"disableConfirmation");e(this,"enableConfirmationFp");e(this,"enableConfirmation");const o=new te({initialState:{isConfirmationEnabled:!1},onChange(b){s.set(b)}}),u=new me({onMounted:o.setState,restoreState:s.get,initialState:{isConfirmationEnabled:!1},isPageReload:i}),a={requires:"web_app_setup_closing_behavior",isTma:n},l=B({...a,returns:"plain"}),p=B({...a,returns:"either",isMounted:u.isMounted}),_=b=>b===this.isConfirmationEnabled()?I(void 0):(o.setState({isConfirmationEnabled:b}),t("web_app_setup_closing_behavior",{need_confirmation:b}));this.isConfirmationEnabled=o.getter("isConfirmationEnabled"),this.isMounted=u.isMounted,this.disableConfirmationFp=p(()=>_(!1)),this.enableConfirmationFp=p(()=>_(!0)),this.mountFp=l(()=>{const b=()=>{};return c(u.mount(),de(b,b))}),this.unmount=u.unmount,this.disableConfirmation=d(this.disableConfirmationFp),this.enableConfirmation=d(this.enableConfirmationFp),this.mount=d(this.mountFp)}}const bs=new yt(c(w(),re("closingBehavior"),j));class kt{constructor({version:t,isTma:s,invokeCustomMethod:n}){e(this,"isSupported");e(this,"deleteItemFp");e(this,"deleteItem");e(this,"getItemFp");e(this,"getItem");e(this,"getItemsFp");e(this,"getItems");e(this,"getKeysFp");e(this,"getKeys");e(this,"setItemFp");e(this,"setItem");e(this,"clearFp");e(this,"clear");const i=B({version:t,requires:"web_app_invoke_custom_method",isTma:s,returns:"task"});this.isSupported=Y("web_app_invoke_custom_method",t),this.deleteItemFp=i((o,u)=>{const a=Array.isArray(o)?o:[o];return c(a.length?n("deleteStorageValues",{keys:a},u):T(void 0),M(()=>{}))}),this.getItemFp=i((o,u)=>c(this.getItemsFp([o],u),M(a=>a[o]||""))),this.getItemsFp=i((o,u)=>c(o.length?n("getStorageValues",{keys:o},u):T({}),M(a=>({...o.reduce((l,p)=>(l[p]="",l),{}),...y.parse(y.record(y.string(),y.string()),a)})))),this.getKeysFp=i(o=>c(n("getStorageKeys",{},o),M(u=>y.parse(y.array(y.string()),u)))),this.setItemFp=i((o,u,a)=>c(n("saveStorageValue",{key:o,value:u},a),M(()=>{}))),this.clearFp=i(o=>c(this.getKeysFp(o),X(this.deleteItemFp))),this.deleteItem=d(this.deleteItemFp),this.getItem=d(this.getItemFp),this.getItems=d(this.getItemsFp),this.getKeys=d(this.getKeysFp),this.setItem=d(this.setItemFp),this.clear=d(this.clearFp)}}const Ee=_e(0);function Qe(){return Ee.set(Ee()+1),Ee().toString()}function Et(r,t,s){return h.invokeCustomMethodFp(r,t,Qe(),{...s||{},postEvent:ue})}const We=be({invokeCustomMethod:Et}),_s=new kt(c(w(),k,We));function gs({request:r,...t}){return P(s=>c(r("web_app_request_emoji_status_access","emoji_status_access_requested",s),M(n=>n.status)),{...t,requires:"web_app_request_emoji_status_access",returns:"task"})}const At=gs(c(w(),k,Q)),Fs=d(At);function Cs({request:r,...t}){return P((s,n)=>c(r("web_app_set_emoji_status",["emoji_status_set","emoji_status_failed"],{params:{custom_emoji_id:s,duration:(n||{}).duration},...n}),ae(i=>i&&"error"in i?$(new bt(i.error)):T(void 0))),{...t,requires:"web_app_set_emoji_status",returns:"task"})}const Bt=Cs(c(w(),Q,k)),ws=d(Bt);class Pt{constructor({postEvent:t,isTma:s,version:n}){e(this,"isSupported");e(this,"impactOccurredFp");e(this,"impactOccurred");e(this,"notificationOccurredFp");e(this,"notificationOccurred");e(this,"selectionChangedFp");e(this,"selectionChanged");const i="web_app_trigger_haptic_feedback",o=B({requires:i,isTma:s,version:n,returns:"plain"});this.isSupported=Y(i,n),this.impactOccurredFp=o(u=>t(i,{type:"impact",impact_style:u})),this.notificationOccurredFp=o(u=>t(i,{type:"notification",notification_type:u})),this.selectionChangedFp=o(()=>t(i,{type:"selection_change"})),this.impactOccurred=d(this.impactOccurredFp),this.notificationOccurred=d(this.notificationOccurredFp),this.selectionChanged=d(this.selectionChangedFp)}}const Ss=new Pt(c(w(),j,k));function vs({postEvent:r,...t}){return P(()=>r("web_app_add_to_home_screen"),{...t,requires:"web_app_add_to_home_screen",returns:"either"})}const It=vs(c(w(),k,j)),ys=d(It);function ks({request:r,...t}){return P(s=>c(r("web_app_check_home_screen","home_screen_checked",s),M(n=>n.status||"unknown")),{...t,requires:"web_app_check_home_screen",returns:"task"})}const qt=ks(c(w(),k,Q)),Es=d(qt);class xt{constructor({retrieveInitData:t}){e(this,"_state",g.signal());e(this,"_raw",g.signal());e(this,"state",g.computed(this._state));e(this,"authDate",this.fromState("auth_date"));e(this,"canSendAfter",this.fromState("can_send_after"));e(this,"canSendAfterDate",g.computed(()=>{const t=this.authDate(),s=this.canSendAfter();return s&&t?new Date(t.getTime()+s*1e3):void 0}));e(this,"chat",this.fromState("chat"));e(this,"chatType",this.fromState("chat_type"));e(this,"chatInstance",this.fromState("chat_instance"));e(this,"hash",this.fromState("hash"));e(this,"queryId",this.fromState("query_id"));e(this,"raw",g.computed(this._raw));e(this,"receiver",this.fromState("receiver"));e(this,"signature",this.fromState("signature"));e(this,"startParam",this.fromState("start_param"));e(this,"user",this.fromState("user"));e(this,"restoreFp");e(this,"restore");this.restoreFp=()=>c(t(),H(pt(()=>{},({raw:s,obj:n})=>{this._state.set(n),this._raw.set(s)}))),this.restore=V.throwifyFpFn(this.restoreFp)}fromState(t){return g.computed(()=>{const s=this._state();return s?s[t]:void 0})}}const As=new xt({retrieveInitData(){return c(Ar,rt("obj",()=>c(h.retrieveLaunchParamsFp(),H(({tgWebAppData:r})=>r?fe(r):ie))),rt("raw",h.retrieveRawInitDataFp),H(({obj:r,raw:t})=>c(Rr,st("obj",()=>r),st("raw",()=>t))))}});class Mt{constructor({version:t,request:s,isTma:n}){e(this,"isOpened");e(this,"isSupported");e(this,"openSlugFp");e(this,"openSlug");e(this,"openUrlFp");e(this,"openUrl");const i=B({version:t,isTma:n,requires:"web_app_open_invoice",returns:"task"}),o=g.signal(!1),u=()=>{o.set(!1)};this.isSupported=Y("web_app_open_invoice",t),this.isOpened=g.computed(o),this.openSlugFp=i((a,l)=>c(this.isOpened()?$(new Se("Invoice is already opened")):T(void 0),X(()=>(o.set(!0),s("web_app_open_invoice","invoice_closed",{...l,params:{slug:a},capture:p=>a===p.slug}))),$e(p=>(u(),p),p=>(u(),p.status)))),this.openUrlFp=i((a,l)=>{const{hostname:p,pathname:_}=new URL(a,window.location.href);if(p!=="t.me")return $(new J(`Link has unexpected hostname: ${p}`));const b=_.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);return b?this.openSlugFp(b[2],l):$(new J('Expected to receive a link with a pathname in format "/invoice/{slug}" or "/${slug}"'))}),this.openUrl=d(this.openUrlFp),this.openSlug=d(this.openSlugFp)}}const Bs=new Mt(c(w(),Q,k));function Ps({postEvent:r,...t}){return P((s,n={})=>{if(typeof s=="string")try{s=new URL(s)}catch(i){return O(new J(`"${s.toString()}" is invalid URL`,i))}return r("web_app_open_link",{url:s.toString(),try_browser:n.tryBrowser,try_instant_view:n.tryInstantView})},{...t,returns:"either"})}const Tt=Ps(c(w(),j)),Is=d(Tt);function qs({postEvent:r,version:t,...s}){return P(n=>{const i=n.toString();return i.match(/^https:\/\/t.me\/.+/)?h.supports("web_app_open_tg_link",U(t))?(n=new URL(n),r("web_app_open_tg_link",{path_full:n.pathname+n.search})):(window.location.href=i,I(void 0)):O(new J(`"${i}" is invalid URL`))},{...s,returns:"either"})}const Ke=qs(c(w(),j,k)),xs=d(Ke);function Ms({openTelegramLink:r,...t}){return P((s,n)=>r("https://t.me/share/url?"+new URLSearchParams({url:s,text:n||""}).toString().replace(/\+/g,"%20")),{...t,returns:"either"})}const Lt=Ms({...w(),openTelegramLink:Ke}),Ts=d(Lt);function Ls(r){let t=!1,s,n;return r.available&&(t=!0,s=r.access_requested,n=r.access_granted),{available:t,accessGranted:n||!1,accessRequested:s||!1}}class Ot{constructor({version:t,request:s,postEvent:n,storage:i,isTma:o,isPageReload:u}){e(this,"state");e(this,"isAvailable");e(this,"isAccessGranted");e(this,"isAccessRequested");e(this,"isMounted");e(this,"isSupported");e(this,"openSettingsFp");e(this,"openSettings");e(this,"requestLocationFp");e(this,"requestLocation");e(this,"mountFp");e(this,"mount");e(this,"unmount");const a=new te({initialState:{available:!1,accessGranted:!1,accessRequested:!1},onChange:i.set}),l=new Ge({isPageReload:u,restoreState:i.get,onMounted:a.setState,initialState(S){return c(s("web_app_check_location","location_checked",S),M(Ls))}}),p={version:t,requires:"web_app_check_location",isTma:o},_=B({...p,returns:"either"}),b=B({...p,returns:"task"}),C=B({...p,returns:"task",isMounted:l.isMounted});this.isAvailable=a.getter("available"),this.isAccessRequested=a.getter("accessRequested"),this.isAccessGranted=a.getter("accessGranted"),this.isSupported=Y("web_app_check_location",t),this.isMounted=l.isMounted,this.state=a.state,this.unmount=l.unmount,this.mountFp=b(l.mount),this.openSettingsFp=_(()=>n("web_app_open_location_settings")),this.requestLocationFp=C(S=>c(s("web_app_request_location","location_requested",S),M(E=>{if(!E.available)return a.setState({available:!1}),null;const{available:v,...m}=E;return m}))),this.mount=d(this.mountFp),this.openSettings=d(this.openSettingsFp),this.requestLocation=d(this.requestLocationFp)}}const Os=new Ot(c(w(),j,k,Q,re("locationManager")));class Vt{constructor({defaults:t,...s}){e(this,"bgColor");e(this,"hasShineEffect");e(this,"isEnabled");e(this,"isLoaderVisible");e(this,"isVisible");e(this,"isMounted");e(this,"state");e(this,"text");e(this,"textColor");e(this,"showFp");e(this,"show");e(this,"hideFp");e(this,"hide");e(this,"enableFp");e(this,"enable");e(this,"enableShineEffectFp");e(this,"enableShineEffect");e(this,"disableFp");e(this,"disable");e(this,"disableShineEffectFp");e(this,"disableShineEffect");e(this,"setBgColorFp");e(this,"setBgColor");e(this,"setTextColorFp");e(this,"setTextColor");e(this,"setTextFp");e(this,"setText");e(this,"showLoaderFp");e(this,"showLoader");e(this,"hideLoaderFp");e(this,"hideLoader");e(this,"setParamsFp");e(this,"setParams");e(this,"mountFp");e(this,"mount");e(this,"unmount");e(this,"onClickFp");e(this,"onClick");e(this,"offClickFp");e(this,"offClick");const n=new ve({...s,version:"100",initialState:{hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Continue"},method:"web_app_setup_main_button",payload:o=>({has_shine_effect:o.hasShineEffect,is_visible:o.isVisible,is_active:o.isEnabled,is_progress_visible:o.isLoaderVisible,text:o.text,color:o.bgColor,text_color:o.textColor})}),i=(o,u)=>{const a=n.stateGetter(o);return g.computed(()=>a()||U(u))};this.bgColor=i("bgColor",t.bgColor),this.textColor=i("textColor",t.textColor),this.hasShineEffect=n.stateGetter("hasShineEffect"),this.isEnabled=n.stateGetter("isEnabled"),this.isLoaderVisible=n.stateGetter("isLoaderVisible"),this.text=n.stateGetter("text"),this.isVisible=n.stateGetter("isVisible"),this.isMounted=n.isMounted,this.state=n.state,[this.setBgColor,this.setBgColorFp]=n.stateSetters("bgColor"),[this.setTextColor,this.setTextColorFp]=n.stateSetters("textColor"),[[this.disableShineEffect,this.disableShineEffectFp],[this.enableShineEffect,this.enableShineEffectFp]]=n.stateBoolSetters("hasShineEffect"),[[this.disable,this.disableFp],[this.enable,this.enableFp]]=n.stateBoolSetters("isEnabled"),[[this.hideLoader,this.hideLoaderFp],[this.showLoader,this.showLoaderFp]]=n.stateBoolSetters("isLoaderVisible"),[this.setText,this.setTextFp]=n.stateSetters("text"),[[this.hide,this.hideFp],[this.show,this.showFp]]=n.stateBoolSetters("isVisible"),this.setParams=n.setState,this.setParamsFp=n.setStateFp,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 Rt(r,t,s){return c(Ue(r,t),n=>({...n,defaults:s}))}const Pe=_e({});function ze(r,t){document.documentElement.style.setProperty(r,t)}function Ne(r){document.documentElement.style.removeProperty(r)}function $t(r){return c(q.toRGBFullFp(r),H(t=>Math.sqrt([.299,.587,.114].reduce((s,n,i)=>{const o=parseInt(t.slice(1+i*2,1+(i+1)*2),16);return s+o*o*n},0))<120))}const Je=V.throwifyFpFn($t);class jt{constructor({initialState:t,onChange:s,offChange:n,isTma:i,storage:o,isPageReload:u}){e(this,"accentTextColor");e(this,"bgColor");e(this,"buttonColor");e(this,"buttonTextColor");e(this,"bottomBarBgColor");e(this,"destructiveTextColor");e(this,"headerBgColor");e(this,"hintColor");e(this,"linkColor");e(this,"secondaryBgColor");e(this,"sectionBgColor");e(this,"sectionHeaderTextColor");e(this,"sectionSeparatorColor");e(this,"subtitleTextColor");e(this,"textColor");e(this,"_isCssVarsBound",g.signal(!1));e(this,"isCssVarsBound",g.computed(this._isCssVarsBound));e(this,"bindCssVarsFp");e(this,"bindCssVars");e(this,"state");e(this,"isDark",g.computed(()=>{const t=this.bgColor();return!t||Je(t)}));e(this,"isMounted");e(this,"mountFp");e(this,"mount");e(this,"unmount");const a=new te({initialState:{},onChange:o.set}),l=S=>{a.setState(S.theme_params)},p=new me({initialState:()=>I(U(t)),isPageReload:u,onMounted(S){a.setState(S),s(l)},onUnmounted(){n(l)},restoreState:o.get}),_={isTma:i,returns:"either"},b=B(_),C=B({..._,isMounted:p.isMounted});this.accentTextColor=a.getter("accent_text_color"),this.bgColor=a.getter("bg_color"),this.buttonColor=a.getter("button_color"),this.buttonTextColor=a.getter("button_text_color"),this.bottomBarBgColor=a.getter("bottom_bar_bg_color"),this.destructiveTextColor=a.getter("destructive_text_color"),this.headerBgColor=a.getter("header_bg_color"),this.hintColor=a.getter("hint_color"),this.linkColor=a.getter("link_color"),this.secondaryBgColor=a.getter("secondary_bg_color"),this.sectionBgColor=a.getter("section_bg_color"),this.sectionHeaderTextColor=a.getter("section_header_text_color"),this.sectionSeparatorColor=a.getter("section_separator_color"),this.subtitleTextColor=a.getter("subtitle_text_color"),this.textColor=a.getter("text_color"),this.state=a.state,this.isMounted=p.isMounted,this.bindCssVarsFp=C(S=>{if(this._isCssVarsBound())return O(new we);S||(S=m=>`--tg-theme-${V.snakeToKebab(m)}`);const E=m=>{Object.entries(a.state()).forEach(([F,f])=>{f&&m(F,f)})},v=()=>{E((m,F)=>{ze(S(m),F)})};return v(),a.state.sub(v),this._isCssVarsBound.set(!0),I(()=>{E(Ne),a.state.unsub(v),this._isCssVarsBound.set(!1)})}),this.mountFp=b(p.mount),this.unmount=p.unmount,this.bindCssVars=d(this.bindCssVarsFp),this.mount=d(this.mountFp)}}const le=new jt({...c(w(),re("themeParams")),offChange(r){h.off("theme_changed",r)},onChange(r){h.on("theme_changed",r)},initialState:Pe}),Vs=new Vt(Rt("mainButton","main_button_pressed",{bgColor:g.computed(()=>le.buttonColor()||"#2481cc"),textColor:g.computed(()=>le.buttonTextColor()||"#ffffff")}));class Dt{constructor({storage:t,isPageReload:s,version:n,postEvent:i,isTma:o,theme:u,onVisibilityChanged:a,offVisibilityChanged:l}){e(this,"isSupported");e(this,"isDark",g.computed(()=>{const t=this.bgColorRgb();return t?Je(t):!1}));e(this,"isActive");e(this,"state");e(this,"isCssVarsBound");e(this,"bindCssVarsFp");e(this,"bindCssVars");e(this,"isMounted");e(this,"mountFp");e(this,"mount");e(this,"unmount");e(this,"bgColor");e(this,"bgColorRgb");e(this,"setBgColorFp");e(this,"setBgColor");e(this,"headerColor");e(this,"headerColorRgb");e(this,"setHeaderColorFp");e(this,"setHeaderColor");e(this,"bottomBarColor");e(this,"bottomBarColorRgb");e(this,"setBottomBarColorFp");e(this,"setBottomBarColor");e(this,"closeFp");e(this,"close");e(this,"readyFp");e(this,"ready");const p=f=>{C.setState({isActive:f.is_visible})},_=f=>{[[this.headerColor,"web_app_set_header_color"],[this.bgColor,"web_app_set_background_color"],[this.bottomBarColor,"web_app_set_bottom_bar_color"]].forEach(([x,D])=>{const R=x();if(!q.isRGB(R)&&(D==="web_app_set_header_color"||!["bg_color","secondary_bg_color"].includes(R))){const G=f[R];G&&i(D,{color:G})}})},b=new me({initialState(){return I({bgColor:"bg_color",headerColor:"header_bg_color",bottomBarColor:"bottom_bar_bg_color",isActive:!0})},isPageReload:s,onMounted:f=>{a(p),u.sub(_),C.setState(f)},onUnmounted(){l(p),u.unsub(_)},restoreState:t.get});this.isMounted=b.isMounted,this.mountFp=P(()=>{const f=()=>{};return c(b.mount(),de(f,f))},{isTma:o,returns:"plain"}),this.mount=d(this.mountFp),this.unmount=b.unmount;const C=new te({initialState:{bgColor:"bg_color",bottomBarColor:"bottom_bar_bg_color",headerColor:"bg_color",isActive:!1},onChange:t.set});this.state=C.state;const S=f=>q.isRGB(f)?f:U(u)[f],E=f=>g.computed(()=>S(f()));this.isActive=C.getter("isActive"),this.isSupported=g.computed(()=>["web_app_set_header_color","web_app_set_background_color","web_app_set_bottom_bar_color"].some(f=>h.supports(f,U(n))));const v=g.signal(!1);this.isCssVarsBound=g.computed(v),this.bindCssVarsFp=P(f=>{if(v())return O(new we);const[x,D]=V.createCbCollector(()=>{v.set(!1)}),R=(G,W)=>{const z=()=>{ze(G,W()||null)};z(),x(W.sub(z),Ne.bind(null,G))};return f||(f=G=>`--tg-${V.camelToKebab(G)}`),R(f("bgColor"),this.bgColorRgb),R(f("bottomBarColor"),this.bottomBarColorRgb),R(f("headerColor"),this.headerColorRgb),v.set(!0),I(D)},{isTma:o,returns:"either",isMounted:this.isMounted}),this.bindCssVars=d(this.bindCssVarsFp);const m=f=>{const x=C.getter(f),D=E(x),R={headerColor:"web_app_set_header_color",bgColor:"web_app_set_background_color",bottomBarColor:"web_app_set_bottom_bar_color"}[f],G=P(W=>{if(W===x())return I(void 0);if(R==="web_app_set_header_color"&&(W==="bg_color"||W==="secondary_bg_color"))return i("web_app_set_header_color",{color_key:W});const z=S(W);return c(z?i(R,{color:z}):O(new Ft(W)),H(()=>{C.setState({[f]:z})}))},{isTma:o,version:n,requires:R,isMounted:this.isMounted,returns:"either",supports:f==="headerColor"?{rgb:{method:"web_app_set_header_color",param:"color",shouldCheck:q.isRGB}}:void 0});return[x,D,d(G),G]};[this.bgColor,this.bgColorRgb,this.setBgColor,this.setBgColorFp]=m("bgColor"),[this.headerColor,this.headerColorRgb,this.setHeaderColor,this.setHeaderColorFp]=m("headerColor"),[this.bottomBarColor,this.bottomBarColorRgb,this.setBottomBarColor,this.setBottomBarColorFp]=m("bottomBarColor");const F=B({isTma:o,returns:"either"});this.closeFp=F(f=>i("web_app_close",{return_back:f})),this.close=d(this.closeFp),this.readyFp=F(()=>i("web_app_ready")),this.ready=d(this.readyFp)}}const Ut=new Dt({...c(w(),j,k,re("miniApp")),offVisibilityChanged(r){h.off("visibility_changed",r)},onVisibilityChanged(r){h.on("visibility_changed",r)},theme:le.state});function Rs(r){const t=r.message.trim(),s=(r.title||"").trim(),n=r.buttons||[];if(s.length>64)return O(new J(`Invalid title: ${s}`));if(!t||t.length>256)return O(new J(`Invalid message: ${t}`));if(n.length>3)return O(new J(`Invalid buttons count: ${n.length}`));const i=[];if(!n.length)i.push({type:"close",id:""});else for(let o=0;o<n.length;o++){const u=n[o],a=u.id||"";if(a.length>64)return O(new J(`Button with index ${o} has invalid id: ${a}`));if(!u.type||u.type==="default"||u.type==="destructive"){const l=u.text.trim();if(!l||l.length>64)return O(new J(`Button with index ${o} has invalid text: ${l}`));i.push({type:u.type,text:l,id:a})}else i.push({type:u.type,id:a})}return I({title:s,message:t,buttons:i})}class Gt{constructor({version:t,isTma:s,request:n}){e(this,"isOpened");e(this,"isSupported");e(this,"showFp");e(this,"show");const i=g.signal(!1),o=()=>{i.set(!1)},u=B({version:t,isTma:s,requires:"web_app_open_popup",returns:"task"});this.isSupported=Y("web_app_open_popup",t),this.isOpened=g.computed(i),this.showFp=u(a=>c(this.isOpened()?$(new Se("A popup is already opened")):T(void 0),ae(()=>dt(Rs(a))),X(l=>(i.set(!0),n("web_app_open_popup","popup_closed",{...a,params:l}))),$e(l=>(o(),l),l=>(o(),l.button_id)))),this.show=d(this.showFp)}}const $s=new Gt(c(w(),Q,k));function js({request:r,...t}){return P(s=>c(r("web_app_request_phone","phone_requested",s),M(n=>n.status)),{...t,requires:"web_app_request_phone",returns:"task"})}const Ye=js(c(w(),k,Q)),Ds=d(Ye);function Us({invokeCustomMethod:r,requestPhoneAccess:t,...s}){const n=u=>c(r("getRequestedContact",{},{...u,timeout:(u||{}).timeout||5e3}),ae(a=>{const l=y.safeParse(y.string(),a);if(!l.success)return $(new ce(a,l.issues));if(!l.output)return T(void 0);const p=y.safeParse(q.pipeQueryToSchema(y.looseObject({contact:q.pipeJsonToSchema(y.looseObject({user_id:y.number(),phone_number:y.string(),first_name:y.string(),last_name:y.optional(y.string())})),auth_date:y.pipe(y.string(),y.transform(_=>new Date(Number(_)*1e3)),y.date()),hash:y.string()})),l.output);return p.success?T({raw:l.output,parsed:p.output}):$(new ce(l.output,p.issues))})),i=u=>c(n(u),Xr(a=>ce.is(a)?O(a):I(void 0),a=>I(a))),o=u=>V.BetterTaskEither(async(a,l,p)=>{let _=50;for(;!p.isRejected;){const b=await i(p)();if(b._tag==="Left")return l(b.left);if(b.right)return a(b.right);await new Promise(C=>setTimeout(C,_)),_+=50}},u);return P(u=>V.BetterTaskEither.fn(a=>c(i(a),X(l=>l?T(l):c(t(a),ae(p=>p==="sent"?o(a):$(new De("User denied access")))))),u),{...s,returns:"task",requires:"web_app_request_phone"})}function Gs({requestContact:r,...t}){return P(r,{...t,returns:"task",requires:"web_app_request_phone"})}const Ze=Us({...c(w(),We,k),requestPhoneAccess:Ye}),Hs=d(Ze),Ht=Gs({...c(w(),k),requestContact(r){return c(Ze(r),M(t=>t.parsed))}}),Qs=d(Ht);function Ws({request:r,...t}){return P(s=>c(r("web_app_request_write_access","write_access_requested",s),M(n=>n.status)),{...t,requires:"web_app_request_write_access",returns:"task"})}const Qt=Ws(c(w(),k,Q)),Ks=d(Qt);class Wt{constructor({version:t,onClosed:s,onTextReceived:n,isTma:i,postEvent:o}){e(this,"isOpened");e(this,"isSupported");e(this,"captureFp");e(this,"capture");e(this,"closeFp");e(this,"close");e(this,"openFp");e(this,"open");const u={version:t,requires:"web_app_open_scan_qr_popup",isTma:i},a=B({...u,returns:"either"}),l=B({...u,returns:"task"}),p=g.signal(!1),_=()=>{p.set(!1)};this.isSupported=Y("web_app_open_scan_qr_popup",t),this.isOpened=g.computed(p),this.captureFp=l(b=>{let C;return c(this.openFp({...b,onCaptured:S=>{b.capture(S)&&(C=S,this.close())}}),M(()=>C))}),this.closeFp=a(()=>c(o("web_app_close_scan_qr_popup"),H(_))),this.openFp=l(b=>c(this.isOpened()?$(new Se("The QR Scanner is already opened")):async()=>o("web_app_open_scan_qr_popup",{text:b.text}),ae(()=>{const[C,S]=V.createCbCollector(),E=v=>(S(),v);return c(V.BetterTaskEither(v=>{C(s(v),n(b.onCaptured))},b),$e(E,E))}))),this.open=d(this.openFp),this.capture=d(this.captureFp),this.close=d(this.closeFp)}}const zs=new Wt({...c(w(),j,k),onClosed(r){return h.on("scan_qr_popup_closed",r)},onTextReceived(r){return h.on("qr_text_received",t=>{r(t.data)})}});class Kt{constructor({defaults:t,...s}){e(this,"isSupported");e(this,"position");e(this,"bgColor");e(this,"hasShineEffect");e(this,"isEnabled");e(this,"isLoaderVisible");e(this,"isVisible");e(this,"isMounted");e(this,"state");e(this,"text");e(this,"textColor");e(this,"showFp");e(this,"show");e(this,"hideFp");e(this,"hide");e(this,"enableFp");e(this,"enable");e(this,"enableShineEffectFp");e(this,"enableShineEffect");e(this,"disableFp");e(this,"disable");e(this,"disableShineEffectFp");e(this,"disableShineEffect");e(this,"setBgColorFp");e(this,"setBgColor");e(this,"setTextColorFp");e(this,"setTextColor");e(this,"setTextFp");e(this,"setText");e(this,"setPositionFp");e(this,"setPosition");e(this,"showLoaderFp");e(this,"showLoader");e(this,"hideLoaderFp");e(this,"hideLoader");e(this,"setParamsFp");e(this,"setParams");e(this,"mountFp");e(this,"mount");e(this,"unmount");e(this,"onClickFp");e(this,"onClick");e(this,"offClickFp");e(this,"offClick");const n=new ve({...s,initialState:{hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Cancel",position:"left"},method:"web_app_setup_secondary_button",payload:o=>({has_shine_effect:o.hasShineEffect,is_visible:o.isVisible,is_active:o.isEnabled,is_progress_visible:o.isLoaderVisible,text:o.text,color:o.bgColor,text_color:o.textColor,position:o.position})}),i=(o,u)=>{const a=n.stateGetter(o);return g.computed(()=>a()||U(u))};this.isSupported=Y("web_app_setup_secondary_button",s.version),this.bgColor=i("bgColor",t.bgColor),this.textColor=i("textColor",t.textColor),this.position=n.stateGetter("position"),this.hasShineEffect=n.stateGetter("hasShineEffect"),this.isEnabled=n.stateGetter("isEnabled"),this.isLoaderVisible=n.stateGetter("isLoaderVisible"),this.text=n.stateGetter("text"),this.isVisible=n.stateGetter("isVisible"),this.isMounted=n.isMounted,this.state=n.state,[this.setPosition,this.setPositionFp]=n.stateSetters("position"),[this.setBgColor,this.setBgColorFp]=n.stateSetters("bgColor"),[this.setTextColor,this.setTextColorFp]=n.stateSetters("textColor"),[[this.disableShineEffect,this.disableShineEffectFp],[this.enableShineEffect,this.enableShineEffectFp]]=n.stateBoolSetters("hasShineEffect"),[[this.disable,this.disableFp],[this.enable,this.enableFp]]=n.stateBoolSetters("isEnabled"),[[this.hideLoader,this.hideLoaderFp],[this.showLoader,this.showLoaderFp]]=n.stateBoolSetters("isLoaderVisible"),[this.setText,this.setTextFp]=n.stateSetters("text"),[[this.hide,this.hideFp],[this.show,this.showFp]]=n.stateBoolSetters("isVisible"),this.setParams=n.setState,this.setParamsFp=n.setStateFp,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 Ns=new Kt(Rt("secondaryButton","secondary_button_pressed",{bgColor:g.computed(()=>Ut.bottomBarColorRgb()||"#000000"),textColor:g.computed(()=>le.buttonColor()||"#2481cc")}));class zt{constructor(t){e(this,"isVisible");e(this,"isMounted");e(this,"isSupported");e(this,"hideFp");e(this,"hide");e(this,"showFp");e(this,"show");e(this,"onClickFp");e(this,"onClick");e(this,"offClickFp");e(this,"offClick");e(this,"mountFp");e(this,"mount");e(this,"unmount");const s=new ve({...t,method:"web_app_setup_settings_button",payload:n=>({is_visible:n.isVisible}),initialState:{isVisible:!1}});this.isVisible=s.stateGetter("isVisible"),this.isMounted=s.isMounted,this.isSupported=s.isSupported,[[this.hide,this.hideFp],[this.show,this.showFp]]=s.stateBoolSetters("isVisible"),this.onClick=s.onClick,this.onClickFp=s.onClickFp,this.offClick=s.offClick,this.offClickFp=s.offClickFp,this.mount=s.mount,this.mountFp=s.mountFp,this.unmount=s.unmount}}const Js=new zt(Ue("settingsButton","settings_button_pressed"));class Nt{constructor({postEvent:t,storage:s,isTma:n,isPageReload:i,version:o}){e(this,"isSupported");e(this,"isVerticalEnabled");e(this,"isMounted");e(this,"mountFp");e(this,"mount");e(this,"unmount");e(this,"disableVerticalFp");e(this,"disableVertical");e(this,"enableVerticalFp");e(this,"enableVertical");const u=new te({initialState:{isVerticalEnabled:!1},onChange(C){s.set(C)}}),a=new me({initialState:{isVerticalEnabled:!1},isPageReload:i,onMounted:u.setState,restoreState:s.get}),l={requires:"web_app_setup_swipe_behavior",isTma:n,version:o},p=B({...l,returns:"plain"}),_=B({...l,isMounted:a.isMounted,returns:"either"}),b=C=>{const S={isVerticalEnabled:C};return u.hasDiff(S)?c(t("web_app_setup_swipe_behavior",{allow_vertical_swipe:C}),H(()=>{u.setState(S)})):I(void 0)};this.isSupported=Y("web_app_setup_swipe_behavior",o),this.isVerticalEnabled=u.getter("isVerticalEnabled"),this.isMounted=a.isMounted,this.disableVerticalFp=_(()=>b(!1)),this.enableVerticalFp=_(()=>b(!0)),this.mountFp=p(()=>{const C=()=>{};return c(a.mount(),de(C,C))}),this.unmount=a.unmount,this.disableVertical=d(this.disableVerticalFp),this.enableVertical=d(this.enableVerticalFp),this.mount=d(this.mountFp)}}const Ys=new Nt(c(w(),j,k,re("swipeBehavior")));async function Zs(r){try{const{clipboard:s}=navigator;if(s)return await s.writeText(r)}catch{}const t=document.createElement("textarea");t.value=r,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}finally{document.body.removeChild(t)}}function Xs({request:r,...t}){return P((s,n,i)=>c(r("web_app_request_file_download","file_download_requested",{...i,params:{url:s,file_name:n}}),X(o=>o.status==="downloading"?T(void 0):$(new De("User denied the action")))),{...t,requires:"web_app_request_file_download",returns:"task"})}const Jt=Xs(c(w(),Q,k)),en=d(Jt);function tn({invokeCustomMethod:r,...t}){return P(s=>c(r("getCurrentTime",{},s),X(n=>{const i=y.safeParse(y.pipe(y.number(),y.integer(),y.transform(o=>new Date(o*1e3)),y.date()),n);return i.success?T(i.output):$(new ce(n,i.issues))})),{...t,requires:"web_app_invoke_custom_method",returns:"task"})}const Yt=tn(c(w(),We,k)),rn=d(Yt);function sn({postEvent:r,...t}){return P(()=>r("web_app_hide_keyboard"),{...t,returns:"either",requires:"web_app_hide_keyboard"})}const Zt=sn(c(w(),j,k)),nn=d(Zt);function on({request:r,createRequestId:t,...s}){return P(n=>{const i=t();return c(r("web_app_read_text_from_clipboard","clipboard_text_received",{...n,params:{req_id:i},capture:h.captureSameReq(i)}),M(({data:o=null})=>o))},{...s,requires:"web_app_read_text_from_clipboard",returns:"task"})}const Xt=on({...c(w(),k,Q),createRequestId:Qe}),an=d(Xt);function er(r){const t={},s=r.match(/Telegram-Android(?:\/([^ ]+))?(?: (\([^)]+\))?|$)/);if(s){const[,n,i]=s;n&&(t.appVersion=n),i&&i.slice(1,i.length-1).split(";").forEach(o=>{const[u,a]=o.trim().split(" ");if(u==="Android")t.androidVersion=a;else if(u==="SDK"){const l=parseInt(a,10);l&&(t.sdkVersion=l)}else a?(t.manufacturer=u,t.model=a):t.performanceClass=u})}return t}function un(){return er(navigator.userAgent)}function cn({postEvent:r,...t}){return P(s=>{const{size:n}=new Blob([s]);return!n||n>4096?O(new J(n?"Maximum size of data to send is 4096 bytes":"Attempted to send empty data")):r("web_app_data_send",{data:s})},{...t,returns:"either"})}const tr=cn(c(w(),j)),pn=d(tr);function ln({request:r,...t}){return P((s,n)=>c(r("web_app_send_prepared_message",["prepared_message_failed","prepared_message_sent"],{...n,params:{id:s}}),X(i=>i&&"error"in i?$(new gt(i.error)):T(void 0))),{...t,requires:"web_app_send_prepared_message",returns:"task"})}const rr=ln(c(w(),Q,k)),hn=d(rr);function dn({postEvent:r,...t}){return P((s,n={})=>r("web_app_share_to_story",{text:n.text,media_url:s,widget_link:n.widgetLink}),{...t,requires:"web_app_share_to_story",returns:"either"})}const sr=dn(c(w(),j,k)),fn=d(sr),Ie=_e(!1);function mn({isInlineMode:r,postEvent:t,...s}){return P((n,i)=>t("web_app_switch_inline_query",{query:n,chat_types:i||[]}),{...s,requires:{every:["web_app_switch_inline_query",()=>U(r)?void 0:"The application must be launched in the inline mode"]},returns:"either"})}const nr=mn({...c(w(),j,k),isInlineMode:Ie}),bn=d(nr);class or{constructor({storage:t,isPageReload:s,onContentSafeAreaInsetsChanged:n,onSafeAreaInsetsChanged:i,onViewportChanged:o,onFullscreenChanged:u,offContentSafeAreaInsetsChanged:a,offFullscreenChanged:l,offSafeAreaInsetsChanged:p,offViewportChanged:_,request:b,isViewportStable:C,isFullscreen:S,isTma:E,version:v,postEvent:m}){e(this,"state");e(this,"height");e(this,"stableHeight");e(this,"width");e(this,"isExpanded");e(this,"isStable",g.computed(()=>this.height()===this.stableHeight()));e(this,"contentSafeAreaInsets");e(this,"contentSafeAreaInsetTop");e(this,"contentSafeAreaInsetLeft");e(this,"contentSafeAreaInsetRight");e(this,"contentSafeAreaInsetBottom");e(this,"safeAreaInsets");e(this,"safeAreaInsetTop");e(this,"safeAreaInsetLeft");e(this,"safeAreaInsetRight");e(this,"safeAreaInsetBottom");e(this,"isFullscreen");e(this,"requestFullscreenFp");e(this,"requestFullscreen");e(this,"exitFullscreenFp");e(this,"exitFullscreen");e(this,"isCssVarsBound");e(this,"bindCssVarsFp");e(this,"bindCssVars");e(this,"isMounted");e(this,"mountFp");e(this,"mount");e(this,"expandFp");e(this,"expand");const F={top:0,right:0,left:0,bottom:0},f=new te({initialState:{contentSafeAreaInsets:F,height:0,isExpanded:!1,isFullscreen:!1,safeAreaInsets:F,stableHeight:0,width:0},onChange:t.set}),x=A=>{f.setState({isExpanded:A.is_expanded,height:A.height,width:A.width,stableHeight:A.is_state_stable?A.height:void 0})},D=A=>{f.setState({isFullscreen:A.is_fullscreen})},R=A=>{f.setState({safeAreaInsets:A})},G=A=>{f.setState({contentSafeAreaInsets:A})},W=new Ge({initialState(A){const se=Z=>()=>{const[ee,N]=Z==="safe-area"?["web_app_request_safe_area","safe_area_changed"]:["web_app_request_content_safe_area","content_safe_area_changed"];return h.supports(ee,U(v))?b(ee,N,A):T({top:0,left:0,right:0,bottom:0})},L=Z=>()=>typeof Z=="boolean"?T(Z):dt(Z());return c(as,Ce("safeAreaInsets",se("safe-area")),Ce("contentSafeAreaInsets",se("content-safe-area")),Ce("isFullscreen",L(S)),Ce("isViewportStable",L(C)),ae(({isViewportStable:Z,...ee})=>Z?T({...ee,height:window.innerHeight,isExpanded:!0,stableHeight:window.innerHeight,width:window.innerWidth}):c(b("web_app_request_viewport","viewport_changed",A),M(N=>({...ee,height:N.height,isExpanded:N.is_expanded,stableHeight:N.is_state_stable?N.height:0,width:N.width})))))},isPageReload:s,onMounted(A){o(x),u(D),i(R),n(G),f.setState(A)},onUnmounted(){_(x),l(D),p(R),a(G)},restoreState:t.get}),z=A=>g.computed(()=>this.safeAreaInsets()[A]),ge=A=>g.computed(()=>this.contentSafeAreaInsets()[A]);this.state=f.state,this.height=f.getter("height"),this.stableHeight=f.getter("stableHeight"),this.width=f.getter("width"),this.isExpanded=f.getter("isExpanded"),this.safeAreaInsets=f.getter("safeAreaInsets"),this.safeAreaInsetTop=z("top"),this.safeAreaInsetBottom=z("bottom"),this.safeAreaInsetLeft=z("left"),this.safeAreaInsetRight=z("right"),this.contentSafeAreaInsets=f.getter("contentSafeAreaInsets"),this.contentSafeAreaInsetTop=ge("top"),this.contentSafeAreaInsetBottom=ge("bottom"),this.contentSafeAreaInsetLeft=ge("left"),this.contentSafeAreaInsetRight=ge("right");const ar=B({isTma:E,returns:"task"}),Xe=B({isTma:E,returns:"either"}),ur=B({isTma:E,requires:"web_app_request_fullscreen",version:v,returns:"task"}),et=A=>ur(se=>c(b(A?"web_app_request_fullscreen":"web_app_exit_fullscreen",["fullscreen_changed","fullscreen_failed"],se),X(L=>"error"in L&&L.error!=="ALREADY_FULLSCREEN"?$(new _t(L.error)):(f.setState({isFullscreen:"is_fullscreen"in L?L.is_fullscreen:!0}),T(void 0)))));this.isMounted=W.isMounted,this.mountFp=ar(W.mount),this.mount=d(this.mountFp),this.isFullscreen=f.getter("isFullscreen"),this.requestFullscreenFp=et(!0),this.requestFullscreen=d(this.requestFullscreenFp),this.exitFullscreenFp=et(!1),this.exitFullscreen=d(this.exitFullscreenFp);const Fe=g.signal(!1);this.isCssVarsBound=g.computed(Fe),this.bindCssVarsFp=Xe(A=>{if(Fe())return O(new we);A||(A=L=>`--tg-viewport-${V.camelToKebab(L)}`);const se=[["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((L,[Z,ee])=>{const N=A(Z);if(N){const tt=()=>{ze(N,`${ee()}px`)};L.push({update:tt,removeListener:ee.sub(tt),cssVar:N})}return L},[]);return se.forEach(L=>{L.update()}),Fe.set(!0),I(()=>{se.forEach(L=>{L.removeListener(),Ne(L.cssVar)}),Fe.set(!1)})}),this.bindCssVars=d(this.bindCssVarsFp),this.expandFp=Xe(()=>m("web_app_expand")),this.expand=d(this.expandFp)}}function _n(){const r=o=>({on:u=>{h.on(o,u)},off:u=>{h.off(o,u)}}),t=r("viewport_changed"),s=r("fullscreen_changed"),n=r("safe_area_changed"),i=r("content_safe_area_changed");return new or({...c(w(),re("viewport"),k,j,Q),isFullscreen(){return c(h.retrieveLaunchParamsFp(),H(o=>!!o.tgWebAppFullscreen))},isViewportStable(){return c(h.retrieveLaunchParamsFp(),H(o=>["macos","tdesktop","unigram","webk","weba","web"].includes(o.tgWebAppPlatform)))},offContentSafeAreaInsetsChanged:i.off,offFullscreenChanged:s.off,offSafeAreaInsetsChanged:n.off,offViewportChanged:t.off,onContentSafeAreaInsetsChanged:i.on,onFullscreenChanged:s.on,onSafeAreaInsetsChanged:n.on,onViewportChanged:t.on})}const gn=_n();function ir(r={}){const{version:t,isInlineMode:s,themeParams:n}=r;if(t&&typeof s=="boolean"&&n)Be.set(t),Ie.set(s),Pe.set(n);else{const a=c(h.retrieveLaunchParamsFp(),ct(l=>l,l=>{Be.set(t||l.tgWebAppVersion),Ie.set(typeof s=="boolean"?s:!!l.tgWebAppBotInline),Pe.set(n||l.tgWebAppThemeParams)}));if(a)return O(a)}r.postEvent&&wt.set(r.postEvent);const[i,o]=V.createCbCollector(h.on("reload_iframe",()=>{h.logger().log("Received a request to reload the page"),St("iframe_will_reload"),window.location.reload()})),{acceptCustomStyles:u=!0}=r;if(u){const a=document.createElement("style");a.id="telegram-custom-styles",document.head.appendChild(a),i(h.on("set_custom_style",l=>{a.innerHTML=l}),()=>{document.head.removeChild(a)})}return c(ue("iframe_ready",{reload_supported:!0}),H(()=>(h.logger().log("The package was initialized"),o)))}const Fn=V.throwifyFpFn(ir);Object.defineProperty(exports,"CancelledError",{enumerable:!0,get:()=>h.CancelledError});Object.defineProperty(exports,"InvalidLaunchParamsError",{enumerable:!0,get:()=>h.InvalidLaunchParamsError});Object.defineProperty(exports,"InvokeCustomMethodFailedError",{enumerable:!0,get:()=>h.InvokeCustomMethodFailedError});Object.defineProperty(exports,"LaunchParamsRetrieveError",{enumerable:!0,get:()=>h.LaunchParamsRetrieveError});Object.defineProperty(exports,"MethodParameterUnsupportedError",{enumerable:!0,get:()=>h.MethodParameterUnsupportedError});Object.defineProperty(exports,"MethodUnsupportedError",{enumerable:!0,get:()=>h.MethodUnsupportedError});Object.defineProperty(exports,"TimeoutError",{enumerable:!0,get:()=>h.TimeoutError});Object.defineProperty(exports,"UnknownEnvError",{enumerable:!0,get:()=>h.UnknownEnvError});Object.defineProperty(exports,"applyPolyfills",{enumerable:!0,get:()=>h.applyPolyfills});Object.defineProperty(exports,"createLogger",{enumerable:!0,get:()=>h.createLogger});Object.defineProperty(exports,"createPostEvent",{enumerable:!0,get:()=>h.createPostEvent});Object.defineProperty(exports,"createStartParam",{enumerable:!0,get:()=>h.createStartParam});Object.defineProperty(exports,"createStartParamFp",{enumerable:!0,get:()=>h.createStartParamFp});Object.defineProperty(exports,"debug",{enumerable:!0,get:()=>h.debug});Object.defineProperty(exports,"decodeBase64Url",{enumerable:!0,get:()=>h.decodeBase64Url});Object.defineProperty(exports,"decodeBase64UrlFp",{enumerable:!0,get:()=>h.decodeBase64UrlFp});Object.defineProperty(exports,"decodeStartParam",{enumerable:!0,get:()=>h.decodeStartParam});Object.defineProperty(exports,"decodeStartParamFp",{enumerable:!0,get:()=>h.decodeStartParamFp});Object.defineProperty(exports,"deepSnakeToCamelObjKeys",{enumerable:!0,get:()=>h.deepSnakeToCamelObjKeys});Object.defineProperty(exports,"emitEvent",{enumerable:!0,get:()=>h.emitEvent});Object.defineProperty(exports,"encodeBase64Url",{enumerable:!0,get:()=>h.encodeBase64Url});Object.defineProperty(exports,"getReleaseVersion",{enumerable:!0,get:()=>h.getReleaseVersion});Object.defineProperty(exports,"isSafeToCreateStartParam",{enumerable:!0,get:()=>h.isSafeToCreateStartParam});Object.defineProperty(exports,"isTMA",{enumerable:!0,get:()=>h.isTMA});Object.defineProperty(exports,"isTMAFp",{enumerable:!0,get:()=>h.isTMAFp});Object.defineProperty(exports,"logger",{enumerable:!0,get:()=>h.logger});Object.defineProperty(exports,"mockTelegramEnv",{enumerable:!0,get:()=>h.mockTelegramEnv});Object.defineProperty(exports,"off",{enumerable:!0,get:()=>h.off});Object.defineProperty(exports,"offAll",{enumerable:!0,get:()=>h.offAll});Object.defineProperty(exports,"on",{enumerable:!0,get:()=>h.on});Object.defineProperty(exports,"retrieveLaunchParams",{enumerable:!0,get:()=>h.retrieveLaunchParams});Object.defineProperty(exports,"retrieveLaunchParamsFp",{enumerable:!0,get:()=>h.retrieveLaunchParamsFp});Object.defineProperty(exports,"retrieveRawInitData",{enumerable:!0,get:()=>h.retrieveRawInitData});Object.defineProperty(exports,"retrieveRawInitDataFp",{enumerable:!0,get:()=>h.retrieveRawInitDataFp});Object.defineProperty(exports,"retrieveRawLaunchParams",{enumerable:!0,get:()=>h.retrieveRawLaunchParams});Object.defineProperty(exports,"retrieveRawLaunchParamsFp",{enumerable:!0,get:()=>h.retrieveRawLaunchParamsFp});Object.defineProperty(exports,"setDebug",{enumerable:!0,get:()=>h.setDebug});Object.defineProperty(exports,"setTargetOrigin",{enumerable:!0,get:()=>h.setTargetOrigin});Object.defineProperty(exports,"supports",{enumerable:!0,get:()=>h.supports});Object.defineProperty(exports,"targetOrigin",{enumerable:!0,get:()=>h.targetOrigin});Object.defineProperty(exports,"isAnyRGB",{enumerable:!0,get:()=>q.isAnyRGB});Object.defineProperty(exports,"isRGB",{enumerable:!0,get:()=>q.isRGB});Object.defineProperty(exports,"isRGBA",{enumerable:!0,get:()=>q.isRGBA});Object.defineProperty(exports,"isRGBAShort",{enumerable:!0,get:()=>q.isRGBAShort});Object.defineProperty(exports,"isRGBShort",{enumerable:!0,get:()=>q.isRGBShort});Object.defineProperty(exports,"parseInitDataQuery",{enumerable:!0,get:()=>q.parseInitDataQuery});Object.defineProperty(exports,"parseInitDataQueryFp",{enumerable:!0,get:()=>q.parseInitDataQueryFp});Object.defineProperty(exports,"parseLaunchParamsQuery",{enumerable:!0,get:()=>q.parseLaunchParamsQuery});Object.defineProperty(exports,"parseLaunchParamsQueryFp",{enumerable:!0,get:()=>q.parseLaunchParamsQueryFp});Object.defineProperty(exports,"serializeInitDataQuery",{enumerable:!0,get:()=>q.serializeInitDataQuery});Object.defineProperty(exports,"serializeLaunchParamsQuery",{enumerable:!0,get:()=>q.serializeLaunchParamsQuery});Object.defineProperty(exports,"toRGB",{enumerable:!0,get:()=>q.toRGB});Object.defineProperty(exports,"toRGBFp",{enumerable:!0,get:()=>q.toRGBFp});Object.defineProperty(exports,"toRGBFull",{enumerable:!0,get:()=>q.toRGBFull});Object.defineProperty(exports,"toRGBFullFp",{enumerable:!0,get:()=>q.toRGBFullFp});exports.AccessDeniedError=De;exports.BackButton=Ct;exports.Biometry=vt;exports.CSSVarsBoundError=we;exports.ClosingBehavior=yt;exports.CloudStorage=kt;exports.ConcurrentCallError=Se;exports.FullscreenFailedError=_t;exports.FunctionUnavailableError=mt;exports.HapticFeedback=Pt;exports.InitData=xt;exports.InvalidArgumentsError=J;exports.InvalidEnvError=cs;exports.Invoice=Mt;exports.LocationManager=Ot;exports.MainButton=Vt;exports.MiniApp=Dt;exports.NotAvailableError=ft;exports.Popup=Gt;exports.QrScanner=Wt;exports.SecondaryButton=Kt;exports.SetEmojiStatusError=bt;exports.SettingsButton=zt;exports.ShareMessageError=gt;exports.SwipeBehavior=Nt;exports.ThemeParams=jt;exports.UnknownThemeParamsKeyError=Ft;exports.ValidationError=ce;exports.Viewport=or;exports.addToHomeScreen=ys;exports.addToHomeScreenFp=It;exports.backButton=ds;exports.biometry=ms;exports.checkHomeScreenStatus=Es;exports.checkHomeScreenStatusFp=qt;exports.closingBehavior=bs;exports.cloudStorage=_s;exports.copyTextToClipboard=Zs;exports.createRequestId=Qe;exports.downloadFile=en;exports.downloadFileFp=Jt;exports.getCurrentTime=rn;exports.getCurrentTimeFp=Yt;exports.hapticFeedback=Ss;exports.hideKeyboard=nn;exports.hideKeyboardFp=Zt;exports.init=Fn;exports.initData=As;exports.initFp=ir;exports.invoice=Bs;exports.invokeCustomMethod=Et;exports.isColorDark=Je;exports.isColorDarkFp=$t;exports.locationManager=Os;exports.mainButton=Vs;exports.miniApp=Ut;exports.openLink=Is;exports.openLinkFp=Tt;exports.openTelegramLink=xs;exports.openTelegramLinkFp=Ke;exports.popup=$s;exports.postEvent=St;exports.postEventFp=ue;exports.qrScanner=zs;exports.readTextFromClipboard=an;exports.readTextFromClipboardFp=Xt;exports.request=fs;exports.requestContact=Qs;exports.requestContactComplete=Hs;exports.requestContactCompleteFp=Ze;exports.requestContactFp=Ht;exports.requestEmojiStatusAccess=Fs;exports.requestEmojiStatusAccessFp=At;exports.requestFp=He;exports.requestPhoneAccess=Ds;exports.requestPhoneAccessFp=Ye;exports.requestWriteAccess=Ks;exports.requestWriteAccessFp=Qt;exports.retrieveAndroidDeviceData=un;exports.retrieveAndroidDeviceDataFrom=er;exports.secondaryButton=Ns;exports.sendData=pn;exports.sendDataFp=tr;exports.setEmojiStatus=ws;exports.setEmojiStatusFp=Bt;exports.settingsButton=Js;exports.shareMessage=hn;exports.shareMessageFp=rr;exports.shareStory=fn;exports.shareStoryFp=sr;exports.shareURL=Ts;exports.shareURLFp=Lt;exports.swipeBehavior=Ys;exports.switchInlineQuery=bn;exports.switchInlineQueryFp=nr;exports.themeParams=le;exports.viewport=gn;
1
+ "use strict";var cr=Object.defineProperty;var pr=(r,t,s)=>t in r?cr(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var e=(r,t,s)=>pr(r,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("@tma.js/signals"),h=require("@tma.js/bridge"),R=require("@tma.js/toolkit"),lr=require("better-promises"),q=require("@tma.js/transformers"),K=require("error-kid"),y=require("valibot");var hr=function(r,t,s){if(s||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return r.concat(o||Array.prototype.slice.call(t))};function ot(r,t,s,n,i,o,u,a,l){switch(arguments.length){case 1:return r;case 2:return function(){return t(r.apply(this,arguments))};case 3:return function(){return s(t(r.apply(this,arguments)))};case 4:return function(){return n(s(t(r.apply(this,arguments))))};case 5:return function(){return i(n(s(t(r.apply(this,arguments)))))};case 6:return function(){return o(i(n(s(t(r.apply(this,arguments))))))};case 7:return function(){return u(o(i(n(s(t(r.apply(this,arguments)))))))};case 8:return function(){return a(u(o(i(n(s(t(r.apply(this,arguments))))))))};case 9:return function(){return l(a(u(o(i(n(s(t(r.apply(this,arguments)))))))))}}}function c(r,t,s,n,i,o,u,a,l){switch(arguments.length){case 1:return r;case 2:return t(r);case 3:return s(t(r));case 4:return n(s(t(r)));case 5:return i(n(s(t(r))));case 6:return o(i(n(s(t(r)))));case 7:return u(o(i(n(s(t(r))))));case 8:return a(u(o(i(n(s(t(r)))))));case 9:return l(a(u(o(i(n(s(t(r))))))));default:{for(var p=arguments[0],_=1;_<arguments.length;_++)p=arguments[_](p);return p}}}var he=function(r,t){var s=typeof r=="number"?function(n){return n.length>=r}:r;return function(){var n=Array.from(arguments);return s(arguments)?t.apply(this,n):function(i){return t.apply(void 0,hr([i],n,!1))}}},dr={_tag:"None"},fr=function(r){return{_tag:"Some",value:r}},mr=function(r){return r._tag==="Left"},it=function(r){return{_tag:"Left",left:r}},at=function(r){return{_tag:"Right",right:r}},qe={};function br(r,t){return function(s){return function(n){return r.ap(r.map(n,function(i){return function(o){return t.ap(i,o)}}),s)}}}function _r(r,t){return function(s){return function(n){return r.map(n,function(i){return t.map(i,s)})}}}function xe(r){return function(t,s){return function(n){return r.chain(n,function(i){return r.map(s(i),function(o){var u;return Object.assign({},i,(u={},u[t]=o,u))})})}}}var O=it,I=at,gr=he(2,function(r,t){return ne(r)?r:t(r.right)}),Me=function(r,t){return c(r,U(t))},ut=function(r,t){return c(r,Sr(t))},Te="Either",U=function(r){return function(t){return ne(t)?t:I(r(t.right))}},Fr={URI:Te,map:Me},Cr=I,wr=function(r){return function(t){return ne(t)?t:ne(r)?r:I(t.right(r.right))}},Sr=wr,vr={URI:Te,map:Me,ap:ut},yr={URI:Te,map:Me,ap:ut,chain:gr},kr=function(r,t){return function(s){return ne(s)?O(r(s.left)):I(t(s.right))}},ne=mr,ct=function(r,t){return function(s){return ne(s)?r(s.left):t(s.right)}},de=ct,Er=function(r,t){try{return I(r())}catch(s){return O(t(s))}},Ar=Cr(qe),Br=xe(yr),rt=Br;function G(r){return typeof r=="function"?r():r}function Y(r,t){return g.computed(()=>h.supports(r,G(t)))}var ie=dr,fe=fr,Pr=function(r,t){return c(r,xr(t))},Ir=function(r,t){return c(r,Tr(t))},qr="Option",xr=function(r){return function(t){return pe(t)?ie:fe(r(t.value))}},Mr=fe,Tr=function(r){return function(t){return pe(t)||pe(r)?ie:fe(t.value(r.value))}},Lr=he(2,function(r,t){return pe(r)?ie:t(r.value)}),Or={URI:qr,map:Pr,ap:Ir,chain:Lr},pe=function(r){return r._tag==="None"},Vr=function(r,t){return function(s){return pe(s)?r():t(s.value)}},pt=Vr,Rr=Mr(qe),st=xe(Or);function $r(r){return ot(I,r.of)}function jr(r){return ot(O,r.of)}function Dr(r){return _r(r,Fr)}function Ur(r){return br(r,vr)}function Gr(r){return function(t,s){return r.chain(t,function(n){return ne(n)?r.of(n):s(n.right)})}}function Hr(r){return function(t,s,n){return r.map(t,kr(s,n))}}function Qr(r){return function(t,s){return function(n){return r.map(n,de(t,s))}}}var Le=function(r,t){return c(r,Wr(t))},lt=function(r,t){return c(r,Kr(t))},Wr=function(r){return function(t){return function(){return Promise.resolve().then(t).then(r)}}},Kr=function(r){return function(t){return function(){return Promise.all([Promise.resolve().then(t),Promise.resolve().then(r)]).then(function(s){var n=s[0],i=s[1];return n(i)})}}},Oe=function(r){return function(){return Promise.resolve(r)}},zr=he(2,function(r,t){return function(){return Promise.resolve().then(r).then(function(s){return t(s)()})}}),Ve="Task",Re={URI:Ve,map:Le},ht={of:Oe},Nr={URI:Ve,map:Le,ap:lt},Jr={URI:Ve,map:Le,of:Oe,ap:lt,chain:zr},Yr=function(r,t,s,n){function i(o){return o instanceof s?o:new s(function(u){u(o)})}return new(s||(s=Promise))(function(o,u){function a(_){try{p(n.next(_))}catch(b){u(b)}}function l(_){try{p(n.throw(_))}catch(b){u(b)}}function p(_){_.done?o(_.value):i(_.value).then(a,l)}p((n=n.apply(r,t||[])).next())})},Zr=function(r,t){var s={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,u;return u={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(p){return function(_){return l([p,_])}}function l(p){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,p[0]&&(s=0)),s;)try{if(n=1,i&&(o=p[0]&2?i.return:p[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,p[1])).done)return o;switch(i=0,o&&(p=[p[0]&2,o.value]),p[0]){case 0:case 1:o=p;break;case 4:return s.label++,{value:p[1],done:!1};case 5:s.label++,i=p[1],p=[0];continue;case 7:p=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!(o=o.length>0&&o[o.length-1])&&(p[0]===6||p[0]===2)){s=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]<o[3])){s.label=p[1];break}if(p[0]===6&&s.label<o[1]){s.label=o[1],o=p;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(p);break}o[2]&&s.ops.pop(),s.trys.pop();continue}p=t.call(r,s)}catch(_){p=[6,_],i=0}finally{n=o=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},j=jr(ht),T=$r(ht),dt=Oe,Xr=Qr(Re),es=function(r,t){return function(){return Yr(void 0,void 0,void 0,function(){var s;return Zr(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,r().then(at)];case 1:return[2,n.sent()];case 2:return s=n.sent(),[2,it(t(s))];case 3:return[2]}})})}},ts=function(r,t){return c(r,M(t))},rs=function(r,t){return c(r,ss(t))},M=Dr(Re),$e=he(3,Hr(Re)),ss=Ur(Nr),je=he(2,Gr(Jr)),ns=T,os="TaskEither",is={URI:os,map:ts,ap:rs,chain:je},as=ns(qe),us=xe(is),Ce=us,X=je,ae=je;function oe(r){return[r]}class ce extends K.errorClassWithData("ValidationError",(t,s)=>({input:t,issues:s}),"Validation error"){}class we extends K.errorClass("CSSVarsBoundError","CSS variables are already bound"){}class ft extends K.errorClass("NotAvailableError",oe){}class cs extends K.errorClass("InvalidEnvError",oe){}class mt extends K.errorClass("FunctionNotAvailableError",oe){}class J extends K.errorClass("InvalidArgumentsError",(t,s)=>[t,{cause:s}]){}class Se extends K.errorClass("ConcurrentCallError",oe){}class bt extends K.errorClass("SetEmojiStatusError",t=>[`Failed to set emoji status: ${t}`]){}class De extends K.errorClass("AccessDeniedError",oe){}class _t extends K.errorClass("FullscreenFailedError",oe){}class gt extends K.errorClass("ShareMessageError",oe){}class Ft extends K.errorClass("UnknownThemeParamsKeyError",t=>[`Unknown theme params key passed: ${t}`]){}function P(r,t){const s=g.computed(()=>G(t.version)||"100"),n=g.computed(()=>G(t.isTma)),{requires:i,returns:o}=t,u=i?typeof i=="object"?i:{every:[i]}:void 0,a=m=>{if(!t.supports)return!0;const F=t.supports[m];return h.supports(F.method,F.param,s())},l=()=>{if(!u)return;const[m,F]="every"in u?["every",u.every]:["some",u.some];for(let f=0;f<F.length;f++){const x=F[f],$=typeof x=="function"?x():h.supports(x,s())?void 0:`it is unsupported in Mini Apps version ${s()}`;if($&&(m==="every"||f===F.length-1))return $}},p=(...m)=>{for(const F in t.supports)if(t.supports[F].shouldCheck(...m)&&!a(F))return`option ${F} is not supported in Mini Apps version ${s()}`},_=g.computed(()=>!l()),b=g.computed(()=>s()!=="0.0"),C=g.computed(()=>t.isMounted?t.isMounted():!0),S=g.computed(()=>n()&&b()&&_()&&C()),E=m=>{const F=new mt(m);return["task","promise"].includes(t.returns)?j(F):O(F)},v=(...m)=>o==="plain"?Er(()=>r(...m),F=>F):o==="promise"?es(()=>r(...m),F=>F):r(...m);return Object.assign((...m)=>{var $;const F="Unable to call function:";if(!n())return E(`${F} it can't be called outside Mini Apps`);if(!b())return E(`${F} the SDK was not initialized. Use the SDK init() function`);const f=l();if(f)return E(`${F} ${f}`);const x=p(...m);if(x)return E(`${F} ${x}`);if(!C()){const V=($=t.isMounting)!=null&&$.call(t)?"mounting. Wait for the mount completion":"unmounted. Use the mount() method";return E(`${F} the component is ${V}`)}return v(...m)},r,{isAvailable:S,ifAvailable(...m){return S()?fe(v(...m)):ie}},u?{isSupported:_}:{},t.supports?{supports:a}:{})}function B(r){return t=>P(t,r)}function d(r){return Object.assign(R.throwifyFpFn(r),{ifAvailable(...t){return c(r.ifAvailable(...t),pt(()=>({ok:!1}),s=>({ok:!0,data:R.throwifyAnyEither(s)})))}})}function Ae(r){const t={};for(const s in r){const n=r[s];n!==void 0&&(t[s]=n)}return t}function ye(r,t){const s=Object.keys(r),n=Object.keys(t);return s.length!==n.length?!1:s.every(i=>Object.prototype.hasOwnProperty.call(t,i)&&r[i]===t[i])}class te{constructor({initialState:t,onChange:s}){e(this,"_state");e(this,"state");e(this,"setState",t=>{const s={...this.state(),...Ae(t)};ye(s,this.state())||this._state.set(s)});this._state=g.signal(t,{equals:ye}),this.state=g.computed(this._state),this.state.sub(s)}getter(t){return g.computed(()=>this._state()[t])}hasDiff(t){return!ye({...this.state(),...Ae(t)},this.state())}}class me{constructor({onMounted:t,restoreState:s,initialState:n,onUnmounted:i,isPageReload:o}){e(this,"_isMounted",g.signal(!1));e(this,"isMounted",g.computed(this._isMounted));e(this,"mount");e(this,"unmount");this.mount=()=>{if(this.isMounted())return I(void 0);const u=G(o)?s():void 0,a=u?I(u):typeof n=="function"?n():I(n);return c(a,U(l=>{g.batch(()=>{this._isMounted.set(!0),t==null||t(l)})}))},this.unmount=()=>{this._isMounted()&&g.batch(()=>{this._isMounted.set(!1),i==null||i()})}}}class ve{constructor({isTma:t,storage:s,onClick:n,offClick:i,initialState:o,isPageReload:u,postEvent:a,payload:l,method:p,version:_}){e(this,"isMounted");e(this,"isSupported");e(this,"state");e(this,"stateSetters");e(this,"stateBoolSetters");e(this,"setStateFp");e(this,"setState");e(this,"onClickFp");e(this,"onClick");e(this,"offClickFp");e(this,"offClick");e(this,"mountFp");e(this,"mount");e(this,"unmount");const b=new te({initialState:o,onChange(m){s.set(m)}}),C=new me({initialState:o,isPageReload:u,onMounted:b.setState,restoreState:s.get}),S={version:_,requires:p,isTma:t},E=B({...S,returns:"plain"}),v=B({...S,returns:"either",isMounted:C.isMounted});this.isMounted=C.isMounted,this.isSupported=Y(p,_),this.state=b.state,this.setStateFp=v(m=>{const F={...this.state(),...Ae(m)};return b.hasDiff(F)?c(a(p,l(F)),U(()=>{b.setState(F)})):I(void 0)}),this.setState=d(this.setStateFp),this.onClickFp=E(n),this.onClick=d(this.onClickFp),this.offClickFp=E(i),this.offClick=d(this.offClickFp),this.mountFp=E(()=>{const m=()=>{};return c(C.mount(),de(m,m))}),this.mount=d(this.mountFp),this.unmount=C.unmount,this.stateSetters=m=>{const F=v(f=>this.setStateFp({[m]:f}));return[d(F),F]},this.stateBoolSetters=m=>{const[,F]=this.stateSetters(m),f=v(()=>F(!1)),x=v(()=>F(!0));return[[d(f),f],[d(x),x]]}}stateGetter(t){return g.computed(()=>this.state()[t])}}class Ct{constructor(t){e(this,"isVisible");e(this,"isMounted");e(this,"isSupported");e(this,"hideFp");e(this,"hide");e(this,"showFp");e(this,"show");e(this,"onClickFp");e(this,"onClick");e(this,"offClickFp");e(this,"offClick");e(this,"mountFp");e(this,"mount");e(this,"unmount");const s=new ve({...t,method:"web_app_setup_back_button",payload:n=>({is_visible:n.isVisible}),initialState:{isVisible:!1}});this.isVisible=s.stateGetter("isVisible"),this.isMounted=s.isMounted,this.isSupported=s.isSupported,[[this.hide,this.hideFp],[this.show,this.showFp]]=s.stateBoolSetters("isVisible"),this.onClick=s.onClick,this.onClickFp=s.onClickFp,this.offClick=s.offClick,this.offClickFp=s.offClickFp,this.mount=s.mount,this.mountFp=s.mountFp,this.unmount=s.unmount}}function w(){return{isTma:g.computed(()=>h.isTMAFp())}}function ps(r){return{get:()=>R.getStorageValue(r),set(t){R.setStorageValue(r,t)}}}function ls(){return performance.getEntriesByType("navigation")[0]}function hs(){const r=ls();return!!r&&r.type==="reload"}function be(r){return t=>({...t,...G(r)})}function re(r){return be({storage:ps(r),isPageReload:hs})}function _e(r,t){return g.signal(r,t)}const wt=_e(h.postEventFp),ue=(...r)=>wt()(...r),St=(...r)=>R.throwifyAnyEither(ue(...r)),D=be({postEvent:ue}),Be=_e("0.0"),k=be({version:Be});function Ue(r,t){return{...c(w(),D,k,re(r)),onClick(s,n){return h.on(t,s,n)},offClick(s,n){h.off(t,s,n)}}}const ds=new Ct(Ue("backButton","back_button_pressed"));class Ge{constructor({initialState:t,onMounted:s,restoreState:n,onUnmounted:i,isPageReload:o}){e(this,"_isMounted",g.signal(!1));e(this,"isMounted",g.computed(this._isMounted));e(this,"mount");e(this,"unmount");this.mount=u=>{if(this._isMounted())return T(void 0);const a=G(o)?n():void 0;return c(a?T(a):t(u),M(l=>{this._isMounted()||g.batch(()=>{this._isMounted.set(!0),s==null||s(l)})}))},this.unmount=()=>{this._isMounted()&&g.batch(()=>{this._isMounted.set(!1),i==null||i()})}}}const nt=new ft("Biometry is not available");function ke(r){let t=!1,s=!1,n="",i=!1,o="",u=!1;return r.available&&(t=!0,s=r.token_saved,n=r.device_id,i=r.access_requested,o=r.type,u=r.access_granted),{available:t,tokenSaved:s,deviceId:n,type:o,accessGranted:u,accessRequested:i}}class vt{constructor({version:t,request:s,postEvent:n,storage:i,onInfoReceived:o,offInfoReceived:u,isTma:a,isPageReload:l}){e(this,"isAvailable");e(this,"isSupported");e(this,"isMounted");e(this,"state");e(this,"authenticateFp");e(this,"authenticate");e(this,"openSettingsFp");e(this,"openSettings");e(this,"requestAccessFp");e(this,"requestAccess");e(this,"updateTokenFp");e(this,"updateToken");e(this,"mountFp");e(this,"mount");e(this,"unmount");const p=m=>{_.setState(ke(m))},_=new te({initialState:{available:!1,type:"unknown",accessGranted:!1,accessRequested:!1,deviceId:"",tokenSaved:!1},onChange:i.set}),b=new Ge({initialState(m){return c(s("web_app_biometry_get_info","biometry_info_received",m),M(ke))},isPageReload:l,onMounted(m){_.setState(m),o(p)},onUnmounted(){u(p)},restoreState:i.get}),C={version:t,requires:"web_app_biometry_request_auth",isTma:a},S=B({...C,returns:"either"}),E=B({...C,returns:"task"}),v=B({...C,isMounted:b.isMounted,returns:"task"});this.isAvailable=_.getter("available"),this.isMounted=b.isMounted,this.isSupported=Y("web_app_biometry_request_auth",t),this.state=_.state,this.unmount=b.unmount,this.mountFp=E(b.mount),this.authenticateFp=v(m=>this.isAvailable()?c(s("web_app_biometry_request_auth","biometry_auth_requested",{...m,params:{reason:((m||{}).reason||"").trim()}}),M(F=>(_.setState({token:F.token}),F))):j(nt)),this.openSettingsFp=S(()=>n("web_app_biometry_open_settings")),this.requestAccessFp=v(m=>c(s("web_app_biometry_request_access","biometry_info_received",{...m,params:{reason:((m||{}).reason||"").trim()}}),X(F=>{const f=ke(F);return f.available?(_.setState(f),T(f.accessRequested)):j(nt)}))),this.updateTokenFp=v((m={})=>{var F;return c(s("web_app_biometry_update_token","biometry_token_updated",{...m,params:{token:m.token||"",reason:(F=m.reason)==null?void 0:F.trim()}}),M(f=>f.status))}),this.authenticate=d(this.authenticateFp),this.openSettings=d(this.openSettingsFp),this.requestAccess=d(this.requestAccessFp),this.updateToken=d(this.updateTokenFp),this.mount=d(this.mountFp)}}const He=(r,t,s)=>h.requestFp(r,t,{postEvent:ue,...s}),fs=(...r)=>lr.BetterPromise.fn(()=>He(...r)()),W=be({request:He}),ms=new vt({...c(w(),D,k,W,re("biometry")),offInfoReceived(r){h.off("biometry_info_received",r)},onInfoReceived(r){return h.on("biometry_info_received",r)}});class yt{constructor({postEvent:t,storage:s,isTma:n,isPageReload:i}){e(this,"isConfirmationEnabled");e(this,"isMounted");e(this,"mountFp");e(this,"mount");e(this,"unmount");e(this,"disableConfirmationFp");e(this,"disableConfirmation");e(this,"enableConfirmationFp");e(this,"enableConfirmation");const o=new te({initialState:{isConfirmationEnabled:!1},onChange(b){s.set(b)}}),u=new me({onMounted:o.setState,restoreState:s.get,initialState:{isConfirmationEnabled:!1},isPageReload:i}),a={requires:"web_app_setup_closing_behavior",isTma:n},l=B({...a,returns:"plain"}),p=B({...a,returns:"either",isMounted:u.isMounted}),_=b=>b===this.isConfirmationEnabled()?I(void 0):(o.setState({isConfirmationEnabled:b}),t("web_app_setup_closing_behavior",{need_confirmation:b}));this.isConfirmationEnabled=o.getter("isConfirmationEnabled"),this.isMounted=u.isMounted,this.disableConfirmationFp=p(()=>_(!1)),this.enableConfirmationFp=p(()=>_(!0)),this.mountFp=l(()=>{const b=()=>{};return c(u.mount(),de(b,b))}),this.unmount=u.unmount,this.disableConfirmation=d(this.disableConfirmationFp),this.enableConfirmation=d(this.enableConfirmationFp),this.mount=d(this.mountFp)}}const bs=new yt(c(w(),re("closingBehavior"),D));class kt{constructor({version:t,isTma:s,invokeCustomMethod:n}){e(this,"isSupported");e(this,"deleteItemFp");e(this,"deleteItem");e(this,"getItemFp");e(this,"getItem");e(this,"getItemsFp");e(this,"getItems");e(this,"getKeysFp");e(this,"getKeys");e(this,"setItemFp");e(this,"setItem");e(this,"clearFp");e(this,"clear");const i=B({version:t,requires:"web_app_invoke_custom_method",isTma:s,returns:"task"});this.isSupported=Y("web_app_invoke_custom_method",t),this.deleteItemFp=i((o,u)=>{const a=Array.isArray(o)?o:[o];return c(a.length?n("deleteStorageValues",{keys:a},u):T(void 0),M(()=>{}))}),this.getItemFp=i((o,u)=>c(this.getItemsFp([o],u),M(a=>a[o]||""))),this.getItemsFp=i((o,u)=>c(o.length?n("getStorageValues",{keys:o},u):T({}),M(a=>({...o.reduce((l,p)=>(l[p]="",l),{}),...y.parse(y.record(y.string(),y.string()),a)})))),this.getKeysFp=i(o=>c(n("getStorageKeys",{},o),M(u=>y.parse(y.array(y.string()),u)))),this.setItemFp=i((o,u,a)=>c(n("saveStorageValue",{key:o,value:u},a),M(()=>{}))),this.clearFp=i(o=>c(this.getKeysFp(o),X(this.deleteItemFp))),this.deleteItem=d(this.deleteItemFp),this.getItem=d(this.getItemFp),this.getItems=d(this.getItemsFp),this.getKeys=d(this.getKeysFp),this.setItem=d(this.setItemFp),this.clear=d(this.clearFp)}}const Ee=_e(0);function Qe(){return Ee.set(Ee()+1),Ee().toString()}function Et(r,t,s){return h.invokeCustomMethodFp(r,t,Qe(),{...s||{},postEvent:ue})}const We=be({invokeCustomMethod:Et}),_s=new kt(c(w(),k,We));function gs({request:r,...t}){return P(s=>c(r("web_app_request_emoji_status_access","emoji_status_access_requested",s),M(n=>n.status)),{...t,requires:"web_app_request_emoji_status_access",returns:"task"})}const At=gs(c(w(),k,W)),Fs=d(At);function Cs({request:r,...t}){return P((s,n)=>c(r("web_app_set_emoji_status",["emoji_status_set","emoji_status_failed"],{params:{custom_emoji_id:s,duration:(n||{}).duration},...n}),ae(i=>i&&"error"in i?j(new bt(i.error)):T(void 0))),{...t,requires:"web_app_set_emoji_status",returns:"task"})}const Bt=Cs(c(w(),W,k)),ws=d(Bt);class Pt{constructor({postEvent:t,isTma:s,version:n}){e(this,"isSupported");e(this,"impactOccurredFp");e(this,"impactOccurred");e(this,"notificationOccurredFp");e(this,"notificationOccurred");e(this,"selectionChangedFp");e(this,"selectionChanged");const i="web_app_trigger_haptic_feedback",o=B({requires:i,isTma:s,version:n,returns:"plain"});this.isSupported=Y(i,n),this.impactOccurredFp=o(u=>t(i,{type:"impact",impact_style:u})),this.notificationOccurredFp=o(u=>t(i,{type:"notification",notification_type:u})),this.selectionChangedFp=o(()=>t(i,{type:"selection_change"})),this.impactOccurred=d(this.impactOccurredFp),this.notificationOccurred=d(this.notificationOccurredFp),this.selectionChanged=d(this.selectionChangedFp)}}const Ss=new Pt(c(w(),D,k));function vs({postEvent:r,...t}){return P(()=>r("web_app_add_to_home_screen"),{...t,requires:"web_app_add_to_home_screen",returns:"either"})}const It=vs(c(w(),k,D)),ys=d(It);function ks({request:r,...t}){return P(s=>c(r("web_app_check_home_screen","home_screen_checked",s),M(n=>n.status||"unknown")),{...t,requires:"web_app_check_home_screen",returns:"task"})}const qt=ks(c(w(),k,W)),Es=d(qt);class xt{constructor({retrieveInitData:t}){e(this,"_state",g.signal());e(this,"_raw",g.signal());e(this,"state",g.computed(this._state));e(this,"authDate",this.fromState("auth_date"));e(this,"canSendAfter",this.fromState("can_send_after"));e(this,"canSendAfterDate",g.computed(()=>{const t=this.authDate(),s=this.canSendAfter();return s&&t?new Date(t.getTime()+s*1e3):void 0}));e(this,"chat",this.fromState("chat"));e(this,"chatType",this.fromState("chat_type"));e(this,"chatInstance",this.fromState("chat_instance"));e(this,"hash",this.fromState("hash"));e(this,"queryId",this.fromState("query_id"));e(this,"raw",g.computed(this._raw));e(this,"receiver",this.fromState("receiver"));e(this,"signature",this.fromState("signature"));e(this,"startParam",this.fromState("start_param"));e(this,"user",this.fromState("user"));e(this,"restoreFp");e(this,"restore");this.restoreFp=()=>c(t(),U(pt(()=>{},({raw:s,obj:n})=>{this._state.set(n),this._raw.set(s)}))),this.restore=R.throwifyFpFn(this.restoreFp)}fromState(t){return g.computed(()=>{const s=this._state();return s?s[t]:void 0})}}const As=new xt({retrieveInitData(){return c(Ar,rt("obj",()=>c(h.retrieveLaunchParamsFp(),U(({tgWebAppData:r})=>r?fe(r):ie))),rt("raw",h.retrieveRawInitDataFp),U(({obj:r,raw:t})=>c(Rr,st("obj",()=>r),st("raw",()=>t))))}});class Mt{constructor({version:t,request:s,isTma:n}){e(this,"isOpened");e(this,"isSupported");e(this,"openSlugFp");e(this,"openSlug");e(this,"openUrlFp");e(this,"openUrl");const i=B({version:t,isTma:n,requires:"web_app_open_invoice",returns:"task"}),o=g.signal(!1),u=()=>{o.set(!1)};this.isSupported=Y("web_app_open_invoice",t),this.isOpened=g.computed(o),this.openSlugFp=i((a,l)=>c(this.isOpened()?j(new Se("Invoice is already opened")):T(void 0),X(()=>(o.set(!0),s("web_app_open_invoice","invoice_closed",{...l,params:{slug:a},capture:p=>a===p.slug}))),$e(p=>(u(),p),p=>(u(),p.status)))),this.openUrlFp=i((a,l)=>{const{hostname:p,pathname:_}=new URL(a,window.location.href);if(p!=="t.me")return j(new J(`Link has unexpected hostname: ${p}`));const b=_.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);return b?this.openSlugFp(b[2],l):j(new J('Expected to receive a link with a pathname in format "/invoice/{slug}" or "/${slug}"'))}),this.openUrl=d(this.openUrlFp),this.openSlug=d(this.openSlugFp)}}const Bs=new Mt(c(w(),W,k));function Ps({postEvent:r,...t}){return P((s,n={})=>{if(typeof s=="string")try{s=new URL(s)}catch(i){return O(new J(`"${s.toString()}" is invalid URL`,i))}return r("web_app_open_link",{url:s.toString(),try_browser:n.tryBrowser,try_instant_view:n.tryInstantView})},{...t,returns:"either"})}const Tt=Ps(c(w(),D)),Is=d(Tt);function qs({postEvent:r,version:t,...s}){return P(n=>{const i=n.toString();return i.match(/^https:\/\/t.me\/.+/)?h.supports("web_app_open_tg_link",G(t))?(n=new URL(n),r("web_app_open_tg_link",{path_full:n.pathname+n.search})):(window.location.href=i,I(void 0)):O(new J(`"${i}" is invalid URL`))},{...s,returns:"either"})}const Ke=qs(c(w(),D,k)),xs=d(Ke);function Ms({openTelegramLink:r,...t}){return P((s,n)=>r("https://t.me/share/url?"+new URLSearchParams({url:s,text:n||""}).toString().replace(/\+/g,"%20")),{...t,returns:"either"})}const Lt=Ms({...w(),openTelegramLink:Ke}),Ts=d(Lt);function Ls(r){let t=!1,s,n;return r.available&&(t=!0,s=r.access_requested,n=r.access_granted),{available:t,accessGranted:n||!1,accessRequested:s||!1}}class Ot{constructor({version:t,request:s,postEvent:n,storage:i,isTma:o,isPageReload:u}){e(this,"state");e(this,"isAvailable");e(this,"isAccessGranted");e(this,"isAccessRequested");e(this,"isMounted");e(this,"isSupported");e(this,"openSettingsFp");e(this,"openSettings");e(this,"requestLocationFp");e(this,"requestLocation");e(this,"mountFp");e(this,"mount");e(this,"unmount");const a=new te({initialState:{available:!1,accessGranted:!1,accessRequested:!1},onChange:i.set}),l=new Ge({isPageReload:u,restoreState:i.get,onMounted:a.setState,initialState(S){return c(s("web_app_check_location","location_checked",S),M(Ls))}}),p={version:t,requires:"web_app_check_location",isTma:o},_=B({...p,returns:"either"}),b=B({...p,returns:"task"}),C=B({...p,returns:"task",isMounted:l.isMounted});this.isAvailable=a.getter("available"),this.isAccessRequested=a.getter("accessRequested"),this.isAccessGranted=a.getter("accessGranted"),this.isSupported=Y("web_app_check_location",t),this.isMounted=l.isMounted,this.state=a.state,this.unmount=l.unmount,this.mountFp=b(l.mount),this.openSettingsFp=_(()=>n("web_app_open_location_settings")),this.requestLocationFp=C(S=>c(s("web_app_request_location","location_requested",S),M(E=>{if(!E.available)return a.setState({available:!1}),null;const{available:v,...m}=E;return m}))),this.mount=d(this.mountFp),this.openSettings=d(this.openSettingsFp),this.requestLocation=d(this.requestLocationFp)}}const Os=new Ot(c(w(),D,k,W,re("locationManager")));class Vt{constructor({defaults:t,...s}){e(this,"bgColor");e(this,"hasShineEffect");e(this,"isEnabled");e(this,"isLoaderVisible");e(this,"isVisible");e(this,"isMounted");e(this,"state");e(this,"text");e(this,"textColor");e(this,"showFp");e(this,"show");e(this,"hideFp");e(this,"hide");e(this,"enableFp");e(this,"enable");e(this,"enableShineEffectFp");e(this,"enableShineEffect");e(this,"disableFp");e(this,"disable");e(this,"disableShineEffectFp");e(this,"disableShineEffect");e(this,"setBgColorFp");e(this,"setBgColor");e(this,"setTextColorFp");e(this,"setTextColor");e(this,"setTextFp");e(this,"setText");e(this,"showLoaderFp");e(this,"showLoader");e(this,"hideLoaderFp");e(this,"hideLoader");e(this,"setParamsFp");e(this,"setParams");e(this,"mountFp");e(this,"mount");e(this,"unmount");e(this,"onClickFp");e(this,"onClick");e(this,"offClickFp");e(this,"offClick");const n=new ve({...s,version:"100",initialState:{hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Continue"},method:"web_app_setup_main_button",payload:o=>({has_shine_effect:o.hasShineEffect,is_visible:o.isVisible,is_active:o.isEnabled,is_progress_visible:o.isLoaderVisible,text:o.text,color:o.bgColor,text_color:o.textColor})}),i=(o,u)=>{const a=n.stateGetter(o);return g.computed(()=>a()||G(u))};this.bgColor=i("bgColor",t.bgColor),this.textColor=i("textColor",t.textColor),this.hasShineEffect=n.stateGetter("hasShineEffect"),this.isEnabled=n.stateGetter("isEnabled"),this.isLoaderVisible=n.stateGetter("isLoaderVisible"),this.text=n.stateGetter("text"),this.isVisible=n.stateGetter("isVisible"),this.isMounted=n.isMounted,this.state=n.state,[this.setBgColor,this.setBgColorFp]=n.stateSetters("bgColor"),[this.setTextColor,this.setTextColorFp]=n.stateSetters("textColor"),[[this.disableShineEffect,this.disableShineEffectFp],[this.enableShineEffect,this.enableShineEffectFp]]=n.stateBoolSetters("hasShineEffect"),[[this.disable,this.disableFp],[this.enable,this.enableFp]]=n.stateBoolSetters("isEnabled"),[[this.hideLoader,this.hideLoaderFp],[this.showLoader,this.showLoaderFp]]=n.stateBoolSetters("isLoaderVisible"),[this.setText,this.setTextFp]=n.stateSetters("text"),[[this.hide,this.hideFp],[this.show,this.showFp]]=n.stateBoolSetters("isVisible"),this.setParams=n.setState,this.setParamsFp=n.setStateFp,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 Rt(r,t,s){return c(Ue(r,t),n=>({...n,defaults:s}))}const Pe=_e({});function ze(r,t){document.documentElement.style.setProperty(r,t)}function Ne(r){document.documentElement.style.removeProperty(r)}function $t(r){return c(q.toRGBFullFp(r),U(t=>Math.sqrt([.299,.587,.114].reduce((s,n,i)=>{const o=parseInt(t.slice(1+i*2,1+(i+1)*2),16);return s+o*o*n},0))<120))}const Je=R.throwifyFpFn($t);class jt{constructor({initialState:t,onChange:s,offChange:n,isTma:i,storage:o,isPageReload:u}){e(this,"accentTextColor");e(this,"bgColor");e(this,"buttonColor");e(this,"buttonTextColor");e(this,"bottomBarBgColor");e(this,"destructiveTextColor");e(this,"headerBgColor");e(this,"hintColor");e(this,"linkColor");e(this,"secondaryBgColor");e(this,"sectionBgColor");e(this,"sectionHeaderTextColor");e(this,"sectionSeparatorColor");e(this,"subtitleTextColor");e(this,"textColor");e(this,"_isCssVarsBound",g.signal(!1));e(this,"isCssVarsBound",g.computed(this._isCssVarsBound));e(this,"bindCssVarsFp");e(this,"bindCssVars");e(this,"state");e(this,"isDark",g.computed(()=>{const t=this.bgColor();return!t||Je(t)}));e(this,"isMounted");e(this,"mountFp");e(this,"mount");e(this,"unmount");const a=new te({initialState:{},onChange:o.set}),l=S=>{a.setState(S.theme_params)},p=new me({initialState:()=>I(G(t)),isPageReload:u,onMounted(S){a.setState(S),s(l)},onUnmounted(){n(l)},restoreState:o.get}),_={isTma:i,returns:"either"},b=B(_),C=B({..._,isMounted:p.isMounted});this.accentTextColor=a.getter("accent_text_color"),this.bgColor=a.getter("bg_color"),this.buttonColor=a.getter("button_color"),this.buttonTextColor=a.getter("button_text_color"),this.bottomBarBgColor=a.getter("bottom_bar_bg_color"),this.destructiveTextColor=a.getter("destructive_text_color"),this.headerBgColor=a.getter("header_bg_color"),this.hintColor=a.getter("hint_color"),this.linkColor=a.getter("link_color"),this.secondaryBgColor=a.getter("secondary_bg_color"),this.sectionBgColor=a.getter("section_bg_color"),this.sectionHeaderTextColor=a.getter("section_header_text_color"),this.sectionSeparatorColor=a.getter("section_separator_color"),this.subtitleTextColor=a.getter("subtitle_text_color"),this.textColor=a.getter("text_color"),this.state=a.state,this.isMounted=p.isMounted,this.bindCssVarsFp=C(S=>{if(this._isCssVarsBound())return O(new we);S||(S=m=>`--tg-theme-${R.snakeToKebab(m)}`);const E=m=>{Object.entries(a.state()).forEach(([F,f])=>{f&&m(F,f)})},v=()=>{E((m,F)=>{ze(S(m),F)})};return v(),a.state.sub(v),this._isCssVarsBound.set(!0),I(()=>{E(Ne),a.state.unsub(v),this._isCssVarsBound.set(!1)})}),this.mountFp=b(p.mount),this.unmount=p.unmount,this.bindCssVars=d(this.bindCssVarsFp),this.mount=d(this.mountFp)}}const le=new jt({...c(w(),re("themeParams")),offChange(r){h.off("theme_changed",r)},onChange(r){h.on("theme_changed",r)},initialState:Pe}),Vs=new Vt(Rt("mainButton","main_button_pressed",{bgColor:g.computed(()=>le.buttonColor()||"#2481cc"),textColor:g.computed(()=>le.buttonTextColor()||"#ffffff")}));class Dt{constructor({storage:t,isPageReload:s,version:n,postEvent:i,isTma:o,theme:u,onVisibilityChanged:a,offVisibilityChanged:l}){e(this,"isSupported");e(this,"isDark",g.computed(()=>{const t=this.bgColorRgb();return t?Je(t):!1}));e(this,"isActive");e(this,"state");e(this,"isCssVarsBound");e(this,"bindCssVarsFp");e(this,"bindCssVars");e(this,"isMounted");e(this,"mountFp");e(this,"mount");e(this,"unmount");e(this,"bgColor");e(this,"bgColorRgb");e(this,"setBgColorFp");e(this,"setBgColor");e(this,"headerColor");e(this,"headerColorRgb");e(this,"setHeaderColorFp");e(this,"setHeaderColor");e(this,"bottomBarColor");e(this,"bottomBarColorRgb");e(this,"setBottomBarColorFp");e(this,"setBottomBarColor");e(this,"closeFp");e(this,"close");e(this,"readyFp");e(this,"ready");const p=f=>{C.setState({isActive:f.is_visible})},_=f=>{[[this.headerColor,"web_app_set_header_color"],[this.bgColor,"web_app_set_background_color"],[this.bottomBarColor,"web_app_set_bottom_bar_color"]].forEach(([x,$])=>{const V=x();if(console.log(V,$),!q.isRGB(V)&&($!=="web_app_set_header_color"||!["bg_color","secondary_bg_color"].includes(V))){const H=f[V];H&&i($,{color:H})}})},b=new me({initialState(){return I({bgColor:"bg_color",headerColor:"header_bg_color",bottomBarColor:"bottom_bar_bg_color",isActive:!0})},isPageReload:s,onMounted:f=>{a(p),u.sub(_),C.setState(f)},onUnmounted(){l(p),u.unsub(_)},restoreState:t.get});this.isMounted=b.isMounted,this.mountFp=P(()=>{const f=()=>{};return c(b.mount(),de(f,f))},{isTma:o,returns:"plain"}),this.mount=d(this.mountFp),this.unmount=b.unmount;const C=new te({initialState:{bgColor:"bg_color",bottomBarColor:"bottom_bar_bg_color",headerColor:"bg_color",isActive:!1},onChange:t.set});this.state=C.state;const S=f=>q.isRGB(f)?f:G(u)[f],E=f=>g.computed(()=>S(f()));this.isActive=C.getter("isActive"),this.isSupported=g.computed(()=>["web_app_set_header_color","web_app_set_background_color","web_app_set_bottom_bar_color"].some(f=>h.supports(f,G(n))));const v=g.signal(!1);this.isCssVarsBound=g.computed(v),this.bindCssVarsFp=P(f=>{if(v())return O(new we);const[x,$]=R.createCbCollector(()=>{v.set(!1)}),V=(H,Q)=>{const z=()=>{ze(H,Q()||null)};z(),x(Q.sub(z),Ne.bind(null,H))};return f||(f=H=>`--tg-${R.camelToKebab(H)}`),V(f("bgColor"),this.bgColorRgb),V(f("bottomBarColor"),this.bottomBarColorRgb),V(f("headerColor"),this.headerColorRgb),v.set(!0),I($)},{isTma:o,returns:"either",isMounted:this.isMounted}),this.bindCssVars=d(this.bindCssVarsFp);const m=f=>{const x=C.getter(f),$=E(x),V={headerColor:"web_app_set_header_color",bgColor:"web_app_set_background_color",bottomBarColor:"web_app_set_bottom_bar_color"}[f],H=P(Q=>{if(Q===x())return I(void 0);if(V==="web_app_set_header_color"&&(Q==="bg_color"||Q==="secondary_bg_color"))return c(i("web_app_set_header_color",{color_key:Q}),U(()=>{C.setState({[f]:Q})}));const z=S(Q);return c(z?i(V,{color:z}):O(new Ft(Q)),U(()=>{C.setState({[f]:z})}))},{isTma:o,version:n,requires:V,isMounted:this.isMounted,returns:"either",supports:f==="headerColor"?{rgb:{method:"web_app_set_header_color",param:"color",shouldCheck:q.isRGB}}:void 0});return[x,$,d(H),H]};[this.bgColor,this.bgColorRgb,this.setBgColor,this.setBgColorFp]=m("bgColor"),[this.headerColor,this.headerColorRgb,this.setHeaderColor,this.setHeaderColorFp]=m("headerColor"),[this.bottomBarColor,this.bottomBarColorRgb,this.setBottomBarColor,this.setBottomBarColorFp]=m("bottomBarColor");const F=B({isTma:o,returns:"either"});this.closeFp=F(f=>i("web_app_close",{return_back:f})),this.close=d(this.closeFp),this.readyFp=F(()=>i("web_app_ready")),this.ready=d(this.readyFp)}}const Ut=new Dt({...c(w(),D,k,re("miniApp")),offVisibilityChanged(r){h.off("visibility_changed",r)},onVisibilityChanged(r){h.on("visibility_changed",r)},theme:le.state});function Rs(r){const t=r.message.trim(),s=(r.title||"").trim(),n=r.buttons||[];if(s.length>64)return O(new J(`Invalid title: ${s}`));if(!t||t.length>256)return O(new J(`Invalid message: ${t}`));if(n.length>3)return O(new J(`Invalid buttons count: ${n.length}`));const i=[];if(!n.length)i.push({type:"close",id:""});else for(let o=0;o<n.length;o++){const u=n[o],a=u.id||"";if(a.length>64)return O(new J(`Button with index ${o} has invalid id: ${a}`));if(!u.type||u.type==="default"||u.type==="destructive"){const l=u.text.trim();if(!l||l.length>64)return O(new J(`Button with index ${o} has invalid text: ${l}`));i.push({type:u.type,text:l,id:a})}else i.push({type:u.type,id:a})}return I({title:s,message:t,buttons:i})}class Gt{constructor({version:t,isTma:s,request:n}){e(this,"isOpened");e(this,"isSupported");e(this,"showFp");e(this,"show");const i=g.signal(!1),o=()=>{i.set(!1)},u=B({version:t,isTma:s,requires:"web_app_open_popup",returns:"task"});this.isSupported=Y("web_app_open_popup",t),this.isOpened=g.computed(i),this.showFp=u(a=>c(this.isOpened()?j(new Se("A popup is already opened")):T(void 0),ae(()=>dt(Rs(a))),X(l=>(i.set(!0),n("web_app_open_popup","popup_closed",{...a,params:l}))),$e(l=>(o(),l),l=>(o(),l.button_id)))),this.show=d(this.showFp)}}const $s=new Gt(c(w(),W,k));function js({request:r,...t}){return P(s=>c(r("web_app_request_phone","phone_requested",s),M(n=>n.status)),{...t,requires:"web_app_request_phone",returns:"task"})}const Ye=js(c(w(),k,W)),Ds=d(Ye);function Us({invokeCustomMethod:r,requestPhoneAccess:t,...s}){const n=u=>c(r("getRequestedContact",{},{...u,timeout:(u||{}).timeout||5e3}),ae(a=>{const l=y.safeParse(y.string(),a);if(!l.success)return j(new ce(a,l.issues));if(!l.output)return T(void 0);const p=y.safeParse(q.pipeQueryToSchema(y.looseObject({contact:q.pipeJsonToSchema(y.looseObject({user_id:y.number(),phone_number:y.string(),first_name:y.string(),last_name:y.optional(y.string())})),auth_date:y.pipe(y.string(),y.transform(_=>new Date(Number(_)*1e3)),y.date()),hash:y.string()})),l.output);return p.success?T({raw:l.output,parsed:p.output}):j(new ce(l.output,p.issues))})),i=u=>c(n(u),Xr(a=>ce.is(a)?O(a):I(void 0),a=>I(a))),o=u=>R.BetterTaskEither(async(a,l,p)=>{let _=50;for(;!p.isRejected;){const b=await i(p)();if(b._tag==="Left")return l(b.left);if(b.right)return a(b.right);await new Promise(C=>setTimeout(C,_)),_+=50}},u);return P(u=>R.BetterTaskEither.fn(a=>c(i(a),X(l=>l?T(l):c(t(a),ae(p=>p==="sent"?o(a):j(new De("User denied access")))))),u),{...s,returns:"task",requires:"web_app_request_phone"})}function Gs({requestContact:r,...t}){return P(r,{...t,returns:"task",requires:"web_app_request_phone"})}const Ze=Us({...c(w(),We,k),requestPhoneAccess:Ye}),Hs=d(Ze),Ht=Gs({...c(w(),k),requestContact(r){return c(Ze(r),M(t=>t.parsed))}}),Qs=d(Ht);function Ws({request:r,...t}){return P(s=>c(r("web_app_request_write_access","write_access_requested",s),M(n=>n.status)),{...t,requires:"web_app_request_write_access",returns:"task"})}const Qt=Ws(c(w(),k,W)),Ks=d(Qt);class Wt{constructor({version:t,onClosed:s,onTextReceived:n,isTma:i,postEvent:o}){e(this,"isOpened");e(this,"isSupported");e(this,"captureFp");e(this,"capture");e(this,"closeFp");e(this,"close");e(this,"openFp");e(this,"open");const u={version:t,requires:"web_app_open_scan_qr_popup",isTma:i},a=B({...u,returns:"either"}),l=B({...u,returns:"task"}),p=g.signal(!1),_=()=>{p.set(!1)};this.isSupported=Y("web_app_open_scan_qr_popup",t),this.isOpened=g.computed(p),this.captureFp=l(b=>{let C;return c(this.openFp({...b,onCaptured:S=>{b.capture(S)&&(C=S,this.close())}}),M(()=>C))}),this.closeFp=a(()=>c(o("web_app_close_scan_qr_popup"),U(_))),this.openFp=l(b=>c(this.isOpened()?j(new Se("The QR Scanner is already opened")):async()=>o("web_app_open_scan_qr_popup",{text:b.text}),ae(()=>{const[C,S]=R.createCbCollector(),E=v=>(S(),v);return c(R.BetterTaskEither(v=>{C(s(v),n(b.onCaptured))},b),$e(E,E))}))),this.open=d(this.openFp),this.capture=d(this.captureFp),this.close=d(this.closeFp)}}const zs=new Wt({...c(w(),D,k),onClosed(r){return h.on("scan_qr_popup_closed",r)},onTextReceived(r){return h.on("qr_text_received",t=>{r(t.data)})}});class Kt{constructor({defaults:t,...s}){e(this,"isSupported");e(this,"position");e(this,"bgColor");e(this,"hasShineEffect");e(this,"isEnabled");e(this,"isLoaderVisible");e(this,"isVisible");e(this,"isMounted");e(this,"state");e(this,"text");e(this,"textColor");e(this,"showFp");e(this,"show");e(this,"hideFp");e(this,"hide");e(this,"enableFp");e(this,"enable");e(this,"enableShineEffectFp");e(this,"enableShineEffect");e(this,"disableFp");e(this,"disable");e(this,"disableShineEffectFp");e(this,"disableShineEffect");e(this,"setBgColorFp");e(this,"setBgColor");e(this,"setTextColorFp");e(this,"setTextColor");e(this,"setTextFp");e(this,"setText");e(this,"setPositionFp");e(this,"setPosition");e(this,"showLoaderFp");e(this,"showLoader");e(this,"hideLoaderFp");e(this,"hideLoader");e(this,"setParamsFp");e(this,"setParams");e(this,"mountFp");e(this,"mount");e(this,"unmount");e(this,"onClickFp");e(this,"onClick");e(this,"offClickFp");e(this,"offClick");const n=new ve({...s,initialState:{hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Cancel",position:"left"},method:"web_app_setup_secondary_button",payload:o=>({has_shine_effect:o.hasShineEffect,is_visible:o.isVisible,is_active:o.isEnabled,is_progress_visible:o.isLoaderVisible,text:o.text,color:o.bgColor,text_color:o.textColor,position:o.position})}),i=(o,u)=>{const a=n.stateGetter(o);return g.computed(()=>a()||G(u))};this.isSupported=Y("web_app_setup_secondary_button",s.version),this.bgColor=i("bgColor",t.bgColor),this.textColor=i("textColor",t.textColor),this.position=n.stateGetter("position"),this.hasShineEffect=n.stateGetter("hasShineEffect"),this.isEnabled=n.stateGetter("isEnabled"),this.isLoaderVisible=n.stateGetter("isLoaderVisible"),this.text=n.stateGetter("text"),this.isVisible=n.stateGetter("isVisible"),this.isMounted=n.isMounted,this.state=n.state,[this.setPosition,this.setPositionFp]=n.stateSetters("position"),[this.setBgColor,this.setBgColorFp]=n.stateSetters("bgColor"),[this.setTextColor,this.setTextColorFp]=n.stateSetters("textColor"),[[this.disableShineEffect,this.disableShineEffectFp],[this.enableShineEffect,this.enableShineEffectFp]]=n.stateBoolSetters("hasShineEffect"),[[this.disable,this.disableFp],[this.enable,this.enableFp]]=n.stateBoolSetters("isEnabled"),[[this.hideLoader,this.hideLoaderFp],[this.showLoader,this.showLoaderFp]]=n.stateBoolSetters("isLoaderVisible"),[this.setText,this.setTextFp]=n.stateSetters("text"),[[this.hide,this.hideFp],[this.show,this.showFp]]=n.stateBoolSetters("isVisible"),this.setParams=n.setState,this.setParamsFp=n.setStateFp,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 Ns=new Kt(Rt("secondaryButton","secondary_button_pressed",{bgColor:g.computed(()=>Ut.bottomBarColorRgb()||"#000000"),textColor:g.computed(()=>le.buttonColor()||"#2481cc")}));class zt{constructor(t){e(this,"isVisible");e(this,"isMounted");e(this,"isSupported");e(this,"hideFp");e(this,"hide");e(this,"showFp");e(this,"show");e(this,"onClickFp");e(this,"onClick");e(this,"offClickFp");e(this,"offClick");e(this,"mountFp");e(this,"mount");e(this,"unmount");const s=new ve({...t,method:"web_app_setup_settings_button",payload:n=>({is_visible:n.isVisible}),initialState:{isVisible:!1}});this.isVisible=s.stateGetter("isVisible"),this.isMounted=s.isMounted,this.isSupported=s.isSupported,[[this.hide,this.hideFp],[this.show,this.showFp]]=s.stateBoolSetters("isVisible"),this.onClick=s.onClick,this.onClickFp=s.onClickFp,this.offClick=s.offClick,this.offClickFp=s.offClickFp,this.mount=s.mount,this.mountFp=s.mountFp,this.unmount=s.unmount}}const Js=new zt(Ue("settingsButton","settings_button_pressed"));class Nt{constructor({postEvent:t,storage:s,isTma:n,isPageReload:i,version:o}){e(this,"isSupported");e(this,"isVerticalEnabled");e(this,"isMounted");e(this,"mountFp");e(this,"mount");e(this,"unmount");e(this,"disableVerticalFp");e(this,"disableVertical");e(this,"enableVerticalFp");e(this,"enableVertical");const u=new te({initialState:{isVerticalEnabled:!1},onChange(C){s.set(C)}}),a=new me({initialState:{isVerticalEnabled:!1},isPageReload:i,onMounted:u.setState,restoreState:s.get}),l={requires:"web_app_setup_swipe_behavior",isTma:n,version:o},p=B({...l,returns:"plain"}),_=B({...l,isMounted:a.isMounted,returns:"either"}),b=C=>{const S={isVerticalEnabled:C};return u.hasDiff(S)?c(t("web_app_setup_swipe_behavior",{allow_vertical_swipe:C}),U(()=>{u.setState(S)})):I(void 0)};this.isSupported=Y("web_app_setup_swipe_behavior",o),this.isVerticalEnabled=u.getter("isVerticalEnabled"),this.isMounted=a.isMounted,this.disableVerticalFp=_(()=>b(!1)),this.enableVerticalFp=_(()=>b(!0)),this.mountFp=p(()=>{const C=()=>{};return c(a.mount(),de(C,C))}),this.unmount=a.unmount,this.disableVertical=d(this.disableVerticalFp),this.enableVertical=d(this.enableVerticalFp),this.mount=d(this.mountFp)}}const Ys=new Nt(c(w(),D,k,re("swipeBehavior")));async function Zs(r){try{const{clipboard:s}=navigator;if(s)return await s.writeText(r)}catch{}const t=document.createElement("textarea");t.value=r,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}finally{document.body.removeChild(t)}}function Xs({request:r,...t}){return P((s,n,i)=>c(r("web_app_request_file_download","file_download_requested",{...i,params:{url:s,file_name:n}}),X(o=>o.status==="downloading"?T(void 0):j(new De("User denied the action")))),{...t,requires:"web_app_request_file_download",returns:"task"})}const Jt=Xs(c(w(),W,k)),en=d(Jt);function tn({invokeCustomMethod:r,...t}){return P(s=>c(r("getCurrentTime",{},s),X(n=>{const i=y.safeParse(y.pipe(y.number(),y.integer(),y.transform(o=>new Date(o*1e3)),y.date()),n);return i.success?T(i.output):j(new ce(n,i.issues))})),{...t,requires:"web_app_invoke_custom_method",returns:"task"})}const Yt=tn(c(w(),We,k)),rn=d(Yt);function sn({postEvent:r,...t}){return P(()=>r("web_app_hide_keyboard"),{...t,returns:"either",requires:"web_app_hide_keyboard"})}const Zt=sn(c(w(),D,k)),nn=d(Zt);function on({request:r,createRequestId:t,...s}){return P(n=>{const i=t();return c(r("web_app_read_text_from_clipboard","clipboard_text_received",{...n,params:{req_id:i},capture:h.captureSameReq(i)}),M(({data:o=null})=>o))},{...s,requires:"web_app_read_text_from_clipboard",returns:"task"})}const Xt=on({...c(w(),k,W),createRequestId:Qe}),an=d(Xt);function er(r){const t={},s=r.match(/Telegram-Android(?:\/([^ ]+))?(?: (\([^)]+\))?|$)/);if(s){const[,n,i]=s;n&&(t.appVersion=n),i&&i.slice(1,i.length-1).split(";").forEach(o=>{const[u,a]=o.trim().split(" ");if(u==="Android")t.androidVersion=a;else if(u==="SDK"){const l=parseInt(a,10);l&&(t.sdkVersion=l)}else a?(t.manufacturer=u,t.model=a):t.performanceClass=u})}return t}function un(){return er(navigator.userAgent)}function cn({postEvent:r,...t}){return P(s=>{const{size:n}=new Blob([s]);return!n||n>4096?O(new J(n?"Maximum size of data to send is 4096 bytes":"Attempted to send empty data")):r("web_app_data_send",{data:s})},{...t,returns:"either"})}const tr=cn(c(w(),D)),pn=d(tr);function ln({request:r,...t}){return P((s,n)=>c(r("web_app_send_prepared_message",["prepared_message_failed","prepared_message_sent"],{...n,params:{id:s}}),X(i=>i&&"error"in i?j(new gt(i.error)):T(void 0))),{...t,requires:"web_app_send_prepared_message",returns:"task"})}const rr=ln(c(w(),W,k)),hn=d(rr);function dn({postEvent:r,...t}){return P((s,n={})=>r("web_app_share_to_story",{text:n.text,media_url:s,widget_link:n.widgetLink}),{...t,requires:"web_app_share_to_story",returns:"either"})}const sr=dn(c(w(),D,k)),fn=d(sr),Ie=_e(!1);function mn({isInlineMode:r,postEvent:t,...s}){return P((n,i)=>t("web_app_switch_inline_query",{query:n,chat_types:i||[]}),{...s,requires:{every:["web_app_switch_inline_query",()=>G(r)?void 0:"The application must be launched in the inline mode"]},returns:"either"})}const nr=mn({...c(w(),D,k),isInlineMode:Ie}),bn=d(nr);class or{constructor({storage:t,isPageReload:s,onContentSafeAreaInsetsChanged:n,onSafeAreaInsetsChanged:i,onViewportChanged:o,onFullscreenChanged:u,offContentSafeAreaInsetsChanged:a,offFullscreenChanged:l,offSafeAreaInsetsChanged:p,offViewportChanged:_,request:b,isViewportStable:C,isFullscreen:S,isTma:E,version:v,postEvent:m}){e(this,"state");e(this,"height");e(this,"stableHeight");e(this,"width");e(this,"isExpanded");e(this,"isStable",g.computed(()=>this.height()===this.stableHeight()));e(this,"contentSafeAreaInsets");e(this,"contentSafeAreaInsetTop");e(this,"contentSafeAreaInsetLeft");e(this,"contentSafeAreaInsetRight");e(this,"contentSafeAreaInsetBottom");e(this,"safeAreaInsets");e(this,"safeAreaInsetTop");e(this,"safeAreaInsetLeft");e(this,"safeAreaInsetRight");e(this,"safeAreaInsetBottom");e(this,"isFullscreen");e(this,"requestFullscreenFp");e(this,"requestFullscreen");e(this,"exitFullscreenFp");e(this,"exitFullscreen");e(this,"isCssVarsBound");e(this,"bindCssVarsFp");e(this,"bindCssVars");e(this,"isMounted");e(this,"mountFp");e(this,"mount");e(this,"expandFp");e(this,"expand");const F={top:0,right:0,left:0,bottom:0},f=new te({initialState:{contentSafeAreaInsets:F,height:0,isExpanded:!1,isFullscreen:!1,safeAreaInsets:F,stableHeight:0,width:0},onChange:t.set}),x=A=>{f.setState({isExpanded:A.is_expanded,height:A.height,width:A.width,stableHeight:A.is_state_stable?A.height:void 0})},$=A=>{f.setState({isFullscreen:A.is_fullscreen})},V=A=>{f.setState({safeAreaInsets:A})},H=A=>{f.setState({contentSafeAreaInsets:A})},Q=new Ge({initialState(A){const se=Z=>()=>{const[ee,N]=Z==="safe-area"?["web_app_request_safe_area","safe_area_changed"]:["web_app_request_content_safe_area","content_safe_area_changed"];return h.supports(ee,G(v))?b(ee,N,A):T({top:0,left:0,right:0,bottom:0})},L=Z=>()=>typeof Z=="boolean"?T(Z):dt(Z());return c(as,Ce("safeAreaInsets",se("safe-area")),Ce("contentSafeAreaInsets",se("content-safe-area")),Ce("isFullscreen",L(S)),Ce("isViewportStable",L(C)),ae(({isViewportStable:Z,...ee})=>Z?T({...ee,height:window.innerHeight,isExpanded:!0,stableHeight:window.innerHeight,width:window.innerWidth}):c(b("web_app_request_viewport","viewport_changed",A),M(N=>({...ee,height:N.height,isExpanded:N.is_expanded,stableHeight:N.is_state_stable?N.height:0,width:N.width})))))},isPageReload:s,onMounted(A){o(x),u($),i(V),n(H),f.setState(A)},onUnmounted(){_(x),l($),p(V),a(H)},restoreState:t.get}),z=A=>g.computed(()=>this.safeAreaInsets()[A]),ge=A=>g.computed(()=>this.contentSafeAreaInsets()[A]);this.state=f.state,this.height=f.getter("height"),this.stableHeight=f.getter("stableHeight"),this.width=f.getter("width"),this.isExpanded=f.getter("isExpanded"),this.safeAreaInsets=f.getter("safeAreaInsets"),this.safeAreaInsetTop=z("top"),this.safeAreaInsetBottom=z("bottom"),this.safeAreaInsetLeft=z("left"),this.safeAreaInsetRight=z("right"),this.contentSafeAreaInsets=f.getter("contentSafeAreaInsets"),this.contentSafeAreaInsetTop=ge("top"),this.contentSafeAreaInsetBottom=ge("bottom"),this.contentSafeAreaInsetLeft=ge("left"),this.contentSafeAreaInsetRight=ge("right");const ar=B({isTma:E,returns:"task"}),Xe=B({isTma:E,returns:"either"}),ur=B({isTma:E,requires:"web_app_request_fullscreen",version:v,returns:"task"}),et=A=>ur(se=>c(b(A?"web_app_request_fullscreen":"web_app_exit_fullscreen",["fullscreen_changed","fullscreen_failed"],se),X(L=>"error"in L&&L.error!=="ALREADY_FULLSCREEN"?j(new _t(L.error)):(f.setState({isFullscreen:"is_fullscreen"in L?L.is_fullscreen:!0}),T(void 0)))));this.isMounted=Q.isMounted,this.mountFp=ar(Q.mount),this.mount=d(this.mountFp),this.isFullscreen=f.getter("isFullscreen"),this.requestFullscreenFp=et(!0),this.requestFullscreen=d(this.requestFullscreenFp),this.exitFullscreenFp=et(!1),this.exitFullscreen=d(this.exitFullscreenFp);const Fe=g.signal(!1);this.isCssVarsBound=g.computed(Fe),this.bindCssVarsFp=Xe(A=>{if(Fe())return O(new we);A||(A=L=>`--tg-viewport-${R.camelToKebab(L)}`);const se=[["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((L,[Z,ee])=>{const N=A(Z);if(N){const tt=()=>{ze(N,`${ee()}px`)};L.push({update:tt,removeListener:ee.sub(tt),cssVar:N})}return L},[]);return se.forEach(L=>{L.update()}),Fe.set(!0),I(()=>{se.forEach(L=>{L.removeListener(),Ne(L.cssVar)}),Fe.set(!1)})}),this.bindCssVars=d(this.bindCssVarsFp),this.expandFp=Xe(()=>m("web_app_expand")),this.expand=d(this.expandFp)}}function _n(){const r=o=>({on:u=>{h.on(o,u)},off:u=>{h.off(o,u)}}),t=r("viewport_changed"),s=r("fullscreen_changed"),n=r("safe_area_changed"),i=r("content_safe_area_changed");return new or({...c(w(),re("viewport"),k,D,W),isFullscreen(){return c(h.retrieveLaunchParamsFp(),U(o=>!!o.tgWebAppFullscreen))},isViewportStable(){return c(h.retrieveLaunchParamsFp(),U(o=>["macos","tdesktop","unigram","webk","weba","web"].includes(o.tgWebAppPlatform)))},offContentSafeAreaInsetsChanged:i.off,offFullscreenChanged:s.off,offSafeAreaInsetsChanged:n.off,offViewportChanged:t.off,onContentSafeAreaInsetsChanged:i.on,onFullscreenChanged:s.on,onSafeAreaInsetsChanged:n.on,onViewportChanged:t.on})}const gn=_n();function ir(r={}){const{version:t,isInlineMode:s,themeParams:n}=r;if(t&&typeof s=="boolean"&&n)Be.set(t),Ie.set(s),Pe.set(n);else{const a=c(h.retrieveLaunchParamsFp(),ct(l=>l,l=>{Be.set(t||l.tgWebAppVersion),Ie.set(typeof s=="boolean"?s:!!l.tgWebAppBotInline),Pe.set(n||l.tgWebAppThemeParams)}));if(a)return O(a)}r.postEvent&&wt.set(r.postEvent);const[i,o]=R.createCbCollector(h.on("reload_iframe",()=>{h.logger().log("Received a request to reload the page"),St("iframe_will_reload"),window.location.reload()})),{acceptCustomStyles:u=!0}=r;if(u){const a=document.createElement("style");a.id="telegram-custom-styles",document.head.appendChild(a),i(h.on("set_custom_style",l=>{a.innerHTML=l}),()=>{document.head.removeChild(a)})}return c(ue("iframe_ready",{reload_supported:!0}),U(()=>(h.logger().log("The package was initialized"),o)))}const Fn=R.throwifyFpFn(ir);Object.defineProperty(exports,"CancelledError",{enumerable:!0,get:()=>h.CancelledError});Object.defineProperty(exports,"InvalidLaunchParamsError",{enumerable:!0,get:()=>h.InvalidLaunchParamsError});Object.defineProperty(exports,"InvokeCustomMethodFailedError",{enumerable:!0,get:()=>h.InvokeCustomMethodFailedError});Object.defineProperty(exports,"LaunchParamsRetrieveError",{enumerable:!0,get:()=>h.LaunchParamsRetrieveError});Object.defineProperty(exports,"MethodParameterUnsupportedError",{enumerable:!0,get:()=>h.MethodParameterUnsupportedError});Object.defineProperty(exports,"MethodUnsupportedError",{enumerable:!0,get:()=>h.MethodUnsupportedError});Object.defineProperty(exports,"TimeoutError",{enumerable:!0,get:()=>h.TimeoutError});Object.defineProperty(exports,"UnknownEnvError",{enumerable:!0,get:()=>h.UnknownEnvError});Object.defineProperty(exports,"applyPolyfills",{enumerable:!0,get:()=>h.applyPolyfills});Object.defineProperty(exports,"createLogger",{enumerable:!0,get:()=>h.createLogger});Object.defineProperty(exports,"createPostEvent",{enumerable:!0,get:()=>h.createPostEvent});Object.defineProperty(exports,"createStartParam",{enumerable:!0,get:()=>h.createStartParam});Object.defineProperty(exports,"createStartParamFp",{enumerable:!0,get:()=>h.createStartParamFp});Object.defineProperty(exports,"debug",{enumerable:!0,get:()=>h.debug});Object.defineProperty(exports,"decodeBase64Url",{enumerable:!0,get:()=>h.decodeBase64Url});Object.defineProperty(exports,"decodeBase64UrlFp",{enumerable:!0,get:()=>h.decodeBase64UrlFp});Object.defineProperty(exports,"decodeStartParam",{enumerable:!0,get:()=>h.decodeStartParam});Object.defineProperty(exports,"decodeStartParamFp",{enumerable:!0,get:()=>h.decodeStartParamFp});Object.defineProperty(exports,"deepSnakeToCamelObjKeys",{enumerable:!0,get:()=>h.deepSnakeToCamelObjKeys});Object.defineProperty(exports,"emitEvent",{enumerable:!0,get:()=>h.emitEvent});Object.defineProperty(exports,"encodeBase64Url",{enumerable:!0,get:()=>h.encodeBase64Url});Object.defineProperty(exports,"getReleaseVersion",{enumerable:!0,get:()=>h.getReleaseVersion});Object.defineProperty(exports,"isSafeToCreateStartParam",{enumerable:!0,get:()=>h.isSafeToCreateStartParam});Object.defineProperty(exports,"isTMA",{enumerable:!0,get:()=>h.isTMA});Object.defineProperty(exports,"isTMAFp",{enumerable:!0,get:()=>h.isTMAFp});Object.defineProperty(exports,"logger",{enumerable:!0,get:()=>h.logger});Object.defineProperty(exports,"mockTelegramEnv",{enumerable:!0,get:()=>h.mockTelegramEnv});Object.defineProperty(exports,"off",{enumerable:!0,get:()=>h.off});Object.defineProperty(exports,"offAll",{enumerable:!0,get:()=>h.offAll});Object.defineProperty(exports,"on",{enumerable:!0,get:()=>h.on});Object.defineProperty(exports,"retrieveLaunchParams",{enumerable:!0,get:()=>h.retrieveLaunchParams});Object.defineProperty(exports,"retrieveLaunchParamsFp",{enumerable:!0,get:()=>h.retrieveLaunchParamsFp});Object.defineProperty(exports,"retrieveRawInitData",{enumerable:!0,get:()=>h.retrieveRawInitData});Object.defineProperty(exports,"retrieveRawInitDataFp",{enumerable:!0,get:()=>h.retrieveRawInitDataFp});Object.defineProperty(exports,"retrieveRawLaunchParams",{enumerable:!0,get:()=>h.retrieveRawLaunchParams});Object.defineProperty(exports,"retrieveRawLaunchParamsFp",{enumerable:!0,get:()=>h.retrieveRawLaunchParamsFp});Object.defineProperty(exports,"setDebug",{enumerable:!0,get:()=>h.setDebug});Object.defineProperty(exports,"setTargetOrigin",{enumerable:!0,get:()=>h.setTargetOrigin});Object.defineProperty(exports,"supports",{enumerable:!0,get:()=>h.supports});Object.defineProperty(exports,"targetOrigin",{enumerable:!0,get:()=>h.targetOrigin});Object.defineProperty(exports,"isAnyRGB",{enumerable:!0,get:()=>q.isAnyRGB});Object.defineProperty(exports,"isRGB",{enumerable:!0,get:()=>q.isRGB});Object.defineProperty(exports,"isRGBA",{enumerable:!0,get:()=>q.isRGBA});Object.defineProperty(exports,"isRGBAShort",{enumerable:!0,get:()=>q.isRGBAShort});Object.defineProperty(exports,"isRGBShort",{enumerable:!0,get:()=>q.isRGBShort});Object.defineProperty(exports,"parseInitDataQuery",{enumerable:!0,get:()=>q.parseInitDataQuery});Object.defineProperty(exports,"parseInitDataQueryFp",{enumerable:!0,get:()=>q.parseInitDataQueryFp});Object.defineProperty(exports,"parseLaunchParamsQuery",{enumerable:!0,get:()=>q.parseLaunchParamsQuery});Object.defineProperty(exports,"parseLaunchParamsQueryFp",{enumerable:!0,get:()=>q.parseLaunchParamsQueryFp});Object.defineProperty(exports,"serializeInitDataQuery",{enumerable:!0,get:()=>q.serializeInitDataQuery});Object.defineProperty(exports,"serializeLaunchParamsQuery",{enumerable:!0,get:()=>q.serializeLaunchParamsQuery});Object.defineProperty(exports,"toRGB",{enumerable:!0,get:()=>q.toRGB});Object.defineProperty(exports,"toRGBFp",{enumerable:!0,get:()=>q.toRGBFp});Object.defineProperty(exports,"toRGBFull",{enumerable:!0,get:()=>q.toRGBFull});Object.defineProperty(exports,"toRGBFullFp",{enumerable:!0,get:()=>q.toRGBFullFp});exports.AccessDeniedError=De;exports.BackButton=Ct;exports.Biometry=vt;exports.CSSVarsBoundError=we;exports.ClosingBehavior=yt;exports.CloudStorage=kt;exports.ConcurrentCallError=Se;exports.FullscreenFailedError=_t;exports.FunctionUnavailableError=mt;exports.HapticFeedback=Pt;exports.InitData=xt;exports.InvalidArgumentsError=J;exports.InvalidEnvError=cs;exports.Invoice=Mt;exports.LocationManager=Ot;exports.MainButton=Vt;exports.MiniApp=Dt;exports.NotAvailableError=ft;exports.Popup=Gt;exports.QrScanner=Wt;exports.SecondaryButton=Kt;exports.SetEmojiStatusError=bt;exports.SettingsButton=zt;exports.ShareMessageError=gt;exports.SwipeBehavior=Nt;exports.ThemeParams=jt;exports.UnknownThemeParamsKeyError=Ft;exports.ValidationError=ce;exports.Viewport=or;exports.addToHomeScreen=ys;exports.addToHomeScreenFp=It;exports.backButton=ds;exports.biometry=ms;exports.checkHomeScreenStatus=Es;exports.checkHomeScreenStatusFp=qt;exports.closingBehavior=bs;exports.cloudStorage=_s;exports.copyTextToClipboard=Zs;exports.createRequestId=Qe;exports.downloadFile=en;exports.downloadFileFp=Jt;exports.getCurrentTime=rn;exports.getCurrentTimeFp=Yt;exports.hapticFeedback=Ss;exports.hideKeyboard=nn;exports.hideKeyboardFp=Zt;exports.init=Fn;exports.initData=As;exports.initFp=ir;exports.invoice=Bs;exports.invokeCustomMethod=Et;exports.isColorDark=Je;exports.isColorDarkFp=$t;exports.locationManager=Os;exports.mainButton=Vs;exports.miniApp=Ut;exports.openLink=Is;exports.openLinkFp=Tt;exports.openTelegramLink=xs;exports.openTelegramLinkFp=Ke;exports.popup=$s;exports.postEvent=St;exports.postEventFp=ue;exports.qrScanner=zs;exports.readTextFromClipboard=an;exports.readTextFromClipboardFp=Xt;exports.request=fs;exports.requestContact=Qs;exports.requestContactComplete=Hs;exports.requestContactCompleteFp=Ze;exports.requestContactFp=Ht;exports.requestEmojiStatusAccess=Fs;exports.requestEmojiStatusAccessFp=At;exports.requestFp=He;exports.requestPhoneAccess=Ds;exports.requestPhoneAccessFp=Ye;exports.requestWriteAccess=Ks;exports.requestWriteAccessFp=Qt;exports.retrieveAndroidDeviceData=un;exports.retrieveAndroidDeviceDataFrom=er;exports.secondaryButton=Ns;exports.sendData=pn;exports.sendDataFp=tr;exports.setEmojiStatus=ws;exports.setEmojiStatusFp=Bt;exports.settingsButton=Js;exports.shareMessage=hn;exports.shareMessageFp=rr;exports.shareStory=fn;exports.shareStoryFp=sr;exports.shareURL=Ts;exports.shareURLFp=Lt;exports.swipeBehavior=Ys;exports.switchInlineQuery=bn;exports.switchInlineQueryFp=nr;exports.themeParams=le;exports.viewport=gn;
2
2
  //# sourceMappingURL=index.cjs.map