@topthink/components 1.2.3 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{jsx as t,Fragment as r}from"react/jsx-runtime";import{memo as e,useContext as i,useState as o,useEffect as s}from"react";import{I as a}from"./index-T-6KSxw4.js";import{useInView as m}from"react-intersection-observer";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"lodash";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"react-async-hook";import"styled-components";import"dayjs";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"goober";import"immer";var n=e(({lazy:e=!0,...n})=>{const{registerImage:p,setShow:c,setCurrent:l,getId:d}=i(a),[h,g]=o(),[u,w]=o(!1),{ref:f,inView:y}=m({threshold:.2,skip:!e,initialInView:!0}),[v]=o(d);if(s(()=>{if(n.src)return p(v,n.src)},[n.src]),u)return t(r,{children:n.alt?`[图片加载失败:${n.alt}]`:" "});const j=!y&&e&&h?"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3e %3crect width='1' height='1' fill='none'/%3e%3c/svg%3e":n.src;return t("img",{width:h?.[0],height:h?.[1],onLoad:t=>{!h&&e&&g([t.currentTarget.clientWidth,t.currentTarget.clientHeight])},onError:()=>{w(!0)},ref:f,...n,alt:void 0,src:j,onClick:()=>{l(v),c(!0)}})});export{n as default};
1
+ import{jsx as t,Fragment as r}from"react/jsx-runtime";import{memo as e,useContext as i,useState as o,useEffect as s}from"react";import{I as a}from"./index-nB_cgu7W.js";import{useInView as m}from"react-intersection-observer";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"lodash";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"react-async-hook";import"styled-components";import"dayjs";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"goober";import"immer";var n=e(({lazy:e=!0,...n})=>{const{registerImage:p,setShow:c,setCurrent:l,getId:d}=i(a),[h,g]=o(),[u,w]=o(!1),{ref:f,inView:y}=m({threshold:.2,skip:!e,initialInView:!0}),[v]=o(d);if(s(()=>{if(n.src)return p(v,n.src)},[n.src]),u)return t(r,{children:n.alt?`[图片加载失败:${n.alt}]`:" "});const j=!y&&e&&h?"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3e %3crect width='1' height='1' fill='none'/%3e%3c/svg%3e":n.src;return t("img",{width:h?.[0],height:h?.[1],onLoad:t=>{!h&&e&&g([t.currentTarget.clientWidth,t.currentTarget.clientHeight])},onError:()=>{w(!0)},ref:f,...n,alt:void 0,src:j,onClick:()=>{l(v),c(!0)}})});export{n as default};
@@ -1,4 +1,4 @@
1
- import{jsxs as t,jsx as r}from"react/jsx-runtime";import{useState as o,useCallback as e}from"react";import i,{useLightboxState as n,useController as a}from"yet-another-react-lightbox";import s from"yet-another-react-lightbox/plugins/counter";import l from"yet-another-react-lightbox/plugins/download";import m from"yet-another-react-lightbox/plugins/zoom";import p from"yet-another-react-lightbox/plugins/thumbnails";import"yet-another-react-lightbox/styles.css";import"yet-another-react-lightbox/plugins/counter.css";import"yet-another-react-lightbox/plugins/thumbnails.css";import{I as c}from"./index-T-6KSxw4.js";import u from"styled-components";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"lodash";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"react-async-hook";import"dayjs";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"goober";import"immer";import"react-intersection-observer";const d={counter:s,zoom:m,download:l,thumbnails:p};let g=0;function h({children:i,render:s,zoom:l,toolbar:m,plugins:p=["counter","zoom","download"]}){const[u,h]=o(()=>new Map),[y,x]=o(),[f,w]=o(!1),_=e((t,r)=>(h(o=>new Map(o).set(t,r)),()=>{h(r=>{const o=new Map(r);return o.delete(t)?o:r})}),[]),j=Array.from(u.keys()),k=j.indexOf(y),v=j.map(t=>{const r=u.get(t);return"string"==typeof r?{src:r}:{render:r}}),z=e(()=>g++,[]);return t(c.Provider,{value:{images:u,current:y,setCurrent:x,setShow:w,registerImage:_,getId:z},children:[i,r(b,{plugins:p.map(t=>d[t]),open:f,index:k,close:()=>w(!1),slides:v,carousel:{finite:!0,preload:3},toolbar:m?.({useController:a,useLightboxState:n}),zoom:l,render:{...s,buttonPrev:v.length<=1?()=>null:void 0,buttonNext:v.length<=1?()=>null:void 0,slide:({slide:t})=>{if("render"in t)return t.render()}},controller:{closeOnBackdropClick:!0}})]})}const b=u(i)`
1
+ import{jsxs as t,jsx as r}from"react/jsx-runtime";import{useState as o,useCallback as e}from"react";import i,{useLightboxState as n,useController as a}from"yet-another-react-lightbox";import s from"yet-another-react-lightbox/plugins/counter";import l from"yet-another-react-lightbox/plugins/download";import m from"yet-another-react-lightbox/plugins/zoom";import p from"yet-another-react-lightbox/plugins/thumbnails";import"yet-another-react-lightbox/styles.css";import"yet-another-react-lightbox/plugins/counter.css";import"yet-another-react-lightbox/plugins/thumbnails.css";import{I as c}from"./index-nB_cgu7W.js";import u from"styled-components";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"lodash";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"react-async-hook";import"dayjs";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"goober";import"immer";import"react-intersection-observer";const d={counter:s,zoom:m,download:l,thumbnails:p};let g=0;function h({children:i,render:s,zoom:l,toolbar:m,plugins:p=["counter","zoom","download"]}){const[u,h]=o(()=>new Map),[y,x]=o(),[f,w]=o(!1),_=e((t,r)=>(h(o=>new Map(o).set(t,r)),()=>{h(r=>{const o=new Map(r);return o.delete(t)?o:r})}),[]),j=Array.from(u.keys()),k=j.indexOf(y),v=j.map(t=>{const r=u.get(t);return"string"==typeof r?{src:r}:{render:r}}),z=e(()=>g++,[]);return t(c.Provider,{value:{images:u,current:y,setCurrent:x,setShow:w,registerImage:_,getId:z},children:[i,r(b,{plugins:p.map(t=>d[t]),open:f,index:k,close:()=>w(!1),slides:v,carousel:{finite:!0,preload:3},toolbar:m?.({useController:a,useLightboxState:n}),zoom:l,render:{...s,buttonPrev:v.length<=1?()=>null:void 0,buttonNext:v.length<=1?()=>null:void 0,slide:({slide:t})=>{if("render"in t)return t.render()}},controller:{closeOnBackdropClick:!0}})]})}const b=u(i)`
2
2
  --yarl__color_backdrop: rgba(0, 0, 0, .7);
3
3
  --yarl__thumbnails_container_background_color: rgba(0, 0, 0, .9);
