@tma.js/sdk 1.2.0 → 1.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/mini-app/types.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.iife.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/mini-app/contactParser.ts +1 -1
- package/src/mini-app/types.ts +1 -1
package/dist/index.iife.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var hr=Object.defineProperty;var pr=(a,w,P)=>w in a?hr(a,w,{enumerable:!0,configurable:!0,writable:!0,value:P}):a[w]=P;var o=(a,w,P)=>(pr(a,typeof w!="symbol"?w+"":w,P),P);this.tmajs=this.tmajs||{};this.tmajs.sdk=function(a){"use strict";function w(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function P(){return performance.getEntriesByType("navigation")[0]||null}function se(){const r=P();return r?r.type==="reload":null}function I(){return new TypeError("Value has unexpected type")}class z extends Error{constructor(e,{cause:s,type:n}={}){super(`Unable to parse value${n?` as ${n}`:""}`,{cause:s});o(this,"type");this.value=e,Object.setPrototypeOf(this,z.prototype),this.type=n}}class J{constructor(t,e,s){this.parser=t,this.isOptional=e,this.type=s}parse(t){if(!(this.isOptional&&t===void 0))try{return this.parser(t)}catch(e){throw new z(t,{type:this.type,cause:e})}}optional(){return this.isOptional=!0,this}}function ne(r){if(Array.isArray(r))return r;if(typeof r=="string")try{const t=JSON.parse(r);if(Array.isArray(t))return t}catch{}throw I()}class ie extends J{constructor(e,s,n){super(ne,s,n);o(this,"itemParser");this.itemParser=typeof e=="function"?e:e.parse.bind(e)}parse(e){const s=super.parse(e);return s===void 0?s:s.map(this.itemParser)}of(e){return this.itemParser=typeof e=="function"?e:e.parse.bind(e),this}}function L(r,t){return()=>new J(r,!1,t)}class Q extends Error{constructor(t,{cause:e,type:s}={}){super(`Unable to parse field "${t}"${s?` as ${s}`:""}`,{cause:e}),Object.setPrototypeOf(this,Q.prototype)}}function bt(r,t){const e={};for(const s in r){const n=r[s];if(!n)continue;let i,c;if(typeof n=="function"||"parse"in n)i=s,c=typeof n=="function"?n:n.parse.bind(n);else{const{type:l}=n;i=n.from||s,c=typeof l=="function"?l:l.parse.bind(l)}let u;const p=t(i);try{u=c(p)}catch(l){throw l instanceof z?new Q(i,{type:l.type,cause:l}):new Q(i,{cause:l})}u!==void 0&&(e[s]=u)}return e}function oe(r){return new ie(t=>t,!1,r)}const S=L(r=>{if(typeof r=="boolean")return r;const t=String(r);if(t==="1"||t==="true")return!0;if(t==="0"||t==="false")return!1;throw I()},"boolean"),R=L(r=>{if(typeof r=="number")return r;if(typeof r=="string"){const t=Number(r);if(!Number.isNaN(t))return t}throw I()},"number"),mt=L(r=>r instanceof Date?r:new Date(R().parse(r)*1e3),"Date");function X(r){let t=r;if(typeof t=="string"&&(t=JSON.parse(t)),typeof t!="object"||t===null||Array.isArray(t))throw I();return t}function _(r,t){return new J(e=>{const s=X(e);return bt(r,n=>s[n])},!1,t)}function tt(r){return/^#[\da-f]{6}$/i.test(r)}function yt(r){return/^#[\da-f]{3}$/i.test(r)}function et(r){const t=r.replace(/\s/g,"").toLowerCase();if(tt(t))return t;if(yt(t)){let s="#";for(let n=0;n<3;n+=1)s+=t[1+n].repeat(2);return s}const e=t.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||t.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);if(e===null)throw new Error(`Value "${r}" does not satisfy any of known RGB formats.`);return e.slice(1).reduce((s,n)=>{const i=parseInt(n,10).toString(16);return s+(i.length===1?"0":"")+i},"#")}function rt(r){const t=et(r);return Math.sqrt([.299,.587,.114].reduce((s,n,i)=>{const c=parseInt(t.slice(1+i*2,1+(i+1)*2),16);return s+c*c*n},0))<120}const h=L(r=>{if(typeof r=="string"||typeof r=="number")return r.toString();throw I()},"string"),Et=L(r=>et(h().parse(r)),"rgb");function st(r,t){return new J(e=>{if(typeof e!="string"&&!(e instanceof URLSearchParams))throw I();const s=typeof e=="string"?new URLSearchParams(e):e;return bt(r,n=>{const i=s.get(n);return i===null?void 0:i})},!1,t)}function Ct(){return _({id:R(),type:h(),title:h(),photoUrl:{type:h().optional(),from:"photo_url"},username:h().optional()},"Chat")}class vt{constructor(t){this.initData=t}get authDate(){return this.initData.authDate}get canSendAfter(){return this.initData.canSendAfter}get canSendAfterDate(){const{canSendAfter:t}=this;return t===void 0?void 0:new Date(this.authDate.getTime()+t*1e3)}get chat(){return this.initData.chat}get chatType(){return this.initData.chatType}get chatInstance(){return this.initData.chatInstance}get hash(){return this.initData.hash}get queryId(){return this.initData.queryId}get receiver(){return this.initData.receiver}get startParam(){return this.initData.startParam}get user(){return this.initData.user}}function nt(){return _({addedToAttachmentMenu:{type:S().optional(),from:"added_to_attachment_menu"},allowsWriteToPm:{type:S().optional(),from:"allows_write_to_pm"},firstName:{type:h(),from:"first_name"},id:R(),isBot:{type:S().optional(),from:"is_bot"},isPremium:{type:S().optional(),from:"is_premium"},languageCode:{type:h().optional(),from:"language_code"},lastName:{type:h().optional(),from:"last_name"},photoUrl:{type:h().optional(),from:"photo_url"},username:h().optional()},"User")}function it(){return st({authDate:{type:mt(),from:"auth_date"},canSendAfter:{type:R().optional(),from:"can_send_after"},chat:Ct().optional(),chatInstance:{type:h().optional(),from:"chat_instance"},chatType:{type:h().optional(),from:"chat_type"},hash:h(),queryId:{type:h().optional(),from:"query_id"},receiver:nt().optional(),startParam:{type:h().optional(),from:"start_param"},user:nt().optional()},"InitData")}function ae(r){return it().parse(r)}function ce(r){return r.replace(/(^|_)bg/,(t,e)=>`${e}background`).replace(/_([a-z])/g,(t,e)=>e.toUpperCase())}function ue(r){return r.replace(/[A-Z]/g,t=>`_${t.toLowerCase()}`).replace(/(^|_)background/,(t,e)=>`${e}bg`)}const ot=L(r=>{const t=Et().optional();return Object.entries(X(r)).reduce((e,[s,n])=>(e[ce(s)]=t.parse(n),e),{})},"ThemeParams");function at(r){return ot().parse(r)}function he(r={}){return E("web_app_request_theme","theme_changed",r).then(at)}function Pt(r){return JSON.stringify(Object.entries(r).reduce((t,[e,s])=>(s&&(t[ue(e)]=s),t),{}))}class b{constructor(){o(this,"listeners",new Map);o(this,"subscribeListeners",[])}addListener(t,e,s){let n=this.listeners.get(t);return n||(n=[],this.listeners.set(t,n)),n.push([e,s]),()=>this.off(t,e)}emit(t,...e){this.subscribeListeners.forEach(n=>n(t,...e));const s=this.listeners.get(t);s&&s.forEach(([n,i],c)=>{n(...e),i&&s.splice(c,1)})}on(t,e){return this.addListener(t,e,!1)}once(t,e){return this.addListener(t,e,!0)}off(t,e){const s=this.listeners.get(t);if(s){for(let n=0;n<s.length;n+=1)if(e===s[n][0]){s.splice(n,1);return}}}subscribe(t){return this.subscribeListeners.push(t),()=>this.unsubscribe(t)}unsubscribe(t){for(let e=0;e<this.subscribeListeners.length;e+=1)if(this.subscribeListeners[e]===t){this.subscribeListeners.splice(e,1);return}}}class m{constructor(t,e){this.state=t,this.ee=e}internalSet(t,e){return this.state[t]===e||e===void 0?!1:(this.state[t]=e,this.ee.emit(`change:${t}`,e),!0)}clone(){return{...this.state}}set(t,e){let s=!1;if(typeof t=="string")s=this.internalSet(t,e);else for(const n in t)this.internalSet(n,t[n])&&(s=!0);s&&this.ee.emit("change")}get(t){return this.state[t]}}class St{constructor(t){o(this,"ee",new b);o(this,"state");o(this,"on",this.ee.on.bind(this.ee));o(this,"off",this.ee.off.bind(this.ee));this.state=new m(t,this.ee)}get accentTextColor(){return this.get("accentTextColor")}get backgroundColor(){return this.get("backgroundColor")}get buttonColor(){return this.get("buttonColor")}get buttonTextColor(){return this.get("buttonTextColor")}get destructiveTextColor(){return this.get("destructiveTextColor")}get(t){return this.state.get(t)}getState(){return this.state.clone()}get headerBackgroundColor(){return this.get("headerBackgroundColor")}get hintColor(){return this.get("hintColor")}get isDark(){return!this.backgroundColor||rt(this.backgroundColor)}get linkColor(){return this.get("linkColor")}get secondaryBackgroundColor(){return this.get("secondaryBackgroundColor")}get sectionBackgroundColor(){return this.get("sectionBackgroundColor")}get sectionHeaderTextColor(){return this.get("sectionHeaderTextColor")}listen(){return y("theme_changed",t=>{this.state.set(at(t.theme_params))})}get subtitleTextColor(){return this.get("subtitleTextColor")}get textColor(){return this.get("textColor")}}function ct(){return st({botInline:{type:S().optional(),from:"tgWebAppBotInline"},initData:{type:it().optional(),from:"tgWebAppData"},initDataRaw:{type:h().optional(),from:"tgWebAppData"},platform:{type:h(),from:"tgWebAppPlatform"},showSettings:{type:S().optional(),from:"tgWebAppShowSettings"},themeParams:{type:ot(),from:"tgWebAppThemeParams"},version:{type:h(),from:"tgWebAppVersion"}},"LaunchParams")}function ut(r){return ct().parse(r)}function pe(){return ut(window.location.hash.slice(1))}function le(){const r=P();if(!r)throw new Error("Unable to get first navigation entry.");const t=r.name.match(/#(.*)/);if(!t)throw new Error("First navigation entry does not contain hash part.");return ut(t[1])}function de(){try{return le()}catch{}try{return pe()}catch{}return null}function kt(r){const{initDataRaw:t,themeParams:e,platform:s,version:n,showSettings:i,botInline:c}=r,u=new URLSearchParams;return t&&u.set("tgWebAppData",t),u.set("tgWebAppPlatform",s),u.set("tgWebAppThemeParams",Pt(e)),u.set("tgWebAppVersion",n),typeof i=="boolean"&&u.set("tgWebAppShowSettings",i?"1":"0"),typeof c=="boolean"&&u.set("tgWebAppBotInline",c?"1":"0"),u.toString()}const qt="telegram-mini-apps-launch-params";function fe(){const r=sessionStorage.getItem(qt);return r?ct().parse(r):null}function ge(r){sessionStorage.setItem(qt,kt(r))}function we(){try{return window.self!==window.top}catch{return!0}}function _e(){const r=fe(),t=de(),e=se();if(r){if(t)return{launchParams:t,isPageReload:we()?e||r.initDataRaw===t.initDataRaw:!0};if(e)return{launchParams:r,isPageReload:e};throw new Error("Unable to retrieve current launch parameters, which must exist.")}if(t)return{launchParams:t,isPageReload:!1};throw new Error("Unable to retrieve any launch parameters.")}const At="tmajsLaunchData";function ht(){const r=window[At];if(r)return r;const t=_e();return window[At]=t,ge(t.launchParams),t}function be(){try{return ht(),!0}catch{return!1}}function me(r){return"external"in r&&w(r.external)&&"notify"in r.external&&typeof r.external.notify=="function"}function ye(r){return"TelegramWebviewProxy"in r&&w(r.TelegramWebviewProxy)&&"postEvent"in r.TelegramWebviewProxy&&typeof r.TelegramWebviewProxy.postEvent=="function"}function pt(){try{return window.self!==window.top}catch{return!0}}class Z extends Error{constructor(t,e){super(`Method "${t}" is unsupported in the Mini Apps version ${e}.`),Object.setPrototypeOf(this,Z.prototype)}}class K extends Error{constructor(t,e,s){super(`Parameter "${e}" in method "${t}" is unsupported in the Mini Apps version ${s}.`),Object.setPrototypeOf(this,K.prototype)}}class Rt{constructor(t,e){this.prefix=t,this.enabled=e}print(t,...e){if(!this.enabled)return;const s=new Date,n=Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,timeZone:"UTC"}).format(s);console[t](`[${n}]`,this.prefix,...e)}disable(){this.enabled=!1}error(...t){this.print("error",...t)}enable(){this.enabled=!0}log(...t){this.print("log",...t)}warn(...t){this.print("warn",...t)}}let Vt="https://web.telegram.org";const B=new Rt("[SDK]",!1);function Ee(r){if(r){B.enable();return}B.disable()}function Ce(r){Vt=r}function ve(){return Vt}const Pe=_({eventType:h(),eventData:r=>r});function Se(r,t){window.dispatchEvent(new MessageEvent("message",{data:JSON.stringify({eventType:r,eventData:t})}))}function ke(){const r=window;"TelegramGameProxy_receiveEvent"in r||[["TelegramGameProxy_receiveEvent"],["TelegramGameProxy","receiveEvent"],["Telegram","WebView","receiveEvent"]].forEach(t=>{let e=r;t.forEach((s,n,i)=>{if(n===i.length-1){e[s]=Se;return}s in e||(e[s]={}),e=e[s]})})}function qe(r){ke(),window.addEventListener("message",t=>{try{const{eventType:e,eventData:s}=Pe.parse(t.data);r(e,s)}catch{}})}function Ae(){return _({req_id:h(),data:r=>r===null?r:h().optional().parse(r)})}function Re(){return _({req_id:h(),result:r=>r,error:h().optional()})}function Ve(){return _({slug:h(),status:h()})}function Te(){return _({status:h()})}function Ie(){return _({button_id:r=>r==null?void 0:h().parse(r)})}function Le(){return _({data:h().optional()})}function Be(){return _({theme_params:r=>{const t=Et().optional();return Object.entries(X(r)).reduce((e,[s,n])=>(e[s]=t.parse(n),e),{})}})}function $e(){return _({height:R(),width:r=>r==null?window.innerWidth:R().parse(r),is_state_stable:S(),is_expanded:S()})}function De(){return _({status:h()})}function xe(){const r=new b,t=(e,...s)=>{B.log("Emitting processed event:",e,...s),r.emit(e,...s)};return window.addEventListener("resize",()=>{t("viewport_changed",{width:window.innerWidth,height:window.innerHeight,is_state_stable:!0,is_expanded:!0})}),qe((e,s)=>{B.log("Received raw event:",e,s);try{switch(e){case"viewport_changed":return t(e,$e().parse(s));case"theme_changed":return t(e,Be().parse(s));case"popup_closed":return s==null?t(e,{}):t(e,Ie().parse(s));case"set_custom_style":return t(e,h().parse(s));case"qr_text_received":return t(e,Le().parse(s));case"clipboard_text_received":return t(e,Ae().parse(s));case"invoice_closed":return t(e,Ve().parse(s));case"phone_requested":return t("phone_requested",Te().parse(s));case"custom_method_invoked":return t("custom_method_invoked",Re().parse(s));case"write_access_requested":return t("write_access_requested",De().parse(s));case"main_button_pressed":case"back_button_pressed":case"settings_button_pressed":case"scan_qr_popup_closed":case"reload_iframe":return t(e);default:return t(e,s)}}catch(n){B.error("Error processing event:",n)}}),r}const lt="telegram-mini-apps-cached-emitter";function H(){const r=window;return r[lt]===void 0&&(r[lt]=xe()),r[lt]}function V(r,t){H().off(r,t)}function y(r,t){return H().on(r,t),()=>V(r,t)}function Ne(r,t){return H().once(r,t),()=>V(r,t)}function Tt(r){H().unsubscribe(r)}function He(r){return H().subscribe(r),()=>Tt(r)}function It(r,t){const e=r.split("."),s=t.split("."),n=Math.max(e.length,s.length);for(let i=0;i<n;i+=1){const c=parseInt(e[i]||"0",10),u=parseInt(s[i]||"0",10);if(c!==u)return c>u?1:-1}return 0}function k(r,t){return It(r,t)<=0}function T(r,t,e){if(typeof e=="string"){if(r==="web_app_open_link"&&t==="try_instant_view")return k("6.4",e);if(r==="web_app_set_header_color"&&t==="color")return k("6.9",e)}switch(r){case"web_app_open_tg_link":case"web_app_open_invoice":case"web_app_setup_back_button":case"web_app_set_background_color":case"web_app_set_header_color":case"web_app_trigger_haptic_feedback":return k("6.1",t);case"web_app_open_popup":return k("6.2",t);case"web_app_close_scan_qr_popup":case"web_app_open_scan_qr_popup":case"web_app_read_text_from_clipboard":return k("6.4",t);case"web_app_switch_inline_query":return k("6.7",t);case"web_app_invoke_custom_method":case"web_app_request_write_access":case"web_app_request_phone":return k("6.9",t);case"web_app_setup_settings_button":return k("6.10",t);default:return!0}}function C(r,t){return e=>T(t[e],r)}function Lt(r,t){return e=>{const[s,n]=t[e];return T(s,n,r)}}function g(r,t,e){let s={},n;t===void 0&&e===void 0?s={}:t!==void 0&&e!==void 0?(s=e,n=t):t!==void 0&&("targetOrigin"in t?s=t:n=t);const{targetOrigin:i=ve()}=s;if(B.log(`Calling method "${r}"`,n),pt()){window.parent.postMessage(JSON.stringify({eventType:r,eventData:n}),i);return}if(me(window)){window.external.notify(JSON.stringify({eventType:r,eventData:n}));return}if(ye(window)){window.TelegramWebviewProxy.postEvent(r,JSON.stringify(n));return}throw new Error("Unable to determine current environment and possible way to send event.")}function Bt(r){return(t,e)=>{if(!T(t,r))throw new Z(t,r);if(w(e)){let s;if(t==="web_app_open_link"&&"try_instant_view"in e?s="try_instant_view":t==="web_app_set_header_color"&&"color"in e&&(s="color"),s&&!T(t,s,r))throw new K(t,s,r)}return g(t,e)}}class O extends Error{constructor(t){super(`Async call timeout exceeded. Timeout: ${t}`),Object.setPrototypeOf(this,O.prototype)}}function Oe(r){return r instanceof O}function We(r){return new Promise(t=>{setTimeout(t,r)})}function Me(r){return new Promise((t,e)=>{setTimeout(e,r,new O(r))})}function dt(r,t){return Promise.race([r(),Me(t)])}function E(r,t,e,s){let n,i,c,u;typeof t=="string"||Array.isArray(t)?(c=Array.isArray(t)?t:[t],n=e):(i=t,c=Array.isArray(e)?e:[e],n=s),w(i)&&typeof i.req_id=="string"&&(u=i.req_id);const{postEvent:p=g,timeout:l}=n||{},d=n&&"capture"in n?n.capture:null,v=()=>new Promise((f,A)=>{const N=c.map(F=>y(F,Y=>{u&&(!w(Y)||Y.req_id!==u)||typeof d=="function"&&!d(Y)||(G(),f(Y))})),G=()=>N.forEach(F=>F());try{p(r,i)}catch(F){G(),A(F)}});return typeof l=="number"?dt(v,l):v()}async function $(r,t,e,s={}){const{result:n,error:i}=await E("web_app_invoke_custom_method",{method:r,params:t,req_id:e},"custom_method_invoked",s);if(i)throw new Error(i);return n}class $t{constructor(t,e,s=g){o(this,"ee",new b);o(this,"state");o(this,"on",(t,e)=>t==="click"?y("back_button_pressed",e):this.ee.on(t,e));o(this,"off",(t,e)=>t==="click"?V("back_button_pressed",e):this.ee.off(t,e));o(this,"supports");this.postEvent=s,this.state=new m({isVisible:t},this.ee),this.supports=C(e,{show:"web_app_setup_back_button",hide:"web_app_setup_back_button"})}set isVisible(t){this.state.set("isVisible",t),this.postEvent("web_app_setup_back_button",{is_visible:t})}get isVisible(){return this.state.get("isVisible")}hide(){this.isVisible=!1}show(){this.isVisible=!0}}function Dt(r,t){return r+(r.length>0&&t.length>0?` ${t}`:t)}function xt(...r){return r.reduce((t,e)=>{let s="";return typeof e=="string"?s=e:typeof e=="object"&&e!==null&&(s=Object.entries(e).reduce((n,[i,c])=>c?Dt(n,i):n,"")),Dt(t,s)},"")}function Ue(r){return typeof r=="object"&&r!==null&&!Array.isArray(null)}function je(...r){return r.reduce((t,e)=>(Ue(e)&&Object.entries(e).forEach(([s,n])=>{const i=xt(t[s],n);i.length>0&&(t[s]=i)}),t),{})}class Nt{constructor(t,e=g){o(this,"ee",new b);o(this,"state");o(this,"on",this.ee.on.bind(this.ee));o(this,"off",this.ee.off.bind(this.ee));this.postEvent=e,this.state=new m({isConfirmationNeeded:t},this.ee)}set isConfirmationNeeded(t){this.state.set("isConfirmationNeeded",t),this.postEvent("web_app_setup_closing_behavior",{need_confirmation:t})}get isConfirmationNeeded(){return this.state.get("isConfirmationNeeded")}disableConfirmation(){this.isConfirmationNeeded=!1}enableConfirmation(){this.isConfirmationNeeded=!0}}function Ht(r,t){return r.reduce((e,s)=>(e[s]=t,e),{})}class Ot{constructor(t,e,s=g){o(this,"supports");this.createRequestId=e,this.postEvent=s,this.supports=C(t,{delete:"web_app_invoke_custom_method",get:"web_app_invoke_custom_method",getKeys:"web_app_invoke_custom_method",set:"web_app_invoke_custom_method"})}async delete(t,e={}){const s=Array.isArray(t)?t:[t];s.length!==0&&await $("deleteStorageValues",{keys:s},this.createRequestId(),{...e,postEvent:this.postEvent})}async getKeys(t={}){const e=await $("getStorageKeys",{},this.createRequestId(),{...t,postEvent:this.postEvent});return oe().of(h()).parse(e)}async get(t,e={}){const s=Array.isArray(t)?t:[t];if(s.length===0)return Ht(s,"");const n=_(Ht(s,h())),i=await $("getStorageValues",{keys:s},this.createRequestId(),{...e,postEvent:this.postEvent}).then(c=>n.parse(c));return Array.isArray(t)?i:i[t]}async set(t,e,s={}){await $("saveStorageValue",{key:t,value:e},this.createRequestId(),{...s,postEvent:this.postEvent})}}class Wt{constructor(t,e=g){o(this,"supports");this.postEvent=e,this.supports=C(t,{impactOccurred:"web_app_trigger_haptic_feedback",notificationOccurred:"web_app_trigger_haptic_feedback",selectionChanged:"web_app_trigger_haptic_feedback"})}impactOccurred(t){this.postEvent("web_app_trigger_haptic_feedback",{type:"impact",impact_style:t})}notificationOccurred(t){this.postEvent("web_app_trigger_haptic_feedback",{type:"notification",notification_type:t})}selectionChanged(){this.postEvent("web_app_trigger_haptic_feedback",{type:"selection_change"})}}function Ge(){const r=document.createElement("style");r.id="telegram-custom-styles",document.head.appendChild(r),y("set_custom_style",t=>{r.innerHTML=t})}function Mt(r){return`telegram-mini-apps-${r}`}function D(r,t){sessionStorage.setItem(Mt(r),JSON.stringify(t))}function x(r){const t=sessionStorage.getItem(Mt(r));return t?JSON.parse(t):null}function Fe(r,t,e){const{isVisible:s=!1}=r?x("back-button")||{}:{},n=new $t(s,t,e);return n.on("change",()=>{D("back-button",{isVisible:n.isVisible})}),n}function ze(r,t){const{isConfirmationNeeded:e=!1}=r?x("closing-behavior")||{}:{},s=new Nt(e,t);return s.on("change",()=>D("closing-behavior",{isConfirmationNeeded:s.isConfirmationNeeded})),s}class Ut{constructor(t){o(this,"ee",new b);o(this,"state");o(this,"postEvent");o(this,"on",(t,e)=>t==="click"?y("main_button_pressed",e):this.ee.on(t,e));o(this,"off",(t,e)=>t==="click"?V("main_button_pressed",e):this.ee.off(t,e));const{postEvent:e=g,text:s,textColor:n,backgroundColor:i,isEnabled:c,isVisible:u,isLoaderVisible:p}=t;this.postEvent=e,this.state=new m({backgroundColor:i,isEnabled:c,isVisible:u,isLoaderVisible:p,text:s,textColor:n},this.ee)}commit(){this.text!==""&&this.postEvent("web_app_setup_main_button",{is_visible:this.isVisible,is_active:this.isEnabled,is_progress_visible:this.isLoaderVisible,text:this.text,color:this.backgroundColor,text_color:this.textColor})}set isEnabled(t){this.setParams({isEnabled:t})}get isEnabled(){return this.state.get("isEnabled")}set isLoaderVisible(t){this.setParams({isLoaderVisible:t})}get isLoaderVisible(){return this.state.get("isLoaderVisible")}set isVisible(t){this.setParams({isVisible:t})}get isVisible(){return this.state.get("isVisible")}get backgroundColor(){return this.state.get("backgroundColor")}get text(){return this.state.get("text")}get textColor(){return this.state.get("textColor")}disable(){return this.isEnabled=!1,this}enable(){return this.isEnabled=!0,this}hide(){return this.isVisible=!1,this}hideLoader(){return this.isLoaderVisible=!1,this}show(){return this.isVisible=!0,this}showLoader(){return this.isLoaderVisible=!0,this}setText(t){return this.setParams({text:t})}setTextColor(t){return this.setParams({textColor:t})}setBackgroundColor(t){return this.setParams({backgroundColor:t})}setParams(t){return this.state.set(t),this.commit(),this}}function Je(r,t,e,s){const{backgroundColor:n=t,isEnabled:i=!1,isVisible:c=!1,isLoaderVisible:u=!1,textColor:p=e,text:l=""}=r?x("main-button")||{}:{},d=new Ut({backgroundColor:n,isEnabled:i,isLoaderVisible:u,isVisible:c,postEvent:s,text:l,textColor:p}),v=()=>D("main-button",{backgroundColor:d.backgroundColor,isEnabled:d.isEnabled,isLoaderVisible:d.isLoaderVisible,isVisible:d.isVisible,text:d.text,textColor:d.textColor});return d.on("change",v),d}const Qe=st({contact:_({userId:{type:R(),from:"user_id"},phoneNumber:{type:h(),from:"phone_number"},firstName:{type:h(),from:"first_name"},lastName:{type:h(),from:"last_name"}}),authDate:{type:mt(),from:"auth_date"},hash:h()});class jt{constructor(t){o(this,"ee",new b);o(this,"state");o(this,"botInline");o(this,"postEvent");o(this,"createRequestId");o(this,"requestingPhoneAccess",!1);o(this,"requestingWriteAccess",!1);o(this,"on",this.ee.on.bind(this.ee));o(this,"off",this.ee.off.bind(this.ee));o(this,"supports");o(this,"supportsParam");const{postEvent:e=g,headerColor:s,backgroundColor:n,version:i,botInline:c,createRequestId:u}=t,p=C(i,{requestPhoneAccess:"web_app_request_phone",requestWriteAccess:"web_app_request_write_access",switchInlineQuery:"web_app_switch_inline_query",setHeaderColor:"web_app_set_header_color",setBackgroundColor:"web_app_set_background_color"});this.postEvent=e,this.botInline=c,this.createRequestId=u,this.supports=l=>!(!p(l)||l==="switchInlineQuery"&&!c),this.state=new m({backgroundColor:n,headerColor:s},this.ee),this.supportsParam=Lt(i,{"setHeaderColor.color":["web_app_set_header_color","color"]})}async getRequestedContact(){return $("getRequestedContact",{},this.createRequestId(),{postEvent:this.postEvent,timeout:1e4}).then(t=>Qe.parse(t))}get backgroundColor(){return this.state.get("backgroundColor")}close(){this.postEvent("web_app_close")}get headerColor(){return this.state.get("headerColor")}get isBotInline(){return this.botInline}get isDark(){return rt(this.backgroundColor)}get isRequestingPhoneAccess(){return this.requestingPhoneAccess}get isRequestingWriteAccess(){return this.requestingWriteAccess}ready(){this.postEvent("web_app_ready")}async requestContact({timeout:t=5e3}={}){try{return await this.getRequestedContact()}catch{}if(await this.requestPhoneAccess()!=="sent")throw new Error("Access denied.");const s=Date.now()+t;let n=50;return dt(async()=>{for(;Date.now()<s;){try{return await this.getRequestedContact()}catch{}await We(n),n+=50}throw new Error("Unable to retrieve requested contact.")},t)}requestPhoneAccess(t={}){if(this.requestingPhoneAccess)throw new Error("Phone access is already being requested.");return this.requestingPhoneAccess=!0,E("web_app_request_phone","phone_requested",{...t,postEvent:this.postEvent}).then(e=>e.status).finally(()=>{this.requestingPhoneAccess=!1})}requestWriteAccess(t={}){if(this.requestingWriteAccess)throw new Error("Write access is already being requested.");return this.requestingWriteAccess=!0,E("web_app_request_write_access","write_access_requested",{...t,postEvent:this.postEvent}).then(e=>e.status).finally(()=>{this.requestingWriteAccess=!1})}sendData(t){const{size:e}=new Blob([t]);if(e===0||e>4096)throw new Error(`Passed data has incorrect size: ${e}`);this.postEvent("web_app_data_send",{data:t})}setHeaderColor(t){this.postEvent("web_app_set_header_color",tt(t)?{color:t}:{color_key:t}),this.state.set("headerColor",t)}setBackgroundColor(t){this.postEvent("web_app_set_background_color",{color:t}),this.state.set("backgroundColor",t)}switchInlineQuery(t,e=[]){if(!this.supports("switchInlineQuery")&&!this.isBotInline)throw new Error("Method is unsupported because Mini App should be launched in inline mode.");this.postEvent("web_app_switch_inline_query",{query:t,chat_types:e})}}function Ze(r,t,e,s,n,i){const{backgroundColor:c=t,headerColor:u="bg_color"}=r?x("mini-app")||{}:{},p=new jt({headerColor:u,backgroundColor:c,version:e,botInline:s,createRequestId:n,postEvent:i}),l=()=>D("mini-app",{backgroundColor:p.backgroundColor,headerColor:p.headerColor});return p.on("change",l),p}function Ke(){let r=0;return()=>(r+=1,r.toString())}class Gt{constructor(t,e,s=g){o(this,"ee",new b);o(this,"state");o(this,"on",(t,e)=>t==="click"?y("settings_button_pressed",e):this.ee.on(t,e));o(this,"off",(t,e)=>t==="click"?V("settings_button_pressed",e):this.ee.off(t,e));o(this,"supports");this.postEvent=s,this.state=new m({isVisible:t},this.ee),this.supports=C(e,{show:"web_app_setup_settings_button",hide:"web_app_setup_settings_button"})}set isVisible(t){this.state.set("isVisible",t),this.postEvent("web_app_setup_settings_button",{is_visible:t})}get isVisible(){return this.state.get("isVisible")}hide(){this.isVisible=!1}show(){this.isVisible=!0}}function Ye(r,t,e){const{isVisible:s=!1}=r?x("settings-button")||{}:{},n=new Gt(s,t,e);return n.on("change",()=>{D("settings-button",{isVisible:n.isVisible})}),n}function Xe(r){const t=new St(r);return t.listen(),t}async function ft(r){const t=await E("web_app_request_viewport","viewport_changed",r);return{height:t.height,width:t.width,isExpanded:t.is_expanded,isStateStable:t.is_state_stable}}function W(r){return r<0?0:r}class M{constructor(t){o(this,"ee",new b);o(this,"state");o(this,"postEvent");o(this,"on",this.ee.on.bind(this.ee));o(this,"off",this.ee.off.bind(this.ee));const{height:e,isExpanded:s,width:n,stableHeight:i,postEvent:c=g}=t;this.postEvent=c,this.state=new m({height:W(e),isExpanded:s,stableHeight:W(i),width:W(n)},this.ee)}sync(t){return ft(t).then(({height:e,isExpanded:s,width:n,isStateStable:i})=>{this.state.set({height:e,width:n,isExpanded:s,stableHeight:i?e:this.state.get("stableHeight")})})}get height(){return this.state.get("height")}get stableHeight(){return this.state.get("stableHeight")}listen(){return y("viewport_changed",t=>{const{height:e,width:s,is_expanded:n,is_state_stable:i}=t,c={height:W(e),isExpanded:n,width:W(s)};i&&(c.stableHeight=c.height),this.state.set(c)})}get isExpanded(){return this.state.get("isExpanded")}get width(){return this.state.get("width")}expand(){this.postEvent("web_app_expand"),this.state.set("isExpanded",!0)}get isStable(){return this.stableHeight===this.height}}function Ft(r){return!["macos","web","weba"].includes(r)}function zt(r,t,e){if(r||!Ft(t))return new M({height:window.innerHeight,isExpanded:!0,postEvent:e,stableHeight:window.innerHeight,width:window.innerWidth});const s=x("viewport");return s?new M({...s,postEvent:e}):null}function Jt(r){return r.listen(),r.on("change",()=>D("viewport",{height:r.height,isExpanded:r.isExpanded,stableHeight:r.stableHeight,width:r.width})),r}function tr(r,t,e){const s=Jt(zt(r,t,e)||new M({width:0,height:0,isExpanded:!1,postEvent:e,stableHeight:0}));return Ft(t)&&s.sync({postEvent:e,timeout:100}).catch(n=>{console.error("Unable to actualize viewport state",n)}),s}async function er(r,t,e){return Jt(zt(r,t,e)||await ft({postEvent:e,timeout:100}).then(({height:s,isStateStable:n,...i})=>new M({...i,height:s,stableHeight:n?s:0})))}function q(r,t){document.documentElement.style.setProperty(r,t)}function rr(r,t){const e=()=>{q("--tg-background-color",r.backgroundColor)},s=()=>{const{backgroundColor:n,secondaryBackgroundColor:i}=t;r.headerColor==="bg_color"?n&&q("--tg-header-color",n):r.headerColor==="secondary_bg_color"?i&&q("--tg-header-color",i):q("--tg-header-color",r.headerColor)};t.on("change",s),r.on("change:backgroundColor",e),r.on("change:headerColor",s),e(),s()}function sr(r){const t=()=>{const e=r.getState();Object.entries(e).forEach(([s,n])=>{if(n){const i=s.replace(/[A-Z]/g,c=>`-${c.toLowerCase()}`);q(`--tg-theme-${i}`,n)}})};r.on("change",t),t()}function Qt(r){const t=()=>q("--tg-viewport-height",`${r.height}px`),e=()=>q("--tg-viewport-width",`${r.width}px`),s=()=>q("--tg-viewport-height",`${r.stableHeight}px`);r.on("change:height",t),r.on("change:width",e),r.on("change:stableHeight",s),t(),e(),s()}function nr(r){return typeof r=="object"?r:r?{themeParams:!0,viewport:!0,miniApp:!0}:{}}function Zt(r,t,e,s){const n=nr(r);n.miniApp&&rr(t,e),n.themeParams&&sr(e),n.viewport&&(s instanceof Promise?s.then(Qt):Qt(s))}function ir(r){const{hostname:t,pathname:e}=new URL(r,window.location.href);if(t!=="t.me")throw new Error(`Incorrect hostname: ${t}`);const s=e.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);if(s===null)throw new Error('Link pathname has incorrect format. Expected to receive "/invoice/{slug}" or "/${slug}"');return s[2]}class Kt{constructor(t,e=g){o(this,"ee",new b);o(this,"state");o(this,"on",this.ee.on.bind(this.ee));o(this,"off",this.ee.off.bind(this.ee));o(this,"supports");this.postEvent=e,this.state=new m({isOpened:!1},this.ee),this.supports=C(t,{open:"web_app_open_invoice"})}set isOpened(t){this.state.set("isOpened",t)}get isOpened(){return this.state.get("isOpened")}async open(t,e){if(this.isOpened)throw new Error("Invoice is already opened");const s=e?ir(t):t;this.isOpened=!0;try{return(await E("web_app_open_invoice",{slug:s},"invoice_closed",{postEvent:this.postEvent,capture(i){return s===i.slug}})).status}finally{this.isOpened=!1}}}function or(r){const t=r.message.trim(),e=(r.title||"").trim(),s=r.buttons||[];let n;if(e.length>64)throw new Error(`Title has incorrect size: ${e.length}`);if(t.length===0||t.length>256)throw new Error(`Message has incorrect size: ${t.length}`);if(s.length>3)throw new Error(`Buttons have incorrect size: ${s.length}`);return s.length===0?n=[{type:"close",id:""}]:n=s.map(i=>{const{id:c=""}=i;if(c.length>64)throw new Error(`Button ID has incorrect size: ${c}`);if(i.type===void 0||i.type==="default"||i.type==="destructive"){const u=i.text.trim();if(u.length===0||u.length>64){const p=i.type||"default";throw new Error(`Button text with type "${p}" has incorrect size: ${i.text.length}`)}return{...i,text:u,id:c}}return{...i,id:c}}),{title:e,message:t,buttons:n}}class Yt{constructor(t,e=g){o(this,"ee",new b);o(this,"state");o(this,"on",this.ee.on.bind(this.ee));o(this,"off",this.ee.off.bind(this.ee));o(this,"supports");this.postEvent=e,this.state=new m({isOpened:!1},this.ee),this.supports=C(t,{open:"web_app_open_popup"})}set isOpened(t){this.state.set("isOpened",t)}get isOpened(){return this.state.get("isOpened")}open(t){if(this.isOpened)throw new Error("Popup is already opened.");return this.isOpened=!0,E("web_app_open_popup",or(t),"popup_closed",{postEvent:this.postEvent}).then(({button_id:e=null})=>e).finally(()=>{this.isOpened=!1})}}class Xt{constructor(t,e=g){o(this,"ee",new b);o(this,"state");o(this,"on",this.ee.on.bind(this.ee));o(this,"off",this.ee.off.bind(this.ee));o(this,"supports");this.postEvent=e,this.state=new m({isOpened:!1},this.ee),this.supports=C(t,{close:"web_app_close_scan_qr_popup",open:"web_app_open_scan_qr_popup"})}close(){this.postEvent("web_app_close_scan_qr_popup"),this.isOpened=!1}set isOpened(t){this.state.set("isOpened",t)}get isOpened(){return this.state.get("isOpened")}async open(t){if(this.isOpened)throw new Error("QR scanner is already opened.");this.isOpened=!0;try{const e=await E("web_app_open_scan_qr_popup",{text:t},["qr_text_received","scan_qr_popup_closed"],{postEvent:this.postEvent});return typeof e=="object"&&typeof e.data=="string"?e.data:null}finally{this.isOpened=!1}}}class te{constructor(t,e,s=g){o(this,"supports");o(this,"supportsParam");this.version=t,this.createRequestId=e,this.postEvent=s,this.supports=C(t,{readTextFromClipboard:"web_app_read_text_from_clipboard"}),this.supportsParam=Lt(t,{"openLink.tryInstantView":["web_app_open_link","try_instant_view"]})}openLink(t,e){const s=new URL(t,window.location.href).toString();if(!T("web_app_open_link",this.version)){window.open(s,"_blank");return}this.postEvent("web_app_open_link",{url:s,...typeof e=="boolean"?{try_instant_view:e}:{}})}openTelegramLink(t){const{hostname:e,pathname:s,search:n}=new URL(t,window.location.href);if(e!=="t.me")throw new Error(`URL has not allowed hostname: ${e}. Only "t.me" is allowed`);if(!T("web_app_open_tg_link",this.version)){window.location.href=t;return}this.postEvent("web_app_open_tg_link",{path_full:s+n})}readTextFromClipboard(){return E("web_app_read_text_from_clipboard",{req_id:this.createRequestId()},"clipboard_text_received",{postEvent:this.postEvent}).then(({data:t=null})=>t)}}function ar(r={}){const{async:t=!1,cssVars:e=!1,acceptCustomStyles:s=!1}=r;try{const{launchParams:{initData:n,initDataRaw:i,version:c,platform:u,themeParams:p,botInline:l=!1},isPageReload:d}=ht(),v=Ke(),f=Bt(c);pt()&&(s&&Ge(),f("iframe_ready",{reload_supported:!0}),y("reload_iframe",()=>window.location.reload()));const A={backButton:Fe(d,c,f),closingBehavior:ze(d,f),cloudStorage:new Ot(c,v,f),createRequestId:v,hapticFeedback:new Wt(c,f),invoice:new Kt(c,f),mainButton:Je(d,p.buttonColor||"#000000",p.buttonTextColor||"#ffffff",f),miniApp:Ze(d,p.backgroundColor||"#ffffff",c,l,v,f),popup:new Yt(c,f),postEvent:f,qrScanner:new Xt(c,f),settingsButton:Ye(d,c,f),themeParams:Xe(p),utils:new te(c,v,f),...n?{initData:new vt(n),initDataRaw:i}:{}},N=t?er(d,u,f):tr(d,u,f);return N instanceof Promise?N.then(G=>(Zt(e,A.miniApp,A.themeParams,G),{...A,viewport:G})):(Zt(e,A.miniApp,A.themeParams,N),{...A,viewport:N})}catch(n){if(t)return Promise.reject(n);throw n}}function U(r,t){return r.startsWith(t)?r:`${t}${r}`}function cr(r){const t=r.match(/#(.+)/);return t?t[1]:null}async function j(r){return r===0?!0:Promise.race([new Promise(t=>{window.addEventListener("popstate",function e(){window.removeEventListener("popstate",e),t(!0)}),window.history.go(r)}),new Promise(t=>{setTimeout(t,50,!1)})])}async function ur(){if(window.history.length<=1||(window.history.pushState(null,""),await j(1-window.history.length)))return;let t=await j(-1);for(;t;)t=await j(-1)}class ee{constructor(t,e,{debug:s=!1,loggerPrefix:n="Navigator"}){o(this,"logger");o(this,"entries");if(this.entriesCursor=e,t.length===0)throw new Error("Entries list should not be empty.");if(e>=t.length)throw new Error("Cursor should be less than entries count.");this.entries=t.map(({pathname:i="",search:c,hash:u})=>{if(!i.startsWith("/")&&i.length>0)throw new Error('Pathname should start with "/"');return{pathname:U(i,"/"),search:c?U(c,"?"):"",hash:u?U(u,"#"):""}}),this.logger=new Rt(`[${n}]`,s)}formatEntry(t){let e;if(typeof t=="string")e=t;else{const{pathname:c="",search:u,hash:p}=t;e=c+(u?U(u,"?"):"")+(p?U(p,"#"):"")}const{pathname:s,search:n,hash:i}=new URL(e,`https://localhost${this.path}`);return{pathname:s,search:n,hash:i}}get entry(){return this.entries[this.entriesCursor]}back(){return this.go(-1)}get cursor(){return this.entriesCursor}get canGoBack(){return this.entriesCursor>0}get canGoForward(){return this.entriesCursor!==this.entries.length-1}forward(){return this.go(1)}go(t){this.logger.log(`called go(${t})`);const e=Math.min(this.entries.length-1,Math.max(this.entriesCursor+t,0));if(this.entriesCursor===e)return this.performGo({updated:!1,delta:t});const s=this.entry;this.entriesCursor=e;const n=this.entry;return this.logger.log("State changed",{before:s,after:n}),this.performGo({updated:!0,delta:t,before:s,after:n})}getEntries(){return this.entries.map(t=>({...t}))}get hash(){return this.entry.hash}push(t){this.entriesCursor!==this.entries.length-1&&this.entries.splice(this.entriesCursor+1);const e=this.formatEntry(t),s=this.entry;this.entriesCursor+=1,this.entries[this.entriesCursor]=e;const n=this.entry;return this.logger.log("State changed",{before:s,after:n}),this.performPush({before:s,after:n})}get path(){return`${this.pathname}${this.search}${this.hash}`}get pathname(){return this.entry.pathname}replace(t){const e=this.formatEntry(t);if(this.search===e.search&&this.pathname===e.pathname&&this.hash===e.hash)return this.performReplace({updated:!1,entry:e});const s=this.entry;this.entries[this.entriesCursor]=e;const n=this.entry;return this.logger.log("State changed",{before:s,after:n}),this.performReplace({updated:!0,before:s,after:n})}get search(){return this.entry.search}}const re=0,gt=1,wt=2;class _t extends ee{constructor(e,s,n={}){super(e,s,{...n,loggerPrefix:"HashNavigator"});o(this,"ee",new b);o(this,"attached",!1);o(this,"onPopState",async({state:e})=>{if(this.logger.log('"popstate" event received. State:',e),e===null)return this.push(window.location.hash.slice(1));if(e===re){this.logger.log("Void reached. Moving history forward"),window.history.forward();return}if(e===gt)return this.back();if(e===wt)return this.forward()});o(this,"back",()=>super.back());o(this,"on",this.ee.on.bind(this.ee));o(this,"off",this.ee.off.bind(this.ee))}static fromLocation(e){const{search:s,pathname:n,hash:i}=new URL(window.location.hash.slice(1),window.location.href);return new _t([{search:s,pathname:n,hash:i}],0,e)}async performGo(e){e.updated&&(this.attached&&await this.syncHistory(),this.emitChanged(e.before,e.after))}async performPush({before:e,after:s}){this.attached&&await this.syncHistory(),this.emitChanged(e,s)}async performReplace(e){e.updated&&(this.attached&&window.history.replaceState(null,"",`#${this.path}`),this.emitChanged(e.before,e.after))}async syncHistory(){window.removeEventListener("popstate",this.onPopState);const e=`#${this.path}`;await ur(),g("web_app_setup_back_button",{is_visible:this.canGoBack}),this.canGoBack&&this.canGoForward?(this.logger.log("Setting up history: [<-, *, ->]"),window.history.replaceState(gt,""),window.history.pushState(null,"",e),window.history.pushState(wt,""),await j(-1)):this.canGoBack?(this.logger.log("Setting up history: [<-, *]"),window.history.replaceState(gt,""),window.history.pushState(null,"",e)):this.canGoForward?(this.logger.log("Setting up history: [*, ->]"),window.history.replaceState(null,e),window.history.pushState(wt,""),await j(-1)):(this.logger.log("Setting up history: [~, *]"),window.history.replaceState(re,""),window.history.pushState(null,"",e)),window.addEventListener("popstate",this.onPopState)}emitChanged(e,s){this.ee.emit("change",{navigator:this,from:e,to:s})}async attach(){if(!this.attached)return this.logger.log("Attaching",this),this.attached=!0,y("back_button_pressed",this.back),this.syncHistory()}detach(){this.attached&&(this.logger.log("Detaching",this),this.attached=!1,window.removeEventListener("popstate",this.onPopState),V("back_button_pressed",this.back))}}return a.BackButton=$t,a.ClosingBehavior=Nt,a.CloudStorage=Ot,a.HapticFeedback=Wt,a.HashNavigator=_t,a.InitData=vt,a.Invoice=Kt,a.MainButton=Ut,a.MethodUnsupportedError=Z,a.MiniApp=jt,a.Navigator=ee,a.ParameterUnsupportedError=K,a.Popup=Yt,a.QRScanner=Xt,a.SettingsButton=Gt,a.ThemeParams=St,a.TimeoutError=O,a.Utils=te,a.Viewport=M,a.chatParser=Ct,a.classNames=xt,a.compareVersions=It,a.createPostEvent=Bt,a.getHash=cr,a.init=ar,a.initDataParser=it,a.invokeCustomMethod=$,a.isColorDark=rt,a.isIframe=pt,a.isRGB=tt,a.isRGBShort=yt,a.isRecord=w,a.isTMA=be,a.isTimeoutError=Oe,a.launchParamsParser=ct,a.mergeClassNames=je,a.off=V,a.on=y,a.once=Ne,a.parseInitData=ae,a.parseLaunchParams=ut,a.parseThemeParams=at,a.postEvent=g,a.request=E,a.requestThemeParams=he,a.requestViewport=ft,a.retrieveLaunchData=ht,a.serializeLaunchParams=kt,a.serializeThemeParams=Pt,a.setDebug=Ee,a.setTargetOrigin=Ce,a.subscribe=He,a.supports=T,a.themeParamsParser=ot,a.toRGB=et,a.unsubscribe=Tt,a.userParser=nt,a.withTimeout=dt,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),a}({});
|
|
1
|
+
var hr=Object.defineProperty;var pr=(a,w,P)=>w in a?hr(a,w,{enumerable:!0,configurable:!0,writable:!0,value:P}):a[w]=P;var o=(a,w,P)=>(pr(a,typeof w!="symbol"?w+"":w,P),P);this.tmajs=this.tmajs||{};this.tmajs.sdk=function(a){"use strict";function w(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function P(){return performance.getEntriesByType("navigation")[0]||null}function se(){const r=P();return r?r.type==="reload":null}function I(){return new TypeError("Value has unexpected type")}class z extends Error{constructor(e,{cause:s,type:n}={}){super(`Unable to parse value${n?` as ${n}`:""}`,{cause:s});o(this,"type");this.value=e,Object.setPrototypeOf(this,z.prototype),this.type=n}}class J{constructor(t,e,s){this.parser=t,this.isOptional=e,this.type=s}parse(t){if(!(this.isOptional&&t===void 0))try{return this.parser(t)}catch(e){throw new z(t,{type:this.type,cause:e})}}optional(){return this.isOptional=!0,this}}function ne(r){if(Array.isArray(r))return r;if(typeof r=="string")try{const t=JSON.parse(r);if(Array.isArray(t))return t}catch{}throw I()}class ie extends J{constructor(e,s,n){super(ne,s,n);o(this,"itemParser");this.itemParser=typeof e=="function"?e:e.parse.bind(e)}parse(e){const s=super.parse(e);return s===void 0?s:s.map(this.itemParser)}of(e){return this.itemParser=typeof e=="function"?e:e.parse.bind(e),this}}function L(r,t){return()=>new J(r,!1,t)}class Q extends Error{constructor(t,{cause:e,type:s}={}){super(`Unable to parse field "${t}"${s?` as ${s}`:""}`,{cause:e}),Object.setPrototypeOf(this,Q.prototype)}}function bt(r,t){const e={};for(const s in r){const n=r[s];if(!n)continue;let i,c;if(typeof n=="function"||"parse"in n)i=s,c=typeof n=="function"?n:n.parse.bind(n);else{const{type:l}=n;i=n.from||s,c=typeof l=="function"?l:l.parse.bind(l)}let u;const p=t(i);try{u=c(p)}catch(l){throw l instanceof z?new Q(i,{type:l.type,cause:l}):new Q(i,{cause:l})}u!==void 0&&(e[s]=u)}return e}function oe(r){return new ie(t=>t,!1,r)}const S=L(r=>{if(typeof r=="boolean")return r;const t=String(r);if(t==="1"||t==="true")return!0;if(t==="0"||t==="false")return!1;throw I()},"boolean"),R=L(r=>{if(typeof r=="number")return r;if(typeof r=="string"){const t=Number(r);if(!Number.isNaN(t))return t}throw I()},"number"),mt=L(r=>r instanceof Date?r:new Date(R().parse(r)*1e3),"Date");function X(r){let t=r;if(typeof t=="string"&&(t=JSON.parse(t)),typeof t!="object"||t===null||Array.isArray(t))throw I();return t}function _(r,t){return new J(e=>{const s=X(e);return bt(r,n=>s[n])},!1,t)}function tt(r){return/^#[\da-f]{6}$/i.test(r)}function yt(r){return/^#[\da-f]{3}$/i.test(r)}function et(r){const t=r.replace(/\s/g,"").toLowerCase();if(tt(t))return t;if(yt(t)){let s="#";for(let n=0;n<3;n+=1)s+=t[1+n].repeat(2);return s}const e=t.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||t.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);if(e===null)throw new Error(`Value "${r}" does not satisfy any of known RGB formats.`);return e.slice(1).reduce((s,n)=>{const i=parseInt(n,10).toString(16);return s+(i.length===1?"0":"")+i},"#")}function rt(r){const t=et(r);return Math.sqrt([.299,.587,.114].reduce((s,n,i)=>{const c=parseInt(t.slice(1+i*2,1+(i+1)*2),16);return s+c*c*n},0))<120}const h=L(r=>{if(typeof r=="string"||typeof r=="number")return r.toString();throw I()},"string"),Et=L(r=>et(h().parse(r)),"rgb");function st(r,t){return new J(e=>{if(typeof e!="string"&&!(e instanceof URLSearchParams))throw I();const s=typeof e=="string"?new URLSearchParams(e):e;return bt(r,n=>{const i=s.get(n);return i===null?void 0:i})},!1,t)}function Ct(){return _({id:R(),type:h(),title:h(),photoUrl:{type:h().optional(),from:"photo_url"},username:h().optional()},"Chat")}class vt{constructor(t){this.initData=t}get authDate(){return this.initData.authDate}get canSendAfter(){return this.initData.canSendAfter}get canSendAfterDate(){const{canSendAfter:t}=this;return t===void 0?void 0:new Date(this.authDate.getTime()+t*1e3)}get chat(){return this.initData.chat}get chatType(){return this.initData.chatType}get chatInstance(){return this.initData.chatInstance}get hash(){return this.initData.hash}get queryId(){return this.initData.queryId}get receiver(){return this.initData.receiver}get startParam(){return this.initData.startParam}get user(){return this.initData.user}}function nt(){return _({addedToAttachmentMenu:{type:S().optional(),from:"added_to_attachment_menu"},allowsWriteToPm:{type:S().optional(),from:"allows_write_to_pm"},firstName:{type:h(),from:"first_name"},id:R(),isBot:{type:S().optional(),from:"is_bot"},isPremium:{type:S().optional(),from:"is_premium"},languageCode:{type:h().optional(),from:"language_code"},lastName:{type:h().optional(),from:"last_name"},photoUrl:{type:h().optional(),from:"photo_url"},username:h().optional()},"User")}function it(){return st({authDate:{type:mt(),from:"auth_date"},canSendAfter:{type:R().optional(),from:"can_send_after"},chat:Ct().optional(),chatInstance:{type:h().optional(),from:"chat_instance"},chatType:{type:h().optional(),from:"chat_type"},hash:h(),queryId:{type:h().optional(),from:"query_id"},receiver:nt().optional(),startParam:{type:h().optional(),from:"start_param"},user:nt().optional()},"InitData")}function ae(r){return it().parse(r)}function ce(r){return r.replace(/(^|_)bg/,(t,e)=>`${e}background`).replace(/_([a-z])/g,(t,e)=>e.toUpperCase())}function ue(r){return r.replace(/[A-Z]/g,t=>`_${t.toLowerCase()}`).replace(/(^|_)background/,(t,e)=>`${e}bg`)}const ot=L(r=>{const t=Et().optional();return Object.entries(X(r)).reduce((e,[s,n])=>(e[ce(s)]=t.parse(n),e),{})},"ThemeParams");function at(r){return ot().parse(r)}function he(r={}){return E("web_app_request_theme","theme_changed",r).then(at)}function Pt(r){return JSON.stringify(Object.entries(r).reduce((t,[e,s])=>(s&&(t[ue(e)]=s),t),{}))}class b{constructor(){o(this,"listeners",new Map);o(this,"subscribeListeners",[])}addListener(t,e,s){let n=this.listeners.get(t);return n||(n=[],this.listeners.set(t,n)),n.push([e,s]),()=>this.off(t,e)}emit(t,...e){this.subscribeListeners.forEach(n=>n(t,...e));const s=this.listeners.get(t);s&&s.forEach(([n,i],c)=>{n(...e),i&&s.splice(c,1)})}on(t,e){return this.addListener(t,e,!1)}once(t,e){return this.addListener(t,e,!0)}off(t,e){const s=this.listeners.get(t);if(s){for(let n=0;n<s.length;n+=1)if(e===s[n][0]){s.splice(n,1);return}}}subscribe(t){return this.subscribeListeners.push(t),()=>this.unsubscribe(t)}unsubscribe(t){for(let e=0;e<this.subscribeListeners.length;e+=1)if(this.subscribeListeners[e]===t){this.subscribeListeners.splice(e,1);return}}}class m{constructor(t,e){this.state=t,this.ee=e}internalSet(t,e){return this.state[t]===e||e===void 0?!1:(this.state[t]=e,this.ee.emit(`change:${t}`,e),!0)}clone(){return{...this.state}}set(t,e){let s=!1;if(typeof t=="string")s=this.internalSet(t,e);else for(const n in t)this.internalSet(n,t[n])&&(s=!0);s&&this.ee.emit("change")}get(t){return this.state[t]}}class St{constructor(t){o(this,"ee",new b);o(this,"state");o(this,"on",this.ee.on.bind(this.ee));o(this,"off",this.ee.off.bind(this.ee));this.state=new m(t,this.ee)}get accentTextColor(){return this.get("accentTextColor")}get backgroundColor(){return this.get("backgroundColor")}get buttonColor(){return this.get("buttonColor")}get buttonTextColor(){return this.get("buttonTextColor")}get destructiveTextColor(){return this.get("destructiveTextColor")}get(t){return this.state.get(t)}getState(){return this.state.clone()}get headerBackgroundColor(){return this.get("headerBackgroundColor")}get hintColor(){return this.get("hintColor")}get isDark(){return!this.backgroundColor||rt(this.backgroundColor)}get linkColor(){return this.get("linkColor")}get secondaryBackgroundColor(){return this.get("secondaryBackgroundColor")}get sectionBackgroundColor(){return this.get("sectionBackgroundColor")}get sectionHeaderTextColor(){return this.get("sectionHeaderTextColor")}listen(){return y("theme_changed",t=>{this.state.set(at(t.theme_params))})}get subtitleTextColor(){return this.get("subtitleTextColor")}get textColor(){return this.get("textColor")}}function ct(){return st({botInline:{type:S().optional(),from:"tgWebAppBotInline"},initData:{type:it().optional(),from:"tgWebAppData"},initDataRaw:{type:h().optional(),from:"tgWebAppData"},platform:{type:h(),from:"tgWebAppPlatform"},showSettings:{type:S().optional(),from:"tgWebAppShowSettings"},themeParams:{type:ot(),from:"tgWebAppThemeParams"},version:{type:h(),from:"tgWebAppVersion"}},"LaunchParams")}function ut(r){return ct().parse(r)}function pe(){return ut(window.location.hash.slice(1))}function le(){const r=P();if(!r)throw new Error("Unable to get first navigation entry.");const t=r.name.match(/#(.*)/);if(!t)throw new Error("First navigation entry does not contain hash part.");return ut(t[1])}function de(){try{return le()}catch{}try{return pe()}catch{}return null}function kt(r){const{initDataRaw:t,themeParams:e,platform:s,version:n,showSettings:i,botInline:c}=r,u=new URLSearchParams;return t&&u.set("tgWebAppData",t),u.set("tgWebAppPlatform",s),u.set("tgWebAppThemeParams",Pt(e)),u.set("tgWebAppVersion",n),typeof i=="boolean"&&u.set("tgWebAppShowSettings",i?"1":"0"),typeof c=="boolean"&&u.set("tgWebAppBotInline",c?"1":"0"),u.toString()}const qt="telegram-mini-apps-launch-params";function fe(){const r=sessionStorage.getItem(qt);return r?ct().parse(r):null}function ge(r){sessionStorage.setItem(qt,kt(r))}function we(){try{return window.self!==window.top}catch{return!0}}function _e(){const r=fe(),t=de(),e=se();if(r){if(t)return{launchParams:t,isPageReload:we()?e||r.initDataRaw===t.initDataRaw:!0};if(e)return{launchParams:r,isPageReload:e};throw new Error("Unable to retrieve current launch parameters, which must exist.")}if(t)return{launchParams:t,isPageReload:!1};throw new Error("Unable to retrieve any launch parameters.")}const At="tmajsLaunchData";function ht(){const r=window[At];if(r)return r;const t=_e();return window[At]=t,ge(t.launchParams),t}function be(){try{return ht(),!0}catch{return!1}}function me(r){return"external"in r&&w(r.external)&&"notify"in r.external&&typeof r.external.notify=="function"}function ye(r){return"TelegramWebviewProxy"in r&&w(r.TelegramWebviewProxy)&&"postEvent"in r.TelegramWebviewProxy&&typeof r.TelegramWebviewProxy.postEvent=="function"}function pt(){try{return window.self!==window.top}catch{return!0}}class Z extends Error{constructor(t,e){super(`Method "${t}" is unsupported in the Mini Apps version ${e}.`),Object.setPrototypeOf(this,Z.prototype)}}class K extends Error{constructor(t,e,s){super(`Parameter "${e}" in method "${t}" is unsupported in the Mini Apps version ${s}.`),Object.setPrototypeOf(this,K.prototype)}}class Rt{constructor(t,e){this.prefix=t,this.enabled=e}print(t,...e){if(!this.enabled)return;const s=new Date,n=Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,timeZone:"UTC"}).format(s);console[t](`[${n}]`,this.prefix,...e)}disable(){this.enabled=!1}error(...t){this.print("error",...t)}enable(){this.enabled=!0}log(...t){this.print("log",...t)}warn(...t){this.print("warn",...t)}}let Vt="https://web.telegram.org";const B=new Rt("[SDK]",!1);function Ee(r){if(r){B.enable();return}B.disable()}function Ce(r){Vt=r}function ve(){return Vt}const Pe=_({eventType:h(),eventData:r=>r});function Se(r,t){window.dispatchEvent(new MessageEvent("message",{data:JSON.stringify({eventType:r,eventData:t})}))}function ke(){const r=window;"TelegramGameProxy_receiveEvent"in r||[["TelegramGameProxy_receiveEvent"],["TelegramGameProxy","receiveEvent"],["Telegram","WebView","receiveEvent"]].forEach(t=>{let e=r;t.forEach((s,n,i)=>{if(n===i.length-1){e[s]=Se;return}s in e||(e[s]={}),e=e[s]})})}function qe(r){ke(),window.addEventListener("message",t=>{try{const{eventType:e,eventData:s}=Pe.parse(t.data);r(e,s)}catch{}})}function Ae(){return _({req_id:h(),data:r=>r===null?r:h().optional().parse(r)})}function Re(){return _({req_id:h(),result:r=>r,error:h().optional()})}function Ve(){return _({slug:h(),status:h()})}function Te(){return _({status:h()})}function Ie(){return _({button_id:r=>r==null?void 0:h().parse(r)})}function Le(){return _({data:h().optional()})}function Be(){return _({theme_params:r=>{const t=Et().optional();return Object.entries(X(r)).reduce((e,[s,n])=>(e[s]=t.parse(n),e),{})}})}function $e(){return _({height:R(),width:r=>r==null?window.innerWidth:R().parse(r),is_state_stable:S(),is_expanded:S()})}function De(){return _({status:h()})}function xe(){const r=new b,t=(e,...s)=>{B.log("Emitting processed event:",e,...s),r.emit(e,...s)};return window.addEventListener("resize",()=>{t("viewport_changed",{width:window.innerWidth,height:window.innerHeight,is_state_stable:!0,is_expanded:!0})}),qe((e,s)=>{B.log("Received raw event:",e,s);try{switch(e){case"viewport_changed":return t(e,$e().parse(s));case"theme_changed":return t(e,Be().parse(s));case"popup_closed":return s==null?t(e,{}):t(e,Ie().parse(s));case"set_custom_style":return t(e,h().parse(s));case"qr_text_received":return t(e,Le().parse(s));case"clipboard_text_received":return t(e,Ae().parse(s));case"invoice_closed":return t(e,Ve().parse(s));case"phone_requested":return t("phone_requested",Te().parse(s));case"custom_method_invoked":return t("custom_method_invoked",Re().parse(s));case"write_access_requested":return t("write_access_requested",De().parse(s));case"main_button_pressed":case"back_button_pressed":case"settings_button_pressed":case"scan_qr_popup_closed":case"reload_iframe":return t(e);default:return t(e,s)}}catch(n){B.error("Error processing event:",n)}}),r}const lt="telegram-mini-apps-cached-emitter";function H(){const r=window;return r[lt]===void 0&&(r[lt]=xe()),r[lt]}function V(r,t){H().off(r,t)}function y(r,t){return H().on(r,t),()=>V(r,t)}function Ne(r,t){return H().once(r,t),()=>V(r,t)}function Tt(r){H().unsubscribe(r)}function He(r){return H().subscribe(r),()=>Tt(r)}function It(r,t){const e=r.split("."),s=t.split("."),n=Math.max(e.length,s.length);for(let i=0;i<n;i+=1){const c=parseInt(e[i]||"0",10),u=parseInt(s[i]||"0",10);if(c!==u)return c>u?1:-1}return 0}function k(r,t){return It(r,t)<=0}function T(r,t,e){if(typeof e=="string"){if(r==="web_app_open_link"&&t==="try_instant_view")return k("6.4",e);if(r==="web_app_set_header_color"&&t==="color")return k("6.9",e)}switch(r){case"web_app_open_tg_link":case"web_app_open_invoice":case"web_app_setup_back_button":case"web_app_set_background_color":case"web_app_set_header_color":case"web_app_trigger_haptic_feedback":return k("6.1",t);case"web_app_open_popup":return k("6.2",t);case"web_app_close_scan_qr_popup":case"web_app_open_scan_qr_popup":case"web_app_read_text_from_clipboard":return k("6.4",t);case"web_app_switch_inline_query":return k("6.7",t);case"web_app_invoke_custom_method":case"web_app_request_write_access":case"web_app_request_phone":return k("6.9",t);case"web_app_setup_settings_button":return k("6.10",t);default:return!0}}function C(r,t){return e=>T(t[e],r)}function Lt(r,t){return e=>{const[s,n]=t[e];return T(s,n,r)}}function g(r,t,e){let s={},n;t===void 0&&e===void 0?s={}:t!==void 0&&e!==void 0?(s=e,n=t):t!==void 0&&("targetOrigin"in t?s=t:n=t);const{targetOrigin:i=ve()}=s;if(B.log(`Calling method "${r}"`,n),pt()){window.parent.postMessage(JSON.stringify({eventType:r,eventData:n}),i);return}if(me(window)){window.external.notify(JSON.stringify({eventType:r,eventData:n}));return}if(ye(window)){window.TelegramWebviewProxy.postEvent(r,JSON.stringify(n));return}throw new Error("Unable to determine current environment and possible way to send event.")}function Bt(r){return(t,e)=>{if(!T(t,r))throw new Z(t,r);if(w(e)){let s;if(t==="web_app_open_link"&&"try_instant_view"in e?s="try_instant_view":t==="web_app_set_header_color"&&"color"in e&&(s="color"),s&&!T(t,s,r))throw new K(t,s,r)}return g(t,e)}}class O extends Error{constructor(t){super(`Async call timeout exceeded. Timeout: ${t}`),Object.setPrototypeOf(this,O.prototype)}}function Oe(r){return r instanceof O}function We(r){return new Promise(t=>{setTimeout(t,r)})}function Me(r){return new Promise((t,e)=>{setTimeout(e,r,new O(r))})}function dt(r,t){return Promise.race([r(),Me(t)])}function E(r,t,e,s){let n,i,c,u;typeof t=="string"||Array.isArray(t)?(c=Array.isArray(t)?t:[t],n=e):(i=t,c=Array.isArray(e)?e:[e],n=s),w(i)&&typeof i.req_id=="string"&&(u=i.req_id);const{postEvent:p=g,timeout:l}=n||{},d=n&&"capture"in n?n.capture:null,v=()=>new Promise((f,A)=>{const N=c.map(F=>y(F,Y=>{u&&(!w(Y)||Y.req_id!==u)||typeof d=="function"&&!d(Y)||(G(),f(Y))})),G=()=>N.forEach(F=>F());try{p(r,i)}catch(F){G(),A(F)}});return typeof l=="number"?dt(v,l):v()}async function $(r,t,e,s={}){const{result:n,error:i}=await E("web_app_invoke_custom_method",{method:r,params:t,req_id:e},"custom_method_invoked",s);if(i)throw new Error(i);return n}class $t{constructor(t,e,s=g){o(this,"ee",new b);o(this,"state");o(this,"on",(t,e)=>t==="click"?y("back_button_pressed",e):this.ee.on(t,e));o(this,"off",(t,e)=>t==="click"?V("back_button_pressed",e):this.ee.off(t,e));o(this,"supports");this.postEvent=s,this.state=new m({isVisible:t},this.ee),this.supports=C(e,{show:"web_app_setup_back_button",hide:"web_app_setup_back_button"})}set isVisible(t){this.state.set("isVisible",t),this.postEvent("web_app_setup_back_button",{is_visible:t})}get isVisible(){return this.state.get("isVisible")}hide(){this.isVisible=!1}show(){this.isVisible=!0}}function Dt(r,t){return r+(r.length>0&&t.length>0?` ${t}`:t)}function xt(...r){return r.reduce((t,e)=>{let s="";return typeof e=="string"?s=e:typeof e=="object"&&e!==null&&(s=Object.entries(e).reduce((n,[i,c])=>c?Dt(n,i):n,"")),Dt(t,s)},"")}function Ue(r){return typeof r=="object"&&r!==null&&!Array.isArray(null)}function je(...r){return r.reduce((t,e)=>(Ue(e)&&Object.entries(e).forEach(([s,n])=>{const i=xt(t[s],n);i.length>0&&(t[s]=i)}),t),{})}class Nt{constructor(t,e=g){o(this,"ee",new b);o(this,"state");o(this,"on",this.ee.on.bind(this.ee));o(this,"off",this.ee.off.bind(this.ee));this.postEvent=e,this.state=new m({isConfirmationNeeded:t},this.ee)}set isConfirmationNeeded(t){this.state.set("isConfirmationNeeded",t),this.postEvent("web_app_setup_closing_behavior",{need_confirmation:t})}get isConfirmationNeeded(){return this.state.get("isConfirmationNeeded")}disableConfirmation(){this.isConfirmationNeeded=!1}enableConfirmation(){this.isConfirmationNeeded=!0}}function Ht(r,t){return r.reduce((e,s)=>(e[s]=t,e),{})}class Ot{constructor(t,e,s=g){o(this,"supports");this.createRequestId=e,this.postEvent=s,this.supports=C(t,{delete:"web_app_invoke_custom_method",get:"web_app_invoke_custom_method",getKeys:"web_app_invoke_custom_method",set:"web_app_invoke_custom_method"})}async delete(t,e={}){const s=Array.isArray(t)?t:[t];s.length!==0&&await $("deleteStorageValues",{keys:s},this.createRequestId(),{...e,postEvent:this.postEvent})}async getKeys(t={}){const e=await $("getStorageKeys",{},this.createRequestId(),{...t,postEvent:this.postEvent});return oe().of(h()).parse(e)}async get(t,e={}){const s=Array.isArray(t)?t:[t];if(s.length===0)return Ht(s,"");const n=_(Ht(s,h())),i=await $("getStorageValues",{keys:s},this.createRequestId(),{...e,postEvent:this.postEvent}).then(c=>n.parse(c));return Array.isArray(t)?i:i[t]}async set(t,e,s={}){await $("saveStorageValue",{key:t,value:e},this.createRequestId(),{...s,postEvent:this.postEvent})}}class Wt{constructor(t,e=g){o(this,"supports");this.postEvent=e,this.supports=C(t,{impactOccurred:"web_app_trigger_haptic_feedback",notificationOccurred:"web_app_trigger_haptic_feedback",selectionChanged:"web_app_trigger_haptic_feedback"})}impactOccurred(t){this.postEvent("web_app_trigger_haptic_feedback",{type:"impact",impact_style:t})}notificationOccurred(t){this.postEvent("web_app_trigger_haptic_feedback",{type:"notification",notification_type:t})}selectionChanged(){this.postEvent("web_app_trigger_haptic_feedback",{type:"selection_change"})}}function Ge(){const r=document.createElement("style");r.id="telegram-custom-styles",document.head.appendChild(r),y("set_custom_style",t=>{r.innerHTML=t})}function Mt(r){return`telegram-mini-apps-${r}`}function D(r,t){sessionStorage.setItem(Mt(r),JSON.stringify(t))}function x(r){const t=sessionStorage.getItem(Mt(r));return t?JSON.parse(t):null}function Fe(r,t,e){const{isVisible:s=!1}=r?x("back-button")||{}:{},n=new $t(s,t,e);return n.on("change",()=>{D("back-button",{isVisible:n.isVisible})}),n}function ze(r,t){const{isConfirmationNeeded:e=!1}=r?x("closing-behavior")||{}:{},s=new Nt(e,t);return s.on("change",()=>D("closing-behavior",{isConfirmationNeeded:s.isConfirmationNeeded})),s}class Ut{constructor(t){o(this,"ee",new b);o(this,"state");o(this,"postEvent");o(this,"on",(t,e)=>t==="click"?y("main_button_pressed",e):this.ee.on(t,e));o(this,"off",(t,e)=>t==="click"?V("main_button_pressed",e):this.ee.off(t,e));const{postEvent:e=g,text:s,textColor:n,backgroundColor:i,isEnabled:c,isVisible:u,isLoaderVisible:p}=t;this.postEvent=e,this.state=new m({backgroundColor:i,isEnabled:c,isVisible:u,isLoaderVisible:p,text:s,textColor:n},this.ee)}commit(){this.text!==""&&this.postEvent("web_app_setup_main_button",{is_visible:this.isVisible,is_active:this.isEnabled,is_progress_visible:this.isLoaderVisible,text:this.text,color:this.backgroundColor,text_color:this.textColor})}set isEnabled(t){this.setParams({isEnabled:t})}get isEnabled(){return this.state.get("isEnabled")}set isLoaderVisible(t){this.setParams({isLoaderVisible:t})}get isLoaderVisible(){return this.state.get("isLoaderVisible")}set isVisible(t){this.setParams({isVisible:t})}get isVisible(){return this.state.get("isVisible")}get backgroundColor(){return this.state.get("backgroundColor")}get text(){return this.state.get("text")}get textColor(){return this.state.get("textColor")}disable(){return this.isEnabled=!1,this}enable(){return this.isEnabled=!0,this}hide(){return this.isVisible=!1,this}hideLoader(){return this.isLoaderVisible=!1,this}show(){return this.isVisible=!0,this}showLoader(){return this.isLoaderVisible=!0,this}setText(t){return this.setParams({text:t})}setTextColor(t){return this.setParams({textColor:t})}setBackgroundColor(t){return this.setParams({backgroundColor:t})}setParams(t){return this.state.set(t),this.commit(),this}}function Je(r,t,e,s){const{backgroundColor:n=t,isEnabled:i=!1,isVisible:c=!1,isLoaderVisible:u=!1,textColor:p=e,text:l=""}=r?x("main-button")||{}:{},d=new Ut({backgroundColor:n,isEnabled:i,isLoaderVisible:u,isVisible:c,postEvent:s,text:l,textColor:p}),v=()=>D("main-button",{backgroundColor:d.backgroundColor,isEnabled:d.isEnabled,isLoaderVisible:d.isLoaderVisible,isVisible:d.isVisible,text:d.text,textColor:d.textColor});return d.on("change",v),d}const Qe=st({contact:_({userId:{type:R(),from:"user_id"},phoneNumber:{type:h(),from:"phone_number"},firstName:{type:h(),from:"first_name"},lastName:{type:h().optional(),from:"last_name"}}),authDate:{type:mt(),from:"auth_date"},hash:h()});class jt{constructor(t){o(this,"ee",new b);o(this,"state");o(this,"botInline");o(this,"postEvent");o(this,"createRequestId");o(this,"requestingPhoneAccess",!1);o(this,"requestingWriteAccess",!1);o(this,"on",this.ee.on.bind(this.ee));o(this,"off",this.ee.off.bind(this.ee));o(this,"supports");o(this,"supportsParam");const{postEvent:e=g,headerColor:s,backgroundColor:n,version:i,botInline:c,createRequestId:u}=t,p=C(i,{requestPhoneAccess:"web_app_request_phone",requestWriteAccess:"web_app_request_write_access",switchInlineQuery:"web_app_switch_inline_query",setHeaderColor:"web_app_set_header_color",setBackgroundColor:"web_app_set_background_color"});this.postEvent=e,this.botInline=c,this.createRequestId=u,this.supports=l=>!(!p(l)||l==="switchInlineQuery"&&!c),this.state=new m({backgroundColor:n,headerColor:s},this.ee),this.supportsParam=Lt(i,{"setHeaderColor.color":["web_app_set_header_color","color"]})}async getRequestedContact(){return $("getRequestedContact",{},this.createRequestId(),{postEvent:this.postEvent,timeout:1e4}).then(t=>Qe.parse(t))}get backgroundColor(){return this.state.get("backgroundColor")}close(){this.postEvent("web_app_close")}get headerColor(){return this.state.get("headerColor")}get isBotInline(){return this.botInline}get isDark(){return rt(this.backgroundColor)}get isRequestingPhoneAccess(){return this.requestingPhoneAccess}get isRequestingWriteAccess(){return this.requestingWriteAccess}ready(){this.postEvent("web_app_ready")}async requestContact({timeout:t=5e3}={}){try{return await this.getRequestedContact()}catch{}if(await this.requestPhoneAccess()!=="sent")throw new Error("Access denied.");const s=Date.now()+t;let n=50;return dt(async()=>{for(;Date.now()<s;){try{return await this.getRequestedContact()}catch{}await We(n),n+=50}throw new Error("Unable to retrieve requested contact.")},t)}requestPhoneAccess(t={}){if(this.requestingPhoneAccess)throw new Error("Phone access is already being requested.");return this.requestingPhoneAccess=!0,E("web_app_request_phone","phone_requested",{...t,postEvent:this.postEvent}).then(e=>e.status).finally(()=>{this.requestingPhoneAccess=!1})}requestWriteAccess(t={}){if(this.requestingWriteAccess)throw new Error("Write access is already being requested.");return this.requestingWriteAccess=!0,E("web_app_request_write_access","write_access_requested",{...t,postEvent:this.postEvent}).then(e=>e.status).finally(()=>{this.requestingWriteAccess=!1})}sendData(t){const{size:e}=new Blob([t]);if(e===0||e>4096)throw new Error(`Passed data has incorrect size: ${e}`);this.postEvent("web_app_data_send",{data:t})}setHeaderColor(t){this.postEvent("web_app_set_header_color",tt(t)?{color:t}:{color_key:t}),this.state.set("headerColor",t)}setBackgroundColor(t){this.postEvent("web_app_set_background_color",{color:t}),this.state.set("backgroundColor",t)}switchInlineQuery(t,e=[]){if(!this.supports("switchInlineQuery")&&!this.isBotInline)throw new Error("Method is unsupported because Mini App should be launched in inline mode.");this.postEvent("web_app_switch_inline_query",{query:t,chat_types:e})}}function Ze(r,t,e,s,n,i){const{backgroundColor:c=t,headerColor:u="bg_color"}=r?x("mini-app")||{}:{},p=new jt({headerColor:u,backgroundColor:c,version:e,botInline:s,createRequestId:n,postEvent:i}),l=()=>D("mini-app",{backgroundColor:p.backgroundColor,headerColor:p.headerColor});return p.on("change",l),p}function Ke(){let r=0;return()=>(r+=1,r.toString())}class Gt{constructor(t,e,s=g){o(this,"ee",new b);o(this,"state");o(this,"on",(t,e)=>t==="click"?y("settings_button_pressed",e):this.ee.on(t,e));o(this,"off",(t,e)=>t==="click"?V("settings_button_pressed",e):this.ee.off(t,e));o(this,"supports");this.postEvent=s,this.state=new m({isVisible:t},this.ee),this.supports=C(e,{show:"web_app_setup_settings_button",hide:"web_app_setup_settings_button"})}set isVisible(t){this.state.set("isVisible",t),this.postEvent("web_app_setup_settings_button",{is_visible:t})}get isVisible(){return this.state.get("isVisible")}hide(){this.isVisible=!1}show(){this.isVisible=!0}}function Ye(r,t,e){const{isVisible:s=!1}=r?x("settings-button")||{}:{},n=new Gt(s,t,e);return n.on("change",()=>{D("settings-button",{isVisible:n.isVisible})}),n}function Xe(r){const t=new St(r);return t.listen(),t}async function ft(r){const t=await E("web_app_request_viewport","viewport_changed",r);return{height:t.height,width:t.width,isExpanded:t.is_expanded,isStateStable:t.is_state_stable}}function W(r){return r<0?0:r}class M{constructor(t){o(this,"ee",new b);o(this,"state");o(this,"postEvent");o(this,"on",this.ee.on.bind(this.ee));o(this,"off",this.ee.off.bind(this.ee));const{height:e,isExpanded:s,width:n,stableHeight:i,postEvent:c=g}=t;this.postEvent=c,this.state=new m({height:W(e),isExpanded:s,stableHeight:W(i),width:W(n)},this.ee)}sync(t){return ft(t).then(({height:e,isExpanded:s,width:n,isStateStable:i})=>{this.state.set({height:e,width:n,isExpanded:s,stableHeight:i?e:this.state.get("stableHeight")})})}get height(){return this.state.get("height")}get stableHeight(){return this.state.get("stableHeight")}listen(){return y("viewport_changed",t=>{const{height:e,width:s,is_expanded:n,is_state_stable:i}=t,c={height:W(e),isExpanded:n,width:W(s)};i&&(c.stableHeight=c.height),this.state.set(c)})}get isExpanded(){return this.state.get("isExpanded")}get width(){return this.state.get("width")}expand(){this.postEvent("web_app_expand"),this.state.set("isExpanded",!0)}get isStable(){return this.stableHeight===this.height}}function Ft(r){return!["macos","web","weba"].includes(r)}function zt(r,t,e){if(r||!Ft(t))return new M({height:window.innerHeight,isExpanded:!0,postEvent:e,stableHeight:window.innerHeight,width:window.innerWidth});const s=x("viewport");return s?new M({...s,postEvent:e}):null}function Jt(r){return r.listen(),r.on("change",()=>D("viewport",{height:r.height,isExpanded:r.isExpanded,stableHeight:r.stableHeight,width:r.width})),r}function tr(r,t,e){const s=Jt(zt(r,t,e)||new M({width:0,height:0,isExpanded:!1,postEvent:e,stableHeight:0}));return Ft(t)&&s.sync({postEvent:e,timeout:100}).catch(n=>{console.error("Unable to actualize viewport state",n)}),s}async function er(r,t,e){return Jt(zt(r,t,e)||await ft({postEvent:e,timeout:100}).then(({height:s,isStateStable:n,...i})=>new M({...i,height:s,stableHeight:n?s:0})))}function q(r,t){document.documentElement.style.setProperty(r,t)}function rr(r,t){const e=()=>{q("--tg-background-color",r.backgroundColor)},s=()=>{const{backgroundColor:n,secondaryBackgroundColor:i}=t;r.headerColor==="bg_color"?n&&q("--tg-header-color",n):r.headerColor==="secondary_bg_color"?i&&q("--tg-header-color",i):q("--tg-header-color",r.headerColor)};t.on("change",s),r.on("change:backgroundColor",e),r.on("change:headerColor",s),e(),s()}function sr(r){const t=()=>{const e=r.getState();Object.entries(e).forEach(([s,n])=>{if(n){const i=s.replace(/[A-Z]/g,c=>`-${c.toLowerCase()}`);q(`--tg-theme-${i}`,n)}})};r.on("change",t),t()}function Qt(r){const t=()=>q("--tg-viewport-height",`${r.height}px`),e=()=>q("--tg-viewport-width",`${r.width}px`),s=()=>q("--tg-viewport-height",`${r.stableHeight}px`);r.on("change:height",t),r.on("change:width",e),r.on("change:stableHeight",s),t(),e(),s()}function nr(r){return typeof r=="object"?r:r?{themeParams:!0,viewport:!0,miniApp:!0}:{}}function Zt(r,t,e,s){const n=nr(r);n.miniApp&&rr(t,e),n.themeParams&&sr(e),n.viewport&&(s instanceof Promise?s.then(Qt):Qt(s))}function ir(r){const{hostname:t,pathname:e}=new URL(r,window.location.href);if(t!=="t.me")throw new Error(`Incorrect hostname: ${t}`);const s=e.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);if(s===null)throw new Error('Link pathname has incorrect format. Expected to receive "/invoice/{slug}" or "/${slug}"');return s[2]}class Kt{constructor(t,e=g){o(this,"ee",new b);o(this,"state");o(this,"on",this.ee.on.bind(this.ee));o(this,"off",this.ee.off.bind(this.ee));o(this,"supports");this.postEvent=e,this.state=new m({isOpened:!1},this.ee),this.supports=C(t,{open:"web_app_open_invoice"})}set isOpened(t){this.state.set("isOpened",t)}get isOpened(){return this.state.get("isOpened")}async open(t,e){if(this.isOpened)throw new Error("Invoice is already opened");const s=e?ir(t):t;this.isOpened=!0;try{return(await E("web_app_open_invoice",{slug:s},"invoice_closed",{postEvent:this.postEvent,capture(i){return s===i.slug}})).status}finally{this.isOpened=!1}}}function or(r){const t=r.message.trim(),e=(r.title||"").trim(),s=r.buttons||[];let n;if(e.length>64)throw new Error(`Title has incorrect size: ${e.length}`);if(t.length===0||t.length>256)throw new Error(`Message has incorrect size: ${t.length}`);if(s.length>3)throw new Error(`Buttons have incorrect size: ${s.length}`);return s.length===0?n=[{type:"close",id:""}]:n=s.map(i=>{const{id:c=""}=i;if(c.length>64)throw new Error(`Button ID has incorrect size: ${c}`);if(i.type===void 0||i.type==="default"||i.type==="destructive"){const u=i.text.trim();if(u.length===0||u.length>64){const p=i.type||"default";throw new Error(`Button text with type "${p}" has incorrect size: ${i.text.length}`)}return{...i,text:u,id:c}}return{...i,id:c}}),{title:e,message:t,buttons:n}}class Yt{constructor(t,e=g){o(this,"ee",new b);o(this,"state");o(this,"on",this.ee.on.bind(this.ee));o(this,"off",this.ee.off.bind(this.ee));o(this,"supports");this.postEvent=e,this.state=new m({isOpened:!1},this.ee),this.supports=C(t,{open:"web_app_open_popup"})}set isOpened(t){this.state.set("isOpened",t)}get isOpened(){return this.state.get("isOpened")}open(t){if(this.isOpened)throw new Error("Popup is already opened.");return this.isOpened=!0,E("web_app_open_popup",or(t),"popup_closed",{postEvent:this.postEvent}).then(({button_id:e=null})=>e).finally(()=>{this.isOpened=!1})}}class Xt{constructor(t,e=g){o(this,"ee",new b);o(this,"state");o(this,"on",this.ee.on.bind(this.ee));o(this,"off",this.ee.off.bind(this.ee));o(this,"supports");this.postEvent=e,this.state=new m({isOpened:!1},this.ee),this.supports=C(t,{close:"web_app_close_scan_qr_popup",open:"web_app_open_scan_qr_popup"})}close(){this.postEvent("web_app_close_scan_qr_popup"),this.isOpened=!1}set isOpened(t){this.state.set("isOpened",t)}get isOpened(){return this.state.get("isOpened")}async open(t){if(this.isOpened)throw new Error("QR scanner is already opened.");this.isOpened=!0;try{const e=await E("web_app_open_scan_qr_popup",{text:t},["qr_text_received","scan_qr_popup_closed"],{postEvent:this.postEvent});return typeof e=="object"&&typeof e.data=="string"?e.data:null}finally{this.isOpened=!1}}}class te{constructor(t,e,s=g){o(this,"supports");o(this,"supportsParam");this.version=t,this.createRequestId=e,this.postEvent=s,this.supports=C(t,{readTextFromClipboard:"web_app_read_text_from_clipboard"}),this.supportsParam=Lt(t,{"openLink.tryInstantView":["web_app_open_link","try_instant_view"]})}openLink(t,e){const s=new URL(t,window.location.href).toString();if(!T("web_app_open_link",this.version)){window.open(s,"_blank");return}this.postEvent("web_app_open_link",{url:s,...typeof e=="boolean"?{try_instant_view:e}:{}})}openTelegramLink(t){const{hostname:e,pathname:s,search:n}=new URL(t,window.location.href);if(e!=="t.me")throw new Error(`URL has not allowed hostname: ${e}. Only "t.me" is allowed`);if(!T("web_app_open_tg_link",this.version)){window.location.href=t;return}this.postEvent("web_app_open_tg_link",{path_full:s+n})}readTextFromClipboard(){return E("web_app_read_text_from_clipboard",{req_id:this.createRequestId()},"clipboard_text_received",{postEvent:this.postEvent}).then(({data:t=null})=>t)}}function ar(r={}){const{async:t=!1,cssVars:e=!1,acceptCustomStyles:s=!1}=r;try{const{launchParams:{initData:n,initDataRaw:i,version:c,platform:u,themeParams:p,botInline:l=!1},isPageReload:d}=ht(),v=Ke(),f=Bt(c);pt()&&(s&&Ge(),f("iframe_ready",{reload_supported:!0}),y("reload_iframe",()=>window.location.reload()));const A={backButton:Fe(d,c,f),closingBehavior:ze(d,f),cloudStorage:new Ot(c,v,f),createRequestId:v,hapticFeedback:new Wt(c,f),invoice:new Kt(c,f),mainButton:Je(d,p.buttonColor||"#000000",p.buttonTextColor||"#ffffff",f),miniApp:Ze(d,p.backgroundColor||"#ffffff",c,l,v,f),popup:new Yt(c,f),postEvent:f,qrScanner:new Xt(c,f),settingsButton:Ye(d,c,f),themeParams:Xe(p),utils:new te(c,v,f),...n?{initData:new vt(n),initDataRaw:i}:{}},N=t?er(d,u,f):tr(d,u,f);return N instanceof Promise?N.then(G=>(Zt(e,A.miniApp,A.themeParams,G),{...A,viewport:G})):(Zt(e,A.miniApp,A.themeParams,N),{...A,viewport:N})}catch(n){if(t)return Promise.reject(n);throw n}}function U(r,t){return r.startsWith(t)?r:`${t}${r}`}function cr(r){const t=r.match(/#(.+)/);return t?t[1]:null}async function j(r){return r===0?!0:Promise.race([new Promise(t=>{window.addEventListener("popstate",function e(){window.removeEventListener("popstate",e),t(!0)}),window.history.go(r)}),new Promise(t=>{setTimeout(t,50,!1)})])}async function ur(){if(window.history.length<=1||(window.history.pushState(null,""),await j(1-window.history.length)))return;let t=await j(-1);for(;t;)t=await j(-1)}class ee{constructor(t,e,{debug:s=!1,loggerPrefix:n="Navigator"}){o(this,"logger");o(this,"entries");if(this.entriesCursor=e,t.length===0)throw new Error("Entries list should not be empty.");if(e>=t.length)throw new Error("Cursor should be less than entries count.");this.entries=t.map(({pathname:i="",search:c,hash:u})=>{if(!i.startsWith("/")&&i.length>0)throw new Error('Pathname should start with "/"');return{pathname:U(i,"/"),search:c?U(c,"?"):"",hash:u?U(u,"#"):""}}),this.logger=new Rt(`[${n}]`,s)}formatEntry(t){let e;if(typeof t=="string")e=t;else{const{pathname:c="",search:u,hash:p}=t;e=c+(u?U(u,"?"):"")+(p?U(p,"#"):"")}const{pathname:s,search:n,hash:i}=new URL(e,`https://localhost${this.path}`);return{pathname:s,search:n,hash:i}}get entry(){return this.entries[this.entriesCursor]}back(){return this.go(-1)}get cursor(){return this.entriesCursor}get canGoBack(){return this.entriesCursor>0}get canGoForward(){return this.entriesCursor!==this.entries.length-1}forward(){return this.go(1)}go(t){this.logger.log(`called go(${t})`);const e=Math.min(this.entries.length-1,Math.max(this.entriesCursor+t,0));if(this.entriesCursor===e)return this.performGo({updated:!1,delta:t});const s=this.entry;this.entriesCursor=e;const n=this.entry;return this.logger.log("State changed",{before:s,after:n}),this.performGo({updated:!0,delta:t,before:s,after:n})}getEntries(){return this.entries.map(t=>({...t}))}get hash(){return this.entry.hash}push(t){this.entriesCursor!==this.entries.length-1&&this.entries.splice(this.entriesCursor+1);const e=this.formatEntry(t),s=this.entry;this.entriesCursor+=1,this.entries[this.entriesCursor]=e;const n=this.entry;return this.logger.log("State changed",{before:s,after:n}),this.performPush({before:s,after:n})}get path(){return`${this.pathname}${this.search}${this.hash}`}get pathname(){return this.entry.pathname}replace(t){const e=this.formatEntry(t);if(this.search===e.search&&this.pathname===e.pathname&&this.hash===e.hash)return this.performReplace({updated:!1,entry:e});const s=this.entry;this.entries[this.entriesCursor]=e;const n=this.entry;return this.logger.log("State changed",{before:s,after:n}),this.performReplace({updated:!0,before:s,after:n})}get search(){return this.entry.search}}const re=0,gt=1,wt=2;class _t extends ee{constructor(e,s,n={}){super(e,s,{...n,loggerPrefix:"HashNavigator"});o(this,"ee",new b);o(this,"attached",!1);o(this,"onPopState",async({state:e})=>{if(this.logger.log('"popstate" event received. State:',e),e===null)return this.push(window.location.hash.slice(1));if(e===re){this.logger.log("Void reached. Moving history forward"),window.history.forward();return}if(e===gt)return this.back();if(e===wt)return this.forward()});o(this,"back",()=>super.back());o(this,"on",this.ee.on.bind(this.ee));o(this,"off",this.ee.off.bind(this.ee))}static fromLocation(e){const{search:s,pathname:n,hash:i}=new URL(window.location.hash.slice(1),window.location.href);return new _t([{search:s,pathname:n,hash:i}],0,e)}async performGo(e){e.updated&&(this.attached&&await this.syncHistory(),this.emitChanged(e.before,e.after))}async performPush({before:e,after:s}){this.attached&&await this.syncHistory(),this.emitChanged(e,s)}async performReplace(e){e.updated&&(this.attached&&window.history.replaceState(null,"",`#${this.path}`),this.emitChanged(e.before,e.after))}async syncHistory(){window.removeEventListener("popstate",this.onPopState);const e=`#${this.path}`;await ur(),g("web_app_setup_back_button",{is_visible:this.canGoBack}),this.canGoBack&&this.canGoForward?(this.logger.log("Setting up history: [<-, *, ->]"),window.history.replaceState(gt,""),window.history.pushState(null,"",e),window.history.pushState(wt,""),await j(-1)):this.canGoBack?(this.logger.log("Setting up history: [<-, *]"),window.history.replaceState(gt,""),window.history.pushState(null,"",e)):this.canGoForward?(this.logger.log("Setting up history: [*, ->]"),window.history.replaceState(null,e),window.history.pushState(wt,""),await j(-1)):(this.logger.log("Setting up history: [~, *]"),window.history.replaceState(re,""),window.history.pushState(null,"",e)),window.addEventListener("popstate",this.onPopState)}emitChanged(e,s){this.ee.emit("change",{navigator:this,from:e,to:s})}async attach(){if(!this.attached)return this.logger.log("Attaching",this),this.attached=!0,y("back_button_pressed",this.back),this.syncHistory()}detach(){this.attached&&(this.logger.log("Detaching",this),this.attached=!1,window.removeEventListener("popstate",this.onPopState),V("back_button_pressed",this.back))}}return a.BackButton=$t,a.ClosingBehavior=Nt,a.CloudStorage=Ot,a.HapticFeedback=Wt,a.HashNavigator=_t,a.InitData=vt,a.Invoice=Kt,a.MainButton=Ut,a.MethodUnsupportedError=Z,a.MiniApp=jt,a.Navigator=ee,a.ParameterUnsupportedError=K,a.Popup=Yt,a.QRScanner=Xt,a.SettingsButton=Gt,a.ThemeParams=St,a.TimeoutError=O,a.Utils=te,a.Viewport=M,a.chatParser=Ct,a.classNames=xt,a.compareVersions=It,a.createPostEvent=Bt,a.getHash=cr,a.init=ar,a.initDataParser=it,a.invokeCustomMethod=$,a.isColorDark=rt,a.isIframe=pt,a.isRGB=tt,a.isRGBShort=yt,a.isRecord=w,a.isTMA=be,a.isTimeoutError=Oe,a.launchParamsParser=ct,a.mergeClassNames=je,a.off=V,a.on=y,a.once=Ne,a.parseInitData=ae,a.parseLaunchParams=ut,a.parseThemeParams=at,a.postEvent=g,a.request=E,a.requestThemeParams=he,a.requestViewport=ft,a.retrieveLaunchData=ht,a.serializeLaunchParams=kt,a.serializeThemeParams=Pt,a.setDebug=Ee,a.setTargetOrigin=Ce,a.subscribe=He,a.supports=T,a.themeParamsParser=ot,a.toRGB=et,a.unsubscribe=Tt,a.userParser=nt,a.withTimeout=dt,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),a}({});
|
|
2
2
|
//# sourceMappingURL=index.iife.js.map
|