@tombcato/ai-selector-react 0.1.2 → 0.1.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.
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(Y,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react"),require("@tombcato/ai-selector-core"),require("@tombcato/smart-ticker")):typeof define=="function"&&define.amd?define(["exports","react","@tombcato/ai-selector-core","@tombcato/smart-ticker"],i):(Y=typeof globalThis<"u"?globalThis:Y||self,i(Y.AISelectorReact={},Y.React,Y.AISelectorCore,Y.smartTicker))})(this,(function(Y,i,H,Ve){"use strict";function Ee(n={}){var q,Q,$,ee,re;const[d,R]=i.useState(((q=n.initialConfig)==null?void 0:q.providerId)||""),[c,C]=i.useState(((Q=n.initialConfig)==null?void 0:Q.apiKey)||""),[m,y]=i.useState((($=n.initialConfig)==null?void 0:$.model)||""),[g,u]=i.useState(((ee=n.initialConfig)==null?void 0:ee.modelName)||""),[v,l]=i.useState(((re=n.initialConfig)==null?void 0:re.baseUrl)||""),[_,x]=i.useState([]),[I,k]=i.useState("idle"),[L,M]=i.useState(null),[F,w]=i.useState(!1),[E,B]=i.useState(null),O=i.useMemo(()=>H.resolveProviderConfig(n.providerConfig),[n.providerConfig]),N=O.providers,h=i.useMemo(()=>N.find(o=>o.id===d)||null,[N,d]),J=i.useMemo(()=>H.createConfigStorage(void 0,{serialize:n.onSerialize,deserialize:n.onDeserialize}),[n.onSerialize,n.onDeserialize]),Z=i.useRef(new Map);i.useEffect(()=>{const o=J.load();o&&(o.providerId&&R(o.providerId),o.apiKey&&C(o.apiKey),o.model&&y(o.model),o.modelName&&u(o.modelName),o.baseUrl&&l(o.baseUrl))},[J]),i.useEffect(()=>{if(!d||!h){x([]),B(null),w(!1);return}const o=h.supportsModelsApi&&(!h.needsApiKey||!!c),S=v||h.baseUrl,U=`${d}|${S}|${c}`,X=Z.current.get(U);if(X){x(X),B(null),w(!1);return}if(!o){const D=O.getModels(d);x(D),Z.current.set(U,D),B(null),w(!1);return}w(!0),B(null),_.length===0&&x(O.getModels(d));const te=setTimeout(async()=>{try{let D;n.modelFetcher?D=await n.modelFetcher({type:"fetchModels",providerId:h.id,baseUrl:S,apiKey:c}):D=await import("@tombcato/ai-selector-core").then(se=>se.fetchModels({provider:h,apiKey:c,baseUrl:S,proxyUrl:n.proxyUrl,fallbackToStatic:!1})),x(D),Z.current.set(U,D)}catch(D){console.warn("Model fetch failed:",D),B("fetchModelsFailed");const se=O.getModels(d);x(se)}finally{w(!1)}},500);return()=>clearTimeout(te)},[d,h,c,v,O,n.proxyUrl,n.modelFetcher]),i.useEffect(()=>{(I==="error"||I==="success")&&(k("idle"),M(null))},[c,v]);const de=i.useCallback(async()=>{if(!h||h.needsApiKey&&!c)return;k("testing"),M(null);let o;if(n.modelFetcher)try{const S=await n.modelFetcher({type:"checkConnection",providerId:h.id,baseUrl:v||h.baseUrl,apiKey:c,modelId:m});o={success:S.success,latencyMs:S.latency||S.latencyMs,message:S.message}}catch(S){o={success:!1,message:S.message||"Unknown error"}}else o=await H.testConnection({provider:h,apiKey:c,baseUrl:v,model:m,proxyUrl:n.proxyUrl});return M(o),k(o.success?"success":"error"),setTimeout(()=>{k("idle")},2e3),o},[h,c,v,m,n.proxyUrl,n.modelFetcher]),fe=i.useCallback(()=>{const o=_.find(U=>U.id===m),S=(o==null?void 0:o.name)||g||m;o!=null&&o.name&&o.name!==g&&u(o.name),J.save({providerId:d,apiKey:c,model:m,modelName:S,baseUrl:v})},[d,c,m,g,v,_,J]),ae=i.useCallback(()=>{J.clear(),R(""),C(""),y(""),u(""),l("")},[J]),W=i.useCallback(o=>{R(o),C(""),y(""),u(""),l(""),k("idle"),M(null)},[]),V=i.useCallback((o,S)=>{if(y(o),S)u(S);else{const U=_.find(X=>X.id===o);u((U==null?void 0:U.name)||o)}},[_]),G=i.useMemo(()=>!(!d||!m||h!=null&&h.needsApiKey&&!c),[d,m,h,c]);return{config:i.useMemo(()=>({providerId:d,apiKey:c,model:m,modelName:g,baseUrl:v||(h==null?void 0:h.baseUrl)||""}),[d,c,m,g,v,h]),providerId:d,apiKey:c,model:m,modelName:g,baseUrl:v,models:_,testStatus:I,testResult:L,isFetchingModels:F,fetchModelError:E,provider:h,providers:N,isValid:G,setProviderId:W,setApiKey:C,setModel:y,selectModel:V,setBaseUrl:l,runTest:de,save:fe,clear:ae}}var ve={exports:{}},ce={};/**
1
+ (function(Y,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react"),require("@tombcato/ai-selector-core"),require("@tombcato/smart-ticker")):typeof define=="function"&&define.amd?define(["exports","react","@tombcato/ai-selector-core","@tombcato/smart-ticker"],i):(Y=typeof globalThis<"u"?globalThis:Y||self,i(Y.AISelectorReact={},Y.React,Y.AISelectorCore,Y.smartTicker))})(this,(function(Y,i,H,Ve){"use strict";function Ee(s={}){var q,Q,$,ee,re;const[d,R]=i.useState(((q=s.initialConfig)==null?void 0:q.providerId)||""),[l,C]=i.useState(((Q=s.initialConfig)==null?void 0:Q.apiKey)||""),[m,y]=i.useState((($=s.initialConfig)==null?void 0:$.model)||""),[g,c]=i.useState(((ee=s.initialConfig)==null?void 0:ee.modelName)||""),[v,u]=i.useState(((re=s.initialConfig)==null?void 0:re.baseUrl)||""),[_,x]=i.useState([]),[I,k]=i.useState("idle"),[L,M]=i.useState(null),[F,w]=i.useState(!1),[E,B]=i.useState(null),O=i.useMemo(()=>H.resolveProviderConfig(s.providerConfig),[s.providerConfig]),N=O.providers,h=i.useMemo(()=>N.find(o=>o.id===d)||null,[N,d]),J=i.useMemo(()=>H.createConfigStorage(void 0,{serialize:s.onSerialize,deserialize:s.onDeserialize}),[s.onSerialize,s.onDeserialize]),Z=i.useRef(new Map);i.useEffect(()=>{const o=J.load();o&&(o.providerId&&R(o.providerId),o.apiKey&&C(o.apiKey),o.model&&y(o.model),o.modelName&&c(o.modelName),o.baseUrl&&u(o.baseUrl))},[J]),i.useEffect(()=>{if(!d||!h){x([]),B(null),w(!1);return}const o=h.supportsModelsApi&&(!h.needsApiKey||!!l),S=v||h.baseUrl,U=`${d}|${S}|${l}`,X=Z.current.get(U);if(X){x(X),B(null),w(!1);return}if(!o){const D=O.getModels(d);x(D),Z.current.set(U,D),B(null),w(!1);return}w(!0),B(null),_.length===0&&x(O.getModels(d));const te=setTimeout(async()=>{try{let D;s.modelFetcher?D=await s.modelFetcher({type:"fetchModels",providerId:h.id,baseUrl:S,apiKey:l}):D=await import("@tombcato/ai-selector-core").then(ne=>ne.fetchModels({provider:h,apiKey:l,baseUrl:S,proxyUrl:s.proxyUrl,fallbackToStatic:!1})),x(D),Z.current.set(U,D)}catch(D){console.warn("Model fetch failed:",D),B("fetchModelsFailed");const ne=O.getModels(d);x(ne)}finally{w(!1)}},500);return()=>clearTimeout(te)},[d,h,l,v,O,s.proxyUrl,s.modelFetcher]),i.useEffect(()=>{(I==="error"||I==="success")&&(k("idle"),M(null))},[l,v]);const de=i.useCallback(async()=>{if(!h||h.needsApiKey&&!l)return;k("testing"),M(null);let o;if(s.modelFetcher)try{const S=await s.modelFetcher({type:"checkConnection",providerId:h.id,baseUrl:v||h.baseUrl,apiKey:l,modelId:m});o={success:S.success,latencyMs:S.latency||S.latencyMs,message:S.message}}catch(S){o={success:!1,message:S.message||"Unknown error"}}else o=await H.testConnection({provider:h,apiKey:l,baseUrl:v,model:m,proxyUrl:s.proxyUrl});return M(o),k(o.success?"success":"error"),setTimeout(()=>{k("idle")},2e3),o},[h,l,v,m,s.proxyUrl,s.modelFetcher]),fe=i.useCallback(()=>{const o=_.find(U=>U.id===m),S=(o==null?void 0:o.name)||g||m;o!=null&&o.name&&o.name!==g&&c(o.name),J.save({providerId:d,apiKey:l,model:m,modelName:S,baseUrl:v})},[d,l,m,g,v,_,J]),ae=i.useCallback(()=>{J.clear(),R(""),C(""),y(""),c(""),u("")},[J]),W=i.useCallback(o=>{R(o),C(""),y(""),c(""),u(""),k("idle"),M(null)},[]),V=i.useCallback((o,S)=>{if(y(o),S)c(S);else{const U=_.find(X=>X.id===o);c((U==null?void 0:U.name)||o)}},[_]),G=i.useMemo(()=>!(!d||!m||h!=null&&h.needsApiKey&&!l),[d,m,h,l]);return{config:i.useMemo(()=>({providerId:d,apiKey:l,model:m,modelName:g,baseUrl:v||(h==null?void 0:h.baseUrl)||""}),[d,l,m,g,v,h]),providerId:d,apiKey:l,model:m,modelName:g,baseUrl:v,models:_,testStatus:I,testResult:L,isFetchingModels:F,fetchModelError:E,provider:h,providers:N,isValid:G,setProviderId:W,setApiKey:C,setModel:y,selectModel:V,setBaseUrl:u,runTest:de,save:fe,clear:ae}}var ve={exports:{}},ce={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Ce;function Ye(){if(Ce)return ce;Ce=1;var n=i,d=Symbol.for("react.element"),R=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,C=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,m={key:!0,ref:!0,__self:!0,__source:!0};function y(g,u,v){var l,_={},x=null,I=null;v!==void 0&&(x=""+v),u.key!==void 0&&(x=""+u.key),u.ref!==void 0&&(I=u.ref);for(l in u)c.call(u,l)&&!m.hasOwnProperty(l)&&(_[l]=u[l]);if(g&&g.defaultProps)for(l in u=g.defaultProps,u)_[l]===void 0&&(_[l]=u[l]);return{$$typeof:d,type:g,key:x,ref:I,props:_,_owner:C.current}}return ce.Fragment=R,ce.jsx=y,ce.jsxs=y,ce}var ue={};/**
9
+ */var Ce;function Ye(){if(Ce)return ce;Ce=1;var s=i,d=Symbol.for("react.element"),R=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,C=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,m={key:!0,ref:!0,__self:!0,__source:!0};function y(g,c,v){var u,_={},x=null,I=null;v!==void 0&&(x=""+v),c.key!==void 0&&(x=""+c.key),c.ref!==void 0&&(I=c.ref);for(u in c)l.call(c,u)&&!m.hasOwnProperty(u)&&(_[u]=c[u]);if(g&&g.defaultProps)for(u in c=g.defaultProps,c)_[u]===void 0&&(_[u]=c[u]);return{$$typeof:d,type:g,key:x,ref:I,props:_,_owner:C.current}}return ce.Fragment=R,ce.jsx=y,ce.jsxs=y,ce}var ue={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,18 +14,18 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Re;function Je(){return Re||(Re=1,process.env.NODE_ENV!=="production"&&(function(){var n=i,d=Symbol.for("react.element"),R=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),g=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),I=Symbol.for("react.offscreen"),k=Symbol.iterator,L="@@iterator";function M(e){if(e===null||typeof e!="object")return null;var t=k&&e[k]||e[L];return typeof t=="function"?t:null}var F=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(e){{for(var t=arguments.length,s=new Array(t>1?t-1:0),a=1;a<t;a++)s[a-1]=arguments[a];E("error",e,s)}}function E(e,t,s){{var a=F.ReactDebugCurrentFrame,b=a.getStackAddendum();b!==""&&(t+="%s",s=s.concat([b]));var j=s.map(function(p){return String(p)});j.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,j)}}var B=!1,O=!1,N=!1,h=!1,J=!1,Z;Z=Symbol.for("react.module.reference");function de(e){return!!(typeof e=="string"||typeof e=="function"||e===c||e===m||J||e===C||e===v||e===l||h||e===I||B||O||N||typeof e=="object"&&e!==null&&(e.$$typeof===x||e.$$typeof===_||e.$$typeof===y||e.$$typeof===g||e.$$typeof===u||e.$$typeof===Z||e.getModuleId!==void 0))}function fe(e,t,s){var a=e.displayName;if(a)return a;var b=t.displayName||t.name||"";return b!==""?s+"("+b+")":s}function ae(e){return e.displayName||"Context"}function W(e){if(e==null)return null;if(typeof e.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case c:return"Fragment";case R:return"Portal";case m:return"Profiler";case C:return"StrictMode";case v:return"Suspense";case l:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case g:var t=e;return ae(t)+".Consumer";case y:var s=e;return ae(s._context)+".Provider";case u:return fe(e,e.render,"ForwardRef");case _:var a=e.displayName||null;return a!==null?a:W(e.type)||"Memo";case x:{var b=e,j=b._payload,p=b._init;try{return W(p(j))}catch{return null}}}return null}var V=Object.assign,G=0,me,q,Q,$,ee,re,o;function S(){}S.__reactDisabledLog=!0;function U(){{if(G===0){me=console.log,q=console.info,Q=console.warn,$=console.error,ee=console.group,re=console.groupCollapsed,o=console.groupEnd;var e={configurable:!0,enumerable:!0,value:S,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}G++}}function X(){{if(G--,G===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:V({},e,{value:me}),info:V({},e,{value:q}),warn:V({},e,{value:Q}),error:V({},e,{value:$}),group:V({},e,{value:ee}),groupCollapsed:V({},e,{value:re}),groupEnd:V({},e,{value:o})})}G<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ie=F.ReactCurrentDispatcher,te;function D(e,t,s){{if(te===void 0)try{throw Error()}catch(b){var a=b.stack.trim().match(/\n( *(at )?)/);te=a&&a[1]||""}return`
18
- `+te+e}}var se=!1,he;{var nr=typeof WeakMap=="function"?WeakMap:Map;he=new nr}function Se(e,t){if(!e||se)return"";{var s=he.get(e);if(s!==void 0)return s}var a;se=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var j;j=ie.current,ie.current=null,U();try{if(t){var p=function(){throw Error()};if(Object.defineProperty(p.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(p,[])}catch(z){a=z}Reflect.construct(e,[],p)}else{try{p.call()}catch(z){a=z}e.call(p.prototype)}}else{try{throw Error()}catch(z){a=z}e()}}catch(z){if(z&&a&&typeof z.stack=="string"){for(var f=z.stack.split(`
17
+ */var Re;function Je(){return Re||(Re=1,process.env.NODE_ENV!=="production"&&(function(){var s=i,d=Symbol.for("react.element"),R=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),g=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),I=Symbol.for("react.offscreen"),k=Symbol.iterator,L="@@iterator";function M(e){if(e===null||typeof e!="object")return null;var t=k&&e[k]||e[L];return typeof t=="function"?t:null}var F=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(e){{for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];E("error",e,n)}}function E(e,t,n){{var a=F.ReactDebugCurrentFrame,b=a.getStackAddendum();b!==""&&(t+="%s",n=n.concat([b]));var j=n.map(function(p){return String(p)});j.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,j)}}var B=!1,O=!1,N=!1,h=!1,J=!1,Z;Z=Symbol.for("react.module.reference");function de(e){return!!(typeof e=="string"||typeof e=="function"||e===l||e===m||J||e===C||e===v||e===u||h||e===I||B||O||N||typeof e=="object"&&e!==null&&(e.$$typeof===x||e.$$typeof===_||e.$$typeof===y||e.$$typeof===g||e.$$typeof===c||e.$$typeof===Z||e.getModuleId!==void 0))}function fe(e,t,n){var a=e.displayName;if(a)return a;var b=t.displayName||t.name||"";return b!==""?n+"("+b+")":n}function ae(e){return e.displayName||"Context"}function W(e){if(e==null)return null;if(typeof e.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case l:return"Fragment";case R:return"Portal";case m:return"Profiler";case C:return"StrictMode";case v:return"Suspense";case u:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case g:var t=e;return ae(t)+".Consumer";case y:var n=e;return ae(n._context)+".Provider";case c:return fe(e,e.render,"ForwardRef");case _:var a=e.displayName||null;return a!==null?a:W(e.type)||"Memo";case x:{var b=e,j=b._payload,p=b._init;try{return W(p(j))}catch{return null}}}return null}var V=Object.assign,G=0,me,q,Q,$,ee,re,o;function S(){}S.__reactDisabledLog=!0;function U(){{if(G===0){me=console.log,q=console.info,Q=console.warn,$=console.error,ee=console.group,re=console.groupCollapsed,o=console.groupEnd;var e={configurable:!0,enumerable:!0,value:S,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}G++}}function X(){{if(G--,G===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:V({},e,{value:me}),info:V({},e,{value:q}),warn:V({},e,{value:Q}),error:V({},e,{value:$}),group:V({},e,{value:ee}),groupCollapsed:V({},e,{value:re}),groupEnd:V({},e,{value:o})})}G<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ie=F.ReactCurrentDispatcher,te;function D(e,t,n){{if(te===void 0)try{throw Error()}catch(b){var a=b.stack.trim().match(/\n( *(at )?)/);te=a&&a[1]||""}return`
18
+ `+te+e}}var ne=!1,he;{var sr=typeof WeakMap=="function"?WeakMap:Map;he=new sr}function Se(e,t){if(!e||ne)return"";{var n=he.get(e);if(n!==void 0)return n}var a;ne=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var j;j=ie.current,ie.current=null,U();try{if(t){var p=function(){throw Error()};if(Object.defineProperty(p.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(p,[])}catch(z){a=z}Reflect.construct(e,[],p)}else{try{p.call()}catch(z){a=z}e.call(p.prototype)}}else{try{throw Error()}catch(z){a=z}e()}}catch(z){if(z&&a&&typeof z.stack=="string"){for(var f=z.stack.split(`
19
19
  `),A=a.stack.split(`
20
20
  `),T=f.length-1,P=A.length-1;T>=1&&P>=0&&f[T]!==A[P];)P--;for(;T>=1&&P>=0;T--,P--)if(f[T]!==A[P]){if(T!==1||P!==1)do if(T--,P--,P<0||f[T]!==A[P]){var K=`
21
- `+f[T].replace(" at new "," at ");return e.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",e.displayName)),typeof e=="function"&&he.set(e,K),K}while(T>=1&&P>=0);break}}}finally{se=!1,ie.current=j,X(),Error.prepareStackTrace=b}var le=e?e.displayName||e.name:"",ne=le?D(le):"";return typeof e=="function"&&he.set(e,ne),ne}function ar(e,t,s){return Se(e,!1)}function ir(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function xe(e,t,s){if(e==null)return"";if(typeof e=="function")return Se(e,ir(e));if(typeof e=="string")return D(e);switch(e){case v:return D("Suspense");case l:return D("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case u:return ar(e.render);case _:return xe(e.type,t,s);case x:{var a=e,b=a._payload,j=a._init;try{return xe(j(b),t,s)}catch{}}}return""}var pe=Object.prototype.hasOwnProperty,Te={},Pe=F.ReactDebugCurrentFrame;function ge(e){if(e){var t=e._owner,s=xe(e.type,e._source,t?t.type:null);Pe.setExtraStackFrame(s)}else Pe.setExtraStackFrame(null)}function or(e,t,s,a,b){{var j=Function.call.bind(pe);for(var p in e)if(j(e,p)){var f=void 0;try{if(typeof e[p]!="function"){var A=Error((a||"React class")+": "+s+" type `"+p+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[p]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw A.name="Invariant Violation",A}f=e[p](t,p,a,s,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(T){f=T}f&&!(f instanceof Error)&&(ge(b),w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",a||"React class",s,p,typeof f),ge(null)),f instanceof Error&&!(f.message in Te)&&(Te[f.message]=!0,ge(b),w("Failed %s type: %s",s,f.message),ge(null))}}}var lr=Array.isArray;function be(e){return lr(e)}function cr(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,s=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return s}}function ur(e){try{return Me(e),!1}catch{return!0}}function Me(e){return""+e}function Oe(e){if(ur(e))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",cr(e)),Me(e)}var Fe=F.ReactCurrentOwner,dr={key:!0,ref:!0,__self:!0,__source:!0},Ae,Ie;function fr(e){if(pe.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function mr(e){if(pe.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function pr(e,t){typeof e.ref=="string"&&Fe.current}function vr(e,t){{var s=function(){Ae||(Ae=!0,w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};s.isReactWarning=!0,Object.defineProperty(e,"key",{get:s,configurable:!0})}}function hr(e,t){{var s=function(){Ie||(Ie=!0,w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};s.isReactWarning=!0,Object.defineProperty(e,"ref",{get:s,configurable:!0})}}var xr=function(e,t,s,a,b,j,p){var f={$$typeof:d,type:e,key:t,ref:s,props:p,_owner:j};return f._store={},Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(f,"_self",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.defineProperty(f,"_source",{configurable:!1,enumerable:!1,writable:!1,value:b}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f};function gr(e,t,s,a,b){{var j,p={},f=null,A=null;s!==void 0&&(Oe(s),f=""+s),mr(t)&&(Oe(t.key),f=""+t.key),fr(t)&&(A=t.ref,pr(t,b));for(j in t)pe.call(t,j)&&!dr.hasOwnProperty(j)&&(p[j]=t[j]);if(e&&e.defaultProps){var T=e.defaultProps;for(j in T)p[j]===void 0&&(p[j]=T[j])}if(f||A){var P=typeof e=="function"?e.displayName||e.name||"Unknown":e;f&&vr(p,P),A&&hr(p,P)}return xr(e,f,A,b,a,Fe.current,p)}}var ye=F.ReactCurrentOwner,Le=F.ReactDebugCurrentFrame;function oe(e){if(e){var t=e._owner,s=xe(e.type,e._source,t?t.type:null);Le.setExtraStackFrame(s)}else Le.setExtraStackFrame(null)}var je;je=!1;function ke(e){return typeof e=="object"&&e!==null&&e.$$typeof===d}function Ue(){{if(ye.current){var e=W(ye.current.type);if(e)return`
21
+ `+f[T].replace(" at new "," at ");return e.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",e.displayName)),typeof e=="function"&&he.set(e,K),K}while(T>=1&&P>=0);break}}}finally{ne=!1,ie.current=j,X(),Error.prepareStackTrace=b}var le=e?e.displayName||e.name:"",se=le?D(le):"";return typeof e=="function"&&he.set(e,se),se}function ar(e,t,n){return Se(e,!1)}function ir(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function xe(e,t,n){if(e==null)return"";if(typeof e=="function")return Se(e,ir(e));if(typeof e=="string")return D(e);switch(e){case v:return D("Suspense");case u:return D("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case c:return ar(e.render);case _:return xe(e.type,t,n);case x:{var a=e,b=a._payload,j=a._init;try{return xe(j(b),t,n)}catch{}}}return""}var pe=Object.prototype.hasOwnProperty,Te={},Pe=F.ReactDebugCurrentFrame;function ge(e){if(e){var t=e._owner,n=xe(e.type,e._source,t?t.type:null);Pe.setExtraStackFrame(n)}else Pe.setExtraStackFrame(null)}function or(e,t,n,a,b){{var j=Function.call.bind(pe);for(var p in e)if(j(e,p)){var f=void 0;try{if(typeof e[p]!="function"){var A=Error((a||"React class")+": "+n+" type `"+p+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[p]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw A.name="Invariant Violation",A}f=e[p](t,p,a,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(T){f=T}f&&!(f instanceof Error)&&(ge(b),w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",a||"React class",n,p,typeof f),ge(null)),f instanceof Error&&!(f.message in Te)&&(Te[f.message]=!0,ge(b),w("Failed %s type: %s",n,f.message),ge(null))}}}var lr=Array.isArray;function be(e){return lr(e)}function cr(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,n=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n}}function ur(e){try{return Me(e),!1}catch{return!0}}function Me(e){return""+e}function Oe(e){if(ur(e))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",cr(e)),Me(e)}var Fe=F.ReactCurrentOwner,dr={key:!0,ref:!0,__self:!0,__source:!0},Ae,Ie;function fr(e){if(pe.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function mr(e){if(pe.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function pr(e,t){typeof e.ref=="string"&&Fe.current}function vr(e,t){{var n=function(){Ae||(Ae=!0,w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}}function hr(e,t){{var n=function(){Ie||(Ie=!0,w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}}var xr=function(e,t,n,a,b,j,p){var f={$$typeof:d,type:e,key:t,ref:n,props:p,_owner:j};return f._store={},Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(f,"_self",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.defineProperty(f,"_source",{configurable:!1,enumerable:!1,writable:!1,value:b}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f};function gr(e,t,n,a,b){{var j,p={},f=null,A=null;n!==void 0&&(Oe(n),f=""+n),mr(t)&&(Oe(t.key),f=""+t.key),fr(t)&&(A=t.ref,pr(t,b));for(j in t)pe.call(t,j)&&!dr.hasOwnProperty(j)&&(p[j]=t[j]);if(e&&e.defaultProps){var T=e.defaultProps;for(j in T)p[j]===void 0&&(p[j]=T[j])}if(f||A){var P=typeof e=="function"?e.displayName||e.name||"Unknown":e;f&&vr(p,P),A&&hr(p,P)}return xr(e,f,A,b,a,Fe.current,p)}}var ye=F.ReactCurrentOwner,Le=F.ReactDebugCurrentFrame;function oe(e){if(e){var t=e._owner,n=xe(e.type,e._source,t?t.type:null);Le.setExtraStackFrame(n)}else Le.setExtraStackFrame(null)}var je;je=!1;function ke(e){return typeof e=="object"&&e!==null&&e.$$typeof===d}function Ue(){{if(ye.current){var e=W(ye.current.type);if(e)return`
22
22
 
23
- Check the render method of \``+e+"`."}return""}}function br(e){return""}var De={};function yr(e){{var t=Ue();if(!t){var s=typeof e=="string"?e:e.displayName||e.name;s&&(t=`
23
+ Check the render method of \``+e+"`."}return""}}function br(e){return""}var De={};function yr(e){{var t=Ue();if(!t){var n=typeof e=="string"?e:e.displayName||e.name;n&&(t=`
24
24
 
25
- Check the top-level render call using <`+s+">.")}return t}}function ze(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var s=yr(t);if(De[s])return;De[s]=!0;var a="";e&&e._owner&&e._owner!==ye.current&&(a=" It was passed a child from "+W(e._owner.type)+"."),oe(e),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',s,a),oe(null)}}function We(e,t){{if(typeof e!="object")return;if(be(e))for(var s=0;s<e.length;s++){var a=e[s];ke(a)&&ze(a,t)}else if(ke(e))e._store&&(e._store.validated=!0);else if(e){var b=M(e);if(typeof b=="function"&&b!==e.entries)for(var j=b.call(e),p;!(p=j.next()).done;)ke(p.value)&&ze(p.value,t)}}}function jr(e){{var t=e.type;if(t==null||typeof t=="string")return;var s;if(typeof t=="function")s=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===u||t.$$typeof===_))s=t.propTypes;else return;if(s){var a=W(t);or(s,e.props,"prop",a,e)}else if(t.PropTypes!==void 0&&!je){je=!0;var b=W(t);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",b||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function kr(e){{for(var t=Object.keys(e.props),s=0;s<t.length;s++){var a=t[s];if(a!=="children"&&a!=="key"){oe(e),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",a),oe(null);break}}e.ref!==null&&(oe(e),w("Invalid attribute `ref` supplied to `React.Fragment`."),oe(null))}}var Ke={};function Be(e,t,s,a,b,j){{var p=de(e);if(!p){var f="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(f+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var A=br();A?f+=A:f+=Ue();var T;e===null?T="null":be(e)?T="array":e!==void 0&&e.$$typeof===d?(T="<"+(W(e.type)||"Unknown")+" />",f=" Did you accidentally export a JSX literal instead of a component?"):T=typeof e,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",T,f)}var P=gr(e,t,s,b,j);if(P==null)return P;if(p){var K=t.children;if(K!==void 0)if(a)if(be(K)){for(var le=0;le<K.length;le++)We(K[le],e);Object.freeze&&Object.freeze(K)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else We(K,e)}if(pe.call(t,"key")){var ne=W(e),z=Object.keys(t).filter(function(Nr){return Nr!=="key"}),we=z.length>0?"{key: someKey, "+z.join(": ..., ")+": ...}":"{key: someKey}";if(!Ke[ne+we]){var _r=z.length>0?"{"+z.join(": ..., ")+": ...}":"{}";w(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+n+">.")}return t}}function ze(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var n=yr(t);if(De[n])return;De[n]=!0;var a="";e&&e._owner&&e._owner!==ye.current&&(a=" It was passed a child from "+W(e._owner.type)+"."),oe(e),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,a),oe(null)}}function We(e,t){{if(typeof e!="object")return;if(be(e))for(var n=0;n<e.length;n++){var a=e[n];ke(a)&&ze(a,t)}else if(ke(e))e._store&&(e._store.validated=!0);else if(e){var b=M(e);if(typeof b=="function"&&b!==e.entries)for(var j=b.call(e),p;!(p=j.next()).done;)ke(p.value)&&ze(p.value,t)}}}function jr(e){{var t=e.type;if(t==null||typeof t=="string")return;var n;if(typeof t=="function")n=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===c||t.$$typeof===_))n=t.propTypes;else return;if(n){var a=W(t);or(n,e.props,"prop",a,e)}else if(t.PropTypes!==void 0&&!je){je=!0;var b=W(t);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",b||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function kr(e){{for(var t=Object.keys(e.props),n=0;n<t.length;n++){var a=t[n];if(a!=="children"&&a!=="key"){oe(e),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",a),oe(null);break}}e.ref!==null&&(oe(e),w("Invalid attribute `ref` supplied to `React.Fragment`."),oe(null))}}var Ke={};function Be(e,t,n,a,b,j){{var p=de(e);if(!p){var f="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(f+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var A=br();A?f+=A:f+=Ue();var T;e===null?T="null":be(e)?T="array":e!==void 0&&e.$$typeof===d?(T="<"+(W(e.type)||"Unknown")+" />",f=" Did you accidentally export a JSX literal instead of a component?"):T=typeof e,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",T,f)}var P=gr(e,t,n,b,j);if(P==null)return P;if(p){var K=t.children;if(K!==void 0)if(a)if(be(K)){for(var le=0;le<K.length;le++)We(K[le],e);Object.freeze&&Object.freeze(K)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else We(K,e)}if(pe.call(t,"key")){var se=W(e),z=Object.keys(t).filter(function(Nr){return Nr!=="key"}),we=z.length>0?"{key: someKey, "+z.join(": ..., ")+": ...}":"{key: someKey}";if(!Ke[se+we]){var _r=z.length>0?"{"+z.join(": ..., ")+": ...}":"{}";w(`A props object containing a "key" prop is being spread into JSX:
26
26
  let props = %s;
27
27
  <%s {...props} />
28
28
  React keys must be passed directly to JSX without using spread:
29
29
  let props = %s;
30
- <%s key={someKey} {...props} />`,we,ne,_r,ne),Ke[ne+we]=!0}}return e===c?kr(P):jr(P),P}}function wr(e,t,s){return Be(e,t,s,!0)}function Er(e,t,s){return Be(e,t,s,!1)}var Cr=Er,Rr=wr;ue.Fragment=c,ue.jsx=Cr,ue.jsxs=Rr})()),ue}var _e;function Ge(){return _e||(_e=1,process.env.NODE_ENV==="production"?ve.exports=Ye():ve.exports=Je()),ve.exports}var r=Ge();function Ne({text:n,className:d="",placeholder:R}){return!n&&R?r.jsx("span",{className:`apmsu-placeholder ${d}`,children:R}):n?r.jsx("span",{className:`inline-flex min-w-0 ${d}`,children:r.jsx(Ve.Ticker,{value:n,charWidth:.8,duration:300})}):null}function Xe({providers:n,selectedProviderId:d,onSelect:R,isOpen:c,setIsOpen:C,disabled:m,language:y="zh"}){const g=H.I18N[y],u=i.useRef(null),v=n.find(l=>l.id===d);return i.useEffect(()=>{const l=_=>{u.current&&!u.current.contains(_.target)&&C(!1)};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[C]),r.jsxs("div",{className:"apmsu-field",ref:u,children:[r.jsx("label",{className:"apmsu-label",children:g.providerLabel}),r.jsxs("div",{className:"relative",children:[r.jsxs("button",{type:"button",onClick:()=>!m&&C(!c),disabled:m,className:"apmsu-select-trigger",children:[v?r.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("img",{src:v.icon,alt:v.name,className:"apmsu-provider-icon"}),r.jsx(Ne,{text:v.name})]}):r.jsx("span",{className:"apmsu-placeholder",children:g.selectProvider}),r.jsx(He,{isOpen:c})]}),r.jsx("div",{className:`apmsu-dropdown max-h-[300px] overflow-auto p-1 origin-top ${c?"apmsu-dropdown-open":""}`,children:n.map(l=>r.jsxs("button",{type:"button",onClick:()=>{R(l.id),C(!1)},className:`apmsu-dropdown-item rounded-sm ${d===l.id?"apmsu-dropdown-item-active":""}`,children:[r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[r.jsx("img",{src:l.icon,alt:l.name,className:"apmsu-provider-icon"}),r.jsx("span",{className:"font-medium whitespace-nowrap",children:l.name})]}),r.jsx("span",{className:"apmsu-hint-text ml-auto text-right truncate flex-1 min-w-0",children:l.baseUrl.replace("https://","")})]},l.id))})]})]})}const He=({isOpen:n})=>r.jsx("svg",{className:`apmsu-chevron ${n?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})});function Ze({provider:n,apiKey:d,onChange:R,testStatus:c,disabled:C,language:m="zh"}){const[y,g]=i.useState(!1),u=H.I18N[m];if(!n||!n.needsApiKey)return null;const v=()=>c==="success"?"apmsu-input apmsu-input-success":"apmsu-input apmsu-input-default";return r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"apmsu-label",children:u.apiKeyLabel}),r.jsxs("div",{className:"relative",children:[r.jsx("input",{type:y?"text":"password",value:d,onChange:l=>R(l.target.value),onFocus:()=>g(!0),onBlur:()=>g(!1),placeholder:u.apiKeyPlaceholder,disabled:C,className:`${v()} pr-10`}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center justify-center",children:y?r.jsxs("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}):r.jsx("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"})})})]})]})}function Qe({provider:n,models:d,selectedModelId:R,onSelect:c,isOpen:C,setIsOpen:m,hasApiKey:y,disabled:g,language:u="zh",isFetchingModels:v,fetchModelError:l,selectedModelName:_}){var w;const x=H.I18N[u],I=i.useRef(null),[k,L]=i.useState("");i.useEffect(()=>{const E=B=>{I.current&&!I.current.contains(B.target)&&(m(!1),L(""))};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[m]);const M=d.filter(E=>E.name.toLowerCase().includes(k.toLowerCase())||E.id.toLowerCase().includes(k.toLowerCase())),F=((w=d.find(E=>E.id===R))==null?void 0:w.name)||_||R;return r.jsxs("div",{className:"apmsu-field",ref:I,children:[r.jsx("label",{className:"apmsu-label flex items-center justify-between",children:r.jsx("span",{children:x.modelLabel})}),r.jsxs("div",{className:"relative",children:[r.jsxs("button",{type:"button",onClick:()=>!g&&n&&m(!C),disabled:g||!n,className:"apmsu-select-trigger",children:[r.jsx(Ne,{text:F,placeholder:x.selectModel}),r.jsx(qe,{isOpen:C})]}),r.jsxs("div",{className:`apmsu-dropdown origin-top ${C?"apmsu-dropdown-open":""}`,children:[r.jsx("div",{className:"p-1.5 apmsu-divider",children:r.jsx("input",{type:"text",value:k,onChange:E=>L(E.target.value),placeholder:x.searchModel,className:"apmsu-select-trigger",autoFocus:C})}),r.jsxs("div",{className:"max-h-60 overflow-auto",children:[k&&!M.some(E=>E.id===k)&&r.jsx("button",{type:"button",onClick:()=>{c(k),m(!1),L("")},className:"apmsu-dropdown-item bg-blue-50 dark:bg-blue-900/20 border-b",children:r.jsxs("span",{className:"text-blue-500",children:[x.useCustom,": ",k]})}),M.map(E=>r.jsx("button",{type:"button",onClick:()=>{c(E.id,E.name),m(!1),L("")},className:`apmsu-dropdown-item ${R===E.id?"apmsu-dropdown-item-active":""}`,children:r.jsx("span",{children:E.name})},E.id)),M.length===0&&!k&&r.jsx("div",{className:"p-4 text-center apmsu-hint-text",children:x.noModels})]})]})]}),(n==null?void 0:n.supportsModelsApi)&&r.jsx("div",{className:"min-h-[20px] flex items-center",children:v?r.jsx("p",{className:"apmsu-hint-text animate-pulse",children:x.refreshingModels}):l?r.jsx("p",{className:"apmsu-hint-text dark:text-zinc-500",children:x[l]||l}):n!=null&&n.needsApiKey&&!y?r.jsx("p",{className:"apmsu-hint-text",children:x.apiKeyTip}):r.jsx("p",{className:"apmsu-hint-text",children:x.modelListUpdated})})]})}const qe=({isOpen:n})=>r.jsx("svg",{className:`apmsu-chevron ${n?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})});function $e({provider:n,baseUrl:d,onChange:R,disabled:c,language:C="zh"}){const[m,y]=i.useState(!1),g=H.I18N[C];return n?r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>y(!m),className:"text-xs text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 flex items-center gap-1 transition-colors",children:[r.jsx("svg",{className:`w-3 h-3 transition-transform ${m?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),g.customBaseUrl]}),r.jsx("div",{className:"grid transition-all duration-200 ease-out",style:{gridTemplateRows:m?"1fr":"0fr"},children:r.jsx("div",{className:"overflow-hidden",children:r.jsx("input",{type:"text",value:d,onChange:u=>R(u.target.value),placeholder:n.baseUrl,disabled:c,className:"apmsu-input apmsu-input-default"})})})]}):null}function er({proxyUrl:n,config:d,initialConfig:R,title:c,showPreview:C=!1,saveButtonText:m,disabled:y=!1,onSave:g,onTestResult:u,onChange:v,onSerialize:l,onDeserialize:_,language:x="zh",modelFetcher:I}){const k=i.useMemo(()=>H.I18N[x],[x]),{providerId:L,apiKey:M,model:F,modelName:w,baseUrl:E,models:B,testStatus:O,testResult:N,provider:h,providers:J,isValid:Z,setProviderId:de,setApiKey:fe,selectModel:ae,setBaseUrl:W,runTest:V,save:G,isFetchingModels:me,fetchModelError:q,config:Q}=Ee({proxyUrl:n,providerConfig:d,initialConfig:R,onSerialize:l,onDeserialize:_,modelFetcher:I}),[$,ee]=i.useState(!1),[re,o]=i.useState(!1),[S,U]=i.useState("idle"),[X,ie]=i.useState(!1);i.useEffect(()=>{v==null||v({providerId:L,apiKey:M,model:F,baseUrl:E})},[L,M,F,E,v]),i.useEffect(()=>{N&&(u==null||u(N))},[N,u]);const te=i.useCallback(()=>{G(),U("saved"),g==null||g(Q),setTimeout(()=>U("idle"),2e3)},[G,g,Q]);return r.jsxs("div",{className:"apmsu-card",children:[c&&r.jsx("h2",{className:"text-lg font-semibold mb-4",children:c}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Xe,{providers:J,selectedProviderId:L,onSelect:de,isOpen:$,setIsOpen:ee,disabled:y,language:x}),r.jsx($e,{provider:h,baseUrl:E,onChange:W,disabled:y,language:x}),r.jsx("div",{className:`transition-all duration-500 ease-in-out ${L?"max-h-[1000px] opacity-100 overflow-visible":"max-h-0 opacity-0 overflow-hidden"}`,children:r.jsxs("div",{className:"space-y-4",children:[r.jsx(Ze,{provider:h,apiKey:M,onChange:fe,testStatus:O,disabled:y,language:x}),r.jsx(Qe,{provider:h,models:B,selectedModelId:F,onSelect:ae,isOpen:re,setIsOpen:o,hasApiKey:!!M,disabled:y,language:x,isFetchingModels:me,fetchModelError:q,selectedModelName:w})]})}),r.jsxs("div",{className:"pt-2 space-y-2",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>V(),disabled:!L||!M||!F||y||O==="testing",className:`apmsu-btn flex-1 ${O==="success"?"apmsu-btn-success":O==="error"?"bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-900/40":"apmsu-btn-ghost border border-gray-200 dark:border-zinc-700"}`,children:O==="testing"?r.jsxs("span",{className:"flex items-center justify-center gap-2",children:[r.jsx(rr,{}),k.testing]}):O==="success"?r.jsxs("span",{className:"flex items-center justify-center gap-2",children:[r.jsx(tr,{}),k.testSuccess," ",(N==null?void 0:N.latencyMs)&&`${N.latencyMs}ms`]}):O==="error"?r.jsxs("span",{className:"flex items-center justify-center gap-2",children:[r.jsx(sr,{}),k.testFailed]}):k.testConnection}),r.jsx("button",{onClick:te,disabled:!Z||y,className:`apmsu-btn flex-1 ${S==="saved"?"apmsu-btn-success":"apmsu-btn-primary"}`,children:S==="saved"?r.jsxs("span",{className:"flex items-center justify-center gap-2",children:[r.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})}),k.saved]}):m||k.save})]}),r.jsx("div",{className:"grid transition-all duration-200 ease-out",style:{gridTemplateRows:!(N!=null&&N.success)&&(N!=null&&N.message)&&O!=="testing"&&O!=="success"?"1fr":"0fr"},children:r.jsx("div",{className:"overflow-hidden",children:r.jsx("div",{className:"p-2 rounded-md bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",children:r.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 line-clamp-3 text-left",children:N==null?void 0:N.message})})})})]})]}),C&&h&&r.jsxs("div",{className:"mt-6 border border-gray-200/50 dark:border-zinc-800 rounded-lg overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>ie(!X),className:"w-full flex items-center justify-between px-4 py-3 bg-zinc-50 dark:bg-zinc-900/50 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 transition-colors",children:[r.jsx("h3",{className:"text-xs font-medium text-gray-500 dark:text-zinc-500 uppercase tracking-wider",children:k.preview}),r.jsx("svg",{className:`w-4 h-4 text-gray-400 transition-transform duration-200 ${X?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r.jsx("div",{className:"grid transition-all duration-200 ease-out",style:{gridTemplateRows:X?"1fr":"0fr"},children:r.jsx("div",{className:"overflow-hidden",children:r.jsx("pre",{className:"text-xs text-gray-600 dark:text-zinc-400 font-mono overflow-x-auto leading-relaxed p-4 bg-zinc-50 dark:bg-zinc-900/50",children:JSON.stringify({provider:h.name,apiFormat:h.apiFormat,baseUrl:E||h.baseUrl,model:F||k.unselected,hasApiKey:!!M},null,2)})})})]})]})}const rr=()=>r.jsxs("svg",{className:"apmsu-icon-spin",viewBox:"0 0 24 24",fill:"none",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),tr=()=>r.jsx("svg",{className:"apmsu-icon-success",fill:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})}),sr=()=>r.jsx("svg",{className:"apmsu-icon-error",fill:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})});Y.AIConfigForm=er,Y.useAIConfig=Ee,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})}));
30
+ <%s key={someKey} {...props} />`,we,se,_r,se),Ke[se+we]=!0}}return e===l?kr(P):jr(P),P}}function wr(e,t,n){return Be(e,t,n,!0)}function Er(e,t,n){return Be(e,t,n,!1)}var Cr=Er,Rr=wr;ue.Fragment=l,ue.jsx=Cr,ue.jsxs=Rr})()),ue}var _e;function Ge(){return _e||(_e=1,process.env.NODE_ENV==="production"?ve.exports=Ye():ve.exports=Je()),ve.exports}var r=Ge();function Ne({text:s,className:d="",placeholder:R}){return!s&&R?r.jsx("span",{className:`apmsu-placeholder ${d}`,children:R}):s?r.jsx("span",{className:`inline-flex min-w-0 ${d}`,children:r.jsx(Ve.Ticker,{value:s,charWidth:.8,duration:300})}):null}function Xe({providers:s,selectedProviderId:d,onSelect:R,isOpen:l,setIsOpen:C,disabled:m,language:y="zh"}){const g=H.I18N[y],c=i.useRef(null),v=s.find(u=>u.id===d);return i.useEffect(()=>{const u=_=>{c.current&&!c.current.contains(_.target)&&C(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[C]),r.jsxs("div",{className:"apmsu-field",ref:c,children:[r.jsx("label",{className:"apmsu-label",children:g.providerLabel}),r.jsxs("div",{className:"relative",children:[r.jsxs("button",{type:"button",onClick:()=>!m&&C(!l),disabled:m,className:"apmsu-select-trigger",children:[v?r.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("img",{src:v.icon,alt:v.name,className:"apmsu-provider-icon"}),r.jsx(Ne,{text:v.name})]}):r.jsx("span",{className:"apmsu-placeholder",children:g.selectProvider}),r.jsx(He,{isOpen:l})]}),r.jsx("div",{className:`apmsu-dropdown max-h-[300px] overflow-auto p-1 origin-top ${l?"apmsu-dropdown-open":""}`,children:s.map(u=>r.jsxs("button",{type:"button",onClick:()=>{R(u.id),C(!1)},className:`apmsu-dropdown-item rounded-sm ${d===u.id?"apmsu-dropdown-item-active":""}`,children:[r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[r.jsx("img",{src:u.icon,alt:u.name,className:"apmsu-provider-icon"}),r.jsx("span",{className:"font-medium whitespace-nowrap",children:u.name})]}),r.jsx("span",{className:"apmsu-hint-text ml-auto text-right truncate flex-1 min-w-0",children:u.baseUrl.replace("https://","")})]},u.id))})]})]})}const He=({isOpen:s})=>r.jsx("svg",{className:`apmsu-chevron ${s?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})});function Ze({provider:s,apiKey:d,onChange:R,disabled:l,language:C="zh"}){const[m,y]=i.useState(!1),g=H.I18N[C];if(!s||!s.needsApiKey)return null;const c=()=>"apmsu-input apmsu-input-default";return r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"apmsu-label",children:g.apiKeyLabel}),r.jsxs("div",{className:"relative",children:[r.jsx("input",{type:m?"text":"password",value:d,onChange:v=>R(v.target.value),onFocus:()=>y(!0),onBlur:()=>y(!1),placeholder:g.apiKeyPlaceholder,disabled:l,className:`${c()} pr-10`}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center justify-center",children:m?r.jsxs("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}):r.jsx("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"})})})]})]})}function Qe({provider:s,models:d,selectedModelId:R,onSelect:l,isOpen:C,setIsOpen:m,hasApiKey:y,disabled:g,language:c="zh",isFetchingModels:v,fetchModelError:u,selectedModelName:_}){var w;const x=H.I18N[c],I=i.useRef(null),[k,L]=i.useState("");i.useEffect(()=>{const E=B=>{I.current&&!I.current.contains(B.target)&&(m(!1),L(""))};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[m]);const M=d.filter(E=>E.name.toLowerCase().includes(k.toLowerCase())||E.id.toLowerCase().includes(k.toLowerCase())),F=((w=d.find(E=>E.id===R))==null?void 0:w.name)||_||R;return r.jsxs("div",{className:"apmsu-field",ref:I,children:[r.jsx("label",{className:"apmsu-label flex items-center justify-between",children:r.jsx("span",{children:x.modelLabel})}),r.jsxs("div",{className:"relative",children:[r.jsxs("button",{type:"button",onClick:()=>!g&&s&&m(!C),disabled:g||!s,className:"apmsu-select-trigger",children:[r.jsx(Ne,{text:F,placeholder:x.selectModel}),r.jsx(qe,{isOpen:C})]}),r.jsxs("div",{className:`apmsu-dropdown origin-top ${C?"apmsu-dropdown-open":""}`,children:[r.jsx("div",{className:"p-1.5 apmsu-divider",children:r.jsx("input",{type:"text",value:k,onChange:E=>L(E.target.value),placeholder:x.searchModel,className:"apmsu-select-trigger",autoFocus:C})}),r.jsxs("div",{className:"max-h-60 overflow-auto",children:[k&&!M.some(E=>E.id===k)&&r.jsx("button",{type:"button",onClick:()=>{l(k),m(!1),L("")},className:"apmsu-dropdown-item bg-blue-50 dark:bg-blue-900/20 border-b",children:r.jsxs("span",{className:"text-blue-500",children:[x.useCustom,": ",k]})}),M.map(E=>r.jsx("button",{type:"button",onClick:()=>{l(E.id,E.name),m(!1),L("")},className:`apmsu-dropdown-item ${R===E.id?"apmsu-dropdown-item-active":""}`,children:r.jsx("span",{children:E.name})},E.id)),M.length===0&&!k&&r.jsx("div",{className:"p-4 text-center apmsu-hint-text",children:x.noModels})]})]})]}),(s==null?void 0:s.supportsModelsApi)&&r.jsx("div",{className:"min-h-[20px] flex items-center",children:v?r.jsx("p",{className:"apmsu-hint-text animate-pulse",children:x.refreshingModels}):u?r.jsx("p",{className:"apmsu-hint-text dark:text-zinc-500",children:x[u]||u}):s!=null&&s.needsApiKey&&!y?r.jsx("p",{className:"apmsu-hint-text",children:x.apiKeyTip}):r.jsx("p",{className:"apmsu-hint-text",children:x.modelListUpdated})})]})}const qe=({isOpen:s})=>r.jsx("svg",{className:`apmsu-chevron ${s?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})});function $e({provider:s,baseUrl:d,onChange:R,disabled:l,language:C="zh"}){const[m,y]=i.useState(!1),g=H.I18N[C];return s?r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>y(!m),className:"text-xs text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 flex items-center gap-1 transition-colors",children:[r.jsx("svg",{className:`w-3 h-3 transition-transform ${m?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),g.customBaseUrl]}),r.jsx("div",{className:"grid transition-all duration-200 ease-out",style:{gridTemplateRows:m?"1fr":"0fr"},children:r.jsx("div",{className:"overflow-hidden",children:r.jsx("input",{type:"text",value:d,onChange:c=>R(c.target.value),placeholder:s.baseUrl,disabled:l,className:"apmsu-input apmsu-input-default"})})})]}):null}function er({proxyUrl:s,config:d,initialConfig:R,title:l,showPreview:C=!1,saveButtonText:m,disabled:y=!1,onSave:g,onTestResult:c,onChange:v,onSerialize:u,onDeserialize:_,language:x="zh",modelFetcher:I}){const k=i.useMemo(()=>H.I18N[x],[x]),{providerId:L,apiKey:M,model:F,modelName:w,baseUrl:E,models:B,testStatus:O,testResult:N,provider:h,providers:J,isValid:Z,setProviderId:de,setApiKey:fe,selectModel:ae,setBaseUrl:W,runTest:V,save:G,isFetchingModels:me,fetchModelError:q,config:Q}=Ee({proxyUrl:s,providerConfig:d,initialConfig:R,onSerialize:u,onDeserialize:_,modelFetcher:I}),[$,ee]=i.useState(!1),[re,o]=i.useState(!1),[S,U]=i.useState("idle"),[X,ie]=i.useState(!1);i.useEffect(()=>{v==null||v({providerId:L,apiKey:M,model:F,baseUrl:E})},[L,M,F,E,v]),i.useEffect(()=>{N&&(c==null||c(N))},[N,c]);const te=i.useCallback(()=>{G(),U("saved"),g==null||g(Q),setTimeout(()=>U("idle"),2e3)},[G,g,Q]);return r.jsxs("div",{className:"apmsu-card",children:[l&&r.jsx("h2",{className:"text-lg font-semibold mb-4",children:l}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Xe,{providers:J,selectedProviderId:L,onSelect:de,isOpen:$,setIsOpen:ee,disabled:y,language:x}),r.jsx($e,{provider:h,baseUrl:E,onChange:W,disabled:y,language:x}),r.jsx("div",{className:`transition-all duration-500 ease-in-out ${L?"max-h-[1000px] opacity-100 overflow-visible":"max-h-0 opacity-0 overflow-hidden"}`,children:r.jsxs("div",{className:"space-y-4",children:[r.jsx(Ze,{provider:h,apiKey:M,onChange:fe,testStatus:O,disabled:y,language:x}),r.jsx(Qe,{provider:h,models:B,selectedModelId:F,onSelect:ae,isOpen:re,setIsOpen:o,hasApiKey:!!M,disabled:y,language:x,isFetchingModels:me,fetchModelError:q,selectedModelName:w})]})}),r.jsxs("div",{className:"pt-2 space-y-2",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>V(),disabled:!L||!M||!F||y||O==="testing",className:`apmsu-btn flex-1 ${O==="success"?"apmsu-btn-success":O==="error"?"bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-900/40":"apmsu-btn-ghost border border-gray-200 dark:border-zinc-700"}`,children:O==="testing"?r.jsxs("span",{className:"flex items-center justify-center gap-2",children:[r.jsx(rr,{}),k.testing]}):O==="success"?r.jsxs("span",{className:"flex items-center justify-center gap-2",children:[r.jsx(tr,{}),k.testSuccess," ",(N==null?void 0:N.latencyMs)&&`${N.latencyMs}ms`]}):O==="error"?r.jsxs("span",{className:"flex items-center justify-center gap-2",children:[r.jsx(nr,{}),k.testFailed]}):k.testConnection}),r.jsx("button",{onClick:te,disabled:!Z||y,className:`apmsu-btn flex-1 ${S==="saved"?"apmsu-btn-success":"apmsu-btn-primary"}`,children:S==="saved"?r.jsxs("span",{className:"flex items-center justify-center gap-2",children:[r.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})}),k.saved]}):m||k.save})]}),r.jsx("div",{className:"grid transition-all duration-200 ease-out",style:{gridTemplateRows:!(N!=null&&N.success)&&(N!=null&&N.message)&&O!=="testing"&&O!=="success"?"1fr":"0fr"},children:r.jsx("div",{className:"overflow-hidden",children:r.jsx("div",{className:"p-2 rounded-md bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",children:r.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 line-clamp-3 text-left",children:N==null?void 0:N.message})})})})]})]}),C&&h&&r.jsxs("div",{className:"mt-6 border border-gray-200/50 dark:border-zinc-800 rounded-lg overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>ie(!X),className:"w-full flex items-center justify-between px-4 py-3 bg-zinc-50 dark:bg-zinc-900/50 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 transition-colors",children:[r.jsx("h3",{className:"text-xs font-medium text-gray-500 dark:text-zinc-500 uppercase tracking-wider",children:k.preview}),r.jsx("svg",{className:`w-4 h-4 text-gray-400 transition-transform duration-200 ${X?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r.jsx("div",{className:"grid transition-all duration-200 ease-out",style:{gridTemplateRows:X?"1fr":"0fr"},children:r.jsx("div",{className:"overflow-hidden",children:r.jsx("pre",{className:"text-xs text-gray-600 dark:text-zinc-400 font-mono overflow-x-auto leading-relaxed p-4 bg-zinc-50 dark:bg-zinc-900/50",children:JSON.stringify({provider:h.name,apiFormat:h.apiFormat,baseUrl:E||h.baseUrl,model:F||k.unselected,hasApiKey:!!M},null,2)})})})]})]})}const rr=()=>r.jsxs("svg",{className:"apmsu-icon-spin",viewBox:"0 0 24 24",fill:"none",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),tr=()=>r.jsx("svg",{className:"apmsu-icon-success",fill:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})}),nr=()=>r.jsx("svg",{className:"apmsu-icon-error",fill:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})});Y.AIConfigForm=er,Y.useAIConfig=Ee,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})}));
31
31
  //# sourceMappingURL=index.umd.js.map