@core-ease/telegram-kit 3.0.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.
Files changed (86) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +299 -0
  3. package/dist/animation/index.d.mts +4 -0
  4. package/dist/animation/index.d.ts +4 -0
  5. package/dist/animation/index.js +2413 -0
  6. package/dist/animation/index.mjs +5 -0
  7. package/dist/animation/lottie/index.d.mts +10 -0
  8. package/dist/animation/lottie/index.d.ts +10 -0
  9. package/dist/animation/lottie/index.js +2313 -0
  10. package/dist/animation/lottie/index.mjs +4 -0
  11. package/dist/animation/tgs/index.d.mts +18 -0
  12. package/dist/animation/tgs/index.d.ts +18 -0
  13. package/dist/animation/tgs/index.js +2402 -0
  14. package/dist/animation/tgs/index.mjs +4 -0
  15. package/dist/bot/index.d.mts +477 -0
  16. package/dist/bot/index.d.ts +477 -0
  17. package/dist/bot/index.js +870 -0
  18. package/dist/bot/index.mjs +847 -0
  19. package/dist/bot-D8BnLWIi.d.mts +2041 -0
  20. package/dist/bot-D8BnLWIi.d.ts +2041 -0
  21. package/dist/browser.global.js +23 -0
  22. package/dist/chunk-7AARTHNW.mjs +40 -0
  23. package/dist/chunk-7CVYPKAL.mjs +15 -0
  24. package/dist/chunk-B3PWALX5.mjs +4418 -0
  25. package/dist/chunk-BQEUEAVK.mjs +2262 -0
  26. package/dist/chunk-FPWYSKK2.mjs +3089 -0
  27. package/dist/chunk-JXK5HCDV.mjs +254 -0
  28. package/dist/chunk-OMH2JGOH.mjs +88 -0
  29. package/dist/chunk-PXO36YTU.mjs +38 -0
  30. package/dist/core/index.d.mts +151 -0
  31. package/dist/core/index.d.ts +151 -0
  32. package/dist/core/index.js +3837 -0
  33. package/dist/core/index.mjs +495 -0
  34. package/dist/dev/index.d.mts +77 -0
  35. package/dist/dev/index.d.ts +77 -0
  36. package/dist/dev/index.js +3214 -0
  37. package/dist/dev/index.mjs +151 -0
  38. package/dist/engine-BDm1_hzn.d.mts +382 -0
  39. package/dist/engine-BDm1_hzn.d.ts +382 -0
  40. package/dist/format/index.d.mts +61 -0
  41. package/dist/format/index.d.ts +61 -0
  42. package/dist/format/index.js +121 -0
  43. package/dist/format/index.mjs +112 -0
  44. package/dist/hooks/index.d.mts +1 -0
  45. package/dist/hooks/index.d.ts +1 -0
  46. package/dist/hooks/index.js +4234 -0
  47. package/dist/hooks/index.mjs +3 -0
  48. package/dist/hooks-C5Per70R.d.mts +1066 -0
  49. package/dist/hooks-C5Per70R.d.ts +1066 -0
  50. package/dist/index.d.mts +849 -0
  51. package/dist/index.d.ts +849 -0
  52. package/dist/index.js +5026 -0
  53. package/dist/index.mjs +478 -0
  54. package/dist/keyboards/index.d.mts +50 -0
  55. package/dist/keyboards/index.d.ts +50 -0
  56. package/dist/keyboards/index.js +127 -0
  57. package/dist/keyboards/index.mjs +124 -0
  58. package/dist/links/index.d.mts +53 -0
  59. package/dist/links/index.d.ts +53 -0
  60. package/dist/links/index.js +139 -0
  61. package/dist/links/index.mjs +133 -0
  62. package/dist/lottie/index.d.mts +3 -0
  63. package/dist/lottie/index.d.ts +3 -0
  64. package/dist/lottie/index.js +2313 -0
  65. package/dist/lottie/index.mjs +4 -0
  66. package/dist/qr/index.d.mts +75 -0
  67. package/dist/qr/index.d.ts +75 -0
  68. package/dist/qr/index.js +983 -0
  69. package/dist/qr/index.mjs +946 -0
  70. package/dist/sdk/index.d.mts +322 -0
  71. package/dist/sdk/index.d.ts +322 -0
  72. package/dist/sdk/index.js +3138 -0
  73. package/dist/sdk/index.mjs +2 -0
  74. package/dist/server/index.d.mts +28 -0
  75. package/dist/server/index.d.ts +28 -0
  76. package/dist/server/index.js +254 -0
  77. package/dist/server/index.mjs +246 -0
  78. package/dist/tgs/index.d.mts +3 -0
  79. package/dist/tgs/index.d.ts +3 -0
  80. package/dist/tgs/index.js +2402 -0
  81. package/dist/tgs/index.mjs +4 -0
  82. package/dist/webapp-B-3_74nK.d.mts +842 -0
  83. package/dist/webapp-B-3_74nK.d.ts +842 -0
  84. package/dist/webapp-BDi9q3-a.d.mts +42 -0
  85. package/dist/webapp-YvmwFYUQ.d.ts +42 -0
  86. package/package.json +165 -0
