@ibdop/platform-kit 1.0.15 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,18 +1,18 @@
1
- (function(g,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("react"),require("axios")):typeof define=="function"&&define.amd?define(["exports","react","axios"],c):(g=typeof globalThis<"u"?globalThis:g||self,c(g.PlatformKit={},g.React,g.axios))})(this,(function(g,c,ut){"use strict";function U(){if(typeof window>"u")return null;const t=window;if(t.__SHELL_AUTH_INSTANCE__)return t.__SHELL_AUTH_INSTANCE__;const n=window;return n.__SHELL_AUTH__?.authInstance?n.__SHELL_AUTH__.authInstance:null}function lt(){const t=U();if(!t)return{isAuthenticated:!1};let n;const a=t;if(t.user?.access_token)n=t.user.access_token;else if(t.user?.profile?.access_token)n=t.user.profile.access_token;else if(typeof a.getAccessToken=="function")try{const o=a.getAccessToken();o instanceof Promise?console.warn("[shellAuth] getAccessToken returned Promise - token may not be available synchronously"):typeof o=="string"&&(n=o)}catch(o){console.warn("[shellAuth] Failed to get access token via getAccessToken:",o)}return{isAuthenticated:t.isAuthenticated,user:t.user?{...t.user,access_token:n}:void 0}}function ft(){const t=U();return t?.isAuthenticated?t.user?.profile?.access_token??null:null}function dt(){return U()?.isAuthenticated??!1}async function be(){const t=U();t?.signinRedirect?await t.signinRedirect():typeof window<"u"&&(window.location.href="/")}async function pt(){const t=U();t?.removeUser&&await t.removeUser()}const Se={log:(...t)=>{},warn:(...t)=>{}};function J(){const[t,n]=c.useState(null),[a,o]=c.useState(!0),i=c.useRef(0),p=20,r=c.useCallback(()=>U(),[]);c.useEffect(()=>{const E=r();if(E){n(E),o(!1);return}const l=d=>{n(d.detail),o(!1)},_=setInterval(()=>{i.current++;const d=r();d?(Se.log("Auth found via polling, attempts:",i.current),n(d),o(!1),clearInterval(_)):i.current>=p&&(o(!1),clearInterval(_))},500);return window.addEventListener("shell-auth-ready",l),()=>{clearInterval(_),window.removeEventListener("shell-auth-ready",l)}},[r]);const f=t||{user:null,isAuthenticated:!1,isLoading:a,signinRedirect:async()=>{const E=U();E?.signinRedirect?await E.signinRedirect():typeof window<"u"&&(window.location.href="/")},removeUser:async()=>{const E=U();E?.removeUser&&await E.removeUser()}};return Se.log("Auth result:",{isAuthenticated:f.isAuthenticated,isLoading:f.isLoading}),f}const ht={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error("[useInfoData]",...t)}};function gt(t){if(t)return t;if(typeof window<"u"){const n=window;if(n.__MF_NAME__)return n.__MF_NAME__}return"unknown-mfe"}function ke(t){const[n,a]=c.useState(null),[o,i]=c.useState(!0),[p,r]=c.useState(null),h=c.useCallback(()=>{const E=gt(t?.mfeName).replace("@ib-dop/","");i(!0),r(null),fetch(`/svc/${E}/info.json`).then(l=>{if(!l.ok)throw new Error(`HTTP ${l.status}: ${l.statusText}`);return l.json()}).then(l=>{a(l)}).catch(l=>{ht.error("Failed to load info:",l),r(l instanceof Error?l.message:String(l))}).finally(()=>{i(!1)})},[t?.mfeName]);return c.useEffect(()=>{h()},[h]),{data:n,isLoading:o,error:p,refetch:h}}const ce={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error("[useV1Config]",...t)}},ee={authority:"",client_id:"",environment:"development"};function mt(){const[t,n]=c.useState(null),[a,o]=c.useState(!0),[i,p]=c.useState(null);return c.useEffect(()=>{(()=>{if(typeof sessionStorage>"u"){p("sessionStorage not available"),n(ee),o(!1);return}try{const h=sessionStorage.getItem("config");if(h){const f=JSON.parse(h);n({...ee,...f}),p(null),ce.log("Config loaded successfully")}else n(ee),p("Config not found in sessionStorage"),ce.warn("Config not found in sessionStorage")}catch(h){ce.error("Error parsing config:",h),n(ee),p("Error parsing config")}finally{o(!1)}})()},[]),{data:t,isLoading:a,error:i}}const Ae="platform-kit",te={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error(`[${Ae}]`,...t)},info:(...t)=>{}};function _t(t){const n=t.response;let a="unknown";return n?n.status===401?a="unauthorized":n.status===403?a="forbidden":n.status===404?a="not_found":n.status>=500&&(a="server"):a="network",{message:n?.data?.message??t.message??"Unknown error",code:n?.data?.code,status:n?.status,type:a,timestamp:Date.now(),url:t.config?.url}}const vt=3,yt=1e3;function Et(t){return!t||t>=500||t===429}function wt(t){return new Promise(n=>setTimeout(n,t))}function Ce(t={}){const n=t.name||Ae,a=t.retries??vt,o=t.retryDelay??yt,i={log:(...r)=>te.log(`[API:${n}]`,...r),warn:(...r)=>te.warn(`[API:${n}]`,...r),error:(...r)=>te.error(`[API:${n}]`,...r),info:(...r)=>te.info(`[API:${n}]`,...r)},p=ut.create({timeout:t.timeout??1e4,baseURL:t.baseURL??"",headers:{"Content-Type":"application/json"}});return p.interceptors.request.use(r=>{const h=U();return i.info("Auth state check:",{isAuthenticated:h?.isAuthenticated,hasUser:!!h?.user,hasToken:!!h?.user?.access_token}),h?.isAuthenticated&&h.user?.access_token?(r.headers.Authorization=`Bearer ${h.user.access_token}`,i.info("Auth token attached")):h?.isAuthenticated&&!h.user?.access_token?i.info("User authenticated but token not yet available"):i.info("User not authenticated - request without token"),i.log(`${r.method?.toUpperCase()} ${r.url}`),r},r=>(i.error("Request interceptor error:",r.message),Promise.reject(r))),p.interceptors.response.use(r=>(i.log(`Response ${r.status}:`,r.config.url),r),async r=>{const h=r.response?.status,f=r.config?.url,E=r.config?._retryCount??0;if(Et(h)&&E<a){const l=r.config;l._retryCount=E+1;const _=o*Math.pow(2,E);return i.warn(`Retrying (${l._retryCount}/${a}) after ${_}ms:`,f),await wt(_),p.request(l)}return h===401?(i.warn("401 Unauthorized - triggering re-auth"),be()):h===403?i.warn("403 Forbidden - insufficient permissions"):h===404?i.warn("404 Not found:",f):h===429?i.warn("429 Rate limited"):h===500?i.error("500 Server error:",f):r.response?i.warn(`Error ${h}:`,r.message):i.error("Network error - backend may be unavailable:",f),Promise.reject(_t(r))}),p}const B=Ce();async function bt(t,n,a=B){const o=await a.get(t,{params:n});return{data:o.data,status:o.status,ok:o.status>=200&&o.status<300}}async function St(t,n,a=B){const o=await a.post(t,n);return{data:o.data,status:o.status,ok:o.status>=200&&o.status<300}}async function kt(t,n,a=B){const o=await a.put(t,n);return{data:o.data,status:o.status,ok:o.status>=200&&o.status<300}}async function At(t,n=B){const a=await n.delete(t);return{data:a.data,status:a.status,ok:a.status>=200&&a.status<300}}function Te(t){if(typeof window>"u")return;const n=window.__MF_NAME__||"unknown",a={...t,mfeName:n,timestamp:Date.now()};window.dispatchEvent(new CustomEvent("mfe-notification",{detail:a,bubbles:!0}))}function xe(t,n){const a={network:{title:"Нет подключения",message:"Сервер недоступен. Проверьте подключение к интернету."},unauthorized:{title:"Требуется вход",message:"Ваша сессия истекла. Войдите в систему снова."},forbidden:{title:"Доступ запрещён",message:"У вас нет прав для выполнения этого действия."},not_found:{title:"Не найдено",message:"Запрошенный ресурс не найден."},server:{title:"Ошибка сервера",message:"Произошла ошибка на сервере. Попробуйте позже."},client:{title:"Ошибка",message:t.message||"Произошла ошибка при выполнении запроса."},unknown:{title:"Неизвестная ошибка",message:t.message||"Произошла неизвестная ошибка."}},o=a[t.type]||a.unknown;Te({type:t.type==="network"?"warning":"error",title:o.title,message:n?`${o.message} (${n})`:o.message})}function Ct(t){return t instanceof Error&&t.name==="AbortError"}function K(t,n={}){const{notifyOnError:a=!0,notifyOnSuccess:o=!1,successMessage:i,errorContext:p,onSuccess:r,onError:h}=n,[f,E]=c.useState(null),[l,_]=c.useState(null),[d,b]=c.useState(!1),w=c.useRef(null),N=l!==null,x=f!==null&&!d&&!N;c.useEffect(()=>()=>{w.current&&w.current.abort()},[]);const A=c.useCallback(()=>{w.current&&(w.current.abort(),w.current=null,b(!1))},[]),y=c.useCallback(async()=>{w.current&&w.current.abort(),w.current=new AbortController;const P=w.current.signal;b(!0),_(null);try{const O=await t(P);if(P.aborted)return null;if(O.ok)return E(O.data),o&&i&&Te({type:"success",title:"Успешно",message:i}),r?.(O.data),O.data;{const V={message:O.data||"Request failed",status:O.status,type:"client",timestamp:Date.now()};return _(V),a&&xe(V,p),h?.(V),null}}catch(O){if(Ct(O))return null;const V=O;return _(V),a&&xe(V,p),h?.(V),null}finally{P.aborted||b(!1),w.current=null}},[t,a,o,i,p,r,h]),R=c.useCallback(()=>{E(null),_(null),b(!1)},[]);return{data:f,error:l,isLoading:d,isError:N,isSuccess:x,execute:y,reset:R,abort:A}}function Tt(t,n={}){const{skip:a=!1,headers:o,immediate:i=!0,...p}=n,r=c.useMemo(()=>f=>{const E=o?o():{};return B.get(t,{headers:{"Content-Type":"application/json",...E},signal:f}).then(l=>({data:l.data,status:l.status,ok:l.status>=200&&l.status<300}))},[t,o]),h=K(r,{...p});return c.useEffect(()=>{i&&!a&&h.execute()},[i,a,t]),h}function xt(t,n,a={}){return K(i=>B.post(t,n,{signal:i}).then(p=>({data:p.data,status:p.status,ok:p.status>=200&&p.status<300})),a)}function Rt(t,n,a={}){return K(i=>B.put(t,n,{signal:i}).then(p=>({data:p.data,status:p.status,ok:p.status>=200&&p.status<300})),a)}function Mt(t,n={}){return K(o=>B.delete(t,{signal:o}).then(i=>({data:i.data,status:i.status,ok:i.status>=200&&i.status<300})),n)}const It={canView:["all"],canEdit:["ibdop-user","ibdop-admin","ibdop-devops"],canDelete:["ibdop-admin","ibdop-devops"],canAdmin:["ibdop-admin"],canViewSensitiveData:["ibdop-admin","ibdop-devops"],canExportData:["ibdop-user"],canManageUsers:["ibdop-admin"]};function Nt(t={}){const n=J(),a=c.useMemo(()=>({...It,...t}),[t]),o=c.useMemo(()=>{const p=n.user?.profile?.realm_roles||n.user?.profile?.roles||[];return Array.isArray(p)?p:[p]},[n.user]),i=p=>p.includes("all")?!0:p.some(r=>o.includes(r));return{canView:i(a.canView),canEdit:i(a.canEdit),canDelete:i(a.canDelete),canAdmin:i(a.canAdmin),canViewSensitiveData:i(a.canViewSensitiveData),canExportData:i(a.canExportData),canManageUsers:i(a.canManageUsers)}}function Pt(){const t=J(),[n,a]=c.useState([]),[o,i]=c.useState(0),[p,r]=c.useState([]),[h,f]=c.useState(!0),[E,l]=c.useState(null),_=c.useCallback(async()=>{if(!t.isAuthenticated){console.debug("[useFeatures] Not authenticated"),f(!1);return}f(!0),l(null);try{const w={"Content-Type":"application/json"},N=t.user?.access_token;N&&(w.Authorization=`Bearer ${N}`);const x=await fetch("/api/features",{headers:w});if(!x.ok)throw new Error(`HTTP ${x.status}: ${x.statusText}`);const A=await x.json();a(A.features||[]),i(A.totalCount||0),r(A.userRoles||[])}catch(w){console.debug("Features fetch error:",w),l(w instanceof Error?w.message:String(w)),a([]),r([])}finally{f(!1)}},[t.isAuthenticated,t.user?.access_token]);c.useEffect(()=>{_()},[_]);const d=c.useCallback(w=>n.find(x=>x.name===w)?.userEnabled??!1,[n]),b=c.useCallback(w=>n.filter(N=>N.mfDependencies?.includes(w)),[n]);return{features:n,totalCount:o,userRoles:p,isLoading:h,error:E,refetch:_,isFeatureEnabled:d,getFeaturesByMf:b}}function jt(){const t=J(),[n,a]=c.useState([]),[o,i]=c.useState([]),[p,r]=c.useState(!1),[h,f]=c.useState(!0),[E,l]=c.useState(null),_=c.useCallback(async()=>{if(!t.isAuthenticated){console.debug("[useFeatureAdmin] Not authenticated"),f(!1);return}f(!0),l(null);try{const x={"Content-Type":"application/json"},A=t.user?.access_token;A&&(x.Authorization=`Bearer ${A}`);const y=await fetch("/api/features/admin",{headers:x});if(!y.ok){if(y.status===403){console.warn("[useFeatureAdmin] 403 Forbidden - checking if token has admin role"),r(!1),a([]),i([]),f(!1);return}throw new Error(`HTTP ${y.status}: ${y.statusText}`)}const R=await y.json();a(R.featureToggles||[]),i(R.microfrontends||[]),r(R.isAdmin||!1)}catch(x){console.debug("FeatureAdmin fetch error:",x),a([]),i([]),r(!1)}finally{f(!1)}},[t.isAuthenticated,t.user?.access_token]),d=c.useCallback(async x=>{try{const A={"Content-Type":"application/json"},y=t.user?.access_token;y&&(A.Authorization=`Bearer ${y}`);const R=await fetch("/api/features/admin",{method:"POST",headers:A,body:JSON.stringify(x)});if(!R.ok){const P=await R.json().catch(()=>({}));throw new Error(P.error||`HTTP ${R.status}`)}return await _(),!0}catch(A){return l(A instanceof Error?A.message:String(A)),!1}},[_]),b=c.useCallback(async(x,A)=>{try{const y={"Content-Type":"application/json"},R=t.user?.access_token;R&&(y.Authorization=`Bearer ${R}`);const P=await fetch(`/api/features/admin/${encodeURIComponent(x)}`,{method:"PUT",headers:y,body:JSON.stringify(A)});if(!P.ok){const O=await P.json().catch(()=>({}));throw new Error(O.error||`HTTP ${P.status}`)}return await _(),!0}catch(y){return l(y instanceof Error?y.message:String(y)),!1}},[_]),w=c.useCallback(async(x,A)=>{try{const y={},R=t.user?.access_token;R&&(y.Authorization=`Bearer ${R}`);const P=await fetch(`/api/features/admin/${encodeURIComponent(x)}/toggle?enabled=${A}`,{method:"POST",headers:y});if(!P.ok){const O=await P.json().catch(()=>({}));throw new Error(O.error||`HTTP ${P.status}`)}return await _(),!0}catch(y){return l(y instanceof Error?y.message:String(y)),!1}},[_]),N=c.useCallback(async x=>{try{const A={},y=t.user?.access_token;y&&(A.Authorization=`Bearer ${y}`);const R=await fetch(`/api/features/admin/${encodeURIComponent(x)}`,{method:"DELETE",headers:A});if(!R.ok){const P=await R.json().catch(()=>({}));throw new Error(P.error||`HTTP ${R.status}`)}return await _(),!0}catch(A){return l(A instanceof Error?A.message:String(A)),!1}},[_]);return c.useEffect(()=>{_()},[_]),{features:n,microfrontends:o,isAdmin:p,isLoading:h,error:E,refetch:_,createFeature:d,updateFeature:b,toggleFeature:w,deleteFeature:N}}function Ot(){const t=J(),[n,a]=c.useState([]),[o,i]=c.useState(0),[p,r]=c.useState(!0),[h,f]=c.useState(null),E=c.useCallback(async()=>{if(!t.isAuthenticated){r(!1);return}r(!0),f(null);try{const l={"Content-Type":"application/json"},_=t.user?.access_token;_&&(l.Authorization=`Bearer ${_}`);const d=await fetch("/api/features/microfrontends",{headers:l});if(!d.ok)throw new Error(`HTTP ${d.status}: ${d.statusText}`);const b=await d.json();a(b.microfrontends||[]),i(b.totalCount||0)}catch(l){f(l instanceof Error?l.message:String(l))}finally{r(!1)}},[t.isAuthenticated,t.user?.access_token]);return c.useEffect(()=>{E()},[E]),{microfrontends:n,totalCount:o,isLoading:p,error:h,refetch:E}}var ne={exports:{}},X={};var Re;function Dt(){if(Re)return X;Re=1;var t=c,n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function r(h,f,E){var l,_={},d=null,b=null;E!==void 0&&(d=""+E),f.key!==void 0&&(d=""+f.key),f.ref!==void 0&&(b=f.ref);for(l in f)o.call(f,l)&&!p.hasOwnProperty(l)&&(_[l]=f[l]);if(h&&h.defaultProps)for(l in f=h.defaultProps,f)_[l]===void 0&&(_[l]=f[l]);return{$$typeof:n,type:h,key:d,ref:b,props:_,_owner:i.current}}return X.Fragment=a,X.jsx=r,X.jsxs=r,X}var Z={};var Me;function Ft(){return Me||(Me=1,process.env.NODE_ENV!=="production"&&(function(){var t=c,n=Symbol.for("react.element"),a=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),r=Symbol.for("react.provider"),h=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),b=Symbol.for("react.offscreen"),w=Symbol.iterator,N="@@iterator";function x(e){if(e===null||typeof e!="object")return null;var s=w&&e[w]||e[N];return typeof s=="function"?s:null}var A=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(e){{for(var s=arguments.length,u=new Array(s>1?s-1:0),m=1;m<s;m++)u[m-1]=arguments[m];R("error",e,u)}}function R(e,s,u){{var m=A.ReactDebugCurrentFrame,C=m.getStackAddendum();C!==""&&(s+="%s",u=u.concat([C]));var T=u.map(function(k){return String(k)});T.unshift("Warning: "+s),Function.prototype.apply.call(console[e],console,T)}}var P=!1,O=!1,V=!1,tn=!1,nn=!1,Le;Le=Symbol.for("react.module.reference");function rn(e){return!!(typeof e=="string"||typeof e=="function"||e===o||e===p||nn||e===i||e===E||e===l||tn||e===b||P||O||V||typeof e=="object"&&e!==null&&(e.$$typeof===d||e.$$typeof===_||e.$$typeof===r||e.$$typeof===h||e.$$typeof===f||e.$$typeof===Le||e.getModuleId!==void 0))}function sn(e,s,u){var m=e.displayName;if(m)return m;var C=s.displayName||s.name||"";return C!==""?u+"("+C+")":u}function Ue(e){return e.displayName||"Context"}function H(e){if(e==null)return null;if(typeof e.tag=="number"&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case o:return"Fragment";case a:return"Portal";case p:return"Profiler";case i:return"StrictMode";case E:return"Suspense";case l:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case h:var s=e;return Ue(s)+".Consumer";case r:var u=e;return Ue(u._context)+".Provider";case f:return sn(e,e.render,"ForwardRef");case _:var m=e.displayName||null;return m!==null?m:H(e.type)||"Memo";case d:{var C=e,T=C._payload,k=C._init;try{return H(k(T))}catch{return null}}}return null}var W=Object.assign,q=0,Be,Ve,He,We,ze,Ge,Ye;function Je(){}Je.__reactDisabledLog=!0;function an(){{if(q===0){Be=console.log,Ve=console.info,He=console.warn,We=console.error,ze=console.group,Ge=console.groupCollapsed,Ye=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Je,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}q++}}function on(){{if(q--,q===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:W({},e,{value:Be}),info:W({},e,{value:Ve}),warn:W({},e,{value:He}),error:W({},e,{value:We}),group:W({},e,{value:ze}),groupCollapsed:W({},e,{value:Ge}),groupEnd:W({},e,{value:Ye})})}q<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var he=A.ReactCurrentDispatcher,ge;function se(e,s,u){{if(ge===void 0)try{throw Error()}catch(C){var m=C.stack.trim().match(/\n( *(at )?)/);ge=m&&m[1]||""}return`
2
- `+ge+e}}var me=!1,ae;{var cn=typeof WeakMap=="function"?WeakMap:Map;ae=new cn}function Ke(e,s){if(!e||me)return"";{var u=ae.get(e);if(u!==void 0)return u}var m;me=!0;var C=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var T;T=he.current,he.current=null,an();try{if(s){var k=function(){throw Error()};if(Object.defineProperty(k.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(k,[])}catch(F){m=F}Reflect.construct(e,[],k)}else{try{k.call()}catch(F){m=F}e.call(k.prototype)}}else{try{throw Error()}catch(F){m=F}e()}}catch(F){if(F&&m&&typeof F.stack=="string"){for(var S=F.stack.split(`
3
- `),D=m.stack.split(`
4
- `),M=S.length-1,I=D.length-1;M>=1&&I>=0&&S[M]!==D[I];)I--;for(;M>=1&&I>=0;M--,I--)if(S[M]!==D[I]){if(M!==1||I!==1)do if(M--,I--,I<0||S[M]!==D[I]){var L=`
5
- `+S[M].replace(" at new "," at ");return e.displayName&&L.includes("<anonymous>")&&(L=L.replace("<anonymous>",e.displayName)),typeof e=="function"&&ae.set(e,L),L}while(M>=1&&I>=0);break}}}finally{me=!1,he.current=T,on(),Error.prepareStackTrace=C}var Y=e?e.displayName||e.name:"",z=Y?se(Y):"";return typeof e=="function"&&ae.set(e,z),z}function un(e,s,u){return Ke(e,!1)}function ln(e){var s=e.prototype;return!!(s&&s.isReactComponent)}function oe(e,s,u){if(e==null)return"";if(typeof e=="function")return Ke(e,ln(e));if(typeof e=="string")return se(e);switch(e){case E:return se("Suspense");case l:return se("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case f:return un(e.render);case _:return oe(e.type,s,u);case d:{var m=e,C=m._payload,T=m._init;try{return oe(T(C),s,u)}catch{}}}return""}var $=Object.prototype.hasOwnProperty,Xe={},Ze=A.ReactDebugCurrentFrame;function ie(e){if(e){var s=e._owner,u=oe(e.type,e._source,s?s.type:null);Ze.setExtraStackFrame(u)}else Ze.setExtraStackFrame(null)}function fn(e,s,u,m,C){{var T=Function.call.bind($);for(var k in e)if(T(e,k)){var S=void 0;try{if(typeof e[k]!="function"){var D=Error((m||"React class")+": "+u+" type `"+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[k]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw D.name="Invariant Violation",D}S=e[k](s,k,m,u,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(M){S=M}S&&!(S instanceof Error)&&(ie(C),y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",m||"React class",u,k,typeof S),ie(null)),S instanceof Error&&!(S.message in Xe)&&(Xe[S.message]=!0,ie(C),y("Failed %s type: %s",u,S.message),ie(null))}}}var dn=Array.isArray;function _e(e){return dn(e)}function pn(e){{var s=typeof Symbol=="function"&&Symbol.toStringTag,u=s&&e[Symbol.toStringTag]||e.constructor.name||"Object";return u}}function hn(e){try{return Qe(e),!1}catch{return!0}}function Qe(e){return""+e}function qe(e){if(hn(e))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",pn(e)),Qe(e)}var $e=A.ReactCurrentOwner,gn={key:!0,ref:!0,__self:!0,__source:!0},et,tt;function mn(e){if($.call(e,"ref")){var s=Object.getOwnPropertyDescriptor(e,"ref").get;if(s&&s.isReactWarning)return!1}return e.ref!==void 0}function _n(e){if($.call(e,"key")){var s=Object.getOwnPropertyDescriptor(e,"key").get;if(s&&s.isReactWarning)return!1}return e.key!==void 0}function vn(e,s){typeof e.ref=="string"&&$e.current}function yn(e,s){{var u=function(){et||(et=!0,y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",s))};u.isReactWarning=!0,Object.defineProperty(e,"key",{get:u,configurable:!0})}}function En(e,s){{var u=function(){tt||(tt=!0,y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",s))};u.isReactWarning=!0,Object.defineProperty(e,"ref",{get:u,configurable:!0})}}var wn=function(e,s,u,m,C,T,k){var S={$$typeof:n,type:e,key:s,ref:u,props:k,_owner:T};return S._store={},Object.defineProperty(S._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(S,"_self",{configurable:!1,enumerable:!1,writable:!1,value:m}),Object.defineProperty(S,"_source",{configurable:!1,enumerable:!1,writable:!1,value:C}),Object.freeze&&(Object.freeze(S.props),Object.freeze(S)),S};function bn(e,s,u,m,C){{var T,k={},S=null,D=null;u!==void 0&&(qe(u),S=""+u),_n(s)&&(qe(s.key),S=""+s.key),mn(s)&&(D=s.ref,vn(s,C));for(T in s)$.call(s,T)&&!gn.hasOwnProperty(T)&&(k[T]=s[T]);if(e&&e.defaultProps){var M=e.defaultProps;for(T in M)k[T]===void 0&&(k[T]=M[T])}if(S||D){var I=typeof e=="function"?e.displayName||e.name||"Unknown":e;S&&yn(k,I),D&&En(k,I)}return wn(e,S,D,C,m,$e.current,k)}}var ve=A.ReactCurrentOwner,nt=A.ReactDebugCurrentFrame;function G(e){if(e){var s=e._owner,u=oe(e.type,e._source,s?s.type:null);nt.setExtraStackFrame(u)}else nt.setExtraStackFrame(null)}var ye;ye=!1;function Ee(e){return typeof e=="object"&&e!==null&&e.$$typeof===n}function rt(){{if(ve.current){var e=H(ve.current.type);if(e)return`
1
+ (function(g,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react"),require("axios")):typeof define=="function"&&define.amd?define(["exports","react","axios"],l):(g=typeof globalThis<"u"?globalThis:g||self,l(g.PlatformKit={},g.React,g.axios))})(this,(function(g,l,ut){"use strict";function U(){if(typeof window>"u")return null;const t=window;if(t.__SHELL_AUTH_INSTANCE__)return t.__SHELL_AUTH_INSTANCE__;const n=window;return n.__SHELL_AUTH__?.authInstance?n.__SHELL_AUTH__.authInstance:null}function lt(){const t=U();if(!t)return{isAuthenticated:!1};let n;const r=t;if(t.user?.access_token)n=t.user.access_token;else if(t.user?.profile?.access_token)n=t.user.profile.access_token;else if(typeof r.getAccessToken=="function")try{const i=r.getAccessToken();i instanceof Promise?console.warn("[shellAuth] getAccessToken returned Promise - token may not be available synchronously"):typeof i=="string"&&(n=i)}catch(i){console.warn("[shellAuth] Failed to get access token via getAccessToken:",i)}return{isAuthenticated:t.isAuthenticated,user:t.user?{...t.user,access_token:n}:void 0}}function ft(){const t=U();return t?.isAuthenticated?t.user?.profile?.access_token??null:null}function dt(){return U()?.isAuthenticated??!1}async function we(){const t=U();t?.signinRedirect?await t.signinRedirect():typeof window<"u"&&(window.location.href="/")}async function pt(){const t=U();t?.removeUser&&await t.removeUser()}const ke={log:(...t)=>{},warn:(...t)=>{}};function J(){const[t,n]=l.useState(null),[r,i]=l.useState(!0),c=l.useRef(0),p=20,o=l.useCallback(()=>U(),[]);l.useEffect(()=>{const b=o();if(b){n(b),i(!1);return}const u=d=>{n(d.detail),i(!1)},m=setInterval(()=>{c.current++;const d=o();d?(ke.log("Auth found via polling, attempts:",c.current),n(d),i(!1),clearInterval(m)):c.current>=p&&(i(!1),clearInterval(m))},500);return window.addEventListener("shell-auth-ready",u),()=>{clearInterval(m),window.removeEventListener("shell-auth-ready",u)}},[o]);const h=t||{user:null,isAuthenticated:!1,isLoading:r,signinRedirect:async()=>{const b=U();b?.signinRedirect?await b.signinRedirect():typeof window<"u"&&(window.location.href="/")},removeUser:async()=>{const b=U();b?.removeUser&&await b.removeUser()}};return ke.log("Auth result:",{isAuthenticated:h.isAuthenticated,isLoading:h.isLoading}),h}const ht={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error("[useInfoData]",...t)}};function mt(t){if(t)return t;if(typeof window<"u"){const n=window;if(n.__MF_NAME__)return n.__MF_NAME__}return"unknown-mfe"}function Se(t){const[n,r]=l.useState(null),[i,c]=l.useState(!0),[p,o]=l.useState(null),a=l.useCallback(()=>{const b=mt(t?.mfeName).replace("@ib-dop/","");c(!0),o(null),fetch(`/svc/${b}/info.json`).then(u=>{if(!u.ok)throw new Error(`HTTP ${u.status}: ${u.statusText}`);return u.json()}).then(u=>{r(u)}).catch(u=>{ht.error("Failed to load info:",u),o(u instanceof Error?u.message:String(u))}).finally(()=>{c(!1)})},[t?.mfeName]);return l.useEffect(()=>{a()},[a]),{data:n,isLoading:i,error:p,refetch:a}}const ce={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error("[useV1Config]",...t)}},ee={authority:"",client_id:"",environment:"development"};function gt(){const[t,n]=l.useState(null),[r,i]=l.useState(!0),[c,p]=l.useState(null);return l.useEffect(()=>{(()=>{if(typeof sessionStorage>"u"){p("sessionStorage not available"),n(ee),i(!1);return}try{const a=sessionStorage.getItem("config");if(a){const h=JSON.parse(a);n({...ee,...h}),p(null),ce.log("Config loaded successfully")}else n(ee),p("Config not found in sessionStorage"),ce.warn("Config not found in sessionStorage")}catch(a){ce.error("Error parsing config:",a),n(ee),p("Error parsing config")}finally{i(!1)}})()},[]),{data:t,isLoading:r,error:c}}const Ae="platform-kit",te={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error(`[${Ae}]`,...t)},info:(...t)=>{}};function _t(t){const n=t.response;let r="unknown";return n?n.status===401?r="unauthorized":n.status===403?r="forbidden":n.status===404?r="not_found":n.status>=500&&(r="server"):r="network",{message:n?.data?.message??t.message??"Unknown error",code:n?.data?.code,status:n?.status,type:r,timestamp:Date.now(),url:t.config?.url}}const yt=3,vt=1e3;function Et(t){return!t||t>=500||t===429}function bt(t){return new Promise(n=>setTimeout(n,t))}function Ce(t={}){const n=t.name||Ae,r=t.retries??yt,i=t.retryDelay??vt,c={log:(...o)=>te.log(`[API:${n}]`,...o),warn:(...o)=>te.warn(`[API:${n}]`,...o),error:(...o)=>te.error(`[API:${n}]`,...o),info:(...o)=>te.info(`[API:${n}]`,...o)},p=ut.create({timeout:t.timeout??1e4,baseURL:t.baseURL??"",headers:{"Content-Type":"application/json"}});return p.interceptors.request.use(o=>{const a=U();return c.info("Auth state check:",{isAuthenticated:a?.isAuthenticated,hasUser:!!a?.user,hasToken:!!a?.user?.access_token}),a?.isAuthenticated&&a.user?.access_token?(o.headers.Authorization=`Bearer ${a.user.access_token}`,c.info("Auth token attached")):a?.isAuthenticated&&!a.user?.access_token?c.info("User authenticated but token not yet available"):c.info("User not authenticated - request without token"),c.log(`${o.method?.toUpperCase()} ${o.url}`),o},o=>(c.error("Request interceptor error:",o.message),Promise.reject(o))),p.interceptors.response.use(o=>(c.log(`Response ${o.status}:`,o.config.url),o),async o=>{const a=o.response?.status,h=o.config?.url,b=o.config?._retryCount??0;if(Et(a)&&b<r){const u=o.config;u._retryCount=b+1;const m=i*Math.pow(2,b);return c.warn(`Retrying (${u._retryCount}/${r}) after ${m}ms:`,h),await bt(m),p.request(u)}return a===401?(c.warn("401 Unauthorized - triggering re-auth"),we()):a===403?c.warn("403 Forbidden - insufficient permissions"):a===404?c.warn("404 Not found:",h):a===429?c.warn("429 Rate limited"):a===500?c.error("500 Server error:",h):o.response?c.warn(`Error ${a}:`,o.message):c.error("Network error - backend may be unavailable:",h),Promise.reject(_t(o))}),p}const V=Ce();async function wt(t,n,r=V){const i=await r.get(t,{params:n});return{data:i.data,status:i.status,ok:i.status>=200&&i.status<300}}async function kt(t,n,r=V){const i=await r.post(t,n);return{data:i.data,status:i.status,ok:i.status>=200&&i.status<300}}async function St(t,n,r=V){const i=await r.put(t,n);return{data:i.data,status:i.status,ok:i.status>=200&&i.status<300}}async function At(t,n=V){const r=await n.delete(t);return{data:r.data,status:r.status,ok:r.status>=200&&r.status<300}}function Te(t){if(typeof window>"u")return;const n=window.__MF_NAME__||"unknown",r={...t,mfeName:n,timestamp:Date.now()};window.dispatchEvent(new CustomEvent("mfe-notification",{detail:r,bubbles:!0}))}function xe(t,n){const r={network:{title:"Нет подключения",message:"Сервер недоступен. Проверьте подключение к интернету."},unauthorized:{title:"Требуется вход",message:"Ваша сессия истекла. Войдите в систему снова."},forbidden:{title:"Доступ запрещён",message:"У вас нет прав для выполнения этого действия."},not_found:{title:"Не найдено",message:"Запрошенный ресурс не найден."},server:{title:"Ошибка сервера",message:"Произошла ошибка на сервере. Попробуйте позже."},client:{title:"Ошибка",message:t.message||"Произошла ошибка при выполнении запроса."},unknown:{title:"Неизвестная ошибка",message:t.message||"Произошла неизвестная ошибка."}},i=r[t.type]||r.unknown;Te({type:t.type==="network"?"warning":"error",title:i.title,message:n?`${i.message} (${n})`:i.message})}function Ct(t){return t instanceof Error&&t.name==="AbortError"}function K(t,n={}){const{notifyOnError:r=!0,notifyOnSuccess:i=!1,successMessage:c,errorContext:p,onSuccess:o,onError:a}=n,[h,b]=l.useState(null),[u,m]=l.useState(null),[d,w]=l.useState(!1),y=l.useRef(null),R=u!==null,x=h!==null&&!d&&!R;l.useEffect(()=>()=>{y.current&&y.current.abort()},[]);const A=l.useCallback(()=>{y.current&&(y.current.abort(),y.current=null,w(!1))},[]),v=l.useCallback(async()=>{y.current&&y.current.abort(),y.current=new AbortController;const P=y.current.signal;w(!0),m(null);try{const j=await t(P);if(P.aborted)return null;if(j.ok)return b(j.data),i&&c&&Te({type:"success",title:"Успешно",message:c}),o?.(j.data),j.data;{const B={message:j.data||"Request failed",status:j.status,type:"client",timestamp:Date.now()};return m(B),r&&xe(B,p),a?.(B),null}}catch(j){if(Ct(j))return null;const B=j;return m(B),r&&xe(B,p),a?.(B),null}finally{P.aborted||w(!1),y.current=null}},[t,r,i,c,p,o,a]),M=l.useCallback(()=>{b(null),m(null),w(!1)},[]);return{data:h,error:u,isLoading:d,isError:R,isSuccess:x,execute:v,reset:M,abort:A}}function Tt(t,n={}){const{skip:r=!1,headers:i,immediate:c=!0,...p}=n,o=l.useMemo(()=>h=>{const b=i?i():{};return V.get(t,{headers:{"Content-Type":"application/json",...b},signal:h}).then(u=>({data:u.data,status:u.status,ok:u.status>=200&&u.status<300}))},[t,i]),a=K(o,{...p});return l.useEffect(()=>{c&&!r&&a.execute()},[c,r,t]),a}function xt(t,n,r={}){return K(c=>V.post(t,n,{signal:c}).then(p=>({data:p.data,status:p.status,ok:p.status>=200&&p.status<300})),r)}function Rt(t,n,r={}){return K(c=>V.put(t,n,{signal:c}).then(p=>({data:p.data,status:p.status,ok:p.status>=200&&p.status<300})),r)}function Mt(t,n={}){return K(i=>V.delete(t,{signal:i}).then(c=>({data:c.data,status:c.status,ok:c.status>=200&&c.status<300})),n)}const It={canView:["all"],canEdit:["ibdop-user","ibdop-admin","ibdop-devops"],canDelete:["ibdop-admin","ibdop-devops"],canAdmin:["ibdop-admin"],canViewSensitiveData:["ibdop-admin","ibdop-devops"],canExportData:["ibdop-user"],canManageUsers:["ibdop-admin"]};function Nt(t={}){const n=J(),r=l.useMemo(()=>({...It,...t}),[t]),i=l.useMemo(()=>{const p=n.user?.profile?.realm_roles||n.user?.profile?.roles||[];return Array.isArray(p)?p:[p]},[n.user]),c=p=>p.includes("all")?!0:p.some(o=>i.includes(o));return{canView:c(r.canView),canEdit:c(r.canEdit),canDelete:c(r.canDelete),canAdmin:c(r.canAdmin),canViewSensitiveData:c(r.canViewSensitiveData),canExportData:c(r.canExportData),canManageUsers:c(r.canManageUsers)}}function Pt(){const t=J(),[n,r]=l.useState([]),[i,c]=l.useState(0),[p,o]=l.useState([]),[a,h]=l.useState(!0),[b,u]=l.useState(null),m=l.useCallback(async()=>{if(!t.isAuthenticated){console.debug("[useFeatures] Not authenticated"),h(!1);return}h(!0),u(null);try{const y={"Content-Type":"application/json"},R=t.user?.access_token;R&&(y.Authorization=`Bearer ${R}`);const x=await fetch("/api/features",{headers:y});if(!x.ok)throw new Error(`HTTP ${x.status}: ${x.statusText}`);const A=await x.json();r(A.features||[]),c(A.totalCount||0),o(A.userRoles||[])}catch(y){console.debug("Features fetch error:",y),u(y instanceof Error?y.message:String(y)),r([]),o([])}finally{h(!1)}},[t.isAuthenticated,t.user?.access_token]);l.useEffect(()=>{m()},[m]);const d=l.useCallback(y=>n.find(x=>x.name===y)?.userEnabled??!1,[n]),w=l.useCallback(y=>n.filter(R=>R.mfDependencies?.includes(y)),[n]);return{features:n,totalCount:i,userRoles:p,isLoading:a,error:b,refetch:m,isFeatureEnabled:d,getFeaturesByMf:w}}function Ot(){const t=J(),[n,r]=l.useState([]),[i,c]=l.useState([]),[p,o]=l.useState(!1),[a,h]=l.useState(!0),[b,u]=l.useState(null),m=l.useCallback(async()=>{if(!t.isAuthenticated){console.debug("[useFeatureAdmin] Not authenticated"),h(!1);return}h(!0),u(null);try{const x={"Content-Type":"application/json"},A=t.user?.access_token;A&&(x.Authorization=`Bearer ${A}`);const v=await fetch("/api/features/admin",{headers:x});if(!v.ok){if(v.status===403){console.warn("[useFeatureAdmin] 403 Forbidden - checking if token has admin role"),o(!1),r([]),c([]),h(!1);return}throw new Error(`HTTP ${v.status}: ${v.statusText}`)}const M=await v.json();r(M.featureToggles||[]),c(M.microfrontends||[]),o(M.isAdmin||!1)}catch(x){console.debug("FeatureAdmin fetch error:",x),r([]),c([]),o(!1)}finally{h(!1)}},[t.isAuthenticated,t.user?.access_token]),d=l.useCallback(async x=>{try{const A={"Content-Type":"application/json"},v=t.user?.access_token;v&&(A.Authorization=`Bearer ${v}`);const M=await fetch("/api/features/admin",{method:"POST",headers:A,body:JSON.stringify(x)});if(!M.ok){const P=await M.json().catch(()=>({}));throw new Error(P.error||`HTTP ${M.status}`)}return await m(),!0}catch(A){return u(A instanceof Error?A.message:String(A)),!1}},[m]),w=l.useCallback(async(x,A)=>{try{const v={"Content-Type":"application/json"},M=t.user?.access_token;M&&(v.Authorization=`Bearer ${M}`);const P=await fetch(`/api/features/admin/${encodeURIComponent(x)}`,{method:"PUT",headers:v,body:JSON.stringify(A)});if(!P.ok){const j=await P.json().catch(()=>({}));throw new Error(j.error||`HTTP ${P.status}`)}return await m(),!0}catch(v){return u(v instanceof Error?v.message:String(v)),!1}},[m]),y=l.useCallback(async(x,A)=>{try{const v={},M=t.user?.access_token;M&&(v.Authorization=`Bearer ${M}`);const P=await fetch(`/api/features/admin/${encodeURIComponent(x)}/toggle?enabled=${A}`,{method:"POST",headers:v});if(!P.ok){const j=await P.json().catch(()=>({}));throw new Error(j.error||`HTTP ${P.status}`)}return await m(),!0}catch(v){return u(v instanceof Error?v.message:String(v)),!1}},[m]),R=l.useCallback(async x=>{try{const A={},v=t.user?.access_token;v&&(A.Authorization=`Bearer ${v}`);const M=await fetch(`/api/features/admin/${encodeURIComponent(x)}`,{method:"DELETE",headers:A});if(!M.ok){const P=await M.json().catch(()=>({}));throw new Error(P.error||`HTTP ${M.status}`)}return await m(),!0}catch(A){return u(A instanceof Error?A.message:String(A)),!1}},[m]);return l.useEffect(()=>{m()},[m]),{features:n,microfrontends:i,isAdmin:p,isLoading:a,error:b,refetch:m,createFeature:d,updateFeature:w,toggleFeature:y,deleteFeature:R}}function jt(){const t=J(),[n,r]=l.useState([]),[i,c]=l.useState(0),[p,o]=l.useState(!0),[a,h]=l.useState(null),b=l.useCallback(async()=>{if(!t.isAuthenticated){o(!1);return}o(!0),h(null);try{const u={"Content-Type":"application/json"},m=t.user?.access_token;m&&(u.Authorization=`Bearer ${m}`);const d=await fetch("/api/features/microfrontends",{headers:u});if(!d.ok)throw new Error(`HTTP ${d.status}: ${d.statusText}`);const w=await d.json();r(w.microfrontends||[]),c(w.totalCount||0)}catch(u){h(u instanceof Error?u.message:String(u))}finally{o(!1)}},[t.isAuthenticated,t.user?.access_token]);return l.useEffect(()=>{b()},[b]),{microfrontends:n,totalCount:i,isLoading:p,error:a,refetch:b}}var ne={exports:{}},X={};var Re;function Dt(){if(Re)return X;Re=1;var t=l,n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,c=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function o(a,h,b){var u,m={},d=null,w=null;b!==void 0&&(d=""+b),h.key!==void 0&&(d=""+h.key),h.ref!==void 0&&(w=h.ref);for(u in h)i.call(h,u)&&!p.hasOwnProperty(u)&&(m[u]=h[u]);if(a&&a.defaultProps)for(u in h=a.defaultProps,h)m[u]===void 0&&(m[u]=h[u]);return{$$typeof:n,type:a,key:d,ref:w,props:m,_owner:c.current}}return X.Fragment=r,X.jsx=o,X.jsxs=o,X}var Q={};var Me;function Ft(){return Me||(Me=1,process.env.NODE_ENV!=="production"&&(function(){var t=l,n=Symbol.for("react.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),w=Symbol.for("react.offscreen"),y=Symbol.iterator,R="@@iterator";function x(e){if(e===null||typeof e!="object")return null;var s=y&&e[y]||e[R];return typeof s=="function"?s:null}var A=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(e){{for(var s=arguments.length,f=new Array(s>1?s-1:0),_=1;_<s;_++)f[_-1]=arguments[_];M("error",e,f)}}function M(e,s,f){{var _=A.ReactDebugCurrentFrame,C=_.getStackAddendum();C!==""&&(s+="%s",f=f.concat([C]));var T=f.map(function(S){return String(S)});T.unshift("Warning: "+s),Function.prototype.apply.call(console[e],console,T)}}var P=!1,j=!1,B=!1,nn=!1,rn=!1,Le;Le=Symbol.for("react.module.reference");function sn(e){return!!(typeof e=="string"||typeof e=="function"||e===i||e===p||rn||e===c||e===b||e===u||nn||e===w||P||j||B||typeof e=="object"&&e!==null&&(e.$$typeof===d||e.$$typeof===m||e.$$typeof===o||e.$$typeof===a||e.$$typeof===h||e.$$typeof===Le||e.getModuleId!==void 0))}function an(e,s,f){var _=e.displayName;if(_)return _;var C=s.displayName||s.name||"";return C!==""?f+"("+C+")":f}function Ue(e){return e.displayName||"Context"}function H(e){if(e==null)return null;if(typeof e.tag=="number"&&v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case i:return"Fragment";case r:return"Portal";case p:return"Profiler";case c:return"StrictMode";case b:return"Suspense";case u:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case a:var s=e;return Ue(s)+".Consumer";case o:var f=e;return Ue(f._context)+".Provider";case h:return an(e,e.render,"ForwardRef");case m:var _=e.displayName||null;return _!==null?_:H(e.type)||"Memo";case d:{var C=e,T=C._payload,S=C._init;try{return H(S(T))}catch{return null}}}return null}var z=Object.assign,q=0,Ve,Be,He,ze,We,Ge,Ye;function Je(){}Je.__reactDisabledLog=!0;function on(){{if(q===0){Ve=console.log,Be=console.info,He=console.warn,ze=console.error,We=console.group,Ge=console.groupCollapsed,Ye=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Je,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}q++}}function cn(){{if(q--,q===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:z({},e,{value:Ve}),info:z({},e,{value:Be}),warn:z({},e,{value:He}),error:z({},e,{value:ze}),group:z({},e,{value:We}),groupCollapsed:z({},e,{value:Ge}),groupEnd:z({},e,{value:Ye})})}q<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var he=A.ReactCurrentDispatcher,me;function se(e,s,f){{if(me===void 0)try{throw Error()}catch(C){var _=C.stack.trim().match(/\n( *(at )?)/);me=_&&_[1]||""}return`
2
+ `+me+e}}var ge=!1,ae;{var un=typeof WeakMap=="function"?WeakMap:Map;ae=new un}function Ke(e,s){if(!e||ge)return"";{var f=ae.get(e);if(f!==void 0)return f}var _;ge=!0;var C=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var T;T=he.current,he.current=null,on();try{if(s){var S=function(){throw Error()};if(Object.defineProperty(S.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(S,[])}catch(F){_=F}Reflect.construct(e,[],S)}else{try{S.call()}catch(F){_=F}e.call(S.prototype)}}else{try{throw Error()}catch(F){_=F}e()}}catch(F){if(F&&_&&typeof F.stack=="string"){for(var k=F.stack.split(`
3
+ `),D=_.stack.split(`
4
+ `),I=k.length-1,N=D.length-1;I>=1&&N>=0&&k[I]!==D[N];)N--;for(;I>=1&&N>=0;I--,N--)if(k[I]!==D[N]){if(I!==1||N!==1)do if(I--,N--,N<0||k[I]!==D[N]){var L=`
5
+ `+k[I].replace(" at new "," at ");return e.displayName&&L.includes("<anonymous>")&&(L=L.replace("<anonymous>",e.displayName)),typeof e=="function"&&ae.set(e,L),L}while(I>=1&&N>=0);break}}}finally{ge=!1,he.current=T,cn(),Error.prepareStackTrace=C}var Y=e?e.displayName||e.name:"",W=Y?se(Y):"";return typeof e=="function"&&ae.set(e,W),W}function ln(e,s,f){return Ke(e,!1)}function fn(e){var s=e.prototype;return!!(s&&s.isReactComponent)}function oe(e,s,f){if(e==null)return"";if(typeof e=="function")return Ke(e,fn(e));if(typeof e=="string")return se(e);switch(e){case b:return se("Suspense");case u:return se("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case h:return ln(e.render);case m:return oe(e.type,s,f);case d:{var _=e,C=_._payload,T=_._init;try{return oe(T(C),s,f)}catch{}}}return""}var $=Object.prototype.hasOwnProperty,Xe={},Qe=A.ReactDebugCurrentFrame;function ie(e){if(e){var s=e._owner,f=oe(e.type,e._source,s?s.type:null);Qe.setExtraStackFrame(f)}else Qe.setExtraStackFrame(null)}function dn(e,s,f,_,C){{var T=Function.call.bind($);for(var S in e)if(T(e,S)){var k=void 0;try{if(typeof e[S]!="function"){var D=Error((_||"React class")+": "+f+" type `"+S+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[S]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw D.name="Invariant Violation",D}k=e[S](s,S,_,f,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(I){k=I}k&&!(k instanceof Error)&&(ie(C),v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",_||"React class",f,S,typeof k),ie(null)),k instanceof Error&&!(k.message in Xe)&&(Xe[k.message]=!0,ie(C),v("Failed %s type: %s",f,k.message),ie(null))}}}var pn=Array.isArray;function _e(e){return pn(e)}function hn(e){{var s=typeof Symbol=="function"&&Symbol.toStringTag,f=s&&e[Symbol.toStringTag]||e.constructor.name||"Object";return f}}function mn(e){try{return Ze(e),!1}catch{return!0}}function Ze(e){return""+e}function qe(e){if(mn(e))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",hn(e)),Ze(e)}var $e=A.ReactCurrentOwner,gn={key:!0,ref:!0,__self:!0,__source:!0},et,tt;function _n(e){if($.call(e,"ref")){var s=Object.getOwnPropertyDescriptor(e,"ref").get;if(s&&s.isReactWarning)return!1}return e.ref!==void 0}function yn(e){if($.call(e,"key")){var s=Object.getOwnPropertyDescriptor(e,"key").get;if(s&&s.isReactWarning)return!1}return e.key!==void 0}function vn(e,s){typeof e.ref=="string"&&$e.current}function En(e,s){{var f=function(){et||(et=!0,v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",s))};f.isReactWarning=!0,Object.defineProperty(e,"key",{get:f,configurable:!0})}}function bn(e,s){{var f=function(){tt||(tt=!0,v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",s))};f.isReactWarning=!0,Object.defineProperty(e,"ref",{get:f,configurable:!0})}}var wn=function(e,s,f,_,C,T,S){var k={$$typeof:n,type:e,key:s,ref:f,props:S,_owner:T};return k._store={},Object.defineProperty(k._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(k,"_self",{configurable:!1,enumerable:!1,writable:!1,value:_}),Object.defineProperty(k,"_source",{configurable:!1,enumerable:!1,writable:!1,value:C}),Object.freeze&&(Object.freeze(k.props),Object.freeze(k)),k};function kn(e,s,f,_,C){{var T,S={},k=null,D=null;f!==void 0&&(qe(f),k=""+f),yn(s)&&(qe(s.key),k=""+s.key),_n(s)&&(D=s.ref,vn(s,C));for(T in s)$.call(s,T)&&!gn.hasOwnProperty(T)&&(S[T]=s[T]);if(e&&e.defaultProps){var I=e.defaultProps;for(T in I)S[T]===void 0&&(S[T]=I[T])}if(k||D){var N=typeof e=="function"?e.displayName||e.name||"Unknown":e;k&&En(S,N),D&&bn(S,N)}return wn(e,k,D,C,_,$e.current,S)}}var ye=A.ReactCurrentOwner,nt=A.ReactDebugCurrentFrame;function G(e){if(e){var s=e._owner,f=oe(e.type,e._source,s?s.type:null);nt.setExtraStackFrame(f)}else nt.setExtraStackFrame(null)}var ve;ve=!1;function Ee(e){return typeof e=="object"&&e!==null&&e.$$typeof===n}function rt(){{if(ye.current){var e=H(ye.current.type);if(e)return`
6
6
 
7
- Check the render method of \``+e+"`."}return""}}function Sn(e){return""}var st={};function kn(e){{var s=rt();if(!s){var u=typeof e=="string"?e:e.displayName||e.name;u&&(s=`
7
+ Check the render method of \``+e+"`."}return""}}function Sn(e){return""}var st={};function An(e){{var s=rt();if(!s){var f=typeof e=="string"?e:e.displayName||e.name;f&&(s=`
8
8
 
9
- Check the top-level render call using <`+u+">.")}return s}}function at(e,s){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var u=kn(s);if(st[u])return;st[u]=!0;var m="";e&&e._owner&&e._owner!==ve.current&&(m=" It was passed a child from "+H(e._owner.type)+"."),G(e),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',u,m),G(null)}}function ot(e,s){{if(typeof e!="object")return;if(_e(e))for(var u=0;u<e.length;u++){var m=e[u];Ee(m)&&at(m,s)}else if(Ee(e))e._store&&(e._store.validated=!0);else if(e){var C=x(e);if(typeof C=="function"&&C!==e.entries)for(var T=C.call(e),k;!(k=T.next()).done;)Ee(k.value)&&at(k.value,s)}}}function An(e){{var s=e.type;if(s==null||typeof s=="string")return;var u;if(typeof s=="function")u=s.propTypes;else if(typeof s=="object"&&(s.$$typeof===f||s.$$typeof===_))u=s.propTypes;else return;if(u){var m=H(s);fn(u,e.props,"prop",m,e)}else if(s.PropTypes!==void 0&&!ye){ye=!0;var C=H(s);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",C||"Unknown")}typeof s.getDefaultProps=="function"&&!s.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Cn(e){{for(var s=Object.keys(e.props),u=0;u<s.length;u++){var m=s[u];if(m!=="children"&&m!=="key"){G(e),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",m),G(null);break}}e.ref!==null&&(G(e),y("Invalid attribute `ref` supplied to `React.Fragment`."),G(null))}}var it={};function ct(e,s,u,m,C,T){{var k=rn(e);if(!k){var S="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(S+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var D=Sn();D?S+=D:S+=rt();var M;e===null?M="null":_e(e)?M="array":e!==void 0&&e.$$typeof===n?(M="<"+(H(e.type)||"Unknown")+" />",S=" Did you accidentally export a JSX literal instead of a component?"):M=typeof e,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",M,S)}var I=bn(e,s,u,C,T);if(I==null)return I;if(k){var L=s.children;if(L!==void 0)if(m)if(_e(L)){for(var Y=0;Y<L.length;Y++)ot(L[Y],e);Object.freeze&&Object.freeze(L)}else y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ot(L,e)}if($.call(s,"key")){var z=H(e),F=Object.keys(s).filter(function(Nn){return Nn!=="key"}),we=F.length>0?"{key: someKey, "+F.join(": ..., ")+": ...}":"{key: someKey}";if(!it[z+we]){var In=F.length>0?"{"+F.join(": ..., ")+": ...}":"{}";y(`A props object containing a "key" prop is being spread into JSX:
9
+ Check the top-level render call using <`+f+">.")}return s}}function at(e,s){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var f=An(s);if(st[f])return;st[f]=!0;var _="";e&&e._owner&&e._owner!==ye.current&&(_=" It was passed a child from "+H(e._owner.type)+"."),G(e),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',f,_),G(null)}}function ot(e,s){{if(typeof e!="object")return;if(_e(e))for(var f=0;f<e.length;f++){var _=e[f];Ee(_)&&at(_,s)}else if(Ee(e))e._store&&(e._store.validated=!0);else if(e){var C=x(e);if(typeof C=="function"&&C!==e.entries)for(var T=C.call(e),S;!(S=T.next()).done;)Ee(S.value)&&at(S.value,s)}}}function Cn(e){{var s=e.type;if(s==null||typeof s=="string")return;var f;if(typeof s=="function")f=s.propTypes;else if(typeof s=="object"&&(s.$$typeof===h||s.$$typeof===m))f=s.propTypes;else return;if(f){var _=H(s);dn(f,e.props,"prop",_,e)}else if(s.PropTypes!==void 0&&!ve){ve=!0;var C=H(s);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",C||"Unknown")}typeof s.getDefaultProps=="function"&&!s.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Tn(e){{for(var s=Object.keys(e.props),f=0;f<s.length;f++){var _=s[f];if(_!=="children"&&_!=="key"){G(e),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",_),G(null);break}}e.ref!==null&&(G(e),v("Invalid attribute `ref` supplied to `React.Fragment`."),G(null))}}var it={};function ct(e,s,f,_,C,T){{var S=sn(e);if(!S){var k="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(k+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var D=Sn();D?k+=D:k+=rt();var I;e===null?I="null":_e(e)?I="array":e!==void 0&&e.$$typeof===n?(I="<"+(H(e.type)||"Unknown")+" />",k=" Did you accidentally export a JSX literal instead of a component?"):I=typeof e,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",I,k)}var N=kn(e,s,f,C,T);if(N==null)return N;if(S){var L=s.children;if(L!==void 0)if(_)if(_e(L)){for(var Y=0;Y<L.length;Y++)ot(L[Y],e);Object.freeze&&Object.freeze(L)}else v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ot(L,e)}if($.call(s,"key")){var W=H(e),F=Object.keys(s).filter(function(Pn){return Pn!=="key"}),be=F.length>0?"{key: someKey, "+F.join(": ..., ")+": ...}":"{key: someKey}";if(!it[W+be]){var Nn=F.length>0?"{"+F.join(": ..., ")+": ...}":"{}";v(`A props object containing a "key" prop is being spread into JSX:
10
10
  let props = %s;
11
11
  <%s {...props} />
12
12
  React keys must be passed directly to JSX without using spread:
13
13
  let props = %s;
14
- <%s key={someKey} {...props} />`,we,z,In,z),it[z+we]=!0}}return e===o?Cn(I):An(I),I}}function Tn(e,s,u){return ct(e,s,u,!0)}function xn(e,s,u){return ct(e,s,u,!1)}var Rn=xn,Mn=Tn;Z.Fragment=o,Z.jsx=Rn,Z.jsxs=Mn})()),Z}var Ie;function Lt(){return Ie||(Ie=1,process.env.NODE_ENV==="production"?ne.exports=Dt():ne.exports=Ft()),ne.exports}var v=Lt();const Ne="platform-kit",Ut=!1,ue={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error(`[${Ne}]`,...t)}};class Bt extends c.Component{hasDispatched=!1;constructor(n){super(n),this.state={hasError:!1}}getMfeName(){if(this.props.mfeName)return this.props.mfeName;if(typeof window<"u"){const n=window;if(n.__MF_NAME__)return n.__MF_NAME__}return Ne}shouldShowDetails(){if(this.props.showDetails!==void 0)return this.props.showDetails;if(typeof sessionStorage<"u")try{const n=sessionStorage.getItem("config");if(n){const a=JSON.parse(n);if(a.showErrorDetails!==void 0)return a.showErrorDetails}}catch{}return Ut}dispatchError(n,a){if(this.hasDispatched||typeof window>"u")return;this.hasDispatched=!0;const o=this.getMfeName();ue.error("ErrorBoundary caught:",n);try{window.dispatchEvent(new CustomEvent("mfe-error",{detail:{mfeName:o,error:n.message||String(n),stack:n.stack,componentStack:a?.componentStack,timestamp:Date.now()},bubbles:!0}))}catch(i){ue.error("Failed to dispatch mfe-error event:",i)}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,a){this.dispatchError(n,a),ue.error("Error info:",a.componentStack)}handleCopy=()=>{const n=`Error in ${this.getMfeName()}:
14
+ <%s key={someKey} {...props} />`,be,W,Nn,W),it[W+be]=!0}}return e===i?Tn(N):Cn(N),N}}function xn(e,s,f){return ct(e,s,f,!0)}function Rn(e,s,f){return ct(e,s,f,!1)}var Mn=Rn,In=xn;Q.Fragment=i,Q.jsx=Mn,Q.jsxs=In})()),Q}var Ie;function Lt(){return Ie||(Ie=1,process.env.NODE_ENV==="production"?ne.exports=Dt():ne.exports=Ft()),ne.exports}var E=Lt();const Ne="platform-kit",Ut=!1,ue={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error(`[${Ne}]`,...t)}};class Vt extends l.Component{hasDispatched=!1;constructor(n){super(n),this.state={hasError:!1}}getMfeName(){if(this.props.mfeName)return this.props.mfeName;if(typeof window<"u"){const n=window;if(n.__MF_NAME__)return n.__MF_NAME__}return Ne}shouldShowDetails(){if(this.props.showDetails!==void 0)return this.props.showDetails;if(typeof sessionStorage<"u")try{const n=sessionStorage.getItem("config");if(n){const r=JSON.parse(n);if(r.showErrorDetails!==void 0)return r.showErrorDetails}}catch{}return Ut}dispatchError(n,r){if(this.hasDispatched||typeof window>"u")return;this.hasDispatched=!0;const i=this.getMfeName();ue.error("ErrorBoundary caught:",n);try{window.dispatchEvent(new CustomEvent("mfe-error",{detail:{mfeName:i,error:n.message||String(n),stack:n.stack,componentStack:r?.componentStack,timestamp:Date.now()},bubbles:!0}))}catch(c){ue.error("Failed to dispatch mfe-error event:",c)}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){this.dispatchError(n,r),ue.error("Error info:",r.componentStack)}handleCopy=()=>{const n=`Error in ${this.getMfeName()}:
15
15
  ${this.state.error?.message}
16
- ${this.state.error?.stack}`;typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(n).then(()=>{alert("Ошибка скопирована в буфер обмена")}).catch(()=>{prompt("Скопируйте ошибку:",n)})};handleRetry=()=>{this.setState({hasError:!1,error:void 0}),this.hasDispatched=!1,typeof window<"u"&&window.location.reload()};handleGoHome=()=>{typeof window<"u"&&(window.location.href="/")};render(){if(this.state.hasError){const n=this.state.error?.message||"Unknown error",a=this.state.error?.stack||"",o=this.shouldShowDetails(),i=this.getMfeName();return v.jsxs("div",{style:{padding:"20px",textAlign:"center",color:"#d32f2f",fontFamily:"monospace",background:"#ffebee",border:"1px solid #ef5350",borderRadius:"4px",margin:"10px"},children:[v.jsxs("h2",{style:{fontSize:"16px",margin:"0 0 8px 0"},children:["⚠️ Ошибка в ",i]}),v.jsx("p",{style:{fontSize:"12px",margin:0},children:"Произошла ошибка в микрофронтенде. Сообщение отправлено в shell."}),o&&v.jsxs("details",{style:{whiteSpace:"pre-wrap",textAlign:"left",marginTop:"10px",background:"#fff",padding:"8px",borderRadius:"4px"},children:[v.jsx("summary",{style:{cursor:"pointer",fontWeight:"bold"},children:"Детали ошибки"}),v.jsxs("pre",{style:{fontSize:"11px",overflow:"auto",maxHeight:"150px",margin:"8px 0 0 0",padding:"8px",background:"#f5f5f5",borderRadius:"4px"},children:[n,a&&`
16
+ ${this.state.error?.stack}`;typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(n).then(()=>{alert("Ошибка скопирована в буфер обмена")}).catch(()=>{prompt("Скопируйте ошибку:",n)})};handleRetry=()=>{this.setState({hasError:!1,error:void 0}),this.hasDispatched=!1,typeof window<"u"&&window.location.reload()};handleGoHome=()=>{typeof window<"u"&&(window.location.href="/")};render(){if(this.state.hasError){const n=this.state.error?.message||"Unknown error",r=this.state.error?.stack||"",i=this.shouldShowDetails(),c=this.getMfeName();return E.jsxs("div",{style:{padding:"20px",textAlign:"center",color:"#d32f2f",fontFamily:"monospace",background:"#ffebee",border:"1px solid #ef5350",borderRadius:"4px",margin:"10px"},children:[E.jsxs("h2",{style:{fontSize:"16px",margin:"0 0 8px 0"},children:["⚠️ Ошибка в ",c]}),E.jsx("p",{style:{fontSize:"12px",margin:0},children:"Произошла ошибка в микрофронтенде. Сообщение отправлено в shell."}),i&&E.jsxs("details",{style:{whiteSpace:"pre-wrap",textAlign:"left",marginTop:"10px",background:"#fff",padding:"8px",borderRadius:"4px"},children:[E.jsx("summary",{style:{cursor:"pointer",fontWeight:"bold"},children:"Детали ошибки"}),E.jsxs("pre",{style:{fontSize:"11px",overflow:"auto",maxHeight:"150px",margin:"8px 0 0 0",padding:"8px",background:"#f5f5f5",borderRadius:"4px"},children:[n,r&&`
17
17
 
18
- ${a}`]})]}),v.jsxs("div",{style:{marginTop:"12px",display:"flex",gap:"8px",justifyContent:"center"},children:[v.jsx("button",{onClick:this.handleCopy,style:{padding:"8px 12px",background:"#666",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},children:"📋 Копировать"}),v.jsx("button",{onClick:this.handleRetry,style:{padding:"8px 12px",background:"#d32f2f",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},children:"🔄 Обновить"}),v.jsx("button",{onClick:this.handleGoHome,style:{padding:"8px 12px",background:"#1976d2",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},children:"🏠 На главную"})]})]})}return this.props.children==null?null:this.props.children}}const j={info:"ℹ️",code:"💻",link:"🔗",user:"👤",clock:"🕐",apps:"📦",storage:"💾",tags:"🏷️",spreadsheet:"📊"};function Vt({mfeName:t}){const{data:n,isLoading:a,error:o}=ke({mfeName:t}),[i,p]=c.useState(!1);if(a)return v.jsxs("span",{className:"text-muted small me-2",children:[v.jsx("span",{className:"me-1",children:"⏳"}),"Загрузка..."]});if(o||!n)return v.jsxs("span",{className:"text-muted small me-2",title:`Ошибка: ${o||"нет данных"}`,children:[v.jsx("span",{className:"me-1",children:"ℹ️"}),"N/A"]});const r=n,h=r.BUILD_VERSION||r.IMAGE_VERSION||r.APP_NAME||"N/A",f=[];return r.APP_NAME&&f.push({key:"APP_NAME",value:r.APP_NAME,label:"Приложение",icon:j.apps}),r.BUILD_VERSION&&f.push({key:"BUILD_VERSION",value:r.BUILD_VERSION,label:"Версия",icon:j.tags}),r.IMAGE_VERSION&&f.push({key:"IMAGE_VERSION",value:r.IMAGE_VERSION,label:"Образ",icon:j.storage}),r.GIT_COMMIT&&f.push({key:"GIT_COMMIT",value:r.GIT_COMMIT,label:"Commit",icon:j.spreadsheet}),r.COMMIT_SHA&&f.push({key:"COMMIT_SHA",value:r.COMMIT_SHA,label:"Commit",icon:j.spreadsheet}),r.GIT_BRANCH&&f.push({key:"GIT_BRANCH",value:r.GIT_BRANCH,label:"Ветка",icon:j.spreadsheet}),r.BUILD_BRANCH&&f.push({key:"BUILD_BRANCH",value:r.BUILD_BRANCH,label:"Ветка",icon:j.spreadsheet}),r.CI_COMMIT_AUTHOR&&f.push({key:"CI_COMMIT_AUTHOR",value:r.CI_COMMIT_AUTHOR,label:"Автор",icon:j.user}),r.CI_COMMIT_TIMESTAMP&&f.push({key:"CI_COMMIT_TIMESTAMP",value:r.CI_COMMIT_TIMESTAMP,label:"Дата",icon:j.clock}),r.BUILD_DATE&&f.push({key:"BUILD_DATE",value:r.BUILD_DATE,label:"Сборка",icon:j.clock}),r.CI_JOB_URL&&f.push({key:"CI_JOB_URL",value:r.CI_JOB_URL,label:"CI Job",icon:j.link}),r.CI_PIPELINE_URL&&f.push({key:"CI_PIPELINE_URL",value:r.CI_PIPELINE_URL,label:"Pipeline",icon:j.link}),r.CI_COMMIT_MESSAGE&&(r.CI_COMMIT_MESSAGE.length>60?r.CI_COMMIT_MESSAGE.substring(0,57)+"":r.CI_COMMIT_MESSAGE,f.push({key:"CI_COMMIT_MESSAGE",value:r.CI_COMMIT_MESSAGE,label:"Сообщение",icon:j.code})),v.jsxs("div",{style:{display:"inline-block",position:"relative"},children:[v.jsxs("button",{onClick:()=>p(!i),style:{background:"transparent",border:"none",cursor:"pointer",padding:"4px 8px",fontSize:"14px",display:"inline-flex",alignItems:"center"},title:"Информация о версии",children:[v.jsx("span",{className:"me-1",children:j.info}),v.jsx("span",{className:"text-dark",children:h})]}),i&&v.jsxs("div",{style:{position:"absolute",top:"100%",right:0,zIndex:1e3,minWidth:"300px",background:"white",border:"1px solid #dee2e6",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",padding:"16px",marginTop:"4px"},children:[v.jsxs("div",{style:{marginBottom:"12px",paddingBottom:"8px",borderBottom:"1px solid #dee2e6",display:"flex",alignItems:"center"},children:[v.jsx("span",{className:"me-2",children:j.apps}),v.jsx("strong",{children:r.APP_NAME||t})]}),v.jsxs("div",{style:{marginBottom:"12px"},children:[v.jsx("span",{className:"text-muted",children:"Версия: "}),v.jsx("strong",{children:h})]}),f.length>0&&v.jsx("div",{style:{fontSize:"13px"},children:f.map(({key:E,value:l,label:_,icon:d})=>{const b=l.length>40&&(E.includes("URL")||E.includes("MESSAGE"))?`${l.substring(0,37)}...`:l;return v.jsxs("div",{style:{marginBottom:"8px",display:"flex",alignItems:"flex-start"},children:[v.jsx("span",{className:"me-2",style:{flexShrink:0},children:d}),v.jsxs("div",{style:{flex:1,minWidth:0},children:[v.jsx("div",{className:"small text-muted",children:_}),v.jsx("div",{className:"font-monospace small text-truncate",style:{maxWidth:"100%"},title:l,children:E.includes("URL")?v.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",style:{color:"#007bff"},children:b}):b})]})]},E)})}),f.length===0&&v.jsx("div",{className:"text-center text-muted py-2 small",children:"Нет информации о версии"}),v.jsx("div",{style:{marginTop:"12px",paddingTop:"8px",borderTop:"1px solid #dee2e6",textAlign:"center",fontSize:"12px",color:"#6c757d"},children:"IngoBank DevOps Platform"}),v.jsx("button",{onClick:()=>p(!1),style:{position:"absolute",top:"8px",right:"8px",background:"transparent",border:"none",cursor:"pointer",fontSize:"16px",color:"#6c757d"},children:"×"})]}),i&&v.jsx("div",{onClick:()=>p(!1),style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:999}})]})}const le="platform-kit",Pe=c.createContext(null);function Ht({children:t}){const[n,a]=c.useState([]),o=typeof window<"u"&&window.__MF_NAME__||le,i=c.useCallback((d,b,w,N)=>({id:`${Date.now()}-${Math.random().toString(36).substr(2,9)}`,type:d,title:b,message:w,mfeName:o,timestamp:Date.now(),duration:N}),[o]),p=c.useCallback(d=>{a(w=>[...w,d].slice(0,5));const b=d.duration||5e3;b>0&&setTimeout(()=>{a(w=>w.filter(N=>N.id!==d.id))},b)},[]),r=c.useCallback(d=>{const b=i(d.type,d.title,d.message,d.duration);p(b),typeof window<"u"&&window.dispatchEvent(new CustomEvent("mfe-notification",{detail:b,bubbles:!0}))},[i,p]),h=c.useCallback((d,b="Успешно")=>{r({type:"success",title:b,message:d})},[r]),f=c.useCallback((d,b="Ошибка")=>{r({type:"error",title:b,message:d})},[r]),E=c.useCallback((d,b="Предупреждение")=>{r({type:"warning",title:b,message:d})},[r]),l=c.useCallback((d,b="Информация")=>{r({type:"info",title:b,message:d})},[r]),_=c.useCallback(d=>{a(b=>b.filter(w=>w.id!==d))},[]);return c.useEffect(()=>{if(typeof window>"u")return;const d=b=>{const w=b.detail;if(w&&w.type&&w.title&&w.message){const N={...w,id:`${Date.now()}-${Math.random().toString(36).substr(2,9)}`};p(N)}};return window.addEventListener("mfe-notification",d),()=>{window.removeEventListener("mfe-notification",d)}},[p]),v.jsxs(Pe.Provider,{value:{notify:r,notifySuccess:h,notifyError:f,notifyWarning:E,notifyInfo:l,removeNotification:_},children:[t,n.length>0&&v.jsx("div",{style:{position:"fixed",top:"80px",right:"20px",zIndex:9998,maxWidth:"400px",width:"100%",display:"flex",flexDirection:"column",gap:"8px",pointerEvents:"none"},children:n.map(d=>v.jsxs("div",{className:`notification notification-${d.type}`,style:{pointerEvents:"auto",padding:"12px 16px",borderRadius:"8px",background:d.type==="success"?"#d4edda":d.type==="error"?"#f8d7da":d.type==="warning"?"#fff3cd":"#d1ecf1",color:d.type==="success"?"#155724":d.type==="error"?"#721c24":d.type==="warning"?"#856404":"#0c5460",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",display:"flex",alignItems:"flex-start",gap:"12px"},children:[v.jsxs("div",{style:{flex:1},children:[v.jsx("strong",{style:{display:"block",marginBottom:"4px"},children:d.title}),v.jsx("p",{style:{margin:0,fontSize:"14px"},children:d.message}),v.jsx("small",{style:{opacity:.7,fontSize:"12px"},children:d.mfeName})]}),v.jsx("button",{onClick:()=>_(d.id),style:{background:"transparent",border:"none",cursor:"pointer",fontSize:"18px",lineHeight:1,opacity:.5},children:"×"})]},d.id))})]})}function Wt(){const t=c.useContext(Pe);return t||{notify:()=>{},notifySuccess:()=>{},notifyError:()=>{},notifyWarning:()=>{},notifyInfo:()=>{},removeNotification:()=>{}}}function zt(t){if(typeof window>"u")return;const n=window.__MF_NAME__||le,a={...t,mfeName:n,timestamp:Date.now()};window.dispatchEvent(new CustomEvent("mfe-notification",{detail:a,bubbles:!0}))}function Q(t,n){const a=n?.prefix?`[${n.prefix}]`:`[${t}]`;return{log:(...o)=>{},warn:(...o)=>{},error:(...o)=>{console.error(a,...o)},info:(...o)=>{}}}const Gt=Q("platform-kit",{prefix:"AUTH"}),Yt=Q("platform-kit",{prefix:"API"}),Jt=Q("platform-kit",{prefix:"ERROR"}),Kt=Q("platform-kit",{prefix:"INFO"}),Xt={},Zt={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error("[getMfeName]",...t)}};function fe(t){return t?t.mfeName?t.mfeName:t.name?t.name.replace("@ib-dop/",""):null:null}function je(){if(typeof window>"u")return null;const t=window;return t.__MF_NAME__?t.__MF_NAME__:null}function Oe(){if(typeof window>"u")return null;try{const t=sessionStorage.getItem("mf-config");if(t){const n=JSON.parse(t);if(n.mfeName)return n.mfeName;if(n.name)return n.name;if(n.appName)return n.appName}}catch{}return null}function de(){const t=Xt;return t.VITE_MFE_NAME?String(t.VITE_MFE_NAME):t.MFE_NAME?String(t.MFE_NAME):null}let re=null,pe=!1;function De(t,n){const a=fe(t);if(a)return a;if(pe&&re)return re;const o=[{source:"window.__MF_NAME__",value:je()},{source:"sessionStorage.mf-config",value:Oe()},{source:"import.meta.env.VITE_MFE_NAME",value:de()}];for(const{source:p,value:r}of o)if(r)return re=r,pe=!0,r;if(n)return n;const i="Cannot determine MFE name. Please pass mfeName in props, set window.__MF_NAME__, sessionStorage.mf-config, or VITE_MFE_NAME";throw Zt.error(i),new Error(i)}function Qt(t){return De(t)}function Fe(t){return fe(t)?"props.mfeName":je()?"window.__MF_NAME__":Oe()?"sessionStorage.mf-config":de()?"import.meta.env.VITE_MFE_NAME":null}function qt(t){return Fe(t)!==null}function $t(){re=null,pe=!1}function en(t){const n=[];return fe(t)&&n.push("props.mfeName"),typeof window<"u"&&(window.__MF_NAME__&&n.push("window.__MF_NAME__"),sessionStorage.getItem("mf-config")&&n.push("sessionStorage.mf-config")),de()&&n.push("import.meta.env.VITE_MFE_NAME"),n}g.ErrorBoundary=Bt,g.NotificationProvider=Ht,g.VersionInfo=Vt,g.api=B,g.apiLogger=Yt,g.authLogger=Gt,g.createApiClient=Ce,g.createMfLogger=Q,g.del=At,g.dispatchNotification=zt,g.errorLogger=Jt,g.get=bt,g.getAccessToken=ft,g.getAllMfeNameSources=en,g.getAuthState=lt,g.getMfeName=De,g.getMfeNameSource=Fe,g.getShellAuth=U,g.hasMfeName=qt,g.infoLogger=Kt,g.isAuthenticated=dt,g.logout=pt,g.post=St,g.put=kt,g.redirectToLogin=be,g.requireMfeName=Qt,g.resetMfeNameCache=$t,g.useApi=K,g.useDel=Mt,g.useFeatureAdmin=jt,g.useFeatures=Pt,g.useGet=Tt,g.useInfoData=ke,g.useMicrofrontendsFeatures=Ot,g.useNotification=Wt,g.usePermissions=Nt,g.usePost=xt,g.usePut=Rt,g.useShellAuth=J,g.useV1Config=mt,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
18
+ ${r}`]})]}),E.jsxs("div",{style:{marginTop:"12px",display:"flex",gap:"8px",justifyContent:"center"},children:[E.jsx("button",{onClick:this.handleCopy,style:{padding:"8px 12px",background:"#666",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},children:"📋 Копировать"}),E.jsx("button",{onClick:this.handleRetry,style:{padding:"8px 12px",background:"#d32f2f",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},children:"🔄 Обновить"}),E.jsx("button",{onClick:this.handleGoHome,style:{padding:"8px 12px",background:"#1976d2",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},children:"🏠 На главную"})]})]})}return this.props.children==null?null:this.props.children}}function Bt(){const[t,n]=l.useState("light");return l.useEffect(()=>{const r=()=>{const p=document.body.classList.contains("dark")||document.body.classList.contains("dark-theme")||document.body.classList.contains("theme-dark")||document.body.classList.contains("bg-dark")||document.documentElement.classList.contains("dark")||document.documentElement.classList.contains("dark-theme")||window.matchMedia("(prefers-color-scheme: dark)").matches;n(p?"dark":"light"),console.log("[VersionInfo] Theme detected:",p?"dark":"light","classes:",document.body.className)};r();const i=new MutationObserver(r);i.observe(document.body,{attributes:!0,attributeFilter:["class"]});const c=window.matchMedia("(prefers-color-scheme: dark)");return c.addEventListener("change",r),()=>{i.disconnect(),c.removeEventListener("change",r)}},[]),t}const O={info:"ℹ️",code:"💻",link:"🔗",user:"👤",clock:"🕐",apps:"📦",storage:"💾",tags:"🏷️",spreadsheet:"📊"};function Ht({mfeName:t}){const{data:n,isLoading:r,error:i}=Se({mfeName:t}),[c,p]=l.useState(!1),o=Bt();if(r)return E.jsxs("span",{className:"text-muted small me-2",children:[E.jsx("span",{className:"me-1",children:"⏳"}),"Загрузка..."]});if(i||!n)return E.jsxs("span",{className:"text-muted small me-2",title:`Ошибка: ${i||"нет данных"}`,children:[E.jsx("span",{className:"me-1",children:"ℹ️"}),"N/A"]});const a=n,h=a.BUILD_VERSION||a.IMAGE_VERSION||a.APP_NAME||"N/A",b=a.APP_NAME?`${a.APP_NAME}: ${h}`:h||t,u=[];return a.APP_NAME&&u.push({key:"APP_NAME",value:a.APP_NAME,label:"Приложение",icon:O.apps}),a.BUILD_VERSION&&u.push({key:"BUILD_VERSION",value:a.BUILD_VERSION,label:"Версия",icon:O.tags}),a.IMAGE_VERSION&&u.push({key:"IMAGE_VERSION",value:a.IMAGE_VERSION,label:"Образ",icon:O.storage}),a.GIT_COMMIT&&u.push({key:"GIT_COMMIT",value:a.GIT_COMMIT,label:"Commit",icon:O.spreadsheet}),a.COMMIT_SHA&&u.push({key:"COMMIT_SHA",value:a.COMMIT_SHA,label:"Commit",icon:O.spreadsheet}),a.GIT_BRANCH&&u.push({key:"GIT_BRANCH",value:a.GIT_BRANCH,label:"Ветка",icon:O.spreadsheet}),a.BUILD_BRANCH&&u.push({key:"BUILD_BRANCH",value:a.BUILD_BRANCH,label:"Ветка",icon:O.spreadsheet}),a.CI_COMMIT_AUTHOR&&u.push({key:"CI_COMMIT_AUTHOR",value:a.CI_COMMIT_AUTHOR,label:"Автор",icon:O.user}),a.CI_COMMIT_TIMESTAMP&&u.push({key:"CI_COMMIT_TIMESTAMP",value:a.CI_COMMIT_TIMESTAMP,label:"Дата",icon:O.clock}),a.BUILD_DATE&&u.push({key:"BUILD_DATE",value:a.BUILD_DATE,label:"Сборка",icon:O.clock}),a.CI_JOB_URL&&u.push({key:"CI_JOB_URL",value:a.CI_JOB_URL,label:"CI Job",icon:O.link}),a.CI_PIPELINE_URL&&u.push({key:"CI_PIPELINE_URL",value:a.CI_PIPELINE_URL,label:"Pipeline",icon:O.link}),a.CI_COMMIT_MESSAGE&&(a.CI_COMMIT_MESSAGE.length>60?a.CI_COMMIT_MESSAGE.substring(0,57)+"":a.CI_COMMIT_MESSAGE,u.push({key:"CI_COMMIT_MESSAGE",value:a.CI_COMMIT_MESSAGE,label:"Сообщение",icon:O.code})),E.jsxs("div",{style:{display:"inline-block",position:"relative"},children:[E.jsxs("button",{onClick:()=>p(!c),style:{background:"transparent",border:"none",cursor:"pointer",padding:"4px 8px",fontSize:"14px",display:"inline-flex",alignItems:"center"},title:"Информация о версии",children:[E.jsx("span",{className:"me-1",children:O.info}),E.jsx("span",{style:{color:o==="dark"?"#c4c7cc":"#212529"},children:h})]}),c&&E.jsxs("div",{style:{position:"absolute",top:"100%",right:0,zIndex:1e3,minWidth:"220px",maxWidth:"280px",background:o==="dark"?"#2d3036":"white",border:`1px solid ${o==="dark"?"#40444b":"#dee2e6"}`,borderRadius:"6px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",padding:"10px 12px",marginTop:"4px"},children:[E.jsxs("div",{style:{marginBottom:"8px",paddingBottom:"6px",borderBottom:`1px solid ${o==="dark"?"#40444b":"#dee2e6"}`,display:"flex",alignItems:"center",fontSize:"13px"},children:[E.jsx("span",{className:"me-1",children:O.apps}),E.jsx("strong",{style:{color:o==="dark"?"#e4e5e6":"#212529"},children:b})]}),u.length>0&&E.jsx("div",{style:{fontSize:"12px"},children:u.filter(m=>m.key!=="APP_NAME"&&m.key!=="BUILD_VERSION"&&m.key!=="IMAGE_VERSION").map(({key:m,value:d,label:w,icon:y})=>{const R=m.includes("URL"),x=R?"🔗":d;return E.jsxs("div",{style:{marginBottom:"4px",display:"flex",alignItems:"center"},children:[E.jsx("span",{className:"me-1",style:{flexShrink:0},children:y}),E.jsxs("span",{style:{color:o==="dark"?"#949ba3":"#6c757d",marginRight:"4px"},children:[w,":"]}),R?E.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",style:{color:"#4da6ff",textDecoration:"none"},children:"🔗"}):E.jsx("span",{style:{color:o==="dark"?"#c4c7cc":"#212529"},children:x})]},m)})}),u.length===0&&E.jsx("div",{className:"text-center text-muted py-2 small",children:"Нет информации о версии"}),E.jsx("div",{style:{marginTop:"8px",paddingTop:"6px",borderTop:`1px solid ${o==="dark"?"#40444b":"#dee2e6"}`,textAlign:"center",fontSize:"11px",color:"#6c757d"},children:"IngoBank DevOps Platform"}),E.jsx("button",{onClick:()=>p(!1),style:{position:"absolute",top:"8px",right:"8px",background:"transparent",border:"none",cursor:"pointer",fontSize:"16px",color:"#6c757d"},children:"×"})]}),c&&E.jsx("div",{onClick:()=>p(!1),style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:999}})]})}const le="platform-kit",Pe=l.createContext(null);function zt({children:t}){const[n,r]=l.useState([]),i=typeof window<"u"&&window.__MF_NAME__||le,c=l.useCallback((d,w,y,R)=>({id:`${Date.now()}-${Math.random().toString(36).substr(2,9)}`,type:d,title:w,message:y,mfeName:i,timestamp:Date.now(),duration:R}),[i]),p=l.useCallback(d=>{r(y=>[...y,d].slice(0,5));const w=d.duration||5e3;w>0&&setTimeout(()=>{r(y=>y.filter(R=>R.id!==d.id))},w)},[]),o=l.useCallback(d=>{const w=c(d.type,d.title,d.message,d.duration);p(w),typeof window<"u"&&window.dispatchEvent(new CustomEvent("mfe-notification",{detail:w,bubbles:!0}))},[c,p]),a=l.useCallback((d,w="Успешно")=>{o({type:"success",title:w,message:d})},[o]),h=l.useCallback((d,w="Ошибка")=>{o({type:"error",title:w,message:d})},[o]),b=l.useCallback((d,w="Предупреждение")=>{o({type:"warning",title:w,message:d})},[o]),u=l.useCallback((d,w="Информация")=>{o({type:"info",title:w,message:d})},[o]),m=l.useCallback(d=>{r(w=>w.filter(y=>y.id!==d))},[]);return l.useEffect(()=>{if(typeof window>"u")return;const d=w=>{const y=w.detail;if(y&&y.type&&y.title&&y.message){const R={...y,id:`${Date.now()}-${Math.random().toString(36).substr(2,9)}`};p(R)}};return window.addEventListener("mfe-notification",d),()=>{window.removeEventListener("mfe-notification",d)}},[p]),E.jsxs(Pe.Provider,{value:{notify:o,notifySuccess:a,notifyError:h,notifyWarning:b,notifyInfo:u,removeNotification:m},children:[t,n.length>0&&E.jsx("div",{style:{position:"fixed",top:"80px",right:"20px",zIndex:9998,maxWidth:"400px",width:"100%",display:"flex",flexDirection:"column",gap:"8px",pointerEvents:"none"},children:n.map(d=>E.jsxs("div",{className:`notification notification-${d.type}`,style:{pointerEvents:"auto",padding:"12px 16px",borderRadius:"8px",background:d.type==="success"?"#d4edda":d.type==="error"?"#f8d7da":d.type==="warning"?"#fff3cd":"#d1ecf1",color:d.type==="success"?"#155724":d.type==="error"?"#721c24":d.type==="warning"?"#856404":"#0c5460",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",display:"flex",alignItems:"flex-start",gap:"12px"},children:[E.jsxs("div",{style:{flex:1},children:[E.jsx("strong",{style:{display:"block",marginBottom:"4px"},children:d.title}),E.jsx("p",{style:{margin:0,fontSize:"14px"},children:d.message}),E.jsx("small",{style:{opacity:.7,fontSize:"12px"},children:d.mfeName})]}),E.jsx("button",{onClick:()=>m(d.id),style:{background:"transparent",border:"none",cursor:"pointer",fontSize:"18px",lineHeight:1,opacity:.5},children:"×"})]},d.id))})]})}function Wt(){const t=l.useContext(Pe);return t||{notify:()=>{},notifySuccess:()=>{},notifyError:()=>{},notifyWarning:()=>{},notifyInfo:()=>{},removeNotification:()=>{}}}function Gt(t){if(typeof window>"u")return;const n=window.__MF_NAME__||le,r={...t,mfeName:n,timestamp:Date.now()};window.dispatchEvent(new CustomEvent("mfe-notification",{detail:r,bubbles:!0}))}function Z(t,n){const r=n?.prefix?`[${n.prefix}]`:`[${t}]`;return{log:(...i)=>{},warn:(...i)=>{},error:(...i)=>{console.error(r,...i)},info:(...i)=>{}}}const Yt=Z("platform-kit",{prefix:"AUTH"}),Jt=Z("platform-kit",{prefix:"API"}),Kt=Z("platform-kit",{prefix:"ERROR"}),Xt=Z("platform-kit",{prefix:"INFO"}),Qt={},Zt={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error("[getMfeName]",...t)}};function fe(t){return t?t.mfeName?t.mfeName:t.name?t.name.replace("@ib-dop/",""):null:null}function Oe(){if(typeof window>"u")return null;const t=window;return t.__MF_NAME__?t.__MF_NAME__:null}function je(){if(typeof window>"u")return null;try{const t=sessionStorage.getItem("mf-config");if(t){const n=JSON.parse(t);if(n.mfeName)return n.mfeName;if(n.name)return n.name;if(n.appName)return n.appName}}catch{}return null}function de(){const t=Qt;return t.VITE_MFE_NAME?String(t.VITE_MFE_NAME):t.MFE_NAME?String(t.MFE_NAME):null}let re=null,pe=!1;function De(t,n){const r=fe(t);if(r)return r;if(pe&&re)return re;const i=[{source:"window.__MF_NAME__",value:Oe()},{source:"sessionStorage.mf-config",value:je()},{source:"import.meta.env.VITE_MFE_NAME",value:de()}];for(const{source:p,value:o}of i)if(o)return re=o,pe=!0,o;if(n)return n;const c="Cannot determine MFE name. Please pass mfeName in props, set window.__MF_NAME__, sessionStorage.mf-config, or VITE_MFE_NAME";throw Zt.error(c),new Error(c)}function qt(t){return De(t)}function Fe(t){return fe(t)?"props.mfeName":Oe()?"window.__MF_NAME__":je()?"sessionStorage.mf-config":de()?"import.meta.env.VITE_MFE_NAME":null}function $t(t){return Fe(t)!==null}function en(){re=null,pe=!1}function tn(t){const n=[];return fe(t)&&n.push("props.mfeName"),typeof window<"u"&&(window.__MF_NAME__&&n.push("window.__MF_NAME__"),sessionStorage.getItem("mf-config")&&n.push("sessionStorage.mf-config")),de()&&n.push("import.meta.env.VITE_MFE_NAME"),n}g.ErrorBoundary=Vt,g.NotificationProvider=zt,g.VersionInfo=Ht,g.api=V,g.apiLogger=Jt,g.authLogger=Yt,g.createApiClient=Ce,g.createMfLogger=Z,g.del=At,g.dispatchNotification=Gt,g.errorLogger=Kt,g.get=wt,g.getAccessToken=ft,g.getAllMfeNameSources=tn,g.getAuthState=lt,g.getMfeName=De,g.getMfeNameSource=Fe,g.getShellAuth=U,g.hasMfeName=$t,g.infoLogger=Xt,g.isAuthenticated=dt,g.logout=pt,g.post=kt,g.put=St,g.redirectToLogin=we,g.requireMfeName=qt,g.resetMfeNameCache=en,g.useApi=K,g.useDel=Mt,g.useFeatureAdmin=Ot,g.useFeatures=Pt,g.useGet=Tt,g.useInfoData=Se,g.useMicrofrontendsFeatures=jt,g.useNotification=Wt,g.usePermissions=Nt,g.usePost=xt,g.usePut=Rt,g.useShellAuth=J,g.useV1Config=gt,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibdop/platform-kit",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "private": false,
5
5
  "description": "Platform Kit - переиспользуемые хуки и компоненты для MF IngoBank DevOps Platform",
6
6
  "main": "dist/index.js",
@@ -2,25 +2,13 @@
2
2
  * VersionInfo - Компонент для отображения информации о версии MF
3
3
  *
4
4
  * Показывает popover с детальной информацией о версии, Git, CI/CD
5
+ * Поддерживает светлую и тёмную тему
5
6
  */
6
7
 
7
- import React, { useState } from 'react'
8
+ import React, { useState, useEffect } from 'react'
8
9
  import { useInfoData } from '../hooks/useInfoData'
9
10
  import type { InfoData } from '../types'
10
11
 
11
- // Icons (mock - in real implementation use @coreui/icons)
12
- const icons = {
13
- info: 'ℹ️',
14
- code: '💻',
15
- link: '🔗',
16
- user: '👤',
17
- clock: '🕐',
18
- apps: '📦',
19
- storage: '💾',
20
- tags: '🏷️',
21
- spreadsheet: '📊',
22
- }
23
-
24
12
  // MF Name for logging
25
13
  const MF_NAME = 'platform-kit'
26
14
 
@@ -42,6 +30,59 @@ const logger = {
42
30
  },
43
31
  }
44
32
 
33
+ /**
34
+ * Detect current theme
35
+ */
36
+ function useTheme(): 'light' | 'dark' {
37
+ const [theme, setTheme] = useState<'light' | 'dark'>('light')
38
+
39
+ useEffect(() => {
40
+ // Check for dark theme on body or html
41
+ const checkTheme = () => {
42
+ const isDark =
43
+ document.body.classList.contains('dark') ||
44
+ document.body.classList.contains('dark-theme') ||
45
+ document.body.classList.contains('theme-dark') ||
46
+ document.body.classList.contains('bg-dark') ||
47
+ document.documentElement.classList.contains('dark') ||
48
+ document.documentElement.classList.contains('dark-theme') ||
49
+ window.matchMedia('(prefers-color-scheme: dark)').matches
50
+ setTheme(isDark ? 'dark' : 'light')
51
+ console.log('[VersionInfo] Theme detected:', isDark ? 'dark' : 'light', 'classes:', document.body.className)
52
+ }
53
+
54
+ checkTheme()
55
+
56
+ // Listen for theme changes
57
+ const observer = new MutationObserver(checkTheme)
58
+ observer.observe(document.body, { attributes: true, attributeFilter: ['class'] })
59
+
60
+ // Also listen for media query changes
61
+ const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)')
62
+ mediaQuery.addEventListener('change', checkTheme)
63
+
64
+ return () => {
65
+ observer.disconnect()
66
+ mediaQuery.removeEventListener('change', checkTheme)
67
+ }
68
+ }, [])
69
+
70
+ return theme
71
+ }
72
+
73
+ // Icons (simple emoji icons)
74
+ const icons = {
75
+ info: 'ℹ️',
76
+ code: '💻',
77
+ link: '🔗',
78
+ user: '👤',
79
+ clock: '🕐',
80
+ apps: '📦',
81
+ storage: '💾',
82
+ tags: '🏷️',
83
+ spreadsheet: '📊',
84
+ }
85
+
45
86
  /**
46
87
  * Props для VersionInfo
47
88
  */
@@ -60,8 +101,9 @@ interface VersionInfoProps {
60
101
  export default function VersionInfo({ mfeName }: VersionInfoProps): React.ReactElement {
61
102
  const { data: infoData, isLoading, error } = useInfoData({ mfeName })
62
103
  const [visible, setVisible] = useState(false)
104
+ const theme = useTheme()
63
105
 
64
- logger.log('VersionInfo rendered:', { mfeName, isLoading, error })
106
+ logger.log('VersionInfo rendered:', { mfeName, isLoading, error, theme })
65
107
 
66
108
  if (isLoading) {
67
109
  return (
@@ -85,6 +127,9 @@ export default function VersionInfo({ mfeName }: VersionInfoProps): React.ReactE
85
127
  const info = infoData as Record<string, string>
86
128
  const displayVersion = info.BUILD_VERSION || info.IMAGE_VERSION || info.APP_NAME || 'N/A'
87
129
 
130
+ // Header format: 📦 mf-kc: 0.0.1
131
+ const headerTitle = info.APP_NAME ? `${info.APP_NAME}: ${displayVersion}` : (displayVersion || mfeName)
132
+
88
133
  // Collect available fields
89
134
  const availableFields: { key: string; value: string; label: string; icon: string }[] = []
90
135
 
@@ -148,7 +193,7 @@ export default function VersionInfo({ mfeName }: VersionInfoProps): React.ReactE
148
193
  title="Информация о версии"
149
194
  >
150
195
  <span className="me-1">{icons.info}</span>
151
- <span className="text-dark">{displayVersion}</span>
196
+ <span style={{ color: theme === 'dark' ? '#c4c7cc' : '#212529' }}>{displayVersion}</span>
152
197
  </button>
153
198
 
154
199
  {/* Popover */}
@@ -159,65 +204,56 @@ export default function VersionInfo({ mfeName }: VersionInfoProps): React.ReactE
159
204
  top: '100%',
160
205
  right: 0,
161
206
  zIndex: 1000,
162
- minWidth: '300px',
163
- background: 'white',
164
- border: '1px solid #dee2e6',
165
- borderRadius: '8px',
207
+ minWidth: '220px',
208
+ maxWidth: '280px',
209
+ background: theme === 'dark' ? '#2d3036' : 'white',
210
+ border: `1px solid ${theme === 'dark' ? '#40444b' : '#dee2e6'}`,
211
+ borderRadius: '6px',
166
212
  boxShadow: '0 4px 12px rgba(0,0,0,0.15)',
167
- padding: '16px',
213
+ padding: '10px 12px',
168
214
  marginTop: '4px',
169
215
  }}
170
216
  >
171
217
  {/* Header */}
172
218
  <div style={{
173
- marginBottom: '12px',
174
- paddingBottom: '8px',
175
- borderBottom: '1px solid #dee2e6',
219
+ marginBottom: '8px',
220
+ paddingBottom: '6px',
221
+ borderBottom: `1px solid ${theme === 'dark' ? '#40444b' : '#dee2e6'}`,
176
222
  display: 'flex',
177
223
  alignItems: 'center',
224
+ fontSize: '13px',
178
225
  }}>
179
- <span className="me-2">{icons.apps}</span>
180
- <strong>{info.APP_NAME || mfeName}</strong>
181
- </div>
182
-
183
- {/* Version */}
184
- <div style={{ marginBottom: '12px' }}>
185
- <span className="text-muted">Версия: </span>
186
- <strong>{displayVersion}</strong>
226
+ <span className="me-1">{icons.apps}</span>
227
+ <strong style={{ color: theme === 'dark' ? '#e4e5e6' : '#212529' }}>{headerTitle}</strong>
187
228
  </div>
188
229
 
189
- {/* Fields */}
230
+ {/* Fields - compact without full URLs */}
190
231
  {availableFields.length > 0 && (
191
- <div style={{ fontSize: '13px' }}>
192
- {availableFields.map(({ key, value, label, icon }) => {
193
- const displayValue = value.length > 40 && (key.includes('URL') || key.includes('MESSAGE'))
194
- ? `${value.substring(0, 37)}...`
195
- : value
232
+ <div style={{ fontSize: '12px' }}>
233
+ {availableFields.filter(f =>
234
+ // Hide these fields - they're already in header or redundant
235
+ f.key !== 'APP_NAME' && f.key !== 'BUILD_VERSION' && f.key !== 'IMAGE_VERSION'
236
+ ).map(({ key, value, label, icon }) => {
237
+ // For URLs, just show the label with clickable link
238
+ const isUrl = key.includes('URL')
239
+ const displayValue = isUrl ? '🔗' : value
196
240
 
197
241
  return (
198
- <div key={key} style={{ marginBottom: '8px', display: 'flex', alignItems: 'flex-start' }}>
199
- <span className="me-2" style={{ flexShrink: 0 }}>{icon}</span>
200
- <div style={{ flex: 1, minWidth: 0 }}>
201
- <div className="small text-muted">{label}</div>
202
- <div
203
- className="font-monospace small text-truncate"
204
- style={{ maxWidth: '100%' }}
205
- title={value}
242
+ <div key={key} style={{ marginBottom: '4px', display: 'flex', alignItems: 'center' }}>
243
+ <span className="me-1" style={{ flexShrink: 0 }}>{icon}</span>
244
+ <span style={{ color: theme === 'dark' ? '#949ba3' : '#6c757d', marginRight: '4px' }}>{label}:</span>
245
+ {isUrl ? (
246
+ <a
247
+ href={value}
248
+ target="_blank"
249
+ rel="noopener noreferrer"
250
+ style={{ color: '#4da6ff', textDecoration: 'none' }}
206
251
  >
207
- {key.includes('URL') ? (
208
- <a
209
- href={value}
210
- target="_blank"
211
- rel="noopener noreferrer"
212
- style={{ color: '#007bff' }}
213
- >
214
- {displayValue}
215
- </a>
216
- ) : (
217
- displayValue
218
- )}
219
- </div>
220
- </div>
252
+ 🔗
253
+ </a>
254
+ ) : (
255
+ <span style={{ color: theme === 'dark' ? '#c4c7cc' : '#212529' }}>{displayValue}</span>
256
+ )}
221
257
  </div>
222
258
  )
223
259
  })}
@@ -232,12 +268,12 @@ export default function VersionInfo({ mfeName }: VersionInfoProps): React.ReactE
232
268
 
233
269
  {/* Footer */}
234
270
  <div style={{
235
- marginTop: '12px',
236
- paddingTop: '8px',
237
- borderTop: '1px solid #dee2e6',
271
+ marginTop: '8px',
272
+ paddingTop: '6px',
273
+ borderTop: `1px solid ${theme === 'dark' ? '#40444b' : '#dee2e6'}`,
238
274
  textAlign: 'center',
239
- fontSize: '12px',
240
- color: '#6c757d',
275
+ fontSize: '11px',
276
+ color: theme === 'dark' ? '#6c757d' : '#6c757d',
241
277
  }}>
242
278
  IngoBank DevOps Platform
243
279
  </div>