oasis-chat 0.2.7 → 0.2.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/dist/index.umd.js CHANGED
@@ -3,5 +3,31 @@
3
3
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Je]=this[Je]={accessors:{}}).accessors,s=this.prototype;function a(c){const u=_(c);r[u]||(Tn(s,c),r[u]=!0)}return f.isArray(t)?t.forEach(a):a(t),this}};p.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),f.reduceDescriptors(p.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),f.freezeMethods(p);function Oe(e,t){const n=this||Q,r=t||n,s=p.from(r.headers);let a=r.data;return f.forEach(e,function(u){a=u.call(n,a,s.normalize(),t?t.status:void 0)}),s.normalize(),a}function Ke(e){return!!(e&&e.__CANCEL__)}function k(e,t,n){P.call(this,e??"canceled",P.ERR_CANCELED,t,n),this.name="CanceledError"}f.inherits(k,P,{__CANCEL__:!0});function Qe(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new P("Request failed with status code "+n.status,[P.ERR_BAD_REQUEST,P.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Yn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Mn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,a=0,c;return t=t!==void 0?t:1e3,function(d){const o=Date.now(),i=r[a];c||(c=o),n[s]=d,r[s]=o;let z=a,w=0;for(;z!==s;)w+=n[z++],z=z%e;if(s=(s+1)%e,s===a&&(a=(a+1)%e),o-c<t)return;const m=i&&o-i;return m?Math.round(w*1e3/m):void 0}}function Gn(e,t){let n=0,r=1e3/t,s,a;const c=(o,i=Date.now())=>{n=i,s=null,a&&(clearTimeout(a),a=null),e(...o)};return[(...o)=>{const i=Date.now(),z=i-n;z>=r?c(o,i):(s=o,a||(a=setTimeout(()=>{a=null,c(s)},r-z)))},()=>s&&c(s)]}const ie=(e,t,n=3)=>{let r=0;const s=Mn(50,250);return Gn(a=>{const c=a.loaded,u=a.lengthComputable?a.total:void 0,d=c-r,o=s(d),i=c<=u;r=c;const z={loaded:c,total:u,progress:u?c/u:void 0,bytes:d,rate:o||void 0,estimated:o&&u&&i?(u-c)/o:void 0,event:a,lengthComputable:u!=null,[t?"download":"upload"]:!0};e(z)},n)},_e=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},$e=e=>(...t)=>f.asap(()=>e(...t)),Wn=b.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,b.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(b.origin),b.navigator&&/(msie|trident)/i.test(b.navigator.userAgent)):()=>!0,gn=b.hasStandardBrowserEnv?{write(e,t,n,r,s,a,c){if(typeof document>"u")return;const u=[`${e}=${encodeURIComponent(t)}`];f.isNumber(n)&&u.push(`expires=${new Date(n).toUTCString()}`),f.isString(r)&&u.push(`path=${r}`),f.isString(s)&&u.push(`domain=${s}`),a===!0&&u.push("secure"),f.isString(c)&&u.push(`SameSite=${c}`),document.cookie=u.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Ln(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function En(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function et(e,t,n){let r=!Ln(t);return e&&(r||n==!1)?En(e,t):t}const tt=e=>e instanceof p?{...e}:e;function E(e,t){t=t||{};const n={};function r(o,i,z,w){return f.isPlainObject(o)&&f.isPlainObject(i)?f.merge.call({caseless:w},o,i):f.isPlainObject(i)?f.merge({},i):f.isArray(i)?i.slice():i}function s(o,i,z,w){if(f.isUndefined(i)){if(!f.isUndefined(o))return r(void 0,o,z,w)}else return r(o,i,z,w)}function a(o,i){if(!f.isUndefined(i))return r(void 0,i)}function c(o,i){if(f.isUndefined(i)){if(!f.isUndefined(o))return r(void 0,o)}else return r(void 0,i)}function u(o,i,z){if(z in t)return r(o,i);if(z in e)return r(void 0,o)}const d={url:a,method:a,data:a,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:u,headers:(o,i,z)=>s(tt(o),tt(i),z,!0)};return f.forEach(Object.keys({...e,...t}),function(i){const z=d[i]||s,w=z(e[i],t[i],i);f.isUndefined(w)&&z!==u||(n[i]=w)}),n}const nt=e=>{const t=E({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:a,headers:c,auth:u}=t;if(t.headers=c=p.from(c),t.url=ke(et(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),u&&c.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):""))),f.isFormData(n)){if(b.hasStandardBrowserEnv||b.hasStandardBrowserWebWorkerEnv)c.setContentType(void 0);else if(f.isFunction(n.getHeaders)){const d=n.getHeaders(),o=["content-type","content-length"];Object.entries(d).forEach(([i,z])=>{o.includes(i.toLowerCase())&&c.set(i,z)})}}if(b.hasStandardBrowserEnv&&(r&&f.isFunction(r)&&(r=r(t)),r||r!==!1&&Wn(t.url))){const d=s&&a&&gn.read(a);d&&c.set(s,d)}return t},Fn=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const s=nt(e);let a=s.data;const c=p.from(s.headers).normalize();let{responseType:u,onUploadProgress:d,onDownloadProgress:o}=s,i,z,w,m,l;function v(){m&&m(),l&&l(),s.cancelToken&&s.cancelToken.unsubscribe(i),s.signal&&s.signal.removeEventListener("abort",i)}let x=new XMLHttpRequest;x.open(s.method.toUpperCase(),s.url,!0),x.timeout=s.timeout;function H(){if(!x)return;const j=p.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders()),T={data:!u||u==="text"||u==="json"?x.responseText:x.response,status:x.status,statusText:x.statusText,headers:j,config:e,request:x};Qe(function(y){n(y),v()},function(y){r(y),v()},T),x=null}"onloadend"in x?x.onloadend=H:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.indexOf("file:")===0)||setTimeout(H)},x.onabort=function(){x&&(r(new P("Request aborted",P.ECONNABORTED,e,x)),x=null)},x.onerror=function(D){const T=D&&D.message?D.message:"Network Error",B=new P(T,P.ERR_NETWORK,e,x);B.event=D||null,r(B),x=null},x.ontimeout=function(){let D=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const T=s.transitional||Se;s.timeoutErrorMessage&&(D=s.timeoutErrorMessage),r(new P(D,T.clarifyTimeoutError?P.ETIMEDOUT:P.ECONNABORTED,e,x)),x=null},a===void 0&&c.setContentType(null),"setRequestHeader"in x&&f.forEach(c.toJSON(),function(D,T){x.setRequestHeader(T,D)}),f.isUndefined(s.withCredentials)||(x.withCredentials=!!s.withCredentials),u&&u!=="json"&&(x.responseType=s.responseType),o&&([w,l]=ie(o,!0),x.addEventListener("progress",w)),d&&x.upload&&([z,m]=ie(d),x.upload.addEventListener("progress",z),x.upload.addEventListener("loadend",m)),(s.cancelToken||s.signal)&&(i=j=>{x&&(r(!j||j.type?new k(null,e,x):j),x.abort(),x=null)},s.cancelToken&&s.cancelToken.subscribe(i),s.signal&&(s.signal.aborted?i():s.signal.addEventListener("abort",i)));const X=Yn(s.url);if(X&&b.protocols.indexOf(X)===-1){r(new P("Unsupported protocol "+X+":",P.ERR_BAD_REQUEST,e));return}x.send(a||null)})},Bn=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const a=function(o){if(!s){s=!0,u();const i=o instanceof Error?o:this.reason;r.abort(i instanceof P?i:new k(i instanceof Error?i.message:i))}};let c=t&&setTimeout(()=>{c=null,a(new P(`timeout ${t} of ms exceeded`,P.ETIMEDOUT))},t);const u=()=>{e&&(c&&clearTimeout(c),c=null,e.forEach(o=>{o.unsubscribe?o.unsubscribe(a):o.removeEventListener("abort",a)}),e=null)};e.forEach(o=>o.addEventListener("abort",a));const{signal:d}=r;return d.unsubscribe=()=>f.asap(u),d}},Vn=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},Rn=async function*(e,t){for await(const n of qn(e))yield*Vn(n,t)},qn=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},rt=(e,t,n,r)=>{const s=Rn(e,t);let a=0,c,u=d=>{c||(c=!0,r&&r(d))};return new ReadableStream({async pull(d){try{const{done:o,value:i}=await s.next();if(o){u(),d.close();return}let z=i.byteLength;if(n){let w=a+=z;n(w)}d.enqueue(new Uint8Array(i))}catch(o){throw u(o),o}},cancel(d){return u(d),s.return()}},{highWaterMark:2})},st=64*1024,{isFunction:fe}=f,Cn=(({Request:e,Response:t})=>({Request:e,Response:t}))(f.global),{ReadableStream:ct,TextEncoder:at}=f.global,it=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Zn=e=>{e=f.merge.call({skipUndefined:!0},Cn,e);const{fetch:t,Request:n,Response:r}=e,s=t?fe(t):typeof fetch=="function",a=fe(n),c=fe(r);if(!s)return!1;const u=s&&fe(ct),d=s&&(typeof at=="function"?(l=>v=>l.encode(v))(new at):async l=>new Uint8Array(await new n(l).arrayBuffer())),o=a&&u&&it(()=>{let l=!1;const v=new n(b.origin,{body:new ct,method:"POST",get duplex(){return l=!0,"half"}}).headers.has("Content-Type");return l&&!v}),i=c&&u&&it(()=>f.isReadableStream(new r("").body)),z={stream:i&&(l=>l.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(l=>{!z[l]&&(z[l]=(v,x)=>{let H=v&&v[l];if(H)return H.call(v);throw new P(`Response type '${l}' is not supported`,P.ERR_NOT_SUPPORT,x)})});const w=async l=>{if(l==null)return 0;if(f.isBlob(l))return l.size;if(f.isSpecCompliantForm(l))return(await new n(b.origin,{method:"POST",body:l}).arrayBuffer()).byteLength;if(f.isArrayBufferView(l)||f.isArrayBuffer(l))return l.byteLength;if(f.isURLSearchParams(l)&&(l=l+""),f.isString(l))return(await d(l)).byteLength},m=async(l,v)=>{const x=f.toFiniteNumber(l.getContentLength());return x??w(v)};return async l=>{let{url:v,method:x,data:H,signal:X,cancelToken:j,timeout:D,onDownloadProgress:T,onUploadProgress:B,responseType:y,headers:ye,withCredentials:le="same-origin",fetchOptions:vt}=nt(l),Pt=t||fetch;y=y?(y+"").toLowerCase():"text";let de=Bn([X,j&&j.toAbortSignal()],D),ee=null;const V=de&&de.unsubscribe&&(()=>{de.unsubscribe()});let wt;try{if(B&&o&&x!=="get"&&x!=="head"&&(wt=await m(ye,H))!==0){let g=new n(v,{method:"POST",body:H,duplex:"half"}),U;if(f.isFormData(H)&&(U=g.headers.get("content-type"))&&ye.setContentType(U),g.body){const[Ae,ze]=_e(wt,ie($e(B)));H=rt(g.body,st,Ae,ze)}}f.isString(le)||(le=le?"include":"omit");const M=a&&"credentials"in n.prototype,Ht={...vt,signal:de,method:x.toUpperCase(),headers:ye.normalize().toJSON(),body:H,duplex:"half",credentials:M?le:void 0};ee=a&&new n(v,Ht);let W=await(a?Pt(ee,vt):Pt(v,Ht));const mt=i&&(y==="stream"||y==="response");if(i&&(T||mt&&V)){const g={};["status","statusText","headers"].forEach(jt=>{g[jt]=W[jt]});const U=f.toFiniteNumber(W.headers.get("content-length")),[Ae,ze]=T&&_e(U,ie($e(T),!0))||[];W=new r(rt(W.body,st,Ae,()=>{ze&&ze(),V&&V()}),g)}y=y||"text";let ur=await z[f.findKey(z,y)||"text"](W,l);return!mt&&V&&V(),await new Promise((g,U)=>{Qe(g,U,{data:ur,headers:p.from(W.headers),status:W.status,statusText:W.statusText,config:l,request:ee})})}catch(M){throw V&&V(),M&&M.name==="TypeError"&&/Load failed|fetch/i.test(M.message)?Object.assign(new P("Network Error",P.ERR_NETWORK,l,ee),{cause:M.cause||M}):P.from(M,M&&M.code,l,ee)}}},kn=new Map,ft=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,a=[r,s,n];let c=a.length,u=c,d,o,i=kn;for(;u--;)d=a[u],o=i.get(d),o===void 0&&i.set(d,o=u?new Map:Zn(t)),i=o;return o};ft();const be={http:zn,xhr:Fn,fetch:{get:ft}};f.forEach(be,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const ut=e=>`- ${e}`,Un=e=>f.isFunction(e)||e===null||e===!1;function Sn(e,t){e=f.isArray(e)?e:[e];const{length:n}=e;let r,s;const a={};for(let c=0;c<n;c++){r=e[c];let u;if(s=r,!Un(r)&&(s=be[(u=String(r)).toLowerCase()],s===void 0))throw new P(`Unknown adapter '${u}'`);if(s&&(f.isFunction(s)||(s=s.get(t))))break;a[u||"#"+c]=s}if(!s){const c=Object.entries(a).map(([d,o])=>`adapter ${d} `+(o===!1?"is not supported by the environment":"is not available in the build"));let u=n?c.length>1?`since :
4
4
  `+c.map(ut).join(`
5
5
  `):" "+ut(c[0]):"as no adapter specified";throw new P("There is no suitable adapter to dispatch the request "+u,"ERR_NOT_SUPPORT")}return s}const ot={getAdapter:Sn,adapters:be};function Xe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new k(null,e)}function lt(e){return Xe(e),e.headers=p.from(e.headers),e.data=Oe.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ot.getAdapter(e.adapter||Q.adapter,e)(e).then(function(r){return Xe(e),r.data=Oe.call(e,e.transformResponse,r),r.headers=p.from(r.headers),r},function(r){return Ke(r)||(Xe(e),r&&r.response&&(r.response.data=Oe.call(e,e.transformResponse,r.response),r.response.headers=p.from(r.response.headers))),Promise.reject(r)})}const dt="1.13.1",ue={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ue[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const zt={};ue.transitional=function(t,n,r){function s(a,c){return"[Axios v"+dt+"] Transitional option '"+a+"'"+c+(r?". "+r:"")}return(a,c,u)=>{if(t===!1)throw new P(s(c," has been removed"+(n?" in "+n:"")),P.ERR_DEPRECATED);return n&&!zt[c]&&(zt[c]=!0,console.warn(s(c," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(a,c,u):!0}},ue.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function In(e,t,n){if(typeof e!="object")throw new P("options must be an object",P.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const a=r[s],c=t[a];if(c){const u=e[a],d=u===void 0||c(u,a,e);if(d!==!0)throw new P("option "+a+" must be "+d,P.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new P("Unknown option "+a,P.ERR_BAD_OPTION)}}const oe={assertOptions:In,validators:ue},Y=oe.validators;let F=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Ue,response:new Ue}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const a=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?a&&!String(r.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(r.stack+=`
6
- `+a):r.stack=a}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=E(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:a}=n;r!==void 0&&oe.assertOptions(r,{silentJSONParsing:Y.transitional(Y.boolean),forcedJSONParsing:Y.transitional(Y.boolean),clarifyTimeoutError:Y.transitional(Y.boolean)},!1),s!=null&&(f.isFunction(s)?n.paramsSerializer={serialize:s}:oe.assertOptions(s,{encode:Y.function,serialize:Y.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),oe.assertOptions(n,{baseUrl:Y.spelling("baseURL"),withXsrfToken:Y.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let c=a&&f.merge(a.common,a[n.method]);a&&f.forEach(["delete","get","head","post","put","patch","common"],l=>{delete a[l]}),n.headers=p.concat(c,a);const u=[];let d=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(n)===!1||(d=d&&v.synchronous,u.unshift(v.fulfilled,v.rejected))});const o=[];this.interceptors.response.forEach(function(v){o.push(v.fulfilled,v.rejected)});let i,z=0,w;if(!d){const l=[lt.bind(this),void 0];for(l.unshift(...u),l.push(...o),w=l.length,i=Promise.resolve(n);z<w;)i=i.then(l[z++],l[z++]);return i}w=u.length;let m=n;for(;z<w;){const l=u[z++],v=u[z++];try{m=l(m)}catch(x){v.call(this,x);break}}try{i=lt.call(this,m)}catch(l){return Promise.reject(l)}for(z=0,w=o.length;z<w;)i=i.then(o[z++],o[z++]);return i}getUri(t){t=E(this.defaults,t);const n=et(t.baseURL,t.url,t.allowAbsoluteUrls);return ke(n,t.params,t.paramsSerializer)}};f.forEach(["delete","get","head","options"],function(t){F.prototype[t]=function(n,r){return this.request(E(r||{},{method:t,url:n,data:(r||{}).data}))}}),f.forEach(["post","put","patch"],function(t){function n(r){return function(a,c,u){return this.request(E(u||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:c}))}}F.prototype[t]=n(),F.prototype[t+"Form"]=n(!0)});let Jn=class Ot{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(s=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](s);r._listeners=null}),this.promise.then=s=>{let a;const c=new Promise(u=>{r.subscribe(u),a=u}).then(s);return c.cancel=function(){r.unsubscribe(a)},c},t(function(a,c,u){r.reason||(r.reason=new k(a,c,u),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Ot(function(s){t=s}),cancel:t}}};function Kn(e){return function(n){return e.apply(null,n)}}function Qn(e){return f.isObject(e)&&e.isAxiosError===!0}const Ne={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ne).forEach(([e,t])=>{Ne[t]=e});function xt(e){const t=new F(e),n=Te(F.prototype.request,t);return f.extend(n,F.prototype,t,{allOwnKeys:!0}),f.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return xt(E(e,s))},n}const O=xt(Q);O.Axios=F,O.CanceledError=k,O.CancelToken=Jn,O.isCancel=Ke,O.VERSION=dt,O.toFormData=ce,O.AxiosError=P,O.Cancel=O.CanceledError,O.all=function(t){return Promise.all(t)},O.spread=Kn,O.isAxiosError=Qn,O.mergeConfig=E,O.AxiosHeaders=p,O.formToJSON=e=>Ie(f.isHTMLForm(e)?new FormData(e):e),O.getAdapter=ot.getAdapter,O.HttpStatusCode=Ne,O.default=O;const{Axios:Pr,AxiosError:wr,CanceledError:Hr,isCancel:mr,CancelToken:jr,VERSION:Or,all:br,Cancel:Xr,isAxiosError:Nr,spread:pr,toFormData:Dr,AxiosHeaders:hr,HttpStatusCode:yr,formToJSON:Ar,getAdapter:Tr,mergeConfig:Yr}=O,_n=e=>{const{exp:t}=e.getState();if(!t)return!1;const n=Math.floor(Date.now()/1e3),r=t-n;return r<=600&&r>0};function $n(e,t){return e.interceptors.request.use(async n=>{var s;if(!((s=n.url)!=null&&s.includes("/auth/user/refresh"))&&_n(t)){const{refreshToken:a}=t.getState();if(!await a()){const{logout:u}=t.getState();return u(),Promise.reject(new Error("토큰 갱신 실패"))}}const{currentWorkspace:r}=t.getState();return r!=null&&r.workspaceId&&(n.headers["current-workspace-id"]=r.workspaceId.toString()),r!=null&&r.workspaceUuid&&(n.headers["current-workspace-uuid"]=r.workspaceUuid),(n.method==="get"||n.method==="post"||n.method==="put")&&(n.timeout=6e5),n},n=>Promise.reject(n)),e.interceptors.response.use(n=>n,n=>{var r,s,a,c,u,d,o;if(n!=null&&n.config&&Object.prototype.hasOwnProperty.call(n.config,"errorHandle")&&!n.config.errorHandle)return Promise.reject(n);if(((r=n.response)==null?void 0:r.status)===401||((s=n.response)==null?void 0:s.status)===403){const{logout:i}=t.getState();i()}else if(n.code==="ECONNABORTED")n.config&&n.config.withCredentials;else if(((a=n.response)==null?void 0:a.status)===400||((c=n.response)==null?void 0:c.status)===402||((u=n.response)==null?void 0:u.status)===412||((d=n.response)==null?void 0:d.status)===500||((o=n.response)==null?void 0:o.status)===503)return Promise.reject(n);return Promise.reject(n)}),e}function er(e){let t="";typeof window<"u"&&window.location&&(t=window.location.origin);const n=O.create({baseURL:t,withCredentials:!0,headers:{Accept:"*/*","Content-Type":"application/json"}});$n(n,e);async function r(u,d={}){const o=await n.get(u,d);return{data:o.data,status:o.status,statusText:o.statusText,headers:o.headers}}async function s(u,d,o={}){const i=await n.post(u,d,o);return{data:i.data,status:i.status,statusText:i.statusText,headers:i.headers}}async function a(u,d,o={}){const i=await n.put(u,d,o);return{data:i.data,status:i.status,statusText:i.statusText,headers:i.headers}}async function c(u,d={}){const o=await n.delete(u,d);return{data:o.data,status:o.status,statusText:o.statusText,headers:o.headers}}return{get:r,post:s,put:a,delete:c,defaults:{headers:{common:{}}}}}class tr{constructor(t){this.httpClient=t}async login(t){return(await this.httpClient.post("/oasis/auth/user/login",t)).data.data}async my(){return(await this.httpClient.get("/oasis/auth/user/info")).data.data}async logout(){await this.httpClient.post("/oasis/auth/user/logout")}async refresh(){return(await this.httpClient.post("/oasis/auth/user/refresh")).data.data}async assistantUser(){return(await this.httpClient.get("/oasis/portal/assistant/user")).data.data}async assistantInfo(t){return(await this.httpClient.get("/oasis/portal/assistant?uuid="+t)).data.data}async assistantChatInfo(t){return(await this.httpClient.get("/oasis/portal/assistant/"+t+"/chat-info")).data.data}async createAssistant(t){return(await this.httpClient.post("/oasis/portal/assistant",t)).data.data}async updateAssistant(t,n){return(await this.httpClient.post("/oasis/portal/assistant/"+t,n)).data.data}async deleteAssistant(t){return(await this.httpClient.delete("/oasis/portal/assistant/"+t)).data.data}async getAssistantVisibility(t){return(await this.httpClient.get("/oasis/portal/assistant/"+t+"/users")).data.data}async saveAssistantVisibility(t,n){return(await this.httpClient.post("/oasis/portal/assistant/"+t+"/users",n)).data.data}async modelInfos(){return(await this.httpClient.get("/oasis/portal/assistant/models")).data.data}async mcpServers(){return(await this.httpClient.get("/oasis/portal/assistant/mcp-servers")).data.data}async searchUsers(t){return(await this.httpClient.get("/oasis/portal/user/search?keyword="+t)).data.data}}function nr(e){return new tr(e)}async function rr(e,t,n){try{const{authStore:r,portalClient:s}=n,a=await s.login({account_id:e,password:t}),{login:c,authMe:u}=r.getState();c(a);const d=await s.my();return u(d),!0}catch(r){return console.error("로그인 실패:",r),!1}}async function sr(){const e=await fetch("/src/app/components/organisms/ChatWindow.html");if(!e.ok)throw new Error(`Failed to load ChatWindow template: ${e.statusText}`);return await e.text()}function G(e,t){e.className=h(t)}async function cr(e){let t=!1;const n=await sr(),r=document.createElement("div");r.innerHTML=n.trim();const s=r.firstElementChild;G(s,["absolute bottom-full right-0 mb-2 bg-blue-200","w-96 h-[500px]","bg-white rounded-lg shadow-2xl","flex flex-col","hidden"]);const a=s.querySelector(".chat-window-header");G(a,["flex items-center justify-between","p-4 border-b border-gray-200","bg-gray-50 rounded-t-lg"]);const c=s.querySelector(".chat-window-title");G(c,"text-lg font-semibold text-gray-800");const u=s.querySelector(".chat-close-btn");G(u,["w-8 h-8","flex items-center justify-center","text-gray-500 hover:text-gray-700","rounded-full hover:bg-gray-200","chat-close-btn"]);const d=s.querySelector(".chat-messages");G(d,["flex-1 overflow-y-auto p-4 space-y-4","bg-white","chat-messages"]);const o=s.querySelector(".chat-window-footer");G(o,["p-4 border-t border-gray-200","bg-gray-50 rounded-b-lg"]);const i=s.querySelector(".chat-input-container");G(i,"flex gap-2");const z=s.querySelector(".chat-input");G(z,["flex-1 px-4 py-2","border border-gray-300 rounded-lg","focus:outline-none focus:ring-2 focus:ring-blue-500","chat-input"]);const w=s.querySelector(".chat-send-btn");G(w,["px-4 py-2","bg-blue-500 text-white rounded-lg","hover:bg-blue-600","disabled:bg-gray-300 disabled:cursor-not-allowed","chat-send-btn"]),u.addEventListener("click",()=>{s.classList.add("hidden"),t=!1});const m=()=>{const v=z.value.trim();if(!v)return;const x=document.createElement("div");x.className=h("flex justify-end");const H=document.createElement("div");H.className=h("max-w-[80%] px-4 py-2","bg-blue-500 text-white rounded-lg"),H.textContent=v,x.appendChild(H),d.appendChild(x),d.scrollTop=d.scrollHeight,z.value="",setTimeout(()=>{const X=document.createElement("div");X.className=h("flex justify-start");const j=document.createElement("div");j.className=h("max-w-[80%] px-4 py-2","bg-gray-200 text-gray-800 rounded-lg"),j.textContent="안녕하세요! 도움이 필요하시면 언제든 말씀해주세요.",X.appendChild(j),d.appendChild(X),d.scrollTop=d.scrollHeight},500)};return w.addEventListener("click",m),z.addEventListener("keypress",v=>{v.key==="Enter"&&m()}),{openChat:()=>{if(t){s.classList.remove("hidden");return}s.classList.remove("hidden"),t=!0,e&&!e.contains(s)&&e.appendChild(s)},chatWindow:s}}let $=null,pe=null,De=null,he=null;function ar(){return $||($=ht(),pe=er($),De=nr(pe),$.setPortalClient(De)),{authStore:$,httpClient:pe,portalClient:De}}async function ir(e,t){const n=ar(),r=await rr(e,t,n);if(r){const{authStore:s}=n,a=s.getState();console.log("로그인 성공:",a.userName||a.accountId)}return r}function fr({account_id:e,password:t,assistant_uuid:n}={}){const r=document.createElement("div");r.className=h("relative");const s=document.createElement("button");s.type="button",s.className=h("relative bg-orange-200");const a=document.createElement("img");return a.src=bt,a.alt="Button",a.className=h("w-12 h-12","rounded-full"),s.appendChild(a),r.appendChild(s),s.addEventListener("click",async c=>{c.preventDefault(),he||(he=await cr(r)),he.openChat()}),e&&t&&(async()=>(s.disabled=!0,s.style.opacity="0.5",s.style.cursor="wait",ir(e,t).then(c=>{c?(s.disabled=!1,s.style.opacity="",s.style.cursor=""):(console.error("로그인 실패"),s.disabled=!0,s.style.opacity="0.3",s.title="로그인 실패")}).catch(c=>{console.error("로그인 처리 중 오류:",c),s.disabled=!0,s.style.opacity="0.3",s.title="로그인 오류"})))(),r}R.createButton=fr,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
6
+ `+a):r.stack=a}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=E(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:a}=n;r!==void 0&&oe.assertOptions(r,{silentJSONParsing:Y.transitional(Y.boolean),forcedJSONParsing:Y.transitional(Y.boolean),clarifyTimeoutError:Y.transitional(Y.boolean)},!1),s!=null&&(f.isFunction(s)?n.paramsSerializer={serialize:s}:oe.assertOptions(s,{encode:Y.function,serialize:Y.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),oe.assertOptions(n,{baseUrl:Y.spelling("baseURL"),withXsrfToken:Y.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let c=a&&f.merge(a.common,a[n.method]);a&&f.forEach(["delete","get","head","post","put","patch","common"],l=>{delete a[l]}),n.headers=p.concat(c,a);const u=[];let d=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(n)===!1||(d=d&&v.synchronous,u.unshift(v.fulfilled,v.rejected))});const o=[];this.interceptors.response.forEach(function(v){o.push(v.fulfilled,v.rejected)});let i,z=0,w;if(!d){const l=[lt.bind(this),void 0];for(l.unshift(...u),l.push(...o),w=l.length,i=Promise.resolve(n);z<w;)i=i.then(l[z++],l[z++]);return i}w=u.length;let m=n;for(;z<w;){const l=u[z++],v=u[z++];try{m=l(m)}catch(x){v.call(this,x);break}}try{i=lt.call(this,m)}catch(l){return Promise.reject(l)}for(z=0,w=o.length;z<w;)i=i.then(o[z++],o[z++]);return i}getUri(t){t=E(this.defaults,t);const n=et(t.baseURL,t.url,t.allowAbsoluteUrls);return ke(n,t.params,t.paramsSerializer)}};f.forEach(["delete","get","head","options"],function(t){F.prototype[t]=function(n,r){return this.request(E(r||{},{method:t,url:n,data:(r||{}).data}))}}),f.forEach(["post","put","patch"],function(t){function n(r){return function(a,c,u){return this.request(E(u||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:c}))}}F.prototype[t]=n(),F.prototype[t+"Form"]=n(!0)});let Jn=class Ot{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(s=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](s);r._listeners=null}),this.promise.then=s=>{let a;const c=new Promise(u=>{r.subscribe(u),a=u}).then(s);return c.cancel=function(){r.unsubscribe(a)},c},t(function(a,c,u){r.reason||(r.reason=new k(a,c,u),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Ot(function(s){t=s}),cancel:t}}};function Kn(e){return function(n){return e.apply(null,n)}}function Qn(e){return f.isObject(e)&&e.isAxiosError===!0}const Ne={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ne).forEach(([e,t])=>{Ne[t]=e});function xt(e){const t=new F(e),n=Te(F.prototype.request,t);return f.extend(n,F.prototype,t,{allOwnKeys:!0}),f.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return xt(E(e,s))},n}const O=xt(Q);O.Axios=F,O.CanceledError=k,O.CancelToken=Jn,O.isCancel=Ke,O.VERSION=dt,O.toFormData=ce,O.AxiosError=P,O.Cancel=O.CanceledError,O.all=function(t){return Promise.all(t)},O.spread=Kn,O.isAxiosError=Qn,O.mergeConfig=E,O.AxiosHeaders=p,O.formToJSON=e=>Ie(f.isHTMLForm(e)?new FormData(e):e),O.getAdapter=ot.getAdapter,O.HttpStatusCode=Ne,O.default=O;const{Axios:Pr,AxiosError:wr,CanceledError:Hr,isCancel:mr,CancelToken:jr,VERSION:Or,all:br,Cancel:Xr,isAxiosError:Nr,spread:pr,toFormData:Dr,AxiosHeaders:hr,HttpStatusCode:yr,formToJSON:Ar,getAdapter:Tr,mergeConfig:Yr}=O,_n=e=>{const{exp:t}=e.getState();if(!t)return!1;const n=Math.floor(Date.now()/1e3),r=t-n;return r<=600&&r>0};function $n(e,t){return e.interceptors.request.use(async n=>{var s;if(!((s=n.url)!=null&&s.includes("/auth/user/refresh"))&&_n(t)){const{refreshToken:a}=t.getState();if(!await a()){const{logout:u}=t.getState();return u(),Promise.reject(new Error("토큰 갱신 실패"))}}const{currentWorkspace:r}=t.getState();return r!=null&&r.workspaceId&&(n.headers["current-workspace-id"]=r.workspaceId.toString()),r!=null&&r.workspaceUuid&&(n.headers["current-workspace-uuid"]=r.workspaceUuid),(n.method==="get"||n.method==="post"||n.method==="put")&&(n.timeout=6e5),n},n=>Promise.reject(n)),e.interceptors.response.use(n=>n,n=>{var r,s,a,c,u,d,o;if(n!=null&&n.config&&Object.prototype.hasOwnProperty.call(n.config,"errorHandle")&&!n.config.errorHandle)return Promise.reject(n);if(((r=n.response)==null?void 0:r.status)===401||((s=n.response)==null?void 0:s.status)===403){const{logout:i}=t.getState();i()}else if(n.code==="ECONNABORTED")n.config&&n.config.withCredentials;else if(((a=n.response)==null?void 0:a.status)===400||((c=n.response)==null?void 0:c.status)===402||((u=n.response)==null?void 0:u.status)===412||((d=n.response)==null?void 0:d.status)===500||((o=n.response)==null?void 0:o.status)===503)return Promise.reject(n);return Promise.reject(n)}),e}function er(e){let t="";typeof window<"u"&&window.location&&(t=window.location.origin);const n=O.create({baseURL:t,withCredentials:!0,headers:{Accept:"*/*","Content-Type":"application/json"}});$n(n,e);async function r(u,d={}){const o=await n.get(u,d);return{data:o.data,status:o.status,statusText:o.statusText,headers:o.headers}}async function s(u,d,o={}){const i=await n.post(u,d,o);return{data:i.data,status:i.status,statusText:i.statusText,headers:i.headers}}async function a(u,d,o={}){const i=await n.put(u,d,o);return{data:i.data,status:i.status,statusText:i.statusText,headers:i.headers}}async function c(u,d={}){const o=await n.delete(u,d);return{data:o.data,status:o.status,statusText:o.statusText,headers:o.headers}}return{get:r,post:s,put:a,delete:c,defaults:{headers:{common:{}}}}}class tr{constructor(t){this.httpClient=t}async login(t){return(await this.httpClient.post("/oasis/auth/user/login",t)).data.data}async my(){return(await this.httpClient.get("/oasis/auth/user/info")).data.data}async logout(){await this.httpClient.post("/oasis/auth/user/logout")}async refresh(){return(await this.httpClient.post("/oasis/auth/user/refresh")).data.data}async assistantUser(){return(await this.httpClient.get("/oasis/portal/assistant/user")).data.data}async assistantInfo(t){return(await this.httpClient.get("/oasis/portal/assistant?uuid="+t)).data.data}async assistantChatInfo(t){return(await this.httpClient.get("/oasis/portal/assistant/"+t+"/chat-info")).data.data}async createAssistant(t){return(await this.httpClient.post("/oasis/portal/assistant",t)).data.data}async updateAssistant(t,n){return(await this.httpClient.post("/oasis/portal/assistant/"+t,n)).data.data}async deleteAssistant(t){return(await this.httpClient.delete("/oasis/portal/assistant/"+t)).data.data}async getAssistantVisibility(t){return(await this.httpClient.get("/oasis/portal/assistant/"+t+"/users")).data.data}async saveAssistantVisibility(t,n){return(await this.httpClient.post("/oasis/portal/assistant/"+t+"/users",n)).data.data}async modelInfos(){return(await this.httpClient.get("/oasis/portal/assistant/models")).data.data}async mcpServers(){return(await this.httpClient.get("/oasis/portal/assistant/mcp-servers")).data.data}async searchUsers(t){return(await this.httpClient.get("/oasis/portal/user/search?keyword="+t)).data.data}}function nr(e){return new tr(e)}async function rr(e,t,n){try{const{authStore:r,portalClient:s}=n,a=await s.login({account_id:e,password:t}),{login:c,authMe:u}=r.getState();c(a);const d=await s.my();return u(d),!0}catch(r){return console.error("로그인 실패:",r),!1}}const sr=`<div class="chat-window-root" style="z-index: 1000;">
7
+ <!-- 헤더 -->
8
+ <div class="chat-window-header">
9
+ <h3 class="chat-window-title">채팅</h3>
10
+ <button
11
+ class="chat-close-btn"
12
+ style="font-size: 24px;"
13
+ >×</button>
14
+ </div>
15
+
16
+ <!-- 메시지 영역 -->
17
+ <div class="chat-messages"></div>
18
+
19
+ <!-- 입력 영역 -->
20
+ <div class="chat-window-footer">
21
+ <div class="chat-input-container">
22
+ <input
23
+ type="text"
24
+ placeholder="메시지를 입력하세요..."
25
+ class="chat-input"
26
+ />
27
+ <button class="chat-send-btn">전송</button>
28
+ </div>
29
+ </div>
30
+ </div>
31
+
32
+ `;function G(e,t){e.className=h(t)}function cr(e){let t=!1;const n=sr,r=document.createElement("div");r.innerHTML=n.trim();const s=r.firstElementChild;if(!s)throw new Error("Failed to create chat window: template is empty");G(s,["absolute bottom-full right-0 mb-2 bg-blue-200","w-96 h-[500px]","bg-white rounded-lg shadow-2xl","flex flex-col","hidden"]);const a=s.querySelector(".chat-window-header");a&&G(a,["flex items-center justify-between","p-4 border-b border-gray-200","bg-gray-50 rounded-t-lg"]);const c=s.querySelector(".chat-window-title");c&&G(c,"text-lg font-semibold text-gray-800");const u=s.querySelector(".chat-close-btn");u&&G(u,["w-8 h-8","flex items-center justify-center","text-gray-500 hover:text-gray-700","rounded-full hover:bg-gray-200","chat-close-btn"]);const d=s.querySelector(".chat-messages");d&&G(d,["flex-1 overflow-y-auto p-4 space-y-4","bg-white","chat-messages"]);const o=s.querySelector(".chat-window-footer");o&&G(o,["p-4 border-t border-gray-200","bg-gray-50 rounded-b-lg"]);const i=s.querySelector(".chat-input-container");i&&G(i,"flex gap-2");const z=s.querySelector(".chat-input");z&&G(z,["flex-1 px-4 py-2","border border-gray-300 rounded-lg","focus:outline-none focus:ring-2 focus:ring-blue-500","chat-input"]);const w=s.querySelector(".chat-send-btn");if(w&&G(w,["px-4 py-2","bg-blue-500 text-white rounded-lg","hover:bg-blue-600","disabled:bg-gray-300 disabled:cursor-not-allowed","chat-send-btn"]),!u||!d||!z||!w)throw new Error("Failed to create chat window: required elements not found");u.addEventListener("click",()=>{s.classList.add("hidden"),t=!1});const m=()=>{const v=z.value.trim();if(!v)return;const x=document.createElement("div");x.className=h("flex justify-end");const H=document.createElement("div");H.className=h("max-w-[80%] px-4 py-2","bg-blue-500 text-white rounded-lg"),H.textContent=v,x.appendChild(H),d.appendChild(x),d.scrollTop=d.scrollHeight,z.value="",setTimeout(()=>{const X=document.createElement("div");X.className=h("flex justify-start");const j=document.createElement("div");j.className=h("max-w-[80%] px-4 py-2","bg-gray-200 text-gray-800 rounded-lg"),j.textContent="안녕하세요! 도움이 필요하시면 언제든 말씀해주세요.",X.appendChild(j),d.appendChild(X),d.scrollTop=d.scrollHeight},500)};return w.addEventListener("click",m),z.addEventListener("keypress",v=>{v.key==="Enter"&&m()}),{openChat:()=>{if(t){s.classList.remove("hidden");return}s.classList.remove("hidden"),t=!0,e&&!e.contains(s)&&e.appendChild(s)},chatWindow:s}}let $=null,pe=null,De=null,he=null;function ar(){return $||($=ht(),pe=er($),De=nr(pe),$.setPortalClient(De)),{authStore:$,httpClient:pe,portalClient:De}}async function ir(e,t){const n=ar(),r=await rr(e,t,n);if(r){const{authStore:s}=n,a=s.getState();console.log("로그인 성공:",a.userName||a.accountId)}return r}function fr({account_id:e,password:t,assistant_uuid:n}={}){const r=document.createElement("div");r.className=h("relative");const s=document.createElement("button");s.type="button",s.className=h("relative bg-orange-200");const a=document.createElement("img");return a.src=bt,a.alt="Button",a.className=h("w-12 h-12","rounded-full"),s.appendChild(a),r.appendChild(s),s.addEventListener("click",c=>{c.preventDefault(),he||(he=cr(r)),he.openChat()}),e&&t&&(async()=>(s.disabled=!0,s.style.opacity="0.5",s.style.cursor="wait",ir(e,t).then(c=>{c?(s.disabled=!1,s.style.opacity="",s.style.cursor=""):(console.error("로그인 실패"),s.disabled=!0,s.style.opacity="0.3",s.title="로그인 실패")}).catch(c=>{console.error("로그인 처리 중 오류:",c),s.disabled=!0,s.style.opacity="0.3",s.title="로그인 오류"})))(),r}R.createButton=fr,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
7
33
  //# sourceMappingURL=index.umd.js.map