PageSourceSearch

https://assets.monica.im/home-web/_next/static/chunks/11697-761602f1c0830f0a.js

js monica.im collected 2026-09-24 09:01:39 UTC 33,068 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[11697],{5620:function(e,t,r){r.d(t,{G:function(){return Z}});var a=r(42548),n=r(31899),s=r(85112),i=r(94573),o=r(83519),l=r(88558),c=r(59332),d=r(62517),u=r(48428),h={src:"https://assets.monica.im/home-web/_next/static/media/paySuccess.e6404f75.png",height:264,width:264,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAMAAADz0U65AAAAYFBMVEVMaXG9qPqojvagf/ji1v6AVPz08f/FrP/Et/+ad/n7+P+CU/x+VPdSIeqoivvh1v17TPl+T/rv5/+6pvakhfjp4v3p2/+ulvbZzPqIXfuCVftWK+e1mf+ZdP////+xlP8bkvTCAAAAHXRSTlMA8eTTVS4tEQjmU6K9Ko6/XdiQzLeFJNJu+U5NIDUiHigAAAAJcEhZcwAAFiUAABYlAUlSJPAAAABBSURBVHicHcGHDYAwEACxS/1UekeB/bdEwgaCE37DWLIDtiWa2AF211r1npBPM6sncbU3HuvkqbGVZK1AvSVI4ANNGQKBYc9u+gAAAABJRU5ErkJggg==",blurWidth:8,blurHeight:8},p=r(47691),m=r(90487),g=r(20171),y=r(72821),f={box:"box--OCW9K",paymentCompletedDialog:"payment-completed-dialog--ztODX",header:"header--UvneD",title:"title--klDjQ",main:"main--_rLyv",image:"image--XKw0H",description:"description--hn_Xi",mark:"mark--EHQt4",footer:"footer--uDu7G",failedContent:"failed-content--bTnl5",subtitle:"subtitle--KE8OF",desc:"desc--fPR25",radioGroup1:"radio-group1--glzrx",radioLabel:"radio-label--NkuWj",textarea:"textarea--B5WNu",successContent:"success-content--aHXf7",redeemButton:"redeem-button--n24Ky",countdown:"countdown--zbxhX",time:"time--ui4iR",colon:"colon--du_Xr",hour:"hour--uoQA7",minute:"minute--z4FSB",second:"second--vNgjk"},v=r(29843),k=r(18442),C=r(20733),S=r(70289),w=r(66946),x=r(43144),T=r(2825),P=r(64955),b=r(4576),N={"confirm-the-change":"confirm-the-change--eg8Jd",confirmTheChange:"confirm-the-change--eg8Jd",header:"header--Q37Ot",content:"content--kMeHV","current-plan":"current-plan--mmmfU",currentPlan:"current-plan--mmmfU","target-plan":"target-plan--gMoEF",targetPlan:"target-plan--gMoEF","vip-name":"vip-name--e6x7q",vipName:"vip-name--e6x7q","month-tag":"month-tag--kIN7O",monthTag:"month-tag--kIN7O","annually-tag":"annually-tag--eTSjB",annuallyTag:"annually-tag--eTSjB","price-info":"price-info--BB_NB",priceInfo:"price-info--BB_NB",footer:"footer--ahJ0f"},j=r(74643),A=r(74156),I=r(59283),U={"pay-for-upgrades":"pay-for-upgrades--kyXNL",payForUpgrades:"pay-for-upgrades--kyXNL",header:"header--TDs9d",content:"content--FfaAK",footer:"footer--GtM5_","pay-btn":"pay-btn--DcSLS",payBtn:"pay-btn--DcSLS"};class _ extends n.PN{get S(){return j.S.Global.modules.MainWindow.LimitedTimeCoupon.PayForUpgrades}onViewCreate(){this.createUserBehaviorEvent("show")}onViewDestroy(){}handleCancelClick(){var e,t;null===(e=(t=this.props).onDisposed)||void 0===e||e.call(t)}async handleConfirmClick(){var e,t,r,a;this.loading=!0,await (null===(e=(t=this.props).onConfirmed)||void 0===e?void 0:e.call(t)),null===(r=(a=this.props).onDisposed)||void 0===r||r.call(a),this.loading=!1,this.createUserBehaviorEvent("click")}createUserBehaviorEvent(e){}constructor(...e){super(...e),(0,v._)(this,"props",void 0),(0,v._)(this,"loading",!1)}}(0,k.gn)([n.SB],_.prototype,"loading",void 0),(0,k.gn)([A.Fl],_.prototype,"S",null);let R=n._Y.createComponent("PayForUpgrades",_,e=>(0,a.jsxs)(o.u,{className:U.payForUpgrades,onDispose:e.props.onDisposed,fixed:"dialogRoot"===e.props.insertTarget,width:350,closeOnMaskClick:!1,children:[(0,a.jsx)("h2",{className:U.title,children:e.S.title}),(0,a.jsxs)("div",{className:U.content,children:[(0,a.jsx)("p",{children:e.S.hint}),(0,a.jsx)("p",{children:(0,a.jsx)(p.Z,{S:e.S.note,components:{strong:e=>(0,a.jsx)("strong",{children:e})}})})]}),(0,a.jsxs)("footer",{className:U.footer,children:[(0,a.jsx)(d.z,{type:"gray",className:U.cancel,onClick:e.handleCancelClick.bind(e),children:e.S.goBack}),(0,a.jsx)(d.z,{className:U.payBtn,loading:e.loading,type:"primary",onClick:e.handleConfirmClick.bind(e),children:e.S.pay})]})]})),B=u.t.createOpener(R,{singleton:!0});class L extends n.PN{get S(){return j.S.Global.modules.MainWindow.LimitedTimeCoupon.ConfirmUpgrade}onViewCreate(){this.createUserBehaviorEvent("show")}onViewDestroy(){}handleConfirm(){this.createUserBehaviorEvent("click"),this.props.onDisposed(),B({insertTarget:this.props.insertTarget,source:this.props.source,onConfirmed:async()=>{try{this.loading=!0,await b.m.subscribe({planKey:i.serverConfigController.recommendPlan.key,source:this.props.source||""}),await Promise.all([S.userController.fetchVipStatus(),I.gM.updateUsageInfos()])}catch(e){console.log(e)}finally{this.loading=!1}}})}createUserBehaviorEvent(e){}constructor(...e){super(...e),(0,v._)(this,"props",void 0),(0,v._)(this,"loading",!1)}}(0,k.gn)([n.SB],L.prototype,"loading",void 0),(0,k.gn)([A.Fl],L.prototype,"S",null);let F=e=>{let t=S.userController.getVipIconName(e);return"PlanMaxFillIcon"===t?(0,a.jsx)(T.l,{size:18}):"PlanUltraIcon"===t?(0,a.jsx)(P.f,{size:18}):(0,a.jsx)(x.J,{name:t,size:18})},E=n._Y.createComponent("ConfirmTheChange",L,e=>{var t,r,n;let{amountPrice:s,expiredTime:l}=e.props;return(0,a.jsxs)(o.u,{className:N.confirmTheChange,fixed:"dialogRoot"===e.props.insertTarget,onDispose:e.props.onDisposed,width:350,closeOnMaskClick:!1,children:[(0,a.jsx)("header",{className:N.header,children:e.S.confirmTheChange}),(0,a.jsxs)("div",{className:N.content,children:[(0,a.jsxs)("div",{className:N.currentPlan,children:[(0,a.jsx)("span",{children:e.S.currentPlan}),(0,a.jsxs)("span",{className:N.vipName,children:[F((null===(t=b.m.currentPlan)||void 0===t?void 0:t.ver
1sion)||"free"),(null===(r=b.m.currentPlan)||void 0===r?void 0:r.name)||m.m.capitalize("free")]}),(0,a.jsx)("span",{className:N.monthTag,children:(null===(n=b.m.currentPlan)||void 0===n?void 0:n.period)==="year"?e.S.annually:e.S.monthly})]}),(0,a.jsxs)("div",{className:N.targetPlan,children:[(0,a.jsx)("span",{children:e.S.changeTo}),(0,a.jsxs)("span",{className:N.vipName,children:[F(i.serverConfigController.recommendPlan.version),i.serverConfigController.recommendPlan.name]}),(0,a.jsx)("span",{className:N.annuallyTag,children:"year"===i.serverConfigController.recommendPlan.period?e.S.annually:e.S.monthly})]}),(0,a.jsxs)("ul",{className:N.priceInfo,children:[(0,a.jsx)("li",{children:(0,a.jsx)(p.Z,{S:e.S.willSave,data:{savePrice:"63%"},components:{strong:e=>(0,a.jsx)("strong",{children:e})}})}),(0,a.jsx)("li",{children:(0,a.jsx)(p.Z,{S:e.S.willPay,data:{price:s},components:{strong:e=>(0,a.jsx)("strong",{children:e})}})}),(0,a.jsx)("li",{children:(0,a.jsx)(p.Z,{S:e.S.willExpire,data:{expire:l},components:{strong:e=>(0,a.jsx)("strong",{children:e})}})})]})]}),(0,a.jsxs)("footer",{className:N.footer,children:[(0,a.jsx)(d.z,{type:"gray",className:N.cancel,onClick:e.props.onDisposed,children:e.S.cancel}),(0,a.jsx)(d.z,{type:"primary",className:N.confirm,onClick:e.handleConfirm.bind(e),loading:e.loading,children:e.S.confirm})]})]})}),D=u.t.createOpener(E,{singleton:!0});var M=r(40124),W=r(46015),V=r(48670),O=r(53358);class z extends n.PN{get S(){return j.S.Global.components.PaymentCompletedDialog}get options(){return[{key:"priceNotSuitable",label:this.S.priceNotSuitable,value:"priceNotSuitable"},{key:"paymentDisabled",label:this.S.paymentMethodNotAvailable,value:"paymentDisabled"},{key:"justExploring",label:this.S.justExploring,value:"justExploring"},{key:"other",label:this.S.other,value:"other"}]}onViewCreate(){}onViewDestroy(){this.countdownController.destroy(),W.f.getProxy(this).disposeAll()}async handleFeedbackSubmit(){if("other"===this.option&&!this.reason){C.M.error("Please fill in the reason");return}try{var e;this.loading=!0,await M.M.submitFeedback({title:this.option,desc:"other"===this.option?this.reason:"",category:"payment_fail",email:(null===(e=S.userController.userInfo)||void 0===e?void 0:e.email)||""}),this.loading=!1,C.M.success(this.S.submitSuccess),this.handleClose()}catch(e){C.M.error(m.m.formatErrorMsg(e)),this.loading=!1}}async handleUpgradeToYearlyPlan(){this.handleClose(),this.createUserBehaviorEvent("click");try{this.loading=!0;let e=await O.u.upgradePreview({planKey:"elite_yearly"});if(!e)return;D({insertTarget:"mainWindow",amountPrice:e.amountDisplay,expiredTime:V.L.formatTime(e.nextChargeDate,"MM/DD/YYYY"),source:"check_payment_result"})}catch(e){C.M.error(m.m.formatErrorMsg(e))}finally{this.loading=!1}}handleClose(){this.props.onDisposed()}createUserBehaviorEvent(e){}constructor(...e){super(...e),(0,v._)(this,"props",void 0),(0,v._)(this,"countdownController",new w.H),(0,v._)(this,"option","priceNotSuitable"),(0,v._)(this,"reason",""),(0,v._)(this,"loading",!1)}}(0,k.gn)([n.SB],z.prototype,"option",void 0),(0,k.gn)([n.SB],z.prototype,"reason",void 0),(0,k.gn)([n.SB],z.prototype,"loading",void 0),(0,k.gn)([n.Fl],z.prototype,"S",null),(0,k.gn)([n.Fl],z.prototype,"options",null);let G=n._Y.createComponent("PaymentCompletedDialog",z,e=>{let{paymentStatus:t}=e.props;return(0,a.jsxs)(o.u,{className:f.paymentCompletedDialog,wrapperClassName:f.box,onDispose:e.handleClose.bind(e),width:488,closeOnMaskClick:!1,children:["failed"===t&&(0,a.jsx)(K,{vm:e}),"success"===t&&(0,a.jsx)(H,{vm:e})]})}),K=(0,y.Pi)(e=>{let{vm:t}=e;return(0,a.jsxs)("div",{className:f.failedContent,children:[(0,a.jsx)("header",{className:f.header,children:(0,a.jsx)("h2",{className:f.title,children:t.S.paymentFailed})}),(0,a.jsxs)("main",{className:f.main,children:[(0,a.jsx)("p",{className:f.subtitle,children:(0,a.jsx)(p.Z,{S:t.S.encounteredIssue,components:{email:e=>(0,a.jsx)("a",{href:m.m.genUrl(g.Cl.feedback,{issueType:"payment_issue"}),target:"_blank",rel:"noreferrer",className:f.mark,children:e})}})}),(0,a.jsx)("p",{className:f.desc,children:t.S.reasonForCanceling}),(0,a.jsx)("div",{className:f.radioGroup1,children:t.options.map(e=>(0,a.jsx)(l.Y,{checked:t.option===e.value,onClick:()=>{t.option=e.value},labelClassName:f.radioLabel,children:e.label},e.key))}),(0,a.jsx)(c.g,{style:{display:"other"===t.option?"block":"none"},value:t.reason,onChange:e=>{t.reason=e.target.value},className:f.textarea,maxLength:5e3,placeholder:t.S.typeHere})]}),(0,a.jsxs)("footer",{className:f.footer,children:[(0,a.jsx)(d.z,{type:"gray",size:"large",onClick:t.handleClose.bind(t),children:t.S.cancel}),(0,a.jsx)(d.z,{type:"primary",size:"large",loading:t.loading,onClick:t.handleFeedbackSubmit.bind(t),children:t.S.submit})]})]})}),H=(0,y.Pi)(e=>{let t,{vm:r}=e,{fullName:n,price:o,yearlyDiscountPercent:l}=i.serverConfigController.recommendPlan;return t="credits"===r.props.productType?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("main",{className:f.main,children:[(0,a.jsx)("div",{className:f.image,children:(0,a.jsx)(s.E,{src:h,alt:"payment successful"})}),(0,a.jsx)("p",{className:f.description,children:r.S.creditsPaymentSuccess})]}),(0,a.jsx)("footer",{className:f.footer,children:(0,a.jsx)(d.z,{type:"primary",size:"large",className:f.redeemButton,onClick:r.handleClose.bind(r),children:r.S.gotIt})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("main",{className:f.main,children:[(0,a.jsx)("div",{className:f.image,children:(0,a.jsx)(s.E,{src:h,alt:"payment successful"})}),(0,a.jsx)("p",{className:f.description,children:r.S.paymentSuccessfulDesc})]}),(0,a.jsx)("footer",{className:f.footer,children:(0,a.jsx)(d.z,{type:"primary",size:"large",className:f.redeemButton,onClick:r.handleClose.bind(r),children:r.S.startExploring})})]}),(0,a.jsxs)("div",{className:f.successContent,children:[(0,a.jsx)("header",{className:f.header,children:(0,a.jsx)("h2",{className:f.title,children:r.S.paymentSuccessful})}),t]})});(0,y.Pi)(e=>{var t,r,n;let{vm:s}=e,i=s.countdownController.countdown;return(0,a.jsx)("div",{className:f.countdown,children:(0,a.jsxs)("div",{className:f.time,children:[(0,a.jsx)("span",{className:f.hour,children:null!==(t=null==i?void 0:i.hour)&&void 0!==t?t:"-"}),(0,a.jsx)("span",{className:f.colon,children:":"}),(0,a.jsx)("span",{className:f.minute,children:null!==(r=null==i?void 0:i.minute)&&void 0!==r?r:"-"}),(0,a.jsx)("span",{className:f.colon,children:":"}),(0,a.jsx)("span",{className:f.second,children:null!==(n=null==i?void 0:i.second)&&void 0!==n?n:"-"})]})})});let Z=u.t.createOpener(G)},64955:function(e,t,r){r.d(t,{f:function(){return c}});var a=r(42548),n=r(2597),s=r(31899),i=r(29843);class o extends s.PN{constructor(...e){super(...e),(0,i._)(this,"props",void 0)}}var l=JSON.parse('{"fill":"none","content":"\\n<g clip-path=\\"url(#clip0_4317_19599)\\">\\n<path d=\\"M18.8571 0H5.14286C2.30254 0 0 2.30254 0 5.14286V18.8571C0 21.6975 2.30254 24 5.14286 24H18.8571C21.6975 24 24 21.6975 24 18.8571V5.14286C24 2.30254 21.6975 0 18.8571 0Z\\" fill=\\"url(#paint0_linear_4317_19599)\\"/>\\n<mask id=\\"mask0_4317_19599\\" style=\\"mask-type:luminance\\" maskUnits=\\"userSpaceOnUse\\" x=\\"2\\" y=\\"2\\" width=\\"20\\" height=\\"21\\">\\n<path d=\\"M21.6865 2.57422H2.14355V22.1171H21.6865V2.57422Z\\" fill=\\"white\\"/>\\n</mask>\\n<g mask=\\"url(#mask0_4317_19599)\\">
1\\n<path d=\\"M10.2682 17.5054C9.96836 18.1649 9.03159 18.1649 8.73185 17.5054L7.22615 14.1928C7.14173 14.0071 6.99288 13.8583 6.80716 13.7738L3.49463 12.2682C2.83512 11.9683 2.83512 11.0317 3.49463 10.7318L6.80716 9.22614C6.99288 9.14172 7.14173 8.99287 7.22615 8.80715L8.73185 5.49462C9.03159 4.83513 9.96836 4.83513 10.2682 5.49462L11.7739 8.80715C11.8583 8.99287 12.0071 9.14172 12.1928 9.22614L15.5053 10.7318C16.1649 11.0317 16.1649 11.9683 15.5053 12.2682L12.1928 13.7738C12.0071 13.8583 11.8583 14.0071 11.7739 14.1928L10.2682 17.5054Z\\" fill=\\"white\\"/>\\n<path d=\\"M17.4136 20.7337C17.2522 21.0888 16.7478 21.0888 16.5864 20.7337L15.7756 18.95C15.7302 18.85 15.65 18.7698 15.55 18.7244L13.7663 17.9136C13.4112 17.7522 13.4112 17.2478 13.7663 17.0864L15.55 16.2756C15.65 16.2302 15.7302 16.15 15.7756 16.05L16.5864 14.2663C16.7478 13.9112 17.2522 13.9112 17.4136 14.2663L18.2244 16.05C18.2698 16.15 18.35 16.2302 18.45 16.2756L20.2336 17.0864C20.5888 17.2478 20.5888 17.7522 20.2336 17.9136L18.45 18.7244C18.35 18.7698 18.2698 18.85 18.2244 18.95L17.4136 20.7337Z\\" fill=\\"white\\"/>\\n<path d=\\"M18.7954 8.80977C18.6801 9.06341 18.3198 9.06341 18.2046 8.80977L17.6254 7.53569C17.593 7.46427 17.5357 7.40702 17.4643 7.37455L16.1902 6.79544C15.9366 6.68013 15.9366 6.31987 16.1902 6.20455L17.4643 5.62544C17.5357 5.59297 17.593 5.53572 17.6254 5.46429L18.2046 4.19024C18.3198 3.93659 18.6801 3.93659 18.7954 4.19024L19.3746 5.46429C19.407 5.53572 19.4643 5.59297 19.5357 5.62544L20.8097 6.20455C21.0634 6.31987 21.0634 6.68013 20.8097 6.79544L19.5357 7.37455C19.4643 7.40702 19.407 7.46427 19.3746 7.53569L18.7954 8.80977Z\\" fill=\\"white\\"/>\\n</g>\\n</g>\\n<defs>\\n<linearGradient id=\\"paint0_linear_4317_19599\\" x1=\\"0\\" y1=\\"12\\" x2=\\"24\\" y2=\\"12\\" gradientUnits=\\"userSpaceOnUse\\">\\n<stop stop-color=\\"#8741EA\\"/>\\n<stop offset=\\"1\\" stop-color=\\"#A742EA\\"/>\\n</linearGradient>\\n<clipPath id=\\"clip0_4317_19599\\">\\n<rect width=\\"24\\" height=\\"24\\" fill=\\"white\\"/>\\n</clipPath>\\n</defs>\\n\\n","viewBox":"0 0 24 24"}');let c=s._Y.createComponent("PlanUltraIcon",o,e=>(0,a.jsx)(n.s,{...e.props,name:"PlanUltraIcon",iconData:l}))},87911:function(e,t,r){r.d(t,{w:function(){return f}});var a=r(29843),n=r(18442),s=r(31899),i=r(28698),o=r(74156),l=r(29282),c=r(53358),d=r(70289),u=r(46687),h=r(61275);class p{get stage(){return this.currentStage}get progress(){return this.currentProgress}get errorCode(){return this.currentErrorCode}get isRunning(){return this.currentStage===h.Vm.uploading||this.currentStage===h.Vm.processing}startUploading(){this.currentErrorCode=null,this.currentProgress=0,this.moveTo(h.Vm.uploading)}reportProgress(e){this.currentProgress=e}enterProcessing(e){this.currentErrorCode=null,this.moveTo(h.Vm.processing),this.options.fakeProgressWhileProcessing&&(this.currentProgress=0,this.processingStartedAt=null!=e?e:Date.now(),this.startFakeProgress())}finishSuccess(){this.stopFakeProgress(),this.currentProgress=100,this.moveTo(h.Vm.success)}finishFailure(e){this.stopFakeProgress(),this.currentErrorCode=e,this.moveTo(h.Vm.failed)}reset(){this.stopFakeProgress(),this.currentProgress=0,this.currentErrorCode=null,this.moveTo(h.Vm.idle)}moveTo(e){this.currentStage!==e&&(this.currentStage=e)}startFakeProgress(){this.stopFakeProgress(),this.fakeProgressTimer=setInterval(()=>{let e=Date.now()-this.processingStartedAt;this.currentProgress=Math.min(h.Oj,Math.round(e/h.Jm*h.Oj))},1e3)}stopFakeProgress(){this.fakeProgressTimer&&(clearInterval(this.fakeProgressTimer),this.fakeProgressTimer=null)}constructor(e,t={}){(0,a._)(this,"taskType",void 0),(0,a._)(this,"options",void 0),(0,a._)(this,"currentStage",void 0),(0,a._)(this,"currentProgress",void 0),(0,a._)(this,"currentErrorCode",void 0),(0,a._)(this,"fakeProgressTimer",void 0),(0,a._)(this,"processingStartedAt",void 0),this.taskType=e,this.options=t,this.currentStage=h.Vm.idle,this.currentProgress=0,this.currentErrorCode=null,this.fakeProgressTimer=null,this.processingStartedAt=0,(0,o.rC)(this)}}(0,n.gn)([o.LO],p.prototype,"currentStage",void 0),(0,n.gn)([o.LO],p.prototype,"currentProgress",void 0),(0,n.gn)([o.LO],p.prototype,"currentErrorCode",void 0),(0,n.gn)([o.Fl],p.prototype,"isRunning",null);var m=r(74454);class g{get isStale(){return this.startedGeneration!==this.currentGeneration()}constructor(e,t){(0,a._)(this,"startedGeneration",void 0),(0,a._)(this,"currentGeneration",void 0),this.startedGeneration=e,this.currentGeneration=t}}class y{setImportUploader(e){this.importUploader=e}get canImportContent(){return!!d.userController.isLogin&&("C"!==u.Z.exportClass||this.accountChain.stage===h.Vm.success)}get accountOverwriteConfirmVisible(){return null!==this.pendingOverwriteKey}get hasBlockingRecoverUpload(){return this.accountChain.stage===h.Vm.uploading||this.contentChain.stage===h.Vm.uploading}isPackageOfType(e,t){return e.name.toLowerCase().endsWith(h.nJ[t])}async initRecovery(){this.armAccountWatch();let e=await this.getRestorableAccountReplacementTask();if(e&&!this.importTaskWaiters.has(e.taskId)&&this.resumeAccountReplacement(e,this.beginRun()),!d.userController.isLogin){this.recoveryInitStarted&&!e&&this.resetRecoveryState(),this.recoveryLoaded=!0;return}if(this.recoveryInitStarted)return;this.recoveryInitStarted=!0;let t=this.beginRun(),r=this.refreshReward(t);try{let e=(0,m.NC)(await l.C.listImportTasks());if(await r,t.isStale||!d.userController.isLogin)return;this.resumeChain(this.accountChain,e,t),this.resumeChain(this.contentChain,e,t)}catch(e){if(t.isStale)return;this.recoveryInitStarted=!1,console.warn("[dataRecovery] 还原失败,下次进入重拉",e)}finally{t.isStale||(this.recoveryLoaded=!0)}}async importAccount(e){await this.runImport(this.accountChain,e)}async importContent(e){this.isPackageOfType(e,"content")&&this.canImportContent&&this.contentChain.stage!==h.Vm.success&&await this.runImport(this.contentChain,e)}async confirmAccountOverwrite(){let e=this.pendingOverwriteKey,t=u.Z.currentUid;if(!e||!t||this.accountChain.isRunning)return;this.pendingOverwriteKey=null;let r=this.beginRun();try{await this.createAndSettle(this.accountChain,e,r,t)}catch(e){var a;if(r.isStale)return;console.warn("[dataRecovery] account: 确认置换后发起失败",e),this.accountChain.finishFailure(null!==(a=(0,c.L)(e))&&void 0!==a?a:null)}}cancelAccountOverwrite(){this.pendingOverwriteKey=null}beginAccountReplacementSuccessHandling(){return!!this.accountReplacementSucceeded&&!this.accountReplacementSuccessHandling&&(this.accountReplacementSuccessHandling=!0,this.accountReplacementSucceeded=!1,!0)}async acknowledgeAccountReplacementSuccess(){this.accountReplacementSuccessHandling=!1,this.accountReplacementSucceeded=!1,await l.C.clearPendingAccountReplacementTask()}async claimReward(){var e,t;let r=this.beginRun(),a=await l.C.claimReward();return!r.isStale&&(this.reward={...this.reward,claimed:!0,credits:null!==(t=a.credits)&&void 0!==t?t:null===(e=this.reward)||void 0===e?void 0:e.credits},!0)}async runImport(e,t){if(e.isRunning)return;if(!this.importUploader)throw Error("data backup import uploader not registered (web only)");let r=this.importUploader,a=this.beginRun(),n="";try{if(e.startUploading(),n=(await r.upload(t,t=>{a.isStale||e.reportProgress(t)})).packageKey,a.isStale)return;await this.createAndSettle(e,n,a)}catch(r){var s;if(a.isStale)return;let t=null!==(s=(0,c.L)(r))&&void 0!==s?s:null;if(e===this.accountChain&&t===i.E0.dataBackupAccountOverwriteConfirmRequired){e.reset(),this.pendingOverwriteKey=n;return}console.warn("[dataRecovery] ".concat(e.taskType,": 发起失败"),r),e.finishFailure(t)}}async createAndSettle(e,t,r,a){e.enterProcessing();let{taskId:n}=await l.C.createImportTask(e.taskType,t,!!a);if(!n)throw Error("unexpected import task payload");r.isStale||(e===this.accountChain&&this.accountTaskIds.add(n),a&&await l.C.savePendingAccountReplacementTask({taskId:n,ownerUid:a,savedAt:Date.now()}),await this.settleTask(e,n,r,!!a))}async settleTask(e,t,r){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=await this.waitImportTaskTerminal(t);if(!r.isStale){if(!n||"failed"===n.status){var s;a&&await l.C.clearPendingAccountReplacementTask(),e.finishFailure(null!==(s=null==n?void 0:n.errorCode)&&void 0!==s?s:null);return}e.finishSuccess(),a&&(this.accountReplacementSucceeded=!0),d.userController.isLogin&&this.refreshReward(r)}}async resumeChain(e,t,r){if(e.stage!==h.Vm.idle)return;if(t.some(t=>t.taskType===e.taskType&&"ready"===t.status)){e.finishSuccess();return}let a=(0,m.n7)(t,e.taskType);a&&(0,m.Ph)(a)&&(e.enterProcessing((0,m.F8)(a.createdAt)),e===this.accountChain&&this.accountTaskIds.add(a.taskId),await this.settleTask(e,a.taskId,r))}beginRun(){return new g(this.recoveryGeneration,()=>this.recoveryGeneration)}async getRestorableAccountReplacementTask(){if(this.accountReplacementSuccessHandling)return null;let e=await l.C.readPendingAccountReplacementTask();if(!e)return null;let t=u.Z.currentUid;return t&&t!==e.ownerUid?(await l.C.clearPendingAccountReplacementTask(),null):e}resumeAccountReplacement(e,t){this.accountChain.enterProcessing(e.savedAt),this.accountTaskIds.add(e.taskId),this.settleTask(this.accountChain,e.taskId,t,!0)}waitImportTaskTerminal(e){return new Promise(t=>{this.importTaskWaiters.set(e,t),this.syncImportTasksPolling()})}syncImportTasksPolling(){if(!this.importTaskWaiters.size){this.importTasksPollTimer&&(clearInterval(this.importTasksPollTimer),this.importTasksPollTimer=null);return}this.importTasksPollTimer||(this.importTasksPollTimer=setInterval(()=>{this.pollImportTaskWaiters()},h.Yq))}async pollImportTaskWaiters(){if(this.importTasksPollInFlight||"undefined"!=typeof document&&document.hidden)return;this.importTasksPollInFlight=!0;let e=this.beginRun();try{let t=Array.from(this.importTaskWaiters.keys()).filter(e=>this.accountTaskIds.has(e));if(t.length>0&&await this.settleWaitersByPublicQuery(e,t),e.isStale)return;Array.from(this.importTaskWaiters.keys()).some(e=>!this.accountTaskIds.has(e))&&(d.userController.isLogin?await this.settleWaitersFromTaskList(e):await this.settleWaitersByPublicQuery(e))}finally{this.importTasksPollInFlight=!1,this.syncImportTasksPolling()}}async settleWaitersFromTaskList(e){try{let t=await l.C.listImportTasks();if(e.isStale)return;
1Array.from(this.importTaskWaiters.keys()).forEach(e=>{let r=t.find(t=>t.taskId===e);r&&(0,m.ZF)(r)&&!(0,m.Ph)(r)&&this.settleImportTaskWaiter(e,r)})}catch(e){console.warn("[dataRecovery] 轮询任务列表失败,继续等待",e)}}async settleWaitersByPublicQuery(e,t){for(let r of null!=t?t:Array.from(this.importTaskWaiters.keys())){if(!this.importTaskWaiters.has(r))continue;let t=await this.fetchImportTask(r);if(e.isStale)return;t&&!(0,m.Ph)(t)&&this.settleImportTaskWaiter(r,t)}}async fetchImportTask(e){try{let t=await l.C.fetchImportTask(e);return(0,m.ZF)(t)?t:null}catch(t){return console.warn("[dataRecovery] 查任务状态失败,继续等待",e,t),null}}settleImportTaskWaiter(e,t){let r=this.importTaskWaiters.get(e);r&&(this.importTaskWaiters.delete(e),this.accountTaskIds.delete(e),r(t))}abandonImportTaskWaiters(){Array.from(this.importTaskWaiters.keys()).forEach(e=>{this.settleImportTaskWaiter(e,null)}),this.syncImportTasksPolling()}async refreshReward(e){try{let t=await l.C.fetchReward();if(e.isStale)return;this.reward=t}catch(e){console.warn("[dataRecovery] 补偿状态拉取失败",e)}}resetRecoveryState(){this.recoveryGeneration+=1,this.abandonImportTaskWaiters(),this.accountTaskIds.clear(),this.recoveryInitStarted=!1,this.reward=null,this.accountReplacementSucceeded=!1,this.pendingOverwriteKey=null,this.accountChain.reset(),this.contentChain.reset()}armAccountWatch(){this.accountWatchArmed||(this.accountWatchArmed=!0,(0,o.U5)(()=>u.Z.currentUid,()=>{var e;null===(e=this.importUploader)||void 0===e||e.forget(),this.resetRecoveryState(),this.recoveryLoaded=!1}))}constructor(){(0,a._)(this,"recoveryLoaded",!1),(0,a._)(this,"reward",null),(0,a._)(this,"pendingOverwriteKey",null),(0,a._)(this,"accountReplacementSucceeded",!1),(0,a._)(this,"accountChain",new p("account")),(0,a._)(this,"contentChain",new p("content",{fakeProgressWhileProcessing:!0})),(0,a._)(this,"recoveryGeneration",0),(0,a._)(this,"recoveryInitStarted",!1),(0,a._)(this,"importTaskWaiters",new Map),(0,a._)(this,"accountTaskIds",new Set),(0,a._)(this,"importTasksPollTimer",null),(0,a._)(this,"importTasksPollInFlight",!1),(0,a._)(this,"accountWatchArmed",!1),(0,a._)(this,"accountReplacementSuccessHandling",!1),(0,a._)(this,"importUploader",null),(0,o.rC)(this)}}(0,n.gn)([s.SB],y.prototype,"recoveryLoaded",void 0),(0,n.gn)([s.SB],y.prototype,"reward",void 0),(0,n.gn)([s.SB],y.prototype,"pendingOverwriteKey",void 0),(0,n.gn)([s.SB],y.prototype,"accountReplacementSucceeded",void 0),(0,n.gn)([o.Fl],y.prototype,"canImportContent",null),(0,n.gn)([o.Fl],y.prototype,"accountOverwriteConfirmVisible",null),(0,n.gn)([o.Fl],y.prototype,"hasBlockingRecoverUpload",null);let f=new y},74454:function(e,t,r){r.d(t,{F8:function(){return n},NC:function(){return h},Ph:function(){return s},RL:function(){return u},Tr:function(){return o},ZF:function(){return c},n7:function(){return d}});let a=["preparing","ready","failed"];function n(e){if("number"==typeof e&&Number.isFinite(e)&&e>0)return e}function s(e){return"ready"!==e.status&&"failed"!==e.status}function i(e){return"account"===e||"content"===e}function o(e){var t;return!!((!e.kind||"export"===e.kind)&&e.taskId&&i(e.taskType))&&a.includes(null!==(t=e.status)&&void 0!==t?t:"")}function l(e){return(!e.kind||"import"===e.kind)&&!!e.taskId&&i(e.taskType)}function c(e){return!!e.taskId}function d(e,t){let r=e.filter(e=>e.taskType===t);return r.length?r.reduce((e,t)=>{var r,a;let s=null!==(r=n(e.createdAt))&&void 0!==r?r:0;return(null!==(a=n(t.createdAt))&&void 0!==a?a:0)>=s?t:e}):null}function u(e){return(null!=e?e:[]).filter(o)}function h(e){return(null!=e?e:[]).filter(l)}},51889:function(e,t,r){r.d(t,{I:function(){return m}});var a=r(42548),n=r(31899),s=r(83519),i=r(62517),o=r(48428),l=r(29843),c=r(18442),d=r(74643),u=r(69764);class h extends n.PN{get S(){return d.S.Global.modules.MainWindow.DataBackupPurchaseBlockDialog}handleClose(){var e,t;this.props.onDisposed(),this.closeNotified||(this.closeNotified=!0,null===(e=(t=this.props).onClose)||void 0===e||e.call(t))}handleViewAnnouncement(){this.closeNotified=!0,(0,u.BR)("purchase_block"),this.props.onDisposed()}constructor(...e){super(...e),(0,l._)(this,"props",void 0),(0,l._)(this,"closeNotified",!1)}}(0,c.gn)([n.Fl],h.prototype,"S",null);let p=n._Y.createComponent("DataBackupPurchaseBlockDialog",h,e=>(0,a.jsx)(s.u,{className:"data-backup-purchase-block-dialog--LLCbM",wrapperClassName:"purchase-block-dialog-wrap--nRYOJ",onDispose:()=>e.handleClose(),fixed:"dialogRoot"===e.props.insertTarget,width:480,children:(0,a.jsxs)("div",{className:"container--oYYyv",children:[(0,a.jsx)("div",{className:"title--_jRKK",children:e.S.title}),(0,a.jsxs)("div",{className:"content--xYdrS",children:[(0,a.jsx)("div",{children:e.S.content}),(0,a.jsx)("div",{children:e.S.refundNotice})]}),(0,a.jsxs)("footer",{className:"footer--L8b5l",children:[(0,a.jsx)(i.z,{size:"large",type:"outline",color:"secondary",onClick:()=>e.handleViewAnnouncement(),children:e.S.viewAnnouncement}),(0,a.jsx)(i.z,{size:"large",color:"primary",onClick:()=>e.handleClose(),children:e.S.gotIt})]})]})})),m=o.t.createOpener(p,{singleton:!0})},11697:function(e,t,r){r.d(t,{x7:function(){return N},Ns:function(){return b}});var a=r(7855),n=r(5620),s=r(51889),i=r(70289),o=r(45784),l=r(64171),c=r(70703),d=r(86541),u=r(4576),h=r(46687),p=r(87911),m=r(14074),g=r(40599),y=r(34087);function f(e){return"".concat(e.name,":").concat(e.size,":").concat(e.lastModified)}let v="monica_data_backup_upload_resume_sessions";function k(){let e=window.localStorage.getItem(v);if(!e)return{};try{let t=JSON.parse(e),r=Date.now(),a={};
1return Object.keys(t).forEach(e=>{let n=t[e];n&&r-n.savedAt<6048e5&&(a[e]=n)}),a}catch(e){return{}}}function C(e){window.localStorage.setItem(v,JSON.stringify(e))}class S{async upload(e,t){let a=this.completedPackages.get(f(e));if(a)return null==t||t(100),{packageKey:a};this.trackUploadStart();try{var n,s,i,o;let a=(o=e.size,Math.max(5242880,Math.ceil(o/1e4))),l=Math.max(1,Math.ceil(e.size/a)),c=await this.loadResumable(e,a),d="",{default:u}=await r.e(65762).then(r.bind(r,42700)),{default:h}=await r.e(21457).then(r.bind(r,21457)),p=new u;p.use(h,{shouldUseMultipart:!0,limit:6,getChunkSize:()=>a,createMultipartUpload:async()=>{if(c)return{uploadId:c.session.uploadId,key:c.session.key};let{uploadId:t,key:r}=(await y.Cb.botFrameworkService.dataBackupApi.initMultipartUpload({fileName:e.name})).data;if(!t||!r)throw Error("init multipart upload returned empty session");return this.saveResumeSession(e,{uploadId:t,key:r,chunkSize:a,savedAt:Date.now()}),{uploadId:t,key:r}},signPart:async(e,t)=>{var r;let{key:a,uploadId:n,partNumber:s}=t,i=await y.Cb.botFrameworkService.dataBackupApi.presignUploadPart({key:a,uploadId:n,partNumbers:[s]}),o=(null!==(r=i.data.urls)&&void 0!==r?r:[]).find(e=>e.partNumber===s);if(!(null==o?void 0:o.url))throw Error("presign result missing part ".concat(s));return{method:"PUT",url:o.url}},listParts:()=>{var e;return null!==(e=null==c?void 0:c.parts)&&void 0!==e?e:[]},completeMultipartUpload:async(t,r)=>{var a;let{key:n,uploadId:s,parts:i}=r,o=await y.Cb.botFrameworkService.dataBackupApi.completeMultipartUpload({key:n,uploadId:s,parts:i.map(e=>{var t,r;return{partNumber:null!==(t=e.PartNumber)&&void 0!==t?t:0,etag:(null!==(r=e.ETag)&&void 0!==r?r:"").replace(/"/g,"")}})});return d=null!==(a=o.data.packageKey)&&void 0!==a?a:"",this.clearResumeSession(e),{location:d}},abortMultipartUpload:async()=>{}});let m=null!==(n=null==c?void 0:c.parts.length)&&void 0!==n?n:0,g=()=>{null==t||t(Math.min(99,Math.round(m/l*100)))};p.on("s3-multipart:part-uploaded",()=>{m+=1,g()}),m>0&&g();try{let r=p.addFile({name:e.name,type:e.type,data:e});c&&p.setFileState(r,{...p.getFile(r),s3Multipart:{key:c.session.key,uploadId:c.session.uploadId}});let a=await p.upload();if(!d){let e=null==a?void 0:null===(i=a.failed)||void 0===i?void 0:null===(s=i[0])||void 0===s?void 0:s.error,t="string"==typeof e?e:null==e?void 0:e.message;throw Error(t||"complete multipart upload returned empty package key")}return null==t||t(100),this.completedPackages.set(f(e),d),{packageKey:d}}finally{p.destroy()}}finally{this.trackUploadEnd()}}forget(){this.completedPackages.clear(),window.localStorage.removeItem(v)}async loadResumable(e,t){let r=k()[f(e)];if(!r||r.chunkSize!==t)return null;try{var a;let e=await y.Cb.botFrameworkService.dataBackupApi.listUploadedParts({key:r.key,uploadId:r.uploadId}),t=[];for(let r of null!==(a=e.data.parts)&&void 0!==a?a:[])"number"==typeof r.partNumber&&"number"==typeof r.size&&r.etag&&t.push({PartNumber:r.partNumber,Size:r.size,ETag:r.etag.replace(/"/g,"")});return{session:r,parts:t}}catch(t){return console.warn("[dataBackup] list uploaded parts failed, fallback to fresh upload",t),this.clearResumeSession(e),null}}saveResumeSession(e,t){let r=k();r[f(e)]=t,C(r)}clearResumeSession(e){let t=k();t[f(e)]&&(delete t[f(e)],C(t))}trackUploadStart(){if(this.activeUploads+=1,1===this.activeUploads){let e=this.warnBeforeUnload.bind(this);this.boundWarnBeforeUnload=e,window.addEventListener("beforeunload",e)}}trackUploadEnd(){this.activeUploads=Math.max(0,this.activeUploads-1),0===this.activeUploads&&this.boundWarnBeforeUnload&&(window.removeEventListener("beforeunload",this.boundWarnBeforeUnload),this.boundWarnBeforeUnload=null)}warnBeforeUnload(e){e.preventDefault(),e.returnValue=""}constructor(){this.activeUploads=0,this.boundWarnBeforeUnload=null,this.completedPackages=new Map}}let w=new S,x=()=>{i.userController.initServiceEventListeners()},T=async()=>{await o.A.init(),await i.userController.init(),await l.teamController.init(),x()},P=!1,b=async()=>!!P||!!a.S.isRunInServerSide||new Promise(e=>{let t=setInterval(()=>{P&&(clearInterval(t),e(!0))},100)}),N=()=>{(0,c.Q)(),(0,m.useLayoutEffect)(()=>
1{a.S.isRunInServerSide||(P&&console.error("BackgroundApp has been initialized"),(0,d.O)(),u.m.setViews({openPaymentCompletedDialog:n.G}),h.Z.setViews({openDataBackupPurchaseBlockDialog:s.I}),p.w.setImportUploader(w),new g.s().init().then(async()=>{await T(),P=!0}))},[])}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.