1import{c as e,o as t,r as n,s as r}from"./apiResponse-C8fEm_-L.js";var i={missing_argument:`缺å°å¿
è¦åæ°`,error_token:`ç»å½å¤±æï¼è¯·éæ°ç»å½`,Token_required:`请å
ç»å½`,"Token required":`请å
ç»å½`,no_permission:`ä»
管çå坿ä½`,error_type:`åæ°ç±»åé误`,error_id:`å¹»ç¯çä¸åå¨`,system_error:`ç³»ç»é误ï¼è¯·ç¨åéè¯`,"Not found":`æ¥å£ä¸åå¨`,"Method not allowed":`è¯·æ±æ¹æ³ä¸å
许`};function a(e){let t=(e||``).trim();return t?/^https?:\/\//i.test(t)?t:t.startsWith(`//`)?`https:${t}`:t.startsWith(`/`)?`https://api.ottohub.cn${t}`:`https://${t}`:``}function o(t=``,n){let r=t?t.startsWith(`/`)?t:`/${t}`:``,i=new URL(`${e}/api/slideshow${r}`);if(n)for(let[e,t]of Object.entries(n))t!=null&&t!==``&&i.searchParams.set(e,String(t));return i.toString()}function s(e){if(!e||typeof e!=`object`)return[];let t=e,n=(t.data&&typeof t.data==`object`?t.data:t).slides;return Array.isArray(n)?n.filter(e=>!!e&&typeof e==`object`).map(e=>({id:Number(e.id)||0,img_url:typeof e.img_url==`string`?a(e.img_url):``,title:typeof e.title==`string`?e.title:``,href:typeof e.href==`string`?e.href:``,is_enabled:+(Number(e.is_enabled)===1),sort_order:Number(e.sort_order)||0,created_at:typeof e.created_at==`string`?e.created_at:void 0,updated_at:typeof e.updated_at==`string`?e.updated_at:void 0})).filter(e=>e.id>0):[]}function c(e){if(!e||typeof e!=`object`)return null;let t=e,n=(t.data&&typeof t.data==`object`?t.data:t).slide;return!n||typeof n!=`object`?null:s({data:{slides:[n]}})[0]??null}function l(e){return e===408||e===429||e===502||e===503||e===504||e===524}async function u(e,t,n=2){let r=null;for(let i=0;i<=n;i++){try{let a=await fetch(e,{...t,cache:`no-store`});if(r=a,!l(a.status)||i===n)return a}catch(e){if(i===n)throw e}await new Promise(e=>setTimeout(e,250*(i+1)))}return r}async function d(e,a){let o=await t(e),s=r(e,o,{messages:i,fallback:e.status===503?`æå¡ç¹å¿ï¼è¯·ç¨åéè¯`:a});if(s)throw!o&&l(e.status)?Error(n(e.status,`æå¡ç¹å¿ï¼è¯·ç¨åéè¯`)):Error(s);return o}async function f(){let e=await fetch(o(`/active`),{cache:`no-store`}),n=await t(e);if(!n||typeof n!=`object`||n.status===`error`)return[];let r=(n.data&&typeof n.data==`object`?n.data:n)?.slides;return Array.isArray(r)?r.filter(e=>!!e&&typeof e==`object`).map(e=>({img_url:typeof e.img_url==`string`?a(e.img_url):``,title:typeof e.title==`string`?e.title:``,href:typeof e.href==`string`?e.href:``})).filter(e=>!!e.img_url):[]}async function p(e,t={}){let n=s(await d(await u(o(``,{token:e,sort_by:t.sort_by??`sort_order`,order:t.order??`asc`})),`è·åå¹»ç¯çå表失败`));return(t.is_enabled===0||t.is_enabled===1)&&(n=n.filter(e=>e.is_enabled===t.is_enabled)),n}async function m(e,t){let n=c(await d(await u(o(),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,...t})}),`å建幻ç¯ç失败`));if(!n)throw Error(`å建æå使ªè¿åå¹»ç¯çæ°æ®`);return n}async function h(e,t,n){let r=c(await d(await u(o(`/${t}`),{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,...n})}),`æ´æ°å¹»ç¯ç失败`));if(!r)throw Error(`æ´æ°æå使ªè¿åå¹»ç¯çæ°æ®`);return r}async function g(e,t){await d(await u(o(`/${t}`,{token:e}),{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e})}),`å é¤å¹»ç¯ç失败`)}async function _(e,t){return s(await d(await u(o(`/reorder`),{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,items:t})}),`è°æ´é¡ºåºå¤±è´¥`))}export{a,p as i,g as n,_ as o,f as r,h as s,m as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.