1var N=Object.defineProperty;var C=(t,e,s)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var l=(t,e,s)=>C(t,typeof e!="symbol"?e+"":e,s);import{rn as R,ro as O,iq as h,rp as I,rq as p,rr as f,rs as _,rt as P,bu as T,bD as g,ru as S,rv as m,rw as y,rx as b,ry as A,rz as v,rA as k}from"./commonChunk.Dhe5lqYh.js";import{t as x,c as L,n as E,s as M,a as D}from"./login.DY633dcM.js";import{o as w,s as G,c as q}from"./dialog.C76Boikc.js";import{z as F}from"../vendors/vendor-stable.B8ub4Ug6.js";import"./vendorChunk.BdsO83GQ.js";import"../vendors/vendor-swiper.T_wbf2QY.js";import"./0_EntryLoginRegisterChunk.CH23XrmN.js";class B{constructor(e,s){l(this,"message");l(this,"code");this.message=e,this.code=s}}const oe=O(),re=h(),ne=I(),{OAUTH_START_PARAM_KEY:H,START_PARAM_KEY:K,OAUTH_TYPE:Q,REFERENCE:U}=P,u=(t,e)=>{try{A()?window.TelegramWebviewProxy.postEvent(t,JSON.stringify(e||{})):window.self!==window.top&&window.parent.postMessage(JSON.stringify({eventType:t,eventData:e}),"https://web.telegram.org")}catch(s){}},W=()=>{if(!y())return b();localStorage.clear(),sessionStorage.clear(),location.href=location.origin,A()&&window.close()},Y=async t=>{var s;const e=p.loginProcess.key;try{const o=f();if(_(e,{execute:!0}),!o.token)throw new Error("Token Is Not Found");const{success:n,message:a,code:r}=await x({requester_type:o.oauthType===Q.OPEN_HASH?T.TG_MICRO_APPLICATION_OPEN:T.TG_MICRO_APPLICATION,access_token:o.token,...t});if(!n)throw new B(a,r);if(_(e,{status:!0}),(s=o.modal)!=null&&s.name){const{modal:{name:c,options:i}}=o;w(c,i)}return!0}catch(o){const{message:n="Application Error",code:a="Unknown Code"}=o||{};switch(a){case g.TG_MICRO_APPLICATION_NEED_CURRENCY_FIRST:{const r=n.split(",");return new Promise(c=>{w("switchCurrency",{options:{toRoot:!1,showCloseButton:!1,closeOnRouteChange:!1,checkedIcon:!1,onSelect(i){c(Y({...t,currency:i.currencyCode}))},modifyCurrencyList(i){return i.filter(d=>r.includes(d.currencyCode))}}})})}case g.TGMA_LOGIN_NEED_REGISTER_OR_BIND_FIRST:default:{const r=[g.TGMA_LOGIN_NEED_REGISTER_OR_BIND_FIRST].includes(a),c=r?n:`${n},${a}`;G({error:c,onConfirm:()=>W(),isSomeErrorText:!r})}}return _(e,{status:null}),!1}},ae=()=>{var n,a;const t=p.navigationProcess.key,e=f(),s=(n=e.route)==null?void 0:n.name,o=(a=e.route)==null?void 0:a.query;!s||S(t).execute||(_(t,{execute:!0}),m(p.loginProcess.key,(r,c)=>{if(r.status){const i=L(s,o);i.navigate?i.navigate():E({name:s})}else r.status===null&&c()}))},z=()=>{if(!y()){try{u("web_app_expand"),u("web_app_request_safe_area"),u("web_app_request_content_safe_area"),u("web_app_setup_closing_behavior",{need_confirmation:!0}),u("web_app_setup_swipe_behavior",{allow_vertical_swipe:!1}),M()}catch(e){}D(({href:e})=>{u("web_app_open_link",{url:e})})}const t=q().forbidAutoDialog();m(p.loginProcess.key,(e,s)=>{e.status!==!1&&s(),e.status===!0&&(t==null||t())})},J=()=>{const t=v(),e={...F(t,K,H),[U]:k.APP_NAME};setTimeout(()=>{E({query:e,replace:!0})})},ie=async()=>{J(),z()},ce=R;export{oe as client,W as exit,ie as init,Y as loginProcess,ae as navigationProcess,ce as openExternalLink,re as webApp,ne as webView};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.