PageSourceSearch

https://sasupo.com/_next/static/chunks/7311.e03a2fb6249232ea.js

js sasupo.com collected 2026-10-08 22:15:39 UTC 11,080 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7311],{17759:(e,t,a)=>{a.d(t,{C5:()=>v,MJ:()=>g,Rr:()=>p,eI:()=>x,lR:()=>h,lV:()=>c,zB:()=>m});var s=a(95155),n=a(12115),l=a(99708),o=a(62177),i=a(82807),r=a(85057);let c=o.Op,d=n.createContext({}),m=e=>{let{...t}=e;return(0,s.jsx)(d.Provider,{value:{name:t.name},children:(0,s.jsx)(o.xI,{...t})})},u=()=>{let e=n.useContext(d),t=n.useContext(f),{getFieldState:a}=(0,o.xW)(),s=(0,o.lN)({name:e.name}),l=a(e.name,s);if(!e)throw Error("useFormField should be used within <FormField>");let{id:i}=t;return{id:i,name:e.name,formItemId:"".concat(i,"-form-item"),formDescriptionId:"".concat(i,"-form-item-description"),formMessageId:"".concat(i,"-form-item-message"),...l}},f=n.createContext({});function x(e){let{className:t,...a}=e,l=n.useId();return(0,s.jsx)(f.Provider,{value:{id:l},children:(0,s.jsx)("div",{"data-slot":"form-item",className:(0,i.cn)("grid gap-2",t),...a})})}function h(e){let{className:t,...a}=e,{error:n,formItemId:l}=u();return(0,s.jsx)(r.J,{"data-slot":"form-label","data-error":!!n,className:(0,i.cn)("data-[error=true]:text-destructive",t),htmlFor:l,...a})}function g(e){let{...t}=e,{error:a,formItemId:n,formDescriptionId:o,formMessageId:i}=u();return(0,s.jsx)(l.DX,{"data-slot":"form-control",id:n,"aria-describedby":a?"".concat(o," ").concat(i):"".concat(o),"aria-invalid":!!a,...t})}function p(e){let{className:t,...a}=e,{formDescriptionId:n}=u();return(0,s.jsx)("p",{"data-slot":"form-description",id:n,className:(0,i.cn)("text-muted-foreground text-sm",t),...a})}function v(e){var t;let{className:a,...n}=e,{error:l,formMessageId:o}=u(),r=l?String(null!=(t=null==l?void 0:l.message)?t:""):n.children;return r?(0,s.jsx)("p",{"data-slot":"form-message",id:o,className:(0,i.cn)("text-destructive text-sm",a),...n,children:r}):null}},38136:(e,t,a)=>{a.d(t,{A:()=>l});var s=a(12115),n="undefined"!=typeof window;let l=function(e,t){var a=(0,s.useState)(void 0!==t?t:!!n&&window.matchMedia(e).matches),l=a[0],o=a[1];return(0,s.useEffect)(function(){var t=!0,a=window.matchMedia(e),s=function(){t&&o(!!a.matches)};return a.addEventListener("change",s),o(a.matches),function(){t=!1,a.removeEventListener("change",s)}},[e]),l}},54165:(e,t,a)=>{a.d(t,{Cf:()=>m,Es:()=>f,HM:()=>c,L3:()=>x,c7:()=>u,lG:()=>i,rr:()=>h});var s=a(95155);a(12115);var n=a(62939),l=a(54416),o=a(82807);function i(e){let{...t}=e;return(0,s.jsx)(n.bL,{"data-slot":"dialog",...t})}function r(e){let{...t}=e;return(0,s.jsx)(n.ZL,{"data-slot":"dialog-portal",...t})}function c(e){let{...t}=e;return(0,s.jsx)(n.bm,{"data-slot":"dialog-close",...t})}function d(e){let{className:t,...a}=e;return(0,s.jsx)(n.hJ,{"data-slot":"dialog-overlay",className:(0,o.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function m(e){let{className:t,children:a,showCloseButton:i=!0,...c}=e;return(0,s.jsxs)(r,{"data-slot":"dialog-portal",children:[(0,s.jsx)(d,{}),(0,s.jsxs)(n.UC,{"data-slot":"dialog-content",className:(0,o.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...c,children:[a,i&&(0,s.jsxs)(n.bm,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,s.jsx)(l.A,{}),(0,s.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function u(e){let{className:t,...a}=e;return(0,s.jsx)("div",{"data-slot":"dialog-header",className:(0,o.cn)("flex flex-col gap-2 text-center sm:text-left",t),...a})}function f(e){let{className:t,...a}=e;return(0,s.jsx)("div",{"data-slot":"dialog-footer",className:(0,o.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...a})}function x(e){let{className:t,...a}=e;return(0,s.jsx)(n.hE,{"data-slot":"dialog-title",className:(0,o.cn)("text-lg leading-none font-semibold",t),...a})}function h(e){let{className:t,...a}=e;return(0,s.jsx)(n.VY,{"data-slot":"dialog-description",className:(0,o.cn)("text-muted-foreground text-sm",t),...a})}},67311:(e,t,a)=>{a.r(t),a.d(t,{default:()=>E});var s=a(95155),n=a(73322),l=a(58270),o=a(12115),i=a(34477);let r=(0,i.createServerReference)("7ffc7758fdf6f955680650136b5609b7ff9f829d80",i.callServer,void 0,i.findSourceMapURL,"createEmissionFactorReportItemAction");var c=a(15900),d=a(82807),m=a(17652),u=a(47262),f=a(68856),x=a(62523),h=a(74556),g=a(63560),p=a(62177),v=a(17759),j=a(30285),N=a(72352),b=a(35695),y=a(17675),C=a(56671),w=a(51267);let _=e=>h.Ik({ids:h.YO(h.ai()).min(1,{message:e("form.validation.factorReportItem")})}),E=e=>{var t;let{open:a,setOpen:i,selectedCategory:h,setSelectedCategory:E,activeEmissionFactors:S,helpInfo:k}=e,I=(0,m.c)(),{year:L}=(0,y.A)(),{scopeId:z}=(0,b.useParams)(),{location:F,month:M=(0,d.bC)().month,actualYear:A=(0,d.bC)().year}=(0,y.A)(),[V,R]=(0,o.useState)([]),[O,J]=(0,o.useState)(!1),[T,B]=(0,o.useState)(!1),[H,P]=(0,o.useState)(""),[D,U]=(0,o.useState)(""),[q,G]=(0,o.useState)(""),Y=(0,p.mN)({resolver:(0,g.u)(_(I)),defaultValues:{ids:[]}}),$=Y.watch("ids"),W=(e,t)=>{let a=Y.getValues("ids");Y.setValue("ids",t?[...a,e]:a.filter(t=>t!==e),{shouldValidate:!0})},X=(0,o.useMemo)(()=>{let e=H.trim().toLowerCase();return V.filter(t=>!$.includes(t.id)&&(!e||t.emission_factor_value.name.toLowerCase().includes(e)||String(t.id).includes(e)))},[H,V,$]),Z=(0,o.useMemo)(()=>{let e=D.trim().toLowerCase();return V.filter(t=>$.includes(t.id)&&(!e||t.emission_factor_value.name.toLowerCase().includes(e)||String(t.id).includes(e)))},[D,V,$]);return(0,o.useEffect)(()=>{let e;if(!a||!(null==h?void 0:h.id)||!L)return;let t=!0,s=async()=>
1{if(t){J(!0);try{let a=await (0,c.p)("category=".concat(h.id,"&fiscal_year=").concat(L,"&limit=100000"));(0,d.yH)({response:a,onSuccess:a=>{a&&a.length>0?t&&(R(a.filter(e=>!S.includes(e.id))),J(!1)):t&&(e=setTimeout(s,2e3))},t:I})}catch(a){console.error("Polling error, retrying...",a),t&&(e=setTimeout(s,2e3))}}};return s(),()=>{t=!1,clearTimeout(e)}},[a,null==h?void 0:h.id,L,I,S]),(0,o.useEffect)(()=>{a||(P(""),U(""),J(!1),Y.setValue("ids",[]))},[Y,a]),(0,s.jsxs)(n.A,{isOpen:a,setIsOpen:i,className:"min-h-125 overflow-hidden p-8 sm:max-w-7xl",children:[(0,s.jsxs)("div",{className:"mb-5 flex items-center justify-center gap-2",children:[(0,s.jsx)(l.A,{variant:"title",className:"text-center text-xl font-semibold",text:I("page.ghgEmissionCalculations.title.add",{name:null!=(t=null==h?void 0:h.name)?t:""})}),(0,s.jsx)(w.HelpInformationSideBar,{helpData:k})]}),(0,s.jsx)(v.lV,{...Y,children:(0,s.jsxs)("form",{onSubmit:Y.handleSubmit(e=>{h&&F?(B(!0),i(!1),r(e.ids.map(e=>({scope_id:Number(z),fiscal_location_id:F,year:Number(A),month:M,emission_factor_category_id:h.id,company_emission_factor_value_id:e})),z).then(e=>{(0,d.yH)({response:e[e.length-1],onSuccess:()=>{P(""),U(""),Y.setValue("ids",[]),C.toast.success(I("page.ghgEmissionCalculations.success.reportItem")),E(null)},t:I})}).finally(()=>B(!1))):(console.error("selectedCategory or location doesn't exit"),G(I("page.ghgEmissionCalculations.selectedCategoryOrLocation")))}),children:[(0,s.jsxs)("div",{className:"flex gap-5",children:[(0,s.jsx)(v.zB,{control:Y.control,name:"ids",render:()=>(0,s.jsx)(v.eI,{className:"flex-1",children:(0,s.jsxs)("div",{children:[(0,s.jsx)(x.p,{name:"left-query",type:"search",value:H,onChange:e=>P(e.target.value),placeholder:I("page.ghgEmissionCalculations.searchToSelect"),className:"mb-5 w-full"}),(0,s.jsx)("div",{className:"h-80 max-h-80 space-y-3 overflow-auto rounded bg-slate-100 p-3",children:O?(0,s.jsx)(f.E,{className:"flex h-72 w-full items-center justify-center rounded-md text-center",children:(0,s.jsx)("h5",{className:"text-sm font-medium",children:I("form.emissionFactorLoading")})}):0===X.length?(0,s.jsx)("div",{className:"text-muted-foreground text-sm",children:I("page.ghgEmissionCalculations.noResult")}):X.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(v.MJ,{children:(0,s.jsx)(u.S,{id:"factor-".concat(e.id),checked:$.includes(e.id),onCheckedChange:t=>W(e.id,!0===t)})}),(0,s.jsx)("label",{htmlFor:"factor-".concat(e.id),className:"cursor-pointer",children:e.emission_factor_value.name})]},e.id))})]})})}),(0,s.jsx)(v.zB,{control:Y.control,name:"ids",render:()=>(0,s.jsxs)(v.eI,{className:"flex-1",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(x.p,{name:"right-query",type:"search",value:D,onChange:e=>U(e.target.value),placeholder:I("page.ghgEmissionCalculations.searchToUnselect"),className:"mb-5 w-full"}),(0,s.jsx)("div",{className:"h-80 max-h-80 space-y-3 overflow-auto rounded bg-slate-100 p-3",children:O?(0,s.jsx)(f.E,{className:"flex h-72 w-full items-center justify-center rounded-md text-center",children:(0,s.jsx)("h5",{className:"text-sm font-medium",children:I("form.emissionFactorLoading")})}):0===Z.length?(0,s.jsx)("div",{className:"text-muted-foreground text-sm",children:I("page.ghgEmissionCalculations.noResult")}):Z.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(v.MJ,{children:(0,s.jsx)(u.S,{id:"factor-".concat(e.id),checked:$.includes(e.id),onCheckedChange:t=>W(e.id,!0===t)})}),(0,s.jsx)("label",{htmlFor:"factor-".concat(e.id),className:"cursor-pointer",children:e.emission_factor_value.name})]},e.id))})]}),(0,s.jsx)(v.C5,{})]})})]}),q&&(0,s.jsx)("span",{className:"text-destructive mt-5 block",children:q}),(0,s.jsxs)("div",{className:"mt-6 flex gap-5",children:[(0,s.jsx)(j.$,{className:"flex-1",variant:"cancel",type:"reset",onClick:()=>i(!1),children:I("button.cancel")}),(0,s.jsx)(j.$,{className:"flex-1",disabled:T,type:"submit",children:T?(0,s.jsx)(N.y,{}):I("button.submit")})]})]})})]})}},68856:(e,t,a)=>{a.d(t,{E:()=>l});var s=a(95155),n=a(82807);function l(e){let{className:t,...a}=e;return(0,s.jsx)("div",{"data-slot":"skeleton",className:(0,n.cn)("animate-pulse rounded-md bg-slate-300",t),...a})}},73322:(e,t,a)=>{a.d(t,{A:()=>r});var s=a(95155),n=a(38136),l=a(54165),o=a(18950),i=a(82807);function r(e){let{children:t,isOpen:a,className:r,setIsOpen:c}=e;return(0,n.A)("(min-width: 768px)",!0)?(0,s.jsx)(l.lG,{open:a,onOpenChange:c,children:(0,s.jsxs)(l.Cf,{className:(0,i.cn)("z-50 max-h-[90vh] min-h-[70vh] w-full overflow-y-auto border-none px-0 sm:max-w-lg",r),children:[(0,s.jsx)(l.L3,{className:"hidden"}),t]})}):(0,s.jsx)(o._s,{open:a,onOpenChange:c,children:(0,s.jsxs)(o.zj,{children:[(0,s.jsx)(o.gk,{className:"hidden"}),(0,s.jsx)("div",{className:(0,i.cn)("hide-scroll-bar min-h-[70vh] overflow-y-auto",r),children:t})]})})}}}]);

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.