1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[240],{8013:(e,t,a)=>{"use strict";a.d(t,{A:()=>r});var s=a(81204);let r=s.forwardRef(function(e,t){let{title:a,titleId:r,...n}=e;return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":r},n),a?s.createElement("title",{id:r},a):null,s.createElement("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12ZM12 8.25a.75.75 0 0 1 .75.75v3.75a.75.75 0 0 1-1.5 0V9a.75.75 0 0 1 .75-.75Zm0 8.25a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z",clipRule:"evenodd"}))})},26923:(e,t,a)=>{"use strict";a.d(t,{g:()=>o});var s=a(81204),r=a(5003),n=a(90421),i=a(29723),l=a(61001),d=a(45482);function o(){let e=new Date,t=(0,d.A)(e,7).getTime(),a=(0,s.useContext)(i.N),[o,c]=(0,l.A)("dash:".concat(function(e){let t=0x811c9dc5;for(let a=0;a<e.length;a++)t^=e.charCodeAt(a),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24),t>>>=0;return t.toString(16)}(a||"unk")),void 0),u=o&&o.updatedAt>t?o.item:void 0,m=(0,r.FS)("".concat(n.Ay.apiURI,"/dash"));return((0,s.useEffect)(()=>{if(m.data)return void c({item:m.data,updatedAt:Date.now()});m.error&&c(void 0)},[m.data,m.error]),m.isLoading&&o&&u)?{...m,isLoading:!1,data:u,fromCache:!0}:m}},45482:(e,t,a)=>{"use strict";a.d(t,{A:()=>i});var s=a(10659),r=a(30582),n=a(54941);function i(e,t){(0,r.A)(2,arguments);var a=(0,n.A)(t);return(0,s.A)(e,-a)}},61001:(e,t,a)=>{"use strict";a.d(t,{A:()=>i});var s=a(81204);function r(e){let t=window.localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(e){}}function n(e,t){let a=JSON.stringify(t);try{window.localStorage.setItem(e,a)}catch(e){console.log("[localStorage] can't set k");return}window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:a}))}function i(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=(0,s.useRef)(r(e)||t),l=(0,s.useCallback)(a=>{let s=s=>{(null===s.key||s.key===e)&&(i.current=r(e)||t,a())};return window.addEventListener("storage",s),()=>{window.removeEventListener("storage",s)}},[e,t]),d=(0,s.useSyncExternalStore)(l,()=>i.current,()=>t);return(0,s.useEffect)(()=>{a&&t==i.current&&n(e,t)},[e,t,a]),[d,t=>n(e,t)]}},61780:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>P});var s=a(78488),r=a(27428),n=a(5003),i=a(90421),l=a(29723),d=a(26923),o=a(98334),c=a(68544),u=a(16371),m=a(32170),p=a(83222),h=a(12295),x=a.n(h),g=a(66453),f=a.n(g),v=a(16900),y=a(81204),b=a(46850);let w={dashboardSignups:{setting:"dashboard-signups",description:"Controls who can create dashboard accounts for this Instant deployment."},ephemeralAppsEnabled:{setting:"ephemeral-apps-enabled",description:"Controls whether clients can create temporary apps."},magicCodeRateLimit:{setting:"magic-code-rate-limit-per-hour",description:"Maximum magic-code requests per email address and app each hour."},magicCodeExpiry:{setting:"default-magic-code-expiry-minutes",description:"Default lifetime of app magic codes in minutes."},webhookPrivateIps:{setting:"smokescreen-whitelist-ips",description:"Private IP addresses that webhook requests may connect to directly."},refreshThrottledApps:{setting:"refresh-throttled-apps",description:"App IDs whose realtime refreshes should be throttled."},refreshThrottleMs:{setting:"refresh-throttle-ms",description:"Delay between throttled realtime refreshes in milliseconds."}},j={magicCodeRateLimit:20,magicCodeExpiry:1440,refreshThrottleMs:1e3},N=[{label:"Open",value:"open",description:"Anyone can create an Instant dashboard account."},{label:"Restricted",value:"restricted",description:"Only the email addresses listed below can create an account."},{label:"Closed",value:"closed",description:"No new dashboard accounts can be created."}];function A(e,t,a){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=a?e:t}function C(e){return[...new Set(Array.isArray(e)?e.filter(e=>"string"==typeof e).map(e=>e.trim().toLowerCase()).filter(Boolean):[])].sort((e,t)=>e.localeCompare(t))}function k(e,t){let a=e.trim();if(!/^\d+$/.test(a))return;let s=Number(a);return Number.isSafeInteger(s)&&s>=t?s:void 0}function S(e){let{title:t,description:a,children:r}=e;return(0,s.jsxs)("section",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("h2",{className:"font-semibold",children:t}),(0,s.jsx)("p",{className:"text-sm text-gray-500 dark:text-neutral-400",children:a})]}),r]})}function E(e){let{items:t,value:a,inputClassName:n,placeholder:i,emptyMessage:l,disabled:d,onChange:o,onAdd:c,onRemove:m}=e;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("form",{className:"flex w-full items-center gap-2",onSubmit:e=>{e.preventDefault(),c()},children:[(0,s.jsx)("div",{className:n,children:(0,s.jsx)(r.ks,{placeholder:i,value:a,onChange:o})}),(0,s.jsx)(r.$n,{type:"submit",variant:"secondary",disabled:d||!a.trim(),children:"Add"})]}),(0,s.jsx)("div",{className:"mt-3 divide-y divide-gray-200 overflow-hidden rounded-sm border border-gray-200 bg-white dark:divide-neutral-700 dark:border-neutral-700 dark:bg-neutral-800",children:t.length?t.map(e=>(0,s.jsxs)("div",{className:"flex items-center justify-between gap-4 px-3 py-2",children:[(0,s.jsx)("span",{className:"truncate font-mono text-xs",children:e}),(0,s.jsx)("button",{type:"button","aria-label":"Remove ".concat(e),title:"Remove ".concat(e),disabled:d,className:"cursor-pointer text-gray-400 hover:text-red-500 disabled:cursor-default disabled:text-gray-300 dark:text-neutral-500 dark:hover:text-red-400 dark:disabled:text-neutral-700",onClick:()=>m(e),children:(0,s.jsx)(u.A,{className:"size-4"})})]},e)):(0,s.jsx)("div",{className:"px-3 py-3 text-sm text-gray-500",children:l})})]})}function I(e){let{label:t,value:a,unit:n,inputClassName:i,helper:l,disabled:d,onChange:o}=e;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-end gap-2",children:[(0,s.jsx)(r.ks,{className:i,label:t,inputMode:"numeric",value:a,disabled:d,onChange:o}),(0,s.jsx)("span",{className:"pb-1 text-sm text-gray-500 dark:text-neutral-400",children:n})]}),l?(0,s.jsx)("p",{className:"mt-1 text-xs text-gray-500 dark:text-neutral-400",children:l}):null]})}function R(e){var t,a,n,i,l,d,o,u;let{app:h,db:x}=e,[g,v]=(0,y.useState)(""),[R,T]=(0,y.useState)(String(j.magicCodeRateLimit)),[_,P]=(0,y.useState)(String(j.magicCodeExpiry)
1),[L,M]=(0,y.useState)(""),[D,Z]=(0,y.useState)(""),[O,U]=(0,y.useState)(String(j.refreshThrottleMs)),[q,$]=(0,y.useState)(!1),[F,z]=(0,y.useState)(!1),[B,G]=(0,y.useState)(!1),[V,J]=(0,y.useState)(!1),[X,Q]=(0,y.useState)(!1),{data:W,error:H,isLoading:K}=x.useQuery({flags:{}}),Y=new Map((null!=(o=null==W?void 0:W.flags)?o:[]).map(e=>[e.setting,e])),ee=Y.get(w.dashboardSignups.setting),et=(u=null==ee?void 0:ee.value)&&"object"==typeof u&&!Array.isArray(u)?ee.value:{},ea=et.mode,es=N.some(e=>e.value===ea)?ea:"open",er=C(et.allowedEmails),en=(null==(t=Y.get(w.ephemeralAppsEnabled.setting))?void 0:t.value)!==!1,ei=A(null==(a=Y.get(w.magicCodeRateLimit.setting))?void 0:a.value,j.magicCodeRateLimit,1),el=A(null==(n=Y.get(w.magicCodeExpiry.setting))?void 0:n.value,j.magicCodeExpiry,1),ed=C(null==(i=Y.get(w.webhookPrivateIps.setting))?void 0:i.value),eo=C(null==(l=Y.get(w.refreshThrottledApps.setting))?void 0:l.value),ec=A(null==(d=Y.get(w.refreshThrottleMs.setting))?void 0:d.value,j.refreshThrottleMs,0),eu=N.find(e=>e.value===es),em=R!==String(ei)||_!==String(el),ep=O!==String(ec);if((0,y.useEffect)(()=>{q||T(String(ei))},[q,ei]),(0,y.useEffect)(()=>{q||P(String(el))},[q,el]),(0,y.useEffect)(()=>{F||U(String(ec))},[F,ec]),K)return(0,s.jsx)(r.G6,{});if(H)return(0,s.jsxs)("div",{className:"rounded-sm border border-red-300 bg-red-50 p-4 text-sm text-red-700",children:["Could not load deployment settings: ",H.message]});let eh=(e,t)=>{var a;let s=Y.get(e.setting);return x.tx.flags[null!=(a=null==s?void 0:s.id)?a:(0,p.id)()].update({setting:e.setting,description:e.description,value:t})},ex=(e,t)=>x.transact(eh(w.dashboardSignups,{mode:e,allowedEmails:t})),eg=async()=>{let e=k(R,1);if(void 0===e)return void(0,c.Ax)("Magic-code requests must be a positive integer.");let t=k(_,1);if(void 0===t)return void(0,c.Ax)("Magic-code expiration must be a positive integer.");Q(!0);try{await x.transact([eh(w.magicCodeRateLimit,e),eh(w.magicCodeExpiry,t)]),$(!1),G(!0),(0,c.Zx)("App authentication settings updated.")}catch(e){(0,c.Ax)("Could not update app authentication settings.")}finally{Q(!1)}},ef=async e=>{Q(!0);try{await x.transact(eh(w.ephemeralAppsEnabled,e)),(0,c.Zx)(e?"Temporary apps enabled.":"Temporary apps disabled.")}catch(e){(0,c.Ax)("Could not update temporary app settings.")}finally{Q(!1)}},ev=async()=>{let e=L.trim().toLowerCase();if(!function(e){let t=e.split(".");if(4===t.length&&t.every(e=>/^\d{1,3}$/.test(e)&&Number(e)>=0&&255>=Number(e)))return!0;if(!e.includes(":"))return!1;try{return new URL("http://[".concat(e,"]/")),!0}catch(e){return!1}}(e))return void(0,c.Ax)("Enter a valid IPv4 or IPv6 address.");if(ed.includes(e))return void(0,c.Ax)("This IP address is already allowed.");Q(!0);try{await x.transact(eh(w.webhookPrivateIps,[...ed,e].sort())),M(""),(0,c.Zx)("".concat(e," can now receive webhook requests."))}catch(e){(0,c.Ax)("Could not add this IP address.")}finally{Q(!1)}},ey=async e=>{Q(!0);try{await x.transact(eh(w.webhookPrivateIps,ed.filter(t=>t!==e))),(0,c.Zx)("".concat(e," removed."))}catch(e){(0,c.Ax)("Could not remove this IP address.")}finally{Q(!1)}},eb=async()=>{let e=D.trim().toLowerCase();if(!(0,b.A)(e))return void(0,c.Ax)("Enter a valid app ID.");if(eo.includes(e))return void(0,c.Ax)("This app is already throttled.");Q(!0);try{await x.transact(eh(w.refreshThrottledApps,[...eo,e].sort())),Z(""),(0,c.Zx)("".concat(e," is now throttled."))}catch(e){(0,c.Ax)("Could not add this app.")}finally{Q(!1)}},ew=async e=>{Q(!0);try{await x.transact(eh(w.refreshThrottledApps,eo.filter(t=>t!==e))),(0,c.Zx)("".concat(e," removed."))}catch(e){(0,c.Ax)("Could not remove this app.")}finally{Q(!1)}},ej=async()=>{let e=k(O,0);if(void 0===e)return void(0,c.Ax)("The refresh interval must be a non-negative integer.");Q(!0);try{await x.transact(eh(w.refreshThrottleMs,e)),z(!1),J(!0),(0,c.Zx)("Refresh throttle updated.")}catch(e){(0,c.Ax)("Could not update the refresh throttle.")}finally{Q(!1)}},eN=async e=>{Q(!0);try{await ex(e,er),(0,c.Zx)("Signup settings updated.")}catch(e){(0,c.Ax)("Could not update signup settings.")}finally{Q(!1)}},eA=async()=>{let e=g.trim().toLowerCase();if(!e||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e))return void(0,c.Ax)("Enter a valid email address.");
1if(er.includes(e))return void(0,c.Ax)("This email address is already allowed.");Q(!0);try{await ex(es,[...er,e].sort()),v(""),(0,c.Zx)("".concat(e," can now sign up."))}catch(e){(0,c.Ax)("Could not add this email address.")}finally{Q(!1)}},eC=async e=>{Q(!0);try{await ex(es,er.filter(t=>t!==e)),(0,c.Zx)("".concat(e," removed."))}catch(e){(0,c.Ax)("Could not remove this email address.")}finally{Q(!1)}};return(0,s.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,s.jsxs)(S,{title:"Dashboard access",description:"Control who can create dashboard accounts. Existing users can always sign in.",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium",children:"Who can sign up?"}),(0,s.jsx)(r.l6,{className:"mt-1.5 w-full md:w-72",disabled:X,value:es,options:N.map(e=>{let{label:t,value:a}=e;return{label:t,value:a}}),onChange:e=>{e&&eN(e.value)}}),(0,s.jsx)("p",{className:"mt-1.5 text-sm text-gray-500 dark:text-neutral-400",children:null==eu?void 0:eu.description})]}),"restricted"===es&&(0,s.jsxs)("div",{className:"border-t border-gray-200 pt-4 dark:border-neutral-700",children:[(0,s.jsx)("h3",{className:"mb-2 text-sm font-medium",children:"Allowed email addresses"}),(0,s.jsx)("div",{children:(0,s.jsx)(E,{items:er,value:g,inputClassName:"min-w-0 flex-1 sm:w-[26rem] sm:flex-none",placeholder:"[email protected]",emptyMessage:"No email addresses have been added.",disabled:X,onChange:v,onAdd:()=>void eA(),onRemove:e=>void eC(e)})})]})]}),(0,s.jsx)(S,{title:"Temporary apps",description:"Allow clients to create temporary apps without signing in. Enabled by default.",children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,s.jsx)("label",{htmlFor:"ephemeral-apps-enabled",className:"text-sm font-medium",children:"Allow temporary app creation"}),(0,s.jsx)(r.dO,{id:"ephemeral-apps-enabled",checked:en,disabled:X,onCheckedChange:e=>{ef(e)}})]})}),(0,s.jsx)(S,{title:"App authentication",description:"Set magic-code defaults across every app in this deployment.",children:(0,s.jsxs)("form",{className:"flex flex-col gap-4",onSubmit:e=>{e.preventDefault(),eg()},children:[(0,s.jsxs)("div",{className:"flex flex-wrap gap-x-8 gap-y-4",children:[(0,s.jsx)(I,{label:"Requests per email per hour",value:R,unit:"requests per hour",inputClassName:"w-28",disabled:X,onChange:e=>{T(e),$(e!==String(ei)||_!==String(el)),G(!1)}}),(0,s.jsx)(I,{label:"Code expires after",value:_,unit:"minutes",inputClassName:"w-36",helper:"Apps use this value unless they configure their own expiration.",disabled:X,onChange:e=>{P(e),$(R!==String(ei)||e!==String(el)),G(!1)}})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(r.$n,{type:"submit",variant:em?"primary":"secondary",disabled:X||!em,children:"Save authentication settings"}),B&&!em?(0,s.jsx)("span",{className:"text-xs text-gray-500 dark:text-neutral-400",children:"Saved"}):null]})]})}),(0,s.jsx)(S,{title:"Private webhook destinations",description:"Allow trusted private or internal IP addresses for webhook destinations. Private destinations stay blocked by default.",children:(0,s.jsx)(E,{items:ed,value:L,inputClassName:"min-w-0 flex-1 sm:w-60 sm:flex-none",placeholder:"10.0.0.25",emptyMessage:"No private IP addresses are allowed.",disabled:X,onChange:M,onAdd:()=>void ev(),onRemove:e=>void ey(e)})}),(0,s.jsxs)(S,{title:"Realtime throttling",description:"Throttle refreshes for selected apps to reduce burst load. Throttling increases realtime latency.",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-medium",children:"Throttled app IDs"}),(0,s.jsx)("p",{className:"mt-1 mb-2 text-sm text-gray-500 dark:text-neutral-400",children:"Find an app ID in its dashboard URL."}),(0,s.jsx)(E,{items:eo,value:D,inputClassName:"min-w-0 flex-1",placeholder:"00000000-0000-0000-0000-000000000000",emptyMessage:"No apps are throttled.",disabled:X,onChange:Z,onAdd:()=>void eb(),onRemove:e=>void ew(e)})]}),(0,s.jsxs)("form",{className:"flex flex-col gap-3 border-t border-gray-200 pt-4 dark:border-neutral-700",onSubmit:e=>{e.preventDefault(),ej()},children:[(0,s.jsx)(I,{label:"Throttle interval",value:O,unit:"ms",inputClassName:"w-28",disabled:X,onChange:e=>{U(e),z(e!==String(ec)),J(!1)}}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(r.$n,{type:"submit",variant:ep?"primary":"secondary",disabled:X||!ep,children:"Save interval"}),V&&!ep?(0,s.jsx)("span",{className:"text-xs text-gray-500 dark:text-neutral-400",children:"Saved"}):null]})]})]}),(0,s.jsxs)(f(),{href:"/dash?app=".concat(h.id,"&t=explorer&s=main"),className:"flex items-center justify-between gap-3 rounded-sm border border-gray-200 bg-white px-4 py-3 hover:bg-gray-50 dark:border-neutral-700 dark:bg-neutral-800 dark:hover:bg-neutral-700",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("h2",{className:"text-sm font-medium",children:"Advanced settings"}),(0,s.jsx)("p",{className:"mt-0.5 truncate text-sm text-gray-500 dark:text-neutral-400",children:"Open Instant Config to edit every flag and toggle directly."})]}),(0,s.jsx)(m.A,{className:"size-4 shrink-0 text-gray-300 dark:text-neutral-600","aria-hidden":"true"})]})]})}function T(e){let{app:t}=e,[a,n]=(0,y.useState)(null);return((0,y.useEffect)(()=>{let e=(0,p.Ts)({appId:t.id,apiURI:i.Ay.apiURI,websocketURI:i.Ay.websocketURI,__adminToken:t.admin_token,disableValidation:!0}
1);return n(e),()=>e.core.shutdown()},[t.id,t.admin_token]),a)?(0,s.jsx)(R,{app:t,db:a}):(0,s.jsx)(r.G6,{})}function _(){let e=(0,d.g)();if(!e.data)return e.error?(0,s.jsxs)("p",{className:"text-sm text-red-600",children:["Could not load deployment settings: ",e.error.message]}):(0,s.jsx)(r.G6,{});let t=e.data,a=t.apps.find(e=>e.id===t.instant_config_app_id);return t.superuser?a?(0,s.jsx)(T,{app:a},a.id):(0,s.jsx)("p",{className:"text-sm text-red-600",children:"Instant Config is not available for this account."}):(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Only the superuser can manage these deployment settings."})}let P=function(){let e=(0,o.z)(),t=(0,n.L4)(),a=(0,v.useRouter)();return((0,y.useEffect)(()=>{e&&a.isReady&&!t&&a.replace("/dash?return-to=/intern/deployment-settings")},[e,a,t]),e&&a.isReady&&t)?(0,s.jsxs)(l.N.Provider,{value:t,children:[(0,s.jsx)(x(),{children:(0,s.jsx)("title",{children:"Deployment Settings"})}),(0,s.jsx)("div",{className:"min-h-screen bg-gray-100 px-4 py-8",children:(0,s.jsxs)("main",{className:"mx-auto w-full max-w-2xl",children:[(0,s.jsx)(f(),{href:"/dash",className:"mb-6 inline-block text-sm text-gray-500 hover:text-gray-900",children:"Back to dashboard"}),(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("h1",{className:"text-xl font-semibold",children:"Deployment Settings"}),(0,s.jsx)("p",{className:"mt-1 text-sm text-gray-600 dark:text-neutral-400",children:"Manage access and configuration for this self-hosted deployment."})]}),(0,s.jsx)(_,{})]})})]}):null}},62211:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/intern/deployment-settings",function(){return a(61780)}])},68544:(e,t,a)=>{"use strict";a.d(t,{Ax:()=>c,Zx:()=>o,i0:()=>d});var s=a(78488),r=a(43428),n=a(93107),i=a(40808),l=a(8013);function d(e,t){r.oR.info(e,{icon:(0,s.jsx)(n.A,{width:20,height:20}),toastId:e,...t})}function o(e,t){r.oR.success(e,{icon:(0,s.jsx)(i.A,{className:"text-green-500",width:20,height:20}),toastId:e,...t})}function c(e,t){var a;r.oR.error(e,{icon:(0,s.jsx)(l.A,{className:"text-red-500",width:20,height:20}),toastId:e,autoClose:null!=(a=null==t?void 0:t.autoClose)?a:5e8,className:"whitespace-pre-wrap",...t})}}},e=>{e.O(0,[636,6593,8792],()=>e(e.s=62211)),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.