1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,915823,e=>{"use strict";e.s(["Subscribable",0,class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}])},180166,e=>{"use strict";var t={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},r=new class{#e=t;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};e.s(["systemSetTimeoutZero",0,function(e){setTimeout(e,0)},"timeoutManager",0,r])},619273,e=>{"use strict";var t=e.i(180166),r="u"<typeof window||"Deno"in globalThis;function i(e,t){return(t?.queryKeyHashFn||s)(e)}function s(e){return JSON.stringify(e,(e,t)=>u(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function n(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&Object.keys(t).every(r=>n(e[r],t[r]))}var a=Object.prototype.hasOwnProperty;function o(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function u(e){if(!c(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!!c(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function c(e){return"[object Object]"===Object.prototype.toString.call(e)}var l=Symbol();e.s(["addToEnd",0,function(e,t,r=0){let i=[...e,t];return r&&i.length>r?i.slice(1):i},"addToStart",0,function(e,t,r=0){let i=[t,...e];return r&&i.length>r?i.slice(0,-1):i},"ensureQueryFn",0,function(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==l?e.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`))},"functionalUpdate",0,function(e,t){return"function"==typeof e?e(t):e},"hashKey",0,s,"hashQueryKeyByOptions",0,i,"isServer",0,r,"isValidTimeout",0,function(e){return"number"==typeof e&&e>=0&&e!==1/0},"keepPreviousData",0,function(e){return e},"matchMutation",0,function(e,t){let{exact:r,status:i,predicate:a,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(r){if(s(t.options.mutationKey)!==s(o))return!1}else if(!n(t.options.mutationKey,o))return!1}return(!i||t.state.status===i)&&(!a||!!a(t))},"matchQuery",0,function(e,t){let{type:r="all",exact:s,fetchStatus:a,predicate:o,queryKey:u,stale:c}=e;if(u){if(s){if(t.queryHash!==i(u,t.options))return!1}else if(!n(t.queryKey,u))return!1}if("all"!==r){let e=t.isActive();if("active"===r&&!e||"inactive"===r&&e)return!1}return("boolean"!=typeof c||t.isStale()===c)&&(!a||a===t.state.fetchStatus)&&(!o||!!o(t))},"noop",0,function(){},"partialMatchKey",0,n,"replaceData",0,function(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?function e(t,r){if(t===r)return t;let i=o(t)&&o(r);if(!i&&!(u(t)&&u(r)))return r;let s=(i?t:Object.keys(t)).length,n=i?r:Object.keys(r),c=n.length,l=i?Array(c):{},h=0;for(let o=0;o<c;o++){let u=i?o:n[o],c=t[u],d=r[u];if(c===d){l[u]=c,(i?o<s:a.call(t,u))&&h++;continue}if(null===c||null===d||"object"!=typeof c||"object"!=typeof d){l[u]=d;continue}let p=e(c,d);l[u]=p,p===c&&h++}return s===c&&h===s?t:l}(e,t):t},"resolveEnabled",0,function(e,t){return"function"==typeof e?e(t):e},"resolveStaleTime",0,function(e,t){return"function"==typeof e?e(t):e},"shallowEqualObjects",0,function(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0},"shouldThrowError",0,function(e,t){return"function"==typeof e?e(...t):!!e},"skipToken",0,l,"sleep",0,function(e){return new Promise(r=>{t.timeoutManager.setTimeout(r,e)})},"timeUntilStale",0,function(e,t){return Math.max(e+(t||0)-Date.now(),0)}])},175555,e=>{"use strict";var t=e.i(915823),r=e.i(619273),i=new class extends t.Subscribable{#r;#i;#s;constructor(){super(),this.#s=e=>{if(!r.isServer&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#i||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#i?.(),this.#i=void 0)}setEventListener(e){this.#s=e,this.#i?.(),this.#i=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#r!==e&&(this.#r=e,this.onFocus())}onFocus(){let e=this.isFocused();
1this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#r?this.#r:globalThis.document?.visibilityState!=="hidden"}};e.s(["focusManager",0,i])},540143,e=>{"use strict";let t,r,i,s,n,a;var o=e.i(180166).systemSetTimeoutZero,u=(t=[],r=0,i=e=>{e()},s=e=>{e()},n=o,{batch:e=>{let a;r++;try{a=e()}finally{let e;--r||(e=t,t=[],e.length&&n(()=>{s(()=>{e.forEach(e=>{i(e)})})}))}return a},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a=e=>{r?t.push(e):n(()=>{i(e)})},setNotifyFunction:e=>{i=e},setBatchNotifyFunction:e=>{s=e},setScheduler:e=>{n=e}});e.s(["notifyManager",0,u])},936553,814448,793803,e=>{"use strict";var t=e.i(175555),r=e.i(915823),i=e.i(619273),s=new class extends r.Subscribable{#n=!0;#i;#s;constructor(){super(),this.#s=e=>{if(!i.isServer&&window.addEventListener){let t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#i||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#i?.(),this.#i=void 0)}setEventListener(e){this.#s=e,this.#i?.(),this.#i=e(this.setOnline.bind(this))}setOnline(e){this.#n!==e&&(this.#n=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#n}};function n(){let e,t,r=new Promise((r,i)=>{e=r,t=i});function i(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=t=>{i({status:"fulfilled",value:t}),e(t)},r.reject=e=>{i({status:"rejected",reason:e}),t(e)},r}function a(e){return Math.min(1e3*2**e,3e4)}function o(e){return(e??"online")!=="online"||s.isOnline()}e.s(["onlineManager",0,s],814448),e.s(["pendingThenable",0,n],793803);var u=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};e.s(["CancelledError",0,u,"canFetch",0,o,"createRetryer",0,function(e){let r,c=!1,l=0,h=n(),d=()=>t.focusManager.isFocused()&&("always"===e.networkMode||s.isOnline())&&e.canRun(),p=()=>o(e.networkMode)&&e.canRun(),f=e=>{"pending"===h.status&&(r?.(),h.resolve(e))},y=e=>{"pending"===h.status&&(r?.(),h.reject(e))},b=()=>new Promise(t=>{r=e=>{("pending"!==h.status||d())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,"pending"===h.status&&e.onContinue?.()}),m=()=>{let t;if("pending"!==h.status)return;let r=0===l?e.initialPromise:void 0;try{t=r??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(f).catch(t=>{if("pending"!==h.status)return;let r=e.retry??3*!i.isServer,s=e.retryDelay??a,n="function"==typeof s?s(l,t):s,o=!0===r||"number"==typeof r&&l<r||"function"==typeof r&&r(l,t);c||!o?y(t):(l++,e.onFail?.(l,t),(0,i.sleep)(n).then(()=>d()?void 0:b()).then(()=>{c?y(t):m()}))})};return{promise:h,status:()=>h.status,cancel:t=>{if("pending"===h.status){let r=new u(t);y(r),e.onCancel?.(r)}},continue:()=>(r?.(),h),cancelRetry:()=>{c=!0},continueRetry:()=>{c=!1},canStart:p,start:()=>(p()?m():b().then(m),h)}}],936553)},88587,e=>{"use strict";var t=e.i(180166),r=e.i(619273),i=class{#a;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),(0,r.isValidTimeout)(this.gcTime)&&(this.#a=t.timeoutManager.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(r.isServer?1/0:3e5))}clearGcTimeout(){this.#a&&(t.timeoutManager.clearTimeout(this.#a),this.#a=void 0)}};e.s(["Removable",0,i])},869230,286491,e=>{"use strict";var t=e.i(175555),r=e.i(540143);e.i(247167);var i=e.i(619273),s=e.i(936553),n=e.i(88587),a=class extends n.Removable{#o;#u;#c;#l;#h;#d;#p;constructor(e){super(),this.#p=!1,this.#d=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#l=e.client,this.#c=this.#l.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#o=u(this.options),this.state=e.state??this.#o,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#h?.promise}setOptions(e){if(this.options={...this.#d,...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let e=u(this.options);void 0!==e.data&&(this.setData(e.data,{updatedAt:e.dataUpdatedAt,manual:!0}),this.#o=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#c.remove(this)}setData(e,t){let r=(0,i.replaceData)(this.state.data,e,this.options);return this.#f({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#f({type:"setState",state:e,setStateOptions:t})}cancel(e){let t=this.#h?.promise;return this.#h?.cancel(e),t?t.then(i.noop).catch(i.noop):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#o)}isActive(){return this.observers.some(e=>!1!==(0,i.resolveEnabled)(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===i.skipToken||this.state.dataUpdateCount+this.state.errorUpdate
1Count===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===(0,i.resolveStaleTime)(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!(0,i.timeUntilStale)(this.state.dataUpdatedAt,e))}onFocus(){let e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#h?.continue()}onOnline(){let e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#h?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#c.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#h&&(this.#p?this.#h.cancel({revert:!0}):this.#h.cancelRetry()),this.scheduleGc()),this.#c.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#f({type:"invalidate"})}async fetch(e,t){let r;if("idle"!==this.state.fetchStatus&&this.#h?.status()!=="rejected"){if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#h)return this.#h.continueRetry(),this.#h.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,a=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#p=!0,n.signal)})},o=()=>{let e,r=(0,i.ensureQueryFn)(this.options,t),s=(a(e={client:this.#l,queryKey:this.queryKey,meta:this.meta}),e);return(this.#p=!1,this.options.persister)?this.options.persister(r,s,this):r(s)},u=(a(r={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#l,state:this.state,fetchFn:o}),r);this.options.behavior?.onFetch(u,this),this.#u=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==u.fetchOptions?.meta)&&this.#f({type:"fetch",meta:u.fetchOptions?.meta}),this.#h=(0,s.createRetryer)({initialPromise:t?.initialPromise,fn:u.fetchFn,onCancel:e=>{e instanceof s.CancelledError&&e.revert&&this.setState({...this.#u,fetchStatus:"idle"}),n.abort()},onFail:(e,t)=>{this.#f({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#f({type:"pause"})},onContinue:()=>{this.#f({type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0});try{let e=await this.#h.start();if(void 0===e)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#c.config.onSuccess?.(e,this),this.#c.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof s.CancelledError){if(e.silent)return this.#h.promise;else if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#f({type:"error",error:e}),this.#c.config.onError?.(e,this),this.#c.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#f(e){let t=t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...o(t.data,this.options),fetchMeta:e.meta??null};case"success":let r={...t,data:e.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#u=e.manual?r:void 0,r;case"error":let i=e.error;return{...t,error:i,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}};this.state=t(this.state),r.notifyManager.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#c.notify({query:this,type:"updated",action:e})})}};function o(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:(0,s.canFetch)(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function u(e){let t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,i=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?i??Date.now():0,error:null,errorUpdate
1Count:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}e.s(["Query",0,a,"fetchState",0,o],286491);var c=e.i(915823),l=e.i(793803),h=e.i(180166),d=class extends c.Subscribable{constructor(e,t){super(),this.options=t,this.#l=e,this.#y=null,this.#b=(0,l.pendingThenable)(),this.bindMethods(),this.setOptions(t)}#l;#m=void 0;#v=void 0;#_=void 0;#g;#S;#b;#y;#w;#R;#T;#E;#C;#D;#O=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#m.addObserver(this),p(this.#m,this.options)?this.#F():this.updateResult(),this.#I())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return f(this.#m,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return f(this.#m,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#Q(),this.#P(),this.#m.removeObserver(this)}setOptions(e){let t=this.options,r=this.#m;if(this.options=this.#l.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,i.resolveEnabled)(this.options.enabled,this.#m))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#U(),this.#m.setOptions(this.options),t._defaulted&&!(0,i.shallowEqualObjects)(this.options,t)&&this.#l.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#m,observer:this});let s=this.hasListeners();s&&y(this.#m,r,this.options,t)&&this.#F(),this.updateResult(),s&&(this.#m!==r||(0,i.resolveEnabled)(this.options.enabled,this.#m)!==(0,i.resolveEnabled)(t.enabled,this.#m)||(0,i.resolveStaleTime)(this.options.staleTime,this.#m)!==(0,i.resolveStaleTime)(t.staleTime,this.#m))&&this.#k();let n=this.#x();s&&(this.#m!==r||(0,i.resolveEnabled)(this.options.enabled,this.#m)!==(0,i.resolveEnabled)(t.enabled,this.#m)||n!==this.#D)&&this.#q(n)}getOptimisticResult(e){var t,r;let s=this.#l.getQueryCache().build(this.#l,e),n=this.createResult(s,e);return t=this,r=n,(0,i.shallowEqualObjects)(t.getCurrentResult(),r)||(this.#_=n,this.#S=this.options,this.#g=this.#m.state),n}getCurrentResult(){return this.#_}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#b.status||this.#b.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#O.add(e)}getCurrentQuery(){return this.#m}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#l.defaultQueryOptions(e),r=this.#l.getQueryCache().build(this.#l,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#F({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#_))}#F(e){this.#U();let t=this.#m.fetch(this.options,e);return e?.throwOnError||(t=t.catch(i.noop)),t}#k(){this.#Q();let e=(0,i.resolveStaleTime)(this.options.staleTime,this.#m);if(i.isServer||this.#_.isStale||!(0,i.isValidTimeout)(e))return;let t=(0,i.timeUntilStale)(this.#_.dataUpdatedAt,e);this.#E=h.timeoutManager.setTimeout(()=>{this.#_.isStale||this.updateResult()},t+1)}#x(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#m):this.options.refetchInterval)??!1}#q(e){this.#P(),this.#D=e,!i.isServer&&!1!==(0,i.resolveEnabled)(this.options.enabled,this.#m)&&(0,i.isValidTimeout)(this.#D)&&0!==this.#D&&(this.#C=h.timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||t.focusManager.isFocused())&&this.#F()},this.#D))}#I(){this.#k(),this.#q(this.#x())}#Q(){this.#E&&(h.timeoutManager.clearTimeout(this.#E),this.#E=void 0)}#P(){this.#C&&(h.timeoutManager.clearInterval(this.#C),this.#C=void 0)}createResult(e,t){let r,s=this.#m,n=this.options,a=this.#_,u=this.#g,c=this.#S,h=e!==s?e.state:this.#v,{state:d}=e,f={...d},m=!1;if(t._optimisticResults){let r=this.hasListeners(),i=!r&&p(e,t),a=r&&y(e,s,t,n);(i||a)&&(f={...f,...o(d.data,e.options)}),"isRestoring"===t._optimisticResults&&(f.fetchStatus="idle")}let{error:v,errorUpdatedAt:_,status:g}=f;r=f.data;let S=!1;if(void 0!==t.placeholderData&&void 0===r&&"pending"===g){let e;a?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=a.data,S=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#T?.state.data,this.#T):t.placeholderData,void 0!==e&&(g="success",r=(0,i.replaceData)(a?.data,e,t),m=!0)}if(t.select&&void 0!==r&&!S)if(a&&r===u?.data&&t.select===this.#w)r=this.#R;else try{this.#w=t.select,r=t.select(r),r=(0,i.replaceData)(a?.data,r,t),this.#R=r,this.#y=null}catch(e){this.#y=e}this.#y&&(v=this.#y,r=this.#R,_=Date.now(),g="error");let w="fetching"===f.fetchStatus,R="pending"===g,T="error"===g,E=R&&w,C=void 0!==r,D={status:g,fetchStatus:f.fetchStatus,isPending:R,isSuccess:"success"===g,isError:T,isInitialLoading:E,isLoading:E,data:r,dataUpdatedAt:f.dataUpdatedAt,error:v,errorUpdatedAt:_,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdate
1Count:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>h.dataUpdateCount||f.errorUpdateCount>h.errorUpdateCount,isFetching:w,isRefetching:w&&!R,isLoadingError:T&&!C,isPaused:"paused"===f.fetchStatus,isPlaceholderData:m,isRefetchError:T&&C,isStale:b(e,t),refetch:this.refetch,promise:this.#b,isEnabled:!1!==(0,i.resolveEnabled)(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=e=>{"error"===D.status?e.reject(D.error):void 0!==D.data&&e.resolve(D.data)},r=()=>{t(this.#b=D.promise=(0,l.pendingThenable)())},i=this.#b;switch(i.status){case"pending":e.queryHash===s.queryHash&&t(i);break;case"fulfilled":("error"===D.status||D.data!==i.value)&&r();break;case"rejected":("error"!==D.status||D.error!==i.reason)&&r()}}return D}updateResult(){let e=this.#_,t=this.createResult(this.#m,this.options);if(this.#g=this.#m.state,this.#S=this.options,void 0!==this.#g.data&&(this.#T=this.#m),(0,i.shallowEqualObjects)(t,e))return;this.#_=t;let r=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#O.size)return!0;let i=new Set(r??this.#O);return this.options.throwOnError&&i.add("error"),Object.keys(this.#_).some(t=>this.#_[t]!==e[t]&&i.has(t))};this.#j({listeners:r()})}#U(){let e=this.#l.getQueryCache().build(this.#l,this.options);if(e===this.#m)return;let t=this.#m;this.#m=e,this.#v=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#I()}#j(e){r.notifyManager.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#_)}),this.#l.getQueryCache().notify({query:this.#m,type:"observerResultsUpdated"})})}};function p(e,t){return!1!==(0,i.resolveEnabled)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&f(e,t,t.refetchOnMount)}function f(e,t,r){if(!1!==(0,i.resolveEnabled)(t.enabled,e)&&"static"!==(0,i.resolveStaleTime)(t.staleTime,e)){let i="function"==typeof r?r(e):r;return"always"===i||!1!==i&&b(e,t)}return!1}function y(e,t,r,s){return(e!==t||!1===(0,i.resolveEnabled)(s.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&b(e,r)}function b(e,t){return!1!==(0,i.resolveEnabled)(t.enabled,e)&&e.isStaleByTime((0,i.resolveStaleTime)(t.staleTime,e))}e.s(["QueryObserver",0,d],869230)},912598,e=>{"use strict";var t=e.i(271645),r=e.i(843476),i=t.createContext(void 0);e.s(["QueryClientProvider",0,({client:e,children:s})=>(t.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,r.jsx)(i.Provider,{value:e,children:s})),"useQueryClient",0,e=>{let r=t.useContext(i);if(e)return e;if(!r)throw Error("No QueryClient set, use QueryClientProvider to set one");return r}])},266027,e=>{"use strict";let t;var r=e.i(869230);e.i(247167);var i=e.i(271645),s=e.i(619273),n=e.i(540143),a=e.i(912598);e.i(843476);var o=i.createContext((t=!1,{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t})),u=i.createContext(!1);u.Provider;var c=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});e.s(["useQuery",0,function(e,t){return function(e,t,r){let l=i.useContext(u),h=i.useContext(o),d=(0,a.useQueryClient)(r),p=d.defaultQueryOptions(e);if(d.getDefaultOptions().queries?._experimental_beforeQuery?.(p),p._optimisticResults=l?"isRestoring":"optimistic",p.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=p.staleTime;p.staleTime="function"==typeof t?(...r)=>e(t(...r)):e(t),"number"==typeof p.gcTime&&(p.gcTime=Math.max(p.gcTime,1e3))}(p.suspense||p.throwOnError||p.experimental_prefetchInRender)&&!h.isReset()&&(p.retryOnMount=!1),i.useEffect(()=>{h.clearReset()},[h]);let f=!d.getQueryCache().get(p.queryHash),[y]=i.useState(()=>new t(d,p)),b=y.getOptimisticResult(p),m=!l&&!1!==e.subscribed;if(i.useSyncExternalStore(i.useCallback(e=>{let t=m?y.subscribe(n.notifyManager.batchCalls(e)):s.noop;return y.updateResult(),t},[y,m]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),i.useEffect(()=>{y.setOptions(p)},[p,y]),p?.suspense&&b.isPending)throw c(p,y,h);if((({result:e,errorResetBoundary:t,throwOnError:r,query:i,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&i&&(n&&void 0===e.data||(0,s.shouldThrowError)(r,[e.error,i])))({result:b,errorResetBoundary:h,throwOnError:p.throwOnError,query:d.getQueryCache().get(p.queryHash),suspense:p.suspense}))throw b.error;if(d.getDefaultOptions().queries?._experimental_afterQuery?.(p,b),p.experimental_prefetchInRender&&!s.isServer&&b.isLoading&&b.isFetching&&!l){let e=f?c(p,y,h):d.getQueryCache().get(p.queryHash)?.promise;e?.catch(s.noop).finally(()=>{y.updateResult()})}return p.notifyOnChangeProps?b:y.trackResult(b)}(e,r.QueryObserver,t)}],266027)},791339,204481,e=>{"use strict";var t=e.i(843476),r=e.i(383642),i=e.i(920755),s=e.i(603092);function n(e){return"active"===e?0:"past_due"===e||"paused"===e?1:2}function a(e){return"recurring"===e?0:"lifetime"===e?1:2}let o=["id","status","subscription_type","updated_at"];async function u(e,t,r,{activeOnly:i=!1,statuses:s,types:c}={}){var l;let h=new Set(function(e){let t=[],r=0,i="";for(let s of e)"("===s&&r++,")"===s&&r--,","===s&&0===r?(t.push(i.trim()),i=""):i+=s;return t.push(i.trim()),t.filter(Boolean)}(r));if(!h.has("*"))for(let e of o)h.add(e);let d=e.from("subscriptions").select([...h].join(", ")).eq("user_id",t);i&&(d=d.eq("status","active")),s&&(d=d.in("status",[...s])),c&&(d=d.in("subscription_type",[...c]));let{data:p,error:f}=await d;return{data:(l=p??[])&&0!==l.length?[...l].sort((e,t)=>
1{let r=n(e.status)-n(t.status);if(0!==r)return r;let i=a(e.subscription_type)-a(t.subscription_type);if(0!==i)return i;let s=e.updated_at?new Date(e.updated_at).getTime():0,o=t.updated_at?new Date(t.updated_at).getTime():0;return s!==o?o-s:String(e.id??"").localeCompare(String(t.id??""))})[0]:null,error:f}}class c{get supabase(){return(0,i.getSupabaseClient)()}async getUserSubscription(e,t){if(!e)return console.warn("[SubscriptionService] Cannot fetch subscription without a user ID"),null;try{let r=await this.getSubscriptionFromDatabase(e);if(r&&"trial"===r.subscription_type)return console.info(`[SubscriptionService] Found trial subscription for user: ${e}, skipping Polar API call`),r;let i=await this.getSubscriptionFromPolar(e,t);if(i)return i;return await this.getSubscriptionFromDatabase(e)}catch(r){let t=r instanceof Error?r.message:"Unknown error";return console.error(`Error fetching subscription: ${t}`),await this.getSubscriptionFromDatabase(e)}}async getUserSubscriptionWithOrders(e,t){if(!e)return console.warn("[SubscriptionService] Cannot fetch subscription without a user ID"),{subscription:null,orders:[]};
1try{let t=await this.getSubscriptionFromDatabase(e);if(t&&"trial"===t.subscription_type)return console.info(`[SubscriptionService] Found trial subscription for user: ${e}, skipping Polar API call for orders`),{subscription:t,orders:[]};console.info(`[SubscriptionService] Fetching subscription and orders for user: ${e}`);let[r,i]=await Promise.all([fetch("/api/subscriptions",{method:"GET",headers:{"Content-Type":"application/json"}}),fetch("/api/orders",{method:"GET",headers:{"Content-Type":"application/json"}})]),s=null;if(r.ok){let t=await r.json();t.items&&t.items.length>0&&(s=await this.completeSubscriptionData({...t.items[0],user_id:e}))}s||(s=await this.getSubscriptionFromDatabase(e));let n=[];return i.ok&&(n=(await i.json()).orders||[]),console.info(`[SubscriptionService] Found subscription: ${!!s}, orders: ${n.length}`),{subscription:s,orders:n}}catch(r){let t=r instanceof Error?r.message:"Unknown error";return console.error(`Error fetching subscription with orders: ${t}`),{subscription:await this.getSubscriptionFromDatabase(e),orders:[]}}}async getSubscriptionFromPolar(e,t){try{console.info(`[SubscriptionService] Fetching subscription via API for user: ${e}`);let t=await fetch("/api/subscriptions?active=true",{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok){if(404===t.status)return console.info(`[SubscriptionService] No subscription found in Polar for user: ${e}`),null;throw Error(`API error: ${t.status} ${t.statusText}`)}let r=await t.json();if(!r.items||0===r.items.length)return console.info(`[SubscriptionService] No active subscriptions found for user: ${e}`),null;let i=r.items[0];return console.info(`[SubscriptionService] Successfully found subscription via API for user: ${e}`),await this.completeSubscriptionData({...i,user_id:e})}catch(t){let e=t instanceof Error?t.message:"Unknown error";return console.error(`[SubscriptionService] Error fetching subscription via API: ${e}`),null}}async getSubscriptionFromDatabase(e){try{console.info(`[SubscriptionService] Fetching subscription from database for user: ${e}`);let{data:t,error:r}=await u(this.supabase,e,`*, 2 subscription_tiers!fk_subscriptions_tier_level( 3 name, 4 max_connections, 5 product_id_monthly, 6 product_id_yearly, 7 price_monthly, 8 price_yearly, 9 bundled_vps_tier_level, 10 ai_credits_limit 11 ), 12 appsumo_tiers!subscriptions_appsumo_tier_fkey( 13 ai_credits_limit 14 )`,{activeOnly:!0});if(r&&"PGRST116"!==r.code){let e=r.message||"Unknown database error";return console.error(`Database error fetching subscription: ${e}`),null}if(!t)return null;return await this.completeSubscriptionData(t)}catch(t){let e=t instanceof Error?t.message:"Unknown error";return console.error(`Error fetching subscription from database: ${e}`),null}}async completeSubscriptionData(e){try{let t,r,i=e.user_id;if(!i)return null;let s={...e,id:e.id||"temp-id",billing_cycle:"yearly"===e.billing_cycle||"monthly"===e.billing_cycle||"lifetime"===e.billing_cycle?e.billing_cycle:"monthly",tier_level:e.tier_level||0,subscription_type:e.subscription_type||"trial",current_period_start:e.current_period_start||new Date().toISOString(),current_period_end:"lifetime"===e.billing_cycle?null:"trial"!==e.subscription_type||e.current_period_end?e.current_period_end||this.calculateEndDate(e.current_period_start):null},n=s.tier_level,a=null,o=e.subscription_tiers;if(o)a=o;else if(null!=n){let{data:e,error:t}=await this.supabase.from("subscription_tiers").select("tier_level, name, max_connections, product_id_monthly, product_id_yearly, price_monthly, price_yearly, bundled_vps_tier_level, ai_credits_limit, vps_discount_percent").eq("tier_level",n).single();t?console.error("Error fetching tier data:",t):a=e}
14let u=await this.getSubscriptionFeatures(n,e.provider),c={...s,features:u,product_name:a?.name||e.product_name||this.getTierName(n),max_connections:e.max_connections??a?.max_connections??1,...(t=a,r=e.appsumo_tiers?.ai_credits_limit??null,{bundled_vps_tier_level:t?.bundled_vps_tier_level??null,ai_credits_limit:r??t?.ai_credits_limit??null,vps_discount_percent:t?.vps_discount_percent??null}),hosting_grandfathered_at:e.users?.hosting_grandfathered_at??e.hosting_grandfathered_at??null,grandfathered_vps_tier_level:e.users?.grandfathered_vps_tier_level??e.grandfathered_vps_tier_level??null};if(delete c.users,"temp-id"!==c.id){let t=await this.getPendingDowngrade(i,e);t&&(c.pending_downgrade=t)}return c}catch(t){let e=t instanceof Error?t.message:"Unknown error";return console.error(`Error completing subscription data: ${e}`),null}}async getSubscriptionFeatures(t,r){try{let{data:i,error:s}=await this.supabase.from("features").select("id, name, description, min_tier_level, is_active, category").lte("min_tier_level",t).eq("is_active",!0);if(s){let e=s.message||"Unknown error";return console.error(`Error fetching features: ${e}`),[]}let n=i?i.map(e=>({id:e.id,name:e.name,description:e.description,min_tier_level:e.min_tier_level,is_active:!0,has_access:!0,category:e.category??void 0})):[];if("appsumo"===r){let{fetchAppsumoDeniedIds:r,applyAppsumoDenyList:i}=await e.A(79327),s=await r(this.supabase,t);n=i(n,s)}return n}catch(t){let e=t instanceof Error?t.message:"Unknown error";return console.error(`Error fetching features: ${e}`),[]}}async getPendingDowngrade(e,t){try{let e,r=t.pending_product_id;if(!r)return null;let i=["product_id_monthly","product_id_yearly","dev_product_id_monthly","dev_product_id_yearly","creem_product_id_monthly","creem_product_id_yearly","dev_creem_product_id_monthly","dev_creem_product_id_yearly"],s=i.map(e=>`${e}.eq.${r}`).join(","),{data:n,error:a}=await this.supabase.from("subscription_tiers").select(`name, tier_level, ${i.join(", ")}`).or(s).single();if(a||!n)return console.error("Error fetching tier for pending downgrade:",a),null;return["product_id_monthly","dev_product_id_monthly","creem_product_id_monthly","dev_creem_product_id_monthly"].some(e=>n[e]===r)?e="monthly":["product_id_yearly","dev_product_id_yearly","creem_product_id_yearly","dev_creem_product_id_yearly"].some(e=>n[e]===r)&&(e="yearly"),{id:t.id||"",subscription_id:t.id||"",effective_date:t.current_period_end||"",target_tier_level:n.tier_level,target_product_name:n.name,target_billing_cycle:e}}catch(e){return console.error("Error fetching pending downgrade:",e),null}}async cancelDowngrade(e,t){try{let e=await fetch("/api/subscriptions/cancel-downgrade",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({changeId:t})}),r=await e.json();if(!e.ok){let t=r.error||`Failed to cancel downgrade: ${e.status} ${e.statusText}`;return console.error("Error cancelling downgrade:",t),!1}return console.info(`Successfully cancelled downgrade for change ID: ${t}`),!0}catch(e){return console.error("Error cancelling downgrade:",e),!1}}calculateEndDate(e){let t=new Date(new Date(e||new Date));return t.setDate(t.getDate()+30),t.toISOString()}getTierName(e){switch(e){case 3:return"Professional Plan";case 2:return"Advanced Plan";case 1:return"Starter Plan";case 0:return"Bridge Plan";default:return"Basic Plan"}}clearCache(){console.info("[SubscriptionService] Cache clear requested - React Query will handle refresh")}async getAllUserSubscriptions(e){if(!e)return console.warn("[SubscriptionService] Cannot fetch subscriptions without a user ID"),[];try{console.info(`[SubscriptionService] Fetching all subscriptions for user: ${e}`);let{data:t,error:r}=await this.supabase.from("subscriptions").select(` 15 *, 16 users:user_id ( hosting_grandfathered_at, grandfathered_vps_tier_level ), 17 subscription_tiers!fk_subscriptions_tier_level( 18 name, 19 max_connections, 20 product_id_monthly, 21 product_id_yearly, 22 product_id_ltd, 23 price_monthly, 24 price_yearly, 25 price_ltd, 26 bundled_vps_tier_level, 27 ai_credits_limit 28 ), 29 appsumo_tiers!subscriptions_appsumo_tier_fkey( 30 ai_credits_limit 31 ) 32 `).eq("user_id",e).order("created_at",{ascending:!1});if(r)return console.error(`Database error fetching subscriptions: ${r.message}`),[];if(!t||0===t.length)return[];return(await Promise.all(t.map(e=>this.completeSubscriptionData(e)))).filter(e=>null!==e)}catch(t){let e=t instanceof Error?t.message:"Unknown error";return console.error(`Error fetching all subscriptions: ${e}`),[]}}async getLifetimeSubscription(e){return(await this.getAllUserSubscriptions(e)).find(e=>"lifetime"===e.billing_cycle&&(0,s.holdsLifetimePlan)(e.status))||null}async getRecurringSubscription(e){return(await this.getAllUserSubscriptions(e)).find(e=>"lifetime"!==e.billing_cycle&&"active"===e.status&&(null===e.current_period_end||new Date(e.current_period_end)>new Date))||null}calculateTotalConnections(e){return(0,s.totalConnectionLimit)(e)}hasPremiumFeatures(e,t){return!(!e||"trial"===e.subscription_type||"active"!==e.status||e.current_period_end&&new Date(e.current_period_end)<=new Date)&&(!!(t&&(0,s.holdsLifetimePlan)(t.status))||e.tier_level>=2)}getPremiumFeaturesExpiration(e){return e&&e.current_period_end?new Date(e.current_period_end):null}async getSubscriptionByType(e,t){try{let{data:r,error:i}=await this.supabase.from("subscriptions").select("id, user_id, status, subscription_type, tier_level, max_connections, billing_cycle, current_period_start, current_period_end, cancel_at_period_end").eq("user_id",e).eq("subscription_type",t).maybeSingle();if(i)return console.error(`[SubscriptionService] Error fetching ${t} subscription:`,i),null;return r}catch(e){return console.error(`[SubscriptionService] Exception fetching ${t} subscription:`,e),null}}
32async hasSubscriptionType(e,t){let r=await this.getSubscriptionByType(e,t);return null!==r&&"active"===r.status}async getSubscriptionCountByType(e,t){try{let{count:r,error:i}=await this.supabase.from("subscriptions").select("*",{count:"exact",head:!0}).eq("user_id",e).eq("subscription_type",t).eq("status","active");if(i)return console.error(`[SubscriptionService] Error counting ${t} subscriptions:`,i),0;return r||0}catch(e){return console.error(`[SubscriptionService] Exception counting ${t} subscriptions:`,e),0}}}var l=e.i(266027),h=e.i(912598),d=e.i(271645);let p=new c,f={},y=!1;function b(){let{user:e}=(0,r.useAuth)(),t=(0,h.useQueryClient)(),i=(0,d.useRef)(!1),n=(0,d.useRef)(!1),[a,o]=(0,d.useState)(!1);(0,d.useEffect)(()=>{if(!y){y=!0;try{let e=[];for(let t=0;t<window.localStorage.length;t++){let r=window.localStorage.key(t);r&&r.startsWith("tsgnl:subs:")&&e.push(r)}e.forEach(e=>window.localStorage.removeItem(e))}catch{}}},[]);let u=(0,d.useMemo)(()=>["subscription",e?.id],[e?.id]),{data:c,isLoading:b,error:m,refetch:v}=(0,l.useQuery)({queryKey:u,queryFn:async()=>{if(!e?.id)return console.info("[useSubscriptionData] No user ID, returning empty array"),[];try{return console.info(`[useSubscriptionData] Fetching all subscriptions for user: ${e.id}`),await p.getAllUserSubscriptions(e.id)}catch(e){throw console.error("[useSubscriptionData] Error fetching subscriptions:",e),e}},enabled:!!e?.id,staleTime:6e5,refetchOnWindowFocus:!1,retry:3,gcTime:9e5}),_=c?.find(e=>"lifetime"===e.billing_cycle&&(0,s.holdsLifetimePlan)(e.status))||null,g=c?.find(e=>"recurring"===e.subscription_type&&"active"===e.status&&(null===e.current_period_end||new Date(e.current_period_end)>new Date))||null,S=g||_||c?.[0]||null,w=!!(S?.hosting_grandfathered_at??c?.find(e=>e.hosting_grandfathered_at)?.hosting_grandfathered_at),R=e?.id?`subscription:init:${e.id}`:null,T=(0,d.useCallback)(()=>!!t.getQueryData(u),[t,u]),E=(0,d.useCallback)(async()=>(console.info("[useSubscriptionData] Manually refreshing subscription data"),e?.id&&(p.clearCache(),R&&(f[R]=!1)),t.invalidateQueries({queryKey:u}),i.current=!0,v()),[v,e?.id,p,R,t,u]),C=(0,d.useCallback)(async()=>{if(T())return void console.info("[useSubscriptionData] Using cached subscription data");if(R&&!0===f[R])return console.info("[useSubscriptionData] Another component is already initializing, waiting"),new Promise(e=>{let t=setInterval(()=>{(!0!==f[R]||T())&&(clearInterval(t),e())},100);setTimeout(()=>{clearInterval(t),e()},5e3)});if(n.current)return void console.info("[useSubscriptionData] Already initializing in this component, skipping duplicate request");if(!i.current&&e?.id)try{console.info("[useSubscriptionData] Initializing subscription data"),n.current=!0,R&&(f[R]=!0),o(!0),await v(),i.current=!0}catch(e){console.error("[useSubscriptionData] Error initializing subscription:",e)}finally{n.current=!1,R&&(f[R]=!1),o(!1)}},[e?.id,v,T,R]),D=!!S&&"active"===S.status,O=!!S&&("recurring"===S.subscription_type?(0,s.holdsRecurringPlan)(S.status):"active"===S.status),F=O||!!_||!!g,I=!!S&&("cancelled"===S.status||"suspended"===S.status),Q=!!S&&"inactive"===S.status,P=!!S&&"past_due"===S.status,U=!!S&&"paused"===S.status,k=!!S&&!0===S.cancel_at_period_end&&"active"===S.status&&"trial"!==S.subscription_type&&"lifetime"!==S.subscription_type&&"lifetime"!==S.billing_cycle&&!!S.current_period_end,x=S?.subscription_type==="trial"&&!!S?.trial_activated_at,q=S?.subscription_type==="trial"&&S?.status!=="active"&&!S?.trial_activated_at,j=S?.subscription_type==="trial"&&S?.status!=="active"&&!q,M=S?.subscription_type==="trial"&&S?.trial_abuse===!0,A=S?.subscription_type==="recurring"&&!(0,s.holdsRecurringPlan)(S?.status),$=c?p.calculateTotalConnections(c):1,L=_?.max_connections||0,K=g?.max_connections||0,B=[O?S:null,_,g].reduce((e,t)=>Math.max(e,t?.tier_level??0),0),G=p.hasPremiumFeatures(g,_),N=p.getPremiumFeaturesExpiration(g),H=S?.max_connections||1,W=!!S&&"active"===S.status,z=W&&Number(S?.tier_credits??0)||0,V=W&&Number(S?.purchased_credits??0)||0,J=Math.round(z)+Math.round(V),Z=W&&((Number(S?.ai_credits_limit??0)||0)>0||V>0),X=!!_,Y=!!g;return{subscription:S,loading:b||a,error:m?m.message:void 0,refreshSubscription:E,initializeSubscription:C,isActive:D,isCancelled:I,isCancelledAtPeriodEnd:k,isInactive:Q,isPaused:U,isTrialExpired:j,isTrialActivated:x,isNoTrialSignup:q,isPrimaryHeld:O,holdsPlan:F,isTrialAbuse:M,isRecurringExpired:A,isPastDue:P,maxConnections:H,daysRemaining:(()=>
32{if(!S?.current_period_end)return 0;let e=new Date(S.current_period_end),t=new Date;return Math.max(0,Math.ceil((e.getTime()-t.getTime())/864e5))})(),tierLevel:B,hostingGrandfathered:w,hasCachedData:T(),aiCreditsRemaining:J,hasAiCredits:Z,lifetimeSubscription:_,recurringSubscription:g,hasLifetimeSubscription:X,hasRecurringSubscription:Y,totalConnectionLimit:$,lifetimeConnectionLimit:L,recurringConnectionLimit:K,hasPremiumFeatures:G,premiumFeaturesExpireAt:N}}e.s(["useSubscriptionData",0,b],204481),(e.i(247167).default.env.NEXT_PUBLIC_DEV_FEATURE_OVERRIDES??"").split(",").map(e=>e.trim()).filter(Boolean);let m=(0,d.createContext)(null);e.s(["SubscriptionProvider",0,function({children:e}){let{subscription:r,loading:i,error:s,refreshSubscription:n,initializeSubscription:a,isActive:o,isCancelled:u,isCancelledAtPeriodEnd:l,isInactive:h,isPaused:d,isTrialExpired:p,isTrialActivated:f,isNoTrialSignup:y,isPrimaryHeld:v,holdsPlan:_,isTrialAbuse:g,isRecurringExpired:S,isPastDue:w,maxConnections:R,daysRemaining:T,tierLevel:E,hostingGrandfathered:C,aiCreditsRemaining:D,hasAiCredits:O,lifetimeSubscription:F,recurringSubscription:I,hasLifetimeSubscription:Q,hasRecurringSubscription:P,totalConnectionLimit:U,lifetimeConnectionLimit:k,recurringConnectionLimit:x,hasPremiumFeatures:q,premiumFeaturesExpireAt:j}=b(),M=new c,A=async e=>M.getUserSubscription(e,void 0),$=async()=>{await n()},L=async()=>{await a()},K=async e=>{if(!r?.user_id)return!1;let t=await M.cancelDowngrade(r.user_id,e);return t&&await $(),t};return(0,t.jsx)(m.Provider,{value:{subscription:r||null,loading:i,error:s,refreshSubscription:$,initializeSubscription:L,isActive:o,isCancelled:u,isCancelledAtPeriodEnd:l,isInactive:h,isPaused:d,isTrialExpired:p,isTrialActivated:f,isNoTrialSignup:y,holdsPlan:_,isTrialAbuse:g,isRecurringExpired:S,isPastDue:w,maxConnections:R,daysRemaining:T,tierLevel:E,aiCreditsRemaining:D,hasAiCredits:O,isTrial:r?.subscription_type==="trial",hostingGrandfathered:C,lifetimeSubscription:F,recurringSubscription:I,hasLifetimeSubscription:Q,hasRecurringSubscription:P,totalConnectionLimit:U,lifetimeConnectionLimit:k,recurringConnectionLimit:x,hasPremiumFeatures:q,premiumFeaturesExpireAt:j,hasFeature:e=>[F,I,v?r:null].some(t=>t?.features?.some(t=>t.id===e)),getActiveSubscriptionForUser:A,cancelDowngrade:K},children:e})},"useSubscription",0,function(){let e=(0,d.useContext)(m);if(!e)throw Error("useSubscription must be used within a SubscriptionProvider");return e}],791339)}]);
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.