-
Notifications
You must be signed in to change notification settings - Fork 3
/
8-fd5ef347026a0fd2f506.js
2 lines (2 loc) · 67.7 KB
/
8-fd5ef347026a0fd2f506.js
1
2
webpackJsonp([8],{3306:function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),s=n.n(i),l=n(1),c=n.n(l),u=n(19),d=n.n(u),p=n(3358),m=n(3497),f=n(1311),h=n(1313),g=n.n(h),y=n(723),v=n.n(y),b=n(3868),T=n(3867),S=n(84),_=n(245),E=n(3392),C=n(3686),w=function(){function e(e,t){var n=[],a=!0,o=!1,r=void 0;try{for(var i,s=e[Symbol.iterator]();!(a=(i=s.next()).done)&&(n.push(i.value),!t||n.length!==t);a=!0);}catch(e){o=!0,r=e}finally{try{!a&&s.return&&s.return()}finally{if(o)throw r}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),O=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),A={heading:{paddingBottom:18},fab:{textAlign:"right",marginTop:"1rem",bottom:"1.5rem",right:"1.5rem",position:"fixed",zIndex:10}},x=function(e){function t(e,n){a(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.handleTranslationSaved=function(){S.a.show({message:"translation_saved",translate:!0})},r.handleTranslationErrored=function(e){d.a.error(e),S.a.show({message:"translation_save_error",action:"ok",translate:!0})},r.state={categoryCombos:null,editSectionModel:!1,greyFieldSectionModel:!1},Promise.all([n.d2.Api.getApi().get(["dataSets",e.params.modelId,"categoryCombos"].join("/"),{fields:"id,displayName",paging:!1})]).then(function(e){var t=w(e,1),n=t[0],a=_.a.state.sections,o=Array.isArray(a)?a:a.toArray();r.setState({sections:o.sort(function(e,t){return e.sortOrder-t.sortOrder}),categoryCombos:n.categoryCombos.map(function(e){return{value:e.id,text:"default"===e.displayName?r.getTranslation("none"):e.displayName}})})}),r.handleAddSectionClick=r.handleAddSectionClick.bind(r),r.handleEditSectionClick=r.handleEditSectionClick.bind(r),r.handleSectionSaved=r.handleSectionSaved.bind(r),r.handleDeleteSectionClick=r.handleDeleteSectionClick.bind(r),r.handleTranslateSectionClick=r.handleTranslateSectionClick.bind(r),r.handleTranslationSaved=r.handleTranslationSaved.bind(r),r.handleTranslationErrored=r.handleTranslationErrored.bind(r),r.handleSectionGreyFieldsClick=r.handleSectionGreyFieldsClick.bind(r),r.swapSections=r.swapSections.bind(r),r.moveSectionUp=r.moveSectionUp.bind(r),r.moveSectionDown=r.moveSectionDown.bind(r),r.getTranslation=n.d2.i18n.getTranslation.bind(n.d2.i18n),r}return r(t,e),O(t,[{key:"handleAddSectionClick",value:function(){var e=this.context.d2.models.sections.create();this.setState(function(t){return{editSectionModel:Object.assign(e,{dataSet:{id:_.a.state.id},sortOrder:t.sections.reduce(function(e,t){return Math.max(t.sortOrder,e)},0)+1})}})}},{key:"handleEditSectionClick",value:function(e){this.setState({editSectionModel:e})}},{key:"handleSectionSaved",value:function(e){var t=this;this.setState(function(t){var n=!1,a=t.sections.map(function(t){return t.id===e.id?(n=!0,e):t}).sort(function(e,t){return e.sortOrder-t.sortOrder});return n||a.push(e),_.a.setState(Object.assign(_.a.state,{sections:a})),{editSectionModel:!1,greyFieldSectionModel:!1,sections:a}},function(){t.forceUpdate()})}},{key:"handleDeleteSectionClick",value:function(e){var t=this;S.a.show({message:this.getTranslation("confirm_delete_section")+" "+e.displayName,action:"confirm",onActionTouchTap:function(){e.delete().then(function(){var n=_.a.state.sections;_.a.setState(Object.assign(_.a.state,{sections:(Array.isArray(n)?n:n.toArray()).filter(function(t){return t.id!==e.id})})),S.a.show({message:t.getTranslation("section_deleted")}),t.setState(function(t){return{sections:t.sections.filter(function(t){return t.id!==e.id})}})}).catch(function(e){S.a.show({message:t.getTranslation("failed_to_delete_section"),action:"ok"}),d.a.warn("Failed to delete section",e)})}})}},{key:"handleTranslateSectionClick",value:function(e){this.setState({translationModel:e})}},{key:"handleSectionGreyFieldsClick",value:function(e){this.setState({greyFieldSectionModel:e})}},{key:"swapSections",value:function(e,t){var n=this;this.setState(function(a){var o=e.sortOrder;return e.sortOrder=t.sortOrder,t.sortOrder=o,Promise.all([e.save(),t.save()]).then(function(){S.a.show({message:n.getTranslation("section_moved")})}).catch(function(e){d.a.warn("Failed to swap sections:",e),S.a.show({message:n.getTranslation("failed_to_move_section"),action:"ok"})}),{sections:a.sections.sort(function(e,t){return e.sortOrder-t.sortOrder})}})}},{key:"moveSectionUp",value:function(e){var t=this.state.sections.indexOf(e);if(t>0){var n=this.state.sections[t-1];this.swapSections(n,e)}}},{key:"moveSectionDown",value:function(e){var t=this.state.sections.indexOf(e);if(t<this.state.sections.length-1){var n=this.state.sections[t+1];this.swapSections(n,e)}}},{key:"render",value:function(){var e=this,t={edit:this.handleEditSectionClick,delete:this.handleDeleteSectionClick,translate:this.handleTranslateSectionClick,manage_grey_fields:this.handleSectionGreyFieldsClick,move_up:this.moveSectionUp,move_down:this.moveSectionDown},n={edit:"edit",move_up:"arrow_upward",move_down:"arrow_downward",manage_grey_fields:"do_not_disturb"},a=function(t,n){return"move_up"===n?e.state.sections.indexOf(t)>0:"move_down"!==n||e.state.sections.indexOf(t)<e.state.sections.length-1};return void 0===this.state.sections?s.a.createElement(m.a,null):s.a.createElement("div",null,s.a.createElement(E.a,{schema:"dataSet",groupName:"dataSetSection"},"section_management"),s.a.createElement(C.a,null,_.a.state.displayName),s.a.createElement(f.a,{columns:["name"],rows:this.state.sections,contextMenuActions:t,contextMenuIcons:n,primaryAction:t.edit,isContextActionAllowed:a}),s.a.createElement(b.a,{open:!!this.state.editSectionModel,sectionModel:this.state.editSectionModel,categoryCombos:this.state.categoryCombos,onRequestClose:function(){e.setState({editSectionModel:!1})},onSaveSection:this.handleSectionSaved}),s.a.createElement(T.a,{open:!!this.state.greyFieldSectionModel,sectionModel:this.state.greyFieldSectionModel,onRequestClose:function(){e.setState({greyFieldSectionModel:!1})},onRequestSave:this.handleSectionSaved}),this.state.translationModel?s.a.createElement(p.a,{objectToTranslate:this.state.translationModel,objectTypeToTranslate:this.state.translationModel&&this.state.translationModel.modelDefinition,open:!!this.state.translationModel,onTranslationSaved:this.handleTranslationSaved,onTranslationError:this.handleTranslationErrored,onRequestClose:function(){e.setState({translationModel:null})},fieldsToTranslate:["name"]}):null,s.a.createElement("div",{style:A.fab},s.a.createElement(g.a,{onClick:this.handleAddSectionClick},s.a.createElement(v.a,{className:"material-icons"},"add"))))}}]),t}(i.Component);x.propTypes={params:c.a.any.isRequired},x.contextTypes={d2:c.a.any.isRequired},t.default=x},3346:function(e,t,n){"use strict";function a(e){return e&&v.a[e]}function o(e){var t=e.major,n=e.minor;return e.snapshot?"master":""+t+n}function r(e,t){var n=/\$\{(.+?)\}/g;return e.replace(n,function(e,n){return t.has(n)?t.get(n):".+?"})}function i(e,t){return Object.keys(v.a).find(function(n){var a=r(n,t);return new RegExp(a).test(e)})}function s(e,t){return a(e)?r(v.a[e],t):""}function l(e,t){var a=new Map([["objectType",t]]),o=new Map([["objectType",n.i(g.camelCaseToUnderscores)(t)]]);return s(i(e,a),o)}function c(e,t){var n=e.schema,a=t.d2,r=window.location.hash.replace(/^#/,"").replace(/\?.+?$/,""),i=o(a.system.version),s="https://docs.dhis2.org/en/use/user-guides/dhis-core-version-"+i+"/configuring-the-system",c=l(r,n);return c?d.a.createElement(h.a,{href:""+s+c,target:"_blank",rel:"noopener noreferrer",tooltip:a.i18n.getTranslation("open_user_guide"),tooltipPosition:"bottom-center",iconClassName:"material-icons",iconStyle:{top:-2}},"help_outline"):null}t.a=c;var u=n(0),d=n.n(u),p=n(1),m=n.n(p),f=n(133),h=n.n(f),g=n(724),y=(n.n(g),n(3357)),v=n.n(y);c.propTypes={schema:m.a.string.isRequired},c.contextTypes={d2:m.a.object}},3357:function(e,t){e.exports={"/list/categorySection":"/metadata.html#manage_category","/list/dataElementSection":"/metadata.html#manage_data_element","/list/dataSetSection":"/metadata.html#manage_data_set","/edit/dataSetSection/dataSet/${objectId}/sections":"/metadata.html#manage_section_form","/edit/dataSetSection/dataSetNotificationTemplate":"/metadata.html#create_data_set_notification","/edit/dataSetSection/dataSet":"/metadata.html#create_data_set","/list/indicatorSection/programIndicatorGroup":"/programs.html#manage_${objectType}","/list/indicatorSection/programIndicator":"/programs.html#configure_program_indicator","/list/indicatorSection":"/metadata.html#manage_indicator","/edit/indicatorSection/programIndicator":"/programs.html#create_${objectType}","/edit/indicatorSection/programIndicatorGroup":"/programs.html#create_${objectType}","/list/organisationUnitSection/organisationUnitLevel":"/metadata.html#name_organisation_unit_level","/list/organisationUnitSection":"/metadata.html#manage_organisation_unit","organisationUnitSection/hierarchy":"/metadata.html#move_organisation_unit","/list/programSection/trackedEntity":"/programs.html#configure_tracked_entity","/list/programSection/programRuleVariable":"/programs.html#configure_program_rule","/list/programSection/program/":"/programs.html#configure_programs_in_maintenance_app","/list/programSection/${objectType}":"/programs.html#configure_${objectType}","/list/programSection":"/programs.html#configure_programs_in_maintenance_app","/edit/programSection/program/":"/programs.html#configure_programs_in_maintenance_app","/edit/programSection/trackedEntityType":"/programs.html#create_tracked_entity","/edit/programSection/${objectType}":"/programs.html#create_${objectType}","/list/validationSection":"/metadata.html#manage_validation_rule","/edit/validationSection/validationNotificationTemplate":"/metadata.html#create_validation_notification","/edit/otherSection/attribute":"/metadata.html#create-or-edit-an-attribute","/list/otherSection/optionGroup":"/metadata.html#create_option_group","/list/otherSection/optionGroupSet":"/metadata.html#create_option_group_set","/list/otherSection/legendSet":"/metadata.html#manage_legend","/edit/otherSection/legendSet":"/metadata.html#create_legend","/list/otherSection/predictorGroup":"/metadata.html#create_predictor_group","/list/otherSection/pushAnalysis":"/metadata.html#manage_push_report","/edit/otherSection/pushAnalysis":"/metadata.html#manage_push_report","/list/otherSection/externalMapLayer":"/metadata.html#manage_external_maplayer","/list/otherSection/locale":"/metadata.html#maintenance_locale_management","/edit/otherSection/locale":"/metadata.html#maintenance_locale_management","/list/otherSection/sqlView":"/metadata.html#maintenance_sql_view","/edit/otherSection/sqlView":"/metadata.html#maintenance_sql_view","/edit/":"/metadata.html#create_${objectType}","/list/":"/metadata.html#manage_${objectType}"}},3358:function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(0),s=n.n(i),l=n(1),c=n.n(l),u=n(18),d=(n.n(u),n(437)),p=n.n(d),m=n(3374),f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},h=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),g=function(e){function t(e,r){a(this,t);var i=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return i.i18n=r.d2.i18n,i.state={TranslationForm:n.i(m.a)(i.props.objectToTranslate)},i.translationSaved=i.translationSaved.bind(i),i.translationError=i.translationError.bind(i),i.closeTranslationDialog=i.closeTranslationDialog.bind(i),i}return r(t,e),h(t,[{key:"render",value:function(){return s.a.createElement(p.a,f({title:this.i18n.getTranslation("translation_dialog_title"),autoDetectWindowHeight:!0,autoScrollBodyContent:!0},this.props),s.a.createElement(this.state.TranslationForm,{onTranslationSaved:this.translationSaved,onTranslationError:this.translationError,onCancel:this.closeTranslationDialog,fieldsToTranslate:this.props.fieldsToTranslate}))}},{key:"componentWillReceiveProps",value:function(e){e.objectToTranslate&&this.setState({TranslationForm:n.i(m.a)(e.objectToTranslate)})}},{key:"closeTranslationDialog",value:function(){this.props.onRequestClose()}},{key:"translationSaved",value:function(e){this.props.onTranslationSaved(e),this.closeTranslationDialog()}},{key:"translationError",value:function(e){this.props.onTranslationError(e)}}]),t}(i.Component);g.propTypes={objectToTranslate:c.a.shape({id:c.a.string.isRequired}).isRequired,onTranslationSaved:c.a.func.isRequired,onTranslationError:c.a.func.isRequired,open:c.a.bool,onRequestClose:c.a.func.isRequired,fieldsToTranslate:c.a.array},g.contextTypes={d2:c.a.object},t.a=g},3373:function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(0),s=n.n(i),l=n(1),c=n.n(l),u=n(319),d=n.n(u),p=n(204),m=n.n(p),f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},h=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),g=function(e){function t(e,n){a(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));r.onLocaleChange=function(e,t,n){r.setState({locale:n}),r.props.onChange(n,e)};var i=r.context.d2.i18n;return r.getTranslation=i.getTranslation.bind(i),r}return r(t,e),h(t,[{key:"render",value:function(){var e=[{payload:"",text:""}].concat(this.props.locales).map(function(e,t){return s.a.createElement(m.a,{key:t,primaryText:e.name,value:e.locale})});return s.a.createElement(d.a,f({fullWidth:!0},this.props,{value:this.state&&this.state.locale,hintText:this.getTranslation("select_locale"),onChange:this.onLocaleChange}),e)}}]),t}(i.Component);g.propTypes={value:c.a.string,locales:c.a.arrayOf(c.a.shape({name:c.a.string.isRequired,locale:c.a.string.isRequired})).isRequired,onChange:c.a.func.isRequired},g.contextTypes={d2:c.a.object},t.a=g},3374:function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e){var t=_.a.create();return n.i(T.a)(e).subscribe(function(e){t.setState(e)}),v.Observable.combineLatest(n.i(T.b)(),t,function(){for(var n=arguments.length,a=Array(n),o=0;o<n;o++)a[o]=arguments[o];return Object.assign.apply(Object,[{objectToTranslate:e,setTranslations:function(e){t.setState({translations:e})}}].concat(a))})}function s(e){return n.i(S.a)(i(e),w)}t.a=s;var l=n(0),c=n.n(l),u=n(1),d=n.n(u),p=n(58),m=n.n(p),f=n(95),h=n.n(f),g=n(200),y=n.n(g),v=n(25),b=(n.n(v),n(3373)),T=n(3375),S=n(1307),_=n(44),E=n(150),C=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),w=function(e){function t(e,r){a(this,t);var i=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));i.state={loading:!0,translations:{},translationValues:{},currentSelectedLocale:""},i.setCurrentLocale=function(e){i.setState({currentSelectedLocale:e})},i.setValue=function(e,t){var n=[].concat(i.props.translations),a=n.find(function(t){return t.locale===i.state.currentSelectedLocale&&t.property.toLowerCase()===h()(e)});a?t.target.value?a.value=t.target.value:n=n.filter(function(e){return e!==a}):(a={property:h()(e).toUpperCase(),locale:i.state.currentSelectedLocale,value:t.target.value},n.push(a)),i.props.setTranslations(n)},i.saveTranslations=function(){n.i(T.c)(i.props.objectToTranslate,i.props.translations).subscribe(i.props.onTranslationSaved,i.props.onTranslationError)};var s=i.context.d2.i18n;return i.getTranslation=s.getTranslation.bind(s),i}return r(t,e),C(t,[{key:"getLoadingdataElement",value:function(){return c.a.createElement("div",{style:{textAlign:"center"}},c.a.createElement(E.a,{mode:"indeterminate"}))}},{key:"renderFieldsToTranslate",value:function(){var e=this;return this.props.fieldsToTranslate.filter(function(e){return e}).map(function(t){return c.a.createElement("div",{key:t},c.a.createElement(m.a,{floatingLabelText:e.getTranslation(h()(t)),value:e.getTranslationValueFor(t),fullWidth:!0,onChange:e.setValue.bind(e,t)}),c.a.createElement("div",null,e.props.objectToTranslate[t]))})}},{key:"renderForm",value:function(){return c.a.createElement("div",null,this.renderFieldsToTranslate(),c.a.createElement(y.a,{label:this.getTranslation("save"),primary:!0,onClick:this.saveTranslations}),c.a.createElement(y.a,{style:{marginLeft:"1rem"},label:this.getTranslation("cancel"),onClick:this.props.onCancel}))}},{key:"renderHelpText",value:function(){return c.a.createElement("div",null,c.a.createElement("p",null,this.getTranslation("select_a_locale_to_enter_translations_for_that_language")))}},{key:"render",value:function(){return this.props.locales||this.props.translations?c.a.createElement("div",{style:{minHeight:250}},c.a.createElement(b.a,{locales:this.props.locales,onChange:this.setCurrentLocale}),this.state.currentSelectedLocale?this.renderForm():this.renderHelpText()):this.getLoadingdataElement()}},{key:"getTranslationValueFor",value:function(e){var t=this,n=this.props.translations.find(function(n){return n.locale===t.state.currentSelectedLocale&&n.property.toLowerCase()===h()(e)});if(n)return n.value}}]),t}(l.Component);w.propTypes={onTranslationSaved:d.a.func.isRequired,onTranslationError:d.a.func.isRequired,objectToTranslate:d.a.shape({id:d.a.string.isRequired}),fieldsToTranslate:d.a.arrayOf(d.a.string)},w.defaultProps={fieldsToTranslate:["name","shortName","description"]},w.contextTypes={d2:d.a.object}},3375:function(e,t,n){"use strict";function a(){return a.localePromise||(a.localePromise=n.i(i.getInstance)().then(function(e){return e.Api.getApi().get("locales/db")}).then(function(e){return{locales:e}})),s.Observable.fromPromise(a.localePromise)}function o(e){return e.href?e.href:e.modelDefinition.apiEndpoint+"/"+e.id}function r(e){return s.Observable.of(e).flatMap(function(e){var t=e.modelDefinition;return t||t.name?n.i(i.getInstance)().then(function(t){return t.Api.getApi().get(o(e)+"/translations")}):Promise.reject(new Error("Can not find modelDefinition for "+e.id))})}t.b=a,t.a=r,n.d(t,"c",function(){return u});var i=n(18),s=(n.n(i),n(25)),l=(n.n(s),n(112)),c=function(){function e(e,t){var n=[],a=!0,o=!1,r=void 0;try{for(var i,s=e[Symbol.iterator]();!(a=(i=s.next()).done)&&(n.push(i.value),!t||n.length!==t);a=!0);}catch(e){o=!0,r=e}finally{try{!a&&s.return&&s.return()}finally{if(o)throw r}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=l.a.create("saveTranslations");u.subscribe(function(e){var t=c(e.data,2),a=t[0],r=t[1],s=e.complete,l=e.error,u=o(a)+"/translations";n.i(i.getInstance)().then(function(e){e.Api.getApi().update(u,{translations:r},{dataType:"text"}).then(function(){return s(r)}).catch(l)})})},3392:function(e,t,n){"use strict";function a(e,t){var n={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function o(e,t){var o=e.level,r=e.schema,s=e.children,l=e.groupName,c=e.isDirtyHandler,h=e.skipTranslation,g=a(e,["level","schema","children","groupName","isDirtyHandler","skipTranslation"]);return i.a.createElement(u.a,f({},g,{level:o}),i.a.createElement(p.a,{onClick:function(){return n.i(m.b)("/list/"+l+"/"+r)},iconStyle:{top:3},isDirtyHandler:c}),h?s:t.d2.i18n.getTranslation(s),r&&i.a.createElement(d.a,{schema:r}))}var r=n(0),i=n.n(r),s=n(1),l=n.n(s),c=n(83),u=n(316),d=n(3346),p=n(3396),m=n(202),f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e};o.propTypes={children:l.a.oneOfType([l.a.string,l.a.array]),level:l.a.number,isDirtyHandler:l.a.func,schema:l.a.string.isRequired,groupName:l.a.string.isRequired,skipTranslation:l.a.bool},o.defaultProps={isDirtyHandler:function(){},level:2,children:"",skipTranslation:!1},t.a=n.i(c.a)(o)},3396:function(e,t,n){"use strict";function a(e,t){var n={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function o(e,t){var n=e.tooltip,o=e.onClick,r=e.isDirtyHandler,s=void 0===r?u.a.getState.bind(u.a):r,c=a(e,["tooltip","onClick","isDirtyHandler"]),p=function(){s&&s()&&s().dirty?confirm(t.d2.i18n.getTranslation("abandon_unsaved_changes"))&&o.apply(void 0,arguments):o.apply(void 0,arguments)};return i.a.createElement(l.a,d({tooltip:n||t.d2.i18n.getTranslation("back"),tooltipPosition:"bottom-right",onClick:p},c,{iconClassName:"material-icons"}),"")}var r=n(0),i=n.n(r),s=n(203),l=n.n(s),c=n(83),u=n(245),d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e};o.propTypes={tooltip:i.a.PropTypes.string},t.a=n.i(c.a)(o)},3497:function(e,t,n){"use strict";function a(e){var t=e.style,n=void 0===t?{}:t,a=e.large,o=void 0!==a&&a,r=e.small,i=void 0!==r&&r;return s.a.createElement("div",{style:Object.assign({},c,n)},s.a.createElement(l.a,{large:o,small:i}))}t.a=a;var o=n(1),r=n.n(o),i=n(0),s=n.n(i),l=n(150),c={left:"45%",position:"fixed",top:"45%"};a.propTypes={style:r.a.object,large:r.a.bool,small:r.a.bool}},3686:function(e,t,n){"use strict";function a(e,t){var n={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function o(e){var t=e.level,n=e.children,o=a(e,["level","children"]),r=Object.assign({},c,o.style);return i.a.createElement(s.a,l({},o,{style:r,level:t||3}),n)}var r=n(0),i=n.n(r),s=n(316),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},c={fontSize:"1.25rem",paddingTop:".5rem",fontWeight:100};o.propTypes={children:i.a.PropTypes.string,level:i.a.PropTypes.number},t.a=o},3863:function(e,t,n){function a(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var o,r,i=function(){function e(e,t){var n=[],a=!0,o=!1,r=void 0;try{for(var i,s=e[Symbol.iterator]();!(a=(i=s.next()).done)&&(n.push(i.value),!t||n.length!==t);a=!0);}catch(e){o=!0,r=e}finally{try{!a&&s.return&&s.return()}finally{if(o)throw r}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(a,i){"object"===s(t)&&void 0!==e?e.exports=i():(o=i,void 0!==(r="function"==typeof o?o.call(t,n,t,e):o)&&(e.exports=r))}(0,function(){"use strict";function e(e){return function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];return v(e,t,a)}}function t(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:E;u&&u(e,null);for(var a=t.length;a--;){var o=t[a];if("string"==typeof o){var r=n(o);r!==o&&(d(t)||(t[a]=r),o=r)}e[o]=!0}return e}function n(e){for(var t=0;t<e.length;t++){k(e,t)||(e[t]=null)}return e}function o(e){var t=g(null),a=!0,r=!1,l=void 0;try{for(var u,d=c(e)[Symbol.iterator]();!(a=(u=d.next()).done);a=!0){var p=u.value,m=i(p,2),f=m[0],h=m[1];k(e,f)&&(Array.isArray(h)?t[f]=n(h):h&&"object"===(void 0===h?"undefined":s(h))&&h.constructor===Object?t[f]=o(h):t[f]=h)}}catch(e){r=!0,l=e}finally{try{!a&&d.return&&d.return()}finally{if(r)throw l}}return t}function r(t,n){function a(){return null}for(;null!==t;){var o=m(t,n);if(o){if(o.get)return e(o.get);if("function"==typeof o.value)return e(o.value)}t=p(t)}return a}function l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Q(),n=function(e){return l(e)};if(n.version="3.0.9",n.removed=[],!e||!e.document||9!==e.document.nodeType)return n.isSupported=!1,n;var i=e.document,u=i,d=u.currentScript,p=e.DocumentFragment,m=e.HTMLTemplateElement,h=e.Node,y=e.Element,v=e.NodeFilter,b=e.NamedNodeMap,G=void 0===b?e.NamedNodeMap||e.MozNamedAttrMap:b,W=e.HTMLFormElement,B=e.DOMParser,Y=e.trustedTypes,$=y.prototype,X=r($,"cloneNode"),J=r($,"nextSibling"),te=r($,"childNodes"),ne=r($,"parentNode");if("function"==typeof m){var ae=i.createElement("template");ae.content&&ae.content.ownerDocument&&(i=ae.content.ownerDocument)}var oe=void 0,re="",ie=i,se=ie.implementation,le=ie.createNodeIterator,ce=ie.createDocumentFragment,ue=ie.getElementsByTagName,de=u.importNode,pe={};n.isSupported="function"==typeof c&&"function"==typeof ne&&se&&void 0!==se.createHTMLDocument;var me=Z.MUSTACHE_EXPR,fe=Z.ERB_EXPR,he=Z.TMPLIT_EXPR,ge=Z.DATA_ATTR,ye=Z.ARIA_ATTR,ve=Z.IS_SCRIPT_OR_DATA,be=Z.ATTR_WHITESPACE,Te=Z.IS_ALLOWED_URI,Se=null,_e=t({},[].concat(a(D),a(M),a(j),a(L),a(F))),Ee=null,Ce=t({},[].concat(a(U),a(q),a(H),a(z))),we=Object.seal(g(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Oe=null,Ae=null,xe=!0,ke=!0,Re=!1,Ne=!0,De=!1,Me=!1,je=!1,Pe=!1,Le=!1,Ie=!1,Fe=!1,Ue=!0,qe=!1,He=!0,ze=!1,Ge={},We=null,Be=t({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Ye=null,$e=t({},["audio","video","img","source","image","track"]),Ve=null,Xe=t({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Je="http://www.w3.org/1998/Math/MathML",Ke="http://www.w3.org/2000/svg",Ze="http://www.w3.org/1999/xhtml",Qe=Ze,et=!1,tt=null,nt=t({},[Je,Ke,Ze],C),at=null,ot=["application/xhtml+xml","text/html"],rt=null,it=null,st=i.createElement("form"),lt=function(e){return e instanceof RegExp||e instanceof Function},ct=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!it||it!==e){if(e&&"object"===(void 0===e?"undefined":s(e))||(e={}),e=o(e),at=-1===ot.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,rt="application/xhtml+xml"===at?C:E,Se=k(e,"ALLOWED_TAGS")?t({},e.ALLOWED_TAGS,rt):_e,Ee=k(e,"ALLOWED_ATTR")?t({},e.ALLOWED_ATTR,rt):Ce,tt=k(e,"ALLOWED_NAMESPACES")?t({},e.ALLOWED_NAMESPACES,C):nt,Ve=k(e,"ADD_URI_SAFE_ATTR")?t(o(Xe),e.ADD_URI_SAFE_ATTR,rt):Xe,Ye=k(e,"ADD_DATA_URI_TAGS")?t(o($e),e.ADD_DATA_URI_TAGS,rt):$e,We=k(e,"FORBID_CONTENTS")?t({},e.FORBID_CONTENTS,rt):Be,Oe=k(e,"FORBID_TAGS")?t({},e.FORBID_TAGS,rt):{},Ae=k(e,"FORBID_ATTR")?t({},e.FORBID_ATTR,rt):{},Ge=!!k(e,"USE_PROFILES")&&e.USE_PROFILES,xe=!1!==e.ALLOW_ARIA_ATTR,ke=!1!==e.ALLOW_DATA_ATTR,Re=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ne=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,De=e.SAFE_FOR_TEMPLATES||!1,Me=e.WHOLE_DOCUMENT||!1,Le=e.RETURN_DOM||!1,Ie=e.RETURN_DOM_FRAGMENT||!1,Fe=e.RETURN_TRUSTED_TYPE||!1,Pe=e.FORCE_BODY||!1,Ue=!1!==e.SANITIZE_DOM,qe=e.SANITIZE_NAMED_PROPS||!1,He=!1!==e.KEEP_CONTENT,ze=e.IN_PLACE||!1,Te=e.ALLOWED_URI_REGEXP||V,Qe=e.NAMESPACE||Ze,we=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&<(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(we.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&<(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(we.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(we.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),De&&(ke=!1),Ie&&(Le=!0),Ge&&(Se=t({},F),Ee=[],!0===Ge.html&&(t(Se,D),t(Ee,U)),!0===Ge.svg&&(t(Se,M),t(Ee,q),t(Ee,z)),!0===Ge.svgFilters&&(t(Se,j),t(Ee,q),t(Ee,z)),!0===Ge.mathMl&&(t(Se,L),t(Ee,H),t(Ee,z))),e.ADD_TAGS&&(Se===_e&&(Se=o(Se)),t(Se,e.ADD_TAGS,rt)),e.ADD_ATTR&&(Ee===Ce&&(Ee=o(Ee)),t(Ee,e.ADD_ATTR,rt)),e.ADD_URI_SAFE_ATTR&&t(Ve,e.ADD_URI_SAFE_ATTR,rt),e.FORBID_CONTENTS&&(We===Be&&(We=o(We)),t(We,e.FORBID_CONTENTS,rt)),He&&(Se["#text"]=!0),Me&&t(Se,["html","head","body"]),Se.table&&(t(Se,["tbody"]),delete Oe.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw N('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw N('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');oe=e.TRUSTED_TYPES_POLICY,re=oe.createHTML("")}else void 0===oe&&(oe=ee(Y,d)),null!==oe&&"string"==typeof re&&(re=oe.createHTML(""));f&&f(e),it=e}},ut=t({},["mi","mo","mn","ms","mtext"]),dt=t({},["foreignobject","desc","title","annotation-xml"]),pt=t({},["title","style","font","a","script"]),mt=t({},[].concat(a(M),a(j),a(P))),ft=t({},[].concat(a(L),a(I))),ht=function(e){var t=ne(e);t&&t.tagName||(t={namespaceURI:Qe,tagName:"template"});var n=E(e.tagName),a=E(t.tagName);return!!tt[e.namespaceURI]&&(e.namespaceURI===Ke?t.namespaceURI===Ze?"svg"===n:t.namespaceURI===Je?"svg"===n&&("annotation-xml"===a||ut[a]):Boolean(mt[n]):e.namespaceURI===Je?t.namespaceURI===Ze?"math"===n:t.namespaceURI===Ke?"math"===n&&dt[a]:Boolean(ft[n]):e.namespaceURI===Ze?!(t.namespaceURI===Ke&&!dt[a])&&(!(t.namespaceURI===Je&&!ut[a])&&(!ft[n]&&(pt[n]||!mt[n]))):!("application/xhtml+xml"!==at||!tt[e.namespaceURI]))},gt=function(e){_(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},yt=function(e,t){try{_(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){_(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!Ee[e])if(Le||Ie)try{gt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},vt=function(e){var t=null,n=null;if(Pe)e="<remove></remove>"+e;else{var a=w(e,/^[\r\n\t ]+/);n=a&&a[0]}"application/xhtml+xml"===at&&Qe===Ze&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var o=oe?oe.createHTML(e):e;if(Qe===Ze)try{t=(new B).parseFromString(o,at)}catch(e){}if(!t||!t.documentElement){t=se.createDocument(Qe,"template",null);try{t.documentElement.innerHTML=et?re:o}catch(e){}}var r=t.body||t.documentElement;return e&&n&&r.insertBefore(i.createTextNode(n),r.childNodes[0]||null),Qe===Ze?ue.call(t,Me?"html":"body")[0]:Me?t.documentElement:r},bt=function(e){return le.call(e.ownerDocument||e,e,v.SHOW_ELEMENT|v.SHOW_COMMENT|v.SHOW_TEXT,null)},Tt=function(e){return e instanceof W&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof G)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},St=function(e){return"function"==typeof h&&e instanceof h},_t=function(e,t,a){pe[e]&&T(pe[e],function(e){e.call(n,t,a,it)})},Et=function(e){var t=null;if(_t("beforeSanitizeElements",e,null),Tt(e))return gt(e),!0;var a=rt(e.nodeName);if(_t("uponSanitizeElement",e,{tagName:a,allowedTags:Se}),e.hasChildNodes()&&!St(e.firstElementChild)&&R(/<[/\w]/g,e.innerHTML)&&R(/<[/\w]/g,e.textContent))return gt(e),!0;if(!Se[a]||Oe[a]){if(!Oe[a]&&wt(a)){if(we.tagNameCheck instanceof RegExp&&R(we.tagNameCheck,a))return!1;if(we.tagNameCheck instanceof Function&&we.tagNameCheck(a))return!1}if(He&&!We[a]){var o=ne(e)||e.parentNode,r=te(e)||e.childNodes;if(r&&o)for(var i=r.length,s=i-1;s>=0;--s)o.insertBefore(X(r[s],!0),J(e))}return gt(e),!0}return e instanceof y&&!ht(e)?(gt(e),!0):"noscript"!==a&&"noembed"!==a&&"noframes"!==a||!R(/<\/no(script|embed|frames)/i,e.innerHTML)?(De&&3===e.nodeType&&(t=e.textContent,T([me,fe,he],function(e){t=O(t,e," ")}),e.textContent!==t&&(_(n.removed,{element:e.cloneNode()}),e.textContent=t)),_t("afterSanitizeElements",e,null),!1):(gt(e),!0)},Ct=function(e,t,n){if(Ue&&("id"===t||"name"===t)&&(n in i||n in st))return!1;if(ke&&!Ae[t]&&R(ge,t));else if(xe&&R(ye,t));else if(!Ee[t]||Ae[t]){if(!(wt(e)&&(we.tagNameCheck instanceof RegExp&&R(we.tagNameCheck,e)||we.tagNameCheck instanceof Function&&we.tagNameCheck(e))&&(we.attributeNameCheck instanceof RegExp&&R(we.attributeNameCheck,t)||we.attributeNameCheck instanceof Function&&we.attributeNameCheck(t))||"is"===t&&we.allowCustomizedBuiltInElements&&(we.tagNameCheck instanceof RegExp&&R(we.tagNameCheck,n)||we.tagNameCheck instanceof Function&&we.tagNameCheck(n))))return!1}else if(Ve[t]);else if(R(Te,O(n,be,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==A(n,"data:")||!Ye[e]){if(Re&&!R(ve,O(n,be,"")));else if(n)return!1}else;return!0},wt=function(e){return"annotation-xml"!==e&&e.indexOf("-")>0},Ot=function(e){_t("beforeSanitizeAttributes",e,null);var t=e.attributes;if(t){for(var a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ee},o=t.length;o--;){(function(){var r=t[o],i=r.name,l=r.namespaceURI,c=r.value,u=rt(i),d="value"===i?c:x(c);if(a.attrName=u,a.attrValue=d,a.keepAttr=!0,a.forceKeepAttr=void 0,_t("uponSanitizeAttribute",e,a),d=a.attrValue,a.forceKeepAttr)return"continue";if(yt(i,e),!a.keepAttr)return"continue";if(!Ne&&R(/\/>/i,d))return yt(i,e),"continue";De&&T([me,fe,he],function(e){d=O(d,e," ")});var p=rt(e.nodeName);if(!Ct(p,u,d))return"continue";if(!qe||"id"!==u&&"name"!==u||(yt(i,e),d="user-content-"+d),oe&&"object"===(void 0===Y?"undefined":s(Y))&&"function"==typeof Y.getAttributeType)if(l);else switch(Y.getAttributeType(p,u)){case"TrustedHTML":d=oe.createHTML(d);break;case"TrustedScriptURL":d=oe.createScriptURL(d)}try{l?e.setAttributeNS(l,i,d):e.setAttribute(i,d),S(n.removed)}catch(e){}})()}_t("afterSanitizeAttributes",e,null)}},At=function e(t){var n=null,a=bt(t);for(_t("beforeSanitizeShadowDOM",t,null);n=a.nextNode();)_t("uponSanitizeShadowNode",n,null),Et(n)||(n.content instanceof p&&e(n.content),Ot(n));_t("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=null,o=null,r=null,i=null;if(et=!e,et&&(e="\x3c!--\x3e"),"string"!=typeof e&&!St(e)){if("function"!=typeof e.toString)throw N("toString is not a function");if("string"!=typeof(e=e.toString()))throw N("dirty is not a string, aborting")}if(!n.isSupported)return e;if(je||ct(t),n.removed=[],"string"==typeof e&&(ze=!1),ze){if(e.nodeName){var s=rt(e.nodeName);if(!Se[s]||Oe[s])throw N("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof h)a=vt("\x3c!----\x3e"),o=a.ownerDocument.importNode(e,!0),1===o.nodeType&&"BODY"===o.nodeName?a=o:"HTML"===o.nodeName?a=o:a.appendChild(o);else{if(!Le&&!De&&!Me&&-1===e.indexOf("<"))return oe&&Fe?oe.createHTML(e):e;if(!(a=vt(e)))return Le?null:Fe?re:""}a&&Pe&>(a.firstChild);for(var l=bt(ze?e:a);r=l.nextNode();)Et(r)||(r.content instanceof p&&At(r.content),Ot(r));if(ze)return e;if(Le){if(Ie)for(i=ce.call(a.ownerDocument);a.firstChild;)i.appendChild(a.firstChild);else i=a;return(Ee.shadowroot||Ee.shadowrootmode)&&(i=de.call(u,i,!0)),i}var c=Me?a.outerHTML:a.innerHTML;return Me&&Se["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&R(K,a.ownerDocument.doctype.name)&&(c="<!DOCTYPE "+a.ownerDocument.doctype.name+">\n"+c),De&&T([me,fe,he],function(e){c=O(c,e," ")}),oe&&Fe?oe.createHTML(c):c},n.setConfig=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ct(e),je=!0},n.clearConfig=function(){it=null,je=!1},n.isValidAttribute=function(e,t,n){it||ct({});var a=rt(e),o=rt(t);return Ct(a,o,n)},n.addHook=function(e,t){"function"==typeof t&&(pe[e]=pe[e]||[],_(pe[e],t))},n.removeHook=function(e){if(pe[e])return S(pe[e])},n.removeHooks=function(e){pe[e]&&(pe[e]=[])},n.removeAllHooks=function(){pe={}},n}var c=Object.entries,u=Object.setPrototypeOf,d=Object.isFrozen,p=Object.getPrototypeOf,m=Object.getOwnPropertyDescriptor,f=Object.freeze,h=Object.seal,g=Object.create,y="undefined"!=typeof Reflect&&Reflect,v=y.apply,b=y.construct;f||(f=function(e){return e}),h||(h=function(e){return e}),v||(v=function(e,t,n){return e.apply(t,n)}),b||(b=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(a(t))))});var T=e(Array.prototype.forEach),S=e(Array.prototype.pop),_=e(Array.prototype.push),E=e(String.prototype.toLowerCase),C=e(String.prototype.toString),w=e(String.prototype.match),O=e(String.prototype.replace),A=e(String.prototype.indexOf),x=e(String.prototype.trim),k=e(Object.prototype.hasOwnProperty),R=e(RegExp.prototype.test),N=function(e){return function(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return b(e,n)}}(TypeError),D=f(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),M=f(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),j=f(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),P=f(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),L=f(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),I=f(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),F=f(["#text"]),U=f(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),q=f(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),H=f(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),z=f(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),G=h(/\{\{[\w\W]*|[\w\W]*\}\}/gm),W=h(/<%[\w\W]*|[\w\W]*%>/gm),B=h(/\${[\w\W]*}/gm),Y=h(/^data-[\-\w.\u00B7-\uFFFF]/),$=h(/^aria-[\-\w]+$/),V=h(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),X=h(/^(?:\w+script|data):/i),J=h(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),K=h(/^html$/i),Z=Object.freeze({__proto__:null,MUSTACHE_EXPR:G,ERB_EXPR:W,TMPLIT_EXPR:B,DATA_ATTR:Y,ARIA_ATTR:$,IS_ALLOWED_URI:V,IS_SCRIPT_OR_DATA:X,ATTR_WHITESPACE:J,DOCTYPE_NAME:K}),Q=function(){return"undefined"==typeof window?null:window},ee=function(e,t){if("object"!==(void 0===e?"undefined":s(e))||"function"!=typeof e.createPolicy)return null;var n=null;t&&t.hasAttribute("data-tt-policy-suffix")&&(n=t.getAttribute("data-tt-policy-suffix"));var a="dompurify"+(n?"#"+n:"");try{return e.createPolicy(a,{createHTML:function(e){return e},createScriptURL:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+a+" could not be created."),null}};return l()})},3867:function(e,t,n){"use strict";function a(e,t){var n={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l=n(0),c=n.n(l),u=n(19),d=n.n(u),p=n(437),m=n.n(p),f=n(151),h=n.n(f),g=n(200),y=n.n(g),v=n(736),b=n.n(v),T=n(67),S=n(84),_=n(245),E=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},C=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),w={dialogContent:{maxWidth:"none"},dialogDiv:{overflowX:"auto",overflowY:"hidden"},table:{borderSpacing:0,borderCollapse:"collapse",margin:"32px auto"},th:{whiteSpace:"nowrap",textAlign:"center",border:"1px solid #e0e0e0",padding:6},thDataElements:{whiteSpace:"nowrap",border:"1px solid #e0e0e0",background:"#f0f0f0",textAlign:"left",padding:6},td:{whiteSpace:"nowrap",padding:2,border:"1px solid #e0e0e0",minWidth:105},tdDataElement:{whiteSpace:"nowrap",padding:6,border:"1px solid #e0e0e0"}},O=function(e){function t(e,n){r(this,t);var a=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return a.state={categories:[]},a.closeDialog=a.closeDialog.bind(a),a.handleSaveClick=a.handleSaveClick.bind(a),a.getTranslation=n.d2.i18n.getTranslation.bind(n.d2.i18n),a}return s(t,e),C(t,[{key:"componentWillReceiveProps",value:function(e){var t=this,n=this.context.d2;if(e.sectionModel){if(e.sectionModel.dataElements.toArray().length<1)return d.a.info("Section "+e.sectionModel.displayName+" contains no data elements"),S.a.show({message:this.getTranslation("this_section_has_no_data_elements"),action:"ok"}),void this.props.onRequestClose();var a={},o=function(e){for(var t=null,n=function(e,n){var a=e;return a[n.id]=t,a};e.length>0;)t=e.pop().categoryOptions.toArray().reduce(n,{});return t},r=function e(t,n,a){return n.length>0?Object.keys(t).reduce(function(o,r){var i=o,s=n.indexOf(r);return-1!==s?(n.splice(s,1),i[r]=e(t[r],n,a),i):(i[r]=t[r],i)},{}):a};n.models.categoryCombos.list({filter:"id:in:["+e.sectionModel.categoryCombos.toArray().map(function(e){return e.id})+"]",paging:!1,fields:["id,displayName","categories[id,displayName,categoryOptions[id,displayName]]","categoryOptionCombos[id,displayName","categoryOptions[id,displayName]]"].join(",")}).then(function(n){n.forEach(function(e){Object.assign(a,JSON.parse(JSON.stringify(o(e.categories.toArray())))),e.categoryOptionCombos.toArray().forEach(function(e){var t=e.categoryOptions.toArray().map(function(e){return e.id});a=r(a,t,{id:e.id,displayName:e.displayName})})});var i=e.sectionModel.greyedFields.reduce(function(e,t){if(e.hasOwnProperty(t.dataElement.id))return e[t.dataElement.id].push(t.categoryOptionCombo.id),e;var n=e;return n[t.dataElement.id]=[t.categoryOptionCombo.id],n},{});t.setState({currentCategoryCombo:n.toArray()[0].id,categoryCombos:n,optionCount:n.toArray().reduce(function(e,t){return e[t.id]=t.categories.toArray().map(function(e){return e.categoryOptions.size}),e},{}),cocMap:a,greyedFields:i})})}}},{key:"closeDialog",value:function(){this.props.onRequestClose()}},{key:"handleSaveClick",value:function(){var e=this,t=[];Object.keys(this.state.greyedFields).forEach(function(n){e.state.greyedFields[n].forEach(function(e){t.push({dataElement:{id:n},categoryOptionCombo:{id:e}})})});var n=Object.assign(this.props.sectionModel,{greyedFields:t});n.save().then(function(t){d.a.info("Section updated",t),S.a.show({message:e.getTranslation("section_saved")}),e.props.onRequestSave(n)}).catch(function(t){d.a.error("Failed to save section:",t),S.a.show({message:e.getTranslation("failed_to_save_section"),action:"ok"})})}},{key:"renderTableHeader",value:function(){var e=this,t=1;return this.state.currentCategoryCombo&&this.state.categoryCombos.get(this.state.currentCategoryCombo).categories.toArray().map(function(n,a){var r=e.state.optionCount[e.state.currentCategoryCombo].slice(a+1).reduce(function(e,t){return t*e},1),i=a===e.state.categoryCombos.get(e.state.currentCategoryCombo).categories.size-1,s=c.a.createElement("tr",{key:a},c.a.createElement("th",{style:w.thDataElements},i&&e.getTranslation("data_element")),Array.apply(void 0,o(Array(t))).map(function(e,t){return n.categoryOptions.toArray().map(function(e,n){return c.a.createElement("th",{key:n+"."+t,colSpan:r,style:w.th},"default"===e.displayName?"":e.displayName)})}));return t*=n.categoryOptions.size,s})}},{key:"renderCheckbox",value:function(e,t,n){var a=this,o=function e(t,n){return 0===n.length?t:e(t[n.shift()],n)}(this.state.cocMap,t),r=this.state.greyedFields.hasOwnProperty(e.id)&&-1!==this.state.greyedFields[e.id].indexOf(o.id),i=function(e,t,n,o){a.setState(function(n){var a=(n.greyedFields[e]||[]).slice();o?a.includes(t)&&a.splice(a.indexOf(t),1):a.includes(t)||a.push(t);var r=Object.keys(n.greyedFields).reduce(function(t,o){var r=t;return r[o]=o===e?a:n.greyedFields[o],r},{});return a.length>0&&!r.hasOwnProperty(e)&&(r[e]=a),{greyedFields:r}})}.bind(this,e.id,o.id);return c.a.createElement("td",{key:n,style:w.td},c.a.createElement(b.a,{checked:!r,label:r?this.getTranslation("disabled"):this.getTranslation("enabled"),labelPosition:"right",labelStyle:{whiteSpace:"nowrap"},onCheck:i}))}},{key:"renderDataElements",value:function(){var e=this,t=function(){return e.state.categoryCombos.get(e.state.currentCategoryCombo).categories.toArray().reduce(function(e,t){if(e.length>0){var n=[];return e.forEach(function(e){t.categoryOptions.toArray().forEach(function(t){var a=e.slice();a.push(t.id),n.push(a)})}),n}return t.categoryOptions.toArray().forEach(function(t){e.push([t.id])}),e},[])},n=this.props.sectionModel.dataElements.toArray().map(function(e){return e.id});return this.state.currentCategoryCombo?_.a.state.dataSetElements.filter(function(e){return n.includes(e.dataElement.id)}).filter(function(t){return(t.categoryCombo?t.categoryCombo.id:t.dataElement.categoryCombo.id)===e.state.currentCategoryCombo}).sort(function(e,t){return n.indexOf(e.dataElement.id)-n.indexOf(t.dataElement.id)}).map(function(n,a){var o=t();return c.a.createElement("tr",{key:a,style:{background:a%2==0?"none":"#f0f0f0"}},c.a.createElement("td",{style:w.tdDataElement},n.dataElement.displayName),o.map(function(t,a){return e.renderCheckbox(n.dataElement,t,a)}))}):null}},{key:"render",value:function(){var e=this,t=this.props.sectionModel.displayName,n=this.props,o=n.open,r=a(n,["open"]),i=[],s=[],l=[];return this.props.sectionModel&&(s=this.props.sectionModel.dataElements.toArray().map(function(e){return e.id}),l=_.a.state.dataSetElements.filter(function(e){return s.includes(e.dataElement.id)}).map(function(e){return e.categoryCombo||e.dataElement.categoryCombo}).reduce(function(e,t){return i.includes(t.id)||(i.push(t.id),e.push(t)),e},[]).sort(function(e,t){return e.displayName.localeCompare(t.displayName)})),c.a.createElement(m.a,E({autoScrollBodyContent:!0,autoDetectWindowHeight:!0,title:this.getTranslation("manage_grey_fields")+": "+t,style:{maxWidth:"none"},contentStyle:w.dialogContent,open:o&&this.props.sectionModel.dataElements.size>0},r,{actions:[c.a.createElement(h.a,{label:this.getTranslation("cancel"),onTouchTap:this.closeDialog,style:{marginRight:16}}),c.a.createElement(y.a,{primary:!0,label:this.getTranslation("save"),onTouchTap:this.handleSaveClick})],onRequestClose:this.closeDialog}),this.props.sectionModel&&this.props.sectionModel.categoryCombos&&this.props.sectionModel.categoryCombos.size>1?c.a.createElement(T.a,{options:l.map(function(t){return{value:t.id,text:"default"===t.displayName?e.getTranslation("none"):t.displayName}}),labelText:this.getTranslation("category_combo"),value:this.state.currentCategoryCombo,onChange:function(t){return e.setState({currentCategoryCombo:t.target.value})},style:{width:"33%"},isRequired:!0}):null,c.a.createElement("div",{style:w.dialogDiv},c.a.createElement("table",{style:w.table},c.a.createElement("tbody",null,this.renderTableHeader(),this.state.currentCategoryCombo&&this.props.sectionModel&&this.renderDataElements()))))}}]),t}(c.a.Component);O.contextTypes={d2:c.a.PropTypes.any.isRequired},O.propTypes={open:c.a.PropTypes.bool.isRequired,sectionModel:c.a.PropTypes.any.isRequired,onRequestClose:c.a.PropTypes.func.isRequired,onRequestSave:c.a.PropTypes.func.isRequired},t.a=O},3868:function(e,t,n){"use strict";function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=n(0),l=n.n(s),c=n(19),u=n.n(c),d=n(437),p=n.n(d),m=n(151),f=n.n(m),h=n(200),g=n.n(h),y=n(58),v=n.n(y),b=n(745),T=(n.n(b),n(453)),S=n(44),_=n(256),E=n.n(_),C=n(67),w=n(84),O=n(245),A=n(171),x=n.n(A),k=n(744),R=(n.n(k),n(3863)),N=(n.n(R),function(){function e(e,t){var n=[],a=!0,o=!1,r=void 0;try{for(var i,s=e[Symbol.iterator]();!(a=(i=s.next()).done)&&(n.push(i.value),!t||n.length!==t);a=!0);}catch(e){o=!0,r=e}finally{try{!a&&s.return&&s.return()}finally{if(o)throw r}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()),D=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),M=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},j=S.a.create(),P=S.a.create(),L=S.a.create(),I=S.a.create(),F=function(e){return M({},e,{beforeSectionText:n.i(R.sanitize)(e.beforeSectionText),afterSectionText:n.i(R.sanitize)(e.afterSectionText)})},U=function(e){function t(e,n){o(this,t);var i=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return i.setAssignedDataElements=function(e){P.setState(e)},i.setAssignedIndicators=function(e){I.setState(e)},i.removeIndicators=function(e){return I.setState(I.state.filter(function(t){return-1===e.indexOf(t)})),Promise.resolve()},i.assignIndicators=function(e){return I.setState(I.state.concat(e)),Promise.resolve()},i.handleRowTotalsChange=function(e,t){i.setState({showRowTotals:t})},i.handleColumnTotalsChange=function(e,t){i.setState({showColumnTotals:t})},i.handleDisableDataElementAutoGroupChange=function(e,t){i.setState({disableDataElementAutoGroup:t})},i.handleFilterChange=function(e){i.setState({filterText:e.target.value})},i.handleNameChange=function(e){var t=Array.isArray(O.a.getState().sections)?O.a.getState().sections:O.a.getState().sections.toArray(),n=t.filter(function(e){return e.id!==i.props.sectionModel.id}).reduce(function(t,n){return t||n.name===e.target.value},!1);i.setState({name:e.target.value,nameError:n?i.getTranslation("value_not_unique"):""})},i.handleCodeChange=function(e){var t=Array.isArray(O.a.getState().sections)?O.a.getState().sections:O.a.getState().sections.toArray(),n=t.filter(function(e){return e.id!==i.props.sectionModel.id}).reduce(function(t,n){return t||n.code&&n.code===e.target.value},!1);i.setState({code:e.target.value,codeError:n?i.getTranslation("value_not_unique"):""})},i.handleDescriptionChange=function(e){i.setState({description:e.target.value})},i.assignDataElements=function(e){return P.setState(P.state.concat(e)),Promise.resolve()},i.removeDataElements=function(e){return P.setState(P.state.filter(function(t){return-1===e.indexOf(t)})),Promise.resolve()},i.handleCategoryComboChange=function(e){var t=e.target.value;O.a.state.dataSetElements&&j.setState(O.a.state.dataSetElements.filter(function(e){return!t||(e.categoryCombo?e.categoryCombo.id===t:e.dataElement.categoryCombo.id===t)}).filter(function(e){return!i.state.filterDataElementIds||!i.state.filterDataElementIds.includes(e.dataElement.id)}).map(function(e){return{value:e.dataElement.id,text:e.dataElement.displayName}}).sort(function(e,t){return e.text.localeCompare(t.text)})),i.setState({categoryCombo:t})},i.saveSection=function(){if(!i.state.name||0===i.state.name.trim().length)return void w.a.show({message:i.getTranslation("name_is_required"),action:i.getTranslation("ok")});var e=i.props.sectionModel.id?i.props.sectionModel:i.props.sectionModel.modelDefinition.create(),t=F(i.state.displayOptions);Object.assign(e,{dataSet:{id:O.a.state.id},name:i.state.name,code:i.state.code,description:i.state.description,showRowTotals:i.state.showRowTotals,showColumnTotals:i.state.showColumnTotals,displayOptions:JSON.stringify(t),disableDataElementAutoGroup:i.state.disableDataElementAutoGroup,dataElements:P.state.map(function(e){return{id:e}}),indicators:I.state.map(function(e){return{id:e}}),sortOrder:i.props.sectionModel.sortOrder||O.a.state.sections.toArray().reduce(function(e,t){return Math.max(e,t.sortOrder+1)},0)}),e.save().then(function(e){w.a.show({message:i.getTranslation("section_saved")}),i.context.d2.models.sections.get(e.response.uid,{fields:[":all,dataElements[id,categoryCombo[id,displayName]]","greyedFields[categoryOptionCombo,dataElement]"].join(",")}).then(function(e){i.props.onSaveSection(e)})}).catch(function(e){u.a.warn("Failed to save section:",e),w.a.show({message:i.getTranslation("failed_to_save_section"),action:i.getTranslation("ok")})})},i.handleChoosePivotMode=function(e,t){var n=i.state.categories||[],a=N(n,1),o=a[0],r=o?o.id:null,s="move_categories"===t?r:null;i.setState({displayOptions:M({},i.state.displayOptions,{pivotMode:t,pivotedCategory:s})})},i.handlePivotCategoryChoice=function(e,t,n){i.setState({displayOptions:M({},i.state.displayOptions,{pivotedCategory:n})})},i.handleSectionTextUpdate=function(e){return function(t,n){i.setState(function(t){return{displayOptions:M({},t.displayOptions,a({},e,n))}})}},i.renderSectionDisplayConfigurationOptions=function(){var e=[{value:"n/a",text:i.getTranslation("pivot_default")},{value:"pivot",text:i.getTranslation("pivot_move_data_elements_to_column")},{value:"move_categories",text:i.getTranslation("pivot_move_category_to_row")}],t="move_categories"===i.state.displayOptions.pivotMode;return l.a.createElement("div",null,l.a.createElement("label",null,i.getTranslation("pivot_options")),l.a.createElement(b.RadioButtonGroup,{onChange:i.handleChoosePivotMode,valueSelected:i.state.displayOptions.pivotMode,name:"pivotOptions",defaultSelected:"n/a"},e.map(function(e){var t=e.value,n=e.text;return l.a.createElement(b.RadioButton,{key:t,value:t,label:n,style:{margin:"10px"}})})),t&&l.a.createElement(x.a,{style:{marginLeft:"50px",marginTop:"-16px"},floatingLabelFixed:!0,floatingLabelText:i.getTranslation("pivot_category_to_move_to_row"),value:i.state.displayOptions.pivotedCategory,onChange:i.handlePivotCategoryChoice},i.state.categories.map(function(e){return l.a.createElement(k.MenuItem,{value:e.id,primaryText:e.displayName})})),l.a.createElement("div",{style:{marginTop:"16px"}},l.a.createElement("label",null,i.getTranslation("section_text_descriptions")),l.a.createElement(v.a,{fullWidth:!0,hintText:i.getTranslation("section_before_text"),defaultValue:i.state.displayOptions.beforeSectionText,onChange:i.handleSectionTextUpdate("beforeSectionText")}),l.a.createElement(v.a,{fullWidth:!0,hintText:i.getTranslation("section_after_text"),defaultValue:i.state.displayOptions.afterSectionText,onChange:i.handleSectionTextUpdate("afterSectionText")})))},i.renderFilters=function(){var e=[{value:!1,text:i.getTranslation("no_filter")}].concat(i.props.categoryCombos.sort(function(e,t){return e.text.localeCompare(t.text)}));return l.a.createElement("div",{style:{minWidth:605}},l.a.createElement(C.a,{options:e,labelText:i.getTranslation("category_combo_filter"),onChange:i.handleCategoryComboChange,value:i.state.categoryCombo,isRequired:!0,disabled:1===i.props.categoryCombos.length,style:{width:284}}),l.a.createElement(v.a,{fullWidth:!0,hintText:i.getTranslation("search_available_selected_items"),defaultValue:i.state.filterText,onChange:i.handleFilterChange}))},i.renderAvailableOptions=function(){var e={position:"relative",display:"block",width:"100%",lineHeight:"24px",color:"rgba(0,0,0,0.3)",marginTop:"1.25rem",fontSize:16},t={marginBottom:80};return l.a.createElement("div",null,l.a.createElement("div",{style:t},l.a.createElement("label",{style:e},i.getTranslation("data_elements")),l.a.createElement(T.a,{itemStore:j,assignedItemStore:P,onAssignItems:i.assignDataElements,onRemoveItems:i.removeDataElements,onOrderChanged:i.setAssignedDataElements,height:250,filterText:i.state.filterText})),L.state.length?l.a.createElement("div",{style:t},l.a.createElement("label",{style:e},i.getTranslation("indicators")),l.a.createElement(T.a,{itemStore:L,assignedItemStore:I,onAssignItems:i.assignIndicators,onRemoveItems:i.removeIndicators,onOrderChanged:i.setAssignedIndicators,height:250,filterText:i.state.filterText})):null)},i.state={categoryCombo:!1,disableDataElementAutoGroup:!1,displayOptions:{pivotMode:null,pivotedCategory:null},categories:[]},j.setState([]),P.setState([]),L.setState([]),I.setState([]),i.getTranslation=n.d2.i18n.getTranslation.bind(n.d2.i18n),i}return i(t,e),D(t,[{key:"componentDidMount",value:function(){var e=this;this.subscriptions=[],this.subscriptions.push(P.subscribe(function(){e.forceUpdate()}));var t=this.context.d2,n=this.props.categoryCombos.map(function(e){return e.value}).join(",");return t.models.categories.list({filter:"categoryCombos.id:in:["+n+"]",paging:!1,fields:["id,displayName","categoryCombos[id]"].join(",")}).then(function(t){var n=t.toArray();e.setState({categories:n})}).catch(function(e){w.a.show({message:"Something went wrong."+e,action:"ok"})})}},{key:"componentWillReceiveProps",value:function(e){var t=this;if(e.sectionModel){var n=e.sectionModel.id,a=O.a.state.sections,o=Array.isArray(a)?a:a.toArray(),r=o.filter(function(e){return e.id!==n}),i=r.reduce(function(e,t){return e.concat((Array.isArray(t.dataElements)?t.dataElements:t.dataElements.toArray()).map(function(e){return e.id}))},[]);P.setState(e.sectionModel.dataElements?e.sectionModel.dataElements.toArray().map(function(e){return e.id}):[]),L.setState(O.a.state.indicators.toArray().map(function(e){return{value:e.id,text:e.displayName}}).sort(function(e,t){return e.text.localeCompare(t.text)})),I.setState(e.sectionModel.indicators?e.sectionModel.indicators.toArray().map(function(e){return e.id}):[]),this.setState({name:e.sectionModel.name,code:e.sectionModel.code,nameError:"",codeError:"",description:e.sectionModel.description,showRowTotals:e.sectionModel.showRowTotals,showColumnTotals:e.sectionModel.showColumnTotals,displayOptions:e.sectionModel.displayOptions?JSON.parse(e.sectionModel.displayOptions):{},disableDataElementAutoGroup:e.sectionModel.disableDataElementAutoGroup,filterText:"",filterDataElementIds:i},function(){t.handleCategoryComboChange({target:{value:!1}}),t.forceUpdate()})}}},{key:"componentWillUnmount",value:function(){this.subscriptions.forEach(function(e){return e.unsubscribe()})}},{key:"render",value:function(){var e=this,t=this.getTranslation("add_section"),n=null;this.props.sectionModel.id&&(t=this.getTranslation("edit_section"),n=l.a.createElement("div",{style:{float:"left",padding:8,color:"rgba(0,0,0,0.5)"}},this.getTranslation("section_id"),":",l.a.createElement("span",{style:{fontFamily:"monospace"}},this.props.sectionModel.id)));var a=function(t){e.setState({nameError:t.target.value.trim().length>0?"":e.getTranslation("value_required")})};return l.a.createElement(p.a,M({autoScrollBodyContent:!0,title:t,actions:[n,l.a.createElement(f.a,{label:this.getTranslation("cancel"),onTouchTap:this.props.onRequestClose,style:{marginRight:24}}),l.a.createElement(g.a,{primary:!0,label:this.getTranslation("save"),onTouchTap:this.saveSection})]},this.props),l.a.createElement(v.a,{floatingLabelText:this.getTranslation("name")+" *",value:this.state.name||"",style:{width:"100%"},onChange:this.handleNameChange,errorText:this.state.nameError,onBlur:a}),l.a.createElement(v.a,{floatingLabelText:this.getTranslation("code"),value:this.state.code||"",style:{width:"100%"},onChange:this.handleCodeChange,errorText:this.state.codeError}),l.a.createElement(v.a,{floatingLabelText:this.getTranslation("description"),value:this.state.description||"",style:{width:"100%"},multiLine:!0,onChange:this.handleDescriptionChange}),l.a.createElement(E.a,{label:this.getTranslation("show_row_totals"),checked:this.state.showRowTotals,style:{margin:"16px 0"},onCheck:this.handleRowTotalsChange}),l.a.createElement(E.a,{label:this.getTranslation("show_column_totals"),checked:this.state.showColumnTotals,style:{margin:"16px 0"},onCheck:this.handleColumnTotalsChange}),l.a.createElement(E.a,{label:this.getTranslation("disable_data_element_auto_group"),checked:this.state.disableDataElementAutoGroup,style:{margin:"16px 0"},onCheck:this.handleDisableDataElementAutoGroupChange}),this.renderFilters(),this.renderAvailableOptions(),this.renderSectionDisplayConfigurationOptions())}}]),t}(l.a.Component);U.propTypes={open:l.a.PropTypes.bool.isRequired,sectionModel:l.a.PropTypes.any.isRequired,categoryCombos:l.a.PropTypes.array.isRequired,onRequestClose:l.a.PropTypes.func.isRequired,onSaveSection:l.a.PropTypes.func.isRequired},U.contextTypes={d2:l.a.PropTypes.any.isRequired},t.a=U}});
//# sourceMappingURL=8-fd5ef347026a0fd2f506.js.map