(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[609],{1328:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/app/bridges/openon",function(){return n(4092)}])},6771:function(e,t,n){"use strict";n.d(t,{Z:function(){return k}});var i=n(5893),r=n(7294),a=n(1163),s=n(9008),o=n.n(s),l=n(3946),c=n(8849),d=n(5317),u=n(8298),p=n(2734),h=n(2293),x=n(9520),m=n(155),y=n(6886),g=n(3321),f=n(5861),j=n(7357);function v(e){let{children:t}=e,n=(0,u.Z)({disableHysteresis:!0,threshold:24});return(0,r.cloneElement)(t,{elevation:n?4:0})}var w=function(){let[e,t]=(0,r.useState)(!1);(0,r.useCallback)(()=>{t(!e)},[e]);let n=(0,p.Z)();return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(v,{children:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(h.Z,{color:"transparent",elevation:0,children:(0,i.jsx)(x.Z,{maxWidth:"xl",sx:{padding:0},children:(0,i.jsx)(m.Z,{sx:{minHeight:50,maxHeight:50,padding:0,flex:1,alignItems:"center",justifyContent:"space-between",display:"flex",flexWrap:"nowrap"},children:(0,i.jsx)(y.ZP,{item:!0,children:(0,i.jsx)(g.Z,{href:"https://system-bridge.timmo.dev",target:"_blank",children:(0,i.jsx)(f.Z,{component:"div",variant:"h4",sx:{textTransform:"none",userSelect:"none",color:n.palette.primary.contrastText},children:"System Bridge"})})})})})}),(0,i.jsx)(j.Z,{sx:{height:n.spacing(18)}})]})})})};let Z=!1;var k=function(e){let t=(0,a.useRouter)();return(0,r.useEffect)(()=>{if(t.isReady&&!Z){var e,n,i,r;Z=!0;let a=(null===(e=t.query)||void 0===e?void 0:e.apiKey)||"",s=(null===(n=t.query)||void 0===n?void 0:n.apiPort)||"9170",o=!1;if((null===(i=t.query)||void 0===i?void 0:i.apiKey)||(o=!0,a=window.prompt("Please enter your API key",a)),(null===(r=t.query)||void 0===r?void 0:r.apiPort)||(o=!0,s=window.prompt("Please enter your API port (default: 9170)",s)),o&&a&&s){let e=t.asPath.split("?")[0];t.replace({pathname:e.includes(".html")?e:"".concat(e,".html"),query:{...t.query,apiKey:a,apiPort:s}})}}},[t]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(o(),{children:[(0,i.jsx)("title",{children:e.title?"".concat(e.title," - System Bridge"):"System Bridge"}),(0,i.jsx)("link",{rel:"canonical",href:e.url}),(0,i.jsx)("meta",{name:"description",content:e.description?"".concat(e.description):e.title?"".concat(e.title," - System Bridge"):"System Bridge"}),(0,i.jsx)("meta",{name:"keywords",content:e.keywords?"".concat(e.keywords):"system-bridge, system, bridge, typescript"})]}),!e.noHeader&&(0,i.jsx)(w,{}),e.closeButton&&(0,i.jsx)(l.Z,{size:"small",sx:{position:"absolute",top:4,right:4,zIndex:1e3},onClick:()=>{window.location.href="http://close.window"},children:(0,i.jsx)(c.Icon,{id:"close",path:d.r5M,size:1})}),e.children]})}},4092:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var i=n(5893),r=n(7294),a=n(1163),s=n(2734),o=n(9520),l=n(6886),c=n(8456),d=n(5861),u=n(447),p=n(699),h=n(3321),x=n(8945),m=n(7262),y=function(){let e=(0,a.useRouter)().query,[t,n]=(0,r.useState)(),[y,g]=(0,r.useState)(),[f]=(0,m.r)(),[j,v]=(0,r.useState)(!1),[w,Z]=(0,r.useState)(""),k=(0,r.useCallback)(async()=>{Z(e.url||"");let t=await x.Z.get("http://".concat((e.apiHost,window.location.hostname),":").concat(e.apiPort||9170,"/api/remote"),{headers:{"api-key":e.apiKey}});if(t&&t.status<400){let e=t.data.data.filter(e=>e.api_key);n(e),g(e[0])}},[e.apiHost,e.apiPort,e.apiKey,e.url]);async function b(){if(null==y?void 0:y.api_key)try{let e=await x.Z.post("http://".concat(y.host,":").concat(y.port,"/api/open"),{[w.includes("://")?"url":"path"]:w},{headers:{"api-key":y.api_key}});e&&e.status<400&&console.log(e.data)}catch(e){console.error(e)}}(0,r.useEffect)(()=>{!j&&e&&e.apiKey&&(v(!0),k())},[j,k,e]);let P=(0,s.Z)();return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(o.Z,{maxWidth:"lg",children:f||t?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d.Z,{component:"h2",variant:"h3",sx:{margin:P.spacing(2,1.5,6)},children:"Open Path / URL On.."}),t&&y?(0,i.jsx)(u.Z,{id:"bridge",options:t,value:y,getOptionLabel:e=>e.name,renderInput:e=>(0,i.jsx)(p.Z,{...e,label:"Bridge",variant:"outlined"}),onChange:(e,t)=>{t&&g(t)},sx:{margin:P.spacing(2,2.5),width:"calc(100% - 32px)"}}):"",(0,i.jsx)(p.Z,{fullWidth:!0,id:"url",label:"Path / URL",onChange:function(e){Z(e.target.value)},type:"url",value:w,variant:"outlined",sx:{margin:P.spacing(2,2.5),width:"calc(100% - 32px)"}}),(0,i.jsx)(h.Z,{color:"primary",disabled:!y||!w,variant:"contained",onClick:b,sx:{margin:P.spacing(6,2.5,2),width:"calc(100% - 32px)"},children:"Send"})]}):(0,i.jsx)(l.ZP,{container:!0,direction:"row",justifyContent:"center",sx:{margin:P.spacing(10,0,8)},children:(0,i.jsx)(c.Z,{})})})})},g=n(6771),f=function(){return(0,i.jsx)(g.Z,{title:"Open URL On",url:"https://system-bridge.timmo.dev",description:"Frontend for System Bridge",noHeader:!0,children:(0,i.jsx)(y,{})})}}},function(e){e.O(0,[702,502,792,316,699,945,447,774,888,179],function(){return e(e.s=1328)}),_N_E=e.O()}]);