@@ -0,0 +1,23 @@
1
+ var TelegramKit=(function(exports){'use strict';var Ge=Object.defineProperty;var ve=Object.getOwnPropertySymbols;var ze=Object.prototype.hasOwnProperty,Je=Object.prototype.propertyIsEnumerable;var je=(r,e,t)=>e in r?Ge(r,e,{enumerable:true,configurable:true,writable:true,value:t}):r[e]=t,T=(r,e)=>{for(var t in e||(e={}))ze.call(e,t)&&je(r,t,e[t]);if(ve)for(var t of ve(e))Je.call(e,t)&&je(r,t,e[t]);return r};var Ze=(r,e)=>{var t={};for(var i in r)ze.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&ve)for(var i of ve(r))e.indexOf(i)<0&&Je.call(r,i)&&(t[i]=r[i]);return t};var Qt=(r,e)=>{for(var t in e)Ge(r,t,{get:e[t],enumerable:true});};var Ee={};Qt(Ee,{Accelerometer:()=>ae,BackButton:()=>K,BiometricManager:()=>Z,BottomButton:()=>q,ClipboardManager:()=>ee,CloudStorage:()=>G,ContactManager:()=>te,DebugBottomBar:()=>Q,DeviceOrientation:()=>ce,DeviceStorage:()=>z,DownloadFileManager:()=>ie,EmojiStatusManager:()=>ne,Gyroscope:()=>le,HapticFeedback:()=>j,HomeScreenManager:()=>re,InvoiceManager:()=>Y,LinkManager:()=>se,LocationManager:()=>X,PopupManager:()=>D,SDK_NAME:()=>ot,ScanQrManager:()=>$,SecureStorage:()=>J,SettingsButton:()=>N,SharingManager:()=>oe,TelegramWebView:()=>W,ThemeManager:()=>F,Utils:()=>O,ViewportManager:()=>U,WebApp:()=>de,WebAppError:()=>he,WebAppErrorName:()=>w,WebAppKernel:()=>H,bootstrapTelegramWebApp:()=>ue,isBootstrapped:()=>Ae});function L(r){try{return r=r.replace(/\+/g,"%20"),decodeURIComponent(r)}catch(e){return r}}function R(r){let e={};if(!r.length)return e;let t=r.split("&");for(let i=0;i<t.length;i++){let o=t[i].split("="),n=L(o[0]),s=o[1]==null?null:L(o[1]);e[n]=s;}return e}function xe(r){r=r.replace(/^#/,"");let e={};if(!r.length)return e;if(r.indexOf("=")<0&&r.indexOf("?")<0)return e._path=L(r),e;let t=r.indexOf("?");if(t>=0){let o=r.substr(0,t);e._path=L(o),r=r.substr(t+1);}let i=R(r);for(let o in i)e[o]=i[o];return e}function Xe(r,e){let t=r.indexOf("#");if(t<0)return r+"#"+e;let i=r.substr(t+1);return i.indexOf("=")>=0||i.indexOf("?")>=0?r+"&"+e:i.length>0?r+"?"+e:r+e}var Ye="__telegram__";function E(r,e){try{return window.sessionStorage.setItem(Ye+r,JSON.stringify(e)),!0}catch(t){}return false}function I(r){try{let e=window.sessionStorage.getItem(Ye+r);return JSON.parse(e)}catch(e){}return null}function _(r){return String(r).replace(/^\s+|\s+$/g,"")}function we(r){if(typeof window!="undefined"&&window.Blob)try{return new Blob([r]).size}catch(t){}let e=r.length;for(let t=r.length-1;t>=0;t--){let i=r.charCodeAt(t);i>127&&i<=2047?e++:i>2047&&i<=65535&&(e+=2),i>=56320&&i<=57343&&t--;}return e}function et(r,e){let t=(typeof r=="string"?r:"").replace(/^\s+|\s+$/g,"").split("."),i=(typeof e=="string"?e:"").replace(/^\s+|\s+$/g,"").split("."),o=Math.max(t.length,i.length);for(let n=0;n<o;n++){let s=parseInt(t[n])||0,a=parseInt(i[n])||0;if(s!=a)return s>a?1:-1}return 0}function V(r){let e=String(r),t;if(t=/^\s*#([0-9a-f]{6})\s*$/i.exec(e))return "#"+t[1].toLowerCase();if(t=/^\s*#([0-9a-f])([0-9a-f])([0-9a-f])\s*$/i.exec(e))return ("#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]).toLowerCase();if(t=/^\s*rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+\.{0,1}\d*))?\)\s*$/.exec(e)){let i=parseInt(t[1]),o=parseInt(t[2]),n=parseInt(t[3]),s=(i<16?"0":"")+i.toString(16),a=(o<16?"0":"")+o.toString(16),u=(n<16?"0":"")+n.toString(16);return "#"+s+a+u}return false}function tt(r){let e=r.replace(/[\s#]/g,"");e.length==3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);let t=parseInt(e.substr(0,2),16),i=parseInt(e.substr(2,2),16),o=parseInt(e.substr(4,2),16);return Math.sqrt(.299*(t*t)+.587*(i*i)+.114*(o*o))<120}function rt(r,e){let t=100,i="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",o=i.length;for(;--t;){let n="";for(let s=0;s<r;s++)n+=i[Math.floor(Math.random()*o)];if(!e(n))return n}throw new Error("WebAppCallbackIdGenerateFailed")}var W=class{constructor(){this.eventHandlers={};this.handleParentMessage=e=>{if(e.source!==window.parent)return;let t;try{t=JSON.parse(e.data);}catch(i){return}if(!(!t||!t.eventType))if(t.eventType=="set_custom_style")e.origin==="https://web.telegram.org"&&this.iFrameStyleEl&&(this.iFrameStyleEl.innerHTML=t.eventData);else if(t.eventType=="reload_iframe"){try{window.parent.postMessage(JSON.stringify({eventType:"iframe_will_reload"}),"*");}catch(i){}location.reload();}else this.receiveEvent(t.eventType,t.eventData);};this.receiveEvent=(e,t)=>{console.log("[@core-ease/telegram-kit:webview] < receiveEvent",e,t),this.callEventCallbacks(e,i=>i(e,t));};let e="";try{e=location.hash.toString();}catch(n){}let t=xe(e),i=I("initParams");if(i)for(let n in i)typeof t[n]=="undefined"&&(t[n]=i[n]);E("initParams",t),this.initParams=t;let o=false;try{if(o=window.parent!=null&&window!==window.parent,o){window.addEventListener("message",this.handleParentMessage),this.iFrameStyleEl=document.createElement("style"),document.head.appendChild(this.iFrameStyleEl);try{window.parent.postMessage(JSON.stringify({eventType:"iframe_ready",eventData:{reload_supported:!0}}),"*");}catch(n){}}}catch(n){}this.isIframe=o,window.TelegramGameProxy_receiveEvent=this.receiveEvent,window.TelegramGameProxy={receiveEvent:this.receiveEvent};}postEvent(e,t,i=""){let o=t||(()=>{});if(console.log("[@core-ease/telegram-kit:webview] > postEvent",e,i),window.TelegramWebviewProxy!==void 0)window.TelegramWebviewProxy.postEvent(e,JSON.stringify(i)),o();else if(window.external&&"notify"in window.external)window.external.notify(JSON.stringify({eventType:e,eventData:i})),o();else if(this.isIframe)try{window.parent.postMessage(JSON.stringify({eventType:e,eventData:i}),"*"),o();}catch(n){o(n);}else o({notAvailable:true});}callEventCallbacks(e,t){let i=this.eventHandlers[e];if(!(!i||!i.length))for(let o=0;o<i.length;o++)try{t(i[o]);}catch(n){}}onEvent(e,t){this.eventHandlers[e]===void 0&&(this.eventHandlers[e]=[]),this.eventHandlers[e].indexOf(t)===-1&&this.eventHandlers[e].push(t);}offEvent(e,t){let i=this.eventHandlers[e];if(i===void 0)return;let o=i.indexOf(t);o!==-1&&i.splice(o,1);}};var O={urlSafeDecode:L,urlParseQueryString:R,urlParseHashParams:xe,urlAppendHashParams:Xe,sessionStorageSet:E,sessionStorageGet:I};var w=(f=>(f.MethodUnsupported="WebAppMethodUnsupported",f.DataInvalid="WebAppDataInvalid",f.InlineModeDisabled="WebAppInlineModeDisabled",f.InlineQueryInvalid="WebAppInlineQueryInvalid",f.InlineChooseChatTypesInvalid="WebAppInlineChooseChatTypesInvalid",f.InlineChooseChatTypeInvalid="WebAppInlineChooseChatTypeInvalid",f.TgUrlInvalid="WebAppTgUrlInvalid",f.InvoiceUrlInvalid="WebAppInvoiceUrlInvalid",f.InvoiceOpened="WebAppInvoiceOpened",f.PopupOpened="WebAppPopupOpened",f.PopupParamInvalid="WebAppPopupParamInvalid",f.ScanQrPopupOpened="WebAppScanQrPopupOpened",f.ScanQrPopupParamInvalid="WebAppScanQrPopupParamInvalid",f.WriteAccessRequested="WebAppWriteAccessRequested",f.ContactRequested="WebAppContactRequested",f.DownloadFilePopupOpened="WebAppDownloadFilePopupOpened",f.DownloadFileParamInvalid="WebAppDownloadFileParamInvalid",f.MediaUrlInvalid="WebAppMediaUrlInvalid",f.ShareToStoryParamInvalid="WebAppShareToStoryParamInvalid",f.ShareMessageOpened="WebAppShareMessageOpened",f.RequestChatOpened="WebAppRequestChatOpened",f.EmojiStatusRequested="WebAppEmojiStatusRequested",f.EmojiStatusAccessRequested="WebAppEmojiStatusAccessRequested",f.HeaderColorInvalid="WebAppHeaderColorInvalid",f.HeaderColorKeyInvalid="WebAppHeaderColorKeyInvalid",f.BackgroundColorInvalid="WebAppBackgroundColorInvalid",f.BottomBarColorInvalid="WebAppBottomBarColorInvalid",f.BottomButtonParamInvalid="WebAppBottomButtonParamInvalid",f.HapticImpactStyleInvalid="WebAppHapticImpactStyleInvalid",f.HapticNotificationTypeInvalid="WebAppHapticNotificationTypeInvalid",f.HapticFeedbackTypeInvalid="WebAppHapticFeedbackTypeInvalid",f.BiometricManagerNotInited="WebAppBiometricManagerNotInited",f.BiometricManagerBiometricsNotAvailable="WebAppBiometricManagerBiometricsNotAvailable",f.BiometricManagerAccessRequested="WebAppBiometricManagerAccessRequested",f.BiometricManagerBiometricAccessNotGranted="WebAppBiometricManagerBiometricAccessNotGranted",f.BiometricManagerAuthenticationRequested="WebAppBiometricManagerAuthenticationRequested",f.BiometricManagerTokenInvalid="WebAppBiometricManagerTokenInvalid",f.BiometricManagerTokenUpdateRequested="WebAppBiometricManagerTokenUpdateRequested",f.BiometricManagerBiometricsAccessNotRequested="WebAppBiometricManagerBiometricsAccessNotRequested",f.BiometricRequestAccessParamInvalid="WebAppBiometricRequestAccessParamInvalid",f.LocationManagerNotInited="WebAppLocationManagerNotInited",f.LocationManagerLocationNotAvailable="WebAppLocationManagerLocationNotAvailable",f.LocationManagerLocationAccessNotRequested="WebAppLocationManagerLocationAccessNotRequested",f.CallbackIdGenerateFailed="WebAppCallbackIdGenerateFailed",f))(w||{}),he=class r extends Error{constructor(e){super(e),this.name=e,this.message=e,Object.setPrototypeOf(this,r.prototype);}};function l(r){throw new he(r)}var H=class{constructor(e){this._version="6.0";this.callbacks={};this.bottomBarHeightPx=0;this.onCustomMethodInvoked=(e,t)=>{var i;if(t.req_id&&this.hasCallback(t.req_id)){let o=this.takeCallback(t.req_id),n=null,s=null;typeof t.result!="undefined"&&(n=t.result),typeof t.error!="undefined"&&(s=t.error),(i=o==null?void 0:o.callback)==null||i.call(o,s,n);}};this.webView=e,this.initParams=e.initParams,this.initParams.tgWebAppVersion&&(this._version=this.initParams.tgWebAppVersion);}get version(){return this._version}set version(e){this._version=e;}versionAtLeast(e){return et(this._version,e)>=0}requireVersion(e,t){this.versionAtLeast(e)||(console.error(`[@core-ease/telegram-kit] Method ${t} is not supported in version ${this._version}`),l("WebAppMethodUnsupported"));}warnIfUnsupported(e,t){return this.versionAtLeast(e)?true:(console.warn(`[@core-ease/telegram-kit] ${t} is not supported in version ${this._version}`),false)}setCssProperty(e,t){let i=document.documentElement;i&&i.style&&i.style.setProperty&&i.style.setProperty("--tg-"+e,t);}strTrim(e){return _(e)}byteLength(e){return we(e)}receiveWebViewEvent(e,...t){this.webView.callEventCallbacks("webview:"+e,i=>{i.apply(null,t);});}onWebViewEvent(e,t){this.webView.onEvent("webview:"+e,t);}offWebViewEvent(e,t){this.webView.offEvent("webview:"+e,t);}registerCallback(e,t=16){let i=rt(t,o=>!!this.callbacks[o]);return this.callbacks[i]={callback:e},i}takeCallback(e){let t=this.callbacks[e];return t&&delete this.callbacks[e],t}hasCallback(e){return !!this.callbacks[e]}invokeCustomMethod(e,t,i){this.requireVersion("6.9","invokeCustomMethod");let o=this.registerCallback(i);this.webView.postEvent("web_app_invoke_custom_method",void 0,{req_id:o,method:e,params:t||{}});}};var F=class{constructor(e){this.kernel=e;this.themeParams={};this._colorScheme="light";this.backgroundColorValue="bg_color";this.appBackgroundColor=null;this.headerColorKey="bg_color";this.headerColorValue=null;this.appHeaderColorKey=null;this.appHeaderColorValue=null;this.bottomBarColorValue="bottom_bar_bg_color";this.appBottomBarColor=null;this.onBottomBarColorApplied=null;let t=I("themeParams"),i=e.initParams.tgWebAppThemeParams;if(i&&i.length)try{let s=JSON.parse(i);s&&this.setThemeParams(s);}catch(s){}t&&this.setThemeParams(t);let o=I("defaultColors"),n=e.initParams.tgWebAppDefaultColors;if(n&&n.length)try{let s=JSON.parse(n);s&&this.setDefaultColors(s);}catch(s){}o&&this.setDefaultColors(o);}get colorScheme(){return this._colorScheme}getThemeParams(){return this.themeParams}setThemeParams(e){e.bg_color=="#1c1c1d"&&e.bg_color==e.secondary_bg_color&&(e.secondary_bg_color="#2c2c2e");for(let t in e){let i=V(e[t]);if(i){this.themeParams[t]=i,t=="bg_color"&&(this._colorScheme=tt(i)?"dark":"light",this.kernel.setCssProperty("color-scheme",this._colorScheme));let o="theme-"+t.split("_").join("-");this.kernel.setCssProperty(o,i);}}E("themeParams",this.themeParams);}setDefaultColors(e){this._colorScheme=="dark"?(e.bg_dark_color&&(this.backgroundColorValue=e.bg_dark_color),e.header_dark_color&&(this.headerColorKey=null,this.headerColorValue=e.header_dark_color)):(e.bg_color&&(this.backgroundColorValue=e.bg_color),e.header_color&&(this.headerColorKey=null,this.headerColorValue=e.header_color)),E("defaultColors",e);}getHeaderColor(){return this.headerColorKey=="secondary_bg_color"?this.themeParams.secondary_bg_color:this.headerColorKey=="bg_color"?this.themeParams.bg_color:this.headerColorValue}setHeaderColor(e){if(!this.kernel.warnIfUnsupported("6.1","Header color"))return;this.kernel.versionAtLeast("6.9")||(this.themeParams.bg_color&&this.themeParams.bg_color==e?e="bg_color":this.themeParams.secondary_bg_color&&this.themeParams.secondary_bg_color==e&&(e="secondary_bg_color"));let t=null,i=null;e=="bg_color"||e=="secondary_bg_color"?i=e:this.kernel.versionAtLeast("6.9")&&(t=V(e),t||(console.error("[@core-ease/telegram-kit] Header color format is invalid",e),l("WebAppHeaderColorInvalid"))),!this.kernel.versionAtLeast("6.9")&&i!="bg_color"&&i!="secondary_bg_color"&&(console.error("[@core-ease/telegram-kit] Header color key should be one of Telegram.WebApp.themeParams.bg_color, Telegram.WebApp.themeParams.secondary_bg_color, 'bg_color', 'secondary_bg_color'",e),l("WebAppHeaderColorKeyInvalid")),this.headerColorKey=i,this.headerColorValue=t||null,this.updateHeaderColor();}updateHeaderColor(){(this.appHeaderColorKey!=this.headerColorKey||this.appHeaderColorValue!=this.headerColorValue)&&(this.appHeaderColorKey=this.headerColorKey,this.appHeaderColorValue=this.headerColorValue,this.appHeaderColorValue?this.kernel.webView.postEvent("web_app_set_header_color",void 0,{color:this.appHeaderColorValue}):this.kernel.webView.postEvent("web_app_set_header_color",void 0,{color_key:this.appHeaderColorKey}));}getBackgroundColor(){return this.backgroundColorValue=="secondary_bg_color"?this.themeParams.secondary_bg_color:this.backgroundColorValue=="bg_color"?this.themeParams.bg_color:this.backgroundColorValue}setBackgroundColor(e){if(!this.kernel.warnIfUnsupported("6.1","Background color"))return;let t;if(e=="bg_color"||e=="secondary_bg_color")t=e;else {let i=V(e);i||(console.error("[@core-ease/telegram-kit] Background color format is invalid",e),l("WebAppBackgroundColorInvalid")),t=i;}this.backgroundColorValue=t,this.updateBackgroundColor();}updateBackgroundColor(){let e=this.getBackgroundColor();this.appBackgroundColor!=e&&(this.appBackgroundColor=e!=null?e:null,this.kernel.webView.postEvent("web_app_set_background_color",void 0,{color:e}));}getBottomBarColor(){return this.bottomBarColorValue=="bottom_bar_bg_color"?this.themeParams.bottom_bar_bg_color||this.themeParams.secondary_bg_color||"#ffffff":this.bottomBarColorValue=="secondary_bg_color"?this.themeParams.secondary_bg_color:this.bottomBarColorValue=="bg_color"?this.themeParams.bg_color:this.bottomBarColorValue}setBottomBarColor(e){if(!this.kernel.warnIfUnsupported("7.10","Bottom bar color"))return;let t;if(e=="bg_color"||e=="secondary_bg_color"||e=="bottom_bar_bg_color")t=e;else {let i=V(e);i||(console.error("[@core-ease/telegram-kit] Bottom bar color format is invalid",e),l("WebAppBottomBarColorInvalid")),t=i;}this.bottomBarColorValue=t,this.updateBottomBarColor();}updateBottomBarColor(){var t;let e=this.getBottomBarColor();this.appBottomBarColor!=e&&(this.appBottomBarColor=e,this.kernel.webView.postEvent("web_app_set_bottom_bar_color",void 0,{color:e})),(t=this.onBottomBarColorApplied)==null||t.call(this);}};var U=class{constructor(e){this.kernel=e;this.viewportHeightPx=false;this.viewportStableHeightPx=false;this._isExpanded=true;this._safeAreaInset={top:0,bottom:0,left:0,right:0};this._contentSafeAreaInset={top:0,bottom:0,left:0,right:0};this._isFullscreen=false;this._isOrientationLocked=false;this._isClosingConfirmationEnabled=false;this._isVerticalSwipesEnabled=true;this.lastWindowHeight=typeof window!="undefined"?window.innerHeight:0;this.handleViewportChanged=(e,t)=>{t.height&&(window.removeEventListener("resize",this.onWindowResize),this.setViewportHeight(t));};this.handleSafeAreaChanged=(e,t)=>{t&&this.setSafeAreaInset(t);};this.handleContentSafeAreaChanged=(e,t)=>{t&&this.setContentSafeAreaInset(t);};this.handleFullscreenChanged=(e,t)=>{this.setFullscreen(t.is_fullscreen),this.kernel.receiveWebViewEvent("fullscreenChanged");};this.handleFullscreenFailed=(e,t)=>{t.error=="ALREADY_FULLSCREEN"&&!this._isFullscreen&&this.setFullscreen(true),this.kernel.receiveWebViewEvent("fullscreenFailed",{error:t.error});};e.initParams.tgWebAppFullscreen&&this.setFullscreen(true);let t=I("isFullscreen");t&&this.setFullscreen(t=="yes");let i=I("isOrientationLocked");i&&this.setOrientationLock(i=="yes"),this.onWindowResize=this.onWindowResize.bind(this);}get isExpanded(){return this._isExpanded}get viewportHeight(){return (this.viewportHeightPx===false?window.innerHeight:this.viewportHeightPx)-this.kernel.bottomBarHeightPx}get viewportStableHeight(){return (this.viewportStableHeightPx===false?window.innerHeight:this.viewportStableHeightPx)-this.kernel.bottomBarHeightPx}get safeAreaInset(){return this._safeAreaInset}get contentSafeAreaInset(){return this._contentSafeAreaInset}get isFullscreen(){return this._isFullscreen}get isOrientationLocked(){return this._isOrientationLocked}get isClosingConfirmationEnabled(){return this._isClosingConfirmationEnabled}get isVerticalSwipesEnabled(){return this._isVerticalSwipesEnabled}setViewportHeight(e){let t=false;typeof e!="undefined"&&(this._isExpanded=!!e.is_expanded,this.viewportHeightPx=e.height,e.is_state_stable&&(this.viewportStableHeightPx=e.height),t=true);let i=this.kernel.bottomBarHeightPx,o=this.viewportHeightPx!==false?this.viewportHeightPx-i+"px":i?`calc(100vh - ${i}px)`:"100vh",n=this.viewportStableHeightPx!==false?this.viewportStableHeightPx-i+"px":i?`calc(100vh - ${i}px)`:"100vh";this.kernel.setCssProperty("viewport-height",o),this.kernel.setCssProperty("viewport-stable-height",n),t&&this.kernel.receiveWebViewEvent("viewportChanged",{isStateStable:!!e.is_state_stable});}onWindowResize(){this.lastWindowHeight!=window.innerHeight&&(this.lastWindowHeight=window.innerHeight,this.kernel.receiveWebViewEvent("viewportChanged",{isStateStable:true}));}setSafeAreaInset(e){typeof e!="undefined"&&(typeof e.top!="undefined"&&(this._safeAreaInset.top=e.top),typeof e.bottom!="undefined"&&(this._safeAreaInset.bottom=e.bottom),typeof e.left!="undefined"&&(this._safeAreaInset.left=e.left),typeof e.right!="undefined"&&(this._safeAreaInset.right=e.right),this.kernel.receiveWebViewEvent("safeAreaChanged")),this.kernel.setCssProperty("safe-area-inset-top",this._safeAreaInset.top+"px"),this.kernel.setCssProperty("safe-area-inset-bottom",this._safeAreaInset.bottom+"px"),this.kernel.setCssProperty("safe-area-inset-left",this._safeAreaInset.left+"px"),this.kernel.setCssProperty("safe-area-inset-right",this._safeAreaInset.right+"px");}setContentSafeAreaInset(e){typeof e!="undefined"&&(typeof e.top!="undefined"&&(this._contentSafeAreaInset.top=e.top),typeof e.bottom!="undefined"&&(this._contentSafeAreaInset.bottom=e.bottom),typeof e.left!="undefined"&&(this._contentSafeAreaInset.left=e.left),typeof e.right!="undefined"&&(this._contentSafeAreaInset.right=e.right),this.kernel.receiveWebViewEvent("contentSafeAreaChanged")),this.kernel.setCssProperty("content-safe-area-inset-top",this._contentSafeAreaInset.top+"px"),this.kernel.setCssProperty("content-safe-area-inset-bottom",this._contentSafeAreaInset.bottom+"px"),this.kernel.setCssProperty("content-safe-area-inset-left",this._contentSafeAreaInset.left+"px"),this.kernel.setCssProperty("content-safe-area-inset-right",this._contentSafeAreaInset.right+"px");}setClosingConfirmation(e){this.kernel.warnIfUnsupported("6.2","Closing confirmation")&&(this._isClosingConfirmationEnabled=!!e,this.kernel.webView.postEvent("web_app_setup_closing_behavior",void 0,{need_confirmation:this._isClosingConfirmationEnabled}));}toggleVerticalSwipes(e){this.kernel.warnIfUnsupported("7.7","Changing swipes behavior")&&(this._isVerticalSwipesEnabled=!!e,this.kernel.webView.postEvent("web_app_setup_swipe_behavior",void 0,{allow_vertical_swipe:this._isVerticalSwipesEnabled}));}setFullscreen(e){this._isFullscreen=!!e,E("isFullscreen",this._isFullscreen?"yes":"no");}requestFullscreen(){this.kernel.requireVersion("8.0","requestFullscreen"),this.kernel.webView.postEvent("web_app_request_fullscreen");}exitFullscreen(){this.kernel.requireVersion("8.0","exitFullscreen"),this.kernel.webView.postEvent("web_app_exit_fullscreen");}setOrientationLock(e){this._isOrientationLocked=!!e,E("isOrientationLocked",this._isOrientationLocked?"yes":"no");}toggleOrientationLock(e){this.kernel.warnIfUnsupported("8.0","Orientation locking")&&(this.setOrientationLock(e),this.kernel.webView.postEvent("web_app_toggle_orientation_lock",void 0,{locked:this._isOrientationLocked}));}};var K=class{constructor(e){this.kernel=e;this._isVisible=false;this.curButtonState=null;this.handleBackButtonPressed=()=>{this.kernel.receiveWebViewEvent("backButtonClicked");};e.webView.onEvent("back_button_pressed",this.handleBackButtonPressed);}get isVisible(){return this._isVisible}set isVisible(e){this.setParams({is_visible:e});}checkVersion(){return this.kernel.warnIfUnsupported("6.1","BackButton")}buttonParams(){return {is_visible:this._isVisible}}updateButton(){let e=this.buttonParams(),t=JSON.stringify(e);this.curButtonState!==t&&(this.curButtonState=t,this.kernel.webView.postEvent("web_app_setup_back_button",void 0,e));}setParams(e){return this.checkVersion()?(typeof e.is_visible!="undefined"&&(this._isVisible=!!e.is_visible),this.updateButton(),this):this}onClick(e){return this.checkVersion()&&this.kernel.onWebViewEvent("backButtonClicked",e),this}offClick(e){return this.checkVersion()&&this.kernel.offWebViewEvent("backButtonClicked",e),this}show(){return this.setParams({is_visible:true})}hide(){return this.setParams({is_visible:false})}};var q=class{constructor(e,t,i,o){this.kernel=t;this.theme=i;this.debugBar=o;this.isVisibleValue=false;this.isActiveValue=true;this.hasShineEffectValue=false;this.isProgressVisibleValue=false;this.iconCustomEmojiIdValue=false;this.colorValue=false;this.textColorValue=false;this.positionValue="left";this.curButtonState=null;this.handlePressed=()=>{this.isActiveValue&&this.kernel.receiveWebViewEvent(this.webViewEventName);};this.type=e,this.isMain=e==="main",this.isMain?(this.setupEventName="web_app_setup_main_button",this.nativePressEventName="main_button_pressed",this.webViewEventName="mainButtonClicked",this.defaultText="Continue",this.defaultColor=()=>i.getThemeParams().button_color||"#2481cc",this.defaultTextColor=()=>i.getThemeParams().button_text_color||"#ffffff"):(this.setupEventName="web_app_setup_secondary_button",this.nativePressEventName="secondary_button_pressed",this.webViewEventName="secondaryButtonClicked",this.defaultText="Cancel",this.defaultColor=()=>i.getBottomBarColor(),this.defaultTextColor=()=>i.getThemeParams().button_color||"#2481cc"),this.textValue=this.defaultText,t.webView.onEvent(this.nativePressEventName,this.handlePressed),o.registerButton(e,this.handlePressed);}get iconCustomEmojiId(){return this.iconCustomEmojiIdValue}set iconCustomEmojiId(e){this.setParams({icon_custom_emoji_id:e});}get text(){return this.textValue}set text(e){this.setParams({text:e});}get color(){return this.colorValue||this.defaultColor()}set color(e){this.setParams({color:e});}get textColor(){return this.textColorValue||this.defaultTextColor()}set textColor(e){this.setParams({text_color:e});}get isVisible(){return this.isVisibleValue}set isVisible(e){this.setParams({is_visible:e});}get isProgressVisible(){return this.isProgressVisibleValue}get isActive(){return this.isActiveValue}set isActive(e){this.setParams({is_active:e});}get hasShineEffect(){return this.hasShineEffectValue}set hasShineEffect(e){this.setParams({has_shine_effect:e});}get position(){return this.positionValue}set position(e){this.isMain||this.setParams({position:e});}buttonParams(){if(!this.isVisibleValue)return {is_visible:false};let e={is_visible:true,is_active:this.isActiveValue,is_progress_visible:this.isProgressVisibleValue,icon_custom_emoji_id:this.iconCustomEmojiIdValue||void 0,text:this.textValue,color:this.color,text_color:this.textColor,has_shine_effect:this.hasShineEffectValue&&this.isActiveValue&&!this.isProgressVisibleValue};return this.isMain||(e.position=this.positionValue),e}updateButton(){let e=this.buttonParams(),t=JSON.stringify(e);this.curButtonState!==t&&(this.curButtonState=t,this.kernel.webView.postEvent(this.setupEventName,void 0,e),this.debugBar.enabled&&this.debugBar.updateButtonVisual(this.type,e));}setParams(e){if(typeof e.icon_custom_emoji_id!="undefined"){let t=e.icon_custom_emoji_id;(t===false||t===null)&&(t=""),t!==""&&!/^[0-9]{10,20}$/.test(t)&&(console.error("[@core-ease/telegram-kit] Bottom button icon custom emoji is invalid",e.icon_custom_emoji_id),l("WebAppBottomButtonParamInvalid")),this.iconCustomEmojiIdValue=t||false;}if(typeof e.text!="undefined"){let t=_(e.text);!t.length&&!this.iconCustomEmojiIdValue&&(console.error("[@core-ease/telegram-kit] Bottom button text is required",e.text),l("WebAppBottomButtonParamInvalid")),t.length>64&&(console.error("[@core-ease/telegram-kit] Bottom button text is too long",t),l("WebAppBottomButtonParamInvalid")),this.textValue=t;}if(typeof e.color!="undefined")if(e.color===false||e.color===null)this.colorValue=false;else {let t=V(e.color);t||(console.error("[@core-ease/telegram-kit] Bottom button color format is invalid",e.color),l("WebAppBottomButtonParamInvalid")),this.colorValue=t;}if(typeof e.text_color!="undefined")if(e.text_color===false||e.text_color===null)this.textColorValue=false;else {let t=V(e.text_color);t||(console.error("[@core-ease/telegram-kit] Bottom button text color format is invalid",e.text_color),l("WebAppBottomButtonParamInvalid")),this.textColorValue=t;}return typeof e.is_visible!="undefined"&&(e.is_visible&&!this.textValue.length&&(console.error("[@core-ease/telegram-kit] Bottom button text is required"),l("WebAppBottomButtonParamInvalid")),this.isVisibleValue=!!e.is_visible),typeof e.has_shine_effect!="undefined"&&(this.hasShineEffectValue=!!e.has_shine_effect),!this.isMain&&typeof e.position!="undefined"&&(e.position!="left"&&e.position!="right"&&e.position!="top"&&e.position!="bottom"&&(console.error("[@core-ease/telegram-kit] Bottom button posiition is invalid",e.position),l("WebAppBottomButtonParamInvalid")),this.positionValue=e.position),typeof e.is_active!="undefined"&&(this.isActiveValue=!!e.is_active),this.updateButton(),this}setText(e){return this.setParams({text:e})}onClick(e){return this.kernel.onWebViewEvent(this.webViewEventName,e),this}offClick(e){return this.kernel.offWebViewEvent(this.webViewEventName,e),this}show(){return this.setParams({is_visible:true})}hide(){return this.setParams({is_visible:false})}enable(){return this.setParams({is_active:true})}disable(){return this.setParams({is_active:false})}showProgress(e){return this.isActiveValue=!!e,this.isProgressVisibleValue=true,this.updateButton(),this}hideProgress(){return this.isActiveValue||(this.isActiveValue=true),this.isProgressVisibleValue=false,this.updateButton(),this}};var N=class{constructor(e){this.kernel=e;this._isVisible=false;this.curButtonState=null;this.handleSettingsButtonPressed=()=>{this.kernel.receiveWebViewEvent("settingsButtonClicked");};e.webView.onEvent("settings_button_pressed",this.handleSettingsButtonPressed);}get isVisible(){return this._isVisible}set isVisible(e){this.setParams({is_visible:e});}checkVersion(){return this.kernel.warnIfUnsupported("6.10","SettingsButton")}buttonParams(){return {is_visible:this._isVisible}}updateButton(){let e=this.buttonParams(),t=JSON.stringify(e);this.curButtonState!==t&&(this.curButtonState=t,this.kernel.webView.postEvent("web_app_setup_settings_button",void 0,e));}setParams(e){return this.checkVersion()?(typeof e.is_visible!="undefined"&&(this._isVisible=!!e.is_visible),this.updateButton(),this):this}onClick(e){return this.checkVersion()&&this.kernel.onWebViewEvent("settingsButtonClicked",e),this}offClick(e){return this.checkVersion()&&this.kernel.offWebViewEvent("settingsButtonClicked",e),this}show(){return this.setParams({is_visible:true})}hide(){return this.setParams({is_visible:false})}};var Dt='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewport="0 0 48 48" width="48px" height="48px"><circle cx="50%" cy="50%" stroke="{COLOR}" stroke-width="2.25" stroke-linecap="round" fill="none" stroke-dashoffset="106" r="9" stroke-dasharray="56.52" rotate="-90"><animate attributeName="stroke-dashoffset" attributeType="XML" dur="360s" from="0" to="12500" repeatCount="indefinite"></animate><animateTransform attributeName="transform" attributeType="XML" type="rotate" dur="1s" from="-90 24 24" to="630 24 24" repeatCount="indefinite"></animateTransform></circle></svg>',Q=class{constructor(e,t){this.kernel=e;this.getBottomBarColor=t;this.container=null;this.buttons={};this.onHeightChanged=null;if(this.enabled=!!e.initParams.tgWebAppDebug,!this.enabled)return;this.container=document.createElement("tg-bottom-bar");let i={display:"flex",gap:"7px",font:"600 14px/18px sans-serif",width:"100%",background:t(),position:"fixed",left:"0",right:"0",bottom:"0",margin:"0",padding:"7px",textAlign:"center",boxSizing:"border-box",zIndex:"10000"};Object.assign(this.container.style,i),document.addEventListener("DOMContentLoaded",function s(){document.removeEventListener("DOMContentLoaded",s),document.body.appendChild(o());});let o=()=>this.container,n=document.createElement("style");n.innerHTML='tg-bottom-button.shine { position: relative; overflow: hidden; } tg-bottom-button.shine:before { content:""; position: absolute; top: 0; width: 100%; height: 100%; background: linear-gradient(120deg, transparent, rgba(255, 255, 255, .2), transparent); animation: tg-bottom-button-shine 5s ease-in-out infinite; } @-webkit-keyframes tg-bottom-button-shine { 0% {left: -100%;} 12%,100% {left: 100%}} @keyframes tg-bottom-button-shine { 0% {left: -100%;} 12%,100% {left: 100%}}',this.container.appendChild(n);}registerButton(e,t){if(!this.enabled||!this.container)return null;let i=document.createElement("tg-bottom-button"),o={display:"none",width:"100%",height:"44px",borderRadius:"0",background:"no-repeat right center",padding:"13px 15px",textAlign:"center",boxSizing:"border-box"};return Object.assign(i.style,o),this.container.appendChild(i),i.addEventListener("click",t,false),this.buttons[e]={el:i,isVisible:false,position:"left"},i}updateButtonVisual(e,t){let i=this.buttons[e];if(!i)return;let o=i.el;i.isVisible=!!t.is_visible,i.position=t.position||"left",t.is_visible?(o.style.display="block",o.style.opacity=t.is_active?"1":"0.8",o.style.cursor=t.is_active?"pointer":"auto",o.disabled=!t.is_active,o.innerText=t.text||"",o.className=t.has_shine_effect?"shine":"",o.style.backgroundImage=t.is_progress_visible?`url('data:image/svg+xml,${encodeURIComponent(Dt.replace("{COLOR}",t.text_color||"#ffffff"))}')`:"none",o.style.backgroundColor=t.color||"",o.style.color=t.text_color||""):o.style.display="none",this.updateBar();}updateBar(){var o;if(!this.enabled||!this.container)return;let e=this.buttons.main,t=this.buttons.secondary,i=0;e&&e.isVisible||t&&t.isVisible?(this.container.style.display="flex",i=58,e!=null&&e.isVisible&&(t!=null&&t.isVisible)&&(t.position=="top"?(this.container.style.flexDirection="column-reverse",i+=51):t.position=="bottom"?(this.container.style.flexDirection="column",i+=51):t.position=="left"?this.container.style.flexDirection="row-reverse":t.position=="right"&&(this.container.style.flexDirection="row"))):(this.container.style.display="none",i=0),this.kernel.bottomBarHeightPx=i,this.container.style.background=this.getBottomBarColor(),document.documentElement&&(document.documentElement.style.boxSizing="border-box",document.documentElement.style.paddingBottom=i+"px"),(o=this.onHeightChanged)==null||o.call(this);}refreshColor(){!this.enabled||!this.container||this.updateBar();}};var D=class{constructor(e){this.kernel=e;this.pending=false;this.handlePopupClosed=(e,t)=>{var i;if(this.pending){let o=this.pending;this.pending=false;let n=typeof t.button_id!="undefined"?t.button_id:null;(i=o.callback)==null||i.call(o,n),this.kernel.receiveWebViewEvent("popupClosed",{button_id:n});}};e.webView.onEvent("popup_closed",this.handlePopupClosed);}showPopup(e,t){this.kernel.requireVersion("6.2","showPopup"),this.pending&&(console.error("[@core-ease/telegram-kit] Popup is already opened"),l("WebAppPopupOpened"));let i={message:""};if(typeof e.title!="undefined"){let s=_(e.title);s.length>64&&(console.error("[@core-ease/telegram-kit] Popup title is too long",s),l("WebAppPopupParamInvalid")),s.length>0&&(i.title=s);}let o="";typeof e.message!="undefined"&&(o=_(e.message)),o.length||(console.error("[@core-ease/telegram-kit] Popup message is required",e.message),l("WebAppPopupParamInvalid")),o.length>256&&(console.error("[@core-ease/telegram-kit] Popup message is too long",o),l("WebAppPopupParamInvalid")),i.message=o;let n=[];if(typeof e.buttons!="undefined"){Array.isArray(e.buttons)||(console.error("[@core-ease/telegram-kit] Popup buttons should be an array",e.buttons),l("WebAppPopupParamInvalid"));for(let s of e.buttons){let a={},u="";typeof s.id!="undefined"&&(u=String(s.id),u.length>64&&(console.error("[@core-ease/telegram-kit] Popup button id is too long",u),l("WebAppPopupParamInvalid"))),a.id=u;let d=s.type||"default";if(a.type=d,!(d=="ok"||d=="close"||d=="cancel"))if(d=="default"||d=="destructive"){let p="";typeof s.text!="undefined"&&(p=_(s.text)),p.length||(console.error(`[@core-ease/telegram-kit] Popup button text is required for type ${d}`,s.text),l("WebAppPopupParamInvalid")),p.length>64&&(console.error("[@core-ease/telegram-kit] Popup button text is too long",p),l("WebAppPopupParamInvalid")),a.text=p;}else console.error("[@core-ease/telegram-kit] Popup button type is invalid",d),l("WebAppPopupParamInvalid");n.push(a);}}else n.push({id:"",type:"close"});n.length<1&&(console.error("[@core-ease/telegram-kit] Popup should have at least one button"),l("WebAppPopupParamInvalid")),n.length>3&&(console.error("[@core-ease/telegram-kit] Popup should not have more than 3 buttons"),l("WebAppPopupParamInvalid")),i.buttons=n,this.pending={callback:t},this.kernel.webView.postEvent("web_app_open_popup",void 0,i);}showAlert(e,t){this.showPopup({message:e},t?()=>t():void 0);}showConfirm(e,t){this.showPopup({message:e,buttons:[{type:"ok",id:"ok"},{type:"cancel"}]},t?i=>t(i=="ok"):void 0);}};var $=class{constructor(e){this.kernel=e;this.pending=false;this.handleQrTextReceived=(e,t)=>{if(this.pending){let i=this.pending,o=typeof t.data!="undefined"?t.data:null;i.callback&&i.callback(o)&&(this.pending=false,this.kernel.webView.postEvent("web_app_close_scan_qr_popup",void 0)),this.kernel.receiveWebViewEvent("qrTextReceived",{data:o});}};this.handleScanQrPopupClosed=()=>{this.pending=false,this.kernel.receiveWebViewEvent("scanQrPopupClosed");};e.webView.onEvent("qr_text_received",this.handleQrTextReceived),e.webView.onEvent("scan_qr_popup_closed",this.handleScanQrPopupClosed);}showScanQrPopup(e,t){this.kernel.requireVersion("6.4","showScanQrPopup"),this.pending&&(console.error("[@core-ease/telegram-kit] Popup is already opened"),l("WebAppScanQrPopupOpened"));let i={};if(typeof e.text!="undefined"){let o=_(e.text);o.length>64&&(console.error("[@core-ease/telegram-kit] Scan QR popup text is too long",o),l("WebAppScanQrPopupParamInvalid")),o.length>0&&(i.text=o);}this.pending={callback:t},this.kernel.webView.postEvent("web_app_open_scan_qr_popup",void 0,i);}closeScanQrPopup(){this.kernel.requireVersion("6.4","closeScanQrPopup"),this.pending=false,this.kernel.webView.postEvent("web_app_close_scan_qr_popup",void 0);}};var j=class{constructor(e){this.kernel=e;}trigger(e){return this.kernel.warnIfUnsupported("6.1","HapticFeedback")?(e.type=="impact"?e.impact_style!="light"&&e.impact_style!="medium"&&e.impact_style!="heavy"&&e.impact_style!="rigid"&&e.impact_style!="soft"&&(console.error("[@core-ease/telegram-kit] Haptic impact style is invalid",e.impact_style),l("WebAppHapticImpactStyleInvalid")):e.type=="notification"?e.notification_type!="error"&&e.notification_type!="success"&&e.notification_type!="warning"&&(console.error("[@core-ease/telegram-kit] Haptic notification type is invalid",e.notification_type),l("WebAppHapticNotificationTypeInvalid")):e.type=="selection_change"||(console.error("[@core-ease/telegram-kit] Haptic feedback type is invalid",e.type),l("WebAppHapticFeedbackTypeInvalid")),this.kernel.webView.postEvent("web_app_trigger_haptic_feedback",void 0,e),this):this}impactOccurred(e){return this.trigger({type:"impact",impact_style:e})}notificationOccurred(e){return this.trigger({type:"notification",notification_type:e})}selectionChanged(){return this.trigger({type:"selection_change"})}};var G=class{constructor(e){this.kernel=e;}invoke(e,t,i){return this.kernel.requireVersion("6.9","CloudStorage"),this.kernel.invokeCustomMethod(e,t,i),this}setItem(e,t,i){return this.invoke("saveStorageValue",{key:e,value:t},i)}getItem(e,t){return this.getItems([e],t?(i,o)=>i?t(i):t(null,o==null?void 0:o[e]):void 0)}getItems(e,t){return this.invoke("getStorageValues",{keys:e},t)}removeItem(e,t){return this.removeItems([e],t)}removeItems(e,t){return this.invoke("deleteStorageValues",{keys:e},t)}getKeys(e){return this.invoke("getStorageKeys",{},e)}};var z=class{constructor(e){this.kernel=e;this.handleEvent=(e,t)=>{var s;if(!t.req_id||!this.kernel.hasCallback(t.req_id))return;let i=this.kernel.takeCallback(t.req_id),o=null,n=null;e=="device_storage_failed"?n=t.error||"UNKNOWN_ERROR":e=="device_storage_key_received"?o=t.value:o=true,(s=i==null?void 0:i.callback)==null||s.call(i,n,o);};e.webView.onEvent("device_storage_key_saved",this.handleEvent),e.webView.onEvent("device_storage_key_received",this.handleEvent),e.webView.onEvent("device_storage_cleared",this.handleEvent),e.webView.onEvent("device_storage_failed",this.handleEvent);}invoke(e,t,i){this.kernel.requireVersion("9.0","DeviceStorage");let o=this.kernel.registerCallback(i);return this.kernel.webView.postEvent(e,void 0,T({req_id:o},t)),this}setItem(e,t,i){return this.invoke("web_app_device_storage_save_key",{key:e,value:t},i)}getItem(e,t){return this.invoke("web_app_device_storage_get_key",{key:e},t)}removeItem(e,t){return this.invoke("web_app_device_storage_save_key",{key:e,value:null},t)}clear(e){return this.invoke("web_app_device_storage_clear",{},e)}};var J=class{constructor(e){this.kernel=e;this.handleEvent=(e,t)=>{var a;if(!t.req_id||!this.kernel.hasCallback(t.req_id))return;let i=this.kernel.takeCallback(t.req_id),o=null,n=null,s=null;e=="secure_storage_failed"?n=t.error||"UNKNOWN_ERROR":e=="secure_storage_key_received"?(o=t.value,t.can_restore&&(s=true)):e=="secure_storage_key_restored"?o=t.value:o=true,(a=i==null?void 0:i.callback)==null||a.call(i,n,o,s);};e.webView.onEvent("secure_storage_key_saved",this.handleEvent),e.webView.onEvent("secure_storage_key_received",this.handleEvent),e.webView.onEvent("secure_storage_key_restored",this.handleEvent),e.webView.onEvent("secure_storage_cleared",this.handleEvent),e.webView.onEvent("secure_storage_failed",this.handleEvent);}invoke(e,t,i){this.kernel.requireVersion("9.0","SecureStorage");let o=this.kernel.registerCallback(i);return this.kernel.webView.postEvent(e,void 0,T({req_id:o},t)),this}setItem(e,t,i){return this.invoke("web_app_secure_storage_save_key",{key:e,value:t},i)}getItem(e,t){return this.invoke("web_app_secure_storage_get_key",{key:e},t)}restoreItem(e,t){return this.invoke("web_app_secure_storage_restore_key",{key:e},t)}removeItem(e,t){return this.invoke("web_app_secure_storage_save_key",{key:e,value:null},t)}clear(e){return this.invoke("web_app_secure_storage_clear",{},e)}};var Z=class{constructor(e){this.kernel=e;this._isInited=false;this._isBiometricAvailable=false;this._biometricType="unknown";this._isAccessRequested=false;this._isAccessGranted=false;this._isBiometricTokenSaved=false;this._deviceId="";this.initCallbacks=[];this.accessRequestState=false;this.authRequestState=false;this.tokenRequestState=false;this.handleInfoReceived=(e,t)=>{var i;if(this._isInited=true,t.available?(this._isBiometricAvailable=true,this._biometricType=t.type||"unknown",t.access_requested?(this._isAccessRequested=true,this._isAccessGranted=!!t.access_granted,this._isBiometricTokenSaved=!!t.token_saved):(this._isAccessRequested=false,this._isAccessGranted=false,this._isBiometricTokenSaved=false)):(this._isBiometricAvailable=false,this._biometricType="unknown",this._isAccessRequested=false,this._isAccessGranted=false,this._isBiometricTokenSaved=false),this._deviceId=t.device_id||"",this.initCallbacks.length>0&&(this.initCallbacks.forEach(o=>o()),this.initCallbacks=[]),this.accessRequestState){let o=this.accessRequestState;this.accessRequestState=false,(i=o.callback)==null||i.call(o,this._isAccessGranted);}this.kernel.receiveWebViewEvent("biometricManagerUpdated");};this.handleAuthRequested=(e,t)=>{var n;let i=t.status=="authorized",o=t.token||"";if(this.authRequestState){let s=this.authRequestState;this.authRequestState=false,(n=s.callback)==null||n.call(s,i,i?o:null);}this.kernel.receiveWebViewEvent("biometricAuthRequested",i?{isAuthenticated:true,biometricToken:o}:{isAuthenticated:false});};this.handleTokenUpdated=(e,t)=>{var o;let i=false;if(this._isBiometricAvailable&&this._isAccessRequested&&(t.status=="updated"?(this._isBiometricTokenSaved=true,i=true):t.status=="removed"&&(this._isBiometricTokenSaved=false,i=true)),this.tokenRequestState){let n=this.tokenRequestState;this.tokenRequestState=false,(o=n.callback)==null||o.call(n,i);}this.kernel.receiveWebViewEvent("biometricTokenUpdated",{isUpdated:i});};e.webView.onEvent("biometry_info_received",this.handleInfoReceived),e.webView.onEvent("biometry_auth_requested",this.handleAuthRequested),e.webView.onEvent("biometry_token_updated",this.handleTokenUpdated);}get isInited(){return this._isInited}get isBiometricAvailable(){return this._isInited&&this._isBiometricAvailable}get biometricType(){return this._biometricType||"unknown"}get isAccessRequested(){return this._isAccessRequested}get isAccessGranted(){return this._isAccessRequested&&this._isAccessGranted}get isBiometricTokenSaved(){return this._isBiometricTokenSaved}get deviceId(){return this._deviceId||""}checkVersion(){return this.kernel.warnIfUnsupported("7.2","BiometricManager")}checkInit(){return this._isInited||(console.error("[@core-ease/telegram-kit] BiometricManager should be inited before using."),l("WebAppBiometricManagerNotInited")),true}init(e){return this.checkVersion()?this._isInited?this:(e&&this.initCallbacks.push(e),this.kernel.webView.postEvent("web_app_biometry_get_info"),this):this}requestAccess(e,t){if(!this.checkVersion())return this;this.checkInit(),this._isBiometricAvailable||(console.error("[@core-ease/telegram-kit] Biometrics is not available on this device."),l("WebAppBiometricManagerBiometricsNotAvailable")),this.accessRequestState&&(console.error("[@core-ease/telegram-kit] Access is already requested"),l("WebAppBiometricManagerAccessRequested"));let i={};if(typeof e.reason!="undefined"){let o=_(e.reason);o.length>128&&(console.error("[@core-ease/telegram-kit] Biometric reason is too long",o),l("WebAppBiometricRequestAccessParamInvalid")),o.length>0&&(i.reason=o);}return this.accessRequestState={callback:t},this.kernel.webView.postEvent("web_app_biometry_request_access",void 0,i),this}authenticate(e,t){if(!this.checkVersion())return this;this.checkInit(),this._isBiometricAvailable||(console.error("[@core-ease/telegram-kit] Biometrics is not available on this device."),l("WebAppBiometricManagerBiometricsNotAvailable")),this.isAccessGranted||(console.error("[@core-ease/telegram-kit] Biometric access was not granted by the user."),l("WebAppBiometricManagerBiometricAccessNotGranted")),this.authRequestState&&(console.error("[@core-ease/telegram-kit] Authentication request is already in progress."),l("WebAppBiometricManagerAuthenticationRequested"));let i={};if(typeof e.reason!="undefined"){let o=_(e.reason);o.length>128&&(console.error("[@core-ease/telegram-kit] Biometric reason is too long",o),l("WebAppBiometricRequestAccessParamInvalid")),o.length>0&&(i.reason=o);}return this.authRequestState={callback:t},this.kernel.webView.postEvent("web_app_biometry_request_auth",void 0,i),this}updateBiometricToken(e,t){return this.checkVersion()?(e=e||"",e.length>1024&&(console.error("[@core-ease/telegram-kit] Token is too long",e),l("WebAppBiometricManagerTokenInvalid")),this.checkInit(),this._isBiometricAvailable||(console.error("[@core-ease/telegram-kit] Biometrics is not available on this device."),l("WebAppBiometricManagerBiometricsNotAvailable")),this.isAccessGranted||(console.error("[@core-ease/telegram-kit] Biometric access was not granted by the user."),l("WebAppBiometricManagerBiometricAccessNotGranted")),this.tokenRequestState&&(console.error("[@core-ease/telegram-kit] Token request is already in progress."),l("WebAppBiometricManagerTokenUpdateRequested")),this.tokenRequestState={callback:t},this.kernel.webView.postEvent("web_app_biometry_update_token",void 0,{token:e}),this):this}openSettings(){return this.checkVersion()?(this.checkInit(),this._isBiometricAvailable||(console.error("[@core-ease/telegram-kit] Biometrics is not available on this device."),l("WebAppBiometricManagerBiometricsNotAvailable")),this._isAccessRequested||(console.error("[@core-ease/telegram-kit] Biometric access was not requested yet."),l("WebAppBiometricManagerBiometricsAccessNotRequested")),this._isAccessGranted?(console.warn("[@core-ease/telegram-kit] Biometric access was granted by the user, no need to go to settings."),this):(this.kernel.webView.postEvent("web_app_biometry_open_settings"),this)):this}};var X=class{constructor(e){this.kernel=e;this._isInited=false;this._isLocationAvailable=false;this._isAccessRequested=false;this._isAccessGranted=false;this.initCallbacks=[];this.getRequestCallbacks=[];this.handleLocationChecked=(e,t)=>{this._isInited=true,t.available?(this._isLocationAvailable=true,t.access_requested?(this._isAccessRequested=true,this._isAccessGranted=!!t.access_granted):(this._isAccessRequested=false,this._isAccessGranted=false)):(this._isLocationAvailable=false,this._isAccessRequested=false,this._isAccessGranted=false),this.initCallbacks.length>0&&(this.initCallbacks.forEach(i=>i()),this.initCallbacks=[]),this.kernel.receiveWebViewEvent("locationManagerUpdated");};this.handleLocationRequested=(e,t)=>{let i=null;t.available&&(i={latitude:t.latitude,longitude:t.longitude,altitude:null,course:null,speed:null,horizontal_accuracy:null,vertical_accuracy:null,course_accuracy:null,speed_accuracy:null},typeof t.altitude!="undefined"&&t.altitude!==null&&(i.altitude=t.altitude),typeof t.course!="undefined"&&t.course!==null&&(i.course=t.course%360),typeof t.speed!="undefined"&&t.speed!==null&&(i.speed=t.speed),typeof t.horizontal_accuracy!="undefined"&&t.horizontal_accuracy!==null&&(i.horizontal_accuracy=t.horizontal_accuracy),typeof t.vertical_accuracy!="undefined"&&t.vertical_accuracy!==null&&(i.vertical_accuracy=t.vertical_accuracy),typeof t.course_accuracy!="undefined"&&t.course_accuracy!==null&&(i.course_accuracy=t.course_accuracy),typeof t.speed_accuracy!="undefined"&&t.speed_accuracy!==null&&(i.speed_accuracy=t.speed_accuracy)),!t.available||!this._isLocationAvailable||!this._isAccessRequested||!this._isAccessGranted?(this.initCallbacks.push(()=>this.locationResponse(i)),this.kernel.webView.postEvent("web_app_check_location")):this.locationResponse(i);};e.webView.onEvent("location_checked",this.handleLocationChecked),e.webView.onEvent("location_requested",this.handleLocationRequested);}get isInited(){return this._isInited}get isLocationAvailable(){return this._isInited&&this._isLocationAvailable}get isAccessRequested(){return this._isAccessRequested}get isAccessGranted(){return this._isAccessRequested&&this._isAccessGranted}locationResponse(e){this.getRequestCallbacks.length>0&&(this.getRequestCallbacks.forEach(t=>t(e)),this.getRequestCallbacks=[]),e!==null&&this.kernel.receiveWebViewEvent("locationRequested",{locationData:e});}checkVersion(){return this.kernel.warnIfUnsupported("8.0","LocationManager")}checkInit(){return this._isInited||(console.error("[@core-ease/telegram-kit] LocationManager should be inited before using."),l("WebAppLocationManagerNotInited")),true}init(e){return this.checkVersion()?this._isInited?this:(e&&this.initCallbacks.push(e),this.kernel.webView.postEvent("web_app_check_location"),this):this}getLocation(e){return this.checkVersion()?(this.checkInit(),this._isLocationAvailable||(console.error("[@core-ease/telegram-kit] Location is not available on this device."),l("WebAppLocationManagerLocationNotAvailable")),this.getRequestCallbacks.push(e),this.kernel.webView.postEvent("web_app_request_location"),this):this}openSettings(){return this.checkVersion()?(this.checkInit(),this._isLocationAvailable||(console.error("[@core-ease/telegram-kit] Location is not available on this device."),l("WebAppLocationManagerLocationNotAvailable")),this._isAccessRequested||(console.error("[@core-ease/telegram-kit] Location access was not requested yet."),l("WebAppLocationManagerLocationAccessNotRequested")),this._isAccessGranted?(console.warn("[@core-ease/telegram-kit] Location access was granted by the user, no need to go to settings."),this):(this.kernel.webView.postEvent("web_app_open_location_settings"),this)):this}};var Y=class{constructor(e){this.kernel=e;this.openInvoices={};this.handleInvoiceClosed=(e,t)=>{var i;if(t.slug&&this.openInvoices[t.slug]){let o=this.openInvoices[t.slug];delete this.openInvoices[t.slug],(i=o.callback)==null||i.call(o,t.status),this.kernel.receiveWebViewEvent("invoiceClosed",{url:o.url,status:t.status});}};e.webView.onEvent("invoice_closed",this.handleInvoiceClosed);}openInvoice(e,t){let i=document.createElement("A");i.href=e;let o=i.pathname.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/),n=o==null?void 0:o[2];(i.protocol!="http:"&&i.protocol!="https:"||i.hostname!="t.me"||!o||!n)&&(console.error("[@core-ease/telegram-kit] Invoice url is invalid",e),l("WebAppInvoiceUrlInvalid")),this.kernel.requireVersion("6.1","openInvoice"),this.openInvoices[n]&&(console.error("[@core-ease/telegram-kit] Invoice is already opened"),l("WebAppInvoiceOpened")),this.openInvoices[n]={url:e,callback:t},this.kernel.webView.postEvent("web_app_open_invoice",void 0,{slug:n});}};var ee=class{constructor(e){this.kernel=e;this.handleClipboardTextReceived=(e,t)=>{var n;if(!t.req_id||!this.kernel.hasCallback(t.req_id))return;let i=this.kernel.takeCallback(t.req_id),o=typeof t.data!="undefined"?t.data:null;(n=i==null?void 0:i.callback)==null||n.call(i,o),this.kernel.receiveWebViewEvent("clipboardTextReceived",{data:o});};e.webView.onEvent("clipboard_text_received",this.handleClipboardTextReceived);}readTextFromClipboard(e){this.kernel.requireVersion("6.4","readTextFromClipboard");let t=this.kernel.registerCallback(e);this.kernel.webView.postEvent("web_app_read_text_from_clipboard",void 0,{req_id:t});}};function it(r,e,t){let i,o,n=0,s=()=>{r.invokeCustomMethod("getRequestedContact",{},(u,d)=>{typeof d=="string"&&d.substr(0,1)=='"'&&d.substr(-1)=='"'&&(d=JSON.parse(d)),d&&d.length?(clearTimeout(o),e(d)):(n+=50,i=setTimeout(s,n));});};o=setTimeout(()=>{clearTimeout(i),e("");},t),s();}var te=class{constructor(e){this.kernel=e;this.writeAccessRequested=false;this.contactRequested=false;this.handleWriteAccessRequested=(e,t)=>{var i;if(this.writeAccessRequested){let o=this.writeAccessRequested;this.writeAccessRequested=false,(i=o.callback)==null||i.call(o,t.status=="allowed"),this.kernel.receiveWebViewEvent("writeAccessRequested",{status:t.status});}};this.handlePhoneRequested=(e,t)=>{var s;if(!this.contactRequested)return;let i=this.contactRequested;this.contactRequested=false;let o=t.status=="sent",n={status:t.status};o?it(this.kernel,a=>{var u;if(a&&a.length){n.response=a,n.responseUnsafe=R(a);for(let d in n.responseUnsafe){let p=n.responseUnsafe[d];try{((p==null?void 0:p.substr(0,1))=="{"&&(p==null?void 0:p.substr(-1))=="}"||(p==null?void 0:p.substr(0,1))=="["&&(p==null?void 0:p.substr(-1))=="]")&&(n.responseUnsafe[d]=JSON.parse(p));}catch(v){}}}(u=i.callback)==null||u.call(i,o,n),this.kernel.receiveWebViewEvent("contactRequested",n);},3e3):((s=i.callback)==null||s.call(i,o,n),this.kernel.receiveWebViewEvent("contactRequested",n));};e.webView.onEvent("write_access_requested",this.handleWriteAccessRequested),e.webView.onEvent("phone_requested",this.handlePhoneRequested);}requestWriteAccess(e){this.kernel.requireVersion("6.9","requestWriteAccess"),this.writeAccessRequested&&(console.error("[@core-ease/telegram-kit] Write access is already requested"),l("WebAppWriteAccessRequested")),this.writeAccessRequested={callback:e},this.kernel.webView.postEvent("web_app_request_write_access");}requestContact(e){this.kernel.requireVersion("6.9","requestContact"),this.contactRequested&&(console.error("[@core-ease/telegram-kit] Contact is already requested"),l("WebAppContactRequested")),this.contactRequested={callback:e},this.kernel.webView.postEvent("web_app_request_phone");}};var re=class{constructor(e){this.kernel=e;this.statusCallbacks=[];this.handleAdded=()=>{this.kernel.receiveWebViewEvent("homeScreenAdded");};this.handleChecked=(e,t)=>{let i=t.status||"unknown";this.statusCallbacks.length>0&&(this.statusCallbacks.forEach(o=>o(i)),this.statusCallbacks=[]),this.kernel.receiveWebViewEvent("homeScreenChecked",{status:i});};e.webView.onEvent("home_screen_added",this.handleAdded),e.webView.onEvent("home_screen_checked",this.handleChecked);}addToHomeScreen(){this.kernel.requireVersion("8.0","addToHomeScreen"),this.kernel.webView.postEvent("web_app_add_to_home_screen");}checkHomeScreenStatus(e){this.kernel.requireVersion("8.0","checkHomeScreenStatus"),e&&this.statusCallbacks.push(e),this.kernel.webView.postEvent("web_app_check_home_screen");}};var ie=class{constructor(e){this.kernel=e;this.requested=false;this.handleFileDownloadRequested=(e,t)=>{var n;if(!this.requested)return;let i=this.requested;this.requested=false;let o=t.status=="downloading";(n=i.callback)==null||n.call(i,o),this.kernel.receiveWebViewEvent("fileDownloadRequested",{status:o?"downloading":"cancelled"});};e.webView.onEvent("file_download_requested",this.handleFileDownloadRequested);}downloadFile(e,t){this.kernel.requireVersion("8.0","downloadFile"),this.requested&&(console.error("[@core-ease/telegram-kit] Popup is already opened"),l("WebAppDownloadFilePopupOpened"));let i=document.createElement("A"),o={};(!e||!e.url||!e.url.length)&&(console.error("[@core-ease/telegram-kit] Url is required"),l("WebAppDownloadFileParamInvalid")),i.href=e.url,i.protocol!="https:"&&(console.error("[@core-ease/telegram-kit] Url protocol is not supported",e.url),l("WebAppDownloadFileParamInvalid")),o.url=i.href,(!e||!e.file_name||!e.file_name.length)&&(console.error("[@core-ease/telegram-kit] File name is required"),l("WebAppDownloadFileParamInvalid")),o.file_name=e.file_name,this.requested={callback:t},this.kernel.webView.postEvent("web_app_request_file_download",void 0,o);}};var oe=class{constructor(e){this.kernel=e;this.shareMessageOpened=false;this.requestChatOpened=false;this.handlePreparedMessageSent=()=>{var t;if(!this.shareMessageOpened)return;let e=this.shareMessageOpened;this.shareMessageOpened=false,(t=e.callback)==null||t.call(e,true),this.kernel.receiveWebViewEvent("shareMessageSent");};this.handlePreparedMessageFailed=(e,t)=>{var o;if(!this.shareMessageOpened)return;let i=this.shareMessageOpened;this.shareMessageOpened=false,(o=i.callback)==null||o.call(i,false),this.kernel.receiveWebViewEvent("shareMessageFailed",{error:t.error});};this.handleRequestedChatSent=()=>{var t;if(!this.requestChatOpened)return;let e=this.requestChatOpened;this.requestChatOpened=false,(t=e.callback)==null||t.call(e,true),this.kernel.receiveWebViewEvent("requestedChatSent");};this.handleRequestedChatFailed=(e,t)=>{var o;if(!this.requestChatOpened)return;let i=this.requestChatOpened;this.requestChatOpened=false,(o=i.callback)==null||o.call(i,false),this.kernel.receiveWebViewEvent("requestedChatFailed",{error:t.error});};e.webView.onEvent("prepared_message_sent",this.handlePreparedMessageSent),e.webView.onEvent("prepared_message_failed",this.handlePreparedMessageFailed),e.webView.onEvent("requested_chat_sent",this.handleRequestedChatSent),e.webView.onEvent("requested_chat_failed",this.handleRequestedChatFailed);}shareToStory(e,t={}){this.kernel.requireVersion("7.8","shareToStory");let i=document.createElement("A");i.href=e,i.protocol!="http:"&&i.protocol!="https:"&&(console.error("[@core-ease/telegram-kit] Media url protocol is not supported",e),l("WebAppMediaUrlInvalid"));let o={media_url:i.href};if(typeof t.text!="undefined"){let n=_(t.text);n.length>2048&&(console.error("[@core-ease/telegram-kit] Text is too long",n),l("WebAppShareToStoryParamInvalid")),n.length>0&&(o.text=n);}if(typeof t.widget_link!="undefined"){let n=t.widget_link||{};i.href=n.url,i.protocol!="http:"&&i.protocol!="https:"&&(console.error("[@core-ease/telegram-kit] Link protocol is not supported",n.url),l("WebAppShareToStoryParamInvalid"));let s={url:i.href};if(typeof n.name!="undefined"){let a=_(n.name);a.length>48&&(console.error("[@core-ease/telegram-kit] Link name is too long",a),l("WebAppShareToStoryParamInvalid")),a.length>0&&(s.name=a);}o.widget_link=s;}this.kernel.webView.postEvent("web_app_share_to_story",void 0,o);}shareMessage(e,t){this.kernel.requireVersion("8.0","shareMessage"),this.shareMessageOpened&&(console.error("[@core-ease/telegram-kit] Share message is already opened"),l("WebAppShareMessageOpened")),this.shareMessageOpened={callback:t},this.kernel.webView.postEvent("web_app_send_prepared_message",void 0,{id:e});}requestChat(e,t){this.kernel.requireVersion("9.6","requestChat"),this.requestChatOpened&&(console.error("[@core-ease/telegram-kit] Request chat is already opened"),l("WebAppRequestChatOpened")),this.requestChatOpened={callback:t},this.kernel.webView.postEvent("web_app_request_chat",void 0,{req_id:e});}switchInlineQuery(e,t,i){this.kernel.requireVersion("6.6","switchInlineQuery"),i.tgWebAppBotInline||(console.error("[@core-ease/telegram-kit] Inline mode is disabled for this bot. Read more about inline mode: https://core.telegram.org/bots/inline"),l("WebAppInlineModeDisabled"));let o=e||"";o.length>256&&(console.error("[@core-ease/telegram-kit] Inline query is too long",o),l("WebAppInlineQueryInvalid"));let n=[];if(t){Array.isArray(t)||(console.error("[@core-ease/telegram-kit] Choose chat types should be an array",t),l("WebAppInlineChooseChatTypesInvalid"));let s={users:1,bots:1,groups:1,channels:1};for(let a of t)s[a]||(console.error("[@core-ease/telegram-kit] Choose chat type is invalid",a),l("WebAppInlineChooseChatTypeInvalid")),s[a]!=2&&(s[a]=2,n.push(a));}this.kernel.webView.postEvent("web_app_switch_inline_query",void 0,{query:o,chat_types:n});}};var ne=class{constructor(e){this.kernel=e;this.setRequested=false;this.accessRequested=false;this.handleSet=()=>{var t;if(!this.setRequested)return;let e=this.setRequested;this.setRequested=false,(t=e.callback)==null||t.call(e,true),this.kernel.receiveWebViewEvent("emojiStatusSet");};this.handleFailed=(e,t)=>{var o;if(!this.setRequested)return;let i=this.setRequested;this.setRequested=false,(o=i.callback)==null||o.call(i,false),this.kernel.receiveWebViewEvent("emojiStatusFailed",{error:t.error});};this.handleAccessRequested=(e,t)=>{var o;if(!this.accessRequested)return;let i=this.accessRequested;this.accessRequested=false,(o=i.callback)==null||o.call(i,t.status=="allowed"),this.kernel.receiveWebViewEvent("emojiStatusAccessRequested",{status:t.status});};e.webView.onEvent("emoji_status_set",this.handleSet),e.webView.onEvent("emoji_status_failed",this.handleFailed),e.webView.onEvent("emoji_status_access_requested",this.handleAccessRequested);}setEmojiStatus(e,t={},i){this.kernel.requireVersion("8.0","setEmojiStatus");let o={custom_emoji_id:e};typeof t.duration!="undefined"&&(o.duration=t.duration),this.setRequested&&(console.error("[@core-ease/telegram-kit] Emoji status is already requested"),l("WebAppEmojiStatusRequested")),this.setRequested={callback:i},this.kernel.webView.postEvent("web_app_set_emoji_status",void 0,o);}requestEmojiStatusAccess(e){this.kernel.requireVersion("8.0","requestEmojiStatusAccess"),this.accessRequested&&(console.error("[@core-ease/telegram-kit] Emoji status permission is already requested"),l("WebAppEmojiStatusAccessRequested")),this.accessRequested={callback:e},this.kernel.webView.postEvent("web_app_request_emoji_status_access");}};var se=class{constructor(e){this.kernel=e;this.handleDocumentClick=e=>{if(e.metaKey||e.ctrlKey)return;let t=e.target;for(;t&&t.tagName!="A"&&t.parentNode;)t=t.parentNode;t&&t.tagName=="A"&&t.target!="_blank"&&(t.protocol=="http:"||t.protocol=="https:")&&t.hostname=="t.me"&&(this.openTelegramLink(t.href),e.preventDefault());};}openLink(e,t={}){let i=document.createElement("A");i.href=e,i.protocol!="http:"&&i.protocol!="https:"&&(console.error("[@core-ease/telegram-kit] Url protocol is not supported",e),l("WebAppTgUrlInvalid"));let o=i.href;if(this.kernel.versionAtLeast("6.1")){let n={url:o};this.kernel.versionAtLeast("6.4")&&t.try_instant_view&&(n.try_instant_view=true),this.kernel.versionAtLeast("7.6")&&t.try_browser&&(n.try_browser=t.try_browser),this.kernel.webView.postEvent("web_app_open_link",void 0,n);}else window.open(o,"_blank");}openTelegramLink(e,t={}){let i=document.createElement("A");i.href=e,i.protocol!="http:"&&i.protocol!="https:"&&(console.error("[@core-ease/telegram-kit] Url protocol is not supported",e),l("WebAppTgUrlInvalid")),i.hostname!="t.me"&&(console.error("[@core-ease/telegram-kit] Url host is not supported",e),l("WebAppTgUrlInvalid"));let o=i.pathname+i.search;if(this.kernel.webView.isIframe||this.kernel.versionAtLeast("6.1")){let n={path_full:o};t.force_request&&(n.force_request=true),this.kernel.webView.postEvent("web_app_open_tg_link",void 0,n);}else location.href="https://t.me"+o;}};var B=class{constructor(e,t,i){this.kernel=e;this.names=t;this._isStarted=false;this.startCallbacks=[];this.stopCallbacks=[];this.handleStarted=()=>{this._isStarted=true,this.startCallbacks.length>0&&(this.startCallbacks.forEach(e=>e(true)),this.startCallbacks=[]),this.kernel.receiveWebViewEvent(this.names.webViewStarted);};this.handleStopped=()=>{this._isStarted=false,this.stopCallbacks.length>0&&(this.stopCallbacks.forEach(e=>e(true)),this.stopCallbacks=[]),this.kernel.receiveWebViewEvent(this.names.webViewStopped);};this.handleChanged=(e,t)=>{this.values=this.mapChangedPayload(t),this.kernel.receiveWebViewEvent(this.names.webViewChanged);};this.handleFailed=(e,t)=>{this.startCallbacks.length>0&&(this.startCallbacks.forEach(i=>i(false)),this.startCallbacks=[]),this.kernel.receiveWebViewEvent(this.names.webViewFailed,{error:t.error});};this.values=i,e.webView.onEvent(t.started,this.handleStarted),e.webView.onEvent(t.stopped,this.handleStopped),e.webView.onEvent(t.changed,this.handleChanged),e.webView.onEvent(t.failed,this.handleFailed);}get isStarted(){return this._isStarted}checkVersion(){return this.kernel.warnIfUnsupported(this.names.minVersion,this.names.displayName)}buildStartParams(e){let t={},i=parseInt(String(e!=null?e:1e3));return isNaN(i)||i<20||i>1e3?console.warn(`[@core-ease/telegram-kit] ${this.names.displayName} refresh_rate is invalid`,i):t.refresh_rate=i,t}doStart(e,t){t&&this.startCallbacks.push(t),this.kernel.webView.postEvent(this.names.startCommand,void 0,e);}stop(e){return this.checkVersion()?(e&&this.stopCallbacks.push(e),this.kernel.webView.postEvent(this.names.stopCommand),this):this}};var ae=class extends B{constructor(e){super(e,{started:"accelerometer_started",stopped:"accelerometer_stopped",changed:"accelerometer_changed",failed:"accelerometer_failed",webViewStarted:"accelerometerStarted",webViewStopped:"accelerometerStopped",webViewChanged:"accelerometerChanged",webViewFailed:"accelerometerFailed",startCommand:"web_app_start_accelerometer",stopCommand:"web_app_stop_accelerometer",minVersion:"8.0",displayName:"Accelerometer"},{x:null,y:null,z:null});}mapChangedPayload(e){return {x:e.x,y:e.y,z:e.z}}get x(){return this.values.x}get y(){return this.values.y}get z(){return this.values.z}start(e={},t){if(!this.checkVersion())return this;let i=this.buildStartParams(e.refresh_rate);return this.doStart(i,t),this}};var le=class extends B{constructor(e){super(e,{started:"gyroscope_started",stopped:"gyroscope_stopped",changed:"gyroscope_changed",failed:"gyroscope_failed",webViewStarted:"gyroscopeStarted",webViewStopped:"gyroscopeStopped",webViewChanged:"gyroscopeChanged",webViewFailed:"gyroscopeFailed",startCommand:"web_app_start_gyroscope",stopCommand:"web_app_stop_gyroscope",minVersion:"8.0",displayName:"Gyroscope"},{x:null,y:null,z:null});}mapChangedPayload(e){return {x:e.x,y:e.y,z:e.z}}get x(){return this.values.x}get y(){return this.values.y}get z(){return this.values.z}start(e={},t){if(!this.checkVersion())return this;let i=this.buildStartParams(e.refresh_rate);return this.doStart(i,t),this}};var ce=class extends B{constructor(e){super(e,{started:"device_orientation_started",stopped:"device_orientation_stopped",changed:"device_orientation_changed",failed:"device_orientation_failed",webViewStarted:"deviceOrientationStarted",webViewStopped:"deviceOrientationStopped",webViewChanged:"deviceOrientationChanged",webViewFailed:"deviceOrientationFailed",startCommand:"web_app_start_device_orientation",stopCommand:"web_app_stop_device_orientation",minVersion:"8.0",displayName:"DeviceOrientation"},{absolute:false,alpha:null,beta:null,gamma:null});}mapChangedPayload(e){return {absolute:!!e.absolute,alpha:e.alpha,beta:e.beta,gamma:e.gamma}}get absolute(){return this.values.absolute}get alpha(){return this.values.alpha}get beta(){return this.values.beta}get gamma(){return this.values.gamma}start(e={},t){if(!this.checkVersion())return this;let i=this.buildStartParams(e.refresh_rate);return i.need_absolute=!!e.need_absolute,this.doStart(i,t),this}};var de=class{constructor(e){this.webView=e;this.webAppInitData="";this.webAppInitDataUnsafe={};this.webAppPlatform="unknown";this.webAppIsActive=true;this.handleThemeChanged=(e,t)=>{t.theme_params&&(this.theme.setThemeParams(t.theme_params),this.MainButton.setParams({}),this.SecondaryButton.setParams({}),this.theme.updateHeaderColor(),this.theme.updateBackgroundColor(),this.theme.updateBottomBarColor(),this.kernel.receiveWebViewEvent("themeChanged"));};this.handleVisibilityChanged=(e,t)=>{t.is_visible?(this.webAppIsActive=true,this.kernel.receiveWebViewEvent("activated")):(this.webAppIsActive=false,this.kernel.receiveWebViewEvent("deactivated"));};let t=new H(e);this.kernel=t;let i=e.initParams;if(i.tgWebAppData&&i.tgWebAppData.length){this.webAppInitData=i.tgWebAppData;let o=R(this.webAppInitData);for(let n in o){let s=o[n];try{((s==null?void 0:s.substr(0,1))=="{"&&(s==null?void 0:s.substr(-1))=="}"||(s==null?void 0:s.substr(0,1))=="["&&(s==null?void 0:s.substr(-1))=="]")&&(o[n]=JSON.parse(s));}catch(a){}}this.webAppInitDataUnsafe=o;}i.tgWebAppPlatform&&(this.webAppPlatform=i.tgWebAppPlatform),this.theme=new F(t),this.viewport=new U(t),this.debugBar=new Q(t,()=>this.theme.getBottomBarColor()),this.BackButton=new K(t),this.MainButton=new q("main",t,this.theme,this.debugBar),this.SecondaryButton=new q("secondary",t,this.theme,this.debugBar),this.SettingsButton=new N(t),this.popups=new D(t),this.scanQr=new $(t),this.HapticFeedback=new j(t),this.CloudStorage=new G(t),this.DeviceStorage=new z(t),this.SecureStorage=new J(t),this.BiometricManager=new Z(t),this.LocationManager=new X(t),this.invoices=new Y(t),this.clipboard=new ee(t),this.contact=new te(t),this.homeScreen=new re(t),this.downloadFileManager=new ie(t),this.sharing=new oe(t),this.emojiStatus=new ne(t),this.links=new se(t),this.Accelerometer=new ae(t),this.DeviceOrientation=new ce(t),this.Gyroscope=new le(t),this.debugBar.onHeightChanged=()=>this.viewport.setViewportHeight(),this.theme.onBottomBarColorApplied=()=>{this.debugBar.refreshColor(),this.SecondaryButton.setParams({});},t.webView.onEvent("theme_changed",this.handleThemeChanged),t.webView.onEvent("viewport_changed",this.viewport.handleViewportChanged),t.webView.onEvent("safe_area_changed",this.viewport.handleSafeAreaChanged),t.webView.onEvent("content_safe_area_changed",this.viewport.handleContentSafeAreaChanged),t.webView.onEvent("visibility_changed",this.handleVisibilityChanged),t.webView.onEvent("fullscreen_changed",this.viewport.handleFullscreenChanged),t.webView.onEvent("fullscreen_failed",this.viewport.handleFullscreenFailed),t.webView.onEvent("custom_method_invoked",t.onCustomMethodInvoked),window.addEventListener("resize",this.viewport.onWindowResize),e.isIframe&&document.addEventListener("click",this.links.handleDocumentClick),this.theme.updateHeaderColor(),this.theme.updateBackgroundColor(),this.theme.updateBottomBarColor(),this.viewport.setViewportHeight(),i.tgWebAppShowSettings&&this.SettingsButton.show(),t.webView.postEvent("web_app_request_theme"),t.webView.postEvent("web_app_request_viewport"),t.webView.postEvent("web_app_request_safe_area"),t.webView.postEvent("web_app_request_content_safe_area");}get initData(){return this.webAppInitData}get initDataUnsafe(){return this.webAppInitDataUnsafe}get version(){return this.kernel.version}get platform(){return this.webAppPlatform}get colorScheme(){return this.theme.colorScheme}get themeParams(){return this.theme.getThemeParams()}get isExpanded(){return this.viewport.isExpanded}get viewportHeight(){return this.viewport.viewportHeight}get viewportStableHeight(){return this.viewport.viewportStableHeight}get safeAreaInset(){return this.viewport.safeAreaInset}get contentSafeAreaInset(){return this.viewport.contentSafeAreaInset}get isFullscreen(){return this.viewport.isFullscreen}get isActive(){return this.webAppIsActive}get isClosingConfirmationEnabled(){return this.viewport.isClosingConfirmationEnabled}set isClosingConfirmationEnabled(e){this.viewport.setClosingConfirmation(e);}get isVerticalSwipesEnabled(){return this.viewport.isVerticalSwipesEnabled}set isVerticalSwipesEnabled(e){this.viewport.toggleVerticalSwipes(e);}get isOrientationLocked(){return this.viewport.isOrientationLocked}set isOrientationLocked(e){this.viewport.toggleOrientationLock(e);}get headerColor(){return this.theme.getHeaderColor()}set headerColor(e){this.theme.setHeaderColor(e);}get backgroundColor(){return this.theme.getBackgroundColor()}set backgroundColor(e){this.theme.setBackgroundColor(e);}get bottomBarColor(){return this.theme.getBottomBarColor()}set bottomBarColor(e){this.theme.setBottomBarColor(e);}isVersionAtLeast(e){return this.kernel.versionAtLeast(e)}setHeaderColor(e){this.headerColor=e;}setBackgroundColor(e){this.backgroundColor=e;}setBottomBarColor(e){this.bottomBarColor=e;}enableClosingConfirmation(){this.isClosingConfirmationEnabled=true;}disableClosingConfirmation(){this.isClosingConfirmationEnabled=false;}enableVerticalSwipes(){this.isVerticalSwipesEnabled=true;}disableVerticalSwipes(){this.isVerticalSwipesEnabled=false;}lockOrientation(){this.isOrientationLocked=true;}unlockOrientation(){this.isOrientationLocked=false;}requestFullscreen(){this.viewport.requestFullscreen();}exitFullscreen(){this.viewport.exitFullscreen();}addToHomeScreen(){this.homeScreen.addToHomeScreen();}checkHomeScreenStatus(e){this.homeScreen.checkHomeScreenStatus(e);}onEvent(e,t){this.kernel.onWebViewEvent(e,t);}offEvent(e,t){this.kernel.offWebViewEvent(e,t);}sendData(e){(!e||!e.length)&&(console.error("[@core-ease/telegram-kit] Data is required",e),l("WebAppDataInvalid")),we(e)>4096&&(console.error("[@core-ease/telegram-kit] Data is too long",e),l("WebAppDataInvalid")),this.kernel.webView.postEvent("web_app_data_send",void 0,{data:e});}switchInlineQuery(e,t){this.sharing.switchInlineQuery(e,t,this.kernel.initParams);}openLink(e,t){this.links.openLink(e,t);}openTelegramLink(e,t){this.links.openTelegramLink(e,t);}openInvoice(e,t){this.invoices.openInvoice(e,t);}showPopup(e,t){this.popups.showPopup(e,t);}showAlert(e,t){this.popups.showAlert(e,t);}showConfirm(e,t){this.popups.showConfirm(e,t);}showScanQrPopup(e,t){this.scanQr.showScanQrPopup(e,t);}closeScanQrPopup(){this.scanQr.closeScanQrPopup();}readTextFromClipboard(e){this.clipboard.readTextFromClipboard(e);}requestWriteAccess(e){this.contact.requestWriteAccess(e);}requestContact(e){this.contact.requestContact(e);}downloadFile(e,t){this.downloadFileManager.downloadFile(e,t);}shareToStory(e,t){this.sharing.shareToStory(e,t);}shareMessage(e,t){this.sharing.shareMessage(e,t);}requestChat(e,t){this.sharing.requestChat(e,t);}setEmojiStatus(e,t,i){this.emojiStatus.setEmojiStatus(e,t,i);}requestEmojiStatusAccess(e){this.emojiStatus.requestEmojiStatusAccess(e);}invokeCustomMethod(e,t,i){this.kernel.invokeCustomMethod(e,t,i);}hideKeyboard(){this.kernel.webView.postEvent("web_app_hide_keyboard");}ready(){this.kernel.webView.postEvent("web_app_ready");}expand(){this.kernel.webView.postEvent("web_app_expand");}close(e={}){let t={};this.kernel.versionAtLeast("7.6")&&e.return_back&&(t.return_back=true),this.kernel.webView.postEvent("web_app_close",void 0,t);}};var ot="@core-ease/telegram-kit",fe=null;function ue(){var i;if(fe)return fe;if(typeof window=="undefined"||typeof document=="undefined")throw new Error(`[${ot}] bootstrapTelegramWebApp() requires a browser environment (window/document).`);let r=new W,e=(i=window.Telegram)!=null?i:window.Telegram={};e.WebView=r,e.Utils=O;let t=new de(r);return e.WebApp=t,fe={webView:r,webApp:t},fe}function Ae(){return fe!==null}var nt="@core-ease/telegram-kit:dev-mode-active";function st(){try{typeof window!="undefined"&&window.sessionStorage.setItem(nt,"1");}catch(r){}}function at(){try{return typeof window!="undefined"&&window.sessionStorage.getItem(nt)==="1"}catch(r){return false}}var $t="@core-ease/telegram-kit:fallback:";function _e(r){let e=`${$t}${r}:`,t=()=>typeof window!="undefined"&&!!window.localStorage;return {async setItem(i,o){if(!t())return false;try{return window.localStorage.setItem(e+i,o),!0}catch(n){return false}},async getItem(i){if(t())try{let o=window.localStorage.getItem(e+i);return o===null?void 0:o}catch(o){return}},async getItems(i){let o={};if(!t())return o;for(let n of i)try{let s=window.localStorage.getItem(e+n);s!==null&&(o[n]=s);}catch(s){}return o},async removeItem(i){if(!t())return false;try{return window.localStorage.removeItem(e+i),!0}catch(o){return false}},async removeItems(i){if(!t())return false;try{return i.forEach(o=>window.localStorage.removeItem(e+o)),!0}catch(o){return false}},async getKeys(){if(!t())return [];try{let i=[];for(let o=0;o<window.localStorage.length;o++){let n=window.localStorage.key(o);n&&n.startsWith(e)&&i.push(n.slice(e.length));}return i}catch(i){return []}},async clear(){if(!t())return false;try{return (await this.getKeys()).forEach(o=>window.localStorage.removeItem(e+o)),!0}catch(i){return false}}}}var jt={light:10,medium:20,heavy:30,rigid:15,soft:10,success:[10,30,10],warning:[20,40,20],error:[30,60,30],selection:5};function S(r){try{typeof navigator!="undefined"&&typeof navigator.vibrate=="function"&&navigator.vibrate(jt[r]);}catch(e){}}function lt(r,e){try{if(typeof document=="undefined")return !1;let t=document.createElement("a");return t.href=r,t.download=e,t.rel="noopener",t.target="_blank",document.body.appendChild(t),t.click(),document.body.removeChild(t),!0}catch(t){return false}}function ct(){return new Promise(r=>{if(typeof navigator=="undefined"||!navigator.geolocation){r(null);return}navigator.geolocation.getCurrentPosition(e=>{r({latitude:e.coords.latitude,longitude:e.coords.longitude,altitude:e.coords.altitude,course:e.coords.heading,speed:e.coords.speed,horizontal_accuracy:e.coords.accuracy,vertical_accuracy:e.coords.altitudeAccuracy,course_accuracy:null,speed_accuracy:null});},()=>r(null),{enableHighAccuracy:false,timeout:8e3,maximumAge:6e4});})}async function dt(){var r;try{if(typeof navigator!="undefined"&&((r=navigator.clipboard)!=null&&r.readText)){let e=await navigator.clipboard.readText();return e!=null?e:null}}catch(e){}return null}function ut(r){if(typeof window=="undefined"||typeof window.prompt!="function")return null;let e=window.prompt(r||"Enter the QR code value:");return e&&e.length?e:null}async function pt(r,e){var t;try{if(typeof navigator!="undefined"&&typeof navigator.share=="function")return await navigator.share({text:r,url:e}),!0}catch(i){}try{if(typeof navigator!="undefined"&&((t=navigator.clipboard)!=null&&t.writeText))return await navigator.clipboard.writeText(e?`${r}
2
+ ${e}`:r),!0}catch(i){}return false}function m(r){let{ready:e,native:t,fallback:i,timeoutMs:o=4e3}=r;if(!e)try{return Promise.resolve(i())}catch(n){return Promise.reject(n)}return new Promise(n=>{let s=false,a=async(d,p)=>{s||(s=true,clearTimeout(u),n(d?await i():p));},u=setTimeout(()=>a(true),o);try{t().then(d=>a(!1,d),()=>a(!0));}catch(d){a(true);}})}async function Ie(r){try{let e=typeof screen!="undefined"?screen.orientation:void 0;return e?(r?await e.lock("portrait"):typeof e.unlock=="function"&&e.unlock(),!0):!1}catch(e){return false}}async function Ve(r,e){var t,i;try{if(typeof document=="undefined")return !1;if(r){let o=e!=null?e:document.documentElement;await((t=o.requestFullscreen)==null?void 0:t.call(o));}else document.fullscreenElement&&await((i=document.exitFullscreen)==null?void 0:i.call(document));return !0}catch(o){return false}}function b(r){try{r();}catch(e){}}var Be=null;function c(){return typeof window=="undefined"?null:(Be||(Be=ue().webApp),Be)}function Gt(){let r=c();return !!(r&&r.initData&&r.initData.length>0)}function zt(r){var e,t;return (t=(e=c())==null?void 0:e.isVersionAtLeast(r))!=null?t:false}function h(r){return !(!Gt()||at()||r&&!zt(r))}function Jt(){var r,e,t;return (t=(e=(r=c())==null?void 0:r.initDataUnsafe)==null?void 0:e.user)!=null?t:null}function Zt(r){var t,i;if(!r)return "User";let e=`${(t=r.first_name)!=null?t:""} ${(i=r.last_name)!=null?i:""}`.trim();return e||(r.username?`@${r.username}`:`User_${r.id}`)}function Xt(r){return r!=null&&r.username?r.username:r!=null&&r.id?String(r.id):"unknown"}function Yt(r,e="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjNjY2Ii8+PHRleHQgeD0iNTAlIiB5PSI1MCUiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIGZvbnQtc2l6ZT0iNDAiIGZpbGw9IndoaXRlIj4/PC90ZXh0Pjwvc3ZnPg=="){var t,i;if(r!=null&&r.photo_url)return r.photo_url;if(r!=null&&r.id){let s=`
3
+ <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
4
+ <rect width="100%" height="100%" rx="50" fill="#4F46E5"/>
5
+ <text
6
+ x="50%"
7
+ y="50%"
8
+ dominant-baseline="middle"
9
+ text-anchor="middle"
10
+ font-family="Arial,sans-serif"
11
+ font-size="40"
12
+ font-weight="bold"
13
+ fill="white"
14
+ >
15
+ ${(`${(t=r.first_name)!=null?t:""} ${(i=r.last_name)!=null?i:""}`.trim()||r.username||`user_${r.id}`).split(/\s+/).slice(0,2).map(u=>{var d,p;return (p=(d=u[0])==null?void 0:d.toUpperCase())!=null?p:""}).join("")}
16
+ </text>
17
+ </svg>
18
+ `;return `data:image/svg+xml;base64,${typeof Buffer!="undefined"?Buffer.from(s).toString("base64"):btoa(s)}`}return e}function en(){var e;let r=(e=Jt())!=null?e:void 0;return {user:r,avatarUrl:Yt(r),displayName:Zt(r),identifier:Xt(r)}}function tn(r,e=false){let t=c();if(!t){typeof window!="undefined"&&window.open(r,"_blank","noopener");return}t.openLink(r,{try_instant_view:e});}function rn(r){let e=c();if(!e){typeof window!="undefined"&&window.open(r,"_blank","noopener");return}e.openTelegramLink(r);}function on(r){return m({ready:h("6.1"),native:()=>new Promise(e=>c().openInvoice(r,t=>e(t))),fallback:()=>{throw new Error("openInvoice requires the Telegram app (Bot API 6.1+).")}})}function nn(r,e){h("6.6")&&b(()=>c().switchInlineQuery(r,e));}function sn(){b(()=>{var r;return (r=c())==null?void 0:r.hideKeyboard()});}function an(){var e,t;let r=c();return {colorScheme:(e=r==null?void 0:r.colorScheme)!=null?e:"dark",themeParams:(t=r==null?void 0:r.themeParams)!=null?t:{}}}function ln(){var e,t,i;let r=c();return {height:(e=r==null?void 0:r.viewportHeight)!=null?e:typeof window!="undefined"?window.innerHeight:0,stableHeight:(t=r==null?void 0:r.viewportStableHeight)!=null?t:typeof window!="undefined"?window.innerHeight:0,isExpanded:(i=r==null?void 0:r.isExpanded)!=null?i:true}}function cn(){b(()=>{var r;return (r=c())==null?void 0:r.expand()});}function dn(){b(()=>{var r;return (r=c())==null?void 0:r.ready()});}function un(){b(()=>{var r;return (r=c())==null?void 0:r.close()});}var pn={enter:()=>h("8.0")?(b(()=>c().requestFullscreen()),Promise.resolve(true)):Ve(true),exit:()=>h("8.0")?(b(()=>c().exitFullscreen()),Promise.resolve(true)):Ve(false)},hn={lock:()=>h("8.0")?(b(()=>c().lockOrientation()),Promise.resolve(true)):Ie(true),unlock:()=>h("8.0")?(b(()=>c().unlockOrientation()),Promise.resolve(true)):Ie(false)};function fn(){b(()=>{var r;return (r=c())==null?void 0:r.enableClosingConfirmation()});}function mn(){b(()=>{var r;return (r=c())==null?void 0:r.disableClosingConfirmation()});}function gn(){b(()=>{var r;return (r=c())==null?void 0:r.enableVerticalSwipes()});}function bn(){b(()=>{var r;return (r=c())==null?void 0:r.disableVerticalSwipes()});}function vn(r){b(()=>{var e;return (e=c())==null?void 0:e.setHeaderColor(r)});}function wn(r){b(()=>{var e;return (e=c())==null?void 0:e.setBackgroundColor(r)});}function _n(r){b(()=>{var e;return (e=c())==null?void 0:e.setBottomBarColor(r)});}function yn(){h("8.0")&&b(()=>c().addToHomeScreen());}function kn(){return m({ready:h("8.0"),native:()=>new Promise(r=>c().checkHomeScreenStatus(e=>r(e))),fallback:()=>"unsupported"})}var Cn={light:()=>h("6.1")?c().HapticFeedback.impactOccurred("light"):S("light"),medium:()=>h("6.1")?c().HapticFeedback.impactOccurred("medium"):S("medium"),heavy:()=>h("6.1")?c().HapticFeedback.impactOccurred("heavy"):S("heavy"),rigid:()=>h("6.1")?c().HapticFeedback.impactOccurred("rigid"):S("rigid"),soft:()=>h("6.1")?c().HapticFeedback.impactOccurred("soft"):S("soft"),success:()=>h("6.1")?c().HapticFeedback.notificationOccurred("success"):S("success"),warning:()=>h("6.1")?c().HapticFeedback.notificationOccurred("warning"):S("warning"),error:()=>h("6.1")?c().HapticFeedback.notificationOccurred("error"):S("error"),selection:()=>h("6.1")?c().HapticFeedback.selectionChanged():S("selection")},pe=_e("cloud"),ye=_e("device"),me=_e("secure"),Pn={setItem:(r,e)=>m({ready:h("6.9"),native:()=>new Promise((t,i)=>c().CloudStorage.setItem(r,e,(o,n)=>o?i(new Error(o)):t(n!=null?n:false))),fallback:()=>pe.setItem(r,e)}),getItem:r=>m({ready:h("6.9"),native:()=>new Promise((e,t)=>c().CloudStorage.getItem(r,(i,o)=>i?t(new Error(i)):e(o))),fallback:()=>pe.getItem(r)}),getItems:r=>m({ready:h("6.9"),native:()=>new Promise((e,t)=>c().CloudStorage.getItems(r,(i,o)=>i?t(new Error(i)):e(o!=null?o:{}))),fallback:()=>pe.getItems(r)}),removeItem:r=>m({ready:h("6.9"),native:()=>new Promise((e,t)=>c().CloudStorage.removeItem(r,(i,o)=>i?t(new Error(i)):e(o!=null?o:false))),fallback:()=>pe.removeItem(r)}),removeItems:r=>m({ready:h("6.9"),native:()=>new Promise((e,t)=>c().CloudStorage.removeItems(r,(i,o)=>i?t(new Error(i)):e(o!=null?o:false))),fallback:()=>pe.removeItems(r)}),getKeys:()=>m({ready:h("6.9"),native:()=>new Promise((r,e)=>c().CloudStorage.getKeys((t,i)=>t?e(new Error(t)):r(i!=null?i:[]))),fallback:()=>pe.getKeys()})},Sn={setItem:(r,e)=>m({ready:h("9.0"),native:()=>new Promise((t,i)=>c().DeviceStorage.setItem(r,e,(o,n)=>o?i(new Error(o)):t(n!=null?n:false))),fallback:()=>ye.setItem(r,e)}),getItem:r=>m({ready:h("9.0"),native:()=>new Promise((e,t)=>c().DeviceStorage.getItem(r,(i,o)=>i?t(new Error(i)):e(o))),fallback:()=>ye.getItem(r)}),removeItem:r=>m({ready:h("9.0"),native:()=>new Promise((e,t)=>c().DeviceStorage.removeItem(r,(i,o)=>i?t(new Error(i)):e(o!=null?o:false))),fallback:()=>ye.removeItem(r)}),clear:()=>m({ready:h("9.0"),native:()=>new Promise((r,e)=>c().DeviceStorage.clear((t,i)=>t?e(new Error(t)):r(i!=null?i:false))),fallback:()=>ye.clear()})},xn={setItem:(r,e)=>m({ready:h("9.0"),native:()=>new Promise((t,i)=>c().SecureStorage.setItem(r,e,(o,n)=>o?i(new Error(o)):t(n!=null?n:false))),fallback:()=>me.setItem(r,e)}),getItem:r=>m({ready:h("9.0"),native:()=>new Promise((e,t)=>c().SecureStorage.getItem(r,(i,o,n)=>i?t(new Error(i)):e({value:o,canRestore:n!=null?n:false}))),fallback:async()=>({value:await me.getItem(r),canRestore:false})}),removeItem:r=>m({ready:h("9.0"),native:()=>new Promise((e,t)=>c().SecureStorage.removeItem(r,(i,o)=>i?t(new Error(i)):e(o!=null?o:false))),fallback:()=>me.removeItem(r)}),clear:()=>m({ready:h("9.0"),native:()=>new Promise((r,e)=>c().SecureStorage.clear((t,i)=>t?e(new Error(t)):r(i!=null?i:false))),fallback:()=>me.clear()}),restoreItem:r=>m({ready:h("9.0"),native:()=>new Promise((e,t)=>c().SecureStorage.restoreItem(r,(i,o)=>i?t(new Error(i)):e(o))),fallback:()=>me.getItem(r)})},An={alert:r=>m({ready:h("6.2"),native:()=>new Promise(e=>c().showAlert(r,e)),fallback:()=>{typeof window!="undefined"&&window.alert(r);}}),confirm:r=>m({ready:h("6.2"),native:()=>new Promise(e=>c().showConfirm(r,e)),fallback:()=>typeof window!="undefined"&&window.confirm(r)}),popup:r=>m({ready:h("6.2"),native:()=>new Promise(e=>c().showPopup(r,t=>e(t!=null?t:null))),fallback:()=>{var i;if(typeof window=="undefined")return null;let e=(i=r.buttons)==null?void 0:i.find(o=>o.type==="ok"||o.type==="default"),t=(e==null?void 0:e.id)!=null?String(e.id):null;return r.buttons&&r.buttons.length>1?window.confirm(`${r.title?r.title+`
19
+ `:""}${r.message}`)?t!=null?t:"ok":null:(window.alert(`${r.title?r.title+`
20
+ `:""}${r.message}`),t)}}),prompt:(r,e="")=>Promise.resolve(typeof window=="undefined"?null:window.prompt(r,e))};function En(){return m({ready:h("6.4"),native:()=>new Promise(r=>c().readTextFromClipboard(e=>r(e!=null?e:null))),fallback:()=>dt()})}function In(r){return m({ready:h("6.4"),native:()=>new Promise(e=>{let t=c();t.showScanQrPopup({text:r},i=>(t.closeScanQrPopup(),e(i),true));}),fallback:()=>ut(r)})}function Vn(r,e){h("7.8")&&b(()=>c().shareToStory(r,e));}function Bn(r){return m({ready:h("8.0"),native:()=>new Promise(e=>c().shareMessage(r,e)),fallback:()=>pt(r)})}function Tn(r){return m({ready:h("8.0"),native:()=>new Promise(e=>c().downloadFile(r,e)),fallback:()=>lt(r.url,r.file_name)})}function Rn(r,e){return m({ready:h("8.0"),native:()=>new Promise(t=>c().setEmojiStatus(r,e,t)),fallback:()=>false})}function qn(){return m({ready:h("8.0"),native:()=>new Promise(r=>c().requestEmojiStatusAccess(r)),fallback:()=>false})}function Mn(){return m({ready:h("6.9"),native:()=>new Promise(r=>c().requestWriteAccess(r)),fallback:()=>false})}function Ln(){return m({ready:h("6.9"),native:()=>new Promise(r=>c().requestContact(r)),fallback:()=>false})}function Wn(r){return m({ready:h("9.6"),native:()=>new Promise(e=>c().requestChat(r,e)),fallback:()=>false})}function On(r,e={}){return m({ready:h("6.9"),native:()=>new Promise((t,i)=>c().invokeCustomMethod(r,e,(o,n)=>o?i(new Error(o)):t(n))),fallback:()=>{throw new Error("invokeCustomMethod requires the Telegram app (Bot API 6.9+).")}})}var Hn={init:()=>m({ready:h("7.2"),native:()=>new Promise(r=>c().BiometricManager.init(r)),fallback:()=>{}}),requestAccess:r=>m({ready:h("7.2"),native:()=>new Promise(e=>c().BiometricManager.requestAccess({reason:r},e)),fallback:()=>false}),authenticate:r=>m({ready:h("7.2"),native:()=>new Promise(e=>c().BiometricManager.authenticate({reason:r},(t,i)=>e({authenticated:t,token:i!=null?i:void 0}))),fallback:()=>({authenticated:false})}),updateBiometricToken:r=>m({ready:h("7.2"),native:()=>new Promise(e=>c().BiometricManager.updateBiometricToken(r,e)),fallback:()=>false}),openSettings:()=>{h("7.2")&&b(()=>c().BiometricManager.openSettings());}},Fn={init:()=>m({ready:h("8.0"),native:()=>new Promise(r=>c().LocationManager.init(()=>r())),fallback:()=>{}}),getLocation:()=>m({ready:h("8.0"),native:()=>new Promise(r=>c().LocationManager.getLocation(e=>r(e))),fallback:()=>ct()}),openSettings:()=>{h("8.0")&&b(()=>c().LocationManager.openSettings());}};var er={id:123456789,first_name:"Dev",last_name:"User",username:"dev_user",language_code:"en",is_premium:false},tr={bg_color:"#ffffff",secondary_bg_color:"#f1f1f1",text_color:"#000000",hint_color:"#999999",link_color:"#2678b6",button_color:"#2678b6",button_text_color:"#ffffff",header_bg_color:"#527da3",bottom_bar_bg_color:"#ffffff",accent_text_color:"#168acd",section_bg_color:"#ffffff",section_header_text_color:"#168acd",section_separator_color:"#e7e7e7",subtitle_text_color:"#999999",destructive_text_color:"#cc2929"},ht={bg_color:"#17212b",secondary_bg_color:"#232e3c",text_color:"#f5f5f5",hint_color:"#708499",link_color:"#6ab3f3",button_color:"#5288c1",button_text_color:"#ffffff",header_bg_color:"#17212b",bottom_bar_bg_color:"#17212b",accent_text_color:"#6ab3f3",section_bg_color:"#232e3c",section_header_text_color:"#6ab3f3",section_separator_color:"#ffffff14",subtitle_text_color:"#708499",destructive_text_color:"#ec3942"};function rr(){if(typeof document=="undefined")return ht;let r=document.documentElement,e=getComputedStyle(r),t=(o,n)=>e.getPropertyValue(o).trim()||n,i=t("--color-scheme","dark")==="dark"||t("--background","#0f0f0f")==="#0f0f0f";return {bg_color:t("--background",i?"#0f0f0f":"#ffffff"),secondary_bg_color:t("--secondary",i?"#101010":"#f1f1f1"),text_color:t("--foreground",i?"#f5f5f5":"#000000"),hint_color:t("--muted-foreground",i?"#7a7a7a":"#999999"),link_color:t("--primary",i?"#6ab3f3":"#2678b6"),button_color:t("--primary",i?"#f5f5f5":"#2678b6"),button_text_color:t("--primary-foreground",i?"#262626":"#ffffff"),header_bg_color:t("--background",i?"#0f0f0f":"#ffffff"),bottom_bar_bg_color:t("--background",i?"#0f0f0f":"#ffffff"),accent_text_color:t("--accent-foreground",i?"#6ab3f3":"#168acd"),section_bg_color:t("--card",i?"#101010":"#ffffff"),section_header_text_color:t("--accent-foreground",i?"#6ab3f3":"#168acd"),section_separator_color:t("--border",i?"#ffffff14":"#e7e7e7"),subtitle_text_color:t("--muted-foreground",i?"#7a7a7a":"#999999"),destructive_text_color:t("--destructive",i?"#f16060":"#cc2929")}}function ir(r){return r==="light"?tr:r==="dark"?ht:rr()}function or(r){let e=T(T({},er),r.user),t={user:JSON.stringify(e),auth_date:String(Math.floor(Date.now()/1e3)),hash:"dev_"+Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)};return r.startParam&&(t.start_param=r.startParam),Object.entries(t).map(([i,o])=>`${i}=${encodeURIComponent(o)}`).join("&")}function nr(){try{return typeof location!="undefined"&&location.hash.indexOf("tgWebAppData")!==-1}catch(r){return false}}function sr(r={}){var e,t;return typeof window=="undefined"||nr()&&!r.force||Ae()&&(console.warn("[@core-ease/telegram-kit] installDevMode() was called after the SDK already bootstrapped - call it before any other @core-ease/telegram-kit import touches getWebApp() (hooks, <TelegramProvider>, core functions)."),!r.force)?false:(O.sessionStorageSet("initParams",{tgWebAppData:or(r),tgWebAppVersion:(e=r.version)!=null?e:"8.0",tgWebAppPlatform:(t=r.platform)!=null?t:"tdesktop",tgWebAppThemeParams:JSON.stringify(ir(r.colorScheme))}),st(),ue(),r.showIndicator!==false&&ar(),console.info("%c[@core-ease/telegram-kit] Dev mode active","background:#2678b6;color:#fff;padding:2px 6px;border-radius:3px;font-weight:bold"),true)}function ar(){if(typeof document=="undefined"||document.getElementById("core-ease-telegram-kit-dev-indicator"))return;let r=getComputedStyle(document.documentElement),e=r.getPropertyValue("--primary").trim()||"#2678b6",t=r.getPropertyValue("--primary-foreground").trim()||"#ffffff",i=document.createElement("div");i.id="core-ease-telegram-kit-dev-indicator",i.textContent="@core-ease/telegram-kit dev",i.style.cssText=["position:fixed","bottom:8px","right:8px","z-index:999999",`background:${e}`,`color:${t}`,"font:bold 11px/1 monospace","padding:4px 8px","border-radius:4px","pointer-events:none","opacity:0.85","letter-spacing:0.5px","box-shadow:0 2px 4px rgba(0,0,0,0.2)"].join(";"),document.body.appendChild(i);}function lr(){return typeof window=="undefined"?false:new URLSearchParams(window.location.search).has("tg_dev")}var ke=class{constructor(){this.bits=[];}push(e,t){for(let i=t-1;i>=0;i--)this.bits.push(e>>>i&1);}get length(){return this.bits.length}toCodewords(){var t;let e=[];for(let i=0;i<this.bits.length;i+=8){let o=0;for(let n=0;n<8;n++)o=o<<1|((t=this.bits[i+n])!=null?t:0);e.push(o);}return e}};var ge=new Uint8Array(512),Te=new Uint8Array(256);(function(){let e=1;for(let t=0;t<255;t++)ge[t]=e,Te[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)ge[t]=ge[t-255];})();function Re(r,e){return r===0||e===0?0:ge[Te[r]+Te[e]]}function ft(r){let e=[1];for(let t=0;t<r;t++){let i=new Array(e.length+1).fill(0);for(let o=0;o<e.length;o++)i[o]^=e[o],i[o+1]^=Re(e[o],ge[t]);e=i;}return e}function mt(r,e){let t=ft(e),i=r.slice();for(let o=0;o<e;o++)i.push(0);for(let o=0;o<r.length;o++){let n=i[o];if(n!==0)for(let s=0;s<t.length;s++)i[o+s]^=Re(t[s],n);}return i.slice(r.length)}var cr=["L","M","Q","H"],gt={L:1,M:0,Q:3,H:2},bt=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],vt=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]];function wt(r){return cr.indexOf(r)}function qe(r){return r*4+17}function dr(r){let e=(16*r+128)*r+64;if(r>=2){let t=Math.floor(r/7)+2;e-=(25*t-10)*t-55,r>=7&&(e-=36);}return e}function ur(r){return Math.floor(dr(r)/8)}function _t(r,e){let t=wt(e),i=bt[t][r],o=vt[t][r];return ur(r)-i*o}function yt(r,e){let t=wt(e);return {eccLength:bt[t][r],numBlocks:vt[t][r]}}function kt(r){if(r===1)return [];let e=Math.floor(r/7)+2,t=Math.floor((r*8+e*3+5)/(e*4-4))*2,i=new Array(e),o=r*4+10;for(let n=e-1;n>=1;n--,o-=t)i[n]=o;return i[0]=6,i}var k={NUMERIC:1,ALPHANUMERIC:2,BYTE:4},Ce="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";function pr(r){return /^[0-9]*$/.test(r)}function hr(r){for(let e of r)if(Ce.indexOf(e)===-1)return false;return true}function Ct(r){return pr(r)?k.NUMERIC:hr(r)?k.ALPHANUMERIC:k.BYTE}function Pt(r){return Array.from(new TextEncoder().encode(r))}function St(r,e){return e<=9?r===k.NUMERIC?10:r===k.ALPHANUMERIC?9:8:e<=26?r===k.NUMERIC?12:r===k.ALPHANUMERIC?11:16:r===k.NUMERIC?14:r===k.ALPHANUMERIC?13:16}function xt(r,e){return r===k.BYTE?Pt(e).length:e.length}function At(r,e,t){if(r===k.NUMERIC)for(let i=0;i<e.length;i+=3){let o=e.substring(i,i+3),n=o.length===3?10:o.length===2?7:4;t.push(parseInt(o,10),n);}else if(r===k.ALPHANUMERIC)for(let i=0;i<e.length;i+=2)if(i+1<e.length){let o=Ce.indexOf(e[i])*45+Ce.indexOf(e[i+1]);t.push(o,11);}else t.push(Ce.indexOf(e[i]),6);else for(let i of Pt(e))t.push(i,8);}function Et(r,e,t,i){let o=new ke;o.push(i,4),o.push(xt(i,r),St(i,e)),At(i,r,o);let n=_t(e,t)*8;if(o.length>n)return null;let s=Math.min(4,n-o.length);for(o.push(0,s);o.length%8!==0;)o.bits.push(0);let a=[236,17],u=0;for(;o.length<n;)o.push(a[u%2],8),u++;return o.toCodewords()}function It(r,e,t){let{eccLength:i,numBlocks:o}=yt(e,t),n=r.length,s=Math.floor(n/o),a=n%o,u=o-a,d=[],p=0;for(let g=0;g<u;g++)d.push(r.slice(p,p+s)),p+=s;for(let g=0;g<a;g++)d.push(r.slice(p,p+s+1)),p+=s+1;let v=d.map(g=>mt(g,i));return {dataBlocks:d,eccBlocks:v}}function Vt({dataBlocks:r,eccBlocks:e}){let t=[],i=Math.max(...r.map(n=>n.length));for(let n=0;n<i;n++)for(let s of r)n<s.length&&t.push(s[n]);let o=e[0].length;for(let n=0;n<o;n++)for(let s of e)t.push(s[n]);return t}function Pe(r){return Array.from({length:r},()=>new Array(r).fill(false))}function Me(r,e,t,i){for(let o=-3;o<=3;o++)for(let n=-3;n<=3;n++){let s=t+n,a=i+o,u=Math.max(Math.abs(n),Math.abs(o));r[a][s]=u!==2,e[a][s]=true;}}function fr(r,e,t,i){for(let o=-2;o<=2;o++)for(let n=-2;n<=2;n++){let s=t+n,a=i+o,u=Math.max(Math.abs(n),Math.abs(o));r[a][s]=u!==1,e[a][s]=true;}}function Tt(r,e,t){let i=r.length;Me(r,e,3,3),Me(r,e,i-4,3),Me(r,e,3,i-4);let o=(s,a)=>{s>=0&&s<i&&a>=0&&a<i&&(e[a][s]=true);};for(let s=0;s<8;s++)o(7,s),o(s,7),o(i-8,s),o(i-1-s,7),o(7,i-1-s),o(s,i-8);for(let s=8;s<i-8;s++)r[6][s]=s%2===0,e[6][s]=true,r[s][6]=s%2===0,e[s][6]=true;let n=kt(t);for(let s of n)for(let a of n)a<=8&&s<=8||a>=i-9&&s<=8||a<=8&&s>=i-9||fr(r,e,a,s);r[i-8][8]=true,e[i-8][8]=true;for(let s=0;s<9;s++)s!==6&&(e[8][s]=true,e[s][8]=true);for(let s=0;s<8;s++)e[8][i-1-s]=true,e[i-1-s][8]=true;if(t>=7)for(let s=0;s<6;s++)for(let a=0;a<3;a++)e[i-11+a][s]=true,e[s][i-11+a]=true;}function Rt(r,e,t){let i=r.length,o=0,n=true;for(let s=i-1;s>=1;s-=2){s===6&&(s=5);for(let a=0;a<i;a++){let u=n?i-1-a:a;for(let d=0;d<2;d++){let p=s-d;e[u][p]||o<t.length&&(r[u][p]=t[o]===1,o++);}}n=!n;}}function Le(r,e,t){let i=r.length,o=Pe(i);for(let n=0;n<i;n++)for(let s=0;s<i;s++){if(o[n][s]=r[n][s],e[n][s])continue;let a;switch(t){case 0:a=(s+n)%2===0;break;case 1:a=n%2===0;break;case 2:a=s%3===0;break;case 3:a=(s+n)%3===0;break;case 4:a=(Math.floor(s/3)+Math.floor(n/2))%2===0;break;case 5:a=s*n%2+s*n%3===0;break;case 6:a=(s*n%2+s*n%3)%2===0;break;case 7:a=((s+n)%2+s*n%3)%2===0;break;default:a=false;}a&&(o[n][s]=!o[n][s]);}return o}var mr=[true,false,true,true,true,false,true,false,false,false,false],gr=[false,false,false,false,true,false,true,true,true,false,true];function Bt(r){let e=t=>t.every((i,o)=>i===r[o]);return e(mr)||e(gr)}function qt(r){let e=r.length,t=0,i=s=>{let a=0;for(let u=0;u<e;u++){let d=null,p=0;for(let v=0;v<e;v++){let g=s(u,v);g===d?p++:(p>=5&&(a+=3+(p-5)),d=g,p=1);}p>=5&&(a+=3+(p-5));}return a};t+=i((s,a)=>r[s][a]),t+=i((s,a)=>r[a][s]);for(let s=0;s<e-1;s++)for(let a=0;a<e-1;a++){let u=r[s][a];u===r[s][a+1]&&u===r[s+1][a]&&u===r[s+1][a+1]&&(t+=3);}for(let s=0;s<e;s++)for(let a=0;a<=e-11;a++){let u=[];for(let d=0;d<11;d++)u.push(r[s][a+d]);Bt(u)&&(t+=40);}for(let s=0;s<e;s++)for(let a=0;a<=e-11;a++){let u=[];for(let d=0;d<11;d++)u.push(r[a+d][s]);Bt(u)&&(t+=40);}let o=0;for(let s=0;s<e;s++)for(let a=0;a<e;a++)r[s][a]&&o++;let n=o*100/(e*e);return t+=Math.floor(Math.abs(n-50)/5)*10,t}function br(r,e){let t=gt[r]<<3|e,i=1335,o=t<<10;for(let n=14;n>=10;n--)(o&1<<n)!==0&&(o^=i<<n-10);return (t<<10|o)^21522}function vr(r){let t=r<<12;for(let i=17;i>=12;i--)(t&1<<i)!==0&&(t^=7973<<i-12);return r<<12|t}function Mt(r,e,t){let i=r.length,o=br(e,t),n=u=>(o>>u&1)===1,s=[[8,0],[8,1],[8,2],[8,3],[8,4],[8,5],[8,7],[8,8],[7,8],[5,8],[4,8],[3,8],[2,8],[1,8],[0,8]];for(let u=0;u<15;u++){let[d,p]=s[u];r[d][p]=n(14-u);}let a=[[i-1,8],[i-2,8],[i-3,8],[i-4,8],[i-5,8],[i-6,8],[i-7,8],[8,i-8],[8,i-7],[8,i-6],[8,i-5],[8,i-4],[8,i-3],[8,i-2],[8,i-1]];for(let u=0;u<15;u++){let[d,p]=a[u];r[d][p]=n(14-u);}r[i-8][8]=true;}function Lt(r,e){if(e<7)return;let t=r.length,i=vr(e);for(let o=0;o<18;o++){let n=(i>>o&1)===1,s=Math.floor(o/3),a=o%3;r[t-11+a][s]=n,r[s][t-11+a]=n;}}var wr=1,_r=40;function We(r,e={}){var Fe,Ue,Ke,Ne,Qe;let t=(Fe=e.errorCorrectionLevel)!=null?Fe:"M",i=Ct(r),o=(Ke=(Ue=e.version)!=null?Ue:e.minVersion)!=null?Ke:wr,n=(Qe=(Ne=e.version)!=null?Ne:e.maxVersion)!=null?Qe:_r,s=null,a=null;for(let A=o;A<=n;A++){let C=Et(r,A,t,i);if(C){s=A,a=C;break}}if(s===null||a===null)throw new Error(`[@core-ease/telegram-kit] Unable to encode a QR code: the input is too long for error correction level "${t}"`+(e.version?` at version ${e.version}.`:" within the allowed version range."));let u=It(a,s,t),d=Vt(u),p=[];for(let A of d)for(let C=7;C>=0;C--)p.push(A>>C&1);let v=qe(s),g=Pe(v),y=Pe(v);Tt(g,y,s),Rt(g,y,p);let P=0,x=g;if(typeof e.maskPattern=="number")P=e.maskPattern,x=Le(g,y,P);else {let A=1/0;for(let C=0;C<8;C++){let De=Le(g,y,C),$e=qt(De);$e<A&&(A=$e,P=C,x=De);}}return Mt(x,t,P),Lt(x,s),{modules:x,size:v,version:s,errorCorrectionLevel:t,maskPattern:P}}function Wt(r,e){return We(r,e)}function Ot(r,e={}){let v=e,{size:t=512,color:i="#000000",background:o="#ffffff",quietZone:n=4}=v,s=Ze(v,["size","color","background","quietZone"]),{modules:a}=We(r,s),u=a.length+n*2,d=t/u,p="";for(let g=0;g<a.length;g++)for(let y=0;y<a.length;y++){if(!a[g][y])continue;let P=(y+n)*d,x=(g+n)*d;p+=`M${P} ${x}h${d}v${d}h${-d}z`;}return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${t} ${t}" width="${t}" height="${t}"><rect width="${t}" height="${t}" fill="${o}"/><path d="${p}" fill="${i}"/></svg>`}var be=class{constructor(e){this.raw=e;}toString(){return this.raw}};function yr(r){return r instanceof be}function Ft(r,e){return r.map(t=>yr(t)?t.raw:e(t)).join("")}var kr=/[_*[\]()~`>#+\-=|{}.!\\]/g,Cr=/[`\\]/g,Pr=/[)\\]/g;function Oe(r){return r.replace(kr,e=>`\\${e}`)}function He(r){return r.replace(Cr,e=>`\\${e}`)}function Ht(r){return r.replace(Pr,e=>`\\${e}`)}function Sr(){let r=t=>new be(t),e=t=>Ft(t,Oe);return {escape:Oe,escapeCode:He,escapeLinkUrl:Ht,text:(...t)=>r(e(t)),bold:(...t)=>r(`*${e(t)}*`),italic:(...t)=>r(`_${e(t)}_`),underline:(...t)=>r(`__${e(t)}__`),strikethrough:(...t)=>r(`~${e(t)}~`),spoiler:(...t)=>r(`||${e(t)}||`),code:t=>r(`\`${He(t)}\``),pre:(t,i)=>r(`\`\`\`${i!=null?i:""}
21
+ ${He(t)}
22
+ \`\`\``),link:(t,...i)=>r(`[${e(i)}](${Ht(t)})`),mentionUser:(t,...i)=>r(`[${e(i)}](tg://user?id=${t})`),customEmoji:(t,i)=>r(`![${Oe(i)}](tg://emoji?id=${t})`),raw:t=>r(t)}}function M(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Se(r){return M(r).replace(/"/g,"&quot;")}function xr(){let r=t=>new be(t),e=t=>Ft(t,M);return {escape:M,escapeAttribute:Se,text:(...t)=>r(e(t)),bold:(...t)=>r(`<b>${e(t)}</b>`),italic:(...t)=>r(`<i>${e(t)}</i>`),underline:(...t)=>r(`<u>${e(t)}</u>`),strikethrough:(...t)=>r(`<s>${e(t)}</s>`),spoiler:(...t)=>r(`<tg-spoiler>${e(t)}</tg-spoiler>`),code:t=>r(`<code>${M(t)}</code>`),pre:(t,i)=>r(i?`<pre><code class="language-${Se(i)}">${M(t)}</code></pre>`:`<pre>${M(t)}</pre>`),link:(t,...i)=>r(`<a href="${Se(t)}">${e(i)}</a>`),mentionUser:(t,...i)=>r(`<a href="tg://user?id=${t}">${e(i)}</a>`),blockquote:(...t)=>r(`<blockquote>${e(t)}</blockquote>`),expandableBlockquote:(...t)=>r(`<blockquote expandable>${e(t)}</blockquote>`),customEmoji:(t,i)=>r(`<tg-emoji emoji-id="${Se(t)}">${M(i)}</tg-emoji>`),raw:t=>r(t)}}var ms=Sr(),gs=xr(),bs={MESSAGE:4096,CAPTION:1024,BUTTON_TEXT:64,CALLBACK_DATA:64,START_PARAMETER:64,BOT_DESCRIPTION:512,BOT_SHORT_DESCRIPTION:120,CHAT_TITLE:128,POLL_QUESTION:300,POLL_OPTION:100};function Ar(r){return r>=55296&&r<=56319}function Er(r){return r>=56320&&r<=57343}function vs(r,e,t="\u2026"){if(r.length<=e)return r;let i=Math.max(0,e-t.length);return i>0&&Ar(r.charCodeAt(i-1))&&Er(r.charCodeAt(i))&&(i-=1),r.slice(0,i)+t}function Ir(r){let e="";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Vr(r){let e=r.replace(/-/g,"+").replace(/_/g,"/"),t=e+"=".repeat((4-e.length%4)%4),i=atob(t),o=new Uint8Array(i.length);for(let n=0;n<i.length;n++)o[n]=i.charCodeAt(n);return o}var Br=/^[A-Za-z0-9_-]{1,64}$/;function Tr(r){return Br.test(r)}function Rr(r){let e=Ir(new TextEncoder().encode(r));if(e.length>64)throw new Error(`[@core-ease/telegram-kit] encodeStartParam: the encoded value is ${e.length} characters, exceeding Telegram's 64-character limit for start parameters. Pass a shorter payload (e.g. a numeric/short ID you look up server-side, instead of embedding full data).`);return e}function _s(r){return new TextDecoder().decode(Vr(r))}function Ut(r){if(r.startParam!==void 0&&r.data!==void 0)throw new Error("[@core-ease/telegram-kit] Provide either `startParam` or `data`, not both.");if(r.data!==void 0)return Rr(r.data);if(r.startParam!==void 0){if(!Tr(r.startParam))throw new Error(`[@core-ease/telegram-kit] "${r.startParam}" is not a valid Telegram start parameter (allowed characters: A-Z a-z 0-9 _ -, max 64 chars). Use \`data\` instead to auto-encode arbitrary text.`);return r.startParam}}function ys(r){let e=Ut(r),t=`https://t.me/${r.botUsername}`;return e?`${t}?start=${e}`:t}function ks(r){let e=Ut(r),t=r.appName?`https://t.me/${r.botUsername}/${r.appName}`:`https://t.me/${r.botUsername}`,i=new URLSearchParams;e&&i.set("startapp",e),r.mode&&i.set("mode",r.mode);let o=i.toString();return o?`${t}?${o}`:t}function Cs(r){let e=new URLSearchParams({url:r.url});return r.text&&e.set("text",r.text),`https://t.me/share/url?${e.toString()}`}var qr=new Set(["t.me","telegram.me","telegram.dog"]);function Ps(r){var a,u,d,p;let e;try{e=new URL(r);}catch(v){return {type:"unknown",url:r}}if(e.protocol==="tg:"){let v=e.hostname||e.pathname.replace(/^\/+/,"");if(v==="resolve"){let g=e.searchParams.get("domain"),y=e.searchParams.get("start"),P=e.searchParams.get("startapp"),x=(a=e.searchParams.get("mode"))!=null?a:void 0;if(g&&y)return {type:"bot-start",username:g,startParam:y};if(g&&P!==null)return {type:"mini-app",username:g,startParam:P||void 0,mode:x};if(g)return {type:"profile",username:g}}if(v==="join"){let g=e.searchParams.get("invite");if(g)return {type:"join-chat",inviteHash:g}}return {type:"unknown",url:r}}if(!qr.has(e.hostname))return {type:"unknown",url:r};let t=e.pathname.split("/").filter(Boolean);if(t.length===0)return {type:"unknown",url:r};if(t[0].startsWith("+"))return {type:"join-chat",inviteHash:t[0].slice(1)};if(t[0]==="joinchat"&&t[1])return {type:"join-chat",inviteHash:t[1]};if(t[0]==="share"&&t[1]==="url")return {type:"share",url:(u=e.searchParams.get("url"))!=null?u:void 0,text:(d=e.searchParams.get("text"))!=null?d:void 0};if(t[0]==="c"&&t[1]&&t[2]){let v=Number(t[2]);return {type:"private-channel-post",internalChatId:t[1],messageId:v}}let i=t[0],o=e.searchParams.get("startapp"),n=e.searchParams.get("start"),s=(p=e.searchParams.get("mode"))!=null?p:void 0;return t.length>=2?{type:"mini-app",username:i,appName:t[1],startParam:o!=null?o:void 0,mode:s}:o!==null?{type:"mini-app",username:i,startParam:o||void 0,mode:s}:n!==null?{type:"bot-start",username:i,startParam:n}:{type:"profile",username:i}}var Kt=class r{constructor(){this.rows=[[]];}currentRow(){return this.rows[this.rows.length-1]}add(e){return this.currentRow().push(e),this}text(e,t){return this.add({text:e,callback_data:t})}url(e,t){return this.add({text:e,url:t})}webApp(e,t){return this.add({text:e,web_app:{url:t}})}login(e,t){return this.add({text:e,login_url:typeof t=="string"?{url:t}:t})}switchInline(e,t=""){return this.add({text:e,switch_inline_query:t})}switchInlineCurrentChat(e,t=""){return this.add({text:e,switch_inline_query_current_chat:t})}switchInlineChosenChat(e,t){return this.add({text:e,switch_inline_query_chosen_chat:t!=null?t:{}})}copyText(e,t){return this.add({text:e,copy_text:typeof t=="string"?{text:t}:t})}pay(e="Pay"){return this.add({text:e,pay:true})}callbackGame(e){return this.add({text:e,callback_game:{}})}button(e){return this.add(e)}row(){return this.currentRow().length>0&&this.rows.push([]),this}static columns(e,t){let i=new r;return e.forEach((o,n)=>{n>0&&n%t===0&&i.row(),i.button(o);}),i}build(){return {inline_keyboard:this.rows.filter(t=>t.length>0)}}},Nt=class{constructor(){this.rows=[[]];}currentRow(){return this.rows[this.rows.length-1]}add(e){return this.currentRow().push(e),this}text(e){return this.add({text:e})}requestContact(e){return this.add({text:e,request_contact:true})}requestLocation(e){return this.add({text:e,request_location:true})}requestPoll(e,t){return this.add({text:e,request_poll:{type:t}})}webApp(e,t){return this.add({text:e,web_app:{url:t}})}requestUsers(e,t){return this.add({text:e,request_users:t})}requestChat(e,t){return this.add({text:e,request_chat:t})}button(e){return this.add(e)}row(){return this.currentRow().length>0&&this.rows.push([]),this}build(e={}){var i;return {keyboard:this.rows.filter(o=>o.length>0),resize_keyboard:(i=e.resize)!=null?i:true,one_time_keyboard:e.oneTime,selective:e.selective,input_field_placeholder:e.placeholder,is_persistent:e.persistent}}};function xs(r){return {remove_keyboard:true,selective:r}}function As(r){return {force_reply:true,input_field_placeholder:r==null?void 0:r.placeholder,selective:r==null?void 0:r.selective}}
23
+ exports.InlineKeyboardBuilder=Kt;exports.ReplyKeyboardBuilder=Nt;exports.TELEGRAM_TEXT_LIMITS=bs;exports.TelegramFormattedText=be;exports.addToHomeScreen=yn;exports.biometric=Hn;exports.bootstrapTelegramWebApp=ue;exports.buildShareLink=Cs;exports.buildStartAppLink=ks;exports.buildStartLink=ys;exports.checkHomeScreenStatus=kn;exports.close=un;exports.cloudStorage=Pn;exports.decodeStartParam=_s;exports.deviceStorage=Sn;exports.dialog=An;exports.disableClosingConfirmation=mn;exports.disableVerticalSwipes=bn;exports.downloadFile=Tn;exports.enableClosingConfirmation=fn;exports.enableVerticalSwipes=gn;exports.encodeQRCode=Wt;exports.encodeStartParam=Rr;exports.escapeHTML=M;exports.escapeHTMLAttribute=Se;exports.escapeMarkdownV2=Oe;exports.escapeMarkdownV2Code=He;exports.escapeMarkdownV2LinkUrl=Ht;exports.expand=cn;exports.forceReply=As;exports.fullscreen=pn;exports.getRawUserData=Jt;exports.getTheme=an;exports.getUserAvatarUrl=Yt;exports.getUserDisplayName=Zt;exports.getUserIdentifier=Xt;exports.getUserInfoWithAvatar=en;exports.getViewport=ln;exports.getWebApp=c;exports.haptic=Cn;exports.hideKeyboard=sn;exports.html=gs;exports.installDevMode=sr;exports.invokeCustomMethod=On;exports.isDevMode=lr;exports.isInTelegram=Gt;exports.isValidStartParam=Tr;exports.isVersionAtLeast=zt;exports.location=Fn;exports.md=ms;exports.openExternalLink=tn;exports.openInvoice=on;exports.openTelegramLink=rn;exports.orientation=hn;exports.parseTelegramLink=Ps;exports.qrCodeToSVG=Ot;exports.readClipboard=En;exports.ready=dn;exports.removeKeyboard=xs;exports.requestChat=Wn;exports.requestContact=Ln;exports.requestEmojiStatusAccess=qn;exports.requestWriteAccess=Mn;exports.safeInvoke=b;exports.scanQr=In;exports.sdk=Ee;exports.secureStorage=xn;exports.setBackgroundColor=wn;exports.setBottomBarColor=_n;exports.setEmojiStatus=Rn;exports.setHeaderColor=vn;exports.shareMessage=Bn;exports.shareToStory=Vn;exports.switchInlineQuery=nn;exports.truncateText=vs;return exports;})({});
@@ -0,0 +1,40 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
22
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
23
+ }) : x)(function(x) {
24
+ if (typeof require !== "undefined") return require.apply(this, arguments);
25
+ throw Error('Dynamic require of "' + x + '" is not supported');
26
+ });
27
+ var __objRest = (source, exclude) => {
28
+ var target = {};
29
+ for (var prop in source)
30
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
31
+ target[prop] = source[prop];
32
+ if (source != null && __getOwnPropSymbols)
33
+ for (var prop of __getOwnPropSymbols(source)) {
34
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
35
+ target[prop] = source[prop];
36
+ }
37
+ return target;
38
+ };
39
+
40
+ export { __objRest, __require, __spreadProps, __spreadValues };
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { createAnimationPlayerComponent } from './chunk-BQEUEAVK.mjs';
3
+ import { __spreadProps, __spreadValues } from './chunk-PXO36YTU.mjs';
4
+ import * as React from 'react';
5
+ import { jsx } from 'react/jsx-runtime';
6
+
7
+ var BaseAnimationPlayer = createAnimationPlayerComponent("LottiePlayer", "Lottie animation");
8
+ var LottiePlayer = React.forwardRef(
9
+ function LottiePlayer2(props, ref) {
10
+ return /* @__PURE__ */ jsx(BaseAnimationPlayer, __spreadProps(__spreadValues({}, props), { ref }));
11
+ }
12
+ );
13
+ LottiePlayer.displayName = "LottiePlayer";
14
+
15
+ export { LottiePlayer };