(function(t){function e(e){for(var a,l,r=e,o=e,c=e,p=0,d=[];p,Object.prototype.hasOwnProperty.call(s,l)&&s&&d.push(s[0]),s=0;for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&(t=o);u&&u(e);while(d.length)d.shift()();return i.push.apply(i,c||[]),n()}function n(){for(var t,e=0;e<i.length;e++){for(var n=i,a=!0,r=1;r<n.length;r++){var o=n;0!==s&&(a=!1)}a&&(i.splice(e–,1),t=l(l.s=n))}return t}var a={},s={app:0},i=[];function l(e){if(a)return a.exports;var n=a={i:e,l:!1,exports:{}};return t.call(n.exports,n,n.exports,l),n.l=!0,n.exports}l.m=t,l.c=a,l.d=function(t,e,n){l.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},l.r=function(t){“undefined”!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:“Module”}),Object.defineProperty(t,“__esModule”,{value:!0})},l.t=function(t,e){if(1&e&&(t=l(t)),8&e)return t;if(4&e&&“object”===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(l.r(n),Object.defineProperty(n,“default”,{enumerable:!0,value:t}),2&e&&“string”!=typeof t)for(var a in t)l.d(n,a,function(e){return t}.bind(null,a));return n},l.n=function(t){var e=t&&t.__esModule?function(){return t}:function(){return t};return l.d(e,“a”,e),e},l.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},l.p=“/”;var r=window=window||[],o=r.push.bind®;r.push=e,r=r.slice();for(var c=0;c);var u=o;i.push(),n()})({0:function(t,e,n){t.exports=n(“cd49”)},“7e79”:function(t,e,n){},cd49:function(t,e,n){“use strict”;n.r(e);n(“e260”),n(“e6cf”),n(“cca6”),n(“a79d”),n(“7e79”);var a=n(“2b0e”),s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n(“div”,[n(“navbar”,{on:{“create-new-setting”:t.openNewSettingModal}}),t.showNewSettingModal?n(“new-setting-modal”,{on:{“close-modal”:t.closeNewSettingModal,“fetch-settings”:t.fetchSettings}}):t._e(),t.settings.length?n(“div”,{staticClass:“flex flex-col items-center mb-3”},t._l(t.settings,(function(e){return n(“setting-row”,{key:e.name,attrs:{setting:e},on:{“fetch-settings”:t.fetchSettings}})})),1):t._e(),n(“toast”)],1)},i=[],l=(n(“d3b7”),n(“96cf”),n(“d4ec”)),r=n(“bee2”),o=n(“262e”),c=n(“2caf”),u=n(“9ab4”),p=n(“60a3”),d=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n(“div”,{staticClass:“w-full lg:w-1/2 xl:w-1/3 absolute right-0 bottom-0 lg:mb-40 transition-opacity duration-200 ease-in-out”,class:t.opacity},[n(“div”,{staticClass:“bg-green-100 border-l-4 border-green-500 text-green-700 p-4”,attrs:{role:“alert”}},[n(“p”,{staticClass:“font-bold”},[t._v(t._s(t.title))]),n(“p”,)])])},b=[],v=function(t){Object(o)(n,t);var e=Object(c)(n);function n(){var t;return Object(l)(this,n),t=e.apply(this,arguments),t.title=“”,t.body=“”,t.showToast=!1,t}return Object(r)(n,[{key:“created”,value:function(){var t=this;this.$root.$on(“launch-toast”,(function(e){var n=e.title,a=e.body;t.title=n,t.body=a,t.showToast=!0,setTimeout((function(){t.showToast=!1}),3e3)}))}},{key:“opacity”,get:function(){return this.showToast?“opacity-100”:“opacity-0”}}]),n}(p);v=Object(u)([p],v);var g=v,f=g,m=n(“2877”),h=Object(m)(f,d,b,!1,null,null,null),y=h.exports,x=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n(“nav”,{staticClass:“flex items-center justify-between flex-wrap bg-teal-500 p-6”},[t._m(0),n(“div”,{staticClass:“flex justify-end”},[n(“span”,{staticClass:“btn-base rounded btn-white-border text-sm px-4 py-2 hover:text-teal-500”,on:{click:t.openSettingForm}},[t._v(“ New Setting ”)])])])},j=[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n(“div”,{staticClass:“flex items-center flex-shrink-0 text-white mr-6”},[n(“span”,{staticClass:“font-semibold text-xl tracking-tight”},[t._v(“Shared Settings”)])])}],O=function(t){Object(o)(n,t);var e=Object(c)(n);function n(){return Object(l)(this,n),e.apply(this,arguments)}return Object(r)(n,),n}(p);O=Object(u)([p],O);var w=O,C=w,_=Object(m)(C,x,j,!1,null,null,null),S=_.exports,k=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n(“div”,{staticClass:“bg-white shadow-md rounded-lg px-4 py-6 mt-3 mx-4 md:mx-auto w-11/12 md:w-3/4 lg:w-1/2”},[n(“div”,{staticClass:“flex justify-between items-center w-full”},[n(“div”,{staticClass:“flex items-end”},[n(“h2”,{staticClass:“text-lg font-semibold text-gray-900”},[t._v(t._s(t.localSetting.name))]),n(“span”,{staticClass:“text-gray-700 ml-2 text-sm”},[t._v(t._s(t.localSetting.type))]),t.localSetting.encrypted?n(“span”,{staticClass:“text-orange-600 ml-2 text-sm”},[t._v(“(encrypted)”)]):t._e()]),n(“small”,{staticClass:“text-sm text-gray-700 cursor-pointer”,on:{click:t.toggleOpen}},[t._v(t._s(t.toggleText))])]),t.open?n(“div”,{staticClass:“mt-3”},[n(“div”,{staticClass:“flex”},[n(“div”,{staticClass:“flex items-center w-1/2”},[n(t.formComponent,{tag:“component”,attrs:{setting:t.localSetting},on:{“update:setting”:function(e){t.localSetting=e}}})],1),n(“div”,{staticClass:“flex justify-end items-center w-1/2”},[n(“button”,{staticClass:“btn-base btn-blue-border py-2 px-4 rounded h-10”,attrs:{disabled:t.clean},on:{click:t.saveSetting}},[t._v(“ Save ”)]),n(“button”,{staticClass:“btn-base btn-red-border py-2 px-4 ml-2 rounded h-10”,on:{click:t.confirmDelete}},[t._v(“ Delete ”)])])]),t.caveatText?n(“small”,{staticClass:“text-gray-700”},[t._v(t._s(t.caveatText))]):t._e()]):t._e()])},V=[],$=(n(“99af”),n(“b0c0”),function(){var t=this,e=t.$createElement,n=t._self._c||e;return n(“div”,{staticClass:“flex justify-between”},[n(“input”,{directives:,staticClass:“input-base input-gray rounded py-2 px-2 w-1/3”,attrs:{type:“number”},domProps:{value:t.lowerBounds},on:{input:function(e){e.target.composing||(t.lowerBounds=e.target.value)}}}),n(“span”,{staticClass:“flex self-end mx-2”},[t._v(“to”)]),n(“input”,{directives:,staticClass:“input-base input-gray rounded py-2 px-2 w-1/3”,attrs:{type:“number”},domProps:{value:t.upperBounds},on:{input:function(e){e.target.composing||(t.upperBounds=e.target.value)}}})])}),N=[],B=(n(“ac1f”),n(“1276”),function(t){Object(o)(n,t);var e=Object(c)(n);function n(){return Object(l)(this,n),e.apply(this,arguments)}return n}(p));Object(u)([Object(p)(Object)],B.prototype,“setting”,void 0),B=Object(u)([p],B);var T=function(t){Object(o)(n,t);var e=Object(c)(n);function n(){var t;return Object(l)(this,n),t=e.apply(this,arguments),t.localValue=t.setting.value,t.lowerBounds=t.localValue.split(“,”),t.upperBounds=t.localValue.split(“,”),t}return Object(r)(n,),n}(B);Object(u)([Object(p)(“setting”,{deep:!0})],T.prototype,“setLocalValue”,null),Object(u)([Object(p)(“assembledRange”)],T.prototype,“updateSetting”,null),T=Object(u)([p],T);var M=T,P=M,R=Object(m)(P,$,N,!1,null,null,null),E=R.exports,L=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n(“input”,{directives:,staticClass:“input-base input-gray rounded py-2 px-2 w-full”,attrs:{type:“text”},domProps:{value:t.localValue},on:{input:function(e){e.target.composing||(t.localValue=e.target.value)}}})},A=[],D=function(t){Object(o)(n,t);var e=Object(c)(n);function n(){var t;return Object(l)(this,n),t=e.apply(this,arguments),t.localValue=t.setting.value,t}return Object(r)(n,),n}(B);Object(u)([Object(p)(“setting”,{deep:!0})],D.prototype,“setLocalValue”,null),Object(u)([Object(p)(“localValue”)],D.prototype,“updateSetting”,null),D=Object(u)([p],D);var F=D,J=F,z=Object(m)(J,L,A,!1,null,null,null),I=z.exports,H=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n(“input”,{directives:,staticClass:“input-base input-gray rounded w-full py-2 px-2”,attrs:{type:“text”,placeholder:“[Insert text here]”},domProps:{value:t.localValue},on:{input:function(e){e.target.composing||(t.localValue=e.target.value)}}})},K=[],q=function(t){Object(o)(n,t);var e=Object(c)(n);function n(){var t;return Object(l)(this,n),t=e.apply(this,arguments),t.localValue=t.setting.value,t}return Object(r)(n,),n}(B);Object(u)([Object(p)(“setting”,{deep:!0})],q.prototype,“setLocalValue”,null),Object(u)([Object(p)(“localValue”)],q.prototype,“updateSetting”,null),q=Object(u)([p],q);var G=q,Q=G,U=Object(m)(Q,H,K,!1,null,null,null),W=U.exports,X=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n(“div”,{staticClass:“relative”},[n(“select”,{staticClass:“select-base select-gray w-full pr-6 rounded py-2 px-2”,domProps:{value:t.setting.value},on:{input:t.updateSetting}},[n(“option”,{attrs:{value:“1”}},[t._v(“true”)]),n(“option”,{attrs:{value:“0”}},[t._v(“false”)])]),n(“div”,{staticClass:“pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-900”},[n(“svg”,{staticClass:“fill-current h-4 w-4”,attrs:{xmlns:“www.w3.org/2000/svg”,viewBox:“0 0 20 20”}},[n(“path”,{attrs:{d:“M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z”}})])])])},Y=[],Z=function(t){Object(o)(n,t);var e=Object(c)(n);function n(){return Object(l)(this,n),e.apply(this,arguments)}return Object(r)(n,[{key:“updateSetting”,value:function(t){var e=t.target;return Object.assign(Object.assign({},this.setting),{value:e.value})}}]),n}(B);Object(u)([Object(p)(“update:setting”)],Z.prototype,“updateSetting”,null),Z=Object(u)([p],Z);var tt=Z,et=tt,nt=Object(m)(et,X,Y,!1,null,null,null),at=nt.exports,st=function(t){Object(o)(n,t);var e=Object(c)(n);function n(){var t;return Object(l)(this,n),t=e.apply(this,arguments),t.open=!1,t.localSetting=Object.assign({},t.setting),t}return Object(r)(n,[{key:“toggleOpen”,value:function(){this.open=!this.open}},{key:“confirmDelete”,value:function(){confirm('Click OK to permanently delete “'.concat(this.setting.name,'”'))&&this.deleteSetting()}},{key:“deleteSetting”,value:function(){return Object(u)(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,fetch(“”.concat(this.$apiBase,“/api/settings/”).concat(this.setting.name,“/destroy”),{method:“delete”,headers:{“Content-Type”:“application/json”}});case 2:this.$root.$emit(“launch-toast”,{title:“Success”,body:“Setting deleted”});case 3:case“end”:return t.stop()}}),t,this)})))}},{key:“saveSetting”,value:function(){return Object(u)(this,void 0,void 0,regeneratorRuntime.mark((function t(){var e,n,a,s,i;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e=this.localSetting,n=e.name,a=e.type,s=e.value,i=e.encrypted,t.next=3,fetch(“”.concat(this.$apiBase,“/api/settings/”).concat(n),{method:“put”,headers:{“Content-Type”:“application/json”},body:JSON.stringify({type:a,value:s,encrypted:i})});case 3:this.$root.$emit(“launch-toast”,{title:“Success”,body:“Setting updated”});case 4:case“end”:return t.stop()}}),t,this)})))}},{key:“toggleText”,get:function(){return this.open?“Hide”:“Show”}},{key:“clean”,get:function(){return this.setting.value===this.localSetting.value}},{key:“caveatText”,get:function(){return“string”===this.setting.type?“* Value will be saved exactly as-is, including whitespace”:“range”===this.setting.type?“* Range values are inclusive”:“”}},{key:“formComponent”,get:function(){var t={range:E,number:I,string:W,boolean:at};return t}}]),n}(p);Object(u)([Object(p)(Object)],st.prototype,“setting”,void 0),Object(u)([Object(p)(“fetch-settings”)],st.prototype,“deleteSetting”,null),Object(u)([Object(p)(“fetch-settings”)],st.prototype,“saveSetting”,null),st=Object(u)([Object(p)({components:{BooleanForm:at}})],st);var it=st,lt=it,rt=Object(m)(lt,k,V,!1,null,null,null),ot=rt.exports,ct=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n(“div”,{staticClass:“fixed z-10 inset-0 overflow-y-auto”},[n(“div”,{staticClass:“flex items-end justify-center min-h-screen pt-4 px-4 pb-48 text-center sm:block sm:p-0”},[t._m(0),n(“span”,{staticClass:“inline-block align-middle h-screen”}),t._v(“​ ”),n(“div”,{staticClass:“modal-base my-8 align-middle max-w-lg w-full”},[n(“div”,{staticClass:“bg-white px-4 py-5 pb-4”},[n(“div”,{staticClass:“flex items-start”},[n(“div”,{staticClass:“mt-0 text-left w-full”},[n(“h3”,{staticClass:“text-xl leading-6 font-medium text-gray-900”},[t._v(“ Create setting ”)]),n(“div”,{staticClass:“mt-6”},[n(“div”,{staticClass:“mb-4”},[n(“label”,{staticClass:“block text-gray-700 text-sm font-bold mb-2”},[t._v(“ Name ”)]),n(“input”,{directives:,staticClass:“input-base input-gray rounded py-2 px-2 w-full”,attrs:{placeholder:“my_setting”},domProps:{value:t.name},on:{input:function(e){e.target.composing||(t.name=e.target.value)}}}),n(“p”,{staticClass:“text-gray-700 text-xs”},[t._v(“Letters, numbers, and underscores only. snake_case preferred.”)])]),n(“div”,{staticClass:“mb-4”},[n(“label”,{staticClass:“block text-gray-700 text-sm font-bold mb-2”},[t._v(“ Type ”)]),n(“div”,{staticClass:“relative”},[n(“select”,{directives:,staticClass:“select-base select-gray w-full pr-6 rounded py-2 px-2”,on:{change:function(e){var n=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){var e=“_value”in t?t._value:t.value;return e}));t.type=e.target.multiple?n:n}}},[n(“option”,{attrs:{value:“string”}},[t._v(“String”)]),n(“option”,{attrs:{value:“number”}},[t._v(“Number”)]),n(“option”,{attrs:{value:“boolean”}},[t._v(“Boolean”)]),n(“option”,{attrs:{value:“range”}},[t._v(“Range”)])]),n(“div”,{staticClass:“pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-900”},[n(“svg”,{staticClass:“fill-current h-4 w-4”,attrs:{xmlns:“www.w3.org/2000/svg”,viewBox:“0 0 20 20”}},[n(“path”,{attrs:{d:“M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z”}})])])])]),n(“div”,{staticClass:“mb-4”},[n(“label”,{staticClass:“block text-gray-700 text-sm font-bold mb-2”},[t._v(“ Value ”)]),n(“div”,{staticClass:“w-full”},[n(t.formComponent,{tag:“component”,attrs:{setting:t.assembledSetting},on:{“update:setting”:function(e){t.assembledSetting=e}}})],1)]),n(“div”,{staticClass:“mb-4”},[n(“label”,{staticClass:“block text-gray-700 text-sm font-bold mb-2”},[t._v(“ Encrypt? ”),n(“input”,{directives:,staticClass:“ml-2”,attrs:{type:“checkbox”},domProps:{checked:Array.isArray(t.encrypted)?t._i(t.encrypted,null)>-1:t.encrypted},on:{change:function(e){var n=t.encrypted,a=e.target,s=!!a.checked;if(Array.isArray(n)){var i=null,l=t._i(n,i);a.checked?l<0&&(t.encrypted=n.concat()):l>-1&&(t.encrypted=n.slice(0,l).concat(n.slice(l+1)))}else t.encrypted=s}}})])])])])])]),n(“div”,{staticClass:“bg-gray-50 px-4 py-3 mb-3 flex justify-end”},[n(“span”,{staticClass:“rounded-md shadow-sm w-auto”},[n(“button”,{staticClass:“btn-base btn-gray-border py-2 px-4 rounded h-10”,attrs:{type:“button”},on:{click:t.closeModal}},[t._v(“ Cancel ”)])]),n(“span”,{staticClass:“rounded-md shadow-sm w-auto ml-3”},[n(“button”,{staticClass:“btn-base btn-blue-border py-2 px-4 rounded h-10”,attrs:{disabled:!t.settingValid,type:“button”},on:{click:t.createSetting}},[t._v(“ Create ”)])])])])])])},ut=[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n(“div”,{staticClass:“fixed inset-0 transition-opacity”},[n(“div”,{staticClass:“absolute inset-0 bg-gray-500 opacity-75”})])}],pt=function(t){Object(o)(n,t);var e=Object(c)(n);function n(){var t;return Object(l)(this,n),t=e.apply(this,arguments),t.name=“”,t.type=“string”,t.value=“”,t.encrypted=!1,t}return Object(r)(n,[{key:“closeModal”,value:function(){this.$emit(“close-modal”)}},{key:“setDefaultValue”,value:function(){var t={range:“0,1”,number:“1”,string:“”,boolean:“1”};this.value=t}},{key:“createSetting”,value:function(){return Object(u)(this,void 0,void 0,regeneratorRuntime.mark((function t(){var e,n,a,s,i;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e=this.assembledSetting,n=e.name,a=e.type,s=e.value,i=e.encrypted,t.next=3,fetch(“”.concat(this.$apiBase,“/api/settings”),{method:“post”,headers:{“Content-Type”:“application/json”},body:JSON.stringify({name:n,type:a,value:s,encrypted:i})});case 3:this.$emit(“close-modal”),this.$emit(“fetch-settings”),this.$root.$emit(“launch-toast”,{title:“Success”,body:“Setting created”});case 6:case“end”:return t.stop()}}),t,this)})))}},{key:“formComponent”,get:function(){var t={range:E,number:I,string:W,boolean:at};return t}},{key:“settingValid”,get:function(){return!!this.name.length&&/^w+$/.test(this.name)}},{key:“assembledSetting”,get:function(){return{name:this.name,type:this.type,value:this.value,encrypted:this.encrypted}},set:function(t){var e=t.value;this.value=e}}]),n}(p);Object(u)([Object(p)(“type”)],pt.prototype,“setDefaultValue”,null),pt=Object(u)([Object(p)({components:{StringForm:W}})],pt);var dt=pt,bt=dt,vt=Object(m)(bt,ct,ut,!1,null,null,null),gt=vt.exports,ft=function(t){Object(o)(n,t);var e=Object(c)(n);function n(){var t;return Object(l)(this,n),t=e.apply(this,arguments),t.settings=[],t.showNewSettingModal=!1,t}return Object(r)(n,[{key:“created”,value:function(){this.fetchSettings()}},{key:“openNewSettingModal”,value:function(){this.showNewSettingModal=!0}},{key:“closeNewSettingModal”,value:function(){this.showNewSettingModal=!1}},{key:“fetchSettings”,value:function(){return Object(u)(this,void 0,void 0,regeneratorRuntime.mark((function t(){var e;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,fetch(“”.concat(this.$apiBase,“/api/settings”),{method:“get”,headers:{“Content-Type”:“application/json”}});case 2:return e=t.sent,t.next=5,e.json();case 5:return this.settings=t.sent,t.abrupt(“return”,this.settings);case 7:case“end”:return t.stop()}}),t,this)})))}}]),n}(p);ft=Object(u)([Object(p)({components:{Toast:y,Navbar:S,SettingRow:ot,NewSettingModal:gt}})],ft);var mt=ft,ht=mt,yt=Object(m)(ht,s,i,!1,null,null,null),xt=yt.exports;a.config.productionTip=!1,a.prototype.$apiBase=window.sharedSettingsApiBase||“”,new a({render:function(t){return t(xt)}}).$mount(“#app”)}}); //# sourceMappingURL=app.2c7ab8e8.js.map