aiex-cli 0.1.1-beta.1 → 0.1.1-beta.2
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.
- package/README.md +3 -2
- package/dist/cli.mjs +262 -30
- package/dist/{generate-drizzle-schema-CaSMqQWx.mjs → generate-drizzle-schema-sZ01QiYJ.mjs} +131 -22
- package/dist/index.d.mts +18 -2
- package/dist/index.mjs +1 -1
- package/dist/table-schema.json +37 -9
- package/dist/web/assets/{AISettings-CxoghpZX.js → AISettings-CRumcTjo.js} +10 -10
- package/dist/web/assets/{DataBrowser-BqmnFDWC.js → DataBrowser-BqRaZJrX.js} +2 -2
- package/dist/web/assets/{ExtractionViewer-Bs8c6xa2.js → ExtractionViewer-lbdQGv2F.js} +1 -1
- package/dist/web/assets/{JsonSchemaEditor-ITVm2zG1.js → JsonSchemaEditor-BywWmkGm.js} +9 -9
- package/dist/web/assets/api-client-CpqFbcyH.js +1 -0
- package/dist/web/assets/{index-DhL7jaO_.js → index-7jWPnI_e.js} +8 -8
- package/dist/web/assets/index-BiNFY3ky.css +2 -0
- package/dist/web/assets/object-utils-OmJ-hFrY.js +1 -0
- package/dist/web/index.html +4 -4
- package/dist/{zh-CN-Cs4MViVi.mjs → zh-CN-BAGJklRp.mjs} +7 -3
- package/package.json +1 -1
- package/dist/web/assets/api-client-EJKabzZK.js +0 -1
- package/dist/web/assets/index-D0So2rJE.css +0 -2
- package/dist/web/assets/object-utils-CqCiBqJ4.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as e,B as t,C as n,D as r,F as i,H as a,K as o,L as s,O as c,Q as l,R as ee,S as u,T as d,W as f,X as p,_t as m,gt as h,ht as g,lt as _,nt as v,q as y,rt as b,tt as te,vt as x,w as S,x as C,y as w,yt as T}from"./vue-i18n-Du42D0vb.js";var E=1,D=new class{subscribers;toasts;dismissedToasts;constructor(){this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)});publish=e=>{this.subscribers.forEach(t=>t(e))};addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]};create=e=>{let{message:t,...n}=e,r=typeof e.id==`number`||e.id&&e.id?.length>0?e.id:E++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r};dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e);message=(e,t)=>this.create({...t,message:e,type:`default`});error=(e,t)=>this.create({...t,type:`error`,message:e});success=(e,t)=>this.create({...t,type:`success`,message:e});info=(e,t)=>this.create({...t,type:`info`,message:e});warning=(e,t)=>this.create({...t,type:`warning`,message:e});loading=(e,t)=>this.create({...t,type:`loading`,message:e});promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),a=n!==void 0,o,s=r.then(async e=>{if(o=[`resolve`,e],i(e))a=!1,this.create({id:n,type:`default`,message:e});else if(k(e)&&!e.ok){a=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,o=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,s=typeof r==`object`&&!i(r)?r:{message:r||``,id:n||``};this.create({id:n,type:`error`,description:o,...s})}else if(e instanceof Error){a=!1;let r=typeof t.error==`function`?await t.error(e):t.error,o=typeof t.description==`function`?await t.description(e):t.description,s=typeof r==`object`&&!i(r)?r:{message:r||``,id:n||``};this.create({id:n,type:`error`,description:o,...s})}else if(t.success!==void 0){a=!1;let r=typeof t.success==`function`?await t.success(e):t.success,o=typeof t.description==`function`?await t.description(e):t.description,s=typeof r==`object`&&!i(r)?r:{message:r||``,id:n||``};this.create({id:n,type:`success`,description:o,...s})}}).catch(async e=>{if(o=[`reject`,e],t.error!==void 0){a=!1;let r=typeof t.error==`function`?await t.error(e):t.error,o=typeof t.description==`function`?await t.description(e):t.description,s=typeof r==`object`&&!i(r)?r:{message:r||``,id:n||``};this.create({id:n,type:`error`,description:o,...s})}}).finally(()=>{a&&(this.dismiss(n),n=void 0),t.finally?.()}),c=()=>new Promise((e,t)=>s.then(()=>o[0]===`reject`?t(o[1]):e(o[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:c}:Object.assign(n,{unwrap:c})};custom=(e,t)=>{let n=t?.id||E++,r=this.toasts.find(e=>e.id===n),i=t?.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(n)&&this.dismissedToasts.delete(n),r?this.toasts=this.toasts.map(r=>r.id===n?(this.publish({...r,component:e,dismissible:i,id:n,...t}),{...r,component:e,dismissible:i,id:n,...t}):r):this.addToast({component:e,dismissible:i,id:n,...t}),n};getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id))};function O(e,t){let n=t?.id||E++;return D.create({message:e,id:n,type:`default`,...t}),n}var k=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,A=Object.assign(O,{success:D.success,info:D.info,warning:D.warning,error:D.error,custom:D.custom,message:D.message,promise:D.promise,dismiss:D.dismiss,loading:D.loading},{getHistory:()=>D.toasts,getToasts:()=>D.getActiveToasts()});function j(e){return e.label!==void 0}var M=3,N=`24px`,P=`16px`,ne=4e3,re=356,F=14,ie=45,ae=200;function oe(){let e=_(!1);return v(()=>{let t=()=>{e.value=document.hidden};return document.addEventListener(`visibilitychange`,t),()=>window.removeEventListener(`visibilitychange`,t)}),{isDocumentHidden:e}}function I(...e){return e.filter(Boolean).join(` `)}function se(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}function ce(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?P:N;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var le=[`data-rich-colors`,`data-styled`,`data-mounted`,`data-promise`,`data-swiped`,`data-removed`,`data-visible`,`data-y-position`,`data-x-position`,`data-index`,`data-front`,`data-swiping`,`data-dismissible`,`data-type`,`data-invert`,`data-swipe-out`,`data-swipe-direction`,`data-expanded`,`data-testid`],ue=[`aria-label`,`data-disabled`,`data-close-button-position`],de=e({__name:`Toast`,props:{toast:{},toasts:{},index:{},swipeDirections:{},expanded:{type:Boolean},invert:{type:Boolean},heights:{},gap:{},position:{},closeButtonPosition:{},visibleToasts:{},expandByDefault:{type:Boolean},closeButton:{type:Boolean},interacting:{type:Boolean},style:{},cancelButtonStyle:{},actionButtonStyle:{},duration:{},class:{},unstyled:{type:Boolean},descriptionClass:{},loadingIcon:{},classes:{},icons:{},closeButtonAriaLabel:{},defaultRichColors:{type:Boolean}},emits:[`update:heights`,`update:height`,`removeToast`],setup(e,{emit:i}){let o=e,c=i,l=_(null),b=_(null),E=_(!1),D=_(!1),O=_(!1),k=_(!1),A=_(!1),M=_(0),N=_(0),P=_(o.toast.duration||o.duration||ne),re=_(null),F=_(null),ce=C(()=>o.index===0),de=C(()=>o.index+1<=o.visibleToasts),L=C(()=>o.toast.type),R=C(()=>o.toast.dismissible!==!1),fe=C(()=>o.toast.class||``),pe=C(()=>o.descriptionClass||``),me=C(()=>{let e=o.toast.position||o.position,t=o.heights.filter(t=>t.position===e).findIndex(e=>e.toastId===o.toast.id);return t>=0?t:0}),he=C(()=>{let e=o.toast.position||o.position;return o.heights.filter(t=>t.position===e).reduce((e,t,n)=>n>=me.value?e:e+t.height,0)}),z=C(()=>me.value*o.gap+he.value||0),ge=C(()=>o.toast.closeButton??o.closeButton),_e=C(()=>o.toast.duration||o.duration||ne),B=_(0),ve=_(0),V=_(null),ye=C(()=>o.position.split(`-`)),be=C(()=>ye.value[0]),xe=C(()=>ye.value[1]),Se=C(()=>typeof o.toast.title!=`string`),Ce=C(()=>typeof o.toast.description!=`string`),{isDocumentHidden:we}=oe(),H=C(()=>L.value&&L.value===`loading`);a(()=>{E.value=!0,P.value=_e.value}),v(async()=>{if(!E.value||!F.value)return;await ee();let e=F.value,t=e.style.height;e.style.height=`auto`;let n=e.getBoundingClientRect().height;e.style.height=t,N.value=n,c(`update:height`,{toastId:o.toast.id,height:n,position:o.toast.position||o.position})});function U(){D.value=!0,M.value=z.value,setTimeout(()=>{c(`removeToast`,o.toast)},ae)}function Te(){if(H.value||!R.value)return{};U(),o.toast.onDismiss?.(o.toast)}function Ee(e){e.button!==2&&(H.value||!R.value||(re.value=new Date,M.value=z.value,e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(O.value=!0,V.value={x:e.clientX,y:e.clientY})))}function De(){if(k.value||!R.value)return;V.value=null;let e=Number(F.value?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(F.value?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),n=new Date().getTime()-(re.value?.getTime()||0),r=l.value===`x`?e:t,i=Math.abs(r)/n;if(Math.abs(r)>=ie||i>.11){M.value=z.value,o.toast.onDismiss?.(o.toast),l.value===`x`?b.value=e>0?`right`:`left`:b.value=t>0?`down`:`up`,U(),k.value=!0;return}else F.value?.style.setProperty(`--swipe-amount-x`,`0px`),F.value?.style.setProperty(`--swipe-amount-y`,`0px`);A.value=!1,O.value=!1,l.value=null}function Oe(e){if(!V.value||!R.value||(window?.getSelection()?.toString()?.length??!1))return;let t=e.clientY-V.value.y,n=e.clientX-V.value.x,r=o.swipeDirections??se(o.position);!l.value&&(Math.abs(n)>1||Math.abs(t)>1)&&(l.value=Math.abs(n)>Math.abs(t)?`x`:`y`);let i={x:0,y:0},a=e=>1/(1.5+Math.abs(e)/20);if(l.value===`y`){if(r.includes(`top`)||r.includes(`bottom`))if(r.includes(`top`)&&t<0||r.includes(`bottom`)&&t>0)i.y=t;else{let e=t*a(t);i.y=Math.abs(e)<Math.abs(t)?e:t}}else if(l.value===`x`&&(r.includes(`left`)||r.includes(`right`)))if(r.includes(`left`)&&n<0||r.includes(`right`)&&n>0)i.x=n;else{let e=n*a(n);i.x=Math.abs(e)<Math.abs(n)?e:n}(Math.abs(i.x)>0||Math.abs(i.y)>0)&&(A.value=!0),F.value?.style.setProperty(`--swipe-amount-x`,`${i.x}px`),F.value?.style.setProperty(`--swipe-amount-y`,`${i.y}px`)}a(()=>{if(E.value=!0,!F.value)return;let e=F.value.getBoundingClientRect().height;N.value=e,c(`update:heights`,[{toastId:o.toast.id,height:e,position:o.toast.position},...o.heights])}),t(()=>{F.value&&c(`removeToast`,o.toast)}),v(e=>{if(o.toast.promise&&L.value===`loading`||o.toast.duration===1/0||o.toast.type===`loading`)return;let t;o.expanded||o.interacting||we.value?(()=>{if(ve.value<B.value){let e=new Date().getTime()-B.value;P.value-=e}ve.value=new Date().getTime()})():P.value!==1/0&&(B.value=new Date().getTime(),t=setTimeout(()=>{o.toast.onAutoClose?.(o.toast),U()},P.value)),e(()=>{clearTimeout(t)})}),te(()=>o.toast.delete,e=>{e!==void 0&&e&&(U(),o.toast.onDismiss?.(o.toast))},{deep:!0});function ke(){O.value=!1,l.value=null,V.value=null}return(e,t)=>(f(),d(`li`,{tabindex:`0`,ref_key:`toastRef`,ref:F,class:h(g(I)(o.class,fe.value,e.classes?.toast,e.toast.classes?.toast,e.classes?.[L.value],e.toast?.classes?.[L.value])),"data-sonner-toast":``,"data-rich-colors":e.toast.richColors??e.defaultRichColors,"data-styled":!(e.toast.component||e.toast?.unstyled||e.unstyled),"data-mounted":E.value,"data-promise":!!e.toast.promise,"data-swiped":A.value,"data-removed":D.value,"data-visible":de.value,"data-y-position":be.value,"data-x-position":xe.value,"data-index":e.index,"data-front":ce.value,"data-swiping":O.value,"data-dismissible":R.value,"data-type":L.value,"data-invert":e.toast.invert||e.invert,"data-swipe-out":k.value,"data-swipe-direction":b.value,"data-expanded":!!(e.expanded||e.expandByDefault&&E.value),"data-testid":e.toast.testId,style:x({"--index":e.index,"--toasts-before":e.index,"--z-index":e.toasts.length-e.index,"--offset":`${D.value?M.value:z.value}px`,"--initial-height":e.expandByDefault?`auto`:`${N.value}px`,...e.style,...o.toast.style}),onDragend:ke,onPointerdown:Ee,onPointerup:De,onPointermove:Oe},[ge.value&&!e.toast.component&&L.value!==`loading`?(f(),d(`button`,{key:0,"aria-label":e.closeButtonAriaLabel||`Close toast`,"data-disabled":H.value,"data-close-button":`true`,"data-close-button-position":e.closeButtonPosition,class:h(g(I)(e.classes?.closeButton,e.toast?.classes?.closeButton)),onClick:Te},[e.icons?.close?(f(),n(p(e.icons?.close),{key:0})):y(e.$slots,`close-icon`,{key:1})],10,ue)):S(`v-if`,!0),e.toast.component?(f(),n(p(e.toast.component),s({key:1},e.toast.componentProps,{onCloseToast:Te,isPaused:e.$props.expanded||e.$props.interacting||g(we)}),null,16,[`isPaused`])):(f(),d(w,{key:2},[L.value!==`default`||e.toast.icon||e.toast.promise?(f(),d(`div`,{key:0,"data-icon":``,class:h(g(I)(e.classes?.icon,e.toast?.classes?.icon))},[e.toast.icon?(f(),n(p(e.toast.icon),{key:0})):(f(),d(w,{key:1},[L.value===`loading`?y(e.$slots,`loading-icon`,{key:0}):L.value===`success`?y(e.$slots,`success-icon`,{key:1}):L.value===`error`?y(e.$slots,`error-icon`,{key:2}):L.value===`warning`?y(e.$slots,`warning-icon`,{key:3}):L.value===`info`?y(e.$slots,`info-icon`,{key:4}):S(`v-if`,!0)],64))],2)):S(`v-if`,!0),u(`div`,{"data-content":``,class:h(g(I)(e.classes?.content,e.toast?.classes?.content))},[u(`div`,{"data-title":``,class:h(g(I)(e.classes?.title,e.toast.classes?.title))},[Se.value?(f(),n(p(e.toast.title),m(s({key:0},e.toast.componentProps)),null,16)):(f(),d(w,{key:1},[r(T(e.toast.title),1)],64))],2),e.toast.description?(f(),d(`div`,{key:0,"data-description":``,class:h(g(I)(e.descriptionClass,pe.value,e.classes?.description,e.toast.classes?.description))},[Ce.value?(f(),n(p(e.toast.description),m(s({key:0},e.toast.componentProps)),null,16)):(f(),d(w,{key:1},[r(T(e.toast.description),1)],64))],2)):S(`v-if`,!0)],2),e.toast.cancel?(f(),d(`button`,{key:1,style:x(e.toast.cancelButtonStyle||e.cancelButtonStyle),class:h(g(I)(e.classes?.cancelButton,e.toast.classes?.cancelButton)),"data-button":``,"data-cancel":``,onClick:t[0]||=t=>{g(j)(e.toast.cancel)&&R.value&&(e.toast.cancel.onClick?.(t),U())}},T(g(j)(e.toast.cancel)?e.toast.cancel?.label:e.toast.cancel),7)):S(`v-if`,!0),e.toast.action?(f(),d(`button`,{key:2,style:x(e.toast.actionButtonStyle||e.actionButtonStyle),class:h(g(I)(e.classes?.actionButton,e.toast.classes?.actionButton)),"data-button":``,"data-action":``,onClick:t[1]||=t=>{g(j)(e.toast.action)&&(e.toast.action.onClick?.(t),!t.defaultPrevented&&U())}},T(g(j)(e.toast.action)?e.toast.action?.label:e.toast.action),7)):S(`v-if`,!0)],64))],46,le))}}),L=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},R={},fe={xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stoke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`};function pe(e,t){return f(),d(`svg`,fe,t[0]||=[u(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`},null,-1),u(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`},null,-1)])}var me=L(R,[[`render`,pe]]),he=[`data-visible`],z={class:`sonner-spinner`},ge=e({__name:`Loader`,props:{visible:{type:Boolean}},setup(e){let t=Array(12).fill(0);return(e,n)=>(f(),d(`div`,{class:`sonner-loading-wrapper`,"data-visible":e.visible},[u(`div`,z,[(f(!0),d(w,null,o(g(t),e=>(f(),d(`div`,{key:`spinner-bar-${e}`,class:`sonner-loading-bar`}))),128))])],8,he))}}),_e={},B={xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`};function ve(e,t){return f(),d(`svg`,B,t[0]||=[u(`path`,{"fill-rule":`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,"clip-rule":`evenodd`},null,-1)])}var V=L(_e,[[`render`,ve]]),ye={},be={xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`};function xe(e,t){return f(),d(`svg`,be,t[0]||=[u(`path`,{"fill-rule":`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,"clip-rule":`evenodd`},null,-1)])}var Se=L(ye,[[`render`,xe]]),Ce={},we={xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`};function H(e,t){return f(),d(`svg`,we,t[0]||=[u(`path`,{"fill-rule":`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,"clip-rule":`evenodd`},null,-1)])}var U=L(Ce,[[`render`,H]]),Te={},Ee={xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`};function De(e,t){return f(),d(`svg`,Ee,t[0]||=[u(`path`,{"fill-rule":`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,"clip-rule":`evenodd`},null,-1)])}var Oe=L(Te,[[`render`,De]]),ke=[`aria-label`],Ae=[`data-sonner-theme`,`dir`,`data-theme`,`data-rich-colors`,`data-y-position`,`data-x-position`],je=typeof window<`u`&&typeof document<`u`;function Me(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}var Ne=e({name:`Toaster`,inheritAttrs:!1,__name:`Toaster`,props:{id:{},invert:{type:Boolean,default:!1},theme:{default:`light`},position:{default:`bottom-right`},closeButtonPosition:{default:`top-left`},hotkey:{default:()=>[`altKey`,`KeyT`]},richColors:{type:Boolean,default:!1},expand:{type:Boolean,default:!1},duration:{},gap:{default:F},visibleToasts:{default:M},closeButton:{type:Boolean,default:!1},toastOptions:{default:()=>({})},class:{default:``},style:{},offset:{default:N},mobileOffset:{default:P},dir:{default:`auto`},swipeDirections:{},icons:{},containerAriaLabel:{default:`Notifications`}},setup(e){let t=e,r=l(),i=_([]),a=C(()=>t.id?i.value.filter(e=>e.toasterId===t.id):i.value.filter(e=>!e.toasterId));function p(e,t){return a.value.filter(n=>!n.position&&t===0||n.position===e)}let m=C(()=>{let e=a.value.filter(e=>e.position).map(e=>e.position);return e.length>0?Array.from(new Set([t.position].concat(e))):[t.position]}),te=C(()=>{let e={};return m.value.forEach(t=>{e[t]=i.value.filter(e=>e.position===t)}),e}),T=_([]),E=_({}),O=_(!1);v(()=>{m.value.forEach(e=>{e in E.value||(E.value[e]=!1)})});let k=_(t.theme===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:t.theme),A=_(null),j=_(null),M=_(!1),N=t.hotkey.join(`+`).replace(/Key/g,``).replace(/Digit/g,``);function P(e){i.value.find(t=>t.id===e.id)?.delete||D.dismiss(e.id),i.value=i.value.filter(({id:t})=>t!==e.id),setTimeout(()=>{i.value.find(t=>t.id===e.id)||(T.value=T.value.filter(t=>t.toastId!==e.id))},ae+50)}function ne(e){M.value&&!e.currentTarget?.contains?.(e.relatedTarget)&&(M.value=!1,j.value&&=(j.value.focus({preventScroll:!0}),null))}function F(e){e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||M.value||(M.value=!0,j.value=e.relatedTarget)}function ie(e){e.target&&e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||(O.value=!0)}v(e=>{e(D.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{i.value=i.value.map(t=>t.id===e.id?{...t,delete:!0}:t)});return}ee(()=>{let t=i.value.findIndex(t=>t.id===e.id);t===-1?i.value=[e,...i.value]:i.value=[...i.value.slice(0,t),{...i.value[t],...e},...i.value.slice(t+1)]})}))}),v(e=>{if(typeof window>`u`)return;if(t.theme!==`system`){k.value=t.theme;return}let n=window.matchMedia(`(prefers-color-scheme: dark)`),r=e=>{k.value=e?`dark`:`light`};r(n.matches);let i=e=>{r(e.matches)};try{n.addEventListener(`change`,i)}catch{n.addListener(i)}e(()=>{try{n.removeEventListener(`change`,i)}catch{n.removeListener(i)}})}),v(()=>{A.value&&j.value&&(j.value.focus({preventScroll:!0}),j.value=null,M.value=!1)}),v(()=>{i.value.length<=1&&Object.keys(E.value).forEach(e=>{E.value[e]=!1})}),v(e=>{function n(e){let n=t.hotkey.every(t=>e[t]||e.code===t),r=Array.isArray(A.value)?A.value[0]:A.value;n&&(m.value.forEach(e=>{E.value[e]=!0}),r?.focus());let i=document.activeElement===A.value||r?.contains(document.activeElement);e.code===`Escape`&&i&&m.value.forEach(e=>{E.value[e]=!1})}je&&(document.addEventListener(`keydown`,n),e(()=>{document.removeEventListener(`keydown`,n)}))});function oe(e){let t=e.currentTarget,n=t.getAttribute(`data-y-position`)+`-`+t.getAttribute(`data-x-position`);E.value[n]=!0}function I(e){if(!O.value){let t=e.currentTarget,n=t.getAttribute(`data-y-position`)+`-`+t.getAttribute(`data-x-position`);E.value[n]=!1}}function se(){Object.keys(E.value).forEach(e=>{E.value[e]=!1})}function le(){O.value=!1}function ue(e){T.value=e}function L(e){let t=T.value.findIndex(t=>t.toastId===e.toastId);if(t!==-1)T.value[t]=e;else{let t=T.value.findIndex(t=>t.position===e.position);t===-1?T.value.unshift(e):T.value.splice(t,0,e)}}return(e,i)=>(f(),d(w,null,[S(` Remove item from normal navigation flow, only available via hotkey `),u(`section`,{"aria-label":`${e.containerAriaLabel} ${g(N)}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`},[(f(!0),d(w,null,o(m.value,(i,a)=>(f(),d(`ol`,s({key:i,ref_for:!0,ref_key:`listRef`,ref:A,"data-sonner-toaster":``,"data-sonner-theme":k.value,class:t.class,dir:e.dir===`auto`?Me():e.dir,tabIndex:-1,"data-theme":e.theme,"data-rich-colors":e.richColors,"data-y-position":i.split(`-`)[0],"data-x-position":i.split(`-`)[1],style:{"--front-toast-height":`${T.value[0]?.height||0}px`,"--width":`${g(re)}px`,"--gap":`${e.gap}px`,...e.style,...g(r).style,...g(ce)(e.offset,e.mobileOffset)}},{ref_for:!0},e.$attrs,{onBlur:ne,onFocus:F,onMouseenter:oe,onMousemove:oe,onMouseleave:I,onDragend:se,onPointerdown:ie,onPointerup:le}),[(f(!0),d(w,null,o(p(i,a),(r,a)=>(f(),n(de,{key:r.id,heights:T.value,icons:e.icons,index:a,toast:r,defaultRichColors:e.richColors,duration:e.toastOptions?.duration??e.duration,class:h(e.toastOptions?.class??``),descriptionClass:e.toastOptions?.descriptionClass,invert:e.invert,visibleToasts:e.visibleToasts,closeButton:e.toastOptions?.closeButton??e.closeButton,interacting:O.value,position:i,closeButtonPosition:e.toastOptions?.closeButtonPosition??e.closeButtonPosition,style:x(e.toastOptions?.style),unstyled:e.toastOptions?.unstyled,classes:e.toastOptions?.classes,cancelButtonStyle:e.toastOptions?.cancelButtonStyle,actionButtonStyle:e.toastOptions?.actionButtonStyle,"close-button-aria-label":e.toastOptions?.closeButtonAriaLabel,toasts:te.value[i],expandByDefault:e.expand,gap:e.gap,expanded:E.value[i]||!1,swipeDirections:t.swipeDirections,"onUpdate:heights":ue,"onUpdate:height":L,onRemoveToast:P},{"close-icon":b(()=>[y(e.$slots,`close-icon`,{},()=>[c(me)])]),"loading-icon":b(()=>[y(e.$slots,`loading-icon`,{},()=>[c(ge,{visible:r.type===`loading`},null,8,[`visible`])])]),"success-icon":b(()=>[y(e.$slots,`success-icon`,{},()=>[c(V)])]),"error-icon":b(()=>[y(e.$slots,`error-icon`,{},()=>[c(Oe)])]),"warning-icon":b(()=>[y(e.$slots,`warning-icon`,{},()=>[c(U)])]),"info-icon":b(()=>[y(e.$slots,`info-icon`,{},()=>[c(Se)])]),_:2},1032,[`heights`,`icons`,`index`,`toast`,`defaultRichColors`,`duration`,`class`,`descriptionClass`,`invert`,`visibleToasts`,`closeButton`,`interacting`,`position`,`closeButtonPosition`,`style`,`unstyled`,`classes`,`cancelButtonStyle`,`actionButtonStyle`,`close-button-aria-label`,`toasts`,`expandByDefault`,`gap`,`expanded`,`swipeDirections`]))),128))],16,Ae))),128))],8,ke)],2112))}}),Pe=class extends Error{name=`KyError`;get isKyError(){return!0}},Fe=class extends Pe{name=`HTTPError`;response;request;options;data;constructor(e,t,n){let r=`${e.status||e.status===0?e.status:``} ${e.statusText??``}`.trim(),i=r?`status code ${r}`:`an unknown error`;super(`Request failed with ${i}: ${t.method} ${t.url}`),this.response=e,this.request=t,this.options=n}},Ie=class extends Pe{name=`NetworkError`;request;constructor(e,t){super(`Request failed due to a network error: ${e.method} ${e.url}`,t),this.request=e}},Le=class extends Error{name=`NonError`;value;constructor(e){let t=`Non-error value was thrown`;try{typeof e==`string`?t=e:e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`&&(t=e.message)}catch{}super(t),this.value=e}},Re=class extends Pe{name=`ForceRetryError`;customDelay;code;customRequest;constructor(e){let t=e?.cause?e.cause instanceof Error?e.cause:new Le(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:`Forced retry`,t?{cause:t}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}},ze=class extends Error{name=`SchemaValidationError`;issues;constructor(e){super(`Response schema validation failed`),this.issues=e}},W=class extends Pe{name=`TimeoutError`;request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.request=e}},Be=(()=>{let e=!1,t=!1,n=typeof globalThis.ReadableStream==`function`,r=typeof globalThis.Request==`function`;if(n&&r)try{t=new globalThis.Request(`https://empty.invalid`,{body:new globalThis.ReadableStream,method:`POST`,get duplex(){return e=!0,`half`}}).headers.has(`Content-Type`)}catch(e){if(e instanceof Error&&e.message===`unsupported BodyInit type`)return!1;throw e}return e&&!t})(),Ve=typeof globalThis.AbortController==`function`,He=typeof globalThis.AbortSignal==`function`&&typeof globalThis.AbortSignal.any==`function`,Ue=typeof globalThis.ReadableStream==`function`,We=typeof globalThis.FormData==`function`,Ge=[`get`,`post`,`put`,`patch`,`head`,`delete`],Ke={json:`application/json`,text:`text/*`,formData:`multipart/form-data`,arrayBuffer:`*/*`,blob:`*/*`,bytes:`*/*`},qe=2147483647,Je=Symbol(`stop`),Ye=class{options;constructor(e){this.options=e}},Xe=e=>new Ye(e),Ze={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},Qe={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},$e=new TextEncoder,et=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[n,r]of e)t+=40,t+=$e.encode(`Content-Disposition: form-data; name="${n}"`).byteLength,t+=typeof r==`string`?$e.encode(r).byteLength:r.size;return t}return e instanceof Blob?e.size:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:typeof e==`string`?$e.encode(e).byteLength:e instanceof URLSearchParams?$e.encode(e.toString()).byteLength:0},tt=(e,t,n)=>{let r,i=0;return e.pipeThrough(new TransformStream({transform(e,a){if(a.enqueue(e),r){i+=r.byteLength;let e=t===0?0:i/t;e>=1&&(e=1-2**-52),n?.({percent:e,totalBytes:Math.max(t,i),transferredBytes:i},r)}r=e},flush(){r&&(i+=r.byteLength,n?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},r))}}))},nt=(e,t)=>{if(!e.body)return e;let n={status:e.status,statusText:e.statusText,headers:e.headers};if(e.status===204)return new Response(null,n);let r=Math.max(0,Number(e.headers.get(`content-length`))||0);return new Response(tt(e.body,r,t),n)},rt=(e,t,n)=>{if(!e.body)return e;let r=et(n??e.body);return new Request(e,{duplex:`half`,body:tt(e.body,r,t)})},G=e=>typeof e==`object`&&!!e,it=Symbol(`replaceOption`),at=e=>G(e)&&e[it]===!0?{isReplace:!0,value:e.value}:{isReplace:!1,value:e},ot=(...e)=>{for(let t of e)if((!G(t)||Array.isArray(t))&&t!==void 0)throw TypeError("The `options` argument must be an object");return pt({},...e)},st=(e={},t={})=>{let n=new globalThis.Headers(e),r=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[e,t]of i.entries())r&&t===`undefined`||t===void 0?n.delete(e):n.set(e,t);return n},ct=e=>{if(!G(e)||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},K=e=>{if(e instanceof URLSearchParams){let t=new URLSearchParams(e),n=e[J];return n&&(t[J]=new Set(n)),t}return e instanceof globalThis.Headers?new globalThis.Headers(e):Array.isArray(e)?[...e]:ct(e)?{...e}:e},lt=e=>Object.fromEntries(Object.entries(e).filter(e=>e[1]!==void 0)),ut=(e,t)=>ct(e)&&ct(t)?lt({...e,...t}):st(e,t);function q(e,t,n){return Object.hasOwn(t,n)&&t[n]===void 0?[]:pt(e[n]??[],t[n]??[])}var dt=(e={},t={})=>({init:q(e,t,`init`),beforeRequest:q(e,t,`beforeRequest`),beforeRetry:q(e,t,`beforeRetry`),beforeError:q(e,t,`beforeError`),afterResponse:q(e,t,`afterResponse`)}),J=Symbol(`deletedParameters`),ft=(e,t)=>{let n=new URLSearchParams,r=new Set;for(let i of[e,t])if(i!==void 0)if(i instanceof URLSearchParams){for(let[e,t]of i.entries())n.append(e,t),r.delete(e);let e=i[J];if(e)for(let t of e)n.delete(t),r.add(t)}else if(Array.isArray(i))for(let e of i){if(!Array.isArray(e)||e.length!==2)throw TypeError(`Array search parameters must be provided in [[key, value], ...] format`);n.append(String(e[0]),String(e[1])),r.delete(String(e[0]))}else if(G(i))for(let[e,t]of Object.entries(i))t===void 0?(n.delete(e),r.add(e)):(n.append(e,String(t)),r.delete(e));else{let e=new URLSearchParams(i);for(let[t,i]of e.entries())n.append(t,i),r.delete(t)}return r.size>0&&(n[J]=r),n},pt=(...e)=>{let t={},n={},r={},i,a=[];for(let o of e)if(Array.isArray(o))Array.isArray(t)||(t=[]),t=[...t,...o];else if(G(o)){for(let[e,n]of Object.entries(o)){if(e===`signal`&&n instanceof globalThis.AbortSignal){a.push(n);continue}let r=at(n),{isReplace:o}=r;if(n=r.value,e===`context`){if(n!=null&&(!G(n)||Array.isArray(n)))throw TypeError("The `context` option must be an object");t={...t,context:n==null?{}:o?{...n}:{...t.context,...n}};continue}if(e===`searchParams`){i=n==null?void 0:o||i===void 0?n:ft(i,n);continue}G(n)&&!o&&e in t&&(n=pt(t[e],n)),t={...t,[e]:n}}if(G(o.hooks)){let{value:e,isReplace:n}=at(o.hooks);r=dt(n?{}:r,e),t.hooks=r}if(G(o.headers)){let{value:e,isReplace:r}=at(o.headers);n=r?K(e):ut(n,e),t.headers=n}}return i!==void 0&&(t.searchParams=i),a.length>0&&(a.length===1?t.signal=a[0]:He?t.signal=AbortSignal.any(a):t.signal=a.at(-1)),t},mt=e=>Ge.includes(e)?e.toUpperCase():e,ht={limit:2,methods:[`get`,`put`,`head`,`delete`,`options`,`trace`],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:1/0,backoffLimit:1/0,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1},gt=(e={})=>{if(typeof e==`number`)return{...ht,limit:e};if(e.methods&&!Array.isArray(e.methods))throw Error(`retry.methods must be an array`);if(e.statusCodes&&!Array.isArray(e.statusCodes))throw Error(`retry.statusCodes must be an array`);let t=Object.fromEntries(Object.entries({...e,methods:e.methods?.map(e=>e.toLowerCase())}).filter(([,e])=>e!==void 0));return{...ht,...t}};async function _t(e,t,n,r){return new Promise((i,a)=>{let o=setTimeout(()=>{n&&n.abort(),a(new W(e))},r.timeout);r.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function vt(e,{signal:t}){return new Promise((n,r)=>{t&&(t.throwIfAborted(),t.addEventListener(`abort`,i,{once:!0}));function i(){clearTimeout(a),r(t.reason)}let a=setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e)})}var yt=e=>{let t={};for(let n in e)Object.hasOwn(e,n)&&!(n in Qe)&&!(n in Ze)&&(t[n]=e[n]);return t},bt=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0||!!e[J]?.size:typeof e==`object`?Object.keys(e).length>0:typeof e==`string`?e.trim().length>0:!!e,xt=Object.prototype.toString,St=e=>xt.call(e)===`[object Error]`,Ct=new Set([`network error`,`NetworkError when attempting to fetch resource.`,`The Internet connection appears to be offline.`,`Network request failed`,`fetch failed`,`terminated`,` A network error occurred.`,`Network connection lost`]);function wt(e){if(!(e&&St(e)&&e.name===`TypeError`&&typeof e.message==`string`))return!1;let{message:t,stack:n}=e;return t===`Load failed`?n===void 0||`__sentry_captured__`in e:t.startsWith(`error sending request for url`)||t===`Failed to fetch`||t.startsWith(`Failed to fetch (`)&&t.endsWith(`)`)?!0:Ct.has(t)}var Tt=(e,t)=>e instanceof t||e?.name===t.name;function Et(e){return Tt(e,Fe)}function Dt(e){return Tt(e,Ie)}function Ot(e){return Tt(e,W)}var kt=10*1024*1024,At="The `prefixUrl` option has been renamed `prefix` in v2 and enhanced to allow slashes in input. See also the new `baseUrl` option for improved flexibility with standard URL resolution: https://github.com/sindresorhus/ky#baseurl",Y=Symbol(`timedOutResponseData`),jt=e=>{let t=/;\s*charset\s*=\s*(?:"([^"]+)"|([^;,\s]+))/i.exec(e),n=t?.[1]??t?.[2];if(n)try{return new TextDecoder(n)}catch{}return new TextDecoder},Mt="The `schema` argument must follow the Standard Schema specification",Nt=e=>typeof e==`object`?{...e,...e.methods&&{methods:[...e.methods]},...e.statusCodes&&{statusCodes:[...e.statusCodes]},...e.afterStatusCodes&&{afterStatusCodes:[...e.afterStatusCodes]}}:e,Pt=Object.prototype.toString,Ft=e=>e instanceof globalThis.Request||Pt.call(e)===`[object Request]`,X=e=>e instanceof globalThis.Response||Pt.call(e)===`[object Response]`,It=e=>Array.isArray(e)?e.map(e=>[...e]):K(e);function Lt(e){let t={...e,json:K(e.json),context:K(e.context),headers:K(e.headers),searchParams:It(e.searchParams)};return e.retry!==void 0&&(t.retry=Nt(e.retry)),t}var Rt=async(e,t)=>{if(typeof t!=`object`&&typeof t!=`function`||t===null)throw TypeError(Mt);let n=t[`~standard`];if(typeof n!=`object`||!n||typeof n.validate!=`function`)throw TypeError(Mt);let r=await n.validate(e);if(r.issues)throw new ze(r.issues);return r.value},zt=class e{static create(t,n){let r=n.hooks?.init??[],i=r.length>0?Lt(n):n;for(let e of r)e(i);let a=new e(t,i),o=async()=>{if(typeof a.#i.timeout==`number`&&a.#i.timeout>2147483647)throw RangeError(`The \`timeout\` option cannot be greater than ${qe}`);if(typeof a.#i.totalTimeout==`number`&&a.#i.totalTimeout>2147483647)throw RangeError(`The \`totalTimeout\` option cannot be greater than ${qe}`);await Promise.resolve();let e=await a.#w(),t=e??await a.#E(async()=>a.#k()),n=e!==void 0||a.#O();for(;;){if(t===void 0)return t;if(X(t))try{t=await a.#T(t)}catch(e){if(!(e instanceof Re))throw e;let r=await a.#D(e,async()=>a.#k());if(r===void 0)return r;t=r,n=a.#O();continue}let e=t;if(!e.ok&&e.type!==`opaque`&&(typeof a.#i.throwHttpErrors==`function`?a.#i.throwHttpErrors(e.status):a.#i.throwHttpErrors)){let r=new Fe(e,a.#P(e),a.#M()),i=r;if(r.data=await a.#h(e),n)throw i;let o=await a.#D(r,async()=>a.#k());if(o===void 0)return o;t=o,n=a.#O();continue}break}if(!X(t))return t;if(a.#m(t),a.#i.onDownloadProgress){if(typeof a.#i.onDownloadProgress!=`function`)throw TypeError("The `onDownloadProgress` option must be a function");if(!Ue)throw Error("Streams are not supported in your environment. `ReadableStream` is missing.");let e=t.clone();return a.#x(t),nt(e,a.#i.onDownloadProgress)}return t},s=(async()=>{try{return await o()}catch(e){if(!(e instanceof Error)||a.#s.has(e))throw e;let t=e;for(let e of a.#i.hooks.beforeError){let n=await e({request:a.request,options:a.#M(),error:t,retryCount:a.#n});n instanceof Error&&(t=n)}throw t}finally{let e=a.#a;a.#b(e?.body??void 0),a.request!==e&&a.#b(a.request.body??void 0)}})();for(let[e,t]of Object.entries(Ke))e===`bytes`&&typeof globalThis.Response?.prototype?.bytes!=`function`||(s[e]=async n=>{a.request.headers.set(`accept`,a.request.headers.get(`accept`)||t);let r=await s;if(e!==`json`)return r[e]();let o=await r.text();if(o===``)return n===void 0?JSON.parse(o):Rt(void 0,n);let c=i.parseJson?await i.parseJson(o,{request:a.#P(r),response:r}):JSON.parse(o);return n===void 0?c:Rt(c,n)});return s}static#e(e){return e&&typeof e==`object`&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0)):e}request;#t;#n=0;#r;#i;#a;#o;#s=new WeakSet;#c;#l;#u=!1;#d=new WeakMap;constructor(t,n={}){if(this.#r=t,Object.hasOwn(n,`prefixUrl`))throw Error(At);if(this.#i={...n,headers:st(this.#r.headers,n.headers),hooks:dt({},n.hooks),method:mt(n.method??this.#r.method??`GET`),prefix:String(n.prefix||``),retry:gt(n.retry),throwHttpErrors:n.throwHttpErrors??!0,timeout:n.timeout??1e4,totalTimeout:n.totalTimeout??!1,fetch:n.fetch??globalThis.fetch.bind(globalThis),context:n.context??{}},typeof this.#r!=`string`&&!(this.#r instanceof URL||this.#r instanceof globalThis.Request))throw TypeError("`input` must be a string, URL, or Request");if(typeof this.#r==`string`&&(this.#i.prefix&&(this.#r=`${this.#i.prefix.replace(/\/+$/,``)}/${this.#r.replace(/^\/+/,``)}`),this.#i.baseUrl)){let e;try{e=new URL(this.#r)}catch{}e||(this.#r=new URL(this.#r,new Request(this.#i.baseUrl).url))}Ve&&He&&(this.#o=this.#i.signal??this.#r.signal,this.#t=new globalThis.AbortController,this.#i.signal=this.#S()),Be&&(this.#i.duplex=`half`),this.#i.json!==void 0&&(this.#i.body=this.#i.stringifyJson?.(this.#i.json)??JSON.stringify(this.#i.json),this.#i.headers.set(`content-type`,this.#i.headers.get(`content-type`)??`application/json`));let r=n.headers&&new globalThis.Headers(n.headers).has(`content-type`);if(this.#r instanceof globalThis.Request&&(We&&this.#i.body instanceof globalThis.FormData||this.#i.body instanceof URLSearchParams)&&!r&&this.#i.headers.delete(`content-type`),this.request=new globalThis.Request(this.#r,this.#i),bt(this.#i.searchParams)){let t=new URL(this.request.url),n=this.#i.searchParams?.[J];if(n)for(let e of n)t.searchParams.delete(e);if(typeof this.#i.searchParams==`string`){let e=this.#i.searchParams.replace(/^\?/,``);e!==``&&(t.search=t.search?`${t.search}&${e}`:`?${e}`)}else{let n=new URLSearchParams(e.#e(this.#i.searchParams));for(let[e,r]of n.entries())t.searchParams.append(e,r)}if(this.#i.searchParams&&typeof this.#i.searchParams==`object`&&!Array.isArray(this.#i.searchParams)&&!(this.#i.searchParams instanceof URLSearchParams))for(let[e,n]of Object.entries(this.#i.searchParams))n===void 0&&t.searchParams.delete(e);this.request=new globalThis.Request(t,this.#i)}if(this.#i.onUploadProgress&&typeof this.#i.onUploadProgress!=`function`)throw TypeError("The `onUploadProgress` option must be a function");this.#l=typeof this.#i.totalTimeout==`number`?this.#j():void 0}#f(){let e=this.#i.retry.delay(this.#n+1),t=e;return this.#i.retry.jitter===!0?t=Math.random()*e:typeof this.#i.retry.jitter==`function`&&(t=this.#i.retry.jitter(e),(!Number.isFinite(t)||t<0)&&(t=e)),Math.min(this.#i.retry.backoffLimit,t)}async#p(e){if(this.#n>=this.#i.retry.limit)throw e;let t=e instanceof Error?e:new Le(e);if(t instanceof Re)return t.customDelay??this.#f();if(!this.#i.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#i.retry.shouldRetry!==void 0){let n=await this.#i.retry.shouldRetry({error:t,retryCount:this.#n+1});if(n===!1)throw e;if(n===!0)return this.#f()}if(Ot(e)){if(!this.#i.retry.retryOnTimeout)throw e;return this.#f()}if(Et(e)){if(!this.#i.retry.statusCodes.includes(e.response.status))throw e;let t=e.response.headers.get(`Retry-After`)??e.response.headers.get(`RateLimit-Reset`)??e.response.headers.get(`X-RateLimit-Retry-After`)??e.response.headers.get(`X-RateLimit-Reset`)??e.response.headers.get(`X-Rate-Limit-Reset`);if(t&&this.#i.retry.afterStatusCodes.includes(e.response.status)){let e=Number(t)*1e3;return Number.isNaN(e)?e=Date.parse(t)-Date.now():e>=Date.parse(`2024-01-01`)&&(e-=Date.now()),Number.isFinite(e)?(e=Math.max(0,e),Math.min(this.#i.retry.maxRetryAfter,e)):Math.min(this.#i.retry.maxRetryAfter,this.#f())}if(e.response.status===413)throw e;return this.#f()}if(!Dt(e))throw e;return this.#f()}#m(e){let t=this.#P(e);return this.#i.parseJson&&(e.json=async()=>{let n=await e.text();return n===``?JSON.parse(n):this.#i.parseJson(n,{request:t,response:e})}),e}async#h(e){let t=await this.#v(e,this.#g());if(t===Y){this.#C();return}if(!t)return;if(!this.#_(e.headers.get(`content-type`)??``))return t;let n=await this.#y(t,e,this.#g(),this.#P(e));if(n===Y){this.#C();return}return n}#g(){let e=this.#i.timeout===!1?1e4:this.#i.timeout,t=this.#A();if(t===void 0)return e;if(t<=0)throw new W(this.request);return Math.min(e,t)}#_(e){let t=(e.split(`;`,1)[0]??``).trim().toLowerCase();return/\/(?:.*[.+-])?json$/.test(t)}async#v(e,t){let{body:n}=e;if(!n)try{return await e.text()}catch{return}let r;try{r=n.getReader()}catch{return}let i=jt(e.headers.get(`content-type`)??``),a=[],o=0,s=(async()=>{try{for(;;){let{done:e,value:t}=await r.read();if(e)break;if(o+=t.byteLength,o>kt){r.cancel().catch(()=>void 0);return}a.push(i.decode(t,{stream:!0}))}}catch{return}return a.push(i.decode()),a.join(``)})(),c=new Promise(e=>{let n=setTimeout(()=>{e(Y)},t);s.finally(()=>{clearTimeout(n)})}),l=await Promise.race([s,c]);return l===Y&&r.cancel().catch(()=>void 0),l}async#y(e,t,n,r){let i;try{return await Promise.race([Promise.resolve().then(()=>this.#i.parseJson?this.#i.parseJson(e,{request:r,response:t}):JSON.parse(e)),new Promise(e=>{i=setTimeout(()=>{e(Y)},n)})])}catch{return}finally{clearTimeout(i)}}#b(e){e&&e.cancel().catch(()=>void 0)}#x(e){this.#b(e.body??void 0)}#S(){return this.#o?AbortSignal.any([this.#o,this.#t.signal]):this.#t.signal}#C(){let e=this.#A();if(e!==void 0&&e<=0)throw new W(this.request)}async#w(){for(let e of this.#i.hooks.beforeRequest){let t=await e({request:this.request,options:this.#M(),retryCount:0});if(Ft(t))this.#N(t);else if(X(t))return t}}async#T(e){let t=this.#P(e);for(let n of this.#i.hooks.afterResponse){let r=this.#F(e.clone(),t);this.#m(r);let i;try{i=await n({request:this.request,options:this.#M(),response:r,retryCount:this.#n})}catch(t){throw r!==e&&this.#x(r),this.#x(e),t}if(i instanceof Ye)throw r!==e&&this.#x(r),this.#x(e),new Re(i.options);let a=X(i)?this.#F(i,t):e;r!==e&&r!==a&&r.body!==a.body&&this.#x(r),e!==a&&e.body!==a.body&&this.#x(e),e=a}return e}async#E(e){try{return await e()}catch(t){return this.#D(t,e)}}async#D(e,t){this.#u=!1;let n=Math.min(await this.#p(e),qe),r={signal:this.#o},i=this.#A();if(i!==void 0){if(i<=0)throw new W(this.request);if(n>=i)throw await vt(i,r),new W(this.request)}if(await vt(n,r),this.#C(),e instanceof Re&&e.customRequest){let t=new globalThis.Request(e.customRequest,this.#i.signal?{signal:this.#i.signal}:void 0);this.#N(t)}for(let t of this.#i.hooks.beforeRetry){let n;try{n=await t({request:this.request,options:this.#M(),error:e,retryCount:this.#n+1})}catch(t){throw t instanceof Error&&t!==e&&this.#s.add(t),t}if(Ft(n)){this.#N(n);break}if(X(n))return this.#u=!0,this.#n++,n;if(n===Je)return}return this.#C(),this.#n++,this.#E(t)}#O(){let e=this.#u;return this.#u=!1,e}async#k(){this.#t?.signal.aborted&&(this.#t=new globalThis.AbortController,this.#i.signal=this.#S(),this.request=new globalThis.Request(this.request,{signal:this.#i.signal}));let e=yt(this.#i),t=this.#i.retry.limit>0?this.request.clone():void 0,n=this.#I(this.request,this.#i.body??void 0);this.#a=n,t&&(this.request=t);try{let t=this.#A();if(t!==void 0&&t<=0)throw new W(this.request);let r=this.#i.timeout===!1?t:t===void 0?this.#i.timeout:Math.min(this.#i.timeout,t),i=r===void 0?await this.#i.fetch(n,e):await _t(n,e,this.#t,{timeout:r,fetch:this.#i.fetch});return this.#F(i,n)}catch(e){throw wt(e)?new Ie(this.request,{cause:e}):e}}#A(){if(this.#l===void 0)return;let e=this.#j()-this.#l;return Math.max(0,this.#i.totalTimeout-e)}#j(){return globalThis.performance?.now()??Date.now()}#M(){if(!this.#c){let{hooks:e,json:t,parseJson:n,stringifyJson:r,searchParams:i,timeout:a,totalTimeout:o,throwHttpErrors:s,fetch:c,...l}=this.#i;this.#c=Object.freeze(l)}return this.#c}#N(e){this.#c=void 0,this.request=e}#P(e){return this.#d.get(e)??this.request}#F(e,t){return this.#d.set(e,t),e}#I(e,t){return!this.#i.onUploadProgress||!e.body||!Be?e:rt(e,this.#i.onUploadProgress,t??this.#i.body??void 0)}},Bt=e=>{let t=(t,n)=>zt.create(t,ot(e,n));for(let n of Ge)t[n]=(t,r)=>zt.create(t,ot(e,r,{method:n}));return t.create=e=>Bt(ot(e)),t.extend=t=>(typeof t==`function`&&(t=t(e??{})),Bt(ot(e,t))),t.stop=Je,t.retry=Xe,t},Z=Bt().create({retry:0});async function Q(e,t){if(e instanceof Fe)try{return(await e.response.json()).error||t}catch{return t}return e instanceof Error?e.message:t}async function Vt(){return Z.get(`api/schema`).json()}async function Ht(e){return Z.get(`api/schema/${encodeURIComponent(e)}`).json()}async function Ut(e,t){try{await Z.post(`api/schema/${encodeURIComponent(e)}`,{json:t})}catch(t){throw Error(await Q(t,`Failed to save schema: ${e}`))}}async function Wt(e){try{await Z.delete(`api/schema/${encodeURIComponent(e)}`)}catch(t){throw Error(await Q(t,`Failed to delete schema: ${e}`))}}var $=class extends Error{constructor(e,t){super(e),this.riskReport=t,this.name=`MigrationError`}};async function Gt(e={}){try{let t=await Z.post(`api/migrate${e.force?`?force=true`:``}`).json();if(!t.success)throw new $(t.error||`Migration failed`,t.riskReport);return t}catch(e){if(e instanceof $)throw e;if(e instanceof Fe){let t=await e.response.json().catch(()=>void 0);throw new $(t?.error||`Migration failed`,t?.riskReport)}throw e instanceof Error?new $(e.message):new $(`Migration failed`)}}async function Kt(e){return Z.get(`api/prompt-snapshot/${encodeURIComponent(e)}`).json()}var qt=[`unpdf`,`liteparse`,`mineru`,`mineru_api`,`external`];async function Jt(){return Z.get(`api/ai/config`).json()}async function Yt(e){try{await Z.put(`api/ai/config`,{json:e})}catch(e){throw Error(await Q(e,`Failed to save AI config`))}}async function Xt(e){let t=await Z.post(`api/ai/registry-lookup`,{json:{modelName:e}}).json().catch(()=>null);return!t||typeof t.vision!=`boolean`?null:t}async function Zt(e){try{let t=await Z.post(`api/ai/notion/inspect`,{json:e}).json();if(!t.success)throw Error(t.error||`Notion connection failed`);return t}catch(e){throw Error(await Q(e,`Notion connection failed`))}}async function Qt(){return Z.get(`api/data`).json()}async function $t(){return Z.get(`api/data/tables`).json()}async function en(e,t={}){let n=new URLSearchParams;return t.page!==void 0&&n.set(`page`,String(t.page)),t.pageSize!==void 0&&n.set(`pageSize`,String(t.pageSize)),t.search&&n.set(`search`,t.search),t.sortField&&n.set(`sortField`,t.sortField),t.sortOrder&&n.set(`sortOrder`,t.sortOrder),t.all!==void 0&&n.set(`all`,String(t.all)),Z.get(`api/data/tables/${encodeURIComponent(e)}`,{searchParams:n}).json()}async function tn(e){return Z.get(`api/data/${encodeURIComponent(e)}`).json()}async function nn(e){try{let t=await Z.post(`api/data/${encodeURIComponent(e)}/notion/retry`).json();if(!t.success)throw Error(t.error||`Notion sync failed`);return t}catch(e){throw Error(await Q(e,`Notion sync failed`))}}export{Ut as _,tn as a,en as c,Qt as d,Vt as f,Yt as g,nn as h,Jt as i,Zt as l,Xt as m,qt as n,Kt as o,Gt as p,Wt as r,Ht as s,$ as t,$t as u,Ne as v,A as y};
|