iobroker.javascript 9.0.7 → 9.0.8
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 +4 -7
- package/admin/assets/OpenAiDialog-BRyhknmu.js +36 -0
- package/admin/assets/{Save-DgI3b32B.js → Save-BCszXKYf.js} +1 -1
- package/admin/assets/{ScriptEditor-CXV4FkqA.js → ScriptEditor-DscINeWJ.js} +1 -1
- package/admin/assets/{ScriptEditorVanillaMonaco-D-2WOvcn.js → ScriptEditorVanillaMonaco-nhdc7Upt.js} +1 -1
- package/admin/assets/createSvgIcon-DgblCazZ.js +30 -0
- package/admin/assets/{index-DLBeMhRC.js → index-BzksVH7W.js} +4 -4
- package/admin/assets/{index-D_7ZHRw9.js → index-Caw9eA1u.js} +1 -1
- package/admin/assets/{index-Del0XJb9.js → index-CifxADFB.js} +1 -1
- package/admin/assets/{index-C5V5CZI4.js → index-CuLNesUT.js} +1 -1
- package/admin/assets/index-DOCky4vY.js +193 -0
- package/admin/assets/index-jqxhK8Zt.js +930 -0
- package/admin/assets/inheritsLoose-DSwHLF2T.js +36 -0
- package/admin/assets/useTheme-DV2tO1lV.js +1 -0
- package/admin/custom/assets/Components-C8Q_PdJG.js +1 -0
- package/admin/custom/assets/DefaultPropsProvider-Bezj9IPf.js +7 -0
- package/admin/custom/assets/DefaultPropsProvider-DQ6dtKrZ.js +1 -0
- package/admin/custom/assets/FilledInput-CEIlqlD1.js +2 -0
- package/admin/custom/assets/Tabs-Cx9dSOCY.js +138 -0
- package/admin/custom/assets/ThemeProvider-7gnV17Cm.js +29 -0
- package/admin/custom/assets/{createSvgIcon-BQThUM-f.js → createSvgIcon-DGttgCVR.js} +1 -1
- package/admin/custom/assets/createTheme-CW8V6Vvd.js +16 -0
- package/admin/custom/assets/defaultTheme-CIHkAzHF.js +1 -0
- package/admin/custom/assets/hostInit-CrAs5YZS.js +1 -1
- package/admin/custom/assets/index-B2rBO0oC.js +1 -0
- package/admin/custom/assets/index-Bngg13Gl.js +1 -0
- package/admin/custom/assets/index-BoDMpfDV.js +904 -0
- package/admin/custom/assets/index-Bw7Lp5Yt.js +7 -0
- package/admin/custom/assets/{index-DIWNdd4a.js → index-D8pO3qKc.js} +1 -1
- package/admin/custom/assets/{index-CoMexdpH.js → index-DWD_PiWG.js} +29 -29
- package/admin/custom/assets/index-MyQg7vyV.js +55 -0
- package/admin/custom/assets/index-Rlkl7Md0.js +1 -0
- package/admin/custom/assets/{index-B8sZ2j0S.js → index-muQ3vq1J.js} +1 -1
- package/admin/custom/assets/useEnhancedEffect-CWsY2xDC.js +8 -0
- package/admin/custom/assets/useTheme-BYiWCERm.js +1 -0
- package/admin/custom/assets/useTheme-BnmV2Fqf.js +1 -0
- package/admin/custom/assets/{virtualExposes-BMKIjWrE.js → virtualExposes-fWevrC15.js} +2 -2
- package/admin/custom/customComponents.js +2 -2
- package/admin/google-blockly/own/blocks_action.js +12 -2
- package/admin/google-blockly/own/blocks_convert.js +17 -3
- package/admin/google-blockly/own/blocks_logic.js +48 -15
- package/admin/google-blockly/own/blocks_object.js +20 -7
- package/admin/google-blockly/own/blocks_sendto.js +48 -11
- package/admin/google-blockly/own/blocks_switch.js +18 -8
- package/admin/google-blockly/own/blocks_system.js +33 -6
- package/admin/google-blockly/own/blocks_text.js +43 -0
- package/admin/google-blockly/own/blocks_time.js +33 -6
- package/admin/google-blockly/own/blocks_trigger.js +49 -18
- package/admin/google-blockly/own/blocks_words.js +4 -0
- package/admin/mf-manifest.json +1 -1
- package/admin/remoteEntry.js +2 -2
- package/admin/tab.html +17 -4
- package/io-package.json +14 -14
- package/package.json +2 -2
- package/admin/assets/OpenAiDialog-CVjeP8wR.js +0 -34
- package/admin/assets/createSvgIcon-Dtl7HhPO.js +0 -30
- package/admin/assets/index-BwNmFzfy.js +0 -193
- package/admin/assets/index-C8bcOa64.js +0 -930
- package/admin/assets/inheritsLoose-C9MZGDit.js +0 -36
- package/admin/assets/useTheme-g_P2Itm2.js +0 -1
- package/admin/custom/assets/Components-D9kRsHNY.js +0 -1
- package/admin/custom/assets/DefaultPropsProvider-9qubdy-V.js +0 -7
- package/admin/custom/assets/DefaultPropsProvider-DbEA5uR6.js +0 -1
- package/admin/custom/assets/FilledInput-BpuM_GyB.js +0 -2
- package/admin/custom/assets/Tabs-CvEv0KOT.js +0 -138
- package/admin/custom/assets/ThemeProvider-DZTpMR8n.js +0 -29
- package/admin/custom/assets/createTheme-BwMO3rTt.js +0 -16
- package/admin/custom/assets/defaultTheme-avbtL0lf.js +0 -1
- package/admin/custom/assets/index-B6ima1M5.js +0 -904
- package/admin/custom/assets/index-B7G6Jpdl.js +0 -1
- package/admin/custom/assets/index-BzS6q3oS.js +0 -55
- package/admin/custom/assets/index-CttBOMyq.js +0 -1
- package/admin/custom/assets/index-Dbe-II7_.js +0 -7
- package/admin/custom/assets/useEnhancedEffect-CdLBzwyA.js +0 -8
- package/admin/custom/assets/useTheme-CDtRWagv.js +0 -1
- package/admin/custom/assets/useTheme-MELayQMj.js +0 -1
- package/admin/custom/assets/useThemeWithoutDefault-C-hl_s0Z.js +0 -1
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import{c as ir,j as O}from"./createSvgIcon-Dtl7HhPO.js";import{i as Z}from"./iobroker_javascript__loadShare__react__loadShare__-BiJPUKBK.js";import{i as j,c as un,C as or}from"./index-C5V5CZI4.js";import{i as U,h as cr}from"./index-DLBeMhRC.js";import{_ as lr}from"./preload-helper-Dp1pzeXC.js";import{C as ur,t as hr}from"./index-Dm1jc4t6.js";import dr from"./ScriptEditorVanillaMonaco-D-2WOvcn.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./iobroker_javascript__mf_v__runtimeInit__mf_v__-CBQgOKij.js";import"./inheritsLoose-C9MZGDit.js";const fr=ir(O.jsx("path",{d:"M11.07 12.85c.77-1.39 2.25-2.21 3.11-3.44.91-1.29.4-3.7-2.18-3.7-1.69 0-2.52 1.28-2.87 2.34L6.54 6.96C7.25 4.83 9.18 3 11.99 3c2.35 0 3.96 1.07 4.78 2.41.7 1.15 1.11 3.3.03 4.9-1.2 1.77-2.35 2.31-2.97 3.45-.25.46-.35.76-.35 2.24h-2.89c-.01-.78-.13-2.05.48-3.15M14 20c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2"}),"QuestionMark");function R(s,e,t,n,r){if(typeof e=="function"?s!==e||!0:!e.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(s,t),t}function c(s,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?s!==e||!n:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(s):n?n.value:e.get(s)}let Fn=function(){const{crypto:s}=globalThis;if(s!=null&&s.randomUUID)return Fn=s.randomUUID.bind(s),s.randomUUID();const e=new Uint8Array(1),t=s?()=>s.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^t()&15>>+n/4).toString(16))};function $t(s){return typeof s=="object"&&s!==null&&("name"in s&&s.name==="AbortError"||"message"in s&&String(s.message).includes("FetchRequestCanceledException"))}const Et=s=>{if(s instanceof Error)return s;if(typeof s=="object"&&s!==null){try{if(Object.prototype.toString.call(s)==="[object Error]"){const e=new Error(s.message,s.cause?{cause:s.cause}:{});return s.stack&&(e.stack=s.stack),s.cause&&!e.cause&&(e.cause=s.cause),s.name&&(e.name=s.name),e}}catch{}try{return new Error(JSON.stringify(s))}catch{}}return new Error(s)};class C extends Error{}class J extends C{constructor(e,t,n,r){super(`${J.makeMessage(e,t,n)}`),this.status=e,this.headers=r,this.requestID=r==null?void 0:r.get("x-request-id"),this.error=t;const a=t;this.code=a==null?void 0:a.code,this.param=a==null?void 0:a.param,this.type=a==null?void 0:a.type}static makeMessage(e,t,n){const r=t!=null&&t.message?typeof t.message=="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||"(no status code or body)"}static generate(e,t,n,r){if(!e||!r)return new ft({message:n,cause:Et(t)});const a=t==null?void 0:t.error;return e===400?new Ln(e,a,n,r):e===401?new Dn(e,a,n,r):e===403?new Bn(e,a,n,r):e===404?new Wn(e,a,n,r):e===409?new Un(e,a,n,r):e===422?new qn(e,a,n,r):e===429?new Jn(e,a,n,r):e>=500?new Hn(e,a,n,r):new J(e,a,n,r)}}class z extends J{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}}class ft extends J{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}}class Ut extends ft{constructor({message:e}={}){super({message:e??"Request timed out."})}}class Ln extends J{}class Dn extends J{}class Bn extends J{}class Wn extends J{}class Un extends J{}class qn extends J{}class Jn extends J{}class Hn extends J{}class Xn extends C{constructor(){super("Could not parse response content as the length limit was reached")}}class Kn extends C{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}class Ie extends Error{constructor(e){super(e)}}const mr=/^[a-z][a-z0-9+.-]*:/i,pr=s=>mr.test(s);let K=s=>(K=Array.isArray,K(s)),hn=K;function gr(s){return typeof s!="object"?{}:s??{}}function _r(s){if(!s)return!0;for(const e in s)return!1;return!0}function yr(s,e){return Object.prototype.hasOwnProperty.call(s,e)}function bt(s){return s!=null&&typeof s=="object"&&!Array.isArray(s)}const wr=(s,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new C(`${s} must be an integer`);if(e<0)throw new C(`${s} must be a positive integer`);return e},br=s=>{try{return JSON.parse(s)}catch{return}},De=s=>new Promise(e=>setTimeout(e,s)),we="5.8.2",Sr=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function xr(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}const Ar=()=>{var t;const s=xr();if(s==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":we,"X-Stainless-OS":fn(Deno.build.os),"X-Stainless-Arch":dn(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:((t=Deno.version)==null?void 0:t.deno)??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":we,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(s==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":we,"X-Stainless-OS":fn(globalThis.process.platform??"unknown"),"X-Stainless-Arch":dn(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};const e=vr();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":we,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":we,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function vr(){if(typeof navigator>"u"||!navigator)return null;const s=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(const{key:e,pattern:t}of s){const n=t.exec(navigator.userAgent);if(n){const r=n[1]||0,a=n[2]||0,i=n[3]||0;return{browser:e,version:`${r}.${a}.${i}`}}}return null}const dn=s=>s==="x32"?"x32":s==="x86_64"||s==="x64"?"x64":s==="arm"?"arm":s==="aarch64"||s==="arm64"?"arm64":s?`other:${s}`:"unknown",fn=s=>(s=s.toLowerCase(),s.includes("ios")?"iOS":s==="android"?"Android":s==="darwin"?"MacOS":s==="win32"?"Windows":s==="freebsd"?"FreeBSD":s==="openbsd"?"OpenBSD":s==="linux"?"Linux":s?`Other:${s}`:"Unknown");let mn;const Cr=()=>mn??(mn=Ar());function Ir(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Vn(...s){const e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...s)}function Gn(s){let e=Symbol.asyncIterator in s?s[Symbol.asyncIterator]():s[Symbol.iterator]();return Vn({start(){},async pull(t){const{done:n,value:r}=await e.next();n?t.close():t.enqueue(r)},async cancel(){var t;await((t=e.return)==null?void 0:t.call(e))}})}function Qn(s){if(s[Symbol.asyncIterator])return s;const e=s.getReader();return{async next(){try{const t=await e.read();return t!=null&&t.done&&e.releaseLock(),t}catch(t){throw e.releaseLock(),t}},async return(){const t=e.cancel();return e.releaseLock(),await t,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Rr(s){var n,r;if(s===null||typeof s!="object")return;if(s[Symbol.asyncIterator]){await((r=(n=s[Symbol.asyncIterator]()).return)==null?void 0:r.call(n));return}const e=s.getReader(),t=e.cancel();e.releaseLock(),await t}const kr=({headers:s,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)}),zn="RFC3986",Yn=s=>String(s),pn={RFC1738:s=>String(s).replace(/%20/g,"+"),RFC3986:Yn},$r="RFC1738";let Ot=(s,e)=>(Ot=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Ot(s,e));const ee=(()=>{const s=[];for(let e=0;e<256;++e)s.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return s})(),St=1024,Er=(s,e,t,n,r)=>{if(s.length===0)return s;let a=s;if(typeof s=="symbol"?a=Symbol.prototype.toString.call(s):typeof s!="string"&&(a=String(s)),t==="iso-8859-1")return escape(a).replace(/%u[0-9a-f]{4}/gi,function(o){return"%26%23"+parseInt(o.slice(2),16)+"%3B"});let i="";for(let o=0;o<a.length;o+=St){const l=a.length>=St?a.slice(o,o+St):a,h=[];for(let _=0;_<l.length;++_){let u=l.charCodeAt(_);if(u===45||u===46||u===95||u===126||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||r===$r&&(u===40||u===41)){h[h.length]=l.charAt(_);continue}if(u<128){h[h.length]=ee[u];continue}if(u<2048){h[h.length]=ee[192|u>>6]+ee[128|u&63];continue}if(u<55296||u>=57344){h[h.length]=ee[224|u>>12]+ee[128|u>>6&63]+ee[128|u&63];continue}_+=1,u=65536+((u&1023)<<10|l.charCodeAt(_)&1023),h[h.length]=ee[240|u>>18]+ee[128|u>>12&63]+ee[128|u>>6&63]+ee[128|u&63]}i+=h.join("")}return i};function Or(s){return!s||typeof s!="object"?!1:!!(s.constructor&&s.constructor.isBuffer&&s.constructor.isBuffer(s))}function gn(s,e){if(K(s)){const t=[];for(let n=0;n<s.length;n+=1)t.push(e(s[n]));return t}return e(s)}const Zn={brackets(s){return String(s)+"[]"},comma:"comma",indices(s,e){return String(s)+"["+e+"]"},repeat(s){return String(s)}},es=function(s,e){Array.prototype.push.apply(s,K(e)?e:[e])};let _n;const B={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Er,encodeValuesOnly:!1,format:zn,formatter:Yn,indices:!1,serializeDate(s){return(_n??(_n=Function.prototype.call.bind(Date.prototype.toISOString)))(s)},skipNulls:!1,strictNullHandling:!1};function Pr(s){return typeof s=="string"||typeof s=="number"||typeof s=="boolean"||typeof s=="symbol"||typeof s=="bigint"}const xt={};function ts(s,e,t,n,r,a,i,o,l,h,_,u,g,d,b,w,A,E){let m=s,y=E,p=0,v=!1;for(;(y=y.get(xt))!==void 0&&!v;){const T=y.get(s);if(p+=1,typeof T<"u"){if(T===p)throw new RangeError("Cyclic object value");v=!0}typeof y.get(xt)>"u"&&(p=0)}if(typeof h=="function"?m=h(e,m):m instanceof Date?m=g==null?void 0:g(m):t==="comma"&&K(m)&&(m=gn(m,function(T){return T instanceof Date?g==null?void 0:g(T):T})),m===null){if(a)return l&&!w?l(e,B.encoder,A,"key",d):e;m=""}if(Pr(m)||Or(m)){if(l){const T=w?e:l(e,B.encoder,A,"key",d);return[(b==null?void 0:b(T))+"="+(b==null?void 0:b(l(m,B.encoder,A,"value",d)))]}return[(b==null?void 0:b(e))+"="+(b==null?void 0:b(String(m)))]}const $=[];if(typeof m>"u")return $;let I;if(t==="comma"&&K(m))w&&l&&(m=gn(m,l)),I=[{value:m.length>0?m.join(",")||null:void 0}];else if(K(h))I=h;else{const T=Object.keys(m);I=_?T.sort(_):T}const F=o?String(e).replace(/\./g,"%2E"):String(e),x=n&&K(m)&&m.length===1?F+"[]":F;if(r&&K(m)&&m.length===0)return x+"[]";for(let T=0;T<I.length;++T){const M=I[T],se=typeof M=="object"&&typeof M.value<"u"?M.value:m[M];if(i&&se===null)continue;const me=u&&o?M.replace(/\./g,"%2E"):M,N=K(m)?typeof t=="function"?t(x,me):x:x+(u?"."+me:"["+me+"]");E.set(s,p);const ie=new WeakMap;ie.set(xt,E),es($,ts(se,N,t,n,r,a,i,o,t==="comma"&&w&&K(m)?null:l,h,_,u,g,d,b,w,A,ie))}return $}function Tr(s=B){if(typeof s.allowEmptyArrays<"u"&&typeof s.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof s.encodeDotInKeys<"u"&&typeof s.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(s.encoder!==null&&typeof s.encoder<"u"&&typeof s.encoder!="function")throw new TypeError("Encoder has to be a function.");const e=s.charset||B.charset;if(typeof s.charset<"u"&&s.charset!=="utf-8"&&s.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let t=zn;if(typeof s.format<"u"){if(!Ot(pn,s.format))throw new TypeError("Unknown format option provided.");t=s.format}const n=pn[t];let r=B.filter;(typeof s.filter=="function"||K(s.filter))&&(r=s.filter);let a;if(s.arrayFormat&&s.arrayFormat in Zn?a=s.arrayFormat:"indices"in s?a=s.indices?"indices":"repeat":a=B.arrayFormat,"commaRoundTrip"in s&&typeof s.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");const i=typeof s.allowDots>"u"?s.encodeDotInKeys?!0:B.allowDots:!!s.allowDots;return{addQueryPrefix:typeof s.addQueryPrefix=="boolean"?s.addQueryPrefix:B.addQueryPrefix,allowDots:i,allowEmptyArrays:typeof s.allowEmptyArrays=="boolean"?!!s.allowEmptyArrays:B.allowEmptyArrays,arrayFormat:a,charset:e,charsetSentinel:typeof s.charsetSentinel=="boolean"?s.charsetSentinel:B.charsetSentinel,commaRoundTrip:!!s.commaRoundTrip,delimiter:typeof s.delimiter>"u"?B.delimiter:s.delimiter,encode:typeof s.encode=="boolean"?s.encode:B.encode,encodeDotInKeys:typeof s.encodeDotInKeys=="boolean"?s.encodeDotInKeys:B.encodeDotInKeys,encoder:typeof s.encoder=="function"?s.encoder:B.encoder,encodeValuesOnly:typeof s.encodeValuesOnly=="boolean"?s.encodeValuesOnly:B.encodeValuesOnly,filter:r,format:t,formatter:n,serializeDate:typeof s.serializeDate=="function"?s.serializeDate:B.serializeDate,skipNulls:typeof s.skipNulls=="boolean"?s.skipNulls:B.skipNulls,sort:typeof s.sort=="function"?s.sort:null,strictNullHandling:typeof s.strictNullHandling=="boolean"?s.strictNullHandling:B.strictNullHandling}}function Mr(s,e={}){let t=s;const n=Tr(e);let r,a;typeof n.filter=="function"?(a=n.filter,t=a("",t)):K(n.filter)&&(a=n.filter,r=a);const i=[];if(typeof t!="object"||t===null)return"";const o=Zn[n.arrayFormat],l=o==="comma"&&n.commaRoundTrip;r||(r=Object.keys(t)),n.sort&&r.sort(n.sort);const h=new WeakMap;for(let g=0;g<r.length;++g){const d=r[g];n.skipNulls&&t[d]===null||es(i,ts(t[d],d,o,l,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,h))}const _=i.join(n.delimiter);let u=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?u+="utf8=%26%2310003%3B&":u+="utf8=%E2%9C%93&"),_.length>0?u+_:""}function Nr(s){let e=0;for(const r of s)e+=r.length;const t=new Uint8Array(e);let n=0;for(const r of s)t.set(r,n),n+=r.length;return t}let yn;function qt(s){let e;return(yn??(e=new globalThis.TextEncoder,yn=e.encode.bind(e)))(s)}let wn;function bn(s){let e;return(wn??(e=new globalThis.TextDecoder,wn=e.decode.bind(e)))(s)}var V,G;class mt{constructor(){V.set(this,void 0),G.set(this,void 0),R(this,V,new Uint8Array),R(this,G,null)}decode(e){if(e==null)return[];const t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?qt(e):e;R(this,V,Nr([c(this,V,"f"),t]));const n=[];let r;for(;(r=jr(c(this,V,"f"),c(this,G,"f")))!=null;){if(r.carriage&&c(this,G,"f")==null){R(this,G,r.index);continue}if(c(this,G,"f")!=null&&(r.index!==c(this,G,"f")+1||r.carriage)){n.push(bn(c(this,V,"f").subarray(0,c(this,G,"f")-1))),R(this,V,c(this,V,"f").subarray(c(this,G,"f"))),R(this,G,null);continue}const a=c(this,G,"f")!==null?r.preceding-1:r.preceding,i=bn(c(this,V,"f").subarray(0,a));n.push(i),R(this,V,c(this,V,"f").subarray(r.index)),R(this,G,null)}return n}flush(){return c(this,V,"f").length?this.decode(`
|
|
2
|
-
`):[]}}V=new WeakMap,G=new WeakMap;mt.NEWLINE_CHARS=new Set([`
|
|
3
|
-
`,"\r"]);mt.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function jr(s,e){for(let r=e??0;r<s.length;r++){if(s[r]===10)return{preceding:r,index:r+1,carriage:!1};if(s[r]===13)return{preceding:r,index:r+1,carriage:!0}}return null}function Fr(s){for(let n=0;n<s.length-1;n++){if(s[n]===10&&s[n+1]===10||s[n]===13&&s[n+1]===13)return n+2;if(s[n]===13&&s[n+1]===10&&n+3<s.length&&s[n+2]===13&&s[n+3]===10)return n+4}return-1}class ne{constructor(e,t){this.iterator=e,this.controller=t}static fromSSEResponse(e,t){let n=!1;async function*r(){if(n)throw new C("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let a=!1;try{for await(const i of Lr(e,t))if(!a){if(i.data.startsWith("[DONE]")){a=!0;continue}if(i.event===null||i.event.startsWith("response.")||i.event.startsWith("transcript.")){let o;try{o=JSON.parse(i.data)}catch(l){throw console.error("Could not parse message into JSON:",i.data),console.error("From chunk:",i.raw),l}if(o&&o.error)throw new J(void 0,o.error,void 0,e.headers);yield o}else{let o;try{o=JSON.parse(i.data)}catch(l){throw console.error("Could not parse message into JSON:",i.data),console.error("From chunk:",i.raw),l}if(i.event=="error")throw new J(void 0,o.error,o.message,void 0);yield{event:i.event,data:o}}}a=!0}catch(i){if($t(i))return;throw i}finally{a||t.abort()}}return new ne(r,t)}static fromReadableStream(e,t){let n=!1;async function*r(){const i=new mt,o=Qn(e);for await(const l of o)for(const h of i.decode(l))yield h;for(const l of i.flush())yield l}async function*a(){if(n)throw new C("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let i=!1;try{for await(const o of r())i||o&&(yield JSON.parse(o));i=!0}catch(o){if($t(o))return;throw o}finally{i||t.abort()}}return new ne(a,t)}[Symbol.asyncIterator](){return this.iterator()}tee(){const e=[],t=[],n=this.iterator(),r=a=>({next:()=>{if(a.length===0){const i=n.next();e.push(i),t.push(i)}return a.shift()}});return[new ne(()=>r(e),this.controller),new ne(()=>r(t),this.controller)]}toReadableStream(){const e=this;let t;return Vn({async start(){t=e[Symbol.asyncIterator]()},async pull(n){try{const{value:r,done:a}=await t.next();if(a)return n.close();const i=qt(JSON.stringify(r)+`
|
|
4
|
-
`);n.enqueue(i)}catch(r){n.error(r)}},async cancel(){var n;await((n=t.return)==null?void 0:n.call(t))}})}}async function*Lr(s,e){if(!s.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new C("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new C("Attempted to iterate over a response with no body");const t=new Br,n=new mt,r=Qn(s.body);for await(const a of Dr(r))for(const i of n.decode(a)){const o=t.decode(i);o&&(yield o)}for(const a of n.flush()){const i=t.decode(a);i&&(yield i)}}async function*Dr(s){let e=new Uint8Array;for await(const t of s){if(t==null)continue;const n=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?qt(t):t;let r=new Uint8Array(e.length+n.length);r.set(e),r.set(n,e.length),e=r;let a;for(;(a=Fr(e))!==-1;)yield e.slice(0,a),e=e.slice(a)}e.length>0&&(yield e)}class Br{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;const a={event:this.event,data:this.data.join(`
|
|
5
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],a}if(this.chunks.push(e),e.startsWith(":"))return null;let[t,n,r]=Wr(e,":");return r.startsWith(" ")&&(r=r.substring(1)),t==="event"?this.event=r:t==="data"&&this.data.push(r),null}}function Wr(s,e){const t=s.indexOf(e);return t!==-1?[s.substring(0,t),e,s.substring(t+e.length)]:[s,"",""]}const it={off:0,error:200,warn:300,info:400,debug:500},Sn=(s,e,t)=>{if(s){if(yr(it,s))return s;H(t).warn(`${e} was set to ${JSON.stringify(s)}, expected one of ${JSON.stringify(Object.keys(it))}`)}};function Re(){}function qe(s,e,t){return!e||it[s]>it[t]?Re:e[s].bind(e)}const Ur={error:Re,warn:Re,info:Re,debug:Re};let xn=new WeakMap;function H(s){const e=s.logger,t=s.logLevel??"off";if(!e)return Ur;const n=xn.get(e);if(n&&n[0]===t)return n[1];const r={error:qe("error",e,t),warn:qe("warn",e,t),info:qe("info",e,t),debug:qe("debug",e,t)};return xn.set(e,[t,r]),r}const le=s=>(s.options&&(s.options={...s.options},delete s.options.headers),s.headers&&(s.headers=Object.fromEntries((s.headers instanceof Headers?[...s.headers]:Object.entries(s.headers)).map(([e,t])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":t]))),"retryOfRequestLogID"in s&&(s.retryOfRequestLogID&&(s.retryOf=s.retryOfRequestLogID),delete s.retryOfRequestLogID),s);async function ns(s,e){const{response:t,requestLogID:n,retryOfRequestLogID:r,startTime:a}=e,i=await(async()=>{var u;if(e.options.stream)return H(s).debug("response",t.status,t.url,t.headers,t.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(t,e.controller):ne.fromSSEResponse(t,e.controller);if(t.status===204)return null;if(e.options.__binaryResponse)return t;const o=t.headers.get("content-type"),l=(u=o==null?void 0:o.split(";")[0])==null?void 0:u.trim();if((l==null?void 0:l.includes("application/json"))||(l==null?void 0:l.endsWith("+json"))){const g=await t.json();return ss(g,t)}return await t.text()})();return H(s).debug(`[${n}] response parsed`,le({retryOfRequestLogID:r,url:t.url,status:t.status,body:i,durationMs:Date.now()-a})),i}function ss(s,e){return!s||typeof s!="object"||Array.isArray(s)?s:Object.defineProperty(s,"_request_id",{value:e.headers.get("x-request-id"),enumerable:!1})}var ke;class pt extends Promise{constructor(e,t,n=ns){super(r=>{r(null)}),this.responsePromise=t,this.parseResponse=n,ke.set(this,void 0),R(this,ke,e)}_thenUnwrap(e){return new pt(c(this,ke,"f"),this.responsePromise,async(t,n)=>ss(e(await this.parseResponse(t,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){const[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t,request_id:t.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(c(this,ke,"f"),e))),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}}ke=new WeakMap;var Je;class rs{constructor(e,t,n,r){Je.set(this,void 0),R(this,Je,e),this.options=r,this.response=t,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){const e=this.nextPageRequestOptions();if(!e)throw new C("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await c(this,Je,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Je=new WeakMap,Symbol.asyncIterator)](){for await(const e of this.iterPages())for(const t of e.getPaginatedItems())yield t}}class qr extends pt{constructor(e,t,n){super(e,t,async(r,a)=>new n(r,a.response,await ns(r,a),a.options))}async*[Symbol.asyncIterator](){const e=await this;for await(const t of e)yield t}}class gt extends rs{constructor(e,t,n,r){super(e,t,n,r),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}}class L extends rs{constructor(e,t,n,r){super(e,t,n,r),this.data=n.data||[],this.has_more=n.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){var n;const e=this.getPaginatedItems(),t=(n=e[e.length-1])==null?void 0:n.id;return t?{...this.options,query:{...gr(this.options.query),after:t}}:null}}const as=()=>{var s;if(typeof File>"u"){const{process:e}=globalThis,t=typeof((s=e==null?void 0:e.versions)==null?void 0:s.node)=="string"&&parseInt(e.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(t?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function Ne(s,e,t){return as(),new File(s,e??"unknown_file",t)}function ze(s){return(typeof s=="object"&&s!==null&&("name"in s&&s.name&&String(s.name)||"url"in s&&s.url&&String(s.url)||"filename"in s&&s.filename&&String(s.filename)||"path"in s&&s.path&&String(s.path))||"").split(/[\\/]/).pop()||void 0}const is=s=>s!=null&&typeof s=="object"&&typeof s[Symbol.asyncIterator]=="function",fe=async(s,e)=>({...s,body:await Hr(s.body,e)}),An=new WeakMap;function Jr(s){const e=typeof s=="function"?s:s.fetch,t=An.get(e);if(t)return t;const n=(async()=>{try{const r="Response"in e?e.Response:(await e("data:,")).constructor,a=new FormData;return a.toString()!==await new r(a).text()}catch{return!0}})();return An.set(e,n),n}const Hr=async(s,e)=>{if(!await Jr(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");const t=new FormData;return await Promise.all(Object.entries(s||{}).map(([n,r])=>Pt(t,n,r))),t},Xr=s=>s instanceof Blob&&"name"in s,Pt=async(s,e,t)=>{if(t!==void 0){if(t==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")s.append(e,String(t));else if(t instanceof Response)s.append(e,Ne([await t.blob()],ze(t)));else if(is(t))s.append(e,Ne([await new Response(Gn(t)).blob()],ze(t)));else if(Xr(t))s.append(e,t,ze(t));else if(Array.isArray(t))await Promise.all(t.map(n=>Pt(s,e+"[]",n)));else if(typeof t=="object")await Promise.all(Object.entries(t).map(([n,r])=>Pt(s,`${e}[${n}]`,r)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${t} instead`)}},os=s=>s!=null&&typeof s=="object"&&typeof s.size=="number"&&typeof s.type=="string"&&typeof s.text=="function"&&typeof s.slice=="function"&&typeof s.arrayBuffer=="function",Kr=s=>s!=null&&typeof s=="object"&&typeof s.name=="string"&&typeof s.lastModified=="number"&&os(s),Vr=s=>s!=null&&typeof s=="object"&&typeof s.url=="string"&&typeof s.blob=="function";async function Gr(s,e,t){if(as(),s=await s,Kr(s))return s instanceof File?s:Ne([await s.arrayBuffer()],s.name);if(Vr(s)){const r=await s.blob();return e||(e=new URL(s.url).pathname.split(/[\\/]/).pop()),Ne(await Tt(r),e,t)}const n=await Tt(s);if(e||(e=ze(s)),!(t!=null&&t.type)){const r=n.find(a=>typeof a=="object"&&"type"in a&&a.type);typeof r=="string"&&(t={...t,type:r})}return Ne(n,e,t)}async function Tt(s){var t;let e=[];if(typeof s=="string"||ArrayBuffer.isView(s)||s instanceof ArrayBuffer)e.push(s);else if(os(s))e.push(s instanceof Blob?s:await s.arrayBuffer());else if(is(s))for await(const n of s)e.push(...await Tt(n));else{const n=(t=s==null?void 0:s.constructor)==null?void 0:t.name;throw new Error(`Unexpected data type: ${typeof s}${n?`; constructor: ${n}`:""}${Qr(s)}`)}return e}function Qr(s){return typeof s!="object"||s===null?"":`; props: [${Object.getOwnPropertyNames(s).map(t=>`"${t}"`).join(", ")}]`}class k{constructor(e){this._client=e}}function cs(s){return s.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}const zr=(s=cs)=>function(t,...n){if(t.length===1)return t[0];let r=!1;const a=t.reduce((_,u,g)=>(/[?#]/.test(u)&&(r=!0),_+u+(g===n.length?"":(r?encodeURIComponent:s)(String(n[g])))),""),i=a.split(/[?#]/,1)[0],o=[],l=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;let h;for(;(h=l.exec(i))!==null;)o.push({start:h.index,length:h[0].length});if(o.length>0){let _=0;const u=o.reduce((g,d)=>{const b=" ".repeat(d.start-_),w="^".repeat(d.length);return _=d.start+d.length,g+b+w},"");throw new C(`Path parameters result in path with invalid segments:
|
|
6
|
-
${a}
|
|
7
|
-
${u}`)}return a},f=zr(cs);let ls=class extends k{list(e,t={},n){return this._client.getAPIList(f`/chat/completions/${e}/messages`,L,{query:t,...n})}};function Yr(s){return typeof s.parse=="function"}const ot=s=>(s==null?void 0:s.role)==="assistant",us=s=>(s==null?void 0:s.role)==="tool";var Mt,Ye,Ze,$e,Ee,et,Oe,ae,Pe,ct,lt,be,hs;class Jt{constructor(){Mt.add(this),this.controller=new AbortController,Ye.set(this,void 0),Ze.set(this,()=>{}),$e.set(this,()=>{}),Ee.set(this,void 0),et.set(this,()=>{}),Oe.set(this,()=>{}),ae.set(this,{}),Pe.set(this,!1),ct.set(this,!1),lt.set(this,!1),be.set(this,!1),R(this,Ye,new Promise((e,t)=>{R(this,Ze,e,"f"),R(this,$e,t,"f")})),R(this,Ee,new Promise((e,t)=>{R(this,et,e,"f"),R(this,Oe,t,"f")})),c(this,Ye,"f").catch(()=>{}),c(this,Ee,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},c(this,Mt,"m",hs).bind(this))},0)}_connected(){this.ended||(c(this,Ze,"f").call(this),this._emit("connect"))}get ended(){return c(this,Pe,"f")}get errored(){return c(this,ct,"f")}get aborted(){return c(this,lt,"f")}abort(){this.controller.abort()}on(e,t){return(c(this,ae,"f")[e]||(c(this,ae,"f")[e]=[])).push({listener:t}),this}off(e,t){const n=c(this,ae,"f")[e];if(!n)return this;const r=n.findIndex(a=>a.listener===t);return r>=0&&n.splice(r,1),this}once(e,t){return(c(this,ae,"f")[e]||(c(this,ae,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,n)=>{R(this,be,!0),e!=="error"&&this.once("error",n),this.once(e,t)})}async done(){R(this,be,!0),await c(this,Ee,"f")}_emit(e,...t){if(c(this,Pe,"f"))return;e==="end"&&(R(this,Pe,!0),c(this,et,"f").call(this));const n=c(this,ae,"f")[e];if(n&&(c(this,ae,"f")[e]=n.filter(r=>!r.once),n.forEach(({listener:r})=>r(...t))),e==="abort"){const r=t[0];!c(this,be,"f")&&!(n!=null&&n.length)&&Promise.reject(r),c(this,$e,"f").call(this,r),c(this,Oe,"f").call(this,r),this._emit("end");return}if(e==="error"){const r=t[0];!c(this,be,"f")&&!(n!=null&&n.length)&&Promise.reject(r),c(this,$e,"f").call(this,r),c(this,Oe,"f").call(this,r),this._emit("end")}}_emitFinal(){}}Ye=new WeakMap,Ze=new WeakMap,$e=new WeakMap,Ee=new WeakMap,et=new WeakMap,Oe=new WeakMap,ae=new WeakMap,Pe=new WeakMap,ct=new WeakMap,lt=new WeakMap,be=new WeakMap,Mt=new WeakSet,hs=function(e){if(R(this,ct,!0),e instanceof Error&&e.name==="AbortError"&&(e=new z),e instanceof z)return R(this,lt,!0),this._emit("abort",e);if(e instanceof C)return this._emit("error",e);if(e instanceof Error){const t=new C(e.message);return t.cause=e,this._emit("error",t)}return this._emit("error",new C(String(e)))};function Ht(s){return(s==null?void 0:s.$brand)==="auto-parseable-response-format"}function Be(s){return(s==null?void 0:s.$brand)==="auto-parseable-tool"}function Zr(s,e){return!e||!ds(e)?{...s,choices:s.choices.map(t=>({...t,message:{...t.message,parsed:null,...t.message.tool_calls?{tool_calls:t.message.tool_calls}:void 0}}))}:Xt(s,e)}function Xt(s,e){const t=s.choices.map(n=>{var r;if(n.finish_reason==="length")throw new Xn;if(n.finish_reason==="content_filter")throw new Kn;return{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:((r=n.message.tool_calls)==null?void 0:r.map(a=>ta(e,a)))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?ea(e,n.message.content):null}}});return{...s,choices:t}}function ea(s,e){var t,n;return((t=s.response_format)==null?void 0:t.type)!=="json_schema"?null:((n=s.response_format)==null?void 0:n.type)==="json_schema"?"$parseRaw"in s.response_format?s.response_format.$parseRaw(e):JSON.parse(e):null}function ta(s,e){var n;const t=(n=s.tools)==null?void 0:n.find(r=>{var a;return((a=r.function)==null?void 0:a.name)===e.function.name});return{...e,function:{...e.function,parsed_arguments:Be(t)?t.$parseRaw(e.function.arguments):t!=null&&t.function.strict?JSON.parse(e.function.arguments):null}}}function na(s,e){var n;if(!s)return!1;const t=(n=s.tools)==null?void 0:n.find(r=>{var a;return((a=r.function)==null?void 0:a.name)===e.function.name});return Be(t)||(t==null?void 0:t.function.strict)||!1}function ds(s){var e;return Ht(s.response_format)?!0:((e=s.tools)==null?void 0:e.some(t=>Be(t)||t.type==="function"&&t.function.strict===!0))??!1}function sa(s){for(const e of s??[]){if(e.type!=="function")throw new C(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new C(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var X,Nt,ut,jt,Ft,Lt,fs,ms;const ra=10;class ps extends Jt{constructor(){super(...arguments),X.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(e){var n;this._chatCompletions.push(e),this._emit("chatCompletion",e);const t=(n=e.choices[0])==null?void 0:n.message;return t&&this._addMessage(t),e}_addMessage(e,t=!0){if("content"in e||(e.content=null),this.messages.push(e),t){if(this._emit("message",e),us(e)&&e.content)this._emit("functionToolCallResult",e.content);else if(ot(e)&&e.tool_calls)for(const n of e.tool_calls)n.type==="function"&&this._emit("functionToolCall",n.function)}}async finalChatCompletion(){await this.done();const e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new C("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),c(this,X,"m",Nt).call(this)}async finalMessage(){return await this.done(),c(this,X,"m",ut).call(this)}async finalFunctionToolCall(){return await this.done(),c(this,X,"m",jt).call(this)}async finalFunctionToolCallResult(){return await this.done(),c(this,X,"m",Ft).call(this)}async totalUsage(){return await this.done(),c(this,X,"m",Lt).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){const e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);const t=c(this,X,"m",ut).call(this);t&&this._emit("finalMessage",t);const n=c(this,X,"m",Nt).call(this);n&&this._emit("finalContent",n);const r=c(this,X,"m",jt).call(this);r&&this._emit("finalFunctionToolCall",r);const a=c(this,X,"m",Ft).call(this);a!=null&&this._emit("finalFunctionToolCallResult",a),this._chatCompletions.some(i=>i.usage)&&this._emit("totalUsage",c(this,X,"m",Lt).call(this))}async _createChatCompletion(e,t,n){const r=n==null?void 0:n.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener("abort",()=>this.controller.abort())),c(this,X,"m",fs).call(this,t);const a=await e.chat.completions.create({...t,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(Xt(a,t))}async _runChatCompletion(e,t,n){for(const r of t.messages)this._addMessage(r,!1);return await this._createChatCompletion(e,t,n)}async _runTools(e,t,n){var d,b,w;const r="tool",{tool_choice:a="auto",stream:i,...o}=t,l=typeof a!="string"&&((d=a==null?void 0:a.function)==null?void 0:d.name),{maxChatCompletions:h=ra}=n||{},_=t.tools.map(A=>{if(Be(A)){if(!A.$callback)throw new C("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:A.$callback,name:A.function.name,description:A.function.description||"",parameters:A.function.parameters,parse:A.$parseRaw,strict:!0}}}return A}),u={};for(const A of _)A.type==="function"&&(u[A.function.name||A.function.function.name]=A.function);const g="tools"in t?_.map(A=>A.type==="function"?{type:"function",function:{name:A.function.name||A.function.function.name,parameters:A.function.parameters,description:A.function.description,strict:A.function.strict}}:A):void 0;for(const A of t.messages)this._addMessage(A,!1);for(let A=0;A<h;++A){const m=(b=(await this._createChatCompletion(e,{...o,tool_choice:a,tools:g,messages:[...this.messages]},n)).choices[0])==null?void 0:b.message;if(!m)throw new C("missing message in ChatCompletion response");if(!((w=m.tool_calls)!=null&&w.length))return;for(const y of m.tool_calls){if(y.type!=="function")continue;const p=y.id,{name:v,arguments:$}=y.function,I=u[v];if(I){if(l&&l!==v){const M=`Invalid tool_call: ${JSON.stringify(v)}. ${JSON.stringify(l)} requested. Please try again`;this._addMessage({role:r,tool_call_id:p,content:M});continue}}else{const M=`Invalid tool_call: ${JSON.stringify(v)}. Available options are: ${Object.keys(u).map(se=>JSON.stringify(se)).join(", ")}. Please try again`;this._addMessage({role:r,tool_call_id:p,content:M});continue}let F;try{F=Yr(I)?await I.parse($):$}catch(M){const se=M instanceof Error?M.message:String(M);this._addMessage({role:r,tool_call_id:p,content:se});continue}const x=await I.function(F,this),T=c(this,X,"m",ms).call(this,x);if(this._addMessage({role:r,tool_call_id:p,content:T}),l)return}}}}X=new WeakSet,Nt=function(){return c(this,X,"m",ut).call(this).content??null},ut=function(){let e=this.messages.length;for(;e-- >0;){const t=this.messages[e];if(ot(t))return{...t,content:t.content??null,refusal:t.refusal??null}}throw new C("stream ended without producing a ChatCompletionMessage with role=assistant")},jt=function(){var e,t;for(let n=this.messages.length-1;n>=0;n--){const r=this.messages[n];if(ot(r)&&((e=r==null?void 0:r.tool_calls)!=null&&e.length))return(t=r.tool_calls.at(-1))==null?void 0:t.function}},Ft=function(){for(let e=this.messages.length-1;e>=0;e--){const t=this.messages[e];if(us(t)&&t.content!=null&&typeof t.content=="string"&&this.messages.some(n=>{var r;return n.role==="assistant"&&((r=n.tool_calls)==null?void 0:r.some(a=>a.type==="function"&&a.id===t.tool_call_id))}))return t.content}},Lt=function(){const e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(const{usage:t}of this._chatCompletions)t&&(e.completion_tokens+=t.completion_tokens,e.prompt_tokens+=t.prompt_tokens,e.total_tokens+=t.total_tokens);return e},fs=function(e){if(e.n!=null&&e.n>1)throw new C("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},ms=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)};class Kt extends ps{static runTools(e,t,n){const r=new Kt,a={...n,headers:{...n==null?void 0:n.headers,"X-Stainless-Helper-Method":"runTools"}};return r._run(()=>r._runTools(e,t,a)),r}_addMessage(e,t=!0){super._addMessage(e,t),ot(e)&&e.content&&this._emit("content",e.content)}}const gs=1,_s=2,ys=4,ws=8,bs=16,Ss=32,xs=64,As=128,vs=256,Cs=As|vs,Is=bs|Ss|Cs|xs,Rs=gs|_s|Is,ks=ys|ws,aa=Rs|ks,W={STR:gs,NUM:_s,ARR:ys,OBJ:ws,NULL:bs,BOOL:Ss,NAN:xs,INFINITY:As,MINUS_INFINITY:vs,INF:Cs,SPECIAL:Is,ATOM:Rs,COLLECTION:ks,ALL:aa};class ia extends Error{}class oa extends Error{}function ca(s,e=W.ALL){if(typeof s!="string")throw new TypeError(`expecting str, got ${typeof s}`);if(!s.trim())throw new Error(`${s} is empty`);return la(s.trim(),e)}const la=(s,e)=>{const t=s.length;let n=0;const r=g=>{throw new ia(`${g} at position ${n}`)},a=g=>{throw new oa(`${g} at position ${n}`)},i=()=>(u(),n>=t&&r("Unexpected end of input"),s[n]==='"'?o():s[n]==="{"?l():s[n]==="["?h():s.substring(n,n+4)==="null"||W.NULL&e&&t-n<4&&"null".startsWith(s.substring(n))?(n+=4,null):s.substring(n,n+4)==="true"||W.BOOL&e&&t-n<4&&"true".startsWith(s.substring(n))?(n+=4,!0):s.substring(n,n+5)==="false"||W.BOOL&e&&t-n<5&&"false".startsWith(s.substring(n))?(n+=5,!1):s.substring(n,n+8)==="Infinity"||W.INFINITY&e&&t-n<8&&"Infinity".startsWith(s.substring(n))?(n+=8,1/0):s.substring(n,n+9)==="-Infinity"||W.MINUS_INFINITY&e&&1<t-n&&t-n<9&&"-Infinity".startsWith(s.substring(n))?(n+=9,-1/0):s.substring(n,n+3)==="NaN"||W.NAN&e&&t-n<3&&"NaN".startsWith(s.substring(n))?(n+=3,NaN):_()),o=()=>{const g=n;let d=!1;for(n++;n<t&&(s[n]!=='"'||d&&s[n-1]==="\\");)d=s[n]==="\\"?!d:!1,n++;if(s.charAt(n)=='"')try{return JSON.parse(s.substring(g,++n-Number(d)))}catch(b){a(String(b))}else if(W.STR&e)try{return JSON.parse(s.substring(g,n-Number(d))+'"')}catch{return JSON.parse(s.substring(g,s.lastIndexOf("\\"))+'"')}r("Unterminated string literal")},l=()=>{n++,u();const g={};try{for(;s[n]!=="}";){if(u(),n>=t&&W.OBJ&e)return g;const d=o();u(),n++;try{const b=i();Object.defineProperty(g,d,{value:b,writable:!0,enumerable:!0,configurable:!0})}catch(b){if(W.OBJ&e)return g;throw b}u(),s[n]===","&&n++}}catch{if(W.OBJ&e)return g;r("Expected '}' at end of object")}return n++,g},h=()=>{n++;const g=[];try{for(;s[n]!=="]";)g.push(i()),u(),s[n]===","&&n++}catch{if(W.ARR&e)return g;r("Expected ']' at end of array")}return n++,g},_=()=>{if(n===0){s==="-"&&W.NUM&e&&r("Not sure what '-' is");try{return JSON.parse(s)}catch(d){if(W.NUM&e)try{return s[s.length-1]==="."?JSON.parse(s.substring(0,s.lastIndexOf("."))):JSON.parse(s.substring(0,s.lastIndexOf("e")))}catch{}a(String(d))}}const g=n;for(s[n]==="-"&&n++;s[n]&&!",]}".includes(s[n]);)n++;n==t&&!(W.NUM&e)&&r("Unterminated number literal");try{return JSON.parse(s.substring(g,n))}catch{s.substring(g,n)==="-"&&W.NUM&e&&r("Not sure what '-' is");try{return JSON.parse(s.substring(g,s.lastIndexOf("e")))}catch(b){a(String(b))}}},u=()=>{for(;n<t&&`
|
|
8
|
-
\r `.includes(s[n]);)n++};return i()},vn=s=>ca(s,W.ALL^W.NUM);var D,re,pe,oe,At,He,vt,Ct,It,Xe,Rt,Cn;class Le extends ps{constructor(e){super(),D.add(this),re.set(this,void 0),pe.set(this,void 0),oe.set(this,void 0),R(this,re,e),R(this,pe,[])}get currentChatCompletionSnapshot(){return c(this,oe,"f")}static fromReadableStream(e){const t=new Le(null);return t._run(()=>t._fromReadableStream(e)),t}static createChatCompletion(e,t,n){const r=new Le(t);return r._run(()=>r._runChatCompletion(e,{...t,stream:!0},{...n,headers:{...n==null?void 0:n.headers,"X-Stainless-Helper-Method":"stream"}})),r}async _createChatCompletion(e,t,n){var i;super._createChatCompletion;const r=n==null?void 0:n.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener("abort",()=>this.controller.abort())),c(this,D,"m",At).call(this);const a=await e.chat.completions.create({...t,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(const o of a)c(this,D,"m",vt).call(this,o);if((i=a.controller.signal)!=null&&i.aborted)throw new z;return this._addChatCompletion(c(this,D,"m",Xe).call(this))}async _fromReadableStream(e,t){var i;const n=t==null?void 0:t.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),c(this,D,"m",At).call(this),this._connected();const r=ne.fromReadableStream(e,this.controller);let a;for await(const o of r)a&&a!==o.id&&this._addChatCompletion(c(this,D,"m",Xe).call(this)),c(this,D,"m",vt).call(this,o),a=o.id;if((i=r.controller.signal)!=null&&i.aborted)throw new z;return this._addChatCompletion(c(this,D,"m",Xe).call(this))}[(re=new WeakMap,pe=new WeakMap,oe=new WeakMap,D=new WeakSet,At=function(){this.ended||R(this,oe,void 0)},He=function(t){let n=c(this,pe,"f")[t.index];return n||(n={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},c(this,pe,"f")[t.index]=n,n)},vt=function(t){var r,a,i,o,l,h,_,u,g,d,b,w,A,E,m;if(this.ended)return;const n=c(this,D,"m",Cn).call(this,t);this._emit("chunk",t,n);for(const y of t.choices){const p=n.choices[y.index];y.delta.content!=null&&((r=p.message)==null?void 0:r.role)==="assistant"&&((a=p.message)!=null&&a.content)&&(this._emit("content",y.delta.content,p.message.content),this._emit("content.delta",{delta:y.delta.content,snapshot:p.message.content,parsed:p.message.parsed})),y.delta.refusal!=null&&((i=p.message)==null?void 0:i.role)==="assistant"&&((o=p.message)!=null&&o.refusal)&&this._emit("refusal.delta",{delta:y.delta.refusal,snapshot:p.message.refusal}),((l=y.logprobs)==null?void 0:l.content)!=null&&((h=p.message)==null?void 0:h.role)==="assistant"&&this._emit("logprobs.content.delta",{content:(_=y.logprobs)==null?void 0:_.content,snapshot:((u=p.logprobs)==null?void 0:u.content)??[]}),((g=y.logprobs)==null?void 0:g.refusal)!=null&&((d=p.message)==null?void 0:d.role)==="assistant"&&this._emit("logprobs.refusal.delta",{refusal:(b=y.logprobs)==null?void 0:b.refusal,snapshot:((w=p.logprobs)==null?void 0:w.refusal)??[]});const v=c(this,D,"m",He).call(this,p);p.finish_reason&&(c(this,D,"m",It).call(this,p),v.current_tool_call_index!=null&&c(this,D,"m",Ct).call(this,p,v.current_tool_call_index));for(const $ of y.delta.tool_calls??[])v.current_tool_call_index!==$.index&&(c(this,D,"m",It).call(this,p),v.current_tool_call_index!=null&&c(this,D,"m",Ct).call(this,p,v.current_tool_call_index)),v.current_tool_call_index=$.index;for(const $ of y.delta.tool_calls??[]){const I=(A=p.message.tool_calls)==null?void 0:A[$.index];I!=null&&I.type&&((I==null?void 0:I.type)==="function"?this._emit("tool_calls.function.arguments.delta",{name:(E=I.function)==null?void 0:E.name,index:$.index,arguments:I.function.arguments,parsed_arguments:I.function.parsed_arguments,arguments_delta:((m=$.function)==null?void 0:m.arguments)??""}):(I==null||I.type,void 0))}}},Ct=function(t,n){var i,o,l;if(c(this,D,"m",He).call(this,t).done_tool_calls.has(n))return;const a=(i=t.message.tool_calls)==null?void 0:i[n];if(!a)throw new Error("no tool call snapshot");if(!a.type)throw new Error("tool call snapshot missing `type`");if(a.type==="function"){const h=(l=(o=c(this,re,"f"))==null?void 0:o.tools)==null?void 0:l.find(_=>_.type==="function"&&_.function.name===a.function.name);this._emit("tool_calls.function.arguments.done",{name:a.function.name,index:n,arguments:a.function.arguments,parsed_arguments:Be(h)?h.$parseRaw(a.function.arguments):h!=null&&h.function.strict?JSON.parse(a.function.arguments):null})}else a.type},It=function(t){var r,a;const n=c(this,D,"m",He).call(this,t);if(t.message.content&&!n.content_done){n.content_done=!0;const i=c(this,D,"m",Rt).call(this);this._emit("content.done",{content:t.message.content,parsed:i?i.$parseRaw(t.message.content):null})}t.message.refusal&&!n.refusal_done&&(n.refusal_done=!0,this._emit("refusal.done",{refusal:t.message.refusal})),(r=t.logprobs)!=null&&r.content&&!n.logprobs_content_done&&(n.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:t.logprobs.content})),(a=t.logprobs)!=null&&a.refusal&&!n.logprobs_refusal_done&&(n.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:t.logprobs.refusal}))},Xe=function(){if(this.ended)throw new C("stream has ended, this shouldn't happen");const t=c(this,oe,"f");if(!t)throw new C("request ended without sending any chunks");return R(this,oe,void 0),R(this,pe,[]),ua(t,c(this,re,"f"))},Rt=function(){var n;const t=(n=c(this,re,"f"))==null?void 0:n.response_format;return Ht(t)?t:null},Cn=function(t){var n,r,a,i;let o=c(this,oe,"f");const{choices:l,...h}=t;o?Object.assign(o,h):o=R(this,oe,{...h,choices:[]});for(const{delta:_,finish_reason:u,index:g,logprobs:d=null,...b}of t.choices){let w=o.choices[g];if(w||(w=o.choices[g]={finish_reason:u,index:g,message:{},logprobs:d,...b}),d)if(!w.logprobs)w.logprobs=Object.assign({},d);else{const{content:$,refusal:I,...F}=d;Object.assign(w.logprobs,F),$&&((n=w.logprobs).content??(n.content=[]),w.logprobs.content.push(...$)),I&&((r=w.logprobs).refusal??(r.refusal=[]),w.logprobs.refusal.push(...I))}if(u&&(w.finish_reason=u,c(this,re,"f")&&ds(c(this,re,"f")))){if(u==="length")throw new Xn;if(u==="content_filter")throw new Kn}if(Object.assign(w,b),!_)continue;const{content:A,refusal:E,function_call:m,role:y,tool_calls:p,...v}=_;if(Object.assign(w.message,v),E&&(w.message.refusal=(w.message.refusal||"")+E),y&&(w.message.role=y),m&&(w.message.function_call?(m.name&&(w.message.function_call.name=m.name),m.arguments&&((a=w.message.function_call).arguments??(a.arguments=""),w.message.function_call.arguments+=m.arguments)):w.message.function_call=m),A&&(w.message.content=(w.message.content||"")+A,!w.message.refusal&&c(this,D,"m",Rt).call(this)&&(w.message.parsed=vn(w.message.content))),p){w.message.tool_calls||(w.message.tool_calls=[]);for(const{index:$,id:I,type:F,function:x,...T}of p){const M=(i=w.message.tool_calls)[$]??(i[$]={});Object.assign(M,T),I&&(M.id=I),F&&(M.type=F),x&&(M.function??(M.function={name:x.name??"",arguments:""})),x!=null&&x.name&&(M.function.name=x.name),x!=null&&x.arguments&&(M.function.arguments+=x.arguments,na(c(this,re,"f"),M)&&(M.function.parsed_arguments=vn(M.function.arguments)))}}}return o},Symbol.asyncIterator)](){const e=[],t=[];let n=!1;return this.on("chunk",r=>{const a=t.shift();a?a.resolve(r):e.push(r)}),this.on("end",()=>{n=!0;for(const r of t)r.resolve(void 0);t.length=0}),this.on("abort",r=>{n=!0;for(const a of t)a.reject(r);t.length=0}),this.on("error",r=>{n=!0;for(const a of t)a.reject(r);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((a,i)=>t.push({resolve:a,reject:i})).then(a=>a?{value:a,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new ne(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function ua(s,e){const{id:t,choices:n,created:r,model:a,system_fingerprint:i,...o}=s,l={...o,id:t,choices:n.map(({message:h,finish_reason:_,index:u,logprobs:g,...d})=>{if(!_)throw new C(`missing finish_reason for choice ${u}`);const{content:b=null,function_call:w,tool_calls:A,...E}=h,m=h.role;if(!m)throw new C(`missing role for choice ${u}`);if(w){const{arguments:y,name:p}=w;if(y==null)throw new C(`missing function_call.arguments for choice ${u}`);if(!p)throw new C(`missing function_call.name for choice ${u}`);return{...d,message:{content:b,function_call:{arguments:y,name:p},role:m,refusal:h.refusal??null},finish_reason:_,index:u,logprobs:g}}return A?{...d,index:u,finish_reason:_,logprobs:g,message:{...E,role:m,content:b,refusal:h.refusal??null,tool_calls:A.map((y,p)=>{const{function:v,type:$,id:I,...F}=y,{arguments:x,name:T,...M}=v||{};if(I==null)throw new C(`missing choices[${u}].tool_calls[${p}].id
|
|
9
|
-
${Ke(s)}`);if($==null)throw new C(`missing choices[${u}].tool_calls[${p}].type
|
|
10
|
-
${Ke(s)}`);if(T==null)throw new C(`missing choices[${u}].tool_calls[${p}].function.name
|
|
11
|
-
${Ke(s)}`);if(x==null)throw new C(`missing choices[${u}].tool_calls[${p}].function.arguments
|
|
12
|
-
${Ke(s)}`);return{...F,id:I,type:$,function:{...M,name:T,arguments:x}}})}}:{...d,message:{...E,content:b,role:m,refusal:h.refusal??null},finish_reason:_,index:u,logprobs:g}}),created:r,model:a,object:"chat.completion",...i?{system_fingerprint:i}:{}};return Zr(l,e)}function Ke(s){return JSON.stringify(s)}class ht extends Le{static fromReadableStream(e){const t=new ht(null);return t._run(()=>t._fromReadableStream(e)),t}static runTools(e,t,n){const r=new ht(t),a={...n,headers:{...n==null?void 0:n.headers,"X-Stainless-Helper-Method":"runTools"}};return r._run(()=>r._runTools(e,t,a)),r}}let Vt=class extends k{constructor(){super(...arguments),this.messages=new ls(this._client)}create(e,t){return this._client.post("/chat/completions",{body:e,...t,stream:e.stream??!1})}retrieve(e,t){return this._client.get(f`/chat/completions/${e}`,t)}update(e,t,n){return this._client.post(f`/chat/completions/${e}`,{body:t,...n})}list(e={},t){return this._client.getAPIList("/chat/completions",L,{query:e,...t})}delete(e,t){return this._client.delete(f`/chat/completions/${e}`,t)}parse(e,t){return sa(e.tools),this._client.chat.completions.create(e,{...t,headers:{...t==null?void 0:t.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap(n=>Xt(n,e))}runTools(e,t){return e.stream?ht.runTools(this._client,e,t):Kt.runTools(this._client,e,t)}stream(e,t){return Le.createChatCompletion(this._client,e,t)}};Vt.Messages=ls;class Gt extends k{constructor(){super(...arguments),this.completions=new Vt(this._client)}}Gt.Completions=Vt;const $s=Symbol("brand.privateNullableHeaders");function*ha(s){if(!s)return;if($s in s){const{values:n,nulls:r}=s;yield*n.entries();for(const a of r)yield[a,null];return}let e=!1,t;s instanceof Headers?t=s.entries():hn(s)?t=s:(e=!0,t=Object.entries(s??{}));for(let n of t){const r=n[0];if(typeof r!="string")throw new TypeError("expected header name to be a string");const a=hn(n[1])?n[1]:[n[1]];let i=!1;for(const o of a)o!==void 0&&(e&&!i&&(i=!0,yield[r,null]),yield[r,o])}}const S=s=>{const e=new Headers,t=new Set;for(const n of s){const r=new Set;for(const[a,i]of ha(n)){const o=a.toLowerCase();r.has(o)||(e.delete(a),r.add(o)),i===null?(e.delete(a),t.add(o)):(e.append(a,i),t.delete(o))}}return{[$s]:!0,values:e,nulls:t}};class Es extends k{create(e,t){return this._client.post("/audio/speech",{body:e,...t,headers:S([{Accept:"application/octet-stream"},t==null?void 0:t.headers]),__binaryResponse:!0})}}class Os extends k{create(e,t){return this._client.post("/audio/transcriptions",fe({body:e,...t,stream:e.stream??!1,__metadata:{model:e.model}},this._client))}}class Ps extends k{create(e,t){return this._client.post("/audio/translations",fe({body:e,...t,__metadata:{model:e.model}},this._client))}}class We extends k{constructor(){super(...arguments),this.transcriptions=new Os(this._client),this.translations=new Ps(this._client),this.speech=new Es(this._client)}}We.Transcriptions=Os;We.Translations=Ps;We.Speech=Es;class Ts extends k{create(e,t){return this._client.post("/batches",{body:e,...t})}retrieve(e,t){return this._client.get(f`/batches/${e}`,t)}list(e={},t){return this._client.getAPIList("/batches",L,{query:e,...t})}cancel(e,t){return this._client.post(f`/batches/${e}/cancel`,t)}}class Ms extends k{create(e,t){return this._client.post("/assistants",{body:e,...t,headers:S([{"OpenAI-Beta":"assistants=v2"},t==null?void 0:t.headers])})}retrieve(e,t){return this._client.get(f`/assistants/${e}`,{...t,headers:S([{"OpenAI-Beta":"assistants=v2"},t==null?void 0:t.headers])})}update(e,t,n){return this._client.post(f`/assistants/${e}`,{body:t,...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}list(e={},t){return this._client.getAPIList("/assistants",L,{query:e,...t,headers:S([{"OpenAI-Beta":"assistants=v2"},t==null?void 0:t.headers])})}delete(e,t){return this._client.delete(f`/assistants/${e}`,{...t,headers:S([{"OpenAI-Beta":"assistants=v2"},t==null?void 0:t.headers])})}}class Ns extends k{create(e,t){return this._client.post("/realtime/sessions",{body:e,...t,headers:S([{"OpenAI-Beta":"assistants=v2"},t==null?void 0:t.headers])})}}class js extends k{create(e,t){return this._client.post("/realtime/transcription_sessions",{body:e,...t,headers:S([{"OpenAI-Beta":"assistants=v2"},t==null?void 0:t.headers])})}}class _t extends k{constructor(){super(...arguments),this.sessions=new Ns(this._client),this.transcriptionSessions=new js(this._client)}}_t.Sessions=Ns;_t.TranscriptionSessions=js;class Fs extends k{create(e,t,n){return this._client.post(f`/threads/${e}/messages`,{body:t,...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}retrieve(e,t,n){const{thread_id:r}=t;return this._client.get(f`/threads/${r}/messages/${e}`,{...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}update(e,t,n){const{thread_id:r,...a}=t;return this._client.post(f`/threads/${r}/messages/${e}`,{body:a,...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}list(e,t={},n){return this._client.getAPIList(f`/threads/${e}/messages`,L,{query:t,...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}delete(e,t,n){const{thread_id:r}=t;return this._client.delete(f`/threads/${r}/messages/${e}`,{...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}}class Ls extends k{retrieve(e,t,n){const{thread_id:r,run_id:a,...i}=t;return this._client.get(f`/threads/${r}/runs/${a}/steps/${e}`,{query:i,...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}list(e,t,n){const{thread_id:r,...a}=t;return this._client.getAPIList(f`/threads/${r}/runs/${e}/steps`,L,{query:a,...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}}const da=s=>{if(typeof Buffer<"u"){const e=Buffer.from(s,"base64");return Array.from(new Float32Array(e.buffer,e.byteOffset,e.length/Float32Array.BYTES_PER_ELEMENT))}else{const e=atob(s),t=e.length,n=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=e.charCodeAt(r);return Array.from(new Float32Array(n.buffer))}};var kt={};const ge=s=>{var e,t,n,r;if(typeof globalThis.process<"u")return((e=kt==null?void 0:kt[s])==null?void 0:e.trim())??void 0;if(typeof globalThis.Deno<"u")return(r=(n=(t=globalThis.Deno.env)==null?void 0:t.get)==null?void 0:n.call(t,s))==null?void 0:r.trim()};var q,he,Dt,te,tt,Y,de,xe,ue,dt,Q,nt,st,je,Te,Me,In,Rn,kn,$n,En,On,Pn;class Fe extends Jt{constructor(){super(...arguments),q.add(this),Dt.set(this,[]),te.set(this,{}),tt.set(this,{}),Y.set(this,void 0),de.set(this,void 0),xe.set(this,void 0),ue.set(this,void 0),dt.set(this,void 0),Q.set(this,void 0),nt.set(this,void 0),st.set(this,void 0),je.set(this,void 0)}[(Dt=new WeakMap,te=new WeakMap,tt=new WeakMap,Y=new WeakMap,de=new WeakMap,xe=new WeakMap,ue=new WeakMap,dt=new WeakMap,Q=new WeakMap,nt=new WeakMap,st=new WeakMap,je=new WeakMap,q=new WeakSet,Symbol.asyncIterator)](){const e=[],t=[];let n=!1;return this.on("event",r=>{const a=t.shift();a?a.resolve(r):e.push(r)}),this.on("end",()=>{n=!0;for(const r of t)r.resolve(void 0);t.length=0}),this.on("abort",r=>{n=!0;for(const a of t)a.reject(r);t.length=0}),this.on("error",r=>{n=!0;for(const a of t)a.reject(r);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((a,i)=>t.push({resolve:a,reject:i})).then(a=>a?{value:a,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){const t=new he;return t._run(()=>t._fromReadableStream(e)),t}async _fromReadableStream(e,t){var a;const n=t==null?void 0:t.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),this._connected();const r=ne.fromReadableStream(e,this.controller);for await(const i of r)c(this,q,"m",Te).call(this,i);if((a=r.controller.signal)!=null&&a.aborted)throw new z;return this._addRun(c(this,q,"m",Me).call(this))}toReadableStream(){return new ne(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,t,n,r){const a=new he;return a._run(()=>a._runToolAssistantStream(e,t,n,{...r,headers:{...r==null?void 0:r.headers,"X-Stainless-Helper-Method":"stream"}})),a}async _createToolAssistantStream(e,t,n,r){var l;const a=r==null?void 0:r.signal;a&&(a.aborted&&this.controller.abort(),a.addEventListener("abort",()=>this.controller.abort()));const i={...n,stream:!0},o=await e.submitToolOutputs(t,i,{...r,signal:this.controller.signal});this._connected();for await(const h of o)c(this,q,"m",Te).call(this,h);if((l=o.controller.signal)!=null&&l.aborted)throw new z;return this._addRun(c(this,q,"m",Me).call(this))}static createThreadAssistantStream(e,t,n){const r=new he;return r._run(()=>r._threadAssistantStream(e,t,{...n,headers:{...n==null?void 0:n.headers,"X-Stainless-Helper-Method":"stream"}})),r}static createAssistantStream(e,t,n,r){const a=new he;return a._run(()=>a._runAssistantStream(e,t,n,{...r,headers:{...r==null?void 0:r.headers,"X-Stainless-Helper-Method":"stream"}})),a}currentEvent(){return c(this,nt,"f")}currentRun(){return c(this,st,"f")}currentMessageSnapshot(){return c(this,Y,"f")}currentRunStepSnapshot(){return c(this,je,"f")}async finalRunSteps(){return await this.done(),Object.values(c(this,te,"f"))}async finalMessages(){return await this.done(),Object.values(c(this,tt,"f"))}async finalRun(){if(await this.done(),!c(this,de,"f"))throw Error("Final run was not received.");return c(this,de,"f")}async _createThreadAssistantStream(e,t,n){var o;const r=n==null?void 0:n.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener("abort",()=>this.controller.abort()));const a={...t,stream:!0},i=await e.createAndRun(a,{...n,signal:this.controller.signal});this._connected();for await(const l of i)c(this,q,"m",Te).call(this,l);if((o=i.controller.signal)!=null&&o.aborted)throw new z;return this._addRun(c(this,q,"m",Me).call(this))}async _createAssistantStream(e,t,n,r){var l;const a=r==null?void 0:r.signal;a&&(a.aborted&&this.controller.abort(),a.addEventListener("abort",()=>this.controller.abort()));const i={...n,stream:!0},o=await e.create(t,i,{...r,signal:this.controller.signal});this._connected();for await(const h of o)c(this,q,"m",Te).call(this,h);if((l=o.controller.signal)!=null&&l.aborted)throw new z;return this._addRun(c(this,q,"m",Me).call(this))}static accumulateDelta(e,t){for(const[n,r]of Object.entries(t)){if(!e.hasOwnProperty(n)){e[n]=r;continue}let a=e[n];if(a==null){e[n]=r;continue}if(n==="index"||n==="type"){e[n]=r;continue}if(typeof a=="string"&&typeof r=="string")a+=r;else if(typeof a=="number"&&typeof r=="number")a+=r;else if(bt(a)&&bt(r))a=this.accumulateDelta(a,r);else if(Array.isArray(a)&&Array.isArray(r)){if(a.every(i=>typeof i=="string"||typeof i=="number")){a.push(...r);continue}for(const i of r){if(!bt(i))throw new Error(`Expected array delta entry to be an object but got: ${i}`);const o=i.index;if(o==null)throw console.error(i),new Error("Expected array delta entry to have an `index` property");if(typeof o!="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${o}`);const l=a[o];l==null?a.push(i):a[o]=this.accumulateDelta(l,i)}continue}else throw Error(`Unhandled record type: ${n}, deltaValue: ${r}, accValue: ${a}`);e[n]=a}return e}_addRun(e){return e}async _threadAssistantStream(e,t,n){return await this._createThreadAssistantStream(t,e,n)}async _runAssistantStream(e,t,n,r){return await this._createAssistantStream(t,e,n,r)}async _runToolAssistantStream(e,t,n,r){return await this._createToolAssistantStream(t,e,n,r)}}he=Fe,Te=function(e){if(!this.ended)switch(R(this,nt,e),c(this,q,"m",kn).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":c(this,q,"m",Pn).call(this,e);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":c(this,q,"m",Rn).call(this,e);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":c(this,q,"m",In).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier")}},Me=function(){if(this.ended)throw new C("stream has ended, this shouldn't happen");if(!c(this,de,"f"))throw Error("Final run has not been received");return c(this,de,"f")},In=function(e){const[t,n]=c(this,q,"m",En).call(this,e,c(this,Y,"f"));R(this,Y,t),c(this,tt,"f")[t.id]=t;for(const r of n){const a=t.content[r.index];(a==null?void 0:a.type)=="text"&&this._emit("textCreated",a.text)}switch(e.event){case"thread.message.created":this._emit("messageCreated",e.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",e.data.delta,t),e.data.delta.content)for(const r of e.data.delta.content){if(r.type=="text"&&r.text){let a=r.text,i=t.content[r.index];if(i&&i.type=="text")this._emit("textDelta",a,i.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(r.index!=c(this,xe,"f")){if(c(this,ue,"f"))switch(c(this,ue,"f").type){case"text":this._emit("textDone",c(this,ue,"f").text,c(this,Y,"f"));break;case"image_file":this._emit("imageFileDone",c(this,ue,"f").image_file,c(this,Y,"f"));break}R(this,xe,r.index)}R(this,ue,t.content[r.index])}break;case"thread.message.completed":case"thread.message.incomplete":if(c(this,xe,"f")!==void 0){const r=e.data.content[c(this,xe,"f")];if(r)switch(r.type){case"image_file":this._emit("imageFileDone",r.image_file,c(this,Y,"f"));break;case"text":this._emit("textDone",r.text,c(this,Y,"f"));break}}c(this,Y,"f")&&this._emit("messageDone",e.data),R(this,Y,void 0)}},Rn=function(e){const t=c(this,q,"m",$n).call(this,e);switch(R(this,je,t),e.event){case"thread.run.step.created":this._emit("runStepCreated",e.data);break;case"thread.run.step.delta":const n=e.data.delta;if(n.step_details&&n.step_details.type=="tool_calls"&&n.step_details.tool_calls&&t.step_details.type=="tool_calls")for(const a of n.step_details.tool_calls)a.index==c(this,dt,"f")?this._emit("toolCallDelta",a,t.step_details.tool_calls[a.index]):(c(this,Q,"f")&&this._emit("toolCallDone",c(this,Q,"f")),R(this,dt,a.index),R(this,Q,t.step_details.tool_calls[a.index]),c(this,Q,"f")&&this._emit("toolCallCreated",c(this,Q,"f")));this._emit("runStepDelta",e.data.delta,t);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":R(this,je,void 0),e.data.step_details.type=="tool_calls"&&c(this,Q,"f")&&(this._emit("toolCallDone",c(this,Q,"f")),R(this,Q,void 0)),this._emit("runStepDone",e.data,t);break}},kn=function(e){c(this,Dt,"f").push(e),this._emit("event",e)},$n=function(e){switch(e.event){case"thread.run.step.created":return c(this,te,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let t=c(this,te,"f")[e.data.id];if(!t)throw Error("Received a RunStepDelta before creation of a snapshot");let n=e.data;if(n.delta){const r=he.accumulateDelta(t,n.delta);c(this,te,"f")[e.data.id]=r}return c(this,te,"f")[e.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":c(this,te,"f")[e.data.id]=e.data;break}if(c(this,te,"f")[e.data.id])return c(this,te,"f")[e.data.id];throw new Error("No snapshot available")},En=function(e,t){let n=[];switch(e.event){case"thread.message.created":return[e.data,n];case"thread.message.delta":if(!t)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let r=e.data;if(r.delta.content)for(const a of r.delta.content)if(a.index in t.content){let i=t.content[a.index];t.content[a.index]=c(this,q,"m",On).call(this,a,i)}else t.content[a.index]=a,n.push(a);return[t,n];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(t)return[t,n];throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},On=function(e,t){return he.accumulateDelta(t,e)},Pn=function(e){switch(R(this,st,e.data),e.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":case"thread.run.incomplete":R(this,de,e.data),c(this,Q,"f")&&(this._emit("toolCallDone",c(this,Q,"f")),R(this,Q,void 0));break}};let Qt=class extends k{constructor(){super(...arguments),this.steps=new Ls(this._client)}create(e,t,n){const{include:r,...a}=t;return this._client.post(f`/threads/${e}/runs`,{query:{include:r},body:a,...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers]),stream:t.stream??!1})}retrieve(e,t,n){const{thread_id:r}=t;return this._client.get(f`/threads/${r}/runs/${e}`,{...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}update(e,t,n){const{thread_id:r,...a}=t;return this._client.post(f`/threads/${r}/runs/${e}`,{body:a,...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}list(e,t={},n){return this._client.getAPIList(f`/threads/${e}/runs`,L,{query:t,...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}cancel(e,t,n){const{thread_id:r}=t;return this._client.post(f`/threads/${r}/runs/${e}/cancel`,{...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}async createAndPoll(e,t,n){const r=await this.create(e,t,n);return await this.poll(r.id,{thread_id:e},n)}createAndStream(e,t,n){return Fe.createAssistantStream(e,this._client.beta.threads.runs,t,n)}async poll(e,t,n){var a;const r=S([n==null?void 0:n.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":((a=n==null?void 0:n.pollIntervalMs)==null?void 0:a.toString())??void 0}]);for(;;){const{data:i,response:o}=await this.retrieve(e,t,{...n,headers:{...n==null?void 0:n.headers,...r}}).withResponse();switch(i.status){case"queued":case"in_progress":case"cancelling":let l=5e3;if(n!=null&&n.pollIntervalMs)l=n.pollIntervalMs;else{const h=o.headers.get("openai-poll-after-ms");if(h){const _=parseInt(h);isNaN(_)||(l=_)}}await De(l);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,t,n){return Fe.createAssistantStream(e,this._client.beta.threads.runs,t,n)}submitToolOutputs(e,t,n){const{thread_id:r,...a}=t;return this._client.post(f`/threads/${r}/runs/${e}/submit_tool_outputs`,{body:a,...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers]),stream:t.stream??!1})}async submitToolOutputsAndPoll(e,t,n){const r=await this.submitToolOutputs(e,t,n);return await this.poll(r.id,t,n)}submitToolOutputsStream(e,t,n){return Fe.createToolAssistantStream(e,this._client.beta.threads.runs,t,n)}};Qt.Steps=Ls;class yt extends k{constructor(){super(...arguments),this.runs=new Qt(this._client),this.messages=new Fs(this._client)}create(e={},t){return this._client.post("/threads",{body:e,...t,headers:S([{"OpenAI-Beta":"assistants=v2"},t==null?void 0:t.headers])})}retrieve(e,t){return this._client.get(f`/threads/${e}`,{...t,headers:S([{"OpenAI-Beta":"assistants=v2"},t==null?void 0:t.headers])})}update(e,t,n){return this._client.post(f`/threads/${e}`,{body:t,...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}delete(e,t){return this._client.delete(f`/threads/${e}`,{...t,headers:S([{"OpenAI-Beta":"assistants=v2"},t==null?void 0:t.headers])})}createAndRun(e,t){return this._client.post("/threads/runs",{body:e,...t,headers:S([{"OpenAI-Beta":"assistants=v2"},t==null?void 0:t.headers]),stream:e.stream??!1})}async createAndRunPoll(e,t){const n=await this.createAndRun(e,t);return await this.runs.poll(n.id,{thread_id:n.thread_id},t)}createAndRunStream(e,t){return Fe.createThreadAssistantStream(e,this._client.beta.threads,t)}}yt.Runs=Qt;yt.Messages=Fs;class Ue extends k{constructor(){super(...arguments),this.realtime=new _t(this._client),this.assistants=new Ms(this._client),this.threads=new yt(this._client)}}Ue.Realtime=_t;Ue.Assistants=Ms;Ue.Threads=yt;class Ds extends k{create(e,t){return this._client.post("/completions",{body:e,...t,stream:e.stream??!1})}}class Bs extends k{retrieve(e,t,n){const{container_id:r}=t;return this._client.get(f`/containers/${r}/files/${e}/content`,{...n,headers:S([{Accept:"application/binary"},n==null?void 0:n.headers]),__binaryResponse:!0})}}let zt=class extends k{constructor(){super(...arguments),this.content=new Bs(this._client)}create(e,t,n){return this._client.post(f`/containers/${e}/files`,fe({body:t,...n},this._client))}retrieve(e,t,n){const{container_id:r}=t;return this._client.get(f`/containers/${r}/files/${e}`,n)}list(e,t={},n){return this._client.getAPIList(f`/containers/${e}/files`,L,{query:t,...n})}delete(e,t,n){const{container_id:r}=t;return this._client.delete(f`/containers/${r}/files/${e}`,{...n,headers:S([{Accept:"*/*"},n==null?void 0:n.headers])})}};zt.Content=Bs;class Yt extends k{constructor(){super(...arguments),this.files=new zt(this._client)}create(e,t){return this._client.post("/containers",{body:e,...t})}retrieve(e,t){return this._client.get(f`/containers/${e}`,t)}list(e={},t){return this._client.getAPIList("/containers",L,{query:e,...t})}delete(e,t){return this._client.delete(f`/containers/${e}`,{...t,headers:S([{Accept:"*/*"},t==null?void 0:t.headers])})}}Yt.Files=zt;class Ws extends k{create(e,t){const n=!!e.encoding_format;let r=n?e.encoding_format:"base64";n&&H(this._client).debug("embeddings/user defined encoding_format:",e.encoding_format);const a=this._client.post("/embeddings",{body:{...e,encoding_format:r},...t});return n?a:(H(this._client).debug("embeddings/decoding base64 embeddings from base64"),a._thenUnwrap(i=>(i&&i.data&&i.data.forEach(o=>{const l=o.embedding;o.embedding=da(l)}),i)))}}class Us extends k{retrieve(e,t,n){const{eval_id:r,run_id:a}=t;return this._client.get(f`/evals/${r}/runs/${a}/output_items/${e}`,n)}list(e,t,n){const{eval_id:r,...a}=t;return this._client.getAPIList(f`/evals/${r}/runs/${e}/output_items`,L,{query:a,...n})}}class Zt extends k{constructor(){super(...arguments),this.outputItems=new Us(this._client)}create(e,t,n){return this._client.post(f`/evals/${e}/runs`,{body:t,...n})}retrieve(e,t,n){const{eval_id:r}=t;return this._client.get(f`/evals/${r}/runs/${e}`,n)}list(e,t={},n){return this._client.getAPIList(f`/evals/${e}/runs`,L,{query:t,...n})}delete(e,t,n){const{eval_id:r}=t;return this._client.delete(f`/evals/${r}/runs/${e}`,n)}cancel(e,t,n){const{eval_id:r}=t;return this._client.post(f`/evals/${r}/runs/${e}`,n)}}Zt.OutputItems=Us;class en extends k{constructor(){super(...arguments),this.runs=new Zt(this._client)}create(e,t){return this._client.post("/evals",{body:e,...t})}retrieve(e,t){return this._client.get(f`/evals/${e}`,t)}update(e,t,n){return this._client.post(f`/evals/${e}`,{body:t,...n})}list(e={},t){return this._client.getAPIList("/evals",L,{query:e,...t})}delete(e,t){return this._client.delete(f`/evals/${e}`,t)}}en.Runs=Zt;let qs=class extends k{create(e,t){return this._client.post("/files",fe({body:e,...t},this._client))}retrieve(e,t){return this._client.get(f`/files/${e}`,t)}list(e={},t){return this._client.getAPIList("/files",L,{query:e,...t})}delete(e,t){return this._client.delete(f`/files/${e}`,t)}content(e,t){return this._client.get(f`/files/${e}/content`,{...t,headers:S([{Accept:"application/binary"},t==null?void 0:t.headers]),__binaryResponse:!0})}async waitForProcessing(e,{pollInterval:t=5e3,maxWait:n=30*60*1e3}={}){const r=new Set(["processed","error","deleted"]),a=Date.now();let i=await this.retrieve(e);for(;!i.status||!r.has(i.status);)if(await De(t),i=await this.retrieve(e),Date.now()-a>n)throw new Ut({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return i}};class Js extends k{}let Hs=class extends k{run(e,t){return this._client.post("/fine_tuning/alpha/graders/run",{body:e,...t})}validate(e,t){return this._client.post("/fine_tuning/alpha/graders/validate",{body:e,...t})}};class tn extends k{constructor(){super(...arguments),this.graders=new Hs(this._client)}}tn.Graders=Hs;class Xs extends k{create(e,t,n){return this._client.getAPIList(f`/fine_tuning/checkpoints/${e}/permissions`,gt,{body:t,method:"post",...n})}retrieve(e,t={},n){return this._client.get(f`/fine_tuning/checkpoints/${e}/permissions`,{query:t,...n})}delete(e,t,n){const{fine_tuned_model_checkpoint:r}=t;return this._client.delete(f`/fine_tuning/checkpoints/${r}/permissions/${e}`,n)}}let nn=class extends k{constructor(){super(...arguments),this.permissions=new Xs(this._client)}};nn.Permissions=Xs;class Ks extends k{list(e,t={},n){return this._client.getAPIList(f`/fine_tuning/jobs/${e}/checkpoints`,L,{query:t,...n})}}class sn extends k{constructor(){super(...arguments),this.checkpoints=new Ks(this._client)}create(e,t){return this._client.post("/fine_tuning/jobs",{body:e,...t})}retrieve(e,t){return this._client.get(f`/fine_tuning/jobs/${e}`,t)}list(e={},t){return this._client.getAPIList("/fine_tuning/jobs",L,{query:e,...t})}cancel(e,t){return this._client.post(f`/fine_tuning/jobs/${e}/cancel`,t)}listEvents(e,t={},n){return this._client.getAPIList(f`/fine_tuning/jobs/${e}/events`,L,{query:t,...n})}pause(e,t){return this._client.post(f`/fine_tuning/jobs/${e}/pause`,t)}resume(e,t){return this._client.post(f`/fine_tuning/jobs/${e}/resume`,t)}}sn.Checkpoints=Ks;class Ae extends k{constructor(){super(...arguments),this.methods=new Js(this._client),this.jobs=new sn(this._client),this.checkpoints=new nn(this._client),this.alpha=new tn(this._client)}}Ae.Methods=Js;Ae.Jobs=sn;Ae.Checkpoints=nn;Ae.Alpha=tn;class Vs extends k{}class rn extends k{constructor(){super(...arguments),this.graderModels=new Vs(this._client)}}rn.GraderModels=Vs;class Gs extends k{createVariation(e,t){return this._client.post("/images/variations",fe({body:e,...t},this._client))}edit(e,t){return this._client.post("/images/edits",fe({body:e,...t},this._client))}generate(e,t){return this._client.post("/images/generations",{body:e,...t})}}class Qs extends k{retrieve(e,t){return this._client.get(f`/models/${e}`,t)}list(e){return this._client.getAPIList("/models",gt,e)}delete(e,t){return this._client.delete(f`/models/${e}`,t)}}class zs extends k{create(e,t){return this._client.post("/moderations",{body:e,...t})}}function fa(s,e){return!e||!pa(e)?{...s,output_parsed:null,output:s.output.map(t=>t.type==="function_call"?{...t,parsed_arguments:null}:t.type==="message"?{...t,content:t.content.map(n=>({...n,parsed:null}))}:t)}:Ys(s,e)}function Ys(s,e){const t=s.output.map(r=>{if(r.type==="function_call")return{...r,parsed_arguments:ya(e,r)};if(r.type==="message"){const a=r.content.map(i=>i.type==="output_text"?{...i,parsed:ma(e,i.text)}:i);return{...r,content:a}}return r}),n=Object.assign({},s,{output:t});return Object.getOwnPropertyDescriptor(s,"output_text")||Bt(n),Object.defineProperty(n,"output_parsed",{enumerable:!0,get(){for(const r of n.output)if(r.type==="message"){for(const a of r.content)if(a.type==="output_text"&&a.parsed!==null)return a.parsed}return null}}),n}function ma(s,e){var t,n,r,a;return((n=(t=s.text)==null?void 0:t.format)==null?void 0:n.type)!=="json_schema"?null:"$parseRaw"in((r=s.text)==null?void 0:r.format)?((a=s.text)==null?void 0:a.format).$parseRaw(e):JSON.parse(e)}function pa(s){var e;return!!Ht((e=s.text)==null?void 0:e.format)}function ga(s){return(s==null?void 0:s.$brand)==="auto-parseable-tool"}function _a(s,e){return s.find(t=>t.type==="function"&&t.name===e)}function ya(s,e){const t=_a(s.tools??[],e.name);return{...e,...e,parsed_arguments:ga(t)?t.$parseRaw(e.arguments):t!=null&&t.strict?JSON.parse(e.arguments):null}}function Bt(s){const e=[];for(const t of s.output)if(t.type==="message")for(const n of t.content)n.type==="output_text"&&e.push(n.text);s.output_text=e.join("")}var _e,Ve,ce,Ge,Tn,Mn,Nn,jn;class an extends Jt{constructor(e){super(),_e.add(this),Ve.set(this,void 0),ce.set(this,void 0),Ge.set(this,void 0),R(this,Ve,e)}static createResponse(e,t,n){const r=new an(t);return r._run(()=>r._createOrRetrieveResponse(e,t,{...n,headers:{...n==null?void 0:n.headers,"X-Stainless-Helper-Method":"stream"}})),r}async _createOrRetrieveResponse(e,t,n){var o;const r=n==null?void 0:n.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener("abort",()=>this.controller.abort())),c(this,_e,"m",Tn).call(this);let a,i=null;"response_id"in t?(a=await e.responses.retrieve(t.response_id,{stream:!0},{...n,signal:this.controller.signal,stream:!0}),i=t.starting_after??null):a=await e.responses.create({...t,stream:!0},{...n,signal:this.controller.signal}),this._connected();for await(const l of a)c(this,_e,"m",Mn).call(this,l,i);if((o=a.controller.signal)!=null&&o.aborted)throw new z;return c(this,_e,"m",Nn).call(this)}[(Ve=new WeakMap,ce=new WeakMap,Ge=new WeakMap,_e=new WeakSet,Tn=function(){this.ended||R(this,ce,void 0)},Mn=function(t,n){if(this.ended)return;const r=(i,o)=>{(n==null||o.sequence_number>n)&&this._emit(i,o)},a=c(this,_e,"m",jn).call(this,t);switch(r("event",t),t.type){case"response.output_text.delta":{const i=a.output[t.output_index];if(!i)throw new C(`missing output at index ${t.output_index}`);if(i.type==="message"){const o=i.content[t.content_index];if(!o)throw new C(`missing content at index ${t.content_index}`);if(o.type!=="output_text")throw new C(`expected content to be 'output_text', got ${o.type}`);r("response.output_text.delta",{...t,snapshot:o.text})}break}case"response.function_call_arguments.delta":{const i=a.output[t.output_index];if(!i)throw new C(`missing output at index ${t.output_index}`);i.type==="function_call"&&r("response.function_call_arguments.delta",{...t,snapshot:i.arguments});break}default:r(t.type,t);break}},Nn=function(){if(this.ended)throw new C("stream has ended, this shouldn't happen");const t=c(this,ce,"f");if(!t)throw new C("request ended without sending any events");R(this,ce,void 0);const n=wa(t,c(this,Ve,"f"));return R(this,Ge,n),n},jn=function(t){let n=c(this,ce,"f");if(!n){if(t.type!=="response.created")throw new C(`When snapshot hasn't been set yet, expected 'response.created' event, got ${t.type}`);return n=R(this,ce,t.response),n}switch(t.type){case"response.output_item.added":{n.output.push(t.item);break}case"response.content_part.added":{const r=n.output[t.output_index];if(!r)throw new C(`missing output at index ${t.output_index}`);r.type==="message"&&r.content.push(t.part);break}case"response.output_text.delta":{const r=n.output[t.output_index];if(!r)throw new C(`missing output at index ${t.output_index}`);if(r.type==="message"){const a=r.content[t.content_index];if(!a)throw new C(`missing content at index ${t.content_index}`);if(a.type!=="output_text")throw new C(`expected content to be 'output_text', got ${a.type}`);a.text+=t.delta}break}case"response.function_call_arguments.delta":{const r=n.output[t.output_index];if(!r)throw new C(`missing output at index ${t.output_index}`);r.type==="function_call"&&(r.arguments+=t.delta);break}case"response.completed":{R(this,ce,t.response);break}}return n},Symbol.asyncIterator)](){const e=[],t=[];let n=!1;return this.on("event",r=>{const a=t.shift();a?a.resolve(r):e.push(r)}),this.on("end",()=>{n=!0;for(const r of t)r.resolve(void 0);t.length=0}),this.on("abort",r=>{n=!0;for(const a of t)a.reject(r);t.length=0}),this.on("error",r=>{n=!0;for(const a of t)a.reject(r);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((a,i)=>t.push({resolve:a,reject:i})).then(a=>a?{value:a,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}async finalResponse(){await this.done();const e=c(this,Ge,"f");if(!e)throw new C("stream ended without producing a ChatCompletion");return e}}function wa(s,e){return fa(s,e)}class Zs extends k{list(e,t={},n){return this._client.getAPIList(f`/responses/${e}/input_items`,L,{query:t,...n})}}class on extends k{constructor(){super(...arguments),this.inputItems=new Zs(this._client)}create(e,t){return this._client.post("/responses",{body:e,...t,stream:e.stream??!1})._thenUnwrap(n=>("object"in n&&n.object==="response"&&Bt(n),n))}retrieve(e,t={},n){return this._client.get(f`/responses/${e}`,{query:t,...n,stream:(t==null?void 0:t.stream)??!1})._thenUnwrap(r=>("object"in r&&r.object==="response"&&Bt(r),r))}delete(e,t){return this._client.delete(f`/responses/${e}`,{...t,headers:S([{Accept:"*/*"},t==null?void 0:t.headers])})}parse(e,t){return this._client.responses.create(e,t)._thenUnwrap(n=>Ys(n,e))}stream(e,t){return an.createResponse(this._client,e,t)}cancel(e,t){return this._client.post(f`/responses/${e}/cancel`,t)}}on.InputItems=Zs;class er extends k{create(e,t,n){return this._client.post(f`/uploads/${e}/parts`,fe({body:t,...n},this._client))}}class cn extends k{constructor(){super(...arguments),this.parts=new er(this._client)}create(e,t){return this._client.post("/uploads",{body:e,...t})}cancel(e,t){return this._client.post(f`/uploads/${e}/cancel`,t)}complete(e,t,n){return this._client.post(f`/uploads/${e}/complete`,{body:t,...n})}}cn.Parts=er;const ba=async s=>{const e=await Promise.allSettled(s),t=e.filter(r=>r.status==="rejected");if(t.length){for(const r of t)console.error(r.reason);throw new Error(`${t.length} promise(s) failed - see the above errors`)}const n=[];for(const r of e)r.status==="fulfilled"&&n.push(r.value);return n};class tr extends k{create(e,t,n){return this._client.post(f`/vector_stores/${e}/file_batches`,{body:t,...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}retrieve(e,t,n){const{vector_store_id:r}=t;return this._client.get(f`/vector_stores/${r}/file_batches/${e}`,{...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}cancel(e,t,n){const{vector_store_id:r}=t;return this._client.post(f`/vector_stores/${r}/file_batches/${e}/cancel`,{...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}async createAndPoll(e,t,n){const r=await this.create(e,t);return await this.poll(e,r.id,n)}listFiles(e,t,n){const{vector_store_id:r,...a}=t;return this._client.getAPIList(f`/vector_stores/${r}/file_batches/${e}/files`,L,{query:a,...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}async poll(e,t,n){var a;const r=S([n==null?void 0:n.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":((a=n==null?void 0:n.pollIntervalMs)==null?void 0:a.toString())??void 0}]);for(;;){const{data:i,response:o}=await this.retrieve(t,{vector_store_id:e},{...n,headers:r}).withResponse();switch(i.status){case"in_progress":let l=5e3;if(n!=null&&n.pollIntervalMs)l=n.pollIntervalMs;else{const h=o.headers.get("openai-poll-after-ms");if(h){const _=parseInt(h);isNaN(_)||(l=_)}}await De(l);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(e,{files:t,fileIds:n=[]},r){if(t==null||t.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");const a=(r==null?void 0:r.maxConcurrency)??5,i=Math.min(a,t.length),o=this._client,l=t.values(),h=[...n];async function _(g){for(let d of g){const b=await o.files.create({file:d,purpose:"assistants"},r);h.push(b.id)}}const u=Array(i).fill(l).map(_);return await ba(u),await this.createAndPoll(e,{file_ids:h})}}class nr extends k{create(e,t,n){return this._client.post(f`/vector_stores/${e}/files`,{body:t,...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}retrieve(e,t,n){const{vector_store_id:r}=t;return this._client.get(f`/vector_stores/${r}/files/${e}`,{...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}update(e,t,n){const{vector_store_id:r,...a}=t;return this._client.post(f`/vector_stores/${r}/files/${e}`,{body:a,...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}list(e,t={},n){return this._client.getAPIList(f`/vector_stores/${e}/files`,L,{query:t,...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}delete(e,t,n){const{vector_store_id:r}=t;return this._client.delete(f`/vector_stores/${r}/files/${e}`,{...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}async createAndPoll(e,t,n){const r=await this.create(e,t,n);return await this.poll(e,r.id,n)}async poll(e,t,n){var a;const r=S([n==null?void 0:n.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":((a=n==null?void 0:n.pollIntervalMs)==null?void 0:a.toString())??void 0}]);for(;;){const i=await this.retrieve(t,{vector_store_id:e},{...n,headers:r}).withResponse(),o=i.data;switch(o.status){case"in_progress":let l=5e3;if(n!=null&&n.pollIntervalMs)l=n.pollIntervalMs;else{const h=i.response.headers.get("openai-poll-after-ms");if(h){const _=parseInt(h);isNaN(_)||(l=_)}}await De(l);break;case"failed":case"completed":return o}}}async upload(e,t,n){const r=await this._client.files.create({file:t,purpose:"assistants"},n);return this.create(e,{file_id:r.id},n)}async uploadAndPoll(e,t,n){const r=await this.upload(e,t,n);return await this.poll(e,r.id,n)}content(e,t,n){const{vector_store_id:r}=t;return this._client.getAPIList(f`/vector_stores/${r}/files/${e}/content`,gt,{...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}}class wt extends k{constructor(){super(...arguments),this.files=new nr(this._client),this.fileBatches=new tr(this._client)}create(e,t){return this._client.post("/vector_stores",{body:e,...t,headers:S([{"OpenAI-Beta":"assistants=v2"},t==null?void 0:t.headers])})}retrieve(e,t){return this._client.get(f`/vector_stores/${e}`,{...t,headers:S([{"OpenAI-Beta":"assistants=v2"},t==null?void 0:t.headers])})}update(e,t,n){return this._client.post(f`/vector_stores/${e}`,{body:t,...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}list(e={},t){return this._client.getAPIList("/vector_stores",L,{query:e,...t,headers:S([{"OpenAI-Beta":"assistants=v2"},t==null?void 0:t.headers])})}delete(e,t){return this._client.delete(f`/vector_stores/${e}`,{...t,headers:S([{"OpenAI-Beta":"assistants=v2"},t==null?void 0:t.headers])})}search(e,t,n){return this._client.getAPIList(f`/vector_stores/${e}/search`,gt,{body:t,method:"post",...n,headers:S([{"OpenAI-Beta":"assistants=v2"},n==null?void 0:n.headers])})}}wt.Files=nr;wt.FileBatches=tr;var Se,sr,rt;class rr extends k{constructor(){super(...arguments),Se.add(this)}async unwrap(e,t,n=this._client.webhookSecret,r=300){return await this.verifySignature(e,t,n,r),JSON.parse(e)}async verifySignature(e,t,n=this._client.webhookSecret,r=300){if(typeof crypto>"u"||typeof crypto.subtle.importKey!="function"||typeof crypto.subtle.verify!="function")throw new Error("Webhook signature verification is only supported when the `crypto` global is defined");c(this,Se,"m",sr).call(this,n);const a=S([t]).values,i=c(this,Se,"m",rt).call(this,a,"webhook-signature"),o=c(this,Se,"m",rt).call(this,a,"webhook-timestamp"),l=c(this,Se,"m",rt).call(this,a,"webhook-id"),h=parseInt(o,10);if(isNaN(h))throw new Ie("Invalid webhook timestamp format");const _=Math.floor(Date.now()/1e3);if(_-h>r)throw new Ie("Webhook timestamp is too old");if(h>_+r)throw new Ie("Webhook timestamp is too new");const u=i.split(" ").map(w=>w.startsWith("v1,")?w.substring(3):w),g=n.startsWith("whsec_")?Buffer.from(n.replace("whsec_",""),"base64"):Buffer.from(n,"utf-8"),d=l?`${l}.${o}.${e}`:`${o}.${e}`,b=await crypto.subtle.importKey("raw",g,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(const w of u)try{const A=Buffer.from(w,"base64");if(await crypto.subtle.verify("HMAC",b,A,new TextEncoder().encode(d)))return}catch{continue}throw new Ie("The given webhook signature does not match the expected signature")}}Se=new WeakSet,sr=function(e){if(typeof e!="string"||e.length===0)throw new Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},rt=function(e,t){if(!e)throw new Error("Headers are required");const n=e.get(t);if(n==null)throw new Error(`Missing required header: ${t}`);return n};var Wt,ln,at,ar;class P{constructor({baseURL:e=ge("OPENAI_BASE_URL"),apiKey:t=ge("OPENAI_API_KEY"),organization:n=ge("OPENAI_ORG_ID")??null,project:r=ge("OPENAI_PROJECT_ID")??null,webhookSecret:a=ge("OPENAI_WEBHOOK_SECRET")??null,...i}={}){if(Wt.add(this),at.set(this,void 0),this.completions=new Ds(this),this.chat=new Gt(this),this.embeddings=new Ws(this),this.files=new qs(this),this.images=new Gs(this),this.audio=new We(this),this.moderations=new zs(this),this.models=new Qs(this),this.fineTuning=new Ae(this),this.graders=new rn(this),this.vectorStores=new wt(this),this.webhooks=new rr(this),this.beta=new Ue(this),this.batches=new Ts(this),this.uploads=new cn(this),this.responses=new on(this),this.evals=new en(this),this.containers=new Yt(this),t===void 0)throw new C("The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }).");const o={apiKey:t,organization:n,project:r,webhookSecret:a,...i,baseURL:e||"https://api.openai.com/v1"};if(!o.dangerouslyAllowBrowser&&Sr())throw new C(`It looks like you're running in a browser-like environment.
|
|
13
|
-
|
|
14
|
-
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
|
15
|
-
If you understand the risks and have appropriate mitigations in place,
|
|
16
|
-
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
17
|
-
|
|
18
|
-
new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
|
|
19
|
-
|
|
20
|
-
https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
21
|
-
`);this.baseURL=o.baseURL,this.timeout=o.timeout??ln.DEFAULT_TIMEOUT,this.logger=o.logger??console;const l="warn";this.logLevel=l,this.logLevel=Sn(o.logLevel,"ClientOptions.logLevel",this)??Sn(ge("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??l,this.fetchOptions=o.fetchOptions,this.maxRetries=o.maxRetries??2,this.fetch=o.fetch??Ir(),R(this,at,kr),this._options=o,this.apiKey=t,this.organization=n,this.project=r,this.webhookSecret=a}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){}authHeaders(e){return S([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return Mr(e,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${we}`}defaultIdempotencyKey(){return`stainless-node-retry-${Fn()}`}makeStatusError(e,t,n,r){return J.generate(e,t,n,r)}buildURL(e,t,n){const r=!c(this,Wt,"m",ar).call(this)&&n||this.baseURL,a=pr(e)?new URL(e):new URL(r+(r.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),i=this.defaultQuery();return _r(i)||(t={...i,...t}),typeof t=="object"&&t&&!Array.isArray(t)&&(a.search=this.stringifyQuery(t)),a.toString()}async prepareOptions(e){}async prepareRequest(e,{url:t,options:n}){}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,n){return this.request(Promise.resolve(n).then(r=>({method:e,path:t,...r})))}request(e,t=null){return new pt(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,n){var E,m;const r=await e,a=r.maxRetries??this.maxRetries;t==null&&(t=a),await this.prepareOptions(r);const{req:i,url:o,timeout:l}=this.buildRequest(r,{retryCount:a-t});await this.prepareRequest(i,{url:o,options:r});const h="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),_=n===void 0?"":`, retryOf: ${n}`,u=Date.now();if(H(this).debug(`[${h}] sending request`,le({retryOfRequestLogID:n,method:r.method,url:o,options:r,headers:i.headers})),(E=r.signal)!=null&&E.aborted)throw new z;const g=new AbortController,d=await this.fetchWithTimeout(o,i,l,g).catch(Et),b=Date.now();if(d instanceof Error){const y=`retrying, ${t} attempts remaining`;if((m=r.signal)!=null&&m.aborted)throw new z;const p=$t(d)||/timed? ?out/i.test(String(d)+("cause"in d?String(d.cause):""));if(t)return H(this).info(`[${h}] connection ${p?"timed out":"failed"} - ${y}`),H(this).debug(`[${h}] connection ${p?"timed out":"failed"} (${y})`,le({retryOfRequestLogID:n,url:o,durationMs:b-u,message:d.message})),this.retryRequest(r,t,n??h);throw H(this).info(`[${h}] connection ${p?"timed out":"failed"} - error; no more retries left`),H(this).debug(`[${h}] connection ${p?"timed out":"failed"} (error; no more retries left)`,le({retryOfRequestLogID:n,url:o,durationMs:b-u,message:d.message})),p?new Ut:new ft({cause:d})}const w=[...d.headers.entries()].filter(([y])=>y==="x-request-id").map(([y,p])=>", "+y+": "+JSON.stringify(p)).join(""),A=`[${h}${_}${w}] ${i.method} ${o} ${d.ok?"succeeded":"failed"} with status ${d.status} in ${b-u}ms`;if(!d.ok){const y=this.shouldRetry(d);if(t&&y){const x=`retrying, ${t} attempts remaining`;return await Rr(d.body),H(this).info(`${A} - ${x}`),H(this).debug(`[${h}] response error (${x})`,le({retryOfRequestLogID:n,url:d.url,status:d.status,headers:d.headers,durationMs:b-u})),this.retryRequest(r,t,n??h,d.headers)}const p=y?"error; no more retries left":"error; not retryable";H(this).info(`${A} - ${p}`);const v=await d.text().catch(x=>Et(x).message),$=br(v),I=$?void 0:v;throw H(this).debug(`[${h}] response error (${p})`,le({retryOfRequestLogID:n,url:d.url,status:d.status,headers:d.headers,message:I,durationMs:Date.now()-u})),this.makeStatusError(d.status,$,I,d.headers)}return H(this).info(A),H(this).debug(`[${h}] response start`,le({retryOfRequestLogID:n,url:d.url,status:d.status,headers:d.headers,durationMs:b-u})),{response:d,options:r,controller:g,requestLogID:h,retryOfRequestLogID:n,startTime:u}}getAPIList(e,t,n){return this.requestAPIList(t,{method:"get",path:e,...n})}requestAPIList(e,t){const n=this.makeRequest(t,null,void 0);return new qr(this,n,e)}async fetchWithTimeout(e,t,n,r){const{signal:a,method:i,...o}=t||{};a&&a.addEventListener("abort",()=>r.abort());const l=setTimeout(()=>r.abort(),n),h=globalThis.ReadableStream&&o.body instanceof globalThis.ReadableStream||typeof o.body=="object"&&o.body!==null&&Symbol.asyncIterator in o.body,_={signal:r.signal,...h?{duplex:"half"}:{},method:"GET",...o};i&&(_.method=i.toUpperCase());try{return await this.fetch.call(void 0,e,_)}finally{clearTimeout(l)}}shouldRetry(e){const t=e.headers.get("x-should-retry");return t==="true"?!0:t==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,t,n,r){let a;const i=r==null?void 0:r.get("retry-after-ms");if(i){const l=parseFloat(i);Number.isNaN(l)||(a=l)}const o=r==null?void 0:r.get("retry-after");if(o&&!a){const l=parseFloat(o);Number.isNaN(l)?a=Date.parse(o)-Date.now():a=l*1e3}if(!(a&&0<=a&&a<60*1e3)){const l=e.maxRetries??this.maxRetries;a=this.calculateDefaultRetryTimeoutMillis(t,l)}return await De(a),this.makeRequest(e,t-1,n)}calculateDefaultRetryTimeoutMillis(e,t){const a=t-e,i=Math.min(.5*Math.pow(2,a),8),o=1-Math.random()*.25;return i*o*1e3}buildRequest(e,{retryCount:t=0}={}){const n={...e},{method:r,path:a,query:i,defaultBaseURL:o}=n,l=this.buildURL(a,i,o);"timeout"in n&&wr("timeout",n.timeout),n.timeout=n.timeout??this.timeout;const{bodyHeaders:h,body:_}=this.buildBody({options:n}),u=this.buildHeaders({options:e,method:r,bodyHeaders:h,retryCount:t});return{req:{method:r,headers:u,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&_ instanceof globalThis.ReadableStream&&{duplex:"half"},..._&&{body:_},...this.fetchOptions??{},...n.fetchOptions??{}},url:l,timeout:n.timeout}}buildHeaders({options:e,method:t,bodyHeaders:n,retryCount:r}){let a={};this.idempotencyHeader&&t!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),a[this.idempotencyHeader]=e.idempotencyKey);const i=S([a,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...Cr(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(i),i.values}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};const n=S([t]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:Gn(e)}:c(this,at,"f").call(this,{body:e,headers:n})}}ln=P,at=new WeakMap,Wt=new WeakSet,ar=function(){return this.baseURL!=="https://api.openai.com/v1"};P.OpenAI=ln;P.DEFAULT_TIMEOUT=6e5;P.OpenAIError=C;P.APIError=J;P.APIConnectionError=ft;P.APIConnectionTimeoutError=Ut;P.APIUserAbortError=z;P.NotFoundError=Wn;P.ConflictError=Un;P.RateLimitError=Jn;P.BadRequestError=Ln;P.AuthenticationError=Dn;P.InternalServerError=Hn;P.PermissionDeniedError=Bn;P.UnprocessableEntityError=qn;P.InvalidWebhookSignatureError=Ie;P.toFile=Gr;P.Completions=Ds;P.Chat=Gt;P.Embeddings=Ws;P.Files=qs;P.Images=Gs;P.Audio=We;P.Moderations=zs;P.Models=Qs;P.FineTuning=Ae;P.Graders=rn;P.VectorStores=wt;P.Webhooks=rr;P.Beta=Ue;P.Batches=Ts;P.Uploads=cn;P.Responses=on;P.Evals=en;P.Containers=Yt;const Sa=lr(()=>import("./docs-BrInh2Pn.js"),[],import.meta.url);let Qe=null;async function xa(s){if(Qe)return Qe;const e=await s.getObjectViewSystem("state","","香"),t=await s.getObjectViewSystem("channel","","香"),n=await s.getObjectViewSystem("device","","香"),r=await s.getObjectViewSystem("folder","","香"),a=await s.getObjectViewSystem("enum","","香");return Qe=Object.assign(e,t,n,r,a),Qe}function ye(s,e){return s&&typeof s=="object"?s[e]||s.en:s||""}async function Aa(s){var b,w,A,E;const e=U.I18n.getLanguage(),t=await xa(s),n=Object.keys(t).sort(),r=new ur,a=[],i=["UNREACH_STICKY"],o=[hr.Types.info],l=[],h=[],_=[],u=[];n.forEach(m=>{var y,p,v;((y=t[m])==null?void 0:y.type)==="enum"?l.push(m):(v=(p=t[m])==null?void 0:p.common)!=null&&v.smartName&&u.push(m)}),l.forEach(m=>{m.startsWith("enum.rooms.")?h.push(m):m.startsWith("enum.functions.")&&_.push(m);const y=t[m].common.members;y!=null&&y.length&&y.forEach(p=>{t[p]&&(u.includes(p)||u.push(p))})});const g={id:"",objects:t,_keysOptional:n,_usedIdsOptional:a,ignoreIndicators:i,excludedTypes:o},d=[];u.forEach(m=>{g.id=m;const y=r.detect(g);y&&y.forEach(p=>{var me;const v=(me=p.states.find(N=>N.id))==null?void 0:me.id;if(!v||d.find(N=>N.id===v))return;const $=t[v],I={id:v,name:ye($.common.name,e),type:$.type,deviceType:p.type,states:p.states.filter(N=>N.id).map(N=>({id:N.id,name:N.name,role:N.defaultRole,type:t[N.id].common.type,unit:t[N.id].common.unit,read:t[N.id].common.read===void 0?!0:t[N.id].common.read,write:t[N.id].common.write===void 0?!0:t[N.id].common.write}))},F=v.split(".");let x,T;($.type==="channel"||$.type==="state")&&(F.pop(),x=F.join("."),t[x]&&(t[x].type==="channel"||t[x].type==="folder")?(F.pop(),T=F.join("."),(!t[T]||t[T].type!=="device"&&t[x].type!=="folder")&&(T=void 0)):x=void 0);const M=h.find(N=>{var ie,ve,Ce;return(ie=t[N].common.members)!=null&&ie.includes(v)||x&&((ve=t[N].common.members)!=null&&ve.includes(x))?!0:T&&((Ce=t[N].common.members)==null?void 0:Ce.includes(T))});M&&(I.room=ye(t[M].common.name,e));const se=_.find(N=>{var ie,ve,Ce;return(ie=t[N].common.members)!=null&&ie.includes(v)||x&&((ve=t[N].common.members)!=null&&ve.includes(x))?!0:T&&((Ce=t[N].common.members)==null?void 0:Ce.includes(T))});se&&(I.function=ye(t[se].common.name,e)),d.push(I)})});for(let m=0;m<d.length;m++){const y=d[m];if(y.type==="state"||y.type==="channel"){const p=y.id.split(".");p.pop();const v=t[p.join(".")];if(v&&(v.type==="channel"||v.type==="device"||v.type==="folder")){y.name=ye(((b=v.common)==null?void 0:b.name)||y.name,e),p.pop();const $=t[p.join(".")];($==null?void 0:$.type)==="device"&&((w=$.common)!=null&&w.icon)&&(y.name=ye(((A=$.common)==null?void 0:A.name)||y.name,e))}else y.name=ye(((E=v==null?void 0:v.common)==null?void 0:E.name)||y.name,e)}}return d}const va=async()=>(await Sa).default,Ca={ru:"Russian",en:"English",de:"German",es:"Spanish",fr:"French",it:"Italian",pl:"Polish",nl:"Dutch",pt:"Portuguese",uk:"Ukrainian","zh-cn":"Chinese"},qa=s=>{const[e,t]=Z.useState(window.localStorage.getItem("openai-question")||""),[n,r]=Z.useState(""),[a,i]=Z.useState(!1),[o,l]=Z.useState(!1),[h,_]=Z.useState(window.localStorage.getItem("openai-model")||"gpt-4o"),[u,g]=Z.useState(!1),d=Z.useRef(null),b=Z.useRef(null),w=Z.useRef(null),A=Z.useCallback(async()=>{var p;let E;d.current?E=d.current:(E=await Aa(s.socket),d.current=E,console.log(`devices: ${JSON.stringify(E,null,2)}`));let m;if(b.current)m=b.current;else{const v=Object.keys(s.runningInstances);for(let $=0;$<v.length;$++){const I=await s.socket.getObject(v[$]);if(m=((I==null?void 0:I.native.gptKey)||"").trim(),m)break}b.current=m||null}let y;if(w.current?y=w.current:(y=await va(),w.current=y),!m){g(!0);return}i(!0),l(!1);try{const I=(await new P({apiKey:m,dangerouslyAllowBrowser:!0}).chat.completions.create({model:h,messages:[{role:"system",content:`You are programmer. Here is a documentation:
|
|
22
|
-
|
|
23
|
-
${y}`},{role:"system",content:`Here is list of devices:
|
|
24
|
-
|
|
25
|
-
${JSON.stringify(E,null,2)}`},{role:"user",content:`Write JavaScript code that does:
|
|
26
|
-
|
|
27
|
-
${e}
|
|
28
|
-
Return only code.
|
|
29
|
-
Write comments in ${Ca[U.I18n.getLanguage()]||"English"}.
|
|
30
|
-
You can call async function directly in the code without encapsulate them in async function as this code will be already executed in async function.
|
|
31
|
-
Do not import any libraries as all functions are already imported.`}]})).choices[0].message,F=(p=I.content)==null?void 0:p.match(/```(javascript|js|typescript)\n?(.*)```(.*)/ms);let x;if(!F)x=I.content,x!=null&&x.startsWith("`")&&(x=x.substring(1)),x!=null&&x.endsWith("`")&&(x=x.substring(0,x.length-1));else if(x=F[2],F[3]){const T=F[3].split(`
|
|
32
|
-
`).map(M=>M.trim());for(;T[0]==="";)T.shift();x=`${T.map(M=>`// ${M}`).join(`
|
|
33
|
-
`)}
|
|
34
|
-
${x}`}console.log(I),r(x||"")}catch(v){console.log(JSON.stringify(v)),v.error&&l(v.error.message),console.error(`Cannot request: ${v}, ${JSON.stringify(v.error||v,null,2)}`)}i(!1)},[e,h,s.runningInstances,s.socket]);return O.jsxs(j.Dialog,{maxWidth:"lg",sx:{"& .MuiDialog-paper":{height:"calc(100% - 100px)"}},open:!0,onClose:()=>s.onClose(),fullWidth:!0,children:[u&&O.jsxs(j.Dialog,{maxWidth:"lg",open:!0,onClose:()=>g(!1),fullWidth:!0,children:[O.jsx(j.DialogTitle,{children:U.I18n.t("No Chat GPT Key found")}),O.jsxs(j.DialogContent,{style:{display:"flex",flexDirection:"column",gap:8},children:[O.jsx("div",{children:U.I18n.t("You have to enter OpenAI API key in the configuration of javascript adapter.")}),O.jsx(j.Button,{variant:"contained",onClick:()=>{const E=Object.keys(s.runningInstances);window.open(`../../#tab-instances/config/${E[0]||"system.adapter.javascript.0"}`,"_blank"),g(!1)},children:U.I18n.t("Open configuration")})]}),O.jsx(j.DialogActions,{children:O.jsx(j.Button,{variant:"contained",startIcon:O.jsx(un,{}),onClick:()=>g(!1),children:U.I18n.t("Close")})})]}),O.jsx(j.DialogTitle,{children:U.I18n.t("AI code generator")}),O.jsxs(j.DialogContent,{style:{display:"flex",flexDirection:"column",gap:8,height:"100%"},children:[O.jsx("div",{children:O.jsx(j.TextField,{variant:"standard",multiline:!0,autoFocus:!0,disabled:a,fullWidth:!0,onKeyUp:E=>{E.key==="Enter"&&E.ctrlKey&&A()},label:U.I18n.t("Enter your question"),helperText:U.I18n.t("Press Ctrl+Enter to get the answer"),value:e,onChange:E=>{window.localStorage.setItem("openai-question",E.target.value),t(E.target.value)}})}),O.jsxs("div",{style:{display:"flex",alignItems:"baseline"},children:[O.jsx(j.Button,{variant:"contained",disabled:a||!e,startIcon:O.jsx(fr,{}),onClick:async()=>A(),children:a?O.jsx(j.CircularProgress,{size:24}):U.I18n.t("Ask")}),O.jsxs(j.FormControl,{style:{width:150,marginLeft:20},variant:"standard",children:[O.jsx(j.InputLabel,{children:U.I18n.t("Model")}),O.jsxs(j.Select,{variant:"standard",value:h,onChange:E=>{window.localStorage.setItem("openai-model",E.target.value),o&&l(!1),_(E.target.value)},children:[O.jsx(j.MenuItem,{value:"gpt-4o",children:"GPT-4o"}),O.jsx(j.MenuItem,{value:"gpt-4-turbo",children:"GPT-4 Turbo"}),O.jsx(j.MenuItem,{value:"gpt-4-32k",children:"GPT-4 32k"}),O.jsx(j.MenuItem,{value:"gpt-4",children:"GPT-4"}),O.jsx(j.MenuItem,{value:"gpt-3.5-turbo-16k",children:"GPT-3.5 Turbo"})]})]})]}),O.jsx("div",{children:U.I18n.t("Result")}),O.jsx("div",{style:{height:"calc(100% - 155px)"},children:o?O.jsx("div",{style:{color:s.themeType==="dark"?"#984242":"#bb0000"},children:o}):O.jsx(dr,{triggerPrettier:1,adapterName:s.adapterName,runningInstances:s.runningInstances,style:{height:"100%",width:"100%",resize:"none"},name:"ai",socket:s.socket,readOnly:!0,checkJs:!0,code:n,isDark:s.themeType==="dark",language:s.language||"javascript"})})]}),O.jsxs(j.DialogActions,{children:[O.jsx(j.Button,{color:"grey",variant:"outlined",disabled:!n,startIcon:O.jsx(cr,{}),onClick:()=>{U.Utils.copyToClipboard(n),window.alert(U.I18n.t("Copied"))},children:U.I18n.t("Copy to clipboard")}),O.jsx(j.Button,{color:"primary",variant:"contained",disabled:!n||o,startIcon:O.jsx(or,{}),onClick:()=>{s.onAddCode(n),s.onClose()},children:U.I18n.t("Use generated code")}),O.jsx(j.Button,{color:"grey",variant:"contained",startIcon:O.jsx(un,{}),onClick:()=>s.onClose(),children:U.I18n.t("Close")})]})]})};export{qa as default};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import{i as I,a as Wt}from"./iobroker_javascript__loadShare__react__loadShare__-BiJPUKBK.js";import{g as Ur}from"./_commonjsHelpers-Cpj98o6Y.js";import{i as Yr,a as qr}from"./iobroker_javascript__mf_v__runtimeInit__mf_v__-CBQgOKij.js";var ur={exports:{}},Ge={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Xr=I,Qr=Symbol.for("react.element"),Zr=Symbol.for("react.fragment"),Jr=Object.prototype.hasOwnProperty,en=Xr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,tn={key:!0,ref:!0,__self:!0,__source:!0};function fr(e,t,r){var n,a={},o=null,s=null;r!==void 0&&(o=""+r),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(s=t.ref);for(n in t)Jr.call(t,n)&&!tn.hasOwnProperty(n)&&(a[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)a[n]===void 0&&(a[n]=t[n]);return{$$typeof:Qr,type:e,key:o,ref:s,props:a,_owner:en.current}}Ge.Fragment=Zr;Ge.jsx=fr;Ge.jsxs=fr;ur.exports=Ge;var ze=ur.exports;function se(e,...t){const r=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(n=>r.searchParams.append("args[]",n)),`Minified MUI error #${e}; visit ${r} for the full message.`}const rn="$$material";function gt(){return gt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},gt.apply(null,arguments)}function nn(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function an(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var on=function(){function e(r){var n=this;this._insertTag=function(a){var o;n.tags.length===0?n.insertionPoint?o=n.insertionPoint.nextSibling:n.prepend?o=n.container.firstChild:o=n.before:o=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(a,o),n.tags.push(a)},this.isSpeedy=r.speedy===void 0?!0:r.speedy,this.tags=[],this.ctr=0,this.nonce=r.nonce,this.key=r.key,this.container=r.container,this.prepend=r.prepend,this.insertionPoint=r.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(n){n.forEach(this._insertTag)},t.insert=function(n){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(an(this));var a=this.tags[this.tags.length-1];if(this.isSpeedy){var o=nn(a);try{o.insertRule(n,o.cssRules.length)}catch{}}else a.appendChild(document.createTextNode(n));this.ctr++},t.flush=function(){this.tags.forEach(function(n){var a;return(a=n.parentNode)==null?void 0:a.removeChild(n)}),this.tags=[],this.ctr=0},e}(),W="-ms-",je="-moz-",P="-webkit-",dr="comm",kt="rule",At="decl",sn="@import",mr="@keyframes",cn="@layer",ln=Math.abs,He=String.fromCharCode,un=Object.assign;function fn(e,t){return j(e,0)^45?(((t<<2^j(e,0))<<2^j(e,1))<<2^j(e,2))<<2^j(e,3):0}function pr(e){return e.trim()}function dn(e,t){return(e=t.exec(e))?e[0]:e}function _(e,t,r){return e.replace(t,r)}function yt(e,t){return e.indexOf(t)}function j(e,t){return e.charCodeAt(t)|0}function Ae(e,t,r){return e.slice(t,r)}function ee(e){return e.length}function Tt(e){return e.length}function Re(e,t){return t.push(e),e}function mn(e,t){return e.map(t).join("")}var Ke=1,he=1,hr=0,V=0,z=0,be="";function Ve(e,t,r,n,a,o,s){return{value:e,root:t,parent:r,type:n,props:a,children:o,line:Ke,column:he,length:s,return:""}}function ve(e,t){return un(Ve("",null,null,"",null,null,0),e,{length:-e.length},t)}function pn(){return z}function hn(){return z=V>0?j(be,--V):0,he--,z===10&&(he=1,Ke--),z}function Y(){return z=V<hr?j(be,V++):0,he++,z===10&&(he=1,Ke++),z}function re(){return j(be,V)}function Fe(){return V}function _e(e,t){return Ae(be,e,t)}function Te(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function gr(e){return Ke=he=1,hr=ee(be=e),V=0,[]}function yr(e){return be="",e}function Me(e){return pr(_e(V-1,bt(e===91?e+2:e===40?e+1:e)))}function gn(e){for(;(z=re())&&z<33;)Y();return Te(e)>2||Te(z)>3?"":" "}function yn(e,t){for(;--t&&Y()&&!(z<48||z>102||z>57&&z<65||z>70&&z<97););return _e(e,Fe()+(t<6&&re()==32&&Y()==32))}function bt(e){for(;Y();)switch(z){case e:return V;case 34:case 39:e!==34&&e!==39&&bt(z);break;case 40:e===41&&bt(e);break;case 92:Y();break}return V}function bn(e,t){for(;Y()&&e+z!==57;)if(e+z===84&&re()===47)break;return"/*"+_e(t,V-1)+"*"+He(e===47?e:Y())}function Sn(e){for(;!Te(re());)Y();return _e(e,V)}function vn(e){return yr(Le("",null,null,null,[""],e=gr(e),0,[0],e))}function Le(e,t,r,n,a,o,s,c,u){for(var f=0,p=0,d=s,m=0,b=0,g=0,h=1,v=1,S=1,$=0,w="",C=a,k=o,A=n,x=w;v;)switch(g=$,$=Y()){case 40:if(g!=108&&j(x,d-1)==58){yt(x+=_(Me($),"&","&\f"),"&\f")!=-1&&(S=-1);break}case 34:case 39:case 91:x+=Me($);break;case 9:case 10:case 13:case 32:x+=gn(g);break;case 92:x+=yn(Fe()-1,7);continue;case 47:switch(re()){case 42:case 47:Re(Cn(bn(Y(),Fe()),t,r),u);break;default:x+="/"}break;case 123*h:c[f++]=ee(x)*S;case 125*h:case 59:case 0:switch($){case 0:case 125:v=0;case 59+p:S==-1&&(x=_(x,/\f/g,"")),b>0&&ee(x)-d&&Re(b>32?Ht(x+";",n,r,d-1):Ht(_(x," ","")+";",n,r,d-2),u);break;case 59:x+=";";default:if(Re(A=Gt(x,t,r,f,p,a,c,w,C=[],k=[],d),o),$===123)if(p===0)Le(x,t,A,A,C,o,d,c,k);else switch(m===99&&j(x,3)===110?100:m){case 100:case 108:case 109:case 115:Le(e,A,A,n&&Re(Gt(e,A,A,0,0,a,c,w,a,C=[],d),k),a,k,d,c,n?C:k);break;default:Le(x,A,A,A,[""],k,0,c,k)}}f=p=b=0,h=S=1,w=x="",d=s;break;case 58:d=1+ee(x),b=g;default:if(h<1){if($==123)--h;else if($==125&&h++==0&&hn()==125)continue}switch(x+=He($),$*h){case 38:S=p>0?1:(x+="\f",-1);break;case 44:c[f++]=(ee(x)-1)*S,S=1;break;case 64:re()===45&&(x+=Me(Y())),m=re(),p=d=ee(w=x+=Sn(Fe())),$++;break;case 45:g===45&&ee(x)==2&&(h=0)}}return o}function Gt(e,t,r,n,a,o,s,c,u,f,p){for(var d=a-1,m=a===0?o:[""],b=Tt(m),g=0,h=0,v=0;g<n;++g)for(var S=0,$=Ae(e,d+1,d=ln(h=s[g])),w=e;S<b;++S)(w=pr(h>0?m[S]+" "+$:_($,/&\f/g,m[S])))&&(u[v++]=w);return Ve(e,t,r,a===0?kt:c,u,f,p)}function Cn(e,t,r){return Ve(e,t,r,dr,He(pn()),Ae(e,2,-2),0)}function Ht(e,t,r,n){return Ve(e,t,r,At,Ae(e,0,n),Ae(e,n+1,-1),n)}function me(e,t){for(var r="",n=Tt(e),a=0;a<n;a++)r+=t(e[a],a,e,t)||"";return r}function xn(e,t,r,n){switch(e.type){case cn:if(e.children.length)break;case sn:case At:return e.return=e.return||e.value;case dr:return"";case mr:return e.return=e.value+"{"+me(e.children,n)+"}";case kt:e.value=e.props.join(",")}return ee(r=me(e.children,n))?e.return=e.value+"{"+r+"}":""}function wn(e){var t=Tt(e);return function(r,n,a,o){for(var s="",c=0;c<t;c++)s+=e[c](r,n,a,o)||"";return s}}function kn(e){return function(t){t.root||(t=t.return)&&e(t)}}function br(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var An=function(t,r,n){for(var a=0,o=0;a=o,o=re(),a===38&&o===12&&(r[n]=1),!Te(o);)Y();return _e(t,V)},Tn=function(t,r){var n=-1,a=44;do switch(Te(a)){case 0:a===38&&re()===12&&(r[n]=1),t[n]+=An(V-1,r,n);break;case 2:t[n]+=Me(a);break;case 4:if(a===44){t[++n]=re()===58?"&\f":"",r[n]=t[n].length;break}default:t[n]+=He(a)}while(a=Y());return t},$n=function(t,r){return yr(Tn(gr(t),r))},Kt=new WeakMap,Pn=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var r=t.value,n=t.parent,a=t.column===n.column&&t.line===n.line;n.type!=="rule";)if(n=n.parent,!n)return;if(!(t.props.length===1&&r.charCodeAt(0)!==58&&!Kt.get(n))&&!a){Kt.set(t,!0);for(var o=[],s=$n(r,o),c=n.props,u=0,f=0;u<s.length;u++)for(var p=0;p<c.length;p++,f++)t.props[f]=o[u]?s[u].replace(/&\f/g,c[p]):c[p]+" "+s[u]}}},_n=function(t){if(t.type==="decl"){var r=t.value;r.charCodeAt(0)===108&&r.charCodeAt(2)===98&&(t.return="",t.value="")}};function Sr(e,t){switch(fn(e,t)){case 5103:return P+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return P+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return P+e+je+e+W+e+e;case 6828:case 4268:return P+e+W+e+e;case 6165:return P+e+W+"flex-"+e+e;case 5187:return P+e+_(e,/(\w+).+(:[^]+)/,P+"box-$1$2"+W+"flex-$1$2")+e;case 5443:return P+e+W+"flex-item-"+_(e,/flex-|-self/,"")+e;case 4675:return P+e+W+"flex-line-pack"+_(e,/align-content|flex-|-self/,"")+e;case 5548:return P+e+W+_(e,"shrink","negative")+e;case 5292:return P+e+W+_(e,"basis","preferred-size")+e;case 6060:return P+"box-"+_(e,"-grow","")+P+e+W+_(e,"grow","positive")+e;case 4554:return P+_(e,/([^-])(transform)/g,"$1"+P+"$2")+e;case 6187:return _(_(_(e,/(zoom-|grab)/,P+"$1"),/(image-set)/,P+"$1"),e,"")+e;case 5495:case 3959:return _(e,/(image-set\([^]*)/,P+"$1$`$1");case 4968:return _(_(e,/(.+:)(flex-)?(.*)/,P+"box-pack:$3"+W+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+P+e+e;case 4095:case 3583:case 4068:case 2532:return _(e,/(.+)-inline(.+)/,P+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(ee(e)-1-t>6)switch(j(e,t+1)){case 109:if(j(e,t+4)!==45)break;case 102:return _(e,/(.+:)(.+)-([^]+)/,"$1"+P+"$2-$3$1"+je+(j(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~yt(e,"stretch")?Sr(_(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(j(e,t+1)!==115)break;case 6444:switch(j(e,ee(e)-3-(~yt(e,"!important")&&10))){case 107:return _(e,":",":"+P)+e;case 101:return _(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+P+(j(e,14)===45?"inline-":"")+"box$3$1"+P+"$2$3$1"+W+"$2box$3")+e}break;case 5936:switch(j(e,t+11)){case 114:return P+e+W+_(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return P+e+W+_(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return P+e+W+_(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return P+e+W+e+e}return e}var En=function(t,r,n,a){if(t.length>-1&&!t.return)switch(t.type){case At:t.return=Sr(t.value,t.length);break;case mr:return me([ve(t,{value:_(t.value,"@","@"+P)})],a);case kt:if(t.length)return mn(t.props,function(o){switch(dn(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return me([ve(t,{props:[_(o,/:(read-\w+)/,":"+je+"$1")]})],a);case"::placeholder":return me([ve(t,{props:[_(o,/:(plac\w+)/,":"+P+"input-$1")]}),ve(t,{props:[_(o,/:(plac\w+)/,":"+je+"$1")]}),ve(t,{props:[_(o,/:(plac\w+)/,W+"input-$1")]})],a)}return""})}},On=[En],Rn=function(t){var r=t.key;if(r==="css"){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(h){var v=h.getAttribute("data-emotion");v.indexOf(" ")!==-1&&(document.head.appendChild(h),h.setAttribute("data-s",""))})}var a=t.stylisPlugins||On,o={},s,c=[];s=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+r+' "]'),function(h){for(var v=h.getAttribute("data-emotion").split(" "),S=1;S<v.length;S++)o[v[S]]=!0;c.push(h)});var u,f=[Pn,_n];{var p,d=[xn,kn(function(h){p.insert(h)})],m=wn(f.concat(a,d)),b=function(v){return me(vn(v),m)};u=function(v,S,$,w){p=$,b(v?v+"{"+S.styles+"}":S.styles),w&&(g.inserted[S.name]=!0)}}var g={key:r,sheet:new on({key:r,container:s,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:o,registered:{},insert:u};return g.sheet.hydrate(c),g},Bn=!0;function vr(e,t,r){var n="";return r.split(" ").forEach(function(a){e[a]!==void 0?t.push(e[a]+";"):a&&(n+=a+" ")}),n}var $t=function(t,r,n){var a=t.key+"-"+r.name;(n===!1||Bn===!1)&&t.registered[a]===void 0&&(t.registered[a]=r.styles)},Cr=function(t,r,n){$t(t,r,n);var a=t.key+"-"+r.name;if(t.inserted[r.name]===void 0){var o=r;do t.insert(r===o?"."+a:"",o,t.sheet,!0),o=o.next;while(o!==void 0)}};function In(e){for(var t=0,r,n=0,a=e.length;a>=4;++n,a-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(a){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var Fn={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Mn=/[A-Z]|^ms/g,Ln=/_EMO_([^_]+?)_([^]*?)_EMO_/g,xr=function(t){return t.charCodeAt(1)===45},Vt=function(t){return t!=null&&typeof t!="boolean"},dt=br(function(e){return xr(e)?e:e.replace(Mn,"-$&").toLowerCase()}),Ut=function(t,r){switch(t){case"animation":case"animationName":if(typeof r=="string")return r.replace(Ln,function(n,a,o){return te={name:a,styles:o,next:te},a})}return Fn[t]!==1&&!xr(t)&&typeof r=="number"&&r!==0?r+"px":r};function $e(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var a=r;if(a.anim===1)return te={name:a.name,styles:a.styles,next:te},a.name;var o=r;if(o.styles!==void 0){var s=o.next;if(s!==void 0)for(;s!==void 0;)te={name:s.name,styles:s.styles,next:te},s=s.next;var c=o.styles+";";return c}return Nn(e,t,r)}case"function":{if(e!==void 0){var u=te,f=r(e);return te=u,$e(e,t,f)}break}}var p=r;if(t==null)return p;var d=t[p];return d!==void 0?d:p}function Nn(e,t,r){var n="";if(Array.isArray(r))for(var a=0;a<r.length;a++)n+=$e(e,t,r[a])+";";else for(var o in r){var s=r[o];if(typeof s!="object"){var c=s;t!=null&&t[c]!==void 0?n+=o+"{"+t[c]+"}":Vt(c)&&(n+=dt(o)+":"+Ut(o,c)+";")}else if(Array.isArray(s)&&typeof s[0]=="string"&&(t==null||t[s[0]]===void 0))for(var u=0;u<s.length;u++)Vt(s[u])&&(n+=dt(o)+":"+Ut(o,s[u])+";");else{var f=$e(e,t,s);switch(o){case"animation":case"animationName":{n+=dt(o)+":"+f+";";break}default:n+=o+"{"+f+"}"}}}return n}var Yt=/label:\s*([^\s;{]+)\s*(;|$)/g,te;function Pt(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,a="";te=void 0;var o=e[0];if(o==null||o.raw===void 0)n=!1,a+=$e(r,t,o);else{var s=o;a+=s[0]}for(var c=1;c<e.length;c++)if(a+=$e(r,t,e[c]),n){var u=o;a+=u[c]}Yt.lastIndex=0;for(var f="",p;(p=Yt.exec(a))!==null;)f+="-"+p[1];var d=In(a)+f;return{name:d,styles:a,next:te}}var zn=function(t){return t()},wr=Wt.useInsertionEffect?Wt.useInsertionEffect:!1,kr=wr||zn,Ci=wr||I.useLayoutEffect,Ar=I.createContext(typeof HTMLElement<"u"?Rn({key:"css"}):null),xi=Ar.Provider,Tr=function(t){return I.forwardRef(function(r,n){var a=I.useContext(Ar);return t(r,a,n)})},_t=I.createContext({}),$r={}.hasOwnProperty,St="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",wi=function(t,r){var n={};for(var a in r)$r.call(r,a)&&(n[a]=r[a]);return n[St]=t,n},jn=function(t){var r=t.cache,n=t.serialized,a=t.isStringTag;return $t(r,n,a),kr(function(){return Cr(r,n,a)}),null},Dn=Tr(function(e,t,r){var n=e.css;typeof n=="string"&&t.registered[n]!==void 0&&(n=t.registered[n]);var a=e[St],o=[n],s="";typeof e.className=="string"?s=vr(t.registered,o,e.className):e.className!=null&&(s=e.className+" ");var c=Pt(o,void 0,I.useContext(_t));s+=t.key+"-"+c.name;var u={};for(var f in e)$r.call(e,f)&&f!=="css"&&f!==St&&(u[f]=e[f]);return u.className=s,r&&(u.ref=r),I.createElement(I.Fragment,null,I.createElement(jn,{cache:t,serialized:c,isStringTag:typeof a=="string"}),I.createElement(a,u))}),ki=Dn,Wn=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Gn=br(function(e){return Wn.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),Hn=Gn,Kn=function(t){return t!=="theme"},qt=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?Hn:Kn},Xt=function(t,r,n){var a;if(r){var o=r.shouldForwardProp;a=t.__emotion_forwardProp&&o?function(s){return t.__emotion_forwardProp(s)&&o(s)}:o}return typeof a!="function"&&n&&(a=t.__emotion_forwardProp),a},Vn=function(t){var r=t.cache,n=t.serialized,a=t.isStringTag;return $t(r,n,a),kr(function(){return Cr(r,n,a)}),null},Un=function e(t,r){var n=t.__emotion_real===t,a=n&&t.__emotion_base||t,o,s;r!==void 0&&(o=r.label,s=r.target);var c=Xt(t,r,n),u=c||qt(a),f=!u("as");return function(){var p=arguments,d=n&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(o!==void 0&&d.push("label:"+o+";"),p[0]==null||p[0].raw===void 0)d.push.apply(d,p);else{var m=p[0];d.push(m[0]);for(var b=p.length,g=1;g<b;g++)d.push(p[g],m[g])}var h=Tr(function(v,S,$){var w=f&&v.as||a,C="",k=[],A=v;if(v.theme==null){A={};for(var x in v)A[x]=v[x];A.theme=I.useContext(_t)}typeof v.className=="string"?C=vr(S.registered,k,v.className):v.className!=null&&(C=v.className+" ");var D=Pt(d.concat(k),S.registered,A);C+=S.key+"-"+D.name,s!==void 0&&(C+=" "+s);var H=f&&c===void 0?qt(w):u,i={};for(var y in v)f&&y==="as"||H(y)&&(i[y]=v[y]);return i.className=C,$&&(i.ref=$),I.createElement(I.Fragment,null,I.createElement(Vn,{cache:S,serialized:D,isStringTag:typeof w=="string"}),I.createElement(w,i))});return h.displayName=o!==void 0?o:"Styled("+(typeof a=="string"?a:a.displayName||a.name||"Component")+")",h.defaultProps=t.defaultProps,h.__emotion_real=h,h.__emotion_base=a,h.__emotion_styles=d,h.__emotion_forwardProp=c,Object.defineProperty(h,"toString",{value:function(){return"."+s}}),h.withComponent=function(v,S){var $=e(v,gt({},r,S,{shouldForwardProp:Xt(h,S,!0)}));return $.apply(void 0,d)},h}},Yn=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],vt=Un.bind(null);Yn.forEach(function(e){vt[e]=vt(e)});const{loadShare:qn}=Yr,{initPromise:Xn}=qr,Qn=Xn.then(e=>qn("prop-types",{customShareInfo:{shareConfig:{singleton:!0,strictVersion:!1,requiredVersion:"*"}}})),Zn=await Qn.then(e=>e());var Jn=Zn;const Ai=Ur(Jn);/**
|
|
10
|
-
* @mui/styled-engine v6.4.11
|
|
11
|
-
*
|
|
12
|
-
* @license MIT
|
|
13
|
-
* This source code is licensed under the MIT license found in the
|
|
14
|
-
* LICENSE file in the root directory of this source tree.
|
|
15
|
-
*/function ea(e,t){return vt(e,t)}function ta(e,t){Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}const Qt=[];function Zt(e){return Qt[0]=e,Pt(Qt)}var Pr={exports:{}},R={};/**
|
|
16
|
-
* @license React
|
|
17
|
-
* react-is.production.js
|
|
18
|
-
*
|
|
19
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
20
|
-
*
|
|
21
|
-
* This source code is licensed under the MIT license found in the
|
|
22
|
-
* LICENSE file in the root directory of this source tree.
|
|
23
|
-
*/var Et=Symbol.for("react.transitional.element"),Ot=Symbol.for("react.portal"),Ue=Symbol.for("react.fragment"),Ye=Symbol.for("react.strict_mode"),qe=Symbol.for("react.profiler"),Xe=Symbol.for("react.consumer"),Qe=Symbol.for("react.context"),Ze=Symbol.for("react.forward_ref"),Je=Symbol.for("react.suspense"),et=Symbol.for("react.suspense_list"),tt=Symbol.for("react.memo"),rt=Symbol.for("react.lazy"),ra=Symbol.for("react.view_transition"),na=Symbol.for("react.client.reference");function X(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Et:switch(e=e.type,e){case Ue:case qe:case Ye:case Je:case et:case ra:return e;default:switch(e=e&&e.$$typeof,e){case Qe:case Ze:case rt:case tt:return e;case Xe:return e;default:return t}}case Ot:return t}}}R.ContextConsumer=Xe;R.ContextProvider=Qe;R.Element=Et;R.ForwardRef=Ze;R.Fragment=Ue;R.Lazy=rt;R.Memo=tt;R.Portal=Ot;R.Profiler=qe;R.StrictMode=Ye;R.Suspense=Je;R.SuspenseList=et;R.isContextConsumer=function(e){return X(e)===Xe};R.isContextProvider=function(e){return X(e)===Qe};R.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Et};R.isForwardRef=function(e){return X(e)===Ze};R.isFragment=function(e){return X(e)===Ue};R.isLazy=function(e){return X(e)===rt};R.isMemo=function(e){return X(e)===tt};R.isPortal=function(e){return X(e)===Ot};R.isProfiler=function(e){return X(e)===qe};R.isStrictMode=function(e){return X(e)===Ye};R.isSuspense=function(e){return X(e)===Je};R.isSuspenseList=function(e){return X(e)===et};R.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===Ue||e===qe||e===Ye||e===Je||e===et||typeof e=="object"&&e!==null&&(e.$$typeof===rt||e.$$typeof===tt||e.$$typeof===Qe||e.$$typeof===Xe||e.$$typeof===Ze||e.$$typeof===na||e.getModuleId!==void 0)};R.typeOf=X;Pr.exports=R;var _r=Pr.exports;function ae(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Er(e){if(I.isValidElement(e)||_r.isValidElementType(e)||!ae(e))return e;const t={};return Object.keys(e).forEach(r=>{t[r]=Er(e[r])}),t}function K(e,t,r={clone:!0}){const n=r.clone?{...e}:e;return ae(e)&&ae(t)&&Object.keys(t).forEach(a=>{I.isValidElement(t[a])||_r.isValidElementType(t[a])?n[a]=t[a]:ae(t[a])&&Object.prototype.hasOwnProperty.call(e,a)&&ae(e[a])?n[a]=K(e[a],t[a],r):r.clone?n[a]=ae(t[a])?Er(t[a]):t[a]:n[a]=t[a]}),n}const aa=e=>{const t=Object.keys(e).map(r=>({key:r,val:e[r]}))||[];return t.sort((r,n)=>r.val-n.val),t.reduce((r,n)=>({...r,[n.key]:n.val}),{})};function oa(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:r="px",step:n=5,...a}=e,o=aa(t),s=Object.keys(o);function c(m){return`@media (min-width:${typeof t[m]=="number"?t[m]:m}${r})`}function u(m){return`@media (max-width:${(typeof t[m]=="number"?t[m]:m)-n/100}${r})`}function f(m,b){const g=s.indexOf(b);return`@media (min-width:${typeof t[m]=="number"?t[m]:m}${r}) and (max-width:${(g!==-1&&typeof t[s[g]]=="number"?t[s[g]]:b)-n/100}${r})`}function p(m){return s.indexOf(m)+1<s.length?f(m,s[s.indexOf(m)+1]):c(m)}function d(m){const b=s.indexOf(m);return b===0?c(s[1]):b===s.length-1?u(s[b]):f(m,s[s.indexOf(m)+1]).replace("@media","@media not all and")}return{keys:s,values:o,up:c,down:u,between:f,only:p,not:d,unit:r,...a}}function ia(e,t){if(!e.containerQueries)return t;const r=Object.keys(t).filter(n=>n.startsWith("@container")).sort((n,a)=>{var s,c;const o=/min-width:\s*([0-9.]+)/;return+(((s=n.match(o))==null?void 0:s[1])||0)-+(((c=a.match(o))==null?void 0:c[1])||0)});return r.length?r.reduce((n,a)=>{const o=t[a];return delete n[a],n[a]=o,n},{...t}):t}function sa(e,t){return t==="@"||t.startsWith("@")&&(e.some(r=>t.startsWith(`@${r}`))||!!t.match(/^@\d/))}function ca(e,t){const r=t.match(/^@([^/]+)?\/?(.+)?$/);if(!r)return null;const[,n,a]=r,o=Number.isNaN(+n)?n||0:+n;return e.containerQueries(a).up(o)}function la(e){const t=(o,s)=>o.replace("@media",s?`@container ${s}`:"@container");function r(o,s){o.up=(...c)=>t(e.breakpoints.up(...c),s),o.down=(...c)=>t(e.breakpoints.down(...c),s),o.between=(...c)=>t(e.breakpoints.between(...c),s),o.only=(...c)=>t(e.breakpoints.only(...c),s),o.not=(...c)=>{const u=t(e.breakpoints.not(...c),s);return u.includes("not all and")?u.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):u}}const n={},a=o=>(r(n,o),n);return r(a),{...e,containerQueries:a}}const ua={borderRadius:4};function ke(e,t){return t?K(e,t,{clone:!1}):e}const nt={xs:0,sm:600,md:900,lg:1200,xl:1536},Jt={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${nt[e]}px)`},fa={containerQueries:e=>({up:t=>{let r=typeof t=="number"?t:nt[t]||t;return typeof r=="number"&&(r=`${r}px`),e?`@container ${e} (min-width:${r})`:`@container (min-width:${r})`}})};function oe(e,t,r){const n=e.theme||{};if(Array.isArray(t)){const o=n.breakpoints||Jt;return t.reduce((s,c,u)=>(s[o.up(o.keys[u])]=r(t[u]),s),{})}if(typeof t=="object"){const o=n.breakpoints||Jt;return Object.keys(t).reduce((s,c)=>{if(sa(o.keys,c)){const u=ca(n.containerQueries?n:fa,c);u&&(s[u]=r(t[c],c))}else if(Object.keys(o.values||nt).includes(c)){const u=o.up(c);s[u]=r(t[c],c)}else{const u=c;s[u]=t[u]}return s},{})}return r(t)}function Or(e={}){var r;return((r=e.keys)==null?void 0:r.reduce((n,a)=>{const o=e.up(a);return n[o]={},n},{}))||{}}function Rr(e,t){return e.reduce((r,n)=>{const a=r[n];return(!a||Object.keys(a).length===0)&&delete r[n],r},t)}function Ti(e,...t){const r=Or(e),n=[r,...t].reduce((a,o)=>K(a,o),{});return Rr(Object.keys(r),n)}function da(e,t){if(typeof e!="object")return{};const r={},n=Object.keys(t);return Array.isArray(e)?n.forEach((a,o)=>{o<e.length&&(r[a]=!0)}):n.forEach(a=>{e[a]!=null&&(r[a]=!0)}),r}function $i({values:e,breakpoints:t,base:r}){const n=r||da(e,t),a=Object.keys(n);if(a.length===0)return e;let o;return a.reduce((s,c,u)=>(Array.isArray(e)?(s[c]=e[u]!=null?e[u]:e[o],o=u):typeof e=="object"?(s[c]=e[c]!=null?e[c]:e[o],o=c):s[c]=e,s),{})}function ge(e){if(typeof e!="string")throw new Error(se(7));return e.charAt(0).toUpperCase()+e.slice(1)}function at(e,t,r=!0){if(!t||typeof t!="string")return null;if(e&&e.vars&&r){const n=`vars.${t}`.split(".").reduce((a,o)=>a&&a[o]?a[o]:null,e);if(n!=null)return n}return t.split(".").reduce((n,a)=>n&&n[a]!=null?n[a]:null,e)}function De(e,t,r,n=r){let a;return typeof e=="function"?a=e(r):Array.isArray(e)?a=e[r]||n:a=at(e,r)||n,t&&(a=t(a,n,e)),a}function N(e){const{prop:t,cssProperty:r=e.prop,themeKey:n,transform:a}=e,o=s=>{if(s[t]==null)return null;const c=s[t],u=s.theme,f=at(u,n)||{};return oe(s,c,d=>{let m=De(f,a,d);return d===m&&typeof d=="string"&&(m=De(f,a,`${t}${d==="default"?"":ge(d)}`,d)),r===!1?m:{[r]:m}})};return o.propTypes={},o.filterProps=[t],o}function ma(e){const t={};return r=>(t[r]===void 0&&(t[r]=e(r)),t[r])}const pa={m:"margin",p:"padding"},ha={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},er={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},ga=ma(e=>{if(e.length>2)if(er[e])e=er[e];else return[e];const[t,r]=e.split(""),n=pa[t],a=ha[r]||"";return Array.isArray(a)?a.map(o=>n+o):[n+a]}),Rt=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],Bt=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"];[...Rt,...Bt];function Ee(e,t,r,n){const a=at(e,t,!0)??r;return typeof a=="number"||typeof a=="string"?o=>typeof o=="string"?o:typeof a=="string"?`calc(${o} * ${a})`:a*o:Array.isArray(a)?o=>{if(typeof o=="string")return o;const s=Math.abs(o),c=a[s];return o>=0?c:typeof c=="number"?-c:`-${c}`}:typeof a=="function"?a:()=>{}}function It(e){return Ee(e,"spacing",8)}function Oe(e,t){return typeof t=="string"||t==null?t:e(t)}function ya(e,t){return r=>e.reduce((n,a)=>(n[a]=Oe(t,r),n),{})}function ba(e,t,r,n){if(!t.includes(r))return null;const a=ga(r),o=ya(a,n),s=e[r];return oe(e,s,o)}function Br(e,t){const r=It(e.theme);return Object.keys(e).map(n=>ba(e,t,n,r)).reduce(ke,{})}function M(e){return Br(e,Rt)}M.propTypes={};M.filterProps=Rt;function L(e){return Br(e,Bt)}L.propTypes={};L.filterProps=Bt;function Ir(e=8,t=It({spacing:e})){if(e.mui)return e;const r=(...n)=>(n.length===0?[1]:n).map(o=>{const s=t(o);return typeof s=="number"?`${s}px`:s}).join(" ");return r.mui=!0,r}function ot(...e){const t=e.reduce((n,a)=>(a.filterProps.forEach(o=>{n[o]=a}),n),{}),r=n=>Object.keys(n).reduce((a,o)=>t[o]?ke(a,t[o](n)):a,{});return r.propTypes={},r.filterProps=e.reduce((n,a)=>n.concat(a.filterProps),[]),r}function q(e){return typeof e!="number"?e:`${e}px solid`}function Q(e,t){return N({prop:e,themeKey:"borders",transform:t})}const Sa=Q("border",q),va=Q("borderTop",q),Ca=Q("borderRight",q),xa=Q("borderBottom",q),wa=Q("borderLeft",q),ka=Q("borderColor"),Aa=Q("borderTopColor"),Ta=Q("borderRightColor"),$a=Q("borderBottomColor"),Pa=Q("borderLeftColor"),_a=Q("outline",q),Ea=Q("outlineColor"),it=e=>{if(e.borderRadius!==void 0&&e.borderRadius!==null){const t=Ee(e.theme,"shape.borderRadius",4),r=n=>({borderRadius:Oe(t,n)});return oe(e,e.borderRadius,r)}return null};it.propTypes={};it.filterProps=["borderRadius"];ot(Sa,va,Ca,xa,wa,ka,Aa,Ta,$a,Pa,it,_a,Ea);const st=e=>{if(e.gap!==void 0&&e.gap!==null){const t=Ee(e.theme,"spacing",8),r=n=>({gap:Oe(t,n)});return oe(e,e.gap,r)}return null};st.propTypes={};st.filterProps=["gap"];const ct=e=>{if(e.columnGap!==void 0&&e.columnGap!==null){const t=Ee(e.theme,"spacing",8),r=n=>({columnGap:Oe(t,n)});return oe(e,e.columnGap,r)}return null};ct.propTypes={};ct.filterProps=["columnGap"];const lt=e=>{if(e.rowGap!==void 0&&e.rowGap!==null){const t=Ee(e.theme,"spacing",8),r=n=>({rowGap:Oe(t,n)});return oe(e,e.rowGap,r)}return null};lt.propTypes={};lt.filterProps=["rowGap"];const Oa=N({prop:"gridColumn"}),Ra=N({prop:"gridRow"}),Ba=N({prop:"gridAutoFlow"}),Ia=N({prop:"gridAutoColumns"}),Fa=N({prop:"gridAutoRows"}),Ma=N({prop:"gridTemplateColumns"}),La=N({prop:"gridTemplateRows"}),Na=N({prop:"gridTemplateAreas"}),za=N({prop:"gridArea"});ot(st,ct,lt,Oa,Ra,Ba,Ia,Fa,Ma,La,Na,za);function pe(e,t){return t==="grey"?t:e}const ja=N({prop:"color",themeKey:"palette",transform:pe}),Da=N({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:pe}),Wa=N({prop:"backgroundColor",themeKey:"palette",transform:pe});ot(ja,Da,Wa);function U(e){return e<=1&&e!==0?`${e*100}%`:e}const Ga=N({prop:"width",transform:U}),Ft=e=>{if(e.maxWidth!==void 0&&e.maxWidth!==null){const t=r=>{var a,o,s,c,u;const n=((s=(o=(a=e.theme)==null?void 0:a.breakpoints)==null?void 0:o.values)==null?void 0:s[r])||nt[r];return n?((u=(c=e.theme)==null?void 0:c.breakpoints)==null?void 0:u.unit)!=="px"?{maxWidth:`${n}${e.theme.breakpoints.unit}`}:{maxWidth:n}:{maxWidth:U(r)}};return oe(e,e.maxWidth,t)}return null};Ft.filterProps=["maxWidth"];const Ha=N({prop:"minWidth",transform:U}),Ka=N({prop:"height",transform:U}),Va=N({prop:"maxHeight",transform:U}),Ua=N({prop:"minHeight",transform:U});N({prop:"size",cssProperty:"width",transform:U});N({prop:"size",cssProperty:"height",transform:U});const Ya=N({prop:"boxSizing"});ot(Ga,Ft,Ha,Ka,Va,Ua,Ya);const ut={border:{themeKey:"borders",transform:q},borderTop:{themeKey:"borders",transform:q},borderRight:{themeKey:"borders",transform:q},borderBottom:{themeKey:"borders",transform:q},borderLeft:{themeKey:"borders",transform:q},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:q},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:it},color:{themeKey:"palette",transform:pe},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:pe},backgroundColor:{themeKey:"palette",transform:pe},p:{style:L},pt:{style:L},pr:{style:L},pb:{style:L},pl:{style:L},px:{style:L},py:{style:L},padding:{style:L},paddingTop:{style:L},paddingRight:{style:L},paddingBottom:{style:L},paddingLeft:{style:L},paddingX:{style:L},paddingY:{style:L},paddingInline:{style:L},paddingInlineStart:{style:L},paddingInlineEnd:{style:L},paddingBlock:{style:L},paddingBlockStart:{style:L},paddingBlockEnd:{style:L},m:{style:M},mt:{style:M},mr:{style:M},mb:{style:M},ml:{style:M},mx:{style:M},my:{style:M},margin:{style:M},marginTop:{style:M},marginRight:{style:M},marginBottom:{style:M},marginLeft:{style:M},marginX:{style:M},marginY:{style:M},marginInline:{style:M},marginInlineStart:{style:M},marginInlineEnd:{style:M},marginBlock:{style:M},marginBlockStart:{style:M},marginBlockEnd:{style:M},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:st},rowGap:{style:lt},columnGap:{style:ct},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:U},maxWidth:{style:Ft},minWidth:{transform:U},height:{transform:U},maxHeight:{transform:U},minHeight:{transform:U},boxSizing:{},font:{themeKey:"font"},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function qa(...e){const t=e.reduce((n,a)=>n.concat(Object.keys(a)),[]),r=new Set(t);return e.every(n=>r.size===Object.keys(n).length)}function Xa(e,t){return typeof e=="function"?e(t):e}function Qa(){function e(r,n,a,o){const s={[r]:n,theme:a},c=o[r];if(!c)return{[r]:n};const{cssProperty:u=r,themeKey:f,transform:p,style:d}=c;if(n==null)return null;if(f==="typography"&&n==="inherit")return{[r]:n};const m=at(a,f)||{};return d?d(s):oe(s,n,g=>{let h=De(m,p,g);return g===h&&typeof g=="string"&&(h=De(m,p,`${r}${g==="default"?"":ge(g)}`,g)),u===!1?h:{[u]:h}})}function t(r){const{sx:n,theme:a={}}=r||{};if(!n)return null;const o=a.unstable_sxConfig??ut;function s(c){let u=c;if(typeof c=="function")u=c(a);else if(typeof c!="object")return c;if(!u)return null;const f=Or(a.breakpoints),p=Object.keys(f);let d=f;return Object.keys(u).forEach(m=>{const b=Xa(u[m],a);if(b!=null)if(typeof b=="object")if(o[m])d=ke(d,e(m,b,a,o));else{const g=oe({theme:a},b,h=>({[m]:h}));qa(g,b)?d[m]=t({sx:b,theme:a}):d=ke(d,g)}else d=ke(d,e(m,b,a,o))}),ia(a,Rr(p,d))}return Array.isArray(n)?n.map(s):s(n)}return t}const ye=Qa();ye.filterProps=["sx"];function Za(e,t){var n;const r=this;if(r.vars){if(!((n=r.colorSchemes)!=null&&n[e])||typeof r.getColorSchemeSelector!="function")return{};let a=r.getColorSchemeSelector(e);return a==="&"?t:((a.includes("data-")||a.includes("."))&&(a=`*:where(${a.replace(/\s*&$/,"")}) &`),{[a]:t})}return r.palette.mode===e?t:{}}function Fr(e={},...t){const{breakpoints:r={},palette:n={},spacing:a,shape:o={},...s}=e,c=oa(r),u=Ir(a);let f=K({breakpoints:c,direction:"ltr",components:{},palette:{mode:"light",...n},spacing:u,shape:{...ua,...o}},s);return f=la(f),f.applyStyles=Za,f=t.reduce((p,d)=>K(p,d),f),f.unstable_sxConfig={...ut,...s==null?void 0:s.unstable_sxConfig},f.unstable_sx=function(d){return ye({sx:d,theme:this})},f}function Ja(e){return Object.keys(e).length===0}function Pi(e=null){const t=I.useContext(_t);return!t||Ja(t)?e:t}const tr=e=>e,eo=()=>{let e=tr;return{configure(t){e=t},generate(t){return e(t)},reset(){e=tr}}},to=eo();function Mr(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=Mr(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ro(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=Mr(e))&&(n&&(n+=" "),n+=t);return n}const no={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function Lr(e,t,r="Mui"){const n=no[t];return n?`${r}-${n}`:`${to.generate(e)}-${t}`}function ao(e,t,r="Mui"){const n={};return t.forEach(a=>{n[a]=Lr(e,a,r)}),n}function Nr(e){const{variants:t,...r}=e,n={variants:t,style:Zt(r),isProcessed:!0};return n.style===r||t&&t.forEach(a=>{typeof a.style!="function"&&(a.style=Zt(a.style))}),n}const oo=Fr();function mt(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function io(e){return e?(t,r)=>r[e]:null}function so(e,t,r){e.theme=uo(e.theme)?r:e.theme[t]||e.theme}function Ne(e,t){const r=typeof t=="function"?t(e):t;if(Array.isArray(r))return r.flatMap(n=>Ne(e,n));if(Array.isArray(r==null?void 0:r.variants)){let n;if(r.isProcessed)n=r.style;else{const{variants:a,...o}=r;n=o}return zr(e,r.variants,[n])}return r!=null&&r.isProcessed?r.style:r}function zr(e,t,r=[]){var a;let n;e:for(let o=0;o<t.length;o+=1){const s=t[o];if(typeof s.props=="function"){if(n??={...e,...e.ownerState,ownerState:e.ownerState},!s.props(n))continue}else for(const c in s.props)if(e[c]!==s.props[c]&&((a=e.ownerState)==null?void 0:a[c])!==s.props[c])continue e;typeof s.style=="function"?(n??={...e,...e.ownerState,ownerState:e.ownerState},r.push(s.style(n))):r.push(s.style)}return r}function co(e={}){const{themeId:t,defaultTheme:r=oo,rootShouldForwardProp:n=mt,slotShouldForwardProp:a=mt}=e;function o(c){so(c,t,r)}return(c,u={})=>{ta(c,k=>k.filter(A=>A!==ye));const{name:f,slot:p,skipVariantsResolver:d,skipSx:m,overridesResolver:b=io(mo(p)),...g}=u,h=d!==void 0?d:p&&p!=="Root"&&p!=="root"||!1,v=m||!1;let S=mt;p==="Root"||p==="root"?S=n:p?S=a:fo(c)&&(S=void 0);const $=ea(c,{shouldForwardProp:S,label:lo(),...g}),w=k=>{if(k.__emotion_real===k)return k;if(typeof k=="function")return function(x){return Ne(x,k)};if(ae(k)){const A=Nr(k);return A.variants?function(D){return Ne(D,A)}:A.style}return k},C=(...k)=>{const A=[],x=k.map(w),D=[];if(A.push(o),f&&b&&D.push(function(T){var Se,jt;const G=(jt=(Se=T.theme.components)==null?void 0:Se[f])==null?void 0:jt.styleOverrides;if(!G)return null;const Z={};for(const Dt in G)Z[Dt]=Ne(T,G[Dt]);return b(T,Z)}),f&&!h&&D.push(function(T){var Z,Se;const B=T.theme,G=(Se=(Z=B==null?void 0:B.components)==null?void 0:Z[f])==null?void 0:Se.variants;return G?zr(T,G):null}),v||D.push(ye),Array.isArray(x[0])){const y=x.shift(),T=new Array(A.length).fill(""),B=new Array(D.length).fill("");let G;G=[...T,...y,...B],G.raw=[...T,...y.raw,...B],A.unshift(G)}const H=[...A,...x,...D],i=$(...H);return c.muiName&&(i.muiName=c.muiName),i};return $.withConfig&&(C.withConfig=$.withConfig),C}}function lo(e,t){return void 0}function uo(e){for(const t in e)return!1;return!0}function fo(e){return typeof e=="string"&&e.charCodeAt(0)>96}function mo(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}function Ct(e,t){const r={...t};for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const a=n;if(a==="components"||a==="slots")r[a]={...e[a],...r[a]};else if(a==="componentsProps"||a==="slotProps"){const o=e[a],s=t[a];if(!s)r[a]=o||{};else if(!o)r[a]=s;else{r[a]={...s};for(const c in o)if(Object.prototype.hasOwnProperty.call(o,c)){const u=c;r[a][u]=Ct(o[u],s[u])}}}else r[a]===void 0&&(r[a]=e[a])}return r}function po(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}function Mt(e,t=0,r=1){return po(e,t,r)}function ho(e){e=e.slice(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let r=e.match(t);return r&&r[0].length===1&&(r=r.map(n=>n+n)),r?`rgb${r.length===4?"a":""}(${r.map((n,a)=>a<3?parseInt(n,16):Math.round(parseInt(n,16)/255*1e3)/1e3).join(", ")})`:""}function go(e){const t=e.toString(16);return t.length===1?`0${t}`:t}function ie(e){if(e.type)return e;if(e.charAt(0)==="#")return ie(ho(e));const t=e.indexOf("("),r=e.substring(0,t);if(!["rgb","rgba","hsl","hsla","color"].includes(r))throw new Error(se(9,e));let n=e.substring(t+1,e.length-1),a;if(r==="color"){if(n=n.split(" "),a=n.shift(),n.length===4&&n[3].charAt(0)==="/"&&(n[3]=n[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(a))throw new Error(se(10,a))}else n=n.split(",");return n=n.map(o=>parseFloat(o)),{type:r,values:n,colorSpace:a}}const yo=e=>{const t=ie(e);return t.values.slice(0,3).map((r,n)=>t.type.includes("hsl")&&n!==0?`${r}%`:r).join(" ")},xe=(e,t)=>{try{return yo(e)}catch{return e}};function ft(e){const{type:t,colorSpace:r}=e;let{values:n}=e;return t.includes("rgb")?n=n.map((a,o)=>o<3?parseInt(a,10):a):t.includes("hsl")&&(n[1]=`${n[1]}%`,n[2]=`${n[2]}%`),t.includes("color")?n=`${r} ${n.join(" ")}`:n=`${n.join(", ")}`,`${t}(${n})`}function _i(e){if(e.startsWith("#"))return e;const{values:t}=ie(e);return`#${t.map((r,n)=>go(n===3?Math.round(255*r):r)).join("")}`}function jr(e){e=ie(e);const{values:t}=e,r=t[0],n=t[1]/100,a=t[2]/100,o=n*Math.min(a,1-a),s=(f,p=(f+r/30)%12)=>a-o*Math.max(Math.min(p-3,9-p,1),-1);let c="rgb";const u=[Math.round(s(0)*255),Math.round(s(8)*255),Math.round(s(4)*255)];return e.type==="hsla"&&(c+="a",u.push(t[3])),ft({type:c,values:u})}function xt(e){e=ie(e);let t=e.type==="hsl"||e.type==="hsla"?ie(jr(e)).values:e.values;return t=t.map(r=>(e.type!=="color"&&(r/=255),r<=.03928?r/12.92:((r+.055)/1.055)**2.4)),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function bo(e,t){const r=xt(e),n=xt(t);return(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}function So(e,t){return e=ie(e),t=Mt(t),(e.type==="rgb"||e.type==="hsl")&&(e.type+="a"),e.type==="color"?e.values[3]=`/${t}`:e.values[3]=t,ft(e)}function Be(e,t,r){try{return So(e,t)}catch{return e}}function Lt(e,t){if(e=ie(e),t=Mt(t),e.type.includes("hsl"))e.values[2]*=1-t;else if(e.type.includes("rgb")||e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]*=1-t;return ft(e)}function E(e,t,r){try{return Lt(e,t)}catch{return e}}function Nt(e,t){if(e=ie(e),t=Mt(t),e.type.includes("hsl"))e.values[2]+=(100-e.values[2])*t;else if(e.type.includes("rgb"))for(let r=0;r<3;r+=1)e.values[r]+=(255-e.values[r])*t;else if(e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]+=(1-e.values[r])*t;return ft(e)}function O(e,t,r){try{return Nt(e,t)}catch{return e}}function vo(e,t=.15){return xt(e)>.5?Lt(e,t):Nt(e,t)}function Ie(e,t,r){try{return vo(e,t)}catch{return e}}function Co(e,t,r=void 0){const n={};for(const a in e){const o=e[a];let s="",c=!0;for(let u=0;u<o.length;u+=1){const f=o[u];f&&(s+=(c===!0?"":" ")+t(f),c=!1,r&&r[f]&&(s+=" "+r[f]))}n[a]=s}return n}const Dr=I.createContext(void 0);function Ei({value:e,children:t}){return ze.jsx(Dr.Provider,{value:e,children:t})}function xo(e){const{theme:t,name:r,props:n}=e;if(!t||!t.components||!t.components[r])return n;const a=t.components[r];return a.defaultProps?Ct(a.defaultProps,n):!a.styleOverrides&&!a.variants?Ct(a,n):n}function wo({props:e,name:t}){const r=I.useContext(Dr);return xo({props:e,name:t,theme:{components:r}})}const rr={theme:void 0};function ko(e){let t,r;return function(a){let o=t;return(o===void 0||a.theme!==r)&&(rr.theme=a.theme,o=Nr(e(rr)),t=o,r=a.theme),o}}function Ao(e=""){function t(...n){if(!n.length)return"";const a=n[0];return typeof a=="string"&&!a.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)?`, var(--${e?`${e}-`:""}${a}${t(...n.slice(1))})`:`, ${a}`}return(n,...a)=>`var(--${e?`${e}-`:""}${n}${t(...a)})`}const nr=(e,t,r,n=[])=>{let a=e;t.forEach((o,s)=>{s===t.length-1?Array.isArray(a)?a[Number(o)]=r:a&&typeof a=="object"&&(a[o]=r):a&&typeof a=="object"&&(a[o]||(a[o]=n.includes(o)?[]:{}),a=a[o])})},To=(e,t,r)=>{function n(a,o=[],s=[]){Object.entries(a).forEach(([c,u])=>{(!r||r&&!r([...o,c]))&&u!=null&&(typeof u=="object"&&Object.keys(u).length>0?n(u,[...o,c],Array.isArray(u)?[...s,c]:s):t([...o,c],u,s))})}n(e)},$o=(e,t)=>typeof t=="number"?["lineHeight","fontWeight","opacity","zIndex"].some(n=>e.includes(n))||e[e.length-1].toLowerCase().includes("opacity")?t:`${t}px`:t;function pt(e,t){const{prefix:r,shouldSkipGeneratingVar:n}=t||{},a={},o={},s={};return To(e,(c,u,f)=>{if((typeof u=="string"||typeof u=="number")&&(!n||!n(c,u))){const p=`--${r?`${r}-`:""}${c.join("-")}`,d=$o(c,u);Object.assign(a,{[p]:d}),nr(o,c,`var(${p})`,f),nr(s,c,`var(${p}, ${d})`,f)}},c=>c[0]==="vars"),{css:a,vars:o,varsWithDefaults:s}}function Po(e,t={}){const{getSelector:r=v,disableCssColorScheme:n,colorSchemeSelector:a}=t,{colorSchemes:o={},components:s,defaultColorScheme:c="light",...u}=e,{vars:f,css:p,varsWithDefaults:d}=pt(u,t);let m=d;const b={},{[c]:g,...h}=o;if(Object.entries(h||{}).forEach(([w,C])=>{const{vars:k,css:A,varsWithDefaults:x}=pt(C,t);m=K(m,x),b[w]={css:A,vars:k}}),g){const{css:w,vars:C,varsWithDefaults:k}=pt(g,t);m=K(m,k),b[c]={css:w,vars:C}}function v(w,C){var A,x;let k=a;if(a==="class"&&(k=".%s"),a==="data"&&(k="[data-%s]"),a!=null&&a.startsWith("data-")&&!a.includes("%s")&&(k=`[${a}="%s"]`),w){if(k==="media")return e.defaultColorScheme===w?":root":{[`@media (prefers-color-scheme: ${((x=(A=o[w])==null?void 0:A.palette)==null?void 0:x.mode)||w})`]:{":root":C}};if(k)return e.defaultColorScheme===w?`:root, ${k.replace("%s",String(w))}`:k.replace("%s",String(w))}return":root"}return{vars:m,generateThemeVars:()=>{let w={...f};return Object.entries(b).forEach(([,{vars:C}])=>{w=K(w,C)}),w},generateStyleSheets:()=>{var D,H;const w=[],C=e.defaultColorScheme||"light";function k(i,y){Object.keys(y).length&&w.push(typeof i=="string"?{[i]:{...y}}:i)}k(r(void 0,{...p}),p);const{[C]:A,...x}=b;if(A){const{css:i}=A,y=(H=(D=o[C])==null?void 0:D.palette)==null?void 0:H.mode,T=!n&&y?{colorScheme:y,...i}:{...i};k(r(C,{...T}),T)}return Object.entries(x).forEach(([i,{css:y}])=>{var G,Z;const T=(Z=(G=o[i])==null?void 0:G.palette)==null?void 0:Z.mode,B=!n&&T?{colorScheme:T,...y}:{...y};k(r(i,{...B}),B)}),w}}}function _o(e){return function(r){return e==="media"?`@media (prefers-color-scheme: ${r})`:e?e.startsWith("data-")&&!e.includes("%s")?`[${e}="${r}"] &`:e==="class"?`.${r} &`:e==="data"?`[data-${r}] &`:`${e.replace("%s",r)} &`:"&"}}const Pe={black:"#000",white:"#fff"},Eo={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},ce={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"},le={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},Ce={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"},ue={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},fe={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"},de={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"};function Wr(){return{text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:Pe.white,default:Pe.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}}}const Oo=Wr();function Gr(){return{text:{primary:Pe.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:Pe.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}}}const ar=Gr();function or(e,t,r,n){const a=n.light||n,o=n.dark||n*1.5;e[t]||(e.hasOwnProperty(r)?e[t]=e[r]:t==="light"?e.light=Nt(e.main,a):t==="dark"&&(e.dark=Lt(e.main,o)))}function Ro(e="light"){return e==="dark"?{main:ue[200],light:ue[50],dark:ue[400]}:{main:ue[700],light:ue[400],dark:ue[800]}}function Bo(e="light"){return e==="dark"?{main:ce[200],light:ce[50],dark:ce[400]}:{main:ce[500],light:ce[300],dark:ce[700]}}function Io(e="light"){return e==="dark"?{main:le[500],light:le[300],dark:le[700]}:{main:le[700],light:le[400],dark:le[800]}}function Fo(e="light"){return e==="dark"?{main:fe[400],light:fe[300],dark:fe[700]}:{main:fe[700],light:fe[500],dark:fe[900]}}function Mo(e="light"){return e==="dark"?{main:de[400],light:de[300],dark:de[700]}:{main:de[800],light:de[500],dark:de[900]}}function Lo(e="light"){return e==="dark"?{main:Ce[400],light:Ce[300],dark:Ce[700]}:{main:"#ed6c02",light:Ce[500],dark:Ce[900]}}function zt(e){const{mode:t="light",contrastThreshold:r=3,tonalOffset:n=.2,...a}=e,o=e.primary||Ro(t),s=e.secondary||Bo(t),c=e.error||Io(t),u=e.info||Fo(t),f=e.success||Mo(t),p=e.warning||Lo(t);function d(h){return bo(h,ar.text.primary)>=r?ar.text.primary:Oo.text.primary}const m=({color:h,name:v,mainShade:S=500,lightShade:$=300,darkShade:w=700})=>{if(h={...h},!h.main&&h[S]&&(h.main=h[S]),!h.hasOwnProperty("main"))throw new Error(se(11,v?` (${v})`:"",S));if(typeof h.main!="string")throw new Error(se(12,v?` (${v})`:"",JSON.stringify(h.main)));return or(h,"light",$,n),or(h,"dark",w,n),h.contrastText||(h.contrastText=d(h.main)),h};let b;return t==="light"?b=Wr():t==="dark"&&(b=Gr()),K({common:{...Pe},mode:t,primary:m({color:o,name:"primary"}),secondary:m({color:s,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:m({color:c,name:"error"}),warning:m({color:p,name:"warning"}),info:m({color:u,name:"info"}),success:m({color:f,name:"success"}),grey:Eo,contrastThreshold:r,getContrastText:d,augmentColor:m,tonalOffset:n,...b},a)}function No(e){const t={};return Object.entries(e).forEach(n=>{const[a,o]=n;typeof o=="object"&&(t[a]=`${o.fontStyle?`${o.fontStyle} `:""}${o.fontVariant?`${o.fontVariant} `:""}${o.fontWeight?`${o.fontWeight} `:""}${o.fontStretch?`${o.fontStretch} `:""}${o.fontSize||""}${o.lineHeight?`/${o.lineHeight} `:""}${o.fontFamily||""}`)}),t}function zo(e,t){return{toolbar:{minHeight:56,[e.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[e.up("sm")]:{minHeight:64}},...t}}function jo(e){return Math.round(e*1e5)/1e5}const ir={textTransform:"uppercase"},sr='"Roboto", "Helvetica", "Arial", sans-serif';function Do(e,t){const{fontFamily:r=sr,fontSize:n=14,fontWeightLight:a=300,fontWeightRegular:o=400,fontWeightMedium:s=500,fontWeightBold:c=700,htmlFontSize:u=16,allVariants:f,pxToRem:p,...d}=typeof t=="function"?t(e):t,m=n/14,b=p||(v=>`${v/u*m}rem`),g=(v,S,$,w,C)=>({fontFamily:r,fontWeight:v,fontSize:b(S),lineHeight:$,...r===sr?{letterSpacing:`${jo(w/S)}em`}:{},...C,...f}),h={h1:g(a,96,1.167,-1.5),h2:g(a,60,1.2,-.5),h3:g(o,48,1.167,0),h4:g(o,34,1.235,.25),h5:g(o,24,1.334,0),h6:g(s,20,1.6,.15),subtitle1:g(o,16,1.75,.15),subtitle2:g(s,14,1.57,.1),body1:g(o,16,1.5,.15),body2:g(o,14,1.43,.15),button:g(s,14,1.75,.4,ir),caption:g(o,12,1.66,.4),overline:g(o,12,2.66,1,ir),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return K({htmlFontSize:u,pxToRem:b,fontFamily:r,fontSize:n,fontWeightLight:a,fontWeightRegular:o,fontWeightMedium:s,fontWeightBold:c,...h},d,{clone:!1})}const Wo=.2,Go=.14,Ho=.12;function F(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${Wo})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${Go})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${Ho})`].join(",")}const Ko=["none",F(0,2,1,-1,0,1,1,0,0,1,3,0),F(0,3,1,-2,0,2,2,0,0,1,5,0),F(0,3,3,-2,0,3,4,0,0,1,8,0),F(0,2,4,-1,0,4,5,0,0,1,10,0),F(0,3,5,-1,0,5,8,0,0,1,14,0),F(0,3,5,-1,0,6,10,0,0,1,18,0),F(0,4,5,-2,0,7,10,1,0,2,16,1),F(0,5,5,-3,0,8,10,1,0,3,14,2),F(0,5,6,-3,0,9,12,1,0,3,16,2),F(0,6,6,-3,0,10,14,1,0,4,18,3),F(0,6,7,-4,0,11,15,1,0,4,20,3),F(0,7,8,-4,0,12,17,2,0,5,22,4),F(0,7,8,-4,0,13,19,2,0,5,24,4),F(0,7,9,-4,0,14,21,2,0,5,26,4),F(0,8,9,-5,0,15,22,2,0,6,28,5),F(0,8,10,-5,0,16,24,2,0,6,30,5),F(0,8,11,-5,0,17,26,2,0,6,32,5),F(0,9,11,-5,0,18,28,2,0,7,34,6),F(0,9,12,-6,0,19,29,2,0,7,36,6),F(0,10,13,-6,0,20,31,3,0,8,38,7),F(0,10,13,-6,0,21,33,3,0,8,40,7),F(0,10,14,-6,0,22,35,3,0,8,42,7),F(0,11,14,-7,0,23,36,3,0,9,44,8),F(0,11,15,-7,0,24,38,3,0,9,46,8)],Vo={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},Uo={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function cr(e){return`${Math.round(e)}ms`}function Yo(e){if(!e)return 0;const t=e/36;return Math.min(Math.round((4+15*t**.25+t/5)*10),3e3)}function qo(e){const t={...Vo,...e.easing},r={...Uo,...e.duration};return{getAutoHeightDuration:Yo,create:(a=["all"],o={})=>{const{duration:s=r.standard,easing:c=t.easeInOut,delay:u=0,...f}=o;return(Array.isArray(a)?a:[a]).map(p=>`${p} ${typeof s=="string"?s:cr(s)} ${c} ${typeof u=="string"?u:cr(u)}`).join(",")},...e,easing:t,duration:r}}const Xo={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function Qo(e){return ae(e)||typeof e>"u"||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||Array.isArray(e)}function Hr(e={}){const t={...e};function r(n){const a=Object.entries(n);for(let o=0;o<a.length;o++){const[s,c]=a[o];!Qo(c)||s.startsWith("unstable_")?delete n[s]:ae(c)&&(n[s]={...c},r(n[s]))}}return r(t),`import { unstable_createBreakpoints as createBreakpoints, createTransitions } from '@mui/material/styles';
|
|
24
|
-
|
|
25
|
-
const theme = ${JSON.stringify(t,null,2)};
|
|
26
|
-
|
|
27
|
-
theme.breakpoints = createBreakpoints(theme.breakpoints || {});
|
|
28
|
-
theme.transitions = createTransitions(theme.transitions || {});
|
|
29
|
-
|
|
30
|
-
export default theme;`}function We(e={},...t){const{breakpoints:r,mixins:n={},spacing:a,palette:o={},transitions:s={},typography:c={},shape:u,...f}=e;if(e.vars&&e.generateThemeVars===void 0)throw new Error(se(20));const p=zt(o),d=Fr(e);let m=K(d,{mixins:zo(d.breakpoints,n),palette:p,shadows:Ko.slice(),typography:Do(p,c),transitions:qo(s),zIndex:{...Xo}});return m=K(m,f),m=t.reduce((b,g)=>K(b,g),m),m.unstable_sxConfig={...ut,...f==null?void 0:f.unstable_sxConfig},m.unstable_sx=function(g){return ye({sx:g,theme:this})},m.toRuntimeSource=Hr,m}function Oi(...e){return We(...e)}function Zo(e){let t;return e<1?t=5.11916*e**2:t=4.5*Math.log(e+1)+2,Math.round(t*10)/1e3}const Jo=[...Array(25)].map((e,t)=>{if(t===0)return"none";const r=Zo(t);return`linear-gradient(rgba(255 255 255 / ${r}), rgba(255 255 255 / ${r}))`});function Kr(e){return{inputPlaceholder:e==="dark"?.5:.42,inputUnderline:e==="dark"?.7:.42,switchTrackDisabled:e==="dark"?.2:.12,switchTrack:e==="dark"?.3:.38}}function Vr(e){return e==="dark"?Jo:[]}function ei(e){const{palette:t={mode:"light"},opacity:r,overlays:n,...a}=e,o=zt(t);return{palette:o,opacity:{...Kr(o.mode),...r},overlays:n||Vr(o.mode),...a}}function ti(e){var t;return!!e[0].match(/(cssVarPrefix|colorSchemeSelector|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!e[0].match(/sxConfig$/)||e[0]==="palette"&&!!((t=e[1])!=null&&t.match(/(mode|contrastThreshold|tonalOffset)/))}const ri=e=>[...[...Array(25)].map((t,r)=>`--${e?`${e}-`:""}overlays-${r}`),`--${e?`${e}-`:""}palette-AppBar-darkBg`,`--${e?`${e}-`:""}palette-AppBar-darkColor`],ni=e=>(t,r)=>{const n=e.rootSelector||":root",a=e.colorSchemeSelector;let o=a;if(a==="class"&&(o=".%s"),a==="data"&&(o="[data-%s]"),a!=null&&a.startsWith("data-")&&!a.includes("%s")&&(o=`[${a}="%s"]`),e.defaultColorScheme===t){if(t==="dark"){const s={};return ri(e.cssVarPrefix).forEach(c=>{s[c]=r[c],delete r[c]}),o==="media"?{[n]:r,"@media (prefers-color-scheme: dark)":{[n]:s}}:o?{[o.replace("%s",t)]:s,[`${n}, ${o.replace("%s",t)}`]:r}:{[n]:{...r,...s}}}if(o&&o!=="media")return`${n}, ${o.replace("%s",String(t))}`}else if(t){if(o==="media")return{[`@media (prefers-color-scheme: ${String(t)})`]:{[n]:r}};if(o)return o.replace("%s",String(t))}return n};function ai(e,t){t.forEach(r=>{e[r]||(e[r]={})})}function l(e,t,r){!e[t]&&r&&(e[t]=r)}function we(e){return typeof e!="string"||!e.startsWith("hsl")?e:jr(e)}function ne(e,t){`${t}Channel`in e||(e[`${t}Channel`]=xe(we(e[t])))}function oi(e){return typeof e=="number"?`${e}px`:typeof e=="string"||typeof e=="function"||Array.isArray(e)?e:"8px"}const J=e=>{try{return e()}catch{}},ii=(e="mui")=>Ao(e);function ht(e,t,r,n){if(!t)return;t=t===!0?{}:t;const a=n==="dark"?"dark":"light";if(!r){e[n]=ei({...t,palette:{mode:a,...t==null?void 0:t.palette}});return}const{palette:o,...s}=We({...r,palette:{mode:a,...t==null?void 0:t.palette}});return e[n]={...t,palette:o,opacity:{...Kr(a),...t==null?void 0:t.opacity},overlays:(t==null?void 0:t.overlays)||Vr(a)},s}function si(e={},...t){const{colorSchemes:r={light:!0},defaultColorScheme:n,disableCssColorScheme:a=!1,cssVarPrefix:o="mui",shouldSkipGeneratingVar:s=ti,colorSchemeSelector:c=r.light&&r.dark?"media":void 0,rootSelector:u=":root",...f}=e,p=Object.keys(r)[0],d=n||(r.light&&p!=="light"?"light":p),m=ii(o),{[d]:b,light:g,dark:h,...v}=r,S={...v};let $=b;if((d==="dark"&&!("dark"in r)||d==="light"&&!("light"in r))&&($=!0),!$)throw new Error(se(21,d));const w=ht(S,$,f,d);g&&!S.light&&ht(S,g,void 0,"light"),h&&!S.dark&&ht(S,h,void 0,"dark");let C={defaultColorScheme:d,...w,cssVarPrefix:o,colorSchemeSelector:c,rootSelector:u,getCssVar:m,colorSchemes:S,font:{...No(w.typography),...w.font},spacing:oi(f.spacing)};Object.keys(C.colorSchemes).forEach(H=>{const i=C.colorSchemes[H].palette,y=T=>{const B=T.split("-"),G=B[1],Z=B[2];return m(T,i[G][Z])};if(i.mode==="light"&&(l(i.common,"background","#fff"),l(i.common,"onBackground","#000")),i.mode==="dark"&&(l(i.common,"background","#000"),l(i.common,"onBackground","#fff")),ai(i,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),i.mode==="light"){l(i.Alert,"errorColor",E(i.error.light,.6)),l(i.Alert,"infoColor",E(i.info.light,.6)),l(i.Alert,"successColor",E(i.success.light,.6)),l(i.Alert,"warningColor",E(i.warning.light,.6)),l(i.Alert,"errorFilledBg",y("palette-error-main")),l(i.Alert,"infoFilledBg",y("palette-info-main")),l(i.Alert,"successFilledBg",y("palette-success-main")),l(i.Alert,"warningFilledBg",y("palette-warning-main")),l(i.Alert,"errorFilledColor",J(()=>i.getContrastText(i.error.main))),l(i.Alert,"infoFilledColor",J(()=>i.getContrastText(i.info.main))),l(i.Alert,"successFilledColor",J(()=>i.getContrastText(i.success.main))),l(i.Alert,"warningFilledColor",J(()=>i.getContrastText(i.warning.main))),l(i.Alert,"errorStandardBg",O(i.error.light,.9)),l(i.Alert,"infoStandardBg",O(i.info.light,.9)),l(i.Alert,"successStandardBg",O(i.success.light,.9)),l(i.Alert,"warningStandardBg",O(i.warning.light,.9)),l(i.Alert,"errorIconColor",y("palette-error-main")),l(i.Alert,"infoIconColor",y("palette-info-main")),l(i.Alert,"successIconColor",y("palette-success-main")),l(i.Alert,"warningIconColor",y("palette-warning-main")),l(i.AppBar,"defaultBg",y("palette-grey-100")),l(i.Avatar,"defaultBg",y("palette-grey-400")),l(i.Button,"inheritContainedBg",y("palette-grey-300")),l(i.Button,"inheritContainedHoverBg",y("palette-grey-A100")),l(i.Chip,"defaultBorder",y("palette-grey-400")),l(i.Chip,"defaultAvatarColor",y("palette-grey-700")),l(i.Chip,"defaultIconColor",y("palette-grey-700")),l(i.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),l(i.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),l(i.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),l(i.LinearProgress,"primaryBg",O(i.primary.main,.62)),l(i.LinearProgress,"secondaryBg",O(i.secondary.main,.62)),l(i.LinearProgress,"errorBg",O(i.error.main,.62)),l(i.LinearProgress,"infoBg",O(i.info.main,.62)),l(i.LinearProgress,"successBg",O(i.success.main,.62)),l(i.LinearProgress,"warningBg",O(i.warning.main,.62)),l(i.Skeleton,"bg",`rgba(${y("palette-text-primaryChannel")} / 0.11)`),l(i.Slider,"primaryTrack",O(i.primary.main,.62)),l(i.Slider,"secondaryTrack",O(i.secondary.main,.62)),l(i.Slider,"errorTrack",O(i.error.main,.62)),l(i.Slider,"infoTrack",O(i.info.main,.62)),l(i.Slider,"successTrack",O(i.success.main,.62)),l(i.Slider,"warningTrack",O(i.warning.main,.62));const T=Ie(i.background.default,.8);l(i.SnackbarContent,"bg",T),l(i.SnackbarContent,"color",J(()=>i.getContrastText(T))),l(i.SpeedDialAction,"fabHoverBg",Ie(i.background.paper,.15)),l(i.StepConnector,"border",y("palette-grey-400")),l(i.StepContent,"border",y("palette-grey-400")),l(i.Switch,"defaultColor",y("palette-common-white")),l(i.Switch,"defaultDisabledColor",y("palette-grey-100")),l(i.Switch,"primaryDisabledColor",O(i.primary.main,.62)),l(i.Switch,"secondaryDisabledColor",O(i.secondary.main,.62)),l(i.Switch,"errorDisabledColor",O(i.error.main,.62)),l(i.Switch,"infoDisabledColor",O(i.info.main,.62)),l(i.Switch,"successDisabledColor",O(i.success.main,.62)),l(i.Switch,"warningDisabledColor",O(i.warning.main,.62)),l(i.TableCell,"border",O(Be(i.divider,1),.88)),l(i.Tooltip,"bg",Be(i.grey[700],.92))}if(i.mode==="dark"){l(i.Alert,"errorColor",O(i.error.light,.6)),l(i.Alert,"infoColor",O(i.info.light,.6)),l(i.Alert,"successColor",O(i.success.light,.6)),l(i.Alert,"warningColor",O(i.warning.light,.6)),l(i.Alert,"errorFilledBg",y("palette-error-dark")),l(i.Alert,"infoFilledBg",y("palette-info-dark")),l(i.Alert,"successFilledBg",y("palette-success-dark")),l(i.Alert,"warningFilledBg",y("palette-warning-dark")),l(i.Alert,"errorFilledColor",J(()=>i.getContrastText(i.error.dark))),l(i.Alert,"infoFilledColor",J(()=>i.getContrastText(i.info.dark))),l(i.Alert,"successFilledColor",J(()=>i.getContrastText(i.success.dark))),l(i.Alert,"warningFilledColor",J(()=>i.getContrastText(i.warning.dark))),l(i.Alert,"errorStandardBg",E(i.error.light,.9)),l(i.Alert,"infoStandardBg",E(i.info.light,.9)),l(i.Alert,"successStandardBg",E(i.success.light,.9)),l(i.Alert,"warningStandardBg",E(i.warning.light,.9)),l(i.Alert,"errorIconColor",y("palette-error-main")),l(i.Alert,"infoIconColor",y("palette-info-main")),l(i.Alert,"successIconColor",y("palette-success-main")),l(i.Alert,"warningIconColor",y("palette-warning-main")),l(i.AppBar,"defaultBg",y("palette-grey-900")),l(i.AppBar,"darkBg",y("palette-background-paper")),l(i.AppBar,"darkColor",y("palette-text-primary")),l(i.Avatar,"defaultBg",y("palette-grey-600")),l(i.Button,"inheritContainedBg",y("palette-grey-800")),l(i.Button,"inheritContainedHoverBg",y("palette-grey-700")),l(i.Chip,"defaultBorder",y("palette-grey-700")),l(i.Chip,"defaultAvatarColor",y("palette-grey-300")),l(i.Chip,"defaultIconColor",y("palette-grey-300")),l(i.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),l(i.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),l(i.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),l(i.LinearProgress,"primaryBg",E(i.primary.main,.5)),l(i.LinearProgress,"secondaryBg",E(i.secondary.main,.5)),l(i.LinearProgress,"errorBg",E(i.error.main,.5)),l(i.LinearProgress,"infoBg",E(i.info.main,.5)),l(i.LinearProgress,"successBg",E(i.success.main,.5)),l(i.LinearProgress,"warningBg",E(i.warning.main,.5)),l(i.Skeleton,"bg",`rgba(${y("palette-text-primaryChannel")} / 0.13)`),l(i.Slider,"primaryTrack",E(i.primary.main,.5)),l(i.Slider,"secondaryTrack",E(i.secondary.main,.5)),l(i.Slider,"errorTrack",E(i.error.main,.5)),l(i.Slider,"infoTrack",E(i.info.main,.5)),l(i.Slider,"successTrack",E(i.success.main,.5)),l(i.Slider,"warningTrack",E(i.warning.main,.5));const T=Ie(i.background.default,.98);l(i.SnackbarContent,"bg",T),l(i.SnackbarContent,"color",J(()=>i.getContrastText(T))),l(i.SpeedDialAction,"fabHoverBg",Ie(i.background.paper,.15)),l(i.StepConnector,"border",y("palette-grey-600")),l(i.StepContent,"border",y("palette-grey-600")),l(i.Switch,"defaultColor",y("palette-grey-300")),l(i.Switch,"defaultDisabledColor",y("palette-grey-600")),l(i.Switch,"primaryDisabledColor",E(i.primary.main,.55)),l(i.Switch,"secondaryDisabledColor",E(i.secondary.main,.55)),l(i.Switch,"errorDisabledColor",E(i.error.main,.55)),l(i.Switch,"infoDisabledColor",E(i.info.main,.55)),l(i.Switch,"successDisabledColor",E(i.success.main,.55)),l(i.Switch,"warningDisabledColor",E(i.warning.main,.55)),l(i.TableCell,"border",E(Be(i.divider,1),.68)),l(i.Tooltip,"bg",Be(i.grey[700],.92))}ne(i.background,"default"),ne(i.background,"paper"),ne(i.common,"background"),ne(i.common,"onBackground"),ne(i,"divider"),Object.keys(i).forEach(T=>{const B=i[T];T!=="tonalOffset"&&B&&typeof B=="object"&&(B.main&&l(i[T],"mainChannel",xe(we(B.main))),B.light&&l(i[T],"lightChannel",xe(we(B.light))),B.dark&&l(i[T],"darkChannel",xe(we(B.dark))),B.contrastText&&l(i[T],"contrastTextChannel",xe(we(B.contrastText))),T==="text"&&(ne(i[T],"primary"),ne(i[T],"secondary")),T==="action"&&(B.active&&ne(i[T],"active"),B.selected&&ne(i[T],"selected")))})}),C=t.reduce((H,i)=>K(H,i),C);const k={prefix:o,disableCssColorScheme:a,shouldSkipGeneratingVar:s,getSelector:ni(C)},{vars:A,generateThemeVars:x,generateStyleSheets:D}=Po(C,k);return C.vars=A,Object.entries(C.colorSchemes[C.defaultColorScheme]).forEach(([H,i])=>{C[H]=i}),C.generateThemeVars=x,C.generateStyleSheets=D,C.generateSpacing=function(){return Ir(f.spacing,It(this))},C.getColorSchemeSelector=_o(c),C.spacing=C.generateSpacing(),C.shouldSkipGeneratingVar=s,C.unstable_sxConfig={...ut,...f==null?void 0:f.unstable_sxConfig},C.unstable_sx=function(i){return ye({sx:i,theme:this})},C.toRuntimeSource=Hr,C}function lr(e,t,r){e.colorSchemes&&r&&(e.colorSchemes[t]={...r!==!0&&r,palette:zt({...r===!0?{}:r.palette,mode:t})})}function ci(e={},...t){const{palette:r,cssVariables:n=!1,colorSchemes:a=r?void 0:{light:!0},defaultColorScheme:o=r==null?void 0:r.mode,...s}=e,c=o||"light",u=a==null?void 0:a[c],f={...a,...r?{[c]:{...typeof u!="boolean"&&u,palette:r}}:void 0};if(n===!1){if(!("colorSchemes"in e))return We(e,...t);let p=r;"palette"in e||f[c]&&(f[c]!==!0?p=f[c].palette:c==="dark"&&(p={mode:"dark"}));const d=We({...e,palette:p},...t);return d.defaultColorScheme=c,d.colorSchemes=f,d.palette.mode==="light"&&(d.colorSchemes.light={...f.light!==!0&&f.light,palette:d.palette},lr(d,"dark",f.dark)),d.palette.mode==="dark"&&(d.colorSchemes.dark={...f.dark!==!0&&f.dark,palette:d.palette},lr(d,"light",f.light)),d}return!r&&!("light"in f)&&c==="light"&&(f.light=!0),si({...s,colorSchemes:f,defaultColorScheme:c,...typeof n!="boolean"&&n},...t)}const li=ci();function ui(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const fi=e=>ui(e)&&e!=="classes",di=co({themeId:rn,defaultTheme:li,rootShouldForwardProp:fi}),mi=ko;function pi(e){return wo(e)}function hi(e){return Lr("MuiSvgIcon",e)}const Ri=ao("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]),gi=e=>{const{color:t,fontSize:r,classes:n}=e,a={root:["root",t!=="inherit"&&`color${ge(t)}`,`fontSize${ge(r)}`]};return Co(a,hi,n)},yi=di("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,r.color!=="inherit"&&t[`color${ge(r.color)}`],t[`fontSize${ge(r.fontSize)}`]]}})(mi(({theme:e})=>{var t,r,n,a,o,s,c,u,f,p,d,m,b,g;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:(a=(t=e.transitions)==null?void 0:t.create)==null?void 0:a.call(t,"fill",{duration:(n=(r=(e.vars??e).transitions)==null?void 0:r.duration)==null?void 0:n.shorter}),variants:[{props:h=>!h.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:((s=(o=e.typography)==null?void 0:o.pxToRem)==null?void 0:s.call(o,20))||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:((u=(c=e.typography)==null?void 0:c.pxToRem)==null?void 0:u.call(c,24))||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:((p=(f=e.typography)==null?void 0:f.pxToRem)==null?void 0:p.call(f,35))||"2.1875rem"}},...Object.entries((e.vars??e).palette).filter(([,h])=>h&&h.main).map(([h])=>{var v,S;return{props:{color:h},style:{color:(S=(v=(e.vars??e).palette)==null?void 0:v[h])==null?void 0:S.main}}}),{props:{color:"action"},style:{color:(m=(d=(e.vars??e).palette)==null?void 0:d.action)==null?void 0:m.active}},{props:{color:"disabled"},style:{color:(g=(b=(e.vars??e).palette)==null?void 0:b.action)==null?void 0:g.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}})),wt=I.forwardRef(function(t,r){const n=pi({props:t,name:"MuiSvgIcon"}),{children:a,className:o,color:s="inherit",component:c="svg",fontSize:u="medium",htmlColor:f,inheritViewBox:p=!1,titleAccess:d,viewBox:m="0 0 24 24",...b}=n,g=I.isValidElement(a)&&a.type==="svg",h={...n,color:s,component:c,fontSize:u,instanceFontSize:t.fontSize,inheritViewBox:p,viewBox:m,hasSvgAsChild:g},v={};p||(v.viewBox=m);const S=gi(h);return ze.jsxs(yi,{as:c,className:ro(S.root,o),focusable:"false",color:f,"aria-hidden":d?void 0:!0,role:d?"img":void 0,ref:r,...v,...b,...g&&a.props,ownerState:h,children:[g?a.props.children:a,d?ze.jsx("title",{children:d}):null]})});wt.muiName="SvgIcon";function Bi(e,t){function r(n,a){return ze.jsx(wt,{"data-testid":`${t}Icon`,ref:a,...n,children:e})}return r.muiName=wt.muiName,I.memo(I.forwardRef(r))}export{wt as $,Oe as A,Ir as B,oa as C,se as D,li as E,si as F,ue as G,Pe as H,fe as I,ce as J,to as K,ao as L,pi as M,Uo as N,di as O,Ai as P,mi as Q,Zo as R,Lt as S,rn as T,Nt as U,vo as V,fi as W,at as X,ui as Y,po as Z,gt as _,Eo as a,ho as a0,_i as a1,jr as a2,ie as a3,ft as a4,bo as a5,xt as a6,Oi as a7,qo as a8,Vo as a9,ei as aa,ti as ab,Do as ac,zo as ad,ri as ae,Ri as af,hi as ag,Pt as ah,Tr as ai,_t as aj,Ci as ak,Cr as al,$r as am,ki as an,wi as ao,xi as ap,Rn as aq,on as ar,Ei as as,ci as b,Bi as c,So as d,ae as e,ut as f,de as g,ye as h,Gn as i,ze as j,ro as k,co as l,Ct as m,ge as n,Ce as o,Co as p,Fr as q,le as r,ea as s,Lr as t,Pi as u,oe as v,$i as w,It as x,K as y,Ti as z};
|