PageSourceSearch

https://supporto.playcar.net/hc/theming_assets/01K09XFSK5REVWAYF28AXVXWSG

js playcar.net collected 2026-09-24 12:23:19 UTC 38,317 bytes, 82 lines download raw bytes

1import{j as e,F as n,L as t,S as s,H as r,I as a,M as o,r as i,u as l,a as u,N as c,T as d,C as m,s as f,b as h,d as p,e as j,f as b,h as g,O as x,i as w,k as q,l as v,p as y,m as k,n as _,o as C,P as S,A as F,q as T,t as I,D as P,v as R,w as L,x as $,y as E,z as D,B as M,E as G,$ as V,G as A,J as z,K as H,Q as N,R as O,U,V as B,W as X,X as W,Y as K,Z as Y,_ as J,a0 as Z,a1 as Q,a2 as ee,a3 as ne,a4 as te,a5 as se,a6 as re}from"shared";function ae({field:i,onChange:l}){const{label:u,error:c,value:d,name:m,required:f,description:h,type:p}=i,j={},b="integer"===p||"decimal"===p?"number":"text";"integer"===p&&(j.step="1"),"decimal"===p&&(j.step="any");const g="anonymous_requester_email"===p?"email":void 0;return e.jsxs(n,{children:[e.jsxs(t,{children:[u,f&&e.jsx(s,{"aria-hidden":"true",children:"*"})]}),h&&e.jsx(r,{dangerouslySetInnerHTML:{__html:h}}),e.jsx(a,{name:m,type:b,defaultValue:d,validation:c?"error":void 0,required:f,onChange:e=>{l&&l(e.target.value)},autoComplete:g,...j}),c&&e.jsx(o,{validation:"error",children:c})]})}const oe=f(n)`
2  .ck.ck-editor {
3    margin-top: ${e=>e.theme.space.xs};
4  }
5`,ie=f(o)`
6  .ck.ck-editor + & {
7    margin-top: ${e=>e.theme.space.xs};
8  }
9`;function le({field:n,hasWysiwyg:a,baseLocale:o,hasAtMentions:f,userRole:p,brandId:j,onChange:b}){const{label:g,error:x,value:w,name:q,required:v,description:y}=n,k=function({hasWysiwyg:n,baseLocale:t,hasAtMentions:s,userRole:r,brandId:a}){const o=i.useRef(!1),{addToast:f}=l(),{t:h}=u();return i.useCallback((async i=>{if(n&&i&&!o.current){o.current=!0;const{createEditor:n}=await import("wysiwyg").then((function(e){return e.m}));(await n(i,{editorType:"supportRequests",hasAtMentions:s,userRole:r,brandId:a,baseLocale:t})).plugins.get("Notification").on("show",((n,t)=>{n.stop();const s=t.message instanceof Error?t.message.message:t.message,{type:r,title:a}=t;f((({close:n})=>e.jsxs(c,{type:r,children:[e.jsx(d,{children:a}),s,e.jsx(m,{"aria-label":h("new-request-form.close-label","Close"),onClick:n})]})))}))}}),[n,t,s,r,a,f,h])}({hasWysiwyg:a,baseLocale:o,hasAtMentions:f,userRole:p,brandId:j});return e.jsxs(oe,{children:[e.jsxs(t,{children:[g,v&&e.jsx(s,{"aria-hidden":"true",children:"*"})]}),y&&e.jsx(r,{dangerouslySetInnerHTML:{__html:y}}),e.jsx(h,{ref:k,name:q,defaultValue:w,validation:x?"error":void 0,required:v,onChange:e=>b(e.target.value),rows:6,isResizable:!0}),x&&e.jsx(ie,{validation:"error",children:x})]})}function ue(){const{t:n}=u();return e.jsxs(e.Fragment,{children:[e.jsx(s,{"aria-hidden":"true",children:"-"}),e.jsx(s,{hidden:!0,children:n("new-request-form.dropdown.empty-option","Select an option")})]})}function ce({field:n,onChange:t}){const{label:r,options:a,error:o,value:l,name:u,required:c,description:d}=n,m=null==l?"":l.toString(),f=i.useRef(null);return i.useEffect((()=>{if(f.current&&c){const e=f.current.querySelector("[role=combobox]");e?.setAttribute("aria-required","true")}}),[f,c]),e.jsxs(p,{children:[e.jsxs(j,{children:[r,c&&e.jsx(s,{"aria-hidden":"true",children:"*"})]}),d&&e.jsx(b,{dangerouslySetInnerHTML:{__html:d}}),e.jsxs(g,{ref:f,inputProps:{name:u,required:c},isEditable:!1,validation:o?"error":void 0,inputValue:m,selectionValue:m,renderValue:({selection:n})=>n?.label||e.jsx(ue,{}),onChange:({selectionValue:e})=>{void 0!==e&&t(e)},children:[!c&&e.jsx(x,{value:"",label:"-",children:e.jsx(ue,{})}),a.map((n=>e.jsx(x,{value:n.value.toString(),label:n.name},n.value)))]}),o&&e.jsx(w,{validation:"error",children:o})]})}function de({field:a,onChange:l}){const{label:u,error:c,value:d,name:m,required:f,description:h}=a,[p,j]=i.useState(d);return e.jsxs(n,{children:[e.jsx("input",{type:"hidden",name:m,value:"off"}),e.jsxs(q,{name:m,required:f,defaultChecked:d,value:p?"on":"off",onChange:e=>{const{checked:n}=e.target;j(n),l(n)},children:[e.jsxs(t,{children:[u,f&&e.jsx(s,{"aria-hidden":"true",children:"*"})]}),h&&e.jsx(r,{dangerouslySetInnerHTML:{__html:h}})]}),c&&e.jsx(o,{validation:"error",children:c})]})}const me="[]";function fe(e){return`[${e.join("::")}]`}function he(e){return e.startsWith("[")&&e.endsWith("]")}function pe(e){const n=fe(e.slice(0,-1));return{type:"SubGroup",name:e[e.length-1],backOption:{type:"previous",label:"Back",value:n},options:[]}}function je({options:e,hasEmptyOption:n}){const t=i.useMemo((()=>function(e,n){const t={[me]:{type:"RootGroup",options:n?[{label:"-",value:""}]:[]}};return e.forEach((e=>{const{name:n,value:s}=e;if(n.includes("::")){const[e,r]=function(e){const n=e.split("::");return[n.slice(0,-1),n.slice(-1)[0]]}(n),a=fe(e);t[a]||(t[a]=pe(e)),t[a]?.options.push({value:s,label:n.split("::").join(" > "),menuLabel:r});for(let n=0;n<e.length;n++){const s=e.slice(0,n),r=e.slice(0,n+1),a=fe(s),o=fe(r);t[a]||(t[a]=pe(s)),void 0===t[a]?.options.find((e=>e.value===o))&&t[a]?.options.push({type:"next",label:r[r.length-1],value:o})}}else t[me].options.push({value:s,label:n})}
9)),t}(e,n)),[e,n]),[s,r]=i.useState(function(e){const n={type:"RootGroup",options:[]};return Object.values(e).forEach((({options:e})=>{n.options.push(...e.filter((({type:e})=>void 0===e)))})),n}(t));i.useEffect((()=>{r(t[me])}),[t]);return{currentGroup:s,isGroupIdentifier:he,setCurrentGroupByIdentifier:e=>{const n=t[e];n&&r(n)}}}function be({field:n}){const{label:t,options:r,error:a,value:o,name:l,required:u,description:c}=n,{currentGroup:d,isGroupIdentifier:m,setCurrentGroupByIdentifier:f}=je({options:r,hasEmptyOption:!1}),[h,q]=i.useState(o||[]),y=i.useRef(null);i.useEffect((()=>{if(y.current&&u){const e=y.current.querySelector("[role=combobox]");e?.setAttribute("aria-required","true")}}),[y,u]);return e.jsxs(p,{children:[h.map((n=>e.jsx("input",{type:"hidden",name:`${l}[]`,value:n},n))),e.jsxs(j,{children:[t,u&&e.jsx(s,{"aria-hidden":"true",children:"*"})]}),c&&e.jsx(b,{dangerouslySetInnerHTML:{__html:c}}),e.jsxs(g,{ref:y,isMultiselectable:!0,inputProps:{required:u},isEditable:!1,validation:a?"error":void 0,onChange:e=>{if(Array.isArray(e.selectionValue)){const n=e.selectionValue.slice(-1).toString();m(n)?f(n):q(e.selectionValue)}},selectionValue:h,maxHeight:"auto",children:["SubGroup"===d.type&&e.jsx(x,{...d.backOption}),"SubGroup"===d.type?e.jsx(v,{"aria-label":d.name,children:d.options.map((n=>e.jsx(x,{...n,children:n.menuLabel??n.label},n.value)))}):d.options.map((n=>e.jsx(x,{...n},n.value)))]}),a&&e.jsx(w,{validation:"error",children:a})]})}const ge="return-focus-to-ticket-form-field";function xe({field:n,newRequestPath:t}){const s=i.createRef();return i.useEffect((()=>{sessionStorage.getItem(ge)&&(sessionStorage.removeItem(ge),s.current?.firstChild?.focus())}),[]),e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"hidden",name:n.name,value:n.value}),n.options.length>1&&e.jsxs(p,{children:[e.jsx(j,{children:n.label}),e.jsx(g,{isEditable:!1,onChange:({selectionValue:e})=>
9{if(e&&"number"==typeof e){const n=new URL(window.location.href);n.searchParams.set("ticket_form_id",e),sessionStorage.setItem(ge,"true"),window.location.assign(`${t}${n.search}`)}},ref:s,children:n.options.map((t=>e.jsx(x,{value:t.value,label:t.name,isSelected:n.value===t.value,children:t.name},t.value)))})]})]})}function we({field:n}){const{value:t,name:s}=n;return e.jsx("input",{type:"hidden",name:s,value:t})}function qe(e){const n=i.useRef(!1),t=i.useRef(!1);return{formRefCallback:i.useCallback((s=>{s&&!n.current&&(n.current=!0,s.submit=async()=>{if(!1===t.current){t.current=!0;const n=await async function(){const e=await fetch("/api/v2/help_center/sessions.json"),{current_session:n}=await e.json();return n.csrf_token}(),r=document.createElement("input");r.type="hidden",r.name="authenticity_token",r.value=n,s.appendChild(r);const a=e.filter((e=>"partialcreditcard"===e.type));for(const e of a){const n=s.querySelector(`input[name="${e.name}"]`);n&&n instanceof HTMLInputElement&&4===n.value.length&&(n.value=`XXXXXXXXX${n.value}`)}HTMLFormElement.prototype.submit.call(s)}})}),[e]),handleSubmit:e=>{e.preventDefault(),e.target.submit()}}}const ve=2048,ye="tf_",ke=["true","false"],_e=["pre","strong","b","p","blockquote","ul","ol","li","h2","h3","h4","i","em","br"];function Ce(e,n){if(!Number.isNaN(Number(e))){const t=`request[custom_fields][${e}]`;return n.ticketFields.find((e=>e.name===t))}switch(e){case"anonymous_requester_email":return n.emailField;case"due_at":return n.dueDateField;case"collaborators":return n.ccField;case"organization_id":return n.organizationField;default:return n.ticketFields.find((n=>n.name===`request[${e}]`))}}function Se({ticketFields:e,ccField:n,dueDateField:t,emailField:s,organizationField:r}){return i.useMemo((()=>function(e){const{href:n}=location,t=new URL(n).searchParams,s={...e,ticketFields:[...e.ticketFields]};if(n.length>ve)return e;if(t.get("parent_id"))return e;for(const[e,n]of t){if(!e.startsWith(ye))continue;const t=Ce(e.substring(ye.length),s);if(!t)continue;const r=y.sanitize(n,{ALLOWED_TAGS:_e});switch(t.type){case"partialcreditcard":continue;case"multiselect":t.value=r.split(",").filter((e=>t.options.some((n=>n.value===e))));break;case"checkbox":ke.includes(r)&&(t.value="true"===r?"on":"false"===r?"off":"");break;default:t.value=r}}return s}({ticketFields:e,ccField:n,dueDateField:t,emailField:s,organizationField:r})),[e,n,t,s,r])}const Fe=f.div`
10  flex: 1;
11`;function Te({file:n,onRemove:t}){const{t:s}=u(),r=e=>{"Enter"!==e.code&&"Space"!==e.code&&"Delete"!==e.code&&"Backspace"!==e.code||(e.preventDefault(),t())},a="pending"===n.status?n.file_name:n.value.file_name,o=s("new-request-form.attachments.stop-upload","Stop upload"),i=s("new-request-form.attachments.remove-file","Remove file");return e.jsx(k.Item,{children:e.jsx(_,{type:"generic",title:a,onKeyDown:e=>{"Delete"!==e.code&&"Backspace"!==e.code||(e.preventDefault(),t())},children:"pending"===n.status?e.jsxs(e.Fragment,{children:[e.jsx(Fe,{children:a}),e.jsx(C,{content:o,children:e.jsx(_.Close,{"aria-label":o,onClick:()=>{t()},onKeyDown:r})}),e.jsx(S,{value:n.progress,"aria-label":s("new-request-form.attachments.uploading","Uploading {{fileName}}",{fileName:a})})]}):e.jsxs(e.Fragment,{children:[e.jsx(Fe,{children:e.jsx(F,{isExternal:!0,href:n.value.url,target:"_blank",children:a})}),e.jsx(C,{content:i,children:e.jsx(_.Delete,{"aria-label":i,onClick:()=>{t()},onKeyDown:r})}),e.jsx(S,{value:100,"aria-hidden":"true"})]})})})}async function Ie(){const e=await fetch("/api/v2/users/me.json"),{user:{authenticity_token:n}}=await e.json();return n}function Pe({field:s}){const{label:r,error:f,name:h,attachments:p}=s,{files:j,addPendingFile:b,setPendingFileProgress:g,setUploaded:x,removePendingFile:w,removeUploadedFile:q}=function(e){const[n,t]=i.useState(e);return{files:n,addPendingFile:i.useCallback(((e,n,s)=>{t((t=>[...t,{status:"pending",id:e,file_name:n,progress:0,xhr:s}]))}),[]),setPendingFileProgress:i.useCallback(((e,n)=>{t((t=>t.map((t=>"pending"===t.status&&t.id===e?{...t,progress:n}:t))))}),[]),removePendingFile:i.useCallback((e=>{t((n=>n.filter((n=>"pending"!==n.status||n.id!==e))))}),[]),removeUploadedFile:i.useCallback((e=>{t((n=>n.filter((n=>"uploaded"!==n.status||n.value.id!==e))))}),[]),setUploaded:i.useCallback(((e,n)=>{t((t=>t.map((t=>"pending"===t.status&&t.id===e?{status:"uploaded",value:n}:t))))}),[])}}(p.map((e=>({status:"uploaded",value:e})))??[]),{addToast:v}=l(),{t:y}=u(),k=i.useCallback((n=>{v((({close:t})=>e.jsxs(c,{type:"error",children:[e.jsx(d,{children:y("new-request-form.attachments.upload-error-title","Upload error")}),y("new-request-form.attachments.upload-error-description","There was an error uploading {{fileName}}. Try again or upload another file.",{fileName:n}),e.jsx(m,{"aria-label":y("new-request-form.close-label","Close"),onClick:t})]})))}),[v,y]),_=i.useCallback((async e=>{const n=await Ie();for(const t of e){const e=new XMLHttpRequest,s=new URL(`${window.location.origin}/api/v2/uploads.json`);s.searchParams.append("filename",t.name),e.open("POST",s),e.setRequestHeader("Content-Type",t.type),e.setRequestHeader("X-CSRF-Token",n),e.responseType="json";const r=crypto.randomUUID();b(r,t.name,e),e.upload.addEventListener("progress",(({loaded:e,total:n})=>{const t=Math.round(e/n*100);t<=90&&g(r,t)})),e.addEventListener("load",(()=>{if(e.status>=200&&e.status<300){const{upload:{attachment:{file_name:n,content_url:t},token:s}}=e.response;x(r,{id:s,file_name:n,url:t})}else k(t.name),w(r)})),e.addEventListener("error",(()=>{k(t.name),w(r)})),e.send(t)}}),[b,w,g,x,k]),{getRootProps:C,getInputProps:S,isDragActive:F}=T({onDrop:_});return e.jsxs(n,{children:[e.jsx(t,{children:r}),f&&e.jsx(o,{validation:"error",children:f}),e.jsxs(I,{...C(),isDragging:F,children:[F?e.jsx("span",{children:y("new-request-form.attachments.drop-files-label","Drop files here")}):e.jsx("span",{children:y("new-request-form.attachments.choose-file-label","Choose a file or drag and drop here")}),e.jsx(a,{...S()})]}),j.map((n=>e.jsx(Te,{file:n,onRemove:()=>{(async e=>{if("pending"===e.status)e.xhr.abort(),w(e.id);else{const n=await Ie(),t=e.value.id;q(e.value.id),await fetch(`/api/v2/uploads/${t}.json`,{method:"DELETE",headers:{"X-CSRF-Token":n}})}})(n)}},"pending"===n.status?n.id:n.value.id))),j.map((n=>"uploaded"===n.status&&e.jsx("input",{type:"hidden",name:h,value:JSON.stringify(n.value)},n.value.id)))]})}function Re({field:l,locale:u,valueFormat:c,onChange:d}){const{label:m,error:f,value:h,name:p,required:j,description:b}=l,[g,x]=i.useState(h?new Date(h):void 0),w=e=>{if(void 0===e)return"";const n=e.toISOString();return"dateTime"===c?n:n.split("T")[0]};return e.jsxs(n,{children:[e.jsxs(t,{children:[m,j&&e.jsx(s,{"aria-hidden":"true",children:"*"})]}),b&&e.jsx(r,{dangerouslySetInnerHTML:{__html:b}}),e.jsx(P,{value:g,onChange:e=>{const n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),12,0,0));x(n);const t=w(n);void 0!==t&&d(t)},locale:u,children:e.jsx(a,{required:j,lang:u,onChange:e=>{""===e.target.value&&(x(void 0),d(""))},validation:f?"error":void 0})}),f&&e.jsx(o,{validation:"error",children:f}),e.jsx("input",{type:"hidden",name:p,value:w(g)})]})}const Le=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,$e=f($)`
12  padding: ${e=>`${e.theme.space.xxs} ${e.theme.space.sm}`};
13
14  // Removes white spaces for inline elements
15  font-size: 0;
16
17  // Same as height of Tag size="large" + base space (4px)
18  // to give some vertical space between tags
19  --line-height: ${e=>8*e.theme.space.base+e.theme.space.base}px;
20  line-height: var(--line-height);
21`,Ee=f.span`
22  display: inline-block;
23  margin-right: ${e=>e.theme.space.sm};
24`,De=f(E)`
25  ${e=>L({theme:e.theme,shadowWidth:"sm",selector:"&:focus"})}
26`,Me=f.div`
27  display: inline-block;
28  position: relative;
29`,Ge=f($)`
30  display: inline-block;
31  min-width: 200px;
32  opacity: 0;
33  user-select: none;
34  height: var(--line-height);
35  line-height: var(--line-height);
36`,Ve=f(a)`
37  position: absolute;
38  top: 0;
39  left: 0;
40  height: var(--line-height);
41  line-height: var(--line-height);
42`;function Ae({field:a}){const{label:l,value:c,name:d,error:m,description:f}=a,{t:h}=u(),p=c?c.split(",").map((e=>e.trim())):[],[j,b]=i.useState(p),[g,x]=i.useState(""),w=i.useRef(null),q=i.useRef(null),{getContainerProps:v,getGridProps:y,getGridRowProps:k,getGridCellProps:_,getTagCloseProps:S,getInputProps:F,getAnnouncementProps:T,announcement:I}=function({tags:e,onTagsChange:n,inputValue:t,onInputValueChange:s,inputRef:r,gridRowRef:a,i18n:o}){const[l,u]=i.useState(0),[c,d]=i.useState(""),m=i.useCallback(((e,n)=>{u(n)}),[u]),{getGridProps:f,getGridCellProps:h}=R({matrix:[e],rowIndex:0,colIndex:l,onChange:m}),p=n=>e.includes(n),j=t=>{n([...e,t]),d(o.addedTag(t))},b=t=>{const s=e[t];n(e.filter(((e,n)=>n!==t))),d(o.removedTag(s)),u(0),setTimeout((()=>{const e=a.current?.querySelector('[tabindex="0"]');e?.focus()}),100)},g=e=>{e.target===e.currentTarget&&r.current?.focus()},x=()=>{u(0)},w=e=>{const n=e.target.value;!n||"Space"!==e.code&&"Enter"!==e.code&&"Comma"!==e.code&&"Tab"!==e.code||(e.preventDefault(),p(n)||j(n),s(""))},q=e=>{const n=e.target.value,[t,r]=[n.slice(0,-1),n.slice(-1)];" "===r||","===r?(t.length>0&&!p(t)&&j(t),s("")):s(n)},v=t=>{t.preventDefault();const s=t.clipboardData.getData("text"),r=new Set(s.split(/[\s,;]+/).filter((n=>!e.includes(n))));n([...e,...r]),d(o.addedTags([...r]))},y=e=>n=>{"Backspace"===n.code&&(n.preventDefault(),b(e))},k=e=>()=>{b(e)};return{getContainerProps:()=>({onClick:g,onBlur:x,tabIndex:-1}),getGridProps:f,getGridRowProps:()=>({role:"row"}),getGridCellProps:e=>h({rowIndex:0,colIndex:e,onKeyDown:y(e)}),getTagCloseProps:e=>({onClick:k(e)}),getInputProps:()=>({value:t,onChange:q,onKeyDown:w,onPaste:v}),announcement:c,getAnnouncementProps:()=>({"aria-live":"polite","aria-relevant":"text"})}}({tags:j,onTagsChange:b,inputValue:g,onInputValueChange:x,inputRef:w,gridRowRef:q,i18n:{addedTag:e=>h("new-request-form.cc-field.email-added","{{email}} has been added",{email:e}),removedTag:e=>h("new-request-form.cc-field.email-removed","{{email}} has been removed",{email:e}),addedTags:e=>h("new-request-form.cc-field.emails-added","{{emails}} have been added",{emails:e})}}),P=(n,t,s)=>e.jsxs(De,{size:"large","aria-label":h("new-request-form.cc-field.email-label","{{email}} - Press Backspace to remove",{email:s}),hue:t?void 0:"red",children:[!t&&e.jsx(E.Avatar,{children:e.jsx(D,{})}),e.jsx("span",{children:s}),e.jsx(E.Close,{...S(n)})]});return e.jsxs(n,{children:[e.jsx(t,{children:l}),f&&e.jsx(r,{children:f}),e.jsxs($e,{...v(),children:[j.length>0&&e.jsx("span",{...y({"aria-label":h("new-request-form.cc-field.container-label","Selected CC emails")}),children:e.jsx("span",{ref:q,...k(),children:j.map(((n,t)=>{const s=Le.test(n);return s?e.jsx(Ee,{..._(t),children:P(t,s,n)},t):e.jsx(C,{content:h("new-request-form.cc-field.invalid-email","Invalid email address"),children:e.jsx(Ee,{..._(t),children:P(t,s,n)})},t)}))})}),e.jsxs(Me,{children:[e.jsx(Ge,{isBare:!0,"aria-hidden":"true",tabIndex:-1,children:g}),e.jsx(Ve,{ref:w,isBare:!0,...F()})]})]}),m&&e.jsx(o,{validation:"error",children:m}),j.map((n=>e.jsx("input",{type:"hidden",name:d,value:n},n))),e.jsx(s,{hidden:!0,...T(),children:I})]})}const ze=f(s)`
43  margin-left: ${e=>e.theme.space.xxs};
44`;function He({field:a,onChange:i}){const{t:l}=u(),{label:c,error:d,value:m,name:f,required:h,description:p}=a,j=function(e){return e?e.replaceAll("X",""):""}(m);return e.jsxs(n,{children:[e.jsxs(t,{children:[c,h&&e.jsx(s,{"aria-hidden":"true",children:"*"}),e.jsx(ze,{children:l("new-request-form.credit-card-digits-hint","(Last 4 digits)")})]}),p&&e.jsx(r,{dangerouslySetInnerHTML:{__html:p}}),e.jsx(M,{start:e.jsx(G,{}),name:f,type:"text",value:j,onChange:e=>i(e.target.value),validation:d?"error":void 0,required:h,maxLength:4}),d&&e.jsx(o,{validation:"error",children:d})]})}function Ne({field:n,onChange:t}){const{label:r,options:a,error:o,value:l,name:u,required:c,description:d}=n,{currentGroup:m,isGroupIdentifier:f,setCurrentGroupByIdentifier:h}=je({options:a,hasEmptyOption:!0}),q=l??"",[y,k]=i.useState(!1),_=i.useRef(null);i.useEffect((()=>
44{if(_.current&&c){const e=_.current.querySelector("[role=combobox]");e?.setAttribute("aria-required","true")}}),[_,c]);return e.jsxs(p,{children:[e.jsxs(j,{children:[r,c&&e.jsx(s,{"aria-hidden":"true",children:"*"})]}),d&&e.jsx(b,{dangerouslySetInnerHTML:{__html:d}}),e.jsxs(g,{ref:_,inputProps:{required:c,name:u},isEditable:!1,validation:o?"error":void 0,onChange:e=>{"string"==typeof e.selectionValue&&f(e.selectionValue)?h(e.selectionValue):("string"==typeof e.selectionValue&&t(e.selectionValue),void 0!==e.isExpanded&&k(e.isExpanded))},selectionValue:q,inputValue:q,renderValue:({selection:n})=>n?.label??e.jsx(ue,{}),isExpanded:y,children:["SubGroup"===m.type&&e.jsx(x,{...m.backOption}),"SubGroup"===m.type?e.jsx(v,{"aria-label":m.name,children:m.options.map((n=>e.jsx(x,{...n,children:n.menuLabel??n.label},n.value)))}):m.options.map((n=>""===n.value?e.jsx(x,{...n,children:e.jsx(ue,{})},n.value):e.jsx(x,{...n},n.value)))]}),o&&e.jsx(w,{validation:"error",children:o})]})}const Oe=V`
45  from {
46    grid-template-rows: 0fr;
47  }
48  to {
49    grid-template-rows: 1fr;
50  }
51`,Ue=f.div`
52  display: grid;
53  animation: ${Oe} 200ms forwards;
54`,Be=f.div`
55  overflow: hidden;
56`,Xe=f.ul`
57  list-style: none;
58  padding: 0;
59  margin: 0;
60`,We=f.li`
61  margin: ${e=>e.theme.space.sm} 0;
62`;function Ke({query:n,locale:t}){const s=function(e,n){const[t,s]=i.useState(e);return i.useEffect((()=>{const t=setTimeout((()=>s(e)),n);return()=>{clearTimeout(t)}}),[e,n]),t}(n,500),[r,a]=i.useState([]),o=i.useRef({}),{t:l}=u();return i.useEffect((()=>{const e=s?.trim().toLocaleLowerCase();if(!e||!function(e){const n=e.charCodeAt(0);return n>=19968&&n<=195103?e.length>=2:e.length>=3}(e))return void a([]);const n=new URL(`${window.location.origin}/api/v2/help_center/deflection/suggestions.json`);n.searchParams.append("locale",t),n.searchParams.append("query",e);const r=o.current[n.toString()];r?a(r):fetch(n).then((e=>e.json())).then((({results:e})=>{o.current[n.toString()]=e,a(e)}))}),[s,t]),r.length>0?e.jsx(Ue,{"data-test-id":"suggested-articles",children:e.jsxs(Be,{children:[e.jsx("h2",{children:l("new-request-form.suggested-articles","Suggested articles")}),e.jsx(Xe,{children:r.map((n=>e.jsx(We,{children:e.jsx(F,{href:n.html_url,children:n.name})},n.html_url)))})]})}):null}const Ye=f.h3`
63  font-size: ${e=>e.theme.fontSizes.md};
64  font-weight: ${e=>e.theme.fontWeights.bold};
65`,Je=f(z)`
66  color: ${e=>A("successHue",700,e.theme)};
67`,Ze=f(H)`
68  position: absolute;
69  top: ${e=>5.5*e.theme.space.base}px;
70  inset-inline-start: ${e=>4*e.theme.space.base+"px"};
71`,Qe=f(F)`
72  display: inline-block;
73  margin-top: ${e=>e.theme.space.sm};
74`;function en({authToken:n,interactionAccessToken:t,articles:s,requestId:r,hasRequestManagement:a,isSignedIn:o,helpCenterPath:l,requestsPath:c,requestPath:d}){const[m,f]=i.useState(0),h=N(),{t:p}=u(),j=()=>String(s[m]?.article_id),b=()=>{Z({type:"success",message:p("new-request-form.answer-bot-modal.request-submitted","Your request was successfully submitted")}),window.location.assign((()=>{if(o)return a?d:l;{const e=new URLSearchParams;return e.set("return_to",c),`${l}?${e.toString()}`}})())};return e.jsxs(O,{appendToNode:h,onClose:()=>{b()},children:[e.jsxs(Je,{tag:"h2",children:[e.jsx(Ze,{}),p("new-request-form.answer-bot-modal.request-submitted","Your request was successfully submitted")]}),e.jsxs(U,{children:[e.jsx(Ye,{children:p("new-request-form.answer-bot-modal.title","While you wait, do any of these articles answer your question?")}),e.jsx("p",{children:p("new-request-form.answer-bot-modal.footer-content","If it does, we can close your recent request {{requestId}}",{requestId:`‭#${r}‬`})}),e.jsx(B,{level:4,expandedSections:[m],onChange:e=>{f(e)},children:s.map((({article_id:t,html_url:s,snippet:r,title:a})=>e.jsxs(B.Section,{children:[e.jsx(B.Header,{children:e.jsx(B.Label,{children:a})}),e.jsxs(B.Panel,{children:[e.jsx(X,{dangerouslySetInnerHTML:{__html:r}}),e.jsx(Qe,{isExternal:!0,href:`${s}?auth_token=${n}`,target:"_blank",children:p("new-request-form.answer-bot-modal.view-article","View article")})]})]},t)))})]}),e.jsxs(W,{children:[e.jsx(K,{children:e.jsx(Y,{onClick:()=>{(async()=>{await fetch("/api/v2/answer_bot/rejection",{method:"POST",body:JSON.stringify({article_id:j(),interaction_access_token:t,reason_
74id:0}),headers:{"Content-Type":"application/json"}}),b()})()},children:p("new-request-form.answer-bot-modal.mark-irrelevant","No, I need help")})}),e.jsx(K,{children:e.jsx(Y,{isPrimary:!0,onClick:()=>{(async()=>{(await fetch("/api/v2/answer_bot/resolution",{method:"POST",body:JSON.stringify({article_id:j(),interaction_access_token:t}),headers:{"Content-Type":"application/json"}})).ok?Z({type:"success",message:p("new-request-form.answer-bot-modal.request-closed","Nice. Your request has been closed.")}):Z({type:"error",message:p("new-request-form.answer-bot-modal.solve-error","There was an error closing your request")}),window.location.href=l})()},children:p("new-request-form.answer-bot-modal.solve-request","Yes, close my request")})})]}),e.jsx(J,{"aria-label":p("new-request-form.close-label","Close")})]})}const nn=f(X)`
75  margin: ${e=>e.theme.space.md} 0;
76`,tn=f.form`
77  display: flex;
78  flex-direction: column;
79  gap: ${e=>e.theme.space.md};
80`,sn=f.div`
81  margin-top: ${e=>e.theme.space.md};
82`;function rn({requestForm:n,wysiwyg:t,newRequestPath:s,parentId:r,parentIdPath:a,locale:o,baseLocale:l,hasAtMentions:c,userRole:d,brandId:m,answerBotModal:f}){const{ticket_fields:h,action:p,http_method:j,accept_charset:b,errors:g,parent_id_field:x,ticket_form_field:w,email_field:q,cc_field:v,organization_field:y,due_date_field:k,end_user_conditions:_,attachments_field:C,inline_attachments_fields:S,description_mimetype_field:T}=n,{answerBot:I}=f,{ticketFields:P,emailField:R,ccField:L,organizationField:$,dueDateField:E}=Se({ticketFields:h,emailField:q,ccField:v,organizationField:y,dueDateField:k}),[D,M]=i.useState(P),[G,V]=i.useState($),[A,z]=i.useState(E),H=(O=_,(N=D).reduce(((e,n)=>{const t=O.filter((e=>e.child_fields.some((e=>e.id===n.id)))),s=t.find((e=>N.find((n=>n.id===e.parent_field_id))?.value===e.value)),r=s?.child_fields.find((e=>e.id===n.id));return(0===t.length||s)&&e.push({...n,required:r?r.is_required:n.required}),e}),[]));var N,O;const{formRefCallback:U,handleSubmit:B}=qe(D),{t:X}=u();function W(e,n){M(D.map((t=>t.name===e.name?{...t,value:n}:t)))}return e.jsxs(e.Fragment,{children:[r&&e.jsx(nn,{children:e.jsx(F,{href:a,children:X("new-request-form.parent-request-link","Follow-up to request {{parentId}}",{parentId:`‭#${r}‬`})})}),e.jsx(nn,{"aria-hidden":"true",children:X("new-request-form.required-fields-info","Fields marked with an asterisk (*) are required.")}),e.jsxs(tn,{ref:U,action:p,method:j,acceptCharset:b,noValidate:!0,onSubmit:B,children:[g&&e.jsx(Q,{type:"error",children:g}),x&&e.jsx(we,{field:x}),w.options.length>0&&e.jsx(xe,{field:w,newRequestPath:s}),R&&e.jsx(ae,{field:R},R.name),L&&e.jsx(Ae,{field:L}),G&&e.jsx(ce,{field:G,onChange:e=>{!function(e){null!==G&&V({...G,value:e})}(e)}},G.name),H.map((n=>{switch(n.type){case"subject":return e.jsxs(e.Fragment,{children:[e.jsx(ae,{field:n,onChange:e=>W(n,e)},n.name),e.jsx(Ke,{query:n.value,locale:o})]});case"text":case"integer":case"decimal":case"regexp":return e.jsx(ae,{field:n,onChange:e=>W(n,e)},n.name);case"partialcreditcard":return e.jsx(He,{field:n,onChange:e=>W(n,e)});case"description":return e.jsxs(e.Fragment,{children:[e.jsx(le,{field:n,hasWysiwyg:t,baseLocale:l,hasAtMentions:c,userRole:d,brandId:m,onChange:e=>W(n,e)},n.name),e.jsx("input",{type:"hidden",name:T.name,value:t?"text/html":"text/plain"})]});case"textarea":return e.jsx(le,{field:n,hasWysiwyg:!1,baseLocale:l,hasAtMentions:c,userRole:d,brandId:m,onChange:e=>W(n,e)},n.name);case"priority":case"tickettype":return e.jsxs(e.Fragment,{children:[e.jsx(ce,{field:n,onChange:e=>W(n,e)},n.name),"task"===n.value&&e.jsx(Re,{field:A,locale:l,valueFormat:"dateTime",onChange:e=>{!function(e){null!==A&&z({...A,value:e})}(e)}})]});case"checkbox":return e.jsx(de,{field:n,onChange:e=>W(n,e)});case"date":return e.jsx(Re,{field:n,locale:l,valueFormat:"date",onChange:e=>W(n,e)});case"multiselect":return e.jsx(be,{field:n});case"tagger":return e.jsx(Ne,{field:n,onChange:e=>W(n,e)},n.name);default:return e.jsx(e.Fragment,{})}})),C&&e.jsx(Pe,{field:C}),S.map((({type:n,name:t,value:s},r)=>e.jsx("input",{type:n,name:t,value:s},r))),e.jsx(sn,{children:(0===w.options.length||w.value)&&e.jsx(Y,{isPrimary:!0,type:"submit",children:X("new-request-form.submit","Submit")})})]}),I.auth_token&&I.interaction_access_token&&I.articles.length>0&&I.request_id&&e.jsx(en,{authToken:I.auth_token,interactionAccessToken:I.interaction_access_token,articles:I.articles,requestId:I.request_id,...f})]})}async function an(n,t,s){const{baseLocale:r}=t;ee(r),await ne(r,(()=>function(e){switch(e){case"./translations/locales/af.json":return import("new-request-form-translations").then((function(e){return e.a}));case"./translations/locales/ar-x-pseudo.json":return import("new-request-form-translations").then((function(e){return e.b}));case"./translations/locales/ar.json":return import("new-request-form-translations").then((function(e){return e.c}));case"./translations/locales/az.json":return import("new-request-form-translations").then((function(e){return e.d}));case"./translations/locales/be.json":return import("new-request-form-translations").then((function(e){return e.e}));case"./translations/locales/bg.json":return import("new-request-form-translations").then((function(e){return e.f}));case"./translations/locales/bn.json":return import("new-request-form-translations").then((function(e){return e.g}));case"./translations/locales/bs.json":return import("new-request-form-translations").then((function(e){return e.h}));case"./translations/locales/ca.json":return import("new-request-form-translations").then((function(e){return e.i}));case"./translations/locales/cs.json":return import("new-request-form-translations").then((function(e){return e.j}));case"./translations/locales/cy.json":return import("new-request-form-translations").then((function(e){return e.k}));case"./translations/locales/da.json":return import("new-request-form-translations").then((function(e){return e.l}));case"./translations/locales/de-x-informal.json":return import("new-request-form-translations").then((function(e){return e.m}));case"./translations/locales/de.json":return import("new-request-form-translations").then((function(e){return e.n}));case"./translations/locales/el.json":return import("new-request-form-translations").then((function(e){return e.o}));case"./translations/locales/en-001.json":return import("new-request-form-translations").then((function(e){return e.p}));case"./translations/locales/en-150.json":return import("new-request-form-translations").then((function(e){return e.q}));case"./translations/locales/en-au.json":return import("new-request-form-translations").then((function(e){return e.r}));case"./translations/locales/en-ca.json":return import("new-request-form-translations").then((function(e){return e.s}));case"./translations/locales/en-gb.json":return import("new-request-form-translations").then((function(e){return e.t}));case"./translations/locales/en-my.json":return import("new-request-form-translations").then((function(e){return e.u}));case"./translations/locales/en-ph.json":return import("new-request-form-translations").then((function(e){return e.v}));case"./translations/locales/en-se.json":return import("new-request-form-translations").then((function(e){return e.w}));case"./translations/locales/en-us.json":return import("new-request-form-translations").then((function(e){return e.x}));case"./translations/locales/en-x-dev.json":return import("new-request-form-translations").then((function(e){return e.y}));case"./translations/locales/en-x-keys.json":return import("new-request-form-translations").then((function(e){return e.z}));case"./translations/locales/en-x-obsolete.json":return import("new-request-form-translations").then((function(e){return e.A}));case"./translations/locales/en-x-pseudo.json":return import("new-request-form-translations").then((function(e){return e.B}));case"./translations/locales/en-x-test.json":return import("new-request-form-translations").then((function(e){return e.C}));case"./translations/locales/es-419.json":return import("new-request-form-translations").then((function(e){return e.D}));case"./translations/locales/es-es.json":return import("new-request-form-translations").then((function(e){return e.E}));case"./translations/locales/es.json":return import("new-request-form-translations").then((function(e){return e.F}));case"./translations/locales/et.json":return import("new-request-form-translations").then((function(e){return e.G}));case"./translations/locales/eu.json":return import("new-request-form-translations").then((function(e){return e.H}));case"./translations/locales/fa-af.json":return import("new-request-form-translations").then((function(e){return e.I}));case"./translations/locales/fa.json":return import("new-request-form-translations").then((function(e){return e.J}));case"./translations/locales/fi.json":return import("new-request-form-translations").then((function(e){return e.K}));case"./translations/locales/fil.json":return import("new-request-form-translations").then((function(e){return e.L}));case"./translations/locales/fo.json":return import("new-request-form-translations").then((function(e){return e.M}));case"./translations/locales/fr-ca.json":return import("new-request-form-translations").then((function(e){return e.N}));case"./translations/locales/fr.json":return import("new-request-form-translations").then((function(e){return e.O}));case"./translations/locales/ga.json":return import("new-request-form-translations").then((function(e){return e.P}));case"./translations/locales/he.json":return import("new-request-form-translations").then((function(e){return e.Q}));case"./translations/locales/hi.json":return import("new-request-form-translations").then((function(e){return e.R}));case"./translations/locales/hr.json":return import("new-request-form-translations").then((function(e){return e.S}));case"./translations/locales/hu.json":return import("new-request-form-translations").then((function(e){return e.T}));case"./translations/locales/hy.json":return import("new-request-form-translations").then((function(e){return e.U}));case"./translations/locales/id.json":return import("new-request-form-translations").then((function(e){return e.V}));case"./translations/locales/is.json":return import("new-request-form-translations").then((function(e){return e.W}));case"./translations/locales/it-ch.json":return import("new-request-form-translations").then((function(e){return e.X}));case"./translations/locales/it.json":return import("new-request-form-translations").then((function(e){return e.Y}));case"./translations/locales/ja.json":return import("new-request-form-translations").then((function(e){return e.Z}
82));case"./translations/locales/ka.json":return import("new-request-form-translations").then((function(e){return e._}));case"./translations/locales/kk.json":return import("new-request-form-translations").then((function(e){return e.$}));case"./translations/locales/kl-dk.json":return import("new-request-form-translations").then((function(e){return e.a0}));case"./translations/locales/ko.json":return import("new-request-form-translations").then((function(e){return e.a1}));case"./translations/locales/ku.json":return import("new-request-form-translations").then((function(e){return e.a2}));case"./translations/locales/lt.json":return import("new-request-form-translations").then((function(e){return e.a3}));case"./translations/locales/lv.json":return import("new-request-form-translations").then((function(e){return e.a4}));case"./translations/locales/mk.json":return import("new-request-form-translations").then((function(e){return e.a5}));case"./translations/locales/mn.json":return import("new-request-form-translations").then((function(e){return e.a6}));case"./translations/locales/ms.json":return import("new-request-form-translations").then((function(e){return e.a7}));case"./translations/locales/mt.json":return import("new-request-form-translations").then((function(e){return e.a8}));case"./translations/locales/my.json":return import("new-request-form-translations").then((function(e){return e.a9}));case"./translations/locales/nl-be.json":return import("new-request-form-translations").then((function(e){return e.aa}));case"./translations/locales/nl.json":return import("new-request-form-translations").then((function(e){return e.ab}));case"./translations/locales/no.json":return import("new-request-form-translations").then((function(e){return e.ac}));case"./translations/locales/pl.json":return import("new-request-form-translations").then((function(e){return e.ad}));case"./translations/locales/pt-br.json":return import("new-request-form-translations").then((function(e){return e.ae}));case"./translations/locales/pt.json":return import("new-request-form-translations").then((function(e){return e.af}));case"./translations/locales/ro.json":return import("new-request-form-translations").then((function(e){return e.ag}));case"./translations/locales/ru.json":return import("new-request-form-translations").then((function(e){return e.ah}));case"./translations/locales/sk.json":return import("new-request-form-translations").then((function(e){return e.ai}));case"./translations/locales/sl.json":return import("new-request-form-translations").then((function(e){return e.aj}));case"./translations/locales/sq.json":return import("new-request-form-translations").then((function(e){return e.ak}));case"./translations/locales/sr-me.json":return import("new-request-form-translations").then((function(e){return e.al}));case"./translations/locales/sr.json":return import("new-request-form-translations").then((function(e){return e.am}));case"./translations/locales/sv.json":return import("new-request-form-translations").then((function(e){return e.an}));case"./translations/locales/th.json":return import("new-request-form-translations").then((function(e){return e.ao}));case"./translations/locales/tr.json":return import("new-request-form-translations").then((function(e){return e.ap}));case"./translations/locales/uk.json":return import("new-request-form-translations").then((function(e){return e.aq}));case"./translations/locales/ur.json":return import("new-request-form-translations").then((function(e){return e.ar}));case"./translations/locales/uz.json":return import("new-request-form-translations").then((function(e){return e.as}));case"./translations/locales/vi.json":return import("new-request-form-translations").then((function(e){return e.at}));case"./translations/locales/zh-cn.json":return import("new-request-form-translations").then((function(e){return e.au}));case"./translations/locales/zh-tw.json":return import("new-request-form-translations").then((function(e){return e.av}));default:return new Promise((function(n,t){("function"==typeof queueMicrotask?queueMicrotask:setTimeout)(t.bind(null,new Error("Unknown variable dynamic import: "+e)))}))}}(`./translations/locales/${r}.json`))),te.render(e.jsx(se,{theme:re(n),children:e.jsx(rn,{...t})}),s)}export{an as renderNewRequestForm};

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.