@crownpeak/dqm-react-component 1.2.0 → 1.2.2
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/CHANGELOG.md +19 -0
- package/dist/DQMSidebar.d.ts.map +1 -1
- package/dist/context/ai/useAITranslation.d.ts.map +1 -1
- package/dist/dqm-widget.esm.js +21 -21
- package/dist/dqm-widget.iife.js +5 -5
- package/dist/index.cjs +38 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3777 -3740
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/dqm-widget.esm.js
CHANGED
|
@@ -383,43 +383,43 @@ return ot(gp,{open:e,onClose:t,maxWidth:"lg",fullWidth:!0,PaperProps:{style:{bor
|
|
|
383
383
|
/* @__PURE__ */rt(Nd,{variant:"outlined",color:"warning",onClick:x,sx:{textTransform:"none"},children:E("sidebar:ai_cache_clear")}),
|
|
384
384
|
/* @__PURE__ */rt(Nd,{variant:"outlined",startIcon:/* @__PURE__ */rt(Fb,{}),onClick:S,disabled:!k||!n||"initializing"===b,sx:{textTransform:"none"},children:E("sidebar:translation_restart")}),
|
|
385
385
|
/* @__PURE__ */rt(Nd,{variant:"outlined",startIcon:/* @__PURE__ */rt(Fb,{}),onClick:u,disabled:!k||!l,sx:{textTransform:"none"},children:E("sidebar:summary_restart")}),
|
|
386
|
-
/* @__PURE__ */rt(Nd,{onClick:t,sx:{textTransform:"none"},children:E("sidebar:close")})]})]})]})]})};var VA=class extends Error{issues;constructor(e){super(e[0].message),this.name="SchemaError",this.issues=e}},KA=/* @__PURE__ */(e=>(e.uninitialized="uninitialized",e.pending="pending",e.fulfilled="fulfilled",e.rejected="rejected",e))(KA||{}),QA="uninitialized",GA="pending",XA="fulfilled",YA="rejected";function JA(e){return{status:e,isUninitialized:e===QA,isLoading:e===GA,isSuccess:e===XA,isError:e===YA}}var ZA=Qk;function eT(e,t){if(e===t||!(ZA(e)&&ZA(t)||Array.isArray(e)&&Array.isArray(t)))return t;const n=Object.keys(t),r=Object.keys(e);let o=n.length===r.length;const a=Array.isArray(t)?[]:{};for(const i of n)a[i]=eT(e[i],t[i]),o&&(o=e[i]===a[i]);return o?e:a}function tT(e,t,n){return e.reduce((e,r,o)=>(t(r,o)&&e.push(n(r,o)),e),[]).flat()}function nT(e){return null!=e}function rT(e){return[...e?.values()??[]].filter(nT)}function oT(e,t){if(!e)return t;if(!t)return e;if(function(e){return new RegExp("(^|:)//").test(e)}(t))return t;const n=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=(e=>e.replace(/\/$/,""))(e),`${e}${n}${t=(e=>e.replace(/^\//,""))(t)}`}function aT(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var iT=()=>/* @__PURE__ */new Map,sT=e=>{const t=new AbortController;return setTimeout(()=>{const e="signal timed out",n="TimeoutError";t.abort("undefined"!=typeof DOMException?new DOMException(e,n):Object.assign(new Error(e),{name:n}))},e),t.signal},lT=(...e)=>{for(const n of e)if(n.aborted)return AbortSignal.abort(n.reason);const t=new AbortController;for(const n of e)n.addEventListener("abort",()=>t.abort(n.reason),{signal:t.signal,once:!0});return t.signal},cT=(...e)=>fetch(...e),uT=e=>e.status>=200&&e.status<=299,dT=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function pT(e){if(!Qk(e))return e;const t={...e};for(const[n,r]of Object.entries(t))void 0===r&&delete t[n];return t}var fT=class{constructor(e,t=void 0){this.value=e,this.meta=t}},hT="__rtkq/",mT="focused",gT=/* @__PURE__ */C_(`${hT}${mT}`),yT=/* @__PURE__ */C_(`${hT}un${mT}`),bT=/* @__PURE__ */C_(`${hT}online`),vT=/* @__PURE__ */C_(`${hT}offline`),wT="query",xT="mutation",ST="infinitequery";function kT(e){return e.type===wT}function CT(e){return e.type===ST}function _T(e){return kT(e)||CT(e)}function ET(e,t,n,r,o,a){const i="function"==typeof e?e(t,n,r,o):e;return i?tT(i,nT,e=>a(AT(e))):[]}function AT(e){return"string"==typeof e?{type:e}:e}var TT=(e,t)=>e.endpointDefinitions[t],PT=Symbol("forceQueryFn"),RT=e=>"function"==typeof e[PT];var MT=class extends VA{constructor(e,t,n,r){super(e),this.value=t,this.schemaName=n,this._bqMeta=r}},IT=(e,t)=>Array.isArray(e)?e.includes(t):!!e;async function OT(e,t,n,r){const o=await e["~standard"].validate(t);if(o.issues)throw new MT(o.issues,t,n,r);return o.value}function NT(e){return e}var LT=(e={})=>({...e,[T_]:!0});function zT(e,{pages:t,pageParams:n},r){const o=t.length-1;return e.getNextPageParam(t[o],t,n[o],n,r)}function $T(e,{pages:t,pageParams:n},r){return e.getPreviousPageParam?.(t[0],t,n[0],n,r)}function DT(e,t,n,r){return ET(n[e.meta.arg.endpointName][t],B_(e)?e.payload:void 0,F_(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,r)}function jT(e){return dC(e)?a_(e):e}function FT(e,t,n){const r=e[t];r&&n(r)}function BT(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function qT(e,t,n){const r=e[BT(t)];r&&n(r)}var WT={};function HT({reducerPath:e,queryThunk:t,mutationThunk:n,serializeQueryArgs:r,context:{endpointDefinitions:o,apiUid:a,extractRehydrationInfo:i,hasRehydrationInfo:s},assertTagType:l,config:c}){const u=C_(`${e}/resetApiState`);function d(e,t,n,r){e[t.queryCacheKey]??={status:QA,endpointName:t.endpointName},FT(e,t.queryCacheKey,e=>{e.status=GA,e.requestId=n&&e.requestId?e.requestId:r.requestId,void 0!==t.originalArgs&&(e.originalArgs=t.originalArgs),e.startedTimeStamp=r.startedTimeStamp;CT(o[r.arg.endpointName])&&"direction"in t&&(e.direction=t.direction)})}function p(e,t,n,r){FT(e,t.arg.queryCacheKey,e=>{if(e.requestId!==t.requestId&&!r)return;const{merge:a}=o[t.arg.endpointName];if(e.status=XA,a)if(void 0!==e.data){const{fulfilledTimeStamp:r,arg:o,baseQueryMeta:i,requestId:s}=t;let l=c_(e.data,e=>a(e,n,{arg:o.originalArgs,baseQueryMeta:i,fulfilledTimeStamp:r,requestId:s}));e.data=l}else e.data=n;else e.data=o[t.arg.endpointName].structuralSharing??1?eT(dC(e.data)?(i=e.data,dC(i)||nC(15),i[tC].base_):e.data,n):n;var i;delete e.error,e.fulfilledTimeStamp=t.fulfilledTimeStamp})}const f=tE({name:`${e}/queries`,initialState:WT,reducers:{removeQueryResult:{reducer(e,{payload:{queryCacheKey:t}}){delete e[t]},prepare:P_()},cacheEntriesUpserted:{reducer(e,t){for(const n of t.payload){const{queryDescription:r,value:o}=n;d(e,r,!0,{arg:r,requestId:t.meta.requestId,startedTimeStamp:t.meta.timestamp}),p(e,{arg:r,requestId:t.meta.requestId,fulfilledTimeStamp:t.meta.timestamp,baseQueryMeta:{}},o,!0)}},prepare:e=>({payload:e.map(e=>{const{endpointName:t,arg:n,value:a}=e,i=o[t];return{queryDescription:{type:wT,endpointName:t,originalArgs:e.arg,queryCacheKey:r({queryArgs:n,endpointDefinition:i,endpointName:t})},value:a}}),meta:{[T_]:!0,requestId:W_(),timestamp:Date.now()}})},queryResultPatched:{reducer(e,{payload:{queryCacheKey:t,patches:n}}){FT(e,t,e=>{e.data=d_(e.data,n.concat())})},prepare:P_()}},extraReducers(e){e.addCase(t.pending,(e,{meta:t,meta:{arg:n}})=>{d(e,n,RT(n),t)}).addCase(t.fulfilled,(e,{meta:t,payload:n})=>{p(e,t,n,RT(t.arg))}).addCase(t.rejected,(e,{meta:{condition:t,arg:n,requestId:r},error:o,payload:a})=>{FT(e,n.queryCacheKey,e=>{if(t);else{if(e.requestId!==r)return;e.status=YA,e.error=a??o}})}).addMatcher(s,(e,t)=>{const{queries:n}=i(t);for(const[r,o]of Object.entries(n))o?.status!==XA&&o?.status!==YA||(e[r]=o)})}}),h=tE({name:`${e}/mutations`,initialState:WT,reducers:{removeMutationResult:{reducer(e,{payload:t}){const n=BT(t);n in e&&delete e[n]},prepare:P_()}},extraReducers(e){e.addCase(n.pending,(e,{meta:t,meta:{requestId:n,arg:r,startedTimeStamp:o}})=>{r.track&&(e[BT(t)]={requestId:n,status:GA,endpointName:r.endpointName,startedTimeStamp:o})}).addCase(n.fulfilled,(e,{payload:t,meta:n})=>{n.arg.track&&qT(e,n,e=>{e.requestId===n.requestId&&(e.status=XA,e.data=t,e.fulfilledTimeStamp=n.fulfilledTimeStamp)})}).addCase(n.rejected,(e,{payload:t,error:n,meta:r})=>{r.arg.track&&qT(e,r,e=>{e.requestId===r.requestId&&(e.status=YA,e.error=t??n)})}).addMatcher(s,(e,t)=>{const{mutations:n}=i(t);for(const[r,o]of Object.entries(n))o?.status!==XA&&o?.status!==YA||r===o?.requestId||(e[r]=o)})}}),m=tE({name:`${e}/invalidation`,initialState:{tags:{},keys:{}},reducers:{updateProvidedBy:{reducer(e,t){for(const{queryCacheKey:n,providedTags:r}of t.payload){g(e,n);for(const{type:t,id:o}of r){const r=(e.tags[t]??={})[o||"__internal_without_id"]??=[];r.includes(n)||r.push(n)}e.keys[n]=r}},prepare:P_()}},extraReducers(e){e.addCase(f.actions.removeQueryResult,(e,{payload:{queryCacheKey:t}})=>{g(e,t)}).addMatcher(s,(e,t)=>{const{provided:n}=i(t);for(const[r,o]of Object.entries(n.tags??{}))for(const[t,a]of Object.entries(o)){const o=(e.tags[r]??={})[t||"__internal_without_id"]??=[];for(const t of a){o.includes(t)||o.push(t),e.keys[t]=n.keys[t]}}}).addMatcher(N_(B_(t),F_(t)),(e,t)=>{y(e,[t])}).addMatcher(f.actions.cacheEntriesUpserted.match,(e,t)=>{y(e,t.payload.map(({queryDescription:e,value:t})=>({type:"UNKNOWN",payload:t,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:e}})))})}});function g(e,t){const n=jT(e.keys[t]??[]);for(const r of n){const n=r.type,o=r.id??"__internal_without_id",a=e.tags[n]?.[o];a&&(e.tags[n][o]=jT(a).filter(e=>e!==t))}delete e.keys[t]}function y(e,t){const n=t.map(e=>{const t=DT(e,"providesTags",o,l),{queryCacheKey:n}=e.meta.arg;return{queryCacheKey:n,providedTags:t}});m.caseReducers.updateProvidedBy(e,m.actions.updateProvidedBy(n))}const b=tE({name:`${e}/subscriptions`,initialState:WT,reducers:{updateSubscriptionOptions(e,t){},unsubscribeQueryResult(e,t){},internal_getRTKQSubscriptions(){}}}),v=tE({name:`${e}/internalSubscriptions`,initialState:WT,reducers:{subscriptionsUpdated:{reducer:(e,t)=>d_(e,t.payload),prepare:P_()}}}),w=tE({name:`${e}/config`,initialState:{online:"undefined"==typeof navigator||void 0===navigator.onLine||navigator.onLine,focused:"undefined"==typeof document||"hidden"!==document.visibilityState,middlewareRegistered:!1,...c},reducers:{middlewareRegistered(e,{payload:t}){e.middlewareRegistered="conflict"!==e.middlewareRegistered&&a===t||"conflict"}},extraReducers:e=>{e.addCase(bT,e=>{e.online=!0}).addCase(vT,e=>{e.online=!1}).addCase(gT,e=>{e.focused=!0}).addCase(yT,e=>{e.focused=!1}).addMatcher(s,e=>({...e}))}}),x=Xk({queries:f.reducer,mutations:h.reducer,provided:m.reducer,subscriptions:v.reducer,config:w.reducer});return{reducer:(e,t)=>x(u.match(t)?void 0:e,t),actions:{...w.actions,...f.actions,...b.actions,...v.actions,...h.actions,...m.actions,resetApiState:u}}}var UT=/* @__PURE__ */Symbol.for("RTKQ/skipToken"),VT={status:QA},KT=/* @__PURE__ */c_(VT,()=>{}),QT=/* @__PURE__ */c_(VT,()=>{});var GT=WeakMap?/* @__PURE__ */new WeakMap:void 0,XT=({endpointName:e,queryArgs:t})=>{let n="";const r=GT?.get(t);if("string"==typeof r)n=r;else{const e=JSON.stringify(t,(e,t)=>t=Qk(t="bigint"==typeof t?{$bigint:t.toString()}:t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t);Qk(t)&>?.set(t,e),n=e}return`${e}(${n})`};function YT(...e){return function(t){const n=g_(e=>t.extractRehydrationInfo?.(e,{reducerPath:t.reducerPath??"api"})),r={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...t,extractRehydrationInfo:n,serializeQueryArgs(e){let n=XT;if("serializeQueryArgs"in e.endpointDefinition){const t=e.endpointDefinition.serializeQueryArgs;n=e=>{const n=t(e);return"string"==typeof n?n:XT({...e,queryArgs:n})}}else t.serializeQueryArgs&&(n=t.serializeQueryArgs);return n(e)},tagTypes:[...t.tagTypes||[]]},o={endpointDefinitions:{},batch(e){e()},apiUid:W_(),extractRehydrationInfo:n,hasRehydrationInfo:g_(e=>null!=n(e))},a={injectEndpoints:function(e){const t=e.endpoints({query:e=>({...e,type:wT}),mutation:e=>({...e,type:xT}),infiniteQuery:e=>({...e,type:ST})});for(const[n,r]of Object.entries(t))if(!0!==e.overrideExisting&&n in o.endpointDefinitions){if("throw"===e.overrideExisting)throw new Error(rE(39))}else{o.endpointDefinitions[n]=r;for(const e of i)e.injectEndpoint(n,r)}return a},enhanceEndpoints({addTagTypes:e,endpoints:t}){if(e)for(const n of e)r.tagTypes.includes(n)||r.tagTypes.push(n);if(t)for(const[n,r]of Object.entries(t))"function"==typeof r?r(TT(o,n)):Object.assign(TT(o,n)||{},r);return a}},i=e.map(e=>e.init(a,r,o));return a.injectEndpoints({endpoints:t.endpoints})}}function JT(e,...t){return Object.assign(e,...t)}var ZT=({api:e,queryThunk:t,internalState:n,mwApi:r})=>{const o=`${e.reducerPath}/subscriptions`;let a=null,i=null;const{updateSubscriptionOptions:s,unsubscribeQueryResult:l}=e.internalActions,c=()=>n.currentSubscriptions,u={getSubscriptions:c,getSubscriptionCount:e=>{const t=c().get(e);return t?.size??0},isRequestSubscribed:(e,t)=>{const n=c();return!!n?.get(e)?.get(t)}};function d(e){return JSON.parse(JSON.stringify(Object.fromEntries([...e].map(([e,t])=>[e,Object.fromEntries(t)]))))}return(r,c)=>{if(a||(a=d(n.currentSubscriptions)),e.util.resetApiState.match(r))return a={},n.currentSubscriptions.clear(),i=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(r))return[!1,u];const p=((n,r)=>{if(s.match(r)){const{queryCacheKey:e,requestId:t,options:o}=r.payload,a=n.get(e);return a?.has(t)&&a.set(t,o),!0}if(l.match(r)){const{queryCacheKey:e,requestId:t}=r.payload,o=n.get(e);return o&&o.delete(t),!0}if(e.internalActions.removeQueryResult.match(r))return n.delete(r.payload.queryCacheKey),!0;if(t.pending.match(r)){const{meta:{arg:e,requestId:t}}=r,o=aT(n,e.queryCacheKey,iT);return e.subscribe&&o.set(t,e.subscriptionOptions??o.get(t)??{}),!0}let o=!1;if(t.rejected.match(r)){const{meta:{condition:e,arg:t,requestId:a}}=r;if(e&&t.subscribe){const e=aT(n,t.queryCacheKey,iT);e.set(a,t.subscriptionOptions??e.get(a)??{}),o=!0}}return o})(n.currentSubscriptions,r);let f=!0;if(p){i||(i=setTimeout(()=>{const t=d(n.currentSubscriptions),[,r]=u_(a,()=>t);c.next(e.internalActions.subscriptionsUpdated(r)),a=t,i=null},500));const s="string"==typeof r.type&&!!r.type.startsWith(o),l=t.rejected.match(r)&&r.meta.condition&&!!r.meta.arg.subscribe;f=!s&&!l}return[f,!1]}},eP=({reducerPath:e,api:t,queryThunk:n,context:r,internalState:o,selectors:{selectQueryEntry:a,selectConfig:i},getRunningQueryThunk:s,mwApi:l})=>{const{removeQueryResult:c,unsubscribeQueryResult:u,cacheEntriesUpserted:d}=t.internalActions,p=N_(u.match,n.fulfilled,n.rejected,d.match);function f(e){const t=o.currentSubscriptions.get(e);if(!t)return!1;return t.size>0}const h={};function m(e){for(const t of e.values())t?.abort?.()}function g(e,t,n){const r=t.getState();for(const o of e){const e=a(r,o);e?.endpointName&&y(o,e.endpointName,t,n)}}function y(e,t,n,o){const i=TT(r,t),l=i?.keepUnusedDataFor??o.keepUnusedDataFor;if(l===1/0)return;const u=Math.max(0,Math.min(l,2147482.647));if(!f(e)){const t=h[e];t&&clearTimeout(t),h[e]=setTimeout(()=>{if(!f(e)){const t=a(n.getState(),e);if(t?.endpointName){const e=n.dispatch(s(t.endpointName,t.originalArgs));e?.abort()}n.dispatch(c({queryCacheKey:e}))}delete h[e]},1e3*u)}}return(e,n)=>{const a=n.getState(),s=i(a);if(p(e)){let t;if(d.match(e))t=e.payload.map(e=>e.queryDescription.queryCacheKey);else{const{queryCacheKey:n}=u.match(e)?e.payload:e.meta.arg;t=[n]}g(t,n,s)}if(t.util.resetApiState.match(e)){for(const[e,t]of Object.entries(h))t&&clearTimeout(t),delete h[e];m(o.runningQueries),m(o.runningMutations)}if(r.hasRehydrationInfo(e)){const{queries:t}=r.extractRehydrationInfo(e);g(Object.keys(t),n,s)}}},tP=new Error("Promise never resolved before cacheEntryRemoved."),nP=({api:e,reducerPath:t,context:n,queryThunk:r,mutationThunk:o,internalState:a,selectors:{selectQueryEntry:i,selectApiState:s}})=>{const l=q_(r),c=q_(o),u=B_(r,o),d={},{removeQueryResult:p,removeMutationResult:f,cacheEntriesUpserted:h}=e.internalActions;function m(e,t,n){const r=d[e];r?.valueResolved&&(r.valueResolved({data:t,meta:n}),delete r.valueResolved)}function g(e){const t=d[e];t&&(delete d[e],t.cacheEntryRemoved())}function y(e){const{arg:t,requestId:n}=e.meta,{endpointName:r,originalArgs:o}=t;return[r,o,n]}function b(t,r,o,a,i){const s=TT(n,t),l=s?.onCacheEntryAdded;if(!l)return;const c={},u=new Promise(e=>{c.cacheEntryRemoved=e}),p=Promise.race([new Promise(e=>{c.valueResolved=e}),u.then(()=>{throw tP})]);p.catch(()=>{}),d[o]=c;const f=e.endpoints[t].select(_T(s)?r:o),h=a.dispatch((e,t,n)=>n),m={...a,getCacheEntry:()=>f(a.getState()),requestId:i,extra:h,updateCachedData:_T(s)?n=>a.dispatch(e.util.updateQueryData(t,r,n)):void 0,cacheDataLoaded:p,cacheEntryRemoved:u},g=l(r,m);Promise.resolve(g).catch(e=>{if(e!==tP)throw e})}return(n,a,s)=>{const v=function(e){if(l(e))return e.meta.arg.queryCacheKey;if(c(e))return e.meta.arg.fixedCacheKey??e.meta.requestId;return p.match(e)?e.payload.queryCacheKey:f.match(e)?BT(e.payload):""}(n);function w(e,t,n,r){const o=i(s,t),l=i(a.getState(),t);!o&&l&&b(e,r,t,a,n)}if(r.pending.match(n)){const[e,t,r]=y(n);w(e,v,r,t)}else if(h.match(n))for(const{queryDescription:e,value:t}of n.payload){const{endpointName:r,originalArgs:o,queryCacheKey:a}=e;w(r,a,n.meta.requestId,o),m(a,t,{})}else if(o.pending.match(n)){if(a.getState()[t].mutations[v]){const[e,t,r]=y(n);b(e,t,v,a,r)}}else if(u(n))m(v,n.payload,n.meta.baseQueryMeta);else if(p.match(n)||f.match(n))g(v);else if(e.util.resetApiState.match(n))for(const e of Object.keys(d))g(e)}},rP=({api:e,context:{apiUid:t},reducerPath:n})=>(n,r)=>{e.util.resetApiState.match(n)&&r.dispatch(e.internalActions.middlewareRegistered(t))},oP=({reducerPath:e,context:t,context:{endpointDefinitions:n},mutationThunk:r,queryThunk:o,api:a,assertTagType:i,refetchQuery:s,internalState:l})=>{const{removeQueryResult:c}=a.internalActions,u=N_(B_(r),F_(r)),d=N_(B_(o,r),j_(o,r));let p=[],f=0;function h(n,r){const o=r.getState(),i=o[e];if(p.push(...n),"delayed"===i.config.invalidationBehavior&&f>0)return;const u=p;if(p=[],0===u.length)return;const d=a.util.selectInvalidatedBy(o,u);t.batch(()=>{const e=Array.from(d.values());for(const{queryCacheKey:t}of e){const e=i.queries[t],n=aT(l.currentSubscriptions,t,iT);e&&(0===n.size?r.dispatch(c({queryCacheKey:t})):e.status!==QA&&r.dispatch(s(e)))}})}return(e,t)=>{(o.pending.match(e)||r.pending.match(e))&&f++,d(e)&&(f=Math.max(0,f-1)),u(e)?h(DT(e,"invalidatesTags",n,i),t):d(e)?h([],t):a.util.invalidateTags.match(e)&&h(ET(e.payload,void 0,void 0,void 0,void 0,i),t)}},aP=({reducerPath:e,queryThunk:t,api:n,refetchQuery:r,internalState:o})=>{const{currentPolls:a,currentSubscriptions:i}=o,s=/* @__PURE__ */new Set;let l=null;function c(e,t){s.add(e),l||(l=setTimeout(()=>{for(const e of s)d({queryCacheKey:e},t);s.clear(),l=null},0))}function u({queryCacheKey:t},n){const o=n.getState()[e],s=o.queries[t],l=i.get(t);if(!s||s.status===QA)return;const{lowestPollingInterval:c,skipPollingIfUnfocused:d}=f(l);if(!Number.isFinite(c))return;const p=a.get(t);p?.timeout&&(clearTimeout(p.timeout),p.timeout=void 0);const h=Date.now()+c;a.set(t,{nextPollTimestamp:h,pollingInterval:c,timeout:setTimeout(()=>{!o.config.focused&&d||n.dispatch(r(s)),u({queryCacheKey:t},n)},c)})}function d({queryCacheKey:t},n){const r=n.getState()[e].queries[t],o=i.get(t);if(!r||r.status===QA)return;const{lowestPollingInterval:s}=f(o);if(!Number.isFinite(s))return void p(t);const l=a.get(t),c=Date.now()+s;(!l||c<l.nextPollTimestamp)&&u({queryCacheKey:t},n)}function p(e){const t=a.get(e);t?.timeout&&clearTimeout(t.timeout),a.delete(e)}function f(e=/* @__PURE__ */new Map){let t=!1,n=Number.POSITIVE_INFINITY;for(const r of e.values())r.pollingInterval&&(n=Math.min(r.pollingInterval,n),t=r.skipPollingIfUnfocused||t);return{lowestPollingInterval:n,skipPollingIfUnfocused:t}}return(e,r)=>{(n.internalActions.updateSubscriptionOptions.match(e)||n.internalActions.unsubscribeQueryResult.match(e))&&c(e.payload.queryCacheKey,r),(t.pending.match(e)||t.rejected.match(e)&&e.meta.condition)&&c(e.meta.arg.queryCacheKey,r),(t.fulfilled.match(e)||t.rejected.match(e)&&!e.meta.condition)&&u(e.meta.arg,r),n.util.resetApiState.match(e)&&(!function(){for(const e of a.keys())p(e)}(),l&&(clearTimeout(l),l=null),s.clear())}},iP=({api:e,context:t,queryThunk:n,mutationThunk:r})=>{const o=D_(n,r),a=j_(n,r),i=B_(n,r),s={};return(n,r)=>{if(o(n)){const{requestId:o,arg:{endpointName:a,originalArgs:i}}=n.meta,l=TT(t,a),c=l?.onQueryStarted;if(c){const t={},n=new Promise((e,n)=>{t.resolve=e,t.reject=n});n.catch(()=>{}),s[o]=t;const u=e.endpoints[a].select(_T(l)?i:o),d=r.dispatch((e,t,n)=>n),p={...r,getCacheEntry:()=>u(r.getState()),requestId:o,extra:d,updateCachedData:_T(l)?t=>r.dispatch(e.util.updateQueryData(a,i,t)):void 0,queryFulfilled:n};c(i,p)}}else if(i(n)){const{requestId:e,baseQueryMeta:t}=n.meta;s[e]?.resolve({data:n.payload,meta:t}),delete s[e]}else if(a(n)){const{requestId:e,rejectedWithValue:t,baseQueryMeta:r}=n.meta;s[e]?.reject({error:n.payload??n.error,isUnhandledError:!t,meta:r}),delete s[e]}}};function sP(e){const{reducerPath:t,queryThunk:n,api:r,context:o,getInternalState:a}=e,{apiUid:i}=o,s={invalidateTags:C_(`${t}/invalidateTags`)},l=e=>e.type.startsWith(`${t}/`),c=[rP,eP,oP,aP,nP,iP];return{middleware:n=>{let s=!1;const d=a(n.dispatch),p={...e,internalState:d,refetchQuery:u,isThisApiSliceAction:l,mwApi:n},f=c.map(e=>e(p)),h=ZT(p),m=(({reducerPath:e,context:t,api:n,refetchQuery:r,internalState:o})=>{const{removeQueryResult:a}=n.internalActions;function i(n,i){const s=n.getState()[e],l=s.queries,c=o.currentSubscriptions;t.batch(()=>{for(const e of c.keys()){const t=l[e],o=c.get(e);if(!o||!t)continue;const u=[...o.values()];(u.some(e=>!0===e[i])||u.every(e=>void 0===e[i])&&s.config[i])&&(0===o.size?n.dispatch(a({queryCacheKey:e})):t.status!==QA&&n.dispatch(r(t)))}})}return(e,t)=>{gT.match(e)&&i(t,"refetchOnFocus"),bT.match(e)&&i(t,"refetchOnReconnect")}})(p);return e=>a=>{if(!Jk(a))return e(a);s||(s=!0,n.dispatch(r.internalActions.middlewareRegistered(i)));const c={...n,next:e},u=n.getState(),[d,p]=h(a,c,u);let g;if(g=d?e(a):p,n.getState()[t]&&(m(a,c,u),l(a)||o.hasRehydrationInfo(a)))for(const e of f)e(a,c,u);return g}},actions:s};function u(t){return e.api.endpoints[t.endpointName].initiate(t.originalArgs,{subscribe:!1,forceRefetch:!0})}}var lP=/* @__PURE__ */Symbol(),cP=({createSelector:e=b_}={})=>({name:lP,init(t,{baseQuery:n,tagTypes:r,reducerPath:o,serializeQueryArgs:a,keepUnusedDataFor:i,refetchOnMountOrArgChange:s,refetchOnFocus:l,refetchOnReconnect:c,invalidationBehavior:u,onSchemaFailure:d,catchSchemaFailure:p,skipSchemaValidation:f},h){s_();const m=e=>e;Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:bT,onOffline:vT,onFocus:gT,onFocusLost:yT},util:{}});const g=function({serializeQueryArgs:e,reducerPath:t,createSelector:n}){const r=e=>KT,o=e=>QT;return{buildQuerySelector:function(e,t){return c(e,t,a)},buildInfiniteQuerySelector:function(e,t){const{infiniteQueryOptions:n}=t;return c(e,t,function(e){const t={...e,...JA(e.status)},{isLoading:r,isError:o,direction:a}=t,i="forward"===a,s="backward"===a;return{...t,hasNextPage:u(n,t.data,t.originalArgs),hasPreviousPage:d(n,t.data,t.originalArgs),isFetchingNextPage:r&&i,isFetchingPreviousPage:r&&s,isFetchNextPageError:o&&i,isFetchPreviousPageError:o&&s}})},buildMutationSelector:function(){return e=>{let t;return t="object"==typeof e?BT(e)??UT:e,n(t===UT?o:e=>i(e)?.mutations?.[t]??QT,a)}},selectInvalidatedBy:function(e,n){const r=e[t],o=/* @__PURE__ */new Set,a=tT(n,nT,AT);for(const t of a){const e=r.provided.tags[t.type];if(!e)continue;let n=(void 0!==t.id?e[t.id]:Object.values(e).flat())??[];for(const t of n)o.add(t)}return Array.from(o.values()).flatMap(e=>{const t=r.queries[e];return t?{queryCacheKey:e,endpointName:t.endpointName,originalArgs:t.originalArgs}:[]})},selectCachedArgsForQuery:function(e,t){return tT(Object.values(s(e)),e=>e?.endpointName===t&&e.status!==QA,e=>e.originalArgs)},selectApiState:i,selectQueries:s,selectMutations:function(e){return i(e)?.mutations},selectQueryEntry:l,selectConfig:function(e){return i(e)?.config}};function a(e){return{...e,...JA(e.status)}}function i(e){return e[t]}function s(e){return i(e)?.queries}function l(e,t){return s(e)?.[t]}function c(t,o,a){return i=>{if(i===UT)return n(r,a);const s=e({queryArgs:i,endpointDefinition:o,endpointName:t});return n(e=>l(e,s)??KT,a)}}function u(e,t,n){return!!t&&null!=zT(e,t,n)}function d(e,t,n){return!(!t||!e.getPreviousPageParam)&&null!=$T(e,t,n)}}({serializeQueryArgs:a,reducerPath:o,createSelector:e}),{selectInvalidatedBy:y,selectCachedArgsForQuery:b,buildQuerySelector:v,buildInfiniteQuerySelector:w,buildMutationSelector:x}=g;JT(t.util,{selectInvalidatedBy:y,selectCachedArgsForQuery:b});const{queryThunk:S,infiniteQueryThunk:k,mutationThunk:C,patchQueryData:_,updateQueryData:E,upsertQueryData:A,prefetch:T,buildMatchThunkActions:P}=function({reducerPath:e,baseQuery:t,context:{endpointDefinitions:n},serializeQueryArgs:r,api:o,assertTagType:a,selectors:i,onSchemaFailure:s,catchSchemaFailure:l,skipSchemaValidation:c}){function u(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}function d(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}const p=(e,t)=>e.query&&e[t]?e[t]:NT,f=async(e,{signal:r,abort:o,rejectWithValue:a,fulfillWithValue:f,dispatch:m,getState:g,extra:y})=>{const b=n[e.endpointName],{metaSchema:v,skipSchemaValidation:w=c}=b,x=e.type===wT;try{let C=NT;const _={signal:r,abort:o,dispatch:m,getState:g,extra:y,endpoint:e.endpointName,type:e.type,forced:x?h(e,g()):void 0,queryCacheKey:x?e.queryCacheKey:void 0},E=x?e[PT]:void 0;let A;const T=async(t,n,r,o)=>{if(null==n&&t.pages.length)return Promise.resolve({data:t});const a={queryArg:e.originalArgs,pageParam:n},i=await P(a),s=o?u:d;return{data:{pages:s(t.pages,i.data,r),pageParams:s(t.pageParams,n,r)},meta:i.meta}};async function P(e){let n;const{extraOptions:r,argSchema:o,rawResponseSchema:a,responseSchema:i}=b;if(o&&!IT(w,"arg")&&(e=await OT(o,e,"argSchema",{})),E?n=E():b.query?(C=p(b,"transformResponse"),n=await t(b.query(e),_,r)):n=await b.queryFn(e,_,r,e=>t(e,_,r)),n.error)throw new fT(n.error,n.meta);let{data:s}=n;a&&!IT(w,"rawResponse")&&(s=await OT(a,n.data,"rawResponseSchema",n.meta));let l=await C(s,n.meta,e);return i&&!IT(w,"response")&&(l=await OT(i,l,"responseSchema",n.meta)),{...n,data:l}}if(x&&"infiniteQueryOptions"in b){const{infiniteQueryOptions:R}=b,{maxPages:M=1/0}=R,I=e.refetchCachedPages??R.refetchCachedPages??!0;let O;const N={pages:[],pageParams:[]},L=i.selectQueryEntry(g(),e.queryCacheKey)?.data,z=h(e,g())&&!e.direction||!L?N:L;if("direction"in e&&e.direction&&z.pages.length){const $="backward"===e.direction,D=($?$T:zT)(R,z,e.originalArgs);O=await T(z,D,M,$)}else{const{initialPageParam:j=R.initialPageParam}=e,F=L?.pageParams??[],B=F[0]??j,q=F.length;if(O=await T(z,B,M),E&&(O={data:O.data.pages[0]}),I)for(let W=1;W<q;W++){const H=zT(R,O.data,e.originalArgs);O=await T(O.data,H,M)}}A=O}else A=await P(e.originalArgs);return v&&!IT(w,"meta")&&A.meta&&(A.meta=await OT(v,A.meta,"metaSchema",A.meta)),f(A.data,LT({fulfilledTimeStamp:Date.now(),baseQueryMeta:A.meta}))}catch(S){let U=S;if(U instanceof fT){let V=p(b,"transformErrorResponse");const{rawErrorResponseSchema:K,errorResponseSchema:Q}=b;let{value:G,meta:X}=U;try{K&&!IT(w,"rawErrorResponse")&&(G=await OT(K,G,"rawErrorResponseSchema",X)),v&&!IT(w,"meta")&&(X=await OT(v,X,"metaSchema",X));let Y=await V(G,X,e.originalArgs);return Q&&!IT(w,"errorResponse")&&(Y=await OT(Q,Y,"errorResponseSchema",X)),a(Y,LT({baseQueryMeta:X}))}catch(k){U=k}}try{if(U instanceof MT){const J={endpoint:e.endpointName,arg:e.originalArgs,type:e.type,queryCacheKey:x?e.queryCacheKey:void 0};b.onSchemaFailure?.(U,J),s?.(U,J);const{catchSchemaFailure:Z=l}=b;if(Z)return a(Z(U,J),LT({baseQueryMeta:U._bqMeta}))}}catch(k){U=k}throw console.error(U),U}};function h(e,t){const n=i.selectQueryEntry(t,e.queryCacheKey),r=i.selectConfig(t).refetchOnMountOrArgChange,o=n?.fulfilledTimeStamp,a=e.forceRefetch??(e.subscribe&&r);return!!a&&(!0===a||(Number(/* @__PURE__ */new Date)-Number(o))/1e3>=a)}const m=()=>G_(`${e}/executeQuery`,f,{getPendingMeta({arg:e}){const t=n[e.endpointName];return LT({startedTimeStamp:Date.now(),...CT(t)?{direction:e.direction}:{}})},condition(e,{getState:t}){const r=t(),o=i.selectQueryEntry(r,e.queryCacheKey),a=o?.fulfilledTimeStamp,s=e.originalArgs,l=o?.originalArgs,c=n[e.endpointName],u=e.direction;return!(!RT(e)&&("pending"===o?.status||!h(e,r)&&(!kT(c)||!c?.forceRefetch?.({currentArg:s,previousArg:l,endpointState:o,state:r}))&&a&&!u))},dispatchConditionRejection:!0}),g=m(),y=m(),b=G_(`${e}/executeMutation`,f,{getPendingMeta:()=>LT({startedTimeStamp:Date.now()})});function v(e){return t=>t?.meta?.arg?.endpointName===e}return{queryThunk:g,mutationThunk:b,infiniteQueryThunk:y,prefetch:(e,t,n={})=>(r,a)=>{const i=(e=>"force"in e)(n)&&n.force,s=(e=>"ifOlderThan"in e)(n)&&n.ifOlderThan,l=(n=!0)=>{const r={forceRefetch:n,subscribe:!1};return o.endpoints[e].initiate(t,r)},c=o.endpoints[e].select(t)(a());if(i)r(l());else if(s){const e=c?.fulfilledTimeStamp;if(!e)return void r(l());(Number(/* @__PURE__ */new Date)-Number(new Date(e)))/1e3>=s&&r(l())}else r(l(!1))},updateQueryData:(e,t,n,r=!0)=>(a,i)=>{const s=o.endpoints[e].select(t)(i()),l={patches:[],inversePatches:[],undo:()=>a(o.util.patchQueryData(e,t,l.inversePatches,r))};if(s.status===QA)return l;let c;if("data"in s)if(pC(s.data)){const[e,t,r]=u_(s.data,n);l.patches.push(...t),l.inversePatches.push(...r),c=e}else c=n(s.data),l.patches.push({op:"replace",path:[],value:c}),l.inversePatches.push({op:"replace",path:[],value:s.data});return 0===l.patches.length||a(o.util.patchQueryData(e,t,l.patches,r)),l},upsertQueryData:(e,t,n)=>r=>r(o.endpoints[e].initiate(t,{subscribe:!1,forceRefetch:!0,[PT]:()=>({data:n})})),patchQueryData:(e,t,i,s)=>(l,c)=>{const u=n[e],d=r({queryArgs:t,endpointDefinition:u,endpointName:e});if(l(o.internalActions.queryResultPatched({queryCacheKey:d,patches:i})),!s)return;const p=o.endpoints[e].select(t)(c()),f=ET(u.providesTags,p.data,void 0,t,{},a);l(o.internalActions.updateProvidedBy([{queryCacheKey:d,providedTags:f}]))},buildMatchThunkActions:function(e,t){return{matchPending:L_(D_(e),v(t)),matchFulfilled:L_(B_(e),v(t)),matchRejected:L_(j_(e),v(t))}}}}({baseQuery:n,reducerPath:o,context:h,api:t,serializeQueryArgs:a,assertTagType:m,selectors:g,onSchemaFailure:d,catchSchemaFailure:p,skipSchemaValidation:f}),{reducer:R,actions:M}=HT({context:h,queryThunk:S,mutationThunk:C,serializeQueryArgs:a,reducerPath:o,assertTagType:m,config:{refetchOnFocus:l,refetchOnReconnect:c,refetchOnMountOrArgChange:s,keepUnusedDataFor:i,reducerPath:o,invalidationBehavior:u}});JT(t.util,{patchQueryData:_,updateQueryData:E,upsertQueryData:A,prefetch:T,resetApiState:M.resetApiState,upsertQueryEntries:M.cacheEntriesUpserted}),JT(t.internalActions,M);const I=/* @__PURE__ */new WeakMap,O=e=>aT(I,e,()=>({currentSubscriptions:/* @__PURE__ */new Map,currentPolls:/* @__PURE__ */new Map,runningQueries:/* @__PURE__ */new Map,runningMutations:/* @__PURE__ */new Map})),{buildInitiateQuery:N,buildInitiateInfiniteQuery:L,buildInitiateMutation:z,getRunningMutationThunk:$,getRunningMutationsThunk:D,getRunningQueriesThunk:j,getRunningQueryThunk:F}=function({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:n,mutationThunk:r,api:o,context:a,getInternalState:i}){const s=e=>i(e)?.runningQueries,l=e=>i(e)?.runningMutations,{unsubscribeQueryResult:c,removeMutationResult:u,updateSubscriptionOptions:d}=o.internalActions;return{buildInitiateQuery:function(e,t){return p(e,t)},buildInitiateInfiniteQuery:function(e,t){return p(e,t)},buildInitiateMutation:function(e){return(t,{track:n=!0,fixedCacheKey:o}={})=>(a,i)=>{const s=r({type:"mutation",endpointName:e,originalArgs:t,track:n,fixedCacheKey:o}),c=a(s),{requestId:d,abort:p,unwrap:f}=c,h=(m=e=>({error:e}),c.unwrap().then(e=>({data:e})).catch(m));var m;const g=Object.assign(h,{arg:c.arg,requestId:d,abort:p,unwrap:f,reset:()=>{a(u({requestId:d,fixedCacheKey:o}))}}),y=l(a);return y.set(d,g),g.then(()=>{y.delete(d)}),o&&(y.set(o,g),g.then(()=>{y.get(o)===g&&y.delete(o)})),g}},getRunningQueryThunk:function(t,n){return r=>{const o=TT(a,t),i=e({queryArgs:n,endpointDefinition:o,endpointName:t});return s(r)?.get(i)}},getRunningMutationThunk:function(e,t){return e=>l(e)?.get(t)},getRunningQueriesThunk:function(){return e=>rT(s(e))},getRunningMutationsThunk:function(){return e=>rT(l(e))}};function p(r,a){const i=(l,{subscribe:u=!0,forceRefetch:p,subscriptionOptions:f,[PT]:h,...m}={})=>(g,y)=>{const b=e({queryArgs:l,endpointDefinition:a,endpointName:r});let v;const w={...m,type:wT,subscribe:u,forceRefetch:p,subscriptionOptions:f,endpointName:r,originalArgs:l,queryCacheKey:b,[PT]:h};if(kT(a))v=t(w);else{const{direction:e,initialPageParam:t,refetchCachedPages:r}=m;v=n({...w,direction:e,initialPageParam:t,refetchCachedPages:r})}const x=o.endpoints[r].select(l),S=g(v),k=x(y()),{requestId:C,abort:_}=S,E=k.requestId!==C,A=s(g)?.get(b),T=()=>x(y()),P=Object.assign(h?S.then(T):E&&!A?Promise.resolve(k):Promise.all([A,S]).then(T),{arg:l,requestId:C,subscriptionOptions:f,queryCacheKey:b,abort:_,async unwrap(){const e=await P;if(e.isError)throw e.error;return e.data},refetch:e=>g(i(l,{subscribe:!1,forceRefetch:!0,...e})),unsubscribe(){u&&g(c({queryCacheKey:b,requestId:C}))},updateSubscriptionOptions(e){P.subscriptionOptions=e,g(d({endpointName:r,requestId:C,queryCacheKey:b,options:e}))}});if(!A&&!E&&!h){const e=s(g);e.set(b,P),P.then(()=>{e.delete(b)})}return P};return i}}({queryThunk:S,mutationThunk:C,infiniteQueryThunk:k,api:t,serializeQueryArgs:a,context:h,getInternalState:O});JT(t.util,{getRunningMutationThunk:$,getRunningMutationsThunk:D,getRunningQueryThunk:F,getRunningQueriesThunk:j});const{middleware:B,actions:q}=sP({reducerPath:o,context:h,queryThunk:S,mutationThunk:C,infiniteQueryThunk:k,api:t,assertTagType:m,selectors:g,getRunningQueryThunk:F,getInternalState:O});return JT(t.util,q),JT(t,{reducer:R,middleware:B}),{name:lP,injectEndpoint(e,n){const r=t,o=r.endpoints[e]??={};kT(n)&&JT(o,{name:e,select:v(e,n),initiate:N(e,n)},P(S,e)),n.type===xT&&JT(o,{name:e,select:x(),initiate:z(e)},P(C,e)),CT(n)&&JT(o,{name:e,select:w(e,n),initiate:L(e,n)},P(S,e))}}}});function uP(e){return e.replace(e[0],e[0].toUpperCase())}cP();function dP(e){return"infinitequery"===e.type}function pP(e,...t){return Object.assign(e,...t)}var fP=Symbol();function hP(e){const t=h.useRef(e),n=h.useMemo(()=>eT(t.current,e),[e]);return h.useEffect(()=>{t.current!==n&&(t.current=n)},[n]),n}function mP(e){const t=h.useRef(e);return h.useEffect(()=>{Bi(t.current,e)||(t.current=e)},[e]),Bi(t.current,e)?t.current:e}var gP=/* @__PURE__ */(()=>!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement))(),yP=/* @__PURE__ */(()=>"undefined"!=typeof navigator&&"ReactNative"===navigator.product)(),bP=/* @__PURE__ */(()=>gP||yP?h.useLayoutEffect:h.useEffect)(),vP=e=>e.isUninitialized?{...e,isUninitialized:!1,isFetching:!0,isLoading:void 0===e.data,status:KA.pending}:e;function wP(e,...t){const n={};return t.forEach(t=>{n[t]=e[t]}),n}var xP=["data","status","isLoading","isSuccess","isError","error"];function SP({api:e,moduleOptions:{batch:t,hooks:{useDispatch:n,useSelector:r,useStore:o},unstable__sideEffectsInRender:a,createSelector:i},serializeQueryArgs:s,context:l}){const c=a?e=>e():h.useEffect,u=e=>e.current?.unsubscribe?.(),d=l.endpointDefinitions;return{buildQueryHooks:function(r){const o=(e,t={})=>{const[n]=m(r,e,t);return y(n),h.useMemo(()=>({refetch:()=>function(e){if(!e.current)throw new Error(rE(38));return e.current.refetch()}(n)}),[n])},a=({refetchOnReconnect:o,refetchOnFocus:a,pollingInterval:i=0,skipPollingIfUnfocused:s=!1}={})=>{const{initiate:l}=e.endpoints[r],d=n(),[p,f]=h.useState(fP),m=h.useRef(void 0),g=mP({refetchOnReconnect:o,refetchOnFocus:a,pollingInterval:i,skipPollingIfUnfocused:s});c(()=>{const e=m.current?.subscriptionOptions;g!==e&&m.current?.updateSubscriptionOptions(g)},[g]);const y=h.useRef(g);c(()=>{y.current=g},[g]);const b=h.useCallback(function(e,n=!1){let r;return t(()=>{u(m),m.current=r=d(l(e,{subscriptionOptions:y.current,forceRefetch:!n})),f(e)}),r},[d,l]),v=h.useCallback(()=>{m.current?.queryCacheKey&&d(e.internalActions.removeQueryResult({queryCacheKey:m.current?.queryCacheKey}))},[d]);return h.useEffect(()=>()=>{u(m)},[]),h.useEffect(()=>{p===fP||m.current||b(p,!0)},[p,b]),h.useMemo(()=>[b,p,{reset:v}],[b,p,v])},i=g(r,p);return{useQueryState:i,useQuerySubscription:o,useLazyQuerySubscription:a,useLazyQuery(e){const[t,n,{reset:r}]=a(e),o=i(n,{...e,skip:n===fP}),s=h.useMemo(()=>({lastArg:n}),[n]);return h.useMemo(()=>[t,{...o,reset:r},s],[t,o,r,s])},useQuery(e,t){const n=o(e,t),r=i(e,{selectFromResult:e===UT||t?.skip?void 0:vP,...t}),a=wP(r,...xP);return h.useDebugValue(a),h.useMemo(()=>({...r,...n}),[r,n])}}},buildInfiniteQueryHooks:function(e){const n=(n,r={})=>{const[o,a,i,s]=m(e,n,r),l=h.useRef(s);c(()=>{l.current=s},[s]);const d=mP(r.refetchCachedPages),p=h.useCallback(function(e,n){let r;return t(()=>{u(o),o.current=r=a(i(e,{subscriptionOptions:l.current,direction:n}))}),r},[o,a,i]);y(o);const f=hP(r.skip?UT:n),g=h.useCallback(e=>{if(!o.current)throw new Error(rE(38));const t={refetchCachedPages:e?.refetchCachedPages??d};return o.current.refetch(t)},[o,d]);return h.useMemo(()=>({trigger:p,refetch:g,fetchNextPage:()=>p(f,"forward"),fetchPreviousPage:()=>p(f,"backward")}),[g,p,f])},r=g(e,f);return{useInfiniteQueryState:r,useInfiniteQuerySubscription:n,useInfiniteQuery(e,t){const{refetch:o,fetchNextPage:a,fetchPreviousPage:i}=n(e,t),s=r(e,{selectFromResult:e===UT||t?.skip?void 0:vP,...t}),l=wP(s,...xP,"hasNextPage","hasPreviousPage");return h.useDebugValue(l),h.useMemo(()=>({...s,fetchNextPage:a,fetchPreviousPage:i,refetch:o}),[s,a,i,o])}}},buildMutationHook:function(o){return({selectFromResult:a,fixedCacheKey:s}={})=>{const{select:l,initiate:c}=e.endpoints[o],u=n(),[d,p]=h.useState();h.useEffect(()=>()=>{d?.arg.fixedCacheKey||d?.reset()},[d]);const f=h.useCallback(function(e){const t=u(c(e,{fixedCacheKey:s}));return p(t),t},[u,c,s]),{requestId:m}=d||{},g=h.useMemo(()=>l({fixedCacheKey:s,requestId:d?.requestId}),[s,d,l]),y=h.useMemo(()=>a?i([g],a):g,[a,g]),b=r(y,Bi),v=null==s?d?.arg.originalArgs:void 0,w=h.useCallback(()=>{t(()=>{d&&p(void 0),s&&u(e.internalActions.removeMutationResult({requestId:m,fixedCacheKey:s}))})},[u,s,d,m]),x=wP(b,...xP,"endpointName");h.useDebugValue(x);const S=h.useMemo(()=>({...b,originalArgs:v,reset:w}),[b,v,w]);return h.useMemo(()=>[f,S],[f,S])}},usePrefetch:function(t,r){const o=n(),a=mP(r);return h.useCallback((n,r)=>o(e.util.prefetch(t,n,{...a,...r})),[t,o,a])}};function p(e,t,n){if(t?.endpointName&&e.isUninitialized){const{endpointName:e}=t,r=d[e];n!==UT&&s({queryArgs:t.originalArgs,endpointDefinition:r,endpointName:e})===s({queryArgs:n,endpointDefinition:r,endpointName:e})&&(t=void 0)}let r=e.isSuccess?e.data:t?.data;void 0===r&&(r=e.data);const o=void 0!==r,a=e.isLoading,i=(!t||t.isLoading||t.isUninitialized)&&!o&&a,l=e.isSuccess||o&&(a&&!t?.isError||e.isUninitialized);return{...e,data:r,currentData:e.data,isFetching:a,isLoading:i,isSuccess:l}}function f(e,t,n){if(t?.endpointName&&e.isUninitialized){const{endpointName:e}=t,r=d[e];n!==UT&&s({queryArgs:t.originalArgs,endpointDefinition:r,endpointName:e})===s({queryArgs:n,endpointDefinition:r,endpointName:e})&&(t=void 0)}let r=e.isSuccess?e.data:t?.data;void 0===r&&(r=e.data);const o=void 0!==r,a=e.isLoading,i=(!t||t.isLoading||t.isUninitialized)&&!o&&a,l=e.isSuccess||a&&o;return{...e,data:r,currentData:e.data,isFetching:a,isLoading:i,isSuccess:l}}function m(t,r,{refetchOnReconnect:o,refetchOnFocus:a,refetchOnMountOrArgChange:i,skip:s=!1,pollingInterval:l=0,skipPollingIfUnfocused:u=!1,...p}={}){const{initiate:f}=e.endpoints[t],m=n(),g=h.useRef(void 0);if(!g.current){const t=m(e.internalActions.internal_getRTKQSubscriptions());g.current=t}const y=hP(s?UT:r),b=mP({refetchOnReconnect:o,refetchOnFocus:a,pollingInterval:l,skipPollingIfUnfocused:u}),v=mP(p.initialPageParam),w=mP(p.refetchCachedPages),x=h.useRef(void 0);let{queryCacheKey:S,requestId:k}=x.current||{},C=!1;S&&k&&(C=g.current.isRequestSubscribed(S,k));const _=!C&&void 0!==x.current;return c(()=>{_&&(x.current=void 0)},[_]),c(()=>{const e=x.current;if(y===UT)return e?.unsubscribe(),void(x.current=void 0);const n=x.current?.subscriptionOptions;if(e&&e.arg===y)b!==n&&e.updateSubscriptionOptions(b);else{e?.unsubscribe();const n=m(f(y,{subscriptionOptions:b,forceRefetch:i,...dP(d[t])?{initialPageParam:v,refetchCachedPages:w}:{}}));x.current=n}},[m,f,i,y,b,_,v,w,t]),[x,m,f,b]}function g(t,n){return(a,{skip:s=!1,selectFromResult:l}={})=>{const{select:c}=e.endpoints[t],u=hP(s?UT:a),d=h.useRef(void 0),p=h.useMemo(()=>i([c(u),(e,t)=>t,e=>u],n,{memoizeOptions:{resultEqualityCheck:Bi}}),[c,u]),f=h.useMemo(()=>l?i([p],l,{devModeChecks:{identityFunctionCheck:"never"}}):p,[p,l]),m=r(e=>f(e,d.current),Bi),g=o(),y=p(g.getState(),d.current);return bP(()=>{d.current=y},[y]),m}}function y(e){h.useEffect(()=>()=>{u(e),e.current=void 0},[e])}}var kP=/* @__PURE__ */Symbol(),CP=/* @__PURE__ */YT(cP(),(({batch:e=ns,hooks:t={useDispatch:Ji,useSelector:ts,useStore:Xi},createSelector:n=b_,unstable__sideEffectsInRender:r=!1,...o}={})=>({name:kP,init(o,{serializeQueryArgs:a},i){const s=o,{buildQueryHooks:l,buildInfiniteQueryHooks:c,buildMutationHook:u,usePrefetch:d}=SP({api:o,moduleOptions:{batch:e,hooks:t,unstable__sideEffectsInRender:r,createSelector:n},serializeQueryArgs:a,context:i});return pP(s,{usePrefetch:d}),pP(i,{batch:e}),{injectEndpoint(e,t){if("query"===t.type){const{useQuery:t,useLazyQuery:n,useLazyQuerySubscription:r,useQueryState:a,useQuerySubscription:i}=l(e);pP(s.endpoints[e],{useQuery:t,useLazyQuery:n,useLazyQuerySubscription:r,useQueryState:a,useQuerySubscription:i}),o[`use${uP(e)}Query`]=t,o[`useLazy${uP(e)}Query`]=n}if(function(e){return"mutation"===e.type}(t)){const t=u(e);pP(s.endpoints[e],{useMutation:t}),o[`use${uP(e)}Mutation`]=t}else if(dP(t)){const{useInfiniteQuery:t,useInfiniteQuerySubscription:n,useInfiniteQueryState:r}=c(e);pP(s.endpoints[e],{useInfiniteQuery:t,useInfiniteQuerySubscription:n,useInfiniteQueryState:r}),o[`use${uP(e)}InfiniteQuery`]=t}}}}}))());const _P="https://api.crownpeak.net/dqm-cms/v1",EP=e=>({"Content-Type":"application/json","x-api-key":e}),AP=CP({reducerPath:"dqmApi",baseQuery:function({baseUrl:e,prepareHeaders:t=e=>e,fetchFn:n=cT,paramsSerializer:r,isJsonContentType:o=dT,jsonContentType:a="application/json",jsonReplacer:i,timeout:s,responseHandler:l,validateStatus:c,...u}={}){return"undefined"==typeof fetch&&n===cT&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),async(p,f,h)=>{const{getState:m,extra:g,endpoint:y,forced:b,type:v}=f;let w,{url:x,headers:S=new Headers(u.headers),params:k,responseHandler:C=l??"json",validateStatus:_=c??uT,timeout:E=s,...A}="string"==typeof p?{url:p}:p,T={...u,signal:E?lT(f.signal,sT(E)):f.signal,...A};S=new Headers(pT(S)),T.headers=await t(S,{getState:m,arg:p,extra:g,endpoint:y,forced:b,type:v,extraOptions:h})||S;const P="object"==typeof(R=T.body)&&(Qk(R)||Array.isArray(R)||"function"==typeof R.toJSON);var R;if(null==T.body||P||"string"==typeof T.body||T.headers.delete("content-type"),!T.headers.has("content-type")&&P&&T.headers.set("content-type",a),P&&o(T.headers)&&(T.body=JSON.stringify(T.body,i)),T.headers.has("accept")||("json"===C?T.headers.set("accept","application/json"):"text"===C&&T.headers.set("accept","text/plain, text/html, */*")),k){const e=~x.indexOf("?")?"&":"?";x+=e+(r?r(k):new URLSearchParams(pT(k)))}x=oT(e,x);const M=new Request(x,T);let I;w={request:new Request(x,T)};try{I=await n(M)}catch(z){return{error:{status:(z instanceof Error||"undefined"!=typeof DOMException&&z instanceof DOMException)&&"TimeoutError"===z.name?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(z)},meta:w}}const O=I.clone();let N;w.response=O;let L="";try{let e;if(await Promise.all([d(I,C).then(e=>N=e,t=>e=t),O.text().then(e=>L=e,()=>{})]),e)throw e}catch(z){return{error:{status:"PARSING_ERROR",originalStatus:I.status,data:L,error:String(z)},meta:w}}return _(I,N)?{data:N,meta:w}:{error:{status:I.status,data:N},meta:w}};async function d(e,t){if("function"==typeof t)return t(e);if("content-type"===t&&(t=o(e.headers)?"json":"text"),"json"===t){const t=await e.text();return t.length?JSON.parse(t):null}return e.text()}}({baseUrl:_P}),tagTypes:["Asset","Highlight"],endpoints:e=>({createAsset:e.mutation({query:({html:e,url:t,websiteId:n,apiKey:r,apiEndpoint:o})=>({url:`${o||_P}/assets`,method:"POST",headers:EP(r),body:{html:e,url:t||window.location.href,websiteId:n},params:{apiKey:r}}),invalidatesTags:["Asset"]}),getAsset:e.query({query:({assetId:e,websiteId:t,apiKey:n,apiEndpoint:r})=>({url:`${r||_P}/assets/${e}`,headers:EP(n),params:{websiteId:t,apiKey:n}}),transformResponse:e=>{const t=(e.checkpoints||[]).reduce((e,t)=>(e[t.category]||(e[t.category]=[]),e[t.category].push(t),e),{}),n=Object.keys(t);Object.entries(t).forEach(([e,t])=>{t.forEach(t=>{t.colors=jk(e,n)})});const r=Object.entries(t),o=e.totalCheckpoints>0?Math.round((e.totalCheckpoints-e.totalErrors)/e.totalCheckpoints*100):0;return{assetId:e.assetId,analysisState:e.analysisState,created:e.created,siteName:e.siteName,totalCheckpoints:e.totalCheckpoints,totalErrors:e.totalErrors,checkpoints:e.checkpoints||[],groupedCategories:r,qualityScore:o}},providesTags:(e,t,{assetId:n})=>[{type:"Asset",id:n}]}),getHighlight:e.query({query:({assetId:e,checkpointId:t,websiteId:n,apiKey:r,apiEndpoint:o})=>({url:`${o||_P}/assets/${e}/pagehighlight/${t}`,headers:EP(r),params:{websiteId:n,apiKey:r}}),transformResponse:(e,t,n)=>({html:e.html,checkpointId:n.checkpointId}),providesTags:(e,t,{assetId:n,checkpointId:r})=>[{type:"Highlight",id:`${n}-${r}`}]}),getAllHighlights:e.query({query:({assetId:e,websiteId:t,apiKey:n,apiEndpoint:r})=>({url:`${r||_P}/assets/${e}/pagehighlight/all`,headers:EP(n),params:{websiteId:t,apiKey:n}}),transformResponse:e=>({html:e.html}),providesTags:(e,t,{assetId:n})=>[{type:"Highlight",id:`${n}-all`}]}),getCheckpointHighlight:e.query({query:({assetId:e,checkpointId:t,websiteId:n,apiKey:r,apiEndpoint:o,highlightSource:a=!1})=>({url:`${o||_P}/assets/${e}/errors/${t}`,headers:EP(r),params:{websiteId:n,apiKey:r,highlightSource:a},responseHandler:"text"}),providesTags:(e,t,{assetId:n,checkpointId:r,highlightSource:o})=>[{type:"Highlight",id:`${n}-${r}-${o?"source":"browser"}`}]})})}),TP={state:"idle",assetId:null,data:null,error:null,isAnalyzing:!1,startedAt:null,completedAt:null},PP=tE({name:"analysis",initialState:TP,reducers:{startAnalysis:e=>{e.state="analyzing",e.isAnalyzing=!0,e.error=null,e.startedAt=Date.now(),e.completedAt=null},setAssetId:(e,t)=>{e.assetId=t.payload},analysisCompleted:(e,t)=>{e.state="completed",e.isAnalyzing=!1,e.data=t.payload,e.completedAt=Date.now()},analysisFailed:(e,t)=>{e.state="error",e.isAnalyzing=!1,e.error=t.payload,e.completedAt=Date.now()},resetAnalysis:e=>{Object.assign(e,TP)},updateAnalysisState:(e,t)=>{e.state=t.payload,"completed"!==t.payload&&"error"!==t.payload||(e.isAnalyzing=!1,e.completedAt=Date.now())}}}),{startAnalysis:RP,setAssetId:MP,analysisCompleted:IP,analysisFailed:OP,resetAnalysis:NP,updateAnalysisState:LP}=PP.actions,zP={selectedCheckpoint:null,selectedCheckpointId:null,viewMode:"browser",showAllHighlights:!1,currentHighlightIndex:0,totalHighlights:0,visibleHighlightIndex:0,cache:{},scrollPositions:{},isModalOpen:!1,isLoading:!1,error:null,highlightedContent:"",scriptsDisabled:!0,hasAutoScrolled:!1,clickedIndicator:0,currentAssetId:null},$P=tE({name:"highlight",initialState:zP,reducers:{selectCheckpoint:(e,t)=>{e.selectedCheckpoint=t.payload,e.selectedCheckpointId=t.payload?.id||null,e.currentHighlightIndex=0,e.visibleHighlightIndex=0,e.hasAutoScrolled=!1,t.payload&&(e.isModalOpen=!0)},setSelectedCheckpointId:(e,t)=>{e.selectedCheckpointId=t.payload,t.payload||(e.selectedCheckpoint=null)},setViewMode:(e,t)=>{e.viewMode=t.payload},toggleShowAllHighlights:e=>{e.showAllHighlights=!e.showAllHighlights,e.selectedCheckpoint=null},setShowAllHighlights:(e,t)=>{e.showAllHighlights=t.payload,t.payload&&(e.selectedCheckpoint=null)},setCurrentHighlightIndex:(e,t)=>{e.currentHighlightIndex=t.payload},nextHighlight:e=>{e.currentHighlightIndex<e.totalHighlights-1&&(e.currentHighlightIndex+=1)},previousHighlight:e=>{e.currentHighlightIndex>0&&(e.currentHighlightIndex-=1)},setTotalHighlights:(e,t)=>{e.totalHighlights=t.payload},setVisibleHighlightIndex:(e,t)=>{e.visibleHighlightIndex=t.payload},cacheHighlight:(e,t)=>{const{checkpointId:n,content:r,type:o}=t.payload;e.cache[n]||(e.cache[n]={timestamp:Date.now()}),e.cache[n][o]=r,e.cache[n].timestamp=Date.now()},clearExpiredCache:e=>{const t=Date.now();Object.keys(e.cache).forEach(n=>{t-e.cache[n].timestamp>3e5&&delete e.cache[n]})},clearCache:e=>{e.cache={}},saveScrollPosition:(e,t)=>{const{checkpointId:n,position:r}=t.payload;e.scrollPositions[n]||(e.scrollPositions[n]={browser:0,source:0}),void 0!==r.browser&&(e.scrollPositions[n].browser=r.browser),void 0!==r.source&&(e.scrollPositions[n].source=r.source)},openModal:e=>{e.isModalOpen=!0},closeModal:e=>{e.isModalOpen=!1,e.selectedCheckpoint=null,e.selectedCheckpointId=null,e.showAllHighlights=!1,e.hasAutoScrolled=!1,e.totalHighlights=0,e.currentHighlightIndex=0,e.highlightedContent=""},setHighlightedContent:(e,t)=>{e.highlightedContent=t.payload},toggleScripts:e=>{e.scriptsDisabled=!e.scriptsDisabled},setScriptsDisabled:(e,t)=>{e.scriptsDisabled=t.payload},setHasAutoScrolled:(e,t)=>{e.hasAutoScrolled=t.payload},incrementClickIndicator:e=>{e.clickedIndicator+=1},setCurrentAssetId:(e,t)=>{e.currentAssetId=t.payload},navigateHighlight:(e,t)=>{if(0===e.totalHighlights)return;let n=(e.visibleHighlightIndex||e.currentHighlightIndex)-1;"next"===t.payload?n=(n+1)%e.totalHighlights:(n-=1,n<0&&(n=e.totalHighlights-1)),e.currentHighlightIndex=n+1,e.visibleHighlightIndex=0,e.clickedIndicator+=1},setLoading:(e,t)=>{e.isLoading=t.payload},setError:(e,t)=>{e.error=t.payload,e.isLoading=!1},resetHighlight:e=>{Object.assign(e,zP)}}}),{selectCheckpoint:DP,setSelectedCheckpointId:jP,setViewMode:FP,toggleShowAllHighlights:BP,setShowAllHighlights:qP,setCurrentHighlightIndex:WP,nextHighlight:HP,previousHighlight:UP,setTotalHighlights:VP,setVisibleHighlightIndex:KP,cacheHighlight:QP,clearExpiredCache:GP,clearCache:XP,saveScrollPosition:YP,openModal:JP,closeModal:ZP,setLoading:eR,setError:tR,resetHighlight:nR,setHighlightedContent:rR,toggleScripts:oR,setScriptsDisabled:aR,setHasAutoScrolled:iR,incrementClickIndicator:sR,setCurrentAssetId:lR,navigateHighlight:cR}=$P.actions,uR={apiKey:null,websiteId:null,isAuthenticated:!1,sessionType:null,sessionToken:null,accessToken:null,refreshToken:null,rememberMe:!1,isLoading:!1,error:null,storageWarningAcknowledged:!1},dR="dqm_apiKey",pR="dqm_websiteID",fR="dqm_sessionToken",hR="dqm_sessionType",mR=G_("auth/initialize",async(e,{dispatch:t})=>{if(!0===e?.disabled)return{isAuthenticated:!1,error:"DQM is disabled"};if(e?.apiKey&&e?.websiteId)return{apiKey:e.apiKey,websiteId:e.websiteId,sessionType:"direct",isAuthenticated:!0};if("undefined"!=typeof window&&!1!==e?.useLocalStorage){if("backend"===oE("dqm_sessionType")){const e=oE("dqm_sessionToken");if(e)return ig.debug("Restoring backend session from localStorage"),{accessToken:e,sessionType:"backend",isAuthenticated:!0}}const e=oE("dqm_apiKey"),t=oE("dqm_websiteID");if(e&&t)return ig.debug("Restoring direct credentials from localStorage"),{apiKey:e,websiteId:t,sessionType:"direct",isAuthenticated:!0}}return e?.authBackendUrl?{isAuthenticated:!1}:{isAuthenticated:!1,error:"DQM not configured"}}),gR=G_("auth/loginWithCredentials",async(e,{rejectWithValue:t})=>{try{if("direct"===e.sessionType&&!/^[\x00-\x7F]*$/.test(e.apiKey))throw new Error("API key contains non-ASCII characters");return!1!==e.rememberMe&&"undefined"!=typeof window&&("backend"===e.sessionType&&e.sessionToken?(aE(fR,e.sessionToken),aE(hR,"backend")):(aE(dR,e.apiKey),aE(pR,e.websiteId),aE(hR,"direct"))),e}catch(n){return t(n instanceof Error?n.message:"Login failed")}}),yR=G_("auth/logout",async(e=!0)=>(e&&"undefined"!=typeof window&&(iE(dR),iE(pR),iE(fR),iE(hR),ig.debug("Cleared localStorage on logout")),!0)),bR=tE({name:"auth",initialState:uR,reducers:{setApiKey:(e,t)=>{e.apiKey=t.payload,e.isAuthenticated=!(!t.payload||!e.websiteId),t.payload&&(e.sessionType="direct")},setWebsiteId:(e,t)=>{e.websiteId=t.payload,e.isAuthenticated=!(!e.apiKey||!t.payload)},setCredentials:(e,t)=>{e.apiKey=t.payload.apiKey,e.websiteId=t.payload.websiteId,e.isAuthenticated=!0,e.sessionType="direct",void 0!==t.payload.rememberMe&&(e.rememberMe=t.payload.rememberMe)},setSessionToken:(e,t)=>{e.accessToken=t.payload.accessToken,e.sessionType="backend",e.isAuthenticated=!0},setRememberMe:(e,t)=>{e.rememberMe=t.payload},acknowledgeStorageWarning:e=>{e.storageWarningAcknowledged=!0},setAuthLoading:(e,t)=>{e.isLoading=t.payload},setAuthError:(e,t)=>{e.error=t.payload,e.isLoading=!1},logout:e=>{e.apiKey=null,e.websiteId=null,e.accessToken=null,e.refreshToken=null,e.isAuthenticated=!1,e.sessionType=null,e.error=null},resetAuth:()=>uR,hydrateFromStorage:(e,t)=>{t.payload.apiKey&&(e.apiKey=t.payload.apiKey),t.payload.websiteId&&(e.websiteId=t.payload.websiteId),void 0!==t.payload.rememberMe&&(e.rememberMe=t.payload.rememberMe),void 0!==t.payload.storageWarningAcknowledged&&(e.storageWarningAcknowledged=t.payload.storageWarningAcknowledged),e.isAuthenticated=!(!e.apiKey||!e.websiteId),e.isAuthenticated&&(e.sessionType="direct")}},extraReducers:e=>{e.addCase(mR.pending,e=>{e.isLoading=!0,e.error=null}).addCase(mR.fulfilled,(e,t)=>{e.isLoading=!1,t.payload.apiKey&&(e.apiKey=t.payload.apiKey),t.payload.websiteId&&(e.websiteId=t.payload.websiteId),t.payload.accessToken&&(e.accessToken=t.payload.accessToken),t.payload.sessionType&&(e.sessionType=t.payload.sessionType),void 0!==t.payload.isAuthenticated&&(e.isAuthenticated=t.payload.isAuthenticated),t.payload.error&&(e.error=t.payload.error)}).addCase(mR.rejected,(e,t)=>{e.isLoading=!1,e.error=t.error.message||"Authentication initialization failed"}),e.addCase(gR.pending,e=>{e.isLoading=!0,e.error=null}).addCase(gR.fulfilled,(e,t)=>{e.isLoading=!1,e.apiKey=t.payload.apiKey,e.websiteId=t.payload.websiteId,e.sessionType=t.payload.sessionType,e.isAuthenticated=!0,t.payload.sessionToken&&(e.accessToken=t.payload.sessionToken),void 0!==t.payload.rememberMe&&(e.rememberMe=t.payload.rememberMe)}).addCase(gR.rejected,(e,t)=>{e.isLoading=!1,e.error=t.payload||"Login failed"}),e.addCase(yR.fulfilled,e=>{e.apiKey=null,e.websiteId=null,e.accessToken=null,e.refreshToken=null,e.isAuthenticated=!1,e.sessionType=null,e.error=null})}}),{setApiKey:vR,setWebsiteId:wR,setCredentials:xR,setSessionToken:SR,setRememberMe:kR,acknowledgeStorageWarning:CR,setAuthLoading:_R,setAuthError:ER,logout:AR,resetAuth:TR,hydrateFromStorage:PR}=bR.actions,RR={settings:{provider:"none",openaiApiKey:null,openaiModel:"gpt-4.1-mini",enabled:!1,translationProvider:"none"},summaries:{},isSettingsOpen:!1,isGenerating:!1,generatingFor:null,error:null},MR=tE({name:"ai",initialState:RR,reducers:{updateSettings:(e,t)=>{e.settings={...e.settings,...t.payload},t.payload.provider&&"none"!==t.payload.provider&&(e.settings.enabled=!0)},setProvider:(e,t)=>{e.settings.provider=t.payload,e.settings.enabled="none"!==t.payload},setOpenAIApiKey:(e,t)=>{e.settings.openaiApiKey=t.payload},setOpenAIModel:(e,t)=>{e.settings.openaiModel=t.payload},setTranslationProvider:(e,t)=>{e.settings.translationProvider=t.payload},openSettings:e=>{e.isSettingsOpen=!0},closeSettings:e=>{e.isSettingsOpen=!1},toggleSettings:e=>{e.isSettingsOpen=!e.isSettingsOpen},startGeneration:(e,t)=>{e.isGenerating=!0,e.generatingFor=t.payload,e.error=null},generationCompleted:(e,t)=>{e.isGenerating=!1,e.generatingFor=null,e.summaries[t.payload.checkpointId]={checkpointId:t.payload.checkpointId,summary:t.payload.summary,generatedAt:Date.now(),provider:t.payload.provider}},generationFailed:(e,t)=>{e.isGenerating=!1,e.generatingFor=null,e.error=t.payload},clearError:e=>{e.error=null},clearSummaries:e=>{e.summaries={}},clearSummary:(e,t)=>{delete e.summaries[t.payload]},resetAI:()=>RR,hydrateSettings:(e,t)=>{t.payload.provider&&(e.settings.provider=t.payload.provider,e.settings.enabled="none"!==t.payload.provider),void 0!==t.payload.openaiApiKey&&(e.settings.openaiApiKey=t.payload.openaiApiKey),t.payload.openaiModel&&(e.settings.openaiModel=t.payload.openaiModel),t.payload.translationProvider&&(e.settings.translationProvider=t.payload.translationProvider)}}}),{updateSettings:IR,setProvider:OR,setOpenAIApiKey:NR,setOpenAIModel:LR,setTranslationProvider:zR,openSettings:$R,closeSettings:DR,toggleSettings:jR,startGeneration:FR,generationCompleted:BR,generationFailed:qR,clearError:WR,clearSummaries:HR,clearSummary:UR,resetAI:VR,hydrateSettings:KR}=MR.actions,QR=function(e){const t=function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:o=!0}=e??{};let a=new __;return t&&("boolean"==typeof t?a.push(x_):a.push(S_(t.extraArgument))),a},{reducer:n,middleware:r,devTools:o=!0,preloadedState:a,enhancers:i}=e||{};let s,l;if("function"==typeof n)s=n;else{if(!Qk(n))throw new Error(rE(1));s=Xk(n)}l="function"==typeof r?r(t):t();let c=Yk;o&&(c=k_({trace:!1,..."object"==typeof o&&o}));const u=function(...e){return t=>(n,r)=>{const o=t(n,r);let a=()=>{throw new Error(Hk(15))};const i={getState:o.getState,dispatch:(e,...t)=>a(e,...t)},s=e.map(e=>e(i));return a=Yk(...s)(o.dispatch),{...o,dispatch:a}}}(...l),d=M_(u);return Gk(s,a,c(..."function"==typeof i?i(d):d()))}({reducer:{locale:dA,analysis:PP.reducer,highlight:$P.reducer,auth:bR.reducer,ai:MR.reducer,[AP.reducerPath]:AP.reducer},middleware:e=>e().concat(AP.middleware)}),GR=({open:e,onClose:t,onOpen:n,config:r,onAuthSuccess:o,onAuthError:a,debugHtml:i})=>{const{t:s,i18n:l}=Ai(["sidebar","auth","common"]),c=Ji(),[u,d]=h.useState("idle"),[p,f]=h.useState(null),[g,y]=h.useState(null),[b,v]=h.useState(null),[w,x]=h.useState(null),S=m.useRef(null),[k,C]=h.useState(null),_=m.useRef(null),[E,A]=h.useState([]),[T,P]=h.useState(null),[R,M]=h.useState(!1),[I,O]=h.useState(null),[N,L]=h.useState(null),[z,$]=h.useState("direct"),[D,j]=h.useState(""),[F,B]=h.useState(null),[q,W]=h.useState(null),[H,U]=h.useState(!1),[V,K]=h.useState("browser"),[Q,G]=h.useState(!1),[X,Y]=h.useState(!1),[J,Z]=h.useState(0),[ee,te]=m.useState(()=>"undefined"==typeof window||"false"!==oE("dqm_quality_breakdown_expanded")),[ne,re]=h.useState(/* @__PURE__ */new Set),[oe,ae]=h.useState({}),[ie,se]=h.useState(0),[le,ce]=h.useState(0),[ue,de]=h.useState(0),[pe,fe]=h.useState(!0),[he,me]=h.useState(!1),ge=m.useRef(null),ye=(()=>{const e=h.useContext(vA);if(!e)throw new Error("useAI must be used within an AIProvider");return e})(),{translationEnabled:be,setTranslationEnabled:ve,translationMode:we,setTranslationMode:xe,summaryEnabled:Se,setSummaryEnabled:ke,openAiApiKey:Ce,setOpenAiApiKey:_e,openAiModel:Ee,setOpenAiModel:Ae,openAiBaseUrl:Te,setOpenAiBaseUrl:Pe,targetLang:Re,translationNeeded:Me,aiEnabled:Ie,effectiveModelId:Oe,computeBudgetMs:Ne}=ye,Le=(()=>{const e=h.useMemo(()=>PA(),[]),t=h.useMemo(()=>/* @__PURE__ */new Map,[]),[n,r]=h.useState(null),o=h.useCallback(async()=>{if("undefined"!=typeof navigator&&navigator.storage?.persisted)try{const e=await navigator.storage.persisted();r("boolean"==typeof e?e:null)}catch{r(null)}else r(null)},[]),a=h.useCallback(async()=>{await e.clearAll(),t.clear()},[t,e]),i=h.useCallback(()=>{t.clear()},[t]);return{cache:e,assetCache:t,storagePersisted:n,refreshStorageState:o,clearAll:a,clearAssetCache:i}})(),{cache:ze,clearAll:$e,clearAssetCache:De}=Le,je=RA({enabled:Ie,openAiApiKey:Ce,openAiModel:Ee,openAiBaseUrl:Te}),{state:Fe,isReady:Be}=je,qe=(e=>{const{engine:t,originalData:n,targetLang:r,modelId:o,enabled:a,timeoutMs:i=45e3,translationInProgress:s=!1,cache:l}=e,{t:c}=Ai("sidebar"),[u,d]=h.useState("idle"),[p,f]=h.useState(null),[m,g]=h.useState(null),[y,b]=h.useState(0),[v,w]=h.useState(null),x=h.useRef(/* @__PURE__ */new Map),S=h.useRef(null),k=h.useRef(r),C=h.useRef(!1),_=h.useRef(null),E=h.useRef(t),A=h.useRef(n),T=h.useRef(r),P=h.useRef(o),R=h.useRef(a),M=h.useRef(i),I=h.useRef(s),O=h.useRef(l),N=h.useRef(c);h.useEffect(()=>{E.current=t,A.current=n,T.current=r,P.current=o,R.current=a,M.current=i,I.current=s,O.current=l,N.current=c});const L=h.useCallback(()=>{S.current?.abort(),S.current=null,C.current=!1,_.current=null,x.current.clear(),g(null),f(null),w(null),d("idle"),b(e=>e+1)},[]),z=n?.assetId??null;return h.useEffect(()=>{k.current!==r&&(k.current=r,_.current=null,f(null),g(null),w(null),d("idle"))},[r]),h.useEffect(()=>{y>0&&(_.current=null)},[y]),h.useEffect(()=>{const e=`${z}:${r}:${o}`;if(!R.current)return void d("idle");if(!z)return;if(I.current)return;if(C.current)return;if(_.current===e)return;if(!E.current.isReady||!E.current.client)return;const t=A.current;if(!t)return;const n=(()=>{const e=(t.checkpoints||[]).filter(e=>e.failed).map(e=>({id:e.id??"",name:e.name??"",description:e.description??"",category:e.category??"",topics:[...e.topics??[]].sort()})).sort((e,t)=>{const n=`${e.id}|${e.category}|${e.name}|${e.description}`,r=`${t.id}|${t.category}|${t.name}|${t.description}`;return n.localeCompare(r)});return _A(JSON.stringify({modelId:P.current,targetLang:T.current,site:t.siteName??"",totalErrors:t.totalErrors??0,failed:e}))})();if(n&&x.current.has(n)){const t=x.current.get(n);return f(t.bullets),w(t.stats),d("ready"),void(_.current=e)}_.current=e,C.current=!0,S.current?.abort();const a=new AbortController;S.current=a,d("generating"),g(null),f(null),w(null);const i=window.setTimeout(()=>{a.abort(),C.current&&(d("error"),g(N.current("summary_timeout")),C.current=!1)},M.current),s=Date.now();ig.debug("Summary: start (once)");const l=E.current.client;return(0,E.current.runWithLock)(async()=>{if(l.reset)try{await l.reset(!0)}catch{}return BA({client:l,data:t,targetLanguage:T.current,modelId:P.current,cache:O.current,signal:a.signal})}).then(e=>{a.signal.aborted||(ig.debug("Summary: ready in",Date.now()-s,"ms"),f(e.bullets),w(e.stats??null),n&&x.current.set(n,{bullets:e.bullets,stats:e.stats??null}),d("ready"))}).catch(e=>{if(a.signal.aborted)return;ig.error("Summary: failed",e),d("error"),g(e instanceof Error?e.message:String(e));const t=e?.stats;t&&w(t)}).finally(()=>{window.clearTimeout(i),C.current=!1}),()=>{a.abort(),window.clearTimeout(i)}},[z,r,o,y]),{state:u,bullets:p,error:m,stats:v,restart:L}})({engine:RA({enabled:Se,openAiApiKey:Ce,openAiModel:Ee,openAiBaseUrl:Te}),originalData:g,targetLang:Re,modelId:Oe,enabled:Se,timeoutMs:r?.summary?.timeoutMs??45e3,cache:ze}),{state:We,bullets:He,error:Ue,stats:Ve,restart:Ke}=qe,Qe=Se&&("generating"===We||"idle"===We),Ge=(e=>{const{engine:t,cacheManager:n,originalData:r,targetLang:o,modelId:a,enabled:i,mode:s,computeBudgetMs:l,persistentCache:c,summaryGenerating:u=!1}=e,{t:d}=Ai("sidebar"),[p,f]=h.useState(null),[m,g]=h.useState(null),[y,b]=h.useState(null),[v,w]=h.useState(/* @__PURE__ */new Set),[x,S]=h.useState(/* @__PURE__ */new Set),[k,C]=h.useState(0),_=h.useRef(null),E=h.useRef(null),A=h.useRef(!1),T=h.useRef(void 0),P=h.useRef(t),R=h.useRef(n),M=h.useRef(r),I=h.useRef(o),O=h.useRef(a),N=h.useRef(i),L=h.useRef(s),z=h.useRef(l),$=h.useRef(c),D=h.useRef(u),j=h.useRef(d);h.useEffect(()=>{P.current=t,R.current=n,M.current=r,I.current=o,O.current=a,N.current=i,L.current=s,z.current=l,$.current=c,D.current=u,j.current=d});const F=r?.assetId??null,B="en"!==o,q=v.size>0,W=h.useCallback(()=>{_.current?.abort(),_.current=null},[]),H=h.useCallback(()=>{f(M.current),w(/* @__PURE__ */new Set),S(/* @__PURE__ */new Set)},[]),U=h.useCallback(()=>{const e=M.current;return e?`${e.assetId}:${I.current}:${O.current}`:""},[]),V=h.useCallback(()=>{if(!M.current)return;if("en"===I.current)return b(j.current("translation_not_needed")),void H();const e=U();R.current.assetCache.delete(e),E.current=null,A.current=!1,H(),W(),b(null),g(null),f(null),w(/* @__PURE__ */new Set),S(/* @__PURE__ */new Set),C(e=>e+1)},[U,H,W]),K=h.useCallback(async e=>{const t=M.current;if(!t)return;if(!N.current)return;const n=t.checkpoints.find(t=>t.id===e);if(!n)return;const r=U();R.current.assetCache.delete(r),S(t=>{const n=new Set(t);return n.delete(e),n}),w(t=>{const n=new Set(t);return n.delete(e),n});try{const e=AA(n),t=EA(O.current,I.current,e);await $.current.deleteCheckpointMany([t])}catch{}E.current=null,C(e=>e+1)},[U]);return h.useEffect(()=>{const e=`${F}:${o}:${a}:${s}`;if(!i)return f(null),g(null),b(null),w(/* @__PURE__ */new Set),void S(/* @__PURE__ */new Set);if(!F)return;if(D.current)return;if(!B)return g(null),b(j.current("translation_not_needed")),void f(M.current);if(A.current)return;if(E.current===e)return;if(!P.current.isReady||!P.current.client)return;const t=M.current;if(!t)return;const n=U(),r=R.current.assetCache.get(n);if(r)return b(null),g({translatedCheckpoints:r.checkpoints.length,totalCheckpoints:r.checkpoints.length,isPartial:!1}),f(r),void(E.current=e);E.current=e,A.current=!0,W();const l=new AbortController;_.current=l,w(/* @__PURE__ */new Set),S(/* @__PURE__ */new Set),b(null),g(null),ig.debug("Translation: start (once)");const c=P.current.client;return(0,P.current.runWithLock)(async()=>qA({client:c,data:t,targetLanguage:I.current,modelId:O.current,maxConcurrentBatches:3,maxItemsPerBatch:12,forceSerial:!1,cache:$.current,computeBudgetMs:z.current,signal:l.signal,onProgress:e=>g(e),onBatchStatus:()=>{},onPartialResult:()=>{}})).then(({data:e,progress:t})=>{l.signal.aborted||(ig.debug("Translation: done"),R.current.assetCache.set(n,e),f(e),t.isPartial&&b("full"===L.current?j.current("translation_incomplete"):j.current("translation_partial")),w(/* @__PURE__ */new Set),S(/* @__PURE__ */new Set))}).catch(e=>{l.signal.aborted||(ig.error("Translation: failed",e),b(e instanceof Error?e.message:String(e)),f(t),w(/* @__PURE__ */new Set),S(/* @__PURE__ */new Set))}).finally(()=>{A.current=!1}),()=>{l.abort()}},[F,o,a,s,i,B,k,U,W]),{translatedData:p,progress:m,error:y,translatingIds:v,translatedIds:x,isTranslating:q,restart:V,stop:W,retrySingleCheckpoint:K,resetToOriginal:H,onDataChange:T.current}})({engine:je,cacheManager:Le,originalData:g,targetLang:Re,modelId:Oe,enabled:be&&Me,mode:we,computeBudgetMs:Ne,persistentCache:ze,summaryGenerating:Qe}),{translatedData:Xe,progress:Ye,restart:Je,stop:Ze}=Ge,et=m.useMemo(()=>be?"initializing"===Fe?"initializing":"error"===Fe?"error":Ye&&Ye.translatedCheckpoints<Ye.totalCheckpoints?"translating":Be?"ready":"initializing":"disabled",[be,Fe,Ye,Be]),[tt,at]=h.useState(Se);h.useEffect(()=>{Qe&&Ze()},[Qe,Ze]);const it="error"===Fe?"AI engine failed to initialize":null,st=m.useMemo(()=>Ee.trim()||"gpt-4.1-mini",[Ee]);h.useEffect(()=>{be&&Me&&Xe?f(Xe):!g||be&&Me||f(g)},[Xe,be,Me,g]);const lt=h.useCallback(e=>{S.current=e,x(e)},[]),ct=m.useRef(!1),ut=m.useRef("browser"),dt=(e=>{const{selector:t,validateIframe:n=!0,pollMs:r=1e3,manualOffset:o}=e||{},a=null!=t&&""!==t,i=m.useCallback(e=>!!e&&(!n||"iframe"!==e.tagName.toLowerCase()||!!e.contentWindow),[n]),s=bA(a?t:"__disabled__",a?{check:i,pollMs:r}:{pollMs:0});if(!a)return{present:!1,height:0,width:0,position:null,contentOffset:{top:0,bottom:0,left:0,right:0},isManualOffset:!1};if(!s.present)return{present:!1,height:0,width:0,position:null,contentOffset:{top:0,bottom:0,left:0,right:0},isManualOffset:!1};if(o){const e={top:0,bottom:0,left:0,right:0};return e[o.position]=o.pixels,{present:!0,height:"top"===o.position||"bottom"===o.position?o.pixels:0,width:"left"===o.position||"right"===o.position?o.pixels:0,position:o.position,contentOffset:e,isManualOffset:!0}}return{present:s.present,height:s.rect?.height??0,width:s.rect?.width??0,position:s.position,contentOffset:s.contentOffset,isManualOffset:!1}})(r?.overlayConfig),pt=!0===r?.disableLogout,ft=h.useRef(r);ft.current=r;const ht=h.useRef(!1);h.useEffect(()=>{"true"===new URLSearchParams(window?.location?.search).get("dqm")&&n()},[]),h.useEffect(()=>{if(ht.current)return;ht.current=!0;const e=ft.current;if(!0===e?.disabled)return M(!1),P(s("sidebar:dqm_disabled")),d("idle"),void c(ER(s("sidebar:dqm_disabled")));if(e?.apiKey&&e?.websiteId)return O({apiKey:e.apiKey,websiteId:e.websiteId}),$("direct"),L(null),M(!0),void c(xR({apiKey:e.apiKey,websiteId:e.websiteId}));if("undefined"!=typeof window&&!1!==e?.useLocalStorage){if("backend"===oE("dqm_sessionType")){const e=oE("dqm_sessionToken");if(e)return ig.debug("Restoring backend session from localStorage"),L(e),$("backend"),O({apiKey:"BACKEND_SESSION",websiteId:"BACKEND_SESSION"}),M(!0),void c(SR({accessToken:e}))}const e=oE("dqm_apiKey"),t=oE("dqm_websiteID");if(e&&t)return ig.debug("Restoring direct credentials from localStorage"),O({apiKey:e,websiteId:t}),$("direct"),L(null),M(!0),void c(xR({apiKey:e,websiteId:t}))}if(e?.authBackendUrl)return M(!1),void d("idle");M(!1),P(s("sidebar:dqm_not_configured")),d("idle"),c(ER(s("sidebar:dqm_not_configured")))},[]);const mt=h.useCallback(e=>{O({apiKey:e.apiKey,websiteId:e.websiteId}),L(e.sessionToken||null),$(e.sessionType),M(!0),P(null),c(xR({apiKey:e.apiKey,websiteId:e.websiteId})),e.sessionToken&&c(SR({accessToken:e.sessionToken})),o&&o(e)},[o,c]),gt=h.useCallback(e=>{ig.error("Authentication error:",e),P(e.message),M(!1),c(ER(e.message)),a&&a(e)},[a,c]),yt=h.useCallback(()=>{O(null),L(null),$("direct"),M(!1),c(AR()),"undefined"!=typeof window&&!1!==r?.useLocalStorage&&(iE("dqm_apiKey"),iE("dqm_websiteID"),iE("dqm_sessionToken"),iE("dqm_sessionType"),ig.debug("Cleared localStorage on logout")),d("idle"),f(null),v(null),lt(null),_.current&&(clearInterval(_.current),_.current=null),C(null),ig.debug("User logged out")},[r?.useLocalStorage,lt,c]),bt=h.useCallback(e=>{if(0===ie)return;let t=(ue||le)-1;"next"===e?t=(t+1)%ie:(t-=1,t<0&&(t=ie-1)),ce(t+1),c(WP(t+1)),de(0),c(KP(0)),Z(e=>e+1),c(sR())},[le,ue,ie,c]),vt=h.useCallback(()=>{G(!1),c(ZP())},[c]);h.useEffect(()=>{Q||(se(0),ce(0),ct.current=!1)},[Q]),h.useEffect(()=>{ie>0&&0===le&&(ig.debug("Auto-setting currentHighlight to 1 (total highlights:",ie,")"),ce(1))},[ie,le]),h.useEffect(()=>{try{window.parent?.postMessage({type:"DQM_DRAWER_STATE",payload:{open:e}},"*")}catch{}},[e]);const wt=h.useCallback(e=>{ig.error("API authentication error:",e),M(!1),P("Authentication required. Please refresh the page.")},[]),xt=h.useCallback(()=>"backend"===z&&r?.authBackendUrl?r.authBackendUrl:"https://api.crownpeak.net/dqm-cms/v1",[z,r?.authBackendUrl]),St=h.useCallback(()=>{const e={"Content-Type":"application/json"};if("backend"===z){const t=N||oE("dqm_sessionToken");t&&(e.Authorization=`Bearer ${t}`)}else{const t=I?.apiKey||oE("dqm_apiKey");t&&(e["x-api-key"]=t)}return e},[z,N,I]),kt=e=>{if(!/^[\x00-\x7F]*$/.test(e))throw new Error("API key contains non-ASCII characters and cannot be used in HTTP headers")},Ct=h.useCallback(async(e,t=0)=>{ig.debug("Polling analysis status, attempt",t+1,"for assetId:",e);try{const t=xt(),r=St();let o;if("backend"===z)o=`${t}/dqm/assets/${e}/status`,ig.debug("Polling backend:",o);else{const r=I?.apiKey||oE("dqm_apiKey");if(!r)throw new Error("DQM API key not available for polling");try{kt(r)}catch(n){throw new Error(`Invalid API key: ${n instanceof Error?n.message:"encoding error"}`)}const a=encodeURIComponent(r);o=`${t}/assets/${e}/status?apiKey=${a}`,ig.debug("Polling direct:",o)}const a=(await pb.get(o,{headers:r,timeout:1e4})).data,i=a.checkpoints&&Array.isArray(a.checkpoints);if(i&&void 0!==a.totalCheckpoints&&a.checkpoints.length===a.totalCheckpoints){_.current&&(clearInterval(_.current),_.current=null),C(null);const e={assetId:a.assetId||a.id,created:a.created,siteName:a.siteName,totalCheckpoints:a.totalCheckpoints,totalErrors:a.totalErrors,checkpoints:a.checkpoints||[]};y(e),f(e),De(),A(Object.entries(Tt(a.checkpoints||[]))),d("completed"),lt(null),ig.debug("Analysis completed:",a.checkpoints.length,"/",a.totalCheckpoints,"checkpoints")}else if("failed"===a.status||"error"===a.status)_.current&&(clearInterval(_.current),_.current=null),C(null),v(a.error||a.message||"Analysis failed with unknown error"),A([]),d("error"),lt(null),ig.debug("Analysis failed:",a.error||a.message);else{const e=i?a.checkpoints.length:0,t=a.totalCheckpoints||"?";ig.debug("Analysis in progress:",e,"/",t,"checkpoints"),b&&v(null)}}catch(r){if(ig.error("Polling failed:",r),pb.isAxiosError(r)&&401===r.response?.status)return void wt(r);if(t<30){const n=Math.min(2e3*Math.pow(1.5,t),1e4);setTimeout(()=>Ct(e,t+1),n)}else _.current&&(clearInterval(_.current),_.current=null),C(null),v("Analysis polling failed after maximum attempts"),A([]),d("error"),lt(null)}},[xt,St,z,I,b,wt,lt]),_t=h.useCallback(e=>{_.current&&(clearInterval(_.current),_.current=null),C(null),ig.debug("Starting polling for assetId:",e),Ct(e);const t=setInterval(()=>{S.current?Ct(e):(clearInterval(t),_.current===t&&(_.current=null),C(null))},3e3);_.current=t,C(t)},[Ct]),Et=h.useCallback(()=>{_.current&&(clearInterval(_.current),_.current=null),C(null),lt(null)},[lt]),At=h.useCallback(async()=>{d("analyzing"),v(null),P(null),f(null),y(null);try{if("backend"===z){const e=N||oE("dqm_sessionToken");if(!e)return d("idle"),void ig.warn("Cannot start analysis: No session token available");ig.debug("Starting analysis with backend session token:",e.substring(0,16)+"...")}else{const t=I?.apiKey||oE("dqm_apiKey"),n=I?.websiteId||oE("dqm_websiteID");if(!t||!n)return d("idle"),void ig.warn("Cannot start analysis: No credentials available");try{kt(t)}catch(e){throw new Error(`Invalid API key: ${e instanceof Error?e.message:"encoding error"}`)}ig.debug("Starting analysis with direct API key")}let t;i?(ig.warn("DEBUG MODE: Using custom HTML from debugHtml prop"),t=i):t=document.documentElement.outerHTML;const n=(e=>{const t=(new DOMParser).parseFromString(e,"text/html");[".MuiDrawer-root","#dqm-widget-host",'[data-block-handle="dqm_quality_analysis"]',"#dqm-quality-analysis-script","#PBarNextFrameWrapper"].forEach(e=>{try{t.querySelectorAll(e).forEach(e=>e.remove())}catch(n){ig.warn("Could not process selector:",e,n.message)}});const n=t.documentElement.outerHTML,r=e.length,o=n.length,a=((r-o)/r*100).toFixed(1);return ig.debug(`HTML optimization: ${r} → ${o} bytes (${a}% reduction)`),o>1048576&&ig.warn(`Optimized HTML still large: ${(o/1024/1024).toFixed(1)}MB`),n})(t),r=xt(),o=St();let a,s;if("backend"===z)a=`${r}/dqm/assets`,s={html:n,url:window.location.href},ig.debug("Using backend mode:",a);else{const e=I?.apiKey||oE("dqm_apiKey"),t=I?.websiteId||oE("dqm_websiteID");a=`${r}/assets?apiKey=${encodeURIComponent(e)}`,s={websiteId:t,content:n,contentType:"text/html; charset=UTF-8",title:document.title,timestamp:/* @__PURE__ */(new Date).toISOString()},o["Content-Type"]="application/x-www-form-urlencoded",ig.debug("Using direct mode:",a)}const l=await pb.post(a,s,{headers:o,timeout:3e4}),c=l.data?.assetId||l.data?.id;if(!c)throw new Error("No Asset ID returned from API");lt(c),_t(c)}catch(t){if(ig.error("Analysis failed:",t),pb.isAxiosError(t)&&401===t.response?.status)return wt(t),void d("error");let e="Unknown error occurred";pb.isAxiosError(t)?e=t.response?.data?.message||t.message||"API request failed":t instanceof Error&&(e=t.message),v(e),A([]),d("error"),Et()}},[z,N,I,i,xt,St,wt,_t,Et]);h.useEffect(()=>{R&&I&&"idle"===u&&(ig.debug("Auto-starting analysis with available credentials"),At())},[R,I,At,u]),h.useCallback(e=>{f(e),re(/* @__PURE__ */new Set),A(e?Object.entries(Tt(e.checkpoints||[])):[])},[]),h.useEffect(()=>()=>{Et()},[]),h.useEffect(()=>{!0===e&&At()},[e]),h.useEffect(()=>{if(!p||!F)return;const e=p.checkpoints.find(e=>e.id===F)||null;W(e)},[p,F]);const Tt=h.useCallback(e=>{const t=e.reduce((e,t)=>(e[t.category]||(e[t.category]=[]),e[t.category].push(t),e),{});return Object.entries(t).forEach(([e,n])=>{n.forEach(n=>{n.colors=jk(e,Object.keys(t))})}),t},[]);h.useEffect(()=>{A(p?Object.entries(Tt(p.checkpoints||[])):[])},[p,Tt]);const Pt=async(e,t,n="browser")=>{j(""),U(!0),B(t),K(n),G(!0),c(rR("")),c(eR(!0)),c(FP(n)),c(JP()),ae(e=>({...e,[t]:{browser:"",source:""}})),ut.current=n;const r=p?.checkpoints.find(e=>e.id===t)||null;W(r),c(DP(r));try{const a=xt(),i=St();let s,l;if("backend"===z)s=`${a}/dqm/assets/${e}/pagehighlight/${t}?highlightSource=false`,l=`${a}/dqm/assets/${e}/pagehighlight/${t}?highlightSource=true`;else{const n=I?.apiKey||oE("dqm_apiKey");if(!n)throw new Error("DQM API key not found");try{kt(n)}catch(o){throw new Error(`Invalid API key: ${o instanceof Error?o.message:"encoding error"}`)}const r=encodeURIComponent(n);s=`${a}/assets/${e}/errors/${t}?apiKey=${r}&highlightSource=false`,l=`${a}/assets/${e}/errors/${t}?apiKey=${r}&highlightSource=true`}const c=r?.canHighlight.page&&await pb.get(s,{headers:i,timeout:15e3,responseType:"text"})||void 0,u=r?.canHighlight.source&&await pb.get(l,{headers:i,timeout:15e3,responseType:"text"})||void 0,d=c?.data||"<p>No highlighted content available.</p>",f=u?.data||"<p>No source content available for this checkpoint.</p>";ae(e=>({...e,[t]:{browser:d,source:f}})),ig.debug("Both views loaded and cached"),"browser"===n&&r?.canHighlight?.page&&p?Mt(p.assetId,r.id):"source"===n&&r?.canHighlight?.source&&p&&Rt(p.assetId,r.id)}catch(a){ig.error("Failed to fetch highlighted content:",a),j(`<p style="color: #dc3545;">${s("sidebar:failed_load_highlights")}</p>`)}finally{U(!1)}},Rt=async(e,t)=>{const n=oe[t];if(n&&n.source)return ig.debug("Using cached source view for checkpoint:",t),void j(n.source);ig.warn("Source view not in cache for checkpoint:",t,", fetching..."),U(!0);try{const n=xt(),o=St();let a;if("backend"===z)a=`${n}/dqm/assets/${e}/pagehighlight/${t}?highlightSource=true`;else{const o=I?.apiKey||oE("dqm_apiKey");if(!o)throw new Error("DQM API key not found");try{kt(o)}catch(r){throw new Error(`Invalid API key: ${r instanceof Error?r.message:"encoding error"}`)}const i=encodeURIComponent(o);a=`${n}/assets/${e}/errors/${t}?apiKey=${i}&highlightSource=true`}const i=await pb.get(a,{headers:o,timeout:15e3,responseType:"text"});if(i.data){const e=i.data;j(e),ae(n=>({...n,[t]:{...n[t],source:e}}))}else ig.warn("No highlighted content in response"),j(`<p>${s("sidebar:no_highlighted_content")}</p>`)}catch(o){ig.error("Failed to fetch source view:",o),j(`<p style="color: #dc3545;">${s("sidebar:failed_load_source")}</p>`)}finally{U(!1)}},Mt=async(e,t)=>{const n=oe[t];if(n&&n.browser)return ig.debug("Using cached browser view for checkpoint:",t),void j(n.browser);ig.warn("Browser view not in cache for checkpoint:",t,", fetching..."),U(!0);try{const n=xt(),o=St();let a;if("backend"===z)a=`${n}/dqm/assets/${e}/pagehighlight/${t}?highlightSource=false`;else{const o=I?.apiKey||oE("dqm_apiKey");if(!o)throw new Error("DQM API key not found");try{kt(o)}catch(r){throw new Error(`Invalid API key: ${r instanceof Error?r.message:"encoding error"}`)}const i=encodeURIComponent(o);a=`${n}/assets/${e}/errors/${t}?apiKey=${i}&highlightSource=false`}const i=await pb.get(a,{headers:o,timeout:15e3,responseType:"text"});if(i.data){const e=i.data;j(e),ae(n=>({...n,[t]:{...n[t],browser:e}}))}else ig.warn("No highlighted content in response"),j(`<p>${s("sidebar:no_highlighted_content")}</p>`)}catch(o){ig.error("Failed to restore browser view:",o),j(`<p style="color: #dc3545;">${s("sidebar:failed_load_browser")}</p>`)}finally{U(!1)}};/* @__PURE__ */
|
|
386
|
+
/* @__PURE__ */rt(Nd,{onClick:t,sx:{textTransform:"none"},children:E("sidebar:close")})]})]})]})]})};var VA=class extends Error{issues;constructor(e){super(e[0].message),this.name="SchemaError",this.issues=e}},KA=/* @__PURE__ */(e=>(e.uninitialized="uninitialized",e.pending="pending",e.fulfilled="fulfilled",e.rejected="rejected",e))(KA||{}),QA="uninitialized",GA="pending",XA="fulfilled",YA="rejected";function JA(e){return{status:e,isUninitialized:e===QA,isLoading:e===GA,isSuccess:e===XA,isError:e===YA}}var ZA=Qk;function eT(e,t){if(e===t||!(ZA(e)&&ZA(t)||Array.isArray(e)&&Array.isArray(t)))return t;const n=Object.keys(t),r=Object.keys(e);let o=n.length===r.length;const a=Array.isArray(t)?[]:{};for(const i of n)a[i]=eT(e[i],t[i]),o&&(o=e[i]===a[i]);return o?e:a}function tT(e,t,n){return e.reduce((e,r,o)=>(t(r,o)&&e.push(n(r,o)),e),[]).flat()}function nT(e){return null!=e}function rT(e){return[...e?.values()??[]].filter(nT)}function oT(e,t){if(!e)return t;if(!t)return e;if(function(e){return new RegExp("(^|:)//").test(e)}(t))return t;const n=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=(e=>e.replace(/\/$/,""))(e),`${e}${n}${t=(e=>e.replace(/^\//,""))(t)}`}function aT(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var iT=()=>/* @__PURE__ */new Map,sT=e=>{const t=new AbortController;return setTimeout(()=>{const e="signal timed out",n="TimeoutError";t.abort("undefined"!=typeof DOMException?new DOMException(e,n):Object.assign(new Error(e),{name:n}))},e),t.signal},lT=(...e)=>{for(const n of e)if(n.aborted)return AbortSignal.abort(n.reason);const t=new AbortController;for(const n of e)n.addEventListener("abort",()=>t.abort(n.reason),{signal:t.signal,once:!0});return t.signal},cT=(...e)=>fetch(...e),uT=e=>e.status>=200&&e.status<=299,dT=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function pT(e){if(!Qk(e))return e;const t={...e};for(const[n,r]of Object.entries(t))void 0===r&&delete t[n];return t}var fT=class{constructor(e,t=void 0){this.value=e,this.meta=t}},hT="__rtkq/",mT="focused",gT=/* @__PURE__ */C_(`${hT}${mT}`),yT=/* @__PURE__ */C_(`${hT}un${mT}`),bT=/* @__PURE__ */C_(`${hT}online`),vT=/* @__PURE__ */C_(`${hT}offline`),wT="query",xT="mutation",ST="infinitequery";function kT(e){return e.type===wT}function CT(e){return e.type===ST}function _T(e){return kT(e)||CT(e)}function ET(e,t,n,r,o,a){const i="function"==typeof e?e(t,n,r,o):e;return i?tT(i,nT,e=>a(AT(e))):[]}function AT(e){return"string"==typeof e?{type:e}:e}var TT=(e,t)=>e.endpointDefinitions[t],PT=Symbol("forceQueryFn"),RT=e=>"function"==typeof e[PT];var MT=class extends VA{constructor(e,t,n,r){super(e),this.value=t,this.schemaName=n,this._bqMeta=r}},IT=(e,t)=>Array.isArray(e)?e.includes(t):!!e;async function OT(e,t,n,r){const o=await e["~standard"].validate(t);if(o.issues)throw new MT(o.issues,t,n,r);return o.value}function NT(e){return e}var LT=(e={})=>({...e,[T_]:!0});function zT(e,{pages:t,pageParams:n},r){const o=t.length-1;return e.getNextPageParam(t[o],t,n[o],n,r)}function $T(e,{pages:t,pageParams:n},r){return e.getPreviousPageParam?.(t[0],t,n[0],n,r)}function DT(e,t,n,r){return ET(n[e.meta.arg.endpointName][t],B_(e)?e.payload:void 0,F_(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,r)}function jT(e){return dC(e)?a_(e):e}function FT(e,t,n){const r=e[t];r&&n(r)}function BT(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function qT(e,t,n){const r=e[BT(t)];r&&n(r)}var WT={};function HT({reducerPath:e,queryThunk:t,mutationThunk:n,serializeQueryArgs:r,context:{endpointDefinitions:o,apiUid:a,extractRehydrationInfo:i,hasRehydrationInfo:s},assertTagType:l,config:c}){const u=C_(`${e}/resetApiState`);function d(e,t,n,r){e[t.queryCacheKey]??={status:QA,endpointName:t.endpointName},FT(e,t.queryCacheKey,e=>{e.status=GA,e.requestId=n&&e.requestId?e.requestId:r.requestId,void 0!==t.originalArgs&&(e.originalArgs=t.originalArgs),e.startedTimeStamp=r.startedTimeStamp;CT(o[r.arg.endpointName])&&"direction"in t&&(e.direction=t.direction)})}function p(e,t,n,r){FT(e,t.arg.queryCacheKey,e=>{if(e.requestId!==t.requestId&&!r)return;const{merge:a}=o[t.arg.endpointName];if(e.status=XA,a)if(void 0!==e.data){const{fulfilledTimeStamp:r,arg:o,baseQueryMeta:i,requestId:s}=t;let l=c_(e.data,e=>a(e,n,{arg:o.originalArgs,baseQueryMeta:i,fulfilledTimeStamp:r,requestId:s}));e.data=l}else e.data=n;else e.data=o[t.arg.endpointName].structuralSharing??1?eT(dC(e.data)?(i=e.data,dC(i)||nC(15),i[tC].base_):e.data,n):n;var i;delete e.error,e.fulfilledTimeStamp=t.fulfilledTimeStamp})}const f=tE({name:`${e}/queries`,initialState:WT,reducers:{removeQueryResult:{reducer(e,{payload:{queryCacheKey:t}}){delete e[t]},prepare:P_()},cacheEntriesUpserted:{reducer(e,t){for(const n of t.payload){const{queryDescription:r,value:o}=n;d(e,r,!0,{arg:r,requestId:t.meta.requestId,startedTimeStamp:t.meta.timestamp}),p(e,{arg:r,requestId:t.meta.requestId,fulfilledTimeStamp:t.meta.timestamp,baseQueryMeta:{}},o,!0)}},prepare:e=>({payload:e.map(e=>{const{endpointName:t,arg:n,value:a}=e,i=o[t];return{queryDescription:{type:wT,endpointName:t,originalArgs:e.arg,queryCacheKey:r({queryArgs:n,endpointDefinition:i,endpointName:t})},value:a}}),meta:{[T_]:!0,requestId:W_(),timestamp:Date.now()}})},queryResultPatched:{reducer(e,{payload:{queryCacheKey:t,patches:n}}){FT(e,t,e=>{e.data=d_(e.data,n.concat())})},prepare:P_()}},extraReducers(e){e.addCase(t.pending,(e,{meta:t,meta:{arg:n}})=>{d(e,n,RT(n),t)}).addCase(t.fulfilled,(e,{meta:t,payload:n})=>{p(e,t,n,RT(t.arg))}).addCase(t.rejected,(e,{meta:{condition:t,arg:n,requestId:r},error:o,payload:a})=>{FT(e,n.queryCacheKey,e=>{if(t);else{if(e.requestId!==r)return;e.status=YA,e.error=a??o}})}).addMatcher(s,(e,t)=>{const{queries:n}=i(t);for(const[r,o]of Object.entries(n))o?.status!==XA&&o?.status!==YA||(e[r]=o)})}}),h=tE({name:`${e}/mutations`,initialState:WT,reducers:{removeMutationResult:{reducer(e,{payload:t}){const n=BT(t);n in e&&delete e[n]},prepare:P_()}},extraReducers(e){e.addCase(n.pending,(e,{meta:t,meta:{requestId:n,arg:r,startedTimeStamp:o}})=>{r.track&&(e[BT(t)]={requestId:n,status:GA,endpointName:r.endpointName,startedTimeStamp:o})}).addCase(n.fulfilled,(e,{payload:t,meta:n})=>{n.arg.track&&qT(e,n,e=>{e.requestId===n.requestId&&(e.status=XA,e.data=t,e.fulfilledTimeStamp=n.fulfilledTimeStamp)})}).addCase(n.rejected,(e,{payload:t,error:n,meta:r})=>{r.arg.track&&qT(e,r,e=>{e.requestId===r.requestId&&(e.status=YA,e.error=t??n)})}).addMatcher(s,(e,t)=>{const{mutations:n}=i(t);for(const[r,o]of Object.entries(n))o?.status!==XA&&o?.status!==YA||r===o?.requestId||(e[r]=o)})}}),m=tE({name:`${e}/invalidation`,initialState:{tags:{},keys:{}},reducers:{updateProvidedBy:{reducer(e,t){for(const{queryCacheKey:n,providedTags:r}of t.payload){g(e,n);for(const{type:t,id:o}of r){const r=(e.tags[t]??={})[o||"__internal_without_id"]??=[];r.includes(n)||r.push(n)}e.keys[n]=r}},prepare:P_()}},extraReducers(e){e.addCase(f.actions.removeQueryResult,(e,{payload:{queryCacheKey:t}})=>{g(e,t)}).addMatcher(s,(e,t)=>{const{provided:n}=i(t);for(const[r,o]of Object.entries(n.tags??{}))for(const[t,a]of Object.entries(o)){const o=(e.tags[r]??={})[t||"__internal_without_id"]??=[];for(const t of a){o.includes(t)||o.push(t),e.keys[t]=n.keys[t]}}}).addMatcher(N_(B_(t),F_(t)),(e,t)=>{y(e,[t])}).addMatcher(f.actions.cacheEntriesUpserted.match,(e,t)=>{y(e,t.payload.map(({queryDescription:e,value:t})=>({type:"UNKNOWN",payload:t,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:e}})))})}});function g(e,t){const n=jT(e.keys[t]??[]);for(const r of n){const n=r.type,o=r.id??"__internal_without_id",a=e.tags[n]?.[o];a&&(e.tags[n][o]=jT(a).filter(e=>e!==t))}delete e.keys[t]}function y(e,t){const n=t.map(e=>{const t=DT(e,"providesTags",o,l),{queryCacheKey:n}=e.meta.arg;return{queryCacheKey:n,providedTags:t}});m.caseReducers.updateProvidedBy(e,m.actions.updateProvidedBy(n))}const b=tE({name:`${e}/subscriptions`,initialState:WT,reducers:{updateSubscriptionOptions(e,t){},unsubscribeQueryResult(e,t){},internal_getRTKQSubscriptions(){}}}),v=tE({name:`${e}/internalSubscriptions`,initialState:WT,reducers:{subscriptionsUpdated:{reducer:(e,t)=>d_(e,t.payload),prepare:P_()}}}),w=tE({name:`${e}/config`,initialState:{online:"undefined"==typeof navigator||void 0===navigator.onLine||navigator.onLine,focused:"undefined"==typeof document||"hidden"!==document.visibilityState,middlewareRegistered:!1,...c},reducers:{middlewareRegistered(e,{payload:t}){e.middlewareRegistered="conflict"!==e.middlewareRegistered&&a===t||"conflict"}},extraReducers:e=>{e.addCase(bT,e=>{e.online=!0}).addCase(vT,e=>{e.online=!1}).addCase(gT,e=>{e.focused=!0}).addCase(yT,e=>{e.focused=!1}).addMatcher(s,e=>({...e}))}}),x=Xk({queries:f.reducer,mutations:h.reducer,provided:m.reducer,subscriptions:v.reducer,config:w.reducer});return{reducer:(e,t)=>x(u.match(t)?void 0:e,t),actions:{...w.actions,...f.actions,...b.actions,...v.actions,...h.actions,...m.actions,resetApiState:u}}}var UT=/* @__PURE__ */Symbol.for("RTKQ/skipToken"),VT={status:QA},KT=/* @__PURE__ */c_(VT,()=>{}),QT=/* @__PURE__ */c_(VT,()=>{});var GT=WeakMap?/* @__PURE__ */new WeakMap:void 0,XT=({endpointName:e,queryArgs:t})=>{let n="";const r=GT?.get(t);if("string"==typeof r)n=r;else{const e=JSON.stringify(t,(e,t)=>t=Qk(t="bigint"==typeof t?{$bigint:t.toString()}:t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t);Qk(t)&>?.set(t,e),n=e}return`${e}(${n})`};function YT(...e){return function(t){const n=g_(e=>t.extractRehydrationInfo?.(e,{reducerPath:t.reducerPath??"api"})),r={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...t,extractRehydrationInfo:n,serializeQueryArgs(e){let n=XT;if("serializeQueryArgs"in e.endpointDefinition){const t=e.endpointDefinition.serializeQueryArgs;n=e=>{const n=t(e);return"string"==typeof n?n:XT({...e,queryArgs:n})}}else t.serializeQueryArgs&&(n=t.serializeQueryArgs);return n(e)},tagTypes:[...t.tagTypes||[]]},o={endpointDefinitions:{},batch(e){e()},apiUid:W_(),extractRehydrationInfo:n,hasRehydrationInfo:g_(e=>null!=n(e))},a={injectEndpoints:function(e){const t=e.endpoints({query:e=>({...e,type:wT}),mutation:e=>({...e,type:xT}),infiniteQuery:e=>({...e,type:ST})});for(const[n,r]of Object.entries(t))if(!0!==e.overrideExisting&&n in o.endpointDefinitions){if("throw"===e.overrideExisting)throw new Error(rE(39))}else{o.endpointDefinitions[n]=r;for(const e of i)e.injectEndpoint(n,r)}return a},enhanceEndpoints({addTagTypes:e,endpoints:t}){if(e)for(const n of e)r.tagTypes.includes(n)||r.tagTypes.push(n);if(t)for(const[n,r]of Object.entries(t))"function"==typeof r?r(TT(o,n)):Object.assign(TT(o,n)||{},r);return a}},i=e.map(e=>e.init(a,r,o));return a.injectEndpoints({endpoints:t.endpoints})}}function JT(e,...t){return Object.assign(e,...t)}var ZT=({api:e,queryThunk:t,internalState:n,mwApi:r})=>{const o=`${e.reducerPath}/subscriptions`;let a=null,i=null;const{updateSubscriptionOptions:s,unsubscribeQueryResult:l}=e.internalActions,c=()=>n.currentSubscriptions,u={getSubscriptions:c,getSubscriptionCount:e=>{const t=c().get(e);return t?.size??0},isRequestSubscribed:(e,t)=>{const n=c();return!!n?.get(e)?.get(t)}};function d(e){return JSON.parse(JSON.stringify(Object.fromEntries([...e].map(([e,t])=>[e,Object.fromEntries(t)]))))}return(r,c)=>{if(a||(a=d(n.currentSubscriptions)),e.util.resetApiState.match(r))return a={},n.currentSubscriptions.clear(),i=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(r))return[!1,u];const p=((n,r)=>{if(s.match(r)){const{queryCacheKey:e,requestId:t,options:o}=r.payload,a=n.get(e);return a?.has(t)&&a.set(t,o),!0}if(l.match(r)){const{queryCacheKey:e,requestId:t}=r.payload,o=n.get(e);return o&&o.delete(t),!0}if(e.internalActions.removeQueryResult.match(r))return n.delete(r.payload.queryCacheKey),!0;if(t.pending.match(r)){const{meta:{arg:e,requestId:t}}=r,o=aT(n,e.queryCacheKey,iT);return e.subscribe&&o.set(t,e.subscriptionOptions??o.get(t)??{}),!0}let o=!1;if(t.rejected.match(r)){const{meta:{condition:e,arg:t,requestId:a}}=r;if(e&&t.subscribe){const e=aT(n,t.queryCacheKey,iT);e.set(a,t.subscriptionOptions??e.get(a)??{}),o=!0}}return o})(n.currentSubscriptions,r);let f=!0;if(p){i||(i=setTimeout(()=>{const t=d(n.currentSubscriptions),[,r]=u_(a,()=>t);c.next(e.internalActions.subscriptionsUpdated(r)),a=t,i=null},500));const s="string"==typeof r.type&&!!r.type.startsWith(o),l=t.rejected.match(r)&&r.meta.condition&&!!r.meta.arg.subscribe;f=!s&&!l}return[f,!1]}},eP=({reducerPath:e,api:t,queryThunk:n,context:r,internalState:o,selectors:{selectQueryEntry:a,selectConfig:i},getRunningQueryThunk:s,mwApi:l})=>{const{removeQueryResult:c,unsubscribeQueryResult:u,cacheEntriesUpserted:d}=t.internalActions,p=N_(u.match,n.fulfilled,n.rejected,d.match);function f(e){const t=o.currentSubscriptions.get(e);if(!t)return!1;return t.size>0}const h={};function m(e){for(const t of e.values())t?.abort?.()}function g(e,t,n){const r=t.getState();for(const o of e){const e=a(r,o);e?.endpointName&&y(o,e.endpointName,t,n)}}function y(e,t,n,o){const i=TT(r,t),l=i?.keepUnusedDataFor??o.keepUnusedDataFor;if(l===1/0)return;const u=Math.max(0,Math.min(l,2147482.647));if(!f(e)){const t=h[e];t&&clearTimeout(t),h[e]=setTimeout(()=>{if(!f(e)){const t=a(n.getState(),e);if(t?.endpointName){const e=n.dispatch(s(t.endpointName,t.originalArgs));e?.abort()}n.dispatch(c({queryCacheKey:e}))}delete h[e]},1e3*u)}}return(e,n)=>{const a=n.getState(),s=i(a);if(p(e)){let t;if(d.match(e))t=e.payload.map(e=>e.queryDescription.queryCacheKey);else{const{queryCacheKey:n}=u.match(e)?e.payload:e.meta.arg;t=[n]}g(t,n,s)}if(t.util.resetApiState.match(e)){for(const[e,t]of Object.entries(h))t&&clearTimeout(t),delete h[e];m(o.runningQueries),m(o.runningMutations)}if(r.hasRehydrationInfo(e)){const{queries:t}=r.extractRehydrationInfo(e);g(Object.keys(t),n,s)}}},tP=new Error("Promise never resolved before cacheEntryRemoved."),nP=({api:e,reducerPath:t,context:n,queryThunk:r,mutationThunk:o,internalState:a,selectors:{selectQueryEntry:i,selectApiState:s}})=>{const l=q_(r),c=q_(o),u=B_(r,o),d={},{removeQueryResult:p,removeMutationResult:f,cacheEntriesUpserted:h}=e.internalActions;function m(e,t,n){const r=d[e];r?.valueResolved&&(r.valueResolved({data:t,meta:n}),delete r.valueResolved)}function g(e){const t=d[e];t&&(delete d[e],t.cacheEntryRemoved())}function y(e){const{arg:t,requestId:n}=e.meta,{endpointName:r,originalArgs:o}=t;return[r,o,n]}function b(t,r,o,a,i){const s=TT(n,t),l=s?.onCacheEntryAdded;if(!l)return;const c={},u=new Promise(e=>{c.cacheEntryRemoved=e}),p=Promise.race([new Promise(e=>{c.valueResolved=e}),u.then(()=>{throw tP})]);p.catch(()=>{}),d[o]=c;const f=e.endpoints[t].select(_T(s)?r:o),h=a.dispatch((e,t,n)=>n),m={...a,getCacheEntry:()=>f(a.getState()),requestId:i,extra:h,updateCachedData:_T(s)?n=>a.dispatch(e.util.updateQueryData(t,r,n)):void 0,cacheDataLoaded:p,cacheEntryRemoved:u},g=l(r,m);Promise.resolve(g).catch(e=>{if(e!==tP)throw e})}return(n,a,s)=>{const v=function(e){if(l(e))return e.meta.arg.queryCacheKey;if(c(e))return e.meta.arg.fixedCacheKey??e.meta.requestId;return p.match(e)?e.payload.queryCacheKey:f.match(e)?BT(e.payload):""}(n);function w(e,t,n,r){const o=i(s,t),l=i(a.getState(),t);!o&&l&&b(e,r,t,a,n)}if(r.pending.match(n)){const[e,t,r]=y(n);w(e,v,r,t)}else if(h.match(n))for(const{queryDescription:e,value:t}of n.payload){const{endpointName:r,originalArgs:o,queryCacheKey:a}=e;w(r,a,n.meta.requestId,o),m(a,t,{})}else if(o.pending.match(n)){if(a.getState()[t].mutations[v]){const[e,t,r]=y(n);b(e,t,v,a,r)}}else if(u(n))m(v,n.payload,n.meta.baseQueryMeta);else if(p.match(n)||f.match(n))g(v);else if(e.util.resetApiState.match(n))for(const e of Object.keys(d))g(e)}},rP=({api:e,context:{apiUid:t},reducerPath:n})=>(n,r)=>{e.util.resetApiState.match(n)&&r.dispatch(e.internalActions.middlewareRegistered(t))},oP=({reducerPath:e,context:t,context:{endpointDefinitions:n},mutationThunk:r,queryThunk:o,api:a,assertTagType:i,refetchQuery:s,internalState:l})=>{const{removeQueryResult:c}=a.internalActions,u=N_(B_(r),F_(r)),d=N_(B_(o,r),j_(o,r));let p=[],f=0;function h(n,r){const o=r.getState(),i=o[e];if(p.push(...n),"delayed"===i.config.invalidationBehavior&&f>0)return;const u=p;if(p=[],0===u.length)return;const d=a.util.selectInvalidatedBy(o,u);t.batch(()=>{const e=Array.from(d.values());for(const{queryCacheKey:t}of e){const e=i.queries[t],n=aT(l.currentSubscriptions,t,iT);e&&(0===n.size?r.dispatch(c({queryCacheKey:t})):e.status!==QA&&r.dispatch(s(e)))}})}return(e,t)=>{(o.pending.match(e)||r.pending.match(e))&&f++,d(e)&&(f=Math.max(0,f-1)),u(e)?h(DT(e,"invalidatesTags",n,i),t):d(e)?h([],t):a.util.invalidateTags.match(e)&&h(ET(e.payload,void 0,void 0,void 0,void 0,i),t)}},aP=({reducerPath:e,queryThunk:t,api:n,refetchQuery:r,internalState:o})=>{const{currentPolls:a,currentSubscriptions:i}=o,s=/* @__PURE__ */new Set;let l=null;function c(e,t){s.add(e),l||(l=setTimeout(()=>{for(const e of s)d({queryCacheKey:e},t);s.clear(),l=null},0))}function u({queryCacheKey:t},n){const o=n.getState()[e],s=o.queries[t],l=i.get(t);if(!s||s.status===QA)return;const{lowestPollingInterval:c,skipPollingIfUnfocused:d}=f(l);if(!Number.isFinite(c))return;const p=a.get(t);p?.timeout&&(clearTimeout(p.timeout),p.timeout=void 0);const h=Date.now()+c;a.set(t,{nextPollTimestamp:h,pollingInterval:c,timeout:setTimeout(()=>{!o.config.focused&&d||n.dispatch(r(s)),u({queryCacheKey:t},n)},c)})}function d({queryCacheKey:t},n){const r=n.getState()[e].queries[t],o=i.get(t);if(!r||r.status===QA)return;const{lowestPollingInterval:s}=f(o);if(!Number.isFinite(s))return void p(t);const l=a.get(t),c=Date.now()+s;(!l||c<l.nextPollTimestamp)&&u({queryCacheKey:t},n)}function p(e){const t=a.get(e);t?.timeout&&clearTimeout(t.timeout),a.delete(e)}function f(e=/* @__PURE__ */new Map){let t=!1,n=Number.POSITIVE_INFINITY;for(const r of e.values())r.pollingInterval&&(n=Math.min(r.pollingInterval,n),t=r.skipPollingIfUnfocused||t);return{lowestPollingInterval:n,skipPollingIfUnfocused:t}}return(e,r)=>{(n.internalActions.updateSubscriptionOptions.match(e)||n.internalActions.unsubscribeQueryResult.match(e))&&c(e.payload.queryCacheKey,r),(t.pending.match(e)||t.rejected.match(e)&&e.meta.condition)&&c(e.meta.arg.queryCacheKey,r),(t.fulfilled.match(e)||t.rejected.match(e)&&!e.meta.condition)&&u(e.meta.arg,r),n.util.resetApiState.match(e)&&(!function(){for(const e of a.keys())p(e)}(),l&&(clearTimeout(l),l=null),s.clear())}},iP=({api:e,context:t,queryThunk:n,mutationThunk:r})=>{const o=D_(n,r),a=j_(n,r),i=B_(n,r),s={};return(n,r)=>{if(o(n)){const{requestId:o,arg:{endpointName:a,originalArgs:i}}=n.meta,l=TT(t,a),c=l?.onQueryStarted;if(c){const t={},n=new Promise((e,n)=>{t.resolve=e,t.reject=n});n.catch(()=>{}),s[o]=t;const u=e.endpoints[a].select(_T(l)?i:o),d=r.dispatch((e,t,n)=>n),p={...r,getCacheEntry:()=>u(r.getState()),requestId:o,extra:d,updateCachedData:_T(l)?t=>r.dispatch(e.util.updateQueryData(a,i,t)):void 0,queryFulfilled:n};c(i,p)}}else if(i(n)){const{requestId:e,baseQueryMeta:t}=n.meta;s[e]?.resolve({data:n.payload,meta:t}),delete s[e]}else if(a(n)){const{requestId:e,rejectedWithValue:t,baseQueryMeta:r}=n.meta;s[e]?.reject({error:n.payload??n.error,isUnhandledError:!t,meta:r}),delete s[e]}}};function sP(e){const{reducerPath:t,queryThunk:n,api:r,context:o,getInternalState:a}=e,{apiUid:i}=o,s={invalidateTags:C_(`${t}/invalidateTags`)},l=e=>e.type.startsWith(`${t}/`),c=[rP,eP,oP,aP,nP,iP];return{middleware:n=>{let s=!1;const d=a(n.dispatch),p={...e,internalState:d,refetchQuery:u,isThisApiSliceAction:l,mwApi:n},f=c.map(e=>e(p)),h=ZT(p),m=(({reducerPath:e,context:t,api:n,refetchQuery:r,internalState:o})=>{const{removeQueryResult:a}=n.internalActions;function i(n,i){const s=n.getState()[e],l=s.queries,c=o.currentSubscriptions;t.batch(()=>{for(const e of c.keys()){const t=l[e],o=c.get(e);if(!o||!t)continue;const u=[...o.values()];(u.some(e=>!0===e[i])||u.every(e=>void 0===e[i])&&s.config[i])&&(0===o.size?n.dispatch(a({queryCacheKey:e})):t.status!==QA&&n.dispatch(r(t)))}})}return(e,t)=>{gT.match(e)&&i(t,"refetchOnFocus"),bT.match(e)&&i(t,"refetchOnReconnect")}})(p);return e=>a=>{if(!Jk(a))return e(a);s||(s=!0,n.dispatch(r.internalActions.middlewareRegistered(i)));const c={...n,next:e},u=n.getState(),[d,p]=h(a,c,u);let g;if(g=d?e(a):p,n.getState()[t]&&(m(a,c,u),l(a)||o.hasRehydrationInfo(a)))for(const e of f)e(a,c,u);return g}},actions:s};function u(t){return e.api.endpoints[t.endpointName].initiate(t.originalArgs,{subscribe:!1,forceRefetch:!0})}}var lP=/* @__PURE__ */Symbol(),cP=({createSelector:e=b_}={})=>({name:lP,init(t,{baseQuery:n,tagTypes:r,reducerPath:o,serializeQueryArgs:a,keepUnusedDataFor:i,refetchOnMountOrArgChange:s,refetchOnFocus:l,refetchOnReconnect:c,invalidationBehavior:u,onSchemaFailure:d,catchSchemaFailure:p,skipSchemaValidation:f},h){s_();const m=e=>e;Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:bT,onOffline:vT,onFocus:gT,onFocusLost:yT},util:{}});const g=function({serializeQueryArgs:e,reducerPath:t,createSelector:n}){const r=e=>KT,o=e=>QT;return{buildQuerySelector:function(e,t){return c(e,t,a)},buildInfiniteQuerySelector:function(e,t){const{infiniteQueryOptions:n}=t;return c(e,t,function(e){const t={...e,...JA(e.status)},{isLoading:r,isError:o,direction:a}=t,i="forward"===a,s="backward"===a;return{...t,hasNextPage:u(n,t.data,t.originalArgs),hasPreviousPage:d(n,t.data,t.originalArgs),isFetchingNextPage:r&&i,isFetchingPreviousPage:r&&s,isFetchNextPageError:o&&i,isFetchPreviousPageError:o&&s}})},buildMutationSelector:function(){return e=>{let t;return t="object"==typeof e?BT(e)??UT:e,n(t===UT?o:e=>i(e)?.mutations?.[t]??QT,a)}},selectInvalidatedBy:function(e,n){const r=e[t],o=/* @__PURE__ */new Set,a=tT(n,nT,AT);for(const t of a){const e=r.provided.tags[t.type];if(!e)continue;let n=(void 0!==t.id?e[t.id]:Object.values(e).flat())??[];for(const t of n)o.add(t)}return Array.from(o.values()).flatMap(e=>{const t=r.queries[e];return t?{queryCacheKey:e,endpointName:t.endpointName,originalArgs:t.originalArgs}:[]})},selectCachedArgsForQuery:function(e,t){return tT(Object.values(s(e)),e=>e?.endpointName===t&&e.status!==QA,e=>e.originalArgs)},selectApiState:i,selectQueries:s,selectMutations:function(e){return i(e)?.mutations},selectQueryEntry:l,selectConfig:function(e){return i(e)?.config}};function a(e){return{...e,...JA(e.status)}}function i(e){return e[t]}function s(e){return i(e)?.queries}function l(e,t){return s(e)?.[t]}function c(t,o,a){return i=>{if(i===UT)return n(r,a);const s=e({queryArgs:i,endpointDefinition:o,endpointName:t});return n(e=>l(e,s)??KT,a)}}function u(e,t,n){return!!t&&null!=zT(e,t,n)}function d(e,t,n){return!(!t||!e.getPreviousPageParam)&&null!=$T(e,t,n)}}({serializeQueryArgs:a,reducerPath:o,createSelector:e}),{selectInvalidatedBy:y,selectCachedArgsForQuery:b,buildQuerySelector:v,buildInfiniteQuerySelector:w,buildMutationSelector:x}=g;JT(t.util,{selectInvalidatedBy:y,selectCachedArgsForQuery:b});const{queryThunk:S,infiniteQueryThunk:k,mutationThunk:C,patchQueryData:_,updateQueryData:E,upsertQueryData:A,prefetch:T,buildMatchThunkActions:P}=function({reducerPath:e,baseQuery:t,context:{endpointDefinitions:n},serializeQueryArgs:r,api:o,assertTagType:a,selectors:i,onSchemaFailure:s,catchSchemaFailure:l,skipSchemaValidation:c}){function u(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}function d(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}const p=(e,t)=>e.query&&e[t]?e[t]:NT,f=async(e,{signal:r,abort:o,rejectWithValue:a,fulfillWithValue:f,dispatch:m,getState:g,extra:y})=>{const b=n[e.endpointName],{metaSchema:v,skipSchemaValidation:w=c}=b,x=e.type===wT;try{let C=NT;const _={signal:r,abort:o,dispatch:m,getState:g,extra:y,endpoint:e.endpointName,type:e.type,forced:x?h(e,g()):void 0,queryCacheKey:x?e.queryCacheKey:void 0},E=x?e[PT]:void 0;let A;const T=async(t,n,r,o)=>{if(null==n&&t.pages.length)return Promise.resolve({data:t});const a={queryArg:e.originalArgs,pageParam:n},i=await P(a),s=o?u:d;return{data:{pages:s(t.pages,i.data,r),pageParams:s(t.pageParams,n,r)},meta:i.meta}};async function P(e){let n;const{extraOptions:r,argSchema:o,rawResponseSchema:a,responseSchema:i}=b;if(o&&!IT(w,"arg")&&(e=await OT(o,e,"argSchema",{})),E?n=E():b.query?(C=p(b,"transformResponse"),n=await t(b.query(e),_,r)):n=await b.queryFn(e,_,r,e=>t(e,_,r)),n.error)throw new fT(n.error,n.meta);let{data:s}=n;a&&!IT(w,"rawResponse")&&(s=await OT(a,n.data,"rawResponseSchema",n.meta));let l=await C(s,n.meta,e);return i&&!IT(w,"response")&&(l=await OT(i,l,"responseSchema",n.meta)),{...n,data:l}}if(x&&"infiniteQueryOptions"in b){const{infiniteQueryOptions:R}=b,{maxPages:M=1/0}=R,I=e.refetchCachedPages??R.refetchCachedPages??!0;let O;const N={pages:[],pageParams:[]},L=i.selectQueryEntry(g(),e.queryCacheKey)?.data,z=h(e,g())&&!e.direction||!L?N:L;if("direction"in e&&e.direction&&z.pages.length){const $="backward"===e.direction,D=($?$T:zT)(R,z,e.originalArgs);O=await T(z,D,M,$)}else{const{initialPageParam:j=R.initialPageParam}=e,F=L?.pageParams??[],B=F[0]??j,q=F.length;if(O=await T(z,B,M),E&&(O={data:O.data.pages[0]}),I)for(let W=1;W<q;W++){const H=zT(R,O.data,e.originalArgs);O=await T(O.data,H,M)}}A=O}else A=await P(e.originalArgs);return v&&!IT(w,"meta")&&A.meta&&(A.meta=await OT(v,A.meta,"metaSchema",A.meta)),f(A.data,LT({fulfilledTimeStamp:Date.now(),baseQueryMeta:A.meta}))}catch(S){let U=S;if(U instanceof fT){let V=p(b,"transformErrorResponse");const{rawErrorResponseSchema:K,errorResponseSchema:Q}=b;let{value:G,meta:X}=U;try{K&&!IT(w,"rawErrorResponse")&&(G=await OT(K,G,"rawErrorResponseSchema",X)),v&&!IT(w,"meta")&&(X=await OT(v,X,"metaSchema",X));let Y=await V(G,X,e.originalArgs);return Q&&!IT(w,"errorResponse")&&(Y=await OT(Q,Y,"errorResponseSchema",X)),a(Y,LT({baseQueryMeta:X}))}catch(k){U=k}}try{if(U instanceof MT){const J={endpoint:e.endpointName,arg:e.originalArgs,type:e.type,queryCacheKey:x?e.queryCacheKey:void 0};b.onSchemaFailure?.(U,J),s?.(U,J);const{catchSchemaFailure:Z=l}=b;if(Z)return a(Z(U,J),LT({baseQueryMeta:U._bqMeta}))}}catch(k){U=k}throw console.error(U),U}};function h(e,t){const n=i.selectQueryEntry(t,e.queryCacheKey),r=i.selectConfig(t).refetchOnMountOrArgChange,o=n?.fulfilledTimeStamp,a=e.forceRefetch??(e.subscribe&&r);return!!a&&(!0===a||(Number(/* @__PURE__ */new Date)-Number(o))/1e3>=a)}const m=()=>G_(`${e}/executeQuery`,f,{getPendingMeta({arg:e}){const t=n[e.endpointName];return LT({startedTimeStamp:Date.now(),...CT(t)?{direction:e.direction}:{}})},condition(e,{getState:t}){const r=t(),o=i.selectQueryEntry(r,e.queryCacheKey),a=o?.fulfilledTimeStamp,s=e.originalArgs,l=o?.originalArgs,c=n[e.endpointName],u=e.direction;return!(!RT(e)&&("pending"===o?.status||!h(e,r)&&(!kT(c)||!c?.forceRefetch?.({currentArg:s,previousArg:l,endpointState:o,state:r}))&&a&&!u))},dispatchConditionRejection:!0}),g=m(),y=m(),b=G_(`${e}/executeMutation`,f,{getPendingMeta:()=>LT({startedTimeStamp:Date.now()})});function v(e){return t=>t?.meta?.arg?.endpointName===e}return{queryThunk:g,mutationThunk:b,infiniteQueryThunk:y,prefetch:(e,t,n={})=>(r,a)=>{const i=(e=>"force"in e)(n)&&n.force,s=(e=>"ifOlderThan"in e)(n)&&n.ifOlderThan,l=(n=!0)=>{const r={forceRefetch:n,subscribe:!1};return o.endpoints[e].initiate(t,r)},c=o.endpoints[e].select(t)(a());if(i)r(l());else if(s){const e=c?.fulfilledTimeStamp;if(!e)return void r(l());(Number(/* @__PURE__ */new Date)-Number(new Date(e)))/1e3>=s&&r(l())}else r(l(!1))},updateQueryData:(e,t,n,r=!0)=>(a,i)=>{const s=o.endpoints[e].select(t)(i()),l={patches:[],inversePatches:[],undo:()=>a(o.util.patchQueryData(e,t,l.inversePatches,r))};if(s.status===QA)return l;let c;if("data"in s)if(pC(s.data)){const[e,t,r]=u_(s.data,n);l.patches.push(...t),l.inversePatches.push(...r),c=e}else c=n(s.data),l.patches.push({op:"replace",path:[],value:c}),l.inversePatches.push({op:"replace",path:[],value:s.data});return 0===l.patches.length||a(o.util.patchQueryData(e,t,l.patches,r)),l},upsertQueryData:(e,t,n)=>r=>r(o.endpoints[e].initiate(t,{subscribe:!1,forceRefetch:!0,[PT]:()=>({data:n})})),patchQueryData:(e,t,i,s)=>(l,c)=>{const u=n[e],d=r({queryArgs:t,endpointDefinition:u,endpointName:e});if(l(o.internalActions.queryResultPatched({queryCacheKey:d,patches:i})),!s)return;const p=o.endpoints[e].select(t)(c()),f=ET(u.providesTags,p.data,void 0,t,{},a);l(o.internalActions.updateProvidedBy([{queryCacheKey:d,providedTags:f}]))},buildMatchThunkActions:function(e,t){return{matchPending:L_(D_(e),v(t)),matchFulfilled:L_(B_(e),v(t)),matchRejected:L_(j_(e),v(t))}}}}({baseQuery:n,reducerPath:o,context:h,api:t,serializeQueryArgs:a,assertTagType:m,selectors:g,onSchemaFailure:d,catchSchemaFailure:p,skipSchemaValidation:f}),{reducer:R,actions:M}=HT({context:h,queryThunk:S,mutationThunk:C,serializeQueryArgs:a,reducerPath:o,assertTagType:m,config:{refetchOnFocus:l,refetchOnReconnect:c,refetchOnMountOrArgChange:s,keepUnusedDataFor:i,reducerPath:o,invalidationBehavior:u}});JT(t.util,{patchQueryData:_,updateQueryData:E,upsertQueryData:A,prefetch:T,resetApiState:M.resetApiState,upsertQueryEntries:M.cacheEntriesUpserted}),JT(t.internalActions,M);const I=/* @__PURE__ */new WeakMap,O=e=>aT(I,e,()=>({currentSubscriptions:/* @__PURE__ */new Map,currentPolls:/* @__PURE__ */new Map,runningQueries:/* @__PURE__ */new Map,runningMutations:/* @__PURE__ */new Map})),{buildInitiateQuery:N,buildInitiateInfiniteQuery:L,buildInitiateMutation:z,getRunningMutationThunk:$,getRunningMutationsThunk:D,getRunningQueriesThunk:j,getRunningQueryThunk:F}=function({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:n,mutationThunk:r,api:o,context:a,getInternalState:i}){const s=e=>i(e)?.runningQueries,l=e=>i(e)?.runningMutations,{unsubscribeQueryResult:c,removeMutationResult:u,updateSubscriptionOptions:d}=o.internalActions;return{buildInitiateQuery:function(e,t){return p(e,t)},buildInitiateInfiniteQuery:function(e,t){return p(e,t)},buildInitiateMutation:function(e){return(t,{track:n=!0,fixedCacheKey:o}={})=>(a,i)=>{const s=r({type:"mutation",endpointName:e,originalArgs:t,track:n,fixedCacheKey:o}),c=a(s),{requestId:d,abort:p,unwrap:f}=c,h=(m=e=>({error:e}),c.unwrap().then(e=>({data:e})).catch(m));var m;const g=Object.assign(h,{arg:c.arg,requestId:d,abort:p,unwrap:f,reset:()=>{a(u({requestId:d,fixedCacheKey:o}))}}),y=l(a);return y.set(d,g),g.then(()=>{y.delete(d)}),o&&(y.set(o,g),g.then(()=>{y.get(o)===g&&y.delete(o)})),g}},getRunningQueryThunk:function(t,n){return r=>{const o=TT(a,t),i=e({queryArgs:n,endpointDefinition:o,endpointName:t});return s(r)?.get(i)}},getRunningMutationThunk:function(e,t){return e=>l(e)?.get(t)},getRunningQueriesThunk:function(){return e=>rT(s(e))},getRunningMutationsThunk:function(){return e=>rT(l(e))}};function p(r,a){const i=(l,{subscribe:u=!0,forceRefetch:p,subscriptionOptions:f,[PT]:h,...m}={})=>(g,y)=>{const b=e({queryArgs:l,endpointDefinition:a,endpointName:r});let v;const w={...m,type:wT,subscribe:u,forceRefetch:p,subscriptionOptions:f,endpointName:r,originalArgs:l,queryCacheKey:b,[PT]:h};if(kT(a))v=t(w);else{const{direction:e,initialPageParam:t,refetchCachedPages:r}=m;v=n({...w,direction:e,initialPageParam:t,refetchCachedPages:r})}const x=o.endpoints[r].select(l),S=g(v),k=x(y()),{requestId:C,abort:_}=S,E=k.requestId!==C,A=s(g)?.get(b),T=()=>x(y()),P=Object.assign(h?S.then(T):E&&!A?Promise.resolve(k):Promise.all([A,S]).then(T),{arg:l,requestId:C,subscriptionOptions:f,queryCacheKey:b,abort:_,async unwrap(){const e=await P;if(e.isError)throw e.error;return e.data},refetch:e=>g(i(l,{subscribe:!1,forceRefetch:!0,...e})),unsubscribe(){u&&g(c({queryCacheKey:b,requestId:C}))},updateSubscriptionOptions(e){P.subscriptionOptions=e,g(d({endpointName:r,requestId:C,queryCacheKey:b,options:e}))}});if(!A&&!E&&!h){const e=s(g);e.set(b,P),P.then(()=>{e.delete(b)})}return P};return i}}({queryThunk:S,mutationThunk:C,infiniteQueryThunk:k,api:t,serializeQueryArgs:a,context:h,getInternalState:O});JT(t.util,{getRunningMutationThunk:$,getRunningMutationsThunk:D,getRunningQueryThunk:F,getRunningQueriesThunk:j});const{middleware:B,actions:q}=sP({reducerPath:o,context:h,queryThunk:S,mutationThunk:C,infiniteQueryThunk:k,api:t,assertTagType:m,selectors:g,getRunningQueryThunk:F,getInternalState:O});return JT(t.util,q),JT(t,{reducer:R,middleware:B}),{name:lP,injectEndpoint(e,n){const r=t,o=r.endpoints[e]??={};kT(n)&&JT(o,{name:e,select:v(e,n),initiate:N(e,n)},P(S,e)),n.type===xT&&JT(o,{name:e,select:x(),initiate:z(e)},P(C,e)),CT(n)&&JT(o,{name:e,select:w(e,n),initiate:L(e,n)},P(S,e))}}}});function uP(e){return e.replace(e[0],e[0].toUpperCase())}cP();function dP(e){return"infinitequery"===e.type}function pP(e,...t){return Object.assign(e,...t)}var fP=Symbol();function hP(e){const t=h.useRef(e),n=h.useMemo(()=>eT(t.current,e),[e]);return h.useEffect(()=>{t.current!==n&&(t.current=n)},[n]),n}function mP(e){const t=h.useRef(e);return h.useEffect(()=>{Bi(t.current,e)||(t.current=e)},[e]),Bi(t.current,e)?t.current:e}var gP=/* @__PURE__ */(()=>!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement))(),yP=/* @__PURE__ */(()=>"undefined"!=typeof navigator&&"ReactNative"===navigator.product)(),bP=/* @__PURE__ */(()=>gP||yP?h.useLayoutEffect:h.useEffect)(),vP=e=>e.isUninitialized?{...e,isUninitialized:!1,isFetching:!0,isLoading:void 0===e.data,status:KA.pending}:e;function wP(e,...t){const n={};return t.forEach(t=>{n[t]=e[t]}),n}var xP=["data","status","isLoading","isSuccess","isError","error"];function SP({api:e,moduleOptions:{batch:t,hooks:{useDispatch:n,useSelector:r,useStore:o},unstable__sideEffectsInRender:a,createSelector:i},serializeQueryArgs:s,context:l}){const c=a?e=>e():h.useEffect,u=e=>e.current?.unsubscribe?.(),d=l.endpointDefinitions;return{buildQueryHooks:function(r){const o=(e,t={})=>{const[n]=m(r,e,t);return y(n),h.useMemo(()=>({refetch:()=>function(e){if(!e.current)throw new Error(rE(38));return e.current.refetch()}(n)}),[n])},a=({refetchOnReconnect:o,refetchOnFocus:a,pollingInterval:i=0,skipPollingIfUnfocused:s=!1}={})=>{const{initiate:l}=e.endpoints[r],d=n(),[p,f]=h.useState(fP),m=h.useRef(void 0),g=mP({refetchOnReconnect:o,refetchOnFocus:a,pollingInterval:i,skipPollingIfUnfocused:s});c(()=>{const e=m.current?.subscriptionOptions;g!==e&&m.current?.updateSubscriptionOptions(g)},[g]);const y=h.useRef(g);c(()=>{y.current=g},[g]);const b=h.useCallback(function(e,n=!1){let r;return t(()=>{u(m),m.current=r=d(l(e,{subscriptionOptions:y.current,forceRefetch:!n})),f(e)}),r},[d,l]),v=h.useCallback(()=>{m.current?.queryCacheKey&&d(e.internalActions.removeQueryResult({queryCacheKey:m.current?.queryCacheKey}))},[d]);return h.useEffect(()=>()=>{u(m)},[]),h.useEffect(()=>{p===fP||m.current||b(p,!0)},[p,b]),h.useMemo(()=>[b,p,{reset:v}],[b,p,v])},i=g(r,p);return{useQueryState:i,useQuerySubscription:o,useLazyQuerySubscription:a,useLazyQuery(e){const[t,n,{reset:r}]=a(e),o=i(n,{...e,skip:n===fP}),s=h.useMemo(()=>({lastArg:n}),[n]);return h.useMemo(()=>[t,{...o,reset:r},s],[t,o,r,s])},useQuery(e,t){const n=o(e,t),r=i(e,{selectFromResult:e===UT||t?.skip?void 0:vP,...t}),a=wP(r,...xP);return h.useDebugValue(a),h.useMemo(()=>({...r,...n}),[r,n])}}},buildInfiniteQueryHooks:function(e){const n=(n,r={})=>{const[o,a,i,s]=m(e,n,r),l=h.useRef(s);c(()=>{l.current=s},[s]);const d=mP(r.refetchCachedPages),p=h.useCallback(function(e,n){let r;return t(()=>{u(o),o.current=r=a(i(e,{subscriptionOptions:l.current,direction:n}))}),r},[o,a,i]);y(o);const f=hP(r.skip?UT:n),g=h.useCallback(e=>{if(!o.current)throw new Error(rE(38));const t={refetchCachedPages:e?.refetchCachedPages??d};return o.current.refetch(t)},[o,d]);return h.useMemo(()=>({trigger:p,refetch:g,fetchNextPage:()=>p(f,"forward"),fetchPreviousPage:()=>p(f,"backward")}),[g,p,f])},r=g(e,f);return{useInfiniteQueryState:r,useInfiniteQuerySubscription:n,useInfiniteQuery(e,t){const{refetch:o,fetchNextPage:a,fetchPreviousPage:i}=n(e,t),s=r(e,{selectFromResult:e===UT||t?.skip?void 0:vP,...t}),l=wP(s,...xP,"hasNextPage","hasPreviousPage");return h.useDebugValue(l),h.useMemo(()=>({...s,fetchNextPage:a,fetchPreviousPage:i,refetch:o}),[s,a,i,o])}}},buildMutationHook:function(o){return({selectFromResult:a,fixedCacheKey:s}={})=>{const{select:l,initiate:c}=e.endpoints[o],u=n(),[d,p]=h.useState();h.useEffect(()=>()=>{d?.arg.fixedCacheKey||d?.reset()},[d]);const f=h.useCallback(function(e){const t=u(c(e,{fixedCacheKey:s}));return p(t),t},[u,c,s]),{requestId:m}=d||{},g=h.useMemo(()=>l({fixedCacheKey:s,requestId:d?.requestId}),[s,d,l]),y=h.useMemo(()=>a?i([g],a):g,[a,g]),b=r(y,Bi),v=null==s?d?.arg.originalArgs:void 0,w=h.useCallback(()=>{t(()=>{d&&p(void 0),s&&u(e.internalActions.removeMutationResult({requestId:m,fixedCacheKey:s}))})},[u,s,d,m]),x=wP(b,...xP,"endpointName");h.useDebugValue(x);const S=h.useMemo(()=>({...b,originalArgs:v,reset:w}),[b,v,w]);return h.useMemo(()=>[f,S],[f,S])}},usePrefetch:function(t,r){const o=n(),a=mP(r);return h.useCallback((n,r)=>o(e.util.prefetch(t,n,{...a,...r})),[t,o,a])}};function p(e,t,n){if(t?.endpointName&&e.isUninitialized){const{endpointName:e}=t,r=d[e];n!==UT&&s({queryArgs:t.originalArgs,endpointDefinition:r,endpointName:e})===s({queryArgs:n,endpointDefinition:r,endpointName:e})&&(t=void 0)}let r=e.isSuccess?e.data:t?.data;void 0===r&&(r=e.data);const o=void 0!==r,a=e.isLoading,i=(!t||t.isLoading||t.isUninitialized)&&!o&&a,l=e.isSuccess||o&&(a&&!t?.isError||e.isUninitialized);return{...e,data:r,currentData:e.data,isFetching:a,isLoading:i,isSuccess:l}}function f(e,t,n){if(t?.endpointName&&e.isUninitialized){const{endpointName:e}=t,r=d[e];n!==UT&&s({queryArgs:t.originalArgs,endpointDefinition:r,endpointName:e})===s({queryArgs:n,endpointDefinition:r,endpointName:e})&&(t=void 0)}let r=e.isSuccess?e.data:t?.data;void 0===r&&(r=e.data);const o=void 0!==r,a=e.isLoading,i=(!t||t.isLoading||t.isUninitialized)&&!o&&a,l=e.isSuccess||a&&o;return{...e,data:r,currentData:e.data,isFetching:a,isLoading:i,isSuccess:l}}function m(t,r,{refetchOnReconnect:o,refetchOnFocus:a,refetchOnMountOrArgChange:i,skip:s=!1,pollingInterval:l=0,skipPollingIfUnfocused:u=!1,...p}={}){const{initiate:f}=e.endpoints[t],m=n(),g=h.useRef(void 0);if(!g.current){const t=m(e.internalActions.internal_getRTKQSubscriptions());g.current=t}const y=hP(s?UT:r),b=mP({refetchOnReconnect:o,refetchOnFocus:a,pollingInterval:l,skipPollingIfUnfocused:u}),v=mP(p.initialPageParam),w=mP(p.refetchCachedPages),x=h.useRef(void 0);let{queryCacheKey:S,requestId:k}=x.current||{},C=!1;S&&k&&(C=g.current.isRequestSubscribed(S,k));const _=!C&&void 0!==x.current;return c(()=>{_&&(x.current=void 0)},[_]),c(()=>{const e=x.current;if(y===UT)return e?.unsubscribe(),void(x.current=void 0);const n=x.current?.subscriptionOptions;if(e&&e.arg===y)b!==n&&e.updateSubscriptionOptions(b);else{e?.unsubscribe();const n=m(f(y,{subscriptionOptions:b,forceRefetch:i,...dP(d[t])?{initialPageParam:v,refetchCachedPages:w}:{}}));x.current=n}},[m,f,i,y,b,_,v,w,t]),[x,m,f,b]}function g(t,n){return(a,{skip:s=!1,selectFromResult:l}={})=>{const{select:c}=e.endpoints[t],u=hP(s?UT:a),d=h.useRef(void 0),p=h.useMemo(()=>i([c(u),(e,t)=>t,e=>u],n,{memoizeOptions:{resultEqualityCheck:Bi}}),[c,u]),f=h.useMemo(()=>l?i([p],l,{devModeChecks:{identityFunctionCheck:"never"}}):p,[p,l]),m=r(e=>f(e,d.current),Bi),g=o(),y=p(g.getState(),d.current);return bP(()=>{d.current=y},[y]),m}}function y(e){h.useEffect(()=>()=>{u(e),e.current=void 0},[e])}}var kP=/* @__PURE__ */Symbol(),CP=/* @__PURE__ */YT(cP(),(({batch:e=ns,hooks:t={useDispatch:Ji,useSelector:ts,useStore:Xi},createSelector:n=b_,unstable__sideEffectsInRender:r=!1,...o}={})=>({name:kP,init(o,{serializeQueryArgs:a},i){const s=o,{buildQueryHooks:l,buildInfiniteQueryHooks:c,buildMutationHook:u,usePrefetch:d}=SP({api:o,moduleOptions:{batch:e,hooks:t,unstable__sideEffectsInRender:r,createSelector:n},serializeQueryArgs:a,context:i});return pP(s,{usePrefetch:d}),pP(i,{batch:e}),{injectEndpoint(e,t){if("query"===t.type){const{useQuery:t,useLazyQuery:n,useLazyQuerySubscription:r,useQueryState:a,useQuerySubscription:i}=l(e);pP(s.endpoints[e],{useQuery:t,useLazyQuery:n,useLazyQuerySubscription:r,useQueryState:a,useQuerySubscription:i}),o[`use${uP(e)}Query`]=t,o[`useLazy${uP(e)}Query`]=n}if(function(e){return"mutation"===e.type}(t)){const t=u(e);pP(s.endpoints[e],{useMutation:t}),o[`use${uP(e)}Mutation`]=t}else if(dP(t)){const{useInfiniteQuery:t,useInfiniteQuerySubscription:n,useInfiniteQueryState:r}=c(e);pP(s.endpoints[e],{useInfiniteQuery:t,useInfiniteQuerySubscription:n,useInfiniteQueryState:r}),o[`use${uP(e)}InfiniteQuery`]=t}}}}}))());const _P="https://api.crownpeak.net/dqm-cms/v1",EP=e=>({"Content-Type":"application/json","x-api-key":e}),AP=CP({reducerPath:"dqmApi",baseQuery:function({baseUrl:e,prepareHeaders:t=e=>e,fetchFn:n=cT,paramsSerializer:r,isJsonContentType:o=dT,jsonContentType:a="application/json",jsonReplacer:i,timeout:s,responseHandler:l,validateStatus:c,...u}={}){return"undefined"==typeof fetch&&n===cT&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),async(p,f,h)=>{const{getState:m,extra:g,endpoint:y,forced:b,type:v}=f;let w,{url:x,headers:S=new Headers(u.headers),params:k,responseHandler:C=l??"json",validateStatus:_=c??uT,timeout:E=s,...A}="string"==typeof p?{url:p}:p,T={...u,signal:E?lT(f.signal,sT(E)):f.signal,...A};S=new Headers(pT(S)),T.headers=await t(S,{getState:m,arg:p,extra:g,endpoint:y,forced:b,type:v,extraOptions:h})||S;const P="object"==typeof(R=T.body)&&(Qk(R)||Array.isArray(R)||"function"==typeof R.toJSON);var R;if(null==T.body||P||"string"==typeof T.body||T.headers.delete("content-type"),!T.headers.has("content-type")&&P&&T.headers.set("content-type",a),P&&o(T.headers)&&(T.body=JSON.stringify(T.body,i)),T.headers.has("accept")||("json"===C?T.headers.set("accept","application/json"):"text"===C&&T.headers.set("accept","text/plain, text/html, */*")),k){const e=~x.indexOf("?")?"&":"?";x+=e+(r?r(k):new URLSearchParams(pT(k)))}x=oT(e,x);const M=new Request(x,T);let I;w={request:new Request(x,T)};try{I=await n(M)}catch(z){return{error:{status:(z instanceof Error||"undefined"!=typeof DOMException&&z instanceof DOMException)&&"TimeoutError"===z.name?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(z)},meta:w}}const O=I.clone();let N;w.response=O;let L="";try{let e;if(await Promise.all([d(I,C).then(e=>N=e,t=>e=t),O.text().then(e=>L=e,()=>{})]),e)throw e}catch(z){return{error:{status:"PARSING_ERROR",originalStatus:I.status,data:L,error:String(z)},meta:w}}return _(I,N)?{data:N,meta:w}:{error:{status:I.status,data:N},meta:w}};async function d(e,t){if("function"==typeof t)return t(e);if("content-type"===t&&(t=o(e.headers)?"json":"text"),"json"===t){const t=await e.text();return t.length?JSON.parse(t):null}return e.text()}}({baseUrl:_P}),tagTypes:["Asset","Highlight"],endpoints:e=>({createAsset:e.mutation({query:({html:e,url:t,websiteId:n,apiKey:r,apiEndpoint:o})=>({url:`${o||_P}/assets`,method:"POST",headers:EP(r),body:{html:e,url:t||window.location.href,websiteId:n},params:{apiKey:r}}),invalidatesTags:["Asset"]}),getAsset:e.query({query:({assetId:e,websiteId:t,apiKey:n,apiEndpoint:r})=>({url:`${r||_P}/assets/${e}`,headers:EP(n),params:{websiteId:t,apiKey:n}}),transformResponse:e=>{const t=(e.checkpoints||[]).reduce((e,t)=>(e[t.category]||(e[t.category]=[]),e[t.category].push(t),e),{}),n=Object.keys(t);Object.entries(t).forEach(([e,t])=>{t.forEach(t=>{t.colors=jk(e,n)})});const r=Object.entries(t),o=e.totalCheckpoints>0?Math.round((e.totalCheckpoints-e.totalErrors)/e.totalCheckpoints*100):0;return{assetId:e.assetId,analysisState:e.analysisState,created:e.created,siteName:e.siteName,totalCheckpoints:e.totalCheckpoints,totalErrors:e.totalErrors,checkpoints:e.checkpoints||[],groupedCategories:r,qualityScore:o}},providesTags:(e,t,{assetId:n})=>[{type:"Asset",id:n}]}),getHighlight:e.query({query:({assetId:e,checkpointId:t,websiteId:n,apiKey:r,apiEndpoint:o})=>({url:`${o||_P}/assets/${e}/pagehighlight/${t}`,headers:EP(r),params:{websiteId:n,apiKey:r}}),transformResponse:(e,t,n)=>({html:e.html,checkpointId:n.checkpointId}),providesTags:(e,t,{assetId:n,checkpointId:r})=>[{type:"Highlight",id:`${n}-${r}`}]}),getAllHighlights:e.query({query:({assetId:e,websiteId:t,apiKey:n,apiEndpoint:r})=>({url:`${r||_P}/assets/${e}/pagehighlight/all`,headers:EP(n),params:{websiteId:t,apiKey:n}}),transformResponse:e=>({html:e.html}),providesTags:(e,t,{assetId:n})=>[{type:"Highlight",id:`${n}-all`}]}),getCheckpointHighlight:e.query({query:({assetId:e,checkpointId:t,websiteId:n,apiKey:r,apiEndpoint:o,highlightSource:a=!1})=>({url:`${o||_P}/assets/${e}/errors/${t}`,headers:EP(r),params:{websiteId:n,apiKey:r,highlightSource:a},responseHandler:"text"}),providesTags:(e,t,{assetId:n,checkpointId:r,highlightSource:o})=>[{type:"Highlight",id:`${n}-${r}-${o?"source":"browser"}`}]})})}),TP={state:"idle",assetId:null,data:null,error:null,isAnalyzing:!1,startedAt:null,completedAt:null},PP=tE({name:"analysis",initialState:TP,reducers:{startAnalysis:e=>{e.state="analyzing",e.isAnalyzing=!0,e.error=null,e.startedAt=Date.now(),e.completedAt=null},setAssetId:(e,t)=>{e.assetId=t.payload},analysisCompleted:(e,t)=>{e.state="completed",e.isAnalyzing=!1,e.data=t.payload,e.completedAt=Date.now()},analysisFailed:(e,t)=>{e.state="error",e.isAnalyzing=!1,e.error=t.payload,e.completedAt=Date.now()},resetAnalysis:e=>{Object.assign(e,TP)},updateAnalysisState:(e,t)=>{e.state=t.payload,"completed"!==t.payload&&"error"!==t.payload||(e.isAnalyzing=!1,e.completedAt=Date.now())}}}),{startAnalysis:RP,setAssetId:MP,analysisCompleted:IP,analysisFailed:OP,resetAnalysis:NP,updateAnalysisState:LP}=PP.actions,zP={selectedCheckpoint:null,selectedCheckpointId:null,viewMode:"browser",showAllHighlights:!1,currentHighlightIndex:0,totalHighlights:0,visibleHighlightIndex:0,cache:{},scrollPositions:{},isModalOpen:!1,isLoading:!1,error:null,highlightedContent:"",scriptsDisabled:!0,hasAutoScrolled:!1,clickedIndicator:0,currentAssetId:null},$P=tE({name:"highlight",initialState:zP,reducers:{selectCheckpoint:(e,t)=>{e.selectedCheckpoint=t.payload,e.selectedCheckpointId=t.payload?.id||null,e.currentHighlightIndex=0,e.visibleHighlightIndex=0,e.hasAutoScrolled=!1,t.payload&&(e.isModalOpen=!0)},setSelectedCheckpointId:(e,t)=>{e.selectedCheckpointId=t.payload,t.payload||(e.selectedCheckpoint=null)},setViewMode:(e,t)=>{e.viewMode=t.payload},toggleShowAllHighlights:e=>{e.showAllHighlights=!e.showAllHighlights,e.selectedCheckpoint=null},setShowAllHighlights:(e,t)=>{e.showAllHighlights=t.payload,t.payload&&(e.selectedCheckpoint=null)},setCurrentHighlightIndex:(e,t)=>{e.currentHighlightIndex=t.payload},nextHighlight:e=>{e.currentHighlightIndex<e.totalHighlights-1&&(e.currentHighlightIndex+=1)},previousHighlight:e=>{e.currentHighlightIndex>0&&(e.currentHighlightIndex-=1)},setTotalHighlights:(e,t)=>{e.totalHighlights=t.payload},setVisibleHighlightIndex:(e,t)=>{e.visibleHighlightIndex=t.payload},cacheHighlight:(e,t)=>{const{checkpointId:n,content:r,type:o}=t.payload;e.cache[n]||(e.cache[n]={timestamp:Date.now()}),e.cache[n][o]=r,e.cache[n].timestamp=Date.now()},clearExpiredCache:e=>{const t=Date.now();Object.keys(e.cache).forEach(n=>{t-e.cache[n].timestamp>3e5&&delete e.cache[n]})},clearCache:e=>{e.cache={}},saveScrollPosition:(e,t)=>{const{checkpointId:n,position:r}=t.payload;e.scrollPositions[n]||(e.scrollPositions[n]={browser:0,source:0}),void 0!==r.browser&&(e.scrollPositions[n].browser=r.browser),void 0!==r.source&&(e.scrollPositions[n].source=r.source)},openModal:e=>{e.isModalOpen=!0},closeModal:e=>{e.isModalOpen=!1,e.selectedCheckpoint=null,e.selectedCheckpointId=null,e.showAllHighlights=!1,e.hasAutoScrolled=!1,e.totalHighlights=0,e.currentHighlightIndex=0,e.highlightedContent=""},setHighlightedContent:(e,t)=>{e.highlightedContent=t.payload},toggleScripts:e=>{e.scriptsDisabled=!e.scriptsDisabled},setScriptsDisabled:(e,t)=>{e.scriptsDisabled=t.payload},setHasAutoScrolled:(e,t)=>{e.hasAutoScrolled=t.payload},incrementClickIndicator:e=>{e.clickedIndicator+=1},setCurrentAssetId:(e,t)=>{e.currentAssetId=t.payload},navigateHighlight:(e,t)=>{if(0===e.totalHighlights)return;let n=(e.visibleHighlightIndex||e.currentHighlightIndex)-1;"next"===t.payload?n=(n+1)%e.totalHighlights:(n-=1,n<0&&(n=e.totalHighlights-1)),e.currentHighlightIndex=n+1,e.visibleHighlightIndex=0,e.clickedIndicator+=1},setLoading:(e,t)=>{e.isLoading=t.payload},setError:(e,t)=>{e.error=t.payload,e.isLoading=!1},resetHighlight:e=>{Object.assign(e,zP)}}}),{selectCheckpoint:DP,setSelectedCheckpointId:jP,setViewMode:FP,toggleShowAllHighlights:BP,setShowAllHighlights:qP,setCurrentHighlightIndex:WP,nextHighlight:HP,previousHighlight:UP,setTotalHighlights:VP,setVisibleHighlightIndex:KP,cacheHighlight:QP,clearExpiredCache:GP,clearCache:XP,saveScrollPosition:YP,openModal:JP,closeModal:ZP,setLoading:eR,setError:tR,resetHighlight:nR,setHighlightedContent:rR,toggleScripts:oR,setScriptsDisabled:aR,setHasAutoScrolled:iR,incrementClickIndicator:sR,setCurrentAssetId:lR,navigateHighlight:cR}=$P.actions,uR={apiKey:null,websiteId:null,isAuthenticated:!1,sessionType:null,sessionToken:null,accessToken:null,refreshToken:null,rememberMe:!1,isLoading:!1,error:null,storageWarningAcknowledged:!1},dR="dqm_apiKey",pR="dqm_websiteID",fR="dqm_sessionToken",hR="dqm_sessionType",mR=G_("auth/initialize",async(e,{dispatch:t})=>{if(!0===e?.disabled)return{isAuthenticated:!1,error:"DQM is disabled"};if(e?.apiKey&&e?.websiteId)return{apiKey:e.apiKey,websiteId:e.websiteId,sessionType:"direct",isAuthenticated:!0};if("undefined"!=typeof window&&!1!==e?.useLocalStorage){if("backend"===oE("dqm_sessionType")){const e=oE("dqm_sessionToken");if(e)return ig.debug("Restoring backend session from localStorage"),{accessToken:e,sessionType:"backend",isAuthenticated:!0}}const e=oE("dqm_apiKey"),t=oE("dqm_websiteID");if(e&&t)return ig.debug("Restoring direct credentials from localStorage"),{apiKey:e,websiteId:t,sessionType:"direct",isAuthenticated:!0}}return e?.authBackendUrl?{isAuthenticated:!1}:{isAuthenticated:!1,error:"DQM not configured"}}),gR=G_("auth/loginWithCredentials",async(e,{rejectWithValue:t})=>{try{if("direct"===e.sessionType&&!/^[\x00-\x7F]*$/.test(e.apiKey))throw new Error("API key contains non-ASCII characters");return!1!==e.rememberMe&&"undefined"!=typeof window&&("backend"===e.sessionType&&e.sessionToken?(aE(fR,e.sessionToken),aE(hR,"backend")):(aE(dR,e.apiKey),aE(pR,e.websiteId),aE(hR,"direct"))),e}catch(n){return t(n instanceof Error?n.message:"Login failed")}}),yR=G_("auth/logout",async(e=!0)=>(e&&"undefined"!=typeof window&&(iE(dR),iE(pR),iE(fR),iE(hR),ig.debug("Cleared localStorage on logout")),!0)),bR=tE({name:"auth",initialState:uR,reducers:{setApiKey:(e,t)=>{e.apiKey=t.payload,e.isAuthenticated=!(!t.payload||!e.websiteId),t.payload&&(e.sessionType="direct")},setWebsiteId:(e,t)=>{e.websiteId=t.payload,e.isAuthenticated=!(!e.apiKey||!t.payload)},setCredentials:(e,t)=>{e.apiKey=t.payload.apiKey,e.websiteId=t.payload.websiteId,e.isAuthenticated=!0,e.sessionType="direct",void 0!==t.payload.rememberMe&&(e.rememberMe=t.payload.rememberMe)},setSessionToken:(e,t)=>{e.accessToken=t.payload.accessToken,e.sessionType="backend",e.isAuthenticated=!0},setRememberMe:(e,t)=>{e.rememberMe=t.payload},acknowledgeStorageWarning:e=>{e.storageWarningAcknowledged=!0},setAuthLoading:(e,t)=>{e.isLoading=t.payload},setAuthError:(e,t)=>{e.error=t.payload,e.isLoading=!1},logout:e=>{e.apiKey=null,e.websiteId=null,e.accessToken=null,e.refreshToken=null,e.isAuthenticated=!1,e.sessionType=null,e.error=null},resetAuth:()=>uR,hydrateFromStorage:(e,t)=>{t.payload.apiKey&&(e.apiKey=t.payload.apiKey),t.payload.websiteId&&(e.websiteId=t.payload.websiteId),void 0!==t.payload.rememberMe&&(e.rememberMe=t.payload.rememberMe),void 0!==t.payload.storageWarningAcknowledged&&(e.storageWarningAcknowledged=t.payload.storageWarningAcknowledged),e.isAuthenticated=!(!e.apiKey||!e.websiteId),e.isAuthenticated&&(e.sessionType="direct")}},extraReducers:e=>{e.addCase(mR.pending,e=>{e.isLoading=!0,e.error=null}).addCase(mR.fulfilled,(e,t)=>{e.isLoading=!1,t.payload.apiKey&&(e.apiKey=t.payload.apiKey),t.payload.websiteId&&(e.websiteId=t.payload.websiteId),t.payload.accessToken&&(e.accessToken=t.payload.accessToken),t.payload.sessionType&&(e.sessionType=t.payload.sessionType),void 0!==t.payload.isAuthenticated&&(e.isAuthenticated=t.payload.isAuthenticated),t.payload.error&&(e.error=t.payload.error)}).addCase(mR.rejected,(e,t)=>{e.isLoading=!1,e.error=t.error.message||"Authentication initialization failed"}),e.addCase(gR.pending,e=>{e.isLoading=!0,e.error=null}).addCase(gR.fulfilled,(e,t)=>{e.isLoading=!1,e.apiKey=t.payload.apiKey,e.websiteId=t.payload.websiteId,e.sessionType=t.payload.sessionType,e.isAuthenticated=!0,t.payload.sessionToken&&(e.accessToken=t.payload.sessionToken),void 0!==t.payload.rememberMe&&(e.rememberMe=t.payload.rememberMe)}).addCase(gR.rejected,(e,t)=>{e.isLoading=!1,e.error=t.payload||"Login failed"}),e.addCase(yR.fulfilled,e=>{e.apiKey=null,e.websiteId=null,e.accessToken=null,e.refreshToken=null,e.isAuthenticated=!1,e.sessionType=null,e.error=null})}}),{setApiKey:vR,setWebsiteId:wR,setCredentials:xR,setSessionToken:SR,setRememberMe:kR,acknowledgeStorageWarning:CR,setAuthLoading:_R,setAuthError:ER,logout:AR,resetAuth:TR,hydrateFromStorage:PR}=bR.actions,RR={settings:{provider:"none",openaiApiKey:null,openaiModel:"gpt-4.1-mini",enabled:!1,translationProvider:"none"},summaries:{},isSettingsOpen:!1,isGenerating:!1,generatingFor:null,error:null},MR=tE({name:"ai",initialState:RR,reducers:{updateSettings:(e,t)=>{e.settings={...e.settings,...t.payload},t.payload.provider&&"none"!==t.payload.provider&&(e.settings.enabled=!0)},setProvider:(e,t)=>{e.settings.provider=t.payload,e.settings.enabled="none"!==t.payload},setOpenAIApiKey:(e,t)=>{e.settings.openaiApiKey=t.payload},setOpenAIModel:(e,t)=>{e.settings.openaiModel=t.payload},setTranslationProvider:(e,t)=>{e.settings.translationProvider=t.payload},openSettings:e=>{e.isSettingsOpen=!0},closeSettings:e=>{e.isSettingsOpen=!1},toggleSettings:e=>{e.isSettingsOpen=!e.isSettingsOpen},startGeneration:(e,t)=>{e.isGenerating=!0,e.generatingFor=t.payload,e.error=null},generationCompleted:(e,t)=>{e.isGenerating=!1,e.generatingFor=null,e.summaries[t.payload.checkpointId]={checkpointId:t.payload.checkpointId,summary:t.payload.summary,generatedAt:Date.now(),provider:t.payload.provider}},generationFailed:(e,t)=>{e.isGenerating=!1,e.generatingFor=null,e.error=t.payload},clearError:e=>{e.error=null},clearSummaries:e=>{e.summaries={}},clearSummary:(e,t)=>{delete e.summaries[t.payload]},resetAI:()=>RR,hydrateSettings:(e,t)=>{t.payload.provider&&(e.settings.provider=t.payload.provider,e.settings.enabled="none"!==t.payload.provider),void 0!==t.payload.openaiApiKey&&(e.settings.openaiApiKey=t.payload.openaiApiKey),t.payload.openaiModel&&(e.settings.openaiModel=t.payload.openaiModel),t.payload.translationProvider&&(e.settings.translationProvider=t.payload.translationProvider)}}}),{updateSettings:IR,setProvider:OR,setOpenAIApiKey:NR,setOpenAIModel:LR,setTranslationProvider:zR,openSettings:$R,closeSettings:DR,toggleSettings:jR,startGeneration:FR,generationCompleted:BR,generationFailed:qR,clearError:WR,clearSummaries:HR,clearSummary:UR,resetAI:VR,hydrateSettings:KR}=MR.actions,QR=function(e){const t=function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:o=!0}=e??{};let a=new __;return t&&("boolean"==typeof t?a.push(x_):a.push(S_(t.extraArgument))),a},{reducer:n,middleware:r,devTools:o=!0,preloadedState:a,enhancers:i}=e||{};let s,l;if("function"==typeof n)s=n;else{if(!Qk(n))throw new Error(rE(1));s=Xk(n)}l="function"==typeof r?r(t):t();let c=Yk;o&&(c=k_({trace:!1,..."object"==typeof o&&o}));const u=function(...e){return t=>(n,r)=>{const o=t(n,r);let a=()=>{throw new Error(Hk(15))};const i={getState:o.getState,dispatch:(e,...t)=>a(e,...t)},s=e.map(e=>e(i));return a=Yk(...s)(o.dispatch),{...o,dispatch:a}}}(...l),d=M_(u);return Gk(s,a,c(..."function"==typeof i?i(d):d()))}({reducer:{locale:dA,analysis:PP.reducer,highlight:$P.reducer,auth:bR.reducer,ai:MR.reducer,[AP.reducerPath]:AP.reducer},middleware:e=>e().concat(AP.middleware)}),GR=({open:e,onClose:t,onOpen:n,config:r,onAuthSuccess:o,onAuthError:a,debugHtml:i})=>{const{t:s,i18n:l}=Ai(["sidebar","auth","common"]),c=Ji(),[u,d]=h.useState("idle"),[p,f]=h.useState(null),[g,y]=h.useState(null),[b,v]=h.useState(null),[w,x]=h.useState(null),S=m.useRef(null),[k,C]=h.useState(null),_=m.useRef(null),[E,A]=h.useState([]),[T,P]=h.useState(null),[R,M]=h.useState(!1),[I,O]=h.useState(null),[N,L]=h.useState(null),[z,$]=h.useState("direct"),[D,j]=h.useState(""),[F,B]=h.useState(null),[q,W]=h.useState(null),[H,U]=h.useState(!1),[V,K]=h.useState("browser"),[Q,G]=h.useState(!1),[X,Y]=h.useState(!1),[J,Z]=h.useState(0),[ee,te]=m.useState(()=>"undefined"==typeof window||"false"!==oE("dqm_quality_breakdown_expanded")),[ne,re]=h.useState(/* @__PURE__ */new Set),[oe,ae]=h.useState({}),[ie,se]=h.useState(0),[le,ce]=h.useState(0),[ue,de]=h.useState(0),[pe,fe]=h.useState(!0),[he,me]=h.useState(!1),ge=m.useRef(null),ye=(()=>{const e=h.useContext(vA);if(!e)throw new Error("useAI must be used within an AIProvider");return e})(),{translationEnabled:be,setTranslationEnabled:ve,translationMode:we,setTranslationMode:xe,summaryEnabled:Se,setSummaryEnabled:ke,openAiApiKey:Ce,setOpenAiApiKey:_e,openAiModel:Ee,setOpenAiModel:Ae,openAiBaseUrl:Te,setOpenAiBaseUrl:Pe,targetLang:Re,translationNeeded:Me,aiEnabled:Ie,effectiveModelId:Oe,computeBudgetMs:Ne}=ye,Le=(()=>{const e=h.useMemo(()=>PA(),[]),t=h.useMemo(()=>/* @__PURE__ */new Map,[]),[n,r]=h.useState(null),o=h.useCallback(async()=>{if("undefined"!=typeof navigator&&navigator.storage?.persisted)try{const e=await navigator.storage.persisted();r("boolean"==typeof e?e:null)}catch{r(null)}else r(null)},[]),a=h.useCallback(async()=>{await e.clearAll(),t.clear()},[t,e]),i=h.useCallback(()=>{t.clear()},[t]);return{cache:e,assetCache:t,storagePersisted:n,refreshStorageState:o,clearAll:a,clearAssetCache:i}})(),{cache:ze,clearAll:$e,clearAssetCache:De}=Le,je=RA({enabled:Ie,openAiApiKey:Ce,openAiModel:Ee,openAiBaseUrl:Te}),{state:Fe,isReady:Be}=je,qe=(e=>{const{engine:t,originalData:n,targetLang:r,modelId:o,enabled:a,timeoutMs:i=45e3,translationInProgress:s=!1,cache:l}=e,{t:c}=Ai("sidebar"),[u,d]=h.useState("idle"),[p,f]=h.useState(null),[m,g]=h.useState(null),[y,b]=h.useState(0),[v,w]=h.useState(null),x=h.useRef(/* @__PURE__ */new Map),S=h.useRef(null),k=h.useRef(r),C=h.useRef(!1),_=h.useRef(null),E=h.useRef(t),A=h.useRef(n),T=h.useRef(r),P=h.useRef(o),R=h.useRef(a),M=h.useRef(i),I=h.useRef(s),O=h.useRef(l),N=h.useRef(c);h.useEffect(()=>{E.current=t,A.current=n,T.current=r,P.current=o,R.current=a,M.current=i,I.current=s,O.current=l,N.current=c});const L=h.useCallback(()=>{S.current?.abort(),S.current=null,C.current=!1,_.current=null,x.current.clear(),g(null),f(null),w(null),d("idle"),b(e=>e+1)},[]),z=n?.assetId??null;return h.useEffect(()=>{k.current!==r&&(k.current=r,_.current=null,f(null),g(null),w(null),d("idle"))},[r]),h.useEffect(()=>{y>0&&(_.current=null)},[y]),h.useEffect(()=>{const e=`${z}:${r}:${o}`;if(!R.current)return void d("idle");if(!z)return;if(I.current)return;if(C.current)return;if(_.current===e)return;if(!E.current.isReady||!E.current.client)return;const t=A.current;if(!t)return;const n=(()=>{const e=(t.checkpoints||[]).filter(e=>e.failed).map(e=>({id:e.id??"",name:e.name??"",description:e.description??"",category:e.category??"",topics:[...e.topics??[]].sort()})).sort((e,t)=>{const n=`${e.id}|${e.category}|${e.name}|${e.description}`,r=`${t.id}|${t.category}|${t.name}|${t.description}`;return n.localeCompare(r)});return _A(JSON.stringify({modelId:P.current,targetLang:T.current,site:t.siteName??"",totalErrors:t.totalErrors??0,failed:e}))})();if(n&&x.current.has(n)){const t=x.current.get(n);return f(t.bullets),w(t.stats),d("ready"),void(_.current=e)}_.current=e,C.current=!0,S.current?.abort();const a=new AbortController;S.current=a,d("generating"),g(null),f(null),w(null);const i=window.setTimeout(()=>{a.abort(),C.current&&(d("error"),g(N.current("summary_timeout")),C.current=!1)},M.current),s=Date.now();ig.debug("Summary: start (once)");const l=E.current.client;return(0,E.current.runWithLock)(async()=>{if(l.reset)try{await l.reset(!0)}catch{}return BA({client:l,data:t,targetLanguage:T.current,modelId:P.current,cache:O.current,signal:a.signal})}).then(e=>{a.signal.aborted||(ig.debug("Summary: ready in",Date.now()-s,"ms"),f(e.bullets),w(e.stats??null),n&&x.current.set(n,{bullets:e.bullets,stats:e.stats??null}),d("ready"))}).catch(e=>{if(a.signal.aborted)return;ig.error("Summary: failed",e),d("error"),g(e instanceof Error?e.message:String(e));const t=e?.stats;t&&w(t)}).finally(()=>{window.clearTimeout(i),C.current=!1}),()=>{a.abort(),window.clearTimeout(i)}},[z,r,o,y]),{state:u,bullets:p,error:m,stats:v,restart:L}})({engine:RA({enabled:Se,openAiApiKey:Ce,openAiModel:Ee,openAiBaseUrl:Te}),originalData:g,targetLang:Re,modelId:Oe,enabled:Se,timeoutMs:r?.summary?.timeoutMs??45e3,cache:ze}),{state:We,bullets:He,error:Ue,stats:Ve,restart:Ke}=qe,Qe=Se&&("generating"===We||"idle"===We),Ge=(e=>{const{engine:t,cacheManager:n,originalData:r,targetLang:o,modelId:a,enabled:i,mode:s,computeBudgetMs:l,persistentCache:c,summaryGenerating:u=!1}=e,{t:d}=Ai("sidebar"),[p,f]=h.useState(null),[m,g]=h.useState(null),[y,b]=h.useState(null),[v,w]=h.useState(/* @__PURE__ */new Set),[x,S]=h.useState(/* @__PURE__ */new Set),[k,C]=h.useState(0),_=h.useRef(null),E=h.useRef(null),A=h.useRef(!1),T=h.useRef(null),P=h.useRef(u),R=h.useRef(void 0),M=h.useRef(t),I=h.useRef(n),O=h.useRef(r),N=h.useRef(o),L=h.useRef(a),z=h.useRef(i),$=h.useRef(s),D=h.useRef(l),j=h.useRef(c),F=h.useRef(u),B=h.useRef(d);h.useEffect(()=>{M.current=t,I.current=n,O.current=r,N.current=o,L.current=a,z.current=i,$.current=s,D.current=l,j.current=c,F.current=u,B.current=d});const q=r?.assetId??null,W="en"!==o,H=v.size>0,U=t.isReady;h.useEffect(()=>{P.current&&!u&&(ig.debug("Translation: summary finished, resetting hasRunForKeyRef for retry"),E.current=null),P.current=u},[u]);const V=h.useCallback(()=>{_.current?.abort(),_.current=null},[]),K=h.useCallback(()=>{f(O.current),w(/* @__PURE__ */new Set),S(/* @__PURE__ */new Set)},[]),Q=h.useCallback(()=>{const e=O.current;return e?`${e.assetId}:${N.current}:${L.current}`:""},[]),G=h.useCallback(()=>{if(!O.current)return;if("en"===N.current)return b(B.current("translation_not_needed")),void K();const e=Q();I.current.assetCache.delete(e),E.current=null,A.current=!1,K(),V(),b(null),g(null),f(null),w(/* @__PURE__ */new Set),S(/* @__PURE__ */new Set),C(e=>e+1)},[Q,K,V]),X=h.useCallback(async e=>{const t=O.current;if(!t)return;if(!z.current)return;const n=t.checkpoints.find(t=>t.id===e);if(!n)return;const r=Q();I.current.assetCache.delete(r),S(t=>{const n=new Set(t);return n.delete(e),n}),w(t=>{const n=new Set(t);return n.delete(e),n});try{const e=AA(n),t=EA(L.current,N.current,e);await j.current.deleteCheckpointMany([t])}catch{}E.current=null,C(e=>e+1)},[Q]);return h.useEffect(()=>{const e=`${q}:${o}:${a}:${s}`;if(T.current&&(clearTimeout(T.current),T.current=null),!i)return f(null),g(null),b(null),w(/* @__PURE__ */new Set),void S(/* @__PURE__ */new Set);if(!q)return;if(u)return void ig.debug("Translation: waiting for summary to complete");if(!W)return g(null),b(B.current("translation_not_needed")),void f(O.current);if(A.current)return;if(E.current===e)return;if(!U||!M.current.client)return void ig.debug("Translation: engine not ready yet");if(!O.current)return;const t=Q(),n=I.current.assetCache.get(t);return n?(b(null),g({translatedCheckpoints:n.checkpoints.length,totalCheckpoints:n.checkpoints.length,isPartial:!1}),f(n),void(E.current=e)):(ig.debug("Translation: scheduling with 300ms debounce"),T.current=setTimeout(()=>{if(T.current=null,!z.current)return void ig.debug("Translation: cancelled after debounce - disabled");if(F.current)return void ig.debug("Translation: cancelled after debounce - summary running");if(A.current)return void ig.debug("Translation: cancelled after debounce - already running");if(E.current===e)return void ig.debug("Translation: cancelled after debounce - already ran for key");if(!M.current.isReady||!M.current.client)return void ig.debug("Translation: cancelled after debounce - engine not ready");const n=O.current;if(!n)return;E.current=e,A.current=!0,V();const r=new AbortController;_.current=r,w(/* @__PURE__ */new Set),S(/* @__PURE__ */new Set),b(null),g(null),ig.debug("Translation: starting API call");const o=M.current.client;(0,M.current.runWithLock)(async()=>qA({client:o,data:n,targetLanguage:N.current,modelId:L.current,maxConcurrentBatches:3,maxItemsPerBatch:12,forceSerial:!1,cache:j.current,computeBudgetMs:D.current,signal:r.signal,onProgress:e=>g(e),onBatchStatus:()=>{},onPartialResult:()=>{}})).then(({data:e,progress:n})=>{r.signal.aborted||(ig.debug("Translation: done"),I.current.assetCache.set(t,e),f(e),n.isPartial&&b("full"===$.current?B.current("translation_incomplete"):B.current("translation_partial")),w(/* @__PURE__ */new Set),S(/* @__PURE__ */new Set))}).catch(e=>{r.signal.aborted||(ig.error("Translation: failed",e),b(e instanceof Error?e.message:String(e)),f(n),w(/* @__PURE__ */new Set),S(/* @__PURE__ */new Set))}).finally(()=>{A.current=!1})},300),()=>{T.current&&(clearTimeout(T.current),T.current=null),_.current?.abort()})},[q,o,a,s,i,W,k,Q,V,u,U]),{translatedData:p,progress:m,error:y,translatingIds:v,translatedIds:x,isTranslating:H,restart:G,stop:V,retrySingleCheckpoint:X,resetToOriginal:K,onDataChange:R.current}})({engine:je,cacheManager:Le,originalData:g,targetLang:Re,modelId:Oe,enabled:be&&Me,mode:we,computeBudgetMs:Ne,persistentCache:ze,summaryGenerating:Qe}),{translatedData:Xe,progress:Ye,restart:Je,stop:Ze}=Ge,et=m.useMemo(()=>be?"initializing"===Fe?"initializing":"error"===Fe?"error":Ye&&Ye.translatedCheckpoints<Ye.totalCheckpoints?"translating":Be?"ready":"initializing":"disabled",[be,Fe,Ye,Be]),[tt,at]=h.useState(Se),it=h.useRef(Qe);h.useEffect(()=>{Qe&&Ze()},[Qe,Ze]),h.useEffect(()=>{it.current&&!Qe&&(ig.debug("DQMSidebar: summary finished, restarting translation"),Je()),it.current=Qe},[Qe,Je]);const st="error"===Fe?"AI engine failed to initialize":null,lt=m.useMemo(()=>Ee.trim()||"gpt-4.1-mini",[Ee]);h.useEffect(()=>{be&&Me&&Xe?f(Xe):!g||be&&Me||f(g)},[Xe,be,Me,g]);const ct=h.useCallback(e=>{S.current=e,x(e)},[]),ut=m.useRef(!1),dt=m.useRef("browser"),pt=(e=>{const{selector:t,validateIframe:n=!0,pollMs:r=1e3,manualOffset:o}=e||{},a=null!=t&&""!==t,i=m.useCallback(e=>!!e&&(!n||"iframe"!==e.tagName.toLowerCase()||!!e.contentWindow),[n]),s=bA(a?t:"__disabled__",a?{check:i,pollMs:r}:{pollMs:0});if(!a)return{present:!1,height:0,width:0,position:null,contentOffset:{top:0,bottom:0,left:0,right:0},isManualOffset:!1};if(!s.present)return{present:!1,height:0,width:0,position:null,contentOffset:{top:0,bottom:0,left:0,right:0},isManualOffset:!1};if(o){const e={top:0,bottom:0,left:0,right:0};return e[o.position]=o.pixels,{present:!0,height:"top"===o.position||"bottom"===o.position?o.pixels:0,width:"left"===o.position||"right"===o.position?o.pixels:0,position:o.position,contentOffset:e,isManualOffset:!0}}return{present:s.present,height:s.rect?.height??0,width:s.rect?.width??0,position:s.position,contentOffset:s.contentOffset,isManualOffset:!1}})(r?.overlayConfig),ft=!0===r?.disableLogout,ht=h.useRef(r);ht.current=r;const mt=h.useRef(!1);h.useEffect(()=>{"true"===new URLSearchParams(window?.location?.search).get("dqm")&&n()},[]),h.useEffect(()=>{if(mt.current)return;mt.current=!0;const e=ht.current;if(!0===e?.disabled)return M(!1),P(s("sidebar:dqm_disabled")),d("idle"),void c(ER(s("sidebar:dqm_disabled")));if(e?.apiKey&&e?.websiteId)return O({apiKey:e.apiKey,websiteId:e.websiteId}),$("direct"),L(null),M(!0),void c(xR({apiKey:e.apiKey,websiteId:e.websiteId}));if("undefined"!=typeof window&&!1!==e?.useLocalStorage){if("backend"===oE("dqm_sessionType")){const e=oE("dqm_sessionToken");if(e)return ig.debug("Restoring backend session from localStorage"),L(e),$("backend"),O({apiKey:"BACKEND_SESSION",websiteId:"BACKEND_SESSION"}),M(!0),void c(SR({accessToken:e}))}const e=oE("dqm_apiKey"),t=oE("dqm_websiteID");if(e&&t)return ig.debug("Restoring direct credentials from localStorage"),O({apiKey:e,websiteId:t}),$("direct"),L(null),M(!0),void c(xR({apiKey:e,websiteId:t}))}if(e?.authBackendUrl)return M(!1),void d("idle");M(!1),P(s("sidebar:dqm_not_configured")),d("idle"),c(ER(s("sidebar:dqm_not_configured")))},[]);const gt=h.useCallback(e=>{O({apiKey:e.apiKey,websiteId:e.websiteId}),L(e.sessionToken||null),$(e.sessionType),M(!0),P(null),c(xR({apiKey:e.apiKey,websiteId:e.websiteId})),e.sessionToken&&c(SR({accessToken:e.sessionToken})),o&&o(e)},[o,c]),yt=h.useCallback(e=>{ig.error("Authentication error:",e),P(e.message),M(!1),c(ER(e.message)),a&&a(e)},[a,c]),bt=h.useCallback(()=>{O(null),L(null),$("direct"),M(!1),c(AR()),"undefined"!=typeof window&&!1!==r?.useLocalStorage&&(iE("dqm_apiKey"),iE("dqm_websiteID"),iE("dqm_sessionToken"),iE("dqm_sessionType"),ig.debug("Cleared localStorage on logout")),d("idle"),f(null),v(null),ct(null),_.current&&(clearInterval(_.current),_.current=null),C(null),ig.debug("User logged out")},[r?.useLocalStorage,ct,c]),vt=h.useCallback(e=>{if(0===ie)return;let t=(ue||le)-1;"next"===e?t=(t+1)%ie:(t-=1,t<0&&(t=ie-1)),ce(t+1),c(WP(t+1)),de(0),c(KP(0)),Z(e=>e+1),c(sR())},[le,ue,ie,c]),wt=h.useCallback(()=>{G(!1),c(ZP())},[c]);h.useEffect(()=>{Q||(se(0),ce(0),ut.current=!1)},[Q]),h.useEffect(()=>{ie>0&&0===le&&(ig.debug("Auto-setting currentHighlight to 1 (total highlights:",ie,")"),ce(1))},[ie,le]),h.useEffect(()=>{try{window.parent?.postMessage({type:"DQM_DRAWER_STATE",payload:{open:e}},"*")}catch{}},[e]);const xt=h.useCallback(e=>{ig.error("API authentication error:",e),M(!1),P("Authentication required. Please refresh the page.")},[]),St=h.useCallback(()=>"backend"===z&&r?.authBackendUrl?r.authBackendUrl:"https://api.crownpeak.net/dqm-cms/v1",[z,r?.authBackendUrl]),kt=h.useCallback(()=>{const e={"Content-Type":"application/json"};if("backend"===z){const t=N||oE("dqm_sessionToken");t&&(e.Authorization=`Bearer ${t}`)}else{const t=I?.apiKey||oE("dqm_apiKey");t&&(e["x-api-key"]=t)}return e},[z,N,I]),Ct=e=>{if(!/^[\x00-\x7F]*$/.test(e))throw new Error("API key contains non-ASCII characters and cannot be used in HTTP headers")},_t=h.useCallback(async(e,t=0)=>{ig.debug("Polling analysis status, attempt",t+1,"for assetId:",e);try{const t=St(),r=kt();let o;if("backend"===z)o=`${t}/dqm/assets/${e}/status`,ig.debug("Polling backend:",o);else{const r=I?.apiKey||oE("dqm_apiKey");if(!r)throw new Error("DQM API key not available for polling");try{Ct(r)}catch(n){throw new Error(`Invalid API key: ${n instanceof Error?n.message:"encoding error"}`)}const a=encodeURIComponent(r);o=`${t}/assets/${e}/status?apiKey=${a}`,ig.debug("Polling direct:",o)}const a=(await pb.get(o,{headers:r,timeout:1e4})).data,i=a.checkpoints&&Array.isArray(a.checkpoints);if(i&&void 0!==a.totalCheckpoints&&a.checkpoints.length===a.totalCheckpoints){_.current&&(clearInterval(_.current),_.current=null),C(null);const e={assetId:a.assetId||a.id,created:a.created,siteName:a.siteName,totalCheckpoints:a.totalCheckpoints,totalErrors:a.totalErrors,checkpoints:a.checkpoints||[]};y(e),f(e),De(),A(Object.entries(Pt(a.checkpoints||[]))),d("completed"),ct(null),ig.debug("Analysis completed:",a.checkpoints.length,"/",a.totalCheckpoints,"checkpoints")}else if("failed"===a.status||"error"===a.status)_.current&&(clearInterval(_.current),_.current=null),C(null),v(a.error||a.message||"Analysis failed with unknown error"),A([]),d("error"),ct(null),ig.debug("Analysis failed:",a.error||a.message);else{const e=i?a.checkpoints.length:0,t=a.totalCheckpoints||"?";ig.debug("Analysis in progress:",e,"/",t,"checkpoints"),b&&v(null)}}catch(r){if(ig.error("Polling failed:",r),pb.isAxiosError(r)&&401===r.response?.status)return void xt(r);if(t<30){const n=Math.min(2e3*Math.pow(1.5,t),1e4);setTimeout(()=>_t(e,t+1),n)}else _.current&&(clearInterval(_.current),_.current=null),C(null),v("Analysis polling failed after maximum attempts"),A([]),d("error"),ct(null)}},[St,kt,z,I,b,xt,ct]),Et=h.useCallback(e=>{_.current&&(clearInterval(_.current),_.current=null),C(null),ig.debug("Starting polling for assetId:",e),_t(e);const t=setInterval(()=>{S.current?_t(e):(clearInterval(t),_.current===t&&(_.current=null),C(null))},3e3);_.current=t,C(t)},[_t]),At=h.useCallback(()=>{_.current&&(clearInterval(_.current),_.current=null),C(null),ct(null)},[ct]),Tt=h.useCallback(async()=>{d("analyzing"),v(null),P(null),f(null),y(null);try{if("backend"===z){const e=N||oE("dqm_sessionToken");if(!e)return d("idle"),void ig.warn("Cannot start analysis: No session token available");ig.debug("Starting analysis with backend session token:",e.substring(0,16)+"...")}else{const t=I?.apiKey||oE("dqm_apiKey"),n=I?.websiteId||oE("dqm_websiteID");if(!t||!n)return d("idle"),void ig.warn("Cannot start analysis: No credentials available");try{Ct(t)}catch(e){throw new Error(`Invalid API key: ${e instanceof Error?e.message:"encoding error"}`)}ig.debug("Starting analysis with direct API key")}let t;i?(ig.warn("DEBUG MODE: Using custom HTML from debugHtml prop"),t=i):t=document.documentElement.outerHTML;const n=(e=>{const t=(new DOMParser).parseFromString(e,"text/html");[".MuiDrawer-root","#dqm-widget-host",'[data-block-handle="dqm_quality_analysis"]',"#dqm-quality-analysis-script","#PBarNextFrameWrapper"].forEach(e=>{try{t.querySelectorAll(e).forEach(e=>e.remove())}catch(n){ig.warn("Could not process selector:",e,n.message)}});const n=t.documentElement.outerHTML,r=e.length,o=n.length,a=((r-o)/r*100).toFixed(1);return ig.debug(`HTML optimization: ${r} → ${o} bytes (${a}% reduction)`),o>1048576&&ig.warn(`Optimized HTML still large: ${(o/1024/1024).toFixed(1)}MB`),n})(t),r=St(),o=kt();let a,s;if("backend"===z)a=`${r}/dqm/assets`,s={html:n,url:window.location.href},ig.debug("Using backend mode:",a);else{const e=I?.apiKey||oE("dqm_apiKey"),t=I?.websiteId||oE("dqm_websiteID");a=`${r}/assets?apiKey=${encodeURIComponent(e)}`,s={websiteId:t,content:n,contentType:"text/html; charset=UTF-8",title:document.title,timestamp:/* @__PURE__ */(new Date).toISOString()},o["Content-Type"]="application/x-www-form-urlencoded",ig.debug("Using direct mode:",a)}const l=await pb.post(a,s,{headers:o,timeout:3e4}),c=l.data?.assetId||l.data?.id;if(!c)throw new Error("No Asset ID returned from API");ct(c),Et(c)}catch(t){if(ig.error("Analysis failed:",t),pb.isAxiosError(t)&&401===t.response?.status)return xt(t),void d("error");let e="Unknown error occurred";pb.isAxiosError(t)?e=t.response?.data?.message||t.message||"API request failed":t instanceof Error&&(e=t.message),v(e),A([]),d("error"),At()}},[z,N,I,i,St,kt,xt,Et,At]);h.useEffect(()=>{R&&I&&"idle"===u&&(ig.debug("Auto-starting analysis with available credentials"),Tt())},[R,I,Tt,u]),h.useCallback(e=>{f(e),re(/* @__PURE__ */new Set),A(e?Object.entries(Pt(e.checkpoints||[])):[])},[]),h.useEffect(()=>()=>{At()},[]),h.useEffect(()=>{!0===e&&Tt()},[e]),h.useEffect(()=>{if(!p||!F)return;const e=p.checkpoints.find(e=>e.id===F)||null;W(e)},[p,F]);const Pt=h.useCallback(e=>{const t=e.reduce((e,t)=>(e[t.category]||(e[t.category]=[]),e[t.category].push(t),e),{});return Object.entries(t).forEach(([e,n])=>{n.forEach(n=>{n.colors=jk(e,Object.keys(t))})}),t},[]);h.useEffect(()=>{A(p?Object.entries(Pt(p.checkpoints||[])):[])},[p,Pt]);const Rt=async(e,t,n="browser")=>{j(""),U(!0),B(t),K(n),G(!0),c(rR("")),c(eR(!0)),c(FP(n)),c(JP()),ae(e=>({...e,[t]:{browser:"",source:""}})),dt.current=n;const r=p?.checkpoints.find(e=>e.id===t)||null;W(r),c(DP(r));try{const a=St(),i=kt();let s,l;if("backend"===z)s=`${a}/dqm/assets/${e}/pagehighlight/${t}?highlightSource=false`,l=`${a}/dqm/assets/${e}/pagehighlight/${t}?highlightSource=true`;else{const n=I?.apiKey||oE("dqm_apiKey");if(!n)throw new Error("DQM API key not found");try{Ct(n)}catch(o){throw new Error(`Invalid API key: ${o instanceof Error?o.message:"encoding error"}`)}const r=encodeURIComponent(n);s=`${a}/assets/${e}/errors/${t}?apiKey=${r}&highlightSource=false`,l=`${a}/assets/${e}/errors/${t}?apiKey=${r}&highlightSource=true`}const c=r?.canHighlight.page&&await pb.get(s,{headers:i,timeout:15e3,responseType:"text"})||void 0,u=r?.canHighlight.source&&await pb.get(l,{headers:i,timeout:15e3,responseType:"text"})||void 0,d=c?.data||"<p>No highlighted content available.</p>",f=u?.data||"<p>No source content available for this checkpoint.</p>";ae(e=>({...e,[t]:{browser:d,source:f}})),ig.debug("Both views loaded and cached"),"browser"===n&&r?.canHighlight?.page&&p?It(p.assetId,r.id):"source"===n&&r?.canHighlight?.source&&p&&Mt(p.assetId,r.id)}catch(a){ig.error("Failed to fetch highlighted content:",a),j(`<p style="color: #dc3545;">${s("sidebar:failed_load_highlights")}</p>`)}finally{U(!1)}},Mt=async(e,t)=>{const n=oe[t];if(n&&n.source)return ig.debug("Using cached source view for checkpoint:",t),void j(n.source);ig.warn("Source view not in cache for checkpoint:",t,", fetching..."),U(!0);try{const n=St(),o=kt();let a;if("backend"===z)a=`${n}/dqm/assets/${e}/pagehighlight/${t}?highlightSource=true`;else{const o=I?.apiKey||oE("dqm_apiKey");if(!o)throw new Error("DQM API key not found");try{Ct(o)}catch(r){throw new Error(`Invalid API key: ${r instanceof Error?r.message:"encoding error"}`)}const i=encodeURIComponent(o);a=`${n}/assets/${e}/errors/${t}?apiKey=${i}&highlightSource=true`}const i=await pb.get(a,{headers:o,timeout:15e3,responseType:"text"});if(i.data){const e=i.data;j(e),ae(n=>({...n,[t]:{...n[t],source:e}}))}else ig.warn("No highlighted content in response"),j(`<p>${s("sidebar:no_highlighted_content")}</p>`)}catch(o){ig.error("Failed to fetch source view:",o),j(`<p style="color: #dc3545;">${s("sidebar:failed_load_source")}</p>`)}finally{U(!1)}},It=async(e,t)=>{const n=oe[t];if(n&&n.browser)return ig.debug("Using cached browser view for checkpoint:",t),void j(n.browser);ig.warn("Browser view not in cache for checkpoint:",t,", fetching..."),U(!0);try{const n=St(),o=kt();let a;if("backend"===z)a=`${n}/dqm/assets/${e}/pagehighlight/${t}?highlightSource=false`;else{const o=I?.apiKey||oE("dqm_apiKey");if(!o)throw new Error("DQM API key not found");try{Ct(o)}catch(r){throw new Error(`Invalid API key: ${r instanceof Error?r.message:"encoding error"}`)}const i=encodeURIComponent(o);a=`${n}/assets/${e}/errors/${t}?apiKey=${i}&highlightSource=false`}const i=await pb.get(a,{headers:o,timeout:15e3,responseType:"text"});if(i.data){const e=i.data;j(e),ae(n=>({...n,[t]:{...n[t],browser:e}}))}else ig.warn("No highlighted content in response"),j(`<p>${s("sidebar:no_highlighted_content")}</p>`)}catch(o){ig.error("Failed to restore browser view:",o),j(`<p style="color: #dc3545;">${s("sidebar:failed_load_browser")}</p>`)}finally{U(!1)}};/* @__PURE__ */
|
|
387
387
|
return ot(ti,{theme:qa({palette:{primary:{main:"#1976d2",light:"#42a5f5",dark:"#1565c0"},secondary:{main:"#f50057"},background:{default:"#fafafa"}},typography:{fontFamily:'Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif',htmlFontSize:18,fontSize:18,h6:{fontSize:"22px"},h5:{fontSize:"24px"},h4:{fontSize:"26px"},h3:{fontSize:"28px"},h2:{fontSize:"30px"},h1:{fontSize:"32px"},subtitle2:{fontSize:"19px"},subtitle1:{fontSize:"18px"},body1:{fontSize:"18px"},body2:{fontSize:"17px"},button:{fontSize:"17px"}},shape:{borderRadius:8},components:{MuiDialog:{styleOverrides:{root:{zIndex:999999}},defaultProps:{disablePortal:r?.shadowDomMode??!1}},MuiPopper:{defaultProps:{disablePortal:r?.shadowDomMode??!1}},MuiTooltip:{defaultProps:{PopperProps:{disablePortal:r?.shadowDomMode??!1}}},MuiModal:{defaultProps:{disablePortal:r?.shadowDomMode??!1}},MuiFab:{styleOverrides:{root:{zIndex:999999}}},MuiBackdrop:{styleOverrides:{root:{zIndex:999998}}}}}),children:[
|
|
388
388
|
/* @__PURE__ */rt(di,{}),
|
|
389
|
-
/* @__PURE__ */rt(fm,{title:s("sidebar:fab_tooltip"),placement:"left",children:/* @__PURE__ */rt(Kb,{"data-testid":"dqm-fab",overlayInfo:
|
|
390
|
-
/* @__PURE__ */rt(Qb,{overlayInfo:
|
|
389
|
+
/* @__PURE__ */rt(fm,{title:s("sidebar:fab_tooltip"),placement:"left",children:/* @__PURE__ */rt(Kb,{"data-testid":"dqm-fab",overlayInfo:pt,onClick:()=>e?t():n(),"aria-label":s("sidebar:fab_tooltip"),style:{opacity:e?0:1,position:"fixed",zIndex:1400,transform:e?"translateX(80px)":"none",transition:"opacity 0.15s ease-in-out, transform 0.25s ease-in-out",pointerEvents:e?"none":"auto"},children:/* @__PURE__ */rt(Bb,{sx:{fontSize:22}})})}),
|
|
390
|
+
/* @__PURE__ */rt(Qb,{overlayInfo:pt,anchor:"right",open:e,onClose:t,variant:"temporary",elevation:16,ModalProps:{keepMounted:!1,disablePortal:r?.shadowDomMode??!1,disableScrollLock:!1,hideBackdrop:!1},children:R?/* @__PURE__ */ot(nt,{children:[
|
|
391
391
|
/* @__PURE__ */ot(Gb,{sx:{justifyContent:"space-between"},children:[
|
|
392
392
|
/* @__PURE__ */rt(kd,{display:"flex",alignItems:"center",gap:1.5,justifyContent:"flex-start",width:"100%",children:/* @__PURE__ */ot(mc,{variant:"h6",component:"h1",fontWeight:700,flexDirection:"row",alignItems:"center",display:"flex",gap:"0.5rem",children:[
|
|
393
393
|
/* @__PURE__ */rt("img",{width:24,height:24,style:{marginRight:"0.5rem"},src:"https://app-assets.gadget.dev/a/255812/505265/assets/dqm.svg",alt:"Crownpeak DQM"}),s("sidebar:title")]})}),
|
|
394
394
|
/* @__PURE__ */ot(kd,{display:"flex",alignItems:"center",gap:1,children:[
|
|
395
|
-
/* @__PURE__ */rt(fm,{title:s("sidebar:ai_settings",{defaultValue:"AI Assistant"}),children:/* @__PURE__ */rt(rv,{index:
|
|
396
|
-
/* @__PURE__ */rt(fA,{index:
|
|
395
|
+
/* @__PURE__ */rt(fm,{title:s("sidebar:ai_settings",{defaultValue:"AI Assistant"}),children:/* @__PURE__ */rt(rv,{index:ft?1:2,onClick:()=>me(!0),"aria-label":s("sidebar:ai_settings",{defaultValue:"AI Assistant"}),sx:{color:Ie?"error"===et?"error.main":"primary.main":"text.secondary"},children:"initializing"===et||"translating"===et?/* @__PURE__ */rt(Kl,{size:22,thickness:4,sx:{color:"inherit"}}):/* @__PURE__ */rt(Mb,{fontSize:"small"})})}),
|
|
396
|
+
/* @__PURE__ */rt(fA,{index:ft?2:3}),!ft&&/* @__PURE__ */rt(fm,{title:s("common:logout"),children:/* @__PURE__ */rt(rv,{index:1,onClick:bt,"aria-label":s("common:logout"),children:/* @__PURE__ */rt($b,{})})}),
|
|
397
397
|
/* @__PURE__ */rt(rv,{"data-testid":"sidebar-close",onClick:t,"aria-label":s("sidebar:close_sidebar"),children:/* @__PURE__ */rt(Ib,{})})]})]}),
|
|
398
398
|
/* @__PURE__ */rt(Xb,{children:/* @__PURE__ */ot(sg,{children:["idle"===u&&R&&/* @__PURE__ */ot(kd,{p:4,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"400px",children:[
|
|
399
399
|
/* @__PURE__ */rt(mc,{variant:"h5",fontWeight:600,gutterBottom:!0,color:"text.secondary",textAlign:"center",children:s("sidebar:ready_title")}),
|
|
400
400
|
/* @__PURE__ */rt(mc,{variant:"body1",color:"text.secondary",textAlign:"center",sx:{maxWidth:400,mb:3},children:s("sidebar:ready_body")}),
|
|
401
401
|
/* @__PURE__ */rt(kd,{component:"svg",sx:{width:"120px",height:"120px",opacity:.3},viewBox:"0 0 24 24",children:/* @__PURE__ */rt("path",{fill:"currentColor",d:"M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4M11,16.5L18,9.5L16.59,8.09L11,13.67L7.91,10.59L6.5,12L11,16.5Z"})})]}),"analyzing"===u&&/* @__PURE__ */rt(nv,{expanded:ee}),"error"===u&&T&&/* @__PURE__ */rt(kd,{children:/* @__PURE__ */ot(cc,{severity:T.includes("Permission denied")?"warning":"error",children:[
|
|
402
402
|
/* @__PURE__ */rt(mc,{variant:"subtitle1",fontWeight:700,gutterBottom:!0,children:T.includes("Permission denied")?s("sidebar:access_denied"):T.includes("not configured")?s("sidebar:config_required"):s("sidebar:auth_error")}),
|
|
403
|
-
/* @__PURE__ */rt(mc,{variant:"body2",color:"text.secondary",children:T})]})}),"error"===u&&!T&&/* @__PURE__ */rt(kd,{children:/* @__PURE__ */ot(cc,{severity:"error",action:/* @__PURE__ */rt(Nd,{color:"inherit",size:"small",onClick:
|
|
403
|
+
/* @__PURE__ */rt(mc,{variant:"body2",color:"text.secondary",children:T})]})}),"error"===u&&!T&&/* @__PURE__ */rt(kd,{children:/* @__PURE__ */ot(cc,{severity:"error",action:/* @__PURE__ */rt(Nd,{color:"inherit",size:"small",onClick:Tt,startIcon:/* @__PURE__ */rt(jb,{}),sx:{textTransform:"none",fontWeight:"bolder",fontSize:"1rem"},children:s("sidebar:retry")}),children:[
|
|
404
404
|
/* @__PURE__ */rt(mc,{variant:"subtitle1",fontWeight:700,gutterBottom:!0,children:s("sidebar:analysis_failed")}),
|
|
405
405
|
/* @__PURE__ */rt(mc,{variant:"body2",color:"text.secondary",children:b})]})}),"completed"===u&&p&&/* @__PURE__ */ot(kd,{children:[
|
|
406
406
|
/* @__PURE__ */ot(Jb,{children:[
|
|
407
407
|
/* @__PURE__ */rt(mc,{variant:"h6",fontWeight:700,gutterBottom:!0,sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:1},children:s("sidebar:overall_quality")}),
|
|
408
408
|
/* @__PURE__ */ot(kd,{display:"flex",alignItems:"center",justifyContent:"flex-start ",columnGap:"60px",pt:2,children:[
|
|
409
409
|
/* @__PURE__ */ot(kd,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:5,children:[
|
|
410
|
-
/* @__PURE__ */rt(Fk,{value:(
|
|
410
|
+
/* @__PURE__ */rt(Fk,{value:(Ot=p,Ot.totalCheckpoints&&0!==Ot.totalCheckpoints?Math.round((Ot.totalCheckpoints-Ot.totalErrors)/Ot.totalCheckpoints*100):0)}),
|
|
411
411
|
/* @__PURE__ */ot(kd,{children:[
|
|
412
412
|
/* @__PURE__ */rt(kd,{display:"flex",alignItems:"center",justifyContent:"center",gap:1,mb:1,flexDirection:"column",children:/* @__PURE__ */ot(mc,{color:"text.primary",fontSize:"12px",fontWeight:400,sx:{color:"gray",textAlign:"center"},children:[s("sidebar:passed"),
|
|
413
413
|
/* @__PURE__ */rt("p",{style:{margin:0,fontWeight:600,fontSize:"26px",color:"#28a745"},children:p.totalCheckpoints-p.totalErrors})]})}),
|
|
414
414
|
/* @__PURE__ */rt("hr",{style:{width:"100%",border:"1px solid #e0e0e0",margin:"10px 0px 10px 0px"}}),
|
|
415
415
|
/* @__PURE__ */rt(kd,{display:"flex",alignItems:"center",justifyContent:"center",gap:1,children:/* @__PURE__ */ot(mc,{fontSize:"12px",fontWeight:400,sx:{color:"gray",textAlign:"center"},children:[
|
|
416
416
|
/* @__PURE__ */rt("p",{style:{margin:0,fontWeight:600,fontSize:"26px",color:"#dc3545"},children:p.totalErrors}),s("sidebar:failed")]})})]})]}),
|
|
417
|
-
/* @__PURE__ */rt(kd,{display:"flex",justifyContent:"center",mt:3,children:/* @__PURE__ */ot(Nd,{variant:"outlined",size:"large",onClick:async()=>{if(p){Y(!0);try{const t=
|
|
417
|
+
/* @__PURE__ */rt(kd,{display:"flex",justifyContent:"center",mt:3,children:/* @__PURE__ */ot(Nd,{variant:"outlined",size:"large",onClick:async()=>{if(p){Y(!0);try{const t=St(),n=kt();let r;if("backend"===z)r=`${t}/dqm/assets/${p.assetId}/pagehighlight/all`;else{const n=I?.apiKey||oE("dqm_apiKey");if(!n)throw new Error("DQM API key not found");try{Ct(n)}catch(e){throw new Error(`Invalid API key: ${e instanceof Error?e.message:"encoding error"}`)}const o=encodeURIComponent(n);r=`${t}/assets/${p.assetId}/pagehighlight/all?apiKey=${o}`}const o=await pb.get(r,{headers:n,timeout:3e4,responseType:"text"});if(o.data){const e=o.data,t=window.open("","_blank");if(t){try{t.opener=null}catch{}const n=ov(e,{allowScripts:!1});t.document.open(),t.document.write(n),t.document.close(),setTimeout(()=>{const e=t.document.createElement("style");e.textContent="\n [data-dqm-id] {\n animation: pulse 1.5s ease-in-out infinite;\n }\n\n @keyframes pulse {\n 0%, 100% {\n background-color: rgba(255, 255, 0, 0.3);\n border-color: #dc3545;\n }\n 50% {\n background-color: rgba(255, 255, 0, 0.6);\n border-color: #ff6666;\n }\n }\n ",t.document.head.appendChild(e)},100)}}else ig.warn("No content in response"),alert(s("sidebar:failed_load_all_errors"))}catch(t){ig.error("Failed to fetch page with all errors:",t),alert(s("sidebar:failed_load_all_errors"))}finally{Y(!1)}}else ig.error("No analysis data available")},disabled:X,sx:{borderRadius:2,py:1,mb:3,fontSize:"17px",textTransform:"none"},children:[X?/* @__PURE__ */rt(Kl,{size:24,sx:{mr:1}}):null,s("sidebar:show_all_errors")]})})]})]}),
|
|
418
418
|
/* @__PURE__ */ot(tv,{children:[
|
|
419
419
|
/* @__PURE__ */ot(kd,{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,flexWrap:"wrap",children:[
|
|
420
420
|
/* @__PURE__ */ot(mc,{variant:"h6",fontWeight:700,sx:{display:"flex",alignItems:"center",gap:1},children:[
|
|
421
421
|
/* @__PURE__ */rt(Mb,{fontSize:"small"}),s("sidebar:summary_title"),
|
|
422
|
-
/* @__PURE__ */rt(fm,{title:s("sidebar:summary_model_tooltip",{defaultValue:"Modell: {{model}}",model:
|
|
422
|
+
/* @__PURE__ */rt(fm,{title:s("sidebar:summary_model_tooltip",{defaultValue:"Modell: {{model}}",model:lt}),children:/* @__PURE__ */rt(Hu,{size:"small",label:"ChatGPT",sx:{ml:1,fontWeight:600}})})]}),
|
|
423
423
|
/* @__PURE__ */ot(kd,{display:"flex",gap:1,alignItems:"center",children:[
|
|
424
424
|
/* @__PURE__ */rt(Nd,{variant:"outlined",size:"small",onClick:()=>me(!0),sx:{textTransform:"none"},children:s("sidebar:ai_settings")}),
|
|
425
425
|
/* @__PURE__ */rt(Nd,{variant:"outlined",size:"small",startIcon:/* @__PURE__ */rt(Fb,{}),onClick:Ke,disabled:!Se||"generating"===We,sx:{textTransform:"none"},children:s("sidebar:summary_regenerate")})]})]}),
|
|
@@ -458,15 +458,15 @@ return rt(Hu,{label:`${e} (${n})`,onClick:()=>{re(t=>{const n=new Set(t);return
|
|
|
458
458
|
/* @__PURE__ */rt(kd,{sx:{minHeight:"calc(100vh - 320px)"},children:/* @__PURE__ */rt(ev,{children:/* @__PURE__ */rt(qf,{sx:{p:0},children:Vb(E,[([e,t])=>t.filter(e=>e.failed).length/t.length]).reverse().filter(([e,t])=>(0===ne.size||ne.has(e))&&t.some(e=>e.failed)).map(([e,t])=>/* @__PURE__ */rt(nt,{children:t.filter(({failed:e})=>e).map(e=>{const{bg:t}=e.colors;/* @__PURE__ */
|
|
459
459
|
return rt(Xf,{sx:{px:0,py:1.5,alignItems:"flex-start"},children:/* @__PURE__ */ot(kd,{mt:.5,children:[
|
|
460
460
|
/* @__PURE__ */rt(kd,{display:"flex",alignItems:"center",gap:1,children:/* @__PURE__ */rt(mc,{variant:"h5",component:"div",fontWeight:600,mb:1.5,sx:{display:"flex",alignItems:"center",gap:1},children:e.name})}),
|
|
461
|
-
/* @__PURE__ */ot(kd,{display:"flex",gap:1,flexWrap:"wrap",mb:2,children:[e?.canHighlight.page&&/* @__PURE__ */rt(Nd,{variant:"outlined",size:"small",startIcon:/* @__PURE__ */rt(Wb,{}),onClick:()=>{B(e.id),
|
|
461
|
+
/* @__PURE__ */ot(kd,{display:"flex",gap:1,flexWrap:"wrap",mb:2,children:[e?.canHighlight.page&&/* @__PURE__ */rt(Nd,{variant:"outlined",size:"small",startIcon:/* @__PURE__ */rt(Wb,{}),onClick:()=>{B(e.id),Rt(p.assetId,e.id,"browser")},sx:{textTransform:"none",borderRadius:2,fontSize:"0.875rem"},children:s("sidebar:view_in_browser")}),e?.canHighlight.source&&/* @__PURE__ */rt(Nd,{variant:"outlined",size:"small",startIcon:/* @__PURE__ */rt(Wb,{}),onClick:()=>{B(e.id),Rt(p.assetId,e.id,"source")},sx:{textTransform:"none",borderRadius:2,fontSize:"0.875rem"},children:s("sidebar:view_source")}),
|
|
462
462
|
/* @__PURE__ */rt(mc,{variant:"body2",color:t,mr:2,ml:e?.canHighlight.source||e?.canHighlight.page?1:0,sx:{fontSize:"0.875rem",alignSelf:"center"},children:e.category}),e.topics?.map(e=>/* @__PURE__ */rt(mc,{variant:"body2",color:"text.secondary",mr:2,sx:{fontSize:"0.875rem",alignSelf:"center"},children:e},e))]}),
|
|
463
463
|
/* @__PURE__ */rt(rx,{html:e.description||""})]})},e.id)})}))})})})]})]})]})}),
|
|
464
|
-
/* @__PURE__ */rt(Yb,{children:/* @__PURE__ */rt(Nd,{onClick:
|
|
465
|
-
/* @__PURE__ */rt(UA,{open:he,onClose:()=>me(!1),translationEnabled:be,setTranslationEnabled:ve,translationMode:we,setTranslationMode:xe,translationTargetLang:Re,translationNeeded:Me,summaryEnabled:Se,setSummaryEnabled:ke,restartSummary:Ke,openAiApiKey:Ce,setOpenAiApiKey:_e,openAiModel:Ee,setOpenAiModel:Ae,openAiBaseUrl:Te,setOpenAiBaseUrl:Pe,aiModelIdEffective:
|
|
466
|
-
/* @__PURE__ */ot(gp,{open:Q,onClose:
|
|
464
|
+
/* @__PURE__ */rt(Yb,{children:/* @__PURE__ */rt(Nd,{onClick:Tt,variant:"contained",size:"large",fullWidth:!0,disabled:"analyzing"===u||!R||!!T,sx:{borderRadius:2,py:1,fontWeight:600,textTransform:"none",background:"linear-gradient(156deg, #b604d4 0%, #e38ef2 100%)","&:hover":{background:"linear-gradient(156deg, #9800b1 0%, #d091db 100%)"},fontSize:"17px",transition:"background 0.3s ease","&:disabled":{background:"#e0e0e0",color:"#9e9e9e"}},children:"analyzing"===u?s("sidebar:analyzing",{defaultValue:"Analyzing..."}):s("sidebar:run_quality_check")})}),
|
|
465
|
+
/* @__PURE__ */rt(UA,{open:he,onClose:()=>me(!1),translationEnabled:be,setTranslationEnabled:ve,translationMode:we,setTranslationMode:xe,translationTargetLang:Re,translationNeeded:Me,summaryEnabled:Se,setSummaryEnabled:ke,restartSummary:Ke,openAiApiKey:Ce,setOpenAiApiKey:_e,openAiModel:Ee,setOpenAiModel:Ae,openAiBaseUrl:Te,setOpenAiBaseUrl:Pe,aiModelIdEffective:lt,translationState:et,translationError:st,translationProgress:Ye,clearTranslationCache:$e,restartTranslation:Je,hasAnalysisData:!!g,openAiSettingsExpanded:tt,setOpenAiSettingsExpanded:at}),
|
|
466
|
+
/* @__PURE__ */ot(gp,{open:Q,onClose:wt,maxWidth:"xl",fullWidth:!0,PaperProps:{style:{borderRadius:12,padding:24,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.2)"}},children:[
|
|
467
467
|
/* @__PURE__ */ot(kp,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 24px",borderBottom:"1px solid #e0e0e0"},children:[
|
|
468
468
|
/* @__PURE__ */rt(mc,{variant:"h6",fontWeight:700,color:"text.primary",children:s("sidebar:highlighted_errors")}),
|
|
469
|
-
/* @__PURE__ */rt(Jl,{onClick:
|
|
469
|
+
/* @__PURE__ */rt(Jl,{onClick:wt,sx:{color:"text.secondary","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"}},"aria-label":s("sidebar:close"),children:/* @__PURE__ */rt(Ib,{})})]}),
|
|
470
470
|
/* @__PURE__ */rt(xp,{dividers:!0,sx:{padding:"16px 24px",borderBottom:"none"},children:/* @__PURE__ */ot(kd,{flexDirection:"row",display:"flex",gap:2,children:[q&&/* @__PURE__ */ot(kd,{width:"20%",sx:{maxHeight:"calc(100vh - 300px)",height:"calc(100vh - 300px)",overflowY:"auto"},children:[
|
|
471
471
|
/* @__PURE__ */rt(mc,{variant:"h6",component:"div",fontWeight:600,mb:2,children:q.name}),
|
|
472
472
|
/* @__PURE__ */ot(kd,{display:"flex",gap:1,mb:2,flexWrap:"wrap",children:[q.colors&&/* @__PURE__ */rt(Hu,{label:q.category,size:"medium",sx:{backgroundColor:q.colors.bg,color:q.colors.text,fontWeight:600,fontSize:"1rem"}}),q.topics?.map(e=>/* @__PURE__ */rt(Hu,{label:e,size:"medium",variant:"outlined",sx:{fontSize:"1rem"}},e))]}),
|
|
@@ -486,18 +486,18 @@ return rt(Xf,{sx:{px:0,py:1.5,alignItems:"flex-start"},children:/* @__PURE__ */o
|
|
|
486
486
|
/* @__PURE__ */rt(Kl,{size:48,sx:{color:"#c653ff",mb:2}}),
|
|
487
487
|
/* @__PURE__ */rt(mc,{variant:"body2",color:"text.secondary",children:s("sidebar:loading_views")})]})})})]}:{ref:ge,sx:{backgroundColor:"#fff",border:"1px solid #e0e0e0",borderRadius:2,padding:2,pt:0,marginTop:0,height:"calc(100vh - 300px)",maxHeight:"calc(100vh - 300px)",overflow:"auto",width:q?"80%":"100%"},children:[
|
|
488
488
|
/* @__PURE__ */ot(kd,{sx:{position:"sticky",top:0,zIndex:10,backgroundColor:"#fff",borderBottom:1,borderColor:"divider",mb:2,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[
|
|
489
|
-
/* @__PURE__ */ot(Um,{value:V,onChange:(e,t)=>{K(t),"browser"===t&&q?.canHighlight?.page&&p?
|
|
489
|
+
/* @__PURE__ */ot(Um,{value:V,onChange:(e,t)=>{K(t),"browser"===t&&q?.canHighlight?.page&&p?It(p.assetId,q.id):"source"===t&&q?.canHighlight?.source&&p&&Mt(p.assetId,q.id)},sx:{"& .MuiTab-root":{textTransform:"none",fontWeight:600,fontSize:"0.95rem"}},children:[
|
|
490
490
|
/* @__PURE__ */rt(_m,{label:s("sidebar:browser_view"),value:"browser",sx:{display:q?.canHighlight.page?"inline-flex":"none"}}),
|
|
491
491
|
/* @__PURE__ */rt(_m,{label:s("sidebar:source_view"),value:"source",sx:{display:q?.canHighlight.source?"inline-flex":"none"}})]}),
|
|
492
492
|
/* @__PURE__ */ot(kd,{sx:{display:"flex",alignItems:"center",gap:1,mr:2},children:[ie>0&&/* @__PURE__ */ot(nt,{children:[
|
|
493
493
|
/* @__PURE__ */rt(mc,{variant:"body2",sx:{color:"text.secondary",fontWeight:600,fontSize:"0.875rem",minWidth:"60px",textAlign:"center"},children:s("sidebar:x_of_y",{current:ue||le||1,total:ie})}),
|
|
494
|
-
/* @__PURE__ */rt(Jl,{size:"small",onClick:()=>
|
|
495
|
-
/* @__PURE__ */rt(Jl,{size:"small",onClick:()=>
|
|
496
|
-
/* @__PURE__ */rt(Jl,{size:"small",onClick:()=>
|
|
494
|
+
/* @__PURE__ */rt(Jl,{size:"small",onClick:()=>vt("prev"),disabled:0===ie,sx:{"&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"}},"aria-label":s("sidebar:prev_highlight"),children:/* @__PURE__ */rt(Pb,{fontSize:"small"})}),
|
|
495
|
+
/* @__PURE__ */rt(Jl,{size:"small",onClick:()=>vt("next"),disabled:0===ie,sx:{"&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"}},"aria-label":s("sidebar:next_highlight"),children:/* @__PURE__ */rt(Rb,{fontSize:"small"})})]}),
|
|
496
|
+
/* @__PURE__ */rt(Jl,{size:"small",onClick:()=>Rt(p.assetId,F,V),sx:{"&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"}},"aria-label":s("sidebar:reload_highlights"),children:/* @__PURE__ */rt(Fb,{fontSize:"small"})}),
|
|
497
497
|
/* @__PURE__ */rt(fm,{title:s("sidebar:open_in_new_tab"),placement:"top",children:/* @__PURE__ */rt(Jl,{size:"small",onClick:()=>{const e=window.open("","_blank");if(e){try{e.opener=null}catch{}const t=ov(D,{allowScripts:!1});e.document.open(),e.document.write(t),e.document.close(),setTimeout(()=>{const t=e.document.querySelectorAll([".astHighlightFull",".astHighlightStart",".astHighlightMiddle",".astHighlightEnd",".astError"].join(", "));if(ig.debug("Found highlights in new tab:",t.length),t.length>0){const e=t[0];ig.debug("Scrolling to first highlight in new tab"),e.scrollIntoView({behavior:"smooth",block:"center"}),e.classList.add("animate"),setTimeout(()=>{e.classList.remove("animate")},800)}else ig.warn("No highlights found in new tab")},500)}},sx:{"&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"}},"aria-label":s("sidebar:open_in_new_tab"),children:/* @__PURE__ */rt(Db,{fontSize:"small"})})}),"browser"===V&&/* @__PURE__ */rt(fm,{title:s(pe?"sidebar:enable_js":"sidebar:disable_js"),placement:"top",children:/* @__PURE__ */rt(Jl,{size:"small",onClick:()=>fe(!pe),sx:{color:pe?"text.secondary":"primary.main","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"}},"aria-label":s(pe?"sidebar:enable_js":"sidebar:disable_js"),children:/* @__PURE__ */ot("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[
|
|
498
498
|
/* @__PURE__ */rt("path",{d:"M16 18L22 12L16 6"}),
|
|
499
499
|
/* @__PURE__ */rt("path",{d:"M8 6L2 12L8 18"})]})})})]})]}),
|
|
500
|
-
/* @__PURE__ */rt(kd,{sx:{minHeight:400},children:"browser"===V?/* @__PURE__ */rt(av,{html:D,currentHighlight:le,clickedIndicator:J,onHighlightsFound:se,onVisibleHighlightChange:de,scriptsDisabled:pe}):/* @__PURE__ */rt(iv,{html:D,onHighlightsFound:se,currentHighlight:le,shouldAutoScrollToFirst:!
|
|
500
|
+
/* @__PURE__ */rt(kd,{sx:{minHeight:400},children:"browser"===V?/* @__PURE__ */rt(av,{html:D,currentHighlight:le,clickedIndicator:J,onHighlightsFound:se,onVisibleHighlightChange:de,scriptsDisabled:pe}):/* @__PURE__ */rt(iv,{html:D,onHighlightsFound:se,currentHighlight:le,shouldAutoScrollToFirst:!ut.current,clickedIndicator:J,onVisibleHighlightChange:de,scrollContainerRef:ge})})]})]})})]})]}):/* @__PURE__ */ot(kd,{sx:{width:"730px",height:"100vh",display:"flex",flexDirection:"column",backgroundColor:"#f5f5f5",overflow:"auto"},children:[
|
|
501
501
|
/* @__PURE__ */ot(kd,{sx:{background:"linear-gradient(135deg, #711bc1 0%, #8e44d6 100%)",color:"white",py:4,px:3,textAlign:"center",boxShadow:"0 4px 20px rgba(0,0,0,0.1)"},children:[
|
|
502
502
|
/* @__PURE__ */ot("svg",{style:{width:"24px",height:"24px",marginBottom:"1rem"},"aria-label":s("sidebar:title"),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 500 500",children:[
|
|
503
503
|
/* @__PURE__ */rt("path",{d:"M18.84,250c0-4.39,1.18-8.74,3.39-12.55L125.16,60.82c4.51-7.75,12.92-12.54,21.92-12.54h205.84c9.03,0,17.41,4.79,21.92,12.54l102.92,176.63c2.21,3.8,3.39,8.16,3.39,12.55,0,4.39-1.18,8.74-3.39,12.54l-102.92,176.64c-4.51,7.75-12.92,12.55-21.92,12.55h-205.84c-9.03,0-17.41-4.8-21.92-12.55L22.24,262.55c-2.21-3.8-3.39-8.16-3.39-12.54ZM12.5,250c0,5.41,1.42,10.82,4.25,15.67l102.92,176.64c5.67,9.71,16.11,15.67,27.41,15.67h205.84c11.3,0,21.75-5.96,27.41-15.67l102.92-176.64c2.83-4.85,4.25-10.26,4.25-15.67,0-5.41-1.42-10.82-4.25-15.68l-102.92-176.64c-5.67-9.71-16.11-15.67-27.41-15.67h-205.84c-11.3,0-21.75,5.96-27.41,15.67L16.75,234.33c-2.83,4.85-4.25,10.27-4.25,15.68Z",style:{fill:"#fff",stroke:"#fff",strokeMiterlimit:10,strokeWidth:3}}),
|
|
@@ -506,8 +506,8 @@ return rt(Xf,{sx:{px:0,py:1.5,alignItems:"flex-start"},children:/* @__PURE__ */o
|
|
|
506
506
|
/* @__PURE__ */rt("path",{d:"M347.45,204.4c-2.14-9.18-8.83-8.76-16.53-7.36-20.65,3.73-41.32,7.7-62.16,9.94-4.02.43-10.73,1.04-19.22,1.09,0,.02,0,.04,0,.06-6.08-.08-12.18-.41-18.31-1.07-20.84-2.25-41.51-6.21-62.16-9.94-7.7-1.39-14.39-1.81-16.53,7.36-2,8.6,4.3,11.78,10.98,13.76,7.09,2.11,14.26,4.15,21.54,5.35,17.54,2.88,35.17,5.25,52.85,7.83-4.75,38.47-13.41,74.69-39.48,104.67-2.52,2.9-1.87,11.59.69,15.16,4.35,6.07,10.07,2.47,14.89-1.86,18.01-16.16,28.26-36.83,35.98-62.51,0-.06,0-.12,0-.19,0,.04,0,.07,0,.11,7.71,25.67,17.97,46.35,35.98,62.51,4.82,4.33,10.54,7.93,14.89,1.86,2.57-3.57,3.21-12.27.69-15.16-26.07-29.98-34.72-66.2-39.48-104.67,17.68-2.59,35.31-4.95,52.85-7.83,7.28-1.2,14.45-3.24,21.54-5.35,6.68-1.99,12.98-5.16,10.98-13.76Z",style:{fill:"#711bc1",strokeWidth:0}}),
|
|
507
507
|
/* @__PURE__ */rt("circle",{cx:"250",cy:"171.61",r:"26.08",style:{fill:"#711bc1",strokeWidth:0}})]})]}),
|
|
508
508
|
/* @__PURE__ */rt(mc,{variant:"subtitle1",children:s("sidebar:title")})]}),
|
|
509
|
-
/* @__PURE__ */rt(kd,{sx:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",p:3,overflow:"auto"},children:/* @__PURE__ */rt(gA,{config:r||{},onAuthSuccess:
|
|
510
|
-
/* @__PURE__ */rt(Jl,{onClick:t,sx:{position:"absolute",top:16,right:16,color:"white",backgroundColor:"rgba(255, 255, 255, 0.1)","&:hover":{backgroundColor:"rgba(255, 255, 255, 0.2)"}},"aria-label":s("sidebar:close"),children:/* @__PURE__ */rt(Ib,{})})]})})]});var
|
|
509
|
+
/* @__PURE__ */rt(kd,{sx:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",p:3,overflow:"auto"},children:/* @__PURE__ */rt(gA,{config:r||{},onAuthSuccess:gt,onAuthError:yt,initialError:T})}),
|
|
510
|
+
/* @__PURE__ */rt(Jl,{onClick:t,sx:{position:"absolute",top:16,right:16,color:"white",backgroundColor:"rgba(255, 255, 255, 0.1)","&:hover":{backgroundColor:"rgba(255, 255, 255, 0.2)"}},"aria-label":s("sidebar:close"),children:/* @__PURE__ */rt(Ib,{})})]})})]});var Ot},XR=e=>/* @__PURE__ */rt(Ti,{i18n:rA,children:/* @__PURE__ */rt(Vi,{store:QR,children:/* @__PURE__ */rt(wA,{translationConfig:e.config?.translation,summaryConfig:e.config?.summary,children:/* @__PURE__ */rt(GR,{...e})})})}),YR=999999,JR="dqm-widget-host",ZR="dqm-react-root",eM="dqm-emotion-style-container",tM="dqm-portal-root";function nM(e,t){return qa({palette:{primary:{main:"#1976d2",light:"#42a5f5",dark:"#1565c0"},secondary:{main:"#f50057"},background:{default:"#fafafa"}},typography:{fontFamily:'Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif',htmlFontSize:t,fontSize:18,h6:{fontSize:"22px"},h5:{fontSize:"24px"},h4:{fontSize:"26px"},h3:{fontSize:"28px"},h2:{fontSize:"30px"},h1:{fontSize:"32px"},subtitle2:{fontSize:"19px"},subtitle1:{fontSize:"18px"},body1:{fontSize:"18px"},body2:{fontSize:"17px"},button:{fontSize:"17px"}},shape:{borderRadius:8},components:{MuiDialog:{styleOverrides:{root:{zIndex:YR}},defaultProps:{container:e}},MuiDrawer:{defaultProps:{ModalProps:{container:e,disablePortal:!0}}},MuiModal:{defaultProps:{container:e,disablePortal:!0}},MuiPopover:{defaultProps:{container:e,disablePortal:!0}},MuiPopper:{defaultProps:{disablePortal:!0}},MuiFab:{styleOverrides:{root:{zIndex:YR}}},MuiBackdrop:{styleOverrides:{root:{zIndex:999998}}}}})}let rM={};const oM=({theme:e})=>{m.useEffect(()=>{if("undefined"==typeof window)return;const e=dE(window.location.search,fE(),navigator.language,lE);QR.dispatch(sA(e)),rA.changeLanguage(e.locale);const t=()=>{const e=QR.getState().locale;if(e.userOverride||"url"===e.source)return;const t=dE(window.location.search,fE(),navigator.language,lE);QR.dispatch(sA(t)),rA.changeLanguage(t.locale)};window.addEventListener("languagechange",t);const n=QR.subscribe(()=>{const e=QR.getState().locale;rA.changeLanguage(e.locale)});return()=>{window.removeEventListener("languagechange",t),n()}},[]);const t={..."undefined"!=typeof window?window.DQM_CONFIG:{},...rM,shadowDomMode:!0},n="undefined"!=typeof window&&"true"===new URLSearchParams(window.location.search).get("dqm")||t.initialOpen||!1,[r,o]=m.useState(n),a=m.useCallback(()=>o(!0),[o]),i=m.useCallback(()=>o(!1),[o]);/* @__PURE__ */
|
|
511
511
|
return rt(Vi,{store:QR,children:/* @__PURE__ */rt(Ti,{i18n:rA,children:/* @__PURE__ */ot(ti,{theme:e,children:[
|
|
512
512
|
/* @__PURE__ */rt(di,{}),
|
|
513
513
|
/* @__PURE__ */rt(sg,{children:/* @__PURE__ */rt(XR,{open:r,onOpen:a,onClose:i,config:t})})]})})})};function aM(e){const t=(t,n)=>{if(e.getElementById(t))return;const r=document.createElement("link");r.id=t,r.rel="stylesheet",r.href=n,e.appendChild(r)};t("dqm-font-roboto","https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"),t("dqm-font-icons","https://fonts.googleapis.com/icon?family=Material+Icons")}function iM(e){if(e.getElementById("dqm-base-style"))return;const t=document.createElement("style");t.id="dqm-base-style",t.textContent=`\n /* Typography Isolation Layer - Force consistent font rendering across all shops */\n :host {\n /* Establish independent font context */\n all: initial;\n display: block;\n position: relative;\n z-index: 999999;\n /* Force base typography */\n font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;\n font-size: 18px !important;\n font-weight: 400 !important;\n line-height: 1.5 !important;\n letter-spacing: normal !important;\n text-transform: none !important;\n /* Ensure quality rendering */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n text-rendering: optimizeLegibility;\n }\n\n /* Reset typography for ALL elements inside shadow DOM */\n *, *::before, *::after {\n /* Inherit from :host, not from document */\n font-family: inherit !important;\n font-size: inherit !important;\n font-weight: inherit !important;\n line-height: inherit !important;\n letter-spacing: inherit !important;\n text-transform: inherit !important;\n /* Basic box model for consistency */\n box-sizing: border-box;\n }\n\n /* Re-establish semantic typography hierarchy */\n #${ZR}, #${tM} {\n font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;\n font-size: 18px !important;\n line-height: 1.5 !important;\n }\n\n /* Headings - explicit sizes to prevent shop theme interference */\n h1 { font-size: 32px !important; font-weight: 500 !important; line-height: 1.2 !important; margin: 0; }\n h2 { font-size: 30px !important; font-weight: 500 !important; line-height: 1.2 !important; margin: 0; }\n h3 { font-size: 28px !important; font-weight: 500 !important; line-height: 1.2 !important; margin: 0; }\n h4 { font-size: 26px !important; font-weight: 500 !important; line-height: 1.2 !important; margin: 0; }\n h5 { font-size: 24px !important; font-weight: 500 !important; line-height: 1.2 !important; margin: 0; }\n h6 { font-size: 22px !important; font-weight: 500 !important; line-height: 1.2 !important; margin: 0; }\n\n /* Body text */\n p, div, span {\n font-size: 18px !important;\n line-height: 1.5 !important;\n margin: 0;\n }\n\n /* Links - no color override, let MUI handle it */\n a {\n text-decoration: none;\n cursor: pointer;\n }\n\n /* Buttons */\n button {\n font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;\n cursor: pointer;\n }\n\n /* Lists */\n ul, ol {\n list-style: none;\n margin: 0;\n padding: 0;\n }\n\n /* Force MUI components to use our typography */\n .MuiTypography-root {\n font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;\n }\n\n .MuiTypography-h1 { font-size: 32px !important; font-weight: 500 !important; line-height: 1.2 !important; }\n .MuiTypography-h2 { font-size: 30px !important; font-weight: 500 !important; line-height: 1.2 !important; }\n .MuiTypography-h3 { font-size: 28px !important; font-weight: 500 !important; line-height: 1.2 !important; }\n .MuiTypography-h4 { font-size: 26px !important; font-weight: 500 !important; line-height: 1.2 !important; }\n .MuiTypography-h5 { font-size: 24px !important; font-weight: 500 !important; line-height: 1.2 !important; }\n .MuiTypography-h6 { font-size: 22px !important; font-weight: 500 !important; line-height: 1.2 !important; }\n .MuiTypography-body1 { font-size: 18px !important; line-height: 1.5 !important; }\n .MuiTypography-body2 { font-size: 17px !important; line-height: 1.5 !important; }\n .MuiTypography-subtitle1 { font-size: 18px !important; line-height: 1.5 !important; }\n .MuiTypography-subtitle2 { font-size: 19px !important; line-height: 1.5 !important; }\n .MuiTypography-button { font-size: 17px !important; font-weight: 600 !important; }\n\n /* Force all MUI components */\n .MuiButton-root,\n .MuiChip-root,\n .MuiIconButton-root,\n .MuiTab-root,\n .MuiMenuItem-root,\n .MuiListItem-root,\n .MuiListItemText-root {\n font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;\n }\n\n /* Input fields */\n input, textarea, select {\n font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;\n font-size: 18px !important;\n }\n\n /* Prevent text-transform inheritance from shop */\n * {\n text-transform: none !important;\n letter-spacing: normal !important;\n }\n\n /* Allow specific MUI components to set their own text-transform */\n .MuiButton-root,\n .MuiTab-root,\n .MuiChip-label {\n text-transform: none !important;\n }\n\n /* Normalize text rendering across browsers */\n * {\n text-size-adjust: 100%;\n -webkit-text-size-adjust: 100%;\n -moz-text-size-adjust: 100%;\n -ms-text-size-adjust: 100%;\n }\n `,e.prepend(t)}const sM=(e,t)=>{if(window.__DQM_WIDGET_INITIALIZED)return void ig.warn("Widget already initialized – skipping duplicate call");const n={..."undefined"!=typeof window?window.DQM_CONFIG:{},...e};let r,o;if(function(e){rM=e}(n),ig.debug("Initializing widget...",n.disabled?"(disabled)":""),t&&t.shadowRoot){const e=t.shadowRoot;let n=e.getElementById(eM);n||(n=document.createElement("div"),n.id=eM,e.appendChild(n));let a=e.getElementById(tM);a||(a=document.createElement("div"),a.id=tM,e.appendChild(a)),aM(e),iM(e),r=e.getElementById(ZR)||document.createElement("div"),r.parentElement||e.appendChild(r),o=ve({key:"dqm",container:n,prepend:!0});const i=nM(a,18);vt.createRoot(r).render(
|