"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7202],{57202:function(e,t,i){i.d(t,{worker:function(){return d}});var n=i(45698);let s=[{fides_key:"low",name:"Low",description:"Low sensitivity",parent_key:null,active:!0,is_default:!1},{fides_key:"medium",name:"Medium",description:"Medium sensitivity",parent_key:null,active:!0,is_default:!1},{fides_key:"high",name:"High",description:"High sensitivity",parent_key:null,active:!0,is_default:!1}],a=[{fides_key:"sensitivity",name:"Sensitivity"}],o="mock_sensitivity_taxonomy",r=!!window.localStorage,l=()=>{if(r)try{let e=window.localStorage.getItem(o);if(e)return JSON.parse(e)}catch(e){}return[...s]},c=e=>{if(r)try{window.localStorage.setItem(o,JSON.stringify(e))}catch(e){}},_=l(),u=[...function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"sensitivity";c(_=[...r?l():e]);let i="/api/v1";return[n.rest.get("".concat(i,"/taxonomies"),(e,t,i)=>t(i.status(200),i.json(a))),n.rest.get("".concat(i,"/taxonomies/").concat(t),(e,t,i)=>{let n=(e=>{let t=[],i=[...e],n=i.filter(e=>null===e.parent_key);for(n.sort((e,t)=>e.fides_key.localeCompare(t.fides_key)),t.push(...n),i.splice(0,i.length,...i.filter(e=>null!==e.parent_key));i.length>0;){let e=[];for(let n=i.length-1;n>=0;n-=1){let s=i[n];t.some(e=>e.fides_key===s.parent_key)&&(e.push(s),i.splice(n,1))}if(0===e.length){t.push(...i);break}e.sort((e,t)=>e.fides_key.localeCompare(t.fides_key)),t.push(...e)}return t})(_);return t(i.status(200),i.json(n))}),n.rest.post("".concat(i,"/taxonomies/").concat(t),async(e,t,i)=>{let n=await e.json(),s=n.fides_key||(n.name&&n.name.trim()?n.name.toLowerCase().replace(/&/g,"and").replace(/'/g,"").replace(/[^a-z0-9]/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""):"new_item_".concat(Date.now())),a=!n.parent_key||_.some(e=>e.fides_key===n.parent_key),o={fides_key:s,name:n.name||null,description:n.description||null,parent_key:a&&n.parent_key||null,active:void 0===n.active||n.active,is_default:void 0!==n.is_default&&n.is_default};return _.push(o),c(_),t(i.status(201),i.json(o))}),n.rest.put("".concat(i,"/taxonomies/").concat(t),async(e,t,i)=>{let n=await e.json(),s=_.findIndex(e=>e.fides_key===n.fides_key);return -1!==s&&(_[s]=n,c(_)),t(i.status(200),i.json(n))}),n.rest.delete("".concat(i,"/taxonomies/").concat(t,"/:fides_key"),(e,t,i)=>{let{fides_key:n}=e.params;return c(_=_.filter(e=>e.fides_key!==n)),t(i.status(204))})]}()],d=(0,n.setupWorker)(...u)}}]);