4
4
  `;export{h as default};
@@ -1,4 +1,4 @@
1
- import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import n from"rc-table";import{unstable_batchedUpdates as o}from"react-dom";import{FormControl as a,Table as i}from"react-bootstrap";import{useUrlSearchParams as c}from"use-url-search-params";import{isEqual as l,omit as s}from"lodash";import*as d from"react";import{useState as p,useCallback as u,useRef as m,useEffect as h,useMemo as f,memo as g,forwardRef as y,useImperativeHandle as v}from"react";import{B as b,u as x,a as w,b as j,r as C,i as k,N as S,L as E,T as z,C as V,S as N,P as O}from"./index-T-6KSxw4.js";import M from"styled-components";import H from"./index-DWyjVOOg.js";import q from"dayjs";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"react-async-hook";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"copy-to-clipboard";import"goober";import"immer";import"react-intersection-observer";import"@topthink/json-form";const K=function({indeterminate:t=!1,...r}){const n=m(null);return h(()=>{n.current&&(n.current.indeterminate=t)},[t]),e("input",{ref:n,...r,className:"form-check-input",type:"checkbox"})};var B;function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},D.apply(null,arguments)}const P=e=>d.createElement("svg",D({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 1024 1024"},e),B||(B=d.createElement("path",{d:"M252.069 906.496h520.283c89.582 0 134.144-44.562 134.144-132.846V250.331c0-88.283-44.562-132.845-134.144-132.845H252.069c-89.143 0-134.583 44.141-134.583 132.845V773.67c0 88.704 45.44 132.845 134.583 132.845zm1.28-68.992c-42.844 0-66.853-22.71-66.853-67.291V253.806c0-44.58 24.01-67.292 66.853-67.292h517.723c42.423 0 66.432 22.711 66.432 67.292v516.388c0 44.58-24.01 67.292-66.432 67.292zM511.78 714.496c22.71 0 36.425-15.854 36.425-40.704V547.365H682.35c24.009 0 40.722-12.874 40.722-35.584 0-23.132-15.854-36.426-40.722-36.426H548.206V340.773c0-24.85-13.715-40.704-36.425-40.704s-35.566 16.713-35.566 40.722v134.583H342.49c-24.85 0-41.142 13.275-41.142 36.407 0 22.71 17.152 35.584 41.142 35.584h133.724v126.427c0 23.99 12.855 40.704 35.566 40.704"})));var T;function Y(){return Y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Y.apply(null,arguments)}const F=e=>d.createElement("svg",Y({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 1024 1024"},e),T||(T=d.createElement("path",{d:"M252.069 906.496h520.283c89.582 0 134.144-44.562 134.144-132.846V250.331c0-88.283-44.562-132.845-134.144-132.845H252.069c-89.143 0-134.583 44.141-134.583 132.845V773.67c0 88.704 45.44 132.845 134.583 132.845zm1.28-68.992c-42.844 0-66.853-22.71-66.853-67.291V253.806c0-44.58 24.01-67.292 66.853-67.292h517.723c42.423 0 66.432 22.711 66.432 67.292v516.388c0 44.58-24.01 67.292-66.432 67.292zm86.582-289.719h344.576c23.991 0 40.704-12.855 40.704-35.566 0-23.15-15.433-36.425-40.704-36.425H339.931c-24.868 0-40.722 13.276-40.722 36.425 0 22.711 16.713 35.566 40.722 35.566"})));function I({data:r,options:n,columns:o,onSearch:a}){const[i,c]=p(0),[s,d]=p(r);h(()=>{l(r,s)||(d(r),c(e=>e+1))},[r]);const[m,g,y]=f(()=>{const e={"ui:col":10,"ui:order":n.order},t={},r={};n.fields.forEach(a=>{const i=o.find(e=>e.dataIndex===a);if(i){const o=i.title;if("string"==typeof o){if(e[a]={"ui:col":4,"ui:labelCol":3,"ui:placeholder":"请输入",...n.ui?.[a]},i.valueEnum){const t=i.valueEnum;return e[a]["ui:placeholder"]="请选择",r[a]={title:o,type:"string",enum:Object.keys(t).flatMap(e=>"string"==typeof t[e].text?[e]:[]),enumNames:Object.keys(t).flatMap(e=>{const r=t[e].text;return"string"==typeof r?[r]:[]})}}t[a]=void 0,r[a]={title:o,type:"string"}}}}),n.extraFields&&Object.entries(n.extraFields).forEach(([o,a])=>{e[o]={"ui:col":4,"ui:labelCol":3,"ui:placeholder":"请输入",...n.ui?.[o]},t[o]=void 0,r[o]={title:a,type:"string"}});return[{type:"object",properties:r},e,t]},[n.fields,n.extraFields]),v=u(({formData:e})=>{d(e),a({...y,...e})},[a,y]),x=u(()=>{a(y)},[a,y]);return e(R,{children:e(H,{formContext:{layout:"horizontal"},schema:m,uiSchema:g,onSubmit:v,formData:s,children:e("div",{className:"col-12 col-md-2 ms-auto mt-md-auto",children:t("div",{className:"justify-content-end d-flex gap-2 ",children:[e(b,{className:"px-4",onClick:x,variant:"secondary",children:"重置"}),e(b,{className:"px-4",type:"submit",variant:"primary",children:"查询"})]})})})},i)}const R=M.div`
1
+ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import n from"rc-table";import{unstable_batchedUpdates as o}from"react-dom";import{FormControl as a,Table as i}from"react-bootstrap";import{useUrlSearchParams as c}from"use-url-search-params";import{isEqual as l,omit as s}from"lodash";import*as d from"react";import{useState as p,useCallback as u,useRef as m,useEffect as h,useMemo as f,memo as g,forwardRef as y,useImperativeHandle as v}from"react";import{B as b,u as x,a as w,b as j,r as C,i as k,N as S,L as E,T as z,C as V,S as N,P as O}from"./index-nB_cgu7W.js";import M from"styled-components";import H from"./index-yzGgzzcg.js";import q from"dayjs";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"react-async-hook";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"copy-to-clipboard";import"goober";import"immer";import"react-intersection-observer";import"@topthink/json-form";const K=function({indeterminate:t=!1,...r}){const n=m(null);return h(()=>{n.current&&(n.current.indeterminate=t)},[t]),e("input",{ref:n,...r,className:"form-check-input",type:"checkbox"})};var B;function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},D.apply(null,arguments)}const P=e=>d.createElement("svg",D({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 1024 1024"},e),B||(B=d.createElement("path",{d:"M252.069 906.496h520.283c89.582 0 134.144-44.562 134.144-132.846V250.331c0-88.283-44.562-132.845-134.144-132.845H252.069c-89.143 0-134.583 44.141-134.583 132.845V773.67c0 88.704 45.44 132.845 134.583 132.845zm1.28-68.992c-42.844 0-66.853-22.71-66.853-67.291V253.806c0-44.58 24.01-67.292 66.853-67.292h517.723c42.423 0 66.432 22.711 66.432 67.292v516.388c0 44.58-24.01 67.292-66.432 67.292zM511.78 714.496c22.71 0 36.425-15.854 36.425-40.704V547.365H682.35c24.009 0 40.722-12.874 40.722-35.584 0-23.132-15.854-36.426-40.722-36.426H548.206V340.773c0-24.85-13.715-40.704-36.425-40.704s-35.566 16.713-35.566 40.722v134.583H342.49c-24.85 0-41.142 13.275-41.142 36.407 0 22.71 17.152 35.584 41.142 35.584h133.724v126.427c0 23.99 12.855 40.704 35.566 40.704"})));var T;function Y(){return Y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Y.apply(null,arguments)}const F=e=>d.createElement("svg",Y({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 1024 1024"},e),T||(T=d.createElement("path",{d:"M252.069 906.496h520.283c89.582 0 134.144-44.562 134.144-132.846V250.331c0-88.283-44.562-132.845-134.144-132.845H252.069c-89.143 0-134.583 44.141-134.583 132.845V773.67c0 88.704 45.44 132.845 134.583 132.845zm1.28-68.992c-42.844 0-66.853-22.71-66.853-67.291V253.806c0-44.58 24.01-67.292 66.853-67.292h517.723c42.423 0 66.432 22.711 66.432 67.292v516.388c0 44.58-24.01 67.292-66.432 67.292zm86.582-289.719h344.576c23.991 0 40.704-12.855 40.704-35.566 0-23.15-15.433-36.425-40.704-36.425H339.931c-24.868 0-40.722 13.276-40.722 36.425 0 22.711 16.713 35.566 40.722 35.566"})));function I({data:r,options:n,columns:o,onSearch:a}){const[i,c]=p(0),[s,d]=p(r);h(()=>{l(r,s)||(d(r),c(e=>e+1))},[r]);const[m,g,y]=f(()=>{const e={"ui:col":10,"ui:order":n.order},t={},r={};n.fields.forEach(a=>{const i=o.find(e=>e.dataIndex===a);if(i){const o=i.title;if("string"==typeof o){if(e[a]={"ui:col":4,"ui:labelCol":3,"ui:placeholder":"请输入",...n.ui?.[a]},i.valueEnum){const t=i.valueEnum;return e[a]["ui:placeholder"]="请选择",r[a]={title:o,type:"string",enum:Object.keys(t).flatMap(e=>"string"==typeof t[e].text?[e]:[]),enumNames:Object.keys(t).flatMap(e=>{const r=t[e].text;return"string"==typeof r?[r]:[]})}}t[a]=void 0,r[a]={title:o,type:"string"}}}}),n.extraFields&&Object.entries(n.extraFields).forEach(([o,a])=>{e[o]={"ui:col":4,"ui:labelCol":3,"ui:placeholder":"请输入",...n.ui?.[o]},t[o]=void 0,r[o]={title:a,type:"string"}});return[{type:"object",properties:r},e,t]},[n.fields,n.extraFields]),v=u(({formData:e})=>{d(e),a({...y,...e})},[a,y]),x=u(()=>{a(y)},[a,y]);return e(R,{children:e(H,{formContext:{layout:"horizontal"},schema:m,uiSchema:g,onSubmit:v,formData:s,children:e("div",{className:"col-12 col-md-2 ms-auto mt-md-auto",children:t("div",{className:"justify-content-end d-flex gap-2 ",children:[e(b,{className:"px-4",onClick:x,variant:"secondary",children:"重置"}),e(b,{className:"px-4",type:"submit",variant:"primary",children:"查询"})]})})})},i)}const R=M.div`
2
2
  margin-bottom: 1rem;
3
3
  `;function _({keyword:t,onKeywordChange:r}){const[n,o]=p(t),i=x(r,500);h(()=>{o(t)},[t]);const c=u(e=>{o(e.target.value),i(e.target.value)},[i,o]);return e(a,{value:n,onChange:c,type:"search",placeholder:"Search..."})}const A=M.thead`
4
4
  th {
@@ -0,0 +1,78 @@
1
+ import e from"sweetalert2/dist/sweetalert2.js";import t from"sweetalert2-react-content";import{jsx as n,jsxs as r,Fragment as a}from"react/jsx-runtime";import{useRef as o,useState as i,useEffect as s,createContext as c,useContext as l,useCallback as d,useMemo as u,Fragment as h,forwardRef as m,lazy as f,Suspense as p,memo as g,Children as y,createElement as w,useImperativeHandle as v}from"react";import{OverlayTrigger as b,Tooltip as x,Spinner as k,Button as C,Modal as N,ButtonGroup as S,ToggleButton as z,Card as P,Accordion as j,Stack as T,Alert as D,Pagination as R,Offcanvas as $,Row as E,Col as H}from"react-bootstrap";import{uniqueId as L,values as B,omit as _,debounce as M}from"lodash";import O,{AxiosHeaders as I}from"axios";import F from"query-string";import*as U from"retry-axios";import{enqueueSnackbar as W,SnackbarProvider as q}from"notistack";import A from"path";import{useAsyncCallback as G}from"react-async-hook";import K,{css as V,createGlobalStyle as Y}from"styled-components";import Q from"dayjs";import"dayjs/locale/zh-cn";import J from"dayjs/plugin/relativeTime";import X from"dayjs/plugin/duration";import Z from"classnames";import{useUrlSearchParams as ee}from"use-url-search-params";import te from"copy-to-clipboard";import*as ne from"goober";import{freeze as re,produce as ae}from"immer";import"react-intersection-observer";const oe=()=>{document.body.style.setProperty("--vh",window.innerHeight/100+"px"),document.body.style.setProperty("--100vh",window.innerHeight+"px")};window.addEventListener("resize",oe),oe();const ie=t(e),se={confirmButtonText:"确定",cancelButtonText:"取消"},ce={confirm:async e=>{const{isConfirmed:t}=await ie.fire({...se,icon:"warning",showCancelButton:!0,...e,async preConfirm(t){if(e.preConfirm)try{return await e.preConfirm(t)}catch(e){return e instanceof Error&&ie.showValidationMessage(e.message),!1}return!0}});return t},success:e=>{ie.fire({...se,toast:!0,position:"top",icon:"success",timer:2e3,showConfirmButton:!1,...e})},error:e=>{ie.fire({...se,toast:!0,position:"top",icon:"error",timer:5e3,showConfirmButton:!1,...e})},close:e=>{ie.close(e)},defaults:se};const le=c({});function de(e){return({resolve:t,destroy:r,message:a})=>{const[c,h]=function(e){const t=o(null),[n,r]=i(e);return s(()=>{t.current&&(t.current(),t.current=null)},[n]),[n,(e,n)=>{t.current="function"==typeof n?n:null,r(e)}]}(!0),m=l(le),f=d(e=>{h(!1,()=>{t(e)})},[h,t]),p=u(()=>({show:c,onHide:()=>f(),onExited:()=>r(),container:m.container}),[c,f,r]);return n(e,{resolve:f,state:p,message:a})}}function ue(e){return t=>new Promise(r=>{const a=n(e,{resolve:r,destroy:()=>{pe(a)},message:t});fe(a)})}let he=()=>{},me=new Set;const fe=e=>{me=new Set(me),me.add(e),he(me)},pe=e=>{me=new Set(me),me.delete(e),he(me)};function ge(e,t){return ue(de(e))(t)}function ye({tooltip:e,children:t,placement:r="bottom"}){return n(b,{placement:r,overlay:n(x,{id:L(),children:e}),children:t})}const we=c(!1),ve=m(({loading:e,percent:t,disabled:o,children:i,tooltip:s,variant:c,...d},u)=>{l(we)&&!c&&(c="link"),e&&(o=!0,i=r(a,{children:[n(k,{ref:u,as:"span",size:"sm",role:"status","aria-hidden":"true",animation:"border"}),t?r("span",{className:"ms-2",children:[t,"%"]}):null]}));const h=n(C,{ref:u,...d,variant:c,disabled:o,children:i});return s?n(ye,{tooltip:s,children:n("span",{className:"d-inline-block",children:h})}):h}),be=function({state:e,message:{title:t,message:a,okText:o,cancelText:i},resolve:s}){return r(N,{...e,children:[n(N.Header,{children:n(N.Title,{as:"h5",children:t||"确认"})}),n(N.Body,{children:a}),r(N.Footer,{children:[n(ve,{variant:"secondary",onClick:()=>s(),children:i||"取消"}),n(ve,{onClick:()=>s(!0),children:o||"确定"})]})]})};const xe=f(()=>import("./index-yzGgzzcg.js")),ke=m((e,t)=>n(p,{fallback:null,children:n(xe,{...e,ref:t})})),Ce=function({state:e,resolve:t,message:{title:a,size:i,layout:s,...c}}){const l=o(null);return r(N,{...e,size:i,backdrop:"static",children:[n(N.Header,{children:n(N.Title,{as:"h5",children:a})}),n(N.Body,{children:n(ke,{ref:l,...c,formContext:{layout:s},onSubmit:({formData:e})=>{t(e)},children:n(h,{})})}),r(N.Footer,{children:[n(ve,{variant:"secondary",onClick:()=>t(),children:"取消"}),n(ve,{onClick:()=>{l.current?.submit().catch(()=>{})},children:"确定"})]})]})};const Ne=({header:e,children:t,footer:o,closable:s=!0,show:c,cancelText:l="取消",okText:d="确定",onOk:h,onCancel:m,onHide:f,okButtonProps:p,bodyAs:g,headerAs:y="h5",confirmLoading:w=!1,...v})=>{const[b,x]=i(!1),k=u(()=>n(ve,{loading:b||w,variant:"primary",onClick:async e=>{x(!0);try{await(h?.(e)),e.defaultPrevented||f?.()}finally{x(!1)}},...p,children:d}),[p,d,h,f,b,w]),C=u(()=>n(ve,{variant:"secondary",onClick:e=>{m?.(e),e.defaultPrevented||f?.()},children:l}),[m,f,l]),S={close:()=>{f?.()}};switch(typeof o){case"undefined":o=r(a,{children:[C,k]});break;case"function":o=o({okButton:k,cancelButton:C,action:S})}return r(N,{...v,onHide:f,show:c,children:[e&&n(N.Header,{closeButton:s,children:n(N.Title,{as:y,children:e})}),n(N.Body,{as:g,children:t}),o&&n(N.Footer,{children:o})]})};Ne.Message=function(e){const[t,r]=i(me);return s(()=>{he=r},[]),n(le.Provider,{value:e,children:Array.from(t).map((e,t)=>n(h,{children:e},`message-${t}`))})},Ne.confirm=function(e){return ue(de(be))(e)},Ne.prompt=function(e){return ue(de(g(Ce)))(e)},Ne.show=ge;const Se=["default","error","warning","success","info"].reduce((e,t)=>(e[t]=(e,n)=>W(e,{variant:t,autoHideDuration:3e3,anchorOrigin:{vertical:"top",horizontal:"center"},...n}),e),{});function ze(e){return e&&"object"==typeof e}U.attach(),O.defaults.raxConfig={retryDelay:2e3,backoffType:"static",shouldRetry:({config:e,response:t})=>!(e?.raxConfig?.retryDecider&&!e.raxConfig.retryDecider())&&("GET"===e?.method?.toUpperCase()&&449===t?.status)},O.defaults.maxContentLength=1/0,O.defaults.maxBodyLength=1/0,O.defaults.baseURL="/api",O.defaults.authTokenName="authorization";const Pe=O.isAxiosError,je=O.isCancel,Te=e=>{if(!O.isAxiosError(e))throw e;Se.error(e.message)},De=function(e){e?.baseURL&&(e.baseURL=A.resolve(O.defaults.baseURL||"/",e.baseURL));const t=O.create(e);return U.attach(t),t.interceptors.request.use(e=>{const t=e.authTokenName;if(t){const n=localStorage.getItem(t);n&&e.headers.set("Authorization",`Bearer ${n}`)}return e},e=>Promise.reject(e)),t.interceptors.response.use(e=>(201===e.status&&e.data.location&&(window.location.href=e.data.location,e.data=void 0),e),e=>{if(O.isAxiosError(e)&&e.response){const{data:t,status:n}=e.response;401===n?e.errors="Unauthorized":ze(t)?422===n?e.errors=t:"message"in t&&(e.errors=t.message):e.errors=t,"string"!=typeof e.errors?e.message=Object.values(e.errors).join("<br />"):e.message=e.errors}return Promise.reject(e)}),t},Re=async function(e,t){if(t||(t=De()),e="string"==typeof e?{url:e}:e,(e={paramsSerializer:function(e){return F.stringify(e,{sort:!1,skipNull:!0,skipEmptyString:!0,arrayFormat:"bracket"})},...e}).onMessage){const n=e.onMessage,r=e.onDownloadProgress,a=!1!==e.sseAutoReconnect,o=e.sseRetryConfig,i=o?.retry??e.sseMaxReconnects??1/0,s=e.sseRetryOnIncomplete??!1,c=e.sseDoneToken??"[DONE]",l=o?.backoffType??"static",d="GET"===(e.method??"get").toUpperCase();let u=o?.retryDelay??e.sseReconnectDelay??3e3,h=0,m="";const f=()=>{if(e.cancelToken?.throwIfRequested?.(),e.signal?.aborted)throw new O.CanceledError("Request aborted")},p=async t=>{await new Promise((n,r)=>{const a=window.setTimeout(()=>{e.signal?.removeEventListener?.("abort",o),n()},Math.max(t,0)),o=()=>{window.clearTimeout(a),r(new O.CanceledError("Request aborted"))};e.signal&&e.signal.addEventListener?.("abort",o,{once:!0})})},g=e=>{switch(l){case"linear":return u*e;case"exponential":return u*2**(e-1);default:return u}},y=e=>{const t={attempt:h+1,...e};return(o?.shouldRetry?.(t)??(a&&d&&e.hasReceivedData))&&h<i};for(;;){f();let a=0,o="",i=null,l=!1,d=!1,w=!1,v=!1,b=!1;const x=()=>{i||(i={id:"",event:"",data:""},l=!1)},k=()=>{i&&("number"==typeof i.retry&&(u=i.retry),l&&(m=i.id),i.data.endsWith("\n")&&(i.data=i.data.slice(0,-1)),i.data===c&&(d=!0),n(i),i=null,l=!1)},C=e=>{if(""===e)return void k();if(e.startsWith(":"))return;const t=e.indexOf(":"),n=-1===t?e:e.slice(0,t);let r=-1===t?"":e.slice(t+1);switch(r.startsWith(" ")&&(r=r.slice(1)),x(),n){case"data":w=!0,i.data+=`${r}\n`;break;case"event":i.event=r;break;case"id":r.includes("\0")||(i.id=r,l=!0);break;case"retry":/^\d+$/.test(r)&&(i.retry=Number(r))}},N=new I;(e.headers instanceof I||e.headers)&&N.set(e.headers),m?N.set("Last-Event-ID",m):N.delete("Last-Event-ID");try{const{data:n}=await t.request({...e,headers:N,onDownloadProgress:e=>{const t=e.event?.target;if(!t)return void r?.(e);if(!b){const e=t.getResponseHeader("content-type")||"";v=/text\/event-stream/i.test(e),b=!0}if(!v)return void r?.(e);const{responseText:n}=t,i=n.slice(a);a=n.length;for(const e of i)"\r"!==e&&("\n"===e?(C(o),o=""):o+=e);r?.(e)}});if(!s||d)return n;if(!y({hasDone:d,closedWithoutDone:!0,hasReceivedData:w}))return n}catch(e){if(O.isCancel(e))throw e;if(!y({error:e,hasDone:d,closedWithoutDone:!1,hasReceivedData:w}))throw e}h+=1,await p(g(h))}}const{data:n}=await t.request(e);return n};Re.create=function(e){const t=De(e),n=e=>Re(e,t);return n.interceptors=t.interceptors,n},Re.defaults=O.defaults,Re.interceptors=O.interceptors;function $e(e){const t=(()=>{const e=o(!1);return s(()=>(e.current=!1,()=>{e.current=!0}),[]),e})(),[n,r]=i(e);return[n,d(e=>{t.current||r(e)},[])]}function Ee(e,t={}){const{locale:n="zh-CN",currency:r=!0,...a}=t;let o;o=r?{style:"currency",currency:"CNY"}:{minimumFractionDigits:2};return new Intl.NumberFormat(n,{...o,...a}).format(e)}function He(e,{manual:t,refreshDeps:n,...r}={}){let{execute:a,currentParams:o,error:i,...c}=G(async t=>(e="string"==typeof e?{url:e}:e,await Re({...e,...t})),r);s(()=>{if(!t&&!n)try{a()}catch{}},[]),s(()=>{n&&l()},n);const l=d(async()=>{try{o?await a(...o):await a()}catch{}},[a,o]);if(i&&Pe(i)){const e=i.errors;i=new Error("string"==typeof e?e:B(e).join(""))}return{refresh:l,execute:a,error:i,...c}}function Le({active:e,inverted:t,...r}){return n(Be,{$active:e,$inverted:t,...r})}K.div`
2
+ position: relative;
3
+ `;const Be=K.div`
4
+ display: ${e=>e.$active?"flex":"none"};
5
+ position: absolute;
6
+ top: 0 !important;
7
+ left: 0 !important;
8
+ width: 100%;
9
+ height: 100%;
10
+ text-align: center;
11
+ vertical-align: middle;
12
+ padding: 1em;
13
+ background-color: ${e=>e.$inverted?"rgba(255, 255, 255, .85)":"rgba(0, 0, 0, .85)"};
14
+ opacity: ${e=>e.$active?1:0};
15
+ line-height: 1;
16
+ animation-fill-mode: both;
17
+ animation-duration: .5s;
18
+ transition: background-color .5s linear;
19
+ flex-direction: column;
20
+ align-items: center;
21
+ justify-content: center;
22
+ user-select: none;
23
+ will-change: opacity;
24
+ z-index: 990;
25
+ `;function _e({loading:e=!0,children:t,variant:a="primary",animation:o="border",wrap:i,...s}){return e?(t&&(t=n("p",{className:"mt-3 text-secondary",children:t})),t=r(Le,{inverted:!0,active:!0,children:[n(k,{animation:o,variant:a,...s}),t]}),i?n(Me,{$height:"number"==typeof i?i:150,children:t}):t):null}const Me=K.div`
26
+ position: relative;
27
+ height: ${e=>`${e.$height}px`};
28
+ `,Oe=f(async()=>{const{QRCodeSVG:e}=await import("qrcode.react");return{default:e}});function Ie(e){return n(p,{fallback:null,children:n(Oe,{...e})})}const Fe=function({state:e,message:t,resolve:r}){const a=o(!0),{result:i,checkUrl:c,onComplete:l}=t,[d,u]=$e(!1);return s(()=>{Re({url:c,method:"post",data:{order_no:i.order_no},raxConfig:{shouldRetry:e=>a.current&&449===e.response?.status}}).then(()=>{l?.(),r()}).catch(()=>null)},[]),n(Ne,{...e,centered:!0,onHide:()=>{a.current=!1,e.onHide()},backdrop:"static",header:"支付结果",okText:"已完成支付",okButtonProps:{loading:d},onOk:async e=>{e.preventDefault();try{u(!0),await Re({url:c,method:"post",data:{order_no:i.order_no,force:!0},raxConfig:{shouldRetry:()=>!1}}),l?.(),r()}catch(e){Pe(e)&&Se.error(e.message)}finally{u(!1)}},cancelText:"取消",children:"请在新打开的页面上进行支付,支付完成后再关闭此窗口"})},Ue=function({state:e,message:t,resolve:a}){const i=o(!0),{result:{pay_options:c,order_no:l},checkUrl:d,onComplete:u}=t,[h,m]=$e(c.channels.alipay?"alipay":"wechat"),[f,p]=$e(!1);s(()=>{Re({url:d,method:"post",data:{order_no:l},raxConfig:{shouldRetry:e=>i.current&&449===e.response?.status}}).then(()=>{u?.(),a()}).catch(()=>null)},[]);const{loading:g,result:y}=He({url:c.url,method:"POST",data:{channel:h,order_no:l}},{refreshDeps:[h]});return r(Ne,{...e,onHide:()=>{i.current=!1,e.onHide()},centered:!0,backdrop:"static",header:"收银台",okText:"已完成支付",okButtonProps:{loading:f},onOk:async e=>{e.preventDefault();try{p(!0),await Re({url:d,method:"post",data:{order_no:l,force:{channel:h}},raxConfig:{shouldRetry:()=>!1}}),u?.(),a()}catch(e){Pe(e)&&Se.error(e.message)}finally{p(!1)}},cancelText:"取消",children:[r("dl",{className:"row",children:[n("dt",{className:"col-3",children:"商品名称"}),n("dd",{className:"col-9",children:c.subject})]}),r("dl",{className:"row",children:[n("dt",{className:"col-3",children:"支付金额"}),n("dd",{className:"col-9 text-success h3",children:Ee(c.amount/100)})]}),r("dl",{className:"row",children:[n("dt",{className:"col-3",children:"支付方式"}),n("dd",{className:"col-9",children:r(S,{children:[c.channels.alipay&&n(z,{id:"payment-alipay",type:"radio",variant:"alipay"===h?"primary":"outline-primary",name:"alipay",value:"alipay",checked:"alipay"===h,onChange:()=>m("alipay"),children:"支付宝"}),c.channels.alipay&&n(z,{id:"payment-wechat",type:"radio",variant:"wechat"===h?"primary":"outline-primary",name:"wechat",value:"wechat",checked:"wechat"===h,onChange:()=>m("wechat"),children:"微信支付"})]})})]}),r("dl",{className:"row mb-0",children:[n("dt",{className:"col-3",children:"扫码支付"}),r("dd",{className:"col-9",children:[n(_e,{loading:g,wrap:200}),y&&n(Ie,{size:200,value:y.data})]})]})]})};function We(e){const{result:t}=e;t.pay_url?(window.opener=null,window.innerWidth<992?location.href=t.pay_url:(window.open(t.pay_url),ge(Fe,e))):ge(Ue,e)}function qe(e,t=2){const n=["","K","M","G"];let r=0;for(;e>=1024&&r<n.length-1;)e/=1024,r++;return e%1==0&&(t=0),e.toFixed(t)+n[r]}function Ae(e,t=2){const n=["","K","M","G"];let r=0;for(;e>=1e3&&r<n.length-1;)e/=1e3,r++;return e%1==0&&(t=0),e.toFixed(t)+n[r]}function Ge(e){const t=A.extname(e);return!(!/^data:image\//.test(e)&&!/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i.test(t))||!/^data:/.test(e)&&!t}function Ke(e){if(/^https?:\/\//.test(e))return e;const t=document.createElement("a");return t.href=e,t.href}Q.locale("zh-cn"),Q.extend(J),Q.extend(X);const Ve={success:n("i",{className:"bi bi-check-circle-fill text-success"}),error:n("i",{className:"bi bi-exclamation-circle-fill text-danger"}),info:n("i",{className:"bi bi-info-circle-fill text-info"}),warning:n("i",{className:"bi bi-exclamation-triangle-fill text-warning"})};function Ye({className:e,status:t,title:a,icon:o,extra:i}){return!o&&t&&(o=Ve[t]),r(Qe,{className:e,children:[o&&n(Je,{children:o}),a&&n(Xe,{children:a}),i&&n(Ze,{children:i})]})}const Qe=K.div`
29
+ padding: 48px 32px;
30
+ `,Je=K.div`
31
+ margin-bottom: 24px;
32
+ text-align: center;
33
+ font-size: 72px;
34
+ `,Xe=K.div`
35
+ color: rgba(0, 0, 0, .85);
36
+ font-size: 24px;
37
+ line-height: 1.8;
38
+ text-align: center;
39
+ `,Ze=K.div`
40
+ margin-top: 32px;
41
+ text-align: center;
42
+ `;function et({children:e,title:t,className:o,...i}){return n(tt,{className:Z("border-0 shadow-sm",o),...i,children:r("div",{className:"card-body",children:[t&&r(a,{children:[n("h5",{children:t}),n("hr",{})]}),e]})})}const tt=K(P)`
43
+ &:not(:last-child) {
44
+ margin-bottom: 1rem;
45
+ }
46
+ `,nt=c(void 0);function rt({children:e}){const[t,r]=i(new Set),a=d(e=>{e&&"string"==typeof e&&(e=[e]),r(new Set(e))},[r]);return n(nt.Provider,{value:[t,r],children:n(j,{activeKey:Array.from(t),onSelect:a,alwaysOpen:!0,children:e})})}const at=()=>{const e=l(nt);if(!e)throw new Error("usePanel must be used within a PanelGroup");return e};function ot({title:e,action:t,children:o,eventKey:i,open:c}){if(i){const[,e]=at();s(()=>{void 0!==c&&e(e=>c?new Set([...e,i]):new Set([...e].filter(e=>e!==i)))},[c]),o=n(j.Collapse,{eventKey:i,children:r(a,{children:[n("hr",{}),o]})})}else o=r(a,{children:[n("hr",{}),o]});return r(et,{children:[r(T,{direction:"horizontal",children:[n("div",{className:"fs-5 me-auto",children:e}),t]}),o]})}function it({errors:e}){return e?n(D,{variant:"danger",children:n("ul",{className:"mb-0",children:"string"==typeof e?n("li",{children:e}):Object.entries(e).map(([e,t])=>n("li",{children:t},e))})}):null}function st({children:e,className:t,size:r="small",direction:a="horizontal"}){"string"==typeof r&&(r={small:8,middle:16,large:24}[r]);const o=y.map(e,e=>{if(e)return n(lt,{children:e})});return n(ct,{className:t,$direction:a,$size:r,children:o})}const ct=K.div`
47
+ display: inline-flex;
48
+ align-items: center;
49
+ gap: ${e=>e.$size}px;
50
+
51
+ ${e=>"vertical"===e.$direction&&V`
52
+ display: flex;
53
+ flex-direction: column;
54
+ align-items: inherit;
55
+ `}
56
+ `,lt=K.div`
57
+
58
+ `,dt=f(()=>import("./steps-DECts1pI.js")),ut=f(()=>import("./steps-DECts1pI.js").then(({Step:e})=>({default:e})));function ht(e){return n(p,{fallback:null,children:n(dt,{...e})})}const mt=function(e){return n(p,{fallback:null,children:n(ut,{...e})})};function ft({title:e,content:t,footer:a}){return r(et,{children:[n(yt,{children:e}),n(gt,{children:t}),a&&n(pt,{children:a})]})}ht.Step=mt;const pt=K.div`
59
+ margin-top: 9px;
60
+ padding-top: 10px;
61
+ border-top: 1px solid #f0f0f0;
62
+ color: rgba(0, 0, 0, .65);
63
+ `,gt=K.div`
64
+ color: rgba(0, 0, 0, .85);
65
+ font-size: 24px;
66
+ `,yt=K.div`
67
+ margin-bottom: 4px;
68
+ color: rgba(0, 0, 0, .45);
69
+ font-size: 1.1rem;
70
+ `;function wt(){}function vt(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}function bt(e){return"current_page"in e}function xt({total:e=0,onChange:t=wt,defaultCurrent:a=1,defaultPageSize:o=10,className:c,...l}){const[h,m]=i(a),[f,p]=i(o);s(()=>{vt(l.current)&&m(l.current)},[l.current]),s(()=>{vt(l.pageSize)&&p(l.pageSize)},[l.pageSize]);const g=u(()=>Math.floor((e-1)/f)+1,[e,f]),y=d(e=>()=>{e!==h&&(m(e),t(e,f))},[t,h,f]),w=h-1>0?h-1:0,v=h+1<g?h+1:g,b=[];let x=null,k=null,C=null,N=null;if(g<=7)for(let e=1;e<=g;e+=1){const t=h===e;b.push(n(R.Item,{active:t,onClick:y(e),children:e},e))}else{N=n(R.Last,{onClick:y(g)},"last"),C=n(R.First,{onClick:y(1)},"first"),x=n(R.Prev,{onClick:y(w)},"prev"),k=n(R.Next,{onClick:y(v)},"next");let e=Math.max(1,h-2),t=Math.min(h+2,g);h-1<=2&&(t=5),g-h<=2&&(e=g-4);for(let r=e;r<=t;r+=1){const e=h===r;b.push(n(R.Item,{active:e,onClick:y(r),children:r},r))}h-1>=4&&3!==h&&b.unshift(x),g-h>=4&&h!==g-2&&b.push(k),1!==e&&b.unshift(C),t!==g&&b.push(N)}return r("div",{className:Z("mb-3 d-flex align-column-center justify-content-between",c),children:[r("div",{className:"d-flex align-items-center",children:["共 ",e," 条"]}),n(R,{className:"mb-0",children:b})]})}function kt({className:e,value:t,locale:r="zh-CN",currency:o=!0,options:i={}}){const s=u(()=>{let e;return e=o?{style:"currency",currency:"CNY"}:{minimumFractionDigits:2},new Intl.NumberFormat(r,{...e,...i})},[o,r,i]);return e?n("span",{className:e,children:s.format(t)}):n(a,{children:s.format(t)})}function Ct({loading:e,disabled:t,children:r,...a}){return n(C,{...a,disabled:e||t,children:e?"Loading…":r})}const Nt=f(()=>import("./image-zoom-He8CEHjx.js"));function St(e){return n(p,{fallback:null,children:n(Nt,{...e})})}const zt=m(({confirm:e,onSuccess:t,children:n,disabled:r,as:a=ve,onError:o,...i},s)=>{const[c,l]=$e(!1),u=d(async n=>{n.preventDefault(),n.stopPropagation();try{if(l(!0),e&&!await Ne.confirm({message:e}))return;let n;if("onRequest"in i)n=await i.onRequest();else{const e="string"==typeof i.url?{url:i.url,method:i.method}:{method:i.method,...i.url};n=await Re(e)}t&&t(n)}catch(n){if(!(n instanceof Error))throw n;o?o(n):Se.error(n.message,{preventDuplicate:!0})}finally{l(!1)}},[i,l]);return w(a,{..._(i,["onRequest","url","method"]),disabled:r||c,onClick:u,ref:s},n)}),Pt=f(()=>import("./index-DVxKeS-t.js")),jt=m((e,t)=>n(p,{fallback:null,children:n(Pt,{...e,ref:t})}));let Tt=0;function Dt({onHide:e,onShow:t}={}){const[n,r]=i(!1),[a,o]=i(`visible-${Tt}`),s=d(()=>{r(!1),e&&e()},[r,e]),c=d(()=>{o("visible-"+ ++Tt)},[o,Tt]);return{visible:n,show:d(()=>{r(!0),t&&t()},[r,t]),hide:s,state:{show:n,onHide:s,onExited:c,key:a}}}const Rt=m(({text:e,onOk:t,modalProps:o,children:i,onShow:s,onHide:c,confirmLoading:l,as:d=ve,...u},h)=>{const{state:m,show:f,hide:p}=Dt({onShow:s,onHide:c});v(h,()=>({close:p}));const g=w(d,{...u,onClick:e=>{e.preventDefault(),e.stopPropagation(),f()}},e);return r(a,{children:[g,n(Ne,{header:e,...o,...m,confirmLoading:l,onOk:async e=>{if(t){!1===await t()&&e.preventDefault()}},children:i})]})}),$t=m(({text:e,onSuccess:t,onSubmit:a,buttonProps:s,modalProps:c,children:l,...u},h)=>{const[m,f]=i(!1),p=o(null),g=o(null);v(h,()=>({close:()=>{p.current?.close()}}));const y=d(async()=>(g.current?.submit().catch(()=>{}),!1),[]),w=d((e,n)=>{t&&t(e,n),p.current?.close()},[t]),b=d(async(e,t)=>{a&&await a(e,t)&&p.current?.close()},[a]);return n(Rt,{ref:p,text:e,...s,modalProps:c,onOk:y,confirmLoading:m,children:r(ke,{...u,onSubmitting:f,ref:g,onSuccess:w,onSubmit:b,children:[l,n("input",{type:"submit",hidden:!0})]})})});function Et({header:e,children:t,closable:a=!0,show:o,onHide:i,bodyAs:s,headerAs:c="h5",...l}){return r($,{...l,onHide:i,show:o,children:[e&&n($.Header,{closeButton:a,children:n($.Title,{as:c,children:e})}),n($.Body,{as:s,children:t})]})}const Ht=m(({text:e,offcanvasProps:t,children:o,onShow:i,onHide:s,as:c=ve,...l},d)=>{const{state:u,show:h,hide:m}=Dt({onShow:i,onHide:s});v(d,()=>({close:m}));const f=w(c,{...l,onClick:h},e);return r(a,{children:[f,n(Et,{header:e,...t,...u,children:o})]})});function Lt(e,t=[]){const n=o(e);return s(()=>{n.current=e}),d((...e)=>n.current?.(...e),t)}function Bt(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:a=(e,t)=>e!==t}=e,o=Lt(r),s=Lt(a),[c,l]=i(n),d=void 0!==t,u=d?t:c,h=Lt(e=>{const t="function"==typeof e?e(u):e;s(u,t)&&(d||l(t),o(t))},[d,o,u,s]);return[u,h]}const _t=m(({className:e,rowClassName:t,paginate:a=!0,sync:c=!1,columns:l=3,source:u,renderItem:h,renderEmpty:m},f)=>{const[p,g]=i([]),[y,w]=i(a?{total:0,current:1,pageSize:10}:null),[b,x]=i(!0),[k,C]=ee({}),[N,S]=Bt({value:c?k.page||1:void 0,defaultValue:1,onChange:e=>{c&&C({page:e||void 0})}}),z=d(async(e=!1)=>{e||x(!0);try{let e;const t={page:N>1?N:void 0};e="string"==typeof u?await Re({url:u,params:t}):await u(t),a&&bt(e)?(e.last_page>1?w({total:e.total,current:e.current_page,pageSize:e.per_page}):w(null),e=e.data):w(null),g(e)}catch(e){}finally{x(!1)}},[u,g,N]);s(()=>{z()},[N]),s(()=>{P.current={reload:z}},[z]);const P=o({reload:z});return v(f,()=>P.current),r(Mt,{className:e,children:[n(_e,{wrap:!0,loading:b}),0===p.length&&!b&&m?.(),n(E,{className:Z(t,"g-4"),children:p.map((e,t)=>n(H,{className:"d-flex",md:12/l,children:h(e)},`card-${t}`))}),y&&n(Ot,{...y,onChange:S})]})}),Mt=K.div`
71
+
72
+ `,Ot=K(xt)`
73
+ margin-bottom: 0;
74
+ justify-content: flex-end;
75
+ margin-top: 1rem;
76
+ `;var It=g(_t);function Ft(){const[e,t]=i(!1),n=o();return s(()=>()=>{n.current&&clearTimeout(n.current)},[]),{copied:e,copy:d(e=>{te(e),t(!0),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{t(!1),n.current=void 0},3e3)},[])}}function Ut({as:e="div",className:t,content:r,tooltip:a=!0,placement:o}){const{copy:i,copied:s}=Ft(),c=a?n("i",s?{className:"bi bi-clipboard-check"}:{className:"bi bi-clipboard"}):s?"已复制":"复制",l=w(e,{role:"button",className:t,onClick:()=>{"function"==typeof r&&(r=r()),i(r)}},c);return a?n(ye,{tooltip:s?"已复制":"复制",placement:o,children:l}):l}const Wt=c({images:new Map,current:0,setCurrent:()=>null,setShow:()=>null,registerImage:()=>()=>null,getId:()=>0}),qt=f(()=>import("./index-BeagW19w.js")),At=f(()=>import("./image-D8-izluk.js"));function Gt(e){return n(p,{fallback:null,children:n(qt,{...e})})}Gt.Image=function(e){return n(p,{fallback:null,children:n(At,{...e})})},Gt.Context=Wt;const Kt=f(()=>import("./infinite-scroller-BRoPXnwY.js")),Vt=m((e,t)=>n(p,{fallback:null,children:n(Kt,{...e,ref:t})})),Yt=f(()=>import("./slider-DE41CkdN.js"));function Qt(e){return n(p,{fallback:null,children:n(Yt,{...e})})}function Jt({children:e}){return r(q,{children:[n(Xt,{}),e]})}const Xt=Y`
77
+ ${ne.extractCss()}
78
+ `,Zt=f(()=>import("./cascader-BQf3OIMo.js"));function en(e){return n(p,{fallback:null,children:n(Zt,{...e})})}const tn=f(()=>import("./select-CwDOdXXH.js"));function nn(e){return n(p,{fallback:null,children:n(tn,{...e})})}function rn(e,t,n){const r=o(e),a=o(M(e,t,n));return s(()=>{r.current=e}),s(()=>{a.current=M((...e)=>{r.current(...e)},t,n)},[t,n]),a.current}function an(e){const[t,n]=i(()=>re("function"==typeof e?e():e,!0));return[t,d(e=>{n("function"==typeof e?ae(e):re(e))},[])]}function on(e="lg"){function t(){const t=e=>{switch(e){case"xxl":return window.innerWidth>=1400;case"xl":return window.innerWidth>=1200;case"lg":return window.innerWidth>=992;case"md":return window.innerWidth>=768;case"sm":return window.innerWidth>=576;default:return!0}};return{isMobile:!t(e),width:window.innerWidth,match:t}}const[n,r]=i(t),a=rn(()=>{r(t())},100);return s(()=>(window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)),[]),n}var sn;!function(e){e[e.init=0]="init",e[e.play=1]="play",e[e.pause=2]="pause",e[e.end=3]="end"}(sn||(sn={}));const cn=(e,t)=>{let n=o(!1);const[r,a]=i(()=>{const{lang:e="default",name:n=""}=t.voice||{};return{isPlaying:!1,status:sn[sn.init],lang:t.lang||"default",voiceInfo:{lang:e,name:n},rate:t.rate||1,pitch:t.pitch||1,volume:t.volume||1}}),c=d(()=>{n.current&&a(e=>({...e,isPlaying:!0,status:sn[sn.play]}))},[]),l=d(()=>{n.current&&a(e=>({...e,isPlaying:!1,status:sn[sn.pause]}))},[]),u=d(()=>{n.current&&a(e=>({...e,isPlaying:!1,status:sn[sn.end]}))},[]);return s(()=>{n.current=!0;const r=new SpeechSynthesisUtterance(e);return t.lang&&(r.lang=t.lang),t.voice&&(r.voice=t.voice),r.rate=t.rate||1,r.pitch=t.pitch||1,r.volume=t.volume||1,r.onstart=c,r.onpause=l,r.onresume=c,r.onend=u,window.speechSynthesis.speak(r),()=>{n.current=!1}},[]),r};function ln(e,t){s(()=>{const t=e();!async function(){await t}()},t)}export{Dt as $,Rt as A,ve as B,et as C,Ne as D,it as E,ke as F,Et as G,ye as H,Wt as I,It as J,Ut as K,_e as L,ce as M,kt as N,Ht as O,xt as P,Gt as Q,Ye as R,st as S,we as T,Vt as U,Qt as V,Ie as W,Jt as X,en as Y,nn as Z,He as _,on as a,Ft as a0,cn as a1,ln as a2,Pe as a3,je as a4,Te as a5,Bt as b,$e as c,an as d,Se as e,ze as f,qe as g,Ee as h,bt as i,Ae as j,Ge as k,Ke as l,ot as m,rt as n,at as o,ht as p,mt as q,Re as r,ft as s,Ct as t,rn as u,St as v,We as w,zt as x,jt as y,$t as z};
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import o,{getRegistry as r}from"@topthink/json-form";import*as a from"react";import{forwardRef as e,useState as i,useCallback as n}from"react";import s from"axios";import{c as p,r as m,B as d}from"./index-T-6KSxw4.js";import{mapValues as l}from"lodash";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"query-string";import"retry-axios";import"notistack";import"path";import"react-async-hook";import"styled-components";import"dayjs";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"goober";import"immer";import"react-intersection-observer";const c=require("ajv-i18n/localize/zh"),u=a.lazy(()=>import("./editor-widget-DiT2rVOW.js")),f=o=>t(a.Suspense,{fallback:null,children:t(u,{...o})}),y={upload:function({options:o,...a}){const{widgets:e}=r();return o.endpoint&&(o.onUpload=async t=>{const r=new FormData;r.set("file",t);const{url:a,value:e}=await m({url:o.endpoint,method:"post",data:r});return{url:a,value:e}}),t(e.upload,{...a,options:o})},avatar:function({options:o,...a}){const{widgets:e}=r();return o.endpoint&&(o.onUpload=async t=>{const r=new FormData;r.set("file",t);const{url:a}=await m({url:o.endpoint,method:"post",data:r});return a}),t(e.avatar,{...a,options:o})},editor:function({options:o,...r}){return o.endpoint&&(o.onUpload=async t=>{const r=new FormData;r.set("file",t);const{url:a}=await m({url:o.endpoint,method:"post",data:r});return a}),t(f,{...r,options:o})},typeahead:function({options:o,...a}){const{widgets:e}=r();return o.endpoint&&(o.onSearch=async({value:t,query:r})=>await m({url:o.endpoint,params:{value:t,query:r}})),t(e.typeahead,{...a,options:o})}},h=e(({action:r,method:a="post",onSuccess:e,formData:u,onSubmitting:f,onSubmit:h,onChange:w,submitText:b="保存",transformData:g,children:v,validate:j,disabled:x,onRequest:D,...S},k)=>{const[q,z]=i(),[_,E]=p(!1),[F,U]=i(u),C=n(async(t,o)=>{if(!_)try{if(E(!0),f&&f(!0),r||D){let{formData:o}=t;g&&(o=g(o));try{let t;return t=D?await D(o):await m({url:r,method:a,data:o}),z(void 0),e&&await e(t,o),t}catch(t){if(!s.isAxiosError(t))throw t;z((t=>{const o=t.errors;return"string"==typeof o?{__errors:[o]}:l(o,t=>({__errors:[t]}))})(t))}}else if(h)return await h(t,o)}finally{E(!1),f&&f(!1)}},[r,a,h,D]),N=n(t=>{const{formData:o}=t;U(o),w&&w(t)},[U,w]),T=n(t=>(t=t.map(t=>({keyword:t.name,dataPath:t.property,...t})),c(t),t),[]),V=t(d,{className:"px-4",disabled:x,loading:_,type:"submit",variant:"primary",children:b});"function"==typeof v&&(v=v({submit:V,loading:_,disabled:x}));const A=!j;return!0===j&&(j=void 0),t(o,{ref:k,extraErrors:q,onSubmit:C,transformErrors:T,noHtml5Validate:!0,noValidate:A,validate:j,disabled:x,...S,formData:F,onChange:N,widgets:y,children:v||t("div",{className:"col-12",children:V})})});export{h as default};
1
+ import{jsx as t}from"react/jsx-runtime";import o,{getRegistry as r}from"@topthink/json-form";import*as a from"react";import{forwardRef as e,useState as i,useCallback as n}from"react";import s from"axios";import{c as p,r as m,B as d}from"./index-nB_cgu7W.js";import{mapValues as l}from"lodash";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"query-string";import"retry-axios";import"notistack";import"path";import"react-async-hook";import"styled-components";import"dayjs";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"goober";import"immer";import"react-intersection-observer";const c=require("ajv-i18n/localize/zh"),u=a.lazy(()=>import("./editor-widget-DiT2rVOW.js")),f=o=>t(a.Suspense,{fallback:null,children:t(u,{...o})}),y={upload:function({options:o,...a}){const{widgets:e}=r();return o.endpoint&&(o.onUpload=async t=>{const r=new FormData;r.set("file",t);const{url:a,value:e}=await m({url:o.endpoint,method:"post",data:r});return{url:a,value:e}}),t(e.upload,{...a,options:o})},avatar:function({options:o,...a}){const{widgets:e}=r();return o.endpoint&&(o.onUpload=async t=>{const r=new FormData;r.set("file",t);const{url:a}=await m({url:o.endpoint,method:"post",data:r});return a}),t(e.avatar,{...a,options:o})},editor:function({options:o,...r}){return o.endpoint&&(o.onUpload=async t=>{const r=new FormData;r.set("file",t);const{url:a}=await m({url:o.endpoint,method:"post",data:r});return a}),t(f,{...r,options:o})},typeahead:function({options:o,...a}){const{widgets:e}=r();return o.endpoint&&(o.onSearch=async({value:t,query:r})=>await m({url:o.endpoint,params:{value:t,query:r}})),t(e.typeahead,{...a,options:o})}},h=e(({action:r,method:a="post",onSuccess:e,formData:u,onSubmitting:f,onSubmit:h,onChange:w,submitText:b="保存",transformData:g,children:v,validate:j,disabled:x,onRequest:D,...S},k)=>{const[q,z]=i(),[_,E]=p(!1),[F,U]=i(u),C=n(async(t,o)=>{if(!_)try{if(E(!0),f&&f(!0),r||D){let{formData:o}=t;g&&(o=g(o));try{let t;return t=D?await D(o):await m({url:r,method:a,data:o}),z(void 0),e&&await e(t,o),t}catch(t){if(!s.isAxiosError(t))throw t;z((t=>{const o=t.errors;return"string"==typeof o?{__errors:[o]}:l(o,t=>({__errors:[t]}))})(t))}}else if(h)return await h(t,o)}finally{E(!1),f&&f(!1)}},[r,a,h,D]),N=n(t=>{const{formData:o}=t;U(o),w&&w(t)},[U,w]),T=n(t=>(t=t.map(t=>({keyword:t.name,dataPath:t.property,...t})),c(t),t),[]),V=t(d,{className:"px-4",disabled:x,loading:_,type:"submit",variant:"primary",children:b});"function"==typeof v&&(v=v({submit:V,loading:_,disabled:x}));const A=!j;return!0===j&&(j=void 0),t(o,{ref:k,extraErrors:q,onSubmit:C,transformErrors:T,noHtml5Validate:!0,noValidate:A,validate:j,disabled:x,...S,formData:F,onChange:N,widgets:y,children:v||t("div",{className:"col-12",children:V})})});export{h as default};
package/es/index.js CHANGED
@@ -1 +1 @@
1
- export{B as Button,C as Card,J as CardList,Y as Cascader,K as Clipboard,E as Error,F as Form,v as ImageZoom,U as InfiniteScroller,Q as Lightbox,L as Loader,t as LoadingButton,M as Message,D as Modal,A as ModalButton,z as ModalForm,N as NumberFormat,G as Offcanvas,O as OffcanvasButton,P as Pagination,m as Panel,n as PanelGroup,W as Qrcode,x as RequestButton,R as Result,Z as Select,V as Slider,S as Space,s as Statistic,q as Step,p as Steps,y as Table,e as Toast,X as ToastProvider,H as Tooltip,j as formatLongNumber,h as formatNumber,g as formatSize,l as getAbsoluteUrl,a4 as isCancel,k as isImageUrl,f as isRecord,a3 as isRequestError,r as request,a5 as showRequestError,a2 as useAsyncEffect,a0 as useClipboard,b as useControllableState,u as useDebounce,d as useImmer,$ as useOverlayState,o as usePanel,_ as useRequest,c as useSafeState,a1 as useSpeech,a as useWindowSize,w as waitPayComplete}from"./index-T-6KSxw4.js";export{StyleSheetManager,ThemeProvider,createGlobalStyle,css,keyframes,default as styled}from"styled-components";export{useAsync,useAsyncCallback}from"react-async-hook";export{useInView}from"react-intersection-observer";export{default as queryString}from"query-string";export{freeze,immerable,produce}from"immer";export{default as dayjs}from"dayjs";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react/jsx-runtime";import"react";import"react-bootstrap";import"lodash";import"axios";import"retry-axios";import"notistack";import"path";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"goober";
1
+ export{B as Button,C as Card,J as CardList,Y as Cascader,K as Clipboard,E as Error,F as Form,v as ImageZoom,U as InfiniteScroller,Q as Lightbox,L as Loader,t as LoadingButton,M as Message,D as Modal,A as ModalButton,z as ModalForm,N as NumberFormat,G as Offcanvas,O as OffcanvasButton,P as Pagination,m as Panel,n as PanelGroup,W as Qrcode,x as RequestButton,R as Result,Z as Select,V as Slider,S as Space,s as Statistic,q as Step,p as Steps,y as Table,e as Toast,X as ToastProvider,H as Tooltip,j as formatLongNumber,h as formatNumber,g as formatSize,l as getAbsoluteUrl,a4 as isCancel,k as isImageUrl,f as isRecord,a3 as isRequestError,r as request,a5 as showRequestError,a2 as useAsyncEffect,a0 as useClipboard,b as useControllableState,u as useDebounce,d as useImmer,$ as useOverlayState,o as usePanel,_ as useRequest,c as useSafeState,a1 as useSpeech,a as useWindowSize,w as waitPayComplete}from"./index-nB_cgu7W.js";export{StyleSheetManager,ThemeProvider,createGlobalStyle,css,keyframes,default as styled}from"styled-components";export{useAsync,useAsyncCallback}from"react-async-hook";export{useInView}from"react-intersection-observer";export{default as queryString}from"query-string";export{freeze,immerable,produce}from"immer";export{default as dayjs}from"dayjs";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react/jsx-runtime";import"react";import"react-bootstrap";import"lodash";import"axios";import"retry-axios";import"notistack";import"path";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"goober";
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import{memo as a,forwardRef as r,useState as e,useCallback as o,useImperativeHandle as i}from"react";import s from"react-infinite-scroller";import{d as m,r as p,i as n}from"./index-T-6KSxw4.js";import{last as d}from"lodash";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"react-async-hook";import"styled-components";import"dayjs";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"goober";import"immer";import"react-intersection-observer";var c=a(r(({source:a,render:r,as:c,useWindow:l,className:u,getState:g,limit:y=10},f)=>{const[h,j]=e(!1),[w,x]=m({params:{},end:!1,data:[]}),b=o(async(t=!1)=>{if(!h){j(!0);try{let r;const e=t?{}:w.params;r="string"==typeof a?await p({url:a,params:e}):await a(e),g||(g=t=>n(t)?{params:{page:t.current_page+1},end:t.current_page>=t.last_page,data:t.data}:{params:{offset:d(t)?.id},end:t.length<y,data:t});const o=g(r);x({...o,data:t?o.data:[...w.data,...o.data]})}catch{x({...w,end:!0})}finally{j(!1)}}},[a,w,g,h]),v=o(()=>{b(!0)},[b]);i(f,()=>({reload:v}),[v]);const _=o(t=>{x(a=>{const r=t(a.data);r&&(a.data=r)})},[x]);return t(s,{className:u,hasMore:!w.end,pageStart:0,loadMore:()=>{b()},useWindow:l,element:c,children:r({data:w.data,setData:_,end:w.end,loading:h,action:{reload:v}})})}));export{c as default};
1
+ import{jsx as t}from"react/jsx-runtime";import{memo as a,forwardRef as r,useState as e,useCallback as o,useImperativeHandle as i}from"react";import s from"react-infinite-scroller";import{d as m,r as p,i as n}from"./index-nB_cgu7W.js";import{last as d}from"lodash";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"react-async-hook";import"styled-components";import"dayjs";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"goober";import"immer";import"react-intersection-observer";var c=a(r(({source:a,render:r,as:c,useWindow:l,className:u,getState:g,limit:y=10},f)=>{const[h,j]=e(!1),[w,x]=m({params:{},end:!1,data:[]}),b=o(async(t=!1)=>{if(!h){j(!0);try{let r;const e=t?{}:w.params;r="string"==typeof a?await p({url:a,params:e}):await a(e),g||(g=t=>n(t)?{params:{page:t.current_page+1},end:t.current_page>=t.last_page,data:t.data}:{params:{offset:d(t)?.id},end:t.length<y,data:t});const o=g(r);x({...o,data:t?o.data:[...w.data,...o.data]})}catch{x({...w,end:!0})}finally{j(!1)}}},[a,w,g,h]),v=o(()=>{b(!0)},[b]);i(f,()=>({reload:v}),[v]);const _=o(t=>{x(a=>{const r=t(a.data);r&&(a.data=r)})},[x]);return t(s,{className:u,hasMore:!w.end,pageStart:0,loadMore:()=>{b()},useWindow:l,element:c,children:r({data:w.data,setData:_,end:w.end,loading:h,action:{reload:v}})})}));export{c as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topthink/components",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "module": "es/index.js",
5
5
  "types": "types/index.d.ts",
6
6
  "files": [
@@ -16,7 +16,7 @@
16
16
  "@topthink/json-form": "1.0.69",
17
17
  "@types/react-infinite-scroller": "^1.2.5",
18
18
  "ajv-i18n": "^4.0.0",
19
- "axios": "^0.27.2",
19
+ "axios": "1.13.6",
20
20
  "classnames": "^2.3.1",
21
21
  "copy-to-clipboard": "^3.3.3",
22
22
  "dayjs": "^1.10.7",
@@ -68,7 +68,7 @@
68
68
  },
69
69
  "author": "yunwuxin <tzzhangyajun@qq.com> (https://github.com/yunwuxin)",
70
70
  "license": "MIT",
71
- "gitHead": "6add4cb134859a69668da4dc736941afa43ebe3c",
71
+ "gitHead": "5b926446ee583f2265247e1b937fc2fac53519a5",
72
72
  "scripts": {
73
73
  "prebuild": "rimraf es types",
74
74
  "build": "rollup -c --environment NODE_ENV:production",
@@ -13,6 +13,19 @@ export interface EventSourceMessage {
13
13
  /** The reconnection interval (in milliseconds) to wait before retrying the connection */
14
14
  retry?: number;
15
15
  }
16
+ export interface SseRetryContext {
17
+ error?: unknown;
18
+ attempt: number;
19
+ hasDone: boolean;
20
+ closedWithoutDone: boolean;
21
+ hasReceivedData: boolean;
22
+ }
23
+ export interface SseRetryConfig {
24
+ retry?: number;
25
+ retryDelay?: number;
26
+ backoffType?: 'static' | 'linear' | 'exponential';
27
+ shouldRetry?: (context: SseRetryContext) => boolean;
28
+ }
16
29
  declare module 'retry-axios' {
17
30
  interface RetryConfig {
18
31
  retryDecider?: () => boolean;
@@ -26,6 +39,12 @@ declare module 'axios' {
26
39
  raxConfig?: RetryConfig;
27
40
  authTokenName?: string | false;
28
41
  onMessage?: (message: EventSourceMessage) => void;
42
+ sseAutoReconnect?: boolean;
43
+ sseReconnectDelay?: number;
44
+ sseMaxReconnects?: number;
45
+ sseDoneToken?: string;
46
+ sseRetryOnIncomplete?: boolean;
47
+ sseRetryConfig?: SseRetryConfig;
29
48
  }
30
49
  }
31
50
  export type RequestConfig = AxiosRequestConfig | string;
@@ -33,8 +52,8 @@ export interface RequestInstance<T = any> {
33
52
  interceptors: AxiosInstance['interceptors'];
34
53
  (config: RequestConfig): Promise<T>;
35
54
  }
36
- export declare const isRequestError: (payload: any) => payload is import("axios").AxiosError;
37
- export declare const isCancel: (value: any) => boolean;
55
+ export declare const isRequestError: typeof import("axios").isAxiosError;
56
+ export declare const isCancel: typeof import("axios").isCancel;
38
57
  export type { Cancel, };
39
58
  export declare const showRequestError: (e: any) => void;
40
59
  declare const request: {
@@ -42,13 +61,17 @@ declare const request: {
42
61
  create(config?: AxiosRequestConfig): {
43
62
  (config: RequestConfig): Promise<any>;
44
63
  interceptors: {
45
- request: import("axios").AxiosInterceptorManager<AxiosRequestConfig>;
64
+ request: import("axios").AxiosInterceptorManager<import("axios").InternalAxiosRequestConfig>;
46
65
  response: import("axios").AxiosInterceptorManager<import("axios").AxiosResponse>;
47
66
  };
48
67
  };
49
- defaults: import("axios").AxiosDefaults<any>;
68
+ defaults: Omit<import("axios").AxiosDefaults<any>, "headers"> & {
69
+ headers: import("axios").HeadersDefaults & {
70
+ [key: string]: import("axios").AxiosHeaderValue;
71
+ };
72
+ };
50
73
  interceptors: {
51
- request: import("axios").AxiosInterceptorManager<AxiosRequestConfig>;
74
+ request: import("axios").AxiosInterceptorManager<import("axios").InternalAxiosRequestConfig>;
52
75
  response: import("axios").AxiosInterceptorManager<import("axios").AxiosResponse>;
53
76
  };
54
77
  };
@@ -1,78 +0,0 @@
1
- import e from"sweetalert2/dist/sweetalert2.js";import n from"sweetalert2-react-content";import{jsx as t,jsxs as r,Fragment as o}from"react/jsx-runtime";import{useRef as a,useState as i,useEffect as c,createContext as s,useContext as l,useCallback as d,useMemo as u,Fragment as h,forwardRef as m,lazy as f,Suspense as p,memo as g,Children as y,createElement as w,useImperativeHandle as v}from"react";import{OverlayTrigger as b,Tooltip as x,Spinner as k,Button as C,Modal as N,ButtonGroup as S,ToggleButton as z,Card as j,Accordion as P,Stack as T,Alert as $,Pagination as H,Offcanvas as B,Row as E,Col as D}from"react-bootstrap";import{uniqueId as L,values as _,omit as R,debounce as F}from"lodash";import M from"axios";import O from"query-string";import*as U from"retry-axios";import{enqueueSnackbar as A,SnackbarProvider as I}from"notistack";import q from"path";import{useAsyncCallback as W}from"react-async-hook";import G,{css as K,createGlobalStyle as V}from"styled-components";import Y from"dayjs";import"dayjs/locale/zh-cn";import Q from"dayjs/plugin/relativeTime";import J from"dayjs/plugin/duration";import X from"classnames";import{useUrlSearchParams as Z}from"use-url-search-params";import ee from"copy-to-clipboard";import*as ne from"goober";import{freeze as te,produce as re}from"immer";import"react-intersection-observer";const oe=()=>{document.body.style.setProperty("--vh",window.innerHeight/100+"px"),document.body.style.setProperty("--100vh",window.innerHeight+"px")};window.addEventListener("resize",oe),oe();const ae=n(e),ie={confirmButtonText:"确定",cancelButtonText:"取消"},ce={confirm:async e=>{const{isConfirmed:n}=await ae.fire({...ie,icon:"warning",showCancelButton:!0,...e,async preConfirm(n){if(e.preConfirm)try{return await e.preConfirm(n)}catch(e){return e instanceof Error&&ae.showValidationMessage(e.message),!1}return!0}});return n},success:e=>{ae.fire({...ie,toast:!0,position:"top",icon:"success",timer:2e3,showConfirmButton:!1,...e})},error:e=>{ae.fire({...ie,toast:!0,position:"top",icon:"error",timer:5e3,showConfirmButton:!1,...e})},close:e=>{ae.close(e)},defaults:ie};const se=s({});function le(e){return({resolve:n,destroy:r,message:o})=>{const[s,h]=function(e){const n=a(null),[t,r]=i(e);return c(()=>{n.current&&(n.current(),n.current=null)},[t]),[t,(e,t)=>{n.current="function"==typeof t?t:null,r(e)}]}(!0),m=l(se),f=d(e=>{h(!1,()=>{n(e)})},[h,n]),p=u(()=>({show:s,onHide:()=>f(),onExited:()=>r(),container:m.container}),[s,f,r]);return t(e,{resolve:f,state:p,message:o})}}function de(e){return n=>new Promise(r=>{const o=t(e,{resolve:r,destroy:()=>{fe(o)},message:n});me(o)})}let ue=()=>{},he=new Set;const me=e=>{he=new Set(he),he.add(e),ue(he)},fe=e=>{he=new Set(he),he.delete(e),ue(he)};function pe(e,n){return de(le(e))(n)}function ge({tooltip:e,children:n,placement:r="bottom"}){return t(b,{placement:r,overlay:t(x,{id:L(),children:e}),children:n})}const ye=s(!1),we=m(({loading:e,percent:n,disabled:a,children:i,tooltip:c,variant:s,...d},u)=>{l(ye)&&!s&&(s="link"),e&&(a=!0,i=r(o,{children:[t(k,{ref:u,as:"span",size:"sm",role:"status","aria-hidden":"true",animation:"border"}),n?r("span",{className:"ms-2",children:[n,"%"]}):null]}));const h=t(C,{ref:u,...d,variant:s,disabled:a,children:i});return c?t(ge,{tooltip:c,children:t("span",{className:"d-inline-block",children:h})}):h}),ve=function({state:e,message:{title:n,message:o,okText:a,cancelText:i},resolve:c}){return r(N,{...e,children:[t(N.Header,{children:t(N.Title,{as:"h5",children:n||"确认"})}),t(N.Body,{children:o}),r(N.Footer,{children:[t(we,{variant:"secondary",onClick:()=>c(),children:i||"取消"}),t(we,{onClick:()=>c(!0),children:a||"确定"})]})]})};const be=f(()=>import("./index-DWyjVOOg.js")),xe=m((e,n)=>t(p,{fallback:null,children:t(be,{...e,ref:n})})),ke=function({state:e,resolve:n,message:{title:o,size:i,layout:c,...s}}){const l=a(null);return r(N,{...e,size:i,backdrop:"static",children:[t(N.Header,{children:t(N.Title,{as:"h5",children:o})}),t(N.Body,{children:t(xe,{ref:l,...s,formContext:{layout:c},onSubmit:({formData:e})=>{n(e)},children:t(h,{})})}),r(N.Footer,{children:[t(we,{variant:"secondary",onClick:()=>n(),children:"取消"}),t(we,{onClick:()=>{l.current?.submit().catch(()=>{})},children:"确定"})]})]})};const Ce=({header:e,children:n,footer:a,closable:c=!0,show:s,cancelText:l="取消",okText:d="确定",onOk:h,onCancel:m,onHide:f,okButtonProps:p,bodyAs:g,headerAs:y="h5",confirmLoading:w=!1,...v})=>{const[b,x]=i(!1),k=u(()=>t(we,{loading:b||w,variant:"primary",onClick:async e=>{x(!0);try{await(h?.(e)),e.defaultPrevented||f?.()}finally{x(!1)}},...p,children:d}),[p,d,h,f,b,w]),C=u(()=>t(we,{variant:"secondary",onClick:e=>{m?.(e),e.defaultPrevented||f?.()},children:l}),[m,f,l]),S={close:()=>{f?.()}};switch(typeof a){case"undefined":a=r(o,{children:[C,k]});break;case"function":a=a({okButton:k,cancelButton:C,action:S})}return r(N,{...v,onHide:f,show:s,children:[e&&t(N.Header,{closeButton:c,children:t(N.Title,{as:y,children:e})}),t(N.Body,{as:g,children:n}),a&&t(N.Footer,{children:a})]})};Ce.Message=function(e){const[n,r]=i(he);return c(()=>{ue=r},[]),t(se.Provider,{value:e,children:Array.from(n).map((e,n)=>t(h,{children:e},`message-${n}`))})},Ce.confirm=function(e){return de(le(ve))(e)},Ce.prompt=function(e){return de(le(g(ke)))(e)},Ce.show=pe;const Ne=["default","error","warning","success","info"].reduce((e,n)=>(e[n]=(e,t)=>A(e,{variant:n,autoHideDuration:3e3,anchorOrigin:{vertical:"top",horizontal:"center"},...t}),e),{});function Se(e){return e&&"object"==typeof e}U.attach(),M.defaults.raxConfig={retryDelay:2e3,backoffType:"static",shouldRetry:({config:e,response:n})=>!(e.raxConfig?.retryDecider&&!e.raxConfig.retryDecider())&&("GET"===e.method?.toUpperCase()&&449===n?.status)},M.defaults.maxContentLength=1/0,M.defaults.maxBodyLength=1/0,M.defaults.baseURL="/api",M.defaults.authTokenName="authorization";const ze=M.isAxiosError,je=M.isCancel,Pe=e=>{if(!M.isAxiosError(e))throw e;Ne.error(e.message)},Te=function(e){e?.baseURL&&(e.baseURL=q.resolve(M.defaults.baseURL||"/",e.baseURL));const n=M.create(e);return U.attach(n),n.interceptors.request.use(e=>{const n=e.authTokenName;if(n){const t=localStorage.getItem(n);t&&(e.headers={Authorization:`Bearer ${t}`,...e.headers})}return e},e=>Promise.reject(e)),n.interceptors.response.use(e=>(201===e.status&&e.data.location&&(window.location.href=e.data.location,e.data=void 0),e),e=>{if(M.isAxiosError(e)&&e.response){const{data:n,status:t}=e.response;401===t?e.errors="Unauthorized":Se(n)?422===t?e.errors=n:"message"in n&&(e.errors=n.message):e.errors=n,"string"!=typeof e.errors?e.message=Object.values(e.errors).join("<br />"):e.message=e.errors}return Promise.reject(e)}),n},$e=async function(e,n){if(n||(n=Te()),e="string"==typeof e?{url:e}:e,(e={paramsSerializer:function(e){return O.stringify(e,{sort:!1,skipNull:!0,skipEmptyString:!0,arrayFormat:"bracket"})},...e}).onMessage){let n=0,t="",r=null;const o=e.onMessage;e.onDownloadProgress=e=>{const a=e.target,{responseText:i}=a;for(;n<e.loaded;){const e=i.substring(n,++n);if(t+=e,"\n"===e){if(r||(r={id:"",event:"",data:""}),"\n"===t)o(r),r=null;else{const e=t.match(/^data:(?<data>.*)/);e&&(r.data=e.groups.data.trim())}t=""}}}}const{data:t}=await n.request(e);return t};$e.create=function(e){const n=Te(e),t=e=>$e(e,n);return t.interceptors=n.interceptors,t},$e.defaults=M.defaults,$e.interceptors=M.interceptors;function He(e){const n=(()=>{const e=a(!1);return c(()=>(e.current=!1,()=>{e.current=!0}),[]),e})(),[t,r]=i(e);return[t,d(e=>{n.current||r(e)},[])]}function Be(e,n={}){const{locale:t="zh-CN",currency:r=!0,...o}=n;let a;a=r?{style:"currency",currency:"CNY"}:{minimumFractionDigits:2};return new Intl.NumberFormat(t,{...a,...o}).format(e)}function Ee(e,{manual:n,refreshDeps:t,...r}={}){let{execute:o,currentParams:a,error:i,...s}=W(async n=>(e="string"==typeof e?{url:e}:e,await $e({...e,...n})),r);c(()=>{if(!n&&!t)try{o()}catch{}},[]),c(()=>{t&&l()},t);const l=d(async()=>{try{a?await o(...a):await o()}catch{}},[o,a]);if(i&&ze(i)){const e=i.errors;i=new Error("string"==typeof e?e:_(e).join(""))}return{refresh:l,execute:o,error:i,...s}}function De({active:e,inverted:n,...r}){return t(Le,{$active:e,$inverted:n,...r})}G.div`
2
- position: relative;
3
- `;const Le=G.div`
4
- display: ${e=>e.$active?"flex":"none"};
5
- position: absolute;
6
- top: 0 !important;
7
- left: 0 !important;
8
- width: 100%;
9
- height: 100%;
10
- text-align: center;
11
- vertical-align: middle;
12
- padding: 1em;
13
- background-color: ${e=>e.$inverted?"rgba(255, 255, 255, .85)":"rgba(0, 0, 0, .85)"};
14
- opacity: ${e=>e.$active?1:0};
15
- line-height: 1;
16
- animation-fill-mode: both;
17
- animation-duration: .5s;
18
- transition: background-color .5s linear;
19
- flex-direction: column;
20
- align-items: center;
21
- justify-content: center;
22
- user-select: none;
23
- will-change: opacity;
24
- z-index: 990;
25
- `;function _e({loading:e=!0,children:n,variant:o="primary",animation:a="border",wrap:i,...c}){return e?(n&&(n=t("p",{className:"mt-3 text-secondary",children:n})),n=r(De,{inverted:!0,active:!0,children:[t(k,{animation:a,variant:o,...c}),n]}),i?t(Re,{$height:"number"==typeof i?i:150,children:n}):n):null}const Re=G.div`
26
- position: relative;
27
- height: ${e=>`${e.$height}px`};
28
- `,Fe=f(async()=>{const{QRCodeSVG:e}=await import("qrcode.react");return{default:e}});function Me(e){return t(p,{fallback:null,children:t(Fe,{...e})})}const Oe=function({state:e,message:n,resolve:r}){const o=a(!0),{result:i,checkUrl:s,onComplete:l}=n,[d,u]=He(!1);return c(()=>{$e({url:s,method:"post",data:{order_no:i.order_no},raxConfig:{shouldRetry:e=>o.current&&449===e.response?.status}}).then(()=>{l?.(),r()}).catch(()=>null)},[]),t(Ce,{...e,centered:!0,onHide:()=>{o.current=!1,e.onHide()},backdrop:"static",header:"支付结果",okText:"已完成支付",okButtonProps:{loading:d},onOk:async e=>{e.preventDefault();try{u(!0),await $e({url:s,method:"post",data:{order_no:i.order_no,force:!0},raxConfig:{shouldRetry:()=>!1}}),l?.(),r()}catch(e){ze(e)&&Ne.error(e.message)}finally{u(!1)}},cancelText:"取消",children:"请在新打开的页面上进行支付,支付完成后再关闭此窗口"})},Ue=function({state:e,message:n,resolve:o}){const i=a(!0),{result:{pay_options:s,order_no:l},checkUrl:d,onComplete:u}=n,[h,m]=He(s.channels.alipay?"alipay":"wechat"),[f,p]=He(!1);c(()=>{$e({url:d,method:"post",data:{order_no:l},raxConfig:{shouldRetry:e=>i.current&&449===e.response?.status}}).then(()=>{u?.(),o()}).catch(()=>null)},[]);const{loading:g,result:y}=Ee({url:s.url,method:"POST",data:{channel:h,order_no:l}},{refreshDeps:[h]});return r(Ce,{...e,onHide:()=>{i.current=!1,e.onHide()},centered:!0,backdrop:"static",header:"收银台",okText:"已完成支付",okButtonProps:{loading:f},onOk:async e=>{e.preventDefault();try{p(!0),await $e({url:d,method:"post",data:{order_no:l,force:{channel:h}},raxConfig:{shouldRetry:()=>!1}}),u?.(),o()}catch(e){ze(e)&&Ne.error(e.message)}finally{p(!1)}},cancelText:"取消",children:[r("dl",{className:"row",children:[t("dt",{className:"col-3",children:"商品名称"}),t("dd",{className:"col-9",children:s.subject})]}),r("dl",{className:"row",children:[t("dt",{className:"col-3",children:"支付金额"}),t("dd",{className:"col-9 text-success h3",children:Be(s.amount/100)})]}),r("dl",{className:"row",children:[t("dt",{className:"col-3",children:"支付方式"}),t("dd",{className:"col-9",children:r(S,{children:[s.channels.alipay&&t(z,{id:"payment-alipay",type:"radio",variant:"alipay"===h?"primary":"outline-primary",name:"alipay",value:"alipay",checked:"alipay"===h,onChange:()=>m("alipay"),children:"支付宝"}),s.channels.alipay&&t(z,{id:"payment-wechat",type:"radio",variant:"wechat"===h?"primary":"outline-primary",name:"wechat",value:"wechat",checked:"wechat"===h,onChange:()=>m("wechat"),children:"微信支付"})]})})]}),r("dl",{className:"row mb-0",children:[t("dt",{className:"col-3",children:"扫码支付"}),r("dd",{className:"col-9",children:[t(_e,{loading:g,wrap:200}),y&&t(Me,{size:200,value:y.data})]})]})]})};function Ae(e){const{result:n}=e;n.pay_url?(window.opener=null,window.innerWidth<992?location.href=n.pay_url:(window.open(n.pay_url),pe(Oe,e))):pe(Ue,e)}function Ie(e,n=2){const t=["","K","M","G"];let r=0;for(;e>=1024&&r<t.length-1;)e/=1024,r++;return e%1==0&&(n=0),e.toFixed(n)+t[r]}function qe(e,n=2){const t=["","K","M","G"];let r=0;for(;e>=1e3&&r<t.length-1;)e/=1e3,r++;return e%1==0&&(n=0),e.toFixed(n)+t[r]}function We(e){const n=q.extname(e);return!(!/^data:image\//.test(e)&&!/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i.test(n))||!/^data:/.test(e)&&!n}function Ge(e){if(/^https?:\/\//.test(e))return e;const n=document.createElement("a");return n.href=e,n.href}Y.locale("zh-cn"),Y.extend(Q),Y.extend(J);const Ke={success:t("i",{className:"bi bi-check-circle-fill text-success"}),error:t("i",{className:"bi bi-exclamation-circle-fill text-danger"}),info:t("i",{className:"bi bi-info-circle-fill text-info"}),warning:t("i",{className:"bi bi-exclamation-triangle-fill text-warning"})};function Ve({className:e,status:n,title:o,icon:a,extra:i}){return!a&&n&&(a=Ke[n]),r(Ye,{className:e,children:[a&&t(Qe,{children:a}),o&&t(Je,{children:o}),i&&t(Xe,{children:i})]})}const Ye=G.div`
29
- padding: 48px 32px;
30
- `,Qe=G.div`
31
- margin-bottom: 24px;
32
- text-align: center;
33
- font-size: 72px;
34
- `,Je=G.div`
35
- color: rgba(0, 0, 0, .85);
36
- font-size: 24px;
37
- line-height: 1.8;
38
- text-align: center;
39
- `,Xe=G.div`
40
- margin-top: 32px;
41
- text-align: center;
42
- `;function Ze({children:e,title:n,className:a,...i}){return t(en,{className:X("border-0 shadow-sm",a),...i,children:r("div",{className:"card-body",children:[n&&r(o,{children:[t("h5",{children:n}),t("hr",{})]}),e]})})}const en=G(j)`
43
- &:not(:last-child) {
44
- margin-bottom: 1rem;
45
- }
46
- `,nn=s(void 0);function tn({children:e}){const[n,r]=i(new Set),o=d(e=>{e&&"string"==typeof e&&(e=[e]),r(new Set(e))},[r]);return t(nn.Provider,{value:[n,r],children:t(P,{activeKey:Array.from(n),onSelect:o,alwaysOpen:!0,children:e})})}const rn=()=>{const e=l(nn);if(!e)throw new Error("usePanel must be used within a PanelGroup");return e};function on({title:e,action:n,children:a,eventKey:i,open:s}){if(i){const[,e]=rn();c(()=>{void 0!==s&&e(e=>s?new Set([...e,i]):new Set([...e].filter(e=>e!==i)))},[s]),a=t(P.Collapse,{eventKey:i,children:r(o,{children:[t("hr",{}),a]})})}else a=r(o,{children:[t("hr",{}),a]});return r(Ze,{children:[r(T,{direction:"horizontal",children:[t("div",{className:"fs-5 me-auto",children:e}),n]}),a]})}function an({errors:e}){return e?t($,{variant:"danger",children:t("ul",{className:"mb-0",children:"string"==typeof e?t("li",{children:e}):Object.entries(e).map(([e,n])=>t("li",{children:n},e))})}):null}function cn({children:e,className:n,size:r="small",direction:o="horizontal"}){"string"==typeof r&&(r={small:8,middle:16,large:24}[r]);const a=y.map(e,e=>{if(e)return t(ln,{children:e})});return t(sn,{className:n,$direction:o,$size:r,children:a})}const sn=G.div`
47
- display: inline-flex;
48
- align-items: center;
49
- gap: ${e=>e.$size}px;
50
-
51
- ${e=>"vertical"===e.$direction&&K`
52
- display: flex;
53
- flex-direction: column;
54
- align-items: inherit;
55
- `}
56
- `,ln=G.div`
57
-
58
- `,dn=f(()=>import("./steps-DECts1pI.js")),un=f(()=>import("./steps-DECts1pI.js").then(({Step:e})=>({default:e})));function hn(e){return t(p,{fallback:null,children:t(dn,{...e})})}const mn=function(e){return t(p,{fallback:null,children:t(un,{...e})})};function fn({title:e,content:n,footer:o}){return r(Ze,{children:[t(yn,{children:e}),t(gn,{children:n}),o&&t(pn,{children:o})]})}hn.Step=mn;const pn=G.div`
59
- margin-top: 9px;
60
- padding-top: 10px;
61
- border-top: 1px solid #f0f0f0;
62
- color: rgba(0, 0, 0, .65);
63
- `,gn=G.div`
64
- color: rgba(0, 0, 0, .85);
65
- font-size: 24px;
66
- `,yn=G.div`
67
- margin-bottom: 4px;
68
- color: rgba(0, 0, 0, .45);
69
- font-size: 1.1rem;
70
- `;function wn(){}function vn(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}function bn(e){return"current_page"in e}function xn({total:e=0,onChange:n=wn,defaultCurrent:o=1,defaultPageSize:a=10,className:s,...l}){const[h,m]=i(o),[f,p]=i(a);c(()=>{vn(l.current)&&m(l.current)},[l.current]),c(()=>{vn(l.pageSize)&&p(l.pageSize)},[l.pageSize]);const g=u(()=>Math.floor((e-1)/f)+1,[e,f]),y=d(e=>()=>{e!==h&&(m(e),n(e,f))},[n,h,f]),w=h-1>0?h-1:0,v=h+1<g?h+1:g,b=[];let x=null,k=null,C=null,N=null;if(g<=7)for(let e=1;e<=g;e+=1){const n=h===e;b.push(t(H.Item,{active:n,onClick:y(e),children:e},e))}else{N=t(H.Last,{onClick:y(g)},"last"),C=t(H.First,{onClick:y(1)},"first"),x=t(H.Prev,{onClick:y(w)},"prev"),k=t(H.Next,{onClick:y(v)},"next");let e=Math.max(1,h-2),n=Math.min(h+2,g);h-1<=2&&(n=5),g-h<=2&&(e=g-4);for(let r=e;r<=n;r+=1){const e=h===r;b.push(t(H.Item,{active:e,onClick:y(r),children:r},r))}h-1>=4&&3!==h&&b.unshift(x),g-h>=4&&h!==g-2&&b.push(k),1!==e&&b.unshift(C),n!==g&&b.push(N)}return r("div",{className:X("mb-3 d-flex align-column-center justify-content-between",s),children:[r("div",{className:"d-flex align-items-center",children:["共 ",e," 条"]}),t(H,{className:"mb-0",children:b})]})}function kn({className:e,value:n,locale:r="zh-CN",currency:a=!0,options:i={}}){const c=u(()=>{let e;return e=a?{style:"currency",currency:"CNY"}:{minimumFractionDigits:2},new Intl.NumberFormat(r,{...e,...i})},[a,r,i]);return e?t("span",{className:e,children:c.format(n)}):t(o,{children:c.format(n)})}function Cn({loading:e,disabled:n,children:r,...o}){return t(C,{...o,disabled:e||n,children:e?"Loading…":r})}const Nn=f(()=>import("./image-zoom-He8CEHjx.js"));function Sn(e){return t(p,{fallback:null,children:t(Nn,{...e})})}const zn=m(({confirm:e,onSuccess:n,children:t,disabled:r,as:o=we,onError:a,...i},c)=>{const[s,l]=He(!1),u=d(async t=>{t.preventDefault(),t.stopPropagation();try{if(l(!0),e&&!await Ce.confirm({message:e}))return;let t;if("onRequest"in i)t=await i.onRequest();else{const e="string"==typeof i.url?{url:i.url,method:i.method}:{method:i.method,...i.url};t=await $e(e)}n&&n(t)}catch(t){if(!(t instanceof Error))throw t;a?a(t):Ne.error(t.message,{preventDuplicate:!0})}finally{l(!1)}},[i,l]);return w(o,{...R(i,["onRequest","url","method"]),disabled:r||s,onClick:u,ref:c},t)}),jn=f(()=>import("./index-CCwsCAqz.js")),Pn=m((e,n)=>t(p,{fallback:null,children:t(jn,{...e,ref:n})}));let Tn=0;function $n({onHide:e,onShow:n}={}){const[t,r]=i(!1),[o,a]=i(`visible-${Tn}`),c=d(()=>{r(!1),e&&e()},[r,e]),s=d(()=>{a("visible-"+ ++Tn)},[a,Tn]);return{visible:t,show:d(()=>{r(!0),n&&n()},[r,n]),hide:c,state:{show:t,onHide:c,onExited:s,key:o}}}const Hn=m(({text:e,onOk:n,modalProps:a,children:i,onShow:c,onHide:s,confirmLoading:l,as:d=we,...u},h)=>{const{state:m,show:f,hide:p}=$n({onShow:c,onHide:s});v(h,()=>({close:p}));const g=w(d,{...u,onClick:e=>{e.preventDefault(),e.stopPropagation(),f()}},e);return r(o,{children:[g,t(Ce,{header:e,...a,...m,confirmLoading:l,onOk:async e=>{if(n){!1===await n()&&e.preventDefault()}},children:i})]})}),Bn=m(({text:e,onSuccess:n,onSubmit:o,buttonProps:c,modalProps:s,children:l,...u},h)=>{const[m,f]=i(!1),p=a(null),g=a(null);v(h,()=>({close:()=>{p.current?.close()}}));const y=d(async()=>(g.current?.submit().catch(()=>{}),!1),[]),w=d((e,t)=>{n&&n(e,t),p.current?.close()},[n]),b=d(async(e,n)=>{o&&await o(e,n)&&p.current?.close()},[o]);return t(Hn,{ref:p,text:e,...c,modalProps:s,onOk:y,confirmLoading:m,children:r(xe,{...u,onSubmitting:f,ref:g,onSuccess:w,onSubmit:b,children:[l,t("input",{type:"submit",hidden:!0})]})})});function En({header:e,children:n,closable:o=!0,show:a,onHide:i,bodyAs:c,headerAs:s="h5",...l}){return r(B,{...l,onHide:i,show:a,children:[e&&t(B.Header,{closeButton:o,children:t(B.Title,{as:s,children:e})}),t(B.Body,{as:c,children:n})]})}const Dn=m(({text:e,offcanvasProps:n,children:a,onShow:i,onHide:c,as:s=we,...l},d)=>{const{state:u,show:h,hide:m}=$n({onShow:i,onHide:c});v(d,()=>({close:m}));const f=w(s,{...l,onClick:h},e);return r(o,{children:[f,t(En,{header:e,...n,...u,children:a})]})});function Ln(e,n=[]){const t=a(e);return c(()=>{t.current=e}),d((...e)=>t.current?.(...e),n)}function _n(e){const{value:n,defaultValue:t,onChange:r,shouldUpdate:o=(e,n)=>e!==n}=e,a=Ln(r),c=Ln(o),[s,l]=i(t),d=void 0!==n,u=d?n:s,h=Ln(e=>{const n="function"==typeof e?e(u):e;c(u,n)&&(d||l(n),a(n))},[d,a,u,c]);return[u,h]}const Rn=m(({className:e,rowClassName:n,paginate:o=!0,sync:s=!1,columns:l=3,source:u,renderItem:h,renderEmpty:m},f)=>{const[p,g]=i([]),[y,w]=i(o?{total:0,current:1,pageSize:10}:null),[b,x]=i(!0),[k,C]=Z({}),[N,S]=_n({value:s?k.page||1:void 0,defaultValue:1,onChange:e=>{s&&C({page:e||void 0})}}),z=d(async(e=!1)=>{e||x(!0);try{let e;const n={page:N>1?N:void 0};e="string"==typeof u?await $e({url:u,params:n}):await u(n),o&&bn(e)?(e.last_page>1?w({total:e.total,current:e.current_page,pageSize:e.per_page}):w(null),e=e.data):w(null),g(e)}catch(e){}finally{x(!1)}},[u,g,N]);c(()=>{z()},[N]),c(()=>{j.current={reload:z}},[z]);const j=a({reload:z});return v(f,()=>j.current),r(Fn,{className:e,children:[t(_e,{wrap:!0,loading:b}),0===p.length&&!b&&m?.(),t(E,{className:X(n,"g-4"),children:p.map((e,n)=>t(D,{className:"d-flex",md:12/l,children:h(e)},`card-${n}`))}),y&&t(Mn,{...y,onChange:S})]})}),Fn=G.div`
71
-
72
- `,Mn=G(xn)`
73
- margin-bottom: 0;
74
- justify-content: flex-end;
75
- margin-top: 1rem;
76
- `;var On=g(Rn);function Un(){const[e,n]=i(!1),t=a();return c(()=>()=>{t.current&&clearTimeout(t.current)},[]),{copied:e,copy:d(e=>{ee(e),n(!0),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{n(!1),t.current=void 0},3e3)},[])}}function An({as:e="div",className:n,content:r,tooltip:o=!0,placement:a}){const{copy:i,copied:c}=Un(),s=o?t("i",c?{className:"bi bi-clipboard-check"}:{className:"bi bi-clipboard"}):c?"已复制":"复制",l=w(e,{role:"button",className:n,onClick:()=>{"function"==typeof r&&(r=r()),i(r)}},s);return o?t(ge,{tooltip:c?"已复制":"复制",placement:a,children:l}):l}const In=s({images:new Map,current:0,setCurrent:()=>null,setShow:()=>null,registerImage:()=>()=>null,getId:()=>0}),qn=f(()=>import("./index-BfNBVFXj.js")),Wn=f(()=>import("./image-DWiUOp4i.js"));function Gn(e){return t(p,{fallback:null,children:t(qn,{...e})})}Gn.Image=function(e){return t(p,{fallback:null,children:t(Wn,{...e})})},Gn.Context=In;const Kn=f(()=>import("./infinite-scroller-D3orXKOG.js")),Vn=m((e,n)=>t(p,{fallback:null,children:t(Kn,{...e,ref:n})})),Yn=f(()=>import("./slider-DE41CkdN.js"));function Qn(e){return t(p,{fallback:null,children:t(Yn,{...e})})}function Jn({children:e}){return r(I,{children:[t(Xn,{}),e]})}const Xn=V`
77
- ${ne.extractCss()}
78
- `,Zn=f(()=>import("./cascader-BQf3OIMo.js"));function et(e){return t(p,{fallback:null,children:t(Zn,{...e})})}const nt=f(()=>import("./select-CwDOdXXH.js"));function tt(e){return t(p,{fallback:null,children:t(nt,{...e})})}function rt(e,n,t){const r=a(e),o=a(F(e,n,t));return c(()=>{r.current=e}),c(()=>{o.current=F((...e)=>{r.current(...e)},n,t)},[n,t]),o.current}function ot(e){const[n,t]=i(()=>te("function"==typeof e?e():e,!0));return[n,d(e=>{t("function"==typeof e?re(e):te(e))},[])]}function at(e="lg"){function n(){const n=e=>{switch(e){case"xxl":return window.innerWidth>=1400;case"xl":return window.innerWidth>=1200;case"lg":return window.innerWidth>=992;case"md":return window.innerWidth>=768;case"sm":return window.innerWidth>=576;default:return!0}};return{isMobile:!n(e),width:window.innerWidth,match:n}}const[t,r]=i(n),o=rt(()=>{r(n())},100);return c(()=>(window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)),[]),t}var it;!function(e){e[e.init=0]="init",e[e.play=1]="play",e[e.pause=2]="pause",e[e.end=3]="end"}(it||(it={}));const ct=(e,n)=>{let t=a(!1);const[r,o]=i(()=>{const{lang:e="default",name:t=""}=n.voice||{};return{isPlaying:!1,status:it[it.init],lang:n.lang||"default",voiceInfo:{lang:e,name:t},rate:n.rate||1,pitch:n.pitch||1,volume:n.volume||1}}),s=d(()=>{t.current&&o(e=>({...e,isPlaying:!0,status:it[it.play]}))},[]),l=d(()=>{t.current&&o(e=>({...e,isPlaying:!1,status:it[it.pause]}))},[]),u=d(()=>{t.current&&o(e=>({...e,isPlaying:!1,status:it[it.end]}))},[]);return c(()=>{t.current=!0;const r=new SpeechSynthesisUtterance(e);return n.lang&&(r.lang=n.lang),n.voice&&(r.voice=n.voice),r.rate=n.rate||1,r.pitch=n.pitch||1,r.volume=n.volume||1,r.onstart=s,r.onpause=l,r.onresume=s,r.onend=u,window.speechSynthesis.speak(r),()=>{t.current=!1}},[]),r};function st(e,n){c(()=>{const n=e();!async function(){await n}()},n)}export{$n as $,Hn as A,we as B,Ze as C,Ce as D,an as E,xe as F,En as G,ge as H,In as I,On as J,An as K,_e as L,ce as M,kn as N,Dn as O,xn as P,Gn as Q,Ve as R,cn as S,ye as T,Vn as U,Qn as V,Me as W,Jn as X,et as Y,tt as Z,Ee as _,at as a,Un as a0,ct as a1,st as a2,ze as a3,je as a4,Pe as a5,_n as b,He as c,ot as d,Ne as e,Se as f,Ie as g,Be as h,bn as i,qe as j,We as k,Ge as l,on as m,tn as n,rn as o,hn as p,mn as q,$e as r,fn as s,Cn as t,rt as u,Sn as v,Ae as w,zn as x,Pn as y,Bn as z};