1"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[184],{9184(e,s,a){a.r(s),a.d(s,{default:()=>f});var t=a(65043),r=a(91719),n=a(14282),l=a(70989),i=a(67006),o=a(98298);function c(){const[e,s]=(0,t.useState)(!1);return{mint:(0,t.useCallback)(async(e,a)=>{s(!0);try{return await async function(e,s){const a="".concat(e,":").concat(s),t=(new TextEncoder).encode(a);let r="";for(let o=0;o<t.length;o++)r+=String.fromCharCode(t[o]);const n=await fetch("/api/v3/auth/token",{method:"POST",credentials:"omit",headers:{Authorization:"Basic "+btoa(r)}});let l=null;try{l=await n.json()}catch(i){}if(200!==n.status||!l||!l.token){const e=new Error(l&&l.error||"mint failed (".concat(n.status,")"));throw e.status=n.status,e}return l}(e,a)}finally{s(!1)}},[]),loading:e}}var d=a(70579);const m="/api/v3/agent-skill";function f(){var e;const s=(0,o.A)(),a=(null===s||void 0===s||null===(e=s.data)||void 0===e?void 0:e.username)||"",{mint:f,loading:u}=c(),[h,x]=(0,t.useState)(!1),[A,b]=(0,t.useState)(""),[p,v]=(0,t.useState)(null),[y,j]=(0,t.useState)(null),[w,N]=(0,t.useState)(null);return(0,d.jsxs)("div",{className:"container",style:{maxWidth:720,padding:"2rem 1rem"},children:[(0,d.jsx)("h2",{children:"API Access"}),(0,d.jsxs)("p",{children:["Generate a short-lived token so an AI agent or script can act with"," ",(0,d.jsx)("strong",{children:"your"})," Wildbook access. Treat it like a password."]}),(0,d.jsxs)(r.A,{variant:"warning",children:["Do ",(0,d.jsx)("strong",{children:"not"})," give your agent your username/password \u2014 paste only the token."]}),(0,d.jsxs)("p",{children:["Your agent can learn this API here: ",(0,d.jsx)("code",{children:m})," ",(0,d.jsx)(n.A,{size:"sm",variant:"link",onClick:()=>{var e;return null===(e=navigator.clipboard)||void 0===e?void 0:e.writeText(window.location.origin+m)},children:"Copy link"})]}),(0,d.jsx)(n.A,{onClick:()=>{v(null),b(""),x(!0)},disabled:!a,children:"Generate API token"}),y&&(0,d.jsxs)("div",{style:{marginTop:"1.5rem"},children:[(0,d.jsxs)(r.A,{variant:"success",children:["Copy this token now \u2014 it won't be shown again",w?" and expires in ~".concat(Math.round(w/60)," min"):"","."]}),(0,d.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,d.jsx)("code",{style:{wordBreak:"break-all",flex:1},children:y}),(0,d.jsx)(n.A,{size:"sm",onClick:()=>{var e;return null===(e=navigator.clipboard)||void 0===e?void 0:e.writeText(y)},children:"Copy"})]})]}),(0,d.jsx)(l.A,{show:h,onHide:()=>x(!1),children:(0,d.jsxs)(i.A,{onSubmit:async e=>{e.preventDefault(),v(null);try{const e=await f(a,A);j(e.token),N(e.expiresInSeconds),b(""),x(!1)}catch(s){401===s.status?v("Incorrect password. If your account uses single sign-on, API tokens aren't available yet."):503===s.status?v("Token issuance isn't enabled on this server."):v("Couldn't generate a token. Please try again.")}},children:[(0,d.jsx)(l.A.Header,{closeButton:!0,children:(0,d.jsx)(l.A.Title,{children:"Confirm your password"})}),(0,d.jsxs)(l.A.Body,{children:[(0,d.jsxs)("p",{children:["Re-enter your password to mint a token for"," ",(0,d.jsx)("strong",{children:a}),"."]}),p&&(0,d.jsx)(r.A,{variant:"danger",children:p}),(0,d.jsxs)(i.A.Group,{children:[(0,d.jsx)(i.A.Label,{htmlFor:"apitoken-pw",children:"Password"}),(0,d.jsx)(i.A.Control,{id:"apitoken-pw",type:"password","aria-label":"Password",value:A,onChange:e=>b(e.target.value),autoComplete:"current-password"})]})]}),(0,d.jsxs)(l.A.Footer,{children:[(0,d.jsx)(n.A,{variant:"secondary",onClick:()=>x(!1),children:"Cancel"}),(0,d.jsx)(n.A,{type:"submit",disabled:u||!A||!a,children:"Confirm"})]})]})})]})}},91719(e,s,a){a.d(s,{A:()=>g});var t=a(89379),r=a(80045),n=a(98139),l=a.n(n),i=a(65043),o=a(97121),c=a(71456),d=a(67852),m=a(4488),f=a(70579);const u=["className","bsPrefix","as"],h=(0,m.A)("h4");h.displayName="DivStyledAsH4";const x=i.forwardRef((e,s)=>{let{className:a,bsPrefix:n,as:i=h}=e,o=(0,r.A)(e,u);return n=(0,d.oU)(n,"alert-heading"),(0,f.jsx)(i,(0,t.A)({ref:s,className:l()(a,n)},o))});x.displayName="AlertHeading";const A=x;var b=a(56161);const p=["className","bsPrefix","as"],v=i.forwardRef((e,s)=>{let{className:a,bsPrefix:n,as:i=b.A}=e,o=(0,r.A)(e,p);return n=(0,d.oU)(n,"alert-link"),(0,f.jsx)(i,(0,t.A)({ref:s,className:l()(a,n)},o))});v.displayName="AlertLink";const y=v;var j=a(18072),w=a(85632);const N=["bsPrefix","show","closeLabel","closeVariant","className","children","variant","onClose","dismissible","transition"],k=i.forwardRef((e,s)=>{const a=(0,o.Zw)(e,{show:"onClose"}),{bsPrefix:n,show:i=!0,closeLabel:m="Close alert",closeVariant:u,className:h,children:x,variant:A="primary",onClose:b,dismissible:p,transition:v=j.A}=a,y=(0,r.A)(a,N),k=(0,d.oU)(n,"alert"),g=(0,c.A)(e=>{b&&b(!1,e)}
1),C=!0===v?j.A:v,P=(0,f.jsxs)("div",(0,t.A)((0,t.A)({role:"alert"},C?void 0:y),{},{ref:s,className:l()(h,k,A&&"".concat(k,"-").concat(A),p&&"".concat(k,"-dismissible")),children:[p&&(0,f.jsx)(w.A,{onClick:g,"aria-label":m,variant:u}),x]}));return C?(0,f.jsx)(C,(0,t.A)((0,t.A)({unmountOnExit:!0},y),{},{ref:void 0,in:i,children:P})):i?P:null});k.displayName="Alert";const g=Object.assign(k,{Link:y,Heading:A})},62663(e,s,a){a.d(s,{Tj:()=>r,mf:()=>n});var t=a(65043);function r(e,s){let a=0;return t.Children.map(e,e=>t.isValidElement(e)?s(e,a++):e)}function n(e,s){return t.Children.toArray(e).some(e=>t.isValidElement(e)&&e.type===s)}},67006(e,s,a){a.d(s,{A:()=>Y});var t=a(89379),r=a(80045),n=a(98139),l=a.n(n),i=a(65173),o=a.n(i),c=a(65043),d=a(44765),m=a(21068),f=a(5673),u=a(67852),h=a(70579);const x=["bsPrefix","className","htmlFor"],A=c.forwardRef((e,s)=>{let{bsPrefix:a,className:n,htmlFor:i}=e,o=(0,r.A)(e,x);const{controlId:d}=(0,c.useContext)(f.A);return a=(0,u.oU)(a,"form-check-label"),(0,h.jsx)("label",(0,t.A)((0,t.A)({},o),{},{ref:s,htmlFor:i||d,className:l()(n,a)}))});A.displayName="FormCheckLabel";const b=A;var p=a(62663);const v=["id","bsPrefix","bsSwitchPrefix","inline","reverse","disabled","isValid","isInvalid","feedbackTooltip","feedback","feedbackType","className","style","title","type","label","children","as"],y=c.forwardRef((e,s)=>{let{id:a,bsPrefix:n,bsSwitchPrefix:i,inline:o=!1,reverse:x=!1,disabled:A=!1,isValid:y=!1,isInvalid:j=!1,feedbackTooltip:w=!1,feedback:N,feedbackType:k,className:g,style:C,title:P="",type:I="checkbox",label:F,children:S,as:R="input"}=e,T=(0,r.A)(e,v);n=(0,u.oU)(n,"form-check"),i=(0,u.oU)(i,"form-switch");const{controlId:L}=(0,c.useContext)(f.A),U=(0,c.useMemo)(()=>({controlId:a||L}),[L,a]),V=!S&&null!=F&&!1!==F||(0,p.mf)(S,b),z=(0,h.jsx)(m.A,(0,t.A)((0,t.A)({},T),{},{type:"switch"===I?"checkbox":I,ref:s,isValid:y,isInvalid:j,disabled:A,as:R}));return(0,h.jsx)(f.A.Provider,{value:U,children:(0,h.jsx)("div",{style:C,className:l()(g,V&&n,o&&"".concat(n,"-inline"),x&&"".concat(n,"-reverse"),"switch"===I&&i),children:S||(0,h.jsxs)(h.Fragment,{children:[z,V&&(0,h.jsx)(b,{title:P,children:F}),N&&(0,h.jsx)(d.A,{type:k,tooltip:w,children:N})]})})})});y.displayName="FormCheck";const j=Object.assign(y,{Input:m.A,Label:b});var w=a(86311);const N=["className","bsPrefix","as"],k=c.forwardRef((e,s)=>{let{className:a,bsPrefix:n,as:i="div"}=e,o=(0,r.A)(e,N);return n=(0,u.oU)(n,"form-floating"),(0,h.jsx)(i,(0,t.A)({ref:s,className:l()(a,n)},o))});k.displayName="FormFloating";const g=k;var C=a(1433),P=a(42780);const I=["bsPrefix","className","id"],F=c.forwardRef((e,s)=>{let{bsPrefix:a,className:n,id:i}=e,o=(0,r.A)(e,I);const{controlId:d}=(0,c.useContext)(f.A);return a=(0,u.oU)(a,"form-range"),(0,h.jsx)("input",(0,t.A)((0,t.A)({},o),{},{type:"range",ref:s,className:l()(n,a),id:i||d}))});F.displayName="FormRange";const S=F,R=["bsPrefix","size","htmlSize","className","isValid","isInvalid","id"],T=c.forwardRef((e,s)=>{let{bsPrefix:a,size:n,htmlSize:i,className:o,isValid:d=!1,isInvalid:m=!1,id:x}=e,A=(0,r.A)(e,R);const{controlId:b}=(0,c.useContext)(f.A);return a=(0,u.oU)(a,"form-select"),(0,h.jsx)("select",(0,t.A)((0,t.A)({},A),{},{size:i,ref:s,className:l()(o,a,n&&"".concat(a,"-").concat(n),d&&"is-valid",m&&"is-invalid"),id:x||b}))});T.displayName="FormSelect";const L=T,U=["bsPrefix","className","as","muted"],V=c.forwardRef((e,s)=>{let{bsPrefix:a,className:n,as:i="small",muted:o}=e,c=(0,r.A)(e,U);return a=(0,u.oU)(a,"form-text"),(0,h.jsx)(i,(0,t.A)((0,t.A)({},c),{},{ref:s,className:l()(n,a,o&&"text-muted")}))});V.displayName="FormText";const z=V,H=c.forwardRef((e,s)=>(0,h.jsx)(j,(0,t.A)((0,t.A)({},e),{},{ref:s,type:"switch"})));H.displayName="Switch";const O=Object.assign(H,{Input:j.Input,Label:j.Label}),E=["bsPrefix","className","children","controlId","label"],G=c.forwardRef((e,s)=>{let{bsPrefix:a,className:n,children:i,controlId:o,label:c}=e,d=(0,r.A)(e,E);return a=(0,u.oU)(a,"form-floating"),(0,h.jsxs)(C.A,(0,t.A)((0,t.A)({ref:s,className:l()(n,a),controlId:o},d),{},{children:[i,(0,h.jsx)("label",{htmlFor:o,children:c})]}))});G.displayName="FloatingLabel";const B=G,D=["className","validated","as"],M={_ref:o().any,validated:o().bool,as:o().elementType},W=c.forwardRef((e,s)=>{let{className:a,validated:n,as:i="form"}=e,o=(0,r.A)(e,D);return(0,h.jsx)(i,(0,t.A)((0,t.A)({},o),{},{ref:s,className:l()(a,n&&"was-validated")}))});W.displayName="Form",W.propTypes=M;const Y=Object.assign(W,{Group:C.A,Control:w.A,Floating:g,Check:j,Switch:O,Label:P.A,Text:z,Range:S,Select:L,FloatingLabel:B})},21068(e,s,a){a.d(s,{A:()=>u});var t=a(89379),r=a(80045),n=a(98139),l=a.n(n),i=a(65043),o=a(5673),c=a(67852),d=a(70579);const m=["id","bsPrefix","className","type","isValid","isInvalid","as"],f=i.forwardRef((e,s)=>{let{id:a,bsPrefix:n,className:f,type:u="checkbox",isValid:h=!1,isInvalid:x=!1,as:A="input"}=e,b=(0,r.A)(e,m);const{controlId:p}=(0,i.useContext)(o.A);return n=(0,c.oU)(n,"form-check-input"),(0,d.jsx)(A,(0,t.A)((0,t.A)({},b),{}
1,{ref:s,type:u,id:a||p,className:l()(f,n,h&&"is-valid",x&&"is-invalid")}))});f.displayName="FormCheckInput";const u=f},1433(e,s,a){a.d(s,{A:()=>d});var t=a(89379),r=a(80045),n=a(65043),l=a(5673),i=a(70579);const o=["controlId","as"],c=n.forwardRef((e,s)=>{let{controlId:a,as:c="div"}=e,d=(0,r.A)(e,o);const m=(0,n.useMemo)(()=>({controlId:a}),[a]);return(0,i.jsx)(l.A.Provider,{value:m,children:(0,i.jsx)(c,(0,t.A)((0,t.A)({},d),{},{ref:s}))})});c.displayName="FormGroup";const d=c},42780(e,s,a){a.d(s,{A:()=>h});var t=a(89379),r=a(80045),n=a(98139),l=a.n(n),i=a(65043),o=(a(96440),a(78602)),c=a(5673),d=a(67852),m=a(70579);const f=["as","bsPrefix","column","visuallyHidden","className","htmlFor"],u=i.forwardRef((e,s)=>{let{as:a="label",bsPrefix:n,column:u=!1,visuallyHidden:h=!1,className:x,htmlFor:A}=e,b=(0,r.A)(e,f);const{controlId:p}=(0,i.useContext)(c.A);n=(0,d.oU)(n,"form-label");let v="col-form-label";"string"===typeof u&&(v="".concat(v," ").concat(v,"-").concat(u));const y=l()(x,n,h&&"visually-hidden",u&&v);return A=A||p,u?(0,m.jsx)(o.A,(0,t.A)({ref:s,as:"label",className:y,htmlFor:A},b)):(0,m.jsx)(a,(0,t.A)({ref:s,className:y,htmlFor:A},b))});u.displayName="FormLabel";const h=u}}]); 2//# sourceMappingURL=184.0e9dcfb5.chunk.js.map
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.