import{__assign as t,__spreadArray as e}from"tslib";import{create as n}from"zustand";import{getQueryParam as r,setQueryParams as a,QUERY_PARAM_KEYS as u}from"../hooks/useLearningTemplateQueryParams.js";var i={globalRuleSet:[],genreRuleSet:[],customRuleSet:[]},o=n(function(n){return{sidebarTab:"rule-sets",selectedRuleSetId:null,ruleSets:i,isStationModalOpen:!1,isILModalTriggered:"true"===r(u.OPEN_IL),isStationOnboardModalTriggered:"true"===r(u.ONBOARD_STATION),scopeTreeData:null,urlVariantId:r(u.VARIANT_ID),urlApprovalAction:(o=r(u.APPROVAL_ACTION),"approve"===o||"reject"===o?o:null),stationNameParam:r(u.STATION_NAME),stations:[],selectedStationId:null,currentRules:[],createdVariantInfo:null,templateMap:{},setTemplateData:function(e,r){return n(function(n){var a;return{templateMap:t(t({},n.templateMap),(a={},a[e]=r,a))}})},setRuleSets:function(t){return n({ruleSets:t})},setScopeTreeData:function(t){return n({scopeTreeData:t})},setStationModalOpen:function(t){return n({isStationModalOpen:t})},setIsILModalTriggered:function(t){var e;a(((e={})[u.OPEN_IL]=t?"true":null,e)),n({isILModalTriggered:t})},setIsStationOnboardModalTriggered:function(e){var r,i;a(t(((r={})[u.ONBOARD_STATION]=e?"true":null,r),e?{}:((i={})[u.STATION_NAME]=null,i))),n(t({isStationOnboardModalTriggered:e},e?{}:{stationNameParam:null}))},setStationNameParam:function(t){var e;a(((e={})[u.STATION_NAME]=t,e)),n({stationNameParam:t})},setInitialRules:function(t){return n({currentRules:t})},setCreatedVariantInfo:function(t){return n({createdVariantInfo:t})},resetCreatedVariantInfo:function(){return n({createdVariantInfo:null})},clearUrlApprovalParams:function(){var t;a(((t={})[u.VARIANT_ID]=null,t[u.APPROVAL_ACTION]=null,t)),n({urlVariantId:null,urlApprovalAction:null})},rawAuditRuleData:null,setRawAuditRuleData:function(t){return n({rawAuditRuleData:t})},setSelectedRuleSetId:function(t){var e;a(((e={})[u.RULESET_ID]=t,e)),n({selectedRuleSetId:t})},toggleRuleTier:function(e){return n(function(n){return{currentRules:n.currentRules.map(function(n){return n.id===e?t(t({},n),{isOpen:!n.isOpen}):n})}})},deleteRule:function(e,r){return n(function(n){return{currentRules:n.currentRules.map(function(n){return n.id===e?t(t({},n),{rules:n.rules.filter(function(t){return t.id!==r}),ruleCount:n.ruleCount-1}):n})}})},setStations:function(t){return n({stations:t})},addStation:function(t){return n(function(n){return{stations:e(e([],n.stations,!0),[t],!1)}})},deleteStation:function(t){return n(function(e){return{stations:e.stations.filter(function(e){return e.stationId!==t}),selectedStationId:e.selectedStationId===t?null:e.selectedStationId}})},error:null,setError:function(t){return n({error:t})},tiers:[],setTiers:function(t){return n({tiers:t})},backwardCompatibility:!1,setBackwardCompatibility:function(t){return n({backwardCompatibility:t})},app_integration_id:null,setAppIntegrationId:function(t){return n({app_integration_id:t})},token:"",setToken:function(t){return n({token:t})}};var o});export{i as INITIAL_RULE_SETS,o as useLearningTemplateStore};
//# sourceMappingURL=useLearningTemplateStore.js.map
