/*! For license information please see editor-current-user.js.LICENSE.txt */
!function(){"use strict";var e={"@elementor/http-client":function(e){e.exports=window.elementorV2.httpClient},"@elementor/query":function(e){e.exports=window.elementorV2.query}},t={};function r(n){var s=t[n];if(void 0!==s)return s.exports;var u=t[n]={exports:{}};return e[n](u,u.exports,r),u.exports}r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};!function(){r.r(n),r.d(n,{PrefetchUserData:function(){return l},useCurrentUserCapabilities:function(){return y},useSuppressedMessage:function(){return d}});var e=r("@elementor/query"),t=r("@elementor/http-client"),s="/users/me",u={params:{context:"edit"}},o={get:()=>(0,t.httpService)().get("wp/v2"+s,u).then((e=>i(e.data))),update:e=>(0,t.httpService)().patch("wp/v2"+s,a(e))},i=e=>({suppressedMessages:Object.entries(e.elementor_introduction).filter((([,e])=>e)).map((([e])=>e)),capabilities:Object.keys(e.capabilities)}),a=e=>({elementor_introduction:e.suppressedMessages?.reduce(((e,t)=>(e[t]=!0,e)),{})}),c="editor-current-user",p=()=>(0,e.useQuery)({queryKey:[c],queryFn:o.get});function l(){return(0,e.useQueryClient)().prefetchQuery({queryKey:[c],queryFn:o.get}),null}var d=t=>{const{data:r}=p(),{mutate:n}=(()=>{const t=(0,e.useQueryClient)();return(0,e.useMutation)({mutationFn:o.update,onSuccess:()=>t.invalidateQueries({queryKey:[c]})})})(),s=!!r?.suppressedMessages.includes(t);return[s,()=>{s||n({suppressedMessages:[...r?.suppressedMessages??[],t]})}]},y=()=>{const{data:e}=p();return{canUser:t=>Boolean(e?.capabilities.includes(t))}}}(),(window.elementorV2=window.elementorV2||{}).editorCurrentUser=n}(),window.elementorV2.editorCurrentUser?.init?.();