diff --git a/docs/assets/index-07c9b5b2.js b/docs/assets/index-61376d1f.js similarity index 99% rename from docs/assets/index-07c9b5b2.js rename to docs/assets/index-61376d1f.js index 24be611..6e5ee3b 100644 --- a/docs/assets/index-07c9b5b2.js +++ b/docs/assets/index-61376d1f.js @@ -1057,7 +1057,7 @@ PERFORMANCE OF THIS SOFTWARE. font-weight: 590; `;styled(TabBar)` margin: 0 auto 22px; -`;const[appState,setAppState]=createStore({buttonRootId:null,language:"en",returnStrategy:"back",twaReturnUrl:void 0,walletsListConfiguration:{},enableAndroidBackHandler:!0});function uniq(b){return[...new Set(b)]}function mergeConcat(b,_,d){return _.map(k=>{const j=d.find($=>$[b]===k[b]);return d=d.filter($=>$[b]!==k[b]),j===void 0?k:j}).concat(d)}function uiWalletToWalletInfo(b){return"jsBridgeKey"in b?__spreadProps(__spreadValues$1({},b),{injected:TonConnect.isWalletInjected(b.jsBridgeKey),embedded:TonConnect.isInsideWalletBrowser(b.jsBridgeKey)}):b}function applyWalletsListConfiguration(b,_){var d;return _&&(d=_.includeWallets)!=null&&d.length&&(b=mergeConcat("name",b,_.includeWallets.map(uiWalletToWalletInfo))),b}function supportsDesktop(b){return b.platforms.some(_=>["macos","linux","windows"].includes(_))}function supportsMobile(b){return b.platforms.some(_=>["ios","android"].includes(_))}function supportsExtension(b){return b.platforms.some(_=>["chrome","firefox","safari"].includes(_))}function eqWalletName(b,_){return _?b.name.toLowerCase()===_.toLowerCase()||b.appName.toLowerCase()===_.toLowerCase():!1}const DesktopSelectWalletModalStyled=styled.div` +`;const[appState,setAppState]=createStore({buttonRootId:null,language:"en",returnStrategy:"back",twaReturnUrl:void 0,walletsListConfiguration:{},enableAndroidBackHandler:!0});function uniq(b){return[...new Set(b)]}function mergeConcat(b,_,d){return _.map(k=>{const j=d.find($=>$[b]===k[b]);return d=d.filter($=>$[b]!==k[b]),j===void 0?k:j}).concat(d)}function uiWalletToWalletInfo(b){return"jsBridgeKey"in b?__spreadProps(__spreadValues$1({},b),{injected:TonConnect.isWalletInjected(b.jsBridgeKey),embedded:TonConnect.isInsideWalletBrowser(b.jsBridgeKey)}):b}function applyWalletsListConfiguration(b,_){var d,k;if(!_)return b;if((d=_.includeWallets)!=null&&d.length&&(b=mergeConcat("name",b,_.includeWallets.map(uiWalletToWalletInfo))),(k=_.customOrder)!=null&&k.length){const j=[...new Set(_.customOrder)],$=j.map(tt=>b.find(rt=>rt.appName===tt)).filter(tt=>tt!==void 0),et=b.filter(tt=>!j.includes(tt.appName));b=[...$,...et]}return b}function supportsDesktop(b){return b.platforms.some(_=>["macos","linux","windows"].includes(_))}function supportsMobile(b){return b.platforms.some(_=>["ios","android"].includes(_))}function supportsExtension(b){return b.platforms.some(_=>["chrome","firefox","safari"].includes(_))}function eqWalletName(b,_){return _?b.name.toLowerCase()===_.toLowerCase()||b.appName.toLowerCase()===_.toLowerCase():!1}const DesktopSelectWalletModalStyled=styled.div` display: flex; flex-direction: column; align-items: center; @@ -1451,7 +1451,7 @@ PERFORMANCE OF THIS SOFTWARE. width: 16px; `,ButtonStyled=styled(Button)` margin-top: 32px; -`,ActionModal=b=>{const _=useDataAttributes(b),d=useContext(TonConnectUiContext),[k,j]=createSignal(!0),[$,et]=createSignal(!1);createEffect(()=>{const ot=action();et(!!ot&&"sent"in ot&&ot.sent)});let tt;d!=null&&d.wallet&&"universalLink"in d.wallet&&(d.wallet.openMethod==="universal-link"||isTelegramUrl(d.wallet.universalLink)&&isInTMA())&&(tt=d.wallet.universalLink);let rt;d!=null&&d.wallet&&"deepLink"in d.wallet&&(d.wallet.openMethod==="custom-deeplink"||isTelegramUrl(d.wallet.deepLink)&&isInTMA())&&(rt=d.wallet.deepLink);const nt=()=>{const ot=action(),at="returnStrategy"in ot?ot.returnStrategy:appState.returnStrategy,it=!k();j(!1),isTelegramUrl(tt)?redirectToTelegram(tt,{returnStrategy:at,twaReturnUrl:"twaReturnUrl"in ot?ot.twaReturnUrl:appState.twaReturnUrl,forceRedirect:it}):redirectToWallet(tt,rt,{returnStrategy:at,forceRedirect:it},()=>{})};return createComponent(ActionModalStyled,mergeProps(_,{get children(){return[createMemo(()=>b.icon),createComponent(H1Styled,{get translationKey(){return b.headerTranslationKey},get translationValues(){return b.headerTranslationValues}}),createComponent(TextStyled,{get translationKey(){return b.textTranslationKey},get translationValues(){return b.textTranslationValues}}),createComponent(Show,{get when(){return!$()&&(b.showButton==="open-wallet"&&tt||b.showButton!=="open-wallet")},get children(){return createComponent(LoaderButtonStyled,{disabled:!0,"data-tc-connect-button-loading":"true",get children(){return createComponent(LoaderIconStyled,{})}})}}),createComponent(Show,{get when(){return $()},get children(){return[createComponent(Show,{get when(){return b.showButton!=="open-wallet"},get children(){return createComponent(ButtonStyled,{onClick:()=>b.onClose(),get children(){return createComponent(Translation,{translationKey:"common.close",children:"Close"})}})}}),createComponent(Show,{get when(){return b.showButton==="open-wallet"&&tt},get children(){return createComponent(ButtonStyled,{onClick:nt,get children(){return createComponent(Translation,{translationKey:"common.openWallet",children:"Open wallet"})}})}})]}})]}}))},ConfirmTransactionModal=b=>{const _=useContext(TonConnectUiContext),[d]=useI18n(),k=()=>_.wallet&&"name"in _.wallet?_.wallet.name:d("common.yourWallet",{},"Your wallet");return createComponent(ActionModal,{headerTranslationKey:"actionModal.confirmTransaction.header",get headerTranslationValues(){return{name:k()}},textTranslationKey:"actionModal.confirmTransaction.text",get icon(){return createComponent(LoaderIcon,{size:"m"})},onClose:()=>b.onClose(),showButton:"open-wallet","data-tc-confirm-modal":"true"})},TransactionCanceledModal=b=>createComponent(ActionModal,{headerTranslationKey:"actionModal.transactionCanceled.header",textTranslationKey:"actionModal.transactionCanceled.text",get icon(){return createComponent(ErrorIcon,{size:"m"})},onClose:()=>b.onClose(),"data-tc-transaction-canceled-modal":"true"}),TransactionSentModal=b=>createComponent(ActionModal,{headerTranslationKey:"actionModal.transactionSent.header",textTranslationKey:"actionModal.transactionSent.text",get icon(){return createComponent(SuccessIcon,{size:"m"})},onClose:()=>b.onClose(),"data-tc-transaction-sent-modal":"true"}),ActionsModal=()=>createComponent(Modal,{get opened(){var b;return createMemo(()=>action()!==null)()&&((b=action())==null?void 0:b.openModal)===!0},get enableAndroidBackHandler(){return appState.enableAndroidBackHandler},onClose:()=>setAction(null),"data-tc-actions-modal-container":"true",get children(){return createComponent(Switch,{get children(){return[createComponent(Match,{get when(){return action().name==="transaction-sent"},get children(){return createComponent(TransactionSentModal,{onClose:()=>setAction(null)})}}),createComponent(Match,{get when(){return action().name==="transaction-canceled"},get children(){return createComponent(TransactionCanceledModal,{onClose:()=>setAction(null)})}}),createComponent(Match,{get when(){return action().name==="confirm-transaction"},get children(){return createComponent(ConfirmTransactionModal,{onClose:()=>setAction(null)})}})]}})}}),SingleWalletModal=()=>{const{locale:b}=useI18n()[1];createEffect(()=>b(appState.language)),createEffect(()=>{getSingleWalletModalIsOpened()&&updateIsMobile()});const _=useContext(ConnectorContext),d=useContext(TonConnectUiContext),[k,j]=createSignal(!1),$=()=>{var nt;return((nt=appState.connectRequestParameters)==null?void 0:nt.state)==="loading"},et=createMemo(()=>{var nt;if(!$())return(nt=appState.connectRequestParameters)==null?void 0:nt.value}),tt=nt=>{d.closeSingleWalletModal(nt)},rt=_.onStatusChange(nt=>{nt&&tt("wallet-selected")});return onCleanup(rt),onCleanup(()=>{j(!1)}),createComponent(StyledModal,{get opened(){return getSingleWalletModalIsOpened()},get enableAndroidBackHandler(){return appState.enableAndroidBackHandler},onClose:()=>tt("action-cancelled"),onClickQuestion:()=>j(nt=>!nt),"data-tc-wallets-modal-container":"true",get children(){return[createComponent(Show,{get when(){return k()},get children(){return createComponent(InfoModal,{onBackClick:()=>j(!1)})}}),createComponent(Show,{get when(){return!k()},get children(){return[createComponent(Show,{get when(){return $()},get children(){return[createComponent(H1Styled$8,{translationKey:"walletModal.loading",children:"Wallets list is loading"}),createComponent(LoaderContainerStyled,{get children(){return createComponent(LoaderIcon,{size:"m"})}})]}}),createComponent(Show,{get when(){return!$()},get children(){return createComponent(Dynamic,{get component(){return isMobile()?MobileConnectionModal:DesktopConnectionModal},get wallet(){return getSingleWalletModalWalletInfo()},get additionalRequest(){return et()},onBackClick:()=>{},backDisabled:!0})}})]}})]}})},App$1=b=>{const _=createI18nContext(i18nDictionary,appState.language);return defineStylesRoot(),fixMobileSafariActiveTransition(),createComponent(I18nContext.Provider,{value:_,get children(){return createComponent(TonConnectUiContext.Provider,{get value(){return b.tonConnectUI},get children(){return createComponent(ConnectorContext.Provider,{get value(){return appState.connector},get children(){return[createComponent(GlobalStyles,{}),createComponent(ThemeProvider,{theme:themeState,get children(){return[createComponent(Show,{get when(){return appState.buttonRootId},get children(){return createComponent(Portal,{get mount(){return document.getElementById(appState.buttonRootId)},get children(){return createComponent(AccountButton,{})}})}}),createComponent(Dynamic,{component:globalStylesTag,get children(){return[createComponent(WalletsModal,{}),createComponent(SingleWalletModal,{}),createComponent(ActionsModal,{})]}})]}})]}})}})}})},widgetController={openWalletsModal:()=>void setTimeout(()=>setWalletsModalState({status:"opened",closeReason:null})),closeWalletsModal:b=>void setTimeout(()=>setWalletsModalState({status:"closed",closeReason:b})),openSingleWalletModal:b=>{setTimeout(()=>setSingleWalletModalState({status:"opened",closeReason:null,walletInfo:b}))},closeSingleWalletModal:b=>void setTimeout(()=>setSingleWalletModalState({status:"closed",closeReason:b})),setAction:b=>void setTimeout(()=>setAction(b)),clearAction:()=>void setTimeout(()=>setAction(null)),getSelectedWalletInfo:()=>lastSelectedWalletInfo(),removeSelectedWalletInfo:()=>setLastSelectedWalletInfo(null),renderApp:(b,_)=>render(()=>createComponent(App$1,{tonConnectUI:_}),document.getElementById(b))};class WalletsModalManager{constructor(_){__publicField(this,"connector"),__publicField(this,"setConnectRequestParametersCallback"),__publicField(this,"consumers",[]),__publicField(this,"tracker"),__publicField(this,"state",walletsModalState()),this.connector=_.connector,this.tracker=_.tracker,this.setConnectRequestParametersCallback=_.setConnectRequestParametersCallback,createEffect(()=>{const d=walletsModalState();this.state=d,this.consumers.forEach(k=>k(d))})}open(){return __async(this,null,function*(){this.tracker.trackConnectionStarted();const d=(yield this.connector.getWallets()).find(isWalletInfoCurrentlyEmbedded);return d?this.connectEmbeddedWallet(d):this.openWalletsModal()})}close(_="action-cancelled"){_==="action-cancelled"&&this.tracker.trackConnectionError("Connection was cancelled"),widgetController.closeWalletsModal(_)}onStateChange(_){return this.consumers.push(_),()=>{this.consumers=this.consumers.filter(d=>d!==_)}}connectEmbeddedWallet(_){const d=j=>{setLastSelectedWalletInfo(_),this.connector.connect({jsBridgeKey:_.jsBridgeKey},j)},k=appState.connectRequestParameters;(k==null?void 0:k.state)==="loading"?this.setConnectRequestParametersCallback(d):d(k==null?void 0:k.value)}openWalletsModal(){return __async(this,null,function*(){return isInTMA()&&sendExpand(),widgetController.openWalletsModal(),new Promise(_=>{const d=this.onStateChange(k=>{const{status:j}=k;j==="opened"&&(d(),_())})})})}}class TransactionModalManager{constructor(_){__publicField(this,"connector"),__publicField(this,"consumers",[]),this.connector=_.connector,createEffect(()=>{const d=action();this.consumers.forEach(k=>k(d))})}onStateChange(_){return this.consumers.push(_),()=>{this.consumers=this.consumers.filter(d=>d!==_)}}}class SingleWalletModalManager{constructor(_){__publicField(this,"connector"),__publicField(this,"setConnectRequestParametersCallback"),__publicField(this,"consumers",[]),__publicField(this,"tracker"),__publicField(this,"state",singleWalletModalState()),this.connector=_.connector,this.tracker=_.tracker,this.setConnectRequestParametersCallback=_.setConnectRequestParametersCallback,createEffect(()=>{const d=singleWalletModalState();this.state=d,this.consumers.forEach(k=>k(d))})}open(_){return __async(this,null,function*(){this.tracker.trackConnectionStarted();const d=yield this.connector.getWallets(),k=applyWalletsListConfiguration(d,appState.walletsListConfiguration),j=k.find(isWalletInfoCurrentlyEmbedded);if(!!j)return this.connectEmbeddedWallet(j);const tt=k.filter(isWalletInfoRemote).find(ot=>eqWalletName(ot,_));if(!!tt)return this.openSingleWalletModal(tt);const nt=`Trying to open modal window with unknown wallet "${_}".`;throw this.tracker.trackConnectionError(nt),new TonConnectUIError(nt)})}close(_="action-cancelled"){_==="action-cancelled"&&this.tracker.trackConnectionError("Connection was cancelled"),widgetController.closeSingleWalletModal("action-cancelled")}onStateChange(_){return this.consumers.push(_),()=>{this.consumers=this.consumers.filter(d=>d!==_)}}connectEmbeddedWallet(_){const d=j=>{setLastSelectedWalletInfo(_),this.connector.connect({jsBridgeKey:_.jsBridgeKey},j)},k=appState.connectRequestParameters;(k==null?void 0:k.state)==="loading"?this.setConnectRequestParametersCallback(d):d(k==null?void 0:k.value)}openSingleWalletModal(_){return __async(this,null,function*(){return isInTMA()&&sendExpand(),widgetController.openSingleWalletModal(_),new Promise(d=>{const k=this.onStateChange(j=>{const{status:$}=j;$==="opened"&&(k(),d())})})})}}class TonConnectUITracker{constructor(_){__publicField(this,"eventPrefix","ton-connect-ui-"),__publicField(this,"tonConnectUiVersion"),__publicField(this,"tonConnectSdkVersion",null),__publicField(this,"eventDispatcher");var d;this.eventDispatcher=(d=_==null?void 0:_.eventDispatcher)!=null?d:new BrowserEventDispatcher,this.tonConnectUiVersion=_.tonConnectUiVersion,this.init().catch()}get version(){return createVersionInfo({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return __async(this,null,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectSdkVersion=yield this.requestTonConnectSdkVersion()}catch{}})}setRequestVersionHandler(){return __async(this,null,function*(){yield this.eventDispatcher.addEventListener("ton-connect-ui-request-version",()=>__async(this,null,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-ui-response-version",createResponseVersionEvent(this.tonConnectUiVersion))}))})}requestTonConnectSdkVersion(){return __async(this,null,function*(){return new Promise((_,d)=>__async(this,null,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-response-version",k=>{_(k.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-request-version",createRequestVersionEvent())}catch(k){d(k)}}))})}dispatchUserActionEvent(_){var d;try{(d=this.eventDispatcher)==null||d.dispatchEvent(`${this.eventPrefix}${_.type}`,_).catch()}catch{}}trackConnectionStarted(..._){try{const d=createConnectionStartedEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}trackConnectionCompleted(..._){try{const d=createConnectionCompletedEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}trackConnectionError(..._){try{const d=createConnectionErrorEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}trackConnectionRestoringStarted(..._){try{const d=createConnectionRestoringStartedEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}trackConnectionRestoringCompleted(..._){try{const d=createConnectionRestoringCompletedEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}trackConnectionRestoringError(..._){try{const d=createConnectionRestoringErrorEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}trackDisconnection(..._){try{const d=createDisconnectionEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}trackTransactionSentForSignature(..._){try{const d=createTransactionSentForSignatureEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}trackTransactionSigned(..._){try{const d=createTransactionSignedEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}trackTransactionSigningFailed(..._){try{const d=createTransactionSigningFailedEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}}const tonConnectUiVersion="2.0.10-beta.0";class TonConnectUI{constructor(_){if(__publicField(this,"walletInfoStorage",new WalletInfoStorage),__publicField(this,"preferredWalletStorage",new PreferredWalletStorage),__publicField(this,"tracker"),__publicField(this,"walletInfo",null),__publicField(this,"systemThemeChangeUnsubscribe",null),__publicField(this,"actionsConfiguration"),__publicField(this,"walletsList"),__publicField(this,"connectRequestParametersCallback"),__publicField(this,"connector"),__publicField(this,"modal"),__publicField(this,"singleWalletModal"),__publicField(this,"transactionModal"),__publicField(this,"connectionRestored",Promise.resolve(!1)),_&&"connector"in _&&_.connector)this.connector=_.connector;else if(_&&"manifestUrl"in _&&_.manifestUrl)this.connector=new TonConnect({manifestUrl:_.manifestUrl,eventDispatcher:_==null?void 0:_.eventDispatcher});else throw new TonConnectUIError("You have to specify a `manifestUrl` or a `connector` in the options.");this.tracker=new TonConnectUITracker({eventDispatcher:_==null?void 0:_.eventDispatcher,tonConnectUiVersion}),this.modal=new WalletsModalManager({connector:this.connector,tracker:this.tracker,setConnectRequestParametersCallback:j=>{this.connectRequestParametersCallback=j}}),this.singleWalletModal=new SingleWalletModalManager({connector:this.connector,tracker:this.tracker,setConnectRequestParametersCallback:j=>{this.connectRequestParametersCallback=j}}),this.transactionModal=new TransactionModalManager({connector:this.connector}),this.walletsList=this.getWallets(),this.walletsList.then(j=>preloadImages(uniq(j.map($=>$.imageUrl))));const d=this.normalizeWidgetRoot(_==null?void 0:_.widgetRootId);this.subscribeToWalletChange(),(_==null?void 0:_.restoreConnection)!==!1&&(this.connectionRestored=createMacrotaskAsync(()=>__async(this,null,function*(){return this.tracker.trackConnectionRestoringStarted(),yield this.connector.restoreConnection(),this.connector.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):(this.tracker.trackConnectionRestoringError("Connection was not restored"),this.walletInfoStorage.removeWalletInfo()),this.connector.connected}))),this.uiOptions=mergeOptions(_,{uiPreferences:{theme:"SYSTEM"}});const k=this.preferredWalletStorage.getPreferredWalletAppName();setAppState({connector:this.connector,preferredWalletAppName:k}),widgetController.renderApp(d,this)}static getWallets(){return TonConnect.getWallets()}get connected(){return this.connector.connected}get account(){return this.connector.account}get wallet(){return this.connector.wallet?__spreadValues$1(__spreadValues$1({},this.connector.wallet),this.walletInfo):null}set uiOptions(_){var d,k,j,$,et;this.checkButtonRootExist(_.buttonRootId),this.actionsConfiguration=_.actionsConfiguration,(d=_.uiPreferences)!=null&&d.theme?((k=_.uiPreferences)==null?void 0:k.theme)!=="SYSTEM"?((j=this.systemThemeChangeUnsubscribe)==null||j.call(this),setTheme(_.uiPreferences.theme,_.uiPreferences.colorsSet)):(setTheme(getSystemTheme(),_.uiPreferences.colorsSet),this.systemThemeChangeUnsubscribe||(this.systemThemeChangeUnsubscribe=subscribeToThemeChange(setTheme))):($=_.uiPreferences)!=null&&$.colorsSet&&setColors(_.uiPreferences.colorsSet),(et=_.uiPreferences)!=null&&et.borderRadius&&setBorderRadius(_.uiPreferences.borderRadius),setAppState(tt=>{var rt,nt;const ot=mergeOptions(__spreadValues$1(__spreadValues$1(__spreadValues$1(__spreadValues$1({},_.language&&{language:_.language}),!!((rt=_.actionsConfiguration)!=null&&rt.returnStrategy)&&{returnStrategy:_.actionsConfiguration.returnStrategy}),!!((nt=_.actionsConfiguration)!=null&&nt.twaReturnUrl)&&{twaReturnUrl:_.actionsConfiguration.twaReturnUrl}),!!_.walletsListConfiguration&&{walletsListConfiguration:_.walletsListConfiguration}),unwrap(tt));return _.buttonRootId!==void 0&&(ot.buttonRootId=_.buttonRootId),_.enableAndroidBackHandler!==void 0&&(ot.enableAndroidBackHandler=_.enableAndroidBackHandler),ot})}setConnectRequestParameters(_){var d;setAppState({connectRequestParameters:_}),((_==null?void 0:_.state)==="ready"||!_)&&((d=this.connectRequestParametersCallback)==null||d.call(this,_==null?void 0:_.value))}getWallets(){return __async(this,null,function*(){return this.connector.getWallets()})}onStatusChange(_,d){return this.connector.onStatusChange(k=>__async(this,null,function*(){if(k){const j=yield this.getSelectedWalletInfo(k);_(__spreadValues$1(__spreadValues$1({},k),j||this.walletInfoStorage.getWalletInfo()))}else _(k)}),d)}openModal(){return __async(this,null,function*(){return this.modal.open()})}closeModal(_){this.modal.close(_)}onModalStateChange(_){return this.modal.onStateChange(_)}get modalState(){return this.modal.state}openSingleWalletModal(_){return __async(this,null,function*(){return this.singleWalletModal.open(_)})}closeSingleWalletModal(_){this.singleWalletModal.close(_)}onSingleWalletModalStateChange(_){return this.singleWalletModal.onStateChange(_)}get singleWalletModalState(){return this.singleWalletModal.state}connectWallet(){return __async(this,null,function*(){const d=(yield this.getWallets()).find(isWalletInfoCurrentlyEmbedded);return d?yield this.connectEmbeddedWallet(d):yield this.connectExternalWallet()})}disconnect(){return this.tracker.trackDisconnection(this.wallet,"dapp"),widgetController.clearAction(),widgetController.removeSelectedWalletInfo(),this.walletInfoStorage.removeWalletInfo(),this.connector.disconnect()}sendTransaction(_,d){return __async(this,null,function*(){if(this.tracker.trackTransactionSentForSignature(this.wallet,_),!this.connected)throw this.tracker.trackTransactionSigningFailed(this.wallet,_,"Wallet was not connected"),new TonConnectUIError("Connect wallet to send a transaction.");isInTMA()&&sendExpand();const{notifications:k,modals:j,returnStrategy:$,twaReturnUrl:et,skipRedirectToWallet:tt}=this.getModalsAndNotificationsConfiguration(d);widgetController.setAction({name:"confirm-transaction",showNotification:k.includes("before"),openModal:j.includes("before"),sent:!1});const rt=()=>{nt.signal.aborted||(widgetController.setAction({name:"confirm-transaction",showNotification:k.includes("before"),openModal:j.includes("before"),sent:!0}),this.walletInfo&&"universalLink"in this.walletInfo&&(this.walletInfo.openMethod==="universal-link"||this.walletInfo.openMethod==="custom-deeplink")&&(isTelegramUrl(this.walletInfo.universalLink)?redirectToTelegram(this.walletInfo.universalLink,{returnStrategy:$,twaReturnUrl:et||appState.twaReturnUrl,forceRedirect:!1}):redirectToWallet(this.walletInfo.universalLink,this.walletInfo.deepLink,{returnStrategy:$,forceRedirect:!1},()=>{})))},nt=new AbortController,ot=this.onTransactionModalStateChange(at=>{at!=null&&at.openModal||(ot(),at||nt.abort())});try{const at=yield this.waitForSendTransaction({transaction:_,signal:nt.signal},rt);return this.tracker.trackTransactionSigned(this.wallet,_,at),widgetController.setAction({name:"transaction-sent",showNotification:k.includes("success"),openModal:j.includes("success")}),at}catch(at){throw widgetController.setAction({name:"transaction-canceled",showNotification:k.includes("error"),openModal:j.includes("error")}),at instanceof TonConnectError?at:(console.error(at),new TonConnectUIError("Unhandled error:"+at))}finally{ot()}})}connectEmbeddedWallet(_){return __async(this,null,function*(){const d=j=>{setLastSelectedWalletInfo(_),this.connector.connect({jsBridgeKey:_.jsBridgeKey},j)},k=appState.connectRequestParameters;return(k==null?void 0:k.state)==="loading"?this.connectRequestParametersCallback=d:d(k==null?void 0:k.value),yield this.waitForWalletConnection({ignoreErrors:!1})})}connectExternalWallet(){return __async(this,null,function*(){const _=new AbortController;widgetController.openWalletsModal();const d=this.onModalStateChange(k=>{const{status:j,closeReason:$}=k;j!=="opened"&&(d(),$==="action-cancelled"&&_.abort())});return yield this.waitForWalletConnection({ignoreErrors:!0,signal:_.signal})})}waitForWalletConnection(_){return __async(this,null,function*(){return new Promise((d,k)=>{this.tracker.trackConnectionStarted();const{ignoreErrors:j=!1,signal:$=null}=_;if($&&$.aborted)return this.tracker.trackConnectionError("Connection was cancelled"),k(new TonConnectUIError("Wallet was not connected"));const et=nt=>__async(this,null,function*(){if(nt)this.tracker.trackConnectionCompleted(nt),rt(),d(nt);else{if(this.tracker.trackConnectionError("Connection was cancelled"),j)return;rt(),k(new TonConnectUIError("Wallet was not connected"))}}),tt=nt=>{this.tracker.trackConnectionError(nt.message),!j&&(rt(),k(nt))},rt=this.onStatusChange(nt=>et(nt),nt=>tt(nt));$&&$.addEventListener("abort",()=>{rt(),k(new TonConnectUIError("Wallet was not connected"))},{once:!0})})})}waitForSendTransaction(_,d){return __async(this,null,function*(){return new Promise((k,j)=>{const{transaction:$,signal:et}=_;if(et.aborted)return this.tracker.trackTransactionSigningFailed(this.wallet,$,"Transaction was cancelled"),j(new TonConnectUIError("Transaction was not sent"));const tt=ot=>__async(this,null,function*(){k(ot)}),rt=ot=>{j(ot)},nt=()=>{this.tracker.trackTransactionSigningFailed(this.wallet,$,"Transaction was cancelled"),j(new TonConnectUIError("Transaction was not sent"))};et.addEventListener("abort",nt,{once:!0}),this.connector.sendTransaction($,{onRequestSent:d,signal:et}).then(ot=>(et.removeEventListener("abort",nt),tt(ot))).catch(ot=>(et.removeEventListener("abort",nt),rt(ot)))})})}onTransactionModalStateChange(_){return this.transactionModal.onStateChange(_)}subscribeToWalletChange(){this.connector.onStatusChange(_=>__async(this,null,function*(){var d;_?(yield this.updateWalletInfo(_),this.setPreferredWalletAppName(((d=this.walletInfo)==null?void 0:d.appName)||_.device.appName)):this.walletInfoStorage.removeWalletInfo()}))}setPreferredWalletAppName(_){this.preferredWalletStorage.setPreferredWalletAppName(_),setAppState({preferredWalletAppName:_})}getSelectedWalletInfo(_){return __async(this,null,function*(){let d=widgetController.getSelectedWalletInfo();if(!d)return null;let k;if("name"in d)k=d;else{const $=applyWalletsListConfiguration(yield this.walletsList,appState.walletsListConfiguration).find(et=>eqWalletName(et,_.device.appName));if(!$)throw new TonConnectUIError(`Cannot find WalletInfo for the '${_.device.appName}' wallet`);k=__spreadValues$1(__spreadValues$1({},$),d)}return k})}updateWalletInfo(_){return __async(this,null,function*(){const d=yield this.getSelectedWalletInfo(_);if(d){this.walletInfo=d,this.walletInfoStorage.setWalletInfo(d);return}const k=this.walletInfoStorage.getWalletInfo();if(k){this.walletInfo=k;return}this.walletInfo=(yield this.walletsList).find(j=>eqWalletName(j,_.device.appName))||null})}normalizeWidgetRoot(_){if(!_||!document.getElementById(_)){_="tc-widget-root";const d=document.createElement("div");d.id=_,document.body.appendChild(d)}return _}checkButtonRootExist(_){if(_!=null&&!document.getElementById(_))throw new TonConnectUIError(`${_} element not found in the document.`)}getModalsAndNotificationsConfiguration(_){var d,k,j,$,et,tt;const rt=["before","success","error"];let nt=rt;(d=this.actionsConfiguration)!=null&&d.notifications&&((k=this.actionsConfiguration)==null?void 0:k.notifications)!=="all"&&(nt=this.actionsConfiguration.notifications),_!=null&&_.notifications&&(_.notifications==="all"?nt=rt:nt=_.notifications);let ot=["before"];(j=this.actionsConfiguration)!=null&&j.modals&&(this.actionsConfiguration.modals==="all"?ot=rt:ot=this.actionsConfiguration.modals),_!=null&&_.modals&&(_.modals==="all"?ot=rt:ot=_.modals);const at=(_==null?void 0:_.returnStrategy)||(($=this.actionsConfiguration)==null?void 0:$.returnStrategy)||"back",it=(_==null?void 0:_.twaReturnUrl)||((et=this.actionsConfiguration)==null?void 0:et.twaReturnUrl);let dt=(_==null?void 0:_.skipRedirectToWallet)||((tt=this.actionsConfiguration)==null?void 0:tt.skipRedirectToWallet)||"ios";return isInTMA()&&(dt="never"),{notifications:nt,modals:ot,returnStrategy:at,twaReturnUrl:it,skipRedirectToWallet:dt}}}var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(b,_,d)=>_ in b?__defProp(b,_,{enumerable:!0,configurable:!0,writable:!0,value:d}):b[_]=d,__spreadValues=(b,_)=>{for(var d in _||(_={}))__hasOwnProp.call(_,d)&&__defNormalProp(b,d,_[d]);if(__getOwnPropSymbols)for(var d of __getOwnPropSymbols(_))__propIsEnum.call(_,d)&&__defNormalProp(b,d,_[d]);return b},__objRest=(b,_)=>{var d={};for(var k in b)__hasOwnProp.call(b,k)&&_.indexOf(k)<0&&(d[k]=b[k]);if(b!=null&&__getOwnPropSymbols)for(var k of __getOwnPropSymbols(b))_.indexOf(k)<0&&__propIsEnum.call(b,k)&&(d[k]=b[k]);return d},jsxRuntime={exports:{}},reactJsxRuntime_production_min={};/** +`,ActionModal=b=>{const _=useDataAttributes(b),d=useContext(TonConnectUiContext),[k,j]=createSignal(!0),[$,et]=createSignal(!1);createEffect(()=>{const ot=action();et(!!ot&&"sent"in ot&&ot.sent)});let tt;d!=null&&d.wallet&&"universalLink"in d.wallet&&(d.wallet.openMethod==="universal-link"||isTelegramUrl(d.wallet.universalLink)&&isInTMA())&&(tt=d.wallet.universalLink);let rt;d!=null&&d.wallet&&"deepLink"in d.wallet&&(d.wallet.openMethod==="custom-deeplink"||isTelegramUrl(d.wallet.deepLink)&&isInTMA())&&(rt=d.wallet.deepLink);const nt=()=>{const ot=action(),at="returnStrategy"in ot?ot.returnStrategy:appState.returnStrategy,it=!k();j(!1),isTelegramUrl(tt)?redirectToTelegram(tt,{returnStrategy:at,twaReturnUrl:"twaReturnUrl"in ot?ot.twaReturnUrl:appState.twaReturnUrl,forceRedirect:it}):redirectToWallet(tt,rt,{returnStrategy:at,forceRedirect:it},()=>{})};return createComponent(ActionModalStyled,mergeProps(_,{get children(){return[createMemo(()=>b.icon),createComponent(H1Styled,{get translationKey(){return b.headerTranslationKey},get translationValues(){return b.headerTranslationValues}}),createComponent(TextStyled,{get translationKey(){return b.textTranslationKey},get translationValues(){return b.textTranslationValues}}),createComponent(Show,{get when(){return!$()&&(b.showButton==="open-wallet"&&tt||b.showButton!=="open-wallet")},get children(){return createComponent(LoaderButtonStyled,{disabled:!0,"data-tc-connect-button-loading":"true",get children(){return createComponent(LoaderIconStyled,{})}})}}),createComponent(Show,{get when(){return $()},get children(){return[createComponent(Show,{get when(){return b.showButton!=="open-wallet"},get children(){return createComponent(ButtonStyled,{onClick:()=>b.onClose(),get children(){return createComponent(Translation,{translationKey:"common.close",children:"Close"})}})}}),createComponent(Show,{get when(){return b.showButton==="open-wallet"&&tt},get children(){return createComponent(ButtonStyled,{onClick:nt,get children(){return createComponent(Translation,{translationKey:"common.openWallet",children:"Open wallet"})}})}})]}})]}}))},ConfirmTransactionModal=b=>{const _=useContext(TonConnectUiContext),[d]=useI18n(),k=()=>_.wallet&&"name"in _.wallet?_.wallet.name:d("common.yourWallet",{},"Your wallet");return createComponent(ActionModal,{headerTranslationKey:"actionModal.confirmTransaction.header",get headerTranslationValues(){return{name:k()}},textTranslationKey:"actionModal.confirmTransaction.text",get icon(){return createComponent(LoaderIcon,{size:"m"})},onClose:()=>b.onClose(),showButton:"open-wallet","data-tc-confirm-modal":"true"})},TransactionCanceledModal=b=>createComponent(ActionModal,{headerTranslationKey:"actionModal.transactionCanceled.header",textTranslationKey:"actionModal.transactionCanceled.text",get icon(){return createComponent(ErrorIcon,{size:"m"})},onClose:()=>b.onClose(),"data-tc-transaction-canceled-modal":"true"}),TransactionSentModal=b=>createComponent(ActionModal,{headerTranslationKey:"actionModal.transactionSent.header",textTranslationKey:"actionModal.transactionSent.text",get icon(){return createComponent(SuccessIcon,{size:"m"})},onClose:()=>b.onClose(),"data-tc-transaction-sent-modal":"true"}),ActionsModal=()=>createComponent(Modal,{get opened(){var b;return createMemo(()=>action()!==null)()&&((b=action())==null?void 0:b.openModal)===!0},get enableAndroidBackHandler(){return appState.enableAndroidBackHandler},onClose:()=>setAction(null),"data-tc-actions-modal-container":"true",get children(){return createComponent(Switch,{get children(){return[createComponent(Match,{get when(){return action().name==="transaction-sent"},get children(){return createComponent(TransactionSentModal,{onClose:()=>setAction(null)})}}),createComponent(Match,{get when(){return action().name==="transaction-canceled"},get children(){return createComponent(TransactionCanceledModal,{onClose:()=>setAction(null)})}}),createComponent(Match,{get when(){return action().name==="confirm-transaction"},get children(){return createComponent(ConfirmTransactionModal,{onClose:()=>setAction(null)})}})]}})}}),SingleWalletModal=()=>{const{locale:b}=useI18n()[1];createEffect(()=>b(appState.language)),createEffect(()=>{getSingleWalletModalIsOpened()&&updateIsMobile()});const _=useContext(ConnectorContext),d=useContext(TonConnectUiContext),[k,j]=createSignal(!1),$=()=>{var nt;return((nt=appState.connectRequestParameters)==null?void 0:nt.state)==="loading"},et=createMemo(()=>{var nt;if(!$())return(nt=appState.connectRequestParameters)==null?void 0:nt.value}),tt=nt=>{d.closeSingleWalletModal(nt)},rt=_.onStatusChange(nt=>{nt&&tt("wallet-selected")});return onCleanup(rt),onCleanup(()=>{j(!1)}),createComponent(StyledModal,{get opened(){return getSingleWalletModalIsOpened()},get enableAndroidBackHandler(){return appState.enableAndroidBackHandler},onClose:()=>tt("action-cancelled"),onClickQuestion:()=>j(nt=>!nt),"data-tc-wallets-modal-container":"true",get children(){return[createComponent(Show,{get when(){return k()},get children(){return createComponent(InfoModal,{onBackClick:()=>j(!1)})}}),createComponent(Show,{get when(){return!k()},get children(){return[createComponent(Show,{get when(){return $()},get children(){return[createComponent(H1Styled$8,{translationKey:"walletModal.loading",children:"Wallets list is loading"}),createComponent(LoaderContainerStyled,{get children(){return createComponent(LoaderIcon,{size:"m"})}})]}}),createComponent(Show,{get when(){return!$()},get children(){return createComponent(Dynamic,{get component(){return isMobile()?MobileConnectionModal:DesktopConnectionModal},get wallet(){return getSingleWalletModalWalletInfo()},get additionalRequest(){return et()},onBackClick:()=>{},backDisabled:!0})}})]}})]}})},App$1=b=>{const _=createI18nContext(i18nDictionary,appState.language);return defineStylesRoot(),fixMobileSafariActiveTransition(),createComponent(I18nContext.Provider,{value:_,get children(){return createComponent(TonConnectUiContext.Provider,{get value(){return b.tonConnectUI},get children(){return createComponent(ConnectorContext.Provider,{get value(){return appState.connector},get children(){return[createComponent(GlobalStyles,{}),createComponent(ThemeProvider,{theme:themeState,get children(){return[createComponent(Show,{get when(){return appState.buttonRootId},get children(){return createComponent(Portal,{get mount(){return document.getElementById(appState.buttonRootId)},get children(){return createComponent(AccountButton,{})}})}}),createComponent(Dynamic,{component:globalStylesTag,get children(){return[createComponent(WalletsModal,{}),createComponent(SingleWalletModal,{}),createComponent(ActionsModal,{})]}})]}})]}})}})}})},widgetController={openWalletsModal:()=>void setTimeout(()=>setWalletsModalState({status:"opened",closeReason:null})),closeWalletsModal:b=>void setTimeout(()=>setWalletsModalState({status:"closed",closeReason:b})),openSingleWalletModal:b=>{setTimeout(()=>setSingleWalletModalState({status:"opened",closeReason:null,walletInfo:b}))},closeSingleWalletModal:b=>void setTimeout(()=>setSingleWalletModalState({status:"closed",closeReason:b})),setAction:b=>void setTimeout(()=>setAction(b)),clearAction:()=>void setTimeout(()=>setAction(null)),getSelectedWalletInfo:()=>lastSelectedWalletInfo(),removeSelectedWalletInfo:()=>setLastSelectedWalletInfo(null),renderApp:(b,_)=>render(()=>createComponent(App$1,{tonConnectUI:_}),document.getElementById(b))};class WalletsModalManager{constructor(_){__publicField(this,"connector"),__publicField(this,"setConnectRequestParametersCallback"),__publicField(this,"consumers",[]),__publicField(this,"tracker"),__publicField(this,"state",walletsModalState()),this.connector=_.connector,this.tracker=_.tracker,this.setConnectRequestParametersCallback=_.setConnectRequestParametersCallback,createEffect(()=>{const d=walletsModalState();this.state=d,this.consumers.forEach(k=>k(d))})}open(){return __async(this,null,function*(){this.tracker.trackConnectionStarted();const d=(yield this.connector.getWallets()).find(isWalletInfoCurrentlyEmbedded);return d?this.connectEmbeddedWallet(d):this.openWalletsModal()})}close(_="action-cancelled"){_==="action-cancelled"&&this.tracker.trackConnectionError("Connection was cancelled"),widgetController.closeWalletsModal(_)}onStateChange(_){return this.consumers.push(_),()=>{this.consumers=this.consumers.filter(d=>d!==_)}}connectEmbeddedWallet(_){const d=j=>{setLastSelectedWalletInfo(_),this.connector.connect({jsBridgeKey:_.jsBridgeKey},j)},k=appState.connectRequestParameters;(k==null?void 0:k.state)==="loading"?this.setConnectRequestParametersCallback(d):d(k==null?void 0:k.value)}openWalletsModal(){return __async(this,null,function*(){return isInTMA()&&sendExpand(),widgetController.openWalletsModal(),new Promise(_=>{const d=this.onStateChange(k=>{const{status:j}=k;j==="opened"&&(d(),_())})})})}}class TransactionModalManager{constructor(_){__publicField(this,"connector"),__publicField(this,"consumers",[]),this.connector=_.connector,createEffect(()=>{const d=action();this.consumers.forEach(k=>k(d))})}onStateChange(_){return this.consumers.push(_),()=>{this.consumers=this.consumers.filter(d=>d!==_)}}}class SingleWalletModalManager{constructor(_){__publicField(this,"connector"),__publicField(this,"setConnectRequestParametersCallback"),__publicField(this,"consumers",[]),__publicField(this,"tracker"),__publicField(this,"state",singleWalletModalState()),this.connector=_.connector,this.tracker=_.tracker,this.setConnectRequestParametersCallback=_.setConnectRequestParametersCallback,createEffect(()=>{const d=singleWalletModalState();this.state=d,this.consumers.forEach(k=>k(d))})}open(_){return __async(this,null,function*(){this.tracker.trackConnectionStarted();const d=yield this.connector.getWallets(),k=applyWalletsListConfiguration(d,appState.walletsListConfiguration),j=k.find(isWalletInfoCurrentlyEmbedded);if(!!j)return this.connectEmbeddedWallet(j);const tt=k.filter(isWalletInfoRemote).find(ot=>eqWalletName(ot,_));if(!!tt)return this.openSingleWalletModal(tt);const nt=`Trying to open modal window with unknown wallet "${_}".`;throw this.tracker.trackConnectionError(nt),new TonConnectUIError(nt)})}close(_="action-cancelled"){_==="action-cancelled"&&this.tracker.trackConnectionError("Connection was cancelled"),widgetController.closeSingleWalletModal("action-cancelled")}onStateChange(_){return this.consumers.push(_),()=>{this.consumers=this.consumers.filter(d=>d!==_)}}connectEmbeddedWallet(_){const d=j=>{setLastSelectedWalletInfo(_),this.connector.connect({jsBridgeKey:_.jsBridgeKey},j)},k=appState.connectRequestParameters;(k==null?void 0:k.state)==="loading"?this.setConnectRequestParametersCallback(d):d(k==null?void 0:k.value)}openSingleWalletModal(_){return __async(this,null,function*(){return isInTMA()&&sendExpand(),widgetController.openSingleWalletModal(_),new Promise(d=>{const k=this.onStateChange(j=>{const{status:$}=j;$==="opened"&&(k(),d())})})})}}class TonConnectUITracker{constructor(_){__publicField(this,"eventPrefix","ton-connect-ui-"),__publicField(this,"tonConnectUiVersion"),__publicField(this,"tonConnectSdkVersion",null),__publicField(this,"eventDispatcher");var d;this.eventDispatcher=(d=_==null?void 0:_.eventDispatcher)!=null?d:new BrowserEventDispatcher,this.tonConnectUiVersion=_.tonConnectUiVersion,this.init().catch()}get version(){return createVersionInfo({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return __async(this,null,function*(){try{yield this.setRequestVersionHandler(),this.tonConnectSdkVersion=yield this.requestTonConnectSdkVersion()}catch{}})}setRequestVersionHandler(){return __async(this,null,function*(){yield this.eventDispatcher.addEventListener("ton-connect-ui-request-version",()=>__async(this,null,function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-ui-response-version",createResponseVersionEvent(this.tonConnectUiVersion))}))})}requestTonConnectSdkVersion(){return __async(this,null,function*(){return new Promise((_,d)=>__async(this,null,function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-response-version",k=>{_(k.detail.version)},{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-request-version",createRequestVersionEvent())}catch(k){d(k)}}))})}dispatchUserActionEvent(_){var d;try{(d=this.eventDispatcher)==null||d.dispatchEvent(`${this.eventPrefix}${_.type}`,_).catch()}catch{}}trackConnectionStarted(..._){try{const d=createConnectionStartedEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}trackConnectionCompleted(..._){try{const d=createConnectionCompletedEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}trackConnectionError(..._){try{const d=createConnectionErrorEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}trackConnectionRestoringStarted(..._){try{const d=createConnectionRestoringStartedEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}trackConnectionRestoringCompleted(..._){try{const d=createConnectionRestoringCompletedEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}trackConnectionRestoringError(..._){try{const d=createConnectionRestoringErrorEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}trackDisconnection(..._){try{const d=createDisconnectionEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}trackTransactionSentForSignature(..._){try{const d=createTransactionSentForSignatureEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}trackTransactionSigned(..._){try{const d=createTransactionSignedEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}trackTransactionSigningFailed(..._){try{const d=createTransactionSigningFailedEvent(this.version,..._);this.dispatchUserActionEvent(d)}catch{}}}const tonConnectUiVersion="2.0.10-beta.1";class TonConnectUI{constructor(_){if(__publicField(this,"walletInfoStorage",new WalletInfoStorage),__publicField(this,"preferredWalletStorage",new PreferredWalletStorage),__publicField(this,"tracker"),__publicField(this,"walletInfo",null),__publicField(this,"systemThemeChangeUnsubscribe",null),__publicField(this,"actionsConfiguration"),__publicField(this,"walletsList"),__publicField(this,"connectRequestParametersCallback"),__publicField(this,"connector"),__publicField(this,"modal"),__publicField(this,"singleWalletModal"),__publicField(this,"transactionModal"),__publicField(this,"connectionRestored",Promise.resolve(!1)),_&&"connector"in _&&_.connector)this.connector=_.connector;else if(_&&"manifestUrl"in _&&_.manifestUrl)this.connector=new TonConnect({manifestUrl:_.manifestUrl,eventDispatcher:_==null?void 0:_.eventDispatcher});else throw new TonConnectUIError("You have to specify a `manifestUrl` or a `connector` in the options.");this.tracker=new TonConnectUITracker({eventDispatcher:_==null?void 0:_.eventDispatcher,tonConnectUiVersion}),this.modal=new WalletsModalManager({connector:this.connector,tracker:this.tracker,setConnectRequestParametersCallback:j=>{this.connectRequestParametersCallback=j}}),this.singleWalletModal=new SingleWalletModalManager({connector:this.connector,tracker:this.tracker,setConnectRequestParametersCallback:j=>{this.connectRequestParametersCallback=j}}),this.transactionModal=new TransactionModalManager({connector:this.connector}),this.walletsList=this.getWallets(),this.walletsList.then(j=>preloadImages(uniq(j.map($=>$.imageUrl))));const d=this.normalizeWidgetRoot(_==null?void 0:_.widgetRootId);this.subscribeToWalletChange(),(_==null?void 0:_.restoreConnection)!==!1&&(this.connectionRestored=createMacrotaskAsync(()=>__async(this,null,function*(){return this.tracker.trackConnectionRestoringStarted(),yield this.connector.restoreConnection(),this.connector.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):(this.tracker.trackConnectionRestoringError("Connection was not restored"),this.walletInfoStorage.removeWalletInfo()),this.connector.connected}))),this.uiOptions=mergeOptions(_,{uiPreferences:{theme:"SYSTEM"}});const k=this.preferredWalletStorage.getPreferredWalletAppName();setAppState({connector:this.connector,preferredWalletAppName:k}),widgetController.renderApp(d,this)}static getWallets(){return TonConnect.getWallets()}get connected(){return this.connector.connected}get account(){return this.connector.account}get wallet(){return this.connector.wallet?__spreadValues$1(__spreadValues$1({},this.connector.wallet),this.walletInfo):null}set uiOptions(_){var d,k,j,$,et;this.checkButtonRootExist(_.buttonRootId),this.actionsConfiguration=_.actionsConfiguration,(d=_.uiPreferences)!=null&&d.theme?((k=_.uiPreferences)==null?void 0:k.theme)!=="SYSTEM"?((j=this.systemThemeChangeUnsubscribe)==null||j.call(this),setTheme(_.uiPreferences.theme,_.uiPreferences.colorsSet)):(setTheme(getSystemTheme(),_.uiPreferences.colorsSet),this.systemThemeChangeUnsubscribe||(this.systemThemeChangeUnsubscribe=subscribeToThemeChange(setTheme))):($=_.uiPreferences)!=null&&$.colorsSet&&setColors(_.uiPreferences.colorsSet),(et=_.uiPreferences)!=null&&et.borderRadius&&setBorderRadius(_.uiPreferences.borderRadius),setAppState(tt=>{var rt,nt;const ot=mergeOptions(__spreadValues$1(__spreadValues$1(__spreadValues$1(__spreadValues$1({},_.language&&{language:_.language}),!!((rt=_.actionsConfiguration)!=null&&rt.returnStrategy)&&{returnStrategy:_.actionsConfiguration.returnStrategy}),!!((nt=_.actionsConfiguration)!=null&&nt.twaReturnUrl)&&{twaReturnUrl:_.actionsConfiguration.twaReturnUrl}),!!_.walletsListConfiguration&&{walletsListConfiguration:_.walletsListConfiguration}),unwrap(tt));return _.buttonRootId!==void 0&&(ot.buttonRootId=_.buttonRootId),_.enableAndroidBackHandler!==void 0&&(ot.enableAndroidBackHandler=_.enableAndroidBackHandler),ot})}setConnectRequestParameters(_){var d;setAppState({connectRequestParameters:_}),((_==null?void 0:_.state)==="ready"||!_)&&((d=this.connectRequestParametersCallback)==null||d.call(this,_==null?void 0:_.value))}getWallets(){return __async(this,null,function*(){return this.connector.getWallets()})}onStatusChange(_,d){return this.connector.onStatusChange(k=>__async(this,null,function*(){if(k){const j=yield this.getSelectedWalletInfo(k);_(__spreadValues$1(__spreadValues$1({},k),j||this.walletInfoStorage.getWalletInfo()))}else _(k)}),d)}openModal(){return __async(this,null,function*(){return this.modal.open()})}closeModal(_){this.modal.close(_)}onModalStateChange(_){return this.modal.onStateChange(_)}get modalState(){return this.modal.state}openSingleWalletModal(_){return __async(this,null,function*(){return this.singleWalletModal.open(_)})}closeSingleWalletModal(_){this.singleWalletModal.close(_)}onSingleWalletModalStateChange(_){return this.singleWalletModal.onStateChange(_)}get singleWalletModalState(){return this.singleWalletModal.state}connectWallet(){return __async(this,null,function*(){const d=(yield this.getWallets()).find(isWalletInfoCurrentlyEmbedded);return d?yield this.connectEmbeddedWallet(d):yield this.connectExternalWallet()})}disconnect(){return this.tracker.trackDisconnection(this.wallet,"dapp"),widgetController.clearAction(),widgetController.removeSelectedWalletInfo(),this.walletInfoStorage.removeWalletInfo(),this.connector.disconnect()}sendTransaction(_,d){return __async(this,null,function*(){if(this.tracker.trackTransactionSentForSignature(this.wallet,_),!this.connected)throw this.tracker.trackTransactionSigningFailed(this.wallet,_,"Wallet was not connected"),new TonConnectUIError("Connect wallet to send a transaction.");isInTMA()&&sendExpand();const{notifications:k,modals:j,returnStrategy:$,twaReturnUrl:et,skipRedirectToWallet:tt}=this.getModalsAndNotificationsConfiguration(d);widgetController.setAction({name:"confirm-transaction",showNotification:k.includes("before"),openModal:j.includes("before"),sent:!1});const rt=()=>{nt.signal.aborted||(widgetController.setAction({name:"confirm-transaction",showNotification:k.includes("before"),openModal:j.includes("before"),sent:!0}),this.walletInfo&&"universalLink"in this.walletInfo&&(this.walletInfo.openMethod==="universal-link"||this.walletInfo.openMethod==="custom-deeplink")&&(isTelegramUrl(this.walletInfo.universalLink)?redirectToTelegram(this.walletInfo.universalLink,{returnStrategy:$,twaReturnUrl:et||appState.twaReturnUrl,forceRedirect:!1}):redirectToWallet(this.walletInfo.universalLink,this.walletInfo.deepLink,{returnStrategy:$,forceRedirect:!1},()=>{})))},nt=new AbortController,ot=this.onTransactionModalStateChange(at=>{at!=null&&at.openModal||(ot(),at||nt.abort())});try{const at=yield this.waitForSendTransaction({transaction:_,signal:nt.signal},rt);return this.tracker.trackTransactionSigned(this.wallet,_,at),widgetController.setAction({name:"transaction-sent",showNotification:k.includes("success"),openModal:j.includes("success")}),at}catch(at){throw widgetController.setAction({name:"transaction-canceled",showNotification:k.includes("error"),openModal:j.includes("error")}),at instanceof TonConnectError?at:(console.error(at),new TonConnectUIError("Unhandled error:"+at))}finally{ot()}})}connectEmbeddedWallet(_){return __async(this,null,function*(){const d=j=>{setLastSelectedWalletInfo(_),this.connector.connect({jsBridgeKey:_.jsBridgeKey},j)},k=appState.connectRequestParameters;return(k==null?void 0:k.state)==="loading"?this.connectRequestParametersCallback=d:d(k==null?void 0:k.value),yield this.waitForWalletConnection({ignoreErrors:!1})})}connectExternalWallet(){return __async(this,null,function*(){const _=new AbortController;widgetController.openWalletsModal();const d=this.onModalStateChange(k=>{const{status:j,closeReason:$}=k;j!=="opened"&&(d(),$==="action-cancelled"&&_.abort())});return yield this.waitForWalletConnection({ignoreErrors:!0,signal:_.signal})})}waitForWalletConnection(_){return __async(this,null,function*(){return new Promise((d,k)=>{this.tracker.trackConnectionStarted();const{ignoreErrors:j=!1,signal:$=null}=_;if($&&$.aborted)return this.tracker.trackConnectionError("Connection was cancelled"),k(new TonConnectUIError("Wallet was not connected"));const et=nt=>__async(this,null,function*(){if(nt)this.tracker.trackConnectionCompleted(nt),rt(),d(nt);else{if(this.tracker.trackConnectionError("Connection was cancelled"),j)return;rt(),k(new TonConnectUIError("Wallet was not connected"))}}),tt=nt=>{this.tracker.trackConnectionError(nt.message),!j&&(rt(),k(nt))},rt=this.onStatusChange(nt=>et(nt),nt=>tt(nt));$&&$.addEventListener("abort",()=>{rt(),k(new TonConnectUIError("Wallet was not connected"))},{once:!0})})})}waitForSendTransaction(_,d){return __async(this,null,function*(){return new Promise((k,j)=>{const{transaction:$,signal:et}=_;if(et.aborted)return this.tracker.trackTransactionSigningFailed(this.wallet,$,"Transaction was cancelled"),j(new TonConnectUIError("Transaction was not sent"));const tt=ot=>__async(this,null,function*(){k(ot)}),rt=ot=>{j(ot)},nt=()=>{this.tracker.trackTransactionSigningFailed(this.wallet,$,"Transaction was cancelled"),j(new TonConnectUIError("Transaction was not sent"))};et.addEventListener("abort",nt,{once:!0}),this.connector.sendTransaction($,{onRequestSent:d,signal:et}).then(ot=>(et.removeEventListener("abort",nt),tt(ot))).catch(ot=>(et.removeEventListener("abort",nt),rt(ot)))})})}onTransactionModalStateChange(_){return this.transactionModal.onStateChange(_)}subscribeToWalletChange(){this.connector.onStatusChange(_=>__async(this,null,function*(){var d;_?(yield this.updateWalletInfo(_),this.setPreferredWalletAppName(((d=this.walletInfo)==null?void 0:d.appName)||_.device.appName)):this.walletInfoStorage.removeWalletInfo()}))}setPreferredWalletAppName(_){this.preferredWalletStorage.setPreferredWalletAppName(_),setAppState({preferredWalletAppName:_})}getSelectedWalletInfo(_){return __async(this,null,function*(){let d=widgetController.getSelectedWalletInfo();if(!d)return null;let k;if("name"in d)k=d;else{const $=applyWalletsListConfiguration(yield this.walletsList,appState.walletsListConfiguration).find(et=>eqWalletName(et,_.device.appName));if(!$)throw new TonConnectUIError(`Cannot find WalletInfo for the '${_.device.appName}' wallet`);k=__spreadValues$1(__spreadValues$1({},$),d)}return k})}updateWalletInfo(_){return __async(this,null,function*(){const d=yield this.getSelectedWalletInfo(_);if(d){this.walletInfo=d,this.walletInfoStorage.setWalletInfo(d);return}const k=this.walletInfoStorage.getWalletInfo();if(k){this.walletInfo=k;return}this.walletInfo=(yield this.walletsList).find(j=>eqWalletName(j,_.device.appName))||null})}normalizeWidgetRoot(_){if(!_||!document.getElementById(_)){_="tc-widget-root";const d=document.createElement("div");d.id=_,document.body.appendChild(d)}return _}checkButtonRootExist(_){if(_!=null&&!document.getElementById(_))throw new TonConnectUIError(`${_} element not found in the document.`)}getModalsAndNotificationsConfiguration(_){var d,k,j,$,et,tt;const rt=["before","success","error"];let nt=rt;(d=this.actionsConfiguration)!=null&&d.notifications&&((k=this.actionsConfiguration)==null?void 0:k.notifications)!=="all"&&(nt=this.actionsConfiguration.notifications),_!=null&&_.notifications&&(_.notifications==="all"?nt=rt:nt=_.notifications);let ot=["before"];(j=this.actionsConfiguration)!=null&&j.modals&&(this.actionsConfiguration.modals==="all"?ot=rt:ot=this.actionsConfiguration.modals),_!=null&&_.modals&&(_.modals==="all"?ot=rt:ot=_.modals);const at=(_==null?void 0:_.returnStrategy)||(($=this.actionsConfiguration)==null?void 0:$.returnStrategy)||"back",it=(_==null?void 0:_.twaReturnUrl)||((et=this.actionsConfiguration)==null?void 0:et.twaReturnUrl);let dt=(_==null?void 0:_.skipRedirectToWallet)||((tt=this.actionsConfiguration)==null?void 0:tt.skipRedirectToWallet)||"ios";return isInTMA()&&(dt="never"),{notifications:nt,modals:ot,returnStrategy:at,twaReturnUrl:it,skipRedirectToWallet:dt}}}var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(b,_,d)=>_ in b?__defProp(b,_,{enumerable:!0,configurable:!0,writable:!0,value:d}):b[_]=d,__spreadValues=(b,_)=>{for(var d in _||(_={}))__hasOwnProp.call(_,d)&&__defNormalProp(b,d,_[d]);if(__getOwnPropSymbols)for(var d of __getOwnPropSymbols(_))__propIsEnum.call(_,d)&&__defNormalProp(b,d,_[d]);return b},__objRest=(b,_)=>{var d={};for(var k in b)__hasOwnProp.call(b,k)&&_.indexOf(k)<0&&(d[k]=b[k]);if(b!=null&&__getOwnPropSymbols)for(var k of __getOwnPropSymbols(b))_.indexOf(k)<0&&__propIsEnum.call(b,k)&&(d[k]=b[k]);return d},jsxRuntime={exports:{}},reactJsxRuntime_production_min={};/** * @license React * react-jsx-runtime.production.min.js * @@ -1471,4 +1471,4 @@ PERFORMANCE OF THIS SOFTWARE. The above lifecycles should be removed. Learn more about this warning here: https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof It.getDerivedStateFromProps=="function"&&(Nt.componentWillMount=Ct,Nt.componentWillReceiveProps=xt),typeof Nt.getSnapshotBeforeUpdate=="function"){if(typeof Nt.componentDidUpdate!="function")throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");Nt.componentWillUpdate=wt;var tn=Nt.componentDidUpdate;Nt.componentDidUpdate=function(Gt,xn,Gn){var er=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:Gn;tn.call(this,Gt,xn,er)}}return It}function kt(It,Nt){if(It==null)return{};var Rt,Wt,Pt=function(un,tn){if(un==null)return{};var Gt,xn,Gn={},er=Object.keys(un);for(xn=0;xn=0||(Gn[Gt]=un[Gt]);return Gn}(It,Nt);if(Object.getOwnPropertySymbols){var hn=Object.getOwnPropertySymbols(It);for(Wt=0;Wt=0||Object.prototype.propertyIsEnumerable.call(It,Rt)&&(Pt[Rt]=It[Rt])}return Pt}function _t(It){var Nt=function(Rt){return{}.toString.call(Rt).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}(It);return Nt==="number"&&(Nt=isNaN(It)?"nan":(0|It)!=It?"float":"integer"),Nt}Ct.__suppressDeprecationWarning=!0,xt.__suppressDeprecationWarning=!0,wt.__suppressDeprecationWarning=!0;var Tt={scheme:"rjv-default",author:"mac gainor",base00:"rgba(0, 0, 0, 0)",base01:"rgb(245, 245, 245)",base02:"rgb(235, 235, 235)",base03:"#93a1a1",base04:"rgba(0, 0, 0, 0.3)",base05:"#586e75",base06:"#073642",base07:"#002b36",base08:"#d33682",base09:"#cb4b16",base0A:"#dc322f",base0B:"#859900",base0C:"#6c71c4",base0D:"#586e75",base0E:"#2aa198",base0F:"#268bd2"},At={scheme:"rjv-grey",author:"mac gainor",base00:"rgba(1, 1, 1, 0)",base01:"rgba(1, 1, 1, 0.1)",base02:"rgba(0, 0, 0, 0.2)",base03:"rgba(1, 1, 1, 0.3)",base04:"rgba(0, 0, 0, 0.4)",base05:"rgba(1, 1, 1, 0.5)",base06:"rgba(1, 1, 1, 0.6)",base07:"rgba(1, 1, 1, 0.7)",base08:"rgba(1, 1, 1, 0.8)",base09:"rgba(1, 1, 1, 0.8)",base0A:"rgba(1, 1, 1, 0.8)",base0B:"rgba(1, 1, 1, 0.8)",base0C:"rgba(1, 1, 1, 0.8)",base0D:"rgba(1, 1, 1, 0.8)",base0E:"rgba(1, 1, 1, 0.8)",base0F:"rgba(1, 1, 1, 0.8)"},Et={white:"#fff",black:"#000",transparent:"rgba(1, 1, 1, 0)",globalFontFamily:"monospace",globalCursor:"default",indentBlockWidth:"5px",braceFontWeight:"bold",braceCursor:"pointer",ellipsisFontSize:"18px",ellipsisLineHeight:"10px",ellipsisCursor:"pointer",keyMargin:"0px 5px",keyLetterSpacing:"0.5px",keyFontStyle:"none",keyBorderRadius:"3px",keyColonWeight:"bold",keyVerticalAlign:"top",keyOpacity:"0.85",keyOpacityHover:"1",keyValPaddingTop:"3px",keyValPaddingBottom:"3px",keyValPaddingRight:"5px",keyValBorderLeft:"1px solid",keyValBorderHover:"2px solid",keyValPaddingHover:"3px 5px 3px 4px",pushedContentMarginLeft:"6px",variableValuePaddingRight:"6px",nullFontSize:"11px",nullFontWeight:"bold",nullPadding:"1px 2px",nullBorderRadius:"3px",nanFontSize:"11px",nanFontWeight:"bold",nanPadding:"1px 2px",nanBorderRadius:"3px",undefinedFontSize:"11px",undefinedFontWeight:"bold",undefinedPadding:"1px 2px",undefinedBorderRadius:"3px",dataTypeFontSize:"11px",dataTypeMarginRight:"4px",datatypeOpacity:"0.8",objectSizeBorderRadius:"3px",objectSizeFontStyle:"italic",objectSizeMargin:"0px 6px 0px 0px",clipboardCursor:"pointer",clipboardCheckMarginLeft:"-12px",metaDataPadding:"0px 0px 0px 10px",arrayGroupMetaPadding:"0px 0px 0px 4px",iconContainerWidth:"17px",tooltipPadding:"4px",editInputMinWidth:"130px",editInputBorderRadius:"2px",editInputPadding:"5px",editInputMarginRight:"4px",editInputFontFamily:"monospace",iconCursor:"pointer",iconFontSize:"15px",iconPaddingRight:"1px",dateValueMarginLeft:"2px",iconMarginRight:"3px",detectedRowPaddingTop:"3px",addKeyCoverBackground:"rgba(255, 255, 255, 0.3)",addKeyCoverPosition:"absolute",addKeyCoverPositionPx:"0px",addKeyModalWidth:"200px",addKeyModalMargin:"auto",addKeyModalPadding:"10px",addKeyModalRadius:"3px"},jt=$(45),Lt=function(It){var Nt=function(Rt){return{backgroundColor:Rt.base00,ellipsisColor:Rt.base09,braceColor:Rt.base07,expandedIcon:Rt.base0D,collapsedIcon:Rt.base0E,keyColor:Rt.base07,arrayKeyColor:Rt.base0C,objectSize:Rt.base04,copyToClipboard:Rt.base0F,copyToClipboardCheck:Rt.base0D,objectBorder:Rt.base02,dataTypes:{boolean:Rt.base0E,date:Rt.base0D,float:Rt.base0B,function:Rt.base0D,integer:Rt.base0F,string:Rt.base09,nan:Rt.base08,null:Rt.base0A,undefined:Rt.base05,regexp:Rt.base0A,background:Rt.base02},editVariable:{editIcon:Rt.base0E,cancelIcon:Rt.base09,removeIcon:Rt.base09,addIcon:Rt.base0E,checkIcon:Rt.base0E,background:Rt.base01,color:Rt.base0A,border:Rt.base07},addKeyModal:{background:Rt.base05,border:Rt.base04,color:Rt.base0A,labelColor:Rt.base01},validationFailure:{background:Rt.base09,iconColor:Rt.base01,fontColor:Rt.base01}}}(It);return{"app-container":{fontFamily:Et.globalFontFamily,cursor:Et.globalCursor,backgroundColor:Nt.backgroundColor,position:"relative"},ellipsis:{display:"inline-block",color:Nt.ellipsisColor,fontSize:Et.ellipsisFontSize,lineHeight:Et.ellipsisLineHeight,cursor:Et.ellipsisCursor},"brace-row":{display:"inline-block",cursor:"pointer"},brace:{display:"inline-block",cursor:Et.braceCursor,fontWeight:Et.braceFontWeight,color:Nt.braceColor},"expanded-icon":{color:Nt.expandedIcon},"collapsed-icon":{color:Nt.collapsedIcon},colon:{display:"inline-block",margin:Et.keyMargin,color:Nt.keyColor,verticalAlign:"top"},objectKeyVal:function(Rt,Wt){return{style:rt({paddingTop:Et.keyValPaddingTop,paddingRight:Et.keyValPaddingRight,paddingBottom:Et.keyValPaddingBottom,borderLeft:Et.keyValBorderLeft+" "+Nt.objectBorder,":hover":{paddingLeft:Wt.paddingLeft-1+"px",borderLeft:Et.keyValBorderHover+" "+Nt.objectBorder}},Wt)}},"object-key-val-no-border":{padding:Et.keyValPadding},"pushed-content":{marginLeft:Et.pushedContentMarginLeft},variableValue:function(Rt,Wt){return{style:rt({display:"inline-block",paddingRight:Et.variableValuePaddingRight,position:"relative"},Wt)}},"object-name":{display:"inline-block",color:Nt.keyColor,letterSpacing:Et.keyLetterSpacing,fontStyle:Et.keyFontStyle,verticalAlign:Et.keyVerticalAlign,opacity:Et.keyOpacity,":hover":{opacity:Et.keyOpacityHover}},"array-key":{display:"inline-block",color:Nt.arrayKeyColor,letterSpacing:Et.keyLetterSpacing,fontStyle:Et.keyFontStyle,verticalAlign:Et.keyVerticalAlign,opacity:Et.keyOpacity,":hover":{opacity:Et.keyOpacityHover}},"object-size":{color:Nt.objectSize,borderRadius:Et.objectSizeBorderRadius,fontStyle:Et.objectSizeFontStyle,margin:Et.objectSizeMargin,cursor:"default"},"data-type-label":{fontSize:Et.dataTypeFontSize,marginRight:Et.dataTypeMarginRight,opacity:Et.datatypeOpacity},boolean:{display:"inline-block",color:Nt.dataTypes.boolean},date:{display:"inline-block",color:Nt.dataTypes.date},"date-value":{marginLeft:Et.dateValueMarginLeft},float:{display:"inline-block",color:Nt.dataTypes.float},function:{display:"inline-block",color:Nt.dataTypes.function,cursor:"pointer",whiteSpace:"pre-line"},"function-value":{fontStyle:"italic"},integer:{display:"inline-block",color:Nt.dataTypes.integer},string:{display:"inline-block",color:Nt.dataTypes.string},nan:{display:"inline-block",color:Nt.dataTypes.nan,fontSize:Et.nanFontSize,fontWeight:Et.nanFontWeight,backgroundColor:Nt.dataTypes.background,padding:Et.nanPadding,borderRadius:Et.nanBorderRadius},null:{display:"inline-block",color:Nt.dataTypes.null,fontSize:Et.nullFontSize,fontWeight:Et.nullFontWeight,backgroundColor:Nt.dataTypes.background,padding:Et.nullPadding,borderRadius:Et.nullBorderRadius},undefined:{display:"inline-block",color:Nt.dataTypes.undefined,fontSize:Et.undefinedFontSize,padding:Et.undefinedPadding,borderRadius:Et.undefinedBorderRadius,backgroundColor:Nt.dataTypes.background},regexp:{display:"inline-block",color:Nt.dataTypes.regexp},"copy-to-clipboard":{cursor:Et.clipboardCursor},"copy-icon":{color:Nt.copyToClipboard,fontSize:Et.iconFontSize,marginRight:Et.iconMarginRight,verticalAlign:"top"},"copy-icon-copied":{color:Nt.copyToClipboardCheck,marginLeft:Et.clipboardCheckMarginLeft},"array-group-meta-data":{display:"inline-block",padding:Et.arrayGroupMetaPadding},"object-meta-data":{display:"inline-block",padding:Et.metaDataPadding},"icon-container":{display:"inline-block",width:Et.iconContainerWidth},tooltip:{padding:Et.tooltipPadding},removeVarIcon:{verticalAlign:"top",display:"inline-block",color:Nt.editVariable.removeIcon,cursor:Et.iconCursor,fontSize:Et.iconFontSize,marginRight:Et.iconMarginRight},addVarIcon:{verticalAlign:"top",display:"inline-block",color:Nt.editVariable.addIcon,cursor:Et.iconCursor,fontSize:Et.iconFontSize,marginRight:Et.iconMarginRight},editVarIcon:{verticalAlign:"top",display:"inline-block",color:Nt.editVariable.editIcon,cursor:Et.iconCursor,fontSize:Et.iconFontSize,marginRight:Et.iconMarginRight},"edit-icon-container":{display:"inline-block",verticalAlign:"top"},"check-icon":{display:"inline-block",cursor:Et.iconCursor,color:Nt.editVariable.checkIcon,fontSize:Et.iconFontSize,paddingRight:Et.iconPaddingRight},"cancel-icon":{display:"inline-block",cursor:Et.iconCursor,color:Nt.editVariable.cancelIcon,fontSize:Et.iconFontSize,paddingRight:Et.iconPaddingRight},"edit-input":{display:"inline-block",minWidth:Et.editInputMinWidth,borderRadius:Et.editInputBorderRadius,backgroundColor:Nt.editVariable.background,color:Nt.editVariable.color,padding:Et.editInputPadding,marginRight:Et.editInputMarginRight,fontFamily:Et.editInputFontFamily},"detected-row":{paddingTop:Et.detectedRowPaddingTop},"key-modal-request":{position:Et.addKeyCoverPosition,top:Et.addKeyCoverPositionPx,left:Et.addKeyCoverPositionPx,right:Et.addKeyCoverPositionPx,bottom:Et.addKeyCoverPositionPx,backgroundColor:Et.addKeyCoverBackground},"key-modal":{width:Et.addKeyModalWidth,backgroundColor:Nt.addKeyModal.background,marginLeft:Et.addKeyModalMargin,marginRight:Et.addKeyModalMargin,padding:Et.addKeyModalPadding,borderRadius:Et.addKeyModalRadius,marginTop:"15px",position:"relative"},"key-modal-label":{color:Nt.addKeyModal.labelColor,marginLeft:"2px",marginBottom:"5px",fontSize:"11px"},"key-modal-input-container":{overflow:"hidden"},"key-modal-input":{width:"100%",padding:"3px 6px",fontFamily:"monospace",color:Nt.addKeyModal.color,border:"none",boxSizing:"border-box",borderRadius:"2px"},"key-modal-cancel":{backgroundColor:Nt.editVariable.removeIcon,position:"absolute",top:"0px",right:"0px",borderRadius:"0px 3px 0px 3px",cursor:"pointer"},"key-modal-cancel-icon":{color:Nt.addKeyModal.labelColor,fontSize:Et.iconFontSize,transform:"rotate(45deg)"},"key-modal-submit":{color:Nt.editVariable.addIcon,fontSize:Et.iconFontSize,position:"absolute",right:"2px",top:"3px",cursor:"pointer"},"function-ellipsis":{display:"inline-block",color:Nt.ellipsisColor,fontSize:Et.ellipsisFontSize,lineHeight:Et.ellipsisLineHeight,cursor:Et.ellipsisCursor},"validation-failure":{float:"right",padding:"3px 6px",borderRadius:"2px",cursor:"pointer",color:Nt.validationFailure.fontColor,backgroundColor:Nt.validationFailure.background},"validation-failure-label":{marginRight:"6px"},"validation-failure-clear":{position:"relative",verticalAlign:"top",cursor:"pointer",color:Nt.validationFailure.iconColor,fontSize:Et.iconFontSize,transform:"rotate(45deg)"}}};function Bt(It,Nt,Rt){return It||console.error("theme has not been set"),function(Wt){var Pt=Tt;return Wt!==!1&&Wt!=="none"||(Pt=At),Object(jt.createStyling)(Lt,{defaultBase16:Pt})(Wt)}(It)(Nt,Rt)}var Zt=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=(Wt.rjvId,Wt.type_name),hn=Wt.displayDataTypes,un=Wt.theme;return hn?st.a.createElement("span",Object.assign({className:"data-type-label"},Bt(un,"data-type-label")),Pt):null}}]),Rt}(st.a.PureComponent),rn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props;return st.a.createElement("div",Bt(Wt.theme,"boolean"),st.a.createElement(Zt,Object.assign({type_name:"bool"},Wt)),Wt.value?"true":"false")}}]),Rt}(st.a.PureComponent),nn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props;return st.a.createElement("div",Bt(Wt.theme,"date"),st.a.createElement(Zt,Object.assign({type_name:"date"},Wt)),st.a.createElement("span",Object.assign({className:"date-value"},Bt(Wt.theme,"date-value")),Wt.value.toLocaleTimeString("en-us",{weekday:"short",year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})))}}]),Rt}(st.a.PureComponent),Qt=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props;return st.a.createElement("div",Bt(Wt.theme,"float"),st.a.createElement(Zt,Object.assign({type_name:"float"},Wt)),this.props.value)}}]),Rt}(st.a.PureComponent);function Vt(It,Nt){(Nt==null||Nt>It.length)&&(Nt=It.length);for(var Rt=0,Wt=new Array(Nt);Rt"u"||It[Symbol.iterator]==null){if(Array.isArray(It)||(Rt=fn(It))||Nt&&It&&typeof It.length=="number"){Rt&&(It=Rt);var Wt=0,Pt=function(){};return{s:Pt,n:function(){return Wt>=It.length?{done:!0}:{done:!1,value:It[Wt++]}},e:function(Gt){throw Gt},f:Pt}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var hn,un=!0,tn=!1;return{s:function(){Rt=It[Symbol.iterator]()},n:function(){var Gt=Rt.next();return un=Gt.done,Gt},e:function(Gt){tn=!0,hn=Gt},f:function(){try{un||Rt.return==null||Rt.return()}finally{if(tn)throw hn}}}}function jn(It){return function(Nt){if(Array.isArray(Nt))return Vt(Nt)}(It)||function(Nt){if(typeof Symbol<"u"&&Symbol.iterator in Object(Nt))return Array.from(Nt)}(It)||fn(It)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}var _n=$(46),Bn=new($(47)).Dispatcher,Yn=new(function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){var Wt;nt(this,Rt);for(var Pt=arguments.length,hn=new Array(Pt),un=0;unPt&&(tn.style.cursor="pointer",this.state.collapsed&&(un=st.a.createElement("span",null,un.substring(0,Pt),st.a.createElement("span",Bt(hn,"ellipsis")," ...")))),st.a.createElement("div",Bt(hn,"string"),st.a.createElement(Zt,Object.assign({type_name:"string"},Wt)),st.a.createElement("span",Object.assign({className:"string-value"},tn,{onClick:this.toggleCollapsed}),'"',un,'"'))}}]),Rt}(st.a.PureComponent),gn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){return st.a.createElement("div",Bt(this.props.theme,"undefined"),"undefined")}}]),Rt}(st.a.PureComponent);function Ln(){return(Ln=Object.assign||function(It){for(var Nt=1;Nt=0||(Hn[mr]=or[mr]);return Hn}(It,["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"]),Gn,er=xn.value!==void 0,tr=Object(gt.useRef)(null),ir=Zn(tr,Nt),Kn=Object(gt.useRef)(0),rr=Object(gt.useRef)(),ur=function(){var or=tr.current,yr=Rt&&rr.current?rr.current:function(hr){var lr=window.getComputedStyle(hr);if(lr===null)return null;var sr,dr=(sr=lr,Tn.reduce(function(Mr,Or){return Mr[Or]=sr[Or],Mr},{})),Ar=dr.boxSizing;return Ar===""?null:(Kt&&Ar==="border-box"&&(dr.width=parseFloat(dr.width)+parseFloat(dr.borderRightWidth)+parseFloat(dr.borderLeftWidth)+parseFloat(dr.paddingRight)+parseFloat(dr.paddingLeft)+"px"),{sizingStyle:dr,paddingSize:parseFloat(dr.paddingBottom)+parseFloat(dr.paddingTop),borderSize:parseFloat(dr.borderBottomWidth)+parseFloat(dr.borderTopWidth)})}(or);if(yr){rr.current=yr;var mr=function(hr,lr,sr,dr){sr===void 0&&(sr=1),dr===void 0&&(dr=1/0),Fn||((Fn=document.createElement("textarea")).setAttribute("tab-index","-1"),Fn.setAttribute("aria-hidden","true"),Wn(Fn)),Fn.parentNode===null&&document.body.appendChild(Fn);var Ar=hr.paddingSize,Mr=hr.borderSize,Or=hr.sizingStyle,Ir=Or.boxSizing;Object.keys(Or).forEach(function(Pr){var $r=Pr;Fn.style[$r]=Or[$r]}),Wn(Fn),Fn.value=lr;var pn=function(Pr,$r){var Wr=Pr.scrollHeight;return $r.sizingStyle.boxSizing==="border-box"?Wr+$r.borderSize:Wr-$r.paddingSize}(Fn,hr);Fn.value="x";var Lr=Fn.scrollHeight-Ar,Fr=Lr*sr;Ir==="border-box"&&(Fr=Fr+Ar+Mr),pn=Math.max(Fr,pn);var Dr=Lr*dr;return Ir==="border-box"&&(Dr=Dr+Ar+Mr),[pn=Math.min(Dr,pn),Lr]}(yr,or.value||or.placeholder||"x",Pt,Wt),Pn=mr[0],Hn=mr[1];Kn.current!==Pn&&(Kn.current=Pn,or.style.setProperty("height",Pn+"px","important"),Gt(Pn,{rowHeight:Hn}))}};return Object(gt.useLayoutEffect)(ur),Gn=Un(ur),Object(gt.useLayoutEffect)(function(){var or=function(yr){Gn.current(yr)};return window.addEventListener("resize",or),function(){window.removeEventListener("resize",or)}},[]),Object(gt.createElement)("textarea",Ln({},xn,{onChange:function(or){er||ur(),un(or)},ref:ir}))},pt=Object(gt.forwardRef)(bt);function yt(It){It=It.trim();try{if((It=JSON.stringify(JSON.parse(It)))[0]==="[")return Ut("array",JSON.parse(It));if(It[0]==="{")return Ut("object",JSON.parse(It));if(It.match(/\-?\d+\.\d+/)&&It.match(/\-?\d+\.\d+/)[0]===It)return Ut("float",parseFloat(It));if(It.match(/\-?\d+e-\d+/)&&It.match(/\-?\d+e-\d+/)[0]===It)return Ut("float",Number(It));if(It.match(/\-?\d+/)&&It.match(/\-?\d+/)[0]===It)return Ut("integer",parseInt(It));if(It.match(/\-?\d+e\+\d+/)&&It.match(/\-?\d+e\+\d+/)[0]===It)return Ut("integer",Number(It))}catch{}switch(It=It.toLowerCase()){case"undefined":return Ut("undefined",void 0);case"nan":return Ut("nan",NaN);case"null":return Ut("null",null);case"true":return Ut("boolean",!0);case"false":return Ut("boolean",!1);default:if(It=Date.parse(It))return Ut("date",new Date(It))}return Ut(!1,null)}function Ut(It,Nt){return{type:It,value:Nt}}var sn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",Object.assign({},pr(Pt),{viewBox:"0 0 24 24",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),st.a.createElement("path",{d:"M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M7,13H17V11H7"})))}}]),Rt}(st.a.PureComponent),ln=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",Object.assign({},pr(Pt),{viewBox:"0 0 24 24",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),st.a.createElement("path",{d:"M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,7H11V11H7V13H11V17H13V13H17V11H13V7Z"})))}}]),Rt}(st.a.PureComponent),mn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]),un=pr(Pt).style;return st.a.createElement("span",hn,st.a.createElement("svg",{fill:un.color,width:un.height,height:un.width,style:un,viewBox:"0 0 1792 1792"},st.a.createElement("path",{d:"M1344 800v64q0 14-9 23t-23 9h-832q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h832q14 0 23 9t9 23zm128 448v-832q0-66-47-113t-113-47h-832q-66 0-113 47t-47 113v832q0 66 47 113t113 47h832q66 0 113-47t47-113zm128-832v832q0 119-84.5 203.5t-203.5 84.5h-832q-119 0-203.5-84.5t-84.5-203.5v-832q0-119 84.5-203.5t203.5-84.5h832q119 0 203.5 84.5t84.5 203.5z"})))}}]),Rt}(st.a.PureComponent),Qn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]),un=pr(Pt).style;return st.a.createElement("span",hn,st.a.createElement("svg",{fill:un.color,width:un.height,height:un.width,style:un,viewBox:"0 0 1792 1792"},st.a.createElement("path",{d:"M1344 800v64q0 14-9 23t-23 9h-352v352q0 14-9 23t-23 9h-64q-14 0-23-9t-9-23v-352h-352q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h352v-352q0-14 9-23t23-9h64q14 0 23 9t9 23v352h352q14 0 23 9t9 23zm128 448v-832q0-66-47-113t-113-47h-832q-66 0-113 47t-47 113v832q0 66 47 113t113 47h832q66 0 113-47t47-113zm128-832v832q0 119-84.5 203.5t-203.5 84.5h-832q-119 0-203.5-84.5t-84.5-203.5v-832q0-119 84.5-203.5t203.5-84.5h832q119 0 203.5 84.5t84.5 203.5z"})))}}]),Rt}(st.a.PureComponent),Rn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",{style:rt(rt({},pr(Pt).style),{},{paddingLeft:"2px",verticalAlign:"top"}),viewBox:"0 0 15 15",fill:"currentColor"},st.a.createElement("path",{d:"M0 14l6-6-6-6z"})))}}]),Rt}(st.a.PureComponent),Jn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",{style:rt(rt({},pr(Pt).style),{},{paddingLeft:"2px",verticalAlign:"top"}),viewBox:"0 0 15 15",fill:"currentColor"},st.a.createElement("path",{d:"M0 5l6 6 6-6z"})))}}]),Rt}(st.a.PureComponent),Nn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",Object.assign({},pr(Pt),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),st.a.createElement("g",null,st.a.createElement("path",{d:"m30 35h-25v-22.5h25v7.5h2.5v-12.5c0-1.4-1.1-2.5-2.5-2.5h-7.5c0-2.8-2.2-5-5-5s-5 2.2-5 5h-7.5c-1.4 0-2.5 1.1-2.5 2.5v27.5c0 1.4 1.1 2.5 2.5 2.5h25c1.4 0 2.5-1.1 2.5-2.5v-5h-2.5v5z m-20-27.5h2.5s2.5-1.1 2.5-2.5 1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5 1.3 2.5 2.5 2.5h2.5s2.5 1.1 2.5 2.5h-20c0-1.5 1.1-2.5 2.5-2.5z m-2.5 20h5v-2.5h-5v2.5z m17.5-5v-5l-10 7.5 10 7.5v-5h12.5v-5h-12.5z m-17.5 10h7.5v-2.5h-7.5v2.5z m12.5-17.5h-12.5v2.5h12.5v-2.5z m-7.5 5h-5v2.5h5v-2.5z"}))))}}]),Rt}(st.a.PureComponent),ar=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",Object.assign({},pr(Pt),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),st.a.createElement("g",null,st.a.createElement("path",{d:"m28.6 25q0-0.5-0.4-1l-4-4 4-4q0.4-0.5 0.4-1 0-0.6-0.4-1.1l-2-2q-0.4-0.4-1-0.4-0.6 0-1 0.4l-4.1 4.1-4-4.1q-0.4-0.4-1-0.4-0.6 0-1 0.4l-2 2q-0.5 0.5-0.5 1.1 0 0.5 0.5 1l4 4-4 4q-0.5 0.5-0.5 1 0 0.7 0.5 1.1l2 2q0.4 0.4 1 0.4 0.6 0 1-0.4l4-4.1 4.1 4.1q0.4 0.4 1 0.4 0.6 0 1-0.4l2-2q0.4-0.4 0.4-1z m8.7-5q0 4.7-2.3 8.6t-6.3 6.2-8.6 2.3-8.6-2.3-6.2-6.2-2.3-8.6 2.3-8.6 6.2-6.2 8.6-2.3 8.6 2.3 6.3 6.2 2.3 8.6z"}))))}}]),Rt}(st.a.PureComponent),Xn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",Object.assign({},pr(Pt),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),st.a.createElement("g",null,st.a.createElement("path",{d:"m30.1 21.4v-2.8q0-0.6-0.4-1t-1-0.5h-5.7v-5.7q0-0.6-0.4-1t-1-0.4h-2.9q-0.6 0-1 0.4t-0.4 1v5.7h-5.7q-0.6 0-1 0.5t-0.5 1v2.8q0 0.6 0.5 1t1 0.5h5.7v5.7q0 0.5 0.4 1t1 0.4h2.9q0.6 0 1-0.4t0.4-1v-5.7h5.7q0.6 0 1-0.5t0.4-1z m7.2-1.4q0 4.7-2.3 8.6t-6.3 6.2-8.6 2.3-8.6-2.3-6.2-6.2-2.3-8.6 2.3-8.6 6.2-6.2 8.6-2.3 8.6 2.3 6.3 6.2 2.3 8.6z"}))))}}]),Rt}(st.a.PureComponent),qn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",Object.assign({},pr(Pt),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),st.a.createElement("g",null,st.a.createElement("path",{d:"m31.6 21.6h-10v10h-3.2v-10h-10v-3.2h10v-10h3.2v10h10v3.2z"}))))}}]),Rt}(st.a.PureComponent),fr=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",Object.assign({},pr(Pt),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),st.a.createElement("g",null,st.a.createElement("path",{d:"m19.8 26.4l2.6-2.6-3.4-3.4-2.6 2.6v1.3h2.2v2.1h1.2z m9.8-16q-0.3-0.4-0.7 0l-7.8 7.8q-0.4 0.4 0 0.7t0.7 0l7.8-7.8q0.4-0.4 0-0.7z m1.8 13.2v4.3q0 2.6-1.9 4.5t-4.5 1.9h-18.6q-2.6 0-4.5-1.9t-1.9-4.5v-18.6q0-2.7 1.9-4.6t4.5-1.8h18.6q1.4 0 2.6 0.5 0.3 0.2 0.4 0.5 0.1 0.4-0.2 0.7l-1.1 1.1q-0.3 0.3-0.7 0.1-0.5-0.1-1-0.1h-18.6q-1.4 0-2.5 1.1t-1 2.5v18.6q0 1.4 1 2.5t2.5 1h18.6q1.5 0 2.5-1t1.1-2.5v-2.9q0-0.2 0.2-0.4l1.4-1.5q0.3-0.3 0.8-0.1t0.4 0.6z m-2.1-16.5l6.4 6.5-15 15h-6.4v-6.5z m9.9 3l-2.1 2-6.4-6.4 2.1-2q0.6-0.7 1.5-0.7t1.5 0.7l3.4 3.4q0.6 0.6 0.6 1.5t-0.6 1.5z"}))))}}]),Rt}(st.a.PureComponent),cr=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",Object.assign({},pr(Pt),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),st.a.createElement("g",null,st.a.createElement("path",{d:"m31.7 16.4q0-0.6-0.4-1l-2.1-2.1q-0.4-0.4-1-0.4t-1 0.4l-9.1 9.1-5-5q-0.5-0.4-1-0.4t-1 0.4l-2.1 2q-0.4 0.4-0.4 1 0 0.6 0.4 1l8.1 8.1q0.4 0.4 1 0.4 0.6 0 1-0.4l12.2-12.1q0.4-0.4 0.4-1z m5.6 3.6q0 4.7-2.3 8.6t-6.3 6.2-8.6 2.3-8.6-2.3-6.2-6.2-2.3-8.6 2.3-8.6 6.2-6.2 8.6-2.3 8.6 2.3 6.3 6.2 2.3 8.6z"}))))}}]),Rt}(st.a.PureComponent);function pr(It){return It||(It={}),{style:rt(rt({verticalAlign:"middle"},It),{},{color:It.color?It.color:"#000000",height:"1em",width:"1em"})}}var xr=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(Wt){var Pt;return nt(this,Rt),(Pt=Nt.call(this,Wt)).copiedTimer=null,Pt.handleCopy=function(){var hn=document.createElement("textarea"),un=Pt.props,tn=un.clickCallback,Gt=un.src,xn=un.namespace;hn.innerHTML=JSON.stringify(Pt.clipboardValue(Gt),null," "),document.body.appendChild(hn),hn.select(),document.execCommand("copy"),document.body.removeChild(hn),Pt.copiedTimer=setTimeout(function(){Pt.setState({copied:!1})},5500),Pt.setState({copied:!0},function(){typeof tn=="function"&&tn({src:Gt,namespace:xn,name:xn[xn.length-1]})})},Pt.getClippyIcon=function(){var hn=Pt.props.theme;return Pt.state.copied?st.a.createElement("span",null,st.a.createElement(Nn,Object.assign({className:"copy-icon"},Bt(hn,"copy-icon"))),st.a.createElement("span",Bt(hn,"copy-icon-copied"),"✔")):st.a.createElement(Nn,Object.assign({className:"copy-icon"},Bt(hn,"copy-icon")))},Pt.clipboardValue=function(hn){switch(_t(hn)){case"function":case"regexp":return hn.toString();default:return hn}},Pt.state={copied:!1},Pt}return at(Rt,[{key:"componentWillUnmount",value:function(){this.copiedTimer&&(clearTimeout(this.copiedTimer),this.copiedTimer=null)}},{key:"render",value:function(){var Wt=this.props,Pt=(Wt.src,Wt.theme),hn=Wt.hidden,un=Wt.rowHovered,tn=Bt(Pt,"copy-to-clipboard").style,Gt="inline";return hn&&(Gt="none"),st.a.createElement("span",{className:"copy-to-clipboard-container",title:"Copy to clipboard",style:{verticalAlign:"top",display:un?"inline-block":"none"}},st.a.createElement("span",{style:rt(rt({},tn),{},{display:Gt}),onClick:this.handleCopy},this.getClippyIcon()))}}]),Rt}(st.a.PureComponent),kr=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(Wt){var Pt;return nt(this,Rt),(Pt=Nt.call(this,Wt)).getEditIcon=function(){var hn=Pt.props,un=hn.variable,tn=hn.theme;return st.a.createElement("div",{className:"click-to-edit",style:{verticalAlign:"top",display:Pt.state.hovered?"inline-block":"none"}},st.a.createElement(fr,Object.assign({className:"click-to-edit-icon"},Bt(tn,"editVarIcon"),{onClick:function(){Pt.prepopInput(un)}})))},Pt.prepopInput=function(hn){if(Pt.props.onEdit!==!1){var un=function(Gt){var xn;switch(_t(Gt)){case"undefined":xn="undefined";break;case"nan":xn="NaN";break;case"string":xn=Gt;break;case"date":case"function":case"regexp":xn=Gt.toString();break;default:try{xn=JSON.stringify(Gt,null," ")}catch{xn=""}}return xn}(hn.value),tn=yt(un);Pt.setState({editMode:!0,editValue:un,parsedInput:{type:tn.type,value:tn.value}})}},Pt.getRemoveIcon=function(){var hn=Pt.props,un=hn.variable,tn=hn.namespace,Gt=hn.theme,xn=hn.rjvId;return st.a.createElement("div",{className:"click-to-remove",style:{verticalAlign:"top",display:Pt.state.hovered?"inline-block":"none"}},st.a.createElement(ar,Object.assign({className:"click-to-remove-icon"},Bt(Gt,"removeVarIcon"),{onClick:function(){Bn.dispatch({name:"VARIABLE_REMOVED",rjvId:xn,data:{name:un.name,namespace:tn,existing_value:un.value,variable_removed:!0}})}})))},Pt.getValue=function(hn,un){var tn=!un&&hn.type,Gt=ft(Pt).props;switch(tn){case!1:return Pt.getEditInput();case"string":return st.a.createElement(En,Object.assign({value:hn.value},Gt));case"integer":return st.a.createElement(kn,Object.assign({value:hn.value},Gt));case"float":return st.a.createElement(Qt,Object.assign({value:hn.value},Gt));case"boolean":return st.a.createElement(rn,Object.assign({value:hn.value},Gt));case"function":return st.a.createElement(An,Object.assign({value:hn.value},Gt));case"null":return st.a.createElement(On,Gt);case"nan":return st.a.createElement(yn,Gt);case"undefined":return st.a.createElement(gn,Gt);case"date":return st.a.createElement(nn,Object.assign({value:hn.value},Gt));case"regexp":return st.a.createElement(vn,Object.assign({value:hn.value},Gt));default:return st.a.createElement("div",{className:"object-value"},JSON.stringify(hn.value))}},Pt.getEditInput=function(){var hn=Pt.props.theme,un=Pt.state.editValue;return st.a.createElement("div",null,st.a.createElement(pt,Object.assign({type:"text",inputRef:function(tn){return tn&&tn.focus()},value:un,className:"variable-editor",onChange:function(tn){var Gt=tn.target.value,xn=yt(Gt);Pt.setState({editValue:Gt,parsedInput:{type:xn.type,value:xn.value}})},onKeyDown:function(tn){switch(tn.key){case"Escape":Pt.setState({editMode:!1,editValue:""});break;case"Enter":(tn.ctrlKey||tn.metaKey)&&Pt.submitEdit(!0)}tn.stopPropagation()},placeholder:"update this value",minRows:2},Bt(hn,"edit-input"))),st.a.createElement("div",Bt(hn,"edit-icon-container"),st.a.createElement(ar,Object.assign({className:"edit-cancel"},Bt(hn,"cancel-icon"),{onClick:function(){Pt.setState({editMode:!1,editValue:""})}})),st.a.createElement(cr,Object.assign({className:"edit-check string-value"},Bt(hn,"check-icon"),{onClick:function(){Pt.submitEdit()}})),st.a.createElement("div",null,Pt.showDetected())))},Pt.submitEdit=function(hn){var un=Pt.props,tn=un.variable,Gt=un.namespace,xn=un.rjvId,Gn=Pt.state,er=Gn.editValue,tr=Gn.parsedInput,ir=er;hn&&tr.type&&(ir=tr.value),Pt.setState({editMode:!1}),Bn.dispatch({name:"VARIABLE_UPDATED",rjvId:xn,data:{name:tn.name,namespace:Gt,existing_value:tn.value,new_value:ir,variable_removed:!1}})},Pt.showDetected=function(){var hn=Pt.props,un=hn.theme,tn=(hn.variable,hn.namespace,hn.rjvId,Pt.state.parsedInput),Gt=(tn.type,tn.value,Pt.getDetectedInput());if(Gt)return st.a.createElement("div",null,st.a.createElement("div",Bt(un,"detected-row"),Gt,st.a.createElement(cr,{className:"edit-check detected",style:rt({verticalAlign:"top",paddingLeft:"3px"},Bt(un,"check-icon").style),onClick:function(){Pt.submitEdit(!0)}})))},Pt.getDetectedInput=function(){var hn=Pt.state.parsedInput,un=hn.type,tn=hn.value,Gt=ft(Pt).props,xn=Gt.theme;if(un!==!1)switch(un.toLowerCase()){case"object":return st.a.createElement("span",null,st.a.createElement("span",{style:rt(rt({},Bt(xn,"brace").style),{},{cursor:"default"})},"{"),st.a.createElement("span",{style:rt(rt({},Bt(xn,"ellipsis").style),{},{cursor:"default"})},"..."),st.a.createElement("span",{style:rt(rt({},Bt(xn,"brace").style),{},{cursor:"default"})},"}"));case"array":return st.a.createElement("span",null,st.a.createElement("span",{style:rt(rt({},Bt(xn,"brace").style),{},{cursor:"default"})},"["),st.a.createElement("span",{style:rt(rt({},Bt(xn,"ellipsis").style),{},{cursor:"default"})},"..."),st.a.createElement("span",{style:rt(rt({},Bt(xn,"brace").style),{},{cursor:"default"})},"]"));case"string":return st.a.createElement(En,Object.assign({value:tn},Gt));case"integer":return st.a.createElement(kn,Object.assign({value:tn},Gt));case"float":return st.a.createElement(Qt,Object.assign({value:tn},Gt));case"boolean":return st.a.createElement(rn,Object.assign({value:tn},Gt));case"function":return st.a.createElement(An,Object.assign({value:tn},Gt));case"null":return st.a.createElement(On,Gt);case"nan":return st.a.createElement(yn,Gt);case"undefined":return st.a.createElement(gn,Gt);case"date":return st.a.createElement(nn,Object.assign({value:new Date(tn)},Gt))}},Pt.state={editMode:!1,editValue:"",hovered:!1,renameKey:!1,parsedInput:{type:!1,value:null}},Pt}return at(Rt,[{key:"render",value:function(){var Wt=this,Pt=this.props,hn=Pt.variable,un=Pt.singleIndent,tn=Pt.type,Gt=Pt.theme,xn=Pt.namespace,Gn=Pt.indentWidth,er=Pt.enableClipboard,tr=Pt.onEdit,ir=Pt.onDelete,Kn=Pt.onSelect,rr=Pt.displayArrayKey,ur=Pt.quotesOnKeys,or=this.state.editMode;return st.a.createElement("div",Object.assign({},Bt(Gt,"objectKeyVal",{paddingLeft:Gn*un}),{onMouseEnter:function(){return Wt.setState(rt(rt({},Wt.state),{},{hovered:!0}))},onMouseLeave:function(){return Wt.setState(rt(rt({},Wt.state),{},{hovered:!1}))},className:"variable-row",key:hn.name}),tn=="array"?rr?st.a.createElement("span",Object.assign({},Bt(Gt,"array-key"),{key:hn.name+"_"+xn}),hn.name,st.a.createElement("div",Bt(Gt,"colon"),":")):null:st.a.createElement("span",null,st.a.createElement("span",Object.assign({},Bt(Gt,"object-name"),{className:"object-key",key:hn.name+"_"+xn}),!!ur&&st.a.createElement("span",{style:{verticalAlign:"top"}},'"'),st.a.createElement("span",{style:{display:"inline-block"}},hn.name),!!ur&&st.a.createElement("span",{style:{verticalAlign:"top"}},'"')),st.a.createElement("span",Bt(Gt,"colon"),":")),st.a.createElement("div",Object.assign({className:"variable-value",onClick:Kn===!1&&tr===!1?null:function(yr){var mr=jn(xn);(yr.ctrlKey||yr.metaKey)&&tr!==!1?Wt.prepopInput(hn):Kn!==!1&&(mr.shift(),Kn(rt(rt({},hn),{},{namespace:mr})))}},Bt(Gt,"variableValue",{cursor:Kn===!1?"default":"pointer"})),this.getValue(hn,or)),er?st.a.createElement(xr,{rowHovered:this.state.hovered,hidden:or,src:hn.value,clickCallback:er,theme:Gt,namespace:[].concat(jn(xn),[hn.name])}):null,tr!==!1&&or==0?this.getEditIcon():null,ir!==!1&&or==0?this.getRemoveIcon():null)}}]),Rt}(st.a.PureComponent),Tr=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){var Wt;nt(this,Rt);for(var Pt=arguments.length,hn=new Array(Pt),un=0;un0?er:null,namespace:Gn.splice(0,Gn.length-1),existing_value:tr,variable_removed:!1,key_name:null};_t(tr)==="object"?Bn.dispatch({name:"ADD_VARIABLE_KEY_REQUEST",rjvId:ir,data:rr}):Bn.dispatch({name:"VARIABLE_ADDED",rjvId:ir,data:rt(rt({},rr),{},{new_value:[].concat(jn(tr),[null])})})}})))},Wt.getRemoveObject=function(tn){var Gt=Wt.props,xn=Gt.theme,Gn=(Gt.hover,Gt.namespace),er=Gt.name,tr=Gt.src,ir=Gt.rjvId;if(Gn.length!==1)return st.a.createElement("span",{className:"click-to-remove",style:{display:tn?"inline-block":"none"}},st.a.createElement(ar,Object.assign({className:"click-to-remove-icon"},Bt(xn,"removeVarIcon"),{onClick:function(){Bn.dispatch({name:"VARIABLE_REMOVED",rjvId:ir,data:{name:er,namespace:Gn.splice(0,Gn.length-1),existing_value:tr,variable_removed:!0}})}})))},Wt.render=function(){var tn=Wt.props,Gt=tn.theme,xn=tn.onDelete,Gn=tn.onAdd,er=tn.enableClipboard,tr=tn.src,ir=tn.namespace,Kn=tn.rowHovered;return st.a.createElement("div",Object.assign({},Bt(Gt,"object-meta-data"),{className:"object-meta-data",onClick:function(rr){rr.stopPropagation()}}),Wt.getObjectSize(),er?st.a.createElement(xr,{rowHovered:Kn,clickCallback:er,src:tr,theme:Gt,namespace:ir}):null,Gn!==!1?Wt.getAddAttribute(Kn):null,xn!==!1?Wt.getRemoveObject(Kn):null)},Wt}return Rt}(st.a.PureComponent);function Br(It){var Nt=It.parent_type,Rt=It.namespace,Wt=It.quotesOnKeys,Pt=It.theme,hn=It.jsvRoot,un=It.name,tn=It.displayArrayKey,Gt=It.name?It.name:"";return!hn||un!==!1&&un!==null?Nt=="array"?tn?st.a.createElement("span",Object.assign({},Bt(Pt,"array-key"),{key:Rt}),st.a.createElement("span",{className:"array-key"},Gt),st.a.createElement("span",Bt(Pt,"colon"),":")):st.a.createElement("span",null):st.a.createElement("span",Object.assign({},Bt(Pt,"object-name"),{key:Rt}),st.a.createElement("span",{className:"object-key"},Wt&&st.a.createElement("span",{style:{verticalAlign:"top"}},'"'),st.a.createElement("span",null,Gt),Wt&&st.a.createElement("span",{style:{verticalAlign:"top"}},'"')),st.a.createElement("span",Bt(Pt,"colon"),":")):st.a.createElement("span",null)}function Rr(It){var Nt=It.theme;switch(It.iconStyle){case"triangle":return st.a.createElement(Jn,Object.assign({},Bt(Nt,"expanded-icon"),{className:"expanded-icon"}));case"square":return st.a.createElement(mn,Object.assign({},Bt(Nt,"expanded-icon"),{className:"expanded-icon"}));default:return st.a.createElement(sn,Object.assign({},Bt(Nt,"expanded-icon"),{className:"expanded-icon"}))}}function Ur(It){var Nt=It.theme;switch(It.iconStyle){case"triangle":return st.a.createElement(Rn,Object.assign({},Bt(Nt,"collapsed-icon"),{className:"collapsed-icon"}));case"square":return st.a.createElement(Qn,Object.assign({},Bt(Nt,"collapsed-icon"),{className:"collapsed-icon"}));default:return st.a.createElement(ln,Object.assign({},Bt(Nt,"collapsed-icon"),{className:"collapsed-icon"}))}}var Qr=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(Wt){var Pt;return nt(this,Rt),(Pt=Nt.call(this,Wt)).toggleCollapsed=function(hn){var un=[];for(var tn in Pt.state.expanded)un.push(Pt.state.expanded[tn]);un[hn]=!un[hn],Pt.setState({expanded:un})},Pt.state={expanded:[]},Pt}return at(Rt,[{key:"getExpandedIcon",value:function(Wt){var Pt=this.props,hn=Pt.theme,un=Pt.iconStyle;return this.state.expanded[Wt]?st.a.createElement(Rr,{theme:hn,iconStyle:un}):st.a.createElement(Ur,{theme:hn,iconStyle:un})}},{key:"render",value:function(){var Wt=this,Pt=this.props,hn=Pt.src,un=Pt.groupArraysAfterLength,tn=(Pt.depth,Pt.name),Gt=Pt.theme,xn=Pt.jsvRoot,Gn=Pt.namespace,er=(Pt.parent_type,kt(Pt,["src","groupArraysAfterLength","depth","name","theme","jsvRoot","namespace","parent_type"])),tr=0,ir=5*this.props.indentWidth;xn||(tr=5*this.props.indentWidth);var Kn=un,rr=Math.ceil(hn.length/Kn);return st.a.createElement("div",Object.assign({className:"object-key-val"},Bt(Gt,xn?"jsv-root":"objectKeyVal",{paddingLeft:tr})),st.a.createElement(Br,this.props),st.a.createElement("span",null,st.a.createElement(Tr,Object.assign({size:hn.length},this.props))),jn(Array(rr)).map(function(ur,or){return st.a.createElement("div",Object.assign({key:or,className:"object-key-val array-group"},Bt(Gt,"objectKeyVal",{marginLeft:6,paddingLeft:ir})),st.a.createElement("span",Bt(Gt,"brace-row"),st.a.createElement("div",Object.assign({className:"icon-container"},Bt(Gt,"icon-container"),{onClick:function(yr){Wt.toggleCollapsed(or)}}),Wt.getExpandedIcon(or)),Wt.state.expanded[or]?st.a.createElement(St,Object.assign({key:tn+or,depth:0,name:!1,collapsed:!1,groupArraysAfterLength:Kn,index_offset:or*Kn,src:hn.slice(or*Kn,or*Kn+Kn),namespace:Gn,type:"array",parent_type:"array_group",theme:Gt},er)):st.a.createElement("span",Object.assign({},Bt(Gt,"brace"),{onClick:function(yr){Wt.toggleCollapsed(or)},className:"array-group-brace"}),"[",st.a.createElement("div",Object.assign({},Bt(Gt,"array-group-meta-data"),{className:"array-group-meta-data"}),st.a.createElement("span",Object.assign({className:"object-size"},Bt(Gt,"object-size")),or*Kn," - ",or*Kn+Kn>hn.length?hn.length:or*Kn+Kn)),"]")))}))}}]),Rt}(st.a.PureComponent),Zr=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(Wt){var Pt;nt(this,Rt),(Pt=Nt.call(this,Wt)).toggleCollapsed=function(){Pt.setState({expanded:!Pt.state.expanded},function(){dn.set(Pt.props.rjvId,Pt.props.namespace,"expanded",Pt.state.expanded)})},Pt.getObjectContent=function(un,tn,Gt){return st.a.createElement("div",{className:"pushed-content object-container"},st.a.createElement("div",Object.assign({className:"object-content"},Bt(Pt.props.theme,"pushed-content")),Pt.renderObjectContents(tn,Gt)))},Pt.getEllipsis=function(){return Pt.state.size===0?null:st.a.createElement("div",Object.assign({},Bt(Pt.props.theme,"ellipsis"),{className:"node-ellipsis",onClick:Pt.toggleCollapsed}),"...")},Pt.getObjectMetaData=function(un){var tn=Pt.props,Gt=(tn.rjvId,tn.theme,Pt.state),xn=Gt.size,Gn=Gt.hovered;return st.a.createElement(Tr,Object.assign({rowHovered:Gn,size:xn},Pt.props))},Pt.renderObjectContents=function(un,tn){var Gt,xn=Pt.props,Gn=xn.depth,er=xn.parent_type,tr=xn.index_offset,ir=xn.groupArraysAfterLength,Kn=xn.namespace,rr=Pt.state.object_type,ur=[],or=Object.keys(un||{});return Pt.props.sortKeys&&rr!=="array"&&(or=or.sort()),or.forEach(function(yr){if(Gt=new mo(yr,un[yr]),er==="array_group"&&tr&&(Gt.name=parseInt(Gt.name)+tr),un.hasOwnProperty(yr))if(Gt.type==="object")ur.push(st.a.createElement(St,Object.assign({key:Gt.name,depth:Gn+1,name:Gt.name,src:Gt.value,namespace:Kn.concat(Gt.name),parent_type:rr},tn)));else if(Gt.type==="array"){var mr=St;ir&&Gt.value.length>ir&&(mr=Qr),ur.push(st.a.createElement(mr,Object.assign({key:Gt.name,depth:Gn+1,name:Gt.name,src:Gt.value,namespace:Kn.concat(Gt.name),type:"array",parent_type:rr},tn)))}else ur.push(st.a.createElement(kr,Object.assign({key:Gt.name+"_"+Kn,variable:Gt,singleIndent:5,namespace:Kn,type:Pt.props.type},tn)))}),ur};var hn=Rt.getState(Wt);return Pt.state=rt(rt({},hn),{},{prevProps:{}}),Pt}return at(Rt,[{key:"getBraceStart",value:function(Wt,Pt){var hn=this,un=this.props,tn=un.src,Gt=un.theme,xn=un.iconStyle;if(un.parent_type==="array_group")return st.a.createElement("span",null,st.a.createElement("span",Bt(Gt,"brace"),Wt==="array"?"[":"{"),Pt?this.getObjectMetaData(tn):null);var Gn=Pt?Rr:Ur;return st.a.createElement("span",null,st.a.createElement("span",Object.assign({onClick:function(er){hn.toggleCollapsed()}},Bt(Gt,"brace-row")),st.a.createElement("div",Object.assign({className:"icon-container"},Bt(Gt,"icon-container")),st.a.createElement(Gn,{theme:Gt,iconStyle:xn})),st.a.createElement(Br,this.props),st.a.createElement("span",Bt(Gt,"brace"),Wt==="array"?"[":"{")),Pt?this.getObjectMetaData(tn):null)}},{key:"render",value:function(){var Wt=this,Pt=this.props,hn=Pt.depth,un=Pt.src,tn=(Pt.namespace,Pt.name,Pt.type,Pt.parent_type),Gt=Pt.theme,xn=Pt.jsvRoot,Gn=Pt.iconStyle,er=kt(Pt,["depth","src","namespace","name","type","parent_type","theme","jsvRoot","iconStyle"]),tr=this.state,ir=tr.object_type,Kn=tr.expanded,rr={};return xn||tn==="array_group"?tn==="array_group"&&(rr.borderLeft=0,rr.display="inline"):rr.paddingLeft=5*this.props.indentWidth,st.a.createElement("div",Object.assign({className:"object-key-val",onMouseEnter:function(){return Wt.setState(rt(rt({},Wt.state),{},{hovered:!0}))},onMouseLeave:function(){return Wt.setState(rt(rt({},Wt.state),{},{hovered:!1}))}},Bt(Gt,xn?"jsv-root":"objectKeyVal",rr)),this.getBraceStart(ir,Kn),Kn?this.getObjectContent(hn,un,rt({theme:Gt,iconStyle:Gn},er)):this.getEllipsis(),st.a.createElement("span",{className:"brace-row"},st.a.createElement("span",{style:rt(rt({},Bt(Gt,"brace").style),{},{paddingLeft:Kn?"3px":"0px"})},ir==="array"?"]":"}"),Kn?null:this.getObjectMetaData(un)))}}],[{key:"getDerivedStateFromProps",value:function(Wt,Pt){var hn=Pt.prevProps;return Wt.src!==hn.src||Wt.collapsed!==hn.collapsed||Wt.name!==hn.name||Wt.namespace!==hn.namespace||Wt.rjvId!==hn.rjvId?rt(rt({},Rt.getState(Wt)),{},{prevProps:Wt}):null}}]),Rt}(st.a.PureComponent);Zr.getState=function(It){var Nt=Object.keys(It.src).length,Rt=(It.collapsed===!1||It.collapsed!==!0&&It.collapsed>It.depth)&&(!It.shouldCollapse||It.shouldCollapse({name:It.name,src:It.src,type:_t(It.src),namespace:It.namespace})===!1)&&Nt!==0;return{expanded:dn.get(It.rjvId,It.namespace,"expanded",Rt),object_type:It.type==="array"?"array":"object",parent_type:It.type==="array"?"array":"object",size:Nt,hovered:!1}};var mo=function It(Nt,Rt){nt(this,It),this.name=Nt,this.value=Rt,this.type=_t(Rt)};Mt(Zr);var St=Zr,Dt=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){var Wt;nt(this,Rt);for(var Pt=arguments.length,hn=new Array(Pt),un=0;untn.groupArraysAfterLength&&(xn=Qr),st.a.createElement("div",{className:"pretty-json-container object-container"},st.a.createElement("div",{className:"object-content"},st.a.createElement(xn,Object.assign({namespace:Gt,depth:0,jsvRoot:!0},tn))))},Wt}return Rt}(st.a.PureComponent),$t=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(Wt){var Pt;return nt(this,Rt),(Pt=Nt.call(this,Wt)).closeModal=function(){Bn.dispatch({rjvId:Pt.props.rjvId,name:"RESET"})},Pt.submit=function(){Pt.props.submit(Pt.state.input)},Pt.state={input:Wt.input?Wt.input:""},Pt}return at(Rt,[{key:"render",value:function(){var Wt=this,Pt=this.props,hn=Pt.theme,un=Pt.rjvId,tn=Pt.isValid,Gt=this.state.input,xn=tn(Gt);return st.a.createElement("div",Object.assign({className:"key-modal-request"},Bt(hn,"key-modal-request"),{onClick:this.closeModal}),st.a.createElement("div",Object.assign({},Bt(hn,"key-modal"),{onClick:function(Gn){Gn.stopPropagation()}}),st.a.createElement("div",Bt(hn,"key-modal-label"),"Key Name:"),st.a.createElement("div",{style:{position:"relative"}},st.a.createElement("input",Object.assign({},Bt(hn,"key-modal-input"),{className:"key-modal-input",ref:function(Gn){return Gn&&Gn.focus()},spellCheck:!1,value:Gt,placeholder:"...",onChange:function(Gn){Wt.setState({input:Gn.target.value})},onKeyPress:function(Gn){xn&&Gn.key==="Enter"?Wt.submit():Gn.key==="Escape"&&Wt.closeModal()}})),xn?st.a.createElement(cr,Object.assign({},Bt(hn,"key-modal-submit"),{className:"key-modal-submit",onClick:function(Gn){return Wt.submit()}})):null),st.a.createElement("span",Bt(hn,"key-modal-cancel"),st.a.createElement(qn,Object.assign({},Bt(hn,"key-modal-cancel-icon"),{className:"key-modal-cancel",onClick:function(){Bn.dispatch({rjvId:un,name:"RESET"})}})))))}}]),Rt}(st.a.PureComponent),mt=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){var Wt;nt(this,Rt);for(var Pt=arguments.length,hn=new Array(Pt),un=0;un{_($.updated_src)},[]);return jsxs("div",{className:"send-tx-form",children:[jsx$1("h3",{children:"Configure and send transaction"}),jsx$1(ReactJson,{theme:"ocean",src:defaultTx,onEdit:j,onAdd:j,onDelete:j}),d?jsx$1("button",{onClick:()=>k.sendTransaction(b),children:"Send transaction"}):jsx$1("button",{onClick:()=>k.openModal(),children:"Connect wallet to send the transaction"})]})}const footer="",style$3="",defaultColors={[THEME.LIGHT]:{constant:{black:"#000000",white:"#FFFFFF"},connectButton:{background:"#0098EA",foreground:"#FFFFFF"},accent:"#0098EA",telegramButton:"#0098EA",icon:{primary:"#0F0F0F",secondary:"#7A8999",tertiary:"#C1CAD2",success:"#29CC6A",error:"#F5A73B"},background:{primary:"#FFFFFF",secondary:"#F1F3F5",segment:"#FFFFFF",tint:"#F1F3F5",qr:"#F1F3F5"},text:{primary:"#0F0F0F",secondary:"#6A7785"}},[THEME.DARK]:{constant:{black:"#000000",white:"#FFFFFF"},connectButton:{background:"#0098EA",foreground:"#FFFFFF"},accent:"#E5E5EA",telegramButton:"#31A6F5",icon:{primary:"#E5E5EA",secondary:"#909099",tertiary:"#434347",success:"#29CC6A",error:"#F5A73B"},background:{primary:"#121214",secondary:"#18181A",segment:"#262629",tint:"#222224",qr:"#F1F3F5"},text:{primary:"#E5E5EA",secondary:"#7D7D85"}}},ColorsSelect=({theme:b})=>{const[_,d]=useTonConnectUI(),[k,j]=reactExports.useState(defaultColors[b]);reactExports.useEffect(()=>{j(defaultColors[b])},[b]);const $=(et,tt,rt)=>{d({uiPreferences:{colorsSet:{[b]:{[tt]:rt?{...k[tt],[rt]:et}:et}}}}),j(nt=>({...nt,[tt]:rt?{...nt[tt],[rt]:et}:et})),defaultColors[b]={...defaultColors[b],[tt]:rt?{...k[tt],[rt]:et}:et}};return jsx$1("div",{className:"colors-container",children:Object.entries(k).map(([et,tt])=>typeof tt=="object"?jsxs("div",{children:[jsxs("span",{children:[et,":"]}),Object.entries(tt).map(([rt,nt])=>jsxs("label",{children:[rt,jsx$1("input",{type:"color",value:k[et][rt],onChange:ot=>$(ot.target.value,et,rt)})]},et+rt))]},et):jsxs("div",{children:[jsxs("span",{children:[et,":"]}),jsx$1("label",{children:jsx$1("input",{type:"color",value:k[et],onChange:rt=>$(rt.target.value,et)})})]}))})},style$2="",ColorsModal=()=>{const[b,_]=reactExports.useState(!1),[d,k]=reactExports.useState(THEME.LIGHT);return jsxs(Fragment,{children:[jsx$1("button",{onClick:()=>_(!0),children:"change colors"}),b&&jsxs("div",{className:"modal",children:[jsx$1("button",{onClick:()=>_(!1),children:"close"}),jsxs("div",{className:"modal__toggle",children:[jsx$1("a",{href:"#",style:{color:d===THEME.LIGHT?"blue":"white"},onClick:()=>k(THEME.LIGHT),children:"LIGHT"}),jsx$1("a",{href:"#",style:{color:d===THEME.DARK?"blue":"white"},onClick:()=>k(THEME.DARK),children:"DARK"})]}),jsx$1(ColorsSelect,{theme:d})]})]})},Footer=()=>{const[b,_]=reactExports.useState([!0,!1,!1,!0,!0,!0]),[d,k]=reactExports.useState("back"),[j,$]=reactExports.useState("ios"),[et,tt]=reactExports.useState(!0),[rt,nt]=useTonConnectUI(),ot=lt=>{nt({language:lt})},at=lt=>{nt({uiPreferences:{theme:lt}})},it=lt=>{nt({uiPreferences:{borderRadius:lt}})},dt=lt=>{_(ct=>ct.map((gt,st)=>st===lt?!gt:gt))},ut=lt=>{tt(lt)},ht=()=>{if(!d){k("back");return}nt({actionsConfiguration:{returnStrategy:d}})},ft=()=>{if(!j){$("ios");return}nt({actionsConfiguration:{skipRedirectToWallet:j}})};return reactExports.useEffect(()=>{const lt=["before","success","error"],ct=lt.map((st,Ct)=>b[Ct]?st:void 0).filter(st=>st),gt=lt.map((st,Ct)=>b[Ct+3]?st:void 0).filter(st=>st);nt({actionsConfiguration:{modals:ct,notifications:gt}})},[b]),reactExports.useEffect(()=>{nt({enableAndroidBackHandler:et})},[et]),jsxs("footer",{className:"footer",children:[jsxs("div",{children:[jsx$1("label",{children:"language"}),jsxs("select",{onChange:lt=>ot(lt.target.value),children:[jsx$1("option",{value:"en",children:"en"}),jsx$1("option",{value:"ru",children:"ru"})]})]}),jsxs("div",{children:[jsx$1("label",{children:"theme"}),jsxs("select",{onChange:lt=>at(lt.target.value),children:[jsx$1("option",{value:THEME.DARK,children:"dark"}),jsx$1("option",{value:THEME.LIGHT,children:"light"}),jsx$1("option",{value:"SYSTEM",children:"system"})]})]}),jsxs("div",{children:[jsx$1("label",{children:"borders"}),jsxs("select",{onChange:lt=>it(lt.target.value),children:[jsx$1("option",{value:"m",children:"m"}),jsx$1("option",{value:"s",children:"s"}),jsx$1("option",{value:"none",children:"none"})]})]}),jsxs("div",{children:[jsx$1("label",{children:"enable android back handler"}),jsxs("select",{onChange:lt=>ut(lt.target.value==="true"),value:et.toString(),children:[jsx$1("option",{value:"true",children:"true"}),jsx$1("option",{value:"false",children:"false"})]})]}),jsxs("div",{className:"footer-checkbox-container",children:[jsx$1("span",{children:"modals"}),jsxs("label",{children:["before",jsx$1("input",{type:"checkbox",checked:b[0],onChange:()=>dt(0)})]}),jsxs("label",{children:["success",jsx$1("input",{type:"checkbox",checked:b[1],onChange:()=>dt(1)})]}),jsxs("label",{children:["error",jsx$1("input",{type:"checkbox",checked:b[2],onChange:()=>dt(2)})]})]}),jsxs("div",{className:"footer-checkbox-container",children:[jsx$1("span",{children:"notifications"}),jsxs("label",{children:["before",jsx$1("input",{type:"checkbox",checked:b[3],onChange:()=>dt(3)})]}),jsxs("label",{children:["success",jsx$1("input",{type:"checkbox",checked:b[4],onChange:()=>dt(4)})]}),jsxs("label",{children:["error",jsx$1("input",{type:"checkbox",checked:b[5],onChange:()=>dt(5)})]})]}),jsx$1("div",{children:jsx$1(ColorsModal,{})}),jsx$1("div",{children:jsxs("label",{children:["return strategy:",jsx$1("input",{style:{width:"200px"},value:d,onChange:lt=>k(lt.target.value),onBlur:ht})]})}),jsx$1("div",{children:jsxs("label",{children:[jsx$1("div",{children:"skip redirect to wallet:"}),jsx$1("div",{children:"('ios', 'never', 'always')"}),jsx$1("input",{style:{width:"200px"},value:j,onChange:lt=>$(lt.target.value),onBlur:ft})]})})]})},style$1="";class TonProofDemoApiService{constructor(){Jo(this,"localStorageKey","demo-api-access-token");Jo(this,"host",document.baseURI.replace(/\/$/,""));Jo(this,"accessToken",null);Jo(this,"refreshIntervalMs",9*60*1e3);this.accessToken=localStorage.getItem(this.localStorageKey),this.accessToken||this.generatePayload()}async generatePayload(){try{return{tonProof:(await(await fetch(`${this.host}/api/generate_payload`,{method:"POST"})).json()).payload}}catch{return null}}async checkProof(_,d){try{const k={address:d.address,network:d.chain,public_key:d.publicKey,proof:{..._,state_init:d.walletStateInit}},j=await(await fetch(`${this.host}/api/check_proof`,{method:"POST",body:JSON.stringify(k)})).json();j!=null&&j.token&&(localStorage.setItem(this.localStorageKey,j.token),this.accessToken=j.token)}catch(k){console.log("checkProof error:",k)}}async getAccountInfo(_){return await(await fetch(`${this.host}/api/get_account_info`,{headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":"application/json"}})).json()}async createJetton(_){return await(await fetch(`${this.host}/api/create_jetton`,{body:JSON.stringify(_),headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":"application/json"},method:"POST"})).json()}reset(){this.accessToken=null,localStorage.removeItem(this.localStorageKey),this.generatePayload()}}const TonProofDemoApi=new TonProofDemoApiService;function useInterval(b,_){const d=reactExports.useRef(b);reactExports.useLayoutEffect(()=>{d.current=b},[b]),reactExports.useEffect(()=>{if(!_&&_!==0)return;const k=setInterval(()=>d.current(),_);return()=>clearInterval(k)},[_])}const TonProofDemo=()=>{const b=reactExports.useRef(!0),[_,d]=reactExports.useState({}),k=useTonWallet(),[j,$]=reactExports.useState(!1),[et]=useTonConnectUI(),tt=reactExports.useCallback(async()=>{b.current&&(et.setConnectRequestParameters({state:"loading"}),b.current=!1);const nt=await TonProofDemoApi.generatePayload();nt?et.setConnectRequestParameters({state:"ready",value:nt}):et.setConnectRequestParameters(null)},[et,b]);b.current&&tt(),useInterval(tt,TonProofDemoApi.refreshIntervalMs),reactExports.useEffect(()=>et.onStatusChange(async nt=>{var ot;if(!nt){TonProofDemoApi.reset(),$(!1);return}if((ot=nt.connectItems)!=null&&ot.tonProof&&"proof"in nt.connectItems.tonProof&&await TonProofDemoApi.checkProof(nt.connectItems.tonProof.proof,nt.account),!TonProofDemoApi.accessToken){et.disconnect(),$(!1);return}$(!0)}),[et]);const rt=reactExports.useCallback(async()=>{if(!k)return;const nt=await TonProofDemoApi.getAccountInfo(k.account);d(nt)},[k]);return j?jsxs("div",{className:"ton-proof-demo",children:[jsx$1("h3",{children:"Demo backend API with ton_proof verification"}),j?jsx$1("button",{onClick:rt,children:"Call backend getAccountInfo()"}):jsx$1("div",{className:"ton-proof-demo__error",children:"Connect wallet to call API"}),jsx$1(ReactJson,{src:_,name:"response",theme:"ocean"})]}):null},style="",jetton={name:"Joint Photographic Experts Group",description:"JPEG is a commonly used method of lossy compression for digital images, particularly for those images produced by digital photography. The degree of compression can be adjusted, allowing a selectable tradeoff between storage size and image quality.",image_data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAdVBMVEX///8rKytSUlITExPT09Pm5uYcHBzKysqXl5cZGRmnp6cnJydISEjr6+tOTk5LS0swMDAhISHa2tq3t7fg4OBra2sKCgrw8PB3d3dCQkJeXl49PT29vb2goKCvr68AAADOzs5jY2ODg4ONjY1wcHA2NjaSkpJ0yRZUAAAFXklEQVR4nO3de3eaMBgGcCEIxkgVCiiIVG3t9/+IS8LFS+1ERy665/ljZwW3k99yeV9x5zgaIQiCIAiCIAiCIAiCIAhiLGFQTf85iWnF7wkKQui/Z2Yt8TuLnCEyn1tKnGSD+BznzbVzFuOPgYBc6Fo5i1/DLNFa+PZmIZEMBRRC152NTYMuMx5YaN9e9IYWurYtVAVCy46b4YW27UUVQrv2ohKhVUVDidCqhapIaNFCVSW0p4FTJrSmaCgTWrMXFQot2YsqhXY0cGqFNuxFpUIrFqpioQVFQ7XQfAOnWmi+aKgXmt6LGoSG96IOodmioUNodi/qEZrci5qEBhs4bUJjs6hLaG6h6hOaKhoahYYaOI1CQ0VDq9DIXtQrNFE0dAv1HzeahQb2onah9r2oX6i7aOgX8gZO60I1INS8UI0ItTZwZoQ696IZoc6iYUqoby8aE2pr4AwKNR03Awrn9wl1LdQBhbN7hXqIAwrXdwu1FI0BhYu7hVqKxoDCByZRx0IdUsjyB4jKT9QhhY/Nouq9OKzQcQ757N4cwqcS3h+WBS8udAiEEEJoGgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQWCJmM3cIFz/F34gdCaMROb5/llEejfO6689whfb+Uz4CQlHEczyQoiD2ZIKj2efNSWjUXm8QTv/ORYrpNxstwnHhVyvoZTQi34TicS2EcjuuEYTiu6rVH3tuLza1NKyRFEHb3wtBbZX0WqwlhwAfYCGtcKAcexmvWCsNjlo2Q0c2yvtP8Ml4Ghx7TaF64X61WmyoR4962cxhWk2NS+VLmlJIWTNKiSPel/AOxe5toXpj7UeSTw7cY8affCHfE71IvRSqnNiiIHzEWRWQ9FT8nhycQ1mcOIxM+4rgVppdzQ8XtcEO76/zU4dPY42tObRE6bCF2Vs6uC9laAs++edefe4Xv3Iw1QifzuCH9RSgvBvSC3avw2yaMrgpZLia4eOibd+0RMoGYX5/DaCWm8LEO0Boh+eQ7LaHtSUOjLk5zbdJj01kpzIXCJ6u2fak1qy7iuCRbPr+7O9ptq4SrNE33E08W8AP70dMsY3GAij0664R+1uX2yjUvPOnaZu2KPG1LvYzXikRMdiv0N8su3s3Tx7ywa73LtRytFB7fXsT8gLkUTo7/BsGTCJO43BTNO8T6pHHO3x6erdJ2DsMnEYqBM+bTdvzXqoU4aY7X2KyQSZPnEZ7dviIUbTdvStsf6wcZ0fqFhKLij7cXfxfLX0jI1qLh+dHKvZDQIRWfRM85e+lrCdlBtAHv9PS17JX2Ia8Q8hlAuTj2pkw2ek8r3GW0S42ilezrVhnvyZloZNfywrMKx+W06rKpr0fvdWs33afu12ojHyyG2/xmO26p8ORpYui1NyZ1+8q78bB5pvje412+YSEf6FXhWevd3qFFuTx5Irws+zymMSwsgyC4XGf+Zhuc5b27xWix8Zq3IsG3S29PoBlhtO3WJuH5MUyfnOf0+ROj2drdpUXuE7/nG2ITnz3xNwrJ7RPit4iO1O5P1+Rzs3hxZSxqolkY+X72yetdqe+zYb3CaL/5rMRBuH/o0ecTCOl0KQuZ98toXkPIK1n9QeFLCtmuCoLyM9II1H3SMMoLnL49aEBoIBBC+N8LEwuEnlLhKLs9BMXJlmqFO72l4WfYTC1wtP0wLPwoFQtHe7M7kaaqgaPRV6//X6cmjOzUA0ej6pBR30RotpjqAPJ404mJTLeKj1EEQRAEQRAEQRAEQRAEQf6SP4jPv7WHGoGuAAAAAElFTkSuQmCC",symbol:"JPEG",decimals:9,amount:"1000000000000000"},CreateJettonDemo=()=>{const[b,_]=reactExports.useState({}),[d]=useTonConnectUI(),k=useTonWallet();return jsxs("div",{className:"create-jetton-demo",children:[jsx$1("h3",{children:"Create Jetton"}),k?jsx$1("button",{onClick:async()=>{const $=await TonProofDemoApi.createJetton(jetton);_($),"error"in $||await d.sendTransaction($)},children:"Send create jetton"}):jsx$1("div",{className:"ton-proof-demo__error",children:"Connect wallet to send transaction"}),jsx$1(ReactJson,{src:b,name:"response",theme:"ocean"})]})};function App(){return jsx$1(TonConnectUIProvider$1,{manifestUrl:"https://ton-connect.github.io/demo-dapp-with-react-ui/tonconnect-manifest.json",uiPreferences:{theme:THEME.DARK},walletsListConfiguration:{includeWallets:[{appName:"tonwallet",name:"TON Wallet",imageUrl:"https://wallet.ton.org/assets/ui/qr-logo.png",aboutUrl:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",universalLink:"https://wallet.ton.org/ton-connect",jsBridgeKey:"tonwallet",bridgeUrl:"https://bridge.tonapi.io/bridge",platforms:["chrome","android"]},{appName:"nicegramWallet",name:"Nicegram Wallet",imageUrl:"https://static.nicegram.app/icon.png",aboutUrl:"https://nicegram.app",universalLink:"https://nicegram.app/tc",deepLink:"nicegram-tc://",jsBridgeKey:"nicegramWallet",bridgeUrl:"https://bridge.tonapi.io/bridge",platforms:["ios","android"]},{appName:"tokenpocket",name:"TokenPocket",imageUrl:"https://hk.tpstatic.net/logo/tokenpocket.png",aboutUrl:"https://tokenpocket.pro",jsBridgeKey:"tokenpocket",platforms:["ios","android"]},{appName:"dewallet",name:"DeWallet",imageUrl:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",aboutUrl:"https://delabwallet.com",universalLink:"https://t.me/dewallet?attach=wallet",bridgeUrl:"https://bridge.dewallet.pro/bridge",platforms:["ios","android","macos","windows","linux"]},{appName:"cdcTonWallet",name:"Crypto.com DeFi Wallet",imageUrl:"https://apro-ncw-api-file.crypto.com/wallet/logo",aboutUrl:"https://crypto.com/defi-wallet",universalLink:"https://wallet.crypto.com/deeplink/ton-connect",deepLink:"dfw://",jsBridgeKey:"cdcTonWallet",bridgeUrl:"https://wallet.crypto.com/sse/tonbridge",platforms:["ios","android","chrome"]},{appName:"tobi",name:"Tobi",imageUrl:"https://app.tobiwallet.app/icons/logo.png",aboutUrl:"https://tobi.fun",universalLink:"https://t.me/TobiCopilotBot?attach=wallet",bridgeUrl:"https://ton-bridge.tobiwallet.app/bridge",platforms:["ios","android","macos","windows","linux"]},{appName:"trustwalletTon",name:"Trust",imageUrl:"https://assets-cdn.trustwallet.com/dapps/trust.logo.png",aboutUrl:"https://trustwallet.com/about-us",bridgeUrl:"https://tonconnect.trustwallet.com/bridge",jsBridgeKey:"trustwalletTon",platforms:["chrome","ios","android"]},{appName:"bitgetWalletLite",name:"Bitget Wallet Lite",imageUrl:"https://raw.githubusercontent.com/bitgetwallet/download/main/logo/png/bitget_wallet_lite_logo.png",aboutUrl:"https://web3.bitget.com",universalLink:"https://t.me/BitgetWallet_TGBot?attach=wallet",bridgeUrl:"https://ton-connect-bridge.bgwapi.io/bridge",platforms:["ios","android","macos","windows","linux"]},{appName:"onekey",name:"OneKey",imageUrl:"https://common.onekey-asset.com/logo/onekey-x288.png",aboutUrl:"https://onekey.so",jsBridgeKey:"onekeyTonWallet",platforms:["chrome"]},{appName:"tomoWallet",name:"Tomo Wallet",imageUrl:"https://pub.tomo.inc/logo.png",aboutUrl:"https://www.tomo.inc/",universalLink:"https://t.me/tomowalletbot?attach=wallet",bridgeUrl:"https://go-bridge.tomo.inc/bridge",platforms:["ios","android","macos","windows","linux"]},{appName:"hpyTonWallet",name:"HyperPay Wallet",imageUrl:"https://hyperpay-website.oss-cn-hongkong.aliyuncs.com/static/dist/images/2022-12-30/logo.png",aboutUrl:"https://www.hyperpay.tech",universalLink:"https://www.hyperpay.tech/download&deeplink=hyperpay://web3/wallet/tonconnect",jsBridgeKey:"hpyTonWallet",bridgeUrl:"https://bridge.tonapi.io/bridge",platforms:["ios","android","macos","windows","linux"]}]},actionsConfiguration:{twaReturnUrl:"https://t.me/DemoDappWithTonConnectBot/demo"},children:jsxs("div",{className:"app",children:[jsx$1(Header,{}),jsx$1(TxForm,{}),jsx$1(CreateJettonDemo,{}),jsx$1(TonProofDemo,{}),jsx$1(Footer,{})]})})}const index="";function runSingleInstance(b){let _=!1;return async()=>{if(!_){_=!0;try{await b()}catch(d){console.error(d)}finally{_=!1}}}}eruda.init();async function enableMocking(){const b=document.baseURI.replace(/\/$/,"");return new Promise(async _=>{const{worker:d}=await __vitePreload(()=>import("./worker-58115eaa.js"),[]),k=()=>d.start({onUnhandledRequest:"bypass",quiet:!1,serviceWorker:{url:"/demo-dapp-with-react-ui/mockServiceWorker.js"}});let j=await k();_(j);const $=runSingleInstance(async()=>{var et;try{const rt=(await((et=navigator.serviceWorker)==null?void 0:et.getRegistrations())||[]).length>0,nt=await fetch(`${b}/api/healthz`).then(ot=>ot.status===200?ot.json().then(at=>at.ok).catch(()=>!1):!1).catch(()=>!1);(!rt||!nt)&&(await(j==null?void 0:j.unregister().catch(()=>{})),j=await k().catch(()=>null))}catch(tt){console.error("Error in verifyAndRestartWorker:",tt),j=await k().catch(()=>null)}});setInterval($,1e3)})}enableMocking().then(()=>reactDomExports.render(jsx$1(reactExports.StrictMode,{children:jsx$1(App,{})}),document.getElementById("root")));export{CHAIN as C,__vitePreload as _,buffer as b,commonjsGlobal as c,getAugmentedNamespace as g,naclFastExports as n,require$$4 as r}; +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}var _n=$(46),Bn=new($(47)).Dispatcher,Yn=new(function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){var Wt;nt(this,Rt);for(var Pt=arguments.length,hn=new Array(Pt),un=0;unPt&&(tn.style.cursor="pointer",this.state.collapsed&&(un=st.a.createElement("span",null,un.substring(0,Pt),st.a.createElement("span",Bt(hn,"ellipsis")," ...")))),st.a.createElement("div",Bt(hn,"string"),st.a.createElement(Zt,Object.assign({type_name:"string"},Wt)),st.a.createElement("span",Object.assign({className:"string-value"},tn,{onClick:this.toggleCollapsed}),'"',un,'"'))}}]),Rt}(st.a.PureComponent),gn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){return st.a.createElement("div",Bt(this.props.theme,"undefined"),"undefined")}}]),Rt}(st.a.PureComponent);function Ln(){return(Ln=Object.assign||function(It){for(var Nt=1;Nt=0||(Hn[mr]=or[mr]);return Hn}(It,["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"]),Gn,er=xn.value!==void 0,tr=Object(gt.useRef)(null),ir=Zn(tr,Nt),Kn=Object(gt.useRef)(0),rr=Object(gt.useRef)(),ur=function(){var or=tr.current,yr=Rt&&rr.current?rr.current:function(hr){var lr=window.getComputedStyle(hr);if(lr===null)return null;var sr,dr=(sr=lr,Tn.reduce(function(Mr,Or){return Mr[Or]=sr[Or],Mr},{})),Ar=dr.boxSizing;return Ar===""?null:(Kt&&Ar==="border-box"&&(dr.width=parseFloat(dr.width)+parseFloat(dr.borderRightWidth)+parseFloat(dr.borderLeftWidth)+parseFloat(dr.paddingRight)+parseFloat(dr.paddingLeft)+"px"),{sizingStyle:dr,paddingSize:parseFloat(dr.paddingBottom)+parseFloat(dr.paddingTop),borderSize:parseFloat(dr.borderBottomWidth)+parseFloat(dr.borderTopWidth)})}(or);if(yr){rr.current=yr;var mr=function(hr,lr,sr,dr){sr===void 0&&(sr=1),dr===void 0&&(dr=1/0),Fn||((Fn=document.createElement("textarea")).setAttribute("tab-index","-1"),Fn.setAttribute("aria-hidden","true"),Wn(Fn)),Fn.parentNode===null&&document.body.appendChild(Fn);var Ar=hr.paddingSize,Mr=hr.borderSize,Or=hr.sizingStyle,Ir=Or.boxSizing;Object.keys(Or).forEach(function(Pr){var $r=Pr;Fn.style[$r]=Or[$r]}),Wn(Fn),Fn.value=lr;var pn=function(Pr,$r){var Wr=Pr.scrollHeight;return $r.sizingStyle.boxSizing==="border-box"?Wr+$r.borderSize:Wr-$r.paddingSize}(Fn,hr);Fn.value="x";var Lr=Fn.scrollHeight-Ar,Fr=Lr*sr;Ir==="border-box"&&(Fr=Fr+Ar+Mr),pn=Math.max(Fr,pn);var Dr=Lr*dr;return Ir==="border-box"&&(Dr=Dr+Ar+Mr),[pn=Math.min(Dr,pn),Lr]}(yr,or.value||or.placeholder||"x",Pt,Wt),Pn=mr[0],Hn=mr[1];Kn.current!==Pn&&(Kn.current=Pn,or.style.setProperty("height",Pn+"px","important"),Gt(Pn,{rowHeight:Hn}))}};return Object(gt.useLayoutEffect)(ur),Gn=Un(ur),Object(gt.useLayoutEffect)(function(){var or=function(yr){Gn.current(yr)};return window.addEventListener("resize",or),function(){window.removeEventListener("resize",or)}},[]),Object(gt.createElement)("textarea",Ln({},xn,{onChange:function(or){er||ur(),un(or)},ref:ir}))},pt=Object(gt.forwardRef)(bt);function yt(It){It=It.trim();try{if((It=JSON.stringify(JSON.parse(It)))[0]==="[")return Ut("array",JSON.parse(It));if(It[0]==="{")return Ut("object",JSON.parse(It));if(It.match(/\-?\d+\.\d+/)&&It.match(/\-?\d+\.\d+/)[0]===It)return Ut("float",parseFloat(It));if(It.match(/\-?\d+e-\d+/)&&It.match(/\-?\d+e-\d+/)[0]===It)return Ut("float",Number(It));if(It.match(/\-?\d+/)&&It.match(/\-?\d+/)[0]===It)return Ut("integer",parseInt(It));if(It.match(/\-?\d+e\+\d+/)&&It.match(/\-?\d+e\+\d+/)[0]===It)return Ut("integer",Number(It))}catch{}switch(It=It.toLowerCase()){case"undefined":return Ut("undefined",void 0);case"nan":return Ut("nan",NaN);case"null":return Ut("null",null);case"true":return Ut("boolean",!0);case"false":return Ut("boolean",!1);default:if(It=Date.parse(It))return Ut("date",new Date(It))}return Ut(!1,null)}function Ut(It,Nt){return{type:It,value:Nt}}var sn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",Object.assign({},pr(Pt),{viewBox:"0 0 24 24",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),st.a.createElement("path",{d:"M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M7,13H17V11H7"})))}}]),Rt}(st.a.PureComponent),ln=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",Object.assign({},pr(Pt),{viewBox:"0 0 24 24",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),st.a.createElement("path",{d:"M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,7H11V11H7V13H11V17H13V13H17V11H13V7Z"})))}}]),Rt}(st.a.PureComponent),mn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]),un=pr(Pt).style;return st.a.createElement("span",hn,st.a.createElement("svg",{fill:un.color,width:un.height,height:un.width,style:un,viewBox:"0 0 1792 1792"},st.a.createElement("path",{d:"M1344 800v64q0 14-9 23t-23 9h-832q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h832q14 0 23 9t9 23zm128 448v-832q0-66-47-113t-113-47h-832q-66 0-113 47t-47 113v832q0 66 47 113t113 47h832q66 0 113-47t47-113zm128-832v832q0 119-84.5 203.5t-203.5 84.5h-832q-119 0-203.5-84.5t-84.5-203.5v-832q0-119 84.5-203.5t203.5-84.5h832q119 0 203.5 84.5t84.5 203.5z"})))}}]),Rt}(st.a.PureComponent),Qn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]),un=pr(Pt).style;return st.a.createElement("span",hn,st.a.createElement("svg",{fill:un.color,width:un.height,height:un.width,style:un,viewBox:"0 0 1792 1792"},st.a.createElement("path",{d:"M1344 800v64q0 14-9 23t-23 9h-352v352q0 14-9 23t-23 9h-64q-14 0-23-9t-9-23v-352h-352q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h352v-352q0-14 9-23t23-9h64q14 0 23 9t9 23v352h352q14 0 23 9t9 23zm128 448v-832q0-66-47-113t-113-47h-832q-66 0-113 47t-47 113v832q0 66 47 113t113 47h832q66 0 113-47t47-113zm128-832v832q0 119-84.5 203.5t-203.5 84.5h-832q-119 0-203.5-84.5t-84.5-203.5v-832q0-119 84.5-203.5t203.5-84.5h832q119 0 203.5 84.5t84.5 203.5z"})))}}]),Rt}(st.a.PureComponent),Rn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",{style:rt(rt({},pr(Pt).style),{},{paddingLeft:"2px",verticalAlign:"top"}),viewBox:"0 0 15 15",fill:"currentColor"},st.a.createElement("path",{d:"M0 14l6-6-6-6z"})))}}]),Rt}(st.a.PureComponent),Jn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",{style:rt(rt({},pr(Pt).style),{},{paddingLeft:"2px",verticalAlign:"top"}),viewBox:"0 0 15 15",fill:"currentColor"},st.a.createElement("path",{d:"M0 5l6 6 6-6z"})))}}]),Rt}(st.a.PureComponent),Nn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",Object.assign({},pr(Pt),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),st.a.createElement("g",null,st.a.createElement("path",{d:"m30 35h-25v-22.5h25v7.5h2.5v-12.5c0-1.4-1.1-2.5-2.5-2.5h-7.5c0-2.8-2.2-5-5-5s-5 2.2-5 5h-7.5c-1.4 0-2.5 1.1-2.5 2.5v27.5c0 1.4 1.1 2.5 2.5 2.5h25c1.4 0 2.5-1.1 2.5-2.5v-5h-2.5v5z m-20-27.5h2.5s2.5-1.1 2.5-2.5 1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5 1.3 2.5 2.5 2.5h2.5s2.5 1.1 2.5 2.5h-20c0-1.5 1.1-2.5 2.5-2.5z m-2.5 20h5v-2.5h-5v2.5z m17.5-5v-5l-10 7.5 10 7.5v-5h12.5v-5h-12.5z m-17.5 10h7.5v-2.5h-7.5v2.5z m12.5-17.5h-12.5v2.5h12.5v-2.5z m-7.5 5h-5v2.5h5v-2.5z"}))))}}]),Rt}(st.a.PureComponent),ar=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",Object.assign({},pr(Pt),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),st.a.createElement("g",null,st.a.createElement("path",{d:"m28.6 25q0-0.5-0.4-1l-4-4 4-4q0.4-0.5 0.4-1 0-0.6-0.4-1.1l-2-2q-0.4-0.4-1-0.4-0.6 0-1 0.4l-4.1 4.1-4-4.1q-0.4-0.4-1-0.4-0.6 0-1 0.4l-2 2q-0.5 0.5-0.5 1.1 0 0.5 0.5 1l4 4-4 4q-0.5 0.5-0.5 1 0 0.7 0.5 1.1l2 2q0.4 0.4 1 0.4 0.6 0 1-0.4l4-4.1 4.1 4.1q0.4 0.4 1 0.4 0.6 0 1-0.4l2-2q0.4-0.4 0.4-1z m8.7-5q0 4.7-2.3 8.6t-6.3 6.2-8.6 2.3-8.6-2.3-6.2-6.2-2.3-8.6 2.3-8.6 6.2-6.2 8.6-2.3 8.6 2.3 6.3 6.2 2.3 8.6z"}))))}}]),Rt}(st.a.PureComponent),Xn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",Object.assign({},pr(Pt),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),st.a.createElement("g",null,st.a.createElement("path",{d:"m30.1 21.4v-2.8q0-0.6-0.4-1t-1-0.5h-5.7v-5.7q0-0.6-0.4-1t-1-0.4h-2.9q-0.6 0-1 0.4t-0.4 1v5.7h-5.7q-0.6 0-1 0.5t-0.5 1v2.8q0 0.6 0.5 1t1 0.5h5.7v5.7q0 0.5 0.4 1t1 0.4h2.9q0.6 0 1-0.4t0.4-1v-5.7h5.7q0.6 0 1-0.5t0.4-1z m7.2-1.4q0 4.7-2.3 8.6t-6.3 6.2-8.6 2.3-8.6-2.3-6.2-6.2-2.3-8.6 2.3-8.6 6.2-6.2 8.6-2.3 8.6 2.3 6.3 6.2 2.3 8.6z"}))))}}]),Rt}(st.a.PureComponent),qn=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",Object.assign({},pr(Pt),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),st.a.createElement("g",null,st.a.createElement("path",{d:"m31.6 21.6h-10v10h-3.2v-10h-10v-3.2h10v-10h3.2v10h10v3.2z"}))))}}]),Rt}(st.a.PureComponent),fr=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",Object.assign({},pr(Pt),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),st.a.createElement("g",null,st.a.createElement("path",{d:"m19.8 26.4l2.6-2.6-3.4-3.4-2.6 2.6v1.3h2.2v2.1h1.2z m9.8-16q-0.3-0.4-0.7 0l-7.8 7.8q-0.4 0.4 0 0.7t0.7 0l7.8-7.8q0.4-0.4 0-0.7z m1.8 13.2v4.3q0 2.6-1.9 4.5t-4.5 1.9h-18.6q-2.6 0-4.5-1.9t-1.9-4.5v-18.6q0-2.7 1.9-4.6t4.5-1.8h18.6q1.4 0 2.6 0.5 0.3 0.2 0.4 0.5 0.1 0.4-0.2 0.7l-1.1 1.1q-0.3 0.3-0.7 0.1-0.5-0.1-1-0.1h-18.6q-1.4 0-2.5 1.1t-1 2.5v18.6q0 1.4 1 2.5t2.5 1h18.6q1.5 0 2.5-1t1.1-2.5v-2.9q0-0.2 0.2-0.4l1.4-1.5q0.3-0.3 0.8-0.1t0.4 0.6z m-2.1-16.5l6.4 6.5-15 15h-6.4v-6.5z m9.9 3l-2.1 2-6.4-6.4 2.1-2q0.6-0.7 1.5-0.7t1.5 0.7l3.4 3.4q0.6 0.6 0.6 1.5t-0.6 1.5z"}))))}}]),Rt}(st.a.PureComponent),cr=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){return nt(this,Rt),Nt.apply(this,arguments)}return at(Rt,[{key:"render",value:function(){var Wt=this.props,Pt=Wt.style,hn=kt(Wt,["style"]);return st.a.createElement("span",hn,st.a.createElement("svg",Object.assign({},pr(Pt),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),st.a.createElement("g",null,st.a.createElement("path",{d:"m31.7 16.4q0-0.6-0.4-1l-2.1-2.1q-0.4-0.4-1-0.4t-1 0.4l-9.1 9.1-5-5q-0.5-0.4-1-0.4t-1 0.4l-2.1 2q-0.4 0.4-0.4 1 0 0.6 0.4 1l8.1 8.1q0.4 0.4 1 0.4 0.6 0 1-0.4l12.2-12.1q0.4-0.4 0.4-1z m5.6 3.6q0 4.7-2.3 8.6t-6.3 6.2-8.6 2.3-8.6-2.3-6.2-6.2-2.3-8.6 2.3-8.6 6.2-6.2 8.6-2.3 8.6 2.3 6.3 6.2 2.3 8.6z"}))))}}]),Rt}(st.a.PureComponent);function pr(It){return It||(It={}),{style:rt(rt({verticalAlign:"middle"},It),{},{color:It.color?It.color:"#000000",height:"1em",width:"1em"})}}var xr=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(Wt){var Pt;return nt(this,Rt),(Pt=Nt.call(this,Wt)).copiedTimer=null,Pt.handleCopy=function(){var hn=document.createElement("textarea"),un=Pt.props,tn=un.clickCallback,Gt=un.src,xn=un.namespace;hn.innerHTML=JSON.stringify(Pt.clipboardValue(Gt),null," "),document.body.appendChild(hn),hn.select(),document.execCommand("copy"),document.body.removeChild(hn),Pt.copiedTimer=setTimeout(function(){Pt.setState({copied:!1})},5500),Pt.setState({copied:!0},function(){typeof tn=="function"&&tn({src:Gt,namespace:xn,name:xn[xn.length-1]})})},Pt.getClippyIcon=function(){var hn=Pt.props.theme;return Pt.state.copied?st.a.createElement("span",null,st.a.createElement(Nn,Object.assign({className:"copy-icon"},Bt(hn,"copy-icon"))),st.a.createElement("span",Bt(hn,"copy-icon-copied"),"✔")):st.a.createElement(Nn,Object.assign({className:"copy-icon"},Bt(hn,"copy-icon")))},Pt.clipboardValue=function(hn){switch(_t(hn)){case"function":case"regexp":return hn.toString();default:return hn}},Pt.state={copied:!1},Pt}return at(Rt,[{key:"componentWillUnmount",value:function(){this.copiedTimer&&(clearTimeout(this.copiedTimer),this.copiedTimer=null)}},{key:"render",value:function(){var Wt=this.props,Pt=(Wt.src,Wt.theme),hn=Wt.hidden,un=Wt.rowHovered,tn=Bt(Pt,"copy-to-clipboard").style,Gt="inline";return hn&&(Gt="none"),st.a.createElement("span",{className:"copy-to-clipboard-container",title:"Copy to clipboard",style:{verticalAlign:"top",display:un?"inline-block":"none"}},st.a.createElement("span",{style:rt(rt({},tn),{},{display:Gt}),onClick:this.handleCopy},this.getClippyIcon()))}}]),Rt}(st.a.PureComponent),kr=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(Wt){var Pt;return nt(this,Rt),(Pt=Nt.call(this,Wt)).getEditIcon=function(){var hn=Pt.props,un=hn.variable,tn=hn.theme;return st.a.createElement("div",{className:"click-to-edit",style:{verticalAlign:"top",display:Pt.state.hovered?"inline-block":"none"}},st.a.createElement(fr,Object.assign({className:"click-to-edit-icon"},Bt(tn,"editVarIcon"),{onClick:function(){Pt.prepopInput(un)}})))},Pt.prepopInput=function(hn){if(Pt.props.onEdit!==!1){var un=function(Gt){var xn;switch(_t(Gt)){case"undefined":xn="undefined";break;case"nan":xn="NaN";break;case"string":xn=Gt;break;case"date":case"function":case"regexp":xn=Gt.toString();break;default:try{xn=JSON.stringify(Gt,null," ")}catch{xn=""}}return xn}(hn.value),tn=yt(un);Pt.setState({editMode:!0,editValue:un,parsedInput:{type:tn.type,value:tn.value}})}},Pt.getRemoveIcon=function(){var hn=Pt.props,un=hn.variable,tn=hn.namespace,Gt=hn.theme,xn=hn.rjvId;return st.a.createElement("div",{className:"click-to-remove",style:{verticalAlign:"top",display:Pt.state.hovered?"inline-block":"none"}},st.a.createElement(ar,Object.assign({className:"click-to-remove-icon"},Bt(Gt,"removeVarIcon"),{onClick:function(){Bn.dispatch({name:"VARIABLE_REMOVED",rjvId:xn,data:{name:un.name,namespace:tn,existing_value:un.value,variable_removed:!0}})}})))},Pt.getValue=function(hn,un){var tn=!un&&hn.type,Gt=ft(Pt).props;switch(tn){case!1:return Pt.getEditInput();case"string":return st.a.createElement(En,Object.assign({value:hn.value},Gt));case"integer":return st.a.createElement(kn,Object.assign({value:hn.value},Gt));case"float":return st.a.createElement(Qt,Object.assign({value:hn.value},Gt));case"boolean":return st.a.createElement(rn,Object.assign({value:hn.value},Gt));case"function":return st.a.createElement(An,Object.assign({value:hn.value},Gt));case"null":return st.a.createElement(On,Gt);case"nan":return st.a.createElement(yn,Gt);case"undefined":return st.a.createElement(gn,Gt);case"date":return st.a.createElement(nn,Object.assign({value:hn.value},Gt));case"regexp":return st.a.createElement(vn,Object.assign({value:hn.value},Gt));default:return st.a.createElement("div",{className:"object-value"},JSON.stringify(hn.value))}},Pt.getEditInput=function(){var hn=Pt.props.theme,un=Pt.state.editValue;return st.a.createElement("div",null,st.a.createElement(pt,Object.assign({type:"text",inputRef:function(tn){return tn&&tn.focus()},value:un,className:"variable-editor",onChange:function(tn){var Gt=tn.target.value,xn=yt(Gt);Pt.setState({editValue:Gt,parsedInput:{type:xn.type,value:xn.value}})},onKeyDown:function(tn){switch(tn.key){case"Escape":Pt.setState({editMode:!1,editValue:""});break;case"Enter":(tn.ctrlKey||tn.metaKey)&&Pt.submitEdit(!0)}tn.stopPropagation()},placeholder:"update this value",minRows:2},Bt(hn,"edit-input"))),st.a.createElement("div",Bt(hn,"edit-icon-container"),st.a.createElement(ar,Object.assign({className:"edit-cancel"},Bt(hn,"cancel-icon"),{onClick:function(){Pt.setState({editMode:!1,editValue:""})}})),st.a.createElement(cr,Object.assign({className:"edit-check string-value"},Bt(hn,"check-icon"),{onClick:function(){Pt.submitEdit()}})),st.a.createElement("div",null,Pt.showDetected())))},Pt.submitEdit=function(hn){var un=Pt.props,tn=un.variable,Gt=un.namespace,xn=un.rjvId,Gn=Pt.state,er=Gn.editValue,tr=Gn.parsedInput,ir=er;hn&&tr.type&&(ir=tr.value),Pt.setState({editMode:!1}),Bn.dispatch({name:"VARIABLE_UPDATED",rjvId:xn,data:{name:tn.name,namespace:Gt,existing_value:tn.value,new_value:ir,variable_removed:!1}})},Pt.showDetected=function(){var hn=Pt.props,un=hn.theme,tn=(hn.variable,hn.namespace,hn.rjvId,Pt.state.parsedInput),Gt=(tn.type,tn.value,Pt.getDetectedInput());if(Gt)return st.a.createElement("div",null,st.a.createElement("div",Bt(un,"detected-row"),Gt,st.a.createElement(cr,{className:"edit-check detected",style:rt({verticalAlign:"top",paddingLeft:"3px"},Bt(un,"check-icon").style),onClick:function(){Pt.submitEdit(!0)}})))},Pt.getDetectedInput=function(){var hn=Pt.state.parsedInput,un=hn.type,tn=hn.value,Gt=ft(Pt).props,xn=Gt.theme;if(un!==!1)switch(un.toLowerCase()){case"object":return st.a.createElement("span",null,st.a.createElement("span",{style:rt(rt({},Bt(xn,"brace").style),{},{cursor:"default"})},"{"),st.a.createElement("span",{style:rt(rt({},Bt(xn,"ellipsis").style),{},{cursor:"default"})},"..."),st.a.createElement("span",{style:rt(rt({},Bt(xn,"brace").style),{},{cursor:"default"})},"}"));case"array":return st.a.createElement("span",null,st.a.createElement("span",{style:rt(rt({},Bt(xn,"brace").style),{},{cursor:"default"})},"["),st.a.createElement("span",{style:rt(rt({},Bt(xn,"ellipsis").style),{},{cursor:"default"})},"..."),st.a.createElement("span",{style:rt(rt({},Bt(xn,"brace").style),{},{cursor:"default"})},"]"));case"string":return st.a.createElement(En,Object.assign({value:tn},Gt));case"integer":return st.a.createElement(kn,Object.assign({value:tn},Gt));case"float":return st.a.createElement(Qt,Object.assign({value:tn},Gt));case"boolean":return st.a.createElement(rn,Object.assign({value:tn},Gt));case"function":return st.a.createElement(An,Object.assign({value:tn},Gt));case"null":return st.a.createElement(On,Gt);case"nan":return st.a.createElement(yn,Gt);case"undefined":return st.a.createElement(gn,Gt);case"date":return st.a.createElement(nn,Object.assign({value:new Date(tn)},Gt))}},Pt.state={editMode:!1,editValue:"",hovered:!1,renameKey:!1,parsedInput:{type:!1,value:null}},Pt}return at(Rt,[{key:"render",value:function(){var Wt=this,Pt=this.props,hn=Pt.variable,un=Pt.singleIndent,tn=Pt.type,Gt=Pt.theme,xn=Pt.namespace,Gn=Pt.indentWidth,er=Pt.enableClipboard,tr=Pt.onEdit,ir=Pt.onDelete,Kn=Pt.onSelect,rr=Pt.displayArrayKey,ur=Pt.quotesOnKeys,or=this.state.editMode;return st.a.createElement("div",Object.assign({},Bt(Gt,"objectKeyVal",{paddingLeft:Gn*un}),{onMouseEnter:function(){return Wt.setState(rt(rt({},Wt.state),{},{hovered:!0}))},onMouseLeave:function(){return Wt.setState(rt(rt({},Wt.state),{},{hovered:!1}))},className:"variable-row",key:hn.name}),tn=="array"?rr?st.a.createElement("span",Object.assign({},Bt(Gt,"array-key"),{key:hn.name+"_"+xn}),hn.name,st.a.createElement("div",Bt(Gt,"colon"),":")):null:st.a.createElement("span",null,st.a.createElement("span",Object.assign({},Bt(Gt,"object-name"),{className:"object-key",key:hn.name+"_"+xn}),!!ur&&st.a.createElement("span",{style:{verticalAlign:"top"}},'"'),st.a.createElement("span",{style:{display:"inline-block"}},hn.name),!!ur&&st.a.createElement("span",{style:{verticalAlign:"top"}},'"')),st.a.createElement("span",Bt(Gt,"colon"),":")),st.a.createElement("div",Object.assign({className:"variable-value",onClick:Kn===!1&&tr===!1?null:function(yr){var mr=jn(xn);(yr.ctrlKey||yr.metaKey)&&tr!==!1?Wt.prepopInput(hn):Kn!==!1&&(mr.shift(),Kn(rt(rt({},hn),{},{namespace:mr})))}},Bt(Gt,"variableValue",{cursor:Kn===!1?"default":"pointer"})),this.getValue(hn,or)),er?st.a.createElement(xr,{rowHovered:this.state.hovered,hidden:or,src:hn.value,clickCallback:er,theme:Gt,namespace:[].concat(jn(xn),[hn.name])}):null,tr!==!1&&or==0?this.getEditIcon():null,ir!==!1&&or==0?this.getRemoveIcon():null)}}]),Rt}(st.a.PureComponent),Tr=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){var Wt;nt(this,Rt);for(var Pt=arguments.length,hn=new Array(Pt),un=0;un0?er:null,namespace:Gn.splice(0,Gn.length-1),existing_value:tr,variable_removed:!1,key_name:null};_t(tr)==="object"?Bn.dispatch({name:"ADD_VARIABLE_KEY_REQUEST",rjvId:ir,data:rr}):Bn.dispatch({name:"VARIABLE_ADDED",rjvId:ir,data:rt(rt({},rr),{},{new_value:[].concat(jn(tr),[null])})})}})))},Wt.getRemoveObject=function(tn){var Gt=Wt.props,xn=Gt.theme,Gn=(Gt.hover,Gt.namespace),er=Gt.name,tr=Gt.src,ir=Gt.rjvId;if(Gn.length!==1)return st.a.createElement("span",{className:"click-to-remove",style:{display:tn?"inline-block":"none"}},st.a.createElement(ar,Object.assign({className:"click-to-remove-icon"},Bt(xn,"removeVarIcon"),{onClick:function(){Bn.dispatch({name:"VARIABLE_REMOVED",rjvId:ir,data:{name:er,namespace:Gn.splice(0,Gn.length-1),existing_value:tr,variable_removed:!0}})}})))},Wt.render=function(){var tn=Wt.props,Gt=tn.theme,xn=tn.onDelete,Gn=tn.onAdd,er=tn.enableClipboard,tr=tn.src,ir=tn.namespace,Kn=tn.rowHovered;return st.a.createElement("div",Object.assign({},Bt(Gt,"object-meta-data"),{className:"object-meta-data",onClick:function(rr){rr.stopPropagation()}}),Wt.getObjectSize(),er?st.a.createElement(xr,{rowHovered:Kn,clickCallback:er,src:tr,theme:Gt,namespace:ir}):null,Gn!==!1?Wt.getAddAttribute(Kn):null,xn!==!1?Wt.getRemoveObject(Kn):null)},Wt}return Rt}(st.a.PureComponent);function Br(It){var Nt=It.parent_type,Rt=It.namespace,Wt=It.quotesOnKeys,Pt=It.theme,hn=It.jsvRoot,un=It.name,tn=It.displayArrayKey,Gt=It.name?It.name:"";return!hn||un!==!1&&un!==null?Nt=="array"?tn?st.a.createElement("span",Object.assign({},Bt(Pt,"array-key"),{key:Rt}),st.a.createElement("span",{className:"array-key"},Gt),st.a.createElement("span",Bt(Pt,"colon"),":")):st.a.createElement("span",null):st.a.createElement("span",Object.assign({},Bt(Pt,"object-name"),{key:Rt}),st.a.createElement("span",{className:"object-key"},Wt&&st.a.createElement("span",{style:{verticalAlign:"top"}},'"'),st.a.createElement("span",null,Gt),Wt&&st.a.createElement("span",{style:{verticalAlign:"top"}},'"')),st.a.createElement("span",Bt(Pt,"colon"),":")):st.a.createElement("span",null)}function Rr(It){var Nt=It.theme;switch(It.iconStyle){case"triangle":return st.a.createElement(Jn,Object.assign({},Bt(Nt,"expanded-icon"),{className:"expanded-icon"}));case"square":return st.a.createElement(mn,Object.assign({},Bt(Nt,"expanded-icon"),{className:"expanded-icon"}));default:return st.a.createElement(sn,Object.assign({},Bt(Nt,"expanded-icon"),{className:"expanded-icon"}))}}function Ur(It){var Nt=It.theme;switch(It.iconStyle){case"triangle":return st.a.createElement(Rn,Object.assign({},Bt(Nt,"collapsed-icon"),{className:"collapsed-icon"}));case"square":return st.a.createElement(Qn,Object.assign({},Bt(Nt,"collapsed-icon"),{className:"collapsed-icon"}));default:return st.a.createElement(ln,Object.assign({},Bt(Nt,"collapsed-icon"),{className:"collapsed-icon"}))}}var Qr=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(Wt){var Pt;return nt(this,Rt),(Pt=Nt.call(this,Wt)).toggleCollapsed=function(hn){var un=[];for(var tn in Pt.state.expanded)un.push(Pt.state.expanded[tn]);un[hn]=!un[hn],Pt.setState({expanded:un})},Pt.state={expanded:[]},Pt}return at(Rt,[{key:"getExpandedIcon",value:function(Wt){var Pt=this.props,hn=Pt.theme,un=Pt.iconStyle;return this.state.expanded[Wt]?st.a.createElement(Rr,{theme:hn,iconStyle:un}):st.a.createElement(Ur,{theme:hn,iconStyle:un})}},{key:"render",value:function(){var Wt=this,Pt=this.props,hn=Pt.src,un=Pt.groupArraysAfterLength,tn=(Pt.depth,Pt.name),Gt=Pt.theme,xn=Pt.jsvRoot,Gn=Pt.namespace,er=(Pt.parent_type,kt(Pt,["src","groupArraysAfterLength","depth","name","theme","jsvRoot","namespace","parent_type"])),tr=0,ir=5*this.props.indentWidth;xn||(tr=5*this.props.indentWidth);var Kn=un,rr=Math.ceil(hn.length/Kn);return st.a.createElement("div",Object.assign({className:"object-key-val"},Bt(Gt,xn?"jsv-root":"objectKeyVal",{paddingLeft:tr})),st.a.createElement(Br,this.props),st.a.createElement("span",null,st.a.createElement(Tr,Object.assign({size:hn.length},this.props))),jn(Array(rr)).map(function(ur,or){return st.a.createElement("div",Object.assign({key:or,className:"object-key-val array-group"},Bt(Gt,"objectKeyVal",{marginLeft:6,paddingLeft:ir})),st.a.createElement("span",Bt(Gt,"brace-row"),st.a.createElement("div",Object.assign({className:"icon-container"},Bt(Gt,"icon-container"),{onClick:function(yr){Wt.toggleCollapsed(or)}}),Wt.getExpandedIcon(or)),Wt.state.expanded[or]?st.a.createElement(St,Object.assign({key:tn+or,depth:0,name:!1,collapsed:!1,groupArraysAfterLength:Kn,index_offset:or*Kn,src:hn.slice(or*Kn,or*Kn+Kn),namespace:Gn,type:"array",parent_type:"array_group",theme:Gt},er)):st.a.createElement("span",Object.assign({},Bt(Gt,"brace"),{onClick:function(yr){Wt.toggleCollapsed(or)},className:"array-group-brace"}),"[",st.a.createElement("div",Object.assign({},Bt(Gt,"array-group-meta-data"),{className:"array-group-meta-data"}),st.a.createElement("span",Object.assign({className:"object-size"},Bt(Gt,"object-size")),or*Kn," - ",or*Kn+Kn>hn.length?hn.length:or*Kn+Kn)),"]")))}))}}]),Rt}(st.a.PureComponent),Zr=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(Wt){var Pt;nt(this,Rt),(Pt=Nt.call(this,Wt)).toggleCollapsed=function(){Pt.setState({expanded:!Pt.state.expanded},function(){dn.set(Pt.props.rjvId,Pt.props.namespace,"expanded",Pt.state.expanded)})},Pt.getObjectContent=function(un,tn,Gt){return st.a.createElement("div",{className:"pushed-content object-container"},st.a.createElement("div",Object.assign({className:"object-content"},Bt(Pt.props.theme,"pushed-content")),Pt.renderObjectContents(tn,Gt)))},Pt.getEllipsis=function(){return Pt.state.size===0?null:st.a.createElement("div",Object.assign({},Bt(Pt.props.theme,"ellipsis"),{className:"node-ellipsis",onClick:Pt.toggleCollapsed}),"...")},Pt.getObjectMetaData=function(un){var tn=Pt.props,Gt=(tn.rjvId,tn.theme,Pt.state),xn=Gt.size,Gn=Gt.hovered;return st.a.createElement(Tr,Object.assign({rowHovered:Gn,size:xn},Pt.props))},Pt.renderObjectContents=function(un,tn){var Gt,xn=Pt.props,Gn=xn.depth,er=xn.parent_type,tr=xn.index_offset,ir=xn.groupArraysAfterLength,Kn=xn.namespace,rr=Pt.state.object_type,ur=[],or=Object.keys(un||{});return Pt.props.sortKeys&&rr!=="array"&&(or=or.sort()),or.forEach(function(yr){if(Gt=new mo(yr,un[yr]),er==="array_group"&&tr&&(Gt.name=parseInt(Gt.name)+tr),un.hasOwnProperty(yr))if(Gt.type==="object")ur.push(st.a.createElement(St,Object.assign({key:Gt.name,depth:Gn+1,name:Gt.name,src:Gt.value,namespace:Kn.concat(Gt.name),parent_type:rr},tn)));else if(Gt.type==="array"){var mr=St;ir&&Gt.value.length>ir&&(mr=Qr),ur.push(st.a.createElement(mr,Object.assign({key:Gt.name,depth:Gn+1,name:Gt.name,src:Gt.value,namespace:Kn.concat(Gt.name),type:"array",parent_type:rr},tn)))}else ur.push(st.a.createElement(kr,Object.assign({key:Gt.name+"_"+Kn,variable:Gt,singleIndent:5,namespace:Kn,type:Pt.props.type},tn)))}),ur};var hn=Rt.getState(Wt);return Pt.state=rt(rt({},hn),{},{prevProps:{}}),Pt}return at(Rt,[{key:"getBraceStart",value:function(Wt,Pt){var hn=this,un=this.props,tn=un.src,Gt=un.theme,xn=un.iconStyle;if(un.parent_type==="array_group")return st.a.createElement("span",null,st.a.createElement("span",Bt(Gt,"brace"),Wt==="array"?"[":"{"),Pt?this.getObjectMetaData(tn):null);var Gn=Pt?Rr:Ur;return st.a.createElement("span",null,st.a.createElement("span",Object.assign({onClick:function(er){hn.toggleCollapsed()}},Bt(Gt,"brace-row")),st.a.createElement("div",Object.assign({className:"icon-container"},Bt(Gt,"icon-container")),st.a.createElement(Gn,{theme:Gt,iconStyle:xn})),st.a.createElement(Br,this.props),st.a.createElement("span",Bt(Gt,"brace"),Wt==="array"?"[":"{")),Pt?this.getObjectMetaData(tn):null)}},{key:"render",value:function(){var Wt=this,Pt=this.props,hn=Pt.depth,un=Pt.src,tn=(Pt.namespace,Pt.name,Pt.type,Pt.parent_type),Gt=Pt.theme,xn=Pt.jsvRoot,Gn=Pt.iconStyle,er=kt(Pt,["depth","src","namespace","name","type","parent_type","theme","jsvRoot","iconStyle"]),tr=this.state,ir=tr.object_type,Kn=tr.expanded,rr={};return xn||tn==="array_group"?tn==="array_group"&&(rr.borderLeft=0,rr.display="inline"):rr.paddingLeft=5*this.props.indentWidth,st.a.createElement("div",Object.assign({className:"object-key-val",onMouseEnter:function(){return Wt.setState(rt(rt({},Wt.state),{},{hovered:!0}))},onMouseLeave:function(){return Wt.setState(rt(rt({},Wt.state),{},{hovered:!1}))}},Bt(Gt,xn?"jsv-root":"objectKeyVal",rr)),this.getBraceStart(ir,Kn),Kn?this.getObjectContent(hn,un,rt({theme:Gt,iconStyle:Gn},er)):this.getEllipsis(),st.a.createElement("span",{className:"brace-row"},st.a.createElement("span",{style:rt(rt({},Bt(Gt,"brace").style),{},{paddingLeft:Kn?"3px":"0px"})},ir==="array"?"]":"}"),Kn?null:this.getObjectMetaData(un)))}}],[{key:"getDerivedStateFromProps",value:function(Wt,Pt){var hn=Pt.prevProps;return Wt.src!==hn.src||Wt.collapsed!==hn.collapsed||Wt.name!==hn.name||Wt.namespace!==hn.namespace||Wt.rjvId!==hn.rjvId?rt(rt({},Rt.getState(Wt)),{},{prevProps:Wt}):null}}]),Rt}(st.a.PureComponent);Zr.getState=function(It){var Nt=Object.keys(It.src).length,Rt=(It.collapsed===!1||It.collapsed!==!0&&It.collapsed>It.depth)&&(!It.shouldCollapse||It.shouldCollapse({name:It.name,src:It.src,type:_t(It.src),namespace:It.namespace})===!1)&&Nt!==0;return{expanded:dn.get(It.rjvId,It.namespace,"expanded",Rt),object_type:It.type==="array"?"array":"object",parent_type:It.type==="array"?"array":"object",size:Nt,hovered:!1}};var mo=function It(Nt,Rt){nt(this,It),this.name=Nt,this.value=Rt,this.type=_t(Rt)};Mt(Zr);var St=Zr,Dt=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){var Wt;nt(this,Rt);for(var Pt=arguments.length,hn=new Array(Pt),un=0;untn.groupArraysAfterLength&&(xn=Qr),st.a.createElement("div",{className:"pretty-json-container object-container"},st.a.createElement("div",{className:"object-content"},st.a.createElement(xn,Object.assign({namespace:Gt,depth:0,jsvRoot:!0},tn))))},Wt}return Rt}(st.a.PureComponent),$t=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(Wt){var Pt;return nt(this,Rt),(Pt=Nt.call(this,Wt)).closeModal=function(){Bn.dispatch({rjvId:Pt.props.rjvId,name:"RESET"})},Pt.submit=function(){Pt.props.submit(Pt.state.input)},Pt.state={input:Wt.input?Wt.input:""},Pt}return at(Rt,[{key:"render",value:function(){var Wt=this,Pt=this.props,hn=Pt.theme,un=Pt.rjvId,tn=Pt.isValid,Gt=this.state.input,xn=tn(Gt);return st.a.createElement("div",Object.assign({className:"key-modal-request"},Bt(hn,"key-modal-request"),{onClick:this.closeModal}),st.a.createElement("div",Object.assign({},Bt(hn,"key-modal"),{onClick:function(Gn){Gn.stopPropagation()}}),st.a.createElement("div",Bt(hn,"key-modal-label"),"Key Name:"),st.a.createElement("div",{style:{position:"relative"}},st.a.createElement("input",Object.assign({},Bt(hn,"key-modal-input"),{className:"key-modal-input",ref:function(Gn){return Gn&&Gn.focus()},spellCheck:!1,value:Gt,placeholder:"...",onChange:function(Gn){Wt.setState({input:Gn.target.value})},onKeyPress:function(Gn){xn&&Gn.key==="Enter"?Wt.submit():Gn.key==="Escape"&&Wt.closeModal()}})),xn?st.a.createElement(cr,Object.assign({},Bt(hn,"key-modal-submit"),{className:"key-modal-submit",onClick:function(Gn){return Wt.submit()}})):null),st.a.createElement("span",Bt(hn,"key-modal-cancel"),st.a.createElement(qn,Object.assign({},Bt(hn,"key-modal-cancel-icon"),{className:"key-modal-cancel",onClick:function(){Bn.dispatch({rjvId:un,name:"RESET"})}})))))}}]),Rt}(st.a.PureComponent),mt=function(It){dt(Rt,It);var Nt=ct(Rt);function Rt(){var Wt;nt(this,Rt);for(var Pt=arguments.length,hn=new Array(Pt),un=0;un{_($.updated_src)},[]);return jsxs("div",{className:"send-tx-form",children:[jsx$1("h3",{children:"Configure and send transaction"}),jsx$1(ReactJson,{theme:"ocean",src:defaultTx,onEdit:j,onAdd:j,onDelete:j}),d?jsx$1("button",{onClick:()=>k.sendTransaction(b),children:"Send transaction"}):jsx$1("button",{onClick:()=>k.openModal(),children:"Connect wallet to send the transaction"})]})}const footer="",style$3="",defaultColors={[THEME.LIGHT]:{constant:{black:"#000000",white:"#FFFFFF"},connectButton:{background:"#0098EA",foreground:"#FFFFFF"},accent:"#0098EA",telegramButton:"#0098EA",icon:{primary:"#0F0F0F",secondary:"#7A8999",tertiary:"#C1CAD2",success:"#29CC6A",error:"#F5A73B"},background:{primary:"#FFFFFF",secondary:"#F1F3F5",segment:"#FFFFFF",tint:"#F1F3F5",qr:"#F1F3F5"},text:{primary:"#0F0F0F",secondary:"#6A7785"}},[THEME.DARK]:{constant:{black:"#000000",white:"#FFFFFF"},connectButton:{background:"#0098EA",foreground:"#FFFFFF"},accent:"#E5E5EA",telegramButton:"#31A6F5",icon:{primary:"#E5E5EA",secondary:"#909099",tertiary:"#434347",success:"#29CC6A",error:"#F5A73B"},background:{primary:"#121214",secondary:"#18181A",segment:"#262629",tint:"#222224",qr:"#F1F3F5"},text:{primary:"#E5E5EA",secondary:"#7D7D85"}}},ColorsSelect=({theme:b})=>{const[_,d]=useTonConnectUI(),[k,j]=reactExports.useState(defaultColors[b]);reactExports.useEffect(()=>{j(defaultColors[b])},[b]);const $=(et,tt,rt)=>{d({uiPreferences:{colorsSet:{[b]:{[tt]:rt?{...k[tt],[rt]:et}:et}}}}),j(nt=>({...nt,[tt]:rt?{...nt[tt],[rt]:et}:et})),defaultColors[b]={...defaultColors[b],[tt]:rt?{...k[tt],[rt]:et}:et}};return jsx$1("div",{className:"colors-container",children:Object.entries(k).map(([et,tt])=>typeof tt=="object"?jsxs("div",{children:[jsxs("span",{children:[et,":"]}),Object.entries(tt).map(([rt,nt])=>jsxs("label",{children:[rt,jsx$1("input",{type:"color",value:k[et][rt],onChange:ot=>$(ot.target.value,et,rt)})]},et+rt))]},et):jsxs("div",{children:[jsxs("span",{children:[et,":"]}),jsx$1("label",{children:jsx$1("input",{type:"color",value:k[et],onChange:rt=>$(rt.target.value,et)})})]}))})},style$2="",ColorsModal=()=>{const[b,_]=reactExports.useState(!1),[d,k]=reactExports.useState(THEME.LIGHT);return jsxs(Fragment,{children:[jsx$1("button",{onClick:()=>_(!0),children:"change colors"}),b&&jsxs("div",{className:"modal",children:[jsx$1("button",{onClick:()=>_(!1),children:"close"}),jsxs("div",{className:"modal__toggle",children:[jsx$1("a",{href:"#",style:{color:d===THEME.LIGHT?"blue":"white"},onClick:()=>k(THEME.LIGHT),children:"LIGHT"}),jsx$1("a",{href:"#",style:{color:d===THEME.DARK?"blue":"white"},onClick:()=>k(THEME.DARK),children:"DARK"})]}),jsx$1(ColorsSelect,{theme:d})]})]})},Footer=()=>{const[b,_]=reactExports.useState([!0,!1,!1,!0,!0,!0]),[d,k]=reactExports.useState("back"),[j,$]=reactExports.useState("ios"),[et,tt]=reactExports.useState(!0),[rt,nt]=useTonConnectUI(),ot=lt=>{nt({language:lt})},at=lt=>{nt({uiPreferences:{theme:lt}})},it=lt=>{nt({uiPreferences:{borderRadius:lt}})},dt=lt=>{_(ct=>ct.map((gt,st)=>st===lt?!gt:gt))},ut=lt=>{tt(lt)},ht=()=>{if(!d){k("back");return}nt({actionsConfiguration:{returnStrategy:d}})},ft=()=>{if(!j){$("ios");return}nt({actionsConfiguration:{skipRedirectToWallet:j}})};return reactExports.useEffect(()=>{const lt=["before","success","error"],ct=lt.map((st,Ct)=>b[Ct]?st:void 0).filter(st=>st),gt=lt.map((st,Ct)=>b[Ct+3]?st:void 0).filter(st=>st);nt({actionsConfiguration:{modals:ct,notifications:gt}})},[b]),reactExports.useEffect(()=>{nt({enableAndroidBackHandler:et})},[et]),jsxs("footer",{className:"footer",children:[jsxs("div",{children:[jsx$1("label",{children:"language"}),jsxs("select",{onChange:lt=>ot(lt.target.value),children:[jsx$1("option",{value:"en",children:"en"}),jsx$1("option",{value:"ru",children:"ru"})]})]}),jsxs("div",{children:[jsx$1("label",{children:"theme"}),jsxs("select",{onChange:lt=>at(lt.target.value),children:[jsx$1("option",{value:THEME.DARK,children:"dark"}),jsx$1("option",{value:THEME.LIGHT,children:"light"}),jsx$1("option",{value:"SYSTEM",children:"system"})]})]}),jsxs("div",{children:[jsx$1("label",{children:"borders"}),jsxs("select",{onChange:lt=>it(lt.target.value),children:[jsx$1("option",{value:"m",children:"m"}),jsx$1("option",{value:"s",children:"s"}),jsx$1("option",{value:"none",children:"none"})]})]}),jsxs("div",{children:[jsx$1("label",{children:"enable android back handler"}),jsxs("select",{onChange:lt=>ut(lt.target.value==="true"),value:et.toString(),children:[jsx$1("option",{value:"true",children:"true"}),jsx$1("option",{value:"false",children:"false"})]})]}),jsxs("div",{className:"footer-checkbox-container",children:[jsx$1("span",{children:"modals"}),jsxs("label",{children:["before",jsx$1("input",{type:"checkbox",checked:b[0],onChange:()=>dt(0)})]}),jsxs("label",{children:["success",jsx$1("input",{type:"checkbox",checked:b[1],onChange:()=>dt(1)})]}),jsxs("label",{children:["error",jsx$1("input",{type:"checkbox",checked:b[2],onChange:()=>dt(2)})]})]}),jsxs("div",{className:"footer-checkbox-container",children:[jsx$1("span",{children:"notifications"}),jsxs("label",{children:["before",jsx$1("input",{type:"checkbox",checked:b[3],onChange:()=>dt(3)})]}),jsxs("label",{children:["success",jsx$1("input",{type:"checkbox",checked:b[4],onChange:()=>dt(4)})]}),jsxs("label",{children:["error",jsx$1("input",{type:"checkbox",checked:b[5],onChange:()=>dt(5)})]})]}),jsx$1("div",{children:jsx$1(ColorsModal,{})}),jsx$1("div",{children:jsxs("label",{children:["return strategy:",jsx$1("input",{style:{width:"200px"},value:d,onChange:lt=>k(lt.target.value),onBlur:ht})]})}),jsx$1("div",{children:jsxs("label",{children:[jsx$1("div",{children:"skip redirect to wallet:"}),jsx$1("div",{children:"('ios', 'never', 'always')"}),jsx$1("input",{style:{width:"200px"},value:j,onChange:lt=>$(lt.target.value),onBlur:ft})]})})]})},style$1="";class TonProofDemoApiService{constructor(){Jo(this,"localStorageKey","demo-api-access-token");Jo(this,"host",document.baseURI.replace(/\/$/,""));Jo(this,"accessToken",null);Jo(this,"refreshIntervalMs",9*60*1e3);this.accessToken=localStorage.getItem(this.localStorageKey),this.accessToken||this.generatePayload()}async generatePayload(){try{return{tonProof:(await(await fetch(`${this.host}/api/generate_payload`,{method:"POST"})).json()).payload}}catch{return null}}async checkProof(_,d){try{const k={address:d.address,network:d.chain,public_key:d.publicKey,proof:{..._,state_init:d.walletStateInit}},j=await(await fetch(`${this.host}/api/check_proof`,{method:"POST",body:JSON.stringify(k)})).json();j!=null&&j.token&&(localStorage.setItem(this.localStorageKey,j.token),this.accessToken=j.token)}catch(k){console.log("checkProof error:",k)}}async getAccountInfo(_){return await(await fetch(`${this.host}/api/get_account_info`,{headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":"application/json"}})).json()}async createJetton(_){return await(await fetch(`${this.host}/api/create_jetton`,{body:JSON.stringify(_),headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":"application/json"},method:"POST"})).json()}reset(){this.accessToken=null,localStorage.removeItem(this.localStorageKey),this.generatePayload()}}const TonProofDemoApi=new TonProofDemoApiService;function useInterval(b,_){const d=reactExports.useRef(b);reactExports.useLayoutEffect(()=>{d.current=b},[b]),reactExports.useEffect(()=>{if(!_&&_!==0)return;const k=setInterval(()=>d.current(),_);return()=>clearInterval(k)},[_])}const TonProofDemo=()=>{const b=reactExports.useRef(!0),[_,d]=reactExports.useState({}),k=useTonWallet(),[j,$]=reactExports.useState(!1),[et]=useTonConnectUI(),tt=reactExports.useCallback(async()=>{b.current&&(et.setConnectRequestParameters({state:"loading"}),b.current=!1);const nt=await TonProofDemoApi.generatePayload();nt?et.setConnectRequestParameters({state:"ready",value:nt}):et.setConnectRequestParameters(null)},[et,b]);b.current&&tt(),useInterval(tt,TonProofDemoApi.refreshIntervalMs),reactExports.useEffect(()=>et.onStatusChange(async nt=>{var ot;if(!nt){TonProofDemoApi.reset(),$(!1);return}if((ot=nt.connectItems)!=null&&ot.tonProof&&"proof"in nt.connectItems.tonProof&&await TonProofDemoApi.checkProof(nt.connectItems.tonProof.proof,nt.account),!TonProofDemoApi.accessToken){et.disconnect(),$(!1);return}$(!0)}),[et]);const rt=reactExports.useCallback(async()=>{if(!k)return;const nt=await TonProofDemoApi.getAccountInfo(k.account);d(nt)},[k]);return j?jsxs("div",{className:"ton-proof-demo",children:[jsx$1("h3",{children:"Demo backend API with ton_proof verification"}),j?jsx$1("button",{onClick:rt,children:"Call backend getAccountInfo()"}):jsx$1("div",{className:"ton-proof-demo__error",children:"Connect wallet to call API"}),jsx$1(ReactJson,{src:_,name:"response",theme:"ocean"})]}):null},style="",jetton={name:"Joint Photographic Experts Group",description:"JPEG is a commonly used method of lossy compression for digital images, particularly for those images produced by digital photography. The degree of compression can be adjusted, allowing a selectable tradeoff between storage size and image quality.",image_data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAdVBMVEX///8rKytSUlITExPT09Pm5uYcHBzKysqXl5cZGRmnp6cnJydISEjr6+tOTk5LS0swMDAhISHa2tq3t7fg4OBra2sKCgrw8PB3d3dCQkJeXl49PT29vb2goKCvr68AAADOzs5jY2ODg4ONjY1wcHA2NjaSkpJ0yRZUAAAFXklEQVR4nO3de3eaMBgGcCEIxkgVCiiIVG3t9/+IS8LFS+1ERy665/ljZwW3k99yeV9x5zgaIQiCIAiCIAiCIAiCIAhiLGFQTf85iWnF7wkKQui/Z2Yt8TuLnCEyn1tKnGSD+BznzbVzFuOPgYBc6Fo5i1/DLNFa+PZmIZEMBRRC152NTYMuMx5YaN9e9IYWurYtVAVCy46b4YW27UUVQrv2ohKhVUVDidCqhapIaNFCVSW0p4FTJrSmaCgTWrMXFQot2YsqhXY0cGqFNuxFpUIrFqpioQVFQ7XQfAOnWmi+aKgXmt6LGoSG96IOodmioUNodi/qEZrci5qEBhs4bUJjs6hLaG6h6hOaKhoahYYaOI1CQ0VDq9DIXtQrNFE0dAv1HzeahQb2onah9r2oX6i7aOgX8gZO60I1INS8UI0ItTZwZoQ696IZoc6iYUqoby8aE2pr4AwKNR03Awrn9wl1LdQBhbN7hXqIAwrXdwu1FI0BhYu7hVqKxoDCByZRx0IdUsjyB4jKT9QhhY/Nouq9OKzQcQ757N4cwqcS3h+WBS8udAiEEEJoGgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQWCJmM3cIFz/F34gdCaMROb5/llEejfO6689whfb+Uz4CQlHEczyQoiD2ZIKj2efNSWjUXm8QTv/ORYrpNxstwnHhVyvoZTQi34TicS2EcjuuEYTiu6rVH3tuLza1NKyRFEHb3wtBbZX0WqwlhwAfYCGtcKAcexmvWCsNjlo2Q0c2yvtP8Ml4Ghx7TaF64X61WmyoR4962cxhWk2NS+VLmlJIWTNKiSPel/AOxe5toXpj7UeSTw7cY8affCHfE71IvRSqnNiiIHzEWRWQ9FT8nhycQ1mcOIxM+4rgVppdzQ8XtcEO76/zU4dPY42tObRE6bCF2Vs6uC9laAs++edefe4Xv3Iw1QifzuCH9RSgvBvSC3avw2yaMrgpZLia4eOibd+0RMoGYX5/DaCWm8LEO0Boh+eQ7LaHtSUOjLk5zbdJj01kpzIXCJ6u2fak1qy7iuCRbPr+7O9ptq4SrNE33E08W8AP70dMsY3GAij0664R+1uX2yjUvPOnaZu2KPG1LvYzXikRMdiv0N8su3s3Tx7ywa73LtRytFB7fXsT8gLkUTo7/BsGTCJO43BTNO8T6pHHO3x6erdJ2DsMnEYqBM+bTdvzXqoU4aY7X2KyQSZPnEZ7dviIUbTdvStsf6wcZ0fqFhKLij7cXfxfLX0jI1qLh+dHKvZDQIRWfRM85e+lrCdlBtAHv9PS17JX2Ia8Q8hlAuTj2pkw2ek8r3GW0S42ilezrVhnvyZloZNfywrMKx+W06rKpr0fvdWs33afu12ojHyyG2/xmO26p8ORpYui1NyZ1+8q78bB5pvje412+YSEf6FXhWevd3qFFuTx5Irws+zymMSwsgyC4XGf+Zhuc5b27xWix8Zq3IsG3S29PoBlhtO3WJuH5MUyfnOf0+ROj2drdpUXuE7/nG2ITnz3xNwrJ7RPit4iO1O5P1+Rzs3hxZSxqolkY+X72yetdqe+zYb3CaL/5rMRBuH/o0ecTCOl0KQuZ98toXkPIK1n9QeFLCtmuCoLyM9II1H3SMMoLnL49aEBoIBBC+N8LEwuEnlLhKLs9BMXJlmqFO72l4WfYTC1wtP0wLPwoFQtHe7M7kaaqgaPRV6//X6cmjOzUA0ej6pBR30RotpjqAPJ404mJTLeKj1EEQRAEQRAEQRAEQRAEQf6SP4jPv7WHGoGuAAAAAElFTkSuQmCC",symbol:"JPEG",decimals:9,amount:"1000000000000000"},CreateJettonDemo=()=>{const[b,_]=reactExports.useState({}),[d]=useTonConnectUI(),k=useTonWallet();return jsxs("div",{className:"create-jetton-demo",children:[jsx$1("h3",{children:"Create Jetton"}),k?jsx$1("button",{onClick:async()=>{const $=await TonProofDemoApi.createJetton(jetton);_($),"error"in $||await d.sendTransaction($)},children:"Send create jetton"}):jsx$1("div",{className:"ton-proof-demo__error",children:"Connect wallet to send transaction"}),jsx$1(ReactJson,{src:b,name:"response",theme:"ocean"})]})};function App(){return jsx$1(TonConnectUIProvider$1,{manifestUrl:"https://ton-connect.github.io/demo-dapp-with-react-ui/tonconnect-manifest.json",uiPreferences:{theme:THEME.DARK},walletsListConfiguration:{includeWallets:[{appName:"telegram-wallet",name:"Wallet",imageUrl:"https://wallet.tg/images/logo-288.png",aboutUrl:"https://wallet.tg/",universalLink:"https://t.me/wallet?attach=wallet",bridgeUrl:"https://bridge.ton.space/bridge",platforms:["ios","android","macos","windows","linux"]},{appName:"tonwallet",name:"TON Wallet",imageUrl:"https://wallet.ton.org/assets/ui/qr-logo.png",aboutUrl:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",universalLink:"https://wallet.ton.org/ton-connect",jsBridgeKey:"tonwallet",bridgeUrl:"https://bridge.tonapi.io/bridge",platforms:["chrome","android"]},{appName:"nicegramWallet",name:"Nicegram Wallet",imageUrl:"https://static.nicegram.app/icon.png",aboutUrl:"https://nicegram.app",universalLink:"https://nicegram.app/tc",deepLink:"nicegram-tc://",jsBridgeKey:"nicegramWallet",bridgeUrl:"https://bridge.tonapi.io/bridge",platforms:["ios","android"]},{appName:"tokenpocket",name:"TokenPocket",imageUrl:"https://hk.tpstatic.net/logo/tokenpocket.png",aboutUrl:"https://tokenpocket.pro",jsBridgeKey:"tokenpocket",platforms:["ios","android"]},{appName:"dewallet",name:"DeWallet",imageUrl:"https://raw.githubusercontent.com/delab-team/manifests-images/main/WalletAvatar.png",aboutUrl:"https://delabwallet.com",universalLink:"https://t.me/dewallet?attach=wallet",bridgeUrl:"https://bridge.dewallet.pro/bridge",platforms:["ios","android","macos","windows","linux"]},{appName:"cdcTonWallet",name:"Crypto.com DeFi Wallet",imageUrl:"https://apro-ncw-api-file.crypto.com/wallet/logo",aboutUrl:"https://crypto.com/defi-wallet",universalLink:"https://wallet.crypto.com/deeplink/ton-connect",deepLink:"dfw://",jsBridgeKey:"cdcTonWallet",bridgeUrl:"https://wallet.crypto.com/sse/tonbridge",platforms:["ios","android","chrome"]},{appName:"tobi",name:"Tobi",imageUrl:"https://app.tobiwallet.app/icons/logo.png",aboutUrl:"https://tobi.fun",universalLink:"https://t.me/TobiCopilotBot?attach=wallet",bridgeUrl:"https://ton-bridge.tobiwallet.app/bridge",platforms:["ios","android","macos","windows","linux"]},{appName:"trustwalletTon",name:"Trust",imageUrl:"https://assets-cdn.trustwallet.com/dapps/trust.logo.png",aboutUrl:"https://trustwallet.com/about-us",bridgeUrl:"https://tonconnect.trustwallet.com/bridge",jsBridgeKey:"trustwalletTon",platforms:["chrome","ios","android"]},{appName:"bitgetWalletLite",name:"Bitget Wallet Lite",imageUrl:"https://raw.githubusercontent.com/bitgetwallet/download/main/logo/png/bitget_wallet_lite_logo.png",aboutUrl:"https://web3.bitget.com",universalLink:"https://t.me/BitgetWallet_TGBot?attach=wallet",bridgeUrl:"https://ton-connect-bridge.bgwapi.io/bridge",platforms:["ios","android","macos","windows","linux"]},{appName:"onekey",name:"OneKey",imageUrl:"https://common.onekey-asset.com/logo/onekey-x288.png",aboutUrl:"https://onekey.so",jsBridgeKey:"onekeyTonWallet",platforms:["chrome"]},{appName:"tomoWallet",name:"Tomo Wallet",imageUrl:"https://pub.tomo.inc/logo.png",aboutUrl:"https://www.tomo.inc/",universalLink:"https://t.me/tomowalletbot?attach=wallet",bridgeUrl:"https://go-bridge.tomo.inc/bridge",platforms:["ios","android","macos","windows","linux"]},{appName:"hpyTonWallet",name:"HyperPay Wallet",imageUrl:"https://hyperpay-website.oss-cn-hongkong.aliyuncs.com/static/dist/images/2022-12-30/logo.png",aboutUrl:"https://www.hyperpay.tech",universalLink:"https://www.hyperpay.tech/download&deeplink=hyperpay://web3/wallet/tonconnect",jsBridgeKey:"hpyTonWallet",bridgeUrl:"https://bridge.tonapi.io/bridge",platforms:["ios","android","macos","windows","linux"]}]},actionsConfiguration:{twaReturnUrl:"https://t.me/DemoDappWithTonConnectBot/demo"},children:jsxs("div",{className:"app",children:[jsx$1(Header,{}),jsx$1(TxForm,{}),jsx$1(CreateJettonDemo,{}),jsx$1(TonProofDemo,{}),jsx$1(Footer,{})]})})}const index="";function runSingleInstance(b){let _=!1;return async()=>{if(!_){_=!0;try{await b()}catch(d){console.error(d)}finally{_=!1}}}}eruda.init();async function enableMocking(){const b=document.baseURI.replace(/\/$/,"");return new Promise(async _=>{const{worker:d}=await __vitePreload(()=>import("./worker-f51faf5a.js"),[]),k=()=>d.start({onUnhandledRequest:"bypass",quiet:!1,serviceWorker:{url:"/demo-dapp-with-react-ui/mockServiceWorker.js"}});let j=await k();_(j);const $=runSingleInstance(async()=>{var et;try{const rt=(await((et=navigator.serviceWorker)==null?void 0:et.getRegistrations())||[]).length>0,nt=await fetch(`${b}/api/healthz`).then(ot=>ot.status===200?ot.json().then(at=>at.ok).catch(()=>!1):!1).catch(()=>!1);(!rt||!nt)&&(await(j==null?void 0:j.unregister().catch(()=>{})),j=await k().catch(()=>null))}catch(tt){console.error("Error in verifyAndRestartWorker:",tt),j=await k().catch(()=>null)}});setInterval($,1e3)})}enableMocking().then(()=>reactDomExports.render(jsx$1(reactExports.StrictMode,{children:jsx$1(App,{})}),document.getElementById("root")));export{CHAIN as C,buffer as b,commonjsGlobal as c,getAugmentedNamespace as g,naclFastExports as n,require$$4 as r}; diff --git a/docs/assets/index-e5afa628.js b/docs/assets/index-e5afa628.js deleted file mode 100644 index e01c900..0000000 --- a/docs/assets/index-e5afa628.js +++ /dev/null @@ -1,177 +0,0 @@ -const ba="16.9.0",Da=Object.freeze({major:16,minor:9,patch:0,preReleaseTag:null});function A(e,n){if(!!!e)throw new Error(n)}function se(e){return typeof(e==null?void 0:e.then)=="function"}function oe(e){return typeof e=="object"&&e!==null}function Q(e,n){if(!!!e)throw new Error(n??"Unexpected invariant triggered.")}const Dr=/\r\n|[\n\r]/g;function et(e,n){let t=0,i=1;for(const r of e.body.matchAll(Dr)){if(typeof r.index=="number"||Q(!1),r.index>=n)break;t=r.index+r[0].length,i+=1}return{line:i,column:n+1-t}}function Sr(e){return oi(e.source,et(e.source,e.start))}function oi(e,n){const t=e.locationOffset.column-1,i="".padStart(t)+e.body,r=n.line-1,s=e.locationOffset.line-1,o=n.line+s,a=n.line===1?t:0,c=n.column+a,l=`${e.name}:${o}:${c} -`,f=i.split(/\r\n|[\n\r]/g),d=f[r];if(d.length>120){const p=Math.floor(c/80),y=c%80,N=[];for(let L=0;L["|",L]),["|","^".padStart(y)],["|",N[p+1]]])}return l+Ft([[`${o-1} |`,f[r-1]],[`${o} |`,d],["|","^".padStart(c)],[`${o+1} |`,f[r+1]]])}function Ft(e){const n=e.filter(([i,r])=>r!==void 0),t=Math.max(...n.map(([i])=>i.length));return n.map(([i,r])=>i.padStart(t)+(r?" "+r:"")).join(` -`)}function Ar(e){const n=e[0];return n==null||"kind"in n||"length"in n?{nodes:n,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:n}class h extends Error{constructor(n,...t){var i,r,s;const{nodes:o,source:a,positions:c,path:l,originalError:f,extensions:d}=Ar(t);super(n),this.name="GraphQLError",this.path=l??void 0,this.originalError=f??void 0,this.nodes=kt(Array.isArray(o)?o:o?[o]:void 0);const p=kt((i=this.nodes)===null||i===void 0?void 0:i.map(N=>N.loc).filter(N=>N!=null));this.source=a??(p==null||(r=p[0])===null||r===void 0?void 0:r.source),this.positions=c??(p==null?void 0:p.map(N=>N.start)),this.locations=c&&a?c.map(N=>et(a,N)):p==null?void 0:p.map(N=>et(N.source,N.start));const y=oe(f==null?void 0:f.extensions)?f==null?void 0:f.extensions:void 0;this.extensions=(s=d??y)!==null&&s!==void 0?s:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),f!=null&&f.stack?Object.defineProperty(this,"stack",{value:f.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,h):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let n=this.message;if(this.nodes)for(const t of this.nodes)t.loc&&(n+=` - -`+Sr(t.loc));else if(this.source&&this.locations)for(const t of this.locations)n+=` - -`+oi(this.source,t);return n}toJSON(){const n={message:this.message};return this.locations!=null&&(n.locations=this.locations),this.path!=null&&(n.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(n.extensions=this.extensions),n}}function kt(e){return e===void 0||e.length===0?void 0:e}function Sa(e){return e.toString()}function Aa(e){return e.toJSON()}function X(e,n,t){return new h(`Syntax Error: ${t}`,{source:e,positions:[n]})}class wr{constructor(n,t,i){this.start=n.start,this.end=t.end,this.startToken=n,this.endToken=t,this.source=i}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class ai{constructor(n,t,i,r,s,o){this.kind=n,this.start=t,this.end=i,this.line=r,this.column=s,this.value=o,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const ci={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},Rr=new Set(Object.keys(ci));function nt(e){const n=e==null?void 0:e.kind;return typeof n=="string"&&Rr.has(n)}var z;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(z||(z={}));var b;(function(e){e.QUERY="QUERY",e.MUTATION="MUTATION",e.SUBSCRIPTION="SUBSCRIPTION",e.FIELD="FIELD",e.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",e.FRAGMENT_SPREAD="FRAGMENT_SPREAD",e.INLINE_FRAGMENT="INLINE_FRAGMENT",e.VARIABLE_DEFINITION="VARIABLE_DEFINITION",e.SCHEMA="SCHEMA",e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.FIELD_DEFINITION="FIELD_DEFINITION",e.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.ENUM_VALUE="ENUM_VALUE",e.INPUT_OBJECT="INPUT_OBJECT",e.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"})(b||(b={}));var u;(function(e){e.NAME="Name",e.DOCUMENT="Document",e.OPERATION_DEFINITION="OperationDefinition",e.VARIABLE_DEFINITION="VariableDefinition",e.SELECTION_SET="SelectionSet",e.FIELD="Field",e.ARGUMENT="Argument",e.FRAGMENT_SPREAD="FragmentSpread",e.INLINE_FRAGMENT="InlineFragment",e.FRAGMENT_DEFINITION="FragmentDefinition",e.VARIABLE="Variable",e.INT="IntValue",e.FLOAT="FloatValue",e.STRING="StringValue",e.BOOLEAN="BooleanValue",e.NULL="NullValue",e.ENUM="EnumValue",e.LIST="ListValue",e.OBJECT="ObjectValue",e.OBJECT_FIELD="ObjectField",e.DIRECTIVE="Directive",e.NAMED_TYPE="NamedType",e.LIST_TYPE="ListType",e.NON_NULL_TYPE="NonNullType",e.SCHEMA_DEFINITION="SchemaDefinition",e.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",e.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",e.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",e.FIELD_DEFINITION="FieldDefinition",e.INPUT_VALUE_DEFINITION="InputValueDefinition",e.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",e.UNION_TYPE_DEFINITION="UnionTypeDefinition",e.ENUM_TYPE_DEFINITION="EnumTypeDefinition",e.ENUM_VALUE_DEFINITION="EnumValueDefinition",e.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",e.DIRECTIVE_DEFINITION="DirectiveDefinition",e.SCHEMA_EXTENSION="SchemaExtension",e.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",e.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",e.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",e.UNION_TYPE_EXTENSION="UnionTypeExtension",e.ENUM_TYPE_EXTENSION="EnumTypeExtension",e.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"})(u||(u={}));function tt(e){return e===9||e===32}function rn(e){return e>=48&&e<=57}function ui(e){return e>=97&&e<=122||e>=65&&e<=90}function lt(e){return ui(e)||e===95}function li(e){return ui(e)||rn(e)||e===95}function Lr(e){var n;let t=Number.MAX_SAFE_INTEGER,i=null,r=-1;for(let o=0;oa===0?o:o.slice(t)).slice((n=i)!==null&&n!==void 0?n:0,r+1)}function Fr(e){let n=0;for(;n1&&i.slice(1).every(y=>y.length===0||tt(y.charCodeAt(0))),o=t.endsWith('\\"""'),a=e.endsWith('"')&&!o,c=e.endsWith("\\"),l=a||c,f=!(n!=null&&n.minimize)&&(!r||e.length>70||l||s||o);let d="";const p=r&&tt(e.charCodeAt(0));return(f&&!p||s)&&(d+=` -`),d+=t,(f||l)&&(d+=` -`),'"""'+d+'"""'}var E;(function(e){e.SOF="",e.EOF="",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"})(E||(E={}));class di{constructor(n){const t=new ai(E.SOF,0,0,0,0);this.source=n,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let n=this.token;if(n.kind!==E.EOF)do if(n.next)n=n.next;else{const t=$r(this,n.end);n.next=t,t.prev=n,n=t}while(n.kind===E.COMMENT);return n}}function pi(e){return e===E.BANG||e===E.DOLLAR||e===E.AMP||e===E.PAREN_L||e===E.PAREN_R||e===E.SPREAD||e===E.COLON||e===E.EQUALS||e===E.AT||e===E.BRACKET_L||e===E.BRACKET_R||e===E.BRACE_L||e===E.PIPE||e===E.BRACE_R}function Xe(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function Vn(e,n){return hi(e.charCodeAt(n))&&mi(e.charCodeAt(n+1))}function hi(e){return e>=55296&&e<=56319}function mi(e){return e>=56320&&e<=57343}function Ce(e,n){const t=e.source.body.codePointAt(n);if(t===void 0)return E.EOF;if(t>=32&&t<=126){const i=String.fromCodePoint(t);return i==='"'?`'"'`:`"${i}"`}return"U+"+t.toString(16).toUpperCase().padStart(4,"0")}function Y(e,n,t,i,r){const s=e.line,o=1+t-e.lineStart;return new ai(n,t,i,s,o,r)}function $r(e,n){const t=e.source.body,i=t.length;let r=n;for(;r=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function jr(e,n){const t=e.source.body;switch(t.charCodeAt(n+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:` -`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw X(e.source,n,`Invalid character escape sequence: "${t.slice(n,n+2)}".`)}function Pr(e,n){const t=e.source.body,i=t.length;let r=e.lineStart,s=n+3,o=s,a="";const c=[];for(;sEi?"["+Xr(e)+"]":"{ "+t.map(([r,s])=>r+": "+xn(s,n)).join(", ")+" }"}function Jr(e,n){if(e.length===0)return"[]";if(n.length>Ei)return"[Array]";const t=Math.min(Br,e.length),i=e.length-t,r=[];for(let s=0;s1&&r.push(`... ${i} more items`),"["+r.join(", ")+"]"}function Xr(e){const n=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(n==="Object"&&typeof e.constructor=="function"){const t=e.constructor.name;if(typeof t=="string"&&t!=="")return t}return n}const zr=globalThis.process&&!0,ye=zr?function(n,t){return n instanceof t}:function(n,t){if(n instanceof t)return!0;if(typeof n=="object"&&n!==null){var i;const r=t.prototype[Symbol.toStringTag],s=Symbol.toStringTag in n?n[Symbol.toStringTag]:(i=n.constructor)===null||i===void 0?void 0:i.name;if(r===s){const o=T(n);throw new Error(`Cannot use ${r} "${o}" from another module or realm. - -Ensure that there is only one instance of "graphql" in the node_modules -directory. If different versions of "graphql" are the dependencies of other -relied on modules, use "resolutions" to ensure only one version is installed. - -https://yarnpkg.com/en/docs/selective-version-resolutions - -Duplicate "graphql" modules cannot be used at the same time since different -versions may have different capabilities and behavior. The data from one -version used in the function from another could produce confusing and -spurious results.`)}}return!1};class ft{constructor(n,t="GraphQL request",i={line:1,column:1}){typeof n=="string"||A(!1,`Body must be a string. Received: ${T(n)}.`),this.body=n,this.name=t,this.locationOffset=i,this.locationOffset.line>0||A(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||A(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function Ti(e){return ye(e,ft)}function dt(e,n){return new Cn(e,n).parseDocument()}function Hr(e,n){const t=new Cn(e,n);t.expectToken(E.SOF);const i=t.parseValueLiteral(!1);return t.expectToken(E.EOF),i}function wa(e,n){const t=new Cn(e,n);t.expectToken(E.SOF);const i=t.parseConstValueLiteral();return t.expectToken(E.EOF),i}function Ra(e,n){const t=new Cn(e,n);t.expectToken(E.SOF);const i=t.parseTypeReference();return t.expectToken(E.EOF),i}class Cn{constructor(n,t={}){const i=Ti(n)?n:new ft(n);this._lexer=new di(i),this._options=t,this._tokenCounter=0}parseName(){const n=this.expectToken(E.NAME);return this.node(n,{kind:u.NAME,value:n.value})}parseDocument(){return this.node(this._lexer.token,{kind:u.DOCUMENT,definitions:this.many(E.SOF,this.parseDefinition,E.EOF)})}parseDefinition(){if(this.peek(E.BRACE_L))return this.parseOperationDefinition();const n=this.peekDescription(),t=n?this._lexer.lookahead():this._lexer.token;if(t.kind===E.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(n)throw X(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const n=this._lexer.token;if(this.peek(E.BRACE_L))return this.node(n,{kind:u.OPERATION_DEFINITION,operation:z.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let i;return this.peek(E.NAME)&&(i=this.parseName()),this.node(n,{kind:u.OPERATION_DEFINITION,operation:t,name:i,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const n=this.expectToken(E.NAME);switch(n.value){case"query":return z.QUERY;case"mutation":return z.MUTATION;case"subscription":return z.SUBSCRIPTION}throw this.unexpected(n)}parseVariableDefinitions(){return this.optionalMany(E.PAREN_L,this.parseVariableDefinition,E.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:u.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(E.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(E.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const n=this._lexer.token;return this.expectToken(E.DOLLAR),this.node(n,{kind:u.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:u.SELECTION_SET,selections:this.many(E.BRACE_L,this.parseSelection,E.BRACE_R)})}parseSelection(){return this.peek(E.SPREAD)?this.parseFragment():this.parseField()}parseField(){const n=this._lexer.token,t=this.parseName();let i,r;return this.expectOptionalToken(E.COLON)?(i=t,r=this.parseName()):r=t,this.node(n,{kind:u.FIELD,alias:i,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(E.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(n){const t=n?this.parseConstArgument:this.parseArgument;return this.optionalMany(E.PAREN_L,t,E.PAREN_R)}parseArgument(n=!1){const t=this._lexer.token,i=this.parseName();return this.expectToken(E.COLON),this.node(t,{kind:u.ARGUMENT,name:i,value:this.parseValueLiteral(n)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const n=this._lexer.token;this.expectToken(E.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(E.NAME)?this.node(n,{kind:u.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(n,{kind:u.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const n=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(n,{kind:u.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(n,{kind:u.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(n){const t=this._lexer.token;switch(t.kind){case E.BRACKET_L:return this.parseList(n);case E.BRACE_L:return this.parseObject(n);case E.INT:return this.advanceLexer(),this.node(t,{kind:u.INT,value:t.value});case E.FLOAT:return this.advanceLexer(),this.node(t,{kind:u.FLOAT,value:t.value});case E.STRING:case E.BLOCK_STRING:return this.parseStringLiteral();case E.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:u.BOOLEAN,value:!0});case"false":return this.node(t,{kind:u.BOOLEAN,value:!1});case"null":return this.node(t,{kind:u.NULL});default:return this.node(t,{kind:u.ENUM,value:t.value})}case E.DOLLAR:if(n)if(this.expectToken(E.DOLLAR),this._lexer.token.kind===E.NAME){const i=this._lexer.token.value;throw X(this._lexer.source,t.start,`Unexpected variable "$${i}" in constant value.`)}else throw this.unexpected(t);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const n=this._lexer.token;return this.advanceLexer(),this.node(n,{kind:u.STRING,value:n.value,block:n.kind===E.BLOCK_STRING})}parseList(n){const t=()=>this.parseValueLiteral(n);return this.node(this._lexer.token,{kind:u.LIST,values:this.any(E.BRACKET_L,t,E.BRACKET_R)})}parseObject(n){const t=()=>this.parseObjectField(n);return this.node(this._lexer.token,{kind:u.OBJECT,fields:this.any(E.BRACE_L,t,E.BRACE_R)})}parseObjectField(n){const t=this._lexer.token,i=this.parseName();return this.expectToken(E.COLON),this.node(t,{kind:u.OBJECT_FIELD,name:i,value:this.parseValueLiteral(n)})}parseDirectives(n){const t=[];for(;this.peek(E.AT);)t.push(this.parseDirective(n));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(n){const t=this._lexer.token;return this.expectToken(E.AT),this.node(t,{kind:u.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(n)})}parseTypeReference(){const n=this._lexer.token;let t;if(this.expectOptionalToken(E.BRACKET_L)){const i=this.parseTypeReference();this.expectToken(E.BRACKET_R),t=this.node(n,{kind:u.LIST_TYPE,type:i})}else t=this.parseNamedType();return this.expectOptionalToken(E.BANG)?this.node(n,{kind:u.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:u.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(E.STRING)||this.peek(E.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const n=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const i=this.parseConstDirectives(),r=this.many(E.BRACE_L,this.parseOperationTypeDefinition,E.BRACE_R);return this.node(n,{kind:u.SCHEMA_DEFINITION,description:t,directives:i,operationTypes:r})}parseOperationTypeDefinition(){const n=this._lexer.token,t=this.parseOperationType();this.expectToken(E.COLON);const i=this.parseNamedType();return this.node(n,{kind:u.OPERATION_TYPE_DEFINITION,operation:t,type:i})}parseScalarTypeDefinition(){const n=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const i=this.parseName(),r=this.parseConstDirectives();return this.node(n,{kind:u.SCALAR_TYPE_DEFINITION,description:t,name:i,directives:r})}parseObjectTypeDefinition(){const n=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const i=this.parseName(),r=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(n,{kind:u.OBJECT_TYPE_DEFINITION,description:t,name:i,interfaces:r,directives:s,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(E.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(E.BRACE_L,this.parseFieldDefinition,E.BRACE_R)}parseFieldDefinition(){const n=this._lexer.token,t=this.parseDescription(),i=this.parseName(),r=this.parseArgumentDefs();this.expectToken(E.COLON);const s=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(n,{kind:u.FIELD_DEFINITION,description:t,name:i,arguments:r,type:s,directives:o})}parseArgumentDefs(){return this.optionalMany(E.PAREN_L,this.parseInputValueDef,E.PAREN_R)}parseInputValueDef(){const n=this._lexer.token,t=this.parseDescription(),i=this.parseName();this.expectToken(E.COLON);const r=this.parseTypeReference();let s;this.expectOptionalToken(E.EQUALS)&&(s=this.parseConstValueLiteral());const o=this.parseConstDirectives();return this.node(n,{kind:u.INPUT_VALUE_DEFINITION,description:t,name:i,type:r,defaultValue:s,directives:o})}parseInterfaceTypeDefinition(){const n=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const i=this.parseName(),r=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(n,{kind:u.INTERFACE_TYPE_DEFINITION,description:t,name:i,interfaces:r,directives:s,fields:o})}parseUnionTypeDefinition(){const n=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const i=this.parseName(),r=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(n,{kind:u.UNION_TYPE_DEFINITION,description:t,name:i,directives:r,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(E.EQUALS)?this.delimitedMany(E.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const n=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const i=this.parseName(),r=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(n,{kind:u.ENUM_TYPE_DEFINITION,description:t,name:i,directives:r,values:s})}parseEnumValuesDefinition(){return this.optionalMany(E.BRACE_L,this.parseEnumValueDefinition,E.BRACE_R)}parseEnumValueDefinition(){const n=this._lexer.token,t=this.parseDescription(),i=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(n,{kind:u.ENUM_VALUE_DEFINITION,description:t,name:i,directives:r})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw X(this._lexer.source,this._lexer.token.start,`${vn(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const n=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const i=this.parseName(),r=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(n,{kind:u.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:i,directives:r,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(E.BRACE_L,this.parseInputValueDef,E.BRACE_R)}parseTypeSystemExtension(){const n=this._lexer.lookahead();if(n.kind===E.NAME)switch(n.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(n)}parseSchemaExtension(){const n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),i=this.optionalMany(E.BRACE_L,this.parseOperationTypeDefinition,E.BRACE_R);if(t.length===0&&i.length===0)throw this.unexpected();return this.node(n,{kind:u.SCHEMA_EXTENSION,directives:t,operationTypes:i})}parseScalarTypeExtension(){const n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),i=this.parseConstDirectives();if(i.length===0)throw this.unexpected();return this.node(n,{kind:u.SCALAR_TYPE_EXTENSION,name:t,directives:i})}parseObjectTypeExtension(){const n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(i.length===0&&r.length===0&&s.length===0)throw this.unexpected();return this.node(n,{kind:u.OBJECT_TYPE_EXTENSION,name:t,interfaces:i,directives:r,fields:s})}parseInterfaceTypeExtension(){const n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(i.length===0&&r.length===0&&s.length===0)throw this.unexpected();return this.node(n,{kind:u.INTERFACE_TYPE_EXTENSION,name:t,interfaces:i,directives:r,fields:s})}parseUnionTypeExtension(){const n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(n,{kind:u.UNION_TYPE_EXTENSION,name:t,directives:i,types:r})}parseEnumTypeExtension(){const n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(n,{kind:u.ENUM_TYPE_EXTENSION,name:t,directives:i,values:r})}parseInputObjectTypeExtension(){const n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(n,{kind:u.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:i,fields:r})}parseDirectiveDefinition(){const n=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(E.AT);const i=this.parseName(),r=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(n,{kind:u.DIRECTIVE_DEFINITION,description:t,name:i,arguments:r,repeatable:s,locations:o})}parseDirectiveLocations(){return this.delimitedMany(E.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const n=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(b,t.value))return t;throw this.unexpected(n)}node(n,t){return this._options.noLocation!==!0&&(t.loc=new wr(n,this._lexer.lastToken,this._lexer.source)),t}peek(n){return this._lexer.token.kind===n}expectToken(n){const t=this._lexer.token;if(t.kind===n)return this.advanceLexer(),t;throw X(this._lexer.source,t.start,`Expected ${yi(n)}, found ${vn(t)}.`)}expectOptionalToken(n){return this._lexer.token.kind===n?(this.advanceLexer(),!0):!1}expectKeyword(n){const t=this._lexer.token;if(t.kind===E.NAME&&t.value===n)this.advanceLexer();else throw X(this._lexer.source,t.start,`Expected "${n}", found ${vn(t)}.`)}expectOptionalKeyword(n){const t=this._lexer.token;return t.kind===E.NAME&&t.value===n?(this.advanceLexer(),!0):!1}unexpected(n){const t=n??this._lexer.token;return X(this._lexer.source,t.start,`Unexpected ${vn(t)}.`)}any(n,t,i){this.expectToken(n);const r=[];for(;!this.expectOptionalToken(i);)r.push(t.call(this));return r}optionalMany(n,t,i){if(this.expectOptionalToken(n)){const r=[];do r.push(t.call(this));while(!this.expectOptionalToken(i));return r}return[]}many(n,t,i){this.expectToken(n);const r=[];do r.push(t.call(this));while(!this.expectOptionalToken(i));return r}delimitedMany(n,t){this.expectOptionalToken(n);const i=[];do i.push(t.call(this));while(this.expectOptionalToken(n));return i}advanceLexer(){const{maxTokens:n}=this._options,t=this._lexer.advance();if(n!==void 0&&t.kind!==E.EOF&&(++this._tokenCounter,this._tokenCounter>n))throw X(this._lexer.source,t.start,`Document contains more that ${n} tokens. Parsing aborted.`)}}function vn(e){const n=e.value;return yi(e.kind)+(n!=null?` "${n}"`:"")}function yi(e){return pi(e)?`"${e}"`:e}const Wr=5;function Oe(e,n){const[t,i]=n?[e,n]:[void 0,e];let r=" Did you mean ";t&&(r+=t+" ");const s=i.map(c=>`"${c}"`);switch(s.length){case 0:return"";case 1:return r+s[0]+"?";case 2:return r+s[0]+" or "+s[1]+"?"}const o=s.slice(0,Wr),a=o.pop();return r+o.join(", ")+", or "+a+"?"}function Vt(e){return e}function be(e,n){const t=Object.create(null);for(const i of e)t[n(i)]=i;return t}function Le(e,n,t){const i=Object.create(null);for(const r of e)i[n(r)]=t(r);return i}function ge(e,n){const t=Object.create(null);for(const i of Object.keys(e))t[i]=n(e[i],i);return t}function dn(e,n){let t=0,i=0;for(;t0);let a=0;do++i,a=a*10+s-it,s=n.charCodeAt(i);while(Nn(s)&&a>0);if(oa)return 1}else{if(rs)return 1;++t,++i}}return e.length-n.length}const it=48,Kr=57;function Nn(e){return!isNaN(e)&&it<=e&&e<=Kr}function Fe(e,n){const t=Object.create(null),i=new Zr(e),r=Math.floor(e.length*.4)+1;for(const s of n){const o=i.measure(s,r);o!==void 0&&(t[s]=o)}return Object.keys(t).sort((s,o)=>{const a=t[s]-t[o];return a!==0?a:dn(s,o)})}class Zr{constructor(n){this._input=n,this._inputLowerCase=n.toLowerCase(),this._inputArray=xt(this._inputLowerCase),this._rows=[new Array(n.length+1).fill(0),new Array(n.length+1).fill(0),new Array(n.length+1).fill(0)]}measure(n,t){if(this._input===n)return 0;const i=n.toLowerCase();if(this._inputLowerCase===i)return 1;let r=xt(i),s=this._inputArray;if(r.lengtht)return;const c=this._rows;for(let f=0;f<=a;f++)c[0][f]=f;for(let f=1;f<=o;f++){const d=c[(f-1)%3],p=c[f%3];let y=p[0]=f;for(let N=1;N<=a;N++){const L=r[f-1]===s[N-1]?0:1;let k=Math.min(d[N]+1,p[N-1]+1,d[N-1]+L);if(f>1&&N>1&&r[f-1]===s[N-2]&&r[f-2]===s[N-1]){const P=c[(f-2)%3][N-2];k=Math.min(k,P+1)}kt)return}const l=c[o%3][a];return l<=t?l:void 0}}function xt(e){const n=e.length,t=new Array(n);for(let i=0;ie.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>I(e.definitions,` - -`)},OperationDefinition:{leave(e){const n=R("(",I(e.variableDefinitions,", "),")"),t=I([e.operation,I([e.name,n]),I(e.directives," ")]," ");return(t==="query"?"":t+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:n,defaultValue:t,directives:i})=>e+": "+n+R(" = ",t)+R(" ",I(i," "))},SelectionSet:{leave:({selections:e})=>he(e)},Field:{leave({alias:e,name:n,arguments:t,directives:i,selectionSet:r}){const s=R("",e,": ")+n;let o=s+R("(",I(t,", "),")");return o.length>rs&&(o=s+R(`( -`,bn(I(t,` -`)),` -)`)),I([o,I(i," "),r]," ")}},Argument:{leave:({name:e,value:n})=>e+": "+n},FragmentSpread:{leave:({name:e,directives:n})=>"..."+e+R(" ",I(n," "))},InlineFragment:{leave:({typeCondition:e,directives:n,selectionSet:t})=>I(["...",R("on ",e),I(n," "),t]," ")},FragmentDefinition:{leave:({name:e,typeCondition:n,variableDefinitions:t,directives:i,selectionSet:r})=>`fragment ${e}${R("(",I(t,", "),")")} on ${n} ${R("",I(i," ")," ")}`+r},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:n})=>n?fi(e):es(e)},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+I(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+I(e,", ")+"}"},ObjectField:{leave:({name:e,value:n})=>e+": "+n},Directive:{leave:({name:e,arguments:n})=>"@"+e+R("(",I(n,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:n,operationTypes:t})=>R("",e,` -`)+I(["schema",I(n," "),he(t)]," ")},OperationTypeDefinition:{leave:({operation:e,type:n})=>e+": "+n},ScalarTypeDefinition:{leave:({description:e,name:n,directives:t})=>R("",e,` -`)+I(["scalar",n,I(t," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:n,interfaces:t,directives:i,fields:r})=>R("",e,` -`)+I(["type",n,R("implements ",I(t," & ")),I(i," "),he(r)]," ")},FieldDefinition:{leave:({description:e,name:n,arguments:t,type:i,directives:r})=>R("",e,` -`)+n+(Ct(t)?R(`( -`,bn(I(t,` -`)),` -)`):R("(",I(t,", "),")"))+": "+i+R(" ",I(r," "))},InputValueDefinition:{leave:({description:e,name:n,type:t,defaultValue:i,directives:r})=>R("",e,` -`)+I([n+": "+t,R("= ",i),I(r," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:n,interfaces:t,directives:i,fields:r})=>R("",e,` -`)+I(["interface",n,R("implements ",I(t," & ")),I(i," "),he(r)]," ")},UnionTypeDefinition:{leave:({description:e,name:n,directives:t,types:i})=>R("",e,` -`)+I(["union",n,I(t," "),R("= ",I(i," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:n,directives:t,values:i})=>R("",e,` -`)+I(["enum",n,I(t," "),he(i)]," ")},EnumValueDefinition:{leave:({description:e,name:n,directives:t})=>R("",e,` -`)+I([n,I(t," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:n,directives:t,fields:i})=>R("",e,` -`)+I(["input",n,I(t," "),he(i)]," ")},DirectiveDefinition:{leave:({description:e,name:n,arguments:t,repeatable:i,locations:r})=>R("",e,` -`)+"directive @"+n+(Ct(t)?R(`( -`,bn(I(t,` -`)),` -)`):R("(",I(t,", "),")"))+(i?" repeatable":"")+" on "+I(r," | ")},SchemaExtension:{leave:({directives:e,operationTypes:n})=>I(["extend schema",I(e," "),he(n)]," ")},ScalarTypeExtension:{leave:({name:e,directives:n})=>I(["extend scalar",e,I(n," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:n,directives:t,fields:i})=>I(["extend type",e,R("implements ",I(n," & ")),I(t," "),he(i)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:n,directives:t,fields:i})=>I(["extend interface",e,R("implements ",I(n," & ")),I(t," "),he(i)]," ")},UnionTypeExtension:{leave:({name:e,directives:n,types:t})=>I(["extend union",e,I(n," "),R("= ",I(t," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:n,values:t})=>I(["extend enum",e,I(n," "),he(t)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:n,fields:t})=>I(["extend input",e,I(n," "),he(t)]," ")}};function I(e,n=""){var t;return(t=e==null?void 0:e.filter(i=>i).join(n))!==null&&t!==void 0?t:""}function he(e){return R(`{ -`,bn(I(e,` -`)),` -}`)}function R(e,n,t=""){return n!=null&&n!==""?e+n+t:""}function bn(e){return R(" ",e.replace(/\n/g,` - `))}function Ct(e){var n;return(n=e==null?void 0:e.some(t=>t.includes(` -`)))!==null&&n!==void 0?n:!1}function rt(e,n){switch(e.kind){case u.NULL:return null;case u.INT:return parseInt(e.value,10);case u.FLOAT:return parseFloat(e.value);case u.STRING:case u.ENUM:case u.BOOLEAN:return e.value;case u.LIST:return e.values.map(t=>rt(t,n));case u.OBJECT:return Le(e.fields,t=>t.name.value,t=>rt(t.value,n));case u.VARIABLE:return n==null?void 0:n[e.name.value]}}function le(e){if(e!=null||A(!1,"Must provide name."),typeof e=="string"||A(!1,"Expected name to be a string."),e.length===0)throw new h("Expected name to be a non-empty string.");for(let n=1;no(rt(a,c)),this.extensions=ue(n.extensions),this.astNode=n.astNode,this.extensionASTNodes=(s=n.extensionASTNodes)!==null&&s!==void 0?s:[],n.specifiedByURL==null||typeof n.specifiedByURL=="string"||A(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${T(n.specifiedByURL)}.`),n.serialize==null||typeof n.serialize=="function"||A(!1,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),n.parseLiteral&&(typeof n.parseValue=="function"&&typeof n.parseLiteral=="function"||A(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`))}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class Te{constructor(n){var t;this.name=le(n.name),this.description=n.description,this.isTypeOf=n.isTypeOf,this.extensions=ue(n.extensions),this.astNode=n.astNode,this.extensionASTNodes=(t=n.extensionASTNodes)!==null&&t!==void 0?t:[],this._fields=()=>bi(n),this._interfaces=()=>Oi(n),n.isTypeOf==null||typeof n.isTypeOf=="function"||A(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${T(n.isTypeOf)}.`)}get[Symbol.toStringTag](){return"GraphQLObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:Si(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Oi(e){var n;const t=Ii((n=e.interfaces)!==null&&n!==void 0?n:[]);return Array.isArray(t)||A(!1,`${e.name} interfaces must be an Array or a function which returns an Array.`),t}function bi(e){const n=_i(e.fields);return Ye(n)||A(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),ge(n,(t,i)=>{var r;Ye(t)||A(!1,`${e.name}.${i} field config must be an object.`),t.resolve==null||typeof t.resolve=="function"||A(!1,`${e.name}.${i} field resolver must be a function if provided, but got: ${T(t.resolve)}.`);const s=(r=t.args)!==null&&r!==void 0?r:{};return Ye(s)||A(!1,`${e.name}.${i} args must be an object with argument names as keys.`),{name:le(i),description:t.description,type:t.type,args:Di(s),resolve:t.resolve,subscribe:t.subscribe,deprecationReason:t.deprecationReason,extensions:ue(t.extensions),astNode:t.astNode}})}function Di(e){return Object.entries(e).map(([n,t])=>({name:le(n),description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:ue(t.extensions),astNode:t.astNode}))}function Ye(e){return oe(e)&&!Array.isArray(e)}function Si(e){return ge(e,n=>({description:n.description,type:n.type,args:Ai(n.args),resolve:n.resolve,subscribe:n.subscribe,deprecationReason:n.deprecationReason,extensions:n.extensions,astNode:n.astNode}))}function Ai(e){return Le(e,n=>n.name,n=>({description:n.description,type:n.type,defaultValue:n.defaultValue,deprecationReason:n.deprecationReason,extensions:n.extensions,astNode:n.astNode}))}function je(e){return S(e.type)&&e.defaultValue===void 0}class on{constructor(n){var t;this.name=le(n.name),this.description=n.description,this.resolveType=n.resolveType,this.extensions=ue(n.extensions),this.astNode=n.astNode,this.extensionASTNodes=(t=n.extensionASTNodes)!==null&&t!==void 0?t:[],this._fields=bi.bind(void 0,n),this._interfaces=Oi.bind(void 0,n),n.resolveType==null||typeof n.resolveType=="function"||A(!1,`${this.name} must provide "resolveType" as a function, but got: ${T(n.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLInterfaceType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:Si(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class an{constructor(n){var t;this.name=le(n.name),this.description=n.description,this.resolveType=n.resolveType,this.extensions=ue(n.extensions),this.astNode=n.astNode,this.extensionASTNodes=(t=n.extensionASTNodes)!==null&&t!==void 0?t:[],this._types=ls.bind(void 0,n),n.resolveType==null||typeof n.resolveType=="function"||A(!1,`${this.name} must provide "resolveType" as a function, but got: ${T(n.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLUnionType"}getTypes(){return typeof this._types=="function"&&(this._types=this._types()),this._types}toConfig(){return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function ls(e){const n=Ii(e.types);return Array.isArray(n)||A(!1,`Must provide Array of types or a function which returns such an array for Union ${e.name}.`),n}class Me{constructor(n){var t;this.name=le(n.name),this.description=n.description,this.extensions=ue(n.extensions),this.astNode=n.astNode,this.extensionASTNodes=(t=n.extensionASTNodes)!==null&&t!==void 0?t:[],this._values=typeof n.values=="function"?n.values:Mt(this.name,n.values),this._valueLookup=null,this._nameLookup=null}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){return typeof this._values=="function"&&(this._values=Mt(this.name,this._values())),this._values}getValue(n){return this._nameLookup===null&&(this._nameLookup=be(this.getValues(),t=>t.name)),this._nameLookup[n]}serialize(n){this._valueLookup===null&&(this._valueLookup=new Map(this.getValues().map(i=>[i.value,i])));const t=this._valueLookup.get(n);if(t===void 0)throw new h(`Enum "${this.name}" cannot represent value: ${T(n)}`);return t.name}parseValue(n){if(typeof n!="string"){const i=T(n);throw new h(`Enum "${this.name}" cannot represent non-string value: ${i}.`+gn(this,i))}const t=this.getValue(n);if(t==null)throw new h(`Value "${n}" does not exist in "${this.name}" enum.`+gn(this,n));return t.value}parseLiteral(n,t){if(n.kind!==u.ENUM){const r=U(n);throw new h(`Enum "${this.name}" cannot represent non-enum value: ${r}.`+gn(this,r),{nodes:n})}const i=this.getValue(n.value);if(i==null){const r=U(n);throw new h(`Value "${r}" does not exist in "${this.name}" enum.`+gn(this,r),{nodes:n})}return i.value}toConfig(){const n=Le(this.getValues(),t=>t.name,t=>({description:t.description,value:t.value,deprecationReason:t.deprecationReason,extensions:t.extensions,astNode:t.astNode}));return{name:this.name,description:this.description,values:n,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function gn(e,n){const t=e.getValues().map(r=>r.name),i=Fe(n,t);return Oe("the enum value",i)}function Mt(e,n){return Ye(n)||A(!1,`${e} values must be an object with value names as keys.`),Object.entries(n).map(([t,i])=>(Ye(i)||A(!1,`${e}.${t} must refer to an object with a "value" key representing an internal value but got: ${T(i)}.`),{name:os(t),description:i.description,value:i.value!==void 0?i.value:t,deprecationReason:i.deprecationReason,extensions:ue(i.extensions),astNode:i.astNode}))}class cn{constructor(n){var t,i;this.name=le(n.name),this.description=n.description,this.extensions=ue(n.extensions),this.astNode=n.astNode,this.extensionASTNodes=(t=n.extensionASTNodes)!==null&&t!==void 0?t:[],this.isOneOf=(i=n.isOneOf)!==null&&i!==void 0?i:!1,this._fields=fs.bind(void 0,n)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}toConfig(){const n=ge(this.getFields(),t=>({description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:t.extensions,astNode:t.astNode}));return{name:this.name,description:this.description,fields:n,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,isOneOf:this.isOneOf}}toString(){return this.name}toJSON(){return this.toString()}}function fs(e){const n=_i(e.fields);return Ye(n)||A(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),ge(n,(t,i)=>(!("resolve"in t)||A(!1,`${e.name}.${i} field has a resolve property, but Input Types cannot define resolvers.`),{name:le(i),description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:ue(t.extensions),astNode:t.astNode}))}function pt(e){return S(e.type)&&e.defaultValue===void 0}function st(e,n){return e===n?!0:S(e)&&S(n)||j(e)&&j(n)?st(e.ofType,n.ofType):!1}function qe(e,n,t){return n===t?!0:S(t)?S(n)?qe(e,n.ofType,t.ofType):!1:S(n)?qe(e,n.ofType,t):j(t)?j(n)?qe(e,n.ofType,t.ofType):!1:j(n)?!1:_e(t)&&($(n)||F(n))&&e.isSubType(t,n)}function Ut(e,n,t){return n===t?!0:_e(n)?_e(t)?e.getPossibleTypes(n).some(i=>e.isSubType(t,i)):e.isSubType(n,t):_e(t)?e.isSubType(t,n):!1}const zn=2147483647,Hn=-2147483648,ds=new Ae({name:"Int",description:"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.",serialize(e){const n=hn(e);if(typeof n=="boolean")return n?1:0;let t=n;if(typeof n=="string"&&n!==""&&(t=Number(n)),typeof t!="number"||!Number.isInteger(t))throw new h(`Int cannot represent non-integer value: ${T(n)}`);if(t>zn||tzn||ezn||ne.name===n)}function hn(e){if(oe(e)){if(typeof e.valueOf=="function"){const n=e.valueOf();if(!oe(n))return n}if(typeof e.toJSON=="function")return e.toJSON()}return e}function mt(e){return ye(e,Ne)}function qa(e){if(!mt(e))throw new Error(`Expected ${T(e)} to be a GraphQL directive.`);return e}class Ne{constructor(n){var t,i;this.name=le(n.name),this.description=n.description,this.locations=n.locations,this.isRepeatable=(t=n.isRepeatable)!==null&&t!==void 0?t:!1,this.extensions=ue(n.extensions),this.astNode=n.astNode,Array.isArray(n.locations)||A(!1,`@${n.name} locations must be an Array.`);const r=(i=n.args)!==null&&i!==void 0?i:{};oe(r)&&!Array.isArray(r)||A(!1,`@${n.name} args must be an object with argument names as keys.`),this.args=Di(r)}get[Symbol.toStringTag](){return"GraphQLDirective"}toConfig(){return{name:this.name,description:this.description,locations:this.locations,args:Ai(this.args),isRepeatable:this.isRepeatable,extensions:this.extensions,astNode:this.astNode}}toString(){return"@"+this.name}toJSON(){return this.toString()}}const Ri=new Ne({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[b.FIELD,b.FRAGMENT_SPREAD,b.INLINE_FRAGMENT],args:{if:{type:new w(re),description:"Included when true."}}}),Li=new Ne({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[b.FIELD,b.FRAGMENT_SPREAD,b.INLINE_FRAGMENT],args:{if:{type:new w(re),description:"Skipped when true."}}}),Fi="No longer supported",Et=new Ne({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[b.FIELD_DEFINITION,b.ARGUMENT_DEFINITION,b.INPUT_FIELD_DEFINITION,b.ENUM_VALUE],args:{reason:{type:B,description:"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",defaultValue:Fi}}}),ki=new Ne({name:"specifiedBy",description:"Exposes a URL that specifies the behavior of this scalar.",locations:[b.SCALAR],args:{url:{type:new w(B),description:"The URL that specifies the behavior of this scalar."}}}),$i=new Ne({name:"oneOf",description:"Indicates exactly one field must be supplied and this field must not be `null`.",locations:[b.INPUT_OBJECT],args:{}}),Pe=Object.freeze([Ri,Li,Et,ki,$i]);function Vi(e){return Pe.some(({name:n})=>n===e.name)}function Tt(e){return typeof e=="object"&&typeof(e==null?void 0:e[Symbol.iterator])=="function"}function Ve(e,n){if(S(n)){const t=Ve(e,n.ofType);return(t==null?void 0:t.kind)===u.NULL?null:t}if(e===null)return{kind:u.NULL};if(e===void 0)return null;if(j(n)){const t=n.ofType;if(Tt(e)){const i=[];for(const r of e){const s=Ve(r,t);s!=null&&i.push(s)}return{kind:u.LIST,values:i}}return Ve(e,t)}if(C(n)){if(!oe(e))return null;const t=[];for(const i of Object.values(n.getFields())){const r=Ve(e[i.name],i.type);r&&t.push({kind:u.OBJECT_FIELD,name:{kind:u.NAME,value:i.name},value:r})}return{kind:u.OBJECT,fields:t}}if(De(n)){const t=n.serialize(e);if(t==null)return null;if(typeof t=="boolean")return{kind:u.BOOLEAN,value:t};if(typeof t=="number"&&Number.isFinite(t)){const i=String(t);return jt.test(i)?{kind:u.INT,value:i}:{kind:u.FLOAT,value:i}}if(typeof t=="string")return J(n)?{kind:u.ENUM,value:t}:n===wi&&jt.test(t)?{kind:u.INT,value:t}:{kind:u.STRING,value:t};throw new TypeError(`Cannot convert value to AST: ${T(t)}.`)}Q(!1,"Unexpected input type: "+T(n))}const jt=/^-?(?:0|[1-9][0-9]*)$/,yt=new Te({name:"__Schema",description:"A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.",fields:()=>({description:{type:B,resolve:e=>e.description},types:{description:"A list of all types supported by this server.",type:new w(new W(new w(Ee))),resolve(e){return Object.values(e.getTypeMap())}},queryType:{description:"The type that query operations will be rooted at.",type:new w(Ee),resolve:e=>e.getQueryType()},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:Ee,resolve:e=>e.getMutationType()},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:Ee,resolve:e=>e.getSubscriptionType()},directives:{description:"A list of all directives supported by this server.",type:new w(new W(new w(xi))),resolve:e=>e.getDirectives()}})}),xi=new Te({name:"__Directive",description:`A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document. - -In some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.`,fields:()=>({name:{type:new w(B),resolve:e=>e.name},description:{type:B,resolve:e=>e.description},isRepeatable:{type:new w(re),resolve:e=>e.isRepeatable},locations:{type:new w(new W(new w(Ci))),resolve:e=>e.locations},args:{type:new w(new W(new w(Gn))),args:{includeDeprecated:{type:re,defaultValue:!1}},resolve(e,{includeDeprecated:n}){return n?e.args:e.args.filter(t=>t.deprecationReason==null)}}})}),Ci=new Me({name:"__DirectiveLocation",description:"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",values:{QUERY:{value:b.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:b.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:b.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:b.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:b.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:b.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:b.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:b.VARIABLE_DEFINITION,description:"Location adjacent to a variable definition."},SCHEMA:{value:b.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:b.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:b.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:b.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:b.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:b.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:b.UNION,description:"Location adjacent to a union definition."},ENUM:{value:b.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:b.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:b.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:b.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."}}}),Ee=new Te({name:"__Type",description:"The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",fields:()=>({kind:{type:new w(ji),resolve(e){if(fe(e))return V.SCALAR;if(F(e))return V.OBJECT;if($(e))return V.INTERFACE;if(H(e))return V.UNION;if(J(e))return V.ENUM;if(C(e))return V.INPUT_OBJECT;if(j(e))return V.LIST;if(S(e))return V.NON_NULL;Q(!1,`Unexpected type: "${T(e)}".`)}},name:{type:B,resolve:e=>"name"in e?e.name:void 0},description:{type:B,resolve:e=>"description"in e?e.description:void 0},specifiedByURL:{type:B,resolve:e=>"specifiedByURL"in e?e.specifiedByURL:void 0},fields:{type:new W(new w(Mi)),args:{includeDeprecated:{type:re,defaultValue:!1}},resolve(e,{includeDeprecated:n}){if(F(e)||$(e)){const t=Object.values(e.getFields());return n?t:t.filter(i=>i.deprecationReason==null)}}},interfaces:{type:new W(new w(Ee)),resolve(e){if(F(e)||$(e))return e.getInterfaces()}},possibleTypes:{type:new W(new w(Ee)),resolve(e,n,t,{schema:i}){if(_e(e))return i.getPossibleTypes(e)}},enumValues:{type:new W(new w(Ui)),args:{includeDeprecated:{type:re,defaultValue:!1}},resolve(e,{includeDeprecated:n}){if(J(e)){const t=e.getValues();return n?t:t.filter(i=>i.deprecationReason==null)}}},inputFields:{type:new W(new w(Gn)),args:{includeDeprecated:{type:re,defaultValue:!1}},resolve(e,{includeDeprecated:n}){if(C(e)){const t=Object.values(e.getFields());return n?t:t.filter(i=>i.deprecationReason==null)}}},ofType:{type:Ee,resolve:e=>"ofType"in e?e.ofType:void 0},isOneOf:{type:re,resolve:e=>{if(C(e))return e.isOneOf}}})}),Mi=new Te({name:"__Field",description:"Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",fields:()=>({name:{type:new w(B),resolve:e=>e.name},description:{type:B,resolve:e=>e.description},args:{type:new w(new W(new w(Gn))),args:{includeDeprecated:{type:re,defaultValue:!1}},resolve(e,{includeDeprecated:n}){return n?e.args:e.args.filter(t=>t.deprecationReason==null)}},type:{type:new w(Ee),resolve:e=>e.type},isDeprecated:{type:new w(re),resolve:e=>e.deprecationReason!=null},deprecationReason:{type:B,resolve:e=>e.deprecationReason}})}),Gn=new Te({name:"__InputValue",description:"Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",fields:()=>({name:{type:new w(B),resolve:e=>e.name},description:{type:B,resolve:e=>e.description},type:{type:new w(Ee),resolve:e=>e.type},defaultValue:{type:B,description:"A GraphQL-formatted string representing the default value for this input value.",resolve(e){const{type:n,defaultValue:t}=e,i=Ve(t,n);return i?U(i):null}},isDeprecated:{type:new w(re),resolve:e=>e.deprecationReason!=null},deprecationReason:{type:B,resolve:e=>e.deprecationReason}})}),Ui=new Te({name:"__EnumValue",description:"One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",fields:()=>({name:{type:new w(B),resolve:e=>e.name},description:{type:B,resolve:e=>e.description},isDeprecated:{type:new w(re),resolve:e=>e.deprecationReason!=null},deprecationReason:{type:B,resolve:e=>e.deprecationReason}})});var V;(function(e){e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.INPUT_OBJECT="INPUT_OBJECT",e.LIST="LIST",e.NON_NULL="NON_NULL"})(V||(V={}));const ji=new Me({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:V.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:V.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:V.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:V.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:V.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:V.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:V.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:V.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}}),Dn={name:"__schema",type:new w(yt),description:"Access the current type schema of this server.",args:[],resolve:(e,n,t,{schema:i})=>i,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},Sn={name:"__type",type:Ee,description:"Request the type information of a single type.",args:[{name:"name",description:void 0,type:new w(B),defaultValue:void 0,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0}],resolve:(e,{name:n},t,{schema:i})=>i.getType(n),deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},An={name:"__typename",type:new w(B),description:"The name of the current Object type at runtime.",args:[],resolve:(e,n,t,{parentType:i})=>i.name,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},Bn=Object.freeze([yt,xi,Ci,Ee,Mi,Gn,Ui,ji]);function ze(e){return Bn.some(({name:n})=>e.name===n)}function hs(e){return ye(e,mn)}function Pi(e){if(!hs(e))throw new Error(`Expected ${T(e)} to be a GraphQL schema.`);return e}class mn{constructor(n){var t,i;this.__validationErrors=n.assumeValid===!0?[]:void 0,oe(n)||A(!1,"Must provide configuration object."),!n.types||Array.isArray(n.types)||A(!1,`"types" must be Array if provided but got: ${T(n.types)}.`),!n.directives||Array.isArray(n.directives)||A(!1,`"directives" must be Array if provided but got: ${T(n.directives)}.`),this.description=n.description,this.extensions=ue(n.extensions),this.astNode=n.astNode,this.extensionASTNodes=(t=n.extensionASTNodes)!==null&&t!==void 0?t:[],this._queryType=n.query,this._mutationType=n.mutation,this._subscriptionType=n.subscription,this._directives=(i=n.directives)!==null&&i!==void 0?i:Pe;const r=new Set(n.types);if(n.types!=null)for(const s of n.types)r.delete(s),me(s,r);this._queryType!=null&&me(this._queryType,r),this._mutationType!=null&&me(this._mutationType,r),this._subscriptionType!=null&&me(this._subscriptionType,r);for(const s of this._directives)if(mt(s))for(const o of s.args)me(o.type,r);me(yt,r),this._typeMap=Object.create(null),this._subTypeMap=Object.create(null),this._implementationsMap=Object.create(null);for(const s of r){if(s==null)continue;const o=s.name;if(o||A(!1,"One of the provided types for building the Schema is missing a name."),this._typeMap[o]!==void 0)throw new Error(`Schema must contain uniquely named types but contains multiple types named "${o}".`);if(this._typeMap[o]=s,$(s)){for(const a of s.getInterfaces())if($(a)){let c=this._implementationsMap[a.name];c===void 0&&(c=this._implementationsMap[a.name]={objects:[],interfaces:[]}),c.interfaces.push(s)}}else if(F(s)){for(const a of s.getInterfaces())if($(a)){let c=this._implementationsMap[a.name];c===void 0&&(c=this._implementationsMap[a.name]={objects:[],interfaces:[]}),c.objects.push(s)}}}}get[Symbol.toStringTag](){return"GraphQLSchema"}getQueryType(){return this._queryType}getMutationType(){return this._mutationType}getSubscriptionType(){return this._subscriptionType}getRootType(n){switch(n){case z.QUERY:return this.getQueryType();case z.MUTATION:return this.getMutationType();case z.SUBSCRIPTION:return this.getSubscriptionType()}}getTypeMap(){return this._typeMap}getType(n){return this.getTypeMap()[n]}getPossibleTypes(n){return H(n)?n.getTypes():this.getImplementations(n).objects}getImplementations(n){const t=this._implementationsMap[n.name];return t??{objects:[],interfaces:[]}}isSubType(n,t){let i=this._subTypeMap[n.name];if(i===void 0){if(i=Object.create(null),H(n))for(const r of n.getTypes())i[r.name]=!0;else{const r=this.getImplementations(n);for(const s of r.objects)i[s.name]=!0;for(const s of r.interfaces)i[s.name]=!0}this._subTypeMap[n.name]=i}return i[t.name]!==void 0}getDirectives(){return this._directives}getDirective(n){return this.getDirectives().find(t=>t.name===n)}toConfig(){return{description:this.description,query:this.getQueryType(),mutation:this.getMutationType(),subscription:this.getSubscriptionType(),types:Object.values(this.getTypeMap()),directives:this.getDirectives(),extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,assumeValid:this.__validationErrors!==void 0}}}function me(e,n){const t=ee(e);if(!n.has(t)){if(n.add(t),H(t))for(const i of t.getTypes())me(i,n);else if(F(t)||$(t)){for(const i of t.getInterfaces())me(i,n);for(const i of Object.values(t.getFields())){me(i.type,n);for(const r of i.args)me(r.type,n)}}else if(C(t))for(const i of Object.values(t.getFields()))me(i.type,n)}return n}function Gi(e){if(Pi(e),e.__validationErrors)return e.__validationErrors;const n=new ms(e);Es(n),Ts(n),ys(n);const t=n.getErrors();return e.__validationErrors=t,t}function Bi(e){const n=Gi(e);if(n.length!==0)throw new Error(n.map(t=>t.message).join(` - -`))}class ms{constructor(n){this._errors=[],this.schema=n}reportError(n,t){const i=Array.isArray(t)?t.filter(Boolean):t;this._errors.push(new h(n,{nodes:i}))}getErrors(){return this._errors}}function Es(e){const n=e.schema,t=n.getQueryType();if(!t)e.reportError("Query root type must be provided.",n.astNode);else if(!F(t)){var i;e.reportError(`Query root type must be Object type, it cannot be ${T(t)}.`,(i=Wn(n,z.QUERY))!==null&&i!==void 0?i:t.astNode)}const r=n.getMutationType();if(r&&!F(r)){var s;e.reportError(`Mutation root type must be Object type if provided, it cannot be ${T(r)}.`,(s=Wn(n,z.MUTATION))!==null&&s!==void 0?s:r.astNode)}const o=n.getSubscriptionType();if(o&&!F(o)){var a;e.reportError(`Subscription root type must be Object type if provided, it cannot be ${T(o)}.`,(a=Wn(n,z.SUBSCRIPTION))!==null&&a!==void 0?a:o.astNode)}}function Wn(e,n){var t;return(t=[e.astNode,...e.extensionASTNodes].flatMap(i=>{var r;return(r=i==null?void 0:i.operationTypes)!==null&&r!==void 0?r:[]}).find(i=>i.operation===n))===null||t===void 0?void 0:t.type}function Ts(e){for(const t of e.schema.getDirectives()){if(!mt(t)){e.reportError(`Expected directive but got: ${T(t)}.`,t==null?void 0:t.astNode);continue}Ue(e,t);for(const i of t.args)if(Ue(e,i),ie(i.type)||e.reportError(`The type of @${t.name}(${i.name}:) must be Input Type but got: ${T(i.type)}.`,i.astNode),je(i)&&i.deprecationReason!=null){var n;e.reportError(`Required argument @${t.name}(${i.name}:) cannot be deprecated.`,[vt(i.astNode),(n=i.astNode)===null||n===void 0?void 0:n.type])}}}function Ue(e,n){n.name.startsWith("__")&&e.reportError(`Name "${n.name}" must not begin with "__", which is reserved by GraphQL introspection.`,n.astNode)}function ys(e){const n=bs(e),t=e.schema.getTypeMap();for(const i of Object.values(t)){if(!jn(i)){e.reportError(`Expected GraphQL named type but got: ${T(i)}.`,i.astNode);continue}ze(i)||Ue(e,i),F(i)||$(i)?(Pt(e,i),Gt(e,i)):H(i)?gs(e,i):J(i)?Is(e,i):C(i)&&(_s(e,i),n(i))}}function Pt(e,n){const t=Object.values(n.getFields());t.length===0&&e.reportError(`Type ${n.name} must define one or more fields.`,[n.astNode,...n.extensionASTNodes]);for(const o of t){if(Ue(e,o),!xe(o.type)){var i;e.reportError(`The type of ${n.name}.${o.name} must be Output Type but got: ${T(o.type)}.`,(i=o.astNode)===null||i===void 0?void 0:i.type)}for(const a of o.args){const c=a.name;if(Ue(e,a),!ie(a.type)){var r;e.reportError(`The type of ${n.name}.${o.name}(${c}:) must be Input Type but got: ${T(a.type)}.`,(r=a.astNode)===null||r===void 0?void 0:r.type)}if(je(a)&&a.deprecationReason!=null){var s;e.reportError(`Required argument ${n.name}.${o.name}(${c}:) cannot be deprecated.`,[vt(a.astNode),(s=a.astNode)===null||s===void 0?void 0:s.type])}}}}function Gt(e,n){const t=Object.create(null);for(const i of n.getInterfaces()){if(!$(i)){e.reportError(`Type ${T(n)} must only implement Interface types, it cannot implement ${T(i)}.`,nn(n,i));continue}if(n===i){e.reportError(`Type ${n.name} cannot implement itself because it would create a circular reference.`,nn(n,i));continue}if(t[i.name]){e.reportError(`Type ${n.name} can only implement ${i.name} once.`,nn(n,i));continue}t[i.name]=!0,Ns(e,n,i),vs(e,n,i)}}function vs(e,n,t){const i=n.getFields();for(const c of Object.values(t.getFields())){const l=c.name,f=i[l];if(!f){e.reportError(`Interface field ${t.name}.${l} expected but ${n.name} does not provide it.`,[c.astNode,n.astNode,...n.extensionASTNodes]);continue}if(!qe(e.schema,f.type,c.type)){var r,s;e.reportError(`Interface field ${t.name}.${l} expects type ${T(c.type)} but ${n.name}.${l} is type ${T(f.type)}.`,[(r=c.astNode)===null||r===void 0?void 0:r.type,(s=f.astNode)===null||s===void 0?void 0:s.type])}for(const d of c.args){const p=d.name,y=f.args.find(N=>N.name===p);if(!y){e.reportError(`Interface field argument ${t.name}.${l}(${p}:) expected but ${n.name}.${l} does not provide it.`,[d.astNode,f.astNode]);continue}if(!st(d.type,y.type)){var o,a;e.reportError(`Interface field argument ${t.name}.${l}(${p}:) expects type ${T(d.type)} but ${n.name}.${l}(${p}:) is type ${T(y.type)}.`,[(o=d.astNode)===null||o===void 0?void 0:o.type,(a=y.astNode)===null||a===void 0?void 0:a.type])}}for(const d of f.args){const p=d.name;!c.args.find(N=>N.name===p)&&je(d)&&e.reportError(`Object field ${n.name}.${l} includes required argument ${p} that is missing from the Interface field ${t.name}.${l}.`,[d.astNode,c.astNode])}}}function Ns(e,n,t){const i=n.getInterfaces();for(const r of t.getInterfaces())i.includes(r)||e.reportError(r===n?`Type ${n.name} cannot implement ${t.name} because it would create a circular reference.`:`Type ${n.name} must implement ${r.name} because it is implemented by ${t.name}.`,[...nn(t,r),...nn(n,t)])}function gs(e,n){const t=n.getTypes();t.length===0&&e.reportError(`Union type ${n.name} must define one or more member types.`,[n.astNode,...n.extensionASTNodes]);const i=Object.create(null);for(const r of t){if(i[r.name]){e.reportError(`Union type ${n.name} can only include type ${r.name} once.`,Bt(n,r.name));continue}i[r.name]=!0,F(r)||e.reportError(`Union type ${n.name} can only include Object types, it cannot include ${T(r)}.`,Bt(n,String(r)))}}function Is(e,n){const t=n.getValues();t.length===0&&e.reportError(`Enum type ${n.name} must define one or more values.`,[n.astNode,...n.extensionASTNodes]);for(const i of t)Ue(e,i)}function _s(e,n){const t=Object.values(n.getFields());t.length===0&&e.reportError(`Input Object type ${n.name} must define one or more fields.`,[n.astNode,...n.extensionASTNodes]);for(const s of t){if(Ue(e,s),!ie(s.type)){var i;e.reportError(`The type of ${n.name}.${s.name} must be Input Type but got: ${T(s.type)}.`,(i=s.astNode)===null||i===void 0?void 0:i.type)}if(pt(s)&&s.deprecationReason!=null){var r;e.reportError(`Required input field ${n.name}.${s.name} cannot be deprecated.`,[vt(s.astNode),(r=s.astNode)===null||r===void 0?void 0:r.type])}n.isOneOf&&Os(n,s,e)}}function Os(e,n,t){if(S(n.type)){var i;t.reportError(`OneOf input field ${e.name}.${n.name} must be nullable.`,(i=n.astNode)===null||i===void 0?void 0:i.type)}n.defaultValue!==void 0&&t.reportError(`OneOf input field ${e.name}.${n.name} cannot have a default value.`,n.astNode)}function bs(e){const n=Object.create(null),t=[],i=Object.create(null);return r;function r(s){if(n[s.name])return;n[s.name]=!0,i[s.name]=t.length;const o=Object.values(s.getFields());for(const a of o)if(S(a.type)&&C(a.type.ofType)){const c=a.type.ofType,l=i[c.name];if(t.push(a),l===void 0)r(c);else{const f=t.slice(l),d=f.map(p=>p.name).join(".");e.reportError(`Cannot reference Input Object "${c.name}" within itself through a series of non-null fields: "${d}".`,f.map(p=>p.astNode))}t.pop()}i[s.name]=void 0}}function nn(e,n){const{astNode:t,extensionASTNodes:i}=e;return(t!=null?[t,...i]:i).flatMap(s=>{var o;return(o=s.interfaces)!==null&&o!==void 0?o:[]}).filter(s=>s.name.value===n.name)}function Bt(e,n){const{astNode:t,extensionASTNodes:i}=e;return(t!=null?[t,...i]:i).flatMap(s=>{var o;return(o=s.types)!==null&&o!==void 0?o:[]}).filter(s=>s.name.value===n)}function vt(e){var n;return e==null||(n=e.directives)===null||n===void 0?void 0:n.find(t=>t.name.value===Et.name)}function ae(e,n){switch(n.kind){case u.LIST_TYPE:{const t=ae(e,n.type);return t&&new W(t)}case u.NON_NULL_TYPE:{const t=ae(e,n.type);return t&&new w(t)}case u.NAMED_TYPE:return e.getType(n.name.value)}}class Qi{constructor(n,t,i){this._schema=n,this._typeStack=[],this._parentTypeStack=[],this._inputTypeStack=[],this._fieldDefStack=[],this._defaultValueStack=[],this._directive=null,this._argument=null,this._enumValue=null,this._getFieldDef=i??Ds,t&&(ie(t)&&this._inputTypeStack.push(t),Se(t)&&this._parentTypeStack.push(t),xe(t)&&this._typeStack.push(t))}get[Symbol.toStringTag](){return"TypeInfo"}getType(){if(this._typeStack.length>0)return this._typeStack[this._typeStack.length-1]}getParentType(){if(this._parentTypeStack.length>0)return this._parentTypeStack[this._parentTypeStack.length-1]}getInputType(){if(this._inputTypeStack.length>0)return this._inputTypeStack[this._inputTypeStack.length-1]}getParentInputType(){if(this._inputTypeStack.length>1)return this._inputTypeStack[this._inputTypeStack.length-2]}getFieldDef(){if(this._fieldDefStack.length>0)return this._fieldDefStack[this._fieldDefStack.length-1]}getDefaultValue(){if(this._defaultValueStack.length>0)return this._defaultValueStack[this._defaultValueStack.length-1]}getDirective(){return this._directive}getArgument(){return this._argument}getEnumValue(){return this._enumValue}enter(n){const t=this._schema;switch(n.kind){case u.SELECTION_SET:{const r=ee(this.getType());this._parentTypeStack.push(Se(r)?r:void 0);break}case u.FIELD:{const r=this.getParentType();let s,o;r&&(s=this._getFieldDef(t,r,n),s&&(o=s.type)),this._fieldDefStack.push(s),this._typeStack.push(xe(o)?o:void 0);break}case u.DIRECTIVE:this._directive=t.getDirective(n.name.value);break;case u.OPERATION_DEFINITION:{const r=t.getRootType(n.operation);this._typeStack.push(F(r)?r:void 0);break}case u.INLINE_FRAGMENT:case u.FRAGMENT_DEFINITION:{const r=n.typeCondition,s=r?ae(t,r):ee(this.getType());this._typeStack.push(xe(s)?s:void 0);break}case u.VARIABLE_DEFINITION:{const r=ae(t,n.type);this._inputTypeStack.push(ie(r)?r:void 0);break}case u.ARGUMENT:{var i;let r,s;const o=(i=this.getDirective())!==null&&i!==void 0?i:this.getFieldDef();o&&(r=o.args.find(a=>a.name===n.name.value),r&&(s=r.type)),this._argument=r,this._defaultValueStack.push(r?r.defaultValue:void 0),this._inputTypeStack.push(ie(s)?s:void 0);break}case u.LIST:{const r=gi(this.getInputType()),s=j(r)?r.ofType:r;this._defaultValueStack.push(void 0),this._inputTypeStack.push(ie(s)?s:void 0);break}case u.OBJECT_FIELD:{const r=ee(this.getInputType());let s,o;C(r)&&(o=r.getFields()[n.name.value],o&&(s=o.type)),this._defaultValueStack.push(o?o.defaultValue:void 0),this._inputTypeStack.push(ie(s)?s:void 0);break}case u.ENUM:{const r=ee(this.getInputType());let s;J(r)&&(s=r.getValue(n.value)),this._enumValue=s;break}}}leave(n){switch(n.kind){case u.SELECTION_SET:this._parentTypeStack.pop();break;case u.FIELD:this._fieldDefStack.pop(),this._typeStack.pop();break;case u.DIRECTIVE:this._directive=null;break;case u.OPERATION_DEFINITION:case u.INLINE_FRAGMENT:case u.FRAGMENT_DEFINITION:this._typeStack.pop();break;case u.VARIABLE_DEFINITION:this._inputTypeStack.pop();break;case u.ARGUMENT:this._argument=null,this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case u.LIST:case u.OBJECT_FIELD:this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case u.ENUM:this._enumValue=null;break}}}function Ds(e,n,t){const i=t.name.value;if(i===Dn.name&&e.getQueryType()===n)return Dn;if(i===Sn.name&&e.getQueryType()===n)return Sn;if(i===An.name&&Se(n))return An;if(F(n)||$(n))return n.getFields()[i]}function Yi(e,n){return{enter(...t){const i=t[0];e.enter(i);const r=sn(n,i.kind).enter;if(r){const s=r.apply(n,t);return s!==void 0&&(e.leave(i),nt(s)&&e.enter(s)),s}},leave(...t){const i=t[0],r=sn(n,i.kind).leave;let s;return r&&(s=r.apply(n,t)),e.leave(i),s}}}function Ja(e){return qi(e)||Ji(e)||Xi(e)}function qi(e){return e.kind===u.OPERATION_DEFINITION||e.kind===u.FRAGMENT_DEFINITION}function Xa(e){return e.kind===u.FIELD||e.kind===u.FRAGMENT_SPREAD||e.kind===u.INLINE_FRAGMENT}function Ss(e){return e.kind===u.VARIABLE||e.kind===u.INT||e.kind===u.FLOAT||e.kind===u.STRING||e.kind===u.BOOLEAN||e.kind===u.NULL||e.kind===u.ENUM||e.kind===u.LIST||e.kind===u.OBJECT}function Qt(e){return Ss(e)&&(e.kind===u.LIST?e.values.some(Qt):e.kind===u.OBJECT?e.fields.some(n=>Qt(n.value)):e.kind!==u.VARIABLE)}function za(e){return e.kind===u.NAMED_TYPE||e.kind===u.LIST_TYPE||e.kind===u.NON_NULL_TYPE}function Ji(e){return e.kind===u.SCHEMA_DEFINITION||En(e)||e.kind===u.DIRECTIVE_DEFINITION}function En(e){return e.kind===u.SCALAR_TYPE_DEFINITION||e.kind===u.OBJECT_TYPE_DEFINITION||e.kind===u.INTERFACE_TYPE_DEFINITION||e.kind===u.UNION_TYPE_DEFINITION||e.kind===u.ENUM_TYPE_DEFINITION||e.kind===u.INPUT_OBJECT_TYPE_DEFINITION}function Xi(e){return e.kind===u.SCHEMA_EXTENSION||Nt(e)}function Nt(e){return e.kind===u.SCALAR_TYPE_EXTENSION||e.kind===u.OBJECT_TYPE_EXTENSION||e.kind===u.INTERFACE_TYPE_EXTENSION||e.kind===u.UNION_TYPE_EXTENSION||e.kind===u.ENUM_TYPE_EXTENSION||e.kind===u.INPUT_OBJECT_TYPE_EXTENSION}function As(e){return{Document(n){for(const t of n.definitions)if(!qi(t)){const i=t.kind===u.SCHEMA_DEFINITION||t.kind===u.SCHEMA_EXTENSION?"schema":'"'+t.name.value+'"';e.reportError(new h(`The ${i} definition is not executable.`,{nodes:t}))}return!1}}}function ws(e){return{Field(n){const t=e.getParentType();if(t&&!e.getFieldDef()){const r=e.getSchema(),s=n.name.value;let o=Oe("to use an inline fragment on",Rs(r,t,s));o===""&&(o=Oe(Ls(t,s))),e.reportError(new h(`Cannot query field "${s}" on type "${t.name}".`+o,{nodes:n}))}}}}function Rs(e,n,t){if(!_e(n))return[];const i=new Set,r=Object.create(null);for(const o of e.getPossibleTypes(n))if(o.getFields()[t]){i.add(o),r[o.name]=1;for(const a of o.getInterfaces()){var s;a.getFields()[t]&&(i.add(a),r[a.name]=((s=r[a.name])!==null&&s!==void 0?s:0)+1)}}return[...i].sort((o,a)=>{const c=r[a.name]-r[o.name];return c!==0?c:$(o)&&e.isSubType(o,a)?-1:$(a)&&e.isSubType(a,o)?1:dn(o.name,a.name)}).map(o=>o.name)}function Ls(e,n){if(F(e)||$(e)){const t=Object.keys(e.getFields());return Fe(n,t)}return[]}function Fs(e){return{InlineFragment(n){const t=n.typeCondition;if(t){const i=ae(e.getSchema(),t);if(i&&!Se(i)){const r=U(t);e.reportError(new h(`Fragment cannot condition on non composite type "${r}".`,{nodes:t}))}}},FragmentDefinition(n){const t=ae(e.getSchema(),n.typeCondition);if(t&&!Se(t)){const i=U(n.typeCondition);e.reportError(new h(`Fragment "${n.name.value}" cannot condition on non composite type "${i}".`,{nodes:n.typeCondition}))}}}}function ks(e){return{...zi(e),Argument(n){const t=e.getArgument(),i=e.getFieldDef(),r=e.getParentType();if(!t&&i&&r){const s=n.name.value,o=i.args.map(c=>c.name),a=Fe(s,o);e.reportError(new h(`Unknown argument "${s}" on field "${r.name}.${i.name}".`+Oe(a),{nodes:n}))}}}}function zi(e){const n=Object.create(null),t=e.getSchema(),i=t?t.getDirectives():Pe;for(const o of i)n[o.name]=o.args.map(a=>a.name);const r=e.getDocument().definitions;for(const o of r)if(o.kind===u.DIRECTIVE_DEFINITION){var s;const a=(s=o.arguments)!==null&&s!==void 0?s:[];n[o.name.value]=a.map(c=>c.name.value)}return{Directive(o){const a=o.name.value,c=n[a];if(o.arguments&&c)for(const l of o.arguments){const f=l.name.value;if(!c.includes(f)){const d=Fe(f,c);e.reportError(new h(`Unknown argument "${f}" on directive "@${a}".`+Oe(d),{nodes:l}))}}return!1}}}function Hi(e){const n=Object.create(null),t=e.getSchema(),i=t?t.getDirectives():Pe;for(const s of i)n[s.name]=s.locations;const r=e.getDocument().definitions;for(const s of r)s.kind===u.DIRECTIVE_DEFINITION&&(n[s.name.value]=s.locations.map(o=>o.value));return{Directive(s,o,a,c,l){const f=s.name.value,d=n[f];if(!d){e.reportError(new h(`Unknown directive "@${f}".`,{nodes:s}));return}const p=$s(l);p&&!d.includes(p)&&e.reportError(new h(`Directive "@${f}" may not be used on ${p}.`,{nodes:s}))}}}function $s(e){const n=e[e.length-1];switch("kind"in n||Q(!1),n.kind){case u.OPERATION_DEFINITION:return Vs(n.operation);case u.FIELD:return b.FIELD;case u.FRAGMENT_SPREAD:return b.FRAGMENT_SPREAD;case u.INLINE_FRAGMENT:return b.INLINE_FRAGMENT;case u.FRAGMENT_DEFINITION:return b.FRAGMENT_DEFINITION;case u.VARIABLE_DEFINITION:return b.VARIABLE_DEFINITION;case u.SCHEMA_DEFINITION:case u.SCHEMA_EXTENSION:return b.SCHEMA;case u.SCALAR_TYPE_DEFINITION:case u.SCALAR_TYPE_EXTENSION:return b.SCALAR;case u.OBJECT_TYPE_DEFINITION:case u.OBJECT_TYPE_EXTENSION:return b.OBJECT;case u.FIELD_DEFINITION:return b.FIELD_DEFINITION;case u.INTERFACE_TYPE_DEFINITION:case u.INTERFACE_TYPE_EXTENSION:return b.INTERFACE;case u.UNION_TYPE_DEFINITION:case u.UNION_TYPE_EXTENSION:return b.UNION;case u.ENUM_TYPE_DEFINITION:case u.ENUM_TYPE_EXTENSION:return b.ENUM;case u.ENUM_VALUE_DEFINITION:return b.ENUM_VALUE;case u.INPUT_OBJECT_TYPE_DEFINITION:case u.INPUT_OBJECT_TYPE_EXTENSION:return b.INPUT_OBJECT;case u.INPUT_VALUE_DEFINITION:{const t=e[e.length-3];return"kind"in t||Q(!1),t.kind===u.INPUT_OBJECT_TYPE_DEFINITION?b.INPUT_FIELD_DEFINITION:b.ARGUMENT_DEFINITION}default:Q(!1,"Unexpected kind: "+T(n.kind))}}function Vs(e){switch(e){case z.QUERY:return b.QUERY;case z.MUTATION:return b.MUTATION;case z.SUBSCRIPTION:return b.SUBSCRIPTION}}function xs(e){return{FragmentSpread(n){const t=n.name.value;e.getFragment(t)||e.reportError(new h(`Unknown fragment "${t}".`,{nodes:n.name}))}}}function Wi(e){const n=e.getSchema(),t=n?n.getTypeMap():Object.create(null),i=Object.create(null);for(const s of e.getDocument().definitions)En(s)&&(i[s.name.value]=!0);const r=[...Object.keys(t),...Object.keys(i)];return{NamedType(s,o,a,c,l){const f=s.name.value;if(!t[f]&&!i[f]){var d;const p=(d=l[2])!==null&&d!==void 0?d:a,y=p!=null&&Cs(p);if(y&&Yt.includes(f))return;const N=Fe(f,y?Yt.concat(r):r);e.reportError(new h(`Unknown type "${f}".`+Oe(N),{nodes:s}))}}}}const Yt=[...Pn,...Bn].map(e=>e.name);function Cs(e){return"kind"in e&&(Ji(e)||Xi(e))}function Ms(e){let n=0;return{Document(t){n=t.definitions.filter(i=>i.kind===u.OPERATION_DEFINITION).length},OperationDefinition(t){!t.name&&n>1&&e.reportError(new h("This anonymous operation must be the only defined operation.",{nodes:t}))}}}function Us(e){var n,t,i;const r=e.getSchema(),s=(n=(t=(i=r==null?void 0:r.astNode)!==null&&i!==void 0?i:r==null?void 0:r.getQueryType())!==null&&t!==void 0?t:r==null?void 0:r.getMutationType())!==null&&n!==void 0?n:r==null?void 0:r.getSubscriptionType();let o=0;return{SchemaDefinition(a){if(s){e.reportError(new h("Cannot define a new schema within a schema extension.",{nodes:a}));return}o>0&&e.reportError(new h("Must provide only one schema definition.",{nodes:a})),++o}}}const js=3;function Ps(e){function n(t,i=Object.create(null),r=0){if(t.kind===u.FRAGMENT_SPREAD){const s=t.name.value;if(i[s]===!0)return!1;const o=e.getFragment(s);if(!o)return!1;try{return i[s]=!0,n(o,i,r)}finally{i[s]=void 0}}if(t.kind===u.FIELD&&(t.name.value==="fields"||t.name.value==="interfaces"||t.name.value==="possibleTypes"||t.name.value==="inputFields")&&(r++,r>=js))return!0;if("selectionSet"in t&&t.selectionSet){for(const s of t.selectionSet.selections)if(n(s,i,r))return!0}return!1}return{Field(t){if((t.name.value==="__schema"||t.name.value==="__type")&&n(t))return e.reportError(new h("Maximum introspection depth exceeded",{nodes:[t]})),!1}}}function Gs(e){const n=Object.create(null),t=[],i=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition(s){return r(s),!1}};function r(s){if(n[s.name.value])return;const o=s.name.value;n[o]=!0;const a=e.getFragmentSpreads(s.selectionSet);if(a.length!==0){i[o]=t.length;for(const c of a){const l=c.name.value,f=i[l];if(t.push(c),f===void 0){const d=e.getFragment(l);d&&r(d)}else{const d=t.slice(f),p=d.slice(0,-1).map(y=>'"'+y.name.value+'"').join(", ");e.reportError(new h(`Cannot spread fragment "${l}" within itself`+(p!==""?` via ${p}.`:"."),{nodes:d}))}t.pop()}i[o]=void 0}}}function Bs(e){let n=Object.create(null);return{OperationDefinition:{enter(){n=Object.create(null)},leave(t){const i=e.getRecursiveVariableUsages(t);for(const{node:r}of i){const s=r.name.value;n[s]!==!0&&e.reportError(new h(t.name?`Variable "$${s}" is not defined by operation "${t.name.value}".`:`Variable "$${s}" is not defined.`,{nodes:[r,t]}))}}},VariableDefinition(t){n[t.variable.name.value]=!0}}}function Qs(e){const n=[],t=[];return{OperationDefinition(i){return n.push(i),!1},FragmentDefinition(i){return t.push(i),!1},Document:{leave(){const i=Object.create(null);for(const r of n)for(const s of e.getRecursivelyReferencedFragments(r))i[s.name.value]=!0;for(const r of t){const s=r.name.value;i[s]!==!0&&e.reportError(new h(`Fragment "${s}" is never used.`,{nodes:r}))}}}}}function Ys(e){let n=[];return{OperationDefinition:{enter(){n=[]},leave(t){const i=Object.create(null),r=e.getRecursiveVariableUsages(t);for(const{node:s}of r)i[s.name.value]=!0;for(const s of n){const o=s.variable.name.value;i[o]!==!0&&e.reportError(new h(t.name?`Variable "$${o}" is never used in operation "${t.name.value}".`:`Variable "$${o}" is never used.`,{nodes:s}))}}},VariableDefinition(t){n.push(t)}}}function Qn(e){switch(e.kind){case u.OBJECT:return{...e,fields:qs(e.fields)};case u.LIST:return{...e,values:e.values.map(Qn)};case u.INT:case u.FLOAT:case u.STRING:case u.BOOLEAN:case u.NULL:case u.ENUM:case u.VARIABLE:return e}}function qs(e){return e.map(n=>({...n,value:Qn(n.value)})).sort((n,t)=>dn(n.name.value,t.name.value))}function Ki(e){return Array.isArray(e)?e.map(([n,t])=>`subfields "${n}" conflict because `+Ki(t)).join(" and "):e}function Js(e){const n=new Zs,t=new Map;return{SelectionSet(i){const r=Xs(e,t,n,e.getParentType(),i);for(const[[s,o],a,c]of r){const l=Ki(o);e.reportError(new h(`Fields "${s}" conflict because ${l}. Use different aliases on the fields to fetch both if this was intentional.`,{nodes:a.concat(c)}))}}}}function Xs(e,n,t,i,r){const s=[],[o,a]=Ln(e,n,i,r);if(Hs(e,s,n,t,o),a.length!==0)for(let c=0;c1)for(let a=0;a[s.value,o]));return t.every(s=>{const o=s.value,a=r.get(s.name.value);return a===void 0?!1:qt(o)===qt(a)})}function qt(e){return U(Qn(e))}function ot(e,n){return j(e)?j(n)?ot(e.ofType,n.ofType):!0:j(n)?!0:S(e)?S(n)?ot(e.ofType,n.ofType):!0:S(n)?!0:De(e)||De(n)?e!==n:!1}function Ln(e,n,t,i){const r=n.get(i);if(r)return r;const s=Object.create(null),o=Object.create(null);er(e,t,i,s,o);const a=[s,Object.keys(o)];return n.set(i,a),a}function at(e,n,t){const i=n.get(t.selectionSet);if(i)return i;const r=ae(e.getSchema(),t.typeCondition);return Ln(e,n,r,t.selectionSet)}function er(e,n,t,i,r){for(const s of t.selections)switch(s.kind){case u.FIELD:{const o=s.name.value;let a;(F(n)||$(n))&&(a=n.getFields()[o]);const c=s.alias?s.alias.value:o;i[c]||(i[c]=[]),i[c].push([n,s,a]);break}case u.FRAGMENT_SPREAD:r[s.name.value]=!0;break;case u.INLINE_FRAGMENT:{const o=s.typeCondition,a=o?ae(e.getSchema(),o):n;er(e,a,s.selectionSet,i,r);break}}}function Ks(e,n,t,i){if(e.length>0)return[[n,e.map(([r])=>r)],[t,...e.map(([,r])=>r).flat()],[i,...e.map(([,,r])=>r).flat()]]}class Zs{constructor(){this._data=new Map}has(n,t,i){var r;const[s,o]=ns.name.value));for(const s of i.args)if(!r.has(s.name)&&je(s)){const o=T(s.type);e.reportError(new h(`Field "${i.name}" argument "${s.name}" of type "${o}" is required, but it was not provided.`,{nodes:n}))}}}}}function nr(e){var n;const t=Object.create(null),i=e.getSchema(),r=(n=i==null?void 0:i.getDirectives())!==null&&n!==void 0?n:Pe;for(const a of r)t[a.name]=be(a.args.filter(je),c=>c.name);const s=e.getDocument().definitions;for(const a of s)if(a.kind===u.DIRECTIVE_DEFINITION){var o;const c=(o=a.arguments)!==null&&o!==void 0?o:[];t[a.name.value]=be(c.filter(ao),l=>l.name.value)}return{Directive:{leave(a){const c=a.name.value,l=t[c];if(l){var f;const d=(f=a.arguments)!==null&&f!==void 0?f:[],p=new Set(d.map(y=>y.name.value));for(const[y,N]of Object.entries(l))if(!p.has(y)){const L=Mn(N.type)?T(N.type):U(N.type);e.reportError(new h(`Directive "@${c}" argument "${y}" of type "${L}" is required, but it was not provided.`,{nodes:a}))}}}}}}function ao(e){return e.type.kind===u.NON_NULL_TYPE&&e.defaultValue==null}function co(e){return{Field(n){const t=e.getType(),i=n.selectionSet;if(t){if(De(ee(t))){if(i){const r=n.name.value,s=T(t);e.reportError(new h(`Field "${r}" must not have a selection since type "${s}" has no subfields.`,{nodes:i}))}}else if(!i){const r=n.name.value,s=T(t);e.reportError(new h(`Field "${r}" of type "${s}" must have a selection of subfields. Did you mean "${r} { ... }"?`,{nodes:n}))}}}}}function tr(e){return e.map(n=>typeof n=="number"?"["+n.toString()+"]":"."+n).join("")}function Je(e,n,t){return{prev:e,key:n,typename:t}}function Z(e){const n=[];let t=e;for(;t;)n.push(t.key),t=t.prev;return n.reverse()}function uo(e,n,t=lo){return Ze(e,n,t,void 0)}function lo(e,n,t){let i="Invalid value "+T(n);throw e.length>0&&(i+=` at "value${tr(e)}"`),t.message=i+": "+t.message,t}function Ze(e,n,t,i){if(S(n)){if(e!=null)return Ze(e,n.ofType,t,i);t(Z(i),e,new h(`Expected non-nullable type "${T(n)}" not to be null.`));return}if(e==null)return null;if(j(n)){const r=n.ofType;return Tt(e)?Array.from(e,(s,o)=>{const a=Je(i,o,void 0);return Ze(s,r,t,a)}):[Ze(e,r,t,i)]}if(C(n)){if(!oe(e)){t(Z(i),e,new h(`Expected type "${n.name}" to be an object.`));return}const r={},s=n.getFields();for(const o of Object.values(s)){const a=e[o.name];if(a===void 0){if(o.defaultValue!==void 0)r[o.name]=o.defaultValue;else if(S(o.type)){const c=T(o.type);t(Z(i),e,new h(`Field "${o.name}" of required type "${c}" was not provided.`))}continue}r[o.name]=Ze(a,o.type,t,Je(i,o.name,n.name))}for(const o of Object.keys(e))if(!s[o]){const a=Fe(o,Object.keys(n.getFields()));t(Z(i),e,new h(`Field "${o}" is not defined by type "${n.name}".`+Oe(a)))}if(n.isOneOf){const o=Object.keys(r);o.length!==1&&t(Z(i),e,new h(`Exactly one key must be specified for OneOf type "${n.name}".`));const a=o[0],c=r[a];c===null&&t(Z(i).concat(a),c,new h(`Field "${a}" must be non-null.`))}return r}if(De(n)){let r;try{r=n.parseValue(e)}catch(s){s instanceof h?t(Z(i),e,s):t(Z(i),e,new h(`Expected type "${n.name}". `+s.message,{originalError:s}));return}return r===void 0&&t(Z(i),e,new h(`Expected type "${n.name}".`)),r}Q(!1,"Unexpected input type: "+T(n))}function Ie(e,n,t){if(e){if(e.kind===u.VARIABLE){const i=e.name.value;if(t==null||t[i]===void 0)return;const r=t[i];return r===null&&S(n)?void 0:r}if(S(n))return e.kind===u.NULL?void 0:Ie(e,n.ofType,t);if(e.kind===u.NULL)return null;if(j(n)){const i=n.ofType;if(e.kind===u.LIST){const s=[];for(const o of e.values)if(Jt(o,t)){if(S(i))return;s.push(null)}else{const a=Ie(o,i,t);if(a===void 0)return;s.push(a)}return s}const r=Ie(e,i,t);return r===void 0?void 0:[r]}if(C(n)){if(e.kind!==u.OBJECT)return;const i=Object.create(null),r=be(e.fields,s=>s.name.value);for(const s of Object.values(n.getFields())){const o=r[s.name];if(!o||Jt(o.value,t)){if(s.defaultValue!==void 0)i[s.name]=s.defaultValue;else if(S(s.type))return;continue}const a=Ie(o.value,s.type,t);if(a===void 0)return;i[s.name]=a}if(n.isOneOf){const s=Object.keys(i);if(s.length!==1||i[s[0]]===null)return}return i}if(De(n)){let i;try{i=n.parseLiteral(e,t)}catch{return}return i===void 0?void 0:i}Q(!1,"Unexpected input type: "+T(n))}}function Jt(e,n){return e.kind===u.VARIABLE&&(n==null||n[e.name.value]===void 0)}function fo(e,n,t,i){const r=[],s=i==null?void 0:i.maxErrors;try{const o=po(e,n,t,a=>{if(s!=null&&r.length>=s)throw new h("Too many errors processing variables, error limit reached. Execution aborted.");r.push(a)});if(r.length===0)return{coerced:o}}catch(o){r.push(o)}return{errors:r}}function po(e,n,t,i){const r={};for(const s of n){const o=s.variable.name.value,a=ae(e,s.type);if(!ie(a)){const l=U(s.type);i(new h(`Variable "$${o}" expected value of type "${l}" which cannot be used as an input type.`,{nodes:s.type}));continue}if(!ir(t,o)){if(s.defaultValue)r[o]=Ie(s.defaultValue,a);else if(S(a)){const l=T(a);i(new h(`Variable "$${o}" of required type "${l}" was not provided.`,{nodes:s}))}continue}const c=t[o];if(c===null&&S(a)){const l=T(a);i(new h(`Variable "$${o}" of non-null type "${l}" must not be null.`,{nodes:s}));continue}r[o]=uo(c,a,(l,f,d)=>{let p=`Variable "$${o}" got invalid value `+T(f);l.length>0&&(p+=` at "${o}${tr(l)}"`),i(new h(p+"; "+d.message,{nodes:s,originalError:d}))})}return r}function It(e,n,t){var i;const r={},s=(i=n.arguments)!==null&&i!==void 0?i:[],o=be(s,a=>a.name.value);for(const a of e.args){const c=a.name,l=a.type,f=o[c];if(!f){if(a.defaultValue!==void 0)r[c]=a.defaultValue;else if(S(l))throw new h(`Argument "${c}" of required type "${T(l)}" was not provided.`,{nodes:n});continue}const d=f.value;let p=d.kind===u.NULL;if(d.kind===u.VARIABLE){const N=d.name.value;if(t==null||!ir(t,N)){if(a.defaultValue!==void 0)r[c]=a.defaultValue;else if(S(l))throw new h(`Argument "${c}" of required type "${T(l)}" was provided the variable "$${N}" which was not provided a runtime value.`,{nodes:d});continue}p=t[N]==null}if(p&&S(l))throw new h(`Argument "${c}" of non-null type "${T(l)}" must not be null.`,{nodes:d});const y=Ie(d,l,t);if(y===void 0)throw new h(`Argument "${c}" has invalid value ${U(d)}.`,{nodes:d});r[c]=y}return r}function un(e,n,t){var i;const r=(i=n.directives)===null||i===void 0?void 0:i.find(s=>s.name.value===e.name);if(r)return It(e,r,t)}function ir(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function _t(e,n,t,i,r){const s=new Map;return Fn(e,n,t,i,r,s,new Set),s}function ho(e,n,t,i,r){const s=new Map,o=new Set;for(const a of r)a.selectionSet&&Fn(e,n,t,i,a.selectionSet,s,o);return s}function Fn(e,n,t,i,r,s,o){for(const a of r.selections)switch(a.kind){case u.FIELD:{if(!Kn(t,a))continue;const c=mo(a),l=s.get(c);l!==void 0?l.push(a):s.set(c,[a]);break}case u.INLINE_FRAGMENT:{if(!Kn(t,a)||!Xt(e,a,i))continue;Fn(e,n,t,i,a.selectionSet,s,o);break}case u.FRAGMENT_SPREAD:{const c=a.name.value;if(o.has(c)||!Kn(t,a))continue;o.add(c);const l=n[c];if(!l||!Xt(e,l,i))continue;Fn(e,n,t,i,l.selectionSet,s,o);break}}}function Kn(e,n){const t=un(Li,n,e);if((t==null?void 0:t.if)===!0)return!1;const i=un(Ri,n,e);return(i==null?void 0:i.if)!==!1}function Xt(e,n,t){const i=n.typeCondition;if(!i)return!0;const r=ae(e,i);return r===t?!0:_e(r)?e.isSubType(r,t):!1}function mo(e){return e.alias?e.alias.value:e.name.value}function Eo(e){return{OperationDefinition(n){if(n.operation==="subscription"){const t=e.getSchema(),i=t.getSubscriptionType();if(i){const r=n.name?n.name.value:null,s=Object.create(null),o=e.getDocument(),a=Object.create(null);for(const l of o.definitions)l.kind===u.FRAGMENT_DEFINITION&&(a[l.name.value]=l);const c=_t(t,a,s,i,n.selectionSet);if(c.size>1){const d=[...c.values()].slice(1).flat();e.reportError(new h(r!=null?`Subscription "${r}" must select only one top level field.`:"Anonymous Subscription must select only one top level field.",{nodes:d}))}for(const l of c.values())l[0].name.value.startsWith("__")&&e.reportError(new h(r!=null?`Subscription "${r}" must not select an introspection top level field.`:"Anonymous Subscription must not select an introspection top level field.",{nodes:l}))}}}}}function Ot(e,n){const t=new Map;for(const i of e){const r=n(i),s=t.get(r);s===void 0?t.set(r,[i]):s.push(i)}return t}function To(e){return{DirectiveDefinition(i){var r;const s=(r=i.arguments)!==null&&r!==void 0?r:[];return t(`@${i.name.value}`,s)},InterfaceTypeDefinition:n,InterfaceTypeExtension:n,ObjectTypeDefinition:n,ObjectTypeExtension:n};function n(i){var r;const s=i.name.value,o=(r=i.fields)!==null&&r!==void 0?r:[];for(const c of o){var a;const l=c.name.value,f=(a=c.arguments)!==null&&a!==void 0?a:[];t(`${s}.${l}`,f)}return!1}function t(i,r){const s=Ot(r,o=>o.name.value);for(const[o,a]of s)a.length>1&&e.reportError(new h(`Argument "${i}(${o}:)" can only be defined once.`,{nodes:a.map(c=>c.name)}));return!1}}function rr(e){return{Field:n,Directive:n};function n(t){var i;const r=(i=t.arguments)!==null&&i!==void 0?i:[],s=Ot(r,o=>o.name.value);for(const[o,a]of s)a.length>1&&e.reportError(new h(`There can be only one argument named "${o}".`,{nodes:a.map(c=>c.name)}))}}function yo(e){const n=Object.create(null),t=e.getSchema();return{DirectiveDefinition(i){const r=i.name.value;if(t!=null&&t.getDirective(r)){e.reportError(new h(`Directive "@${r}" already exists in the schema. It cannot be redefined.`,{nodes:i.name}));return}return n[r]?e.reportError(new h(`There can be only one directive named "@${r}".`,{nodes:[n[r],i.name]})):n[r]=i.name,!1}}}function sr(e){const n=Object.create(null),t=e.getSchema(),i=t?t.getDirectives():Pe;for(const a of i)n[a.name]=!a.isRepeatable;const r=e.getDocument().definitions;for(const a of r)a.kind===u.DIRECTIVE_DEFINITION&&(n[a.name.value]=!a.repeatable);const s=Object.create(null),o=Object.create(null);return{enter(a){if(!("directives"in a)||!a.directives)return;let c;if(a.kind===u.SCHEMA_DEFINITION||a.kind===u.SCHEMA_EXTENSION)c=s;else if(En(a)||Nt(a)){const l=a.name.value;c=o[l],c===void 0&&(o[l]=c=Object.create(null))}else c=Object.create(null);for(const l of a.directives){const f=l.name.value;n[f]&&(c[f]?e.reportError(new h(`The directive "@${f}" can only be used once at this location.`,{nodes:[c[f],l]})):c[f]=l)}}}}function vo(e){const n=e.getSchema(),t=n?n.getTypeMap():Object.create(null),i=Object.create(null);return{EnumTypeDefinition:r,EnumTypeExtension:r};function r(s){var o;const a=s.name.value;i[a]||(i[a]=Object.create(null));const c=(o=s.values)!==null&&o!==void 0?o:[],l=i[a];for(const f of c){const d=f.name.value,p=t[a];J(p)&&p.getValue(d)?e.reportError(new h(`Enum value "${a}.${d}" already exists in the schema. It cannot also be defined in this type extension.`,{nodes:f.name})):l[d]?e.reportError(new h(`Enum value "${a}.${d}" can only be defined once.`,{nodes:[l[d],f.name]})):l[d]=f.name}return!1}}function No(e){const n=e.getSchema(),t=n?n.getTypeMap():Object.create(null),i=Object.create(null);return{InputObjectTypeDefinition:r,InputObjectTypeExtension:r,InterfaceTypeDefinition:r,InterfaceTypeExtension:r,ObjectTypeDefinition:r,ObjectTypeExtension:r};function r(s){var o;const a=s.name.value;i[a]||(i[a]=Object.create(null));const c=(o=s.fields)!==null&&o!==void 0?o:[],l=i[a];for(const f of c){const d=f.name.value;go(t[a],d)?e.reportError(new h(`Field "${a}.${d}" already exists in the schema. It cannot also be defined in this type extension.`,{nodes:f.name})):l[d]?e.reportError(new h(`Field "${a}.${d}" can only be defined once.`,{nodes:[l[d],f.name]})):l[d]=f.name}return!1}}function go(e,n){return F(e)||$(e)||C(e)?e.getFields()[n]!=null:!1}function Io(e){const n=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition(t){const i=t.name.value;return n[i]?e.reportError(new h(`There can be only one fragment named "${i}".`,{nodes:[n[i],t.name]})):n[i]=t.name,!1}}}function or(e){const n=[];let t=Object.create(null);return{ObjectValue:{enter(){n.push(t),t=Object.create(null)},leave(){const i=n.pop();i||Q(!1),t=i}},ObjectField(i){const r=i.name.value;t[r]?e.reportError(new h(`There can be only one input field named "${r}".`,{nodes:[t[r],i.name]})):t[r]=i.name}}}function _o(e){const n=Object.create(null);return{OperationDefinition(t){const i=t.name;return i&&(n[i.value]?e.reportError(new h(`There can be only one operation named "${i.value}".`,{nodes:[n[i.value],i]})):n[i.value]=i),!1},FragmentDefinition:()=>!1}}function Oo(e){const n=e.getSchema(),t=Object.create(null),i=n?{query:n.getQueryType(),mutation:n.getMutationType(),subscription:n.getSubscriptionType()}:{};return{SchemaDefinition:r,SchemaExtension:r};function r(s){var o;const a=(o=s.operationTypes)!==null&&o!==void 0?o:[];for(const c of a){const l=c.operation,f=t[l];i[l]?e.reportError(new h(`Type for ${l} already defined in the schema. It cannot be redefined.`,{nodes:c})):f?e.reportError(new h(`There can be only one ${l} type in schema.`,{nodes:[f,c]})):t[l]=c}return!1}}function bo(e){const n=Object.create(null),t=e.getSchema();return{ScalarTypeDefinition:i,ObjectTypeDefinition:i,InterfaceTypeDefinition:i,UnionTypeDefinition:i,EnumTypeDefinition:i,InputObjectTypeDefinition:i};function i(r){const s=r.name.value;if(t!=null&&t.getType(s)){e.reportError(new h(`Type "${s}" already exists in the schema. It cannot also be defined in this type definition.`,{nodes:r.name}));return}return n[s]?e.reportError(new h(`There can be only one type named "${s}".`,{nodes:[n[s],r.name]})):n[s]=r.name,!1}}function Do(e){return{OperationDefinition(n){var t;const i=(t=n.variableDefinitions)!==null&&t!==void 0?t:[],r=Ot(i,s=>s.variable.name.value);for(const[s,o]of r)o.length>1&&e.reportError(new h(`There can be only one variable named "$${s}".`,{nodes:o.map(a=>a.variable.name)}))}}}function So(e){let n={};return{OperationDefinition:{enter(){n={}}},VariableDefinition(t){n[t.variable.name.value]=t},ListValue(t){const i=gi(e.getParentInputType());if(!j(i))return $e(e,t),!1},ObjectValue(t){const i=ee(e.getInputType());if(!C(i))return $e(e,t),!1;const r=be(t.fields,s=>s.name.value);for(const s of Object.values(i.getFields()))if(!r[s.name]&&pt(s)){const a=T(s.type);e.reportError(new h(`Field "${i.name}.${s.name}" of required type "${a}" was not provided.`,{nodes:t}))}i.isOneOf&&Ao(e,t,i,r,n)},ObjectField(t){const i=ee(e.getParentInputType());if(!e.getInputType()&&C(i)){const s=Fe(t.name.value,Object.keys(i.getFields()));e.reportError(new h(`Field "${t.name.value}" is not defined by type "${i.name}".`+Oe(s),{nodes:t}))}},NullValue(t){const i=e.getInputType();S(i)&&e.reportError(new h(`Expected value of type "${T(i)}", found ${U(t)}.`,{nodes:t}))},EnumValue:t=>$e(e,t),IntValue:t=>$e(e,t),FloatValue:t=>$e(e,t),StringValue:t=>$e(e,t),BooleanValue:t=>$e(e,t)}}function $e(e,n){const t=e.getInputType();if(!t)return;const i=ee(t);if(!De(i)){const r=T(t);e.reportError(new h(`Expected value of type "${r}", found ${U(n)}.`,{nodes:n}));return}try{if(i.parseLiteral(n,void 0)===void 0){const s=T(t);e.reportError(new h(`Expected value of type "${s}", found ${U(n)}.`,{nodes:n}))}}catch(r){const s=T(t);r instanceof h?e.reportError(r):e.reportError(new h(`Expected value of type "${s}", found ${U(n)}; `+r.message,{nodes:n,originalError:r}))}}function Ao(e,n,t,i,r){var s;const o=Object.keys(i);if(o.length!==1){e.reportError(new h(`OneOf Input Object "${t.name}" must specify exactly one key.`,{nodes:[n]}));return}const c=(s=i[o[0]])===null||s===void 0?void 0:s.value,l=!c||c.kind===u.NULL,f=(c==null?void 0:c.kind)===u.VARIABLE;if(l){e.reportError(new h(`Field "${t.name}.${o[0]}" must be non-null.`,{nodes:[n]}));return}if(f){const d=c.name.value;r[d].type.kind!==u.NON_NULL_TYPE&&e.reportError(new h(`Variable "${d}" must be non-nullable to be used for OneOf Input Object "${t.name}".`,{nodes:[n]}))}}function wo(e){return{VariableDefinition(n){const t=ae(e.getSchema(),n.type);if(t!==void 0&&!ie(t)){const i=n.variable.name.value,r=U(n.type);e.reportError(new h(`Variable "$${i}" cannot be non-input type "${r}".`,{nodes:n.type}))}}}}function Ro(e){let n=Object.create(null);return{OperationDefinition:{enter(){n=Object.create(null)},leave(t){const i=e.getRecursiveVariableUsages(t);for(const{node:r,type:s,defaultValue:o}of i){const a=r.name.value,c=n[a];if(c&&s){const l=e.getSchema(),f=ae(l,c.type);if(f&&!Lo(l,f,c.defaultValue,s,o)){const d=T(f),p=T(s);e.reportError(new h(`Variable "$${a}" of type "${d}" used in position expecting type "${p}".`,{nodes:[c,r]}))}}}}},VariableDefinition(t){n[t.variable.name.value]=t}}}function Lo(e,n,t,i,r){if(S(i)&&!S(n)){if(!(t!=null&&t.kind!==u.NULL)&&!(r!==void 0))return!1;const a=i.ofType;return qe(e,n,a)}return qe(e,n,i)}const Fo=Object.freeze([Ps]),ko=Object.freeze([As,_o,Ms,Eo,Wi,Fs,wo,co,ws,Io,xs,Qs,eo,Gs,Do,Bs,Ys,Hi,sr,ks,rr,So,oo,Ro,Js,or,...Fo]),$o=Object.freeze([Us,Oo,bo,vo,No,To,yo,Wi,Hi,sr,to,zi,rr,or,nr]);class ar{constructor(n,t){this._ast=n,this._fragments=void 0,this._fragmentSpreads=new Map,this._recursivelyReferencedFragments=new Map,this._onError=t}get[Symbol.toStringTag](){return"ASTValidationContext"}reportError(n){this._onError(n)}getDocument(){return this._ast}getFragment(n){let t;if(this._fragments)t=this._fragments;else{t=Object.create(null);for(const i of this.getDocument().definitions)i.kind===u.FRAGMENT_DEFINITION&&(t[i.name.value]=i);this._fragments=t}return t[n]}getFragmentSpreads(n){let t=this._fragmentSpreads.get(n);if(!t){t=[];const i=[n];let r;for(;r=i.pop();)for(const s of r.selections)s.kind===u.FRAGMENT_SPREAD?t.push(s):s.selectionSet&&i.push(s.selectionSet);this._fragmentSpreads.set(n,t)}return t}getRecursivelyReferencedFragments(n){let t=this._recursivelyReferencedFragments.get(n);if(!t){t=[];const i=Object.create(null),r=[n.selectionSet];let s;for(;s=r.pop();)for(const o of this.getFragmentSpreads(s)){const a=o.name.value;if(i[a]!==!0){i[a]=!0;const c=this.getFragment(a);c&&(t.push(c),r.push(c.selectionSet))}}this._recursivelyReferencedFragments.set(n,t)}return t}}class Vo extends ar{constructor(n,t,i){super(n,i),this._schema=t}get[Symbol.toStringTag](){return"SDLValidationContext"}getSchema(){return this._schema}}class xo extends ar{constructor(n,t,i,r){super(t,r),this._schema=n,this._typeInfo=i,this._variableUsages=new Map,this._recursiveVariableUsages=new Map}get[Symbol.toStringTag](){return"ValidationContext"}getSchema(){return this._schema}getVariableUsages(n){let t=this._variableUsages.get(n);if(!t){const i=[],r=new Qi(this._schema);pn(n,Yi(r,{VariableDefinition:()=>!1,Variable(s){i.push({node:s,type:r.getInputType(),defaultValue:r.getDefaultValue()})}})),t=i,this._variableUsages.set(n,t)}return t}getRecursiveVariableUsages(n){let t=this._recursiveVariableUsages.get(n);if(!t){t=this.getVariableUsages(n);for(const i of this.getRecursivelyReferencedFragments(n))t=t.concat(this.getVariableUsages(i));this._recursiveVariableUsages.set(n,t)}return t}getType(){return this._typeInfo.getType()}getParentType(){return this._typeInfo.getParentType()}getInputType(){return this._typeInfo.getInputType()}getParentInputType(){return this._typeInfo.getParentInputType()}getFieldDef(){return this._typeInfo.getFieldDef()}getDirective(){return this._typeInfo.getDirective()}getArgument(){return this._typeInfo.getArgument()}getEnumValue(){return this._typeInfo.getEnumValue()}}function Co(e,n,t=ko,i,r=new Qi(e)){var s;const o=(s=i==null?void 0:i.maxErrors)!==null&&s!==void 0?s:100;n||A(!1,"Must provide document."),Bi(e);const a=Object.freeze({}),c=[],l=new xo(e,n,r,d=>{if(c.length>=o)throw c.push(new h("Too many validation errors, error limit reached. Validation aborted.")),a;c.push(d)}),f=vi(t.map(d=>d(l)));try{pn(n,Yi(r,f))}catch(d){if(d!==a)throw d}return c}function cr(e,n,t=$o){const i=[],r=new Vo(e,n,o=>{i.push(o)}),s=t.map(o=>o(r));return pn(e,vi(s)),i}function Mo(e){const n=cr(e);if(n.length!==0)throw new Error(n.map(t=>t.message).join(` - -`))}function Uo(e,n){const t=cr(e,n);if(t.length!==0)throw new Error(t.map(i=>i.message).join(` - -`))}function jo(e){let n;return function(i,r,s){n===void 0&&(n=new WeakMap);let o=n.get(i);o===void 0&&(o=new WeakMap,n.set(i,o));let a=o.get(r);a===void 0&&(a=new WeakMap,o.set(r,a));let c=a.get(s);return c===void 0&&(c=e(i,r,s),a.set(s,c)),c}}function zt(e){return Promise.all(Object.values(e)).then(n=>{const t=Object.create(null);for(const[i,r]of Object.keys(e).entries())t[r]=n[i];return t})}function Po(e,n,t){let i=t;for(const r of e)i=se(i)?i.then(s=>n(s,r)):n(i,r);return i}function Go(e){return e instanceof Error?e:new Bo(e)}class Bo extends Error{constructor(n){super("Unexpected error value: "+T(n)),this.name="NonErrorThrown",this.thrownValue=n}}function ln(e,n,t){var i;const r=Go(e);return Qo(r)?r:new h(r.message,{nodes:(i=r.nodes)!==null&&i!==void 0?i:n,source:r.source,positions:r.positions,path:t,originalError:r})}function Qo(e){return Array.isArray(e.path)}const Yo=jo((e,n,t)=>ho(e.schema,e.fragments,e.variableValues,n,t));function bt(e){arguments.length<2||A(!1,"graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.");const{schema:n,document:t,variableValues:i,rootValue:r}=e;ur(n,t,i);const s=lr(e);if(!("schema"in s))return{errors:s};try{const{operation:o}=s,a=Jo(s,o,r);return se(a)?a.then(c=>In(c,s.errors),c=>(s.errors.push(c),In(null,s.errors))):In(a,s.errors)}catch(o){return s.errors.push(o),In(null,s.errors)}}function qo(e){const n=bt(e);if(se(n))throw new Error("GraphQL execution failed to complete synchronously.");return n}function In(e,n){return n.length===0?{data:e}:{errors:n,data:e}}function ur(e,n,t){n||A(!1,"Must provide document."),Bi(e),t==null||oe(t)||A(!1,"Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.")}function lr(e){var n,t;const{schema:i,document:r,rootValue:s,contextValue:o,variableValues:a,operationName:c,fieldResolver:l,typeResolver:f,subscribeFieldResolver:d}=e;let p;const y=Object.create(null);for(const k of r.definitions)switch(k.kind){case u.OPERATION_DEFINITION:if(c==null){if(p!==void 0)return[new h("Must provide operation name if query contains multiple operations.")];p=k}else((n=k.name)===null||n===void 0?void 0:n.value)===c&&(p=k);break;case u.FRAGMENT_DEFINITION:y[k.name.value]=k;break}if(!p)return c!=null?[new h(`Unknown operation named "${c}".`)]:[new h("Must provide an operation.")];const N=(t=p.variableDefinitions)!==null&&t!==void 0?t:[],L=fo(i,N,a??{},{maxErrors:50});return L.errors?L.errors:{schema:i,fragments:y,rootValue:s,contextValue:o,operation:p,variableValues:L.coerced,fieldResolver:l??Kt,typeResolver:f??Ko,subscribeFieldResolver:d??Kt,errors:[]}}function Jo(e,n,t){const i=e.schema.getRootType(n.operation);if(i==null)throw new h(`Schema is not configured to execute ${n.operation} operation.`,{nodes:n});const r=_t(e.schema,e.fragments,e.variableValues,i,n.selectionSet),s=void 0;switch(n.operation){case z.QUERY:return kn(e,i,t,s,r);case z.MUTATION:return Xo(e,i,t,s,r);case z.SUBSCRIPTION:return kn(e,i,t,s,r)}}function Xo(e,n,t,i,r){return Po(r.entries(),(s,[o,a])=>{const c=Je(i,o,n.name),l=fr(e,n,t,a,c);return l===void 0?s:se(l)?l.then(f=>(s[o]=f,s)):(s[o]=l,s)},Object.create(null))}function kn(e,n,t,i,r){const s=Object.create(null);let o=!1;try{for(const[a,c]of r.entries()){const l=Je(i,a,n.name),f=fr(e,n,t,c,l);f!==void 0&&(s[a]=f,se(f)&&(o=!0))}}catch(a){if(o)return zt(s).finally(()=>{throw a});throw a}return o?zt(s):s}function fr(e,n,t,i,r){var s;const o=pr(e.schema,n,i[0]);if(!o)return;const a=o.type,c=(s=o.resolve)!==null&&s!==void 0?s:e.fieldResolver,l=dr(e,o,i,n,r);try{const f=It(o,i[0],e.variableValues),d=e.contextValue,p=c(t,f,d,l);let y;return se(p)?y=p.then(N=>fn(e,a,i,l,r,N)):y=fn(e,a,i,l,r,p),se(y)?y.then(void 0,N=>{const L=ln(N,i,Z(r));return $n(L,a,e)}):y}catch(f){const d=ln(f,i,Z(r));return $n(d,a,e)}}function dr(e,n,t,i,r){return{fieldName:n.name,fieldNodes:t,returnType:n.type,parentType:i,path:r,schema:e.schema,fragments:e.fragments,rootValue:e.rootValue,operation:e.operation,variableValues:e.variableValues}}function $n(e,n,t){if(S(n))throw e;return t.errors.push(e),null}function fn(e,n,t,i,r,s){if(s instanceof Error)throw s;if(S(n)){const o=fn(e,n.ofType,t,i,r,s);if(o===null)throw new Error(`Cannot return null for non-nullable field ${i.parentType.name}.${i.fieldName}.`);return o}if(s==null)return null;if(j(n))return zo(e,n,t,i,r,s);if(De(n))return Ho(n,s);if(_e(n))return Wo(e,n,t,i,r,s);if(F(n))return ct(e,n,t,i,r,s);Q(!1,"Cannot complete value of unexpected output type: "+T(n))}function zo(e,n,t,i,r,s){if(!Tt(s))throw new h(`Expected Iterable, but did not find one for field "${i.parentType.name}.${i.fieldName}".`);const o=n.ofType;let a=!1;const c=Array.from(s,(l,f)=>{const d=Je(r,f,void 0);try{let p;return se(l)?p=l.then(y=>fn(e,o,t,i,d,y)):p=fn(e,o,t,i,d,l),se(p)?(a=!0,p.then(void 0,y=>{const N=ln(y,t,Z(d));return $n(N,o,e)})):p}catch(p){const y=ln(p,t,Z(d));return $n(y,o,e)}});return a?Promise.all(c):c}function Ho(e,n){const t=e.serialize(n);if(t==null)throw new Error(`Expected \`${T(e)}.serialize(${T(n)})\` to return non-nullable value, returned: ${T(t)}`);return t}function Wo(e,n,t,i,r,s){var o;const a=(o=n.resolveType)!==null&&o!==void 0?o:e.typeResolver,c=e.contextValue,l=a(s,c,i,n);return se(l)?l.then(f=>ct(e,Ht(f,e,n,t,i,s),t,i,r,s)):ct(e,Ht(l,e,n,t,i,s),t,i,r,s)}function Ht(e,n,t,i,r,s){if(e==null)throw new h(`Abstract type "${t.name}" must resolve to an Object type at runtime for field "${r.parentType.name}.${r.fieldName}". Either the "${t.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`,i);if(F(e))throw new h("Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.");if(typeof e!="string")throw new h(`Abstract type "${t.name}" must resolve to an Object type at runtime for field "${r.parentType.name}.${r.fieldName}" with value ${T(s)}, received "${T(e)}".`);const o=n.schema.getType(e);if(o==null)throw new h(`Abstract type "${t.name}" was resolved to a type "${e}" that does not exist inside the schema.`,{nodes:i});if(!F(o))throw new h(`Abstract type "${t.name}" was resolved to a non-object type "${e}".`,{nodes:i});if(!n.schema.isSubType(t,o))throw new h(`Runtime Object type "${o.name}" is not a possible type for "${t.name}".`,{nodes:i});return o}function ct(e,n,t,i,r,s){const o=Yo(e,n,t);if(n.isTypeOf){const a=n.isTypeOf(s,e.contextValue,i);if(se(a))return a.then(c=>{if(!c)throw Wt(n,s,t);return kn(e,n,s,r,o)});if(!a)throw Wt(n,s,t)}return kn(e,n,s,r,o)}function Wt(e,n,t){return new h(`Expected value of type "${e.name}" but got: ${T(n)}.`,{nodes:t})}const Ko=function(e,n,t,i){if(oe(e)&&typeof e.__typename=="string")return e.__typename;const r=t.schema.getPossibleTypes(i),s=[];for(let o=0;o{for(let a=0;an(hr(e)))}function Wa(e){const n=hr(e);if(se(n))throw new Error("GraphQL execution failed to complete synchronously.");return n}function hr(e){arguments.length<2||A(!1,"graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.");const{schema:n,source:t,rootValue:i,contextValue:r,variableValues:s,operationName:o,fieldResolver:a,typeResolver:c}=e,l=Gi(n);if(l.length>0)return{errors:l};let f;try{f=dt(t)}catch(p){return{errors:[p]}}const d=Co(n,f);return d.length>0?{errors:d}:bt({schema:n,document:f,rootValue:i,contextValue:r,variableValues:s,operationName:o,fieldResolver:a,typeResolver:c})}function mr(e){return typeof(e==null?void 0:e[Symbol.asyncIterator])=="function"}function Zo(e,n){const t=e[Symbol.asyncIterator]();async function i(r){if(r.done)return r;try{return{value:await n(r.value),done:!1}}catch(s){if(typeof t.return=="function")try{await t.return()}catch{}throw s}}return{async next(){return i(await t.next())},async return(){return typeof t.return=="function"?i(await t.return()):{value:void 0,done:!0}},async throw(r){if(typeof t.throw=="function")return i(await t.throw(r));throw r},[Symbol.asyncIterator](){return this}}}async function Ka(e){arguments.length<2||A(!1,"graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.");const n=await na(e);return mr(n)?Zo(n,i=>bt({...e,rootValue:i})):n}function ea(e){const n=e[0];return n&&"document"in n?n:{schema:n,document:e[1],rootValue:e[2],contextValue:e[3],variableValues:e[4],operationName:e[5],subscribeFieldResolver:e[6]}}async function na(...e){const n=ea(e),{schema:t,document:i,variableValues:r}=n;ur(t,i,r);const s=lr(n);if(!("schema"in s))return{errors:s};try{const o=await ta(s);if(!mr(o))throw new Error(`Subscription field must return Async Iterable. Received: ${T(o)}.`);return o}catch(o){if(o instanceof h)return{errors:[o]};throw o}}async function ta(e){const{schema:n,fragments:t,operation:i,variableValues:r,rootValue:s}=e,o=n.getSubscriptionType();if(o==null)throw new h("Schema is not configured to execute subscription operation.",{nodes:i});const a=_t(n,t,r,o,i.selectionSet),[c,l]=[...a.entries()][0],f=pr(n,o,l[0]);if(!f){const N=l[0].name.value;throw new h(`The subscription field "${N}" is not defined.`,{nodes:l})}const d=Je(void 0,c,o.name),p=dr(e,f,l,o,d);try{var y;const N=It(f,l[0],r),L=e.contextValue,P=await((y=f.subscribe)!==null&&y!==void 0?y:e.subscribeFieldResolver)(s,N,L,p);if(P instanceof Error)throw P;return P}catch(N){throw ln(N,l,Z(d))}}function Za(e){return{Field(n){const t=e.getFieldDef(),i=t==null?void 0:t.deprecationReason;if(t&&i!=null){const r=e.getParentType();r!=null||Q(!1),e.reportError(new h(`The field ${r.name}.${t.name} is deprecated. ${i}`,{nodes:n}))}},Argument(n){const t=e.getArgument(),i=t==null?void 0:t.deprecationReason;if(t&&i!=null){const r=e.getDirective();if(r!=null)e.reportError(new h(`Directive "@${r.name}" argument "${t.name}" is deprecated. ${i}`,{nodes:n}));else{const s=e.getParentType(),o=e.getFieldDef();s!=null&&o!=null||Q(!1),e.reportError(new h(`Field "${s.name}.${o.name}" argument "${t.name}" is deprecated. ${i}`,{nodes:n}))}}},ObjectField(n){const t=ee(e.getParentInputType());if(C(t)){const i=t.getFields()[n.name.value],r=i==null?void 0:i.deprecationReason;r!=null&&e.reportError(new h(`The input field ${t.name}.${i.name} is deprecated. ${r}`,{nodes:n}))}},EnumValue(n){const t=e.getEnumValue(),i=t==null?void 0:t.deprecationReason;if(t&&i!=null){const r=ee(e.getInputType());r!=null||Q(!1),e.reportError(new h(`The enum value "${r.name}.${t.name}" is deprecated. ${i}`,{nodes:n}))}}}}function ec(e){return{Field(n){const t=ee(e.getType());t&&ze(t)&&e.reportError(new h(`GraphQL introspection has been disabled, but the requested query contained the field "${n.name.value}".`,{nodes:n}))}}}function ia(e){const n={descriptions:!0,specifiedByUrl:!1,directiveIsRepeatable:!1,schemaDescription:!1,inputValueDeprecation:!1,oneOf:!1,...e},t=n.descriptions?"description":"",i=n.specifiedByUrl?"specifiedByURL":"",r=n.directiveIsRepeatable?"isRepeatable":"",s=n.schemaDescription?t:"";function o(c){return n.inputValueDeprecation?c:""}const a=n.oneOf?"isOneOf":"";return` - query IntrospectionQuery { - __schema { - ${s} - queryType { name } - mutationType { name } - subscriptionType { name } - types { - ...FullType - } - directives { - name - ${t} - ${r} - locations - args${o("(includeDeprecated: true)")} { - ...InputValue - } - } - } - } - - fragment FullType on __Type { - kind - name - ${t} - ${i} - ${a} - fields(includeDeprecated: true) { - name - ${t} - args${o("(includeDeprecated: true)")} { - ...InputValue - } - type { - ...TypeRef - } - isDeprecated - deprecationReason - } - inputFields${o("(includeDeprecated: true)")} { - ...InputValue - } - interfaces { - ...TypeRef - } - enumValues(includeDeprecated: true) { - name - ${t} - isDeprecated - deprecationReason - } - possibleTypes { - ...TypeRef - } - } - - fragment InputValue on __InputValue { - name - ${t} - type { ...TypeRef } - defaultValue - ${o("isDeprecated")} - ${o("deprecationReason")} - } - - fragment TypeRef on __Type { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - } - } - } - } - } - } - } - } - } - } - `}function nc(e,n){let t=null;for(const r of e.definitions)if(r.kind===u.OPERATION_DEFINITION){var i;if(n==null){if(t)return null;t=r}else if(((i=r.name)===null||i===void 0?void 0:i.value)===n)return r}return t}function tc(e,n){if(n.operation==="query"){const t=e.getQueryType();if(!t)throw new h("Schema does not define the required query root type.",{nodes:n});return t}if(n.operation==="mutation"){const t=e.getMutationType();if(!t)throw new h("Schema is not configured for mutations.",{nodes:n});return t}if(n.operation==="subscription"){const t=e.getSubscriptionType();if(!t)throw new h("Schema is not configured for subscriptions.",{nodes:n});return t}throw new h("Can only have query, mutation and subscription operations.",{nodes:n})}function ic(e,n){const t={specifiedByUrl:!0,directiveIsRepeatable:!0,schemaDescription:!0,inputValueDeprecation:!0,oneOf:!0,...n},i=dt(ia(t)),r=qo({schema:e,document:i});return!r.errors&&r.data||Q(!1),r.data}function rc(e,n){oe(e)&&oe(e.__schema)||A(!1,`Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ${T(e)}.`);const t=e.__schema,i=Le(t.types,v=>v.name,v=>p(v));for(const v of[...Pn,...Bn])i[v.name]&&(i[v.name]=v);const r=t.queryType?f(t.queryType):null,s=t.mutationType?f(t.mutationType):null,o=t.subscriptionType?f(t.subscriptionType):null,a=t.directives?t.directives.map(Yn):[];return new mn({description:t.description,query:r,mutation:s,subscription:o,types:Object.values(i),directives:a,assumeValid:n==null?void 0:n.assumeValid});function c(v){if(v.kind===V.LIST){const D=v.ofType;if(!D)throw new Error("Decorated type deeper than introspection query.");return new W(c(D))}if(v.kind===V.NON_NULL){const D=v.ofType;if(!D)throw new Error("Decorated type deeper than introspection query.");const te=c(D);return new w(us(te))}return l(v)}function l(v){const D=v.name;if(!D)throw new Error(`Unknown type reference: ${T(v)}.`);const te=i[D];if(!te)throw new Error(`Invalid or incomplete schema, unknown type: ${D}. Ensure that a full introspection query is used in order to build a client schema.`);return te}function f(v){return as(l(v))}function d(v){return cs(l(v))}function p(v){if(v!=null&&v.name!=null&&v.kind!=null)switch(v.kind){case V.SCALAR:return y(v);case V.OBJECT:return L(v);case V.INTERFACE:return k(v);case V.UNION:return P(v);case V.ENUM:return de(v);case V.INPUT_OBJECT:return K(v)}const D=T(v);throw new Error(`Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ${D}.`)}function y(v){return new Ae({name:v.name,description:v.description,specifiedByURL:v.specifiedByURL})}function N(v){if(v.interfaces===null&&v.kind===V.INTERFACE)return[];if(!v.interfaces){const D=T(v);throw new Error(`Introspection result missing interfaces: ${D}.`)}return v.interfaces.map(d)}function L(v){return new Te({name:v.name,description:v.description,interfaces:()=>N(v),fields:()=>ne(v)})}function k(v){return new on({name:v.name,description:v.description,interfaces:()=>N(v),fields:()=>ne(v)})}function P(v){if(!v.possibleTypes){const D=T(v);throw new Error(`Introspection result missing possibleTypes: ${D}.`)}return new an({name:v.name,description:v.description,types:()=>v.possibleTypes.map(f)})}function de(v){if(!v.enumValues){const D=T(v);throw new Error(`Introspection result missing enumValues: ${D}.`)}return new Me({name:v.name,description:v.description,values:Le(v.enumValues,D=>D.name,D=>({description:D.description,deprecationReason:D.deprecationReason}))})}function K(v){if(!v.inputFields){const D=T(v);throw new Error(`Introspection result missing inputFields: ${D}.`)}return new cn({name:v.name,description:v.description,fields:()=>Re(v.inputFields),isOneOf:v.isOneOf})}function ne(v){if(!v.fields)throw new Error(`Introspection result missing fields: ${T(v)}.`);return Le(v.fields,D=>D.name,ke)}function ke(v){const D=c(v.type);if(!xe(D)){const te=T(D);throw new Error(`Introspection must provide output type for fields, but received: ${te}.`)}if(!v.args){const te=T(v);throw new Error(`Introspection result missing field args: ${te}.`)}return{description:v.description,deprecationReason:v.deprecationReason,type:D,args:Re(v.args)}}function Re(v){return Le(v,D=>D.name,Ge)}function Ge(v){const D=c(v.type);if(!ie(D)){const Be=T(D);throw new Error(`Introspection must provide input type for arguments, but received: ${Be}.`)}const te=v.defaultValue!=null?Ie(Hr(v.defaultValue),D):void 0;return{description:v.description,type:D,defaultValue:te,deprecationReason:v.deprecationReason}}function Yn(v){if(!v.args){const D=T(v);throw new Error(`Introspection result missing directive args: ${D}.`)}if(!v.locations){const D=T(v);throw new Error(`Introspection result missing directive locations: ${D}.`)}return new Ne({name:v.name,description:v.description,isRepeatable:v.isRepeatable,locations:v.locations.slice(),args:Re(v.args)})}}function sc(e,n,t){Pi(e),n!=null&&n.kind===u.DOCUMENT||A(!1,"Must provide valid Document AST."),(t==null?void 0:t.assumeValid)!==!0&&(t==null?void 0:t.assumeValidSDL)!==!0&&Uo(n,e);const i=e.toConfig(),r=Er(i,n,t);return i===r?e:new mn(r)}function Er(e,n,t){var i,r,s,o;const a=[],c=Object.create(null),l=[];let f;const d=[];for(const m of n.definitions)if(m.kind===u.SCHEMA_DEFINITION)f=m;else if(m.kind===u.SCHEMA_EXTENSION)d.push(m);else if(En(m))a.push(m);else if(Nt(m)){const _=m.name.value,g=c[_];c[_]=g?g.concat([m]):[m]}else m.kind===u.DIRECTIVE_DEFINITION&&l.push(m);if(Object.keys(c).length===0&&a.length===0&&l.length===0&&d.length===0&&f==null)return e;const p=Object.create(null);for(const m of e.types)p[m.name]=de(m);for(const m of a){var y;const _=m.name.value;p[_]=(y=Zt[_])!==null&&y!==void 0?y:br(m)}const N={query:e.query&&k(e.query),mutation:e.mutation&&k(e.mutation),subscription:e.subscription&&k(e.subscription),...f&&te([f]),...te(d)};return{description:(i=f)===null||i===void 0||(r=i.description)===null||r===void 0?void 0:r.value,...N,types:Object.values(p),directives:[...e.directives.map(P),...l.map(Or)],extensions:Object.create(null),astNode:(s=f)!==null&&s!==void 0?s:e.astNode,extensionASTNodes:e.extensionASTNodes.concat(d),assumeValid:(o=t==null?void 0:t.assumeValid)!==null&&o!==void 0?o:!1};function L(m){return j(m)?new W(L(m.ofType)):S(m)?new w(L(m.ofType)):k(m)}function k(m){return p[m.name]}function P(m){const _=m.toConfig();return new Ne({..._,args:ge(_.args,D)})}function de(m){if(ze(m)||ht(m))return m;if(fe(m))return ke(m);if(F(m))return Re(m);if($(m))return Ge(m);if(H(m))return Yn(m);if(J(m))return ne(m);if(C(m))return K(m);Q(!1,"Unexpected type: "+T(m))}function K(m){var _;const g=m.toConfig(),O=(_=c[g.name])!==null&&_!==void 0?_:[];return new cn({...g,fields:()=>({...ge(g.fields,x=>({...x,type:L(x.type)})),...wt(O)}),extensionASTNodes:g.extensionASTNodes.concat(O)})}function ne(m){var _;const g=m.toConfig(),O=(_=c[m.name])!==null&&_!==void 0?_:[];return new Me({...g,values:{...g.values,...Rt(O)},extensionASTNodes:g.extensionASTNodes.concat(O)})}function ke(m){var _;const g=m.toConfig(),O=(_=c[g.name])!==null&&_!==void 0?_:[];let x=g.specifiedByURL;for(const M of O){var q;x=(q=ei(M))!==null&&q!==void 0?q:x}return new Ae({...g,specifiedByURL:x,extensionASTNodes:g.extensionASTNodes.concat(O)})}function Re(m){var _;const g=m.toConfig(),O=(_=c[g.name])!==null&&_!==void 0?_:[];return new Te({...g,interfaces:()=>[...m.getInterfaces().map(k),...yn(O)],fields:()=>({...ge(g.fields,v),...Tn(O)}),extensionASTNodes:g.extensionASTNodes.concat(O)})}function Ge(m){var _;const g=m.toConfig(),O=(_=c[g.name])!==null&&_!==void 0?_:[];return new on({...g,interfaces:()=>[...m.getInterfaces().map(k),...yn(O)],fields:()=>({...ge(g.fields,v),...Tn(O)}),extensionASTNodes:g.extensionASTNodes.concat(O)})}function Yn(m){var _;const g=m.toConfig(),O=(_=c[g.name])!==null&&_!==void 0?_:[];return new an({...g,types:()=>[...m.getTypes().map(k),...Lt(O)],extensionASTNodes:g.extensionASTNodes.concat(O)})}function v(m){return{...m,type:L(m.type),args:m.args&&ge(m.args,D)}}function D(m){return{...m,type:L(m.type)}}function te(m){const _={};for(const O of m){var g;const x=(g=O.operationTypes)!==null&&g!==void 0?g:[];for(const q of x)_[q.operation]=Be(q.type)}return _}function Be(m){var _;const g=m.name.value,O=(_=Zt[g])!==null&&_!==void 0?_:p[g];if(O===void 0)throw new Error(`Unknown type: "${g}".`);return O}function He(m){return m.kind===u.LIST_TYPE?new W(He(m.type)):m.kind===u.NON_NULL_TYPE?new w(He(m.type)):Be(m)}function Or(m){var _;return new Ne({name:m.name.value,description:(_=m.description)===null||_===void 0?void 0:_.value,locations:m.locations.map(({value:g})=>g),isRepeatable:m.repeatable,args:At(m.arguments),astNode:m})}function Tn(m){const _=Object.create(null);for(const x of m){var g;const q=(g=x.fields)!==null&&g!==void 0?g:[];for(const M of q){var O;_[M.name.value]={type:He(M.type),description:(O=M.description)===null||O===void 0?void 0:O.value,args:At(M.arguments),deprecationReason:_n(M),astNode:M}}}return _}function At(m){const _=m??[],g=Object.create(null);for(const x of _){var O;const q=He(x.type);g[x.name.value]={type:q,description:(O=x.description)===null||O===void 0?void 0:O.value,defaultValue:Ie(x.defaultValue,q),deprecationReason:_n(x),astNode:x}}return g}function wt(m){const _=Object.create(null);for(const x of m){var g;const q=(g=x.fields)!==null&&g!==void 0?g:[];for(const M of q){var O;const Qe=He(M.type);_[M.name.value]={type:Qe,description:(O=M.description)===null||O===void 0?void 0:O.value,defaultValue:Ie(M.defaultValue,Qe),deprecationReason:_n(M),astNode:M}}}return _}function Rt(m){const _=Object.create(null);for(const x of m){var g;const q=(g=x.values)!==null&&g!==void 0?g:[];for(const M of q){var O;_[M.name.value]={description:(O=M.description)===null||O===void 0?void 0:O.value,deprecationReason:_n(M),astNode:M}}}return _}function yn(m){return m.flatMap(_=>{var g,O;return(g=(O=_.interfaces)===null||O===void 0?void 0:O.map(Be))!==null&&g!==void 0?g:[]})}function Lt(m){return m.flatMap(_=>{var g,O;return(g=(O=_.types)===null||O===void 0?void 0:O.map(Be))!==null&&g!==void 0?g:[]})}function br(m){var _;const g=m.name.value,O=(_=c[g])!==null&&_!==void 0?_:[];switch(m.kind){case u.OBJECT_TYPE_DEFINITION:{var x;const pe=[m,...O];return new Te({name:g,description:(x=m.description)===null||x===void 0?void 0:x.value,interfaces:()=>yn(pe),fields:()=>Tn(pe),astNode:m,extensionASTNodes:O})}case u.INTERFACE_TYPE_DEFINITION:{var q;const pe=[m,...O];return new on({name:g,description:(q=m.description)===null||q===void 0?void 0:q.value,interfaces:()=>yn(pe),fields:()=>Tn(pe),astNode:m,extensionASTNodes:O})}case u.ENUM_TYPE_DEFINITION:{var M;const pe=[m,...O];return new Me({name:g,description:(M=m.description)===null||M===void 0?void 0:M.value,values:Rt(pe),astNode:m,extensionASTNodes:O})}case u.UNION_TYPE_DEFINITION:{var Qe;const pe=[m,...O];return new an({name:g,description:(Qe=m.description)===null||Qe===void 0?void 0:Qe.value,types:()=>Lt(pe),astNode:m,extensionASTNodes:O})}case u.SCALAR_TYPE_DEFINITION:{var qn;return new Ae({name:g,description:(qn=m.description)===null||qn===void 0?void 0:qn.value,specifiedByURL:ei(m),astNode:m,extensionASTNodes:O})}case u.INPUT_OBJECT_TYPE_DEFINITION:{var Jn;const pe=[m,...O];return new cn({name:g,description:(Jn=m.description)===null||Jn===void 0?void 0:Jn.value,fields:()=>wt(pe),astNode:m,extensionASTNodes:O,isOneOf:ra(m)})}}}}const Zt=be([...Pn,...Bn],e=>e.name);function _n(e){const n=un(Et,e);return n==null?void 0:n.reason}function ei(e){const n=un(ki,e);return n==null?void 0:n.url}function ra(e){return!!un($i,e)}function sa(e,n){e!=null&&e.kind===u.DOCUMENT||A(!1,"Must provide valid Document AST."),(n==null?void 0:n.assumeValid)!==!0&&(n==null?void 0:n.assumeValidSDL)!==!0&&Mo(e);const i=Er({description:void 0,types:[],directives:[],extensions:Object.create(null),extensionASTNodes:[],assumeValid:!1},e,n);if(i.astNode==null)for(const s of i.types)switch(s.name){case"Query":i.query=s;break;case"Mutation":i.mutation=s;break;case"Subscription":i.subscription=s;break}const r=[...i.directives,...Pe.filter(s=>i.directives.every(o=>o.name!==s.name))];return new mn({...i,directives:r})}function oc(e,n){const t=dt(e,{noLocation:n==null?void 0:n.noLocation,allowLegacyFragmentVariables:n==null?void 0:n.allowLegacyFragmentVariables});return sa(t,{assumeValidSDL:n==null?void 0:n.assumeValidSDL,assumeValid:n==null?void 0:n.assumeValid})}function ac(e){const n=e.toConfig(),t=Le(Zn(n.types),p=>p.name,d);return new mn({...n,types:Object.values(t),directives:Zn(n.directives).map(o),query:s(n.query),mutation:s(n.mutation),subscription:s(n.subscription)});function i(p){return j(p)?new W(i(p.ofType)):S(p)?new w(i(p.ofType)):r(p)}function r(p){return t[p.name]}function s(p){return p&&r(p)}function o(p){const y=p.toConfig();return new Ne({...y,locations:Tr(y.locations,N=>N),args:a(y.args)})}function a(p){return On(p,y=>({...y,type:i(y.type)}))}function c(p){return On(p,y=>({...y,type:i(y.type),args:y.args&&a(y.args)}))}function l(p){return On(p,y=>({...y,type:i(y.type)}))}function f(p){return Zn(p).map(r)}function d(p){if(fe(p)||ze(p))return p;if(F(p)){const y=p.toConfig();return new Te({...y,interfaces:()=>f(y.interfaces),fields:()=>c(y.fields)})}if($(p)){const y=p.toConfig();return new on({...y,interfaces:()=>f(y.interfaces),fields:()=>c(y.fields)})}if(H(p)){const y=p.toConfig();return new an({...y,types:()=>f(y.types)})}if(J(p)){const y=p.toConfig();return new Me({...y,values:On(y.values,N=>N)})}if(C(p)){const y=p.toConfig();return new cn({...y,fields:()=>l(y.fields)})}Q(!1,"Unexpected type: "+T(p))}}function On(e,n){const t=Object.create(null);for(const i of Object.keys(e).sort(dn))t[i]=n(e[i]);return t}function Zn(e){return Tr(e,n=>n.name)}function Tr(e,n){return e.slice().sort((t,i)=>{const r=n(t),s=n(i);return dn(r,s)})}function cc(e){return yr(e,n=>!Vi(n),oa)}function uc(e){return yr(e,Vi,ze)}function oa(e){return!ht(e)&&!ze(e)}function yr(e,n,t){const i=e.getDirectives().filter(n),r=Object.values(e.getTypeMap()).filter(t);return[aa(e),...i.map(s=>Ea(s)),...r.map(s=>ua(s))].filter(Boolean).join(` - -`)}function aa(e){if(e.description==null&&ca(e))return;const n=[],t=e.getQueryType();t&&n.push(` query: ${t.name}`);const i=e.getMutationType();i&&n.push(` mutation: ${i.name}`);const r=e.getSubscriptionType();return r&&n.push(` subscription: ${r.name}`),ce(e)+`schema { -${n.join(` -`)} -}`}function ca(e){const n=e.getQueryType();if(n&&n.name!=="Query")return!1;const t=e.getMutationType();if(t&&t.name!=="Mutation")return!1;const i=e.getSubscriptionType();return!(i&&i.name!=="Subscription")}function ua(e){if(fe(e))return la(e);if(F(e))return fa(e);if($(e))return da(e);if(H(e))return pa(e);if(J(e))return ha(e);if(C(e))return ma(e);Q(!1,"Unexpected type: "+T(e))}function la(e){return ce(e)+`scalar ${e.name}`+Ta(e)}function vr(e){const n=e.getInterfaces();return n.length?" implements "+n.map(t=>t.name).join(" & "):""}function fa(e){return ce(e)+`type ${e.name}`+vr(e)+Nr(e)}function da(e){return ce(e)+`interface ${e.name}`+vr(e)+Nr(e)}function pa(e){const n=e.getTypes(),t=n.length?" = "+n.join(" | "):"";return ce(e)+"union "+e.name+t}function ha(e){const n=e.getValues().map((t,i)=>ce(t," ",!i)+" "+t.name+St(t.deprecationReason));return ce(e)+`enum ${e.name}`+Dt(n)}function ma(e){const n=Object.values(e.getFields()).map((t,i)=>ce(t," ",!i)+" "+ut(t));return ce(e)+`input ${e.name}`+(e.isOneOf?" @oneOf":"")+Dt(n)}function Nr(e){const n=Object.values(e.getFields()).map((t,i)=>ce(t," ",!i)+" "+t.name+gr(t.args," ")+": "+String(t.type)+St(t.deprecationReason));return Dt(n)}function Dt(e){return e.length!==0?` { -`+e.join(` -`)+` -}`:""}function gr(e,n=""){return e.length===0?"":e.every(t=>!t.description)?"("+e.map(ut).join(", ")+")":`( -`+e.map((t,i)=>ce(t," "+n,!i)+" "+n+ut(t)).join(` -`)+` -`+n+")"}function ut(e){const n=Ve(e.defaultValue,e.type);let t=e.name+": "+String(e.type);return n&&(t+=` = ${U(n)}`),t+St(e.deprecationReason)}function Ea(e){return ce(e)+"directive @"+e.name+gr(e.args)+(e.isRepeatable?" repeatable":"")+" on "+e.locations.join(" | ")}function St(e){return e==null?"":e!==Fi?` @deprecated(reason: ${U({kind:u.STRING,value:e})})`:" @deprecated"}function Ta(e){return e.specifiedByURL==null?"":` @specifiedBy(url: ${U({kind:u.STRING,value:e.specifiedByURL})})`}function ce(e,n="",t=!0){const{description:i}=e;if(i==null)return"";const r=U({kind:u.STRING,value:i,block:kr(i)});return(n&&!t?` -`+n:n)+r.replace(/\n/g,` -`+n)+` -`}function lc(e){const n=[];for(const t of e)n.push(...t.definitions);return{kind:u.DOCUMENT,definitions:n}}function fc(e){const n=[],t=Object.create(null);for(const r of e.definitions)switch(r.kind){case u.OPERATION_DEFINITION:n.push(r);break;case u.FRAGMENT_DEFINITION:t[r.name.value]=ni(r.selectionSet);break}const i=Object.create(null);for(const r of n){const s=new Set;for(const a of ni(r.selectionSet))Ir(s,t,a);const o=r.name?r.name.value:"";i[o]={kind:u.DOCUMENT,definitions:e.definitions.filter(a=>a===r||a.kind===u.FRAGMENT_DEFINITION&&s.has(a.name.value))}}return i}function Ir(e,n,t){if(!e.has(t)){e.add(t);const i=n[t];if(i!==void 0)for(const r of i)Ir(e,n,r)}}function ni(e){const n=[];return pn(e,{FragmentSpread(t){n.push(t.name.value)}}),n}function dc(e){const n=Ti(e)?e:new ft(e),t=n.body,i=new di(n);let r="",s=!1;for(;i.advance().kind!==E.EOF;){const o=i.token,a=o.kind,c=!pi(o.kind);s&&(c||o.kind===E.SPREAD)&&(r+=" ");const l=t.slice(o.start,o.end);a===E.BLOCK_STRING?r+=fi(o.value,{minimize:!0}):r+=l,s=c}return r}function pc(e){const n=ya(e);if(n)throw n;return e}function ya(e){if(typeof e=="string"||A(!1,"Expected name to be a string."),e.startsWith("__"))return new h(`Name "${e}" must not begin with "__", which is reserved by GraphQL introspection.`);try{le(e)}catch(n){return n}}var G;(function(e){e.TYPE_REMOVED="TYPE_REMOVED",e.TYPE_CHANGED_KIND="TYPE_CHANGED_KIND",e.TYPE_REMOVED_FROM_UNION="TYPE_REMOVED_FROM_UNION",e.VALUE_REMOVED_FROM_ENUM="VALUE_REMOVED_FROM_ENUM",e.REQUIRED_INPUT_FIELD_ADDED="REQUIRED_INPUT_FIELD_ADDED",e.IMPLEMENTED_INTERFACE_REMOVED="IMPLEMENTED_INTERFACE_REMOVED",e.FIELD_REMOVED="FIELD_REMOVED",e.FIELD_CHANGED_KIND="FIELD_CHANGED_KIND",e.REQUIRED_ARG_ADDED="REQUIRED_ARG_ADDED",e.ARG_REMOVED="ARG_REMOVED",e.ARG_CHANGED_KIND="ARG_CHANGED_KIND",e.DIRECTIVE_REMOVED="DIRECTIVE_REMOVED",e.DIRECTIVE_ARG_REMOVED="DIRECTIVE_ARG_REMOVED",e.REQUIRED_DIRECTIVE_ARG_ADDED="REQUIRED_DIRECTIVE_ARG_ADDED",e.DIRECTIVE_REPEATABLE_REMOVED="DIRECTIVE_REPEATABLE_REMOVED",e.DIRECTIVE_LOCATION_REMOVED="DIRECTIVE_LOCATION_REMOVED"})(G||(G={}));var ve;(function(e){e.VALUE_ADDED_TO_ENUM="VALUE_ADDED_TO_ENUM",e.TYPE_ADDED_TO_UNION="TYPE_ADDED_TO_UNION",e.OPTIONAL_INPUT_FIELD_ADDED="OPTIONAL_INPUT_FIELD_ADDED",e.OPTIONAL_ARG_ADDED="OPTIONAL_ARG_ADDED",e.IMPLEMENTED_INTERFACE_ADDED="IMPLEMENTED_INTERFACE_ADDED",e.ARG_DEFAULT_VALUE_CHANGE="ARG_DEFAULT_VALUE_CHANGE"})(ve||(ve={}));function hc(e,n){return _r(e,n).filter(t=>t.type in G)}function mc(e,n){return _r(e,n).filter(t=>t.type in ve)}function _r(e,n){return[...Na(e,n),...va(e,n)]}function va(e,n){const t=[],i=we(e.getDirectives(),n.getDirectives());for(const r of i.removed)t.push({type:G.DIRECTIVE_REMOVED,description:`${r.name} was removed.`});for(const[r,s]of i.persisted){const o=we(r.args,s.args);for(const a of o.added)je(a)&&t.push({type:G.REQUIRED_DIRECTIVE_ARG_ADDED,description:`A required arg ${a.name} on directive ${r.name} was added.`});for(const a of o.removed)t.push({type:G.DIRECTIVE_ARG_REMOVED,description:`${a.name} was removed from ${r.name}.`});r.isRepeatable&&!s.isRepeatable&&t.push({type:G.DIRECTIVE_REPEATABLE_REMOVED,description:`Repeatable flag was removed from ${r.name}.`});for(const a of r.locations)s.locations.includes(a)||t.push({type:G.DIRECTIVE_LOCATION_REMOVED,description:`${a} was removed from ${r.name}.`})}return t}function Na(e,n){const t=[],i=we(Object.values(e.getTypeMap()),Object.values(n.getTypeMap()));for(const r of i.removed)t.push({type:G.TYPE_REMOVED,description:ht(r)?`Standard scalar ${r.name} was removed because it is not referenced anymore.`:`${r.name} was removed.`});for(const[r,s]of i.persisted)J(r)&&J(s)?t.push(..._a(r,s)):H(r)&&H(s)?t.push(...Ia(r,s)):C(r)&&C(s)?t.push(...ga(r,s)):F(r)&&F(s)?t.push(...ii(r,s),...ti(r,s)):$(r)&&$(s)?t.push(...ii(r,s),...ti(r,s)):r.constructor!==s.constructor&&t.push({type:G.TYPE_CHANGED_KIND,description:`${r.name} changed from ${ri(r)} to ${ri(s)}.`});return t}function ga(e,n){const t=[],i=we(Object.values(e.getFields()),Object.values(n.getFields()));for(const r of i.added)pt(r)?t.push({type:G.REQUIRED_INPUT_FIELD_ADDED,description:`A required field ${r.name} on input type ${e.name} was added.`}):t.push({type:ve.OPTIONAL_INPUT_FIELD_ADDED,description:`An optional field ${r.name} on input type ${e.name} was added.`});for(const r of i.removed)t.push({type:G.FIELD_REMOVED,description:`${e.name}.${r.name} was removed.`});for(const[r,s]of i.persisted)tn(r.type,s.type)||t.push({type:G.FIELD_CHANGED_KIND,description:`${e.name}.${r.name} changed type from ${String(r.type)} to ${String(s.type)}.`});return t}function Ia(e,n){const t=[],i=we(e.getTypes(),n.getTypes());for(const r of i.added)t.push({type:ve.TYPE_ADDED_TO_UNION,description:`${r.name} was added to union type ${e.name}.`});for(const r of i.removed)t.push({type:G.TYPE_REMOVED_FROM_UNION,description:`${r.name} was removed from union type ${e.name}.`});return t}function _a(e,n){const t=[],i=we(e.getValues(),n.getValues());for(const r of i.added)t.push({type:ve.VALUE_ADDED_TO_ENUM,description:`${r.name} was added to enum type ${e.name}.`});for(const r of i.removed)t.push({type:G.VALUE_REMOVED_FROM_ENUM,description:`${r.name} was removed from enum type ${e.name}.`});return t}function ti(e,n){const t=[],i=we(e.getInterfaces(),n.getInterfaces());for(const r of i.added)t.push({type:ve.IMPLEMENTED_INTERFACE_ADDED,description:`${r.name} added to interfaces implemented by ${e.name}.`});for(const r of i.removed)t.push({type:G.IMPLEMENTED_INTERFACE_REMOVED,description:`${e.name} no longer implements interface ${r.name}.`});return t}function ii(e,n){const t=[],i=we(Object.values(e.getFields()),Object.values(n.getFields()));for(const r of i.removed)t.push({type:G.FIELD_REMOVED,description:`${e.name}.${r.name} was removed.`});for(const[r,s]of i.persisted)t.push(...Oa(e,r,s)),en(r.type,s.type)||t.push({type:G.FIELD_CHANGED_KIND,description:`${e.name}.${r.name} changed type from ${String(r.type)} to ${String(s.type)}.`});return t}function Oa(e,n,t){const i=[],r=we(n.args,t.args);for(const s of r.removed)i.push({type:G.ARG_REMOVED,description:`${e.name}.${n.name} arg ${s.name} was removed.`});for(const[s,o]of r.persisted)if(!tn(s.type,o.type))i.push({type:G.ARG_CHANGED_KIND,description:`${e.name}.${n.name} arg ${s.name} has changed type from ${String(s.type)} to ${String(o.type)}.`});else if(s.defaultValue!==void 0)if(o.defaultValue===void 0)i.push({type:ve.ARG_DEFAULT_VALUE_CHANGE,description:`${e.name}.${n.name} arg ${s.name} defaultValue was removed.`});else{const c=si(s.defaultValue,s.type),l=si(o.defaultValue,o.type);c!==l&&i.push({type:ve.ARG_DEFAULT_VALUE_CHANGE,description:`${e.name}.${n.name} arg ${s.name} has changed defaultValue from ${c} to ${l}.`})}for(const s of r.added)je(s)?i.push({type:G.REQUIRED_ARG_ADDED,description:`A required arg ${s.name} on ${e.name}.${n.name} was added.`}):i.push({type:ve.OPTIONAL_ARG_ADDED,description:`An optional arg ${s.name} on ${e.name}.${n.name} was added.`});return i}function en(e,n){return j(e)?j(n)&&en(e.ofType,n.ofType)||S(n)&&en(e,n.ofType):S(e)?S(n)&&en(e.ofType,n.ofType):jn(n)&&e.name===n.name||S(n)&&en(e,n.ofType)}function tn(e,n){return j(e)?j(n)&&tn(e.ofType,n.ofType):S(e)?S(n)&&tn(e.ofType,n.ofType)||!S(n)&&tn(e.ofType,n):jn(n)&&e.name===n.name}function ri(e){if(fe(e))return"a Scalar type";if(F(e))return"an Object type";if($(e))return"an Interface type";if(H(e))return"a Union type";if(J(e))return"an Enum type";if(C(e))return"an Input type";Q(!1,"Unexpected type: "+T(e))}function si(e,n){const t=Ve(e,n);return t!=null||Q(!1),U(Qn(t))}function we(e,n){const t=[],i=[],r=[],s=be(e,({name:a})=>a),o=be(n,({name:a})=>a);for(const a of e){const c=o[a.name];c===void 0?i.push(a):r.push([a,c])}for(const a of n)s[a.name]===void 0&&t.push(a);return{added:t,persisted:r,removed:i}}export{Ke as BREAK,G as BreakingChangeType,Fi as DEFAULT_DEPRECATION_REASON,ve as DangerousChangeType,b as DirectiveLocation,As as ExecutableDefinitionsRule,ws as FieldsOnCorrectTypeRule,Fs as FragmentsOnCompositeTypesRule,zn as GRAPHQL_MAX_INT,Hn as GRAPHQL_MIN_INT,re as GraphQLBoolean,Et as GraphQLDeprecatedDirective,Ne as GraphQLDirective,Me as GraphQLEnumType,h as GraphQLError,ps as GraphQLFloat,wi as GraphQLID,Ri as GraphQLIncludeDirective,cn as GraphQLInputObjectType,ds as GraphQLInt,on as GraphQLInterfaceType,W as GraphQLList,w as GraphQLNonNull,Te as GraphQLObjectType,$i as GraphQLOneOfDirective,Ae as GraphQLScalarType,mn as GraphQLSchema,Li as GraphQLSkipDirective,ki as GraphQLSpecifiedByDirective,B as GraphQLString,an as GraphQLUnionType,u as Kind,ks as KnownArgumentNamesRule,Hi as KnownDirectivesRule,xs as KnownFragmentNamesRule,Wi as KnownTypeNamesRule,di as Lexer,wr as Location,Ms as LoneAnonymousOperationRule,Us as LoneSchemaDefinitionRule,Ps as MaxIntrospectionDepthRule,Za as NoDeprecatedCustomRule,Gs as NoFragmentCyclesRule,ec as NoSchemaIntrospectionCustomRule,Bs as NoUndefinedVariablesRule,Qs as NoUnusedFragmentsRule,Ys as NoUnusedVariablesRule,z as OperationTypeNode,Js as OverlappingFieldsCanBeMergedRule,eo as PossibleFragmentSpreadsRule,to as PossibleTypeExtensionsRule,oo as ProvidedRequiredArgumentsRule,co as ScalarLeafsRule,Dn as SchemaMetaFieldDef,Eo as SingleFieldSubscriptionsRule,ft as Source,ai as Token,E as TokenKind,Qi as TypeInfo,V as TypeKind,Sn as TypeMetaFieldDef,An as TypeNameMetaFieldDef,To as UniqueArgumentDefinitionNamesRule,rr as UniqueArgumentNamesRule,yo as UniqueDirectiveNamesRule,sr as UniqueDirectivesPerLocationRule,vo as UniqueEnumValueNamesRule,No as UniqueFieldDefinitionNamesRule,Io as UniqueFragmentNamesRule,or as UniqueInputFieldNamesRule,_o as UniqueOperationNamesRule,Oo as UniqueOperationTypesRule,bo as UniqueTypeNamesRule,Do as UniqueVariableNamesRule,xo as ValidationContext,So as ValuesOfCorrectTypeRule,wo as VariablesAreInputTypesRule,Ro as VariablesInAllowedPositionRule,xi as __Directive,Ci as __DirectiveLocation,Ui as __EnumValue,Mi as __Field,Gn as __InputValue,yt as __Schema,Ee as __Type,ji as __TypeKind,Ba as assertAbstractType,Ga as assertCompositeType,qa as assertDirective,Va as assertEnumType,os as assertEnumValueName,xa as assertInputObjectType,Ua as assertInputType,cs as assertInterfaceType,Pa as assertLeafType,Ca as assertListType,le as assertName,Ya as assertNamedType,Ma as assertNonNullType,us as assertNullableType,as as assertObjectType,ja as assertOutputType,ka as assertScalarType,Pi as assertSchema,Fa as assertType,$a as assertUnionType,pc as assertValidName,Bi as assertValidSchema,Qa as assertWrappingType,Ve as astFromValue,sa as buildASTSchema,rc as buildClientSchema,oc as buildSchema,uo as coerceInputValue,lc as concatAST,na as createSourceEventStream,Kt as defaultFieldResolver,Ko as defaultTypeResolver,Ut as doTypesOverlap,bt as execute,qo as executeSync,sc as extendSchema,hc as findBreakingChanges,mc as findDangerousChanges,Aa as formatError,It as getArgumentValues,un as getDirectiveValues,sn as getEnterLeaveForKind,ia as getIntrospectionQuery,et as getLocation,ee as getNamedType,gi as getNullableType,nc as getOperationAST,tc as getOperationRootType,fo as getVariableValues,La as getVisitFn,Ha as graphql,Wa as graphqlSync,ic as introspectionFromSchema,Bn as introspectionTypes,_e as isAbstractType,Se as isCompositeType,Qt as isConstValueNode,Ja as isDefinitionNode,mt as isDirective,J as isEnumType,st as isEqualType,qi as isExecutableDefinitionNode,C as isInputObjectType,ie as isInputType,$ as isInterfaceType,ze as isIntrospectionType,De as isLeafType,j as isListType,jn as isNamedType,S as isNonNullType,Ni as isNullableType,F as isObjectType,xe as isOutputType,je as isRequiredArgument,pt as isRequiredInputField,fe as isScalarType,hs as isSchema,Xa as isSelectionNode,Vi as isSpecifiedDirective,ht as isSpecifiedScalarType,Mn as isType,En as isTypeDefinitionNode,Nt as isTypeExtensionNode,za as isTypeNode,qe as isTypeSubTypeOf,Ji as isTypeSystemDefinitionNode,Xi as isTypeSystemExtensionNode,H as isUnionType,ya as isValidNameError,Ss as isValueNode,Un as isWrappingType,ac as lexicographicSortSchema,ln as locatedError,dt as parse,wa as parseConstValue,Ra as parseType,Hr as parseValue,U as print,Sa as printError,uc as printIntrospectionSchema,Sr as printLocation,cc as printSchema,oi as printSourceLocation,ua as printType,Fo as recommendedRules,_i as resolveObjMapThunk,Ii as resolveReadonlyArrayThunk,Z as responsePathAsArray,fc as separateOperations,Pe as specifiedDirectives,ko as specifiedRules,Pn as specifiedScalarTypes,dc as stripIgnoredCharacters,Ka as subscribe,X as syntaxError,ae as typeFromAST,Co as validate,Gi as validateSchema,Ie as valueFromAST,rt as valueFromASTUntyped,ba as version,Da as versionInfo,pn as visit,vi as visitInParallel,Yi as visitWithTypeInfo}; diff --git a/docs/assets/worker-58115eaa.js b/docs/assets/worker-58115eaa.js deleted file mode 100644 index 4d98f34..0000000 --- a/docs/assets/worker-58115eaa.js +++ /dev/null @@ -1,301 +0,0 @@ -var $w=Object.defineProperty;var Ww=(e,t,n)=>t in e?$w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var je=(e,t,n)=>(Ww(e,typeof t!="symbol"?t+"":t,n),n),Mu=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var _n=(e,t,n)=>(Mu(e,t,"read from private field"),n?n.call(e):t.get(e)),ei=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},xu=(e,t,n,r)=>(Mu(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);var $r=(e,t,n)=>(Mu(e,t,"access private method"),n);import{_ as Hw,C as qi,c as re,n as Gs,g as Vw,b as Xe,r as $i}from"./index-07c9b5b2.js";var Jw=/(%?)(%([sdijo]))/g;function Kw(e,t){switch(t){case"s":return e;case"d":case"i":return Number(e);case"j":return JSON.stringify(e);case"o":{if(typeof e=="string")return e;const n=JSON.stringify(e);return n==="{}"||n==="[]"||/^\[object .+?\]$/.test(n)?e:n}}}function Oo(e,...t){if(t.length===0)return e;let n=0,r=e.replace(Jw,(a,o,i,s)=>{const l=t[n],u=Kw(l,s);return o?a:(n++,u)});return n{if(!e)throw new Yw(t,...n)};Kt.as=(e,t,n,...r)=>{if(!t){const a=r.length===0?n:Oo(n,...r);let o;try{o=Reflect.construct(e,[a])}catch{o=e(a)}throw o}};const Zw="[MSW]";function Qc(e,...t){const n=Oo(e,...t);return`${Zw} ${n}`}function Xw(e,...t){console.warn(Qc(e,...t))}function ek(e,...t){console.error(Qc(e,...t))}const Pe={formatMessage:Qc,warn:Xw,error:ek};class ef extends Error{constructor(t){super(t),this.name="InternalError"}}function tk(){Kt(typeof URL<"u",Pe.formatMessage(`Global "URL" class is not defined. This likely means that you're running MSW in an environment that doesn't support all Node.js standard API (e.g. React Native). If that's the case, please use an appropriate polyfill for the "URL" class, like "react-native-url-polyfill".`))}var nk=class extends Error{constructor(t,n,r){super(`Possible EventEmitter memory leak detected. ${r} ${n.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=t,this.type=n,this.count=r,this.name="MaxListenersExceededWarning"}},tm=class{static listenerCount(t,n){return t.listenerCount(n)}constructor(){this.events=new Map,this.maxListeners=tm.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}_emitInternalEvent(t,n,r){this.emit(t,n,r)}_getListeners(t){return Array.prototype.concat.apply([],this.events.get(t))||[]}_removeListener(t,n){const r=t.indexOf(n);return r>-1&&t.splice(r,1),[]}_wrapOnceListener(t,n){const r=(...a)=>(this.removeListener(t,r),n.apply(this,a));return Object.defineProperty(r,"name",{value:n.name}),r}setMaxListeners(t){return this.maxListeners=t,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(t,...n){const r=this._getListeners(t);return r.forEach(a=>{a.apply(this,n)}),r.length>0}addListener(t,n){this._emitInternalEvent("newListener",t,n);const r=this._getListeners(t).concat(n);if(this.events.set(t,r),this.maxListeners>0&&this.listenerCount(t)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const a=new nk(this,t,this.listenerCount(t));console.warn(a)}return this}on(t,n){return this.addListener(t,n)}once(t,n){return this.addListener(t,this._wrapOnceListener(t,n))}prependListener(t,n){const r=this._getListeners(t);if(r.length>0){const a=[n].concat(r);this.events.set(t,a)}else this.events.set(t,r.concat(n));return this}prependOnceListener(t,n){return this.prependListener(t,this._wrapOnceListener(t,n))}removeListener(t,n){const r=this._getListeners(t);return r.length>0&&(this._removeListener(r,n),this.events.set(t,r),this._emitInternalEvent("removeListener",t,n)),this}off(t,n){return this.removeListener(t,n)}removeAllListeners(t){return t?this.events.delete(t):this.events.clear(),this}listeners(t){return Array.from(this._getListeners(t))}listenerCount(t){return this._getListeners(t).length}rawListeners(t){return this.listeners(t)}},Wi=tm;Wi.defaultMaxListeners=10;function rk(e,t){const n=e.emit;if(n._isPiped)return;const r=function(o,...i){return t.emit(o,...i),n.call(this,o,...i)};r._isPiped=!0,e.emit=r}function ak(e){const t=[...e];return Object.freeze(t),t}class ok{constructor(){je(this,"subscriptions",[])}dispose(){let t;for(;t=this.subscriptions.shift();)t()}}class ik{constructor(t){je(this,"handlers");this.initialHandlers=t,this.handlers=[...t]}prepend(t){this.handlers.unshift(...t)}reset(t){this.handlers=t.length>0?[...t]:[...this.initialHandlers]}currentHandlers(){return this.handlers}}class sk extends ok{constructor(...n){super();je(this,"handlersController");je(this,"emitter");je(this,"publicEmitter");je(this,"events");Kt(this.validateHandlers(n),Pe.formatMessage("Failed to apply given request handlers: invalid input. Did you forget to spread the request handlers Array?")),this.handlersController=new ik(n),this.emitter=new Wi,this.publicEmitter=new Wi,rk(this.emitter,this.publicEmitter),this.events=this.createLifeCycleEvents(),this.subscriptions.push(()=>{this.emitter.removeAllListeners(),this.publicEmitter.removeAllListeners()})}validateHandlers(n){return n.every(r=>!Array.isArray(r))}use(...n){Kt(this.validateHandlers(n),Pe.formatMessage('Failed to call "use()" with the given request handlers: invalid input. Did you forget to spread the array of request handlers?')),this.handlersController.prepend(n)}restoreHandlers(){this.handlersController.currentHandlers().forEach(n=>{"isUsed"in n&&(n.isUsed=!1)})}resetHandlers(...n){this.handlersController.reset(n)}listHandlers(){return ak(this.handlersController.currentHandlers())}createLifeCycleEvents(){return{on:(...n)=>this.publicEmitter.on(...n),removeListener:(...n)=>this.publicEmitter.removeListener(...n),removeAllListeners:(...n)=>this.publicEmitter.removeAllListeners(...n)}}}const lk=/[\/\\]msw[\/\\]src[\/\\](.+)/,uk=/(node_modules)?[\/\\]lib[\/\\](core|browser|node|native|iife)[\/\\]|^[^\/\\]*$/;function nm(e){const t=e.stack;if(!t)return;const r=t.split(` -`).slice(1).find(o=>!(lk.test(o)||uk.test(o)));return r?r.replace(/\s*at [^()]*\(([^)]+)\)/,"$1").replace(/^@/,""):void 0}function ck(e){return e?Reflect.has(e,Symbol.iterator)||Reflect.has(e,Symbol.asyncIterator):!1}const Li=class Li{constructor(t){je(this,"info");je(this,"isUsed");je(this,"resolver");je(this,"resolverIterator");je(this,"resolverIteratorResult");je(this,"options");this.resolver=t.resolver,this.options=t.options;const n=nm(new Error);this.info={...t.info,callFrame:n},this.isUsed=!1}async parse(t){return{}}async test(t){const n=await this.parse({request:t.request,resolutionContext:t.resolutionContext});return this.predicate({request:t.request,parsedResult:n,resolutionContext:t.resolutionContext})}extendResolverArgs(t){return{}}cloneRequestOrGetFromCache(t){const n=Li.cache.get(t);if(typeof n<"u")return n;const r=t.clone();return Li.cache.set(t,r),r}async run(t){var c,d;if(this.isUsed&&((c=this.options)!=null&&c.once))return null;const n=this.cloneRequestOrGetFromCache(t.request),r=await this.parse({request:t.request,resolutionContext:t.resolutionContext});if(!this.predicate({request:t.request,parsedResult:r,resolutionContext:t.resolutionContext})||this.isUsed&&((d=this.options)!=null&&d.once))return null;this.isUsed=!0;const o=this.wrapResolver(this.resolver),i=this.extendResolverArgs({request:t.request,parsedResult:r}),l=await o({...i,requestId:t.requestId,request:t.request}).catch(h=>{if(h instanceof Response)return h;throw h});return this.createExecutionResult({request:n,requestId:t.requestId,response:l,parsedResult:r})}wrapResolver(t){return async n=>{var i;if(!this.resolverIterator){const s=await t(n);if(!ck(s))return s;this.resolverIterator=Symbol.iterator in s?s[Symbol.iterator]():s[Symbol.asyncIterator]()}this.isUsed=!1;const{done:r,value:a}=await this.resolverIterator.next(),o=await a;return o&&(this.resolverIteratorResult=o.clone()),r?(this.isUsed=!0,(i=this.resolverIteratorResult)==null?void 0:i.clone()):o}}createExecutionResult(t){return{handler:this,request:t.request,requestId:t.requestId,response:t.response,parsedResult:t.parsedResult}}};je(Li,"cache",new WeakMap);let ho=Li;function dk(e,t){return e.toLowerCase()===t.toLowerCase()}function rm(e){return e<300?"#69AB32":e<400?"#F0BB4B":"#E95F5D"}function Zn(e){const t=new Date,n=`${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}:${t.getSeconds().toString().padStart(2,"0")}`;return e!=null&&e.milliseconds?`${n}.${t.getMilliseconds().toString().padStart(3,"0")}`:n}async function am(e){const n=await e.clone().text();return{url:new URL(e.url),method:e.method,headers:Object.fromEntries(e.headers.entries()),body:n}}var fk=Object.create,om=Object.defineProperty,hk=Object.getOwnPropertyDescriptor,im=Object.getOwnPropertyNames,mk=Object.getPrototypeOf,pk=Object.prototype.hasOwnProperty,sm=(e,t)=>function(){return t||(0,e[im(e)[0]])((t={exports:{}}).exports,t),t.exports},gk=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of im(t))!pk.call(e,a)&&a!==n&&om(e,a,{get:()=>t[a],enumerable:!(r=hk(t,a))||r.enumerable});return e},yk=(e,t,n)=>(n=e!=null?fk(mk(e)):{},gk(t||!e||!e.__esModule?om(n,"default",{value:e,enumerable:!0}):n,e)),bk=sm({"node_modules/statuses/codes.json"(e,t){t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}}}),wk=sm({"node_modules/statuses/index.js"(e,t){var n=bk();t.exports=s,s.message=n,s.code=r(n),s.codes=a(n),s.redirect={300:!0,301:!0,302:!0,303:!0,305:!0,307:!0,308:!0},s.empty={204:!0,205:!0,304:!0},s.retry={502:!0,503:!0,504:!0};function r(l){var u={};return Object.keys(l).forEach(function(d){var h=l[d],m=Number(d);u[h.toLowerCase()]=m}),u}function a(l){return Object.keys(l).map(function(c){return Number(c)})}function o(l){var u=l.toLowerCase();if(!Object.prototype.hasOwnProperty.call(s.code,u))throw new Error('invalid status message: "'+l+'"');return s.code[u]}function i(l){if(!Object.prototype.hasOwnProperty.call(s.message,l))throw new Error("invalid status code: "+l);return s.message[l]}function s(l){if(typeof l=="number")return i(l);if(typeof l!="string")throw new TypeError("code must be a number or string");var u=parseInt(l,10);return isNaN(u)?o(l):i(u)}}}),kk=yk(wk(),1),lm=kk.default;/*! Bundled license information: - -statuses/index.js: - (*! - * statuses - * Copyright(c) 2014 Jonathan Ong - * Copyright(c) 2016 Douglas Christopher Wilson - * MIT Licensed - *) -*/const{message:vk}=lm;async function um(e){const t=e.clone(),n=await t.text(),r=t.status||200,a=t.statusText||vk[r]||"OK";return{status:r,statusText:a,headers:Object.fromEntries(t.headers.entries()),body:n}}function jk(e){for(var t=[],n=0;n=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122||i===95){a+=e[o++];continue}break}if(!a)throw new TypeError("Missing parameter name at ".concat(n));t.push({type:"NAME",index:n,value:a}),n=o;continue}if(r==="("){var s=1,l="",o=n+1;if(e[o]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(o));for(;o-1)return!0}return!1},f=function(q){var Y=s[s.length-1],ee=q||(Y&&typeof Y=="string"?Y:"");if(Y&&!ee)throw new TypeError('Must have text between two parameters, missing text after "'.concat(Y.name,'"'));return!ee||y(ee)?"[^".concat(cr(i),"]+?"):"(?:(?!".concat(cr(ee),")[^").concat(cr(i),"])+?")};u)?(?!\?)/g,r=0,a=n.exec(e.source);a;)t.push({name:a[1]||r++,prefix:"",suffix:"",modifier:"",pattern:""}),a=n.exec(e.source);return e}function Sk(e,t,n){var r=e.map(function(a){return dm(a,t,n).source});return new RegExp("(?:".concat(r.join("|"),")"),cm(n))}function Pk(e,t,n){return Tk(_k(e,n),t,n)}function Tk(e,t,n){n===void 0&&(n={});for(var r=n.strict,a=r===void 0?!1:r,o=n.start,i=o===void 0?!0:o,s=n.end,l=s===void 0?!0:s,u=n.encode,c=u===void 0?function(Y){return Y}:u,d=n.delimiter,h=d===void 0?"/#?":d,m=n.endsWith,y=m===void 0?"":m,f="[".concat(cr(y),"]|$"),j="[".concat(cr(h),"]"),T=i?"^":"",E=0,b=e;E-1:J===void 0;a||(T+="(?:".concat(j,"(?=").concat(f,"))?")),q||(T+="(?=".concat(j,"|").concat(f,")"))}return new RegExp(T,cm(n))}function dm(e,t,n){return e instanceof RegExp?Ak(e,t):Array.isArray(e)?Sk(e,t,n):Pk(e,t,n)}new TextEncoder;function fm(){if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof process<"u"){const e=process.type;return e==="renderer"||e==="worker"?!1:!!(process.versions&&process.versions.node)}return!1}var Bk=Object.defineProperty,Mk=(e,t)=>{for(var n in t)Bk(e,n,{get:t[n],enumerable:!0})},fc={};Mk(fc,{blue:()=>Ik,gray:()=>hc,green:()=>Rk,red:()=>Ok,yellow:()=>xk});function xk(e){return`\x1B[33m${e}\x1B[0m`}function Ik(e){return`\x1B[34m${e}\x1B[0m`}function hc(e){return`\x1B[90m${e}\x1B[0m`}function Ok(e){return`\x1B[31m${e}\x1B[0m`}function Rk(e){return`\x1B[32m${e}\x1B[0m`}var gl=fm(),hm=class{constructor(t){je(this,"prefix");this.name=t,this.prefix=`[${this.name}]`;const n=tf("DEBUG"),r=tf("LOG_LEVEL");n==="1"||n==="true"||typeof n<"u"&&this.name.startsWith(n)?(this.debug=ti(r,"debug")?rn:this.debug,this.info=ti(r,"info")?rn:this.info,this.success=ti(r,"success")?rn:this.success,this.warning=ti(r,"warning")?rn:this.warning,this.error=ti(r,"error")?rn:this.error):(this.info=rn,this.success=rn,this.warning=rn,this.error=rn,this.only=rn)}extend(t){return new hm(`${this.name}:${t}`)}debug(t,...n){this.logEntry({level:"debug",message:hc(t),positionals:n,prefix:this.prefix,colors:{prefix:"gray"}})}info(t,...n){this.logEntry({level:"info",message:t,positionals:n,prefix:this.prefix,colors:{prefix:"blue"}});const r=new Nk;return(a,...o)=>{r.measure(),this.logEntry({level:"info",message:`${a} ${hc(`${r.deltaTime}ms`)}`,positionals:o,prefix:this.prefix,colors:{prefix:"blue"}})}}success(t,...n){this.logEntry({level:"info",message:t,positionals:n,prefix:`✔ ${this.prefix}`,colors:{timestamp:"green",prefix:"green"}})}warning(t,...n){this.logEntry({level:"warning",message:t,positionals:n,prefix:`⚠ ${this.prefix}`,colors:{timestamp:"yellow",prefix:"yellow"}})}error(t,...n){this.logEntry({level:"error",message:t,positionals:n,prefix:`✖ ${this.prefix}`,colors:{timestamp:"red",prefix:"red"}})}only(t){t()}createEntry(t,n){return{timestamp:new Date,level:t,message:n}}logEntry(t){const{level:n,message:r,prefix:a,colors:o,positionals:i=[]}=t,s=this.createEntry(n,r),l=(o==null?void 0:o.timestamp)||"gray",u=(o==null?void 0:o.prefix)||"gray",c={timestamp:fc[l],prefix:fc[u]};this.getWriter(n)([c.timestamp(this.formatTimestamp(s.timestamp))].concat(a!=null?c.prefix(a):[]).concat(nf(r)).join(" "),...i.map(nf))}formatTimestamp(t){return`${t.toLocaleTimeString("en-GB")}:${t.getMilliseconds()}`}getWriter(t){switch(t){case"debug":case"success":case"info":return zk;case"warning":return Dk;case"error":return Uk}}},Nk=class{constructor(){je(this,"startTime");je(this,"endTime");je(this,"deltaTime");this.startTime=performance.now()}measure(){this.endTime=performance.now();const t=this.endTime-this.startTime;this.deltaTime=t.toFixed(2)}},rn=()=>{};function zk(e,...t){if(gl){process.stdout.write(Oo(e,...t)+` -`);return}console.log(e,...t)}function Dk(e,...t){if(gl){process.stderr.write(Oo(e,...t)+` -`);return}console.warn(e,...t)}function Uk(e,...t){if(gl){process.stderr.write(Oo(e,...t)+` -`);return}console.error(e,...t)}function tf(e){var t;return gl?process.env[e]:(t=globalThis[e])==null?void 0:t.toString()}function ti(e,t){return e!==void 0&&e!==t}function nf(e){return typeof e>"u"?"undefined":e===null?"null":typeof e=="string"?e:typeof e=="object"?JSON.stringify(e):e.toString()}function rf(e){return globalThis[e]||void 0}function Fk(e,t){globalThis[e]=t}function Lk(e){delete globalThis[e]}var qk=class{constructor(t){this.symbol=t,this.readyState="INACTIVE",this.emitter=new Wi,this.subscriptions=[],this.logger=new hm(t.description),this.emitter.setMaxListeners(0),this.logger.info("constructing the interceptor...")}checkEnvironment(){return!0}apply(){const t=this.logger.extend("apply");if(t.info("applying the interceptor..."),this.readyState==="APPLIED"){t.info("intercepted already applied!");return}if(!this.checkEnvironment()){t.info("the interceptor cannot be applied in this environment!");return}this.readyState="APPLYING";const r=this.getInstance();if(r){t.info("found a running instance, reusing..."),this.on=(a,o)=>(t.info('proxying the "%s" listener',a),r.emitter.addListener(a,o),this.subscriptions.push(()=>{r.emitter.removeListener(a,o),t.info('removed proxied "%s" listener!',a)}),this),this.readyState="APPLIED";return}t.info("no running instance found, setting up a new instance..."),this.setup(),this.setInstance(),this.readyState="APPLIED"}setup(){}on(t,n){const r=this.logger.extend("on");return this.readyState==="DISPOSING"||this.readyState==="DISPOSED"?(r.info("cannot listen to events, already disposed!"),this):(r.info('adding "%s" event listener:',t,n),this.emitter.on(t,n),this)}once(t,n){return this.emitter.once(t,n),this}off(t,n){return this.emitter.off(t,n),this}removeAllListeners(t){return this.emitter.removeAllListeners(t),this}dispose(){const t=this.logger.extend("dispose");if(this.readyState==="DISPOSED"){t.info("cannot dispose, already disposed!");return}if(t.info("disposing the interceptor..."),this.readyState="DISPOSING",!this.getInstance()){t.info("no interceptors running, skipping dispose...");return}if(this.clearInstance(),t.info("global symbol deleted:",rf(this.symbol)),this.subscriptions.length>0){t.info("disposing of %d subscriptions...",this.subscriptions.length);for(const n of this.subscriptions)n();this.subscriptions=[],t.info("disposed of all subscriptions!",this.subscriptions.length)}this.emitter.removeAllListeners(),t.info("destroyed the listener!"),this.readyState="DISPOSED"}getInstance(){var t;const n=rf(this.symbol);return this.logger.info("retrieved global instance:",(t=n==null?void 0:n.constructor)==null?void 0:t.name),n}setInstance(){Fk(this.symbol,this),this.logger.info("set global instance!",this.symbol.description)}clearInstance(){Lk(this.symbol),this.logger.info("cleared global instance!",this.symbol.description)}};function mm(){return Math.random().toString(16).slice(2)}function $k(e,t=!0){return[t&&e.origin,e.pathname].filter(Boolean).join("")}const Wk=/[\?|#].*$/g;function Hk(e){return new URL(`/${e}`,"http://localhost").searchParams}function pm(e){return e.endsWith("?")?e:e.replace(Wk,"")}function Vk(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}function Jk(e,t){if(Vk(e)||e.startsWith("*"))return e;const n=t||typeof document<"u"&&document.baseURI;return n?decodeURI(new URL(encodeURI(e),n).href):e}function Kk(e,t){if(e instanceof RegExp)return e;const n=Jk(e,t);return pm(n)}function Gk(e){return e.replace(/([:a-zA-Z_-]*)(\*{1,2})+/g,(t,n,r)=>{const a="(.*)";return n?n.startsWith(":")?`${n}${r}`:`${n}${a}`:a}).replace(/([^\/])(:)(?=\d+)/,"$1\\$2").replace(/^([^\/]+)(:)(?=\/\/)/,"$1\\$2")}function Yc(e,t,n){const r=Kk(t,n),a=typeof r=="string"?Gk(r):r,o=$k(e),i=Ck(a,{decode:decodeURIComponent})(o),s=i&&i.params||{};return{matches:i!==!1,params:s}}function La(e){if(typeof location>"u")return e.toString();const t=e instanceof URL?e:new URL(e);return t.origin===location.origin?t.pathname:t.origin+t.pathname}var Qk=Object.create,gm=Object.defineProperty,Yk=Object.getOwnPropertyDescriptor,ym=Object.getOwnPropertyNames,Zk=Object.getPrototypeOf,Xk=Object.prototype.hasOwnProperty,ev=(e,t)=>function(){return t||(0,e[ym(e)[0]])((t={exports:{}}).exports,t),t.exports},tv=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ym(t))!Xk.call(e,a)&&a!==n&&gm(e,a,{get:()=>t[a],enumerable:!(r=Yk(t,a))||r.enumerable});return e},nv=(e,t,n)=>(n=e!=null?Qk(Zk(e)):{},tv(t||!e||!e.__esModule?gm(n,"default",{value:e,enumerable:!0}):n,e)),rv=ev({"node_modules/cookie/index.js"(e){e.parse=r,e.serialize=a;var t=Object.prototype.toString,n=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function r(u,c){if(typeof u!="string")throw new TypeError("argument str must be a string");for(var d={},h=c||{},m=h.decode||o,y=0;ytypeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),ut=(e,t)=>function(){return t||(0,e[wm(e)[0]])((t={exports:{}}).exports,t),t.exports},cv=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of wm(t))!lv.call(e,a)&&a!==n&&bm(e,a,{get:()=>t[a],enumerable:!(r=iv(t,a))||r.enumerable});return e},dv=(e,t,n)=>(n=e!=null?ov(sv(e)):{},cv(t||!e||!e.__esModule?bm(n,"default",{value:e,enumerable:!0}):n,e)),km=ut({"node_modules/punycode/punycode.js"(e,t){var n=2147483647,r=36,a=1,o=26,i=38,s=700,l=72,u=128,c="-",d=/^xn--/,h=/[^\0-\x7F]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=r-a,j=Math.floor,T=String.fromCharCode;function E(B){throw new RangeError(y[B])}function b(B,H){const ie=[];let se=B.length;for(;se--;)ie[se]=H(B[se]);return ie}function g(B,H){const ie=B.split("@");let se="";ie.length>1&&(se=ie[0]+"@",B=ie[1]),B=B.replace(m,".");const M=B.split("."),Ie=b(M,H).join(".");return se+Ie}function A(B){const H=[];let ie=0;const se=B.length;for(;ie=55296&&M<=56319&&ieString.fromCodePoint(...B),x=function(B){return B>=48&&B<58?26+(B-48):B>=65&&B<91?B-65:B>=97&&B<123?B-97:r},J=function(B,H){return B+22+75*(B<26)-((H!=0)<<5)},q=function(B,H,ie){let se=0;for(B=ie?j(B/s):B>>1,B+=j(B/H);B>f*o>>1;se+=r)B=j(B/f);return j(se+(f+1)*B/(B+i))},Y=function(B){const H=[],ie=B.length;let se=0,M=u,Ie=l,xe=B.lastIndexOf(c);xe<0&&(xe=0);for(let qe=0;qe=128&&E("not-basic"),H.push(B.charCodeAt(qe));for(let qe=xe>0?xe+1:0;qe=ie&&E("invalid-input");const Ke=x(B.charCodeAt(qe++));Ke>=r&&E("invalid-input"),Ke>j((n-se)/tt)&&E("overflow"),se+=Ke*tt;const Oe=Ne<=Ie?a:Ne>=Ie+o?o:Ne-Ie;if(Kej(n/ot)&&E("overflow"),tt*=ot}const at=H.length+1;Ie=q(se-Ve,at,Ve==0),j(se/at)>n-M&&E("overflow"),M+=j(se/at),se%=at,H.splice(se++,0,M)}return String.fromCodePoint(...H)},ee=function(B){const H=[];B=A(B);const ie=B.length;let se=u,M=0,Ie=l;for(const Ve of B)Ve<128&&H.push(T(Ve));const xe=H.length;let qe=xe;for(xe&&H.push(c);qe=se&&ttj((n-M)/at)&&E("overflow"),M+=(Ve-se)*at,se=Ve;for(const tt of B)if(ttn&&E("overflow"),tt===se){let Ne=M;for(let Ke=r;;Ke+=r){const Oe=Ke<=Ie?a:Ke>=Ie+o?o:Ke-Ie;if(Ne=2&&(ee=ee.slice(2)):y(x)?ee=_[4]:x?J&&(ee=ee.slice(2)):Y>=2&&y(A.protocol)&&(ee=_[4]),{protocol:x,slashes:J||y(x),slashesCount:Y,rest:ee}}function j(g,A){if(g==="")return A;for(var _=(A||"/").split("/").slice(0,-1).concat(g.split("/")),x=_.length,J=_[x-1],q=!1,Y=0;x--;)_[x]==="."?_.splice(x,1):_[x]===".."?(_.splice(x,1),Y++):Y&&(x===0&&(q=!0),_.splice(x,1),Y--);return q&&_.unshift(""),(J==="."||J==="..")&&_.push(""),_.join("/")}function T(g,A,_){if(g=c(g),g=g.replace(o,""),!(this instanceof T))return new T(g,A,_);var x,J,q,Y,ee,ce,N=d.slice(),R=typeof A,B=this,H=0;for(R!=="object"&&R!=="string"&&(_=A,A=null),_&&typeof _!="function"&&(_=r.parse),A=m(A),J=f(g||"",A),x=!J.protocol&&!J.slashes,B.slashes=J.slashes||x&&A.slashes,B.protocol=J.protocol||A.protocol||"",g=J.rest,(J.protocol==="file:"&&(J.slashesCount!==2||u.test(g))||!J.slashes&&(J.protocol||J.slashesCount<2||!y(B.protocol)))&&(N[3]=[/(.*)/,"pathname"]);H255)return"DOMAIN_TOO_LONG";for(var o=a.split("."),i,s=0;s63)return"LABEL_TOO_LONG";if(i.charAt(0)==="-")return"LABEL_STARTS_WITH_DASH";if(i.charAt(i.length-1)==="-")return"LABEL_ENDS_WITH_DASH";if(!/^[a-z0-9\-]+$/.test(i))return"LABEL_INVALID_CHARS"}},e.parse=function(r){if(typeof r!="string")throw new TypeError("Domain name must be a string.");var a=r.slice(0).toLowerCase();a.charAt(a.length-1)==="."&&(a=a.slice(0,a.length-1));var o=n.validate(a);if(o)return{input:r,error:{message:e.errorCodes[o],code:o}};var i={input:r,tld:null,sld:null,domain:null,subdomain:null,listed:!1},s=a.split(".");if(s[s.length-1]==="local")return i;var l=function(){return/xn--/.test(a)&&(i.domain&&(i.domain=t.toASCII(i.domain)),i.subdomain&&(i.subdomain=t.toASCII(i.subdomain))),i},u=n.findRule(a);if(!u)return s.length<2?i:(i.tld=s.pop(),i.sld=s.pop(),i.domain=[i.sld,i.tld].join("."),s.length&&(i.subdomain=s.pop()),l());i.listed=!0;var c=u.suffix.split("."),d=s.slice(0,s.length-c.length);return u.exception&&d.push(c.shift()),i.tld=c.join("."),!d.length||(u.wildcard&&(c.unshift(d.pop()),i.tld=c.join(".")),!d.length)||(i.sld=d.pop(),i.domain=[i.sld,i.tld].join("."),d.length&&(i.subdomain=d.join("."))),l()},e.get=function(r){return r&&e.parse(r).domain||null},e.isValid=function(r){var a=e.parse(r);return!!(a.domain&&a.listed)}}}),vm=ut({"node_modules/tough-cookie/lib/pubsuffix-psl.js"(e){var t=gv(),n=["local","example","invalid","localhost","test"],r=["localhost","invalid"];function a(o,i={}){const s=o.split("."),l=s[s.length-1],u=!!i.allowSpecialUseDomain,c=!!i.ignoreError;if(u&&n.includes(l)){if(s.length>1)return`${s[s.length-2]}.${l}`;if(r.includes(l))return`${l}`}if(!c&&n.includes(l))throw new Error(`Cookie has domain set to the public suffix "${l}" which is a special use domain. To allow this, configure your CookieJar with {allowSpecialUseDomain:true, rejectPublicSuffixes: false}.`);return t.get(o)}e.getPublicSuffix=a}}),jm=ut({"node_modules/tough-cookie/lib/store.js"(e){var t=class{constructor(){this.synchronous=!1}findCookie(n,r,a,o){throw new Error("findCookie is not implemented")}findCookies(n,r,a,o){throw new Error("findCookies is not implemented")}putCookie(n,r){throw new Error("putCookie is not implemented")}updateCookie(n,r,a){throw new Error("updateCookie is not implemented")}removeCookie(n,r,a,o){throw new Error("removeCookie is not implemented")}removeCookies(n,r,a){throw new Error("removeCookies is not implemented")}removeAllCookies(n){throw new Error("removeAllCookies is not implemented")}getAllCookies(n){throw new Error("getAllCookies is not implemented (therefore jar cannot be serialized)")}};e.Store=t}}),_m=ut({"node_modules/universalify/index.js"(e){e.fromCallback=function(t){return Object.defineProperty(function(){if(typeof arguments[arguments.length-1]=="function")t.apply(this,arguments);else return new Promise((n,r)=>{arguments[arguments.length]=(a,o)=>{if(a)return r(a);n(o)},arguments.length++,t.apply(this,arguments)})},"name",{value:t.name})},e.fromPromise=function(t){return Object.defineProperty(function(){const n=arguments[arguments.length-1];if(typeof n!="function")return t.apply(this,arguments);delete arguments[arguments.length-1],arguments.length--,t.apply(this,arguments).then(r=>n(null,r),n)},"name",{value:t.name})}}}),Cm=ut({"node_modules/tough-cookie/lib/permuteDomain.js"(e){var t=vm();function n(r,a){const o=t.getPublicSuffix(r,{allowSpecialUseDomain:a});if(!o)return null;if(o==r)return[r];r.slice(-1)=="."&&(r=r.slice(0,-1));const s=r.slice(0,-(o.length+1)).split(".").reverse();let l=o;const u=[l];for(;s.length;)l=`${s.shift()}.${l}`,u.push(l);return u}e.permuteDomain=n}}),Em=ut({"node_modules/tough-cookie/lib/pathMatch.js"(e){function t(n,r){return r===n||n.indexOf(r)===0&&(r.substr(-1)==="/"||n.substr(r.length,1)==="/")}e.pathMatch=t}}),Am=ut({"node_modules/tough-cookie/lib/utilHelper.js"(e){function t(){try{return uv("util")}catch{return null}}function n(){return Symbol.for("nodejs.util.inspect.custom")}function r(a){const i=(a.requireUtil||t)();return i?i.inspect.custom:null}e.getUtilInspect=function(o,i={}){const l=(i.requireUtil||t)();return function(c,d,h){return l?l.inspect(c,d,h):o(c)}},e.getCustomInspectSymbol=function(o={}){return(o.lookupCustomInspectSymbol||n)()||r(o)}}}),yv=ut({"node_modules/tough-cookie/lib/memstore.js"(e){var{fromCallback:t}=_m(),n=jm().Store,r=Cm().permuteDomain,a=Em().pathMatch,{getCustomInspectSymbol:o,getUtilInspect:i}=Am(),s=class extends n{constructor(){super(),this.synchronous=!0,this.idx=Object.create(null);const d=o();d&&(this[d]=this.inspect)}inspect(){return`{ idx: ${{inspect:i(l)}.inspect(this.idx,!1,2)} }`}findCookie(d,h,m,y){return!this.idx[d]||!this.idx[d][h]?y(null,void 0):y(null,this.idx[d][h][m]||null)}findCookies(d,h,m,y){const f=[];if(typeof m=="function"&&(y=m,m=!0),!d)return y(null,[]);let j;h?j=function(g){Object.keys(g).forEach(A=>{if(a(h,A)){const _=g[A];for(const x in _)f.push(_[x])}})}:j=function(g){for(const A in g){const _=g[A];for(const x in _)f.push(_[x])}};const T=r(d,m)||[d],E=this.idx;T.forEach(b=>{const g=E[b];g&&j(g)}),y(null,f)}putCookie(d,h){this.idx[d.domain]||(this.idx[d.domain]=Object.create(null)),this.idx[d.domain][d.path]||(this.idx[d.domain][d.path]=Object.create(null)),this.idx[d.domain][d.path][d.key]=d,h(null)}updateCookie(d,h,m){this.putCookie(h,m)}removeCookie(d,h,m,y){this.idx[d]&&this.idx[d][h]&&this.idx[d][h][m]&&delete this.idx[d][h][m],y(null)}removeCookies(d,h,m){return this.idx[d]&&(h?delete this.idx[d][h]:delete this.idx[d]),m(null)}removeAllCookies(d){return this.idx=Object.create(null),d(null)}getAllCookies(d){const h=[],m=this.idx;Object.keys(m).forEach(f=>{Object.keys(m[f]).forEach(T=>{Object.keys(m[f][T]).forEach(b=>{b!==null&&h.push(m[f][T][b])})})}),h.sort((f,j)=>(f.creationIndex||0)-(j.creationIndex||0)),d(null,h)}};["findCookie","findCookies","putCookie","updateCookie","removeCookie","removeCookies","removeAllCookies","getAllCookies"].forEach(d=>{s.prototype[d]=t(s.prototype[d])}),e.MemoryCookieStore=s;function l(d){const h=Object.keys(d);if(h.length===0)return"[Object: null prototype] {}";let m=`[Object: null prototype] { -`;return Object.keys(d).forEach((y,f)=>{m+=u(y,d[y]),f{y+=c(f,h[f]),j{const E=h[f];y+=` ${f}: ${E.inspect()}`,j=58)break;F++}return FO||!W&&F!=D.length?null:parseInt(D.substr(0,F),10)}function Y(D){const S=D.split(":"),O=[0,0,0];if(S.length!==3)return null;for(let W=0;W<3;W++){const F=W==2,oe=q(S[W],1,2,F);if(oe===null)return null;O[W]=oe}return O}function ee(D){D=String(D).substr(0,3).toLowerCase();const S=j[D];return S>=0?S:null}function ce(D){if(!D)return;const S=D.split(f);if(!S)return;let O=null,W=null,F=null,oe=null,ge=null,Ce=null;for(let Re=0;Re=70&&Ce<=99?Ce+=1900:Ce>=0&&Ce<=69&&(Ce+=2e3)))}if(!(oe===null||ge===null||Ce===null||F===null||oe<1||oe>31||Ce<1601||O>23||W>59||F>59))return new Date(Date.UTC(Ce,ge,oe,O,W,F))}function N(D){return s.validate(s.isDate(D),D),D.toUTCString()}function R(D){return D==null?null:(D=D.trim().replace(/^\./,""),J.test(D)&&(D=D.replace("[","").replace("]","")),t&&/[^\u0001-\u007f]/.test(D)&&(D=t.toASCII(D)),D.toLowerCase())}function B(D,S,O){if(D==null||S==null)return null;if(O!==!1&&(D=R(D),S=R(S)),D==S)return!0;const W=D.lastIndexOf(S);return!(W<=0||D.length!==S.length+W||D.substr(W-1,1)!=="."||_.test(D))}function H(D){if(!D||D.substr(0,1)!=="/")return"/";if(D==="/")return D;const S=D.lastIndexOf("/");return S===0?"/":D.slice(0,S)}function ie(D){if(s.isEmptyString(D))return D;for(let S=0;S1;){const O=D.lastIndexOf("/");if(O===0)break;D=D.substr(0,O),S.push(D)}return S.push("/"),S}function Ne(D){if(D instanceof Object)return D;try{D=decodeURI(D)}catch{}return n(D)}var Ke={key:"",value:"",expires:"Infinity",maxAge:null,domain:null,path:null,secure:!1,httpOnly:!1,extensions:null,hostOnly:null,pathIsDefault:null,creation:null,lastAccessed:null,sameSite:void 0},Oe=class Us{constructor(S={}){const O=c();O&&(this[O]=this.inspect),Object.assign(this,Ke,S),this.creation=this.creation||new Date,Object.defineProperty(this,"creationIndex",{configurable:!1,enumerable:!1,writable:!0,value:++Us.cookiesCreated})}inspect(){const S=Date.now(),O=this.hostOnly!=null?this.hostOnly:"?",W=this.creation?`${S-this.creation.getTime()}ms`:"?",F=this.lastAccessed?`${S-this.lastAccessed.getTime()}ms`:"?";return`Cookie="${this.toString()}; hostOnly=${O}; aAge=${F}; cAge=${W}"`}toJSON(){const S={};for(const O of Us.serializableProperties)this[O]!==Ke[O]&&(O==="expires"||O==="creation"||O==="lastAccessed"?this[O]===null?S[O]=null:S[O]=this[O]=="Infinity"?"Infinity":this[O].toISOString():O==="maxAge"?this[O]!==null&&(S[O]=this[O]==1/0||this[O]==-1/0?this[O].toString():this[O]):this[O]!==Ke[O]&&(S[O]=this[O]));return S}clone(){return Ve(this.toJSON())}validate(){if(!d.test(this.value)||this.expires!=1/0&&!(this.expires instanceof Date)&&!ce(this.expires)||this.maxAge!=null&&this.maxAge<=0||this.path!=null&&!y.test(this.path))return!1;const S=this.cdomain();return!(S&&(S.match(/\.$/)||r.getPublicSuffix(S)==null))}setExpires(S){S instanceof Date?this.expires=S:this.expires=ce(S)||"Infinity"}setMaxAge(S){S===1/0||S===-1/0?this.maxAge=S.toString():this.maxAge=S}cookieString(){let S=this.value;return S==null&&(S=""),this.key===""?S:`${this.key}=${S}`}toString(){let S=this.cookieString();if(this.expires!=1/0&&(this.expires instanceof Date?S+=`; Expires=${N(this.expires)}`:S+=`; Expires=${this.expires}`),this.maxAge!=null&&this.maxAge!=1/0&&(S+=`; Max-Age=${this.maxAge}`),this.domain&&!this.hostOnly&&(S+=`; Domain=${this.domain}`),this.path&&(S+=`; Path=${this.path}`),this.secure&&(S+="; Secure"),this.httpOnly&&(S+="; HttpOnly"),this.sameSite&&this.sameSite!=="none"){const O=Us.sameSiteCanonical[this.sameSite.toLowerCase()];S+=`; SameSite=${O||this.sameSite}`}return this.extensions&&this.extensions.forEach(O=>{S+=`; ${O}`}),S}TTL(S){if(this.maxAge!=null)return this.maxAge<=0?0:this.maxAge*1e3;let O=this.expires;return O!=1/0?(O instanceof Date||(O=ce(O)||1/0),O==1/0?1/0:O.getTime()-(S||Date.now())):1/0}expiryTime(S){if(this.maxAge!=null){const O=S||this.creation||new Date,W=this.maxAge<=0?-1/0:this.maxAge*1e3;return O.getTime()+W}return this.expires==1/0?1/0:this.expires.getTime()}expiryDate(S){const O=this.expiryTime(S);return O==1/0?new Date(T):O==-1/0?new Date(E):new Date(O)}isPersistent(){return this.maxAge!=null||this.expires!=1/0}canonicalizedDomain(){return this.domain==null?null:R(this.domain)}cdomain(){return this.canonicalizedDomain()}};Oe.cookiesCreated=0,Oe.parse=M,Oe.fromJSON=Ve,Oe.serializableProperties=Object.keys(Ke),Oe.sameSiteLevel={strict:3,lax:2,none:1},Oe.sameSiteCanonical={strict:"Strict",lax:"Lax"};function ot(D){if(D!=null){const S=D.toLowerCase();switch(S){case A.STRICT:case A.SILENT:case A.DISABLED:return S}}return A.SILENT}var kt=class Fs{constructor(S,O={rejectPublicSuffixes:!0}){typeof O=="boolean"&&(O={rejectPublicSuffixes:O}),s.validate(s.isObject(O),O),this.rejectPublicSuffixes=O.rejectPublicSuffixes,this.enableLooseMode=!!O.looseMode,this.allowSpecialUseDomain=typeof O.allowSpecialUseDomain=="boolean"?O.allowSpecialUseDomain:!0,this.store=S||new o,this.prefixSecurity=ot(O.prefixSecurity),this._cloneSync=Dt("clone"),this._importCookiesSync=Dt("_importCookies"),this.getCookiesSync=Dt("getCookies"),this.getCookieStringSync=Dt("getCookieString"),this.getSetCookieStringsSync=Dt("getSetCookieStrings"),this.removeAllCookiesSync=Dt("removeAllCookies"),this.setCookieSync=Dt("setCookie"),this.serializeSync=Dt("serialize")}setCookie(S,O,W,F){s.validate(s.isUrlStringOrObject(O),F,W);let oe;if(s.isFunction(O))return F=O,F(new Error("No URL was specified"));const ge=Ne(O);if(s.isFunction(W)&&(F=W,W={}),s.validate(s.isFunction(F),F),!s.isNonEmptyString(S)&&!s.isObject(S)&&S instanceof String&&S.length==0)return F(null);const Ce=R(ge.hostname),Re=W.loose||this.enableLooseMode;let Se=null;if(W.sameSiteContext&&(Se=g(W.sameSiteContext),!Se))return F(new Error(b));if(typeof S=="string"||S instanceof String){if(S=Oe.parse(S,{loose:Re}),!S)return oe=new Error("Cookie failed to parse"),F(W.ignoreError?null:oe)}else if(!(S instanceof Oe))return oe=new Error("First argument to setCookie must be a Cookie object or string"),F(W.ignoreError?null:oe);const ye=W.now||new Date;if(this.rejectPublicSuffixes&&S.domain&&r.getPublicSuffix(S.cdomain(),{allowSpecialUseDomain:this.allowSpecialUseDomain,ignoreError:W.ignoreError})==null&&!J.test(S.domain))return oe=new Error("Cookie has domain set to a public suffix"),F(W.ignoreError?null:oe);if(S.domain){if(!B(Ce,S.cdomain(),!1))return oe=new Error(`Cookie not in this host's domain. Cookie:${S.cdomain()} Request:${Ce}`),F(W.ignoreError?null:oe);S.hostOnly==null&&(S.hostOnly=!1)}else S.hostOnly=!0,S.domain=Ce;if((!S.path||S.path[0]!=="/")&&(S.path=H(ge.pathname),S.pathIsDefault=!0),W.http===!1&&S.httpOnly)return oe=new Error("Cookie is HttpOnly and this isn't an HTTP API"),F(W.ignoreError?null:oe);if(S.sameSite!=="none"&&S.sameSite!==void 0&&Se&&Se==="none")return oe=new Error("Cookie is SameSite but this is a cross-origin request"),F(W.ignoreError?null:oe);const nn=this.prefixSecurity===A.SILENT;if(!(this.prefixSecurity===A.DISABLED)){let v=!1,C;if(Ie(S)?xe(S)||(v=!0,C="Cookie has __Host prefix but either Secure or HostOnly attribute is not set or Path is not '/'"):(v=!0,C="Cookie has __Secure prefix but Secure attribute is not set"),v)return F(W.ignoreError||nn?null:new Error(C))}const P=this.store;P.updateCookie||(P.updateCookie=function(v,C,I){this.putCookie(C,I)});function p(v,C){if(v)return F(v);const I=function(k){if(k)return F(k);F(null,S)};if(C){if(W.http===!1&&C.httpOnly)return v=new Error("old Cookie is HttpOnly and this isn't an HTTP API"),F(W.ignoreError?null:v);S.creation=C.creation,S.creationIndex=C.creationIndex,S.lastAccessed=ye,P.updateCookie(C,S,I)}else S.creation=S.lastAccessed=ye,P.putCookie(S,I)}P.findCookie(S.domain,S.path,S.key,p)}getCookies(S,O,W){s.validate(s.isUrlStringOrObject(S),W,S);const F=Ne(S);s.isFunction(O)&&(W=O,O={}),s.validate(s.isObject(O),W,O),s.validate(s.isFunction(W),W);const oe=R(F.hostname),ge=F.pathname||"/";let Ce=O.secure;Ce==null&&F.protocol&&(F.protocol=="https:"||F.protocol=="wss:")&&(Ce=!0);let Re=0;if(O.sameSiteContext){const v=g(O.sameSiteContext);if(Re=Oe.sameSiteLevel[v],!Re)return W(new Error(b))}let Se=O.http;Se==null&&(Se=!0);const ye=O.now||Date.now(),nn=O.expire!==!1,it=!!O.allPaths,P=this.store;function p(v){if(v.hostOnly){if(v.domain!=oe)return!1}else if(!B(oe,v.domain,!1))return!1;return!it&&!i(ge,v.path)||v.secure&&!Ce||v.httpOnly&&!Se||Re&&Oe.sameSiteLevel[v.sameSite||"none"]>Re?!1:nn&&v.expiryTime()<=ye?(P.removeCookie(v.domain,v.path,v.key,()=>{}),!1):!0}P.findCookies(oe,it?null:ge,this.allowSpecialUseDomain,(v,C)=>{if(v)return W(v);C=C.filter(p),O.sort!==!1&&(C=C.sort(at));const I=new Date;for(const k of C)k.lastAccessed=I;W(null,C)})}getCookieString(...S){const O=S.pop();s.validate(s.isFunction(O),O);const W=function(F,oe){F?O(F):O(null,oe.sort(at).map(ge=>ge.cookieString()).join("; "))};S.push(W),this.getCookies.apply(this,S)}getSetCookieStrings(...S){const O=S.pop();s.validate(s.isFunction(O),O);const W=function(F,oe){F?O(F):O(null,oe.map(ge=>ge.toString()))};S.push(W),this.getCookies.apply(this,S)}serialize(S){s.validate(s.isFunction(S),S);let O=this.store.constructor.name;s.isObject(O)&&(O=null);const W={version:`tough-cookie@${l}`,storeType:O,rejectPublicSuffixes:!!this.rejectPublicSuffixes,enableLooseMode:!!this.enableLooseMode,allowSpecialUseDomain:!!this.allowSpecialUseDomain,prefixSecurity:ot(this.prefixSecurity),cookies:[]};if(!(this.store.getAllCookies&&typeof this.store.getAllCookies=="function"))return S(new Error("store does not support getAllCookies and cannot be serialized"));this.store.getAllCookies((F,oe)=>F?S(F):(W.cookies=oe.map(ge=>(ge=ge instanceof Oe?ge.toJSON():ge,delete ge.creationIndex,ge)),S(null,W)))}toJSON(){return this.serializeSync()}_importCookies(S,O){let W=S.cookies;if(!W||!Array.isArray(W))return O(new Error("serialized jar has no cookies array"));W=W.slice();const F=oe=>{if(oe)return O(oe);if(!W.length)return O(oe,this);let ge;try{ge=Ve(W.shift())}catch(Ce){return O(Ce)}if(ge===null)return F(null);this.store.putCookie(ge,F)};F()}clone(S,O){arguments.length===1&&(O=S,S=null),this.serialize((W,F)=>{if(W)return O(W);Fs.deserialize(F,S,O)})}cloneSync(S){if(arguments.length===0)return this._cloneSync();if(!S.synchronous)throw new Error("CookieJar clone destination store is not synchronous; use async API instead.");return this._cloneSync(S)}removeAllCookies(S){s.validate(s.isFunction(S),S);const O=this.store;if(typeof O.removeAllCookies=="function"&&O.removeAllCookies!==a.prototype.removeAllCookies)return O.removeAllCookies(S);O.getAllCookies((W,F)=>{if(W)return S(W);if(F.length===0)return S(null);let oe=0;const ge=[];function Ce(Re){if(Re&&ge.push(Re),oe++,oe===F.length)return S(ge.length?ge[0]:null)}F.forEach(Re=>{O.removeCookie(Re.domain,Re.path,Re.key,Ce)})})}static deserialize(S,O,W){arguments.length!==3&&(W=O,O=null),s.validate(s.isFunction(W),W);let F;if(typeof S=="string"){if(F=qe(S),F instanceof Error)return W(F)}else F=S;const oe=new Fs(O,{rejectPublicSuffixes:F.rejectPublicSuffixes,looseMode:F.enableLooseMode,allowSpecialUseDomain:F.allowSpecialUseDomain,prefixSecurity:F.prefixSecurity});oe._importCookies(F,ge=>{if(ge)return W(ge);W(null,oe)})}static deserializeSync(S,O){const W=typeof S=="string"?JSON.parse(S):S,F=new Fs(O,{rejectPublicSuffixes:W.rejectPublicSuffixes,looseMode:W.enableLooseMode});if(!F.store.synchronous)throw new Error("CookieJar store is not synchronous; use async API instead.");return F._importCookiesSync(W),F}};kt.fromJSON=kt.deserializeSync,["_importCookies","clone","getCookies","getCookieString","getSetCookieStrings","removeAllCookies","serialize","setCookie"].forEach(D=>{kt.prototype[D]=u(kt.prototype[D])}),kt.deserialize=u(kt.deserialize);function Dt(D){return function(...S){if(!this.store.synchronous)throw new Error("CookieJar store is not synchronous; use async API instead.");let O,W;if(this[D](...S,(F,oe)=>{O=F,W=oe}),O)throw O;return W}}e.version=l,e.CookieJar=kt,e.Cookie=Oe,e.Store=a,e.MemoryCookieStore=o,e.parseDate=ce,e.formatDate=N,e.parse=M,e.fromJSON=Ve,e.domainMatch=B,e.defaultPath=H,e.pathMatch=i,e.getPublicSuffix=r.getPublicSuffix,e.cookieCompare=at,e.permuteDomain=Cm().permuteDomain,e.permutePath=tt,e.canonicalDomain=R,e.PrefixSecurityEnum=A,e.ParameterError=s.ParameterError}}),vv=dv(kv(),1),jv=vv.default;/*! Bundled license information: - -tough-cookie/lib/pubsuffix-psl.js: - (*! - * Copyright (c) 2018, Salesforce.com, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of Salesforce.com nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *) - -tough-cookie/lib/store.js: - (*! - * Copyright (c) 2015, Salesforce.com, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of Salesforce.com nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *) - -tough-cookie/lib/permuteDomain.js: - (*! - * Copyright (c) 2015, Salesforce.com, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of Salesforce.com nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *) - -tough-cookie/lib/pathMatch.js: - (*! - * Copyright (c) 2015, Salesforce.com, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of Salesforce.com nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *) - -tough-cookie/lib/memstore.js: - (*! - * Copyright (c) 2015, Salesforce.com, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of Salesforce.com nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *) - -tough-cookie/lib/cookie.js: - (*! - * Copyright (c) 2015-2020, Salesforce.com, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of Salesforce.com nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *) -*/const{Cookie:_v,CookieJar:Cv,Store:Ev,MemoryCookieStore:Av,domainMatch:Sv,pathMatch:Pv}=jv;class Tv extends Ev{constructor(){super();je(this,"storage");je(this,"storageKey");Kt(typeof localStorage<"u","Failed to create a WebStorageCookieStore: `localStorage` is not available in this environment. This is likely an issue with MSW. Please report it on GitHub: https://github.com/mswjs/msw/issues"),this.synchronous=!0,this.storage=localStorage,this.storageKey="__msw-cookie-store__"}findCookie(n,r,a,o){try{const i=this.getStore(),s=this.filterCookiesFromList(i,{domain:n,path:r,key:a});o(null,s[0]||null)}catch(i){i instanceof Error&&o(i,null)}}findCookies(n,r,a,o){if(!n){o(null,[]);return}try{const i=this.getStore(),s=this.filterCookiesFromList(i,{domain:n,path:r});o(null,s)}catch(i){i instanceof Error&&o(i,[])}}putCookie(n,r){try{if(n.maxAge===0)return;const a=this.getStore();a.push(n),this.updateStore(a)}catch(a){a instanceof Error&&r(a)}}updateCookie(n,r,a){if(r.maxAge===0){this.removeCookie(r.domain||"",r.path||"",r.key,a);return}this.putCookie(r,a)}removeCookie(n,r,a,o){try{const i=this.getStore(),s=this.deleteCookiesFromList(i,{domain:n,path:r,key:a});this.updateStore(s),o(null)}catch(i){i instanceof Error&&o(i)}}removeCookies(n,r,a){try{const o=this.getStore(),i=this.deleteCookiesFromList(o,{domain:n,path:r});this.updateStore(i),a(null)}catch(o){o instanceof Error&&a(o)}}getAllCookies(n){try{n(null,this.getStore())}catch(r){r instanceof Error&&n(r,[])}}getStore(){try{const n=this.storage.getItem(this.storageKey);if(n==null)return[];const r=JSON.parse(n),a=[];for(const o of r){const i=_v.fromJSON(o);i!=null&&a.push(i)}return a}catch{return[]}}updateStore(n){this.storage.setItem(this.storageKey,JSON.stringify(n.map(r=>r.toJSON())))}filterCookiesFromList(n,r){const a=[];for(const o of n)r.domain&&!Sv(r.domain,o.domain||"")||r.path&&!Pv(r.path,o.path||"")||r.key&&o.key!==r.key||a.push(o);return a}deleteCookiesFromList(n,r){const a=this.filterCookiesFromList(n,r);return n.filter(o=>!a.includes(o))}}const Bv=fm()?new Av:new Tv,Sm=new Cv(Bv);function af(){return mc.parse(document.cookie)}function Mv(e){if(typeof document>"u"||typeof location>"u")return{};switch(e.credentials){case"same-origin":{const t=new URL(e.url);return location.origin===t.origin?af():{}}case"include":return af();default:return{}}}function Pm(e){const t=e.headers.get("cookie"),n=t?mc.parse(t):{},r=Mv(e);for(const i in r)e.headers.append("cookie",mc.serialize(i,r[i]));const a=Sm.getCookiesSync(e.url),o=Object.fromEntries(a.map(i=>[i.key,i.value]));for(const i of a)e.headers.append("cookie",i.toString());return{...r,...o,...n}}var or=(e=>(e.HEAD="HEAD",e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.OPTIONS="OPTIONS",e.DELETE="DELETE",e))(or||{});class Tm extends ho{constructor(t,n,r,a){super({info:{header:`${t} ${n}`,path:n,method:t},resolver:r,options:a}),this.checkRedundantQueryParameters()}checkRedundantQueryParameters(){const{method:t,path:n}=this.info;if(n instanceof RegExp||pm(n)===n)return;Hk(n).forEach((o,i)=>{}),Pe.warn(`Found a redundant usage of query parameters in the request handler URL for "${t} ${n}". Please match against a path instead and access query parameters using "new URL(request.url).searchParams" instead. Learn more: https://mswjs.io/docs/recipes/query-parameters`)}async parse(t){var o;const n=new URL(t.request.url),r=Yc(n,this.info.path,(o=t.resolutionContext)==null?void 0:o.baseUrl),a=Pm(t.request);return{match:r,cookies:a}}predicate(t){const n=this.matchMethod(t.request.method),r=t.parsedResult.match.matches;return n&&r}matchMethod(t){return this.info.method instanceof RegExp?this.info.method.test(t):dk(this.info.method,t)}extendResolverArgs(t){var n;return{params:((n=t.parsedResult.match)==null?void 0:n.params)||{},cookies:t.parsedResult.cookies}}async log(t){const n=La(t.request.url),r=await am(t.request),a=await um(t.response),o=rm(a.status);console.groupCollapsed(Pe.formatMessage(`${Zn()} ${t.request.method} ${n} (%c${a.status} ${a.statusText}%c)`),`color:${o}`,"color:inherit"),console.log("Request",r),console.log("Handler:",this),console.log("Response",a),console.groupEnd()}}function er(e){return(t,n,r={})=>new Tm(e,t,n,r)}const ni={all:er(/.+/),head:er(or.HEAD),get:er(or.GET),post:er(or.POST),put:er(or.PUT),delete:er(or.DELETE),patch:er(or.PATCH),options:er(or.OPTIONS)};function Iu(e){try{return JSON.parse(e)}catch{return}}var xv=Object.create,Bm=Object.defineProperty,Iv=Object.getOwnPropertyDescriptor,Mm=Object.getOwnPropertyNames,Ov=Object.getPrototypeOf,Rv=Object.prototype.hasOwnProperty,Nv=(e,t)=>function(){return t||(0,e[Mm(e)[0]])((t={exports:{}}).exports,t),t.exports},zv=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Mm(t))!Rv.call(e,a)&&a!==n&&Bm(e,a,{get:()=>t[a],enumerable:!(r=Iv(t,a))||r.enumerable});return e},Dv=(e,t,n)=>(n=e!=null?xv(Ov(e)):{},zv(t||!e||!e.__esModule?Bm(n,"default",{value:e,enumerable:!0}):n,e)),Uv=Nv({"node_modules/set-cookie-parser/lib/set-cookie.js"(e,t){var n={decodeValues:!0,map:!1,silent:!1};function r(l){return typeof l=="string"&&!!l.trim()}function a(l,u){var c=l.split(";").filter(r),d=c.shift(),h=o(d),m=h.name,y=h.value;u=u?Object.assign({},n,u):n;try{y=u.decodeValues?decodeURIComponent(y):y}catch(j){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+y+"'. Set options.decodeValues to false to disable this feature.",j)}var f={name:m,value:y};return c.forEach(function(j){var T=j.split("="),E=T.shift().trimLeft().toLowerCase(),b=T.join("=");E==="expires"?f.expires=new Date(b):E==="max-age"?f.maxAge=parseInt(b,10):E==="secure"?f.secure=!0:E==="httponly"?f.httpOnly=!0:E==="samesite"?f.sameSite=b:f[E]=b}),f}function o(l){var u="",c="",d=l.split("=");return d.length>1?(u=d.shift(),c=d.join("=")):c=l,{name:u,value:c}}function i(l,u){if(u=u?Object.assign({},n,u):n,!l)return u.map?{}:[];if(l.headers)if(typeof l.headers.getSetCookie=="function")l=l.headers.getSetCookie();else if(l.headers["set-cookie"])l=l.headers["set-cookie"];else{var c=l.headers[Object.keys(l.headers).find(function(h){return h.toLowerCase()==="set-cookie"})];!c&&l.headers.cookie&&!u.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),l=c}if(Array.isArray(l)||(l=[l]),u=u?Object.assign({},n,u):n,u.map){var d={};return l.filter(r).reduce(function(h,m){var y=a(m,u);return h[y.name]=y,h},d)}else return l.filter(r).map(function(h){return a(h,u)})}function s(l){if(Array.isArray(l))return l;if(typeof l!="string")return[];var u=[],c=0,d,h,m,y,f;function j(){for(;c=l.length)&&u.push(l.substring(d,l.length))}return u}t.exports=i,t.exports.parse=i,t.exports.parseString=a,t.exports.splitCookiesString=s}}),Fv=Dv(Uv()),Lv=/[^a-z0-9\-#$%&'*+.^_`|~]/i;function ri(e){if(Lv.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}var of=[String.fromCharCode(10),String.fromCharCode(13),String.fromCharCode(9),String.fromCharCode(32)],qv=new RegExp(`(^[${of.join("")}]|$[${of.join("")}])`,"g");function Ou(e){return e.replace(qv,"")}function ai(e){if(typeof e!="string"||e.length===0)return!1;for(let t=0;t127||!$v(n))return!1}return!0}function $v(e){return![127,32,"(",")","<",">","@",",",";",":","\\",'"',"/","[","]","?","=","{","}"].includes(e)}function sf(e){if(typeof e!="string"||e.trim()!==e)return!1;for(let t=0;t{this.append(a,r)},this):Array.isArray(t)?t.forEach(([n,r])=>{this.append(n,Array.isArray(r)?r.join(lf):r)}):t&&Object.getOwnPropertyNames(t).forEach(n=>{const r=t[n];this.append(n,Array.isArray(r)?r.join(lf):r)})}[(uf=Va,cf=Ru,df=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}*keys(){for(const[t]of this.entries())yield t}*values(){for(const[,t]of this.entries())yield t}*entries(){let t=Object.keys(this[Va]).sort((n,r)=>n.localeCompare(r));for(const n of t)if(n==="set-cookie")for(const r of this.getSetCookie())yield[n,r];else yield[n,this.get(n)]}has(t){if(!ai(t))throw new TypeError(`Invalid header name "${t}"`);return this[Va].hasOwnProperty(ri(t))}get(t){if(!ai(t))throw TypeError(`Invalid header name "${t}"`);return this[Va][ri(t)]??null}set(t,n){if(!ai(t)||!sf(n))return;const r=ri(t),a=Ou(n);this[Va][r]=Ou(a),this[Ru].set(r,t)}append(t,n){if(!ai(t)||!sf(n))return;const r=ri(t),a=Ou(n);let o=this.has(r)?`${this.get(r)}, ${a}`:a;this.set(t,o)}delete(t){if(!ai(t)||!this.has(t))return;const n=ri(t);delete this[Va][n],this[Ru].delete(n)}forEach(t,n){for(const[r,a]of this.entries())t.call(n,a,r,this)}getSetCookie(){const t=this.get("set-cookie");return t===null?[]:t===""?[""]:(0,Fv.splitCookiesString)(t)}};function Wv(e){return e.trim().split(/[\r\n]+/).reduce((n,r)=>{if(r.trim()==="")return n;const a=r.split(": "),o=a.shift(),i=a.join(": ");return n.append(o,i),n},new xm)}function Hv(e){var s,l;const t=Wv(e),n=t.get("content-type")||"text/plain",r=t.get("content-disposition");if(!r)throw new Error('"Content-Disposition" header is required.');const a=r.split(";").reduce((u,c)=>{const[d,...h]=c.trim().split("=");return u[d]=h.join("="),u},{}),o=(s=a.name)==null?void 0:s.slice(1,-1),i=(l=a.filename)==null?void 0:l.slice(1,-1);return{name:o,filename:i,contentType:n}}function Vv(e,t){const n=t==null?void 0:t.get("content-type");if(!n)return;const[,...r]=n.split(/; */),a=r.filter(l=>l.startsWith("boundary=")).map(l=>l.replace(/^boundary=/,""))[0];if(!a)return;const o=new RegExp(`--+${a}`),i=e.split(o).filter(l=>l.startsWith(`\r -`)&&l.endsWith(`\r -`)).map(l=>l.trimStart().replace(/\r\n$/,""));if(!i.length)return;const s={};try{for(const l of i){const[u,...c]=l.split(`\r -\r -`),d=c.join(`\r -\r -`),{contentType:h,filename:m,name:y}=Hv(u),f=m===void 0?d:new File([d],m,{type:h}),j=s[y];j===void 0?s[y]=f:Array.isArray(j)?s[y]=[...j,f]:s[y]=[j,f]}return s}catch{return}}function Om(e){var n;const t=e.definitions.find(r=>r.kind==="OperationDefinition");return{operationType:t==null?void 0:t.operation,operationName:(n=t==null?void 0:t.name)==null?void 0:n.value}}async function Jv(e){const{parse:t}=await Hw(()=>import("./index-e5afa628.js"),[]).catch(n=>{throw console.error('[MSW] Failed to parse a GraphQL query: cannot import the "graphql" module. Please make sure you install it if you wish to intercept GraphQL requests. See the original import error below.'),n});try{const n=t(e);return Om(n)}catch(n){return n}}function Kv(e,t,n){const r={variables:e};for(const[a,o]of Object.entries(t)){if(!(a in n))throw new Error(`Given files do not have a key '${a}' .`);for(const i of o){const[s,...l]=i.split(".").reverse(),u=l.reverse();let c=r;for(const d of u){if(!(d in c))throw new Error(`Property '${u}' is not in operations.`);c=c[d]}c[s]=n[a]}}return r.variables}async function Gv(e){var t;switch(e.method){case"GET":{const n=new URL(e.url),r=n.searchParams.get("query"),a=n.searchParams.get("variables")||"";return{query:r,variables:Iu(a)}}case"POST":{const n=e.clone();if((t=e.headers.get("content-type"))!=null&&t.includes("multipart/form-data")){const a=Vv(await n.text(),e.headers);if(!a)return null;const{operations:o,map:i,...s}=a,l=Iu(o)||{};if(!l.query)return null;const u=Iu(i||"")||{},c=l.variables?Kv(l.variables,u,s):{};return{query:l.query,variables:c}}const r=await n.json().catch(()=>null);if(r!=null&&r.query){const{query:a,variables:o}=r;return{query:a,variables:o}}}default:return null}}async function Qv(e){const t=await Gv(e);if(!t||!t.query)return;const{query:n,variables:r}=t,a=await Jv(n);if(a instanceof Error){const o=La(e.url);throw new Error(Pe.formatMessage(`Failed to intercept a GraphQL request to "%s %s": cannot parse query. See the error message from the parser below. - -%s`,e.method,o,a.message))}return{query:t.query,operationType:a.operationType,operationName:a.operationName,variables:r}}function Yv(e){return e==null?!1:typeof e=="object"&&"kind"in e&&"definitions"in e}const ro=class ro extends ho{constructor(n,r,a,o,i){let s=r;if(Yv(r)){const u=Om(r);if(u.operationType!==n)throw new Error(`Failed to create a GraphQL handler: provided a DocumentNode with a mismatched operation type (expected "${n}", but got "${u.operationType}").`);if(!u.operationName)throw new Error("Failed to create a GraphQL handler: provided a DocumentNode with no operation name.");s=u.operationName}const l=n==="all"?`${n} (origin: ${a.toString()})`:`${n} ${s} (origin: ${a.toString()})`;super({info:{header:l,operationType:n,operationName:s},resolver:o,options:i});je(this,"endpoint");this.endpoint=a}async parseGraphQLRequestOrGetFromCache(n){return ro.parsedRequestCache.has(n)||ro.parsedRequestCache.set(n,await Qv(n).catch(r=>{console.error(r)})),ro.parsedRequestCache.get(n)}async parse(n){const r=Yc(new URL(n.request.url),this.endpoint),a=Pm(n.request);if(!r.matches)return{match:r,cookies:a};const o=await this.parseGraphQLRequestOrGetFromCache(n.request);return typeof o>"u"?{match:r,cookies:a}:{match:r,cookies:a,query:o.query,operationType:o.operationType,operationName:o.operationName,variables:o.variables}}predicate(n){if(n.parsedResult.operationType===void 0)return!1;if(!n.parsedResult.operationName&&this.info.operationType!=="all"){const o=La(n.request.url);return Pe.warn(`Failed to intercept a GraphQL request at "${n.request.method} ${o}": anonymous GraphQL operations are not supported. - -Consider naming this operation or using "graphql.operation()" request handler to intercept GraphQL requests regardless of their operation name/type. Read more: https://mswjs.io/docs/api/graphql/#graphqloperationresolver`),!1}const r=this.info.operationType==="all"||n.parsedResult.operationType===this.info.operationType,a=this.info.operationName instanceof RegExp?this.info.operationName.test(n.parsedResult.operationName||""):n.parsedResult.operationName===this.info.operationName;return n.parsedResult.match.matches&&r&&a}extendResolverArgs(n){return{query:n.parsedResult.query||"",operationName:n.parsedResult.operationName||"",variables:n.parsedResult.variables||{},cookies:n.parsedResult.cookies}}async log(n){const r=await am(n.request),a=await um(n.response),o=rm(a.status),i=n.parsedResult.operationName?`${n.parsedResult.operationType} ${n.parsedResult.operationName}`:`anonymous ${n.parsedResult.operationType}`;console.groupCollapsed(Pe.formatMessage(`${Zn()} ${i} (%c${a.status} ${a.statusText}%c)`),`color:${o}`,"color:inherit"),console.log("Request:",r),console.log("Handler:",this),console.log("Response:",a),console.groupEnd()}};je(ro,"parsedRequestCache",new WeakMap);let pc=ro;const Nu=Symbol("kEmitter"),Rm=Symbol("kDispatchEvent"),ff=Symbol("kStopPropagationPatched"),hf=Symbol("KOnStopPropagation");var _I;class Zv{constructor(t){je(this,"id");je(this,"callFrame");je(this,_I);this.url=t,this.id=mm(),this[Nu]=new Wi,this.callFrame=nm(new Error)}parse(t){const n=t.event.data;return{match:Yc(n.client.url,this.url)}}predicate(t){return t.parsedResult.match.matches}async[(_I=Nu,Rm)](t){const n=this.parse({event:t}),r=t.data,a={...r,params:n.match.params||{}};r.client.addEventListener("message",Ja(this)),r.client.addEventListener("close",Ja(this)),r.server.addEventListener("open",Ja(this)),r.server.addEventListener("message",Ja(this)),r.server.addEventListener("error",Ja(this)),r.server.addEventListener("close",Ja(this)),this[Nu].emit("connection",a)}}function Ja(e){return function(n){const r=Reflect.get(n,"kPropagationStoppedAt");if(r&&e.id!==r){n.stopImmediatePropagation();return}Object.defineProperty(n,hf,{value(){Object.defineProperty(n,"kPropagationStoppedAt",{value:e.id})},configurable:!0}),Reflect.get(n,ff)||(n.stopPropagation=new Proxy(n.stopPropagation,{apply:(a,o,i)=>{var s;return(s=Reflect.get(n,hf))==null||s.call(e),Reflect.apply(a,o,i)}}),Object.defineProperty(n,ff,{value:!0,configurable:!1}))}}function Xv(){const e=(t,n)=>{e.state="pending",e.resolve=r=>{if(e.state!=="pending")return;e.result=r;const a=o=>(e.state="fulfilled",o);return t(r instanceof Promise?r:Promise.resolve(r).then(a))},e.reject=r=>{if(e.state==="pending")return queueMicrotask(()=>{e.state="rejected"}),n(e.rejectionReason=r)}};return e}var dr,co,Ls,Xh,e0=(Xh=class extends Promise{constructor(n=null){const r=Xv();super((a,o)=>{r(a,o),n==null||n(r.resolve,r.reject)});ei(this,co);ei(this,dr,void 0);je(this,"resolve");je(this,"reject");xu(this,dr,r),this.resolve=_n(this,dr).resolve,this.reject=_n(this,dr).reject}get state(){return _n(this,dr).state}get rejectionReason(){return _n(this,dr).rejectionReason}then(n,r){return $r(this,co,Ls).call(this,super.then(n,r))}catch(n){return $r(this,co,Ls).call(this,super.catch(n))}finally(n){return $r(this,co,Ls).call(this,super.finally(n))}},dr=new WeakMap,co=new WeakSet,Ls=function(n){return Object.defineProperties(n,{resolve:{configurable:!0,value:this.resolve},reject:{configurable:!0,value:this.reject}})},Xh),t0=async e=>{try{return{error:null,data:await e().catch(n=>{throw n})}}catch(t){return{error:t,data:null}}};const n0=async({request:e,requestId:t,handlers:n,resolutionContext:r})=>{let a=null,o=null;for(const i of n)if(i instanceof ho&&(o=await i.run({request:e,requestId:t,resolutionContext:r}),o!==null&&(a=i),o!=null&&o.response))break;return a?{handler:a,parsedResult:o==null?void 0:o.parsedResult,response:o==null?void 0:o.response}:null};async function Nm(e,t="warn"){const n=new URL(e.url),r=La(n)+n.search,a=e.method==="HEAD"||e.method==="GET"?null:await e.clone().text(),i=`intercepted a request without a matching request handler:${` - - • ${e.method} ${r} - -${a?` • Request body: ${a} - -`:""}`}If you still wish to intercept this unhandled request, please create a request handler for it. -Read more: https://mswjs.io/docs/getting-started/mocks`;function s(l){switch(l){case"error":throw Pe.error("Error: %s",i),new ef(Pe.formatMessage('Cannot bypass a request when using the "error" strategy for the "onUnhandledRequest" option.'));case"warn":{Pe.warn("Warning: %s",i);break}case"bypass":break;default:throw new ef(Pe.formatMessage('Failed to react to an unhandled request: unknown strategy "%s". Please provide one of the supported strategies ("bypass", "warn", "error") or a custom callback function as the value of the "onUnhandledRequest" option.',l))}}if(typeof t=="function"){t(e,{warning:s.bind(null,"warn"),error:s.bind(null,"error")});return}n.protocol!=="file:"&&s(t)}const{message:r0}=lm,zm=Symbol("kSetCookie");function Wr(e={}){const t=(e==null?void 0:e.status)||200,n=(e==null?void 0:e.statusText)||r0[t]||"",r=new Headers(e==null?void 0:e.headers);return{...e,headers:r,status:t,statusText:n}}function a0(e,t){t.type&&Object.defineProperty(e,"type",{value:t.type,enumerable:!0,writable:!1});const n=t.headers.get("set-cookie");if(n&&(Object.defineProperty(e,zm,{value:n,enumerable:!1,writable:!1}),typeof document<"u")){const r=xm.prototype.getSetCookie.call(t.headers);for(const a of r)document.cookie=a}return e}function o0(e,t){const n=Reflect.get(t,zm);n&&Sm.setCookie(n,e.url)}async function Dm(e,t,n,r,a,o){var c,d,h,m,y,f;if(a.emit("request:start",{request:e,requestId:t}),e.headers.get("x-msw-intention")==="bypass"){a.emit("request:end",{request:e,requestId:t}),(c=o==null?void 0:o.onPassthroughResponse)==null||c.call(o,e);return}const i=await t0(()=>n0({request:e,requestId:t,handlers:n,resolutionContext:o==null?void 0:o.resolutionContext}));if(i.error)throw a.emit("unhandledException",{error:i.error,request:e,requestId:t}),i.error;if(!i.data){await Nm(e,r.onUnhandledRequest),a.emit("request:unhandled",{request:e,requestId:t}),a.emit("request:end",{request:e,requestId:t}),(d=o==null?void 0:o.onPassthroughResponse)==null||d.call(o,e);return}const{response:s}=i.data;if(!s){a.emit("request:end",{request:e,requestId:t}),(h=o==null?void 0:o.onPassthroughResponse)==null||h.call(o,e);return}if(s.status===302&&s.headers.get("x-msw-intention")==="passthrough"){a.emit("request:end",{request:e,requestId:t}),(m=o==null?void 0:o.onPassthroughResponse)==null||m.call(o,e);return}o0(e,s),a.emit("request:match",{request:e,requestId:t});const l=i.data,u=((y=o==null?void 0:o.transformResponse)==null?void 0:y.call(o,s))||s;return(f=o==null?void 0:o.onMockedResponse)==null||f.call(o,u,l),a.emit("request:end",{request:e,requestId:t}),u}class cn extends Response{constructor(t,n){const r=Wr(n);super(t,r),a0(this,r)}static text(t,n){const r=Wr(n);return r.headers.has("Content-Type")||r.headers.set("Content-Type","text/plain"),r.headers.has("Content-Length")||r.headers.set("Content-Length",t?new Blob([t]).size.toString():"0"),new cn(t,r)}static json(t,n){const r=Wr(n);r.headers.has("Content-Type")||r.headers.set("Content-Type","application/json");const a=JSON.stringify(t);return r.headers.has("Content-Length")||r.headers.set("Content-Length",a?new Blob([a]).size.toString():"0"),new cn(a,r)}static xml(t,n){const r=Wr(n);return r.headers.has("Content-Type")||r.headers.set("Content-Type","text/xml"),new cn(t,r)}static html(t,n){const r=Wr(n);return r.headers.has("Content-Type")||r.headers.set("Content-Type","text/html"),new cn(t,r)}static arrayBuffer(t,n){const r=Wr(n);return t&&!r.headers.has("Content-Length")&&r.headers.set("Content-Length",t.byteLength.toString()),new cn(t,r)}static formData(t,n){return new cn(t,Wr(n))}}tk();function i0(e){return{status:e.status,statusText:e.statusText,headers:Object.fromEntries(e.headers.entries())}}function mf(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function Um(e,t){return Object.entries(t).reduce((n,[r,a])=>{const o=n[r];return Array.isArray(o)&&Array.isArray(a)?(n[r]=o.concat(a),n):mf(o)&&mf(a)?(n[r]=Um(o,a),n):(n[r]=a,n)},Object.assign({},e))}function st(e,t){return Object.defineProperties(t,{target:{value:e,enumerable:!0,writable:!0},currentTarget:{value:e,enumerable:!0,writable:!0}}),t}var ao=Symbol("kCancelable"),dn=Symbol("kDefaultPrevented"),Zc=class extends MessageEvent{constructor(e,t){super(e,t),this[ao]=!!t.cancelable,this[dn]=!1}get cancelable(){return this[ao]}set cancelable(e){this[ao]=e}get defaultPrevented(){return this[dn]}set defaultPrevented(e){this[dn]=e}preventDefault(){this.cancelable&&!this[dn]&&(this[dn]=!0)}},yl=class extends Event{constructor(e,t={}){super(e,t),this.code=t.code===void 0?0:t.code,this.reason=t.reason===void 0?"":t.reason,this.wasClean=t.wasClean===void 0?!1:t.wasClean}},pf=class extends yl{constructor(e,t={}){super(e,t),this[ao]=!!t.cancelable,this[dn]=!1}get cancelable(){return this[ao]}set cancelable(e){this[ao]=e}get defaultPrevented(){return this[dn]}set defaultPrevented(e){this[dn]=e}preventDefault(){this.cancelable&&!this[dn]&&(this[dn]=!0)}},oi=Symbol("kEmitter"),Ms=Symbol("kBoundListener"),s0=class{constructor(e,t){this.socket=e,this.transport=t,this.id=mm(),this.url=new URL(e.url),this[oi]=new EventTarget,this.transport.addEventListener("outgoing",n=>{const r=st(this.socket,new Zc("message",{data:n.data,origin:n.origin,cancelable:!0}));this[oi].dispatchEvent(r),r.defaultPrevented&&n.preventDefault()}),this.transport.addEventListener("close",n=>{this[oi].dispatchEvent(st(this.socket,new yl("close",n)))})}addEventListener(e,t,n){if(!Reflect.has(t,Ms)){const r=t.bind(this.socket);Object.defineProperty(t,Ms,{value:r,enumerable:!1,configurable:!1})}this[oi].addEventListener(e,Reflect.get(t,Ms),n)}removeEventListener(e,t,n){this[oi].removeEventListener(e,Reflect.get(t,Ms),n)}send(e){this.transport.send(e)}close(e,t){this.transport.close(e,t)}},gf="InvalidAccessError: close code out of user configurable range",Qs=Symbol("kPassthroughPromise"),Fm=Symbol("kOnSend"),Hi=Symbol("kClose"),ts=class extends EventTarget{constructor(e,t){super(),this.CONNECTING=0,this.OPEN=1,this.CLOSING=2,this.CLOSED=3,this._onopen=null,this._onmessage=null,this._onerror=null,this._onclose=null,this.url=e.toString(),this.protocol="",this.extensions="",this.binaryType="blob",this.readyState=this.CONNECTING,this.bufferedAmount=0,this[Qs]=new e0,queueMicrotask(async()=>{await this[Qs]||(this.protocol=typeof t=="string"?t:Array.isArray(t)&&t.length>0?t[0]:"",this.readyState===this.CONNECTING&&(this.readyState=this.OPEN,this.dispatchEvent(st(this,new Event("open")))))})}set onopen(e){this.removeEventListener("open",this._onopen),this._onopen=e,e!==null&&this.addEventListener("open",e)}get onopen(){return this._onopen}set onmessage(e){this.removeEventListener("message",this._onmessage),this._onmessage=e,e!==null&&this.addEventListener("message",e)}get onmessage(){return this._onmessage}set onerror(e){this.removeEventListener("error",this._onerror),this._onerror=e,e!==null&&this.addEventListener("error",e)}get onerror(){return this._onerror}set onclose(e){this.removeEventListener("close",this._onclose),this._onclose=e,e!==null&&this.addEventListener("close",e)}get onclose(){return this._onclose}send(e){if(this.readyState===this.CONNECTING)throw this.close(),new DOMException("InvalidStateError");this.readyState===this.CLOSING||this.readyState===this.CLOSED||(this.bufferedAmount+=l0(e),queueMicrotask(()=>{var t;this.bufferedAmount=0,(t=this[Fm])==null||t.call(this,e)}))}close(e=1e3,t){Kt(e,gf),Kt(e===1e3||e>=3e3&&e<=4999,gf),this[Hi](e,t)}[Hi](e=1e3,t,n=!0){this.readyState===this.CLOSING||this.readyState===this.CLOSED||(this.readyState=this.CLOSING,queueMicrotask(()=>{this.readyState=this.CLOSED,this.dispatchEvent(st(this,new yl("close",{code:e,reason:t,wasClean:n}))),this._onopen=null,this._onmessage=null,this._onerror=null,this._onclose=null}))}addEventListener(e,t,n){return super.addEventListener(e,t,n)}removeEventListener(e,t,n){return super.removeEventListener(e,t,n)}};ts.CONNECTING=0;ts.OPEN=1;ts.CLOSING=2;ts.CLOSED=3;function l0(e){return typeof e=="string"?e.length:e instanceof Blob?e.size:e.byteLength}var tr=Symbol("kEmitter"),xs=Symbol("kBoundListener"),zu=Symbol("kSend"),u0=class{constructor(e,t,n){this.client=e,this.transport=t,this.createConnection=n,this[tr]=new EventTarget,this.mockCloseController=new AbortController,this.realCloseController=new AbortController,this.transport.addEventListener("outgoing",r=>{typeof this.realWebSocket>"u"||queueMicrotask(()=>{r.defaultPrevented||this[zu](r.data)})}),this.transport.addEventListener("incoming",this.handleIncomingMessage.bind(this))}get socket(){return Kt(this.realWebSocket,'Cannot access "socket" on the original WebSocket server object: the connection is not open. Did you forget to call `server.connect()`?'),this.realWebSocket}connect(){Kt(!this.realWebSocket||this.realWebSocket.readyState!==WebSocket.OPEN,'Failed to call "connect()" on the original WebSocket instance: the connection already open');const e=this.createConnection();e.binaryType=this.client.binaryType,e.addEventListener("open",t=>{this[tr].dispatchEvent(st(this.realWebSocket,new Event("open",t)))},{once:!0}),e.addEventListener("message",t=>{this.transport.dispatchEvent(st(this.realWebSocket,new MessageEvent("incoming",{data:t.data,origin:t.origin})))}),this.client.addEventListener("close",t=>{this.handleMockClose(t)},{signal:this.mockCloseController.signal}),e.addEventListener("close",t=>{this.handleRealClose(t)},{signal:this.realCloseController.signal}),e.addEventListener("error",()=>{const t=st(e,new Event("error",{cancelable:!0}));this[tr].dispatchEvent(t),t.defaultPrevented||this.client.dispatchEvent(st(this.client,new Event("error")))}),this.realWebSocket=e}addEventListener(e,t,n){if(!Reflect.has(t,xs)){const r=t.bind(this.client);Object.defineProperty(t,xs,{value:r,enumerable:!1})}this[tr].addEventListener(e,Reflect.get(t,xs),n)}removeEventListener(e,t,n){this[tr].removeEventListener(e,Reflect.get(t,xs),n)}send(e){this[zu](e)}[zu](e){const{realWebSocket:t}=this;if(Kt(t,'Failed to call "server.send()" for "%s": the connection is not open. Did you forget to call "server.connect()"?',this.client.url),!(t.readyState===WebSocket.CLOSING||t.readyState===WebSocket.CLOSED)){if(t.readyState===WebSocket.CONNECTING){t.addEventListener("open",()=>{t.send(e)},{once:!0});return}t.send(e)}}close(){const{realWebSocket:e}=this;Kt(e,'Failed to close server connection for "%s": the connection is not open. Did you forget to call "server.connect()"?',this.client.url),this.realCloseController.abort(),!(e.readyState===WebSocket.CLOSING||e.readyState===WebSocket.CLOSED)&&(e.close(),queueMicrotask(()=>{this[tr].dispatchEvent(st(this.realWebSocket,new pf("close",{code:1e3,cancelable:!0})))}))}handleIncomingMessage(e){const t=st(e.target,new Zc("message",{data:e.data,origin:e.origin,cancelable:!0}));this[tr].dispatchEvent(t),t.defaultPrevented||this.client.dispatchEvent(st(this.client,new MessageEvent("message",{data:e.data,origin:e.origin})))}handleMockClose(e){this.realWebSocket&&this.realWebSocket.close()}handleRealClose(e){this.mockCloseController.abort();const t=st(this.realWebSocket,new pf("close",{code:e.code,reason:e.reason,wasClean:e.wasClean,cancelable:!0}));this[tr].dispatchEvent(t),t.defaultPrevented||this.client[Hi](e.code,e.reason)}},c0=class extends EventTarget{constructor(e){super(),this.socket=e,this.socket.addEventListener("close",t=>{this.dispatchEvent(st(this.socket,new yl("close",t)))}),this.socket[Fm]=t=>{this.dispatchEvent(st(this.socket,new Zc("outgoing",{data:t,origin:this.socket.url,cancelable:!0})))}}addEventListener(e,t,n){return super.addEventListener(e,t,n)}dispatchEvent(e){return super.dispatchEvent(e)}send(e){queueMicrotask(()=>{this.socket.dispatchEvent(st(this.socket,new MessageEvent("message",{data:e,origin:this.socket.url})))})}close(e,t){this.socket[Hi](e,t)}},Lm=class extends qk{constructor(){super(Lm.symbol)}checkEnvironment(){return typeof globalThis.WebSocket<"u"}setup(){const e=globalThis.WebSocket,t=new Proxy(globalThis.WebSocket,{construct:(n,r,a)=>{const[o,i]=r,s=()=>Reflect.construct(n,r,a),l=new ts(o,i),u=new c0(l);return queueMicrotask(()=>{try{const c=new u0(l,u,s);this.emitter.emit("connection",{client:new s0(l,u),server:c,info:{protocols:i}})?l[Qs].resolve(!1):(l[Qs].resolve(!0),c.connect(),c.addEventListener("open",()=>{l.dispatchEvent(st(l,new Event("open"))),c.realWebSocket&&(l.protocol=c.realWebSocket.protocol)}))}catch(c){c instanceof Error&&(l.dispatchEvent(new Event("error")),l.readyState!==WebSocket.CLOSING&&l.readyState!==WebSocket.CLOSED&&l[Hi](1011,c.message,!1),console.error(c))}}),l}});globalThis.WebSocket=t,this.subscriptions.push(()=>{globalThis.WebSocket=e})}},qm=Lm;qm.symbol=Symbol("websocket");const gc=new qm;function d0(e){gc.on("connection",async t=>{const n=e.getHandlers(),r=new MessageEvent("connection",{data:t}),a=[];for(const o of n)o instanceof Zv&&o.predicate({event:r,parsedResult:o.parse({event:r})})&&a.push(o);if(a.length>0){e==null||e.onMockedConnection(t);for(const o of a)o[Rm](r)}else{const o=new Request(t.client.url,{headers:{upgrade:"websocket",connection:"upgrade"}});await Nm(o,e.getUnhandledRequestStrategy()).catch(i=>{const s=new Event("error");Object.defineProperty(s,"cause",{enumerable:!0,configurable:!1,value:i}),t.client.socket.dispatchEvent(s)}),e==null||e.onPassthroughConnection(t),t.server.connect()}})}function bl(e){return e instanceof Blob?e.size:e instanceof ArrayBuffer?e.byteLength:new Blob([e]).size}const yf=24;function Du(e){return e.length<=yf?e:`${e.slice(0,yf)}…`}async function wl(e){if(e instanceof Blob){const t=await e.text();return`Blob(${Du(t)})`}if(typeof e=="object"&&"byteLength"in e){const t=new TextDecoder().decode(e);return`ArrayBuffer(${Du(t)})`}return Du(e)}const qa={system:"#3b82f6",outgoing:"#22c55e",incoming:"#ef4444",mocked:"#ff6a33"};function f0(e){const{client:t,server:n}=e;h0(t),t.addEventListener("message",r=>{g0(r)}),t.addEventListener("close",r=>{m0(r)}),t.socket.addEventListener("error",r=>{p0(r)}),t.send=new Proxy(t.send,{apply(r,a,o){const[i]=o,s=new MessageEvent("message",{data:i});return Object.defineProperties(s,{currentTarget:{enumerable:!0,writable:!1,value:t.socket},target:{enumerable:!0,writable:!1,value:t.socket}}),queueMicrotask(()=>{b0(s)}),Reflect.apply(r,a,o)}}),n.addEventListener("open",()=>{n.addEventListener("message",r=>{w0(r)})},{once:!0}),n.send=new Proxy(n.send,{apply(r,a,o){const[i]=o,s=new MessageEvent("message",{data:i});return Object.defineProperties(s,{currentTarget:{enumerable:!0,writable:!1,value:n.socket},target:{enumerable:!0,writable:!1,value:n.socket}}),y0(s),Reflect.apply(r,a,o)}})}function h0(e){const t=La(e.url);console.groupCollapsed(Pe.formatMessage(`${Zn()} %c▶%c ${t}`),`color:${qa.system}`,"color:inherit"),console.log("Client:",e.socket),console.groupEnd()}function m0(e){const t=e.target,n=La(t.url);console.groupCollapsed(Pe.formatMessage(`${Zn({milliseconds:!0})} %c■%c ${n}`),`color:${qa.system}`,"color:inherit"),console.log(e),console.groupEnd()}function p0(e){const t=e.target,n=La(t.url);console.groupCollapsed(Pe.formatMessage(`${Zn({milliseconds:!0})} %c×%c ${n}`),`color:${qa.system}`,"color:inherit"),console.log(e),console.groupEnd()}async function g0(e){const t=bl(e.data),n=await wl(e.data),r=e.defaultPrevented?"⇡":"⬆";console.groupCollapsed(Pe.formatMessage(`${Zn({milliseconds:!0})} %c${r}%c ${n} %c${t}%c`),`color:${qa.outgoing}`,"color:inherit","color:gray;font-weight:normal","color:inherit;font-weight:inherit"),console.log(e),console.groupEnd()}async function y0(e){const t=bl(e.data),n=await wl(e.data);console.groupCollapsed(Pe.formatMessage(`${Zn({milliseconds:!0})} %c⬆%c ${n} %c${t}%c`),`color:${qa.mocked}`,"color:inherit","color:gray;font-weight:normal","color:inherit;font-weight:inherit"),console.log(e),console.groupEnd()}async function b0(e){const t=bl(e.data),n=await wl(e.data);console.groupCollapsed(Pe.formatMessage(`${Zn({milliseconds:!0})} %c⬇%c ${n} %c${t}%c`),`color:${qa.mocked}`,"color:inherit","color:gray;font-weight:normal","color:inherit;font-weight:inherit"),console.log(e),console.groupEnd()}async function w0(e){const t=bl(e.data),n=await wl(e.data),r=e.defaultPrevented?"⇣":"⬇";console.groupCollapsed(Pe.formatMessage(`${Zn({milliseconds:!0})} %c${r}%c ${n} %c${t}%c`),`color:${qa.incoming}`,"color:inherit","color:gray;font-weight:normal","color:inherit;font-weight:inherit"),console.log(e),console.groupEnd()}var k0=/(%?)(%([sdijo]))/g;function v0(e,t){switch(t){case"s":return e;case"d":case"i":return Number(e);case"j":return JSON.stringify(e);case"o":{if(typeof e=="string")return e;const n=JSON.stringify(e);return n==="{}"||n==="[]"||/^\[object .+?\]$/.test(n)?e:n}}}function ns(e,...t){if(t.length===0)return e;let n=0,r=e.replace(k0,(a,o,i,s)=>{const l=t[n],u=v0(l,s);return o?a:(n++,u)});return n{if(!e)throw new C0(t,...n)};Cr.as=(e,t,n,...r)=>{if(!t){const a=r.length===0?n:ns(n,...r);let o;try{o=Reflect.construct(e,[a])}catch{o=e(a)}throw o}};function Xc(){if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof process<"u"){const e=process.type;return e==="renderer"||e==="worker"?!1:!!(process.versions&&process.versions.node)}return!1}var yc=async e=>{try{return{error:null,data:await e().catch(n=>{throw n})}}catch(t){return{error:t,data:null}}};function E0(e){return new URL(e,location.href).href}function Uu(e,t,n){return[e.active,e.installing,e.waiting].filter(i=>i!=null).find(i=>n(i.scriptURL,t))||null}var A0=async(e,t={},n)=>{const r=E0(e),a=await navigator.serviceWorker.getRegistrations().then(s=>s.filter(l=>Uu(l,r,n)));!navigator.serviceWorker.controller&&a.length>0&&location.reload();const[o]=a;if(o)return o.update(),[Uu(o,r,n),o];const i=await yc(async()=>{const s=await navigator.serviceWorker.register(e,t);return[Uu(s,r,n),s]});if(i.error){if(i.error.message.includes("(404)")){const l=new URL((t==null?void 0:t.scope)||"/",location.href);throw new Error(Pe.formatMessage(`Failed to register a Service Worker for scope ('${l.href}') with script ('${r}'): Service Worker script does not exist at the given path. - -Did you forget to run "npx msw init "? - -Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/init`))}throw new Error(Pe.formatMessage(`Failed to register the Service Worker: - -%s`,i.error.message))}return i.data};function $m(e={}){if(e.quiet)return;const t=e.message||"Mocking enabled.";console.groupCollapsed(`%c${Pe.formatMessage(t)}`,"color:orangered;font-weight:bold;"),console.log("%cDocumentation: %chttps://mswjs.io/docs","font-weight:bold","font-weight:normal"),console.log("Found an issue? https://github.com/mswjs/msw/issues"),e.workerUrl&&console.log("Worker script URL:",e.workerUrl),e.workerScope&&console.log("Worker scope:",e.workerScope),e.client&&console.log("Client ID: %s (%s)",e.client.id,e.client.frameType),console.groupEnd()}async function S0(e,t){var r,a;e.workerChannel.send("MOCK_ACTIVATE");const{payload:n}=await e.events.once("MOCKING_ENABLED");if(e.isMockingEnabled){Pe.warn('Found a redundant "worker.start()" call. Note that starting the worker while mocking is already enabled will have no effect. Consider removing this "worker.start()" call.');return}e.isMockingEnabled=!0,$m({quiet:t.quiet,workerScope:(r=e.registration)==null?void 0:r.scope,workerUrl:(a=e.worker)==null?void 0:a.scriptURL,client:n.client})}var P0=class{constructor(e){this.port=e}postMessage(e,...t){const[n,r]=t;this.port.postMessage({type:e,data:n},{transfer:r})}};function T0(e){if(!["HEAD","GET"].includes(e.method))return e.body}function B0(e){return new Request(e.url,{...e,body:T0(e)})}var M0=(e,t)=>async(n,r)=>{const a=new P0(n.ports[0]),o=r.payload.id,i=B0(r.payload),s=i.clone(),l=i.clone();ho.cache.set(i,l),e.requests.set(o,l);try{await Dm(i,o,e.getRequestHandlers().filter(u=>u instanceof Tm||u instanceof pc),t,e.emitter,{onPassthroughResponse(){a.postMessage("PASSTHROUGH")},async onMockedResponse(u,{handler:c,parsedResult:d}){const h=u.clone(),m=u.clone(),y=i0(u);if(e.supports.readableStreamTransfer){const f=u.body;a.postMessage("MOCK_RESPONSE",{...y,body:f},f?[f]:void 0)}else{const f=u.body===null?null:await h.arrayBuffer();a.postMessage("MOCK_RESPONSE",{...y,body:f})}t.quiet||e.emitter.once("response:mocked",()=>{c.log({request:s,response:m,parsedResult:d})})}})}catch(u){u instanceof Error&&(Pe.error(`Uncaught exception in the request handler for "%s %s": - -%s - -This exception has been gracefully handled as a 500 response, however, it's strongly recommended to resolve this error, as it indicates a mistake in your code. If you wish to mock an error response, please see this guide: https://mswjs.io/docs/recipes/mocking-error-responses`,i.method,i.url,u.stack??u),a.postMessage("MOCK_RESPONSE",{status:500,statusText:"Request Handler Error",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:u.name,message:u.message,stack:u.stack})}))}};async function x0(e){e.workerChannel.send("INTEGRITY_CHECK_REQUEST");const{payload:t}=await e.events.once("INTEGRITY_CHECK_RESPONSE");t.checksum!=="07a8241b182f8a246a7cd39894799a9e"&&Pe.warn(`The currently registered Service Worker has been generated by a different version of MSW (${t.packageVersion}) and may not be fully compatible with the installed version. - -It's recommended you update your worker script by running this command: - - • npx msw init - -You can also automate this process and make the worker script update automatically upon the library installations. Read more: https://mswjs.io/docs/cli/init.`)}var I0=new TextEncoder;function O0(e){return I0.encode(e)}function R0(e,t){return new TextDecoder(t).decode(e)}function N0(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}var oo=Symbol("isPatchedModule");function z0(e,t){try{return e[t],!0}catch{return!1}}var D0=new Set([101,103,204,205,304]),U0=new Set([301,302,303,307,308]);function Wm(e){return D0.has(e)}function F0(e){return new Response(JSON.stringify(e instanceof Error?{name:e.name,message:e.message,stack:e.stack}:e),{status:500,statusText:"Unhandled Exception",headers:{"Content-Type":"application/json"}})}function L0(e){return z0(e,"type")&&e.type==="error"}var q0=Object.defineProperty,$0=(e,t)=>{for(var n in t)q0(e,n,{get:t[n],enumerable:!0})},bc={};$0(bc,{blue:()=>H0,gray:()=>wc,green:()=>J0,red:()=>V0,yellow:()=>W0});function W0(e){return`\x1B[33m${e}\x1B[0m`}function H0(e){return`\x1B[34m${e}\x1B[0m`}function wc(e){return`\x1B[90m${e}\x1B[0m`}function V0(e){return`\x1B[31m${e}\x1B[0m`}function J0(e){return`\x1B[32m${e}\x1B[0m`}var kl=Xc(),Hm=class{constructor(e){je(this,"prefix");this.name=e,this.prefix=`[${this.name}]`;const t=bf("DEBUG"),n=bf("LOG_LEVEL");t==="1"||t==="true"||typeof t<"u"&&this.name.startsWith(t)?(this.debug=ii(n,"debug")?an:this.debug,this.info=ii(n,"info")?an:this.info,this.success=ii(n,"success")?an:this.success,this.warning=ii(n,"warning")?an:this.warning,this.error=ii(n,"error")?an:this.error):(this.info=an,this.success=an,this.warning=an,this.error=an,this.only=an)}extend(e){return new Hm(`${this.name}:${e}`)}debug(e,...t){this.logEntry({level:"debug",message:wc(e),positionals:t,prefix:this.prefix,colors:{prefix:"gray"}})}info(e,...t){this.logEntry({level:"info",message:e,positionals:t,prefix:this.prefix,colors:{prefix:"blue"}});const n=new K0;return(r,...a)=>{n.measure(),this.logEntry({level:"info",message:`${r} ${wc(`${n.deltaTime}ms`)}`,positionals:a,prefix:this.prefix,colors:{prefix:"blue"}})}}success(e,...t){this.logEntry({level:"info",message:e,positionals:t,prefix:`✔ ${this.prefix}`,colors:{timestamp:"green",prefix:"green"}})}warning(e,...t){this.logEntry({level:"warning",message:e,positionals:t,prefix:`⚠ ${this.prefix}`,colors:{timestamp:"yellow",prefix:"yellow"}})}error(e,...t){this.logEntry({level:"error",message:e,positionals:t,prefix:`✖ ${this.prefix}`,colors:{timestamp:"red",prefix:"red"}})}only(e){e()}createEntry(e,t){return{timestamp:new Date,level:e,message:t}}logEntry(e){const{level:t,message:n,prefix:r,colors:a,positionals:o=[]}=e,i=this.createEntry(t,n),s=(a==null?void 0:a.timestamp)||"gray",l=(a==null?void 0:a.prefix)||"gray",u={timestamp:bc[s],prefix:bc[l]};this.getWriter(t)([u.timestamp(this.formatTimestamp(i.timestamp))].concat(r!=null?u.prefix(r):[]).concat(wf(n)).join(" "),...o.map(wf))}formatTimestamp(e){return`${e.toLocaleTimeString("en-GB")}:${e.getMilliseconds()}`}getWriter(e){switch(e){case"debug":case"success":case"info":return G0;case"warning":return Q0;case"error":return Y0}}},K0=class{constructor(){je(this,"startTime");je(this,"endTime");je(this,"deltaTime");this.startTime=performance.now()}measure(){this.endTime=performance.now();const e=this.endTime-this.startTime;this.deltaTime=e.toFixed(2)}},an=()=>{};function G0(e,...t){if(kl){process.stdout.write(ns(e,...t)+` -`);return}console.log(e,...t)}function Q0(e,...t){if(kl){process.stderr.write(ns(e,...t)+` -`);return}console.warn(e,...t)}function Y0(e,...t){if(kl){process.stderr.write(ns(e,...t)+` -`);return}console.error(e,...t)}function bf(e){var t;return kl?process.env[e]:(t=globalThis[e])==null?void 0:t.toString()}function ii(e,t){return e!==void 0&&e!==t}function wf(e){return typeof e>"u"?"undefined":e===null?"null":typeof e=="string"?e:typeof e=="object"?JSON.stringify(e):e.toString()}var Z0=class extends Error{constructor(e,t,n){super(`Possible EventEmitter memory leak detected. ${n} ${t.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=e,this.type=t,this.count=n,this.name="MaxListenersExceededWarning"}},Vm=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=Vm.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}_emitInternalEvent(e,t,n){this.emit(e,t,n)}_getListeners(e){return Array.prototype.concat.apply([],this.events.get(e))||[]}_removeListener(e,t){const n=e.indexOf(t);return n>-1&&e.splice(n,1),[]}_wrapOnceListener(e,t){const n=(...r)=>(this.removeListener(e,n),t.apply(this,r));return Object.defineProperty(n,"name",{value:t.name}),n}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(e,...t){const n=this._getListeners(e);return n.forEach(r=>{r.apply(this,t)}),n.length>0}addListener(e,t){this._emitInternalEvent("newListener",e,t);const n=this._getListeners(e).concat(t);if(this.events.set(e,n),this.maxListeners>0&&this.listenerCount(e)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const r=new Z0(this,e,this.listenerCount(e));console.warn(r)}return this}on(e,t){return this.addListener(e,t)}once(e,t){return this.addListener(e,this._wrapOnceListener(e,t))}prependListener(e,t){const n=this._getListeners(e);if(n.length>0){const r=[t].concat(n);this.events.set(e,r)}else this.events.set(e,n.concat(t));return this}prependOnceListener(e,t){return this.prependListener(e,this._wrapOnceListener(e,t))}removeListener(e,t){const n=this._getListeners(e);return n.length>0&&(this._removeListener(n,t),this.events.set(e,n),this._emitInternalEvent("removeListener",e,t)),this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){return e?this.events.delete(e):this.events.clear(),this}listeners(e){return Array.from(this._getListeners(e))}listenerCount(e){return this._getListeners(e).length}rawListeners(e){return this.listeners(e)}},Jm=Vm;Jm.defaultMaxListeners=10;var X0="x-interceptors-internal-request-id";function kf(e){return globalThis[e]||void 0}function ej(e,t){globalThis[e]=t}function tj(e){delete globalThis[e]}var ed=class{constructor(e){this.symbol=e,this.readyState="INACTIVE",this.emitter=new Jm,this.subscriptions=[],this.logger=new Hm(e.description),this.emitter.setMaxListeners(0),this.logger.info("constructing the interceptor...")}checkEnvironment(){return!0}apply(){const e=this.logger.extend("apply");if(e.info("applying the interceptor..."),this.readyState==="APPLIED"){e.info("intercepted already applied!");return}if(!this.checkEnvironment()){e.info("the interceptor cannot be applied in this environment!");return}this.readyState="APPLYING";const n=this.getInstance();if(n){e.info("found a running instance, reusing..."),this.on=(r,a)=>(e.info('proxying the "%s" listener',r),n.emitter.addListener(r,a),this.subscriptions.push(()=>{n.emitter.removeListener(r,a),e.info('removed proxied "%s" listener!',r)}),this),this.readyState="APPLIED";return}e.info("no running instance found, setting up a new instance..."),this.setup(),this.setInstance(),this.readyState="APPLIED"}setup(){}on(e,t){const n=this.logger.extend("on");return this.readyState==="DISPOSING"||this.readyState==="DISPOSED"?(n.info("cannot listen to events, already disposed!"),this):(n.info('adding "%s" event listener:',e,t),this.emitter.on(e,t),this)}once(e,t){return this.emitter.once(e,t),this}off(e,t){return this.emitter.off(e,t),this}removeAllListeners(e){return this.emitter.removeAllListeners(e),this}dispose(){const e=this.logger.extend("dispose");if(this.readyState==="DISPOSED"){e.info("cannot dispose, already disposed!");return}if(e.info("disposing the interceptor..."),this.readyState="DISPOSING",!this.getInstance()){e.info("no interceptors running, skipping dispose...");return}if(this.clearInstance(),e.info("global symbol deleted:",kf(this.symbol)),this.subscriptions.length>0){e.info("disposing of %d subscriptions...",this.subscriptions.length);for(const t of this.subscriptions)t();this.subscriptions=[],e.info("disposed of all subscriptions!",this.subscriptions.length)}this.emitter.removeAllListeners(),e.info("destroyed the listener!"),this.readyState="DISPOSED"}getInstance(){var e;const t=kf(this.symbol);return this.logger.info("retrieved global instance:",(e=t==null?void 0:t.constructor)==null?void 0:e.name),t}setInstance(){ej(this.symbol,this),this.logger.info("set global instance!",this.symbol.description)}clearInstance(){tj(this.symbol),this.logger.info("cleared global instance!",this.symbol.description)}};function Km(){return Math.random().toString(16).slice(2)}var kc=class extends ed{constructor(e){kc.symbol=Symbol(e.name),super(kc.symbol),this.interceptors=e.interceptors}setup(){const e=this.logger.extend("setup");e.info("applying all %d interceptors...",this.interceptors.length);for(const t of this.interceptors)e.info('applying "%s" interceptor...',t.constructor.name),t.apply(),e.info("adding interceptor dispose subscription"),this.subscriptions.push(()=>t.dispose())}on(e,t){for(const n of this.interceptors)n.on(e,t);return this}once(e,t){for(const n of this.interceptors)n.once(e,t);return this}off(e,t){for(const n of this.interceptors)n.off(e,t);return this}removeAllListeners(e){for(const t of this.interceptors)t.removeAllListeners(e);return this}};function nj(e){return(t,n)=>{var s;const{payload:r}=n,{requestId:a}=r,o=e.requests.get(a);if(e.requests.delete(a),(s=r.type)!=null&&s.includes("opaque"))return;const i=r.status===0?Response.error():new Response(Wm(r.status)?null:r.body,r);i.url||Object.defineProperty(i,"url",{value:o.url,enumerable:!0,writable:!1}),e.emitter.emit(r.isMockedResponse?"response:mocked":"response:bypass",{response:i,request:o,requestId:r.requestId})}}function rj(e,t){!(t!=null&&t.quiet)&&!location.href.startsWith(e.scope)&&Pe.warn(`Cannot intercept requests on this page because it's outside of the worker's scope ("${e.scope}"). If you wish to mock API requests on this page, you must resolve this scope issue. - -- (Recommended) Register the worker at the root level ("/") of your application. -- Set the "Service-Worker-Allowed" response header to allow out-of-scope workers.`)}var aj=e=>function(n,r){return(async()=>{e.events.removeAllListeners(),e.workerChannel.on("REQUEST",M0(e,n)),e.workerChannel.on("RESPONSE",nj(e));const i=await A0(n.serviceWorker.url,n.serviceWorker.options,n.findWorker),[s,l]=i;if(!s){const u=r!=null&&r.findWorker?Pe.formatMessage(`Failed to locate the Service Worker registration using a custom "findWorker" predicate. - -Please ensure that the custom predicate properly locates the Service Worker registration at "%s". -More details: https://mswjs.io/docs/api/setup-worker/start#findworker -`,n.serviceWorker.url):Pe.formatMessage(`Failed to locate the Service Worker registration. - -This most likely means that the worker script URL "%s" cannot resolve against the actual public hostname (%s). This may happen if your application runs behind a proxy, or has a dynamic hostname. - -Please consider using a custom "serviceWorker.url" option to point to the actual worker script location, or a custom "findWorker" option to resolve the Service Worker registration manually. More details: https://mswjs.io/docs/api/setup-worker/start`,n.serviceWorker.url,location.host);throw new Error(u)}return e.worker=s,e.registration=l,e.events.addListener(window,"beforeunload",()=>{s.state!=="redundant"&&e.workerChannel.send("CLIENT_CLOSED"),window.clearInterval(e.keepAliveInterval),window.postMessage({type:"msw/worker:stop"})}),await x0(e).catch(u=>{Pe.error("Error while checking the worker script integrity. Please report this on GitHub (https://github.com/mswjs/msw/issues), including the original error below."),console.error(u)}),e.keepAliveInterval=window.setInterval(()=>e.workerChannel.send("KEEPALIVE_REQUEST"),5e3),rj(l,e.startOptions),l})().then(async i=>{const s=i.installing||i.waiting;return s&&await new Promise(l=>{s.addEventListener("statechange",()=>{if(s.state==="activated")return l()})}),await S0(e,n).catch(l=>{throw new Error(`Failed to enable mocking: ${l==null?void 0:l.message}`)}),i})};function Gm(e={}){e.quiet||console.log(`%c${Pe.formatMessage("Mocking disabled.")}`,"color:orangered;font-weight:bold;")}var oj=e=>function(){var n;if(!e.isMockingEnabled){Pe.warn('Found a redundant "worker.stop()" call. Note that stopping the worker while mocking already stopped has no effect. Consider removing this "worker.stop()" call.');return}e.workerChannel.send("MOCK_DEACTIVATE"),e.isMockingEnabled=!1,window.clearInterval(e.keepAliveInterval),window.postMessage({type:"msw/worker:stop"}),Gm({quiet:(n=e.startOptions)==null?void 0:n.quiet})},ij={serviceWorker:{url:"/mockServiceWorker.js",options:null},quiet:!1,waitUntilReady:!0,onUnhandledRequest:"warn",findWorker(e,t){return e===t}};function sj(){const e=(t,n)=>{e.state="pending",e.resolve=r=>{if(e.state!=="pending")return;e.result=r;const a=o=>(e.state="fulfilled",o);return t(r instanceof Promise?r:Promise.resolve(r).then(a))},e.reject=r=>{if(e.state==="pending")return queueMicrotask(()=>{e.state="rejected"}),n(e.rejectionReason=r)}};return e}var fr,fo,qs,em,td=(em=class extends Promise{constructor(t=null){const n=sj();super((r,a)=>{n(r,a),t==null||t(n.resolve,n.reject)});ei(this,fo);ei(this,fr,void 0);je(this,"resolve");je(this,"reject");xu(this,fr,n),this.resolve=_n(this,fr).resolve,this.reject=_n(this,fr).reject}get state(){return _n(this,fr).state}get rejectionReason(){return _n(this,fr).rejectionReason}then(t,n){return $r(this,fo,qs).call(this,super.then(t,n))}catch(t){return $r(this,fo,qs).call(this,super.catch(t))}finally(t){return $r(this,fo,qs).call(this,super.finally(t))}},fr=new WeakMap,fo=new WeakSet,qs=function(t){return Object.defineProperties(t,{resolve:{configurable:!0,value:this.resolve},reject:{configurable:!0,value:this.reject}})},em),Ys=class extends Error{constructor(e){super(e),this.name="InterceptorError",Object.setPrototypeOf(this,Ys.prototype)}},si=Symbol("kRequestHandled"),un=Symbol("kResponsePromise"),nd=class{constructor(e){this.request=e,this[si]=!1,this[un]=new td}respondWith(e){Cr.as(Ys,!this[si],'Failed to respond to the "%s %s" request: the "request" event has already been handled.',this.request.method,this.request.url),this[si]=!0,this[un].resolve(e)}errorWith(e){Cr.as(Ys,!this[si],'Failed to error the "%s %s" request: the "request" event has already been handled.',this.request.method,this.request.url),this[si]=!0,this[un].resolve(e)}};async function Zs(e,t,...n){const r=e.listeners(t);if(r.length!==0)for(const a of r)await a.apply(e,n)}function lj(e){return e==null||!(e instanceof Error)?!1:"code"in e&&"errno"in e}async function Qm(e){const t=async o=>(o instanceof Error?e.onError(o):L0(o)?e.onRequestError(o):await e.onResponse(o),!0),n=async o=>{if(o instanceof Ys)throw a.error;return lj(o)?(e.onError(o),!0):o instanceof Response?await t(o):!1};e.emitter.once("request",({requestId:o})=>{o===e.requestId&&e.controller[un].state==="pending"&&e.controller[un].resolve(void 0)});const r=new td;e.request.signal&&e.request.signal.addEventListener("abort",()=>{r.reject(e.request.signal.reason)},{once:!0});const a=await yc(async()=>{const o=Zs(e.emitter,"request",{requestId:e.requestId,request:e.request,controller:e.controller});return await Promise.race([r,o,e.controller[un]]),await e.controller[un]});if(r.state==="rejected")return e.onError(r.rejectionReason),!0;if(a.error){if(await n(a.error))return!0;if(e.emitter.listenerCount("unhandledException")>0){const o=new nd(e.request);await Zs(e.emitter,"unhandledException",{error:a.error,request:e.request,requestId:e.requestId,controller:o}).then(()=>{o[un].state==="pending"&&o[un].resolve(void 0)});const i=await yc(()=>o[un]);if(i.error)return n(i.error);if(i.data)return t(i.data)}return e.onResponse(F0(a.error)),!0}return a.data?t(a.data):!1}function uj(e){try{return new URL(e),!0}catch{return!1}}function ea(e){return Object.assign(new TypeError("Failed to fetch"),{cause:e})}var cj=["content-encoding","content-language","content-location","content-type","content-length"],Fu=Symbol("kRedirectCount");async function dj(e,t){if(t.status!==303&&e.body!=null)return Promise.reject(ea());const n=new URL(e.url);let r;try{r=new URL(t.headers.get("location"),e.url)}catch(o){return Promise.reject(ea(o))}if(!(r.protocol==="http:"||r.protocol==="https:"))return Promise.reject(ea("URL scheme must be a HTTP(S) scheme"));if(Reflect.get(e,Fu)>20)return Promise.reject(ea("redirect count exceeded"));if(Object.defineProperty(e,Fu,{value:(Reflect.get(e,Fu)||0)+1}),e.mode==="cors"&&(r.username||r.password)&&!vf(n,r))return Promise.reject(ea('cross origin not allowed for request mode "cors"'));const a={};return([301,302].includes(t.status)&&e.method==="POST"||t.status===303&&!["HEAD","GET"].includes(e.method))&&(a.method="GET",a.body=null,cj.forEach(o=>{e.headers.delete(o)})),vf(n,r)||(e.headers.delete("authorization"),e.headers.delete("proxy-authorization"),e.headers.delete("cookie"),e.headers.delete("host")),a.headers=e.headers,fetch(new Request(r,a))}function vf(e,t){return e.origin===t.origin&&e.origin==="null"||e.protocol===t.protocol&&e.hostname===t.hostname&&e.port===t.port}var Ym=class extends ed{constructor(){super(Ym.symbol)}checkEnvironment(){return typeof globalThis<"u"&&typeof globalThis.fetch<"u"}async setup(){const e=globalThis.fetch;Cr(!e[oo],'Failed to patch the "fetch" module: already patched.'),globalThis.fetch=async(t,n)=>{const r=Km(),a=typeof t=="string"&&typeof location<"u"&&!uj(t)?new URL(t,location.origin):t,o=new Request(a,n),i=new td,s=new nd(o);return this.logger.info("[%s] %s",o.method,o.url),this.logger.info("awaiting for the mocked response..."),this.logger.info('emitting the "request" event for %s listener(s)...',this.emitter.listenerCount("request")),await Qm({request:o,requestId:r,emitter:this.emitter,controller:s,onResponse:async u=>{if(this.logger.info("received mocked response!",{response:u}),U0.has(u.status)){if(o.redirect==="error"){i.reject(ea("unexpected redirect"));return}if(o.redirect==="follow"){dj(o,u).then(c=>{i.resolve(c)},c=>{i.reject(c)});return}}this.emitter.listenerCount("response")>0&&(this.logger.info('emitting the "response" event...'),await Zs(this.emitter,"response",{response:u.clone(),isMockedResponse:!0,request:o,requestId:r})),Object.defineProperty(u,"url",{writable:!1,enumerable:!0,configurable:!1,value:o.url}),i.resolve(u)},onRequestError:u=>{this.logger.info("request has errored!",{response:u}),i.reject(ea(u))},onError:u=>{this.logger.info("request has been aborted!",{error:u}),i.reject(u)}})?(this.logger.info("request has been handled, returning mock promise..."),i):(this.logger.info("no mocked response received, performing request as-is..."),e(o).then(async u=>{if(this.logger.info("original fetch performed",u),this.emitter.listenerCount("response")>0){this.logger.info('emitting the "response" event...');const c=u.clone();await Zs(this.emitter,"response",{response:c,isMockedResponse:!1,request:o,requestId:r})}return u}))},Object.defineProperty(globalThis.fetch,oo,{enumerable:!0,configurable:!0,value:!0}),this.subscriptions.push(()=>{Object.defineProperty(globalThis.fetch,oo,{value:void 0}),globalThis.fetch=e,this.logger.info('restored native "globalThis.fetch"!',globalThis.fetch.name)})}},Zm=Ym;Zm.symbol=Symbol("fetch");function fj(e,t){const n=new Uint8Array(e.byteLength+t.byteLength);return n.set(e,0),n.set(t,e.byteLength),n}var Xm=class{constructor(e,t){this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.type="",this.srcElement=null,this.currentTarget=null,this.eventPhase=0,this.isTrusted=!0,this.composed=!1,this.cancelable=!0,this.defaultPrevented=!1,this.bubbles=!0,this.lengthComputable=!0,this.loaded=0,this.total=0,this.cancelBubble=!1,this.returnValue=!0,this.type=e,this.target=(t==null?void 0:t.target)||null,this.currentTarget=(t==null?void 0:t.currentTarget)||null,this.timeStamp=Date.now()}composedPath(){return[]}initEvent(e,t,n){this.type=e,this.bubbles=!!t,this.cancelable=!!n}preventDefault(){this.defaultPrevented=!0}stopPropagation(){}stopImmediatePropagation(){}},hj=class extends Xm{constructor(e,t){super(e),this.lengthComputable=(t==null?void 0:t.lengthComputable)||!1,this.composed=(t==null?void 0:t.composed)||!1,this.loaded=(t==null?void 0:t.loaded)||0,this.total=(t==null?void 0:t.total)||0}},mj=typeof ProgressEvent<"u";function pj(e,t,n){const r=["error","progress","loadstart","loadend","load","timeout","abort"],a=mj?ProgressEvent:hj;return r.includes(t)?new a(t,{lengthComputable:!0,loaded:(n==null?void 0:n.loaded)||0,total:(n==null?void 0:n.total)||0}):new Xm(t,{target:e,currentTarget:e})}function ep(e,t){if(!(t in e))return null;if(Object.prototype.hasOwnProperty.call(e,t))return e;const r=Reflect.getPrototypeOf(e);return r?ep(r,t):null}function Lu(e,t){return new Proxy(e,gj(t))}function gj(e){const{constructorCall:t,methodCall:n,getProperty:r,setProperty:a}=e,o={};return typeof t<"u"&&(o.construct=function(i,s,l){const u=Reflect.construct.bind(null,i,s,l);return t.call(l,s,u)}),o.set=function(i,s,l){const u=()=>{const c=ep(i,s)||i,d=Reflect.getOwnPropertyDescriptor(c,s);return typeof(d==null?void 0:d.set)<"u"?(d.set.apply(i,[l]),!0):Reflect.defineProperty(c,s,{writable:!0,enumerable:!0,configurable:!0,value:l})};return typeof a<"u"?a.call(i,[s,l],u):u()},o.get=function(i,s,l){const u=()=>i[s],c=typeof r<"u"?r.call(i,[s,l],u):u();return typeof c=="function"?(...d)=>{const h=c.bind(i,...d);return typeof n<"u"?n.call(i,[s,d],h):h()}:c},o}function yj(e){return["application/xhtml+xml","application/xml","image/svg+xml","text/html","text/xml"].some(n=>e.startsWith(n))}function bj(e){try{return JSON.parse(e)}catch{return null}}function wj(e,t){const n=Wm(e.status)?null:t;return new Response(n,{status:e.status,statusText:e.statusText,headers:kj(e.getAllResponseHeaders())})}function kj(e){const t=new Headers,n=e.split(/[\r\n]+/);for(const r of n){if(r.trim()==="")continue;const[a,...o]=r.split(": "),i=o.join(": ");t.append(a,i)}return t}async function jf(e){const t=e.headers.get("content-length");return t!=null&&t!==""?Number(t):(await e.arrayBuffer()).byteLength}var li=Symbol("kIsRequestHandled"),vj=Xc(),qu=Symbol("kFetchRequest"),jj=class{constructor(e,t){this.initialRequest=e,this.logger=t,this.method="GET",this.url=null,this[li]=!1,this.events=new Map,this.uploadEvents=new Map,this.requestId=Km(),this.requestHeaders=new Headers,this.responseBuffer=new Uint8Array,this.request=Lu(e,{setProperty:([n,r],a)=>{switch(n){case"ontimeout":{const o=n.slice(2);return this.request.addEventListener(o,r),a()}default:return a()}},methodCall:([n,r],a)=>{var o;switch(n){case"open":{const[i,s]=r;return typeof s>"u"?(this.method="GET",this.url=_f(i)):(this.method=i,this.url=_f(s)),this.logger=this.logger.extend(`${this.method} ${this.url.href}`),this.logger.info("open",this.method,this.url.href),a()}case"addEventListener":{const[i,s]=r;return this.registerEvent(i,s),this.logger.info("addEventListener",i,s),a()}case"setRequestHeader":{const[i,s]=r;return this.requestHeaders.set(i,s),this.logger.info("setRequestHeader",i,s),a()}case"send":{const[i]=r;this.request.addEventListener("load",()=>{if(typeof this.onResponse<"u"){const c=wj(this.request,this.request.response);this.onResponse.call(this,{response:c,isMockedResponse:this[li],request:l,requestId:this.requestId})}});const s=typeof i=="string"?O0(i):i,l=this.toFetchApiRequest(s);this[qu]=l.clone(),(((o=this.onRequest)==null?void 0:o.call(this,{request:l,requestId:this.requestId}))||Promise.resolve()).finally(()=>{if(!this[li])return this.logger.info("request callback settled but request has not been handled (readystate %d), performing as-is...",this.request.readyState),vj&&this.request.setRequestHeader(X0,this.requestId),a()});break}default:return a()}}}),Ka(this.request,"upload",Lu(this.request.upload,{setProperty:([n,r],a)=>{switch(n){case"onloadstart":case"onprogress":case"onaboart":case"onerror":case"onload":case"ontimeout":case"onloadend":{const o=n.slice(2);this.registerUploadEvent(o,r)}}return a()},methodCall:([n,r],a)=>{switch(n){case"addEventListener":{const[o,i]=r;return this.registerUploadEvent(o,i),this.logger.info("upload.addEventListener",o,i),a()}}}}))}registerEvent(e,t){const r=(this.events.get(e)||[]).concat(t);this.events.set(e,r),this.logger.info('registered event "%s"',e,t)}registerUploadEvent(e,t){const r=(this.uploadEvents.get(e)||[]).concat(t);this.uploadEvents.set(e,r),this.logger.info('registered upload event "%s"',e,t)}async respondWith(e){if(this[li]=!0,this[qu]){const r=await jf(this[qu]);this.trigger("loadstart",this.request.upload,{loaded:0,total:r}),this.trigger("progress",this.request.upload,{loaded:r,total:r}),this.trigger("load",this.request.upload,{loaded:r,total:r}),this.trigger("loadend",this.request.upload,{loaded:r,total:r})}this.logger.info("responding with a mocked response: %d %s",e.status,e.statusText),Ka(this.request,"status",e.status),Ka(this.request,"statusText",e.statusText),Ka(this.request,"responseURL",this.url.href),this.request.getResponseHeader=new Proxy(this.request.getResponseHeader,{apply:(r,a,o)=>{if(this.logger.info("getResponseHeader",o[0]),this.request.readyState{if(this.logger.info("getAllResponseHeaders"),this.request.readyState`${o}: ${i}`).join(`\r -`);return this.logger.info("resolved all response headers to",a),a}}),Object.defineProperties(this.request,{response:{enumerable:!0,configurable:!1,get:()=>this.response},responseText:{enumerable:!0,configurable:!1,get:()=>this.responseText},responseXML:{enumerable:!0,configurable:!1,get:()=>this.responseXML}});const t=await jf(e.clone());this.logger.info("calculated response body length",t),this.trigger("loadstart",this.request,{loaded:0,total:t}),this.setReadyState(this.request.HEADERS_RECEIVED),this.setReadyState(this.request.LOADING);const n=()=>{this.logger.info("finalizing the mocked response..."),this.setReadyState(this.request.DONE),this.trigger("load",this.request,{loaded:this.responseBuffer.byteLength,total:t}),this.trigger("loadend",this.request,{loaded:this.responseBuffer.byteLength,total:t})};if(e.body){this.logger.info("mocked response has body, streaming...");const r=e.body.getReader(),a=async()=>{const{value:o,done:i}=await r.read();if(i){this.logger.info("response body stream done!"),n();return}o&&(this.logger.info("read response body chunk:",o),this.responseBuffer=fj(this.responseBuffer,o),this.trigger("progress",this.request,{loaded:this.responseBuffer.byteLength,total:t})),a()};a()}else n()}responseBufferToText(){return R0(this.responseBuffer)}get response(){if(this.logger.info("getResponse (responseType: %s)",this.request.responseType),this.request.readyState!==this.request.DONE)return null;switch(this.request.responseType){case"json":{const e=bj(this.responseBufferToText());return this.logger.info("resolved response JSON",e),e}case"arraybuffer":{const e=N0(this.responseBuffer);return this.logger.info("resolved response ArrayBuffer",e),e}case"blob":{const e=this.request.getResponseHeader("Content-Type")||"text/plain",t=new Blob([this.responseBufferToText()],{type:e});return this.logger.info("resolved response Blob (mime type: %s)",t,e),t}default:{const e=this.responseBufferToText();return this.logger.info('resolving "%s" response type as text',this.request.responseType,e),e}}}get responseText(){if(Cr(this.request.responseType===""||this.request.responseType==="text","InvalidStateError: The object is in invalid state."),this.request.readyState!==this.request.LOADING&&this.request.readyState!==this.request.DONE)return"";const e=this.responseBufferToText();return this.logger.info('getResponseText: "%s"',e),e}get responseXML(){if(Cr(this.request.responseType===""||this.request.responseType==="document","InvalidStateError: The object is in invalid state."),this.request.readyState!==this.request.DONE)return null;const e=this.request.getResponseHeader("Content-Type")||"";return typeof DOMParser>"u"?(console.warn("Cannot retrieve XMLHttpRequest response body as XML: DOMParser is not defined. You are likely using an environment that is not browser or does not polyfill browser globals correctly."),null):yj(e)?new DOMParser().parseFromString(this.responseBufferToText(),e):null}errorWith(e){this[li]=!0,this.logger.info("responding with an error"),this.setReadyState(this.request.DONE),this.trigger("error",this.request),this.trigger("loadend",this.request)}setReadyState(e){if(this.logger.info("setReadyState: %d -> %d",this.request.readyState,e),this.request.readyState===e){this.logger.info("ready state identical, skipping transition...");return}Ka(this.request,"readyState",e),this.logger.info("set readyState to: %d",e),e!==this.request.UNSENT&&(this.logger.info('triggerring "readystatechange" event...'),this.trigger("readystatechange",this.request))}trigger(e,t,n){const r=t[`on${e}`],a=pj(t,e,n);this.logger.info('trigger "%s"',e,n||""),typeof r=="function"&&(this.logger.info('found a direct "%s" callback, calling...',e),r.call(t,a));const o=t instanceof XMLHttpRequestUpload?this.uploadEvents:this.events;for(const[i,s]of o)i===e&&(this.logger.info('found %d listener(s) for "%s" event, calling...',s.length,e),s.forEach(l=>l.call(t,a)))}toFetchApiRequest(e){this.logger.info("converting request to a Fetch API Request...");const t=e instanceof Document?e.documentElement.innerText:e,n=new Request(this.url.href,{method:this.method,headers:this.requestHeaders,credentials:this.request.withCredentials?"include":"same-origin",body:["GET","HEAD"].includes(this.method.toUpperCase())?null:t}),r=Lu(n.headers,{methodCall:([a,o],i)=>{switch(a){case"append":case"set":{const[s,l]=o;this.request.setRequestHeader(s,l);break}case"delete":{const[s]=o;console.warn(`XMLHttpRequest: Cannot remove a "${s}" header from the Fetch API representation of the "${n.method} ${n.url}" request. XMLHttpRequest headers cannot be removed.`);break}}return i()}});return Ka(n,"headers",r),this.logger.info("converted request to a Fetch API Request!",n),n}};function _f(e){return typeof location>"u"?new URL(e):new URL(e.toString(),location.href)}function Ka(e,t,n){Reflect.defineProperty(e,t,{writable:!0,enumerable:!0,value:n})}function _j({emitter:e,logger:t}){return new Proxy(globalThis.XMLHttpRequest,{construct(r,a,o){t.info("constructed new XMLHttpRequest");const i=Reflect.construct(r,a,o),s=Object.getOwnPropertyDescriptors(r.prototype);for(const u in s)Reflect.defineProperty(i,u,s[u]);const l=new jj(i,t);return l.onRequest=async function({request:u,requestId:c}){const d=new nd(u);this.logger.info("awaiting mocked response..."),this.logger.info('emitting the "request" event for %s listener(s)...',e.listenerCount("request")),await Qm({request:u,requestId:c,controller:d,emitter:e,onResponse:async m=>{await this.respondWith(m)},onRequestError:()=>{this.errorWith(new TypeError("Network error"))},onError:m=>{this.logger.info("request errored!",{error:m}),m instanceof Error&&this.errorWith(m)}})||this.logger.info("no mocked response received, performing request as-is...")},l.onResponse=async function({response:u,isMockedResponse:c,request:d,requestId:h}){this.logger.info('emitting the "response" event for %s listener(s)...',e.listenerCount("response")),e.emit("response",{response:u,isMockedResponse:c,request:d,requestId:h})},l.request}})}var tp=class extends ed{constructor(){super(tp.interceptorSymbol)}checkEnvironment(){return typeof globalThis.XMLHttpRequest<"u"}setup(){const e=this.logger.extend("setup");e.info('patching "XMLHttpRequest" module...');const t=globalThis.XMLHttpRequest;Cr(!t[oo],'Failed to patch the "XMLHttpRequest" module: already patched.'),globalThis.XMLHttpRequest=_j({emitter:this.emitter,logger:this.logger}),e.info('native "XMLHttpRequest" module patched!',globalThis.XMLHttpRequest.name),Object.defineProperty(globalThis.XMLHttpRequest,oo,{enumerable:!0,configurable:!0,value:!0}),this.subscriptions.push(()=>{Object.defineProperty(globalThis.XMLHttpRequest,oo,{value:void 0}),globalThis.XMLHttpRequest=t,e.info('native "XMLHttpRequest" module restored!',globalThis.XMLHttpRequest.name)})}},np=tp;np.interceptorSymbol=Symbol("xhr");function Cj(e,t){const n=new kc({name:"fallback",interceptors:[new Zm,new np]});return n.on("request",async({request:r,requestId:a,controller:o})=>{const i=r.clone(),s=await Dm(r,a,e.getRequestHandlers(),t,e.emitter,{onMockedResponse(l,{handler:u,parsedResult:c}){t.quiet||e.emitter.once("response:mocked",({response:d})=>{u.log({request:i,response:d,parsedResult:c})})}});s&&o.respondWith(s)}),n.on("response",({response:r,isMockedResponse:a,request:o,requestId:i})=>{e.emitter.emit(a?"response:mocked":"response:bypass",{response:r,request:o,requestId:i})}),n.apply(),n}function Ej(e){return async function(n){e.fallbackInterceptor=Cj(e,n),$m({message:"Mocking enabled (fallback mode).",quiet:n.quiet})}}function Aj(e){return function(){var n,r;(n=e.fallbackInterceptor)==null||n.dispose(),Gm({quiet:(r=e.startOptions)==null?void 0:r.quiet})}}function Sj(){try{const e=new ReadableStream({start:n=>n.close()});return new MessageChannel().port1.postMessage(e,[e]),!0}catch{return!1}}var Pj=class extends sk{constructor(...t){super(...t);je(this,"context");je(this,"startHandler",null);je(this,"stopHandler",null);je(this,"listeners");Cr(!Xc(),Pe.formatMessage("Failed to execute `setupWorker` in a non-browser environment. Consider using `setupServer` for Node.js environment instead.")),this.listeners=[],this.context=this.createWorkerContext()}createWorkerContext(){const t={isMockingEnabled:!1,startOptions:null,worker:null,getRequestHandlers:()=>this.handlersController.currentHandlers(),registration:null,requests:new Map,emitter:this.emitter,workerChannel:{on:(n,r)=>{this.context.events.addListener(navigator.serviceWorker,"message",a=>{if(a.source!==this.context.worker)return;const o=a.data;o&&o.type===n&&r(a,o)})},send:n=>{var r;(r=this.context.worker)==null||r.postMessage(n)}},events:{addListener:(n,r,a)=>(n.addEventListener(r,a),this.listeners.push({eventType:r,target:n,callback:a}),()=>{n.removeEventListener(r,a)}),removeAllListeners:()=>{for(const{target:n,eventType:r,callback:a}of this.listeners)n.removeEventListener(r,a);this.listeners=[]},once:n=>{const r=[];return new Promise((a,o)=>{const i=s=>{try{const l=s.data;l.type===n&&a(l)}catch(l){o(l)}};r.push(this.context.events.addListener(navigator.serviceWorker,"message",i),this.context.events.addListener(navigator.serviceWorker,"messageerror",o))}).finally(()=>{r.forEach(a=>a())})}},supports:{serviceWorkerApi:!("serviceWorker"in navigator)||location.protocol==="file:",readableStreamTransfer:Sj()}};return this.startHandler=t.supports.serviceWorkerApi?Ej(t):aj(t),this.stopHandler=t.supports.serviceWorkerApi?Aj(t):oj(t),t}async start(t={}){return t.waitUntilReady===!0&&Pe.warn('The "waitUntilReady" option has been deprecated. Please remove it from this "worker.start()" call. Follow the recommended Browser integration (https://mswjs.io/docs/integrations/browser) to eliminate any race conditions between the Service Worker registration and any requests made by your application on initial render.'),this.context.startOptions=Um(ij,t),d0({getUnhandledRequestStrategy:()=>this.context.startOptions.onUnhandledRequest,getHandlers:()=>this.handlersController.currentHandlers(),onMockedConnection:n=>{this.context.startOptions.quiet||f0(n)},onPassthroughConnection(){}}),gc.apply(),this.subscriptions.push(()=>{gc.dispose()}),await this.startHandler(this.context.startOptions,t)}stop(){super.dispose(),this.context.events.removeAllListeners(),this.context.emitter.removeAllListeners(),this.stopHandler()}};function Tj(...e){return new Pj(...e)}var Ee;(function(e){e.assertEqual=a=>a;function t(a){}e.assertIs=t;function n(a){throw new Error}e.assertNever=n,e.arrayToEnum=a=>{const o={};for(const i of a)o[i]=i;return o},e.getValidEnumValues=a=>{const o=e.objectKeys(a).filter(s=>typeof a[a[s]]!="number"),i={};for(const s of o)i[s]=a[s];return e.objectValues(i)},e.objectValues=a=>e.objectKeys(a).map(function(o){return a[o]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const o=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&o.push(i);return o},e.find=(a,o)=>{for(const i of a)if(o(i))return i},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function r(a,o=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(Ee||(Ee={}));var Xs;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Xs||(Xs={}));const ae=Ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Tn=e=>{switch(typeof e){case"undefined":return ae.undefined;case"string":return ae.string;case"number":return isNaN(e)?ae.nan:ae.number;case"boolean":return ae.boolean;case"function":return ae.function;case"bigint":return ae.bigint;case"symbol":return ae.symbol;case"object":return Array.isArray(e)?ae.array:e===null?ae.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ae.promise:typeof Map<"u"&&e instanceof Map?ae.map:typeof Set<"u"&&e instanceof Set?ae.set:typeof Date<"u"&&e instanceof Date?ae.date:ae.object;default:return ae.unknown}},K=Ee.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),rp=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class St extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(o){return o.message},r={_errors:[]},a=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let s=r,l=0;for(;ln.message){const n={},r=[];for(const a of this.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):r.push(t(a));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}St.create=e=>new St(e);const ia=(e,t)=>{let n;switch(e.code){case K.invalid_type:e.received===ae.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case K.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ee.jsonStringifyReplacer)}`;break;case K.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ee.joinValues(e.keys,", ")}`;break;case K.invalid_union:n="Invalid input";break;case K.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ee.joinValues(e.options)}`;break;case K.invalid_enum_value:n=`Invalid enum value. Expected ${Ee.joinValues(e.options)}, received '${e.received}'`;break;case K.invalid_arguments:n="Invalid function arguments";break;case K.invalid_return_type:n="Invalid function return type";break;case K.invalid_date:n="Invalid date";break;case K.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ee.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case K.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case K.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case K.custom:n="Invalid input";break;case K.invalid_intersection_types:n="Intersection results could not be merged";break;case K.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case K.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ee.assertNever(e)}return{message:n}};let ap=ia;function op(e){ap=e}function Vi(){return ap}const Ji=e=>{const{data:t,path:n,errorMaps:r,issueData:a}=e,o=[...n,...a.path||[]],i={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let s="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)s=u(i,{data:t,defaultError:s}).message;return{...a,path:o,message:s}},ip=[];function ne(e,t){const n=Vi(),r=Ji({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ia?void 0:ia].filter(a=>!!a)});e.common.issues.push(r)}class rt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const a of n){if(a.status==="aborted")return me;a.status==="dirty"&&t.dirty(),r.push(a.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const a of n){const o=await a.key,i=await a.value;r.push({key:o,value:i})}return rt.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const a of n){const{key:o,value:i}=a;if(o.status==="aborted"||i.status==="aborted")return me;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(r[o.value]=i.value)}return{status:t.value,value:r}}}const me=Object.freeze({status:"aborted"}),na=e=>({status:"dirty",value:e}),lt=e=>({status:"valid",value:e}),el=e=>e.status==="aborted",tl=e=>e.status==="dirty",mo=e=>e.status==="valid",po=e=>typeof Promise<"u"&&e instanceof Promise;function nl(e,t,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)}function sp(e,t,n,r,a){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?a.call(e,n):a?a.value=n:t.set(e,n),n}var ue;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ue||(ue={}));var xi,Ii;class pn{constructor(t,n,r,a){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Cf=(e,t)=>{if(mo(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new St(e.common.issues);return this._error=n,this._error}}};function ve(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(i,s)=>{var l,u;const{message:c}=e;return i.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:(l=c??r)!==null&&l!==void 0?l:s.defaultError}:i.code!=="invalid_type"?{message:s.defaultError}:{message:(u=c??n)!==null&&u!==void 0?u:s.defaultError}},description:a}}class be{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Tn(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Tn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new rt,ctx:{common:t.parent.common,data:t.data,parsedType:Tn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(po(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const a={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Tn(t)},o=this._parseSync({data:t,path:a.path,parent:a});return Cf(a,o)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Tn(t)},a=this._parse({data:t,path:r.path,parent:r}),o=await(po(a)?a:Promise.resolve(a));return Cf(r,o)}refine(t,n){const r=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,o)=>{const i=t(a),s=()=>o.addIssue({code:K.custom,...r(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(s(),!1)):i?!0:(s(),!1)})}refinement(t,n){return this._refinement((r,a)=>t(r)?!0:(a.addIssue(typeof n=="function"?n(r,a):n),!1))}_refinement(t){return new Rt({schema:this,typeName:he.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Qt.create(this,this._def)}nullable(){return Dn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $t.create(this,this._def)}promise(){return la.create(this,this._def)}or(t){return wo.create([this,t],this._def)}and(t){return ko.create(this,t,this._def)}transform(t){return new Rt({...ve(this._def),schema:this,typeName:he.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Eo({...ve(this._def),innerType:this,defaultValue:n,typeName:he.ZodDefault})}brand(){return new vl({typeName:he.ZodBranded,type:this,...ve(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Ao({...ve(this._def),innerType:this,catchValue:n,typeName:he.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Ro.create(this,t)}readonly(){return So.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Bj=/^c[^\s-]{8,}$/i,Mj=/^[0-9a-z]+$/,xj=/^[0-9A-HJKMNP-TV-Z]{26}$/,Ij=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Oj=/^[a-z0-9_-]{21}$/i,Rj=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Nj=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,zj="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let $u;const Dj=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Uj=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Fj=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,lp="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Lj=new RegExp(`^${lp}$`);function up(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function qj(e){return new RegExp(`^${up(e)}$`)}function rd(e){let t=`${lp}T${up(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function $j(e,t){return!!((t==="v4"||!t)&&Dj.test(e)||(t==="v6"||!t)&&Uj.test(e))}class qt extends be{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ae.string){const o=this._getOrReturnCtx(t);return ne(o,{code:K.invalid_type,expected:ae.string,received:o.parsedType}),me}const r=new rt;let a;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(a=this._getOrReturnCtx(t,a),ne(a,{code:K.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const i=t.data.length>o.value,s=t.data.lengtht.test(a),{validation:n,code:K.invalid_string,...ue.errToObj(r)})}_addCheck(t){return new qt({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ue.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ue.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ue.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ue.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ue.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ue.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ue.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ue.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ue.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ue.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...ue.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...ue.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...ue.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...ue.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...ue.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ue.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ue.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ue.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ue.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ue.errToObj(n)})}nonempty(t){return this.min(1,ue.errToObj(t))}trim(){return new qt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new qt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new qt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new qt({checks:[],typeName:he.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...ve(e)})};function Wj(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r,o=parseInt(e.toFixed(a).replace(".","")),i=parseInt(t.toFixed(a).replace(".",""));return o%i/Math.pow(10,a)}class Rn extends be{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ae.number){const o=this._getOrReturnCtx(t);return ne(o,{code:K.invalid_type,expected:ae.number,received:o.parsedType}),me}let r;const a=new rt;for(const o of this._def.checks)o.kind==="int"?Ee.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ne(r,{code:K.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),ne(r,{code:K.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?Wj(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),ne(r,{code:K.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ne(r,{code:K.not_finite,message:o.message}),a.dirty()):Ee.assertNever(o);return{status:a.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ue.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ue.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ue.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ue.toString(n))}setLimit(t,n,r,a){return new Rn({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ue.toString(a)}]})}_addCheck(t){return new Rn({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ue.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ue.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ue.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ue.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ue.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ue.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:ue.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ue.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ue.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&Ee.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew Rn({checks:[],typeName:he.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...ve(e)});class Nn extends be{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==ae.bigint){const o=this._getOrReturnCtx(t);return ne(o,{code:K.invalid_type,expected:ae.bigint,received:o.parsedType}),me}let r;const a=new rt;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),ne(r,{code:K.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ne(r,{code:K.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):Ee.assertNever(o);return{status:a.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ue.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ue.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ue.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ue.toString(n))}setLimit(t,n,r,a){return new Nn({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ue.toString(a)}]})}_addCheck(t){return new Nn({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ue.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ue.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ue.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ue.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ue.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Nn({checks:[],typeName:he.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...ve(e)})};class go extends be{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ae.boolean){const r=this._getOrReturnCtx(t);return ne(r,{code:K.invalid_type,expected:ae.boolean,received:r.parsedType}),me}return lt(t.data)}}go.create=e=>new go({typeName:he.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...ve(e)});class Er extends be{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ae.date){const o=this._getOrReturnCtx(t);return ne(o,{code:K.invalid_type,expected:ae.date,received:o.parsedType}),me}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return ne(o,{code:K.invalid_date}),me}const r=new rt;let a;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(a=this._getOrReturnCtx(t,a),ne(a,{code:K.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Ee.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Er({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ue.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ue.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew Er({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:he.ZodDate,...ve(e)});class Ki extends be{_parse(t){if(this._getType(t)!==ae.symbol){const r=this._getOrReturnCtx(t);return ne(r,{code:K.invalid_type,expected:ae.symbol,received:r.parsedType}),me}return lt(t.data)}}Ki.create=e=>new Ki({typeName:he.ZodSymbol,...ve(e)});class yo extends be{_parse(t){if(this._getType(t)!==ae.undefined){const r=this._getOrReturnCtx(t);return ne(r,{code:K.invalid_type,expected:ae.undefined,received:r.parsedType}),me}return lt(t.data)}}yo.create=e=>new yo({typeName:he.ZodUndefined,...ve(e)});class bo extends be{_parse(t){if(this._getType(t)!==ae.null){const r=this._getOrReturnCtx(t);return ne(r,{code:K.invalid_type,expected:ae.null,received:r.parsedType}),me}return lt(t.data)}}bo.create=e=>new bo({typeName:he.ZodNull,...ve(e)});class sa extends be{constructor(){super(...arguments),this._any=!0}_parse(t){return lt(t.data)}}sa.create=e=>new sa({typeName:he.ZodAny,...ve(e)});class hr extends be{constructor(){super(...arguments),this._unknown=!0}_parse(t){return lt(t.data)}}hr.create=e=>new hr({typeName:he.ZodUnknown,...ve(e)});class gn extends be{_parse(t){const n=this._getOrReturnCtx(t);return ne(n,{code:K.invalid_type,expected:ae.never,received:n.parsedType}),me}}gn.create=e=>new gn({typeName:he.ZodNever,...ve(e)});class Gi extends be{_parse(t){if(this._getType(t)!==ae.undefined){const r=this._getOrReturnCtx(t);return ne(r,{code:K.invalid_type,expected:ae.void,received:r.parsedType}),me}return lt(t.data)}}Gi.create=e=>new Gi({typeName:he.ZodVoid,...ve(e)});class $t extends be{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),a=this._def;if(n.parsedType!==ae.array)return ne(n,{code:K.invalid_type,expected:ae.array,received:n.parsedType}),me;if(a.exactLength!==null){const i=n.data.length>a.exactLength.value,s=n.data.lengtha.maxLength.value&&(ne(n,{code:K.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,s)=>a.type._parseAsync(new pn(n,i,n.path,s)))).then(i=>rt.mergeArray(r,i));const o=[...n.data].map((i,s)=>a.type._parseSync(new pn(n,i,n.path,s)));return rt.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new $t({...this._def,minLength:{value:t,message:ue.toString(n)}})}max(t,n){return new $t({...this._def,maxLength:{value:t,message:ue.toString(n)}})}length(t,n){return new $t({...this._def,exactLength:{value:t,message:ue.toString(n)}})}nonempty(t){return this.min(1,t)}}$t.create=(e,t)=>new $t({type:e,minLength:null,maxLength:null,exactLength:null,typeName:he.ZodArray,...ve(t)});function Xa(e){if(e instanceof Le){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Qt.create(Xa(r))}return new Le({...e._def,shape:()=>t})}else return e instanceof $t?new $t({...e._def,type:Xa(e.element)}):e instanceof Qt?Qt.create(Xa(e.unwrap())):e instanceof Dn?Dn.create(Xa(e.unwrap())):e instanceof Xt?Xt.create(e.items.map(t=>Xa(t))):e}class Le extends be{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Ee.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==ae.object){const u=this._getOrReturnCtx(t);return ne(u,{code:K.invalid_type,expected:ae.object,received:u.parsedType}),me}const{status:r,ctx:a}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof gn&&this._def.unknownKeys==="strip"))for(const u in a.data)i.includes(u)||s.push(u);const l=[];for(const u of i){const c=o[u],d=a.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new pn(a,d,a.path,u)),alwaysSet:u in a.data})}if(this._def.catchall instanceof gn){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of s)l.push({key:{status:"valid",value:c},value:{status:"valid",value:a.data[c]}});else if(u==="strict")s.length>0&&(ne(a,{code:K.unrecognized_keys,keys:s}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of s){const d=a.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new pn(a,d,a.path,c)),alwaysSet:c in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of l){const d=await c.key,h=await c.value;u.push({key:d,value:h,alwaysSet:c.alwaysSet})}return u}).then(u=>rt.mergeObjectSync(r,u)):rt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return ue.errToObj,new Le({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var a,o,i,s;const l=(i=(o=(a=this._def).errorMap)===null||o===void 0?void 0:o.call(a,n,r).message)!==null&&i!==void 0?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=ue.errToObj(t).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new Le({...this._def,unknownKeys:"strip"})}passthrough(){return new Le({...this._def,unknownKeys:"passthrough"})}extend(t){return new Le({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Le({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:he.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Le({...this._def,catchall:t})}pick(t){const n={};return Ee.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Le({...this._def,shape:()=>n})}omit(t){const n={};return Ee.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Le({...this._def,shape:()=>n})}deepPartial(){return Xa(this)}partial(t){const n={};return Ee.objectKeys(this.shape).forEach(r=>{const a=this.shape[r];t&&!t[r]?n[r]=a:n[r]=a.optional()}),new Le({...this._def,shape:()=>n})}required(t){const n={};return Ee.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Qt;)o=o._def.innerType;n[r]=o}}),new Le({...this._def,shape:()=>n})}keyof(){return cp(Ee.objectKeys(this.shape))}}Le.create=(e,t)=>new Le({shape:()=>e,unknownKeys:"strip",catchall:gn.create(),typeName:he.ZodObject,...ve(t)});Le.strictCreate=(e,t)=>new Le({shape:()=>e,unknownKeys:"strict",catchall:gn.create(),typeName:he.ZodObject,...ve(t)});Le.lazycreate=(e,t)=>new Le({shape:e,unknownKeys:"strip",catchall:gn.create(),typeName:he.ZodObject,...ve(t)});class wo extends be{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function a(o){for(const s of o)if(s.result.status==="valid")return s.result;for(const s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;const i=o.map(s=>new St(s.ctx.common.issues));return ne(n,{code:K.invalid_union,unionErrors:i}),me}if(n.common.async)return Promise.all(r.map(async o=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(a);{let o;const i=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},c=l._parseSync({data:n.data,path:n.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!o&&(o={result:c,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const s=i.map(l=>new St(l));return ne(n,{code:K.invalid_union,unionErrors:s}),me}}get options(){return this._def.options}}wo.create=(e,t)=>new wo({options:e,typeName:he.ZodUnion,...ve(t)});const Pn=e=>e instanceof jo?Pn(e.schema):e instanceof Rt?Pn(e.innerType()):e instanceof _o?[e.value]:e instanceof zn?e.options:e instanceof Co?Ee.objectValues(e.enum):e instanceof Eo?Pn(e._def.innerType):e instanceof yo?[void 0]:e instanceof bo?[null]:e instanceof Qt?[void 0,...Pn(e.unwrap())]:e instanceof Dn?[null,...Pn(e.unwrap())]:e instanceof vl||e instanceof So?Pn(e.unwrap()):e instanceof Ao?Pn(e._def.innerType):[];class rs extends be{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ae.object)return ne(n,{code:K.invalid_type,expected:ae.object,received:n.parsedType}),me;const r=this.discriminator,a=n.data[r],o=this.optionsMap.get(a);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(ne(n,{code:K.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),me)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const a=new Map;for(const o of n){const i=Pn(o.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const s of i){if(a.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);a.set(s,o)}}return new rs({typeName:he.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:a,...ve(r)})}}function vc(e,t){const n=Tn(e),r=Tn(t);if(e===t)return{valid:!0,data:e};if(n===ae.object&&r===ae.object){const a=Ee.objectKeys(t),o=Ee.objectKeys(e).filter(s=>a.indexOf(s)!==-1),i={...e,...t};for(const s of o){const l=vc(e[s],t[s]);if(!l.valid)return{valid:!1};i[s]=l.data}return{valid:!0,data:i}}else if(n===ae.array&&r===ae.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let o=0;o{if(el(o)||el(i))return me;const s=vc(o.value,i.value);return s.valid?((tl(o)||tl(i))&&n.dirty(),{status:n.value,value:s.data}):(ne(r,{code:K.invalid_intersection_types}),me)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,i])=>a(o,i)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ko.create=(e,t,n)=>new ko({left:e,right:t,typeName:he.ZodIntersection,...ve(n)});class Xt extends be{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.array)return ne(r,{code:K.invalid_type,expected:ae.array,received:r.parsedType}),me;if(r.data.lengththis._def.items.length&&(ne(r,{code:K.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((i,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new pn(r,i,r.path,s)):null}).filter(i=>!!i);return r.common.async?Promise.all(o).then(i=>rt.mergeArray(n,i)):rt.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new Xt({...this._def,rest:t})}}Xt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Xt({items:e,typeName:he.ZodTuple,rest:null,...ve(t)})};class vo extends be{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.object)return ne(r,{code:K.invalid_type,expected:ae.object,received:r.parsedType}),me;const a=[],o=this._def.keyType,i=this._def.valueType;for(const s in r.data)a.push({key:o._parse(new pn(r,s,r.path,s)),value:i._parse(new pn(r,r.data[s],r.path,s)),alwaysSet:s in r.data});return r.common.async?rt.mergeObjectAsync(n,a):rt.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof be?new vo({keyType:t,valueType:n,typeName:he.ZodRecord,...ve(r)}):new vo({keyType:qt.create(),valueType:t,typeName:he.ZodRecord,...ve(n)})}}class Qi extends be{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.map)return ne(r,{code:K.invalid_type,expected:ae.map,received:r.parsedType}),me;const a=this._def.keyType,o=this._def.valueType,i=[...r.data.entries()].map(([s,l],u)=>({key:a._parse(new pn(r,s,r.path,[u,"key"])),value:o._parse(new pn(r,l,r.path,[u,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of i){const u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return me;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}})}else{const s=new Map;for(const l of i){const u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return me;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}}}}Qi.create=(e,t,n)=>new Qi({valueType:t,keyType:e,typeName:he.ZodMap,...ve(n)});class Ar extends be{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.set)return ne(r,{code:K.invalid_type,expected:ae.set,received:r.parsedType}),me;const a=this._def;a.minSize!==null&&r.data.sizea.maxSize.value&&(ne(r,{code:K.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());const o=this._def.valueType;function i(l){const u=new Set;for(const c of l){if(c.status==="aborted")return me;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}const s=[...r.data.values()].map((l,u)=>o._parse(new pn(r,l,r.path,u)));return r.common.async?Promise.all(s).then(l=>i(l)):i(s)}min(t,n){return new Ar({...this._def,minSize:{value:t,message:ue.toString(n)}})}max(t,n){return new Ar({...this._def,maxSize:{value:t,message:ue.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Ar.create=(e,t)=>new Ar({valueType:e,minSize:null,maxSize:null,typeName:he.ZodSet,...ve(t)});class oa extends be{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ae.function)return ne(n,{code:K.invalid_type,expected:ae.function,received:n.parsedType}),me;function r(s,l){return Ji({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Vi(),ia].filter(u=>!!u),issueData:{code:K.invalid_arguments,argumentsError:l}})}function a(s,l){return Ji({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Vi(),ia].filter(u=>!!u),issueData:{code:K.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof la){const s=this;return lt(async function(...l){const u=new St([]),c=await s._def.args.parseAsync(l,o).catch(m=>{throw u.addIssue(r(l,m)),u}),d=await Reflect.apply(i,this,c);return await s._def.returns._def.type.parseAsync(d,o).catch(m=>{throw u.addIssue(a(d,m)),u})})}else{const s=this;return lt(function(...l){const u=s._def.args.safeParse(l,o);if(!u.success)throw new St([r(l,u.error)]);const c=Reflect.apply(i,this,u.data),d=s._def.returns.safeParse(c,o);if(!d.success)throw new St([a(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new oa({...this._def,args:Xt.create(t).rest(hr.create())})}returns(t){return new oa({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new oa({args:t||Xt.create([]).rest(hr.create()),returns:n||hr.create(),typeName:he.ZodFunction,...ve(r)})}}class jo extends be{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}jo.create=(e,t)=>new jo({getter:e,typeName:he.ZodLazy,...ve(t)});class _o extends be{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ne(n,{received:n.data,code:K.invalid_literal,expected:this._def.value}),me}return{status:"valid",value:t.data}}get value(){return this._def.value}}_o.create=(e,t)=>new _o({value:e,typeName:he.ZodLiteral,...ve(t)});function cp(e,t){return new zn({values:e,typeName:he.ZodEnum,...ve(t)})}class zn extends be{constructor(){super(...arguments),xi.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return ne(n,{expected:Ee.joinValues(r),received:n.parsedType,code:K.invalid_type}),me}if(nl(this,xi,"f")||sp(this,xi,new Set(this._def.values),"f"),!nl(this,xi,"f").has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return ne(n,{received:n.data,code:K.invalid_enum_value,options:r}),me}return lt(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return zn.create(t,{...this._def,...n})}exclude(t,n=this._def){return zn.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}xi=new WeakMap;zn.create=cp;class Co extends be{constructor(){super(...arguments),Ii.set(this,void 0)}_parse(t){const n=Ee.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==ae.string&&r.parsedType!==ae.number){const a=Ee.objectValues(n);return ne(r,{expected:Ee.joinValues(a),received:r.parsedType,code:K.invalid_type}),me}if(nl(this,Ii,"f")||sp(this,Ii,new Set(Ee.getValidEnumValues(this._def.values)),"f"),!nl(this,Ii,"f").has(t.data)){const a=Ee.objectValues(n);return ne(r,{received:r.data,code:K.invalid_enum_value,options:a}),me}return lt(t.data)}get enum(){return this._def.values}}Ii=new WeakMap;Co.create=(e,t)=>new Co({values:e,typeName:he.ZodNativeEnum,...ve(t)});class la extends be{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ae.promise&&n.common.async===!1)return ne(n,{code:K.invalid_type,expected:ae.promise,received:n.parsedType}),me;const r=n.parsedType===ae.promise?n.data:Promise.resolve(n.data);return lt(r.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}}la.create=(e,t)=>new la({type:e,typeName:he.ZodPromise,...ve(t)});class Rt extends be{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===he.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),a=this._def.effect||null,o={addIssue:i=>{ne(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){const i=a.transform(r.data,o);if(r.common.async)return Promise.resolve(i).then(async s=>{if(n.value==="aborted")return me;const l=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return l.status==="aborted"?me:l.status==="dirty"||n.value==="dirty"?na(l.value):l});{if(n.value==="aborted")return me;const s=this._def.schema._parseSync({data:i,path:r.path,parent:r});return s.status==="aborted"?me:s.status==="dirty"||n.value==="dirty"?na(s.value):s}}if(a.type==="refinement"){const i=s=>{const l=a.refinement(s,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?me:(s.status==="dirty"&&n.dirty(),i(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?me:(s.status==="dirty"&&n.dirty(),i(s.value).then(()=>({status:n.value,value:s.value}))))}if(a.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!mo(i))return i;const s=a.transform(i.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>mo(i)?Promise.resolve(a.transform(i.value,o)).then(s=>({status:n.value,value:s})):i);Ee.assertNever(a)}}Rt.create=(e,t,n)=>new Rt({schema:e,typeName:he.ZodEffects,effect:t,...ve(n)});Rt.createWithPreprocess=(e,t,n)=>new Rt({schema:t,effect:{type:"preprocess",transform:e},typeName:he.ZodEffects,...ve(n)});class Qt extends be{_parse(t){return this._getType(t)===ae.undefined?lt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Qt.create=(e,t)=>new Qt({innerType:e,typeName:he.ZodOptional,...ve(t)});class Dn extends be{_parse(t){return this._getType(t)===ae.null?lt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Dn.create=(e,t)=>new Dn({innerType:e,typeName:he.ZodNullable,...ve(t)});class Eo extends be{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===ae.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Eo.create=(e,t)=>new Eo({innerType:e,typeName:he.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ve(t)});class Ao extends be{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return po(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new St(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new St(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Ao.create=(e,t)=>new Ao({innerType:e,typeName:he.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ve(t)});class Yi extends be{_parse(t){if(this._getType(t)!==ae.nan){const r=this._getOrReturnCtx(t);return ne(r,{code:K.invalid_type,expected:ae.nan,received:r.parsedType}),me}return{status:"valid",value:t.data}}}Yi.create=e=>new Yi({typeName:he.ZodNaN,...ve(e)});const dp=Symbol("zod_brand");class vl extends be{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Ro extends be{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?me:o.status==="dirty"?(n.dirty(),na(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?me:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(t,n){return new Ro({in:t,out:n,typeName:he.ZodPipeline})}}class So extends be{_parse(t){const n=this._def.innerType._parse(t),r=a=>(mo(a)&&(a.value=Object.freeze(a.value)),a);return po(n)?n.then(a=>r(a)):r(n)}unwrap(){return this._def.innerType}}So.create=(e,t)=>new So({innerType:e,typeName:he.ZodReadonly,...ve(t)});function ad(e,t={},n){return e?sa.create().superRefine((r,a)=>{var o,i;if(!e(r)){const s=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(i=(o=s.fatal)!==null&&o!==void 0?o:n)!==null&&i!==void 0?i:!0,u=typeof s=="string"?{message:s}:s;a.addIssue({code:"custom",...u,fatal:l})}}):sa.create()}const fp={object:Le.lazycreate};var he;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(he||(he={}));const hp=(e,t={message:`Input not instance of ${e.name}`})=>ad(n=>n instanceof e,t),od=qt.create,id=Rn.create,mp=Yi.create,pp=Nn.create,sd=go.create,gp=Er.create,yp=Ki.create,bp=yo.create,wp=bo.create,kp=sa.create,vp=hr.create,jp=gn.create,_p=Gi.create,Cp=$t.create,Ep=Le.create,Ap=Le.strictCreate,Sp=wo.create,Pp=rs.create,Tp=ko.create,Bp=Xt.create,Mp=vo.create,xp=Qi.create,Ip=Ar.create,Op=oa.create,Rp=jo.create,Np=_o.create,zp=zn.create,Dp=Co.create,Up=la.create,rl=Rt.create,Fp=Qt.create,Lp=Dn.create,qp=Rt.createWithPreprocess,$p=Ro.create,Wp=()=>od().optional(),Hp=()=>id().optional(),Vp=()=>sd().optional(),Jp={string:e=>qt.create({...e,coerce:!0}),number:e=>Rn.create({...e,coerce:!0}),boolean:e=>go.create({...e,coerce:!0}),bigint:e=>Nn.create({...e,coerce:!0}),date:e=>Er.create({...e,coerce:!0})},Kp=me;var He=Object.freeze({__proto__:null,defaultErrorMap:ia,setErrorMap:op,getErrorMap:Vi,makeIssue:Ji,EMPTY_PATH:ip,addIssueToContext:ne,ParseStatus:rt,INVALID:me,DIRTY:na,OK:lt,isAborted:el,isDirty:tl,isValid:mo,isAsync:po,get util(){return Ee},get objectUtil(){return Xs},ZodParsedType:ae,getParsedType:Tn,ZodType:be,datetimeRegex:rd,ZodString:qt,ZodNumber:Rn,ZodBigInt:Nn,ZodBoolean:go,ZodDate:Er,ZodSymbol:Ki,ZodUndefined:yo,ZodNull:bo,ZodAny:sa,ZodUnknown:hr,ZodNever:gn,ZodVoid:Gi,ZodArray:$t,ZodObject:Le,ZodUnion:wo,ZodDiscriminatedUnion:rs,ZodIntersection:ko,ZodTuple:Xt,ZodRecord:vo,ZodMap:Qi,ZodSet:Ar,ZodFunction:oa,ZodLazy:jo,ZodLiteral:_o,ZodEnum:zn,ZodNativeEnum:Co,ZodPromise:la,ZodEffects:Rt,ZodTransformer:Rt,ZodOptional:Qt,ZodNullable:Dn,ZodDefault:Eo,ZodCatch:Ao,ZodNaN:Yi,BRAND:dp,ZodBranded:vl,ZodPipeline:Ro,ZodReadonly:So,custom:ad,Schema:be,ZodSchema:be,late:fp,get ZodFirstPartyTypeKind(){return he},coerce:Jp,any:kp,array:Cp,bigint:pp,boolean:sd,date:gp,discriminatedUnion:Pp,effect:rl,enum:zp,function:Op,instanceof:hp,intersection:Tp,lazy:Rp,literal:Np,map:xp,nan:mp,nativeEnum:Dp,never:jp,null:wp,nullable:Lp,number:id,object:Ep,oboolean:Vp,onumber:Hp,optional:Fp,ostring:Wp,pipeline:$p,preprocess:qp,promise:Up,record:Mp,set:Ip,strictObject:Ap,string:od,symbol:yp,transformer:rl,tuple:Bp,undefined:bp,union:Sp,unknown:vp,void:_p,NEVER:Kp,ZodIssueCode:K,quotelessJson:rp,ZodError:St});const Hj=Object.freeze(Object.defineProperty({__proto__:null,BRAND:dp,DIRTY:na,EMPTY_PATH:ip,INVALID:me,NEVER:Kp,OK:lt,ParseStatus:rt,Schema:be,ZodAny:sa,ZodArray:$t,ZodBigInt:Nn,ZodBoolean:go,ZodBranded:vl,ZodCatch:Ao,ZodDate:Er,ZodDefault:Eo,ZodDiscriminatedUnion:rs,ZodEffects:Rt,ZodEnum:zn,ZodError:St,get ZodFirstPartyTypeKind(){return he},ZodFunction:oa,ZodIntersection:ko,ZodIssueCode:K,ZodLazy:jo,ZodLiteral:_o,ZodMap:Qi,ZodNaN:Yi,ZodNativeEnum:Co,ZodNever:gn,ZodNull:bo,ZodNullable:Dn,ZodNumber:Rn,ZodObject:Le,ZodOptional:Qt,ZodParsedType:ae,ZodPipeline:Ro,ZodPromise:la,ZodReadonly:So,ZodRecord:vo,ZodSchema:be,ZodSet:Ar,ZodString:qt,ZodSymbol:Ki,ZodTransformer:Rt,ZodTuple:Xt,ZodType:be,ZodUndefined:yo,ZodUnion:wo,ZodUnknown:hr,ZodVoid:Gi,addIssueToContext:ne,any:kp,array:Cp,bigint:pp,boolean:sd,coerce:Jp,custom:ad,date:gp,datetimeRegex:rd,default:He,defaultErrorMap:ia,discriminatedUnion:Pp,effect:rl,enum:zp,function:Op,getErrorMap:Vi,getParsedType:Tn,instanceof:hp,intersection:Tp,isAborted:el,isAsync:po,isDirty:tl,isValid:mo,late:fp,lazy:Rp,literal:Np,makeIssue:Ji,map:xp,nan:mp,nativeEnum:Dp,never:jp,null:wp,nullable:Lp,number:id,object:Ep,get objectUtil(){return Xs},oboolean:Vp,onumber:Hp,optional:Fp,ostring:Wp,pipeline:$p,preprocess:qp,promise:Up,quotelessJson:rp,record:Mp,set:Ip,setErrorMap:op,strictObject:Ap,string:od,symbol:yp,transformer:rl,tuple:Bp,undefined:bp,union:Sp,unknown:vp,get util(){return Ee},void:_p,z:He},Symbol.toStringTag,{value:"Module"})),Vj=He.object({address:He.string(),network:He.enum([qi.MAINNET,qi.TESTNET]),public_key:He.string(),proof:He.object({timestamp:He.number(),domain:He.object({lengthBytes:He.number(),value:He.string()}),payload:He.string(),signature:He.string(),state_init:He.string()})});var Ue={},de={},Nt={};const Jj=Symbol.for("nodejs.util.inspect.custom");var No=Jj,zo={};Object.defineProperty(zo,"__esModule",{value:!0});zo.crc16=void 0;function Kj(e){let n=0;const r=Buffer.alloc(e.length+2);r.set(e);for(let a of r){let o=128;for(;o>0;)n<<=1,a&o&&(n+=1),o>>=1,n>65535&&(n&=65535,n^=4129)}return Buffer.from([Math.floor(n/256),n%256])}zo.crc16=Kj;var Gj=re&&re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Gp;Object.defineProperty(Nt,"__esModule",{value:!0});Nt.address=Nt.Address=void 0;const Qj=Gj(No),Qp=zo,jc=17,Yp=81,_c=128;function Ef(e){if(typeof e=="string"&&!ld.isFriendly(e))throw new Error("Unknown address type");const t=Buffer.isBuffer(e)?e:Buffer.from(e,"base64");if(t.length!==36)throw new Error("Unknown address type: byte length is not equal to 36");const n=t.subarray(0,34),r=t.subarray(34,36),a=(0,Qp.crc16)(n);if(!(a[0]===r[0]&&a[1]===r[1]))throw new Error("Invalid checksum: "+e);let o=n[0],i=!1,s=!1;if(o&_c&&(i=!0,o=o^_c),o!==jc&&o!==Yp)throw"Unknown address tag";s=o===jc;let l=null;n[1]===255?l=-1:l=n[1];const u=n.subarray(2,34);return{isTestOnly:i,isBounceable:s,workchain:l,hashPart:u}}let ld=class ir{static isAddress(t){return t instanceof ir}static isFriendly(t){return!(t.length!==48||!/[A-Za-z0-9+/_-]+/.test(t))}static isRaw(t){if(t.indexOf(":")===-1)return!1;let[n,r]=t.split(":");return!(!Number.isInteger(parseFloat(n))||!/[a-f0-9]+/.test(r.toLowerCase())||r.length!==64)}static normalize(t){return typeof t=="string"?ir.parse(t).toString():t.toString()}static parse(t){if(ir.isFriendly(t))return this.parseFriendly(t).address;if(ir.isRaw(t))return this.parseRaw(t);throw new Error("Unknown address type: "+t)}static parseRaw(t){let n=parseInt(t.split(":")[0]),r=Buffer.from(t.split(":")[1],"hex");return new ir(n,r)}static parseFriendly(t){if(Buffer.isBuffer(t)){let n=Ef(t);return{isBounceable:n.isBounceable,isTestOnly:n.isTestOnly,address:new ir(n.workchain,n.hashPart)}}else{let n=t.replace(/\-/g,"+").replace(/_/g,"/"),r=Ef(n);return{isBounceable:r.isBounceable,isTestOnly:r.isTestOnly,address:new ir(r.workchain,r.hashPart)}}}constructor(t,n){if(this.toRawString=()=>this.workChain+":"+this.hash.toString("hex"),this.toRaw=()=>{const r=Buffer.alloc(36);return r.set(this.hash),r.set([this.workChain,this.workChain,this.workChain,this.workChain],32),r},this.toStringBuffer=r=>{let a=r&&r.testOnly!==void 0?r.testOnly:!1,i=(r&&r.bounceable!==void 0?r.bounceable:!0)?jc:Yp;a&&(i|=_c);const s=Buffer.alloc(34);s[0]=i,s[1]=this.workChain,s.set(this.hash,2);const l=Buffer.alloc(36);return l.set(s),l.set((0,Qp.crc16)(s),34),l},this.toString=r=>{let a=r&&r.urlSafe!==void 0?r.urlSafe:!0,o=this.toStringBuffer(r);return a?o.toString("base64").replace(/\+/g,"-").replace(/\//g,"_"):o.toString("base64")},this[Gp]=()=>this.toString(),n.length!==32)throw new Error("Invalid address hash length: "+n.length);this.workChain=t,this.hash=n,Object.freeze(this)}equals(t){return t.workChain!==this.workChain?!1:t.hash.equals(this.hash)}};Nt.Address=ld;Gp=Qj.default;function Yj(e){return ld.parse(e)}Nt.address=Yj;var Do={},Zj=re&&re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Zp;Object.defineProperty(Do,"__esModule",{value:!0});Do.ExternalAddress=void 0;const Xj=Zj(No);class ud{static isAddress(t){return t instanceof ud}constructor(t,n){this[Zp]=()=>this.toString(),this.value=t,this.bits=n}toString(){return`External<${this.bits}:${this.value}>`}}Do.ExternalAddress=ud;Zp=Xj.default;var jl={},ua={};Object.defineProperty(ua,"__esModule",{value:!0});ua.base32Decode=ua.base32Encode=void 0;const Cc="abcdefghijklmnopqrstuvwxyz234567";function e_(e){const t=e.byteLength;let n=0,r=0,a="";for(let o=0;o=5;)a+=Cc[r>>>n-5&31],n-=5;return n>0&&(a+=Cc[r<<5-n&31]),a}ua.base32Encode=e_;function t_(e,t){const n=e.indexOf(t);if(n===-1)throw new Error("Invalid character found: "+t);return n}function n_(e){let t;t=e.toLowerCase();const{length:n}=t;let r=0,a=0,o=0;const i=Buffer.alloc(n*5/8|0);for(let s=0;s=8&&(i[o++]=a>>>r-8&255,r-=8);return i}ua.base32Decode=n_;var r_=re&&re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Xp;Object.defineProperty(jl,"__esModule",{value:!0});jl.ADNLAddress=void 0;const a_=r_(No),Af=ua,Sf=zo;class al{static parseFriendly(t){if(t.length!==55)throw Error("Invalid address");t="f"+t;let n=(0,Af.base32Decode)(t);if(n[0]!==45)throw Error("Invalid address");let r=n.slice(33);if(!(0,Sf.crc16)(n.slice(0,33)).equals(r))throw Error("Invalid address");return new al(n.slice(1,33))}static parseRaw(t){const n=Buffer.from(t,"base64");return new al(n)}constructor(t){if(this.toRaw=()=>this.address.toString("hex").toUpperCase(),this.toString=()=>{let n=Buffer.concat([Buffer.from([45]),this.address]),r=(0,Sf.crc16)(n);return n=Buffer.concat([n,r]),(0,Af.base32Encode)(n).slice(1)},this[Xp]=()=>this.toString(),t.length!==32)throw Error("Invalid address");this.address=t}equals(t){return this.address.equals(t.address)}}jl.ADNLAddress=al;Xp=a_.default;var _l={},Hr={},ui={},ci={},Vr={},Pf;function Cl(){if(Pf)return Vr;Pf=1,Object.defineProperty(Vr,"__esModule",{value:!0}),Vr.paddedBufferToBits=Vr.bitsToPaddedBuffer=void 0;const e=El(),t=Fr();function n(a){let o=new e.BitBuilder(Math.ceil(a.length/8)*8);o.writeBits(a);let i=Math.ceil(a.length/8)*8-a.length;for(let s=0;s=0;i--)if(a[i]!==0){const s=a[i];let l=s&-s;l&1||(l=Math.log2(l)+1),i>0&&(o=i<<3),o+=8-l;break}return new t.BitString(a,0,o)}return Vr.paddedBufferToBits=r,Vr}var Tf;function Fr(){if(Tf)return ci;Tf=1;var e=re&&re.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t;Object.defineProperty(ci,"__esModule",{value:!0}),ci.BitString=void 0;const n=Cl(),r=e(No);let a=class $s{static isBitString(i){return i instanceof $s}constructor(i,s,l){if(this[t]=()=>this.toString(),l<0)throw new Error(`Length ${l} is out of bounds`);this._length=l,this._data=i,this._offset=s}get length(){return this._length}at(i){if(i>=this._length)throw new Error(`Index ${i} > ${this._length} is out of bounds`);if(i<0)throw new Error(`Index ${i} < 0 is out of bounds`);let s=this._offset+i>>3,l=7-(this._offset+i)%8;return(this._data[s]&1<this._length)throw new Error(`Offset(${i}) > ${this._length} is out of bounds`);if(i<0)throw new Error(`Offset(${i}) < 0 is out of bounds`);if(s===0)return $s.EMPTY;if(i+s>this._length)throw new Error(`Offset ${i} + Length ${s} > ${this._length} is out of bounds`);return new $s(this._data,this._offset+i,s)}subbuffer(i,s){if(i>this._length)throw new Error(`Offset ${i} is out of bounds`);if(i<0)throw new Error(`Offset ${i} is out of bounds`);if(i+s>this._length)throw new Error(`Offset + Lenght = ${i+s} is out of bounds`);if(s%8!==0||(this._offset+i)%8!==0)return null;let l=this._offset+i>>3,u=l+(s>>3);return this._data.subarray(l,u)}equals(i){if(this._length!==i._length)return!1;for(let s=0;sthis._buffer.length*8)throw new Error("BitBuilder overflow");(typeof o=="boolean"&&o===!0||typeof o=="number"&&o>0)&&(this._buffer[i/8|0]|=1<<7-i%8),this._length++}writeBits(o){for(let i=0;ithis._buffer.length*8)throw new Error("BitBuilder overflow");o.copy(this._buffer,this._length/8),this._length+=o.length*8}else for(let i=0;i=l)throw Error(`bitLength is too small for a value ${o}. Got ${i}`);if(this._length+i>this._buffer.length*8)throw new Error("BitBuilder overflow");const u=8-this._length%8;if(u>0){const c=Math.floor(this._length/8);if(i>BigInt(i-u));this._buffer[c]|=d,this._length+=u}}for(i-=u;i>0;)i>=8?(this._buffer[this._length/8]=Number(s>>BigInt(i-8)&0xffn),this._length+=8,i-=8):(this._buffer[this._length/8]=Number(s<=l)throw Error(`value is out of range for ${i} bits. Got ${o}`);s<0?(this.writeBit(!0),s=l+s):this.writeBit(!1),this.writeUint(s,i-1)}writeVarUint(o,i){let s=BigInt(o);if(i<0||!Number.isSafeInteger(i))throw Error(`invalid bit length. Got ${i}`);if(s<0)throw Error(`value is negative. Got ${o}`);if(s===0n){this.writeUint(0,i);return}const l=Math.ceil(s.toString(2).length/8),u=l*8;this.writeUint(l,i),this.writeUint(s,u)}writeVarInt(o,i){let s=BigInt(o);if(i<0||!Number.isSafeInteger(i))throw Error(`invalid bit length. Got ${i}`);if(s===0n){this.writeUint(0,i);return}let l=s>0?s:-s;const u=1+Math.ceil(l.toString(2).length/8),c=u*8;this.writeUint(u,i),this.writeInt(s,c)}writeCoins(o){this.writeVarUint(o,4)}writeAddress(o){if(o==null){this.writeUint(0,2);return}if(e.Address.isAddress(o)){this.writeUint(2,2),this.writeUint(0,1),this.writeInt(o.workChain,8),this.writeBuffer(o.hash);return}if(t.ExternalAddress.isAddress(o)){this.writeUint(1,2),this.writeUint(o.bits,9),this.writeUint(o.value,o.bits);return}throw Error(`Invalid address. Got ${o}`)}build(){return new n.BitString(this._buffer,0,this._length)}buffer(){if(this._length%8!==0)throw new Error("BitBuilder buffer is not byte aligned");return this._buffer.subarray(0,this._length/8)}};return ui.BitBuilder=r,ui}var di={},Lr={};Object.defineProperty(Lr,"__esModule",{value:!0});Lr.CellType=void 0;var Mf;(function(e){e[e.Ordinary=-1]="Ordinary",e[e.PrunedBranch=1]="PrunedBranch",e[e.Library=2]="Library",e[e.MerkleProof=3]="MerkleProof",e[e.MerkleUpdate=4]="MerkleUpdate"})(Mf||(Lr.CellType=Mf={}));var fi={},hi={},mi={},Al={};Object.defineProperty(Al,"__esModule",{value:!0});Al.readUnaryLength=void 0;function o_(e){let t=0;for(;e.loadBit();)t++;return t}Al.readUnaryLength=o_;var xf;function cd(){if(xf)return mi;xf=1,Object.defineProperty(mi,"__esModule",{value:!0}),mi.generateMerkleProof=void 0;const e=Ze(),t=Al;function n(i){return(0,e.beginCell)().storeUint(1,8).storeUint(1,8).storeBuffer(i.hash(0)).storeUint(i.depth(0),16).endCell({exotic:!0})}function r(i){return(0,e.beginCell)().storeUint(3,8).storeBuffer(i.hash(0)).storeUint(i.depth(0),16).storeRef(i).endCell({exotic:!0})}function a(i,s,l,u){const c=s.asCell();let d=s.loadBit()?1:0,h=0,m=i;if(d===0){h=(0,t.readUnaryLength)(s);for(let y=0;y0&&g.storeUint(BigInt("0b"+b),b.length),g}dt.writeLabelShort=s;function l(b){return 1+b.length+1+b.length}function u(b,g,A){A.storeBit(1),A.storeBit(0);let _=Math.ceil(Math.log2(g+1));return A.storeUint(b.length,_),b.length>0&&A.storeUint(BigInt("0b"+b),b.length),A}dt.writeLabelLong=u;function c(b,g){return 1+1+Math.ceil(Math.log2(g+1))+b.length}function d(b,g,A,_){_.storeBit(1),_.storeBit(1),_.storeBit(b);let x=Math.ceil(Math.log2(A+1));_.storeUint(g,x)}dt.writeLabelSame=d;function h(b){return 1+1+1+Math.ceil(Math.log2(b+1))}function m(b){if(b.length===0||b.length===1)return!0;for(let g=1;g(0,l.deserializeInternalKey)(R))}values(){return Array.from(this._map.values())}store(R,B,H){if(this._map.size===0)R.storeBit(0);else{let ie=this._key;B!=null&&(ie=B);let se=this._value;if(H!=null&&(se=H),!ie)throw Error("Key serializer is not defined");if(!se)throw Error("Value serializer is not defined");let M=new Map;for(const[xe,qe]of this._map)M.set(ie.serialize((0,l.deserializeInternalKey)(xe)),qe);R.storeBit(1);let Ie=(0,t.beginCell)();(0,s.serializeDict)(M,ie.bits,se.serialize,Ie),R.storeRef(Ie.endCell())}}storeDirect(R,B,H){if(this._map.size===0)throw Error("Cannot store empty dictionary directly");let ie=this._key;B!=null&&(ie=B);let se=this._value;if(H!=null&&(se=H),!ie)throw Error("Key serializer is not defined");if(!se)throw Error("Value serializer is not defined");let M=new Map;for(const[Ie,xe]of this._map)M.set(ie.serialize((0,l.deserializeInternalKey)(Ie)),xe);(0,s.serializeDict)(M,ie.bits,se.serialize,R)}generateMerkleProof(R){return(0,a.generateMerkleProof)(this,R,this._key)}generateMerkleUpdate(R,B){return(0,o.generateMerkleUpdate)(this,R,this._key,B)}};hi.Dictionary=u,u.Keys={Address:()=>c(),BigInt:N=>d(N),Int:N=>h(N),BigUint:N=>m(N),Uint:N=>y(N),Buffer:N=>f(N),BitString:N=>j(N)},u.Values={BigInt:N=>E(N),Int:N=>T(N),BigVarInt:N=>b(N),BigUint:N=>_(N),Uint:N=>A(N),BigVarUint:N=>g(N),Bool:()=>x(),Address:()=>J(),Cell:()=>q(),Buffer:N=>ee(N),BitString:N=>ce(N),Dictionary:(N,R)=>Y(N,R)};function c(){return{bits:267,serialize:N=>{if(!e.Address.isAddress(N))throw Error("Key is not an address");return(0,t.beginCell)().storeAddress(N).endCell().beginParse().preloadUintBig(267)},parse:N=>(0,t.beginCell)().storeUint(N,267).endCell().beginParse().loadAddress()}}function d(N){return{bits:N,serialize:R=>{if(typeof R!="bigint")throw Error("Key is not a bigint");return(0,t.beginCell)().storeInt(R,N).endCell().beginParse().loadUintBig(N)},parse:R=>(0,t.beginCell)().storeUint(R,N).endCell().beginParse().loadIntBig(N)}}function h(N){return{bits:N,serialize:R=>{if(typeof R!="number")throw Error("Key is not a number");if(!Number.isSafeInteger(R))throw Error("Key is not a safe integer: "+R);return(0,t.beginCell)().storeInt(R,N).endCell().beginParse().loadUintBig(N)},parse:R=>(0,t.beginCell)().storeUint(R,N).endCell().beginParse().loadInt(N)}}function m(N){return{bits:N,serialize:R=>{if(typeof R!="bigint")throw Error("Key is not a bigint");if(R<0)throw Error("Key is negative: "+R);return(0,t.beginCell)().storeUint(R,N).endCell().beginParse().loadUintBig(N)},parse:R=>(0,t.beginCell)().storeUint(R,N).endCell().beginParse().loadUintBig(N)}}function y(N){return{bits:N,serialize:R=>{if(typeof R!="number")throw Error("Key is not a number");if(!Number.isSafeInteger(R))throw Error("Key is not a safe integer: "+R);if(R<0)throw Error("Key is negative: "+R);return(0,t.beginCell)().storeUint(R,N).endCell().beginParse().loadUintBig(N)},parse:R=>Number((0,t.beginCell)().storeUint(R,N).endCell().beginParse().loadUint(N))}}function f(N){return{bits:N*8,serialize:R=>{if(!Buffer.isBuffer(R))throw Error("Key is not a buffer");return(0,t.beginCell)().storeBuffer(R).endCell().beginParse().loadUintBig(N*8)},parse:R=>(0,t.beginCell)().storeUint(R,N*8).endCell().beginParse().loadBuffer(N)}}function j(N){return{bits:N,serialize:R=>{if(!r.BitString.isBitString(R))throw Error("Key is not a BitString");return(0,t.beginCell)().storeBits(R).endCell().beginParse().loadUintBig(N)},parse:R=>(0,t.beginCell)().storeUint(R,N).endCell().beginParse().loadBits(N)}}function T(N){return{serialize:(R,B)=>{B.storeInt(R,N)},parse:R=>R.loadInt(N)}}function E(N){return{serialize:(R,B)=>{B.storeInt(R,N)},parse:R=>R.loadIntBig(N)}}function b(N){return{serialize:(R,B)=>{B.storeVarInt(R,N)},parse:R=>R.loadVarIntBig(N)}}function g(N){return{serialize:(R,B)=>{B.storeVarUint(R,N)},parse:R=>R.loadVarUintBig(N)}}function A(N){return{serialize:(R,B)=>{B.storeUint(R,N)},parse:R=>R.loadUint(N)}}function _(N){return{serialize:(R,B)=>{B.storeUint(R,N)},parse:R=>R.loadUintBig(N)}}function x(){return{serialize:(N,R)=>{R.storeBit(N)},parse:N=>N.loadBit()}}function J(){return{serialize:(N,R)=>{R.storeAddress(N)},parse:N=>N.loadAddress()}}function q(){return{serialize:(N,R)=>{R.storeRef(N)},parse:N=>N.loadRef()}}function Y(N,R){return{serialize:(B,H)=>{B.store(H)},parse:B=>u.load(N,R,B)}}function ee(N){return{serialize:(R,B)=>{if(R.length!==N)throw Error("Invalid buffer size");B.storeBuffer(R)},parse:R=>R.loadBuffer(N)}}function ce(N){return{serialize:(R,B)=>{if(R.length!==N)throw Error("Invalid BitString size");B.storeBits(R)},parse:R=>R.loadBits(N)}}return hi}var Cn={},Nf;function ng(){if(Nf)return Cn;Nf=1,Object.defineProperty(Cn,"__esModule",{value:!0}),Cn.writeString=Cn.stringToCell=Cn.readString=void 0;const e=Ze();function t(i){if(i.remainingBits%8!==0)throw new Error(`Invalid string length: ${i.remainingBits}`);if(i.remainingRefs!==0&&i.remainingRefs!==1)throw new Error(`invalid number of refs: ${i.remainingRefs}`);let s;return i.remainingBits===0?s=Buffer.alloc(0):s=i.loadBuffer(i.remainingBits/8),i.remainingRefs===1&&(s=Buffer.concat([s,t(i.loadRef().beginParse())])),s}function n(i){return t(i).toString()}Cn.readString=n;function r(i,s){if(i.length>0){let l=Math.floor(s.availableBits/8);if(i.length>l){let u=i.subarray(0,l),c=i.subarray(l);s=s.storeBuffer(u);let d=(0,e.beginCell)();r(c,d),s=s.storeRef(d.endCell())}else s=s.storeBuffer(i)}}function a(i){let s=(0,e.beginCell)();return r(Buffer.from(i),s),s.endCell()}Cn.stringToCell=a;function o(i,s){r(Buffer.from(i),s)}return Cn.writeString=o,Cn}var zf;function dd(){if(zf)return fi;zf=1;var e=re&&re.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t;Object.defineProperty(fi,"__esModule",{value:!0}),fi.Slice=void 0;const n=e(No),r=$a(),a=Ze(),o=ng();let i=class Sc{constructor(l,u){this[t]=()=>this.toString(),this._reader=l.clone(),this._refs=[...u],this._refsOffset=0}get remainingBits(){return this._reader.remaining}get offsetBits(){return this._reader.offset}get remainingRefs(){return this._refs.length-this._refsOffset}get offsetRefs(){return this._refsOffset}skip(l){return this._reader.skip(l),this}loadBit(){return this._reader.loadBit()}preloadBit(){return this._reader.preloadBit()}loadBoolean(){return this.loadBit()}loadMaybeBoolean(){return this.loadBit()?this.loadBoolean():null}loadBits(l){return this._reader.loadBits(l)}preloadBits(l){return this._reader.preloadBits(l)}loadUint(l){return this._reader.loadUint(l)}loadUintBig(l){return this._reader.loadUintBig(l)}preloadUint(l){return this._reader.preloadUint(l)}preloadUintBig(l){return this._reader.preloadUintBig(l)}loadMaybeUint(l){return this.loadBit()?this.loadUint(l):null}loadMaybeUintBig(l){return this.loadBit()?this.loadUintBig(l):null}loadInt(l){return this._reader.loadInt(l)}loadIntBig(l){return this._reader.loadIntBig(l)}preloadInt(l){return this._reader.preloadInt(l)}preloadIntBig(l){return this._reader.preloadIntBig(l)}loadMaybeInt(l){return this.loadBit()?this.loadInt(l):null}loadMaybeIntBig(l){return this.loadBit()?this.loadIntBig(l):null}loadVarUint(l){return this._reader.loadVarUint(l)}loadVarUintBig(l){return this._reader.loadVarUintBig(l)}preloadVarUint(l){return this._reader.preloadVarUint(l)}preloadVarUintBig(l){return this._reader.preloadVarUintBig(l)}loadVarInt(l){return this._reader.loadVarInt(l)}loadVarIntBig(l){return this._reader.loadVarIntBig(l)}preloadVarInt(l){return this._reader.preloadVarInt(l)}preloadVarIntBig(l){return this._reader.preloadVarIntBig(l)}loadCoins(){return this._reader.loadCoins()}preloadCoins(){return this._reader.preloadCoins()}loadMaybeCoins(){return this._reader.loadBit()?this._reader.loadCoins():null}loadAddress(){return this._reader.loadAddress()}loadMaybeAddress(){return this._reader.loadMaybeAddress()}loadExternalAddress(){return this._reader.loadExternalAddress()}loadMaybeExternalAddress(){return this._reader.loadMaybeExternalAddress()}loadAddressAny(){return this._reader.loadAddressAny()}loadRef(){if(this._refsOffset>=this._refs.length)throw new Error("No more references");return this._refs[this._refsOffset++]}preloadRef(){if(this._refsOffset>=this._refs.length)throw new Error("No more references");return this._refs[this._refsOffset]}loadMaybeRef(){return this.loadBit()?this.loadRef():null}preloadMaybeRef(){return this.preloadBit()?this.preloadRef():null}loadBuffer(l){return this._reader.loadBuffer(l)}preloadBuffer(l){return this._reader.preloadBuffer(l)}loadStringTail(){return(0,o.readString)(this)}loadMaybeStringTail(){return this.loadBit()?(0,o.readString)(this):null}loadStringRefTail(){return(0,o.readString)(this.loadRef().beginParse())}loadMaybeStringRefTail(){const l=this.loadMaybeRef();return l?(0,o.readString)(l.beginParse()):null}loadDict(l,u){return r.Dictionary.load(l,u,this)}loadDictDirect(l,u){return r.Dictionary.loadDirect(l,u,this)}endParse(){if(this.remainingBits>0||this.remainingRefs>0)throw new Error("Slice is not empty")}asCell(){return(0,a.beginCell)().storeSlice(this).endCell()}asBuilder(){return(0,a.beginCell)().storeSlice(this)}clone(l=!1){if(l){let u=this._reader.clone();return u.reset(),new Sc(u,this._refs)}else{let u=new Sc(this._reader,this._refs);return u._refsOffset=this._refsOffset,u}}toString(){return this.asCell().toString()}};return fi.Slice=i,t=n.default,fi}var Tl={},en={};Object.defineProperty(en,"__esModule",{value:!0});en.BitReader=void 0;const h_=Nt,m_=Do;class fd{constructor(t,n=0){this._checkpoints=[],this._bits=t,this._offset=n}get offset(){return this._offset}get remaining(){return this._bits.length-this._offset}skip(t){if(t<0||this._offset+t>this._bits.length)throw new Error(`Index ${this._offset+t} is out of bounds`);this._offset+=t}reset(){this._checkpoints.length>0?this._offset=this._checkpoints.pop():this._offset=0}save(){this._checkpoints.push(this._offset)}loadBit(){let t=this._bits.at(this._offset);return this._offset++,t}preloadBit(){return this._bits.at(this._offset)}loadBits(t){let n=this._bits.substring(this._offset,t);return this._offset+=t,n}preloadBits(t){return this._bits.substring(this._offset,t)}loadBuffer(t){let n=this._preloadBuffer(t,this._offset);return this._offset+=t*8,n}preloadBuffer(t){return this._preloadBuffer(t,this._offset)}loadUint(t){return Number(this.loadUintBig(t))}loadUintBig(t){let n=this.preloadUintBig(t);return this._offset+=t,n}preloadUint(t){return Number(this._preloadUint(t,this._offset))}preloadUintBig(t){return this._preloadUint(t,this._offset)}loadInt(t){let n=this._preloadInt(t,this._offset);return this._offset+=t,Number(n)}loadIntBig(t){let n=this._preloadInt(t,this._offset);return this._offset+=t,n}preloadInt(t){return Number(this._preloadInt(t,this._offset))}preloadIntBig(t){return this._preloadInt(t,this._offset)}loadVarUint(t){let n=Number(this.loadUint(t));return Number(this.loadUintBig(n*8))}loadVarUintBig(t){let n=Number(this.loadUint(t));return this.loadUintBig(n*8)}preloadVarUint(t){let n=Number(this._preloadUint(t,this._offset));return Number(this._preloadUint(n*8,this._offset+t))}preloadVarUintBig(t){let n=Number(this._preloadUint(t,this._offset));return this._preloadUint(n*8,this._offset+t)}loadVarInt(t){let n=Number(this.loadUint(t));return Number(this.loadIntBig(n*8))}loadVarIntBig(t){let n=Number(this.loadUint(t));return this.loadIntBig(n*8)}preloadVarInt(t){let n=Number(this._preloadUint(t,this._offset));return Number(this._preloadInt(n*8,this._offset+t))}preloadVarIntBig(t){let n=Number(this._preloadUint(t,this._offset));return this._preloadInt(n*8,this._offset+t)}loadCoins(){return this.loadVarUintBig(4)}preloadCoins(){return this.preloadVarUintBig(4)}loadAddress(){let t=Number(this._preloadUint(2,this._offset));if(t===2)return this._loadInternalAddress();throw new Error("Invalid address: "+t)}loadMaybeAddress(){let t=Number(this._preloadUint(2,this._offset));if(t===0)return this._offset+=2,null;if(t===2)return this._loadInternalAddress();throw new Error("Invalid address")}loadExternalAddress(){if(Number(this._preloadUint(2,this._offset))===1)return this._loadExternalAddress();throw new Error("Invalid address")}loadMaybeExternalAddress(){let t=Number(this._preloadUint(2,this._offset));if(t===0)return this._offset+=2,null;if(t===1)return this._loadExternalAddress();throw new Error("Invalid address")}loadAddressAny(){let t=Number(this._preloadUint(2,this._offset));if(t===0)return this._offset+=2,null;if(t===2)return this._loadInternalAddress();if(t===1)return this._loadExternalAddress();throw Error(t===3?"Unsupported":"Unreachable")}loadPaddedBits(t){if(t%8!==0)throw new Error("Invalid number of bits");let n=t;for(;;)if(this._bits.at(this._offset+n-1)){n--;break}else n--;let r=this._bits.substring(this._offset,n);return this._offset+=t,r}clone(){return new fd(this._bits,this._offset)}_preloadInt(t,n){if(t==0)return 0n;let r=this._bits.at(n),a=0n;for(let o=0;o>t-1)%2!==0}}qo.LevelMask=hd;function v_(e){return e=e-(e>>1&1431655765),e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}Object.defineProperty(Lo,"__esModule",{value:!0});Lo.exoticPruned=void 0;const j_=en,Df=qo;function __(e,t){let n=new j_.BitReader(e),r=n.loadUint(8);if(r!==1)throw new Error(`Pruned branch cell must have type 1, got "${r}"`);if(t.length!==0)throw new Error(`Pruned Branch cell can't has refs, got "${t.length}"`);let a;if(e.length===280)a=new Df.LevelMask(1);else{if(a=new Df.LevelMask(n.loadUint(8)),a.level<1||a.level>3)throw new Error(`Pruned Branch cell level must be >= 1 and <= 3, got "${a.level}/${a.value}"`);const l=8+8+a.apply(a.level-1).hashCount*(256+16);if(e.length!==l)throw new Error(`Pruned branch cell must have exactly ${l} bits, got "${e.length}"`)}let o=[],i=[],s=[];for(let l=0;l>1);return{type:Bl.CellType.MerkleProof,depths:n,hashes:r,mask:a}}function x_(e,t){(0,S_.exoticMerkleUpdate)(e,t);let n=[],r=[],a=new Ml.LevelMask((t[0].level()|t[1].level())>>1);return{type:Bl.CellType.MerkleUpdate,depths:n,hashes:r,mask:a}}function I_(e,t){let r=new C_.BitReader(e).preloadUint(8);if(r===1)return T_(e,t);if(r===2)return B_(e,t);if(r===3)return M_(e,t);if(r===4)return x_(e,t);throw Error("Invalid exotic cell type: "+r)}Tl.resolveExotic=I_;var xl={},Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.getRepr=Mn.getBitsDescriptor=Mn.getRefsDescriptor=void 0;const Oi=Lr,O_=Cl();function rg(e,t,n){return e.length+(n!==Oi.CellType.Ordinary?1:0)*8+t*32}Mn.getRefsDescriptor=rg;function ag(e){let t=e.length;return Math.ceil(t/8)+Math.floor(t/8)}Mn.getBitsDescriptor=ag;function R_(e,t,n,r,a,o){const i=Math.ceil(t.length/8),s=Buffer.alloc(2+i+(2+32)*n.length);let l=0;s[l++]=rg(n,a,o),s[l++]=ag(e),(0,O_.bitsToPaddedBuffer)(t).copy(s,l),l+=i;for(const u of n){let c;o==Oi.CellType.MerkleProof||o==Oi.CellType.MerkleUpdate?c=u.depth(r+1):c=u.depth(r),s[l++]=Math.floor(c/256),s[l++]=c%256}for(const u of n){let c;o==Oi.CellType.MerkleProof||o==Oi.CellType.MerkleUpdate?c=u.hash(r+1):c=u.hash(r),c.copy(s,l),l+=32}return s}Mn.getRepr=R_;var Wu={},mr={},og={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(re,function(){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function r(P,p,v,C){var I,k,L,$=p||[0],V=(v=v||0)>>>3,X=C===-1?3:0;for(I=0;I>>2,$.length<=k&&$.push(0),$[k]|=P[I]<<8*(X+C*(L%4));return{value:$,binLen:8*P.length+v}}function a(P,p,v){switch(p){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw new Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(P){case"HEX":return function(C,I,k){return function(L,$,V,X){var le,Z,te,we;if(L.length%2!=0)throw new Error("String of HEX type must be in byte increments");var G=$||[0],Ae=(V=V||0)>>>3,_e=X===-1?3:0;for(le=0;le>>1)+Ae)>>>2;G.length<=te;)G.push(0);G[te]|=Z<<8*(_e+X*(we%4))}return{value:G,binLen:4*L.length+V}}(C,I,k,v)};case"TEXT":return function(C,I,k){return function(L,$,V,X,le){var Z,te,we,G,Ae,_e,Te,ze,Ht=0,ct=V||[0],Tt=(X=X||0)>>>3;if($==="UTF8")for(Te=le===-1?3:0,we=0;we(Z=L.charCodeAt(we))?te.push(Z):2048>Z?(te.push(192|Z>>>6),te.push(128|63&Z)):55296>Z||57344<=Z?te.push(224|Z>>>12,128|Z>>>6&63,128|63&Z):(we+=1,Z=65536+((1023&Z)<<10|1023&L.charCodeAt(we)),te.push(240|Z>>>18,128|Z>>>12&63,128|Z>>>6&63,128|63&Z)),G=0;G>>2;ct.length<=Ae;)ct.push(0);ct[Ae]|=te[G]<<8*(Te+le*(_e%4)),Ht+=1}else for(Te=le===-1?2:0,ze=$==="UTF16LE"&&le!==1||$!=="UTF16LE"&&le===1,we=0;we>>8),Ae=(_e=Ht+Tt)>>>2;ct.length<=Ae;)ct.push(0);ct[Ae]|=Z<<8*(Te+le*(_e%4)),Ht+=2}return{value:ct,binLen:8*Ht+X}}(C,p,I,k,v)};case"B64":return function(C,I,k){return function(L,$,V,X){var le,Z,te,we,G,Ae,_e=0,Te=$||[0],ze=(V=V||0)>>>3,Ht=X===-1?3:0,ct=L.indexOf("=");if(L.search(/^[a-zA-Z0-9=+/]+$/)===-1)throw new Error("Invalid character in base-64 string");if(L=L.replace(/=/g,""),ct!==-1&&ct{const n={},r=a=>{a.forEach(o=>{n[o]=!0})};return Ho(e)?r(e):r(String(e).split(t)),n},gA=()=>{},yA=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Yu="abcdefghijklmnopqrstuvwxyz",eh="0123456789",yy={DIGIT:eh,ALPHA:Yu,ALPHA_DIGIT:Yu+Yu.toUpperCase()+eh},bA=(e=16,t=yy.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function wA(e){return!!(e&&xt(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const kA=e=>{const t=new Array(10),n=(r,a)=>{if(Zl(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[a]=r;const o=Ho(r)?[]:{};return ds(r,(i,s)=>{const l=n(i,a+1);!Xi(l)&&(o[s]=l)}),t[a]=void 0,o}}return r};return n(e,0)},vA=tn("AsyncFunction"),jA=e=>e&&(Zl(e)||xt(e))&&xt(e.then)&&xt(e.catch),by=((e,t)=>e?setImmediate:t?((n,r)=>(ra.addEventListener("message",({source:a,data:o})=>{a===ra&&o===n&&r.length&&r.shift()()},!1),a=>{r.push(a),ra.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",xt(ra.postMessage)),_A=typeof queueMicrotask<"u"?queueMicrotask.bind(ra):typeof process<"u"&&process.nextTick||by;var z={isArray:Ho,isArrayBuffer:fy,isBuffer:FE,isFormData:GE,isArrayBufferView:LE,isString:qE,isNumber:hy,isBoolean:$E,isObject:Zl,isPlainObject:Ws,isReadableStream:YE,isRequest:ZE,isResponse:XE,isHeaders:eA,isUndefined:Xi,isDate:WE,isFile:HE,isBlob:VE,isRegExp:hA,isFunction:xt,isStream:KE,isURLSearchParams:QE,isTypedArray:lA,isFileList:JE,forEach:ds,merge:Ic,extend:nA,trim:tA,stripBOM:rA,inherits:aA,toFlatObject:oA,kindOf:Ql,kindOfTest:tn,endsWith:iA,toArray:sA,forEachEntry:uA,matchAll:cA,isHTMLForm:dA,hasOwnProperty:Xf,hasOwnProp:Xf,reduceDescriptors:gy,freezeMethods:mA,toObjectSet:pA,toCamelCase:fA,noop:gA,toFiniteNumber:yA,findKey:my,global:ra,isContextDefined:py,ALPHABET:yy,generateString:bA,isSpecCompliantForm:wA,toJSONObject:kA,isAsyncFn:vA,isThenable:jA,setImmediate:by,asap:_A};function ke(e,t,n,r,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),a&&(this.response=a,this.status=a.status?a.status:null)}z.inherits(ke,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:z.toJSONObject(this.config),code:this.code,status:this.status}}});const wy=ke.prototype,ky={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{ky[e]={value:e}});Object.defineProperties(ke,ky);Object.defineProperty(wy,"isAxiosError",{value:!0});ke.from=(e,t,n,r,a,o)=>{const i=Object.create(wy);return z.toFlatObject(e,i,function(l){return l!==Error.prototype},s=>s!=="isAxiosError"),ke.call(i,e.message,t,n,r,a),i.cause=e,i.name=e.name,o&&Object.assign(i,o),i};var CA=null;function Oc(e){return z.isPlainObject(e)||z.isArray(e)}function vy(e){return z.endsWith(e,"[]")?e.slice(0,-2):e}function th(e,t,n){return e?e.concat(t).map(function(a,o){return a=vy(a),!n&&o?"["+a+"]":a}).join(n?".":""):t}function EA(e){return z.isArray(e)&&!e.some(Oc)}const AA=z.toFlatObject(z,{},null,function(t){return/^is[A-Z]/.test(t)});function Xl(e,t,n){if(!z.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=z.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,j){return!z.isUndefined(j[f])});const r=n.metaTokens,a=n.visitor||c,o=n.dots,i=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&z.isSpecCompliantForm(t);if(!z.isFunction(a))throw new TypeError("visitor must be a function");function u(y){if(y===null)return"";if(z.isDate(y))return y.toISOString();if(!l&&z.isBlob(y))throw new ke("Blob is not supported. Use a Buffer instead.");return z.isArrayBuffer(y)||z.isTypedArray(y)?l&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function c(y,f,j){let T=y;if(y&&!j&&typeof y=="object"){if(z.endsWith(f,"{}"))f=r?f:f.slice(0,-2),y=JSON.stringify(y);else if(z.isArray(y)&&EA(y)||(z.isFileList(y)||z.endsWith(f,"[]"))&&(T=z.toArray(y)))return f=vy(f),T.forEach(function(b,g){!(z.isUndefined(b)||b===null)&&t.append(i===!0?th([f],g,o):i===null?f:f+"[]",u(b))}),!1}return Oc(y)?!0:(t.append(th(j,f,o),u(y)),!1)}const d=[],h=Object.assign(AA,{defaultVisitor:c,convertValue:u,isVisitable:Oc});function m(y,f){if(!z.isUndefined(y)){if(d.indexOf(y)!==-1)throw Error("Circular reference detected in "+f.join("."));d.push(y),z.forEach(y,function(T,E){(!(z.isUndefined(T)||T===null)&&a.call(t,T,z.isString(E)?E.trim():E,f,h))===!0&&m(T,f?f.concat(E):[E])}),d.pop()}}if(!z.isObject(e))throw new TypeError("data must be an object");return m(e),t}function nh(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function _d(e,t){this._pairs=[],e&&Xl(e,this,t)}const jy=_d.prototype;jy.append=function(t,n){this._pairs.push([t,n])};jy.toString=function(t){const n=t?function(r){return t.call(this,r,nh)}:nh;return this._pairs.map(function(a){return n(a[0])+"="+n(a[1])},"").join("&")};function SA(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function _y(e,t,n){if(!t)return e;const r=n&&n.encode||SA,a=n&&n.serialize;let o;if(a?o=a(t,n):o=z.isURLSearchParams(t)?t.toString():new _d(t,n).toString(r),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class PA{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){z.forEach(this.handlers,function(r){r!==null&&t(r)})}}var rh=PA,Cy={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},TA=typeof URLSearchParams<"u"?URLSearchParams:_d,BA=typeof FormData<"u"?FormData:null,MA=typeof Blob<"u"?Blob:null,xA={isBrowser:!0,classes:{URLSearchParams:TA,FormData:BA,Blob:MA},protocols:["http","https","file","blob","url","data"]};const Cd=typeof window<"u"&&typeof document<"u",Rc=typeof navigator=="object"&&navigator||void 0,IA=Cd&&(!Rc||["ReactNative","NativeScript","NS"].indexOf(Rc.product)<0),OA=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),RA=Cd&&window.location.href||"http://localhost";var NA=Object.freeze({__proto__:null,hasBrowserEnv:Cd,hasStandardBrowserWebWorkerEnv:OA,hasStandardBrowserEnv:IA,navigator:Rc,origin:RA}),Pt={...NA,...xA};function zA(e,t){return Xl(e,new Pt.classes.URLSearchParams,Object.assign({visitor:function(n,r,a,o){return Pt.isNode&&z.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function DA(e){return z.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function UA(e){const t={},n=Object.keys(e);let r;const a=n.length;let o;for(r=0;r=n.length;return i=!i&&z.isArray(a)?a.length:i,l?(z.hasOwnProp(a,i)?a[i]=[a[i],r]:a[i]=r,!s):((!a[i]||!z.isObject(a[i]))&&(a[i]=[]),t(n,r,a[i],o)&&z.isArray(a[i])&&(a[i]=UA(a[i])),!s)}if(z.isFormData(e)&&z.isFunction(e.entries)){const n={};return z.forEachEntry(e,(r,a)=>{t(DA(r),a,n,0)}),n}return null}function FA(e,t,n){if(z.isString(e))try{return(t||JSON.parse)(e),z.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Ed={transitional:Cy,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",a=r.indexOf("application/json")>-1,o=z.isObject(t);if(o&&z.isHTMLForm(t)&&(t=new FormData(t)),z.isFormData(t))return a?JSON.stringify(Ey(t)):t;if(z.isArrayBuffer(t)||z.isBuffer(t)||z.isStream(t)||z.isFile(t)||z.isBlob(t)||z.isReadableStream(t))return t;if(z.isArrayBufferView(t))return t.buffer;if(z.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return zA(t,this.formSerializer).toString();if((s=z.isFileList(t))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Xl(s?{"files[]":t}:t,l&&new l,this.formSerializer)}}return o||a?(n.setContentType("application/json",!1),FA(t)):t}],transformResponse:[function(t){const n=this.transitional||Ed.transitional,r=n&&n.forcedJSONParsing,a=this.responseType==="json";if(z.isResponse(t)||z.isReadableStream(t))return t;if(t&&z.isString(t)&&(r&&!this.responseType||a)){const i=!(n&&n.silentJSONParsing)&&a;try{return JSON.parse(t)}catch(s){if(i)throw s.name==="SyntaxError"?ke.from(s,ke.ERR_BAD_RESPONSE,this,null,this.response):s}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Pt.classes.FormData,Blob:Pt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};z.forEach(["delete","get","head","post","put","patch"],e=>{Ed.headers[e]={}});var Ad=Ed;const LA=z.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var qA=e=>{const t={};let n,r,a;return e&&e.split(` -`).forEach(function(i){a=i.indexOf(":"),n=i.substring(0,a).trim().toLowerCase(),r=i.substring(a+1).trim(),!(!n||t[n]&&LA[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};const ah=Symbol("internals");function bi(e){return e&&String(e).trim().toLowerCase()}function Hs(e){return e===!1||e==null?e:z.isArray(e)?e.map(Hs):String(e)}function $A(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const WA=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Zu(e,t,n,r,a){if(z.isFunction(r))return r.call(this,t,n);if(a&&(t=n),!!z.isString(t)){if(z.isString(r))return t.indexOf(r)!==-1;if(z.isRegExp(r))return r.test(t)}}function HA(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function VA(e,t){const n=z.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(a,o,i){return this[r].call(this,t,a,o,i)},configurable:!0})})}class eu{constructor(t){t&&this.set(t)}set(t,n,r){const a=this;function o(s,l,u){const c=bi(l);if(!c)throw new Error("header name must be a non-empty string");const d=z.findKey(a,c);(!d||a[d]===void 0||u===!0||u===void 0&&a[d]!==!1)&&(a[d||l]=Hs(s))}const i=(s,l)=>z.forEach(s,(u,c)=>o(u,c,l));if(z.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(z.isString(t)&&(t=t.trim())&&!WA(t))i(qA(t),n);else if(z.isHeaders(t))for(const[s,l]of t.entries())o(l,s,r);else t!=null&&o(n,t,r);return this}get(t,n){if(t=bi(t),t){const r=z.findKey(this,t);if(r){const a=this[r];if(!n)return a;if(n===!0)return $A(a);if(z.isFunction(n))return n.call(this,a,r);if(z.isRegExp(n))return n.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=bi(t),t){const r=z.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Zu(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let a=!1;function o(i){if(i=bi(i),i){const s=z.findKey(r,i);s&&(!n||Zu(r,r[s],s,n))&&(delete r[s],a=!0)}}return z.isArray(t)?t.forEach(o):o(t),a}clear(t){const n=Object.keys(this);let r=n.length,a=!1;for(;r--;){const o=n[r];(!t||Zu(this,this[o],o,t,!0))&&(delete this[o],a=!0)}return a}normalize(t){const n=this,r={};return z.forEach(this,(a,o)=>{const i=z.findKey(r,o);if(i){n[i]=Hs(a),delete n[o];return}const s=t?HA(o):String(o).trim();s!==o&&delete n[o],n[s]=Hs(a),r[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return z.forEach(this,(r,a)=>{r!=null&&r!==!1&&(n[a]=t&&z.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(a=>r.set(a)),r}static accessor(t){const r=(this[ah]=this[ah]={accessors:{}}).accessors,a=this.prototype;function o(i){const s=bi(i);r[s]||(VA(a,i),r[s]=!0)}return z.isArray(t)?t.forEach(o):o(t),this}}eu.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);z.reduceDescriptors(eu.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});z.freezeMethods(eu);var Yt=eu;function Xu(e,t){const n=this||Ad,r=t||n,a=Yt.from(r.headers);let o=r.data;return z.forEach(e,function(s){o=s.call(n,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function Ay(e){return!!(e&&e.__CANCEL__)}function Vo(e,t,n){ke.call(this,e??"canceled",ke.ERR_CANCELED,t,n),this.name="CanceledError"}z.inherits(Vo,ke,{__CANCEL__:!0});function Sy(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new ke("Request failed with status code "+n.status,[ke.ERR_BAD_REQUEST,ke.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function JA(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function KA(e,t){e=e||10;const n=new Array(e),r=new Array(e);let a=0,o=0,i;return t=t!==void 0?t:1e3,function(l){const u=Date.now(),c=r[o];i||(i=u),n[a]=l,r[a]=u;let d=o,h=0;for(;d!==a;)h+=n[d++],d=d%e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),u-i{n=c,a=null,o&&(clearTimeout(o),o=null),e.apply(null,u)};return[(...u)=>{const c=Date.now(),d=c-n;d>=r?i(u,c):(a=u,o||(o=setTimeout(()=>{o=null,i(a)},r-d)))},()=>a&&i(a)]}const ll=(e,t,n=3)=>{let r=0;const a=KA(50,250);return GA(o=>{const i=o.loaded,s=o.lengthComputable?o.total:void 0,l=i-r,u=a(l),c=i<=s;r=i;const d={loaded:i,total:s,progress:s?i/s:void 0,bytes:l,rate:u||void 0,estimated:u&&s&&c?(s-i)/u:void 0,event:o,lengthComputable:s!=null,[t?"download":"upload"]:!0};e(d)},n)},oh=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ih=e=>(...t)=>z.asap(()=>e(...t));var QA=Pt.hasStandardBrowserEnv?function(){const t=Pt.navigator&&/(msie|trident)/i.test(Pt.navigator.userAgent),n=document.createElement("a");let r;function a(o){let i=o;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=a(window.location.href),function(i){const s=z.isString(i)?a(i):i;return s.protocol===r.protocol&&s.host===r.host}}():function(){return function(){return!0}}(),YA=Pt.hasStandardBrowserEnv?{write(e,t,n,r,a,o){const i=[e+"="+encodeURIComponent(t)];z.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),z.isString(r)&&i.push("path="+r),z.isString(a)&&i.push("domain="+a),o===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function ZA(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function XA(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Py(e,t){return e&&!ZA(t)?XA(e,t):t}const sh=e=>e instanceof Yt?{...e}:e;function xa(e,t){t=t||{};const n={};function r(u,c,d){return z.isPlainObject(u)&&z.isPlainObject(c)?z.merge.call({caseless:d},u,c):z.isPlainObject(c)?z.merge({},c):z.isArray(c)?c.slice():c}function a(u,c,d){if(z.isUndefined(c)){if(!z.isUndefined(u))return r(void 0,u,d)}else return r(u,c,d)}function o(u,c){if(!z.isUndefined(c))return r(void 0,c)}function i(u,c){if(z.isUndefined(c)){if(!z.isUndefined(u))return r(void 0,u)}else return r(void 0,c)}function s(u,c,d){if(d in t)return r(u,c);if(d in e)return r(void 0,u)}const l={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:s,headers:(u,c)=>a(sh(u),sh(c),!0)};return z.forEach(Object.keys(Object.assign({},e,t)),function(c){const d=l[c]||a,h=d(e[c],t[c],c);z.isUndefined(h)&&d!==s||(n[c]=h)}),n}var Ty=e=>{const t=xa({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:o,headers:i,auth:s}=t;t.headers=i=Yt.from(i),t.url=_y(Py(t.baseURL,t.url),e.params,e.paramsSerializer),s&&i.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):"")));let l;if(z.isFormData(n)){if(Pt.hasStandardBrowserEnv||Pt.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((l=i.getContentType())!==!1){const[u,...c]=l?l.split(";").map(d=>d.trim()).filter(Boolean):[];i.setContentType([u||"multipart/form-data",...c].join("; "))}}if(Pt.hasStandardBrowserEnv&&(r&&z.isFunction(r)&&(r=r(t)),r||r!==!1&&QA(t.url))){const u=a&&o&&YA.read(o);u&&i.set(a,u)}return t};const eS=typeof XMLHttpRequest<"u";var tS=eS&&function(e){return new Promise(function(n,r){const a=Ty(e);let o=a.data;const i=Yt.from(a.headers).normalize();let{responseType:s,onUploadProgress:l,onDownloadProgress:u}=a,c,d,h,m,y;function f(){m&&m(),y&&y(),a.cancelToken&&a.cancelToken.unsubscribe(c),a.signal&&a.signal.removeEventListener("abort",c)}let j=new XMLHttpRequest;j.open(a.method.toUpperCase(),a.url,!0),j.timeout=a.timeout;function T(){if(!j)return;const b=Yt.from("getAllResponseHeaders"in j&&j.getAllResponseHeaders()),A={data:!s||s==="text"||s==="json"?j.responseText:j.response,status:j.status,statusText:j.statusText,headers:b,config:e,request:j};Sy(function(x){n(x),f()},function(x){r(x),f()},A),j=null}"onloadend"in j?j.onloadend=T:j.onreadystatechange=function(){!j||j.readyState!==4||j.status===0&&!(j.responseURL&&j.responseURL.indexOf("file:")===0)||setTimeout(T)},j.onabort=function(){j&&(r(new ke("Request aborted",ke.ECONNABORTED,e,j)),j=null)},j.onerror=function(){r(new ke("Network Error",ke.ERR_NETWORK,e,j)),j=null},j.ontimeout=function(){let g=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const A=a.transitional||Cy;a.timeoutErrorMessage&&(g=a.timeoutErrorMessage),r(new ke(g,A.clarifyTimeoutError?ke.ETIMEDOUT:ke.ECONNABORTED,e,j)),j=null},o===void 0&&i.setContentType(null),"setRequestHeader"in j&&z.forEach(i.toJSON(),function(g,A){j.setRequestHeader(A,g)}),z.isUndefined(a.withCredentials)||(j.withCredentials=!!a.withCredentials),s&&s!=="json"&&(j.responseType=a.responseType),u&&([h,y]=ll(u,!0),j.addEventListener("progress",h)),l&&j.upload&&([d,m]=ll(l),j.upload.addEventListener("progress",d),j.upload.addEventListener("loadend",m)),(a.cancelToken||a.signal)&&(c=b=>{j&&(r(!b||b.type?new Vo(null,e,j):b),j.abort(),j=null)},a.cancelToken&&a.cancelToken.subscribe(c),a.signal&&(a.signal.aborted?c():a.signal.addEventListener("abort",c)));const E=JA(a.url);if(E&&Pt.protocols.indexOf(E)===-1){r(new ke("Unsupported protocol "+E+":",ke.ERR_BAD_REQUEST,e));return}j.send(o||null)})};const nS=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,a;const o=function(u){if(!a){a=!0,s();const c=u instanceof Error?u:this.reason;r.abort(c instanceof ke?c:new Vo(c instanceof Error?c.message:c))}};let i=t&&setTimeout(()=>{i=null,o(new ke(`timeout ${t} of ms exceeded`,ke.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:l}=r;return l.unsubscribe=()=>z.asap(s),l}};var rS=nS;const aS=function*(e,t){let n=e.byteLength;if(!t||n{const a=oS(e,t);let o=0,i,s=l=>{i||(i=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:u,value:c}=await a.next();if(u){s(),l.close();return}let d=c.byteLength;if(n){let h=o+=d;n(h)}l.enqueue(new Uint8Array(c))}catch(u){throw s(u),u}},cancel(l){return s(l),a.return()}},{highWaterMark:2})},tu=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",By=tu&&typeof ReadableStream=="function",sS=tu&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),My=(e,...t)=>{try{return!!e(...t)}catch{return!1}},lS=By&&My(()=>{let e=!1;const t=new Request(Pt.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),uh=64*1024,Nc=By&&My(()=>z.isReadableStream(new Response("").body)),ul={stream:Nc&&(e=>e.body)};tu&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!ul[t]&&(ul[t]=z.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new ke(`Response type '${t}' is not supported`,ke.ERR_NOT_SUPPORT,r)})})})(new Response);const uS=async e=>{if(e==null)return 0;if(z.isBlob(e))return e.size;if(z.isSpecCompliantForm(e))return(await new Request(Pt.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(z.isArrayBufferView(e)||z.isArrayBuffer(e))return e.byteLength;if(z.isURLSearchParams(e)&&(e=e+""),z.isString(e))return(await sS(e)).byteLength},cS=async(e,t)=>{const n=z.toFiniteNumber(e.getContentLength());return n??uS(t)};var dS=tu&&(async e=>{let{url:t,method:n,data:r,signal:a,cancelToken:o,timeout:i,onDownloadProgress:s,onUploadProgress:l,responseType:u,headers:c,withCredentials:d="same-origin",fetchOptions:h}=Ty(e);u=u?(u+"").toLowerCase():"text";let m=rS([a,o&&o.toAbortSignal()],i),y;const f=m&&m.unsubscribe&&(()=>{m.unsubscribe()});let j;try{if(l&&lS&&n!=="get"&&n!=="head"&&(j=await cS(c,r))!==0){let A=new Request(t,{method:"POST",body:r,duplex:"half"}),_;if(z.isFormData(r)&&(_=A.headers.get("content-type"))&&c.setContentType(_),A.body){const[x,J]=oh(j,ll(ih(l)));r=lh(A.body,uh,x,J)}}z.isString(d)||(d=d?"include":"omit");const T="credentials"in Request.prototype;y=new Request(t,{...h,signal:m,method:n.toUpperCase(),headers:c.normalize().toJSON(),body:r,duplex:"half",credentials:T?d:void 0});let E=await fetch(y);const b=Nc&&(u==="stream"||u==="response");if(Nc&&(s||b&&f)){const A={};["status","statusText","headers"].forEach(q=>{A[q]=E[q]});const _=z.toFiniteNumber(E.headers.get("content-length")),[x,J]=s&&oh(_,ll(ih(s),!0))||[];E=new Response(lh(E.body,uh,x,()=>{J&&J(),f&&f()}),A)}u=u||"text";let g=await ul[z.findKey(ul,u)||"text"](E,e);return!b&&f&&f(),await new Promise((A,_)=>{Sy(A,_,{data:g,headers:Yt.from(E.headers),status:E.status,statusText:E.statusText,config:e,request:y})})}catch(T){throw f&&f(),T&&T.name==="TypeError"&&/fetch/i.test(T.message)?Object.assign(new ke("Network Error",ke.ERR_NETWORK,e,y),{cause:T.cause||T}):ke.from(T,T&&T.code,e,y)}});const zc={http:CA,xhr:tS,fetch:dS};z.forEach(zc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const ch=e=>`- ${e}`,fS=e=>z.isFunction(e)||e===null||e===!1;var xy={getAdapter:e=>{e=z.isArray(e)?e:[e];const{length:t}=e;let n,r;const a={};for(let o=0;o`adapter ${s} `+(l===!1?"is not supported by the environment":"is not available in the build"));let i=t?o.length>1?`since : -`+o.map(ch).join(` -`):" "+ch(o[0]):"as no adapter specified";throw new ke("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:zc};function ec(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Vo(null,e)}function dh(e){return ec(e),e.headers=Yt.from(e.headers),e.data=Xu.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),xy.getAdapter(e.adapter||Ad.adapter)(e).then(function(r){return ec(e),r.data=Xu.call(e,e.transformResponse,r),r.headers=Yt.from(r.headers),r},function(r){return Ay(r)||(ec(e),r&&r.response&&(r.response.data=Xu.call(e,e.transformResponse,r.response),r.response.headers=Yt.from(r.response.headers))),Promise.reject(r)})}const Iy="1.7.7",Sd={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Sd[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const fh={};Sd.transitional=function(t,n,r){function a(o,i){return"[Axios v"+Iy+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,s)=>{if(t===!1)throw new ke(a(i," has been removed"+(n?" in "+n:"")),ke.ERR_DEPRECATED);return n&&!fh[i]&&(fh[i]=!0,console.warn(a(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,s):!0}};function hS(e,t,n){if(typeof e!="object")throw new ke("options must be an object",ke.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let a=r.length;for(;a-- >0;){const o=r[a],i=t[o];if(i){const s=e[o],l=s===void 0||i(s,o,e);if(l!==!0)throw new ke("option "+o+" must be "+l,ke.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ke("Unknown option "+o,ke.ERR_BAD_OPTION)}}var Dc={assertOptions:hS,validators:Sd};const rr=Dc.validators;class cl{constructor(t){this.defaults=t,this.interceptors={request:new rh,response:new rh}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let a;Error.captureStackTrace?Error.captureStackTrace(a={}):a=new Error;const o=a.stack?a.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=xa(this.defaults,n);const{transitional:r,paramsSerializer:a,headers:o}=n;r!==void 0&&Dc.assertOptions(r,{silentJSONParsing:rr.transitional(rr.boolean),forcedJSONParsing:rr.transitional(rr.boolean),clarifyTimeoutError:rr.transitional(rr.boolean)},!1),a!=null&&(z.isFunction(a)?n.paramsSerializer={serialize:a}:Dc.assertOptions(a,{encode:rr.function,serialize:rr.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&z.merge(o.common,o[n.method]);o&&z.forEach(["delete","get","head","post","put","patch","common"],y=>{delete o[y]}),n.headers=Yt.concat(i,o);const s=[];let l=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(n)===!1||(l=l&&f.synchronous,s.unshift(f.fulfilled,f.rejected))});const u=[];this.interceptors.response.forEach(function(f){u.push(f.fulfilled,f.rejected)});let c,d=0,h;if(!l){const y=[dh.bind(this),void 0];for(y.unshift.apply(y,s),y.push.apply(y,u),h=y.length,c=Promise.resolve(n);d{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](a);r._listeners=null}),this.promise.then=a=>{let o;const i=new Promise(s=>{r.subscribe(s),o=s}).then(a);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,s){r.reason||(r.reason=new Vo(o,i,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Pd(function(a){t=a}),cancel:t}}}var mS=Pd;function pS(e){return function(n){return e.apply(null,n)}}function gS(e){return z.isObject(e)&&e.isAxiosError===!0}const Uc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Uc).forEach(([e,t])=>{Uc[t]=e});var yS=Uc;function Oy(e){const t=new Vs(e),n=dy(Vs.prototype.request,t);return z.extend(n,Vs.prototype,t,{allOwnKeys:!0}),z.extend(n,t,null,{allOwnKeys:!0}),n.create=function(a){return Oy(xa(e,a))},n}const Je=Oy(Ad);Je.Axios=Vs;Je.CanceledError=Vo;Je.CancelToken=mS;Je.isCancel=Ay;Je.VERSION=Iy;Je.toFormData=Xl;Je.AxiosError=ke;Je.Cancel=Je.CanceledError;Je.all=function(t){return Promise.all(t)};Je.spread=pS;Je.isAxiosError=gS;Je.mergeConfig=xa;Je.AxiosHeaders=Yt;Je.formToJSON=e=>Ey(z.isHTMLForm(e)?new FormData(e):e);Je.getAdapter=xy.getAdapter;Je.HttpStatusCode=yS;Je.default=Je;var Td=Je;const fs=Vw(Hj),bS="@ton/ton",wS="14.0.0",kS="https://github.com/ton-org/ton.git",vS="Whales Corp. ",jS="MIT",_S="dist/index.js",CS=["dist"],ES={docs:"rm -fr docs && typedoc src/index.ts",build:"rm -fr dist && tsc --declaration",test:"jest --verbose --runInBand",release:"yarn build && yarn release-it --npm.yarn1"},AS={"@release-it/keep-a-changelog":"^5.0.0","@ton/core":"^0.56.0","@ton/crypto":"3.2.0","@ton/emulator":"^2.1.1","@types/jest":"^27.0.1","@types/node":"^16.7.10",buffer:"^6.0.3",expect:"^27.1.0",jest:"^27.1.0","jest-mock":"^27.1.0",karma:"^6.3.4","karma-chrome-launcher":"^3.1.0","karma-jasmine":"^4.0.1","karma-typescript":"^5.5.2","karma-webpack":"^5.0.0",prando:"^6.0.1","release-it":"^17.1.1","ts-jest":"^27.0.5","ts-loader":"^9.2.5","ts-node":"^10.7.0",typedoc:"^0.23.24",typescript:"^4.4.2",webpack:"^5.51.2"},SS={axios:"^1.6.7",dataloader:"^2.0.0","symbol.inspect":"1.0.1",teslabot:"^1.3.0",zod:"^3.21.4"},PS={"@ton/core":">=0.56.0","@ton/crypto":">=3.2.0"},TS={access:"public",registry:"https://registry.npmjs.org/"},BS="yarn@3.4.1",MS={name:bS,version:wS,repository:kS,author:vS,license:jS,main:_S,files:CS,scripts:ES,devDependencies:AS,dependencies:SS,peerDependencies:PS,publishConfig:TS,"release-it":{github:{release:!0},plugins:{"@release-it/keep-a-changelog":{filename:"CHANGELOG.md"}}},packageManager:BS};var Ry=re&&re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(cs,"__esModule",{value:!0});cs.HttpApi=void 0;const xS=Gl,hh=Ry(DE),IS=Ry(Td),Q=fs,OS=MS.version,xo=Q.z.object({"@type":Q.z.literal("ton.blockIdExt"),workchain:Q.z.number(),shard:Q.z.string(),seqno:Q.z.number(),root_hash:Q.z.string(),file_hash:Q.z.string()}),RS=Q.z.object({balance:Q.z.union([Q.z.number(),Q.z.string()]),state:Q.z.union([Q.z.literal("active"),Q.z.literal("uninitialized"),Q.z.literal("frozen")]),data:Q.z.string(),code:Q.z.string(),last_transaction_id:Q.z.object({"@type":Q.z.literal("internal.transactionId"),lt:Q.z.string(),hash:Q.z.string()}),block_id:xo,sync_utime:Q.z.number()}),NS=Q.z.object({"@type":Q.z.literal("ok")}),zS=Q.z.object({"@type":Q.z.literal("query.fees"),source_fees:Q.z.object({"@type":Q.z.literal("fees"),in_fwd_fee:Q.z.number(),storage_fee:Q.z.number(),gas_fee:Q.z.number(),fwd_fee:Q.z.number()})}),DS=Q.z.object({gas_used:Q.z.number(),exit_code:Q.z.number(),stack:Q.z.array(Q.z.unknown())}),US=Q.z.union([Q.z.object({"@type":Q.z.literal("msg.dataRaw"),body:Q.z.string()}),Q.z.object({"@type":Q.z.literal("msg.dataText"),text:Q.z.string()}),Q.z.object({"@type":Q.z.literal("msg.dataDecryptedText"),text:Q.z.string()}),Q.z.object({"@type":Q.z.literal("msg.dataEncryptedText"),text:Q.z.string()})]),mh=Q.z.object({source:Q.z.string(),destination:Q.z.string(),value:Q.z.string(),fwd_fee:Q.z.string(),ihr_fee:Q.z.string(),created_lt:Q.z.string(),body_hash:Q.z.string(),msg_data:US,message:Q.z.string().optional()}),Fc=Q.z.object({data:Q.z.string(),utime:Q.z.number(),transaction_id:Q.z.object({lt:Q.z.string(),hash:Q.z.string()}),fee:Q.z.string(),storage_fee:Q.z.string(),other_fee:Q.z.string(),in_msg:Q.z.union([Q.z.undefined(),mh]),out_msgs:Q.z.array(mh)}),ph=Q.z.array(Fc),FS=Q.z.object({state_root_hash:Q.z.string(),last:xo,init:xo}),LS=Q.z.object({shards:Q.z.array(xo)}),qS=Q.z.object({"@type":Q.z.literal("blocks.shortTxId"),mode:Q.z.number(),account:Q.z.string(),lt:Q.z.string(),hash:Q.z.string()}),gh=Q.z.object({id:xo,req_count:Q.z.number(),incomplete:Q.z.boolean(),transactions:Q.z.array(qS)});class yh{constructor(t,n,r,a){this.namespace=t,this.cache=n,this.codec=r,this.keyEncoder=a}async get(t){let n=await this.cache.get(this.namespace,this.keyEncoder(t));if(n){let r=this.codec.safeParse(JSON.parse(n));if(r.success)return r.data}return null}async set(t,n){n!==null?await this.cache.set(this.namespace,this.keyEncoder(t),JSON.stringify(n)):await this.cache.set(this.namespace,this.keyEncoder(t),null)}}class $S{constructor(t,n){this.endpoint=t,this.cache=new xS.InMemoryCache,this.parameters={timeout:(n==null?void 0:n.timeout)||3e4,apiKey:n==null?void 0:n.apiKey,adapter:n==null?void 0:n.adapter},this.shardCache=new yh("ton-shard",this.cache,Q.z.array(xo),r=>r+""),this.shardLoader=new hh.default(async r=>await Promise.all(r.map(async a=>{const o=await this.shardCache.get(a);if(o)return o;let i=(await this.doCall("shards",{seqno:a},LS)).shards;return await this.shardCache.set(a,i),i}))),this.shardTransactionsCache=new yh("ton-shard-tx",this.cache,gh,r=>r.workchain+":"+r.shard+":"+r.seqno),this.shardTransactionsLoader=new hh.default(async r=>await Promise.all(r.map(async a=>{const o=await this.shardTransactionsCache.get(a);if(o)return o;let i=await this.doCall("getBlockTransactions",{workchain:a.workchain,seqno:a.seqno,shard:a.shard},gh);return await this.shardTransactionsCache.set(a,i),i})),{cacheKeyFn:r=>r.workchain+":"+r.shard+":"+r.seqno})}getAddressInformation(t){return this.doCall("getAddressInformation",{address:t.toString()},RS)}async getTransactions(t,n){const r=n.inclusive;delete n.inclusive;let a;n.hash&&(a=Buffer.from(n.hash,"base64").toString("hex"));let o=n.limit;n.hash&&n.lt&&r!==!0&&o++;let i=await this.doCall("getTransactions",{address:t.toString(),...n,limit:o,hash:a},ph);return i.length>o&&(i=i.slice(0,o)),n.hash&&n.lt&&r!==!0&&i.shift(),i}async getMasterchainInfo(){return await this.doCall("getMasterchainInfo",{},FS)}async getShards(t){return await this.shardLoader.load(t)}async getBlockTransactions(t,n,r){return await this.shardTransactionsLoader.load({workchain:t,seqno:n,shard:r})}async getTransaction(t,n,r){let a=Buffer.from(r,"base64").toString("hex"),i=(await this.doCall("getTransactions",{address:t.toString(),lt:n,hash:a,limit:1},ph)).find(s=>s.transaction_id.lt===n&&s.transaction_id.hash===r);return i||null}async callGetMethod(t,n,r){return await this.doCall("runGetMethod",{address:t.toString(),method:n,stack:WS(r)},DS)}async sendBoc(t){await this.doCall("sendBoc",{boc:t.toString("base64")},NS)}async estimateFee(t,n){return await this.doCall("estimateFee",{address:t.toString(),body:n.body.toBoc().toString("base64"),init_data:n.initData?n.initData.toBoc().toString("base64"):"",init_code:n.initCode?n.initCode.toBoc().toString("base64"):"",ignore_chksig:n.ignoreSignature},zS)}async tryLocateResultTx(t,n,r){return await this.doCall("tryLocateResultTx",{source:t.toString(),destination:n.toString(),created_lt:r},Fc)}async tryLocateSourceTx(t,n,r){return await this.doCall("tryLocateSourceTx",{source:t.toString(),destination:n.toString(),created_lt:r},Fc)}async doCall(t,n,r){let a={"Content-Type":"application/json","X-Ton-Client-Version":OS};this.parameters.apiKey&&(a["X-API-Key"]=this.parameters.apiKey);let o=await IS.default.post(this.endpoint,JSON.stringify({id:"1",jsonrpc:"2.0",method:t,params:n}),{headers:a,timeout:this.parameters.timeout,adapter:this.parameters.adapter});if(o.status!==200||!o.data.ok)throw Error("Received error: "+JSON.stringify(o.data));let i=r.safeParse(o.data.result);if(i.success)return i.data;throw Error("Malformed response: "+i.error.format()._errors.join(", "))}}cs.HttpApi=$S;function WS(e){let t=[];for(let n of e)if(n.type==="int")t.push(["num",n.value.toString()]);else if(n.type==="cell")t.push(["tvm.Cell",n.cell.toBoc().toString("base64")]);else if(n.type==="slice")t.push(["tvm.Slice",n.cell.toBoc().toString("base64")]);else if(n.type==="builder")t.push(["tvm.Builder",n.cell.toBoc().toString("base64")]);else throw Error("Unsupported stack item type: "+n.type);return t}var nu={};Object.defineProperty(nu,"__esModule",{value:!0});nu.TonClient=void 0;const HS=cs,De=de;class VS{constructor(t){this.parameters={endpoint:t.endpoint},this.api=new HS.HttpApi(this.parameters.endpoint,{timeout:t.timeout,apiKey:t.apiKey,adapter:t.httpAdapter})}async getBalance(t){return(await this.getContractState(t)).balance}async runMethod(t,n,r=[]){let a=await this.api.callGetMethod(t,n,r);if(a.exit_code!==0)throw Error("Unable to execute get method. Got exit_code: "+a.exit_code);return{gas_used:a.gas_used,stack:bh(a.stack)}}async callGetMethod(t,n,r=[]){return this.runMethod(t,n,r)}async runMethodWithError(t,n,r=[]){let a=await this.api.callGetMethod(t,n,r);return{gas_used:a.gas_used,stack:bh(a.stack),exit_code:a.exit_code}}async callGetMethodWithError(t,n,r=[]){return this.runMethodWithError(t,n,r)}async getTransactions(t,n){let r=await this.api.getTransactions(t,n),a=[];for(let o of r)a.push((0,De.loadTransaction)(De.Cell.fromBoc(Buffer.from(o.data,"base64"))[0].beginParse()));return a}async getTransaction(t,n,r){let a=await this.api.getTransaction(t,n,r);return a?(0,De.loadTransaction)(De.Cell.fromBoc(Buffer.from(a.data,"base64"))[0].beginParse()):null}async tryLocateResultTx(t,n,r){let a=await this.api.tryLocateResultTx(t,n,r);return(0,De.loadTransaction)(De.Cell.fromBase64(a.data).beginParse())}async tryLocateSourceTx(t,n,r){let a=await this.api.tryLocateSourceTx(t,n,r);return(0,De.loadTransaction)(De.Cell.fromBase64(a.data).beginParse())}async getMasterchainInfo(){let t=await this.api.getMasterchainInfo();return{workchain:t.init.workchain,shard:t.last.shard,initSeqno:t.init.seqno,latestSeqno:t.last.seqno}}async getWorkchainShards(t){return(await this.api.getShards(t)).map(r=>({workchain:r.workchain,shard:r.shard,seqno:r.seqno}))}async getShardTransactions(t,n,r){let a=await this.api.getBlockTransactions(t,n,r);if(a.incomplete)throw Error("Unsupported");return a.transactions.map(o=>({account:De.Address.parseRaw(o.account),lt:o.lt,hash:o.hash}))}async sendMessage(t){const n=(0,De.beginCell)().store((0,De.storeMessage)(t)).endCell().toBoc();await this.api.sendBoc(n)}async sendFile(t){await this.api.sendBoc(t)}async estimateExternalMessageFee(t,n){return await this.api.estimateFee(t,{body:n.body,initCode:n.initCode,initData:n.initData,ignoreSignature:n.ignoreSignature})}async sendExternalMessage(t,n){if(await this.isContractDeployed(t.address)||!t.init){const r=(0,De.external)({to:t.address,body:n});await this.sendMessage(r)}else{const r=(0,De.external)({to:t.address,init:t.init,body:n});await this.sendMessage(r)}}async isContractDeployed(t){return(await this.getContractState(t)).state==="active"}async getContractState(t){let n=await this.api.getAddressInformation(t),r=BigInt(n.balance),a=n.state;return{balance:r,state:a,code:n.code!==""?Buffer.from(n.code,"base64"):null,data:n.data!==""?Buffer.from(n.data,"base64"):null,lastTransaction:n.last_transaction_id.lt!=="0"?{lt:n.last_transaction_id.lt,hash:n.last_transaction_id.hash}:null,blockId:{workchain:n.block_id.workchain,shard:n.block_id.shard,seqno:n.block_id.seqno},timestampt:n.sync_utime}}open(t){return(0,De.openContract)(t,n=>Lc(this,n.address,n.init))}provider(t,n){return Lc(this,t,n??null)}}nu.TonClient=VS;function Zr(e){const t=e["@type"];switch(t){case"tvm.list":case"tvm.tuple":return e.elements.map(Zr);case"tvm.cell":return De.Cell.fromBoc(Buffer.from(e.bytes,"base64"))[0];case"tvm.slice":return De.Cell.fromBoc(Buffer.from(e.bytes,"base64"))[0];case"tvm.stackEntryCell":return Zr(e.cell);case"tvm.stackEntrySlice":return Zr(e.slice);case"tvm.stackEntryTuple":return Zr(e.tuple);case"tvm.stackEntryList":return Zr(e.list);case"tvm.stackEntryNumber":return Zr(e.number);case"tvm.numberDecimal":return BigInt(e.number);default:throw Error("Unsupported item type: "+t)}}function JS(e){if(e[0]==="num"){let t=e[1];return t.startsWith("-")?{type:"int",value:-BigInt(t.slice(1))}:{type:"int",value:BigInt(t)}}else{if(e[0]==="null")return{type:"null"};if(e[0]==="cell")return{type:"cell",cell:De.Cell.fromBoc(Buffer.from(e[1].bytes,"base64"))[0]};if(e[0]==="slice")return{type:"slice",cell:De.Cell.fromBoc(Buffer.from(e[1].bytes,"base64"))[0]};if(e[0]==="builder")return{type:"builder",cell:De.Cell.fromBoc(Buffer.from(e[1].bytes,"base64"))[0]};if(e[0]==="tuple"||e[0]==="list")return e[1].elements.length===0?{type:"null"}:{type:"tuple",items:e[1].elements.map(Zr)};throw Error("Unsupported stack item type: "+e[0])}}function bh(e){let t=[];for(let n of e)t.push(JS(n));return new De.TupleReader(t)}function Lc(e,t,n){return{async getState(){let r=await e.getContractState(t),a=r.balance,o=r.lastTransaction?{lt:BigInt(r.lastTransaction.lt),hash:Buffer.from(r.lastTransaction.hash,"base64")}:null,i;if(r.state==="active")i={type:"active",code:r.code?r.code:null,data:r.data?r.data:null};else if(r.state==="uninitialized")i={type:"uninit"};else if(r.state==="frozen")i={type:"frozen",stateHash:Buffer.alloc(0)};else throw Error("Unsupported state");return{balance:a,last:o,state:i}},async get(r,a){return{stack:(await e.callGetMethod(t,r,a)).stack}},async external(r){let a=null;n&&!await e.isContractDeployed(t)&&(a=n);const o=(0,De.external)({to:t,init:a,body:r});let i=(0,De.beginCell)().store((0,De.storeMessage)(o)).endCell().toBoc();await e.sendFile(i)},async internal(r,a){let o=null;n&&!await e.isContractDeployed(t)&&(o=n);let i=!0;a.bounce!==null&&a.bounce!==void 0&&(i=a.bounce);let s;typeof a.value=="string"?s=(0,De.toNano)(a.value):s=a.value;let l=null;typeof a.body=="string"?l=(0,De.comment)(a.body):a.body&&(l=a.body),await r.send({to:t,value:s,bounce:i,sendMode:a.sendMode,init:o,body:l})},open(r){return(0,De.openContract)(r,a=>Lc(e,a.address,a.init??null))},getTransactions(r,a,o,i){return e.getTransactions(r,{limit:i??100,lt:a.toString(),hash:o.toString("base64"),inclusive:!0})}}}var ru={},au={};Object.defineProperty(au,"__esModule",{value:!0});au.toUrlSafe=void 0;function KS(e){for(;e.indexOf("/")>=0;)e=e.replace("/","_");for(;e.indexOf("+")>=0;)e=e.replace("+","-");for(;e.indexOf("=")>=0;)e=e.replace("=","");return e}au.toUrlSafe=KS;var Is=re&&re.__classPrivateFieldSet||function(e,t,n,r,a){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?a.call(e,n):a?a.value=n:t.set(e,n),n},pe=re&&re.__classPrivateFieldGet||function(e,t,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)},GS=re&&re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},vt,jt,_t,ht;Object.defineProperty(ru,"__esModule",{value:!0});ru.TonClient4=void 0;const QS=GS(Td),gt=de,tc=au,w=fs;class YS{constructor(t){vt.set(this,void 0),jt.set(this,void 0),_t.set(this,void 0),ht.set(this,void 0),Is(this,ht,QS.default.create(),"f"),Is(this,vt,t.endpoint,"f"),Is(this,jt,t.timeout||5e3,"f"),Is(this,_t,t.httpAdapter,"f"),t.requestInterceptor&&pe(this,ht,"f").interceptors.request.use(t.requestInterceptor)}async getLastBlock(){let t=await pe(this,ht,"f").get(pe(this,vt,"f")+"/block/latest",{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")}),n=ZS.safeParse(t.data);if(!n.success)throw Error("Mailformed response: "+n.error.format()._errors.join(", "));return n.data}async getBlock(t){let n=await pe(this,ht,"f").get(pe(this,vt,"f")+"/block/"+t,{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")}),r=wh.safeParse(n.data);if(!r.success)throw Error("Mailformed response");if(!r.data.exist)throw Error("Block is out of scope");return r.data.block}async getBlockByUtime(t){let n=await pe(this,ht,"f").get(pe(this,vt,"f")+"/block/utime/"+t,{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")}),r=wh.safeParse(n.data);if(!r.success)throw Error("Mailformed response");if(!r.data.exist)throw Error("Block is out of scope");return r.data.block}async getAccount(t,n){let r=await pe(this,ht,"f").get(pe(this,vt,"f")+"/block/"+t+"/"+n.toString({urlSafe:!0}),{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")}),a=XS.safeParse(r.data);if(!a.success)throw Error("Mailformed response");return a.data}async getAccountLite(t,n){let r=await pe(this,ht,"f").get(pe(this,vt,"f")+"/block/"+t+"/"+n.toString({urlSafe:!0})+"/lite",{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")}),a=eP.safeParse(r.data);if(!a.success)throw Error("Mailformed response");return a.data}async isContractDeployed(t,n){return(await this.getAccountLite(t,n)).account.state.type==="active"}async isAccountChanged(t,n,r){let a=await pe(this,ht,"f").get(pe(this,vt,"f")+"/block/"+t+"/"+n.toString({urlSafe:!0})+"/changed/"+r.toString(10),{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")}),o=tP.safeParse(a.data);if(!o.success)throw Error("Mailformed response");return o.data}async getAccountTransactions(t,n,r){let a=await pe(this,ht,"f").get(pe(this,vt,"f")+"/account/"+t.toString({urlSafe:!0})+"/tx/"+n.toString(10)+"/"+(0,tc.toUrlSafe)(r.toString("base64")),{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")}),o=oP.safeParse(a.data);if(!o.success)throw Error("Mailformed response");let i=o.data,s=[],l=gt.Cell.fromBoc(Buffer.from(i.boc,"base64"));for(let u=0;u0&&(r="/"+[...n].sort().join(","));let a=await pe(this,ht,"f").get(pe(this,vt,"f")+"/block/"+t+"/config"+r,{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")}),o=rP.safeParse(a.data);if(!o.success)throw Error("Mailformed response");return o.data}async runMethod(t,n,r,a){let o=a&&a.length>0?"/"+(0,tc.toUrlSafe)((0,gt.serializeTuple)(a).toBoc({idx:!1,crc32:!1}).toString("base64")):"",i=pe(this,vt,"f")+"/block/"+t+"/"+n.toString({urlSafe:!0})+"/run/"+encodeURIComponent(r)+o,s=await pe(this,ht,"f").get(i,{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")}),l=nP.safeParse(s.data);if(!l.success)throw Error("Mailformed response");let u=l.data.resultRaw?(0,gt.parseTuple)(gt.Cell.fromBoc(Buffer.from(l.data.resultRaw,"base64"))[0]):[];return{exitCode:l.data.exitCode,result:u,resultRaw:l.data.resultRaw,block:l.data.block,shardBlock:l.data.shardBlock,reader:new gt.TupleReader(u)}}async sendMessage(t){let n=await pe(this,ht,"f").post(pe(this,vt,"f")+"/send",{boc:t.toString("base64")},{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")});if(!aP.safeParse(n.data).success)throw Error("Mailformed response");return{status:n.data.status}}open(t){return(0,gt.openContract)(t,n=>Ni(this,null,n.address,n.init))}openAt(t,n){return(0,gt.openContract)(n,r=>Ni(this,t,r.address,r.init))}provider(t,n){return Ni(this,null,t,n??null)}providerAt(t,n,r){return Ni(this,t,n,r??null)}}ru.TonClient4=YS;vt=new WeakMap,jt=new WeakMap,_t=new WeakMap,ht=new WeakMap;function Ni(e,t,n,r){return{async getState(){let a=t;a===null&&(a=(await e.getLastBlock()).last.seqno);let o=await e.getAccount(a,n),i=o.account.last?{lt:BigInt(o.account.last.lt),hash:Buffer.from(o.account.last.hash,"base64")}:null,s;if(o.account.state.type==="active")s={type:"active",code:o.account.state.code?Buffer.from(o.account.state.code,"base64"):null,data:o.account.state.data?Buffer.from(o.account.state.data,"base64"):null};else if(o.account.state.type==="uninit")s={type:"uninit"};else if(o.account.state.type==="frozen")s={type:"frozen",stateHash:Buffer.from(o.account.state.stateHash,"base64")};else throw Error("Unsupported state");return{balance:BigInt(o.account.balance.coins),last:i,state:s}},async get(a,o){let i=t;i===null&&(i=(await e.getLastBlock()).last.seqno);let s=await e.runMethod(i,n,a,o);if(s.exitCode!==0&&s.exitCode!==1)throw Error("Exit code: "+s.exitCode);return{stack:new gt.TupleReader(s.result)}},async external(a){let o=await e.getLastBlock(),i=null;r&&(await e.getAccountLite(o.last.seqno,n)).account.state.type!=="active"&&(i=r);const s=(0,gt.external)({to:n,init:i,body:a});let l=(0,gt.beginCell)().store((0,gt.storeMessage)(s)).endCell().toBoc();await e.sendMessage(l)},async internal(a,o){let i=await e.getLastBlock(),s=null;r&&(await e.getAccountLite(i.last.seqno,n)).account.state.type!=="active"&&(s=r);let l=!0;o.bounce!==null&&o.bounce!==void 0&&(l=o.bounce);let u;typeof o.value=="string"?u=(0,gt.toNano)(o.value):u=o.value;let c=null;typeof o.body=="string"?c=(0,gt.comment)(o.body):o.body&&(c=o.body),await a.send({to:n,value:u,bounce:l,sendMode:o.sendMode,init:s,body:c})},open(a){return(0,gt.openContract)(a,o=>Ni(e,t,o.address,o.init??null))},async getTransactions(a,o,i,s){const l=typeof s=="number";if(l&&s<=0)return[];let u=[];do{const c=await e.getAccountTransactions(a,o,i),d=c[0].tx,[h,m]=[d.lt,d.hash()];if(u.length>0&&h===o&&m.equals(i)&&c.shift(),c.length===0)break;const f=c[c.length-1].tx,[j,T]=[f.lt,f.hash()];if(j===o&&T.equals(i))break;u.push(...c.map(E=>E.tx)),o=j,i=T}while(l&&u.lengthu===a))==null?void 0:s[0];if(i===void 0)throw new Error(`Can't deserialize walletId: unknown wallet version ${a}`);return{networkGlobalId:n,workChain:r,walletVersion:i,subwalletNumber:o}}Ia.loadWalletIdV5Beta=pP;function gP(e){return t=>{t.storeInt(e.networkGlobalId,32),t.storeInt(e.workChain,8),t.storeUint(Dy[e.walletVersion],8),t.storeUint(e.subwalletNumber,32)}}Ia.storeWalletIdV5Beta=gP;var _h;function Uy(){if(_h)return wi;_h=1,Object.defineProperty(wi,"__esModule",{value:!0}),wi.WalletContractV5Beta=void 0;const e=de,t=jn(),n=Ia;class r{static create(o){var s,l,u,c;const i={networkGlobalId:((s=o.walletId)==null?void 0:s.networkGlobalId)??-239,workChain:((l=o==null?void 0:o.walletId)==null?void 0:l.workChain)??0,subwalletNumber:((u=o==null?void 0:o.walletId)==null?void 0:u.subwalletNumber)??0,walletVersion:((c=o==null?void 0:o.walletId)==null?void 0:c.walletVersion)??"v5"};return new r(i,o.publicKey)}constructor(o,i){this.walletId=o,this.publicKey=i,this.walletId=o;let s=e.Cell.fromBoc(Buffer.from("te6cckEBAQEAIwAIQgLkzzsvTG1qYeoPK1RH0mZ4WyavNjfbLe7mvNGqgm80Eg3NjhE=","base64"))[0],l=(0,e.beginCell)().storeInt(0,33).store((0,n.storeWalletIdV5Beta)(this.walletId)).storeBuffer(this.publicKey,32).storeBit(0).endCell();this.init={code:s,data:l},this.address=(0,e.contractAddress)(this.walletId.workChain,{code:s,data:l})}async getBalance(o){return(await o.getState()).balance}async getSeqno(o){return(await o.getState()).state.type==="active"?(await o.get("seqno",[])).stack.readNumber():0}async getExtensions(o){return(await o.getState()).state.type==="active"?(await o.get("get_extensions",[])).stack.readCellOpt():null}async getExtensionsArray(o){const i=await this.getExtensions(o);if(!i)return[];const s=e.Dictionary.loadDirect(e.Dictionary.Keys.BigUint(256),e.Dictionary.Values.BigInt(8),i);return s.keys().map(l=>{const u=s.get(l),c=l^u+1n;return e.Address.parseRaw(`${u}:${c.toString(16).padStart(64,"0")}`)})}async getIsSecretKeyAuthEnabled(o){return(await o.get("get_is_signature_auth_allowed",[])).stack.readNumber()!==0}async send(o,i){await o.external(i)}async sendTransfer(o,i){const s=await this.createTransfer(i);await this.send(o,s)}async sendAddExtension(o,i){const s=await this.createAddExtension(i);await this.send(o,s)}async sendRemoveExtension(o,i){const s=await this.createRemoveExtension(i);await this.send(o,s)}async sendActionsBatch(o,i){const s=await this.createRequest(i);await this.send(o,s)}createActions(o){return o.messages.map(s=>({type:"sendMsg",mode:o.sendMode,outMsg:s}))}createTransfer(o){return this.createRequest({...o,actions:this.createActions({messages:o.messages,sendMode:o.sendMode})})}createAddExtension(o){return this.createRequest({...o,actions:[{type:"addExtension",address:o.extensionAddress}]})}createRemoveExtension(o){return this.createRequest({...o,actions:[{type:"removeExtension",address:o.extensionAddress}]})}createRequest(o){return o.authType==="extension"?(0,t.createWalletTransferV5Beta)(o):(0,t.createWalletTransferV5Beta)({...o,walletId:(0,n.storeWalletIdV5Beta)(this.walletId)})}sender(o,i){return{send:async s=>{let l=await this.getSeqno(o),u=this.createTransfer({seqno:l,secretKey:i,sendMode:s.sendMode??e.SendMode.PAY_GAS_SEPARATELY+e.SendMode.IGNORE_ERRORS,messages:[(0,e.internal)({to:s.to,value:s.value,init:s.init,body:s.body,bounce:s.bounce})]});await this.send(o,u)}}}}return wi.WalletContractV5Beta=r,r.OpCodes={auth_extension:1702392942,auth_signed_external:1936287598,auth_signed_internal:1936289396},wi}var Gt={},Oa={};Object.defineProperty(Oa,"__esModule",{value:!0});Oa.isOutActionBasic=Oa.isOutActionExtended=void 0;function Fy(e){return e.type==="setIsPublicKeyEnabled"||e.type==="addExtension"||e.type==="removeExtension"}Oa.isOutActionExtended=Fy;function yP(e){return!Fy(e)}Oa.isOutActionBasic=yP;Object.defineProperty(Gt,"__esModule",{value:!0});Gt.loadOutListExtendedV5Beta=Gt.storeOutListExtendedV5Beta=Gt.loadOutActionV5BetaExtended=Gt.storeOutActionExtendedV5Beta=void 0;const Js=de,Ch=Oa,Ly=550222170;function bP(e){return t=>{t.storeUint(Ly,32).storeUint(e.isEnabled?1:0,1)}}const qy=474012575;function wP(e){return t=>{t.storeUint(qy,32).storeAddress(e.address)}}const $y=1588524196;function kP(e){return t=>{t.storeUint($y,32).storeAddress(e.address)}}function Wy(e){switch(e.type){case"setIsPublicKeyEnabled":return bP(e);case"addExtension":return wP(e);case"removeExtension":return kP(e);default:throw new Error("Unknown action type"+(e==null?void 0:e.type))}}Gt.storeOutActionExtendedV5Beta=Wy;function Hy(e){const t=e.loadUint(32);switch(t){case Ly:return{type:"setIsPublicKeyEnabled",isEnabled:!!e.loadUint(1)};case qy:return{type:"addExtension",address:e.loadAddress()};case $y:return{type:"removeExtension",address:e.loadAddress()};default:throw new Error(`Unknown extended out action tag 0x${t.toString(16)}`)}}Gt.loadOutActionV5BetaExtended=Hy;function Vy(e){const[t,...n]=e;if(!t||!(0,Ch.isOutActionExtended)(t)){if(e.some(Ch.isOutActionExtended))throw new Error("Can't serialize actions list: all extended actions must be placed before out actions");return r=>{r.storeUint(0,1).storeRef((0,Js.beginCell)().store((0,Js.storeOutList)(e)).endCell())}}return r=>{r.storeUint(1,1).store(Wy(t)).storeRef((0,Js.beginCell)().store(Vy(n)).endCell())}}Gt.storeOutListExtendedV5Beta=Vy;function vP(e){const t=[];for(;e.loadUint(1);){const r=Hy(e);t.push(r),e=e.loadRef().beginParse()}const n=(0,Js.loadOutList)(e.loadRef().beginParse());if(n.some(r=>r.type==="setCode"))throw new Error("Can't deserialize actions list: only sendMsg actions are allowed for wallet v5");return t.concat(n)}Gt.loadOutListExtendedV5Beta=vP;var iu={};Object.defineProperty(iu,"__esModule",{value:!0});iu.signPayload=void 0;const jP=Wt();function _P(e,t,n){return"secretKey"in e?n((0,jP.sign)(t.endCell().hash(),e.secretKey),t):e.signer(t.endCell()).then(r=>n(r,t))}iu.signPayload=_P;var ki={},On={};Object.defineProperty(On,"__esModule",{value:!0});On.storeWalletIdV5R1=On.loadWalletIdV5R1=On.isWalletIdV5R1ClientContext=void 0;const no=de;function Jy(e){return typeof e!="number"}On.isWalletIdV5R1ClientContext=Jy;const Ky={v5r1:0};function CP(e,t){var i;const n=new no.BitReader(new no.BitString(typeof e=="bigint"?Buffer.from(e.toString(16),"hex"):e instanceof no.Slice?e.loadBuffer(4):e,0,32)).loadInt(32),r=BigInt(n)^BigInt(t),a=(0,no.beginCell)().storeInt(r,32).endCell().beginParse();if(a.loadUint(1)){const s=a.loadInt(8),l=a.loadUint(8),u=a.loadUint(15),c=(i=Object.entries(Ky).find(([d,h])=>h===l))==null?void 0:i[0];if(c===void 0)throw new Error(`Can't deserialize walletId: unknown wallet version ${l}`);return{networkGlobalId:t,context:{walletVersion:c,workChain:s,subwalletNumber:u}}}else{const s=a.loadUint(31);return{networkGlobalId:t,context:s}}}On.loadWalletIdV5R1=CP;function EP(e){return t=>{let n;return Jy(e.context)?n=(0,no.beginCell)().storeUint(1,1).storeInt(e.context.workChain,8).storeUint(Ky[e.context.walletVersion],8).storeUint(e.context.subwalletNumber,15).endCell().beginParse().loadInt(32):n=(0,no.beginCell)().storeUint(0,1).storeUint(e.context,31).endCell().beginParse().loadInt(32),t.storeInt(BigInt(e.networkGlobalId)^BigInt(n),32)}}On.storeWalletIdV5R1=EP;var Eh;function Gy(){if(Eh)return ki;Eh=1,Object.defineProperty(ki,"__esModule",{value:!0}),ki.WalletContractV5R1=void 0;const e=de,t=jn(),n=On;class r{static create(o){var s,l,u;let i=0;return"workChain"in o&&o.workChain!=null&&(i=o.workChain),(s=o.walletId)!=null&&s.context&&(0,n.isWalletIdV5R1ClientContext)(o.walletId.context)&&o.walletId.context.workChain!=null&&(i=o.walletId.context.workChain),new r(i,o.publicKey,{networkGlobalId:((l=o.walletId)==null?void 0:l.networkGlobalId)??-239,context:((u=o.walletId)==null?void 0:u.context)??{workChain:0,walletVersion:"v5r1",subwalletNumber:0}})}constructor(o,i,s){this.publicKey=i,this.walletId=s,this.walletId=s;let l=e.Cell.fromBoc(Buffer.from("b5ee9c7241021401000281000114ff00f4a413f4bcf2c80b01020120020d020148030402dcd020d749c120915b8f6320d70b1f2082106578746ebd21821073696e74bdb0925f03e082106578746eba8eb48020d72101d074d721fa4030fa44f828fa443058bd915be0ed44d0810141d721f4058307f40e6fa1319130e18040d721707fdb3ce03120d749810280b99130e070e2100f020120050c020120060902016e07080019adce76a2684020eb90eb85ffc00019af1df6a2684010eb90eb858fc00201480a0b0017b325fb51341c75c875c2c7e00011b262fb513435c280200019be5f0f6a2684080a0eb90fa02c0102f20e011e20d70b1f82107369676ebaf2e08a7f0f01e68ef0eda2edfb218308d722028308d723208020d721d31fd31fd31fed44d0d200d31f20d31fd3ffd70a000af90140ccf9109a28945f0adb31e1f2c087df02b35007b0f2d0845125baf2e0855036baf2e086f823bbf2d0882292f800de01a47fc8ca00cb1f01cf16c9ed542092f80fde70db3cd81003f6eda2edfb02f404216e926c218e4c0221d73930709421c700b38e2d01d72820761e436c20d749c008f2e09320d74ac002f2e09320d71d06c712c2005230b0f2d089d74cd7393001a4e86c128407bbf2e093d74ac000f2e093ed55e2d20001c000915be0ebd72c08142091709601d72c081c12e25210b1e30f20d74a111213009601fa4001fa44f828fa443058baf2e091ed44d0810141d718f405049d7fc8ca0040048307f453f2e08b8e14038307f45bf2e08c22d70a00216e01b3b0f2d090e2c85003cf1612f400c9ed54007230d72c08248e2d21f2e092d200ed44d0d2005113baf2d08f54503091319c01810140d721d70a00f2e08ee2c8ca0058cf16c9ed5493f2c08de20010935bdb31e1d74cd0b4d6c35e","hex"))[0],u=(0,e.beginCell)().storeUint(1,1).storeUint(0,32).store((0,n.storeWalletIdV5R1)(this.walletId)).storeBuffer(this.publicKey,32).storeBit(0).endCell();this.init={code:l,data:u},this.address=(0,e.contractAddress)(o,{code:l,data:u})}async getBalance(o){return(await o.getState()).balance}async getSeqno(o){return(await o.getState()).state.type==="active"?(await o.get("seqno",[])).stack.readNumber():0}async getExtensions(o){return(await o.getState()).state.type==="active"?(await o.get("get_extensions",[])).stack.readCellOpt():null}async getExtensionsArray(o){const i=await this.getExtensions(o);return i?e.Dictionary.loadDirect(e.Dictionary.Keys.BigUint(256),e.Dictionary.Values.BigInt(1),i).keys().map(l=>{const u=this.address.workChain;return e.Address.parseRaw(`${u}:${l.toString(16).padStart(64,"0")}`)}):[]}async getIsSecretKeyAuthEnabled(o){return(await o.get("is_signature_allowed",[])).stack.readBoolean()}async send(o,i){await o.external(i)}async sendTransfer(o,i){const s=await this.createTransfer(i);await this.send(o,s)}async sendAddExtension(o,i){const s=await this.createAddExtension(i);await this.send(o,s)}async sendRemoveExtension(o,i){const s=await this.createRemoveExtension(i);await this.send(o,s)}createActions(o){return o.messages.map(s=>({type:"sendMsg",mode:o.sendMode,outMsg:s}))}createTransfer(o){return this.createRequest({actions:this.createActions({messages:o.messages,sendMode:o.sendMode}),...o})}createAddExtension(o){return this.createRequest({actions:[{type:"addExtension",address:o.extensionAddress}],...o})}createRemoveExtension(o){return this.createRequest({actions:[{type:"removeExtension",address:o.extensionAddress}],...o})}createRequest(o){return o.authType==="extension"?(0,t.createWalletTransferV5R1)(o):(0,t.createWalletTransferV5R1)({...o,walletId:(0,n.storeWalletIdV5R1)(this.walletId)})}sender(o,i){return{send:async s=>{let l=await this.getSeqno(o),u=this.createTransfer({seqno:l,secretKey:i,sendMode:s.sendMode??e.SendMode.PAY_GAS_SEPARATELY+e.SendMode.IGNORE_ERRORS,messages:[(0,e.internal)({to:s.to,value:s.value,init:s.init,body:s.body,bounce:s.bounce})]});await this.send(o,u)}}}}return ki.WalletContractV5R1=r,r.OpCodes={auth_extension:1702392942,auth_signed_external:1936287598,auth_signed_internal:1936289396},ki}var bt={};Object.defineProperty(bt,"__esModule",{value:!0});bt.patchV5R1ActionsSendMode=bt.toSafeV5R1SendMode=bt.loadOutListExtendedV5R1=bt.storeOutListExtendedV5R1=bt.loadOutActionExtendedV5R1=bt.storeOutActionExtendedV5R1=void 0;const es=de,Ah=Oa,Qy=4;function AP(e){return t=>{t.storeUint(Qy,8).storeUint(e.isEnabled?1:0,1)}}const Yy=2;function SP(e){return t=>{t.storeUint(Yy,8).storeAddress(e.address)}}const Zy=3;function PP(e){return t=>{t.storeUint(Zy,8).storeAddress(e.address)}}function Bd(e){switch(e.type){case"setIsPublicKeyEnabled":return AP(e);case"addExtension":return SP(e);case"removeExtension":return PP(e);default:throw new Error("Unknown action type"+(e==null?void 0:e.type))}}bt.storeOutActionExtendedV5R1=Bd;function qc(e){const t=e.loadUint(8);switch(t){case Qy:return{type:"setIsPublicKeyEnabled",isEnabled:!!e.loadUint(1)};case Yy:return{type:"addExtension",address:e.loadAddress()};case Zy:return{type:"removeExtension",address:e.loadAddress()};default:throw new Error(`Unknown extended out action tag 0x${t.toString(16)}`)}}bt.loadOutActionExtendedV5R1=qc;function TP(e){const t=e.filter(Ah.isOutActionExtended),n=e.filter(Ah.isOutActionBasic);return r=>{const a=n.length?(0,es.beginCell)().store((0,es.storeOutList)(n.slice().reverse())):null;if(r.storeMaybeRef(a),t.length===0)r.storeUint(0,1);else{const[o,...i]=t;r.storeUint(1,1).store(Bd(o)),i.length>0&&r.storeRef(Xy(i))}}}bt.storeOutListExtendedV5R1=TP;function Xy(e){const[t,...n]=e;let r=(0,es.beginCell)().store(Bd(t));return n.length>0&&(r=r.storeRef(Xy(n))),r.endCell()}function BP(e){const t=[],n=e.loadMaybeRef();if(n){const r=(0,es.loadOutList)(n.beginParse());if(r.some(a=>a.type!=="sendMsg"))throw new Error("Can't deserialize actions list: only sendMsg actions are allowed for wallet v5r1");t.push(...r)}if(e.loadBoolean()){const r=qc(e);t.push(r)}for(;e.remainingRefs>0;){e=e.loadRef().beginParse();const r=qc(e);t.push(r)}return t}bt.loadOutListExtendedV5R1=BP;function eb(e,t){return t==="internal"||t==="extension"?e:e|es.SendMode.IGNORE_ERRORS}bt.toSafeV5R1SendMode=eb;function MP(e,t){return e.map(n=>n.type==="sendMsg"?{...n,mode:eb(n.mode,t)}:n)}bt.patchV5R1ActionsSendMode=MP;var Sh;function jn(){if(Sh)return ft;Sh=1,Object.defineProperty(ft,"__esModule",{value:!0}),ft.createWalletTransferV5R1=ft.createWalletTransferV5Beta=ft.createWalletTransferV4=ft.createWalletTransferV3=ft.createWalletTransferV2=ft.createWalletTransferV1=void 0;const e=de,t=Wt(),n=Uy(),r=Gt,a=iu,o=Gy(),i=bt;function s(f,j){return(0,e.beginCell)().storeBuffer(f).storeBuilder(j).endCell()}function l(f,j){return(0,e.beginCell)().storeBuilder(j).storeBuffer(f).endCell()}function u(f){let j=(0,e.beginCell)().storeUint(f.seqno,32);f.message&&(j.storeUint(f.sendMode,8),j.storeRef((0,e.beginCell)().store((0,e.storeMessageRelaxed)(f.message))));let T=(0,t.sign)(j.endCell().hash(),f.secretKey);return(0,e.beginCell)().storeBuffer(T).storeBuilder(j).endCell()}ft.createWalletTransferV1=u;function c(f){if(f.messages.length>4)throw Error("Maximum number of messages in a single transfer is 4");let j=(0,e.beginCell)().storeUint(f.seqno,32);if(f.seqno===0)for(let b=0;b<32;b++)j.storeBit(1);else j.storeUint(f.timeout||Math.floor(Date.now()/1e3)+60,32);for(let b of f.messages)j.storeUint(f.sendMode,8),j.storeRef((0,e.beginCell)().store((0,e.storeMessageRelaxed)(b)));let T=(0,t.sign)(j.endCell().hash(),f.secretKey);return(0,e.beginCell)().storeBuffer(T).storeBuilder(j).endCell()}ft.createWalletTransferV2=c;function d(f){if(f.messages.length>4)throw Error("Maximum number of messages in a single transfer is 4");let j=(0,e.beginCell)().storeUint(f.walletId,32);if(f.seqno===0)for(let T=0;T<32;T++)j.storeBit(1);else j.storeUint(f.timeout||Math.floor(Date.now()/1e3)+60,32);j.storeUint(f.seqno,32);for(let T of f.messages)j.storeUint(f.sendMode,8),j.storeRef((0,e.beginCell)().store((0,e.storeMessageRelaxed)(T)));return(0,a.signPayload)(f,j,s)}ft.createWalletTransferV3=d;function h(f){if(f.messages.length>4)throw Error("Maximum number of messages in a single transfer is 4");let j=(0,e.beginCell)().storeUint(f.walletId,32);if(f.seqno===0)for(let T=0;T<32;T++)j.storeBit(1);else j.storeUint(f.timeout||Math.floor(Date.now()/1e3)+60,32);j.storeUint(f.seqno,32),j.storeUint(0,8);for(let T of f.messages)j.storeUint(f.sendMode,8),j.storeRef((0,e.beginCell)().store((0,e.storeMessageRelaxed)(T)));return(0,a.signPayload)(f,j,s)}ft.createWalletTransferV4=h;function m(f){if(f.actions.length>255)throw Error("Maximum number of OutActions in a single request is 255");if(f.authType==="extension")return(0,e.beginCell)().storeUint(n.WalletContractV5Beta.OpCodes.auth_extension,32).store((0,r.storeOutListExtendedV5Beta)(f.actions)).endCell();const j=(0,e.beginCell)().storeUint(f.authType==="internal"?n.WalletContractV5Beta.OpCodes.auth_signed_internal:n.WalletContractV5Beta.OpCodes.auth_signed_external,32).store(f.walletId);if(f.seqno===0)for(let T=0;T<32;T++)j.storeBit(1);else j.storeUint(f.timeout||Math.floor(Date.now()/1e3)+60,32);return j.storeUint(f.seqno,32).store((0,r.storeOutListExtendedV5Beta)(f.actions)),(0,a.signPayload)(f,j,l)}ft.createWalletTransferV5Beta=m;function y(f){if(f.actions.length>255)throw Error("Maximum number of OutActions in a single request is 255");if(f={...f},f.authType==="extension")return(0,e.beginCell)().storeUint(o.WalletContractV5R1.OpCodes.auth_extension,32).storeUint(f.queryId??0,64).store((0,i.storeOutListExtendedV5R1)(f.actions)).endCell();f.actions=(0,i.patchV5R1ActionsSendMode)(f.actions,f.authType);const j=(0,e.beginCell)().storeUint(f.authType==="internal"?o.WalletContractV5R1.OpCodes.auth_signed_internal:o.WalletContractV5R1.OpCodes.auth_signed_external,32).store(f.walletId);if(f.seqno===0)for(let T=0;T<32;T++)j.storeBit(1);else j.storeUint(f.timeout||Math.floor(Date.now()/1e3)+60,32);return j.storeUint(f.seqno,32).store((0,i.storeOutListExtendedV5R1)(f.actions)),(0,a.signPayload)(f,j,l)}return ft.createWalletTransferV5R1=y,ft}Object.defineProperty(ou,"__esModule",{value:!0});ou.WalletContractV1R1=void 0;const Ga=de,xP=jn();class Md{static create(t){return new Md(t.workchain,t.publicKey)}constructor(t,n){this.workchain=t,this.publicKey=n;let r=Ga.Cell.fromBoc(Buffer.from("te6cckEBAQEARAAAhP8AIN2k8mCBAgDXGCDXCx/tRNDTH9P/0VESuvKhIvkBVBBE+RDyovgAAdMfMSDXSpbTB9QC+wDe0aTIyx/L/8ntVEH98Ik=","base64"))[0],a=(0,Ga.beginCell)().storeUint(0,32).storeBuffer(n).endCell();this.init={code:r,data:a},this.address=(0,Ga.contractAddress)(t,{code:r,data:a})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){let n=await t.getState();return n.state.type==="active"?Ga.Cell.fromBoc(n.state.data)[0].beginParse().loadUint(32):0}async send(t,n){await t.external(n)}async sendTransfer(t,n){let r=this.createTransfer(n);await this.send(t,r)}createTransfer(t){let n=Ga.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(n=t.sendMode),(0,xP.createWalletTransferV1)({seqno:t.seqno,sendMode:n,secretKey:t.secretKey,message:t.message})}sender(t,n){return{send:async r=>{let a=await this.getSeqno(t),o=this.createTransfer({seqno:a,secretKey:n,sendMode:r.sendMode,message:(0,Ga.internal)({to:r.to,value:r.value,init:r.init,body:r.body,bounce:r.bounce})});await this.send(t,o)}}}}ou.WalletContractV1R1=Md;var su={};Object.defineProperty(su,"__esModule",{value:!0});su.WalletContractV1R2=void 0;const vi=de,IP=jn();class xd{static create(t){return new xd(t.workchain,t.publicKey)}constructor(t,n){this.workchain=t,this.publicKey=n;let r=vi.Cell.fromBoc(Buffer.from("te6cckEBAQEAUwAAov8AIN0gggFMl7qXMO1E0NcLH+Ck8mCBAgDXGCDXCx/tRNDTH9P/0VESuvKhIvkBVBBE+RDyovgAAdMfMSDXSpbTB9QC+wDe0aTIyx/L/8ntVNDieG8=","base64"))[0],a=(0,vi.beginCell)().storeUint(0,32).storeBuffer(n).endCell();this.init={code:r,data:a},this.address=(0,vi.contractAddress)(t,{code:r,data:a})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,n){await t.external(n)}async sendTransfer(t,n){let r=this.createTransfer(n);await this.send(t,r)}createTransfer(t){let n=vi.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(n=t.sendMode),(0,IP.createWalletTransferV1)({seqno:t.seqno,sendMode:n,secretKey:t.secretKey,message:t.message})}sender(t,n){return{send:async r=>{let a=await this.getSeqno(t),o=this.createTransfer({seqno:a,secretKey:n,sendMode:r.sendMode,message:(0,vi.internal)({to:r.to,value:r.value,init:r.init,body:r.body,bounce:r.bounce})});await this.send(t,o)}}}}su.WalletContractV1R2=xd;var lu={};Object.defineProperty(lu,"__esModule",{value:!0});lu.WalletContractV1R3=void 0;const ji=de,OP=jn();class Id{static create(t){return new Id(t.workchain,t.publicKey)}constructor(t,n){this.workchain=t,this.publicKey=n;let r=ji.Cell.fromBoc(Buffer.from("te6cckEBAQEAXwAAuv8AIN0gggFMl7ohggEznLqxnHGw7UTQ0x/XC//jBOCk8mCBAgDXGCDXCx/tRNDTH9P/0VESuvKhIvkBVBBE+RDyovgAAdMfMSDXSpbTB9QC+wDe0aTIyx/L/8ntVLW4bkI=","base64"))[0],a=(0,ji.beginCell)().storeUint(0,32).storeBuffer(n).endCell();this.init={code:r,data:a},this.address=(0,ji.contractAddress)(t,{code:r,data:a})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,n){await t.external(n)}async sendTransfer(t,n){let r=this.createTransfer(n);await this.send(t,r)}createTransfer(t){let n=ji.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(n=t.sendMode),(0,OP.createWalletTransferV1)({seqno:t.seqno,sendMode:n,secretKey:t.secretKey,message:t.message})}sender(t,n){return{send:async r=>{let a=await this.getSeqno(t),o=this.createTransfer({seqno:a,secretKey:n,sendMode:r.sendMode,message:(0,ji.internal)({to:r.to,value:r.value,init:r.init,body:r.body,bounce:r.bounce})});await this.send(t,o)}}}}lu.WalletContractV1R3=Id;var uu={};Object.defineProperty(uu,"__esModule",{value:!0});uu.WalletContractV2R1=void 0;const _i=de,RP=jn();class Od{static create(t){return new Od(t.workchain,t.publicKey)}constructor(t,n){this.workchain=t,this.publicKey=n;let r=_i.Cell.fromBoc(Buffer.from("te6cckEBAQEAVwAAqv8AIN0gggFMl7qXMO1E0NcLH+Ck8mCDCNcYINMf0x8B+CO78mPtRNDTH9P/0VExuvKhA/kBVBBC+RDyovgAApMg10qW0wfUAvsA6NGkyMsfy//J7VShNwu2","base64"))[0],a=(0,_i.beginCell)().storeUint(0,32).storeBuffer(n).endCell();this.init={code:r,data:a},this.address=(0,_i.contractAddress)(t,{code:r,data:a})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,n){await t.external(n)}async sendTransfer(t,n){let r=this.createTransfer(n);await this.send(t,r)}createTransfer(t){let n=_i.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(n=t.sendMode),(0,RP.createWalletTransferV2)({seqno:t.seqno,sendMode:n,secretKey:t.secretKey,messages:t.messages,timeout:t.timeout})}sender(t,n){return{send:async r=>{let a=await this.getSeqno(t),o=this.createTransfer({seqno:a,secretKey:n,sendMode:r.sendMode,messages:[(0,_i.internal)({to:r.to,value:r.value,init:r.init,body:r.body,bounce:r.bounce})]});await this.send(t,o)}}}}uu.WalletContractV2R1=Od;var cu={};Object.defineProperty(cu,"__esModule",{value:!0});cu.WalletContractV2R2=void 0;const Ci=de,NP=jn();class Rd{static create(t){return new Rd(t.workchain,t.publicKey)}constructor(t,n){this.workchain=t,this.publicKey=n;let r=Ci.Cell.fromBoc(Buffer.from("te6cckEBAQEAYwAAwv8AIN0gggFMl7ohggEznLqxnHGw7UTQ0x/XC//jBOCk8mCDCNcYINMf0x8B+CO78mPtRNDTH9P/0VExuvKhA/kBVBBC+RDyovgAApMg10qW0wfUAvsA6NGkyMsfy//J7VQETNeh","base64"))[0],a=(0,Ci.beginCell)().storeUint(0,32).storeBuffer(n).endCell();this.init={code:r,data:a},this.address=(0,Ci.contractAddress)(t,{code:r,data:a})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,n){await t.external(n)}async sendTransfer(t,n){let r=this.createTransfer(n);await this.send(t,r)}createTransfer(t){let n=Ci.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(n=t.sendMode),(0,NP.createWalletTransferV2)({seqno:t.seqno,sendMode:n,secretKey:t.secretKey,messages:t.messages,timeout:t.timeout})}sender(t,n){return{send:async r=>{let a=await this.getSeqno(t),o=this.createTransfer({seqno:a,secretKey:n,sendMode:r.sendMode,messages:[(0,Ci.internal)({to:r.to,value:r.value,init:r.init,body:r.body,bounce:r.bounce})]});await this.send(t,o)}}}}cu.WalletContractV2R2=Rd;var du={};Object.defineProperty(du,"__esModule",{value:!0});du.WalletContractV3R1=void 0;const Ei=de,zP=jn();class Nd{static create(t){return new Nd(t.workchain,t.publicKey,t.walletId)}constructor(t,n,r){this.workchain=t,this.publicKey=n,r!=null?this.walletId=r:this.walletId=698983191+t;let a=Ei.Cell.fromBoc(Buffer.from("te6cckEBAQEAYgAAwP8AIN0gggFMl7qXMO1E0NcLH+Ck8mCDCNcYINMf0x/TH/gjE7vyY+1E0NMf0x/T/9FRMrryoVFEuvKiBPkBVBBV+RDyo/gAkyDXSpbTB9QC+wDo0QGkyMsfyx/L/8ntVD++buA=","base64"))[0],o=(0,Ei.beginCell)().storeUint(0,32).storeUint(this.walletId,32).storeBuffer(n).endCell();this.init={code:a,data:o},this.address=(0,Ei.contractAddress)(t,{code:a,data:o})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,n){await t.external(n)}async sendTransfer(t,n){let r=this.createTransfer(n);await this.send(t,r)}createTransfer(t){return(0,zP.createWalletTransferV3)({...t,sendMode:t.sendMode??Ei.SendMode.PAY_GAS_SEPARATELY,walletId:this.walletId})}sender(t,n){return{send:async r=>{let a=await this.getSeqno(t),o=this.createTransfer({seqno:a,secretKey:n,sendMode:r.sendMode,messages:[(0,Ei.internal)({to:r.to,value:r.value,init:r.init,body:r.body,bounce:r.bounce})]});await this.send(t,o)}}}}du.WalletContractV3R1=Nd;var fu={};Object.defineProperty(fu,"__esModule",{value:!0});fu.WalletContractV3R2=void 0;const Ai=de,DP=jn();class zd{static create(t){return new zd(t.workchain,t.publicKey,t.walletId)}constructor(t,n,r){this.workchain=t,this.publicKey=n,r!=null?this.walletId=r:this.walletId=698983191+t;let a=Ai.Cell.fromBoc(Buffer.from("te6cckEBAQEAcQAA3v8AIN0gggFMl7ohggEznLqxn3Gw7UTQ0x/THzHXC//jBOCk8mCDCNcYINMf0x/TH/gjE7vyY+1E0NMf0x/T/9FRMrryoVFEuvKiBPkBVBBV+RDyo/gAkyDXSpbTB9QC+wDo0QGkyMsfyx/L/8ntVBC9ba0=","base64"))[0],o=(0,Ai.beginCell)().storeUint(0,32).storeUint(this.walletId,32).storeBuffer(n).endCell();this.init={code:a,data:o},this.address=(0,Ai.contractAddress)(t,{code:a,data:o})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,n){await t.external(n)}async sendTransfer(t,n){let r=this.createTransfer(n);await this.send(t,r)}createTransfer(t){return(0,DP.createWalletTransferV3)({...t,sendMode:t.sendMode??Ai.SendMode.PAY_GAS_SEPARATELY,walletId:this.walletId})}sender(t,n){return{send:async r=>{let a=await this.getSeqno(t),o=this.createTransfer({seqno:a,secretKey:n,sendMode:r.sendMode,messages:[(0,Ai.internal)({to:r.to,value:r.value,init:r.init,body:r.body,bounce:r.bounce})]});await this.send(t,o)}}}}fu.WalletContractV3R2=zd;var hu={};Object.defineProperty(hu,"__esModule",{value:!0});hu.WalletContractV4=void 0;const Si=de,UP=jn();class Dd{static create(t){return new Dd(t.workchain,t.publicKey,t.walletId)}constructor(t,n,r){this.workchain=t,this.publicKey=n,r!=null?this.walletId=r:this.walletId=698983191+t;let a=Si.Cell.fromBoc(Buffer.from("te6ccgECFAEAAtQAART/APSkE/S88sgLAQIBIAIDAgFIBAUE+PKDCNcYINMf0x/THwL4I7vyZO1E0NMf0x/T//QE0VFDuvKhUVG68qIF+QFUEGT5EPKj+AAkpMjLH1JAyx9SMMv/UhD0AMntVPgPAdMHIcAAn2xRkyDXSpbTB9QC+wDoMOAhwAHjACHAAuMAAcADkTDjDQOkyMsfEssfy/8QERITAubQAdDTAyFxsJJfBOAi10nBIJJfBOAC0x8hghBwbHVnvSKCEGRzdHK9sJJfBeAD+kAwIPpEAcjKB8v/ydDtRNCBAUDXIfQEMFyBAQj0Cm+hMbOSXwfgBdM/yCWCEHBsdWe6kjgw4w0DghBkc3RyupJfBuMNBgcCASAICQB4AfoA9AQw+CdvIjBQCqEhvvLgUIIQcGx1Z4MesXCAGFAEywUmzxZY+gIZ9ADLaRfLH1Jgyz8gyYBA+wAGAIpQBIEBCPRZMO1E0IEBQNcgyAHPFvQAye1UAXKwjiOCEGRzdHKDHrFwgBhQBcsFUAPPFiP6AhPLassfyz/JgED7AJJfA+ICASAKCwBZvSQrb2omhAgKBrkPoCGEcNQICEekk30pkQzmkD6f+YN4EoAbeBAUiYcVnzGEAgFYDA0AEbjJftRNDXCx+AA9sp37UTQgQFA1yH0BDACyMoHy//J0AGBAQj0Cm+hMYAIBIA4PABmtznaiaEAga5Drhf/AABmvHfaiaEAQa5DrhY/AAG7SB/oA1NQi+QAFyMoHFcv/ydB3dIAYyMsFywIizxZQBfoCFMtrEszMyXP7AMhAFIEBCPRR8qcCAHCBAQjXGPoA0z/IVCBHgQEI9FHyp4IQbm90ZXB0gBjIywXLAlAGzxZQBPoCFMtqEssfyz/Jc/sAAgBsgQEI1xj6ANM/MFIkgQEI9Fnyp4IQZHN0cnB0gBjIywXLAlAFzxZQA/oCE8tqyx8Syz/Jc/sAAAr0AMntVA==","base64"))[0],o=(0,Si.beginCell)().storeUint(0,32).storeUint(this.walletId,32).storeBuffer(this.publicKey).storeBit(0).endCell();this.init={code:a,data:o},this.address=(0,Si.contractAddress)(t,{code:a,data:o})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,n){await t.external(n)}async sendTransfer(t,n){let r=this.createTransfer(n);await this.send(t,r)}createTransfer(t){return(0,UP.createWalletTransferV4)({...t,sendMode:t.sendMode??Si.SendMode.PAY_GAS_SEPARATELY,walletId:this.walletId})}sender(t,n){return{send:async r=>{let a=await this.getSeqno(t),o=this.createTransfer({seqno:a,secretKey:n,sendMode:r.sendMode,messages:[(0,Si.internal)({to:r.to,value:r.value,init:r.init,body:r.body,bounce:r.bounce})]});await this.send(t,o)}}}}hu.WalletContractV4=Dd;var tb={};(function(e){var t=re&&re.__createBinding||(Object.create?function(r,a,o,i){i===void 0&&(i=o);var s=Object.getOwnPropertyDescriptor(a,o);(!s||("get"in s?!a.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(r,i,s)}:function(r,a,o,i){i===void 0&&(i=o),r[i]=a[o]}),n=re&&re.__exportStar||function(r,a){for(var o in r)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&t(a,r,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(Uy(),e),n(Gt,e),n(Ia,e)})(tb);var nb={};(function(e){var t=re&&re.__createBinding||(Object.create?function(r,a,o,i){i===void 0&&(i=o);var s=Object.getOwnPropertyDescriptor(a,o);(!s||("get"in s?!a.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(r,i,s)}:function(r,a,o,i){i===void 0&&(i=o),r[i]=a[o]}),n=re&&re.__exportStar||function(r,a){for(var o in r)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&t(a,r,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(Gy(),e),n(bt,e),n(On,e)})(nb);var mu={};Object.defineProperty(mu,"__esModule",{value:!0});mu.JettonMaster=void 0;const FP=de;class Ud{static create(t){return new Ud(t)}constructor(t){this.address=t}async getWalletAddress(t,n){return(await t.get("get_wallet_address",[{type:"slice",cell:(0,FP.beginCell)().storeAddress(n).endCell()}])).stack.readAddress()}async getJettonData(t){let n=await t.get("get_jetton_data",[]),r=n.stack.readBigNumber(),a=n.stack.readBoolean(),o=n.stack.readAddress(),i=n.stack.readCell(),s=n.stack.readCell();return{totalSupply:r,mintable:a,adminAddress:o,content:i,walletCode:s}}}mu.JettonMaster=Ud;var pu={};Object.defineProperty(pu,"__esModule",{value:!0});pu.JettonWallet=void 0;let LP=class rb{static create(t){return new rb(t)}constructor(t){this.address=t}async getBalance(t){return(await t.getState()).state.type!=="active"?0n:(await t.get("get_wallet_data",[])).stack.readBigNumber()}};pu.JettonWallet=LP;var hs={};Object.defineProperty(hs,"__esModule",{value:!0});hs.MultisigOrder=void 0;const Ph=Wt(),Os=de;class dl{constructor(t){this.signatures={},this.payload=t}static fromCell(t){var i;let n=t.beginParse(),r=(i=n.loadMaybeRef())==null?void 0:i.beginParse();const a=n.asCell();let o=new dl(a);if(r){for(;r.remainingBits>0;){const s=r.loadBuffer(64),l=r.loadUint(8);o.signatures[l]=s,r.remainingRefs>0?r=r.loadRef().asSlice():r.skip(1)}r.endParse()}return o}static fromPayload(t){return new dl(t)}addSignature(t,n,r){const a=this.payload.hash();if(!(0,Ph.signVerify)(a,n,r.owners.get(t).slice(0,-1)))throw Error("invalid signature");this.signatures[t]=n}sign(t,n){const r=this.payload.hash();return this.signatures[t]=(0,Ph.sign)(r,n),r}unionSignatures(t){this.signatures=Object.assign({},this.signatures,t.signatures)}clearSignatures(){this.signatures={}}toCell(t){let n=(0,Os.beginCell)().storeBit(0);for(const r in this.signatures){const a=this.signatures[r];n=(0,Os.beginCell)().storeBit(1).storeRef((0,Os.beginCell)().storeBuffer(a).storeUint(parseInt(r),8).storeBuilder(n).endCell())}return(0,Os.beginCell)().storeUint(t,8).storeBuilder(n).storeBuilder(this.payload.asBuilder()).endCell()}}hs.MultisigOrder=dl;var gu={};Object.defineProperty(gu,"__esModule",{value:!0});gu.MultisigOrderBuilder=void 0;const Pi=de,qP=hs;class $P{constructor(t,n){this.messages=(0,Pi.beginCell)(),this.queryId=0n,this.walletId=t,this.queryOffset=n||7200}addMessage(t,n){if(this.messages.refs>=4)throw Error("only 4 refs are allowed");this.updateQueryId(),this.messages.storeUint(n,8),this.messages.storeRef((0,Pi.beginCell)().store((0,Pi.storeMessageRelaxed)(t)).endCell())}clearMessages(){this.messages=(0,Pi.beginCell)()}build(){return qP.MultisigOrder.fromPayload((0,Pi.beginCell)().storeUint(this.walletId,32).storeUint(this.queryId,64).storeBuilder(this.messages).endCell())}updateQueryId(){const t=BigInt(Math.floor(Date.now()/1e3+this.queryOffset));this.queryId=t<<32n}}gu.MultisigOrderBuilder=$P;var yu={};Object.defineProperty(yu,"__esModule",{value:!0});yu.MultisigWallet=void 0;const Th=Wt(),mt=de,WP=mt.Cell.fromBase64("te6ccgECKwEABBgAART/APSkE/S88sgLAQIBIAIDAgFIBAUE2vIgxwCOgzDbPOCDCNcYIPkBAdMH2zwiwAAToVNxePQOb6Hyn9s8VBq6+RDyoAb0BCD5AQHTH1EYuvKq0z9wUwHwCgHCCAGDCryx8mhTFYBA9A5voSCYDqQgwgryZw7f+COqH1NAufJhVCOjU04gIyEiAgLMBgcCASAMDQIBIAgJAgFmCgsAA9GEAiPymAvHoHN9CYbZ5S7Z4BPHohwhJQAtAKkItdJEqCTItdKlwLUAdAT8ArobBKAATwhbpEx4CBukTDgAdAg10rDAJrUAvALyFjPFszJ4HHXI8gBzxb0AMmACASAODwIBIBQVARW77ZbVA0cFUg2zyCoCAUgQEQIBIBITAXOxHXQgwjXGCD5AQHTB4IB1MTtQ9hTIHj0Dm+h8p/XC/9eMfkQ8qCuAfQEIW6TW3Ey4PkBWNs8AaQBgJwA9rtqA6ADoAPoCAXoCEfyAgPyA3XlP+AXkegAA54tkwAAXrhlXP8EA1WZ2oexAAgEgFhcCASAYGQFRtyVbZ4YmRmpGEAgegc30McJNhFpAADMaYeYuAFrgJhwLb+4cC3d0bhAjAYm1WZtnhqvgb+2xxsoicAgej430pBHEoFpAADHDhBACGuQkuuBk9kUWE5kAOeLKhACQCB6IYFImHFImHFImXEA2YlzNijAjAgEgGhsAF7UGtc4QQDVZnah7EAIBIBwdAgOZOB4fARGsGm2eL4G2CUAjABWt+UEAzJV2oewYQAENqTbPBVfBYCMAFa3f3CCAarM7UPYgAiDbPALyZfgAUENxQxPbPO1UIyoACtP/0wcwBKDbPC+uUyCw8mISsQKkJbNTHLmwJYEA4aojoCi8sPJpggGGoPgBBZcCERACPj4wjo0REB/bPEDXePRDEL0F4lQWW1Rz51YQU9zbPFRxClR6vCQlKCYAIO1E0NMf0wfTB9M/9AT0BNEAXgGOGjDSAAHyo9MH0wdQA9cBIPkBBfkBFbrypFAD4GwhIddKqgIi10m68qtwVCATAAwByMv/ywcE1ts87VT4D3AlblOJvrGYEG4QLVDHXwePGzBUJANQTds8UFWgRlAQSRA6SwlTuds8UFQWf+L4AAeDJaGOLCaAQPSWb6UglDBTA7neII4WODk5CNIAAZfTBzAW8AcFkTDifwgHBZJsMeKz5jAGKicoKQBgcI4pA9CDCNcY0wf0BDBTFnj0Dm+h8qXXC/9URUT5EPKmrlIgsVIDvRShI27mbCIyAH5SML6OIF8D+ACTItdKmALTB9QC+wAC6DJwyMoAQBSAQPRDAvAHjhdxyMsAFMsHEssHWM8BWM8WQBOAQPRDAeIBII6KEEUQNEMA2zztVJJfBuIqABzIyx/LB8sHyz/0APQAyQ==");class Fd{constructor(t,n,r,a,o){this.provider=null,this.owners=mt.Dictionary.empty(),this.workchain=n,this.walletId=r,this.k=a;for(let i=0;i0;){const o=r.readTuple(),i=o.readNumber(),s=o.readNumber();o.pop();const l=o.readNumber();a.push({id:i,unfreezeAt:s,stakeHeld:l})}return a}async getPastElections(t){const n=await t.get("past_elections",[]),r=new Ut.TupleReader(n.stack.readLispList()),a=[];for(;r.remaining>0;){const o=r.readTuple(),i=o.readNumber(),s=o.readNumber(),l=o.readNumber();o.pop();const u=o.readCell(),c=o.readBigNumber(),d=o.readBigNumber();let h=new Map;const m=u.beginParse().loadDictDirect(Ut.Dictionary.Keys.Buffer(32),HP);for(const[y,f]of m)h.set(BigInt("0x"+y.toString("hex")).toString(10),{address:f.address,weight:f.weight,stake:f.stake});a.push({id:i,unfreezeAt:s,stakeHeld:l,totalStake:c,bonuses:d,frozen:h})}return a}async getElectionEntities(t){const n=await t.getState();if(n.state.type!=="active")throw Error("Unexpected error");const a=Ut.Cell.fromBoc(n.state.data)[0].beginParse();if(!a.loadBit())return null;const o=a.loadRef().beginParse(),i=o.loadUint(32),s=o.loadUint(32),l=o.loadCoins(),u=o.loadCoins(),c=o.loadDict(Ut.Dictionary.Keys.Buffer(32),VP);let d=[];if(c)for(const[h,m]of c)d.push({pubkey:h,stake:m.stake,address:m.address,adnl:m.adnl});return{minStake:l,allStakes:u,endElectionsTime:s,startWorkTime:i,entities:d}}async getActiveElectionId(t){const r=(await t.get("active_election_id",[])).stack.readNumber();return r>0?r:null}async getComplaints(t,n){const r=new Ut.TupleBuilder;r.writeNumber(n);const a=await t.get("list_complaints",r.build());if(a.stack.peek().type==="null")return[];const o=new Ut.TupleReader(a.stack.readLispList()),i=[];for(;o.remaining>0;){const s=o.readTuple(),l=s.readBigNumber(),u=s.readTuple(),c=u.readTuple(),d=Buffer.from(c.readBigNumber().toString(16),"hex");c.readCell();const h=c.readNumber(),m=c.readNumber(),y=new Ut.Address(-1,Buffer.from(c.readBigNumber().toString(16),"hex")),f=c.readBigNumber(),j=c.readBigNumber(),T=c.readBigNumber(),E=[],b=new Ut.TupleReader(u.readLispList());for(;b.remaining>0;)E.push(b.readNumber());const g=u.readBigNumber(),A=u.readBigNumber();i.push({id:l,publicKey:d,createdAt:h,severity:m,paid:f,suggestedFine:j,suggestedFinePart:T,rewardAddress:y,votes:E,remainingWeight:A,vsetId:g})}return i}}bu.ElectorContract=Ld;var fe={};Object.defineProperty(fe,"__esModule",{value:!0});fe.parseFullConfig=fe.loadConfigParamsAsSlice=fe.loadConfigParamById=fe.parseVotingSetup=fe.parseProposalSetup=fe.configParse29=fe.configParse28=fe.configParseMsgPrices=fe.configParseGasLimitsPrices=fe.configParseBridge=fe.configParseValidatorSet=fe.configParse12=fe.configParseWorkchainDescriptor=fe.configParse40=fe.configParse8=fe.configParse18=fe.configParse17=fe.configParse16=fe.configParse15=fe.configParse13=fe.configParse5=fe.configParseMasterAddressRequired=fe.parseBridge=fe.parseValidatorSet=fe.configParseMasterAddress=void 0;const At=de;function zi(e){return e?new At.Address(-1,e.loadBuffer(32)):null}fe.configParseMasterAddress=zi;function Bh(e){if(e.loadUint(32)!==2390828938)throw Error("Invalid config");return e.loadBuffer(32)}const Mh={serialize(e,t){throw Error("not implemented")},parse(e){const t=e.loadUint(8);if(t===83)return{publicKey:Bh(e),weight:e.loadUintBig(64),adnlAddress:null};if(t===115)return{publicKey:Bh(e),weight:e.loadUintBig(64),adnlAddress:e.loadBuffer(32)};throw Error("Invalid config")}};function ab(e){const t=e.loadUint(8);if(t===17){const n=e.loadUint(32),r=e.loadUint(32),a=e.loadUint(16),o=e.loadUint(16),i=e.loadDictDirect(At.Dictionary.Keys.Uint(16),Mh);return{timeSince:n,timeUntil:r,total:a,main:o,totalWeight:null,list:i}}else if(t===18){const n=e.loadUint(32),r=e.loadUint(32),a=e.loadUint(16),o=e.loadUint(16),i=e.loadUintBig(64),s=e.loadDict(At.Dictionary.Keys.Uint(16),Mh);return{timeSince:n,timeUntil:r,total:a,main:o,totalWeight:i,list:s}}}fe.parseValidatorSet=ab;function ob(e){const t=new At.Address(-1,e.loadBuffer(32)),n=new At.Address(-1,e.loadBuffer(32)),r=e.loadDict(At.Dictionary.Keys.Buffer(32),At.Dictionary.Values.Buffer(32)),a=new Map;for(const[i,s]of r)a.set(new At.Address(-1,i).toString(),s);const o=e.loadBuffer(32);return{bridgeAddress:t,oracleMultisigAddress:n,oracles:a,externalChainAddress:o}}fe.parseBridge=ob;function $c(e){if(!e)throw Error("Invalid config");return zi(e)}fe.configParseMasterAddressRequired=$c;function ib(e){if(!e)throw Error("Invalid config");if(e.loadUint(8)===1){const n=e.loadBit()?new At.Address(-1,e.loadBuffer(32)):null,r=e.loadUint(32),a=e.loadUint(32);return{blackholeAddr:n,feeBurnNominator:r,feeBurnDenominator:a}}throw new Error("Invalid config")}fe.configParse5=ib;function JP(e){if(!e)throw Error("Invalid config");if(e.loadUint(8)===26){const n=e.loadCoins(),r=e.loadCoins(),a=e.loadCoins();return{deposit:n,bitPrice:r,cellPrice:a}}throw new Error("Invalid config")}fe.configParse13=JP;function sb(e){if(!e)throw Error("Invalid config");const t=e.loadUint(32),n=e.loadUint(32),r=e.loadUint(32),a=e.loadUint(32);return{validatorsElectedFor:t,electorsStartBefore:n,electorsEndBefore:r,stakeHeldFor:a}}fe.configParse15=sb;function lb(e){if(!e)throw Error("Invalid config");const t=e.loadUint(16),n=e.loadUint(16),r=e.loadUint(16);return{maxValidators:t,maxMainValidators:n,minValidators:r}}fe.configParse16=lb;function ub(e){if(!e)throw Error("Invalid config");const t=e.loadCoins(),n=e.loadCoins(),r=e.loadCoins(),a=e.loadUint(32);return{minStake:t,maxStake:n,minTotalStake:r,maxStakeFactor:a}}fe.configParse17=ub;const KP={serialize(e,t){throw Error("not implemented")},parse(e){if(e.loadUint(8)!==204)throw Error("Invalid config");const n=e.loadUint(32),r=e.loadUintBig(64),a=e.loadUintBig(64),o=e.loadUintBig(64),i=e.loadUintBig(64);return{utime_since:n,bit_price_ps:r,cell_price_ps:a,mc_bit_price_ps:o,mc_cell_price_ps:i}}};function cb(e){if(!e)throw Error("Invalid config");return e.loadDictDirect(At.Dictionary.Keys.Buffer(4),KP).values()}fe.configParse18=cb;function db(e){if(!e)return{version:0,capabilities:0n};const t=e.loadUint(32),n=e.loadUintBig(64);return{version:t,capabilities:n}}fe.configParse8=db;function fb(e){if(!e)return null;if(e.loadUint(8)!==1)throw Error("Invalid config");const n=e.loadCoins(),r=e.loadCoins(),a=e.loadUint(16),o=e.loadUint(16),i=e.loadUint(16),s=e.loadUint(16),l=e.loadUint(16),u=e.loadUint(16),c=e.loadUint(16),d=e.loadUint(16),h=e.loadUint(16);return{defaultFlatFine:n,defaultProportionaFine:r,severityFlatMult:a,severityProportionalMult:o,unfunishableInterval:i,longInterval:s,longFlatMult:l,longProportionalMult:u,mediumInterval:c,mediumFlatMult:d,mediumProportionalMult:h}}fe.configParse40=fb;function GP(e){if(e.loadUint(8)!==166)throw Error("Invalid config");const t=e.loadUint(32),n=e.loadUint(8),r=e.loadUint(8),a=e.loadUint(8),o=e.loadBit(),i=e.loadBit(),s=e.loadBit(),l=e.loadUint(13),u=e.loadBuffer(32),c=e.loadBuffer(32),d=e.loadUint(32);if(e.loadBit())throw Error("Invalid config");const h=e.loadUint(32),m=e.loadUintBig(64);return{enabledSince:t,actialMinSplit:n,min_split:r,max_split:a,basic:o,active:i,accept_msgs:s,flags:l,zerostateRootHash:u,zerostateFileHash:c,version:d,format:{vmVersion:h,vmMode:m}}}fe.configParseWorkchainDescriptor=GP;const QP={serialize(e,t){throw Error("not implemented")},parse(e){if(e.loadUint(8)!==166)throw Error("Invalid config");const t=e.loadUint(32),n=e.loadUint(8),r=e.loadUint(8),a=e.loadUint(8),o=e.loadBit(),i=e.loadBit(),s=e.loadBit(),l=e.loadUint(13),u=e.loadBuffer(32),c=e.loadBuffer(32),d=e.loadUint(32);if(e.loadBit())throw Error("Invalid config");const h=e.loadUint(32),m=e.loadUintBig(64);return{enabledSince:t,actialMinSplit:n,min_split:r,max_split:a,basic:o,active:i,accept_msgs:s,flags:l,zerostateRootHash:u,zerostateFileHash:c,version:d,format:{vmVersion:h,vmMode:m}}}};function hb(e){if(!e)throw Error("Invalid config");const t=e.loadDict(At.Dictionary.Keys.Uint(32),QP);if(t)return t;throw Error("No workchains exist")}fe.configParse12=hb;function Xr(e){return e?ab(e):null}fe.configParseValidatorSet=Xr;function Ks(e){return e?ob(e):null}fe.configParseBridge=Ks;function YP(e){const t=e.loadUint(8);if(t===222){const n=e.loadUintBig(64),r=e.loadUintBig(64),a=e.loadUintBig(64),o=e.loadUintBig(64),i=e.loadUintBig(64),s=e.loadUintBig(64),l=e.loadUintBig(64);return{gasPrice:n,gasLimit:r,specialGasLimit:a,gasCredit:o,blockGasLimit:i,freezeDueLimit:s,deleteDueLimit:l}}else if(t===221){const n=e.loadUintBig(64),r=e.loadUintBig(64),a=e.loadUintBig(64),o=e.loadUintBig(64),i=e.loadUintBig(64),s=e.loadUintBig(64);return{gasPrice:n,gasLimit:r,gasCredit:a,blockGasLimit:o,freezeDueLimit:i,deleteDueLimit:s}}else throw Error("Invalid config")}function Wc(e){if(!e)throw Error("Invalid config");if(e.loadUint(8)===209){const n=e.loadUintBig(64),r=e.loadUintBig(64),a=YP(e);return{flatLimit:n,flatGasPrice:r,other:a}}else throw Error("Invalid config")}fe.configParseGasLimitsPrices=Wc;function Hc(e){if(!e)throw new Error("Invalid config");if(e.loadUint(8)!==234)throw new Error("Invalid msg prices param");return{lumpPrice:e.loadUintBig(64),bitPrice:e.loadUintBig(64),cellPrice:e.loadUintBig(64),ihrPriceFactor:e.loadUint(32),firstFrac:e.loadUint(16),nextFrac:e.loadUint(16)}}fe.configParseMsgPrices=Hc;function mb(e){if(!e)throw new Error("Invalid config");const t=e.loadUint(8);if(t===193){const n=e.loadUint(32),r=e.loadUint(32),a=e.loadUint(32),o=e.loadUint(32);return{masterCatchainLifetime:n,shardCatchainLifetime:r,shardValidatorsLifetime:a,shardValidatorsCount:o}}if(t===194){const n=e.loadUint(7),r=e.loadBit(),a=e.loadUint(32),o=e.loadUint(32),i=e.loadUint(32),s=e.loadUint(32);return{flags:n,suffleMasterValidators:r,masterCatchainLifetime:a,shardCatchainLifetime:o,shardValidatorsLifetime:i,shardValidatorsCount:s}}throw new Error("Invalid config")}fe.configParse28=mb;function pb(e){if(!e)throw new Error("Invalid config");const t=e.loadUint(8);if(t===214){const n=e.loadUint(32),r=e.loadUint(32),a=e.loadUint(32),o=e.loadUint(32),i=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32);return{roundCandidates:n,nextCandidateDelay:r,consensusTimeout:a,fastAttempts:o,attemptDuration:i,catchainMaxDeps:s,maxBlockBytes:l,maxColaltedBytes:u}}else if(t===215){const n=e.loadUint(7),r=e.loadBit(),a=e.loadUint(8),o=e.loadUint(32),i=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32),c=e.loadUint(32),d=e.loadUint(32);return{flags:n,newCatchainIds:r,roundCandidates:a,nextCandidateDelay:o,consensusTimeout:i,fastAttempts:s,attemptDuration:l,catchainMaxDeps:u,maxBlockBytes:c,maxColaltedBytes:d}}else if(t===216){const n=e.loadUint(7),r=e.loadBit(),a=e.loadUint(8),o=e.loadUint(32),i=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32),c=e.loadUint(32),d=e.loadUint(32),h=e.loadUint(16);return{flags:n,newCatchainIds:r,roundCandidates:a,nextCandidateDelay:o,consensusTimeout:i,fastAttempts:s,attemptDuration:l,catchainMaxDeps:u,maxBlockBytes:c,maxColaltedBytes:d,protoVersion:h}}else if(t===217){const n=e.loadUint(7),r=e.loadBit(),a=e.loadUint(8),o=e.loadUint(32),i=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32),c=e.loadUint(32),d=e.loadUint(32),h=e.loadUint(16),m=e.loadUint(32);return{flags:n,newCatchainIds:r,roundCandidates:a,nextCandidateDelay:o,consensusTimeout:i,fastAttempts:s,attemptDuration:l,catchainMaxDeps:u,maxBlockBytes:c,maxColaltedBytes:d,protoVersion:h,catchainMaxBlocksCoeff:m}}throw new Error("Invalid config")}fe.configParse29=pb;function Vc(e){if(e.loadUint(8)!==54)throw new Error("Invalid config");const n=e.loadUint(8),r=e.loadUint(8),a=e.loadUint(8),o=e.loadUint(8),i=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32);return{minTotalRounds:n,maxTotalRounds:r,minWins:a,maxLoses:o,minStoreSec:i,maxStoreSec:s,bitPrice:l,cellPrice:u}}fe.parseProposalSetup=Vc;function gb(e){if(!e)throw new Error("Invalid config");if(e.loadUint(8)!==145)throw new Error("Invalid config");const n=Vc(e.loadRef().beginParse()),r=Vc(e.loadRef().beginParse());return{normalParams:n,criticalParams:r}}fe.parseVotingSetup=gb;function yb(e){return At.Cell.fromBase64(e).beginParse().loadDictDirect(At.Dictionary.Keys.Int(32),At.Dictionary.Values.Cell())}function ZP(e,t){return yb(e).get(t)}fe.loadConfigParamById=ZP;function XP(e){const t=yb(e),n=new Map;for(const[r,a]of t)n.set(r,a.beginParse());return n}fe.loadConfigParamsAsSlice=XP;function eT(e){return{configAddress:$c(e.get(0)),electorAddress:$c(e.get(1)),minterAddress:zi(e.get(2)),feeCollectorAddress:zi(e.get(3)),dnsRootAddress:zi(e.get(4)),burningConfig:ib(e.get(5)),globalVersion:db(e.get(8)),workchains:hb(e.get(12)),voting:gb(e.get(11)),validators:{...sb(e.get(15)),...lb(e.get(16)),...ub(e.get(17))},storagePrices:cb(e.get(18)),gasPrices:{masterchain:Wc(e.get(20)),workchain:Wc(e.get(21))},msgPrices:{masterchain:Hc(e.get(24)),workchain:Hc(e.get(25))},validatorSets:{prevValidators:Xr(e.get(32)),prevTempValidators:Xr(e.get(33)),currentValidators:Xr(e.get(34)),currentTempValidators:Xr(e.get(35)),nextValidators:Xr(e.get(36)),nextTempValidators:Xr(e.get(37))},validatorsPunish:fb(e.get(40)),bridges:{ethereum:Ks(e.get(71)),binance:Ks(e.get(72)),polygon:Ks(e.get(73))},catchain:mb(e.get(28)),consensus:pb(e.get(29))}}fe.parseFullConfig=eT;var Ft={};Object.defineProperty(Ft,"__esModule",{value:!0});Ft.computeMessageForwardFees=Ft.computeExternalMessageFees=Ft.computeGasPrices=Ft.computeFwdFees=Ft.computeStorageFees=void 0;const rc=de;function tT(e){const{lastPaid:t,now:n,storagePrices:r,storageStat:a,special:o,masterchain:i}=e;if(n<=t||r.length===0||n>16n)}Ft.computeGasPrices=nT;function rT(e,t){let n=fl(t);return n.bits-=t.bits.length,n.cells-=1,qd(e,BigInt(n.cells),BigInt(n.bits))}Ft.computeExternalMessageFees=rT;function aT(e,t){let n=(0,rc.loadMessageRelaxed)(t.beginParse()),r={bits:0,cells:0};if(n.init){const l=new rc.Cell().asBuilder();(0,rc.storeStateInit)(n.init)(l);const u=l.endCell();let c=fl(u);c.bits-=u.bits.length,c.cells-=1,r.bits+=c.bits,r.cells+=c.cells}let a=fl(n.body);a.bits-=n.body.bits.length,a.cells-=1,r.bits+=a.bits,r.cells+=a.cells;let o=qd(e,BigInt(r.cells),BigInt(r.bits)),i=o*BigInt(e.firstFrac)>>16n,s=o-i;return{fees:i,remaining:s}}Ft.computeMessageForwardFees=aT;function fl(e){let t=e.bits.length,n=1;for(let r of e.refs){let a=fl(r);n+=a.cells,t+=a.bits}return{bits:t,cells:n}}function bb(e){let t=e%65536n,n=e>>16n;return t!==0n&&(n+=1n),n}(function(e){var t=re&&re.__createBinding||(Object.create?function(J,q,Y,ee){ee===void 0&&(ee=Y);var ce=Object.getOwnPropertyDescriptor(q,Y);(!ce||("get"in ce?!q.__esModule:ce.writable||ce.configurable))&&(ce={enumerable:!0,get:function(){return q[Y]}}),Object.defineProperty(J,ee,ce)}:function(J,q,Y,ee){ee===void 0&&(ee=Y),J[ee]=q[Y]}),n=re&&re.__exportStar||function(J,q){for(var Y in J)Y!=="default"&&!Object.prototype.hasOwnProperty.call(q,Y)&&t(q,J,Y)};Object.defineProperty(e,"__esModule",{value:!0}),e.computeStorageFees=e.computeMessageForwardFees=e.computeGasPrices=e.computeFwdFees=e.computeExternalMessageFees=e.loadConfigParamsAsSlice=e.loadConfigParamById=e.parseFullConfig=e.parseVotingSetup=e.parseValidatorSet=e.parseProposalSetup=e.parseBridge=e.configParseWorkchainDescriptor=e.configParseValidatorSet=e.configParseMsgPrices=e.configParseMasterAddressRequired=e.configParseMasterAddress=e.configParseGasLimitsPrices=e.configParseBridge=e.configParse40=e.configParse29=e.configParse28=e.configParse18=e.configParse17=e.configParse16=e.configParse15=e.configParse13=e.configParse12=e.configParse8=e.configParse5=e.ElectorContract=e.MultisigWallet=e.MultisigOrderBuilder=e.MultisigOrder=e.JettonWallet=e.JettonMaster=e.WalletContractV5R1=e.WalletContractV5Beta=e.WalletContractV4=e.WalletContractV3R2=e.WalletContractV3R1=e.WalletContractV2R2=e.WalletContractV2R1=e.WalletContractV1R3=e.WalletContractV1R2=e.WalletContractV1R1=e.TonClient4=e.TonClient=e.HttpApi=void 0,n(de,e);var r=cs;Object.defineProperty(e,"HttpApi",{enumerable:!0,get:function(){return r.HttpApi}});var a=nu;Object.defineProperty(e,"TonClient",{enumerable:!0,get:function(){return a.TonClient}});var o=ru;Object.defineProperty(e,"TonClient4",{enumerable:!0,get:function(){return o.TonClient4}});var i=ou;Object.defineProperty(e,"WalletContractV1R1",{enumerable:!0,get:function(){return i.WalletContractV1R1}});var s=su;Object.defineProperty(e,"WalletContractV1R2",{enumerable:!0,get:function(){return s.WalletContractV1R2}});var l=lu;Object.defineProperty(e,"WalletContractV1R3",{enumerable:!0,get:function(){return l.WalletContractV1R3}});var u=uu;Object.defineProperty(e,"WalletContractV2R1",{enumerable:!0,get:function(){return u.WalletContractV2R1}});var c=cu;Object.defineProperty(e,"WalletContractV2R2",{enumerable:!0,get:function(){return c.WalletContractV2R2}});var d=du;Object.defineProperty(e,"WalletContractV3R1",{enumerable:!0,get:function(){return d.WalletContractV3R1}});var h=fu;Object.defineProperty(e,"WalletContractV3R2",{enumerable:!0,get:function(){return h.WalletContractV3R2}});var m=hu;Object.defineProperty(e,"WalletContractV4",{enumerable:!0,get:function(){return m.WalletContractV4}});var y=tb;Object.defineProperty(e,"WalletContractV5Beta",{enumerable:!0,get:function(){return y.WalletContractV5Beta}});var f=nb;Object.defineProperty(e,"WalletContractV5R1",{enumerable:!0,get:function(){return f.WalletContractV5R1}});var j=mu;Object.defineProperty(e,"JettonMaster",{enumerable:!0,get:function(){return j.JettonMaster}});var T=pu;Object.defineProperty(e,"JettonWallet",{enumerable:!0,get:function(){return T.JettonWallet}});var E=hs;Object.defineProperty(e,"MultisigOrder",{enumerable:!0,get:function(){return E.MultisigOrder}});var b=gu;Object.defineProperty(e,"MultisigOrderBuilder",{enumerable:!0,get:function(){return b.MultisigOrderBuilder}});var g=yu;Object.defineProperty(e,"MultisigWallet",{enumerable:!0,get:function(){return g.MultisigWallet}});var A=bu;Object.defineProperty(e,"ElectorContract",{enumerable:!0,get:function(){return A.ElectorContract}});var _=fe;Object.defineProperty(e,"configParse5",{enumerable:!0,get:function(){return _.configParse5}}),Object.defineProperty(e,"configParse8",{enumerable:!0,get:function(){return _.configParse8}}),Object.defineProperty(e,"configParse12",{enumerable:!0,get:function(){return _.configParse12}}),Object.defineProperty(e,"configParse13",{enumerable:!0,get:function(){return _.configParse13}}),Object.defineProperty(e,"configParse15",{enumerable:!0,get:function(){return _.configParse15}}),Object.defineProperty(e,"configParse16",{enumerable:!0,get:function(){return _.configParse16}}),Object.defineProperty(e,"configParse17",{enumerable:!0,get:function(){return _.configParse17}}),Object.defineProperty(e,"configParse18",{enumerable:!0,get:function(){return _.configParse18}}),Object.defineProperty(e,"configParse28",{enumerable:!0,get:function(){return _.configParse28}}),Object.defineProperty(e,"configParse29",{enumerable:!0,get:function(){return _.configParse29}}),Object.defineProperty(e,"configParse40",{enumerable:!0,get:function(){return _.configParse40}}),Object.defineProperty(e,"configParseBridge",{enumerable:!0,get:function(){return _.configParseBridge}}),Object.defineProperty(e,"configParseGasLimitsPrices",{enumerable:!0,get:function(){return _.configParseGasLimitsPrices}}),Object.defineProperty(e,"configParseMasterAddress",{enumerable:!0,get:function(){return _.configParseMasterAddress}}),Object.defineProperty(e,"configParseMasterAddressRequired",{enumerable:!0,get:function(){return _.configParseMasterAddressRequired}}),Object.defineProperty(e,"configParseMsgPrices",{enumerable:!0,get:function(){return _.configParseMsgPrices}}),Object.defineProperty(e,"configParseValidatorSet",{enumerable:!0,get:function(){return _.configParseValidatorSet}}),Object.defineProperty(e,"configParseWorkchainDescriptor",{enumerable:!0,get:function(){return _.configParseWorkchainDescriptor}}),Object.defineProperty(e,"parseBridge",{enumerable:!0,get:function(){return _.parseBridge}}),Object.defineProperty(e,"parseProposalSetup",{enumerable:!0,get:function(){return _.parseProposalSetup}}),Object.defineProperty(e,"parseValidatorSet",{enumerable:!0,get:function(){return _.parseValidatorSet}}),Object.defineProperty(e,"parseVotingSetup",{enumerable:!0,get:function(){return _.parseVotingSetup}}),Object.defineProperty(e,"parseFullConfig",{enumerable:!0,get:function(){return _.parseFullConfig}}),Object.defineProperty(e,"loadConfigParamById",{enumerable:!0,get:function(){return _.loadConfigParamById}}),Object.defineProperty(e,"loadConfigParamsAsSlice",{enumerable:!0,get:function(){return _.loadConfigParamsAsSlice}});var x=Ft;Object.defineProperty(e,"computeExternalMessageFees",{enumerable:!0,get:function(){return x.computeExternalMessageFees}}),Object.defineProperty(e,"computeFwdFees",{enumerable:!0,get:function(){return x.computeFwdFees}}),Object.defineProperty(e,"computeGasPrices",{enumerable:!0,get:function(){return x.computeGasPrices}}),Object.defineProperty(e,"computeMessageForwardFees",{enumerable:!0,get:function(){return x.computeMessageForwardFees}}),Object.defineProperty(e,"computeStorageFees",{enumerable:!0,get:function(){return x.computeStorageFees}})})(Ue);class wu{constructor(t){je(this,"client");this.client=t}static create(t){return t===qi.MAINNET&&(t=new Ue.TonClient4({endpoint:"https://mainnet-v4.tonhubapi.com"})),t===qi.TESTNET&&(t=new Ue.TonClient4({endpoint:"https://testnet-v4.tonhubapi.com"})),new wu(t)}async getWalletPublicKey(t){const n=await this.client.getLastBlock(),r=await this.client.runMethod(n.last.seqno,Ue.Address.parse(t),"get_public_key",[]);return Xe.Buffer.from(r.reader.readBigNumber().toString(16).padStart(64,"0"),"hex")}async getAccountInfo(t){const n=await this.client.getLastBlock();return await this.client.getAccount(n.last.seqno,Ue.Address.parse(t))}}var xh=Wt();class oT{static create(t){const n=Ue.WalletContractV4.create(t),{data:r}=n.init,a=Ue.Cell.fromBoc(Xe.Buffer.from("B5EE9C72410215010002F5000114FF00F4A413F4BCF2C80B010201200203020148040504F8F28308D71820D31FD31FD31F02F823BBF263ED44D0D31FD31FD3FFF404D15143BAF2A15151BAF2A205F901541064F910F2A3F80024A4C8CB1F5240CB1F5230CBFF5210F400C9ED54F80F01D30721C0009F6C519320D74A96D307D402FB00E830E021C001E30021C002E30001C0039130E30D03A4C8CB1F12CB1FCBFF1112131403EED001D0D3030171B0915BE021D749C120915BE001D31F218210706C7567BD228210626C6E63BDB022821064737472BDB0925F03E002FA403020FA4401C8CA07CBFFC9D0ED44D0810140D721F404305C810108F40A6FA131B3925F05E004D33FC8258210706C7567BA9131E30D248210626C6E63BAE30004060708020120090A005001FA00F404308210706C7567831EB17080185005CB0527CF165003FA02F40012CB69CB1F5210CB3F0052F8276F228210626C6E63831EB17080185005CB0527CF1624FA0214CB6A13CB1F5230CB3F01FA02F4000092821064737472BA8E3504810108F45930ED44D0810140D720C801CF16F400C9ED54821064737472831EB17080185004CB0558CF1622FA0212CB6ACB1FCB3F9410345F04E2C98040FB000201200B0C0059BD242B6F6A2684080A06B90FA0218470D4080847A4937D29910CE6903E9FF9837812801B7810148987159F31840201580D0E0011B8C97ED44D0D70B1F8003DB29DFB513420405035C87D010C00B23281F2FFF274006040423D029BE84C600201200F100019ADCE76A26840206B90EB85FFC00019AF1DF6A26840106B90EB858FC0006ED207FA00D4D422F90005C8CA0715CBFFC9D077748018C8CB05CB0222CF165005FA0214CB6B12CCCCC971FB00C84014810108F451F2A702006C810108D718C8542025810108F451F2A782106E6F746570748018C8CB05CB025004CF16821005F5E100FA0213CB6A12CB1FC971FB00020072810108D718305202810108F459F2A7F82582106473747270748018C8CB05CB025005CF16821005F5E100FA0214CB6A13CB1F12CB3FC973FB00000AF400C9ED5446A9F34F","hex"))[0];return n.init={data:r,code:a},n.address=Ue.contractAddress(t.workchain,n.init),n}}const iT=[{contract:Ue.WalletContractV1R1,loadData:ac},{contract:Ue.WalletContractV1R2,loadData:ac},{contract:Ue.WalletContractV1R3,loadData:ac},{contract:Ue.WalletContractV2R1,loadData:Ih},{contract:Ue.WalletContractV2R2,loadData:Ih},{contract:Ue.WalletContractV3R1,loadData:Oh},{contract:Ue.WalletContractV3R2,loadData:Oh},{contract:oT,loadData:Rh},{contract:Ue.WalletContractV4,loadData:Rh},{contract:Ue.WalletContractV5Beta,loadData:sT},{contract:Ue.WalletContractV5R1,loadData:lT}].map(({contract:e,loadData:t})=>({contract:e,loadData:t,wallet:e.create({workchain:0,publicKey:Xe.Buffer.alloc(32)})}));function ac(e){const t=e.loadUint(32),n=e.loadBuffer(32);return{seqno:t,publicKey:n}}function Ih(e){const t=e.loadUint(32),n=e.loadBuffer(32);return{seqno:t,publicKey:n}}function Oh(e){const t=e.loadUint(32),n=e.loadUint(32),r=e.loadBuffer(32);return{seqno:t,publicKey:r,walletId:n}}function Rh(e){const t=e.loadUint(32),n=e.loadUint(32),r=e.loadBuffer(32),a=e.loadMaybeRef();return{seqno:t,publicKey:r,walletId:n,plugins:a}}function sT(e){const t=e.loadBoolean(),n=e.loadUint(32),r=e.loadUintBig(80),a=e.loadBuffer(32),o=e.loadMaybeRef();return{isSignatureAuthAllowed:t,seqno:n,publicKey:a,walletId:r,plugins:o}}function lT(e){const t=e.loadBoolean(),n=e.loadUint(32),r=e.loadUint(32),a=e.loadBuffer(32),o=e.loadMaybeRef();return{isSignatureAuthAllowed:t,seqno:n,publicKey:a,walletId:r,plugins:o}}function uT(e){if(!e.code||!e.data)return null;for(const{wallet:t,loadData:n}of iT)try{if(t.init.code.equals(e.code))return n(e.data.beginParse()).publicKey}catch{}return null}const cT="ton-proof-item-v2/",dT="ton-connect",fT=["ton-connect.github.io","localhost:5173"],hT=15*60;class wb{generatePayload(){return Xe.Buffer.from(Gs.randomBytes(32)).toString("hex")}async checkProof(t,n){try{const r=Ue.loadStateInit(Ue.Cell.fromBase64(t.proof.state_init).beginParse());let a=uT(r)??await n(t.address);if(!a)return!1;const o=Xe.Buffer.from(t.public_key,"hex");if(!a.equals(o))return!1;const i=Ue.Address.parse(t.address),s=Ue.contractAddress(i.workChain,r);if(!s.equals(i)||!fT.includes(t.proof.domain.value)||Math.floor(Date.now()/1e3)-hT>t.proof.timestamp)return!1;const u={workchain:s.workChain,address:s.hash,domain:{lengthBytes:t.proof.domain.lengthBytes,value:t.proof.domain.value},signature:Xe.Buffer.from(t.proof.signature,"base64"),payload:t.proof.payload,stateInit:t.proof.state_init,timestamp:t.proof.timestamp},c=Xe.Buffer.alloc(4);c.writeUInt32BE(u.workchain,0);const d=Xe.Buffer.alloc(8);d.writeBigUInt64LE(BigInt(u.timestamp),0);const h=Xe.Buffer.alloc(4);h.writeUInt32LE(u.domain.lengthBytes,0);const m=Xe.Buffer.concat([Xe.Buffer.from(cT),c,u.address,h,Xe.Buffer.from(u.domain.value),d,Xe.Buffer.from(u.payload)]),y=Xe.Buffer.from(await xh.sha256(m)),f=Xe.Buffer.concat([Xe.Buffer.from([255,255]),Xe.Buffer.from(dT),y]),j=Xe.Buffer.from(await xh.sha256(f));return Gs.sign.detached.verify(j,u.signature,a)}catch{return!1}}}function ms(e){return cn.json(e,{status:200,statusText:"OK"})}function vr(e){return cn.json(e,{status:400,statusText:"Bad Request"})}function hl(e){return cn.json(e,{status:401,statusText:"Unauthorized"})}const ku=crypto,kb=e=>e instanceof CryptoKey,hn=new TextEncoder,Ra=new TextDecoder;function vb(...e){const t=e.reduce((a,{length:o})=>a+o,0),n=new Uint8Array(t);let r=0;for(const a of e)n.set(a,r),r+=a.length;return n}const mT=e=>{let t=e;typeof t=="string"&&(t=hn.encode(t));const n=32768,r=[];for(let a=0;amT(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),pT=e=>{const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r{let t=e;t instanceof Uint8Array&&(t=Ra.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return pT(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}};class wt extends Error{constructor(t,n){var r;super(t,n),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,(r=Error.captureStackTrace)==null||r.call(Error,this,this.constructor)}}wt.code="ERR_JOSE_GENERIC";class Vt extends wt{constructor(t,n,r="unspecified",a="unspecified"){super(t,{cause:{claim:r,reason:a,payload:n}}),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=r,this.reason=a,this.payload=n}}Vt.code="ERR_JWT_CLAIM_VALIDATION_FAILED";class Jc extends wt{constructor(t,n,r="unspecified",a="unspecified"){super(t,{cause:{claim:r,reason:a,payload:n}}),this.code="ERR_JWT_EXPIRED",this.claim=r,this.reason=a,this.payload=n}}Jc.code="ERR_JWT_EXPIRED";class jb extends wt{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}}jb.code="ERR_JOSE_ALG_NOT_ALLOWED";class Bn extends wt{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}}Bn.code="ERR_JOSE_NOT_SUPPORTED";class gT extends wt{constructor(t="decryption operation failed",n){super(t,n),this.code="ERR_JWE_DECRYPTION_FAILED"}}gT.code="ERR_JWE_DECRYPTION_FAILED";class yT extends wt{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}}yT.code="ERR_JWE_INVALID";class $e extends wt{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}}$e.code="ERR_JWS_INVALID";class Jt extends wt{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}}Jt.code="ERR_JWT_INVALID";class bT extends wt{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}}bT.code="ERR_JWK_INVALID";class wT extends wt{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}}wT.code="ERR_JWKS_INVALID";class kT extends wt{constructor(t="no applicable key found in the JSON Web Key Set",n){super(t,n),this.code="ERR_JWKS_NO_MATCHING_KEY"}}kT.code="ERR_JWKS_NO_MATCHING_KEY";class vT extends wt{constructor(t="multiple matching keys found in the JSON Web Key Set",n){super(t,n),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS"}}vT.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";class jT extends wt{constructor(t="request timed out",n){super(t,n),this.code="ERR_JWKS_TIMEOUT"}}jT.code="ERR_JWKS_TIMEOUT";class _b extends wt{constructor(t="signature verification failed",n){super(t,n),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}_b.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";function An(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function Rs(e,t){return e.name===t}function ic(e){return parseInt(e.name.slice(4),10)}function _T(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function CT(e,t){if(t.length&&!t.some(n=>e.usages.includes(n))){let n="CryptoKey does not support this operation, its usages must include ";if(t.length>2){const r=t.pop();n+=`one of ${t.join(", ")}, or ${r}.`}else t.length===2?n+=`one of ${t[0]} or ${t[1]}.`:n+=`${t[0]}.`;throw new TypeError(n)}}function ET(e,t,...n){switch(t){case"HS256":case"HS384":case"HS512":{if(!Rs(e.algorithm,"HMAC"))throw An("HMAC");const r=parseInt(t.slice(2),10);if(ic(e.algorithm.hash)!==r)throw An(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!Rs(e.algorithm,"RSASSA-PKCS1-v1_5"))throw An("RSASSA-PKCS1-v1_5");const r=parseInt(t.slice(2),10);if(ic(e.algorithm.hash)!==r)throw An(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!Rs(e.algorithm,"RSA-PSS"))throw An("RSA-PSS");const r=parseInt(t.slice(2),10);if(ic(e.algorithm.hash)!==r)throw An(`SHA-${r}`,"algorithm.hash");break}case"EdDSA":{if(e.algorithm.name!=="Ed25519"&&e.algorithm.name!=="Ed448")throw An("Ed25519 or Ed448");break}case"ES256":case"ES384":case"ES512":{if(!Rs(e.algorithm,"ECDSA"))throw An("ECDSA");const r=_T(t);if(e.algorithm.namedCurve!==r)throw An(r,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}CT(e,n)}function Cb(e,t,...n){var r;if(n=n.filter(Boolean),n.length>2){const a=n.pop();e+=`one of type ${n.join(", ")}, or ${a}.`}else n.length===2?e+=`one of type ${n[0]} or ${n[1]}.`:e+=`of type ${n[0]}.`;return t==null?e+=` Received ${t}`:typeof t=="function"&&t.name?e+=` Received function ${t.name}`:typeof t=="object"&&t!=null&&(r=t.constructor)!=null&&r.name&&(e+=` Received an instance of ${t.constructor.name}`),e}const Nh=(e,...t)=>Cb("Key must be ",e,...t);function Eb(e,t,...n){return Cb(`Key for the ${e} algorithm must be `,t,...n)}const Ab=e=>kb(e)?!0:(e==null?void 0:e[Symbol.toStringTag])==="KeyObject",ml=["CryptoKey"],AT=(...e)=>{const t=e.filter(Boolean);if(t.length===0||t.length===1)return!0;let n;for(const r of t){const a=Object.keys(r);if(!n||n.size===0){n=new Set(a);continue}for(const o of a){if(n.has(o))return!1;n.add(o)}}return!0},Sb=AT;function ST(e){return typeof e=="object"&&e!==null}function Na(e){if(!ST(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}const Pb=(e,t)=>{if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:n}=t.algorithm;if(typeof n!="number"||n<2048)throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}};function Jo(e){return Na(e)&&typeof e.kty=="string"}function PT(e){return e.kty!=="oct"&&typeof e.d=="string"}function TT(e){return e.kty!=="oct"&&typeof e.d>"u"}function BT(e){return Jo(e)&&e.kty==="oct"&&typeof e.k=="string"}function MT(e){let t,n;switch(e.kty){case"RSA":{switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},n=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},n=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},n=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new Bn('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},n=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},n=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new Bn('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(e.alg){case"EdDSA":t={name:e.crv},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new Bn('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new Bn('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}const xT=async e=>{if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:t,keyUsages:n}=MT(e),r=[t,e.ext??!1,e.key_ops??n],a={...e};return delete a.alg,delete a.use,ku.subtle.importKey("jwk",a,...r)},Tb=xT,Bb=e=>jr(e);let Qa,Ya;const Mb=e=>(e==null?void 0:e[Symbol.toStringTag])==="KeyObject",pl=async(e,t,n,r,a=!1)=>{let o=e.get(t);if(o!=null&&o[r])return o[r];const i=await Tb({...n,alg:r});return a&&Object.freeze(t),o?o[r]=i:e.set(t,{[r]:i}),i},IT=(e,t)=>{if(Mb(e)){let n=e.export({format:"jwk"});return delete n.d,delete n.dp,delete n.dq,delete n.p,delete n.q,delete n.qi,n.k?Bb(n.k):(Ya||(Ya=new WeakMap),pl(Ya,e,n,t))}return Jo(e)?e.k?jr(e.k):(Ya||(Ya=new WeakMap),pl(Ya,e,e,t,!0)):e},OT=(e,t)=>{if(Mb(e)){let n=e.export({format:"jwk"});return n.k?Bb(n.k):(Qa||(Qa=new WeakMap),pl(Qa,e,n,t))}return Jo(e)?e.k?jr(e.k):(Qa||(Qa=new WeakMap),pl(Qa,e,e,t,!0)):e},zh={normalizePublicKey:IT,normalizePrivateKey:OT};async function RT(e,t){if(!Na(e))throw new TypeError("JWK must be an object");switch(t||(t=e.alg),e.kty){case"oct":if(typeof e.k!="string"||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return jr(e.k);case"RSA":if(e.oth!==void 0)throw new Bn('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return Tb({...e,alg:t});default:throw new Bn('Unsupported "kty" (Key Type) Parameter value')}}const eo=e=>e==null?void 0:e[Symbol.toStringTag],Kc=(e,t,n)=>{var r,a;if(t.use!==void 0&&t.use!=="sig")throw new TypeError("Invalid key for this operation, when present its use must be sig");if(t.key_ops!==void 0&&((a=(r=t.key_ops).includes)==null?void 0:a.call(r,n))!==!0)throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${n}`);if(t.alg!==void 0&&t.alg!==e)throw new TypeError(`Invalid key for this operation, when present its alg must be ${e}`);return!0},NT=(e,t,n,r)=>{if(!(t instanceof Uint8Array)){if(r&&Jo(t)){if(BT(t)&&Kc(e,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!Ab(t))throw new TypeError(Eb(e,t,...ml,"Uint8Array",r?"JSON Web Key":null));if(t.type!=="secret")throw new TypeError(`${eo(t)} instances for symmetric algorithms must be of type "secret"`)}},zT=(e,t,n,r)=>{if(r&&Jo(t))switch(n){case"sign":if(PT(t)&&Kc(e,t,n))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(TT(t)&&Kc(e,t,n))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!Ab(t))throw new TypeError(Eb(e,t,...ml,r?"JSON Web Key":null));if(t.type==="secret")throw new TypeError(`${eo(t)} instances for asymmetric algorithms must not be of type "secret"`);if(n==="sign"&&t.type==="public")throw new TypeError(`${eo(t)} instances for asymmetric algorithm signing must be of type "private"`);if(n==="decrypt"&&t.type==="public")throw new TypeError(`${eo(t)} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&n==="verify"&&t.type==="private")throw new TypeError(`${eo(t)} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&n==="encrypt"&&t.type==="private")throw new TypeError(`${eo(t)} instances for asymmetric algorithm encryption must be of type "public"`)};function xb(e,t,n,r){t.startsWith("HS")||t==="dir"||t.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(t)?NT(t,n,r,e):zT(t,n,r,e)}xb.bind(void 0,!1);const Gc=xb.bind(void 0,!0);function Ib(e,t,n,r,a){if(a.crit!==void 0&&(r==null?void 0:r.crit)===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||r.crit===void 0)return new Set;if(!Array.isArray(r.crit)||r.crit.length===0||r.crit.some(i=>typeof i!="string"||i.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let o;n!==void 0?o=new Map([...Object.entries(n),...t.entries()]):o=t;for(const i of r.crit){if(!o.has(i))throw new Bn(`Extension Header Parameter "${i}" is not recognized`);if(a[i]===void 0)throw new e(`Extension Header Parameter "${i}" is missing`);if(o.get(i)&&r[i]===void 0)throw new e(`Extension Header Parameter "${i}" MUST be integrity protected`)}return new Set(r.crit)}const DT=(e,t)=>{if(t!==void 0&&(!Array.isArray(t)||t.some(n=>typeof n!="string")))throw new TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)},UT=DT;function Ob(e,t){const n=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:e.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"EdDSA":return{name:t.name};default:throw new Bn(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}async function Rb(e,t,n){if(n==="sign"&&(t=await zh.normalizePrivateKey(t,e)),n==="verify"&&(t=await zh.normalizePublicKey(t,e)),kb(t))return ET(t,e,n),t;if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(Nh(t,...ml));return ku.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[n])}throw new TypeError(Nh(t,...ml,"Uint8Array","JSON Web Key"))}const FT=async(e,t,n,r)=>{const a=await Rb(e,t,"verify");Pb(e,a);const o=Ob(e,a.algorithm);try{return await ku.subtle.verify(o,a,n,r)}catch{return!1}},LT=FT;async function qT(e,t,n){if(!Na(e))throw new $e("Flattened JWS must be an object");if(e.protected===void 0&&e.header===void 0)throw new $e('Flattened JWS must have either of the "protected" or "header" members');if(e.protected!==void 0&&typeof e.protected!="string")throw new $e("JWS Protected Header incorrect type");if(e.payload===void 0)throw new $e("JWS Payload missing");if(typeof e.signature!="string")throw new $e("JWS Signature missing or incorrect type");if(e.header!==void 0&&!Na(e.header))throw new $e("JWS Unprotected Header incorrect type");let r={};if(e.protected)try{const f=jr(e.protected);r=JSON.parse(Ra.decode(f))}catch{throw new $e("JWS Protected Header is invalid")}if(!Sb(r,e.header))throw new $e("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const a={...r,...e.header},o=Ib($e,new Map([["b64",!0]]),n==null?void 0:n.crit,r,a);let i=!0;if(o.has("b64")&&(i=r.b64,typeof i!="boolean"))throw new $e('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:s}=a;if(typeof s!="string"||!s)throw new $e('JWS "alg" (Algorithm) Header Parameter missing or invalid');const l=n&&UT("algorithms",n.algorithms);if(l&&!l.has(s))throw new jb('"alg" (Algorithm) Header Parameter value not allowed');if(i){if(typeof e.payload!="string")throw new $e("JWS Payload must be a string")}else if(typeof e.payload!="string"&&!(e.payload instanceof Uint8Array))throw new $e("JWS Payload must be a string or an Uint8Array instance");let u=!1;typeof t=="function"?(t=await t(r,e),u=!0,Gc(s,t,"verify"),Jo(t)&&(t=await RT(t,s))):Gc(s,t,"verify");const c=vb(hn.encode(e.protected??""),hn.encode("."),typeof e.payload=="string"?hn.encode(e.payload):e.payload);let d;try{d=jr(e.signature)}catch{throw new $e("Failed to base64url decode the signature")}if(!await LT(s,t,d,c))throw new _b;let m;if(i)try{m=jr(e.payload)}catch{throw new $e("Failed to base64url decode the payload")}else typeof e.payload=="string"?m=hn.encode(e.payload):m=e.payload;const y={payload:m};return e.protected!==void 0&&(y.protectedHeader=r),e.header!==void 0&&(y.unprotectedHeader=e.header),u?{...y,key:t}:y}async function $T(e,t,n){if(e instanceof Uint8Array&&(e=Ra.decode(e)),typeof e!="string")throw new $e("Compact JWS must be a string or Uint8Array");const{0:r,1:a,2:o,length:i}=e.split(".");if(i!==3)throw new $e("Invalid Compact JWS");const s=await qT({payload:a,protected:r,signature:o},t,n),l={payload:s.payload,protectedHeader:s.protectedHeader};return typeof t=="function"?{...l,key:s.key}:l}const lr=e=>Math.floor(e.getTime()/1e3),Nb=60,zb=Nb*60,$d=zb*24,WT=$d*7,HT=$d*365.25,VT=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Di=e=>{const t=VT.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]),r=t[3].toLowerCase();let a;switch(r){case"sec":case"secs":case"second":case"seconds":case"s":a=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":a=Math.round(n*Nb);break;case"hour":case"hours":case"hr":case"hrs":case"h":a=Math.round(n*zb);break;case"day":case"days":case"d":a=Math.round(n*$d);break;case"week":case"weeks":case"w":a=Math.round(n*WT);break;default:a=Math.round(n*HT);break}return t[1]==="-"||t[4]==="ago"?-a:a},Dh=e=>e.toLowerCase().replace(/^application\//,""),JT=(e,t)=>typeof e=="string"?t.includes(e):Array.isArray(e)?t.some(Set.prototype.has.bind(new Set(e))):!1,KT=(e,t,n={})=>{let r;try{r=JSON.parse(Ra.decode(t))}catch{}if(!Na(r))throw new Jt("JWT Claims Set must be a top-level JSON object");const{typ:a}=n;if(a&&(typeof e.typ!="string"||Dh(e.typ)!==Dh(a)))throw new Vt('unexpected "typ" JWT header value',r,"typ","check_failed");const{requiredClaims:o=[],issuer:i,subject:s,audience:l,maxTokenAge:u}=n,c=[...o];u!==void 0&&c.push("iat"),l!==void 0&&c.push("aud"),s!==void 0&&c.push("sub"),i!==void 0&&c.push("iss");for(const y of new Set(c.reverse()))if(!(y in r))throw new Vt(`missing required "${y}" claim`,r,y,"missing");if(i&&!(Array.isArray(i)?i:[i]).includes(r.iss))throw new Vt('unexpected "iss" claim value',r,"iss","check_failed");if(s&&r.sub!==s)throw new Vt('unexpected "sub" claim value',r,"sub","check_failed");if(l&&!JT(r.aud,typeof l=="string"?[l]:l))throw new Vt('unexpected "aud" claim value',r,"aud","check_failed");let d;switch(typeof n.clockTolerance){case"string":d=Di(n.clockTolerance);break;case"number":d=n.clockTolerance;break;case"undefined":d=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:h}=n,m=lr(h||new Date);if((r.iat!==void 0||u)&&typeof r.iat!="number")throw new Vt('"iat" claim must be a number',r,"iat","invalid");if(r.nbf!==void 0){if(typeof r.nbf!="number")throw new Vt('"nbf" claim must be a number',r,"nbf","invalid");if(r.nbf>m+d)throw new Vt('"nbf" claim timestamp check failed',r,"nbf","check_failed")}if(r.exp!==void 0){if(typeof r.exp!="number")throw new Vt('"exp" claim must be a number',r,"exp","invalid");if(r.exp<=m-d)throw new Jc('"exp" claim timestamp check failed',r,"exp","check_failed")}if(u){const y=m-r.iat,f=typeof u=="number"?u:Di(u);if(y-d>f)throw new Jc('"iat" claim timestamp check failed (too far in the past)',r,"iat","check_failed");if(y<0-d)throw new Vt('"iat" claim timestamp check failed (it should be in the past)',r,"iat","check_failed")}return r};async function GT(e,t,n){var i;const r=await $T(e,t,n);if((i=r.protectedHeader.crit)!=null&&i.includes("b64")&&r.protectedHeader.b64===!1)throw new Jt("JWTs MUST NOT use unencoded payload");const o={payload:KT(r.protectedHeader,r.payload,n),protectedHeader:r.protectedHeader};return typeof t=="function"?{...o,key:r.key}:o}const QT=async(e,t,n)=>{const r=await Rb(e,t,"sign");Pb(e,r);const a=await ku.subtle.sign(Ob(e,r.algorithm),r,n);return new Uint8Array(a)},YT=QT;class ZT{constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=t}setProtectedHeader(t){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setUnprotectedHeader(t){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=t,this}async sign(t,n){if(!this._protectedHeader&&!this._unprotectedHeader)throw new $e("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!Sb(this._protectedHeader,this._unprotectedHeader))throw new $e("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const r={...this._protectedHeader,...this._unprotectedHeader},a=Ib($e,new Map([["b64",!0]]),n==null?void 0:n.crit,this._protectedHeader,r);let o=!0;if(a.has("b64")&&(o=this._protectedHeader.b64,typeof o!="boolean"))throw new $e('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:i}=r;if(typeof i!="string"||!i)throw new $e('JWS "alg" (Algorithm) Header Parameter missing or invalid');Gc(i,t,"sign");let s=this._payload;o&&(s=hn.encode(oc(s)));let l;this._protectedHeader?l=hn.encode(oc(JSON.stringify(this._protectedHeader))):l=hn.encode("");const u=vb(l,hn.encode("."),s),c=await YT(i,t,u),d={signature:oc(c),payload:""};return o&&(d.payload=Ra.decode(s)),this._unprotectedHeader&&(d.header=this._unprotectedHeader),this._protectedHeader&&(d.protected=Ra.decode(l)),d}}class XT{constructor(t){this._flattened=new ZT(t)}setProtectedHeader(t){return this._flattened.setProtectedHeader(t),this}async sign(t,n){const r=await this._flattened.sign(t,n);if(r.payload===void 0)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${r.protected}.${r.payload}.${r.signature}`}}function Gr(e,t){if(!Number.isFinite(t))throw new TypeError(`Invalid ${e} input`);return t}class e2{constructor(t={}){if(!Na(t))throw new TypeError("JWT Claims Set MUST be an object");this._payload=t}setIssuer(t){return this._payload={...this._payload,iss:t},this}setSubject(t){return this._payload={...this._payload,sub:t},this}setAudience(t){return this._payload={...this._payload,aud:t},this}setJti(t){return this._payload={...this._payload,jti:t},this}setNotBefore(t){return typeof t=="number"?this._payload={...this._payload,nbf:Gr("setNotBefore",t)}:t instanceof Date?this._payload={...this._payload,nbf:Gr("setNotBefore",lr(t))}:this._payload={...this._payload,nbf:lr(new Date)+Di(t)},this}setExpirationTime(t){return typeof t=="number"?this._payload={...this._payload,exp:Gr("setExpirationTime",t)}:t instanceof Date?this._payload={...this._payload,exp:Gr("setExpirationTime",lr(t))}:this._payload={...this._payload,exp:lr(new Date)+Di(t)},this}setIssuedAt(t){return typeof t>"u"?this._payload={...this._payload,iat:lr(new Date)}:t instanceof Date?this._payload={...this._payload,iat:Gr("setIssuedAt",lr(t))}:typeof t=="string"?this._payload={...this._payload,iat:Gr("setIssuedAt",lr(new Date)+Di(t))}:this._payload={...this._payload,iat:Gr("setIssuedAt",t)},this}}class t2 extends e2{setProtectedHeader(t){return this._protectedHeader=t,this}async sign(t,n){var a;const r=new XT(hn.encode(JSON.stringify(this._payload)));if(r.setProtectedHeader(this._protectedHeader),Array.isArray((a=this._protectedHeader)==null?void 0:a.crit)&&this._protectedHeader.crit.includes("b64")&&this._protectedHeader.b64===!1)throw new Jt("JWTs MUST NOT use unencoded payload");return r.sign(t,n)}}const n2=jr;function r2(e){if(typeof e!="string")throw new Jt("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:n}=e.split(".");if(n===5)throw new Jt("Only JWTs using Compact JWS serialization can be decoded");if(n!==3)throw new Jt("Invalid JWT");if(!t)throw new Jt("JWTs must contain a payload");let r;try{r=n2(t)}catch{throw new Jt("Failed to base64url decode the payload")}let a;try{a=JSON.parse(Ra.decode(r))}catch{throw new Jt("Failed to parse the decoded payload as JSON")}if(!Na(a))throw new Jt("Invalid JWT Claims Set");return a}const Db="your_secret_key";function Ub(e){return async t=>{const r=new TextEncoder().encode(Db);return new t2(t).setProtectedHeader({alg:"HS256"}).setIssuedAt().setExpirationTime(e).sign(r)}}const a2=Ub("1Y"),o2=Ub("15m");async function Wd(e){const n=new TextEncoder().encode(Db);try{const{payload:r}=await GT(e,n);return r}catch{return null}}function i2(){return e=>{try{return r2(e)}catch{return null}}}const Fb=i2(),s2=async({request:e})=>{try{const t=Vj.parse(await e.json()),n=wu.create(t.network);if(!await new wb().checkProof(t,s=>n.getWalletPublicKey(s)))return vr({error:"Invalid proof"});const o=t.proof.payload;if(!await Wd(o))return vr({error:"Invalid token"});const i=await a2({address:t.address,network:t.network});return ms({token:i})}catch(t){return vr({error:"Invalid request",trace:t})}};var sc={},Ti={},ps={},Zt={};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.defer=Lb=Zt.internalOnchainContentToCell=Zt.sleep=void 0;const Sn=de,l2=Wt();function u2(e){return new Promise(t=>{setTimeout(()=>t(),e)})}Zt.sleep=u2;function c2(e){const t=Sn.Dictionary.empty(Sn.Dictionary.Keys.Buffer(32),Sn.Dictionary.Values.Cell());for(const n in e){if(e[n]===void 0)continue;const r=(0,Sn.beginCell)();if(n==="image_data"){const a=Sn.Dictionary.empty(Sn.Dictionary.Keys.Uint(32),Sn.Dictionary.Values.Cell()),o=Buffer.from(e[n],"base64");for(let i=0;i*127e(...t)}Zt.defer=d2;var f2=re&&re.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var a=Object.getOwnPropertyDescriptor(t,n);(!a||("get"in a?!t.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,a)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),h2=re&&re.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Uh=re&&re.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&f2(t,e,n);return h2(t,e),t};Object.defineProperty(ps,"__esModule",{value:!0});ps.PinataStorage=void 0;const Fh=Zt;class Hd{constructor(t,n){this.client=(0,Fh.defer)(async()=>{const r=await Promise.resolve().then(()=>Uh($i)).then(a=>a.default);return new r(this.apiKey,this.secretApiKey)}),this.stream=(0,Fh.defer)(async r=>(await Promise.resolve().then(()=>Uh($i)).then(o=>o.Readable)).from(r)),this.apiKey=t,this.secretApiKey=n}static create(t){return new Hd(t.pinataApiKey,t.pinataSecretKey)}async uploadFile(t){const n=await this.client(),r=await this.stream(t);return"ipfs://"+(await n.pinFileToIPFS(r,{pinataMetadata:{name:"Assets SDK Jetton"}})).IpfsHash}}ps.PinataStorage=Hd;var gs={},m2=re&&re.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var a=Object.getOwnPropertyDescriptor(t,n);(!a||("get"in a?!t.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,a)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),p2=re&&re.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),g2=re&&re.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&m2(t,e,n);return p2(t,e),t};Object.defineProperty(gs,"__esModule",{value:!0});gs.S3Storage=void 0;const y2=Zt;class Vd{constructor(t,n,r){this.s3=(0,y2.defer)(async()=>{const a=await Promise.resolve().then(()=>g2($i)).then(o=>o.S3);return new a({credentials:{accessKeyId:this.accessKeyId,secretAccessKey:this.secretAccessKey}})}),this.accessKeyId=t,this.secretAccessKey=n,this.bucket=r}static create(t){return new Vd(t.s3AccessKeyId,t.s3SecretAccessKey,t.s3Bucket)}async uploadFile(t){const n=await this.s3(),r="jetton/"+Math.random().toString(36).substring(2);return await n.putObject({Bucket:this.bucket,Key:r,Body:t}),"https://"+this.bucket+".s3.amazonaws.com/"+r}}gs.S3Storage=Vd;var Tr={},Qe={};Object.defineProperty(Qe,"__esModule",{value:!0});Qe.bufferToStr=Qe.decodeImage=Qe.decodeSimpleFields=Qe.loadFullContent=Qe.DefaultContentResolver=void 0;const qb=de,b2=Wt();class w2{constructor(t){this.ipfsGateway=t??(n=>`https://ipfs.io/ipfs/${n}`)}async resolve(t){if(t.startsWith("ipfs://")&&(t=this.ipfsGateway(t.slice(7))),!(t.startsWith("https://")||t.startsWith("http://")))throw new Error("Unknown URL: "+t);return Buffer.from(await(await fetch(t)).arrayBuffer())}}Qe.DefaultContentResolver=w2;function k2(e){const t=[];for(;e.remainingBits>0||e.remainingRefs>0;){if(e.remainingBits%8!==0)throw new Error("Slice must contain an integer number of bytes");if(t.push(e.loadBuffer(e.remainingBits/8)),e.remainingRefs===1)e=e.loadRef().beginParse();else if(e.remainingRefs>1)throw new Error("Slice must contain at most 1 ref")}return Buffer.concat(t)}const v2={serialize:()=>{throw new Error("Buffer serialization is not supported")},parse:e=>{const t=e.loadRef().beginParse();if(t.remainingBits%8!==0)throw new Error("Slice must contain an integer number of bytes");if(t.remainingRefs!==0)throw new Error("Slice must not contain refs");return t.loadBuffer(t.remainingBits/8)}};function j2(e){const t=e.loadDict(qb.Dictionary.Keys.Uint(32),v2),n=[];for(let r=0;r{throw new Error("ContentData serialization is not supported")},parse:e=>{const t=e.loadRef().beginParse(),n=t.loadUint(8);if(n===0)return k2(t);if(n===1)return j2(t);throw new Error("Unknown ContentData type: "+n)}};function Lh(e){const t=JSON.parse(e.toString("utf-8"));if(typeof t!="object")throw new Error("Data must be an object");return t}function ur(e){return BigInt("0x"+(0,b2.sha256_sync)(e).toString("hex"))}async function C2(e,t){const n=e.beginParse(),r=n.loadUint(8);if(r===0){const a=n.loadDict(qb.Dictionary.Keys.BigUint(256),_2),o=a.get(ur("uri"));if(o!==void 0){const i=o.toString("utf-8"),s=await t.resolve(i);return{type:"semichain",offchainFields:Lh(s),onchainFields:a,offchainUrl:i}}return{type:"onchain",onchainFields:a}}else if(r===1){const a=n.loadStringTail(),o=await t.resolve(a);return{type:"offchain",offchainFields:Lh(o),offchainUrl:a}}else throw new Error("Unknown FullContent type: "+r)}Qe.loadFullContent=C2;function E2(e,t){const n={};for(const r in t){if(e.onchainFields!==void 0){const a=ur(r),o=e.onchainFields.get(a);if(o!==void 0){n[r]=t[r].onchain(o),e.onchainFields.delete(a);continue}}e.offchainFields!==void 0&&r in e.offchainFields&&(n[r]=t[r].offchain(e.offchainFields[r]),delete e.offchainFields[r])}return n}Qe.decodeSimpleFields=E2;function A2(e){if(e.onchainFields!==void 0&&e.onchainFields.has(ur("image"))&&e.onchainFields.has(ur("image_data")))throw new Error("Onchain fields contain both image and image_data");if(e.offchainFields!==void 0&&"image"in e.offchainFields&&"image_data"in e.offchainFields)throw new Error("Offchain fields contain both image and image_data");if(e.onchainFields!==void 0){const t=e.onchainFields.get(ur("image"));if(t!==void 0)return e.onchainFields.delete(ur("image")),t.toString("utf-8");const n=e.onchainFields.get(ur("image_data"));if(n!==void 0)return e.onchainFields.delete(ur("image_data")),n}if(e.offchainFields!==void 0){if("image"in e.offchainFields){const t=e.offchainFields.image;if(typeof t!="string")throw new Error("Image URI must be a string");return delete e.offchainFields.image,t}if("image_data"in e.offchainFields){const t=e.offchainFields.image_data;if(typeof t!="string")throw new Error("Offchain image data must be a string");return delete e.offchainFields.image_data,Buffer.from(t,"base64")}}}Qe.decodeImage=A2;const S2=e=>e.toString("utf-8");Qe.bufferToStr=S2;var P2=re&&re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.parseJettonContent=Tr.jettonContentToInternal=void 0;const T2=de,Bt=P2(fs),ar=Qe;function B2(e){var t,n;return{uri:e.uri,name:e.name,description:e.description,image:e.image,image_data:(t=e.imageData)==null?void 0:t.toString("base64"),symbol:e.symbol,decimals:(n=e.decimals)==null?void 0:n.toString(),amount_style:e.amountStyle,render_type:e.renderType}}Tr.jettonContentToInternal=B2;function M2(e){const t=(0,ar.decodeSimpleFields)(e,{name:{onchain:ar.bufferToStr,offchain:r=>Bt.default.string().parse(r)},description:{onchain:ar.bufferToStr,offchain:r=>Bt.default.string().parse(r)},symbol:{onchain:ar.bufferToStr,offchain:r=>Bt.default.string().parse(r)},decimals:{onchain:r=>parseInt((0,ar.bufferToStr)(r)),offchain:r=>Bt.default.union([Bt.default.string(),Bt.default.number()]).transform(a=>Number(a)).parse(r)},amount_style:{onchain:r=>{const a=(0,ar.bufferToStr)(r);if(!["n","n-of-total","%"].includes(a))throw new Error("Unknown amount_style: "+a);return a},offchain:r=>Bt.default.union([Bt.default.literal("n"),Bt.default.literal("n-of-total"),Bt.default.literal("%")]).parse(r)},render_type:{onchain:r=>{const a=(0,ar.bufferToStr)(r);if(!["currency","game"].includes(a))throw new Error("Unknown render_type: "+a);return a},offchain:r=>Bt.default.union([Bt.default.literal("currency"),Bt.default.literal("game")]).parse(r)}});return t.image=(0,ar.decodeImage)(e),{...t,type:e.type,unknownOffchainFields:e.offchainFields??{},unknownOnchainFields:e.onchainFields??T2.Dictionary.empty(),offchainUrl:e.offchainUrl}}Tr.parseJettonContent=M2;var Un={},x2=re&&re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Un,"__esModule",{value:!0});Un.parseNftContent=Un.nftContentToInternal=void 0;const I2=de,qh=x2(fs),Ns=Qe;function O2(e){var t;return{uri:e.uri,name:e.name,description:e.description,image:e.image,image_data:(t=e.imageData)==null?void 0:t.toString("base64")}}Un.nftContentToInternal=O2;function R2(e){const t=(0,Ns.decodeSimpleFields)(e,{name:{onchain:Ns.bufferToStr,offchain:r=>qh.default.string().parse(r)},description:{onchain:Ns.bufferToStr,offchain:r=>qh.default.string().parse(r)}});return t.image=(0,Ns.decodeImage)(e),{...t,type:e.type,unknownOffchainFields:e.offchainFields??{},unknownOnchainFields:e.onchainFields??I2.Dictionary.empty(),offchainUrl:e.offchainUrl}}Un.parseNftContent=R2;var Br={},vu={};Object.defineProperty(vu,"__esModule",{value:!0});vu.jettonWalletCode=void 0;vu.jettonWalletCode={codeBoc:"te6ccgECEgEAAzQAART/APSkE/S88sgLAQIBYgIDAgLMBAUAG6D2BdqJofQB9IH0gahhAgHUBgcCAUgICQDDCDHAJJfBOAB0NMDAXGwlRNfA/AL4PpA+kAx+gAxcdch+gAx+gAwc6m0AALTH4IQD4p+pVIgupUxNFnwCOCCEBeNRRlSILqWMUREA/AJ4DWCEFlfB7y6k1nwCuBfBIQP8vCAAET6RDBwuvLhTYAIBIAoLAgEgEBEB8QD0z/6APpAIfAB7UTQ+gD6QPpA1DBRNqFSKscF8uLBKML/8uLCVDRCcFQgE1QUA8hQBPoCWM8WAc8WzMkiyMsBEvQA9ADLAMkg+QBwdMjLAsoHy//J0AT6QPQEMfoAINdJwgDy4sR3gBjIywVQCM8WcPoCF8trE8yAMA/c7UTQ+gD6QPpA1DAI0z/6AFFRoAX6QPpAU1vHBVRzbXBUIBNUFAPIUAT6AljPFgHPFszJIsjLARL0APQAywDJ+QBwdMjLAsoHy//J0FANxwUcsfLiwwr6AFGooYIImJaAggiYloAStgihggjk4cCgGKEn4w8l1wsBwwAjgDQ4PAK6CEBeNRRnIyx8Zyz9QB/oCIs8WUAbPFiX6AlADzxbJUAXMI5FykXHiUAioE6CCCOThwKoAggiYloCgoBS88uLFBMmAQPsAECPIUAT6AljPFgHPFszJ7VQAcFJ5oBihghBzYtCcyMsfUjDLP1j6AlAHzxZQB88WyXGAEMjLBSTPFlAG+gIVy2oUzMlx+wAQJBAjAA4QSRA4N18EAHbCALCOIYIQ1TJ223CAEMjLBVAIzxZQBPoCFstqEssfEss/yXL7AJM1bCHiA8hQBPoCWM8WAc8WzMntVADbO1E0PoA+kD6QNQwB9M/+gD6QDBRUaFSSccF8uLBJ8L/8uLCggjk4cCqABagFrzy4sOCEHvdl97Iyx8Vyz9QA/oCIs8WAc8WyXGAGMjLBSTPFnD6AstqzMmAQPsAQBPIUAT6AljPFgHPFszJ7VSAAgyAINch7UTQ+gD6QPpA1DAE0x+CEBeNRRlSILqCEHvdl94TuhKx8uLF0z8x+gAwE6BQI8hQBPoCWM8WAc8WzMntVIA=="};var Mr={};Object.defineProperty(Mr,"__esModule",{value:!0});Mr.parseExcessReturnOptions=Mr.parseNotifyOptions=void 0;const $h=de;function N2(e){return e===!1?null:typeof e=="object"?{amount:e.amount??(0,$h.toNano)("0.01"),payload:e.payload??null}:{amount:(0,$h.toNano)("0.01"),payload:null}}Mr.parseNotifyOptions=N2;function z2(e,t){return e===!1?null:typeof e=="object"?{address:e.address??t.address}:{address:t.address}}Mr.parseExcessReturnOptions=z2;var Fn={},Be={};Object.defineProperty(Be,"__esModule",{value:!0});Be.JETTON_EXCESSES_OPCODE=Be.JETTON_BURN_NOTIFICATION_OPCODE=Be.JETTON_BURN_OPCODE=Be.JETTON_TRANSFER_NOTIFICATION_OPCODE=Be.JETTON_TRANSFER_OPCODE=Be.JETTON_CHANGE_CONTENT_OPCODE=Be.JETTON_CHANGE_ADMIN_OPCODE=Be.JETTON_INTERNAL_TRANSFER_OPCODE=Be.JETTON_MINT_OPCODE=void 0;Be.JETTON_MINT_OPCODE=21;Be.JETTON_INTERNAL_TRANSFER_OPCODE=395134233;Be.JETTON_CHANGE_ADMIN_OPCODE=3;Be.JETTON_CHANGE_CONTENT_OPCODE=4;Be.JETTON_TRANSFER_OPCODE=260734629;Be.JETTON_TRANSFER_NOTIFICATION_OPCODE=1935855772;Be.JETTON_BURN_OPCODE=1499400124;Be.JETTON_BURN_NOTIFICATION_OPCODE=2078119902;Be.JETTON_EXCESSES_OPCODE=3576854235;Object.defineProperty(Fn,"__esModule",{value:!0});Fn.loadJettonTransferMessage=Fn.storeJettonTransferMessage=void 0;const $b=Be;function D2(e){return t=>{t.storeUint($b.JETTON_TRANSFER_OPCODE,32),t.storeUint(e.queryId,64),t.storeCoins(e.amount),t.storeAddress(e.destination),t.storeAddress(e.responseDestination),t.storeMaybeRef(e.customPayload),t.storeCoins(e.forwardAmount??0),t.storeMaybeRef(e.forwardPayload)}}Fn.storeJettonTransferMessage=D2;function U2(e){if(e.loadUint(32)!==$b.JETTON_TRANSFER_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadCoins(),r=e.loadAddress(),a=e.loadMaybeAddress(),o=e.loadMaybeRef(),i=e.loadCoins(),l=e.loadBoolean()?e.loadRef():e.asCell();return{queryId:t,amount:n,destination:r,responseDestination:a,customPayload:o,forwardAmount:i,forwardPayload:l}}Fn.loadJettonTransferMessage=U2;var Ln={};Object.defineProperty(Ln,"__esModule",{value:!0});Ln.loadJettonBurnMessage=Ln.storeJettonBurnMessage=void 0;const Wb=Be;function F2(e){return t=>{t.storeUint(Wb.JETTON_BURN_OPCODE,32),t.storeUint(e.queryId,64),t.storeCoins(e.amount),t.storeAddress(e.responseDestination),t.storeMaybeRef(e.customPayload)}}Ln.storeJettonBurnMessage=F2;function L2(e){if(e.loadUint(32)!==Wb.JETTON_BURN_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadCoins(),r=e.loadMaybeAddress(),a=e.loadMaybeRef();return{queryId:t,amount:n,responseDestination:r,customPayload:a}}Ln.loadJettonBurnMessage=L2;var ys={},bs={},wn={};Object.defineProperty(wn,"__esModule",{value:!0});wn.loadJettonInternalTransferMessage=wn.storeJettonInternalTransferMessage=void 0;const Hb=Be;function q2(e){return t=>{t.storeUint(Hb.JETTON_INTERNAL_TRANSFER_OPCODE,32),t.storeUint(e.queryId,64),t.storeCoins(e.amount),t.storeAddress(e.from),t.storeAddress(e.responseAddress),t.storeCoins(e.forwardTonAmount),t.storeMaybeRef(e.forwardPayload)}}wn.storeJettonInternalTransferMessage=q2;function $2(e){if(e.loadUint(32)!==Hb.JETTON_INTERNAL_TRANSFER_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadCoins(),r=e.loadAddress(),a=e.loadAddress(),o=e.loadCoins(),s=e.loadBoolean()?e.loadRef():e.asCell();return{queryId:t,amount:n,from:r,responseAddress:a,forwardTonAmount:o,forwardPayload:s}}wn.loadJettonInternalTransferMessage=$2;var xr={};Object.defineProperty(xr,"__esModule",{value:!0});xr.loadJettonBurnNotificationMessage=xr.storeJettonBurnNotificationMessage=void 0;const Vb=Be;function W2(e){return t=>{t.storeUint(Vb.JETTON_BURN_NOTIFICATION_OPCODE,32),t.storeUint(e.queryId,64),t.storeCoins(e.amount),t.storeAddress(e.sender),t.storeAddress(e.responseDestination)}}xr.storeJettonBurnNotificationMessage=W2;function H2(e){if(e.loadUint(32)!==Vb.JETTON_BURN_NOTIFICATION_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadCoins(),r=e.loadAddress(),a=e.loadMaybeAddress();return{queryId:t,amount:n,sender:r,responseDestination:a}}xr.loadJettonBurnNotificationMessage=H2;var Ir={};Object.defineProperty(Ir,"__esModule",{value:!0});Ir.loadJettonTransferNotificationMessage=Ir.storeJettonTransferNotificationMessage=void 0;const Jb=Be;function V2(e){return t=>{t.storeUint(Jb.JETTON_TRANSFER_NOTIFICATION_OPCODE,32),t.storeUint(e.queryId,64),t.storeCoins(e.amount),t.storeAddress(e.sender),t.storeMaybeRef(e.forwardPayload)}}Ir.storeJettonTransferNotificationMessage=V2;function J2(e){if(e.loadUint(32)!==Jb.JETTON_TRANSFER_NOTIFICATION_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadCoins(),r=e.loadAddress(),o=e.loadBoolean()?e.loadRef():e.asCell();return{queryId:t,amount:n,sender:r,forwardPayload:o}}Ir.loadJettonTransferNotificationMessage=J2;Object.defineProperty(bs,"__esModule",{value:!0});bs.loadJettonWalletMessage=void 0;const Za=Be,K2=Fn,G2=wn,Q2=Ln,Y2=xr,Z2=Ir;function X2(e){try{switch(e.preloadUint(32)){case Za.JETTON_TRANSFER_OPCODE:return{kind:"jetton_transfer",...(0,K2.loadJettonTransferMessage)(e)};case Za.JETTON_INTERNAL_TRANSFER_OPCODE:return{kind:"jetton_internal_transfer",...(0,G2.loadJettonInternalTransferMessage)(e)};case Za.JETTON_TRANSFER_NOTIFICATION_OPCODE:return{kind:"transfer_notification",...(0,Z2.loadJettonTransferNotificationMessage)(e)};case Za.JETTON_BURN_OPCODE:return{kind:"jetton_burn",...(0,Q2.loadJettonBurnMessage)(e)};case Za.JETTON_BURN_NOTIFICATION_OPCODE:return{kind:"jetton_burn_notification",...(0,Y2.loadJettonBurnNotificationMessage)(e)};case Za.JETTON_EXCESSES_OPCODE:return{kind:"excesses",queryId:e.loadUintBig(64)}}}catch{}return{kind:"unknown"}}bs.loadJettonWalletMessage=X2;var Xn={},Jd={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.loadTransferMessage=e.loadEncryptedMessage=e.storeEncryptedMessage=e.loadTextMessage=e.storeTextMessage=e.loadSimpleTransferMessage=e.storeSimpleTransferMessage=e.ENCRYPTED_MESSAGE_OPCODE=e.TEXT_OPCODE=void 0,e.TEXT_OPCODE=0,e.ENCRYPTED_MESSAGE_OPCODE=560454219;function t(l){return u=>{}}e.storeSimpleTransferMessage=t;function n(l){return{}}e.loadSimpleTransferMessage=n;function r(l){return u=>{u.storeUint(0,32),u.storeStringTail(l.text)}}e.storeTextMessage=r;function a(l){if(l.loadUint(32)!==0)throw new Error("Wrong opcode");return{text:l.loadStringTail()}}e.loadTextMessage=a;function o(l){return u=>{u.storeUint(e.ENCRYPTED_MESSAGE_OPCODE,32),u.storeStringTail(l.data.toString("utf-8"))}}e.storeEncryptedMessage=o;function i(l){if(l.loadUint(32)!==e.ENCRYPTED_MESSAGE_OPCODE)throw new Error("Wrong opcode");const u=l.loadStringTail();return{data:Buffer.from(u,"utf-8")}}e.loadEncryptedMessage=i;function s(l){if(l.remainingBits===0)return{kind:"simple_transfer"};try{switch(l.preloadUint(32)){case e.TEXT_OPCODE:return{kind:"text_message",...a(l)};case e.ENCRYPTED_MESSAGE_OPCODE:return{kind:"encrypted_message",...i(l)}}}catch{}return{kind:"unknown"}}e.loadTransferMessage=s})(Jd);Object.defineProperty(Xn,"__esModule",{value:!0});Xn.parseTransferTransaction=void 0;const eB=Jd;function tB(e){if(e.description.type!=="generic")return{kind:"unknown",transaction:e};if(!e.inMessage)return{kind:"unknown",transaction:e};if(e.inMessage.info.type!=="internal")return{kind:"unknown",transaction:e};const t=e.inMessage.body.beginParse(),n=(0,eB.loadTransferMessage)(t);return n.kind==="simple_transfer"?{kind:"simple_transfer",from:e.inMessage.info.src,to:e.inMessage.info.dest,amount:e.inMessage.info.value.coins,transaction:e}:n.kind==="text_message"?{kind:"text_message",from:e.inMessage.info.src,to:e.inMessage.info.dest,amount:e.inMessage.info.value.coins,text:n.text,transaction:e}:n.kind==="encrypted_message"?{kind:"encrypted_message",from:e.inMessage.info.src,to:e.inMessage.info.dest,amount:e.inMessage.info.value.coins,data:n.data,transaction:e}:{kind:"unknown",transaction:e}}Xn.parseTransferTransaction=tB;Object.defineProperty(ys,"__esModule",{value:!0});ys.parseJettonWalletTransaction=void 0;const nB=bs,rB=Xn;function aB(e){const t=(0,rB.parseTransferTransaction)(e);if(t.kind!=="unknown")return t;if(e.description.type!=="generic")return{kind:"unknown",transaction:e};if(!e.inMessage)return{kind:"unknown",transaction:e};if(e.inMessage.info.type!=="internal")return{kind:"unknown",transaction:e};if(e.description.computePhase.type!=="vm")return{kind:"unknown",transaction:e};if(e.description.computePhase.exitCode!==0)return{kind:"unknown",transaction:e};if(!e.inMessage.body)return{kind:"unknown",transaction:e};const n=e.inMessage.info.bounced,r=(0,nB.loadJettonWalletMessage)(e.inMessage.body.beginParse());return r.kind==="jetton_transfer"?{kind:"jetton_transfer",queryId:r.queryId,from:e.inMessage.info.src,to:r.destination,amount:r.amount,responseAddress:r.responseDestination,forwardTonAmount:r.forwardAmount,forwardPayload:r.forwardPayload,transaction:e}:n&&r.kind==="jetton_internal_transfer"?{kind:"jetton_transfer_failed",queryId:r.queryId,amount:r.amount,transaction:e}:r.kind==="jetton_internal_transfer"?{kind:"jetton_transfer_received",queryId:r.queryId,amount:r.amount,from:e.inMessage.info.src,transaction:e}:r.kind==="jetton_burn"?{kind:"jetton_burn",queryId:r.queryId,amount:r.amount,transaction:e}:n&&r.kind==="jetton_burn_notification"?{kind:"jetton_burn_failed",queryId:r.queryId,amount:r.amount,transaction:e}:{kind:"unknown",transaction:e}}ys.parseJettonWalletTransaction=aB;Object.defineProperty(Br,"__esModule",{value:!0});Br.JettonWallet=Br.jettonWalletConfigToCell=void 0;const ln=de,oB=vu,lc=Mr,iB=Fn,sB=Ln,lB=ys;function Kb(e){return(0,ln.beginCell)().storeCoins(e.balance).storeAddress(e.owner).storeAddress(e.jettonMaster).storeRef(e.jettonWalletCode).endCell()}Br.jettonWalletConfigToCell=Kb;class aa{constructor(t,n){this.address=t,this.init=n}static createFromConfig(t,n,r){const o={data:Kb({balance:0n,owner:t.owner,jettonMaster:t.jettonMaster,jettonWalletCode:n??aa.code}),code:n??aa.code};return new aa((0,ln.contractAddress)(r??0,o),o)}static createFromAddress(t){return new aa(t)}async sendDeploy(t,n,r){await t.internal(n,{value:r??(0,ln.toNano)("0.05"),bounce:!0})}async send(t,n,r,a,o){const i=(0,lc.parseNotifyOptions)(o==null?void 0:o.notify),s=(0,lc.parseExcessReturnOptions)(o==null?void 0:o.returnExcess,n);await t.internal(n,{value:((o==null?void 0:o.value)??(0,ln.toNano)("0.05"))+((i==null?void 0:i.amount)??0n),bounce:!0,sendMode:ln.SendMode.PAY_GAS_SEPARATELY,body:(0,ln.beginCell)().store((0,iB.storeJettonTransferMessage)({queryId:(o==null?void 0:o.queryId)??0n,amount:a,destination:r,responseDestination:(s==null?void 0:s.address)??null,customPayload:(o==null?void 0:o.customPayload)??null,forwardAmount:(i==null?void 0:i.amount)??0n,forwardPayload:(i==null?void 0:i.payload)??null})).endCell()})}async sendBurn(t,n,r,a){const o=(0,lc.parseExcessReturnOptions)(a==null?void 0:a.returnExcess,n);await t.internal(n,{value:(a==null?void 0:a.value)??(0,ln.toNano)("0.05"),bounce:!0,sendMode:ln.SendMode.PAY_GAS_SEPARATELY,body:(0,ln.beginCell)().store((0,sB.storeJettonBurnMessage)({queryId:(a==null?void 0:a.queryId)??0n,amount:r,responseDestination:(o==null?void 0:o.address)??null,customPayload:(a==null?void 0:a.customPayload)??null})).endCell()})}async getData(t){const{stack:n}=await t.get("get_wallet_data",[]);return{balance:n.readBigNumber(),owner:n.readAddress(),jettonMaster:n.readAddress(),jettonWalletCode:n.readCell()}}async getActions(t,n){let{lt:r,hash:a,limit:o}=n??{};if(!r||!a){const s=await t.getState();if(!s.last)return[];r=s.last.lt,a=s.last.hash}return(await t.getTransactions(this.address,r,a,o)).map(s=>(0,lB.parseJettonWalletTransaction)(s))}}Br.JettonWallet=aa;aa.code=ln.Cell.fromBase64(oB.jettonWalletCode.codeBoc);var za={},ju={};Object.defineProperty(ju,"__esModule",{value:!0});ju.jettonMinterCode=void 0;ju.jettonMinterCode={codeBoc:"te6ccgECDgEAAqMAART/APSkE/S88sgLAQIBYgIDAgLMBAUCA3pgDA0B9dkGOASS+B8ADoaYGAuNhJL4HwfSB9IBj9ABi465D9ABj9ABg51NoAAWmP6Z/2omh9AH0gamoYQAqpOF1HGZqamxsommOC+XAkgX0gfQBqGBBoQDBrkP0AGBKIGigheASKUCgZ5CgCfQEsZ4tmZmT2qnBBCD3uy+8pOF1AYAk7PwUIgG4KhAJqgoB5CgCfQEsZ4sA54tmZJFkZYCJegB6AGWAZJB8gDg6ZGWBZQPl/+ToO8AMZGWCrGeLKAJ9AQnltYlmZmS4/YBBPSO4DY3NwH6APpA+ChUEgZwVCATVBQDyFAE+gJYzxYBzxbMySLIywES9AD0AMsAyfkAcHTIywLKB8v/ydBQBscF8uBKoQNFRchQBPoCWM8WzMzJ7VQB+kAwINcLAcMAkVvjDeCCECx2uXNScLrjAjU3NyPAA+MCNQLABAcICQoAPoIQ1TJ223CAEMjLBVADzxYi+gISy2rLH8s/yYBC+wAB/jZfA4IImJaAFaAVvPLgSwL6QNMAMJXIIc8WyZFt4oIQ0XNUAHCAGMjLBVAFzxYk+gIUy2oTyx8Uyz8j+kQwcLqOM/goRANwVCATVBQDyFAE+gJYzxYBzxbMySLIywES9AD0AMsAyfkAcHTIywLKB8v/ydDPFpZsInABywHi9AALADQzUDXHBfLgSQP6QDBZyFAE+gJYzxbMzMntVABCjhhRJMcF8uBJ1DBDAMhQBPoCWM8WzMzJ7VTgXwWED/LwAArJgED7AAB9rbz2omh9AH0gamoYNhj8FAC4KhAJqgoB5CgCfQEsZ4sA54tmZJFkZYCJegB6AGWAZPyAODpkZYFlA+X/5OhAAB+vFvaiaH0AfSBqahg/qpBA"};var qn={};Object.defineProperty(qn,"__esModule",{value:!0});qn.loadJettonMintMessage=qn.storeJettonMintMessage=void 0;const uB=de,Gb=Be,Qb=wn;function cB(e){return t=>{t.storeUint(Gb.JETTON_MINT_OPCODE,32),t.storeUint(e.queryId,64),t.storeAddress(e.to),t.storeCoins(e.walletForwardValue),t.storeRef((0,uB.beginCell)().store((0,Qb.storeJettonInternalTransferMessage)(e)).endCell())}}qn.storeJettonMintMessage=cB;function dB(e){if(e.loadUint(32)!==Gb.JETTON_MINT_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadAddress(),r=e.loadCoins(),a=(0,Qb.loadJettonInternalTransferMessage)(e.loadRef().beginParse());return{queryId:t,amount:a.amount,from:a.from,to:n,responseAddress:a.responseAddress,forwardTonAmount:a.forwardTonAmount,forwardPayload:a.forwardPayload,walletForwardValue:r}}qn.loadJettonMintMessage=dB;var Or={};Object.defineProperty(Or,"__esModule",{value:!0});Or.loadJettonMinterContent=Or.storeJettonMinterContent=void 0;function fB(e){return t=>{t.storeCoins(0),t.storeAddress(e.admin),t.storeRef(e.content),t.storeRef(e.jettonWalletCode)}}Or.storeJettonMinterContent=fB;function hB(e){e.loadCoins();const t=e.loadAddress(),n=e.loadRef(),r=e.loadRef();return{admin:t,content:n,jettonWalletCode:r}}Or.loadJettonMinterContent=hB;var $n={};Object.defineProperty($n,"__esModule",{value:!0});$n.loadJettonChangeAdminMessage=$n.storeJettonChangeAdminMessage=void 0;const Yb=Be;function mB(e){return t=>{t.storeUint(Yb.JETTON_CHANGE_ADMIN_OPCODE,32),t.storeUint(e.queryId,64),t.storeAddress(e.newAdmin)}}$n.storeJettonChangeAdminMessage=mB;function pB(e){if(e.loadUint(32)!==Yb.JETTON_CHANGE_ADMIN_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadAddress();return{queryId:t,newAdmin:n}}$n.loadJettonChangeAdminMessage=pB;var Wn={};Object.defineProperty(Wn,"__esModule",{value:!0});Wn.loadJettonChangeContentMessage=Wn.storeJettonChangeContentMessage=void 0;const Zb=Be;function gB(e){return t=>{t.storeUint(Zb.JETTON_CHANGE_CONTENT_OPCODE,32),t.storeUint(e.queryId,64),t.storeRef(e.newContent)}}Wn.storeJettonChangeContentMessage=gB;function yB(e){if(e.loadUint(32)!==Zb.JETTON_CHANGE_CONTENT_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadRef();return{queryId:t,newContent:n}}Wn.loadJettonChangeContentMessage=yB;var ws={},ks={};Object.defineProperty(ks,"__esModule",{value:!0});ks.loadJettonMinterMessage=void 0;const bB=qn,wB=wn,kB=$n,vB=Wn,zs=Be;function jB(e){try{switch(e.preloadUint(32)){case zs.JETTON_MINT_OPCODE:return{kind:"mint",...(0,bB.loadJettonMintMessage)(e)};case zs.JETTON_INTERNAL_TRANSFER_OPCODE:return{kind:"internal_transfer",...(0,wB.loadJettonInternalTransferMessage)(e)};case zs.JETTON_CHANGE_ADMIN_OPCODE:return{kind:"change_admin",...(0,kB.loadJettonChangeAdminMessage)(e)};case zs.JETTON_CHANGE_CONTENT_OPCODE:return{kind:"change_content",...(0,vB.loadJettonChangeContentMessage)(e)}}}catch{}return{kind:"unknown"}}ks.loadJettonMinterMessage=jB;Object.defineProperty(ws,"__esModule",{value:!0});ws.parseJettonMinterTransaction=void 0;const _B=ks,CB=Xn;function EB(e){const t=(0,CB.parseTransferTransaction)(e);if(t.kind!=="unknown")return t;if(e.description.type!=="generic")return{kind:"unknown",transaction:e};if(!e.inMessage)return{kind:"unknown",transaction:e};if(e.inMessage.info.type!=="internal")return{kind:"unknown",transaction:e};if(e.description.computePhase.type!=="vm")return{kind:"unknown",transaction:e};if(e.description.computePhase.exitCode!==0)return{kind:"unknown",transaction:e};const n=(0,_B.loadJettonMinterMessage)(e.inMessage.body.beginParse());return n.kind==="mint"?{kind:"mint",queryId:n.queryId,amount:n.amount,recipient:n.to,responseAddress:n.responseAddress,forwardPayload:n.forwardPayload,forwardTonAmount:n.forwardTonAmount,value:e.inMessage.info.value.coins,transaction:e}:n.kind==="internal_transfer"?{kind:"burn",queryId:n.queryId,amount:n.amount,from:n.from,value:e.inMessage.info.value.coins,transaction:e}:n.kind==="change_admin"?{kind:"change_admin",queryId:n.queryId,newAdmin:n.newAdmin,value:e.inMessage.info.value.coins,transaction:e}:n.kind==="change_content"?{kind:"change_content",queryId:n.queryId,newContent:n.newContent,value:e.inMessage.info.value.coins,transaction:e}:{kind:"unknown",transaction:e}}ws.parseJettonMinterTransaction=EB;Object.defineProperty(za,"__esModule",{value:!0});za.JettonMinter=za.jettonMinterConfigToCell=void 0;const Ct=de,Xb=Br,AB=Qe,SB=Tr,PB=ju,Wh=Mr,TB=qn,BB=Or,MB=$n,xB=Wn,IB=ws;function ew(e){return(0,Ct.beginCell)().store((0,BB.storeJettonMinterContent)({admin:e.admin,content:e.content,jettonWalletCode:e.jettonWalletCode??Xb.JettonWallet.code})).endCell()}za.jettonMinterConfigToCell=ew;class io{constructor(t,n,r){this.address=t,this.init=n,this.contentResolver=r}static createFromAddress(t,n){return new io(t,void 0,n)}static createFromConfig(t,n,r,a){const i={data:ew(t),code:n??io.code};return new io((0,Ct.contractAddress)(r??0,i),i,a)}async sendDeploy(t,n,r){await t.internal(n,{value:r??(0,Ct.toNano)("0.05"),bounce:!0})}async sendMint(t,n,r,a,o){const i=(0,Wh.parseNotifyOptions)(o==null?void 0:o.notify),s=(0,Wh.parseExcessReturnOptions)(o==null?void 0:o.returnExcess,n);await t.internal(n,{value:(o==null?void 0:o.value)??(0,Ct.toNano)("0.05"),bounce:!0,body:(0,Ct.beginCell)().store((0,TB.storeJettonMintMessage)({queryId:(o==null?void 0:o.queryId)??0n,amount:a,from:this.address,to:r,responseAddress:(s==null?void 0:s.address)??null,forwardPayload:(i==null?void 0:i.payload)??null,forwardTonAmount:(i==null?void 0:i.amount)??0n,walletForwardValue:((i==null?void 0:i.amount)??0n)+(s?(0,Ct.toNano)("0.01"):0n)+(0,Ct.toNano)(.02)})).endCell()})}async sendChangeAdmin(t,n,r,a){await t.internal(n,{value:(a==null?void 0:a.value)??(0,Ct.toNano)("0.05"),bounce:!0,body:(0,Ct.beginCell)().store((0,MB.storeJettonChangeAdminMessage)({queryId:(a==null?void 0:a.queryId)??0n,newAdmin:r})).endCell()})}async sendChangeContent(t,n,r,a){await t.internal(n,{value:(a==null?void 0:a.value)??(0,Ct.toNano)("0.05"),bounce:!0,body:(0,Ct.beginCell)().store((0,xB.storeJettonChangeContentMessage)({queryId:(a==null?void 0:a.queryId)??0n,newContent:r})).endCell()})}async getData(t){const n=new Ct.TupleBuilder,{stack:r}=await t.get("get_jetton_data",n.build());return{totalSupply:r.readBigNumber(),mintable:r.readBigNumber()!==0n,adminAddress:r.readAddressOpt(),jettonContent:r.readCell(),jettonWalletCode:r.readCell()}}async getWalletAddress(t,n){const r=new Ct.TupleBuilder;r.writeAddress(n);const{stack:a}=await t.get("get_wallet_address",r.build());return a.readAddress()}async getWallet(t,n){const r=await this.getWalletAddress(t,n);return t.open(new Xb.JettonWallet(r))}async getContent(t){if(!this.contentResolver)throw new Error("No content resolver");const n=await this.getData(t);return(0,SB.parseJettonContent)(await(0,AB.loadFullContent)(n.jettonContent,this.contentResolver))}async getActions(t,n){let{lt:r,hash:a,limit:o}=n??{};if(!r||!a){const s=await t.getState();if(!s.last)return[];r=s.last.lt,a=s.last.hash}return(await t.getTransactions(this.address,r,a,o)).map(s=>(0,IB.parseJettonMinterTransaction)(s))}}za.JettonMinter=io;io.code=Ct.Cell.fromBase64(PB.jettonMinterCode.codeBoc);var Qr={},vs={},_u={};Object.defineProperty(_u,"__esModule",{value:!0});_u.nftCollectionEditableCode=void 0;_u.nftCollectionEditableCode={codeBoc:"te6ccgECFAEAAh8AART/APSkE/S88sgLAQIBYgIDAgLNBAUCASAODwTn0QY4BIrfAA6GmBgLjYSK3wfSAYAOmP6Z/2omh9IGmf6mpqGEEINJ6cqClAXUcUG6+CgOhBCFRlgFa4QAhkZYKoAueLEn0BCmW1CeWP5Z+A54tkwCB9gHAbKLnjgvlwyJLgAPGBEuABcYES4AHxgRgZgeACQGBwgJAgEgCgsAYDUC0z9TE7vy4ZJTE7oB+gDUMCgQNFnwBo4SAaRDQ8hQBc8WE8s/zMzMye1Ukl8F4gCmNXAD1DCON4BA9JZvpSCOKQakIIEA+r6T8sGP3oEBkyGgUyW78vQC+gDUMCJUSzDwBiO6kwKkAt4Ekmwh4rPmMDJQREMTyFAFzxYTyz/MzMzJ7VQALDI0AfpAMEFEyFAFzxYTyz/MzMzJ7VQAPI4V1NQwEDRBMMhQBc8WE8s/zMzMye1U4F8EhA/y8AIBIAwNAD1FrwBHAh8AV3gBjIywVYzxZQBPoCE8trEszMyXH7AIAC0AcjLP/gozxbJcCDIywET9AD0AMsAyYAAbPkAdMjLAhLKB8v/ydCACASAQEQAlvILfaiaH0gaZ/qamoYLehqGCxABDuLXTHtRND6QNM/1NTUMBAkXwTQ1DHUMNBxyMsHAc8WzMmAIBIBITAC+12v2omh9IGmf6mpqGDYg6GmH6Yf9IBhAALbT0faiaH0gaZ/qamoYCi+CeAI4APgCw"};var Hn={},Vn={};Object.defineProperty(Vn,"__esModule",{value:!0});Vn.loadNftRoyaltyParams=Vn.storeNftRoyaltyParams=void 0;function OB(e){return t=>{t.storeUint(e.numerator,16),t.storeUint(e.denominator,16),t.storeAddress(e.recipient)}}Vn.storeNftRoyaltyParams=OB;function RB(e){return{numerator:e.loadUintBig(16),denominator:e.loadUintBig(16),recipient:e.loadAddress()}}Vn.loadNftRoyaltyParams=RB;var Me={};Object.defineProperty(Me,"__esModule",{value:!0});Me.NFT_EXCESSES_OPCODE=Me.NFT_REPORT_STATIC_DATA_OPCODE=Me.NFT_GET_STATIC_DATA_OPCODE=Me.NFT_OWNER_ASSIGNED_OPCODE=Me.NFT_TRANSFER_OPCODE=Me.NFT_CHANGE_CONTENT_OPCODE=Me.NFT_CHANGE_ADMIN_OPCODE=Me.NFT_BATCH_MINT_OPCODE=Me.NFT_MINT_OPCODE=void 0;Me.NFT_MINT_OPCODE=1;Me.NFT_BATCH_MINT_OPCODE=2;Me.NFT_CHANGE_ADMIN_OPCODE=3;Me.NFT_CHANGE_CONTENT_OPCODE=4;Me.NFT_TRANSFER_OPCODE=1607220500;Me.NFT_OWNER_ASSIGNED_OPCODE=85167505;Me.NFT_GET_STATIC_DATA_OPCODE=801842850;Me.NFT_REPORT_STATIC_DATA_OPCODE=2339837749;Me.NFT_EXCESSES_OPCODE=3576854235;Object.defineProperty(Hn,"__esModule",{value:!0});Hn.loadNftChangeContentMessage=Hn.storeNftChangeContentMessage=void 0;const tw=Vn,nw=Me;function NB(e){return t=>{t.storeUint(nw.NFT_CHANGE_CONTENT_OPCODE,32),t.storeUint(e.queryId,64),t.storeRef(e.newContent),t.store((0,tw.storeNftRoyaltyParams)(e.newRoyaltyParams))}}Hn.storeNftChangeContentMessage=NB;function zB(e){if(e.loadUint(32)!==nw.NFT_CHANGE_CONTENT_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadRef(),r=(0,tw.loadNftRoyaltyParams)(e.loadRef().beginParse());return{queryId:t,newContent:n,newRoyaltyParams:r}}Hn.loadNftChangeContentMessage=zB;var Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});Jn.loadNftMintMessage=Jn.storeNftMintMessage=void 0;const DB=de,rw=Me;function UB(e,t){return n=>{n.storeUint(rw.NFT_MINT_OPCODE,32),n.storeUint(e.queryId,64),n.storeUint(e.itemIndex,64),n.storeCoins(e.value),n.storeRef((0,DB.beginCell)().store(t(e.itemParams)).endCell())}}Jn.storeNftMintMessage=UB;function FB(e,t){if(e.loadUint(32)!==rw.NFT_MINT_OPCODE)throw new Error("Wrong opcode");const n=e.loadUintBig(64),r=e.loadUintBig(64),a=e.loadCoins(),o=e.loadRef();return{itemIndex:r,value:a,itemParams:t(o.beginParse()),queryId:n}}Jn.loadNftMintMessage=FB;var et={};Object.defineProperty(et,"__esModule",{value:!0});et.createNftMintItemValue=et.loadNftBatchMintItem=et.storeNftBatchMintItem=et.loadNftBatchMintMessage=et.storeNftBatchMintMessage=void 0;const so=de,aw=Me;function LB(e,t){return n=>{const r=so.Dictionary.empty(so.Dictionary.Keys.BigUint(64),Kd(t));for(const a of e.requests){if(r.has(a.index))throw new Error("Duplicate items");r.set(a.index,a)}n.storeUint(aw.NFT_BATCH_MINT_OPCODE,32),n.storeUint(e.queryId??0,64),n.storeRef((0,so.beginCell)().storeDictDirect(r))}}et.storeNftBatchMintMessage=LB;function qB(e,t){if(e.loadUint(32)!==aw.NFT_BATCH_MINT_OPCODE)throw new Error("Wrong opcode");const n=e.loadUintBig(64),r=e.loadDictDirect(so.Dictionary.Keys.BigUint(64),Kd(void 0,t));return{queryId:n,requests:r.values()}}et.loadNftBatchMintMessage=qB;function ow(e,t){return n=>{n.storeCoins(e.value??(0,so.toNano)("0.03")),n.storeRef((0,so.beginCell)().store(t(e.params)).endCell())}}et.storeNftBatchMintItem=ow;function iw(e,t){const n=e.loadUintBig(64),r=e.loadCoins(),a=e.loadRef();return{index:n,value:r,params:t(a.beginParse())}}et.loadNftBatchMintItem=iw;function Kd(e,t){return{serialize(n,r){if(!e)throw new Error("storeParams is not defined");r.store(ow(n,e))},parse(n){if(!t)throw new Error("loadParams is not defined");return iw(n,t)}}}et.createNftMintItemValue=Kd;var Kn={};Object.defineProperty(Kn,"__esModule",{value:!0});Kn.loadNftChangeAdminMessage=Kn.storeNftChangeAdminMessage=void 0;const sw=Me;function $B(e){return t=>{t.storeUint(sw.NFT_CHANGE_ADMIN_OPCODE,32),t.storeUint(e.queryId??0,64),t.storeAddress(e.newAdmin)}}Kn.storeNftChangeAdminMessage=$B;function WB(e){if(e.loadUint(32)!==sw.NFT_CHANGE_ADMIN_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadAddress();return{queryId:t,newAdmin:n}}Kn.loadNftChangeAdminMessage=WB;Object.defineProperty(vs,"__esModule",{value:!0});vs.NftCollectionBase=void 0;const Mt=de,HB=Qe,VB=Un,JB=_u,KB=Hn,GB=Jn,QB=et,YB=Kn;class lw{constructor(t,n,r,a){this.address=t,this.init=n,this.contentResolver=r,this.itemParamsValue=a}async sendDeploy(t,n,r){await t.internal(n,{value:r??(0,Mt.toNano)("0.05"),bounce:!0})}async sendMint(t,n,r,a){if(this.itemParamsValue===void 0)throw new Error("No item params value");await t.internal(n,{value:(a==null?void 0:a.value)??(0,Mt.toNano)("0.05"),bounce:!0,sendMode:Mt.SendMode.PAY_GAS_SEPARATELY,body:(0,Mt.beginCell)().store((0,GB.storeNftMintMessage)({queryId:(a==null?void 0:a.queryId)??0n,itemIndex:r.index,itemParams:r,value:r.value??(0,Mt.toNano)("0.03")},this.itemParamsValue.store)).endCell()})}async sendBatchMint(t,n,r,a){if(this.itemParamsValue===void 0)throw new Error("No item params value");await t.internal(n,{value:(a==null?void 0:a.value)??(0,Mt.toNano)("0.05")*BigInt(r.length),bounce:!0,body:(0,Mt.beginCell)().store((0,QB.storeNftBatchMintMessage)({queryId:(a==null?void 0:a.queryId)??0n,requests:r.map(o=>({index:o.index,params:o,value:o.value??(0,Mt.toNano)("0.03")}))},this.itemParamsValue.store)).endCell()})}async sendChangeAdmin(t,n,r,a){await t.internal(n,{value:(a==null?void 0:a.value)??(0,Mt.toNano)("0.05"),bounce:!0,body:(0,Mt.beginCell)().store((0,YB.storeNftChangeAdminMessage)({newAdmin:r,queryId:(a==null?void 0:a.queryId)??0n})).endCell()})}async sendChangeContent(t,n,r,a){await t.internal(n,{value:(a==null?void 0:a.value)??(0,Mt.toNano)("0.05"),bounce:!0,body:(0,Mt.beginCell)().store((0,KB.storeNftChangeContentMessage)({queryId:(a==null?void 0:a.queryId)??0n,newContent:r.newContent,newRoyaltyParams:r.newRoyaltyParams})).endCell()})}async getItemAddress(t,n){return(await t.get("get_nft_address_by_index",[{type:"int",value:n}])).stack.readAddress()}async getData(t){const n=await t.get("get_collection_data",[]);return{nextItemIndex:n.stack.readBigNumber(),content:n.stack.readCell(),owner:n.stack.readAddressOpt()}}async getContent(t){if(this.contentResolver===void 0)throw new Error("No content resolver");const n=await this.getData(t);return(0,VB.parseNftContent)(await(0,HB.loadFullContent)(n.content,this.contentResolver))}async getItemContent(t,n,r){return(await t.get("get_nft_content",[{type:"int",value:n},{type:"cell",cell:r}])).stack.readCell()}}vs.NftCollectionBase=lw;lw.code=Mt.Cell.fromBase64(JB.nftCollectionEditableCode.codeBoc);var Yr={},Cu={};Object.defineProperty(Cu,"__esModule",{value:!0});Cu.nftItemCode=void 0;Cu.nftItemCode={codeBoc:"te6ccgECDgEAAdwAART/APSkE/S88sgLAQIBYgIDAgLOBAUACaEfn+AFAgEgBgcCASAMDQLPDIhxwCSXwPg0NMDAXGwkl8D4PpA+kAx+gAxcdch+gAx+gAwc6m0APACBLOOFDBsIjRSMscF8uGVAfpA1DAQI/AD4AbTH9M/ghBfzD0UUjC64wIwNDQ1NYIQL8smohK64wJfBIQP8vCAICQARPpEMHC68uFNgAqwyEDdeMkATUTXHBfLhkfpAIfAB+kDSADH6ACDXScIA8uLEggr68IAboSGUUxWgod4i1wsBwwAgkgahkTbiIML/8uGSIZQQKjdb4w0CkzAyNOMNVQLwAwoLAHJwghCLdxc1BcjL/1AEzxYQJIBAcIAQyMsFUAfPFlAF+gIVy2oSyx/LPyJus5RYzxcBkTLiAckB+wAAfIIQBRONkchQCc8WUAvPFnEkSRRURqBwgBDIywVQB88WUAX6AhXLahLLH8s/Im6zlFjPFwGRMuIByQH7ABBHAGom8AGCENUydtsQN0QAbXFwgBDIywVQB88WUAX6AhXLahLLH8s/Im6zlFjPFwGRMuIByQH7AAA7O1E0NM/+kAg10nCAJp/AfpA1DAQJBAj4DBwWW1tgAB0A8jLP1jPFgHPFszJ7VSA="};var It={};Object.defineProperty(It,"__esModule",{value:!0});It.createNftItemParamsValue=It.loadNftItemParams=It.storeNftItemParams=void 0;const ZB=de;function uw(e){return t=>{t.storeAddress(e.owner),typeof e.individualContent=="string"?t.storeRef((0,ZB.beginCell)().storeStringTail(e.individualContent).endCell()):t.storeRef(e.individualContent)}}It.storeNftItemParams=uw;function cw(e){return{owner:e.loadAddress(),individualContent:e.loadRef()}}It.loadNftItemParams=cw;function XB(){return{store:uw,load:cw}}It.createNftItemParamsValue=XB;var Gn={};Object.defineProperty(Gn,"__esModule",{value:!0});Gn.loadNftTransferMessage=Gn.storeNftTransferMessage=void 0;const dw=Me;function eM(e){return t=>{const{queryId:n,newOwner:r,responseDestination:a,customPayload:o,forwardAmount:i,forwardPayload:s}=e;t.storeUint(dw.NFT_TRANSFER_OPCODE,32).storeUint(n,64).storeAddress(r).storeAddress(a).storeMaybeRef(o).storeCoins(i).storeMaybeRef(s)}}Gn.storeNftTransferMessage=eM;function tM(e){if(e.loadUint(32)!==dw.NFT_TRANSFER_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadAddress(),r=e.loadMaybeAddress(),a=e.loadMaybeRef(),o=e.loadCoins(),s=e.loadBoolean()?e.loadRef():e.asCell();return{queryId:t,newOwner:n,responseDestination:r,customPayload:a,forwardAmount:o,forwardPayload:s}}Gn.loadNftTransferMessage=tM;var js={},Ko={},Rr={};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.loadNftDeployMessage=Rr.storeNftDeployMessage=void 0;function nM(e){return t=>{const{owner:n,content:r}=e;t.storeAddress(n).storeRef(r)}}Rr.storeNftDeployMessage=nM;function rM(e){const t=e.loadAddress(),n=e.loadRef();return{owner:t,content:n}}Rr.loadNftDeployMessage=rM;var Nr={};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.loadNftGetStaticDataMessage=Nr.storeNftGetStaticDataMessage=void 0;const fw=Me;function aM(e){return t=>{const{queryId:n}=e;t.storeUint(fw.NFT_GET_STATIC_DATA_OPCODE,32).storeUint(n,64)}}Nr.storeNftGetStaticDataMessage=aM;function oM(e){if(e.loadUint(32)!==fw.NFT_GET_STATIC_DATA_OPCODE)throw new Error("Wrong opcode");return{queryId:e.loadUintBig(64)}}Nr.loadNftGetStaticDataMessage=oM;var zr={};Object.defineProperty(zr,"__esModule",{value:!0});zr.loadNftReportStaticDataMessage=zr.storeNftReportStaticDataMessage=void 0;const hw=Me;function iM(e){return t=>{const{queryId:n,index:r,collection:a}=e;t.storeUint(hw.NFT_REPORT_STATIC_DATA_OPCODE,32).storeUint(n,64).storeUint(r,256).storeAddress(a)}}zr.storeNftReportStaticDataMessage=iM;function sM(e){if(e.loadUint(32)!==hw.NFT_REPORT_STATIC_DATA_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadUintBig(256),r=e.loadAddress();return{queryId:t,index:n,collection:r}}zr.loadNftReportStaticDataMessage=sM;var Dr={};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.loadNftOwnerAssignedMessage=Dr.storeNftOwnerAssignedMessage=void 0;const mw=Me;function lM(e){return t=>{const{queryId:n,previousOwner:r,payload:a}=e;t.storeUint(mw.NFT_OWNER_ASSIGNED_OPCODE,32).storeUint(n,64).storeAddress(r).storeMaybeRef(a)}}Dr.storeNftOwnerAssignedMessage=lM;function uM(e){if(e.loadUint(32)!==mw.NFT_OWNER_ASSIGNED_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadAddress(),a=e.loadBoolean()?e.loadRef():e.asCell();return{queryId:t,previousOwner:n,payload:a}}Dr.loadNftOwnerAssignedMessage=uM;var Ur={};Object.defineProperty(Ur,"__esModule",{value:!0});Ur.loadNftExcessesMessage=Ur.storeNftExcessesMessage=void 0;const pw=Me;function cM(e){return t=>{const{queryId:n}=e;t.storeUint(pw.NFT_EXCESSES_OPCODE,32).storeUint(n,64)}}Ur.storeNftExcessesMessage=cM;function dM(e){if(e.loadUint(32)!==pw.NFT_EXCESSES_OPCODE)throw new Error("Wrong opcode");return{queryId:e.loadUintBig(64)}}Ur.loadNftExcessesMessage=dM;Object.defineProperty(Ko,"__esModule",{value:!0});Ko.loadNftMessage=void 0;const fM=Rr,hM=Gn,mM=Nr,pM=zr,gM=Dr,Bi=Me,yM=Ur;function bM(e){try{switch(e.preloadUint(32)){case Bi.NFT_TRANSFER_OPCODE:return{kind:"nft_transfer",...(0,hM.loadNftTransferMessage)(e)};case Bi.NFT_OWNER_ASSIGNED_OPCODE:return{kind:"owner_assigned",...(0,gM.loadNftOwnerAssignedMessage)(e)};case Bi.NFT_REPORT_STATIC_DATA_OPCODE:return{kind:"report_static_data",...(0,pM.loadNftReportStaticDataMessage)(e)};case Bi.NFT_GET_STATIC_DATA_OPCODE:return{kind:"get_static_data",...(0,mM.loadNftGetStaticDataMessage)(e)};case Bi.NFT_EXCESSES_OPCODE:return{kind:"excesses",...(0,yM.loadNftExcessesMessage)(e)}}if(e.remainingBits===256+11&&e.remainingRefs===1)return{kind:"nft_deploy",...(0,fM.loadNftDeployMessage)(e)}}catch{}return{kind:"unknown"}}Ko.loadNftMessage=bM;Object.defineProperty(js,"__esModule",{value:!0});js.parseNftItemTransaction=void 0;const wM=Ko,kM=Xn;function vM(e){const t=(0,kM.parseTransferTransaction)(e);if(t.kind!=="unknown")return t;if(e.description.type!=="generic")return{kind:"unknown",transaction:e};if(!e.inMessage)return{kind:"unknown",transaction:e};if(e.inMessage.info.type!=="internal")return{kind:"unknown",transaction:e};if(e.description.computePhase.type!=="vm")return{kind:"unknown",transaction:e};if(e.description.computePhase.exitCode!==0)return{kind:"unknown",transaction:e};const n=(0,wM.loadNftMessage)(e.inMessage.body.beginParse());return n.kind==="nft_deploy"?{kind:"deploy",owner:n.owner,content:n.content,collection:e.inMessage.info.src,transaction:e}:n.kind==="nft_transfer"?{kind:"nft_transfer",queryId:n.queryId,newOwner:n.newOwner,customPayload:n.customPayload??null,forwardAmount:n.forwardAmount,forwardPayload:n.forwardPayload??null,transaction:e}:{kind:"unknown",transaction:e}}js.parseNftItemTransaction=vM;var Hh;function Gd(){if(Hh)return Yr;Hh=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.NftItem=Yr.nftItemConfigToCell=void 0;const e=de,t=Qe,n=Eu(),r=Un,a=Cu,o=Mr,i=It,s=Gn,l=js;function u(d){return(0,e.beginCell)().storeUint(d.index,64).storeAddress(d.collection).endCell()}Yr.nftItemConfigToCell=u;class c{constructor(h,m,y){this.address=h,this.init=m,this.contentResolver=y}static createFromConfig(h,m,y,f){const T={data:u(h),code:m??c.nftCode};return new c((0,e.contractAddress)(y??0,T),T,f)}static createFromAddress(h,m){return new c(h,void 0,m)}async sendDeploy(h,m,y,f){await h.internal(m,{value:f??(0,e.toNano)("0.05"),bounce:!0,body:(0,e.beginCell)().store((0,i.storeNftItemParams)(y)).endCell()})}async send(h,m,y,f){const j=(0,o.parseNotifyOptions)(f==null?void 0:f.notify),T=(0,o.parseExcessReturnOptions)(f==null?void 0:f.returnExcess,m);await h.internal(m,{value:((f==null?void 0:f.value)??(0,e.toNano)("0.05"))+((j==null?void 0:j.amount)??0n),bounce:!0,sendMode:e.SendMode.PAY_GAS_SEPARATELY,body:(0,e.beginCell)().store((0,s.storeNftTransferMessage)({queryId:(f==null?void 0:f.queryId)??0n,newOwner:y,responseDestination:(T==null?void 0:T.address)??null,customPayload:(f==null?void 0:f.customPayload)??null,forwardAmount:(j==null?void 0:j.amount)??0n,forwardPayload:(j==null?void 0:j.payload)??null})).endCell()})}async getData(h){const{stack:m}=await h.get("get_nft_data",[]);return{initialized:m.readBoolean(),index:m.readBigNumber(),collection:m.readAddressOpt(),owner:m.readAddressOpt(),individualContent:m.readCellOpt()}}async getContent(h){if(this.contentResolver===void 0)throw new Error("No content resolver");const{collection:m,individualContent:y,index:f}=await this.getData(h);if(y===null)throw new Error("Individual content is null");let j;return m===null?j=y:j=await h.open(n.NftCollection.createFromAddress(m,this.contentResolver)).getItemContent(f,y),(0,r.parseNftContent)(await(0,t.loadFullContent)(j,this.contentResolver))}async getRoyaltyParams(h){const{collection:m}=await this.getData(h);return m===null?this.getNftItemRoyaltyParams(h):h.open(n.NftCollection.createFromAddress(m,this.contentResolver)).getRoyaltyParams()}async getNftItemRoyaltyParams(h){const{stack:m}=await h.get("get_royalty_params",[]);return{numerator:m.readBigNumber(),denominator:m.readBigNumber(),recipient:m.readAddress()}}async getActions(h,m){let{lt:y,hash:f,limit:j}=m??{};if(!y||!f){const E=await h.getState();if(!E.last)return[];y=E.last.lt,f=E.last.hash}return(await h.getTransactions(this.address,y,f,j)).map(E=>(0,l.parseNftItemTransaction)(E))}}return Yr.NftItem=c,c.nftCode=e.Cell.fromBase64(a.nftItemCode.codeBoc),Yr}var Qn={};Object.defineProperty(Qn,"__esModule",{value:!0});Qn.loadNftCollectionData=Qn.storeNftCollectionData=void 0;const jM=de,gw=Vn;function _M(e){return t=>{t.storeAddress(e.admin),t.storeUint(0,64),t.storeRef(e.content),t.storeRef(e.itemCode),t.storeRef((0,jM.beginCell)().store((0,gw.storeNftRoyaltyParams)(e.royalty)).endCell())}}Qn.storeNftCollectionData=_M;function CM(e){return{admin:e.loadAddress(),content:e.loadRef(),itemCode:e.loadRef(),royalty:(0,gw.loadNftRoyaltyParams)(e)}}Qn.loadNftCollectionData=CM;var _s={},Go={};Object.defineProperty(Go,"__esModule",{value:!0});Go.loadNftCollectionMessage=void 0;const Ds=Me,EM=Jn,AM=et,SM=Kn,PM=Hn;function TM(e,t){try{switch(e.preloadUint(32)){case Ds.NFT_MINT_OPCODE:return{kind:"mint",...(0,EM.loadNftMintMessage)(e,t.load)};case Ds.NFT_BATCH_MINT_OPCODE:return{kind:"mint_batch",...(0,AM.loadNftBatchMintMessage)(e,t.load)};case Ds.NFT_CHANGE_ADMIN_OPCODE:return{kind:"change_admin",...(0,SM.loadNftChangeAdminMessage)(e)};case Ds.NFT_CHANGE_CONTENT_OPCODE:return{kind:"change_content",...(0,PM.loadNftChangeContentMessage)(e)}}}catch{}return{kind:"unknown"}}Go.loadNftCollectionMessage=TM;Object.defineProperty(_s,"__esModule",{value:!0});_s.parseNftCollectionTransaction=void 0;const BM=Go,MM=It,xM=Xn;function IM(e){const t=(0,xM.parseTransferTransaction)(e);if(t.kind!=="unknown")return t;if(e.description.type!=="generic")return{kind:"unknown",transaction:e};if(!e.inMessage)return{kind:"unknown",transaction:e};if(e.inMessage.info.type!=="internal")return{kind:"unknown",transaction:e};if(e.description.computePhase.type!=="vm")return{kind:"unknown",transaction:e};if(e.description.computePhase.exitCode!==0)return{kind:"unknown",transaction:e};const n=(0,BM.loadNftCollectionMessage)(e.inMessage.body.beginParse(),(0,MM.createNftItemParamsValue)());return n.kind==="mint"?{kind:"mint",queryId:n.queryId,index:n.itemIndex,owner:n.itemParams.owner,content:n.itemParams.individualContent,transaction:e}:n.kind==="mint_batch"?{kind:"mint_batch",queryId:n.queryId,items:n.requests.map(r=>({index:r.index,owner:r.params.owner,content:r.params.individualContent})),transaction:e}:n.kind==="change_admin"?{kind:"change_owner",queryId:n.queryId,newOwner:n.newAdmin,transaction:e}:n.kind==="change_content"?{kind:"change_content",queryId:n.queryId,newContent:n.newContent,newRoyalty:n.newRoyaltyParams,transaction:e}:{kind:"unknown",transaction:e}}_s.parseNftCollectionTransaction=IM;var Vh;function Eu(){if(Vh)return Qr;Vh=1,Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.NftCollection=Qr.nftCollectionConfigToCell=void 0;const e=de,t=vs,n=Gd(),r=Qn,a=It,o=_s;function i(l){var u,c,d;return(0,e.beginCell)().store((0,r.storeNftCollectionData)({admin:l.admin,content:l.content,itemCode:l.itemCode??n.NftItem.nftCode,royalty:{numerator:((u=l.royalty)==null?void 0:u.numerator)??0n,denominator:((c=l.royalty)==null?void 0:c.denominator)??1n,recipient:((d=l.royalty)==null?void 0:d.recipient)??l.admin}})).endCell()}Qr.nftCollectionConfigToCell=i;class s extends t.NftCollectionBase{static createFromConfig(u,c,d,h){const y={data:i(u),code:c??t.NftCollectionBase.code};return new s((0,e.contractAddress)(d??0,y),y,h,(0,a.createNftItemParamsValue)())}static createFromAddress(u,c){return new s(u,void 0,c,(0,a.createNftItemParamsValue)())}async getItem(u,c){const d=await this.getItemAddress(u,c);return u.open(new n.NftItem(d,void 0,this.contentResolver))}async getRoyaltyParams(u){const{stack:c}=await u.get("royalty_params",[]);return{numerator:c.readBigNumber(),denominator:c.readBigNumber(),recipient:c.readAddress()}}async getActions(u,c){let{lt:d,hash:h,limit:m}=c??{};if(!d||!h){const f=await u.getState();if(!f.last)return[];d=f.last.lt,h=f.last.hash}return(await u.getTransactions(this.address,d,h,m)).map(f=>(0,o.parseNftCollectionTransaction)(f))}}return Qr.NftCollection=s,Qr}var Da={},Io={},Au={};Object.defineProperty(Au,"__esModule",{value:!0});Au.sbtItemCode=void 0;Au.sbtItemCode={codeBoc:"te6ccgECEwEAAzsAART/APSkE/S88sgLAQIBYgIDAgLOBAUCASAPEAS9RsIiDHAJFb4AHQ0wP6QDDwAvhCs44cMfhDAccF8uGV+kAB+GTUAfhm+kAw+GVw+GfwA+AC0x8CcbDjAgHTP4IQ0MO/6lIwuuMCghAE3tFIUjC64wIwghAvyyaiUiC6gGBwgJAgEgDQ4AlDAx0x+CEAUkx64Suo450z8wgBD4RHCCEMGOhtJVA22AQAPIyx8Syz8hbrOTAc8XkTHiyXEFyMsFUATPFlj6AhPLaszJAfsAkTDiAMJsEvpA1NMAMPhH+EHIy/9QBs8W+ETPFhLMFMs/UjDLAAPDAJb4RlADzALegBB4sXCCEA3WB+NANRSAQAPIyx8Syz8hbrOTAc8XkTHiyXEFyMsFUATPFlj6AhPLaszJAfsAAMYy+ERQA8cF8uGR+kDU0wAw+Ef4QcjL//hEzxYTzBLLP1IQywABwwCU+EYBzN6AEHixcIIQBSTHrkBVA4BAA8jLHxLLPyFus5MBzxeRMeLJcQXIywVQBM8WWPoCE8tqzMkB+wAD+o5AMfhByMv/+EPPFoAQcIIQi3cXNUAVUEQDgEADyMsfEss/IW6zkwHPF5Ex4slxBcjLBVAEzxZY+gITy2rMyQH7AOCCEB8EU3pSILrjAoIQb4n141Iguo4WW/hFAccF8uGR+EfAAPLhk/gj+GfwA+CCENE207NSILrjAjAxCgsMAJIx+EQixwXy4ZGAEHCCENUydtsQJFUCbYMGA8jLHxLLPyFus5MBzxeRMeLJcQXIywVQBM8WWPoCE8tqzMkB+wCLAvhkiwL4ZfADAI4x+EQixwXy4ZGCCvrwgHD7AoAQcIIQ1TJ22xAkVQJtgwYDyMsfEss/IW6zkwHPF5Ex4slxBcjLBVAEzxZY+gITy2rMyQH7AAAgghBfzD0UupPywZ3ehA/y8ABhO1E0NM/Afhh+kAB+GNw+GIg10nCAI4Wf/hi+kAB+GTUAfhm+kAB+GXTPzD4Z5Ew4oAA3PhH+Eb4QcjLP/hDzxb4RM8WzPhFzxbLP8ntVIAIBWBESAB28fn+AF8IXwg/CH8InwjQADbVjHgBfCLAADbewfgBfCPA="};var Ot={};Object.defineProperty(Ot,"__esModule",{value:!0});Ot.createSbtItemParamsValue=Ot.loadSbtItemParams=Ot.storeSbtItemParams=void 0;const OM=de;function yw(e){return t=>{t.storeAddress(e.owner),typeof e.individualContent=="string"?t.storeRef((0,OM.beginCell)().storeStringTail(e.individualContent).endCell()):t.storeRef(e.individualContent),t.storeAddress(e.authority)}}Ot.storeSbtItemParams=yw;function bw(e){const t=e.loadAddress(),n=e.loadRef(),r=e.loadMaybeAddress();return{owner:t,individualContent:n,authority:r}}Ot.loadSbtItemParams=bw;function RM(){return{store:yw,load:bw}}Ot.createSbtItemParamsValue=RM;var Cs={};Object.defineProperty(Cs,"__esModule",{value:!0});Cs.parseSbtItemTransaction=void 0;const NM=Ko,zM=Xn;function DM(e){const t=(0,zM.parseTransferTransaction)(e);if(t.kind!=="unknown")return t;if(e.description.type!=="generic")return{kind:"unknown",transaction:e};if(!e.inMessage)return{kind:"unknown",transaction:e};if(e.inMessage.info.type!=="internal")return{kind:"unknown",transaction:e};if(e.description.computePhase.type!=="vm")return{kind:"unknown",transaction:e};if(e.description.computePhase.exitCode!==0)return{kind:"unknown",transaction:e};const n=(0,NM.loadNftMessage)(e.inMessage.body.beginParse());return n.kind==="nft_deploy"?{kind:"sbt_deploy",owner:n.owner,content:n.content,collection:e.inMessage.info.src,transaction:e}:{kind:"unknown",transaction:e}}Cs.parseSbtItemTransaction=DM;Object.defineProperty(Io,"__esModule",{value:!0});Io.SbtItem=Io.sbtItemConfigToCell=void 0;const Ui=de,UM=Qe,FM=Eu(),LM=Un,qM=Au,$M=Ot,WM=Cs;function ww(e){return(0,Ui.beginCell)().storeUint(e.index,64).storeAddress(e.collection).endCell()}Io.sbtItemConfigToCell=ww;class lo{constructor(t,n,r){this.address=t,this.init=n,this.contentResolver=r}static createFromConfig(t,n,r,a){const i={data:ww(t),code:n??lo.sbtCode};return new lo((0,Ui.contractAddress)(r??0,i),i,a)}static createFromAddress(t,n){return new lo(t,void 0,n)}async sendDeploy(t,n,r,a){await t.internal(n,{value:a??(0,Ui.toNano)("0.03"),bounce:!0,body:(0,Ui.beginCell)().store((0,$M.storeSbtItemParams)(r)).endCell()})}async getData(t){const{stack:n}=await t.get("get_nft_data",[]);return{initialized:n.readBoolean(),index:n.readBigNumber(),collection:n.readAddressOpt(),owner:n.readAddressOpt(),individualContent:n.readCellOpt()}}async getContent(t){if(this.contentResolver===void 0)throw new Error("No content resolver");const{collection:n,individualContent:r,index:a}=await this.getData(t);if(r===null)throw new Error("Individual content is null");let o;return n===null?o=r:o=await t.open(FM.NftCollection.createFromAddress(n,this.contentResolver)).getItemContent(a,r),(0,LM.parseNftContent)(await(0,UM.loadFullContent)(o,this.contentResolver))}async getActions(t,n){let{lt:r,hash:a,limit:o}=n??{};if(!r||!a){const s=await t.getState();if(!s.last)return[];r=s.last.lt,a=s.last.hash}return(await t.getTransactions(this.address,r,a,o)).map(s=>(0,WM.parseSbtItemTransaction)(s))}}Io.SbtItem=lo;lo.sbtCode=Ui.Cell.fromBase64(qM.sbtItemCode.codeBoc);var Es={};Object.defineProperty(Es,"__esModule",{value:!0});Es.parseSbtCollectionTransaction=void 0;const HM=Ot,VM=Go;function JM(e){if(e.description.type!=="generic")return{kind:"unknown",transaction:e};if(!e.inMessage)return{kind:"unknown",transaction:e};if(e.inMessage.info.type!=="internal")return{kind:"unknown",transaction:e};if(e.description.computePhase.type!=="vm")return{kind:"unknown",transaction:e};if(e.description.computePhase.exitCode!==0)return{kind:"unknown",transaction:e};const t=(0,VM.loadNftCollectionMessage)(e.inMessage.body.beginParse(),(0,HM.createSbtItemParamsValue)());return t.kind==="mint"?{kind:"mint",index:t.itemIndex,owner:t.itemParams.owner,content:t.itemParams.individualContent,authority:t.itemParams.authority,transaction:e}:t.kind==="mint_batch"?{kind:"mint_batch",items:t.requests.map(n=>({index:n.index,owner:n.params.owner,content:n.params.individualContent,authority:n.params.authority})),transaction:e}:t.kind==="change_admin"?{kind:"change_owner",newOwner:t.newAdmin,transaction:e}:t.kind==="change_content"?{kind:"change_content",newContent:t.newContent,newRoyalty:t.newRoyaltyParams,transaction:e}:{kind:"unknown",transaction:e}}Es.parseSbtCollectionTransaction=JM;Object.defineProperty(Da,"__esModule",{value:!0});Da.SbtCollection=Da.sbtCollectionConfigToCell=void 0;const kw=de,KM=vs,vw=Io,GM=Es,QM=Qn,Jh=Ot;function jw(e){return(0,kw.beginCell)().store((0,QM.storeNftCollectionData)({admin:e.admin,content:e.content,itemCode:e.itemCode??vw.SbtItem.sbtCode,royalty:{numerator:0n,denominator:1n,recipient:e.admin}})).endCell()}Da.sbtCollectionConfigToCell=jw;class Fi extends KM.NftCollectionBase{static createFromConfig(t,n,r,a){const i={data:jw(t),code:n??Fi.code};return new Fi((0,kw.contractAddress)(r??0,i),i,a,(0,Jh.createSbtItemParamsValue)())}static createFromAddress(t,n){return new Fi(t,void 0,n,(0,Jh.createSbtItemParamsValue)())}async getItem(t,n){const r=await this.getItemAddress(t,n);return t.open(new vw.SbtItem(r,void 0,this.contentResolver))}async getActions(t,n){let{lt:r,hash:a,limit:o}=n??{};if(!r||!a){const s=await t.getState();if(!s.last)return[];r=s.last.lt,a=s.last.hash}return(await t.getTransactions(this.address,r,a,o)).map(s=>(0,GM.parseSbtCollectionTransaction)(s))}}Da.SbtCollection=Fi;var As={};Object.defineProperty(As,"__esModule",{value:!0});As.NftSale=void 0;const We=de;class uo{constructor(t,n){this.address=t,this.init=n}static createFromConfig(t,n,r){const o={data:(0,We.beginCell)().storeBit(!1).storeUint(t.createdAt,32).storeAddress(t.marketplace).storeAddress(t.nft).storeAddress(null).storeCoins(t.fullPrice).storeRef((0,We.beginCell)().storeAddress(t.marketplaceFeeTo).storeCoins(t.marketplaceFee).storeAddress(t.royaltyTo).storeCoins(t.royalty)).storeBit(t.canDeployByExternal).endCell(),code:n??uo.code};return new uo((0,We.contractAddress)(r??0,o),o)}static createFromAddress(t){return new uo(t)}async sendDeploy(t,n,r){await t.internal(n,{value:r??(0,We.toNano)("1"),bounce:!0,sendMode:We.SendMode.PAY_GAS_SEPARATELY})}async sendDeployExternal(t){await t.external(new We.Cell)}async sendTopup(t,n,r){await t.internal(n,{value:(r==null?void 0:r.value)??(0,We.toNano)("0.05"),bounce:!0,sendMode:We.SendMode.PAY_GAS_SEPARATELY,body:(0,We.beginCell)().storeUint(1,32).storeUint((r==null?void 0:r.queryId)??0,64).endCell()})}async sendAdminMessage(t,n,r,a,o){const i=(0,We.beginCell)().storeUint(555,32).storeUint(o??0,64);r.message instanceof We.Cell?i.storeRef(i):i.storeRef((0,We.beginCell)().store((0,We.storeMessageRelaxed)(r.message))),await t.internal(n,{value:a??(0,We.toNano)("0.05"),bounce:!0,sendMode:We.SendMode.PAY_GAS_SEPARATELY,body:i.storeUint(r.sendMode,8).endCell()})}async sendCancel(t,n,r){const{isComplete:a}=await this.getData(t);if(a)throw new Error("Sale is complete");await t.internal(n,{value:(r==null?void 0:r.value)??(0,We.toNano)("1"),bounce:!0,sendMode:We.SendMode.PAY_GAS_SEPARATELY,body:(0,We.beginCell)().storeUint(3,32).storeUint((r==null?void 0:r.queryId)??0,64).endCell()})}async sendBuy(t,n,r){const{isComplete:a,nftOwner:o,fullPrice:i}=await this.getData(t);if(!a)throw new Error("Sale is not complete");if(o===null)throw new Error("NFT owner is not set");await t.internal(n,{value:(r==null?void 0:r.value)??i+(0,We.toNano)(1),bounce:!0,sendMode:We.SendMode.PAY_GAS_SEPARATELY,body:(0,We.beginCell)().storeUint(2,32).storeUint((r==null?void 0:r.queryId)??0,64).endCell()})}async getData(t){const{stack:n}=await t.get("get_sale_data",[]);return{type:n.readNumber(),isComplete:n.readBoolean(),createdAt:n.readNumber(),marketplace:n.readAddress(),nft:n.readAddress(),nftOwner:n.readAddressOpt(),fullPrice:n.readBigNumber(),marketplaceFeeTo:n.readAddress(),marketplaceFee:n.readBigNumber(),royaltyTo:n.readAddressOpt(),royalty:n.readBigNumber()}}}As.NftSale=uo;uo.code=We.Cell.fromBase64("te6cckECCwEAArkAART/APSkE/S88sgLAQIBIAMCAH7yMO1E0NMA0x/6QPpA+kD6ANTTADDAAY4d+ABwB8jLABbLH1AEzxZYzxYBzxYB+gLMywDJ7VTgXweCAP/+8vACAUgFBABXoDhZ2omhpgGmP/SB9IH0gfQBqaYAYGGh9IH0AfSB9ABhBCCMkrCgFYACqwECAs0IBgH3ZghA7msoAUmCgUjC+8uHCJND6QPoA+kD6ADBTkqEhoVCHoRagUpBwgBDIywVQA88WAfoCy2rJcfsAJcIAJddJwgKwjhdQRXCAEMjLBVADzxYB+gLLaslx+wAQI5I0NOJacIAQyMsFUAPPFgH6AstqyXH7AHAgghBfzD0UgcAlsjLHxPLPyPPFlADzxbKAIIJycOA+gLKAMlxgBjIywUmzxZw+gLLaszJgwb7AHFVUHAHyMsAFssfUATPFljPFgHPFgH6AszLAMntVAH30A6GmBgLjYSS+CcH0gGHaiaGmAaY/9IH0gfSB9AGppgBgYOCmE44BgAEqYhOmPhW8Q4YBKGATpn8cIxbMbC3MbK2QV44LJOZlvKAVxFWAAyS+G8BJrpOEBFcCBFd0VYACRWdjYKdxjgthOjq+G6hhoaYPqGAD9gHAU4ADAkB6PLRlLOOQjEzOTlTUscFkl8J4FFRxwXy4fSCEAUTjZEWuvLh9QP6QDBGUBA0WXAHyMsAFssfUATPFljPFgHPFgH6AszLAMntVOAwNyjAA+MCKMAAnDY3EDhHZRRDMHDwBeAIwAKYVUQQJBAj8AXgXwqED/LwCgDUODmCEDuaygAYvvLhyVNGxwVRUscFFbHy4cpwIIIQX8w9FCGAEMjLBSjPFiH6Astqyx8Vyz8nzxYnzxYUygAj+gITygDJgwb7AHFQZkUVBHAHyMsAFssfUATPFljPFgHPFgH6AszLAMntVOBqUYM=");var Ss={};Object.defineProperty(Ss,"__esModule",{value:!0});Ss.NoopStorage=void 0;class YM{async uploadFile(t){throw new Error("No storage provider configured")}}Ss.NoopStorage=YM;var Ge={},Kh;function ZM(){if(Kh)return Ge;Kh=1;var e=re&&re.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.retry=Ge.formatAddressLink=Ge.formatAddress=Ge.printAddress=Ge.printInfo=Ge.createEnv=Ge.createContentResolver=Ge.createStorageEnv=void 0;const t=de,n=Lw(),r=Qe,a=e($i),o=e($i);function i(){if({}.STORAGE_TYPE===void 0)throw new Error("No STORAGE_TYPE in env!");if({}.STORAGE_TYPE==="pinata"){if({}.PINATA_API_KEY===void 0)throw new Error("No PINATA_API_KEY in env!");if({}.PINATA_SECRET_KEY===void 0)throw new Error("No PINATA_SECRET_KEY in env!");return new n.PinataStorage({}.PINATA_API_KEY,{}.PINATA_SECRET_KEY)}else if({}.STORAGE_TYPE==="s3"){if({}.S3_ACCESS_KEY_ID===void 0)throw new Error("No S3_ACCESS_KEY_ID in env!");if({}.S3_SECRET_ACCESS_KEY===void 0)throw new Error("No S3_SECRET_ACCESS_KEY in env!");if({}.S3_BUCKET===void 0)throw new Error("No S3_BUCKET in env!");return new n.S3Storage({}.S3_ACCESS_KEY_ID,{}.S3_SECRET_ACCESS_KEY,{}.S3_BUCKET)}throw new Error(`Unknown storage type: ${{}.STORAGE_TYPE}`)}Ge.createStorageEnv=i;function s(){if({}.IPFS_GATEWAY_TYPE===void 0)throw new Error("No IPFS_GATEWAY_TYPE in env!");if({}.IPFS_GATEWAY_TYPE==="ipfs.io")return new r.DefaultContentResolver(y=>`https://ipfs.io/ipfs/${y}`);if({}.IPFS_GATEWAY_TYPE==="https"){if({}.IPFS_GATEWAY===void 0)throw new Error("No IPFS_GATEWAY in env!");const y=new URL({}.IPFS_GATEWAY);return new r.DefaultContentResolver(f=>(y.pathname="/ipfs/"+f,y.toString()))}if({}.IPFS_GATEWAY_TYPE==="pinata"){if({}.IPFS_GATEWAY===void 0)throw new Error("No IPFS_GATEWAY in env!");if({}.IPFS_GATEWAY_API_KEY===void 0)throw new Error("No IPFS_GATEWAY_API_KEY in env!");const y=new URL({}.IPFS_GATEWAY);return new r.DefaultContentResolver(f=>(y.pathname="/ipfs/"+f,y.searchParams.set("pinataGatewayToken",{}.IPFS_GATEWAY_API_KEY),y.toString()))}throw new Error(`Unknown IPFS gateway type: ${{}.IPFS_GATEWAY_TYPE}`)}Ge.createContentResolver=s;async function l(){if({}.WALLET_TYPE===void 0)throw new Error("No WALLET_TYPE in env!");if({}.WALLET_TYPE!=="highload-v2")throw new Error(`Unknown wallet type: ${{}.WALLET_TYPE}`);if({}.MNEMONIC===void 0)throw new Error("No MNEMONIC in env!");if({}.NETWORK===void 0)throw new Error("No NETWORK in env!");if({}.NETWORK!=="mainnet"&&{}.NETWORK!=="testnet")throw new Error(`Unknown network: ${{}.NETWORK}`);const y=s(),f=i(),j=await(0,n.createApi)({}.NETWORK),T=await(0,n.importKey)({}.MNEMONIC),{publicKey:E,secretKey:b}=T,g=await(0,n.createWallet)({}.WALLET_TYPE,E),A=j.open(g).sender(T.secretKey);return{sdk:n.AssetsSDK.create({storage:f,api:j,sender:A,contentResolver:y}),network:{}.NETWORK,storage:f,sender:A,client:j}}Ge.createEnv=l;function u(y,f){var E;const j=Object.keys(y),T=[];for(const b of j){let g=y[b];if(typeof g=="string")g=a.default.green(g);else if(typeof g=="bigint")g=a.default.yellow(g.toString());else if(typeof g=="number")g=a.default.cyan(g);else if(typeof g=="boolean")g=a.default.blue(g);else if(g===null)g=a.default.red("null");else if(g===void 0)g=a.default.red("undefined");else if(t.Address.isAddress(g))g=`${a.default.magenta(d(g,f))} ${a.default.blue(h(g,f))}`;else if(g instanceof t.Cell)g=a.default.blue(g.toString("base64"));else throw new Error(`Unknown type: ${typeof g}`);T.push([b,g])}console.log((0,o.default)(T.filter(([b])=>b!=="name").map(([b,g])=>`${a.default.bold(b)}: ${g}`).join(` -`),{padding:{top:0,bottom:0,left:1,right:1},borderStyle:"round",borderColor:"green",title:(E=T.find(([b,g])=>b==="name"))==null?void 0:E[1]}))}Ge.printInfo=u;function c(y,f,j="wallet"){const T=d(y,f),E=h(y,f);console.log(`Your ${j} has the address ${T} -You can view it at ${E}`)}Ge.printAddress=c;function d(y,f){return y?y.toString({testOnly:f==="testnet",bounceable:!0}):"null"}Ge.formatAddress=d;function h(y,f){return y?`https://${f==="testnet"?"testnet.":""}tonviewer.com/${d(y,f)}`:"null"}Ge.formatAddressLink=h;async function m(y,f){let{retries:j,delay:T,name:E}={retries:3,delay:1e3,...f};for(let b=0;bsetTimeout(g,T*2**b))}throw new Error("Exceeded number of retries")}return Ge.retry=m,Ge}var Gh;function XM(){if(Gh)return Ti;Gh=1,Object.defineProperty(Ti,"__esModule",{value:!0}),Ti.AssetsSDK=void 0;const e=de,t=ps,n=gs,r=Tr,a=Un,o=Zt,i=Br,s=za,l=Eu(),u=Gd(),c=Da,d=Qe,h=As,m=Ss,y=ZM(),f=0;class j{constructor(E,b,g,A){this.storage=E,this.api=b,this.sender=g,this.contentResolver=A}static create(E){let{api:b,storage:g,sender:A,contentResolver:_}=E;return g?"pinataApiKey"in g?g=t.PinataStorage.create(g):"s3AccessKeyId"in g&&(g=n.S3Storage.create(g)):g=new m.NoopStorage,_??(_=new d.DefaultContentResolver),new j(g,b,A,_)}async deployJetton(E,b){var J;if(!this.sender)throw new Error("Sender must be defined");const g=(b==null?void 0:b.adminAddress)??((J=this.sender)==null?void 0:J.address);if(g===void 0)throw new Error("Admin address must be defined in options or be available in Sender");const A=s.JettonMinter.createFromConfig({admin:g,content:await this.contentToCell((0,r.jettonContentToInternal)(E),(b==null?void 0:b.onchainContent)??!1)},s.JettonMinter.code,f,this.contentResolver),_=this.api.open(A),x=b==null?void 0:b.premintAmount;return typeof x=="bigint"&&x>0n?await _.sendMint(this.sender,g,x,{...b==null?void 0:b.premintOptions,value:b==null?void 0:b.value,queryId:b==null?void 0:b.queryId}):await _.sendDeploy(this.sender,b==null?void 0:b.value),_}openJetton(E){return this.api.open(s.JettonMinter.createFromAddress(E,this.contentResolver))}async deployNftCollection(E,b){var _,x;if(!this.sender)throw new Error("Sender must be defined");const g=(b==null?void 0:b.adminAddress)??((_=this.sender)==null?void 0:_.address);if(g===void 0)throw new Error("Admin address must be defined in options or be available in Sender");const A=this.api.open(l.NftCollection.createFromConfig({admin:g,content:(0,e.beginCell)().storeRef(await this.contentToCell((0,a.nftContentToInternal)(E.collectionContent),(b==null?void 0:b.onchainContent)??!1)).storeRef((0,e.beginCell)().storeStringTail(E.commonContent)).endCell(),royalty:b==null?void 0:b.royaltyParams},l.NftCollection.code,f,this.contentResolver));return typeof((x=b==null?void 0:b.premintItems)==null?void 0:x.length)=="number"&&(b==null?void 0:b.premintItems.length)>0?await A.sendBatchMint(this.sender,b==null?void 0:b.premintItems,{value:b==null?void 0:b.value,queryId:b==null?void 0:b.queryId}):await A.sendDeploy(this.sender,b==null?void 0:b.value),A}openNftCollection(E){return this.api.open(l.NftCollection.createFromAddress(E,this.contentResolver))}async deploySbtCollection(E,b){var _,x;if(!this.sender)throw new Error("Sender must be defined");const g=(b==null?void 0:b.adminAddress)??((_=this.sender)==null?void 0:_.address);if(g===void 0)throw new Error("Admin address must be defined in options or be available in Sender");const A=this.api.open(c.SbtCollection.createFromConfig({admin:g,content:(0,e.beginCell)().storeRef(await this.contentToCell((0,a.nftContentToInternal)(E.collectionContent),(E==null?void 0:E.onchainContent)??!1)).storeRef((0,e.beginCell)().storeStringTail(E.commonContent)).endCell()},c.SbtCollection.code,f,this.contentResolver));return typeof((x=b==null?void 0:b.premintItems)==null?void 0:x.length)=="number"&&(b==null?void 0:b.premintItems.length)>0?await A.sendBatchMint(this.sender,b==null?void 0:b.premintItems,{value:b==null?void 0:b.value,queryId:b==null?void 0:b.queryId}):await A.sendDeploy(this.sender,b==null?void 0:b.value),A}openSbtCollection(E){return this.api.open(c.SbtCollection.createFromAddress(E,this.contentResolver))}openJettonWallet(E){return this.api.open(new i.JettonWallet(E))}openNftItem(E){return this.api.open(new u.NftItem(E,void 0,this.contentResolver))}async deployNftSale(E){var A;if(!this.sender)throw new Error("Sender must be defined");if((E.marketplace??((A=this.sender)==null?void 0:A.address))===void 0)throw new Error("Marketplace address must be defined in options or be available in Sender");const g=this.api.open(h.NftSale.createFromConfig({createdAt:E.createdAt??Math.floor(Date.now()/1e3),marketplace:E.marketplace??null,nft:E.nft,fullPrice:E.fullPrice,marketplaceFeeTo:E.marketplaceFeeTo??null,marketplaceFee:E.marketplaceFee??0n,royaltyTo:E.royaltyTo??null,royalty:E.royalty??0n,canDeployByExternal:E.canDeployByExternal??!0}));return await g.sendTopup(this.sender,{value:E.value,queryId:E.queryId}),g}openNftSale(E){return this.api.open(h.NftSale.createFromAddress(E))}async internalOffchainContentToCell(E){const b=Buffer.from(JSON.stringify(E),"utf-8"),g=await(0,y.retry)(()=>this.storage.uploadFile(b),{name:"upload content"});return(0,e.beginCell)().storeUint(1,8).storeStringTail(g).endCell()}async contentToCell(E,b){return b?(0,o.internalOnchainContentToCell)(E):await this.internalOffchainContentToCell(E)}}return Ti.AssetsSDK=j,Ti}var Ps={},Lt={},Su={},nt=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global||{},pt={searchParams:"URLSearchParams"in nt,iterable:"Symbol"in nt&&"iterator"in Symbol,blob:"FileReader"in nt&&"Blob"in nt&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in nt,arrayBuffer:"ArrayBuffer"in nt};function ex(e){return e&&DataView.prototype.isPrototypeOf(e)}if(pt.arrayBuffer)var tx=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],nx=ArrayBuffer.isView||function(e){return e&&tx.indexOf(Object.prototype.toString.call(e))>-1};function Qo(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||e==="")throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function Qd(e){return typeof e!="string"&&(e=String(e)),e}function Yd(e){var t={next:function(){var n=e.shift();return{done:n===void 0,value:n}}};return pt.iterable&&(t[Symbol.iterator]=function(){return t}),t}function Ye(e){this.map={},e instanceof Ye?e.forEach(function(t,n){this.append(n,t)},this):Array.isArray(e)?e.forEach(function(t){if(t.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}Ye.prototype.append=function(e,t){e=Qo(e),t=Qd(t);var n=this.map[e];this.map[e]=n?n+", "+t:t};Ye.prototype.delete=function(e){delete this.map[Qo(e)]};Ye.prototype.get=function(e){return e=Qo(e),this.has(e)?this.map[e]:null};Ye.prototype.has=function(e){return this.map.hasOwnProperty(Qo(e))};Ye.prototype.set=function(e,t){this.map[Qo(e)]=Qd(t)};Ye.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)};Ye.prototype.keys=function(){var e=[];return this.forEach(function(t,n){e.push(n)}),Yd(e)};Ye.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),Yd(e)};Ye.prototype.entries=function(){var e=[];return this.forEach(function(t,n){e.push([n,t])}),Yd(e)};pt.iterable&&(Ye.prototype[Symbol.iterator]=Ye.prototype.entries);function uc(e){if(!e._noBody){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}}function _w(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function rx(e){var t=new FileReader,n=_w(t);return t.readAsArrayBuffer(e),n}function ax(e){var t=new FileReader,n=_w(t),r=/charset=([A-Za-z0-9_-]+)/.exec(e.type),a=r?r[1]:"utf-8";return t.readAsText(e,a),n}function ox(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?t:e}function Ua(e,t){if(!(this instanceof Ua))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t=t||{};var n=t.body;if(e instanceof Ua){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new Ye(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!n&&e._bodyInit!=null&&(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",(t.headers||!this.headers)&&(this.headers=new Ye(t.headers)),this.method=sx(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in nt){var o=new AbortController;return o.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),(this.method==="GET"||this.method==="HEAD")&&(t.cache==="no-store"||t.cache==="no-cache")){var r=/([?&])_=[^&]*/;if(r.test(this.url))this.url=this.url.replace(r,"$1_="+new Date().getTime());else{var a=/\?/;this.url+=(a.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}Ua.prototype.clone=function(){return new Ua(this,{body:this._bodyInit})};function lx(e){var t=new FormData;return e.trim().split("&").forEach(function(n){if(n){var r=n.split("="),a=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(a),decodeURIComponent(o))}}),t}function ux(e){var t=new Ye,n=e.replace(/\r?\n[\t ]+/g," ");return n.split("\r").map(function(r){return r.indexOf(` -`)===0?r.substr(1,r.length):r}).forEach(function(r){var a=r.split(":"),o=a.shift().trim();if(o){var i=a.join(":").trim();try{t.append(o,i)}catch(s){console.warn("Response "+s.message)}}}),t}Cw.call(Ua.prototype);function kn(e,t){if(!(this instanceof kn))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=t.status===void 0?200:t.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText===void 0?"":""+t.statusText,this.headers=new Ye(t.headers),this.url=t.url||"",this._initBody(e)}Cw.call(kn.prototype);kn.prototype.clone=function(){return new kn(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Ye(this.headers),url:this.url})};kn.error=function(){var e=new kn(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var cx=[301,302,303,307,308];kn.redirect=function(e,t){if(cx.indexOf(t)===-1)throw new RangeError("Invalid status code");return new kn(null,{status:t,headers:{location:e}})};var ta=nt.DOMException;try{new ta}catch{ta=function(t,n){this.message=t,this.name=n;var r=Error(t);this.stack=r.stack},ta.prototype=Object.create(Error.prototype),ta.prototype.constructor=ta}function Ew(e,t){return new Promise(function(n,r){var a=new Ua(e,t);if(a.signal&&a.signal.aborted)return r(new ta("Aborted","AbortError"));var o=new XMLHttpRequest;function i(){o.abort()}o.onload=function(){var u={statusText:o.statusText,headers:ux(o.getAllResponseHeaders()||"")};a.url.indexOf("file://")===0&&(o.status<200||o.status>599)?u.status=200:u.status=o.status,u.url="responseURL"in o?o.responseURL:u.headers.get("X-Request-URL");var c="response"in o?o.response:o.responseText;setTimeout(function(){n(new kn(c,u))},0)},o.onerror=function(){setTimeout(function(){r(new TypeError("Network request failed"))},0)},o.ontimeout=function(){setTimeout(function(){r(new TypeError("Network request timed out"))},0)},o.onabort=function(){setTimeout(function(){r(new ta("Aborted","AbortError"))},0)};function s(u){try{return u===""&&nt.location.href?nt.location.href:u}catch{return u}}if(o.open(a.method,s(a.url),!0),a.credentials==="include"?o.withCredentials=!0:a.credentials==="omit"&&(o.withCredentials=!1),"responseType"in o&&(pt.blob?o.responseType="blob":pt.arrayBuffer&&(o.responseType="arraybuffer")),t&&typeof t.headers=="object"&&!(t.headers instanceof Ye||nt.Headers&&t.headers instanceof nt.Headers)){var l=[];Object.getOwnPropertyNames(t.headers).forEach(function(u){l.push(Qo(u)),o.setRequestHeader(u,Qd(t.headers[u]))}),a.headers.forEach(function(u,c){l.indexOf(c)===-1&&o.setRequestHeader(c,u)})}else a.headers.forEach(function(u,c){o.setRequestHeader(c,u)});a.signal&&(a.signal.addEventListener("abort",i),o.onreadystatechange=function(){o.readyState===4&&a.signal.removeEventListener("abort",i)}),o.send(typeof a._bodyInit>"u"?null:a._bodyInit)})}Ew.polyfill=!0;nt.fetch||(nt.fetch=Ew,nt.Headers=Ye,nt.Request=Ua,nt.Response=kn);self.fetch.bind(self);var dx=re&&re.__awaiter||function(e,t,n,r){function a(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function s(c){try{u(r.next(c))}catch(d){i(d)}}function l(c){try{u(r.throw(c))}catch(d){i(d)}}function u(c){c.done?o(c.value):a(c.value).then(s,l)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(Su,"__esModule",{value:!0});Su.Nodes=void 0;class fx{constructor(){this.nodeIndex=-1,this.committee=new Set,this.topology=[],this.initTime=0}init(t){return dx(this,void 0,void 0,function*(){this.nodeIndex=-1,this.committee.clear(),this.topology=[],this.initTime=Date.now();let n=[];try{n=yield(yield fetch(t)).json()}catch(r){throw new Error(`exception in fetch(${t}): ${r}`)}for(const r of n)r.Healthy==="1"&&this.topology.push(r);if(this.topology.length===0)throw new Error(`no healthy nodes in ${t}`)})}getHealthyFor(t){var n;const r=[];for(const a of this.topology)a.Weight>0&&(!((n=a.Mngr)===null||n===void 0)&&n.health[t])&&r.push(a);return r}}Su.Nodes=fx;const hx="@orbs-network/ton-access",mx="2.3.3",px="Unthrottled anonymous RPC access to TON blockchain via a robust decentralized network",gx="lib/index.js",yx="lib/index.js",bx="lib/index.d.ts",wx=["lib/**/*"],kx={test:"env mocha -r ts-node/register test/**/*.ts","test:v2":"env mocha -r ts-node/register test/ton-v2.ts","test:v4":"env mocha -r ts-node/register test/ton-v4.ts",cleanup:"rimraf ./lib","build:web:reg":"esbuild ./lib/web.js --bundle --sourcemap --target=es2015 --outfile=./dist/index.js","build:web:min":"esbuild ./lib/web.js --bundle --minify --target=es2015 --outfile=./dist/index.min.js","build:web":"rimraf ./dist && npm run build:web:reg && npm run build:web:min",build:"npm run lint && rimraf ./lib && tsc && npm run build:web",format:'prettier --write "src/**/*.ts"',lint:"tslint -p tsconfig.json",prepare:"npm run build",prepublishOnly:"npm test && npm run lint",preversion:"npm run lint",version:"npm run format && git add -A src",postversion:"git push && git push --tags"},vx={type:"git",url:"git+https://github.com/orbs-network/ton-access.git"},jx="yuval@orbs.com",_x="MIT",Cx={url:"https://github.com/orbs-network/ton-access/issues"},Ex="https://github.com/orbs-network/ton-access#readme",Ax={"isomorphic-fetch":"^3.0.0"},Sx={"@types/bn.js":"^5.1.1","@types/chai":"^4.3.4","@types/isomorphic-fetch":"^0.0.36","@types/mocha":"^10.0.0",buffer:"^6.0.3",chai:"^4.3.7",esbuild:"^0.15.14",mocha:"^10.1.0",prettier:"^2.7.1",rimraf:"^3.0.2",ton:"^12.1.3","ton-lite-client":"npm:@truecarry/ton-lite-client@^1.6.1",tonweb:"^0.0.58","ts-node":"^10.9.1",tslib:"^2.4.0",tslint:"^6.1.3","tslint-config-prettier":"^1.18.0"},Px={name:hx,version:mx,description:px,source:gx,main:yx,types:bx,files:wx,scripts:kx,repository:vx,author:jx,license:_x,bugs:Cx,homepage:Ex,dependencies:Ax,devDependencies:Sx};var Yo=re&&re.__awaiter||function(e,t,n,r){function a(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function s(c){try{u(r.next(c))}catch(d){i(d)}}function l(c){try{u(r.throw(c))}catch(d){i(d)}}function u(c){c.done?o(c.value):a(c.value).then(s,l)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(Lt,"__esModule",{value:!0});Lt.getHttpV4Endpoint=Lt.getHttpV4Endpoints=Lt.getHttpEndpoint=Lt.getHttpEndpoints=Lt.Access=void 0;const Tx=Su;class Aw{constructor(){this.host="ton.access.orbs.network",this.urlVersion=1,this.nodes=new Tx.Nodes}init(){return Yo(this,void 0,void 0,function*(){const t=Px;yield this.nodes.init(`https://${this.host}/mngr/nodes?npm_version=${t.version}`)})}makeProtonet(t,n){let r="";switch(t){case"toncenter-api-v2":r+="v2-";break;case"ton-api-v4":r+="v4-";break}return r+=n,r}weightedRandom(t){let n=0;for(const o of t)n+=o.Weight;const r=Math.floor(Math.random()*n);let a=0;for(const o of t){if(r>=a&&r{await this.sendTransferAndWait(t,{secretKey:n,sendMode:r.sendMode,messages:[(0,Et.internal)({to:r.to,value:r.value,bounce:r.bounce,init:r.init,body:r.body})]})},address:this.address}}}Ts.HighloadWalletContractV2=Zd;function Bw(){return{serialize:(e,t)=>{const{sendMode:n,message:r}=e,a=(0,Et.beginCell)().storeWritable((0,Et.storeMessageRelaxed)(r));t.storeUint(n,8),t.storeRef(a)},parse:e=>{const t=e.loadUint(8),n=(0,Et.loadMessageRelaxed)(e.loadRef().beginParse());return{sendMode:t,message:n}}}}function Dx(e,t,n){const r=Math.floor(e/1e3)+t;return(BigInt(r)<<32n)+BigInt(n)}function Ux(e){return t=>{const{secretKey:n,messages:r,seqno:a,sendMode:o,now:i,timeout:s,walletId:l}=e,u=Dx(i,s,a),c=Et.Dictionary.empty(Et.Dictionary.Keys.Int(16),Bw());for(const[y,f]of r.entries())c.set(y,{sendMode:o,message:f});const d=(0,Et.beginCell)().storeUint(l,32).storeUint(u,64).storeDict(c).endCell(),h=d.hash(),m=(0,Nx.sign)(h,n);t.storeBuffer(m),t.storeSlice(d.beginParse())}}function Fx(e){const t=e.loadBuffer(64),n=e.loadUint(32),r=e.loadUintBig(64),o=e.loadDict(Et.Dictionary.Keys.Int(16),Bw()).values();return{signature:t,walletId:n,queryId:r,messages:o}}Object.defineProperty(_r,"__esModule",{value:!0});_r.createSender=_r.createWallet=_r.createHighloadV2=void 0;const Lx=Ts,qx=Ps,$x=0;function Mw(e){return Lx.HighloadWalletContractV2.create({workchain:$x,publicKey:e})}_r.createHighloadV2=Mw;function xw(e,t){switch(e){case"highload-v2":return Mw(t);default:throw new Error("Unsupported wallet type")}}_r.createWallet=xw;async function Wx(e,t,n){const a=n==="testnet"||n==="mainnet"?await(0,qx.createApi)(n):n,o=xw(e,t.publicKey);return a.open(o).sender(t.secretKey)}_r.createSender=Wx;var Tu={};Object.defineProperty(Tu,"__esModule",{value:!0});Tu.NoSenderError=void 0;class Hx extends Error{constructor(){super("Sender is not set")}}Tu.NoSenderError=Hx;var Bu={},Iw=re&&re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Bu,"__esModule",{value:!0});Bu.TonAPI=void 0;const Vx=de,U=Iw(fs),Jx=Iw(Td),vn=U.default.string().transform(e=>Vx.Address.parseRaw(e)),Xd=U.default.string().transform(e=>Buffer.from(e,"hex")),qr=U.default.union([U.default.number(),U.default.string()]).transform(e=>BigInt(e)),Ow=U.default.union([U.default.number(),U.default.string()]).transform(e=>Number(e)),Rw=U.default.object({resolution:U.default.string(),url:U.default.string()}),Yn=U.default.object({address:vn,name:U.default.optional(U.default.string()),is_scam:U.default.boolean(),icon:U.default.optional(U.default.string()),is_wallet:U.default.boolean()}),Nw=U.default.object({address:vn,next_item_index:qr,owner:U.default.optional(Yn),metadata:U.default.optional(U.default.record(U.default.any())),raw_collection_content:Xd,previews:U.default.optional(U.default.array(Rw)),approved_by:U.default.array(U.default.string())}),Kx=U.default.object({nft_collections:U.default.array(Nw)}),Gx=U.default.object({value:qr,token_name:U.default.string()}),Qx=U.default.object({address:vn,market:Yn,owner:U.default.optional(Yn),price:Gx}),zw=U.default.object({address:vn,index:qr,owner:U.default.optional(Yn),collection:U.default.optional(U.default.object({address:vn,name:U.default.string(),description:U.default.string()})),verified:U.default.boolean(),metadata:U.default.record(U.default.any()),sale:U.default.optional(Qx),previews:U.default.optional(U.default.array(Rw)),dns:U.default.optional(U.default.string()),approved_by:U.default.array(U.default.string())}),dc=U.default.object({nft_items:U.default.array(zw)}),Dw=U.default.union([U.default.literal("whitelist"),U.default.literal("blacklist"),U.default.literal("none")]),Yx=U.default.object({address:vn,name:U.default.string(),symbol:U.default.string(),decimals:Ow,image:U.default.optional(U.default.string()),description:U.default.optional(U.default.string()),social:U.default.optional(U.default.array(U.default.string())),websites:U.default.optional(U.default.array(U.default.string())),catalogs:U.default.optional(U.default.array(U.default.string()))}),Uw=U.default.object({mintable:U.default.boolean(),total_supply:qr,metadata:Yx,verification:Dw,holders_count:U.default.number()}),Zx=U.default.object({jettons:U.default.array(Uw)}),Xx=U.default.object({address:vn,owner:Yn,balance:qr}),eI=U.default.object({addresses:U.default.array(Xx)}),tI=U.default.object({encryption_type:U.default.string(),cipher_text:Xd}),nI=U.default.object({type:U.default.string(),origin:vn}),rI=U.default.object({sender:U.default.optional(Yn),recipient:U.default.optional(Yn),nft:vn,comment:U.default.optional(U.default.string()),encrypted_comment:U.default.optional(tI),payload:U.default.optional(Xd),refund:U.default.optional(nI)}),aI=U.default.union([U.default.literal("ok"),U.default.literal("failed")]),oI=U.default.object({type:U.default.literal("NftItemTransfer"),status:aI,NftItemTransfer:rI}).transform(e=>({status:e.status,...e.NftItemTransfer})),iI=e=>U.default.object({event_id:U.default.string(),account:Yn,timestamp:U.default.number(),actions:U.default.array(e),is_scam:U.default.boolean(),lt:qr,in_progress:U.default.boolean()}),sI=iI(oI),lI=e=>U.default.object({events:U.default.array(e),next_from:qr}),uI=lI(sI),cI=U.default.object({prices:U.default.optional(U.default.record(U.default.number())),diff_24h:U.default.optional(U.default.record(U.default.string())),diff_7d:U.default.optional(U.default.record(U.default.string())),diff_30d:U.default.optional(U.default.record(U.default.string()))}),dI=U.default.object({address:vn,name:U.default.string(),symbol:U.default.string(),decimals:Ow,image:U.default.string(),verification:Dw}),fI=U.default.object({balance:qr,price:U.default.optional(cI),wallet_address:Yn,jetton:dI}),hI=U.default.object({balances:U.default.array(fI)}),sn=e=>typeof e=="string"?e:e.toRawString();class mI{constructor(t){this.instance=Jx.default.create({baseURL:(t==null?void 0:t.baseURL)??"https://tonapi.io",headers:(t==null?void 0:t.token)===void 0?{}:{Authorization:"Bearer "+t.token}})}async getNftCollections(t){return Kx.parse((await this.instance.get("/v2/nfts/collections",{params:t})).data).nft_collections}async getNftCollection(t){return Nw.parse((await this.instance.get(`/v2/nfts/collections/${sn(t)}`)).data)}async getNftCollectionItems(t,n){return dc.parse((await this.instance.get(`/v2/nfts/collections/${sn(t)}/items`,{params:n})).data).nft_items}async getNftItems(t){return dc.parse((await this.instance.post("/v2/nfts/_bulk",{account_ids:t.map(sn)})).data).nft_items}async getNftItem(t){return zw.parse((await this.instance.get(`/v2/nfts/${sn(t)}`)).data)}async getJettons(t){return Zx.parse((await this.instance.get("/v2/jettons",{params:t})).data).jettons}async getJetton(t){return Uw.parse((await this.instance.get(`/v2/jettons/${sn(t)}`)).data)}async getJettonHolders(t,n){return eI.parse((await this.instance.get(`/v2/jettons/${sn(t)}/holders`,{params:n})).data).addresses}async getNftItemTransferHistory(t,n){return uI.parse((await this.instance.get(`/v2/nfts/${sn(t)}/history`,{params:{limit:100,...n}})).data)}async getAccountNfts(t,n){return dc.parse((await this.instance.get(`/v2/accounts/${sn(t)}/nfts`,{params:{...n,collection:(n==null?void 0:n.collection)===void 0?void 0:sn(n.collection)}})).data).nft_items}async getAccountJettons(t,n){return hI.parse((await this.instance.get(`/v2/accounts/${sn(t)}/jettons`,{params:{currencies:(n==null?void 0:n.currencies)===void 0?void 0:n.currencies.join(",")}})).data).balances}}Bu.TonAPI=mI;var Fa={};Object.defineProperty(Fa,"__esModule",{value:!0});Fa.loadJettonExcessesMessage=Fa.storeJettonExcessesMessage=void 0;const Fw=Be;function pI(e){return t=>{t.storeUint(Fw.JETTON_EXCESSES_OPCODE,32),t.storeUint(e.queryId,64)}}Fa.storeJettonExcessesMessage=pI;function gI(e){if(e.loadUint(32)!==Fw.JETTON_EXCESSES_OPCODE)throw new Error("Wrong opcode");return{queryId:e.loadUintBig(64)}}Fa.loadJettonExcessesMessage=gI;var Yh;function Lw(){return Yh||(Yh=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.storeNftGetStaticDataMessage=e.loadNftGetStaticDataMessage=e.storeNftExcessesMessage=e.loadNftExcessesMessage=e.storeNftDeployMessage=e.loadNftDeployMessage=e.loadNftCollectionMessage=e.storeNftCollectionData=e.loadNftCollectionData=e.parseNftCollectionTransaction=e.storeNftChangeContentMessage=e.loadNftChangeContentMessage=e.storeNftChangeAdminMessage=e.loadNftChangeAdminMessage=e.storeNftBatchMintMessage=e.loadNftBatchMintMessage=e.createNftMintItemValue=e.storeNftBatchMintItem=e.loadNftBatchMintItem=e.NFT_MINT_OPCODE=e.NFT_CHANGE_CONTENT_OPCODE=e.NFT_CHANGE_ADMIN_OPCODE=e.NFT_BATCH_MINT_OPCODE=e.NFT_OWNER_ASSIGNED_OPCODE=e.NFT_REPORT_STATIC_DATA_OPCODE=e.NFT_GET_STATIC_DATA_OPCODE=e.NFT_EXCESSES_OPCODE=e.NFT_TRANSFER_OPCODE=e.TonAPI=e.NoSenderError=e.parseTransferTransaction=e.storeEncryptedMessage=e.storeTextMessage=e.storeSimpleTransferMessage=e.loadEncryptedMessage=e.loadTextMessage=e.loadSimpleTransferMessage=e.loadTransferMessage=e.ENCRYPTED_MESSAGE_OPCODE=e.TEXT_OPCODE=e.HighloadWalletContractV2=e.createSender=e.createHighloadV2=e.createWallet=e.importKey=e.createApi=e.NoopStorage=e.S3Storage=e.PinataStorage=e.AssetsSDK=void 0,e.storeJettonChangeContentMessage=e.loadJettonChangeContentMessage=e.storeJettonChangeAdminMessage=e.loadJettonChangeAdminMessage=e.storeJettonBurnNotificationMessage=e.loadJettonBurnNotificationMessage=e.storeJettonBurnMessage=e.loadJettonBurnMessage=e.jettonContentToInternal=e.parseJettonContent=e.jettonWalletConfigToCell=e.JettonWallet=e.jettonMinterConfigToCell=e.JettonMinter=e.JETTON_TRANSFER_NOTIFICATION_OPCODE=e.JETTON_EXCESSES_OPCODE=e.JETTON_MINT_OPCODE=e.JETTON_INTERNAL_TRANSFER_OPCODE=e.JETTON_TRANSFER_OPCODE=e.JETTON_CHANGE_CONTENT_OPCODE=e.JETTON_CHANGE_ADMIN_OPCODE=e.JETTON_BURN_OPCODE=e.JETTON_BURN_NOTIFICATION_OPCODE=e.NftSale=e.nftItemConfigToCell=e.NftItem=e.sbtCollectionConfigToCell=e.SbtCollection=e.nftCollectionConfigToCell=e.NftCollection=e.createSbtItemParamsValue=e.storeSbtItemParams=e.loadSbtItemParams=e.parseSbtItemTransaction=e.parseSbtCollectionTransaction=e.storeNftTransferMessage=e.loadNftTransferMessage=e.storeNftRoyaltyParams=e.loadNftRoyaltyParams=e.storeNftReportStaticDataMessage=e.loadNftReportStaticDataMessage=e.storeNftOwnerAssignedMessage=e.loadNftOwnerAssignedMessage=e.storeNftMintMessage=e.loadNftMintMessage=e.loadNftMessage=e.createNftItemParamsValue=e.storeNftItemParams=e.loadNftItemParams=e.parseNftItemTransaction=void 0,e.loadJettonWalletMessage=e.parseJettonWalletTransaction=e.loadJettonMinterMessage=e.parseJettonMinterTransaction=e.storeJettonTransferNotificationMessage=e.loadJettonTransferNotificationMessage=e.storeJettonTransferMessage=e.loadJettonTransferMessage=e.storeJettonMintMessage=e.loadJettonMintMessage=e.storeJettonMinterContent=e.loadJettonMinterContent=e.storeJettonInternalTransferMessage=e.loadJettonInternalTransferMessage=e.storeJettonExcessesMessage=e.loadJettonExcessesMessage=void 0;var t=XM();Object.defineProperty(e,"AssetsSDK",{enumerable:!0,get:function(){return t.AssetsSDK}});var n=ps;Object.defineProperty(e,"PinataStorage",{enumerable:!0,get:function(){return n.PinataStorage}});var r=gs;Object.defineProperty(e,"S3Storage",{enumerable:!0,get:function(){return r.S3Storage}});var a=Ss;Object.defineProperty(e,"NoopStorage",{enumerable:!0,get:function(){return a.NoopStorage}});var o=Ps;Object.defineProperty(e,"createApi",{enumerable:!0,get:function(){return o.createApi}});var i=Pu;Object.defineProperty(e,"importKey",{enumerable:!0,get:function(){return i.importKey}});var s=_r;Object.defineProperty(e,"createWallet",{enumerable:!0,get:function(){return s.createWallet}}),Object.defineProperty(e,"createHighloadV2",{enumerable:!0,get:function(){return s.createHighloadV2}}),Object.defineProperty(e,"createSender",{enumerable:!0,get:function(){return s.createSender}});var l=Ts;Object.defineProperty(e,"HighloadWalletContractV2",{enumerable:!0,get:function(){return l.HighloadWalletContractV2}});var u=Jd;Object.defineProperty(e,"TEXT_OPCODE",{enumerable:!0,get:function(){return u.TEXT_OPCODE}}),Object.defineProperty(e,"ENCRYPTED_MESSAGE_OPCODE",{enumerable:!0,get:function(){return u.ENCRYPTED_MESSAGE_OPCODE}}),Object.defineProperty(e,"loadTransferMessage",{enumerable:!0,get:function(){return u.loadTransferMessage}}),Object.defineProperty(e,"loadSimpleTransferMessage",{enumerable:!0,get:function(){return u.loadSimpleTransferMessage}}),Object.defineProperty(e,"loadTextMessage",{enumerable:!0,get:function(){return u.loadTextMessage}}),Object.defineProperty(e,"loadEncryptedMessage",{enumerable:!0,get:function(){return u.loadEncryptedMessage}}),Object.defineProperty(e,"storeSimpleTransferMessage",{enumerable:!0,get:function(){return u.storeSimpleTransferMessage}}),Object.defineProperty(e,"storeTextMessage",{enumerable:!0,get:function(){return u.storeTextMessage}}),Object.defineProperty(e,"storeEncryptedMessage",{enumerable:!0,get:function(){return u.storeEncryptedMessage}});var c=Xn;Object.defineProperty(e,"parseTransferTransaction",{enumerable:!0,get:function(){return c.parseTransferTransaction}});var d=Tu;Object.defineProperty(e,"NoSenderError",{enumerable:!0,get:function(){return d.NoSenderError}});var h=Bu;Object.defineProperty(e,"TonAPI",{enumerable:!0,get:function(){return h.TonAPI}});var m=Me;Object.defineProperty(e,"NFT_TRANSFER_OPCODE",{enumerable:!0,get:function(){return m.NFT_TRANSFER_OPCODE}}),Object.defineProperty(e,"NFT_EXCESSES_OPCODE",{enumerable:!0,get:function(){return m.NFT_EXCESSES_OPCODE}}),Object.defineProperty(e,"NFT_GET_STATIC_DATA_OPCODE",{enumerable:!0,get:function(){return m.NFT_GET_STATIC_DATA_OPCODE}}),Object.defineProperty(e,"NFT_REPORT_STATIC_DATA_OPCODE",{enumerable:!0,get:function(){return m.NFT_REPORT_STATIC_DATA_OPCODE}}),Object.defineProperty(e,"NFT_OWNER_ASSIGNED_OPCODE",{enumerable:!0,get:function(){return m.NFT_OWNER_ASSIGNED_OPCODE}}),Object.defineProperty(e,"NFT_BATCH_MINT_OPCODE",{enumerable:!0,get:function(){return m.NFT_BATCH_MINT_OPCODE}}),Object.defineProperty(e,"NFT_CHANGE_ADMIN_OPCODE",{enumerable:!0,get:function(){return m.NFT_CHANGE_ADMIN_OPCODE}}),Object.defineProperty(e,"NFT_CHANGE_CONTENT_OPCODE",{enumerable:!0,get:function(){return m.NFT_CHANGE_CONTENT_OPCODE}}),Object.defineProperty(e,"NFT_MINT_OPCODE",{enumerable:!0,get:function(){return m.NFT_MINT_OPCODE}});var y=et;Object.defineProperty(e,"loadNftBatchMintItem",{enumerable:!0,get:function(){return y.loadNftBatchMintItem}});var f=et;Object.defineProperty(e,"storeNftBatchMintItem",{enumerable:!0,get:function(){return f.storeNftBatchMintItem}});var j=et;Object.defineProperty(e,"createNftMintItemValue",{enumerable:!0,get:function(){return j.createNftMintItemValue}});var T=et;Object.defineProperty(e,"loadNftBatchMintMessage",{enumerable:!0,get:function(){return T.loadNftBatchMintMessage}});var E=et;Object.defineProperty(e,"storeNftBatchMintMessage",{enumerable:!0,get:function(){return E.storeNftBatchMintMessage}});var b=Kn;Object.defineProperty(e,"loadNftChangeAdminMessage",{enumerable:!0,get:function(){return b.loadNftChangeAdminMessage}});var g=Kn;Object.defineProperty(e,"storeNftChangeAdminMessage",{enumerable:!0,get:function(){return g.storeNftChangeAdminMessage}});var A=Hn;Object.defineProperty(e,"loadNftChangeContentMessage",{enumerable:!0,get:function(){return A.loadNftChangeContentMessage}});var _=Hn;Object.defineProperty(e,"storeNftChangeContentMessage",{enumerable:!0,get:function(){return _.storeNftChangeContentMessage}});var x=_s;Object.defineProperty(e,"parseNftCollectionTransaction",{enumerable:!0,get:function(){return x.parseNftCollectionTransaction}});var J=Qn;Object.defineProperty(e,"loadNftCollectionData",{enumerable:!0,get:function(){return J.loadNftCollectionData}});var q=Qn;Object.defineProperty(e,"storeNftCollectionData",{enumerable:!0,get:function(){return q.storeNftCollectionData}});var Y=Go;Object.defineProperty(e,"loadNftCollectionMessage",{enumerable:!0,get:function(){return Y.loadNftCollectionMessage}});var ee=Rr;Object.defineProperty(e,"loadNftDeployMessage",{enumerable:!0,get:function(){return ee.loadNftDeployMessage}});var ce=Rr;Object.defineProperty(e,"storeNftDeployMessage",{enumerable:!0,get:function(){return ce.storeNftDeployMessage}});var N=Ur;Object.defineProperty(e,"loadNftExcessesMessage",{enumerable:!0,get:function(){return N.loadNftExcessesMessage}});var R=Ur;Object.defineProperty(e,"storeNftExcessesMessage",{enumerable:!0,get:function(){return R.storeNftExcessesMessage}});var B=Nr;Object.defineProperty(e,"loadNftGetStaticDataMessage",{enumerable:!0,get:function(){return B.loadNftGetStaticDataMessage}});var H=Nr;Object.defineProperty(e,"storeNftGetStaticDataMessage",{enumerable:!0,get:function(){return H.storeNftGetStaticDataMessage}});var ie=js;Object.defineProperty(e,"parseNftItemTransaction",{enumerable:!0,get:function(){return ie.parseNftItemTransaction}});var se=It;Object.defineProperty(e,"loadNftItemParams",{enumerable:!0,get:function(){return se.loadNftItemParams}});var M=It;Object.defineProperty(e,"storeNftItemParams",{enumerable:!0,get:function(){return M.storeNftItemParams}});var Ie=It;Object.defineProperty(e,"createNftItemParamsValue",{enumerable:!0,get:function(){return Ie.createNftItemParamsValue}});var xe=Ko;Object.defineProperty(e,"loadNftMessage",{enumerable:!0,get:function(){return xe.loadNftMessage}});var qe=Jn;Object.defineProperty(e,"loadNftMintMessage",{enumerable:!0,get:function(){return qe.loadNftMintMessage}});var Ve=Jn;Object.defineProperty(e,"storeNftMintMessage",{enumerable:!0,get:function(){return Ve.storeNftMintMessage}});var at=Dr;Object.defineProperty(e,"loadNftOwnerAssignedMessage",{enumerable:!0,get:function(){return at.loadNftOwnerAssignedMessage}});var tt=Dr;Object.defineProperty(e,"storeNftOwnerAssignedMessage",{enumerable:!0,get:function(){return tt.storeNftOwnerAssignedMessage}});var Ne=zr;Object.defineProperty(e,"loadNftReportStaticDataMessage",{enumerable:!0,get:function(){return Ne.loadNftReportStaticDataMessage}});var Ke=zr;Object.defineProperty(e,"storeNftReportStaticDataMessage",{enumerable:!0,get:function(){return Ke.storeNftReportStaticDataMessage}});var Oe=Vn;Object.defineProperty(e,"loadNftRoyaltyParams",{enumerable:!0,get:function(){return Oe.loadNftRoyaltyParams}});var ot=Vn;Object.defineProperty(e,"storeNftRoyaltyParams",{enumerable:!0,get:function(){return ot.storeNftRoyaltyParams}});var kt=Gn;Object.defineProperty(e,"loadNftTransferMessage",{enumerable:!0,get:function(){return kt.loadNftTransferMessage}});var Dt=Gn;Object.defineProperty(e,"storeNftTransferMessage",{enumerable:!0,get:function(){return Dt.storeNftTransferMessage}});var D=Es;Object.defineProperty(e,"parseSbtCollectionTransaction",{enumerable:!0,get:function(){return D.parseSbtCollectionTransaction}});var S=Cs;Object.defineProperty(e,"parseSbtItemTransaction",{enumerable:!0,get:function(){return S.parseSbtItemTransaction}});var O=Ot;Object.defineProperty(e,"loadSbtItemParams",{enumerable:!0,get:function(){return O.loadSbtItemParams}});var W=Ot;Object.defineProperty(e,"storeSbtItemParams",{enumerable:!0,get:function(){return W.storeSbtItemParams}});var F=Ot;Object.defineProperty(e,"createSbtItemParamsValue",{enumerable:!0,get:function(){return F.createSbtItemParamsValue}});var oe=Eu();Object.defineProperty(e,"NftCollection",{enumerable:!0,get:function(){return oe.NftCollection}}),Object.defineProperty(e,"nftCollectionConfigToCell",{enumerable:!0,get:function(){return oe.nftCollectionConfigToCell}});var ge=Da;Object.defineProperty(e,"SbtCollection",{enumerable:!0,get:function(){return ge.SbtCollection}}),Object.defineProperty(e,"sbtCollectionConfigToCell",{enumerable:!0,get:function(){return ge.sbtCollectionConfigToCell}});var Ce=Gd();Object.defineProperty(e,"NftItem",{enumerable:!0,get:function(){return Ce.NftItem}}),Object.defineProperty(e,"nftItemConfigToCell",{enumerable:!0,get:function(){return Ce.nftItemConfigToCell}});var Re=As;Object.defineProperty(e,"NftSale",{enumerable:!0,get:function(){return Re.NftSale}});var Se=Be;Object.defineProperty(e,"JETTON_BURN_NOTIFICATION_OPCODE",{enumerable:!0,get:function(){return Se.JETTON_BURN_NOTIFICATION_OPCODE}}),Object.defineProperty(e,"JETTON_BURN_OPCODE",{enumerable:!0,get:function(){return Se.JETTON_BURN_OPCODE}}),Object.defineProperty(e,"JETTON_CHANGE_ADMIN_OPCODE",{enumerable:!0,get:function(){return Se.JETTON_CHANGE_ADMIN_OPCODE}}),Object.defineProperty(e,"JETTON_CHANGE_CONTENT_OPCODE",{enumerable:!0,get:function(){return Se.JETTON_CHANGE_CONTENT_OPCODE}}),Object.defineProperty(e,"JETTON_TRANSFER_OPCODE",{enumerable:!0,get:function(){return Se.JETTON_TRANSFER_OPCODE}}),Object.defineProperty(e,"JETTON_INTERNAL_TRANSFER_OPCODE",{enumerable:!0,get:function(){return Se.JETTON_INTERNAL_TRANSFER_OPCODE}}),Object.defineProperty(e,"JETTON_MINT_OPCODE",{enumerable:!0,get:function(){return Se.JETTON_MINT_OPCODE}}),Object.defineProperty(e,"JETTON_EXCESSES_OPCODE",{enumerable:!0,get:function(){return Se.JETTON_EXCESSES_OPCODE}}),Object.defineProperty(e,"JETTON_TRANSFER_NOTIFICATION_OPCODE",{enumerable:!0,get:function(){return Se.JETTON_TRANSFER_NOTIFICATION_OPCODE}});var ye=za;Object.defineProperty(e,"JettonMinter",{enumerable:!0,get:function(){return ye.JettonMinter}}),Object.defineProperty(e,"jettonMinterConfigToCell",{enumerable:!0,get:function(){return ye.jettonMinterConfigToCell}});var nn=Br;Object.defineProperty(e,"JettonWallet",{enumerable:!0,get:function(){return nn.JettonWallet}}),Object.defineProperty(e,"jettonWalletConfigToCell",{enumerable:!0,get:function(){return nn.jettonWalletConfigToCell}});var it=Tr;Object.defineProperty(e,"parseJettonContent",{enumerable:!0,get:function(){return it.parseJettonContent}}),Object.defineProperty(e,"jettonContentToInternal",{enumerable:!0,get:function(){return it.jettonContentToInternal}});var P=Ln;Object.defineProperty(e,"loadJettonBurnMessage",{enumerable:!0,get:function(){return P.loadJettonBurnMessage}});var p=Ln;Object.defineProperty(e,"storeJettonBurnMessage",{enumerable:!0,get:function(){return p.storeJettonBurnMessage}});var v=xr;Object.defineProperty(e,"loadJettonBurnNotificationMessage",{enumerable:!0,get:function(){return v.loadJettonBurnNotificationMessage}});var C=xr;Object.defineProperty(e,"storeJettonBurnNotificationMessage",{enumerable:!0,get:function(){return C.storeJettonBurnNotificationMessage}});var I=$n;Object.defineProperty(e,"loadJettonChangeAdminMessage",{enumerable:!0,get:function(){return I.loadJettonChangeAdminMessage}});var k=$n;Object.defineProperty(e,"storeJettonChangeAdminMessage",{enumerable:!0,get:function(){return k.storeJettonChangeAdminMessage}});var L=Wn;Object.defineProperty(e,"loadJettonChangeContentMessage",{enumerable:!0,get:function(){return L.loadJettonChangeContentMessage}});var $=Wn;Object.defineProperty(e,"storeJettonChangeContentMessage",{enumerable:!0,get:function(){return $.storeJettonChangeContentMessage}});var V=Fa;Object.defineProperty(e,"loadJettonExcessesMessage",{enumerable:!0,get:function(){return V.loadJettonExcessesMessage}});var X=Fa;Object.defineProperty(e,"storeJettonExcessesMessage",{enumerable:!0,get:function(){return X.storeJettonExcessesMessage}});var le=wn;Object.defineProperty(e,"loadJettonInternalTransferMessage",{enumerable:!0,get:function(){return le.loadJettonInternalTransferMessage}});var Z=wn;Object.defineProperty(e,"storeJettonInternalTransferMessage",{enumerable:!0,get:function(){return Z.storeJettonInternalTransferMessage}});var te=Or;Object.defineProperty(e,"loadJettonMinterContent",{enumerable:!0,get:function(){return te.loadJettonMinterContent}});var we=Or;Object.defineProperty(e,"storeJettonMinterContent",{enumerable:!0,get:function(){return we.storeJettonMinterContent}});var G=qn;Object.defineProperty(e,"loadJettonMintMessage",{enumerable:!0,get:function(){return G.loadJettonMintMessage}});var Ae=qn;Object.defineProperty(e,"storeJettonMintMessage",{enumerable:!0,get:function(){return Ae.storeJettonMintMessage}});var _e=Fn;Object.defineProperty(e,"loadJettonTransferMessage",{enumerable:!0,get:function(){return _e.loadJettonTransferMessage}});var Te=Fn;Object.defineProperty(e,"storeJettonTransferMessage",{enumerable:!0,get:function(){return Te.storeJettonTransferMessage}});var ze=Ir;Object.defineProperty(e,"loadJettonTransferNotificationMessage",{enumerable:!0,get:function(){return ze.loadJettonTransferNotificationMessage}});var Ht=Ir;Object.defineProperty(e,"storeJettonTransferNotificationMessage",{enumerable:!0,get:function(){return Ht.storeJettonTransferNotificationMessage}});var ct=ws;Object.defineProperty(e,"parseJettonMinterTransaction",{enumerable:!0,get:function(){return ct.parseJettonMinterTransaction}});var Tt=ks;Object.defineProperty(e,"loadJettonMinterMessage",{enumerable:!0,get:function(){return Tt.loadJettonMinterMessage}});var Zo=ys;Object.defineProperty(e,"parseJettonWalletTransaction",{enumerable:!0,get:function(){return Zo.parseJettonWalletTransaction}});var Ha=bs;Object.defineProperty(e,"loadJettonWalletMessage",{enumerable:!0,get:function(){return Ha.loadJettonWalletMessage}})}(sc)),sc}var Zh=Lw();const yI=He.object({name:He.string(),description:He.string(),image_data:He.string(),symbol:He.string(),decimals:He.number(),amount:He.string()}),bI=1e3*60*5,wI=async({request:e})=>{var t;try{const n=(t=e.headers.get("Authorization"))==null?void 0:t.replace("Bearer ","");if(!n||!await Wd(n))return hl({error:"Unauthorized"});const r=Fb(n);if(!(r!=null&&r.address)||!(r!=null&&r.network))return hl({error:"Invalid token"});const a=yI.parse(await e.json()),o=Math.round((Date.now()+bI)/1e3),i=de.toNano("0.06").toString(),s=de.toNano("0.05"),l=Ue.Address.parse(r.address),u=Ue.Address.parse(r.address),c=Ue.Address.parse(r.address),d=Zh.JettonMinter.createFromConfig({admin:u,content:Lb({name:a.name,description:a.description,image_data:Buffer.from(a.image_data,"ascii").toString("base64"),symbol:a.symbol,decimals:a.decimals})});if(!d.init)return vr({error:"Invalid jetton master"});const h=d.address.toString({urlSafe:!0,bounceable:!0,testOnly:r.network===qi.TESTNET}),m=de.beginCell().store(de.storeStateInit(d.init)).endCell().toBoc().toString("base64"),y=de.beginCell().store(Zh.storeJettonMintMessage({queryId:0n,amount:BigInt(a.amount),from:d.address,to:c,responseAddress:l,forwardPayload:null,forwardTonAmount:1n,walletForwardValue:s})).endCell().toBoc().toString("base64");return ms({validUntil:o,from:l.toRawString(),messages:[{address:h,amount:i,stateInit:m,payload:y}]})}catch(n){return n instanceof Error?vr({error:"Invalid request",trace:n.message}):vr({error:"Invalid request",trace:n})}},kI=async()=>{try{const t=new wb().generatePayload(),n=await o2({payload:t});return ms({payload:n})}catch(e){return vr({error:"Invalid request",trace:e})}},vI=async({request:e})=>{var t;try{const n=(t=e.headers.get("Authorization"))==null?void 0:t.replace("Bearer ","");if(!n||!await Wd(n))return hl({error:"Unauthorized"});const r=Fb(n);if(!(r!=null&&r.address)||!(r!=null&&r.network))return hl({error:"Invalid token"});const a=wu.create(r.network);return ms(await a.getAccountInfo(r.address))}catch(n){return vr({error:"Invalid request",trace:n})}},jI=async()=>ms({ok:!0}),Mi=document.baseURI.replace(/\/$/,""),OI=Tj(ni.get(`${Mi}/api/healthz`,jI),ni.post(`${Mi}/api/generate_payload`,kI),ni.post(`${Mi}/api/check_proof`,s2),ni.get(`${Mi}/api/get_account_info`,vI),ni.post(`${Mi}/api/create_jetton`,wI));export{OI as worker}; diff --git a/docs/assets/worker-f51faf5a.js b/docs/assets/worker-f51faf5a.js new file mode 100644 index 0000000..c807e8c --- /dev/null +++ b/docs/assets/worker-f51faf5a.js @@ -0,0 +1,291 @@ +var Mk=Object.defineProperty;var xk=(e,t,n)=>t in e?Mk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ae=(e,t,n)=>(xk(e,typeof t!="symbol"?t+"":t,n),n),xu=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var _n=(e,t,n)=>(xu(e,t,"read from private field"),n?n.call(e):t.get(e)),Xo=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Ou=(e,t,n,r)=>(xu(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);var Wr=(e,t,n)=>(xu(e,t,"access private method"),n);import{C as Li,c as re,n as Ks,g as Ok,b as Xe,r as qi}from"./index-61376d1f.js";var Ik=/(%?)(%([sdijo]))/g;function Rk(e,t){switch(t){case"s":return e;case"d":case"i":return Number(e);case"j":return JSON.stringify(e);case"o":{if(typeof e=="string")return e;const n=JSON.stringify(e);return n==="{}"||n==="[]"||/^\[object .+?\]$/.test(n)?e:n}}}function Oo(e,...t){if(t.length===0)return e;let n=0,r=e.replace(Ik,(a,o,i,s)=>{const l=t[n],u=Rk(l,s);return o?a:(n++,u)});return n{if(!e)throw new Dk(t,...n)};Kt.as=(e,t,n,...r)=>{if(!t){const a=r.length===0?n:Oo(n,...r);let o;try{o=Reflect.construct(e,[a])}catch{o=e(a)}throw o}};const Uk="[MSW]";function Jc(e,...t){const n=Oo(e,...t);return`${Uk} ${n}`}function Fk(e,...t){console.warn(Jc(e,...t))}function Lk(e,...t){console.error(Jc(e,...t))}const xe={formatMessage:Jc,warn:Fk,error:Lk};class Qd extends Error{constructor(t){super(t),this.name="InternalError"}}function qk(){Kt(typeof URL<"u",xe.formatMessage(`Global "URL" class is not defined. This likely means that you're running MSW in an environment that doesn't support all Node.js standard API (e.g. React Native). If that's the case, please use an appropriate polyfill for the "URL" class, like "react-native-url-polyfill".`))}var $k=class extends Error{constructor(t,n,r){super(`Possible EventEmitter memory leak detected. ${r} ${n.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=t,this.type=n,this.count=r,this.name="MaxListenersExceededWarning"}},Yh=class{static listenerCount(t,n){return t.listenerCount(n)}constructor(){this.events=new Map,this.maxListeners=Yh.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}_emitInternalEvent(t,n,r){this.emit(t,n,r)}_getListeners(t){return Array.prototype.concat.apply([],this.events.get(t))||[]}_removeListener(t,n){const r=t.indexOf(n);return r>-1&&t.splice(r,1),[]}_wrapOnceListener(t,n){const r=(...a)=>(this.removeListener(t,r),n.apply(this,a));return Object.defineProperty(r,"name",{value:n.name}),r}setMaxListeners(t){return this.maxListeners=t,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(t,...n){const r=this._getListeners(t);return r.forEach(a=>{a.apply(this,n)}),r.length>0}addListener(t,n){this._emitInternalEvent("newListener",t,n);const r=this._getListeners(t).concat(n);if(this.events.set(t,r),this.maxListeners>0&&this.listenerCount(t)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const a=new $k(this,t,this.listenerCount(t));console.warn(a)}return this}on(t,n){return this.addListener(t,n)}once(t,n){return this.addListener(t,this._wrapOnceListener(t,n))}prependListener(t,n){const r=this._getListeners(t);if(r.length>0){const a=[n].concat(r);this.events.set(t,a)}else this.events.set(t,r.concat(n));return this}prependOnceListener(t,n){return this.prependListener(t,this._wrapOnceListener(t,n))}removeListener(t,n){const r=this._getListeners(t);return r.length>0&&(this._removeListener(r,n),this.events.set(t,r),this._emitInternalEvent("removeListener",t,n)),this}off(t,n){return this.removeListener(t,n)}removeAllListeners(t){return t?this.events.delete(t):this.events.clear(),this}listeners(t){return Array.from(this._getListeners(t))}listenerCount(t){return this._getListeners(t).length}rawListeners(t){return this.listeners(t)}},Gs=Yh;Gs.defaultMaxListeners=10;function Wk(e,t){const n=e.emit;if(n._isPiped)return;const r=function(o,...i){return t.emit(o,...i),n.call(this,o,...i)};r._isPiped=!0,e.emit=r}function Hk(e){const t=[...e];return Object.freeze(t),t}class Vk{constructor(){Ae(this,"subscriptions",[])}dispose(){let t;for(;t=this.subscriptions.shift();)t()}}class Jk{constructor(t){Ae(this,"handlers");this.initialHandlers=t,this.handlers=[...t]}prepend(t){this.handlers.unshift(...t)}reset(t){this.handlers=t.length>0?[...t]:[...this.initialHandlers]}currentHandlers(){return this.handlers}}class Kk extends Vk{constructor(...n){super();Ae(this,"handlersController");Ae(this,"emitter");Ae(this,"publicEmitter");Ae(this,"events");Kt(this.validateHandlers(n),xe.formatMessage("Failed to apply given request handlers: invalid input. Did you forget to spread the request handlers Array?")),this.handlersController=new Jk(n),this.emitter=new Gs,this.publicEmitter=new Gs,Wk(this.emitter,this.publicEmitter),this.events=this.createLifeCycleEvents(),this.subscriptions.push(()=>{this.emitter.removeAllListeners(),this.publicEmitter.removeAllListeners()})}validateHandlers(n){return n.every(r=>!Array.isArray(r))}use(...n){Kt(this.validateHandlers(n),xe.formatMessage('Failed to call "use()" with the given request handlers: invalid input. Did you forget to spread the array of request handlers?')),this.handlersController.prepend(n)}restoreHandlers(){this.handlersController.currentHandlers().forEach(n=>{"isUsed"in n&&(n.isUsed=!1)})}resetHandlers(...n){this.handlersController.reset(n)}listHandlers(){return Hk(this.handlersController.currentHandlers())}createLifeCycleEvents(){return{on:(...n)=>this.publicEmitter.on(...n),removeListener:(...n)=>this.publicEmitter.removeListener(...n),removeAllListeners:(...n)=>this.publicEmitter.removeAllListeners(...n)}}}const Gk=/[\/\\]msw[\/\\]src[\/\\](.+)/,Yk=/(node_modules)?[\/\\]lib[\/\\](core|browser|node|native|iife)[\/\\]|^[^\/\\]*$/;function Qk(e){const t=e.stack;if(!t)return;const r=t.split(` +`).slice(1).find(o=>!(Gk.test(o)||Yk.test(o)));return r?r.replace(/\s*at [^()]*\(([^)]+)\)/,"$1").replace(/^@/,""):void 0}function Zk(e){return e?Reflect.has(e,Symbol.iterator)||Reflect.has(e,Symbol.asyncIterator):!1}const Fi=class Fi{constructor(t){Ae(this,"__kind");Ae(this,"info");Ae(this,"isUsed");Ae(this,"resolver");Ae(this,"resolverIterator");Ae(this,"resolverIteratorResult");Ae(this,"options");this.resolver=t.resolver,this.options=t.options;const n=Qk(new Error);this.info={...t.info,callFrame:n},this.isUsed=!1,this.__kind="RequestHandler"}async parse(t){return{}}async test(t){const n=await this.parse({request:t.request,resolutionContext:t.resolutionContext});return this.predicate({request:t.request,parsedResult:n,resolutionContext:t.resolutionContext})}extendResolverArgs(t){return{}}cloneRequestOrGetFromCache(t){const n=Fi.cache.get(t);if(typeof n<"u")return n;const r=t.clone();return Fi.cache.set(t,r),r}async run(t){var c,d;if(this.isUsed&&((c=this.options)!=null&&c.once))return null;const n=this.cloneRequestOrGetFromCache(t.request),r=await this.parse({request:t.request,resolutionContext:t.resolutionContext});if(!this.predicate({request:t.request,parsedResult:r,resolutionContext:t.resolutionContext})||this.isUsed&&((d=this.options)!=null&&d.once))return null;this.isUsed=!0;const o=this.wrapResolver(this.resolver),i=this.extendResolverArgs({request:t.request,parsedResult:r}),l=await o({...i,requestId:t.requestId,request:t.request}).catch(b=>{if(b instanceof Response)return b;throw b});return this.createExecutionResult({request:n,requestId:t.requestId,response:l,parsedResult:r})}wrapResolver(t){return async n=>{var i;if(!this.resolverIterator){const s=await t(n);if(!Zk(s))return s;this.resolverIterator=Symbol.iterator in s?s[Symbol.iterator]():s[Symbol.asyncIterator]()}this.isUsed=!1;const{done:r,value:a}=await this.resolverIterator.next(),o=await a;return o&&(this.resolverIteratorResult=o.clone()),r?(this.isUsed=!0,(i=this.resolverIteratorResult)==null?void 0:i.clone()):o}}createExecutionResult(t){return{handler:this,request:t.request,requestId:t.requestId,response:t.response,parsedResult:t.parsedResult}}};Ae(Fi,"cache",new WeakMap);let Ys=Fi;function Xk(e,t){return e.toLowerCase()===t.toLowerCase()}function ew(e){return e<300?"#69AB32":e<400?"#F0BB4B":"#E95F5D"}function Fr(e){const t=new Date,n=`${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}:${t.getSeconds().toString().padStart(2,"0")}`;return e!=null&&e.milliseconds?`${n}.${t.getMilliseconds().toString().padStart(3,"0")}`:n}async function tw(e){const n=await e.clone().text();return{url:new URL(e.url),method:e.method,headers:Object.fromEntries(e.headers.entries()),body:n}}var nw=Object.create,Qh=Object.defineProperty,rw=Object.getOwnPropertyDescriptor,Zh=Object.getOwnPropertyNames,aw=Object.getPrototypeOf,ow=Object.prototype.hasOwnProperty,Xh=(e,t)=>function(){return t||(0,e[Zh(e)[0]])((t={exports:{}}).exports,t),t.exports},iw=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Zh(t))!ow.call(e,a)&&a!==n&&Qh(e,a,{get:()=>t[a],enumerable:!(r=rw(t,a))||r.enumerable});return e},sw=(e,t,n)=>(n=e!=null?nw(aw(e)):{},iw(t||!e||!e.__esModule?Qh(n,"default",{value:e,enumerable:!0}):n,e)),lw=Xh({"node_modules/statuses/codes.json"(e,t){t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}}}),uw=Xh({"node_modules/statuses/index.js"(e,t){var n=lw();t.exports=s,s.message=n,s.code=r(n),s.codes=a(n),s.redirect={300:!0,301:!0,302:!0,303:!0,305:!0,307:!0,308:!0},s.empty={204:!0,205:!0,304:!0},s.retry={502:!0,503:!0,504:!0};function r(l){var u={};return Object.keys(l).forEach(function(d){var b=l[d],m=Number(d);u[b.toLowerCase()]=m}),u}function a(l){return Object.keys(l).map(function(c){return Number(c)})}function o(l){var u=l.toLowerCase();if(!Object.prototype.hasOwnProperty.call(s.code,u))throw new Error('invalid status message: "'+l+'"');return s.code[u]}function i(l){if(!Object.prototype.hasOwnProperty.call(s.message,l))throw new Error("invalid status code: "+l);return s.message[l]}function s(l){if(typeof l=="number")return i(l);if(typeof l!="string")throw new TypeError("code must be a number or string");var u=parseInt(l,10);return isNaN(u)?o(l):i(u)}}}),cw=sw(uw(),1),em=cw.default;/*! Bundled license information: + +statuses/index.js: + (*! + * statuses + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2016 Douglas Christopher Wilson + * MIT Licensed + *) +*/const{message:dw}=em;async function fw(e){const t=e.clone(),n=await t.text(),r=t.status||200,a=t.statusText||dw[r]||"OK";return{status:r,statusText:a,headers:Object.fromEntries(t.headers.entries()),body:n}}function hw(e){for(var t=[],n=0;n=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122||i===95){a+=e[o++];continue}break}if(!a)throw new TypeError("Missing parameter name at ".concat(n));t.push({type:"NAME",index:n,value:a}),n=o;continue}if(r==="("){var s=1,l="",o=n+1;if(e[o]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(o));for(;o-1)return!0}return!1},f=function(L){var G=s[s.length-1],ee=L||(G&&typeof G=="string"?G:"");if(G&&!ee)throw new TypeError('Must have text between two parameters, missing text after "'.concat(G.name,'"'));return!ee||p(ee)?"[^".concat(cr(i),"]+?"):"(?:(?!".concat(cr(ee),")[^").concat(cr(i),"])+?")};u)?(?!\?)/g,r=0,a=n.exec(e.source);a;)t.push({name:a[1]||r++,prefix:"",suffix:"",modifier:"",pattern:""}),a=n.exec(e.source);return e}function bw(e,t,n){var r=e.map(function(a){return nm(a,t,n).source});return new RegExp("(?:".concat(r.join("|"),")"),tm(n))}function kw(e,t,n){return ww(mw(e,n),t,n)}function ww(e,t,n){n===void 0&&(n={});for(var r=n.strict,a=r===void 0?!1:r,o=n.start,i=o===void 0?!0:o,s=n.end,l=s===void 0?!0:s,u=n.encode,c=u===void 0?function(G){return G}:u,d=n.delimiter,b=d===void 0?"/#?":d,m=n.endsWith,p=m===void 0?"":m,f="[".concat(cr(p),"]|$"),k="[".concat(cr(b),"]"),T=i?"^":"",A=0,y=e;A-1:H===void 0;a||(T+="(?:".concat(k,"(?=").concat(f,"))?")),L||(T+="(?=".concat(k,"|").concat(f,")"))}return new RegExp(T,tm(n))}function nm(e,t,n){return e instanceof RegExp?yw(e,t):Array.isArray(e)?bw(e,t,n):kw(e,t,n)}new TextEncoder;var Za=class extends Response{static isConfigurableStatusCode(t){return t>=200&&t<=599}static isRedirectResponse(t){return Za.STATUS_CODES_WITH_REDIRECT.includes(t)}static isResponseWithBody(t){return!Za.STATUS_CODES_WITHOUT_BODY.includes(t)}static setUrl(t,n){t&&n.url==""&&Object.defineProperty(n,"url",{value:t,enumerable:!0,configurable:!0,writable:!1})}constructor(t,n={}){var r;const a=(r=n.status)!=null?r:200,o=Za.isConfigurableStatusCode(a)?a:200,i=Za.isResponseWithBody(a)?t:null;if(super(i,{...n,status:o}),a!==o){const s=Object.getOwnPropertySymbols(this).find(l=>l.description==="state");if(s){const l=Reflect.get(this,s);Reflect.set(l,"status",a)}else Object.defineProperty(this,"status",{value:a,enumerable:!0,configurable:!0,writable:!1})}Za.setUrl(n.url,this)}},rm=Za;rm.STATUS_CODES_WITHOUT_BODY=[101,103,204,205,304];rm.STATUS_CODES_WITH_REDIRECT=[301,302,303,307,308];function am(){if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof process<"u"){const e=process.type;return e==="renderer"||e==="worker"?!1:!!(process.versions&&process.versions.node)}return!1}var vw=Object.defineProperty,jw=(e,t)=>{for(var n in t)vw(e,n,{get:t[n],enumerable:!0})},dc={};jw(dc,{blue:()=>Cw,gray:()=>fc,green:()=>Aw,red:()=>Ew,yellow:()=>_w});function _w(e){return`\x1B[33m${e}\x1B[0m`}function Cw(e){return`\x1B[34m${e}\x1B[0m`}function fc(e){return`\x1B[90m${e}\x1B[0m`}function Ew(e){return`\x1B[31m${e}\x1B[0m`}function Aw(e){return`\x1B[32m${e}\x1B[0m`}var yl=am(),om=class{constructor(t){Ae(this,"prefix");this.name=t,this.prefix=`[${this.name}]`;const n=Zd("DEBUG"),r=Zd("LOG_LEVEL");n==="1"||n==="true"||typeof n<"u"&&this.name.startsWith(n)?(this.debug=ei(r,"debug")?rn:this.debug,this.info=ei(r,"info")?rn:this.info,this.success=ei(r,"success")?rn:this.success,this.warning=ei(r,"warning")?rn:this.warning,this.error=ei(r,"error")?rn:this.error):(this.info=rn,this.success=rn,this.warning=rn,this.error=rn,this.only=rn)}extend(t){return new om(`${this.name}:${t}`)}debug(t,...n){this.logEntry({level:"debug",message:fc(t),positionals:n,prefix:this.prefix,colors:{prefix:"gray"}})}info(t,...n){this.logEntry({level:"info",message:t,positionals:n,prefix:this.prefix,colors:{prefix:"blue"}});const r=new Sw;return(a,...o)=>{r.measure(),this.logEntry({level:"info",message:`${a} ${fc(`${r.deltaTime}ms`)}`,positionals:o,prefix:this.prefix,colors:{prefix:"blue"}})}}success(t,...n){this.logEntry({level:"info",message:t,positionals:n,prefix:`✔ ${this.prefix}`,colors:{timestamp:"green",prefix:"green"}})}warning(t,...n){this.logEntry({level:"warning",message:t,positionals:n,prefix:`⚠ ${this.prefix}`,colors:{timestamp:"yellow",prefix:"yellow"}})}error(t,...n){this.logEntry({level:"error",message:t,positionals:n,prefix:`✖ ${this.prefix}`,colors:{timestamp:"red",prefix:"red"}})}only(t){t()}createEntry(t,n){return{timestamp:new Date,level:t,message:n}}logEntry(t){const{level:n,message:r,prefix:a,colors:o,positionals:i=[]}=t,s=this.createEntry(n,r),l=(o==null?void 0:o.timestamp)||"gray",u=(o==null?void 0:o.prefix)||"gray",c={timestamp:dc[l],prefix:dc[u]};this.getWriter(n)([c.timestamp(this.formatTimestamp(s.timestamp))].concat(a!=null?c.prefix(a):[]).concat(Xd(r)).join(" "),...i.map(Xd))}formatTimestamp(t){return`${t.toLocaleTimeString("en-GB")}:${t.getMilliseconds()}`}getWriter(t){switch(t){case"debug":case"success":case"info":return Tw;case"warning":return Pw;case"error":return Bw}}},Sw=class{constructor(){Ae(this,"startTime");Ae(this,"endTime");Ae(this,"deltaTime");this.startTime=performance.now()}measure(){this.endTime=performance.now();const t=this.endTime-this.startTime;this.deltaTime=t.toFixed(2)}},rn=()=>{};function Tw(e,...t){if(yl){process.stdout.write(Oo(e,...t)+` +`);return}console.log(e,...t)}function Pw(e,...t){if(yl){process.stderr.write(Oo(e,...t)+` +`);return}console.warn(e,...t)}function Bw(e,...t){if(yl){process.stderr.write(Oo(e,...t)+` +`);return}console.error(e,...t)}function Zd(e){var t;return yl?process.env[e]:(t=globalThis[e])==null?void 0:t.toString()}function ei(e,t){return e!==void 0&&e!==t}function Xd(e){return typeof e>"u"?"undefined":e===null?"null":typeof e=="string"?e:typeof e=="object"?JSON.stringify(e):e.toString()}function ef(e){return globalThis[e]||void 0}function Mw(e,t){globalThis[e]=t}function xw(e){delete globalThis[e]}var Ow=class{constructor(t){this.symbol=t,this.readyState="INACTIVE",this.emitter=new Gs,this.subscriptions=[],this.logger=new om(t.description),this.emitter.setMaxListeners(0),this.logger.info("constructing the interceptor...")}checkEnvironment(){return!0}apply(){const t=this.logger.extend("apply");if(t.info("applying the interceptor..."),this.readyState==="APPLIED"){t.info("intercepted already applied!");return}if(!this.checkEnvironment()){t.info("the interceptor cannot be applied in this environment!");return}this.readyState="APPLYING";const r=this.getInstance();if(r){t.info("found a running instance, reusing..."),this.on=(a,o)=>(t.info('proxying the "%s" listener',a),r.emitter.addListener(a,o),this.subscriptions.push(()=>{r.emitter.removeListener(a,o),t.info('removed proxied "%s" listener!',a)}),this),this.readyState="APPLIED";return}t.info("no running instance found, setting up a new instance..."),this.setup(),this.setInstance(),this.readyState="APPLIED"}setup(){}on(t,n){const r=this.logger.extend("on");return this.readyState==="DISPOSING"||this.readyState==="DISPOSED"?(r.info("cannot listen to events, already disposed!"),this):(r.info('adding "%s" event listener:',t,n),this.emitter.on(t,n),this)}once(t,n){return this.emitter.once(t,n),this}off(t,n){return this.emitter.off(t,n),this}removeAllListeners(t){return this.emitter.removeAllListeners(t),this}dispose(){const t=this.logger.extend("dispose");if(this.readyState==="DISPOSED"){t.info("cannot dispose, already disposed!");return}if(t.info("disposing the interceptor..."),this.readyState="DISPOSING",!this.getInstance()){t.info("no interceptors running, skipping dispose...");return}if(this.clearInstance(),t.info("global symbol deleted:",ef(this.symbol)),this.subscriptions.length>0){t.info("disposing of %d subscriptions...",this.subscriptions.length);for(const n of this.subscriptions)n();this.subscriptions=[],t.info("disposed of all subscriptions!",this.subscriptions.length)}this.emitter.removeAllListeners(),t.info("destroyed the listener!"),this.readyState="DISPOSED"}getInstance(){var t;const n=ef(this.symbol);return this.logger.info("retrieved global instance:",(t=n==null?void 0:n.constructor)==null?void 0:t.name),n}setInstance(){Mw(this.symbol,this),this.logger.info("set global instance!",this.symbol.description)}clearInstance(){xw(this.symbol),this.logger.info("cleared global instance!",this.symbol.description)}};function Iw(){return Math.random().toString(16).slice(2)}function Rw(e,t=!0){return[t&&e.origin,e.pathname].filter(Boolean).join("")}const Nw=/[\?|#].*$/g;function zw(e){return new URL(`/${e}`,"http://localhost").searchParams}function im(e){return e.endsWith("?")?e:e.replace(Nw,"")}function Dw(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}function Uw(e,t){if(Dw(e)||e.startsWith("*"))return e;const n=t||typeof document<"u"&&document.baseURI;return n?decodeURI(new URL(encodeURI(e),n).href):e}function Fw(e,t){if(e instanceof RegExp)return e;const n=Uw(e,t);return im(n)}function Lw(e){return e.replace(/([:a-zA-Z_-]*)(\*{1,2})+/g,(t,n,r)=>{const a="(.*)";return n?n.startsWith(":")?`${n}${r}`:`${n}${a}`:a}).replace(/([^\/])(:)(?=\d+)/,"$1\\$2").replace(/^([^\/]+)(:)(?=\/\/)/,"$1\\$2")}function qw(e,t,n){const r=Fw(t,n),a=typeof r=="string"?Lw(r):r,o=Rw(e),i=pw(a,{decode:decodeURIComponent})(o),s=i&&i.params||{};return{matches:i!==!1,params:s}}function Xi(e){if(typeof location>"u")return e.toString();const t=e instanceof URL?e:new URL(e);return t.origin===location.origin?t.pathname:t.origin+t.pathname}var $w=Object.create,sm=Object.defineProperty,Ww=Object.getOwnPropertyDescriptor,lm=Object.getOwnPropertyNames,Hw=Object.getPrototypeOf,Vw=Object.prototype.hasOwnProperty,Jw=(e,t)=>function(){return t||(0,e[lm(e)[0]])((t={exports:{}}).exports,t),t.exports},Kw=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of lm(t))!Vw.call(e,a)&&a!==n&&sm(e,a,{get:()=>t[a],enumerable:!(r=Ww(t,a))||r.enumerable});return e},Gw=(e,t,n)=>(n=e!=null?$w(Hw(e)):{},Kw(t||!e||!e.__esModule?sm(n,"default",{value:e,enumerable:!0}):n,e)),Yw=Jw({"node_modules/cookie/index.js"(e){e.parse=s,e.serialize=c;var t=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,a=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,o=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,i=/^[\u0020-\u003A\u003D-\u007E]*$/;function s(p,f){if(typeof p!="string")throw new TypeError("argument str must be a string");var k={},T=p.length;if(T<2)return k;var A=f&&f.decode||d,y=0,h=0,C=0;do{if(h=p.indexOf("=",y),h===-1)break;if(C=p.indexOf(";",y),C===-1)C=T;else if(h>C){y=p.lastIndexOf(";",h-1)+1;continue}var _=l(p,y,h),x=u(p,h,_),H=p.slice(_,x);if(!n.call(k,H)){var L=l(p,h+1,C),G=u(p,C,L);p.charCodeAt(L)===34&&p.charCodeAt(G-1)===34&&(L++,G--);var ee=p.slice(L,G);k[H]=m(ee,A)}y=C+1}while(yk;){var T=p.charCodeAt(--f);if(T!==32&&T!==9)return f+1}return k}function c(p,f,k){var T=k&&k.encode||encodeURIComponent;if(typeof T!="function")throw new TypeError("option encode is invalid");if(!r.test(p))throw new TypeError("argument name is invalid");var A=T(f);if(!a.test(A))throw new TypeError("argument val is invalid");var y=p+"="+A;if(!k)return y;if(k.maxAge!=null){var h=Math.floor(k.maxAge);if(!isFinite(h))throw new TypeError("option maxAge is invalid");y+="; Max-Age="+h}if(k.domain){if(!o.test(k.domain))throw new TypeError("option domain is invalid");y+="; Domain="+k.domain}if(k.path){if(!i.test(k.path))throw new TypeError("option path is invalid");y+="; Path="+k.path}if(k.expires){var C=k.expires;if(!b(C)||isNaN(C.valueOf()))throw new TypeError("option expires is invalid");y+="; Expires="+C.toUTCString()}if(k.httpOnly&&(y+="; HttpOnly"),k.secure&&(y+="; Secure"),k.partitioned&&(y+="; Partitioned"),k.priority){var _=typeof k.priority=="string"?k.priority.toLowerCase():k.priority;switch(_){case"low":y+="; Priority=Low";break;case"medium":y+="; Priority=Medium";break;case"high":y+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(k.sameSite){var x=typeof k.sameSite=="string"?k.sameSite.toLowerCase():k.sameSite;switch(x){case!0:y+="; SameSite=Strict";break;case"lax":y+="; SameSite=Lax";break;case"strict":y+="; SameSite=Strict";break;case"none":y+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return y}function d(p){return p.indexOf("%")!==-1?decodeURIComponent(p):p}function b(p){return t.call(p)==="[object Date]"}function m(p,f){try{return f(p)}catch{return p}}}}),Qw=Gw(Yw(),1),um=Qw.default;/*! Bundled license information: + +cookie/index.js: + (*! + * cookie + * Copyright(c) 2012-2014 Roman Shtylman + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + *) +*/var Zw=Object.create,cm=Object.defineProperty,Xw=Object.getOwnPropertyDescriptor,dm=Object.getOwnPropertyNames,ev=Object.getPrototypeOf,tv=Object.prototype.hasOwnProperty,nv=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),ut=(e,t)=>function(){return t||(0,e[dm(e)[0]])((t={exports:{}}).exports,t),t.exports},rv=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of dm(t))!tv.call(e,a)&&a!==n&&cm(e,a,{get:()=>t[a],enumerable:!(r=Xw(t,a))||r.enumerable});return e},av=(e,t,n)=>(n=e!=null?Zw(ev(e)):{},rv(t||!e||!e.__esModule?cm(n,"default",{value:e,enumerable:!0}):n,e)),fm=ut({"node_modules/punycode/punycode.js"(e,t){var n=2147483647,r=36,a=1,o=26,i=38,s=700,l=72,u=128,c="-",d=/^xn--/,b=/[^\0-\x7F]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=r-a,k=Math.floor,T=String.fromCharCode;function A(B){throw new RangeError(p[B])}function y(B,V){const ie=[];let se=B.length;for(;se--;)ie[se]=V(B[se]);return ie}function h(B,V){const ie=B.split("@");let se="";ie.length>1&&(se=ie[0]+"@",B=ie[1]),B=B.replace(m,".");const M=B.split("."),Oe=y(M,V).join(".");return se+Oe}function C(B){const V=[];let ie=0;const se=B.length;for(;ie=55296&&M<=56319&&ieString.fromCodePoint(...B),x=function(B){return B>=48&&B<58?26+(B-48):B>=65&&B<91?B-65:B>=97&&B<123?B-97:r},H=function(B,V){return B+22+75*(B<26)-((V!=0)<<5)},L=function(B,V,ie){let se=0;for(B=ie?k(B/s):B>>1,B+=k(B/V);B>f*o>>1;se+=r)B=k(B/f);return k(se+(f+1)*B/(B+i))},G=function(B){const V=[],ie=B.length;let se=0,M=u,Oe=l,Me=B.lastIndexOf(c);Me<0&&(Me=0);for(let qe=0;qe=128&&A("not-basic"),V.push(B.charCodeAt(qe));for(let qe=Me>0?Me+1:0;qe=ie&&A("invalid-input");const Ke=x(B.charCodeAt(qe++));Ke>=r&&A("invalid-input"),Ke>k((n-se)/tt)&&A("overflow"),se+=Ke*tt;const Ie=Ne<=Oe?a:Ne>=Oe+o?o:Ne-Oe;if(Kek(n/ot)&&A("overflow"),tt*=ot}const at=V.length+1;Oe=L(se-Ve,at,Ve==0),k(se/at)>n-M&&A("overflow"),M+=k(se/at),se%=at,V.splice(se++,0,M)}return String.fromCodePoint(...V)},ee=function(B){const V=[];B=C(B);const ie=B.length;let se=u,M=0,Oe=l;for(const Ve of B)Ve<128&&V.push(T(Ve));const Me=V.length;let qe=Me;for(Me&&V.push(c);qe=se&&ttk((n-M)/at)&&A("overflow"),M+=(Ve-se)*at,se=Ve;for(const tt of B)if(ttn&&A("overflow"),tt===se){let Ne=M;for(let Ke=r;;Ke+=r){const Ie=Ke<=Oe?a:Ke>=Oe+o?o:Ke-Oe;if(Ne=2&&(ee=ee.slice(2)):p(x)?ee=_[4]:x?H&&(ee=ee.slice(2)):G>=2&&p(C.protocol)&&(ee=_[4]),{protocol:x,slashes:H||p(x),slashesCount:G,rest:ee}}function k(h,C){if(h==="")return C;for(var _=(C||"/").split("/").slice(0,-1).concat(h.split("/")),x=_.length,H=_[x-1],L=!1,G=0;x--;)_[x]==="."?_.splice(x,1):_[x]===".."?(_.splice(x,1),G++):G&&(x===0&&(L=!0),_.splice(x,1),G--);return L&&_.unshift(""),(H==="."||H==="..")&&_.push(""),_.join("/")}function T(h,C,_){if(h=c(h),h=h.replace(o,""),!(this instanceof T))return new T(h,C,_);var x,H,L,G,ee,ce,N=d.slice(),R=typeof C,B=this,V=0;for(R!=="object"&&R!=="string"&&(_=C,C=null),_&&typeof _!="function"&&(_=r.parse),C=m(C),H=f(h||"",C),x=!H.protocol&&!H.slashes,B.slashes=H.slashes||x&&C.slashes,B.protocol=H.protocol||C.protocol||"",h=H.rest,(H.protocol==="file:"&&(H.slashesCount!==2||u.test(h))||!H.slashes&&(H.protocol||H.slashesCount<2||!p(B.protocol)))&&(N[3]=[/(.*)/,"pathname"]);V255)return"DOMAIN_TOO_LONG";for(var o=a.split("."),i,s=0;s63)return"LABEL_TOO_LONG";if(i.charAt(0)==="-")return"LABEL_STARTS_WITH_DASH";if(i.charAt(i.length-1)==="-")return"LABEL_ENDS_WITH_DASH";if(!/^[a-z0-9\-]+$/.test(i))return"LABEL_INVALID_CHARS"}},e.parse=function(r){if(typeof r!="string")throw new TypeError("Domain name must be a string.");var a=r.slice(0).toLowerCase();a.charAt(a.length-1)==="."&&(a=a.slice(0,a.length-1));var o=n.validate(a);if(o)return{input:r,error:{message:e.errorCodes[o],code:o}};var i={input:r,tld:null,sld:null,domain:null,subdomain:null,listed:!1},s=a.split(".");if(s[s.length-1]==="local")return i;var l=function(){return/xn--/.test(a)&&(i.domain&&(i.domain=t.toASCII(i.domain)),i.subdomain&&(i.subdomain=t.toASCII(i.subdomain))),i},u=n.findRule(a);if(!u)return s.length<2?i:(i.tld=s.pop(),i.sld=s.pop(),i.domain=[i.sld,i.tld].join("."),s.length&&(i.subdomain=s.pop()),l());i.listed=!0;var c=u.suffix.split("."),d=s.slice(0,s.length-c.length);return u.exception&&d.push(c.shift()),i.tld=c.join("."),!d.length||(u.wildcard&&(c.unshift(d.pop()),i.tld=c.join(".")),!d.length)||(i.sld=d.pop(),i.domain=[i.sld,i.tld].join("."),d.length&&(i.subdomain=d.join("."))),l()},e.get=function(r){return r&&e.parse(r).domain||null},e.isValid=function(r){var a=e.parse(r);return!!(a.domain&&a.listed)}}}),hm=ut({"node_modules/tough-cookie/lib/pubsuffix-psl.js"(e){var t=uv(),n=["local","example","invalid","localhost","test"],r=["localhost","invalid"];function a(o,i={}){const s=o.split("."),l=s[s.length-1],u=!!i.allowSpecialUseDomain,c=!!i.ignoreError;if(u&&n.includes(l)){if(s.length>1)return`${s[s.length-2]}.${l}`;if(r.includes(l))return`${l}`}if(!c&&n.includes(l))throw new Error(`Cookie has domain set to the public suffix "${l}" which is a special use domain. To allow this, configure your CookieJar with {allowSpecialUseDomain:true, rejectPublicSuffixes: false}.`);return t.get(o)}e.getPublicSuffix=a}}),mm=ut({"node_modules/tough-cookie/lib/store.js"(e){var t=class{constructor(){this.synchronous=!1}findCookie(n,r,a,o){throw new Error("findCookie is not implemented")}findCookies(n,r,a,o){throw new Error("findCookies is not implemented")}putCookie(n,r){throw new Error("putCookie is not implemented")}updateCookie(n,r,a){throw new Error("updateCookie is not implemented")}removeCookie(n,r,a,o){throw new Error("removeCookie is not implemented")}removeCookies(n,r,a){throw new Error("removeCookies is not implemented")}removeAllCookies(n){throw new Error("removeAllCookies is not implemented")}getAllCookies(n){throw new Error("getAllCookies is not implemented (therefore jar cannot be serialized)")}};e.Store=t}}),pm=ut({"node_modules/universalify/index.js"(e){e.fromCallback=function(t){return Object.defineProperty(function(){if(typeof arguments[arguments.length-1]=="function")t.apply(this,arguments);else return new Promise((n,r)=>{arguments[arguments.length]=(a,o)=>{if(a)return r(a);n(o)},arguments.length++,t.apply(this,arguments)})},"name",{value:t.name})},e.fromPromise=function(t){return Object.defineProperty(function(){const n=arguments[arguments.length-1];if(typeof n!="function")return t.apply(this,arguments);delete arguments[arguments.length-1],arguments.length--,t.apply(this,arguments).then(r=>n(null,r),n)},"name",{value:t.name})}}}),gm=ut({"node_modules/tough-cookie/lib/permuteDomain.js"(e){var t=hm();function n(r,a){const o=t.getPublicSuffix(r,{allowSpecialUseDomain:a});if(!o)return null;if(o==r)return[r];r.slice(-1)=="."&&(r=r.slice(0,-1));const s=r.slice(0,-(o.length+1)).split(".").reverse();let l=o;const u=[l];for(;s.length;)l=`${s.shift()}.${l}`,u.push(l);return u}e.permuteDomain=n}}),ym=ut({"node_modules/tough-cookie/lib/pathMatch.js"(e){function t(n,r){return r===n||n.indexOf(r)===0&&(r.substr(-1)==="/"||n.substr(r.length,1)==="/")}e.pathMatch=t}}),bm=ut({"node_modules/tough-cookie/lib/utilHelper.js"(e){function t(){try{return nv("util")}catch{return null}}function n(){return Symbol.for("nodejs.util.inspect.custom")}function r(a){const i=(a.requireUtil||t)();return i?i.inspect.custom:null}e.getUtilInspect=function(o,i={}){const l=(i.requireUtil||t)();return function(c,d,b){return l?l.inspect(c,d,b):o(c)}},e.getCustomInspectSymbol=function(o={}){return(o.lookupCustomInspectSymbol||n)()||r(o)}}}),cv=ut({"node_modules/tough-cookie/lib/memstore.js"(e){var{fromCallback:t}=pm(),n=mm().Store,r=gm().permuteDomain,a=ym().pathMatch,{getCustomInspectSymbol:o,getUtilInspect:i}=bm(),s=class extends n{constructor(){super(),this.synchronous=!0,this.idx=Object.create(null);const d=o();d&&(this[d]=this.inspect)}inspect(){return`{ idx: ${{inspect:i(l)}.inspect(this.idx,!1,2)} }`}findCookie(d,b,m,p){return!this.idx[d]||!this.idx[d][b]?p(null,void 0):p(null,this.idx[d][b][m]||null)}findCookies(d,b,m,p){const f=[];if(typeof m=="function"&&(p=m,m=!0),!d)return p(null,[]);let k;b?k=function(h){Object.keys(h).forEach(C=>{if(a(b,C)){const _=h[C];for(const x in _)f.push(_[x])}})}:k=function(h){for(const C in h){const _=h[C];for(const x in _)f.push(_[x])}};const T=r(d,m)||[d],A=this.idx;T.forEach(y=>{const h=A[y];h&&k(h)}),p(null,f)}putCookie(d,b){this.idx[d.domain]||(this.idx[d.domain]=Object.create(null)),this.idx[d.domain][d.path]||(this.idx[d.domain][d.path]=Object.create(null)),this.idx[d.domain][d.path][d.key]=d,b(null)}updateCookie(d,b,m){this.putCookie(b,m)}removeCookie(d,b,m,p){this.idx[d]&&this.idx[d][b]&&this.idx[d][b][m]&&delete this.idx[d][b][m],p(null)}removeCookies(d,b,m){return this.idx[d]&&(b?delete this.idx[d][b]:delete this.idx[d]),m(null)}removeAllCookies(d){return this.idx=Object.create(null),d(null)}getAllCookies(d){const b=[],m=this.idx;Object.keys(m).forEach(f=>{Object.keys(m[f]).forEach(T=>{Object.keys(m[f][T]).forEach(y=>{y!==null&&b.push(m[f][T][y])})})}),b.sort((f,k)=>(f.creationIndex||0)-(k.creationIndex||0)),d(null,b)}};["findCookie","findCookies","putCookie","updateCookie","removeCookie","removeCookies","removeAllCookies","getAllCookies"].forEach(d=>{s.prototype[d]=t(s.prototype[d])}),e.MemoryCookieStore=s;function l(d){const b=Object.keys(d);if(b.length===0)return"[Object: null prototype] {}";let m=`[Object: null prototype] { +`;return Object.keys(d).forEach((p,f)=>{m+=u(p,d[p]),f{p+=c(f,b[f]),k{const A=b[f];p+=` ${f}: ${A.inspect()}`,k=58)break;F++}return FI||!W&&F!=D.length?null:parseInt(D.substr(0,F),10)}function G(D){const S=D.split(":"),I=[0,0,0];if(S.length!==3)return null;for(let W=0;W<3;W++){const F=W==2,oe=L(S[W],1,2,F);if(oe===null)return null;I[W]=oe}return I}function ee(D){D=String(D).substr(0,3).toLowerCase();const S=k[D];return S>=0?S:null}function ce(D){if(!D)return;const S=D.split(f);if(!S)return;let I=null,W=null,F=null,oe=null,ge=null,_e=null;for(let Re=0;Re=70&&_e<=99?_e+=1900:_e>=0&&_e<=69&&(_e+=2e3)))}if(!(oe===null||ge===null||_e===null||F===null||oe<1||oe>31||_e<1601||I>23||W>59||F>59))return new Date(Date.UTC(_e,ge,oe,I,W,F))}function N(D){return s.validate(s.isDate(D),D),D.toUTCString()}function R(D){return D==null?null:(D=D.trim().replace(/^\./,""),H.test(D)&&(D=D.replace("[","").replace("]","")),t&&/[^\u0001-\u007f]/.test(D)&&(D=t.toASCII(D)),D.toLowerCase())}function B(D,S,I){if(D==null||S==null)return null;if(I!==!1&&(D=R(D),S=R(S)),D==S)return!0;const W=D.lastIndexOf(S);return!(W<=0||D.length!==S.length+W||D.substr(W-1,1)!=="."||_.test(D))}function V(D){if(!D||D.substr(0,1)!=="/")return"/";if(D==="/")return D;const S=D.lastIndexOf("/");return S===0?"/":D.slice(0,S)}function ie(D){if(s.isEmptyString(D))return D;for(let S=0;S1;){const I=D.lastIndexOf("/");if(I===0)break;D=D.substr(0,I),S.push(D)}return S.push("/"),S}function Ne(D){if(D instanceof Object)return D;try{D=decodeURI(D)}catch{}return n(D)}var Ke={key:"",value:"",expires:"Infinity",maxAge:null,domain:null,path:null,secure:!1,httpOnly:!1,extensions:null,hostOnly:null,pathIsDefault:null,creation:null,lastAccessed:null,sameSite:void 0},Ie=class Ds{constructor(S={}){const I=c();I&&(this[I]=this.inspect),Object.assign(this,Ke,S),this.creation=this.creation||new Date,Object.defineProperty(this,"creationIndex",{configurable:!1,enumerable:!1,writable:!0,value:++Ds.cookiesCreated})}inspect(){const S=Date.now(),I=this.hostOnly!=null?this.hostOnly:"?",W=this.creation?`${S-this.creation.getTime()}ms`:"?",F=this.lastAccessed?`${S-this.lastAccessed.getTime()}ms`:"?";return`Cookie="${this.toString()}; hostOnly=${I}; aAge=${F}; cAge=${W}"`}toJSON(){const S={};for(const I of Ds.serializableProperties)this[I]!==Ke[I]&&(I==="expires"||I==="creation"||I==="lastAccessed"?this[I]===null?S[I]=null:S[I]=this[I]=="Infinity"?"Infinity":this[I].toISOString():I==="maxAge"?this[I]!==null&&(S[I]=this[I]==1/0||this[I]==-1/0?this[I].toString():this[I]):this[I]!==Ke[I]&&(S[I]=this[I]));return S}clone(){return Ve(this.toJSON())}validate(){if(!d.test(this.value)||this.expires!=1/0&&!(this.expires instanceof Date)&&!ce(this.expires)||this.maxAge!=null&&this.maxAge<=0||this.path!=null&&!p.test(this.path))return!1;const S=this.cdomain();return!(S&&(S.match(/\.$/)||r.getPublicSuffix(S)==null))}setExpires(S){S instanceof Date?this.expires=S:this.expires=ce(S)||"Infinity"}setMaxAge(S){S===1/0||S===-1/0?this.maxAge=S.toString():this.maxAge=S}cookieString(){let S=this.value;return S==null&&(S=""),this.key===""?S:`${this.key}=${S}`}toString(){let S=this.cookieString();if(this.expires!=1/0&&(this.expires instanceof Date?S+=`; Expires=${N(this.expires)}`:S+=`; Expires=${this.expires}`),this.maxAge!=null&&this.maxAge!=1/0&&(S+=`; Max-Age=${this.maxAge}`),this.domain&&!this.hostOnly&&(S+=`; Domain=${this.domain}`),this.path&&(S+=`; Path=${this.path}`),this.secure&&(S+="; Secure"),this.httpOnly&&(S+="; HttpOnly"),this.sameSite&&this.sameSite!=="none"){const I=Ds.sameSiteCanonical[this.sameSite.toLowerCase()];S+=`; SameSite=${I||this.sameSite}`}return this.extensions&&this.extensions.forEach(I=>{S+=`; ${I}`}),S}TTL(S){if(this.maxAge!=null)return this.maxAge<=0?0:this.maxAge*1e3;let I=this.expires;return I!=1/0?(I instanceof Date||(I=ce(I)||1/0),I==1/0?1/0:I.getTime()-(S||Date.now())):1/0}expiryTime(S){if(this.maxAge!=null){const I=S||this.creation||new Date,W=this.maxAge<=0?-1/0:this.maxAge*1e3;return I.getTime()+W}return this.expires==1/0?1/0:this.expires.getTime()}expiryDate(S){const I=this.expiryTime(S);return I==1/0?new Date(T):I==-1/0?new Date(A):new Date(I)}isPersistent(){return this.maxAge!=null||this.expires!=1/0}canonicalizedDomain(){return this.domain==null?null:R(this.domain)}cdomain(){return this.canonicalizedDomain()}};Ie.cookiesCreated=0,Ie.parse=M,Ie.fromJSON=Ve,Ie.serializableProperties=Object.keys(Ke),Ie.sameSiteLevel={strict:3,lax:2,none:1},Ie.sameSiteCanonical={strict:"Strict",lax:"Lax"};function ot(D){if(D!=null){const S=D.toLowerCase();switch(S){case C.STRICT:case C.SILENT:case C.DISABLED:return S}}return C.SILENT}var wt=class Us{constructor(S,I={rejectPublicSuffixes:!0}){typeof I=="boolean"&&(I={rejectPublicSuffixes:I}),s.validate(s.isObject(I),I),this.rejectPublicSuffixes=I.rejectPublicSuffixes,this.enableLooseMode=!!I.looseMode,this.allowSpecialUseDomain=typeof I.allowSpecialUseDomain=="boolean"?I.allowSpecialUseDomain:!0,this.store=S||new o,this.prefixSecurity=ot(I.prefixSecurity),this._cloneSync=Dt("clone"),this._importCookiesSync=Dt("_importCookies"),this.getCookiesSync=Dt("getCookies"),this.getCookieStringSync=Dt("getCookieString"),this.getSetCookieStringsSync=Dt("getSetCookieStrings"),this.removeAllCookiesSync=Dt("removeAllCookies"),this.setCookieSync=Dt("setCookie"),this.serializeSync=Dt("serialize")}setCookie(S,I,W,F){s.validate(s.isUrlStringOrObject(I),F,W);let oe;if(s.isFunction(I))return F=I,F(new Error("No URL was specified"));const ge=Ne(I);if(s.isFunction(W)&&(F=W,W={}),s.validate(s.isFunction(F),F),!s.isNonEmptyString(S)&&!s.isObject(S)&&S instanceof String&&S.length==0)return F(null);const _e=R(ge.hostname),Re=W.loose||this.enableLooseMode;let Se=null;if(W.sameSiteContext&&(Se=h(W.sameSiteContext),!Se))return F(new Error(y));if(typeof S=="string"||S instanceof String){if(S=Ie.parse(S,{loose:Re}),!S)return oe=new Error("Cookie failed to parse"),F(W.ignoreError?null:oe)}else if(!(S instanceof Ie))return oe=new Error("First argument to setCookie must be a Cookie object or string"),F(W.ignoreError?null:oe);const ye=W.now||new Date;if(this.rejectPublicSuffixes&&S.domain&&r.getPublicSuffix(S.cdomain(),{allowSpecialUseDomain:this.allowSpecialUseDomain,ignoreError:W.ignoreError})==null&&!H.test(S.domain))return oe=new Error("Cookie has domain set to a public suffix"),F(W.ignoreError?null:oe);if(S.domain){if(!B(_e,S.cdomain(),!1))return oe=new Error(`Cookie not in this host's domain. Cookie:${S.cdomain()} Request:${_e}`),F(W.ignoreError?null:oe);S.hostOnly==null&&(S.hostOnly=!1)}else S.hostOnly=!0,S.domain=_e;if((!S.path||S.path[0]!=="/")&&(S.path=V(ge.pathname),S.pathIsDefault=!0),W.http===!1&&S.httpOnly)return oe=new Error("Cookie is HttpOnly and this isn't an HTTP API"),F(W.ignoreError?null:oe);if(S.sameSite!=="none"&&S.sameSite!==void 0&&Se&&Se==="none")return oe=new Error("Cookie is SameSite but this is a cross-origin request"),F(W.ignoreError?null:oe);const nn=this.prefixSecurity===C.SILENT;if(!(this.prefixSecurity===C.DISABLED)){let j=!1,E;if(Oe(S)?Me(S)||(j=!0,E="Cookie has __Host prefix but either Secure or HostOnly attribute is not set or Path is not '/'"):(j=!0,E="Cookie has __Secure prefix but Secure attribute is not set"),j)return F(W.ignoreError||nn?null:new Error(E))}const P=this.store;P.updateCookie||(P.updateCookie=function(j,E,O){this.putCookie(E,O)});function g(j,E){if(j)return F(j);const O=function(v){if(v)return F(v);F(null,S)};if(E){if(W.http===!1&&E.httpOnly)return j=new Error("old Cookie is HttpOnly and this isn't an HTTP API"),F(W.ignoreError?null:j);S.creation=E.creation,S.creationIndex=E.creationIndex,S.lastAccessed=ye,P.updateCookie(E,S,O)}else S.creation=S.lastAccessed=ye,P.putCookie(S,O)}P.findCookie(S.domain,S.path,S.key,g)}getCookies(S,I,W){s.validate(s.isUrlStringOrObject(S),W,S);const F=Ne(S);s.isFunction(I)&&(W=I,I={}),s.validate(s.isObject(I),W,I),s.validate(s.isFunction(W),W);const oe=R(F.hostname),ge=F.pathname||"/";let _e=I.secure;_e==null&&F.protocol&&(F.protocol=="https:"||F.protocol=="wss:")&&(_e=!0);let Re=0;if(I.sameSiteContext){const j=h(I.sameSiteContext);if(Re=Ie.sameSiteLevel[j],!Re)return W(new Error(y))}let Se=I.http;Se==null&&(Se=!0);const ye=I.now||Date.now(),nn=I.expire!==!1,it=!!I.allPaths,P=this.store;function g(j){if(j.hostOnly){if(j.domain!=oe)return!1}else if(!B(oe,j.domain,!1))return!1;return!it&&!i(ge,j.path)||j.secure&&!_e||j.httpOnly&&!Se||Re&&Ie.sameSiteLevel[j.sameSite||"none"]>Re?!1:nn&&j.expiryTime()<=ye?(P.removeCookie(j.domain,j.path,j.key,()=>{}),!1):!0}P.findCookies(oe,it?null:ge,this.allowSpecialUseDomain,(j,E)=>{if(j)return W(j);E=E.filter(g),I.sort!==!1&&(E=E.sort(at));const O=new Date;for(const v of E)v.lastAccessed=O;W(null,E)})}getCookieString(...S){const I=S.pop();s.validate(s.isFunction(I),I);const W=function(F,oe){F?I(F):I(null,oe.sort(at).map(ge=>ge.cookieString()).join("; "))};S.push(W),this.getCookies.apply(this,S)}getSetCookieStrings(...S){const I=S.pop();s.validate(s.isFunction(I),I);const W=function(F,oe){F?I(F):I(null,oe.map(ge=>ge.toString()))};S.push(W),this.getCookies.apply(this,S)}serialize(S){s.validate(s.isFunction(S),S);let I=this.store.constructor.name;s.isObject(I)&&(I=null);const W={version:`tough-cookie@${l}`,storeType:I,rejectPublicSuffixes:!!this.rejectPublicSuffixes,enableLooseMode:!!this.enableLooseMode,allowSpecialUseDomain:!!this.allowSpecialUseDomain,prefixSecurity:ot(this.prefixSecurity),cookies:[]};if(!(this.store.getAllCookies&&typeof this.store.getAllCookies=="function"))return S(new Error("store does not support getAllCookies and cannot be serialized"));this.store.getAllCookies((F,oe)=>F?S(F):(W.cookies=oe.map(ge=>(ge=ge instanceof Ie?ge.toJSON():ge,delete ge.creationIndex,ge)),S(null,W)))}toJSON(){return this.serializeSync()}_importCookies(S,I){let W=S.cookies;if(!W||!Array.isArray(W))return I(new Error("serialized jar has no cookies array"));W=W.slice();const F=oe=>{if(oe)return I(oe);if(!W.length)return I(oe,this);let ge;try{ge=Ve(W.shift())}catch(_e){return I(_e)}if(ge===null)return F(null);this.store.putCookie(ge,F)};F()}clone(S,I){arguments.length===1&&(I=S,S=null),this.serialize((W,F)=>{if(W)return I(W);Us.deserialize(F,S,I)})}cloneSync(S){if(arguments.length===0)return this._cloneSync();if(!S.synchronous)throw new Error("CookieJar clone destination store is not synchronous; use async API instead.");return this._cloneSync(S)}removeAllCookies(S){s.validate(s.isFunction(S),S);const I=this.store;if(typeof I.removeAllCookies=="function"&&I.removeAllCookies!==a.prototype.removeAllCookies)return I.removeAllCookies(S);I.getAllCookies((W,F)=>{if(W)return S(W);if(F.length===0)return S(null);let oe=0;const ge=[];function _e(Re){if(Re&&ge.push(Re),oe++,oe===F.length)return S(ge.length?ge[0]:null)}F.forEach(Re=>{I.removeCookie(Re.domain,Re.path,Re.key,_e)})})}static deserialize(S,I,W){arguments.length!==3&&(W=I,I=null),s.validate(s.isFunction(W),W);let F;if(typeof S=="string"){if(F=qe(S),F instanceof Error)return W(F)}else F=S;const oe=new Us(I,{rejectPublicSuffixes:F.rejectPublicSuffixes,looseMode:F.enableLooseMode,allowSpecialUseDomain:F.allowSpecialUseDomain,prefixSecurity:F.prefixSecurity});oe._importCookies(F,ge=>{if(ge)return W(ge);W(null,oe)})}static deserializeSync(S,I){const W=typeof S=="string"?JSON.parse(S):S,F=new Us(I,{rejectPublicSuffixes:W.rejectPublicSuffixes,looseMode:W.enableLooseMode});if(!F.store.synchronous)throw new Error("CookieJar store is not synchronous; use async API instead.");return F._importCookiesSync(W),F}};wt.fromJSON=wt.deserializeSync,["_importCookies","clone","getCookies","getCookieString","getSetCookieStrings","removeAllCookies","serialize","setCookie"].forEach(D=>{wt.prototype[D]=u(wt.prototype[D])}),wt.deserialize=u(wt.deserialize);function Dt(D){return function(...S){if(!this.store.synchronous)throw new Error("CookieJar store is not synchronous; use async API instead.");let I,W;if(this[D](...S,(F,oe)=>{I=F,W=oe}),I)throw I;return W}}e.version=l,e.CookieJar=wt,e.Cookie=Ie,e.Store=a,e.MemoryCookieStore=o,e.parseDate=ce,e.formatDate=N,e.parse=M,e.fromJSON=Ve,e.domainMatch=B,e.defaultPath=V,e.pathMatch=i,e.getPublicSuffix=r.getPublicSuffix,e.cookieCompare=at,e.permuteDomain=gm().permuteDomain,e.permutePath=tt,e.canonicalDomain=R,e.PrefixSecurityEnum=C,e.ParameterError=s.ParameterError}}),mv=av(hv(),1),pv=mv.default;/*! Bundled license information: + +tough-cookie/lib/pubsuffix-psl.js: + (*! + * Copyright (c) 2018, Salesforce.com, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Salesforce.com nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *) + +tough-cookie/lib/store.js: + (*! + * Copyright (c) 2015, Salesforce.com, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Salesforce.com nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *) + +tough-cookie/lib/permuteDomain.js: + (*! + * Copyright (c) 2015, Salesforce.com, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Salesforce.com nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *) + +tough-cookie/lib/pathMatch.js: + (*! + * Copyright (c) 2015, Salesforce.com, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Salesforce.com nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *) + +tough-cookie/lib/memstore.js: + (*! + * Copyright (c) 2015, Salesforce.com, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Salesforce.com nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *) + +tough-cookie/lib/cookie.js: + (*! + * Copyright (c) 2015-2020, Salesforce.com, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Salesforce.com nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *) +*/const{Cookie:gv,CookieJar:yv,Store:bv,MemoryCookieStore:kv,domainMatch:wv,pathMatch:vv}=pv;class jv extends bv{constructor(){super();Ae(this,"storage");Ae(this,"storageKey");Kt(typeof localStorage<"u","Failed to create a WebStorageCookieStore: `localStorage` is not available in this environment. This is likely an issue with MSW. Please report it on GitHub: https://github.com/mswjs/msw/issues"),this.synchronous=!0,this.storage=localStorage,this.storageKey="__msw-cookie-store__"}findCookie(n,r,a,o){try{const i=this.getStore(),s=this.filterCookiesFromList(i,{domain:n,path:r,key:a});o(null,s[0]||null)}catch(i){i instanceof Error&&o(i,null)}}findCookies(n,r,a,o){if(!n){o(null,[]);return}try{const i=this.getStore(),s=this.filterCookiesFromList(i,{domain:n,path:r});o(null,s)}catch(i){i instanceof Error&&o(i,[])}}putCookie(n,r){try{if(n.maxAge===0)return;const a=this.getStore();a.push(n),this.updateStore(a)}catch(a){a instanceof Error&&r(a)}}updateCookie(n,r,a){if(r.maxAge===0){this.removeCookie(r.domain||"",r.path||"",r.key,a);return}this.putCookie(r,a)}removeCookie(n,r,a,o){try{const i=this.getStore(),s=this.deleteCookiesFromList(i,{domain:n,path:r,key:a});this.updateStore(s),o(null)}catch(i){i instanceof Error&&o(i)}}removeCookies(n,r,a){try{const o=this.getStore(),i=this.deleteCookiesFromList(o,{domain:n,path:r});this.updateStore(i),a(null)}catch(o){o instanceof Error&&a(o)}}getAllCookies(n){try{n(null,this.getStore())}catch(r){r instanceof Error&&n(r,[])}}getStore(){try{const n=this.storage.getItem(this.storageKey);if(n==null)return[];const r=JSON.parse(n),a=[];for(const o of r){const i=gv.fromJSON(o);i!=null&&a.push(i)}return a}catch{return[]}}updateStore(n){this.storage.setItem(this.storageKey,JSON.stringify(n.map(r=>r.toJSON())))}filterCookiesFromList(n,r){const a=[];for(const o of n)r.domain&&!wv(r.domain,o.domain||"")||r.path&&!vv(r.path,o.path||"")||r.key&&o.key!==r.key||a.push(o);return a}deleteCookiesFromList(n,r){const a=this.filterCookiesFromList(n,r);return n.filter(o=>!a.includes(o))}}const _v=am()?new kv:new jv,km=new yv(_v);function wm(e){const t=um.parse(e),n={};for(const r in t)typeof t[r]<"u"&&(n[r]=t[r]);return n}function tf(){return wm(document.cookie)}function Cv(e){if(typeof document>"u"||typeof location>"u")return{};switch(e.credentials){case"same-origin":{const t=new URL(e.url);return location.origin===t.origin?tf():{}}case"include":return tf();default:return{}}}function Ev(e){const t=e.headers.get("cookie"),n=t?wm(t):{},r=Cv(e);for(const i in r)e.headers.append("cookie",um.serialize(i,r[i]));const a=km.getCookiesSync(e.url),o=Object.fromEntries(a.map(i=>[i.key,i.value]));for(const i of a)e.headers.append("cookie",i.toString());return{...r,...o,...n}}var or=(e=>(e.HEAD="HEAD",e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.OPTIONS="OPTIONS",e.DELETE="DELETE",e))(or||{});class Av extends Ys{constructor(t,n,r,a){super({info:{header:`${t} ${n}`,path:n,method:t},resolver:r,options:a}),this.checkRedundantQueryParameters()}checkRedundantQueryParameters(){const{method:t,path:n}=this.info;if(n instanceof RegExp||im(n)===n)return;zw(n).forEach((o,i)=>{}),xe.warn(`Found a redundant usage of query parameters in the request handler URL for "${t} ${n}". Please match against a path instead and access query parameters using "new URL(request.url).searchParams" instead. Learn more: https://mswjs.io/docs/recipes/query-parameters`)}async parse(t){var o;const n=new URL(t.request.url),r=qw(n,this.info.path,(o=t.resolutionContext)==null?void 0:o.baseUrl),a=Ev(t.request);return{match:r,cookies:a}}predicate(t){const n=this.matchMethod(t.request.method),r=t.parsedResult.match.matches;return n&&r}matchMethod(t){return this.info.method instanceof RegExp?this.info.method.test(t):Xk(this.info.method,t)}extendResolverArgs(t){var n;return{params:((n=t.parsedResult.match)==null?void 0:n.params)||{},cookies:t.parsedResult.cookies}}async log(t){const n=Xi(t.request.url),r=await tw(t.request),a=await fw(t.response),o=ew(a.status);console.groupCollapsed(xe.formatMessage(`${Fr()} ${t.request.method} ${n} (%c${a.status} ${a.statusText}%c)`),`color:${o}`,"color:inherit"),console.log("Request",r),console.log("Handler:",this),console.log("Response",a),console.groupEnd()}}function er(e){return(t,n,r={})=>new Av(e,t,n,r)}const ti={all:er(/.+/),head:er(or.HEAD),get:er(or.GET),post:er(or.POST),put:er(or.PUT),delete:er(or.DELETE),patch:er(or.PATCH),options:er(or.OPTIONS)};var Sv=Object.create,vm=Object.defineProperty,Tv=Object.getOwnPropertyDescriptor,jm=Object.getOwnPropertyNames,Pv=Object.getPrototypeOf,Bv=Object.prototype.hasOwnProperty,Mv=(e,t)=>function(){return t||(0,e[jm(e)[0]])((t={exports:{}}).exports,t),t.exports},xv=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of jm(t))!Bv.call(e,a)&&a!==n&&vm(e,a,{get:()=>t[a],enumerable:!(r=Tv(t,a))||r.enumerable});return e},Ov=(e,t,n)=>(n=e!=null?Sv(Pv(e)):{},xv(t||!e||!e.__esModule?vm(n,"default",{value:e,enumerable:!0}):n,e)),Iv=Mv({"node_modules/set-cookie-parser/lib/set-cookie.js"(e,t){var n={decodeValues:!0,map:!1,silent:!1};function r(l){return typeof l=="string"&&!!l.trim()}function a(l,u){var c=l.split(";").filter(r),d=c.shift(),b=o(d),m=b.name,p=b.value;u=u?Object.assign({},n,u):n;try{p=u.decodeValues?decodeURIComponent(p):p}catch(k){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+p+"'. Set options.decodeValues to false to disable this feature.",k)}var f={name:m,value:p};return c.forEach(function(k){var T=k.split("="),A=T.shift().trimLeft().toLowerCase(),y=T.join("=");A==="expires"?f.expires=new Date(y):A==="max-age"?f.maxAge=parseInt(y,10):A==="secure"?f.secure=!0:A==="httponly"?f.httpOnly=!0:A==="samesite"?f.sameSite=y:f[A]=y}),f}function o(l){var u="",c="",d=l.split("=");return d.length>1?(u=d.shift(),c=d.join("=")):c=l,{name:u,value:c}}function i(l,u){if(u=u?Object.assign({},n,u):n,!l)return u.map?{}:[];if(l.headers)if(typeof l.headers.getSetCookie=="function")l=l.headers.getSetCookie();else if(l.headers["set-cookie"])l=l.headers["set-cookie"];else{var c=l.headers[Object.keys(l.headers).find(function(b){return b.toLowerCase()==="set-cookie"})];!c&&l.headers.cookie&&!u.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),l=c}if(Array.isArray(l)||(l=[l]),u=u?Object.assign({},n,u):n,u.map){var d={};return l.filter(r).reduce(function(b,m){var p=a(m,u);return b[p.name]=p,b},d)}else return l.filter(r).map(function(b){return a(b,u)})}function s(l){if(Array.isArray(l))return l;if(typeof l!="string")return[];var u=[],c=0,d,b,m,p,f;function k(){for(;c=l.length)&&u.push(l.substring(d,l.length))}return u}t.exports=i,t.exports.parse=i,t.exports.parseString=a,t.exports.splitCookiesString=s}}),Rv=Ov(Iv()),Nv=/[^a-z0-9\-#$%&'*+.^_`|~]/i;function ni(e){if(Nv.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}var nf=[String.fromCharCode(10),String.fromCharCode(13),String.fromCharCode(9),String.fromCharCode(32)],zv=new RegExp(`(^[${nf.join("")}]|$[${nf.join("")}])`,"g");function Iu(e){return e.replace(zv,"")}function ri(e){if(typeof e!="string"||e.length===0)return!1;for(let t=0;t127||!Dv(n))return!1}return!0}function Dv(e){return![127,32,"(",")","<",">","@",",",";",":","\\",'"',"/","[","]","?","=","{","}"].includes(e)}function rf(e){if(typeof e!="string"||e.trim()!==e)return!1;for(let t=0;t{this.append(a,r)},this):Array.isArray(t)?t.forEach(([n,r])=>{this.append(n,Array.isArray(r)?r.join(af):r)}):t&&Object.getOwnPropertyNames(t).forEach(n=>{const r=t[n];this.append(n,Array.isArray(r)?r.join(af):r)})}[(of=Va,sf=Ru,lf=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}*keys(){for(const[t]of this.entries())yield t}*values(){for(const[,t]of this.entries())yield t}*entries(){let t=Object.keys(this[Va]).sort((n,r)=>n.localeCompare(r));for(const n of t)if(n==="set-cookie")for(const r of this.getSetCookie())yield[n,r];else yield[n,this.get(n)]}has(t){if(!ri(t))throw new TypeError(`Invalid header name "${t}"`);return this[Va].hasOwnProperty(ni(t))}get(t){if(!ri(t))throw TypeError(`Invalid header name "${t}"`);return this[Va][ni(t)]??null}set(t,n){if(!ri(t)||!rf(n))return;const r=ni(t),a=Iu(n);this[Va][r]=Iu(a),this[Ru].set(r,t)}append(t,n){if(!ri(t)||!rf(n))return;const r=ni(t),a=Iu(n);let o=this.has(r)?`${this.get(r)}, ${a}`:a;this.set(t,o)}delete(t){if(!ri(t)||!this.has(t))return;const n=ni(t);delete this[Va][n],this[Ru].delete(n)}forEach(t,n){for(const[r,a]of this.entries())t.call(n,a,r,this)}getSetCookie(){const t=this.get("set-cookie");return t===null?[]:t===""?[""]:(0,Rv.splitCookiesString)(t)}};const Fv=Symbol("kDispatchEvent");function Lv(){const e=(t,n)=>{e.state="pending",e.resolve=r=>{if(e.state!=="pending")return;e.result=r;const a=o=>(e.state="fulfilled",o);return t(r instanceof Promise?r:Promise.resolve(r).then(a))},e.reject=r=>{if(e.state==="pending")return queueMicrotask(()=>{e.state="rejected"}),n(e.rejectionReason=r)}};return e}var dr,co,Fs,Kh,qv=(Kh=class extends Promise{constructor(n=null){const r=Lv();super((a,o)=>{r(a,o),n==null||n(r.resolve,r.reject)});Xo(this,co);Xo(this,dr,void 0);Ae(this,"resolve");Ae(this,"reject");Ou(this,dr,r),this.resolve=_n(this,dr).resolve,this.reject=_n(this,dr).reject}get state(){return _n(this,dr).state}get rejectionReason(){return _n(this,dr).rejectionReason}then(n,r){return Wr(this,co,Fs).call(this,super.then(n,r))}catch(n){return Wr(this,co,Fs).call(this,super.catch(n))}finally(n){return Wr(this,co,Fs).call(this,super.finally(n))}},dr=new WeakMap,co=new WeakSet,Fs=function(n){return Object.defineProperties(n,{resolve:{configurable:!0,value:this.resolve},reject:{configurable:!0,value:this.reject}})},Kh),$v=async e=>{try{return{error:null,data:await e().catch(n=>{throw n})}}catch(t){return{error:t,data:null}}};const Wv=async({request:e,requestId:t,handlers:n,resolutionContext:r})=>{let a=null,o=null;for(const i of n)if(o=await i.run({request:e,requestId:t,resolutionContext:r}),o!==null&&(a=i),o!=null&&o.response)break;return a?{handler:a,parsedResult:o==null?void 0:o.parsedResult,response:o==null?void 0:o.response}:null};async function Cm(e,t="warn"){const n=new URL(e.url),r=Xi(n)+n.search,a=e.method==="HEAD"||e.method==="GET"?null:await e.clone().text(),i=`intercepted a request without a matching request handler:${` + + • ${e.method} ${r} + +${a?` • Request body: ${a} + +`:""}`}If you still wish to intercept this unhandled request, please create a request handler for it. +Read more: https://mswjs.io/docs/getting-started/mocks`;function s(l){switch(l){case"error":throw xe.error("Error: %s",i),new Qd(xe.formatMessage('Cannot bypass a request when using the "error" strategy for the "onUnhandledRequest" option.'));case"warn":{xe.warn("Warning: %s",i);break}case"bypass":break;default:throw new Qd(xe.formatMessage('Failed to react to an unhandled request: unknown strategy "%s". Please provide one of the supported strategies ("bypass", "warn", "error") or a custom callback function as the value of the "onUnhandledRequest" option.',l))}}if(typeof t=="function"){t(e,{warning:s.bind(null,"warn"),error:s.bind(null,"error")});return}n.protocol!=="file:"&&s(t)}const{message:Hv}=em,Em=Symbol("kSetCookie");function Hr(e={}){const t=(e==null?void 0:e.status)||200,n=(e==null?void 0:e.statusText)||Hv[t]||"",r=new Headers(e==null?void 0:e.headers);return{...e,headers:r,status:t,statusText:n}}function Vv(e,t){t.type&&Object.defineProperty(e,"type",{value:t.type,enumerable:!0,writable:!1});const n=t.headers.get("set-cookie");if(n&&(Object.defineProperty(e,Em,{value:n,enumerable:!1,writable:!1}),typeof document<"u")){const r=Uv.prototype.getSetCookie.call(t.headers);for(const a of r)document.cookie=a}return e}function Jv(e,t){const n=Reflect.get(t,Em);n&&km.setCookie(n,e.url)}async function Am(e,t,n,r,a,o){var u,c,d,b,m,p;if(a.emit("request:start",{request:e,requestId:t}),(u=e.headers.get("accept"))!=null&&u.includes("msw/passthrough")){a.emit("request:end",{request:e,requestId:t}),(c=o==null?void 0:o.onPassthroughResponse)==null||c.call(o,e);return}const i=await $v(()=>Wv({request:e,requestId:t,handlers:n,resolutionContext:o==null?void 0:o.resolutionContext}));if(i.error)throw a.emit("unhandledException",{error:i.error,request:e,requestId:t}),i.error;if(!i.data){await Cm(e,r.onUnhandledRequest),a.emit("request:unhandled",{request:e,requestId:t}),a.emit("request:end",{request:e,requestId:t}),(d=o==null?void 0:o.onPassthroughResponse)==null||d.call(o,e);return}const{response:s}=i.data;if(!s){a.emit("request:end",{request:e,requestId:t}),(b=o==null?void 0:o.onPassthroughResponse)==null||b.call(o,e);return}if(s.status===302&&s.headers.get("x-msw-intention")==="passthrough"){a.emit("request:end",{request:e,requestId:t}),(m=o==null?void 0:o.onPassthroughResponse)==null||m.call(o,e);return}Jv(e,s),a.emit("request:match",{request:e,requestId:t});const l=i.data;return(p=o==null?void 0:o.onMockedResponse)==null||p.call(o,s,l),a.emit("request:end",{request:e,requestId:t}),s}class cn extends Response{constructor(t,n){const r=Hr(n);super(t,r),Vv(this,r)}static text(t,n){const r=Hr(n);return r.headers.has("Content-Type")||r.headers.set("Content-Type","text/plain"),r.headers.has("Content-Length")||r.headers.set("Content-Length",t?new Blob([t]).size.toString():"0"),new cn(t,r)}static json(t,n){const r=Hr(n);r.headers.has("Content-Type")||r.headers.set("Content-Type","application/json");const a=JSON.stringify(t);return r.headers.has("Content-Length")||r.headers.set("Content-Length",a?new Blob([a]).size.toString():"0"),new cn(a,r)}static xml(t,n){const r=Hr(n);return r.headers.has("Content-Type")||r.headers.set("Content-Type","text/xml"),new cn(t,r)}static html(t,n){const r=Hr(n);return r.headers.has("Content-Type")||r.headers.set("Content-Type","text/html"),new cn(t,r)}static arrayBuffer(t,n){const r=Hr(n);return t&&!r.headers.has("Content-Length")&&r.headers.set("Content-Length",t.byteLength.toString()),new cn(t,r)}static formData(t,n){return new cn(t,Hr(n))}}qk();function Kv(e){return{status:e.status,statusText:e.statusText,headers:Object.fromEntries(e.headers.entries())}}function Kc(e){return t=>t!=null&&typeof t=="object"&&"__kind"in t&&t.__kind===e}function uf(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function Sm(e,t){return Object.entries(t).reduce((n,[r,a])=>{const o=n[r];return Array.isArray(o)&&Array.isArray(a)?(n[r]=o.concat(a),n):uf(o)&&uf(a)?(n[r]=Sm(o,a),n):(n[r]=a,n)},Object.assign({},e))}function Gv(e){const t=Object.getOwnPropertyDescriptor(globalThis,e);return typeof t>"u"||typeof t.get=="function"&&typeof t.get()>"u"||typeof t.get>"u"&&t.value==null?!1:typeof t.set>"u"&&!t.configurable?(console.error(`[MSW] Failed to apply interceptor: the global \`${e}\` property is non-configurable. This is likely an issue with your environment. If you are using a framework, please open an issue about this in their repository.`),!1):!0}function st(e,t){return Object.defineProperties(t,{target:{value:e,enumerable:!0,writable:!0},currentTarget:{value:e,enumerable:!0,writable:!0}}),t}var ao=Symbol("kCancelable"),dn=Symbol("kDefaultPrevented"),Gc=class extends MessageEvent{constructor(e,t){super(e,t),this[ao]=!!t.cancelable,this[dn]=!1}get cancelable(){return this[ao]}set cancelable(e){this[ao]=e}get defaultPrevented(){return this[dn]}set defaultPrevented(e){this[dn]=e}preventDefault(){this.cancelable&&!this[dn]&&(this[dn]=!0)}},bl=class extends Event{constructor(e,t={}){super(e,t),this.code=t.code===void 0?0:t.code,this.reason=t.reason===void 0?"":t.reason,this.wasClean=t.wasClean===void 0?!1:t.wasClean}},cf=class extends bl{constructor(e,t={}){super(e,t),this[ao]=!!t.cancelable,this[dn]=!1}get cancelable(){return this[ao]}set cancelable(e){this[ao]=e}get defaultPrevented(){return this[dn]}set defaultPrevented(e){this[dn]=e}preventDefault(){this.cancelable&&!this[dn]&&(this[dn]=!0)}},ai=Symbol("kEmitter"),Bs=Symbol("kBoundListener"),Yv=class{constructor(e,t){this.socket=e,this.transport=t,this.id=Iw(),this.url=new URL(e.url),this[ai]=new EventTarget,this.transport.addEventListener("outgoing",n=>{const r=st(this.socket,new Gc("message",{data:n.data,origin:n.origin,cancelable:!0}));this[ai].dispatchEvent(r),r.defaultPrevented&&n.preventDefault()}),this.transport.addEventListener("close",n=>{this[ai].dispatchEvent(st(this.socket,new bl("close",n)))})}addEventListener(e,t,n){if(!Reflect.has(t,Bs)){const r=t.bind(this.socket);Object.defineProperty(t,Bs,{value:r,enumerable:!1,configurable:!1})}this[ai].addEventListener(e,Reflect.get(t,Bs),n)}removeEventListener(e,t,n){this[ai].removeEventListener(e,Reflect.get(t,Bs),n)}send(e){this.transport.send(e)}close(e,t){this.transport.close(e,t)}},df="InvalidAccessError: close code out of user configurable range",Qs=Symbol("kPassthroughPromise"),Tm=Symbol("kOnSend"),$i=Symbol("kClose"),es=class extends EventTarget{constructor(e,t){super(),this.CONNECTING=0,this.OPEN=1,this.CLOSING=2,this.CLOSED=3,this._onopen=null,this._onmessage=null,this._onerror=null,this._onclose=null,this.url=e.toString(),this.protocol="",this.extensions="",this.binaryType="blob",this.readyState=this.CONNECTING,this.bufferedAmount=0,this[Qs]=new qv,queueMicrotask(async()=>{await this[Qs]||(this.protocol=typeof t=="string"?t:Array.isArray(t)&&t.length>0?t[0]:"",this.readyState===this.CONNECTING&&(this.readyState=this.OPEN,this.dispatchEvent(st(this,new Event("open")))))})}set onopen(e){this.removeEventListener("open",this._onopen),this._onopen=e,e!==null&&this.addEventListener("open",e)}get onopen(){return this._onopen}set onmessage(e){this.removeEventListener("message",this._onmessage),this._onmessage=e,e!==null&&this.addEventListener("message",e)}get onmessage(){return this._onmessage}set onerror(e){this.removeEventListener("error",this._onerror),this._onerror=e,e!==null&&this.addEventListener("error",e)}get onerror(){return this._onerror}set onclose(e){this.removeEventListener("close",this._onclose),this._onclose=e,e!==null&&this.addEventListener("close",e)}get onclose(){return this._onclose}send(e){if(this.readyState===this.CONNECTING)throw this.close(),new DOMException("InvalidStateError");this.readyState===this.CLOSING||this.readyState===this.CLOSED||(this.bufferedAmount+=Qv(e),queueMicrotask(()=>{var t;this.bufferedAmount=0,(t=this[Tm])==null||t.call(this,e)}))}close(e=1e3,t){Kt(e,df),Kt(e===1e3||e>=3e3&&e<=4999,df),this[$i](e,t)}[$i](e=1e3,t,n=!0){this.readyState===this.CLOSING||this.readyState===this.CLOSED||(this.readyState=this.CLOSING,queueMicrotask(()=>{this.readyState=this.CLOSED,this.dispatchEvent(st(this,new bl("close",{code:e,reason:t,wasClean:n}))),this._onopen=null,this._onmessage=null,this._onerror=null,this._onclose=null}))}addEventListener(e,t,n){return super.addEventListener(e,t,n)}removeEventListener(e,t,n){return super.removeEventListener(e,t,n)}};es.CONNECTING=0;es.OPEN=1;es.CLOSING=2;es.CLOSED=3;function Qv(e){return typeof e=="string"?e.length:e instanceof Blob?e.size:e.byteLength}var tr=Symbol("kEmitter"),Ms=Symbol("kBoundListener"),Nu=Symbol("kSend"),Zv=class{constructor(e,t,n){this.client=e,this.transport=t,this.createConnection=n,this[tr]=new EventTarget,this.mockCloseController=new AbortController,this.realCloseController=new AbortController,this.transport.addEventListener("outgoing",r=>{typeof this.realWebSocket>"u"||queueMicrotask(()=>{r.defaultPrevented||this[Nu](r.data)})}),this.transport.addEventListener("incoming",this.handleIncomingMessage.bind(this))}get socket(){return Kt(this.realWebSocket,'Cannot access "socket" on the original WebSocket server object: the connection is not open. Did you forget to call `server.connect()`?'),this.realWebSocket}connect(){Kt(!this.realWebSocket||this.realWebSocket.readyState!==WebSocket.OPEN,'Failed to call "connect()" on the original WebSocket instance: the connection already open');const e=this.createConnection();e.binaryType=this.client.binaryType,e.addEventListener("open",t=>{this[tr].dispatchEvent(st(this.realWebSocket,new Event("open",t)))},{once:!0}),e.addEventListener("message",t=>{this.transport.dispatchEvent(st(this.realWebSocket,new MessageEvent("incoming",{data:t.data,origin:t.origin})))}),this.client.addEventListener("close",t=>{this.handleMockClose(t)},{signal:this.mockCloseController.signal}),e.addEventListener("close",t=>{this.handleRealClose(t)},{signal:this.realCloseController.signal}),e.addEventListener("error",()=>{const t=st(e,new Event("error",{cancelable:!0}));this[tr].dispatchEvent(t),t.defaultPrevented||this.client.dispatchEvent(st(this.client,new Event("error")))}),this.realWebSocket=e}addEventListener(e,t,n){if(!Reflect.has(t,Ms)){const r=t.bind(this.client);Object.defineProperty(t,Ms,{value:r,enumerable:!1})}this[tr].addEventListener(e,Reflect.get(t,Ms),n)}removeEventListener(e,t,n){this[tr].removeEventListener(e,Reflect.get(t,Ms),n)}send(e){this[Nu](e)}[Nu](e){const{realWebSocket:t}=this;if(Kt(t,'Failed to call "server.send()" for "%s": the connection is not open. Did you forget to call "server.connect()"?',this.client.url),!(t.readyState===WebSocket.CLOSING||t.readyState===WebSocket.CLOSED)){if(t.readyState===WebSocket.CONNECTING){t.addEventListener("open",()=>{t.send(e)},{once:!0});return}t.send(e)}}close(){const{realWebSocket:e}=this;Kt(e,'Failed to close server connection for "%s": the connection is not open. Did you forget to call "server.connect()"?',this.client.url),this.realCloseController.abort(),!(e.readyState===WebSocket.CLOSING||e.readyState===WebSocket.CLOSED)&&(e.close(),queueMicrotask(()=>{this[tr].dispatchEvent(st(this.realWebSocket,new cf("close",{code:1e3,cancelable:!0})))}))}handleIncomingMessage(e){const t=st(e.target,new Gc("message",{data:e.data,origin:e.origin,cancelable:!0}));this[tr].dispatchEvent(t),t.defaultPrevented||this.client.dispatchEvent(st(this.client,new MessageEvent("message",{data:e.data,origin:e.origin})))}handleMockClose(e){this.realWebSocket&&this.realWebSocket.close()}handleRealClose(e){this.mockCloseController.abort();const t=st(this.realWebSocket,new cf("close",{code:e.code,reason:e.reason,wasClean:e.wasClean,cancelable:!0}));this[tr].dispatchEvent(t),t.defaultPrevented||this.client[$i](e.code,e.reason)}},Xv=class extends EventTarget{constructor(e){super(),this.socket=e,this.socket.addEventListener("close",t=>{this.dispatchEvent(st(this.socket,new bl("close",t)))}),this.socket[Tm]=t=>{this.dispatchEvent(st(this.socket,new Gc("outgoing",{data:t,origin:this.socket.url,cancelable:!0})))}}addEventListener(e,t,n){return super.addEventListener(e,t,n)}dispatchEvent(e){return super.dispatchEvent(e)}send(e){queueMicrotask(()=>{if(this.socket.readyState===this.socket.CLOSING||this.socket.readyState===this.socket.CLOSED)return;const t=()=>{this.socket.dispatchEvent(st(this.socket,new MessageEvent("message",{data:e,origin:this.socket.url})))};this.socket.readyState===this.socket.CONNECTING?this.socket.addEventListener("open",()=>{t()},{once:!0}):t()})}close(e,t){this.socket[$i](e,t)}},Pm=class extends Ow{constructor(){super(Pm.symbol)}checkEnvironment(){return Gv("WebSocket")}setup(){const e=Object.getOwnPropertyDescriptor(globalThis,"WebSocket"),t=new Proxy(globalThis.WebSocket,{construct:(n,r,a)=>{const[o,i]=r,s=()=>Reflect.construct(n,r,a),l=new es(o,i),u=new Xv(l);return queueMicrotask(()=>{try{const c=new Zv(l,u,s);this.emitter.emit("connection",{client:new Yv(l,u),server:c,info:{protocols:i}})?l[Qs].resolve(!1):(l[Qs].resolve(!0),c.connect(),c.addEventListener("open",()=>{l.dispatchEvent(st(l,new Event("open"))),c.realWebSocket&&(l.protocol=c.realWebSocket.protocol)}))}catch(c){c instanceof Error&&(l.dispatchEvent(new Event("error")),l.readyState!==WebSocket.CLOSING&&l.readyState!==WebSocket.CLOSED&&l[$i](1011,c.message,!1),console.error(c))}}),l}});Object.defineProperty(globalThis,"WebSocket",{value:t,configurable:!0}),this.subscriptions.push(()=>{Object.defineProperty(globalThis,"WebSocket",e)})}},Bm=Pm;Bm.symbol=Symbol("websocket");const hc=new Bm;function e0(e){hc.on("connection",async t=>{const n=e.getHandlers(),r=new MessageEvent("connection",{data:t}),a=[];for(const o of n)Kc("EventHandler")(o)&&o.predicate({event:r,parsedResult:o.parse({event:r})})&&a.push(o);if(a.length>0){e==null||e.onMockedConnection(t);for(const o of a)o[Fv](r)}else{const o=new Request(t.client.url,{headers:{upgrade:"websocket",connection:"upgrade"}});await Cm(o,e.getUnhandledRequestStrategy()).catch(i=>{const s=new Event("error");Object.defineProperty(s,"cause",{enumerable:!0,configurable:!1,value:i}),t.client.socket.dispatchEvent(s)}),e==null||e.onPassthroughConnection(t),t.server.connect()}})}function kl(e){return e instanceof Blob?e.size:e instanceof ArrayBuffer?e.byteLength:new Blob([e]).size}const ff=24;function zu(e){return e.length<=ff?e:`${e.slice(0,ff)}…`}async function wl(e){if(e instanceof Blob){const t=await e.text();return`Blob(${zu(t)})`}if(typeof e=="object"&&"byteLength"in e){const t=new TextDecoder().decode(e);return`ArrayBuffer(${zu(t)})`}return zu(e)}const qa={system:"#3b82f6",outgoing:"#22c55e",incoming:"#ef4444",mocked:"#ff6a33"};function t0(e){const{client:t,server:n}=e;n0(t),t.addEventListener("message",r=>{o0(r)}),t.addEventListener("close",r=>{r0(r)}),t.socket.addEventListener("error",r=>{a0(r)}),t.send=new Proxy(t.send,{apply(r,a,o){const[i]=o,s=new MessageEvent("message",{data:i});return Object.defineProperties(s,{currentTarget:{enumerable:!0,writable:!1,value:t.socket},target:{enumerable:!0,writable:!1,value:t.socket}}),queueMicrotask(()=>{s0(s)}),Reflect.apply(r,a,o)}}),n.addEventListener("open",()=>{n.addEventListener("message",r=>{l0(r)})},{once:!0}),n.send=new Proxy(n.send,{apply(r,a,o){const[i]=o,s=new MessageEvent("message",{data:i});return Object.defineProperties(s,{currentTarget:{enumerable:!0,writable:!1,value:n.socket},target:{enumerable:!0,writable:!1,value:n.socket}}),i0(s),Reflect.apply(r,a,o)}})}function n0(e){const t=Xi(e.url);console.groupCollapsed(xe.formatMessage(`${Fr()} %c▶%c ${t}`),`color:${qa.system}`,"color:inherit"),console.log("Client:",e.socket),console.groupEnd()}function r0(e){const t=e.target,n=Xi(t.url);console.groupCollapsed(xe.formatMessage(`${Fr({milliseconds:!0})} %c■%c ${n}`),`color:${qa.system}`,"color:inherit"),console.log(e),console.groupEnd()}function a0(e){const t=e.target,n=Xi(t.url);console.groupCollapsed(xe.formatMessage(`${Fr({milliseconds:!0})} %c×%c ${n}`),`color:${qa.system}`,"color:inherit"),console.log(e),console.groupEnd()}async function o0(e){const t=kl(e.data),n=await wl(e.data),r=e.defaultPrevented?"⇡":"⬆";console.groupCollapsed(xe.formatMessage(`${Fr({milliseconds:!0})} %c${r}%c ${n} %c${t}%c`),`color:${qa.outgoing}`,"color:inherit","color:gray;font-weight:normal","color:inherit;font-weight:inherit"),console.log(e),console.groupEnd()}async function i0(e){const t=kl(e.data),n=await wl(e.data);console.groupCollapsed(xe.formatMessage(`${Fr({milliseconds:!0})} %c⬆%c ${n} %c${t}%c`),`color:${qa.mocked}`,"color:inherit","color:gray;font-weight:normal","color:inherit;font-weight:inherit"),console.log(e),console.groupEnd()}async function s0(e){const t=kl(e.data),n=await wl(e.data);console.groupCollapsed(xe.formatMessage(`${Fr({milliseconds:!0})} %c⬇%c ${n} %c${t}%c`),`color:${qa.mocked}`,"color:inherit","color:gray;font-weight:normal","color:inherit;font-weight:inherit"),console.log(e),console.groupEnd()}async function l0(e){const t=kl(e.data),n=await wl(e.data),r=e.defaultPrevented?"⇣":"⬇";console.groupCollapsed(xe.formatMessage(`${Fr({milliseconds:!0})} %c${r}%c ${n} %c${t}%c`),`color:${qa.incoming}`,"color:inherit","color:gray;font-weight:normal","color:inherit;font-weight:inherit"),console.log(e),console.groupEnd()}var u0=/(%?)(%([sdijo]))/g;function c0(e,t){switch(t){case"s":return e;case"d":case"i":return Number(e);case"j":return JSON.stringify(e);case"o":{if(typeof e=="string")return e;const n=JSON.stringify(e);return n==="{}"||n==="[]"||/^\[object .+?\]$/.test(n)?e:n}}}function ts(e,...t){if(t.length===0)return e;let n=0,r=e.replace(u0,(a,o,i,s)=>{const l=t[n],u=c0(l,s);return o?a:(n++,u)});return n{if(!e)throw new h0(t,...n)};Cr.as=(e,t,n,...r)=>{if(!t){const a=r.length===0?n:ts(n,...r);let o;try{o=Reflect.construct(e,[a])}catch{o=e(a)}throw o}};function Yc(){if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof process<"u"){const e=process.type;return e==="renderer"||e==="worker"?!1:!!(process.versions&&process.versions.node)}return!1}var mc=async e=>{try{return{error:null,data:await e().catch(n=>{throw n})}}catch(t){return{error:t,data:null}}};function m0(e){return new URL(e,location.href).href}function Du(e,t,n){return[e.active,e.installing,e.waiting].filter(i=>i!=null).find(i=>n(i.scriptURL,t))||null}var p0=async(e,t={},n)=>{const r=m0(e),a=await navigator.serviceWorker.getRegistrations().then(s=>s.filter(l=>Du(l,r,n)));!navigator.serviceWorker.controller&&a.length>0&&location.reload();const[o]=a;if(o)return o.update(),[Du(o,r,n),o];const i=await mc(async()=>{const s=await navigator.serviceWorker.register(e,t);return[Du(s,r,n),s]});if(i.error){if(i.error.message.includes("(404)")){const l=new URL((t==null?void 0:t.scope)||"/",location.href);throw new Error(xe.formatMessage(`Failed to register a Service Worker for scope ('${l.href}') with script ('${r}'): Service Worker script does not exist at the given path. + +Did you forget to run "npx msw init "? + +Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/init`))}throw new Error(xe.formatMessage(`Failed to register the Service Worker: + +%s`,i.error.message))}return i.data};function Mm(e={}){if(e.quiet)return;const t=e.message||"Mocking enabled.";console.groupCollapsed(`%c${xe.formatMessage(t)}`,"color:orangered;font-weight:bold;"),console.log("%cDocumentation: %chttps://mswjs.io/docs","font-weight:bold","font-weight:normal"),console.log("Found an issue? https://github.com/mswjs/msw/issues"),e.workerUrl&&console.log("Worker script URL:",e.workerUrl),e.workerScope&&console.log("Worker scope:",e.workerScope),e.client&&console.log("Client ID: %s (%s)",e.client.id,e.client.frameType),console.groupEnd()}async function g0(e,t){var r,a;e.workerChannel.send("MOCK_ACTIVATE");const{payload:n}=await e.events.once("MOCKING_ENABLED");if(e.isMockingEnabled){xe.warn('Found a redundant "worker.start()" call. Note that starting the worker while mocking is already enabled will have no effect. Consider removing this "worker.start()" call.');return}e.isMockingEnabled=!0,Mm({quiet:t.quiet,workerScope:(r=e.registration)==null?void 0:r.scope,workerUrl:(a=e.worker)==null?void 0:a.scriptURL,client:n.client})}var y0=class{constructor(e){this.port=e}postMessage(e,...t){const[n,r]=t;this.port.postMessage({type:e,data:n},{transfer:r})}};function b0(e){if(!["HEAD","GET"].includes(e.method))return e.body}function k0(e){return new Request(e.url,{...e,body:b0(e)})}var w0=(e,t)=>async(n,r)=>{const a=new y0(n.ports[0]),o=r.payload.id,i=k0(r.payload),s=i.clone(),l=i.clone();Ys.cache.set(i,l),e.requests.set(o,l);try{await Am(i,o,e.getRequestHandlers().filter(Kc("RequestHandler")),t,e.emitter,{onPassthroughResponse(){a.postMessage("PASSTHROUGH")},async onMockedResponse(u,{handler:c,parsedResult:d}){const b=u.clone(),m=u.clone(),p=Kv(u);if(e.supports.readableStreamTransfer){const f=u.body;a.postMessage("MOCK_RESPONSE",{...p,body:f},f?[f]:void 0)}else{const f=u.body===null?null:await b.arrayBuffer();a.postMessage("MOCK_RESPONSE",{...p,body:f})}t.quiet||e.emitter.once("response:mocked",()=>{c.log({request:s,response:m,parsedResult:d})})}})}catch(u){u instanceof Error&&(xe.error(`Uncaught exception in the request handler for "%s %s": + +%s + +This exception has been gracefully handled as a 500 response, however, it's strongly recommended to resolve this error, as it indicates a mistake in your code. If you wish to mock an error response, please see this guide: https://mswjs.io/docs/recipes/mocking-error-responses`,i.method,i.url,u.stack??u),a.postMessage("MOCK_RESPONSE",{status:500,statusText:"Request Handler Error",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:u.name,message:u.message,stack:u.stack})}))}};async function v0(e){e.workerChannel.send("INTEGRITY_CHECK_REQUEST");const{payload:t}=await e.events.once("INTEGRITY_CHECK_RESPONSE");t.checksum!=="ca7800994cc8bfb5eb961e037c877074"&&xe.warn(`The currently registered Service Worker has been generated by a different version of MSW (${t.packageVersion}) and may not be fully compatible with the installed version. + +It's recommended you update your worker script by running this command: + + • npx msw init + +You can also automate this process and make the worker script update automatically upon the library installations. Read more: https://mswjs.io/docs/cli/init.`)}var j0=new TextEncoder;function _0(e){return j0.encode(e)}function C0(e,t){return new TextDecoder(t).decode(e)}function E0(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}var oo=Symbol("isPatchedModule"),Xa=class extends Response{static isConfigurableStatusCode(e){return e>=200&&e<=599}static isRedirectResponse(e){return Xa.STATUS_CODES_WITH_REDIRECT.includes(e)}static isResponseWithBody(e){return!Xa.STATUS_CODES_WITHOUT_BODY.includes(e)}static setUrl(e,t){e&&t.url==""&&Object.defineProperty(t,"url",{value:e,enumerable:!0,configurable:!0,writable:!1})}constructor(e,t={}){var n;const r=(n=t.status)!=null?n:200,a=Xa.isConfigurableStatusCode(r)?r:200,o=Xa.isResponseWithBody(r)?e:null;if(super(o,{...t,status:a}),r!==a){const i=Object.getOwnPropertySymbols(this).find(s=>s.description==="state");if(i){const s=Reflect.get(this,i);Reflect.set(s,"status",r)}else Object.defineProperty(this,"status",{value:r,enumerable:!0,configurable:!0,writable:!1})}Xa.setUrl(t.url,this)}},Mn=Xa;Mn.STATUS_CODES_WITHOUT_BODY=[101,103,204,205,304];Mn.STATUS_CODES_WITH_REDIRECT=[301,302,303,307,308];var A0=Object.defineProperty,S0=(e,t)=>{for(var n in t)A0(e,n,{get:t[n],enumerable:!0})},pc={};S0(pc,{blue:()=>P0,gray:()=>gc,green:()=>M0,red:()=>B0,yellow:()=>T0});function T0(e){return`\x1B[33m${e}\x1B[0m`}function P0(e){return`\x1B[34m${e}\x1B[0m`}function gc(e){return`\x1B[90m${e}\x1B[0m`}function B0(e){return`\x1B[31m${e}\x1B[0m`}function M0(e){return`\x1B[32m${e}\x1B[0m`}var vl=Yc(),xm=class{constructor(e){Ae(this,"prefix");this.name=e,this.prefix=`[${this.name}]`;const t=hf("DEBUG"),n=hf("LOG_LEVEL");t==="1"||t==="true"||typeof t<"u"&&this.name.startsWith(t)?(this.debug=oi(n,"debug")?an:this.debug,this.info=oi(n,"info")?an:this.info,this.success=oi(n,"success")?an:this.success,this.warning=oi(n,"warning")?an:this.warning,this.error=oi(n,"error")?an:this.error):(this.info=an,this.success=an,this.warning=an,this.error=an,this.only=an)}extend(e){return new xm(`${this.name}:${e}`)}debug(e,...t){this.logEntry({level:"debug",message:gc(e),positionals:t,prefix:this.prefix,colors:{prefix:"gray"}})}info(e,...t){this.logEntry({level:"info",message:e,positionals:t,prefix:this.prefix,colors:{prefix:"blue"}});const n=new x0;return(r,...a)=>{n.measure(),this.logEntry({level:"info",message:`${r} ${gc(`${n.deltaTime}ms`)}`,positionals:a,prefix:this.prefix,colors:{prefix:"blue"}})}}success(e,...t){this.logEntry({level:"info",message:e,positionals:t,prefix:`✔ ${this.prefix}`,colors:{timestamp:"green",prefix:"green"}})}warning(e,...t){this.logEntry({level:"warning",message:e,positionals:t,prefix:`⚠ ${this.prefix}`,colors:{timestamp:"yellow",prefix:"yellow"}})}error(e,...t){this.logEntry({level:"error",message:e,positionals:t,prefix:`✖ ${this.prefix}`,colors:{timestamp:"red",prefix:"red"}})}only(e){e()}createEntry(e,t){return{timestamp:new Date,level:e,message:t}}logEntry(e){const{level:t,message:n,prefix:r,colors:a,positionals:o=[]}=e,i=this.createEntry(t,n),s=(a==null?void 0:a.timestamp)||"gray",l=(a==null?void 0:a.prefix)||"gray",u={timestamp:pc[s],prefix:pc[l]};this.getWriter(t)([u.timestamp(this.formatTimestamp(i.timestamp))].concat(r!=null?u.prefix(r):[]).concat(mf(n)).join(" "),...o.map(mf))}formatTimestamp(e){return`${e.toLocaleTimeString("en-GB")}:${e.getMilliseconds()}`}getWriter(e){switch(e){case"debug":case"success":case"info":return O0;case"warning":return I0;case"error":return R0}}},x0=class{constructor(){Ae(this,"startTime");Ae(this,"endTime");Ae(this,"deltaTime");this.startTime=performance.now()}measure(){this.endTime=performance.now();const e=this.endTime-this.startTime;this.deltaTime=e.toFixed(2)}},an=()=>{};function O0(e,...t){if(vl){process.stdout.write(ts(e,...t)+` +`);return}console.log(e,...t)}function I0(e,...t){if(vl){process.stderr.write(ts(e,...t)+` +`);return}console.warn(e,...t)}function R0(e,...t){if(vl){process.stderr.write(ts(e,...t)+` +`);return}console.error(e,...t)}function hf(e){var t;return vl?process.env[e]:(t=globalThis[e])==null?void 0:t.toString()}function oi(e,t){return e!==void 0&&e!==t}function mf(e){return typeof e>"u"?"undefined":e===null?"null":typeof e=="string"?e:typeof e=="object"?JSON.stringify(e):e.toString()}var N0=class extends Error{constructor(e,t,n){super(`Possible EventEmitter memory leak detected. ${n} ${t.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=e,this.type=t,this.count=n,this.name="MaxListenersExceededWarning"}},Om=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=Om.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}_emitInternalEvent(e,t,n){this.emit(e,t,n)}_getListeners(e){return Array.prototype.concat.apply([],this.events.get(e))||[]}_removeListener(e,t){const n=e.indexOf(t);return n>-1&&e.splice(n,1),[]}_wrapOnceListener(e,t){const n=(...r)=>(this.removeListener(e,n),t.apply(this,r));return Object.defineProperty(n,"name",{value:t.name}),n}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(e,...t){const n=this._getListeners(e);return n.forEach(r=>{r.apply(this,t)}),n.length>0}addListener(e,t){this._emitInternalEvent("newListener",e,t);const n=this._getListeners(e).concat(t);if(this.events.set(e,n),this.maxListeners>0&&this.listenerCount(e)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const r=new N0(this,e,this.listenerCount(e));console.warn(r)}return this}on(e,t){return this.addListener(e,t)}once(e,t){return this.addListener(e,this._wrapOnceListener(e,t))}prependListener(e,t){const n=this._getListeners(e);if(n.length>0){const r=[t].concat(n);this.events.set(e,r)}else this.events.set(e,n.concat(t));return this}prependOnceListener(e,t){return this.prependListener(e,this._wrapOnceListener(e,t))}removeListener(e,t){const n=this._getListeners(e);return n.length>0&&(this._removeListener(n,t),this.events.set(e,n),this._emitInternalEvent("removeListener",e,t)),this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){return e?this.events.delete(e):this.events.clear(),this}listeners(e){return Array.from(this._getListeners(e))}listenerCount(e){return this._getListeners(e).length}rawListeners(e){return this.listeners(e)}},Im=Om;Im.defaultMaxListeners=10;var z0="x-interceptors-internal-request-id";function pf(e){return globalThis[e]||void 0}function D0(e,t){globalThis[e]=t}function U0(e){delete globalThis[e]}var Qc=class{constructor(e){this.symbol=e,this.readyState="INACTIVE",this.emitter=new Im,this.subscriptions=[],this.logger=new xm(e.description),this.emitter.setMaxListeners(0),this.logger.info("constructing the interceptor...")}checkEnvironment(){return!0}apply(){const e=this.logger.extend("apply");if(e.info("applying the interceptor..."),this.readyState==="APPLIED"){e.info("intercepted already applied!");return}if(!this.checkEnvironment()){e.info("the interceptor cannot be applied in this environment!");return}this.readyState="APPLYING";const n=this.getInstance();if(n){e.info("found a running instance, reusing..."),this.on=(r,a)=>(e.info('proxying the "%s" listener',r),n.emitter.addListener(r,a),this.subscriptions.push(()=>{n.emitter.removeListener(r,a),e.info('removed proxied "%s" listener!',r)}),this),this.readyState="APPLIED";return}e.info("no running instance found, setting up a new instance..."),this.setup(),this.setInstance(),this.readyState="APPLIED"}setup(){}on(e,t){const n=this.logger.extend("on");return this.readyState==="DISPOSING"||this.readyState==="DISPOSED"?(n.info("cannot listen to events, already disposed!"),this):(n.info('adding "%s" event listener:',e,t),this.emitter.on(e,t),this)}once(e,t){return this.emitter.once(e,t),this}off(e,t){return this.emitter.off(e,t),this}removeAllListeners(e){return this.emitter.removeAllListeners(e),this}dispose(){const e=this.logger.extend("dispose");if(this.readyState==="DISPOSED"){e.info("cannot dispose, already disposed!");return}if(e.info("disposing the interceptor..."),this.readyState="DISPOSING",!this.getInstance()){e.info("no interceptors running, skipping dispose...");return}if(this.clearInstance(),e.info("global symbol deleted:",pf(this.symbol)),this.subscriptions.length>0){e.info("disposing of %d subscriptions...",this.subscriptions.length);for(const t of this.subscriptions)t();this.subscriptions=[],e.info("disposed of all subscriptions!",this.subscriptions.length)}this.emitter.removeAllListeners(),e.info("destroyed the listener!"),this.readyState="DISPOSED"}getInstance(){var e;const t=pf(this.symbol);return this.logger.info("retrieved global instance:",(e=t==null?void 0:t.constructor)==null?void 0:e.name),t}setInstance(){D0(this.symbol,this),this.logger.info("set global instance!",this.symbol.description)}clearInstance(){U0(this.symbol),this.logger.info("cleared global instance!",this.symbol.description)}};function Rm(){return Math.random().toString(16).slice(2)}var yc=class extends Qc{constructor(e){yc.symbol=Symbol(e.name),super(yc.symbol),this.interceptors=e.interceptors}setup(){const e=this.logger.extend("setup");e.info("applying all %d interceptors...",this.interceptors.length);for(const t of this.interceptors)e.info('applying "%s" interceptor...',t.constructor.name),t.apply(),e.info("adding interceptor dispose subscription"),this.subscriptions.push(()=>t.dispose())}on(e,t){for(const n of this.interceptors)n.on(e,t);return this}once(e,t){for(const n of this.interceptors)n.once(e,t);return this}off(e,t){for(const n of this.interceptors)n.off(e,t);return this}removeAllListeners(e){for(const t of this.interceptors)t.removeAllListeners(e);return this}};function F0(e){return(t,n)=>{var s;const{payload:r}=n,{requestId:a}=r,o=e.requests.get(a);if(e.requests.delete(a),(s=r.type)!=null&&s.includes("opaque"))return;const i=r.status===0?Response.error():new Mn(Mn.isResponseWithBody(r.status)?r.body:null,{...r,url:o.url});e.emitter.emit(r.isMockedResponse?"response:mocked":"response:bypass",{response:i,request:o,requestId:r.requestId})}}function L0(e,t){!(t!=null&&t.quiet)&&!location.href.startsWith(e.scope)&&xe.warn(`Cannot intercept requests on this page because it's outside of the worker's scope ("${e.scope}"). If you wish to mock API requests on this page, you must resolve this scope issue. + +- (Recommended) Register the worker at the root level ("/") of your application. +- Set the "Service-Worker-Allowed" response header to allow out-of-scope workers.`)}var q0=e=>function(n,r){return(async()=>{e.events.removeAllListeners(),e.workerChannel.on("REQUEST",w0(e,n)),e.workerChannel.on("RESPONSE",F0(e));const i=await p0(n.serviceWorker.url,n.serviceWorker.options,n.findWorker),[s,l]=i;if(!s){const u=r!=null&&r.findWorker?xe.formatMessage(`Failed to locate the Service Worker registration using a custom "findWorker" predicate. + +Please ensure that the custom predicate properly locates the Service Worker registration at "%s". +More details: https://mswjs.io/docs/api/setup-worker/start#findworker +`,n.serviceWorker.url):xe.formatMessage(`Failed to locate the Service Worker registration. + +This most likely means that the worker script URL "%s" cannot resolve against the actual public hostname (%s). This may happen if your application runs behind a proxy, or has a dynamic hostname. + +Please consider using a custom "serviceWorker.url" option to point to the actual worker script location, or a custom "findWorker" option to resolve the Service Worker registration manually. More details: https://mswjs.io/docs/api/setup-worker/start`,n.serviceWorker.url,location.host);throw new Error(u)}return e.worker=s,e.registration=l,e.events.addListener(window,"beforeunload",()=>{s.state!=="redundant"&&e.workerChannel.send("CLIENT_CLOSED"),window.clearInterval(e.keepAliveInterval),window.postMessage({type:"msw/worker:stop"})}),await v0(e).catch(u=>{xe.error("Error while checking the worker script integrity. Please report this on GitHub (https://github.com/mswjs/msw/issues), including the original error below."),console.error(u)}),e.keepAliveInterval=window.setInterval(()=>e.workerChannel.send("KEEPALIVE_REQUEST"),5e3),L0(l,e.startOptions),l})().then(async i=>{const s=i.installing||i.waiting;return s&&await new Promise(l=>{s.addEventListener("statechange",()=>{if(s.state==="activated")return l()})}),await g0(e,n).catch(l=>{throw new Error(`Failed to enable mocking: ${l==null?void 0:l.message}`)}),i})};function Nm(e={}){e.quiet||console.log(`%c${xe.formatMessage("Mocking disabled.")}`,"color:orangered;font-weight:bold;")}var $0=e=>function(){var n;if(!e.isMockingEnabled){xe.warn('Found a redundant "worker.stop()" call. Note that stopping the worker while mocking already stopped has no effect. Consider removing this "worker.stop()" call.');return}e.workerChannel.send("MOCK_DEACTIVATE"),e.isMockingEnabled=!1,window.clearInterval(e.keepAliveInterval),window.postMessage({type:"msw/worker:stop"}),Nm({quiet:(n=e.startOptions)==null?void 0:n.quiet})},W0={serviceWorker:{url:"/mockServiceWorker.js",options:null},quiet:!1,waitUntilReady:!0,onUnhandledRequest:"warn",findWorker(e,t){return e===t}};function H0(){const e=(t,n)=>{e.state="pending",e.resolve=r=>{if(e.state!=="pending")return;e.result=r;const a=o=>(e.state="fulfilled",o);return t(r instanceof Promise?r:Promise.resolve(r).then(a))},e.reject=r=>{if(e.state==="pending")return queueMicrotask(()=>{e.state="rejected"}),n(e.rejectionReason=r)}};return e}var fr,fo,Ls,Gh,Zc=(Gh=class extends Promise{constructor(t=null){const n=H0();super((r,a)=>{n(r,a),t==null||t(n.resolve,n.reject)});Xo(this,fo);Xo(this,fr,void 0);Ae(this,"resolve");Ae(this,"reject");Ou(this,fr,n),this.resolve=_n(this,fr).resolve,this.reject=_n(this,fr).reject}get state(){return _n(this,fr).state}get rejectionReason(){return _n(this,fr).rejectionReason}then(t,n){return Wr(this,fo,Ls).call(this,super.then(t,n))}catch(t){return Wr(this,fo,Ls).call(this,super.catch(t))}finally(t){return Wr(this,fo,Ls).call(this,super.finally(t))}},fr=new WeakMap,fo=new WeakSet,Ls=function(t){return Object.defineProperties(t,{resolve:{configurable:!0,value:this.resolve},reject:{configurable:!0,value:this.reject}})},Gh),Zs=class extends Error{constructor(e){super(e),this.name="InterceptorError",Object.setPrototypeOf(this,Zs.prototype)}},ii=Symbol("kRequestHandled"),un=Symbol("kResponsePromise"),Xc=class{constructor(e){this.request=e,this[ii]=!1,this[un]=new Zc}respondWith(e){Cr.as(Zs,!this[ii],'Failed to respond to the "%s %s" request: the "request" event has already been handled.',this.request.method,this.request.url),this[ii]=!0,this[un].resolve(e)}errorWith(e){Cr.as(Zs,!this[ii],'Failed to error the "%s %s" request: the "request" event has already been handled.',this.request.method,this.request.url),this[ii]=!0,this[un].resolve(e)}};async function Xs(e,t,...n){const r=e.listeners(t);if(r.length!==0)for(const a of r)await a.apply(e,n)}function V0(e,t){try{return e[t],!0}catch{return!1}}function J0(e){return new Response(JSON.stringify(e instanceof Error?{name:e.name,message:e.message,stack:e.stack}:e),{status:500,statusText:"Unhandled Exception",headers:{"Content-Type":"application/json"}})}function K0(e){return V0(e,"type")&&e.type==="error"}function G0(e){return e==null||!(e instanceof Error)?!1:"code"in e&&"errno"in e}async function zm(e){const t=async o=>(o instanceof Error?e.onError(o):K0(o)?e.onRequestError(o):await e.onResponse(o),!0),n=async o=>{if(o instanceof Zs)throw a.error;return G0(o)?(e.onError(o),!0):o instanceof Response?await t(o):!1};e.emitter.once("request",({requestId:o})=>{o===e.requestId&&e.controller[un].state==="pending"&&e.controller[un].resolve(void 0)});const r=new Zc;e.request.signal&&(e.request.signal.aborted?r.reject(e.request.signal.reason):e.request.signal.addEventListener("abort",()=>{r.reject(e.request.signal.reason)},{once:!0}));const a=await mc(async()=>{const o=Xs(e.emitter,"request",{requestId:e.requestId,request:e.request,controller:e.controller});return await Promise.race([r,o,e.controller[un]]),await e.controller[un]});if(r.state==="rejected")return e.onError(r.rejectionReason),!0;if(a.error){if(await n(a.error))return!0;if(e.emitter.listenerCount("unhandledException")>0){const o=new Xc(e.request);await Xs(e.emitter,"unhandledException",{error:a.error,request:e.request,requestId:e.requestId,controller:o}).then(()=>{o[un].state==="pending"&&o[un].resolve(void 0)});const i=await mc(()=>o[un]);if(i.error)return n(i.error);if(i.data)return t(i.data)}return e.onResponse(J0(a.error)),!0}return a.data?t(a.data):!1}function Dm(e){const t=Object.getOwnPropertyDescriptor(globalThis,e);return typeof t>"u"||typeof t.get=="function"&&typeof t.get()>"u"||typeof t.get>"u"&&t.value==null?!1:typeof t.set>"u"&&!t.configurable?(console.error(`[MSW] Failed to apply interceptor: the global \`${e}\` property is non-configurable. This is likely an issue with your environment. If you are using a framework, please open an issue about this in their repository.`),!1):!0}function Y0(e){try{return new URL(e),!0}catch{return!1}}function ta(e){return Object.assign(new TypeError("Failed to fetch"),{cause:e})}var Q0=["content-encoding","content-language","content-location","content-type","content-length"],Uu=Symbol("kRedirectCount");async function Z0(e,t){if(t.status!==303&&e.body!=null)return Promise.reject(ta());const n=new URL(e.url);let r;try{r=new URL(t.headers.get("location"),e.url)}catch(o){return Promise.reject(ta(o))}if(!(r.protocol==="http:"||r.protocol==="https:"))return Promise.reject(ta("URL scheme must be a HTTP(S) scheme"));if(Reflect.get(e,Uu)>20)return Promise.reject(ta("redirect count exceeded"));if(Object.defineProperty(e,Uu,{value:(Reflect.get(e,Uu)||0)+1}),e.mode==="cors"&&(r.username||r.password)&&!gf(n,r))return Promise.reject(ta('cross origin not allowed for request mode "cors"'));const a={};return([301,302].includes(t.status)&&e.method==="POST"||t.status===303&&!["HEAD","GET"].includes(e.method))&&(a.method="GET",a.body=null,Q0.forEach(o=>{e.headers.delete(o)})),gf(n,r)||(e.headers.delete("authorization"),e.headers.delete("proxy-authorization"),e.headers.delete("cookie"),e.headers.delete("host")),a.headers=e.headers,fetch(new Request(r,a))}function gf(e,t){return e.origin===t.origin&&e.origin==="null"||e.protocol===t.protocol&&e.hostname===t.hostname&&e.port===t.port}var X0=class extends TransformStream{constructor(){console.warn("[Interceptors]: Brotli decompression of response streams is not supported in the browser"),super({transform(e,t){t.enqueue(e)}})}},ej=class extends TransformStream{constructor(e,...t){super({},...t);const n=[super.readable,...e].reduce((r,a)=>r.pipeThrough(a));Object.defineProperty(this,"readable",{get(){return n}})}};function tj(e){return e.toLowerCase().split(",").map(t=>t.trim())}function nj(e){if(e==="")return null;const t=tj(e);if(t.length===0)return null;const n=t.reduceRight((r,a)=>a==="gzip"||a==="x-gzip"?r.concat(new DecompressionStream("gzip")):a==="deflate"?r.concat(new DecompressionStream("deflate")):a==="br"?r.concat(new X0):(r.length=0,r),[]);return new ej(n)}function rj(e){if(e.body===null)return null;const t=nj(e.headers.get("content-encoding")||"");return t?(e.body.pipeTo(t.writable),t.readable):null}var Um=class extends Qc{constructor(){super(Um.symbol)}checkEnvironment(){return Dm("fetch")}async setup(){const e=globalThis.fetch;Cr(!e[oo],'Failed to patch the "fetch" module: already patched.'),globalThis.fetch=async(t,n)=>{const r=Rm(),a=typeof t=="string"&&typeof location<"u"&&!Y0(t)?new URL(t,location.origin):t,o=new Request(a,n),i=new Zc,s=new Xc(o);return this.logger.info("[%s] %s",o.method,o.url),this.logger.info("awaiting for the mocked response..."),this.logger.info('emitting the "request" event for %s listener(s)...',this.emitter.listenerCount("request")),await zm({request:o,requestId:r,emitter:this.emitter,controller:s,onResponse:async u=>{this.logger.info("received mocked response!",{rawResponse:u});const c=rj(u),d=c===null?u:new Mn(c,u);if(Mn.setUrl(o.url,d),Mn.isRedirectResponse(d.status)){if(o.redirect==="error"){i.reject(ta("unexpected redirect"));return}if(o.redirect==="follow"){Z0(o,d).then(b=>{i.resolve(b)},b=>{i.reject(b)});return}}this.emitter.listenerCount("response")>0&&(this.logger.info('emitting the "response" event...'),await Xs(this.emitter,"response",{response:d.clone(),isMockedResponse:!0,request:o,requestId:r})),i.resolve(d)},onRequestError:u=>{this.logger.info("request has errored!",{response:u}),i.reject(ta(u))},onError:u=>{this.logger.info("request has been aborted!",{error:u}),i.reject(u)}})?(this.logger.info("request has been handled, returning mock promise..."),i):(this.logger.info("no mocked response received, performing request as-is..."),e(o).then(async u=>{if(this.logger.info("original fetch performed",u),this.emitter.listenerCount("response")>0){this.logger.info('emitting the "response" event...');const c=u.clone();await Xs(this.emitter,"response",{response:c,isMockedResponse:!1,request:o,requestId:r})}return u}))},Object.defineProperty(globalThis.fetch,oo,{enumerable:!0,configurable:!0,value:!0}),this.subscriptions.push(()=>{Object.defineProperty(globalThis.fetch,oo,{value:void 0}),globalThis.fetch=e,this.logger.info('restored native "globalThis.fetch"!',globalThis.fetch.name)})}},Fm=Um;Fm.symbol=Symbol("fetch");function aj(e,t){const n=new Uint8Array(e.byteLength+t.byteLength);return n.set(e,0),n.set(t,e.byteLength),n}var Lm=class{constructor(e,t){this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.type="",this.srcElement=null,this.currentTarget=null,this.eventPhase=0,this.isTrusted=!0,this.composed=!1,this.cancelable=!0,this.defaultPrevented=!1,this.bubbles=!0,this.lengthComputable=!0,this.loaded=0,this.total=0,this.cancelBubble=!1,this.returnValue=!0,this.type=e,this.target=(t==null?void 0:t.target)||null,this.currentTarget=(t==null?void 0:t.currentTarget)||null,this.timeStamp=Date.now()}composedPath(){return[]}initEvent(e,t,n){this.type=e,this.bubbles=!!t,this.cancelable=!!n}preventDefault(){this.defaultPrevented=!0}stopPropagation(){}stopImmediatePropagation(){}},oj=class extends Lm{constructor(e,t){super(e),this.lengthComputable=(t==null?void 0:t.lengthComputable)||!1,this.composed=(t==null?void 0:t.composed)||!1,this.loaded=(t==null?void 0:t.loaded)||0,this.total=(t==null?void 0:t.total)||0}},ij=typeof ProgressEvent<"u";function sj(e,t,n){const r=["error","progress","loadstart","loadend","load","timeout","abort"],a=ij?ProgressEvent:oj;return r.includes(t)?new a(t,{lengthComputable:!0,loaded:(n==null?void 0:n.loaded)||0,total:(n==null?void 0:n.total)||0}):new Lm(t,{target:e,currentTarget:e})}function qm(e,t){if(!(t in e))return null;if(Object.prototype.hasOwnProperty.call(e,t))return e;const r=Reflect.getPrototypeOf(e);return r?qm(r,t):null}function Fu(e,t){return new Proxy(e,lj(t))}function lj(e){const{constructorCall:t,methodCall:n,getProperty:r,setProperty:a}=e,o={};return typeof t<"u"&&(o.construct=function(i,s,l){const u=Reflect.construct.bind(null,i,s,l);return t.call(l,s,u)}),o.set=function(i,s,l){const u=()=>{const c=qm(i,s)||i,d=Reflect.getOwnPropertyDescriptor(c,s);return typeof(d==null?void 0:d.set)<"u"?(d.set.apply(i,[l]),!0):Reflect.defineProperty(c,s,{writable:!0,enumerable:!0,configurable:!0,value:l})};return typeof a<"u"?a.call(i,[s,l],u):u()},o.get=function(i,s,l){const u=()=>i[s],c=typeof r<"u"?r.call(i,[s,l],u):u();return typeof c=="function"?(...d)=>{const b=c.bind(i,...d);return typeof n<"u"?n.call(i,[s,d],b):b()}:c},o}function uj(e){return["application/xhtml+xml","application/xml","image/svg+xml","text/html","text/xml"].some(n=>e.startsWith(n))}function cj(e){try{return JSON.parse(e)}catch{return null}}function dj(e,t){const n=Mn.isResponseWithBody(e.status)?t:null;return new Mn(n,{url:e.responseURL,status:e.status,statusText:e.statusText,headers:fj(e.getAllResponseHeaders())})}function fj(e){const t=new Headers,n=e.split(/[\r\n]+/);for(const r of n){if(r.trim()==="")continue;const[a,...o]=r.split(": "),i=o.join(": ");t.append(a,i)}return t}async function yf(e){const t=e.headers.get("content-length");return t!=null&&t!==""?Number(t):(await e.arrayBuffer()).byteLength}var si=Symbol("kIsRequestHandled"),hj=Yc(),Lu=Symbol("kFetchRequest"),mj=class{constructor(e,t){this.initialRequest=e,this.logger=t,this.method="GET",this.url=null,this[si]=!1,this.events=new Map,this.uploadEvents=new Map,this.requestId=Rm(),this.requestHeaders=new Headers,this.responseBuffer=new Uint8Array,this.request=Fu(e,{setProperty:([n,r],a)=>{switch(n){case"ontimeout":{const o=n.slice(2);return this.request.addEventListener(o,r),a()}default:return a()}},methodCall:([n,r],a)=>{var o;switch(n){case"open":{const[i,s]=r;return typeof s>"u"?(this.method="GET",this.url=bf(i)):(this.method=i,this.url=bf(s)),this.logger=this.logger.extend(`${this.method} ${this.url.href}`),this.logger.info("open",this.method,this.url.href),a()}case"addEventListener":{const[i,s]=r;return this.registerEvent(i,s),this.logger.info("addEventListener",i,s),a()}case"setRequestHeader":{const[i,s]=r;return this.requestHeaders.set(i,s),this.logger.info("setRequestHeader",i,s),a()}case"send":{const[i]=r;this.request.addEventListener("load",()=>{if(typeof this.onResponse<"u"){const c=dj(this.request,this.request.response);this.onResponse.call(this,{response:c,isMockedResponse:this[si],request:l,requestId:this.requestId})}});const s=typeof i=="string"?_0(i):i,l=this.toFetchApiRequest(s);this[Lu]=l.clone(),(((o=this.onRequest)==null?void 0:o.call(this,{request:l,requestId:this.requestId}))||Promise.resolve()).finally(()=>{if(!this[si])return this.logger.info("request callback settled but request has not been handled (readystate %d), performing as-is...",this.request.readyState),hj&&this.request.setRequestHeader(z0,this.requestId),a()});break}default:return a()}}}),Ja(this.request,"upload",Fu(this.request.upload,{setProperty:([n,r],a)=>{switch(n){case"onloadstart":case"onprogress":case"onaboart":case"onerror":case"onload":case"ontimeout":case"onloadend":{const o=n.slice(2);this.registerUploadEvent(o,r)}}return a()},methodCall:([n,r],a)=>{switch(n){case"addEventListener":{const[o,i]=r;return this.registerUploadEvent(o,i),this.logger.info("upload.addEventListener",o,i),a()}}}}))}registerEvent(e,t){const r=(this.events.get(e)||[]).concat(t);this.events.set(e,r),this.logger.info('registered event "%s"',e,t)}registerUploadEvent(e,t){const r=(this.uploadEvents.get(e)||[]).concat(t);this.uploadEvents.set(e,r),this.logger.info('registered upload event "%s"',e,t)}async respondWith(e){if(this[si]=!0,this[Lu]){const r=await yf(this[Lu]);this.trigger("loadstart",this.request.upload,{loaded:0,total:r}),this.trigger("progress",this.request.upload,{loaded:r,total:r}),this.trigger("load",this.request.upload,{loaded:r,total:r}),this.trigger("loadend",this.request.upload,{loaded:r,total:r})}this.logger.info("responding with a mocked response: %d %s",e.status,e.statusText),Ja(this.request,"status",e.status),Ja(this.request,"statusText",e.statusText),Ja(this.request,"responseURL",this.url.href),this.request.getResponseHeader=new Proxy(this.request.getResponseHeader,{apply:(r,a,o)=>{if(this.logger.info("getResponseHeader",o[0]),this.request.readyState{if(this.logger.info("getAllResponseHeaders"),this.request.readyState`${o}: ${i}`).join(`\r +`);return this.logger.info("resolved all response headers to",a),a}}),Object.defineProperties(this.request,{response:{enumerable:!0,configurable:!1,get:()=>this.response},responseText:{enumerable:!0,configurable:!1,get:()=>this.responseText},responseXML:{enumerable:!0,configurable:!1,get:()=>this.responseXML}});const t=await yf(e.clone());this.logger.info("calculated response body length",t),this.trigger("loadstart",this.request,{loaded:0,total:t}),this.setReadyState(this.request.HEADERS_RECEIVED),this.setReadyState(this.request.LOADING);const n=()=>{this.logger.info("finalizing the mocked response..."),this.setReadyState(this.request.DONE),this.trigger("load",this.request,{loaded:this.responseBuffer.byteLength,total:t}),this.trigger("loadend",this.request,{loaded:this.responseBuffer.byteLength,total:t})};if(e.body){this.logger.info("mocked response has body, streaming...");const r=e.body.getReader(),a=async()=>{const{value:o,done:i}=await r.read();if(i){this.logger.info("response body stream done!"),n();return}o&&(this.logger.info("read response body chunk:",o),this.responseBuffer=aj(this.responseBuffer,o),this.trigger("progress",this.request,{loaded:this.responseBuffer.byteLength,total:t})),a()};a()}else n()}responseBufferToText(){return C0(this.responseBuffer)}get response(){if(this.logger.info("getResponse (responseType: %s)",this.request.responseType),this.request.readyState!==this.request.DONE)return null;switch(this.request.responseType){case"json":{const e=cj(this.responseBufferToText());return this.logger.info("resolved response JSON",e),e}case"arraybuffer":{const e=E0(this.responseBuffer);return this.logger.info("resolved response ArrayBuffer",e),e}case"blob":{const e=this.request.getResponseHeader("Content-Type")||"text/plain",t=new Blob([this.responseBufferToText()],{type:e});return this.logger.info("resolved response Blob (mime type: %s)",t,e),t}default:{const e=this.responseBufferToText();return this.logger.info('resolving "%s" response type as text',this.request.responseType,e),e}}}get responseText(){if(Cr(this.request.responseType===""||this.request.responseType==="text","InvalidStateError: The object is in invalid state."),this.request.readyState!==this.request.LOADING&&this.request.readyState!==this.request.DONE)return"";const e=this.responseBufferToText();return this.logger.info('getResponseText: "%s"',e),e}get responseXML(){if(Cr(this.request.responseType===""||this.request.responseType==="document","InvalidStateError: The object is in invalid state."),this.request.readyState!==this.request.DONE)return null;const e=this.request.getResponseHeader("Content-Type")||"";return typeof DOMParser>"u"?(console.warn("Cannot retrieve XMLHttpRequest response body as XML: DOMParser is not defined. You are likely using an environment that is not browser or does not polyfill browser globals correctly."),null):uj(e)?new DOMParser().parseFromString(this.responseBufferToText(),e):null}errorWith(e){this[si]=!0,this.logger.info("responding with an error"),this.setReadyState(this.request.DONE),this.trigger("error",this.request),this.trigger("loadend",this.request)}setReadyState(e){if(this.logger.info("setReadyState: %d -> %d",this.request.readyState,e),this.request.readyState===e){this.logger.info("ready state identical, skipping transition...");return}Ja(this.request,"readyState",e),this.logger.info("set readyState to: %d",e),e!==this.request.UNSENT&&(this.logger.info('triggerring "readystatechange" event...'),this.trigger("readystatechange",this.request))}trigger(e,t,n){const r=t[`on${e}`],a=sj(t,e,n);this.logger.info('trigger "%s"',e,n||""),typeof r=="function"&&(this.logger.info('found a direct "%s" callback, calling...',e),r.call(t,a));const o=t instanceof XMLHttpRequestUpload?this.uploadEvents:this.events;for(const[i,s]of o)i===e&&(this.logger.info('found %d listener(s) for "%s" event, calling...',s.length,e),s.forEach(l=>l.call(t,a)))}toFetchApiRequest(e){this.logger.info("converting request to a Fetch API Request...");const t=e instanceof Document?e.documentElement.innerText:e,n=new Request(this.url.href,{method:this.method,headers:this.requestHeaders,credentials:this.request.withCredentials?"include":"same-origin",body:["GET","HEAD"].includes(this.method.toUpperCase())?null:t}),r=Fu(n.headers,{methodCall:([a,o],i)=>{switch(a){case"append":case"set":{const[s,l]=o;this.request.setRequestHeader(s,l);break}case"delete":{const[s]=o;console.warn(`XMLHttpRequest: Cannot remove a "${s}" header from the Fetch API representation of the "${n.method} ${n.url}" request. XMLHttpRequest headers cannot be removed.`);break}}return i()}});return Ja(n,"headers",r),this.logger.info("converted request to a Fetch API Request!",n),n}};function bf(e){return typeof location>"u"?new URL(e):new URL(e.toString(),location.href)}function Ja(e,t,n){Reflect.defineProperty(e,t,{writable:!0,enumerable:!0,value:n})}function pj({emitter:e,logger:t}){return new Proxy(globalThis.XMLHttpRequest,{construct(r,a,o){t.info("constructed new XMLHttpRequest");const i=Reflect.construct(r,a,o),s=Object.getOwnPropertyDescriptors(r.prototype);for(const u in s)Reflect.defineProperty(i,u,s[u]);const l=new mj(i,t);return l.onRequest=async function({request:u,requestId:c}){const d=new Xc(u);this.logger.info("awaiting mocked response..."),this.logger.info('emitting the "request" event for %s listener(s)...',e.listenerCount("request")),await zm({request:u,requestId:c,controller:d,emitter:e,onResponse:async m=>{await this.respondWith(m)},onRequestError:()=>{this.errorWith(new TypeError("Network error"))},onError:m=>{this.logger.info("request errored!",{error:m}),m instanceof Error&&this.errorWith(m)}})||this.logger.info("no mocked response received, performing request as-is...")},l.onResponse=async function({response:u,isMockedResponse:c,request:d,requestId:b}){this.logger.info('emitting the "response" event for %s listener(s)...',e.listenerCount("response")),e.emit("response",{response:u,isMockedResponse:c,request:d,requestId:b})},l.request}})}var $m=class extends Qc{constructor(){super($m.interceptorSymbol)}checkEnvironment(){return Dm("XMLHttpRequest")}setup(){const e=this.logger.extend("setup");e.info('patching "XMLHttpRequest" module...');const t=globalThis.XMLHttpRequest;Cr(!t[oo],'Failed to patch the "XMLHttpRequest" module: already patched.'),globalThis.XMLHttpRequest=pj({emitter:this.emitter,logger:this.logger}),e.info('native "XMLHttpRequest" module patched!',globalThis.XMLHttpRequest.name),Object.defineProperty(globalThis.XMLHttpRequest,oo,{enumerable:!0,configurable:!0,value:!0}),this.subscriptions.push(()=>{Object.defineProperty(globalThis.XMLHttpRequest,oo,{value:void 0}),globalThis.XMLHttpRequest=t,e.info('native "XMLHttpRequest" module restored!',globalThis.XMLHttpRequest.name)})}},Wm=$m;Wm.interceptorSymbol=Symbol("xhr");function gj(e,t){const n=new yc({name:"fallback",interceptors:[new Fm,new Wm]});return n.on("request",async({request:r,requestId:a,controller:o})=>{const i=r.clone(),s=await Am(r,a,e.getRequestHandlers().filter(Kc("RequestHandler")),t,e.emitter,{onMockedResponse(l,{handler:u,parsedResult:c}){t.quiet||e.emitter.once("response:mocked",({response:d})=>{u.log({request:i,response:d,parsedResult:c})})}});s&&o.respondWith(s)}),n.on("response",({response:r,isMockedResponse:a,request:o,requestId:i})=>{e.emitter.emit(a?"response:mocked":"response:bypass",{response:r,request:o,requestId:i})}),n.apply(),n}function yj(e){return async function(n){e.fallbackInterceptor=gj(e,n),Mm({message:"Mocking enabled (fallback mode).",quiet:n.quiet})}}function bj(e){return function(){var n,r;(n=e.fallbackInterceptor)==null||n.dispose(),Nm({quiet:(r=e.startOptions)==null?void 0:r.quiet})}}function kj(){try{const e=new ReadableStream({start:n=>n.close()});return new MessageChannel().port1.postMessage(e,[e]),!0}catch{return!1}}var wj=class extends Kk{constructor(...t){super(...t);Ae(this,"context");Ae(this,"startHandler",null);Ae(this,"stopHandler",null);Ae(this,"listeners");Cr(!Yc(),xe.formatMessage("Failed to execute `setupWorker` in a non-browser environment. Consider using `setupServer` for Node.js environment instead.")),this.listeners=[],this.context=this.createWorkerContext()}createWorkerContext(){const t={isMockingEnabled:!1,startOptions:null,worker:null,getRequestHandlers:()=>this.handlersController.currentHandlers(),registration:null,requests:new Map,emitter:this.emitter,workerChannel:{on:(n,r)=>{this.context.events.addListener(navigator.serviceWorker,"message",a=>{if(a.source!==this.context.worker)return;const o=a.data;o&&o.type===n&&r(a,o)})},send:n=>{var r;(r=this.context.worker)==null||r.postMessage(n)}},events:{addListener:(n,r,a)=>(n.addEventListener(r,a),this.listeners.push({eventType:r,target:n,callback:a}),()=>{n.removeEventListener(r,a)}),removeAllListeners:()=>{for(const{target:n,eventType:r,callback:a}of this.listeners)n.removeEventListener(r,a);this.listeners=[]},once:n=>{const r=[];return new Promise((a,o)=>{const i=s=>{try{const l=s.data;l.type===n&&a(l)}catch(l){o(l)}};r.push(this.context.events.addListener(navigator.serviceWorker,"message",i),this.context.events.addListener(navigator.serviceWorker,"messageerror",o))}).finally(()=>{r.forEach(a=>a())})}},supports:{serviceWorkerApi:!("serviceWorker"in navigator)||location.protocol==="file:",readableStreamTransfer:kj()}};return this.startHandler=t.supports.serviceWorkerApi?yj(t):q0(t),this.stopHandler=t.supports.serviceWorkerApi?bj(t):$0(t),t}async start(t={}){return t.waitUntilReady===!0&&xe.warn('The "waitUntilReady" option has been deprecated. Please remove it from this "worker.start()" call. Follow the recommended Browser integration (https://mswjs.io/docs/integrations/browser) to eliminate any race conditions between the Service Worker registration and any requests made by your application on initial render.'),this.context.startOptions=Sm(W0,t),e0({getUnhandledRequestStrategy:()=>this.context.startOptions.onUnhandledRequest,getHandlers:()=>this.handlersController.currentHandlers(),onMockedConnection:n=>{this.context.startOptions.quiet||t0(n)},onPassthroughConnection(){}}),hc.apply(),this.subscriptions.push(()=>{hc.dispose()}),await this.startHandler(this.context.startOptions,t)}stop(){super.dispose(),this.context.events.removeAllListeners(),this.context.emitter.removeAllListeners(),this.stopHandler()}};function vj(...e){return new wj(...e)}var Ce;(function(e){e.assertEqual=a=>a;function t(a){}e.assertIs=t;function n(a){throw new Error}e.assertNever=n,e.arrayToEnum=a=>{const o={};for(const i of a)o[i]=i;return o},e.getValidEnumValues=a=>{const o=e.objectKeys(a).filter(s=>typeof a[a[s]]!="number"),i={};for(const s of o)i[s]=a[s];return e.objectValues(i)},e.objectValues=a=>e.objectKeys(a).map(function(o){return a[o]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const o=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&o.push(i);return o},e.find=(a,o)=>{for(const i of a)if(o(i))return i},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function r(a,o=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(Ce||(Ce={}));var el;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(el||(el={}));const ae=Ce.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Pn=e=>{switch(typeof e){case"undefined":return ae.undefined;case"string":return ae.string;case"number":return isNaN(e)?ae.nan:ae.number;case"boolean":return ae.boolean;case"function":return ae.function;case"bigint":return ae.bigint;case"symbol":return ae.symbol;case"object":return Array.isArray(e)?ae.array:e===null?ae.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ae.promise:typeof Map<"u"&&e instanceof Map?ae.map:typeof Set<"u"&&e instanceof Set?ae.set:typeof Date<"u"&&e instanceof Date?ae.date:ae.object;default:return ae.unknown}},K=Ce.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Hm=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class St extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(o){return o.message},r={_errors:[]},a=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let s=r,l=0;for(;ln.message){const n={},r=[];for(const a of this.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):r.push(t(a));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}St.create=e=>new St(e);const sa=(e,t)=>{let n;switch(e.code){case K.invalid_type:e.received===ae.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case K.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ce.jsonStringifyReplacer)}`;break;case K.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ce.joinValues(e.keys,", ")}`;break;case K.invalid_union:n="Invalid input";break;case K.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ce.joinValues(e.options)}`;break;case K.invalid_enum_value:n=`Invalid enum value. Expected ${Ce.joinValues(e.options)}, received '${e.received}'`;break;case K.invalid_arguments:n="Invalid function arguments";break;case K.invalid_return_type:n="Invalid function return type";break;case K.invalid_date:n="Invalid date";break;case K.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ce.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case K.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case K.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case K.custom:n="Invalid input";break;case K.invalid_intersection_types:n="Intersection results could not be merged";break;case K.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case K.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ce.assertNever(e)}return{message:n}};let Vm=sa;function Jm(e){Vm=e}function Wi(){return Vm}const Hi=e=>{const{data:t,path:n,errorMaps:r,issueData:a}=e,o=[...n,...a.path||[]],i={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let s="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)s=u(i,{data:t,defaultError:s}).message;return{...a,path:o,message:s}},Km=[];function ne(e,t){const n=Wi(),r=Hi({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===sa?void 0:sa].filter(a=>!!a)});e.common.issues.push(r)}class rt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const a of n){if(a.status==="aborted")return me;a.status==="dirty"&&t.dirty(),r.push(a.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const a of n){const o=await a.key,i=await a.value;r.push({key:o,value:i})}return rt.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const a of n){const{key:o,value:i}=a;if(o.status==="aborted"||i.status==="aborted")return me;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(r[o.value]=i.value)}return{status:t.value,value:r}}}const me=Object.freeze({status:"aborted"}),ra=e=>({status:"dirty",value:e}),lt=e=>({status:"valid",value:e}),tl=e=>e.status==="aborted",nl=e=>e.status==="dirty",ho=e=>e.status==="valid",mo=e=>typeof Promise<"u"&&e instanceof Promise;function rl(e,t,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)}function Gm(e,t,n,r,a){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?a.call(e,n):a?a.value=n:t.set(e,n),n}var ue;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ue||(ue={}));var Mi,xi;class pn{constructor(t,n,r,a){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const kf=(e,t)=>{if(ho(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new St(e.common.issues);return this._error=n,this._error}}};function ve(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(i,s)=>{var l,u;const{message:c}=e;return i.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:(l=c??r)!==null&&l!==void 0?l:s.defaultError}:i.code!=="invalid_type"?{message:s.defaultError}:{message:(u=c??n)!==null&&u!==void 0?u:s.defaultError}},description:a}}class be{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Pn(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Pn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new rt,ctx:{common:t.parent.common,data:t.data,parsedType:Pn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(mo(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const a={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Pn(t)},o=this._parseSync({data:t,path:a.path,parent:a});return kf(a,o)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Pn(t)},a=this._parse({data:t,path:r.path,parent:r}),o=await(mo(a)?a:Promise.resolve(a));return kf(r,o)}refine(t,n){const r=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,o)=>{const i=t(a),s=()=>o.addIssue({code:K.custom,...r(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(s(),!1)):i?!0:(s(),!1)})}refinement(t,n){return this._refinement((r,a)=>t(r)?!0:(a.addIssue(typeof n=="function"?n(r,a):n),!1))}_refinement(t){return new Rt({schema:this,typeName:he.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Yt.create(this,this._def)}nullable(){return Un.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $t.create(this,this._def)}promise(){return ua.create(this,this._def)}or(t){return bo.create([this,t],this._def)}and(t){return ko.create(this,t,this._def)}transform(t){return new Rt({...ve(this._def),schema:this,typeName:he.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Co({...ve(this._def),innerType:this,defaultValue:n,typeName:he.ZodDefault})}brand(){return new jl({typeName:he.ZodBranded,type:this,...ve(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Eo({...ve(this._def),innerType:this,catchValue:n,typeName:he.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Io.create(this,t)}readonly(){return Ao.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const jj=/^c[^\s-]{8,}$/i,_j=/^[0-9a-z]+$/,Cj=/^[0-9A-HJKMNP-TV-Z]{26}$/,Ej=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Aj=/^[a-z0-9_-]{21}$/i,Sj=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Tj=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Pj="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let qu;const Bj=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Mj=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,xj=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ym="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Oj=new RegExp(`^${Ym}$`);function Qm(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function Ij(e){return new RegExp(`^${Qm(e)}$`)}function ed(e){let t=`${Ym}T${Qm(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Rj(e,t){return!!((t==="v4"||!t)&&Bj.test(e)||(t==="v6"||!t)&&Mj.test(e))}class qt extends be{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ae.string){const o=this._getOrReturnCtx(t);return ne(o,{code:K.invalid_type,expected:ae.string,received:o.parsedType}),me}const r=new rt;let a;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(a=this._getOrReturnCtx(t,a),ne(a,{code:K.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const i=t.data.length>o.value,s=t.data.lengtht.test(a),{validation:n,code:K.invalid_string,...ue.errToObj(r)})}_addCheck(t){return new qt({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ue.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ue.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ue.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ue.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ue.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ue.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ue.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ue.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ue.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ue.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...ue.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...ue.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...ue.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...ue.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...ue.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ue.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ue.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ue.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ue.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ue.errToObj(n)})}nonempty(t){return this.min(1,ue.errToObj(t))}trim(){return new qt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new qt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new qt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new qt({checks:[],typeName:he.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...ve(e)})};function Nj(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r,o=parseInt(e.toFixed(a).replace(".","")),i=parseInt(t.toFixed(a).replace(".",""));return o%i/Math.pow(10,a)}class Nn extends be{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ae.number){const o=this._getOrReturnCtx(t);return ne(o,{code:K.invalid_type,expected:ae.number,received:o.parsedType}),me}let r;const a=new rt;for(const o of this._def.checks)o.kind==="int"?Ce.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ne(r,{code:K.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),ne(r,{code:K.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?Nj(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),ne(r,{code:K.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ne(r,{code:K.not_finite,message:o.message}),a.dirty()):Ce.assertNever(o);return{status:a.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ue.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ue.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ue.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ue.toString(n))}setLimit(t,n,r,a){return new Nn({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ue.toString(a)}]})}_addCheck(t){return new Nn({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ue.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ue.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ue.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ue.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ue.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ue.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:ue.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ue.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ue.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&Ce.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew Nn({checks:[],typeName:he.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...ve(e)});class zn extends be{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==ae.bigint){const o=this._getOrReturnCtx(t);return ne(o,{code:K.invalid_type,expected:ae.bigint,received:o.parsedType}),me}let r;const a=new rt;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),ne(r,{code:K.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ne(r,{code:K.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):Ce.assertNever(o);return{status:a.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ue.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ue.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ue.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ue.toString(n))}setLimit(t,n,r,a){return new zn({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ue.toString(a)}]})}_addCheck(t){return new zn({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ue.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ue.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ue.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ue.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ue.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new zn({checks:[],typeName:he.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...ve(e)})};class po extends be{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ae.boolean){const r=this._getOrReturnCtx(t);return ne(r,{code:K.invalid_type,expected:ae.boolean,received:r.parsedType}),me}return lt(t.data)}}po.create=e=>new po({typeName:he.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...ve(e)});class Er extends be{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ae.date){const o=this._getOrReturnCtx(t);return ne(o,{code:K.invalid_type,expected:ae.date,received:o.parsedType}),me}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return ne(o,{code:K.invalid_date}),me}const r=new rt;let a;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(a=this._getOrReturnCtx(t,a),ne(a,{code:K.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Ce.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Er({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ue.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ue.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew Er({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:he.ZodDate,...ve(e)});class Vi extends be{_parse(t){if(this._getType(t)!==ae.symbol){const r=this._getOrReturnCtx(t);return ne(r,{code:K.invalid_type,expected:ae.symbol,received:r.parsedType}),me}return lt(t.data)}}Vi.create=e=>new Vi({typeName:he.ZodSymbol,...ve(e)});class go extends be{_parse(t){if(this._getType(t)!==ae.undefined){const r=this._getOrReturnCtx(t);return ne(r,{code:K.invalid_type,expected:ae.undefined,received:r.parsedType}),me}return lt(t.data)}}go.create=e=>new go({typeName:he.ZodUndefined,...ve(e)});class yo extends be{_parse(t){if(this._getType(t)!==ae.null){const r=this._getOrReturnCtx(t);return ne(r,{code:K.invalid_type,expected:ae.null,received:r.parsedType}),me}return lt(t.data)}}yo.create=e=>new yo({typeName:he.ZodNull,...ve(e)});class la extends be{constructor(){super(...arguments),this._any=!0}_parse(t){return lt(t.data)}}la.create=e=>new la({typeName:he.ZodAny,...ve(e)});class hr extends be{constructor(){super(...arguments),this._unknown=!0}_parse(t){return lt(t.data)}}hr.create=e=>new hr({typeName:he.ZodUnknown,...ve(e)});class gn extends be{_parse(t){const n=this._getOrReturnCtx(t);return ne(n,{code:K.invalid_type,expected:ae.never,received:n.parsedType}),me}}gn.create=e=>new gn({typeName:he.ZodNever,...ve(e)});class Ji extends be{_parse(t){if(this._getType(t)!==ae.undefined){const r=this._getOrReturnCtx(t);return ne(r,{code:K.invalid_type,expected:ae.void,received:r.parsedType}),me}return lt(t.data)}}Ji.create=e=>new Ji({typeName:he.ZodVoid,...ve(e)});class $t extends be{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),a=this._def;if(n.parsedType!==ae.array)return ne(n,{code:K.invalid_type,expected:ae.array,received:n.parsedType}),me;if(a.exactLength!==null){const i=n.data.length>a.exactLength.value,s=n.data.lengtha.maxLength.value&&(ne(n,{code:K.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,s)=>a.type._parseAsync(new pn(n,i,n.path,s)))).then(i=>rt.mergeArray(r,i));const o=[...n.data].map((i,s)=>a.type._parseSync(new pn(n,i,n.path,s)));return rt.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new $t({...this._def,minLength:{value:t,message:ue.toString(n)}})}max(t,n){return new $t({...this._def,maxLength:{value:t,message:ue.toString(n)}})}length(t,n){return new $t({...this._def,exactLength:{value:t,message:ue.toString(n)}})}nonempty(t){return this.min(1,t)}}$t.create=(e,t)=>new $t({type:e,minLength:null,maxLength:null,exactLength:null,typeName:he.ZodArray,...ve(t)});function eo(e){if(e instanceof Le){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Yt.create(eo(r))}return new Le({...e._def,shape:()=>t})}else return e instanceof $t?new $t({...e._def,type:eo(e.element)}):e instanceof Yt?Yt.create(eo(e.unwrap())):e instanceof Un?Un.create(eo(e.unwrap())):e instanceof Xt?Xt.create(e.items.map(t=>eo(t))):e}class Le extends be{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Ce.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==ae.object){const u=this._getOrReturnCtx(t);return ne(u,{code:K.invalid_type,expected:ae.object,received:u.parsedType}),me}const{status:r,ctx:a}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof gn&&this._def.unknownKeys==="strip"))for(const u in a.data)i.includes(u)||s.push(u);const l=[];for(const u of i){const c=o[u],d=a.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new pn(a,d,a.path,u)),alwaysSet:u in a.data})}if(this._def.catchall instanceof gn){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of s)l.push({key:{status:"valid",value:c},value:{status:"valid",value:a.data[c]}});else if(u==="strict")s.length>0&&(ne(a,{code:K.unrecognized_keys,keys:s}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of s){const d=a.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new pn(a,d,a.path,c)),alwaysSet:c in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of l){const d=await c.key,b=await c.value;u.push({key:d,value:b,alwaysSet:c.alwaysSet})}return u}).then(u=>rt.mergeObjectSync(r,u)):rt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return ue.errToObj,new Le({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var a,o,i,s;const l=(i=(o=(a=this._def).errorMap)===null||o===void 0?void 0:o.call(a,n,r).message)!==null&&i!==void 0?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=ue.errToObj(t).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new Le({...this._def,unknownKeys:"strip"})}passthrough(){return new Le({...this._def,unknownKeys:"passthrough"})}extend(t){return new Le({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Le({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:he.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Le({...this._def,catchall:t})}pick(t){const n={};return Ce.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Le({...this._def,shape:()=>n})}omit(t){const n={};return Ce.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Le({...this._def,shape:()=>n})}deepPartial(){return eo(this)}partial(t){const n={};return Ce.objectKeys(this.shape).forEach(r=>{const a=this.shape[r];t&&!t[r]?n[r]=a:n[r]=a.optional()}),new Le({...this._def,shape:()=>n})}required(t){const n={};return Ce.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Yt;)o=o._def.innerType;n[r]=o}}),new Le({...this._def,shape:()=>n})}keyof(){return Zm(Ce.objectKeys(this.shape))}}Le.create=(e,t)=>new Le({shape:()=>e,unknownKeys:"strip",catchall:gn.create(),typeName:he.ZodObject,...ve(t)});Le.strictCreate=(e,t)=>new Le({shape:()=>e,unknownKeys:"strict",catchall:gn.create(),typeName:he.ZodObject,...ve(t)});Le.lazycreate=(e,t)=>new Le({shape:e,unknownKeys:"strip",catchall:gn.create(),typeName:he.ZodObject,...ve(t)});class bo extends be{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function a(o){for(const s of o)if(s.result.status==="valid")return s.result;for(const s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;const i=o.map(s=>new St(s.ctx.common.issues));return ne(n,{code:K.invalid_union,unionErrors:i}),me}if(n.common.async)return Promise.all(r.map(async o=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(a);{let o;const i=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},c=l._parseSync({data:n.data,path:n.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!o&&(o={result:c,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const s=i.map(l=>new St(l));return ne(n,{code:K.invalid_union,unionErrors:s}),me}}get options(){return this._def.options}}bo.create=(e,t)=>new bo({options:e,typeName:he.ZodUnion,...ve(t)});const Tn=e=>e instanceof vo?Tn(e.schema):e instanceof Rt?Tn(e.innerType()):e instanceof jo?[e.value]:e instanceof Dn?e.options:e instanceof _o?Ce.objectValues(e.enum):e instanceof Co?Tn(e._def.innerType):e instanceof go?[void 0]:e instanceof yo?[null]:e instanceof Yt?[void 0,...Tn(e.unwrap())]:e instanceof Un?[null,...Tn(e.unwrap())]:e instanceof jl||e instanceof Ao?Tn(e.unwrap()):e instanceof Eo?Tn(e._def.innerType):[];class ns extends be{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ae.object)return ne(n,{code:K.invalid_type,expected:ae.object,received:n.parsedType}),me;const r=this.discriminator,a=n.data[r],o=this.optionsMap.get(a);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(ne(n,{code:K.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),me)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const a=new Map;for(const o of n){const i=Tn(o.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const s of i){if(a.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);a.set(s,o)}}return new ns({typeName:he.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:a,...ve(r)})}}function bc(e,t){const n=Pn(e),r=Pn(t);if(e===t)return{valid:!0,data:e};if(n===ae.object&&r===ae.object){const a=Ce.objectKeys(t),o=Ce.objectKeys(e).filter(s=>a.indexOf(s)!==-1),i={...e,...t};for(const s of o){const l=bc(e[s],t[s]);if(!l.valid)return{valid:!1};i[s]=l.data}return{valid:!0,data:i}}else if(n===ae.array&&r===ae.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let o=0;o{if(tl(o)||tl(i))return me;const s=bc(o.value,i.value);return s.valid?((nl(o)||nl(i))&&n.dirty(),{status:n.value,value:s.data}):(ne(r,{code:K.invalid_intersection_types}),me)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,i])=>a(o,i)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ko.create=(e,t,n)=>new ko({left:e,right:t,typeName:he.ZodIntersection,...ve(n)});class Xt extends be{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.array)return ne(r,{code:K.invalid_type,expected:ae.array,received:r.parsedType}),me;if(r.data.lengththis._def.items.length&&(ne(r,{code:K.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((i,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new pn(r,i,r.path,s)):null}).filter(i=>!!i);return r.common.async?Promise.all(o).then(i=>rt.mergeArray(n,i)):rt.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new Xt({...this._def,rest:t})}}Xt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Xt({items:e,typeName:he.ZodTuple,rest:null,...ve(t)})};class wo extends be{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.object)return ne(r,{code:K.invalid_type,expected:ae.object,received:r.parsedType}),me;const a=[],o=this._def.keyType,i=this._def.valueType;for(const s in r.data)a.push({key:o._parse(new pn(r,s,r.path,s)),value:i._parse(new pn(r,r.data[s],r.path,s)),alwaysSet:s in r.data});return r.common.async?rt.mergeObjectAsync(n,a):rt.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof be?new wo({keyType:t,valueType:n,typeName:he.ZodRecord,...ve(r)}):new wo({keyType:qt.create(),valueType:t,typeName:he.ZodRecord,...ve(n)})}}class Ki extends be{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.map)return ne(r,{code:K.invalid_type,expected:ae.map,received:r.parsedType}),me;const a=this._def.keyType,o=this._def.valueType,i=[...r.data.entries()].map(([s,l],u)=>({key:a._parse(new pn(r,s,r.path,[u,"key"])),value:o._parse(new pn(r,l,r.path,[u,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of i){const u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return me;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}})}else{const s=new Map;for(const l of i){const u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return me;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}}}}Ki.create=(e,t,n)=>new Ki({valueType:t,keyType:e,typeName:he.ZodMap,...ve(n)});class Ar extends be{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.set)return ne(r,{code:K.invalid_type,expected:ae.set,received:r.parsedType}),me;const a=this._def;a.minSize!==null&&r.data.sizea.maxSize.value&&(ne(r,{code:K.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());const o=this._def.valueType;function i(l){const u=new Set;for(const c of l){if(c.status==="aborted")return me;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}const s=[...r.data.values()].map((l,u)=>o._parse(new pn(r,l,r.path,u)));return r.common.async?Promise.all(s).then(l=>i(l)):i(s)}min(t,n){return new Ar({...this._def,minSize:{value:t,message:ue.toString(n)}})}max(t,n){return new Ar({...this._def,maxSize:{value:t,message:ue.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Ar.create=(e,t)=>new Ar({valueType:e,minSize:null,maxSize:null,typeName:he.ZodSet,...ve(t)});class ia extends be{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ae.function)return ne(n,{code:K.invalid_type,expected:ae.function,received:n.parsedType}),me;function r(s,l){return Hi({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Wi(),sa].filter(u=>!!u),issueData:{code:K.invalid_arguments,argumentsError:l}})}function a(s,l){return Hi({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Wi(),sa].filter(u=>!!u),issueData:{code:K.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof ua){const s=this;return lt(async function(...l){const u=new St([]),c=await s._def.args.parseAsync(l,o).catch(m=>{throw u.addIssue(r(l,m)),u}),d=await Reflect.apply(i,this,c);return await s._def.returns._def.type.parseAsync(d,o).catch(m=>{throw u.addIssue(a(d,m)),u})})}else{const s=this;return lt(function(...l){const u=s._def.args.safeParse(l,o);if(!u.success)throw new St([r(l,u.error)]);const c=Reflect.apply(i,this,u.data),d=s._def.returns.safeParse(c,o);if(!d.success)throw new St([a(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new ia({...this._def,args:Xt.create(t).rest(hr.create())})}returns(t){return new ia({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new ia({args:t||Xt.create([]).rest(hr.create()),returns:n||hr.create(),typeName:he.ZodFunction,...ve(r)})}}class vo extends be{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}vo.create=(e,t)=>new vo({getter:e,typeName:he.ZodLazy,...ve(t)});class jo extends be{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ne(n,{received:n.data,code:K.invalid_literal,expected:this._def.value}),me}return{status:"valid",value:t.data}}get value(){return this._def.value}}jo.create=(e,t)=>new jo({value:e,typeName:he.ZodLiteral,...ve(t)});function Zm(e,t){return new Dn({values:e,typeName:he.ZodEnum,...ve(t)})}class Dn extends be{constructor(){super(...arguments),Mi.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return ne(n,{expected:Ce.joinValues(r),received:n.parsedType,code:K.invalid_type}),me}if(rl(this,Mi,"f")||Gm(this,Mi,new Set(this._def.values),"f"),!rl(this,Mi,"f").has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return ne(n,{received:n.data,code:K.invalid_enum_value,options:r}),me}return lt(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Dn.create(t,{...this._def,...n})}exclude(t,n=this._def){return Dn.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Mi=new WeakMap;Dn.create=Zm;class _o extends be{constructor(){super(...arguments),xi.set(this,void 0)}_parse(t){const n=Ce.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==ae.string&&r.parsedType!==ae.number){const a=Ce.objectValues(n);return ne(r,{expected:Ce.joinValues(a),received:r.parsedType,code:K.invalid_type}),me}if(rl(this,xi,"f")||Gm(this,xi,new Set(Ce.getValidEnumValues(this._def.values)),"f"),!rl(this,xi,"f").has(t.data)){const a=Ce.objectValues(n);return ne(r,{received:r.data,code:K.invalid_enum_value,options:a}),me}return lt(t.data)}get enum(){return this._def.values}}xi=new WeakMap;_o.create=(e,t)=>new _o({values:e,typeName:he.ZodNativeEnum,...ve(t)});class ua extends be{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ae.promise&&n.common.async===!1)return ne(n,{code:K.invalid_type,expected:ae.promise,received:n.parsedType}),me;const r=n.parsedType===ae.promise?n.data:Promise.resolve(n.data);return lt(r.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ua.create=(e,t)=>new ua({type:e,typeName:he.ZodPromise,...ve(t)});class Rt extends be{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===he.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),a=this._def.effect||null,o={addIssue:i=>{ne(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){const i=a.transform(r.data,o);if(r.common.async)return Promise.resolve(i).then(async s=>{if(n.value==="aborted")return me;const l=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return l.status==="aborted"?me:l.status==="dirty"||n.value==="dirty"?ra(l.value):l});{if(n.value==="aborted")return me;const s=this._def.schema._parseSync({data:i,path:r.path,parent:r});return s.status==="aborted"?me:s.status==="dirty"||n.value==="dirty"?ra(s.value):s}}if(a.type==="refinement"){const i=s=>{const l=a.refinement(s,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?me:(s.status==="dirty"&&n.dirty(),i(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?me:(s.status==="dirty"&&n.dirty(),i(s.value).then(()=>({status:n.value,value:s.value}))))}if(a.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ho(i))return i;const s=a.transform(i.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>ho(i)?Promise.resolve(a.transform(i.value,o)).then(s=>({status:n.value,value:s})):i);Ce.assertNever(a)}}Rt.create=(e,t,n)=>new Rt({schema:e,typeName:he.ZodEffects,effect:t,...ve(n)});Rt.createWithPreprocess=(e,t,n)=>new Rt({schema:t,effect:{type:"preprocess",transform:e},typeName:he.ZodEffects,...ve(n)});class Yt extends be{_parse(t){return this._getType(t)===ae.undefined?lt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Yt.create=(e,t)=>new Yt({innerType:e,typeName:he.ZodOptional,...ve(t)});class Un extends be{_parse(t){return this._getType(t)===ae.null?lt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Un.create=(e,t)=>new Un({innerType:e,typeName:he.ZodNullable,...ve(t)});class Co extends be{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===ae.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Co.create=(e,t)=>new Co({innerType:e,typeName:he.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ve(t)});class Eo extends be{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return mo(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new St(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new St(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Eo.create=(e,t)=>new Eo({innerType:e,typeName:he.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ve(t)});class Gi extends be{_parse(t){if(this._getType(t)!==ae.nan){const r=this._getOrReturnCtx(t);return ne(r,{code:K.invalid_type,expected:ae.nan,received:r.parsedType}),me}return{status:"valid",value:t.data}}}Gi.create=e=>new Gi({typeName:he.ZodNaN,...ve(e)});const Xm=Symbol("zod_brand");class jl extends be{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Io extends be{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?me:o.status==="dirty"?(n.dirty(),ra(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?me:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(t,n){return new Io({in:t,out:n,typeName:he.ZodPipeline})}}class Ao extends be{_parse(t){const n=this._def.innerType._parse(t),r=a=>(ho(a)&&(a.value=Object.freeze(a.value)),a);return mo(n)?n.then(a=>r(a)):r(n)}unwrap(){return this._def.innerType}}Ao.create=(e,t)=>new Ao({innerType:e,typeName:he.ZodReadonly,...ve(t)});function td(e,t={},n){return e?la.create().superRefine((r,a)=>{var o,i;if(!e(r)){const s=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(i=(o=s.fatal)!==null&&o!==void 0?o:n)!==null&&i!==void 0?i:!0,u=typeof s=="string"?{message:s}:s;a.addIssue({code:"custom",...u,fatal:l})}}):la.create()}const ep={object:Le.lazycreate};var he;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(he||(he={}));const tp=(e,t={message:`Input not instance of ${e.name}`})=>td(n=>n instanceof e,t),nd=qt.create,rd=Nn.create,np=Gi.create,rp=zn.create,ad=po.create,ap=Er.create,op=Vi.create,ip=go.create,sp=yo.create,lp=la.create,up=hr.create,cp=gn.create,dp=Ji.create,fp=$t.create,hp=Le.create,mp=Le.strictCreate,pp=bo.create,gp=ns.create,yp=ko.create,bp=Xt.create,kp=wo.create,wp=Ki.create,vp=Ar.create,jp=ia.create,_p=vo.create,Cp=jo.create,Ep=Dn.create,Ap=_o.create,Sp=ua.create,al=Rt.create,Tp=Yt.create,Pp=Un.create,Bp=Rt.createWithPreprocess,Mp=Io.create,xp=()=>nd().optional(),Op=()=>rd().optional(),Ip=()=>ad().optional(),Rp={string:e=>qt.create({...e,coerce:!0}),number:e=>Nn.create({...e,coerce:!0}),boolean:e=>po.create({...e,coerce:!0}),bigint:e=>zn.create({...e,coerce:!0}),date:e=>Er.create({...e,coerce:!0})},Np=me;var He=Object.freeze({__proto__:null,defaultErrorMap:sa,setErrorMap:Jm,getErrorMap:Wi,makeIssue:Hi,EMPTY_PATH:Km,addIssueToContext:ne,ParseStatus:rt,INVALID:me,DIRTY:ra,OK:lt,isAborted:tl,isDirty:nl,isValid:ho,isAsync:mo,get util(){return Ce},get objectUtil(){return el},ZodParsedType:ae,getParsedType:Pn,ZodType:be,datetimeRegex:ed,ZodString:qt,ZodNumber:Nn,ZodBigInt:zn,ZodBoolean:po,ZodDate:Er,ZodSymbol:Vi,ZodUndefined:go,ZodNull:yo,ZodAny:la,ZodUnknown:hr,ZodNever:gn,ZodVoid:Ji,ZodArray:$t,ZodObject:Le,ZodUnion:bo,ZodDiscriminatedUnion:ns,ZodIntersection:ko,ZodTuple:Xt,ZodRecord:wo,ZodMap:Ki,ZodSet:Ar,ZodFunction:ia,ZodLazy:vo,ZodLiteral:jo,ZodEnum:Dn,ZodNativeEnum:_o,ZodPromise:ua,ZodEffects:Rt,ZodTransformer:Rt,ZodOptional:Yt,ZodNullable:Un,ZodDefault:Co,ZodCatch:Eo,ZodNaN:Gi,BRAND:Xm,ZodBranded:jl,ZodPipeline:Io,ZodReadonly:Ao,custom:td,Schema:be,ZodSchema:be,late:ep,get ZodFirstPartyTypeKind(){return he},coerce:Rp,any:lp,array:fp,bigint:rp,boolean:ad,date:ap,discriminatedUnion:gp,effect:al,enum:Ep,function:jp,instanceof:tp,intersection:yp,lazy:_p,literal:Cp,map:wp,nan:np,nativeEnum:Ap,never:cp,null:sp,nullable:Pp,number:rd,object:hp,oboolean:Ip,onumber:Op,optional:Tp,ostring:xp,pipeline:Mp,preprocess:Bp,promise:Sp,record:kp,set:vp,strictObject:mp,string:nd,symbol:op,transformer:al,tuple:bp,undefined:ip,union:pp,unknown:up,void:dp,NEVER:Np,ZodIssueCode:K,quotelessJson:Hm,ZodError:St});const zj=Object.freeze(Object.defineProperty({__proto__:null,BRAND:Xm,DIRTY:ra,EMPTY_PATH:Km,INVALID:me,NEVER:Np,OK:lt,ParseStatus:rt,Schema:be,ZodAny:la,ZodArray:$t,ZodBigInt:zn,ZodBoolean:po,ZodBranded:jl,ZodCatch:Eo,ZodDate:Er,ZodDefault:Co,ZodDiscriminatedUnion:ns,ZodEffects:Rt,ZodEnum:Dn,ZodError:St,get ZodFirstPartyTypeKind(){return he},ZodFunction:ia,ZodIntersection:ko,ZodIssueCode:K,ZodLazy:vo,ZodLiteral:jo,ZodMap:Ki,ZodNaN:Gi,ZodNativeEnum:_o,ZodNever:gn,ZodNull:yo,ZodNullable:Un,ZodNumber:Nn,ZodObject:Le,ZodOptional:Yt,ZodParsedType:ae,ZodPipeline:Io,ZodPromise:ua,ZodReadonly:Ao,ZodRecord:wo,ZodSchema:be,ZodSet:Ar,ZodString:qt,ZodSymbol:Vi,ZodTransformer:Rt,ZodTuple:Xt,ZodType:be,ZodUndefined:go,ZodUnion:bo,ZodUnknown:hr,ZodVoid:Ji,addIssueToContext:ne,any:lp,array:fp,bigint:rp,boolean:ad,coerce:Rp,custom:td,date:ap,datetimeRegex:ed,default:He,defaultErrorMap:sa,discriminatedUnion:gp,effect:al,enum:Ep,function:jp,getErrorMap:Wi,getParsedType:Pn,instanceof:tp,intersection:yp,isAborted:tl,isAsync:mo,isDirty:nl,isValid:ho,late:ep,lazy:_p,literal:Cp,makeIssue:Hi,map:wp,nan:np,nativeEnum:Ap,never:cp,null:sp,nullable:Pp,number:rd,object:hp,get objectUtil(){return el},oboolean:Ip,onumber:Op,optional:Tp,ostring:xp,pipeline:Mp,preprocess:Bp,promise:Sp,quotelessJson:Hm,record:kp,set:vp,setErrorMap:Jm,strictObject:mp,string:nd,symbol:op,transformer:al,tuple:bp,undefined:ip,union:pp,unknown:up,get util(){return Ce},void:dp,z:He},Symbol.toStringTag,{value:"Module"})),Dj=He.object({address:He.string(),network:He.enum([Li.MAINNET,Li.TESTNET]),public_key:He.string(),proof:He.object({timestamp:He.number(),domain:He.object({lengthBytes:He.number(),value:He.string()}),payload:He.string(),signature:He.string(),state_init:He.string()})});var Ue={},de={},Nt={};const Uj=Symbol.for("nodejs.util.inspect.custom");var Ro=Uj,No={};Object.defineProperty(No,"__esModule",{value:!0});No.crc16=void 0;function Fj(e){let n=0;const r=Buffer.alloc(e.length+2);r.set(e);for(let a of r){let o=128;for(;o>0;)n<<=1,a&o&&(n+=1),o>>=1,n>65535&&(n&=65535,n^=4129)}return Buffer.from([Math.floor(n/256),n%256])}No.crc16=Fj;var Lj=re&&re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},zp;Object.defineProperty(Nt,"__esModule",{value:!0});Nt.address=Nt.Address=void 0;const qj=Lj(Ro),Dp=No,kc=17,Up=81,wc=128;function wf(e){if(typeof e=="string"&&!od.isFriendly(e))throw new Error("Unknown address type");const t=Buffer.isBuffer(e)?e:Buffer.from(e,"base64");if(t.length!==36)throw new Error("Unknown address type: byte length is not equal to 36");const n=t.subarray(0,34),r=t.subarray(34,36),a=(0,Dp.crc16)(n);if(!(a[0]===r[0]&&a[1]===r[1]))throw new Error("Invalid checksum: "+e);let o=n[0],i=!1,s=!1;if(o&wc&&(i=!0,o=o^wc),o!==kc&&o!==Up)throw"Unknown address tag";s=o===kc;let l=null;n[1]===255?l=-1:l=n[1];const u=n.subarray(2,34);return{isTestOnly:i,isBounceable:s,workchain:l,hashPart:u}}let od=class ir{static isAddress(t){return t instanceof ir}static isFriendly(t){return!(t.length!==48||!/[A-Za-z0-9+/_-]+/.test(t))}static isRaw(t){if(t.indexOf(":")===-1)return!1;let[n,r]=t.split(":");return!(!Number.isInteger(parseFloat(n))||!/[a-f0-9]+/.test(r.toLowerCase())||r.length!==64)}static normalize(t){return typeof t=="string"?ir.parse(t).toString():t.toString()}static parse(t){if(ir.isFriendly(t))return this.parseFriendly(t).address;if(ir.isRaw(t))return this.parseRaw(t);throw new Error("Unknown address type: "+t)}static parseRaw(t){let n=parseInt(t.split(":")[0]),r=Buffer.from(t.split(":")[1],"hex");return new ir(n,r)}static parseFriendly(t){if(Buffer.isBuffer(t)){let n=wf(t);return{isBounceable:n.isBounceable,isTestOnly:n.isTestOnly,address:new ir(n.workchain,n.hashPart)}}else{let n=t.replace(/\-/g,"+").replace(/_/g,"/"),r=wf(n);return{isBounceable:r.isBounceable,isTestOnly:r.isTestOnly,address:new ir(r.workchain,r.hashPart)}}}constructor(t,n){if(this.toRawString=()=>this.workChain+":"+this.hash.toString("hex"),this.toRaw=()=>{const r=Buffer.alloc(36);return r.set(this.hash),r.set([this.workChain,this.workChain,this.workChain,this.workChain],32),r},this.toStringBuffer=r=>{let a=r&&r.testOnly!==void 0?r.testOnly:!1,i=(r&&r.bounceable!==void 0?r.bounceable:!0)?kc:Up;a&&(i|=wc);const s=Buffer.alloc(34);s[0]=i,s[1]=this.workChain,s.set(this.hash,2);const l=Buffer.alloc(36);return l.set(s),l.set((0,Dp.crc16)(s),34),l},this.toString=r=>{let a=r&&r.urlSafe!==void 0?r.urlSafe:!0,o=this.toStringBuffer(r);return a?o.toString("base64").replace(/\+/g,"-").replace(/\//g,"_"):o.toString("base64")},this[zp]=()=>this.toString(),n.length!==32)throw new Error("Invalid address hash length: "+n.length);this.workChain=t,this.hash=n,Object.freeze(this)}equals(t){return t.workChain!==this.workChain?!1:t.hash.equals(this.hash)}};Nt.Address=od;zp=qj.default;function $j(e){return od.parse(e)}Nt.address=$j;var zo={},Wj=re&&re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Fp;Object.defineProperty(zo,"__esModule",{value:!0});zo.ExternalAddress=void 0;const Hj=Wj(Ro);class id{static isAddress(t){return t instanceof id}constructor(t,n){this[Fp]=()=>this.toString(),this.value=t,this.bits=n}toString(){return`External<${this.bits}:${this.value}>`}}zo.ExternalAddress=id;Fp=Hj.default;var _l={},ca={};Object.defineProperty(ca,"__esModule",{value:!0});ca.base32Decode=ca.base32Encode=void 0;const vc="abcdefghijklmnopqrstuvwxyz234567";function Vj(e){const t=e.byteLength;let n=0,r=0,a="";for(let o=0;o=5;)a+=vc[r>>>n-5&31],n-=5;return n>0&&(a+=vc[r<<5-n&31]),a}ca.base32Encode=Vj;function Jj(e,t){const n=e.indexOf(t);if(n===-1)throw new Error("Invalid character found: "+t);return n}function Kj(e){let t;t=e.toLowerCase();const{length:n}=t;let r=0,a=0,o=0;const i=Buffer.alloc(n*5/8|0);for(let s=0;s=8&&(i[o++]=a>>>r-8&255,r-=8);return i}ca.base32Decode=Kj;var Gj=re&&re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Lp;Object.defineProperty(_l,"__esModule",{value:!0});_l.ADNLAddress=void 0;const Yj=Gj(Ro),vf=ca,jf=No;class ol{static parseFriendly(t){if(t.length!==55)throw Error("Invalid address");t="f"+t;let n=(0,vf.base32Decode)(t);if(n[0]!==45)throw Error("Invalid address");let r=n.slice(33);if(!(0,jf.crc16)(n.slice(0,33)).equals(r))throw Error("Invalid address");return new ol(n.slice(1,33))}static parseRaw(t){const n=Buffer.from(t,"base64");return new ol(n)}constructor(t){if(this.toRaw=()=>this.address.toString("hex").toUpperCase(),this.toString=()=>{let n=Buffer.concat([Buffer.from([45]),this.address]),r=(0,jf.crc16)(n);return n=Buffer.concat([n,r]),(0,vf.base32Encode)(n).slice(1)},this[Lp]=()=>this.toString(),t.length!==32)throw Error("Invalid address");this.address=t}equals(t){return this.address.equals(t.address)}}_l.ADNLAddress=ol;Lp=Yj.default;var Cl={},Vr={},li={},ui={},Jr={},_f;function El(){if(_f)return Jr;_f=1,Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.paddedBufferToBits=Jr.bitsToPaddedBuffer=void 0;const e=Al(),t=Lr();function n(a){let o=new e.BitBuilder(Math.ceil(a.length/8)*8);o.writeBits(a);let i=Math.ceil(a.length/8)*8-a.length;for(let s=0;s=0;i--)if(a[i]!==0){const s=a[i];let l=s&-s;l&1||(l=Math.log2(l)+1),i>0&&(o=i<<3),o+=8-l;break}return new t.BitString(a,0,o)}return Jr.paddedBufferToBits=r,Jr}var Cf;function Lr(){if(Cf)return ui;Cf=1;var e=re&&re.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t;Object.defineProperty(ui,"__esModule",{value:!0}),ui.BitString=void 0;const n=El(),r=e(Ro);let a=class qs{static isBitString(i){return i instanceof qs}constructor(i,s,l){if(this[t]=()=>this.toString(),l<0)throw new Error(`Length ${l} is out of bounds`);this._length=l,this._data=i,this._offset=s}get length(){return this._length}at(i){if(i>=this._length)throw new Error(`Index ${i} > ${this._length} is out of bounds`);if(i<0)throw new Error(`Index ${i} < 0 is out of bounds`);let s=this._offset+i>>3,l=7-(this._offset+i)%8;return(this._data[s]&1<this._length)throw new Error(`Offset(${i}) > ${this._length} is out of bounds`);if(i<0)throw new Error(`Offset(${i}) < 0 is out of bounds`);if(s===0)return qs.EMPTY;if(i+s>this._length)throw new Error(`Offset ${i} + Length ${s} > ${this._length} is out of bounds`);return new qs(this._data,this._offset+i,s)}subbuffer(i,s){if(i>this._length)throw new Error(`Offset ${i} is out of bounds`);if(i<0)throw new Error(`Offset ${i} is out of bounds`);if(i+s>this._length)throw new Error(`Offset + Lenght = ${i+s} is out of bounds`);if(s%8!==0||(this._offset+i)%8!==0)return null;let l=this._offset+i>>3,u=l+(s>>3);return this._data.subarray(l,u)}equals(i){if(this._length!==i._length)return!1;for(let s=0;sthis._buffer.length*8)throw new Error("BitBuilder overflow");(typeof o=="boolean"&&o===!0||typeof o=="number"&&o>0)&&(this._buffer[i/8|0]|=1<<7-i%8),this._length++}writeBits(o){for(let i=0;ithis._buffer.length*8)throw new Error("BitBuilder overflow");o.copy(this._buffer,this._length/8),this._length+=o.length*8}else for(let i=0;i=l)throw Error(`bitLength is too small for a value ${o}. Got ${i}`);if(this._length+i>this._buffer.length*8)throw new Error("BitBuilder overflow");const u=8-this._length%8;if(u>0){const c=Math.floor(this._length/8);if(i>BigInt(i-u));this._buffer[c]|=d,this._length+=u}}for(i-=u;i>0;)i>=8?(this._buffer[this._length/8]=Number(s>>BigInt(i-8)&0xffn),this._length+=8,i-=8):(this._buffer[this._length/8]=Number(s<=l)throw Error(`value is out of range for ${i} bits. Got ${o}`);s<0?(this.writeBit(!0),s=l+s):this.writeBit(!1),this.writeUint(s,i-1)}writeVarUint(o,i){let s=BigInt(o);if(i<0||!Number.isSafeInteger(i))throw Error(`invalid bit length. Got ${i}`);if(s<0)throw Error(`value is negative. Got ${o}`);if(s===0n){this.writeUint(0,i);return}const l=Math.ceil(s.toString(2).length/8),u=l*8;this.writeUint(l,i),this.writeUint(s,u)}writeVarInt(o,i){let s=BigInt(o);if(i<0||!Number.isSafeInteger(i))throw Error(`invalid bit length. Got ${i}`);if(s===0n){this.writeUint(0,i);return}let l=s>0?s:-s;const u=1+Math.ceil(l.toString(2).length/8),c=u*8;this.writeUint(u,i),this.writeInt(s,c)}writeCoins(o){this.writeVarUint(o,4)}writeAddress(o){if(o==null){this.writeUint(0,2);return}if(e.Address.isAddress(o)){this.writeUint(2,2),this.writeUint(0,1),this.writeInt(o.workChain,8),this.writeBuffer(o.hash);return}if(t.ExternalAddress.isAddress(o)){this.writeUint(1,2),this.writeUint(o.bits,9),this.writeUint(o.value,o.bits);return}throw Error(`Invalid address. Got ${o}`)}build(){return new n.BitString(this._buffer,0,this._length)}buffer(){if(this._length%8!==0)throw new Error("BitBuilder buffer is not byte aligned");return this._buffer.subarray(0,this._length/8)}};return li.BitBuilder=r,li}var ci={},qr={};Object.defineProperty(qr,"__esModule",{value:!0});qr.CellType=void 0;var Af;(function(e){e[e.Ordinary=-1]="Ordinary",e[e.PrunedBranch=1]="PrunedBranch",e[e.Library=2]="Library",e[e.MerkleProof=3]="MerkleProof",e[e.MerkleUpdate=4]="MerkleUpdate"})(Af||(qr.CellType=Af={}));var di={},fi={},hi={},Sl={};Object.defineProperty(Sl,"__esModule",{value:!0});Sl.readUnaryLength=void 0;function Qj(e){let t=0;for(;e.loadBit();)t++;return t}Sl.readUnaryLength=Qj;var Sf;function sd(){if(Sf)return hi;Sf=1,Object.defineProperty(hi,"__esModule",{value:!0}),hi.generateMerkleProof=void 0;const e=Ze(),t=Sl;function n(i){return(0,e.beginCell)().storeUint(1,8).storeUint(1,8).storeBuffer(i.hash(0)).storeUint(i.depth(0),16).endCell({exotic:!0})}function r(i){return(0,e.beginCell)().storeUint(3,8).storeBuffer(i.hash(0)).storeUint(i.depth(0),16).storeRef(i).endCell({exotic:!0})}function a(i,s,l,u){const c=s.asCell();let d=s.loadBit()?1:0,b=0,m=i;if(d===0){b=(0,t.readUnaryLength)(s);for(let p=0;p0&&h.storeUint(BigInt("0b"+y),y.length),h}dt.writeLabelShort=s;function l(y){return 1+y.length+1+y.length}function u(y,h,C){C.storeBit(1),C.storeBit(0);let _=Math.ceil(Math.log2(h+1));return C.storeUint(y.length,_),y.length>0&&C.storeUint(BigInt("0b"+y),y.length),C}dt.writeLabelLong=u;function c(y,h){return 1+1+Math.ceil(Math.log2(h+1))+y.length}function d(y,h,C,_){_.storeBit(1),_.storeBit(1),_.storeBit(y);let x=Math.ceil(Math.log2(C+1));_.storeUint(h,x)}dt.writeLabelSame=d;function b(y){return 1+1+1+Math.ceil(Math.log2(y+1))}function m(y){if(y.length===0||y.length===1)return!0;for(let h=1;h(0,l.deserializeInternalKey)(R))}values(){return Array.from(this._map.values())}store(R,B,V){if(this._map.size===0)R.storeBit(0);else{let ie=this._key;B!=null&&(ie=B);let se=this._value;if(V!=null&&(se=V),!ie)throw Error("Key serializer is not defined");if(!se)throw Error("Value serializer is not defined");let M=new Map;for(const[Me,qe]of this._map)M.set(ie.serialize((0,l.deserializeInternalKey)(Me)),qe);R.storeBit(1);let Oe=(0,t.beginCell)();(0,s.serializeDict)(M,ie.bits,se.serialize,Oe),R.storeRef(Oe.endCell())}}storeDirect(R,B,V){if(this._map.size===0)throw Error("Cannot store empty dictionary directly");let ie=this._key;B!=null&&(ie=B);let se=this._value;if(V!=null&&(se=V),!ie)throw Error("Key serializer is not defined");if(!se)throw Error("Value serializer is not defined");let M=new Map;for(const[Oe,Me]of this._map)M.set(ie.serialize((0,l.deserializeInternalKey)(Oe)),Me);(0,s.serializeDict)(M,ie.bits,se.serialize,R)}generateMerkleProof(R){return(0,a.generateMerkleProof)(this,R,this._key)}generateMerkleUpdate(R,B){return(0,o.generateMerkleUpdate)(this,R,this._key,B)}};fi.Dictionary=u,u.Keys={Address:()=>c(),BigInt:N=>d(N),Int:N=>b(N),BigUint:N=>m(N),Uint:N=>p(N),Buffer:N=>f(N),BitString:N=>k(N)},u.Values={BigInt:N=>A(N),Int:N=>T(N),BigVarInt:N=>y(N),BigUint:N=>_(N),Uint:N=>C(N),BigVarUint:N=>h(N),Bool:()=>x(),Address:()=>H(),Cell:()=>L(),Buffer:N=>ee(N),BitString:N=>ce(N),Dictionary:(N,R)=>G(N,R)};function c(){return{bits:267,serialize:N=>{if(!e.Address.isAddress(N))throw Error("Key is not an address");return(0,t.beginCell)().storeAddress(N).endCell().beginParse().preloadUintBig(267)},parse:N=>(0,t.beginCell)().storeUint(N,267).endCell().beginParse().loadAddress()}}function d(N){return{bits:N,serialize:R=>{if(typeof R!="bigint")throw Error("Key is not a bigint");return(0,t.beginCell)().storeInt(R,N).endCell().beginParse().loadUintBig(N)},parse:R=>(0,t.beginCell)().storeUint(R,N).endCell().beginParse().loadIntBig(N)}}function b(N){return{bits:N,serialize:R=>{if(typeof R!="number")throw Error("Key is not a number");if(!Number.isSafeInteger(R))throw Error("Key is not a safe integer: "+R);return(0,t.beginCell)().storeInt(R,N).endCell().beginParse().loadUintBig(N)},parse:R=>(0,t.beginCell)().storeUint(R,N).endCell().beginParse().loadInt(N)}}function m(N){return{bits:N,serialize:R=>{if(typeof R!="bigint")throw Error("Key is not a bigint");if(R<0)throw Error("Key is negative: "+R);return(0,t.beginCell)().storeUint(R,N).endCell().beginParse().loadUintBig(N)},parse:R=>(0,t.beginCell)().storeUint(R,N).endCell().beginParse().loadUintBig(N)}}function p(N){return{bits:N,serialize:R=>{if(typeof R!="number")throw Error("Key is not a number");if(!Number.isSafeInteger(R))throw Error("Key is not a safe integer: "+R);if(R<0)throw Error("Key is negative: "+R);return(0,t.beginCell)().storeUint(R,N).endCell().beginParse().loadUintBig(N)},parse:R=>Number((0,t.beginCell)().storeUint(R,N).endCell().beginParse().loadUint(N))}}function f(N){return{bits:N*8,serialize:R=>{if(!Buffer.isBuffer(R))throw Error("Key is not a buffer");return(0,t.beginCell)().storeBuffer(R).endCell().beginParse().loadUintBig(N*8)},parse:R=>(0,t.beginCell)().storeUint(R,N*8).endCell().beginParse().loadBuffer(N)}}function k(N){return{bits:N,serialize:R=>{if(!r.BitString.isBitString(R))throw Error("Key is not a BitString");return(0,t.beginCell)().storeBits(R).endCell().beginParse().loadUintBig(N)},parse:R=>(0,t.beginCell)().storeUint(R,N).endCell().beginParse().loadBits(N)}}function T(N){return{serialize:(R,B)=>{B.storeInt(R,N)},parse:R=>R.loadInt(N)}}function A(N){return{serialize:(R,B)=>{B.storeInt(R,N)},parse:R=>R.loadIntBig(N)}}function y(N){return{serialize:(R,B)=>{B.storeVarInt(R,N)},parse:R=>R.loadVarIntBig(N)}}function h(N){return{serialize:(R,B)=>{B.storeVarUint(R,N)},parse:R=>R.loadVarUintBig(N)}}function C(N){return{serialize:(R,B)=>{B.storeUint(R,N)},parse:R=>R.loadUint(N)}}function _(N){return{serialize:(R,B)=>{B.storeUint(R,N)},parse:R=>R.loadUintBig(N)}}function x(){return{serialize:(N,R)=>{R.storeBit(N)},parse:N=>N.loadBit()}}function H(){return{serialize:(N,R)=>{R.storeAddress(N)},parse:N=>N.loadAddress()}}function L(){return{serialize:(N,R)=>{R.storeRef(N)},parse:N=>N.loadRef()}}function G(N,R){return{serialize:(B,V)=>{B.store(V)},parse:B=>u.load(N,R,B)}}function ee(N){return{serialize:(R,B)=>{if(R.length!==N)throw Error("Invalid buffer size");B.storeBuffer(R)},parse:R=>R.loadBuffer(N)}}function ce(N){return{serialize:(R,B)=>{if(R.length!==N)throw Error("Invalid BitString size");B.storeBits(R)},parse:R=>R.loadBits(N)}}return fi}var Cn={},Mf;function Wp(){if(Mf)return Cn;Mf=1,Object.defineProperty(Cn,"__esModule",{value:!0}),Cn.writeString=Cn.stringToCell=Cn.readString=void 0;const e=Ze();function t(i){if(i.remainingBits%8!==0)throw new Error(`Invalid string length: ${i.remainingBits}`);if(i.remainingRefs!==0&&i.remainingRefs!==1)throw new Error(`invalid number of refs: ${i.remainingRefs}`);let s;return i.remainingBits===0?s=Buffer.alloc(0):s=i.loadBuffer(i.remainingBits/8),i.remainingRefs===1&&(s=Buffer.concat([s,t(i.loadRef().beginParse())])),s}function n(i){return t(i).toString()}Cn.readString=n;function r(i,s){if(i.length>0){let l=Math.floor(s.availableBits/8);if(i.length>l){let u=i.subarray(0,l),c=i.subarray(l);s=s.storeBuffer(u);let d=(0,e.beginCell)();r(c,d),s=s.storeRef(d.endCell())}else s=s.storeBuffer(i)}}function a(i){let s=(0,e.beginCell)();return r(Buffer.from(i),s),s.endCell()}Cn.stringToCell=a;function o(i,s){r(Buffer.from(i),s)}return Cn.writeString=o,Cn}var xf;function ld(){if(xf)return di;xf=1;var e=re&&re.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t;Object.defineProperty(di,"__esModule",{value:!0}),di.Slice=void 0;const n=e(Ro),r=$a(),a=Ze(),o=Wp();let i=class Cc{constructor(l,u){this[t]=()=>this.toString(),this._reader=l.clone(),this._refs=[...u],this._refsOffset=0}get remainingBits(){return this._reader.remaining}get offsetBits(){return this._reader.offset}get remainingRefs(){return this._refs.length-this._refsOffset}get offsetRefs(){return this._refsOffset}skip(l){return this._reader.skip(l),this}loadBit(){return this._reader.loadBit()}preloadBit(){return this._reader.preloadBit()}loadBoolean(){return this.loadBit()}loadMaybeBoolean(){return this.loadBit()?this.loadBoolean():null}loadBits(l){return this._reader.loadBits(l)}preloadBits(l){return this._reader.preloadBits(l)}loadUint(l){return this._reader.loadUint(l)}loadUintBig(l){return this._reader.loadUintBig(l)}preloadUint(l){return this._reader.preloadUint(l)}preloadUintBig(l){return this._reader.preloadUintBig(l)}loadMaybeUint(l){return this.loadBit()?this.loadUint(l):null}loadMaybeUintBig(l){return this.loadBit()?this.loadUintBig(l):null}loadInt(l){return this._reader.loadInt(l)}loadIntBig(l){return this._reader.loadIntBig(l)}preloadInt(l){return this._reader.preloadInt(l)}preloadIntBig(l){return this._reader.preloadIntBig(l)}loadMaybeInt(l){return this.loadBit()?this.loadInt(l):null}loadMaybeIntBig(l){return this.loadBit()?this.loadIntBig(l):null}loadVarUint(l){return this._reader.loadVarUint(l)}loadVarUintBig(l){return this._reader.loadVarUintBig(l)}preloadVarUint(l){return this._reader.preloadVarUint(l)}preloadVarUintBig(l){return this._reader.preloadVarUintBig(l)}loadVarInt(l){return this._reader.loadVarInt(l)}loadVarIntBig(l){return this._reader.loadVarIntBig(l)}preloadVarInt(l){return this._reader.preloadVarInt(l)}preloadVarIntBig(l){return this._reader.preloadVarIntBig(l)}loadCoins(){return this._reader.loadCoins()}preloadCoins(){return this._reader.preloadCoins()}loadMaybeCoins(){return this._reader.loadBit()?this._reader.loadCoins():null}loadAddress(){return this._reader.loadAddress()}loadMaybeAddress(){return this._reader.loadMaybeAddress()}loadExternalAddress(){return this._reader.loadExternalAddress()}loadMaybeExternalAddress(){return this._reader.loadMaybeExternalAddress()}loadAddressAny(){return this._reader.loadAddressAny()}loadRef(){if(this._refsOffset>=this._refs.length)throw new Error("No more references");return this._refs[this._refsOffset++]}preloadRef(){if(this._refsOffset>=this._refs.length)throw new Error("No more references");return this._refs[this._refsOffset]}loadMaybeRef(){return this.loadBit()?this.loadRef():null}preloadMaybeRef(){return this.preloadBit()?this.preloadRef():null}loadBuffer(l){return this._reader.loadBuffer(l)}preloadBuffer(l){return this._reader.preloadBuffer(l)}loadStringTail(){return(0,o.readString)(this)}loadMaybeStringTail(){return this.loadBit()?(0,o.readString)(this):null}loadStringRefTail(){return(0,o.readString)(this.loadRef().beginParse())}loadMaybeStringRefTail(){const l=this.loadMaybeRef();return l?(0,o.readString)(l.beginParse()):null}loadDict(l,u){return r.Dictionary.load(l,u,this)}loadDictDirect(l,u){return r.Dictionary.loadDirect(l,u,this)}endParse(){if(this.remainingBits>0||this.remainingRefs>0)throw new Error("Slice is not empty")}asCell(){return(0,a.beginCell)().storeSlice(this).endCell()}asBuilder(){return(0,a.beginCell)().storeSlice(this)}clone(l=!1){if(l){let u=this._reader.clone();return u.reset(),new Cc(u,this._refs)}else{let u=new Cc(this._reader,this._refs);return u._refsOffset=this._refsOffset,u}}toString(){return this.asCell().toString()}};return di.Slice=i,t=n.default,di}var Bl={},en={};Object.defineProperty(en,"__esModule",{value:!0});en.BitReader=void 0;const o_=Nt,i_=zo;class ud{constructor(t,n=0){this._checkpoints=[],this._bits=t,this._offset=n}get offset(){return this._offset}get remaining(){return this._bits.length-this._offset}skip(t){if(t<0||this._offset+t>this._bits.length)throw new Error(`Index ${this._offset+t} is out of bounds`);this._offset+=t}reset(){this._checkpoints.length>0?this._offset=this._checkpoints.pop():this._offset=0}save(){this._checkpoints.push(this._offset)}loadBit(){let t=this._bits.at(this._offset);return this._offset++,t}preloadBit(){return this._bits.at(this._offset)}loadBits(t){let n=this._bits.substring(this._offset,t);return this._offset+=t,n}preloadBits(t){return this._bits.substring(this._offset,t)}loadBuffer(t){let n=this._preloadBuffer(t,this._offset);return this._offset+=t*8,n}preloadBuffer(t){return this._preloadBuffer(t,this._offset)}loadUint(t){return Number(this.loadUintBig(t))}loadUintBig(t){let n=this.preloadUintBig(t);return this._offset+=t,n}preloadUint(t){return Number(this._preloadUint(t,this._offset))}preloadUintBig(t){return this._preloadUint(t,this._offset)}loadInt(t){let n=this._preloadInt(t,this._offset);return this._offset+=t,Number(n)}loadIntBig(t){let n=this._preloadInt(t,this._offset);return this._offset+=t,n}preloadInt(t){return Number(this._preloadInt(t,this._offset))}preloadIntBig(t){return this._preloadInt(t,this._offset)}loadVarUint(t){let n=Number(this.loadUint(t));return Number(this.loadUintBig(n*8))}loadVarUintBig(t){let n=Number(this.loadUint(t));return this.loadUintBig(n*8)}preloadVarUint(t){let n=Number(this._preloadUint(t,this._offset));return Number(this._preloadUint(n*8,this._offset+t))}preloadVarUintBig(t){let n=Number(this._preloadUint(t,this._offset));return this._preloadUint(n*8,this._offset+t)}loadVarInt(t){let n=Number(this.loadUint(t));return Number(this.loadIntBig(n*8))}loadVarIntBig(t){let n=Number(this.loadUint(t));return this.loadIntBig(n*8)}preloadVarInt(t){let n=Number(this._preloadUint(t,this._offset));return Number(this._preloadInt(n*8,this._offset+t))}preloadVarIntBig(t){let n=Number(this._preloadUint(t,this._offset));return this._preloadInt(n*8,this._offset+t)}loadCoins(){return this.loadVarUintBig(4)}preloadCoins(){return this.preloadVarUintBig(4)}loadAddress(){let t=Number(this._preloadUint(2,this._offset));if(t===2)return this._loadInternalAddress();throw new Error("Invalid address: "+t)}loadMaybeAddress(){let t=Number(this._preloadUint(2,this._offset));if(t===0)return this._offset+=2,null;if(t===2)return this._loadInternalAddress();throw new Error("Invalid address")}loadExternalAddress(){if(Number(this._preloadUint(2,this._offset))===1)return this._loadExternalAddress();throw new Error("Invalid address")}loadMaybeExternalAddress(){let t=Number(this._preloadUint(2,this._offset));if(t===0)return this._offset+=2,null;if(t===1)return this._loadExternalAddress();throw new Error("Invalid address")}loadAddressAny(){let t=Number(this._preloadUint(2,this._offset));if(t===0)return this._offset+=2,null;if(t===2)return this._loadInternalAddress();if(t===1)return this._loadExternalAddress();throw Error(t===3?"Unsupported":"Unreachable")}loadPaddedBits(t){if(t%8!==0)throw new Error("Invalid number of bits");let n=t;for(;;)if(this._bits.at(this._offset+n-1)){n--;break}else n--;let r=this._bits.substring(this._offset,n);return this._offset+=t,r}clone(){return new ud(this._bits,this._offset)}_preloadInt(t,n){if(t==0)return 0n;let r=this._bits.at(n),a=0n;for(let o=0;o>t-1)%2!==0}}Lo.LevelMask=cd;function h_(e){return e=e-(e>>1&1431655765),e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}Object.defineProperty(Fo,"__esModule",{value:!0});Fo.exoticPruned=void 0;const m_=en,Of=Lo;function p_(e,t){let n=new m_.BitReader(e),r=n.loadUint(8);if(r!==1)throw new Error(`Pruned branch cell must have type 1, got "${r}"`);if(t.length!==0)throw new Error(`Pruned Branch cell can't has refs, got "${t.length}"`);let a;if(e.length===280)a=new Of.LevelMask(1);else{if(a=new Of.LevelMask(n.loadUint(8)),a.level<1||a.level>3)throw new Error(`Pruned Branch cell level must be >= 1 and <= 3, got "${a.level}/${a.value}"`);const l=8+8+a.apply(a.level-1).hashCount*(256+16);if(e.length!==l)throw new Error(`Pruned branch cell must have exactly ${l} bits, got "${e.length}"`)}let o=[],i=[],s=[];for(let l=0;l>1);return{type:Ml.CellType.MerkleProof,depths:n,hashes:r,mask:a}}function C_(e,t){(0,k_.exoticMerkleUpdate)(e,t);let n=[],r=[],a=new xl.LevelMask((t[0].level()|t[1].level())>>1);return{type:Ml.CellType.MerkleUpdate,depths:n,hashes:r,mask:a}}function E_(e,t){let r=new g_.BitReader(e).preloadUint(8);if(r===1)return v_(e,t);if(r===2)return j_(e,t);if(r===3)return __(e,t);if(r===4)return C_(e,t);throw Error("Invalid exotic cell type: "+r)}Bl.resolveExotic=E_;var Ol={},xn={};Object.defineProperty(xn,"__esModule",{value:!0});xn.getRepr=xn.getBitsDescriptor=xn.getRefsDescriptor=void 0;const Oi=qr,A_=El();function Hp(e,t,n){return e.length+(n!==Oi.CellType.Ordinary?1:0)*8+t*32}xn.getRefsDescriptor=Hp;function Vp(e){let t=e.length;return Math.ceil(t/8)+Math.floor(t/8)}xn.getBitsDescriptor=Vp;function S_(e,t,n,r,a,o){const i=Math.ceil(t.length/8),s=Buffer.alloc(2+i+(2+32)*n.length);let l=0;s[l++]=Hp(n,a,o),s[l++]=Vp(e),(0,A_.bitsToPaddedBuffer)(t).copy(s,l),l+=i;for(const u of n){let c;o==Oi.CellType.MerkleProof||o==Oi.CellType.MerkleUpdate?c=u.depth(r+1):c=u.depth(r),s[l++]=Math.floor(c/256),s[l++]=c%256}for(const u of n){let c;o==Oi.CellType.MerkleProof||o==Oi.CellType.MerkleUpdate?c=u.hash(r+1):c=u.hash(r),c.copy(s,l),l+=32}return s}xn.getRepr=S_;var $u={},mr={},Jp={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(re,function(){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function r(P,g,j,E){var O,v,q,$=g||[0],J=(j=j||0)>>>3,X=E===-1?3:0;for(O=0;O>>2,$.length<=v&&$.push(0),$[v]|=P[O]<<8*(X+E*(q%4));return{value:$,binLen:8*P.length+j}}function a(P,g,j){switch(g){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw new Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(P){case"HEX":return function(E,O,v){return function(q,$,J,X){var le,Z,te,ke;if(q.length%2!=0)throw new Error("String of HEX type must be in byte increments");var Y=$||[0],Ee=(J=J||0)>>>3,je=X===-1?3:0;for(le=0;le>>1)+Ee)>>>2;Y.length<=te;)Y.push(0);Y[te]|=Z<<8*(je+X*(ke%4))}return{value:Y,binLen:4*q.length+J}}(E,O,v,j)};case"TEXT":return function(E,O,v){return function(q,$,J,X,le){var Z,te,ke,Y,Ee,je,Te,ze,Ht=0,ct=J||[0],Pt=(X=X||0)>>>3;if($==="UTF8")for(Te=le===-1?3:0,ke=0;ke(Z=q.charCodeAt(ke))?te.push(Z):2048>Z?(te.push(192|Z>>>6),te.push(128|63&Z)):55296>Z||57344<=Z?te.push(224|Z>>>12,128|Z>>>6&63,128|63&Z):(ke+=1,Z=65536+((1023&Z)<<10|1023&q.charCodeAt(ke)),te.push(240|Z>>>18,128|Z>>>12&63,128|Z>>>6&63,128|63&Z)),Y=0;Y>>2;ct.length<=Ee;)ct.push(0);ct[Ee]|=te[Y]<<8*(Te+le*(je%4)),Ht+=1}else for(Te=le===-1?2:0,ze=$==="UTF16LE"&&le!==1||$!=="UTF16LE"&&le===1,ke=0;ke>>8),Ee=(je=Ht+Pt)>>>2;ct.length<=Ee;)ct.push(0);ct[Ee]|=Z<<8*(Te+le*(je%4)),Ht+=2}return{value:ct,binLen:8*Ht+X}}(E,g,O,v,j)};case"B64":return function(E,O,v){return function(q,$,J,X){var le,Z,te,ke,Y,Ee,je=0,Te=$||[0],ze=(J=J||0)>>>3,Ht=X===-1?3:0,ct=q.indexOf("=");if(q.search(/^[a-zA-Z0-9=+/]+$/)===-1)throw new Error("Invalid character in base-64 string");if(q=q.replace(/=/g,""),ct!==-1&&ct{const n={},r=a=>{a.forEach(o=>{n[o]=!0})};return Wo(e)?r(e):r(String(e).split(t)),n},lA=()=>{},uA=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Yu="abcdefghijklmnopqrstuvwxyz",Gf="0123456789",oy={DIGIT:Gf,ALPHA:Yu,ALPHA_DIGIT:Yu+Yu.toUpperCase()+Gf},cA=(e=16,t=oy.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function dA(e){return!!(e&&xt(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const fA=e=>{const t=new Array(10),n=(r,a)=>{if(Xl(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[a]=r;const o=Wo(r)?[]:{};return cs(r,(i,s)=>{const l=n(i,a+1);!Qi(l)&&(o[s]=l)}),t[a]=void 0,o}}return r};return n(e,0)},hA=tn("AsyncFunction"),mA=e=>e&&(Xl(e)||xt(e))&&xt(e.then)&&xt(e.catch),iy=((e,t)=>e?setImmediate:t?((n,r)=>(aa.addEventListener("message",({source:a,data:o})=>{a===aa&&o===n&&r.length&&r.shift()()},!1),a=>{r.push(a),aa.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",xt(aa.postMessage)),pA=typeof queueMicrotask<"u"?queueMicrotask.bind(aa):typeof process<"u"&&process.nextTick||iy;var z={isArray:Wo,isArrayBuffer:ey,isBuffer:xE,isFormData:LE,isArrayBufferView:OE,isString:IE,isNumber:ty,isBoolean:RE,isObject:Xl,isPlainObject:$s,isReadableStream:$E,isRequest:WE,isResponse:HE,isHeaders:VE,isUndefined:Qi,isDate:NE,isFile:zE,isBlob:DE,isRegExp:oA,isFunction:xt,isStream:FE,isURLSearchParams:qE,isTypedArray:eA,isFileList:UE,forEach:cs,merge:Bc,extend:KE,trim:JE,stripBOM:GE,inherits:YE,toFlatObject:QE,kindOf:Ql,kindOfTest:tn,endsWith:ZE,toArray:XE,forEachEntry:tA,matchAll:nA,isHTMLForm:rA,hasOwnProperty:Kf,hasOwnProp:Kf,reduceDescriptors:ay,freezeMethods:iA,toObjectSet:sA,toCamelCase:aA,noop:lA,toFiniteNumber:uA,findKey:ny,global:aa,isContextDefined:ry,ALPHABET:oy,generateString:cA,isSpecCompliantForm:dA,toJSONObject:fA,isAsyncFn:hA,isThenable:mA,setImmediate:iy,asap:pA};function we(e,t,n,r,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),a&&(this.response=a,this.status=a.status?a.status:null)}z.inherits(we,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:z.toJSONObject(this.config),code:this.code,status:this.status}}});const sy=we.prototype,ly={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{ly[e]={value:e}});Object.defineProperties(we,ly);Object.defineProperty(sy,"isAxiosError",{value:!0});we.from=(e,t,n,r,a,o)=>{const i=Object.create(sy);return z.toFlatObject(e,i,function(l){return l!==Error.prototype},s=>s!=="isAxiosError"),we.call(i,e.message,t,n,r,a),i.cause=e,i.name=e.name,o&&Object.assign(i,o),i};var gA=null;function Mc(e){return z.isPlainObject(e)||z.isArray(e)}function uy(e){return z.endsWith(e,"[]")?e.slice(0,-2):e}function Yf(e,t,n){return e?e.concat(t).map(function(a,o){return a=uy(a),!n&&o?"["+a+"]":a}).join(n?".":""):t}function yA(e){return z.isArray(e)&&!e.some(Mc)}const bA=z.toFlatObject(z,{},null,function(t){return/^is[A-Z]/.test(t)});function eu(e,t,n){if(!z.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=z.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,k){return!z.isUndefined(k[f])});const r=n.metaTokens,a=n.visitor||c,o=n.dots,i=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&z.isSpecCompliantForm(t);if(!z.isFunction(a))throw new TypeError("visitor must be a function");function u(p){if(p===null)return"";if(z.isDate(p))return p.toISOString();if(!l&&z.isBlob(p))throw new we("Blob is not supported. Use a Buffer instead.");return z.isArrayBuffer(p)||z.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function c(p,f,k){let T=p;if(p&&!k&&typeof p=="object"){if(z.endsWith(f,"{}"))f=r?f:f.slice(0,-2),p=JSON.stringify(p);else if(z.isArray(p)&&yA(p)||(z.isFileList(p)||z.endsWith(f,"[]"))&&(T=z.toArray(p)))return f=uy(f),T.forEach(function(y,h){!(z.isUndefined(y)||y===null)&&t.append(i===!0?Yf([f],h,o):i===null?f:f+"[]",u(y))}),!1}return Mc(p)?!0:(t.append(Yf(k,f,o),u(p)),!1)}const d=[],b=Object.assign(bA,{defaultVisitor:c,convertValue:u,isVisitable:Mc});function m(p,f){if(!z.isUndefined(p)){if(d.indexOf(p)!==-1)throw Error("Circular reference detected in "+f.join("."));d.push(p),z.forEach(p,function(T,A){(!(z.isUndefined(T)||T===null)&&a.call(t,T,z.isString(A)?A.trim():A,f,b))===!0&&m(T,f?f.concat(A):[A])}),d.pop()}}if(!z.isObject(e))throw new TypeError("data must be an object");return m(e),t}function Qf(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function wd(e,t){this._pairs=[],e&&eu(e,this,t)}const cy=wd.prototype;cy.append=function(t,n){this._pairs.push([t,n])};cy.toString=function(t){const n=t?function(r){return t.call(this,r,Qf)}:Qf;return this._pairs.map(function(a){return n(a[0])+"="+n(a[1])},"").join("&")};function kA(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function dy(e,t,n){if(!t)return e;const r=n&&n.encode||kA,a=n&&n.serialize;let o;if(a?o=a(t,n):o=z.isURLSearchParams(t)?t.toString():new wd(t,n).toString(r),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class wA{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){z.forEach(this.handlers,function(r){r!==null&&t(r)})}}var Zf=wA,fy={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},vA=typeof URLSearchParams<"u"?URLSearchParams:wd,jA=typeof FormData<"u"?FormData:null,_A=typeof Blob<"u"?Blob:null,CA={isBrowser:!0,classes:{URLSearchParams:vA,FormData:jA,Blob:_A},protocols:["http","https","file","blob","url","data"]};const vd=typeof window<"u"&&typeof document<"u",xc=typeof navigator=="object"&&navigator||void 0,EA=vd&&(!xc||["ReactNative","NativeScript","NS"].indexOf(xc.product)<0),AA=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),SA=vd&&window.location.href||"http://localhost";var TA=Object.freeze({__proto__:null,hasBrowserEnv:vd,hasStandardBrowserWebWorkerEnv:AA,hasStandardBrowserEnv:EA,navigator:xc,origin:SA}),Tt={...TA,...CA};function PA(e,t){return eu(e,new Tt.classes.URLSearchParams,Object.assign({visitor:function(n,r,a,o){return Tt.isNode&&z.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function BA(e){return z.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function MA(e){const t={},n=Object.keys(e);let r;const a=n.length;let o;for(r=0;r=n.length;return i=!i&&z.isArray(a)?a.length:i,l?(z.hasOwnProp(a,i)?a[i]=[a[i],r]:a[i]=r,!s):((!a[i]||!z.isObject(a[i]))&&(a[i]=[]),t(n,r,a[i],o)&&z.isArray(a[i])&&(a[i]=MA(a[i])),!s)}if(z.isFormData(e)&&z.isFunction(e.entries)){const n={};return z.forEachEntry(e,(r,a)=>{t(BA(r),a,n,0)}),n}return null}function xA(e,t,n){if(z.isString(e))try{return(t||JSON.parse)(e),z.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const jd={transitional:fy,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",a=r.indexOf("application/json")>-1,o=z.isObject(t);if(o&&z.isHTMLForm(t)&&(t=new FormData(t)),z.isFormData(t))return a?JSON.stringify(hy(t)):t;if(z.isArrayBuffer(t)||z.isBuffer(t)||z.isStream(t)||z.isFile(t)||z.isBlob(t)||z.isReadableStream(t))return t;if(z.isArrayBufferView(t))return t.buffer;if(z.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return PA(t,this.formSerializer).toString();if((s=z.isFileList(t))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return eu(s?{"files[]":t}:t,l&&new l,this.formSerializer)}}return o||a?(n.setContentType("application/json",!1),xA(t)):t}],transformResponse:[function(t){const n=this.transitional||jd.transitional,r=n&&n.forcedJSONParsing,a=this.responseType==="json";if(z.isResponse(t)||z.isReadableStream(t))return t;if(t&&z.isString(t)&&(r&&!this.responseType||a)){const i=!(n&&n.silentJSONParsing)&&a;try{return JSON.parse(t)}catch(s){if(i)throw s.name==="SyntaxError"?we.from(s,we.ERR_BAD_RESPONSE,this,null,this.response):s}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Tt.classes.FormData,Blob:Tt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};z.forEach(["delete","get","head","post","put","patch"],e=>{jd.headers[e]={}});var _d=jd;const OA=z.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var IA=e=>{const t={};let n,r,a;return e&&e.split(` +`).forEach(function(i){a=i.indexOf(":"),n=i.substring(0,a).trim().toLowerCase(),r=i.substring(a+1).trim(),!(!n||t[n]&&OA[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};const Xf=Symbol("internals");function yi(e){return e&&String(e).trim().toLowerCase()}function Ws(e){return e===!1||e==null?e:z.isArray(e)?e.map(Ws):String(e)}function RA(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const NA=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Qu(e,t,n,r,a){if(z.isFunction(r))return r.call(this,t,n);if(a&&(t=n),!!z.isString(t)){if(z.isString(r))return t.indexOf(r)!==-1;if(z.isRegExp(r))return r.test(t)}}function zA(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function DA(e,t){const n=z.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(a,o,i){return this[r].call(this,t,a,o,i)},configurable:!0})})}class tu{constructor(t){t&&this.set(t)}set(t,n,r){const a=this;function o(s,l,u){const c=yi(l);if(!c)throw new Error("header name must be a non-empty string");const d=z.findKey(a,c);(!d||a[d]===void 0||u===!0||u===void 0&&a[d]!==!1)&&(a[d||l]=Ws(s))}const i=(s,l)=>z.forEach(s,(u,c)=>o(u,c,l));if(z.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(z.isString(t)&&(t=t.trim())&&!NA(t))i(IA(t),n);else if(z.isHeaders(t))for(const[s,l]of t.entries())o(l,s,r);else t!=null&&o(n,t,r);return this}get(t,n){if(t=yi(t),t){const r=z.findKey(this,t);if(r){const a=this[r];if(!n)return a;if(n===!0)return RA(a);if(z.isFunction(n))return n.call(this,a,r);if(z.isRegExp(n))return n.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=yi(t),t){const r=z.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Qu(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let a=!1;function o(i){if(i=yi(i),i){const s=z.findKey(r,i);s&&(!n||Qu(r,r[s],s,n))&&(delete r[s],a=!0)}}return z.isArray(t)?t.forEach(o):o(t),a}clear(t){const n=Object.keys(this);let r=n.length,a=!1;for(;r--;){const o=n[r];(!t||Qu(this,this[o],o,t,!0))&&(delete this[o],a=!0)}return a}normalize(t){const n=this,r={};return z.forEach(this,(a,o)=>{const i=z.findKey(r,o);if(i){n[i]=Ws(a),delete n[o];return}const s=t?zA(o):String(o).trim();s!==o&&delete n[o],n[s]=Ws(a),r[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return z.forEach(this,(r,a)=>{r!=null&&r!==!1&&(n[a]=t&&z.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(a=>r.set(a)),r}static accessor(t){const r=(this[Xf]=this[Xf]={accessors:{}}).accessors,a=this.prototype;function o(i){const s=yi(i);r[s]||(DA(a,i),r[s]=!0)}return z.isArray(t)?t.forEach(o):o(t),this}}tu.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);z.reduceDescriptors(tu.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});z.freezeMethods(tu);var Qt=tu;function Zu(e,t){const n=this||_d,r=t||n,a=Qt.from(r.headers);let o=r.data;return z.forEach(e,function(s){o=s.call(n,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function my(e){return!!(e&&e.__CANCEL__)}function Ho(e,t,n){we.call(this,e??"canceled",we.ERR_CANCELED,t,n),this.name="CanceledError"}z.inherits(Ho,we,{__CANCEL__:!0});function py(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new we("Request failed with status code "+n.status,[we.ERR_BAD_REQUEST,we.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function UA(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function FA(e,t){e=e||10;const n=new Array(e),r=new Array(e);let a=0,o=0,i;return t=t!==void 0?t:1e3,function(l){const u=Date.now(),c=r[o];i||(i=u),n[a]=l,r[a]=u;let d=o,b=0;for(;d!==a;)b+=n[d++],d=d%e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),u-i{n=c,a=null,o&&(clearTimeout(o),o=null),e.apply(null,u)};return[(...u)=>{const c=Date.now(),d=c-n;d>=r?i(u,c):(a=u,o||(o=setTimeout(()=>{o=null,i(a)},r-d)))},()=>a&&i(a)]}const ul=(e,t,n=3)=>{let r=0;const a=FA(50,250);return LA(o=>{const i=o.loaded,s=o.lengthComputable?o.total:void 0,l=i-r,u=a(l),c=i<=s;r=i;const d={loaded:i,total:s,progress:s?i/s:void 0,bytes:l,rate:u||void 0,estimated:u&&s&&c?(s-i)/u:void 0,event:o,lengthComputable:s!=null,[t?"download":"upload"]:!0};e(d)},n)},eh=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},th=e=>(...t)=>z.asap(()=>e(...t));var qA=Tt.hasStandardBrowserEnv?function(){const t=Tt.navigator&&/(msie|trident)/i.test(Tt.navigator.userAgent),n=document.createElement("a");let r;function a(o){let i=o;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=a(window.location.href),function(i){const s=z.isString(i)?a(i):i;return s.protocol===r.protocol&&s.host===r.host}}():function(){return function(){return!0}}(),$A=Tt.hasStandardBrowserEnv?{write(e,t,n,r,a,o){const i=[e+"="+encodeURIComponent(t)];z.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),z.isString(r)&&i.push("path="+r),z.isString(a)&&i.push("domain="+a),o===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function WA(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function HA(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function gy(e,t){return e&&!WA(t)?HA(e,t):t}const nh=e=>e instanceof Qt?{...e}:e;function Oa(e,t){t=t||{};const n={};function r(u,c,d){return z.isPlainObject(u)&&z.isPlainObject(c)?z.merge.call({caseless:d},u,c):z.isPlainObject(c)?z.merge({},c):z.isArray(c)?c.slice():c}function a(u,c,d){if(z.isUndefined(c)){if(!z.isUndefined(u))return r(void 0,u,d)}else return r(u,c,d)}function o(u,c){if(!z.isUndefined(c))return r(void 0,c)}function i(u,c){if(z.isUndefined(c)){if(!z.isUndefined(u))return r(void 0,u)}else return r(void 0,c)}function s(u,c,d){if(d in t)return r(u,c);if(d in e)return r(void 0,u)}const l={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:s,headers:(u,c)=>a(nh(u),nh(c),!0)};return z.forEach(Object.keys(Object.assign({},e,t)),function(c){const d=l[c]||a,b=d(e[c],t[c],c);z.isUndefined(b)&&d!==s||(n[c]=b)}),n}var yy=e=>{const t=Oa({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:o,headers:i,auth:s}=t;t.headers=i=Qt.from(i),t.url=dy(gy(t.baseURL,t.url),e.params,e.paramsSerializer),s&&i.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):"")));let l;if(z.isFormData(n)){if(Tt.hasStandardBrowserEnv||Tt.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((l=i.getContentType())!==!1){const[u,...c]=l?l.split(";").map(d=>d.trim()).filter(Boolean):[];i.setContentType([u||"multipart/form-data",...c].join("; "))}}if(Tt.hasStandardBrowserEnv&&(r&&z.isFunction(r)&&(r=r(t)),r||r!==!1&&qA(t.url))){const u=a&&o&&$A.read(o);u&&i.set(a,u)}return t};const VA=typeof XMLHttpRequest<"u";var JA=VA&&function(e){return new Promise(function(n,r){const a=yy(e);let o=a.data;const i=Qt.from(a.headers).normalize();let{responseType:s,onUploadProgress:l,onDownloadProgress:u}=a,c,d,b,m,p;function f(){m&&m(),p&&p(),a.cancelToken&&a.cancelToken.unsubscribe(c),a.signal&&a.signal.removeEventListener("abort",c)}let k=new XMLHttpRequest;k.open(a.method.toUpperCase(),a.url,!0),k.timeout=a.timeout;function T(){if(!k)return;const y=Qt.from("getAllResponseHeaders"in k&&k.getAllResponseHeaders()),C={data:!s||s==="text"||s==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:y,config:e,request:k};py(function(x){n(x),f()},function(x){r(x),f()},C),k=null}"onloadend"in k?k.onloadend=T:k.onreadystatechange=function(){!k||k.readyState!==4||k.status===0&&!(k.responseURL&&k.responseURL.indexOf("file:")===0)||setTimeout(T)},k.onabort=function(){k&&(r(new we("Request aborted",we.ECONNABORTED,e,k)),k=null)},k.onerror=function(){r(new we("Network Error",we.ERR_NETWORK,e,k)),k=null},k.ontimeout=function(){let h=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const C=a.transitional||fy;a.timeoutErrorMessage&&(h=a.timeoutErrorMessage),r(new we(h,C.clarifyTimeoutError?we.ETIMEDOUT:we.ECONNABORTED,e,k)),k=null},o===void 0&&i.setContentType(null),"setRequestHeader"in k&&z.forEach(i.toJSON(),function(h,C){k.setRequestHeader(C,h)}),z.isUndefined(a.withCredentials)||(k.withCredentials=!!a.withCredentials),s&&s!=="json"&&(k.responseType=a.responseType),u&&([b,p]=ul(u,!0),k.addEventListener("progress",b)),l&&k.upload&&([d,m]=ul(l),k.upload.addEventListener("progress",d),k.upload.addEventListener("loadend",m)),(a.cancelToken||a.signal)&&(c=y=>{k&&(r(!y||y.type?new Ho(null,e,k):y),k.abort(),k=null)},a.cancelToken&&a.cancelToken.subscribe(c),a.signal&&(a.signal.aborted?c():a.signal.addEventListener("abort",c)));const A=UA(a.url);if(A&&Tt.protocols.indexOf(A)===-1){r(new we("Unsupported protocol "+A+":",we.ERR_BAD_REQUEST,e));return}k.send(o||null)})};const KA=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,a;const o=function(u){if(!a){a=!0,s();const c=u instanceof Error?u:this.reason;r.abort(c instanceof we?c:new Ho(c instanceof Error?c.message:c))}};let i=t&&setTimeout(()=>{i=null,o(new we(`timeout ${t} of ms exceeded`,we.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:l}=r;return l.unsubscribe=()=>z.asap(s),l}};var GA=KA;const YA=function*(e,t){let n=e.byteLength;if(!t||n{const a=QA(e,t);let o=0,i,s=l=>{i||(i=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:u,value:c}=await a.next();if(u){s(),l.close();return}let d=c.byteLength;if(n){let b=o+=d;n(b)}l.enqueue(new Uint8Array(c))}catch(u){throw s(u),u}},cancel(l){return s(l),a.return()}},{highWaterMark:2})},nu=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",by=nu&&typeof ReadableStream=="function",XA=nu&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),ky=(e,...t)=>{try{return!!e(...t)}catch{return!1}},eS=by&&ky(()=>{let e=!1;const t=new Request(Tt.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),ah=64*1024,Oc=by&&ky(()=>z.isReadableStream(new Response("").body)),cl={stream:Oc&&(e=>e.body)};nu&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!cl[t]&&(cl[t]=z.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new we(`Response type '${t}' is not supported`,we.ERR_NOT_SUPPORT,r)})})})(new Response);const tS=async e=>{if(e==null)return 0;if(z.isBlob(e))return e.size;if(z.isSpecCompliantForm(e))return(await new Request(Tt.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(z.isArrayBufferView(e)||z.isArrayBuffer(e))return e.byteLength;if(z.isURLSearchParams(e)&&(e=e+""),z.isString(e))return(await XA(e)).byteLength},nS=async(e,t)=>{const n=z.toFiniteNumber(e.getContentLength());return n??tS(t)};var rS=nu&&(async e=>{let{url:t,method:n,data:r,signal:a,cancelToken:o,timeout:i,onDownloadProgress:s,onUploadProgress:l,responseType:u,headers:c,withCredentials:d="same-origin",fetchOptions:b}=yy(e);u=u?(u+"").toLowerCase():"text";let m=GA([a,o&&o.toAbortSignal()],i),p;const f=m&&m.unsubscribe&&(()=>{m.unsubscribe()});let k;try{if(l&&eS&&n!=="get"&&n!=="head"&&(k=await nS(c,r))!==0){let C=new Request(t,{method:"POST",body:r,duplex:"half"}),_;if(z.isFormData(r)&&(_=C.headers.get("content-type"))&&c.setContentType(_),C.body){const[x,H]=eh(k,ul(th(l)));r=rh(C.body,ah,x,H)}}z.isString(d)||(d=d?"include":"omit");const T="credentials"in Request.prototype;p=new Request(t,{...b,signal:m,method:n.toUpperCase(),headers:c.normalize().toJSON(),body:r,duplex:"half",credentials:T?d:void 0});let A=await fetch(p);const y=Oc&&(u==="stream"||u==="response");if(Oc&&(s||y&&f)){const C={};["status","statusText","headers"].forEach(L=>{C[L]=A[L]});const _=z.toFiniteNumber(A.headers.get("content-length")),[x,H]=s&&eh(_,ul(th(s),!0))||[];A=new Response(rh(A.body,ah,x,()=>{H&&H(),f&&f()}),C)}u=u||"text";let h=await cl[z.findKey(cl,u)||"text"](A,e);return!y&&f&&f(),await new Promise((C,_)=>{py(C,_,{data:h,headers:Qt.from(A.headers),status:A.status,statusText:A.statusText,config:e,request:p})})}catch(T){throw f&&f(),T&&T.name==="TypeError"&&/fetch/i.test(T.message)?Object.assign(new we("Network Error",we.ERR_NETWORK,e,p),{cause:T.cause||T}):we.from(T,T&&T.code,e,p)}});const Ic={http:gA,xhr:JA,fetch:rS};z.forEach(Ic,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const oh=e=>`- ${e}`,aS=e=>z.isFunction(e)||e===null||e===!1;var wy={getAdapter:e=>{e=z.isArray(e)?e:[e];const{length:t}=e;let n,r;const a={};for(let o=0;o`adapter ${s} `+(l===!1?"is not supported by the environment":"is not available in the build"));let i=t?o.length>1?`since : +`+o.map(oh).join(` +`):" "+oh(o[0]):"as no adapter specified";throw new we("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:Ic};function Xu(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ho(null,e)}function ih(e){return Xu(e),e.headers=Qt.from(e.headers),e.data=Zu.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),wy.getAdapter(e.adapter||_d.adapter)(e).then(function(r){return Xu(e),r.data=Zu.call(e,e.transformResponse,r),r.headers=Qt.from(r.headers),r},function(r){return my(r)||(Xu(e),r&&r.response&&(r.response.data=Zu.call(e,e.transformResponse,r.response),r.response.headers=Qt.from(r.response.headers))),Promise.reject(r)})}const vy="1.7.7",Cd={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Cd[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const sh={};Cd.transitional=function(t,n,r){function a(o,i){return"[Axios v"+vy+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,s)=>{if(t===!1)throw new we(a(i," has been removed"+(n?" in "+n:"")),we.ERR_DEPRECATED);return n&&!sh[i]&&(sh[i]=!0,console.warn(a(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,s):!0}};function oS(e,t,n){if(typeof e!="object")throw new we("options must be an object",we.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let a=r.length;for(;a-- >0;){const o=r[a],i=t[o];if(i){const s=e[o],l=s===void 0||i(s,o,e);if(l!==!0)throw new we("option "+o+" must be "+l,we.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new we("Unknown option "+o,we.ERR_BAD_OPTION)}}var Rc={assertOptions:oS,validators:Cd};const rr=Rc.validators;class dl{constructor(t){this.defaults=t,this.interceptors={request:new Zf,response:new Zf}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let a;Error.captureStackTrace?Error.captureStackTrace(a={}):a=new Error;const o=a.stack?a.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Oa(this.defaults,n);const{transitional:r,paramsSerializer:a,headers:o}=n;r!==void 0&&Rc.assertOptions(r,{silentJSONParsing:rr.transitional(rr.boolean),forcedJSONParsing:rr.transitional(rr.boolean),clarifyTimeoutError:rr.transitional(rr.boolean)},!1),a!=null&&(z.isFunction(a)?n.paramsSerializer={serialize:a}:Rc.assertOptions(a,{encode:rr.function,serialize:rr.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&z.merge(o.common,o[n.method]);o&&z.forEach(["delete","get","head","post","put","patch","common"],p=>{delete o[p]}),n.headers=Qt.concat(i,o);const s=[];let l=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(n)===!1||(l=l&&f.synchronous,s.unshift(f.fulfilled,f.rejected))});const u=[];this.interceptors.response.forEach(function(f){u.push(f.fulfilled,f.rejected)});let c,d=0,b;if(!l){const p=[ih.bind(this),void 0];for(p.unshift.apply(p,s),p.push.apply(p,u),b=p.length,c=Promise.resolve(n);d{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](a);r._listeners=null}),this.promise.then=a=>{let o;const i=new Promise(s=>{r.subscribe(s),o=s}).then(a);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,s){r.reason||(r.reason=new Ho(o,i,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Ed(function(a){t=a}),cancel:t}}}var iS=Ed;function sS(e){return function(n){return e.apply(null,n)}}function lS(e){return z.isObject(e)&&e.isAxiosError===!0}const Nc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Nc).forEach(([e,t])=>{Nc[t]=e});var uS=Nc;function jy(e){const t=new Hs(e),n=Xg(Hs.prototype.request,t);return z.extend(n,Hs.prototype,t,{allOwnKeys:!0}),z.extend(n,t,null,{allOwnKeys:!0}),n.create=function(a){return jy(Oa(e,a))},n}const Je=jy(_d);Je.Axios=Hs;Je.CanceledError=Ho;Je.CancelToken=iS;Je.isCancel=my;Je.VERSION=vy;Je.toFormData=eu;Je.AxiosError=we;Je.Cancel=Je.CanceledError;Je.all=function(t){return Promise.all(t)};Je.spread=sS;Je.isAxiosError=lS;Je.mergeConfig=Oa;Je.AxiosHeaders=Qt;Je.formToJSON=e=>hy(z.isHTMLForm(e)?new FormData(e):e);Je.getAdapter=wy.getAdapter;Je.HttpStatusCode=uS;Je.default=Je;var Ad=Je;const ds=Ok(zj),cS="@ton/ton",dS="14.0.0",fS="https://github.com/ton-org/ton.git",hS="Whales Corp. ",mS="MIT",pS="dist/index.js",gS=["dist"],yS={docs:"rm -fr docs && typedoc src/index.ts",build:"rm -fr dist && tsc --declaration",test:"jest --verbose --runInBand",release:"yarn build && yarn release-it --npm.yarn1"},bS={"@release-it/keep-a-changelog":"^5.0.0","@ton/core":"^0.56.0","@ton/crypto":"3.2.0","@ton/emulator":"^2.1.1","@types/jest":"^27.0.1","@types/node":"^16.7.10",buffer:"^6.0.3",expect:"^27.1.0",jest:"^27.1.0","jest-mock":"^27.1.0",karma:"^6.3.4","karma-chrome-launcher":"^3.1.0","karma-jasmine":"^4.0.1","karma-typescript":"^5.5.2","karma-webpack":"^5.0.0",prando:"^6.0.1","release-it":"^17.1.1","ts-jest":"^27.0.5","ts-loader":"^9.2.5","ts-node":"^10.7.0",typedoc:"^0.23.24",typescript:"^4.4.2",webpack:"^5.51.2"},kS={axios:"^1.6.7",dataloader:"^2.0.0","symbol.inspect":"1.0.1",teslabot:"^1.3.0",zod:"^3.21.4"},wS={"@ton/core":">=0.56.0","@ton/crypto":">=3.2.0"},vS={access:"public",registry:"https://registry.npmjs.org/"},jS="yarn@3.4.1",_S={name:cS,version:dS,repository:fS,author:hS,license:mS,main:pS,files:gS,scripts:yS,devDependencies:bS,dependencies:kS,peerDependencies:wS,publishConfig:vS,"release-it":{github:{release:!0},plugins:{"@release-it/keep-a-changelog":{filename:"CHANGELOG.md"}}},packageManager:jS};var _y=re&&re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(us,"__esModule",{value:!0});us.HttpApi=void 0;const CS=Yl,lh=_y(BE),ES=_y(Ad),Q=ds,AS=_S.version,Mo=Q.z.object({"@type":Q.z.literal("ton.blockIdExt"),workchain:Q.z.number(),shard:Q.z.string(),seqno:Q.z.number(),root_hash:Q.z.string(),file_hash:Q.z.string()}),SS=Q.z.object({balance:Q.z.union([Q.z.number(),Q.z.string()]),state:Q.z.union([Q.z.literal("active"),Q.z.literal("uninitialized"),Q.z.literal("frozen")]),data:Q.z.string(),code:Q.z.string(),last_transaction_id:Q.z.object({"@type":Q.z.literal("internal.transactionId"),lt:Q.z.string(),hash:Q.z.string()}),block_id:Mo,sync_utime:Q.z.number()}),TS=Q.z.object({"@type":Q.z.literal("ok")}),PS=Q.z.object({"@type":Q.z.literal("query.fees"),source_fees:Q.z.object({"@type":Q.z.literal("fees"),in_fwd_fee:Q.z.number(),storage_fee:Q.z.number(),gas_fee:Q.z.number(),fwd_fee:Q.z.number()})}),BS=Q.z.object({gas_used:Q.z.number(),exit_code:Q.z.number(),stack:Q.z.array(Q.z.unknown())}),MS=Q.z.union([Q.z.object({"@type":Q.z.literal("msg.dataRaw"),body:Q.z.string()}),Q.z.object({"@type":Q.z.literal("msg.dataText"),text:Q.z.string()}),Q.z.object({"@type":Q.z.literal("msg.dataDecryptedText"),text:Q.z.string()}),Q.z.object({"@type":Q.z.literal("msg.dataEncryptedText"),text:Q.z.string()})]),uh=Q.z.object({source:Q.z.string(),destination:Q.z.string(),value:Q.z.string(),fwd_fee:Q.z.string(),ihr_fee:Q.z.string(),created_lt:Q.z.string(),body_hash:Q.z.string(),msg_data:MS,message:Q.z.string().optional()}),zc=Q.z.object({data:Q.z.string(),utime:Q.z.number(),transaction_id:Q.z.object({lt:Q.z.string(),hash:Q.z.string()}),fee:Q.z.string(),storage_fee:Q.z.string(),other_fee:Q.z.string(),in_msg:Q.z.union([Q.z.undefined(),uh]),out_msgs:Q.z.array(uh)}),ch=Q.z.array(zc),xS=Q.z.object({state_root_hash:Q.z.string(),last:Mo,init:Mo}),OS=Q.z.object({shards:Q.z.array(Mo)}),IS=Q.z.object({"@type":Q.z.literal("blocks.shortTxId"),mode:Q.z.number(),account:Q.z.string(),lt:Q.z.string(),hash:Q.z.string()}),dh=Q.z.object({id:Mo,req_count:Q.z.number(),incomplete:Q.z.boolean(),transactions:Q.z.array(IS)});class fh{constructor(t,n,r,a){this.namespace=t,this.cache=n,this.codec=r,this.keyEncoder=a}async get(t){let n=await this.cache.get(this.namespace,this.keyEncoder(t));if(n){let r=this.codec.safeParse(JSON.parse(n));if(r.success)return r.data}return null}async set(t,n){n!==null?await this.cache.set(this.namespace,this.keyEncoder(t),JSON.stringify(n)):await this.cache.set(this.namespace,this.keyEncoder(t),null)}}class RS{constructor(t,n){this.endpoint=t,this.cache=new CS.InMemoryCache,this.parameters={timeout:(n==null?void 0:n.timeout)||3e4,apiKey:n==null?void 0:n.apiKey,adapter:n==null?void 0:n.adapter},this.shardCache=new fh("ton-shard",this.cache,Q.z.array(Mo),r=>r+""),this.shardLoader=new lh.default(async r=>await Promise.all(r.map(async a=>{const o=await this.shardCache.get(a);if(o)return o;let i=(await this.doCall("shards",{seqno:a},OS)).shards;return await this.shardCache.set(a,i),i}))),this.shardTransactionsCache=new fh("ton-shard-tx",this.cache,dh,r=>r.workchain+":"+r.shard+":"+r.seqno),this.shardTransactionsLoader=new lh.default(async r=>await Promise.all(r.map(async a=>{const o=await this.shardTransactionsCache.get(a);if(o)return o;let i=await this.doCall("getBlockTransactions",{workchain:a.workchain,seqno:a.seqno,shard:a.shard},dh);return await this.shardTransactionsCache.set(a,i),i})),{cacheKeyFn:r=>r.workchain+":"+r.shard+":"+r.seqno})}getAddressInformation(t){return this.doCall("getAddressInformation",{address:t.toString()},SS)}async getTransactions(t,n){const r=n.inclusive;delete n.inclusive;let a;n.hash&&(a=Buffer.from(n.hash,"base64").toString("hex"));let o=n.limit;n.hash&&n.lt&&r!==!0&&o++;let i=await this.doCall("getTransactions",{address:t.toString(),...n,limit:o,hash:a},ch);return i.length>o&&(i=i.slice(0,o)),n.hash&&n.lt&&r!==!0&&i.shift(),i}async getMasterchainInfo(){return await this.doCall("getMasterchainInfo",{},xS)}async getShards(t){return await this.shardLoader.load(t)}async getBlockTransactions(t,n,r){return await this.shardTransactionsLoader.load({workchain:t,seqno:n,shard:r})}async getTransaction(t,n,r){let a=Buffer.from(r,"base64").toString("hex"),i=(await this.doCall("getTransactions",{address:t.toString(),lt:n,hash:a,limit:1},ch)).find(s=>s.transaction_id.lt===n&&s.transaction_id.hash===r);return i||null}async callGetMethod(t,n,r){return await this.doCall("runGetMethod",{address:t.toString(),method:n,stack:NS(r)},BS)}async sendBoc(t){await this.doCall("sendBoc",{boc:t.toString("base64")},TS)}async estimateFee(t,n){return await this.doCall("estimateFee",{address:t.toString(),body:n.body.toBoc().toString("base64"),init_data:n.initData?n.initData.toBoc().toString("base64"):"",init_code:n.initCode?n.initCode.toBoc().toString("base64"):"",ignore_chksig:n.ignoreSignature},PS)}async tryLocateResultTx(t,n,r){return await this.doCall("tryLocateResultTx",{source:t.toString(),destination:n.toString(),created_lt:r},zc)}async tryLocateSourceTx(t,n,r){return await this.doCall("tryLocateSourceTx",{source:t.toString(),destination:n.toString(),created_lt:r},zc)}async doCall(t,n,r){let a={"Content-Type":"application/json","X-Ton-Client-Version":AS};this.parameters.apiKey&&(a["X-API-Key"]=this.parameters.apiKey);let o=await ES.default.post(this.endpoint,JSON.stringify({id:"1",jsonrpc:"2.0",method:t,params:n}),{headers:a,timeout:this.parameters.timeout,adapter:this.parameters.adapter});if(o.status!==200||!o.data.ok)throw Error("Received error: "+JSON.stringify(o.data));let i=r.safeParse(o.data.result);if(i.success)return i.data;throw Error("Malformed response: "+i.error.format()._errors.join(", "))}}us.HttpApi=RS;function NS(e){let t=[];for(let n of e)if(n.type==="int")t.push(["num",n.value.toString()]);else if(n.type==="cell")t.push(["tvm.Cell",n.cell.toBoc().toString("base64")]);else if(n.type==="slice")t.push(["tvm.Slice",n.cell.toBoc().toString("base64")]);else if(n.type==="builder")t.push(["tvm.Builder",n.cell.toBoc().toString("base64")]);else throw Error("Unsupported stack item type: "+n.type);return t}var ru={};Object.defineProperty(ru,"__esModule",{value:!0});ru.TonClient=void 0;const zS=us,De=de;class DS{constructor(t){this.parameters={endpoint:t.endpoint},this.api=new zS.HttpApi(this.parameters.endpoint,{timeout:t.timeout,apiKey:t.apiKey,adapter:t.httpAdapter})}async getBalance(t){return(await this.getContractState(t)).balance}async runMethod(t,n,r=[]){let a=await this.api.callGetMethod(t,n,r);if(a.exit_code!==0)throw Error("Unable to execute get method. Got exit_code: "+a.exit_code);return{gas_used:a.gas_used,stack:hh(a.stack)}}async callGetMethod(t,n,r=[]){return this.runMethod(t,n,r)}async runMethodWithError(t,n,r=[]){let a=await this.api.callGetMethod(t,n,r);return{gas_used:a.gas_used,stack:hh(a.stack),exit_code:a.exit_code}}async callGetMethodWithError(t,n,r=[]){return this.runMethodWithError(t,n,r)}async getTransactions(t,n){let r=await this.api.getTransactions(t,n),a=[];for(let o of r)a.push((0,De.loadTransaction)(De.Cell.fromBoc(Buffer.from(o.data,"base64"))[0].beginParse()));return a}async getTransaction(t,n,r){let a=await this.api.getTransaction(t,n,r);return a?(0,De.loadTransaction)(De.Cell.fromBoc(Buffer.from(a.data,"base64"))[0].beginParse()):null}async tryLocateResultTx(t,n,r){let a=await this.api.tryLocateResultTx(t,n,r);return(0,De.loadTransaction)(De.Cell.fromBase64(a.data).beginParse())}async tryLocateSourceTx(t,n,r){let a=await this.api.tryLocateSourceTx(t,n,r);return(0,De.loadTransaction)(De.Cell.fromBase64(a.data).beginParse())}async getMasterchainInfo(){let t=await this.api.getMasterchainInfo();return{workchain:t.init.workchain,shard:t.last.shard,initSeqno:t.init.seqno,latestSeqno:t.last.seqno}}async getWorkchainShards(t){return(await this.api.getShards(t)).map(r=>({workchain:r.workchain,shard:r.shard,seqno:r.seqno}))}async getShardTransactions(t,n,r){let a=await this.api.getBlockTransactions(t,n,r);if(a.incomplete)throw Error("Unsupported");return a.transactions.map(o=>({account:De.Address.parseRaw(o.account),lt:o.lt,hash:o.hash}))}async sendMessage(t){const n=(0,De.beginCell)().store((0,De.storeMessage)(t)).endCell().toBoc();await this.api.sendBoc(n)}async sendFile(t){await this.api.sendBoc(t)}async estimateExternalMessageFee(t,n){return await this.api.estimateFee(t,{body:n.body,initCode:n.initCode,initData:n.initData,ignoreSignature:n.ignoreSignature})}async sendExternalMessage(t,n){if(await this.isContractDeployed(t.address)||!t.init){const r=(0,De.external)({to:t.address,body:n});await this.sendMessage(r)}else{const r=(0,De.external)({to:t.address,init:t.init,body:n});await this.sendMessage(r)}}async isContractDeployed(t){return(await this.getContractState(t)).state==="active"}async getContractState(t){let n=await this.api.getAddressInformation(t),r=BigInt(n.balance),a=n.state;return{balance:r,state:a,code:n.code!==""?Buffer.from(n.code,"base64"):null,data:n.data!==""?Buffer.from(n.data,"base64"):null,lastTransaction:n.last_transaction_id.lt!=="0"?{lt:n.last_transaction_id.lt,hash:n.last_transaction_id.hash}:null,blockId:{workchain:n.block_id.workchain,shard:n.block_id.shard,seqno:n.block_id.seqno},timestampt:n.sync_utime}}open(t){return(0,De.openContract)(t,n=>Dc(this,n.address,n.init))}provider(t,n){return Dc(this,t,n??null)}}ru.TonClient=DS;function Xr(e){const t=e["@type"];switch(t){case"tvm.list":case"tvm.tuple":return e.elements.map(Xr);case"tvm.cell":return De.Cell.fromBoc(Buffer.from(e.bytes,"base64"))[0];case"tvm.slice":return De.Cell.fromBoc(Buffer.from(e.bytes,"base64"))[0];case"tvm.stackEntryCell":return Xr(e.cell);case"tvm.stackEntrySlice":return Xr(e.slice);case"tvm.stackEntryTuple":return Xr(e.tuple);case"tvm.stackEntryList":return Xr(e.list);case"tvm.stackEntryNumber":return Xr(e.number);case"tvm.numberDecimal":return BigInt(e.number);default:throw Error("Unsupported item type: "+t)}}function US(e){if(e[0]==="num"){let t=e[1];return t.startsWith("-")?{type:"int",value:-BigInt(t.slice(1))}:{type:"int",value:BigInt(t)}}else{if(e[0]==="null")return{type:"null"};if(e[0]==="cell")return{type:"cell",cell:De.Cell.fromBoc(Buffer.from(e[1].bytes,"base64"))[0]};if(e[0]==="slice")return{type:"slice",cell:De.Cell.fromBoc(Buffer.from(e[1].bytes,"base64"))[0]};if(e[0]==="builder")return{type:"builder",cell:De.Cell.fromBoc(Buffer.from(e[1].bytes,"base64"))[0]};if(e[0]==="tuple"||e[0]==="list")return e[1].elements.length===0?{type:"null"}:{type:"tuple",items:e[1].elements.map(Xr)};throw Error("Unsupported stack item type: "+e[0])}}function hh(e){let t=[];for(let n of e)t.push(US(n));return new De.TupleReader(t)}function Dc(e,t,n){return{async getState(){let r=await e.getContractState(t),a=r.balance,o=r.lastTransaction?{lt:BigInt(r.lastTransaction.lt),hash:Buffer.from(r.lastTransaction.hash,"base64")}:null,i;if(r.state==="active")i={type:"active",code:r.code?r.code:null,data:r.data?r.data:null};else if(r.state==="uninitialized")i={type:"uninit"};else if(r.state==="frozen")i={type:"frozen",stateHash:Buffer.alloc(0)};else throw Error("Unsupported state");return{balance:a,last:o,state:i}},async get(r,a){return{stack:(await e.callGetMethod(t,r,a)).stack}},async external(r){let a=null;n&&!await e.isContractDeployed(t)&&(a=n);const o=(0,De.external)({to:t,init:a,body:r});let i=(0,De.beginCell)().store((0,De.storeMessage)(o)).endCell().toBoc();await e.sendFile(i)},async internal(r,a){let o=null;n&&!await e.isContractDeployed(t)&&(o=n);let i=!0;a.bounce!==null&&a.bounce!==void 0&&(i=a.bounce);let s;typeof a.value=="string"?s=(0,De.toNano)(a.value):s=a.value;let l=null;typeof a.body=="string"?l=(0,De.comment)(a.body):a.body&&(l=a.body),await r.send({to:t,value:s,bounce:i,sendMode:a.sendMode,init:o,body:l})},open(r){return(0,De.openContract)(r,a=>Dc(e,a.address,a.init??null))},getTransactions(r,a,o,i){return e.getTransactions(r,{limit:i??100,lt:a.toString(),hash:o.toString("base64"),inclusive:!0})}}}var au={},ou={};Object.defineProperty(ou,"__esModule",{value:!0});ou.toUrlSafe=void 0;function FS(e){for(;e.indexOf("/")>=0;)e=e.replace("/","_");for(;e.indexOf("+")>=0;)e=e.replace("+","-");for(;e.indexOf("=")>=0;)e=e.replace("=","");return e}ou.toUrlSafe=FS;var xs=re&&re.__classPrivateFieldSet||function(e,t,n,r,a){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?a.call(e,n):a?a.value=n:t.set(e,n),n},pe=re&&re.__classPrivateFieldGet||function(e,t,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)},LS=re&&re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},vt,jt,_t,ht;Object.defineProperty(au,"__esModule",{value:!0});au.TonClient4=void 0;const qS=LS(Ad),gt=de,ec=ou,w=ds;class $S{constructor(t){vt.set(this,void 0),jt.set(this,void 0),_t.set(this,void 0),ht.set(this,void 0),xs(this,ht,qS.default.create(),"f"),xs(this,vt,t.endpoint,"f"),xs(this,jt,t.timeout||5e3,"f"),xs(this,_t,t.httpAdapter,"f"),t.requestInterceptor&&pe(this,ht,"f").interceptors.request.use(t.requestInterceptor)}async getLastBlock(){let t=await pe(this,ht,"f").get(pe(this,vt,"f")+"/block/latest",{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")}),n=WS.safeParse(t.data);if(!n.success)throw Error("Mailformed response: "+n.error.format()._errors.join(", "));return n.data}async getBlock(t){let n=await pe(this,ht,"f").get(pe(this,vt,"f")+"/block/"+t,{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")}),r=mh.safeParse(n.data);if(!r.success)throw Error("Mailformed response");if(!r.data.exist)throw Error("Block is out of scope");return r.data.block}async getBlockByUtime(t){let n=await pe(this,ht,"f").get(pe(this,vt,"f")+"/block/utime/"+t,{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")}),r=mh.safeParse(n.data);if(!r.success)throw Error("Mailformed response");if(!r.data.exist)throw Error("Block is out of scope");return r.data.block}async getAccount(t,n){let r=await pe(this,ht,"f").get(pe(this,vt,"f")+"/block/"+t+"/"+n.toString({urlSafe:!0}),{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")}),a=HS.safeParse(r.data);if(!a.success)throw Error("Mailformed response");return a.data}async getAccountLite(t,n){let r=await pe(this,ht,"f").get(pe(this,vt,"f")+"/block/"+t+"/"+n.toString({urlSafe:!0})+"/lite",{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")}),a=VS.safeParse(r.data);if(!a.success)throw Error("Mailformed response");return a.data}async isContractDeployed(t,n){return(await this.getAccountLite(t,n)).account.state.type==="active"}async isAccountChanged(t,n,r){let a=await pe(this,ht,"f").get(pe(this,vt,"f")+"/block/"+t+"/"+n.toString({urlSafe:!0})+"/changed/"+r.toString(10),{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")}),o=JS.safeParse(a.data);if(!o.success)throw Error("Mailformed response");return o.data}async getAccountTransactions(t,n,r){let a=await pe(this,ht,"f").get(pe(this,vt,"f")+"/account/"+t.toString({urlSafe:!0})+"/tx/"+n.toString(10)+"/"+(0,ec.toUrlSafe)(r.toString("base64")),{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")}),o=QS.safeParse(a.data);if(!o.success)throw Error("Mailformed response");let i=o.data,s=[],l=gt.Cell.fromBoc(Buffer.from(i.boc,"base64"));for(let u=0;u0&&(r="/"+[...n].sort().join(","));let a=await pe(this,ht,"f").get(pe(this,vt,"f")+"/block/"+t+"/config"+r,{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")}),o=GS.safeParse(a.data);if(!o.success)throw Error("Mailformed response");return o.data}async runMethod(t,n,r,a){let o=a&&a.length>0?"/"+(0,ec.toUrlSafe)((0,gt.serializeTuple)(a).toBoc({idx:!1,crc32:!1}).toString("base64")):"",i=pe(this,vt,"f")+"/block/"+t+"/"+n.toString({urlSafe:!0})+"/run/"+encodeURIComponent(r)+o,s=await pe(this,ht,"f").get(i,{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")}),l=KS.safeParse(s.data);if(!l.success)throw Error("Mailformed response");let u=l.data.resultRaw?(0,gt.parseTuple)(gt.Cell.fromBoc(Buffer.from(l.data.resultRaw,"base64"))[0]):[];return{exitCode:l.data.exitCode,result:u,resultRaw:l.data.resultRaw,block:l.data.block,shardBlock:l.data.shardBlock,reader:new gt.TupleReader(u)}}async sendMessage(t){let n=await pe(this,ht,"f").post(pe(this,vt,"f")+"/send",{boc:t.toString("base64")},{adapter:pe(this,_t,"f"),timeout:pe(this,jt,"f")});if(!YS.safeParse(n.data).success)throw Error("Mailformed response");return{status:n.data.status}}open(t){return(0,gt.openContract)(t,n=>Ri(this,null,n.address,n.init))}openAt(t,n){return(0,gt.openContract)(n,r=>Ri(this,t,r.address,r.init))}provider(t,n){return Ri(this,null,t,n??null)}providerAt(t,n,r){return Ri(this,t,n,r??null)}}au.TonClient4=$S;vt=new WeakMap,jt=new WeakMap,_t=new WeakMap,ht=new WeakMap;function Ri(e,t,n,r){return{async getState(){let a=t;a===null&&(a=(await e.getLastBlock()).last.seqno);let o=await e.getAccount(a,n),i=o.account.last?{lt:BigInt(o.account.last.lt),hash:Buffer.from(o.account.last.hash,"base64")}:null,s;if(o.account.state.type==="active")s={type:"active",code:o.account.state.code?Buffer.from(o.account.state.code,"base64"):null,data:o.account.state.data?Buffer.from(o.account.state.data,"base64"):null};else if(o.account.state.type==="uninit")s={type:"uninit"};else if(o.account.state.type==="frozen")s={type:"frozen",stateHash:Buffer.from(o.account.state.stateHash,"base64")};else throw Error("Unsupported state");return{balance:BigInt(o.account.balance.coins),last:i,state:s}},async get(a,o){let i=t;i===null&&(i=(await e.getLastBlock()).last.seqno);let s=await e.runMethod(i,n,a,o);if(s.exitCode!==0&&s.exitCode!==1)throw Error("Exit code: "+s.exitCode);return{stack:new gt.TupleReader(s.result)}},async external(a){let o=await e.getLastBlock(),i=null;r&&(await e.getAccountLite(o.last.seqno,n)).account.state.type!=="active"&&(i=r);const s=(0,gt.external)({to:n,init:i,body:a});let l=(0,gt.beginCell)().store((0,gt.storeMessage)(s)).endCell().toBoc();await e.sendMessage(l)},async internal(a,o){let i=await e.getLastBlock(),s=null;r&&(await e.getAccountLite(i.last.seqno,n)).account.state.type!=="active"&&(s=r);let l=!0;o.bounce!==null&&o.bounce!==void 0&&(l=o.bounce);let u;typeof o.value=="string"?u=(0,gt.toNano)(o.value):u=o.value;let c=null;typeof o.body=="string"?c=(0,gt.comment)(o.body):o.body&&(c=o.body),await a.send({to:n,value:u,bounce:l,sendMode:o.sendMode,init:s,body:c})},open(a){return(0,gt.openContract)(a,o=>Ri(e,t,o.address,o.init??null))},async getTransactions(a,o,i,s){const l=typeof s=="number";if(l&&s<=0)return[];let u=[];do{const c=await e.getAccountTransactions(a,o,i),d=c[0].tx,[b,m]=[d.lt,d.hash()];if(u.length>0&&b===o&&m.equals(i)&&c.shift(),c.length===0)break;const f=c[c.length-1].tx,[k,T]=[f.lt,f.hash()];if(k===o&&T.equals(i))break;u.push(...c.map(A=>A.tx)),o=k,i=T}while(l&&u.lengthu===a))==null?void 0:s[0];if(i===void 0)throw new Error(`Can't deserialize walletId: unknown wallet version ${a}`);return{networkGlobalId:n,workChain:r,walletVersion:i,subwalletNumber:o}}Ia.loadWalletIdV5Beta=sT;function lT(e){return t=>{t.storeInt(e.networkGlobalId,32),t.storeInt(e.workChain,8),t.storeUint(Ay[e.walletVersion],8),t.storeUint(e.subwalletNumber,32)}}Ia.storeWalletIdV5Beta=lT;var bh;function Sy(){if(bh)return bi;bh=1,Object.defineProperty(bi,"__esModule",{value:!0}),bi.WalletContractV5Beta=void 0;const e=de,t=jn(),n=Ia;class r{static create(o){var s,l,u,c;const i={networkGlobalId:((s=o.walletId)==null?void 0:s.networkGlobalId)??-239,workChain:((l=o==null?void 0:o.walletId)==null?void 0:l.workChain)??0,subwalletNumber:((u=o==null?void 0:o.walletId)==null?void 0:u.subwalletNumber)??0,walletVersion:((c=o==null?void 0:o.walletId)==null?void 0:c.walletVersion)??"v5"};return new r(i,o.publicKey)}constructor(o,i){this.walletId=o,this.publicKey=i,this.walletId=o;let s=e.Cell.fromBoc(Buffer.from("te6cckEBAQEAIwAIQgLkzzsvTG1qYeoPK1RH0mZ4WyavNjfbLe7mvNGqgm80Eg3NjhE=","base64"))[0],l=(0,e.beginCell)().storeInt(0,33).store((0,n.storeWalletIdV5Beta)(this.walletId)).storeBuffer(this.publicKey,32).storeBit(0).endCell();this.init={code:s,data:l},this.address=(0,e.contractAddress)(this.walletId.workChain,{code:s,data:l})}async getBalance(o){return(await o.getState()).balance}async getSeqno(o){return(await o.getState()).state.type==="active"?(await o.get("seqno",[])).stack.readNumber():0}async getExtensions(o){return(await o.getState()).state.type==="active"?(await o.get("get_extensions",[])).stack.readCellOpt():null}async getExtensionsArray(o){const i=await this.getExtensions(o);if(!i)return[];const s=e.Dictionary.loadDirect(e.Dictionary.Keys.BigUint(256),e.Dictionary.Values.BigInt(8),i);return s.keys().map(l=>{const u=s.get(l),c=l^u+1n;return e.Address.parseRaw(`${u}:${c.toString(16).padStart(64,"0")}`)})}async getIsSecretKeyAuthEnabled(o){return(await o.get("get_is_signature_auth_allowed",[])).stack.readNumber()!==0}async send(o,i){await o.external(i)}async sendTransfer(o,i){const s=await this.createTransfer(i);await this.send(o,s)}async sendAddExtension(o,i){const s=await this.createAddExtension(i);await this.send(o,s)}async sendRemoveExtension(o,i){const s=await this.createRemoveExtension(i);await this.send(o,s)}async sendActionsBatch(o,i){const s=await this.createRequest(i);await this.send(o,s)}createActions(o){return o.messages.map(s=>({type:"sendMsg",mode:o.sendMode,outMsg:s}))}createTransfer(o){return this.createRequest({...o,actions:this.createActions({messages:o.messages,sendMode:o.sendMode})})}createAddExtension(o){return this.createRequest({...o,actions:[{type:"addExtension",address:o.extensionAddress}]})}createRemoveExtension(o){return this.createRequest({...o,actions:[{type:"removeExtension",address:o.extensionAddress}]})}createRequest(o){return o.authType==="extension"?(0,t.createWalletTransferV5Beta)(o):(0,t.createWalletTransferV5Beta)({...o,walletId:(0,n.storeWalletIdV5Beta)(this.walletId)})}sender(o,i){return{send:async s=>{let l=await this.getSeqno(o),u=this.createTransfer({seqno:l,secretKey:i,sendMode:s.sendMode??e.SendMode.PAY_GAS_SEPARATELY+e.SendMode.IGNORE_ERRORS,messages:[(0,e.internal)({to:s.to,value:s.value,init:s.init,body:s.body,bounce:s.bounce})]});await this.send(o,u)}}}}return bi.WalletContractV5Beta=r,r.OpCodes={auth_extension:1702392942,auth_signed_external:1936287598,auth_signed_internal:1936289396},bi}var Gt={},Ra={};Object.defineProperty(Ra,"__esModule",{value:!0});Ra.isOutActionBasic=Ra.isOutActionExtended=void 0;function Ty(e){return e.type==="setIsPublicKeyEnabled"||e.type==="addExtension"||e.type==="removeExtension"}Ra.isOutActionExtended=Ty;function uT(e){return!Ty(e)}Ra.isOutActionBasic=uT;Object.defineProperty(Gt,"__esModule",{value:!0});Gt.loadOutListExtendedV5Beta=Gt.storeOutListExtendedV5Beta=Gt.loadOutActionV5BetaExtended=Gt.storeOutActionExtendedV5Beta=void 0;const Vs=de,kh=Ra,Py=550222170;function cT(e){return t=>{t.storeUint(Py,32).storeUint(e.isEnabled?1:0,1)}}const By=474012575;function dT(e){return t=>{t.storeUint(By,32).storeAddress(e.address)}}const My=1588524196;function fT(e){return t=>{t.storeUint(My,32).storeAddress(e.address)}}function xy(e){switch(e.type){case"setIsPublicKeyEnabled":return cT(e);case"addExtension":return dT(e);case"removeExtension":return fT(e);default:throw new Error("Unknown action type"+(e==null?void 0:e.type))}}Gt.storeOutActionExtendedV5Beta=xy;function Oy(e){const t=e.loadUint(32);switch(t){case Py:return{type:"setIsPublicKeyEnabled",isEnabled:!!e.loadUint(1)};case By:return{type:"addExtension",address:e.loadAddress()};case My:return{type:"removeExtension",address:e.loadAddress()};default:throw new Error(`Unknown extended out action tag 0x${t.toString(16)}`)}}Gt.loadOutActionV5BetaExtended=Oy;function Iy(e){const[t,...n]=e;if(!t||!(0,kh.isOutActionExtended)(t)){if(e.some(kh.isOutActionExtended))throw new Error("Can't serialize actions list: all extended actions must be placed before out actions");return r=>{r.storeUint(0,1).storeRef((0,Vs.beginCell)().store((0,Vs.storeOutList)(e)).endCell())}}return r=>{r.storeUint(1,1).store(xy(t)).storeRef((0,Vs.beginCell)().store(Iy(n)).endCell())}}Gt.storeOutListExtendedV5Beta=Iy;function hT(e){const t=[];for(;e.loadUint(1);){const r=Oy(e);t.push(r),e=e.loadRef().beginParse()}const n=(0,Vs.loadOutList)(e.loadRef().beginParse());if(n.some(r=>r.type==="setCode"))throw new Error("Can't deserialize actions list: only sendMsg actions are allowed for wallet v5");return t.concat(n)}Gt.loadOutListExtendedV5Beta=hT;var su={};Object.defineProperty(su,"__esModule",{value:!0});su.signPayload=void 0;const mT=Wt();function pT(e,t,n){return"secretKey"in e?n((0,mT.sign)(t.endCell().hash(),e.secretKey),t):e.signer(t.endCell()).then(r=>n(r,t))}su.signPayload=pT;var ki={},Rn={};Object.defineProperty(Rn,"__esModule",{value:!0});Rn.storeWalletIdV5R1=Rn.loadWalletIdV5R1=Rn.isWalletIdV5R1ClientContext=void 0;const ro=de;function Ry(e){return typeof e!="number"}Rn.isWalletIdV5R1ClientContext=Ry;const Ny={v5r1:0};function gT(e,t){var i;const n=new ro.BitReader(new ro.BitString(typeof e=="bigint"?Buffer.from(e.toString(16),"hex"):e instanceof ro.Slice?e.loadBuffer(4):e,0,32)).loadInt(32),r=BigInt(n)^BigInt(t),a=(0,ro.beginCell)().storeInt(r,32).endCell().beginParse();if(a.loadUint(1)){const s=a.loadInt(8),l=a.loadUint(8),u=a.loadUint(15),c=(i=Object.entries(Ny).find(([d,b])=>b===l))==null?void 0:i[0];if(c===void 0)throw new Error(`Can't deserialize walletId: unknown wallet version ${l}`);return{networkGlobalId:t,context:{walletVersion:c,workChain:s,subwalletNumber:u}}}else{const s=a.loadUint(31);return{networkGlobalId:t,context:s}}}Rn.loadWalletIdV5R1=gT;function yT(e){return t=>{let n;return Ry(e.context)?n=(0,ro.beginCell)().storeUint(1,1).storeInt(e.context.workChain,8).storeUint(Ny[e.context.walletVersion],8).storeUint(e.context.subwalletNumber,15).endCell().beginParse().loadInt(32):n=(0,ro.beginCell)().storeUint(0,1).storeUint(e.context,31).endCell().beginParse().loadInt(32),t.storeInt(BigInt(e.networkGlobalId)^BigInt(n),32)}}Rn.storeWalletIdV5R1=yT;var wh;function zy(){if(wh)return ki;wh=1,Object.defineProperty(ki,"__esModule",{value:!0}),ki.WalletContractV5R1=void 0;const e=de,t=jn(),n=Rn;class r{static create(o){var s,l,u;let i=0;return"workChain"in o&&o.workChain!=null&&(i=o.workChain),(s=o.walletId)!=null&&s.context&&(0,n.isWalletIdV5R1ClientContext)(o.walletId.context)&&o.walletId.context.workChain!=null&&(i=o.walletId.context.workChain),new r(i,o.publicKey,{networkGlobalId:((l=o.walletId)==null?void 0:l.networkGlobalId)??-239,context:((u=o.walletId)==null?void 0:u.context)??{workChain:0,walletVersion:"v5r1",subwalletNumber:0}})}constructor(o,i,s){this.publicKey=i,this.walletId=s,this.walletId=s;let l=e.Cell.fromBoc(Buffer.from("b5ee9c7241021401000281000114ff00f4a413f4bcf2c80b01020120020d020148030402dcd020d749c120915b8f6320d70b1f2082106578746ebd21821073696e74bdb0925f03e082106578746eba8eb48020d72101d074d721fa4030fa44f828fa443058bd915be0ed44d0810141d721f4058307f40e6fa1319130e18040d721707fdb3ce03120d749810280b99130e070e2100f020120050c020120060902016e07080019adce76a2684020eb90eb85ffc00019af1df6a2684010eb90eb858fc00201480a0b0017b325fb51341c75c875c2c7e00011b262fb513435c280200019be5f0f6a2684080a0eb90fa02c0102f20e011e20d70b1f82107369676ebaf2e08a7f0f01e68ef0eda2edfb218308d722028308d723208020d721d31fd31fd31fed44d0d200d31f20d31fd3ffd70a000af90140ccf9109a28945f0adb31e1f2c087df02b35007b0f2d0845125baf2e0855036baf2e086f823bbf2d0882292f800de01a47fc8ca00cb1f01cf16c9ed542092f80fde70db3cd81003f6eda2edfb02f404216e926c218e4c0221d73930709421c700b38e2d01d72820761e436c20d749c008f2e09320d74ac002f2e09320d71d06c712c2005230b0f2d089d74cd7393001a4e86c128407bbf2e093d74ac000f2e093ed55e2d20001c000915be0ebd72c08142091709601d72c081c12e25210b1e30f20d74a111213009601fa4001fa44f828fa443058baf2e091ed44d0810141d718f405049d7fc8ca0040048307f453f2e08b8e14038307f45bf2e08c22d70a00216e01b3b0f2d090e2c85003cf1612f400c9ed54007230d72c08248e2d21f2e092d200ed44d0d2005113baf2d08f54503091319c01810140d721d70a00f2e08ee2c8ca0058cf16c9ed5493f2c08de20010935bdb31e1d74cd0b4d6c35e","hex"))[0],u=(0,e.beginCell)().storeUint(1,1).storeUint(0,32).store((0,n.storeWalletIdV5R1)(this.walletId)).storeBuffer(this.publicKey,32).storeBit(0).endCell();this.init={code:l,data:u},this.address=(0,e.contractAddress)(o,{code:l,data:u})}async getBalance(o){return(await o.getState()).balance}async getSeqno(o){return(await o.getState()).state.type==="active"?(await o.get("seqno",[])).stack.readNumber():0}async getExtensions(o){return(await o.getState()).state.type==="active"?(await o.get("get_extensions",[])).stack.readCellOpt():null}async getExtensionsArray(o){const i=await this.getExtensions(o);return i?e.Dictionary.loadDirect(e.Dictionary.Keys.BigUint(256),e.Dictionary.Values.BigInt(1),i).keys().map(l=>{const u=this.address.workChain;return e.Address.parseRaw(`${u}:${l.toString(16).padStart(64,"0")}`)}):[]}async getIsSecretKeyAuthEnabled(o){return(await o.get("is_signature_allowed",[])).stack.readBoolean()}async send(o,i){await o.external(i)}async sendTransfer(o,i){const s=await this.createTransfer(i);await this.send(o,s)}async sendAddExtension(o,i){const s=await this.createAddExtension(i);await this.send(o,s)}async sendRemoveExtension(o,i){const s=await this.createRemoveExtension(i);await this.send(o,s)}createActions(o){return o.messages.map(s=>({type:"sendMsg",mode:o.sendMode,outMsg:s}))}createTransfer(o){return this.createRequest({actions:this.createActions({messages:o.messages,sendMode:o.sendMode}),...o})}createAddExtension(o){return this.createRequest({actions:[{type:"addExtension",address:o.extensionAddress}],...o})}createRemoveExtension(o){return this.createRequest({actions:[{type:"removeExtension",address:o.extensionAddress}],...o})}createRequest(o){return o.authType==="extension"?(0,t.createWalletTransferV5R1)(o):(0,t.createWalletTransferV5R1)({...o,walletId:(0,n.storeWalletIdV5R1)(this.walletId)})}sender(o,i){return{send:async s=>{let l=await this.getSeqno(o),u=this.createTransfer({seqno:l,secretKey:i,sendMode:s.sendMode??e.SendMode.PAY_GAS_SEPARATELY+e.SendMode.IGNORE_ERRORS,messages:[(0,e.internal)({to:s.to,value:s.value,init:s.init,body:s.body,bounce:s.bounce})]});await this.send(o,u)}}}}return ki.WalletContractV5R1=r,r.OpCodes={auth_extension:1702392942,auth_signed_external:1936287598,auth_signed_internal:1936289396},ki}var bt={};Object.defineProperty(bt,"__esModule",{value:!0});bt.patchV5R1ActionsSendMode=bt.toSafeV5R1SendMode=bt.loadOutListExtendedV5R1=bt.storeOutListExtendedV5R1=bt.loadOutActionExtendedV5R1=bt.storeOutActionExtendedV5R1=void 0;const Zi=de,vh=Ra,Dy=4;function bT(e){return t=>{t.storeUint(Dy,8).storeUint(e.isEnabled?1:0,1)}}const Uy=2;function kT(e){return t=>{t.storeUint(Uy,8).storeAddress(e.address)}}const Fy=3;function wT(e){return t=>{t.storeUint(Fy,8).storeAddress(e.address)}}function Sd(e){switch(e.type){case"setIsPublicKeyEnabled":return bT(e);case"addExtension":return kT(e);case"removeExtension":return wT(e);default:throw new Error("Unknown action type"+(e==null?void 0:e.type))}}bt.storeOutActionExtendedV5R1=Sd;function Uc(e){const t=e.loadUint(8);switch(t){case Dy:return{type:"setIsPublicKeyEnabled",isEnabled:!!e.loadUint(1)};case Uy:return{type:"addExtension",address:e.loadAddress()};case Fy:return{type:"removeExtension",address:e.loadAddress()};default:throw new Error(`Unknown extended out action tag 0x${t.toString(16)}`)}}bt.loadOutActionExtendedV5R1=Uc;function vT(e){const t=e.filter(vh.isOutActionExtended),n=e.filter(vh.isOutActionBasic);return r=>{const a=n.length?(0,Zi.beginCell)().store((0,Zi.storeOutList)(n.slice().reverse())):null;if(r.storeMaybeRef(a),t.length===0)r.storeUint(0,1);else{const[o,...i]=t;r.storeUint(1,1).store(Sd(o)),i.length>0&&r.storeRef(Ly(i))}}}bt.storeOutListExtendedV5R1=vT;function Ly(e){const[t,...n]=e;let r=(0,Zi.beginCell)().store(Sd(t));return n.length>0&&(r=r.storeRef(Ly(n))),r.endCell()}function jT(e){const t=[],n=e.loadMaybeRef();if(n){const r=(0,Zi.loadOutList)(n.beginParse());if(r.some(a=>a.type!=="sendMsg"))throw new Error("Can't deserialize actions list: only sendMsg actions are allowed for wallet v5r1");t.push(...r)}if(e.loadBoolean()){const r=Uc(e);t.push(r)}for(;e.remainingRefs>0;){e=e.loadRef().beginParse();const r=Uc(e);t.push(r)}return t}bt.loadOutListExtendedV5R1=jT;function qy(e,t){return t==="internal"||t==="extension"?e:e|Zi.SendMode.IGNORE_ERRORS}bt.toSafeV5R1SendMode=qy;function _T(e,t){return e.map(n=>n.type==="sendMsg"?{...n,mode:qy(n.mode,t)}:n)}bt.patchV5R1ActionsSendMode=_T;var jh;function jn(){if(jh)return ft;jh=1,Object.defineProperty(ft,"__esModule",{value:!0}),ft.createWalletTransferV5R1=ft.createWalletTransferV5Beta=ft.createWalletTransferV4=ft.createWalletTransferV3=ft.createWalletTransferV2=ft.createWalletTransferV1=void 0;const e=de,t=Wt(),n=Sy(),r=Gt,a=su,o=zy(),i=bt;function s(f,k){return(0,e.beginCell)().storeBuffer(f).storeBuilder(k).endCell()}function l(f,k){return(0,e.beginCell)().storeBuilder(k).storeBuffer(f).endCell()}function u(f){let k=(0,e.beginCell)().storeUint(f.seqno,32);f.message&&(k.storeUint(f.sendMode,8),k.storeRef((0,e.beginCell)().store((0,e.storeMessageRelaxed)(f.message))));let T=(0,t.sign)(k.endCell().hash(),f.secretKey);return(0,e.beginCell)().storeBuffer(T).storeBuilder(k).endCell()}ft.createWalletTransferV1=u;function c(f){if(f.messages.length>4)throw Error("Maximum number of messages in a single transfer is 4");let k=(0,e.beginCell)().storeUint(f.seqno,32);if(f.seqno===0)for(let y=0;y<32;y++)k.storeBit(1);else k.storeUint(f.timeout||Math.floor(Date.now()/1e3)+60,32);for(let y of f.messages)k.storeUint(f.sendMode,8),k.storeRef((0,e.beginCell)().store((0,e.storeMessageRelaxed)(y)));let T=(0,t.sign)(k.endCell().hash(),f.secretKey);return(0,e.beginCell)().storeBuffer(T).storeBuilder(k).endCell()}ft.createWalletTransferV2=c;function d(f){if(f.messages.length>4)throw Error("Maximum number of messages in a single transfer is 4");let k=(0,e.beginCell)().storeUint(f.walletId,32);if(f.seqno===0)for(let T=0;T<32;T++)k.storeBit(1);else k.storeUint(f.timeout||Math.floor(Date.now()/1e3)+60,32);k.storeUint(f.seqno,32);for(let T of f.messages)k.storeUint(f.sendMode,8),k.storeRef((0,e.beginCell)().store((0,e.storeMessageRelaxed)(T)));return(0,a.signPayload)(f,k,s)}ft.createWalletTransferV3=d;function b(f){if(f.messages.length>4)throw Error("Maximum number of messages in a single transfer is 4");let k=(0,e.beginCell)().storeUint(f.walletId,32);if(f.seqno===0)for(let T=0;T<32;T++)k.storeBit(1);else k.storeUint(f.timeout||Math.floor(Date.now()/1e3)+60,32);k.storeUint(f.seqno,32),k.storeUint(0,8);for(let T of f.messages)k.storeUint(f.sendMode,8),k.storeRef((0,e.beginCell)().store((0,e.storeMessageRelaxed)(T)));return(0,a.signPayload)(f,k,s)}ft.createWalletTransferV4=b;function m(f){if(f.actions.length>255)throw Error("Maximum number of OutActions in a single request is 255");if(f.authType==="extension")return(0,e.beginCell)().storeUint(n.WalletContractV5Beta.OpCodes.auth_extension,32).store((0,r.storeOutListExtendedV5Beta)(f.actions)).endCell();const k=(0,e.beginCell)().storeUint(f.authType==="internal"?n.WalletContractV5Beta.OpCodes.auth_signed_internal:n.WalletContractV5Beta.OpCodes.auth_signed_external,32).store(f.walletId);if(f.seqno===0)for(let T=0;T<32;T++)k.storeBit(1);else k.storeUint(f.timeout||Math.floor(Date.now()/1e3)+60,32);return k.storeUint(f.seqno,32).store((0,r.storeOutListExtendedV5Beta)(f.actions)),(0,a.signPayload)(f,k,l)}ft.createWalletTransferV5Beta=m;function p(f){if(f.actions.length>255)throw Error("Maximum number of OutActions in a single request is 255");if(f={...f},f.authType==="extension")return(0,e.beginCell)().storeUint(o.WalletContractV5R1.OpCodes.auth_extension,32).storeUint(f.queryId??0,64).store((0,i.storeOutListExtendedV5R1)(f.actions)).endCell();f.actions=(0,i.patchV5R1ActionsSendMode)(f.actions,f.authType);const k=(0,e.beginCell)().storeUint(f.authType==="internal"?o.WalletContractV5R1.OpCodes.auth_signed_internal:o.WalletContractV5R1.OpCodes.auth_signed_external,32).store(f.walletId);if(f.seqno===0)for(let T=0;T<32;T++)k.storeBit(1);else k.storeUint(f.timeout||Math.floor(Date.now()/1e3)+60,32);return k.storeUint(f.seqno,32).store((0,i.storeOutListExtendedV5R1)(f.actions)),(0,a.signPayload)(f,k,l)}return ft.createWalletTransferV5R1=p,ft}Object.defineProperty(iu,"__esModule",{value:!0});iu.WalletContractV1R1=void 0;const Ka=de,CT=jn();class Td{static create(t){return new Td(t.workchain,t.publicKey)}constructor(t,n){this.workchain=t,this.publicKey=n;let r=Ka.Cell.fromBoc(Buffer.from("te6cckEBAQEARAAAhP8AIN2k8mCBAgDXGCDXCx/tRNDTH9P/0VESuvKhIvkBVBBE+RDyovgAAdMfMSDXSpbTB9QC+wDe0aTIyx/L/8ntVEH98Ik=","base64"))[0],a=(0,Ka.beginCell)().storeUint(0,32).storeBuffer(n).endCell();this.init={code:r,data:a},this.address=(0,Ka.contractAddress)(t,{code:r,data:a})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){let n=await t.getState();return n.state.type==="active"?Ka.Cell.fromBoc(n.state.data)[0].beginParse().loadUint(32):0}async send(t,n){await t.external(n)}async sendTransfer(t,n){let r=this.createTransfer(n);await this.send(t,r)}createTransfer(t){let n=Ka.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(n=t.sendMode),(0,CT.createWalletTransferV1)({seqno:t.seqno,sendMode:n,secretKey:t.secretKey,message:t.message})}sender(t,n){return{send:async r=>{let a=await this.getSeqno(t),o=this.createTransfer({seqno:a,secretKey:n,sendMode:r.sendMode,message:(0,Ka.internal)({to:r.to,value:r.value,init:r.init,body:r.body,bounce:r.bounce})});await this.send(t,o)}}}}iu.WalletContractV1R1=Td;var lu={};Object.defineProperty(lu,"__esModule",{value:!0});lu.WalletContractV1R2=void 0;const wi=de,ET=jn();class Pd{static create(t){return new Pd(t.workchain,t.publicKey)}constructor(t,n){this.workchain=t,this.publicKey=n;let r=wi.Cell.fromBoc(Buffer.from("te6cckEBAQEAUwAAov8AIN0gggFMl7qXMO1E0NcLH+Ck8mCBAgDXGCDXCx/tRNDTH9P/0VESuvKhIvkBVBBE+RDyovgAAdMfMSDXSpbTB9QC+wDe0aTIyx/L/8ntVNDieG8=","base64"))[0],a=(0,wi.beginCell)().storeUint(0,32).storeBuffer(n).endCell();this.init={code:r,data:a},this.address=(0,wi.contractAddress)(t,{code:r,data:a})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,n){await t.external(n)}async sendTransfer(t,n){let r=this.createTransfer(n);await this.send(t,r)}createTransfer(t){let n=wi.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(n=t.sendMode),(0,ET.createWalletTransferV1)({seqno:t.seqno,sendMode:n,secretKey:t.secretKey,message:t.message})}sender(t,n){return{send:async r=>{let a=await this.getSeqno(t),o=this.createTransfer({seqno:a,secretKey:n,sendMode:r.sendMode,message:(0,wi.internal)({to:r.to,value:r.value,init:r.init,body:r.body,bounce:r.bounce})});await this.send(t,o)}}}}lu.WalletContractV1R2=Pd;var uu={};Object.defineProperty(uu,"__esModule",{value:!0});uu.WalletContractV1R3=void 0;const vi=de,AT=jn();class Bd{static create(t){return new Bd(t.workchain,t.publicKey)}constructor(t,n){this.workchain=t,this.publicKey=n;let r=vi.Cell.fromBoc(Buffer.from("te6cckEBAQEAXwAAuv8AIN0gggFMl7ohggEznLqxnHGw7UTQ0x/XC//jBOCk8mCBAgDXGCDXCx/tRNDTH9P/0VESuvKhIvkBVBBE+RDyovgAAdMfMSDXSpbTB9QC+wDe0aTIyx/L/8ntVLW4bkI=","base64"))[0],a=(0,vi.beginCell)().storeUint(0,32).storeBuffer(n).endCell();this.init={code:r,data:a},this.address=(0,vi.contractAddress)(t,{code:r,data:a})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,n){await t.external(n)}async sendTransfer(t,n){let r=this.createTransfer(n);await this.send(t,r)}createTransfer(t){let n=vi.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(n=t.sendMode),(0,AT.createWalletTransferV1)({seqno:t.seqno,sendMode:n,secretKey:t.secretKey,message:t.message})}sender(t,n){return{send:async r=>{let a=await this.getSeqno(t),o=this.createTransfer({seqno:a,secretKey:n,sendMode:r.sendMode,message:(0,vi.internal)({to:r.to,value:r.value,init:r.init,body:r.body,bounce:r.bounce})});await this.send(t,o)}}}}uu.WalletContractV1R3=Bd;var cu={};Object.defineProperty(cu,"__esModule",{value:!0});cu.WalletContractV2R1=void 0;const ji=de,ST=jn();class Md{static create(t){return new Md(t.workchain,t.publicKey)}constructor(t,n){this.workchain=t,this.publicKey=n;let r=ji.Cell.fromBoc(Buffer.from("te6cckEBAQEAVwAAqv8AIN0gggFMl7qXMO1E0NcLH+Ck8mCDCNcYINMf0x8B+CO78mPtRNDTH9P/0VExuvKhA/kBVBBC+RDyovgAApMg10qW0wfUAvsA6NGkyMsfy//J7VShNwu2","base64"))[0],a=(0,ji.beginCell)().storeUint(0,32).storeBuffer(n).endCell();this.init={code:r,data:a},this.address=(0,ji.contractAddress)(t,{code:r,data:a})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,n){await t.external(n)}async sendTransfer(t,n){let r=this.createTransfer(n);await this.send(t,r)}createTransfer(t){let n=ji.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(n=t.sendMode),(0,ST.createWalletTransferV2)({seqno:t.seqno,sendMode:n,secretKey:t.secretKey,messages:t.messages,timeout:t.timeout})}sender(t,n){return{send:async r=>{let a=await this.getSeqno(t),o=this.createTransfer({seqno:a,secretKey:n,sendMode:r.sendMode,messages:[(0,ji.internal)({to:r.to,value:r.value,init:r.init,body:r.body,bounce:r.bounce})]});await this.send(t,o)}}}}cu.WalletContractV2R1=Md;var du={};Object.defineProperty(du,"__esModule",{value:!0});du.WalletContractV2R2=void 0;const _i=de,TT=jn();class xd{static create(t){return new xd(t.workchain,t.publicKey)}constructor(t,n){this.workchain=t,this.publicKey=n;let r=_i.Cell.fromBoc(Buffer.from("te6cckEBAQEAYwAAwv8AIN0gggFMl7ohggEznLqxnHGw7UTQ0x/XC//jBOCk8mCDCNcYINMf0x8B+CO78mPtRNDTH9P/0VExuvKhA/kBVBBC+RDyovgAApMg10qW0wfUAvsA6NGkyMsfy//J7VQETNeh","base64"))[0],a=(0,_i.beginCell)().storeUint(0,32).storeBuffer(n).endCell();this.init={code:r,data:a},this.address=(0,_i.contractAddress)(t,{code:r,data:a})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,n){await t.external(n)}async sendTransfer(t,n){let r=this.createTransfer(n);await this.send(t,r)}createTransfer(t){let n=_i.SendMode.PAY_GAS_SEPARATELY;return t.sendMode!==null&&t.sendMode!==void 0&&(n=t.sendMode),(0,TT.createWalletTransferV2)({seqno:t.seqno,sendMode:n,secretKey:t.secretKey,messages:t.messages,timeout:t.timeout})}sender(t,n){return{send:async r=>{let a=await this.getSeqno(t),o=this.createTransfer({seqno:a,secretKey:n,sendMode:r.sendMode,messages:[(0,_i.internal)({to:r.to,value:r.value,init:r.init,body:r.body,bounce:r.bounce})]});await this.send(t,o)}}}}du.WalletContractV2R2=xd;var fu={};Object.defineProperty(fu,"__esModule",{value:!0});fu.WalletContractV3R1=void 0;const Ci=de,PT=jn();class Od{static create(t){return new Od(t.workchain,t.publicKey,t.walletId)}constructor(t,n,r){this.workchain=t,this.publicKey=n,r!=null?this.walletId=r:this.walletId=698983191+t;let a=Ci.Cell.fromBoc(Buffer.from("te6cckEBAQEAYgAAwP8AIN0gggFMl7qXMO1E0NcLH+Ck8mCDCNcYINMf0x/TH/gjE7vyY+1E0NMf0x/T/9FRMrryoVFEuvKiBPkBVBBV+RDyo/gAkyDXSpbTB9QC+wDo0QGkyMsfyx/L/8ntVD++buA=","base64"))[0],o=(0,Ci.beginCell)().storeUint(0,32).storeUint(this.walletId,32).storeBuffer(n).endCell();this.init={code:a,data:o},this.address=(0,Ci.contractAddress)(t,{code:a,data:o})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,n){await t.external(n)}async sendTransfer(t,n){let r=this.createTransfer(n);await this.send(t,r)}createTransfer(t){return(0,PT.createWalletTransferV3)({...t,sendMode:t.sendMode??Ci.SendMode.PAY_GAS_SEPARATELY,walletId:this.walletId})}sender(t,n){return{send:async r=>{let a=await this.getSeqno(t),o=this.createTransfer({seqno:a,secretKey:n,sendMode:r.sendMode,messages:[(0,Ci.internal)({to:r.to,value:r.value,init:r.init,body:r.body,bounce:r.bounce})]});await this.send(t,o)}}}}fu.WalletContractV3R1=Od;var hu={};Object.defineProperty(hu,"__esModule",{value:!0});hu.WalletContractV3R2=void 0;const Ei=de,BT=jn();class Id{static create(t){return new Id(t.workchain,t.publicKey,t.walletId)}constructor(t,n,r){this.workchain=t,this.publicKey=n,r!=null?this.walletId=r:this.walletId=698983191+t;let a=Ei.Cell.fromBoc(Buffer.from("te6cckEBAQEAcQAA3v8AIN0gggFMl7ohggEznLqxn3Gw7UTQ0x/THzHXC//jBOCk8mCDCNcYINMf0x/TH/gjE7vyY+1E0NMf0x/T/9FRMrryoVFEuvKiBPkBVBBV+RDyo/gAkyDXSpbTB9QC+wDo0QGkyMsfyx/L/8ntVBC9ba0=","base64"))[0],o=(0,Ei.beginCell)().storeUint(0,32).storeUint(this.walletId,32).storeBuffer(n).endCell();this.init={code:a,data:o},this.address=(0,Ei.contractAddress)(t,{code:a,data:o})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,n){await t.external(n)}async sendTransfer(t,n){let r=this.createTransfer(n);await this.send(t,r)}createTransfer(t){return(0,BT.createWalletTransferV3)({...t,sendMode:t.sendMode??Ei.SendMode.PAY_GAS_SEPARATELY,walletId:this.walletId})}sender(t,n){return{send:async r=>{let a=await this.getSeqno(t),o=this.createTransfer({seqno:a,secretKey:n,sendMode:r.sendMode,messages:[(0,Ei.internal)({to:r.to,value:r.value,init:r.init,body:r.body,bounce:r.bounce})]});await this.send(t,o)}}}}hu.WalletContractV3R2=Id;var mu={};Object.defineProperty(mu,"__esModule",{value:!0});mu.WalletContractV4=void 0;const Ai=de,MT=jn();class Rd{static create(t){return new Rd(t.workchain,t.publicKey,t.walletId)}constructor(t,n,r){this.workchain=t,this.publicKey=n,r!=null?this.walletId=r:this.walletId=698983191+t;let a=Ai.Cell.fromBoc(Buffer.from("te6ccgECFAEAAtQAART/APSkE/S88sgLAQIBIAIDAgFIBAUE+PKDCNcYINMf0x/THwL4I7vyZO1E0NMf0x/T//QE0VFDuvKhUVG68qIF+QFUEGT5EPKj+AAkpMjLH1JAyx9SMMv/UhD0AMntVPgPAdMHIcAAn2xRkyDXSpbTB9QC+wDoMOAhwAHjACHAAuMAAcADkTDjDQOkyMsfEssfy/8QERITAubQAdDTAyFxsJJfBOAi10nBIJJfBOAC0x8hghBwbHVnvSKCEGRzdHK9sJJfBeAD+kAwIPpEAcjKB8v/ydDtRNCBAUDXIfQEMFyBAQj0Cm+hMbOSXwfgBdM/yCWCEHBsdWe6kjgw4w0DghBkc3RyupJfBuMNBgcCASAICQB4AfoA9AQw+CdvIjBQCqEhvvLgUIIQcGx1Z4MesXCAGFAEywUmzxZY+gIZ9ADLaRfLH1Jgyz8gyYBA+wAGAIpQBIEBCPRZMO1E0IEBQNcgyAHPFvQAye1UAXKwjiOCEGRzdHKDHrFwgBhQBcsFUAPPFiP6AhPLassfyz/JgED7AJJfA+ICASAKCwBZvSQrb2omhAgKBrkPoCGEcNQICEekk30pkQzmkD6f+YN4EoAbeBAUiYcVnzGEAgFYDA0AEbjJftRNDXCx+AA9sp37UTQgQFA1yH0BDACyMoHy//J0AGBAQj0Cm+hMYAIBIA4PABmtznaiaEAga5Drhf/AABmvHfaiaEAQa5DrhY/AAG7SB/oA1NQi+QAFyMoHFcv/ydB3dIAYyMsFywIizxZQBfoCFMtrEszMyXP7AMhAFIEBCPRR8qcCAHCBAQjXGPoA0z/IVCBHgQEI9FHyp4IQbm90ZXB0gBjIywXLAlAGzxZQBPoCFMtqEssfyz/Jc/sAAgBsgQEI1xj6ANM/MFIkgQEI9Fnyp4IQZHN0cnB0gBjIywXLAlAFzxZQA/oCE8tqyx8Syz/Jc/sAAAr0AMntVA==","base64"))[0],o=(0,Ai.beginCell)().storeUint(0,32).storeUint(this.walletId,32).storeBuffer(this.publicKey).storeBit(0).endCell();this.init={code:a,data:o},this.address=(0,Ai.contractAddress)(t,{code:a,data:o})}async getBalance(t){return(await t.getState()).balance}async getSeqno(t){return(await t.getState()).state.type==="active"?(await t.get("seqno",[])).stack.readNumber():0}async send(t,n){await t.external(n)}async sendTransfer(t,n){let r=this.createTransfer(n);await this.send(t,r)}createTransfer(t){return(0,MT.createWalletTransferV4)({...t,sendMode:t.sendMode??Ai.SendMode.PAY_GAS_SEPARATELY,walletId:this.walletId})}sender(t,n){return{send:async r=>{let a=await this.getSeqno(t),o=this.createTransfer({seqno:a,secretKey:n,sendMode:r.sendMode,messages:[(0,Ai.internal)({to:r.to,value:r.value,init:r.init,body:r.body,bounce:r.bounce})]});await this.send(t,o)}}}}mu.WalletContractV4=Rd;var $y={};(function(e){var t=re&&re.__createBinding||(Object.create?function(r,a,o,i){i===void 0&&(i=o);var s=Object.getOwnPropertyDescriptor(a,o);(!s||("get"in s?!a.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(r,i,s)}:function(r,a,o,i){i===void 0&&(i=o),r[i]=a[o]}),n=re&&re.__exportStar||function(r,a){for(var o in r)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&t(a,r,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(Sy(),e),n(Gt,e),n(Ia,e)})($y);var Wy={};(function(e){var t=re&&re.__createBinding||(Object.create?function(r,a,o,i){i===void 0&&(i=o);var s=Object.getOwnPropertyDescriptor(a,o);(!s||("get"in s?!a.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(r,i,s)}:function(r,a,o,i){i===void 0&&(i=o),r[i]=a[o]}),n=re&&re.__exportStar||function(r,a){for(var o in r)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&t(a,r,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(zy(),e),n(bt,e),n(Rn,e)})(Wy);var pu={};Object.defineProperty(pu,"__esModule",{value:!0});pu.JettonMaster=void 0;const xT=de;class Nd{static create(t){return new Nd(t)}constructor(t){this.address=t}async getWalletAddress(t,n){return(await t.get("get_wallet_address",[{type:"slice",cell:(0,xT.beginCell)().storeAddress(n).endCell()}])).stack.readAddress()}async getJettonData(t){let n=await t.get("get_jetton_data",[]),r=n.stack.readBigNumber(),a=n.stack.readBoolean(),o=n.stack.readAddress(),i=n.stack.readCell(),s=n.stack.readCell();return{totalSupply:r,mintable:a,adminAddress:o,content:i,walletCode:s}}}pu.JettonMaster=Nd;var gu={};Object.defineProperty(gu,"__esModule",{value:!0});gu.JettonWallet=void 0;let OT=class Hy{static create(t){return new Hy(t)}constructor(t){this.address=t}async getBalance(t){return(await t.getState()).state.type!=="active"?0n:(await t.get("get_wallet_data",[])).stack.readBigNumber()}};gu.JettonWallet=OT;var fs={};Object.defineProperty(fs,"__esModule",{value:!0});fs.MultisigOrder=void 0;const _h=Wt(),Os=de;class fl{constructor(t){this.signatures={},this.payload=t}static fromCell(t){var i;let n=t.beginParse(),r=(i=n.loadMaybeRef())==null?void 0:i.beginParse();const a=n.asCell();let o=new fl(a);if(r){for(;r.remainingBits>0;){const s=r.loadBuffer(64),l=r.loadUint(8);o.signatures[l]=s,r.remainingRefs>0?r=r.loadRef().asSlice():r.skip(1)}r.endParse()}return o}static fromPayload(t){return new fl(t)}addSignature(t,n,r){const a=this.payload.hash();if(!(0,_h.signVerify)(a,n,r.owners.get(t).slice(0,-1)))throw Error("invalid signature");this.signatures[t]=n}sign(t,n){const r=this.payload.hash();return this.signatures[t]=(0,_h.sign)(r,n),r}unionSignatures(t){this.signatures=Object.assign({},this.signatures,t.signatures)}clearSignatures(){this.signatures={}}toCell(t){let n=(0,Os.beginCell)().storeBit(0);for(const r in this.signatures){const a=this.signatures[r];n=(0,Os.beginCell)().storeBit(1).storeRef((0,Os.beginCell)().storeBuffer(a).storeUint(parseInt(r),8).storeBuilder(n).endCell())}return(0,Os.beginCell)().storeUint(t,8).storeBuilder(n).storeBuilder(this.payload.asBuilder()).endCell()}}fs.MultisigOrder=fl;var yu={};Object.defineProperty(yu,"__esModule",{value:!0});yu.MultisigOrderBuilder=void 0;const Si=de,IT=fs;class RT{constructor(t,n){this.messages=(0,Si.beginCell)(),this.queryId=0n,this.walletId=t,this.queryOffset=n||7200}addMessage(t,n){if(this.messages.refs>=4)throw Error("only 4 refs are allowed");this.updateQueryId(),this.messages.storeUint(n,8),this.messages.storeRef((0,Si.beginCell)().store((0,Si.storeMessageRelaxed)(t)).endCell())}clearMessages(){this.messages=(0,Si.beginCell)()}build(){return IT.MultisigOrder.fromPayload((0,Si.beginCell)().storeUint(this.walletId,32).storeUint(this.queryId,64).storeBuilder(this.messages).endCell())}updateQueryId(){const t=BigInt(Math.floor(Date.now()/1e3+this.queryOffset));this.queryId=t<<32n}}yu.MultisigOrderBuilder=RT;var bu={};Object.defineProperty(bu,"__esModule",{value:!0});bu.MultisigWallet=void 0;const Ch=Wt(),mt=de,NT=mt.Cell.fromBase64("te6ccgECKwEABBgAART/APSkE/S88sgLAQIBIAIDAgFIBAUE2vIgxwCOgzDbPOCDCNcYIPkBAdMH2zwiwAAToVNxePQOb6Hyn9s8VBq6+RDyoAb0BCD5AQHTH1EYuvKq0z9wUwHwCgHCCAGDCryx8mhTFYBA9A5voSCYDqQgwgryZw7f+COqH1NAufJhVCOjU04gIyEiAgLMBgcCASAMDQIBIAgJAgFmCgsAA9GEAiPymAvHoHN9CYbZ5S7Z4BPHohwhJQAtAKkItdJEqCTItdKlwLUAdAT8ArobBKAATwhbpEx4CBukTDgAdAg10rDAJrUAvALyFjPFszJ4HHXI8gBzxb0AMmACASAODwIBIBQVARW77ZbVA0cFUg2zyCoCAUgQEQIBIBITAXOxHXQgwjXGCD5AQHTB4IB1MTtQ9hTIHj0Dm+h8p/XC/9eMfkQ8qCuAfQEIW6TW3Ey4PkBWNs8AaQBgJwA9rtqA6ADoAPoCAXoCEfyAgPyA3XlP+AXkegAA54tkwAAXrhlXP8EA1WZ2oexAAgEgFhcCASAYGQFRtyVbZ4YmRmpGEAgegc30McJNhFpAADMaYeYuAFrgJhwLb+4cC3d0bhAjAYm1WZtnhqvgb+2xxsoicAgej430pBHEoFpAADHDhBACGuQkuuBk9kUWE5kAOeLKhACQCB6IYFImHFImHFImXEA2YlzNijAjAgEgGhsAF7UGtc4QQDVZnah7EAIBIBwdAgOZOB4fARGsGm2eL4G2CUAjABWt+UEAzJV2oewYQAENqTbPBVfBYCMAFa3f3CCAarM7UPYgAiDbPALyZfgAUENxQxPbPO1UIyoACtP/0wcwBKDbPC+uUyCw8mISsQKkJbNTHLmwJYEA4aojoCi8sPJpggGGoPgBBZcCERACPj4wjo0REB/bPEDXePRDEL0F4lQWW1Rz51YQU9zbPFRxClR6vCQlKCYAIO1E0NMf0wfTB9M/9AT0BNEAXgGOGjDSAAHyo9MH0wdQA9cBIPkBBfkBFbrypFAD4GwhIddKqgIi10m68qtwVCATAAwByMv/ywcE1ts87VT4D3AlblOJvrGYEG4QLVDHXwePGzBUJANQTds8UFWgRlAQSRA6SwlTuds8UFQWf+L4AAeDJaGOLCaAQPSWb6UglDBTA7neII4WODk5CNIAAZfTBzAW8AcFkTDifwgHBZJsMeKz5jAGKicoKQBgcI4pA9CDCNcY0wf0BDBTFnj0Dm+h8qXXC/9URUT5EPKmrlIgsVIDvRShI27mbCIyAH5SML6OIF8D+ACTItdKmALTB9QC+wAC6DJwyMoAQBSAQPRDAvAHjhdxyMsAFMsHEssHWM8BWM8WQBOAQPRDAeIBII6KEEUQNEMA2zztVJJfBuIqABzIyx/LB8sHyz/0APQAyQ==");class zd{constructor(t,n,r,a,o){this.provider=null,this.owners=mt.Dictionary.empty(),this.workchain=n,this.walletId=r,this.k=a;for(let i=0;i0;){const o=r.readTuple(),i=o.readNumber(),s=o.readNumber();o.pop();const l=o.readNumber();a.push({id:i,unfreezeAt:s,stakeHeld:l})}return a}async getPastElections(t){const n=await t.get("past_elections",[]),r=new Ut.TupleReader(n.stack.readLispList()),a=[];for(;r.remaining>0;){const o=r.readTuple(),i=o.readNumber(),s=o.readNumber(),l=o.readNumber();o.pop();const u=o.readCell(),c=o.readBigNumber(),d=o.readBigNumber();let b=new Map;const m=u.beginParse().loadDictDirect(Ut.Dictionary.Keys.Buffer(32),zT);for(const[p,f]of m)b.set(BigInt("0x"+p.toString("hex")).toString(10),{address:f.address,weight:f.weight,stake:f.stake});a.push({id:i,unfreezeAt:s,stakeHeld:l,totalStake:c,bonuses:d,frozen:b})}return a}async getElectionEntities(t){const n=await t.getState();if(n.state.type!=="active")throw Error("Unexpected error");const a=Ut.Cell.fromBoc(n.state.data)[0].beginParse();if(!a.loadBit())return null;const o=a.loadRef().beginParse(),i=o.loadUint(32),s=o.loadUint(32),l=o.loadCoins(),u=o.loadCoins(),c=o.loadDict(Ut.Dictionary.Keys.Buffer(32),DT);let d=[];if(c)for(const[b,m]of c)d.push({pubkey:b,stake:m.stake,address:m.address,adnl:m.adnl});return{minStake:l,allStakes:u,endElectionsTime:s,startWorkTime:i,entities:d}}async getActiveElectionId(t){const r=(await t.get("active_election_id",[])).stack.readNumber();return r>0?r:null}async getComplaints(t,n){const r=new Ut.TupleBuilder;r.writeNumber(n);const a=await t.get("list_complaints",r.build());if(a.stack.peek().type==="null")return[];const o=new Ut.TupleReader(a.stack.readLispList()),i=[];for(;o.remaining>0;){const s=o.readTuple(),l=s.readBigNumber(),u=s.readTuple(),c=u.readTuple(),d=Buffer.from(c.readBigNumber().toString(16),"hex");c.readCell();const b=c.readNumber(),m=c.readNumber(),p=new Ut.Address(-1,Buffer.from(c.readBigNumber().toString(16),"hex")),f=c.readBigNumber(),k=c.readBigNumber(),T=c.readBigNumber(),A=[],y=new Ut.TupleReader(u.readLispList());for(;y.remaining>0;)A.push(y.readNumber());const h=u.readBigNumber(),C=u.readBigNumber();i.push({id:l,publicKey:d,createdAt:b,severity:m,paid:f,suggestedFine:k,suggestedFinePart:T,rewardAddress:p,votes:A,remainingWeight:C,vsetId:h})}return i}}ku.ElectorContract=Dd;var fe={};Object.defineProperty(fe,"__esModule",{value:!0});fe.parseFullConfig=fe.loadConfigParamsAsSlice=fe.loadConfigParamById=fe.parseVotingSetup=fe.parseProposalSetup=fe.configParse29=fe.configParse28=fe.configParseMsgPrices=fe.configParseGasLimitsPrices=fe.configParseBridge=fe.configParseValidatorSet=fe.configParse12=fe.configParseWorkchainDescriptor=fe.configParse40=fe.configParse8=fe.configParse18=fe.configParse17=fe.configParse16=fe.configParse15=fe.configParse13=fe.configParse5=fe.configParseMasterAddressRequired=fe.parseBridge=fe.parseValidatorSet=fe.configParseMasterAddress=void 0;const At=de;function Ni(e){return e?new At.Address(-1,e.loadBuffer(32)):null}fe.configParseMasterAddress=Ni;function Eh(e){if(e.loadUint(32)!==2390828938)throw Error("Invalid config");return e.loadBuffer(32)}const Ah={serialize(e,t){throw Error("not implemented")},parse(e){const t=e.loadUint(8);if(t===83)return{publicKey:Eh(e),weight:e.loadUintBig(64),adnlAddress:null};if(t===115)return{publicKey:Eh(e),weight:e.loadUintBig(64),adnlAddress:e.loadBuffer(32)};throw Error("Invalid config")}};function Vy(e){const t=e.loadUint(8);if(t===17){const n=e.loadUint(32),r=e.loadUint(32),a=e.loadUint(16),o=e.loadUint(16),i=e.loadDictDirect(At.Dictionary.Keys.Uint(16),Ah);return{timeSince:n,timeUntil:r,total:a,main:o,totalWeight:null,list:i}}else if(t===18){const n=e.loadUint(32),r=e.loadUint(32),a=e.loadUint(16),o=e.loadUint(16),i=e.loadUintBig(64),s=e.loadDict(At.Dictionary.Keys.Uint(16),Ah);return{timeSince:n,timeUntil:r,total:a,main:o,totalWeight:i,list:s}}}fe.parseValidatorSet=Vy;function Jy(e){const t=new At.Address(-1,e.loadBuffer(32)),n=new At.Address(-1,e.loadBuffer(32)),r=e.loadDict(At.Dictionary.Keys.Buffer(32),At.Dictionary.Values.Buffer(32)),a=new Map;for(const[i,s]of r)a.set(new At.Address(-1,i).toString(),s);const o=e.loadBuffer(32);return{bridgeAddress:t,oracleMultisigAddress:n,oracles:a,externalChainAddress:o}}fe.parseBridge=Jy;function Fc(e){if(!e)throw Error("Invalid config");return Ni(e)}fe.configParseMasterAddressRequired=Fc;function Ky(e){if(!e)throw Error("Invalid config");if(e.loadUint(8)===1){const n=e.loadBit()?new At.Address(-1,e.loadBuffer(32)):null,r=e.loadUint(32),a=e.loadUint(32);return{blackholeAddr:n,feeBurnNominator:r,feeBurnDenominator:a}}throw new Error("Invalid config")}fe.configParse5=Ky;function UT(e){if(!e)throw Error("Invalid config");if(e.loadUint(8)===26){const n=e.loadCoins(),r=e.loadCoins(),a=e.loadCoins();return{deposit:n,bitPrice:r,cellPrice:a}}throw new Error("Invalid config")}fe.configParse13=UT;function Gy(e){if(!e)throw Error("Invalid config");const t=e.loadUint(32),n=e.loadUint(32),r=e.loadUint(32),a=e.loadUint(32);return{validatorsElectedFor:t,electorsStartBefore:n,electorsEndBefore:r,stakeHeldFor:a}}fe.configParse15=Gy;function Yy(e){if(!e)throw Error("Invalid config");const t=e.loadUint(16),n=e.loadUint(16),r=e.loadUint(16);return{maxValidators:t,maxMainValidators:n,minValidators:r}}fe.configParse16=Yy;function Qy(e){if(!e)throw Error("Invalid config");const t=e.loadCoins(),n=e.loadCoins(),r=e.loadCoins(),a=e.loadUint(32);return{minStake:t,maxStake:n,minTotalStake:r,maxStakeFactor:a}}fe.configParse17=Qy;const FT={serialize(e,t){throw Error("not implemented")},parse(e){if(e.loadUint(8)!==204)throw Error("Invalid config");const n=e.loadUint(32),r=e.loadUintBig(64),a=e.loadUintBig(64),o=e.loadUintBig(64),i=e.loadUintBig(64);return{utime_since:n,bit_price_ps:r,cell_price_ps:a,mc_bit_price_ps:o,mc_cell_price_ps:i}}};function Zy(e){if(!e)throw Error("Invalid config");return e.loadDictDirect(At.Dictionary.Keys.Buffer(4),FT).values()}fe.configParse18=Zy;function Xy(e){if(!e)return{version:0,capabilities:0n};const t=e.loadUint(32),n=e.loadUintBig(64);return{version:t,capabilities:n}}fe.configParse8=Xy;function eb(e){if(!e)return null;if(e.loadUint(8)!==1)throw Error("Invalid config");const n=e.loadCoins(),r=e.loadCoins(),a=e.loadUint(16),o=e.loadUint(16),i=e.loadUint(16),s=e.loadUint(16),l=e.loadUint(16),u=e.loadUint(16),c=e.loadUint(16),d=e.loadUint(16),b=e.loadUint(16);return{defaultFlatFine:n,defaultProportionaFine:r,severityFlatMult:a,severityProportionalMult:o,unfunishableInterval:i,longInterval:s,longFlatMult:l,longProportionalMult:u,mediumInterval:c,mediumFlatMult:d,mediumProportionalMult:b}}fe.configParse40=eb;function LT(e){if(e.loadUint(8)!==166)throw Error("Invalid config");const t=e.loadUint(32),n=e.loadUint(8),r=e.loadUint(8),a=e.loadUint(8),o=e.loadBit(),i=e.loadBit(),s=e.loadBit(),l=e.loadUint(13),u=e.loadBuffer(32),c=e.loadBuffer(32),d=e.loadUint(32);if(e.loadBit())throw Error("Invalid config");const b=e.loadUint(32),m=e.loadUintBig(64);return{enabledSince:t,actialMinSplit:n,min_split:r,max_split:a,basic:o,active:i,accept_msgs:s,flags:l,zerostateRootHash:u,zerostateFileHash:c,version:d,format:{vmVersion:b,vmMode:m}}}fe.configParseWorkchainDescriptor=LT;const qT={serialize(e,t){throw Error("not implemented")},parse(e){if(e.loadUint(8)!==166)throw Error("Invalid config");const t=e.loadUint(32),n=e.loadUint(8),r=e.loadUint(8),a=e.loadUint(8),o=e.loadBit(),i=e.loadBit(),s=e.loadBit(),l=e.loadUint(13),u=e.loadBuffer(32),c=e.loadBuffer(32),d=e.loadUint(32);if(e.loadBit())throw Error("Invalid config");const b=e.loadUint(32),m=e.loadUintBig(64);return{enabledSince:t,actialMinSplit:n,min_split:r,max_split:a,basic:o,active:i,accept_msgs:s,flags:l,zerostateRootHash:u,zerostateFileHash:c,version:d,format:{vmVersion:b,vmMode:m}}}};function tb(e){if(!e)throw Error("Invalid config");const t=e.loadDict(At.Dictionary.Keys.Uint(32),qT);if(t)return t;throw Error("No workchains exist")}fe.configParse12=tb;function ea(e){return e?Vy(e):null}fe.configParseValidatorSet=ea;function Js(e){return e?Jy(e):null}fe.configParseBridge=Js;function $T(e){const t=e.loadUint(8);if(t===222){const n=e.loadUintBig(64),r=e.loadUintBig(64),a=e.loadUintBig(64),o=e.loadUintBig(64),i=e.loadUintBig(64),s=e.loadUintBig(64),l=e.loadUintBig(64);return{gasPrice:n,gasLimit:r,specialGasLimit:a,gasCredit:o,blockGasLimit:i,freezeDueLimit:s,deleteDueLimit:l}}else if(t===221){const n=e.loadUintBig(64),r=e.loadUintBig(64),a=e.loadUintBig(64),o=e.loadUintBig(64),i=e.loadUintBig(64),s=e.loadUintBig(64);return{gasPrice:n,gasLimit:r,gasCredit:a,blockGasLimit:o,freezeDueLimit:i,deleteDueLimit:s}}else throw Error("Invalid config")}function Lc(e){if(!e)throw Error("Invalid config");if(e.loadUint(8)===209){const n=e.loadUintBig(64),r=e.loadUintBig(64),a=$T(e);return{flatLimit:n,flatGasPrice:r,other:a}}else throw Error("Invalid config")}fe.configParseGasLimitsPrices=Lc;function qc(e){if(!e)throw new Error("Invalid config");if(e.loadUint(8)!==234)throw new Error("Invalid msg prices param");return{lumpPrice:e.loadUintBig(64),bitPrice:e.loadUintBig(64),cellPrice:e.loadUintBig(64),ihrPriceFactor:e.loadUint(32),firstFrac:e.loadUint(16),nextFrac:e.loadUint(16)}}fe.configParseMsgPrices=qc;function nb(e){if(!e)throw new Error("Invalid config");const t=e.loadUint(8);if(t===193){const n=e.loadUint(32),r=e.loadUint(32),a=e.loadUint(32),o=e.loadUint(32);return{masterCatchainLifetime:n,shardCatchainLifetime:r,shardValidatorsLifetime:a,shardValidatorsCount:o}}if(t===194){const n=e.loadUint(7),r=e.loadBit(),a=e.loadUint(32),o=e.loadUint(32),i=e.loadUint(32),s=e.loadUint(32);return{flags:n,suffleMasterValidators:r,masterCatchainLifetime:a,shardCatchainLifetime:o,shardValidatorsLifetime:i,shardValidatorsCount:s}}throw new Error("Invalid config")}fe.configParse28=nb;function rb(e){if(!e)throw new Error("Invalid config");const t=e.loadUint(8);if(t===214){const n=e.loadUint(32),r=e.loadUint(32),a=e.loadUint(32),o=e.loadUint(32),i=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32);return{roundCandidates:n,nextCandidateDelay:r,consensusTimeout:a,fastAttempts:o,attemptDuration:i,catchainMaxDeps:s,maxBlockBytes:l,maxColaltedBytes:u}}else if(t===215){const n=e.loadUint(7),r=e.loadBit(),a=e.loadUint(8),o=e.loadUint(32),i=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32),c=e.loadUint(32),d=e.loadUint(32);return{flags:n,newCatchainIds:r,roundCandidates:a,nextCandidateDelay:o,consensusTimeout:i,fastAttempts:s,attemptDuration:l,catchainMaxDeps:u,maxBlockBytes:c,maxColaltedBytes:d}}else if(t===216){const n=e.loadUint(7),r=e.loadBit(),a=e.loadUint(8),o=e.loadUint(32),i=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32),c=e.loadUint(32),d=e.loadUint(32),b=e.loadUint(16);return{flags:n,newCatchainIds:r,roundCandidates:a,nextCandidateDelay:o,consensusTimeout:i,fastAttempts:s,attemptDuration:l,catchainMaxDeps:u,maxBlockBytes:c,maxColaltedBytes:d,protoVersion:b}}else if(t===217){const n=e.loadUint(7),r=e.loadBit(),a=e.loadUint(8),o=e.loadUint(32),i=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32),c=e.loadUint(32),d=e.loadUint(32),b=e.loadUint(16),m=e.loadUint(32);return{flags:n,newCatchainIds:r,roundCandidates:a,nextCandidateDelay:o,consensusTimeout:i,fastAttempts:s,attemptDuration:l,catchainMaxDeps:u,maxBlockBytes:c,maxColaltedBytes:d,protoVersion:b,catchainMaxBlocksCoeff:m}}throw new Error("Invalid config")}fe.configParse29=rb;function $c(e){if(e.loadUint(8)!==54)throw new Error("Invalid config");const n=e.loadUint(8),r=e.loadUint(8),a=e.loadUint(8),o=e.loadUint(8),i=e.loadUint(32),s=e.loadUint(32),l=e.loadUint(32),u=e.loadUint(32);return{minTotalRounds:n,maxTotalRounds:r,minWins:a,maxLoses:o,minStoreSec:i,maxStoreSec:s,bitPrice:l,cellPrice:u}}fe.parseProposalSetup=$c;function ab(e){if(!e)throw new Error("Invalid config");if(e.loadUint(8)!==145)throw new Error("Invalid config");const n=$c(e.loadRef().beginParse()),r=$c(e.loadRef().beginParse());return{normalParams:n,criticalParams:r}}fe.parseVotingSetup=ab;function ob(e){return At.Cell.fromBase64(e).beginParse().loadDictDirect(At.Dictionary.Keys.Int(32),At.Dictionary.Values.Cell())}function WT(e,t){return ob(e).get(t)}fe.loadConfigParamById=WT;function HT(e){const t=ob(e),n=new Map;for(const[r,a]of t)n.set(r,a.beginParse());return n}fe.loadConfigParamsAsSlice=HT;function VT(e){return{configAddress:Fc(e.get(0)),electorAddress:Fc(e.get(1)),minterAddress:Ni(e.get(2)),feeCollectorAddress:Ni(e.get(3)),dnsRootAddress:Ni(e.get(4)),burningConfig:Ky(e.get(5)),globalVersion:Xy(e.get(8)),workchains:tb(e.get(12)),voting:ab(e.get(11)),validators:{...Gy(e.get(15)),...Yy(e.get(16)),...Qy(e.get(17))},storagePrices:Zy(e.get(18)),gasPrices:{masterchain:Lc(e.get(20)),workchain:Lc(e.get(21))},msgPrices:{masterchain:qc(e.get(24)),workchain:qc(e.get(25))},validatorSets:{prevValidators:ea(e.get(32)),prevTempValidators:ea(e.get(33)),currentValidators:ea(e.get(34)),currentTempValidators:ea(e.get(35)),nextValidators:ea(e.get(36)),nextTempValidators:ea(e.get(37))},validatorsPunish:eb(e.get(40)),bridges:{ethereum:Js(e.get(71)),binance:Js(e.get(72)),polygon:Js(e.get(73))},catchain:nb(e.get(28)),consensus:rb(e.get(29))}}fe.parseFullConfig=VT;var Ft={};Object.defineProperty(Ft,"__esModule",{value:!0});Ft.computeMessageForwardFees=Ft.computeExternalMessageFees=Ft.computeGasPrices=Ft.computeFwdFees=Ft.computeStorageFees=void 0;const nc=de;function JT(e){const{lastPaid:t,now:n,storagePrices:r,storageStat:a,special:o,masterchain:i}=e;if(n<=t||r.length===0||n>16n)}Ft.computeGasPrices=KT;function GT(e,t){let n=hl(t);return n.bits-=t.bits.length,n.cells-=1,Ud(e,BigInt(n.cells),BigInt(n.bits))}Ft.computeExternalMessageFees=GT;function YT(e,t){let n=(0,nc.loadMessageRelaxed)(t.beginParse()),r={bits:0,cells:0};if(n.init){const l=new nc.Cell().asBuilder();(0,nc.storeStateInit)(n.init)(l);const u=l.endCell();let c=hl(u);c.bits-=u.bits.length,c.cells-=1,r.bits+=c.bits,r.cells+=c.cells}let a=hl(n.body);a.bits-=n.body.bits.length,a.cells-=1,r.bits+=a.bits,r.cells+=a.cells;let o=Ud(e,BigInt(r.cells),BigInt(r.bits)),i=o*BigInt(e.firstFrac)>>16n,s=o-i;return{fees:i,remaining:s}}Ft.computeMessageForwardFees=YT;function hl(e){let t=e.bits.length,n=1;for(let r of e.refs){let a=hl(r);n+=a.cells,t+=a.bits}return{bits:t,cells:n}}function ib(e){let t=e%65536n,n=e>>16n;return t!==0n&&(n+=1n),n}(function(e){var t=re&&re.__createBinding||(Object.create?function(H,L,G,ee){ee===void 0&&(ee=G);var ce=Object.getOwnPropertyDescriptor(L,G);(!ce||("get"in ce?!L.__esModule:ce.writable||ce.configurable))&&(ce={enumerable:!0,get:function(){return L[G]}}),Object.defineProperty(H,ee,ce)}:function(H,L,G,ee){ee===void 0&&(ee=G),H[ee]=L[G]}),n=re&&re.__exportStar||function(H,L){for(var G in H)G!=="default"&&!Object.prototype.hasOwnProperty.call(L,G)&&t(L,H,G)};Object.defineProperty(e,"__esModule",{value:!0}),e.computeStorageFees=e.computeMessageForwardFees=e.computeGasPrices=e.computeFwdFees=e.computeExternalMessageFees=e.loadConfigParamsAsSlice=e.loadConfigParamById=e.parseFullConfig=e.parseVotingSetup=e.parseValidatorSet=e.parseProposalSetup=e.parseBridge=e.configParseWorkchainDescriptor=e.configParseValidatorSet=e.configParseMsgPrices=e.configParseMasterAddressRequired=e.configParseMasterAddress=e.configParseGasLimitsPrices=e.configParseBridge=e.configParse40=e.configParse29=e.configParse28=e.configParse18=e.configParse17=e.configParse16=e.configParse15=e.configParse13=e.configParse12=e.configParse8=e.configParse5=e.ElectorContract=e.MultisigWallet=e.MultisigOrderBuilder=e.MultisigOrder=e.JettonWallet=e.JettonMaster=e.WalletContractV5R1=e.WalletContractV5Beta=e.WalletContractV4=e.WalletContractV3R2=e.WalletContractV3R1=e.WalletContractV2R2=e.WalletContractV2R1=e.WalletContractV1R3=e.WalletContractV1R2=e.WalletContractV1R1=e.TonClient4=e.TonClient=e.HttpApi=void 0,n(de,e);var r=us;Object.defineProperty(e,"HttpApi",{enumerable:!0,get:function(){return r.HttpApi}});var a=ru;Object.defineProperty(e,"TonClient",{enumerable:!0,get:function(){return a.TonClient}});var o=au;Object.defineProperty(e,"TonClient4",{enumerable:!0,get:function(){return o.TonClient4}});var i=iu;Object.defineProperty(e,"WalletContractV1R1",{enumerable:!0,get:function(){return i.WalletContractV1R1}});var s=lu;Object.defineProperty(e,"WalletContractV1R2",{enumerable:!0,get:function(){return s.WalletContractV1R2}});var l=uu;Object.defineProperty(e,"WalletContractV1R3",{enumerable:!0,get:function(){return l.WalletContractV1R3}});var u=cu;Object.defineProperty(e,"WalletContractV2R1",{enumerable:!0,get:function(){return u.WalletContractV2R1}});var c=du;Object.defineProperty(e,"WalletContractV2R2",{enumerable:!0,get:function(){return c.WalletContractV2R2}});var d=fu;Object.defineProperty(e,"WalletContractV3R1",{enumerable:!0,get:function(){return d.WalletContractV3R1}});var b=hu;Object.defineProperty(e,"WalletContractV3R2",{enumerable:!0,get:function(){return b.WalletContractV3R2}});var m=mu;Object.defineProperty(e,"WalletContractV4",{enumerable:!0,get:function(){return m.WalletContractV4}});var p=$y;Object.defineProperty(e,"WalletContractV5Beta",{enumerable:!0,get:function(){return p.WalletContractV5Beta}});var f=Wy;Object.defineProperty(e,"WalletContractV5R1",{enumerable:!0,get:function(){return f.WalletContractV5R1}});var k=pu;Object.defineProperty(e,"JettonMaster",{enumerable:!0,get:function(){return k.JettonMaster}});var T=gu;Object.defineProperty(e,"JettonWallet",{enumerable:!0,get:function(){return T.JettonWallet}});var A=fs;Object.defineProperty(e,"MultisigOrder",{enumerable:!0,get:function(){return A.MultisigOrder}});var y=yu;Object.defineProperty(e,"MultisigOrderBuilder",{enumerable:!0,get:function(){return y.MultisigOrderBuilder}});var h=bu;Object.defineProperty(e,"MultisigWallet",{enumerable:!0,get:function(){return h.MultisigWallet}});var C=ku;Object.defineProperty(e,"ElectorContract",{enumerable:!0,get:function(){return C.ElectorContract}});var _=fe;Object.defineProperty(e,"configParse5",{enumerable:!0,get:function(){return _.configParse5}}),Object.defineProperty(e,"configParse8",{enumerable:!0,get:function(){return _.configParse8}}),Object.defineProperty(e,"configParse12",{enumerable:!0,get:function(){return _.configParse12}}),Object.defineProperty(e,"configParse13",{enumerable:!0,get:function(){return _.configParse13}}),Object.defineProperty(e,"configParse15",{enumerable:!0,get:function(){return _.configParse15}}),Object.defineProperty(e,"configParse16",{enumerable:!0,get:function(){return _.configParse16}}),Object.defineProperty(e,"configParse17",{enumerable:!0,get:function(){return _.configParse17}}),Object.defineProperty(e,"configParse18",{enumerable:!0,get:function(){return _.configParse18}}),Object.defineProperty(e,"configParse28",{enumerable:!0,get:function(){return _.configParse28}}),Object.defineProperty(e,"configParse29",{enumerable:!0,get:function(){return _.configParse29}}),Object.defineProperty(e,"configParse40",{enumerable:!0,get:function(){return _.configParse40}}),Object.defineProperty(e,"configParseBridge",{enumerable:!0,get:function(){return _.configParseBridge}}),Object.defineProperty(e,"configParseGasLimitsPrices",{enumerable:!0,get:function(){return _.configParseGasLimitsPrices}}),Object.defineProperty(e,"configParseMasterAddress",{enumerable:!0,get:function(){return _.configParseMasterAddress}}),Object.defineProperty(e,"configParseMasterAddressRequired",{enumerable:!0,get:function(){return _.configParseMasterAddressRequired}}),Object.defineProperty(e,"configParseMsgPrices",{enumerable:!0,get:function(){return _.configParseMsgPrices}}),Object.defineProperty(e,"configParseValidatorSet",{enumerable:!0,get:function(){return _.configParseValidatorSet}}),Object.defineProperty(e,"configParseWorkchainDescriptor",{enumerable:!0,get:function(){return _.configParseWorkchainDescriptor}}),Object.defineProperty(e,"parseBridge",{enumerable:!0,get:function(){return _.parseBridge}}),Object.defineProperty(e,"parseProposalSetup",{enumerable:!0,get:function(){return _.parseProposalSetup}}),Object.defineProperty(e,"parseValidatorSet",{enumerable:!0,get:function(){return _.parseValidatorSet}}),Object.defineProperty(e,"parseVotingSetup",{enumerable:!0,get:function(){return _.parseVotingSetup}}),Object.defineProperty(e,"parseFullConfig",{enumerable:!0,get:function(){return _.parseFullConfig}}),Object.defineProperty(e,"loadConfigParamById",{enumerable:!0,get:function(){return _.loadConfigParamById}}),Object.defineProperty(e,"loadConfigParamsAsSlice",{enumerable:!0,get:function(){return _.loadConfigParamsAsSlice}});var x=Ft;Object.defineProperty(e,"computeExternalMessageFees",{enumerable:!0,get:function(){return x.computeExternalMessageFees}}),Object.defineProperty(e,"computeFwdFees",{enumerable:!0,get:function(){return x.computeFwdFees}}),Object.defineProperty(e,"computeGasPrices",{enumerable:!0,get:function(){return x.computeGasPrices}}),Object.defineProperty(e,"computeMessageForwardFees",{enumerable:!0,get:function(){return x.computeMessageForwardFees}}),Object.defineProperty(e,"computeStorageFees",{enumerable:!0,get:function(){return x.computeStorageFees}})})(Ue);class wu{constructor(t){Ae(this,"client");this.client=t}static create(t){return t===Li.MAINNET&&(t=new Ue.TonClient4({endpoint:"https://mainnet-v4.tonhubapi.com"})),t===Li.TESTNET&&(t=new Ue.TonClient4({endpoint:"https://testnet-v4.tonhubapi.com"})),new wu(t)}async getWalletPublicKey(t){const n=await this.client.getLastBlock(),r=await this.client.runMethod(n.last.seqno,Ue.Address.parse(t),"get_public_key",[]);return Xe.Buffer.from(r.reader.readBigNumber().toString(16).padStart(64,"0"),"hex")}async getAccountInfo(t){const n=await this.client.getLastBlock();return await this.client.getAccount(n.last.seqno,Ue.Address.parse(t))}}var Sh=Wt();class QT{static create(t){const n=Ue.WalletContractV4.create(t),{data:r}=n.init,a=Ue.Cell.fromBoc(Xe.Buffer.from("B5EE9C72410215010002F5000114FF00F4A413F4BCF2C80B010201200203020148040504F8F28308D71820D31FD31FD31F02F823BBF263ED44D0D31FD31FD3FFF404D15143BAF2A15151BAF2A205F901541064F910F2A3F80024A4C8CB1F5240CB1F5230CBFF5210F400C9ED54F80F01D30721C0009F6C519320D74A96D307D402FB00E830E021C001E30021C002E30001C0039130E30D03A4C8CB1F12CB1FCBFF1112131403EED001D0D3030171B0915BE021D749C120915BE001D31F218210706C7567BD228210626C6E63BDB022821064737472BDB0925F03E002FA403020FA4401C8CA07CBFFC9D0ED44D0810140D721F404305C810108F40A6FA131B3925F05E004D33FC8258210706C7567BA9131E30D248210626C6E63BAE30004060708020120090A005001FA00F404308210706C7567831EB17080185005CB0527CF165003FA02F40012CB69CB1F5210CB3F0052F8276F228210626C6E63831EB17080185005CB0527CF1624FA0214CB6A13CB1F5230CB3F01FA02F4000092821064737472BA8E3504810108F45930ED44D0810140D720C801CF16F400C9ED54821064737472831EB17080185004CB0558CF1622FA0212CB6ACB1FCB3F9410345F04E2C98040FB000201200B0C0059BD242B6F6A2684080A06B90FA0218470D4080847A4937D29910CE6903E9FF9837812801B7810148987159F31840201580D0E0011B8C97ED44D0D70B1F8003DB29DFB513420405035C87D010C00B23281F2FFF274006040423D029BE84C600201200F100019ADCE76A26840206B90EB85FFC00019AF1DF6A26840106B90EB858FC0006ED207FA00D4D422F90005C8CA0715CBFFC9D077748018C8CB05CB0222CF165005FA0214CB6B12CCCCC971FB00C84014810108F451F2A702006C810108D718C8542025810108F451F2A782106E6F746570748018C8CB05CB025004CF16821005F5E100FA0213CB6A12CB1FC971FB00020072810108D718305202810108F459F2A7F82582106473747270748018C8CB05CB025005CF16821005F5E100FA0214CB6A13CB1F12CB3FC973FB00000AF400C9ED5446A9F34F","hex"))[0];return n.init={data:r,code:a},n.address=Ue.contractAddress(t.workchain,n.init),n}}const ZT=[{contract:Ue.WalletContractV1R1,loadData:rc},{contract:Ue.WalletContractV1R2,loadData:rc},{contract:Ue.WalletContractV1R3,loadData:rc},{contract:Ue.WalletContractV2R1,loadData:Th},{contract:Ue.WalletContractV2R2,loadData:Th},{contract:Ue.WalletContractV3R1,loadData:Ph},{contract:Ue.WalletContractV3R2,loadData:Ph},{contract:QT,loadData:Bh},{contract:Ue.WalletContractV4,loadData:Bh},{contract:Ue.WalletContractV5Beta,loadData:XT},{contract:Ue.WalletContractV5R1,loadData:eP}].map(({contract:e,loadData:t})=>({contract:e,loadData:t,wallet:e.create({workchain:0,publicKey:Xe.Buffer.alloc(32)})}));function rc(e){const t=e.loadUint(32),n=e.loadBuffer(32);return{seqno:t,publicKey:n}}function Th(e){const t=e.loadUint(32),n=e.loadBuffer(32);return{seqno:t,publicKey:n}}function Ph(e){const t=e.loadUint(32),n=e.loadUint(32),r=e.loadBuffer(32);return{seqno:t,publicKey:r,walletId:n}}function Bh(e){const t=e.loadUint(32),n=e.loadUint(32),r=e.loadBuffer(32),a=e.loadMaybeRef();return{seqno:t,publicKey:r,walletId:n,plugins:a}}function XT(e){const t=e.loadBoolean(),n=e.loadUint(32),r=e.loadUintBig(80),a=e.loadBuffer(32),o=e.loadMaybeRef();return{isSignatureAuthAllowed:t,seqno:n,publicKey:a,walletId:r,plugins:o}}function eP(e){const t=e.loadBoolean(),n=e.loadUint(32),r=e.loadUint(32),a=e.loadBuffer(32),o=e.loadMaybeRef();return{isSignatureAuthAllowed:t,seqno:n,publicKey:a,walletId:r,plugins:o}}function tP(e){if(!e.code||!e.data)return null;for(const{wallet:t,loadData:n}of ZT)try{if(t.init.code.equals(e.code))return n(e.data.beginParse()).publicKey}catch{}return null}const nP="ton-proof-item-v2/",rP="ton-connect",aP=["ton-connect.github.io","localhost:5173"],oP=15*60;class sb{generatePayload(){return Xe.Buffer.from(Ks.randomBytes(32)).toString("hex")}async checkProof(t,n){try{const r=Ue.loadStateInit(Ue.Cell.fromBase64(t.proof.state_init).beginParse());let a=tP(r)??await n(t.address);if(!a)return!1;const o=Xe.Buffer.from(t.public_key,"hex");if(!a.equals(o))return!1;const i=Ue.Address.parse(t.address),s=Ue.contractAddress(i.workChain,r);if(!s.equals(i)||!aP.includes(t.proof.domain.value)||Math.floor(Date.now()/1e3)-oP>t.proof.timestamp)return!1;const u={workchain:s.workChain,address:s.hash,domain:{lengthBytes:t.proof.domain.lengthBytes,value:t.proof.domain.value},signature:Xe.Buffer.from(t.proof.signature,"base64"),payload:t.proof.payload,stateInit:t.proof.state_init,timestamp:t.proof.timestamp},c=Xe.Buffer.alloc(4);c.writeUInt32BE(u.workchain,0);const d=Xe.Buffer.alloc(8);d.writeBigUInt64LE(BigInt(u.timestamp),0);const b=Xe.Buffer.alloc(4);b.writeUInt32LE(u.domain.lengthBytes,0);const m=Xe.Buffer.concat([Xe.Buffer.from(nP),c,u.address,b,Xe.Buffer.from(u.domain.value),d,Xe.Buffer.from(u.payload)]),p=Xe.Buffer.from(await Sh.sha256(m)),f=Xe.Buffer.concat([Xe.Buffer.from([255,255]),Xe.Buffer.from(rP),p]),k=Xe.Buffer.from(await Sh.sha256(f));return Ks.sign.detached.verify(k,u.signature,a)}catch{return!1}}}function hs(e){return cn.json(e,{status:200,statusText:"OK"})}function vr(e){return cn.json(e,{status:400,statusText:"Bad Request"})}function ml(e){return cn.json(e,{status:401,statusText:"Unauthorized"})}const vu=crypto,lb=e=>e instanceof CryptoKey,hn=new TextEncoder,Na=new TextDecoder;function ub(...e){const t=e.reduce((a,{length:o})=>a+o,0),n=new Uint8Array(t);let r=0;for(const a of e)n.set(a,r),r+=a.length;return n}const iP=e=>{let t=e;typeof t=="string"&&(t=hn.encode(t));const n=32768,r=[];for(let a=0;aiP(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),sP=e=>{const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r{let t=e;t instanceof Uint8Array&&(t=Na.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return sP(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}};class kt extends Error{constructor(t,n){var r;super(t,n),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,(r=Error.captureStackTrace)==null||r.call(Error,this,this.constructor)}}kt.code="ERR_JOSE_GENERIC";class Vt extends kt{constructor(t,n,r="unspecified",a="unspecified"){super(t,{cause:{claim:r,reason:a,payload:n}}),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=r,this.reason=a,this.payload=n}}Vt.code="ERR_JWT_CLAIM_VALIDATION_FAILED";class Wc extends kt{constructor(t,n,r="unspecified",a="unspecified"){super(t,{cause:{claim:r,reason:a,payload:n}}),this.code="ERR_JWT_EXPIRED",this.claim=r,this.reason=a,this.payload=n}}Wc.code="ERR_JWT_EXPIRED";class cb extends kt{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}}cb.code="ERR_JOSE_ALG_NOT_ALLOWED";class Bn extends kt{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}}Bn.code="ERR_JOSE_NOT_SUPPORTED";class lP extends kt{constructor(t="decryption operation failed",n){super(t,n),this.code="ERR_JWE_DECRYPTION_FAILED"}}lP.code="ERR_JWE_DECRYPTION_FAILED";class uP extends kt{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}}uP.code="ERR_JWE_INVALID";class $e extends kt{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}}$e.code="ERR_JWS_INVALID";class Jt extends kt{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}}Jt.code="ERR_JWT_INVALID";class cP extends kt{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}}cP.code="ERR_JWK_INVALID";class dP extends kt{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}}dP.code="ERR_JWKS_INVALID";class fP extends kt{constructor(t="no applicable key found in the JSON Web Key Set",n){super(t,n),this.code="ERR_JWKS_NO_MATCHING_KEY"}}fP.code="ERR_JWKS_NO_MATCHING_KEY";class hP extends kt{constructor(t="multiple matching keys found in the JSON Web Key Set",n){super(t,n),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS"}}hP.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";class mP extends kt{constructor(t="request timed out",n){super(t,n),this.code="ERR_JWKS_TIMEOUT"}}mP.code="ERR_JWKS_TIMEOUT";class db extends kt{constructor(t="signature verification failed",n){super(t,n),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}db.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";function An(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function Is(e,t){return e.name===t}function oc(e){return parseInt(e.name.slice(4),10)}function pP(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function gP(e,t){if(t.length&&!t.some(n=>e.usages.includes(n))){let n="CryptoKey does not support this operation, its usages must include ";if(t.length>2){const r=t.pop();n+=`one of ${t.join(", ")}, or ${r}.`}else t.length===2?n+=`one of ${t[0]} or ${t[1]}.`:n+=`${t[0]}.`;throw new TypeError(n)}}function yP(e,t,...n){switch(t){case"HS256":case"HS384":case"HS512":{if(!Is(e.algorithm,"HMAC"))throw An("HMAC");const r=parseInt(t.slice(2),10);if(oc(e.algorithm.hash)!==r)throw An(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!Is(e.algorithm,"RSASSA-PKCS1-v1_5"))throw An("RSASSA-PKCS1-v1_5");const r=parseInt(t.slice(2),10);if(oc(e.algorithm.hash)!==r)throw An(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!Is(e.algorithm,"RSA-PSS"))throw An("RSA-PSS");const r=parseInt(t.slice(2),10);if(oc(e.algorithm.hash)!==r)throw An(`SHA-${r}`,"algorithm.hash");break}case"EdDSA":{if(e.algorithm.name!=="Ed25519"&&e.algorithm.name!=="Ed448")throw An("Ed25519 or Ed448");break}case"ES256":case"ES384":case"ES512":{if(!Is(e.algorithm,"ECDSA"))throw An("ECDSA");const r=pP(t);if(e.algorithm.namedCurve!==r)throw An(r,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}gP(e,n)}function fb(e,t,...n){var r;if(n=n.filter(Boolean),n.length>2){const a=n.pop();e+=`one of type ${n.join(", ")}, or ${a}.`}else n.length===2?e+=`one of type ${n[0]} or ${n[1]}.`:e+=`of type ${n[0]}.`;return t==null?e+=` Received ${t}`:typeof t=="function"&&t.name?e+=` Received function ${t.name}`:typeof t=="object"&&t!=null&&(r=t.constructor)!=null&&r.name&&(e+=` Received an instance of ${t.constructor.name}`),e}const Mh=(e,...t)=>fb("Key must be ",e,...t);function hb(e,t,...n){return fb(`Key for the ${e} algorithm must be `,t,...n)}const mb=e=>lb(e)?!0:(e==null?void 0:e[Symbol.toStringTag])==="KeyObject",pl=["CryptoKey"],bP=(...e)=>{const t=e.filter(Boolean);if(t.length===0||t.length===1)return!0;let n;for(const r of t){const a=Object.keys(r);if(!n||n.size===0){n=new Set(a);continue}for(const o of a){if(n.has(o))return!1;n.add(o)}}return!0},pb=bP;function kP(e){return typeof e=="object"&&e!==null}function za(e){if(!kP(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}const gb=(e,t)=>{if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:n}=t.algorithm;if(typeof n!="number"||n<2048)throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}};function Vo(e){return za(e)&&typeof e.kty=="string"}function wP(e){return e.kty!=="oct"&&typeof e.d=="string"}function vP(e){return e.kty!=="oct"&&typeof e.d>"u"}function jP(e){return Vo(e)&&e.kty==="oct"&&typeof e.k=="string"}function _P(e){let t,n;switch(e.kty){case"RSA":{switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},n=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},n=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},n=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new Bn('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},n=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},n=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new Bn('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(e.alg){case"EdDSA":t={name:e.crv},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new Bn('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new Bn('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}const CP=async e=>{if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:t,keyUsages:n}=_P(e),r=[t,e.ext??!1,e.key_ops??n],a={...e};return delete a.alg,delete a.use,vu.subtle.importKey("jwk",a,...r)},yb=CP,bb=e=>jr(e);let Ga,Ya;const kb=e=>(e==null?void 0:e[Symbol.toStringTag])==="KeyObject",gl=async(e,t,n,r,a=!1)=>{let o=e.get(t);if(o!=null&&o[r])return o[r];const i=await yb({...n,alg:r});return a&&Object.freeze(t),o?o[r]=i:e.set(t,{[r]:i}),i},EP=(e,t)=>{if(kb(e)){let n=e.export({format:"jwk"});return delete n.d,delete n.dp,delete n.dq,delete n.p,delete n.q,delete n.qi,n.k?bb(n.k):(Ya||(Ya=new WeakMap),gl(Ya,e,n,t))}return Vo(e)?e.k?jr(e.k):(Ya||(Ya=new WeakMap),gl(Ya,e,e,t,!0)):e},AP=(e,t)=>{if(kb(e)){let n=e.export({format:"jwk"});return n.k?bb(n.k):(Ga||(Ga=new WeakMap),gl(Ga,e,n,t))}return Vo(e)?e.k?jr(e.k):(Ga||(Ga=new WeakMap),gl(Ga,e,e,t,!0)):e},xh={normalizePublicKey:EP,normalizePrivateKey:AP};async function SP(e,t){if(!za(e))throw new TypeError("JWK must be an object");switch(t||(t=e.alg),e.kty){case"oct":if(typeof e.k!="string"||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return jr(e.k);case"RSA":if(e.oth!==void 0)throw new Bn('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return yb({...e,alg:t});default:throw new Bn('Unsupported "kty" (Key Type) Parameter value')}}const to=e=>e==null?void 0:e[Symbol.toStringTag],Hc=(e,t,n)=>{var r,a;if(t.use!==void 0&&t.use!=="sig")throw new TypeError("Invalid key for this operation, when present its use must be sig");if(t.key_ops!==void 0&&((a=(r=t.key_ops).includes)==null?void 0:a.call(r,n))!==!0)throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${n}`);if(t.alg!==void 0&&t.alg!==e)throw new TypeError(`Invalid key for this operation, when present its alg must be ${e}`);return!0},TP=(e,t,n,r)=>{if(!(t instanceof Uint8Array)){if(r&&Vo(t)){if(jP(t)&&Hc(e,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!mb(t))throw new TypeError(hb(e,t,...pl,"Uint8Array",r?"JSON Web Key":null));if(t.type!=="secret")throw new TypeError(`${to(t)} instances for symmetric algorithms must be of type "secret"`)}},PP=(e,t,n,r)=>{if(r&&Vo(t))switch(n){case"sign":if(wP(t)&&Hc(e,t,n))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(vP(t)&&Hc(e,t,n))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!mb(t))throw new TypeError(hb(e,t,...pl,r?"JSON Web Key":null));if(t.type==="secret")throw new TypeError(`${to(t)} instances for asymmetric algorithms must not be of type "secret"`);if(n==="sign"&&t.type==="public")throw new TypeError(`${to(t)} instances for asymmetric algorithm signing must be of type "private"`);if(n==="decrypt"&&t.type==="public")throw new TypeError(`${to(t)} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&n==="verify"&&t.type==="private")throw new TypeError(`${to(t)} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&n==="encrypt"&&t.type==="private")throw new TypeError(`${to(t)} instances for asymmetric algorithm encryption must be of type "public"`)};function wb(e,t,n,r){t.startsWith("HS")||t==="dir"||t.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(t)?TP(t,n,r,e):PP(t,n,r,e)}wb.bind(void 0,!1);const Vc=wb.bind(void 0,!0);function vb(e,t,n,r,a){if(a.crit!==void 0&&(r==null?void 0:r.crit)===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||r.crit===void 0)return new Set;if(!Array.isArray(r.crit)||r.crit.length===0||r.crit.some(i=>typeof i!="string"||i.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let o;n!==void 0?o=new Map([...Object.entries(n),...t.entries()]):o=t;for(const i of r.crit){if(!o.has(i))throw new Bn(`Extension Header Parameter "${i}" is not recognized`);if(a[i]===void 0)throw new e(`Extension Header Parameter "${i}" is missing`);if(o.get(i)&&r[i]===void 0)throw new e(`Extension Header Parameter "${i}" MUST be integrity protected`)}return new Set(r.crit)}const BP=(e,t)=>{if(t!==void 0&&(!Array.isArray(t)||t.some(n=>typeof n!="string")))throw new TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)},MP=BP;function jb(e,t){const n=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:e.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"EdDSA":return{name:t.name};default:throw new Bn(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}async function _b(e,t,n){if(n==="sign"&&(t=await xh.normalizePrivateKey(t,e)),n==="verify"&&(t=await xh.normalizePublicKey(t,e)),lb(t))return yP(t,e,n),t;if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(Mh(t,...pl));return vu.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[n])}throw new TypeError(Mh(t,...pl,"Uint8Array","JSON Web Key"))}const xP=async(e,t,n,r)=>{const a=await _b(e,t,"verify");gb(e,a);const o=jb(e,a.algorithm);try{return await vu.subtle.verify(o,a,n,r)}catch{return!1}},OP=xP;async function IP(e,t,n){if(!za(e))throw new $e("Flattened JWS must be an object");if(e.protected===void 0&&e.header===void 0)throw new $e('Flattened JWS must have either of the "protected" or "header" members');if(e.protected!==void 0&&typeof e.protected!="string")throw new $e("JWS Protected Header incorrect type");if(e.payload===void 0)throw new $e("JWS Payload missing");if(typeof e.signature!="string")throw new $e("JWS Signature missing or incorrect type");if(e.header!==void 0&&!za(e.header))throw new $e("JWS Unprotected Header incorrect type");let r={};if(e.protected)try{const f=jr(e.protected);r=JSON.parse(Na.decode(f))}catch{throw new $e("JWS Protected Header is invalid")}if(!pb(r,e.header))throw new $e("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const a={...r,...e.header},o=vb($e,new Map([["b64",!0]]),n==null?void 0:n.crit,r,a);let i=!0;if(o.has("b64")&&(i=r.b64,typeof i!="boolean"))throw new $e('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:s}=a;if(typeof s!="string"||!s)throw new $e('JWS "alg" (Algorithm) Header Parameter missing or invalid');const l=n&&MP("algorithms",n.algorithms);if(l&&!l.has(s))throw new cb('"alg" (Algorithm) Header Parameter value not allowed');if(i){if(typeof e.payload!="string")throw new $e("JWS Payload must be a string")}else if(typeof e.payload!="string"&&!(e.payload instanceof Uint8Array))throw new $e("JWS Payload must be a string or an Uint8Array instance");let u=!1;typeof t=="function"?(t=await t(r,e),u=!0,Vc(s,t,"verify"),Vo(t)&&(t=await SP(t,s))):Vc(s,t,"verify");const c=ub(hn.encode(e.protected??""),hn.encode("."),typeof e.payload=="string"?hn.encode(e.payload):e.payload);let d;try{d=jr(e.signature)}catch{throw new $e("Failed to base64url decode the signature")}if(!await OP(s,t,d,c))throw new db;let m;if(i)try{m=jr(e.payload)}catch{throw new $e("Failed to base64url decode the payload")}else typeof e.payload=="string"?m=hn.encode(e.payload):m=e.payload;const p={payload:m};return e.protected!==void 0&&(p.protectedHeader=r),e.header!==void 0&&(p.unprotectedHeader=e.header),u?{...p,key:t}:p}async function RP(e,t,n){if(e instanceof Uint8Array&&(e=Na.decode(e)),typeof e!="string")throw new $e("Compact JWS must be a string or Uint8Array");const{0:r,1:a,2:o,length:i}=e.split(".");if(i!==3)throw new $e("Invalid Compact JWS");const s=await IP({payload:a,protected:r,signature:o},t,n),l={payload:s.payload,protectedHeader:s.protectedHeader};return typeof t=="function"?{...l,key:s.key}:l}const lr=e=>Math.floor(e.getTime()/1e3),Cb=60,Eb=Cb*60,Fd=Eb*24,NP=Fd*7,zP=Fd*365.25,DP=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,zi=e=>{const t=DP.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]),r=t[3].toLowerCase();let a;switch(r){case"sec":case"secs":case"second":case"seconds":case"s":a=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":a=Math.round(n*Cb);break;case"hour":case"hours":case"hr":case"hrs":case"h":a=Math.round(n*Eb);break;case"day":case"days":case"d":a=Math.round(n*Fd);break;case"week":case"weeks":case"w":a=Math.round(n*NP);break;default:a=Math.round(n*zP);break}return t[1]==="-"||t[4]==="ago"?-a:a},Oh=e=>e.toLowerCase().replace(/^application\//,""),UP=(e,t)=>typeof e=="string"?t.includes(e):Array.isArray(e)?t.some(Set.prototype.has.bind(new Set(e))):!1,FP=(e,t,n={})=>{let r;try{r=JSON.parse(Na.decode(t))}catch{}if(!za(r))throw new Jt("JWT Claims Set must be a top-level JSON object");const{typ:a}=n;if(a&&(typeof e.typ!="string"||Oh(e.typ)!==Oh(a)))throw new Vt('unexpected "typ" JWT header value',r,"typ","check_failed");const{requiredClaims:o=[],issuer:i,subject:s,audience:l,maxTokenAge:u}=n,c=[...o];u!==void 0&&c.push("iat"),l!==void 0&&c.push("aud"),s!==void 0&&c.push("sub"),i!==void 0&&c.push("iss");for(const p of new Set(c.reverse()))if(!(p in r))throw new Vt(`missing required "${p}" claim`,r,p,"missing");if(i&&!(Array.isArray(i)?i:[i]).includes(r.iss))throw new Vt('unexpected "iss" claim value',r,"iss","check_failed");if(s&&r.sub!==s)throw new Vt('unexpected "sub" claim value',r,"sub","check_failed");if(l&&!UP(r.aud,typeof l=="string"?[l]:l))throw new Vt('unexpected "aud" claim value',r,"aud","check_failed");let d;switch(typeof n.clockTolerance){case"string":d=zi(n.clockTolerance);break;case"number":d=n.clockTolerance;break;case"undefined":d=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:b}=n,m=lr(b||new Date);if((r.iat!==void 0||u)&&typeof r.iat!="number")throw new Vt('"iat" claim must be a number',r,"iat","invalid");if(r.nbf!==void 0){if(typeof r.nbf!="number")throw new Vt('"nbf" claim must be a number',r,"nbf","invalid");if(r.nbf>m+d)throw new Vt('"nbf" claim timestamp check failed',r,"nbf","check_failed")}if(r.exp!==void 0){if(typeof r.exp!="number")throw new Vt('"exp" claim must be a number',r,"exp","invalid");if(r.exp<=m-d)throw new Wc('"exp" claim timestamp check failed',r,"exp","check_failed")}if(u){const p=m-r.iat,f=typeof u=="number"?u:zi(u);if(p-d>f)throw new Wc('"iat" claim timestamp check failed (too far in the past)',r,"iat","check_failed");if(p<0-d)throw new Vt('"iat" claim timestamp check failed (it should be in the past)',r,"iat","check_failed")}return r};async function LP(e,t,n){var i;const r=await RP(e,t,n);if((i=r.protectedHeader.crit)!=null&&i.includes("b64")&&r.protectedHeader.b64===!1)throw new Jt("JWTs MUST NOT use unencoded payload");const o={payload:FP(r.protectedHeader,r.payload,n),protectedHeader:r.protectedHeader};return typeof t=="function"?{...o,key:r.key}:o}const qP=async(e,t,n)=>{const r=await _b(e,t,"sign");gb(e,r);const a=await vu.subtle.sign(jb(e,r.algorithm),r,n);return new Uint8Array(a)},$P=qP;class WP{constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=t}setProtectedHeader(t){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setUnprotectedHeader(t){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=t,this}async sign(t,n){if(!this._protectedHeader&&!this._unprotectedHeader)throw new $e("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!pb(this._protectedHeader,this._unprotectedHeader))throw new $e("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const r={...this._protectedHeader,...this._unprotectedHeader},a=vb($e,new Map([["b64",!0]]),n==null?void 0:n.crit,this._protectedHeader,r);let o=!0;if(a.has("b64")&&(o=this._protectedHeader.b64,typeof o!="boolean"))throw new $e('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:i}=r;if(typeof i!="string"||!i)throw new $e('JWS "alg" (Algorithm) Header Parameter missing or invalid');Vc(i,t,"sign");let s=this._payload;o&&(s=hn.encode(ac(s)));let l;this._protectedHeader?l=hn.encode(ac(JSON.stringify(this._protectedHeader))):l=hn.encode("");const u=ub(l,hn.encode("."),s),c=await $P(i,t,u),d={signature:ac(c),payload:""};return o&&(d.payload=Na.decode(s)),this._unprotectedHeader&&(d.header=this._unprotectedHeader),this._protectedHeader&&(d.protected=Na.decode(l)),d}}class HP{constructor(t){this._flattened=new WP(t)}setProtectedHeader(t){return this._flattened.setProtectedHeader(t),this}async sign(t,n){const r=await this._flattened.sign(t,n);if(r.payload===void 0)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${r.protected}.${r.payload}.${r.signature}`}}function Yr(e,t){if(!Number.isFinite(t))throw new TypeError(`Invalid ${e} input`);return t}class VP{constructor(t={}){if(!za(t))throw new TypeError("JWT Claims Set MUST be an object");this._payload=t}setIssuer(t){return this._payload={...this._payload,iss:t},this}setSubject(t){return this._payload={...this._payload,sub:t},this}setAudience(t){return this._payload={...this._payload,aud:t},this}setJti(t){return this._payload={...this._payload,jti:t},this}setNotBefore(t){return typeof t=="number"?this._payload={...this._payload,nbf:Yr("setNotBefore",t)}:t instanceof Date?this._payload={...this._payload,nbf:Yr("setNotBefore",lr(t))}:this._payload={...this._payload,nbf:lr(new Date)+zi(t)},this}setExpirationTime(t){return typeof t=="number"?this._payload={...this._payload,exp:Yr("setExpirationTime",t)}:t instanceof Date?this._payload={...this._payload,exp:Yr("setExpirationTime",lr(t))}:this._payload={...this._payload,exp:lr(new Date)+zi(t)},this}setIssuedAt(t){return typeof t>"u"?this._payload={...this._payload,iat:lr(new Date)}:t instanceof Date?this._payload={...this._payload,iat:Yr("setIssuedAt",lr(t))}:typeof t=="string"?this._payload={...this._payload,iat:Yr("setIssuedAt",lr(new Date)+zi(t))}:this._payload={...this._payload,iat:Yr("setIssuedAt",t)},this}}class JP extends VP{setProtectedHeader(t){return this._protectedHeader=t,this}async sign(t,n){var a;const r=new HP(hn.encode(JSON.stringify(this._payload)));if(r.setProtectedHeader(this._protectedHeader),Array.isArray((a=this._protectedHeader)==null?void 0:a.crit)&&this._protectedHeader.crit.includes("b64")&&this._protectedHeader.b64===!1)throw new Jt("JWTs MUST NOT use unencoded payload");return r.sign(t,n)}}const KP=jr;function GP(e){if(typeof e!="string")throw new Jt("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:n}=e.split(".");if(n===5)throw new Jt("Only JWTs using Compact JWS serialization can be decoded");if(n!==3)throw new Jt("Invalid JWT");if(!t)throw new Jt("JWTs must contain a payload");let r;try{r=KP(t)}catch{throw new Jt("Failed to base64url decode the payload")}let a;try{a=JSON.parse(Na.decode(r))}catch{throw new Jt("Failed to parse the decoded payload as JSON")}if(!za(a))throw new Jt("Invalid JWT Claims Set");return a}const Ab="your_secret_key";function Sb(e){return async t=>{const r=new TextEncoder().encode(Ab);return new JP(t).setProtectedHeader({alg:"HS256"}).setIssuedAt().setExpirationTime(e).sign(r)}}const YP=Sb("1Y"),QP=Sb("15m");async function Ld(e){const n=new TextEncoder().encode(Ab);try{const{payload:r}=await LP(e,n);return r}catch{return null}}function ZP(){return e=>{try{return GP(e)}catch{return null}}}const Tb=ZP(),XP=async({request:e})=>{try{const t=Dj.parse(await e.json()),n=wu.create(t.network);if(!await new sb().checkProof(t,s=>n.getWalletPublicKey(s)))return vr({error:"Invalid proof"});const o=t.proof.payload;if(!await Ld(o))return vr({error:"Invalid token"});const i=await YP({address:t.address,network:t.network});return hs({token:i})}catch(t){return vr({error:"Invalid request",trace:t})}};var ic={},Ti={},ms={},Zt={};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.defer=Pb=Zt.internalOnchainContentToCell=Zt.sleep=void 0;const Sn=de,e2=Wt();function t2(e){return new Promise(t=>{setTimeout(()=>t(),e)})}Zt.sleep=t2;function n2(e){const t=Sn.Dictionary.empty(Sn.Dictionary.Keys.Buffer(32),Sn.Dictionary.Values.Cell());for(const n in e){if(e[n]===void 0)continue;const r=(0,Sn.beginCell)();if(n==="image_data"){const a=Sn.Dictionary.empty(Sn.Dictionary.Keys.Uint(32),Sn.Dictionary.Values.Cell()),o=Buffer.from(e[n],"base64");for(let i=0;i*127e(...t)}Zt.defer=r2;var a2=re&&re.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var a=Object.getOwnPropertyDescriptor(t,n);(!a||("get"in a?!t.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,a)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),o2=re&&re.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ih=re&&re.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&a2(t,e,n);return o2(t,e),t};Object.defineProperty(ms,"__esModule",{value:!0});ms.PinataStorage=void 0;const Rh=Zt;class qd{constructor(t,n){this.client=(0,Rh.defer)(async()=>{const r=await Promise.resolve().then(()=>Ih(qi)).then(a=>a.default);return new r(this.apiKey,this.secretApiKey)}),this.stream=(0,Rh.defer)(async r=>(await Promise.resolve().then(()=>Ih(qi)).then(o=>o.Readable)).from(r)),this.apiKey=t,this.secretApiKey=n}static create(t){return new qd(t.pinataApiKey,t.pinataSecretKey)}async uploadFile(t){const n=await this.client(),r=await this.stream(t);return"ipfs://"+(await n.pinFileToIPFS(r,{pinataMetadata:{name:"Assets SDK Jetton"}})).IpfsHash}}ms.PinataStorage=qd;var ps={},i2=re&&re.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var a=Object.getOwnPropertyDescriptor(t,n);(!a||("get"in a?!t.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,a)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),s2=re&&re.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l2=re&&re.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&i2(t,e,n);return s2(t,e),t};Object.defineProperty(ps,"__esModule",{value:!0});ps.S3Storage=void 0;const u2=Zt;class $d{constructor(t,n,r){this.s3=(0,u2.defer)(async()=>{const a=await Promise.resolve().then(()=>l2(qi)).then(o=>o.S3);return new a({credentials:{accessKeyId:this.accessKeyId,secretAccessKey:this.secretAccessKey}})}),this.accessKeyId=t,this.secretAccessKey=n,this.bucket=r}static create(t){return new $d(t.s3AccessKeyId,t.s3SecretAccessKey,t.s3Bucket)}async uploadFile(t){const n=await this.s3(),r="jetton/"+Math.random().toString(36).substring(2);return await n.putObject({Bucket:this.bucket,Key:r,Body:t}),"https://"+this.bucket+".s3.amazonaws.com/"+r}}ps.S3Storage=$d;var Pr={},Ye={};Object.defineProperty(Ye,"__esModule",{value:!0});Ye.bufferToStr=Ye.decodeImage=Ye.decodeSimpleFields=Ye.loadFullContent=Ye.DefaultContentResolver=void 0;const Bb=de,c2=Wt();class d2{constructor(t){this.ipfsGateway=t??(n=>`https://ipfs.io/ipfs/${n}`)}async resolve(t){if(t.startsWith("ipfs://")&&(t=this.ipfsGateway(t.slice(7))),!(t.startsWith("https://")||t.startsWith("http://")))throw new Error("Unknown URL: "+t);return Buffer.from(await(await fetch(t)).arrayBuffer())}}Ye.DefaultContentResolver=d2;function f2(e){const t=[];for(;e.remainingBits>0||e.remainingRefs>0;){if(e.remainingBits%8!==0)throw new Error("Slice must contain an integer number of bytes");if(t.push(e.loadBuffer(e.remainingBits/8)),e.remainingRefs===1)e=e.loadRef().beginParse();else if(e.remainingRefs>1)throw new Error("Slice must contain at most 1 ref")}return Buffer.concat(t)}const h2={serialize:()=>{throw new Error("Buffer serialization is not supported")},parse:e=>{const t=e.loadRef().beginParse();if(t.remainingBits%8!==0)throw new Error("Slice must contain an integer number of bytes");if(t.remainingRefs!==0)throw new Error("Slice must not contain refs");return t.loadBuffer(t.remainingBits/8)}};function m2(e){const t=e.loadDict(Bb.Dictionary.Keys.Uint(32),h2),n=[];for(let r=0;r{throw new Error("ContentData serialization is not supported")},parse:e=>{const t=e.loadRef().beginParse(),n=t.loadUint(8);if(n===0)return f2(t);if(n===1)return m2(t);throw new Error("Unknown ContentData type: "+n)}};function Nh(e){const t=JSON.parse(e.toString("utf-8"));if(typeof t!="object")throw new Error("Data must be an object");return t}function ur(e){return BigInt("0x"+(0,c2.sha256_sync)(e).toString("hex"))}async function g2(e,t){const n=e.beginParse(),r=n.loadUint(8);if(r===0){const a=n.loadDict(Bb.Dictionary.Keys.BigUint(256),p2),o=a.get(ur("uri"));if(o!==void 0){const i=o.toString("utf-8"),s=await t.resolve(i);return{type:"semichain",offchainFields:Nh(s),onchainFields:a,offchainUrl:i}}return{type:"onchain",onchainFields:a}}else if(r===1){const a=n.loadStringTail(),o=await t.resolve(a);return{type:"offchain",offchainFields:Nh(o),offchainUrl:a}}else throw new Error("Unknown FullContent type: "+r)}Ye.loadFullContent=g2;function y2(e,t){const n={};for(const r in t){if(e.onchainFields!==void 0){const a=ur(r),o=e.onchainFields.get(a);if(o!==void 0){n[r]=t[r].onchain(o),e.onchainFields.delete(a);continue}}e.offchainFields!==void 0&&r in e.offchainFields&&(n[r]=t[r].offchain(e.offchainFields[r]),delete e.offchainFields[r])}return n}Ye.decodeSimpleFields=y2;function b2(e){if(e.onchainFields!==void 0&&e.onchainFields.has(ur("image"))&&e.onchainFields.has(ur("image_data")))throw new Error("Onchain fields contain both image and image_data");if(e.offchainFields!==void 0&&"image"in e.offchainFields&&"image_data"in e.offchainFields)throw new Error("Offchain fields contain both image and image_data");if(e.onchainFields!==void 0){const t=e.onchainFields.get(ur("image"));if(t!==void 0)return e.onchainFields.delete(ur("image")),t.toString("utf-8");const n=e.onchainFields.get(ur("image_data"));if(n!==void 0)return e.onchainFields.delete(ur("image_data")),n}if(e.offchainFields!==void 0){if("image"in e.offchainFields){const t=e.offchainFields.image;if(typeof t!="string")throw new Error("Image URI must be a string");return delete e.offchainFields.image,t}if("image_data"in e.offchainFields){const t=e.offchainFields.image_data;if(typeof t!="string")throw new Error("Offchain image data must be a string");return delete e.offchainFields.image_data,Buffer.from(t,"base64")}}}Ye.decodeImage=b2;const k2=e=>e.toString("utf-8");Ye.bufferToStr=k2;var w2=re&&re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.parseJettonContent=Pr.jettonContentToInternal=void 0;const v2=de,Bt=w2(ds),ar=Ye;function j2(e){var t,n;return{uri:e.uri,name:e.name,description:e.description,image:e.image,image_data:(t=e.imageData)==null?void 0:t.toString("base64"),symbol:e.symbol,decimals:(n=e.decimals)==null?void 0:n.toString(),amount_style:e.amountStyle,render_type:e.renderType}}Pr.jettonContentToInternal=j2;function _2(e){const t=(0,ar.decodeSimpleFields)(e,{name:{onchain:ar.bufferToStr,offchain:r=>Bt.default.string().parse(r)},description:{onchain:ar.bufferToStr,offchain:r=>Bt.default.string().parse(r)},symbol:{onchain:ar.bufferToStr,offchain:r=>Bt.default.string().parse(r)},decimals:{onchain:r=>parseInt((0,ar.bufferToStr)(r)),offchain:r=>Bt.default.union([Bt.default.string(),Bt.default.number()]).transform(a=>Number(a)).parse(r)},amount_style:{onchain:r=>{const a=(0,ar.bufferToStr)(r);if(!["n","n-of-total","%"].includes(a))throw new Error("Unknown amount_style: "+a);return a},offchain:r=>Bt.default.union([Bt.default.literal("n"),Bt.default.literal("n-of-total"),Bt.default.literal("%")]).parse(r)},render_type:{onchain:r=>{const a=(0,ar.bufferToStr)(r);if(!["currency","game"].includes(a))throw new Error("Unknown render_type: "+a);return a},offchain:r=>Bt.default.union([Bt.default.literal("currency"),Bt.default.literal("game")]).parse(r)}});return t.image=(0,ar.decodeImage)(e),{...t,type:e.type,unknownOffchainFields:e.offchainFields??{},unknownOnchainFields:e.onchainFields??v2.Dictionary.empty(),offchainUrl:e.offchainUrl}}Pr.parseJettonContent=_2;var Fn={},C2=re&&re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Fn,"__esModule",{value:!0});Fn.parseNftContent=Fn.nftContentToInternal=void 0;const E2=de,zh=C2(ds),Rs=Ye;function A2(e){var t;return{uri:e.uri,name:e.name,description:e.description,image:e.image,image_data:(t=e.imageData)==null?void 0:t.toString("base64")}}Fn.nftContentToInternal=A2;function S2(e){const t=(0,Rs.decodeSimpleFields)(e,{name:{onchain:Rs.bufferToStr,offchain:r=>zh.default.string().parse(r)},description:{onchain:Rs.bufferToStr,offchain:r=>zh.default.string().parse(r)}});return t.image=(0,Rs.decodeImage)(e),{...t,type:e.type,unknownOffchainFields:e.offchainFields??{},unknownOnchainFields:e.onchainFields??E2.Dictionary.empty(),offchainUrl:e.offchainUrl}}Fn.parseNftContent=S2;var Br={},ju={};Object.defineProperty(ju,"__esModule",{value:!0});ju.jettonWalletCode=void 0;ju.jettonWalletCode={codeBoc:"te6ccgECEgEAAzQAART/APSkE/S88sgLAQIBYgIDAgLMBAUAG6D2BdqJofQB9IH0gahhAgHUBgcCAUgICQDDCDHAJJfBOAB0NMDAXGwlRNfA/AL4PpA+kAx+gAxcdch+gAx+gAwc6m0AALTH4IQD4p+pVIgupUxNFnwCOCCEBeNRRlSILqWMUREA/AJ4DWCEFlfB7y6k1nwCuBfBIQP8vCAAET6RDBwuvLhTYAIBIAoLAgEgEBEB8QD0z/6APpAIfAB7UTQ+gD6QPpA1DBRNqFSKscF8uLBKML/8uLCVDRCcFQgE1QUA8hQBPoCWM8WAc8WzMkiyMsBEvQA9ADLAMkg+QBwdMjLAsoHy//J0AT6QPQEMfoAINdJwgDy4sR3gBjIywVQCM8WcPoCF8trE8yAMA/c7UTQ+gD6QPpA1DAI0z/6AFFRoAX6QPpAU1vHBVRzbXBUIBNUFAPIUAT6AljPFgHPFszJIsjLARL0APQAywDJ+QBwdMjLAsoHy//J0FANxwUcsfLiwwr6AFGooYIImJaAggiYloAStgihggjk4cCgGKEn4w8l1wsBwwAjgDQ4PAK6CEBeNRRnIyx8Zyz9QB/oCIs8WUAbPFiX6AlADzxbJUAXMI5FykXHiUAioE6CCCOThwKoAggiYloCgoBS88uLFBMmAQPsAECPIUAT6AljPFgHPFszJ7VQAcFJ5oBihghBzYtCcyMsfUjDLP1j6AlAHzxZQB88WyXGAEMjLBSTPFlAG+gIVy2oUzMlx+wAQJBAjAA4QSRA4N18EAHbCALCOIYIQ1TJ223CAEMjLBVAIzxZQBPoCFstqEssfEss/yXL7AJM1bCHiA8hQBPoCWM8WAc8WzMntVADbO1E0PoA+kD6QNQwB9M/+gD6QDBRUaFSSccF8uLBJ8L/8uLCggjk4cCqABagFrzy4sOCEHvdl97Iyx8Vyz9QA/oCIs8WAc8WyXGAGMjLBSTPFnD6AstqzMmAQPsAQBPIUAT6AljPFgHPFszJ7VSAAgyAINch7UTQ+gD6QPpA1DAE0x+CEBeNRRlSILqCEHvdl94TuhKx8uLF0z8x+gAwE6BQI8hQBPoCWM8WAc8WzMntVIA=="};var Mr={};Object.defineProperty(Mr,"__esModule",{value:!0});Mr.parseExcessReturnOptions=Mr.parseNotifyOptions=void 0;const Dh=de;function T2(e){return e===!1?null:typeof e=="object"?{amount:e.amount??(0,Dh.toNano)("0.01"),payload:e.payload??null}:{amount:(0,Dh.toNano)("0.01"),payload:null}}Mr.parseNotifyOptions=T2;function P2(e,t){return e===!1?null:typeof e=="object"?{address:e.address??t.address}:{address:t.address}}Mr.parseExcessReturnOptions=P2;var Ln={},Pe={};Object.defineProperty(Pe,"__esModule",{value:!0});Pe.JETTON_EXCESSES_OPCODE=Pe.JETTON_BURN_NOTIFICATION_OPCODE=Pe.JETTON_BURN_OPCODE=Pe.JETTON_TRANSFER_NOTIFICATION_OPCODE=Pe.JETTON_TRANSFER_OPCODE=Pe.JETTON_CHANGE_CONTENT_OPCODE=Pe.JETTON_CHANGE_ADMIN_OPCODE=Pe.JETTON_INTERNAL_TRANSFER_OPCODE=Pe.JETTON_MINT_OPCODE=void 0;Pe.JETTON_MINT_OPCODE=21;Pe.JETTON_INTERNAL_TRANSFER_OPCODE=395134233;Pe.JETTON_CHANGE_ADMIN_OPCODE=3;Pe.JETTON_CHANGE_CONTENT_OPCODE=4;Pe.JETTON_TRANSFER_OPCODE=260734629;Pe.JETTON_TRANSFER_NOTIFICATION_OPCODE=1935855772;Pe.JETTON_BURN_OPCODE=1499400124;Pe.JETTON_BURN_NOTIFICATION_OPCODE=2078119902;Pe.JETTON_EXCESSES_OPCODE=3576854235;Object.defineProperty(Ln,"__esModule",{value:!0});Ln.loadJettonTransferMessage=Ln.storeJettonTransferMessage=void 0;const Mb=Pe;function B2(e){return t=>{t.storeUint(Mb.JETTON_TRANSFER_OPCODE,32),t.storeUint(e.queryId,64),t.storeCoins(e.amount),t.storeAddress(e.destination),t.storeAddress(e.responseDestination),t.storeMaybeRef(e.customPayload),t.storeCoins(e.forwardAmount??0),t.storeMaybeRef(e.forwardPayload)}}Ln.storeJettonTransferMessage=B2;function M2(e){if(e.loadUint(32)!==Mb.JETTON_TRANSFER_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadCoins(),r=e.loadAddress(),a=e.loadMaybeAddress(),o=e.loadMaybeRef(),i=e.loadCoins(),l=e.loadBoolean()?e.loadRef():e.asCell();return{queryId:t,amount:n,destination:r,responseDestination:a,customPayload:o,forwardAmount:i,forwardPayload:l}}Ln.loadJettonTransferMessage=M2;var qn={};Object.defineProperty(qn,"__esModule",{value:!0});qn.loadJettonBurnMessage=qn.storeJettonBurnMessage=void 0;const xb=Pe;function x2(e){return t=>{t.storeUint(xb.JETTON_BURN_OPCODE,32),t.storeUint(e.queryId,64),t.storeCoins(e.amount),t.storeAddress(e.responseDestination),t.storeMaybeRef(e.customPayload)}}qn.storeJettonBurnMessage=x2;function O2(e){if(e.loadUint(32)!==xb.JETTON_BURN_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadCoins(),r=e.loadMaybeAddress(),a=e.loadMaybeRef();return{queryId:t,amount:n,responseDestination:r,customPayload:a}}qn.loadJettonBurnMessage=O2;var gs={},ys={},kn={};Object.defineProperty(kn,"__esModule",{value:!0});kn.loadJettonInternalTransferMessage=kn.storeJettonInternalTransferMessage=void 0;const Ob=Pe;function I2(e){return t=>{t.storeUint(Ob.JETTON_INTERNAL_TRANSFER_OPCODE,32),t.storeUint(e.queryId,64),t.storeCoins(e.amount),t.storeAddress(e.from),t.storeAddress(e.responseAddress),t.storeCoins(e.forwardTonAmount),t.storeMaybeRef(e.forwardPayload)}}kn.storeJettonInternalTransferMessage=I2;function R2(e){if(e.loadUint(32)!==Ob.JETTON_INTERNAL_TRANSFER_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadCoins(),r=e.loadAddress(),a=e.loadAddress(),o=e.loadCoins(),s=e.loadBoolean()?e.loadRef():e.asCell();return{queryId:t,amount:n,from:r,responseAddress:a,forwardTonAmount:o,forwardPayload:s}}kn.loadJettonInternalTransferMessage=R2;var xr={};Object.defineProperty(xr,"__esModule",{value:!0});xr.loadJettonBurnNotificationMessage=xr.storeJettonBurnNotificationMessage=void 0;const Ib=Pe;function N2(e){return t=>{t.storeUint(Ib.JETTON_BURN_NOTIFICATION_OPCODE,32),t.storeUint(e.queryId,64),t.storeCoins(e.amount),t.storeAddress(e.sender),t.storeAddress(e.responseDestination)}}xr.storeJettonBurnNotificationMessage=N2;function z2(e){if(e.loadUint(32)!==Ib.JETTON_BURN_NOTIFICATION_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadCoins(),r=e.loadAddress(),a=e.loadMaybeAddress();return{queryId:t,amount:n,sender:r,responseDestination:a}}xr.loadJettonBurnNotificationMessage=z2;var Or={};Object.defineProperty(Or,"__esModule",{value:!0});Or.loadJettonTransferNotificationMessage=Or.storeJettonTransferNotificationMessage=void 0;const Rb=Pe;function D2(e){return t=>{t.storeUint(Rb.JETTON_TRANSFER_NOTIFICATION_OPCODE,32),t.storeUint(e.queryId,64),t.storeCoins(e.amount),t.storeAddress(e.sender),t.storeMaybeRef(e.forwardPayload)}}Or.storeJettonTransferNotificationMessage=D2;function U2(e){if(e.loadUint(32)!==Rb.JETTON_TRANSFER_NOTIFICATION_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadCoins(),r=e.loadAddress(),o=e.loadBoolean()?e.loadRef():e.asCell();return{queryId:t,amount:n,sender:r,forwardPayload:o}}Or.loadJettonTransferNotificationMessage=U2;Object.defineProperty(ys,"__esModule",{value:!0});ys.loadJettonWalletMessage=void 0;const Qa=Pe,F2=Ln,L2=kn,q2=qn,$2=xr,W2=Or;function H2(e){try{switch(e.preloadUint(32)){case Qa.JETTON_TRANSFER_OPCODE:return{kind:"jetton_transfer",...(0,F2.loadJettonTransferMessage)(e)};case Qa.JETTON_INTERNAL_TRANSFER_OPCODE:return{kind:"jetton_internal_transfer",...(0,L2.loadJettonInternalTransferMessage)(e)};case Qa.JETTON_TRANSFER_NOTIFICATION_OPCODE:return{kind:"transfer_notification",...(0,W2.loadJettonTransferNotificationMessage)(e)};case Qa.JETTON_BURN_OPCODE:return{kind:"jetton_burn",...(0,q2.loadJettonBurnMessage)(e)};case Qa.JETTON_BURN_NOTIFICATION_OPCODE:return{kind:"jetton_burn_notification",...(0,$2.loadJettonBurnNotificationMessage)(e)};case Qa.JETTON_EXCESSES_OPCODE:return{kind:"excesses",queryId:e.loadUintBig(64)}}}catch{}return{kind:"unknown"}}ys.loadJettonWalletMessage=H2;var Xn={},Wd={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.loadTransferMessage=e.loadEncryptedMessage=e.storeEncryptedMessage=e.loadTextMessage=e.storeTextMessage=e.loadSimpleTransferMessage=e.storeSimpleTransferMessage=e.ENCRYPTED_MESSAGE_OPCODE=e.TEXT_OPCODE=void 0,e.TEXT_OPCODE=0,e.ENCRYPTED_MESSAGE_OPCODE=560454219;function t(l){return u=>{}}e.storeSimpleTransferMessage=t;function n(l){return{}}e.loadSimpleTransferMessage=n;function r(l){return u=>{u.storeUint(0,32),u.storeStringTail(l.text)}}e.storeTextMessage=r;function a(l){if(l.loadUint(32)!==0)throw new Error("Wrong opcode");return{text:l.loadStringTail()}}e.loadTextMessage=a;function o(l){return u=>{u.storeUint(e.ENCRYPTED_MESSAGE_OPCODE,32),u.storeStringTail(l.data.toString("utf-8"))}}e.storeEncryptedMessage=o;function i(l){if(l.loadUint(32)!==e.ENCRYPTED_MESSAGE_OPCODE)throw new Error("Wrong opcode");const u=l.loadStringTail();return{data:Buffer.from(u,"utf-8")}}e.loadEncryptedMessage=i;function s(l){if(l.remainingBits===0)return{kind:"simple_transfer"};try{switch(l.preloadUint(32)){case e.TEXT_OPCODE:return{kind:"text_message",...a(l)};case e.ENCRYPTED_MESSAGE_OPCODE:return{kind:"encrypted_message",...i(l)}}}catch{}return{kind:"unknown"}}e.loadTransferMessage=s})(Wd);Object.defineProperty(Xn,"__esModule",{value:!0});Xn.parseTransferTransaction=void 0;const V2=Wd;function J2(e){if(e.description.type!=="generic")return{kind:"unknown",transaction:e};if(!e.inMessage)return{kind:"unknown",transaction:e};if(e.inMessage.info.type!=="internal")return{kind:"unknown",transaction:e};const t=e.inMessage.body.beginParse(),n=(0,V2.loadTransferMessage)(t);return n.kind==="simple_transfer"?{kind:"simple_transfer",from:e.inMessage.info.src,to:e.inMessage.info.dest,amount:e.inMessage.info.value.coins,transaction:e}:n.kind==="text_message"?{kind:"text_message",from:e.inMessage.info.src,to:e.inMessage.info.dest,amount:e.inMessage.info.value.coins,text:n.text,transaction:e}:n.kind==="encrypted_message"?{kind:"encrypted_message",from:e.inMessage.info.src,to:e.inMessage.info.dest,amount:e.inMessage.info.value.coins,data:n.data,transaction:e}:{kind:"unknown",transaction:e}}Xn.parseTransferTransaction=J2;Object.defineProperty(gs,"__esModule",{value:!0});gs.parseJettonWalletTransaction=void 0;const K2=ys,G2=Xn;function Y2(e){const t=(0,G2.parseTransferTransaction)(e);if(t.kind!=="unknown")return t;if(e.description.type!=="generic")return{kind:"unknown",transaction:e};if(!e.inMessage)return{kind:"unknown",transaction:e};if(e.inMessage.info.type!=="internal")return{kind:"unknown",transaction:e};if(e.description.computePhase.type!=="vm")return{kind:"unknown",transaction:e};if(e.description.computePhase.exitCode!==0)return{kind:"unknown",transaction:e};if(!e.inMessage.body)return{kind:"unknown",transaction:e};const n=e.inMessage.info.bounced,r=(0,K2.loadJettonWalletMessage)(e.inMessage.body.beginParse());return r.kind==="jetton_transfer"?{kind:"jetton_transfer",queryId:r.queryId,from:e.inMessage.info.src,to:r.destination,amount:r.amount,responseAddress:r.responseDestination,forwardTonAmount:r.forwardAmount,forwardPayload:r.forwardPayload,transaction:e}:n&&r.kind==="jetton_internal_transfer"?{kind:"jetton_transfer_failed",queryId:r.queryId,amount:r.amount,transaction:e}:r.kind==="jetton_internal_transfer"?{kind:"jetton_transfer_received",queryId:r.queryId,amount:r.amount,from:e.inMessage.info.src,transaction:e}:r.kind==="jetton_burn"?{kind:"jetton_burn",queryId:r.queryId,amount:r.amount,transaction:e}:n&&r.kind==="jetton_burn_notification"?{kind:"jetton_burn_failed",queryId:r.queryId,amount:r.amount,transaction:e}:{kind:"unknown",transaction:e}}gs.parseJettonWalletTransaction=Y2;Object.defineProperty(Br,"__esModule",{value:!0});Br.JettonWallet=Br.jettonWalletConfigToCell=void 0;const ln=de,Q2=ju,sc=Mr,Z2=Ln,X2=qn,eB=gs;function Nb(e){return(0,ln.beginCell)().storeCoins(e.balance).storeAddress(e.owner).storeAddress(e.jettonMaster).storeRef(e.jettonWalletCode).endCell()}Br.jettonWalletConfigToCell=Nb;class oa{constructor(t,n){this.address=t,this.init=n}static createFromConfig(t,n,r){const o={data:Nb({balance:0n,owner:t.owner,jettonMaster:t.jettonMaster,jettonWalletCode:n??oa.code}),code:n??oa.code};return new oa((0,ln.contractAddress)(r??0,o),o)}static createFromAddress(t){return new oa(t)}async sendDeploy(t,n,r){await t.internal(n,{value:r??(0,ln.toNano)("0.05"),bounce:!0})}async send(t,n,r,a,o){const i=(0,sc.parseNotifyOptions)(o==null?void 0:o.notify),s=(0,sc.parseExcessReturnOptions)(o==null?void 0:o.returnExcess,n);await t.internal(n,{value:((o==null?void 0:o.value)??(0,ln.toNano)("0.05"))+((i==null?void 0:i.amount)??0n),bounce:!0,sendMode:ln.SendMode.PAY_GAS_SEPARATELY,body:(0,ln.beginCell)().store((0,Z2.storeJettonTransferMessage)({queryId:(o==null?void 0:o.queryId)??0n,amount:a,destination:r,responseDestination:(s==null?void 0:s.address)??null,customPayload:(o==null?void 0:o.customPayload)??null,forwardAmount:(i==null?void 0:i.amount)??0n,forwardPayload:(i==null?void 0:i.payload)??null})).endCell()})}async sendBurn(t,n,r,a){const o=(0,sc.parseExcessReturnOptions)(a==null?void 0:a.returnExcess,n);await t.internal(n,{value:(a==null?void 0:a.value)??(0,ln.toNano)("0.05"),bounce:!0,sendMode:ln.SendMode.PAY_GAS_SEPARATELY,body:(0,ln.beginCell)().store((0,X2.storeJettonBurnMessage)({queryId:(a==null?void 0:a.queryId)??0n,amount:r,responseDestination:(o==null?void 0:o.address)??null,customPayload:(a==null?void 0:a.customPayload)??null})).endCell()})}async getData(t){const{stack:n}=await t.get("get_wallet_data",[]);return{balance:n.readBigNumber(),owner:n.readAddress(),jettonMaster:n.readAddress(),jettonWalletCode:n.readCell()}}async getActions(t,n){let{lt:r,hash:a,limit:o}=n??{};if(!r||!a){const s=await t.getState();if(!s.last)return[];r=s.last.lt,a=s.last.hash}return(await t.getTransactions(this.address,r,a,o)).map(s=>(0,eB.parseJettonWalletTransaction)(s))}}Br.JettonWallet=oa;oa.code=ln.Cell.fromBase64(Q2.jettonWalletCode.codeBoc);var Da={},_u={};Object.defineProperty(_u,"__esModule",{value:!0});_u.jettonMinterCode=void 0;_u.jettonMinterCode={codeBoc:"te6ccgECDgEAAqMAART/APSkE/S88sgLAQIBYgIDAgLMBAUCA3pgDA0B9dkGOASS+B8ADoaYGAuNhJL4HwfSB9IBj9ABi465D9ABj9ABg51NoAAWmP6Z/2omh9AH0gamoYQAqpOF1HGZqamxsommOC+XAkgX0gfQBqGBBoQDBrkP0AGBKIGigheASKUCgZ5CgCfQEsZ4tmZmT2qnBBCD3uy+8pOF1AYAk7PwUIgG4KhAJqgoB5CgCfQEsZ4sA54tmZJFkZYCJegB6AGWAZJB8gDg6ZGWBZQPl/+ToO8AMZGWCrGeLKAJ9AQnltYlmZmS4/YBBPSO4DY3NwH6APpA+ChUEgZwVCATVBQDyFAE+gJYzxYBzxbMySLIywES9AD0AMsAyfkAcHTIywLKB8v/ydBQBscF8uBKoQNFRchQBPoCWM8WzMzJ7VQB+kAwINcLAcMAkVvjDeCCECx2uXNScLrjAjU3NyPAA+MCNQLABAcICQoAPoIQ1TJ223CAEMjLBVADzxYi+gISy2rLH8s/yYBC+wAB/jZfA4IImJaAFaAVvPLgSwL6QNMAMJXIIc8WyZFt4oIQ0XNUAHCAGMjLBVAFzxYk+gIUy2oTyx8Uyz8j+kQwcLqOM/goRANwVCATVBQDyFAE+gJYzxYBzxbMySLIywES9AD0AMsAyfkAcHTIywLKB8v/ydDPFpZsInABywHi9AALADQzUDXHBfLgSQP6QDBZyFAE+gJYzxbMzMntVABCjhhRJMcF8uBJ1DBDAMhQBPoCWM8WzMzJ7VTgXwWED/LwAArJgED7AAB9rbz2omh9AH0gamoYNhj8FAC4KhAJqgoB5CgCfQEsZ4sA54tmZJFkZYCJegB6AGWAZPyAODpkZYFlA+X/5OhAAB+vFvaiaH0AfSBqahg/qpBA"};var $n={};Object.defineProperty($n,"__esModule",{value:!0});$n.loadJettonMintMessage=$n.storeJettonMintMessage=void 0;const tB=de,zb=Pe,Db=kn;function nB(e){return t=>{t.storeUint(zb.JETTON_MINT_OPCODE,32),t.storeUint(e.queryId,64),t.storeAddress(e.to),t.storeCoins(e.walletForwardValue),t.storeRef((0,tB.beginCell)().store((0,Db.storeJettonInternalTransferMessage)(e)).endCell())}}$n.storeJettonMintMessage=nB;function rB(e){if(e.loadUint(32)!==zb.JETTON_MINT_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadAddress(),r=e.loadCoins(),a=(0,Db.loadJettonInternalTransferMessage)(e.loadRef().beginParse());return{queryId:t,amount:a.amount,from:a.from,to:n,responseAddress:a.responseAddress,forwardTonAmount:a.forwardTonAmount,forwardPayload:a.forwardPayload,walletForwardValue:r}}$n.loadJettonMintMessage=rB;var Ir={};Object.defineProperty(Ir,"__esModule",{value:!0});Ir.loadJettonMinterContent=Ir.storeJettonMinterContent=void 0;function aB(e){return t=>{t.storeCoins(0),t.storeAddress(e.admin),t.storeRef(e.content),t.storeRef(e.jettonWalletCode)}}Ir.storeJettonMinterContent=aB;function oB(e){e.loadCoins();const t=e.loadAddress(),n=e.loadRef(),r=e.loadRef();return{admin:t,content:n,jettonWalletCode:r}}Ir.loadJettonMinterContent=oB;var Wn={};Object.defineProperty(Wn,"__esModule",{value:!0});Wn.loadJettonChangeAdminMessage=Wn.storeJettonChangeAdminMessage=void 0;const Ub=Pe;function iB(e){return t=>{t.storeUint(Ub.JETTON_CHANGE_ADMIN_OPCODE,32),t.storeUint(e.queryId,64),t.storeAddress(e.newAdmin)}}Wn.storeJettonChangeAdminMessage=iB;function sB(e){if(e.loadUint(32)!==Ub.JETTON_CHANGE_ADMIN_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadAddress();return{queryId:t,newAdmin:n}}Wn.loadJettonChangeAdminMessage=sB;var Hn={};Object.defineProperty(Hn,"__esModule",{value:!0});Hn.loadJettonChangeContentMessage=Hn.storeJettonChangeContentMessage=void 0;const Fb=Pe;function lB(e){return t=>{t.storeUint(Fb.JETTON_CHANGE_CONTENT_OPCODE,32),t.storeUint(e.queryId,64),t.storeRef(e.newContent)}}Hn.storeJettonChangeContentMessage=lB;function uB(e){if(e.loadUint(32)!==Fb.JETTON_CHANGE_CONTENT_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadRef();return{queryId:t,newContent:n}}Hn.loadJettonChangeContentMessage=uB;var bs={},ks={};Object.defineProperty(ks,"__esModule",{value:!0});ks.loadJettonMinterMessage=void 0;const cB=$n,dB=kn,fB=Wn,hB=Hn,Ns=Pe;function mB(e){try{switch(e.preloadUint(32)){case Ns.JETTON_MINT_OPCODE:return{kind:"mint",...(0,cB.loadJettonMintMessage)(e)};case Ns.JETTON_INTERNAL_TRANSFER_OPCODE:return{kind:"internal_transfer",...(0,dB.loadJettonInternalTransferMessage)(e)};case Ns.JETTON_CHANGE_ADMIN_OPCODE:return{kind:"change_admin",...(0,fB.loadJettonChangeAdminMessage)(e)};case Ns.JETTON_CHANGE_CONTENT_OPCODE:return{kind:"change_content",...(0,hB.loadJettonChangeContentMessage)(e)}}}catch{}return{kind:"unknown"}}ks.loadJettonMinterMessage=mB;Object.defineProperty(bs,"__esModule",{value:!0});bs.parseJettonMinterTransaction=void 0;const pB=ks,gB=Xn;function yB(e){const t=(0,gB.parseTransferTransaction)(e);if(t.kind!=="unknown")return t;if(e.description.type!=="generic")return{kind:"unknown",transaction:e};if(!e.inMessage)return{kind:"unknown",transaction:e};if(e.inMessage.info.type!=="internal")return{kind:"unknown",transaction:e};if(e.description.computePhase.type!=="vm")return{kind:"unknown",transaction:e};if(e.description.computePhase.exitCode!==0)return{kind:"unknown",transaction:e};const n=(0,pB.loadJettonMinterMessage)(e.inMessage.body.beginParse());return n.kind==="mint"?{kind:"mint",queryId:n.queryId,amount:n.amount,recipient:n.to,responseAddress:n.responseAddress,forwardPayload:n.forwardPayload,forwardTonAmount:n.forwardTonAmount,value:e.inMessage.info.value.coins,transaction:e}:n.kind==="internal_transfer"?{kind:"burn",queryId:n.queryId,amount:n.amount,from:n.from,value:e.inMessage.info.value.coins,transaction:e}:n.kind==="change_admin"?{kind:"change_admin",queryId:n.queryId,newAdmin:n.newAdmin,value:e.inMessage.info.value.coins,transaction:e}:n.kind==="change_content"?{kind:"change_content",queryId:n.queryId,newContent:n.newContent,value:e.inMessage.info.value.coins,transaction:e}:{kind:"unknown",transaction:e}}bs.parseJettonMinterTransaction=yB;Object.defineProperty(Da,"__esModule",{value:!0});Da.JettonMinter=Da.jettonMinterConfigToCell=void 0;const Ct=de,Lb=Br,bB=Ye,kB=Pr,wB=_u,Uh=Mr,vB=$n,jB=Ir,_B=Wn,CB=Hn,EB=bs;function qb(e){return(0,Ct.beginCell)().store((0,jB.storeJettonMinterContent)({admin:e.admin,content:e.content,jettonWalletCode:e.jettonWalletCode??Lb.JettonWallet.code})).endCell()}Da.jettonMinterConfigToCell=qb;class io{constructor(t,n,r){this.address=t,this.init=n,this.contentResolver=r}static createFromAddress(t,n){return new io(t,void 0,n)}static createFromConfig(t,n,r,a){const i={data:qb(t),code:n??io.code};return new io((0,Ct.contractAddress)(r??0,i),i,a)}async sendDeploy(t,n,r){await t.internal(n,{value:r??(0,Ct.toNano)("0.05"),bounce:!0})}async sendMint(t,n,r,a,o){const i=(0,Uh.parseNotifyOptions)(o==null?void 0:o.notify),s=(0,Uh.parseExcessReturnOptions)(o==null?void 0:o.returnExcess,n);await t.internal(n,{value:(o==null?void 0:o.value)??(0,Ct.toNano)("0.05"),bounce:!0,body:(0,Ct.beginCell)().store((0,vB.storeJettonMintMessage)({queryId:(o==null?void 0:o.queryId)??0n,amount:a,from:this.address,to:r,responseAddress:(s==null?void 0:s.address)??null,forwardPayload:(i==null?void 0:i.payload)??null,forwardTonAmount:(i==null?void 0:i.amount)??0n,walletForwardValue:((i==null?void 0:i.amount)??0n)+(s?(0,Ct.toNano)("0.01"):0n)+(0,Ct.toNano)(.02)})).endCell()})}async sendChangeAdmin(t,n,r,a){await t.internal(n,{value:(a==null?void 0:a.value)??(0,Ct.toNano)("0.05"),bounce:!0,body:(0,Ct.beginCell)().store((0,_B.storeJettonChangeAdminMessage)({queryId:(a==null?void 0:a.queryId)??0n,newAdmin:r})).endCell()})}async sendChangeContent(t,n,r,a){await t.internal(n,{value:(a==null?void 0:a.value)??(0,Ct.toNano)("0.05"),bounce:!0,body:(0,Ct.beginCell)().store((0,CB.storeJettonChangeContentMessage)({queryId:(a==null?void 0:a.queryId)??0n,newContent:r})).endCell()})}async getData(t){const n=new Ct.TupleBuilder,{stack:r}=await t.get("get_jetton_data",n.build());return{totalSupply:r.readBigNumber(),mintable:r.readBigNumber()!==0n,adminAddress:r.readAddressOpt(),jettonContent:r.readCell(),jettonWalletCode:r.readCell()}}async getWalletAddress(t,n){const r=new Ct.TupleBuilder;r.writeAddress(n);const{stack:a}=await t.get("get_wallet_address",r.build());return a.readAddress()}async getWallet(t,n){const r=await this.getWalletAddress(t,n);return t.open(new Lb.JettonWallet(r))}async getContent(t){if(!this.contentResolver)throw new Error("No content resolver");const n=await this.getData(t);return(0,kB.parseJettonContent)(await(0,bB.loadFullContent)(n.jettonContent,this.contentResolver))}async getActions(t,n){let{lt:r,hash:a,limit:o}=n??{};if(!r||!a){const s=await t.getState();if(!s.last)return[];r=s.last.lt,a=s.last.hash}return(await t.getTransactions(this.address,r,a,o)).map(s=>(0,EB.parseJettonMinterTransaction)(s))}}Da.JettonMinter=io;io.code=Ct.Cell.fromBase64(wB.jettonMinterCode.codeBoc);var Qr={},ws={},Cu={};Object.defineProperty(Cu,"__esModule",{value:!0});Cu.nftCollectionEditableCode=void 0;Cu.nftCollectionEditableCode={codeBoc:"te6ccgECFAEAAh8AART/APSkE/S88sgLAQIBYgIDAgLNBAUCASAODwTn0QY4BIrfAA6GmBgLjYSK3wfSAYAOmP6Z/2omh9IGmf6mpqGEEINJ6cqClAXUcUG6+CgOhBCFRlgFa4QAhkZYKoAueLEn0BCmW1CeWP5Z+A54tkwCB9gHAbKLnjgvlwyJLgAPGBEuABcYES4AHxgRgZgeACQGBwgJAgEgCgsAYDUC0z9TE7vy4ZJTE7oB+gDUMCgQNFnwBo4SAaRDQ8hQBc8WE8s/zMzMye1Ukl8F4gCmNXAD1DCON4BA9JZvpSCOKQakIIEA+r6T8sGP3oEBkyGgUyW78vQC+gDUMCJUSzDwBiO6kwKkAt4Ekmwh4rPmMDJQREMTyFAFzxYTyz/MzMzJ7VQALDI0AfpAMEFEyFAFzxYTyz/MzMzJ7VQAPI4V1NQwEDRBMMhQBc8WE8s/zMzMye1U4F8EhA/y8AIBIAwNAD1FrwBHAh8AV3gBjIywVYzxZQBPoCE8trEszMyXH7AIAC0AcjLP/gozxbJcCDIywET9AD0AMsAyYAAbPkAdMjLAhLKB8v/ydCACASAQEQAlvILfaiaH0gaZ/qamoYLehqGCxABDuLXTHtRND6QNM/1NTUMBAkXwTQ1DHUMNBxyMsHAc8WzMmAIBIBITAC+12v2omh9IGmf6mpqGDYg6GmH6Yf9IBhAALbT0faiaH0gaZ/qamoYCi+CeAI4APgCw"};var Vn={},Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});Jn.loadNftRoyaltyParams=Jn.storeNftRoyaltyParams=void 0;function AB(e){return t=>{t.storeUint(e.numerator,16),t.storeUint(e.denominator,16),t.storeAddress(e.recipient)}}Jn.storeNftRoyaltyParams=AB;function SB(e){return{numerator:e.loadUintBig(16),denominator:e.loadUintBig(16),recipient:e.loadAddress()}}Jn.loadNftRoyaltyParams=SB;var Be={};Object.defineProperty(Be,"__esModule",{value:!0});Be.NFT_EXCESSES_OPCODE=Be.NFT_REPORT_STATIC_DATA_OPCODE=Be.NFT_GET_STATIC_DATA_OPCODE=Be.NFT_OWNER_ASSIGNED_OPCODE=Be.NFT_TRANSFER_OPCODE=Be.NFT_CHANGE_CONTENT_OPCODE=Be.NFT_CHANGE_ADMIN_OPCODE=Be.NFT_BATCH_MINT_OPCODE=Be.NFT_MINT_OPCODE=void 0;Be.NFT_MINT_OPCODE=1;Be.NFT_BATCH_MINT_OPCODE=2;Be.NFT_CHANGE_ADMIN_OPCODE=3;Be.NFT_CHANGE_CONTENT_OPCODE=4;Be.NFT_TRANSFER_OPCODE=1607220500;Be.NFT_OWNER_ASSIGNED_OPCODE=85167505;Be.NFT_GET_STATIC_DATA_OPCODE=801842850;Be.NFT_REPORT_STATIC_DATA_OPCODE=2339837749;Be.NFT_EXCESSES_OPCODE=3576854235;Object.defineProperty(Vn,"__esModule",{value:!0});Vn.loadNftChangeContentMessage=Vn.storeNftChangeContentMessage=void 0;const $b=Jn,Wb=Be;function TB(e){return t=>{t.storeUint(Wb.NFT_CHANGE_CONTENT_OPCODE,32),t.storeUint(e.queryId,64),t.storeRef(e.newContent),t.store((0,$b.storeNftRoyaltyParams)(e.newRoyaltyParams))}}Vn.storeNftChangeContentMessage=TB;function PB(e){if(e.loadUint(32)!==Wb.NFT_CHANGE_CONTENT_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadRef(),r=(0,$b.loadNftRoyaltyParams)(e.loadRef().beginParse());return{queryId:t,newContent:n,newRoyaltyParams:r}}Vn.loadNftChangeContentMessage=PB;var Kn={};Object.defineProperty(Kn,"__esModule",{value:!0});Kn.loadNftMintMessage=Kn.storeNftMintMessage=void 0;const BB=de,Hb=Be;function MB(e,t){return n=>{n.storeUint(Hb.NFT_MINT_OPCODE,32),n.storeUint(e.queryId,64),n.storeUint(e.itemIndex,64),n.storeCoins(e.value),n.storeRef((0,BB.beginCell)().store(t(e.itemParams)).endCell())}}Kn.storeNftMintMessage=MB;function xB(e,t){if(e.loadUint(32)!==Hb.NFT_MINT_OPCODE)throw new Error("Wrong opcode");const n=e.loadUintBig(64),r=e.loadUintBig(64),a=e.loadCoins(),o=e.loadRef();return{itemIndex:r,value:a,itemParams:t(o.beginParse()),queryId:n}}Kn.loadNftMintMessage=xB;var et={};Object.defineProperty(et,"__esModule",{value:!0});et.createNftMintItemValue=et.loadNftBatchMintItem=et.storeNftBatchMintItem=et.loadNftBatchMintMessage=et.storeNftBatchMintMessage=void 0;const so=de,Vb=Be;function OB(e,t){return n=>{const r=so.Dictionary.empty(so.Dictionary.Keys.BigUint(64),Hd(t));for(const a of e.requests){if(r.has(a.index))throw new Error("Duplicate items");r.set(a.index,a)}n.storeUint(Vb.NFT_BATCH_MINT_OPCODE,32),n.storeUint(e.queryId??0,64),n.storeRef((0,so.beginCell)().storeDictDirect(r))}}et.storeNftBatchMintMessage=OB;function IB(e,t){if(e.loadUint(32)!==Vb.NFT_BATCH_MINT_OPCODE)throw new Error("Wrong opcode");const n=e.loadUintBig(64),r=e.loadDictDirect(so.Dictionary.Keys.BigUint(64),Hd(void 0,t));return{queryId:n,requests:r.values()}}et.loadNftBatchMintMessage=IB;function Jb(e,t){return n=>{n.storeCoins(e.value??(0,so.toNano)("0.03")),n.storeRef((0,so.beginCell)().store(t(e.params)).endCell())}}et.storeNftBatchMintItem=Jb;function Kb(e,t){const n=e.loadUintBig(64),r=e.loadCoins(),a=e.loadRef();return{index:n,value:r,params:t(a.beginParse())}}et.loadNftBatchMintItem=Kb;function Hd(e,t){return{serialize(n,r){if(!e)throw new Error("storeParams is not defined");r.store(Jb(n,e))},parse(n){if(!t)throw new Error("loadParams is not defined");return Kb(n,t)}}}et.createNftMintItemValue=Hd;var Gn={};Object.defineProperty(Gn,"__esModule",{value:!0});Gn.loadNftChangeAdminMessage=Gn.storeNftChangeAdminMessage=void 0;const Gb=Be;function RB(e){return t=>{t.storeUint(Gb.NFT_CHANGE_ADMIN_OPCODE,32),t.storeUint(e.queryId??0,64),t.storeAddress(e.newAdmin)}}Gn.storeNftChangeAdminMessage=RB;function NB(e){if(e.loadUint(32)!==Gb.NFT_CHANGE_ADMIN_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadAddress();return{queryId:t,newAdmin:n}}Gn.loadNftChangeAdminMessage=NB;Object.defineProperty(ws,"__esModule",{value:!0});ws.NftCollectionBase=void 0;const Mt=de,zB=Ye,DB=Fn,UB=Cu,FB=Vn,LB=Kn,qB=et,$B=Gn;class Yb{constructor(t,n,r,a){this.address=t,this.init=n,this.contentResolver=r,this.itemParamsValue=a}async sendDeploy(t,n,r){await t.internal(n,{value:r??(0,Mt.toNano)("0.05"),bounce:!0})}async sendMint(t,n,r,a){if(this.itemParamsValue===void 0)throw new Error("No item params value");await t.internal(n,{value:(a==null?void 0:a.value)??(0,Mt.toNano)("0.05"),bounce:!0,sendMode:Mt.SendMode.PAY_GAS_SEPARATELY,body:(0,Mt.beginCell)().store((0,LB.storeNftMintMessage)({queryId:(a==null?void 0:a.queryId)??0n,itemIndex:r.index,itemParams:r,value:r.value??(0,Mt.toNano)("0.03")},this.itemParamsValue.store)).endCell()})}async sendBatchMint(t,n,r,a){if(this.itemParamsValue===void 0)throw new Error("No item params value");await t.internal(n,{value:(a==null?void 0:a.value)??(0,Mt.toNano)("0.05")*BigInt(r.length),bounce:!0,body:(0,Mt.beginCell)().store((0,qB.storeNftBatchMintMessage)({queryId:(a==null?void 0:a.queryId)??0n,requests:r.map(o=>({index:o.index,params:o,value:o.value??(0,Mt.toNano)("0.03")}))},this.itemParamsValue.store)).endCell()})}async sendChangeAdmin(t,n,r,a){await t.internal(n,{value:(a==null?void 0:a.value)??(0,Mt.toNano)("0.05"),bounce:!0,body:(0,Mt.beginCell)().store((0,$B.storeNftChangeAdminMessage)({newAdmin:r,queryId:(a==null?void 0:a.queryId)??0n})).endCell()})}async sendChangeContent(t,n,r,a){await t.internal(n,{value:(a==null?void 0:a.value)??(0,Mt.toNano)("0.05"),bounce:!0,body:(0,Mt.beginCell)().store((0,FB.storeNftChangeContentMessage)({queryId:(a==null?void 0:a.queryId)??0n,newContent:r.newContent,newRoyaltyParams:r.newRoyaltyParams})).endCell()})}async getItemAddress(t,n){return(await t.get("get_nft_address_by_index",[{type:"int",value:n}])).stack.readAddress()}async getData(t){const n=await t.get("get_collection_data",[]);return{nextItemIndex:n.stack.readBigNumber(),content:n.stack.readCell(),owner:n.stack.readAddressOpt()}}async getContent(t){if(this.contentResolver===void 0)throw new Error("No content resolver");const n=await this.getData(t);return(0,DB.parseNftContent)(await(0,zB.loadFullContent)(n.content,this.contentResolver))}async getItemContent(t,n,r){return(await t.get("get_nft_content",[{type:"int",value:n},{type:"cell",cell:r}])).stack.readCell()}}ws.NftCollectionBase=Yb;Yb.code=Mt.Cell.fromBase64(UB.nftCollectionEditableCode.codeBoc);var Zr={},Eu={};Object.defineProperty(Eu,"__esModule",{value:!0});Eu.nftItemCode=void 0;Eu.nftItemCode={codeBoc:"te6ccgECDgEAAdwAART/APSkE/S88sgLAQIBYgIDAgLOBAUACaEfn+AFAgEgBgcCASAMDQLPDIhxwCSXwPg0NMDAXGwkl8D4PpA+kAx+gAxcdch+gAx+gAwc6m0APACBLOOFDBsIjRSMscF8uGVAfpA1DAQI/AD4AbTH9M/ghBfzD0UUjC64wIwNDQ1NYIQL8smohK64wJfBIQP8vCAICQARPpEMHC68uFNgAqwyEDdeMkATUTXHBfLhkfpAIfAB+kDSADH6ACDXScIA8uLEggr68IAboSGUUxWgod4i1wsBwwAgkgahkTbiIML/8uGSIZQQKjdb4w0CkzAyNOMNVQLwAwoLAHJwghCLdxc1BcjL/1AEzxYQJIBAcIAQyMsFUAfPFlAF+gIVy2oSyx/LPyJus5RYzxcBkTLiAckB+wAAfIIQBRONkchQCc8WUAvPFnEkSRRURqBwgBDIywVQB88WUAX6AhXLahLLH8s/Im6zlFjPFwGRMuIByQH7ABBHAGom8AGCENUydtsQN0QAbXFwgBDIywVQB88WUAX6AhXLahLLH8s/Im6zlFjPFwGRMuIByQH7AAA7O1E0NM/+kAg10nCAJp/AfpA1DAQJBAj4DBwWW1tgAB0A8jLP1jPFgHPFszJ7VSA="};var Ot={};Object.defineProperty(Ot,"__esModule",{value:!0});Ot.createNftItemParamsValue=Ot.loadNftItemParams=Ot.storeNftItemParams=void 0;const WB=de;function Qb(e){return t=>{t.storeAddress(e.owner),typeof e.individualContent=="string"?t.storeRef((0,WB.beginCell)().storeStringTail(e.individualContent).endCell()):t.storeRef(e.individualContent)}}Ot.storeNftItemParams=Qb;function Zb(e){return{owner:e.loadAddress(),individualContent:e.loadRef()}}Ot.loadNftItemParams=Zb;function HB(){return{store:Qb,load:Zb}}Ot.createNftItemParamsValue=HB;var Yn={};Object.defineProperty(Yn,"__esModule",{value:!0});Yn.loadNftTransferMessage=Yn.storeNftTransferMessage=void 0;const Xb=Be;function VB(e){return t=>{const{queryId:n,newOwner:r,responseDestination:a,customPayload:o,forwardAmount:i,forwardPayload:s}=e;t.storeUint(Xb.NFT_TRANSFER_OPCODE,32).storeUint(n,64).storeAddress(r).storeAddress(a).storeMaybeRef(o).storeCoins(i).storeMaybeRef(s)}}Yn.storeNftTransferMessage=VB;function JB(e){if(e.loadUint(32)!==Xb.NFT_TRANSFER_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadAddress(),r=e.loadMaybeAddress(),a=e.loadMaybeRef(),o=e.loadCoins(),s=e.loadBoolean()?e.loadRef():e.asCell();return{queryId:t,newOwner:n,responseDestination:r,customPayload:a,forwardAmount:o,forwardPayload:s}}Yn.loadNftTransferMessage=JB;var vs={},Jo={},Rr={};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.loadNftDeployMessage=Rr.storeNftDeployMessage=void 0;function KB(e){return t=>{const{owner:n,content:r}=e;t.storeAddress(n).storeRef(r)}}Rr.storeNftDeployMessage=KB;function GB(e){const t=e.loadAddress(),n=e.loadRef();return{owner:t,content:n}}Rr.loadNftDeployMessage=GB;var Nr={};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.loadNftGetStaticDataMessage=Nr.storeNftGetStaticDataMessage=void 0;const ek=Be;function YB(e){return t=>{const{queryId:n}=e;t.storeUint(ek.NFT_GET_STATIC_DATA_OPCODE,32).storeUint(n,64)}}Nr.storeNftGetStaticDataMessage=YB;function QB(e){if(e.loadUint(32)!==ek.NFT_GET_STATIC_DATA_OPCODE)throw new Error("Wrong opcode");return{queryId:e.loadUintBig(64)}}Nr.loadNftGetStaticDataMessage=QB;var zr={};Object.defineProperty(zr,"__esModule",{value:!0});zr.loadNftReportStaticDataMessage=zr.storeNftReportStaticDataMessage=void 0;const tk=Be;function ZB(e){return t=>{const{queryId:n,index:r,collection:a}=e;t.storeUint(tk.NFT_REPORT_STATIC_DATA_OPCODE,32).storeUint(n,64).storeUint(r,256).storeAddress(a)}}zr.storeNftReportStaticDataMessage=ZB;function XB(e){if(e.loadUint(32)!==tk.NFT_REPORT_STATIC_DATA_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadUintBig(256),r=e.loadAddress();return{queryId:t,index:n,collection:r}}zr.loadNftReportStaticDataMessage=XB;var Dr={};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.loadNftOwnerAssignedMessage=Dr.storeNftOwnerAssignedMessage=void 0;const nk=Be;function eM(e){return t=>{const{queryId:n,previousOwner:r,payload:a}=e;t.storeUint(nk.NFT_OWNER_ASSIGNED_OPCODE,32).storeUint(n,64).storeAddress(r).storeMaybeRef(a)}}Dr.storeNftOwnerAssignedMessage=eM;function tM(e){if(e.loadUint(32)!==nk.NFT_OWNER_ASSIGNED_OPCODE)throw new Error("Wrong opcode");const t=e.loadUintBig(64),n=e.loadAddress(),a=e.loadBoolean()?e.loadRef():e.asCell();return{queryId:t,previousOwner:n,payload:a}}Dr.loadNftOwnerAssignedMessage=tM;var Ur={};Object.defineProperty(Ur,"__esModule",{value:!0});Ur.loadNftExcessesMessage=Ur.storeNftExcessesMessage=void 0;const rk=Be;function nM(e){return t=>{const{queryId:n}=e;t.storeUint(rk.NFT_EXCESSES_OPCODE,32).storeUint(n,64)}}Ur.storeNftExcessesMessage=nM;function rM(e){if(e.loadUint(32)!==rk.NFT_EXCESSES_OPCODE)throw new Error("Wrong opcode");return{queryId:e.loadUintBig(64)}}Ur.loadNftExcessesMessage=rM;Object.defineProperty(Jo,"__esModule",{value:!0});Jo.loadNftMessage=void 0;const aM=Rr,oM=Yn,iM=Nr,sM=zr,lM=Dr,Pi=Be,uM=Ur;function cM(e){try{switch(e.preloadUint(32)){case Pi.NFT_TRANSFER_OPCODE:return{kind:"nft_transfer",...(0,oM.loadNftTransferMessage)(e)};case Pi.NFT_OWNER_ASSIGNED_OPCODE:return{kind:"owner_assigned",...(0,lM.loadNftOwnerAssignedMessage)(e)};case Pi.NFT_REPORT_STATIC_DATA_OPCODE:return{kind:"report_static_data",...(0,sM.loadNftReportStaticDataMessage)(e)};case Pi.NFT_GET_STATIC_DATA_OPCODE:return{kind:"get_static_data",...(0,iM.loadNftGetStaticDataMessage)(e)};case Pi.NFT_EXCESSES_OPCODE:return{kind:"excesses",...(0,uM.loadNftExcessesMessage)(e)}}if(e.remainingBits===256+11&&e.remainingRefs===1)return{kind:"nft_deploy",...(0,aM.loadNftDeployMessage)(e)}}catch{}return{kind:"unknown"}}Jo.loadNftMessage=cM;Object.defineProperty(vs,"__esModule",{value:!0});vs.parseNftItemTransaction=void 0;const dM=Jo,fM=Xn;function hM(e){const t=(0,fM.parseTransferTransaction)(e);if(t.kind!=="unknown")return t;if(e.description.type!=="generic")return{kind:"unknown",transaction:e};if(!e.inMessage)return{kind:"unknown",transaction:e};if(e.inMessage.info.type!=="internal")return{kind:"unknown",transaction:e};if(e.description.computePhase.type!=="vm")return{kind:"unknown",transaction:e};if(e.description.computePhase.exitCode!==0)return{kind:"unknown",transaction:e};const n=(0,dM.loadNftMessage)(e.inMessage.body.beginParse());return n.kind==="nft_deploy"?{kind:"deploy",owner:n.owner,content:n.content,collection:e.inMessage.info.src,transaction:e}:n.kind==="nft_transfer"?{kind:"nft_transfer",queryId:n.queryId,newOwner:n.newOwner,customPayload:n.customPayload??null,forwardAmount:n.forwardAmount,forwardPayload:n.forwardPayload??null,transaction:e}:{kind:"unknown",transaction:e}}vs.parseNftItemTransaction=hM;var Fh;function Vd(){if(Fh)return Zr;Fh=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.NftItem=Zr.nftItemConfigToCell=void 0;const e=de,t=Ye,n=Au(),r=Fn,a=Eu,o=Mr,i=Ot,s=Yn,l=vs;function u(d){return(0,e.beginCell)().storeUint(d.index,64).storeAddress(d.collection).endCell()}Zr.nftItemConfigToCell=u;class c{constructor(b,m,p){this.address=b,this.init=m,this.contentResolver=p}static createFromConfig(b,m,p,f){const T={data:u(b),code:m??c.nftCode};return new c((0,e.contractAddress)(p??0,T),T,f)}static createFromAddress(b,m){return new c(b,void 0,m)}async sendDeploy(b,m,p,f){await b.internal(m,{value:f??(0,e.toNano)("0.05"),bounce:!0,body:(0,e.beginCell)().store((0,i.storeNftItemParams)(p)).endCell()})}async send(b,m,p,f){const k=(0,o.parseNotifyOptions)(f==null?void 0:f.notify),T=(0,o.parseExcessReturnOptions)(f==null?void 0:f.returnExcess,m);await b.internal(m,{value:((f==null?void 0:f.value)??(0,e.toNano)("0.05"))+((k==null?void 0:k.amount)??0n),bounce:!0,sendMode:e.SendMode.PAY_GAS_SEPARATELY,body:(0,e.beginCell)().store((0,s.storeNftTransferMessage)({queryId:(f==null?void 0:f.queryId)??0n,newOwner:p,responseDestination:(T==null?void 0:T.address)??null,customPayload:(f==null?void 0:f.customPayload)??null,forwardAmount:(k==null?void 0:k.amount)??0n,forwardPayload:(k==null?void 0:k.payload)??null})).endCell()})}async getData(b){const{stack:m}=await b.get("get_nft_data",[]);return{initialized:m.readBoolean(),index:m.readBigNumber(),collection:m.readAddressOpt(),owner:m.readAddressOpt(),individualContent:m.readCellOpt()}}async getContent(b){if(this.contentResolver===void 0)throw new Error("No content resolver");const{collection:m,individualContent:p,index:f}=await this.getData(b);if(p===null)throw new Error("Individual content is null");let k;return m===null?k=p:k=await b.open(n.NftCollection.createFromAddress(m,this.contentResolver)).getItemContent(f,p),(0,r.parseNftContent)(await(0,t.loadFullContent)(k,this.contentResolver))}async getRoyaltyParams(b){const{collection:m}=await this.getData(b);return m===null?this.getNftItemRoyaltyParams(b):b.open(n.NftCollection.createFromAddress(m,this.contentResolver)).getRoyaltyParams()}async getNftItemRoyaltyParams(b){const{stack:m}=await b.get("get_royalty_params",[]);return{numerator:m.readBigNumber(),denominator:m.readBigNumber(),recipient:m.readAddress()}}async getActions(b,m){let{lt:p,hash:f,limit:k}=m??{};if(!p||!f){const A=await b.getState();if(!A.last)return[];p=A.last.lt,f=A.last.hash}return(await b.getTransactions(this.address,p,f,k)).map(A=>(0,l.parseNftItemTransaction)(A))}}return Zr.NftItem=c,c.nftCode=e.Cell.fromBase64(a.nftItemCode.codeBoc),Zr}var Qn={};Object.defineProperty(Qn,"__esModule",{value:!0});Qn.loadNftCollectionData=Qn.storeNftCollectionData=void 0;const mM=de,ak=Jn;function pM(e){return t=>{t.storeAddress(e.admin),t.storeUint(0,64),t.storeRef(e.content),t.storeRef(e.itemCode),t.storeRef((0,mM.beginCell)().store((0,ak.storeNftRoyaltyParams)(e.royalty)).endCell())}}Qn.storeNftCollectionData=pM;function gM(e){return{admin:e.loadAddress(),content:e.loadRef(),itemCode:e.loadRef(),royalty:(0,ak.loadNftRoyaltyParams)(e)}}Qn.loadNftCollectionData=gM;var js={},Ko={};Object.defineProperty(Ko,"__esModule",{value:!0});Ko.loadNftCollectionMessage=void 0;const zs=Be,yM=Kn,bM=et,kM=Gn,wM=Vn;function vM(e,t){try{switch(e.preloadUint(32)){case zs.NFT_MINT_OPCODE:return{kind:"mint",...(0,yM.loadNftMintMessage)(e,t.load)};case zs.NFT_BATCH_MINT_OPCODE:return{kind:"mint_batch",...(0,bM.loadNftBatchMintMessage)(e,t.load)};case zs.NFT_CHANGE_ADMIN_OPCODE:return{kind:"change_admin",...(0,kM.loadNftChangeAdminMessage)(e)};case zs.NFT_CHANGE_CONTENT_OPCODE:return{kind:"change_content",...(0,wM.loadNftChangeContentMessage)(e)}}}catch{}return{kind:"unknown"}}Ko.loadNftCollectionMessage=vM;Object.defineProperty(js,"__esModule",{value:!0});js.parseNftCollectionTransaction=void 0;const jM=Ko,_M=Ot,CM=Xn;function EM(e){const t=(0,CM.parseTransferTransaction)(e);if(t.kind!=="unknown")return t;if(e.description.type!=="generic")return{kind:"unknown",transaction:e};if(!e.inMessage)return{kind:"unknown",transaction:e};if(e.inMessage.info.type!=="internal")return{kind:"unknown",transaction:e};if(e.description.computePhase.type!=="vm")return{kind:"unknown",transaction:e};if(e.description.computePhase.exitCode!==0)return{kind:"unknown",transaction:e};const n=(0,jM.loadNftCollectionMessage)(e.inMessage.body.beginParse(),(0,_M.createNftItemParamsValue)());return n.kind==="mint"?{kind:"mint",queryId:n.queryId,index:n.itemIndex,owner:n.itemParams.owner,content:n.itemParams.individualContent,transaction:e}:n.kind==="mint_batch"?{kind:"mint_batch",queryId:n.queryId,items:n.requests.map(r=>({index:r.index,owner:r.params.owner,content:r.params.individualContent})),transaction:e}:n.kind==="change_admin"?{kind:"change_owner",queryId:n.queryId,newOwner:n.newAdmin,transaction:e}:n.kind==="change_content"?{kind:"change_content",queryId:n.queryId,newContent:n.newContent,newRoyalty:n.newRoyaltyParams,transaction:e}:{kind:"unknown",transaction:e}}js.parseNftCollectionTransaction=EM;var Lh;function Au(){if(Lh)return Qr;Lh=1,Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.NftCollection=Qr.nftCollectionConfigToCell=void 0;const e=de,t=ws,n=Vd(),r=Qn,a=Ot,o=js;function i(l){var u,c,d;return(0,e.beginCell)().store((0,r.storeNftCollectionData)({admin:l.admin,content:l.content,itemCode:l.itemCode??n.NftItem.nftCode,royalty:{numerator:((u=l.royalty)==null?void 0:u.numerator)??0n,denominator:((c=l.royalty)==null?void 0:c.denominator)??1n,recipient:((d=l.royalty)==null?void 0:d.recipient)??l.admin}})).endCell()}Qr.nftCollectionConfigToCell=i;class s extends t.NftCollectionBase{static createFromConfig(u,c,d,b){const p={data:i(u),code:c??t.NftCollectionBase.code};return new s((0,e.contractAddress)(d??0,p),p,b,(0,a.createNftItemParamsValue)())}static createFromAddress(u,c){return new s(u,void 0,c,(0,a.createNftItemParamsValue)())}async getItem(u,c){const d=await this.getItemAddress(u,c);return u.open(new n.NftItem(d,void 0,this.contentResolver))}async getRoyaltyParams(u){const{stack:c}=await u.get("royalty_params",[]);return{numerator:c.readBigNumber(),denominator:c.readBigNumber(),recipient:c.readAddress()}}async getActions(u,c){let{lt:d,hash:b,limit:m}=c??{};if(!d||!b){const f=await u.getState();if(!f.last)return[];d=f.last.lt,b=f.last.hash}return(await u.getTransactions(this.address,d,b,m)).map(f=>(0,o.parseNftCollectionTransaction)(f))}}return Qr.NftCollection=s,Qr}var Ua={},xo={},Su={};Object.defineProperty(Su,"__esModule",{value:!0});Su.sbtItemCode=void 0;Su.sbtItemCode={codeBoc:"te6ccgECEwEAAzsAART/APSkE/S88sgLAQIBYgIDAgLOBAUCASAPEAS9RsIiDHAJFb4AHQ0wP6QDDwAvhCs44cMfhDAccF8uGV+kAB+GTUAfhm+kAw+GVw+GfwA+AC0x8CcbDjAgHTP4IQ0MO/6lIwuuMCghAE3tFIUjC64wIwghAvyyaiUiC6gGBwgJAgEgDQ4AlDAx0x+CEAUkx64Suo450z8wgBD4RHCCEMGOhtJVA22AQAPIyx8Syz8hbrOTAc8XkTHiyXEFyMsFUATPFlj6AhPLaszJAfsAkTDiAMJsEvpA1NMAMPhH+EHIy/9QBs8W+ETPFhLMFMs/UjDLAAPDAJb4RlADzALegBB4sXCCEA3WB+NANRSAQAPIyx8Syz8hbrOTAc8XkTHiyXEFyMsFUATPFlj6AhPLaszJAfsAAMYy+ERQA8cF8uGR+kDU0wAw+Ef4QcjL//hEzxYTzBLLP1IQywABwwCU+EYBzN6AEHixcIIQBSTHrkBVA4BAA8jLHxLLPyFus5MBzxeRMeLJcQXIywVQBM8WWPoCE8tqzMkB+wAD+o5AMfhByMv/+EPPFoAQcIIQi3cXNUAVUEQDgEADyMsfEss/IW6zkwHPF5Ex4slxBcjLBVAEzxZY+gITy2rMyQH7AOCCEB8EU3pSILrjAoIQb4n141Iguo4WW/hFAccF8uGR+EfAAPLhk/gj+GfwA+CCENE207NSILrjAjAxCgsMAJIx+EQixwXy4ZGAEHCCENUydtsQJFUCbYMGA8jLHxLLPyFus5MBzxeRMeLJcQXIywVQBM8WWPoCE8tqzMkB+wCLAvhkiwL4ZfADAI4x+EQixwXy4ZGCCvrwgHD7AoAQcIIQ1TJ22xAkVQJtgwYDyMsfEss/IW6zkwHPF5Ex4slxBcjLBVAEzxZY+gITy2rMyQH7AAAgghBfzD0UupPywZ3ehA/y8ABhO1E0NM/Afhh+kAB+GNw+GIg10nCAI4Wf/hi+kAB+GTUAfhm+kAB+GXTPzD4Z5Ew4oAA3PhH+Eb4QcjLP/hDzxb4RM8WzPhFzxbLP8ntVIAIBWBESAB28fn+AF8IXwg/CH8InwjQADbVjHgBfCLAADbewfgBfCPA="};var It={};Object.defineProperty(It,"__esModule",{value:!0});It.createSbtItemParamsValue=It.loadSbtItemParams=It.storeSbtItemParams=void 0;const AM=de;function ok(e){return t=>{t.storeAddress(e.owner),typeof e.individualContent=="string"?t.storeRef((0,AM.beginCell)().storeStringTail(e.individualContent).endCell()):t.storeRef(e.individualContent),t.storeAddress(e.authority)}}It.storeSbtItemParams=ok;function ik(e){const t=e.loadAddress(),n=e.loadRef(),r=e.loadMaybeAddress();return{owner:t,individualContent:n,authority:r}}It.loadSbtItemParams=ik;function SM(){return{store:ok,load:ik}}It.createSbtItemParamsValue=SM;var _s={};Object.defineProperty(_s,"__esModule",{value:!0});_s.parseSbtItemTransaction=void 0;const TM=Jo,PM=Xn;function BM(e){const t=(0,PM.parseTransferTransaction)(e);if(t.kind!=="unknown")return t;if(e.description.type!=="generic")return{kind:"unknown",transaction:e};if(!e.inMessage)return{kind:"unknown",transaction:e};if(e.inMessage.info.type!=="internal")return{kind:"unknown",transaction:e};if(e.description.computePhase.type!=="vm")return{kind:"unknown",transaction:e};if(e.description.computePhase.exitCode!==0)return{kind:"unknown",transaction:e};const n=(0,TM.loadNftMessage)(e.inMessage.body.beginParse());return n.kind==="nft_deploy"?{kind:"sbt_deploy",owner:n.owner,content:n.content,collection:e.inMessage.info.src,transaction:e}:{kind:"unknown",transaction:e}}_s.parseSbtItemTransaction=BM;Object.defineProperty(xo,"__esModule",{value:!0});xo.SbtItem=xo.sbtItemConfigToCell=void 0;const Di=de,MM=Ye,xM=Au(),OM=Fn,IM=Su,RM=It,NM=_s;function sk(e){return(0,Di.beginCell)().storeUint(e.index,64).storeAddress(e.collection).endCell()}xo.sbtItemConfigToCell=sk;class lo{constructor(t,n,r){this.address=t,this.init=n,this.contentResolver=r}static createFromConfig(t,n,r,a){const i={data:sk(t),code:n??lo.sbtCode};return new lo((0,Di.contractAddress)(r??0,i),i,a)}static createFromAddress(t,n){return new lo(t,void 0,n)}async sendDeploy(t,n,r,a){await t.internal(n,{value:a??(0,Di.toNano)("0.03"),bounce:!0,body:(0,Di.beginCell)().store((0,RM.storeSbtItemParams)(r)).endCell()})}async getData(t){const{stack:n}=await t.get("get_nft_data",[]);return{initialized:n.readBoolean(),index:n.readBigNumber(),collection:n.readAddressOpt(),owner:n.readAddressOpt(),individualContent:n.readCellOpt()}}async getContent(t){if(this.contentResolver===void 0)throw new Error("No content resolver");const{collection:n,individualContent:r,index:a}=await this.getData(t);if(r===null)throw new Error("Individual content is null");let o;return n===null?o=r:o=await t.open(xM.NftCollection.createFromAddress(n,this.contentResolver)).getItemContent(a,r),(0,OM.parseNftContent)(await(0,MM.loadFullContent)(o,this.contentResolver))}async getActions(t,n){let{lt:r,hash:a,limit:o}=n??{};if(!r||!a){const s=await t.getState();if(!s.last)return[];r=s.last.lt,a=s.last.hash}return(await t.getTransactions(this.address,r,a,o)).map(s=>(0,NM.parseSbtItemTransaction)(s))}}xo.SbtItem=lo;lo.sbtCode=Di.Cell.fromBase64(IM.sbtItemCode.codeBoc);var Cs={};Object.defineProperty(Cs,"__esModule",{value:!0});Cs.parseSbtCollectionTransaction=void 0;const zM=It,DM=Ko;function UM(e){if(e.description.type!=="generic")return{kind:"unknown",transaction:e};if(!e.inMessage)return{kind:"unknown",transaction:e};if(e.inMessage.info.type!=="internal")return{kind:"unknown",transaction:e};if(e.description.computePhase.type!=="vm")return{kind:"unknown",transaction:e};if(e.description.computePhase.exitCode!==0)return{kind:"unknown",transaction:e};const t=(0,DM.loadNftCollectionMessage)(e.inMessage.body.beginParse(),(0,zM.createSbtItemParamsValue)());return t.kind==="mint"?{kind:"mint",index:t.itemIndex,owner:t.itemParams.owner,content:t.itemParams.individualContent,authority:t.itemParams.authority,transaction:e}:t.kind==="mint_batch"?{kind:"mint_batch",items:t.requests.map(n=>({index:n.index,owner:n.params.owner,content:n.params.individualContent,authority:n.params.authority})),transaction:e}:t.kind==="change_admin"?{kind:"change_owner",newOwner:t.newAdmin,transaction:e}:t.kind==="change_content"?{kind:"change_content",newContent:t.newContent,newRoyalty:t.newRoyaltyParams,transaction:e}:{kind:"unknown",transaction:e}}Cs.parseSbtCollectionTransaction=UM;Object.defineProperty(Ua,"__esModule",{value:!0});Ua.SbtCollection=Ua.sbtCollectionConfigToCell=void 0;const lk=de,FM=ws,uk=xo,LM=Cs,qM=Qn,qh=It;function ck(e){return(0,lk.beginCell)().store((0,qM.storeNftCollectionData)({admin:e.admin,content:e.content,itemCode:e.itemCode??uk.SbtItem.sbtCode,royalty:{numerator:0n,denominator:1n,recipient:e.admin}})).endCell()}Ua.sbtCollectionConfigToCell=ck;class Ui extends FM.NftCollectionBase{static createFromConfig(t,n,r,a){const i={data:ck(t),code:n??Ui.code};return new Ui((0,lk.contractAddress)(r??0,i),i,a,(0,qh.createSbtItemParamsValue)())}static createFromAddress(t,n){return new Ui(t,void 0,n,(0,qh.createSbtItemParamsValue)())}async getItem(t,n){const r=await this.getItemAddress(t,n);return t.open(new uk.SbtItem(r,void 0,this.contentResolver))}async getActions(t,n){let{lt:r,hash:a,limit:o}=n??{};if(!r||!a){const s=await t.getState();if(!s.last)return[];r=s.last.lt,a=s.last.hash}return(await t.getTransactions(this.address,r,a,o)).map(s=>(0,LM.parseSbtCollectionTransaction)(s))}}Ua.SbtCollection=Ui;var Es={};Object.defineProperty(Es,"__esModule",{value:!0});Es.NftSale=void 0;const We=de;class uo{constructor(t,n){this.address=t,this.init=n}static createFromConfig(t,n,r){const o={data:(0,We.beginCell)().storeBit(!1).storeUint(t.createdAt,32).storeAddress(t.marketplace).storeAddress(t.nft).storeAddress(null).storeCoins(t.fullPrice).storeRef((0,We.beginCell)().storeAddress(t.marketplaceFeeTo).storeCoins(t.marketplaceFee).storeAddress(t.royaltyTo).storeCoins(t.royalty)).storeBit(t.canDeployByExternal).endCell(),code:n??uo.code};return new uo((0,We.contractAddress)(r??0,o),o)}static createFromAddress(t){return new uo(t)}async sendDeploy(t,n,r){await t.internal(n,{value:r??(0,We.toNano)("1"),bounce:!0,sendMode:We.SendMode.PAY_GAS_SEPARATELY})}async sendDeployExternal(t){await t.external(new We.Cell)}async sendTopup(t,n,r){await t.internal(n,{value:(r==null?void 0:r.value)??(0,We.toNano)("0.05"),bounce:!0,sendMode:We.SendMode.PAY_GAS_SEPARATELY,body:(0,We.beginCell)().storeUint(1,32).storeUint((r==null?void 0:r.queryId)??0,64).endCell()})}async sendAdminMessage(t,n,r,a,o){const i=(0,We.beginCell)().storeUint(555,32).storeUint(o??0,64);r.message instanceof We.Cell?i.storeRef(i):i.storeRef((0,We.beginCell)().store((0,We.storeMessageRelaxed)(r.message))),await t.internal(n,{value:a??(0,We.toNano)("0.05"),bounce:!0,sendMode:We.SendMode.PAY_GAS_SEPARATELY,body:i.storeUint(r.sendMode,8).endCell()})}async sendCancel(t,n,r){const{isComplete:a}=await this.getData(t);if(a)throw new Error("Sale is complete");await t.internal(n,{value:(r==null?void 0:r.value)??(0,We.toNano)("1"),bounce:!0,sendMode:We.SendMode.PAY_GAS_SEPARATELY,body:(0,We.beginCell)().storeUint(3,32).storeUint((r==null?void 0:r.queryId)??0,64).endCell()})}async sendBuy(t,n,r){const{isComplete:a,nftOwner:o,fullPrice:i}=await this.getData(t);if(!a)throw new Error("Sale is not complete");if(o===null)throw new Error("NFT owner is not set");await t.internal(n,{value:(r==null?void 0:r.value)??i+(0,We.toNano)(1),bounce:!0,sendMode:We.SendMode.PAY_GAS_SEPARATELY,body:(0,We.beginCell)().storeUint(2,32).storeUint((r==null?void 0:r.queryId)??0,64).endCell()})}async getData(t){const{stack:n}=await t.get("get_sale_data",[]);return{type:n.readNumber(),isComplete:n.readBoolean(),createdAt:n.readNumber(),marketplace:n.readAddress(),nft:n.readAddress(),nftOwner:n.readAddressOpt(),fullPrice:n.readBigNumber(),marketplaceFeeTo:n.readAddress(),marketplaceFee:n.readBigNumber(),royaltyTo:n.readAddressOpt(),royalty:n.readBigNumber()}}}Es.NftSale=uo;uo.code=We.Cell.fromBase64("te6cckECCwEAArkAART/APSkE/S88sgLAQIBIAMCAH7yMO1E0NMA0x/6QPpA+kD6ANTTADDAAY4d+ABwB8jLABbLH1AEzxZYzxYBzxYB+gLMywDJ7VTgXweCAP/+8vACAUgFBABXoDhZ2omhpgGmP/SB9IH0gfQBqaYAYGGh9IH0AfSB9ABhBCCMkrCgFYACqwECAs0IBgH3ZghA7msoAUmCgUjC+8uHCJND6QPoA+kD6ADBTkqEhoVCHoRagUpBwgBDIywVQA88WAfoCy2rJcfsAJcIAJddJwgKwjhdQRXCAEMjLBVADzxYB+gLLaslx+wAQI5I0NOJacIAQyMsFUAPPFgH6AstqyXH7AHAgghBfzD0UgcAlsjLHxPLPyPPFlADzxbKAIIJycOA+gLKAMlxgBjIywUmzxZw+gLLaszJgwb7AHFVUHAHyMsAFssfUATPFljPFgHPFgH6AszLAMntVAH30A6GmBgLjYSS+CcH0gGHaiaGmAaY/9IH0gfSB9AGppgBgYOCmE44BgAEqYhOmPhW8Q4YBKGATpn8cIxbMbC3MbK2QV44LJOZlvKAVxFWAAyS+G8BJrpOEBFcCBFd0VYACRWdjYKdxjgthOjq+G6hhoaYPqGAD9gHAU4ADAkB6PLRlLOOQjEzOTlTUscFkl8J4FFRxwXy4fSCEAUTjZEWuvLh9QP6QDBGUBA0WXAHyMsAFssfUATPFljPFgHPFgH6AszLAMntVOAwNyjAA+MCKMAAnDY3EDhHZRRDMHDwBeAIwAKYVUQQJBAj8AXgXwqED/LwCgDUODmCEDuaygAYvvLhyVNGxwVRUscFFbHy4cpwIIIQX8w9FCGAEMjLBSjPFiH6Astqyx8Vyz8nzxYnzxYUygAj+gITygDJgwb7AHFQZkUVBHAHyMsAFssfUATPFljPFgHPFgH6AszLAMntVOBqUYM=");var As={};Object.defineProperty(As,"__esModule",{value:!0});As.NoopStorage=void 0;class $M{async uploadFile(t){throw new Error("No storage provider configured")}}As.NoopStorage=$M;var Ge={},$h;function WM(){if($h)return Ge;$h=1;var e=re&&re.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.retry=Ge.formatAddressLink=Ge.formatAddress=Ge.printAddress=Ge.printInfo=Ge.createEnv=Ge.createContentResolver=Ge.createStorageEnv=void 0;const t=de,n=Pk(),r=Ye,a=e(qi),o=e(qi);function i(){if({}.STORAGE_TYPE===void 0)throw new Error("No STORAGE_TYPE in env!");if({}.STORAGE_TYPE==="pinata"){if({}.PINATA_API_KEY===void 0)throw new Error("No PINATA_API_KEY in env!");if({}.PINATA_SECRET_KEY===void 0)throw new Error("No PINATA_SECRET_KEY in env!");return new n.PinataStorage({}.PINATA_API_KEY,{}.PINATA_SECRET_KEY)}else if({}.STORAGE_TYPE==="s3"){if({}.S3_ACCESS_KEY_ID===void 0)throw new Error("No S3_ACCESS_KEY_ID in env!");if({}.S3_SECRET_ACCESS_KEY===void 0)throw new Error("No S3_SECRET_ACCESS_KEY in env!");if({}.S3_BUCKET===void 0)throw new Error("No S3_BUCKET in env!");return new n.S3Storage({}.S3_ACCESS_KEY_ID,{}.S3_SECRET_ACCESS_KEY,{}.S3_BUCKET)}throw new Error(`Unknown storage type: ${{}.STORAGE_TYPE}`)}Ge.createStorageEnv=i;function s(){if({}.IPFS_GATEWAY_TYPE===void 0)throw new Error("No IPFS_GATEWAY_TYPE in env!");if({}.IPFS_GATEWAY_TYPE==="ipfs.io")return new r.DefaultContentResolver(p=>`https://ipfs.io/ipfs/${p}`);if({}.IPFS_GATEWAY_TYPE==="https"){if({}.IPFS_GATEWAY===void 0)throw new Error("No IPFS_GATEWAY in env!");const p=new URL({}.IPFS_GATEWAY);return new r.DefaultContentResolver(f=>(p.pathname="/ipfs/"+f,p.toString()))}if({}.IPFS_GATEWAY_TYPE==="pinata"){if({}.IPFS_GATEWAY===void 0)throw new Error("No IPFS_GATEWAY in env!");if({}.IPFS_GATEWAY_API_KEY===void 0)throw new Error("No IPFS_GATEWAY_API_KEY in env!");const p=new URL({}.IPFS_GATEWAY);return new r.DefaultContentResolver(f=>(p.pathname="/ipfs/"+f,p.searchParams.set("pinataGatewayToken",{}.IPFS_GATEWAY_API_KEY),p.toString()))}throw new Error(`Unknown IPFS gateway type: ${{}.IPFS_GATEWAY_TYPE}`)}Ge.createContentResolver=s;async function l(){if({}.WALLET_TYPE===void 0)throw new Error("No WALLET_TYPE in env!");if({}.WALLET_TYPE!=="highload-v2")throw new Error(`Unknown wallet type: ${{}.WALLET_TYPE}`);if({}.MNEMONIC===void 0)throw new Error("No MNEMONIC in env!");if({}.NETWORK===void 0)throw new Error("No NETWORK in env!");if({}.NETWORK!=="mainnet"&&{}.NETWORK!=="testnet")throw new Error(`Unknown network: ${{}.NETWORK}`);const p=s(),f=i(),k=await(0,n.createApi)({}.NETWORK),T=await(0,n.importKey)({}.MNEMONIC),{publicKey:A,secretKey:y}=T,h=await(0,n.createWallet)({}.WALLET_TYPE,A),C=k.open(h).sender(T.secretKey);return{sdk:n.AssetsSDK.create({storage:f,api:k,sender:C,contentResolver:p}),network:{}.NETWORK,storage:f,sender:C,client:k}}Ge.createEnv=l;function u(p,f){var A;const k=Object.keys(p),T=[];for(const y of k){let h=p[y];if(typeof h=="string")h=a.default.green(h);else if(typeof h=="bigint")h=a.default.yellow(h.toString());else if(typeof h=="number")h=a.default.cyan(h);else if(typeof h=="boolean")h=a.default.blue(h);else if(h===null)h=a.default.red("null");else if(h===void 0)h=a.default.red("undefined");else if(t.Address.isAddress(h))h=`${a.default.magenta(d(h,f))} ${a.default.blue(b(h,f))}`;else if(h instanceof t.Cell)h=a.default.blue(h.toString("base64"));else throw new Error(`Unknown type: ${typeof h}`);T.push([y,h])}console.log((0,o.default)(T.filter(([y])=>y!=="name").map(([y,h])=>`${a.default.bold(y)}: ${h}`).join(` +`),{padding:{top:0,bottom:0,left:1,right:1},borderStyle:"round",borderColor:"green",title:(A=T.find(([y,h])=>y==="name"))==null?void 0:A[1]}))}Ge.printInfo=u;function c(p,f,k="wallet"){const T=d(p,f),A=b(p,f);console.log(`Your ${k} has the address ${T} +You can view it at ${A}`)}Ge.printAddress=c;function d(p,f){return p?p.toString({testOnly:f==="testnet",bounceable:!0}):"null"}Ge.formatAddress=d;function b(p,f){return p?`https://${f==="testnet"?"testnet.":""}tonviewer.com/${d(p,f)}`:"null"}Ge.formatAddressLink=b;async function m(p,f){let{retries:k,delay:T,name:A}={retries:3,delay:1e3,...f};for(let y=0;ysetTimeout(h,T*2**y))}throw new Error("Exceeded number of retries")}return Ge.retry=m,Ge}var Wh;function HM(){if(Wh)return Ti;Wh=1,Object.defineProperty(Ti,"__esModule",{value:!0}),Ti.AssetsSDK=void 0;const e=de,t=ms,n=ps,r=Pr,a=Fn,o=Zt,i=Br,s=Da,l=Au(),u=Vd(),c=Ua,d=Ye,b=Es,m=As,p=WM(),f=0;class k{constructor(A,y,h,C){this.storage=A,this.api=y,this.sender=h,this.contentResolver=C}static create(A){let{api:y,storage:h,sender:C,contentResolver:_}=A;return h?"pinataApiKey"in h?h=t.PinataStorage.create(h):"s3AccessKeyId"in h&&(h=n.S3Storage.create(h)):h=new m.NoopStorage,_??(_=new d.DefaultContentResolver),new k(h,y,C,_)}async deployJetton(A,y){var H;if(!this.sender)throw new Error("Sender must be defined");const h=(y==null?void 0:y.adminAddress)??((H=this.sender)==null?void 0:H.address);if(h===void 0)throw new Error("Admin address must be defined in options or be available in Sender");const C=s.JettonMinter.createFromConfig({admin:h,content:await this.contentToCell((0,r.jettonContentToInternal)(A),(y==null?void 0:y.onchainContent)??!1)},s.JettonMinter.code,f,this.contentResolver),_=this.api.open(C),x=y==null?void 0:y.premintAmount;return typeof x=="bigint"&&x>0n?await _.sendMint(this.sender,h,x,{...y==null?void 0:y.premintOptions,value:y==null?void 0:y.value,queryId:y==null?void 0:y.queryId}):await _.sendDeploy(this.sender,y==null?void 0:y.value),_}openJetton(A){return this.api.open(s.JettonMinter.createFromAddress(A,this.contentResolver))}async deployNftCollection(A,y){var _,x;if(!this.sender)throw new Error("Sender must be defined");const h=(y==null?void 0:y.adminAddress)??((_=this.sender)==null?void 0:_.address);if(h===void 0)throw new Error("Admin address must be defined in options or be available in Sender");const C=this.api.open(l.NftCollection.createFromConfig({admin:h,content:(0,e.beginCell)().storeRef(await this.contentToCell((0,a.nftContentToInternal)(A.collectionContent),(y==null?void 0:y.onchainContent)??!1)).storeRef((0,e.beginCell)().storeStringTail(A.commonContent)).endCell(),royalty:y==null?void 0:y.royaltyParams},l.NftCollection.code,f,this.contentResolver));return typeof((x=y==null?void 0:y.premintItems)==null?void 0:x.length)=="number"&&(y==null?void 0:y.premintItems.length)>0?await C.sendBatchMint(this.sender,y==null?void 0:y.premintItems,{value:y==null?void 0:y.value,queryId:y==null?void 0:y.queryId}):await C.sendDeploy(this.sender,y==null?void 0:y.value),C}openNftCollection(A){return this.api.open(l.NftCollection.createFromAddress(A,this.contentResolver))}async deploySbtCollection(A,y){var _,x;if(!this.sender)throw new Error("Sender must be defined");const h=(y==null?void 0:y.adminAddress)??((_=this.sender)==null?void 0:_.address);if(h===void 0)throw new Error("Admin address must be defined in options or be available in Sender");const C=this.api.open(c.SbtCollection.createFromConfig({admin:h,content:(0,e.beginCell)().storeRef(await this.contentToCell((0,a.nftContentToInternal)(A.collectionContent),(A==null?void 0:A.onchainContent)??!1)).storeRef((0,e.beginCell)().storeStringTail(A.commonContent)).endCell()},c.SbtCollection.code,f,this.contentResolver));return typeof((x=y==null?void 0:y.premintItems)==null?void 0:x.length)=="number"&&(y==null?void 0:y.premintItems.length)>0?await C.sendBatchMint(this.sender,y==null?void 0:y.premintItems,{value:y==null?void 0:y.value,queryId:y==null?void 0:y.queryId}):await C.sendDeploy(this.sender,y==null?void 0:y.value),C}openSbtCollection(A){return this.api.open(c.SbtCollection.createFromAddress(A,this.contentResolver))}openJettonWallet(A){return this.api.open(new i.JettonWallet(A))}openNftItem(A){return this.api.open(new u.NftItem(A,void 0,this.contentResolver))}async deployNftSale(A){var C;if(!this.sender)throw new Error("Sender must be defined");if((A.marketplace??((C=this.sender)==null?void 0:C.address))===void 0)throw new Error("Marketplace address must be defined in options or be available in Sender");const h=this.api.open(b.NftSale.createFromConfig({createdAt:A.createdAt??Math.floor(Date.now()/1e3),marketplace:A.marketplace??null,nft:A.nft,fullPrice:A.fullPrice,marketplaceFeeTo:A.marketplaceFeeTo??null,marketplaceFee:A.marketplaceFee??0n,royaltyTo:A.royaltyTo??null,royalty:A.royalty??0n,canDeployByExternal:A.canDeployByExternal??!0}));return await h.sendTopup(this.sender,{value:A.value,queryId:A.queryId}),h}openNftSale(A){return this.api.open(b.NftSale.createFromAddress(A))}async internalOffchainContentToCell(A){const y=Buffer.from(JSON.stringify(A),"utf-8"),h=await(0,p.retry)(()=>this.storage.uploadFile(y),{name:"upload content"});return(0,e.beginCell)().storeUint(1,8).storeStringTail(h).endCell()}async contentToCell(A,y){return y?(0,o.internalOnchainContentToCell)(A):await this.internalOffchainContentToCell(A)}}return Ti.AssetsSDK=k,Ti}var Ss={},Lt={},Tu={},nt=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global||{},pt={searchParams:"URLSearchParams"in nt,iterable:"Symbol"in nt&&"iterator"in Symbol,blob:"FileReader"in nt&&"Blob"in nt&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in nt,arrayBuffer:"ArrayBuffer"in nt};function VM(e){return e&&DataView.prototype.isPrototypeOf(e)}if(pt.arrayBuffer)var JM=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],KM=ArrayBuffer.isView||function(e){return e&&JM.indexOf(Object.prototype.toString.call(e))>-1};function Go(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||e==="")throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function Jd(e){return typeof e!="string"&&(e=String(e)),e}function Kd(e){var t={next:function(){var n=e.shift();return{done:n===void 0,value:n}}};return pt.iterable&&(t[Symbol.iterator]=function(){return t}),t}function Qe(e){this.map={},e instanceof Qe?e.forEach(function(t,n){this.append(n,t)},this):Array.isArray(e)?e.forEach(function(t){if(t.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}Qe.prototype.append=function(e,t){e=Go(e),t=Jd(t);var n=this.map[e];this.map[e]=n?n+", "+t:t};Qe.prototype.delete=function(e){delete this.map[Go(e)]};Qe.prototype.get=function(e){return e=Go(e),this.has(e)?this.map[e]:null};Qe.prototype.has=function(e){return this.map.hasOwnProperty(Go(e))};Qe.prototype.set=function(e,t){this.map[Go(e)]=Jd(t)};Qe.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)};Qe.prototype.keys=function(){var e=[];return this.forEach(function(t,n){e.push(n)}),Kd(e)};Qe.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),Kd(e)};Qe.prototype.entries=function(){var e=[];return this.forEach(function(t,n){e.push([n,t])}),Kd(e)};pt.iterable&&(Qe.prototype[Symbol.iterator]=Qe.prototype.entries);function lc(e){if(!e._noBody){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}}function dk(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function GM(e){var t=new FileReader,n=dk(t);return t.readAsArrayBuffer(e),n}function YM(e){var t=new FileReader,n=dk(t),r=/charset=([A-Za-z0-9_-]+)/.exec(e.type),a=r?r[1]:"utf-8";return t.readAsText(e,a),n}function QM(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?t:e}function Fa(e,t){if(!(this instanceof Fa))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t=t||{};var n=t.body;if(e instanceof Fa){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new Qe(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!n&&e._bodyInit!=null&&(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",(t.headers||!this.headers)&&(this.headers=new Qe(t.headers)),this.method=XM(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in nt){var o=new AbortController;return o.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),(this.method==="GET"||this.method==="HEAD")&&(t.cache==="no-store"||t.cache==="no-cache")){var r=/([?&])_=[^&]*/;if(r.test(this.url))this.url=this.url.replace(r,"$1_="+new Date().getTime());else{var a=/\?/;this.url+=(a.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}Fa.prototype.clone=function(){return new Fa(this,{body:this._bodyInit})};function ex(e){var t=new FormData;return e.trim().split("&").forEach(function(n){if(n){var r=n.split("="),a=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(a),decodeURIComponent(o))}}),t}function tx(e){var t=new Qe,n=e.replace(/\r?\n[\t ]+/g," ");return n.split("\r").map(function(r){return r.indexOf(` +`)===0?r.substr(1,r.length):r}).forEach(function(r){var a=r.split(":"),o=a.shift().trim();if(o){var i=a.join(":").trim();try{t.append(o,i)}catch(s){console.warn("Response "+s.message)}}}),t}fk.call(Fa.prototype);function wn(e,t){if(!(this instanceof wn))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=t.status===void 0?200:t.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText===void 0?"":""+t.statusText,this.headers=new Qe(t.headers),this.url=t.url||"",this._initBody(e)}fk.call(wn.prototype);wn.prototype.clone=function(){return new wn(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Qe(this.headers),url:this.url})};wn.error=function(){var e=new wn(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var nx=[301,302,303,307,308];wn.redirect=function(e,t){if(nx.indexOf(t)===-1)throw new RangeError("Invalid status code");return new wn(null,{status:t,headers:{location:e}})};var na=nt.DOMException;try{new na}catch{na=function(t,n){this.message=t,this.name=n;var r=Error(t);this.stack=r.stack},na.prototype=Object.create(Error.prototype),na.prototype.constructor=na}function hk(e,t){return new Promise(function(n,r){var a=new Fa(e,t);if(a.signal&&a.signal.aborted)return r(new na("Aborted","AbortError"));var o=new XMLHttpRequest;function i(){o.abort()}o.onload=function(){var u={statusText:o.statusText,headers:tx(o.getAllResponseHeaders()||"")};a.url.indexOf("file://")===0&&(o.status<200||o.status>599)?u.status=200:u.status=o.status,u.url="responseURL"in o?o.responseURL:u.headers.get("X-Request-URL");var c="response"in o?o.response:o.responseText;setTimeout(function(){n(new wn(c,u))},0)},o.onerror=function(){setTimeout(function(){r(new TypeError("Network request failed"))},0)},o.ontimeout=function(){setTimeout(function(){r(new TypeError("Network request timed out"))},0)},o.onabort=function(){setTimeout(function(){r(new na("Aborted","AbortError"))},0)};function s(u){try{return u===""&&nt.location.href?nt.location.href:u}catch{return u}}if(o.open(a.method,s(a.url),!0),a.credentials==="include"?o.withCredentials=!0:a.credentials==="omit"&&(o.withCredentials=!1),"responseType"in o&&(pt.blob?o.responseType="blob":pt.arrayBuffer&&(o.responseType="arraybuffer")),t&&typeof t.headers=="object"&&!(t.headers instanceof Qe||nt.Headers&&t.headers instanceof nt.Headers)){var l=[];Object.getOwnPropertyNames(t.headers).forEach(function(u){l.push(Go(u)),o.setRequestHeader(u,Jd(t.headers[u]))}),a.headers.forEach(function(u,c){l.indexOf(c)===-1&&o.setRequestHeader(c,u)})}else a.headers.forEach(function(u,c){o.setRequestHeader(c,u)});a.signal&&(a.signal.addEventListener("abort",i),o.onreadystatechange=function(){o.readyState===4&&a.signal.removeEventListener("abort",i)}),o.send(typeof a._bodyInit>"u"?null:a._bodyInit)})}hk.polyfill=!0;nt.fetch||(nt.fetch=hk,nt.Headers=Qe,nt.Request=Fa,nt.Response=wn);self.fetch.bind(self);var rx=re&&re.__awaiter||function(e,t,n,r){function a(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function s(c){try{u(r.next(c))}catch(d){i(d)}}function l(c){try{u(r.throw(c))}catch(d){i(d)}}function u(c){c.done?o(c.value):a(c.value).then(s,l)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(Tu,"__esModule",{value:!0});Tu.Nodes=void 0;class ax{constructor(){this.nodeIndex=-1,this.committee=new Set,this.topology=[],this.initTime=0}init(t){return rx(this,void 0,void 0,function*(){this.nodeIndex=-1,this.committee.clear(),this.topology=[],this.initTime=Date.now();let n=[];try{n=yield(yield fetch(t)).json()}catch(r){throw new Error(`exception in fetch(${t}): ${r}`)}for(const r of n)r.Healthy==="1"&&this.topology.push(r);if(this.topology.length===0)throw new Error(`no healthy nodes in ${t}`)})}getHealthyFor(t){var n;const r=[];for(const a of this.topology)a.Weight>0&&(!((n=a.Mngr)===null||n===void 0)&&n.health[t])&&r.push(a);return r}}Tu.Nodes=ax;const ox="@orbs-network/ton-access",ix="2.3.3",sx="Unthrottled anonymous RPC access to TON blockchain via a robust decentralized network",lx="lib/index.js",ux="lib/index.js",cx="lib/index.d.ts",dx=["lib/**/*"],fx={test:"env mocha -r ts-node/register test/**/*.ts","test:v2":"env mocha -r ts-node/register test/ton-v2.ts","test:v4":"env mocha -r ts-node/register test/ton-v4.ts",cleanup:"rimraf ./lib","build:web:reg":"esbuild ./lib/web.js --bundle --sourcemap --target=es2015 --outfile=./dist/index.js","build:web:min":"esbuild ./lib/web.js --bundle --minify --target=es2015 --outfile=./dist/index.min.js","build:web":"rimraf ./dist && npm run build:web:reg && npm run build:web:min",build:"npm run lint && rimraf ./lib && tsc && npm run build:web",format:'prettier --write "src/**/*.ts"',lint:"tslint -p tsconfig.json",prepare:"npm run build",prepublishOnly:"npm test && npm run lint",preversion:"npm run lint",version:"npm run format && git add -A src",postversion:"git push && git push --tags"},hx={type:"git",url:"git+https://github.com/orbs-network/ton-access.git"},mx="yuval@orbs.com",px="MIT",gx={url:"https://github.com/orbs-network/ton-access/issues"},yx="https://github.com/orbs-network/ton-access#readme",bx={"isomorphic-fetch":"^3.0.0"},kx={"@types/bn.js":"^5.1.1","@types/chai":"^4.3.4","@types/isomorphic-fetch":"^0.0.36","@types/mocha":"^10.0.0",buffer:"^6.0.3",chai:"^4.3.7",esbuild:"^0.15.14",mocha:"^10.1.0",prettier:"^2.7.1",rimraf:"^3.0.2",ton:"^12.1.3","ton-lite-client":"npm:@truecarry/ton-lite-client@^1.6.1",tonweb:"^0.0.58","ts-node":"^10.9.1",tslib:"^2.4.0",tslint:"^6.1.3","tslint-config-prettier":"^1.18.0"},wx={name:ox,version:ix,description:sx,source:lx,main:ux,types:cx,files:dx,scripts:fx,repository:hx,author:mx,license:px,bugs:gx,homepage:yx,dependencies:bx,devDependencies:kx};var Yo=re&&re.__awaiter||function(e,t,n,r){function a(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function s(c){try{u(r.next(c))}catch(d){i(d)}}function l(c){try{u(r.throw(c))}catch(d){i(d)}}function u(c){c.done?o(c.value):a(c.value).then(s,l)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(Lt,"__esModule",{value:!0});Lt.getHttpV4Endpoint=Lt.getHttpV4Endpoints=Lt.getHttpEndpoint=Lt.getHttpEndpoints=Lt.Access=void 0;const vx=Tu;class mk{constructor(){this.host="ton.access.orbs.network",this.urlVersion=1,this.nodes=new vx.Nodes}init(){return Yo(this,void 0,void 0,function*(){const t=wx;yield this.nodes.init(`https://${this.host}/mngr/nodes?npm_version=${t.version}`)})}makeProtonet(t,n){let r="";switch(t){case"toncenter-api-v2":r+="v2-";break;case"ton-api-v4":r+="v4-";break}return r+=n,r}weightedRandom(t){let n=0;for(const o of t)n+=o.Weight;const r=Math.floor(Math.random()*n);let a=0;for(const o of t){if(r>=a&&r{await this.sendTransferAndWait(t,{secretKey:n,sendMode:r.sendMode,messages:[(0,Et.internal)({to:r.to,value:r.value,bounce:r.bounce,init:r.init,body:r.body})]})},address:this.address}}}Ts.HighloadWalletContractV2=Gd;function bk(){return{serialize:(e,t)=>{const{sendMode:n,message:r}=e,a=(0,Et.beginCell)().storeWritable((0,Et.storeMessageRelaxed)(r));t.storeUint(n,8),t.storeRef(a)},parse:e=>{const t=e.loadUint(8),n=(0,Et.loadMessageRelaxed)(e.loadRef().beginParse());return{sendMode:t,message:n}}}}function Bx(e,t,n){const r=Math.floor(e/1e3)+t;return(BigInt(r)<<32n)+BigInt(n)}function Mx(e){return t=>{const{secretKey:n,messages:r,seqno:a,sendMode:o,now:i,timeout:s,walletId:l}=e,u=Bx(i,s,a),c=Et.Dictionary.empty(Et.Dictionary.Keys.Int(16),bk());for(const[p,f]of r.entries())c.set(p,{sendMode:o,message:f});const d=(0,Et.beginCell)().storeUint(l,32).storeUint(u,64).storeDict(c).endCell(),b=d.hash(),m=(0,Tx.sign)(b,n);t.storeBuffer(m),t.storeSlice(d.beginParse())}}function xx(e){const t=e.loadBuffer(64),n=e.loadUint(32),r=e.loadUintBig(64),o=e.loadDict(Et.Dictionary.Keys.Int(16),bk()).values();return{signature:t,walletId:n,queryId:r,messages:o}}Object.defineProperty(_r,"__esModule",{value:!0});_r.createSender=_r.createWallet=_r.createHighloadV2=void 0;const Ox=Ts,Ix=Ss,Rx=0;function kk(e){return Ox.HighloadWalletContractV2.create({workchain:Rx,publicKey:e})}_r.createHighloadV2=kk;function wk(e,t){switch(e){case"highload-v2":return kk(t);default:throw new Error("Unsupported wallet type")}}_r.createWallet=wk;async function Nx(e,t,n){const a=n==="testnet"||n==="mainnet"?await(0,Ix.createApi)(n):n,o=wk(e,t.publicKey);return a.open(o).sender(t.secretKey)}_r.createSender=Nx;var Bu={};Object.defineProperty(Bu,"__esModule",{value:!0});Bu.NoSenderError=void 0;class zx extends Error{constructor(){super("Sender is not set")}}Bu.NoSenderError=zx;var Mu={},vk=re&&re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Mu,"__esModule",{value:!0});Mu.TonAPI=void 0;const Dx=de,U=vk(ds),Ux=vk(Ad),vn=U.default.string().transform(e=>Dx.Address.parseRaw(e)),Yd=U.default.string().transform(e=>Buffer.from(e,"hex")),$r=U.default.union([U.default.number(),U.default.string()]).transform(e=>BigInt(e)),jk=U.default.union([U.default.number(),U.default.string()]).transform(e=>Number(e)),_k=U.default.object({resolution:U.default.string(),url:U.default.string()}),Zn=U.default.object({address:vn,name:U.default.optional(U.default.string()),is_scam:U.default.boolean(),icon:U.default.optional(U.default.string()),is_wallet:U.default.boolean()}),Ck=U.default.object({address:vn,next_item_index:$r,owner:U.default.optional(Zn),metadata:U.default.optional(U.default.record(U.default.any())),raw_collection_content:Yd,previews:U.default.optional(U.default.array(_k)),approved_by:U.default.array(U.default.string())}),Fx=U.default.object({nft_collections:U.default.array(Ck)}),Lx=U.default.object({value:$r,token_name:U.default.string()}),qx=U.default.object({address:vn,market:Zn,owner:U.default.optional(Zn),price:Lx}),Ek=U.default.object({address:vn,index:$r,owner:U.default.optional(Zn),collection:U.default.optional(U.default.object({address:vn,name:U.default.string(),description:U.default.string()})),verified:U.default.boolean(),metadata:U.default.record(U.default.any()),sale:U.default.optional(qx),previews:U.default.optional(U.default.array(_k)),dns:U.default.optional(U.default.string()),approved_by:U.default.array(U.default.string())}),cc=U.default.object({nft_items:U.default.array(Ek)}),Ak=U.default.union([U.default.literal("whitelist"),U.default.literal("blacklist"),U.default.literal("none")]),$x=U.default.object({address:vn,name:U.default.string(),symbol:U.default.string(),decimals:jk,image:U.default.optional(U.default.string()),description:U.default.optional(U.default.string()),social:U.default.optional(U.default.array(U.default.string())),websites:U.default.optional(U.default.array(U.default.string())),catalogs:U.default.optional(U.default.array(U.default.string()))}),Sk=U.default.object({mintable:U.default.boolean(),total_supply:$r,metadata:$x,verification:Ak,holders_count:U.default.number()}),Wx=U.default.object({jettons:U.default.array(Sk)}),Hx=U.default.object({address:vn,owner:Zn,balance:$r}),Vx=U.default.object({addresses:U.default.array(Hx)}),Jx=U.default.object({encryption_type:U.default.string(),cipher_text:Yd}),Kx=U.default.object({type:U.default.string(),origin:vn}),Gx=U.default.object({sender:U.default.optional(Zn),recipient:U.default.optional(Zn),nft:vn,comment:U.default.optional(U.default.string()),encrypted_comment:U.default.optional(Jx),payload:U.default.optional(Yd),refund:U.default.optional(Kx)}),Yx=U.default.union([U.default.literal("ok"),U.default.literal("failed")]),Qx=U.default.object({type:U.default.literal("NftItemTransfer"),status:Yx,NftItemTransfer:Gx}).transform(e=>({status:e.status,...e.NftItemTransfer})),Zx=e=>U.default.object({event_id:U.default.string(),account:Zn,timestamp:U.default.number(),actions:U.default.array(e),is_scam:U.default.boolean(),lt:$r,in_progress:U.default.boolean()}),Xx=Zx(Qx),eO=e=>U.default.object({events:U.default.array(e),next_from:$r}),tO=eO(Xx),nO=U.default.object({prices:U.default.optional(U.default.record(U.default.number())),diff_24h:U.default.optional(U.default.record(U.default.string())),diff_7d:U.default.optional(U.default.record(U.default.string())),diff_30d:U.default.optional(U.default.record(U.default.string()))}),rO=U.default.object({address:vn,name:U.default.string(),symbol:U.default.string(),decimals:jk,image:U.default.string(),verification:Ak}),aO=U.default.object({balance:$r,price:U.default.optional(nO),wallet_address:Zn,jetton:rO}),oO=U.default.object({balances:U.default.array(aO)}),sn=e=>typeof e=="string"?e:e.toRawString();class iO{constructor(t){this.instance=Ux.default.create({baseURL:(t==null?void 0:t.baseURL)??"https://tonapi.io",headers:(t==null?void 0:t.token)===void 0?{}:{Authorization:"Bearer "+t.token}})}async getNftCollections(t){return Fx.parse((await this.instance.get("/v2/nfts/collections",{params:t})).data).nft_collections}async getNftCollection(t){return Ck.parse((await this.instance.get(`/v2/nfts/collections/${sn(t)}`)).data)}async getNftCollectionItems(t,n){return cc.parse((await this.instance.get(`/v2/nfts/collections/${sn(t)}/items`,{params:n})).data).nft_items}async getNftItems(t){return cc.parse((await this.instance.post("/v2/nfts/_bulk",{account_ids:t.map(sn)})).data).nft_items}async getNftItem(t){return Ek.parse((await this.instance.get(`/v2/nfts/${sn(t)}`)).data)}async getJettons(t){return Wx.parse((await this.instance.get("/v2/jettons",{params:t})).data).jettons}async getJetton(t){return Sk.parse((await this.instance.get(`/v2/jettons/${sn(t)}`)).data)}async getJettonHolders(t,n){return Vx.parse((await this.instance.get(`/v2/jettons/${sn(t)}/holders`,{params:n})).data).addresses}async getNftItemTransferHistory(t,n){return tO.parse((await this.instance.get(`/v2/nfts/${sn(t)}/history`,{params:{limit:100,...n}})).data)}async getAccountNfts(t,n){return cc.parse((await this.instance.get(`/v2/accounts/${sn(t)}/nfts`,{params:{...n,collection:(n==null?void 0:n.collection)===void 0?void 0:sn(n.collection)}})).data).nft_items}async getAccountJettons(t,n){return oO.parse((await this.instance.get(`/v2/accounts/${sn(t)}/jettons`,{params:{currencies:(n==null?void 0:n.currencies)===void 0?void 0:n.currencies.join(",")}})).data).balances}}Mu.TonAPI=iO;var La={};Object.defineProperty(La,"__esModule",{value:!0});La.loadJettonExcessesMessage=La.storeJettonExcessesMessage=void 0;const Tk=Pe;function sO(e){return t=>{t.storeUint(Tk.JETTON_EXCESSES_OPCODE,32),t.storeUint(e.queryId,64)}}La.storeJettonExcessesMessage=sO;function lO(e){if(e.loadUint(32)!==Tk.JETTON_EXCESSES_OPCODE)throw new Error("Wrong opcode");return{queryId:e.loadUintBig(64)}}La.loadJettonExcessesMessage=lO;var Vh;function Pk(){return Vh||(Vh=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.storeNftGetStaticDataMessage=e.loadNftGetStaticDataMessage=e.storeNftExcessesMessage=e.loadNftExcessesMessage=e.storeNftDeployMessage=e.loadNftDeployMessage=e.loadNftCollectionMessage=e.storeNftCollectionData=e.loadNftCollectionData=e.parseNftCollectionTransaction=e.storeNftChangeContentMessage=e.loadNftChangeContentMessage=e.storeNftChangeAdminMessage=e.loadNftChangeAdminMessage=e.storeNftBatchMintMessage=e.loadNftBatchMintMessage=e.createNftMintItemValue=e.storeNftBatchMintItem=e.loadNftBatchMintItem=e.NFT_MINT_OPCODE=e.NFT_CHANGE_CONTENT_OPCODE=e.NFT_CHANGE_ADMIN_OPCODE=e.NFT_BATCH_MINT_OPCODE=e.NFT_OWNER_ASSIGNED_OPCODE=e.NFT_REPORT_STATIC_DATA_OPCODE=e.NFT_GET_STATIC_DATA_OPCODE=e.NFT_EXCESSES_OPCODE=e.NFT_TRANSFER_OPCODE=e.TonAPI=e.NoSenderError=e.parseTransferTransaction=e.storeEncryptedMessage=e.storeTextMessage=e.storeSimpleTransferMessage=e.loadEncryptedMessage=e.loadTextMessage=e.loadSimpleTransferMessage=e.loadTransferMessage=e.ENCRYPTED_MESSAGE_OPCODE=e.TEXT_OPCODE=e.HighloadWalletContractV2=e.createSender=e.createHighloadV2=e.createWallet=e.importKey=e.createApi=e.NoopStorage=e.S3Storage=e.PinataStorage=e.AssetsSDK=void 0,e.storeJettonChangeContentMessage=e.loadJettonChangeContentMessage=e.storeJettonChangeAdminMessage=e.loadJettonChangeAdminMessage=e.storeJettonBurnNotificationMessage=e.loadJettonBurnNotificationMessage=e.storeJettonBurnMessage=e.loadJettonBurnMessage=e.jettonContentToInternal=e.parseJettonContent=e.jettonWalletConfigToCell=e.JettonWallet=e.jettonMinterConfigToCell=e.JettonMinter=e.JETTON_TRANSFER_NOTIFICATION_OPCODE=e.JETTON_EXCESSES_OPCODE=e.JETTON_MINT_OPCODE=e.JETTON_INTERNAL_TRANSFER_OPCODE=e.JETTON_TRANSFER_OPCODE=e.JETTON_CHANGE_CONTENT_OPCODE=e.JETTON_CHANGE_ADMIN_OPCODE=e.JETTON_BURN_OPCODE=e.JETTON_BURN_NOTIFICATION_OPCODE=e.NftSale=e.nftItemConfigToCell=e.NftItem=e.sbtCollectionConfigToCell=e.SbtCollection=e.nftCollectionConfigToCell=e.NftCollection=e.createSbtItemParamsValue=e.storeSbtItemParams=e.loadSbtItemParams=e.parseSbtItemTransaction=e.parseSbtCollectionTransaction=e.storeNftTransferMessage=e.loadNftTransferMessage=e.storeNftRoyaltyParams=e.loadNftRoyaltyParams=e.storeNftReportStaticDataMessage=e.loadNftReportStaticDataMessage=e.storeNftOwnerAssignedMessage=e.loadNftOwnerAssignedMessage=e.storeNftMintMessage=e.loadNftMintMessage=e.loadNftMessage=e.createNftItemParamsValue=e.storeNftItemParams=e.loadNftItemParams=e.parseNftItemTransaction=void 0,e.loadJettonWalletMessage=e.parseJettonWalletTransaction=e.loadJettonMinterMessage=e.parseJettonMinterTransaction=e.storeJettonTransferNotificationMessage=e.loadJettonTransferNotificationMessage=e.storeJettonTransferMessage=e.loadJettonTransferMessage=e.storeJettonMintMessage=e.loadJettonMintMessage=e.storeJettonMinterContent=e.loadJettonMinterContent=e.storeJettonInternalTransferMessage=e.loadJettonInternalTransferMessage=e.storeJettonExcessesMessage=e.loadJettonExcessesMessage=void 0;var t=HM();Object.defineProperty(e,"AssetsSDK",{enumerable:!0,get:function(){return t.AssetsSDK}});var n=ms;Object.defineProperty(e,"PinataStorage",{enumerable:!0,get:function(){return n.PinataStorage}});var r=ps;Object.defineProperty(e,"S3Storage",{enumerable:!0,get:function(){return r.S3Storage}});var a=As;Object.defineProperty(e,"NoopStorage",{enumerable:!0,get:function(){return a.NoopStorage}});var o=Ss;Object.defineProperty(e,"createApi",{enumerable:!0,get:function(){return o.createApi}});var i=Pu;Object.defineProperty(e,"importKey",{enumerable:!0,get:function(){return i.importKey}});var s=_r;Object.defineProperty(e,"createWallet",{enumerable:!0,get:function(){return s.createWallet}}),Object.defineProperty(e,"createHighloadV2",{enumerable:!0,get:function(){return s.createHighloadV2}}),Object.defineProperty(e,"createSender",{enumerable:!0,get:function(){return s.createSender}});var l=Ts;Object.defineProperty(e,"HighloadWalletContractV2",{enumerable:!0,get:function(){return l.HighloadWalletContractV2}});var u=Wd;Object.defineProperty(e,"TEXT_OPCODE",{enumerable:!0,get:function(){return u.TEXT_OPCODE}}),Object.defineProperty(e,"ENCRYPTED_MESSAGE_OPCODE",{enumerable:!0,get:function(){return u.ENCRYPTED_MESSAGE_OPCODE}}),Object.defineProperty(e,"loadTransferMessage",{enumerable:!0,get:function(){return u.loadTransferMessage}}),Object.defineProperty(e,"loadSimpleTransferMessage",{enumerable:!0,get:function(){return u.loadSimpleTransferMessage}}),Object.defineProperty(e,"loadTextMessage",{enumerable:!0,get:function(){return u.loadTextMessage}}),Object.defineProperty(e,"loadEncryptedMessage",{enumerable:!0,get:function(){return u.loadEncryptedMessage}}),Object.defineProperty(e,"storeSimpleTransferMessage",{enumerable:!0,get:function(){return u.storeSimpleTransferMessage}}),Object.defineProperty(e,"storeTextMessage",{enumerable:!0,get:function(){return u.storeTextMessage}}),Object.defineProperty(e,"storeEncryptedMessage",{enumerable:!0,get:function(){return u.storeEncryptedMessage}});var c=Xn;Object.defineProperty(e,"parseTransferTransaction",{enumerable:!0,get:function(){return c.parseTransferTransaction}});var d=Bu;Object.defineProperty(e,"NoSenderError",{enumerable:!0,get:function(){return d.NoSenderError}});var b=Mu;Object.defineProperty(e,"TonAPI",{enumerable:!0,get:function(){return b.TonAPI}});var m=Be;Object.defineProperty(e,"NFT_TRANSFER_OPCODE",{enumerable:!0,get:function(){return m.NFT_TRANSFER_OPCODE}}),Object.defineProperty(e,"NFT_EXCESSES_OPCODE",{enumerable:!0,get:function(){return m.NFT_EXCESSES_OPCODE}}),Object.defineProperty(e,"NFT_GET_STATIC_DATA_OPCODE",{enumerable:!0,get:function(){return m.NFT_GET_STATIC_DATA_OPCODE}}),Object.defineProperty(e,"NFT_REPORT_STATIC_DATA_OPCODE",{enumerable:!0,get:function(){return m.NFT_REPORT_STATIC_DATA_OPCODE}}),Object.defineProperty(e,"NFT_OWNER_ASSIGNED_OPCODE",{enumerable:!0,get:function(){return m.NFT_OWNER_ASSIGNED_OPCODE}}),Object.defineProperty(e,"NFT_BATCH_MINT_OPCODE",{enumerable:!0,get:function(){return m.NFT_BATCH_MINT_OPCODE}}),Object.defineProperty(e,"NFT_CHANGE_ADMIN_OPCODE",{enumerable:!0,get:function(){return m.NFT_CHANGE_ADMIN_OPCODE}}),Object.defineProperty(e,"NFT_CHANGE_CONTENT_OPCODE",{enumerable:!0,get:function(){return m.NFT_CHANGE_CONTENT_OPCODE}}),Object.defineProperty(e,"NFT_MINT_OPCODE",{enumerable:!0,get:function(){return m.NFT_MINT_OPCODE}});var p=et;Object.defineProperty(e,"loadNftBatchMintItem",{enumerable:!0,get:function(){return p.loadNftBatchMintItem}});var f=et;Object.defineProperty(e,"storeNftBatchMintItem",{enumerable:!0,get:function(){return f.storeNftBatchMintItem}});var k=et;Object.defineProperty(e,"createNftMintItemValue",{enumerable:!0,get:function(){return k.createNftMintItemValue}});var T=et;Object.defineProperty(e,"loadNftBatchMintMessage",{enumerable:!0,get:function(){return T.loadNftBatchMintMessage}});var A=et;Object.defineProperty(e,"storeNftBatchMintMessage",{enumerable:!0,get:function(){return A.storeNftBatchMintMessage}});var y=Gn;Object.defineProperty(e,"loadNftChangeAdminMessage",{enumerable:!0,get:function(){return y.loadNftChangeAdminMessage}});var h=Gn;Object.defineProperty(e,"storeNftChangeAdminMessage",{enumerable:!0,get:function(){return h.storeNftChangeAdminMessage}});var C=Vn;Object.defineProperty(e,"loadNftChangeContentMessage",{enumerable:!0,get:function(){return C.loadNftChangeContentMessage}});var _=Vn;Object.defineProperty(e,"storeNftChangeContentMessage",{enumerable:!0,get:function(){return _.storeNftChangeContentMessage}});var x=js;Object.defineProperty(e,"parseNftCollectionTransaction",{enumerable:!0,get:function(){return x.parseNftCollectionTransaction}});var H=Qn;Object.defineProperty(e,"loadNftCollectionData",{enumerable:!0,get:function(){return H.loadNftCollectionData}});var L=Qn;Object.defineProperty(e,"storeNftCollectionData",{enumerable:!0,get:function(){return L.storeNftCollectionData}});var G=Ko;Object.defineProperty(e,"loadNftCollectionMessage",{enumerable:!0,get:function(){return G.loadNftCollectionMessage}});var ee=Rr;Object.defineProperty(e,"loadNftDeployMessage",{enumerable:!0,get:function(){return ee.loadNftDeployMessage}});var ce=Rr;Object.defineProperty(e,"storeNftDeployMessage",{enumerable:!0,get:function(){return ce.storeNftDeployMessage}});var N=Ur;Object.defineProperty(e,"loadNftExcessesMessage",{enumerable:!0,get:function(){return N.loadNftExcessesMessage}});var R=Ur;Object.defineProperty(e,"storeNftExcessesMessage",{enumerable:!0,get:function(){return R.storeNftExcessesMessage}});var B=Nr;Object.defineProperty(e,"loadNftGetStaticDataMessage",{enumerable:!0,get:function(){return B.loadNftGetStaticDataMessage}});var V=Nr;Object.defineProperty(e,"storeNftGetStaticDataMessage",{enumerable:!0,get:function(){return V.storeNftGetStaticDataMessage}});var ie=vs;Object.defineProperty(e,"parseNftItemTransaction",{enumerable:!0,get:function(){return ie.parseNftItemTransaction}});var se=Ot;Object.defineProperty(e,"loadNftItemParams",{enumerable:!0,get:function(){return se.loadNftItemParams}});var M=Ot;Object.defineProperty(e,"storeNftItemParams",{enumerable:!0,get:function(){return M.storeNftItemParams}});var Oe=Ot;Object.defineProperty(e,"createNftItemParamsValue",{enumerable:!0,get:function(){return Oe.createNftItemParamsValue}});var Me=Jo;Object.defineProperty(e,"loadNftMessage",{enumerable:!0,get:function(){return Me.loadNftMessage}});var qe=Kn;Object.defineProperty(e,"loadNftMintMessage",{enumerable:!0,get:function(){return qe.loadNftMintMessage}});var Ve=Kn;Object.defineProperty(e,"storeNftMintMessage",{enumerable:!0,get:function(){return Ve.storeNftMintMessage}});var at=Dr;Object.defineProperty(e,"loadNftOwnerAssignedMessage",{enumerable:!0,get:function(){return at.loadNftOwnerAssignedMessage}});var tt=Dr;Object.defineProperty(e,"storeNftOwnerAssignedMessage",{enumerable:!0,get:function(){return tt.storeNftOwnerAssignedMessage}});var Ne=zr;Object.defineProperty(e,"loadNftReportStaticDataMessage",{enumerable:!0,get:function(){return Ne.loadNftReportStaticDataMessage}});var Ke=zr;Object.defineProperty(e,"storeNftReportStaticDataMessage",{enumerable:!0,get:function(){return Ke.storeNftReportStaticDataMessage}});var Ie=Jn;Object.defineProperty(e,"loadNftRoyaltyParams",{enumerable:!0,get:function(){return Ie.loadNftRoyaltyParams}});var ot=Jn;Object.defineProperty(e,"storeNftRoyaltyParams",{enumerable:!0,get:function(){return ot.storeNftRoyaltyParams}});var wt=Yn;Object.defineProperty(e,"loadNftTransferMessage",{enumerable:!0,get:function(){return wt.loadNftTransferMessage}});var Dt=Yn;Object.defineProperty(e,"storeNftTransferMessage",{enumerable:!0,get:function(){return Dt.storeNftTransferMessage}});var D=Cs;Object.defineProperty(e,"parseSbtCollectionTransaction",{enumerable:!0,get:function(){return D.parseSbtCollectionTransaction}});var S=_s;Object.defineProperty(e,"parseSbtItemTransaction",{enumerable:!0,get:function(){return S.parseSbtItemTransaction}});var I=It;Object.defineProperty(e,"loadSbtItemParams",{enumerable:!0,get:function(){return I.loadSbtItemParams}});var W=It;Object.defineProperty(e,"storeSbtItemParams",{enumerable:!0,get:function(){return W.storeSbtItemParams}});var F=It;Object.defineProperty(e,"createSbtItemParamsValue",{enumerable:!0,get:function(){return F.createSbtItemParamsValue}});var oe=Au();Object.defineProperty(e,"NftCollection",{enumerable:!0,get:function(){return oe.NftCollection}}),Object.defineProperty(e,"nftCollectionConfigToCell",{enumerable:!0,get:function(){return oe.nftCollectionConfigToCell}});var ge=Ua;Object.defineProperty(e,"SbtCollection",{enumerable:!0,get:function(){return ge.SbtCollection}}),Object.defineProperty(e,"sbtCollectionConfigToCell",{enumerable:!0,get:function(){return ge.sbtCollectionConfigToCell}});var _e=Vd();Object.defineProperty(e,"NftItem",{enumerable:!0,get:function(){return _e.NftItem}}),Object.defineProperty(e,"nftItemConfigToCell",{enumerable:!0,get:function(){return _e.nftItemConfigToCell}});var Re=Es;Object.defineProperty(e,"NftSale",{enumerable:!0,get:function(){return Re.NftSale}});var Se=Pe;Object.defineProperty(e,"JETTON_BURN_NOTIFICATION_OPCODE",{enumerable:!0,get:function(){return Se.JETTON_BURN_NOTIFICATION_OPCODE}}),Object.defineProperty(e,"JETTON_BURN_OPCODE",{enumerable:!0,get:function(){return Se.JETTON_BURN_OPCODE}}),Object.defineProperty(e,"JETTON_CHANGE_ADMIN_OPCODE",{enumerable:!0,get:function(){return Se.JETTON_CHANGE_ADMIN_OPCODE}}),Object.defineProperty(e,"JETTON_CHANGE_CONTENT_OPCODE",{enumerable:!0,get:function(){return Se.JETTON_CHANGE_CONTENT_OPCODE}}),Object.defineProperty(e,"JETTON_TRANSFER_OPCODE",{enumerable:!0,get:function(){return Se.JETTON_TRANSFER_OPCODE}}),Object.defineProperty(e,"JETTON_INTERNAL_TRANSFER_OPCODE",{enumerable:!0,get:function(){return Se.JETTON_INTERNAL_TRANSFER_OPCODE}}),Object.defineProperty(e,"JETTON_MINT_OPCODE",{enumerable:!0,get:function(){return Se.JETTON_MINT_OPCODE}}),Object.defineProperty(e,"JETTON_EXCESSES_OPCODE",{enumerable:!0,get:function(){return Se.JETTON_EXCESSES_OPCODE}}),Object.defineProperty(e,"JETTON_TRANSFER_NOTIFICATION_OPCODE",{enumerable:!0,get:function(){return Se.JETTON_TRANSFER_NOTIFICATION_OPCODE}});var ye=Da;Object.defineProperty(e,"JettonMinter",{enumerable:!0,get:function(){return ye.JettonMinter}}),Object.defineProperty(e,"jettonMinterConfigToCell",{enumerable:!0,get:function(){return ye.jettonMinterConfigToCell}});var nn=Br;Object.defineProperty(e,"JettonWallet",{enumerable:!0,get:function(){return nn.JettonWallet}}),Object.defineProperty(e,"jettonWalletConfigToCell",{enumerable:!0,get:function(){return nn.jettonWalletConfigToCell}});var it=Pr;Object.defineProperty(e,"parseJettonContent",{enumerable:!0,get:function(){return it.parseJettonContent}}),Object.defineProperty(e,"jettonContentToInternal",{enumerable:!0,get:function(){return it.jettonContentToInternal}});var P=qn;Object.defineProperty(e,"loadJettonBurnMessage",{enumerable:!0,get:function(){return P.loadJettonBurnMessage}});var g=qn;Object.defineProperty(e,"storeJettonBurnMessage",{enumerable:!0,get:function(){return g.storeJettonBurnMessage}});var j=xr;Object.defineProperty(e,"loadJettonBurnNotificationMessage",{enumerable:!0,get:function(){return j.loadJettonBurnNotificationMessage}});var E=xr;Object.defineProperty(e,"storeJettonBurnNotificationMessage",{enumerable:!0,get:function(){return E.storeJettonBurnNotificationMessage}});var O=Wn;Object.defineProperty(e,"loadJettonChangeAdminMessage",{enumerable:!0,get:function(){return O.loadJettonChangeAdminMessage}});var v=Wn;Object.defineProperty(e,"storeJettonChangeAdminMessage",{enumerable:!0,get:function(){return v.storeJettonChangeAdminMessage}});var q=Hn;Object.defineProperty(e,"loadJettonChangeContentMessage",{enumerable:!0,get:function(){return q.loadJettonChangeContentMessage}});var $=Hn;Object.defineProperty(e,"storeJettonChangeContentMessage",{enumerable:!0,get:function(){return $.storeJettonChangeContentMessage}});var J=La;Object.defineProperty(e,"loadJettonExcessesMessage",{enumerable:!0,get:function(){return J.loadJettonExcessesMessage}});var X=La;Object.defineProperty(e,"storeJettonExcessesMessage",{enumerable:!0,get:function(){return X.storeJettonExcessesMessage}});var le=kn;Object.defineProperty(e,"loadJettonInternalTransferMessage",{enumerable:!0,get:function(){return le.loadJettonInternalTransferMessage}});var Z=kn;Object.defineProperty(e,"storeJettonInternalTransferMessage",{enumerable:!0,get:function(){return Z.storeJettonInternalTransferMessage}});var te=Ir;Object.defineProperty(e,"loadJettonMinterContent",{enumerable:!0,get:function(){return te.loadJettonMinterContent}});var ke=Ir;Object.defineProperty(e,"storeJettonMinterContent",{enumerable:!0,get:function(){return ke.storeJettonMinterContent}});var Y=$n;Object.defineProperty(e,"loadJettonMintMessage",{enumerable:!0,get:function(){return Y.loadJettonMintMessage}});var Ee=$n;Object.defineProperty(e,"storeJettonMintMessage",{enumerable:!0,get:function(){return Ee.storeJettonMintMessage}});var je=Ln;Object.defineProperty(e,"loadJettonTransferMessage",{enumerable:!0,get:function(){return je.loadJettonTransferMessage}});var Te=Ln;Object.defineProperty(e,"storeJettonTransferMessage",{enumerable:!0,get:function(){return Te.storeJettonTransferMessage}});var ze=Or;Object.defineProperty(e,"loadJettonTransferNotificationMessage",{enumerable:!0,get:function(){return ze.loadJettonTransferNotificationMessage}});var Ht=Or;Object.defineProperty(e,"storeJettonTransferNotificationMessage",{enumerable:!0,get:function(){return Ht.storeJettonTransferNotificationMessage}});var ct=bs;Object.defineProperty(e,"parseJettonMinterTransaction",{enumerable:!0,get:function(){return ct.parseJettonMinterTransaction}});var Pt=ks;Object.defineProperty(e,"loadJettonMinterMessage",{enumerable:!0,get:function(){return Pt.loadJettonMinterMessage}});var Qo=gs;Object.defineProperty(e,"parseJettonWalletTransaction",{enumerable:!0,get:function(){return Qo.parseJettonWalletTransaction}});var Ha=ys;Object.defineProperty(e,"loadJettonWalletMessage",{enumerable:!0,get:function(){return Ha.loadJettonWalletMessage}})}(ic)),ic}var Jh=Pk();const uO=He.object({name:He.string(),description:He.string(),image_data:He.string(),symbol:He.string(),decimals:He.number(),amount:He.string()}),cO=1e3*60*5,dO=async({request:e})=>{var t;try{const n=(t=e.headers.get("Authorization"))==null?void 0:t.replace("Bearer ","");if(!n||!await Ld(n))return ml({error:"Unauthorized"});const r=Tb(n);if(!(r!=null&&r.address)||!(r!=null&&r.network))return ml({error:"Invalid token"});const a=uO.parse(await e.json()),o=Math.round((Date.now()+cO)/1e3),i=de.toNano("0.06").toString(),s=de.toNano("0.05"),l=Ue.Address.parse(r.address),u=Ue.Address.parse(r.address),c=Ue.Address.parse(r.address),d=Jh.JettonMinter.createFromConfig({admin:u,content:Pb({name:a.name,description:a.description,image_data:Buffer.from(a.image_data,"ascii").toString("base64"),symbol:a.symbol,decimals:a.decimals})});if(!d.init)return vr({error:"Invalid jetton master"});const b=d.address.toString({urlSafe:!0,bounceable:!0,testOnly:r.network===Li.TESTNET}),m=de.beginCell().store(de.storeStateInit(d.init)).endCell().toBoc().toString("base64"),p=de.beginCell().store(Jh.storeJettonMintMessage({queryId:0n,amount:BigInt(a.amount),from:d.address,to:c,responseAddress:l,forwardPayload:null,forwardTonAmount:1n,walletForwardValue:s})).endCell().toBoc().toString("base64");return hs({validUntil:o,from:l.toRawString(),messages:[{address:b,amount:i,stateInit:m,payload:p}]})}catch(n){return n instanceof Error?vr({error:"Invalid request",trace:n.message}):vr({error:"Invalid request",trace:n})}},fO=async()=>{try{const t=new sb().generatePayload(),n=await QP({payload:t});return hs({payload:n})}catch(e){return vr({error:"Invalid request",trace:e})}},hO=async({request:e})=>{var t;try{const n=(t=e.headers.get("Authorization"))==null?void 0:t.replace("Bearer ","");if(!n||!await Ld(n))return ml({error:"Unauthorized"});const r=Tb(n);if(!(r!=null&&r.address)||!(r!=null&&r.network))return ml({error:"Invalid token"});const a=wu.create(r.network);return hs(await a.getAccountInfo(r.address))}catch(n){return vr({error:"Invalid request",trace:n})}},mO=async()=>hs({ok:!0}),Bi=document.baseURI.replace(/\/$/,""),AO=vj(ti.get(`${Bi}/api/healthz`,mO),ti.post(`${Bi}/api/generate_payload`,fO),ti.post(`${Bi}/api/check_proof`,XP),ti.get(`${Bi}/api/get_account_info`,hO),ti.post(`${Bi}/api/create_jetton`,dO));export{AO as worker}; diff --git a/docs/index.html b/docs/index.html index 6df1e15..77f8cd9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -9,7 +9,7 @@ Demo Dapp with @tonconnect/ui-react - +