PageSourceSearch

https://www.akeptus.com/_next/static/chunks/pages/ai/chat-fec92b1f595e5a5d.js

js akeptus.com collected 2026-10-01 15:36:49 UTC 60,002 bytes, 9 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3369,7009,9015,13038,17485,25750,32257,35419,38334,39866,57800,61840,62247,69705,71354,83746,84628,92086],{16070:(e,t,r)=>{"use strict";r.d(t,{X:()=>i,i:()=>a});let n={"stress-test":"/homeowners/resilience","plan-ahead":"/homeowners/continuity"};function a(e){var t;let r=Array.isArray(e)?e[0]:e;return"string"==typeof r&&null!=(t=n[r])?t:null}let s={"/homeowners/nature":"/homeowners/app"};function i(e){let t;if(!e)return null;try{t=new URL(e,"https://akeptus.local")}catch(e){return null}let r=s[t.pathname];return r||("/homeowners/emergency"!==t.pathname?null:a(t.searchParams.get("tab")))}},47137:(e,t,r)=>{"use strict";r.d(t,{F:()=>i});var n=r(869241);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,s=n.$,i=(e,t)=>r=>{var n;if((null==t?void 0:t.variants)==null)return s(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:i,defaultVariants:o}=t,l=Object.keys(i).map(e=>{let t=null==r?void 0:r[e],n=null==o?void 0:o[e];if(null===t)return null;let s=a(t)||a(n);return i[e][s]}),c=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{});return s(e,l,null==t||null==(n=t.compoundVariants)?void 0:n.reduce((e,t)=>{let{class:r,className:n,...a}=t;return Object.entries(a).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...c}[t]):({...o,...c})[t]===r})?[...e,r,n]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},54368:(e,t,r)=>{"use strict";r.d(t,{s:()=>s});var n=r(14232);function a(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function s(...e){return n.useCallback(function(...e){return t=>{let r=!1,n=e.map(e=>{let n=a(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){let r=n[t];"function"==typeof r?r():a(e[t],null)}}}}(...e),e)}},60011:(e,t,r)=>{"use strict";r.d(t,{_A:()=>o,aB:()=>l,xA:()=>s});var n=r(920503),a=r(16070);let s="/homeowners/app",i=["/homeowners","/profile"];function o(e){var t;return!!e&&"homeowner"===String(null!=(t=e.organizationType)?t:"").trim().toLowerCase()}function l(e,t){var r;let s=(0,n.pJ)(e,{allowedOrigin:t}),o=null!=(r=(0,a.X)(s))?r:s;if(!o)return null;try{let e=new URL(o,null!=t?t:"https://akeptus.local");return i.some(t=>e.pathname===t||e.pathname.startsWith("".concat(t,"/")))?o:null}catch(e){return null}}},61016:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>v});var n=r(14232),a=r(975656),s=r(341941),i=r(585111),o=r(656840),l=r(538806);let c=()=>{},u=c(),d=Object,f=e=>e===u,h=new WeakMap,m=(e,t)=>e===`[object ${t}]`,g=0,p=e=>{let t,r,n=typeof e,a=d.prototype.toString.call(e),s=m(a,"Date"),i=m(a,"RegExp"),o=m(a,"Object");if(d(e)!==e||s||i)t=s?e.toJSON():"symbol"==n?e.toString():"string"==n?JSON.stringify(e):""+e;else{if(t=h.get(e))return t;if(t=++g+"~",h.set(e,t),Array.isArray(e)){for(r=0,t="@";r<e.length;r++)t+=p(e[r])+",";h.set(e,t)}if(o){t="#";let n=d.keys(e).sort();for(;!f(r=n.pop());)f(e[r])||(t+=r+":"+p(e[r])+",");h.set(e,t)}}return t},b=Promise.resolve(),v=(0,o.Ht)(a.Ay,e=>(t,r,a)=>{let o,c=(0,n.useRef)(!1),{cache:u,initialSize:d=1,revalidateAll:f=!1,persistSize:h=!1,revalidateFirstPage:m=!0,revalidateOnMount:g=!1,parallel:v=!1}=a,[,,,y]=s.b.get(s.c);try{(o=(e=>(e=>{if("function"==typeof e)try{e=e()}catch(t){e=""}let t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?p(e):"",t]})(e?e(0,null):null)[0])(t))&&(o=i.q+o)}catch(e){}let[w,x,j]=(0,s.z)(u,o),k=(0,n.useCallback)(()=>(0,s.e)(w()._l)?d:w()._l,[u,o,d]);(0,l.useSyncExternalStore)((0,n.useCallback)(e=>o?j(o,()=>{e()}):()=>{},[u,o]),k,k);let A=(0,n.useCallback)(()=>{let e=w()._l;return(0,s.e)(e)?d:e},[o,d]),C=(0,n.useRef)(A());(0,s.u)(()=>{if(!c.current){c.current=!0;return}o&&x({_l:h?C.current:A()})},[o,u]);let E=g&&!c.current,N=e(o,async e=>{let n=w()._i,i=w()._r;x({_r:s.U});let o=[],l=A(),[c]=(0,s.z)(u,e),d=c().data,h=[],g=null;for(let e=0;e<l;++e){let[l,c]=(0,s.s)(t(e,v?null:g));if(!l)break;let[p,b]=(0,s.z)(u,l),w=p().data,x=f||n||(0,s.e)(w)||m&&!e&&!(0,s.e)(d)||E||d&&!(0,s.e)(d[e])&&!a.compare(d[e],w);if(r&&("function"==typeof i?i(w,c):x)){let t=async()=>{if(l in y){let e=y[l];delete y[l],w=await e}else w=await r(c);b({data:w,_k:c}),o[e]=w};v?h.push(t):await t()}else o[e]=w;v||(g=w)}return v&&await Promise.all(h.map(e=>e())),x({_i:s.U}),o},a),_=(0,n.useCallback)(function(e,t){let r="boolean"==typeof t?{revalidate:t}:t||{},n=!1!==r.revalidate;return o?(n&&((0,s.e)(e)?x({_i:!0,_r:r.revalidate}):x({_i:!1,_r:r.revalidate})),arguments.length?N.mutate(e,{...r,revalidate:n}):N.mutate()):b},[o,u]),S=(0,n.useCallback)(e=>{let r;if(!o)return b;let[,n]=(0,s.z)(u,o);if((0,s.a)(e)?r=e(A()):"number"==typeof e&&(r=e),"number"!=typeof r)return b;n({_l:r}),C.current=r;let a=[],[i]=(0,s.z)(u,o),l=null;for(let e=0;e<r;++e){let[r]=(0,s.s)(t(e,l)),[n]=(0,s.z)(u,r),o=r?n().data:s.U;if((0,s.e)(o))return _(i().data);a.push(o),l=o}return _(a)},[o,u,_,A]);return{size:A(),setSize:S,mutate:_,get data(){return N.data},get error(){return N.error},get isValidating(){return N.isValidating},get isLoading(){return N.isLoading}}})},76928:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(358693).A)("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]])},89099:(e,t,r)=>{e.exports=r(816296)},126532:(e,t,r)=>{"use strict";r.d(t,{Bc:()=>o,ZI:()=>u,k$:()=>c,m_:()=>l});var n=r(637876),a=r(14232),s=r(155824),i=r(277166);let o=s.Kq,l=s.bL,c=s.l9,u=a.forwardRef((e,t)=>
1{let{className:r,sideOffset:a=6,...o}=e;return(0,n.jsx)(s.ZL,{children:(0,n.jsx)(s.UC,{ref:t,sideOffset:a,className:(0,i.cn)("z-50 max-w-xs rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs text-gray-700 shadow-[0_1px_4px_rgba(0,0,0,0.05)]","animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",r),...o})})});u.displayName=s.UC.displayName},228249:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(358693).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},234379:(e,t,r)=>{"use strict";r.d(t,{$:()=>c,r:()=>l});var n=r(637876),a=r(14232),s=r(682987),i=r(47137),o=r(277166);let l=(0,i.F)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-600 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-emerald-700 text-white hover:bg-emerald-600/90",destructive:"bg-[#e5383b] text-white hover:bg-[#e5383b]/90",outline:"border border-stone-300 bg-white hover:bg-[#fafafa] hover:text-stone-900",secondary:"bg-[#fafafa] text-stone-900 hover:bg-gray-100",ghost:"hover:bg-[#fafafa] hover:text-stone-900",link:"text-emerald-600 underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=a.forwardRef((e,t)=>{let{className:r,variant:a,size:i,asChild:c=!1,...u}=e,d=c?s.DX:"button";return(0,n.jsx)(d,{className:(0,o.cn)(l({variant:a,size:i,className:r})),ref:t,...u})});c.displayName="Button"},246253:(e,t,r)=>{"use strict";r.d(t,{cf:()=>i,pQ:()=>l,qT:()=>o});var n=r(14232);let a=[[/\/home-health(?:[/?]|$)/,"Home Health"],[/\/smart-devices(?:[/?]|$)/,"Devices"],[/\/energy\/bills(?:[/?]|$)/,"Bills"],[/\/tasks(?:[/?]|$)/,"Tasks"],[/\/projects(?:[/?]|$)/,"Projects"],[/\/documents(?:[/?]|$)/,"Documents"],[/\/utilities(?:[/?]|$)/,"Utilities"],[/\/notifications(?:[/?]|$)/,"Notifications"]],s=new Set(["api","homeowners","summary","list","page","status","counts"]);function i(e){var t,r;let n=null!=(t=e.split(/[?#]/)[0])?t:e;for(let[e,t]of a)if(e.test(n))return t;return(null!=(r=[...n.split("/").filter(Boolean)].reverse().find(e=>!s.has(e)))?r:"home records").replace(/[_-]+/g," ").replace(/\b\w/g,e=>e.toUpperCase())}let o=(0,n.createContext)({register:()=>()=>void 0});function l(){return(0,n.useContext)(o)}},269008:(e,t,r)=>{"use strict";r.d(t,{CU:()=>l,RO:()=>o,Sc:()=>c});var n=r(637876);r(14232);var a=r(277166),s=r(918556);r(234379);var i=r(486791);function o(e){let{variant:t="received",className:r,children:s}=e;return(0,n.jsx)("div",{className:(0,a.cn)("flex items-start gap-2","sent"===t&&"flex-row-reverse",r),children:s})}function l(e){let{variant:t="received",isLoading:r,className:s,children:o}=e;return(0,n.jsx)("div",{className:(0,a.cn)("rounded-2xl px-4 py-2.5 text-sm font-light max-w-[72%]","sent"===t?"bg-emerald-700 text-white rounded-br-sm":"bg-stone-100 text-stone-800 rounded-bl-sm",s),children:r?(0,n.jsx)("div",{className:"flex items-center space-x-1 py-0.5",children:(0,n.jsx)(i.K,{})}):o})}function c(e){let{src:t,fallback:r="?",className:i}=e;return(0,n.jsxs)(s.eu,{className:(0,a.cn)("h-7 w-7 flex-shrink-0",i),children:[t&&(0,n.jsx)(s.BK,{src:t,alt:r}),(0,n.jsx)(s.q5,{className:"text-xs bg-stone-200 text-stone-600",children:r})]})}},322833:(e,t,r)=>{"use strict";r.d(t,{_:()=>a,i:()=>s});var n=r(14232);let a=e=>e.key||"";function s(e){let t=[];return n.Children.forEach(e,e=>{(0,n.isValidElement)(e)&&t.push(e)}),t}},377662:(e,t,r)=>{"use strict";r.d(t,{ME:()=>l,Om:()=>i,lx:()=>c,wB:()=>u});var n=r(341941),a=r(894890);let s=a.bOF.homeownersPage.energyStats;async function i(){await Promise.all([(0,n.j)(a.bOF.homeownersPage.notificationFeed),(0,n.j)(a.bOF.homeownersPage.materializeNotifications),(0,n.j)(a.bOF.homeownersPage.upcomingWork),(0,n.j)(a.bOF.homeownersPage.hobbies),(0,n.j)(a.bOF.homeownersPage.autopilotTicker),(0,n.j)(e=>"string"==typeof e&&(e.startsWith(a.bOF.homeownersPage.agentActivity)||e.startsWith(a.bOF.homeownersPage.agentActions)||e.startsWith(a.bOF.homeownersPage.morningBrief)||e.startsWith(a.bOF.homeownersPage.plannerTasks)))])}let o=()=>(0,n.j)(e=>"string"==typeof e&&e.startsWith(a.bOF.homeownersPage.householdAppliances));async function l(e){var t,r;let i=null!=(r=null==e||null==(t=e.provider)?void 0:t.trim())?r:null,l=(null==e?void 0:e.includeEnergyAnalysis)!==!1,c=(null==e?void 0:e.includeIdentityComposite)===!0,u=(null==e?void 0:e.includeAssetRegistry)===!0,d=[i?(0,n.j)(a.bOF.homeownersPage.path("/integrations/".concat(i,"/devices"))):(0,n.j)(e=>"string"==typeof e&&/^\/api\/homeowners\/integrations\/[^/]+\/devices(?:\?.*)?$/.test(e)),(0,n.j)(a.bOF.homeownersPage.smartDevices),(0,n.j)(a.bOF.homeownersPage.homeHealth),(0,n.j)(e=>
1Array.isArray(e)&&"home-connect-detail"===e[0])];u&&d.push((0,n.j)(a.bOF.homeownersPage.assetRegistry)),c&&!l&&d.push(o()),l&&d.push((0,n.j)(e=>"string"==typeof e&&e.startsWith(a.bOF.homeownersPage.monthlyEndUse)),(0,n.j)(e=>"string"==typeof e&&e.startsWith(a.bOF.homeownersPage.monthlyEndUseHistory)),(0,n.j)(e=>"string"==typeof e&&e.startsWith(a.bOF.homeownersPage.costAttribution)),(0,n.j)(e=>"string"==typeof e&&e.startsWith(a.bOF.homeownersPage.energyProfile)),(0,n.j)(e=>"string"==typeof e&&e.startsWith(a.bOF.homeownersPage.carbonFootprint)),o(),(0,n.j)(e=>"string"==typeof e&&e.startsWith(s))),await Promise.all(d)}async function c(e){await Promise.all([i(),l(e)])}async function u(){await Promise.all([(0,n.j)(a.bOF.homeownersPage.documents),(0,n.j)(a.bOF.homeownersPage.timeline),(0,n.j)(a.bOF.homeownersPage.homeHealth),(0,n.j)(e=>"string"==typeof e&&(e.startsWith(a.bOF.homeownersPage.documents)||e.startsWith(a.bOF.homeownersPage.documentActionProposals)||e.startsWith(a.bOF.homeownersPage.timeline)||e.startsWith(a.bOF.homeownersPage.homeHealth)||e.startsWith(a.bOF.homeownersPage.aiAssist)))])}},428419:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(358693).A)("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},453417:(e,t,r)=>{"use strict";r.d(t,{C:()=>c});var n=r(637876),a=r(307990),s=r(14232),i=r(939751),o=r(54368);class l extends s.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent&&!1!==this.props.pop){let e=t.offsetParent,r=(0,a.s)(e)&&e.offsetWidth||0,n=(0,a.s)(e)&&e.offsetHeight||0,s=this.props.sizeRef.current;s.height=t.offsetHeight||0,s.width=t.offsetWidth||0,s.top=t.offsetTop,s.left=t.offsetLeft,s.right=r-s.width-s.left,s.bottom=n-s.height-s.top}return null}componentDidUpdate(){}render(){return this.props.children}}function c({children:e,isPresent:t,anchorX:r,anchorY:a,root:c,pop:u}){let d=(0,s.useId)(),f=(0,s.useRef)(null),h=(0,s.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:m}=(0,s.useContext)(i.Q),g=e.props?.ref??e?.ref,p=(0,o.s)(f,g);return(0,s.useInsertionEffect)(()=>{let{width:e,height:n,top:s,left:i,right:o,bottom:l}=h.current;if(t||!1===u||!f.current||!e||!n)return;let g="left"===r?`left: ${i}`:`right: ${o}`,p="bottom"===a?`bottom: ${l}`:`top: ${s}`;f.current.dataset.motionPopId=d;let b=document.createElement("style");m&&(b.nonce=m);let v=c??document.head;return v.appendChild(b),b.sheet&&b.sheet.insertRule(`
2          [data-motion-pop-id="${d}"] {
3            position: absolute !important;
4            width: ${e}px !important;
5            height: ${n}px !important;
6            ${g}px !important;
7            ${p}px !important;
8          }
9        `),()=>{v.contains(b)&&v.removeChild(b)}},[t]),(0,n.jsx)(l,{isPresent:t,childRef:f,sizeRef:h,pop:u,children:!1===u?e:s.cloneElement(e,{ref:p})})}},466605:(e,t,r)=>{"use strict";r.d(t,{P:()=>u});var n=r(637876),a=r(76928),s=r(79622),i=r(14232),o=r(629136),l=r(234379),c=r(889202);function u(e){let{id:t,placeholder:r="Ask me anything!",maxHeight:u=200,loadingDuration:d=3e3,thinkingDuration:f=1e3,onSubmit:h,className:m,autoAnimate:g=!1}=e,[p,b]=(0,i.useState)(""),[v,y]=(0,i.useState)(g),[w]=(0,i.useState)(g);(0,i.useEffect)(()=>{let e,t=()=>{w&&(y(!0),e=setTimeout(()=>{y(!1),e=setTimeout(t,f)},d))};return w&&t(),()=>clearTimeout(e)},[w,d,f]);let x=async()=>{p.trim()&&!v&&(y(!0),await (null==h?void 0:h(p)),b(""),setTimeout(()=>y(!1),d))};return(0,n.jsxs)(c.Pl,{value:p,onValueChange:b,isLoading:v,onSubmit:x,maxHeight:u,className:(0,o.cn)("w-full",m),children:[(0,n.jsx)(c.Xk,{id:t,placeholder:r}),(0,n.jsx)(c.U3,{className:"justify-end pt-2",children:(0,n.jsx)(c.Nh,{tooltip:v?"Stop generation":"Send message",children:(0,n.jsx)(l.$,{variant:"default",size:"sm",className:"h-8 w-8 rounded-full",onClick:x,disabled:v||!p.trim(),"aria-label":v?"Stop generation":"Send message",children:v?(0,n.jsx)(a.A,{className:"size-4 fill-current"}):(0,n.jsx)(s.A,{className:"size-4"})})})})]})}},471354:(e,t,r)=>{"use strict";r.d(t,{Gl:()=>d,IL:()=>j,JM:()=>k,MC:()=>p,SL:()=>A,UI:()=>v,Yl:()=>b,az:()=>x,eG:()=>C,fF:()=>N,fj:()=>g,is:()=>c,lY:()=>E,mh:()=>w,oh:()=>m,yX:()=>y});
9var n=r(341941),a=r(638334),s=r(894890),i=r(377662),o=r(747148),l=r(781069);let c=["rachio","hydrawise"],u=e=>e.trim().toLowerCase().replace(/-/g,"_"),d=e=>"all"===u(e)?s.bOF.homeownersPage.smartDevices:s.bOF.homeownersPage.path("/integrations/".concat(u(e),"/devices"));async function f(e){let t=await (0,l.x6)(e,{timeoutMs:1e4});if(!t.ok){var r,n;if("timeout"===t.error)throw Error("Smart device request timed out after ".concat(1e4,"ms"));if("network_error"===t.error&&t.details instanceof Error)throw t.details;let e=t.details;throw new l.fk(null!=(n=null!=(r=null==e?void 0:e.error)?r:null==e?void 0:e.message)?n:"Failed to load smart devices (".concat(t.status||0,")"),t.status,t.details)}var a=t.data;let s=a&&"object"==typeof a&&"data"in a?a.data:a;if(!s||"object"!=typeof s)throw Error("Smart device payload was malformed");let i=s.devices;if(!Array.isArray(i))throw Error("Smart device payload was missing devices");return{devices:i,unavailable:!!s.unavailable}}async function h(e,t,r){let n={"Content-Type":"application/json"},a=await (0,o.bG)();a&&(n["x-csrf-token"]=a);let s=await fetch(t,{method:e,headers:n,body:r?JSON.stringify(r):void 0});if(!s.ok){var i;throw Error(null!=(i=(await s.json().catch(()=>({}))).error)?i:"API error ".concat(s.status))}return s.json()}function m(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=t?d(e):null,{data:n,error:s,isLoading:i,mutate:o}=(0,a.CD)(r,{fetcher:f,refreshInterval:3e5,revalidateOnFocus:!1}),l=!!(null==n?void 0:n.unavailable),c=s instanceof Error?s:s?Error(String(s)):null;return{devices:Array.isArray(null==n?void 0:n.devices)?n.devices:[],isLoading:i,unavailable:l,providerUnavailable:l,requestError:c,error:s,mutate:o}}async function g(e){var t,r;let n=await fetch(s.bOF.homeownersPage.path("/integrations/".concat(u(e),"/discover")));if(!n.ok)throw Error(null!=(t=(await n.json().catch(()=>({}))).error)?t:"API error ".concat(n.status));let a=await n.json(),i=null!=(r=a.data)?r:a;return Array.isArray(i.devices)?i.devices:[]}async function p(e,t){let r=d(e),a=await h("POST",r,t);return await Promise.all([(0,n.j)(r),(0,n.j)(d("all"))]),await (0,i.lx)({provider:e,includeEnergyAnalysis:!0,includeAssetRegistry:!0}),a.data.device}async function b(e,t){let r=d(e);await h("DELETE",s.bOF.homeownersPage.deviceDetail(e,t)),await Promise.all([(0,n.j)(r),(0,n.j)(d("all"))]),await (0,i.lx)({provider:e,includeEnergyAnalysis:!0,includeAssetRegistry:!0})}async function v(e,t,r){let a=await h("PATCH",s.bOF.homeownersPage.deviceDetail(e,t),{user_override_category:r});return await Promise.all([(0,n.j)(d(e)),(0,n.j)(d("all"))]),await (0,i.lx)({provider:e,includeEnergyAnalysis:!1,includeIdentityComposite:!0}),a.data.device}async function y(e,t,r){let a=d(e),o=await h("PATCH",s.bOF.homeownersPage.deviceDetail(e,t),{alias:r});return await (0,n.j)(a),await (0,i.lx)({provider:e,includeEnergyAnalysis:!1,includeIdentityComposite:!0}),o.data.device}async function w(e,t){let r=d(e);await h("POST","".concat(r,"/").concat(t,"/poll")),await (0,i.lx)({provider:e,includeEnergyAnalysis:!1})}async function x(e,t,r,n,a){var o;let l=null==a||null==(o=a.consentToken)?void 0:o.trim();if(!l)throw Error("Device command requires confirmation before dispatch.");let c=await h("POST",s.bOF.homeownersPage.deviceCommand(e,t),{command:r,...n?{payload:n}:{},consent_token:l});return await (0,i.lx)({provider:e,includeEnergyAnalysis:!1}),c.data}async function j(e){let t=await k({provider:e.provider,deviceId:e.deviceId,command:e.command,payload:e.payload,sourceSurface:e.sourceSurface});return x(e.provider,e.deviceId,e.command,e.payload,{consentToken:t.consentToken,sourceSurface:e.sourceSurface})}async function k(e){var t,r,n;let a=(await h("POST",s.bOF.homeownersPage.deviceCommandConsents,{provider:e.provider,device_id:e.deviceId,command:e.command,...e.payload?{payload:e.payload}:{},source_surface:e.sourceSurface})).data;return{consentId:String(null!=(t=a.consent_id)?t:""),consentToken:String(null!=(r=a.consent_token)?r:""),expiresAt:String(null!=(n=a.expires_at)?n:"")}}function A(e,t){var r;if((null==e?void 0:e.confirmationStatus)==="confirmed")return!0;let n=function(e){let t=null==e?void 0:e.trim().toLowerCase();return t?["on","1","true"].includes(t)?"turn_on":["off","0","false"].includes(t)?"turn_off":null:null}(null==e||null==(r=e.stateEcho)?void 0:r.relayState);return null!==n&&n===t}function C(e){let t=(null==e?void 0:e.trim())||"Device";return{title:"Command sent",message:"".concat(t," accepted the command. Confirming actual device state from the provider now.")}}function E(e){let t=d(e);(0,n.j)(t),(0,n.j)(d("all"))}function N(e){if(!e)return"never";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return"".concat(t," min ago");let r=Math.floor(t/60);return r<24?"".concat(r,"h ago"):"".concat(Math.floor(r/24),"d ago")}},486791:(e,t,r)=>{"use strict";r.d(t,{K:()=>a});var n=r(637876);function a(){return(0,n.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"text-stone-400",children:[(0,n.jsx)("circle",{cx:"4",cy:"12",r:"2",fill:"
9currentColor",children:(0,n.jsx)("animate",{id:"spinner_qFRN",begin:"0;spinner_OcgL.end+0.25s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),(0,n.jsx)("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor",children:(0,n.jsx)("animate",{begin:"spinner_qFRN.begin+0.1s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),(0,n.jsx)("circle",{cx:"20",cy:"12",r:"2",fill:"currentColor",children:(0,n.jsx)("animate",{id:"spinner_OcgL",begin:"spinner_qFRN.begin+0.2s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})})]})}},497023:(e,t,r)=>{"use strict";r.d(t,{SP:()=>s,WQ:()=>o,Yn:()=>d,hX:()=>c,jH:()=>u,j_:()=>i});let n={"to do":"to_do",todo:"to_do","to-do":"to_do",needed:"needed",open:"open",missing:"missing",watch:"watch",current:"current",low:"low_stock","low stock":"low_stock","out of stock":"out_of_stock",out:"out_of_stock"},a={researching:"Researching",shortlisted:"Shortlisted",to_do:"To do",open:"Open",booked:"Booked",check_in:"Check-in",confirmed:"Confirmed",in_progress:"In progress",done:"Done",changed:"Changed",missing:"Missing",expires_soon:"Expires soon",current:"Current",paid:"Paid",staged:"Staged",packed:"Packed",needed:"Needed",buy:"Buy",due:"Due",ready:"Ready",watch:"Watch",info:"Info",traveling:"Traveling",returned:"Returned",estimated:"Estimated",note:"Note",book_again:"Book again",avoid:"Avoid",low_stock:"Low",out_of_stock:"Out of stock",no_status:"No status"};function s(e){if(!e)return null;let t=e.trim();if(!t)return null;let r=t.toLowerCase().replace(/-/g," ");if(a[r])return r;let s=r.replace(/\s+/g,"_");return a[s]?s:n[r]?n[r]:n[s]?n[s]:null}function i(e){if(!e)return"";let t=s(e);return t?a[t]:e.trim().replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}let o=new Set(["booked","confirmed","done","paid","staged","packed","current","check_in","traveling","returned","ready"]),l=new Set(["researching","shortlisted"]);function c(e){let t=s(e);return null!=t&&o.has(t)}function u(e){let t=s(e);return null!=t&&l.has(t)}function d(e){return!c(e)&&"considering"!==e}},532e3:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(358693).A)("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},543301:(e,t,r)=>{"use strict";r.d(t,{y:()=>i});let n=["planner-tasks","planner-maintenance","today","members"],a=["profile","home-health","planner-appointments","planner-rebates","foresight","field-sessions","documents"],s=["hobbies","pantry","recall-bulletins","quotes","zones","community","insurance-policies","warranty-intelligence","projects","routines","habits","upcoming-work","rebate-eligibility"];function i(e){let t=function(e){if(!e)return"";let t=e.indexOf("?");return -1===t?e:e.slice(0,t)}(e);return n.some(e=>t.includes(e))?"critical":a.some(e=>t.includes(e))?"high":s.some(e=>t.includes(e))?"low":"normal"}},581145:(e,t,r)=>{"use strict";r.d(t,{Qu:()=>p,Rm:()=>g,VL:()=>o,XU:()=>b,cg:()=>m,fz:()=>v,k6:()=>l,u0:()=>u});let n="akeptus:homeowner:offline:scope",a=null,s=0,i=new Set;function o(){return s}function l(e){return i.add(e),()=>{i.delete(e)}}function c(){s+=1,i.forEach(e=>e())}function u(){let e=b(),t=s;return{prefix:e,revision:t,isCurrent:()=>null!==e&&t===s&&e===b()}}function d(){return window.sessionStorage?window.sessionStorage:null}function f(e){let t=String(null!=e?e:"").trim();return t.length>0?t:null}function h(e){let t=f(null==e?void 0:e.userId),r=f(null==e?void 0:e.organizationId);return t&&r?{userId:t,organizationId:r}:null}function m(e){let t=h(e);if(!t)return void g();let r=p(),s=(null==r?void 0:r.userId)!==t.userId||(null==r?void 0:r.organizationId)!==t.organizationId;a=t;let i=d();i&&i.setItem(n,JSON.stringify(t)),s&&c()}function g(){var e;let t=null!==p();a=null,null==(e=d())||e.removeItem(n),t&&c()}function p(){if(a)return a;let e=d();if(!e)return null;let t=e.getItem(n);if(!t)return null;try{let r=JSON.parse(t),s=h(r);if(!s)return e.removeItem(n),null;return a=s,s}catch(t){return e.removeItem(n),null}}function b(){let e=p();return e?"".concat(e.userId,":").concat(e.organizationId):null}
9class v extends Error{constructor(){super("The active home changed before this queued action was sent"),this.name="HomeownerOfflineAdmissionError"}}},602193:(e,t,r)=>{"use strict";r.d(t,{s:()=>l});var n=r(637876),a=r(234379),s=r(277166),i=r(558725),o=r(14232);function l(e){let{scrollRef:t,containerRef:r,className:l,threshold:c=100,variant:u="outline",size:d="sm",...f}=e,[h,m]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{let e=()=>{if(r.current){let{scrollTop:e,scrollHeight:t,clientHeight:n}=r.current;m(e+n<t-c)}},t=r.current;return t&&(t.addEventListener("scroll",e),e()),()=>{t&&t.removeEventListener("scroll",e)}},[r,c]),(0,n.jsx)(a.$,{variant:"primary"===u||"success"===u?"default":"danger"===u?"destructive":"secondary"===u?"secondary":u,size:"md"===d?"default":d,className:(0,s.cn)("h-8 w-8 rounded-full transition-all duration-150 ease-out p-0",h?"translate-y-0 scale-100 opacity-100":"pointer-events-none translate-y-4 scale-95 opacity-0",l),onClick:()=>{r.current&&r.current.scrollTo({top:r.current.scrollHeight,behavior:"smooth"})},"aria-label":"Scroll to bottom",type:"button",...f,children:(0,n.jsx)(i.A,{className:"h-4 min-h-4 w-4 min-w-4"})})}},629136:(e,t,r)=>{"use strict";r.d(t,{cn:()=>a,h0:()=>s});let n={button:{sizes:{sm:"px-3 py-1.5 text-sm",base:"px-4 py-2 text-base",lg:"px-6 py-3 text-lg"},common:"inline-flex items-center justify-center gap-2 font-medium transition-all duration-200 ease-out focus:outline-none focus-visible:ring-2 focus-visible:ring-[#6B88F4] focus-visible:ring-offset-2",primary:{base:"rounded-lg",colors:"bg-[#6B88F4] text-white hover:bg-[#5a75e0] active:bg-[#4A61C9]",disabled:"disabled:bg-neutral-300 disabled:text-neutral-500 disabled:cursor-not-allowed disabled:shadow-none"},secondary:{base:"rounded-lg",colors:"bg-white border border-neutral-300 text-neutral-700 hover:bg-neutral-50 hover:border-neutral-400 active:bg-neutral-100",disabled:"disabled:bg-neutral-100 disabled:border-neutral-200 disabled:text-neutral-400 disabled:cursor-not-allowed"},danger:{base:"rounded-lg",colors:"bg-[#E53935] text-white hover:bg-[#C62828] active:bg-[#B71C1C]",disabled:"disabled:bg-neutral-300 disabled:text-neutral-500 disabled:cursor-not-allowed disabled:shadow-none"},ghost:{base:"rounded-lg",colors:"text-neutral-700 hover:bg-neutral-100 active:bg-neutral-200",disabled:"disabled:text-neutral-400 disabled:cursor-not-allowed disabled:bg-transparent"},outline:{base:"rounded-lg",colors:"border-2 border-[#6B88F4] text-[#6B88F4] hover:bg-[#D4DBFD]/30 active:bg-[#D4DBFD]/50",disabled:"disabled:border-neutral-300 disabled:text-neutral-400 disabled:cursor-not-allowed disabled:bg-transparent"},link:{base:"rounded-lg",colors:"text-[#6B88F4] hover:text-[#5a75e0] hover:underline active:text-[#4A61C9]",disabled:"disabled:text-neutral-400 disabled:cursor-not-allowed disabled:no-underline"},pill:{base:"rounded-full",colors:"bg-[#6B88F4] text-white hover:bg-[#5a75e0] active:bg-[#4A61C9] shadow-sm hover:shadow-md hover:-translate-y-0.5 active:translate-y-0",disabled:"disabled:bg-neutral-300 disabled:text-neutral-500 disabled:cursor-not-allowed disabled:shadow-none disabled:transform-none"}}};function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter(Boolean).join(" ")}function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"primary",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"base",r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=n.button[e],i=n.button.sizes[t];return a(n.button.common,i,s.base,s.colors,r&&s.disabled)}},632257:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(358693).A)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},638334:(e,t,r)=>{"use strict";r.d(t,{CD:()=>y,GO:()=>v,H2:()=>x,Qm:()=>w,TS:()=>k,l:()=>j,me:()=>E,oY:()=>A,t1:()=>b,wr:()=>C,yY:()=>f});var n=r(14232),a=r(975656),s=r(767392),i=r(747148),o=r(986266),l=r(543301),c=r(246253);let u=(0,o.Vu)({maxConcurrent:6,defaultRetries:0});function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Error(e);return void 0!==t.status&&(r.status=t.status),t.code&&(r.code=t.code),void 0!==t.isCancelled&&(r.isCancelled=t.isCancelled),void 0!==t.applied&&(r.applied=t.applied),void 0!==t.readback&&(r.readback=t.readback),r}function f(e){return e instanceof Error&&"applied"in e&&!0===e.applied}function h(e){return e instanceof Error&&("AbortError"===e.name||/abort/i.test(e.message))}async function m(e,t,r){var n,a;let s=new AbortController,i=function(e,t){if(!t)return null;if(t.aborted)return e.abort(),null;let r=()=>{e.abort()};return t.addEventListener("abort",r,{once:!0}),()=>t.removeEventListener("abort",r)}(s,null==t?void 0:t.signal),o=!1,l=null,c=null!=(n=null==r?void 0:r.timeoutMs)?n:12e3;
9try{let r=new Promise((e,t)=>{l=globalThis.setTimeout(()=>{o=!0,t(d("Request timeout",{status:408,code:"REQUEST_TIMEOUT"})),s.abort()},c)});return await Promise.race([fetch(e,{...t,signal:s.signal}),r])}catch(e){if(o)throw e;if(null==t||null==(a=t.signal)?void 0:a.aborted)throw d("Request cancelled",{status:499,code:"REQUEST_CANCELLED",isCancelled:!0});if(h(e))throw d("Network error: request aborted",{status:503,code:"NETWORK_ERROR"});throw e}finally{null==i||i(),l&&globalThis.clearTimeout(l)}}function g(e){return e instanceof Error&&("status"in e||"code"in e||"isCancelled"in e)?e:h(e)?d("Request cancelled",{status:499,code:"REQUEST_CANCELLED",isCancelled:!0}):e instanceof TypeError&&e.message.toLowerCase().includes("fetch")?d("Network error: Unable to connect to server",{status:503,code:"NETWORK_ERROR"}):e instanceof Error?e:d("Unknown error occurred")}async function p(e){let t=await e.json().catch(()=>null),r=t&&"object"==typeof t&&"error"in t&&"string"==typeof t.error?t.error:t&&"object"==typeof t&&"message"in t&&"string"==typeof t.message?t.message:"API error ".concat(e.status),n=t&&"object"==typeof t&&"code"in t&&"string"==typeof t.code?t.code:void 0,a=!!(t&&"object"==typeof t&&"applied"in t&&!0===t.applied),s=t&&"object"==typeof t&&"readback"in t&&null!==t.readback&&"object"==typeof t.readback&&!Array.isArray(t.readback)?t.readback:null;return d(r,{status:e.status,code:n,applied:a,readback:s})}async function b(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12e3;try{let r=await u.enqueue(()=>m(e,void 0,{timeoutMs:t}),{priority:(0,l.y)(e),timeout:12e3===t?2e4:t+8e3,retries:0});if(!r.ok){let e=await r.json().catch(()=>null),t=e&&"object"==typeof e&&"error"in e&&"string"==typeof e.error?e.error:e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message?e.message:"API error ".concat(r.status),n=e&&"object"==typeof e&&"code"in e&&"string"==typeof e.code?e.code:void 0;throw d(t,{status:r.status,code:n})}let n=await r.json();return n&&"object"==typeof n&&"data"in n?n.data:n}catch(e){throw g(e)}}async function v(e){return b(e)}function y(e,t){let{fetcher:r,...s}=null!=t?t:{},i=(0,n.useId)(),o=(0,c.pQ)(),l=(0,a.Ay)(e,e?null!=r?r:v:null,s);return(0,n.useEffect)(()=>{var t;if(e)return o.register({id:i,key:e,error:null!=(t=l.error)?t:null,data:l.data,retry:l.mutate})},[e,o,i,l.data,l.error,l.mutate]),l}async function w(){return(0,i.bG)()}async function x(e,t,r,n){try{var a,s;let i={"Content-Type":"application/json"},o=await w();o&&(i["x-csrf-token"]=o);let l="GET"!==e&&"HEAD"!==e,c=null!=(s=null==n?void 0:n.timeoutMs)?s:l?45e3:12e3;null==n||null==(a=n.beforeDispatch)||a.call(n);let u=await m(t,{method:e,headers:i,body:r?JSON.stringify(r):void 0},{timeoutMs:c});if(!u.ok)throw await p(u);return u.json()}catch(e){throw g(e)}}function j(e){if(!e)return null;let t=e.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/);if(!t)return null;let[,r,n,a,s,i]=t,o=new Date(Number(r),Number(n)-1,Number(a),Number(s),Number(i),0,0);return Number.isNaN(o.getTime())?null:o.toISOString()}function k(e){if(!e)return"";let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let r=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0");return"".concat(r,"-").concat(n,"-").concat(a,"T").concat(s,":").concat(i)}function A(){return"undefined"!=typeof navigator&&!1===navigator.onLine}function C(e,t){return e?{source:t,capturedAt:e.capturedAt,isStale:(0,s.T7)(e)}:"live"===t?{source:t,capturedAt:null,isStale:!1}:null}function E(e){var t;let[r,i]=(0,n.useState)(null),o=(0,n.useId)(),l=(0,c.pQ)(),{data:u,error:d,isLoading:f,mutate:h}=(0,a.Ay)(e.swrKey,e.swrKey?null!=(t=e.fetcher)?t:v:null,e.swrOptions);(0,n.useEffect)(()=>{i((0,s.kp)(e.storageKey))},[e.storageKey]);let m=null!=u?u:null==r?void 0:r.data,g=(0,n.useMemo)(()=>e.selectData(m),[m,e.selectData]);(0,n.useEffect)(()=>{void 0!==u&&null!=g&&null==d&&(0,s.d2)(e.storageKey,{data:g,capturedAt:new Date().toISOString(),staleAfterHours:e.staleAfterHours})},[d,e.staleAfterHours,e.storageKey,g]);let p=r&&(null!=d||A())?C(r,"cached"):C(r,"live");return(0,n.useEffect)(()=>
9{if(e.swrKey)return l.register({id:o,key:e.swrKey,error:null!=d?d:null,data:null!=g?g:void 0,retry:h})},[d,e.swrKey,h,l,o,g]),{data:g,error:d,isLoading:f,mutate:h,snapshot:p}}},657061:(e,t,r)=>{"use strict";r.d(t,{T:()=>i});var n=r(637876),a=r(14232),s=r(277166);let i=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("textarea",{className:(0,s.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),ref:t,...a})});i.displayName="Textarea"},767392:(e,t,r)=>{"use strict";r.d(t,{T7:()=>u,d2:()=>l,kp:()=>c});var n=r(581145);let a="akeptus:homeowner:offline:",s=new Set(["homeowner_profile","energy_bills","home_health"]);function i(){return window.sessionStorage?window.sessionStorage:null}function o(e){let t=(0,n.XU)();return t?"".concat(a).concat(t,":").concat(e):"".concat(a).concat(e)}function l(e,t){if(s.has(e))return;let r=i();if(!r||!(0,n.XU)())return;let a={version:1,capturedAt:t.capturedAt,staleAfterHours:t.staleAfterHours,data:t.data};r.setItem(o(e),JSON.stringify(a))}function c(e){if(s.has(e))return null;let t=i();if(!t||!(0,n.XU)())return null;let r=t.getItem(o(e));if(!r)return null;try{let e=JSON.parse(r);return e&&"object"==typeof e&&1===e.version&&"string"==typeof e.capturedAt&&"number"==typeof e.staleAfterHours&&void 0!==e.data?e:null}catch(e){return null}}function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now(),r=new Date(e.capturedAt).getTime();return!Number.isFinite(r)||r+60*e.staleAfterHours*6e4<=t}},781069:(e,t,r)=>{"use strict";r.d(t,{Vo:()=>s,fk:()=>i,nr:()=>o,x6:()=>l});var n=r(920503),a=r(747148);function s(e){return e&&"object"==typeof e&&"success"in e&&!0===e.success&&"data"in e?e.data:e}class i extends Error{constructor(e,t,r){super(e),this.status=t,this.data=r,this.name="FetchError"}}async function o(e,t){var r,s,o;let l=t;if((0,a.CY)(e)&&(0,a.jM)(null!=(r=null==t?void 0:t.method)?r:e instanceof Request?e.method:void 0)){let r=new Headers(null!=(s=null==t?void 0:t.headers)?s:e instanceof Request?e.headers:void 0);if(!r.has("x-csrf-token")){let e=await (0,a.bG)();e&&r.set("x-csrf-token",e)}l={...t,headers:r}}let c=await fetch(e,l);if(!c.ok){if(401===c.status){let e=(o=window.location.pathname+window.location.search,(0,n.LS)(o,{message:"Your session has expired. Please log in again.",reason:"session_expired"}));window.location.href=e}let e={};try{"function"==typeof c.clone?e=await c.clone().json():"function"==typeof c.json&&(e=await c.json())}catch(e){}let t=e;throw new i((null==t?void 0:t.error)||(null==t?void 0:t.message)||"HTTP ".concat(c.status," ").concat(c.statusText),c.status,e)}return c}async function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{timeoutMs:r,init:n}=t,a=new AbortController,s=!1,i=null==n?void 0:n.signal;(null==i?void 0:i.aborted)&&a.abort();let o=()=>{a.abort()};i&&!i.aborted&&i.addEventListener("abort",o,{once:!0});let l=r?setTimeout(()=>{s=!0,a.abort()},r):null;try{let t=await fetch(e,{...n||{},signal:a.signal}),r=null;try{r=await t.json()}catch(e){if(t.ok)return{ok:!1,status:t.status,error:"invalid_json",details:e};return{ok:!1,status:t.status,error:"http_error"}}if(!t.ok)return{ok:!1,status:t.status,error:"http_error",details:r};return{ok:!0,status:t.status,data:r}}catch(e){if(e instanceof Error&&"AbortError"===e.name)return{ok:!1,status:0,error:s?"timeout":"aborted",details:e};return{ok:!1,status:0,error:"network_error",details:e}}finally{l&&clearTimeout(l),i&&i.removeEventListener("abort",o)}}},793223:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>w});var n=r(637876),a=r(977328),s=r.n(a),i=r(397141),o=r(14232),l=r(673884),c=r(995159),u=r(648230),d=r.n(u),f=r(743956),h=r(310773),m=r(114804),g=r(466605),p=r(894890),b=r(602193),v=r(269008);let y=[{title:"Ask About Emissions",description:"Get instant answers on Scope 1-3 performance, hotspots, and reduction ideas.",icon:(0,n.jsx)(l.A,{className:"h-5 w-5 text-gray-600"})},{title:"Debug Data Quality",description:"Let Universal Chat walk 
9you through anomalies, missing data, and remediation plans.",icon:(0,n.jsx)(c.A,{className:"h-5 w-5 text-gray-600"})},{title:"Plan Next Actions",description:"Draft supplier outreach, governance approvals, or tactical decarbonisation steps.",icon:(0,n.jsx)(i.gO,{className:"h-5 w-5 text-gray-600"})}],w=()=>{let[e,t]=(0,o.useState)("checking"),[r,a]=(0,o.useState)(null),[c,u]=(0,o.useState)([]),w=(0,o.useRef)(null),x=(0,o.useRef)(null),j=(0,o.useCallback)(async()=>{t("checking"),a(null);try{let e=await p.bOF.aiNew.chatHistory({limit:1});if(!e.success)throw Error(e.error||"Chat history request was rejected");t("ready")}catch(e){t("error"),a(e instanceof Error?e.message:"Unable to verify chat API connectivity")}},[]);(0,o.useEffect)(()=>{j()},[j]);let k=(0,o.useCallback)(()=>{"function"==typeof window.__openUniversalChat&&window.__openUniversalChat()},[]),A=(0,o.useCallback)(async e=>{u(t=>[...t,{role:"user",content:e}]);try{let t=await p.bOF.aiNew.chat({message:e,context_type:"general",include_data:!0}),r=t.data&&"object"==typeof t.data?t.data:null,n=(null==r?void 0:r.response)&&"object"==typeof r.response?r.response:null,a="string"==typeof(null==n?void 0:n.message)?n.message:t.error||"The assistant returned no answer for this request.";u(e=>[...e,{role:"assistant",content:a}])}catch(e){u(e=>[...e,{role:"assistant",content:"The chat request could not be completed. Check the connection and retry."}])}},[]);return(0,n.jsx)(h.OV,{requiredPermissions:[m.aX.DATA_VIEW_ALL],children:(0,n.jsxs)(f.A,{children:[(0,n.jsx)(s(),{children:(0,n.jsx)("title",{children:"Universal Chat — AI Chat | Akeptus"})}),(0,n.jsxs)("main",{className:"max-w-7xl mx-auto px-6 py-8",children:[(0,n.jsx)("nav",{className:"mb-6","aria-label":"Breadcrumb",children:(0,n.jsxs)("ol",{className:"flex items-center gap-2",children:[(0,n.jsx)("li",{children:(0,n.jsx)(d(),{href:"/dashboard",className:"universal-body text-gray-600 hover:text-gray-700 transition-colors",children:"Dashboard"})}),(0,n.jsx)("li",{children:(0,n.jsx)("span",{className:"universal-body text-gray-400",children:"/"})}),(0,n.jsx)("li",{children:(0,n.jsx)(d(),{href:"/ai",className:"universal-body text-gray-600 hover:text-gray-700 transition-colors",children:"AI Hub"})}),(0,n.jsx)("li",{children:(0,n.jsx)("span",{className:"universal-body text-gray-400",children:"/"})}),(0,n.jsx)("li",{children:(0,n.jsx)("span",{className:"universal-body text-gray-900 font-medium",children:"Chat"})})]})}),(0,n.jsxs)("div",{className:"mb-8",children:[(0,n.jsx)("h1",{className:"universal-h1 text-gray-900 mb-2",children:"Universal Chat"}),(0,n.jsx)("p",{className:"universal-body typography-secondary",children:"Ask questions about your emissions data, compliance status, and reduction strategies."})]}),(0,n.jsx)("section",{className:"rounded-xl border border-gray-200 bg-white p-8 shadow-sm",children:(0,n.jsxs)("div",{className:"flex flex-col gap-6 lg:flex-row lg:items-center lg:justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-sm font-medium text-gray-500 uppercase tracking-wide mb-3",children:"AI Copilot"}),(0,n.jsx)("p",{className:"max-w-2xl universal-body text-gray-700",children:"The floating chat button in the lower-right corner opens the same conversational engine across the entire platform. Ask about emissions, compliance, or next steps and your context and organisation settings are passed automatically."}),(0,n.jsxs)("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[(0,n.jsxs)("button",{type:"button",onClick:k,className:"inline-flex items-center gap-2 px-4 py-2 bg-emerald-700 text-white text-sm font-medium rounded-lg hover:bg-stone-700 transition-colors",children:[(0,n.jsx)(i.gO,{className:"h-4 w-4"}),"Open Universal Chat"]}),(0,n.jsx)(d(),{href:"/ai",className:"inline-flex items-center gap-2 px-4 py-2 bg-white border border-gray-200 text-gray-700 text-sm font-medium rounded-lg hover:bg-[#fafaf8] transition-colors",children:"Explore AI Hub"})]})]}),(0,n.jsxs)("div",{className:"hidden w-full max-w-sm rounded-xl border border-gray-200 bg-gray-50 p-6 sm:block",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-gray-700",children:"Qu
9ick tip"}),(0,n.jsx)("p",{className:"mt-2 universal-body text-gray-600",children:"Universal Chat keeps your conversation history per session. Use the toolbar to clear, edit, or delete recent exchanges before sending an updated question."})]})]})}),(0,n.jsx)("section",{className:"mt-6 rounded-xl border border-gray-200 bg-white p-5 shadow-sm",children:(0,n.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-sm font-semibold text-gray-900",children:"Chat API Status"}),(0,n.jsxs)("p",{className:"text-sm text-gray-600",children:["ready"===e&&"Connected","checking"===e&&"Checking connection...","error"===e&&"Connection issue: ".concat(r||"Unknown error")]})]}),(0,n.jsx)("button",{type:"button",onClick:()=>void j(),className:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium rounded-lg border border-gray-100 text-gray-700 hover:bg-[#fafaf8] transition-colors",children:"Retry Check"})]})}),(0,n.jsxs)("section",{className:"mt-6 rounded-xl border border-gray-200 bg-white shadow-sm overflow-hidden",children:[(0,n.jsxs)("div",{className:"px-5 py-4 border-b border-gray-100 flex items-center gap-2",children:[(0,n.jsx)(l.A,{className:"w-4 h-4 text-emerald-600"}),(0,n.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:"Ask the AI"})]}),c.length>0&&(0,n.jsxs)("div",{ref:w,className:"px-5 py-4 max-h-80 overflow-y-auto relative",children:[c.map((e,t)=>{let r="user"===e.role;return(0,n.jsxs)(v.RO,{variant:r?"sent":"received",children:[!r&&(0,n.jsx)(v.Sc,{fallback:"AI"}),(0,n.jsx)(v.CU,{variant:r?"sent":"received",className:"max-w-[85%] text-sm leading-relaxed",children:e.content})]},t)}),(0,n.jsx)("div",{ref:x}),(0,n.jsx)("div",{className:"sticky bottom-2 flex justify-center",children:(0,n.jsx)(b.s,{containerRef:w,scrollRef:x,className:"shadow-[0_1px_4px_rgba(0,0,0,0.05)]"})})]}),(0,n.jsx)("div",{className:"px-4",children:(0,n.jsx)(g.P,{placeholder:"Ask about your emissions, targets, or reduction strategies...",minHeight:56,maxHeight:200,loadingDuration:500,onSubmit:A})})]}),(0,n.jsx)("section",{className:"mt-8 grid gap-4 md:grid-cols-3",children:y.map(e=>(0,n.jsxs)("div",{className:"flex flex-col gap-3 rounded-xl border border-gray-200 bg-white p-5 shadow-sm",children:[(0,n.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-gray-100",children:e.icon}),(0,n.jsx)("h2",{className:"text-sm font-semibold text-gray-900",children:e.title}),(0,n.jsx)("p",{className:"universal-body text-gray-600",children:e.description})]},e.title))})]})]})})}},887170:(e,t,r)=>{"use strict";r.d(t,{N:()=>d});var n=r(637876),a=r(14232),s=r(905048),i=r(991200),o=r(50181),l=r(890965),c=r(783885),u=r(322833);let d=({children:e,custom:t,initial:r=!0,onExitComplete:d,presenceAffectsLayout:f=!0,mode:h="sync",propagate:m=!1,anchorX:g="left",anchorY:p="top",root:b})=>{let[v,y]=(0,c.xQ)(m),w=(0,a.useMemo)(()=>(0,u.i)(e),[e]),x=m&&!v?[]:w.map(u._),j=(0,a.useRef)(!0),k=(0,a.useRef)(w),A=(0,i.M)(()=>new Map),C=(0,a.useRef)(new Set),[E,N]=(0,a.useState)(w),[_,S]=(0,a.useState)(w);(0,o.E)(()=>{j.current=!1,k.current=w;for(let e=0;e<_.length;e++){let t=(0,u._)(_[e]);x.includes(t)?(A.delete(t),C.current.delete(t)):!0!==A.get(t)&&A.set(t,!1)}},[_,x.length,x.join("-")]);let P=[];if(w!==E){let e=[...w];for(let t=0;t<_.length;t++){let r=_[t],n=(0,u._)(r);x.includes(n)||(e.splice(t,0,r),P.push(r))}return"wait"===h&&P.length&&(e=P),S((0,u.i)(e)),N(w),null}let{forceRender:R}=(0,a.useContext)(s.L);return(0,n.jsx)(n.Fragment,{children:_.map(e=>{let a=(0,u._)(e),s=(!m||!!v)&&(w===_||x.includes(a));return(0,n.jsx)(l.O,{isPresent:s,initial:(!j.current||!!r)&&void 0,custom:t,presenceAffectsLayout:f,mode:h,root:b,onExitComplete:s?void 0:()=>{if(C.current.has(a)||(C.current.add(a),!A.has(a)))return;A.set(a,!0);let e=!0;A.forEach(t=>{t||(e=!1)}),e&&(R?.(),S(k.current),m&&y?.(),d&&d())},anchorX:g,anchorY:p,children:e},a)})})}},889202:(e,t,r)=>{"use strict";r.d(t,{Nh:()=>h,Pl:()=>u,U3:()=>f,Xk:()=>d});var n=r(637876),a=r(657061),s=r(126532),i=r(277166),o=r(14232);let l=(0,o.createContext)({isLoading:!1,value:"",setValue:()=>{},maxHeight:240,onSubmit:void 0,disabled:!1});function c(){let e=(0,o.useContext)(l);if(!e)throw Error("usePromptInput must be used within a PromptInput");return e}function u(e){let{className:t,isLoading:r=!1,maxHeight:a=240,value:c,onValueChange:u,onSubmit:d,children:f}=e,[h,m]=(0,o.useState)(c||"");return(0,n.jsx)(s.Bc,{children:(0,n.jsx)(l.Provider,{value:{isLoading:r,value:null!=c?c:h,setValue:null!=u?u:e=>{m(e),null==u||u(e)},maxHeight:a,onSubmit:d},children:(0,n.jsx)("div",{className:(0,i.cn)("border-input bg-background rounded-3xl border p-2 shadow-xs",t),children:f})})})}function d(e){let{className:t,onKeyDown:r,disableAutosize:s=!1,...l}=e,{value:u,setValue:d,maxHeight:f,onSubmit:h,disabled:m}=c(),g=(0,o.useRef)(null);return(0,o.useEffect)(()=>{!s&&g.current&&(g.current.style.height="auto",g.current.style.height="number"==typeof f?"".concat(Math.min(g.current.scrollHeight,f),"px"):"min(".concat(g.current.scrollHeight,"px, ").concat(f,")"))},[u,f,s]),(0,n.jsx)(a.T,{ref:g,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),null==h||h()),null==r||r(e)},className:(0,i.cn)("text-primary min-h-[44px] w-full resize-none border-none bg-transparent shadow-none outline-none focus-visible:ring-0 focus-visible:ring-offset-0",t),rows:1,disabled:m,...l})}function f(e){let{children:t,className:r,...a}=e;return(0,n.jsx)("div",{className:(0,i.cn)("flex items-center gap-2",r),...a,children:t})}function h(e){let{tooltip:t,children:r,className:a,side:i="top",...o}=e,{disabled:l}=c();return(0,n.jsxs)(s.m_,{...o,children:[(0,n.jsx)(s.k$,{asChild:!0,disabled:l,children:r}),(0,n.jsx)(s.ZI,{side:i,className:a,children:t})]})}},890965:(e,t,r)=>{"use strict";r.d(t,{O:()=>l});var n=r(637876),a=r(14232),s=r(803866),i=r(991200),o=r(453417);let l=({children:e,initial:t,isPresent:r,onExitComplete:l,custom:u,presenceAffectsLayout:d,mode:f,anchorX:h,anchorY:m,root:g})=>{let p=(0,i.M)(c),b=(0,a.useId)(),v=!0,y=(0,a.useMemo)(()=>
9(v=!1,{id:b,initial:t,isPresent:r,custom:u,onExitComplete:e=>{for(let t of(p.set(e,!0),p.values()))if(!t)return;l&&l()},register:e=>(p.set(e,!1),()=>p.delete(e))}),[r,p,l]);return d&&v&&(y={...y}),(0,a.useMemo)(()=>{p.forEach((e,t)=>p.set(t,!1))},[r]),a.useEffect(()=>{r||p.size||!l||l()},[r]),e=(0,n.jsx)(o.C,{pop:"popLayout"===f,isPresent:r,anchorX:h,anchorY:m,root:g,children:e}),(0,n.jsx)(s.t.Provider,{value:y,children:e})};function c(){return new Map}},913192:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/ai/chat",function(){return r(793223)}])},920503:(e,t,r)=>{"use strict";r.d(t,{LS:()=>u,UF:()=>c,X5:()=>d,pJ:()=>l});var n=r(16070);let a=["/auth/login","/auth/register","/auth/forgot-password","/auth/reset-password","/auth/confirm","/auth/post-login","/auth/account-status","/auth/error","/auth/logout"],s="https://akeptus.local";function i(e){var t;return e?null!=(t=(0,n.X)(e))?t:e:null}function o(e){let t=e.trim();return t?(t.startsWith("/")?t:"/".concat(t)).replace(/\/+$/,"")||"/":""}function l(e){var t,r;let n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=Array.isArray(e)?"string"==typeof e[0]?e[0]:null:"string"==typeof e?e:null;if(!i)return null;let l=(function(e){try{return decodeURIComponent(e)}catch(t){return e}})(i).trim();if(!l||l.startsWith("//"))return null;let c=new Set((null!=(t=s.blockedPathnames)?t:a).map(e=>{var t;return String(null!=(t=o(e))?t:"").toLowerCase()}));if(l.startsWith("http://")||l.startsWith("https://")){if(!s.allowedOrigin)return null;try{n=new URL(l)}catch(e){return null}if(n.origin!==s.allowedOrigin)return null}else{if(!l.startsWith("/"))return null;try{n=new URL(l,"https://akeptus.local")}catch(e){return null}}return n.pathname.startsWith("//")||c.has(String(null!=(r=o(n.pathname))?r:"").toLowerCase())?null:"".concat(n.pathname).concat(n.search).concat(n.hash)}function c(e,t){var r,n;if("string"==typeof e&&e.trim())return l(e,{blockedPathnames:a});let s=null!=(r=null==t?void 0:t.pathname)?r:window.location.pathname,i=null!=(n=null==t?void 0:t.search)?n:window.location.search;return s&&s.trim()?l("".concat(s).concat(null!=i?i:""),{blockedPathnames:a}):null}function u(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n="string"==typeof e||Array.isArray(e)?e:null==e?void 0:e.callbackUrl,o="string"==typeof e||Array.isArray(e)?r:null!=e?e:r,c=new URL("/auth/login",s),u=i(l(n,{blockedPathnames:null!=(t=o.blockedPathnames)?t:a}));return u&&c.searchParams.set("callbackUrl",u),o.message&&c.searchParams.set("message",o.message),o.reason&&c.searchParams.set("reason",o.reason),"".concat(c.pathname).concat(c.search)}function d(e,t){let r=new URL("/auth/post-login",s),n=i(l(e,{allowedOrigin:t,blockedPathnames:a}));return n&&r.searchParams.set("callbackUrl",n),"".concat(r.pathname).concat(r.search)}},930342:(e,t,r)=>{"use strict";function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1024,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null==e)return"";let n=String(e);return(n=n.replace(/<[^>]*>/g,"").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/g,"").replace(/\r\n?/g,"\n"),(n=r.preserveLineBreaks?n.split("\n").map(e=>e.replace(/\s+/g," ").trim()).join("\n").replace(/\n{3,}/g,"\n\n").trim():n.replace(/\s+/g," ").trim()).length>t)?n.slice(0,t):n}r.d(t,{V:()=>n})},952786:(e,t,r)=>{"use strict";r.d(t,{l:()=>b,r:()=>f});var n=r(14232);let a=[],s=new Map,i=0,o="";function l(){return globalThis}function c(e){return"function"==typeof(null==e?void 0:e.focus)}function u(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function d(e){let t=null==e?void 0:e.getAttribute("data-testid");return t?'[data-testid="'.concat(u(t),'"]'):(null==e?void 0:e.id)?'[id="'.concat(u(e.id),'"]'):null}function f(e){l().__AKEPTUS_MODAL_RETURN_FOCUS_TARGET__=c(e)?{element:e,selector:d(e)}:null}function h(e){let t=a.lastIndexOf(e);t>=0&&a.splice(t,1)}function m(e){return Array.from(e.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), [contenteditable="true"]')).filter(e=>!e.hasAttribute("disabled")&&"true"!==e.getAttribute("aria-hidden"))}function g(e){return e.focus(),document.activeElement===e||e.contains(document.activeElement)}function p(e){var t;let r=s.get(e),n=null==r?void 0:r.containerRef.current;if(!n)return!1;let a=null==(t=r.initialFocusRef)?void 0:t.current;if(a&&n.contains(a))return g(a);let[i]=m(n);return i?g(i):g(n)}function b(e){let{open:t,onClose:r,initialFocusRef:u}=e,f=(0,n.useRef)(null),g=(0,n.useRef)(Symbol("modal")),b=(0,n.useRef)(!1),v=(0,n.useRef)(null),y=(0,n.useRef)(null),w=()=>
9{if(!b.current)return;b.current=!1,h(g.current),s.delete(g.current);let e=function(e,t){if(null==e?void 0:e.isConnected)return e;if(!t)return null;let r=document.querySelector(t);return c(r)?r:null}(v.current,y.current);v.current=null,y.current=null;let t=a[a.length-1];if(t){var r;let n=null==(r=s.get(t))?void 0:r.containerRef.current;if((null==e?void 0:e.isConnected)&&(null==n?void 0:n.contains(e)))return void e.focus();if(p(t))return;h(t),s.delete(t)}(null==e?void 0:e.isConnected)&&e.focus()};return(0,n.useEffect)(()=>{if(!t){h(g.current),s.delete(g.current);return}return s.set(g.current,{containerRef:f,initialFocusRef:u}),h(g.current),a.push(g.current),()=>{h(g.current),s.delete(g.current)}},[f,u,t]),(0,n.useEffect)(()=>{if(t)return 0===i&&(o=document.body.style.overflow,document.body.style.overflow="hidden"),i+=1,()=>{0===(i=Math.max(0,i-1))&&(document.body.style.overflow=o,o="")}},[t]),(0,n.useEffect)(()=>{if(t){if(!b.current){var e,r;let t=c(document.activeElement)?document.activeElement:null,n=function(){var e;let t=null!=(e=l().__AKEPTUS_MODAL_RETURN_FOCUS_TARGET__)?e:null;return l().__AKEPTUS_MODAL_RETURN_FOCUS_TARGET__=null,t}();v.current=null!=(e=null==n?void 0:n.element)?e:t,y.current=null!=(r=null==n?void 0:n.selector)?r:d(t)}b.current=!0;let t=window.setTimeout(()=>{p(g.current)},50);return()=>{window.clearTimeout(t),w()}}w()},[t]),(0,n.useEffect)(()=>{if(!t)return;let e=e=>{if(a[a.length-1]!==g.current)return;if("Escape"===e.key){e.preventDefault(),e.stopPropagation(),r();return}if("Tab"!==e.key)return;let t=f.current;if(!t)return;let n=m(t);if(0===n.length){e.preventDefault(),t.focus();return}let s=n[0],i=n[n.length-1];if(!s||!i)return;let o=document.activeElement instanceof HTMLElement?document.activeElement:null;if(!o||!t.contains(o)){e.preventDefault(),(e.shiftKey?i:s).focus();return}if(e.shiftKey&&o===s){e.preventDefault(),i.focus();return}e.shiftKey||o!==i||(e.preventDefault(),s.focus())};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[r,t]),{containerRef:f}}},982457:(e,t,r)=>{"use strict";r.d(t,{Qg:()=>i,bL:()=>l});var n=r(14232),a=r(866326),s=r(637876),i=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),o=n.forwardRef((e,t)=>(0,s.jsx)(a.sG.span,{...e,ref:t,style:{...i,...e.style}}));o.displayName="VisuallyHidden";var l=o},986266:(e,t,r)=>{"use strict";r.d(t,{LN:()=>c,Vu:()=>u});var n=r(118977);r(571976);var a=r(599742);let s={maxConcurrent:4,staggerDelay:50,defaultTimeout:6e4,defaultRetries:2,priorityDelays:{critical:0,high:25,normal:50,low:100,deferred:200},enableLogging:!1},i={critical:0,high:1,normal:2,low:3,deferred:4};class o{enqueue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{priority:r="normal",timeout:n=this.config.defaultTimeout,retries:a=this.config.defaultRetries,id:s=this.generateId()}=t;return new Promise((t,i)=>{let o={id:s,execute:e,priority:r,addedAt:Date.now(),timeout:n,retries:a,resolve:t,reject:i,abortController:new AbortController},l=this.findInsertIndex(r);this.queue.splice(l,0,o),this.metrics.totalQueued++,this.config.enableLogging,this.processQueue()})}async enqueueAll(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Promise.all(e.map((e,r)=>this.enqueue(e.execute,{...t,id:e.id||"batch-".concat(Date.now(),"-").concat(r)}).then(t=>({id:e.id||"batch-".concat(Date.now(),"-").concat(r),result:t})).catch(t=>({id:e.id||"batch-".concat(Date.now(),"-").concat(r),error:t}))))}cancel(e){var t,r;let n=this.queue.findIndex(t=>t.id===e);if(n>=0){let[e]=this.queue.splice(n,1);return e&&(null==(t=e.abortController)||t.abort(),e.reject(Error("Request cancelled")),this.metrics.totalCancelled++),!0}let a=this.activeRequests.get(e);return!!a&&(null==(r=a.abortController)||r.abort(),this.activeRequests.delete(e),this.metrics.totalCancelled++,!0)}cancelAll(){var e,t;for(let t of this.queue)null==(e=t.abortController)||e.abort(),t.reject(Error("All requests cancelled"));for(let[,e]of(this.metrics.totalCancelled+=this.queue.length,this.queue=[],this.activeRequests))null==(t=e.abortController)||t.abort(),this.metrics.totalCancelled++;this.activeRequests.clear(),this.config.enableLogging}getStatus(){return{queueLength:this.queue.length,activeRequests:this.activeRequests.size,metrics:{...this.metrics},config:this.config}}updateConfig(e){this.config={...this.config,...e}}generateId(){return"req-".concat(Date.now(),"-").concat(++this.requestIdCounter)}findInsertIndex(e){let t=i[e];for(let e=0;e<this.queue.length;e++){let r=this.queue[e];if(r&&i[r.priority]>t)return e}return this.queue.length}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0&&this.activeRequests.size<this.config.maxConcurrent;){let e=this.queue.shift();if(!e)continue;let t=Date.now()-this.lastRequestTime,r=Math.max(0,this.config.priorityDelays[e.priority]-t);r>
90&&await this.delay(r),this.lastRequestTime=Date.now(),this.executeRequest(e)}this.isProcessing=!1}}async executeRequest(e){this.activeRequests.set(e.id,e);let t=Date.now(),r=t-e.addedAt,a=0,s=e.retries||0;for(;a<=s;){let o=null;try{let a=new Promise((t,r)=>{o=setTimeout(()=>r(Error("Request ".concat(e.id," timed out after ").concat(e.timeout,"ms"))),e.timeout)}),s=await Promise.race([e.execute(),a]),i=Date.now()-t;this.updateMetrics(r,i,!0),this.config.enableLogging&&n.logger.info("[RequestQueue] Request ".concat(e.id," completed in ").concat(i,"ms (waited ").concat(r,"ms)")),e.resolve(s),this.activeRequests.delete(e.id),this.processQueue();return}catch(o){var i;if(a++,(o instanceof Error?o.message:String(o))==="Request cancelled"||(null==(i=e.abortController)?void 0:i.signal.aborted))return void this.activeRequests.delete(e.id);if(a<=s){let t=1e3*Math.pow(2,a-1);this.config.enableLogging&&n.logger.info("[RequestQueue] Request ".concat(e.id," failed, retrying in ").concat(t,"ms (attempt ").concat(a,"/").concat(s+1,")")),await this.delay(t)}else{let a=Date.now()-t;this.updateMetrics(r,a,!1);let i=o instanceof Error?o:Error(String(o));this.config.enableLogging&&n.logger.error("[RequestQueue] Request ".concat(e.id," failed after ").concat(s+1," attempts:"),i),e.reject(i),this.activeRequests.delete(e.id),this.processQueue();return}}finally{o&&clearTimeout(o)}}}updateMetrics(e,t,r){r?this.metrics.totalCompleted++:this.metrics.totalFailed++;let n=this.metrics.totalCompleted+this.metrics.totalFailed;this.metrics.averageWaitTime=(this.metrics.averageWaitTime*(n-1)+e)/n,this.metrics.averageExecutionTime=(this.metrics.averageExecutionTime*(n-1)+t)/n}delay(e){return new Promise(t=>setTimeout(t,e))}constructor(e={}){this.queue=[],this.activeRequests=new Map,this.isProcessing=!1,this.lastRequestTime=0,this.requestIdCounter=0,this.metrics={totalQueued:0,totalCompleted:0,totalFailed:0,totalCancelled:0,averageWaitTime:0,averageExecutionTime:0},this.config={...s,...e}}}let l=null,c=new Proxy({},{get:(e,t)=>("phase-production-build"===a.env.NEXT_PHASE?{enqueue:async()=>{throw Error("Not available during build")},enqueueAll:async()=>[],cancel:()=>!1,cancelAll:()=>{},getStatus:()=>({queueLength:0,activeRequests:0,metrics:{},config:{}}),updateConfig:()=>{}}:(!l&&(l=new o({maxConcurrent:4,staggerDelay:50,defaultTimeout:6e4,defaultRetries:2,enableLogging:!1})),l))[t]});function u(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new o(e)}},995159:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(358693).A)("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])}},e=>{e.O(0,[38513,82909,58422,1126,10553,42237,65130,41941,75656,77197,54587,29186,21979,82373,23433,30188,65356,55824,94890,10773,50762,1537,17427,37432,43956,90636,46593,38792],()=>e(e.s=913192)),_N_E=e.O()}]);

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.