tj
2025-06-05 bba272999cc546f65781bf3d20245a3f819af67f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
(self["webpackChunklin_cms_vue"]=self["webpackChunklin_cms_vue"]||[]).push([[2244,2239,1789],{40377:function(e,t){var n,o,r;
/** @license
 * eventsource.js
 * Available under MIT License (MIT)
 * https://github.com/Yaffle/EventSource/
 */(function(i){"use strict";var s=i.setTimeout,a=i.clearTimeout,c=i.XMLHttpRequest,u=i.XDomainRequest,d=i.ActiveXObject,f=i.EventSource,l=i.document,p=i.Promise,h=i.fetch,v=i.Response,y=i.TextDecoder,g=i.TextEncoder,m=i.AbortController;if("undefined"===typeof window||"undefined"===typeof l||"readyState"in l||null!=l.body||(l.readyState="loading",window.addEventListener("load",(function(e){l.readyState="complete"}),!1)),null==c&&null!=d&&(c=function(){return new d("Microsoft.XMLHTTP")}),void 0==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),void 0==m){var w=h;h=function(e,t){var n=t.signal;return w(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then((function(e){var t=e.body.getReader();return n._reader=t,n._aborted&&n._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}}))},m=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function b(){this.bitsNeeded=0,this.codePoint=0}b.prototype.decode=function(e){function t(e,t,n){if(1===n)return e>=128>>t&&e<<t<=2047;if(2===n)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===n)return e>=65536>>t&&e<<t<=1114111;throw new Error}function n(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var o=65533,r="",i=this.bitsNeeded,s=this.codePoint,a=0;a<e.length;a+=1){var c=e[a];0!==i&&(c<128||c>191||!t(s<<6|63&c,i-6,n(i,s)))&&(i=0,s=o,r+=String.fromCharCode(s)),0===i?(c>=0&&c<=127?(i=0,s=c):c>=192&&c<=223?(i=6,s=31&c):c>=224&&c<=239?(i=12,s=15&c):c>=240&&c<=247?(i=18,s=7&c):(i=0,s=o),0===i||t(s,i,n(i,s))||(i=0,s=o)):(i-=6,s=s<<6|63&c),0===i&&(s<=65535?r+=String.fromCharCode(s):(r+=String.fromCharCode(55296+(s-65535-1>>10)),r+=String.fromCharCode(56320+(s-65535-1&1023))))}return this.bitsNeeded=i,this.codePoint=s,r};var E=function(){try{return"test"===(new y).decode((new g).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1};void 0!=y&&void 0!=g&&E()||(y=b);var C=function(){};function S(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=C,this.onload=C,this.onerror=C,this.onreadystatechange=C,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=C}function T(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function _(e){for(var t=Object.create(null),n=e.split("\r\n"),o=0;o<n.length;o+=1){var r=n[o],i=r.split(": "),s=i.shift(),a=i.join(": ");t[T(s)]=a}this._map=t}function x(){}function A(e){this._headers=e}function R(){}function O(){this._listeners=Object.create(null)}function D(e){s((function(){throw e}),0)}function k(e){this.type=e,this.target=void 0}function N(e,t){k.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function I(e,t){k.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function j(e,t){k.call(this,e),this.error=t.error}S.prototype.open=function(e,t){this._abort(!0);var n=this,o=this._xhr,r=1,i=0;this._abort=function(e){0!==n._sendTimeout&&(a(n._sendTimeout),n._sendTimeout=0),1!==r&&2!==r&&3!==r||(r=4,o.onload=C,o.onerror=C,o.onabort=C,o.onprogress=C,o.onreadystatechange=C,o.abort(),0!==i&&(a(i),i=0),e||(n.readyState=4,n.onabort(null),n.onreadystatechange())),r=0};var u=function(){if(1===r){var e=0,t="",i=void 0;if("contentType"in o)e=200,t="OK",i=o.contentType;else try{e=o.status,t=o.statusText,i=o.getResponseHeader("Content-Type")}catch(s){e=0,t="",i=void 0}0!==e&&(r=2,n.readyState=2,n.status=e,n.statusText=t,n._contentType=i,n.onreadystatechange())}},d=function(){if(u(),2===r||3===r){r=3;var e="";try{e=o.responseText}catch(t){}n.readyState=3,n.responseText=e,n.onprogress()}},f=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:C}),d(),1===r||2===r||3===r){if(r=4,0!==i&&(a(i),i=0),n.readyState=4,"load"===e)n.onload(t);else if("error"===e)n.onerror(t);else{if("abort"!==e)throw new TypeError;n.onabort(t)}n.onreadystatechange()}},l=function(e){void 0!=o&&(4===o.readyState?"onload"in o&&"onerror"in o&&"onabort"in o||f(""===o.responseText?"error":"load",e):3===o.readyState?"onprogress"in o||d():2===o.readyState&&u())},p=function(){i=s((function(){p()}),500),3===o.readyState&&d()};"onload"in o&&(o.onload=function(e){f("load",e)}),"onerror"in o&&(o.onerror=function(e){f("error",e)}),"onabort"in o&&(o.onabort=function(e){f("abort",e)}),"onprogress"in o&&(o.onprogress=d),"onreadystatechange"in o&&(o.onreadystatechange=function(e){l(e)}),!("contentType"in o)&&"ontimeout"in c.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),o.open(e,t,!0),"readyState"in o&&(i=s((function(){p()}),0))},S.prototype.abort=function(){this._abort(!1)},S.prototype.getResponseHeader=function(e){return this._contentType},S.prototype.setRequestHeader=function(e,t){var n=this._xhr;"setRequestHeader"in n&&n.setRequestHeader(e,t)},S.prototype.getAllResponseHeaders=function(){return void 0!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},S.prototype.send=function(){if("ontimeout"in c.prototype&&("sendAsBinary"in c.prototype||"mozAnon"in c.prototype)||void 0==l||void 0==l.readyState||"complete"===l.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(n){throw n}}else{var t=this;t._sendTimeout=s((function(){t._sendTimeout=0,t.send()}),4)}},_.prototype.get=function(e){return this._map[T(e)]},null!=c&&null==c.HEADERS_RECEIVED&&(c.HEADERS_RECEIVED=2),x.prototype.open=function(e,t,n,o,r,i,s){e.open("GET",r);var a=0;for(var u in e.onprogress=function(){var t=e.responseText,o=t.slice(a);a+=o.length,n(o)},e.onerror=function(e){e.preventDefault(),o(new Error("NetworkError"))},e.onload=function(){o(null)},e.onabort=function(){o(null)},e.onreadystatechange=function(){if(e.readyState===c.HEADERS_RECEIVED){var n=e.status,o=e.statusText,r=e.getResponseHeader("Content-Type"),i=e.getAllResponseHeaders();t(n,o,r,new _(i))}},e.withCredentials=i,s)Object.prototype.hasOwnProperty.call(s,u)&&e.setRequestHeader(u,s[u]);return e.send(),e},A.prototype.get=function(e){return this._headers.get(e)},R.prototype.open=function(e,t,n,o,r,i,s){var a=null,c=new m,u=c.signal,d=new y;return h(r,{headers:s,credentials:i?"include":"same-origin",signal:u,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new A(e.headers)),new p((function(e,t){var o=function(){a.read().then((function(t){if(t.done)e(void 0);else{var r=d.decode(t.value,{stream:!0});n(r),o()}}))["catch"]((function(e){t(e)}))};o()}))}))["catch"]((function(e){return"AbortError"===e.name?void 0:e})).then((function(e){o(e)})),{abort:function(){null!=a&&a.cancel(),c.abort()}}},O.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(void 0!=t)for(var n=t.length,o=0;o<n;o+=1){var r=t[o];try{"function"===typeof r.handleEvent?r.handleEvent(e):r.call(this,e)}catch(i){D(i)}}},O.prototype.addEventListener=function(e,t){e=String(e);var n=this._listeners,o=n[e];void 0==o&&(o=[],n[e]=o);for(var r=!1,i=0;i<o.length;i+=1)o[i]===t&&(r=!0);r||o.push(t)},O.prototype.removeEventListener=function(e,t){e=String(e);var n=this._listeners,o=n[e];if(void 0!=o){for(var r=[],i=0;i<o.length;i+=1)o[i]!==t&&r.push(o[i]);0===r.length?delete n[e]:n[e]=r}},N.prototype=Object.create(k.prototype),I.prototype=Object.create(k.prototype),j.prototype=Object.create(k.prototype);var H=-1,P=0,L=1,U=2,B=-1,M=0,q=1,G=2,J=3,X=/^text\/event\-stream(;.*)?$/i,$=1e3,V=18e6,z=function(e,t){var n=null==e?t:parseInt(e,10);return n!==n&&(n=t),F(n)},F=function(e){return Math.min(Math.max(e,$),V)},K=function(e,t,n){try{"function"===typeof t&&t.call(e,n)}catch(o){D(o)}};function Z(e,t){O.call(this),t=t||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,Y(this,e,t)}function Q(){return void 0!=c&&"withCredentials"in c.prototype||void 0==u?new c:new u}var W=void 0!=h&&void 0!=v&&"body"in v.prototype;function Y(e,t,n){t=String(t);var o=Boolean(n.withCredentials),r=n.lastEventIdQueryParameterName||"lastEventId",i=F(1e3),c=z(n.heartbeatTimeout,45e3),u="",d=i,f=!1,l=0,p=n.headers||{},h=n.Transport,v=W&&void 0==h?void 0:new S(void 0!=h?new h:Q()),y=null!=h&&"string"!==typeof h?new h:void 0==v?new R:new x,g=void 0,m=0,w=H,b="",E="",C="",T="",_=M,A=0,O=0,D=function(t,n,o,r){if(w===P)if(200===t&&void 0!=o&&X.test(o)){w=L,f=Date.now(),d=i,e.readyState=L;var s=new I("open",{status:t,statusText:n,headers:r});e.dispatchEvent(s),K(e,e.onopen,s)}else{var a="";200!==t?(n&&(n=n.replace(/\s+/g," ")),a="EventSource's response has a status "+t+" "+n+" that is not 200. Aborting the connection."):a="EventSource's response has a Content-Type specifying an unsupported type: "+(void 0==o?"-":o.replace(/\s+/g," "))+". Aborting the connection.",V();s=new I("error",{status:t,statusText:n,headers:r});e.dispatchEvent(s),K(e,e.onerror,s),console.error(a)}},k=function(t){if(w===L){for(var n=-1,o=0;o<t.length;o+=1){var r=t.charCodeAt(o);r!=="\n".charCodeAt(0)&&r!=="\r".charCodeAt(0)||(n=o)}var p=(-1!==n?T:"")+t.slice(0,n+1);T=(-1===n?T:"")+t.slice(n+1),""!==t&&(f=Date.now(),l+=t.length);for(var h=0;h<p.length;h+=1){r=p.charCodeAt(h);if(_===B&&r==="\n".charCodeAt(0))_=M;else if(_===B&&(_=M),r==="\r".charCodeAt(0)||r==="\n".charCodeAt(0)){if(_!==M){_===q&&(O=h+1);var v=p.slice(A,O-1),y=p.slice(O+(O<h&&p.charCodeAt(O)===" ".charCodeAt(0)?1:0),h);"data"===v?(b+="\n",b+=y):"id"===v?E=y:"event"===v?C=y:"retry"===v?(i=z(y,i),d=i):"heartbeatTimeout"===v&&(c=z(y,c),0!==m&&(a(m),m=s((function(){Z()}),c)))}if(_===M){if(""!==b){u=E,""===C&&(C="message");var g=new N(C,{data:b.slice(1),lastEventId:E});if(e.dispatchEvent(g),"open"===C?K(e,e.onopen,g):"message"===C?K(e,e.onmessage,g):"error"===C&&K(e,e.onerror,g),w===U)return}b="",C=""}_=r==="\r".charCodeAt(0)?B:M}else _===M&&(A=h,_=q),_===q?r===":".charCodeAt(0)&&(O=h+1,_=G):_===G&&(_=J)}}},$=function(t){if(w===L||w===P){w=H,0!==m&&(a(m),m=0),m=s((function(){Z()}),d),d=F(Math.min(16*i,2*d)),e.readyState=P;var n=new j("error",{error:t});e.dispatchEvent(n),K(e,e.onerror,n),void 0!=t&&console.error(t)}},V=function(){w=U,void 0!=g&&(g.abort(),g=void 0),0!==m&&(a(m),m=0),e.readyState=U},Z=function(){if(m=0,w===H){f=!1,l=0,m=s((function(){Z()}),c),w=P,b="",C="",E=u,T="",A=0,O=0,_=M;var n=t;if("data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==u){var o=t.indexOf("?");n=-1===o?t:t.slice(0,o+1)+t.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(e,t){return t===r?"":e})),n+=(-1===t.indexOf("?")?"?":"&")+r+"="+encodeURIComponent(u)}var i=e.withCredentials,a={Accept:"text/event-stream"},d=e.headers;if(void 0!=d)for(var p in d)Object.prototype.hasOwnProperty.call(d,p)&&(a[p]=d[p]);try{g=y.open(v,D,k,$,n,i,a)}catch(S){throw V(),S}}else if(f||void 0==g){var h=Math.max((f||Date.now())+c-Date.now(),1);f=!1,m=s((function(){Z()}),h)}else $(new Error("No activity within "+c+" milliseconds. "+(w===P?"No response received.":l+" chars received.")+" Reconnecting.")),void 0!=g&&(g.abort(),g=void 0)};e.url=t,e.readyState=P,e.withCredentials=o,e.headers=p,e._close=V,Z()}Z.prototype=Object.create(O.prototype),Z.prototype.CONNECTING=P,Z.prototype.OPEN=L,Z.prototype.CLOSED=U,Z.prototype.close=function(){this._close()},Z.CONNECTING=P,Z.OPEN=L,Z.CLOSED=U,Z.prototype.withCredentials=void 0;var ee=f;void 0==c||void 0!=f&&"withCredentials"in f.prototype||(ee=Z),function(i){if("object"===typeof e.exports){var s=i(t);void 0!==s&&(e.exports=s)}else o=[t],n=i,r="function"===typeof n?n.apply(t,o):n,void 0===r||(e.exports=r)}((function(e){e.EventSourcePolyfill=Z,e.NativeEventSource=f,e.EventSource=ee}))})("undefined"===typeof globalThis?"undefined"!==typeof window?window:"undefined"!==typeof self?self:this:globalThis)},12215:function(e,t,n){var o,r;
/*!
 * JavaScript Cookie v2.2.1
 * https://github.com/js-cookie/js-cookie
 *
 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
 * Released under the MIT license
 */(function(i){var s;if(o=i,r="function"===typeof o?o.call(t,n,t,e):o,void 0===r||(e.exports=r),s=!0,e.exports=i(),s=!0,!s){var a=window.Cookies,c=window.Cookies=i();c.noConflict=function(){return window.Cookies=a,c}}})((function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var o in n)t[o]=n[o]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}function n(o){function r(){}function i(t,n,i){if("undefined"!==typeof document){i=e({path:"/"},r.defaults,i),"number"===typeof i.expires&&(i.expires=new Date(1*new Date+864e5*i.expires)),i.expires=i.expires?i.expires.toUTCString():"";try{var s=JSON.stringify(n);/^[\{\[]/.test(s)&&(n=s)}catch(u){}n=o.write?o.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var c in i)i[c]&&(a+="; "+c,!0!==i[c]&&(a+="="+i[c].split(";")[0]));return document.cookie=t+"="+n+a}}function s(e,n){if("undefined"!==typeof document){for(var r={},i=document.cookie?document.cookie.split("; "):[],s=0;s<i.length;s++){var a=i[s].split("="),c=a.slice(1).join("=");n||'"'!==c.charAt(0)||(c=c.slice(1,-1));try{var u=t(a[0]);if(c=(o.read||o)(c,u)||t(c),n)try{c=JSON.parse(c)}catch(d){}if(r[u]=c,e===u)break}catch(d){}}return e?r[e]:r}}return r.set=i,r.get=function(e){return s(e,!1)},r.getJSON=function(e){return s(e,!0)},r.remove=function(t,n){i(t,"",e(n,{expires:-1}))},r.defaults={},r.withConverter=n,r}return n((function(){}))}))},92244:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return a}});var o=n(91114),r=n(96557),i=n(34642),s=n(61789);class a{constructor(e){(0,o.A)(this,"url",null),(0,o.A)(this,"events",null),(0,o.A)(this,"sse",null),this.url=e}async getEvents(){const e=await(0,r.get)("cms/notify/events");this.events=e.events}async initSse(){await this.getEvents(),this.sse=new s["default"](i["default"].baseUrl+this.url,this.events)}async createEvents(e,t){const n=await(0,r.post)("cms/notify/events",{group_id:e,events:t});return n}async updateEvents(e,t){const n=await(0,r.put)("cms/notify/events",{group_id:e,events:t});return n}}},54620:function(e,t,n){"use strict";n.r(t),n.d(t,{getToken:function(){return a},removeToken:function(){return c},saveAccessToken:function(){return s},saveTokens:function(){return i}});var o=n(12215),r=n.n(o);function i(e,t){r().set("access_token",`Bearer ${e}`),r().set("refresh_token",`Bearer ${t}`)}function s(e){r().set("access_token",`Bearer ${e}`)}function a(e){return r().get(e)}function c(){r().remove("access_token"),r().remove("refresh_token"),sessionStorage.removeItem("flag"),sessionStorage.clear(),localStorage.clear()}},61789:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return a}});var o=n(91114),r=n(20163),i=(n(40377),n(54620)),s=n(55129);class a{constructor(e,t){(0,o.A)(this,"source",null),console.log(e,t),this.source=new EventSourcePolyfill(e,{headers:{Authorization:(0,i.getToken)("access_token")}}),this.open(),t.forEach((e=>{this.addEventListener(e)}))}open(){this.source.onopen=e=>{console.log("sse opened",e)}}error(){this.source.onerror=e=>{console.log("error",e)}}addEventListener(e){this.source.addEventListener(e,(e=>{s["default"].commit("MARK_UNREAD_MESSAGE",{data:e.data,id:e.lastEventId}),r.nk.warning(JSON.parse(e.data).message)}))}}},91114:function(e,t,n){"use strict";function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function r(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function i(e){var t=r(e,"string");return"symbol"==o(t)?t:t+""}function s(e,t,n){return(t=i(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,{A:function(){return s}})}}]);
//# sourceMappingURL=2244.5308bef2.js.map