@tma.js/bridge 2.2.0 → 2.2.1
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/dts/errors.d.ts +6 -6
- package/dist/dts/launch-params.d.ts +3 -3
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.iife.js +3 -3
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +161 -146
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/dts/errors.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
declare const MethodUnsupportedError_base: import('error-kid').ErrorClass<[method: string, version: string]>;
|
|
2
|
-
export declare class MethodUnsupportedError extends MethodUnsupportedError_base {
|
|
2
|
+
export declare class MethodUnsupportedError extends /* @__PURE__ */ MethodUnsupportedError_base {
|
|
3
3
|
}
|
|
4
4
|
declare const MethodParameterUnsupportedError_base: import('error-kid').ErrorClass<[method: string, param: string, version: string]>;
|
|
5
|
-
export declare class MethodParameterUnsupportedError extends MethodParameterUnsupportedError_base {
|
|
5
|
+
export declare class MethodParameterUnsupportedError extends /* @__PURE__ */ MethodParameterUnsupportedError_base {
|
|
6
6
|
}
|
|
7
7
|
declare const LaunchParamsRetrieveError_base: import('error-kid').ErrorClassWithData<[{
|
|
8
8
|
source: string;
|
|
@@ -13,15 +13,15 @@ declare const LaunchParamsRetrieveError_base: import('error-kid').ErrorClassWith
|
|
|
13
13
|
error: unknown;
|
|
14
14
|
}[];
|
|
15
15
|
}>;
|
|
16
|
-
export declare class LaunchParamsRetrieveError extends LaunchParamsRetrieveError_base {
|
|
16
|
+
export declare class LaunchParamsRetrieveError extends /* @__PURE__ */ LaunchParamsRetrieveError_base {
|
|
17
17
|
}
|
|
18
18
|
declare const InvalidLaunchParamsError_base: import('error-kid').ErrorClass<[launchParams: string, cause: unknown]>;
|
|
19
|
-
export declare class InvalidLaunchParamsError extends InvalidLaunchParamsError_base {
|
|
19
|
+
export declare class InvalidLaunchParamsError extends /* @__PURE__ */ InvalidLaunchParamsError_base {
|
|
20
20
|
}
|
|
21
21
|
declare const UnknownEnvError_base: import('error-kid').ErrorClass<[]>;
|
|
22
|
-
export declare class UnknownEnvError extends UnknownEnvError_base {
|
|
22
|
+
export declare class UnknownEnvError extends /* @__PURE__ */ UnknownEnvError_base {
|
|
23
23
|
}
|
|
24
24
|
declare const InvokeCustomMethodFailedError_base: import('error-kid').ErrorClass<[error: string]>;
|
|
25
|
-
export declare class InvokeCustomMethodFailedError extends InvokeCustomMethodFailedError_base {
|
|
25
|
+
export declare class InvokeCustomMethodFailedError extends /* @__PURE__ */ InvokeCustomMethodFailedError_base {
|
|
26
26
|
}
|
|
27
27
|
export {};
|
|
@@ -9,7 +9,7 @@ export type RetrieveLaunchParamsResult = LaunchParamsGenType;
|
|
|
9
9
|
/**
|
|
10
10
|
* @returns Launch parameters from any known source.
|
|
11
11
|
*/
|
|
12
|
-
export declare
|
|
12
|
+
export declare function retrieveLaunchParamsFp(): E.Either<RetrieveLaunchParamsError, RetrieveLaunchParamsResult>;
|
|
13
13
|
/**
|
|
14
14
|
* @see retrieveLaunchParamsFp
|
|
15
15
|
*/
|
|
@@ -17,11 +17,11 @@ export declare const retrieveLaunchParams: () => RetrieveLaunchParamsResult;
|
|
|
17
17
|
/**
|
|
18
18
|
* @returns Raw init data from any known source.
|
|
19
19
|
*/
|
|
20
|
-
export declare
|
|
20
|
+
export declare function retrieveRawInitDataFp(): E.Either<RetrieveRawInitDataError, O.Option<string>>;
|
|
21
21
|
/**
|
|
22
22
|
* @see retrieveRawInitDataFp
|
|
23
23
|
*/
|
|
24
|
-
export declare
|
|
24
|
+
export declare function retrieveRawInitData(): string | undefined;
|
|
25
25
|
/**
|
|
26
26
|
* @returns Launch parameters in a raw format from any known source.
|
|
27
27
|
*/
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("valibot"),_=require("@tma.js/toolkit"),A=require("better-promises"),E=require("error-kid"),w=require("@tma.js/transformers"),b=require("@tma.js/signals"),Oe=require("mitt");function
|
|
2
|
-
`)]){}class de extends E.errorClass("InvalidLaunchParamsError",(r,t)=>[`Invalid value for launch params: ${r}`,{cause:t}]){}class
|
|
3
|
-
`),r,s)}vr(t,a)}const{on:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("valibot"),_=require("@tma.js/toolkit"),A=require("better-promises"),E=require("error-kid"),w=require("@tma.js/transformers"),b=require("@tma.js/signals"),Oe=require("mitt");function U(e){return i.is(i.looseObject({TelegramWebviewProxy:i.looseObject({postEvent:i.function()})}),e)}function W(){try{return window.self!==window.top}catch{return!0}}var Le=function(e,r,t){if(t||arguments.length===2)for(var n=0,o=r.length,a;n<o;n++)(a||!(n in r))&&(a||(a=Array.prototype.slice.call(r,0,n)),a[n]=r[n]);return e.concat(a||Array.prototype.slice.call(r))};function $e(e){return e}function re(e,r,t,n,o,a,s,u,p){switch(arguments.length){case 1:return e;case 2:return function(){return r(e.apply(this,arguments))};case 3:return function(){return t(r(e.apply(this,arguments)))};case 4:return function(){return n(t(r(e.apply(this,arguments))))};case 5:return function(){return o(n(t(r(e.apply(this,arguments)))))};case 6:return function(){return a(o(n(t(r(e.apply(this,arguments))))))};case 7:return function(){return s(a(o(n(t(r(e.apply(this,arguments)))))))};case 8:return function(){return u(s(a(o(n(t(r(e.apply(this,arguments))))))))};case 9:return function(){return p(u(s(a(o(n(t(r(e.apply(this,arguments)))))))))}}}function m(e,r,t,n,o,a,s,u,p){switch(arguments.length){case 1:return e;case 2:return r(e);case 3:return t(r(e));case 4:return n(t(r(e)));case 5:return o(n(t(r(e))));case 6:return a(o(n(t(r(e)))));case 7:return s(a(o(n(t(r(e))))));case 8:return u(s(a(o(n(t(r(e)))))));case 9:return p(u(s(a(o(n(t(r(e))))))));default:{for(var c=arguments[0],l=1;l<arguments.length;l++)c=arguments[l](c);return c}}}var C=function(e,r){var t=typeof e=="number"?function(n){return n.length>=e}:e;return function(){var n=Array.from(arguments);return t(arguments)?r.apply(this,n):function(o){return r.apply(void 0,Le([o],n,!1))}}},je={_tag:"None"},Re=function(e){return{_tag:"Some",value:e}},Ue=function(e){return e._tag==="Left"},We=function(e){return{_tag:"Left",left:e}},Ie=function(e){return{_tag:"Right",right:e}},g=We,f=Ie,te=C(2,function(e,r){return P(e)?e:r(e.right)}),Be=function(e){return function(r){return P(r)?r:f(e(r.right))}},Ve=function(e,r){return function(t){return P(t)?g(e(t.left)):f(r(t.right))}},ze=function(e){return function(r){return P(r)?g(e(r.left)):r}},P=Ue,ne=function(e,r){return function(t){return P(t)?e(t.left):r(t.right)}},De=ne,I=ne,Ge=I,B=function(e,r){try{return f(e())}catch(t){return g(r(t))}},Je=te,Ne=te,Qe=je,Ke=Re,He=function(e){return e._tag==="None"},Ye=function(e,r){return function(t){return He(t)?e():r(t.value)}},Xe=Ye;function Ze(e){return re(f,e.of)}function er(e){return re(g,e.of)}function rr(e){return function(r,t){return e.chain(r,function(n){return P(n)?e.of(n):t(n.right)})}}function tr(e){return function(r,t,n){return e.map(r,Ve(t,n))}}function nr(e){return function(r,t){return function(n){return e.map(n,I(r,t))}}}var ae=function(e,r){return m(e,or(r))},ar=function(e,r){return m(e,sr(r))},or=function(e){return function(r){return function(){return Promise.resolve().then(r).then(e)}}},sr=function(e){return function(r){return function(){return Promise.all([Promise.resolve().then(r),Promise.resolve().then(e)]).then(function(t){var n=t[0],o=t[1];return n(o)})}}},oe=function(e){return function(){return Promise.resolve(e)}},ir=C(2,function(e,r){return function(){return Promise.resolve().then(e).then(function(t){return r(t)()})}}),se="Task",ie={URI:se,map:ae},ue={of:oe},ur={URI:se,map:ae,of:oe,ap:ar,chain:ir},cr=er(ue),ce=Ze(ue),pe=nr(ie),le=C(3,tr(ie)),_e=C(2,rr(ur)),pr=_e,fe=_e;class me extends E.errorClass("MethodUnsupportedError",(r,t)=>[`Method "${r}" is unsupported in Mini Apps version ${t}`]){}class he extends E.errorClass("MethodParameterUnsupportedError",(r,t,n)=>[`Parameter "${t}" of "${r}" method is unsupported in Mini Apps version ${n}`]){}class ge extends E.errorClassWithData("LaunchParamsRetrieveError",r=>({errors:r}),r=>[["Unable to retrieve launch parameters from any known source. Perhaps, you have opened your app outside Telegram?","📖 Refer to docs for more information:","https://docs.telegram-mini-apps.com/packages/tma-js-bridge/environment","","Collected errors:",...r.map(({source:t,error:n})=>`Source: ${t} / ${n instanceof Error?n.message:String(n)}`)].join(`
|
|
2
|
+
`)]){}class de extends E.errorClass("InvalidLaunchParamsError",(r,t)=>[`Invalid value for launch params: ${r}`,{cause:t}]){}class V extends E.errorClass("UnknownEnvError"){}class we extends E.errorClass("InvokeCustomMethodError",r=>[`Server returned error: ${r}`]){}const Q="launchParams";function K(e){return e.replace(/^[^?#]*[?#]/,"").replace(/[?#]/g,"&")}function be(){return m(x(),Je(w.parseLaunchParamsQueryFp))}const lr=_.throwifyFpFn(be);function ve(){return m(x(),Be(e=>{const r=new URLSearchParams(e).get("tgWebAppData");return r?Ke(r):Qe}))}function _r(){return m(ve(),Ge(e=>{throw e},e=>e),Xe(()=>{},e=>e))}function x(){const e=[];for(const[r,t]of[[()=>K(window.location.href),"window.location.href"],[()=>{const n=performance.getEntriesByType("navigation")[0];return n&&K(n.name)},"performance navigation entries"],[()=>_.getStorageValue(Q),"local storage"]]){const n=r();if(!n){e.push({source:t,error:new Error("Source is empty")});continue}const o=m(w.parseLaunchParamsQueryFp(n),De(a=>a,()=>!0));if(typeof o!="boolean"){e.push({source:t,error:o});continue}return _.setStorageValue(Q,n),f(n)}return g(new ge(e))}const fr=_.throwifyFpFn(x);function mr(e,r){const t=new Map,n=Oe(),o=(a,s,u=!1)=>{const p=t.get(a)||new Map;t.set(a,p);const c=p.get(s)||[];p.set(s,c);const l=c.findIndex(h=>h[1]===u);if(l>=0&&(n.off(a,c[l][0]),c.splice(l,1),!c.length&&(p.delete(s),!p.size))){const h=t.size;t.delete(a),h&&!t.size&&r()}};return{on(a,s,u){!t.size&&e();const p=()=>{o(a,s,u)},c=(...d)=>{u&&p(),a==="*"?s({name:d[0],payload:d[1]}):s(...d)};n.on(a,c);const l=t.get(a)||new Map;t.set(a,l);const h=l.get(s)||[];return l.set(s,h),h.push([c,u||!1]),p},off:o,emit:n.emit,clear(){const a=t.size;n.all.clear(),t.clear(),a&&r()}}}function F(e,r){window.dispatchEvent(new MessageEvent("message",{data:JSON.stringify({eventType:e,eventData:r}),source:window.parent}))}const M=b.signal(!1),z=b.signal("https://web.telegram.org"),hr=e=>{v().log("Event received:",e)},D=b.computed(M);function gr(e){e!==M()&&(M.set(e),(e?q:Ee)("*",hr))}const G=b.computed(z);function dr(e){z.set(e),v().log("New target origin set",e)}const y=b.signal((...e)=>{window.parent.postMessage(...e)}),v=b.signal(_.createLogger("Bridge",{bgColor:"#9147ff",textColor:"white",shouldLog:D}));function wr(){Pe(),[y,z,G,M,D,v].forEach(e=>{e.unsubAll(),"reset"in e&&e.reset()})}function $(e,r,t){const n=[t],o=e[r];typeof o=="function"&&n.push(o);const a=(...u)=>{n.forEach(p=>p(...u))},s=Object.assign((...u)=>{a(...u)},{unwrap(){const{length:u}=n;if(u===1){delete e[r];return}if(u===2){Y(e,r,n[1]);return}n.unshift(1),Y(e,r,a)}});ye(e,r,()=>s,u=>n.push(u))}function H(e,r){const t=e[r];ye(e,r,()=>t,n=>{Object.entries(n).forEach(([o,a])=>{t[o]=a})})}function ye(e,r,t,n){Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:t,set:n})}function Y(e,r,t){Object.defineProperty(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t})}const br={clipboard_text_received:i.looseObject({req_id:i.string(),data:i.nullish(i.string())}),custom_method_invoked:i.looseObject({req_id:i.string(),result:i.optional(i.unknown()),error:i.optional(i.string())}),popup_closed:i.nullish(i.looseObject({button_id:i.nullish(i.string(),()=>{})}),{}),viewport_changed:i.nullish(i.looseObject({height:i.number(),width:i.nullish(i.number(),()=>window.innerWidth),is_state_stable:i.boolean(),is_expanded:i.boolean()}),()=>({height:window.innerHeight,is_state_stable:!0,is_expanded:!0})),theme_changed:i.looseObject({theme_params:w.themeParams()})};function X(e){if(e.source!==window.parent)return;let r;try{r=i.parse(w.pipeJsonToSchema(w.miniAppsMessage()),e.data)}catch{return}const{eventType:t,eventData:n}=r,o=br[t];let a;try{a=o?i.parse(o,n):n}catch(s){return v().forceError([`An error occurred processing the "${t}" event from the Telegram application.`,"Please, file an issue here:","https://github.com/Telegram-Mini-Apps/tma.js/issues/new/choose"].join(`
|
|
3
|
+
`),r,s)}vr(t,a)}const{on:q,off:Ee,emit:vr,clear:Pe}=mr(()=>{const e=window;!e.TelegramGameProxy&&(e.TelegramGameProxy={}),$(e.TelegramGameProxy,"receiveEvent",F),H(e,"TelegramGameProxy"),!e.Telegram&&(e.Telegram={}),!e.Telegram.WebView&&(e.Telegram.WebView={}),$(e.Telegram.WebView,"receiveEvent",F),H(e.Telegram,"WebView"),$(e,"TelegramGameProxy_receiveEvent",F),window.addEventListener("message",X)},()=>{[["TelegramGameProxy_receiveEvent"],["TelegramGameProxy","receiveEvent"],["Telegram","WebView","receiveEvent"]].forEach(e=>{const r=window;let t=[void 0,r];for(const a of e)if(t=[t[1],t[1][a]],!t[1])return;const[n,o]=t;"unwrap"in o&&(o.unwrap(),n&&n!==r&&!Object.keys(n).length&&delete r[e[0]])}),window.removeEventListener("message",X)}),ke=(...e)=>y()(...e);function Se(e,r){m(k(e,r),ze(t=>{throw t}))}function k(e,r){v().log("Posting event:",r?{eventType:e,eventData:r}:{eventType:e});const t=window,n=JSON.stringify({eventType:e,eventData:r});return W()?(ke(n,G()),f(void 0)):U(t)?(t.TelegramWebviewProxy.postEvent(e,JSON.stringify(r)),f(void 0)):i.is(i.looseObject({external:i.looseObject({notify:i.function()})}),t)?(t.external.notify(n),f(void 0)):g(new V)}function O(e,r,t={}){const{capture:n=()=>!0,postEvent:o=k}=t,a=b.signal(),[s,u]=_.createCbCollector();(Array.isArray(r)?r:[r]).forEach(c=>{s(q(c,l=>{const h=Array.isArray(r);n(h?{event:c,payload:l}:l)&&a.set([h?{event:c,payload:l}:l])}))});const p=c=>(u(),c);return m(async()=>o(e,t.params),fe(()=>_.BetterTaskEither((c,l,h)=>{const d=a();if(d)return c(d[0]);const S=T=>{T&&c(T[0])},L=()=>{a.unsub(S)};a.sub(S),h.on("finalized",L)},t)),le(p,p))}function yr(e,r,t){const{postEvent:n}=t||{};return _.throwifyAnyEither(O(e,r,{...t,postEvent:n?(...o)=>{try{return n(...o),f(void 0)}catch(a){return g(a)}}:k}))}function Er(e,r){const t=Te(e,r);return typeof t=="function"?A.BetterPromise.fn(()=>_.throwifyAnyEither(t)):t}function Te(e,r){const t=U(window);if(!e)return t||m(x(),I(()=>!1,()=>!0));if(t)return ce(!0);const{timeout:n=100}=r||{};return m(O("web_app_request_theme","theme_changed",{...r,timeout:n}),pe(o=>A.TimeoutError.is(o)||V.is(o)?f(!1):g(o),()=>f(!0)))}function Pr({launchParams:e,onEvent:r,resetPostMessage:t}={}){if(e){const a=typeof e=="string"||e instanceof URLSearchParams?e.toString():w.serializeLaunchParamsQuery({...e,tgWebAppData:void 0})+(e.tgWebAppData?`&tgWebAppData=${encodeURIComponent(e.tgWebAppData.toString())}`:"");try{w.parseLaunchParamsQuery(a)}catch(s){throw new de(a,s)}_.setStorageValue("launchParams",a)}if(W()){if(!r)return;t&&y.reset();const a=y();y.set((...s)=>{const[u]=s,p=()=>{a(...s)};try{const c=i.parse(w.pipeJsonToSchema(w.miniAppsMessage()),u);r({name:c.eventType,params:c.eventData},p)}catch{p()}});return}const n=window.TelegramWebviewProxy||{},o=n.postEvent||(()=>{});window.TelegramWebviewProxy={...n,postEvent(a,s){const u=()=>{o(a,s)};r?r({name:a,params:s?JSON.parse(s):void 0},u):u()}},v().log("Environment was mocked by the mockTelegramEnv function")}function Ae(e){return({req_id:r})=>r===e}const Z={"6.0":["iframe_ready","iframe_will_reload","web_app_close","web_app_data_send","web_app_expand","web_app_open_link","web_app_ready","web_app_request_theme","web_app_request_viewport","web_app_setup_main_button","web_app_setup_closing_behavior"],6.1:["web_app_open_tg_link","web_app_open_invoice","web_app_setup_back_button","web_app_set_background_color","web_app_set_header_color","web_app_trigger_haptic_feedback"],6.2:["web_app_open_popup"],6.4:["web_app_close_scan_qr_popup","web_app_open_scan_qr_popup","web_app_read_text_from_clipboard",{method:"web_app_open_link",param:"try_instant_view"}],6.7:["web_app_switch_inline_query"],6.9:["web_app_invoke_custom_method","web_app_request_write_access","web_app_request_phone",{method:"web_app_set_header_color",param:"color"}],"6.10":["web_app_setup_settings_button"],7.2:["web_app_biometry_get_info","web_app_biometry_open_settings","web_app_biometry_request_access","web_app_biometry_request_auth","web_app_biometry_update_token"],7.6:[{method:"web_app_open_link",param:"try_browser"},{method:"web_app_close",param:"return_back"}],7.7:["web_app_setup_swipe_behavior"],7.8:["web_app_share_to_story"],"7.10":["web_app_setup_secondary_button","web_app_set_bottom_bar_color",{method:"web_app_setup_main_button",param:"has_shine_effect"}],"8.0":["web_app_request_safe_area","web_app_request_content_safe_area","web_app_request_fullscreen","web_app_exit_fullscreen","web_app_set_emoji_status","web_app_add_to_home_screen","web_app_check_home_screen","web_app_request_emoji_status_access","web_app_check_location","web_app_open_location_settings","web_app_request_file_download","web_app_request_location","web_app_send_prepared_message","web_app_start_accelerometer","web_app_start_device_orientation","web_app_start_gyroscope","web_app_stop_accelerometer","web_app_stop_device_orientation","web_app_stop_gyroscope","web_app_toggle_orientation_lock"],"9.0":["web_app_device_storage_clear","web_app_device_storage_get_key","web_app_device_storage_save_key","web_app_secure_storage_clear","web_app_secure_storage_get_key","web_app_secure_storage_restore_key","web_app_secure_storage_save_key"],9.1:["web_app_hide_keyboard"]};function j(e,r){return Object.keys(Z).find(n=>Z[n].some(o=>r?typeof o=="object"&&o.method===e&&o.param===r:o===e))||null}function ee(e){return e.split(".").map(Number)}function xe(e,r){const t=ee(e),n=ee(r),o=Math.max(t.length,n.length);for(let a=0;a<o;a+=1){const s=t[a]||0,u=n[a]||0;if(s!==u)return s>u?1:-1}return 0}function R(e,r,t){const n=t?j(e,r):j(e);return n?xe(n,t||r)<=0:!1}function kr(e,r="strict"){const t=typeof r=="function"?r:n=>{const{method:o,version:a}=n,s="param"in n?new he(o,n.param,a):new me(o,a);if(r==="strict")throw s;return v().forceWarn(s.message)};return(n,o)=>R(n,e)?n==="web_app_set_header_color"&&i.is(i.looseObject({color:i.any()}),o)&&!R(n,"color",e)?t({version:e,method:n,param:"color"}):Se(n,o):t({version:e,method:n})}function Fe(e,r,t,n){return m(O("web_app_invoke_custom_method","custom_method_invoked",{...n||{},params:{method:e,params:r,req_id:t},capture:Ae(t)}),pr(({result:o,error:a})=>a?cr(new we(a)):ce(o)))}function Sr(e,r,t,n){return A.BetterPromise.fn(()=>m(Fe(e,r,t,n),pe(o=>{throw o},o=>o))())}function Me(e,r,t={}){const{capture:n=()=>!0,postEvent:o=k}=t,a=b.signal(),[s,u]=_.createCbCollector();(Array.isArray(r)?r:[r]).forEach(c=>{s(q(c,l=>{(Array.isArray(r)?n({event:c,payload:l}):n(l))&&a.set([l])}))});const p=c=>(u(),c);return m(async()=>o(e,t.params),fe(()=>_.BetterTaskEither((c,l,h)=>{const d=a();if(d)return c(d[0]);const S=T=>{T&&c(T[0])},L=()=>{a.unsub(S)};a.sub(S),h.on("finalized",L)},t)),le(p,p))}function Tr(e,r,t){const{postEvent:n}=t||{};return _.throwifyAnyEither(Me(e,r,{...t,postEvent:n?(...o)=>{try{return n(...o),f(void 0)}catch(a){return g(a)}}:k}))}function Ar(){Object.hasOwn||(Object.hasOwn=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)})}function J(e){return B(()=>decodeURIComponent(atob(e.replace(/-/g,"+").replace(/_/g,"/")).split("").map(r=>"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)).join("")),r=>r)}const xr=_.throwifyFpFn(J);function N(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(r,t)=>String.fromCharCode(parseInt(`0x${t}`)))).replace(/\+/g,"-").replace(/\//g,"_")}var Fr=function(e){return B(function(){return JSON.parse(e)},$e)};function Ce(e){const r=N(typeof e=="string"?e:JSON.stringify(e));return r.length>512?g(new Error("Value is too long for start parameter")):f(r)}const Mr=_.throwifyFpFn(Ce);function Cr(e,r){return _.throwifyAnyEither(qe(e,typeof r=="function"?t=>B(()=>r(t),n=>n):r))}function qe(e,r){return m(J(e),Ne(t=>r?typeof r=="function"?r(t):Fr(t):f(t)))}function qr(e){return N(e).length<=512}Object.defineProperty(exports,"createLogger",{enumerable:!0,get:()=>_.createLogger});Object.defineProperty(exports,"deepSnakeToCamelObjKeys",{enumerable:!0,get:()=>_.deepSnakeToCamelObjKeys});Object.defineProperty(exports,"CancelledError",{enumerable:!0,get:()=>A.CancelledError});Object.defineProperty(exports,"TimeoutError",{enumerable:!0,get:()=>A.TimeoutError});exports.InvalidLaunchParamsError=de;exports.InvokeCustomMethodFailedError=we;exports.LaunchParamsRetrieveError=ge;exports.MethodParameterUnsupportedError=he;exports.MethodUnsupportedError=me;exports.UnknownEnvError=V;exports.applyPolyfills=Ar;exports.captureSameReq=Ae;exports.compareVersions=xe;exports.createPostEvent=kr;exports.createStartParam=Mr;exports.createStartParamFp=Ce;exports.debug=D;exports.decodeBase64Url=xr;exports.decodeBase64UrlFp=J;exports.decodeStartParam=Cr;exports.decodeStartParamFp=qe;exports.emitEvent=F;exports.encodeBase64Url=N;exports.getReleaseVersion=j;exports.hasWebviewProxy=U;exports.invokeCustomMethod=Sr;exports.invokeCustomMethodFp=Fe;exports.isIframe=W;exports.isSafeToCreateStartParam=qr;exports.isTMA=Er;exports.isTMAFp=Te;exports.logger=v;exports.mockTelegramEnv=Pr;exports.off=Ee;exports.offAll=Pe;exports.on=q;exports.postEvent=Se;exports.postEventFp=k;exports.postMessage=ke;exports.postMessageImpl=y;exports.request=Tr;exports.request2=yr;exports.request2Fp=O;exports.requestFp=Me;exports.resetGlobals=wr;exports.retrieveLaunchParams=lr;exports.retrieveLaunchParamsFp=be;exports.retrieveRawInitData=_r;exports.retrieveRawInitDataFp=ve;exports.retrieveRawLaunchParams=fr;exports.retrieveRawLaunchParamsFp=x;exports.setDebug=gr;exports.setTargetOrigin=dr;exports.supports=R;exports.targetOrigin=G;
|
|
4
4
|
//# sourceMappingURL=index.cjs.map
|