PageSourceSearch

https://www.tsuhan-tora.com/assets/index-JtuHi6EP.js

js tsuhan-tora.com collected 2026-10-08 02:14:11 UTC 20,060 bytes, 257 lines download raw bytes

1import{h as m,j as e,l as Le,L as De}from"./vendor-react-Dx9ATBpN.js";import{S as T,E as le}from"./StatCard-CgDGxMMH.js";import{af as p,k as Oe,j as de,al as c,ae as o,az as s,aW as Te,ab as Re,aN as Ie,a_ as Ne,Y as ze}from"./index-TAoP3JUX.js";import{S as Be}from"./Select-CCHE51sf.js";import{E as I}from"./EmptyState-P3vs2EoZ.js";import{M as w}from"./MyPageSection-ZS-yeE5H.js";import{M as Ee}from"./MyPageInnerLayout-CDcd8UvE.js";import{j as Ke,a as Ve,d as We,f as ce}from"./convert-D6W3rJvB.js";import{R as W,a as F,C as U,X as _,Y as H,T as Y,L as Q,B as R}from"./vendor-recharts-wtmkQznW.js";import{u as Fe}from"./index-C3PmEdZi.js";import{u as Ue}from"./index-Covfrwq4.js";import{j as _e,o as He}from"./vendor-firebase-CM36PMsb.js";import"./vendor-motion-27JH31EY.js";import"./vendor-datepicker-B96X1cxi.js";import"./PageTitle-Bac1yGW9.js";var Ye=typeof window<"u",Qe=function(t,n){return Ye?window.matchMedia(t).matches:!1},G=function(t,n){var d=m.useState(Qe(t)),u=d[0],h=d[1];return m.useEffect(function(){var f=!0,y=window.matchMedia(t),v=function(){f&&h(!!y.matches)};return y.addEventListener("change",v),h(y.matches),function(){f=!1,y.removeEventListener("change",v)}},[t]),u};const Ge=()=>{const t=G(p.smartPhone),n=G(p.tablet),d=G(p.gtTablet);return{isSmartphone:t,isTablet:n,isGtTablet:d}},q=({children:t,title:n})=>e.jsx(Oe,{fallbackRender:()=>e.jsx(I,{title:n??"グラフを表示できませんでした",description:"時間をおいて再度お試しください。",compact:!0}),children:t}),qe=[{key:"all",value:"全データ"},{key:"sales",value:"売上推移"},{key:"orders",value:"注文数"}],Xe=[{label:"商品管理",description:"掲載商品の追加・編集",to:"/mypage/vendor/products"},{label:"注文管理",description:"受注・出荷ステータス",to:"/mypage/vendor/orders"},{label:"売上管理",description:"月次売上と明細",to:"/mypage/vendor/sales"},{label:"口座情報",description:"入金先口座の登録",to:"/mypage/vendor/bank-account"}],ue=t=>t==="NA"?"前月実績なし":t.startsWith("+")?`前月比 ${t}%`:t.startsWith("-")?`前月比 ${t}%`:"前月比 ±0%",he=t=>t==="NA"?"flat":t.startsWith("+")?"up":t.startsWith("-")?"down":"flat",me=t=>{const n=Number(Array.isArray(t)?t[0]:t);return`¥${(Number.isFinite(n)?n:0).toLocaleString()}`},xe=t=>t===0?"0":t>=1e4?`${(t/1e4).toLocaleString(void 0,{maximumFractionDigits:1})}万円`:t%1e3===0?`${t/1e3}千円`:`${t.toLocaleString()}円`,Je=t=>{const n=t/4,d=10**Math.floor(Math.log10(n)),u=[1,2,5,10].map(h=>h*d).find(h=>h>=n);return Math.max(u??d*10,1e3)},fe=t=>{const n=Math.max(0,...t.filter(Number.isFinite));if(n===0)return[0,1e3];const d=Je(n),u=Math.ceil(n/d)*d;return Array.from({length:u/d+1},(h,f)=>f*d)},Ze=t=>t.flatMap(n=>Object.entries(n).filter(([d])=>d!=="month").map(([,d])=>Number(d))),et=(t,n)=>t?1.4:n?2.4:4,tt=t=>{const{isSmartphone:n,isTablet:d}=Ge(),u=et(n,d),h=n?"bottom":"top",f={allowEscapeViewBox:{x:!1,y:!1},wrapperStyle:{maxWidth:"100%"},contentStyle:{maxWidth:"100%",whiteSpace:"normal",fontSize:n?c.small:c.medium}},y=Le();if(!t.user)return null;const v=!!t.productRankings&&t.productRankings.length>0,x=!!t.salesHistory&&t.salesHistory.length>0,z=!!t.monthlyOrdersChartData&&t.monthlyOrdersChartData.length>0,S=!!t.monthlySalesChartData&&t.monthlySalesChartData.length>0,D=fe((t.salesHistory??[]).map(a=>a.sales)),$=fe(Ze(t.monthlySalesChartData??[])),K=t.productSeries.length<=1,C=t.productSeries.length===1?t.productSeries[0].name:"全商品",B=K?[]:t.productSeries;return e.jsx(Ee,{title:"ダッシュボード",description:"ショップの実績と各管理メニューへの導線をまとめています。",children:e.jsxs(rt,{children:[t.alerts&&(t.alerts.openInquiryCount>0||t.alerts.unshippedOrderCount>0)&&e.jsxs(nt,{children:[t.alerts.openInquiryCount>0&&e.jsxs(ge,{to:"/mypage/vendor/inquiries",children:[e.jsxs(pe,{children:[t.alerts.openInquiryCount,"件"]}),e.jsx(je,{children:"未対応のお問い合わせがあります"}),e.jsx(be,{children:"確認する →"})]}),t.alerts.unshippedOrderCount>0&&e.jsxs(ge,{to:"/mypage/vendor/orders",children:[e.jsxs(pe,{children:[t.alerts.unshippedOrderCount,"件"]}),e.jsx(je,{children:"未発送の注文があります"}),e.jsx(be,{children:"確認する →"})]})]}),e.jsx(w,{title:"ショップ情報",children:e.jsxs(ot,{children:[e.jsx(at,{children:t.user.iconFileUrl?e.jsx(st,{src:t.user.iconFileUrl,alt:`${t.user.name} のアイコン`}):e.jsx(it,{"aria-label":`${t.user.name} のアイコン未設定`})}),e.jsxs(lt,{children:[e.jsxs(dt,{children:[e.jsxs(ct,{children:[t.user.name," 様"]}),e.jsxs(ut,{children:[e.jsxs(ht,{children:["ID: ",t.user.id]}),e.jsx(mt,{children:Ke(t.user.type)})]})]}),e.jsxs(gt,{children:[e.jsxs(ye,{children:[e.jsx(A,{children:"住所"}),e.jsx(M,{children:[t.user.zipCode?`〒${Ve(t.user.zipCode)}`:null,We(t.user.prefecture??void 0),t.user.city,t.user.address].filter(
1Boolean).join(" ")||"—"})]}),e.jsxs(N,{children:[e.jsx(A,{children:"電話番号"}),e.jsx(M,{children:ce(t.user.phoneNumber)||"—"})]}),e.jsxs(N,{children:[e.jsx(A,{children:"FAX"}),e.jsx(M,{children:ce(t.user.faxNumber??void 0)||"—"})]}),e.jsxs(N,{children:[e.jsx(A,{children:"メールアドレス"}),e.jsx(M,{children:t.user.email||"—"})]}),e.jsxs(N,{children:[e.jsx(A,{children:"法人番号"}),e.jsx(M,{children:t.user.corporateNumber||"—"})]}),t.user.bio&&e.jsxs(ye,{children:[e.jsx(A,{children:"自己紹介"}),e.jsx(M,{children:t.user.bio})]})]}),e.jsx(xt,{children:e.jsx(ft,{children:e.jsx(de,{variant:"outlined",size:"small",onClick:()=>y("/mypage/vendor/profile"),children:"ショップ情報を編集"})})})]})]})}),e.jsx(w,{title:"主要メニュー",children:e.jsx(pt,{children:Xe.map(a=>e.jsxs(J,{type:"button",onClick:()=>y(a.to),children:[e.jsx(jt,{children:a.label}),e.jsx(bt,{children:a.description}),e.jsx(yt,{"aria-hidden":!0,children:"→"})]},a.to))})}),t.stats&&e.jsx(w,{title:"年間サマリ",children:e.jsxs(Se,{children:[e.jsx(T,{label:"商品掲載数",value:`${t.stats.totalProducts.toLocaleString()} 件`}),e.jsx(T,{label:"年間 注文数",value:`${t.stats.totalOrders.toLocaleString()} 件`}),e.jsx(T,{label:"年間 総売上(税込)",value:`¥${t.stats.totalSales.toLocaleString()}`,tone:"brand"})]})}),e.jsx(w,{title:"今月の実績",children:e.jsxs(Se,{children:[e.jsx(T,{label:"今月 注文数",value:`${t.currentMonthOrderCount.toLocaleString()} 件`,caption:`先月: ${t.lastMonthOrderCount.toLocaleString()} 件`,delta:{label:ue(t.orderCountRatio),direction:he(t.orderCountRatio)}}),e.jsx(T,{label:"今月 売上(税込)",value:`¥${t.currentMonthSalesAmount.toLocaleString()}`,caption:`先月: ¥${t.lastMonthSalesAmount.toLocaleString()}`,delta:{label:ue(t.salesAmountRatio),direction:he(t.salesAmountRatio)}})]})}),e.jsx(w,{title:"売上推移",children:x?e.jsx(q,{title:"売上推移グラフを表示できませんでした",children:e.jsx(X,{children:e.jsx(W,{width:"100%",aspect:u,children:e.jsxs(F,{data:t.salesHistory,children:[e.jsx(U,{strokeDasharray:"3 3",vertical:!1}),e.jsx(_,{dataKey:"month",fontSize:c.medium}),e.jsx(H,{width:64,ticks:D,domain:[0,D[D.length-1]],tickFormatter:a=>xe(a)}),e.jsx(Y,{...f,formatter:a=>me(a)}),e.jsx(Q,{verticalAlign:h,align:"right"}),e.jsx(R,{name:"売上",dataKey:"sales",fill:o.brand})]})})})}):e.jsx(I,{title:"今年の売上データはまだありません",description:"注文が発生すると、月別の売上推移がここに表示されます。",compact:!0})}),e.jsx(w,{title:"商品ランキング",children:v?e.jsxs(St,{children:[e.jsxs(we,{children:[e.jsx($e,{children:"売上 TOP 10"}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx(P,{children:"順位"}),e.jsx(P,{children:"商品名"}),e.jsx(P,{align:"right",children:"売上(税込)"})]})}),e.jsx("tbody",{children:[...t.productRankings??[]].sort((a,g)=>g.sales-a.sales).slice(0,10).map((a,g)=>e.jsxs("tr",{children:[e.jsx(L,{children:g+1}),e.jsx(L,{children:a.productName}),e.jsxs(L,{align:"right",children:["¥",a.sales.toLocaleString()]})]},a.productId))})]})]}),e.jsxs(we,{children:[e.jsx($e,{children:"注文数 TOP 10"}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx(P,{children:"順位"}),e.jsx(P,{children:"商品名"}),e.jsx(P,{align:"right",children:"注文数"})]})}),e.jsx("tbody",{children:[...t.productRankings??[]].sort((a,g)=>g.orders-a.orders).slice(0,10).map((a,g)=>e.jsxs("tr",{children:[e.jsx(L,{children:g+1}),e.jsx(L,{children:a.productName}),e.jsxs(L,{align:"right",children:[a.orders.toLocaleString()," 件"]})]},a.productId))})]})]})]}):e.jsx(I,{title:"ランキングを表示できるデータがありません",description:"販売実績が貯まると、売上・注文数の TOP10 がここに表示されます。",compact:!0})}),e.jsx(w,{title:"月次注文数",children:z?e.jsx(q,{title:"月次注文数グラフを表示できませんでした",children:e.jsx(X,{children:e.jsx(W,{width:"100%",aspect:u,children:e.jsxs(F,{data:t.monthlyOrdersChartData,children:[e.jsx(U,{strokeDasharray:"3 3",vertical:!1}),e.jsx(_,{dataKey:"month",fontSize:c.medium}),e.jsx(H,{}),e.jsx(Y,{...f}),e.jsx(Q,{verticalAlign:h,align:"right"}),e.jsx(R,{name:C,dataKey:"total",fill:o.brand}),B.map(a=>e.jsx(R,{name:a.name,dataKey:a.id,fill:a.color},a.id))]})})})}):e.jsx(I,{title:"月次注文数のデータはまだありません",description:"注文が発生すると、月別の注文数がここに表示されます。",compact:!0})}),e.jsx(w,{title:"月次売上",children:S?e.jsx(q,{title:"月次売上グラフを表示できませんでした",children:e.jsx(X,{children:e.jsx(W,{width:"100%",aspect:u,children:e.jsxs(F,{data:t.monthlySalesChartData,children:[e.jsx(U,{strokeDasharray:"3 3",vertical:!1}),e.jsx(_,{dataKey:"month",fontSize:c.medium}),e.jsx(H,{width:64,ticks:$,domain:[0,$[$.length-1]],tickFormatter:a=>xe(a)}),e.jsx(Y,{...f,formatter:a=>me(a)}),e.jsx(Q,{verticalAlign:h,align:"right"}),e.jsx(R,{name:C,dataKey:"total",fill:o.brand}),B.map(a=>e.jsx(R,{name:a.name,dataKey:a.id,fill:a.color},a.id))]})})})}):e.jsx(I,{title:"月次売上のデータはまだありません",description:"注文が発生すると、月別の売上がここに表示されます。",compact:!0})}),e.jsxs(w,{title:"CSV ダウンロード",children:[e.jsx(wt,{children:"集計データを SJIS の CSV 形式で書き出します。出力したい種類を選択してください。"}),e.jsxs($t,{children:[e.jsx(vt,{children:e.jsx(Be,{options:qe,value:t.csvKind,onChange:a=>t.onCsvKindChange(a),variant:"outlined"})}),e.jsx(Ct,{children:e.jsx(de,{variant:"fill",onClick:t.downloadCSV,children:"CSVダウンロード"})})]})]})]})})},rt=s.div`
2  display: flex;
3  flex-direction: column;
4  gap: 24px;
5`,nt=s.div`
6  display: flex;
7  flex-wrap: wrap;
8  gap: 12px;
9`,ge=s(De)`
10  display: flex;
11  flex: 1 1 240px;
12  gap: 12px;
13  align-items: baseline;
14  padding: 14px 16px;
15  color: ${o.textPrimary};
16  text-decoration: none;
17  background-color: #fff7e0;
18  border: 1px solid ${o.brand};
19  border-radius: 8px;
20  transition: 0.3s;
21
22  :hover {
23    opacity: 0.8;
24  }
25`,pe=s.span`
26  font-size: ${c.extraLarge};
27  font-weight: bold;
28  color: ${o.brandAccent};
29  white-space: nowrap;
30`,je=s.span`
31  font-size: ${c.medium};
32  font-weight: bold;
33`,be=s.span`
34  margin-left: auto;
35  font-size: ${c.small};
36  color: ${o.textSecondary};
37  white-space: nowrap;
38`,ot=s.div`
39  display: flex;
40  flex-direction: row;
41  gap: 24px;
42  width: 100%;
43
44  @media ${p.smartPhone} {
45    flex-direction: column;
46    align-items: center;
47    gap: 16px;
48  }
49`,at=s.div`
50  flex-shrink: 0;
51`,st=s.img`
52  width: 120px;
53  height: 120px;
54  border-radius: 50%;
55  object-fit: cover;
56  background-color: ${o.surfaceMuted};
57`,it=s.div`
58  width: 120px;
59  height: 120px;
60  border-radius: 50%;
61  background-color: ${o.surfaceMuted};
62`,lt=s.div`
63  display: flex;
64  flex-direction: column;
65  gap: 16px;
66  width: 100%;
67  min-width: 0;
68`,dt=s.div`
69  display: flex;
70  flex-direction: column;
71  gap: 6px;
72`,ct=s.p`
73  font-size: ${c.semiExtraLarge};
74  font-weight: bold;
75  color: ${o.textPrimary};
76`,ut=s.div`
77  display: flex;
78  flex-wrap: wrap;
79  align-items: center;
80  gap: 8px;
81`,ht=s.span`
82  font-size: ${c.small};
83  color: ${o.textMuted};
84`,mt=s.span`
85  display: inline-block;
86  padding: 2px 10px;
87  font-size: ${c.small};
88  font-weight: 600;
89  color: ${o.brandInk};
90  background-color: ${o.brand};
91  border-radius: 999px;
92`,xt=s.div`
93  display: flex;
94  justify-content: flex-start;
95  margin-top: 8px;
96`,ft=s.div`
97  width: 220px;
98
99  @media ${p.smartPhone} {
100    width: 100%;
101  }
102`,gt=s.dl`
103  display: grid;
104  grid-template-columns: repeat(2, minmax(0, 1fr));
105  gap: 12px 24px;
106  margin: 0;
107
108  @media ${p.smartPhone} {
109    grid-template-columns: 1fr;
110  }
111`,N=s.div`
112  display: flex;
113  flex-direction: column;
114  gap: 2px;
115  min-width: 0;
116`,ye=s(N)`
117  grid-column: 1 / -1;
118`,A=s.dt`
119  font-size: ${c.small};
120  color: ${o.textMuted};
121`,M=s.dd`
122  margin: 0;
123  font-size: ${c.semiLarge};
124  color: ${o.textPrimary};
125  word-break: break-word;
126`,pt=s.div`
127  display: grid;
128  grid-template-columns: repeat(4, minmax(0, 1fr));
129  gap: 12px;
130
131  @media ${p.tablet} {
132    grid-template-columns: repeat(2, minmax(0, 1fr));
133  }
134
135  @media ${p.smartPhone} {
136    grid-template-columns: 1fr;
137  }
138`,J=s.button`
139  position: relative;
140  display: flex;
141  flex-direction: column;
142  gap: 6px;
143  padding: 16px 18px;
144  text-align: left;
145  background-color: ${o.surfaceDefault};
146  border: 1px solid ${o.borderDefault};
147  border-radius: 8px;
148  cursor: pointer;
149  transition: border-color 150ms ease-out, background-color 150ms ease-out,
150    transform 150ms ease-out;
151
152  &:hover {
153    border-color: ${o.brand};
154    background-color: #fffaea;
155  }
156
157  /* PR-A11y-1: keyboard user 向け focus indicator (旧: outline:none で focus 不可視 だった) */
158  &:focus-visible {
159    border-color: ${o.brand};
160    background-color: #fffaea;
161    outline: 2px solid ${o.brand};
162    outline-offset: 2px;
163  }
164`,jt=s.span`
165  font-size: ${c.large};
166  font-weight: bold;
167  color: ${o.textPrimary};
168`,bt=s.span`
169  font-size: ${c.small};
170  color: ${o.textMuted};
171`,yt=s.span`
172  position: absolute;
173  top: 14px;
174  right: 16px;
175  font-size: ${c.semiLarge};
176  color: ${o.textMuted};
177
178  ${J}:hover &,
179  ${J}:focus-visible & {
180    color: ${o.brandInk};
181  }
182`,X=s.div`
183  position: relative;
184  overflow: hidden;
185`,Se=s.div`
186  display: grid;
187  grid-template-columns: repeat(3, minmax(0, 1fr));
188  gap: 12px;
189
190  @media ${p.phablet} {
191    grid-template-columns: repeat(2, minmax(0, 1fr));
192  }
193
194  @media ${p.smartPhone} {
195    grid-template-columns: 1fr;
196  }
197`,St=s.div`
198  display: grid;
199  grid-template-columns: repeat(2, minmax(0, 1fr));
200  gap: 16px;
201
202  @media ${p.phablet} {
203    grid-template-columns: 1fr;
204  }
205`,we=s.div`
206  display: flex;
207  flex-direction: column;
208  gap: 8px;
209`,$e=s.h4`
210  font-size: ${c.semiLarge};
211  font-weight: bold;
212  color: ${o.textPrimary};
213`,ve=s.table`
214  width: 100%;
215  border-collapse: collapse;
216`,P=s.th`
217  padding: 10px 12px;
218  font-size: ${c.small};
219  font-weight: bold;
220  text-align: ${t=>t.align??"left"};
221  color: ${o.textSecondary};
222  background-color: ${o.surfaceMuted};
223  border-bottom: 1px solid ${o.borderDefault};
224`,L=s.td`
225  padding: 10px 12px;
226  font-size: ${c.semiLarge};
227  text-align: ${t=>t.align??"left"};
228  color: ${o.textPrimary};
229  border-bottom: 1px solid ${o.borderDefault};
230`,wt=s.p`
231  font-size: ${c.small};
232  color: ${o.textMuted};
233`,$t=s.div`
234  display: flex;
235  gap: 12px;
236  align-items: center;
237
238  @media ${p.smartPhone} {
239    flex-direction: column;
240    align-items: stretch;
241  }
242`,vt=s.div`
243  width: 200px;
244
245  @media ${p.smartPhone} {
246    width: 100%;
247  }
248`,Ct=s.div`
249  width: 220px;
250
251  @media ${p.smartPhone} {
252    width: 100%;
253  }
254`,kt=async()=>{var u;const t=_e();await new Promise((h,f)=>He(t,h,f));const n=await((u=t.currentUser)==null?void 0:u.getIdToken(!0));if(!n)throw new Error("No token provided");return(await Re.post("https://www-api.tsuhan-tora.com/v1/user/show-vendor-dashboard-alerts",{},{headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json"}})).data},At=t=>Te({queryKey:["showVendorDashboardAlerts"],queryFn:kt,enabled:!0}),Ce=[o.info,o.brandAccent,o.accentCopper,o.accentTan,o.textMuted,o.brandBright,o.accentTanDark,o.surfaceInverse,o.brandAccent,o.accentOliveLight],E=Array.from({length:12},(t,n)=>n+1),Ft=()=>{var ne,oe,ae,se,ie;const{authenticated:t}=Ie(),n=new Date().getFullYear(),d=new Date().getMonth()+1,u=Ne({},{enabled:!!t}),h=Ue({year:n},{enabled:!!t}),f=Fe({productNameOrId:"",offset:0},{enabled:!!t}),[y,v]=m.useState("all"),x=((ne=h.data)==null?void 0:ne.monthlyTotals)??{},z=((oe=h.data)==null?void 0:oe.previousYearMonthlyTotals)??{},S=((ae=h.data)==null?void 0:ae.productSales)??[],D=m.useMemo(()=>
254{if(!h.data||!f.data)return;const r=Object.values(x);return{totalProducts:f.data.totalCount??0,totalOrders:r.reduce((i,l)=>i+(l.orderCount??0),0),totalSales:r.reduce((i,l)=>i+(l.ownerAmount??0),0)}},[h.data,f.data,x]),$=m.useMemo(()=>S.map(r=>({productId:r.userProductId,productName:r.productName,sales:r.annualOwnerTotal??0,orders:r.annualOrderCount??0})),[S]),K=m.useMemo(()=>S.map((r,i)=>({id:r.userProductId,name:r.productName,color:Ce[i%Ce.length]})),[S]),C=m.useMemo(()=>E.map(r=>{var i;return{month:`${r}月`,sales:((i=x[String(r)])==null?void 0:i.ownerAmount)??0}}),[x]),B=m.useMemo(()=>E.map(r=>{var j,b;const i=String(r),l={month:`${n}年${r.toString().padStart(2,"0")}月`,total:((j=x[i])==null?void 0:j.orderCount)??0};for(const O of S)l[O.userProductId]=((b=O.monthlySales[i])==null?void 0:b.orderCount)??0;return l}),[x,S,n]),a=m.useMemo(()=>E.map(r=>{var j,b;const i=String(r),l={month:`${n}年${r.toString().padStart(2,"0")}月`,total:((j=x[i])==null?void 0:j.ownerAmount)??0};for(const O of S)l[O.userProductId]=((b=O.monthlySales[i])==null?void 0:b.ownerAmount)??0;return l}),[x,S,n]),g=m.useMemo(()=>{const r=x[String(d)];return{orderCount:(r==null?void 0:r.orderCount)??0,totalAmount:(r==null?void 0:r.ownerAmount)??0}},[x,d]),k=m.useMemo(()=>{const r=d===1?z[12]:x[String(d-1)];return{orderCount:(r==null?void 0:r.orderCount)??0,totalAmount:(r==null?void 0:r.ownerAmount)??0}},[x,z,d]),Z=(r,i)=>{if(r===0&&i===0)return"0";if(r===0)return"-100";if(i===0)return"NA";const l=Math.round(r/i*100);return l>100?`+${l-100}`:l<100?`-${100-l}`:"0"},ke=m.useMemo(()=>Z(g.orderCount,k.orderCount),[g.orderCount,k.orderCount]),Ae=m.useMemo(()=>Z(g.totalAmount,k.totalAmount),[g.totalAmount,k.totalAmount]),V=(r,i)=>{const l=new Uint8Array(le.convert(le.stringToCode(r),{from:"UNICODE",to:"SJIS"})),j=document.createElement("a");j.href=URL.createObjectURL(new Blob([l],{type:"text/csv"})),j.download=i,j.click(),URL.revokeObjectURL(j.href),j.remove()},ee=m.useCallback(()=>{const r="年月,商品注文数,商品売上",i=E.map(l=>{const j=String(l),b=x[j];return[`${n}/${l.toString().padStart(2,"0")}`,(b==null?void 0:b.orderCount)??0,(b==null?void 0:b.ownerAmount)??0].join(",")});V([r,...i].join(`
255`),`${n}01_${n}12_商品売上.csv`)},[x,n]),te=m.useCallback(()=>{const r="月,売上",i=C.map(l=>`${l.month},${l.sales}`);V([r,...i].join(`
256`),`${n}_売上推移.csv`)},[C,n]),re=m.useCallback(()=>{const r="商品ID,商品名,注文数",i=$.map(l=>`${l.productId},${l.productName.replace(/,/g,"、")},${l.orders}`);V([r,...i].join(`
257`),`${n}_注文データ.csv`)},[$,n]),Me=m.useCallback(()=>{switch(y){case"all":ee();break;case"sales":te();break;case"orders":re();break}},[y,ee,te,re]),Pe=At();return m.useEffect(()=>{var r;if(!(u.isLoading||!((r=u.data)!=null&&r.user))&&!u.data.user.isFacilityProvider)throw new ze},[(se=u.data)==null?void 0:se.user,u.isLoading]),e.jsx(tt,{user:(ie=u.data)==null?void 0:ie.user,alerts:Pe.data,stats:D,productRankings:$,productSeries:K,salesHistory:C,monthlyOrdersChartData:B,monthlySalesChartData:a,currentMonthOrderCount:g.orderCount,lastMonthOrderCount:k.orderCount,orderCountRatio:ke,currentMonthSalesAmount:g.totalAmount,lastMonthSalesAmount:k.totalAmount,salesAmountRatio:Ae,csvKind:y,onCsvKindChange:v,downloadCSV:Me})};export{Ft as default};

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.