1import{_ as J}from"./ReNIE8jL.js";import{_ as Q}from"./DDEE-iBm.js";import{_ as Y}from"./BTjRyTJK.js";import{cD as Z,cT as N,cU as ie,cK as q,aI as re,aF as ee}from"./BBadv83t.js";import{_ as ue}from"./QVSONFor.js";import{_ as de}from"./BeXUUoFL.js";import{_ as ce}from"./rNytwKgL.js";import{_ as me}from"./Desj5l9F.js";import{_ as pe}from"./Dpvn06ox.js";import{af as te,r as $,c as h,K as fe,ag as s,ah as k,am as c,as as x,ax as p,dv as z,ei as F,an as e,ao as X,aq as i,du as C,dt as g,av as I,eg as B,a4 as _e,aw as ne,ee as ve,a8 as be,W as xe,eF as ge,eH as ye}from"./mCBnZlwl.js";import{_ as he}from"./DlyrBbso.js";import"./9PRWBKqy.js";import"./BptNY6de.js";import"./CvNejbUP.js";import"./Cape7XEV.js";import"./BuXdVFVw.js";import"./BkELLDnV.js";import"./C1uKaqIs.js";import"./DL7C5X15.js";import"./D1ZgRogs.js";(function(){try{var A=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new A.Error().stack;d&&(A._sentryDebugIds=A._sentryDebugIds||{},A._sentryDebugIds[d]="3efd8abf-a556-4ec4-9410-9e5ea9009559",A._sentryDebugIdIdentifier="sentry-dbid-3efd8abf-a556-4ec4-9410-9e5ea9009559")}catch{}})();const ke={style:{"flex-grow":"1"}},Ie={class:"action-map-chips"},$e={key:0,inert:""},we={style:{display:"inline-block","font-size":"13px",position:"relative",top:"-9px",left:"-4px"}},Ce={class:"action"},Ae={key:0,inert:""},Te={style:{display:"inline-block","font-size":"13px",position:"relative",top:"-9px",left:"-4px"}},Ge={class:"action"},Ve={class:"rumble-line-one"},Se={class:"rumble-line-one-left"},Pe={key:2,class:"rumble-line-one-right"},Be=te({__name:"Configuration",props:{configuration:{},gamepad:{}},setup(A){const d=A,y=Z(),r=$(),m=$(0),v=$(1),w=$(1),T=$(),E=h(()=>d.gamepad.buttons.map((t,a)=>({btn:t,btnIndex:a})).filter(t=>t.btn.pressed).map(t=>({type:"button",index:t.btnIndex}))),L=h(()=>d.gamepad.axes.map((t,a)=>({value:t,axisIndex:a})).filter(t=>t.value>N||t.value<-N).map(t=>{const a=Math.floor(t.axisIndex/2),u=t.axisIndex%2===0,P=t.value>0?"positive":"negative";return{type:"axis",index:t.axisIndex,displayIndex:a,direction:P,x:u?t.value:0,y:u?0:t.value}})),f=h(()=>[...E.value,...L.value]),O=h(()=>ie.map(t=>({value:t,text:q.get(t)}))),M=h(()=>Object.entries(d.configuration.buttonMap).map(([t,a])=>({buttonIndex:Number(t),action:a,pressed:f.value.length===1&&f.value[0].type==="button"&&f.value[0].index===Number(t)})).sort((t,a)=>t.buttonIndex-a.buttonIndex)),_=h(()=>Object.entries(d.configuration.axisMap).map(([t,a])=>{const u=a.axisIndex,P=Math.floor(u/2),U=u%2===0,K=U?a.direction==="positive"?1:-1:0,j=U?0:a.direction==="positive"?1:-1,H=f.value.length===1&&f.value[0].type==="axis"&&f.value[0].index===u&&f.value[0].direction===a.direction;return{axisIndex:u,action:a,displayIndex:P,x:K,y:j,pressed:H}}).sort((t,a)=>t.axisIndex-a.axisIndex)),o=h(()=>f.value.length>1?"Too many buttons/axis pressed.":l.value===null?"Press a single button or axis":l.value.type==="button"?"Selection action for this button":l.value.type==="axis"?"Selection action for this axis":""),l=$(null);fe(()=>{f.value.length===1?l.value=f.value[0]:f.value.length>1&&(l.value=null)});function G(){r.value&&(l.value===null?console.warn("Not exactly one button pressed"):l.value.type==="button"?y.addGamepadConfigurationButtonAction({docPath:d.configuration.docPath,buttonIndex:l.value.index,action:r.value,rumble:{duration:m.value,weak:v.value,strong:w.value},seat:T.value}):l.value.type==="axis"&&y.addGamepadConfigurationAxisAction({docPath:d.configuration.docPath,axisIndex:l.value.index,action:r.value,rumble:{duration:m.value,weak:v.value,strong:w.value},direction:l.value.direction,seat:T.value}),_e(()=>{r.value=void 0,T.value=void 0}))}function R(t){y.removeGamepadConfigurationButtonAction({docPath:d.configuration.docPath,buttonIndex:t})}function V(t){y.removeGamepadConfigurationAxisAction({docPath:d.configuration.docPath,axisAction:t})}function S(){y.removeGamepadConfiguration(d.configuration.docPath)}const D=h(()=>typeof d.gamepad.vibrationActuator=="object");function b(){d.gamepad.vibrationActuator.playEffect("dual-rumble",{startDelay:0,duration:m.value,weakMagnitude:v.value,strongMagnitude:w.value})}return(t,a)=>
1{const u=re,P=ue,U=J,K=Q,j=ee,H=de,W=ce,oe=me,ae=Y,se=pe;return s(),k(se,{class:"ma-5"},{title:c(()=>[i(u,{icon:"$gamepad"}),x("span",ke,g(t.configuration.nickname),1),i(P,{onClick:S},{default:c(()=>[i(u,{icon:"$delete"})]),_:1})]),default:c(()=>[x("div",Ie,[(s(!0),p(z,null,F(e(M),n=>(s(),p("div",{key:n.buttonIndex,class:X(["action-map buttons",{pressed:n.pressed}])},[i(U,{class:"activator button"},{default:c(()=>[C(g(n.buttonIndex),1)]),_:2},1024),i(u,{icon:"$arrowRight",class:"arrow"}),n.action.seat!==void 0?(s(),p("div",$e,[i(u,{icon:"$seat"}),x("span",we,g(n.action.seat),1)])):I("",!0),x("span",Ce,g(("actionLabelMap"in t?t.actionLabelMap:e(q)).get(n.action.action)),1),n.action.rumble.duration>0?(s(),k(u,{key:1,icon:"$rumble",class:"rumble"})):I("",!0),i(P,{class:"delete",onClick:le=>R(n.buttonIndex)},{default:c(()=>[i(u,{icon:"$delete"})]),_:2},1032,["onClick"])],2))),128)),(s(!0),p(z,null,F(e(_),n=>(s(),p("div",{key:n.axisIndex,class:X(["action-map axis",{pressed:n.pressed}])},[i(K,{class:"activator axis",x:n.x,y:n.y,label:n.displayIndex,"centered-label":!0},null,8,["x","y","label"]),i(u,{icon:"$arrowRight",class:"arrow"}),n.action.seat!==void 0?(s(),p("div",Ae,[i(u,{icon:"$seat"}),x("span",Te,g(n.action.seat),1)])):I("",!0),x("span",Ge,g(("actionLabelMap"in t?t.actionLabelMap:e(q)).get(n.action.action)),1),n.action.rumble.duration>0?(s(),k(u,{key:1,class:"rumble",icon:"$rumble"})):I("",!0),i(P,{class:"delete",onClick:le=>V(n.action)},{default:c(()=>[i(u,{icon:"$delete"})]),_:2},1032,["onClick"])],2))),128))]),i(H,{ref:"newActionToAddSelect",modelValue:e(r),"onUpdate:modelValue":a[0]||(a[0]=n=>B(r)?r.value=n:null),items:e(O),placeholder:e(o),disabled:e(l)===null},{prepend:c(()=>[e(l)===null?(s(),k(u,{key:0,size:"32",icon:"$close"})):e(l).type==="button"?(s(),k(U,{key:1,style:{margin:"0"}},{default:c(()=>[C(g(e(l).index),1)]),_:1})):(s(),k(K,{key:2,style:{width:"32px",height:"32px"},x:e(l).x,y:e(l).y,label:e(l).displayIndex,"centered-label":!0},null,8,["x","y","label"]))]),append:c(()=>[i(j,{disabled:e(l)===null||e(r)===void 0,onClick:G},{default:c(()=>a[5]||(a[5]=[C("Save")])),_:1},8,["disabled"])]),_:1},8,["modelValue","items","placeholder","disabled"]),i(oe,{label:`Rumble (${e(m)===0?"Off":Math.round(e(m)/100)/10+"s"})`,mandatory:"",show:""},{default:c(()=>[x("div",Ve,[x("div",Se,[i(W,{modelValue:e(m),"onUpdate:modelValue":a[1]||(a[1]=n=>B(m)?m.value=n:null),label:"Duration",max:2e3,min:0},{"thumb-label":c(({modelValue:n})=>[C(g(n===0?"Off":Math.round(n/100)/10+"s"),1)]),_:1},8,["modelValue"])])]),e(m)>0?(s(),k(W,{key:0,modelValue:e(v),"onUpdate:modelValue":a[2]||(a[2]=n=>B(v)?v.value=n:null),label:"Weak",max:1,min:0,step:.1},{"thumb-label":c(({modelValue:n})=>[C(g(n===0?"Off":n*10),1)]),_:1},8,["modelValue"])):I("",!0),e(m)>0?(s(),k(W,{key:1,modelValue:e(w),"onUpdate:modelValue":a[3]||(a[3]=n=>B(w)?w.value=n:null),label:"Strong",max:1,min:0,step:.1},{"thumb-label":c(({modelValue:n})=>[C(g(n===0?"Off":n*10),1)]),_:1},8,["modelValue"])):I("",!0),e(m)>0?(s(),p("div",Pe,[i(j,{size:"small",disabled:e(m)===0||!e(D),onClick:b},{default:c(()=>a[6]||(a[6]=[C(" Test ")])),_:1},8,["disabled"])])):I("",!0)]),_:1},8,["label"]),i(ae,{modelValue:e(T),"onUpdate:modelValue":a[4]||(a[4]=n=>B(T)?T.value=n:null),modelModifiers:{number:!0},label:"Seat","prepend-inner-icon":"$seat",hint:"Make button exclusive for the player with the given seat number.",clearable:"",type:"number",min:"1"},null,8,["modelValue"])]),_:1})}}}),Ne=ne(Be,[["__scopeId","data-v-1517b637"]]),Le={key:0,class:"page",translate:"no"},Re={class:"text-h6"},De={class:"pressedButtonsAndAxes"},Ue={key:0},ze={key:1,class:"flex-column"},Fe={key:2},Ee={class:"controls"},Oe={key:0,class:"mt-3"},Me={key:1,class:"page",translate:"no"},Ke=te({__name:"[gamepadIndex]",setup(A){const d=Z(),y=$(-1),r=$(null),m=$(-1),v=$(""),w=$(!1),T=h(()=>/\(.*\)/g);ve(()=>{y.value=Number(be().params.gamepadIndex)}),xe(()=>{E();const _=d.subscribeToGamepadSettings();ge(async()=>{m.value>=0&&window.cancelAnimationFrame(m.value),await(await _)()})});function E(){const _=navigator.getGamepads();if(_.length>y.value){const o=_[y.value];o?r.value={id:o.id,axes:o.axes,buttons:o.buttons,index:o.index,connected:o.connected,mapping:o.mapping,timestamp:o.timestamp}:r.value=null}else r.value=null;m.value=window.requestAnimationFrame(E)}const L=h(()=>r.value?r.value.buttons.map((_,o)=>({index:o,pressed:_.pressed})).filter(_=>_.pressed):[]),f=h(()=>
1{if(!r.value)return[];const _=Array.from({length:Math.ceil(r.value.axes.length/2)});for(let o=0;o<_.length;o++){const l=o*2,G=r.value.axes[l],R=G>N||G<-N,V=l+1,S=V<r.value.axes.length?r.value.axes[V]:0,D=S>N||S<-N;_[o]={x:G,y:S,index:o,xIndex:l,yIndex:V,xPressed:R,yPressed:D}}return _.filter(o=>o.xPressed||o.yPressed)}),O=h(()=>d.gamepadConfigurations);async function M(){if(v.value){w.value=!0;try{await d.addGamepadConfiguration(v.value),v.value=""}finally{w.value=!1}}}return(_,o)=>{const l=J,G=Q,R=Y,V=ee,S=Ne,D=he;return e(r)?(s(),p("div",Le,[x("p",Re," Gamepad #"+g(e(y)+1)+": "+g(e(r).id.replace(e(T),"")),1),o[3]||(o[3]=x("p",null," To map button presses to actions in the Shared Game Timer, first create a configuration, giving it a name, then press each button you wish to map and select the corresponding action in the configuration box. ",-1)),x("div",De,[e(L).length>0?(s(),p("div",Ue,[(s(!0),p(z,null,F(e(L),b=>(s(),k(l,{key:b.index,size:"x-large"},{default:c(()=>[C(g(b.index),1)]),_:2},1024))),128))])):I("",!0),e(f).length>0?(s(),p("div",ze,[(s(!0),p(z,null,F(e(f),b=>(s(),k(G,{key:b.index,x:b.x,y:b.y,label:b.index,"centered-label":!0},null,8,["x","y","label"]))),128))])):I("",!0),e(f).length+e(L).length===0?(s(),p("div",Fe,[i(l,{color:"grey"},{default:c(()=>o[1]||(o[1]=[C("no buttons pressed")])),_:1})])):I("",!0)]),o[4]||(o[4]=x("h2",{class:"text-h5 mt-5"},"Gamepad Configurations",-1)),x("div",Ee,[i(R,{modelValue:e(v),"onUpdate:modelValue":o[0]||(o[0]=b=>B(v)?v.value=b:null),modelModifiers:{trim:!0},label:"Nickname",enterkeyhint:"done",onKeydown:ye(M,["enter"])},null,8,["modelValue"]),i(V,{disabled:e(w)||e(v)==="",onClick:M},{default:c(()=>o[2]||(o[2]=[C(" Add Configuration ")])),_:1},8,["disabled"])]),e(O).length===0?(s(),p("p",Oe," Create a gamepad configuration using the form above, giving it a nickname. ")):I("",!0),(s(!0),p(z,null,F(e(O),b=>(s(),k(S,{key:b.docPath,gamepad:e(r),configuration:b},null,8,["gamepad","configuration"]))),128))])):(s(),p("div",Me,[i(D,{title:`Gamepad #${e(y)} Setup`},null,8,["title"]),o[5]||(o[5]=x("p",null,"No gamepad detected in that slot. Try pressing a button or go back.",-1))]))}}}),ct=ne(Ke,[["__scopeId","data-v-a3909a99"]]);export{ct as default};
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.