"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),n=require("react/jsx-runtime"),t=require("react"),i=require("../AppCommonsProvider/AppCommonsContext.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=o(e),s="CorvaUI.internal.SettingsPinned",u=t.createContext({isPinned:!1,isPopoverOpen:!1,open:function(){},close:function(){},onPinClick:function(){},animatePopover:!0,showPinButton:!0});exports.AppSettingsPinnedKey=s,exports.AppSettingsPinningProvider=function(e){var o=e.children,a=e.initiallyPinned,l=void 0!==a&&a,p=e.pinningEnabled,d=void 0!==p&&p,c=e.additionalControls,P=i.useAppCommonsInternal(),f=P.appSettings,C=P.onSettingChange,v=P.appSettingsComponent,m=P.isInsideNewMobileApp,g=l&&f&&!(s in f)||!(null==f||!f[s]),S=t.useState(!1),b=r.default(S,2),x=b[0],A=b[1],h=t.useState(!1),y=r.default(h,2),j=y[0],k=y[1],q=t.useState(g&&!!v),w=r.default(q,2),I=w[0],M=w[1],O=I&&!m,B=t.useCallback((function(){k(!1),A(O),M(!O),C(s,!O)}),[C,O]),_=t.useCallback((function(){O||(k(!0),A(!0))}),[O]),E=t.useCallback((function(e){k(!0),M(!1),e&&C(s,!1),A(!1)}),[C]),K=!m&&d,N=t.useMemo((function(){return{isPinned:O,isPopoverOpen:x,open:_,close:E,onPinClick:B,animatePopover:j,showPinButton:K,initiallyPinned:l,additionalControls:c}}),[O,x,_,E,B,j,K,l,c]);return n.jsx(u.Provider,{value:N,children:o})},exports.useAppSettingPinning=function(){return t.useContext(u)};
//# sourceMappingURL=AppSettingsPinningContext.js.map
