@imgly/plugin-ai-text-generation-web
Version:
AI text generation plugin for the CE.SDK editor
66 lines (62 loc) • 119 kB
JavaScript
var Cs=typeof global=="object"&&global&&global.Object===Object&&global,Ai=Cs,Ss=typeof self=="object"&&self&&self.Object===Object&&self,Ps=Ai||Ss||Function("return this")(),de=Ps,Es=de.Symbol,ft=Es,vi=Object.prototype,Rs=vi.hasOwnProperty,$s=vi.toString,er=ft?ft.toStringTag:void 0;function Ts(r){var e=Rs.call(r,er),t=r[er];try{r[er]=void 0;var n=!0}catch{}var i=$s.call(r);return n&&(e?r[er]=t:delete r[er]),i}var Os=Ts,Ms=Object.prototype,Ns=Ms.toString;function Ls(r){return Ns.call(r)}var js=Ls,Fs="[object Null]",Ds="[object Undefined]",li=ft?ft.toStringTag:void 0;function Us(r){return r==null?r===void 0?Ds:Fs:li&&li in Object(r)?Os(r):js(r)}var ir=Us;function Bs(r){return r!=null&&typeof r=="object"}var bn=Bs,Ju=Array.isArray;function zs(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}var Ii=zs,qs="[object AsyncFunction]",Vs="[object Function]",Gs="[object GeneratorFunction]",Ws="[object Proxy]";function Hs(r){if(!Ii(r))return!1;var e=ir(r);return e==Vs||e==Gs||e==qs||e==Ws}var Ks=Hs,Js=de["__core-js_shared__"],cn=Js,ui=function(){var r=/[^.]+$/.exec(cn&&cn.keys&&cn.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function Qs(r){return!!ui&&ui in r}var Ys=Qs,Xs=Function.prototype,Zs=Xs.toString;function eo(r){if(r!=null){try{return Zs.call(r)}catch{}try{return r+""}catch{}}return""}var Ue=eo,to=/[\\^$.*+?()[\]{}|]/g,ro=/^\[object .+?Constructor\]$/,no=Function.prototype,io=Object.prototype,so=no.toString,oo=io.hasOwnProperty,ao=RegExp("^"+so.call(oo).replace(to,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function lo(r){if(!Ii(r)||Ys(r))return!1;var e=Ks(r)?ao:ro;return e.test(Ue(r))}var uo=lo;function co(r,e){return r?.[e]}var po=co;function fo(r,e){var t=po(r,e);return uo(t)?t:void 0}var mt=fo,mo=mt(de,"WeakMap"),fn=mo;function ho(r,e){return r===e||r!==r&&e!==e}var go=ho,yo=9007199254740991;function bo(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=yo}var wo=bo,Qu=Object.prototype,_o="[object Arguments]";function xo(r){return bn(r)&&ir(r)==_o}var ci=xo,ki=Object.prototype,Ao=ki.hasOwnProperty,vo=ki.propertyIsEnumerable,Yu=ci(function(){return arguments}())?ci:function(r){return bn(r)&&Ao.call(r,"callee")&&!vo.call(r,"callee")},Ci=typeof exports=="object"&&exports&&!exports.nodeType&&exports,di=Ci&&typeof module=="object"&&module&&!module.nodeType&&module,Io=di&&di.exports===Ci,pi=Io?de.Buffer:void 0,Xu=pi?pi.isBuffer:void 0,ko="[object Arguments]",Co="[object Array]",So="[object Boolean]",Po="[object Date]",Eo="[object Error]",Ro="[object Function]",$o="[object Map]",To="[object Number]",Oo="[object Object]",Mo="[object RegExp]",No="[object Set]",Lo="[object String]",jo="[object WeakMap]",Fo="[object ArrayBuffer]",Do="[object DataView]",Uo="[object Float32Array]",Bo="[object Float64Array]",zo="[object Int8Array]",qo="[object Int16Array]",Vo="[object Int32Array]",Go="[object Uint8Array]",Wo="[object Uint8ClampedArray]",Ho="[object Uint16Array]",Ko="[object Uint32Array]",I={};I[Uo]=I[Bo]=I[zo]=I[qo]=I[Vo]=I[Go]=I[Wo]=I[Ho]=I[Ko]=!0;I[ko]=I[Co]=I[Fo]=I[So]=I[Do]=I[Po]=I[Eo]=I[Ro]=I[$o]=I[To]=I[Oo]=I[Mo]=I[No]=I[Lo]=I[jo]=!1;function Jo(r){return bn(r)&&wo(r.length)&&!!I[ir(r)]}var Qo=Jo;function Yo(r){return function(e){return r(e)}}var Xo=Yo,Si=typeof exports=="object"&&exports&&!exports.nodeType&&exports,tr=Si&&typeof module=="object"&&module&&!module.nodeType&&module,Zo=tr&&tr.exports===Si,dn=Zo&&Ai.process,ea=function(){try{var r=tr&&tr.require&&tr.require("util").types;return r||dn&&dn.binding&&dn.binding("util")}catch{}}(),fi=ea,mi=fi&&fi.isTypedArray,Zu=mi?Xo(mi):Qo,ta=Object.prototype,ec=ta.hasOwnProperty;function ra(r,e){return function(t){return r(e(t))}}var na=ra,tc=na(Object.keys,Object),ia=Object.prototype,rc=ia.hasOwnProperty,sa=mt(Object,"create"),rr=sa;function oa(){this.__data__=rr?rr(null):{},this.size=0}var aa=oa;function la(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var ua=la,ca="__lodash_hash_undefined__",da=Object.prototype,pa=da.hasOwnProperty;function fa(r){var e=this.__data__;if(rr){var t=e[r];return t===ca?void 0:t}return pa.call(e,r)?e[r]:void 0}var ma=fa,ha=Object.prototype,ga=ha.hasOwnProperty;function ya(r){var e=this.__data__;return rr?e[r]!==void 0:ga.call(e,r)}var ba=ya,wa="__lodash_hash_undefined__";function _a(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=rr&&e===void 0?wa:e,this}var xa=_a;function ht(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}ht.prototype.clear=aa;ht.prototype.delete=ua;ht.prototype.get=ma;ht.prototype.has=ba;ht.prototype.set=xa;var hi=ht;function Aa(){this.__data__=[],this.size=0}var va=Aa;function Ia(r,e){for(var t=r.length;t--;)if(go(r[t][0],e))return t;return-1}var Rr=Ia,ka=Array.prototype,Ca=ka.splice;function Sa(r){var e=this.__data__,t=Rr(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():Ca.call(e,t,1),--this.size,!0}var Pa=Sa;function Ea(r){var e=this.__data__,t=Rr(e,r);return t<0?void 0:e[t][1]}var Ra=Ea;function $a(r){return Rr(this.__data__,r)>-1}var Ta=$a;function Oa(r,e){var t=this.__data__,n=Rr(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this}var Ma=Oa;function gt(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}gt.prototype.clear=va;gt.prototype.delete=Pa;gt.prototype.get=Ra;gt.prototype.has=Ta;gt.prototype.set=Ma;var $r=gt,Na=mt(de,"Map"),nr=Na;function La(){this.size=0,this.__data__={hash:new hi,map:new(nr||$r),string:new hi}}var ja=La;function Fa(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}var Da=Fa;function Ua(r,e){var t=r.__data__;return Da(e)?t[typeof e=="string"?"string":"hash"]:t.map}var Tr=Ua;function Ba(r){var e=Tr(this,r).delete(r);return this.size-=e?1:0,e}var za=Ba;function qa(r){return Tr(this,r).get(r)}var Va=qa;function Ga(r){return Tr(this,r).has(r)}var Wa=Ga;function Ha(r,e){var t=Tr(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this}var Ka=Ha;function yt(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}yt.prototype.clear=ja;yt.prototype.delete=za;yt.prototype.get=Va;yt.prototype.has=Wa;yt.prototype.set=Ka;var Pi=yt;function Ja(){this.__data__=new $r,this.size=0}var Qa=Ja;function Ya(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}var Xa=Ya;function Za(r){return this.__data__.get(r)}var el=Za;function tl(r){return this.__data__.has(r)}var rl=tl,nl=200;function il(r,e){var t=this.__data__;if(t instanceof $r){var n=t.__data__;if(!nr||n.length<nl-1)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new Pi(n)}return t.set(r,e),this.size=t.size,this}var sl=il;function sr(r){var e=this.__data__=new $r(r);this.size=e.size}sr.prototype.clear=Qa;sr.prototype.delete=Xa;sr.prototype.get=el;sr.prototype.has=rl;sr.prototype.set=sl;var ol=Object.prototype,nc=ol.propertyIsEnumerable,al=mt(de,"DataView"),mn=al,ll=mt(de,"Promise"),hn=ll,ul=mt(de,"Set"),gn=ul,gi="[object Map]",cl="[object Object]",yi="[object Promise]",bi="[object Set]",wi="[object WeakMap]",_i="[object DataView]",dl=Ue(mn),pl=Ue(nr),fl=Ue(hn),ml=Ue(gn),hl=Ue(fn),pt=ir;(mn&&pt(new mn(new ArrayBuffer(1)))!=_i||nr&&pt(new nr)!=gi||hn&&pt(hn.resolve())!=yi||gn&&pt(new gn)!=bi||fn&&pt(new fn)!=wi)&&(pt=function(r){var e=ir(r),t=e==cl?r.constructor:void 0,n=t?Ue(t):"";if(n)switch(n){case dl:return _i;case pl:return gi;case fl:return yi;case ml:return bi;case hl:return wi}return e});var ic=de.Uint8Array,gl="__lodash_hash_undefined__";function yl(r){return this.__data__.set(r,gl),this}var bl=yl;function wl(r){return this.__data__.has(r)}var _l=wl;function yn(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Pi;++e<t;)this.add(r[e])}yn.prototype.add=yn.prototype.push=bl;yn.prototype.has=_l;var xi=ft?ft.prototype:void 0,sc=xi?xi.valueOf:void 0,xl=Object.prototype,oc=xl.hasOwnProperty,Al=Object.prototype,ac=Al.hasOwnProperty,lc=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),uc=new RegExp(/[A-Fa-f0-9]{1}/,"g"),cc=new RegExp(/[A-Fa-f0-9]{2}/,"g");function Ei(r,e){let t={...r};if(!e)return t;for(let[n,i]of Object.entries(e))i===!1||i===null||i===void 0?delete t[n]:i===!0?n in r||(t[n]=!0):t[n]=i;return t}var pn="@imgly/plugin-ai-generation",dc=`
<svg>
<symbol
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
id="@imgly/Sparkle"
>
<path d="M5.35545 2.06745C5.24149 1.72556 4.7579 1.72556 4.64394 2.06745L4.05898 3.82232C4.02166 3.93429 3.9338 4.02215 3.82184 4.05948L2.06694 4.64459C1.72506 4.75858 1.72509 5.24217 2.06699 5.3561L3.82179 5.9409C3.93378 5.97822 4.02166 6.06609 4.05899 6.17808L4.64394 7.93291C4.7579 8.2748 5.24149 8.2748 5.35545 7.93291L5.9404 6.17806C5.97773 6.06608 6.06559 5.97821 6.17757 5.94089L7.93242 5.35594C8.27431 5.24198 8.27431 4.75839 7.93242 4.64442L6.17757 4.05947C6.06559 4.02215 5.97773 3.93428 5.9404 3.8223L5.35545 2.06745Z" fill="currentColor"/>
<path d="M17.9632 3.23614C17.8026 2.80788 17.1968 2.80788 17.0362 3.23614L16.0787 5.78951C16.0285 5.92337 15.9229 6.02899 15.789 6.07918L13.2356 7.0367C12.8074 7.19729 12.8074 7.80307 13.2356 7.96366L15.789 8.92118C15.9229 8.97138 16.0285 9.077 16.0787 9.21085L17.0362 11.7642C17.1968 12.1925 17.8026 12.1925 17.9632 11.7642L18.9207 9.21086C18.9709 9.077 19.0765 8.97138 19.2104 8.92118L21.7637 7.96366C22.192 7.80307 22.192 7.1973 21.7637 7.0367L19.2104 6.07918C19.0765 6.02899 18.9709 5.92337 18.9207 5.78951L17.9632 3.23614Z" fill="currentColor"/>
<path d="M9.30058 7.82012C9.54712 7.1791 10.454 7.1791 10.7006 7.82012L12.3809 12.189C12.4571 12.3871 12.6136 12.5436 12.8117 12.6198L17.1806 14.3001C17.8216 14.5466 17.8216 15.4536 17.1806 15.7001L12.8117 17.3804C12.6136 17.4566 12.4571 17.6131 12.3809 17.8112L10.7006 22.1801C10.454 22.8211 9.54712 22.8211 9.30058 22.1801L7.62024 17.8112C7.54406 17.6131 7.38754 17.4566 7.18947 17.3804L2.82061 15.7001C2.17959 15.4536 2.17959 14.5466 2.82061 14.3001L7.18947 12.6198C7.38754 12.5436 7.54406 12.3871 7.62024 12.189L9.30058 7.82012Z" fill="currentColor"/>
</symbol>
<symbol
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
id="${pn}/image"
>
<path d="M3 16.5V18C3 19.6569 4.34315 21 6 21H18C19.6569 21 21 19.6569 21 18V6C21 4.34315 19.6569 3 18 3L17.999 5C18.5513 5 19 5.44772 19 6V18C19 18.5523 18.5523 19 18 19H6C5.44772 19 5 18.5523 5 18V16.5H3Z" fill="currentColor"/>
<path d="M13.0982 0.884877C12.9734 0.568323 12.5254 0.568322 12.4005 0.884876L11.7485 2.53819C11.7104 2.63483 11.6339 2.71134 11.5372 2.74945L9.8839 3.40151C9.56735 3.52636 9.56734 3.97436 9.8839 4.09921L11.5372 4.75126C11.6339 4.78938 11.7104 4.86588 11.7485 4.96253L12.4005 6.61584C12.5254 6.93239 12.9734 6.9324 13.0982 6.61584L13.7503 4.96253C13.7884 4.86588 13.8649 4.78938 13.9616 4.75126L15.6149 4.09921C15.9314 3.97436 15.9314 3.52636 15.6149 3.40151L13.9616 2.74945C13.8649 2.71134 13.7884 2.63483 13.7503 2.53819L13.0982 0.884877Z" fill="currentColor"/>
<path d="M6.40053 5.38488C6.52538 5.06832 6.97338 5.06832 7.09823 5.38488L8.17455 8.11392C8.21267 8.21057 8.28917 8.28707 8.38582 8.32519L11.1149 9.40151C11.4314 9.52636 11.4314 9.97436 11.1149 10.0992L8.38582 11.1755C8.28917 11.2136 8.21267 11.2901 8.17455 11.3868L7.09823 14.1158C6.97338 14.4324 6.52538 14.4324 6.40053 14.1158L5.32421 11.3868C5.2861 11.2901 5.20959 11.2136 5.11295 11.1755L2.3839 10.0992C2.06735 9.97436 2.06735 9.52636 2.3839 9.40151L5.11295 8.32519C5.20959 8.28707 5.2861 8.21057 5.32421 8.11392L6.40053 5.38488Z" fill="currentColor"/>
<path d="M18.9994 16.5008V18.0004C18.9994 18.5526 18.5517 19.0004 17.9994 19.0004H9.33302L14.3753 11.4369C14.6722 10.9916 15.3266 10.9916 15.6234 11.4369L18.9994 16.5008Z" fill="currentColor"/>
</symbol>
<symbol
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
id="${pn}/video"
>
<path d="M6 3C4.34315 3 3 4.34315 3 6V18C3 19.6569 4.34315 21 6 21H18C19.6569 21 21 19.6569 21 18V16.5H19V18C19 18.5523 18.5523 19 18 19H6C5.44772 19 5 18.5523 5 18V6C5 5.44772 5.44772 5 6 5V3Z" fill="currentColor"/>
<path d="M10.9025 0.8839C11.0273 0.567345 11.4753 0.567346 11.6002 0.883901L12.2522 2.53721C12.2904 2.63386 12.3669 2.71036 12.4635 2.74848L14.1168 3.40053C14.4334 3.52538 14.4334 3.97338 14.1168 4.09823L12.4635 4.75029C12.3669 4.7884 12.2904 4.86491 12.2522 4.96155L11.6002 6.61486C11.4753 6.93142 11.0273 6.93142 10.9025 6.61486L10.2504 4.96155C10.2123 4.86491 10.1358 4.7884 10.0392 4.75029L8.38585 4.09823C8.0693 3.97338 8.0693 3.52538 8.38585 3.40053L10.0392 2.74848C10.1358 2.71036 10.2123 2.63386 10.2504 2.53721L10.9025 0.8839Z" fill="currentColor"/>
<path d="M18.9019 3.3845C19.0267 3.06795 19.4747 3.06795 19.5996 3.3845L20.6759 6.11355C20.714 6.2102 20.7905 6.2867 20.8872 6.32482L23.6162 7.40114C23.9328 7.52598 23.9328 7.97399 23.6162 8.09883L20.8872 9.17515C20.7905 9.21327 20.714 9.28977 20.6759 9.38642L19.5996 12.1155C19.4747 12.432 19.0267 12.432 18.9019 12.1155L17.8255 9.38642C17.7874 9.28977 17.7109 9.21327 17.6143 9.17515L14.8852 8.09883C14.5687 7.97399 14.5687 7.52598 14.8852 7.40114L17.6143 6.32482C17.7109 6.2867 17.7874 6.2102 17.8255 6.11355L18.9019 3.3845Z" fill="currentColor"/>
<path d="M14.9994 13.2862C15.5089 12.8859 15.5089 12.1141 14.9995 11.7137L10.618 8.27047C9.96188 7.75485 9.00011 8.22225 9.00011 9.05673L9.00011 15.9429C9.00011 16.7773 9.96185 17.2448 10.618 16.7292L14.9994 13.2862Z" fill="currentColor"/>
</symbol>
<symbol
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
id="${pn}/audio"
>
<path d="M6 3.80273C4.2066 4.84016 3 6.77919 3 9.00004V12.8153C3 15.931 5.39501 18.4873 8.44444 18.7436V20.9645C8.44444 22.2198 9.89427 22.9198 10.8773 22.1392L15.1265 18.7647H15.5C17.8285 18.7647 19.8472 17.4384 20.8417 15.5H18.4187C17.6889 16.2784 16.6512 16.7647 15.5 16.7647H14.9522C14.6134 16.7647 14.2846 16.8794 14.0193 17.0901L10.4444 19.929V18.2597C10.4444 17.4341 9.77513 16.7647 8.9495 16.7647C7.80494 16.7647 6.77409 16.2779 6.05276 15.5H6V15.4419C5.37798 14.7439 5 13.8237 5 12.8153V9.00004C5 7.98559 5.37764 7.05935 6 6.35422V3.80273Z" fill="currentColor"/>
<path d="M11.6002 1.8839C11.4753 1.56735 11.0273 1.56735 10.9025 1.8839L10.2504 3.53721C10.2123 3.63386 10.1358 3.71036 10.0392 3.74848L8.38585 4.40053C8.0693 4.52538 8.0693 4.97338 8.38585 5.09823L10.0392 5.75029C10.1358 5.7884 10.2123 5.86491 10.2504 5.96155L10.9025 7.61486C11.0273 7.93142 11.4753 7.93142 11.6002 7.61486L12.2522 5.96155C12.2904 5.86491 12.3669 5.7884 12.4635 5.75029L14.1168 5.09823C14.4334 4.97338 14.4334 4.52538 14.1168 4.40053L12.4635 3.74848C12.3669 3.71036 12.2904 3.63386 12.2522 3.53721L11.6002 1.8839Z" fill="currentColor"/>
<path d="M19.5996 4.3845C19.4747 4.06795 19.0267 4.06795 18.9019 4.3845L17.8255 7.11355C17.7874 7.2102 17.7109 7.2867 17.6143 7.32482L14.8852 8.40114C14.5687 8.52598 14.5687 8.97399 14.8852 9.09883L17.6143 10.1752C17.7109 10.2133 17.7874 10.2898 17.8255 10.3864L18.9019 13.1155C19.0267 13.432 19.4747 13.432 19.5996 13.1155L20.6759 10.3864C20.714 10.2898 20.7905 10.2133 20.8872 10.1752L23.6162 9.09883C23.9328 8.97399 23.9328 8.52598 23.6162 8.40114L20.8872 7.32482C20.7905 7.2867 20.714 7.2102 20.6759 7.11355L19.5996 4.3845Z" fill="currentColor"/>
</symbol>
<symbol
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
id="@imgly/MixingPlate"
>
<path d="M9.75 9C10.5784 9 11.25 8.32843 11.25 7.5C11.25 6.67157 10.5784 6 9.75 6C8.92157 6 8.25 6.67157 8.25 7.5C8.25 8.32843 8.92157 9 9.75 9Z" fill="currentColor"/>
<path d="M7 13C7.82843 13 8.5 12.3284 8.5 11.5C8.5 10.6716 7.82843 10 7 10C6.17157 10 5.5 10.6716 5.5 11.5C5.5 12.3284 6.17157 13 7 13Z" fill="currentColor"/>
<path d="M15.75 7.5C15.75 8.32843 15.0784 9 14.25 9C13.4216 9 12.75 8.32843 12.75 7.5C12.75 6.67157 13.4216 6 14.25 6C15.0784 6 15.75 6.67157 15.75 7.5Z" fill="currentColor"/>
<path d="M17 13C17.8284 13 18.5 12.3284 18.5 11.5C18.5 10.6716 17.8284 10 17 10C16.1716 10 15.5 10.6716 15.5 11.5C15.5 12.3284 16.1716 13 17 13Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.26309 2.77709C10.6681 1.77921 13.4829 1.7322 15.9209 2.64297C18.1572 3.47923 20.0876 5.09285 21.1766 7.28598C22.3395 9.62772 22.4889 13.1077 20.3864 15.2982C19.2693 16.4621 17.7657 16.9982 16.0026 16.9997C15.7897 16.9997 15.5555 16.9864 15.3497 16.9745C15.309 16.9722 15.2694 16.9699 15.2313 16.9679C14.9817 16.9542 14.761 16.9455 14.5569 16.9539C14.124 16.9718 13.9598 17.0612 13.89 17.1324C13.718 17.3081 13.6946 17.6672 13.8854 17.8895C14.2899 18.3608 14.5016 18.9277 14.5016 19.5497C14.5016 20.2206 14.3086 20.9011 13.7542 21.3896C13.2471 21.837 12.6082 21.9997 11.9635 21.9997C10.6049 21.9997 9.31155 21.7367 8.0934 21.2067C6.89058 20.6831 5.84501 19.9687 4.94363 19.0666C4.04281 18.1651 3.31836 17.107 2.79369 15.8978C1.72761 13.4409 1.72662 10.5261 2.81247 8.07034C3.88024 5.65548 5.84206 3.78161 8.26309 2.77709ZM15.2207 4.51639C13.2556 3.78239 10.9651 3.82132 9.02956 4.62439C7.06888 5.43791 5.49559 6.94785 4.64163 8.87914C3.78373 10.8194 3.78253 13.1522 4.62841 15.1017C5.05312 16.0805 5.63511 16.9291 6.35838 17.6529C7.08102 18.3761 7.91671 18.9484 8.89123 19.3728C9.8492 19.7895 10.87 19.9997 11.9635 19.9997C12.2815 19.9997 12.394 19.9225 12.431 19.8899L12.4319 19.8891C12.4367 19.8849 12.4487 19.8743 12.4631 19.8359C12.4799 19.7911 12.5016 19.7024 12.5016 19.5497C12.5016 19.4091 12.4633 19.3034 12.3677 19.192C11.5353 18.222 11.5272 16.6868 12.4611 15.7331C13.0741 15.1071 13.8844 14.98 14.4745 14.9556C14.7819 14.943 15.085 14.9568 15.3409 14.9709C15.3906 14.9736 15.4379 14.9763 15.4832 14.9788C15.6876 14.9904 15.8508 14.9997 16.0009 14.9997C17.3405 14.9986 18.2792 14.6054 18.9435 13.9133C20.2633 12.5382 20.3186 10.055 19.3853 8.1755C18.5436 6.48051 17.0293 5.19281 15.2207 4.51639Z" fill="currentColor"/>
</symbol>
</svg>
`;var Or="RFC3986",Mr={RFC1738:r=>String(r).replace(/%20/g,"+"),RFC3986:r=>String(r)},Ri="RFC1738";var vl=Array.isArray,ee=(()=>{let r=[];for(let e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r})();var wn=1024,$i=(r,e,t,n,i)=>{if(r.length===0)return r;let s=r;if(typeof r=="symbol"?s=Symbol.prototype.toString.call(r):typeof r!="string"&&(s=String(r)),t==="iso-8859-1")return escape(s).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let o="";for(let a=0;a<s.length;a+=wn){let c=s.length>=wn?s.slice(a,a+wn):s,d=[];for(let _=0;_<c.length;++_){let u=c.charCodeAt(_);if(u===45||u===46||u===95||u===126||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||i===Ri&&(u===40||u===41)){d[d.length]=c.charAt(_);continue}if(u<128){d[d.length]=ee[u];continue}if(u<2048){d[d.length]=ee[192|u>>6]+ee[128|u&63];continue}if(u<55296||u>=57344){d[d.length]=ee[224|u>>12]+ee[128|u>>6&63]+ee[128|u&63];continue}_+=1,u=65536+((u&1023)<<10|c.charCodeAt(_)&1023),d[d.length]=ee[240|u>>18]+ee[128|u>>12&63]+ee[128|u>>6&63]+ee[128|u&63]}o+=d.join("")}return o};function Ti(r){return!r||typeof r!="object"?!1:!!(r.constructor&&r.constructor.isBuffer&&r.constructor.isBuffer(r))}function _n(r,e){if(vl(r)){let t=[];for(let n=0;n<r.length;n+=1)t.push(e(r[n]));return t}return e(r)}var Il=Object.prototype.hasOwnProperty,Oi={brackets(r){return String(r)+"[]"},comma:"comma",indices(r,e){return String(r)+"["+e+"]"},repeat(r){return String(r)}},te=Array.isArray,kl=Array.prototype.push,Mi=function(r,e){kl.apply(r,te(e)?e:[e])},Cl=Date.prototype.toISOString,T={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:$i,encodeValuesOnly:!1,format:Or,formatter:Mr[Or],indices:!1,serializeDate(r){return Cl.call(r)},skipNulls:!1,strictNullHandling:!1};function Sl(r){return typeof r=="string"||typeof r=="number"||typeof r=="boolean"||typeof r=="symbol"||typeof r=="bigint"}var xn={};function Ni(r,e,t,n,i,s,o,a,c,d,_,u,f,p,A,g,S,R){let y=r,D=R,C=0,N=!1;for(;(D=D.get(xn))!==void 0&&!N;){let P=D.get(r);if(C+=1,typeof P<"u"){if(P===C)throw new RangeError("Cyclic object value");N=!0}typeof D.get(xn)>"u"&&(C=0)}if(typeof d=="function"?y=d(e,y):y instanceof Date?y=f?.(y):t==="comma"&&te(y)&&(y=_n(y,function(P){return P instanceof Date?f?.(P):P})),y===null){if(s)return c&&!g?c(e,T.encoder,S,"key",p):e;y=""}if(Sl(y)||Ti(y)){if(c){let P=g?e:c(e,T.encoder,S,"key",p);return[A?.(P)+"="+A?.(c(y,T.encoder,S,"value",p))]}return[A?.(e)+"="+A?.(String(y))]}let B=[];if(typeof y>"u")return B;let z;if(t==="comma"&&te(y))g&&c&&(y=_n(y,c)),z=[{value:y.length>0?y.join(",")||null:void 0}];else if(te(d))z=d;else{let P=Object.keys(y);z=_?P.sort(_):P}let L=a?String(e).replace(/\./g,"%2E"):String(e),j=n&&te(y)&&y.length===1?L+"[]":L;if(i&&te(y)&&y.length===0)return j+"[]";for(let P=0;P<z.length;++P){let $=z[P],oi=typeof $=="object"&&typeof $.value<"u"?$.value:y[$];if(o&&oi===null)continue;let un=u&&a?$.replace(/\./g,"%2E"):$,ks=te(y)?typeof t=="function"?t(j,un):j:j+(u?"."+un:"["+un+"]");R.set(r,C);let ai=new WeakMap;ai.set(xn,R),Mi(B,Ni(oi,ks,t,n,i,s,o,a,t==="comma"&&g&&te(y)?null:c,d,_,u,f,p,A,g,S,ai))}return B}function Pl(r=T){if(typeof r.allowEmptyArrays<"u"&&typeof r.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof r.encodeDotInKeys<"u"&&typeof r.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(r.encoder!==null&&typeof r.encoder<"u"&&typeof r.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=r.charset||T.charset;if(typeof r.charset<"u"&&r.charset!=="utf-8"&&r.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let t=Or;if(typeof r.format<"u"){if(!Il.call(Mr,r.format))throw new TypeError("Unknown format option provided.");t=r.format}let n=Mr[t],i=T.filter;(typeof r.filter=="function"||te(r.filter))&&(i=r.filter);let s;if(r.arrayFormat&&r.arrayFormat in Oi?s=r.arrayFormat:"indices"in r?s=r.indices?"indices":"repeat":s=T.arrayFormat,"commaRoundTrip"in r&&typeof r.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let o=typeof r.allowDots>"u"?r.encodeDotInKeys?!0:T.allowDots:!!r.allowDots;return{addQueryPrefix:typeof r.addQueryPrefix=="boolean"?r.addQueryPrefix:T.addQueryPrefix,allowDots:o,allowEmptyArrays:typeof r.allowEmptyArrays=="boolean"?!!r.allowEmptyArrays:T.allowEmptyArrays,arrayFormat:s,charset:e,charsetSentinel:typeof r.charsetSentinel=="boolean"?r.charsetSentinel:T.charsetSentinel,commaRoundTrip:!!r.commaRoundTrip,delimiter:typeof r.delimiter>"u"?T.delimiter:r.delimiter,encode:typeof r.encode=="boolean"?r.encode:T.encode,encodeDotInKeys:typeof r.encodeDotInKeys=="boolean"?r.encodeDotInKeys:T.encodeDotInKeys,encoder:typeof r.encoder=="function"?r.encoder:T.encoder,encodeValuesOnly:typeof r.encodeValuesOnly=="boolean"?r.encodeValuesOnly:T.encodeValuesOnly,filter:i,format:t,formatter:n,serializeDate:typeof r.serializeDate=="function"?r.serializeDate:T.serializeDate,skipNulls:typeof r.skipNulls=="boolean"?r.skipNulls:T.skipNulls,sort:typeof r.sort=="function"?r.sort:null,strictNullHandling:typeof r.strictNullHandling=="boolean"?r.strictNullHandling:T.strictNullHandling}}function An(r,e={}){let t=r,n=Pl(e),i,s;typeof n.filter=="function"?(s=n.filter,t=s("",t)):te(n.filter)&&(s=n.filter,i=s);let o=[];if(typeof t!="object"||t===null)return"";let a=Oi[n.arrayFormat],c=a==="comma"&&n.commaRoundTrip;i||(i=Object.keys(t)),n.sort&&i.sort(n.sort);let d=new WeakMap;for(let f=0;f<i.length;++f){let p=i[f];n.skipNulls&&t[p]===null||Mi(o,Ni(t[p],p,a,c,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,d))}let _=o.join(n.delimiter),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+_:""}var Be="4.104.0";var Li=!1,ze,vn,Rl,$l,Tl,In,Ol,Nr,kn,Cn,Sn,Lr,Pn;function ji(r,e={auto:!1}){if(Li)throw new Error(`you must \`import 'openai/shims/${r.kind}'\` before importing anything else from openai`);if(ze)throw new Error(`can't \`import 'openai/shims/${r.kind}'\` after \`import 'openai/shims/${ze}'\``);Li=e.auto,ze=r.kind,vn=r.fetch,Rl=r.Request,$l=r.Response,Tl=r.Headers,In=r.FormData,Ol=r.Blob,Nr=r.File,kn=r.ReadableStream,Cn=r.getMultipartRequestOptions,Sn=r.getDefaultAgent,Lr=r.fileFromPath,Pn=r.isFsReadStream}var jr=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function Fi({manuallyImported:r}={}){let e=r?"You may need to use polyfills":"Add one of these imports before your first `import \u2026 from 'openai'`:\n- `import 'openai/shims/node'` (if you're running on Node)\n- `import 'openai/shims/web'` (otherwise)\n",t,n,i,s;try{t=fetch,n=Request,i=Response,s=Headers}catch(o){throw new Error(`this environment is missing the following Web Fetch API type: ${o.message}. ${e}`)}return{kind:"web",fetch:t,Request:n,Response:i,Headers:s,FormData:typeof FormData<"u"?FormData:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${e}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${e}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${e}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${e}`)}},getMultipartRequestOptions:async(o,a)=>({...a,body:new jr(o)}),getDefaultAgent:o=>{},fileFromPath:()=>{throw new Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/openai/openai-node#file-uploads")},isFsReadStream:o=>!1}}var En=()=>{ze||ji(Fi(),{auto:!0})};En();var m=class extends Error{},O=class r extends m{constructor(e,t,n,i){super(`${r.makeMessage(e,t,n)}`),this.status=e,this.headers=i,this.request_id=i?.["x-request-id"],this.error=t;let s=t;this.code=s?.code,this.param=s?.param,this.type=s?.type}static makeMessage(e,t,n){let i=t?.message?typeof t.message=="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&i?`${e} ${i}`:e?`${e} status code (no body)`:i||"(no status code or body)"}static generate(e,t,n,i){if(!e||!i)return new _e({message:n,cause:Fr(t)});let s=t?.error;return e===400?new or(e,s,n,i):e===401?new ar(e,s,n,i):e===403?new lr(e,s,n,i):e===404?new ur(e,s,n,i):e===409?new cr(e,s,n,i):e===422?new dr(e,s,n,i):e===429?new pr(e,s,n,i):e>=500?new fr(e,s,n,i):new r(e,s,n,i)}},E=class extends O{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},_e=class extends O{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}},xe=class extends _e{constructor({message:e}={}){super({message:e??"Request timed out."})}},or=class extends O{},ar=class extends O{},lr=class extends O{},ur=class extends O{},cr=class extends O{},dr=class extends O{},pr=class extends O{},fr=class extends O{},bt=class extends m{constructor(){super("Could not parse response content as the length limit was reached")}},wt=class extends m{constructor(){super("Could not parse response content as the request was rejected by the content filter")}};var Dr=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},qe=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},W,Ve=class{constructor(){W.set(this,void 0),this.buffer=new Uint8Array,Dr(this,W,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?new TextEncoder().encode(e):e,n=new Uint8Array(this.buffer.length+t.length);n.set(this.buffer),n.set(t,this.buffer.length),this.buffer=n;let i=[],s;for(;(s=Ll(this.buffer,qe(this,W,"f")))!=null;){if(s.carriage&&qe(this,W,"f")==null){Dr(this,W,s.index,"f");continue}if(qe(this,W,"f")!=null&&(s.index!==qe(this,W,"f")+1||s.carriage)){i.push(this.decodeText(this.buffer.slice(0,qe(this,W,"f")-1))),this.buffer=this.buffer.slice(qe(this,W,"f")),Dr(this,W,null,"f");continue}let o=qe(this,W,"f")!==null?s.preceding-1:s.preceding,a=this.decodeText(this.buffer.slice(0,o));i.push(a),this.buffer=this.buffer.slice(s.index),Dr(this,W,null,"f")}return i}decodeText(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new m(`Unexpected: received non-Uint8Array (${e.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if(typeof TextDecoder<"u"){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(e);throw new m(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new m("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
`):[]}};W=new WeakMap;Ve.NEWLINE_CHARS=new Set([`
`,"\r"]);Ve.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Ll(r,e){for(let i=e??0;i<r.length;i++){if(r[i]===10)return{preceding:i,index:i+1,carriage:!1};if(r[i]===13)return{preceding:i,index:i+1,carriage:!0}}return null}function Di(r){for(let n=0;n<r.length-1;n++){if(r[n]===10&&r[n+1]===10||r[n]===13&&r[n+1]===13)return n+2;if(r[n]===13&&r[n+1]===10&&n+3<r.length&&r[n+2]===13&&r[n+3]===10)return n+4}return-1}function Rn(r){if(r[Symbol.asyncIterator])return r;let e=r.getReader();return{async next(){try{let t=await e.read();return t?.done&&e.releaseLock(),t}catch(t){throw e.releaseLock(),t}},async return(){let t=e.cancel();return e.releaseLock(),await t,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var re=class r{constructor(e,t){this.iterator=e,this.controller=t}static fromSSEResponse(e,t){let n=!1;async function*i(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let s=!1;try{for await(let o of jl(e,t))if(!s){if(o.data.startsWith("[DONE]")){s=!0;continue}if(o.event===null||o.event.startsWith("response.")||o.event.startsWith("transcript.")){let a;try{a=JSON.parse(o.data)}catch(c){throw console.error("Could not parse message into JSON:",o.data),console.error("From chunk:",o.raw),c}if(a&&a.error)throw new O(void 0,a.error,void 0,Tn(e.headers));yield a}else{let a;try{a=JSON.parse(o.data)}catch(c){throw console.error("Could not parse message into JSON:",o.data),console.error("From chunk:",o.raw),c}if(o.event=="error")throw new O(void 0,a.error,a.message,void 0);yield{event:o.event,data:a}}}s=!0}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{s||t.abort()}}return new r(i,t)}static fromReadableStream(e,t){let n=!1;async function*i(){let o=new Ve,a=Rn(e);for await(let c of a)for(let d of o.decode(c))yield d;for(let c of o.flush())yield c}async function*s(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let o=!1;try{for await(let a of i())o||a&&(yield JSON.parse(a));o=!0}catch(a){if(a instanceof Error&&a.name==="AbortError")return;throw a}finally{o||t.abort()}}return new r(s,t)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],t=[],n=this.iterator(),i=s=>({next:()=>{if(s.length===0){let o=n.next();e.push(o),t.push(o)}return s.shift()}});return[new r(()=>i(e),this.controller),new r(()=>i(t),this.controller)]}toReadableStream(){let e=this,t,n=new TextEncoder;return new kn({async start(){t=e[Symbol.asyncIterator]()},async pull(i){try{let{value:s,done:o}=await t.next();if(o)return i.close();let a=n.encode(JSON.stringify(s)+`
`);i.enqueue(a)}catch(s){i.error(s)}},async cancel(){await t.return?.()}})}};async function*jl(r,e){if(!r.body)throw e.abort(),new m("Attempted to iterate over a response with no body");let t=new $n,n=new Ve,i=Rn(r.body);for await(let s of Fl(i))for(let o of n.decode(s)){let a=t.decode(o);a&&(yield a)}for(let s of n.flush()){let o=t.decode(s);o&&(yield o)}}async function*Fl(r){let e=new Uint8Array;for await(let t of r){if(t==null)continue;let n=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?new TextEncoder().encode(t):t,i=new Uint8Array(e.length+n.length);i.set(e),i.set(n,e.length),e=i;let s;for(;(s=Di(e))!==-1;)yield e.slice(0,s),e=e.slice(s)}e.length>0&&(yield e)}var $n=class{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;let s={event:this.event,data:this.data.join(`
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],s}if(this.chunks.push(e),e.startsWith(":"))return null;let[t,n,i]=Dl(e,":");return i.startsWith(" ")&&(i=i.substring(1)),t==="event"?this.event=i:t==="data"&&this.data.push(i),null}};function Dl(r,e){let t=r.indexOf(e);return t!==-1?[r.substring(0,t),e,r.substring(t+e.length)]:[r,"",""]}var Ui=r=>r!=null&&typeof r=="object"&&typeof r.url=="string"&&typeof r.blob=="function",Bi=r=>r!=null&&typeof r=="object"&&typeof r.name=="string"&&typeof r.lastModified=="number"&&mr(r),mr=r=>r!=null&&typeof r=="object"&&typeof r.size=="number"&&typeof r.type=="string"&&typeof r.text=="function"&&typeof r.slice=="function"&&typeof r.arrayBuffer=="function",Ul=r=>Bi(r)||Ui(r)||Pn(r);async function Nn(r,e,t){if(r=await r,Bi(r))return r;if(Ui(r)){let i=await r.blob();e||(e=new URL(r.url).pathname.split(/[\\/]/).pop()??"unknown_file");let s=mr(i)?[await i.arrayBuffer()]:[i];return new Nr(s,e,t)}let n=await Bl(r);if(e||(e=ql(r)??"unknown_file"),!t?.type){let i=n[0]?.type;typeof i=="string"&&(t={...t,type:i})}return new Nr(n,e,t)}async function Bl(r){let e=[];if(typeof r=="string"||ArrayBuffer.isView(r)||r instanceof ArrayBuffer)e.push(r);else if(mr(r))e.push(await r.arrayBuffer());else if(Vl(r))for await(let t of r)e.push(t);else throw new Error(`Unexpected data type: ${typeof r}; constructor: ${r?.constructor?.name}; props: ${zl(r)}`);return e}function zl(r){return`[${Object.getOwnPropertyNames(r).map(t=>`"${t}"`).join(", ")}]`}function ql(r){return On(r.name)||On(r.filename)||On(r.path)?.split(/[\\/]/).pop()}var On=r=>{if(typeof r=="string")return r;if(typeof Buffer<"u"&&r instanceof Buffer)return String(r)},Vl=r=>r!=null&&typeof r=="object"&&typeof r[Symbol.asyncIterator]=="function",Ln=r=>r&&typeof r=="object"&&r.body&&r[Symbol.toStringTag]==="MultipartBody";var V=async r=>{let e=await zi(r.body);return Cn(e,r)},zi=async r=>{let e=new In;return await Promise.all(Object.entries(r||{}).map(([t,n])=>Mn(e,t,n))),e};var Mn=async(r,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")r.append(e,String(t));else if(Ul(t)){let n=await Nn(t);r.append(e,n)}else if(Array.isArray(t))await Promise.all(t.map(n=>Mn(r,e+"[]",n)));else if(typeof t=="object")await Promise.all(Object.entries(t).map(([n,i])=>Mn(r,`${e}[${n}]`,i)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${t} instead`)}};var Wl=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Hl=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Ur;En();async function Ki(r){let{response:e}=r;if(r.options.stream)return pe("response",e.status,e.url,e.headers,e.body),r.options.__streamClass?r.options.__streamClass.fromSSEResponse(e,r.controller):re.fromSSEResponse(e,r.controller);if(e.status===204)return null;if(r.options.__binaryResponse)return e;let n=e.headers.get("content-type")?.split(";")[0]?.trim();if(n?.includes("application/json")||n?.endsWith("+json")){let o=await e.json();return pe("response",e.status,e.url,e.headers,o),Ji(o,e)}let s=await e.text();return pe("response",e.status,e.url,e.headers,s),s}function Ji(r,e){return!r||typeof r!="object"||Array.isArray(r)?r:Object.defineProperty(r,"_request_id",{value:e.headers.get("x-request-id"),enumerable:!1})}var zr=class r extends Promise{constructor(e,t=Ki){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=t}_thenUnwrap(e){return new r(this.responsePromise,async t=>Ji(e(await this.parseResponse(t),t),t.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[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(this.parseResponse)),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)}},qr=class{constructor({baseURL:e,maxRetries:t=2,timeout:n=6e5,httpAgent:i,fetch:s}){this.baseURL=e,this.maxRetries=jn("maxRetries",t),this.timeout=jn("timeout",n),this.httpAgent=i,this.fetch=s??vn}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...Yl(),...this.authHeaders(e)}}validateHeaders(e,t){}defaultIdempotencyKey(){return`stainless-node-retry-${tu()}`}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(async i=>{let s=i&&mr(i?.body)?new DataView(await i.body.arrayBuffer()):i?.body instanceof DataView?i.body:i?.body instanceof ArrayBuffer?new DataView(i.body):i&&ArrayBuffer.isView(i?.body)?new DataView(i.body.buffer):i?.body;return{method:e,path:t,...i,body:s}}))}getAPIList(e,t,n){return this.requestAPIList(t,{method:"get",path:e,...n})}calculateContentLength(e){if(typeof e=="string"){if(typeof Buffer<"u")return Buffer.byteLength(e,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length.toString()}else if(ArrayBuffer.isView(e))return e.byteLength.toString();return null}buildRequest(e,{retryCount:t=0}={}){let n={...e},{method:i,path:s,query:o,headers:a={}}=n,c=ArrayBuffer.isView(n.body)||n.__binaryRequest&&typeof n.body=="string"?n.body:Ln(n.body)?n.body.body:n.body?JSON.stringify(n.body,null,2):null,d=this.calculateContentLength(c),_=this.buildURL(s,o);"timeout"in n&&jn("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let u=n.httpAgent??this.httpAgent??Sn(_),f=n.timeout+1e3;typeof u?.options?.timeout=="number"&&f>(u.options.timeout??0)&&(u.options.timeout=f),this.idempotencyHeader&&i!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),a[this.idempotencyHeader]=e.idempotencyKey);let p=this.buildHeaders({options:n,headers:a,contentLength:d,retryCount:t});return{req:{method:i,...c&&{body:c},headers:p,...u&&{agent:u},signal:n.signal??null},url:_,timeout:n.timeout}}buildHeaders({options:e,headers:t,contentLength:n,retryCount:i}){let s={};n&&(s["content-length"]=n);let o=this.defaultHeaders(e);return Wi(s,o),Wi(s,t),Ln(e.body)&&ze!=="node"&&delete s["content-type"],Br(o,"x-stainless-retry-count")===void 0&&Br(t,"x-stainless-retry-count")===void 0&&(s["x-stainless-retry-count"]=String(i)),Br(o,"x-stainless-timeout")===void 0&&Br(t,"x-stainless-timeout")===void 0&&e.timeout&&(s["x-stainless-timeout"]=String(Math.trunc(e.timeout/1e3))),this.validateHeaders(s,t),s}async prepareOptions(e){}async prepareRequest(e,{url:t,options:n}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(t=>[...t])):{...e}:{}}makeStatusError(e,t,n,i){return O.generate(e,t,n,i)}request(e,t=null){return new zr(this.makeRequest(e,t))}async makeRequest(e,t){let n=await e,i=n.maxRetries??this.maxRetries;t==null&&(t=i),await this.prepareOptions(n);let{req:s,url:o,timeout:a}=this.buildRequest(n,{retryCount:i-t});if(await this.prepareRequest(s,{url:o,options:n}),pe("request",o,n,s.headers),n.signal?.aborted)throw new E;let c=new AbortController,d=await this.fetchWithTimeout(o,s,a,c).catch(Fr);if(d instanceof Error){if(n.signal?.aborted)throw new E;if(t)return this.retryRequest(n,t);throw d.name==="AbortError"?new xe:new _e({cause:d})}let _=Tn(d.headers);if(!d.ok){if(t&&this.shouldRetry(d)){let S=`retrying, ${t} attempts remaining`;return pe(`response (error; ${S})`,d.status,o,_),this.retryRequest(n,t,_)}let u=await d.text().catch(S=>Fr(S).message),f=Xl(u),p=f?void 0:u;throw pe(`response (error; ${t?"(error; no more retries left)":"(error; not retryable)"})`,d.status,o,_,p),this.makeStatusError(d.status,f,p,_)}return{response:d,options:n,controller:c}}requestAPIList(e,t){let n=this.makeRequest(t,null);return new Fn(this,n,e)}buildURL(e,t){let n=eu(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),i=this.defaultQuery();return Qi(i)||(t={...i,...t}),typeof t=="object"&&t&&!Array.isArray(t)&&(n.search=this.stringifyQuery(t)),n.toString()}stringifyQuery(e){return Object.entries(e).filter(([t,n])=>typeof n<"u").map(([t,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(t)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(t)}=`;throw new m(`Cannot stringify type ${typeof n}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}async fetchWithTimeout(e,t,n,i){let{signal:s,...o}=t||{};s&&s.addEventListener("abort",()=>i.abort());let a=setTimeout(()=>i.abort(),n),c={signal:i.signal,...o};return c.method&&(c.method=c.method.toUpperCase()),this.fetch.call(void 0,e,c).finally(()=>{clearTimeout(a)})}shouldRetry(e){let 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){let i,s=n?.["retry-after-ms"];if(s){let a=parseFloat(s);Number.isNaN(a)||(i=a)}let o=n?.["retry-after"];if(o&&!i){let a=parseFloat(o);Number.isNaN(a)?i=Date.parse(o)-Date.now():i=a*1e3}if(!(i&&0<=i&&i<60*1e3)){let a=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(t,a)}return await fe(i),this.makeRequest(e,t-1)}calculateDefaultRetryTimeoutMillis(e,t){let s=t-e,o=Math.min(.5*Math.pow(2,s),8),a=1-Math.random()*.25;return o*a*1e3}getUserAgent(){return`${this.constructor.name}/JS ${Be}`}},hr=class{constructor(e,t,n,i){Ur.set(this,void 0),Wl(this,Ur,e,"f"),this.options=i,this.response=t,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageInfo()!=null:!1}async getNextPage(){let e=this.nextPageInfo();if(!e)throw new m("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let t={...this.options};if("params"in e&&typeof t.query=="object")t.query={...t.query,...e.params};else if("url"in e){let n=[...Object.entries(t.query||{}),...e.url.searchParams.entries()];for(let[i,s]of n)e.url.searchParams.set(i,s);t.query=void 0,t.path=e.url.toString()}return await Hl(this,Ur,"f").requestAPIList(this.constructor,t)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Ur=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let t of e.getPaginatedItems())yield t}},Fn=class extends zr{constructor(e,t,n){super(t,async i=>new n(e,i.response,await Ki(i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let t of e)yield t}},Tn=r=>new Proxy(Object.fromEntries(r.entries()),{get(e,t){let n=t.toString();return e[n.toLowerCase()]||e[n]}}),Kl={method:!0,path:!0,query:!0,body:!0,headers:!0,maxRetries:!0,stream:!0,timeout:!0,httpAgent:!0,signal:!0,idempotencyKey:!0,__metadata:!0,__binaryRequest:!0,__binaryResponse:!0,__streamClass:!0},w=r=>typeof r=="object"&&r!==null&&!Qi(r)&&Object.keys(r).every(e=>Yi(Kl,e)),Jl=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Be,"X-Stainless-OS":Vi(Deno.build.os),"X-Stainless-Arch":qi(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Be,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":process.version};if(Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Be,"X-Stainless-OS":Vi(process.platform),"X-Stainless-Arch":qi(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let r=Ql();return r?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Be,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${r.browser}`,"X-Stainless-Runtime-Version":r.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Be,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Ql(){if(typeof navigator>"u"||!navigator)return null;let r=[{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(let{key:e,pattern:t}of r){let n=t.exec(navigator.userAgent);if(n){let i=n[1]||0,s=n[2]||0,o=n[3]||0;return{browser:e,version:`${i}.${s}.${o}`}}}return null}var qi=r=>r==="x32"?"x32":r==="x86_64"||r==="x64"?"x64":r==="arm"?"arm":r==="aarch64"||r==="arm64"?"arm64":r?`other:${r}`:"unknown",Vi=r=>(r=r.toLowerCase(),r.includes("ios")?"iOS":r==="android"?"Android":r==="darwin"?"MacOS":r==="win32"?"Windows":r==="freebsd"?"FreeBSD":r==="openbsd"?"OpenBSD":r==="linux"?"Linux":r?`Other:${r}`:"Unknown"),Gi,Yl=()=>Gi??(Gi=Jl()),Xl=r=>{try{return JSON.parse(r)}catch{return}},Zl=/^[a-z][a-z0-9+.-]*:/i,eu=r=>Zl.test(r),fe=r=>new Promise(e=>setTimeout(e,r)),jn=(r,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new m(`${r} must be an integer`);if(e<0)throw new m(`${r} must be a positive integer`);return e},Fr=r=>{if(r instanceof Error)return r;if(typeof r=="object"&&r!==null)try{return new Error(JSON.stringify(r))}catch{}return new Error(r)};var gr=r=>{if(typeof process<"u")return process.env?.[r]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(r)?.trim()};function Qi(r){if(!r)return!0;for(let e in r)return!1;return!0}function Yi(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Wi(r,e){for(let t in e){if(!Yi(e,t))continue;let n=t.toLowerCase();if(!n)continue;let i=e[t];i===null?delete r[n]:i!==void 0&&(r[n]=i)}}var Hi=new Set(["authorization","api-key"]);function pe(r,...e){if(typeof process<"u"&&process?.env?.DEBUG==="true"){let t=e.map(n=>{if(!n)return n;if(n.headers){let s={...n,headers:{...n.headers}};for(let o in n.headers)Hi.has(o.toLowerCase())&&(s.headers[o]="REDACTED");return s}let i=null;for(let s in n)Hi.has(s.toLowerCase())&&(i??(i={...n}),i[s]="REDACTED");return i??n});console.log(`OpenAI:DEBUG:${r}`,...t)}}var tu=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)}),Xi=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",ru=r=>typeof r?.get=="function";var Br=(r,e)=>{let t=e.toLowerCase();if(ru(r)){let n=e[0]?.toUpperCase()+e.substring(1).replace(/([^\w])(\w)/g,(i,s,o)=>s+o.toUpperCase());for(let i of[e,t,e.toUpperCase(),n]){let s=r.get(i);if(s)return s}}for(let[n,i]of Object.entries(r))if(n.toLowerCase()===t)return Array.isArray(i)?(i.length<=1||console.warn(`Received ${i.length} entries for the ${e} header, using the first entry.`),i[0]):i};var Zi=r=>{if(typeof Buffer<"u"){let e=Buffer.from(r,"base64");return Array.from(new Float32Array(e.buffer,e.byteOffset,e.length/Float32Array.BYTES_PER_ELEMENT))}else{let e=atob(r),t=e.length,n=new Uint8Array(t);for(let i=0;i<t;i++)n[i]=e.charCodeAt(i);return Array.from(new Float32Array(n.buffer))}};function yr(r){return r!=null&&typeof r=="object"&&!Array.isArray(r)}var ne=class extends hr{constructor(e,t,n,i){supe