@digital-realty/ui-service-management 14.0.1 → 14.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist/ui-service-management.js +3 -3
- package/dist/ui-service-management10.js +1 -1
- package/dist/ui-service-management14.js +1 -1
- package/dist/ui-service-management15.js +1 -1
- package/dist/ui-service-management16.js +1 -1
- package/dist/ui-service-management17.js +1 -1
- package/dist/ui-service-management19.js +1 -1
- package/dist/ui-service-management2.js +1 -1
- package/dist/ui-service-management20.js +1 -1
- package/dist/ui-service-management21.js +1 -1
- package/dist/ui-service-management22.js +1 -1
- package/dist/ui-service-management24.js +1 -1
- package/dist/ui-service-management25.js +1 -1
- package/dist/ui-service-management26.js +1 -1
- package/dist/ui-service-management27.js +1 -1
- package/dist/ui-service-management28.js +1 -1
- package/dist/ui-service-management29.js +1 -1
- package/dist/ui-service-management30.js +1 -1
- package/dist/ui-service-management31.js +1 -1
- package/dist/ui-service-management4.js +1 -1
- package/dist/ui-service-management5.js +2 -2
- package/dist/ui-service-management6.js +2 -2
- package/dist/ui-service-management7.js +1 -1
- package/dist/ui-service-management8.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate as E}from"tslib";import{css as bt,html as g,LitElement as Rt,nothing as P,svg as Ot}from"lit";import{property as we,customElement as X,state as Ji}from"lit/decorators.js";import G from"moment";import{baseTheme as ua}from"@digital-realty/theme";import he from"moment-timezone";import"date-fns/format.js";import{makeAutoObservable as se}from"mobx";import{makePersistable as Je}from"mobx-persist-store";import{authedUser as ot}from"@digital-realty/ix-account-switcher";import{Router as rt}from"@vaadin/router";import{User as la,UserManager as ma}from"oidc-client-ts";import{MobxLitElement as _e}from"@adobe/lit-mobx";import{ifDefined as pa}from"lit/directives/if-defined.js";import"@digital-realty/ix-select/ix-select.js";import"@digital-realty/ix-select/ix-select-option.js";import"@digital-realty/ix-icon-button/ix-icon-button.js";import{until as fe}from"lit-html/directives/until.js";import{isPossiblePhoneNumber as ha}from"libphonenumber-js";var gi;(function(e){e.CustomerSupport="customer-support",e.FacilityAccess="facility-access",e.RemoteHands="remote-hands",e.DeliveriesAndRemovals="deliveries-removals",e.TroubleTicket="trouble-ticket"})(gi||(gi={}));var y;(function(e){e.CustomerSupport="customer-support",e.FacilityAccess="facility-access",e.VisitorAccess="visitor-access",e.PermanentBadge="permanent-badge",e.OSPAccess="osp-access",e.POPPOEAccess="pop-poe-access",e.RemoteHands="remote-hands",e.Deliveries="deliveries",e.Removals="removals",e.DeliveriesAndRemovals="deliveries-removals",e.TroubleTickets="trouble-tickets"})(y||(y={}));const va="ticketViewType";var wi;(function(e){e.PlannedWork="Planned Work",e.UrgentWork="Urgent Work"})(wi||(wi={}));var H;(function(e){e.TelxSFDC="TelxSFDC",e.Insite="InSite",e.ServiceNow="ServiceNow"})(H||(H={}));const ct="YYYY-MM-DD",ga="HH:mm:ss",$t="HH:mm",wa="YYYY-MM-DD HH:mm";var w;(function(e){e.Default="default",e.Submitting="submitting",e.Submitted="submitted",e.Error="error"})(w||(w={}));var Q;(function(e){e.Deliveries="deliveries-tickets",e.FacilityAccess="osp-access-tickets",e.TroubleTickets="trouble-tickets",e.RemoteHands="remote-hands-tickets"})(Q||(Q={}));const Wi=[{label:"CSV",extensions:["csv"]},{label:"DOC/X",extensions:["doc","docx"]},{label:"GIF",extensions:["gif"]},{label:"JPG (JPEG)",extensions:["jpg","jpeg"]},{label:"PDF",extensions:["pdf"]},{label:"PNG",extensions:["png"]},{label:"XLS/X",extensions:["xls","xlsx"]}],fa=[{label:"JPG (JPEG)",extensions:["image/jpg","image/jpeg"]},{label:"PDF",extensions:["application/pdf"]},{label:"PNG",extensions:["image/png"]},{label:"GIF",extensions:["image/gif"]}],ka=Wi.flatMap(e=>e.extensions),ya=fa.flatMap(e=>e.extensions),Ta=e=>{var t;return Number((t=e.split("cursor=").pop())===null||t===void 0?void 0:t.split("&")[0])},Gi=async(e,t)=>{const i=await t({...e,cursor:"1"});if(!i)return[];const s=[...i.items];if(i.last&&i.self!==i.last){const n=[];let o=1;o=Ta(i.last);for(let a=2;a<=o;a+=1)n.push(t({...e,cursor:a.toString()}));await Promise.all(n).then(a=>{a.forEach(r=>{r&&s.push(...r.items)})})}return s},ba=e=>{var t,i;return e?"name"in e?((t=e.name)===null||t===void 0?void 0:t.trim())||e.id||"":((i=e.comment)===null||i===void 0?void 0:i.trim())||e.id||"":""},Ra="https://api.digitalrealty.com/service-management/v1".replace(/\/+$/,"");class Zi{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Ra}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Ki}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Aa=new Zi;class ai{constructor(t=Aa){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new Ca(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?ai.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new Sa(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;Ia(r.body)||r.body instanceof URLSearchParams||_a(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}ai.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function _a(e){return typeof Blob<"u"&&e instanceof Blob}function Ia(e){return typeof FormData<"u"&&e instanceof FormData}class Sa extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class Ca extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class ne extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function I(e,t){return e[t]!=null}function Ki(e,t=""){return Object.keys(e).map(i=>Yi(i,e[i],t)).filter(i=>i.length>0).join("&")}function Yi(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return Yi(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Ki(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class Ne{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class Na{constructor(t){this.raw=t}async value(){return await this.raw.blob()}}const Pa="https://api.digitalrealty.com".replace(/\/+$/,"");class Et{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Pa}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Qi}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const qa=new Et;class kt{constructor(t=qa){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new Oa(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?kt.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new Xi(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;Ba(r.body)||r.body instanceof URLSearchParams||Da(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}kt.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function Da(e){return typeof Blob<"u"&&e instanceof Blob}function Ba(e){return typeof FormData<"u"&&e instanceof FormData}class Xi extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class Oa extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class $ extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function h(e,t){return e[t]!=null}function Qi(e,t=""){return Object.keys(e).map(i=>es(i,e[i],t)).filter(i=>i.length>0).join("&")}function es(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return es(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Qi(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class j{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class ts{constructor(t){this.raw=t}async value(){return await this.raw.blob()}}class $a extends kt{async getCourierBySiteRaw(t,i){if(t.accountNumber===null||t.accountNumber===void 0)throw new $("accountNumber","Required parameter requestParameters.accountNumber was null or undefined when calling getCourierBySite.");if(t.site===null||t.site===void 0)throw new $("site","Required parameter requestParameters.site was null or undefined when calling getCourierBySite.");const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/deliveries-removals/courier-companies",method:"GET",headers:n,query:s},i);return new j(o)}async getCourierBySite(t,i){return await(await this.getCourierBySiteRaw(t,i)).value()}}function is(e){if(e!==void 0)return e===null?null:{cancellationReason:e.cancellationReason}}function ss(e){return Ea(e)}function Ea(e,t){return e==null?e:{message:h(e,"message")?e.message:void 0}}function fi(e){return xa(e)}function xa(e,t){return e==null?e:{createdBy:h(e,"created_by")?e.created_by:void 0,createdAt:h(e,"created_at")?new Date(e.created_at):void 0,comment:h(e,"comment")?e.comment:void 0}}function ns(e){return Fa(e)}function Fa(e,t){return e==null?e:{comments:h(e,"comments")?e.comments.map(fi):void 0}}function La(e){return Va(e)}function Va(e,t){return e==null?e:{deliveryBlocked:h(e,"delivery_blocked")?e.delivery_blocked:void 0}}function as(e){return Ua(e)}function Ua(e,t){return e==null?e:{accountNumber:h(e,"account_number")?e.account_number:void 0,accountName:h(e,"account_name")?e.account_name:void 0,id:h(e,"id")?e.id:void 0,status:h(e,"status")?e.status:void 0,site:h(e,"site")?e.site:void 0,subject:h(e,"subject")?e.subject:void 0,createdBy:h(e,"created_by")?e.created_by:void 0,updatedAt:h(e,"updated_at")?new Date(e.updated_at):void 0}}function Ha(e){return za(e)}function za(e,t){return e==null?e:{deliveryTickets:h(e,"delivery_tickets")?e.delivery_tickets.map(as):void 0,totalCount:h(e,"total_count")?e.total_count:void 0,pageNumber:h(e,"page_number")?e.page_number:void 0,pageSize:h(e,"page_size")?e.page_size:void 0}}function ja(e){if(e!==void 0)return e===null?null:{tracking_number:e.trackingNumber,size_when_oversized:e.sizeWhenOversized,weight_when_overweight:e.weightWhenOverweight,courier_company:e.courierCompany}}function Ma(e){if(e!==void 0)return e===null?null:{id:e.id,tracking_number:e.trackingNumber,number_of_packages:e.numberOfPackages,size_when_oversized:e.sizeWhenOversized,weight_when_overweight:e.weightWhenOverweight,courier_company:e.courierCompany}}function Ja(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,subject:e.subject,description:e.description,eta_from:e.etaFrom===null?null:e.etaFrom.toISOString().substring(0,10),eta_to:e.etaTo===null?null:e.etaTo.toISOString(),loading_bay_required:e.loadingBayRequired,remote_hands_required:e.remoteHandsRequired,customer_reference:e.customerReference,site:e.site,other_notification_recipients:e.otherNotificationRecipients,packages:e.packages===void 0?void 0:e.packages.map(Ma)}}function Wa(e){return Ga(e)}function Ga(e,t){return e==null?e:{id:h(e,"id")?e.id:void 0,trackingNumber:h(e,"tracking_number")?e.tracking_number:void 0,numberOfPackages:h(e,"number_of_packages")?e.number_of_packages:void 0,sizeWhenOversized:h(e,"size_when_oversized")?e.size_when_oversized:void 0,weightWhenOverweight:h(e,"weight_when_overweight")?e.weight_when_overweight:void 0,courierCompany:h(e,"courier_company")?e.courier_company:void 0}}function xt(e){return Za(e)}function Za(e,t){return e==null?e:{id:h(e,"id")?e.id:void 0,accountNumber:h(e,"account_number")?e.account_number:void 0,accountName:h(e,"account_name")?e.account_name:void 0,status:h(e,"status")?e.status:void 0,subject:h(e,"subject")?e.subject:void 0,description:h(e,"description")?e.description:void 0,cancellationReason:h(e,"cancellation_reason")?e.cancellation_reason:void 0,etaFrom:h(e,"eta_from")?e.eta_from===null?null:new Date(e.eta_from):void 0,etaTo:h(e,"eta_to")?e.eta_to===null?null:new Date(e.eta_to):void 0,customerReference:h(e,"customer_reference")?e.customer_reference:void 0,site:h(e,"site")?e.site:void 0,otherNotificationRecipients:h(e,"other_notification_recipients")?e.other_notification_recipients:void 0,createdBy:h(e,"created_by")?e.created_by:void 0,createdAt:h(e,"created_at")?new Date(e.created_at):void 0,updatedAt:h(e,"updated_at")?new Date(e.updated_at):void 0,loadingBayRequired:h(e,"loading_bay_required")?e.loading_bay_required:void 0,remoteHandsRequired:h(e,"remote_hands_required")?e.remote_hands_required:void 0,packages:h(e,"packages")?e.packages.map(Wa):void 0,comments:h(e,"comments")?e.comments.map(fi):void 0}}function Ka(e){if(e!==void 0)return e===null?null:{subject:e.subject,description:e.description,eta_from:e.etaFrom===void 0?void 0:e.etaFrom===null?null:e.etaFrom.toISOString(),eta_to:e.etaTo===void 0?void 0:e.etaTo===null?null:e.etaTo.toISOString(),loading_bay_required:e.loadingBayRequired,customer_reference:e.customerReference,other_notification_recipients:e.otherNotificationRecipients}}function Ya(e){return Xa(e)}function Xa(e,t){return e==null?e:{removalTickets:h(e,"removal_tickets")?e.removal_tickets.map(as):void 0,totalCount:h(e,"total_count")?e.total_count:void 0,pageNumber:h(e,"page_number")?e.page_number:void 0,pageSize:h(e,"page_size")?e.page_size:void 0}}function Qa(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,subject:e.subject,description:e.description,customer_reference:e.customerReference,removal_party:e.removalParty,courier_company:e.courierCompany,tracking_number:e.trackingNumber,pickup_date:e.pickupDate.toISOString(),site:e.site,other_notification_recipients:e.otherNotificationRecipients}}function ki(e){return eo(e)}function eo(e,t){return e==null?e:{id:h(e,"id")?e.id:void 0,accountNumber:h(e,"account_number")?e.account_number:void 0,accountName:h(e,"account_name")?e.account_name:void 0,status:h(e,"status")?e.status:void 0,cancellationReason:h(e,"cancellation_reason")?e.cancellation_reason:void 0,subject:h(e,"subject")?e.subject:void 0,description:h(e,"description")?e.description:void 0,customerReference:h(e,"customer_reference")?e.customer_reference:void 0,removalParty:h(e,"removal_party")?e.removal_party:void 0,courierCompany:h(e,"courier_company")?e.courier_company:void 0,trackingNumber:h(e,"tracking_number")?e.tracking_number:void 0,pickupDate:h(e,"pickup_date")?e.pickup_date:void 0,site:h(e,"site")?e.site:void 0,otherNotificationRecipients:h(e,"other_notification_recipients")?e.other_notification_recipients:void 0,createdBy:h(e,"created_by")?e.created_by:void 0,createdAt:h(e,"created_at")?new Date(e.created_at):void 0,updatedAt:h(e,"updated_at")?new Date(e.updated_at):void 0,comments:h(e,"comments")?e.comments.map(fi):void 0}}function to(e){if(e!==void 0)return e===null?null:{subject:e.subject,description:e.description,customer_reference:e.customerReference,courier_company:e.courierCompany,tracking_number:e.trackingNumber,pickup_date:e.pickupDate===void 0?void 0:e.pickupDate===null?null:e.pickupDate.toISOString(),other_notification_recipients:e.otherNotificationRecipients}}function yi(e){return io(e)}function io(e,t){return e==null?e:{id:h(e,"id")?e.id:void 0,fileName:h(e,"file_name")?e.file_name:void 0,fileSize:h(e,"file_size")?e.file_size:void 0,contentType:h(e,"content_type")?e.content_type:void 0,createdBy:h(e,"created_by")?e.created_by:void 0,createdAt:h(e,"created_at")?new Date(e.created_at):void 0}}function os(e){return so(e)}function so(e,t){return e==null?e:{attachments:h(e,"attachments")?e.attachments.map(yi):void 0}}function rs(e){if(e!==void 0)return e===null?null:{comment:e.comment}}class no extends kt{async cancellationDeliveryRequestRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling cancellationDeliveryRequest.");if(t.cancellationTicketsRequest===null||t.cancellationTicketsRequest===void 0)throw new $("cancellationTicketsRequest","Required parameter requestParameters.cancellationTicketsRequest was null or undefined when calling cancellationDeliveryRequest.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets/{ticket_id}/cancel".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PUT",headers:n,query:s,body:is(t.cancellationTicketsRequest)},i);return new j(o,a=>ss(a))}async cancellationDeliveryRequest(t,i){return await(await this.cancellationDeliveryRequestRaw(t,i)).value()}async createAttachmentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createAttachment.");if(t.fileName===null||t.fileName===void 0)throw new $("fileName","Required parameter requestParameters.fileName was null or undefined when calling createAttachment.");if(t.body===null||t.body===void 0)throw new $("body","Required parameter requestParameters.body was null or undefined when calling createAttachment.");const s={};t.fileName!==void 0&&(s.file_name=t.fileName);const n={};if(n["Content-Type"]="image/jpeg",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets/{ticket_id}/attachments/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:t.body},i);return new j(o,a=>yi(a))}async createAttachment(t,i){return await(await this.createAttachmentRaw(t,i)).value()}async createDeliveriesCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createDeliveriesComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new $("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createDeliveriesComment.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:rs(t.ticketCommentsRequest)},i);return new j(o,a=>ns(a))}async createDeliveriesComment(t,i){return await(await this.createDeliveriesCommentRaw(t,i)).value()}async createDeliveryRaw(t,i){if(t.deliveryTicketsRequest===null||t.deliveryTicketsRequest===void 0)throw new $("deliveryTicketsRequest","Required parameter requestParameters.deliveryTicketsRequest was null or undefined when calling createDelivery.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets",method:"POST",headers:n,query:s,body:Ja(t.deliveryTicketsRequest)},i);return new j(o,a=>xt(a))}async createDelivery(t,i){return await(await this.createDeliveryRaw(t,i)).value()}async getDeliveriesRaw(t,i){if(t.accountNumber===null||t.accountNumber===void 0)throw new $("accountNumber","Required parameter requestParameters.accountNumber was null or undefined when calling getDeliveries.");const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.status!==void 0&&(s.status=t.status),t.createdBy!==void 0&&(s.created_by=t.createdBy),t.sort!==void 0&&(s.sort=t.sort),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets",method:"GET",headers:n,query:s},i);return new j(o,a=>Ha(a))}async getDeliveries(t,i){return await(await this.getDeliveriesRaw(t,i)).value()}async getDeliveryAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getDeliveryAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new $("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getDeliveryAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets/{ticket_id}/attachments/{attachment_id}/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new ts(o)}async getDeliveryAttachmentsById(t,i){return await(await this.getDeliveryAttachmentsByIdRaw(t,i)).value()}async getDeliveryAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getDeliveryAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new j(o,a=>os(a))}async getDeliveryAttachmentsList(t,i){return await(await this.getDeliveryAttachmentsListRaw(t,i)).value()}async getDeliveryByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getDeliveryById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new j(o,a=>xt(a))}async getDeliveryById(t,i){return await(await this.getDeliveryByIdRaw(t,i)).value()}async getDeliveryDiscoveryRaw(t,i){if(t.accountNumber===null||t.accountNumber===void 0)throw new $("accountNumber","Required parameter requestParameters.accountNumber was null or undefined when calling getDeliveryDiscovery.");if(t.site===null||t.site===void 0)throw new $("site","Required parameter requestParameters.site was null or undefined when calling getDeliveryDiscovery.");const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-discovery",method:"GET",headers:n,query:s},i);return new j(o,a=>La(a))}async getDeliveryDiscovery(t,i){return await(await this.getDeliveryDiscoveryRaw(t,i)).value()}async updateDeliveriesTicketsRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateDeliveriesTickets.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:Ka(t.deliveryTicketsUpdateRequest)},i);return new j(o,a=>xt(a))}async updateDeliveriesTickets(t,i){return await(await this.updateDeliveriesTicketsRaw(t,i)).value()}async updateDeliveriesTicketsPackagesRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateDeliveriesTicketsPackages.");if(t.packageId===null||t.packageId===void 0)throw new $("packageId","Required parameter requestParameters.packageId was null or undefined when calling updateDeliveriesTicketsPackages.");if(t.deliveryTicketUpdatePackagesRequest===null||t.deliveryTicketUpdatePackagesRequest===void 0)throw new $("deliveryTicketUpdatePackagesRequest","Required parameter requestParameters.deliveryTicketUpdatePackagesRequest was null or undefined when calling updateDeliveriesTicketsPackages.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets/{ticket_id}/packages/{package_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{package_id}",encodeURIComponent(String(t.packageId))),method:"PATCH",headers:n,query:s,body:ja(t.deliveryTicketUpdatePackagesRequest)},i);return new j(o,a=>xt(a))}async updateDeliveriesTicketsPackages(t,i){return await(await this.updateDeliveriesTicketsPackagesRaw(t,i)).value()}}class ao extends kt{async cancellationRemovalRequestRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling cancellationRemovalRequest.");if(t.cancellationTicketsRequest===null||t.cancellationTicketsRequest===void 0)throw new $("cancellationTicketsRequest","Required parameter requestParameters.cancellationTicketsRequest was null or undefined when calling cancellationRemovalRequest.");const s={},n={};n["Content-Type"]="application/json";const o=await this.request({path:"/removals-tickets/{ticket_id}/cancel".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PUT",headers:n,query:s,body:is(t.cancellationTicketsRequest)},i);return new j(o,a=>ss(a))}async cancellationRemovalRequest(t,i){return await(await this.cancellationRemovalRequestRaw(t,i)).value()}async createCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new $("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createComment.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/removal-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:rs(t.ticketCommentsRequest)},i);return new j(o,a=>ns(a))}async createComment(t,i){return await(await this.createCommentRaw(t,i)).value()}async createRemovalRaw(t,i){if(t.removalTicketsRequest===null||t.removalTicketsRequest===void 0)throw new $("removalTicketsRequest","Required parameter requestParameters.removalTicketsRequest was null or undefined when calling createRemoval.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/removal-tickets",method:"POST",headers:n,query:s,body:Qa(t.removalTicketsRequest)},i);return new j(o,a=>ki(a))}async createRemoval(t,i){return await(await this.createRemovalRaw(t,i)).value()}async createRemovalsAttachmentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createRemovalsAttachment.");if(t.fileName===null||t.fileName===void 0)throw new $("fileName","Required parameter requestParameters.fileName was null or undefined when calling createRemovalsAttachment.");if(t.body===null||t.body===void 0)throw new $("body","Required parameter requestParameters.body was null or undefined when calling createRemovalsAttachment.");const s={};t.fileName!==void 0&&(s.file_name=t.fileName);const n={};if(n["Content-Type"]="image/jpeg",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/removal-tickets/{ticket_id}/attachments/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:t.body},i);return new j(o,a=>yi(a))}async createRemovalsAttachment(t,i){return await(await this.createRemovalsAttachmentRaw(t,i)).value()}async getRemovalByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getRemovalById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/removal-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new j(o,a=>ki(a))}async getRemovalById(t,i){return await(await this.getRemovalByIdRaw(t,i)).value()}async getRemovalPartiesRaw(t){const i={},s={};if(this.configuration&&this.configuration.accessToken){const o=this.configuration.accessToken,a=await o("BearerAuth",[]);a&&(s.Authorization=`Bearer ${a}`)}const n=await this.request({path:"/removal-parties",method:"GET",headers:s,query:i},t);return new j(n)}async getRemovalParties(t){return await(await this.getRemovalPartiesRaw(t)).value()}async getRemovalsRaw(t,i){const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.status!==void 0&&(s.status=t.status),t.createdBy!==void 0&&(s.created_by=t.createdBy),t.sort!==void 0&&(s.sort=t.sort),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/removal-tickets",method:"GET",headers:n,query:s},i);return new j(o,a=>Ya(a))}async getRemovals(t={},i){return await(await this.getRemovalsRaw(t,i)).value()}async getRemovalsAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getRemovalsAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new $("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getRemovalsAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/removal-tickets/{ticket_id}/attachments/{attachment_id}/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new ts(o)}async getRemovalsAttachmentsById(t,i){return await(await this.getRemovalsAttachmentsByIdRaw(t,i)).value()}async getRemovalsAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getRemovalsAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/removal-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new j(o,a=>os(a))}async getRemovalsAttachmentsList(t,i){return await(await this.getRemovalsAttachmentsListRaw(t,i)).value()}async updateRemovalByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateRemovalById.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/removal-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:to(t.removalsTicketsUpdateRequest)},i);return new j(o,a=>ki(a))}async updateRemovalById(t,i){return await(await this.updateRemovalByIdRaw(t,i)).value()}}const oo="https://api.digitalrealty.com/service-management/v1/facility-access".replace(/\/+$/,"");class pt{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:oo}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||cs}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const ro=new pt;class Xe{constructor(t=ro){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new mo(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?Xe.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new lo(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;uo(r.body)||r.body instanceof URLSearchParams||co(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}Xe.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function co(e){return typeof Blob<"u"&&e instanceof Blob}function uo(e){return typeof FormData<"u"&&e instanceof FormData}class lo extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class mo extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class v extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function c(e,t){return e[t]!=null}function cs(e,t=""){return Object.keys(e).map(i=>ds(i,e[i],t)).filter(i=>i.length>0).join("&")}function ds(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return ds(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?cs(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class q{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class Ft{constructor(t){this.raw=t}async value(){return await this.raw.blob()}}function po(e){return ho(e)}function ho(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,accountNumber:c(e,"account_number")?e.account_number:void 0,firstName:c(e,"first_name")?e.first_name:void 0,lastName:c(e,"last_name")?e.last_name:void 0,email:c(e,"email")?e.email:void 0,phone:c(e,"phone")?e.phone:void 0,representingCompany:c(e,"representing_company")?e.representing_company:void 0,badgeStartDate:c(e,"badge_start_date")?new Date(e.badge_start_date):void 0,activeBadge:c(e,"active_badge")?e.active_badge:void 0,terminationRequested:c(e,"termination_requested")?e.termination_requested:void 0}}function vo(e){return go(e)}function go(e,t){return e==null?e:{items:c(e,"items")?e.items.map(po):void 0,totalCount:c(e,"total_count")?e.total_count:void 0}}function Lt(e){if(e!==void 0)return e===null?null:{cancellationReason:e.cancellationReason}}function Vt(e){return wo(e)}function wo(e,t){return e==null?e:{message:c(e,"message")?e.message:void 0}}function At(e){return fo(e)}function fo(e,t){return e==null?e:{createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?new Date(e.created_at):void 0,comment:c(e,"comment")?e.comment:void 0}}function Ut(e){return ko(e)}function ko(e,t){return e==null?e:{comments:c(e,"comments")?e.comments.map(At):void 0}}const us={Approved:"Approved",Denied:"Denied"};function Ht(e){if(e!==void 0)return e===null?null:{id:e.id,approval_status:e.approvalStatus}}function yo(e){return To(e)}function To(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,approvalStatus:c(e,"approval_status")?e.approval_status:void 0}}function zt(e){return bo(e)}function bo(e,t){return e==null?e:{items:c(e,"items")?e.items.map(yo):void 0}}function Ro(e){if(e!==void 0)return e===null?null:{id:e.id,start_date_time:e.startDateTime===void 0?void 0:e.startDateTime.toISOString(),end_date_time:e.endDateTime===void 0?void 0:e.endDateTime.toISOString()}}function Ao(e){if(e!==void 0)return e===null?null:{first_name:e.firstName,last_name:e.lastName,email:e.email,company:e.company,phone:e.phone,visitor_type:e.visitorType}}function _o(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,visitors:e.visitors.map(Ao),locations:e.locations.map(Ro),escort_first_name:e.escortFirstName,escort_last_name:e.escortLastName,visitor_host_first_name:e.visitorHostFirstName,visitor_host_last_name:e.visitorHostLastName,customer_external_reference:e.customerExternalReference,service_impacted_description:e.serviceImpactedDescription,work_description:e.workDescription,notification_recipients:e.notificationRecipients}}function Io(e){return So(e)}function So(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,startDateTime:c(e,"start_date_time")?e.start_date_time:void 0,endDateTime:c(e,"end_date_time")?e.end_date_time:void 0}}function ls(e){return Co(e)}function Co(e,t){return e==null?e:{accountNumber:c(e,"account_number")?e.account_number:void 0,accountName:c(e,"account_name")?e.account_name:void 0,id:c(e,"id")?e.id:void 0,status:c(e,"status")?e.status:void 0,cancellationReason:c(e,"cancellation_reason")?e.cancellation_reason:void 0,subject:c(e,"subject")?e.subject:void 0,visitorFirstName:c(e,"visitor_first_name")?e.visitor_first_name:void 0,visitorLastName:c(e,"visitor_last_name")?e.visitor_last_name:void 0,visitorEmail:c(e,"visitor_email")?e.visitor_email:void 0,visitorCompany:c(e,"visitor_company")?e.visitor_company:void 0,visitorPhone:c(e,"visitor_phone")?e.visitor_phone:void 0,visitorType:c(e,"visitor_type")?e.visitor_type:void 0,site:c(e,"site")?e.site:void 0,locations:c(e,"locations")?e.locations.map(Io):void 0,escortFirstName:c(e,"escort_first_name")?e.escort_first_name:void 0,escortLastName:c(e,"escort_last_name")?e.escort_last_name:void 0,visitorHostFirstName:c(e,"visitor_host_first_name")?e.visitor_host_first_name:void 0,visitorHostLastName:c(e,"visitor_host_last_name")?e.visitor_host_last_name:void 0,customerExternalReference:c(e,"customer_external_reference")?e.customer_external_reference:void 0,serviceImpactedDescription:c(e,"service_impacted_description")?e.service_impacted_description:void 0,workDescription:c(e,"work_description")?e.work_description:void 0,notificationRecipients:c(e,"notification_recipients")?e.notification_recipients:void 0,createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?e.created_at:void 0,updatedAt:c(e,"updated_at")?e.updated_at:void 0,closedAt:c(e,"closed_at")?e.closed_at:void 0,comments:c(e,"comments")?e.comments.map(At):void 0}}function No(e){if(e!==void 0)return e===null?null:{id:e.id,start_date_time:e.startDateTime===void 0?void 0:e.startDateTime.toISOString(),end_date_time:e.endDateTime===void 0?void 0:e.endDateTime.toISOString()}}function Po(e){if(e!==void 0)return e===null?null:{visitor_phone:e.visitorPhone,visitor_company:e.visitorCompany,escort_first_name:e.escortFirstName,escort_last_name:e.escortLastName,locations:e.locations===void 0?void 0:e.locations.map(No),visitor_host_first_name:e.visitorHostFirstName,visitor_host_last_name:e.visitorHostLastName,customer_external_reference:e.customerExternalReference,service_impacted_description:e.serviceImpactedDescription,work_description:e.workDescription,other_notification_recipients:e.otherNotificationRecipients}}function qo(e){return Do(e)}function Do(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,startDateTime:c(e,"start_date_time")?new Date(e.start_date_time):void 0,endDateTime:c(e,"end_date_time")?new Date(e.end_date_time):void 0}}function Bo(e){return Oo(e)}function Oo(e,t){return e==null?e:{accountNumber:c(e,"account_number")?e.account_number:void 0,accountName:c(e,"account_name")?e.account_name:void 0,id:c(e,"id")?e.id:void 0,status:c(e,"status")?e.status:void 0,subject:c(e,"subject")?e.subject:void 0,site:c(e,"site")?e.site:void 0,locations:c(e,"locations")?e.locations.map(qo):void 0,description:c(e,"description")?e.description:void 0,createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?new Date(e.created_at):void 0,updatedAt:c(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:c(e,"closed_at")?new Date(e.closed_at):void 0}}function $o(e){return Eo(e)}function Eo(e,t){return e==null?e:{items:c(e,"items")?e.items.map(Bo):void 0,totalCount:c(e,"total_count")?e.total_count:void 0,pageNumber:c(e,"page_number")?e.page_number:void 0,pageSize:c(e,"page_size")?e.page_size:void 0}}function xo(e){if(e!==void 0)return e===null?null:{id:e.id,start_date_time:e.startDateTime.toISOString(),end_date_time:e.endDateTime.toISOString()}}function Fo(e){if(e!==void 0)return e===null?null:{ppop_space_from:e.ppopSpaceFrom,ppop_space_to:e.ppopSpaceTo,cable_type:e.cableType,on_ladder_rack:e.onLadderRack,in_inner_duct:e.inInnerDuct,in_fiber_guide:e.inFiberGuide}}function ms(e){return Lo(e)}function Lo(e,t){return e==null?e:{rack:c(e,"rack")?e.rack:void 0,cabinet:c(e,"cabinet")?e.cabinet:void 0}}function ps(e){if(e!==void 0)return e===null?null:{rack:e.rack,cabinet:e.cabinet}}function Vo(e){if(e!==void 0)return e===null?null:{side_a_name:e.sideAName,side_a_room_number:e.sideARoomNumber,side_a_rack_number:e.sideARackNumber,side_a_panel_number:e.sideAPanelNumber,side_a_port_1:e.sideAPort1,side_a_carrier_circuit_id:e.sideACarrierCircuitId,side_b_name:e.sideBName,side_b_room_number:e.sideBRoomNumber,side_b_rack_number:e.sideBRackNumber,side_b_panel_number:e.sideBPanelNumber,side_b_port_1:e.sideBPort1,side_b_carrier_circuit_id:e.sideBCarrierCircuitId}}function Uo(e){if(e!==void 0)return e===null?null:{service_type:e.serviceType,scope:e.scope,circuits:e.circuits===void 0?void 0:e.circuits.map(Vo),work_description:e.workDescription}}function Ho(e){if(e!==void 0)return e===null?null:{spop_space_from:e.spopSpaceFrom,spop_space_to:e.spopSpaceTo,cable_type:e.cableType,on_ladder_rack:e.onLadderRack,in_inner_duct:e.inInnerDuct,in_fiber_guide:e.inFiberGuide}}function zo(e){if(e!==void 0)return e===null?null:{first_name:e.firstName,last_name:e.lastName,email:e.email,company:e.company,phone:e.phone,visitor_type:e.visitorType}}function jo(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,visitors:e.visitors.map(zo),locations:e.locations.map(xo),escort_first_name:e.escortFirstName,escort_last_name:e.escortLastName,visitor_host_first_name:e.visitorHostFirstName,visitor_host_last_name:e.visitorHostLastName,customer_external_reference:e.customerExternalReference,service_impacted_description:e.serviceImpactedDescription,service_details:Uo(e.serviceDetails),ppop_space:e.ppopSpace===void 0?void 0:e.ppopSpace.map(ps),spop_space:e.spopSpace===void 0?void 0:e.spopSpace.map(ps),ppop_room_work:Fo(e.ppopRoomWork),spop_room_work:Ho(e.spopRoomWork),notification_recipients:e.notificationRecipients}}function Mo(e){return Jo(e)}function Jo(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,startDateTime:c(e,"start_date_time")?e.start_date_time:void 0,endDateTime:c(e,"end_date_time")?e.end_date_time:void 0,approvalStatus:c(e,"approval_status")?e.approval_status:void 0,modifiedBy:c(e,"modified_by")?e.modified_by:void 0}}function Wo(e){return Go(e)}function Go(e,t){return e==null?e:{ppopSpaceFrom:c(e,"ppop_space_from")?e.ppop_space_from:void 0,ppopSpaceTo:c(e,"ppop_space_to")?e.ppop_space_to:void 0,cableType:c(e,"cable_type")?e.cable_type:void 0,onLadderRack:c(e,"on_ladder_rack")?e.on_ladder_rack:void 0,inInnerDuct:c(e,"in_inner_duct")?e.in_inner_duct:void 0,inFiberGuide:c(e,"in_fiber_guide")?e.in_fiber_guide:void 0}}function Zo(e){return Ko(e)}function Ko(e,t){return e==null?e:{sideAName:c(e,"side_a_name")?e.side_a_name:void 0,sideARoomNumber:c(e,"side_a_room_number")?e.side_a_room_number:void 0,sideARackNumber:c(e,"side_a_rack_number")?e.side_a_rack_number:void 0,sideAPanelNumber:c(e,"side_a_panel_number")?e.side_a_panel_number:void 0,sideAPort1:c(e,"side_a_port_1")?e.side_a_port_1:void 0,sideACarrierCircuitId:c(e,"side_a_carrier_circuit_id")?e.side_a_carrier_circuit_id:void 0,sideBName:c(e,"side_b_name")?e.side_b_name:void 0,sideBRoomNumber:c(e,"side_b_room_number")?e.side_b_room_number:void 0,sideBRackNumber:c(e,"side_b_rack_number")?e.side_b_rack_number:void 0,sideBPanelNumber:c(e,"side_b_panel_number")?e.side_b_panel_number:void 0,sideBPort1:c(e,"side_b_port_1")?e.side_b_port_1:void 0,sideBCarrierCircuitId:c(e,"side_b_carrier_circuit_id")?e.side_b_carrier_circuit_id:void 0}}const We={SiteSurvey:"Site Survey",Testing:"Testing",InstallationDeInstallationWork:"Installation/De-installation Work"};function Yo(e){return Xo(e)}function Xo(e,t){return e==null?e:{serviceType:c(e,"service_type")?e.service_type:void 0,scope:c(e,"scope")?e.scope:void 0,circuits:c(e,"circuits")?e.circuits.map(Zo):void 0,workDescription:c(e,"work_description")?e.work_description:void 0}}function Qo(e){return er(e)}function er(e,t){return e==null?e:{spopSpaceFrom:c(e,"spop_space_from")?e.spop_space_from:void 0,spopSpaceTo:c(e,"spop_space_to")?e.spop_space_to:void 0,cableType:c(e,"cable_type")?e.cable_type:void 0,onLadderRack:c(e,"on_ladder_rack")?e.on_ladder_rack:void 0,inInnerDuct:c(e,"in_inner_duct")?e.in_inner_duct:void 0,inFiberGuide:c(e,"in_fiber_guide")?e.in_fiber_guide:void 0}}function hs(e){return tr(e)}function tr(e,t){return e==null?e:{accountNumber:c(e,"account_number")?e.account_number:void 0,accountName:c(e,"account_name")?e.account_name:void 0,id:c(e,"id")?e.id:void 0,status:c(e,"status")?e.status:void 0,cancellationReason:c(e,"cancellation_reason")?e.cancellation_reason:void 0,subject:c(e,"subject")?e.subject:void 0,visitorFirstName:c(e,"visitor_first_name")?e.visitor_first_name:void 0,visitorLastName:c(e,"visitor_last_name")?e.visitor_last_name:void 0,visitorEmail:c(e,"visitor_email")?e.visitor_email:void 0,visitorCompany:c(e,"visitor_company")?e.visitor_company:void 0,visitorPhone:c(e,"visitor_phone")?e.visitor_phone:void 0,visitorType:c(e,"visitor_type")?e.visitor_type:void 0,site:c(e,"site")?e.site:void 0,locations:c(e,"locations")?e.locations.map(Mo):void 0,escortFirstName:c(e,"escort_first_name")?e.escort_first_name:void 0,escortLastName:c(e,"escort_last_name")?e.escort_last_name:void 0,visitorHostFirstName:c(e,"visitor_host_first_name")?e.visitor_host_first_name:void 0,visitorHostLastName:c(e,"visitor_host_last_name")?e.visitor_host_last_name:void 0,visitorHostCompany:c(e,"visitor_host_company")?e.visitor_host_company:void 0,customerExternalReference:c(e,"customer_external_reference")?e.customer_external_reference:void 0,serviceImpactedDescription:c(e,"service_impacted_description")?e.service_impacted_description:void 0,serviceDetails:c(e,"service_details")?Yo(e.service_details):void 0,ppopSpace:c(e,"ppop_space")?e.ppop_space.map(ms):void 0,spopSpace:c(e,"spop_space")?e.spop_space.map(ms):void 0,ppopRoomWork:c(e,"ppop_room_work")?Wo(e.ppop_room_work):void 0,spopRoomWork:c(e,"spop_room_work")?Qo(e.spop_room_work):void 0,notificationRecipients:c(e,"notification_recipients")?e.notification_recipients:void 0,createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?e.created_at:void 0,updatedAt:c(e,"updated_at")?e.updated_at:void 0,closedAt:c(e,"closed_at")?e.closed_at:void 0,comments:c(e,"comments")?e.comments.map(At):void 0}}function ir(e){if(e!==void 0)return e===null?null:{id:e.id,start_date_time:e.startDateTime.toISOString(),end_date_time:e.endDateTime.toISOString()}}function sr(e){if(e!==void 0)return e===null?null:{ppop_space_from:e.ppopSpaceFrom,ppop_space_to:e.ppopSpaceTo,cable_type:e.cableType,on_ladder_rack:e.onLadderRack,in_inner_duct:e.inInnerDuct,in_fiber_guide:e.inFiberGuide}}function vs(e){if(e!==void 0)return e===null?null:{id:e.id,rack:e.rack,cabinet:e.cabinet}}function nr(e){if(e!==void 0)return e===null?null:{id:e.id,side_a_name:e.sideAName,side_a_room_number:e.sideARoomNumber,side_a_rack_number:e.sideARackNumber,side_a_panel_number:e.sideAPanelNumber,side_a_port_1:e.sideAPort1,side_a_carrier_circuit_id:e.sideACarrierCircuitId,side_b_name:e.sideBName,side_b_room_number:e.sideBRoomNumber,side_b_rack_number:e.sideBRackNumber,side_b_panel_number:e.sideBPanelNumber,side_b_port_1:e.sideBPort1,side_b_carrier_circuit_id:e.sideBCarrierCircuitId}}function ar(e){if(e!==void 0)return e===null?null:{service_type:e.serviceType,scope:e.scope,circuits:e.circuits===void 0?void 0:e.circuits.map(nr),work_description:e.workDescription}}function or(e){if(e!==void 0)return e===null?null:{spop_space_from:e.spopSpaceFrom,spop_space_to:e.spopSpaceTo,cable_type:e.cableType,on_ladder_rack:e.onLadderRack,in_inner_duct:e.inInnerDuct,in_fiber_guide:e.inFiberGuide}}function rr(e){if(e!==void 0)return e===null?null:{visitor_phone:e.visitorPhone,escort_first_name:e.escortFirstName,escort_last_name:e.escortLastName,visitor_host_first_name:e.visitorHostFirstName,visitor_host_last_name:e.visitorHostLastName,visitor_company:e.visitorCompany,service_impacted_description:e.serviceImpactedDescription,locations:e.locations===void 0?void 0:e.locations.map(ir),service_details:ar(e.serviceDetails),ppop_space:e.ppopSpace===void 0?void 0:e.ppopSpace.map(vs),spop_space:e.spopSpace===void 0?void 0:e.spopSpace.map(vs),ppop_room_work:sr(e.ppopRoomWork),spop_room_work:or(e.spopRoomWork),customer_external_reference:e.customerExternalReference,notification_recipients:e.notificationRecipients}}function cr(e){return dr(e)}function dr(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,startDateTime:c(e,"start_date_time")?new Date(e.start_date_time):void 0,endDateTime:c(e,"end_date_time")?new Date(e.end_date_time):void 0,approvalStatus:c(e,"approval_status")?e.approval_status:void 0,modifiedBy:c(e,"modified_by")?e.modified_by:void 0}}function ur(e){return lr(e)}function lr(e,t){return e==null?e:{accountNumber:c(e,"account_number")?e.account_number:void 0,accountName:c(e,"account_name")?e.account_name:void 0,id:c(e,"id")?e.id:void 0,status:c(e,"status")?e.status:void 0,subject:c(e,"subject")?e.subject:void 0,site:c(e,"site")?e.site:void 0,locations:c(e,"locations")?e.locations.map(cr):void 0,description:c(e,"description")?e.description:void 0,createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?new Date(e.created_at):void 0,updatedAt:c(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:c(e,"closed_at")?new Date(e.closed_at):void 0}}function mr(e){return pr(e)}function pr(e,t){return e==null?e:{items:c(e,"items")?e.items.map(ur):void 0,totalCount:c(e,"total_count")?e.total_count:void 0,pageNumber:c(e,"page_number")?e.page_number:void 0,pageSize:c(e,"page_size")?e.page_size:void 0}}function hr(e){if(e!==void 0)return e===null?null:{id:e.id,start_date:e.startDate===void 0?void 0:e.startDate.toISOString().substring(0,10),end_date:e.endDate===void 0?void 0:e.endDate.toISOString().substring(0,10),operation:e.operation}}function vr(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,badgeholder_id:e.badgeholderId,badge_start_date:e.badgeStartDate.toISOString().substring(0,10),badge_end_date:e.badgeEndDate===void 0?void 0:e.badgeEndDate.toISOString().substring(0,10),locations:e.locations===void 0?void 0:e.locations.map(hr),notification_recipients:e.notificationRecipients}}function gr(e){if(e!==void 0)return e===null?null:{id:e.id,start_date:e.startDate===void 0?void 0:e.startDate.toISOString().substring(0,10),end_date:e.endDate===void 0?void 0:e.endDate.toISOString().substring(0,10)}}function wr(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,badgeholder_first_name:e.badgeholderFirstName,badgeholder_last_name:e.badgeholderLastName,badgeholder_email:e.badgeholderEmail,badgeholder_company:e.badgeholderCompany,badgeholder_phone:e.badgeholderPhone,badge_start_date:e.badgeStartDate.toISOString().substring(0,10),badge_end_date:e.badgeEndDate===void 0?void 0:e.badgeEndDate.toISOString().substring(0,10),locations:e.locations===void 0?void 0:e.locations.map(gr),notification_recipients:e.notificationRecipients}}function fr(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,badgeholder_id:e.badgeholderId,badge_end_date:e.badgeEndDate.toISOString().substring(0,10),notification_recipients:e.notificationRecipients}}function gs(e){return kr(e)}function kr(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,site:c(e,"site")?e.site:void 0,siteAddress:c(e,"site_address")?e.site_address:void 0,startDate:c(e,"start_date")?e.start_date:void 0,endDate:c(e,"end_date")?e.end_date:void 0,approvalStatus:c(e,"approval_status")?e.approval_status:void 0,modifiedBy:c(e,"modified_by")?e.modified_by:void 0}}function ws(e){return yr(e)}function yr(e,t){return e==null?e:{accountNumber:c(e,"account_number")?e.account_number:void 0,accountName:c(e,"account_name")?e.account_name:void 0,id:c(e,"id")?e.id:void 0,status:c(e,"status")?e.status:void 0,cancellationReason:c(e,"cancellation_reason")?e.cancellation_reason:void 0,subject:c(e,"subject")?e.subject:void 0,badgeholderFirstName:c(e,"badgeholder_first_name")?e.badgeholder_first_name:void 0,badgeholderLastName:c(e,"badgeholder_last_name")?e.badgeholder_last_name:void 0,badgeholderEmail:c(e,"badgeholder_email")?e.badgeholder_email:void 0,badgeholderPhone:c(e,"badgeholder_phone")?e.badgeholder_phone:void 0,badgeholderCompany:c(e,"badgeholder_company")?e.badgeholder_company:void 0,requestType:c(e,"request_type")?e.request_type:void 0,badgeStartDate:c(e,"badge_start_date")?e.badge_start_date:void 0,badgeEndDate:c(e,"badge_end_date")?e.badge_end_date:void 0,locations:c(e,"locations")?e.locations.map(gs):void 0,notificationRecipients:c(e,"notification_recipients")?e.notification_recipients:void 0,createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?new Date(e.created_at):void 0,updatedAt:c(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:c(e,"closed_at")?new Date(e.closed_at):void 0,comments:c(e,"comments")?e.comments.map(At):void 0}}function Tr(e){if(e!==void 0)return e===null?null:{other_notification_recipients:e.otherNotificationRecipients}}function br(e){return Rr(e)}function Rr(e,t){return e==null?e:{accountNumber:c(e,"account_number")?e.account_number:void 0,accountName:c(e,"account_name")?e.account_name:void 0,id:c(e,"id")?e.id:void 0,status:c(e,"status")?e.status:void 0,subject:c(e,"subject")?e.subject:void 0,badgeholderEmail:c(e,"badgeholder_email")?e.badgeholder_email:void 0,requestType:c(e,"request_type")?e.request_type:void 0,locations:c(e,"locations")?e.locations.map(gs):void 0,createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?new Date(e.created_at):void 0,updatedAt:c(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:c(e,"closed_at")?new Date(e.closed_at):void 0}}function Ar(e){return _r(e)}function _r(e,t){return e==null?e:{items:c(e,"items")?e.items.map(br):void 0,totalCount:c(e,"total_count")?e.total_count:void 0,pageNumber:c(e,"page_number")?e.page_number:void 0,pageSize:c(e,"page_size")?e.page_size:void 0}}function _t(e){return Ir(e)}function Ir(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,fileName:c(e,"file_name")?e.file_name:void 0,fileSize:c(e,"file_size")?e.file_size:void 0,contentType:c(e,"content_type")?e.content_type:void 0,createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?e.created_at===null?null:new Date(e.created_at):void 0}}function jt(e){return Sr(e)}function Sr(e,t){return e==null?e:{attachments:c(e,"attachments")?e.attachments.map(_t):void 0}}function Mt(e){if(e!==void 0)return e===null?null:{comment:e.comment}}function ht(e){return Cr(e)}function Cr(e,t){return e==null?e:{ticketNumbers:c(e,"ticket_numbers")?e.ticket_numbers:void 0}}function Nr(e){if(e!==void 0)return e===null?null:{id:e.id,start_date:e.startDate===void 0?void 0:e.startDate.toISOString().substring(0,10),end_date:e.endDate===void 0?void 0:e.endDate.toISOString().substring(0,10)}}function Pr(e){if(e!==void 0)return e===null?null:{site_code:e.siteCode,visitor_host_id:e.visitorHostId,locations:e.locations===void 0?void 0:e.locations.map(Nr)}}function qr(e){if(e!==void 0)return e===null?null:{first_name:e.firstName,last_name:e.lastName,email:e.email,phone:e.phone}}const Jt={Escorted:"Escorted",Standard:"Standard",Extended:"Extended"};function Dr(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,visitors:e.visitors===void 0?void 0:e.visitors.map(qr),visit_start_date:e.visitStartDate.toISOString().substring(0,10),visit_end_date:e.visitEndDate.toISOString().substring(0,10),visit_type:e.visitType,sites:e.sites===void 0?void 0:e.sites.map(Pr),escort_first_name:e.escortFirstName,escort_last_name:e.escortLastName,visitor_host_first_name:e.visitorHostFirstName,visitor_host_last_name:e.visitorHostLastName,representing_company:e.representingCompany,description:e.description,notification_recipients:e.notificationRecipients}}function fs(e){return Br(e)}function Br(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,startDate:c(e,"start_date")?e.start_date:void 0,endDate:c(e,"end_date")?e.end_date:void 0,approvalStatus:c(e,"approval_status")?e.approval_status:void 0,modifiedBy:c(e,"modified_by")?e.modified_by:void 0}}function ks(e){return Or(e)}function Or(e,t){return e==null?e:{accountNumber:c(e,"account_number")?e.account_number:void 0,accountName:c(e,"account_name")?e.account_name:void 0,id:c(e,"id")?e.id:void 0,status:c(e,"status")?e.status:void 0,cancellationReason:c(e,"cancellation_reason")?e.cancellation_reason:void 0,subject:c(e,"subject")?e.subject:void 0,visitorFirstName:c(e,"visitor_first_name")?e.visitor_first_name:void 0,visitorLastName:c(e,"visitor_last_name")?e.visitor_last_name:void 0,visitorEmail:c(e,"visitor_email")?e.visitor_email:void 0,visitorPhone:c(e,"visitor_phone")?e.visitor_phone:void 0,visitStartDate:c(e,"visit_start_date")?e.visit_start_date:void 0,visitEndDate:c(e,"visit_end_date")?e.visit_end_date:void 0,visitType:c(e,"visit_type")?e.visit_type:void 0,site:c(e,"site")?e.site:void 0,locations:c(e,"locations")?e.locations.map(fs):void 0,escortFirstName:c(e,"escort_first_name")?e.escort_first_name:void 0,escortLastName:c(e,"escort_last_name")?e.escort_last_name:void 0,visitorHostFirstName:c(e,"visitor_host_first_name")?e.visitor_host_first_name:void 0,visitorHostLastName:c(e,"visitor_host_last_name")?e.visitor_host_last_name:void 0,representingCompany:c(e,"representing_company")?e.representing_company:void 0,description:c(e,"description")?e.description:void 0,notificationRecipients:c(e,"notification_recipients")?e.notification_recipients:void 0,createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?new Date(e.created_at):void 0,updatedAt:c(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:c(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0,comments:c(e,"comments")?e.comments.map(At):void 0}}function $r(e){if(e!==void 0)return e===null?null:{visitor_phone:e.visitorPhone,other_notification_recipients:e.otherNotificationRecipients}}function Er(e){return xr(e)}function xr(e,t){return e==null?e:{accountNumber:c(e,"account_number")?e.account_number:void 0,accountName:c(e,"account_name")?e.account_name:void 0,id:c(e,"id")?e.id:void 0,status:c(e,"status")?e.status:void 0,subject:c(e,"subject")?e.subject:void 0,site:c(e,"site")?e.site:void 0,locations:c(e,"locations")?e.locations.map(fs):void 0,visitType:c(e,"visit_type")?e.visit_type:void 0,description:c(e,"description")?e.description:void 0,createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?new Date(e.created_at):void 0,updatedAt:c(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:c(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0}}function Fr(e){return Lr(e)}function Lr(e,t){return e==null?e:{items:c(e,"items")?e.items.map(Er):void 0,totalCount:c(e,"total_count")?e.total_count:void 0,pageNumber:c(e,"page_number")?e.page_number:void 0,pageSize:c(e,"page_size")?e.page_size:void 0}}function Vr(e){return Ur(e)}function Ur(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,firstName:c(e,"first_name")?e.first_name:void 0,lastName:c(e,"last_name")?e.last_name:void 0}}function Hr(e){return zr(e)}function zr(e,t){return e==null?e:{items:c(e,"items")?e.items.map(Vr):void 0,totalCount:c(e,"total_count")?e.total_count:void 0}}class jr extends Xe{async cancellationOspAccessRequestRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling cancellationOspAccessRequest.");if(t.cancellationTicketsRequest===null||t.cancellationTicketsRequest===void 0)throw new v("cancellationTicketsRequest","Required parameter requestParameters.cancellationTicketsRequest was null or undefined when calling cancellationOspAccessRequest.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/osp-access-tickets/{ticket_id}/cancel".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PUT",headers:n,query:s,body:Lt(t.cancellationTicketsRequest)},i);return new q(o,a=>Vt(a))}async cancellationOspAccessRequest(t,i){return await(await this.cancellationOspAccessRequestRaw(t,i)).value()}async createOspAccessAttachmentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createOspAccessAttachment.");if(t.fileName===null||t.fileName===void 0)throw new v("fileName","Required parameter requestParameters.fileName was null or undefined when calling createOspAccessAttachment.");if(t.body===null||t.body===void 0)throw new v("body","Required parameter requestParameters.body was null or undefined when calling createOspAccessAttachment.");const s={};t.fileName!==void 0&&(s.file_name=t.fileName);const n={};if(n["Content-Type"]="image/jpeg",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/osp-access-tickets/{ticket_id}/attachments/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:t.body},i);return new q(o,a=>_t(a))}async createOspAccessAttachment(t,i){return await(await this.createOspAccessAttachmentRaw(t,i)).value()}async createOspAccessCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createOspAccessComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new v("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createOspAccessComment.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/osp-access-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:Mt(t.ticketCommentsRequest)},i);return new q(o,a=>Ut(a))}async createOspAccessComment(t,i){return await(await this.createOspAccessCommentRaw(t,i)).value()}async createOspAccessTicketRaw(t,i){if(t.oSPAccessTicketRequest===null||t.oSPAccessTicketRequest===void 0)throw new v("oSPAccessTicketRequest","Required parameter requestParameters.oSPAccessTicketRequest was null or undefined when calling createOspAccessTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/osp-access-tickets",method:"POST",headers:n,query:s,body:_o(t.oSPAccessTicketRequest)},i);return new q(o,a=>ht(a))}async createOspAccessTicket(t,i){return await(await this.createOspAccessTicketRaw(t,i)).value()}async getOspAccessAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getOspAccessAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new v("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getOspAccessAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/osp-access-tickets/{ticket_id}/attachments/{attachment_id}/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new Ft(o)}async getOspAccessAttachmentsById(t,i){return await(await this.getOspAccessAttachmentsByIdRaw(t,i)).value()}async getOspAccessAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getOspAccessAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/osp-access-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new q(o,a=>jt(a))}async getOspAccessAttachmentsList(t,i){return await(await this.getOspAccessAttachmentsListRaw(t,i)).value()}async getOspAccessTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getOspAccessTicketById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/osp-access-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new q(o,a=>ls(a))}async getOspAccessTicketById(t,i){return await(await this.getOspAccessTicketByIdRaw(t,i)).value()}async getOspAccessTicketsRaw(t,i){const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.status!==void 0&&(s.status=t.status),t.createdBy!==void 0&&(s.created_by=t.createdBy),t.sort!==void 0&&(s.sort=t.sort),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={},o=await this.request({path:"/osp-access-tickets",method:"GET",headers:n,query:s},i);return new q(o,a=>$o(a))}async getOspAccessTickets(t={},i){return await(await this.getOspAccessTicketsRaw(t,i)).value()}async updateOspAccessLocationsTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateOspAccessLocationsTicket.");if(t.locationsPatchRequestInner===null||t.locationsPatchRequestInner===void 0)throw new v("locationsPatchRequestInner","Required parameter requestParameters.locationsPatchRequestInner was null or undefined when calling updateOspAccessLocationsTicket.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/osp-access-tickets/{ticket_id}/locations".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:t.locationsPatchRequestInner.map(Ht)},i);return new q(o,a=>zt(a))}async updateOspAccessLocationsTicket(t,i){return await(await this.updateOspAccessLocationsTicketRaw(t,i)).value()}async updateOspAccessTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateOspAccessTicket.");if(t.oSPAccessTicketUpdateRequest===null||t.oSPAccessTicketUpdateRequest===void 0)throw new v("oSPAccessTicketUpdateRequest","Required parameter requestParameters.oSPAccessTicketUpdateRequest was null or undefined when calling updateOspAccessTicket.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/osp-access-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:Po(t.oSPAccessTicketUpdateRequest)},i);return new q(o,a=>ls(a))}async updateOspAccessTicket(t,i){return await(await this.updateOspAccessTicketRaw(t,i)).value()}}class Mr extends Xe{async cancellationPopAccessRequestRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling cancellationPopAccessRequest.");if(t.cancellationTicketsRequest===null||t.cancellationTicketsRequest===void 0)throw new v("cancellationTicketsRequest","Required parameter requestParameters.cancellationTicketsRequest was null or undefined when calling cancellationPopAccessRequest.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/pop-access-tickets/{ticket_id}/cancel".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PUT",headers:n,query:s,body:Lt(t.cancellationTicketsRequest)},i);return new q(o,a=>Vt(a))}async cancellationPopAccessRequest(t,i){return await(await this.cancellationPopAccessRequestRaw(t,i)).value()}async createPopAccessAttachmentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createPopAccessAttachment.");if(t.fileName===null||t.fileName===void 0)throw new v("fileName","Required parameter requestParameters.fileName was null or undefined when calling createPopAccessAttachment.");if(t.body===null||t.body===void 0)throw new v("body","Required parameter requestParameters.body was null or undefined when calling createPopAccessAttachment.");const s={};t.fileName!==void 0&&(s.file_name=t.fileName);const n={};if(n["Content-Type"]="image/jpeg",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/pop-access-tickets/{ticket_id}/attachments/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:t.body},i);return new q(o,a=>_t(a))}async createPopAccessAttachment(t,i){return await(await this.createPopAccessAttachmentRaw(t,i)).value()}async createPopAccessCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createPopAccessComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new v("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createPopAccessComment.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/pop-access-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:Mt(t.ticketCommentsRequest)},i);return new q(o,a=>Ut(a))}async createPopAccessComment(t,i){return await(await this.createPopAccessCommentRaw(t,i)).value()}async createPopAccessTicketRaw(t,i){if(t.pOPAccessTicketRequest===null||t.pOPAccessTicketRequest===void 0)throw new v("pOPAccessTicketRequest","Required parameter requestParameters.pOPAccessTicketRequest was null or undefined when calling createPopAccessTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/pop-access-tickets",method:"POST",headers:n,query:s,body:jo(t.pOPAccessTicketRequest)},i);return new q(o,a=>ht(a))}async createPopAccessTicket(t,i){return await(await this.createPopAccessTicketRaw(t,i)).value()}async getPopAccessAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getPopAccessAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new v("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getPopAccessAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/pop-access-tickets/{ticket_id}/attachments/{attachment_id}/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new Ft(o)}async getPopAccessAttachmentsById(t,i){return await(await this.getPopAccessAttachmentsByIdRaw(t,i)).value()}async getPopAccessAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getPopAccessAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/pop-access-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new q(o,a=>jt(a))}async getPopAccessAttachmentsList(t,i){return await(await this.getPopAccessAttachmentsListRaw(t,i)).value()}async getPopAccessTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getPopAccessTicketById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/pop-access-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new q(o,a=>hs(a))}async getPopAccessTicketById(t,i){return await(await this.getPopAccessTicketByIdRaw(t,i)).value()}async getPopAccessTicketsRaw(t,i){const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.status!==void 0&&(s.status=t.status),t.createdBy!==void 0&&(s.created_by=t.createdBy),t.sort!==void 0&&(s.sort=t.sort),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={},o=await this.request({path:"/pop-access-tickets",method:"GET",headers:n,query:s},i);return new q(o,a=>mr(a))}async getPopAccessTickets(t={},i){return await(await this.getPopAccessTicketsRaw(t,i)).value()}async updatePopAccessLocationsTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updatePopAccessLocationsTicket.");if(t.locationsPatchRequestInner===null||t.locationsPatchRequestInner===void 0)throw new v("locationsPatchRequestInner","Required parameter requestParameters.locationsPatchRequestInner was null or undefined when calling updatePopAccessLocationsTicket.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/pop-access-tickets/{ticket_id}/locations".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:t.locationsPatchRequestInner.map(Ht)},i);return new q(o,a=>zt(a))}async updatePopAccessLocationsTicket(t,i){return await(await this.updatePopAccessLocationsTicketRaw(t,i)).value()}async updatePopAccessTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updatePopAccessTicket.");if(t.pOPAccessTicketUpdateRequest===null||t.pOPAccessTicketUpdateRequest===void 0)throw new v("pOPAccessTicketUpdateRequest","Required parameter requestParameters.pOPAccessTicketUpdateRequest was null or undefined when calling updatePopAccessTicket.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/pop-access-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:rr(t.pOPAccessTicketUpdateRequest)},i);return new q(o,a=>hs(a))}async updatePopAccessTicket(t,i){return await(await this.updatePopAccessTicketRaw(t,i)).value()}}class Jr extends Xe{async cancellationPermanentBadgeRequestRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling cancellationPermanentBadgeRequest.");if(t.cancellationTicketsRequest===null||t.cancellationTicketsRequest===void 0)throw new v("cancellationTicketsRequest","Required parameter requestParameters.cancellationTicketsRequest was null or undefined when calling cancellationPermanentBadgeRequest.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-tickets/{ticket_id}/cancel".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PUT",headers:n,query:s,body:Lt(t.cancellationTicketsRequest)},i);return new q(o,a=>Vt(a))}async cancellationPermanentBadgeRequest(t,i){return await(await this.cancellationPermanentBadgeRequestRaw(t,i)).value()}async createPermanentBadegeAttachmentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createPermanentBadegeAttachment.");if(t.fileName===null||t.fileName===void 0)throw new v("fileName","Required parameter requestParameters.fileName was null or undefined when calling createPermanentBadegeAttachment.");if(t.body===null||t.body===void 0)throw new v("body","Required parameter requestParameters.body was null or undefined when calling createPermanentBadegeAttachment.");const s={};t.fileName!==void 0&&(s.file_name=t.fileName);const n={};if(n["Content-Type"]="image/jpeg",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-tickets/{ticket_id}/attachments/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:t.body},i);return new q(o,a=>_t(a))}async createPermanentBadegeAttachment(t,i){return await(await this.createPermanentBadegeAttachmentRaw(t,i)).value()}async createPermanentBadgeCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createPermanentBadgeComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new v("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createPermanentBadgeComment.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:Mt(t.ticketCommentsRequest)},i);return new q(o,a=>Ut(a))}async createPermanentBadgeComment(t,i){return await(await this.createPermanentBadgeCommentRaw(t,i)).value()}async createPermanentBadgeModifyTicketRaw(t,i){if(t.permanentBadgeAccessModifyTicketRequest===null||t.permanentBadgeAccessModifyTicketRequest===void 0)throw new v("permanentBadgeAccessModifyTicketRequest","Required parameter requestParameters.permanentBadgeAccessModifyTicketRequest was null or undefined when calling createPermanentBadgeModifyTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-access-modify-tickets",method:"POST",headers:n,query:s,body:vr(t.permanentBadgeAccessModifyTicketRequest)},i);return new q(o,a=>ht(a))}async createPermanentBadgeModifyTicket(t,i){return await(await this.createPermanentBadgeModifyTicketRaw(t,i)).value()}async createPermanentBadgeNewTicketRaw(t,i){if(t.permanentBadgeAccessNewTicketRequest===null||t.permanentBadgeAccessNewTicketRequest===void 0)throw new v("permanentBadgeAccessNewTicketRequest","Required parameter requestParameters.permanentBadgeAccessNewTicketRequest was null or undefined when calling createPermanentBadgeNewTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-access-new-tickets",method:"POST",headers:n,query:s,body:wr(t.permanentBadgeAccessNewTicketRequest)},i);return new q(o,a=>ht(a))}async createPermanentBadgeNewTicket(t,i){return await(await this.createPermanentBadgeNewTicketRaw(t,i)).value()}async createPermanentBadgeTerminateTicketRaw(t,i){if(t.permanentBadgeAccessTerminateTicketRequest===null||t.permanentBadgeAccessTerminateTicketRequest===void 0)throw new v("permanentBadgeAccessTerminateTicketRequest","Required parameter requestParameters.permanentBadgeAccessTerminateTicketRequest was null or undefined when calling createPermanentBadgeTerminateTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-access-terminate-tickets",method:"POST",headers:n,query:s,body:fr(t.permanentBadgeAccessTerminateTicketRequest)},i);return new q(o,a=>ht(a))}async createPermanentBadgeTerminateTicket(t,i){return await(await this.createPermanentBadgeTerminateTicketRaw(t,i)).value()}async getPermanentBadgeAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getPermanentBadgeAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new v("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getPermanentBadgeAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-tickets/{ticket_id}/attachments/{attachment_id}/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new Ft(o)}async getPermanentBadgeAttachmentsById(t,i){return await(await this.getPermanentBadgeAttachmentsByIdRaw(t,i)).value()}async getPermanentBadgeAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getPermanentBadgeAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new q(o,a=>jt(a))}async getPermanentBadgeAttachmentsList(t,i){return await(await this.getPermanentBadgeAttachmentsListRaw(t,i)).value()}async getPermanentBadgeHoldersListRaw(t,i){if(t.accountNumber===null||t.accountNumber===void 0)throw new v("accountNumber","Required parameter requestParameters.accountNumber was null or undefined when calling getPermanentBadgeHoldersList.");const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.activeBadge!==void 0&&(s.active_badge=t.activeBadge),t.nameOrEmailContains!==void 0&&(s.name_or_email_contains=t.nameOrEmailContains),t.page!==void 0&&(s.page=t.page),t.size!==void 0&&(s.size=t.size);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-tickets/badge-holders",method:"GET",headers:n,query:s},i);return new q(o,a=>vo(a))}async getPermanentBadgeHoldersList(t,i){return await(await this.getPermanentBadgeHoldersListRaw(t,i)).value()}async getPermanentBadgeTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getPermanentBadgeTicketById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new q(o,a=>ws(a))}async getPermanentBadgeTicketById(t,i){return await(await this.getPermanentBadgeTicketByIdRaw(t,i)).value()}async getPermanentBadgeTicketsRaw(t,i){const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.status!==void 0&&(s.status=t.status),t.createdBy!==void 0&&(s.created_by=t.createdBy),t.sort!==void 0&&(s.sort=t.sort),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={},o=await this.request({path:"/permanent-badge-access-tickets",method:"GET",headers:n,query:s},i);return new q(o,a=>Ar(a))}async getPermanentBadgeTickets(t={},i){return await(await this.getPermanentBadgeTicketsRaw(t,i)).value()}async updatePermanentBadgeLocationsTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updatePermanentBadgeLocationsTicket.");if(t.locationsPatchRequestInner===null||t.locationsPatchRequestInner===void 0)throw new v("locationsPatchRequestInner","Required parameter requestParameters.locationsPatchRequestInner was null or undefined when calling updatePermanentBadgeLocationsTicket.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-tickets/{ticket_id}/locations".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:t.locationsPatchRequestInner.map(Ht)},i);return new q(o,a=>zt(a))}async updatePermanentBadgeLocationsTicket(t,i){return await(await this.updatePermanentBadgeLocationsTicketRaw(t,i)).value()}async updatePermanentBadgeTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updatePermanentBadgeTicket.");if(t.permanentBadgeAccessTicketUpdateRequest===null||t.permanentBadgeAccessTicketUpdateRequest===void 0)throw new v("permanentBadgeAccessTicketUpdateRequest","Required parameter requestParameters.permanentBadgeAccessTicketUpdateRequest was null or undefined when calling updatePermanentBadgeTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:Tr(t.permanentBadgeAccessTicketUpdateRequest)},i);return new q(o,a=>ws(a))}async updatePermanentBadgeTicket(t,i){return await(await this.updatePermanentBadgeTicketRaw(t,i)).value()}}class Wr extends Xe{async cancellationVisitorAccessRequestRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling cancellationVisitorAccessRequest.");if(t.cancellationTicketsRequest===null||t.cancellationTicketsRequest===void 0)throw new v("cancellationTicketsRequest","Required parameter requestParameters.cancellationTicketsRequest was null or undefined when calling cancellationVisitorAccessRequest.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-access-tickets/{ticket_id}/cancel".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PUT",headers:n,query:s,body:Lt(t.cancellationTicketsRequest)},i);return new q(o,a=>Vt(a))}async cancellationVisitorAccessRequest(t,i){return await(await this.cancellationVisitorAccessRequestRaw(t,i)).value()}async createVisitorAccessAttachmentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createVisitorAccessAttachment.");if(t.fileName===null||t.fileName===void 0)throw new v("fileName","Required parameter requestParameters.fileName was null or undefined when calling createVisitorAccessAttachment.");if(t.body===null||t.body===void 0)throw new v("body","Required parameter requestParameters.body was null or undefined when calling createVisitorAccessAttachment.");const s={};t.fileName!==void 0&&(s.file_name=t.fileName);const n={};if(n["Content-Type"]="image/jpeg",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-access-tickets/{ticket_id}/attachments/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:t.body},i);return new q(o,a=>_t(a))}async createVisitorAccessAttachment(t,i){return await(await this.createVisitorAccessAttachmentRaw(t,i)).value()}async createVisitorAccessCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createVisitorAccessComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new v("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createVisitorAccessComment.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-access-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:Mt(t.ticketCommentsRequest)},i);return new q(o,a=>Ut(a))}async createVisitorAccessComment(t,i){return await(await this.createVisitorAccessCommentRaw(t,i)).value()}async createVisitorAccessTicketRaw(t,i){if(t.visitorAccessTicketRequest===null||t.visitorAccessTicketRequest===void 0)throw new v("visitorAccessTicketRequest","Required parameter requestParameters.visitorAccessTicketRequest was null or undefined when calling createVisitorAccessTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-access-tickets",method:"POST",headers:n,query:s,body:Dr(t.visitorAccessTicketRequest)},i);return new q(o,a=>ht(a))}async createVisitorAccessTicket(t,i){return await(await this.createVisitorAccessTicketRaw(t,i)).value()}async getVisitorAccessAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getVisitorAccessAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new v("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getVisitorAccessAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-access-tickets/{ticket_id}/attachments/{attachment_id}/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new Ft(o)}async getVisitorAccessAttachmentsById(t,i){return await(await this.getVisitorAccessAttachmentsByIdRaw(t,i)).value()}async getVisitorAccessAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getVisitorAccessAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-access-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new q(o,a=>jt(a))}async getVisitorAccessAttachmentsList(t,i){return await(await this.getVisitorAccessAttachmentsListRaw(t,i)).value()}async getVisitorAccessTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getVisitorAccessTicketById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-access-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new q(o,a=>ks(a))}async getVisitorAccessTicketById(t,i){return await(await this.getVisitorAccessTicketByIdRaw(t,i)).value()}async getVisitorAccessTicketsRaw(t,i){const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.status!==void 0&&(s.status=t.status),t.createdBy!==void 0&&(s.created_by=t.createdBy),t.sort!==void 0&&(s.sort=t.sort),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={},o=await this.request({path:"/visitor-access-tickets",method:"GET",headers:n,query:s},i);return new q(o,a=>Fr(a))}async getVisitorAccessTickets(t={},i){return await(await this.getVisitorAccessTicketsRaw(t,i)).value()}async updateVisitorAccessLocationsTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateVisitorAccessLocationsTicket.");if(t.locationsPatchRequestInner===null||t.locationsPatchRequestInner===void 0)throw new v("locationsPatchRequestInner","Required parameter requestParameters.locationsPatchRequestInner was null or undefined when calling updateVisitorAccessLocationsTicket.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-access-tickets/{ticket_id}/locations".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:t.locationsPatchRequestInner.map(Ht)},i);return new q(o,a=>zt(a))}async updateVisitorAccessLocationsTicket(t,i){return await(await this.updateVisitorAccessLocationsTicketRaw(t,i)).value()}async updateVisitorAccessTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateVisitorAccessTicket.");if(t.visitorAccessTicketUpdateRequest===null||t.visitorAccessTicketUpdateRequest===void 0)throw new v("visitorAccessTicketUpdateRequest","Required parameter requestParameters.visitorAccessTicketUpdateRequest was null or undefined when calling updateVisitorAccessTicket.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-access-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:$r(t.visitorAccessTicketUpdateRequest)},i);return new q(o,a=>ks(a))}async updateVisitorAccessTicket(t,i){return await(await this.updateVisitorAccessTicketRaw(t,i)).value()}}class Gr extends Xe{async getVisitorHostsListRaw(t,i){if(t.site===null||t.site===void 0)throw new v("site","Required parameter requestParameters.site was null or undefined when calling getVisitorHostsList.");const s={};t.site!==void 0&&(s.site=t.site),t.nameOrEmailContains!==void 0&&(s.name_or_email_contains=t.nameOrEmailContains),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-hosts",method:"GET",headers:n,query:s},i);return new q(o,a=>Hr(a))}async getVisitorHostsList(t,i){return await(await this.getVisitorHostsListRaw(t,i)).value()}}const Zr="http://localhost".replace(/\/+$/,"");class Wt{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Zr}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||ys}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Kr=new Wt;class Bt{constructor(t=Kr){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new ec(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?Bt.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new Qr(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;Xr(r.body)||r.body instanceof URLSearchParams||Yr(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}Bt.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function Yr(e){return typeof Blob<"u"&&e instanceof Blob}function Xr(e){return typeof FormData<"u"&&e instanceof FormData}class Qr extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class ec extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class Ti extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function f(e,t){return e[t]!=null}function ys(e,t=""){return Object.keys(e).map(i=>Ts(i,e[i],t)).filter(i=>i.length>0).join("&")}function Ts(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return Ts(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?ys(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class It{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}const tc="https://service-management.digitalrealty.com".replace(/\/+$/,"");class Gt{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:tc}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||bs}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const ic=new Gt;class yt{constructor(t=ic){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new oc(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?yt.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new ac(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;nc(r.body)||r.body instanceof URLSearchParams||sc(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}yt.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function sc(e){return typeof Blob<"u"&&e instanceof Blob}function nc(e){return typeof FormData<"u"&&e instanceof FormData}class ac extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class oc extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class dt extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function Ge(e,t){return e[t]!=null}function bs(e,t=""){return Object.keys(e).map(i=>Rs(i,e[i],t)).filter(i=>i.length>0).join("&")}function Rs(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return Rs(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?bs(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class bi{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class rc{constructor(t){this.raw=t}async value(){return await this.raw.text()}}const cc="https://service-management.digitalrealty.com".replace(/\/+$/,"");class As{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:cc}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||_s}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const dc=new As;class oi{constructor(t=dc){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new pc(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?oi.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new mc(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;lc(r.body)||r.body instanceof URLSearchParams||uc(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}oi.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function uc(e){return typeof Blob<"u"&&e instanceof Blob}function lc(e){return typeof FormData<"u"&&e instanceof FormData}class mc extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class pc extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class ee extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function _(e,t){return e[t]!=null}function _s(e,t=""){return Object.keys(e).map(i=>Is(i,e[i],t)).filter(i=>i.length>0).join("&")}function Is(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return Is(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?_s(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class Pe{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class hc{constructor(t){this.raw=t}async value(){return await this.raw.blob()}}function vc(e){if(e!==void 0)return e===null?null:{cancellationReason:e.cancellationReason}}function gc(e){return wc(e)}function wc(e,t){return e==null?e:{message:_(e,"message")?e.message:void 0}}function fc(e){return kc(e)}function kc(e,t){return e==null?e:{requestType:_(e,"request_type")?e.request_type:void 0,categories:_(e,"categories")?e.categories:void 0}}function yc(e){return Tc(e)}function Tc(e,t){return e==null?e:{items:_(e,"items")?e.items.map(fc):void 0}}function Ss(e){return bc(e)}function bc(e,t){return e==null?e:{createdBy:_(e,"created_by")?e.created_by:void 0,createdAt:_(e,"created_at")?new Date(e.created_at):void 0,comment:_(e,"comment")?e.comment:void 0}}function Rc(e){return Ac(e)}function Ac(e,t){return e==null?e:{comments:_(e,"comments")?e.comments.map(Ss):void 0}}function _c(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,request_type:e.requestType,category:e.category,subject:e.subject,description:e.description,expected_start:e.expectedStart===void 0?void 0:e.expectedStart===null?null:e.expectedStart.toISOString(),customer_reference:e.customerReference,locations:e.locations,reference_ticket:e.referenceTicket,other_notification_recipients:e.otherNotificationRecipients}}function Ri(e){return Ic(e)}function Ic(e,t){return e==null?e:{ticketId:_(e,"ticket_id")?e.ticket_id:void 0,accountNumber:_(e,"account_number")?e.account_number:void 0,accountName:_(e,"account_name")?e.account_name:void 0,status:_(e,"status")?e.status:void 0,cancellationReason:_(e,"cancellation_reason")?e.cancellation_reason:void 0,site:_(e,"site")?e.site:void 0,locations:_(e,"locations")?e.locations:void 0,requestType:_(e,"request_type")?e.request_type:void 0,category:_(e,"category")?e.category:void 0,subject:_(e,"subject")?e.subject:void 0,description:_(e,"description")?e.description:void 0,expectedStart:_(e,"expected_start")?e.expected_start===null?null:new Date(e.expected_start):void 0,referenceTicket:_(e,"reference_ticket")?e.reference_ticket:void 0,customerReference:_(e,"customer_reference")?e.customer_reference:void 0,otherNotificationRecipients:_(e,"other_notification_recipients")?e.other_notification_recipients:void 0,createdBy:_(e,"created_by")?e.created_by:void 0,createdAt:_(e,"created_at")?new Date(e.created_at):void 0,updatedAt:_(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:_(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0,comments:_(e,"comments")?e.comments.map(Ss):void 0}}function Sc(e){return Cc(e)}function Cc(e,t){return e==null?e:{accountNumber:_(e,"account_number")?e.account_number:void 0,accountName:_(e,"account_name")?e.account_name:void 0,id:_(e,"id")?e.id:void 0,status:_(e,"status")?e.status:void 0,site:_(e,"site")?e.site:void 0,locations:_(e,"locations")?e.locations:void 0,description:_(e,"description")?e.description:void 0,subject:_(e,"subject")?e.subject:void 0,createdBy:_(e,"created_by")?e.created_by:void 0,updatedAt:_(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:_(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0}}function Nc(e){return Pc(e)}function Pc(e,t){return e==null?e:{remoteHandsTickets:_(e,"remote_hands_tickets")?e.remote_hands_tickets.map(Sc):void 0,totalCount:_(e,"total_count")?e.total_count:void 0,pageNumber:_(e,"page_number")?e.page_number:void 0,pageSize:_(e,"page_size")?e.page_size:void 0}}function qc(e){if(e!==void 0)return e===null?null:{customer_reference:e.customerReference,other_notification_recipients:e.otherNotificationRecipients}}function Cs(e){return Dc(e)}function Dc(e,t){return e==null?e:{id:_(e,"id")?e.id:void 0,fileName:_(e,"file_name")?e.file_name:void 0,fileSize:_(e,"file_size")?e.file_size:void 0,contentType:_(e,"content_type")?e.content_type:void 0,createdBy:_(e,"created_by")?e.created_by:void 0,createdAt:_(e,"created_at")?e.created_at===null?null:new Date(e.created_at):void 0}}function Bc(e){return Oc(e)}function Oc(e,t){return e==null?e:{attachments:_(e,"attachments")?e.attachments.map(Cs):void 0}}function $c(e){if(e!==void 0)return e===null?null:{comment:e.comment}}class Ec extends oi{async cancellationRemoteHandsRequestRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ee("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling cancellationRemoteHandsRequest.");if(t.cancellationTicketsRequest===null||t.cancellationTicketsRequest===void 0)throw new ee("cancellationTicketsRequest","Required parameter requestParameters.cancellationTicketsRequest was null or undefined when calling cancellationRemoteHandsRequest.");const s={},n={};n["Content-Type"]="application/json";const o=await this.request({path:"/remote-hands-tickets/{ticket_id}/cancel".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PUT",headers:n,query:s,body:vc(t.cancellationTicketsRequest)},i);return new Pe(o,a=>gc(a))}async cancellationRemoteHandsRequest(t,i){return await(await this.cancellationRemoteHandsRequestRaw(t,i)).value()}async createRemoteHandsAttachmentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ee("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createRemoteHandsAttachment.");if(t.fileName===null||t.fileName===void 0)throw new ee("fileName","Required parameter requestParameters.fileName was null or undefined when calling createRemoteHandsAttachment.");if(t.body===null||t.body===void 0)throw new ee("body","Required parameter requestParameters.body was null or undefined when calling createRemoteHandsAttachment.");const s={};t.fileName!==void 0&&(s.file_name=t.fileName);const n={};if(n["Content-Type"]="image/jpeg",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/remote-hands-tickets/{ticket_id}/attachments/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:t.body},i);return new Pe(o,a=>Cs(a))}async createRemoteHandsAttachment(t,i){return await(await this.createRemoteHandsAttachmentRaw(t,i)).value()}async createRemoteHandsCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ee("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createRemoteHandsComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new ee("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createRemoteHandsComment.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/remote-hands-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:$c(t.ticketCommentsRequest)},i);return new Pe(o,a=>Rc(a))}async createRemoteHandsComment(t,i){return await(await this.createRemoteHandsCommentRaw(t,i)).value()}async createRemoteHandsTicketRaw(t,i){if(t.remoteHandsRequest===null||t.remoteHandsRequest===void 0)throw new ee("remoteHandsRequest","Required parameter requestParameters.remoteHandsRequest was null or undefined when calling createRemoteHandsTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/remote-hands-tickets",method:"POST",headers:n,query:s,body:_c(t.remoteHandsRequest)},i);return new Pe(o,a=>Ri(a))}async createRemoteHandsTicket(t,i){return await(await this.createRemoteHandsTicketRaw(t,i)).value()}async getRemoteHandsAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ee("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getRemoteHandsAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new ee("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getRemoteHandsAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/remote-hands-tickets/{ticket_id}/attachments/{attachment_id}/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new hc(o)}async getRemoteHandsAttachmentsById(t,i){return await(await this.getRemoteHandsAttachmentsByIdRaw(t,i)).value()}async getRemoteHandsAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ee("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getRemoteHandsAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/remote-hands-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new Pe(o,a=>Bc(a))}async getRemoteHandsAttachmentsList(t,i){return await(await this.getRemoteHandsAttachmentsListRaw(t,i)).value()}async getRemoteHandsCategoriesListRaw(t,i){if(t.site===null||t.site===void 0)throw new ee("site","Required parameter requestParameters.site was null or undefined when calling getRemoteHandsCategoriesList.");const s={};t.site!==void 0&&(s.site=t.site),t.accountNumber!==void 0&&(s.account_number=t.accountNumber);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/remote-hands-tickets/categories",method:"GET",headers:n,query:s},i);return new Pe(o,a=>yc(a))}async getRemoteHandsCategoriesList(t,i){return await(await this.getRemoteHandsCategoriesListRaw(t,i)).value()}async getRemoteHandsTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ee("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getRemoteHandsTicketById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/remote-hands-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new Pe(o,a=>Ri(a))}async getRemoteHandsTicketById(t,i){return await(await this.getRemoteHandsTicketByIdRaw(t,i)).value()}async getRemoteHandsTicketsRaw(t,i){const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.status!==void 0&&(s.status=t.status),t.createdBy!==void 0&&(s.created_by=t.createdBy),t.sort!==void 0&&(s.sort=t.sort),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={},o=await this.request({path:"/remote-hands-tickets",method:"GET",headers:n,query:s},i);return new Pe(o,a=>Nc(a))}async getRemoteHandsTickets(t={},i){return await(await this.getRemoteHandsTicketsRaw(t,i)).value()}async updateRemoteHandsTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ee("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateRemoteHandsTicketById.");if(t.remoteHandsUpdateRequest===null||t.remoteHandsUpdateRequest===void 0)throw new ee("remoteHandsUpdateRequest","Required parameter requestParameters.remoteHandsUpdateRequest was null or undefined when calling updateRemoteHandsTicketById.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/remote-hands-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:qc(t.remoteHandsUpdateRequest)},i);return new Pe(o,a=>Ri(a))}async updateRemoteHandsTicketById(t,i){return await(await this.updateRemoteHandsTicketByIdRaw(t,i)).value()}}function xc(e){return Fc(e)}function Fc(e,t){return e==null?e:{serviceManagement:f(e,"service_management")?e.service_management:void 0,remoteHands:f(e,"remote_hands")?e.remote_hands:void 0,deliveries:f(e,"deliveries")?e.deliveries:void 0,removals:f(e,"removals")?e.removals:void 0,facilitiesAccess:f(e,"facilities_access")?e.facilities_access:void 0,temporaryAccess:f(e,"temporary_access")?e.temporary_access:void 0,inventory:f(e,"inventory")?e.inventory:void 0,orderHistory:f(e,"order_history")?e.order_history:void 0,precabling:f(e,"precabling")?e.precabling:void 0,crossConnect:f(e,"cross_connect")?e.cross_connect:void 0,customerEquipmentConnection:f(e,"customer_equipment_connection")?e.customer_equipment_connection:void 0,virtualConnectivity:f(e,"virtual_connectivity")?e.virtual_connectivity:void 0,customerCare:f(e,"customer_care")?e.customer_care:void 0,troubleTickets:f(e,"trouble_tickets")?e.trouble_tickets:void 0}}function Lc(e){return Vc(e)}function Vc(e,t){return e==null?e:{name:f(e,"name")?e.name:void 0,privilegeLevel:f(e,"privilege_level")?e.privilege_level:void 0}}function Uc(e){return Hc(e)}function Hc(e,t){return e==null?e:{id:e.id,accountNumber:e.account_number,siteId:e.site_id,floor:f(e,"floor")?e.floor:void 0,room:f(e,"room")?e.room:void 0,cage:f(e,"cage")?e.cage:void 0,rack:f(e,"rack")?e.rack:void 0,row:f(e,"row")?e.row:void 0,locationType:e.location_type,csrDemarcation:e.csr_demarcation,comment:f(e,"comment")?e.comment:void 0,dcimEnabled:f(e,"dcim_enabled")?e.dcim_enabled:void 0,permissions:f(e,"permissions")?e.permissions.map(Lc):void 0,assignableProcesses:f(e,"assignable_processes")?xc(e.assignable_processes):void 0}}function zc(e){return jc(e)}function jc(e,t){return e==null?e:{self:f(e,"self")?e.self:void 0,first:f(e,"first")?e.first:void 0,prev:f(e,"prev")?e.prev:void 0,next:f(e,"next")?e.next:void 0,last:f(e,"last")?e.last:void 0,items:e.items.map(Uc)}}function Mc(e){return Jc(e)}function Jc(e,t){return e==null?e:{count:e.count}}function Ns(e){return Wc(e)}function Wc(e,t){return e==null?e:{id:f(e,"id")?e.id:void 0,locationId:f(e,"location_id")?e.location_id:void 0,name:f(e,"name")?e.name:void 0,campus:f(e,"campus")?e.campus:void 0,metroArea:f(e,"metro_area")?e.metro_area:void 0,region:f(e,"region")?e.region:void 0,regionName:f(e,"region_name")?e.region_name:void 0,country:f(e,"country")?e.country:void 0,addressCountry:f(e,"address_country")?e.address_country:void 0,addressLocality:f(e,"address_locality")?e.address_locality:void 0,addressRegion:f(e,"address_region")?e.address_region:void 0,postalCode:f(e,"postal_code")?e.postal_code:void 0,streetAddress:f(e,"street_address")?e.street_address:void 0,peeringdbFacilityId:f(e,"peeringdb_facility_id")?e.peeringdb_facility_id:void 0,organisationName:f(e,"organisation_name")?e.organisation_name:void 0,timeZone:f(e,"time_zone")?e.time_zone:void 0,latitude:f(e,"latitude")?e.latitude:void 0,longitude:f(e,"longitude")?e.longitude:void 0,locations:f(e,"locations")?Mc(e.locations):void 0}}function Gc(e){return Zc(e)}function Zc(e,t){return e==null?e:{self:f(e,"self")?e.self:void 0,first:f(e,"first")?e.first:void 0,prev:f(e,"prev")?e.prev:void 0,next:f(e,"next")?e.next:void 0,last:f(e,"last")?e.last:void 0,items:e.items.map(Ns)}}function Kc(e){return Yc(e)}function Yc(e,t){return e==null?e:{id:f(e,"id")?e.id:void 0,name:f(e,"name")?e.name:void 0,description:f(e,"description")?e.description:void 0}}function Xc(e){return Qc(e)}function Qc(e,t){return e==null?e:{id:f(e,"id")?e.id:void 0,name:f(e,"name")?e.name:void 0,description:f(e,"description")?e.description:void 0}}class ed extends Bt{async getLocationsRaw(t,i){const s={};t.sort!==void 0&&(s.sort=t.sort),t.cursor!==void 0&&(s.cursor=t.cursor),t.pageSize!==void 0&&(s.page_size=t.pageSize),t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.id!==void 0&&(s.id=t.id),t.siteId!==void 0&&(s.site_id=t.siteId),t.floor!==void 0&&(s.floor=t.floor),t.room!==void 0&&(s.room=t.room),t.cage!==void 0&&(s.cage=t.cage),t.rack!==void 0&&(s.rack=t.rack),t.row!==void 0&&(s.row=t.row),t.demarcation!==void 0&&(s.demarcation=t.demarcation),t.locationType!==void 0&&(s.location_type=t.locationType),t.embed!==void 0&&(s.embed=t.embed),t.permissionType!==void 0&&(s.permission_type=t.permissionType),t.permissionPrivilege!==void 0&&(s.permission_privilege=t.permissionPrivilege),t.dcimEnabled!==void 0&&(s.dcim_enabled=t.dcimEnabled),t.assignableProcess!==void 0&&(s.assignable_process=t.assignableProcess);const n={};this.configuration&&this.configuration.apiKey&&(n.Authorization=this.configuration.apiKey("Authorization"));const o=await this.request({path:"/locations",method:"GET",headers:n,query:s},i);return new It(o,a=>zc(a))}async getLocations(t={},i){return await(await this.getLocationsRaw(t,i)).value()}}class Ps extends Bt{async getOspsBySiteIdRaw(t,i){if(t.siteId===null||t.siteId===void 0)throw new Ti("siteId","Required parameter requestParameters.siteId was null or undefined when calling getOspsBySiteId.");const s={},n={};this.configuration&&this.configuration.apiKey&&(n.Authorization=this.configuration.apiKey("Authorization"));const o=await this.request({path:"/sites/{siteId}/osps".replace("{siteId}",encodeURIComponent(String(t.siteId))),method:"GET",headers:n,query:s},i);return new It(o,a=>a.map(Kc))}async getOspsBySiteId(t,i){return await(await this.getOspsBySiteIdRaw(t,i)).value()}async getPopsBySiteIdRaw(t,i){if(t.siteId===null||t.siteId===void 0)throw new Ti("siteId","Required parameter requestParameters.siteId was null or undefined when calling getPopsBySiteId.");const s={},n={};this.configuration&&this.configuration.apiKey&&(n.Authorization=this.configuration.apiKey("Authorization"));const o=await this.request({path:"/sites/{siteId}/pops".replace("{siteId}",encodeURIComponent(String(t.siteId))),method:"GET",headers:n,query:s},i);return new It(o,a=>a.map(Xc))}async getPopsBySiteId(t,i){return await(await this.getPopsBySiteIdRaw(t,i)).value()}async getSiteByIdRaw(t,i){if(t.siteId===null||t.siteId===void 0)throw new Ti("siteId","Required parameter requestParameters.siteId was null or undefined when calling getSiteById.");const s={},n={};this.configuration&&this.configuration.apiKey&&(n.Authorization=this.configuration.apiKey("Authorization"));const o=await this.request({path:"/sites/{siteId}".replace("{siteId}",encodeURIComponent(String(t.siteId))),method:"GET",headers:n,query:s},i);return new It(o,a=>Ns(a))}async getSiteById(t,i){return await(await this.getSiteByIdRaw(t,i)).value()}async getSitesRaw(t,i){const s={};t.name!==void 0&&(s.name=t.name),t.sort!==void 0&&(s.sort=t.sort),t.cursor!==void 0&&(s.cursor=t.cursor),t.pageSize!==void 0&&(s.page_size=t.pageSize),t.showMySites!==void 0&&(s.show_my_sites=t.showMySites),t.embed!==void 0&&(s.embed=t.embed);const n={};this.configuration&&this.configuration.apiKey&&(n.Authorization=this.configuration.apiKey("Authorization"));const o=await this.request({path:"/sites",method:"GET",headers:n,query:s},i);return new It(o,a=>Gc(a))}async getSites(t={},i){return await(await this.getSitesRaw(t,i)).value()}}const td="https://api.digitalrealty.com".replace(/\/+$/,"");class qs{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:td}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Ds}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const id=new qs;class ri{constructor(t=id){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new od(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?ri.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new ad(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;nd(r.body)||r.body instanceof URLSearchParams||sd(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}ri.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function sd(e){return typeof Blob<"u"&&e instanceof Blob}function nd(e){return typeof FormData<"u"&&e instanceof FormData}class ad extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class od extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class Zt extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function T(e,t){return e[t]!=null}function Ds(e,t=""){return Object.keys(e).map(i=>Bs(i,e[i],t)).filter(i=>i.length>0).join("&")}function Bs(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return Bs(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Ds(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class Ai{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class Os{constructor(t){this.raw=t}async value(){return await this.raw.blob()}}const rd="https://api.digitalrealty.com/service-management/v1".replace(/\/+$/,"");class $s{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:rd}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Es}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const cd=new $s;class ci{constructor(t=cd){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new md(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?ci.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new ld(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;ud(r.body)||r.body instanceof URLSearchParams||dd(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}ci.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function dd(e){return typeof Blob<"u"&&e instanceof Blob}function ud(e){return typeof FormData<"u"&&e instanceof FormData}class ld extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class md extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class vt extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function D(e,t){return e[t]!=null}function Es(e,t=""){return Object.keys(e).map(i=>xs(i,e[i],t)).filter(i=>i.length>0).join("&")}function xs(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return xs(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Es(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class Kt{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class Fs{constructor(t){this.raw=t}async value(){return await this.raw.blob()}}function Ls(e){return pd(e)}function pd(e,t){return e==null?e:{createdBy:D(e,"created_by")?e.created_by:void 0,createdAt:D(e,"created_at")?new Date(e.created_at):void 0,comment:D(e,"comment")?e.comment:void 0}}function hd(e){return vd(e)}function vd(e,t){return e==null?e:{comments:D(e,"comments")?e.comments.map(Ls):void 0}}function Vs(e){return gd(e)}function gd(e,t){return e==null?e:{id:D(e,"id")?e.id:void 0,fileName:D(e,"file_name")?e.file_name:void 0}}function wd(e){return fd(e)}function fd(e,t){return e==null?e:{accountNumber:D(e,"account_number")?e.account_number:void 0,accountName:D(e,"account_name")?e.account_name:void 0,id:D(e,"id")?e.id:void 0,status:D(e,"status")?e.status:void 0,subject:D(e,"subject")?e.subject:void 0,site:D(e,"site")?e.site:void 0,priority:D(e,"priority")?e.priority:void 0,comments:D(e,"comments")?e.comments.map(Ls):void 0,attachments:D(e,"attachments")?e.attachments.map(Vs):void 0,createdAt:D(e,"created_at")?new Date(e.created_at):void 0,updatedAt:D(e,"updated_at")?new Date(e.updated_at):void 0}}function kd(e){return yd(e)}function yd(e,t){return e==null?e:{accountNumber:D(e,"account_number")?e.account_number:void 0,accountName:D(e,"account_name")?e.account_name:void 0,id:D(e,"id")?e.id:void 0,status:D(e,"status")?e.status:void 0,subject:D(e,"subject")?e.subject:void 0,site:D(e,"site")?e.site:void 0,priority:D(e,"priority")?e.priority:void 0,attachments:D(e,"attachments")?e.attachments.map(Vs):void 0,createdAt:D(e,"created_at")?new Date(e.created_at):void 0,updatedAt:D(e,"updated_at")?new Date(e.updated_at):void 0}}function Td(e){return bd(e)}function bd(e,t){return e==null?e:{items:D(e,"items")?e.items.map(kd):void 0,totalCount:D(e,"total_count")?e.total_count:void 0,pageNumber:D(e,"page_number")?e.page_number:void 0,pageSize:D(e,"page_size")?e.page_size:void 0}}function Rd(e){return Ad(e)}function Ad(e,t){return e==null?e:{id:D(e,"id")?e.id:void 0,fileName:D(e,"file_name")?e.file_name:void 0,fileSize:D(e,"file_size")?e.file_size:void 0,contentType:D(e,"content_type")?e.content_type:void 0,createdBy:D(e,"created_by")?e.created_by:void 0,createdAt:D(e,"created_at")?new Date(e.created_at):void 0}}function _d(e){return Id(e)}function Id(e,t){return e==null?e:{attachments:D(e,"attachments")?e.attachments.map(Rd):void 0}}function Sd(e){if(e!==void 0)return e===null?null:{comment:e.comment}}class Cd extends ci{async createIncidentCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new vt("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createIncidentComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new vt("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createIncidentComment.");const s={},n={};n["Content-Type"]="application/json";const o=await this.request({path:"/incident-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:Sd(t.ticketCommentsRequest)},i);return new Kt(o,a=>hd(a))}async createIncidentComment(t,i){return await(await this.createIncidentCommentRaw(t,i)).value()}async downloadIncidentTicketsRaw(t,i){const s={};t.$filter!==void 0&&(s.$filter=t.$filter),t.$orderby!==void 0&&(s.$orderby=t.$orderby),t.$skip!==void 0&&(s.$skip=t.$skip),t.$top!==void 0&&(s.$top=t.$top);const n={},o=await this.request({path:"/incident-tickets/file",method:"GET",headers:n,query:s},i);return new Fs(o)}async downloadIncidentTickets(t={},i){return await(await this.downloadIncidentTicketsRaw(t,i)).value()}async getIncidentsAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new vt("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getIncidentsAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new vt("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getIncidentsAttachmentsById.");const s={},n={},o=await this.request({path:"/incident-tickets/{ticket_id}/attachments/file/{attachment_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new Fs(o)}async getIncidentsAttachmentsById(t,i){return await(await this.getIncidentsAttachmentsByIdRaw(t,i)).value()}async getIncidentsAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new vt("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getIncidentsAttachmentsList.");const s={},n={},o=await this.request({path:"/incident-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new Kt(o,a=>_d(a))}async getIncidentsAttachmentsList(t,i){return await(await this.getIncidentsAttachmentsListRaw(t,i)).value()}async getIncidentsTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new vt("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getIncidentsTicketById.");const s={},n={},o=await this.request({path:"/incident-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new Kt(o,a=>wd(a))}async getIncidentsTicketById(t,i){return await(await this.getIncidentsTicketByIdRaw(t,i)).value()}async getIncidentsTicketsRaw(t,i){const s={};t.$filter!==void 0&&(s.$filter=t.$filter),t.$orderby!==void 0&&(s.$orderby=t.$orderby),t.$skip!==void 0&&(s.$skip=t.$skip),t.$top!==void 0&&(s.$top=t.$top);const n={},o=await this.request({path:"/incident-tickets",method:"GET",headers:n,query:s},i);return new Kt(o,a=>Td(a))}async getIncidentsTickets(t={},i){return await(await this.getIncidentsTicketsRaw(t,i)).value()}}const Nd="http://localhost".replace(/\/+$/,"");class Us{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Nd}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||zs}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Pd=new Us;class di{constructor(t=Pd){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new Od(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?di.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new Bd(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;Dd(r.body)||r.body instanceof URLSearchParams||qd(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}di.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function qd(e){return typeof Blob<"u"&&e instanceof Blob}function Dd(e){return typeof FormData<"u"&&e instanceof FormData}class Bd extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class Od extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class Hs extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function qe(e,t){return e[t]!=null}function zs(e,t=""){return Object.keys(e).map(i=>js(i,e[i],t)).filter(i=>i.length>0).join("&")}function js(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return js(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?zs(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class $d{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}const Ed="http://localhost".replace(/\/+$/,"");class Ms{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Ed}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Ws}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const xd=new Ms;class ui{constructor(t=xd){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new Ud(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?ui.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new Vd(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;Ld(r.body)||r.body instanceof URLSearchParams||Fd(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}ui.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function Fd(e){return typeof Blob<"u"&&e instanceof Blob}function Ld(e){return typeof FormData<"u"&&e instanceof FormData}class Vd extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class Ud extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}function Js(e,t){return e[t]!=null}function Ws(e,t=""){return Object.keys(e).map(i=>Gs(i,e[i],t)).filter(i=>i.length>0).join("&")}function Gs(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return Gs(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Ws(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class Zs{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}function Hd(e){if(e!==void 0)return e===null?null:{cancellationReason:e.cancellationReason}}function zd(e){return jd(e)}function jd(e,t){return e==null?e:{message:I(e,"message")?e.message:void 0}}function Md(e){return Jd(e)}function Jd(e,t){return e==null?e:{requestType:I(e,"request_type")?e.request_type:void 0,categories:I(e,"categories")?e.categories:void 0}}function Wd(e){return Gd(e)}function Gd(e,t){return e==null?e:{items:I(e,"items")?e.items.map(Md):void 0}}function Ks(e){return Zd(e)}function Zd(e,t){return e==null?e:{createdBy:I(e,"created_by")?e.created_by:void 0,createdAt:I(e,"created_at")?new Date(e.created_at):void 0,comment:I(e,"comment")?e.comment:void 0}}function Kd(e){return Yd(e)}function Yd(e,t){return e==null?e:{comments:I(e,"comments")?e.comments.map(Ks):void 0}}function Xd(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,subject:e.subject,request_type:e.requestType,category:e.category,locations:e.locations,customer_reference:e.customerReference,description:e.description,notification_recipients:e.notificationRecipients}}function _i(e){return Qd(e)}function Qd(e,t){return e==null?e:{accountNumber:I(e,"account_number")?e.account_number:void 0,accountName:I(e,"account_name")?e.account_name:void 0,id:I(e,"id")?e.id:void 0,status:I(e,"status")?e.status:void 0,cancellationReason:I(e,"cancellation_reason")?e.cancellation_reason:void 0,subject:I(e,"subject")?e.subject:void 0,requestType:I(e,"request_type")?e.request_type:void 0,category:I(e,"category")?e.category:void 0,site:I(e,"site")?e.site:void 0,locations:I(e,"locations")?e.locations:void 0,customerReference:I(e,"customer_reference")?e.customer_reference:void 0,description:I(e,"description")?e.description:void 0,notificationRecipients:I(e,"notification_recipients")?e.notification_recipients:void 0,createdBy:I(e,"created_by")?e.created_by:void 0,createdAt:I(e,"created_at")?new Date(e.created_at):void 0,updatedAt:I(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:I(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0,comments:I(e,"comments")?e.comments.map(Ks):void 0}}function eu(e){if(e!==void 0)return e===null?null:{subject:e.subject,description:e.description,customer_reference:e.customerReference,other_notification_recipients:e.otherNotificationRecipients}}function tu(e){return iu(e)}function iu(e,t){return e==null?e:{accountNumber:I(e,"account_number")?e.account_number:void 0,accountName:I(e,"account_name")?e.account_name:void 0,id:I(e,"id")?e.id:void 0,status:I(e,"status")?e.status:void 0,subject:I(e,"subject")?e.subject:void 0,site:I(e,"site")?e.site:void 0,locations:I(e,"locations")?e.locations:void 0,description:I(e,"description")?e.description:void 0,createdBy:I(e,"created_by")?e.created_by:void 0,createdAt:I(e,"created_at")?new Date(e.created_at):void 0,updatedAt:I(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:I(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0}}function su(e){return nu(e)}function nu(e,t){return e==null?e:{items:I(e,"items")?e.items.map(tu):void 0,totalCount:I(e,"total_count")?e.total_count:void 0,pageNumber:I(e,"page_number")?e.page_number:void 0,pageSize:I(e,"page_size")?e.page_size:void 0}}function Ys(e){return au(e)}function au(e,t){return e==null?e:{id:I(e,"id")?e.id:void 0,fileName:I(e,"file_name")?e.file_name:void 0,fileSize:I(e,"file_size")?e.file_size:void 0,contentType:I(e,"content_type")?e.content_type:void 0,createdBy:I(e,"created_by")?e.created_by:void 0,createdAt:I(e,"created_at")?new Date(e.created_at):void 0}}function ou(e){return ru(e)}function ru(e,t){return e==null?e:{attachments:I(e,"attachments")?e.attachments.map(Ys):void 0}}function cu(e){if(e!==void 0)return e===null?null:{comment:e.comment}}class du extends ai{async cancellationCustomerCareRequestRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ne("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling cancellationCustomerCareRequest.");if(t.cancellationTicketsRequest===null||t.cancellationTicketsRequest===void 0)throw new ne("cancellationTicketsRequest","Required parameter requestParameters.cancellationTicketsRequest was null or undefined when calling cancellationCustomerCareRequest.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/customer-care-tickets/{ticket_id}/cancel".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PUT",headers:n,query:s,body:Hd(t.cancellationTicketsRequest)},i);return new Ne(o,a=>zd(a))}async cancellationCustomerCareRequest(t,i){return await(await this.cancellationCustomerCareRequestRaw(t,i)).value()}async createCustomerCareCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ne("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createCustomerCareComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new ne("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createCustomerCareComment.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/customer-care-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:cu(t.ticketCommentsRequest)},i);return new Ne(o,a=>Kd(a))}async createCustomerCareComment(t,i){return await(await this.createCustomerCareCommentRaw(t,i)).value()}async createCustomerCareTicketRaw(t,i){if(t.customerCareTicketRequest===null||t.customerCareTicketRequest===void 0)throw new ne("customerCareTicketRequest","Required parameter requestParameters.customerCareTicketRequest was null or undefined when calling createCustomerCareTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/customer-care-tickets",method:"POST",headers:n,query:s,body:Xd(t.customerCareTicketRequest)},i);return new Ne(o,a=>_i(a))}async createCustomerCareTicket(t,i){return await(await this.createCustomerCareTicketRaw(t,i)).value()}async createCustomerCareTicketAttachmentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ne("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createCustomerCareTicketAttachment.");if(t.fileName===null||t.fileName===void 0)throw new ne("fileName","Required parameter requestParameters.fileName was null or undefined when calling createCustomerCareTicketAttachment.");if(t.body===null||t.body===void 0)throw new ne("body","Required parameter requestParameters.body was null or undefined when calling createCustomerCareTicketAttachment.");const s={};t.fileName!==void 0&&(s.file_name=t.fileName);const n={};if(n["Content-Type"]="image/jpeg",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/customer-care-tickets/{ticket_id}/attachments/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:t.body},i);return new Ne(o,a=>Ys(a))}async createCustomerCareTicketAttachment(t,i){return await(await this.createCustomerCareTicketAttachmentRaw(t,i)).value()}async getCustomerCareCategoriesListRaw(t,i){const s={};t.site!==void 0&&(s.site=t.site),t.accountNumber!==void 0&&(s.account_number=t.accountNumber);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/customer-care-tickets/categories",method:"GET",headers:n,query:s},i);return new Ne(o,a=>Wd(a))}async getCustomerCareCategoriesList(t={},i){return await(await this.getCustomerCareCategoriesListRaw(t,i)).value()}async getCustomerCareTicketAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ne("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getCustomerCareTicketAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new ne("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getCustomerCareTicketAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/customer-care-tickets/{ticket_id}/attachments/file/{attachment_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new Na(o)}async getCustomerCareTicketAttachmentsById(t,i){return await(await this.getCustomerCareTicketAttachmentsByIdRaw(t,i)).value()}async getCustomerCareTicketAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ne("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getCustomerCareTicketAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/customer-care-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new Ne(o,a=>ou(a))}async getCustomerCareTicketAttachmentsList(t,i){return await(await this.getCustomerCareTicketAttachmentsListRaw(t,i)).value()}async getCustomerCareTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ne("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getCustomerCareTicketById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/customer-care-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new Ne(o,a=>_i(a))}async getCustomerCareTicketById(t,i){return await(await this.getCustomerCareTicketByIdRaw(t,i)).value()}async getCustomerCareTicketsRaw(t,i){const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.status!==void 0&&(s.status=t.status),t.createdBy!==void 0&&(s.created_by=t.createdBy),t.sort!==void 0&&(s.sort=t.sort),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={},o=await this.request({path:"/customer-care-tickets",method:"GET",headers:n,query:s},i);return new Ne(o,a=>su(a))}async getCustomerCareTickets(t={},i){return await(await this.getCustomerCareTicketsRaw(t,i)).value()}async updateCustomerCareTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ne("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateCustomerCareTicket.");if(t.customerCareTicketUpdateRequest===null||t.customerCareTicketUpdateRequest===void 0)throw new ne("customerCareTicketUpdateRequest","Required parameter requestParameters.customerCareTicketUpdateRequest was null or undefined when calling updateCustomerCareTicket.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/customer-care-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:eu(t.customerCareTicketUpdateRequest)},i);return new Ne(o,a=>_i(a))}async updateCustomerCareTicket(t,i){return await(await this.updateCustomerCareTicketRaw(t,i)).value()}}function uu(e){return lu(e)}function lu(e,t){return e==null?e:{requestType:Ge(e,"request_type")?e.request_type:void 0,categories:Ge(e,"categories")?e.categories:void 0}}function mu(e){return pu(e)}function pu(e,t){return e==null?e:{mappedRequestType:Ge(e,"mapped_request_type")?e.mapped_request_type:void 0,canonicalValue:Ge(e,"canonical_value")?e.canonical_value:void 0,mappedValue:Ge(e,"mapped_value")?e.mapped_value:void 0,isActive:Ge(e,"is_active")?e.is_active:void 0}}function hu(e){return vu(e)}function vu(e,t){return e==null?e:{requestType:Ge(e,"request_type")?e.request_type:void 0,categories:Ge(e,"categories")?e.categories.map(mu):void 0}}class gu extends yt{async getRequestTypesAndCategoriesRaw(t,i){if(t.serviceTicketType===null||t.serviceTicketType===void 0)throw new dt("serviceTicketType","Required parameter requestParameters.serviceTicketType was null or undefined when calling getRequestTypesAndCategories.");if(t.accountNumber===null||t.accountNumber===void 0)throw new dt("accountNumber","Required parameter requestParameters.accountNumber was null or undefined when calling getRequestTypesAndCategories.");if(t.site===null||t.site===void 0)throw new dt("site","Required parameter requestParameters.site was null or undefined when calling getRequestTypesAndCategories.");if(t.requestType===null||t.requestType===void 0)throw new dt("requestType","Required parameter requestParameters.requestType was null or undefined when calling getRequestTypesAndCategories.");const s={};t.serviceTicketType!==void 0&&(s.service_ticket_type=t.serviceTicketType),t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.requestType!==void 0&&(s.request_type=t.requestType);const n={},o=await this.request({path:"/categories",method:"GET",headers:n,query:s},i);return new bi(o,a=>a.map(uu))}async getRequestTypesAndCategories(t,i){return await(await this.getRequestTypesAndCategoriesRaw(t,i)).value()}}class wu extends yt{async getRequestTypeCategoryMappingsRaw(t,i){if(t.serviceTicketType===null||t.serviceTicketType===void 0)throw new dt("serviceTicketType","Required parameter requestParameters.serviceTicketType was null or undefined when calling getRequestTypeCategoryMappings.");if(t.serviceManagementSystem===null||t.serviceManagementSystem===void 0)throw new dt("serviceManagementSystem","Required parameter requestParameters.serviceManagementSystem was null or undefined when calling getRequestTypeCategoryMappings.");const s={};t.serviceTicketType!==void 0&&(s.service_ticket_type=t.serviceTicketType),t.serviceManagementSystem!==void 0&&(s.service_management_system=t.serviceManagementSystem),t.siteCode!==void 0&&(s.site_code=t.siteCode);const n={},o=await this.request({path:"/requestTypeCategoryMappings",method:"GET",headers:n,query:s},i);return new bi(o,a=>a.map(hu))}async getRequestTypeCategoryMappings(t,i){return await(await this.getRequestTypeCategoryMappingsRaw(t,i)).value()}}const fu={CustomerEnquiries:"customer_enquiries",RemoteHands:"remote_hands",CustomerCare:"customer_care",TroubleTickets:"trouble_tickets"};class ku extends yt{async getTermsRaw(t,i){if(t.service===null||t.service===void 0)throw new dt("service","Required parameter requestParameters.service was null or undefined when calling getTerms.");const s={},n={},o=await this.request({path:"/{service}/terms".replace("{service}",encodeURIComponent(String(t.service))),method:"GET",headers:n,query:s},i);return this.isJsonMime(o.headers.get("content-type"))?new bi(o):new rc(o)}async getTerms(t,i){return await(await this.getTermsRaw(t,i)).value()}}const yu="https://api.digitalrealty.com".replace(/\/+$/,"");class Xs{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:yu}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Qs}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Tu=new Xs;class li{constructor(t=Tu){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new _u(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?li.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new Au(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;Ru(r.body)||r.body instanceof URLSearchParams||bu(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}li.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function bu(e){return typeof Blob<"u"&&e instanceof Blob}function Ru(e){return typeof FormData<"u"&&e instanceof FormData}class Au extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class _u extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}function V(e,t){return e[t]!=null}function Qs(e,t=""){return Object.keys(e).map(i=>en(i,e[i],t)).filter(i=>i.length>0).join("&")}function en(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return en(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Qs(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class Iu{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class Su{constructor(t){this.raw=t}async value(){return await this.raw.blob()}}function Cu(e){return Nu(e)}function Nu(e,t){return e==null?e:{id:V(e,"id")?e.id:void 0,name:V(e,"name")?e.name:void 0}}function Pu(e){return qu(e)}function qu(e,t){return e==null?e:{accountNumber:V(e,"account_number")?e.account_number:void 0,accountName:V(e,"account_name")?e.account_name:void 0,ticketId:V(e,"ticket_id")?e.ticket_id:void 0,ticketType:V(e,"ticket_type")?e.ticket_type:void 0,requestType:V(e,"request_type")?e.request_type:void 0,category:V(e,"category")?e.category:void 0,subject:V(e,"subject")?e.subject:void 0,sites:V(e,"sites")?e.sites.map(Cu):void 0,locations:V(e,"locations")?e.locations:void 0,accessRequestedFor:V(e,"access_requested_for")?e.access_requested_for:void 0,status:V(e,"status")?e.status:void 0,cancellationReason:V(e,"cancellation_reason")?e.cancellation_reason:void 0,createdBy:V(e,"created_by")?e.created_by:void 0,createdAt:V(e,"created_at")?new Date(e.created_at):void 0,updatedAt:V(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:V(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0}}function Du(e){return Bu(e)}function Bu(e,t){return e==null?e:{items:V(e,"items")?e.items.map(Pu):void 0,totalCount:V(e,"total_count")?e.total_count:void 0,pageNumber:V(e,"page_number")?e.page_number:void 0,pageSize:V(e,"page_size")?e.page_size:void 0}}class Ou extends li{async downloadServiceTicketsRaw(t,i){const s={};t.$filter!==void 0&&(s.$filter=t.$filter),t.permissionPrivilege!==void 0&&(s.permission_privilege=t.permissionPrivilege);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/service-tickets/file",method:"GET",headers:n,query:s},i);return new Su(o)}async downloadServiceTickets(t={},i){return await(await this.downloadServiceTicketsRaw(t,i)).value()}async getServiceTicketsRaw(t,i){const s={};t.$filter!==void 0&&(s.$filter=t.$filter),t.$orderby!==void 0&&(s.$orderby=t.$orderby),t.$skip!==void 0&&(s.$skip=t.$skip),t.$top!==void 0&&(s.$top=t.$top),t.permissionPrivilege!==void 0&&(s.permission_privilege=t.permissionPrivilege);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/service-tickets",method:"GET",headers:n,query:s},i);return new Iu(o,a=>Du(a))}async getServiceTickets(t={},i){return await(await this.getServiceTicketsRaw(t,i)).value()}}function $u(e){return Eu(e)}function Eu(e,t){return e==null?e:{id:T(e,"id")?e.id:void 0,fileName:T(e,"file_name")?e.file_name:void 0}}function xu(e){return Fu(e)}function Fu(e,t){return e==null?e:{accountNumber:T(e,"account_number")?e.account_number:void 0,accountName:T(e,"account_name")?e.account_name:void 0,id:T(e,"id")?e.id:void 0,status:T(e,"status")?e.status:void 0,cancellationReason:T(e,"cancellation_reason")?e.cancellation_reason:void 0,subject:T(e,"subject")?e.subject:void 0,startDate:T(e,"start_date")?new Date(e.start_date):void 0,endDate:T(e,"end_date")?new Date(e.end_date):void 0,approvalStatus:T(e,"approval_status")?e.approval_status:void 0,category:T(e,"category")?e.category:void 0,activityType:T(e,"activity_type")?e.activity_type:void 0,activitySubtype:T(e,"activity_subtype")?e.activity_subtype:void 0,activityCategory:T(e,"activity_category")?e.activity_category:void 0,site:T(e,"site")?e.site:void 0,locations:T(e,"locations")?e.locations:void 0,highLevelSummary:T(e,"high_level_summary")?e.high_level_summary:void 0,serviceType:T(e,"service_type")?e.service_type:void 0,riskLevel:T(e,"risk_level")?e.risk_level:void 0,attachments:T(e,"attachments")?e.attachments.map($u):void 0,createdAt:T(e,"created_at")?new Date(e.created_at):void 0,updatedAt:T(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:T(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0}}function Lu(e){return Vu(e)}function Vu(e,t){return e==null?e:{items:T(e,"items")?e.items.map(xu):void 0}}function Uu(e){return Hu(e)}function Hu(e,t){return e==null?e:{id:T(e,"id")?e.id:void 0,fileName:T(e,"file_name")?e.file_name:void 0}}function zu(e){return ju(e)}function ju(e,t){return e==null?e:{accountNumber:T(e,"account_number")?e.account_number:void 0,accountName:T(e,"account_name")?e.account_name:void 0,id:T(e,"id")?e.id:void 0,status:T(e,"status")?e.status:void 0,subject:T(e,"subject")?e.subject:void 0,startDate:T(e,"start_date")?new Date(e.start_date):void 0,endDate:T(e,"end_date")?new Date(e.end_date):void 0,activityType:T(e,"activity_type")?e.activity_type:void 0,site:T(e,"site")?e.site:void 0,locations:T(e,"locations")?e.locations:void 0,notificationType:T(e,"notification_type")?e.notification_type:void 0,riskLevel:T(e,"risk_level")?e.risk_level:void 0,attachments:T(e,"attachments")?e.attachments.map(Uu):void 0,createdAt:T(e,"created_at")?new Date(e.created_at):void 0,updatedAt:T(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:T(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0}}function Mu(e){return Ju(e)}function Ju(e,t){return e==null?e:{items:T(e,"items")?e.items.map(zu):void 0,totalCount:T(e,"total_count")?e.total_count:void 0,pageNumber:T(e,"page_number")?e.page_number:void 0,pageSize:T(e,"page_size")?e.page_size:void 0}}function Wu(e){return Gu(e)}function Gu(e,t){return e==null?e:{id:T(e,"id")?e.id:void 0,fileName:T(e,"file_name")?e.file_name:void 0,fileSize:T(e,"file_size")?e.file_size:void 0,contentType:T(e,"content_type")?e.content_type:void 0,createdBy:T(e,"created_by")?e.created_by:void 0,createdAt:T(e,"created_at")?new Date(e.created_at):void 0}}function Zu(e){return Ku(e)}function Ku(e,t){return e==null?e:{attachments:T(e,"attachments")?e.attachments.map(Wu):void 0}}class Yu extends ri{async downloadPlannedMaintenanceTicketsRaw(t,i){const s={};t.$filter!==void 0&&(s.$filter=t.$filter),t.$orderby!==void 0&&(s.$orderby=t.$orderby),t.$skip!==void 0&&(s.$skip=t.$skip),t.$top!==void 0&&(s.$top=t.$top);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/planned-maintenances/file",method:"GET",headers:n,query:s},i);return new Os(o)}async downloadPlannedMaintenanceTickets(t={},i){return await(await this.downloadPlannedMaintenanceTicketsRaw(t,i)).value()}async getPlannedMaintenanceAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new Zt("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getPlannedMaintenanceAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new Zt("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getPlannedMaintenanceAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/planned-maintenances/{ticket_id}/attachments/file/{attachment_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new Os(o)}async getPlannedMaintenanceAttachmentsById(t,i){return await(await this.getPlannedMaintenanceAttachmentsByIdRaw(t,i)).value()}async getPlannedMaintenanceAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new Zt("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getPlannedMaintenanceAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/planned-maintenances/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new Ai(o,a=>Zu(a))}async getPlannedMaintenanceAttachmentsList(t,i){return await(await this.getPlannedMaintenanceAttachmentsListRaw(t,i)).value()}async getPlannedMaintenanceTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new Zt("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getPlannedMaintenanceTicketById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/planned-maintenances/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new Ai(o,a=>Lu(a))}async getPlannedMaintenanceTicketById(t,i){return await(await this.getPlannedMaintenanceTicketByIdRaw(t,i)).value()}async getPlannedMaintenanceTicketsRaw(t,i){const s={};t.$filter!==void 0&&(s.$filter=t.$filter),t.$orderby!==void 0&&(s.$orderby=t.$orderby),t.$skip!==void 0&&(s.$skip=t.$skip),t.$top!==void 0&&(s.$top=t.$top);const n={},o=await this.request({path:"/planned-maintenances",method:"GET",headers:n,query:s},i);return new Ai(o,a=>Mu(a))}async getPlannedMaintenanceTickets(t={},i){return await(await this.getPlannedMaintenanceTicketsRaw(t,i)).value()}}function Xu(e){return Qu(e)}function Qu(e,t){return e==null?e:{en:qe(e,"en")?e.en:void 0,fr:qe(e,"fr")?e.fr:void 0,de:qe(e,"de")?e.de:void 0,es:qe(e,"es")?e.es:void 0}}function el(e){return tl(e)}function tl(e,t){return e}function il(e){return sl(e)}function sl(e,t){return e}const Yt={ServiceNow:"ServiceNow",InSite:"InSite",TelxSfdc:"TelxSFDC"};function nl(e){return al(e)}function al(e,t){return e}function ol(e){return rl(e)}function rl(e,t){return e==null?e:{process:qe(e,"process")?il(e.process):void 0,site:qe(e,"site")?e.site:void 0,serviceManagementSystem:qe(e,"serviceManagementSystem")?nl(e.serviceManagementSystem):void 0,destinationUrls:qe(e,"destinationUrls")?Xu(e.destinationUrls):void 0,portal:qe(e,"portal")?el(e.portal):void 0}}class cl extends di{async getSiteNavigationRaw(t,i){if(t.accountNumber===null||t.accountNumber===void 0)throw new Hs("accountNumber","Required parameter requestParameters.accountNumber was null or undefined when calling getSiteNavigation.");if(t.site===null||t.site===void 0)throw new Hs("site","Required parameter requestParameters.site was null or undefined when calling getSiteNavigation.");const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.process!==void 0&&(s.process=t.process);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("bearerToken",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/site-configurations",method:"GET",headers:n,query:s},i);return new $d(o,a=>a.map(ol))}async getSiteNavigation(t,i){return await(await this.getSiteNavigationRaw(t,i)).value()}}const dl="http://localhost".replace(/\/+$/,"");class tn{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:dl}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||sn}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const ul=new tn;class mi{constructor(t=ul){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new hl(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?mi.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new pl(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;ml(r.body)||r.body instanceof URLSearchParams||ll(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}mi.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function ll(e){return typeof Blob<"u"&&e instanceof Blob}function ml(e){return typeof FormData<"u"&&e instanceof FormData}class pl extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class hl extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class te extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function R(e,t){return e[t]!=null}function sn(e,t=""){return Object.keys(e).map(i=>nn(i,e[i],t)).filter(i=>i.length>0).join("&")}function nn(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return nn(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?sn(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class De{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class vl{constructor(t){this.raw=t}async value(){return await this.raw.blob()}}function gl(e){if(e!==void 0)return e===null?null:{cancellationReason:e.cancellationReason}}function wl(e){return fl(e)}function fl(e,t){return e==null?e:{message:R(e,"message")?e.message:void 0}}function kl(e){return yl(e)}function yl(e,t){return e==null?e:{requestType:R(e,"request_type")?e.request_type:void 0,categories:R(e,"categories")?e.categories:void 0}}function Tl(e){return bl(e)}function bl(e,t){return e==null?e:{items:R(e,"items")?e.items.map(kl):void 0}}function an(e){return Rl(e)}function Rl(e,t){return e==null?e:{createdBy:R(e,"created_by")?e.created_by:void 0,createdAt:R(e,"created_at")?new Date(e.created_at):void 0,comment:R(e,"comment")?e.comment:void 0}}function Al(e){return _l(e)}function _l(e,t){return e==null?e:{comments:R(e,"comments")?e.comments.map(an):void 0}}function on(e){return Il(e)}function Il(e,t){return e==null?e:{id:R(e,"id")?e.id:void 0,fileName:R(e,"file_name")?e.file_name:void 0,fileSize:R(e,"file_size")?e.file_size:void 0,contentType:R(e,"content_type")?e.content_type:void 0,createdBy:R(e,"created_by")?e.created_by:void 0,createdAt:R(e,"created_at")?new Date(e.created_at):void 0}}function Sl(e){return Cl(e)}function Cl(e,t){return e==null?e:{attachments:R(e,"attachments")?e.attachments.map(on):void 0}}function Nl(e){if(e!==void 0)return e===null?null:{comment:e.comment}}function Pl(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,subject:e.subject,request_type:e.requestType,category:e.category,locations:e.locations,circuit_id:e.circuitId,customer_reference:e.customerReference,description:e.description,notification_recipients:e.notificationRecipients}}function Ii(e){return ql(e)}function ql(e,t){return e==null?e:{ticketNumber:R(e,"ticket_number")?e.ticket_number:void 0,accountNumber:R(e,"account_number")?e.account_number:void 0,accountName:R(e,"account_name")?e.account_name:void 0,id:R(e,"id")?e.id:void 0,status:R(e,"status")?e.status:void 0,cancellationReason:R(e,"cancellation_reason")?e.cancellation_reason:void 0,subject:R(e,"subject")?e.subject:void 0,requestType:R(e,"request_type")?e.request_type:void 0,category:R(e,"category")?e.category:void 0,site:R(e,"site")?e.site:void 0,locations:R(e,"locations")?e.locations:void 0,circuitId:R(e,"circuit_id")?e.circuit_id:void 0,customerReference:R(e,"customer_reference")?e.customer_reference:void 0,description:R(e,"description")?e.description:void 0,notificationRecipients:R(e,"notification_recipients")?e.notification_recipients:void 0,createdBy:R(e,"created_by")?e.created_by:void 0,createdAt:R(e,"created_at")?new Date(e.created_at):void 0,updatedAt:R(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:R(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0,comments:R(e,"comments")?e.comments.map(an):void 0}}function Dl(e){if(e!==void 0)return e===null?null:{subject:e.subject,description:e.description,circuit_id:e.circuitId,customer_reference:e.customerReference,other_notification_recipients:e.otherNotificationRecipients}}function Bl(e){return Ol(e)}function Ol(e,t){return e==null?e:{accountNumber:R(e,"account_number")?e.account_number:void 0,accountName:R(e,"account_name")?e.account_name:void 0,id:R(e,"id")?e.id:void 0,status:R(e,"status")?e.status:void 0,subject:R(e,"subject")?e.subject:void 0,site:R(e,"site")?e.site:void 0,locations:R(e,"locations")?e.locations:void 0,description:R(e,"description")?e.description:void 0,createdBy:R(e,"created_by")?e.created_by:void 0,createdAt:R(e,"created_at")?new Date(e.created_at):void 0,updatedAt:R(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:R(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0}}function $l(e){return El(e)}function El(e,t){return e==null?e:{items:R(e,"items")?e.items.map(Bl):void 0,totalCount:R(e,"total_count")?e.total_count:void 0,pageNumber:R(e,"page_number")?e.page_number:void 0,pageSize:R(e,"page_size")?e.page_size:void 0}}class xl extends mi{async cancellationTroubleTicketRequestRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new te("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling cancellationTroubleTicketRequest.");if(t.cancellationTicketsRequest===null||t.cancellationTicketsRequest===void 0)throw new te("cancellationTicketsRequest","Required parameter requestParameters.cancellationTicketsRequest was null or undefined when calling cancellationTroubleTicketRequest.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/trouble-tickets/{ticket_id}/cancel".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PUT",headers:n,query:s,body:gl(t.cancellationTicketsRequest)},i);return new De(o,a=>wl(a))}async cancellationTroubleTicketRequest(t,i){return await(await this.cancellationTroubleTicketRequestRaw(t,i)).value()}async createTroubleTicketAttachmentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new te("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createTroubleTicketAttachment.");if(t.fileName===null||t.fileName===void 0)throw new te("fileName","Required parameter requestParameters.fileName was null or undefined when calling createTroubleTicketAttachment.");if(t.body===null||t.body===void 0)throw new te("body","Required parameter requestParameters.body was null or undefined when calling createTroubleTicketAttachment.");const s={};t.fileName!==void 0&&(s.file_name=t.fileName);const n={};if(n["Content-Type"]="image/jpeg",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/trouble-tickets/{ticket_id}/attachments/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:t.body},i);return new De(o,a=>on(a))}async createTroubleTicketAttachment(t,i){return await(await this.createTroubleTicketAttachmentRaw(t,i)).value()}async createTroubleTicketCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new te("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createTroubleTicketComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new te("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createTroubleTicketComment.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/trouble-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:Nl(t.ticketCommentsRequest)},i);return new De(o,a=>Al(a))}async createTroubleTicketComment(t,i){return await(await this.createTroubleTicketCommentRaw(t,i)).value()}async createTroubleTicketTicketRaw(t,i){if(t.troubleTicketRequest===null||t.troubleTicketRequest===void 0)throw new te("troubleTicketRequest","Required parameter requestParameters.troubleTicketRequest was null or undefined when calling createTroubleTicketTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/trouble-tickets",method:"POST",headers:n,query:s,body:Pl(t.troubleTicketRequest)},i);return new De(o,a=>Ii(a))}async createTroubleTicketTicket(t,i){return await(await this.createTroubleTicketTicketRaw(t,i)).value()}async getTroubleTicketAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new te("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getTroubleTicketAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new te("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getTroubleTicketAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/trouble-tickets/{ticket_id}/attachments/file/{attachment_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new vl(o)}async getTroubleTicketAttachmentsById(t,i){return await(await this.getTroubleTicketAttachmentsByIdRaw(t,i)).value()}async getTroubleTicketAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new te("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getTroubleTicketAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/trouble-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new De(o,a=>Sl(a))}async getTroubleTicketAttachmentsList(t,i){return await(await this.getTroubleTicketAttachmentsListRaw(t,i)).value()}async getTroubleTicketTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new te("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getTroubleTicketTicketById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/trouble-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new De(o,a=>Ii(a))}async getTroubleTicketTicketById(t,i){return await(await this.getTroubleTicketTicketByIdRaw(t,i)).value()}async getTroubleTicketTicketsRaw(t,i){const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.status!==void 0&&(s.status=t.status),t.createdBy!==void 0&&(s.created_by=t.createdBy),t.sort!==void 0&&(s.sort=t.sort),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={},o=await this.request({path:"/trouble-tickets",method:"GET",headers:n,query:s},i);return new De(o,a=>$l(a))}async getTroubleTicketTickets(t={},i){return await(await this.getTroubleTicketTicketsRaw(t,i)).value()}async getTroubleTicketsCategoriesListRaw(t,i){if(t.site===null||t.site===void 0)throw new te("site","Required parameter requestParameters.site was null or undefined when calling getTroubleTicketsCategoriesList.");const s={};t.site!==void 0&&(s.site=t.site);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/trouble-tickets/categories",method:"GET",headers:n,query:s},i);return new De(o,a=>Tl(a))}async getTroubleTicketsCategoriesList(t,i){return await(await this.getTroubleTicketsCategoriesListRaw(t,i)).value()}async updateTroubleTicketTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new te("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateTroubleTicketTicket.");if(t.troubleTicketUpdateRequest===null||t.troubleTicketUpdateRequest===void 0)throw new te("troubleTicketUpdateRequest","Required parameter requestParameters.troubleTicketUpdateRequest was null or undefined when calling updateTroubleTicketTicket.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/trouble-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:Dl(t.troubleTicketUpdateRequest)},i);return new De(o,a=>Ii(a))}async updateTroubleTicketTicket(t,i){return await(await this.updateTroubleTicketTicketRaw(t,i)).value()}}function Fl(e){return Ll(e)}function Ll(e,t){return e==null?e:{id:e.id,name:e.name,isNonLocation:e.is_non_location,category:Js(e,"category")?e.category:void 0,privileges:e.privileges,isInternal:e.is_internal}}function Vl(e){return Ul(e)}function Ul(e,t){return e==null?e:{accountNumber:e.account_number,permissionName:e.permission_name,privilege:e.privilege,isNonLocation:Js(e,"is_non_location")?e.is_non_location:void 0,permissionIsInternal:e.permission_is_internal}}class Hl extends ui{async getPermissionsRaw(t){const i={},s={};this.configuration&&this.configuration.accessToken&&(s.Authorization=await this.configuration.accessToken("oAuth2",[]));const n=await this.request({path:"/permissions",method:"GET",headers:s,query:i},t);return new Zs(n,o=>o.map(Fl))}async getPermissions(t){return await(await this.getPermissionsRaw(t)).value()}async getUserPermissionsRaw(t,i){const s={};t.excludeSiblings!==void 0&&(s.exclude_siblings=t.excludeSiblings),t.excludeParents!==void 0&&(s.exclude_parents=t.excludeParents);const n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const o=await this.request({path:"/my-permissions",method:"GET",headers:n,query:s},i);return new Zs(o,a=>a.map(Vl))}async getUserPermissions(t={},i){return await(await this.getUserPermissionsRaw(t,i)).value()}}const z={CustomerCare:"sm-customer-care",DeliveriesRemovals:"sm-deliveries",References:"sm-references",RemoteHands:"sm-remote-hands",TroubleTickets:"sm-trouble-tickets",FacilityAccess:"sm-facility-access",ServiceTickets:"sm-service-tickets",SiteMaintenance:"sm-site-maintenance",Incidents:"sm-incidents",Inventory:"inventory",SiteNavigation:"site-navigations",UserManagement:"usermanagement"},F={Site:"Site",Floor:"Floor",Room:"Room",Cabinet:"Cabinet",Cage:"Cage"},U={Read:"Read",Update:"Update",Delete:"Delete",Create:"Create",Approve:"Approve"},zl={READ:1,UPDATE:2,DELETE:4,CREATE:8,APPROVE:16};var Si;(function(e){e.Security="Security",e.DCIM="DCIM",e.PlannedSiteMaintenance="Planned Site Maintenance"})(Si||(Si={}));const S={RemoteHands:"Remote Hands",TroubleTickets:"Trouble Ticket",DeliveriesRemovals:"Shipping & Receiving",VisitorAccess:"Visitor Access",CustomerCare:"Customer Support",PermanentBadge:"Permanent Badge",OSPAccess:"OSP Access",POPPOEAccess:"POP/POE Room Access",PlannedMaintenance:"Planned Site Maintenance"},jl={Duplicate:"Duplicate request",Error:"Request entered in error",NotNeeded:"Request no longer needed"},Ml={Delivery:"Delivery",Removal:"Removal",TroubleTicket:"Trouble Ticket",FacilityAccess:"Facility Access",RemoteHands:"Remote Hands",VisitorAccess:"Visitor Access",PermanentBadge:"Permanent Badge"},ut={GreaterThan:"gt:",GreaterOrEqual:"ge:",LessThan:"lt:",LessThanOrEqual:"le:"},Jl=10,Wl="permission_privilege";class Gl{constructor(t){this.configuration=t}get customerCareApi(){return new du(new Zi({basePath:`${this.configuration.SMApiUrl}/${z.CustomerCare}`,headers:{Authorization:this.getAuthorization()}}))}get courierCompaniesApi(){return new $a(new Et({basePath:`${this.configuration.SMApiUrl}/${z.DeliveriesRemovals}`,headers:{Authorization:this.getAuthorization()}}))}get deliveriesApi(){return new no(new Et({basePath:`${this.configuration.SMApiUrl}/${z.DeliveriesRemovals}`,headers:{Authorization:this.getAuthorization()}}))}get removalsApi(){return new ao(new Et({basePath:`${this.configuration.SMApiUrl}/${z.DeliveriesRemovals}`,headers:{Authorization:this.getAuthorization()}}))}get remoteHandsApi(){return new Ec(new As({basePath:`${this.configuration.SMApiUrl}/${z.RemoteHands}`,headers:{Authorization:this.getAuthorization()}}))}get troubleTicketsApi(){return new xl(new tn({basePath:`${this.configuration.SMApiUrl}/${z.TroubleTickets}`,headers:{Authorization:this.getAuthorization()}}))}get facilityAccessApi(){return{visitorAccess:new Wr(new pt({basePath:`${this.configuration.SMApiUrl}/${z.FacilityAccess}`,headers:{Authorization:this.getAuthorization()}})),visitorHost:new Gr(new pt({basePath:`${this.configuration.SMApiUrl}/${z.FacilityAccess}`,headers:{Authorization:this.getAuthorization()}})),permanentBadgeAccess:new Jr(new pt({basePath:`${this.configuration.SMApiUrl}/${z.FacilityAccess}`,headers:{Authorization:this.getAuthorization()}})),ospAccess:new jr(new pt({basePath:`${this.configuration.SMApiUrl}/${z.FacilityAccess}`,headers:{Authorization:this.getAuthorization()}})),popAccess:new Mr(new pt({basePath:`${this.configuration.SMApiUrl}/${z.FacilityAccess}`,headers:{Authorization:this.getAuthorization()}}))}}get serviceTicketApi(){return new Ou(new Xs({basePath:`${this.configuration.SMApiUrl}/${z.ServiceTickets}`,headers:{Authorization:this.getAuthorization()}}))}get inventoryApi(){return{locations:new ed(new Wt({basePath:`${this.configuration.SMApiUrl}/${z.Inventory}`,headers:{Authorization:this.getAuthorization()}})),sites:new Ps(new Wt({basePath:`${this.configuration.SMApiUrl}/${z.Inventory}`,headers:{Authorization:this.getAuthorization()}}))}}get sitesApi(){return new Ps(new Wt({basePath:`${this.configuration.SMApiUrl}/${z.Inventory}`,headers:{Authorization:this.getAuthorization()}}))}get siteNavigationApi(){return new cl(new Us({basePath:`${this.configuration.SMApiUrl}/${z.SiteNavigation}`,headers:{Authorization:this.getAuthorization()}}))}get plannedMaintenanceApi(){return new Yu(new qs({basePath:`${this.configuration.SMApiUrl}/${z.SiteMaintenance}`,headers:{Authorization:this.getAuthorization()}}))}get incidentsApi(){return new Cd(new $s({basePath:`${this.configuration.SMApiUrl}/${z.Incidents}`,headers:{Authorization:this.getAuthorization()}}))}get userPermissionsApi(){return new Hl(new Ms({basePath:`${this.configuration.SMApiUrl}/${z.UserManagement}`,headers:{Authorization:this.getAuthorization()}}))}getAuthorizationToken(){return this.getAuthorization()}get referencesApi(){return{categories:new gu(new Gt({basePath:`${this.configuration.SMApiUrl}/${z.References}`,headers:{Authorization:this.getAuthorization(),"cache-control":"no-cache"}})),requestTypeCategoryMappings:new wu(new Gt({basePath:`${this.configuration.SMApiUrl}/${z.References}`,headers:{Authorization:this.getAuthorization(),"cache-control":"no-cache"}})),terms:new ku(new Gt({basePath:`${this.configuration.SMApiUrl}/sm-references`,headers:{Authorization:this.getAuthorization(),"cache-control":"no-cache"}}))}}getAuthorization(){return this.configuration.getAuthorizationFn?this.configuration.getAuthorizationFn():""}}class Zl extends la{constructor(t,i){super({...t}),this.hashed_identifier=i}}class Kl{constructor(t,i){this.name=t,this.accountNumber=i}}class Qe{constructor({loginAuthority:t,clientId:i,scope:s,postLogoutRedirectUri:n,userStorageKey:o="user-authentication",redirectUrlKey:a="redirect-url",authPaths:r={authenticate:"authenticate",authCallback:"auth-callback",logout:"logout"}}){this.getHashedRootAccountNumberAndUserEmail=async()=>{const A=ot.getAccountHierarchy(),N=await Qe.hashValue(ot===null||ot===void 0?void 0:ot.email);let b=await Qe.hashValue(ot===null||ot===void 0?void 0:ot.account_number);return A&&(b=await Qe.hashValue(A==null?void 0:A.accountNumber)),`${b}-${N}`},this.configuration={loginAuthority:t,clientId:i,scope:s,postLogoutRedirectUri:n,userStorageKey:o,redirectUrlKey:a,authPaths:r};const{location:d}=window,u=`${d.protocol}//${d.hostname}${d.port?`:${d.port}`:""}`,p={authority:this.configuration.loginAuthority,client_id:this.configuration.clientId,redirect_uri:`${u}/${this.configuration.authPaths.authCallback}`,response_type:"code",scope:this.configuration.scope,post_logout_redirect_uri:this.configuration.postLogoutRedirectUri,loadUserInfo:!0};this.userManager=new ma(p)}isLoggedIn(){const t=this.getUser();if(t===null)return!1;if(!t.expires_at)return!0;const i=new Date,s=new Date(t.expires_at*1e3);return i<s}redirectToAuth(t=!1){const i=this.isAuthenticating();(t||!i)&&(i||localStorage.setItem(this.configuration.redirectUrlKey,window.location.href),rt.go(`/${this.configuration.authPaths.authenticate}`))}isAuthenticating(){const t=window.location.pathname.split("/");return t[t.length-1]===this.configuration.authPaths.authenticate?(this.userManager.signinRedirect(),!0):!1}isHandlingAuthCallback(){const t=window.location.pathname.split("/");return t[t.length-1]===this.configuration.authPaths.authCallback?(this.userManager.signinRedirectCallback().then(Qe.ensureValidUser).then(Qe.addHashedIdToUserProfile).then(i=>this.saveUser(i)).then(()=>this.authSuccessRedirect()).catch(()=>this.redirectToAuth()),!0):!1}authSuccessRedirect(){let t="/";const i=localStorage.getItem(this.configuration.redirectUrlKey);i&&(localStorage.removeItem(this.configuration.redirectUrlKey),t=i),rt.go(t)}redirectToLogout(){this.isHandlingLogout()||rt.go(`/${this.configuration.authPaths.logout}`)}isHandlingLogout(){const t=window.location.pathname.split("/");return t[t.length-1]===this.configuration.authPaths.logout?(this.clearUser(),window.localStorage.clear(),this.userManager.signoutRedirect({id_token_hint:this.getIdToken()}),!0):!1}isProcessing(){return this.isAuthenticating()||this.isHandlingAuthCallback()||this.isHandlingLogout()}saveUser(t){localStorage.setItem(this.configuration.userStorageKey,JSON.stringify(t))}clearUser(){localStorage.removeItem(this.configuration.userStorageKey)}getUser(){const t=localStorage.getItem(this.configuration.userStorageKey);return t?JSON.parse(t):null}getUserProfileSub(){var t;const i=this.getUser();return(t=i==null?void 0:i.profile)===null||t===void 0?void 0:t.sub}getUserLocale(){var t;const i=this.getUser();return(t=i==null?void 0:i.profile)===null||t===void 0?void 0:t.locale}getHashedIdentifer(){var t;return(t=this.getUser())===null||t===void 0?void 0:t.hashed_identifier}getIdToken(){var t;return(t=this.getUser())===null||t===void 0?void 0:t.id_token}getAccessToken(){var t;return(t=this.getUser())===null||t===void 0?void 0:t.access_token}getAuthorization(){var t,i;return`${(t=this.getUser())===null||t===void 0?void 0:t.token_type} ${(i=this.getUser())===null||i===void 0?void 0:i.access_token}`}getUserAccount(){var t,i,s,n;return new Kl((i=(t=this.getUser())===null||t===void 0?void 0:t.profile)===null||i===void 0?void 0:i.account_name,(n=(s=this.getUser())===null||s===void 0?void 0:s.profile)===null||n===void 0?void 0:n.account_number)}getUserEmail(){var t,i;return(i=(t=this.getUser())===null||t===void 0?void 0:t.profile)===null||i===void 0?void 0:i.email}getAccountNumber(){var t,i;return(i=(t=this.getUser())===null||t===void 0?void 0:t.profile)===null||i===void 0?void 0:i.account_number}static async hashValue(t){const i=new TextEncoder().encode(t),s=await crypto.subtle.digest("SHA-256",i);return Array.from(new Uint8Array(s)).map(n=>n.toString(16).padStart(2,"0")).join("")}static async addHashedIdToUserProfile(t){const i=`${t.profile.sub}-${t.profile.customer_id}`,s=await Qe.hashValue(i);return new Zl(t,s)}static ensureValidUser(t){if(!t.id_token)throw new Error("Missing property:id_token");return t}}function ke(){var e;const t=(e=window.gpConfig)===null||e===void 0?void 0:e["ui-service-management"];if(!t)throw new Error("ui-service-management config not loaded. Ensure config.json is fetched before app bootstrap.");return t}const Xt=ke(),ae=new Qe({loginAuthority:Xt.LoginAuthority,clientId:Xt.ServiceManagementUIClientId,scope:Xt.ServiceManagementUIScopes}),l=new Gl({SMApiUrl:Xt.SMApiUrl,getAuthorizationFn:()=>`Bearer ${ae.getAccessToken()}`}),rn="no instructions provided",Ci=" [Special Instructions] ",gt="Other",cn="Digital Realty",Yl="Interxion",dn=5;class Xl{constructor(){this.couriers={},this.sites=[],this.removalParties=[],this.requestTypeCategoriesDict={},this.termsLookup={[Q.Deliveries]:"",[Q.FacilityAccess]:"",[Q.TroubleTickets]:"",[Q.RemoteHands]:""},se(this),Je(this,{name:"lookups",properties:["couriers","sites","removalParties","requestTypeCategoriesDict","termsLookup"],storage:window.sessionStorage})}getCouriers(t,i){var s;const n=(s=this.couriers[t])!==null&&s!==void 0?s:[];return i?[...n,gt]:n}async fillCouriers(t,i,s){!t||!i||!s||this.couriers[s]||(this.couriers[s]=await l.courierCompaniesApi.getCourierBySite({accountNumber:i,site:t}))}async fillSites(){const t={pageSize:1e3};this.sites=await Gi(t,i=>l.inventoryApi.sites.getSites(i))}async getRemoteHandsCategories(t,i){const s=`RemoteHands-${t}-${i}`;if(this.requestTypeCategoriesDict[s])return this.requestTypeCategoriesDict[s];const n=await l.remoteHandsApi.getRemoteHandsCategoriesList({site:t,accountNumber:i});return!n.items||n.items.length===0?{}:(this.requestTypeCategoriesDict[s]=Object.fromEntries(n.items.filter(o=>{var a;return o.requestType&&((a=o.categories)===null||a===void 0?void 0:a.length)}).map(o=>[o.requestType,o.categories])),this.requestTypeCategoriesDict[s])}async getRequestCategories(t,i,s){const n=`${t}-${i}`;if(this.requestTypeCategoriesDict[n]&&!s)return this.requestTypeCategoriesDict[n];const o=(await l.referencesApi.requestTypeCategoryMappings.getRequestTypeCategoryMappings({serviceTicketType:i,serviceManagementSystem:t,siteCode:s})).filter(a=>{var r;return(r=a.categories)===null||r===void 0?void 0:r.some(d=>d.isActive)});return this.requestTypeCategoriesDict[n]=Object.fromEntries(o.map(a=>{var r;return[a.requestType,(r=a.categories)===null||r===void 0?void 0:r.filter(d=>d.isActive).map(d=>d.canonicalValue)]})),this.requestTypeCategoriesDict[n]}async fillRemovalParties(){this.removalParties=await l.removalsApi.getRemovalParties()}async fillLookups(){await Promise.all([this.fillRemovalParties(),this.fillTerms(),this.fillSites()])}async fillTerms(){const t=async i=>{await l.referencesApi.terms.getTerms({service:i}).then(s=>{this.termsLookup[i]=s})};await Promise.all([t(Q.Deliveries),t(Q.TroubleTickets),t(Q.RemoteHands),t(Q.FacilityAccess)])}clear(){this.couriers={},this.sites=[],this.removalParties=[],this.requestTypeCategoriesDict={},this.termsLookup={[Q.Deliveries]:"",[Q.FacilityAccess]:"",[Q.TroubleTickets]:"",[Q.RemoteHands]:""}}}const J=new Xl;function St(e){return new Date(e).toISOString().split("T")[0]}const un=()=>{var e;const t=localStorage.getItem("date-format");return t&&((e=JSON.parse(t))===null||e===void 0?void 0:e.preferredTimezone)||he.tz.guess()},Be=(e,t,i)=>{var s,n;if(!e||!t)return;const o=`${e} ${t}`,a=(n=(s=J.sites)===null||s===void 0?void 0:s.find(r=>r.id===i))===null||n===void 0?void 0:n.timeZone;return(a?he.tz(o,a):he.utc(o)).utc().toDate()};function Ql(e,t=un()){const i=he.tz(e,t).startOf("day").toDate(),s=he.tz(e,t).endOf("day").toDate();return{startOfDayLocal:i,endOfDayLocal:s}}const em=()=>he.utc().tz(un()).startOf("day").format("YYYY-MM-DD"),tm=(e,t)=>(t?he.tz(t):he.utc()).add(e,"days").format("YYYY-MM-DD"),Z=e=>{if(e)return new Date(e)},im=()=>{var e;const t=localStorage.getItem("date-format");return t&&((e=JSON.parse(t))===null||e===void 0?void 0:e.preferredDateFormat)||"yyyy-MM-dd"};St(new Date);const sm=bt`.header-container{display:flex;align-items:center;gap:20px}.header__title{margin:0;font-family:var(--root-secondary-font);font-style:normal;font-weight:700;font-size:34px;line-height:40px;letter-spacing:.35px;color:#092241;flex-grow:1}.header__profile{background-color:#092241;height:35px;border-radius:10px;color:#fff;padding-left:20px;padding-right:20px;display:flex;align-items:center;font-size:14px}.header__logout{height:35px;border-radius:10px;border:none;background-color:#1456e0;color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;padding-left:15px;padding-right:15px}.header__logout svg{width:1em;height:1em;font-size:20px;margin-right:5px}.header__accounts{width:200px;--md-outlined-field-top-space:5px;--md-outlined-field-bottom-space:5px}@media only screen and (min-width:5px) and (max-width:500px){.header-container{flex-direction:column}}@media only screen and (min-width:500px) and (max-width:1250px){.header-container{flex-direction:row}}`,L={ErrorRaised:"sm:error-raised",DrawerClose:"drawer-close",CreateTicket:"create-ticket",CancelTicket:"cancel-ticket",EditTicket:"edit-ticket",ApproveDenyTicket:"approve-deny-ticket"};class Oe{constructor(t,i,s){var n,o;this.id=t,this.siteId=i,this.accountNumber=s;const a=J.sites.find(r=>r.id===this.siteId);a?this.displayName=`${a==null?void 0:a.name} - ${a==null?void 0:a.streetAddress}`:this.displayName=(o=(n=this.id)!==null&&n!==void 0?n:this.siteId)!==null&&o!==void 0?o:""}}async function nm(e){if(!e)return"";const t=J.sites.find(i=>i.locationId===e);return t?`${t.name} - ${t.streetAddress}`:e}async function am(e){if(!e)return"";const t=J.sites.find(i=>i.id===e);return t?`${t.name} - ${t.streetAddress}`:e}async function om(e){const t=J.sites.find(i=>i.id===e);return t==null?void 0:t.locationId}const ln=(e,t,i)=>{e.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))},rm=e=>ln(document,L.ErrorRaised,e),m=async(e,t=!0)=>{let i="An error occurred";if(e instanceof Xi&&e.response.status===400)try{const{detail:s}=await e.response.json();i=s}catch(s){console.error(e)}else console.error(e);t&&rm(i)},cm=e=>{window.dispatchEvent(new CustomEvent("add-toast",{detail:{id:"error-toast",content:g`<ix-message-toast forceClose="false" toastId="error-toast" type="error">${e} </ix-message-toast>`,vertical:"bottom",horizontal:"center",animated:!0,above:!1}}))};class dm{constructor(){se(this),Je(this,{name:"locations",properties:[],storage:window.localStorage})}async getLocations(t,i){var s;let n=[],o={...t,sort:t.sort||"+id"};const a=r=>l.inventoryApi.locations.getLocations(r).catch(d=>{m(d,!1)});if(i!=null&&i.onlyLoadFirstPage){const r=await a(o);n=(s=r==null?void 0:r.items)!==null&&s!==void 0?s:[]}else n=await Gi(o,a);return n.sort((r,d)=>r.id.localeCompare(d.id))}async getOspsBySiteId(t){try{const i=await l.inventoryApi.sites.getOspsBySiteId({siteId:t});return i!=null?i:[]}catch(i){return[]}}async getPopsBySiteId(t){try{const i=await l.inventoryApi.sites.getPopsBySiteId({siteId:t});return i!=null?i:[]}catch(i){return[]}}}const le=new dm;class um{constructor(){this.isHideLocationDatesEnabled=()=>{const t=ke()["SM:HideLocationDates"];return typeof t=="boolean"?t:!1},this.showNewDatePickerComponent=()=>{const t=ke()["SM:UseNewDatePicker"];return typeof t=="boolean"?t:!1},this.isOspEnabled=()=>{const t=ke()["SM:ShowOspAccess"];return typeof t=="boolean"?t:!1},this.isPopPoeEnabled=()=>{const t=ke()["SM:ShowPopPoeAccess"];return typeof t=="boolean"?t:!1},this.isIncidentsEnabled=()=>{const t=ke()["SM:IncidentsEnabled"];return typeof t=="boolean"?t:!1},this.isCustomerCarePopWhitelistEnabled=()=>{const t=ke()["SM:CustomerCarePopWhitelistEnabled"];return typeof t=="boolean"?t:!1},this.customerCarePopWhitelist=()=>{const t=ke()["SM:CustomerCarePopWhitelist"];return typeof t=="string"?t:""}}}const wt=new um,Ct=`${F.Floor},${F.Room},${F.Cabinet},${F.Cage}`;function mn(e){return e===S.VisitorAccess||e===S.PermanentBadge}function lm(e){return e===S.RemoteHands||e===S.TroubleTickets||e===S.VisitorAccess||e===S.PermanentBadge||e===S.CustomerCare||e===S.OSPAccess||e===S.POPPOEAccess}async function Ze(e){var t;const i=await le.getLocations({...e,pageSize:100});return(t=[...new Map(i.map(s=>[s.siteId,s])).values()].map(s=>new Oe(void 0,s.siteId,s.accountNumber)))!==null&&t!==void 0?t:[]}async function mm(e,t,i,s){let n=[];const o=lm(t);let a=ut.GreaterThan+F.Site;o?mn(t)&&(a=Ct):a=F.Site;let r=await le.getLocations({locationType:a,permissionType:t,permissionPrivilege:e,pageSize:100,accountNumber:s,assignableProcess:i});return o?(r=[...new Map(r.map(d=>[d.siteId,d])).values()],n=r.map(d=>new Oe(d.siteId,d.siteId,d.accountNumber))):n=r.map(d=>new Oe(d.id,d.siteId,d.accountNumber)),n!=null?n:[]}async function pm(e,t){const i=await le.getLocations({locationType:F.Site,permissionType:t,permissionPrivilege:e,pageSize:100}),s=[...new Set(i.map(n=>n.accountNumber))];return s!=null?s:[]}async function hm(e,t,i,s,n){let o=ut.GreaterThan+F.Site;return mn(t)&&(o=Ct),await le.getLocations({permissionType:t,locationType:o,permissionPrivilege:e,siteId:s,pageSize:100,accountNumber:n,assignableProcess:i})}async function Nt(e,t,i,s){const n=await le.getLocations({permissionType:t,permissionPrivilege:e,id:i,accountNumber:s,pageSize:1},{onlyLoadFirstPage:!0});return(n==null?void 0:n.length)>0}async function $e(e,t,i,s){return(await le.getLocations({permissionPrivilege:t,pageSize:1,permissionType:e,assignableProcess:i,locationType:s},{onlyLoadFirstPage:!0})).length>0}async function Ke(e,t,i){return(await le.getLocations({permissionPrivilege:i,pageSize:100,permissionType:t})).some(s=>e.includes(s.id))}async function pn(e){var t;if(!e)return;const i=await le.getLocations({id:e,pageSize:1},{onlyLoadFirstPage:!0});return(t=i==null?void 0:i[0])===null||t===void 0?void 0:t.siteId}async function vm(e){var t;if(!e)return;const i=await le.getLocations({siteId:e,locationType:F.Site,pageSize:1},{onlyLoadFirstPage:!0});return(t=i==null?void 0:i[0])===null||t===void 0?void 0:t.id}async function hn(){return $e(S.CustomerCare,U.Create,void 0,F.Site)}async function vn(){return $e(S.VisitorAccess,U.Create,void 0,F.Site)}async function gn(){return $e(S.PermanentBadge,U.Create,void 0,F.Site)}async function wn(){return wt.isOspEnabled()?$e(S.OSPAccess,U.Create,void 0,F.Site):!1}async function fn(){return wt.isPopPoeEnabled()?$e(S.POPPOEAccess,U.Create,void 0,F.Site):!1}async function gm(){return $e(S.DeliveriesRemovals,U.Create)}async function kn(){return(await Promise.all([vn(),gn(),wn(),fn()])).some(e=>e)}async function yn(){return $e(S.RemoteHands,U.Create,void 0,F.Site)}async function Ni(){return gm()}function Tn(){return $e(S.TroubleTickets,U.Create,void 0,F.Site)}async function wm(){return(await Promise.all([hn(),kn(),yn(),Ni(),Tn()])).some(e=>e)}function fm(e){switch(e){case"Visitor Access":return S.VisitorAccess;case"Permanent Badge":return S.PermanentBadge;case"OSP Access":return S.OSPAccess;case"PoP/POE Access":return S.POPPOEAccess;default:return}}async function bn(e){if(e===void 0)return!1;const t=await pn(e);return t?(await le.getLocations({siteId:t,permissionType:S.OSPAccess,locationType:ut.GreaterOrEqual+F.Site,permissionPrivilege:U.Update,pageSize:100,assignableProcess:"OSP_access"})).some(i=>i.siteId===t):!1}async function Rn(e){if(e===void 0)return!1;const t=await pn(e);return t?(await le.getLocations({siteId:t,permissionType:S.POPPOEAccess,locationType:ut.GreaterOrEqual+F.Site,permissionPrivilege:U.Update,pageSize:100,assignableProcess:"POP_access"})).some(i=>i.siteId===t):!1}async function An(e){return le.getOspsBySiteId(e)}async function _n(e){return le.getPopsBySiteId(e)}let Pi=class extends Rt{constructor(){super(...arguments),this.hasCreatePermission=!1}dispatchCreateTicketEvent(){const e=new CustomEvent(L.CreateTicket,{bubbles:!0,composed:!0});this.dispatchEvent(e)}async firstUpdated(){this.hasCreatePermission=await wm()}render(){return this.hasCreatePermission?g` <ix-button @click="${this.dispatchCreateTicketEvent}" has-icon> <md-icon slot="icon">add</md-icon> <span class="uppercase font-bold tracking-wider">Create Ticket</span> </ix-button>`:P}};E([we()],Pi.prototype,"hasCreatePermission",void 0),Pi=E([X("sm-create-service-ticket-button")],Pi);let Ie=null;function In(){const{pathname:e,search:t,hash:i}=window.location;rt.go({pathname:e,search:t,hash:i})}function km(e,t,i){const s=i.map(n=>({...n,path:`${t}${n.path}`,redirect:n.redirect?`${t}${n.redirect}`:null}));s.push({name:W.ServiceTickets,path:t||"/",component:"service-tickets-view",headerRight:g`<sm-create-service-ticket-button></sm-create-service-ticket-button>`,action:()=>{import("./ui-service-management2.js")}}),s.push({path:"(.*)",component:"service-tickets-view",action:()=>{import("./ui-service-management2.js")}}),Ie=new rt(e),Ie.setRoutes(s),window.addEventListener("shell-after-navigate",In)}function ym(){return Ie}function Tm(){Ie==null||Ie.unsubscribe(),Ie==null||Ie.removeRoutes(),Ie=null,window.removeEventListener("shell-after-navigate",In)}function Qt(e,t){return Ie&&Ie.urlForName(e,t)}function bm(e,t){const i=Qt(e);i&&rt.go({pathname:i,hash:t})}let qi=class extends Rt{constructor(){super(...arguments),this.routeName=null}return(){this.routeName&&bm(this.routeName),window.history.back()}render(){return g` <ix-button appearance="text" has-icon @click="${this.return}"> <md-icon slot="icon">arrow_back</md-icon> <span class="uppercase font-bold tracking-wider">Back</span> </ix-button>`}};E([we({type:String})],qi.prototype,"routeName",void 0),qi=E([X("sm-back-button")],qi);const Rm="Other parties to notify",Am="Result",Ye="CANCEL TICKET",_m="REQUEST CANCELLATION",Ee="EDIT TICKET",Im="Sites & Locations",Sm="Sites, Locations & Hosts",Cm="Trouble Ticket is not supported for this site.",Nm="We are unable to process your request. Please, try again or reach out to us for further assistance. We apologize for the inconvenience. Your Digital Realty Team.",Pm="Please be advised that your company has been restricted from submitting a new Delivery request for this location until all existing packages have been retrieved.",qm="We're unable to process your request at the moment. Please reach out to Customer Care for assistance.",Dm="Unable to process request. Contact Customer Care.",Bm='For POP/POE Room Access, please submit your request via the Customer Care form using the "Building" request type and "POP/POE Room Access" category.',Om="Important Note: Selecting a location is required to submit this ticket. If your specific POP/POE location is missing from the dropdown, please select any available location to complete your request for Room Access.";var O;(function(e){e.Announced="Announced",e.Cancelled="Cancelled",e.Completed="Completed",e.Draft="Draft",e.InProgress="In Progress",e.New="New",e.Expired="Expired"})(O||(O={}));var ei;(function(e){e.CancellationRequested="Cancellation requested"})(ei||(ei={}));var ft;(function(e){e.Approved="Approved",e.PendingPickup="Pending Pick-up",e.Rejected="Rejected"})(ft||(ft={}));var oe;(function(e){e.Approved="Approved",e.PendingApproval="Pending Approval",e.ApprovalDenied="Approval Denied"})(oe||(oe={}));const $m=[O.Cancelled,O.Completed,O.Expired,ft.Rejected,oe.ApprovalDenied],Em=[O.New,O.InProgress,O.Announced,ft.PendingPickup,ft.Approved,ei.CancellationRequested,oe.PendingApproval];var Di;(function(e){e.Resolved="Resolved",e.InProgress="In Progress",e.New="New",e.Closed="Closed",e.Cancelled="Cancelled"})(Di||(Di={}));class xm{constructor(){se(this)}async getServiceBackend(t,i,s){var n;i=i==null?void 0:i.split(".").pop();let o={accountNumber:t,site:i};const a=await l.siteNavigationApi.getSiteNavigation(o).catch(r=>{m(r,!1)});switch((n=a==null?void 0:a.find(r=>r.process===s))===null||n===void 0?void 0:n.serviceManagementSystem){case Yt.InSite:return H.Insite;case Yt.ServiceNow:return H.ServiceNow;case Yt.TelxSfdc:return s==="Facilities_access"?H.Insite:H.TelxSFDC;default:return}}}const K=new xm;var lt;(function(e){e.Kilograms="kilograms",e.Pounds="pounds"})(lt||(lt={}));function Sn(e){return typeof e=="string"&&e.trim().length>0}function Fm(e,t){return e.split(t).map(i=>i.trim().toLowerCase()).filter(i=>i.length>0)}const Cn=e=>/^(([^<>()[\]\\.,;:\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,}))$/.test(e);function Lm(e){return/^[a-zA-Z0-9]+$/.test(e)}function Vm(e){return/^[a-zA-Z0-9 ]+$/.test(e)}function Um(e){return/^[a-zA-Z0-9.' ]+$/.test(e)}function Hm(e){const t=he(e,"YYYY-MM-DD"),i=he().add(24,"hours").startOf("day");return t.isSameOrAfter(i)}function zm(e,t){const i=t?he.tz(t):he.utc(),[s,n]=e.split(":").map(o=>parseInt(o,10));return s>i.hours()||s===i.hours()&&n>i.minutes()}function Nn(e){return Sn(e)?/^(0|[1-9]\d*)$/.test(e):!1}const Pn=(e,t)=>{let i;return t===H.ServiceNow&&(i=e.weight,e.overweight&&(e.isHistorical||(i=`${e.weight} ${e.weightUnit}`))),{trackingNumber:e.trackingNumber,numberOfPackages:e.numberOfPackages,sizeWhenOversized:e.dimensions,weightWhenOverweight:i,courierCompany:e.courier===gt?e.otherCompany:e.courier}},qn=(e,t=!1)=>{var i,s,n,o,a;const r=e.serviceBackend!==H.ServiceNow?e.shortDescription+Ci+(e.instructions||rn):e.shortDescription,d={accountNumber:(i=e.site)===null||i===void 0?void 0:i.accountNumber,subject:(s=e.subject)!==null&&s!==void 0?s:"",description:r,etaFrom:Z(e.estimatedDate)||null,etaTo:Z(e.latestDate)||null,customerReference:e.referenceNumber,site:(o=(n=e.site)===null||n===void 0?void 0:n.id)!==null&&o!==void 0?o:"",otherNotificationRecipients:e.contacts,remoteHandsRequired:e.needRemoteHands};return(e==null?void 0:e.serviceBackend)!==H.TelxSFDC&&(d.loadingBayRequired=e.isLoadingBayRequired),t||(d.packages=(a=e.packages)===null||a===void 0?void 0:a.map(u=>Pn(u,e.serviceBackend))),d};function jm(e,t){const i=new Date;return t&&i.setDate(i.getDate()+e),St(i)}function Mm(e){const t=new Date;return t.setDate(t.getDate()+e),St(t)}const Dn=async(e,t,i)=>{if(!e||!t||!i)return[e];if(await K.getServiceBackend(t,i,"Deliveries")!==H.ServiceNow){const s=e.lastIndexOf(Ci);return s===-1?[e]:e.endsWith(rn)?[e.substring(0,s)]:[e.substring(0,s),e.substring(s+Ci.length)]}return[e]},Jm=e=>{if(!e)return[void 0,void 0];const t=e.split(" ");if(t.length!==2)return[e,void 0];const[i,s]=t;let n;if(s.toLowerCase()===lt.Kilograms)n=lt.Kilograms;else if(s.toLowerCase()===lt.Pounds)n=lt.Pounds;else return[e,void 0];return Nn(i)?[i,n]:[e,void 0]},Bn=async(e,t,i,s)=>{if(!e)return[];await J.fillCouriers(t,i,s);const n=J.getCouriers(s);return e.map(o=>{const a=n==null?void 0:n.find(N=>{var b;return N.toLowerCase()===((b=o.courierCompany)===null||b===void 0?void 0:b.toLowerCase())}),r=!!a,d=!!o.weightWhenOverweight;let u="",p;if(d){const[N,b]=Jm(o.weightWhenOverweight);u=N!=null?N:"",p=b}let A=!1;return d&&(A=!p||u.length>dn),{id:o.id||"",trackingNumber:o.trackingNumber,numberOfPackages:o.numberOfPackages||0,dimensions:o.sizeWhenOversized,overweight:d,oversized:!!o.sizeWhenOversized,weight:A?o.weightWhenOverweight:u,weightUnit:A?void 0:p,courier:r?a:gt,otherCompany:r?"":o.courierCompany,isHistorical:A}})},On=async e=>{var t,i,s,n,o,a;if(!e)return;const[r,d]=await Dn(e.description,e.accountNumber,e.site),u=await K.getServiceBackend(e.accountNumber,e.site,"Deliveries"),p=await Bn(e.packages,e.site,e.accountNumber,u);return{id:e.id,accountName:e.accountName,accountNumber:e.accountNumber,subject:e.subject,shortDescription:r,instructions:d,estimatedDate:(t=e.etaFrom)===null||t===void 0?void 0:t.toISOString().split("T")[0],latestDate:(i=e.etaTo)===null||i===void 0?void 0:i.toISOString().split("T")[0],referenceNumber:e.customerReference,site:e.site,cancellationReason:e.cancellationReason,contacts:e.otherNotificationRecipients,state:e.status,requester:e.createdBy,createdOn:(s=e.createdAt)===null||s===void 0?void 0:s.toISOString(),updatedOn:(n=e.updatedAt)===null||n===void 0?void 0:n.toISOString(),isLoadingBayRequired:e.loadingBayRequired,needRemoteHands:(o=e.remoteHandsRequired)!==null&&o!==void 0?o:!1,packages:p,comments:(a=e.comments)===null||a===void 0?void 0:a.map(A=>M(A)),serviceBackend:u}},Wm=async e=>{var t,i,s;if(!e)return;const[n,o]=await Dn(e.description,e.accountNumber,e.site),a=await K.getServiceBackend(e.accountNumber,e.site,"Deliveries"),r=await Bn(e.packages,e.site,e.accountNumber,a),d=J.sites.find(u=>u.id===e.site).locationId;return{id:e.id||"",accountNumber:e.accountNumber||"",subject:e.subject,shortDescription:n,instructions:o,estimatedDate:(t=e.etaFrom)===null||t===void 0?void 0:t.toISOString(),latestDate:(i=e.etaTo)===null||i===void 0?void 0:i.toISOString(),referenceNumber:e.customerReference,site:new Oe(d,e.site,e.accountNumber),contacts:e.otherNotificationRecipients,isLoadingBayRequired:e.loadingBayRequired,serviceBackend:a,isValid:!0,needRemoteHands:(s=e.remoteHandsRequired)!==null&&s!==void 0?s:!1,packages:r}},Gm=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}}),$n=e=>e.requestType===wi.PlannedWork&&e.serviceBackend===H.ServiceNow,Zm=e=>{var t,i;return $n(e)&&(i=Be(e.startDate,e.startTime,(t=e.site)===null||t===void 0?void 0:t.siteId))!==null&&i!==void 0?i:null},En=async e=>{var t,i;if(!e.expectedStart)return{startDate:"",startTime:"",startDateTime:""};const s=(i=(t=J.sites)===null||t===void 0?void 0:t.find(o=>o.locationId===e.site))===null||i===void 0?void 0:i.timeZone,n=s?G(e.expectedStart).tz(s):G(e.expectedStart);return{startDate:n.format("YYYY-MM-DD"),startTime:n.format("HH:mm"),startDateTime:n.format("YYYY-MM-DDTHH:mm")}},Km=e=>{var t,i,s,n,o;return{accountNumber:(t=e.accountNumber)!==null&&t!==void 0?t:"",requestType:(i=e.requestType)!==null&&i!==void 0?i:"",category:(s=e.category)!==null&&s!==void 0?s:"",subject:(n=e.subject)!==null&&n!==void 0?n:"",description:e.description,expectedStart:Zm(e),customerReference:e.referenceNumber,locations:!((o=e.location)===null||o===void 0)&&o.id?[e.location.id]:[],referenceTicket:e.referenceTicketNumber,otherNotificationRecipients:e.contacts}},Ym=e=>({customerReference:e.referenceNumber,otherNotificationRecipients:e.contacts}),xn=async e=>{var t,i,s,n,o;if(!e)return;const{startDate:a,startTime:r}=await En(e);return{id:e.ticketId,accountName:e.accountName,accountNumber:e.accountNumber,category:e.category,subject:e.subject,shortDescription:e.description,startDate:a,startTime:r,referenceNumber:e.customerReference,contacts:e.otherNotificationRecipients,state:e.status,site:e.site,locations:(i=(t=e.locations)===null||t===void 0?void 0:t.join(", "))!==null&&i!==void 0?i:"",requester:e.createdBy,requestType:e.requestType,referenceTicketNumber:e.referenceTicket,createdAt:(s=e.createdAt)===null||s===void 0?void 0:s.toISOString(),updatedAt:(n=e.updatedAt)===null||n===void 0?void 0:n.toISOString(),cancellationReason:e.cancellationReason,comments:(o=e.comments)===null||o===void 0?void 0:o.map(d=>M(d)),serviceBackend:await K.getServiceBackend(e.accountNumber,e.site,"Remote_hands"),ticketStatus:e.status||""}},Xm=async e=>{var t,i,s,n;if(!e)return;const{startDate:o,startTime:a,startDateTime:r}=await En(e);return{id:e.ticketId||"",accountName:e.accountName,accountNumber:e.accountNumber||"",category:e.category,subject:e.subject,description:e.description,shortDescription:(i=(t=e.description)===null||t===void 0?void 0:t.split("-")[0])===null||i===void 0?void 0:i.trim(),startDate:o,startTime:a,startDateTime:r,referenceNumber:e.customerReference,contacts:e.otherNotificationRecipients,state:e.status,site:{id:e.site},location:{id:e.locations[0],accountNumber:e.accountNumber},requester:e.createdBy,requestType:e.requestType,referenceTicketNumber:e.referenceTicket,createdOn:(s=e.createdAt)===null||s===void 0?void 0:s.toISOString(),updatedOn:(n=e.updatedAt)===null||n===void 0?void 0:n.toISOString(),ticketStatus:e.status||"",serviceBackend:await K.getServiceBackend(e.accountNumber,e.site,"Remote_hands")}},Qm=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}}),Bi=(e,t)=>{if(e===gt)return!0;const i=J.getCouriers(t).map(s=>s.toLowerCase());return!!e&&!(i!=null&&i.includes(e.toLowerCase()))},Fn=e=>e===cn,ep=e=>G().add({days:e}).format(ct),tp=(e,t)=>G(t).add({days:e}).format(ct),ip=e=>!!e&&G(e).isBefore(G().add({days:1}),"day"),sp=e=>!!e&&G(e).isBefore(G(),"day"),np=e=>{var t,i,s,n,o,a;const r=(t=Bi(e.courier,e.serviceBackend)?e.otherCompany:e.courier)!==null&&t!==void 0?t:"";return{accountNumber:(i=e.site)===null||i===void 0?void 0:i.accountNumber,subject:(s=e.subject)!==null&&s!==void 0?s:"",description:e.shortDescription,customerReference:e.referenceNumber,removalParty:(n=e.removalParty)!==null&&n!==void 0?n:"",courierCompany:r,trackingNumber:e.trackingNumber,pickupDate:Z(e.pickupDate),site:(a=(o=e.site)===null||o===void 0?void 0:o.id)!==null&&a!==void 0?a:"",otherNotificationRecipients:e.contacts}},ap=e=>{var t;const i=(t=Bi(e.courier,e.serviceBackend)?e.otherCompany:e.courier)!==null&&t!==void 0?t:"";return{subject:e.subject,description:e.shortDescription,customerReference:e.referenceNumber,courierCompany:i,trackingNumber:e.trackingNumber,pickupDate:Z(e.pickupDate),otherNotificationRecipients:e.contacts}},Ln=async(e,t,i,s)=>{await J.fillCouriers(t,i,s);const n=J.getCouriers(s).find(a=>a.toLowerCase()===(e==null?void 0:e.toLowerCase())),o=!!n;return{courier:o?n:gt,otherCompany:o?"":e}},Vn=e=>e===Yl?cn:e;async function op(e){if(!e)return;const t=await K.getServiceBackend(e.accountNumber,e.site,"Removals"),{courier:i,otherCompany:s}=await Ln(e.courierCompany,e.site,e.accountNumber,t),n=Vn(e.removalParty),o=J.sites.find(a=>a.id===e.site).locationId;return{id:e.id,accountNumber:e.accountNumber,site:new Oe(o,e.site,e.accountNumber),subject:e.subject,shortDescription:e.description,courier:i,otherCompany:s,removalParty:n,trackingNumber:e.trackingNumber,pickupDate:e.pickupDate,referenceNumber:e.customerReference,contacts:e.otherNotificationRecipients,status:e.status,isValid:!0,serviceBackend:await K.getServiceBackend(e.accountNumber,e.site,"Removals")}}const rp=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}}),Un=async e=>{var t,i,s;if(!e)return;const n=await K.getServiceBackend(e.accountNumber,e.site,"Removals"),{courier:o,otherCompany:a}=await Ln(e.courierCompany,e.site,e.accountNumber,n),r=Vn(e.removalParty);return{id:e.id,accountName:e.accountName,accountNumber:e.accountNumber,status:e.status,subject:e.subject,shortDescription:e.description,referenceNumber:e.customerReference,removalParty:r,needRemoteHands:Fn(r),courier:o,otherCompany:a,trackingNumber:e.trackingNumber,pickupDate:e.pickupDate,site:e.site,serviceBackend:n,contacts:e.otherNotificationRecipients,requester:e.createdBy,createdOn:(t=e.createdAt)===null||t===void 0?void 0:t.toISOString(),updatedOn:(i=e.updatedAt)===null||i===void 0?void 0:i.toISOString(),cancellationReason:e.cancellationReason,comments:(s=e.comments)===null||s===void 0?void 0:s.map(d=>M(d))}},cp=e=>{var t,i,s,n,o,a,r,d;return{accountNumber:(t=e.accountNumber)!==null&&t!==void 0?t:"",requestType:(i=e.requestType)!==null&&i!==void 0?i:"",category:(s=e.category)!==null&&s!==void 0?s:"",subject:(n=e.subject)!==null&&n!==void 0?n:"",description:(o=e.description)!==null&&o!==void 0?o:"",locations:e.locations,customerReference:(a=e.referenceNumber)!==null&&a!==void 0?a:"",circuitId:(r=e.circuitId)!==null&&r!==void 0?r:"",notificationRecipients:(d=e.contacts)!==null&&d!==void 0?d:""}},dp=e=>{const t={};return e.subject&&(t.subject=e.subject),e.description&&(t.description=e.description),e.circuitId&&(t.circuitId=e.circuitId),e.referenceNumber&&(t.customerReference=e.referenceNumber),e.contacts&&(t.otherNotificationRecipients=e.contacts),t},Oi=async e=>{var t,i,s,n;if(e)return{id:e.id,accountName:e.accountName,accountNumber:e.accountNumber,category:e.category,subject:e.subject,description:e.description,referenceNumber:e.customerReference,contacts:e.notificationRecipients,state:e.status,site:{id:e.site,accountNumber:e.accountNumber},locations:e.locations,requester:e.createdBy,requestType:e.requestType,circuitId:e.circuitId,createdOn:(t=e.createdAt)===null||t===void 0?void 0:t.toISOString(),updatedOn:(i=e.updatedAt)===null||i===void 0?void 0:i.toISOString(),closedOn:(s=e.closedAt)===null||s===void 0?void 0:s.toISOString(),comments:(n=e.comments)===null||n===void 0?void 0:n.map(o=>M(o)),cancellationReason:e.cancellationReason,serviceBackend:await K.getServiceBackend(e.accountNumber,e.site,"Trouble_tickets")}},up=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}});async function Pt(e,t,i,s,n,o){var a;let r;switch(e){case y.CustomerSupport:{r=await l.customerCareApi.createCustomerCareTicketAttachment({ticketId:n,fileName:i,body:t},{headers:{"Content-Type":s,Authorization:l.getAuthorizationToken()}}).catch(d=>{throw m(d,!1),d});break}case y.RemoteHands:{r=await l.remoteHandsApi.createRemoteHandsAttachment({ticketId:n,fileName:i,body:t},{headers:{"Content-Type":s,Authorization:l.getAuthorizationToken()}}).catch(d=>{throw m(d,!1),d});break}case y.Deliveries:{r=await l.deliveriesApi.createAttachment({ticketId:n,fileName:i,body:t},{headers:{"Content-Type":s,Authorization:l.getAuthorizationToken()}}).catch(d=>{throw m(d,!1),d});break}case y.Removals:{r=await l.removalsApi.createRemovalsAttachment({ticketId:n,fileName:i,body:t},{headers:{"Content-Type":s,Authorization:l.getAuthorizationToken()}}).catch(d=>{throw m(d,!1),d});break}case y.FacilityAccess:{switch(o){case"Visitor Access":r=await l.facilityAccessApi.visitorAccess.createVisitorAccessAttachment({ticketId:n,fileName:i,body:t},{headers:{"Content-Type":s,Authorization:l.getAuthorizationToken()}}).catch(d=>{throw m(d,!1),d});break;case"Permanent Badge":r=await((a=l.facilityAccessApi.permanentBadgeAccess)===null||a===void 0?void 0:a.createPermanentBadegeAttachment({ticketId:n,fileName:i,body:t},{headers:{"Content-Type":s,Authorization:l.getAuthorizationToken()}}).catch(d=>{throw m(d,!1),d}));break;case"OSP Access":r=await l.facilityAccessApi.ospAccess.createOspAccessAttachment({ticketId:n,fileName:i,body:t},{headers:{"Content-Type":s,Authorization:l.getAuthorizationToken()}}).catch(d=>{throw m(d,!1),d});break;case"PoP/POE Access":r=await l.facilityAccessApi.popAccess.createPopAccessAttachment({ticketId:n,fileName:i,body:t},{headers:{"Content-Type":s,Authorization:l.getAuthorizationToken()}}).catch(d=>{throw m(d,!1),d});break}break}case y.TroubleTickets:{r=await l.troubleTicketsApi.createTroubleTicketAttachment({ticketId:n,fileName:i,body:t},{headers:{"Content-Type":s,Authorization:l.getAuthorizationToken()}}).catch(d=>{throw m(d,!1),d});break}default:return}return r}const xe=e=>{const t=URL.createObjectURL(e);window.open(t),setTimeout(()=>URL.revokeObjectURL(t),1e3*60*5)};async function lp(e,t,i,s){var n;let o;try{switch(e){case y.CustomerSupport:{o=await l.customerCareApi.getCustomerCareTicketAttachmentsById({ticketId:i,attachmentId:t!=null?t:""}),xe(o);break}case y.RemoteHands:{o=await l.remoteHandsApi.getRemoteHandsAttachmentsById({ticketId:i,attachmentId:t!=null?t:""}),xe(o);break}case y.Deliveries:{o=await l.deliveriesApi.getDeliveryAttachmentsById({ticketId:i,attachmentId:t!=null?t:""}),xe(o);break}case y.Removals:{o=await l.removalsApi.getRemovalsAttachmentsById({ticketId:i,attachmentId:t!=null?t:""}),xe(o);break}case y.TroubleTickets:{o=await l.troubleTicketsApi.getTroubleTicketAttachmentsById({ticketId:i,attachmentId:t!=null?t:""}),xe(o);break}case y.FacilityAccess:{switch(s){case"Visitor Access":o=await l.facilityAccessApi.visitorAccess.getVisitorAccessAttachmentsById({ticketId:i,attachmentId:t}),xe(o);break;case"Permanent Badge":o=await((n=l.facilityAccessApi.permanentBadgeAccess)===null||n===void 0?void 0:n.getPermanentBadgeAttachmentsById({ticketId:i,attachmentId:t})),xe(o);break;case"OSP Access":o=await l.facilityAccessApi.ospAccess.getOspAccessAttachmentsById({ticketId:i,attachmentId:t}),xe(o);break;case"PoP/POE Access":o=await l.facilityAccessApi.popAccess.getPopAccessAttachmentsById({ticketId:i,attachmentId:t}),xe(o);break;default:break}break}default:return}}catch(a){console.error("error",a),m(a,!1)}return o}const Fe=(e,t)=>{const i=URL.createObjectURL(e),s=document.createElement("a");s.href=i,s.download=t,document.body.appendChild(s),s.click(),URL.revokeObjectURL(i)};async function mp(e,t,i,s,n){var o;let a;try{switch(e){case y.CustomerSupport:{a=await l.customerCareApi.getCustomerCareTicketAttachmentsById({ticketId:s,attachmentId:t!=null?t:""}),Fe(a,i);break}case y.RemoteHands:{a=await l.remoteHandsApi.getRemoteHandsAttachmentsById({ticketId:s,attachmentId:t!=null?t:""}),Fe(a,i);break}case y.Deliveries:{a=await l.deliveriesApi.getDeliveryAttachmentsById({ticketId:s,attachmentId:t!=null?t:""}),Fe(a,i);break}case y.Removals:{a=await l.removalsApi.getRemovalsAttachmentsById({ticketId:s,attachmentId:t!=null?t:""}),Fe(a,i);break}case y.TroubleTickets:{a=await l.troubleTicketsApi.getTroubleTicketAttachmentsById({ticketId:s,attachmentId:t!=null?t:""}),Fe(a,i);break}case y.FacilityAccess:{switch(n){case"Visitor Access":a=await l.facilityAccessApi.visitorAccess.getVisitorAccessAttachmentsById({ticketId:s,attachmentId:t}),Fe(a,i);break;case"Permanent Badge":a=await((o=l.facilityAccessApi.permanentBadgeAccess)===null||o===void 0?void 0:o.getPermanentBadgeAttachmentsById({ticketId:s,attachmentId:t})),Fe(a,i);break;case"OSP Access":a=await l.facilityAccessApi.ospAccess.getOspAccessAttachmentsById({ticketId:s,attachmentId:t}),Fe(a,i);break;case"PoP/POE Access":a=await l.facilityAccessApi.popAccess.getPopAccessAttachmentsById({ticketId:s,attachmentId:t}),Fe(a,i);break;default:break}break}default:return}}catch(r){console.error("error",r),m(r,!1)}return a}async function Hn(e,t,i){var s,n;try{let o;switch(e){case y.CustomerSupport:{o=await l.customerCareApi.getCustomerCareTicketAttachmentsList({ticketId:t});break}case y.RemoteHands:{o=await l.remoteHandsApi.getRemoteHandsAttachmentsList({ticketId:t});break}case y.Deliveries:{o=await l.deliveriesApi.getDeliveryAttachmentsList({ticketId:t});break}case y.Removals:{o=await l.removalsApi.getRemovalsAttachmentsList({ticketId:t});break}case y.TroubleTickets:{o=await l.troubleTicketsApi.getTroubleTicketAttachmentsList({ticketId:t});break}case y.FacilityAccess:{switch(i){case"Visitor Access":o=await l.facilityAccessApi.visitorAccess.getVisitorAccessAttachmentsList({ticketId:t});break;case"Permanent Badge":o=await((s=l.facilityAccessApi.permanentBadgeAccess)===null||s===void 0?void 0:s.getPermanentBadgeAttachmentsList({ticketId:t}));break;case"OSP Access":o=await l.facilityAccessApi.ospAccess.getOspAccessAttachmentsList({ticketId:t});break;case"PoP/POE Access":o=await l.facilityAccessApi.popAccess.getPopAccessAttachmentsList({ticketId:t});break;default:break}break}default:return}return k.attachments=(n=o==null?void 0:o.attachments)!==null&&n!==void 0?n:[],k.attachments}catch(o){console.error("error",o),await m(o,!1);return}}const qt=async(e,t,i="text/csv")=>{const s=new Blob([await e.arrayBuffer()],{type:i}),n=URL.createObjectURL(s),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),URL.revokeObjectURL(n)};async function pp(e,t){try{const i=await l.serviceTicketApi.downloadServiceTickets({$filter:e,permissionPrivilege:t});await qt(i,"service-tickets.csv")}catch(i){m(i,!1)}}async function hp(e,t,i,s){try{const n=await l.plannedMaintenanceApi.downloadPlannedMaintenanceTickets({$filter:e,$orderby:t,$skip:i,$top:s});await qt(n,"planned-maintenance-tickets.csv")}catch(n){m(n,!1)}}async function vp(e,t,i){try{const s=await l.plannedMaintenanceApi.getPlannedMaintenanceAttachmentsByIdRaw({ticketId:e,attachmentId:t}),n=s.raw.headers.get("content-type")||void 0,o=await s.value();await qt(o,i,n)}catch(s){m(s,!1)}}async function gp(e,t,i,s){try{const n=await l.incidentsApi.downloadIncidentTickets({$filter:e,$orderby:t,$skip:i,$top:s});await qt(n,"incident-tickets.csv")}catch(n){m(n,!1)}}async function wp(e,t,i){try{const s=await l.incidentsApi.getIncidentsAttachmentsByIdRaw({ticketId:e,attachmentId:t}),n=s.raw.headers.get("content-type")||void 0,o=await s.value();await qt(o,i,n)}catch(s){m(s,!1)}}const Le={ticketType:void 0,ticketStep:void 0,serviceTickets:void 0,permissions:{hasCustomerCareCreatePermission:!1,hasFacilityAccessCreatePermission:!1,hasRemoteHandsCreatePermission:!1,hasDeliveriesAndRemovalsCreatePermission:!1,hasTroubleTicketsCreatePermission:!1},loadings:{ticketCreatePermissionChecks:!0,serviceTicketList:!0,attachments:!0,downloadServiceTicketList:!1,serviceTicket:!1,isTicketCancelling:!1},attachments:[],failedAttachments:[],error:{uploadingAttachments:!1,serviceTicketsGrid:!1,fetchingTicket:!1,cancellingTicket:!1},hasPendingApprovalDialogBeenShown:!1};class fp{constructor(){this.ticketType=void 0,this.ticketStep=void 0,this.serviceTickets=void 0,this.permissions=Le.permissions,this.loadings=Le.loadings,this.attachments=Le.attachments,this.failedAttachments=Le.failedAttachments,this.error=Le.error,this.hasPendingApprovalDialogBeenShown=Le.hasPendingApprovalDialogBeenShown,se(this)}updateTicketType(t=void 0){this.ticketType=t}clear(){this.ticketType=void 0,this.ticketStep=void 0,this.error=Le.error,this.loadings=Le.loadings,this.failedAttachments=Le.failedAttachments}setPendingApprovalDialogShown(t){this.hasPendingApprovalDialogBeenShown=t}async checkPermissions(){this.loadings.ticketCreatePermissionChecks=!0,this.permissions.hasCustomerCareCreatePermission=await hn(),this.permissions.hasFacilityAccessCreatePermission=await kn(),this.permissions.hasRemoteHandsCreatePermission=await yn(),this.permissions.hasDeliveriesAndRemovalsCreatePermission=await Ni(),this.permissions.hasTroubleTicketsCreatePermission=await Tn(),this.loadings.ticketCreatePermissionChecks=!1}async postAttachments(t,i,s,n,o){i&&i.length>0&&(this.error.uploadingAttachments=!1,this.failedAttachments=i.map(a=>a.fileName),await Promise.all(i.map(async a=>{try{const r=await Pt(t,a.file,a.fileName,a.fileType,s,o);n&&r!=null&&r.id&&(this.attachments.push(r),this.failedAttachments=this.failedAttachments.filter(d=>d!==a.fileName))}catch(r){await m(r,!1),this.error.uploadingAttachments=!0}})))}async GetServiceTicketList(t,i,s,n,o,a){var r,d;this.loadings.serviceTicketList=!0,this.error.serviceTicketsGrid=!1;try{this.serviceTickets=await l.serviceTicketApi.getServiceTickets({$filter:t,$orderby:i,$skip:s,$top:n,permissionPrivilege:o},a)}catch(u){if(!((r=a==null?void 0:a.signal)===null||r===void 0)&&r.aborted)return;m(u,!1),this.serviceTickets=void 0,this.error.serviceTicketsGrid=!0}finally{!((d=a==null?void 0:a.signal)===null||d===void 0)&&d.aborted||(this.loadings.serviceTicketList=!1)}}async downloadServiceTickets(t,i){this.loadings.downloadServiceTicketList=!0,await pp(t,i),this.loadings.downloadServiceTicketList=!1}get ticketAttachments(){return this.attachments.filter(t=>!t.isError).map(t=>({name:t.fileName}))}}const k=new fp,ye={newTicket:{isValid:!1,accountNumber:"",attachments:[]},selectedTicket:void 0,submissionResult:{state:w.Default},loadings:{isSubmitting:!1,ticketDetailsPermissionCheck:!1}};class kp{constructor(){this.newTicket=ye.newTicket,this.submissionResult=ye.submissionResult,this.selectedTicket=ye.selectedTicket,this.loadings=ye.loadings,se(this),Je(this,{name:"removals",properties:[],storage:window.localStorage})}createTicket(){var t,i,s;this.newTicket={...ye.newTicket,site:(t=this.newTicket.site)!==null&&t!==void 0?t:void 0,serviceBackend:(i=this.newTicket.serviceBackend)!==null&&i!==void 0?i:void 0,accountNumber:(s=this.newTicket.accountNumber)!==null&&s!==void 0?s:"NOT FOUND"},this.submissionResult=ye.submissionResult}updateIsFormValid(t){this.newTicket.isValid=t}updateSite(t){this.newTicket.site=t}updateSubject(t){this.newTicket.subject=t}updateShortDesc(t){this.newTicket.shortDescription=t}updateCourier(t){this.newTicket.courier=t}updateOtherCompany(t){this.newTicket.otherCompany=t}updateTrackingNumber(t){this.newTicket.trackingNumber=t}updatePickupDate(t){this.newTicket.pickupDate=t}updateReferenceNumber(t){this.newTicket.referenceNumber=t}updateRemovalParty(t){this.newTicket.removalParty=t}updateContacts(t){this.newTicket.contacts=t}updateAttachments(t){var i;this.newTicket.attachments=[...(i=this.newTicket.attachments)!==null&&i!==void 0?i:[],...t]}async submitNewTicketRequest(){var t;this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.result=void 0;try{this.submissionResult.result=await l.removalsApi.createRemoval({removalTicketsRequest:np(this.newTicket)})}catch(i){throw this.loadings.isSubmitting=!1,this.submissionResult.state=w.Error,await m(i,!1),i}try{!((t=this.submissionResult.result)===null||t===void 0)&&t.id&&(await k.postAttachments(y.Removals,this.newTicket.attachments,this.submissionResult.result.id),this.newTicket.attachments=void 0)}catch(i){throw await m(i,!1),i}finally{this.loadings.isSubmitting=!1}}async hasTicketPermissionAtLocation(t,i,s,n){try{return this.loadings.ticketDetailsPermissionCheck=!0,await Nt(t,i,s,n)}finally{this.loadings.ticketDetailsPermissionCheck=!1}}async setNewTicket(){try{this.newTicket=await op(this.submissionResult.result)||ye.newTicket}catch(t){throw await m(t,!1),t}}async getRemovalsServiceTicket(t){if(t)try{const i=await l.removalsApi.getRemovalById({ticketId:t});this.submissionResult.result=i,this.selectedTicket=await Un(i),await this.setNewTicket()}catch(i){throw await m(i,!1),i}}async editTicketRequest(){let t;try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting;try{t=await l.removalsApi.updateRemovalById({ticketId:this.newTicket.id||"",removalsTicketsUpdateRequest:ap(this.newTicket)}),this.submissionResult.result=t,this.submissionResult.state=w.Submitted}catch(i){this.submissionResult.state=w.Error,await m(i,!1)}try{await k.postAttachments(y.Removals,this.newTicket.attachments,this.newTicket.id,!0),this.newTicket.attachments=void 0}catch(i){await m(i,!1)}try{t&&(this.selectedTicket=await Un(t),await this.setNewTicket())}catch(i){throw await m(i,!1),i}}finally{this.loadings.isSubmitting=!1}}async cancelTicket(t){var i,s;try{if(k.loadings.isTicketCancelling=!0,!((i=this.selectedTicket)===null||i===void 0)&&i.id){const n=(s=this.selectedTicket)===null||s===void 0?void 0:s.id;await l.removalsApi.cancellationRemovalRequest({ticketId:n,cancellationTicketsRequest:{cancellationReason:t}}),await this.getRemovalsServiceTicket(n)}}catch(n){throw await m(n,!1),n}finally{k.loadings.isTicketCancelling=!1}}clear(){this.newTicket=ye.newTicket,this.selectedTicket=ye.selectedTicket,this.submissionResult=ye.submissionResult,this.loadings=ye.loadings}}const Ve=new kp,Te={newTicket:{isValid:!1,isLoadingBayRequired:!1,needRemoteHands:!1,accountNumber:"",contacts:"",attachments:[]},selectedTicket:void 0,submissionResult:{state:w.Default,result:void 0},loadings:{isSubmitting:!1,isDeliveryBlocked:!1,ticketDetailsPermissionCheck:!1}};class yp{constructor(){this.newTicket=Te.newTicket,this.submissionResult=Te.submissionResult,this.selectedTicket=Te.selectedTicket,this.loadings=Te.loadings,se(this),Je(this,{name:"deliveries",properties:[],storage:window.localStorage})}createTicket(){var t,i,s;this.newTicket={...Te.newTicket,site:(t=this.newTicket.site)!==null&&t!==void 0?t:void 0,serviceBackend:(i=this.newTicket.serviceBackend)!==null&&i!==void 0?i:void 0,accountNumber:(s=this.newTicket.accountNumber)!==null&&s!==void 0?s:"NOT FOUND"},this.submissionResult=Te.submissionResult}addPackage(t,i){var s;if(!t)return;const n=(s=this.newTicket.packages)!==null&&s!==void 0?s:[];i?this.newTicket.packages=n.map(o=>o.id===t.id?t:o):this.newTicket.packages=[...n,t]}removePackage(t){var i;if(t){const s=((i=this.newTicket.packages)!==null&&i!==void 0?i:[]).filter(n=>n.id!==t.id);this.newTicket.packages=[...s]}}updateSite(t){this.newTicket.site=t,this.newTicket.packages=[]}updateSubject(t){this.newTicket.subject=t}updateShortDesc(t){this.newTicket.shortDescription=t}updateEstimatedDate(t){this.newTicket.estimatedDate=t}updateLatestDate(t){this.newTicket.latestDate=t}updateReferenceNumber(t){this.newTicket.referenceNumber=t}updateLoadingBay(t){this.newTicket.isLoadingBayRequired=t}updateNeedRemoteHands(t){this.newTicket.needRemoteHands=t}updateInstructions(t){this.newTicket.instructions=t}updateContacts(t){this.newTicket.contacts=t}updateAttachments(t){var i;this.newTicket.attachments=[...(i=this.newTicket.attachments)!==null&&i!==void 0?i:[],...t]}updateTermsAgreed(t){this.newTicket.termsAgreed=t}updateIsValid(t){this.newTicket.isValid=t}async submitNewTicketRequest(){var t;this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting;try{this.submissionResult.result=await l.deliveriesApi.createDelivery({deliveryTicketsRequest:qn(this.newTicket)}),this.submissionResult.state=w.Submitted}catch(i){throw this.loadings.isSubmitting=!1,this.submissionResult.state=w.Error,await m(i,!1),i}try{!((t=this.submissionResult.result)===null||t===void 0)&&t.id&&await k.postAttachments(y.Deliveries,this.newTicket.attachments,this.submissionResult.result.id),this.newTicket.attachments=void 0}catch(i){throw await m(i,!1),i}finally{this.loadings.isSubmitting=!1}}async setNewTicket(){try{this.newTicket=await Wm(this.submissionResult.result)||Te.newTicket}catch(t){throw await m(t,!1),t}}async updateTicketRequest(){var t,i;let s;try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting;try{s=await l.deliveriesApi.updateDeliveriesTickets({ticketId:((t=this.selectedTicket)===null||t===void 0?void 0:t.id)||"",deliveryTicketsUpdateRequest:qn(this.newTicket,!0)});const n=((i=this.newTicket)===null||i===void 0?void 0:i.packages)||[],o=(await Promise.all(n.map(async a=>{var r;return l.deliveriesApi.updateDeliveriesTicketsPackages({ticketId:((r=this.selectedTicket)===null||r===void 0?void 0:r.id)||"",packageId:(a==null?void 0:a.id)||"",deliveryTicketUpdatePackagesRequest:Pn(a,this.newTicket.serviceBackend)}).then(d=>{var u,p;return(p=(u=d.packages)===null||u===void 0?void 0:u.find(A=>A.id===a.id))!==null&&p!==void 0?p:null}).catch(d=>(m(d,!1),null))}))).filter(a=>a!==null);s&&(s.packages=s.packages.map(a=>{const r=o.find(d=>a.id===d.id);return r!=null?r:a})),this.submissionResult.result=s,this.submissionResult.state=w.Submitted}catch(n){throw this.submissionResult.state=w.Error,await m(n,!1),n}try{await k.postAttachments(y.Deliveries,this.newTicket.attachments,this.newTicket.id,!0),this.newTicket.attachments=void 0}catch(n){await m(n,!1)}try{this.selectedTicket=await On(s),await this.setNewTicket()}catch(n){await m(n,!1)}}finally{this.loadings.isSubmitting=!1}}async hasTicketPermissionAtLocation(t,i,s,n){this.loadings.ticketDetailsPermissionCheck=!0;const o=await Nt(t,i,s,n);return this.loadings.ticketDetailsPermissionCheck=!1,o}async getDeliveriesServiceTicket(t){if(t)try{const i=await l.deliveriesApi.getDeliveryById({ticketId:t});this.submissionResult.result=i,this.selectedTicket=await On(i),await this.setNewTicket()}catch(i){throw await m(i,!1),i}}async cancelDelivery(t,i){try{k.loadings.isTicketCancelling=!0,t&&(await l.deliveriesApi.cancellationDeliveryRequest({ticketId:t,cancellationTicketsRequest:{cancellationReason:i}}),await this.getDeliveriesServiceTicket(t))}catch(s){throw await m(s,!1),s}finally{k.loadings.isTicketCancelling=!1}}async isDeliveryBlocked(t,i){var s;let n;return this.loadings.isDeliveryBlocked=!0,t&&i&&(n=await l.deliveriesApi.getDeliveryDiscovery({site:t,accountNumber:i}).catch(o=>{m(o,!1)})),this.loadings.isDeliveryBlocked=!1,(s=n==null?void 0:n.deliveryBlocked)!==null&&s!==void 0?s:!0}clear(){this.newTicket=Te.newTicket,this.selectedTicket=Te.selectedTicket,this.submissionResult=Te.submissionResult,this.loadings=Te.loadings}}const be=new yp,Re={newTicket:{isValid:!1,accountNumber:"",disableReferenceTicketNumber:!1,attachments:[]},selectedTicket:void 0,submissionResult:{state:w.Default},loadings:{isSubmitting:!1,ticketDetailsPermissionCheck:!1,requestType:!1}};class Tp{constructor(){this.newTicket=Re.newTicket,this.submissionResult=Re.submissionResult,this.selectedTicket=Re.selectedTicket,this.loadings=Re.loadings,se(this),Je(this,{name:"remote-hands",properties:[],storage:window.localStorage})}createTicket(t){var i,s,n,o;const a=(i=this.newTicket.accountNumber)!==null&&i!==void 0?i:ae.getUserAccount().accountNumber;this.newTicket={...Re.newTicket,site:(s=this.newTicket.site)!==null&&s!==void 0?s:void 0,accountNumber:a!=null?a:"NOT FOUND",serviceBackend:t,referenceTicketNumber:(n=this.newTicket.referenceTicketNumber)!==null&&n!==void 0?n:void 0,disableReferenceTicketNumber:(o=this.newTicket.disableReferenceTicketNumber)!==null&&o!==void 0?o:void 0},this.submissionResult=Re.submissionResult}updateSite(t,i=!1){this.newTicket.site=t,this.newTicket.isValid=i}updateLocation(t){this.newTicket.location=t}updateSubject(t){this.newTicket.subject=t}updateDescription(t){this.newTicket.description=t}updateRequestType(t){this.newTicket.requestType=t,this.newTicket.category=void 0}updateCategory(t){this.newTicket.category=t}updateReferenceNumber(t){this.newTicket.referenceNumber=t}updateReferenceTicketNumber(t){this.newTicket.referenceTicketNumber=t}updateReferenceNumberDisable(t){this.newTicket.referenceTicketNumber=t,this.newTicket.disableReferenceTicketNumber=!0}updateStartDate(t){this.newTicket.startDate=t}updateStartTime(t){this.newTicket.startTime=t}updateContacts(t){this.newTicket.contacts=t}updateAccountNumber(t){this.newTicket.accountNumber=t}updateFormValidation(t){this.newTicket.isValid=t}updateAttachments(t){var i;this.newTicket.attachments=[...(i=this.newTicket.attachments)!==null&&i!==void 0?i:[],...t]}updateTermsAgreed(t){this.newTicket.termsAgreed=t}async setNewTicket(){try{this.newTicket=await Xm(this.submissionResult.result)||Re.newTicket}catch(t){throw await m(t,!1),t}}async updateTicketRequest(){var t;let i;try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting;try{i=await l.remoteHandsApi.updateRemoteHandsTicketById({ticketId:((t=this.selectedTicket)===null||t===void 0?void 0:t.id)||"",remoteHandsUpdateRequest:Ym(this.newTicket)}),this.submissionResult.result=i,this.submissionResult.state=w.Submitted}catch(s){this.submissionResult.state=w.Error,await m(s,!1)}try{await k.postAttachments(y.RemoteHands,this.newTicket.attachments,this.newTicket.id,!0),this.newTicket.attachments=void 0}catch(s){await m(s,!1)}try{i&&(this.selectedTicket=await xn(i))}catch(s){await m(s,!1)}}catch(s){throw await m(s,!1),s}finally{this.loadings.isSubmitting=!1}}async submitNewTicketRequest(){var t;this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting;try{this.submissionResult.result=await l.remoteHandsApi.createRemoteHandsTicket({remoteHandsRequest:Km(this.newTicket)}),this.submissionResult.state=w.Submitted}catch(i){throw this.loadings.isSubmitting=!1,this.submissionResult.state=w.Error,await m(i,!1),i}try{!((t=this.submissionResult.result)===null||t===void 0)&&t.ticketId&&(await k.postAttachments(y.RemoteHands,this.newTicket.attachments,this.submissionResult.result.ticketId),this.newTicket.attachments=void 0)}catch(i){throw await m(i,!1),i}finally{this.loadings.isSubmitting=!1}}async getRemoteHandsServiceTicket(t){if(t)try{const i=await l.remoteHandsApi.getRemoteHandsTicketById({ticketId:t});this.submissionResult.result=i,this.selectedTicket=await xn(i),await this.setNewTicket()}catch(i){throw await m(i,!1),i}}async cancelTicket(t){var i;try{k.loadings.isTicketCancelling=!0,!((i=this.selectedTicket)===null||i===void 0)&&i.id&&(await l.remoteHandsApi.cancellationRemoteHandsRequest({ticketId:this.selectedTicket.id,cancellationTicketsRequest:{cancellationReason:t}}),await this.getRemoteHandsServiceTicket(this.selectedTicket.id))}catch(s){throw await m(s,!1),s}finally{k.loadings.isTicketCancelling=!1}}clear(){this.newTicket=Re.newTicket,this.selectedTicket=Re.selectedTicket,this.submissionResult=Re.submissionResult,this.loadings=Re.loadings}}const re=new Tp,bp=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}}),Ae={newTicket:{isValid:!1,accountNumber:"",attachments:[],locations:[]},selectedTicket:void 0,submissionResult:{state:w.Default},loadings:{isSubmitting:!1}};class Rp{constructor(){this.newTicket=Ae.newTicket,this.submissionResult=Ae.submissionResult,this.selectedTicket=Ae.selectedTicket,this.loadings=Ae.loadings,se(this),Je(this,{name:"trouble-tickets",properties:[],storage:window.localStorage})}getIsInProgress(){var t;return((t=this.selectedTicket)===null||t===void 0?void 0:t.state)===O.InProgress}createTicket(t){var i,s;const{accountNumber:n}=ae.getUserAccount();this.newTicket={...Ae.newTicket,site:(i=this.newTicket.site)!==null&&i!==void 0?i:void 0,accountNumber:n!=null?n:"NOT FOUND",referenceTicketNumber:t,serviceBackend:(s=this.newTicket.serviceBackend)!==null&&s!==void 0?s:void 0},this.submissionResult=Ae.submissionResult}updateSite(t,i=!1){this.newTicket.site=t,this.newTicket.isValid=i}updateLocations(t,i){var s,n,o;if(i)(o=this.newTicket.locations)===null||o===void 0||o.push(t);else{const a=(s=this.newTicket.locations)===null||s===void 0?void 0:s.indexOf(t);a!==void 0&&a!==-1&&((n=this.newTicket.locations)===null||n===void 0||n.splice(a,1))}}clearLocations(){this.newTicket.locations=[]}updateSubject(t){this.newTicket.subject=t}updateDescription(t){this.newTicket.description=t}updateRequestType(t){this.newTicket.requestType=t,this.newTicket.category=void 0}updateCategory(t){this.newTicket.category=t}updateReferenceNumber(t){this.newTicket.referenceNumber=t}updateReferenceTicketNumber(t){this.newTicket.referenceTicketNumber=t}updateReferenceNumberDisable(t){this.newTicket.referenceTicketNumber=t}updateCircuitId(t){this.newTicket.circuitId=t}updateContacts(t){this.newTicket.contacts=t}updateAccountNumber(t){this.newTicket.accountNumber=t}updateFormValidation(t){this.newTicket.isValid=t}updateTermsAgreed(t){this.newTicket.termsAgreed=t}updateAttachments(t){var i;this.newTicket.attachments=[...(i=this.newTicket.attachments)!==null&&i!==void 0?i:[],...t]}async submitNewTicketRequest(){var t,i;this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.result=void 0;try{this.submissionResult.result=await l.troubleTicketsApi.createTroubleTicketTicket({troubleTicketRequest:cp(this.newTicket)}),this.submissionResult.state=w.Submitted}catch(s){throw this.loadings.isSubmitting=!1,this.submissionResult.state=w.Error,await m(s,!1),s}try{!((i=(t=this.submissionResult)===null||t===void 0?void 0:t.result)===null||i===void 0)&&i.id&&(await k.postAttachments(y.TroubleTickets,this.newTicket.attachments,this.submissionResult.result.id),this.newTicket.attachments=void 0)}catch(s){throw await m(s,!1),s}finally{this.loadings.isSubmitting=!1}}async setNewTicket(){try{this.newTicket=await Oi(this.submissionResult.result)||Ae.newTicket}catch(t){throw await m(t,!1),t}}async submitUpdateTicketRequest(){var t,i;if(this.newTicket&&this.selectedTicket&&this.selectedTicket.id){let s;try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting;try{s=await l.troubleTicketsApi.updateTroubleTicketTicket({ticketId:(t=this.selectedTicket.id)!==null&&t!==void 0?t:"",troubleTicketUpdateRequest:dp(this.newTicket)}),this.submissionResult.result=s}catch(n){this.submissionResult.state=w.Error,await m(n,!1)}try{await k.postAttachments(y.TroubleTickets,this.newTicket.attachments,(i=this.selectedTicket)===null||i===void 0?void 0:i.id,!0),this.newTicket.attachments=void 0}catch(n){await m(n,!1)}try{s&&(this.submissionResult.state=w.Submitted,this.submissionResult.result=s,this.selectedTicket=await Oi(this.submissionResult.result),await this.setNewTicket())}catch(n){await m(n,!1)}}finally{this.loadings.isSubmitting=!1}}}async getTroubleTicketById(t){if(t)try{const i=await l.troubleTicketsApi.getTroubleTicketTicketById({ticketId:t});this.submissionResult.result=i,this.selectedTicket=await Oi(i),await this.setNewTicket()}catch(i){throw await m(i,!1),i}}async cancelTicket(t){var i;try{k.loadings.isTicketCancelling=!0,!((i=this.selectedTicket)===null||i===void 0)&&i.id&&(await l.troubleTicketsApi.cancellationTroubleTicketRequest({ticketId:this.selectedTicket.id,cancellationTicketsRequest:{cancellationReason:t}}),await this.getTroubleTicketById(this.selectedTicket.id))}catch(s){throw await m(s,!1),s}finally{k.loadings.isTicketCancelling=!1}}clear(){this.newTicket=Ae.newTicket,this.selectedTicket=Ae.selectedTicket,this.submissionResult=Ae.submissionResult,this.loadings=Ae.loadings}}const Ue=new Rp,Ap={"Visitor First Name":"visitorFirstName","Visitor Last Name":"visitorLastName","Visitor Email Address":"visitorEmailAddress","Visitor Phone Number":"visitorPhoneNumber"},zn=40,$i="bulk_";function mt(e){return e.startsWith("WO")}function _p(e){return e.startsWith("CS")||e.startsWith("DEL")}function Ip(e,t){return e?Jt.Escorted:t==="Standard"?Jt.Standard:Jt.Extended}function Sp(e){return e?e==="Escorted"?{isEscortedVisitor:!0,visitorBadge:void 0}:{isEscortedVisitor:!1,visitorBadge:e==="Standard"?"Standard":"Extended"}:{isEscortedVisitor:void 0,visitorBadge:void 0}}function Cp(e){return e.map(t=>{var i;return{siteCode:t.site.siteId,visitorHostId:(i=t.visitorHost)===null||i===void 0?void 0:i.id,locations:t.locations.map(s=>({id:s.id,startDate:Z(s.startDate),endDate:Z(s.endDate)}))}})}const Np=e=>({otherNotificationRecipients:e.contacts,visitorPhone:e.visitors[0].phone});async function jn(e,t,i,s,n,o){var a,r;const d=(a=J.sites.find(u=>u.locationId===e))===null||a===void 0?void 0:a.id;return[{site:new Oe(e,d,t),locations:(r=i==null?void 0:i.map(u=>({id:u.id||"-",site:d,startDate:u.startDate||"",endDate:u.endDate||"",status:u.approvalStatus||"-",modifiedBy:u.modifiedBy||"-"})))!==null&&r!==void 0?r:[],isVisitorHostDetailsValid:s,visitorHost:n,serviceBackend:o}]}const Pp=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}}),qp=e=>{var t,i,s,n;return{accountNumber:e.accountNumber,visitors:e.visitors.map(o=>({firstName:o.firstName,lastName:o.lastName,email:o.email,phone:o.phone})),visitStartDate:Z(e.startDate),visitEndDate:Z(e.endDate),visitType:Ip((t=e.isEscortedVisitor)!==null&&t!==void 0?t:!1,e.visitorBadge),sites:Cp(e.sitesDetails||[]),escortFirstName:e.escortFirstName,escortLastName:e.escortLastName,visitorHostFirstName:(i=e.hostFirstName)!==null&&i!==void 0?i:"",visitorHostLastName:(s=e.hostLastName)!==null&&s!==void 0?s:"",representingCompany:(n=e.representingCompany)!==null&&n!==void 0?n:"",description:e.notes,notificationRecipients:e.contacts}},Mn=async e=>{var t,i,s,n;if(!e)return;const o=mt(e.id)?H.Insite:H.ServiceNow;return{id:e.id,accountNumber:e.accountNumber||"-",accountName:e.accountName||"-",contacts:e.notificationRecipients||"",state:e.status||"-",requester:e.createdBy||"-",createdOn:e.createdAt.toISOString(),updatedOn:e.updatedAt.toISOString(),requestType:"Visitor Access",category:"New Visitor Access",visitors:[{firstName:e.visitorFirstName||"-",lastName:e.visitorLastName||"-",email:e.visitorEmail||"-",phone:e.visitorPhone||"-",id:""}],visitorType:e.visitType||"-",escortFirstName:e.escortFirstName||"-",escortLastName:e.escortLastName||"-",startDate:e.visitStartDate,endDate:e.visitEndDate,representingCompany:e.representingCompany||"-",notes:e.description||"-",site:e.site,cancellationReason:e.cancellationReason,sitesDetails:await jn((t=e.site)!==null&&t!==void 0?t:"-",(i=e.accountNumber)!==null&&i!==void 0?i:"-",(s=e.locations)!==null&&s!==void 0?s:[],!0,{firstName:e.visitorHostFirstName,lastName:e.visitorHostLastName},o),hostFirstName:e.visitorHostFirstName,hostLastName:e.visitorHostLastName,comments:(n=e.comments)===null||n===void 0?void 0:n.map(a=>M(a))}},Dp=async e=>{var t,i,s;if(!e)return;const{isEscortedVisitor:n,visitorBadge:o}=Sp(e.visitType),a=mt(e.id)?H.Insite:H.ServiceNow;return{id:e==null?void 0:e.id,accountNumber:e.accountNumber||"",contacts:e.notificationRecipients||"",requestType:"Visitor Access",category:"New Visitor Access",visitors:[{firstName:e.visitorFirstName||"",lastName:e.visitorLastName||"",email:e.visitorEmail||"",phone:e.visitorPhone||""}],escortFirstName:e.escortFirstName||"",escortLastName:e.escortLastName||"",startDate:e.visitStartDate,endDate:e.visitEndDate,representingCompany:e.representingCompany||"-",notes:e.description||"-",sitesDetails:await jn((t=e.site)!==null&&t!==void 0?t:"-",(i=e.accountNumber)!==null&&i!==void 0?i:"-",(s=e.locations)!==null&&s!==void 0?s:[],!0,{firstName:e.visitorHostFirstName,lastName:e.visitorHostLastName},a),hostFirstName:e.visitorHostFirstName,hostLastName:e.visitorHostLastName,cancellationReason:e.cancellationReason,visitorBadge:o,isEscortedVisitor:n,isFileAttachedForVisitors:!1,isNotificationsAttachmentsValid:!0,isRequestedAccessDetailsValid:!0,isVisitorContactsDetailsValid:!0,isVisitorEscortedDetailsValid:!0}},Jn=e=>{const{visitorFirstName:t,visitorLastName:i,visitorEmailAddress:s,visitorPhoneNumber:n}=e;if(!t||!i||!s)return"Error: First name, last name and email are required.";const o=!Cn(s),a=n&&n.length>0&&!ha(n);if(o&&a)return"Error: Invalid visitor email address and phone number";if(o)return"Error: Invalid visitor email address";if(a)return"Error: Invalid visitor phone number"};async function Bp(e){const[t,i]=await Promise.all([Ze({locationType:F.Site,permissionType:S.VisitorAccess,permissionPrivilege:e}),Ze({locationType:Ct,permissionType:S.VisitorAccess,permissionPrivilege:e,assignableProcess:"Facilities_access"})]),s=new Set(i.map(n=>n.siteId));return t.sort((n,o)=>n.siteId>o.siteId?1:-1).map(n=>({...n,hasSpaces:s.has(n.siteId)}))}const ce={newTicket:{isRequestedAccessDetailsValid:!1,isVisitorContactsDetailsValid:!1,isVisitorEscortedDetailsValid:!1,isNotificationsAttachmentsValid:!1,isRepresentingCompanyValid:!1,accountNumber:void 0,visitors:[],contacts:"",attachments:[],isEscortedVisitor:!1,startDate:void 0,endDate:void 0,sitesDetails:void 0,visitorBadge:"Standard"},selectedTicket:void 0,submissionResult:{state:w.Default,ticketNumbers:[],ticketResponse:void 0},loadings:{isSubmitting:!1,facilityAccessTicket:!1},isEditAttachmentAdded:!1};class Op{constructor(){this.DuplicateEmailErrorMessage="Each visitor must have a unique email address.",this.newTicket=ce.newTicket,this.submissionResult=ce.submissionResult,this.selectedTicket=ce.selectedTicket,this.loadings=ce.loadings,this.isEditAttachmentAdded=ce.isEditAttachmentAdded,se(this)}createTicket(){var t,i;const s=(t=this.newTicket.accountNumber)!==null&&t!==void 0?t:ae.getUserAccount().accountNumber;this.newTicket={...ce.newTicket,accountNumber:s,requestType:"Visitor Access",category:"New Visitor Access",serviceBackend:(i=this.newTicket.serviceBackend)!==null&&i!==void 0?i:void 0},this.submissionResult=ce.submissionResult}isVisitorContactsValid(t){this.newTicket.isVisitorContactsDetailsValid=t}isEscortedDetailsValid(t){this.newTicket.isVisitorEscortedDetailsValid=t}get isVisitorHostDetailsValid(){var t;return((t=this.newTicket.sitesDetails)===null||t===void 0?void 0:t.some(i=>i.isVisitorHostDetailsValid===!1))===!1}isVisitorHostDetailsValidBySite(t,i){var s;const n=(s=this.newTicket.sitesDetails)===null||s===void 0?void 0:s.find(o=>o.site.siteId===t);n&&(n.isVisitorHostDetailsValid=i)}isRequestedAccessDetailsValid(t){this.newTicket.isRequestedAccessDetailsValid=t}isNotificationsAttachmentsValid(t){this.newTicket.isNotificationsAttachmentsValid=t}isRepresentingCompanyValid(t){this.newTicket.isRepresentingCompanyValid=t}updateTermsAgreed(t){this.newTicket.termsAgreed=t}updateAttachments(t){var i;(i=this.newTicket.attachments)===null||i===void 0||i.push(...t)}removeBulkAttachment(){var t;this.newTicket.attachments=(t=this.newTicket.attachments)===null||t===void 0?void 0:t.filter(i=>{var s;return!(!((s=i.fileName)===null||s===void 0)&&s.startsWith($i))})}get isNewTicketValid(){return this.newTicket.isVisitorContactsDetailsValid&&this.newTicket.isVisitorEscortedDetailsValid&&this.isVisitorHostDetailsValid&&this.newTicket.isRequestedAccessDetailsValid&&this.newTicket.isRepresentingCompanyValid&&this.newTicket.isNotificationsAttachmentsValid}updateIsEscortedVisitor(t){this.newTicket.isEscortedVisitor=t,t?this.newTicket.visitorBadge=void 0:(this.newTicket.escortFirstName=void 0,this.newTicket.escortLastName=void 0,this.newTicket.visitorBadge===void 0&&(this.newTicket.visitorBadge="Standard"))}updateVisitorHost(t,i){var s;const n=(s=this.newTicket.sitesDetails)===null||s===void 0?void 0:s.find(o=>o.site.siteId===t);n&&(n.visitorHost=i,n.isVisitorHostDetailsValid=!0)}updateEscortFirstName(t){this.newTicket.escortFirstName=t}updateEscortLastName(t){this.newTicket.escortLastName=t}updateIsFileAttachedForVisitors(t){this.newTicket.isFileAttachedForVisitors=t}validateNoDuplicateEmails(t){const i=[...t];i.forEach((n,o)=>{n.validationError===this.DuplicateEmailErrorMessage&&(i[o]={...n,validationError:void 0,isValid:!0})});const s=i.filter(n=>!n.validationError);return i.forEach((n,o)=>{n.validationError||s.filter(a=>a.email.toLowerCase()===n.email.toLowerCase()).length>1&&(i[o]={...n,validationError:this.DuplicateEmailErrorMessage,isValid:!1})}),i}addOrUpdateVisitor(t){var i;if(!t)return;const s=(i=this.newTicket.visitors)!==null&&i!==void 0?i:[],n=s.findIndex(a=>a.id===t.id),o=n!==-1;if(!(!o&&s.length>=zn))if(this.newTicket.id)this.newTicket.visitors=[t];else{let a;t.isUploadedFromFile&&(a=Jn({visitorFirstName:t.firstName,visitorLastName:t.lastName,visitorEmailAddress:t.email,visitorPhoneNumber:t.phone}));const r={...t,validationError:a,isValid:!a},d=[...s];o?d[n]=r:d.push(r),this.newTicket.visitors=this.validateNoDuplicateEmails(d)}}addBulkVisitors(t){t.forEach(i=>{const s=Jn(i),n={id:crypto.randomUUID(),firstName:i.visitorFirstName,lastName:i.visitorLastName,email:i.visitorEmailAddress,phone:i.visitorPhoneNumber,isUploadedFromFile:!0,validationError:s,isValid:!s};this.addOrUpdateVisitor(n)})}removeBulkVisitors(){var t;const i=((t=this.newTicket.visitors)!==null&&t!==void 0?t:[]).filter(s=>s.isUploadedFromFile!==!0);this.newTicket.visitors=[...i]}removeVisitor(t){var i;if(t){const s=((i=this.newTicket.visitors)!==null&&i!==void 0?i:[]).filter(n=>n.id!==t.id);this.newTicket.visitors=this.validateNoDuplicateEmails(s)}}removeAllVisitors(){this.newTicket.visitors=[]}updateHostFirstName(t){this.newTicket.hostFirstName=t}updateHostLastName(t){this.newTicket.hostLastName=t}updateVisitorBadge(t){this.newTicket.visitorBadge=t}updateStartDate(t){var i;this.newTicket.startDate=t,(i=this.newTicket.sitesDetails)===null||i===void 0||i.forEach(s=>{s.locations.forEach(n=>{n.startDate=t})})}updateEndDate(t){var i;this.newTicket.endDate=t,(i=this.newTicket.sitesDetails)===null||i===void 0||i.forEach(s=>{s.locations.forEach(n=>{n.endDate=t})})}updateRepresentingCompany(t){this.newTicket.representingCompany=t}updateNotes(t){this.newTicket.notes=t}async addSiteLocations(t){var i;if(t){const s=await K.getServiceBackend(t.site.accountNumber,t.site.siteId,"Facilities_access"),n=((i=this.newTicket.sitesDetails)!==null&&i!==void 0?i:[]).filter(a=>a.site.siteId!==t.site.siteId),o={...t,serviceBackend:s};this.newTicket.sitesDetails=[...n,o]}}removeSiteLocations(t){var i;if(t){const s=((i=this.newTicket.sitesDetails)!==null&&i!==void 0?i:[]).filter(n=>n.site.siteId!==t.site.siteId);this.newTicket.sitesDetails=[...s]}}updateContacts(t){this.newTicket.contacts=t}async submitNewTicketRequest(){var t,i,s,n;let o;this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.ticketNumbers=void 0;try{o=await l.facilityAccessApi.visitorAccess.createVisitorAccessTicket({visitorAccessTicketRequest:qp(this.newTicket)}),this.submissionResult.ticketNumbers=o==null?void 0:o.ticketNumbers}catch(a){throw this.loadings.isSubmitting=!1,this.submissionResult.state=w.Error,await m(a,!1),a}try{if(o){k.failedAttachments=((t=this.newTicket.attachments)!==null&&t!==void 0?t:[]).map(u=>u.fileName);const{ticketNumbers:a}=o,r=(i=a==null?void 0:a.filter(u=>_p(u)))!==null&&i!==void 0?i:[],d=(s=a==null?void 0:a.filter(u=>mt(u)))!==null&&s!==void 0?s:[];a!=null&&a.length&&!((n=this.newTicket.attachments)===null||n===void 0)&&n.length&&await Promise.all(this.newTicket.attachments.map(async u=>{const p=[];let A=[];u.fileName.startsWith($i)?(r.length>0&&A.push(r[0]),d.length>0&&A.push(...d)):A=a,p.push(...A.map(async N=>Pt(y.FacilityAccess,u.file,u.fileName,u.fileType,N,this.newTicket.requestType))),await Promise.all(p).then(()=>{var N;k.failedAttachments=((N=this.newTicket.attachments)!==null&&N!==void 0?N:[]).filter(b=>b.fileName!==u.fileName).map(b=>b.fileName)})})),this.newTicket.attachments=void 0}}catch(a){throw k.error.uploadingAttachments=!0,await m(a,!1),a}finally{this.submissionResult.state=w.Submitted,this.loadings.isSubmitting=!1}}async setNewTicket(){try{this.newTicket=await Dp(this.submissionResult.ticketResponse)||ce.newTicket}catch(t){throw await m(t,!1),t}}async submitUpdateTicketRequest(){let t;try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.ticketNumbers=void 0;try{t=await l.facilityAccessApi.visitorAccess.updateVisitorAccessTicket({visitorAccessTicketUpdateRequest:Np(this.newTicket),ticketId:this.newTicket.id}),this.submissionResult.ticketResponse=t,this.submissionResult.state=w.Submitted,this.submissionResult.ticketNumbers=[t.id]}catch(i){this.submissionResult.state=w.Error,await m(i,!1)}try{await k.postAttachments(y.FacilityAccess,this.newTicket.attachments,this.newTicket.id,!0,"Visitor Access"),this.newTicket.attachments=void 0}catch(i){await m(i,!1)}try{t&&(this.selectedTicket=await Mn(t),await this.setNewTicket())}catch(i){await m(i,!1)}}catch(i){throw await m(i,!1),i}finally{this.loadings.isSubmitting=!1}}async getVisitorAccessServiceTicket(t){if(t)try{const i=await l.facilityAccessApi.visitorAccess.getVisitorAccessTicketById({ticketId:t});this.submissionResult.ticketResponse=i,this.selectedTicket=await Mn(i),await this.setNewTicket()}catch(i){throw await m(i,!1),i}}async cancelTicket(t,i){try{k.loadings.isTicketCancelling=!0,k.error.cancellingTicket=!1,t&&(await l.facilityAccessApi.visitorAccess.cancellationVisitorAccessRequest({ticketId:t,cancellationTicketsRequest:{cancellationReason:i}}).catch(s=>{throw m(s,!1),s}),await this.getVisitorAccessServiceTicket(t))}catch(s){throw k.error.cancellingTicket=!0,await m(s,!1),s}finally{k.loadings.isTicketCancelling=!1}}async hasUpdatePermissions(){try{return!!await Ke(this.selectedTicket.sitesDetails[0].locations.map(t=>t.id),S.VisitorAccess,U.Update)}catch(t){return!1}}clearNewTicket(){this.newTicket=ce.newTicket}async patchLocationsApprovalStatus(t){var i,s;const n=t.map(o=>({id:o.id,approvalStatus:us[o.status]}));await l.facilityAccessApi.visitorAccess.updateVisitorAccessLocationsTicket({ticketId:((i=this.selectedTicket)===null||i===void 0?void 0:i.id)||"",locationsPatchRequestInner:n}),await this.getVisitorAccessServiceTicket((s=this.selectedTicket)===null||s===void 0?void 0:s.id)}async getVisitorHosts(t,i,s,n=1,o=10){return await l.facilityAccessApi.visitorHost.getVisitorHostsList({site:t,nameOrEmailContains:i,pageNumber:n,pageSize:o},s).catch(r=>{var d;!((d=s==null?void 0:s.signal)===null||d===void 0)&&d.aborted||m(r,!1)})||{items:[],totalCount:0}}clear(){this.newTicket=ce.newTicket,this.selectedTicket=ce.selectedTicket,this.submissionResult=ce.submissionResult,this.loadings=ce.loadings,this.isEditAttachmentAdded=ce.isEditAttachmentAdded}}const ie=new Op;function $p(e){return e.flatMap(t=>t.locations).map(t=>({id:t.id,startDate:Z(t.startDate),endDate:Z(t.endDate)}))}function Ep(e){return e.flatMap(t=>t.locations).map(t=>({id:t.id,startDate:Z(t.startDate),endDate:Z(t.endDate),operation:"add"}))}const xp=e=>{var t;return{accountNumber:(t=e.accountNumber)!==null&&t!==void 0?t:"",badgeholderFirstName:e.badgeHolder.firstName,badgeholderLastName:e.badgeHolder.lastName,badgeholderEmail:e.badgeHolder.email,badgeholderCompany:e.badgeHolder.company,badgeholderPhone:e.badgeHolder.phone,badgeStartDate:Z(e.startDate),badgeEndDate:Z(e.endDate),locations:$p(e.sitesDetails||[]),notificationRecipients:e.contacts}},Fp=e=>({otherNotificationRecipients:e.contacts}),Lp=e=>({otherNotificationRecipients:e.contacts}),Vp=()=>({}),Up=e=>{var t;return{accountNumber:(t=e.accountNumber)!==null&&t!==void 0?t:"",badgeholderId:e.badgeHolder.id,badgeStartDate:Z(e.startDate),badgeEndDate:Z(e.endDate),locations:Ep(e.sitesDetails||[]),notificationRecipients:e.contacts}},Hp=e=>({badgeholderId:e.badgeHolder.id,accountNumber:e.badgeHolder.accountNumber,badgeEndDate:Z(e.endDate)});async function Wn(e,t=""){if(!e)return[];const i=e.map(a=>({id:a.id||"-",site:a.site||"",siteAddress:a.siteAddress,startDate:a.startDate||"",endDate:a.endDate||"",status:a.approvalStatus||"-",modifiedBy:a.modifiedBy||"-"})),s=[...new Set(i.map(a=>a.site))],n={};await Promise.all(s.map(async a=>{var r;n[a]=(r=await vm(a))!==null&&r!==void 0?r:a}));const o=[];return i.forEach(a=>{const{site:r}=a,d=o.find(u=>u.site.siteId===r);d?d.locations.push(a):o.push({site:new Oe(n[r],r,t),locations:[a]})}),o}const Gn=async e=>{var t,i,s;if(e)return{id:e==null?void 0:e.id,accountNumber:e.accountNumber||"-",accountName:e.accountName||"-",contacts:e.notificationRecipients||"",state:e.status||"-",requester:e.createdBy||"-",createdOn:(t=e.createdAt)===null||t===void 0?void 0:t.toISOString(),updatedOn:(i=e.updatedAt)===null||i===void 0?void 0:i.toISOString(),requestType:"Permanent Badge",category:e.requestType,visitors:[{firstName:e.badgeholderFirstName||"-",lastName:e.badgeholderLastName||"-",email:e.badgeholderEmail||"-",phone:e.badgeholderPhone,company:e.badgeholderCompany||"-"}],startDate:e.badgeStartDate,endDate:e.badgeEndDate,sitesDetails:await Wn(e.locations,e.accountNumber),cancellationReason:e.cancellationReason,comments:(s=e.comments)===null||s===void 0?void 0:s.map(n=>M(n))}},zp=async e=>{if(e)return{id:e==null?void 0:e.id,contacts:e.notificationRecipients,requestType:"Permanent Badge",category:e.requestType,visitors:[{firstName:e.badgeholderFirstName||"",lastName:e.badgeholderLastName||"",email:e.badgeholderEmail||"",phone:e.badgeholderPhone||"",company:e.badgeholderCompany||""}],badgeHolder:{firstName:e.badgeholderFirstName||"",lastName:e.badgeholderLastName||"",email:e.badgeholderEmail||"",phone:e.badgeholderPhone||"",company:e.badgeholderCompany||""},startDate:e.badgeStartDate,endDate:e.badgeEndDate,sitesDetails:await Wn(e.locations,e.accountNumber),isNotificationsAttachmentsValid:!0,isRequestedAccessDetailsValid:!0,isVisitorContactsDetailsValid:!0,isEndDateValid:!0,isBadgeholderValid:!0}},jp=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}}),Zn=e=>e.map(t=>({id:t.id,accountNumber:t.accountNumber,firstName:t.firstName,lastName:t.lastName,email:t.email,phone:t.phone,company:t.representingCompany,startDate:t.badgeStartDate?St(t.badgeStartDate):void 0})),Mp=(e,t)=>[...e,...Zn(t)];async function Jp(e){const[t,i]=await Promise.all([Ze({locationType:F.Site,permissionType:S.PermanentBadge,permissionPrivilege:e}),Ze({locationType:Ct,permissionType:S.PermanentBadge,permissionPrivilege:e,assignableProcess:"Facilities_access"})]),s=new Set(i.map(n=>n.siteId));return t.sort((n,o)=>n.siteId>o.siteId?1:-1).map(n=>({...n,hasSpaces:s.has(n.siteId)}))}const de={newTicket:{isRequestedAccessDetailsValid:!1,isNotificationsAttachmentsValid:!1,isBadgeholderValid:!1,isStartDateSetViaBadgeHolder:!1,isEndDateValid:!1,accountNumber:void 0,contacts:"",badgeHolder:{},attachments:[],isVisitorContactsDetailsValid:!1,visitors:[]},selectedTicket:void 0,submissionResult:{state:w.Default,ticketNumbers:[],ticketResponse:void 0},loadings:{isSubmitting:!1,facilityAccessTicket:!1},isEditAttachmentAdded:!1};class Wp{constructor(){this.newTicket=de.newTicket,this.submissionResult=de.submissionResult,this.selectedTicket=de.selectedTicket,this.loadings=de.loadings,this.isEditAttachmentAdded=de.isEditAttachmentAdded,se(this)}createTicket(){var t,i,s,n;const o=(t=this.newTicket.accountNumber)!==null&&t!==void 0?t:ae.getUserAccount().accountNumber;this.newTicket={...de.newTicket,accountNumber:o,requestType:(i=this.newTicket.requestType)!==null&&i!==void 0?i:void 0,category:(s=this.newTicket.category)!==null&&s!==void 0?s:void 0,serviceBackend:(n=this.newTicket.serviceBackend)!==null&&n!==void 0?n:void 0},this.submissionResult=de.submissionResult}updateStartDateSetViaBadgeholder(t){this.newTicket.isStartDateSetViaBadgeHolder=t}isVisitorContactsValid(t){this.newTicket.isVisitorContactsDetailsValid=t}isRequestedAccessDetailsValid(t){this.newTicket.isRequestedAccessDetailsValid=t}isBadgeholderValid(t){this.newTicket.isBadgeholderValid=t}isNotificationsAttachmentsValid(t){this.newTicket.isNotificationsAttachmentsValid=t}isEndDateValid(t){this.newTicket.isEndDateValid=t}updateTermsAgreed(t){this.newTicket.termsAgreed=t}updateAttachments(t){var i;(i=this.newTicket.attachments)===null||i===void 0||i.push(...t)}removeBulkAttachment(){throw new Error("Method not implemented.")}get isNewTicketValid(){switch(this.newTicket.category){case"New":return this.newTicket.isVisitorContactsDetailsValid&&this.newTicket.isRequestedAccessDetailsValid&&this.newTicket.isNotificationsAttachmentsValid;case"Modify":return this.newTicket.isBadgeholderValid&&this.newTicket.isRequestedAccessDetailsValid&&this.newTicket.isNotificationsAttachmentsValid;case"Terminate":return this.newTicket.isBadgeholderValid&&this.newTicket.isEndDateValid;default:return!1}}setBadgeHolder(t){this.newTicket.badgeHolder=t,t===void 0?this.newTicket.visitors=[]:this.newTicket.visitors=[{id:t.id,firstName:t.firstName,lastName:t.lastName,email:t.email,phone:t.phone,company:t.company}]}addOrUpdateVisitor(t){t&&this.setBadgeHolder(t)}addBulkVisitors(t){throw new Error("Method not implemented.")}removeBulkVisitors(){throw new Error("Method not implemented.")}removeVisitor(t){this.setBadgeHolder(void 0)}removeAllVisitors(){this.newTicket.visitors=[]}clearStartDate(){this.newTicket.startDate=void 0}updateStartDate(t){var i;this.newTicket.startDate=t,(i=this.newTicket.sitesDetails)===null||i===void 0||i.forEach(s=>{s.locations.forEach(n=>{n.startDate=t})})}updateEndDate(t){var i;this.newTicket.endDate=t,(i=this.newTicket.sitesDetails)===null||i===void 0||i.forEach(s=>{s.locations.forEach(n=>{n.endDate=t})})}async addSiteLocations(t){var i;if(t){const s=await K.getServiceBackend(t.site.accountNumber,t.site.siteId,"Facilities_access"),n=((i=this.newTicket.sitesDetails)!==null&&i!==void 0?i:[]).filter(a=>a.site.siteId!==t.site.siteId),o={...t,serviceBackend:s};this.newTicket.sitesDetails=[...n,o]}}removeSiteLocations(t){var i;if(t){const s=((i=this.newTicket.sitesDetails)!==null&&i!==void 0?i:[]).filter(n=>n.site.siteId!==t.site.siteId);this.newTicket.sitesDetails=[...s]}}updateContacts(t){this.newTicket.contacts=t}async submitNewTicketRequest(){var t,i;let s;this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.ticketNumbers=void 0;try{switch(this.newTicket.category){case"New":s=await l.facilityAccessApi.permanentBadgeAccess.createPermanentBadgeNewTicket({permanentBadgeAccessNewTicketRequest:xp(this.newTicket)});break;case"Modify":s=await l.facilityAccessApi.permanentBadgeAccess.createPermanentBadgeModifyTicket({permanentBadgeAccessModifyTicketRequest:Up(this.newTicket)});break;case"Terminate":s=await l.facilityAccessApi.permanentBadgeAccess.createPermanentBadgeTerminateTicket({permanentBadgeAccessTerminateTicketRequest:Hp(this.newTicket)});break;default:throw new Error("Invalid category")}this.submissionResult.ticketNumbers=s==null?void 0:s.ticketNumbers}catch(n){throw this.loadings.isSubmitting=!1,this.submissionResult.state=w.Error,await m(n,!1),n}try{if(s){k.failedAttachments=((t=this.newTicket.attachments)!==null&&t!==void 0?t:[]).map(o=>o.fileName);const{ticketNumbers:n}=s;n!=null&&n.length&&!((i=this.newTicket.attachments)===null||i===void 0)&&i.length&&await Promise.all(this.newTicket.attachments.map(async o=>Promise.all(n.map(async a=>Pt(y.FacilityAccess,o.file,o.fileName,o.fileType,a,this.newTicket.requestType))).then(()=>{var a;k.failedAttachments=((a=this.newTicket.attachments)!==null&&a!==void 0?a:[]).filter(r=>r.fileName!==o.fileName).map(r=>r.fileName)}))),this.newTicket.attachments=void 0}}catch(n){throw k.error.uploadingAttachments=!0,await m(n,!1),n}finally{this.submissionResult.state=w.Submitted,this.loadings.isSubmitting=!1}}mapPermanentBadgeTicketToUpdateRequest(){switch(this.newTicket.category){case"Modify":return Lp(this.newTicket);case"New":return Fp(this.newTicket);case"Terminate":return Vp();default:throw new Error("Invalid category")}}async setNewTicket(){try{this.newTicket=await zp(this.submissionResult.ticketResponse)||de.newTicket}catch(t){throw await m(t,!1),t}}async submitUpdateTicketRequest(){var t;let i;try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.ticketNumbers=void 0;try{i=await((t=l.facilityAccessApi.permanentBadgeAccess)===null||t===void 0?void 0:t.updatePermanentBadgeTicket({permanentBadgeAccessTicketUpdateRequest:this.mapPermanentBadgeTicketToUpdateRequest(),ticketId:this.newTicket.id})),this.submissionResult.ticketResponse=i,this.submissionResult.state=w.Submitted,this.submissionResult.ticketNumbers=[i.id]}catch(s){await m(s,!1)}try{await k.postAttachments(y.FacilityAccess,this.newTicket.attachments,this.newTicket.id,!0,"Permanent Badge"),this.newTicket.attachments=void 0}catch(s){await m(s,!1)}try{i&&(this.selectedTicket=await Gn(i),await this.setNewTicket())}catch(s){await m(s,!1)}}catch(s){throw await m(s,!1),this.submissionResult.state=w.Error,s}finally{this.loadings.isSubmitting=!1}}async getPermanentBadgeAccessServiceTicket(t){if(t)try{const i=await l.facilityAccessApi.permanentBadgeAccess.getPermanentBadgeTicketById({ticketId:t});this.submissionResult.ticketResponse=i,this.selectedTicket=await Gn(i),await this.setNewTicket()}catch(i){throw await m(i,!1),i}}async cancelTicket(t,i){try{k.loadings.isTicketCancelling=!0,k.error.cancellingTicket=!1,t&&(await l.facilityAccessApi.permanentBadgeAccess.cancellationPermanentBadgeRequest({ticketId:t,cancellationTicketsRequest:{cancellationReason:i}}).catch(s=>{throw m(s,!1),s}),await this.getPermanentBadgeAccessServiceTicket(t))}catch(s){throw k.error.cancellingTicket=!0,await m(s,!1),s}finally{k.loadings.isTicketCancelling=!1}}async hasUpdatePermissions(){try{return!!await Ke(this.selectedTicket.sitesDetails[0].locations.map(t=>t.id),S.PermanentBadge,U.Update)}catch(t){return!1}}async getAttachments(t,i){return Hn(y.FacilityAccess,t,i)}async getPermanentBadgeHolders(t,i,s=1,n=10){return await l.facilityAccessApi.permanentBadgeAccess.getPermanentBadgeHoldersList({accountNumber:this.newTicket.accountNumber,activeBadge:!0,nameOrEmailContains:t,page:s,size:n},i).catch(a=>{var r;!((r=i==null?void 0:i.signal)===null||r===void 0)&&r.aborted||m(a,!0)})||{items:[],totalCount:0}}clearNewTicket(){this.newTicket=de.newTicket}async patchLocationsApprovalStatus(t){var i,s,n;const o=t.map(a=>({id:a.id,approvalStatus:us[a.status]}));await((i=l.facilityAccessApi.permanentBadgeAccess)===null||i===void 0?void 0:i.updatePermanentBadgeLocationsTicket({ticketId:((s=this.selectedTicket)===null||s===void 0?void 0:s.id)||"",locationsPatchRequestInner:o}).catch(a=>{m(a,!1)})),await this.getPermanentBadgeAccessServiceTicket((n=this.selectedTicket)===null||n===void 0?void 0:n.id).catch(a=>{m(a,!1)})}clear(){this.newTicket=de.newTicket,this.selectedTicket=de.selectedTicket,this.submissionResult=de.submissionResult,this.loadings=de.loadings,this.isEditAttachmentAdded=de.isEditAttachmentAdded}}const Y=new Wp;function Gp(e){return e.flatMap(t=>t.locations.map(i=>({id:i.id,startDateTime:Be(i.startDate,i.startTime,t.site.siteId),endDateTime:Be(i.endDate,i.endTime,t.site.siteId)})))}async function Kn(e){var t,i,s;const{timeZone:n,id:o}=((t=J.sites)===null||t===void 0?void 0:t.find(d=>d.locationId===e.site))||{},a=o?await An(o):[],r=new Map(a.map(d=>{var u;return[d.id,(u=d.name)!==null&&u!==void 0?u:d.id]}));return[{site:new Oe(e.site,o,e.accountNumber),locations:(s=(i=e.locations)===null||i===void 0?void 0:i.map(d=>{var u,p,A,N;return{id:d.id,name:r.get(d.id)||d.id,site:o,startDate:d.startDateTime&&n?(u=G(d.startDateTime).tz(n))===null||u===void 0?void 0:u.format(ct):"-",startTime:d.startDateTime&&n?(p=G(d.startDateTime).tz(n))===null||p===void 0?void 0:p.format($t):"-",endDate:d.endDateTime&&n?(A=G(d.endDateTime).tz(n))===null||A===void 0?void 0:A.format(ct):"-",endTime:d.endDateTime&&n?(N=G(d.endDateTime).tz(n))===null||N===void 0?void 0:N.format($t):"-"}}))!==null&&s!==void 0?s:[]}]}async function Zp(e){const[t,i]=await Promise.all([Ze({locationType:F.Site,permissionType:S.OSPAccess,permissionPrivilege:e}),Ze({locationType:ut.GreaterThan+F.Site,permissionType:S.OSPAccess,permissionPrivilege:e,assignableProcess:"OSP_access"})]),s=new Set(i.map(n=>n.siteId));return t.sort((n,o)=>n.siteId>o.siteId?1:-1).map(n=>({...n,hasSpaces:s.has(n.siteId),accountNumber:n.accountNumber}))}const Kp=e=>({accountNumber:e.accountNumber,visitors:e.visitors.map(t=>({firstName:t.firstName,lastName:t.lastName,email:t.email,company:t.company,phone:t.phone,visitorType:t.visitorType})),locations:Gp(e.sitesDetails||[]),escortFirstName:e.escortFirstName,escortLastName:e.escortLastName,visitorHostFirstName:e.hostFirstName,visitorHostLastName:e.hostLastName,customerExternalReference:e.customerExternalReference,serviceImpactedDescription:e.serviceImpactDescription,workDescription:e.workDescription,notificationRecipients:e.contacts}),ue=(e,t)=>e===t||!e&&!t||!e&&t==="-",Yp=(e,t)=>{var i,s;const n={};ue(e.visitors[0].phone,t.visitors[0].phone)||(n.visitorPhone=e.visitors[0].phone),ue(e.visitors[0].company,t.visitors[0].company)||(n.visitorCompany=e.visitors[0].company),(!ue(e.escortFirstName,t.escortFirstName)||!ue(e.escortLastName,t.escortLastName))&&(n.escortFirstName=e.escortFirstName,n.escortLastName=e.escortLastName),(!ue(e.hostFirstName,t.visitorHostFirstName)||!ue(e.hostLastName,t.visitorHostLastName))&&(n.visitorHostFirstName=e.hostFirstName,n.visitorHostLastName=e.hostLastName),ue(e.customerExternalReference,t.customerExternalReference)||(n.customerExternalReference=e.customerExternalReference),ue(e.serviceImpactDescription,t.serviceImpactDescription)||(n.serviceImpactedDescription=e.serviceImpactDescription),ue(e.workDescription,t.workDescription)||(n.workDescription=e.workDescription),ue(e.contacts,t.notificationRecipients)||(n.otherNotificationRecipients=e.contacts);const o=((i=e.sitesDetails)===null||i===void 0?void 0:i.flatMap(d=>d.locations))||[],a=((s=t.sitesDetails)===null||s===void 0?void 0:s.flatMap(d=>d.locations))||[],r=o.map(d=>{var u,p;const A=a.find(b=>b.id===d.id),N={id:d.id};return(!A||!ue(d.startDate,A.startDate)||!ue(d.startTime,A.startTime))&&(N.startDateTime=Be(d.startDate,d.startTime,(u=e.sitesDetails)===null||u===void 0?void 0:u[0].site.siteId)),(!A||!ue(d.endDate,A.endDate)||!ue(d.endTime,A.endTime))&&(N.endDateTime=Be(d.endDate,d.endTime,(p=e.sitesDetails)===null||p===void 0?void 0:p[0].site.siteId)),N}).filter(d=>d.startDateTime||d.endDateTime);return r.length&&(n.locations=r),Object.keys(n).length===0&&(n.visitorCompany=e.visitors[0].company),n},Yn=async e=>{var t;return{id:e.id||"-",state:e.status||"-",requester:e.createdBy||"-",createdOn:e.createdAt||"-",updatedOn:e.updatedAt||"-",requestType:"OSP Access",visitors:[{firstName:e.visitorFirstName||"-",lastName:e.visitorLastName||"-",email:e.visitorEmail||"-",phone:e.visitorPhone||"-",company:e.visitorCompany||"-",visitorType:e.visitorType}],visitorType:e.visitorType||"-",escortFirstName:e.escortFirstName||"-",escortLastName:e.escortLastName||"-",visitorHostFirstName:e.visitorHostFirstName||"-",visitorHostLastName:e.visitorHostLastName||"-",site:e.site||"-",sitesDetails:await Kn(e),customerExternalReference:e.customerExternalReference||"-",serviceImpacted:e.serviceImpactedDescription?"Yes":"No",serviceImpactDescription:e.serviceImpactedDescription||"-",workDescription:e.workDescription||"-",notificationRecipients:e.notificationRecipients||"",cancellationReason:e.cancellationReason||"-",comments:(t=e.comments)===null||t===void 0?void 0:t.map(i=>M(i))}},Xp=async e=>{var t,i,s,n,o;if(e)return{isVisitorContactsDetailsValid:!0,isVisitorEscortedDetailsValid:!0,isVisitorHostValid:!0,isRequestedAccessDetailsValid:!0,isServiceImpactedSectionValid:!0,isNotificationsAttachmentsValid:!0,accountNumber:(t=e.accountNumber)!==null&&t!==void 0?t:"",status:e.status,requestType:"OSP Access",category:"",visitors:[{firstName:(i=e.visitorFirstName)!==null&&i!==void 0?i:"",lastName:(s=e.visitorLastName)!==null&&s!==void 0?s:"",email:(n=e.visitorEmail)!==null&&n!==void 0?n:"",company:e.visitorCompany,phone:(o=e.visitorPhone)!==null&&o!==void 0?o:"",visitorType:e.visitorType}],isEscortedVisitor:!0,escortFirstName:e.escortFirstName,escortLastName:e.escortLastName,hostFirstName:e.visitorHostFirstName,hostLastName:e.visitorHostLastName,visitorBadge:"Standard",sitesDetails:await Kn(e),contacts:e.notificationRecipients,customerExternalReference:e.customerExternalReference,isServiceImpacted:!!e.serviceImpactedDescription,serviceImpactDescription:e.serviceImpactedDescription,workDescription:e.workDescription,termsAgreed:!0,id:e.id,attachments:[]}},Qp=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}}),me={newTicket:{isVisitorContactsDetailsValid:!1,isVisitorEscortedDetailsValid:!1,isVisitorHostValid:!1,isRequestedAccessDetailsValid:!1,isServiceImpactedSectionValid:!1,isNotificationsAttachmentsValid:!1,accountNumber:"",visitors:[],contacts:"",attachments:[],startDate:void 0,endDate:void 0,sitesDetails:void 0,visitorBadge:"Standard",serviceType:void 0,isEscortedVisitor:!0,escortFirstName:void 0,escortLastName:void 0,hostCompany:void 0,hostFirstName:void 0,hostLastName:void 0},selectedTicket:void 0,submissionResult:{state:w.Default,ticketNumbers:[],ticketResponse:void 0},loadings:{isSubmitting:!1,facilityAccessTicket:!1},isEditAttachmentAdded:!1};class Xn{constructor(){this.newTicket=me.newTicket,this.submissionResult=me.submissionResult,this.selectedTicket=me.selectedTicket,this.loadings=me.loadings,this.isEditAttachmentAdded=me.isEditAttachmentAdded,se(this)}async setNewTicket(){var t;try{this.newTicket=(t=await Xp(this.submissionResult.ticketResponse))!==null&&t!==void 0?t:me.newTicket}catch(i){throw await m(i,!1),i}}async getOSPAccessServiceTicket(t){if(t)try{const i=await l.facilityAccessApi.ospAccess.getOspAccessTicketById({ticketId:t});this.submissionResult.ticketResponse=i,this.selectedTicket=await Yn(i),await this.setNewTicket()}catch(i){throw await m(i,!1),i}}createTicket(){var t;const i=(t=this.newTicket.accountNumber)!==null&&t!==void 0?t:ae.getUserAccount().accountNumber;this.newTicket={...me.newTicket,accountNumber:i,requestType:"OSP Access",category:""},this.submissionResult=me.submissionResult}isNotificationsAttachmentsValid(t){this.newTicket.isNotificationsAttachmentsValid=t}updateAttachments(t){var i;(i=this.newTicket.attachments)===null||i===void 0||i.push(...t)}updateIsEscortedVisitor(t){this.newTicket.isEscortedVisitor=t,t?this.newTicket.visitorBadge=void 0:(this.newTicket.escortFirstName=void 0,this.newTicket.escortLastName=void 0,this.newTicket.visitorBadge===void 0&&(this.newTicket.visitorBadge="Standard"))}updateVisitorHost(t,i){var s;const n=(s=this.newTicket.sitesDetails)===null||s===void 0?void 0:s.find(o=>o.site.siteId===t);n&&(n.visitorHost=i,n.isVisitorHostDetailsValid=!0)}updateEscortFirstName(t){this.newTicket.escortFirstName=t}updateEscortLastName(t){this.newTicket.escortLastName=t}addOrUpdateVisitor(t){var i;if(t)if(this.newTicket.id)this.newTicket.visitors=[t];else{const s=((i=this.newTicket.visitors)!==null&&i!==void 0?i:[]).filter(n=>n.id!==t.id);this.newTicket.visitors=[...s,t]}}removeVisitor(t){var i;if(t){const s=((i=this.newTicket.visitors)!==null&&i!==void 0?i:[]).filter(n=>n.id!==t.id);this.newTicket.visitors=[...s]}}updateHostFirstName(t){this.newTicket.hostFirstName=t}updateHostLastName(t){this.newTicket.hostLastName=t}updateVisitorBadge(t){this.newTicket.visitorBadge=t}updateTermsAgreed(t){this.newTicket.termsAgreed=t}async addSiteLocations(t){var i;if(t){const s=((i=this.newTicket.sitesDetails)!==null&&i!==void 0?i:[]).filter(n=>n.site.siteId!==t.site.siteId);this.newTicket.sitesDetails=[...s,t]}}removeSiteLocations(t){var i;if(t){const s=((i=this.newTicket.sitesDetails)!==null&&i!==void 0?i:[]).filter(n=>n.site.siteId!==t.site.siteId);this.newTicket.sitesDetails=[...s]}}updateContacts(t){this.newTicket.contacts=t}async submitNewTicketRequest(){var t,i;let s;this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.ticketNumbers=void 0;try{s=await l.facilityAccessApi.ospAccess.createOspAccessTicket({oSPAccessTicketRequest:Kp(this.newTicket)}),this.submissionResult.ticketNumbers=s==null?void 0:s.ticketNumbers}catch(n){throw this.loadings.isSubmitting=!1,this.submissionResult.state=w.Error,await m(n,!1),n}try{if(s){k.failedAttachments=((t=this.newTicket.attachments)!==null&&t!==void 0?t:[]).map(o=>o.fileName);const{ticketNumbers:n}=s;n!=null&&n.length&&!((i=this.newTicket.attachments)===null||i===void 0)&&i.length&&await Promise.all(this.newTicket.attachments.map(async o=>Promise.all(n.map(async a=>Pt(y.FacilityAccess,o.file,o.fileName,o.fileType,a,this.newTicket.requestType))).then(()=>{var a;k.failedAttachments=((a=this.newTicket.attachments)!==null&&a!==void 0?a:[]).filter(r=>r.fileName!==o.fileName).map(r=>r.fileName)}))),this.newTicket.attachments=void 0}}catch(n){throw k.error.uploadingAttachments=!0,await m(n,!1),n}finally{this.submissionResult.state=w.Submitted,this.loadings.isSubmitting=!1}}async submitUpdateTicketRequest(){let t;try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.ticketNumbers=void 0;try{t=await l.facilityAccessApi.ospAccess.updateOspAccessTicket({oSPAccessTicketUpdateRequest:Yp(this.newTicket,this.selectedTicket),ticketId:this.newTicket.id}),this.submissionResult.ticketResponse=t,this.submissionResult.state=w.Submitted,this.submissionResult.ticketNumbers=[t==null?void 0:t.id]}catch(i){this.submissionResult.state=w.Error,await m(i,!1)}try{await k.postAttachments(y.FacilityAccess,this.newTicket.attachments,this.newTicket.id,!0,"OSP Access"),this.newTicket.attachments=void 0}catch(i){await m(i,!1)}try{t&&(this.selectedTicket=await Yn(t))}catch(i){await m(i,!1)}}catch(i){throw await m(i,!1),i}finally{this.loadings.isSubmitting=!1}}updateFieldValue(t,i){this.newTicket[t]=i}isVisitorContactsValid(t){this.newTicket.isVisitorContactsDetailsValid=t}isEscortedDetailsValid(t){this.newTicket.isVisitorEscortedDetailsValid=t}isRequestedAccessDetailsValid(t){this.newTicket.isRequestedAccessDetailsValid=t}addBulkVisitors(t){throw new Error("Method not implemented.")}removeBulkVisitors(){throw new Error("Method not implemented.")}removeBulkAttachment(){throw new Error("Method not implemented.")}removeAllVisitors(){this.newTicket.visitors=[]}async hasUpdatePermissions(){var t;try{return await bn((t=this.selectedTicket)===null||t===void 0?void 0:t.site)}catch(i){return!1}}async cancelTicket(t){var i;try{k.loadings.isTicketCancelling=!0,!((i=this.selectedTicket)===null||i===void 0)&&i.id&&(await l.facilityAccessApi.ospAccess.cancellationOspAccessRequest({ticketId:this.selectedTicket.id,cancellationTicketsRequest:{cancellationReason:t}}),await this.getOSPAccessServiceTicket(this.selectedTicket.id))}catch(s){throw await m(s,!1),s}finally{k.loadings.isTicketCancelling=!1}}get isNewTicketValid(){const t=this.newTicket.isVisitorContactsDetailsValid,i=this.newTicket.isVisitorEscortedDetailsValid,s=this.newTicket.isVisitorHostValid,n=this.newTicket.isRequestedAccessDetailsValid,o=this.newTicket.isServiceImpactedSectionValid,a=this.newTicket.isNotificationsAttachmentsValid;return t&&i&&s&&n&&o&&a}clear(){this.newTicket=me.newTicket,this.selectedTicket=me.selectedTicket,this.submissionResult=me.submissionResult,this.loadings=me.loadings,this.isEditAttachmentAdded=me.isEditAttachmentAdded}}const Se=new Xn;function eh(e){return e.flatMap(t=>t.locations.map(i=>({id:i.id,startDateTime:Be(i.startDate,i.startTime,t.site.siteId),endDateTime:Be(i.endDate,i.endTime,t.site.siteId)})))}async function Qn(e){var t,i,s,n;const{timeZone:o,id:a}=(i=(t=J.sites)===null||t===void 0?void 0:t.find(u=>u.locationId===e.site))!==null&&i!==void 0?i:{},r=a?await _n(a):[],d=new Map(r.map(u=>{var p;return[u.id,(p=u.name)!==null&&p!==void 0?p:u.id]}));return[{site:new Oe(e.site,a,e.accountNumber),locations:(n=(s=e.locations)===null||s===void 0?void 0:s.map(u=>{var p,A,N,b;return{id:u.id,name:d.get(u.id)||u.id,site:a,startDate:u.startDateTime&&o?(p=G(u.startDateTime).tz(o))===null||p===void 0?void 0:p.format(ct):"-",startTime:u.startDateTime&&o?(A=G(u.startDateTime).tz(o))===null||A===void 0?void 0:A.format($t):"-",endDate:u.endDateTime&&o?(N=G(u.endDateTime).tz(o))===null||N===void 0?void 0:N.format(ct):"-",endTime:u.endDateTime&&o?(b=G(u.endDateTime).tz(o))===null||b===void 0?void 0:b.format($t):"-"}}))!==null&&n!==void 0?n:[]}]}async function th(e){const[t,i]=await Promise.all([Ze({locationType:F.Site,permissionType:S.POPPOEAccess,permissionPrivilege:e}),Ze({locationType:ut.GreaterThan+F.Site,permissionType:S.POPPOEAccess,permissionPrivilege:e,assignableProcess:"POP_access"})]),s=new Set(i.map(n=>n.siteId));return t.sort((n,o)=>n.siteId>o.siteId?1:-1).map(n=>({...n,hasSpaces:s.has(n.siteId),accountNumber:n.accountNumber}))}const Ei=e=>{var t;return(t=e==null?void 0:e.map(i=>{var s,n,o,a,r,d,u,p,A,N,b,C;return{sideAName:(s=i.sideAName)!==null&&s!==void 0?s:"",sideARoomNumber:(n=i.sideARoomNumber)!==null&&n!==void 0?n:"",sideARackNumber:(o=i.sideARackNumber)!==null&&o!==void 0?o:"",sideAPanelNumber:(a=i.sideAPanelNumber)!==null&&a!==void 0?a:"",sideAPort1:(r=i.sideAPort)!==null&&r!==void 0?r:"",sideACarrierCircuitId:(d=i.sideACarrierCircuitID)!==null&&d!==void 0?d:"",sideBName:(u=i.sideZName)!==null&&u!==void 0?u:"",sideBRoomNumber:(p=i.sideZRoomNumber)!==null&&p!==void 0?p:"",sideBRackNumber:(A=i.sideZRackNumber)!==null&&A!==void 0?A:"",sideBPanelNumber:(N=i.sideZPanelNumber)!==null&&N!==void 0?N:"",sideBPort1:(b=i.sideZPort)!==null&&b!==void 0?b:"",sideBCarrierCircuitId:(C=i.sideZCarrierCircuitID)!==null&&C!==void 0?C:""}}))!==null&&t!==void 0?t:[]},ea=e=>!e||e.length===1&&!e[0].rack&&!e[0].cabinet?[]:e.map(t=>{var i,s;return{rack:(i=t.rack)!==null&&i!==void 0?i:"",cabinet:(s=t.cabinet)!==null&&s!==void 0?s:""}}),ih=e=>({accountNumber:e.accountNumber,visitors:e.visitors.map(t=>({firstName:t.firstName,lastName:t.lastName,email:t.email,company:t.company,phone:t.phone,visitorType:t.visitorType})),locations:eh(e.sitesDetails||[]),escortFirstName:e.escortFirstName,escortLastName:e.escortLastName,visitorHostFirstName:e.hostFirstName,visitorHostLastName:e.hostLastName,customerExternalReference:e.customerExternalReference,serviceImpactedDescription:e.serviceImpactDescription,serviceDetails:{serviceType:e.serviceType,scope:e.scope,circuits:Ei(e.circuits),workDescription:e.descriptionOfWork},ppopSpace:ea(e.ppopSpaces),spopSpace:ea(e.spopSpaces),ppopRoomWork:e.isPpopCableRunOutside?{ppopSpaceFrom:e.ppopFromRackPanel,ppopSpaceTo:e.ppopToRackPanel,cableType:e.ppopCableType,onLadderRack:e.ppopLadderRack,inInnerDuct:e.ppopInnerDuct,inFiberGuide:e.ppopFiberGuide}:void 0,spopRoomWork:e.isSpopCableRunOutside?{spopSpaceFrom:e.spopFromRackPanel,spopSpaceTo:e.spopToRackPanel,cableType:e.spopCableType,onLadderRack:e.spopLadderRack,inInnerDuct:e.spopInnerDuct,inFiberGuide:e.spopFiberGuide}:void 0,notificationRecipients:e.contacts}),ta=e=>(e==null?void 0:e.map(t=>({sideAName:t.sideAName||"-",sideARoomNumber:t.sideARoomNumber||"-",sideARackNumber:t.sideARackNumber||"-",sideAPanelNumber:t.sideAPanelNumber||"-",sideAPort:t.sideAPort1||"-",sideACarrierCircuitID:t.sideACarrierCircuitId||"-",sideZName:t.sideBName||"-",sideZRoomNumber:t.sideBRoomNumber||"-",sideZRackNumber:t.sideBRackNumber||"-",sideZPanelNumber:t.sideBPanelNumber||"-",sideZPort:t.sideBPort1||"-",sideZCarrierCircuitID:t.sideBCarrierCircuitId||"-"})))||[],ia=async e=>{var t,i,s,n,o,a,r,d,u,p,A,N,b,C,x,et,tt,it,st,nt,at;return{id:e.id||"-",state:e.status||"-",requester:e.createdBy||"-",createdOn:e.createdAt||"-",updatedOn:e.updatedAt||"-",requestType:"PoP/POE Access",visitors:[{firstName:e.visitorFirstName||"-",lastName:e.visitorLastName||"-",email:e.visitorEmail||"-",phone:e.visitorPhone||"-",company:e.visitorCompany||"-",visitorType:e.visitorType}],visitorType:e.visitorType||"-",escortFirstName:e.escortFirstName||"-",escortLastName:e.escortLastName||"-",visitorHostFirstName:e.visitorHostFirstName||"-",visitorHostLastName:e.visitorHostLastName||"-",visitorHostCompany:e.visitorHostCompany||"-",site:e.site||"-",sitesDetails:await Qn(e),customerExternalReference:e.customerExternalReference||"-",isServiceImpacted:!!e.serviceImpactedDescription,serviceImpactDescription:e.serviceImpactedDescription||"-",serviceType:((t=e.serviceDetails)===null||t===void 0?void 0:t.serviceType)||"-",scope:((i=e.serviceDetails)===null||i===void 0?void 0:i.scope)||"-",isCrossConnectPatchCableInstallationOrRemoval:!!(!((n=(s=e.serviceDetails)===null||s===void 0?void 0:s.circuits)===null||n===void 0)&&n.length),workDescription:((o=e.serviceDetails)===null||o===void 0?void 0:o.workDescription)||"-",circuits:ta((a=e.serviceDetails)===null||a===void 0?void 0:a.circuits),ppopSpaces:((r=e.ppopSpace)===null||r===void 0?void 0:r.map(ge=>({rack:ge.rack||"",cabinet:ge.cabinet||""})))||[],spopSpaces:((d=e.spopSpace)===null||d===void 0?void 0:d.map(ge=>({rack:ge.rack||"",cabinet:ge.cabinet||""})))||[],isPpopCableRunOutside:!!e.ppopRoomWork&&Object.keys(e.ppopRoomWork).length>0,ppopFromRackPanel:((u=e.ppopRoomWork)===null||u===void 0?void 0:u.ppopSpaceFrom)||"-",ppopToRackPanel:((p=e.ppopRoomWork)===null||p===void 0?void 0:p.ppopSpaceTo)||"-",ppopCableType:((A=e.ppopRoomWork)===null||A===void 0?void 0:A.cableType)||"-",ppopLadderRack:(N=e.ppopRoomWork)===null||N===void 0?void 0:N.onLadderRack,ppopInnerDuct:(b=e.ppopRoomWork)===null||b===void 0?void 0:b.inInnerDuct,ppopFiberGuide:(C=e.ppopRoomWork)===null||C===void 0?void 0:C.inFiberGuide,isSpopCableRunOutside:!!(e.spopRoomWork&&Object.keys(e.spopRoomWork).length>0),spopFromRackPanel:((x=e.spopRoomWork)===null||x===void 0?void 0:x.spopSpaceFrom)||"-",spopToRackPanel:((et=e.spopRoomWork)===null||et===void 0?void 0:et.spopSpaceTo)||"-",spopCableType:((tt=e.spopRoomWork)===null||tt===void 0?void 0:tt.cableType)||"-",spopLadderRack:(it=e.spopRoomWork)===null||it===void 0?void 0:it.onLadderRack,spopInnerDuct:(st=e.spopRoomWork)===null||st===void 0?void 0:st.inInnerDuct,spopFiberGuide:(nt=e.spopRoomWork)===null||nt===void 0?void 0:nt.inFiberGuide,notificationRecipients:e.notificationRecipients||"",cancellationReason:e.cancellationReason||"-",comments:(at=e.comments)===null||at===void 0?void 0:at.map(ge=>M(ge))}},sh=async e=>{var t,i,s,n,o,a,r,d,u,p,A,N,b,C,x,et,tt,it,st,nt,at,ge,pi,hi,vi;if(e)return{isVisitorContactsDetailsValid:!0,isVisitorEscortedDetailsValid:!0,isVisitorHostValid:!0,isRequestedAccessDetailsValid:!0,isNotificationsAttachmentsValid:!0,isPopRequestedAccessValid:!0,accountNumber:(t=e.accountNumber)!==null&&t!==void 0?t:"",status:e.status,requestType:"PoP/POE Access",category:"",id:e.id,visitors:[{firstName:(i=e.visitorFirstName)!==null&&i!==void 0?i:"",lastName:(s=e.visitorLastName)!==null&&s!==void 0?s:"",email:(n=e.visitorEmail)!==null&&n!==void 0?n:"",company:e.visitorCompany,phone:(o=e.visitorPhone)!==null&&o!==void 0?o:"",visitorType:e.visitorType}],isEscortedVisitor:!0,escortFirstName:e.escortFirstName,escortLastName:e.escortLastName,sitesDetails:await Qn(e),hostFirstName:e.visitorHostFirstName,hostLastName:e.visitorHostLastName,customerExternalReference:e.customerExternalReference,isServiceImpacted:!!e.serviceImpactedDescription,serviceImpactDescription:e.serviceImpactedDescription,termsAgreed:!0,serviceType:(a=e.serviceDetails)===null||a===void 0?void 0:a.serviceType,scope:(r=e.serviceDetails)===null||r===void 0?void 0:r.scope,isCrossConnectInstallation:!!(!((u=(d=e.serviceDetails)===null||d===void 0?void 0:d.circuits)===null||u===void 0)&&u.length),descriptionOfWork:(p=e.serviceDetails)===null||p===void 0?void 0:p.workDescription,circuits:ta((A=e.serviceDetails)===null||A===void 0?void 0:A.circuits),ppopSpaces:((N=e.ppopSpace)===null||N===void 0?void 0:N.map(Tt=>({rack:Tt.rack||"",cabinet:Tt.cabinet||""})))||[],spopSpaces:((b=e.spopSpace)===null||b===void 0?void 0:b.map(Tt=>({rack:Tt.rack||"",cabinet:Tt.cabinet||""})))||[],isPpopCableRunOutside:!!e.ppopRoomWork&&Object.keys(e.ppopRoomWork).length>0,ppopFromRackPanel:(C=e.ppopRoomWork)===null||C===void 0?void 0:C.ppopSpaceFrom,ppopToRackPanel:(x=e.ppopRoomWork)===null||x===void 0?void 0:x.ppopSpaceTo,ppopCableType:(et=e.ppopRoomWork)===null||et===void 0?void 0:et.cableType,ppopLadderRack:(tt=e.ppopRoomWork)===null||tt===void 0?void 0:tt.onLadderRack,ppopInnerDuct:(it=e.ppopRoomWork)===null||it===void 0?void 0:it.inInnerDuct,ppopFiberGuide:(st=e.ppopRoomWork)===null||st===void 0?void 0:st.inFiberGuide,isSpopCableRunOutside:!!(e.spopRoomWork&&Object.keys(e.spopRoomWork).length>0),spopFromRackPanel:(nt=e.spopRoomWork)===null||nt===void 0?void 0:nt.spopSpaceFrom,spopToRackPanel:(at=e.spopRoomWork)===null||at===void 0?void 0:at.spopSpaceTo,spopCableType:(ge=e.spopRoomWork)===null||ge===void 0?void 0:ge.cableType,spopLadderRack:(pi=e.spopRoomWork)===null||pi===void 0?void 0:pi.onLadderRack,spopInnerDuct:(hi=e.spopRoomWork)===null||hi===void 0?void 0:hi.inInnerDuct,spopFiberGuide:(vi=e.spopRoomWork)===null||vi===void 0?void 0:vi.inFiberGuide,contacts:e.notificationRecipients,attachments:[]}},nh=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}}),He=(e,t)=>(e!=null?e:!1)!==(t!=null?t:!1),B=(e,t)=>!(e===t||!e&&!t||!e&&t==="-"),ah=(e,t)=>B(e.sideAName,t.sideAName)||B(e.sideARoomNumber,t.sideARoomNumber)||B(e.sideARackNumber,t.sideARackNumber)||B(e.sideAPanelNumber,t.sideAPanelNumber)||B(e.sideAPort,t.sideAPort)||B(e.sideACarrierCircuitID,t.sideACarrierCircuitID)||B(e.sideZName,t.sideZName)||B(e.sideZRoomNumber,t.sideZRoomNumber)||B(e.sideZRackNumber,t.sideZRackNumber)||B(e.sideZPanelNumber,t.sideZPanelNumber)||B(e.sideZPort,t.sideZPort)||B(e.sideZCarrierCircuitID,t.sideZCarrierCircuitID),oh=(e,t)=>{if(e===void 0)return t.length!==0;if(e.length!==t.length)return!0;for(let i=0;i<e.length;i++)if(ah(e[i],t[i]))return!0;return!1},sa=(e,t)=>{if(e===void 0&&!(t!=null&&t.length))return!1;if(!e||!t||e.length!==t.length)return!0;for(let i=0;i<e.length;i++)if(B(e[i].rack,t[i].rack)||B(e[i].cabinet,t[i].cabinet))return!0;return!1},rh=(e,t)=>{var i,s;const n={};B(e.visitors[0].company,t.visitors[0].company)&&(n.visitorCompany=e.visitors[0].company),(B(e.escortFirstName,t.escortFirstName)||B(e.escortLastName,t.escortLastName))&&(n.escortFirstName=e.escortFirstName,n.escortLastName=e.escortLastName);const o=((i=e.sitesDetails)===null||i===void 0?void 0:i.flatMap(d=>d.locations.map(u=>({id:u.id,startDate:u.startDate,startTime:u.startTime,endDate:u.endDate,endTime:u.endTime,siteId:d.site.siteId}))))||[],a=((s=t.sitesDetails)===null||s===void 0?void 0:s.flatMap(d=>d.locations))||[],r=o.map(d=>{const u=a.find(A=>A.id===d.id),p={id:d.id};return(!u||B(d.startDate,u.startDate)||B(d.startTime,u.startTime)||B(d.endDate,u.endDate)||B(d.endTime,u.endTime))&&(p.startDateTime=Be(d.startDate,d.startTime,d.siteId),p.endDateTime=Be(d.endDate,d.endTime,d.siteId)),p}).filter(d=>d.startDateTime&&d.endDateTime);if(r.length&&(n.locations=r),(B(e.hostFirstName,t.visitorHostFirstName)||B(e.hostLastName,t.visitorHostLastName))&&(n.visitorHostFirstName=e.hostFirstName,n.visitorHostLastName=e.hostLastName),He(e.isServiceImpacted,t.isServiceImpacted)&&e.isServiceImpacted===!1&&(n.serviceImpactedDescription=""),B(e.serviceImpactDescription,t.serviceImpactDescription)&&(n.serviceImpactedDescription=e.serviceImpactDescription),n.serviceDetails={},B(e.serviceType,t.serviceType))switch(n.serviceDetails.serviceType=e.serviceType,e.serviceType){case We.SiteSurvey:case We.Testing:n.serviceDetails.scope=e.scope,n.serviceDetails.workDescription="",n.serviceDetails.circuits=[];break;case We.InstallationDeInstallationWork:n.serviceDetails.scope="",n.serviceDetails.workDescription=e.descriptionOfWork,n.serviceDetails.circuits=Ei(e.circuits);break;default:throw new Error("Unsupported service type for update")}else switch(e.serviceType){case We.SiteSurvey:case We.Testing:B(e.scope,t.scope)&&(n.serviceDetails.scope=e.scope);break;case We.InstallationDeInstallationWork:B(e.descriptionOfWork,t.workDescription)&&(n.serviceDetails.workDescription=e.descriptionOfWork),oh(e.circuits,t.circuits)&&(n.serviceDetails.circuits=Ei(e.circuits));break;default:throw new Error("Unsupported service type for update")}return Object.keys(n.serviceDetails).length===0&&delete n.serviceDetails,sa(e.ppopSpaces,t.ppopSpaces)&&(n.ppopSpace=e.ppopSpaces),sa(e.spopSpaces,t.spopSpaces)&&(n.spopSpace=e.spopSpaces),e.isPpopCableRunOutside?(n.ppopRoomWork={},B(e.ppopFromRackPanel,t.ppopFromRackPanel)&&(n.ppopRoomWork.ppopSpaceFrom=e.ppopFromRackPanel),B(e.ppopToRackPanel,t.ppopToRackPanel)&&(n.ppopRoomWork.ppopSpaceTo=e.ppopToRackPanel),B(e.ppopCableType,t.ppopCableType)&&(n.ppopRoomWork.cableType=e.ppopCableType),He(e.ppopLadderRack,t.ppopLadderRack)&&(n.ppopRoomWork.onLadderRack=e.ppopLadderRack),He(e.ppopInnerDuct,t.ppopInnerDuct)&&(n.ppopRoomWork.inInnerDuct=e.ppopInnerDuct),He(e.ppopFiberGuide,t.ppopFiberGuide)&&(n.ppopRoomWork.inFiberGuide=e.ppopFiberGuide),Object.keys(n.ppopRoomWork).length===0&&delete n.ppopRoomWork):He(e.isPpopCableRunOutside,t.isPpopCableRunOutside)&&(n.ppopRoomWork=null),e.isSpopCableRunOutside?(n.spopRoomWork={},B(e.spopFromRackPanel,t.spopFromRackPanel)&&(n.spopRoomWork.spopSpaceFrom=e.spopFromRackPanel),B(e.spopToRackPanel,t.spopToRackPanel)&&(n.spopRoomWork.spopSpaceTo=e.spopToRackPanel),B(e.spopCableType,t.spopCableType)&&(n.spopRoomWork.cableType=e.spopCableType),He(e.spopLadderRack,t.spopLadderRack)&&(n.spopRoomWork.onLadderRack=e.spopLadderRack),He(e.spopInnerDuct,t.spopInnerDuct)&&(n.spopRoomWork.inInnerDuct=e.spopInnerDuct),He(e.spopFiberGuide,t.spopFiberGuide)&&(n.spopRoomWork.inFiberGuide=e.spopFiberGuide),Object.keys(n.spopRoomWork).length===0&&delete n.spopRoomWork):He(e.isSpopCableRunOutside,t.isSpopCableRunOutside)&&(n.spopRoomWork=null),B(e.visitors[0].phone,t.visitors[0].phone)&&(n.visitorPhone=e.visitors[0].phone),B(e.customerExternalReference,t.customerExternalReference)&&(n.customerExternalReference=e.customerExternalReference),B(e.contacts,t.notificationRecipients)&&(n.notificationRecipients=e.contacts),Object.keys(n).length===0&&(n.visitorCompany=e.visitors[0].company),n},pe={newTicket:{isVisitorContactsDetailsValid:!1,isVisitorEscortedDetailsValid:!1,isVisitorHostValid:!1,isRequestedAccessDetailsValid:!1,isPopRequestedAccessValid:!1,isPPopRoomWorkValid:!1,isSPopRoomWorkValid:!1,isNotificationsAttachmentsValid:!1,accountNumber:"",visitors:[],contacts:"",attachments:[],startDate:void 0,endDate:void 0,sitesDetails:void 0,visitorBadge:"Standard",serviceType:void 0,isEscortedVisitor:!0,escortFirstName:void 0,escortLastName:void 0,hostCompany:void 0,hostFirstName:void 0,hostLastName:void 0,ppopSpaces:[{}],spopSpaces:[{}]},selectedTicket:void 0,submissionResult:{state:w.Default,ticketNumbers:[],popAccessResponse:void 0},loadings:{isSubmitting:!1,facilityAccessTicket:!1},isEditAttachmentAdded:!1};class na{constructor(){this.newTicket=pe.newTicket,this.submissionResult=pe.submissionResult,this.selectedTicket=pe.selectedTicket,this.loadings=pe.loadings,this.isEditAttachmentAdded=pe.isEditAttachmentAdded,se(this)}createTicket(){var t,i;const s=(t=this.newTicket.accountNumber)!==null&&t!==void 0?t:ae.getUserAccount().accountNumber;this.newTicket={...pe.newTicket,accountNumber:s,requestType:"PoP/POE Access",category:"",serviceBackend:(i=this.newTicket.serviceBackend)!==null&&i!==void 0?i:void 0},this.submissionResult=pe.submissionResult}async setNewTicket(){try{this.newTicket=await sh(this.submissionResult.ticketResponse),this.newTicket||(this.newTicket=pe.newTicket)}catch(t){throw await m(t,!1),t}}async getPOPAccessServiceTicket(t){if(t)try{const i=await l.facilityAccessApi.popAccess.getPopAccessTicketById({ticketId:t});this.submissionResult.ticketResponse=i,this.selectedTicket=await ia(i)}catch(i){throw await m(i,!1),i}}async hasUpdatePermissions(){var t;try{return await Rn((t=this.selectedTicket)===null||t===void 0?void 0:t.site)}catch(i){return!1}}isNotificationsAttachmentsValid(t){this.newTicket.isNotificationsAttachmentsValid=t}updateAttachments(t){var i;(i=this.newTicket.attachments)===null||i===void 0||i.push(...t)}updateIsEscortedVisitor(t){this.newTicket.isEscortedVisitor=t,t?this.newTicket.visitorBadge=void 0:(this.newTicket.escortFirstName=void 0,this.newTicket.escortLastName=void 0,this.newTicket.visitorBadge===void 0&&(this.newTicket.visitorBadge="Standard"))}updateVisitorHost(t,i){var s;const n=(s=this.newTicket.sitesDetails)===null||s===void 0?void 0:s.find(o=>o.site.siteId===t);n&&(n.visitorHost=i,n.isVisitorHostDetailsValid=!0)}updateEscortFirstName(t){this.newTicket.escortFirstName=t}updateEscortLastName(t){this.newTicket.escortLastName=t}addVisitor(t){var i;if(t)if(this.newTicket.id)this.newTicket.visitors=[t];else{const s=((i=this.newTicket.visitors)!==null&&i!==void 0?i:[]).filter(n=>n.id!==t.id);this.newTicket.visitors=[...s,t]}}removeVisitor(t){var i;if(t){const s=((i=this.newTicket.visitors)!==null&&i!==void 0?i:[]).filter(n=>n.id!==t.id);this.newTicket.visitors=[...s]}}addOrUpdateVisitor(t){var i;if(t)if(this.newTicket.id)this.newTicket.visitors=[t];else{const s=((i=this.newTicket.visitors)!==null&&i!==void 0?i:[]).filter(n=>n.id!==t.id);this.newTicket.visitors=[...s,t]}}updateHostFirstName(t){this.newTicket.hostFirstName=t}updateHostLastName(t){this.newTicket.hostLastName=t}updateVisitorBadge(t){this.newTicket.visitorBadge=t}updateTermsAgreed(t){this.newTicket.termsAgreed=t}updateStartDate(t){var i;this.newTicket.startDate=t,(i=this.newTicket.sitesDetails)===null||i===void 0||i.forEach(s=>{s.locations.forEach(n=>{n.startDate=t})})}updateEndDate(t){var i;this.newTicket.endDate=t,(i=this.newTicket.sitesDetails)===null||i===void 0||i.forEach(s=>{s.locations.forEach(n=>{n.endDate=t})})}async addSiteLocations(t){var i;if(t){const s=((i=this.newTicket.sitesDetails)!==null&&i!==void 0?i:[]).filter(n=>n.site.siteId!==t.site.siteId);this.newTicket.sitesDetails=[...s,t]}}removeSiteLocations(t){var i;if(t){const s=((i=this.newTicket.sitesDetails)!==null&&i!==void 0?i:[]).filter(n=>n.site.siteId!==t.site.siteId);this.newTicket.sitesDetails=[...s]}}updateContacts(t){this.newTicket.contacts=t}async submitNewTicketRequest(){var t;this.resetSubmission();try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.ticketNumbers=void 0;const i=await l.facilityAccessApi.popAccess.createPopAccessTicket({pOPAccessTicketRequest:ih(this.newTicket)}).catch(s=>{throw m(s,!1),this.submissionResult.state=w.Error,s});if(i){const{ticketNumbers:s}=i;s!=null&&s.length&&!((t=this.newTicket.attachments)===null||t===void 0)&&t.length&&await Promise.all(s.map(async n=>{await k.postAttachments(y.FacilityAccess,this.newTicket.attachments,n,!1,"PoP/POE Access")})),this.newTicket.attachments=void 0,this.submissionResult.state=w.Submitted,this.submissionResult.ticketNumbers=i==null?void 0:i.ticketNumbers}}catch(i){throw await m(i,!1),this.submissionResult.state=w.Error,i}finally{this.loadings.isSubmitting=!1}}async cancelTicket(t){var i;try{k.loadings.isTicketCancelling=!0,!((i=this.selectedTicket)===null||i===void 0)&&i.id&&(await l.facilityAccessApi.popAccess.cancellationPopAccessRequest({ticketId:this.selectedTicket.id,cancellationTicketsRequest:{cancellationReason:t}}),await this.getPOPAccessServiceTicket(this.selectedTicket.id))}catch(s){throw await m(s,!1),s}finally{k.loadings.isTicketCancelling=!1}}async submitUpdateTicketRequest(){let t;try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.ticketNumbers=void 0;try{t=await l.facilityAccessApi.popAccess.updatePopAccessTicket({pOPAccessTicketUpdateRequest:rh(this.newTicket,this.selectedTicket),ticketId:this.newTicket.id}),this.submissionResult.ticketResponse=t,this.submissionResult.state=w.Submitted,this.submissionResult.ticketNumbers=[t==null?void 0:t.id]}catch(i){throw this.submissionResult.state=w.Error,await m(i,!1),i}try{await k.postAttachments(y.FacilityAccess,this.newTicket.attachments,this.newTicket.id,!0,"PoP/POE Access"),this.newTicket.attachments=[]}catch(i){await m(i,!1)}try{t&&(this.selectedTicket=await ia(t))}catch(i){throw await m(i,!1),i}}finally{this.loadings.isSubmitting=!1}}resetSubmission(){this.submissionResult=pe.submissionResult}clearNewTicket(){this.newTicket=pe.newTicket}clear(){this.newTicket=pe.newTicket,this.selectedTicket=pe.selectedTicket,this.submissionResult=pe.submissionResult}updateFieldValue(t,i){this.newTicket[t]=i}updateIsServiceImpacted(t){this.newTicket.isServiceImpacted=t}updateCustomerExternalReference(t){this.newTicket.customerExternalReference=t}updateServiceImpactDescription(t){this.newTicket.serviceImpactDescription=t}updateServiceType(t){this.newTicket.serviceType=t,t===We.InstallationDeInstallationWork&&this.updateScope(""),this.updateIsCrossConnectInstallation(!1)}updateScope(t){this.newTicket.scope=t}updateDescriptionOfWork(t){this.newTicket.descriptionOfWork=t}updateIsCrossConnectInstallation(t){this.newTicket.isCrossConnectInstallation=t,t?this.newTicket.circuits=[{}]:(this.updateDescriptionOfWork(""),this.newTicket.circuits=void 0)}updateIsPPopCableRunOutside(t){this.newTicket.isPpopCableRunOutside=t,t||(this.newTicket.ppopFromRackPanel=void 0,this.newTicket.ppopToRackPanel=void 0,this.newTicket.ppopCableType=void 0,this.newTicket.ppopLadderRack=void 0,this.newTicket.ppopInnerDuct=void 0,this.newTicket.ppopFiberGuide=void 0)}updateIsSPopCableRunOutside(t){this.newTicket.isSpopCableRunOutside=t,t||(this.newTicket.spopFromRackPanel=void 0,this.newTicket.spopToRackPanel=void 0,this.newTicket.spopCableType=void 0,this.newTicket.spopLadderRack=void 0,this.newTicket.spopInnerDuct=void 0,this.newTicket.spopFiberGuide=void 0)}updateCircuitField(t,i,s){var n;(!this.newTicket.circuits||((n=this.newTicket.circuits)===null||n===void 0?void 0:n.length)===0)&&(this.newTicket.circuits=[{}]);const o=[...this.newTicket.circuits];o[s][i]=t,this.newTicket.circuits=o}isVisitorContactsValid(t){this.newTicket.isVisitorContactsDetailsValid=t}isEscortedDetailsValid(t){this.newTicket.isVisitorEscortedDetailsValid=t}isRequestedAccessDetailsValid(t){this.newTicket.isRequestedAccessDetailsValid=t}addBulkVisitors(t){throw new Error("Method not implemented.")}removeBulkVisitors(){throw new Error("Method not implemented.")}removeBulkAttachment(){throw new Error("Method not implemented.")}removeAllVisitors(){this.newTicket.visitors=[]}get isNewTicketValid(){const t=this.newTicket.isVisitorContactsDetailsValid,i=this.newTicket.isVisitorEscortedDetailsValid,s=this.newTicket.isVisitorHostValid,n=this.newTicket.isRequestedAccessDetailsValid,o=this.newTicket.isPopRequestedAccessValid;return t&&i&&s&&n&&o}get isAdditionalComponentValid(){return this.newTicket.isPPopRoomWorkValid&&this.newTicket.isSPopRoomWorkValid&&this.newTicket.isNotificationsAttachmentsValid}}const Ce=new na;var ti;(function(e){e.PLANNED_MAINTENANCE="Planned Maintenance",e.INCIDENTS="Incidents",e.DCIM_ALERTS="DCIM Alerts",e.SERVICE_TICKETS="Service Tickets"})(ti||(ti={}));const ch=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}}),M=e=>({comment:e.comment,commentedBy:e.createdBy,commentedOn:e.createdAt});async function dh(e,t,i){var s,n,o,a,r,d,u,p,A,N;let b;switch(e){case y.Deliveries:{const C=await l.deliveriesApi.createDeliveriesComment(Gm(t,i)).catch(x=>{m(x,!1)});b=(s=C==null?void 0:C.comments)===null||s===void 0?void 0:s.map(M),be.selectedTicket&&(be.selectedTicket.comments=b);break}case y.Removals:{const C=await l.removalsApi.createComment(rp(t,i)).catch(x=>{m(x,!1)});b=(n=C==null?void 0:C.comments)===null||n===void 0?void 0:n.map(M),Ve.selectedTicket&&(Ve.selectedTicket.comments=b);break}case y.RemoteHands:{const C=await l.remoteHandsApi.createRemoteHandsComment(Qm(t,i)).catch(x=>{m(x,!1)});b=(o=C==null?void 0:C.comments)===null||o===void 0?void 0:o.map(M),re.selectedTicket&&(re.selectedTicket.comments=b);break}case y.VisitorAccess:{const C=await l.facilityAccessApi.visitorAccess.createVisitorAccessComment(Pp(t,i)).catch(x=>{m(x,!1)});b=(a=C==null?void 0:C.comments)===null||a===void 0?void 0:a.map(M),ie.selectedTicket&&(ie.selectedTicket.comments=b);break}case y.PermanentBadge:{const C=await l.facilityAccessApi.permanentBadgeAccess.createPermanentBadgeComment(jp(t,i)).catch(x=>{m(x,!1)});b=(r=C==null?void 0:C.comments)===null||r===void 0?void 0:r.map(M),Y.selectedTicket&&(Y.selectedTicket.comments=b);break}case y.CustomerSupport:{const C=await l.customerCareApi.createCustomerCareComment(bp(t,i)).catch(x=>{m(x,!1)});b=(d=C==null?void 0:C.comments)===null||d===void 0?void 0:d.map(M),je.selectedTicket&&(je.selectedTicket.comments=b);break}case y.TroubleTickets:{const C=await l.troubleTicketsApi.createTroubleTicketComment(up(t,i)).catch(x=>{m(x,!1)});b=(u=C==null?void 0:C.comments)===null||u===void 0?void 0:u.map(M),Ue.selectedTicket&&(Ue.selectedTicket.comments=b);break}case y.OSPAccess:{const C=await l.facilityAccessApi.ospAccess.createOspAccessComment(Qp(t,i)).catch(x=>{m(x,!1)});b=(p=C==null?void 0:C.comments)===null||p===void 0?void 0:p.map(M),Se.selectedTicket&&(Se.selectedTicket.comments=b);break}case y.POPPOEAccess:{const C=await l.facilityAccessApi.popAccess.createPopAccessComment(nh(t,i)).catch(x=>{m(x,!1)});b=(A=C==null?void 0:C.comments)===null||A===void 0?void 0:A.map(M),Ce.selectedTicket&&(Ce.selectedTicket.comments=b);break}case ti.INCIDENTS:{const C=await l.incidentsApi.createIncidentComment(ch(t,i)).catch(x=>{m(x,!1)});b=(N=C==null?void 0:C.comments)===null||N===void 0?void 0:N.map(M);break}default:return}return b}const uh=e=>({subject:e.subject,customerReference:e.customerReferenceNumber,description:e.description,otherNotificationRecipients:e.contacts}),lh=e=>{var t;return{accountNumber:e.accountNumber,subject:e.subject,requestType:e.requestType,category:e.category,locations:!((t=e.location)===null||t===void 0)&&t.id?[e.location.id]:[],customerReference:e.customerReferenceNumber,description:e.description,notificationRecipients:e.contacts}},mh=async e=>{if(e)return{accountNumber:e.accountNumber,serviceBackend:await K.getServiceBackend(e.accountNumber,e.site,"Customer_care"),subject:e.subject,requestType:e.requestType,category:e.category,site:{id:e.site,accountNumber:e.accountNumber},location:{id:e.locations[0],accountNumber:e.accountNumber},customerReferenceNumber:e.customerReference,description:e.description,contacts:e.notificationRecipients}},aa=async e=>{var t,i,s,n,o;if(e)return{id:e.id,accountName:e.accountName,accountNumber:e.accountNumber,serviceBackend:await K.getServiceBackend(e.accountNumber,e.site,"Customer_care"),subject:e.subject,description:e.description,customerReference:e.customerReference,site:e.site,location:!((t=e.locations)===null||t===void 0)&&t.length?e.locations[0]:"",notificationRecipients:e.notificationRecipients,status:e.status,createdBy:e.createdBy,createdAt:(i=e.createdAt)===null||i===void 0?void 0:i.toISOString(),updatedAt:(s=e.updatedAt)===null||s===void 0?void 0:s.toISOString(),closedAt:(n=e.closedAt)===null||n===void 0?void 0:n.toISOString(),cancellationReason:e.cancellationReason,requestType:e.requestType,category:e.category,comments:(o=e.comments)===null||o===void 0?void 0:o.map(a=>M(a))}},ze={selectedTicket:void 0,ticket:{isValid:!1,subject:"",description:"",site:void 0,requestType:"",category:"",customerReferenceNumber:"",contacts:"",attachments:[],accountNumber:""},submissionResult:{state:w.Default,result:void 0},loadings:{isSubmitting:!1}};class ph{constructor(){this.selectedTicket=ze.selectedTicket,this.ticket=ze.ticket,this.submissionResult=ze.submissionResult,this.loadings=ze.loadings,se(this),Je(this,{name:"customerCare",properties:[],storage:window.localStorage})}async setTicket(){try{this.ticket=await mh(this.submissionResult.result)||ze.ticket}catch(t){throw await m(t,!1),t}}async getSelectedTicket(t){if(t)try{const i=await l.customerCareApi.getCustomerCareTicketById({ticketId:t});this.submissionResult.result=i,this.selectedTicket=await aa(i),await this.setTicket()}catch(i){throw await m(i,!1),i}}async getCategories(t,i){if(!(!t||!i))try{return await l.customerCareApi.getCustomerCareCategoriesList({site:t,accountNumber:i})}catch(s){throw await m(s,!1),s}}async cancelTicket(t){var i;try{k.loadings.isTicketCancelling=!0,!((i=this.selectedTicket)===null||i===void 0)&&i.id&&(await l.customerCareApi.cancellationCustomerCareRequest({ticketId:this.selectedTicket.id,cancellationTicketsRequest:{cancellationReason:t}}).catch(s=>{throw m(s,!1),s}),await this.getSelectedTicket(this.selectedTicket.id))}finally{k.loadings.isTicketCancelling=!1}}async updateSite(t){this.ticket.site=t,this.ticket.accountNumber=t.accountNumber}async createTicket(){var t;this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting;try{this.submissionResult.result=await l.customerCareApi.createCustomerCareTicket({customerCareTicketRequest:lh(this.ticket)}),this.submissionResult.state=w.Submitted}catch(i){throw this.loadings.isSubmitting=!1,this.submissionResult.state=w.Error,await m(i,!1),i}try{!((t=this.submissionResult.result)===null||t===void 0)&&t.id&&await k.postAttachments(y.CustomerSupport,this.ticket.attachments,this.submissionResult.result.id),this.ticket.attachments=void 0}catch(i){throw await m(i,!1),i}finally{this.loadings.isSubmitting=!1}}async updateTicket(){var t,i;let s;try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting;try{s=await l.customerCareApi.updateCustomerCareTicket({ticketId:((t=this.selectedTicket)===null||t===void 0?void 0:t.id)||"",customerCareTicketUpdateRequest:uh(this.ticket)}),this.submissionResult.result=s,this.submissionResult.state=w.Submitted}catch(n){throw this.submissionResult.state=w.Error,await m(n,!1),n}try{await k.postAttachments(y.CustomerSupport,this.ticket.attachments,(i=this.selectedTicket)===null||i===void 0?void 0:i.id,!0),this.ticket.attachments=void 0}catch(n){throw await m(n,!1),n}try{s&&(this.selectedTicket=await aa(s),await this.setTicket())}catch(n){throw await m(n,!1),n}}finally{this.loadings.isSubmitting=!1}}updateLocation(t){this.ticket.location=t}clear(){this.ticket=ze.ticket,this.selectedTicket=ze.selectedTicket,this.submissionResult=ze.submissionResult,this.loadings=ze.loadings}}const je=new ph,ve=bt` *, ::before, ::after {
|
|
1
|
+
import{__decorate as E}from"tslib";import{css as bt,html as g,LitElement as Rt,nothing as P,svg as Ot}from"lit";import{property as fe,customElement as Q,state as Wi}from"lit/decorators.js";import G from"moment";import{baseTheme as ma}from"@digital-realty/theme";import ve from"moment-timezone";import"date-fns/format.js";import{makeAutoObservable as ne}from"mobx";import{makePersistable as Je}from"mobx-persist-store";import{authedUser as ot}from"@digital-realty/ix-account-switcher";import{Router as rt}from"@vaadin/router";import{User as pa,UserManager as ha}from"oidc-client-ts";import{MobxLitElement as _e}from"@adobe/lit-mobx";import{ifDefined as va}from"lit/directives/if-defined.js";import"@digital-realty/ix-select/ix-select.js";import"@digital-realty/ix-select/ix-select-option.js";import"@digital-realty/ix-icon-button/ix-icon-button.js";import{until as ke}from"lit-html/directives/until.js";import{isPossiblePhoneNumber as ga}from"libphonenumber-js";var gi;(function(e){e.CustomerSupport="customer-support",e.FacilityAccess="facility-access",e.RemoteHands="remote-hands",e.DeliveriesAndRemovals="deliveries-removals",e.TroubleTicket="trouble-ticket"})(gi||(gi={}));var y;(function(e){e.CustomerSupport="customer-support",e.FacilityAccess="facility-access",e.VisitorAccess="visitor-access",e.PermanentBadge="permanent-badge",e.OSPAccess="osp-access",e.POPPOEAccess="pop-poe-access",e.RemoteHands="remote-hands",e.Deliveries="deliveries",e.Removals="removals",e.DeliveriesAndRemovals="deliveries-removals",e.TroubleTickets="trouble-tickets"})(y||(y={}));const wa="ticketViewType";var wi;(function(e){e.PlannedWork="Planned Work",e.UrgentWork="Urgent Work"})(wi||(wi={}));var H;(function(e){e.TelxSFDC="TelxSFDC",e.Insite="InSite",e.ServiceNow="ServiceNow"})(H||(H={}));const ct="YYYY-MM-DD",fa="HH:mm:ss",$t="HH:mm",ka="YYYY-MM-DD HH:mm";var w;(function(e){e.Default="default",e.Submitting="submitting",e.Submitted="submitted",e.Error="error"})(w||(w={}));var ee;(function(e){e.Deliveries="deliveries-tickets",e.FacilityAccess="osp-access-tickets",e.TroubleTickets="trouble-tickets",e.RemoteHands="remote-hands-tickets"})(ee||(ee={}));const Gi=[{label:"CSV",extensions:["csv"]},{label:"DOC/X",extensions:["doc","docx"]},{label:"GIF",extensions:["gif"]},{label:"JPG (JPEG)",extensions:["jpg","jpeg"]},{label:"PDF",extensions:["pdf"]},{label:"PNG",extensions:["png"]},{label:"XLS/X",extensions:["xls","xlsx"]}],ya=[{label:"JPG (JPEG)",extensions:["image/jpg","image/jpeg"]},{label:"PDF",extensions:["application/pdf"]},{label:"PNG",extensions:["image/png"]},{label:"GIF",extensions:["image/gif"]}],Ta=Gi.flatMap(e=>e.extensions),ba=ya.flatMap(e=>e.extensions),Ra=e=>{var t;return Number((t=e.split("cursor=").pop())===null||t===void 0?void 0:t.split("&")[0])},Zi=async(e,t)=>{const i=await t({...e,cursor:"1"});if(!i)return[];const s=[...i.items];if(i.last&&i.self!==i.last){const n=[];let o=1;o=Ra(i.last);for(let a=2;a<=o;a+=1)n.push(t({...e,cursor:a.toString()}));await Promise.all(n).then(a=>{a.forEach(r=>{r&&s.push(...r.items)})})}return s},Aa=e=>{var t,i;return e?"name"in e?((t=e.name)===null||t===void 0?void 0:t.trim())||e.id||"":((i=e.comment)===null||i===void 0?void 0:i.trim())||e.id||"":""},_a="https://api.digitalrealty.com/service-management/v1".replace(/\/+$/,"");class Ki{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:_a}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Yi}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Sa=new Ki;class ai{constructor(t=Sa){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new Pa(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?ai.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new Na(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;Ca(r.body)||r.body instanceof URLSearchParams||Ia(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}ai.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function Ia(e){return typeof Blob<"u"&&e instanceof Blob}function Ca(e){return typeof FormData<"u"&&e instanceof FormData}class Na extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class Pa extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class ae extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function S(e,t){return e[t]!=null}function Yi(e,t=""){return Object.keys(e).map(i=>Xi(i,e[i],t)).filter(i=>i.length>0).join("&")}function Xi(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return Xi(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Yi(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class Ne{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class qa{constructor(t){this.raw=t}async value(){return await this.raw.blob()}}const Da="https://api.digitalrealty.com".replace(/\/+$/,"");class Et{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Da}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||es}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Ba=new Et;class kt{constructor(t=Ba){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new Ea(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?kt.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new Qi(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;$a(r.body)||r.body instanceof URLSearchParams||Oa(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}kt.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function Oa(e){return typeof Blob<"u"&&e instanceof Blob}function $a(e){return typeof FormData<"u"&&e instanceof FormData}class Qi extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class Ea extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class $ extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function h(e,t){return e[t]!=null}function es(e,t=""){return Object.keys(e).map(i=>ts(i,e[i],t)).filter(i=>i.length>0).join("&")}function ts(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return ts(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?es(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class j{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class is{constructor(t){this.raw=t}async value(){return await this.raw.blob()}}class xa extends kt{async getCourierBySiteRaw(t,i){if(t.accountNumber===null||t.accountNumber===void 0)throw new $("accountNumber","Required parameter requestParameters.accountNumber was null or undefined when calling getCourierBySite.");if(t.site===null||t.site===void 0)throw new $("site","Required parameter requestParameters.site was null or undefined when calling getCourierBySite.");const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/deliveries-removals/courier-companies",method:"GET",headers:n,query:s},i);return new j(o)}async getCourierBySite(t,i){return await(await this.getCourierBySiteRaw(t,i)).value()}}function ss(e){if(e!==void 0)return e===null?null:{cancellationReason:e.cancellationReason}}function ns(e){return Fa(e)}function Fa(e,t){return e==null?e:{message:h(e,"message")?e.message:void 0}}function fi(e){return La(e)}function La(e,t){return e==null?e:{createdBy:h(e,"created_by")?e.created_by:void 0,createdAt:h(e,"created_at")?new Date(e.created_at):void 0,comment:h(e,"comment")?e.comment:void 0}}function as(e){return Va(e)}function Va(e,t){return e==null?e:{comments:h(e,"comments")?e.comments.map(fi):void 0}}function Ua(e){return Ha(e)}function Ha(e,t){return e==null?e:{deliveryBlocked:h(e,"delivery_blocked")?e.delivery_blocked:void 0}}function os(e){return za(e)}function za(e,t){return e==null?e:{accountNumber:h(e,"account_number")?e.account_number:void 0,accountName:h(e,"account_name")?e.account_name:void 0,id:h(e,"id")?e.id:void 0,status:h(e,"status")?e.status:void 0,site:h(e,"site")?e.site:void 0,subject:h(e,"subject")?e.subject:void 0,createdBy:h(e,"created_by")?e.created_by:void 0,updatedAt:h(e,"updated_at")?new Date(e.updated_at):void 0}}function ja(e){return Ma(e)}function Ma(e,t){return e==null?e:{deliveryTickets:h(e,"delivery_tickets")?e.delivery_tickets.map(os):void 0,totalCount:h(e,"total_count")?e.total_count:void 0,pageNumber:h(e,"page_number")?e.page_number:void 0,pageSize:h(e,"page_size")?e.page_size:void 0}}function Ja(e){if(e!==void 0)return e===null?null:{tracking_number:e.trackingNumber,size_when_oversized:e.sizeWhenOversized,weight_when_overweight:e.weightWhenOverweight,courier_company:e.courierCompany}}function Wa(e){if(e!==void 0)return e===null?null:{id:e.id,tracking_number:e.trackingNumber,number_of_packages:e.numberOfPackages,size_when_oversized:e.sizeWhenOversized,weight_when_overweight:e.weightWhenOverweight,courier_company:e.courierCompany}}function Ga(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,subject:e.subject,description:e.description,eta_from:e.etaFrom===null?null:e.etaFrom.toISOString().substring(0,10),eta_to:e.etaTo===null?null:e.etaTo.toISOString(),loading_bay_required:e.loadingBayRequired,remote_hands_required:e.remoteHandsRequired,customer_reference:e.customerReference,site:e.site,other_notification_recipients:e.otherNotificationRecipients,packages:e.packages===void 0?void 0:e.packages.map(Wa)}}function Za(e){return Ka(e)}function Ka(e,t){return e==null?e:{id:h(e,"id")?e.id:void 0,trackingNumber:h(e,"tracking_number")?e.tracking_number:void 0,numberOfPackages:h(e,"number_of_packages")?e.number_of_packages:void 0,sizeWhenOversized:h(e,"size_when_oversized")?e.size_when_oversized:void 0,weightWhenOverweight:h(e,"weight_when_overweight")?e.weight_when_overweight:void 0,courierCompany:h(e,"courier_company")?e.courier_company:void 0}}function xt(e){return Ya(e)}function Ya(e,t){return e==null?e:{id:h(e,"id")?e.id:void 0,accountNumber:h(e,"account_number")?e.account_number:void 0,accountName:h(e,"account_name")?e.account_name:void 0,status:h(e,"status")?e.status:void 0,subject:h(e,"subject")?e.subject:void 0,description:h(e,"description")?e.description:void 0,cancellationReason:h(e,"cancellation_reason")?e.cancellation_reason:void 0,etaFrom:h(e,"eta_from")?e.eta_from===null?null:new Date(e.eta_from):void 0,etaTo:h(e,"eta_to")?e.eta_to===null?null:new Date(e.eta_to):void 0,customerReference:h(e,"customer_reference")?e.customer_reference:void 0,site:h(e,"site")?e.site:void 0,otherNotificationRecipients:h(e,"other_notification_recipients")?e.other_notification_recipients:void 0,createdBy:h(e,"created_by")?e.created_by:void 0,createdAt:h(e,"created_at")?new Date(e.created_at):void 0,updatedAt:h(e,"updated_at")?new Date(e.updated_at):void 0,loadingBayRequired:h(e,"loading_bay_required")?e.loading_bay_required:void 0,remoteHandsRequired:h(e,"remote_hands_required")?e.remote_hands_required:void 0,packages:h(e,"packages")?e.packages.map(Za):void 0,comments:h(e,"comments")?e.comments.map(fi):void 0}}function Xa(e){if(e!==void 0)return e===null?null:{subject:e.subject,description:e.description,eta_from:e.etaFrom===void 0?void 0:e.etaFrom===null?null:e.etaFrom.toISOString(),eta_to:e.etaTo===void 0?void 0:e.etaTo===null?null:e.etaTo.toISOString(),loading_bay_required:e.loadingBayRequired,customer_reference:e.customerReference,other_notification_recipients:e.otherNotificationRecipients}}function Qa(e){return eo(e)}function eo(e,t){return e==null?e:{removalTickets:h(e,"removal_tickets")?e.removal_tickets.map(os):void 0,totalCount:h(e,"total_count")?e.total_count:void 0,pageNumber:h(e,"page_number")?e.page_number:void 0,pageSize:h(e,"page_size")?e.page_size:void 0}}function to(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,subject:e.subject,description:e.description,customer_reference:e.customerReference,removal_party:e.removalParty,courier_company:e.courierCompany,tracking_number:e.trackingNumber,pickup_date:e.pickupDate.toISOString(),site:e.site,other_notification_recipients:e.otherNotificationRecipients}}function ki(e){return io(e)}function io(e,t){return e==null?e:{id:h(e,"id")?e.id:void 0,accountNumber:h(e,"account_number")?e.account_number:void 0,accountName:h(e,"account_name")?e.account_name:void 0,status:h(e,"status")?e.status:void 0,cancellationReason:h(e,"cancellation_reason")?e.cancellation_reason:void 0,subject:h(e,"subject")?e.subject:void 0,description:h(e,"description")?e.description:void 0,customerReference:h(e,"customer_reference")?e.customer_reference:void 0,removalParty:h(e,"removal_party")?e.removal_party:void 0,courierCompany:h(e,"courier_company")?e.courier_company:void 0,trackingNumber:h(e,"tracking_number")?e.tracking_number:void 0,pickupDate:h(e,"pickup_date")?e.pickup_date:void 0,site:h(e,"site")?e.site:void 0,otherNotificationRecipients:h(e,"other_notification_recipients")?e.other_notification_recipients:void 0,createdBy:h(e,"created_by")?e.created_by:void 0,createdAt:h(e,"created_at")?new Date(e.created_at):void 0,updatedAt:h(e,"updated_at")?new Date(e.updated_at):void 0,comments:h(e,"comments")?e.comments.map(fi):void 0}}function so(e){if(e!==void 0)return e===null?null:{subject:e.subject,description:e.description,customer_reference:e.customerReference,courier_company:e.courierCompany,tracking_number:e.trackingNumber,pickup_date:e.pickupDate===void 0?void 0:e.pickupDate===null?null:e.pickupDate.toISOString(),other_notification_recipients:e.otherNotificationRecipients}}function yi(e){return no(e)}function no(e,t){return e==null?e:{id:h(e,"id")?e.id:void 0,fileName:h(e,"file_name")?e.file_name:void 0,fileSize:h(e,"file_size")?e.file_size:void 0,contentType:h(e,"content_type")?e.content_type:void 0,createdBy:h(e,"created_by")?e.created_by:void 0,createdAt:h(e,"created_at")?new Date(e.created_at):void 0}}function rs(e){return ao(e)}function ao(e,t){return e==null?e:{attachments:h(e,"attachments")?e.attachments.map(yi):void 0}}function cs(e){if(e!==void 0)return e===null?null:{comment:e.comment}}class oo extends kt{async cancellationDeliveryRequestRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling cancellationDeliveryRequest.");if(t.cancellationTicketsRequest===null||t.cancellationTicketsRequest===void 0)throw new $("cancellationTicketsRequest","Required parameter requestParameters.cancellationTicketsRequest was null or undefined when calling cancellationDeliveryRequest.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets/{ticket_id}/cancel".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PUT",headers:n,query:s,body:ss(t.cancellationTicketsRequest)},i);return new j(o,a=>ns(a))}async cancellationDeliveryRequest(t,i){return await(await this.cancellationDeliveryRequestRaw(t,i)).value()}async createAttachmentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createAttachment.");if(t.fileName===null||t.fileName===void 0)throw new $("fileName","Required parameter requestParameters.fileName was null or undefined when calling createAttachment.");if(t.body===null||t.body===void 0)throw new $("body","Required parameter requestParameters.body was null or undefined when calling createAttachment.");const s={};t.fileName!==void 0&&(s.file_name=t.fileName);const n={};if(n["Content-Type"]="image/jpeg",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets/{ticket_id}/attachments/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:t.body},i);return new j(o,a=>yi(a))}async createAttachment(t,i){return await(await this.createAttachmentRaw(t,i)).value()}async createDeliveriesCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createDeliveriesComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new $("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createDeliveriesComment.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:cs(t.ticketCommentsRequest)},i);return new j(o,a=>as(a))}async createDeliveriesComment(t,i){return await(await this.createDeliveriesCommentRaw(t,i)).value()}async createDeliveryRaw(t,i){if(t.deliveryTicketsRequest===null||t.deliveryTicketsRequest===void 0)throw new $("deliveryTicketsRequest","Required parameter requestParameters.deliveryTicketsRequest was null or undefined when calling createDelivery.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets",method:"POST",headers:n,query:s,body:Ga(t.deliveryTicketsRequest)},i);return new j(o,a=>xt(a))}async createDelivery(t,i){return await(await this.createDeliveryRaw(t,i)).value()}async getDeliveriesRaw(t,i){if(t.accountNumber===null||t.accountNumber===void 0)throw new $("accountNumber","Required parameter requestParameters.accountNumber was null or undefined when calling getDeliveries.");const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.status!==void 0&&(s.status=t.status),t.createdBy!==void 0&&(s.created_by=t.createdBy),t.sort!==void 0&&(s.sort=t.sort),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets",method:"GET",headers:n,query:s},i);return new j(o,a=>ja(a))}async getDeliveries(t,i){return await(await this.getDeliveriesRaw(t,i)).value()}async getDeliveryAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getDeliveryAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new $("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getDeliveryAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets/{ticket_id}/attachments/{attachment_id}/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new is(o)}async getDeliveryAttachmentsById(t,i){return await(await this.getDeliveryAttachmentsByIdRaw(t,i)).value()}async getDeliveryAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getDeliveryAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new j(o,a=>rs(a))}async getDeliveryAttachmentsList(t,i){return await(await this.getDeliveryAttachmentsListRaw(t,i)).value()}async getDeliveryByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getDeliveryById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new j(o,a=>xt(a))}async getDeliveryById(t,i){return await(await this.getDeliveryByIdRaw(t,i)).value()}async getDeliveryDiscoveryRaw(t,i){if(t.accountNumber===null||t.accountNumber===void 0)throw new $("accountNumber","Required parameter requestParameters.accountNumber was null or undefined when calling getDeliveryDiscovery.");if(t.site===null||t.site===void 0)throw new $("site","Required parameter requestParameters.site was null or undefined when calling getDeliveryDiscovery.");const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-discovery",method:"GET",headers:n,query:s},i);return new j(o,a=>Ua(a))}async getDeliveryDiscovery(t,i){return await(await this.getDeliveryDiscoveryRaw(t,i)).value()}async updateDeliveriesTicketsRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateDeliveriesTickets.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:Xa(t.deliveryTicketsUpdateRequest)},i);return new j(o,a=>xt(a))}async updateDeliveriesTickets(t,i){return await(await this.updateDeliveriesTicketsRaw(t,i)).value()}async updateDeliveriesTicketsPackagesRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateDeliveriesTicketsPackages.");if(t.packageId===null||t.packageId===void 0)throw new $("packageId","Required parameter requestParameters.packageId was null or undefined when calling updateDeliveriesTicketsPackages.");if(t.deliveryTicketUpdatePackagesRequest===null||t.deliveryTicketUpdatePackagesRequest===void 0)throw new $("deliveryTicketUpdatePackagesRequest","Required parameter requestParameters.deliveryTicketUpdatePackagesRequest was null or undefined when calling updateDeliveriesTicketsPackages.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/delivery-tickets/{ticket_id}/packages/{package_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{package_id}",encodeURIComponent(String(t.packageId))),method:"PATCH",headers:n,query:s,body:Ja(t.deliveryTicketUpdatePackagesRequest)},i);return new j(o,a=>xt(a))}async updateDeliveriesTicketsPackages(t,i){return await(await this.updateDeliveriesTicketsPackagesRaw(t,i)).value()}}class ro extends kt{async cancellationRemovalRequestRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling cancellationRemovalRequest.");if(t.cancellationTicketsRequest===null||t.cancellationTicketsRequest===void 0)throw new $("cancellationTicketsRequest","Required parameter requestParameters.cancellationTicketsRequest was null or undefined when calling cancellationRemovalRequest.");const s={},n={};n["Content-Type"]="application/json";const o=await this.request({path:"/removals-tickets/{ticket_id}/cancel".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PUT",headers:n,query:s,body:ss(t.cancellationTicketsRequest)},i);return new j(o,a=>ns(a))}async cancellationRemovalRequest(t,i){return await(await this.cancellationRemovalRequestRaw(t,i)).value()}async createCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new $("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createComment.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/removal-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:cs(t.ticketCommentsRequest)},i);return new j(o,a=>as(a))}async createComment(t,i){return await(await this.createCommentRaw(t,i)).value()}async createRemovalRaw(t,i){if(t.removalTicketsRequest===null||t.removalTicketsRequest===void 0)throw new $("removalTicketsRequest","Required parameter requestParameters.removalTicketsRequest was null or undefined when calling createRemoval.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/removal-tickets",method:"POST",headers:n,query:s,body:to(t.removalTicketsRequest)},i);return new j(o,a=>ki(a))}async createRemoval(t,i){return await(await this.createRemovalRaw(t,i)).value()}async createRemovalsAttachmentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createRemovalsAttachment.");if(t.fileName===null||t.fileName===void 0)throw new $("fileName","Required parameter requestParameters.fileName was null or undefined when calling createRemovalsAttachment.");if(t.body===null||t.body===void 0)throw new $("body","Required parameter requestParameters.body was null or undefined when calling createRemovalsAttachment.");const s={};t.fileName!==void 0&&(s.file_name=t.fileName);const n={};if(n["Content-Type"]="image/jpeg",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/removal-tickets/{ticket_id}/attachments/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:t.body},i);return new j(o,a=>yi(a))}async createRemovalsAttachment(t,i){return await(await this.createRemovalsAttachmentRaw(t,i)).value()}async getRemovalByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getRemovalById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/removal-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new j(o,a=>ki(a))}async getRemovalById(t,i){return await(await this.getRemovalByIdRaw(t,i)).value()}async getRemovalPartiesRaw(t){const i={},s={};if(this.configuration&&this.configuration.accessToken){const o=this.configuration.accessToken,a=await o("BearerAuth",[]);a&&(s.Authorization=`Bearer ${a}`)}const n=await this.request({path:"/removal-parties",method:"GET",headers:s,query:i},t);return new j(n)}async getRemovalParties(t){return await(await this.getRemovalPartiesRaw(t)).value()}async getRemovalsRaw(t,i){const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.status!==void 0&&(s.status=t.status),t.createdBy!==void 0&&(s.created_by=t.createdBy),t.sort!==void 0&&(s.sort=t.sort),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/removal-tickets",method:"GET",headers:n,query:s},i);return new j(o,a=>Qa(a))}async getRemovals(t={},i){return await(await this.getRemovalsRaw(t,i)).value()}async getRemovalsAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getRemovalsAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new $("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getRemovalsAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/removal-tickets/{ticket_id}/attachments/{attachment_id}/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new is(o)}async getRemovalsAttachmentsById(t,i){return await(await this.getRemovalsAttachmentsByIdRaw(t,i)).value()}async getRemovalsAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getRemovalsAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/removal-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new j(o,a=>rs(a))}async getRemovalsAttachmentsList(t,i){return await(await this.getRemovalsAttachmentsListRaw(t,i)).value()}async updateRemovalByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new $("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateRemovalById.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/removal-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:so(t.removalsTicketsUpdateRequest)},i);return new j(o,a=>ki(a))}async updateRemovalById(t,i){return await(await this.updateRemovalByIdRaw(t,i)).value()}}const co="https://api.digitalrealty.com/service-management/v1/facility-access".replace(/\/+$/,"");class pt{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:co}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||ds}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const uo=new pt;class Xe{constructor(t=uo){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new ho(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?Xe.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new po(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;mo(r.body)||r.body instanceof URLSearchParams||lo(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}Xe.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function lo(e){return typeof Blob<"u"&&e instanceof Blob}function mo(e){return typeof FormData<"u"&&e instanceof FormData}class po extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class ho extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class v extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function c(e,t){return e[t]!=null}function ds(e,t=""){return Object.keys(e).map(i=>us(i,e[i],t)).filter(i=>i.length>0).join("&")}function us(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return us(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?ds(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class q{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class Ft{constructor(t){this.raw=t}async value(){return await this.raw.blob()}}function vo(e){return go(e)}function go(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,accountNumber:c(e,"account_number")?e.account_number:void 0,firstName:c(e,"first_name")?e.first_name:void 0,lastName:c(e,"last_name")?e.last_name:void 0,email:c(e,"email")?e.email:void 0,phone:c(e,"phone")?e.phone:void 0,representingCompany:c(e,"representing_company")?e.representing_company:void 0,badgeStartDate:c(e,"badge_start_date")?new Date(e.badge_start_date):void 0,activeBadge:c(e,"active_badge")?e.active_badge:void 0,terminationRequested:c(e,"termination_requested")?e.termination_requested:void 0}}function wo(e){return fo(e)}function fo(e,t){return e==null?e:{items:c(e,"items")?e.items.map(vo):void 0,totalCount:c(e,"total_count")?e.total_count:void 0}}function Lt(e){if(e!==void 0)return e===null?null:{cancellationReason:e.cancellationReason}}function Vt(e){return ko(e)}function ko(e,t){return e==null?e:{message:c(e,"message")?e.message:void 0}}function At(e){return yo(e)}function yo(e,t){return e==null?e:{createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?new Date(e.created_at):void 0,comment:c(e,"comment")?e.comment:void 0}}function Ut(e){return To(e)}function To(e,t){return e==null?e:{comments:c(e,"comments")?e.comments.map(At):void 0}}const ls={Approved:"Approved",Denied:"Denied"};function Ht(e){if(e!==void 0)return e===null?null:{id:e.id,approval_status:e.approvalStatus}}function bo(e){return Ro(e)}function Ro(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,approvalStatus:c(e,"approval_status")?e.approval_status:void 0}}function zt(e){return Ao(e)}function Ao(e,t){return e==null?e:{items:c(e,"items")?e.items.map(bo):void 0}}function _o(e){if(e!==void 0)return e===null?null:{id:e.id,start_date_time:e.startDateTime===void 0?void 0:e.startDateTime.toISOString(),end_date_time:e.endDateTime===void 0?void 0:e.endDateTime.toISOString()}}function So(e){if(e!==void 0)return e===null?null:{first_name:e.firstName,last_name:e.lastName,email:e.email,company:e.company,phone:e.phone,visitor_type:e.visitorType}}function Io(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,visitors:e.visitors.map(So),locations:e.locations.map(_o),escort_first_name:e.escortFirstName,escort_last_name:e.escortLastName,visitor_host_first_name:e.visitorHostFirstName,visitor_host_last_name:e.visitorHostLastName,customer_external_reference:e.customerExternalReference,service_impacted_description:e.serviceImpactedDescription,work_description:e.workDescription,notification_recipients:e.notificationRecipients}}function Co(e){return No(e)}function No(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,startDateTime:c(e,"start_date_time")?e.start_date_time:void 0,endDateTime:c(e,"end_date_time")?e.end_date_time:void 0}}function ms(e){return Po(e)}function Po(e,t){return e==null?e:{accountNumber:c(e,"account_number")?e.account_number:void 0,accountName:c(e,"account_name")?e.account_name:void 0,id:c(e,"id")?e.id:void 0,status:c(e,"status")?e.status:void 0,cancellationReason:c(e,"cancellation_reason")?e.cancellation_reason:void 0,subject:c(e,"subject")?e.subject:void 0,visitorFirstName:c(e,"visitor_first_name")?e.visitor_first_name:void 0,visitorLastName:c(e,"visitor_last_name")?e.visitor_last_name:void 0,visitorEmail:c(e,"visitor_email")?e.visitor_email:void 0,visitorCompany:c(e,"visitor_company")?e.visitor_company:void 0,visitorPhone:c(e,"visitor_phone")?e.visitor_phone:void 0,visitorType:c(e,"visitor_type")?e.visitor_type:void 0,site:c(e,"site")?e.site:void 0,locations:c(e,"locations")?e.locations.map(Co):void 0,escortFirstName:c(e,"escort_first_name")?e.escort_first_name:void 0,escortLastName:c(e,"escort_last_name")?e.escort_last_name:void 0,visitorHostFirstName:c(e,"visitor_host_first_name")?e.visitor_host_first_name:void 0,visitorHostLastName:c(e,"visitor_host_last_name")?e.visitor_host_last_name:void 0,customerExternalReference:c(e,"customer_external_reference")?e.customer_external_reference:void 0,serviceImpactedDescription:c(e,"service_impacted_description")?e.service_impacted_description:void 0,workDescription:c(e,"work_description")?e.work_description:void 0,notificationRecipients:c(e,"notification_recipients")?e.notification_recipients:void 0,createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?e.created_at:void 0,updatedAt:c(e,"updated_at")?e.updated_at:void 0,closedAt:c(e,"closed_at")?e.closed_at:void 0,comments:c(e,"comments")?e.comments.map(At):void 0}}function qo(e){if(e!==void 0)return e===null?null:{id:e.id,start_date_time:e.startDateTime===void 0?void 0:e.startDateTime.toISOString(),end_date_time:e.endDateTime===void 0?void 0:e.endDateTime.toISOString()}}function Do(e){if(e!==void 0)return e===null?null:{visitor_phone:e.visitorPhone,visitor_company:e.visitorCompany,escort_first_name:e.escortFirstName,escort_last_name:e.escortLastName,locations:e.locations===void 0?void 0:e.locations.map(qo),visitor_host_first_name:e.visitorHostFirstName,visitor_host_last_name:e.visitorHostLastName,customer_external_reference:e.customerExternalReference,service_impacted_description:e.serviceImpactedDescription,work_description:e.workDescription,other_notification_recipients:e.otherNotificationRecipients}}function Bo(e){return Oo(e)}function Oo(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,startDateTime:c(e,"start_date_time")?new Date(e.start_date_time):void 0,endDateTime:c(e,"end_date_time")?new Date(e.end_date_time):void 0}}function $o(e){return Eo(e)}function Eo(e,t){return e==null?e:{accountNumber:c(e,"account_number")?e.account_number:void 0,accountName:c(e,"account_name")?e.account_name:void 0,id:c(e,"id")?e.id:void 0,status:c(e,"status")?e.status:void 0,subject:c(e,"subject")?e.subject:void 0,site:c(e,"site")?e.site:void 0,locations:c(e,"locations")?e.locations.map(Bo):void 0,description:c(e,"description")?e.description:void 0,createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?new Date(e.created_at):void 0,updatedAt:c(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:c(e,"closed_at")?new Date(e.closed_at):void 0}}function xo(e){return Fo(e)}function Fo(e,t){return e==null?e:{items:c(e,"items")?e.items.map($o):void 0,totalCount:c(e,"total_count")?e.total_count:void 0,pageNumber:c(e,"page_number")?e.page_number:void 0,pageSize:c(e,"page_size")?e.page_size:void 0}}function Lo(e){if(e!==void 0)return e===null?null:{id:e.id,start_date_time:e.startDateTime.toISOString(),end_date_time:e.endDateTime.toISOString()}}function Vo(e){if(e!==void 0)return e===null?null:{ppop_space_from:e.ppopSpaceFrom,ppop_space_to:e.ppopSpaceTo,cable_type:e.cableType,on_ladder_rack:e.onLadderRack,in_inner_duct:e.inInnerDuct,in_fiber_guide:e.inFiberGuide}}function ps(e){return Uo(e)}function Uo(e,t){return e==null?e:{rack:c(e,"rack")?e.rack:void 0,cabinet:c(e,"cabinet")?e.cabinet:void 0}}function hs(e){if(e!==void 0)return e===null?null:{rack:e.rack,cabinet:e.cabinet}}function Ho(e){if(e!==void 0)return e===null?null:{side_a_name:e.sideAName,side_a_room_number:e.sideARoomNumber,side_a_rack_number:e.sideARackNumber,side_a_panel_number:e.sideAPanelNumber,side_a_port_1:e.sideAPort1,side_a_carrier_circuit_id:e.sideACarrierCircuitId,side_b_name:e.sideBName,side_b_room_number:e.sideBRoomNumber,side_b_rack_number:e.sideBRackNumber,side_b_panel_number:e.sideBPanelNumber,side_b_port_1:e.sideBPort1,side_b_carrier_circuit_id:e.sideBCarrierCircuitId}}function zo(e){if(e!==void 0)return e===null?null:{service_type:e.serviceType,scope:e.scope,circuits:e.circuits===void 0?void 0:e.circuits.map(Ho),work_description:e.workDescription}}function jo(e){if(e!==void 0)return e===null?null:{spop_space_from:e.spopSpaceFrom,spop_space_to:e.spopSpaceTo,cable_type:e.cableType,on_ladder_rack:e.onLadderRack,in_inner_duct:e.inInnerDuct,in_fiber_guide:e.inFiberGuide}}function Mo(e){if(e!==void 0)return e===null?null:{first_name:e.firstName,last_name:e.lastName,email:e.email,company:e.company,phone:e.phone,visitor_type:e.visitorType}}function Jo(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,visitors:e.visitors.map(Mo),locations:e.locations.map(Lo),escort_first_name:e.escortFirstName,escort_last_name:e.escortLastName,visitor_host_first_name:e.visitorHostFirstName,visitor_host_last_name:e.visitorHostLastName,customer_external_reference:e.customerExternalReference,service_impacted_description:e.serviceImpactedDescription,service_details:zo(e.serviceDetails),ppop_space:e.ppopSpace===void 0?void 0:e.ppopSpace.map(hs),spop_space:e.spopSpace===void 0?void 0:e.spopSpace.map(hs),ppop_room_work:Vo(e.ppopRoomWork),spop_room_work:jo(e.spopRoomWork),notification_recipients:e.notificationRecipients}}function Wo(e){return Go(e)}function Go(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,startDateTime:c(e,"start_date_time")?e.start_date_time:void 0,endDateTime:c(e,"end_date_time")?e.end_date_time:void 0,approvalStatus:c(e,"approval_status")?e.approval_status:void 0,modifiedBy:c(e,"modified_by")?e.modified_by:void 0}}function Zo(e){return Ko(e)}function Ko(e,t){return e==null?e:{ppopSpaceFrom:c(e,"ppop_space_from")?e.ppop_space_from:void 0,ppopSpaceTo:c(e,"ppop_space_to")?e.ppop_space_to:void 0,cableType:c(e,"cable_type")?e.cable_type:void 0,onLadderRack:c(e,"on_ladder_rack")?e.on_ladder_rack:void 0,inInnerDuct:c(e,"in_inner_duct")?e.in_inner_duct:void 0,inFiberGuide:c(e,"in_fiber_guide")?e.in_fiber_guide:void 0}}function Yo(e){return Xo(e)}function Xo(e,t){return e==null?e:{sideAName:c(e,"side_a_name")?e.side_a_name:void 0,sideARoomNumber:c(e,"side_a_room_number")?e.side_a_room_number:void 0,sideARackNumber:c(e,"side_a_rack_number")?e.side_a_rack_number:void 0,sideAPanelNumber:c(e,"side_a_panel_number")?e.side_a_panel_number:void 0,sideAPort1:c(e,"side_a_port_1")?e.side_a_port_1:void 0,sideACarrierCircuitId:c(e,"side_a_carrier_circuit_id")?e.side_a_carrier_circuit_id:void 0,sideBName:c(e,"side_b_name")?e.side_b_name:void 0,sideBRoomNumber:c(e,"side_b_room_number")?e.side_b_room_number:void 0,sideBRackNumber:c(e,"side_b_rack_number")?e.side_b_rack_number:void 0,sideBPanelNumber:c(e,"side_b_panel_number")?e.side_b_panel_number:void 0,sideBPort1:c(e,"side_b_port_1")?e.side_b_port_1:void 0,sideBCarrierCircuitId:c(e,"side_b_carrier_circuit_id")?e.side_b_carrier_circuit_id:void 0}}const We={SiteSurvey:"Site Survey",Testing:"Testing",InstallationDeInstallationWork:"Installation/De-installation Work"};function Qo(e){return er(e)}function er(e,t){return e==null?e:{serviceType:c(e,"service_type")?e.service_type:void 0,scope:c(e,"scope")?e.scope:void 0,circuits:c(e,"circuits")?e.circuits.map(Yo):void 0,workDescription:c(e,"work_description")?e.work_description:void 0}}function tr(e){return ir(e)}function ir(e,t){return e==null?e:{spopSpaceFrom:c(e,"spop_space_from")?e.spop_space_from:void 0,spopSpaceTo:c(e,"spop_space_to")?e.spop_space_to:void 0,cableType:c(e,"cable_type")?e.cable_type:void 0,onLadderRack:c(e,"on_ladder_rack")?e.on_ladder_rack:void 0,inInnerDuct:c(e,"in_inner_duct")?e.in_inner_duct:void 0,inFiberGuide:c(e,"in_fiber_guide")?e.in_fiber_guide:void 0}}function vs(e){return sr(e)}function sr(e,t){return e==null?e:{accountNumber:c(e,"account_number")?e.account_number:void 0,accountName:c(e,"account_name")?e.account_name:void 0,id:c(e,"id")?e.id:void 0,status:c(e,"status")?e.status:void 0,cancellationReason:c(e,"cancellation_reason")?e.cancellation_reason:void 0,subject:c(e,"subject")?e.subject:void 0,visitorFirstName:c(e,"visitor_first_name")?e.visitor_first_name:void 0,visitorLastName:c(e,"visitor_last_name")?e.visitor_last_name:void 0,visitorEmail:c(e,"visitor_email")?e.visitor_email:void 0,visitorCompany:c(e,"visitor_company")?e.visitor_company:void 0,visitorPhone:c(e,"visitor_phone")?e.visitor_phone:void 0,visitorType:c(e,"visitor_type")?e.visitor_type:void 0,site:c(e,"site")?e.site:void 0,locations:c(e,"locations")?e.locations.map(Wo):void 0,escortFirstName:c(e,"escort_first_name")?e.escort_first_name:void 0,escortLastName:c(e,"escort_last_name")?e.escort_last_name:void 0,visitorHostFirstName:c(e,"visitor_host_first_name")?e.visitor_host_first_name:void 0,visitorHostLastName:c(e,"visitor_host_last_name")?e.visitor_host_last_name:void 0,visitorHostCompany:c(e,"visitor_host_company")?e.visitor_host_company:void 0,customerExternalReference:c(e,"customer_external_reference")?e.customer_external_reference:void 0,serviceImpactedDescription:c(e,"service_impacted_description")?e.service_impacted_description:void 0,serviceDetails:c(e,"service_details")?Qo(e.service_details):void 0,ppopSpace:c(e,"ppop_space")?e.ppop_space.map(ps):void 0,spopSpace:c(e,"spop_space")?e.spop_space.map(ps):void 0,ppopRoomWork:c(e,"ppop_room_work")?Zo(e.ppop_room_work):void 0,spopRoomWork:c(e,"spop_room_work")?tr(e.spop_room_work):void 0,notificationRecipients:c(e,"notification_recipients")?e.notification_recipients:void 0,createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?e.created_at:void 0,updatedAt:c(e,"updated_at")?e.updated_at:void 0,closedAt:c(e,"closed_at")?e.closed_at:void 0,comments:c(e,"comments")?e.comments.map(At):void 0}}function nr(e){if(e!==void 0)return e===null?null:{id:e.id,start_date_time:e.startDateTime.toISOString(),end_date_time:e.endDateTime.toISOString()}}function ar(e){if(e!==void 0)return e===null?null:{ppop_space_from:e.ppopSpaceFrom,ppop_space_to:e.ppopSpaceTo,cable_type:e.cableType,on_ladder_rack:e.onLadderRack,in_inner_duct:e.inInnerDuct,in_fiber_guide:e.inFiberGuide}}function gs(e){if(e!==void 0)return e===null?null:{id:e.id,rack:e.rack,cabinet:e.cabinet}}function or(e){if(e!==void 0)return e===null?null:{id:e.id,side_a_name:e.sideAName,side_a_room_number:e.sideARoomNumber,side_a_rack_number:e.sideARackNumber,side_a_panel_number:e.sideAPanelNumber,side_a_port_1:e.sideAPort1,side_a_carrier_circuit_id:e.sideACarrierCircuitId,side_b_name:e.sideBName,side_b_room_number:e.sideBRoomNumber,side_b_rack_number:e.sideBRackNumber,side_b_panel_number:e.sideBPanelNumber,side_b_port_1:e.sideBPort1,side_b_carrier_circuit_id:e.sideBCarrierCircuitId}}function rr(e){if(e!==void 0)return e===null?null:{service_type:e.serviceType,scope:e.scope,circuits:e.circuits===void 0?void 0:e.circuits.map(or),work_description:e.workDescription}}function cr(e){if(e!==void 0)return e===null?null:{spop_space_from:e.spopSpaceFrom,spop_space_to:e.spopSpaceTo,cable_type:e.cableType,on_ladder_rack:e.onLadderRack,in_inner_duct:e.inInnerDuct,in_fiber_guide:e.inFiberGuide}}function dr(e){if(e!==void 0)return e===null?null:{visitor_phone:e.visitorPhone,escort_first_name:e.escortFirstName,escort_last_name:e.escortLastName,visitor_host_first_name:e.visitorHostFirstName,visitor_host_last_name:e.visitorHostLastName,visitor_company:e.visitorCompany,service_impacted_description:e.serviceImpactedDescription,locations:e.locations===void 0?void 0:e.locations.map(nr),service_details:rr(e.serviceDetails),ppop_space:e.ppopSpace===void 0?void 0:e.ppopSpace.map(gs),spop_space:e.spopSpace===void 0?void 0:e.spopSpace.map(gs),ppop_room_work:ar(e.ppopRoomWork),spop_room_work:cr(e.spopRoomWork),customer_external_reference:e.customerExternalReference,notification_recipients:e.notificationRecipients}}function ur(e){return lr(e)}function lr(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,startDateTime:c(e,"start_date_time")?new Date(e.start_date_time):void 0,endDateTime:c(e,"end_date_time")?new Date(e.end_date_time):void 0,approvalStatus:c(e,"approval_status")?e.approval_status:void 0,modifiedBy:c(e,"modified_by")?e.modified_by:void 0}}function mr(e){return pr(e)}function pr(e,t){return e==null?e:{accountNumber:c(e,"account_number")?e.account_number:void 0,accountName:c(e,"account_name")?e.account_name:void 0,id:c(e,"id")?e.id:void 0,status:c(e,"status")?e.status:void 0,subject:c(e,"subject")?e.subject:void 0,site:c(e,"site")?e.site:void 0,locations:c(e,"locations")?e.locations.map(ur):void 0,description:c(e,"description")?e.description:void 0,createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?new Date(e.created_at):void 0,updatedAt:c(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:c(e,"closed_at")?new Date(e.closed_at):void 0}}function hr(e){return vr(e)}function vr(e,t){return e==null?e:{items:c(e,"items")?e.items.map(mr):void 0,totalCount:c(e,"total_count")?e.total_count:void 0,pageNumber:c(e,"page_number")?e.page_number:void 0,pageSize:c(e,"page_size")?e.page_size:void 0}}function gr(e){if(e!==void 0)return e===null?null:{id:e.id,start_date:e.startDate===void 0?void 0:e.startDate.toISOString().substring(0,10),end_date:e.endDate===void 0?void 0:e.endDate.toISOString().substring(0,10),operation:e.operation}}function wr(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,badgeholder_id:e.badgeholderId,badge_start_date:e.badgeStartDate.toISOString().substring(0,10),badge_end_date:e.badgeEndDate===void 0?void 0:e.badgeEndDate.toISOString().substring(0,10),locations:e.locations===void 0?void 0:e.locations.map(gr),notification_recipients:e.notificationRecipients}}function fr(e){if(e!==void 0)return e===null?null:{id:e.id,start_date:e.startDate===void 0?void 0:e.startDate.toISOString().substring(0,10),end_date:e.endDate===void 0?void 0:e.endDate.toISOString().substring(0,10)}}function kr(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,badgeholder_first_name:e.badgeholderFirstName,badgeholder_last_name:e.badgeholderLastName,badgeholder_email:e.badgeholderEmail,badgeholder_company:e.badgeholderCompany,badgeholder_phone:e.badgeholderPhone,badge_start_date:e.badgeStartDate.toISOString().substring(0,10),badge_end_date:e.badgeEndDate===void 0?void 0:e.badgeEndDate.toISOString().substring(0,10),locations:e.locations===void 0?void 0:e.locations.map(fr),notification_recipients:e.notificationRecipients}}function yr(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,badgeholder_id:e.badgeholderId,badge_end_date:e.badgeEndDate.toISOString().substring(0,10),notification_recipients:e.notificationRecipients}}function ws(e){return Tr(e)}function Tr(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,site:c(e,"site")?e.site:void 0,siteAddress:c(e,"site_address")?e.site_address:void 0,startDate:c(e,"start_date")?e.start_date:void 0,endDate:c(e,"end_date")?e.end_date:void 0,approvalStatus:c(e,"approval_status")?e.approval_status:void 0,modifiedBy:c(e,"modified_by")?e.modified_by:void 0}}function fs(e){return br(e)}function br(e,t){return e==null?e:{accountNumber:c(e,"account_number")?e.account_number:void 0,accountName:c(e,"account_name")?e.account_name:void 0,id:c(e,"id")?e.id:void 0,status:c(e,"status")?e.status:void 0,cancellationReason:c(e,"cancellation_reason")?e.cancellation_reason:void 0,subject:c(e,"subject")?e.subject:void 0,badgeholderFirstName:c(e,"badgeholder_first_name")?e.badgeholder_first_name:void 0,badgeholderLastName:c(e,"badgeholder_last_name")?e.badgeholder_last_name:void 0,badgeholderEmail:c(e,"badgeholder_email")?e.badgeholder_email:void 0,badgeholderPhone:c(e,"badgeholder_phone")?e.badgeholder_phone:void 0,badgeholderCompany:c(e,"badgeholder_company")?e.badgeholder_company:void 0,requestType:c(e,"request_type")?e.request_type:void 0,badgeStartDate:c(e,"badge_start_date")?e.badge_start_date:void 0,badgeEndDate:c(e,"badge_end_date")?e.badge_end_date:void 0,locations:c(e,"locations")?e.locations.map(ws):void 0,notificationRecipients:c(e,"notification_recipients")?e.notification_recipients:void 0,createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?new Date(e.created_at):void 0,updatedAt:c(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:c(e,"closed_at")?new Date(e.closed_at):void 0,comments:c(e,"comments")?e.comments.map(At):void 0}}function Rr(e){if(e!==void 0)return e===null?null:{other_notification_recipients:e.otherNotificationRecipients}}function Ar(e){return _r(e)}function _r(e,t){return e==null?e:{accountNumber:c(e,"account_number")?e.account_number:void 0,accountName:c(e,"account_name")?e.account_name:void 0,id:c(e,"id")?e.id:void 0,status:c(e,"status")?e.status:void 0,subject:c(e,"subject")?e.subject:void 0,badgeholderEmail:c(e,"badgeholder_email")?e.badgeholder_email:void 0,requestType:c(e,"request_type")?e.request_type:void 0,locations:c(e,"locations")?e.locations.map(ws):void 0,createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?new Date(e.created_at):void 0,updatedAt:c(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:c(e,"closed_at")?new Date(e.closed_at):void 0}}function Sr(e){return Ir(e)}function Ir(e,t){return e==null?e:{items:c(e,"items")?e.items.map(Ar):void 0,totalCount:c(e,"total_count")?e.total_count:void 0,pageNumber:c(e,"page_number")?e.page_number:void 0,pageSize:c(e,"page_size")?e.page_size:void 0}}function _t(e){return Cr(e)}function Cr(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,fileName:c(e,"file_name")?e.file_name:void 0,fileSize:c(e,"file_size")?e.file_size:void 0,contentType:c(e,"content_type")?e.content_type:void 0,createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?e.created_at===null?null:new Date(e.created_at):void 0}}function jt(e){return Nr(e)}function Nr(e,t){return e==null?e:{attachments:c(e,"attachments")?e.attachments.map(_t):void 0}}function Mt(e){if(e!==void 0)return e===null?null:{comment:e.comment}}function ht(e){return Pr(e)}function Pr(e,t){return e==null?e:{ticketNumbers:c(e,"ticket_numbers")?e.ticket_numbers:void 0}}function qr(e){if(e!==void 0)return e===null?null:{id:e.id,start_date:e.startDate===void 0?void 0:e.startDate.toISOString().substring(0,10),end_date:e.endDate===void 0?void 0:e.endDate.toISOString().substring(0,10)}}function Dr(e){if(e!==void 0)return e===null?null:{site_code:e.siteCode,visitor_host_id:e.visitorHostId,locations:e.locations===void 0?void 0:e.locations.map(qr)}}function Br(e){if(e!==void 0)return e===null?null:{first_name:e.firstName,last_name:e.lastName,email:e.email,phone:e.phone}}const Jt={Escorted:"Escorted",Standard:"Standard",Extended:"Extended"};function Or(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,visitors:e.visitors===void 0?void 0:e.visitors.map(Br),visit_start_date:e.visitStartDate.toISOString().substring(0,10),visit_end_date:e.visitEndDate.toISOString().substring(0,10),visit_type:e.visitType,sites:e.sites===void 0?void 0:e.sites.map(Dr),escort_first_name:e.escortFirstName,escort_last_name:e.escortLastName,visitor_host_first_name:e.visitorHostFirstName,visitor_host_last_name:e.visitorHostLastName,representing_company:e.representingCompany,description:e.description,notification_recipients:e.notificationRecipients}}function ks(e){return $r(e)}function $r(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,startDate:c(e,"start_date")?e.start_date:void 0,endDate:c(e,"end_date")?e.end_date:void 0,approvalStatus:c(e,"approval_status")?e.approval_status:void 0,modifiedBy:c(e,"modified_by")?e.modified_by:void 0}}function ys(e){return Er(e)}function Er(e,t){return e==null?e:{accountNumber:c(e,"account_number")?e.account_number:void 0,accountName:c(e,"account_name")?e.account_name:void 0,id:c(e,"id")?e.id:void 0,status:c(e,"status")?e.status:void 0,cancellationReason:c(e,"cancellation_reason")?e.cancellation_reason:void 0,subject:c(e,"subject")?e.subject:void 0,visitorFirstName:c(e,"visitor_first_name")?e.visitor_first_name:void 0,visitorLastName:c(e,"visitor_last_name")?e.visitor_last_name:void 0,visitorEmail:c(e,"visitor_email")?e.visitor_email:void 0,visitorPhone:c(e,"visitor_phone")?e.visitor_phone:void 0,visitStartDate:c(e,"visit_start_date")?e.visit_start_date:void 0,visitEndDate:c(e,"visit_end_date")?e.visit_end_date:void 0,visitType:c(e,"visit_type")?e.visit_type:void 0,site:c(e,"site")?e.site:void 0,locations:c(e,"locations")?e.locations.map(ks):void 0,escortFirstName:c(e,"escort_first_name")?e.escort_first_name:void 0,escortLastName:c(e,"escort_last_name")?e.escort_last_name:void 0,visitorHostFirstName:c(e,"visitor_host_first_name")?e.visitor_host_first_name:void 0,visitorHostLastName:c(e,"visitor_host_last_name")?e.visitor_host_last_name:void 0,representingCompany:c(e,"representing_company")?e.representing_company:void 0,description:c(e,"description")?e.description:void 0,notificationRecipients:c(e,"notification_recipients")?e.notification_recipients:void 0,createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?new Date(e.created_at):void 0,updatedAt:c(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:c(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0,comments:c(e,"comments")?e.comments.map(At):void 0}}function xr(e){if(e!==void 0)return e===null?null:{visitor_phone:e.visitorPhone,other_notification_recipients:e.otherNotificationRecipients}}function Fr(e){return Lr(e)}function Lr(e,t){return e==null?e:{accountNumber:c(e,"account_number")?e.account_number:void 0,accountName:c(e,"account_name")?e.account_name:void 0,id:c(e,"id")?e.id:void 0,status:c(e,"status")?e.status:void 0,subject:c(e,"subject")?e.subject:void 0,site:c(e,"site")?e.site:void 0,locations:c(e,"locations")?e.locations.map(ks):void 0,visitType:c(e,"visit_type")?e.visit_type:void 0,description:c(e,"description")?e.description:void 0,createdBy:c(e,"created_by")?e.created_by:void 0,createdAt:c(e,"created_at")?new Date(e.created_at):void 0,updatedAt:c(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:c(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0}}function Vr(e){return Ur(e)}function Ur(e,t){return e==null?e:{items:c(e,"items")?e.items.map(Fr):void 0,totalCount:c(e,"total_count")?e.total_count:void 0,pageNumber:c(e,"page_number")?e.page_number:void 0,pageSize:c(e,"page_size")?e.page_size:void 0}}function Hr(e){return zr(e)}function zr(e,t){return e==null?e:{id:c(e,"id")?e.id:void 0,firstName:c(e,"first_name")?e.first_name:void 0,lastName:c(e,"last_name")?e.last_name:void 0}}function jr(e){return Mr(e)}function Mr(e,t){return e==null?e:{items:c(e,"items")?e.items.map(Hr):void 0,totalCount:c(e,"total_count")?e.total_count:void 0}}class Jr extends Xe{async cancellationOspAccessRequestRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling cancellationOspAccessRequest.");if(t.cancellationTicketsRequest===null||t.cancellationTicketsRequest===void 0)throw new v("cancellationTicketsRequest","Required parameter requestParameters.cancellationTicketsRequest was null or undefined when calling cancellationOspAccessRequest.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/osp-access-tickets/{ticket_id}/cancel".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PUT",headers:n,query:s,body:Lt(t.cancellationTicketsRequest)},i);return new q(o,a=>Vt(a))}async cancellationOspAccessRequest(t,i){return await(await this.cancellationOspAccessRequestRaw(t,i)).value()}async createOspAccessAttachmentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createOspAccessAttachment.");if(t.fileName===null||t.fileName===void 0)throw new v("fileName","Required parameter requestParameters.fileName was null or undefined when calling createOspAccessAttachment.");if(t.body===null||t.body===void 0)throw new v("body","Required parameter requestParameters.body was null or undefined when calling createOspAccessAttachment.");const s={};t.fileName!==void 0&&(s.file_name=t.fileName);const n={};if(n["Content-Type"]="image/jpeg",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/osp-access-tickets/{ticket_id}/attachments/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:t.body},i);return new q(o,a=>_t(a))}async createOspAccessAttachment(t,i){return await(await this.createOspAccessAttachmentRaw(t,i)).value()}async createOspAccessCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createOspAccessComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new v("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createOspAccessComment.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/osp-access-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:Mt(t.ticketCommentsRequest)},i);return new q(o,a=>Ut(a))}async createOspAccessComment(t,i){return await(await this.createOspAccessCommentRaw(t,i)).value()}async createOspAccessTicketRaw(t,i){if(t.oSPAccessTicketRequest===null||t.oSPAccessTicketRequest===void 0)throw new v("oSPAccessTicketRequest","Required parameter requestParameters.oSPAccessTicketRequest was null or undefined when calling createOspAccessTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/osp-access-tickets",method:"POST",headers:n,query:s,body:Io(t.oSPAccessTicketRequest)},i);return new q(o,a=>ht(a))}async createOspAccessTicket(t,i){return await(await this.createOspAccessTicketRaw(t,i)).value()}async getOspAccessAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getOspAccessAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new v("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getOspAccessAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/osp-access-tickets/{ticket_id}/attachments/{attachment_id}/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new Ft(o)}async getOspAccessAttachmentsById(t,i){return await(await this.getOspAccessAttachmentsByIdRaw(t,i)).value()}async getOspAccessAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getOspAccessAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/osp-access-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new q(o,a=>jt(a))}async getOspAccessAttachmentsList(t,i){return await(await this.getOspAccessAttachmentsListRaw(t,i)).value()}async getOspAccessTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getOspAccessTicketById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/osp-access-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new q(o,a=>ms(a))}async getOspAccessTicketById(t,i){return await(await this.getOspAccessTicketByIdRaw(t,i)).value()}async getOspAccessTicketsRaw(t,i){const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.status!==void 0&&(s.status=t.status),t.createdBy!==void 0&&(s.created_by=t.createdBy),t.sort!==void 0&&(s.sort=t.sort),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={},o=await this.request({path:"/osp-access-tickets",method:"GET",headers:n,query:s},i);return new q(o,a=>xo(a))}async getOspAccessTickets(t={},i){return await(await this.getOspAccessTicketsRaw(t,i)).value()}async updateOspAccessLocationsTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateOspAccessLocationsTicket.");if(t.locationsPatchRequestInner===null||t.locationsPatchRequestInner===void 0)throw new v("locationsPatchRequestInner","Required parameter requestParameters.locationsPatchRequestInner was null or undefined when calling updateOspAccessLocationsTicket.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/osp-access-tickets/{ticket_id}/locations".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:t.locationsPatchRequestInner.map(Ht)},i);return new q(o,a=>zt(a))}async updateOspAccessLocationsTicket(t,i){return await(await this.updateOspAccessLocationsTicketRaw(t,i)).value()}async updateOspAccessTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateOspAccessTicket.");if(t.oSPAccessTicketUpdateRequest===null||t.oSPAccessTicketUpdateRequest===void 0)throw new v("oSPAccessTicketUpdateRequest","Required parameter requestParameters.oSPAccessTicketUpdateRequest was null or undefined when calling updateOspAccessTicket.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/osp-access-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:Do(t.oSPAccessTicketUpdateRequest)},i);return new q(o,a=>ms(a))}async updateOspAccessTicket(t,i){return await(await this.updateOspAccessTicketRaw(t,i)).value()}}class Wr extends Xe{async cancellationPopAccessRequestRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling cancellationPopAccessRequest.");if(t.cancellationTicketsRequest===null||t.cancellationTicketsRequest===void 0)throw new v("cancellationTicketsRequest","Required parameter requestParameters.cancellationTicketsRequest was null or undefined when calling cancellationPopAccessRequest.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/pop-access-tickets/{ticket_id}/cancel".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PUT",headers:n,query:s,body:Lt(t.cancellationTicketsRequest)},i);return new q(o,a=>Vt(a))}async cancellationPopAccessRequest(t,i){return await(await this.cancellationPopAccessRequestRaw(t,i)).value()}async createPopAccessAttachmentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createPopAccessAttachment.");if(t.fileName===null||t.fileName===void 0)throw new v("fileName","Required parameter requestParameters.fileName was null or undefined when calling createPopAccessAttachment.");if(t.body===null||t.body===void 0)throw new v("body","Required parameter requestParameters.body was null or undefined when calling createPopAccessAttachment.");const s={};t.fileName!==void 0&&(s.file_name=t.fileName);const n={};if(n["Content-Type"]="image/jpeg",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/pop-access-tickets/{ticket_id}/attachments/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:t.body},i);return new q(o,a=>_t(a))}async createPopAccessAttachment(t,i){return await(await this.createPopAccessAttachmentRaw(t,i)).value()}async createPopAccessCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createPopAccessComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new v("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createPopAccessComment.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/pop-access-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:Mt(t.ticketCommentsRequest)},i);return new q(o,a=>Ut(a))}async createPopAccessComment(t,i){return await(await this.createPopAccessCommentRaw(t,i)).value()}async createPopAccessTicketRaw(t,i){if(t.pOPAccessTicketRequest===null||t.pOPAccessTicketRequest===void 0)throw new v("pOPAccessTicketRequest","Required parameter requestParameters.pOPAccessTicketRequest was null or undefined when calling createPopAccessTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/pop-access-tickets",method:"POST",headers:n,query:s,body:Jo(t.pOPAccessTicketRequest)},i);return new q(o,a=>ht(a))}async createPopAccessTicket(t,i){return await(await this.createPopAccessTicketRaw(t,i)).value()}async getPopAccessAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getPopAccessAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new v("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getPopAccessAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/pop-access-tickets/{ticket_id}/attachments/{attachment_id}/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new Ft(o)}async getPopAccessAttachmentsById(t,i){return await(await this.getPopAccessAttachmentsByIdRaw(t,i)).value()}async getPopAccessAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getPopAccessAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/pop-access-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new q(o,a=>jt(a))}async getPopAccessAttachmentsList(t,i){return await(await this.getPopAccessAttachmentsListRaw(t,i)).value()}async getPopAccessTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getPopAccessTicketById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/pop-access-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new q(o,a=>vs(a))}async getPopAccessTicketById(t,i){return await(await this.getPopAccessTicketByIdRaw(t,i)).value()}async getPopAccessTicketsRaw(t,i){const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.status!==void 0&&(s.status=t.status),t.createdBy!==void 0&&(s.created_by=t.createdBy),t.sort!==void 0&&(s.sort=t.sort),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={},o=await this.request({path:"/pop-access-tickets",method:"GET",headers:n,query:s},i);return new q(o,a=>hr(a))}async getPopAccessTickets(t={},i){return await(await this.getPopAccessTicketsRaw(t,i)).value()}async updatePopAccessLocationsTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updatePopAccessLocationsTicket.");if(t.locationsPatchRequestInner===null||t.locationsPatchRequestInner===void 0)throw new v("locationsPatchRequestInner","Required parameter requestParameters.locationsPatchRequestInner was null or undefined when calling updatePopAccessLocationsTicket.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/pop-access-tickets/{ticket_id}/locations".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:t.locationsPatchRequestInner.map(Ht)},i);return new q(o,a=>zt(a))}async updatePopAccessLocationsTicket(t,i){return await(await this.updatePopAccessLocationsTicketRaw(t,i)).value()}async updatePopAccessTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updatePopAccessTicket.");if(t.pOPAccessTicketUpdateRequest===null||t.pOPAccessTicketUpdateRequest===void 0)throw new v("pOPAccessTicketUpdateRequest","Required parameter requestParameters.pOPAccessTicketUpdateRequest was null or undefined when calling updatePopAccessTicket.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/pop-access-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:dr(t.pOPAccessTicketUpdateRequest)},i);return new q(o,a=>vs(a))}async updatePopAccessTicket(t,i){return await(await this.updatePopAccessTicketRaw(t,i)).value()}}class Gr extends Xe{async cancellationPermanentBadgeRequestRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling cancellationPermanentBadgeRequest.");if(t.cancellationTicketsRequest===null||t.cancellationTicketsRequest===void 0)throw new v("cancellationTicketsRequest","Required parameter requestParameters.cancellationTicketsRequest was null or undefined when calling cancellationPermanentBadgeRequest.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-tickets/{ticket_id}/cancel".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PUT",headers:n,query:s,body:Lt(t.cancellationTicketsRequest)},i);return new q(o,a=>Vt(a))}async cancellationPermanentBadgeRequest(t,i){return await(await this.cancellationPermanentBadgeRequestRaw(t,i)).value()}async createPermanentBadegeAttachmentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createPermanentBadegeAttachment.");if(t.fileName===null||t.fileName===void 0)throw new v("fileName","Required parameter requestParameters.fileName was null or undefined when calling createPermanentBadegeAttachment.");if(t.body===null||t.body===void 0)throw new v("body","Required parameter requestParameters.body was null or undefined when calling createPermanentBadegeAttachment.");const s={};t.fileName!==void 0&&(s.file_name=t.fileName);const n={};if(n["Content-Type"]="image/jpeg",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-tickets/{ticket_id}/attachments/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:t.body},i);return new q(o,a=>_t(a))}async createPermanentBadegeAttachment(t,i){return await(await this.createPermanentBadegeAttachmentRaw(t,i)).value()}async createPermanentBadgeCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createPermanentBadgeComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new v("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createPermanentBadgeComment.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:Mt(t.ticketCommentsRequest)},i);return new q(o,a=>Ut(a))}async createPermanentBadgeComment(t,i){return await(await this.createPermanentBadgeCommentRaw(t,i)).value()}async createPermanentBadgeModifyTicketRaw(t,i){if(t.permanentBadgeAccessModifyTicketRequest===null||t.permanentBadgeAccessModifyTicketRequest===void 0)throw new v("permanentBadgeAccessModifyTicketRequest","Required parameter requestParameters.permanentBadgeAccessModifyTicketRequest was null or undefined when calling createPermanentBadgeModifyTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-access-modify-tickets",method:"POST",headers:n,query:s,body:wr(t.permanentBadgeAccessModifyTicketRequest)},i);return new q(o,a=>ht(a))}async createPermanentBadgeModifyTicket(t,i){return await(await this.createPermanentBadgeModifyTicketRaw(t,i)).value()}async createPermanentBadgeNewTicketRaw(t,i){if(t.permanentBadgeAccessNewTicketRequest===null||t.permanentBadgeAccessNewTicketRequest===void 0)throw new v("permanentBadgeAccessNewTicketRequest","Required parameter requestParameters.permanentBadgeAccessNewTicketRequest was null or undefined when calling createPermanentBadgeNewTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-access-new-tickets",method:"POST",headers:n,query:s,body:kr(t.permanentBadgeAccessNewTicketRequest)},i);return new q(o,a=>ht(a))}async createPermanentBadgeNewTicket(t,i){return await(await this.createPermanentBadgeNewTicketRaw(t,i)).value()}async createPermanentBadgeTerminateTicketRaw(t,i){if(t.permanentBadgeAccessTerminateTicketRequest===null||t.permanentBadgeAccessTerminateTicketRequest===void 0)throw new v("permanentBadgeAccessTerminateTicketRequest","Required parameter requestParameters.permanentBadgeAccessTerminateTicketRequest was null or undefined when calling createPermanentBadgeTerminateTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-access-terminate-tickets",method:"POST",headers:n,query:s,body:yr(t.permanentBadgeAccessTerminateTicketRequest)},i);return new q(o,a=>ht(a))}async createPermanentBadgeTerminateTicket(t,i){return await(await this.createPermanentBadgeTerminateTicketRaw(t,i)).value()}async getPermanentBadgeAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getPermanentBadgeAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new v("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getPermanentBadgeAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-tickets/{ticket_id}/attachments/{attachment_id}/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new Ft(o)}async getPermanentBadgeAttachmentsById(t,i){return await(await this.getPermanentBadgeAttachmentsByIdRaw(t,i)).value()}async getPermanentBadgeAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getPermanentBadgeAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new q(o,a=>jt(a))}async getPermanentBadgeAttachmentsList(t,i){return await(await this.getPermanentBadgeAttachmentsListRaw(t,i)).value()}async getPermanentBadgeHoldersListRaw(t,i){if(t.accountNumber===null||t.accountNumber===void 0)throw new v("accountNumber","Required parameter requestParameters.accountNumber was null or undefined when calling getPermanentBadgeHoldersList.");const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.activeBadge!==void 0&&(s.active_badge=t.activeBadge),t.nameOrEmailContains!==void 0&&(s.name_or_email_contains=t.nameOrEmailContains),t.page!==void 0&&(s.page=t.page),t.size!==void 0&&(s.size=t.size);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-tickets/badge-holders",method:"GET",headers:n,query:s},i);return new q(o,a=>wo(a))}async getPermanentBadgeHoldersList(t,i){return await(await this.getPermanentBadgeHoldersListRaw(t,i)).value()}async getPermanentBadgeTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getPermanentBadgeTicketById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new q(o,a=>fs(a))}async getPermanentBadgeTicketById(t,i){return await(await this.getPermanentBadgeTicketByIdRaw(t,i)).value()}async getPermanentBadgeTicketsRaw(t,i){const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.status!==void 0&&(s.status=t.status),t.createdBy!==void 0&&(s.created_by=t.createdBy),t.sort!==void 0&&(s.sort=t.sort),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={},o=await this.request({path:"/permanent-badge-access-tickets",method:"GET",headers:n,query:s},i);return new q(o,a=>Sr(a))}async getPermanentBadgeTickets(t={},i){return await(await this.getPermanentBadgeTicketsRaw(t,i)).value()}async updatePermanentBadgeLocationsTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updatePermanentBadgeLocationsTicket.");if(t.locationsPatchRequestInner===null||t.locationsPatchRequestInner===void 0)throw new v("locationsPatchRequestInner","Required parameter requestParameters.locationsPatchRequestInner was null or undefined when calling updatePermanentBadgeLocationsTicket.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-tickets/{ticket_id}/locations".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:t.locationsPatchRequestInner.map(Ht)},i);return new q(o,a=>zt(a))}async updatePermanentBadgeLocationsTicket(t,i){return await(await this.updatePermanentBadgeLocationsTicketRaw(t,i)).value()}async updatePermanentBadgeTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updatePermanentBadgeTicket.");if(t.permanentBadgeAccessTicketUpdateRequest===null||t.permanentBadgeAccessTicketUpdateRequest===void 0)throw new v("permanentBadgeAccessTicketUpdateRequest","Required parameter requestParameters.permanentBadgeAccessTicketUpdateRequest was null or undefined when calling updatePermanentBadgeTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/permanent-badge-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:Rr(t.permanentBadgeAccessTicketUpdateRequest)},i);return new q(o,a=>fs(a))}async updatePermanentBadgeTicket(t,i){return await(await this.updatePermanentBadgeTicketRaw(t,i)).value()}}class Zr extends Xe{async cancellationVisitorAccessRequestRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling cancellationVisitorAccessRequest.");if(t.cancellationTicketsRequest===null||t.cancellationTicketsRequest===void 0)throw new v("cancellationTicketsRequest","Required parameter requestParameters.cancellationTicketsRequest was null or undefined when calling cancellationVisitorAccessRequest.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-access-tickets/{ticket_id}/cancel".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PUT",headers:n,query:s,body:Lt(t.cancellationTicketsRequest)},i);return new q(o,a=>Vt(a))}async cancellationVisitorAccessRequest(t,i){return await(await this.cancellationVisitorAccessRequestRaw(t,i)).value()}async createVisitorAccessAttachmentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createVisitorAccessAttachment.");if(t.fileName===null||t.fileName===void 0)throw new v("fileName","Required parameter requestParameters.fileName was null or undefined when calling createVisitorAccessAttachment.");if(t.body===null||t.body===void 0)throw new v("body","Required parameter requestParameters.body was null or undefined when calling createVisitorAccessAttachment.");const s={};t.fileName!==void 0&&(s.file_name=t.fileName);const n={};if(n["Content-Type"]="image/jpeg",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-access-tickets/{ticket_id}/attachments/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:t.body},i);return new q(o,a=>_t(a))}async createVisitorAccessAttachment(t,i){return await(await this.createVisitorAccessAttachmentRaw(t,i)).value()}async createVisitorAccessCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createVisitorAccessComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new v("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createVisitorAccessComment.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-access-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:Mt(t.ticketCommentsRequest)},i);return new q(o,a=>Ut(a))}async createVisitorAccessComment(t,i){return await(await this.createVisitorAccessCommentRaw(t,i)).value()}async createVisitorAccessTicketRaw(t,i){if(t.visitorAccessTicketRequest===null||t.visitorAccessTicketRequest===void 0)throw new v("visitorAccessTicketRequest","Required parameter requestParameters.visitorAccessTicketRequest was null or undefined when calling createVisitorAccessTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-access-tickets",method:"POST",headers:n,query:s,body:Or(t.visitorAccessTicketRequest)},i);return new q(o,a=>ht(a))}async createVisitorAccessTicket(t,i){return await(await this.createVisitorAccessTicketRaw(t,i)).value()}async getVisitorAccessAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getVisitorAccessAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new v("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getVisitorAccessAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-access-tickets/{ticket_id}/attachments/{attachment_id}/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new Ft(o)}async getVisitorAccessAttachmentsById(t,i){return await(await this.getVisitorAccessAttachmentsByIdRaw(t,i)).value()}async getVisitorAccessAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getVisitorAccessAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-access-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new q(o,a=>jt(a))}async getVisitorAccessAttachmentsList(t,i){return await(await this.getVisitorAccessAttachmentsListRaw(t,i)).value()}async getVisitorAccessTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getVisitorAccessTicketById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-access-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new q(o,a=>ys(a))}async getVisitorAccessTicketById(t,i){return await(await this.getVisitorAccessTicketByIdRaw(t,i)).value()}async getVisitorAccessTicketsRaw(t,i){const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.status!==void 0&&(s.status=t.status),t.createdBy!==void 0&&(s.created_by=t.createdBy),t.sort!==void 0&&(s.sort=t.sort),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={},o=await this.request({path:"/visitor-access-tickets",method:"GET",headers:n,query:s},i);return new q(o,a=>Vr(a))}async getVisitorAccessTickets(t={},i){return await(await this.getVisitorAccessTicketsRaw(t,i)).value()}async updateVisitorAccessLocationsTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateVisitorAccessLocationsTicket.");if(t.locationsPatchRequestInner===null||t.locationsPatchRequestInner===void 0)throw new v("locationsPatchRequestInner","Required parameter requestParameters.locationsPatchRequestInner was null or undefined when calling updateVisitorAccessLocationsTicket.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-access-tickets/{ticket_id}/locations".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:t.locationsPatchRequestInner.map(Ht)},i);return new q(o,a=>zt(a))}async updateVisitorAccessLocationsTicket(t,i){return await(await this.updateVisitorAccessLocationsTicketRaw(t,i)).value()}async updateVisitorAccessTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new v("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateVisitorAccessTicket.");if(t.visitorAccessTicketUpdateRequest===null||t.visitorAccessTicketUpdateRequest===void 0)throw new v("visitorAccessTicketUpdateRequest","Required parameter requestParameters.visitorAccessTicketUpdateRequest was null or undefined when calling updateVisitorAccessTicket.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-access-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:xr(t.visitorAccessTicketUpdateRequest)},i);return new q(o,a=>ys(a))}async updateVisitorAccessTicket(t,i){return await(await this.updateVisitorAccessTicketRaw(t,i)).value()}}class Kr extends Xe{async getVisitorHostsListRaw(t,i){if(t.site===null||t.site===void 0)throw new v("site","Required parameter requestParameters.site was null or undefined when calling getVisitorHostsList.");const s={};t.site!==void 0&&(s.site=t.site),t.nameOrEmailContains!==void 0&&(s.name_or_email_contains=t.nameOrEmailContains),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/visitor-hosts",method:"GET",headers:n,query:s},i);return new q(o,a=>jr(a))}async getVisitorHostsList(t,i){return await(await this.getVisitorHostsListRaw(t,i)).value()}}const Yr="http://localhost".replace(/\/+$/,"");class Wt{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Yr}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Ts}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Xr=new Wt;class Bt{constructor(t=Xr){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new ic(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?Bt.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new tc(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;ec(r.body)||r.body instanceof URLSearchParams||Qr(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}Bt.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function Qr(e){return typeof Blob<"u"&&e instanceof Blob}function ec(e){return typeof FormData<"u"&&e instanceof FormData}class tc extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class ic extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class Ti extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function f(e,t){return e[t]!=null}function Ts(e,t=""){return Object.keys(e).map(i=>bs(i,e[i],t)).filter(i=>i.length>0).join("&")}function bs(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return bs(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Ts(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class St{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}const sc="https://service-management.digitalrealty.com".replace(/\/+$/,"");class Gt{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:sc}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Rs}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const nc=new Gt;class yt{constructor(t=nc){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new cc(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?yt.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new rc(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;oc(r.body)||r.body instanceof URLSearchParams||ac(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}yt.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function ac(e){return typeof Blob<"u"&&e instanceof Blob}function oc(e){return typeof FormData<"u"&&e instanceof FormData}class rc extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class cc extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class dt extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function Ge(e,t){return e[t]!=null}function Rs(e,t=""){return Object.keys(e).map(i=>As(i,e[i],t)).filter(i=>i.length>0).join("&")}function As(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return As(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Rs(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class bi{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class dc{constructor(t){this.raw=t}async value(){return await this.raw.text()}}const uc="https://service-management.digitalrealty.com".replace(/\/+$/,"");class _s{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:uc}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Ss}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const lc=new _s;class oi{constructor(t=lc){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new vc(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?oi.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new hc(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;pc(r.body)||r.body instanceof URLSearchParams||mc(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}oi.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function mc(e){return typeof Blob<"u"&&e instanceof Blob}function pc(e){return typeof FormData<"u"&&e instanceof FormData}class hc extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class vc extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class te extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function _(e,t){return e[t]!=null}function Ss(e,t=""){return Object.keys(e).map(i=>Is(i,e[i],t)).filter(i=>i.length>0).join("&")}function Is(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return Is(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Ss(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class Pe{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class gc{constructor(t){this.raw=t}async value(){return await this.raw.blob()}}function wc(e){if(e!==void 0)return e===null?null:{cancellationReason:e.cancellationReason}}function fc(e){return kc(e)}function kc(e,t){return e==null?e:{message:_(e,"message")?e.message:void 0}}function yc(e){return Tc(e)}function Tc(e,t){return e==null?e:{requestType:_(e,"request_type")?e.request_type:void 0,categories:_(e,"categories")?e.categories:void 0}}function bc(e){return Rc(e)}function Rc(e,t){return e==null?e:{items:_(e,"items")?e.items.map(yc):void 0}}function Cs(e){return Ac(e)}function Ac(e,t){return e==null?e:{createdBy:_(e,"created_by")?e.created_by:void 0,createdAt:_(e,"created_at")?new Date(e.created_at):void 0,comment:_(e,"comment")?e.comment:void 0}}function _c(e){return Sc(e)}function Sc(e,t){return e==null?e:{comments:_(e,"comments")?e.comments.map(Cs):void 0}}function Ic(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,request_type:e.requestType,category:e.category,subject:e.subject,description:e.description,expected_start:e.expectedStart===void 0?void 0:e.expectedStart===null?null:e.expectedStart.toISOString(),customer_reference:e.customerReference,locations:e.locations,reference_ticket:e.referenceTicket,other_notification_recipients:e.otherNotificationRecipients}}function Ri(e){return Cc(e)}function Cc(e,t){return e==null?e:{ticketId:_(e,"ticket_id")?e.ticket_id:void 0,accountNumber:_(e,"account_number")?e.account_number:void 0,accountName:_(e,"account_name")?e.account_name:void 0,status:_(e,"status")?e.status:void 0,cancellationReason:_(e,"cancellation_reason")?e.cancellation_reason:void 0,site:_(e,"site")?e.site:void 0,locations:_(e,"locations")?e.locations:void 0,requestType:_(e,"request_type")?e.request_type:void 0,category:_(e,"category")?e.category:void 0,subject:_(e,"subject")?e.subject:void 0,description:_(e,"description")?e.description:void 0,expectedStart:_(e,"expected_start")?e.expected_start===null?null:new Date(e.expected_start):void 0,referenceTicket:_(e,"reference_ticket")?e.reference_ticket:void 0,customerReference:_(e,"customer_reference")?e.customer_reference:void 0,otherNotificationRecipients:_(e,"other_notification_recipients")?e.other_notification_recipients:void 0,createdBy:_(e,"created_by")?e.created_by:void 0,createdAt:_(e,"created_at")?new Date(e.created_at):void 0,updatedAt:_(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:_(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0,comments:_(e,"comments")?e.comments.map(Cs):void 0}}function Nc(e){return Pc(e)}function Pc(e,t){return e==null?e:{accountNumber:_(e,"account_number")?e.account_number:void 0,accountName:_(e,"account_name")?e.account_name:void 0,id:_(e,"id")?e.id:void 0,status:_(e,"status")?e.status:void 0,site:_(e,"site")?e.site:void 0,locations:_(e,"locations")?e.locations:void 0,description:_(e,"description")?e.description:void 0,subject:_(e,"subject")?e.subject:void 0,createdBy:_(e,"created_by")?e.created_by:void 0,updatedAt:_(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:_(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0}}function qc(e){return Dc(e)}function Dc(e,t){return e==null?e:{remoteHandsTickets:_(e,"remote_hands_tickets")?e.remote_hands_tickets.map(Nc):void 0,totalCount:_(e,"total_count")?e.total_count:void 0,pageNumber:_(e,"page_number")?e.page_number:void 0,pageSize:_(e,"page_size")?e.page_size:void 0}}function Bc(e){if(e!==void 0)return e===null?null:{customer_reference:e.customerReference,other_notification_recipients:e.otherNotificationRecipients}}function Ns(e){return Oc(e)}function Oc(e,t){return e==null?e:{id:_(e,"id")?e.id:void 0,fileName:_(e,"file_name")?e.file_name:void 0,fileSize:_(e,"file_size")?e.file_size:void 0,contentType:_(e,"content_type")?e.content_type:void 0,createdBy:_(e,"created_by")?e.created_by:void 0,createdAt:_(e,"created_at")?e.created_at===null?null:new Date(e.created_at):void 0}}function $c(e){return Ec(e)}function Ec(e,t){return e==null?e:{attachments:_(e,"attachments")?e.attachments.map(Ns):void 0}}function xc(e){if(e!==void 0)return e===null?null:{comment:e.comment}}class Fc extends oi{async cancellationRemoteHandsRequestRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new te("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling cancellationRemoteHandsRequest.");if(t.cancellationTicketsRequest===null||t.cancellationTicketsRequest===void 0)throw new te("cancellationTicketsRequest","Required parameter requestParameters.cancellationTicketsRequest was null or undefined when calling cancellationRemoteHandsRequest.");const s={},n={};n["Content-Type"]="application/json";const o=await this.request({path:"/remote-hands-tickets/{ticket_id}/cancel".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PUT",headers:n,query:s,body:wc(t.cancellationTicketsRequest)},i);return new Pe(o,a=>fc(a))}async cancellationRemoteHandsRequest(t,i){return await(await this.cancellationRemoteHandsRequestRaw(t,i)).value()}async createRemoteHandsAttachmentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new te("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createRemoteHandsAttachment.");if(t.fileName===null||t.fileName===void 0)throw new te("fileName","Required parameter requestParameters.fileName was null or undefined when calling createRemoteHandsAttachment.");if(t.body===null||t.body===void 0)throw new te("body","Required parameter requestParameters.body was null or undefined when calling createRemoteHandsAttachment.");const s={};t.fileName!==void 0&&(s.file_name=t.fileName);const n={};if(n["Content-Type"]="image/jpeg",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/remote-hands-tickets/{ticket_id}/attachments/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:t.body},i);return new Pe(o,a=>Ns(a))}async createRemoteHandsAttachment(t,i){return await(await this.createRemoteHandsAttachmentRaw(t,i)).value()}async createRemoteHandsCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new te("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createRemoteHandsComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new te("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createRemoteHandsComment.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/remote-hands-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:xc(t.ticketCommentsRequest)},i);return new Pe(o,a=>_c(a))}async createRemoteHandsComment(t,i){return await(await this.createRemoteHandsCommentRaw(t,i)).value()}async createRemoteHandsTicketRaw(t,i){if(t.remoteHandsRequest===null||t.remoteHandsRequest===void 0)throw new te("remoteHandsRequest","Required parameter requestParameters.remoteHandsRequest was null or undefined when calling createRemoteHandsTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/remote-hands-tickets",method:"POST",headers:n,query:s,body:Ic(t.remoteHandsRequest)},i);return new Pe(o,a=>Ri(a))}async createRemoteHandsTicket(t,i){return await(await this.createRemoteHandsTicketRaw(t,i)).value()}async getRemoteHandsAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new te("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getRemoteHandsAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new te("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getRemoteHandsAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/remote-hands-tickets/{ticket_id}/attachments/{attachment_id}/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new gc(o)}async getRemoteHandsAttachmentsById(t,i){return await(await this.getRemoteHandsAttachmentsByIdRaw(t,i)).value()}async getRemoteHandsAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new te("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getRemoteHandsAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/remote-hands-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new Pe(o,a=>$c(a))}async getRemoteHandsAttachmentsList(t,i){return await(await this.getRemoteHandsAttachmentsListRaw(t,i)).value()}async getRemoteHandsCategoriesListRaw(t,i){if(t.site===null||t.site===void 0)throw new te("site","Required parameter requestParameters.site was null or undefined when calling getRemoteHandsCategoriesList.");const s={};t.site!==void 0&&(s.site=t.site),t.accountNumber!==void 0&&(s.account_number=t.accountNumber);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/remote-hands-tickets/categories",method:"GET",headers:n,query:s},i);return new Pe(o,a=>bc(a))}async getRemoteHandsCategoriesList(t,i){return await(await this.getRemoteHandsCategoriesListRaw(t,i)).value()}async getRemoteHandsTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new te("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getRemoteHandsTicketById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/remote-hands-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new Pe(o,a=>Ri(a))}async getRemoteHandsTicketById(t,i){return await(await this.getRemoteHandsTicketByIdRaw(t,i)).value()}async getRemoteHandsTicketsRaw(t,i){const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.status!==void 0&&(s.status=t.status),t.createdBy!==void 0&&(s.created_by=t.createdBy),t.sort!==void 0&&(s.sort=t.sort),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={},o=await this.request({path:"/remote-hands-tickets",method:"GET",headers:n,query:s},i);return new Pe(o,a=>qc(a))}async getRemoteHandsTickets(t={},i){return await(await this.getRemoteHandsTicketsRaw(t,i)).value()}async updateRemoteHandsTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new te("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateRemoteHandsTicketById.");if(t.remoteHandsUpdateRequest===null||t.remoteHandsUpdateRequest===void 0)throw new te("remoteHandsUpdateRequest","Required parameter requestParameters.remoteHandsUpdateRequest was null or undefined when calling updateRemoteHandsTicketById.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/remote-hands-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:Bc(t.remoteHandsUpdateRequest)},i);return new Pe(o,a=>Ri(a))}async updateRemoteHandsTicketById(t,i){return await(await this.updateRemoteHandsTicketByIdRaw(t,i)).value()}}function Lc(e){return Vc(e)}function Vc(e,t){return e==null?e:{serviceManagement:f(e,"service_management")?e.service_management:void 0,remoteHands:f(e,"remote_hands")?e.remote_hands:void 0,deliveries:f(e,"deliveries")?e.deliveries:void 0,removals:f(e,"removals")?e.removals:void 0,facilitiesAccess:f(e,"facilities_access")?e.facilities_access:void 0,temporaryAccess:f(e,"temporary_access")?e.temporary_access:void 0,inventory:f(e,"inventory")?e.inventory:void 0,orderHistory:f(e,"order_history")?e.order_history:void 0,precabling:f(e,"precabling")?e.precabling:void 0,crossConnect:f(e,"cross_connect")?e.cross_connect:void 0,customerEquipmentConnection:f(e,"customer_equipment_connection")?e.customer_equipment_connection:void 0,virtualConnectivity:f(e,"virtual_connectivity")?e.virtual_connectivity:void 0,customerCare:f(e,"customer_care")?e.customer_care:void 0,troubleTickets:f(e,"trouble_tickets")?e.trouble_tickets:void 0}}function Uc(e){return Hc(e)}function Hc(e,t){return e==null?e:{name:f(e,"name")?e.name:void 0,privilegeLevel:f(e,"privilege_level")?e.privilege_level:void 0}}function zc(e){return jc(e)}function jc(e,t){return e==null?e:{id:e.id,accountNumber:e.account_number,siteId:e.site_id,floor:f(e,"floor")?e.floor:void 0,room:f(e,"room")?e.room:void 0,cage:f(e,"cage")?e.cage:void 0,rack:f(e,"rack")?e.rack:void 0,row:f(e,"row")?e.row:void 0,locationType:e.location_type,csrDemarcation:e.csr_demarcation,comment:f(e,"comment")?e.comment:void 0,dcimEnabled:f(e,"dcim_enabled")?e.dcim_enabled:void 0,permissions:f(e,"permissions")?e.permissions.map(Uc):void 0,assignableProcesses:f(e,"assignable_processes")?Lc(e.assignable_processes):void 0}}function Mc(e){return Jc(e)}function Jc(e,t){return e==null?e:{self:f(e,"self")?e.self:void 0,first:f(e,"first")?e.first:void 0,prev:f(e,"prev")?e.prev:void 0,next:f(e,"next")?e.next:void 0,last:f(e,"last")?e.last:void 0,items:e.items.map(zc)}}function Wc(e){return Gc(e)}function Gc(e,t){return e==null?e:{count:e.count}}function Ps(e){return Zc(e)}function Zc(e,t){return e==null?e:{id:f(e,"id")?e.id:void 0,locationId:f(e,"location_id")?e.location_id:void 0,name:f(e,"name")?e.name:void 0,campus:f(e,"campus")?e.campus:void 0,metroArea:f(e,"metro_area")?e.metro_area:void 0,region:f(e,"region")?e.region:void 0,regionName:f(e,"region_name")?e.region_name:void 0,country:f(e,"country")?e.country:void 0,addressCountry:f(e,"address_country")?e.address_country:void 0,addressLocality:f(e,"address_locality")?e.address_locality:void 0,addressRegion:f(e,"address_region")?e.address_region:void 0,postalCode:f(e,"postal_code")?e.postal_code:void 0,streetAddress:f(e,"street_address")?e.street_address:void 0,peeringdbFacilityId:f(e,"peeringdb_facility_id")?e.peeringdb_facility_id:void 0,organisationName:f(e,"organisation_name")?e.organisation_name:void 0,timeZone:f(e,"time_zone")?e.time_zone:void 0,latitude:f(e,"latitude")?e.latitude:void 0,longitude:f(e,"longitude")?e.longitude:void 0,locations:f(e,"locations")?Wc(e.locations):void 0}}function Kc(e){return Yc(e)}function Yc(e,t){return e==null?e:{self:f(e,"self")?e.self:void 0,first:f(e,"first")?e.first:void 0,prev:f(e,"prev")?e.prev:void 0,next:f(e,"next")?e.next:void 0,last:f(e,"last")?e.last:void 0,items:e.items.map(Ps)}}function Xc(e){return Qc(e)}function Qc(e,t){return e==null?e:{id:f(e,"id")?e.id:void 0,name:f(e,"name")?e.name:void 0,description:f(e,"description")?e.description:void 0}}function ed(e){return td(e)}function td(e,t){return e==null?e:{id:f(e,"id")?e.id:void 0,name:f(e,"name")?e.name:void 0,description:f(e,"description")?e.description:void 0}}class id extends Bt{async getLocationsRaw(t,i){const s={};t.sort!==void 0&&(s.sort=t.sort),t.cursor!==void 0&&(s.cursor=t.cursor),t.pageSize!==void 0&&(s.page_size=t.pageSize),t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.id!==void 0&&(s.id=t.id),t.siteId!==void 0&&(s.site_id=t.siteId),t.floor!==void 0&&(s.floor=t.floor),t.room!==void 0&&(s.room=t.room),t.cage!==void 0&&(s.cage=t.cage),t.rack!==void 0&&(s.rack=t.rack),t.row!==void 0&&(s.row=t.row),t.demarcation!==void 0&&(s.demarcation=t.demarcation),t.locationType!==void 0&&(s.location_type=t.locationType),t.embed!==void 0&&(s.embed=t.embed),t.permissionType!==void 0&&(s.permission_type=t.permissionType),t.permissionPrivilege!==void 0&&(s.permission_privilege=t.permissionPrivilege),t.dcimEnabled!==void 0&&(s.dcim_enabled=t.dcimEnabled),t.assignableProcess!==void 0&&(s.assignable_process=t.assignableProcess);const n={};this.configuration&&this.configuration.apiKey&&(n.Authorization=this.configuration.apiKey("Authorization"));const o=await this.request({path:"/locations",method:"GET",headers:n,query:s},i);return new St(o,a=>Mc(a))}async getLocations(t={},i){return await(await this.getLocationsRaw(t,i)).value()}}class qs extends Bt{async getOspsBySiteIdRaw(t,i){if(t.siteId===null||t.siteId===void 0)throw new Ti("siteId","Required parameter requestParameters.siteId was null or undefined when calling getOspsBySiteId.");const s={},n={};this.configuration&&this.configuration.apiKey&&(n.Authorization=this.configuration.apiKey("Authorization"));const o=await this.request({path:"/sites/{siteId}/osps".replace("{siteId}",encodeURIComponent(String(t.siteId))),method:"GET",headers:n,query:s},i);return new St(o,a=>a.map(Xc))}async getOspsBySiteId(t,i){return await(await this.getOspsBySiteIdRaw(t,i)).value()}async getPopsBySiteIdRaw(t,i){if(t.siteId===null||t.siteId===void 0)throw new Ti("siteId","Required parameter requestParameters.siteId was null or undefined when calling getPopsBySiteId.");const s={},n={};this.configuration&&this.configuration.apiKey&&(n.Authorization=this.configuration.apiKey("Authorization"));const o=await this.request({path:"/sites/{siteId}/pops".replace("{siteId}",encodeURIComponent(String(t.siteId))),method:"GET",headers:n,query:s},i);return new St(o,a=>a.map(ed))}async getPopsBySiteId(t,i){return await(await this.getPopsBySiteIdRaw(t,i)).value()}async getSiteByIdRaw(t,i){if(t.siteId===null||t.siteId===void 0)throw new Ti("siteId","Required parameter requestParameters.siteId was null or undefined when calling getSiteById.");const s={},n={};this.configuration&&this.configuration.apiKey&&(n.Authorization=this.configuration.apiKey("Authorization"));const o=await this.request({path:"/sites/{siteId}".replace("{siteId}",encodeURIComponent(String(t.siteId))),method:"GET",headers:n,query:s},i);return new St(o,a=>Ps(a))}async getSiteById(t,i){return await(await this.getSiteByIdRaw(t,i)).value()}async getSitesRaw(t,i){const s={};t.name!==void 0&&(s.name=t.name),t.sort!==void 0&&(s.sort=t.sort),t.cursor!==void 0&&(s.cursor=t.cursor),t.pageSize!==void 0&&(s.page_size=t.pageSize),t.showMySites!==void 0&&(s.show_my_sites=t.showMySites),t.embed!==void 0&&(s.embed=t.embed);const n={};this.configuration&&this.configuration.apiKey&&(n.Authorization=this.configuration.apiKey("Authorization"));const o=await this.request({path:"/sites",method:"GET",headers:n,query:s},i);return new St(o,a=>Kc(a))}async getSites(t={},i){return await(await this.getSitesRaw(t,i)).value()}}const sd="https://api.digitalrealty.com".replace(/\/+$/,"");class Ds{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:sd}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Bs}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const nd=new Ds;class ri{constructor(t=nd){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new cd(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?ri.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new rd(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;od(r.body)||r.body instanceof URLSearchParams||ad(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}ri.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function ad(e){return typeof Blob<"u"&&e instanceof Blob}function od(e){return typeof FormData<"u"&&e instanceof FormData}class rd extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class cd extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class Zt extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function T(e,t){return e[t]!=null}function Bs(e,t=""){return Object.keys(e).map(i=>Os(i,e[i],t)).filter(i=>i.length>0).join("&")}function Os(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return Os(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Bs(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class Ai{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class $s{constructor(t){this.raw=t}async value(){return await this.raw.blob()}}const dd="https://api.digitalrealty.com/service-management/v1".replace(/\/+$/,"");class Es{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:dd}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||xs}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const ud=new Es;class ci{constructor(t=ud){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new hd(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?ci.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new pd(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;md(r.body)||r.body instanceof URLSearchParams||ld(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}ci.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function ld(e){return typeof Blob<"u"&&e instanceof Blob}function md(e){return typeof FormData<"u"&&e instanceof FormData}class pd extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class hd extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class vt extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function D(e,t){return e[t]!=null}function xs(e,t=""){return Object.keys(e).map(i=>Fs(i,e[i],t)).filter(i=>i.length>0).join("&")}function Fs(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return Fs(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?xs(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class Kt{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class Ls{constructor(t){this.raw=t}async value(){return await this.raw.blob()}}function Vs(e){return vd(e)}function vd(e,t){return e==null?e:{createdBy:D(e,"created_by")?e.created_by:void 0,createdAt:D(e,"created_at")?new Date(e.created_at):void 0,comment:D(e,"comment")?e.comment:void 0}}function gd(e){return wd(e)}function wd(e,t){return e==null?e:{comments:D(e,"comments")?e.comments.map(Vs):void 0}}function Us(e){return fd(e)}function fd(e,t){return e==null?e:{id:D(e,"id")?e.id:void 0,fileName:D(e,"file_name")?e.file_name:void 0}}function kd(e){return yd(e)}function yd(e,t){return e==null?e:{accountNumber:D(e,"account_number")?e.account_number:void 0,accountName:D(e,"account_name")?e.account_name:void 0,id:D(e,"id")?e.id:void 0,status:D(e,"status")?e.status:void 0,subject:D(e,"subject")?e.subject:void 0,site:D(e,"site")?e.site:void 0,priority:D(e,"priority")?e.priority:void 0,comments:D(e,"comments")?e.comments.map(Vs):void 0,attachments:D(e,"attachments")?e.attachments.map(Us):void 0,createdAt:D(e,"created_at")?new Date(e.created_at):void 0,updatedAt:D(e,"updated_at")?new Date(e.updated_at):void 0}}function Td(e){return bd(e)}function bd(e,t){return e==null?e:{accountNumber:D(e,"account_number")?e.account_number:void 0,accountName:D(e,"account_name")?e.account_name:void 0,id:D(e,"id")?e.id:void 0,status:D(e,"status")?e.status:void 0,subject:D(e,"subject")?e.subject:void 0,site:D(e,"site")?e.site:void 0,priority:D(e,"priority")?e.priority:void 0,attachments:D(e,"attachments")?e.attachments.map(Us):void 0,createdAt:D(e,"created_at")?new Date(e.created_at):void 0,updatedAt:D(e,"updated_at")?new Date(e.updated_at):void 0}}function Rd(e){return Ad(e)}function Ad(e,t){return e==null?e:{items:D(e,"items")?e.items.map(Td):void 0,totalCount:D(e,"total_count")?e.total_count:void 0,pageNumber:D(e,"page_number")?e.page_number:void 0,pageSize:D(e,"page_size")?e.page_size:void 0}}function _d(e){return Sd(e)}function Sd(e,t){return e==null?e:{id:D(e,"id")?e.id:void 0,fileName:D(e,"file_name")?e.file_name:void 0,fileSize:D(e,"file_size")?e.file_size:void 0,contentType:D(e,"content_type")?e.content_type:void 0,createdBy:D(e,"created_by")?e.created_by:void 0,createdAt:D(e,"created_at")?new Date(e.created_at):void 0}}function Id(e){return Cd(e)}function Cd(e,t){return e==null?e:{attachments:D(e,"attachments")?e.attachments.map(_d):void 0}}function Nd(e){if(e!==void 0)return e===null?null:{comment:e.comment}}class Pd extends ci{async createIncidentCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new vt("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createIncidentComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new vt("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createIncidentComment.");const s={},n={};n["Content-Type"]="application/json";const o=await this.request({path:"/incident-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:Nd(t.ticketCommentsRequest)},i);return new Kt(o,a=>gd(a))}async createIncidentComment(t,i){return await(await this.createIncidentCommentRaw(t,i)).value()}async downloadIncidentTicketsRaw(t,i){const s={};t.$filter!==void 0&&(s.$filter=t.$filter),t.$orderby!==void 0&&(s.$orderby=t.$orderby),t.$skip!==void 0&&(s.$skip=t.$skip),t.$top!==void 0&&(s.$top=t.$top);const n={},o=await this.request({path:"/incident-tickets/file",method:"GET",headers:n,query:s},i);return new Ls(o)}async downloadIncidentTickets(t={},i){return await(await this.downloadIncidentTicketsRaw(t,i)).value()}async getIncidentsAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new vt("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getIncidentsAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new vt("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getIncidentsAttachmentsById.");const s={},n={},o=await this.request({path:"/incident-tickets/{ticket_id}/attachments/file/{attachment_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new Ls(o)}async getIncidentsAttachmentsById(t,i){return await(await this.getIncidentsAttachmentsByIdRaw(t,i)).value()}async getIncidentsAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new vt("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getIncidentsAttachmentsList.");const s={},n={},o=await this.request({path:"/incident-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new Kt(o,a=>Id(a))}async getIncidentsAttachmentsList(t,i){return await(await this.getIncidentsAttachmentsListRaw(t,i)).value()}async getIncidentsTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new vt("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getIncidentsTicketById.");const s={},n={},o=await this.request({path:"/incident-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new Kt(o,a=>kd(a))}async getIncidentsTicketById(t,i){return await(await this.getIncidentsTicketByIdRaw(t,i)).value()}async getIncidentsTicketsRaw(t,i){const s={};t.$filter!==void 0&&(s.$filter=t.$filter),t.$orderby!==void 0&&(s.$orderby=t.$orderby),t.$skip!==void 0&&(s.$skip=t.$skip),t.$top!==void 0&&(s.$top=t.$top);const n={},o=await this.request({path:"/incident-tickets",method:"GET",headers:n,query:s},i);return new Kt(o,a=>Rd(a))}async getIncidentsTickets(t={},i){return await(await this.getIncidentsTicketsRaw(t,i)).value()}}const qd="http://localhost".replace(/\/+$/,"");class Hs{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:qd}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||js}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Dd=new Hs;class di{constructor(t=Dd){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new Ed(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?di.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new $d(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;Od(r.body)||r.body instanceof URLSearchParams||Bd(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}di.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function Bd(e){return typeof Blob<"u"&&e instanceof Blob}function Od(e){return typeof FormData<"u"&&e instanceof FormData}class $d extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class Ed extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class zs extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function qe(e,t){return e[t]!=null}function js(e,t=""){return Object.keys(e).map(i=>Ms(i,e[i],t)).filter(i=>i.length>0).join("&")}function Ms(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return Ms(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?js(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class xd{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}const Fd="http://localhost".replace(/\/+$/,"");class Js{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Fd}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Gs}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Ld=new Js;class ui{constructor(t=Ld){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new zd(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?ui.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new Hd(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;Ud(r.body)||r.body instanceof URLSearchParams||Vd(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}ui.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function Vd(e){return typeof Blob<"u"&&e instanceof Blob}function Ud(e){return typeof FormData<"u"&&e instanceof FormData}class Hd extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class zd extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}function Ws(e,t){return e[t]!=null}function Gs(e,t=""){return Object.keys(e).map(i=>Zs(i,e[i],t)).filter(i=>i.length>0).join("&")}function Zs(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return Zs(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Gs(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class Ks{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}function jd(e){if(e!==void 0)return e===null?null:{cancellationReason:e.cancellationReason}}function Md(e){return Jd(e)}function Jd(e,t){return e==null?e:{message:S(e,"message")?e.message:void 0}}function Wd(e){return Gd(e)}function Gd(e,t){return e==null?e:{requestType:S(e,"request_type")?e.request_type:void 0,categories:S(e,"categories")?e.categories:void 0}}function Zd(e){return Kd(e)}function Kd(e,t){return e==null?e:{items:S(e,"items")?e.items.map(Wd):void 0}}function Ys(e){return Yd(e)}function Yd(e,t){return e==null?e:{createdBy:S(e,"created_by")?e.created_by:void 0,createdAt:S(e,"created_at")?new Date(e.created_at):void 0,comment:S(e,"comment")?e.comment:void 0}}function Xd(e){return Qd(e)}function Qd(e,t){return e==null?e:{comments:S(e,"comments")?e.comments.map(Ys):void 0}}function eu(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,subject:e.subject,request_type:e.requestType,category:e.category,locations:e.locations,customer_reference:e.customerReference,description:e.description,notification_recipients:e.notificationRecipients}}function _i(e){return tu(e)}function tu(e,t){return e==null?e:{accountNumber:S(e,"account_number")?e.account_number:void 0,accountName:S(e,"account_name")?e.account_name:void 0,id:S(e,"id")?e.id:void 0,status:S(e,"status")?e.status:void 0,cancellationReason:S(e,"cancellation_reason")?e.cancellation_reason:void 0,subject:S(e,"subject")?e.subject:void 0,requestType:S(e,"request_type")?e.request_type:void 0,category:S(e,"category")?e.category:void 0,site:S(e,"site")?e.site:void 0,locations:S(e,"locations")?e.locations:void 0,customerReference:S(e,"customer_reference")?e.customer_reference:void 0,description:S(e,"description")?e.description:void 0,notificationRecipients:S(e,"notification_recipients")?e.notification_recipients:void 0,createdBy:S(e,"created_by")?e.created_by:void 0,createdAt:S(e,"created_at")?new Date(e.created_at):void 0,updatedAt:S(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:S(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0,comments:S(e,"comments")?e.comments.map(Ys):void 0}}function iu(e){if(e!==void 0)return e===null?null:{subject:e.subject,description:e.description,customer_reference:e.customerReference,other_notification_recipients:e.otherNotificationRecipients}}function su(e){return nu(e)}function nu(e,t){return e==null?e:{accountNumber:S(e,"account_number")?e.account_number:void 0,accountName:S(e,"account_name")?e.account_name:void 0,id:S(e,"id")?e.id:void 0,status:S(e,"status")?e.status:void 0,subject:S(e,"subject")?e.subject:void 0,site:S(e,"site")?e.site:void 0,locations:S(e,"locations")?e.locations:void 0,description:S(e,"description")?e.description:void 0,createdBy:S(e,"created_by")?e.created_by:void 0,createdAt:S(e,"created_at")?new Date(e.created_at):void 0,updatedAt:S(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:S(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0}}function au(e){return ou(e)}function ou(e,t){return e==null?e:{items:S(e,"items")?e.items.map(su):void 0,totalCount:S(e,"total_count")?e.total_count:void 0,pageNumber:S(e,"page_number")?e.page_number:void 0,pageSize:S(e,"page_size")?e.page_size:void 0}}function Xs(e){return ru(e)}function ru(e,t){return e==null?e:{id:S(e,"id")?e.id:void 0,fileName:S(e,"file_name")?e.file_name:void 0,fileSize:S(e,"file_size")?e.file_size:void 0,contentType:S(e,"content_type")?e.content_type:void 0,createdBy:S(e,"created_by")?e.created_by:void 0,createdAt:S(e,"created_at")?new Date(e.created_at):void 0}}function cu(e){return du(e)}function du(e,t){return e==null?e:{attachments:S(e,"attachments")?e.attachments.map(Xs):void 0}}function uu(e){if(e!==void 0)return e===null?null:{comment:e.comment}}class lu extends ai{async cancellationCustomerCareRequestRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ae("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling cancellationCustomerCareRequest.");if(t.cancellationTicketsRequest===null||t.cancellationTicketsRequest===void 0)throw new ae("cancellationTicketsRequest","Required parameter requestParameters.cancellationTicketsRequest was null or undefined when calling cancellationCustomerCareRequest.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/customer-care-tickets/{ticket_id}/cancel".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PUT",headers:n,query:s,body:jd(t.cancellationTicketsRequest)},i);return new Ne(o,a=>Md(a))}async cancellationCustomerCareRequest(t,i){return await(await this.cancellationCustomerCareRequestRaw(t,i)).value()}async createCustomerCareCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ae("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createCustomerCareComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new ae("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createCustomerCareComment.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/customer-care-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:uu(t.ticketCommentsRequest)},i);return new Ne(o,a=>Xd(a))}async createCustomerCareComment(t,i){return await(await this.createCustomerCareCommentRaw(t,i)).value()}async createCustomerCareTicketRaw(t,i){if(t.customerCareTicketRequest===null||t.customerCareTicketRequest===void 0)throw new ae("customerCareTicketRequest","Required parameter requestParameters.customerCareTicketRequest was null or undefined when calling createCustomerCareTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/customer-care-tickets",method:"POST",headers:n,query:s,body:eu(t.customerCareTicketRequest)},i);return new Ne(o,a=>_i(a))}async createCustomerCareTicket(t,i){return await(await this.createCustomerCareTicketRaw(t,i)).value()}async createCustomerCareTicketAttachmentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ae("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createCustomerCareTicketAttachment.");if(t.fileName===null||t.fileName===void 0)throw new ae("fileName","Required parameter requestParameters.fileName was null or undefined when calling createCustomerCareTicketAttachment.");if(t.body===null||t.body===void 0)throw new ae("body","Required parameter requestParameters.body was null or undefined when calling createCustomerCareTicketAttachment.");const s={};t.fileName!==void 0&&(s.file_name=t.fileName);const n={};if(n["Content-Type"]="image/jpeg",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/customer-care-tickets/{ticket_id}/attachments/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:t.body},i);return new Ne(o,a=>Xs(a))}async createCustomerCareTicketAttachment(t,i){return await(await this.createCustomerCareTicketAttachmentRaw(t,i)).value()}async getCustomerCareCategoriesListRaw(t,i){const s={};t.site!==void 0&&(s.site=t.site),t.accountNumber!==void 0&&(s.account_number=t.accountNumber);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/customer-care-tickets/categories",method:"GET",headers:n,query:s},i);return new Ne(o,a=>Zd(a))}async getCustomerCareCategoriesList(t={},i){return await(await this.getCustomerCareCategoriesListRaw(t,i)).value()}async getCustomerCareTicketAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ae("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getCustomerCareTicketAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new ae("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getCustomerCareTicketAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/customer-care-tickets/{ticket_id}/attachments/file/{attachment_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new qa(o)}async getCustomerCareTicketAttachmentsById(t,i){return await(await this.getCustomerCareTicketAttachmentsByIdRaw(t,i)).value()}async getCustomerCareTicketAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ae("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getCustomerCareTicketAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/customer-care-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new Ne(o,a=>cu(a))}async getCustomerCareTicketAttachmentsList(t,i){return await(await this.getCustomerCareTicketAttachmentsListRaw(t,i)).value()}async getCustomerCareTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ae("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getCustomerCareTicketById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/customer-care-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new Ne(o,a=>_i(a))}async getCustomerCareTicketById(t,i){return await(await this.getCustomerCareTicketByIdRaw(t,i)).value()}async getCustomerCareTicketsRaw(t,i){const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.status!==void 0&&(s.status=t.status),t.createdBy!==void 0&&(s.created_by=t.createdBy),t.sort!==void 0&&(s.sort=t.sort),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={},o=await this.request({path:"/customer-care-tickets",method:"GET",headers:n,query:s},i);return new Ne(o,a=>au(a))}async getCustomerCareTickets(t={},i){return await(await this.getCustomerCareTicketsRaw(t,i)).value()}async updateCustomerCareTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ae("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateCustomerCareTicket.");if(t.customerCareTicketUpdateRequest===null||t.customerCareTicketUpdateRequest===void 0)throw new ae("customerCareTicketUpdateRequest","Required parameter requestParameters.customerCareTicketUpdateRequest was null or undefined when calling updateCustomerCareTicket.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/customer-care-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:iu(t.customerCareTicketUpdateRequest)},i);return new Ne(o,a=>_i(a))}async updateCustomerCareTicket(t,i){return await(await this.updateCustomerCareTicketRaw(t,i)).value()}}function mu(e){return pu(e)}function pu(e,t){return e==null?e:{requestType:Ge(e,"request_type")?e.request_type:void 0,categories:Ge(e,"categories")?e.categories:void 0}}function hu(e){return vu(e)}function vu(e,t){return e==null?e:{mappedRequestType:Ge(e,"mapped_request_type")?e.mapped_request_type:void 0,canonicalValue:Ge(e,"canonical_value")?e.canonical_value:void 0,mappedValue:Ge(e,"mapped_value")?e.mapped_value:void 0,isActive:Ge(e,"is_active")?e.is_active:void 0}}function gu(e){return wu(e)}function wu(e,t){return e==null?e:{requestType:Ge(e,"request_type")?e.request_type:void 0,categories:Ge(e,"categories")?e.categories.map(hu):void 0}}class fu extends yt{async getRequestTypesAndCategoriesRaw(t,i){if(t.serviceTicketType===null||t.serviceTicketType===void 0)throw new dt("serviceTicketType","Required parameter requestParameters.serviceTicketType was null or undefined when calling getRequestTypesAndCategories.");if(t.accountNumber===null||t.accountNumber===void 0)throw new dt("accountNumber","Required parameter requestParameters.accountNumber was null or undefined when calling getRequestTypesAndCategories.");if(t.site===null||t.site===void 0)throw new dt("site","Required parameter requestParameters.site was null or undefined when calling getRequestTypesAndCategories.");if(t.requestType===null||t.requestType===void 0)throw new dt("requestType","Required parameter requestParameters.requestType was null or undefined when calling getRequestTypesAndCategories.");const s={};t.serviceTicketType!==void 0&&(s.service_ticket_type=t.serviceTicketType),t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.requestType!==void 0&&(s.request_type=t.requestType);const n={},o=await this.request({path:"/categories",method:"GET",headers:n,query:s},i);return new bi(o,a=>a.map(mu))}async getRequestTypesAndCategories(t,i){return await(await this.getRequestTypesAndCategoriesRaw(t,i)).value()}}class ku extends yt{async getRequestTypeCategoryMappingsRaw(t,i){if(t.serviceTicketType===null||t.serviceTicketType===void 0)throw new dt("serviceTicketType","Required parameter requestParameters.serviceTicketType was null or undefined when calling getRequestTypeCategoryMappings.");if(t.serviceManagementSystem===null||t.serviceManagementSystem===void 0)throw new dt("serviceManagementSystem","Required parameter requestParameters.serviceManagementSystem was null or undefined when calling getRequestTypeCategoryMappings.");const s={};t.serviceTicketType!==void 0&&(s.service_ticket_type=t.serviceTicketType),t.serviceManagementSystem!==void 0&&(s.service_management_system=t.serviceManagementSystem),t.siteCode!==void 0&&(s.site_code=t.siteCode);const n={},o=await this.request({path:"/requestTypeCategoryMappings",method:"GET",headers:n,query:s},i);return new bi(o,a=>a.map(gu))}async getRequestTypeCategoryMappings(t,i){return await(await this.getRequestTypeCategoryMappingsRaw(t,i)).value()}}const yu={CustomerEnquiries:"customer_enquiries",RemoteHands:"remote_hands",CustomerCare:"customer_care",TroubleTickets:"trouble_tickets"};class Tu extends yt{async getTermsRaw(t,i){if(t.service===null||t.service===void 0)throw new dt("service","Required parameter requestParameters.service was null or undefined when calling getTerms.");const s={},n={},o=await this.request({path:"/{service}/terms".replace("{service}",encodeURIComponent(String(t.service))),method:"GET",headers:n,query:s},i);return this.isJsonMime(o.headers.get("content-type"))?new bi(o):new dc(o)}async getTerms(t,i){return await(await this.getTermsRaw(t,i)).value()}}const bu="https://api.digitalrealty.com".replace(/\/+$/,"");class Qs{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:bu}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||en}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Ru=new Qs;class li{constructor(t=Ru){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new Iu(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?li.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new Su(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;_u(r.body)||r.body instanceof URLSearchParams||Au(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}li.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function Au(e){return typeof Blob<"u"&&e instanceof Blob}function _u(e){return typeof FormData<"u"&&e instanceof FormData}class Su extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class Iu extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}function V(e,t){return e[t]!=null}function en(e,t=""){return Object.keys(e).map(i=>tn(i,e[i],t)).filter(i=>i.length>0).join("&")}function tn(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return tn(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?en(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class Cu{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class Nu{constructor(t){this.raw=t}async value(){return await this.raw.blob()}}function Pu(e){return qu(e)}function qu(e,t){return e==null?e:{id:V(e,"id")?e.id:void 0,name:V(e,"name")?e.name:void 0}}function Du(e){return Bu(e)}function Bu(e,t){return e==null?e:{accountNumber:V(e,"account_number")?e.account_number:void 0,accountName:V(e,"account_name")?e.account_name:void 0,ticketId:V(e,"ticket_id")?e.ticket_id:void 0,ticketType:V(e,"ticket_type")?e.ticket_type:void 0,requestType:V(e,"request_type")?e.request_type:void 0,category:V(e,"category")?e.category:void 0,subject:V(e,"subject")?e.subject:void 0,sites:V(e,"sites")?e.sites.map(Pu):void 0,locations:V(e,"locations")?e.locations:void 0,accessRequestedFor:V(e,"access_requested_for")?e.access_requested_for:void 0,status:V(e,"status")?e.status:void 0,cancellationReason:V(e,"cancellation_reason")?e.cancellation_reason:void 0,createdBy:V(e,"created_by")?e.created_by:void 0,createdAt:V(e,"created_at")?new Date(e.created_at):void 0,updatedAt:V(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:V(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0}}function Ou(e){return $u(e)}function $u(e,t){return e==null?e:{items:V(e,"items")?e.items.map(Du):void 0,totalCount:V(e,"total_count")?e.total_count:void 0,pageNumber:V(e,"page_number")?e.page_number:void 0,pageSize:V(e,"page_size")?e.page_size:void 0}}class Eu extends li{async downloadServiceTicketsRaw(t,i){const s={};t.$filter!==void 0&&(s.$filter=t.$filter),t.permissionPrivilege!==void 0&&(s.permission_privilege=t.permissionPrivilege);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/service-tickets/file",method:"GET",headers:n,query:s},i);return new Nu(o)}async downloadServiceTickets(t={},i){return await(await this.downloadServiceTicketsRaw(t,i)).value()}async getServiceTicketsRaw(t,i){const s={};t.$filter!==void 0&&(s.$filter=t.$filter),t.$orderby!==void 0&&(s.$orderby=t.$orderby),t.$skip!==void 0&&(s.$skip=t.$skip),t.$top!==void 0&&(s.$top=t.$top),t.permissionPrivilege!==void 0&&(s.permission_privilege=t.permissionPrivilege);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/service-tickets",method:"GET",headers:n,query:s},i);return new Cu(o,a=>Ou(a))}async getServiceTickets(t={},i){return await(await this.getServiceTicketsRaw(t,i)).value()}}function xu(e){return Fu(e)}function Fu(e,t){return e==null?e:{id:T(e,"id")?e.id:void 0,fileName:T(e,"file_name")?e.file_name:void 0}}function Lu(e){return Vu(e)}function Vu(e,t){return e==null?e:{accountNumber:T(e,"account_number")?e.account_number:void 0,accountName:T(e,"account_name")?e.account_name:void 0,id:T(e,"id")?e.id:void 0,status:T(e,"status")?e.status:void 0,cancellationReason:T(e,"cancellation_reason")?e.cancellation_reason:void 0,subject:T(e,"subject")?e.subject:void 0,startDate:T(e,"start_date")?new Date(e.start_date):void 0,endDate:T(e,"end_date")?new Date(e.end_date):void 0,approvalStatus:T(e,"approval_status")?e.approval_status:void 0,category:T(e,"category")?e.category:void 0,activityType:T(e,"activity_type")?e.activity_type:void 0,activitySubtype:T(e,"activity_subtype")?e.activity_subtype:void 0,activityCategory:T(e,"activity_category")?e.activity_category:void 0,site:T(e,"site")?e.site:void 0,locations:T(e,"locations")?e.locations:void 0,highLevelSummary:T(e,"high_level_summary")?e.high_level_summary:void 0,serviceType:T(e,"service_type")?e.service_type:void 0,riskLevel:T(e,"risk_level")?e.risk_level:void 0,attachments:T(e,"attachments")?e.attachments.map(xu):void 0,createdAt:T(e,"created_at")?new Date(e.created_at):void 0,updatedAt:T(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:T(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0}}function Uu(e){return Hu(e)}function Hu(e,t){return e==null?e:{items:T(e,"items")?e.items.map(Lu):void 0}}function zu(e){return ju(e)}function ju(e,t){return e==null?e:{id:T(e,"id")?e.id:void 0,fileName:T(e,"file_name")?e.file_name:void 0}}function Mu(e){return Ju(e)}function Ju(e,t){return e==null?e:{accountNumber:T(e,"account_number")?e.account_number:void 0,accountName:T(e,"account_name")?e.account_name:void 0,id:T(e,"id")?e.id:void 0,status:T(e,"status")?e.status:void 0,subject:T(e,"subject")?e.subject:void 0,startDate:T(e,"start_date")?new Date(e.start_date):void 0,endDate:T(e,"end_date")?new Date(e.end_date):void 0,activityType:T(e,"activity_type")?e.activity_type:void 0,site:T(e,"site")?e.site:void 0,locations:T(e,"locations")?e.locations:void 0,notificationType:T(e,"notification_type")?e.notification_type:void 0,riskLevel:T(e,"risk_level")?e.risk_level:void 0,attachments:T(e,"attachments")?e.attachments.map(zu):void 0,createdAt:T(e,"created_at")?new Date(e.created_at):void 0,updatedAt:T(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:T(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0}}function Wu(e){return Gu(e)}function Gu(e,t){return e==null?e:{items:T(e,"items")?e.items.map(Mu):void 0,totalCount:T(e,"total_count")?e.total_count:void 0,pageNumber:T(e,"page_number")?e.page_number:void 0,pageSize:T(e,"page_size")?e.page_size:void 0}}function Zu(e){return Ku(e)}function Ku(e,t){return e==null?e:{id:T(e,"id")?e.id:void 0,fileName:T(e,"file_name")?e.file_name:void 0,fileSize:T(e,"file_size")?e.file_size:void 0,contentType:T(e,"content_type")?e.content_type:void 0,createdBy:T(e,"created_by")?e.created_by:void 0,createdAt:T(e,"created_at")?new Date(e.created_at):void 0}}function Yu(e){return Xu(e)}function Xu(e,t){return e==null?e:{attachments:T(e,"attachments")?e.attachments.map(Zu):void 0}}class Qu extends ri{async downloadPlannedMaintenanceTicketsRaw(t,i){const s={};t.$filter!==void 0&&(s.$filter=t.$filter),t.$orderby!==void 0&&(s.$orderby=t.$orderby),t.$skip!==void 0&&(s.$skip=t.$skip),t.$top!==void 0&&(s.$top=t.$top);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/planned-maintenances/file",method:"GET",headers:n,query:s},i);return new $s(o)}async downloadPlannedMaintenanceTickets(t={},i){return await(await this.downloadPlannedMaintenanceTicketsRaw(t,i)).value()}async getPlannedMaintenanceAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new Zt("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getPlannedMaintenanceAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new Zt("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getPlannedMaintenanceAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/planned-maintenances/{ticket_id}/attachments/file/{attachment_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new $s(o)}async getPlannedMaintenanceAttachmentsById(t,i){return await(await this.getPlannedMaintenanceAttachmentsByIdRaw(t,i)).value()}async getPlannedMaintenanceAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new Zt("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getPlannedMaintenanceAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/planned-maintenances/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new Ai(o,a=>Yu(a))}async getPlannedMaintenanceAttachmentsList(t,i){return await(await this.getPlannedMaintenanceAttachmentsListRaw(t,i)).value()}async getPlannedMaintenanceTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new Zt("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getPlannedMaintenanceTicketById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/planned-maintenances/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new Ai(o,a=>Uu(a))}async getPlannedMaintenanceTicketById(t,i){return await(await this.getPlannedMaintenanceTicketByIdRaw(t,i)).value()}async getPlannedMaintenanceTicketsRaw(t,i){const s={};t.$filter!==void 0&&(s.$filter=t.$filter),t.$orderby!==void 0&&(s.$orderby=t.$orderby),t.$skip!==void 0&&(s.$skip=t.$skip),t.$top!==void 0&&(s.$top=t.$top);const n={},o=await this.request({path:"/planned-maintenances",method:"GET",headers:n,query:s},i);return new Ai(o,a=>Wu(a))}async getPlannedMaintenanceTickets(t={},i){return await(await this.getPlannedMaintenanceTicketsRaw(t,i)).value()}}function el(e){return tl(e)}function tl(e,t){return e==null?e:{en:qe(e,"en")?e.en:void 0,fr:qe(e,"fr")?e.fr:void 0,de:qe(e,"de")?e.de:void 0,es:qe(e,"es")?e.es:void 0}}function il(e){return sl(e)}function sl(e,t){return e}function nl(e){return al(e)}function al(e,t){return e}const Yt={ServiceNow:"ServiceNow",InSite:"InSite",TelxSfdc:"TelxSFDC"};function ol(e){return rl(e)}function rl(e,t){return e}function cl(e){return dl(e)}function dl(e,t){return e==null?e:{process:qe(e,"process")?nl(e.process):void 0,site:qe(e,"site")?e.site:void 0,serviceManagementSystem:qe(e,"serviceManagementSystem")?ol(e.serviceManagementSystem):void 0,destinationUrls:qe(e,"destinationUrls")?el(e.destinationUrls):void 0,portal:qe(e,"portal")?il(e.portal):void 0}}class ul extends di{async getSiteNavigationRaw(t,i){if(t.accountNumber===null||t.accountNumber===void 0)throw new zs("accountNumber","Required parameter requestParameters.accountNumber was null or undefined when calling getSiteNavigation.");if(t.site===null||t.site===void 0)throw new zs("site","Required parameter requestParameters.site was null or undefined when calling getSiteNavigation.");const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.process!==void 0&&(s.process=t.process);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("bearerToken",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/site-configurations",method:"GET",headers:n,query:s},i);return new xd(o,a=>a.map(cl))}async getSiteNavigation(t,i){return await(await this.getSiteNavigationRaw(t,i)).value()}}const ll="http://localhost".replace(/\/+$/,"");class sn{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:ll}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||nn}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const ml=new sn;class mi{constructor(t=ml){this.configuration=t,this.fetchApi=async(i,s)=>{let n={url:i,init:s};for(const a of this.middleware)a.pre&&(n=await a.pre({fetch:this.fetchApi,...n})||n);let o;try{o=await(this.configuration.fetchApi||fetch)(n.url,n.init)}catch(a){for(const r of this.middleware)r.onError&&(o=await r.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new gl(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:n.url,init:n.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const i=this.clone();return i.middleware=i.middleware.concat(...t),i}withPreMiddleware(...t){const i=t.map(s=>({pre:s}));return this.withMiddleware(...i)}withPostMiddleware(...t){const i=t.map(s=>({post:s}));return this.withMiddleware(...i)}isJsonMime(t){return t?mi.jsonRegex.test(t):!1}async request(t,i){const{url:s,init:n}=await this.createFetchParams(t,i),o=await this.fetchApi(s,n);if(o&&o.status>=200&&o.status<300)return o;throw new vl(o,"Response returned an error code")}async createFetchParams(t,i){let s=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(s+="?"+this.configuration.queryParamsStringify(t.query));const n=Object.assign({},this.configuration.headers,t.headers);Object.keys(n).forEach(p=>n[p]===void 0?delete n[p]:{});const o=typeof i=="function"?i:async()=>i,a={method:t.method,headers:n,body:t.body,credentials:this.configuration.credentials},r={...a,...await o({init:a,context:t})};let d;hl(r.body)||r.body instanceof URLSearchParams||pl(r.body)?d=r.body:this.isJsonMime(n["Content-Type"])?d=JSON.stringify(r.body):d=r.body;const u={...r,body:d};return{url:s,init:u}}clone(){const t=this.constructor,i=new t(this.configuration);return i.middleware=this.middleware.slice(),i}}mi.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function pl(e){return typeof Blob<"u"&&e instanceof Blob}function hl(e){return typeof FormData<"u"&&e instanceof FormData}class vl extends Error{constructor(t,i){super(i),this.response=t,this.name="ResponseError"}}class gl extends Error{constructor(t,i){super(i),this.cause=t,this.name="FetchError"}}class ie extends Error{constructor(t,i){super(i),this.field=t,this.name="RequiredError"}}function R(e,t){return e[t]!=null}function nn(e,t=""){return Object.keys(e).map(i=>an(i,e[i],t)).filter(i=>i.length>0).join("&")}function an(e,t,i=""){const s=i+(i.length?`[${e}]`:e);if(t instanceof Array){const n=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(s)}=`);return`${encodeURIComponent(s)}=${n}`}if(t instanceof Set){const n=Array.from(t);return an(e,n,i)}return t instanceof Date?`${encodeURIComponent(s)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?nn(t,s):`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`}class De{constructor(t,i=s=>s){this.raw=t,this.transformer=i}async value(){return this.transformer(await this.raw.json())}}class wl{constructor(t){this.raw=t}async value(){return await this.raw.blob()}}function fl(e){if(e!==void 0)return e===null?null:{cancellationReason:e.cancellationReason}}function kl(e){return yl(e)}function yl(e,t){return e==null?e:{message:R(e,"message")?e.message:void 0}}function Tl(e){return bl(e)}function bl(e,t){return e==null?e:{requestType:R(e,"request_type")?e.request_type:void 0,categories:R(e,"categories")?e.categories:void 0}}function Rl(e){return Al(e)}function Al(e,t){return e==null?e:{items:R(e,"items")?e.items.map(Tl):void 0}}function on(e){return _l(e)}function _l(e,t){return e==null?e:{createdBy:R(e,"created_by")?e.created_by:void 0,createdAt:R(e,"created_at")?new Date(e.created_at):void 0,comment:R(e,"comment")?e.comment:void 0}}function Sl(e){return Il(e)}function Il(e,t){return e==null?e:{comments:R(e,"comments")?e.comments.map(on):void 0}}function rn(e){return Cl(e)}function Cl(e,t){return e==null?e:{id:R(e,"id")?e.id:void 0,fileName:R(e,"file_name")?e.file_name:void 0,fileSize:R(e,"file_size")?e.file_size:void 0,contentType:R(e,"content_type")?e.content_type:void 0,createdBy:R(e,"created_by")?e.created_by:void 0,createdAt:R(e,"created_at")?new Date(e.created_at):void 0}}function Nl(e){return Pl(e)}function Pl(e,t){return e==null?e:{attachments:R(e,"attachments")?e.attachments.map(rn):void 0}}function ql(e){if(e!==void 0)return e===null?null:{comment:e.comment}}function Dl(e){if(e!==void 0)return e===null?null:{account_number:e.accountNumber,subject:e.subject,request_type:e.requestType,category:e.category,locations:e.locations,circuit_id:e.circuitId,customer_reference:e.customerReference,description:e.description,notification_recipients:e.notificationRecipients}}function Si(e){return Bl(e)}function Bl(e,t){return e==null?e:{ticketNumber:R(e,"ticket_number")?e.ticket_number:void 0,accountNumber:R(e,"account_number")?e.account_number:void 0,accountName:R(e,"account_name")?e.account_name:void 0,id:R(e,"id")?e.id:void 0,status:R(e,"status")?e.status:void 0,cancellationReason:R(e,"cancellation_reason")?e.cancellation_reason:void 0,subject:R(e,"subject")?e.subject:void 0,requestType:R(e,"request_type")?e.request_type:void 0,category:R(e,"category")?e.category:void 0,site:R(e,"site")?e.site:void 0,locations:R(e,"locations")?e.locations:void 0,circuitId:R(e,"circuit_id")?e.circuit_id:void 0,customerReference:R(e,"customer_reference")?e.customer_reference:void 0,description:R(e,"description")?e.description:void 0,notificationRecipients:R(e,"notification_recipients")?e.notification_recipients:void 0,createdBy:R(e,"created_by")?e.created_by:void 0,createdAt:R(e,"created_at")?new Date(e.created_at):void 0,updatedAt:R(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:R(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0,comments:R(e,"comments")?e.comments.map(on):void 0}}function Ol(e){if(e!==void 0)return e===null?null:{subject:e.subject,description:e.description,circuit_id:e.circuitId,customer_reference:e.customerReference,other_notification_recipients:e.otherNotificationRecipients}}function $l(e){return El(e)}function El(e,t){return e==null?e:{accountNumber:R(e,"account_number")?e.account_number:void 0,accountName:R(e,"account_name")?e.account_name:void 0,id:R(e,"id")?e.id:void 0,status:R(e,"status")?e.status:void 0,subject:R(e,"subject")?e.subject:void 0,site:R(e,"site")?e.site:void 0,locations:R(e,"locations")?e.locations:void 0,description:R(e,"description")?e.description:void 0,createdBy:R(e,"created_by")?e.created_by:void 0,createdAt:R(e,"created_at")?new Date(e.created_at):void 0,updatedAt:R(e,"updated_at")?new Date(e.updated_at):void 0,closedAt:R(e,"closed_at")?e.closed_at===null?null:new Date(e.closed_at):void 0}}function xl(e){return Fl(e)}function Fl(e,t){return e==null?e:{items:R(e,"items")?e.items.map($l):void 0,totalCount:R(e,"total_count")?e.total_count:void 0,pageNumber:R(e,"page_number")?e.page_number:void 0,pageSize:R(e,"page_size")?e.page_size:void 0}}class Ll extends mi{async cancellationTroubleTicketRequestRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ie("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling cancellationTroubleTicketRequest.");if(t.cancellationTicketsRequest===null||t.cancellationTicketsRequest===void 0)throw new ie("cancellationTicketsRequest","Required parameter requestParameters.cancellationTicketsRequest was null or undefined when calling cancellationTroubleTicketRequest.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/trouble-tickets/{ticket_id}/cancel".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PUT",headers:n,query:s,body:fl(t.cancellationTicketsRequest)},i);return new De(o,a=>kl(a))}async cancellationTroubleTicketRequest(t,i){return await(await this.cancellationTroubleTicketRequestRaw(t,i)).value()}async createTroubleTicketAttachmentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ie("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createTroubleTicketAttachment.");if(t.fileName===null||t.fileName===void 0)throw new ie("fileName","Required parameter requestParameters.fileName was null or undefined when calling createTroubleTicketAttachment.");if(t.body===null||t.body===void 0)throw new ie("body","Required parameter requestParameters.body was null or undefined when calling createTroubleTicketAttachment.");const s={};t.fileName!==void 0&&(s.file_name=t.fileName);const n={};if(n["Content-Type"]="image/jpeg",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/trouble-tickets/{ticket_id}/attachments/file".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:t.body},i);return new De(o,a=>rn(a))}async createTroubleTicketAttachment(t,i){return await(await this.createTroubleTicketAttachmentRaw(t,i)).value()}async createTroubleTicketCommentRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ie("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling createTroubleTicketComment.");if(t.ticketCommentsRequest===null||t.ticketCommentsRequest===void 0)throw new ie("ticketCommentsRequest","Required parameter requestParameters.ticketCommentsRequest was null or undefined when calling createTroubleTicketComment.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/trouble-tickets/{ticket_id}/comments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"POST",headers:n,query:s,body:ql(t.ticketCommentsRequest)},i);return new De(o,a=>Sl(a))}async createTroubleTicketComment(t,i){return await(await this.createTroubleTicketCommentRaw(t,i)).value()}async createTroubleTicketTicketRaw(t,i){if(t.troubleTicketRequest===null||t.troubleTicketRequest===void 0)throw new ie("troubleTicketRequest","Required parameter requestParameters.troubleTicketRequest was null or undefined when calling createTroubleTicketTicket.");const s={},n={};if(n["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/trouble-tickets",method:"POST",headers:n,query:s,body:Dl(t.troubleTicketRequest)},i);return new De(o,a=>Si(a))}async createTroubleTicketTicket(t,i){return await(await this.createTroubleTicketTicketRaw(t,i)).value()}async getTroubleTicketAttachmentsByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ie("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getTroubleTicketAttachmentsById.");if(t.attachmentId===null||t.attachmentId===void 0)throw new ie("attachmentId","Required parameter requestParameters.attachmentId was null or undefined when calling getTroubleTicketAttachmentsById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/trouble-tickets/{ticket_id}/attachments/file/{attachment_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))).replace("{attachment_id}",encodeURIComponent(String(t.attachmentId))),method:"GET",headers:n,query:s},i);return new wl(o)}async getTroubleTicketAttachmentsById(t,i){return await(await this.getTroubleTicketAttachmentsByIdRaw(t,i)).value()}async getTroubleTicketAttachmentsListRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ie("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getTroubleTicketAttachmentsList.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/trouble-tickets/{ticket_id}/attachments".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new De(o,a=>Nl(a))}async getTroubleTicketAttachmentsList(t,i){return await(await this.getTroubleTicketAttachmentsListRaw(t,i)).value()}async getTroubleTicketTicketByIdRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ie("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling getTroubleTicketTicketById.");const s={},n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/trouble-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"GET",headers:n,query:s},i);return new De(o,a=>Si(a))}async getTroubleTicketTicketById(t,i){return await(await this.getTroubleTicketTicketByIdRaw(t,i)).value()}async getTroubleTicketTicketsRaw(t,i){const s={};t.accountNumber!==void 0&&(s.account_number=t.accountNumber),t.site!==void 0&&(s.site=t.site),t.status!==void 0&&(s.status=t.status),t.createdBy!==void 0&&(s.created_by=t.createdBy),t.sort!==void 0&&(s.sort=t.sort),t.pageNumber!==void 0&&(s.page_number=t.pageNumber),t.pageSize!==void 0&&(s.page_size=t.pageSize);const n={},o=await this.request({path:"/trouble-tickets",method:"GET",headers:n,query:s},i);return new De(o,a=>xl(a))}async getTroubleTicketTickets(t={},i){return await(await this.getTroubleTicketTicketsRaw(t,i)).value()}async getTroubleTicketsCategoriesListRaw(t,i){if(t.site===null||t.site===void 0)throw new ie("site","Required parameter requestParameters.site was null or undefined when calling getTroubleTicketsCategoriesList.");const s={};t.site!==void 0&&(s.site=t.site);const n={};if(this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/trouble-tickets/categories",method:"GET",headers:n,query:s},i);return new De(o,a=>Rl(a))}async getTroubleTicketsCategoriesList(t,i){return await(await this.getTroubleTicketsCategoriesListRaw(t,i)).value()}async updateTroubleTicketTicketRaw(t,i){if(t.ticketId===null||t.ticketId===void 0)throw new ie("ticketId","Required parameter requestParameters.ticketId was null or undefined when calling updateTroubleTicketTicket.");if(t.troubleTicketUpdateRequest===null||t.troubleTicketUpdateRequest===void 0)throw new ie("troubleTicketUpdateRequest","Required parameter requestParameters.troubleTicketUpdateRequest was null or undefined when calling updateTroubleTicketTicket.");const s={},n={};if(n["Content-Type"]="application/merge-patch+json",this.configuration&&this.configuration.accessToken){const a=this.configuration.accessToken,r=await a("BearerAuth",[]);r&&(n.Authorization=`Bearer ${r}`)}const o=await this.request({path:"/trouble-tickets/{ticket_id}".replace("{ticket_id}",encodeURIComponent(String(t.ticketId))),method:"PATCH",headers:n,query:s,body:Ol(t.troubleTicketUpdateRequest)},i);return new De(o,a=>Si(a))}async updateTroubleTicketTicket(t,i){return await(await this.updateTroubleTicketTicketRaw(t,i)).value()}}function Vl(e){return Ul(e)}function Ul(e,t){return e==null?e:{id:e.id,name:e.name,isNonLocation:e.is_non_location,category:Ws(e,"category")?e.category:void 0,privileges:e.privileges,isInternal:e.is_internal}}function Hl(e){return zl(e)}function zl(e,t){return e==null?e:{accountNumber:e.account_number,permissionName:e.permission_name,privilege:e.privilege,isNonLocation:Ws(e,"is_non_location")?e.is_non_location:void 0,permissionIsInternal:e.permission_is_internal}}class jl extends ui{async getPermissionsRaw(t){const i={},s={};this.configuration&&this.configuration.accessToken&&(s.Authorization=await this.configuration.accessToken("oAuth2",[]));const n=await this.request({path:"/permissions",method:"GET",headers:s,query:i},t);return new Ks(n,o=>o.map(Vl))}async getPermissions(t){return await(await this.getPermissionsRaw(t)).value()}async getUserPermissionsRaw(t,i){const s={};t.excludeSiblings!==void 0&&(s.exclude_siblings=t.excludeSiblings),t.excludeParents!==void 0&&(s.exclude_parents=t.excludeParents);const n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("oAuth2",[]));const o=await this.request({path:"/my-permissions",method:"GET",headers:n,query:s},i);return new Ks(o,a=>a.map(Hl))}async getUserPermissions(t={},i){return await(await this.getUserPermissionsRaw(t,i)).value()}}const z={CustomerCare:"sm-customer-care",DeliveriesRemovals:"sm-deliveries",References:"sm-references",RemoteHands:"sm-remote-hands",TroubleTickets:"sm-trouble-tickets",FacilityAccess:"sm-facility-access",ServiceTickets:"sm-service-tickets",SiteMaintenance:"sm-site-maintenance",Incidents:"sm-incidents",Inventory:"inventory",SiteNavigation:"site-navigations",UserManagement:"usermanagement"},F={Site:"Site",Floor:"Floor",Room:"Room",Cabinet:"Cabinet",Cage:"Cage"},U={Read:"Read",Update:"Update",Delete:"Delete",Create:"Create",Approve:"Approve"},Ml={READ:1,UPDATE:2,DELETE:4,CREATE:8,APPROVE:16};var Ii;(function(e){e.Security="Security",e.DCIM="DCIM",e.PlannedSiteMaintenance="Planned Site Maintenance"})(Ii||(Ii={}));const I={RemoteHands:"Remote Hands",TroubleTickets:"Trouble Ticket",DeliveriesRemovals:"Shipping & Receiving",VisitorAccess:"Visitor Access",CustomerCare:"Customer Support",PermanentBadge:"Permanent Badge",OSPAccess:"OSP Access",POPPOEAccess:"POP/POE Room Access",PlannedMaintenance:"Planned Site Maintenance"},Jl={Duplicate:"Duplicate request",Error:"Request entered in error",NotNeeded:"Request no longer needed"},Wl={Delivery:"Delivery",Removal:"Removal",TroubleTicket:"Trouble Ticket",FacilityAccess:"Facility Access",RemoteHands:"Remote Hands",VisitorAccess:"Visitor Access",PermanentBadge:"Permanent Badge"},ut={GreaterThan:"gt:",GreaterOrEqual:"ge:",LessThan:"lt:",LessThanOrEqual:"le:"},Gl=10,Zl="permission_privilege";class Kl{constructor(t){this.configuration=t}get customerCareApi(){return new lu(new Ki({basePath:`${this.configuration.SMApiUrl}/${z.CustomerCare}`,headers:{Authorization:this.getAuthorization()}}))}get courierCompaniesApi(){return new xa(new Et({basePath:`${this.configuration.SMApiUrl}/${z.DeliveriesRemovals}`,headers:{Authorization:this.getAuthorization()}}))}get deliveriesApi(){return new oo(new Et({basePath:`${this.configuration.SMApiUrl}/${z.DeliveriesRemovals}`,headers:{Authorization:this.getAuthorization()}}))}get removalsApi(){return new ro(new Et({basePath:`${this.configuration.SMApiUrl}/${z.DeliveriesRemovals}`,headers:{Authorization:this.getAuthorization()}}))}get remoteHandsApi(){return new Fc(new _s({basePath:`${this.configuration.SMApiUrl}/${z.RemoteHands}`,headers:{Authorization:this.getAuthorization()}}))}get troubleTicketsApi(){return new Ll(new sn({basePath:`${this.configuration.SMApiUrl}/${z.TroubleTickets}`,headers:{Authorization:this.getAuthorization()}}))}get facilityAccessApi(){return{visitorAccess:new Zr(new pt({basePath:`${this.configuration.SMApiUrl}/${z.FacilityAccess}`,headers:{Authorization:this.getAuthorization()}})),visitorHost:new Kr(new pt({basePath:`${this.configuration.SMApiUrl}/${z.FacilityAccess}`,headers:{Authorization:this.getAuthorization()}})),permanentBadgeAccess:new Gr(new pt({basePath:`${this.configuration.SMApiUrl}/${z.FacilityAccess}`,headers:{Authorization:this.getAuthorization()}})),ospAccess:new Jr(new pt({basePath:`${this.configuration.SMApiUrl}/${z.FacilityAccess}`,headers:{Authorization:this.getAuthorization()}})),popAccess:new Wr(new pt({basePath:`${this.configuration.SMApiUrl}/${z.FacilityAccess}`,headers:{Authorization:this.getAuthorization()}}))}}get serviceTicketApi(){return new Eu(new Qs({basePath:`${this.configuration.SMApiUrl}/${z.ServiceTickets}`,headers:{Authorization:this.getAuthorization()}}))}get inventoryApi(){return{locations:new id(new Wt({basePath:`${this.configuration.SMApiUrl}/${z.Inventory}`,headers:{Authorization:this.getAuthorization()}})),sites:new qs(new Wt({basePath:`${this.configuration.SMApiUrl}/${z.Inventory}`,headers:{Authorization:this.getAuthorization()}}))}}get sitesApi(){return new qs(new Wt({basePath:`${this.configuration.SMApiUrl}/${z.Inventory}`,headers:{Authorization:this.getAuthorization()}}))}get siteNavigationApi(){return new ul(new Hs({basePath:`${this.configuration.SMApiUrl}/${z.SiteNavigation}`,headers:{Authorization:this.getAuthorization()}}))}get plannedMaintenanceApi(){return new Qu(new Ds({basePath:`${this.configuration.SMApiUrl}/${z.SiteMaintenance}`,headers:{Authorization:this.getAuthorization()}}))}get incidentsApi(){return new Pd(new Es({basePath:`${this.configuration.SMApiUrl}/${z.Incidents}`,headers:{Authorization:this.getAuthorization()}}))}get userPermissionsApi(){return new jl(new Js({basePath:`${this.configuration.SMApiUrl}/${z.UserManagement}`,headers:{Authorization:this.getAuthorization()}}))}getAuthorizationToken(){return this.getAuthorization()}get referencesApi(){return{categories:new fu(new Gt({basePath:`${this.configuration.SMApiUrl}/${z.References}`,headers:{Authorization:this.getAuthorization(),"cache-control":"no-cache"}})),requestTypeCategoryMappings:new ku(new Gt({basePath:`${this.configuration.SMApiUrl}/${z.References}`,headers:{Authorization:this.getAuthorization(),"cache-control":"no-cache"}})),terms:new Tu(new Gt({basePath:`${this.configuration.SMApiUrl}/sm-references`,headers:{Authorization:this.getAuthorization(),"cache-control":"no-cache"}}))}}getAuthorization(){return this.configuration.getAuthorizationFn?this.configuration.getAuthorizationFn():""}}class Yl extends pa{constructor(t,i){super({...t}),this.hashed_identifier=i}}class Xl{constructor(t,i){this.name=t,this.accountNumber=i}}class Qe{constructor({loginAuthority:t,clientId:i,scope:s,postLogoutRedirectUri:n,userStorageKey:o="user-authentication",redirectUrlKey:a="redirect-url",authPaths:r={authenticate:"authenticate",authCallback:"auth-callback",logout:"logout"}}){this.getHashedRootAccountNumberAndUserEmail=async()=>{const A=ot.getAccountHierarchy(),N=await Qe.hashValue(ot===null||ot===void 0?void 0:ot.email);let b=await Qe.hashValue(ot===null||ot===void 0?void 0:ot.account_number);return A&&(b=await Qe.hashValue(A==null?void 0:A.accountNumber)),`${b}-${N}`},this.configuration={loginAuthority:t,clientId:i,scope:s,postLogoutRedirectUri:n,userStorageKey:o,redirectUrlKey:a,authPaths:r};const{location:d}=window,u=`${d.protocol}//${d.hostname}${d.port?`:${d.port}`:""}`,p={authority:this.configuration.loginAuthority,client_id:this.configuration.clientId,redirect_uri:`${u}/${this.configuration.authPaths.authCallback}`,response_type:"code",scope:this.configuration.scope,post_logout_redirect_uri:this.configuration.postLogoutRedirectUri,loadUserInfo:!0};this.userManager=new ha(p)}isLoggedIn(){const t=this.getUser();if(t===null)return!1;if(!t.expires_at)return!0;const i=new Date,s=new Date(t.expires_at*1e3);return i<s}redirectToAuth(t=!1){const i=this.isAuthenticating();(t||!i)&&(i||localStorage.setItem(this.configuration.redirectUrlKey,window.location.href),rt.go(`/${this.configuration.authPaths.authenticate}`))}isAuthenticating(){const t=window.location.pathname.split("/");return t[t.length-1]===this.configuration.authPaths.authenticate?(this.userManager.signinRedirect(),!0):!1}isHandlingAuthCallback(){const t=window.location.pathname.split("/");return t[t.length-1]===this.configuration.authPaths.authCallback?(this.userManager.signinRedirectCallback().then(Qe.ensureValidUser).then(Qe.addHashedIdToUserProfile).then(i=>this.saveUser(i)).then(()=>this.authSuccessRedirect()).catch(()=>this.redirectToAuth()),!0):!1}authSuccessRedirect(){let t="/";const i=localStorage.getItem(this.configuration.redirectUrlKey);i&&(localStorage.removeItem(this.configuration.redirectUrlKey),t=i),rt.go(t)}redirectToLogout(){this.isHandlingLogout()||rt.go(`/${this.configuration.authPaths.logout}`)}isHandlingLogout(){const t=window.location.pathname.split("/");return t[t.length-1]===this.configuration.authPaths.logout?(this.clearUser(),window.localStorage.clear(),this.userManager.signoutRedirect({id_token_hint:this.getIdToken()}),!0):!1}isProcessing(){return this.isAuthenticating()||this.isHandlingAuthCallback()||this.isHandlingLogout()}saveUser(t){localStorage.setItem(this.configuration.userStorageKey,JSON.stringify(t))}clearUser(){localStorage.removeItem(this.configuration.userStorageKey)}getUser(){const t=localStorage.getItem(this.configuration.userStorageKey);return t?JSON.parse(t):null}getUserProfileSub(){var t;const i=this.getUser();return(t=i==null?void 0:i.profile)===null||t===void 0?void 0:t.sub}getUserLocale(){var t;const i=this.getUser();return(t=i==null?void 0:i.profile)===null||t===void 0?void 0:t.locale}getHashedIdentifer(){var t;return(t=this.getUser())===null||t===void 0?void 0:t.hashed_identifier}getIdToken(){var t;return(t=this.getUser())===null||t===void 0?void 0:t.id_token}getAccessToken(){var t;return(t=this.getUser())===null||t===void 0?void 0:t.access_token}getAuthorization(){var t,i;return`${(t=this.getUser())===null||t===void 0?void 0:t.token_type} ${(i=this.getUser())===null||i===void 0?void 0:i.access_token}`}getUserAccount(){var t,i,s,n;return new Xl((i=(t=this.getUser())===null||t===void 0?void 0:t.profile)===null||i===void 0?void 0:i.account_name,(n=(s=this.getUser())===null||s===void 0?void 0:s.profile)===null||n===void 0?void 0:n.account_number)}getUserEmail(){var t,i;return(i=(t=this.getUser())===null||t===void 0?void 0:t.profile)===null||i===void 0?void 0:i.email}getAccountNumber(){var t,i;return(i=(t=this.getUser())===null||t===void 0?void 0:t.profile)===null||i===void 0?void 0:i.account_number}static async hashValue(t){const i=new TextEncoder().encode(t),s=await crypto.subtle.digest("SHA-256",i);return Array.from(new Uint8Array(s)).map(n=>n.toString(16).padStart(2,"0")).join("")}static async addHashedIdToUserProfile(t){const i=`${t.profile.sub}-${t.profile.customer_id}`,s=await Qe.hashValue(i);return new Yl(t,s)}static ensureValidUser(t){if(!t.id_token)throw new Error("Missing property:id_token");return t}}function K(){var e;const t=(e=window.gpConfig)===null||e===void 0?void 0:e["ui-service-management"];if(!t)throw new Error("ui-service-management config not loaded. Ensure config.json is fetched before app bootstrap.");return t}const Xt=K(),oe=new Qe({loginAuthority:Xt.LoginAuthority,clientId:Xt.ServiceManagementUIClientId,scope:Xt.ServiceManagementUIScopes}),l=new Kl({SMApiUrl:Xt.SMApiUrl,getAuthorizationFn:()=>`Bearer ${oe.getAccessToken()}`}),cn="no instructions provided",Ci=" [Special Instructions] ",gt="Other",dn="Digital Realty",Ql="Interxion",un=5;class em{constructor(){this.couriers={},this.sites=[],this.removalParties=[],this.requestTypeCategoriesDict={},this.termsLookup={[ee.Deliveries]:"",[ee.FacilityAccess]:"",[ee.TroubleTickets]:"",[ee.RemoteHands]:""},ne(this),Je(this,{name:"lookups",properties:["couriers","sites","removalParties","requestTypeCategoriesDict","termsLookup"],storage:window.sessionStorage})}getCouriers(t,i){var s;const n=(s=this.couriers[t])!==null&&s!==void 0?s:[];return i?[...n,gt]:n}async fillCouriers(t,i,s){!t||!i||!s||this.couriers[s]||(this.couriers[s]=await l.courierCompaniesApi.getCourierBySite({accountNumber:i,site:t}))}async fillSites(){const t={pageSize:1e3};this.sites=await Zi(t,i=>l.inventoryApi.sites.getSites(i))}async getRemoteHandsCategories(t,i){const s=`RemoteHands-${t}-${i}`;if(this.requestTypeCategoriesDict[s])return this.requestTypeCategoriesDict[s];const n=await l.remoteHandsApi.getRemoteHandsCategoriesList({site:t,accountNumber:i});return!n.items||n.items.length===0?{}:(this.requestTypeCategoriesDict[s]=Object.fromEntries(n.items.filter(o=>{var a;return o.requestType&&((a=o.categories)===null||a===void 0?void 0:a.length)}).map(o=>[o.requestType,o.categories])),this.requestTypeCategoriesDict[s])}async getRequestCategories(t,i,s){const n=`${t}-${i}`;if(this.requestTypeCategoriesDict[n]&&!s)return this.requestTypeCategoriesDict[n];const o=(await l.referencesApi.requestTypeCategoryMappings.getRequestTypeCategoryMappings({serviceTicketType:i,serviceManagementSystem:t,siteCode:s})).filter(a=>{var r;return(r=a.categories)===null||r===void 0?void 0:r.some(d=>d.isActive)});return this.requestTypeCategoriesDict[n]=Object.fromEntries(o.map(a=>{var r;return[a.requestType,(r=a.categories)===null||r===void 0?void 0:r.filter(d=>d.isActive).map(d=>d.canonicalValue)]})),this.requestTypeCategoriesDict[n]}async fillRemovalParties(){this.removalParties=await l.removalsApi.getRemovalParties()}async fillLookups(){await Promise.all([this.fillRemovalParties(),this.fillTerms(),this.fillSites()])}async fillTerms(){const t=async i=>{await l.referencesApi.terms.getTerms({service:i}).then(s=>{this.termsLookup[i]=s})};await Promise.all([t(ee.Deliveries),t(ee.TroubleTickets),t(ee.RemoteHands),t(ee.FacilityAccess)])}clear(){this.couriers={},this.sites=[],this.removalParties=[],this.requestTypeCategoriesDict={},this.termsLookup={[ee.Deliveries]:"",[ee.FacilityAccess]:"",[ee.TroubleTickets]:"",[ee.RemoteHands]:""}}}const J=new em;function It(e){return new Date(e).toISOString().split("T")[0]}const ln=()=>{var e;const t=localStorage.getItem("date-format");return t&&((e=JSON.parse(t))===null||e===void 0?void 0:e.preferredTimezone)||ve.tz.guess()},Be=(e,t,i)=>{var s,n;if(!e||!t)return;const o=`${e} ${t}`,a=(n=(s=J.sites)===null||s===void 0?void 0:s.find(r=>r.id===i))===null||n===void 0?void 0:n.timeZone;return(a?ve.tz(o,a):ve.utc(o)).utc().toDate()};function tm(e,t=ln()){const i=ve.tz(e,t).startOf("day").toDate(),s=ve.tz(e,t).endOf("day").toDate();return{startOfDayLocal:i,endOfDayLocal:s}}const im=()=>ve.utc().tz(ln()).startOf("day").format("YYYY-MM-DD"),sm=(e,t)=>(t?ve.tz(t):ve.utc()).add(e,"days").format("YYYY-MM-DD"),Z=e=>{if(e)return new Date(e)},nm=()=>{var e;const t=localStorage.getItem("date-format");return t&&((e=JSON.parse(t))===null||e===void 0?void 0:e.preferredDateFormat)||"yyyy-MM-dd"};It(new Date);const am=bt`.header-container{display:flex;align-items:center;gap:20px}.header__title{margin:0;font-family:var(--root-secondary-font);font-style:normal;font-weight:700;font-size:34px;line-height:40px;letter-spacing:.35px;color:#092241;flex-grow:1}.header__profile{background-color:#092241;height:35px;border-radius:10px;color:#fff;padding-left:20px;padding-right:20px;display:flex;align-items:center;font-size:14px}.header__logout{height:35px;border-radius:10px;border:none;background-color:#1456e0;color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;padding-left:15px;padding-right:15px}.header__logout svg{width:1em;height:1em;font-size:20px;margin-right:5px}.header__accounts{width:200px;--md-outlined-field-top-space:5px;--md-outlined-field-bottom-space:5px}@media only screen and (min-width:5px) and (max-width:500px){.header-container{flex-direction:column}}@media only screen and (min-width:500px) and (max-width:1250px){.header-container{flex-direction:row}}`,L={ErrorRaised:"sm:error-raised",DrawerClose:"drawer-close",CreateTicket:"create-ticket",CancelTicket:"cancel-ticket",EditTicket:"edit-ticket",ApproveDenyTicket:"approve-deny-ticket"};class Oe{constructor(t,i,s){var n,o;this.id=t,this.siteId=i,this.accountNumber=s;const a=J.sites.find(r=>r.id===this.siteId);a?this.displayName=`${a==null?void 0:a.name} - ${a==null?void 0:a.streetAddress}`:this.displayName=(o=(n=this.id)!==null&&n!==void 0?n:this.siteId)!==null&&o!==void 0?o:""}}async function om(e){if(!e)return"";const t=J.sites.find(i=>i.locationId===e);return t?`${t.name} - ${t.streetAddress}`:e}async function rm(e){if(!e)return"";const t=J.sites.find(i=>i.id===e);return t?`${t.name} - ${t.streetAddress}`:e}async function cm(e){const t=J.sites.find(i=>i.id===e);return t==null?void 0:t.locationId}const mn=(e,t,i)=>{e.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))},dm=e=>mn(document,L.ErrorRaised,e),m=async(e,t=!0)=>{let i="An error occurred";if(e instanceof Qi&&e.response.status===400)try{const{detail:s}=await e.response.json();i=s}catch(s){console.error(e)}else console.error(e);t&&dm(i)},um=e=>{window.dispatchEvent(new CustomEvent("add-toast",{detail:{id:"error-toast",content:g`<ix-message-toast forceClose="false" toastId="error-toast" type="error">${e} </ix-message-toast>`,vertical:"bottom",horizontal:"center",animated:!0,above:!1}}))};class lm{constructor(){ne(this),Je(this,{name:"locations",properties:[],storage:window.localStorage})}async getLocations(t,i){var s;let n=[],o={...t,sort:t.sort||"+id"};const a=r=>l.inventoryApi.locations.getLocations(r).catch(d=>{m(d,!1)});if(i!=null&&i.onlyLoadFirstPage){const r=await a(o);n=(s=r==null?void 0:r.items)!==null&&s!==void 0?s:[]}else n=await Zi(o,a);return n.sort((r,d)=>r.id.localeCompare(d.id))}async getOspsBySiteId(t){try{const i=await l.inventoryApi.sites.getOspsBySiteId({siteId:t});return i!=null?i:[]}catch(i){return[]}}async getPopsBySiteId(t){try{const i=await l.inventoryApi.sites.getPopsBySiteId({siteId:t});return i!=null?i:[]}catch(i){return[]}}}const me=new lm;class mm{constructor(){this.OspLocationsMaxStartDateFromToday=()=>{const t=K()["SM:OspLocationsMaxStartDateFromToday"];return typeof t=="number"?t:90},this.PopLocationsMaxStartDateFromToday=()=>{const t=K()["SM:PopLocationsMaxStartDateFromToday"];return typeof t=="number"?t:90},this.DeliveriesWeightWhenOverweightMaxLength=()=>{const t=K()["SM:Deliveries:WeightWhenOverweightMaxLength"];return typeof t=="number"?t:1e3},this.DeliveriesSizeWhenOversizedMaxLength=()=>{const t=K()["SM:Deliveries:SizeWhenOversizedMaxLength"];return typeof t=="number"?t:1e3},this.AllowedLocationTypes=()=>{const t=K()["SM:AllowedLocationTypes"];return typeof t=="string"?t:""}}}const Ni=new mm;class pm{constructor(){this.isHideLocationDatesEnabled=()=>{const t=K()["SM:HideLocationDates"];return typeof t=="boolean"?t:!1},this.showNewDatePickerComponent=()=>{const t=K()["SM:UseNewDatePicker"];return typeof t=="boolean"?t:!1},this.isOspEnabled=()=>{const t=K()["SM:ShowOspAccess"];return typeof t=="boolean"?t:!1},this.isPopPoeEnabled=()=>{const t=K()["SM:ShowPopPoeAccess"];return typeof t=="boolean"?t:!1},this.isIncidentsEnabled=()=>{const t=K()["SM:IncidentsEnabled"];return typeof t=="boolean"?t:!1},this.isCustomerCarePopWhitelistEnabled=()=>{const t=K()["SM:CustomerCarePopWhitelistEnabled"];return typeof t=="boolean"?t:!1},this.customerCarePopWhitelist=()=>{const t=K()["SM:CustomerCarePopWhitelist"];return typeof t=="string"?t:""}}}const wt=new pm,Ct=`${F.Floor},${F.Room},${F.Cabinet},${F.Cage}`;function pn(e){return e===I.VisitorAccess||e===I.PermanentBadge}function hn(e){return e===I.OSPAccess||e===I.POPPOEAccess}function hm(e){return e===I.RemoteHands||e===I.TroubleTickets||e===I.VisitorAccess||e===I.PermanentBadge||e===I.CustomerCare||e===I.OSPAccess||e===I.POPPOEAccess}async function Ze(e){var t;const i=await me.getLocations({...e,pageSize:100});return(t=[...new Map(i.map(s=>[s.siteId,s])).values()].map(s=>new Oe(void 0,s.siteId,s.accountNumber)))!==null&&t!==void 0?t:[]}async function vm(e,t,i,s){let n=[],o=Ni.AllowedLocationTypes();t===I.DeliveriesRemovals?o=F.Site:pn(t)?o=Ct:hn(t)&&(o=ut.GreaterThan+F.Site);let a=await me.getLocations({locationType:o,permissionType:t,permissionPrivilege:e,pageSize:100,accountNumber:s,assignableProcess:i});return hm(t)?(a=[...new Map(a.map(r=>[r.siteId,r])).values()],n=a.map(r=>new Oe(r.siteId,r.siteId,r.accountNumber))):n=a.map(r=>new Oe(r.id,r.siteId,r.accountNumber)),n!=null?n:[]}async function gm(e,t){const i=await me.getLocations({locationType:F.Site,permissionType:t,permissionPrivilege:e,pageSize:100}),s=[...new Set(i.map(n=>n.accountNumber))];return s!=null?s:[]}async function wm(e,t,i,s,n){let o=Ni.AllowedLocationTypes();return pn(t)?o=Ct:hn(t)&&(o=ut.GreaterThan+F.Site),await me.getLocations({permissionType:t,locationType:o,permissionPrivilege:e,siteId:s,pageSize:100,accountNumber:n,assignableProcess:i})}async function Nt(e,t,i,s){const n=await me.getLocations({permissionType:t,permissionPrivilege:e,id:i,accountNumber:s,pageSize:1},{onlyLoadFirstPage:!0});return(n==null?void 0:n.length)>0}async function $e(e,t,i,s){return(await me.getLocations({permissionPrivilege:t,pageSize:1,permissionType:e,assignableProcess:i,locationType:s},{onlyLoadFirstPage:!0})).length>0}async function Ke(e,t,i){return(await me.getLocations({permissionPrivilege:i,pageSize:100,permissionType:t})).some(s=>e.includes(s.id))}async function vn(e){var t;if(!e)return;const i=await me.getLocations({id:e,pageSize:1},{onlyLoadFirstPage:!0});return(t=i==null?void 0:i[0])===null||t===void 0?void 0:t.siteId}async function fm(e){var t;if(!e)return;const i=await me.getLocations({siteId:e,locationType:F.Site,pageSize:1},{onlyLoadFirstPage:!0});return(t=i==null?void 0:i[0])===null||t===void 0?void 0:t.id}async function gn(){return $e(I.CustomerCare,U.Create,void 0,F.Site)}async function wn(){return $e(I.VisitorAccess,U.Create,void 0,F.Site)}async function fn(){return $e(I.PermanentBadge,U.Create,void 0,F.Site)}async function kn(){return wt.isOspEnabled()?$e(I.OSPAccess,U.Create,void 0,F.Site):!1}async function yn(){return wt.isPopPoeEnabled()?$e(I.POPPOEAccess,U.Create,void 0,F.Site):!1}async function km(){return $e(I.DeliveriesRemovals,U.Create)}async function Tn(){return(await Promise.all([wn(),fn(),kn(),yn()])).some(e=>e)}async function bn(){return $e(I.RemoteHands,U.Create,void 0,F.Site)}async function Pi(){return km()}function Rn(){return $e(I.TroubleTickets,U.Create,void 0,F.Site)}async function ym(){return(await Promise.all([gn(),Tn(),bn(),Pi(),Rn()])).some(e=>e)}function Tm(e){switch(e){case"Visitor Access":return I.VisitorAccess;case"Permanent Badge":return I.PermanentBadge;case"OSP Access":return I.OSPAccess;case"PoP/POE Access":return I.POPPOEAccess;default:return}}async function An(e){if(e===void 0)return!1;const t=await vn(e);return t?(await me.getLocations({siteId:t,permissionType:I.OSPAccess,locationType:ut.GreaterOrEqual+F.Site,permissionPrivilege:U.Update,pageSize:100,assignableProcess:"OSP_access"})).some(i=>i.siteId===t):!1}async function _n(e){if(e===void 0)return!1;const t=await vn(e);return t?(await me.getLocations({siteId:t,permissionType:I.POPPOEAccess,locationType:ut.GreaterOrEqual+F.Site,permissionPrivilege:U.Update,pageSize:100,assignableProcess:"POP_access"})).some(i=>i.siteId===t):!1}async function Sn(e){return me.getOspsBySiteId(e)}async function In(e){return me.getPopsBySiteId(e)}let qi=class extends Rt{constructor(){super(...arguments),this.hasCreatePermission=!1}dispatchCreateTicketEvent(){const e=new CustomEvent(L.CreateTicket,{bubbles:!0,composed:!0});this.dispatchEvent(e)}async firstUpdated(){this.hasCreatePermission=await ym()}render(){return this.hasCreatePermission?g` <ix-button @click="${this.dispatchCreateTicketEvent}" has-icon> <md-icon slot="icon">add</md-icon> <span class="uppercase font-bold tracking-wider">Create Ticket</span> </ix-button>`:P}};E([fe()],qi.prototype,"hasCreatePermission",void 0),qi=E([Q("sm-create-service-ticket-button")],qi);let Se=null;function Cn(){const{pathname:e,search:t,hash:i}=window.location;rt.go({pathname:e,search:t,hash:i})}function bm(e,t,i){const s=i.map(n=>({...n,path:`${t}${n.path}`,redirect:n.redirect?`${t}${n.redirect}`:null}));s.push({name:W.ServiceTickets,path:t||"/",component:"service-tickets-view",headerRight:g`<sm-create-service-ticket-button></sm-create-service-ticket-button>`,action:()=>{import("./ui-service-management2.js")}}),s.push({path:"(.*)",component:"service-tickets-view",action:()=>{import("./ui-service-management2.js")}}),Se=new rt(e),Se.setRoutes(s),window.addEventListener("shell-after-navigate",Cn)}function Rm(){return Se}function Am(){Se==null||Se.unsubscribe(),Se==null||Se.removeRoutes(),Se=null,window.removeEventListener("shell-after-navigate",Cn)}function Qt(e,t){return Se&&Se.urlForName(e,t)}function _m(e,t){const i=Qt(e);i&&rt.go({pathname:i,hash:t})}let Di=class extends Rt{constructor(){super(...arguments),this.routeName=null}return(){this.routeName&&_m(this.routeName),window.history.back()}render(){return g` <ix-button appearance="text" has-icon @click="${this.return}"> <md-icon slot="icon">arrow_back</md-icon> <span class="uppercase font-bold tracking-wider">Back</span> </ix-button>`}};E([fe({type:String})],Di.prototype,"routeName",void 0),Di=E([Q("sm-back-button")],Di);const Sm="Other parties to notify",Im="Result",Ye="CANCEL TICKET",Cm="REQUEST CANCELLATION",Ee="EDIT TICKET",Nm="Sites & Locations",Pm="Sites, Locations & Hosts",qm="Trouble Ticket is not supported for this site.",Dm="We are unable to process your request. Please, try again or reach out to us for further assistance. We apologize for the inconvenience. Your Digital Realty Team.",Bm="Please be advised that your company has been restricted from submitting a new Delivery request for this location until all existing packages have been retrieved.",Om="We're unable to process your request at the moment. Please reach out to Customer Care for assistance.",$m="Unable to process request. Contact Customer Care.",Em='For POP/POE Room Access, please submit your request via the Customer Care form using the "Building" request type and "POP/POE Room Access" category.',xm="Important Note: Selecting a location is required to submit this ticket. If your specific POP/POE location is missing from the dropdown, please select any available location to complete your request for Room Access.";var O;(function(e){e.Announced="Announced",e.Cancelled="Cancelled",e.Completed="Completed",e.Draft="Draft",e.InProgress="In Progress",e.New="New",e.Expired="Expired"})(O||(O={}));var ei;(function(e){e.CancellationRequested="Cancellation requested"})(ei||(ei={}));var ft;(function(e){e.Approved="Approved",e.PendingPickup="Pending Pick-up",e.Rejected="Rejected"})(ft||(ft={}));var re;(function(e){e.Approved="Approved",e.PendingApproval="Pending Approval",e.ApprovalDenied="Approval Denied"})(re||(re={}));const Fm=[O.Cancelled,O.Completed,O.Expired,ft.Rejected,re.ApprovalDenied],Lm=[O.New,O.InProgress,O.Announced,ft.PendingPickup,ft.Approved,ei.CancellationRequested,re.PendingApproval];var Bi;(function(e){e.Resolved="Resolved",e.InProgress="In Progress",e.New="New",e.Closed="Closed",e.Cancelled="Cancelled"})(Bi||(Bi={}));class Vm{constructor(){ne(this)}async getServiceBackend(t,i,s){var n;i=i==null?void 0:i.split(".").pop();let o={accountNumber:t,site:i};const a=await l.siteNavigationApi.getSiteNavigation(o).catch(r=>{m(r,!1)});switch((n=a==null?void 0:a.find(r=>r.process===s))===null||n===void 0?void 0:n.serviceManagementSystem){case Yt.InSite:return H.Insite;case Yt.ServiceNow:return H.ServiceNow;case Yt.TelxSfdc:return s==="Facilities_access"?H.Insite:H.TelxSFDC;default:return}}}const Y=new Vm;var lt;(function(e){e.Kilograms="kilograms",e.Pounds="pounds"})(lt||(lt={}));function Nn(e){return typeof e=="string"&&e.trim().length>0}function Um(e,t){return e.split(t).map(i=>i.trim().toLowerCase()).filter(i=>i.length>0)}const Pn=e=>/^(([^<>()[\]\\.,;:\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,}))$/.test(e);function Hm(e){return/^[a-zA-Z0-9]+$/.test(e)}function zm(e){return/^[a-zA-Z0-9 ]+$/.test(e)}function jm(e){return/^[a-zA-Z0-9.' ]+$/.test(e)}function Mm(e){const t=ve(e,"YYYY-MM-DD"),i=ve().add(24,"hours").startOf("day");return t.isSameOrAfter(i)}function Jm(e,t){const i=t?ve.tz(t):ve.utc(),[s,n]=e.split(":").map(o=>parseInt(o,10));return s>i.hours()||s===i.hours()&&n>i.minutes()}function qn(e){return Nn(e)?/^(0|[1-9]\d*)$/.test(e):!1}const Dn=(e,t)=>{let i;return t===H.ServiceNow&&(i=e.weight,e.overweight&&(e.isHistorical||(i=`${e.weight} ${e.weightUnit}`))),{trackingNumber:e.trackingNumber,numberOfPackages:e.numberOfPackages,sizeWhenOversized:e.dimensions,weightWhenOverweight:i,courierCompany:e.courier===gt?e.otherCompany:e.courier}},Bn=(e,t=!1)=>{var i,s,n,o,a;const r=e.serviceBackend!==H.ServiceNow?e.shortDescription+Ci+(e.instructions||cn):e.shortDescription,d={accountNumber:(i=e.site)===null||i===void 0?void 0:i.accountNumber,subject:(s=e.subject)!==null&&s!==void 0?s:"",description:r,etaFrom:Z(e.estimatedDate)||null,etaTo:Z(e.latestDate)||null,customerReference:e.referenceNumber,site:(o=(n=e.site)===null||n===void 0?void 0:n.id)!==null&&o!==void 0?o:"",otherNotificationRecipients:e.contacts,remoteHandsRequired:e.needRemoteHands};return(e==null?void 0:e.serviceBackend)!==H.TelxSFDC&&(d.loadingBayRequired=e.isLoadingBayRequired),t||(d.packages=(a=e.packages)===null||a===void 0?void 0:a.map(u=>Dn(u,e.serviceBackend))),d};function Wm(e,t){const i=new Date;return t&&i.setDate(i.getDate()+e),It(i)}function Gm(e){const t=new Date;return t.setDate(t.getDate()+e),It(t)}const On=async(e,t,i)=>{if(!e||!t||!i)return[e];if(await Y.getServiceBackend(t,i,"Deliveries")!==H.ServiceNow){const s=e.lastIndexOf(Ci);return s===-1?[e]:e.endsWith(cn)?[e.substring(0,s)]:[e.substring(0,s),e.substring(s+Ci.length)]}return[e]},Zm=e=>{if(!e)return[void 0,void 0];const t=e.split(" ");if(t.length!==2)return[e,void 0];const[i,s]=t;let n;if(s.toLowerCase()===lt.Kilograms)n=lt.Kilograms;else if(s.toLowerCase()===lt.Pounds)n=lt.Pounds;else return[e,void 0];return qn(i)?[i,n]:[e,void 0]},$n=async(e,t,i,s)=>{if(!e)return[];await J.fillCouriers(t,i,s);const n=J.getCouriers(s);return e.map(o=>{const a=n==null?void 0:n.find(N=>{var b;return N.toLowerCase()===((b=o.courierCompany)===null||b===void 0?void 0:b.toLowerCase())}),r=!!a,d=!!o.weightWhenOverweight;let u="",p;if(d){const[N,b]=Zm(o.weightWhenOverweight);u=N!=null?N:"",p=b}let A=!1;return d&&(A=!p||u.length>un),{id:o.id||"",trackingNumber:o.trackingNumber,numberOfPackages:o.numberOfPackages||0,dimensions:o.sizeWhenOversized,overweight:d,oversized:!!o.sizeWhenOversized,weight:A?o.weightWhenOverweight:u,weightUnit:A?void 0:p,courier:r?a:gt,otherCompany:r?"":o.courierCompany,isHistorical:A}})},En=async e=>{var t,i,s,n,o,a;if(!e)return;const[r,d]=await On(e.description,e.accountNumber,e.site),u=await Y.getServiceBackend(e.accountNumber,e.site,"Deliveries"),p=await $n(e.packages,e.site,e.accountNumber,u);return{id:e.id,accountName:e.accountName,accountNumber:e.accountNumber,subject:e.subject,shortDescription:r,instructions:d,estimatedDate:(t=e.etaFrom)===null||t===void 0?void 0:t.toISOString().split("T")[0],latestDate:(i=e.etaTo)===null||i===void 0?void 0:i.toISOString().split("T")[0],referenceNumber:e.customerReference,site:e.site,cancellationReason:e.cancellationReason,contacts:e.otherNotificationRecipients,state:e.status,requester:e.createdBy,createdOn:(s=e.createdAt)===null||s===void 0?void 0:s.toISOString(),updatedOn:(n=e.updatedAt)===null||n===void 0?void 0:n.toISOString(),isLoadingBayRequired:e.loadingBayRequired,needRemoteHands:(o=e.remoteHandsRequired)!==null&&o!==void 0?o:!1,packages:p,comments:(a=e.comments)===null||a===void 0?void 0:a.map(A=>M(A)),serviceBackend:u}},Km=async e=>{var t,i,s;if(!e)return;const[n,o]=await On(e.description,e.accountNumber,e.site),a=await Y.getServiceBackend(e.accountNumber,e.site,"Deliveries"),r=await $n(e.packages,e.site,e.accountNumber,a),d=J.sites.find(u=>u.id===e.site).locationId;return{id:e.id||"",accountNumber:e.accountNumber||"",subject:e.subject,shortDescription:n,instructions:o,estimatedDate:(t=e.etaFrom)===null||t===void 0?void 0:t.toISOString(),latestDate:(i=e.etaTo)===null||i===void 0?void 0:i.toISOString(),referenceNumber:e.customerReference,site:new Oe(d,e.site,e.accountNumber),contacts:e.otherNotificationRecipients,isLoadingBayRequired:e.loadingBayRequired,serviceBackend:a,isValid:!0,needRemoteHands:(s=e.remoteHandsRequired)!==null&&s!==void 0?s:!1,packages:r}},Ym=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}}),xn=e=>e.requestType===wi.PlannedWork&&e.serviceBackend===H.ServiceNow,Xm=e=>{var t,i;return xn(e)&&(i=Be(e.startDate,e.startTime,(t=e.site)===null||t===void 0?void 0:t.siteId))!==null&&i!==void 0?i:null},Fn=async e=>{var t,i;if(!e.expectedStart)return{startDate:"",startTime:"",startDateTime:""};const s=(i=(t=J.sites)===null||t===void 0?void 0:t.find(o=>o.locationId===e.site))===null||i===void 0?void 0:i.timeZone,n=s?G(e.expectedStart).tz(s):G(e.expectedStart);return{startDate:n.format("YYYY-MM-DD"),startTime:n.format("HH:mm"),startDateTime:n.format("YYYY-MM-DDTHH:mm")}},Qm=e=>{var t,i,s,n,o;return{accountNumber:(t=e.accountNumber)!==null&&t!==void 0?t:"",requestType:(i=e.requestType)!==null&&i!==void 0?i:"",category:(s=e.category)!==null&&s!==void 0?s:"",subject:(n=e.subject)!==null&&n!==void 0?n:"",description:e.description,expectedStart:Xm(e),customerReference:e.referenceNumber,locations:!((o=e.location)===null||o===void 0)&&o.id?[e.location.id]:[],referenceTicket:e.referenceTicketNumber,otherNotificationRecipients:e.contacts}},ep=e=>({customerReference:e.referenceNumber,otherNotificationRecipients:e.contacts}),Ln=async e=>{var t,i,s,n,o;if(!e)return;const{startDate:a,startTime:r}=await Fn(e);return{id:e.ticketId,accountName:e.accountName,accountNumber:e.accountNumber,category:e.category,subject:e.subject,shortDescription:e.description,startDate:a,startTime:r,referenceNumber:e.customerReference,contacts:e.otherNotificationRecipients,state:e.status,site:e.site,locations:(i=(t=e.locations)===null||t===void 0?void 0:t.join(", "))!==null&&i!==void 0?i:"",requester:e.createdBy,requestType:e.requestType,referenceTicketNumber:e.referenceTicket,createdAt:(s=e.createdAt)===null||s===void 0?void 0:s.toISOString(),updatedAt:(n=e.updatedAt)===null||n===void 0?void 0:n.toISOString(),cancellationReason:e.cancellationReason,comments:(o=e.comments)===null||o===void 0?void 0:o.map(d=>M(d)),serviceBackend:await Y.getServiceBackend(e.accountNumber,e.site,"Remote_hands"),ticketStatus:e.status||""}},tp=async e=>{var t,i,s,n;if(!e)return;const{startDate:o,startTime:a,startDateTime:r}=await Fn(e);return{id:e.ticketId||"",accountName:e.accountName,accountNumber:e.accountNumber||"",category:e.category,subject:e.subject,description:e.description,shortDescription:(i=(t=e.description)===null||t===void 0?void 0:t.split("-")[0])===null||i===void 0?void 0:i.trim(),startDate:o,startTime:a,startDateTime:r,referenceNumber:e.customerReference,contacts:e.otherNotificationRecipients,state:e.status,site:{id:e.site},location:{id:e.locations[0],accountNumber:e.accountNumber},requester:e.createdBy,requestType:e.requestType,referenceTicketNumber:e.referenceTicket,createdOn:(s=e.createdAt)===null||s===void 0?void 0:s.toISOString(),updatedOn:(n=e.updatedAt)===null||n===void 0?void 0:n.toISOString(),ticketStatus:e.status||"",serviceBackend:await Y.getServiceBackend(e.accountNumber,e.site,"Remote_hands")}},ip=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}}),Oi=(e,t)=>{if(e===gt)return!0;const i=J.getCouriers(t).map(s=>s.toLowerCase());return!!e&&!(i!=null&&i.includes(e.toLowerCase()))},Vn=e=>e===dn,sp=e=>G().add({days:e}).format(ct),np=(e,t)=>G(t).add({days:e}).format(ct),ap=e=>!!e&&G(e).isBefore(G().add({days:1}),"day"),op=e=>!!e&&G(e).isBefore(G(),"day"),rp=e=>{var t,i,s,n,o,a;const r=(t=Oi(e.courier,e.serviceBackend)?e.otherCompany:e.courier)!==null&&t!==void 0?t:"";return{accountNumber:(i=e.site)===null||i===void 0?void 0:i.accountNumber,subject:(s=e.subject)!==null&&s!==void 0?s:"",description:e.shortDescription,customerReference:e.referenceNumber,removalParty:(n=e.removalParty)!==null&&n!==void 0?n:"",courierCompany:r,trackingNumber:e.trackingNumber,pickupDate:Z(e.pickupDate),site:(a=(o=e.site)===null||o===void 0?void 0:o.id)!==null&&a!==void 0?a:"",otherNotificationRecipients:e.contacts}},cp=e=>{var t;const i=(t=Oi(e.courier,e.serviceBackend)?e.otherCompany:e.courier)!==null&&t!==void 0?t:"";return{subject:e.subject,description:e.shortDescription,customerReference:e.referenceNumber,courierCompany:i,trackingNumber:e.trackingNumber,pickupDate:Z(e.pickupDate),otherNotificationRecipients:e.contacts}},Un=async(e,t,i,s)=>{await J.fillCouriers(t,i,s);const n=J.getCouriers(s).find(a=>a.toLowerCase()===(e==null?void 0:e.toLowerCase())),o=!!n;return{courier:o?n:gt,otherCompany:o?"":e}},Hn=e=>e===Ql?dn:e;async function dp(e){if(!e)return;const t=await Y.getServiceBackend(e.accountNumber,e.site,"Removals"),{courier:i,otherCompany:s}=await Un(e.courierCompany,e.site,e.accountNumber,t),n=Hn(e.removalParty),o=J.sites.find(a=>a.id===e.site).locationId;return{id:e.id,accountNumber:e.accountNumber,site:new Oe(o,e.site,e.accountNumber),subject:e.subject,shortDescription:e.description,courier:i,otherCompany:s,removalParty:n,trackingNumber:e.trackingNumber,pickupDate:e.pickupDate,referenceNumber:e.customerReference,contacts:e.otherNotificationRecipients,status:e.status,isValid:!0,serviceBackend:await Y.getServiceBackend(e.accountNumber,e.site,"Removals")}}const up=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}}),zn=async e=>{var t,i,s;if(!e)return;const n=await Y.getServiceBackend(e.accountNumber,e.site,"Removals"),{courier:o,otherCompany:a}=await Un(e.courierCompany,e.site,e.accountNumber,n),r=Hn(e.removalParty);return{id:e.id,accountName:e.accountName,accountNumber:e.accountNumber,status:e.status,subject:e.subject,shortDescription:e.description,referenceNumber:e.customerReference,removalParty:r,needRemoteHands:Vn(r),courier:o,otherCompany:a,trackingNumber:e.trackingNumber,pickupDate:e.pickupDate,site:e.site,serviceBackend:n,contacts:e.otherNotificationRecipients,requester:e.createdBy,createdOn:(t=e.createdAt)===null||t===void 0?void 0:t.toISOString(),updatedOn:(i=e.updatedAt)===null||i===void 0?void 0:i.toISOString(),cancellationReason:e.cancellationReason,comments:(s=e.comments)===null||s===void 0?void 0:s.map(d=>M(d))}},lp=e=>{var t,i,s,n,o,a,r,d;return{accountNumber:(t=e.accountNumber)!==null&&t!==void 0?t:"",requestType:(i=e.requestType)!==null&&i!==void 0?i:"",category:(s=e.category)!==null&&s!==void 0?s:"",subject:(n=e.subject)!==null&&n!==void 0?n:"",description:(o=e.description)!==null&&o!==void 0?o:"",locations:e.locations,customerReference:(a=e.referenceNumber)!==null&&a!==void 0?a:"",circuitId:(r=e.circuitId)!==null&&r!==void 0?r:"",notificationRecipients:(d=e.contacts)!==null&&d!==void 0?d:""}},mp=e=>{const t={};return e.subject&&(t.subject=e.subject),e.description&&(t.description=e.description),e.circuitId&&(t.circuitId=e.circuitId),e.referenceNumber&&(t.customerReference=e.referenceNumber),e.contacts&&(t.otherNotificationRecipients=e.contacts),t},$i=async e=>{var t,i,s,n;if(e)return{id:e.id,accountName:e.accountName,accountNumber:e.accountNumber,category:e.category,subject:e.subject,description:e.description,referenceNumber:e.customerReference,contacts:e.notificationRecipients,state:e.status,site:{id:e.site,accountNumber:e.accountNumber},locations:e.locations,requester:e.createdBy,requestType:e.requestType,circuitId:e.circuitId,createdOn:(t=e.createdAt)===null||t===void 0?void 0:t.toISOString(),updatedOn:(i=e.updatedAt)===null||i===void 0?void 0:i.toISOString(),closedOn:(s=e.closedAt)===null||s===void 0?void 0:s.toISOString(),comments:(n=e.comments)===null||n===void 0?void 0:n.map(o=>M(o)),cancellationReason:e.cancellationReason,serviceBackend:await Y.getServiceBackend(e.accountNumber,e.site,"Trouble_tickets")}},pp=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}});async function Pt(e,t,i,s,n,o){var a;let r;switch(e){case y.CustomerSupport:{r=await l.customerCareApi.createCustomerCareTicketAttachment({ticketId:n,fileName:i,body:t},{headers:{"Content-Type":s,Authorization:l.getAuthorizationToken()}}).catch(d=>{throw m(d,!1),d});break}case y.RemoteHands:{r=await l.remoteHandsApi.createRemoteHandsAttachment({ticketId:n,fileName:i,body:t},{headers:{"Content-Type":s,Authorization:l.getAuthorizationToken()}}).catch(d=>{throw m(d,!1),d});break}case y.Deliveries:{r=await l.deliveriesApi.createAttachment({ticketId:n,fileName:i,body:t},{headers:{"Content-Type":s,Authorization:l.getAuthorizationToken()}}).catch(d=>{throw m(d,!1),d});break}case y.Removals:{r=await l.removalsApi.createRemovalsAttachment({ticketId:n,fileName:i,body:t},{headers:{"Content-Type":s,Authorization:l.getAuthorizationToken()}}).catch(d=>{throw m(d,!1),d});break}case y.FacilityAccess:{switch(o){case"Visitor Access":r=await l.facilityAccessApi.visitorAccess.createVisitorAccessAttachment({ticketId:n,fileName:i,body:t},{headers:{"Content-Type":s,Authorization:l.getAuthorizationToken()}}).catch(d=>{throw m(d,!1),d});break;case"Permanent Badge":r=await((a=l.facilityAccessApi.permanentBadgeAccess)===null||a===void 0?void 0:a.createPermanentBadegeAttachment({ticketId:n,fileName:i,body:t},{headers:{"Content-Type":s,Authorization:l.getAuthorizationToken()}}).catch(d=>{throw m(d,!1),d}));break;case"OSP Access":r=await l.facilityAccessApi.ospAccess.createOspAccessAttachment({ticketId:n,fileName:i,body:t},{headers:{"Content-Type":s,Authorization:l.getAuthorizationToken()}}).catch(d=>{throw m(d,!1),d});break;case"PoP/POE Access":r=await l.facilityAccessApi.popAccess.createPopAccessAttachment({ticketId:n,fileName:i,body:t},{headers:{"Content-Type":s,Authorization:l.getAuthorizationToken()}}).catch(d=>{throw m(d,!1),d});break}break}case y.TroubleTickets:{r=await l.troubleTicketsApi.createTroubleTicketAttachment({ticketId:n,fileName:i,body:t},{headers:{"Content-Type":s,Authorization:l.getAuthorizationToken()}}).catch(d=>{throw m(d,!1),d});break}default:return}return r}const xe=e=>{const t=URL.createObjectURL(e);window.open(t),setTimeout(()=>URL.revokeObjectURL(t),1e3*60*5)};async function hp(e,t,i,s){var n;let o;try{switch(e){case y.CustomerSupport:{o=await l.customerCareApi.getCustomerCareTicketAttachmentsById({ticketId:i,attachmentId:t!=null?t:""}),xe(o);break}case y.RemoteHands:{o=await l.remoteHandsApi.getRemoteHandsAttachmentsById({ticketId:i,attachmentId:t!=null?t:""}),xe(o);break}case y.Deliveries:{o=await l.deliveriesApi.getDeliveryAttachmentsById({ticketId:i,attachmentId:t!=null?t:""}),xe(o);break}case y.Removals:{o=await l.removalsApi.getRemovalsAttachmentsById({ticketId:i,attachmentId:t!=null?t:""}),xe(o);break}case y.TroubleTickets:{o=await l.troubleTicketsApi.getTroubleTicketAttachmentsById({ticketId:i,attachmentId:t!=null?t:""}),xe(o);break}case y.FacilityAccess:{switch(s){case"Visitor Access":o=await l.facilityAccessApi.visitorAccess.getVisitorAccessAttachmentsById({ticketId:i,attachmentId:t}),xe(o);break;case"Permanent Badge":o=await((n=l.facilityAccessApi.permanentBadgeAccess)===null||n===void 0?void 0:n.getPermanentBadgeAttachmentsById({ticketId:i,attachmentId:t})),xe(o);break;case"OSP Access":o=await l.facilityAccessApi.ospAccess.getOspAccessAttachmentsById({ticketId:i,attachmentId:t}),xe(o);break;case"PoP/POE Access":o=await l.facilityAccessApi.popAccess.getPopAccessAttachmentsById({ticketId:i,attachmentId:t}),xe(o);break;default:break}break}default:return}}catch(a){console.error("error",a),m(a,!1)}return o}const Fe=(e,t)=>{const i=URL.createObjectURL(e),s=document.createElement("a");s.href=i,s.download=t,document.body.appendChild(s),s.click(),URL.revokeObjectURL(i)};async function vp(e,t,i,s,n){var o;let a;try{switch(e){case y.CustomerSupport:{a=await l.customerCareApi.getCustomerCareTicketAttachmentsById({ticketId:s,attachmentId:t!=null?t:""}),Fe(a,i);break}case y.RemoteHands:{a=await l.remoteHandsApi.getRemoteHandsAttachmentsById({ticketId:s,attachmentId:t!=null?t:""}),Fe(a,i);break}case y.Deliveries:{a=await l.deliveriesApi.getDeliveryAttachmentsById({ticketId:s,attachmentId:t!=null?t:""}),Fe(a,i);break}case y.Removals:{a=await l.removalsApi.getRemovalsAttachmentsById({ticketId:s,attachmentId:t!=null?t:""}),Fe(a,i);break}case y.TroubleTickets:{a=await l.troubleTicketsApi.getTroubleTicketAttachmentsById({ticketId:s,attachmentId:t!=null?t:""}),Fe(a,i);break}case y.FacilityAccess:{switch(n){case"Visitor Access":a=await l.facilityAccessApi.visitorAccess.getVisitorAccessAttachmentsById({ticketId:s,attachmentId:t}),Fe(a,i);break;case"Permanent Badge":a=await((o=l.facilityAccessApi.permanentBadgeAccess)===null||o===void 0?void 0:o.getPermanentBadgeAttachmentsById({ticketId:s,attachmentId:t})),Fe(a,i);break;case"OSP Access":a=await l.facilityAccessApi.ospAccess.getOspAccessAttachmentsById({ticketId:s,attachmentId:t}),Fe(a,i);break;case"PoP/POE Access":a=await l.facilityAccessApi.popAccess.getPopAccessAttachmentsById({ticketId:s,attachmentId:t}),Fe(a,i);break;default:break}break}default:return}}catch(r){console.error("error",r),m(r,!1)}return a}async function jn(e,t,i){var s,n;try{let o;switch(e){case y.CustomerSupport:{o=await l.customerCareApi.getCustomerCareTicketAttachmentsList({ticketId:t});break}case y.RemoteHands:{o=await l.remoteHandsApi.getRemoteHandsAttachmentsList({ticketId:t});break}case y.Deliveries:{o=await l.deliveriesApi.getDeliveryAttachmentsList({ticketId:t});break}case y.Removals:{o=await l.removalsApi.getRemovalsAttachmentsList({ticketId:t});break}case y.TroubleTickets:{o=await l.troubleTicketsApi.getTroubleTicketAttachmentsList({ticketId:t});break}case y.FacilityAccess:{switch(i){case"Visitor Access":o=await l.facilityAccessApi.visitorAccess.getVisitorAccessAttachmentsList({ticketId:t});break;case"Permanent Badge":o=await((s=l.facilityAccessApi.permanentBadgeAccess)===null||s===void 0?void 0:s.getPermanentBadgeAttachmentsList({ticketId:t}));break;case"OSP Access":o=await l.facilityAccessApi.ospAccess.getOspAccessAttachmentsList({ticketId:t});break;case"PoP/POE Access":o=await l.facilityAccessApi.popAccess.getPopAccessAttachmentsList({ticketId:t});break;default:break}break}default:return}return k.attachments=(n=o==null?void 0:o.attachments)!==null&&n!==void 0?n:[],k.attachments}catch(o){console.error("error",o),await m(o,!1);return}}const qt=async(e,t,i="text/csv")=>{const s=new Blob([await e.arrayBuffer()],{type:i}),n=URL.createObjectURL(s),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),URL.revokeObjectURL(n)};async function gp(e,t){try{const i=await l.serviceTicketApi.downloadServiceTickets({$filter:e,permissionPrivilege:t});await qt(i,"service-tickets.csv")}catch(i){m(i,!1)}}async function wp(e,t,i,s){try{const n=await l.plannedMaintenanceApi.downloadPlannedMaintenanceTickets({$filter:e,$orderby:t,$skip:i,$top:s});await qt(n,"planned-maintenance-tickets.csv")}catch(n){m(n,!1)}}async function fp(e,t,i){try{const s=await l.plannedMaintenanceApi.getPlannedMaintenanceAttachmentsByIdRaw({ticketId:e,attachmentId:t}),n=s.raw.headers.get("content-type")||void 0,o=await s.value();await qt(o,i,n)}catch(s){m(s,!1)}}async function kp(e,t,i,s){try{const n=await l.incidentsApi.downloadIncidentTickets({$filter:e,$orderby:t,$skip:i,$top:s});await qt(n,"incident-tickets.csv")}catch(n){m(n,!1)}}async function yp(e,t,i){try{const s=await l.incidentsApi.getIncidentsAttachmentsByIdRaw({ticketId:e,attachmentId:t}),n=s.raw.headers.get("content-type")||void 0,o=await s.value();await qt(o,i,n)}catch(s){m(s,!1)}}const Le={ticketType:void 0,ticketStep:void 0,serviceTickets:void 0,permissions:{hasCustomerCareCreatePermission:!1,hasFacilityAccessCreatePermission:!1,hasRemoteHandsCreatePermission:!1,hasDeliveriesAndRemovalsCreatePermission:!1,hasTroubleTicketsCreatePermission:!1},loadings:{ticketCreatePermissionChecks:!0,serviceTicketList:!0,attachments:!0,downloadServiceTicketList:!1,serviceTicket:!1,isTicketCancelling:!1},attachments:[],failedAttachments:[],error:{uploadingAttachments:!1,serviceTicketsGrid:!1,fetchingTicket:!1,cancellingTicket:!1},hasPendingApprovalDialogBeenShown:!1};class Tp{constructor(){this.ticketType=void 0,this.ticketStep=void 0,this.serviceTickets=void 0,this.permissions=Le.permissions,this.loadings=Le.loadings,this.attachments=Le.attachments,this.failedAttachments=Le.failedAttachments,this.error=Le.error,this.hasPendingApprovalDialogBeenShown=Le.hasPendingApprovalDialogBeenShown,ne(this)}updateTicketType(t=void 0){this.ticketType=t}clear(){this.ticketType=void 0,this.ticketStep=void 0,this.error=Le.error,this.loadings=Le.loadings,this.failedAttachments=Le.failedAttachments}setPendingApprovalDialogShown(t){this.hasPendingApprovalDialogBeenShown=t}async checkPermissions(){this.loadings.ticketCreatePermissionChecks=!0,this.permissions.hasCustomerCareCreatePermission=await gn(),this.permissions.hasFacilityAccessCreatePermission=await Tn(),this.permissions.hasRemoteHandsCreatePermission=await bn(),this.permissions.hasDeliveriesAndRemovalsCreatePermission=await Pi(),this.permissions.hasTroubleTicketsCreatePermission=await Rn(),this.loadings.ticketCreatePermissionChecks=!1}async postAttachments(t,i,s,n,o){i&&i.length>0&&(this.error.uploadingAttachments=!1,this.failedAttachments=i.map(a=>a.fileName),await Promise.all(i.map(async a=>{try{const r=await Pt(t,a.file,a.fileName,a.fileType,s,o);n&&r!=null&&r.id&&(this.attachments.push(r),this.failedAttachments=this.failedAttachments.filter(d=>d!==a.fileName))}catch(r){await m(r,!1),this.error.uploadingAttachments=!0}})))}async GetServiceTicketList(t,i,s,n,o,a){var r,d;this.loadings.serviceTicketList=!0,this.error.serviceTicketsGrid=!1;try{this.serviceTickets=await l.serviceTicketApi.getServiceTickets({$filter:t,$orderby:i,$skip:s,$top:n,permissionPrivilege:o},a)}catch(u){if(!((r=a==null?void 0:a.signal)===null||r===void 0)&&r.aborted)return;m(u,!1),this.serviceTickets=void 0,this.error.serviceTicketsGrid=!0}finally{!((d=a==null?void 0:a.signal)===null||d===void 0)&&d.aborted||(this.loadings.serviceTicketList=!1)}}async downloadServiceTickets(t,i){this.loadings.downloadServiceTicketList=!0,await gp(t,i),this.loadings.downloadServiceTicketList=!1}get ticketAttachments(){return this.attachments.filter(t=>!t.isError).map(t=>({name:t.fileName}))}}const k=new Tp,ye={newTicket:{isValid:!1,accountNumber:"",attachments:[]},selectedTicket:void 0,submissionResult:{state:w.Default},loadings:{isSubmitting:!1,ticketDetailsPermissionCheck:!1}};class bp{constructor(){this.newTicket=ye.newTicket,this.submissionResult=ye.submissionResult,this.selectedTicket=ye.selectedTicket,this.loadings=ye.loadings,ne(this),Je(this,{name:"removals",properties:[],storage:window.localStorage})}createTicket(){var t,i,s;this.newTicket={...ye.newTicket,site:(t=this.newTicket.site)!==null&&t!==void 0?t:void 0,serviceBackend:(i=this.newTicket.serviceBackend)!==null&&i!==void 0?i:void 0,accountNumber:(s=this.newTicket.accountNumber)!==null&&s!==void 0?s:"NOT FOUND"},this.submissionResult=ye.submissionResult}updateIsFormValid(t){this.newTicket.isValid=t}updateSite(t){this.newTicket.site=t}updateSubject(t){this.newTicket.subject=t}updateShortDesc(t){this.newTicket.shortDescription=t}updateCourier(t){this.newTicket.courier=t}updateOtherCompany(t){this.newTicket.otherCompany=t}updateTrackingNumber(t){this.newTicket.trackingNumber=t}updatePickupDate(t){this.newTicket.pickupDate=t}updateReferenceNumber(t){this.newTicket.referenceNumber=t}updateRemovalParty(t){this.newTicket.removalParty=t}updateContacts(t){this.newTicket.contacts=t}updateAttachments(t){var i;this.newTicket.attachments=[...(i=this.newTicket.attachments)!==null&&i!==void 0?i:[],...t]}async submitNewTicketRequest(){var t;this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.result=void 0;try{this.submissionResult.result=await l.removalsApi.createRemoval({removalTicketsRequest:rp(this.newTicket)})}catch(i){throw this.loadings.isSubmitting=!1,this.submissionResult.state=w.Error,await m(i,!1),i}try{!((t=this.submissionResult.result)===null||t===void 0)&&t.id&&(await k.postAttachments(y.Removals,this.newTicket.attachments,this.submissionResult.result.id),this.newTicket.attachments=void 0)}catch(i){throw await m(i,!1),i}finally{this.loadings.isSubmitting=!1}}async hasTicketPermissionAtLocation(t,i,s,n){try{return this.loadings.ticketDetailsPermissionCheck=!0,await Nt(t,i,s,n)}finally{this.loadings.ticketDetailsPermissionCheck=!1}}async setNewTicket(){try{this.newTicket=await dp(this.submissionResult.result)||ye.newTicket}catch(t){throw await m(t,!1),t}}async getRemovalsServiceTicket(t){if(t)try{const i=await l.removalsApi.getRemovalById({ticketId:t});this.submissionResult.result=i,this.selectedTicket=await zn(i),await this.setNewTicket()}catch(i){throw await m(i,!1),i}}async editTicketRequest(){let t;try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting;try{t=await l.removalsApi.updateRemovalById({ticketId:this.newTicket.id||"",removalsTicketsUpdateRequest:cp(this.newTicket)}),this.submissionResult.result=t,this.submissionResult.state=w.Submitted}catch(i){this.submissionResult.state=w.Error,await m(i,!1)}try{await k.postAttachments(y.Removals,this.newTicket.attachments,this.newTicket.id,!0),this.newTicket.attachments=void 0}catch(i){await m(i,!1)}try{t&&(this.selectedTicket=await zn(t),await this.setNewTicket())}catch(i){throw await m(i,!1),i}}finally{this.loadings.isSubmitting=!1}}async cancelTicket(t){var i,s;try{if(k.loadings.isTicketCancelling=!0,!((i=this.selectedTicket)===null||i===void 0)&&i.id){const n=(s=this.selectedTicket)===null||s===void 0?void 0:s.id;await l.removalsApi.cancellationRemovalRequest({ticketId:n,cancellationTicketsRequest:{cancellationReason:t}}),await this.getRemovalsServiceTicket(n)}}catch(n){throw await m(n,!1),n}finally{k.loadings.isTicketCancelling=!1}}clear(){this.newTicket=ye.newTicket,this.selectedTicket=ye.selectedTicket,this.submissionResult=ye.submissionResult,this.loadings=ye.loadings}}const Ve=new bp,Te={newTicket:{isValid:!1,isLoadingBayRequired:!1,needRemoteHands:!1,accountNumber:"",contacts:"",attachments:[]},selectedTicket:void 0,submissionResult:{state:w.Default,result:void 0},loadings:{isSubmitting:!1,isDeliveryBlocked:!1,ticketDetailsPermissionCheck:!1}};class Rp{constructor(){this.newTicket=Te.newTicket,this.submissionResult=Te.submissionResult,this.selectedTicket=Te.selectedTicket,this.loadings=Te.loadings,ne(this),Je(this,{name:"deliveries",properties:[],storage:window.localStorage})}createTicket(){var t,i,s;this.newTicket={...Te.newTicket,site:(t=this.newTicket.site)!==null&&t!==void 0?t:void 0,serviceBackend:(i=this.newTicket.serviceBackend)!==null&&i!==void 0?i:void 0,accountNumber:(s=this.newTicket.accountNumber)!==null&&s!==void 0?s:"NOT FOUND"},this.submissionResult=Te.submissionResult}addPackage(t,i){var s;if(!t)return;const n=(s=this.newTicket.packages)!==null&&s!==void 0?s:[];i?this.newTicket.packages=n.map(o=>o.id===t.id?t:o):this.newTicket.packages=[...n,t]}removePackage(t){var i;if(t){const s=((i=this.newTicket.packages)!==null&&i!==void 0?i:[]).filter(n=>n.id!==t.id);this.newTicket.packages=[...s]}}updateSite(t){this.newTicket.site=t,this.newTicket.packages=[]}updateSubject(t){this.newTicket.subject=t}updateShortDesc(t){this.newTicket.shortDescription=t}updateEstimatedDate(t){this.newTicket.estimatedDate=t}updateLatestDate(t){this.newTicket.latestDate=t}updateReferenceNumber(t){this.newTicket.referenceNumber=t}updateLoadingBay(t){this.newTicket.isLoadingBayRequired=t}updateNeedRemoteHands(t){this.newTicket.needRemoteHands=t}updateInstructions(t){this.newTicket.instructions=t}updateContacts(t){this.newTicket.contacts=t}updateAttachments(t){var i;this.newTicket.attachments=[...(i=this.newTicket.attachments)!==null&&i!==void 0?i:[],...t]}updateTermsAgreed(t){this.newTicket.termsAgreed=t}updateIsValid(t){this.newTicket.isValid=t}async submitNewTicketRequest(){var t;this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting;try{this.submissionResult.result=await l.deliveriesApi.createDelivery({deliveryTicketsRequest:Bn(this.newTicket)}),this.submissionResult.state=w.Submitted}catch(i){throw this.loadings.isSubmitting=!1,this.submissionResult.state=w.Error,await m(i,!1),i}try{!((t=this.submissionResult.result)===null||t===void 0)&&t.id&&await k.postAttachments(y.Deliveries,this.newTicket.attachments,this.submissionResult.result.id),this.newTicket.attachments=void 0}catch(i){throw await m(i,!1),i}finally{this.loadings.isSubmitting=!1}}async setNewTicket(){try{this.newTicket=await Km(this.submissionResult.result)||Te.newTicket}catch(t){throw await m(t,!1),t}}async updateTicketRequest(){var t,i;let s;try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting;try{s=await l.deliveriesApi.updateDeliveriesTickets({ticketId:((t=this.selectedTicket)===null||t===void 0?void 0:t.id)||"",deliveryTicketsUpdateRequest:Bn(this.newTicket,!0)});const n=((i=this.newTicket)===null||i===void 0?void 0:i.packages)||[],o=(await Promise.all(n.map(async a=>{var r;return l.deliveriesApi.updateDeliveriesTicketsPackages({ticketId:((r=this.selectedTicket)===null||r===void 0?void 0:r.id)||"",packageId:(a==null?void 0:a.id)||"",deliveryTicketUpdatePackagesRequest:Dn(a,this.newTicket.serviceBackend)}).then(d=>{var u,p;return(p=(u=d.packages)===null||u===void 0?void 0:u.find(A=>A.id===a.id))!==null&&p!==void 0?p:null}).catch(d=>(m(d,!1),null))}))).filter(a=>a!==null);s&&(s.packages=s.packages.map(a=>{const r=o.find(d=>a.id===d.id);return r!=null?r:a})),this.submissionResult.result=s,this.submissionResult.state=w.Submitted}catch(n){throw this.submissionResult.state=w.Error,await m(n,!1),n}try{await k.postAttachments(y.Deliveries,this.newTicket.attachments,this.newTicket.id,!0),this.newTicket.attachments=void 0}catch(n){await m(n,!1)}try{this.selectedTicket=await En(s),await this.setNewTicket()}catch(n){await m(n,!1)}}finally{this.loadings.isSubmitting=!1}}async hasTicketPermissionAtLocation(t,i,s,n){this.loadings.ticketDetailsPermissionCheck=!0;const o=await Nt(t,i,s,n);return this.loadings.ticketDetailsPermissionCheck=!1,o}async getDeliveriesServiceTicket(t){if(t)try{const i=await l.deliveriesApi.getDeliveryById({ticketId:t});this.submissionResult.result=i,this.selectedTicket=await En(i),await this.setNewTicket()}catch(i){throw await m(i,!1),i}}async cancelDelivery(t,i){try{k.loadings.isTicketCancelling=!0,t&&(await l.deliveriesApi.cancellationDeliveryRequest({ticketId:t,cancellationTicketsRequest:{cancellationReason:i}}),await this.getDeliveriesServiceTicket(t))}catch(s){throw await m(s,!1),s}finally{k.loadings.isTicketCancelling=!1}}async isDeliveryBlocked(t,i){var s;let n;return this.loadings.isDeliveryBlocked=!0,t&&i&&(n=await l.deliveriesApi.getDeliveryDiscovery({site:t,accountNumber:i}).catch(o=>{m(o,!1)})),this.loadings.isDeliveryBlocked=!1,(s=n==null?void 0:n.deliveryBlocked)!==null&&s!==void 0?s:!0}clear(){this.newTicket=Te.newTicket,this.selectedTicket=Te.selectedTicket,this.submissionResult=Te.submissionResult,this.loadings=Te.loadings}}const be=new Rp,Re={newTicket:{isValid:!1,accountNumber:"",disableReferenceTicketNumber:!1,attachments:[]},selectedTicket:void 0,submissionResult:{state:w.Default},loadings:{isSubmitting:!1,ticketDetailsPermissionCheck:!1,requestType:!1}};class Ap{constructor(){this.newTicket=Re.newTicket,this.submissionResult=Re.submissionResult,this.selectedTicket=Re.selectedTicket,this.loadings=Re.loadings,ne(this),Je(this,{name:"remote-hands",properties:[],storage:window.localStorage})}createTicket(t){var i,s,n,o;const a=(i=this.newTicket.accountNumber)!==null&&i!==void 0?i:oe.getUserAccount().accountNumber;this.newTicket={...Re.newTicket,site:(s=this.newTicket.site)!==null&&s!==void 0?s:void 0,accountNumber:a!=null?a:"NOT FOUND",serviceBackend:t,referenceTicketNumber:(n=this.newTicket.referenceTicketNumber)!==null&&n!==void 0?n:void 0,disableReferenceTicketNumber:(o=this.newTicket.disableReferenceTicketNumber)!==null&&o!==void 0?o:void 0},this.submissionResult=Re.submissionResult}updateSite(t,i=!1){this.newTicket.site=t,this.newTicket.isValid=i}updateLocation(t){this.newTicket.location=t}updateSubject(t){this.newTicket.subject=t}updateDescription(t){this.newTicket.description=t}updateRequestType(t){this.newTicket.requestType=t,this.newTicket.category=void 0}updateCategory(t){this.newTicket.category=t}updateReferenceNumber(t){this.newTicket.referenceNumber=t}updateReferenceTicketNumber(t){this.newTicket.referenceTicketNumber=t}updateReferenceNumberDisable(t){this.newTicket.referenceTicketNumber=t,this.newTicket.disableReferenceTicketNumber=!0}updateStartDate(t){this.newTicket.startDate=t}updateStartTime(t){this.newTicket.startTime=t}updateContacts(t){this.newTicket.contacts=t}updateAccountNumber(t){this.newTicket.accountNumber=t}updateFormValidation(t){this.newTicket.isValid=t}updateAttachments(t){var i;this.newTicket.attachments=[...(i=this.newTicket.attachments)!==null&&i!==void 0?i:[],...t]}updateTermsAgreed(t){this.newTicket.termsAgreed=t}async setNewTicket(){try{this.newTicket=await tp(this.submissionResult.result)||Re.newTicket}catch(t){throw await m(t,!1),t}}async updateTicketRequest(){var t;let i;try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting;try{i=await l.remoteHandsApi.updateRemoteHandsTicketById({ticketId:((t=this.selectedTicket)===null||t===void 0?void 0:t.id)||"",remoteHandsUpdateRequest:ep(this.newTicket)}),this.submissionResult.result=i,this.submissionResult.state=w.Submitted}catch(s){this.submissionResult.state=w.Error,await m(s,!1)}try{await k.postAttachments(y.RemoteHands,this.newTicket.attachments,this.newTicket.id,!0),this.newTicket.attachments=void 0}catch(s){await m(s,!1)}try{i&&(this.selectedTicket=await Ln(i))}catch(s){await m(s,!1)}}catch(s){throw await m(s,!1),s}finally{this.loadings.isSubmitting=!1}}async submitNewTicketRequest(){var t;this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting;try{this.submissionResult.result=await l.remoteHandsApi.createRemoteHandsTicket({remoteHandsRequest:Qm(this.newTicket)}),this.submissionResult.state=w.Submitted}catch(i){throw this.loadings.isSubmitting=!1,this.submissionResult.state=w.Error,await m(i,!1),i}try{!((t=this.submissionResult.result)===null||t===void 0)&&t.ticketId&&(await k.postAttachments(y.RemoteHands,this.newTicket.attachments,this.submissionResult.result.ticketId),this.newTicket.attachments=void 0)}catch(i){throw await m(i,!1),i}finally{this.loadings.isSubmitting=!1}}async getRemoteHandsServiceTicket(t){if(t)try{const i=await l.remoteHandsApi.getRemoteHandsTicketById({ticketId:t});this.submissionResult.result=i,this.selectedTicket=await Ln(i),await this.setNewTicket()}catch(i){throw await m(i,!1),i}}async cancelTicket(t){var i;try{k.loadings.isTicketCancelling=!0,!((i=this.selectedTicket)===null||i===void 0)&&i.id&&(await l.remoteHandsApi.cancellationRemoteHandsRequest({ticketId:this.selectedTicket.id,cancellationTicketsRequest:{cancellationReason:t}}),await this.getRemoteHandsServiceTicket(this.selectedTicket.id))}catch(s){throw await m(s,!1),s}finally{k.loadings.isTicketCancelling=!1}}clear(){this.newTicket=Re.newTicket,this.selectedTicket=Re.selectedTicket,this.submissionResult=Re.submissionResult,this.loadings=Re.loadings}}const ce=new Ap,_p=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}}),Ae={newTicket:{isValid:!1,accountNumber:"",attachments:[],locations:[]},selectedTicket:void 0,submissionResult:{state:w.Default},loadings:{isSubmitting:!1}};class Sp{constructor(){this.newTicket=Ae.newTicket,this.submissionResult=Ae.submissionResult,this.selectedTicket=Ae.selectedTicket,this.loadings=Ae.loadings,ne(this),Je(this,{name:"trouble-tickets",properties:[],storage:window.localStorage})}getIsInProgress(){var t;return((t=this.selectedTicket)===null||t===void 0?void 0:t.state)===O.InProgress}createTicket(t){var i,s;const{accountNumber:n}=oe.getUserAccount();this.newTicket={...Ae.newTicket,site:(i=this.newTicket.site)!==null&&i!==void 0?i:void 0,accountNumber:n!=null?n:"NOT FOUND",referenceTicketNumber:t,serviceBackend:(s=this.newTicket.serviceBackend)!==null&&s!==void 0?s:void 0},this.submissionResult=Ae.submissionResult}updateSite(t,i=!1){this.newTicket.site=t,this.newTicket.isValid=i}updateLocations(t,i){var s,n,o;if(i)(o=this.newTicket.locations)===null||o===void 0||o.push(t);else{const a=(s=this.newTicket.locations)===null||s===void 0?void 0:s.indexOf(t);a!==void 0&&a!==-1&&((n=this.newTicket.locations)===null||n===void 0||n.splice(a,1))}}clearLocations(){this.newTicket.locations=[]}updateSubject(t){this.newTicket.subject=t}updateDescription(t){this.newTicket.description=t}updateRequestType(t){this.newTicket.requestType=t,this.newTicket.category=void 0}updateCategory(t){this.newTicket.category=t}updateReferenceNumber(t){this.newTicket.referenceNumber=t}updateReferenceTicketNumber(t){this.newTicket.referenceTicketNumber=t}updateReferenceNumberDisable(t){this.newTicket.referenceTicketNumber=t}updateCircuitId(t){this.newTicket.circuitId=t}updateContacts(t){this.newTicket.contacts=t}updateAccountNumber(t){this.newTicket.accountNumber=t}updateFormValidation(t){this.newTicket.isValid=t}updateTermsAgreed(t){this.newTicket.termsAgreed=t}updateAttachments(t){var i;this.newTicket.attachments=[...(i=this.newTicket.attachments)!==null&&i!==void 0?i:[],...t]}async submitNewTicketRequest(){var t,i;this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.result=void 0;try{this.submissionResult.result=await l.troubleTicketsApi.createTroubleTicketTicket({troubleTicketRequest:lp(this.newTicket)}),this.submissionResult.state=w.Submitted}catch(s){throw this.loadings.isSubmitting=!1,this.submissionResult.state=w.Error,await m(s,!1),s}try{!((i=(t=this.submissionResult)===null||t===void 0?void 0:t.result)===null||i===void 0)&&i.id&&(await k.postAttachments(y.TroubleTickets,this.newTicket.attachments,this.submissionResult.result.id),this.newTicket.attachments=void 0)}catch(s){throw await m(s,!1),s}finally{this.loadings.isSubmitting=!1}}async setNewTicket(){try{this.newTicket=await $i(this.submissionResult.result)||Ae.newTicket}catch(t){throw await m(t,!1),t}}async submitUpdateTicketRequest(){var t,i;if(this.newTicket&&this.selectedTicket&&this.selectedTicket.id){let s;try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting;try{s=await l.troubleTicketsApi.updateTroubleTicketTicket({ticketId:(t=this.selectedTicket.id)!==null&&t!==void 0?t:"",troubleTicketUpdateRequest:mp(this.newTicket)}),this.submissionResult.result=s}catch(n){this.submissionResult.state=w.Error,await m(n,!1)}try{await k.postAttachments(y.TroubleTickets,this.newTicket.attachments,(i=this.selectedTicket)===null||i===void 0?void 0:i.id,!0),this.newTicket.attachments=void 0}catch(n){await m(n,!1)}try{s&&(this.submissionResult.state=w.Submitted,this.submissionResult.result=s,this.selectedTicket=await $i(this.submissionResult.result),await this.setNewTicket())}catch(n){await m(n,!1)}}finally{this.loadings.isSubmitting=!1}}}async getTroubleTicketById(t){if(t)try{const i=await l.troubleTicketsApi.getTroubleTicketTicketById({ticketId:t});this.submissionResult.result=i,this.selectedTicket=await $i(i),await this.setNewTicket()}catch(i){throw await m(i,!1),i}}async cancelTicket(t){var i;try{k.loadings.isTicketCancelling=!0,!((i=this.selectedTicket)===null||i===void 0)&&i.id&&(await l.troubleTicketsApi.cancellationTroubleTicketRequest({ticketId:this.selectedTicket.id,cancellationTicketsRequest:{cancellationReason:t}}),await this.getTroubleTicketById(this.selectedTicket.id))}catch(s){throw await m(s,!1),s}finally{k.loadings.isTicketCancelling=!1}}clear(){this.newTicket=Ae.newTicket,this.selectedTicket=Ae.selectedTicket,this.submissionResult=Ae.submissionResult,this.loadings=Ae.loadings}}const Ue=new Sp,Ip={"Visitor First Name":"visitorFirstName","Visitor Last Name":"visitorLastName","Visitor Email Address":"visitorEmailAddress","Visitor Phone Number":"visitorPhoneNumber"},Mn=40,Ei="bulk_";function mt(e){return e.startsWith("WO")}function Cp(e){return e.startsWith("CS")||e.startsWith("DEL")}function Np(e,t){return e?Jt.Escorted:t==="Standard"?Jt.Standard:Jt.Extended}function Pp(e){return e?e==="Escorted"?{isEscortedVisitor:!0,visitorBadge:void 0}:{isEscortedVisitor:!1,visitorBadge:e==="Standard"?"Standard":"Extended"}:{isEscortedVisitor:void 0,visitorBadge:void 0}}function qp(e){return e.map(t=>{var i;return{siteCode:t.site.siteId,visitorHostId:(i=t.visitorHost)===null||i===void 0?void 0:i.id,locations:t.locations.map(s=>({id:s.id,startDate:Z(s.startDate),endDate:Z(s.endDate)}))}})}const Dp=e=>({otherNotificationRecipients:e.contacts,visitorPhone:e.visitors[0].phone});async function Jn(e,t,i,s,n,o){var a,r;const d=(a=J.sites.find(u=>u.locationId===e))===null||a===void 0?void 0:a.id;return[{site:new Oe(e,d,t),locations:(r=i==null?void 0:i.map(u=>({id:u.id||"-",site:d,startDate:u.startDate||"",endDate:u.endDate||"",status:u.approvalStatus||"-",modifiedBy:u.modifiedBy||"-"})))!==null&&r!==void 0?r:[],isVisitorHostDetailsValid:s,visitorHost:n,serviceBackend:o}]}const Bp=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}}),Op=e=>{var t,i,s,n;return{accountNumber:e.accountNumber,visitors:e.visitors.map(o=>({firstName:o.firstName,lastName:o.lastName,email:o.email,phone:o.phone})),visitStartDate:Z(e.startDate),visitEndDate:Z(e.endDate),visitType:Np((t=e.isEscortedVisitor)!==null&&t!==void 0?t:!1,e.visitorBadge),sites:qp(e.sitesDetails||[]),escortFirstName:e.escortFirstName,escortLastName:e.escortLastName,visitorHostFirstName:(i=e.hostFirstName)!==null&&i!==void 0?i:"",visitorHostLastName:(s=e.hostLastName)!==null&&s!==void 0?s:"",representingCompany:(n=e.representingCompany)!==null&&n!==void 0?n:"",description:e.notes,notificationRecipients:e.contacts}},Wn=async e=>{var t,i,s,n;if(!e)return;const o=mt(e.id)?H.Insite:H.ServiceNow;return{id:e.id,accountNumber:e.accountNumber||"-",accountName:e.accountName||"-",contacts:e.notificationRecipients||"",state:e.status||"-",requester:e.createdBy||"-",createdOn:e.createdAt.toISOString(),updatedOn:e.updatedAt.toISOString(),requestType:"Visitor Access",category:"New Visitor Access",visitors:[{firstName:e.visitorFirstName||"-",lastName:e.visitorLastName||"-",email:e.visitorEmail||"-",phone:e.visitorPhone||"-",id:""}],visitorType:e.visitType||"-",escortFirstName:e.escortFirstName||"-",escortLastName:e.escortLastName||"-",startDate:e.visitStartDate,endDate:e.visitEndDate,representingCompany:e.representingCompany||"-",notes:e.description||"-",site:e.site,cancellationReason:e.cancellationReason,sitesDetails:await Jn((t=e.site)!==null&&t!==void 0?t:"-",(i=e.accountNumber)!==null&&i!==void 0?i:"-",(s=e.locations)!==null&&s!==void 0?s:[],!0,{firstName:e.visitorHostFirstName,lastName:e.visitorHostLastName},o),hostFirstName:e.visitorHostFirstName,hostLastName:e.visitorHostLastName,comments:(n=e.comments)===null||n===void 0?void 0:n.map(a=>M(a))}},$p=async e=>{var t,i,s;if(!e)return;const{isEscortedVisitor:n,visitorBadge:o}=Pp(e.visitType),a=mt(e.id)?H.Insite:H.ServiceNow;return{id:e==null?void 0:e.id,accountNumber:e.accountNumber||"",contacts:e.notificationRecipients||"",requestType:"Visitor Access",category:"New Visitor Access",visitors:[{firstName:e.visitorFirstName||"",lastName:e.visitorLastName||"",email:e.visitorEmail||"",phone:e.visitorPhone||""}],escortFirstName:e.escortFirstName||"",escortLastName:e.escortLastName||"",startDate:e.visitStartDate,endDate:e.visitEndDate,representingCompany:e.representingCompany||"-",notes:e.description||"-",sitesDetails:await Jn((t=e.site)!==null&&t!==void 0?t:"-",(i=e.accountNumber)!==null&&i!==void 0?i:"-",(s=e.locations)!==null&&s!==void 0?s:[],!0,{firstName:e.visitorHostFirstName,lastName:e.visitorHostLastName},a),hostFirstName:e.visitorHostFirstName,hostLastName:e.visitorHostLastName,cancellationReason:e.cancellationReason,visitorBadge:o,isEscortedVisitor:n,isFileAttachedForVisitors:!1,isNotificationsAttachmentsValid:!0,isRequestedAccessDetailsValid:!0,isVisitorContactsDetailsValid:!0,isVisitorEscortedDetailsValid:!0}},Gn=e=>{const{visitorFirstName:t,visitorLastName:i,visitorEmailAddress:s,visitorPhoneNumber:n}=e;if(!t||!i||!s)return"Error: First name, last name and email are required.";const o=!Pn(s),a=n&&n.length>0&&!ga(n);if(o&&a)return"Error: Invalid visitor email address and phone number";if(o)return"Error: Invalid visitor email address";if(a)return"Error: Invalid visitor phone number"};async function Ep(e){const[t,i]=await Promise.all([Ze({locationType:F.Site,permissionType:I.VisitorAccess,permissionPrivilege:e}),Ze({locationType:Ct,permissionType:I.VisitorAccess,permissionPrivilege:e,assignableProcess:"Facilities_access"})]),s=new Set(i.map(n=>n.siteId));return t.sort((n,o)=>n.siteId>o.siteId?1:-1).map(n=>({...n,hasSpaces:s.has(n.siteId)}))}const de={newTicket:{isRequestedAccessDetailsValid:!1,isVisitorContactsDetailsValid:!1,isVisitorEscortedDetailsValid:!1,isNotificationsAttachmentsValid:!1,isRepresentingCompanyValid:!1,accountNumber:void 0,visitors:[],contacts:"",attachments:[],isEscortedVisitor:!1,startDate:void 0,endDate:void 0,sitesDetails:void 0,visitorBadge:"Standard"},selectedTicket:void 0,submissionResult:{state:w.Default,ticketNumbers:[],ticketResponse:void 0},loadings:{isSubmitting:!1,facilityAccessTicket:!1},isEditAttachmentAdded:!1};class xp{constructor(){this.DuplicateEmailErrorMessage="Each visitor must have a unique email address.",this.newTicket=de.newTicket,this.submissionResult=de.submissionResult,this.selectedTicket=de.selectedTicket,this.loadings=de.loadings,this.isEditAttachmentAdded=de.isEditAttachmentAdded,ne(this)}createTicket(){var t,i;const s=(t=this.newTicket.accountNumber)!==null&&t!==void 0?t:oe.getUserAccount().accountNumber;this.newTicket={...de.newTicket,accountNumber:s,requestType:"Visitor Access",category:"New Visitor Access",serviceBackend:(i=this.newTicket.serviceBackend)!==null&&i!==void 0?i:void 0},this.submissionResult=de.submissionResult}isVisitorContactsValid(t){this.newTicket.isVisitorContactsDetailsValid=t}isEscortedDetailsValid(t){this.newTicket.isVisitorEscortedDetailsValid=t}get isVisitorHostDetailsValid(){var t;return((t=this.newTicket.sitesDetails)===null||t===void 0?void 0:t.some(i=>i.isVisitorHostDetailsValid===!1))===!1}isVisitorHostDetailsValidBySite(t,i){var s;const n=(s=this.newTicket.sitesDetails)===null||s===void 0?void 0:s.find(o=>o.site.siteId===t);n&&(n.isVisitorHostDetailsValid=i)}isRequestedAccessDetailsValid(t){this.newTicket.isRequestedAccessDetailsValid=t}isNotificationsAttachmentsValid(t){this.newTicket.isNotificationsAttachmentsValid=t}isRepresentingCompanyValid(t){this.newTicket.isRepresentingCompanyValid=t}updateTermsAgreed(t){this.newTicket.termsAgreed=t}updateAttachments(t){var i;(i=this.newTicket.attachments)===null||i===void 0||i.push(...t)}removeBulkAttachment(){var t;this.newTicket.attachments=(t=this.newTicket.attachments)===null||t===void 0?void 0:t.filter(i=>{var s;return!(!((s=i.fileName)===null||s===void 0)&&s.startsWith(Ei))})}get isNewTicketValid(){return this.newTicket.isVisitorContactsDetailsValid&&this.newTicket.isVisitorEscortedDetailsValid&&this.isVisitorHostDetailsValid&&this.newTicket.isRequestedAccessDetailsValid&&this.newTicket.isRepresentingCompanyValid&&this.newTicket.isNotificationsAttachmentsValid}updateIsEscortedVisitor(t){this.newTicket.isEscortedVisitor=t,t?this.newTicket.visitorBadge=void 0:(this.newTicket.escortFirstName=void 0,this.newTicket.escortLastName=void 0,this.newTicket.visitorBadge===void 0&&(this.newTicket.visitorBadge="Standard"))}updateVisitorHost(t,i){var s;const n=(s=this.newTicket.sitesDetails)===null||s===void 0?void 0:s.find(o=>o.site.siteId===t);n&&(n.visitorHost=i,n.isVisitorHostDetailsValid=!0)}updateEscortFirstName(t){this.newTicket.escortFirstName=t}updateEscortLastName(t){this.newTicket.escortLastName=t}updateIsFileAttachedForVisitors(t){this.newTicket.isFileAttachedForVisitors=t}validateNoDuplicateEmails(t){const i=[...t];i.forEach((n,o)=>{n.validationError===this.DuplicateEmailErrorMessage&&(i[o]={...n,validationError:void 0,isValid:!0})});const s=i.filter(n=>!n.validationError);return i.forEach((n,o)=>{n.validationError||s.filter(a=>a.email.toLowerCase()===n.email.toLowerCase()).length>1&&(i[o]={...n,validationError:this.DuplicateEmailErrorMessage,isValid:!1})}),i}addOrUpdateVisitor(t){var i;if(!t)return;const s=(i=this.newTicket.visitors)!==null&&i!==void 0?i:[],n=s.findIndex(a=>a.id===t.id),o=n!==-1;if(!(!o&&s.length>=Mn))if(this.newTicket.id)this.newTicket.visitors=[t];else{let a;t.isUploadedFromFile&&(a=Gn({visitorFirstName:t.firstName,visitorLastName:t.lastName,visitorEmailAddress:t.email,visitorPhoneNumber:t.phone}));const r={...t,validationError:a,isValid:!a},d=[...s];o?d[n]=r:d.push(r),this.newTicket.visitors=this.validateNoDuplicateEmails(d)}}addBulkVisitors(t){t.forEach(i=>{const s=Gn(i),n={id:crypto.randomUUID(),firstName:i.visitorFirstName,lastName:i.visitorLastName,email:i.visitorEmailAddress,phone:i.visitorPhoneNumber,isUploadedFromFile:!0,validationError:s,isValid:!s};this.addOrUpdateVisitor(n)})}removeBulkVisitors(){var t;const i=((t=this.newTicket.visitors)!==null&&t!==void 0?t:[]).filter(s=>s.isUploadedFromFile!==!0);this.newTicket.visitors=[...i]}removeVisitor(t){var i;if(t){const s=((i=this.newTicket.visitors)!==null&&i!==void 0?i:[]).filter(n=>n.id!==t.id);this.newTicket.visitors=this.validateNoDuplicateEmails(s)}}removeAllVisitors(){this.newTicket.visitors=[]}updateHostFirstName(t){this.newTicket.hostFirstName=t}updateHostLastName(t){this.newTicket.hostLastName=t}updateVisitorBadge(t){this.newTicket.visitorBadge=t}updateStartDate(t){var i;this.newTicket.startDate=t,(i=this.newTicket.sitesDetails)===null||i===void 0||i.forEach(s=>{s.locations.forEach(n=>{n.startDate=t})})}updateEndDate(t){var i;this.newTicket.endDate=t,(i=this.newTicket.sitesDetails)===null||i===void 0||i.forEach(s=>{s.locations.forEach(n=>{n.endDate=t})})}updateRepresentingCompany(t){this.newTicket.representingCompany=t}updateNotes(t){this.newTicket.notes=t}async addSiteLocations(t){var i;if(t){const s=await Y.getServiceBackend(t.site.accountNumber,t.site.siteId,"Facilities_access"),n=((i=this.newTicket.sitesDetails)!==null&&i!==void 0?i:[]).filter(a=>a.site.siteId!==t.site.siteId),o={...t,serviceBackend:s};this.newTicket.sitesDetails=[...n,o]}}removeSiteLocations(t){var i;if(t){const s=((i=this.newTicket.sitesDetails)!==null&&i!==void 0?i:[]).filter(n=>n.site.siteId!==t.site.siteId);this.newTicket.sitesDetails=[...s]}}updateContacts(t){this.newTicket.contacts=t}async submitNewTicketRequest(){var t,i,s,n;let o;this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.ticketNumbers=void 0;try{o=await l.facilityAccessApi.visitorAccess.createVisitorAccessTicket({visitorAccessTicketRequest:Op(this.newTicket)}),this.submissionResult.ticketNumbers=o==null?void 0:o.ticketNumbers}catch(a){throw this.loadings.isSubmitting=!1,this.submissionResult.state=w.Error,await m(a,!1),a}try{if(o){k.failedAttachments=((t=this.newTicket.attachments)!==null&&t!==void 0?t:[]).map(u=>u.fileName);const{ticketNumbers:a}=o,r=(i=a==null?void 0:a.filter(u=>Cp(u)))!==null&&i!==void 0?i:[],d=(s=a==null?void 0:a.filter(u=>mt(u)))!==null&&s!==void 0?s:[];a!=null&&a.length&&!((n=this.newTicket.attachments)===null||n===void 0)&&n.length&&await Promise.all(this.newTicket.attachments.map(async u=>{const p=[];let A=[];u.fileName.startsWith(Ei)?(r.length>0&&A.push(r[0]),d.length>0&&A.push(...d)):A=a,p.push(...A.map(async N=>Pt(y.FacilityAccess,u.file,u.fileName,u.fileType,N,this.newTicket.requestType))),await Promise.all(p).then(()=>{var N;k.failedAttachments=((N=this.newTicket.attachments)!==null&&N!==void 0?N:[]).filter(b=>b.fileName!==u.fileName).map(b=>b.fileName)})})),this.newTicket.attachments=void 0}}catch(a){throw k.error.uploadingAttachments=!0,await m(a,!1),a}finally{this.submissionResult.state=w.Submitted,this.loadings.isSubmitting=!1}}async setNewTicket(){try{this.newTicket=await $p(this.submissionResult.ticketResponse)||de.newTicket}catch(t){throw await m(t,!1),t}}async submitUpdateTicketRequest(){let t;try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.ticketNumbers=void 0;try{t=await l.facilityAccessApi.visitorAccess.updateVisitorAccessTicket({visitorAccessTicketUpdateRequest:Dp(this.newTicket),ticketId:this.newTicket.id}),this.submissionResult.ticketResponse=t,this.submissionResult.state=w.Submitted,this.submissionResult.ticketNumbers=[t.id]}catch(i){this.submissionResult.state=w.Error,await m(i,!1)}try{await k.postAttachments(y.FacilityAccess,this.newTicket.attachments,this.newTicket.id,!0,"Visitor Access"),this.newTicket.attachments=void 0}catch(i){await m(i,!1)}try{t&&(this.selectedTicket=await Wn(t),await this.setNewTicket())}catch(i){await m(i,!1)}}catch(i){throw await m(i,!1),i}finally{this.loadings.isSubmitting=!1}}async getVisitorAccessServiceTicket(t){if(t)try{const i=await l.facilityAccessApi.visitorAccess.getVisitorAccessTicketById({ticketId:t});this.submissionResult.ticketResponse=i,this.selectedTicket=await Wn(i),await this.setNewTicket()}catch(i){throw await m(i,!1),i}}async cancelTicket(t,i){try{k.loadings.isTicketCancelling=!0,k.error.cancellingTicket=!1,t&&(await l.facilityAccessApi.visitorAccess.cancellationVisitorAccessRequest({ticketId:t,cancellationTicketsRequest:{cancellationReason:i}}).catch(s=>{throw m(s,!1),s}),await this.getVisitorAccessServiceTicket(t))}catch(s){throw k.error.cancellingTicket=!0,await m(s,!1),s}finally{k.loadings.isTicketCancelling=!1}}async hasUpdatePermissions(){try{return!!await Ke(this.selectedTicket.sitesDetails[0].locations.map(t=>t.id),I.VisitorAccess,U.Update)}catch(t){return!1}}clearNewTicket(){this.newTicket=de.newTicket}async patchLocationsApprovalStatus(t){var i,s;const n=t.map(o=>({id:o.id,approvalStatus:ls[o.status]}));await l.facilityAccessApi.visitorAccess.updateVisitorAccessLocationsTicket({ticketId:((i=this.selectedTicket)===null||i===void 0?void 0:i.id)||"",locationsPatchRequestInner:n}),await this.getVisitorAccessServiceTicket((s=this.selectedTicket)===null||s===void 0?void 0:s.id)}async getVisitorHosts(t,i,s,n=1,o=10){return await l.facilityAccessApi.visitorHost.getVisitorHostsList({site:t,nameOrEmailContains:i,pageNumber:n,pageSize:o},s).catch(r=>{var d;!((d=s==null?void 0:s.signal)===null||d===void 0)&&d.aborted||m(r,!1)})||{items:[],totalCount:0}}clear(){this.newTicket=de.newTicket,this.selectedTicket=de.selectedTicket,this.submissionResult=de.submissionResult,this.loadings=de.loadings,this.isEditAttachmentAdded=de.isEditAttachmentAdded}}const se=new xp;function Fp(e){return e.flatMap(t=>t.locations).map(t=>({id:t.id,startDate:Z(t.startDate),endDate:Z(t.endDate)}))}function Lp(e){return e.flatMap(t=>t.locations).map(t=>({id:t.id,startDate:Z(t.startDate),endDate:Z(t.endDate),operation:"add"}))}const Vp=e=>{var t;return{accountNumber:(t=e.accountNumber)!==null&&t!==void 0?t:"",badgeholderFirstName:e.badgeHolder.firstName,badgeholderLastName:e.badgeHolder.lastName,badgeholderEmail:e.badgeHolder.email,badgeholderCompany:e.badgeHolder.company,badgeholderPhone:e.badgeHolder.phone,badgeStartDate:Z(e.startDate),badgeEndDate:Z(e.endDate),locations:Fp(e.sitesDetails||[]),notificationRecipients:e.contacts}},Up=e=>({otherNotificationRecipients:e.contacts}),Hp=e=>({otherNotificationRecipients:e.contacts}),zp=()=>({}),jp=e=>{var t;return{accountNumber:(t=e.accountNumber)!==null&&t!==void 0?t:"",badgeholderId:e.badgeHolder.id,badgeStartDate:Z(e.startDate),badgeEndDate:Z(e.endDate),locations:Lp(e.sitesDetails||[]),notificationRecipients:e.contacts}},Mp=e=>({badgeholderId:e.badgeHolder.id,accountNumber:e.badgeHolder.accountNumber,badgeEndDate:Z(e.endDate)});async function Zn(e,t=""){if(!e)return[];const i=e.map(a=>({id:a.id||"-",site:a.site||"",siteAddress:a.siteAddress,startDate:a.startDate||"",endDate:a.endDate||"",status:a.approvalStatus||"-",modifiedBy:a.modifiedBy||"-"})),s=[...new Set(i.map(a=>a.site))],n={};await Promise.all(s.map(async a=>{var r;n[a]=(r=await fm(a))!==null&&r!==void 0?r:a}));const o=[];return i.forEach(a=>{const{site:r}=a,d=o.find(u=>u.site.siteId===r);d?d.locations.push(a):o.push({site:new Oe(n[r],r,t),locations:[a]})}),o}const Kn=async e=>{var t,i,s;if(e)return{id:e==null?void 0:e.id,accountNumber:e.accountNumber||"-",accountName:e.accountName||"-",contacts:e.notificationRecipients||"",state:e.status||"-",requester:e.createdBy||"-",createdOn:(t=e.createdAt)===null||t===void 0?void 0:t.toISOString(),updatedOn:(i=e.updatedAt)===null||i===void 0?void 0:i.toISOString(),requestType:"Permanent Badge",category:e.requestType,visitors:[{firstName:e.badgeholderFirstName||"-",lastName:e.badgeholderLastName||"-",email:e.badgeholderEmail||"-",phone:e.badgeholderPhone,company:e.badgeholderCompany||"-"}],startDate:e.badgeStartDate,endDate:e.badgeEndDate,sitesDetails:await Zn(e.locations,e.accountNumber),cancellationReason:e.cancellationReason,comments:(s=e.comments)===null||s===void 0?void 0:s.map(n=>M(n))}},Jp=async e=>{if(e)return{id:e==null?void 0:e.id,contacts:e.notificationRecipients,requestType:"Permanent Badge",category:e.requestType,visitors:[{firstName:e.badgeholderFirstName||"",lastName:e.badgeholderLastName||"",email:e.badgeholderEmail||"",phone:e.badgeholderPhone||"",company:e.badgeholderCompany||""}],badgeHolder:{firstName:e.badgeholderFirstName||"",lastName:e.badgeholderLastName||"",email:e.badgeholderEmail||"",phone:e.badgeholderPhone||"",company:e.badgeholderCompany||""},startDate:e.badgeStartDate,endDate:e.badgeEndDate,sitesDetails:await Zn(e.locations,e.accountNumber),isNotificationsAttachmentsValid:!0,isRequestedAccessDetailsValid:!0,isVisitorContactsDetailsValid:!0,isEndDateValid:!0,isBadgeholderValid:!0}},Wp=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}}),Yn=e=>e.map(t=>({id:t.id,accountNumber:t.accountNumber,firstName:t.firstName,lastName:t.lastName,email:t.email,phone:t.phone,company:t.representingCompany,startDate:t.badgeStartDate?It(t.badgeStartDate):void 0})),Gp=(e,t)=>[...e,...Yn(t)];async function Zp(e){const[t,i]=await Promise.all([Ze({locationType:F.Site,permissionType:I.PermanentBadge,permissionPrivilege:e}),Ze({locationType:Ct,permissionType:I.PermanentBadge,permissionPrivilege:e,assignableProcess:"Facilities_access"})]),s=new Set(i.map(n=>n.siteId));return t.sort((n,o)=>n.siteId>o.siteId?1:-1).map(n=>({...n,hasSpaces:s.has(n.siteId)}))}const ue={newTicket:{isRequestedAccessDetailsValid:!1,isNotificationsAttachmentsValid:!1,isBadgeholderValid:!1,isStartDateSetViaBadgeHolder:!1,isEndDateValid:!1,accountNumber:void 0,contacts:"",badgeHolder:{},attachments:[],isVisitorContactsDetailsValid:!1,visitors:[]},selectedTicket:void 0,submissionResult:{state:w.Default,ticketNumbers:[],ticketResponse:void 0},loadings:{isSubmitting:!1,facilityAccessTicket:!1},isEditAttachmentAdded:!1};class Kp{constructor(){this.newTicket=ue.newTicket,this.submissionResult=ue.submissionResult,this.selectedTicket=ue.selectedTicket,this.loadings=ue.loadings,this.isEditAttachmentAdded=ue.isEditAttachmentAdded,ne(this)}createTicket(){var t,i,s,n;const o=(t=this.newTicket.accountNumber)!==null&&t!==void 0?t:oe.getUserAccount().accountNumber;this.newTicket={...ue.newTicket,accountNumber:o,requestType:(i=this.newTicket.requestType)!==null&&i!==void 0?i:void 0,category:(s=this.newTicket.category)!==null&&s!==void 0?s:void 0,serviceBackend:(n=this.newTicket.serviceBackend)!==null&&n!==void 0?n:void 0},this.submissionResult=ue.submissionResult}updateStartDateSetViaBadgeholder(t){this.newTicket.isStartDateSetViaBadgeHolder=t}isVisitorContactsValid(t){this.newTicket.isVisitorContactsDetailsValid=t}isRequestedAccessDetailsValid(t){this.newTicket.isRequestedAccessDetailsValid=t}isBadgeholderValid(t){this.newTicket.isBadgeholderValid=t}isNotificationsAttachmentsValid(t){this.newTicket.isNotificationsAttachmentsValid=t}isEndDateValid(t){this.newTicket.isEndDateValid=t}updateTermsAgreed(t){this.newTicket.termsAgreed=t}updateAttachments(t){var i;(i=this.newTicket.attachments)===null||i===void 0||i.push(...t)}removeBulkAttachment(){throw new Error("Method not implemented.")}get isNewTicketValid(){switch(this.newTicket.category){case"New":return this.newTicket.isVisitorContactsDetailsValid&&this.newTicket.isRequestedAccessDetailsValid&&this.newTicket.isNotificationsAttachmentsValid;case"Modify":return this.newTicket.isBadgeholderValid&&this.newTicket.isRequestedAccessDetailsValid&&this.newTicket.isNotificationsAttachmentsValid;case"Terminate":return this.newTicket.isBadgeholderValid&&this.newTicket.isEndDateValid;default:return!1}}setBadgeHolder(t){this.newTicket.badgeHolder=t,t===void 0?this.newTicket.visitors=[]:this.newTicket.visitors=[{id:t.id,firstName:t.firstName,lastName:t.lastName,email:t.email,phone:t.phone,company:t.company}]}addOrUpdateVisitor(t){t&&this.setBadgeHolder(t)}addBulkVisitors(t){throw new Error("Method not implemented.")}removeBulkVisitors(){throw new Error("Method not implemented.")}removeVisitor(t){this.setBadgeHolder(void 0)}removeAllVisitors(){this.newTicket.visitors=[]}clearStartDate(){this.newTicket.startDate=void 0}updateStartDate(t){var i;this.newTicket.startDate=t,(i=this.newTicket.sitesDetails)===null||i===void 0||i.forEach(s=>{s.locations.forEach(n=>{n.startDate=t})})}updateEndDate(t){var i;this.newTicket.endDate=t,(i=this.newTicket.sitesDetails)===null||i===void 0||i.forEach(s=>{s.locations.forEach(n=>{n.endDate=t})})}async addSiteLocations(t){var i;if(t){const s=await Y.getServiceBackend(t.site.accountNumber,t.site.siteId,"Facilities_access"),n=((i=this.newTicket.sitesDetails)!==null&&i!==void 0?i:[]).filter(a=>a.site.siteId!==t.site.siteId),o={...t,serviceBackend:s};this.newTicket.sitesDetails=[...n,o]}}removeSiteLocations(t){var i;if(t){const s=((i=this.newTicket.sitesDetails)!==null&&i!==void 0?i:[]).filter(n=>n.site.siteId!==t.site.siteId);this.newTicket.sitesDetails=[...s]}}updateContacts(t){this.newTicket.contacts=t}async submitNewTicketRequest(){var t,i;let s;this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.ticketNumbers=void 0;try{switch(this.newTicket.category){case"New":s=await l.facilityAccessApi.permanentBadgeAccess.createPermanentBadgeNewTicket({permanentBadgeAccessNewTicketRequest:Vp(this.newTicket)});break;case"Modify":s=await l.facilityAccessApi.permanentBadgeAccess.createPermanentBadgeModifyTicket({permanentBadgeAccessModifyTicketRequest:jp(this.newTicket)});break;case"Terminate":s=await l.facilityAccessApi.permanentBadgeAccess.createPermanentBadgeTerminateTicket({permanentBadgeAccessTerminateTicketRequest:Mp(this.newTicket)});break;default:throw new Error("Invalid category")}this.submissionResult.ticketNumbers=s==null?void 0:s.ticketNumbers}catch(n){throw this.loadings.isSubmitting=!1,this.submissionResult.state=w.Error,await m(n,!1),n}try{if(s){k.failedAttachments=((t=this.newTicket.attachments)!==null&&t!==void 0?t:[]).map(o=>o.fileName);const{ticketNumbers:n}=s;n!=null&&n.length&&!((i=this.newTicket.attachments)===null||i===void 0)&&i.length&&await Promise.all(this.newTicket.attachments.map(async o=>Promise.all(n.map(async a=>Pt(y.FacilityAccess,o.file,o.fileName,o.fileType,a,this.newTicket.requestType))).then(()=>{var a;k.failedAttachments=((a=this.newTicket.attachments)!==null&&a!==void 0?a:[]).filter(r=>r.fileName!==o.fileName).map(r=>r.fileName)}))),this.newTicket.attachments=void 0}}catch(n){throw k.error.uploadingAttachments=!0,await m(n,!1),n}finally{this.submissionResult.state=w.Submitted,this.loadings.isSubmitting=!1}}mapPermanentBadgeTicketToUpdateRequest(){switch(this.newTicket.category){case"Modify":return Hp(this.newTicket);case"New":return Up(this.newTicket);case"Terminate":return zp();default:throw new Error("Invalid category")}}async setNewTicket(){try{this.newTicket=await Jp(this.submissionResult.ticketResponse)||ue.newTicket}catch(t){throw await m(t,!1),t}}async submitUpdateTicketRequest(){var t;let i;try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.ticketNumbers=void 0;try{i=await((t=l.facilityAccessApi.permanentBadgeAccess)===null||t===void 0?void 0:t.updatePermanentBadgeTicket({permanentBadgeAccessTicketUpdateRequest:this.mapPermanentBadgeTicketToUpdateRequest(),ticketId:this.newTicket.id})),this.submissionResult.ticketResponse=i,this.submissionResult.state=w.Submitted,this.submissionResult.ticketNumbers=[i.id]}catch(s){await m(s,!1)}try{await k.postAttachments(y.FacilityAccess,this.newTicket.attachments,this.newTicket.id,!0,"Permanent Badge"),this.newTicket.attachments=void 0}catch(s){await m(s,!1)}try{i&&(this.selectedTicket=await Kn(i),await this.setNewTicket())}catch(s){await m(s,!1)}}catch(s){throw await m(s,!1),this.submissionResult.state=w.Error,s}finally{this.loadings.isSubmitting=!1}}async getPermanentBadgeAccessServiceTicket(t){if(t)try{const i=await l.facilityAccessApi.permanentBadgeAccess.getPermanentBadgeTicketById({ticketId:t});this.submissionResult.ticketResponse=i,this.selectedTicket=await Kn(i),await this.setNewTicket()}catch(i){throw await m(i,!1),i}}async cancelTicket(t,i){try{k.loadings.isTicketCancelling=!0,k.error.cancellingTicket=!1,t&&(await l.facilityAccessApi.permanentBadgeAccess.cancellationPermanentBadgeRequest({ticketId:t,cancellationTicketsRequest:{cancellationReason:i}}).catch(s=>{throw m(s,!1),s}),await this.getPermanentBadgeAccessServiceTicket(t))}catch(s){throw k.error.cancellingTicket=!0,await m(s,!1),s}finally{k.loadings.isTicketCancelling=!1}}async hasUpdatePermissions(){try{return!!await Ke(this.selectedTicket.sitesDetails[0].locations.map(t=>t.id),I.PermanentBadge,U.Update)}catch(t){return!1}}async getAttachments(t,i){return jn(y.FacilityAccess,t,i)}async getPermanentBadgeHolders(t,i,s=1,n=10){return await l.facilityAccessApi.permanentBadgeAccess.getPermanentBadgeHoldersList({accountNumber:this.newTicket.accountNumber,activeBadge:!0,nameOrEmailContains:t,page:s,size:n},i).catch(a=>{var r;!((r=i==null?void 0:i.signal)===null||r===void 0)&&r.aborted||m(a,!0)})||{items:[],totalCount:0}}clearNewTicket(){this.newTicket=ue.newTicket}async patchLocationsApprovalStatus(t){var i,s,n;const o=t.map(a=>({id:a.id,approvalStatus:ls[a.status]}));await((i=l.facilityAccessApi.permanentBadgeAccess)===null||i===void 0?void 0:i.updatePermanentBadgeLocationsTicket({ticketId:((s=this.selectedTicket)===null||s===void 0?void 0:s.id)||"",locationsPatchRequestInner:o}).catch(a=>{m(a,!1)})),await this.getPermanentBadgeAccessServiceTicket((n=this.selectedTicket)===null||n===void 0?void 0:n.id).catch(a=>{m(a,!1)})}clear(){this.newTicket=ue.newTicket,this.selectedTicket=ue.selectedTicket,this.submissionResult=ue.submissionResult,this.loadings=ue.loadings,this.isEditAttachmentAdded=ue.isEditAttachmentAdded}}const X=new Kp;function Yp(e){return e.flatMap(t=>t.locations.map(i=>({id:i.id,startDateTime:Be(i.startDate,i.startTime,t.site.siteId),endDateTime:Be(i.endDate,i.endTime,t.site.siteId)})))}async function Xn(e){var t,i,s;const{timeZone:n,id:o}=((t=J.sites)===null||t===void 0?void 0:t.find(d=>d.locationId===e.site))||{},a=o?await Sn(o):[],r=new Map(a.map(d=>{var u;return[d.id,(u=d.name)!==null&&u!==void 0?u:d.id]}));return[{site:new Oe(e.site,o,e.accountNumber),locations:(s=(i=e.locations)===null||i===void 0?void 0:i.map(d=>{var u,p,A,N;return{id:d.id,name:r.get(d.id)||d.id,site:o,startDate:d.startDateTime&&n?(u=G(d.startDateTime).tz(n))===null||u===void 0?void 0:u.format(ct):"-",startTime:d.startDateTime&&n?(p=G(d.startDateTime).tz(n))===null||p===void 0?void 0:p.format($t):"-",endDate:d.endDateTime&&n?(A=G(d.endDateTime).tz(n))===null||A===void 0?void 0:A.format(ct):"-",endTime:d.endDateTime&&n?(N=G(d.endDateTime).tz(n))===null||N===void 0?void 0:N.format($t):"-"}}))!==null&&s!==void 0?s:[]}]}async function Xp(e){const[t,i]=await Promise.all([Ze({locationType:F.Site,permissionType:I.OSPAccess,permissionPrivilege:e}),Ze({locationType:ut.GreaterThan+F.Site,permissionType:I.OSPAccess,permissionPrivilege:e,assignableProcess:"OSP_access"})]),s=new Set(i.map(n=>n.siteId));return t.sort((n,o)=>n.siteId>o.siteId?1:-1).map(n=>({...n,hasSpaces:s.has(n.siteId),accountNumber:n.accountNumber}))}const Qp=e=>({accountNumber:e.accountNumber,visitors:e.visitors.map(t=>({firstName:t.firstName,lastName:t.lastName,email:t.email,company:t.company,phone:t.phone,visitorType:t.visitorType})),locations:Yp(e.sitesDetails||[]),escortFirstName:e.escortFirstName,escortLastName:e.escortLastName,visitorHostFirstName:e.hostFirstName,visitorHostLastName:e.hostLastName,customerExternalReference:e.customerExternalReference,serviceImpactedDescription:e.serviceImpactDescription,workDescription:e.workDescription,notificationRecipients:e.contacts}),le=(e,t)=>e===t||!e&&!t||!e&&t==="-",eh=(e,t)=>{var i,s;const n={};le(e.visitors[0].phone,t.visitors[0].phone)||(n.visitorPhone=e.visitors[0].phone),le(e.visitors[0].company,t.visitors[0].company)||(n.visitorCompany=e.visitors[0].company),(!le(e.escortFirstName,t.escortFirstName)||!le(e.escortLastName,t.escortLastName))&&(n.escortFirstName=e.escortFirstName,n.escortLastName=e.escortLastName),(!le(e.hostFirstName,t.visitorHostFirstName)||!le(e.hostLastName,t.visitorHostLastName))&&(n.visitorHostFirstName=e.hostFirstName,n.visitorHostLastName=e.hostLastName),le(e.customerExternalReference,t.customerExternalReference)||(n.customerExternalReference=e.customerExternalReference),le(e.serviceImpactDescription,t.serviceImpactDescription)||(n.serviceImpactedDescription=e.serviceImpactDescription),le(e.workDescription,t.workDescription)||(n.workDescription=e.workDescription),le(e.contacts,t.notificationRecipients)||(n.otherNotificationRecipients=e.contacts);const o=((i=e.sitesDetails)===null||i===void 0?void 0:i.flatMap(d=>d.locations))||[],a=((s=t.sitesDetails)===null||s===void 0?void 0:s.flatMap(d=>d.locations))||[],r=o.map(d=>{var u,p;const A=a.find(b=>b.id===d.id),N={id:d.id};return(!A||!le(d.startDate,A.startDate)||!le(d.startTime,A.startTime))&&(N.startDateTime=Be(d.startDate,d.startTime,(u=e.sitesDetails)===null||u===void 0?void 0:u[0].site.siteId)),(!A||!le(d.endDate,A.endDate)||!le(d.endTime,A.endTime))&&(N.endDateTime=Be(d.endDate,d.endTime,(p=e.sitesDetails)===null||p===void 0?void 0:p[0].site.siteId)),N}).filter(d=>d.startDateTime||d.endDateTime);return r.length&&(n.locations=r),Object.keys(n).length===0&&(n.visitorCompany=e.visitors[0].company),n},Qn=async e=>{var t;return{id:e.id||"-",state:e.status||"-",requester:e.createdBy||"-",createdOn:e.createdAt||"-",updatedOn:e.updatedAt||"-",requestType:"OSP Access",visitors:[{firstName:e.visitorFirstName||"-",lastName:e.visitorLastName||"-",email:e.visitorEmail||"-",phone:e.visitorPhone||"-",company:e.visitorCompany||"-",visitorType:e.visitorType}],visitorType:e.visitorType||"-",escortFirstName:e.escortFirstName||"-",escortLastName:e.escortLastName||"-",visitorHostFirstName:e.visitorHostFirstName||"-",visitorHostLastName:e.visitorHostLastName||"-",site:e.site||"-",sitesDetails:await Xn(e),customerExternalReference:e.customerExternalReference||"-",serviceImpacted:e.serviceImpactedDescription?"Yes":"No",serviceImpactDescription:e.serviceImpactedDescription||"-",workDescription:e.workDescription||"-",notificationRecipients:e.notificationRecipients||"",cancellationReason:e.cancellationReason||"-",comments:(t=e.comments)===null||t===void 0?void 0:t.map(i=>M(i))}},th=async e=>{var t,i,s,n,o;if(e)return{isVisitorContactsDetailsValid:!0,isVisitorEscortedDetailsValid:!0,isVisitorHostValid:!0,isRequestedAccessDetailsValid:!0,isServiceImpactedSectionValid:!0,isNotificationsAttachmentsValid:!0,accountNumber:(t=e.accountNumber)!==null&&t!==void 0?t:"",status:e.status,requestType:"OSP Access",category:"",visitors:[{firstName:(i=e.visitorFirstName)!==null&&i!==void 0?i:"",lastName:(s=e.visitorLastName)!==null&&s!==void 0?s:"",email:(n=e.visitorEmail)!==null&&n!==void 0?n:"",company:e.visitorCompany,phone:(o=e.visitorPhone)!==null&&o!==void 0?o:"",visitorType:e.visitorType}],isEscortedVisitor:!0,escortFirstName:e.escortFirstName,escortLastName:e.escortLastName,hostFirstName:e.visitorHostFirstName,hostLastName:e.visitorHostLastName,visitorBadge:"Standard",sitesDetails:await Xn(e),contacts:e.notificationRecipients,customerExternalReference:e.customerExternalReference,isServiceImpacted:!!e.serviceImpactedDescription,serviceImpactDescription:e.serviceImpactedDescription,workDescription:e.workDescription,termsAgreed:!0,id:e.id,attachments:[]}},ih=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}}),pe={newTicket:{isVisitorContactsDetailsValid:!1,isVisitorEscortedDetailsValid:!1,isVisitorHostValid:!1,isRequestedAccessDetailsValid:!1,isServiceImpactedSectionValid:!1,isNotificationsAttachmentsValid:!1,accountNumber:"",visitors:[],contacts:"",attachments:[],startDate:void 0,endDate:void 0,sitesDetails:void 0,visitorBadge:"Standard",serviceType:void 0,isEscortedVisitor:!0,escortFirstName:void 0,escortLastName:void 0,hostCompany:void 0,hostFirstName:void 0,hostLastName:void 0},selectedTicket:void 0,submissionResult:{state:w.Default,ticketNumbers:[],ticketResponse:void 0},loadings:{isSubmitting:!1,facilityAccessTicket:!1},isEditAttachmentAdded:!1};class ea{constructor(){this.newTicket=pe.newTicket,this.submissionResult=pe.submissionResult,this.selectedTicket=pe.selectedTicket,this.loadings=pe.loadings,this.isEditAttachmentAdded=pe.isEditAttachmentAdded,ne(this)}async setNewTicket(){var t;try{this.newTicket=(t=await th(this.submissionResult.ticketResponse))!==null&&t!==void 0?t:pe.newTicket}catch(i){throw await m(i,!1),i}}async getOSPAccessServiceTicket(t){if(t)try{const i=await l.facilityAccessApi.ospAccess.getOspAccessTicketById({ticketId:t});this.submissionResult.ticketResponse=i,this.selectedTicket=await Qn(i),await this.setNewTicket()}catch(i){throw await m(i,!1),i}}createTicket(){var t;const i=(t=this.newTicket.accountNumber)!==null&&t!==void 0?t:oe.getUserAccount().accountNumber;this.newTicket={...pe.newTicket,accountNumber:i,requestType:"OSP Access",category:""},this.submissionResult=pe.submissionResult}isNotificationsAttachmentsValid(t){this.newTicket.isNotificationsAttachmentsValid=t}updateAttachments(t){var i;(i=this.newTicket.attachments)===null||i===void 0||i.push(...t)}updateIsEscortedVisitor(t){this.newTicket.isEscortedVisitor=t,t?this.newTicket.visitorBadge=void 0:(this.newTicket.escortFirstName=void 0,this.newTicket.escortLastName=void 0,this.newTicket.visitorBadge===void 0&&(this.newTicket.visitorBadge="Standard"))}updateVisitorHost(t,i){var s;const n=(s=this.newTicket.sitesDetails)===null||s===void 0?void 0:s.find(o=>o.site.siteId===t);n&&(n.visitorHost=i,n.isVisitorHostDetailsValid=!0)}updateEscortFirstName(t){this.newTicket.escortFirstName=t}updateEscortLastName(t){this.newTicket.escortLastName=t}addOrUpdateVisitor(t){var i;if(t)if(this.newTicket.id)this.newTicket.visitors=[t];else{const s=((i=this.newTicket.visitors)!==null&&i!==void 0?i:[]).filter(n=>n.id!==t.id);this.newTicket.visitors=[...s,t]}}removeVisitor(t){var i;if(t){const s=((i=this.newTicket.visitors)!==null&&i!==void 0?i:[]).filter(n=>n.id!==t.id);this.newTicket.visitors=[...s]}}updateHostFirstName(t){this.newTicket.hostFirstName=t}updateHostLastName(t){this.newTicket.hostLastName=t}updateVisitorBadge(t){this.newTicket.visitorBadge=t}updateTermsAgreed(t){this.newTicket.termsAgreed=t}async addSiteLocations(t){var i;if(t){const s=((i=this.newTicket.sitesDetails)!==null&&i!==void 0?i:[]).filter(n=>n.site.siteId!==t.site.siteId);this.newTicket.sitesDetails=[...s,t]}}removeSiteLocations(t){var i;if(t){const s=((i=this.newTicket.sitesDetails)!==null&&i!==void 0?i:[]).filter(n=>n.site.siteId!==t.site.siteId);this.newTicket.sitesDetails=[...s]}}updateContacts(t){this.newTicket.contacts=t}async submitNewTicketRequest(){var t,i;let s;this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.ticketNumbers=void 0;try{s=await l.facilityAccessApi.ospAccess.createOspAccessTicket({oSPAccessTicketRequest:Qp(this.newTicket)}),this.submissionResult.ticketNumbers=s==null?void 0:s.ticketNumbers}catch(n){throw this.loadings.isSubmitting=!1,this.submissionResult.state=w.Error,await m(n,!1),n}try{if(s){k.failedAttachments=((t=this.newTicket.attachments)!==null&&t!==void 0?t:[]).map(o=>o.fileName);const{ticketNumbers:n}=s;n!=null&&n.length&&!((i=this.newTicket.attachments)===null||i===void 0)&&i.length&&await Promise.all(this.newTicket.attachments.map(async o=>Promise.all(n.map(async a=>Pt(y.FacilityAccess,o.file,o.fileName,o.fileType,a,this.newTicket.requestType))).then(()=>{var a;k.failedAttachments=((a=this.newTicket.attachments)!==null&&a!==void 0?a:[]).filter(r=>r.fileName!==o.fileName).map(r=>r.fileName)}))),this.newTicket.attachments=void 0}}catch(n){throw k.error.uploadingAttachments=!0,await m(n,!1),n}finally{this.submissionResult.state=w.Submitted,this.loadings.isSubmitting=!1}}async submitUpdateTicketRequest(){let t;try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.ticketNumbers=void 0;try{t=await l.facilityAccessApi.ospAccess.updateOspAccessTicket({oSPAccessTicketUpdateRequest:eh(this.newTicket,this.selectedTicket),ticketId:this.newTicket.id}),this.submissionResult.ticketResponse=t,this.submissionResult.state=w.Submitted,this.submissionResult.ticketNumbers=[t==null?void 0:t.id]}catch(i){this.submissionResult.state=w.Error,await m(i,!1)}try{await k.postAttachments(y.FacilityAccess,this.newTicket.attachments,this.newTicket.id,!0,"OSP Access"),this.newTicket.attachments=void 0}catch(i){await m(i,!1)}try{t&&(this.selectedTicket=await Qn(t))}catch(i){await m(i,!1)}}catch(i){throw await m(i,!1),i}finally{this.loadings.isSubmitting=!1}}updateFieldValue(t,i){this.newTicket[t]=i}isVisitorContactsValid(t){this.newTicket.isVisitorContactsDetailsValid=t}isEscortedDetailsValid(t){this.newTicket.isVisitorEscortedDetailsValid=t}isRequestedAccessDetailsValid(t){this.newTicket.isRequestedAccessDetailsValid=t}addBulkVisitors(t){throw new Error("Method not implemented.")}removeBulkVisitors(){throw new Error("Method not implemented.")}removeBulkAttachment(){throw new Error("Method not implemented.")}removeAllVisitors(){this.newTicket.visitors=[]}async hasUpdatePermissions(){var t;try{return await An((t=this.selectedTicket)===null||t===void 0?void 0:t.site)}catch(i){return!1}}async cancelTicket(t){var i;try{k.loadings.isTicketCancelling=!0,!((i=this.selectedTicket)===null||i===void 0)&&i.id&&(await l.facilityAccessApi.ospAccess.cancellationOspAccessRequest({ticketId:this.selectedTicket.id,cancellationTicketsRequest:{cancellationReason:t}}),await this.getOSPAccessServiceTicket(this.selectedTicket.id))}catch(s){throw await m(s,!1),s}finally{k.loadings.isTicketCancelling=!1}}get isNewTicketValid(){const t=this.newTicket.isVisitorContactsDetailsValid,i=this.newTicket.isVisitorEscortedDetailsValid,s=this.newTicket.isVisitorHostValid,n=this.newTicket.isRequestedAccessDetailsValid,o=this.newTicket.isServiceImpactedSectionValid,a=this.newTicket.isNotificationsAttachmentsValid;return t&&i&&s&&n&&o&&a}clear(){this.newTicket=pe.newTicket,this.selectedTicket=pe.selectedTicket,this.submissionResult=pe.submissionResult,this.loadings=pe.loadings,this.isEditAttachmentAdded=pe.isEditAttachmentAdded}}const Ie=new ea;function sh(e){return e.flatMap(t=>t.locations.map(i=>({id:i.id,startDateTime:Be(i.startDate,i.startTime,t.site.siteId),endDateTime:Be(i.endDate,i.endTime,t.site.siteId)})))}async function ta(e){var t,i,s,n;const{timeZone:o,id:a}=(i=(t=J.sites)===null||t===void 0?void 0:t.find(u=>u.locationId===e.site))!==null&&i!==void 0?i:{},r=a?await In(a):[],d=new Map(r.map(u=>{var p;return[u.id,(p=u.name)!==null&&p!==void 0?p:u.id]}));return[{site:new Oe(e.site,a,e.accountNumber),locations:(n=(s=e.locations)===null||s===void 0?void 0:s.map(u=>{var p,A,N,b;return{id:u.id,name:d.get(u.id)||u.id,site:a,startDate:u.startDateTime&&o?(p=G(u.startDateTime).tz(o))===null||p===void 0?void 0:p.format(ct):"-",startTime:u.startDateTime&&o?(A=G(u.startDateTime).tz(o))===null||A===void 0?void 0:A.format($t):"-",endDate:u.endDateTime&&o?(N=G(u.endDateTime).tz(o))===null||N===void 0?void 0:N.format(ct):"-",endTime:u.endDateTime&&o?(b=G(u.endDateTime).tz(o))===null||b===void 0?void 0:b.format($t):"-"}}))!==null&&n!==void 0?n:[]}]}async function nh(e){const[t,i]=await Promise.all([Ze({locationType:F.Site,permissionType:I.POPPOEAccess,permissionPrivilege:e}),Ze({locationType:ut.GreaterThan+F.Site,permissionType:I.POPPOEAccess,permissionPrivilege:e,assignableProcess:"POP_access"})]),s=new Set(i.map(n=>n.siteId));return t.sort((n,o)=>n.siteId>o.siteId?1:-1).map(n=>({...n,hasSpaces:s.has(n.siteId),accountNumber:n.accountNumber}))}const xi=e=>{var t;return(t=e==null?void 0:e.map(i=>{var s,n,o,a,r,d,u,p,A,N,b,C;return{sideAName:(s=i.sideAName)!==null&&s!==void 0?s:"",sideARoomNumber:(n=i.sideARoomNumber)!==null&&n!==void 0?n:"",sideARackNumber:(o=i.sideARackNumber)!==null&&o!==void 0?o:"",sideAPanelNumber:(a=i.sideAPanelNumber)!==null&&a!==void 0?a:"",sideAPort1:(r=i.sideAPort)!==null&&r!==void 0?r:"",sideACarrierCircuitId:(d=i.sideACarrierCircuitID)!==null&&d!==void 0?d:"",sideBName:(u=i.sideZName)!==null&&u!==void 0?u:"",sideBRoomNumber:(p=i.sideZRoomNumber)!==null&&p!==void 0?p:"",sideBRackNumber:(A=i.sideZRackNumber)!==null&&A!==void 0?A:"",sideBPanelNumber:(N=i.sideZPanelNumber)!==null&&N!==void 0?N:"",sideBPort1:(b=i.sideZPort)!==null&&b!==void 0?b:"",sideBCarrierCircuitId:(C=i.sideZCarrierCircuitID)!==null&&C!==void 0?C:""}}))!==null&&t!==void 0?t:[]},ia=e=>!e||e.length===1&&!e[0].rack&&!e[0].cabinet?[]:e.map(t=>{var i,s;return{rack:(i=t.rack)!==null&&i!==void 0?i:"",cabinet:(s=t.cabinet)!==null&&s!==void 0?s:""}}),ah=e=>({accountNumber:e.accountNumber,visitors:e.visitors.map(t=>({firstName:t.firstName,lastName:t.lastName,email:t.email,company:t.company,phone:t.phone,visitorType:t.visitorType})),locations:sh(e.sitesDetails||[]),escortFirstName:e.escortFirstName,escortLastName:e.escortLastName,visitorHostFirstName:e.hostFirstName,visitorHostLastName:e.hostLastName,customerExternalReference:e.customerExternalReference,serviceImpactedDescription:e.serviceImpactDescription,serviceDetails:{serviceType:e.serviceType,scope:e.scope,circuits:xi(e.circuits),workDescription:e.descriptionOfWork},ppopSpace:ia(e.ppopSpaces),spopSpace:ia(e.spopSpaces),ppopRoomWork:e.isPpopCableRunOutside?{ppopSpaceFrom:e.ppopFromRackPanel,ppopSpaceTo:e.ppopToRackPanel,cableType:e.ppopCableType,onLadderRack:e.ppopLadderRack,inInnerDuct:e.ppopInnerDuct,inFiberGuide:e.ppopFiberGuide}:void 0,spopRoomWork:e.isSpopCableRunOutside?{spopSpaceFrom:e.spopFromRackPanel,spopSpaceTo:e.spopToRackPanel,cableType:e.spopCableType,onLadderRack:e.spopLadderRack,inInnerDuct:e.spopInnerDuct,inFiberGuide:e.spopFiberGuide}:void 0,notificationRecipients:e.contacts}),sa=e=>(e==null?void 0:e.map(t=>({sideAName:t.sideAName||"-",sideARoomNumber:t.sideARoomNumber||"-",sideARackNumber:t.sideARackNumber||"-",sideAPanelNumber:t.sideAPanelNumber||"-",sideAPort:t.sideAPort1||"-",sideACarrierCircuitID:t.sideACarrierCircuitId||"-",sideZName:t.sideBName||"-",sideZRoomNumber:t.sideBRoomNumber||"-",sideZRackNumber:t.sideBRackNumber||"-",sideZPanelNumber:t.sideBPanelNumber||"-",sideZPort:t.sideBPort1||"-",sideZCarrierCircuitID:t.sideBCarrierCircuitId||"-"})))||[],na=async e=>{var t,i,s,n,o,a,r,d,u,p,A,N,b,C,x,et,tt,it,st,nt,at;return{id:e.id||"-",state:e.status||"-",requester:e.createdBy||"-",createdOn:e.createdAt||"-",updatedOn:e.updatedAt||"-",requestType:"PoP/POE Access",visitors:[{firstName:e.visitorFirstName||"-",lastName:e.visitorLastName||"-",email:e.visitorEmail||"-",phone:e.visitorPhone||"-",company:e.visitorCompany||"-",visitorType:e.visitorType}],visitorType:e.visitorType||"-",escortFirstName:e.escortFirstName||"-",escortLastName:e.escortLastName||"-",visitorHostFirstName:e.visitorHostFirstName||"-",visitorHostLastName:e.visitorHostLastName||"-",visitorHostCompany:e.visitorHostCompany||"-",site:e.site||"-",sitesDetails:await ta(e),customerExternalReference:e.customerExternalReference||"-",isServiceImpacted:!!e.serviceImpactedDescription,serviceImpactDescription:e.serviceImpactedDescription||"-",serviceType:((t=e.serviceDetails)===null||t===void 0?void 0:t.serviceType)||"-",scope:((i=e.serviceDetails)===null||i===void 0?void 0:i.scope)||"-",isCrossConnectPatchCableInstallationOrRemoval:!!(!((n=(s=e.serviceDetails)===null||s===void 0?void 0:s.circuits)===null||n===void 0)&&n.length),workDescription:((o=e.serviceDetails)===null||o===void 0?void 0:o.workDescription)||"-",circuits:sa((a=e.serviceDetails)===null||a===void 0?void 0:a.circuits),ppopSpaces:((r=e.ppopSpace)===null||r===void 0?void 0:r.map(we=>({rack:we.rack||"",cabinet:we.cabinet||""})))||[],spopSpaces:((d=e.spopSpace)===null||d===void 0?void 0:d.map(we=>({rack:we.rack||"",cabinet:we.cabinet||""})))||[],isPpopCableRunOutside:!!e.ppopRoomWork&&Object.keys(e.ppopRoomWork).length>0,ppopFromRackPanel:((u=e.ppopRoomWork)===null||u===void 0?void 0:u.ppopSpaceFrom)||"-",ppopToRackPanel:((p=e.ppopRoomWork)===null||p===void 0?void 0:p.ppopSpaceTo)||"-",ppopCableType:((A=e.ppopRoomWork)===null||A===void 0?void 0:A.cableType)||"-",ppopLadderRack:(N=e.ppopRoomWork)===null||N===void 0?void 0:N.onLadderRack,ppopInnerDuct:(b=e.ppopRoomWork)===null||b===void 0?void 0:b.inInnerDuct,ppopFiberGuide:(C=e.ppopRoomWork)===null||C===void 0?void 0:C.inFiberGuide,isSpopCableRunOutside:!!(e.spopRoomWork&&Object.keys(e.spopRoomWork).length>0),spopFromRackPanel:((x=e.spopRoomWork)===null||x===void 0?void 0:x.spopSpaceFrom)||"-",spopToRackPanel:((et=e.spopRoomWork)===null||et===void 0?void 0:et.spopSpaceTo)||"-",spopCableType:((tt=e.spopRoomWork)===null||tt===void 0?void 0:tt.cableType)||"-",spopLadderRack:(it=e.spopRoomWork)===null||it===void 0?void 0:it.onLadderRack,spopInnerDuct:(st=e.spopRoomWork)===null||st===void 0?void 0:st.inInnerDuct,spopFiberGuide:(nt=e.spopRoomWork)===null||nt===void 0?void 0:nt.inFiberGuide,notificationRecipients:e.notificationRecipients||"",cancellationReason:e.cancellationReason||"-",comments:(at=e.comments)===null||at===void 0?void 0:at.map(we=>M(we))}},oh=async e=>{var t,i,s,n,o,a,r,d,u,p,A,N,b,C,x,et,tt,it,st,nt,at,we,pi,hi,vi;if(e)return{isVisitorContactsDetailsValid:!0,isVisitorEscortedDetailsValid:!0,isVisitorHostValid:!0,isRequestedAccessDetailsValid:!0,isNotificationsAttachmentsValid:!0,isPopRequestedAccessValid:!0,accountNumber:(t=e.accountNumber)!==null&&t!==void 0?t:"",status:e.status,requestType:"PoP/POE Access",category:"",id:e.id,visitors:[{firstName:(i=e.visitorFirstName)!==null&&i!==void 0?i:"",lastName:(s=e.visitorLastName)!==null&&s!==void 0?s:"",email:(n=e.visitorEmail)!==null&&n!==void 0?n:"",company:e.visitorCompany,phone:(o=e.visitorPhone)!==null&&o!==void 0?o:"",visitorType:e.visitorType}],isEscortedVisitor:!0,escortFirstName:e.escortFirstName,escortLastName:e.escortLastName,sitesDetails:await ta(e),hostFirstName:e.visitorHostFirstName,hostLastName:e.visitorHostLastName,customerExternalReference:e.customerExternalReference,isServiceImpacted:!!e.serviceImpactedDescription,serviceImpactDescription:e.serviceImpactedDescription,termsAgreed:!0,serviceType:(a=e.serviceDetails)===null||a===void 0?void 0:a.serviceType,scope:(r=e.serviceDetails)===null||r===void 0?void 0:r.scope,isCrossConnectInstallation:!!(!((u=(d=e.serviceDetails)===null||d===void 0?void 0:d.circuits)===null||u===void 0)&&u.length),descriptionOfWork:(p=e.serviceDetails)===null||p===void 0?void 0:p.workDescription,circuits:sa((A=e.serviceDetails)===null||A===void 0?void 0:A.circuits),ppopSpaces:((N=e.ppopSpace)===null||N===void 0?void 0:N.map(Tt=>({rack:Tt.rack||"",cabinet:Tt.cabinet||""})))||[],spopSpaces:((b=e.spopSpace)===null||b===void 0?void 0:b.map(Tt=>({rack:Tt.rack||"",cabinet:Tt.cabinet||""})))||[],isPpopCableRunOutside:!!e.ppopRoomWork&&Object.keys(e.ppopRoomWork).length>0,ppopFromRackPanel:(C=e.ppopRoomWork)===null||C===void 0?void 0:C.ppopSpaceFrom,ppopToRackPanel:(x=e.ppopRoomWork)===null||x===void 0?void 0:x.ppopSpaceTo,ppopCableType:(et=e.ppopRoomWork)===null||et===void 0?void 0:et.cableType,ppopLadderRack:(tt=e.ppopRoomWork)===null||tt===void 0?void 0:tt.onLadderRack,ppopInnerDuct:(it=e.ppopRoomWork)===null||it===void 0?void 0:it.inInnerDuct,ppopFiberGuide:(st=e.ppopRoomWork)===null||st===void 0?void 0:st.inFiberGuide,isSpopCableRunOutside:!!(e.spopRoomWork&&Object.keys(e.spopRoomWork).length>0),spopFromRackPanel:(nt=e.spopRoomWork)===null||nt===void 0?void 0:nt.spopSpaceFrom,spopToRackPanel:(at=e.spopRoomWork)===null||at===void 0?void 0:at.spopSpaceTo,spopCableType:(we=e.spopRoomWork)===null||we===void 0?void 0:we.cableType,spopLadderRack:(pi=e.spopRoomWork)===null||pi===void 0?void 0:pi.onLadderRack,spopInnerDuct:(hi=e.spopRoomWork)===null||hi===void 0?void 0:hi.inInnerDuct,spopFiberGuide:(vi=e.spopRoomWork)===null||vi===void 0?void 0:vi.inFiberGuide,contacts:e.notificationRecipients,attachments:[]}},rh=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}}),He=(e,t)=>(e!=null?e:!1)!==(t!=null?t:!1),B=(e,t)=>!(e===t||!e&&!t||!e&&t==="-"),ch=(e,t)=>B(e.sideAName,t.sideAName)||B(e.sideARoomNumber,t.sideARoomNumber)||B(e.sideARackNumber,t.sideARackNumber)||B(e.sideAPanelNumber,t.sideAPanelNumber)||B(e.sideAPort,t.sideAPort)||B(e.sideACarrierCircuitID,t.sideACarrierCircuitID)||B(e.sideZName,t.sideZName)||B(e.sideZRoomNumber,t.sideZRoomNumber)||B(e.sideZRackNumber,t.sideZRackNumber)||B(e.sideZPanelNumber,t.sideZPanelNumber)||B(e.sideZPort,t.sideZPort)||B(e.sideZCarrierCircuitID,t.sideZCarrierCircuitID),dh=(e,t)=>{if(e===void 0)return t.length!==0;if(e.length!==t.length)return!0;for(let i=0;i<e.length;i++)if(ch(e[i],t[i]))return!0;return!1},aa=(e,t)=>{if(e===void 0&&!(t!=null&&t.length))return!1;if(!e||!t||e.length!==t.length)return!0;for(let i=0;i<e.length;i++)if(B(e[i].rack,t[i].rack)||B(e[i].cabinet,t[i].cabinet))return!0;return!1},uh=(e,t)=>{var i,s;const n={};B(e.visitors[0].company,t.visitors[0].company)&&(n.visitorCompany=e.visitors[0].company),(B(e.escortFirstName,t.escortFirstName)||B(e.escortLastName,t.escortLastName))&&(n.escortFirstName=e.escortFirstName,n.escortLastName=e.escortLastName);const o=((i=e.sitesDetails)===null||i===void 0?void 0:i.flatMap(d=>d.locations.map(u=>({id:u.id,startDate:u.startDate,startTime:u.startTime,endDate:u.endDate,endTime:u.endTime,siteId:d.site.siteId}))))||[],a=((s=t.sitesDetails)===null||s===void 0?void 0:s.flatMap(d=>d.locations))||[],r=o.map(d=>{const u=a.find(A=>A.id===d.id),p={id:d.id};return(!u||B(d.startDate,u.startDate)||B(d.startTime,u.startTime)||B(d.endDate,u.endDate)||B(d.endTime,u.endTime))&&(p.startDateTime=Be(d.startDate,d.startTime,d.siteId),p.endDateTime=Be(d.endDate,d.endTime,d.siteId)),p}).filter(d=>d.startDateTime&&d.endDateTime);if(r.length&&(n.locations=r),(B(e.hostFirstName,t.visitorHostFirstName)||B(e.hostLastName,t.visitorHostLastName))&&(n.visitorHostFirstName=e.hostFirstName,n.visitorHostLastName=e.hostLastName),He(e.isServiceImpacted,t.isServiceImpacted)&&e.isServiceImpacted===!1&&(n.serviceImpactedDescription=""),B(e.serviceImpactDescription,t.serviceImpactDescription)&&(n.serviceImpactedDescription=e.serviceImpactDescription),n.serviceDetails={},B(e.serviceType,t.serviceType))switch(n.serviceDetails.serviceType=e.serviceType,e.serviceType){case We.SiteSurvey:case We.Testing:n.serviceDetails.scope=e.scope,n.serviceDetails.workDescription="",n.serviceDetails.circuits=[];break;case We.InstallationDeInstallationWork:n.serviceDetails.scope="",n.serviceDetails.workDescription=e.descriptionOfWork,n.serviceDetails.circuits=xi(e.circuits);break;default:throw new Error("Unsupported service type for update")}else switch(e.serviceType){case We.SiteSurvey:case We.Testing:B(e.scope,t.scope)&&(n.serviceDetails.scope=e.scope);break;case We.InstallationDeInstallationWork:B(e.descriptionOfWork,t.workDescription)&&(n.serviceDetails.workDescription=e.descriptionOfWork),dh(e.circuits,t.circuits)&&(n.serviceDetails.circuits=xi(e.circuits));break;default:throw new Error("Unsupported service type for update")}return Object.keys(n.serviceDetails).length===0&&delete n.serviceDetails,aa(e.ppopSpaces,t.ppopSpaces)&&(n.ppopSpace=e.ppopSpaces),aa(e.spopSpaces,t.spopSpaces)&&(n.spopSpace=e.spopSpaces),e.isPpopCableRunOutside?(n.ppopRoomWork={},B(e.ppopFromRackPanel,t.ppopFromRackPanel)&&(n.ppopRoomWork.ppopSpaceFrom=e.ppopFromRackPanel),B(e.ppopToRackPanel,t.ppopToRackPanel)&&(n.ppopRoomWork.ppopSpaceTo=e.ppopToRackPanel),B(e.ppopCableType,t.ppopCableType)&&(n.ppopRoomWork.cableType=e.ppopCableType),He(e.ppopLadderRack,t.ppopLadderRack)&&(n.ppopRoomWork.onLadderRack=e.ppopLadderRack),He(e.ppopInnerDuct,t.ppopInnerDuct)&&(n.ppopRoomWork.inInnerDuct=e.ppopInnerDuct),He(e.ppopFiberGuide,t.ppopFiberGuide)&&(n.ppopRoomWork.inFiberGuide=e.ppopFiberGuide),Object.keys(n.ppopRoomWork).length===0&&delete n.ppopRoomWork):He(e.isPpopCableRunOutside,t.isPpopCableRunOutside)&&(n.ppopRoomWork=null),e.isSpopCableRunOutside?(n.spopRoomWork={},B(e.spopFromRackPanel,t.spopFromRackPanel)&&(n.spopRoomWork.spopSpaceFrom=e.spopFromRackPanel),B(e.spopToRackPanel,t.spopToRackPanel)&&(n.spopRoomWork.spopSpaceTo=e.spopToRackPanel),B(e.spopCableType,t.spopCableType)&&(n.spopRoomWork.cableType=e.spopCableType),He(e.spopLadderRack,t.spopLadderRack)&&(n.spopRoomWork.onLadderRack=e.spopLadderRack),He(e.spopInnerDuct,t.spopInnerDuct)&&(n.spopRoomWork.inInnerDuct=e.spopInnerDuct),He(e.spopFiberGuide,t.spopFiberGuide)&&(n.spopRoomWork.inFiberGuide=e.spopFiberGuide),Object.keys(n.spopRoomWork).length===0&&delete n.spopRoomWork):He(e.isSpopCableRunOutside,t.isSpopCableRunOutside)&&(n.spopRoomWork=null),B(e.visitors[0].phone,t.visitors[0].phone)&&(n.visitorPhone=e.visitors[0].phone),B(e.customerExternalReference,t.customerExternalReference)&&(n.customerExternalReference=e.customerExternalReference),B(e.contacts,t.notificationRecipients)&&(n.notificationRecipients=e.contacts),Object.keys(n).length===0&&(n.visitorCompany=e.visitors[0].company),n},he={newTicket:{isVisitorContactsDetailsValid:!1,isVisitorEscortedDetailsValid:!1,isVisitorHostValid:!1,isRequestedAccessDetailsValid:!1,isPopRequestedAccessValid:!1,isPPopRoomWorkValid:!1,isSPopRoomWorkValid:!1,isNotificationsAttachmentsValid:!1,accountNumber:"",visitors:[],contacts:"",attachments:[],startDate:void 0,endDate:void 0,sitesDetails:void 0,visitorBadge:"Standard",serviceType:void 0,isEscortedVisitor:!0,escortFirstName:void 0,escortLastName:void 0,hostCompany:void 0,hostFirstName:void 0,hostLastName:void 0,ppopSpaces:[{}],spopSpaces:[{}]},selectedTicket:void 0,submissionResult:{state:w.Default,ticketNumbers:[],popAccessResponse:void 0},loadings:{isSubmitting:!1,facilityAccessTicket:!1},isEditAttachmentAdded:!1};class oa{constructor(){this.newTicket=he.newTicket,this.submissionResult=he.submissionResult,this.selectedTicket=he.selectedTicket,this.loadings=he.loadings,this.isEditAttachmentAdded=he.isEditAttachmentAdded,ne(this)}createTicket(){var t,i;const s=(t=this.newTicket.accountNumber)!==null&&t!==void 0?t:oe.getUserAccount().accountNumber;this.newTicket={...he.newTicket,accountNumber:s,requestType:"PoP/POE Access",category:"",serviceBackend:(i=this.newTicket.serviceBackend)!==null&&i!==void 0?i:void 0},this.submissionResult=he.submissionResult}async setNewTicket(){try{this.newTicket=await oh(this.submissionResult.ticketResponse),this.newTicket||(this.newTicket=he.newTicket)}catch(t){throw await m(t,!1),t}}async getPOPAccessServiceTicket(t){if(t)try{const i=await l.facilityAccessApi.popAccess.getPopAccessTicketById({ticketId:t});this.submissionResult.ticketResponse=i,this.selectedTicket=await na(i)}catch(i){throw await m(i,!1),i}}async hasUpdatePermissions(){var t;try{return await _n((t=this.selectedTicket)===null||t===void 0?void 0:t.site)}catch(i){return!1}}isNotificationsAttachmentsValid(t){this.newTicket.isNotificationsAttachmentsValid=t}updateAttachments(t){var i;(i=this.newTicket.attachments)===null||i===void 0||i.push(...t)}updateIsEscortedVisitor(t){this.newTicket.isEscortedVisitor=t,t?this.newTicket.visitorBadge=void 0:(this.newTicket.escortFirstName=void 0,this.newTicket.escortLastName=void 0,this.newTicket.visitorBadge===void 0&&(this.newTicket.visitorBadge="Standard"))}updateVisitorHost(t,i){var s;const n=(s=this.newTicket.sitesDetails)===null||s===void 0?void 0:s.find(o=>o.site.siteId===t);n&&(n.visitorHost=i,n.isVisitorHostDetailsValid=!0)}updateEscortFirstName(t){this.newTicket.escortFirstName=t}updateEscortLastName(t){this.newTicket.escortLastName=t}addVisitor(t){var i;if(t)if(this.newTicket.id)this.newTicket.visitors=[t];else{const s=((i=this.newTicket.visitors)!==null&&i!==void 0?i:[]).filter(n=>n.id!==t.id);this.newTicket.visitors=[...s,t]}}removeVisitor(t){var i;if(t){const s=((i=this.newTicket.visitors)!==null&&i!==void 0?i:[]).filter(n=>n.id!==t.id);this.newTicket.visitors=[...s]}}addOrUpdateVisitor(t){var i;if(t)if(this.newTicket.id)this.newTicket.visitors=[t];else{const s=((i=this.newTicket.visitors)!==null&&i!==void 0?i:[]).filter(n=>n.id!==t.id);this.newTicket.visitors=[...s,t]}}updateHostFirstName(t){this.newTicket.hostFirstName=t}updateHostLastName(t){this.newTicket.hostLastName=t}updateVisitorBadge(t){this.newTicket.visitorBadge=t}updateTermsAgreed(t){this.newTicket.termsAgreed=t}updateStartDate(t){var i;this.newTicket.startDate=t,(i=this.newTicket.sitesDetails)===null||i===void 0||i.forEach(s=>{s.locations.forEach(n=>{n.startDate=t})})}updateEndDate(t){var i;this.newTicket.endDate=t,(i=this.newTicket.sitesDetails)===null||i===void 0||i.forEach(s=>{s.locations.forEach(n=>{n.endDate=t})})}async addSiteLocations(t){var i;if(t){const s=((i=this.newTicket.sitesDetails)!==null&&i!==void 0?i:[]).filter(n=>n.site.siteId!==t.site.siteId);this.newTicket.sitesDetails=[...s,t]}}removeSiteLocations(t){var i;if(t){const s=((i=this.newTicket.sitesDetails)!==null&&i!==void 0?i:[]).filter(n=>n.site.siteId!==t.site.siteId);this.newTicket.sitesDetails=[...s]}}updateContacts(t){this.newTicket.contacts=t}async submitNewTicketRequest(){var t;this.resetSubmission();try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.ticketNumbers=void 0;const i=await l.facilityAccessApi.popAccess.createPopAccessTicket({pOPAccessTicketRequest:ah(this.newTicket)}).catch(s=>{throw m(s,!1),this.submissionResult.state=w.Error,s});if(i){const{ticketNumbers:s}=i;s!=null&&s.length&&!((t=this.newTicket.attachments)===null||t===void 0)&&t.length&&await Promise.all(s.map(async n=>{await k.postAttachments(y.FacilityAccess,this.newTicket.attachments,n,!1,"PoP/POE Access")})),this.newTicket.attachments=void 0,this.submissionResult.state=w.Submitted,this.submissionResult.ticketNumbers=i==null?void 0:i.ticketNumbers}}catch(i){throw await m(i,!1),this.submissionResult.state=w.Error,i}finally{this.loadings.isSubmitting=!1}}async cancelTicket(t){var i;try{k.loadings.isTicketCancelling=!0,!((i=this.selectedTicket)===null||i===void 0)&&i.id&&(await l.facilityAccessApi.popAccess.cancellationPopAccessRequest({ticketId:this.selectedTicket.id,cancellationTicketsRequest:{cancellationReason:t}}),await this.getPOPAccessServiceTicket(this.selectedTicket.id))}catch(s){throw await m(s,!1),s}finally{k.loadings.isTicketCancelling=!1}}async submitUpdateTicketRequest(){let t;try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting,this.submissionResult.ticketNumbers=void 0;try{t=await l.facilityAccessApi.popAccess.updatePopAccessTicket({pOPAccessTicketUpdateRequest:uh(this.newTicket,this.selectedTicket),ticketId:this.newTicket.id}),this.submissionResult.ticketResponse=t,this.submissionResult.state=w.Submitted,this.submissionResult.ticketNumbers=[t==null?void 0:t.id]}catch(i){throw this.submissionResult.state=w.Error,await m(i,!1),i}try{await k.postAttachments(y.FacilityAccess,this.newTicket.attachments,this.newTicket.id,!0,"PoP/POE Access"),this.newTicket.attachments=[]}catch(i){await m(i,!1)}try{t&&(this.selectedTicket=await na(t))}catch(i){throw await m(i,!1),i}}finally{this.loadings.isSubmitting=!1}}resetSubmission(){this.submissionResult=he.submissionResult}clearNewTicket(){this.newTicket=he.newTicket}clear(){this.newTicket=he.newTicket,this.selectedTicket=he.selectedTicket,this.submissionResult=he.submissionResult}updateFieldValue(t,i){this.newTicket[t]=i}updateIsServiceImpacted(t){this.newTicket.isServiceImpacted=t}updateCustomerExternalReference(t){this.newTicket.customerExternalReference=t}updateServiceImpactDescription(t){this.newTicket.serviceImpactDescription=t}updateServiceType(t){this.newTicket.serviceType=t,t===We.InstallationDeInstallationWork&&this.updateScope(""),this.updateIsCrossConnectInstallation(!1)}updateScope(t){this.newTicket.scope=t}updateDescriptionOfWork(t){this.newTicket.descriptionOfWork=t}updateIsCrossConnectInstallation(t){this.newTicket.isCrossConnectInstallation=t,t?this.newTicket.circuits=[{}]:(this.updateDescriptionOfWork(""),this.newTicket.circuits=void 0)}updateIsPPopCableRunOutside(t){this.newTicket.isPpopCableRunOutside=t,t||(this.newTicket.ppopFromRackPanel=void 0,this.newTicket.ppopToRackPanel=void 0,this.newTicket.ppopCableType=void 0,this.newTicket.ppopLadderRack=void 0,this.newTicket.ppopInnerDuct=void 0,this.newTicket.ppopFiberGuide=void 0)}updateIsSPopCableRunOutside(t){this.newTicket.isSpopCableRunOutside=t,t||(this.newTicket.spopFromRackPanel=void 0,this.newTicket.spopToRackPanel=void 0,this.newTicket.spopCableType=void 0,this.newTicket.spopLadderRack=void 0,this.newTicket.spopInnerDuct=void 0,this.newTicket.spopFiberGuide=void 0)}updateCircuitField(t,i,s){var n;(!this.newTicket.circuits||((n=this.newTicket.circuits)===null||n===void 0?void 0:n.length)===0)&&(this.newTicket.circuits=[{}]);const o=[...this.newTicket.circuits];o[s][i]=t,this.newTicket.circuits=o}isVisitorContactsValid(t){this.newTicket.isVisitorContactsDetailsValid=t}isEscortedDetailsValid(t){this.newTicket.isVisitorEscortedDetailsValid=t}isRequestedAccessDetailsValid(t){this.newTicket.isRequestedAccessDetailsValid=t}addBulkVisitors(t){throw new Error("Method not implemented.")}removeBulkVisitors(){throw new Error("Method not implemented.")}removeBulkAttachment(){throw new Error("Method not implemented.")}removeAllVisitors(){this.newTicket.visitors=[]}get isNewTicketValid(){const t=this.newTicket.isVisitorContactsDetailsValid,i=this.newTicket.isVisitorEscortedDetailsValid,s=this.newTicket.isVisitorHostValid,n=this.newTicket.isRequestedAccessDetailsValid,o=this.newTicket.isPopRequestedAccessValid;return t&&i&&s&&n&&o}get isAdditionalComponentValid(){return this.newTicket.isPPopRoomWorkValid&&this.newTicket.isSPopRoomWorkValid&&this.newTicket.isNotificationsAttachmentsValid}}const Ce=new oa;var ti;(function(e){e.PLANNED_MAINTENANCE="Planned Maintenance",e.INCIDENTS="Incidents",e.DCIM_ALERTS="DCIM Alerts",e.SERVICE_TICKETS="Service Tickets"})(ti||(ti={}));const lh=(e,t)=>({ticketId:t,ticketCommentsRequest:{comment:e}}),M=e=>({comment:e.comment,commentedBy:e.createdBy,commentedOn:e.createdAt});async function mh(e,t,i){var s,n,o,a,r,d,u,p,A,N;let b;switch(e){case y.Deliveries:{const C=await l.deliveriesApi.createDeliveriesComment(Ym(t,i)).catch(x=>{m(x,!1)});b=(s=C==null?void 0:C.comments)===null||s===void 0?void 0:s.map(M),be.selectedTicket&&(be.selectedTicket.comments=b);break}case y.Removals:{const C=await l.removalsApi.createComment(up(t,i)).catch(x=>{m(x,!1)});b=(n=C==null?void 0:C.comments)===null||n===void 0?void 0:n.map(M),Ve.selectedTicket&&(Ve.selectedTicket.comments=b);break}case y.RemoteHands:{const C=await l.remoteHandsApi.createRemoteHandsComment(ip(t,i)).catch(x=>{m(x,!1)});b=(o=C==null?void 0:C.comments)===null||o===void 0?void 0:o.map(M),ce.selectedTicket&&(ce.selectedTicket.comments=b);break}case y.VisitorAccess:{const C=await l.facilityAccessApi.visitorAccess.createVisitorAccessComment(Bp(t,i)).catch(x=>{m(x,!1)});b=(a=C==null?void 0:C.comments)===null||a===void 0?void 0:a.map(M),se.selectedTicket&&(se.selectedTicket.comments=b);break}case y.PermanentBadge:{const C=await l.facilityAccessApi.permanentBadgeAccess.createPermanentBadgeComment(Wp(t,i)).catch(x=>{m(x,!1)});b=(r=C==null?void 0:C.comments)===null||r===void 0?void 0:r.map(M),X.selectedTicket&&(X.selectedTicket.comments=b);break}case y.CustomerSupport:{const C=await l.customerCareApi.createCustomerCareComment(_p(t,i)).catch(x=>{m(x,!1)});b=(d=C==null?void 0:C.comments)===null||d===void 0?void 0:d.map(M),je.selectedTicket&&(je.selectedTicket.comments=b);break}case y.TroubleTickets:{const C=await l.troubleTicketsApi.createTroubleTicketComment(pp(t,i)).catch(x=>{m(x,!1)});b=(u=C==null?void 0:C.comments)===null||u===void 0?void 0:u.map(M),Ue.selectedTicket&&(Ue.selectedTicket.comments=b);break}case y.OSPAccess:{const C=await l.facilityAccessApi.ospAccess.createOspAccessComment(ih(t,i)).catch(x=>{m(x,!1)});b=(p=C==null?void 0:C.comments)===null||p===void 0?void 0:p.map(M),Ie.selectedTicket&&(Ie.selectedTicket.comments=b);break}case y.POPPOEAccess:{const C=await l.facilityAccessApi.popAccess.createPopAccessComment(rh(t,i)).catch(x=>{m(x,!1)});b=(A=C==null?void 0:C.comments)===null||A===void 0?void 0:A.map(M),Ce.selectedTicket&&(Ce.selectedTicket.comments=b);break}case ti.INCIDENTS:{const C=await l.incidentsApi.createIncidentComment(lh(t,i)).catch(x=>{m(x,!1)});b=(N=C==null?void 0:C.comments)===null||N===void 0?void 0:N.map(M);break}default:return}return b}const ph=e=>({subject:e.subject,customerReference:e.customerReferenceNumber,description:e.description,otherNotificationRecipients:e.contacts}),hh=e=>{var t;return{accountNumber:e.accountNumber,subject:e.subject,requestType:e.requestType,category:e.category,locations:!((t=e.location)===null||t===void 0)&&t.id?[e.location.id]:[],customerReference:e.customerReferenceNumber,description:e.description,notificationRecipients:e.contacts}},vh=async e=>{if(e)return{accountNumber:e.accountNumber,serviceBackend:await Y.getServiceBackend(e.accountNumber,e.site,"Customer_care"),subject:e.subject,requestType:e.requestType,category:e.category,site:{id:e.site,accountNumber:e.accountNumber},location:{id:e.locations[0],accountNumber:e.accountNumber},customerReferenceNumber:e.customerReference,description:e.description,contacts:e.notificationRecipients}},ra=async e=>{var t,i,s,n,o;if(e)return{id:e.id,accountName:e.accountName,accountNumber:e.accountNumber,serviceBackend:await Y.getServiceBackend(e.accountNumber,e.site,"Customer_care"),subject:e.subject,description:e.description,customerReference:e.customerReference,site:e.site,location:!((t=e.locations)===null||t===void 0)&&t.length?e.locations[0]:"",notificationRecipients:e.notificationRecipients,status:e.status,createdBy:e.createdBy,createdAt:(i=e.createdAt)===null||i===void 0?void 0:i.toISOString(),updatedAt:(s=e.updatedAt)===null||s===void 0?void 0:s.toISOString(),closedAt:(n=e.closedAt)===null||n===void 0?void 0:n.toISOString(),cancellationReason:e.cancellationReason,requestType:e.requestType,category:e.category,comments:(o=e.comments)===null||o===void 0?void 0:o.map(a=>M(a))}},ze={selectedTicket:void 0,ticket:{isValid:!1,subject:"",description:"",site:void 0,requestType:"",category:"",customerReferenceNumber:"",contacts:"",attachments:[],accountNumber:""},submissionResult:{state:w.Default,result:void 0},loadings:{isSubmitting:!1}};class gh{constructor(){this.selectedTicket=ze.selectedTicket,this.ticket=ze.ticket,this.submissionResult=ze.submissionResult,this.loadings=ze.loadings,ne(this),Je(this,{name:"customerCare",properties:[],storage:window.localStorage})}async setTicket(){try{this.ticket=await vh(this.submissionResult.result)||ze.ticket}catch(t){throw await m(t,!1),t}}async getSelectedTicket(t){if(t)try{const i=await l.customerCareApi.getCustomerCareTicketById({ticketId:t});this.submissionResult.result=i,this.selectedTicket=await ra(i),await this.setTicket()}catch(i){throw await m(i,!1),i}}async getCategories(t,i){if(!(!t||!i))try{return await l.customerCareApi.getCustomerCareCategoriesList({site:t,accountNumber:i})}catch(s){throw await m(s,!1),s}}async cancelTicket(t){var i;try{k.loadings.isTicketCancelling=!0,!((i=this.selectedTicket)===null||i===void 0)&&i.id&&(await l.customerCareApi.cancellationCustomerCareRequest({ticketId:this.selectedTicket.id,cancellationTicketsRequest:{cancellationReason:t}}).catch(s=>{throw m(s,!1),s}),await this.getSelectedTicket(this.selectedTicket.id))}finally{k.loadings.isTicketCancelling=!1}}async updateSite(t){this.ticket.site=t,this.ticket.accountNumber=t.accountNumber}async createTicket(){var t;this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting;try{this.submissionResult.result=await l.customerCareApi.createCustomerCareTicket({customerCareTicketRequest:hh(this.ticket)}),this.submissionResult.state=w.Submitted}catch(i){throw this.loadings.isSubmitting=!1,this.submissionResult.state=w.Error,await m(i,!1),i}try{!((t=this.submissionResult.result)===null||t===void 0)&&t.id&&await k.postAttachments(y.CustomerSupport,this.ticket.attachments,this.submissionResult.result.id),this.ticket.attachments=void 0}catch(i){throw await m(i,!1),i}finally{this.loadings.isSubmitting=!1}}async updateTicket(){var t,i;let s;try{this.loadings.isSubmitting=!0,this.submissionResult.state=w.Submitting;try{s=await l.customerCareApi.updateCustomerCareTicket({ticketId:((t=this.selectedTicket)===null||t===void 0?void 0:t.id)||"",customerCareTicketUpdateRequest:ph(this.ticket)}),this.submissionResult.result=s,this.submissionResult.state=w.Submitted}catch(n){throw this.submissionResult.state=w.Error,await m(n,!1),n}try{await k.postAttachments(y.CustomerSupport,this.ticket.attachments,(i=this.selectedTicket)===null||i===void 0?void 0:i.id,!0),this.ticket.attachments=void 0}catch(n){throw await m(n,!1),n}try{s&&(this.selectedTicket=await ra(s),await this.setTicket())}catch(n){throw await m(n,!1),n}}finally{this.loadings.isSubmitting=!1}}updateLocation(t){this.ticket.location=t}clear(){this.ticket=ze.ticket,this.selectedTicket=ze.selectedTicket,this.submissionResult=ze.submissionResult,this.loadings=ze.loadings}}const je=new gh,ge=bt` *, ::before, ::after {
|
|
2
2
|
--tw-border-spacing-x: 0;
|
|
3
3
|
--tw-border-spacing-y: 0;
|
|
4
4
|
--tw-translate-x: 0;
|
|
@@ -1061,7 +1061,7 @@ video {
|
|
|
1061
1061
|
margin-left: 0px;
|
|
1062
1062
|
margin-right: 0px;
|
|
1063
1063
|
}
|
|
1064
|
-
} `;let xi=class extends _e{constructor(){super(...arguments),this.hasPermission=void 0}async canPerformActions(){var e,t,i,s;return![O.InProgress,O.New].includes((e=je.selectedTicket)===null||e===void 0?void 0:e.status)||((t=je.selectedTicket)===null||t===void 0?void 0:t.serviceBackend)===H.TelxSFDC||!(!((i=je.selectedTicket)===null||i===void 0)&&i.location&&!((s=je.selectedTicket)===null||s===void 0)&&s.accountNumber)?!1:this.hasPermission!==void 0?this.hasPermission:(this.hasPermission=await Nt(U.Update,S.CustomerCare,je.selectedTicket.location,je.selectedTicket.accountNumber),this.hasPermission)}dispatchClickEvent(e){const t=new CustomEvent(e,{bubbles:!0,composed:!0});this.dispatchEvent(t)}render(){return k.loadings.isTicketCancelling?P:g`<div class="w-fit flex gap-2"> ${fe(this.canPerformActions().then(e=>e?g`<ix-button name="cancel-button" class="cancel" appearance="outlined" @click="${()=>this.dispatchClickEvent(L.CancelTicket)}"> <span>${Ye}</span> </ix-button> <ix-button name="edit-button" @click="${()=>this.dispatchClickEvent(L.EditTicket)}" has-icon> <md-icon slot="icon">edit</md-icon> <span>${Ee}</span> </ix-button>`:P),P)} </div>`}};xi.styles=[ve],xi=E([X("customer-care-button-group")],xi);let ii=class extends _e{constructor(){super(...arguments),this.hasPermission=void 0,this.backendService=void 0}async getServiceBackend(){var e,t;this.backendService||(this.backendService=await K.getServiceBackend((e=be.newTicket.site)===null||e===void 0?void 0:e.accountNumber,(t=be.newTicket.site)===null||t===void 0?void 0:t.id,"Deliveries"))}async canPerformActions(){var e,t,i,s,n,o,a,r,d,u;return((t=(e=be.selectedTicket)===null||e===void 0?void 0:e.state)===null||t===void 0?void 0:t.toLowerCase())!==O.Announced.toLowerCase()||!(!((s=(i=be.newTicket)===null||i===void 0?void 0:i.site)===null||s===void 0)&&s.id&&!((o=(n=be.newTicket)===null||n===void 0?void 0:n.site)===null||o===void 0)&&o.accountNumber)||(await this.getServiceBackend(),this.backendService===H.TelxSFDC)?!1:this.hasPermission!==void 0?this.hasPermission:(this.hasPermission=await be.hasTicketPermissionAtLocation(U.Update,S.DeliveriesRemovals,(r=(a=be.newTicket)===null||a===void 0?void 0:a.site)===null||r===void 0?void 0:r.id,(u=(d=be.newTicket)===null||d===void 0?void 0:d.site)===null||u===void 0?void 0:u.accountNumber),this.hasPermission)}dispatchClickEvent(e){const t=new CustomEvent(e,{bubbles:!0,composed:!0});this.dispatchEvent(t)}render(){return k.loadings.isTicketCancelling?P:g`<div class="w-fit flex gap-2"> ${fe(this.canPerformActions().then(e=>e?g`<ix-button name="cancel-button" class="cancel" appearance="outlined" @click="${()=>this.dispatchClickEvent(L.CancelTicket)}"> <span>${Ye}</span> </ix-button> <ix-button name="edit-button" @click="${()=>this.dispatchClickEvent(L.EditTicket)}" has-icon> <md-icon slot="icon">edit</md-icon> <span>${Ee}</span> </ix-button>`:P),P)} </div>`}};ii.styles=[ve],E([Ji()],ii.prototype,"backendService",void 0),ii=E([X("deliveries-button-group")],ii);let Fi=class extends _e{constructor(){super(...arguments),this.hasPermission=void 0}async canPerformActions(){var e,t,i,s,n,o,a,r,d,u;return((t=(e=Ve.selectedTicket)===null||e===void 0?void 0:e.status)===null||t===void 0?void 0:t.toLowerCase())!==O.Announced.toLowerCase()||!(!((s=(i=Ve.newTicket)===null||i===void 0?void 0:i.site)===null||s===void 0)&&s.id&&!((o=(n=Ve.newTicket)===null||n===void 0?void 0:n.site)===null||o===void 0)&&o.accountNumber)?!1:this.hasPermission!==void 0?this.hasPermission:(this.hasPermission=await Ve.hasTicketPermissionAtLocation(U.Update,S.DeliveriesRemovals,(r=(a=Ve.newTicket)===null||a===void 0?void 0:a.site)===null||r===void 0?void 0:r.id,(u=(d=Ve.newTicket)===null||d===void 0?void 0:d.site)===null||u===void 0?void 0:u.accountNumber),this.hasPermission)}dispatchClickEvent(e){const t=new CustomEvent(e,{bubbles:!0,composed:!0});this.dispatchEvent(t)}render(){return k.loadings.isTicketCancelling?P:g`<div class="w-fit flex gap-2"> ${fe(this.canPerformActions().then(e=>e?g`<ix-button name="cancel-button" class="cancel" appearance="outlined" @click="${()=>this.dispatchClickEvent(L.CancelTicket)}"> <span>${Ye}</span> </ix-button> <ix-button name="edit-button" @click="${()=>this.dispatchClickEvent(L.EditTicket)}" has-icon> <md-icon slot="icon">edit</md-icon> <span>${Ee}</span> </ix-button>`:P),P)} </div>`}};Fi.styles=[ve],Fi=E([X("removals-button-group")],Fi);const oa=e=>e?e.some(t=>t.locations.some(i=>i.status==="Outstanding")):!1,hh=e=>{switch(e){case"New":return"New Badge";case"Modify":return"Modify Badge";case"Terminate":return"Terminate All Access";default:return e}};let Li=class extends _e{constructor(){super(...arguments),this.hasUpdatePermission=void 0,this.hasApprovePermission=void 0}async getUpdatePermissions(){var e,t,i,s;this.hasUpdatePermission!==void 0||!(!((s=(i=(t=(e=ie.selectedTicket)===null||e===void 0?void 0:e.sitesDetails)===null||t===void 0?void 0:t[0])===null||i===void 0?void 0:i.locations)===null||s===void 0)&&s.length)||(this.hasUpdatePermission=await Ke(ie.selectedTicket.sitesDetails[0].locations.map(n=>n.id),S.VisitorAccess,U.Update))}async getApprovePermissions(){var e,t,i,s;this.hasApprovePermission!==void 0||!(!((s=(i=(t=(e=ie.selectedTicket)===null||e===void 0?void 0:e.sitesDetails)===null||t===void 0?void 0:t[0])===null||i===void 0?void 0:i.locations)===null||s===void 0)&&s.length)||(this.hasApprovePermission=await Ke(ie.selectedTicket.sitesDetails[0].locations.map(n=>n.id),S.VisitorAccess,U.Approve))}get canApproveOrDeny(){var e;return!((e=ie.selectedTicket)===null||e===void 0)&&e.state?ie.selectedTicket.state!==O.Cancelled&&oa(ie.selectedTicket.sitesDetails):!1}get canCancel(){var e;return!mt(ie.selectedTicket.id)||!(!((e=ie.selectedTicket)===null||e===void 0)&&e.state)?!1:[O.InProgress.toLowerCase(),oe.PendingApproval.toLowerCase(),oe.Approved.toLowerCase()].includes(ie.selectedTicket.state.toLowerCase())}get canEdit(){var e;return!((e=ie.selectedTicket)===null||e===void 0)&&e.state?![O.Cancelled.toLowerCase(),O.Completed.toLowerCase(),oe.ApprovalDenied.toLowerCase()].includes(ie.selectedTicket.state.toLowerCase()):!1}dispatchClickEvent(e){const t=new CustomEvent(e,{bubbles:!0,composed:!0});this.dispatchEvent(t)}renderApproveDenyBtn(){return!this.hasApprovePermission||!this.canApproveOrDeny?P:g`<ix-button name="approveDenyBtn" has-icon @click="${()=>{this.dispatchClickEvent(L.ApproveDenyTicket)}}"> <md-icon slot="icon">playlist_add_check</md-icon> <span class="button-label">APPROVE/DENY</span> </ix-button>`}renderCancelBtn(){return!this.hasUpdatePermission||!this.canCancel?P:g`<ix-button class="cancel" appearance="outlined" name="cancelBtn" @click="${()=>{this.dispatchClickEvent(L.CancelTicket)}}"> <span class="button-label">${Ye}</span> </ix-button>`}renderEditBtn(){return!this.hasUpdatePermission||!this.canEdit?P:g`<ix-button name="edit-button" @click="${()=>{this.dispatchClickEvent(L.EditTicket)}}" has-icon> <md-icon slot="icon">edit</md-icon> <span>${Ee}</span> </ix-button>`}render(){return k.loadings.isTicketCancelling?P:g`<div class="w-fit flex gap-2"> ${fe(this.getApprovePermissions().then(()=>g` ${this.renderApproveDenyBtn()}`),P)} ${fe(this.getUpdatePermissions().then(()=>g` ${this.renderCancelBtn()} ${this.renderEditBtn()}`),P)} </div>`}};Li.styles=[ve],Li=E([X("visitor-access-button-group")],Li);let Vi=class extends _e{constructor(){super(...arguments),this.hasUpdatePermission=void 0,this.hasApprovePermission=void 0}async getUpdatePermissions(){var e,t,i,s;this.hasUpdatePermission!==void 0||!(!((s=(i=(t=(e=Y.selectedTicket)===null||e===void 0?void 0:e.sitesDetails)===null||t===void 0?void 0:t[0])===null||i===void 0?void 0:i.locations)===null||s===void 0)&&s.length)||(this.hasUpdatePermission=await Ke(Y.selectedTicket.sitesDetails[0].locations.map(n=>n.id),S.PermanentBadge,U.Update))}async getApprovePermissions(){var e,t,i,s;this.hasApprovePermission!==void 0||!(!((s=(i=(t=(e=Y.selectedTicket)===null||e===void 0?void 0:e.sitesDetails)===null||t===void 0?void 0:t[0])===null||i===void 0?void 0:i.locations)===null||s===void 0)&&s.length)||(this.hasApprovePermission=await Ke(Y.selectedTicket.sitesDetails.flatMap(n=>n.locations.map(o=>o.id)),S.PermanentBadge,U.Approve))}get canApproveOrDeny(){return Y.selectedTicket?Y.selectedTicket.category!=="Terminate"&&Y.selectedTicket.state!==O.Cancelled&&oa(Y.selectedTicket.sitesDetails):!1}get canCancel(){var e;return!mt(Y.selectedTicket.id)||!(!((e=Y.selectedTicket)===null||e===void 0)&&e.state)||!ke()["SM:AllowPermanentBadgeCancellation"]?!1:[O.InProgress.toLowerCase(),oe.PendingApproval.toLowerCase(),oe.Approved.toLowerCase()].includes(Y.selectedTicket.state.toLowerCase())}get canEdit(){var e;return!((e=Y.selectedTicket)===null||e===void 0)&&e.state?![O.Cancelled.toLowerCase(),O.Completed.toLowerCase(),oe.ApprovalDenied.toLowerCase()].includes(Y.selectedTicket.state.toLowerCase()):!1}dispatchClickEvent(e){const t=new CustomEvent(e,{bubbles:!0,composed:!0});this.dispatchEvent(t)}renderApproveDenyBtn(){return!this.hasApprovePermission||!this.canApproveOrDeny?P:g`<ix-button name="approveDenyBtn" has-icon @click="${()=>{this.dispatchClickEvent(L.ApproveDenyTicket)}}"> <md-icon slot="icon">playlist_add_check</md-icon> <span class="button-label">APPROVE/DENY</span> </ix-button>`}renderCancelBtn(){return!this.hasUpdatePermission||!this.canCancel?P:g`<ix-button class="cancel" appearance="outlined" name="cancelBtn" @click="${()=>{this.dispatchClickEvent(L.CancelTicket)}}"> <span class="button-label">${Ye}</span> </ix-button>`}renderEditBtn(){return!this.hasUpdatePermission||!this.canEdit?P:g`<ix-button name="edit-button" @click="${()=>{this.dispatchClickEvent(L.EditTicket)}}" has-icon> <md-icon slot="icon">edit</md-icon> <span>${Ee}</span> </ix-button>`}render(){return k.loadings.isTicketCancelling?P:g`<div class="w-fit flex gap-2"> ${fe(this.getApprovePermissions().then(()=>g` ${this.renderApproveDenyBtn()}`),P)} ${fe(this.getUpdatePermissions().then(()=>g` ${this.renderCancelBtn()} ${this.renderEditBtn()}`),P)} </div>`}};Vi.styles=[ve],Vi=E([X("permanent-badge-button-group")],Vi);let Ui=class extends _e{constructor(){super(...arguments),this.hasUpdatePermission=void 0}async getUpdatePermissions(){var e,t,i,s;this.hasUpdatePermission!==void 0||!(!((s=(i=(t=(e=Se.selectedTicket)===null||e===void 0?void 0:e.sitesDetails)===null||t===void 0?void 0:t[0])===null||i===void 0?void 0:i.locations)===null||s===void 0)&&s.length)||(this.hasUpdatePermission=await bn(Se.selectedTicket.site))}get canCancel(){var e;return!mt(Se.selectedTicket.id)||!(!((e=Se.selectedTicket)===null||e===void 0)&&e.state)?!1:[O.InProgress.toLowerCase(),oe.PendingApproval.toLowerCase(),oe.Approved.toLowerCase()].includes(Se.selectedTicket.state.toLowerCase())}get canEdit(){var e;return!((e=Se.selectedTicket)===null||e===void 0)&&e.state?![O.Cancelled.toLowerCase(),O.Completed.toLowerCase()].includes(Se.selectedTicket.state.toLowerCase()):!1}dispatchClickEvent(e){const t=new CustomEvent(e,{bubbles:!0,composed:!0});this.dispatchEvent(t)}renderCancelBtn(){return!this.hasUpdatePermission||!this.canCancel?P:g`<ix-button class="cancel" appearance="outlined" name="cancelBtn" @click="${()=>{this.dispatchClickEvent(L.CancelTicket)}}"> <span class="button-label">${Ye}</span> </ix-button>`}renderEditBtn(){return!this.hasUpdatePermission||!this.canEdit?P:g`<ix-button name="edit-button" @click="${()=>{this.dispatchClickEvent(L.EditTicket)}}" has-icon> <md-icon slot="icon">edit</md-icon> <span>${Ee}</span> </ix-button>`}render(){return k.loadings.isTicketCancelling?P:g`<div class="w-fit flex gap-2"> ${fe(this.getUpdatePermissions().then(()=>g` ${this.renderCancelBtn()} ${this.renderEditBtn()}`),P)} </div>`}};Ui.styles=[ve],Ui=E([X("osp-access-button-group")],Ui);let Hi=class extends _e{constructor(){super(...arguments),this.hasUpdatePermission=void 0}async getUpdatePermissions(){var e,t,i,s;this.hasUpdatePermission!==void 0||!(!((s=(i=(t=(e=Ce.selectedTicket)===null||e===void 0?void 0:e.sitesDetails)===null||t===void 0?void 0:t[0])===null||i===void 0?void 0:i.locations)===null||s===void 0)&&s.length)||(this.hasUpdatePermission=await Rn(Ce.selectedTicket.site))}get canCancel(){var e;return!mt(Ce.selectedTicket.id)||!(!((e=Ce.selectedTicket)===null||e===void 0)&&e.state)?!1:[O.InProgress.toLowerCase(),oe.Approved.toLowerCase()].includes(Ce.selectedTicket.state.toLowerCase())}get canEdit(){var e;return!((e=Ce.selectedTicket)===null||e===void 0)&&e.state?![O.Cancelled.toLowerCase(),O.Completed.toLowerCase()].includes(Ce.selectedTicket.state.toLowerCase()):!1}dispatchClickEvent(e){const t=new CustomEvent(e,{bubbles:!0,composed:!0});this.dispatchEvent(t)}renderCancelBtn(){return!this.hasUpdatePermission||!this.canCancel?P:g`<ix-button class="cancel" appearance="outlined" name="cancelBtn" @click="${()=>{this.dispatchClickEvent(L.CancelTicket)}}"> <span class="button-label">${Ye}</span> </ix-button>`}renderEditBtn(){return!this.hasUpdatePermission||!this.canEdit?P:g`<ix-button name="edit-button" @click="${()=>{this.dispatchClickEvent(L.EditTicket)}}" has-icon> <md-icon slot="icon">edit</md-icon> <span>${Ee}</span> </ix-button>`}render(){return k.loadings.isTicketCancelling?P:g`<div class="w-fit flex gap-2"> ${fe(this.getUpdatePermissions().then(()=>g`${this.renderCancelBtn()}${this.renderEditBtn()}`),P)} </div>`}};Hi.styles=[ve],Hi=E([X("pop-access-button-group")],Hi);let si=class extends _e{constructor(){super(...arguments),this.hasPermission=void 0,this.backendService=void 0}async getServiceBackend(){var e;this.backendService||(this.backendService=await K.getServiceBackend(re.newTicket.location.accountNumber,(e=re.newTicket.site)===null||e===void 0?void 0:e.id,"Remote_hands"))}async getPermissions(){var e,t,i,s,n,o,a,r;return!(!((t=(e=re.newTicket)===null||e===void 0?void 0:e.location)===null||t===void 0)&&t.id&&!((s=(i=re.newTicket)===null||i===void 0?void 0:i.location)===null||s===void 0)&&s.accountNumber)||(await this.getServiceBackend(),this.backendService===H.TelxSFDC)?!1:this.hasPermission!==void 0?this.hasPermission:(re.loadings.ticketDetailsPermissionCheck=!0,this.hasPermission=await Nt(U.Update,S.RemoteHands,(o=(n=re.newTicket)===null||n===void 0?void 0:n.location)===null||o===void 0?void 0:o.id,(r=(a=re.newTicket)===null||a===void 0?void 0:a.location)===null||r===void 0?void 0:r.accountNumber),re.loadings.ticketDetailsPermissionCheck=!1,this.hasPermission)}get canCancel(){var e,t;return this.backendService===H.ServiceNow?!1:((t=(e=re.selectedTicket)===null||e===void 0?void 0:e.state)===null||t===void 0?void 0:t.toLowerCase())===O.New.toLowerCase()}get canEdit(){var e,t,i;const s=new Set([O.New.toLowerCase(),O.InProgress.toLowerCase()]);return!((e=re.selectedTicket)===null||e===void 0)&&e.state?s.has((i=(t=re.selectedTicket)===null||t===void 0?void 0:t.state)===null||i===void 0?void 0:i.toLowerCase()):!1}dispatchClickEvent(e){const t=new CustomEvent(e,{bubbles:!0,composed:!0});this.dispatchEvent(t)}render(){return k.loadings.isTicketCancelling?P:g`<div class="w-fit flex gap-2"> ${fe(this.getPermissions().then(e=>e?g` ${this.canCancel?g`<ix-button class="cancel" appearance="outlined" name="cancelRemovalsBtn" @click="${()=>{this.dispatchClickEvent(L.CancelTicket)}}"> <span class="button-label">${_m}</span> </ix-button>`:P} ${this.canEdit?g`<ix-button name="edit-button" @click="${()=>this.dispatchClickEvent(L.EditTicket)}" has-icon> <md-icon slot="icon">edit</md-icon> <span>${Ee}</span> </ix-button>`:P}`:P),P)} </div>`}};si.styles=[ve],E([Ji()],si.prototype,"backendService",void 0),si=E([X("remote-hands-button-group")],si);let zi=class extends _e{constructor(){super(...arguments),this.hasPermission=void 0}async canPerformActions(){var e,t,i,s,n,o;return!(!((t=(e=Ue.selectedTicket)===null||e===void 0?void 0:e.id)===null||t===void 0)&&t.toLowerCase().startsWith("cs"))||![O.Announced,O.Draft,O.New,O.InProgress].includes((i=Ue.selectedTicket)===null||i===void 0?void 0:i.state)||!(!((s=Ue.selectedTicket)===null||s===void 0)&&s.locations)||((n=Ue.selectedTicket)===null||n===void 0?void 0:n.locations.length)===0||Ue.selectedTicket.serviceBackend===H.TelxSFDC?!1:this.hasPermission!==void 0?this.hasPermission:(this.hasPermission=await Ke((o=Ue.selectedTicket)===null||o===void 0?void 0:o.locations,S.TroubleTickets,U.Update),this.hasPermission)}dispatchClickEvent(e){const t=new CustomEvent(e,{bubbles:!0,composed:!0});this.dispatchEvent(t)}render(){return k.loadings.isTicketCancelling?P:g`<div class="w-fit flex gap-2"> ${fe(this.canPerformActions().then(e=>e?g`<ix-button class="cancel" appearance="outlined" name="cancel-button" @click="${()=>{this.dispatchClickEvent(L.CancelTicket)}}"> <span class="button-label">${Ye}</span> </ix-button> <ix-button name="edit-button" @click="${()=>this.dispatchClickEvent(L.EditTicket)}" has-icon> <md-icon slot="icon">edit</md-icon> <span>${Ee}</span> </ix-button>`:P),P)} </div>`}};zi.styles=[ve],zi=E([X("trouble-ticket-button-group")],zi);const W={Home:"Home",ServiceTickets:"Service Tickets",Reports:"Reports, Maintenance & Incident Notifications",Incidents:"Incidents",DeliveriesTicketDetails:"Deliveries Ticket Details",RemovalsTicketDetails:"Removals Ticket Details",RemoteHandsTicketDetails:"Remote Hands Ticket Details",VisitorAccessTicketDetails:"Visitor Access Ticket Details",CustomerCareTicketDetails:"Customer Care Ticket Details",PermanentBadgeTicketDetails:"Permanent Badge Ticket Details",TroubleTicketDetails:"Trouble Ticket Details",OspAccessTicketDetails:"OSP Access Ticket Details",PopAccessTicketDetails:"POP Access Ticket Details"},Dt=[{name:W.CustomerCareTicketDetails,path:"/service-tickets/customer-care/:ticketId",component:"customer-care-ticket-details-view",hideAccountSwitcher:!0,headerLeft:g`<sm-back-button></sm-back-button>`,headerRight:g`<customer-care-button-group></customer-care-button-group>`,action:()=>{import("./ui-service-management15.js")}},{name:W.DeliveriesTicketDetails,path:"/service-tickets/deliveries/:ticketId",component:"deliveries-ticket-details-view",hideAccountSwitcher:!0,headerLeft:g`<sm-back-button></sm-back-button>`,headerRight:g`<deliveries-button-group></deliveries-button-group>`,action:()=>{import("./ui-service-management19.js")}},{name:W.RemovalsTicketDetails,path:"/service-tickets/removals/:ticketId",component:"removals-ticket-details-view",hideAccountSwitcher:!0,headerLeft:g`<sm-back-button></sm-back-button>`,headerRight:g`<removals-button-group></removals-button-group>`,action:()=>{import("./ui-service-management20.js")}},{name:W.VisitorAccessTicketDetails,path:"/service-tickets/facility-access/visitor-access/:ticketId",component:"visitor-access-ticket-details-view",hideAccountSwitcher:!0,headerLeft:g`<sm-back-button></sm-back-button>`,headerRight:g`<visitor-access-button-group></visitor-access-button-group>`,action:()=>{import("./ui-service-management21.js")}},{name:W.PermanentBadgeTicketDetails,path:"/service-tickets/facility-access/permanent-badge/:ticketId",component:"permanent-badge-ticket-details-view",hideAccountSwitcher:!0,headerLeft:g`<sm-back-button></sm-back-button>`,headerRight:g`<permanent-badge-button-group></permanent-badge-button-group>`,action:()=>{import("./ui-service-management24.js")}},{name:W.RemoteHandsTicketDetails,path:"/service-tickets/remote-hands/:ticketId",component:"remote-hands-ticket-details-view",hideAccountSwitcher:!0,headerLeft:g`<sm-back-button></sm-back-button>`,headerRight:g`<remote-hands-button-group></remote-hands-button-group>`,action:()=>{import("./ui-service-management25.js")}},{name:W.TroubleTicketDetails,path:"/service-tickets/trouble-tickets/:ticketId",component:"trouble-ticket-details-view",hideAccountSwitcher:!0,headerLeft:g`<sm-back-button></sm-back-button>`,headerRight:g`<trouble-ticket-button-group></trouble-ticket-button-group>`,action:()=>{import("./ui-service-management26.js")}},{name:W.Reports,path:"/reports",component:"site-maintenance-list",action:()=>{import("./ui-service-management27.js")}}];wt.isOspEnabled()&&Dt.push({name:W.OspAccessTicketDetails,path:"/service-tickets/facility-access/osp-access/:ticketId",component:"osp-access-ticket-details-view",hideAccountSwitcher:!0,headerLeft:g`<sm-back-button></sm-back-button>`,headerRight:g`<osp-access-button-group></osp-access-button-group>`,action:()=>{import("./ui-service-management29.js")}}),wt.isPopPoeEnabled()&&Dt.push({name:W.PopAccessTicketDetails,path:"/service-tickets/facility-access/pop-access/:ticketId",component:"pop-access-ticket-details-view",hideAccountSwitcher:!0,headerLeft:g`<sm-back-button></sm-back-button>`,headerRight:g`<pop-access-button-group></pop-access-button-group>`,action:()=>{import("./ui-service-management30.js")}}),wt.isIncidentsEnabled()&&Dt.push({name:W.Incidents,path:"/incidents",component:"incidents-list",action:()=>{import("./ui-service-management31.js")}});let ji=class extends _e{constructor(){super(...arguments),this.pageTitle="Loading..."}static get styles(){return[sm]}async firstUpdated(){window.addEventListener("vaadin-router-location-changed",e=>{var t;this.pageTitle=(t=e.detail.location.route)===null||t===void 0?void 0:t.name})}get currentAccount(){return ae.getUserAccount()}get headerRight(){var e;return this.pageTitle===W.ServiceTickets?null:(e=Dt.find(t=>t.name===this.pageTitle))===null||e===void 0?void 0:e.headerRight}render(){var e,t;return g` <div class="header-container"> <h1 class="header__title">${this.pageTitle}</h1> <sm-create-service-ticket-button></sm-create-service-ticket-button> ${this.headerRight} <div class="header__profile"> ${((t=(e=ae.getUser())===null||e===void 0?void 0:e.profile)===null||t===void 0?void 0:t.email)||"Unknown User"} </div> <button @click="${()=>ae.redirectToLogout()}" class="header__logout"> <svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="currentColor"> <path d="m17 7-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4V5z"></path> </svg> Logout </button> <ix-select class="header__accounts" label="Account" .wideMenu="${!0}"> <ix-select-option value="${pa(this.currentAccount.accountNumber)}" .selected="${!0}"> <div slot="headline">${this.currentAccount.name}</div> </ix-select-option> </ix-select> </div> `}};E([we({type:String})],ji.prototype,"pageTitle",void 0),ji=E([X("sm-app-header")],ji);const vh=bt`:host{--navbar-width:256px;--logo-padding-left:0px;--navbar-icon-min-width:56px}.container{width:var(--navbar-width);transition:width .3s ease;border-radius:12px;background:linear-gradient(#1456e0 20.5%,#0d2497 113.5%);min-height:calc(100vh - 54px);margin:15px;color:#fff;padding-bottom:24px;z-index:1000;box-shadow:rgba(3,28,82,.24) 0 8px 24px;text-align:center}.navigation-logo{user-select:none;display:inline-block;fill:currentcolor;flex-shrink:0;transition:fill .2s cubic-bezier(.4,0,.2,1) 0s;font-size:1.5rem;width:178px!important;height:27px!important;padding-top:24px;padding-bottom:18px;padding-left:var(--logo-padding-left)}ul{list-style:none;margin:0;position:relative;padding:8px 4px}ul li a{-webkit-tap-highlight-color:transparent;background-color:transparent;outline:0;border:0;margin:0;cursor:pointer;user-select:none;vertical-align:middle;appearance:none;color:inherit;display:flex;-webkit-box-flex:1;flex-grow:1;-webkit-box-align:center;align-items:center;position:relative;text-decoration:none;min-width:0;box-sizing:border-box;text-align:left;transition:background-color 150ms cubic-bezier(.4,0,.2,1) 0s;padding:12px 16px;border-radius:8px;opacity:.6;text-overflow:ellipsis;white-space:nowrap;-webkit-box-pack:unset;justify-content:unset}a.active,ul li a:hover{background:rgba(255,255,255,.16);opacity:1}.navigation-icon svg{user-select:none;width:1em;height:1em;display:inline-block;fill:currentcolor;transition:fill .2s cubic-bezier(.4,0,.2,1) 0s;font-size:1.5rem;flex-shrink:0;display:inline-flex;color:inherit;min-width:var(--navbar-icon-min-width)}h6{margin:0;font-weight:700;line-height:24px;letter-spacing:.1px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:inherit}.divider{border-color:#fff;opacity:.2;margin:0;flex-shrink:0;border-width:0 0 thin;border-style:solid}.container.compact{--navbar-width:80px}.container.compact .navigation-logo{--logo-padding-left:28px}.container.compact .navigation-icon svg{--navbar-icon-min-width:42px}@media only screen and (min-width:5px) and (max-width:500px){.container{--navbar-width:100%;min-height:auto;margin:0;border-radius:0;padding-bottom:0}.container.compact{--navbar-width:100%}}@media only screen and (min-width:500px) and (max-width:1250px){.container{--navbar-width:100%;min-height:auto;margin:0;border-radius:0;padding-bottom:0}.container.compact{--navbar-width:100%}}`,ra=bt`@font-face{font-family:'Material Icons';font-style:normal;font-weight:400;src:url(https://fonts.gstatic.com/s/materialicons/v145/flUhRq6tzZclQEJ-Vdg-IuiaDsNZ.ttf) format('truetype')}.material-icons{font-family:'Material Icons';font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr}@font-face{font-family:'Material Symbols Outlined';font-style:normal;font-weight:400;src:url(https://fonts.gstatic.com/s/materialsymbolsoutlined/v364/kJF1BvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oDMzByHX9rA6RzaxHMPdY43zj-jCxv3fzvRNU22ZXGJpEpjC_1v-p_4MrImHCIJIZrDCvHOem.ttf) format('truetype')}.material-symbols-outlined{font-family:'Material Symbols Outlined';font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr}.title{font-style:normal;font-weight:700;font-size:20px;line-height:24px;letter-spacing:.15px}.temp-button{border:none;padding:10px;color:#fff;border-radius:100px;cursor:pointer;margin-right:10px;text-decoration:none;font-family:var(--root-secondary-font);font-weight:700;font-style:normal;font-size:14px;line-height:18.52px;letter-spacing:1.25px;text-transform:uppercase}.temp-button span{padding:20px}.temp-button:disabled{background-color:#ddd}.flex{display:flex}.flex-1{flex:1}.border-top-solid-gray{border-top:solid 1px #ddd}.red{background-color:#db0028}.blue{background-color:#1456e0}.white{background-color:#fff;color:#1456e0;border:solid 1px #1456e0}.right{float:right}.margin-top-20{margin-top:20px}.padding-2{padding:2px}.padding-20{padding:20px}.padding-right-10{padding:10px}.font-14{font-size:14px}.button-container{position:absolute;bottom:30px;margin-left:10px}.temp-button span{padding:5px;font-size:20px}@media only screen and (min-width:5px) and (max-width:500px){.button-container{right:10px;top:10px}}@media only screen and (min-width:500px) and (max-width:1250px){.button-container{right:10px;top:10px}}`;let ca=class extends Rt{static get styles(){return[ra]}render(){return g` <div class="button-container"> <button @click="${()=>{localStorage.clear(),rt.go("/")}}" class="temp-button white"> <span class="material-icons"> <md-icon slot="icon">restart_alt</md-icon> </span> </button> </div> `}};ca=E([X("dev-clear-storage-button-service")],ca);const ni={digitalRealtyLogo:Ot`
|
|
1064
|
+
} `;let Fi=class extends _e{constructor(){super(...arguments),this.hasPermission=void 0}async canPerformActions(){var e,t,i,s;return![O.InProgress,O.New].includes((e=je.selectedTicket)===null||e===void 0?void 0:e.status)||((t=je.selectedTicket)===null||t===void 0?void 0:t.serviceBackend)===H.TelxSFDC||!(!((i=je.selectedTicket)===null||i===void 0)&&i.location&&!((s=je.selectedTicket)===null||s===void 0)&&s.accountNumber)?!1:this.hasPermission!==void 0?this.hasPermission:(this.hasPermission=await Nt(U.Update,I.CustomerCare,je.selectedTicket.location,je.selectedTicket.accountNumber),this.hasPermission)}dispatchClickEvent(e){const t=new CustomEvent(e,{bubbles:!0,composed:!0});this.dispatchEvent(t)}render(){return k.loadings.isTicketCancelling?P:g`<div class="w-fit flex gap-2"> ${ke(this.canPerformActions().then(e=>e?g`<ix-button name="cancel-button" class="cancel" appearance="outlined" @click="${()=>this.dispatchClickEvent(L.CancelTicket)}"> <span>${Ye}</span> </ix-button> <ix-button name="edit-button" @click="${()=>this.dispatchClickEvent(L.EditTicket)}" has-icon> <md-icon slot="icon">edit</md-icon> <span>${Ee}</span> </ix-button>`:P),P)} </div>`}};Fi.styles=[ge],Fi=E([Q("customer-care-button-group")],Fi);let ii=class extends _e{constructor(){super(...arguments),this.hasPermission=void 0,this.backendService=void 0}async getServiceBackend(){var e,t;this.backendService||(this.backendService=await Y.getServiceBackend((e=be.newTicket.site)===null||e===void 0?void 0:e.accountNumber,(t=be.newTicket.site)===null||t===void 0?void 0:t.id,"Deliveries"))}async canPerformActions(){var e,t,i,s,n,o,a,r,d,u;return((t=(e=be.selectedTicket)===null||e===void 0?void 0:e.state)===null||t===void 0?void 0:t.toLowerCase())!==O.Announced.toLowerCase()||!(!((s=(i=be.newTicket)===null||i===void 0?void 0:i.site)===null||s===void 0)&&s.id&&!((o=(n=be.newTicket)===null||n===void 0?void 0:n.site)===null||o===void 0)&&o.accountNumber)||(await this.getServiceBackend(),this.backendService===H.TelxSFDC)?!1:this.hasPermission!==void 0?this.hasPermission:(this.hasPermission=await be.hasTicketPermissionAtLocation(U.Update,I.DeliveriesRemovals,(r=(a=be.newTicket)===null||a===void 0?void 0:a.site)===null||r===void 0?void 0:r.id,(u=(d=be.newTicket)===null||d===void 0?void 0:d.site)===null||u===void 0?void 0:u.accountNumber),this.hasPermission)}dispatchClickEvent(e){const t=new CustomEvent(e,{bubbles:!0,composed:!0});this.dispatchEvent(t)}render(){return k.loadings.isTicketCancelling?P:g`<div class="w-fit flex gap-2"> ${ke(this.canPerformActions().then(e=>e?g`<ix-button name="cancel-button" class="cancel" appearance="outlined" @click="${()=>this.dispatchClickEvent(L.CancelTicket)}"> <span>${Ye}</span> </ix-button> <ix-button name="edit-button" @click="${()=>this.dispatchClickEvent(L.EditTicket)}" has-icon> <md-icon slot="icon">edit</md-icon> <span>${Ee}</span> </ix-button>`:P),P)} </div>`}};ii.styles=[ge],E([Wi()],ii.prototype,"backendService",void 0),ii=E([Q("deliveries-button-group")],ii);let Li=class extends _e{constructor(){super(...arguments),this.hasPermission=void 0}async canPerformActions(){var e,t,i,s,n,o,a,r,d,u;return((t=(e=Ve.selectedTicket)===null||e===void 0?void 0:e.status)===null||t===void 0?void 0:t.toLowerCase())!==O.Announced.toLowerCase()||!(!((s=(i=Ve.newTicket)===null||i===void 0?void 0:i.site)===null||s===void 0)&&s.id&&!((o=(n=Ve.newTicket)===null||n===void 0?void 0:n.site)===null||o===void 0)&&o.accountNumber)?!1:this.hasPermission!==void 0?this.hasPermission:(this.hasPermission=await Ve.hasTicketPermissionAtLocation(U.Update,I.DeliveriesRemovals,(r=(a=Ve.newTicket)===null||a===void 0?void 0:a.site)===null||r===void 0?void 0:r.id,(u=(d=Ve.newTicket)===null||d===void 0?void 0:d.site)===null||u===void 0?void 0:u.accountNumber),this.hasPermission)}dispatchClickEvent(e){const t=new CustomEvent(e,{bubbles:!0,composed:!0});this.dispatchEvent(t)}render(){return k.loadings.isTicketCancelling?P:g`<div class="w-fit flex gap-2"> ${ke(this.canPerformActions().then(e=>e?g`<ix-button name="cancel-button" class="cancel" appearance="outlined" @click="${()=>this.dispatchClickEvent(L.CancelTicket)}"> <span>${Ye}</span> </ix-button> <ix-button name="edit-button" @click="${()=>this.dispatchClickEvent(L.EditTicket)}" has-icon> <md-icon slot="icon">edit</md-icon> <span>${Ee}</span> </ix-button>`:P),P)} </div>`}};Li.styles=[ge],Li=E([Q("removals-button-group")],Li);const ca=e=>e?e.some(t=>t.locations.some(i=>i.status==="Outstanding")):!1,wh=e=>{switch(e){case"New":return"New Badge";case"Modify":return"Modify Badge";case"Terminate":return"Terminate All Access";default:return e}};let Vi=class extends _e{constructor(){super(...arguments),this.hasUpdatePermission=void 0,this.hasApprovePermission=void 0}async getUpdatePermissions(){var e,t,i,s;this.hasUpdatePermission!==void 0||!(!((s=(i=(t=(e=se.selectedTicket)===null||e===void 0?void 0:e.sitesDetails)===null||t===void 0?void 0:t[0])===null||i===void 0?void 0:i.locations)===null||s===void 0)&&s.length)||(this.hasUpdatePermission=await Ke(se.selectedTicket.sitesDetails[0].locations.map(n=>n.id),I.VisitorAccess,U.Update))}async getApprovePermissions(){var e,t,i,s;this.hasApprovePermission!==void 0||!(!((s=(i=(t=(e=se.selectedTicket)===null||e===void 0?void 0:e.sitesDetails)===null||t===void 0?void 0:t[0])===null||i===void 0?void 0:i.locations)===null||s===void 0)&&s.length)||(this.hasApprovePermission=await Ke(se.selectedTicket.sitesDetails[0].locations.map(n=>n.id),I.VisitorAccess,U.Approve))}get canApproveOrDeny(){var e;return!((e=se.selectedTicket)===null||e===void 0)&&e.state?se.selectedTicket.state!==O.Cancelled&&ca(se.selectedTicket.sitesDetails):!1}get canCancel(){var e;return!mt(se.selectedTicket.id)||!(!((e=se.selectedTicket)===null||e===void 0)&&e.state)?!1:[O.InProgress.toLowerCase(),re.PendingApproval.toLowerCase(),re.Approved.toLowerCase()].includes(se.selectedTicket.state.toLowerCase())}get canEdit(){var e;return!((e=se.selectedTicket)===null||e===void 0)&&e.state?![O.Cancelled.toLowerCase(),O.Completed.toLowerCase(),re.ApprovalDenied.toLowerCase()].includes(se.selectedTicket.state.toLowerCase()):!1}dispatchClickEvent(e){const t=new CustomEvent(e,{bubbles:!0,composed:!0});this.dispatchEvent(t)}renderApproveDenyBtn(){return!this.hasApprovePermission||!this.canApproveOrDeny?P:g`<ix-button name="approveDenyBtn" has-icon @click="${()=>{this.dispatchClickEvent(L.ApproveDenyTicket)}}"> <md-icon slot="icon">playlist_add_check</md-icon> <span class="button-label">APPROVE/DENY</span> </ix-button>`}renderCancelBtn(){return!this.hasUpdatePermission||!this.canCancel?P:g`<ix-button class="cancel" appearance="outlined" name="cancelBtn" @click="${()=>{this.dispatchClickEvent(L.CancelTicket)}}"> <span class="button-label">${Ye}</span> </ix-button>`}renderEditBtn(){return!this.hasUpdatePermission||!this.canEdit?P:g`<ix-button name="edit-button" @click="${()=>{this.dispatchClickEvent(L.EditTicket)}}" has-icon> <md-icon slot="icon">edit</md-icon> <span>${Ee}</span> </ix-button>`}render(){return k.loadings.isTicketCancelling?P:g`<div class="w-fit flex gap-2"> ${ke(this.getApprovePermissions().then(()=>g` ${this.renderApproveDenyBtn()}`),P)} ${ke(this.getUpdatePermissions().then(()=>g` ${this.renderCancelBtn()} ${this.renderEditBtn()}`),P)} </div>`}};Vi.styles=[ge],Vi=E([Q("visitor-access-button-group")],Vi);let Ui=class extends _e{constructor(){super(...arguments),this.hasUpdatePermission=void 0,this.hasApprovePermission=void 0}async getUpdatePermissions(){var e,t,i,s;this.hasUpdatePermission!==void 0||!(!((s=(i=(t=(e=X.selectedTicket)===null||e===void 0?void 0:e.sitesDetails)===null||t===void 0?void 0:t[0])===null||i===void 0?void 0:i.locations)===null||s===void 0)&&s.length)||(this.hasUpdatePermission=await Ke(X.selectedTicket.sitesDetails[0].locations.map(n=>n.id),I.PermanentBadge,U.Update))}async getApprovePermissions(){var e,t,i,s;this.hasApprovePermission!==void 0||!(!((s=(i=(t=(e=X.selectedTicket)===null||e===void 0?void 0:e.sitesDetails)===null||t===void 0?void 0:t[0])===null||i===void 0?void 0:i.locations)===null||s===void 0)&&s.length)||(this.hasApprovePermission=await Ke(X.selectedTicket.sitesDetails.flatMap(n=>n.locations.map(o=>o.id)),I.PermanentBadge,U.Approve))}get canApproveOrDeny(){return X.selectedTicket?X.selectedTicket.category!=="Terminate"&&X.selectedTicket.state!==O.Cancelled&&ca(X.selectedTicket.sitesDetails):!1}get canCancel(){var e;return!mt(X.selectedTicket.id)||!(!((e=X.selectedTicket)===null||e===void 0)&&e.state)||!K()["SM:AllowPermanentBadgeCancellation"]?!1:[O.InProgress.toLowerCase(),re.PendingApproval.toLowerCase(),re.Approved.toLowerCase()].includes(X.selectedTicket.state.toLowerCase())}get canEdit(){var e;return!((e=X.selectedTicket)===null||e===void 0)&&e.state?![O.Cancelled.toLowerCase(),O.Completed.toLowerCase(),re.ApprovalDenied.toLowerCase()].includes(X.selectedTicket.state.toLowerCase()):!1}dispatchClickEvent(e){const t=new CustomEvent(e,{bubbles:!0,composed:!0});this.dispatchEvent(t)}renderApproveDenyBtn(){return!this.hasApprovePermission||!this.canApproveOrDeny?P:g`<ix-button name="approveDenyBtn" has-icon @click="${()=>{this.dispatchClickEvent(L.ApproveDenyTicket)}}"> <md-icon slot="icon">playlist_add_check</md-icon> <span class="button-label">APPROVE/DENY</span> </ix-button>`}renderCancelBtn(){return!this.hasUpdatePermission||!this.canCancel?P:g`<ix-button class="cancel" appearance="outlined" name="cancelBtn" @click="${()=>{this.dispatchClickEvent(L.CancelTicket)}}"> <span class="button-label">${Ye}</span> </ix-button>`}renderEditBtn(){return!this.hasUpdatePermission||!this.canEdit?P:g`<ix-button name="edit-button" @click="${()=>{this.dispatchClickEvent(L.EditTicket)}}" has-icon> <md-icon slot="icon">edit</md-icon> <span>${Ee}</span> </ix-button>`}render(){return k.loadings.isTicketCancelling?P:g`<div class="w-fit flex gap-2"> ${ke(this.getApprovePermissions().then(()=>g` ${this.renderApproveDenyBtn()}`),P)} ${ke(this.getUpdatePermissions().then(()=>g` ${this.renderCancelBtn()} ${this.renderEditBtn()}`),P)} </div>`}};Ui.styles=[ge],Ui=E([Q("permanent-badge-button-group")],Ui);let Hi=class extends _e{constructor(){super(...arguments),this.hasUpdatePermission=void 0}async getUpdatePermissions(){var e,t,i,s;this.hasUpdatePermission!==void 0||!(!((s=(i=(t=(e=Ie.selectedTicket)===null||e===void 0?void 0:e.sitesDetails)===null||t===void 0?void 0:t[0])===null||i===void 0?void 0:i.locations)===null||s===void 0)&&s.length)||(this.hasUpdatePermission=await An(Ie.selectedTicket.site))}get canCancel(){var e;return!mt(Ie.selectedTicket.id)||!(!((e=Ie.selectedTicket)===null||e===void 0)&&e.state)?!1:[O.InProgress.toLowerCase(),re.PendingApproval.toLowerCase(),re.Approved.toLowerCase()].includes(Ie.selectedTicket.state.toLowerCase())}get canEdit(){var e;return!((e=Ie.selectedTicket)===null||e===void 0)&&e.state?![O.Cancelled.toLowerCase(),O.Completed.toLowerCase()].includes(Ie.selectedTicket.state.toLowerCase()):!1}dispatchClickEvent(e){const t=new CustomEvent(e,{bubbles:!0,composed:!0});this.dispatchEvent(t)}renderCancelBtn(){return!this.hasUpdatePermission||!this.canCancel?P:g`<ix-button class="cancel" appearance="outlined" name="cancelBtn" @click="${()=>{this.dispatchClickEvent(L.CancelTicket)}}"> <span class="button-label">${Ye}</span> </ix-button>`}renderEditBtn(){return!this.hasUpdatePermission||!this.canEdit?P:g`<ix-button name="edit-button" @click="${()=>{this.dispatchClickEvent(L.EditTicket)}}" has-icon> <md-icon slot="icon">edit</md-icon> <span>${Ee}</span> </ix-button>`}render(){return k.loadings.isTicketCancelling?P:g`<div class="w-fit flex gap-2"> ${ke(this.getUpdatePermissions().then(()=>g` ${this.renderCancelBtn()} ${this.renderEditBtn()}`),P)} </div>`}};Hi.styles=[ge],Hi=E([Q("osp-access-button-group")],Hi);let zi=class extends _e{constructor(){super(...arguments),this.hasUpdatePermission=void 0}async getUpdatePermissions(){var e,t,i,s;this.hasUpdatePermission!==void 0||!(!((s=(i=(t=(e=Ce.selectedTicket)===null||e===void 0?void 0:e.sitesDetails)===null||t===void 0?void 0:t[0])===null||i===void 0?void 0:i.locations)===null||s===void 0)&&s.length)||(this.hasUpdatePermission=await _n(Ce.selectedTicket.site))}get canCancel(){var e;return!mt(Ce.selectedTicket.id)||!(!((e=Ce.selectedTicket)===null||e===void 0)&&e.state)?!1:[O.InProgress.toLowerCase(),re.Approved.toLowerCase()].includes(Ce.selectedTicket.state.toLowerCase())}get canEdit(){var e;return!((e=Ce.selectedTicket)===null||e===void 0)&&e.state?![O.Cancelled.toLowerCase(),O.Completed.toLowerCase()].includes(Ce.selectedTicket.state.toLowerCase()):!1}dispatchClickEvent(e){const t=new CustomEvent(e,{bubbles:!0,composed:!0});this.dispatchEvent(t)}renderCancelBtn(){return!this.hasUpdatePermission||!this.canCancel?P:g`<ix-button class="cancel" appearance="outlined" name="cancelBtn" @click="${()=>{this.dispatchClickEvent(L.CancelTicket)}}"> <span class="button-label">${Ye}</span> </ix-button>`}renderEditBtn(){return!this.hasUpdatePermission||!this.canEdit?P:g`<ix-button name="edit-button" @click="${()=>{this.dispatchClickEvent(L.EditTicket)}}" has-icon> <md-icon slot="icon">edit</md-icon> <span>${Ee}</span> </ix-button>`}render(){return k.loadings.isTicketCancelling?P:g`<div class="w-fit flex gap-2"> ${ke(this.getUpdatePermissions().then(()=>g`${this.renderCancelBtn()}${this.renderEditBtn()}`),P)} </div>`}};zi.styles=[ge],zi=E([Q("pop-access-button-group")],zi);let si=class extends _e{constructor(){super(...arguments),this.hasPermission=void 0,this.backendService=void 0}async getServiceBackend(){var e;this.backendService||(this.backendService=await Y.getServiceBackend(ce.newTicket.location.accountNumber,(e=ce.newTicket.site)===null||e===void 0?void 0:e.id,"Remote_hands"))}async getPermissions(){var e,t,i,s,n,o,a,r;return!(!((t=(e=ce.newTicket)===null||e===void 0?void 0:e.location)===null||t===void 0)&&t.id&&!((s=(i=ce.newTicket)===null||i===void 0?void 0:i.location)===null||s===void 0)&&s.accountNumber)||(await this.getServiceBackend(),this.backendService===H.TelxSFDC)?!1:this.hasPermission!==void 0?this.hasPermission:(ce.loadings.ticketDetailsPermissionCheck=!0,this.hasPermission=await Nt(U.Update,I.RemoteHands,(o=(n=ce.newTicket)===null||n===void 0?void 0:n.location)===null||o===void 0?void 0:o.id,(r=(a=ce.newTicket)===null||a===void 0?void 0:a.location)===null||r===void 0?void 0:r.accountNumber),ce.loadings.ticketDetailsPermissionCheck=!1,this.hasPermission)}get canCancel(){var e,t;return this.backendService===H.ServiceNow?!1:((t=(e=ce.selectedTicket)===null||e===void 0?void 0:e.state)===null||t===void 0?void 0:t.toLowerCase())===O.New.toLowerCase()}get canEdit(){var e,t,i;const s=new Set([O.New.toLowerCase(),O.InProgress.toLowerCase()]);return!((e=ce.selectedTicket)===null||e===void 0)&&e.state?s.has((i=(t=ce.selectedTicket)===null||t===void 0?void 0:t.state)===null||i===void 0?void 0:i.toLowerCase()):!1}dispatchClickEvent(e){const t=new CustomEvent(e,{bubbles:!0,composed:!0});this.dispatchEvent(t)}render(){return k.loadings.isTicketCancelling?P:g`<div class="w-fit flex gap-2"> ${ke(this.getPermissions().then(e=>e?g` ${this.canCancel?g`<ix-button class="cancel" appearance="outlined" name="cancelRemovalsBtn" @click="${()=>{this.dispatchClickEvent(L.CancelTicket)}}"> <span class="button-label">${Cm}</span> </ix-button>`:P} ${this.canEdit?g`<ix-button name="edit-button" @click="${()=>this.dispatchClickEvent(L.EditTicket)}" has-icon> <md-icon slot="icon">edit</md-icon> <span>${Ee}</span> </ix-button>`:P}`:P),P)} </div>`}};si.styles=[ge],E([Wi()],si.prototype,"backendService",void 0),si=E([Q("remote-hands-button-group")],si);let ji=class extends _e{constructor(){super(...arguments),this.hasPermission=void 0}async canPerformActions(){var e,t,i,s,n,o;return!(!((t=(e=Ue.selectedTicket)===null||e===void 0?void 0:e.id)===null||t===void 0)&&t.toLowerCase().startsWith("cs"))||![O.Announced,O.Draft,O.New,O.InProgress].includes((i=Ue.selectedTicket)===null||i===void 0?void 0:i.state)||!(!((s=Ue.selectedTicket)===null||s===void 0)&&s.locations)||((n=Ue.selectedTicket)===null||n===void 0?void 0:n.locations.length)===0||Ue.selectedTicket.serviceBackend===H.TelxSFDC?!1:this.hasPermission!==void 0?this.hasPermission:(this.hasPermission=await Ke((o=Ue.selectedTicket)===null||o===void 0?void 0:o.locations,I.TroubleTickets,U.Update),this.hasPermission)}dispatchClickEvent(e){const t=new CustomEvent(e,{bubbles:!0,composed:!0});this.dispatchEvent(t)}render(){return k.loadings.isTicketCancelling?P:g`<div class="w-fit flex gap-2"> ${ke(this.canPerformActions().then(e=>e?g`<ix-button class="cancel" appearance="outlined" name="cancel-button" @click="${()=>{this.dispatchClickEvent(L.CancelTicket)}}"> <span class="button-label">${Ye}</span> </ix-button> <ix-button name="edit-button" @click="${()=>this.dispatchClickEvent(L.EditTicket)}" has-icon> <md-icon slot="icon">edit</md-icon> <span>${Ee}</span> </ix-button>`:P),P)} </div>`}};ji.styles=[ge],ji=E([Q("trouble-ticket-button-group")],ji);const W={Home:"Home",ServiceTickets:"Service Tickets",Reports:"Reports, Maintenance & Incident Notifications",Incidents:"Incidents",DeliveriesTicketDetails:"Deliveries Ticket Details",RemovalsTicketDetails:"Removals Ticket Details",RemoteHandsTicketDetails:"Remote Hands Ticket Details",VisitorAccessTicketDetails:"Visitor Access Ticket Details",CustomerCareTicketDetails:"Customer Care Ticket Details",PermanentBadgeTicketDetails:"Permanent Badge Ticket Details",TroubleTicketDetails:"Trouble Ticket Details",OspAccessTicketDetails:"OSP Access Ticket Details",PopAccessTicketDetails:"POP Access Ticket Details"},Dt=[{name:W.CustomerCareTicketDetails,path:"/service-tickets/customer-care/:ticketId",component:"customer-care-ticket-details-view",hideAccountSwitcher:!0,headerLeft:g`<sm-back-button></sm-back-button>`,headerRight:g`<customer-care-button-group></customer-care-button-group>`,action:()=>{import("./ui-service-management15.js")}},{name:W.DeliveriesTicketDetails,path:"/service-tickets/deliveries/:ticketId",component:"deliveries-ticket-details-view",hideAccountSwitcher:!0,headerLeft:g`<sm-back-button></sm-back-button>`,headerRight:g`<deliveries-button-group></deliveries-button-group>`,action:()=>{import("./ui-service-management19.js")}},{name:W.RemovalsTicketDetails,path:"/service-tickets/removals/:ticketId",component:"removals-ticket-details-view",hideAccountSwitcher:!0,headerLeft:g`<sm-back-button></sm-back-button>`,headerRight:g`<removals-button-group></removals-button-group>`,action:()=>{import("./ui-service-management20.js")}},{name:W.VisitorAccessTicketDetails,path:"/service-tickets/facility-access/visitor-access/:ticketId",component:"visitor-access-ticket-details-view",hideAccountSwitcher:!0,headerLeft:g`<sm-back-button></sm-back-button>`,headerRight:g`<visitor-access-button-group></visitor-access-button-group>`,action:()=>{import("./ui-service-management21.js")}},{name:W.PermanentBadgeTicketDetails,path:"/service-tickets/facility-access/permanent-badge/:ticketId",component:"permanent-badge-ticket-details-view",hideAccountSwitcher:!0,headerLeft:g`<sm-back-button></sm-back-button>`,headerRight:g`<permanent-badge-button-group></permanent-badge-button-group>`,action:()=>{import("./ui-service-management24.js")}},{name:W.RemoteHandsTicketDetails,path:"/service-tickets/remote-hands/:ticketId",component:"remote-hands-ticket-details-view",hideAccountSwitcher:!0,headerLeft:g`<sm-back-button></sm-back-button>`,headerRight:g`<remote-hands-button-group></remote-hands-button-group>`,action:()=>{import("./ui-service-management25.js")}},{name:W.TroubleTicketDetails,path:"/service-tickets/trouble-tickets/:ticketId",component:"trouble-ticket-details-view",hideAccountSwitcher:!0,headerLeft:g`<sm-back-button></sm-back-button>`,headerRight:g`<trouble-ticket-button-group></trouble-ticket-button-group>`,action:()=>{import("./ui-service-management26.js")}},{name:W.Reports,path:"/reports",component:"site-maintenance-list",action:()=>{import("./ui-service-management27.js")}}];wt.isOspEnabled()&&Dt.push({name:W.OspAccessTicketDetails,path:"/service-tickets/facility-access/osp-access/:ticketId",component:"osp-access-ticket-details-view",hideAccountSwitcher:!0,headerLeft:g`<sm-back-button></sm-back-button>`,headerRight:g`<osp-access-button-group></osp-access-button-group>`,action:()=>{import("./ui-service-management29.js")}}),wt.isPopPoeEnabled()&&Dt.push({name:W.PopAccessTicketDetails,path:"/service-tickets/facility-access/pop-access/:ticketId",component:"pop-access-ticket-details-view",hideAccountSwitcher:!0,headerLeft:g`<sm-back-button></sm-back-button>`,headerRight:g`<pop-access-button-group></pop-access-button-group>`,action:()=>{import("./ui-service-management30.js")}}),wt.isIncidentsEnabled()&&Dt.push({name:W.Incidents,path:"/incidents",component:"incidents-list",action:()=>{import("./ui-service-management31.js")}});let Mi=class extends _e{constructor(){super(...arguments),this.pageTitle="Loading..."}static get styles(){return[am]}async firstUpdated(){window.addEventListener("vaadin-router-location-changed",e=>{var t;this.pageTitle=(t=e.detail.location.route)===null||t===void 0?void 0:t.name})}get currentAccount(){return oe.getUserAccount()}get headerRight(){var e;return this.pageTitle===W.ServiceTickets?null:(e=Dt.find(t=>t.name===this.pageTitle))===null||e===void 0?void 0:e.headerRight}render(){var e,t;return g` <div class="header-container"> <h1 class="header__title">${this.pageTitle}</h1> <sm-create-service-ticket-button></sm-create-service-ticket-button> ${this.headerRight} <div class="header__profile"> ${((t=(e=oe.getUser())===null||e===void 0?void 0:e.profile)===null||t===void 0?void 0:t.email)||"Unknown User"} </div> <button @click="${()=>oe.redirectToLogout()}" class="header__logout"> <svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="currentColor"> <path d="m17 7-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4V5z"></path> </svg> Logout </button> <ix-select class="header__accounts" label="Account" .wideMenu="${!0}"> <ix-select-option value="${va(this.currentAccount.accountNumber)}" .selected="${!0}"> <div slot="headline">${this.currentAccount.name}</div> </ix-select-option> </ix-select> </div> `}};E([fe({type:String})],Mi.prototype,"pageTitle",void 0),Mi=E([Q("sm-app-header")],Mi);const fh=bt`:host{--navbar-width:256px;--logo-padding-left:0px;--navbar-icon-min-width:56px}.container{width:var(--navbar-width);transition:width .3s ease;border-radius:12px;background:linear-gradient(#1456e0 20.5%,#0d2497 113.5%);min-height:calc(100vh - 54px);margin:15px;color:#fff;padding-bottom:24px;z-index:1000;box-shadow:rgba(3,28,82,.24) 0 8px 24px;text-align:center}.navigation-logo{user-select:none;display:inline-block;fill:currentcolor;flex-shrink:0;transition:fill .2s cubic-bezier(.4,0,.2,1) 0s;font-size:1.5rem;width:178px!important;height:27px!important;padding-top:24px;padding-bottom:18px;padding-left:var(--logo-padding-left)}ul{list-style:none;margin:0;position:relative;padding:8px 4px}ul li a{-webkit-tap-highlight-color:transparent;background-color:transparent;outline:0;border:0;margin:0;cursor:pointer;user-select:none;vertical-align:middle;appearance:none;color:inherit;display:flex;-webkit-box-flex:1;flex-grow:1;-webkit-box-align:center;align-items:center;position:relative;text-decoration:none;min-width:0;box-sizing:border-box;text-align:left;transition:background-color 150ms cubic-bezier(.4,0,.2,1) 0s;padding:12px 16px;border-radius:8px;opacity:.6;text-overflow:ellipsis;white-space:nowrap;-webkit-box-pack:unset;justify-content:unset}a.active,ul li a:hover{background:rgba(255,255,255,.16);opacity:1}.navigation-icon svg{user-select:none;width:1em;height:1em;display:inline-block;fill:currentcolor;transition:fill .2s cubic-bezier(.4,0,.2,1) 0s;font-size:1.5rem;flex-shrink:0;display:inline-flex;color:inherit;min-width:var(--navbar-icon-min-width)}h6{margin:0;font-weight:700;line-height:24px;letter-spacing:.1px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:inherit}.divider{border-color:#fff;opacity:.2;margin:0;flex-shrink:0;border-width:0 0 thin;border-style:solid}.container.compact{--navbar-width:80px}.container.compact .navigation-logo{--logo-padding-left:28px}.container.compact .navigation-icon svg{--navbar-icon-min-width:42px}@media only screen and (min-width:5px) and (max-width:500px){.container{--navbar-width:100%;min-height:auto;margin:0;border-radius:0;padding-bottom:0}.container.compact{--navbar-width:100%}}@media only screen and (min-width:500px) and (max-width:1250px){.container{--navbar-width:100%;min-height:auto;margin:0;border-radius:0;padding-bottom:0}.container.compact{--navbar-width:100%}}`,da=bt`@font-face{font-family:'Material Icons';font-style:normal;font-weight:400;src:url(https://fonts.gstatic.com/s/materialicons/v145/flUhRq6tzZclQEJ-Vdg-IuiaDsNZ.ttf) format('truetype')}.material-icons{font-family:'Material Icons';font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr}@font-face{font-family:'Material Symbols Outlined';font-style:normal;font-weight:400;src:url(https://fonts.gstatic.com/s/materialsymbolsoutlined/v364/kJF1BvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oDMzByHX9rA6RzaxHMPdY43zj-jCxv3fzvRNU22ZXGJpEpjC_1v-p_4MrImHCIJIZrDCvHOem.ttf) format('truetype')}.material-symbols-outlined{font-family:'Material Symbols Outlined';font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr}.title{font-style:normal;font-weight:700;font-size:20px;line-height:24px;letter-spacing:.15px}.temp-button{border:none;padding:10px;color:#fff;border-radius:100px;cursor:pointer;margin-right:10px;text-decoration:none;font-family:var(--root-secondary-font);font-weight:700;font-style:normal;font-size:14px;line-height:18.52px;letter-spacing:1.25px;text-transform:uppercase}.temp-button span{padding:20px}.temp-button:disabled{background-color:#ddd}.flex{display:flex}.flex-1{flex:1}.border-top-solid-gray{border-top:solid 1px #ddd}.red{background-color:#db0028}.blue{background-color:#1456e0}.white{background-color:#fff;color:#1456e0;border:solid 1px #1456e0}.right{float:right}.margin-top-20{margin-top:20px}.padding-2{padding:2px}.padding-20{padding:20px}.padding-right-10{padding:10px}.font-14{font-size:14px}.button-container{position:absolute;bottom:30px;margin-left:10px}.temp-button span{padding:5px;font-size:20px}@media only screen and (min-width:5px) and (max-width:500px){.button-container{right:10px;top:10px}}@media only screen and (min-width:500px) and (max-width:1250px){.button-container{right:10px;top:10px}}`;let ua=class extends Rt{static get styles(){return[da]}render(){return g` <div class="button-container"> <button @click="${()=>{localStorage.clear(),rt.go("/")}}" class="temp-button white"> <span class="material-icons"> <md-icon slot="icon">restart_alt</md-icon> </span> </button> </div> `}};ua=E([Q("dev-clear-storage-button-service")],ua);const ni={digitalRealtyLogo:Ot`
|
|
1065
1065
|
<path d="M17.6281 26.4421V23.1369C20.6656 23.1369 23.1369 20.6657 23.1369 17.6281H26.4421C26.4421 22.4881 22.4881 26.4421 17.6281 26.4421ZM17.6281 0V3.30527C20.6656 3.30527 23.1369 5.77647 23.1369 8.81404H26.4421C26.4421 3.95398 22.4881 0 17.6281 0ZM8.81404 23.1369H3.30527V17.6281H0V26.4421H8.81404V23.1369ZM3.30527 3.30527H8.81404V0H0V8.81404H3.30527V3.30527Z"></path>
|
|
1066
1066
|
`,digitalRealtyLogoWithText:Ot`
|
|
1067
1067
|
<path d="M174.823 18.1256V18.338H174.216V19.7581H173.986V18.338H173.379V18.1256H174.823ZM175.376 18.1256L176.025 19.4728L176.68 18.1256H177.002V19.7581H176.784V18.3865L176.116 19.7581H175.928L175.272 18.3865V19.7581H175.06V18.1256H175.376Z"></path>
|
|
@@ -1071,4 +1071,4 @@ video {
|
|
|
1071
1071
|
<path d="M4 4C2.897 4 2 4.897 2 6V16C2 17.103 2.897 18 4 18H0V20H24V18H20C21.103 18 22 17.103 22 16V6C22 4.897 21.103 4 20 4H4ZM4 6H20L20.002 16H4V6ZM14.2852 8.00781L11 11.293L9.20703 9.5L7.79297 10.9141L11 14.1211L15.6992 9.42188L14.2852 8.00781Z"></path>
|
|
1072
1072
|
`,reportsIcon:Ot`
|
|
1073
1073
|
<path d="M6 2C4.90575 2 4 2.90575 4 4V20C4 21.0943 4.90575 22 6 22H11V20H6V4H13V9H18V13H20V8L14 2H6ZM12 11V14H15C15 12.343 13.641 11.031 12 11ZM11 12C9.343 12 8 13.343 8 15C8 16.657 9.343 18 11 18C12.657 18 13.969 16.641 14 15H11V12ZM16 15V21H13C13 22.654 14.346 24 16 24H21C22.645 24 24 22.645 24 21V15H16ZM18 17H22V21C22 21.565 21.565 22 21 22C20.449 22 20 21.552 20 21H18V17Z" fill="white"/>
|
|
1074
|
-
`};let
|
|
1074
|
+
`};let Ji=class extends Rt{constructor(){super(...arguments),this.navigationItems=[],this.compact=!1}static get styles(){return[ge,fh]}firstUpdated(){window.addEventListener("vaadin-router-location-changed",()=>{this.requestUpdate(),this.navigationItems.length||(this.navigationItems=[{href:Qt(W.ServiceTickets),title:W.ServiceTickets,icon:g`<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24"> ${ni.serviceTicketsIcon} </svg>`},{href:Qt(W.Reports),title:W.Reports,icon:g`<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24"> ${ni.reportsIcon} </svg>`}])})}toggleCompact(){this.compact=!this.compact}renderItems(){return g` <ul> ${this.navigationItems.map(e=>g` <li> <a href="${e.href}" class="${e.href===window.location.pathname?"active":""}"> <div class="navigation-icon">${e.icon}</div> ${this.compact?"":g`<h6 class="dlr-text-small">${e.title}</h6>`} </a> </li> `)} </ul>`}render(){return g` <div class="${`container ${this.compact?"compact":""}`}"> <svg @click="${this.toggleCompact}" class="navigation-logo" focusable="false" aria-hidden="true" viewBox="0 0 178 27"> ${this.compact?ni.digitalRealtyLogo:ni.digitalRealtyLogoWithText} </svg> <hr class="divider"> ${this.renderItems()} <dev-clear-storage-button-service></dev-clear-storage-button-service> </div> `}};E([fe({type:Boolean,attribute:!1})],Ji.prototype,"compact",void 0),Ji=E([Q("sm-navigation-bar")],Ji);const kh=bt`:host{display:block;font-size:calc(10px + 2vmin);color:#1a2b42;margin:0 auto;background-color:#f5f7ff;font-size:18px;--desktop-device-width:1920px;--tablet-device-width:1024px;--mobile-device-width:375px}.service-management__body{display:flex;flex-direction:column}.service-management__body.standalone{flex-direction:row}.center-container{flex-grow:1;padding:40px;padding-bottom:48px}main{flex-grow:1;max-width:100%}.create-service-ticket-btn{font-family:var(--root-secondary-font);font-weight:700;font-style:normal;font-size:14px;line-height:18.52px;letter-spacing:1.25px}@media only screen and (min-width:5px) and (max-width:500px){.service-management__body.standalone{flex-direction:column}}@media only screen and (min-width:500px) and (max-width:1250px){.service-management__body.standalone{flex-direction:column}}`;class yh{constructor(){this.isStandalone=!1,ne(this),Je(this,{name:"app-state",properties:["isStandalone"],storage:window.sessionStorage})}}const la=new yh;let Me=class extends Rt{constructor(){super(...arguments),this.routes=[],this.baseUrl="",this.sessionToken="",this.disableAuthentication=!1,this.isStandalone=!1,this.appIsVisible=!1,this.handleErrorRaised=e=>{this.errorMessage=e.detail}}static get styles(){return[ma,ge,kh]}updated(e){e.has("routes")&&this.routes.length&&Rm().setRoutes(this.routes)}async firstUpdated(){la.isStandalone=this.isStandalone,this.configureAuth(),this.init(),this.configureMomentCalendarDate(),await J.fillLookups()}configureAuth(){this.disableAuthentication||K().DisableServiceManagementUIAuth?this.appIsVisible=!0:oe.isProcessing()||(oe.isLoggedIn()?this.appIsVisible=!0:oe.redirectToAuth())}configureMomentCalendarDate(){const e=nm().toUpperCase();G.updateLocale("en",{calendar:{sameDay:`[Today], ${e}`,lastDay:`[Yesterday], ${e}`,lastWeek:`${e}`,sameElse:`${e}`}})}init(){window.addEventListener(L.ErrorRaised,this.handleErrorRaised),setTimeout(()=>{var e;const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("main");t&&bm(t,this.baseUrl,Dt)})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener(L.ErrorRaised,this.handleErrorRaised),Am()}clearErrorMessage(){this.errorMessage=void 0}renderNavBar(){return this.isStandalone?g`<sm-navigation-bar></sm-navigation-bar>`:P}renderBody(){return this.isStandalone?g`<div class="center-container"> <sm-app-header></sm-app-header> <main></main> </div>`:g`<main></main>`}render(){return this.appIsVisible?g` <div class="md:mx-4 lg:mx-0 service-management__body ${this.isStandalone?"standalone":""}"> ${this.renderNavBar()} ${this.renderBody()} <ix-dialog ?open="${this.errorMessage}" @closed="${this.clearErrorMessage}"> <div slot="content" method="dialog">${this.errorMessage}</div> <div class="dialog-actions" slot="actions"> <ix-button id="dialogCloseBtn" ariaLabel="Close" appearance="text" text="Close" @click="${this.clearErrorMessage}"> <span>Close</span> </ix-button> </div> </ix-dialog> </div> `:P}};E([fe({type:Array})],Me.prototype,"routes",void 0),E([fe({type:String})],Me.prototype,"baseUrl",void 0),E([fe({type:String})],Me.prototype,"sessionToken",void 0),E([fe({type:Boolean,attribute:!0})],Me.prototype,"disableAuthentication",void 0),E([fe({type:Boolean,attribute:!0})],Me.prototype,"isStandalone",void 0),E([fe({type:Boolean,attribute:!1})],Me.prototype,"appIsVisible",void 0),E([fe({type:String,attribute:!1})],Me.prototype,"errorMessage",void 0),Me=E([Q("ui-service-management")],Me);export{Gm as $,L as A,cm as B,om as C,Bm as D,Um as E,O as F,Om as G,Ta as H,Aa as I,xm as J,w as K,U as L,Ni as M,un as N,Sm as O,Zl as P,gt as Q,W as R,H as S,ge as T,zm as U,jm as V,qn as W,Hm as X,lt as Y,J as Z,rm as _,y as a,jn as a$,It as a0,Wm as a1,ap as a2,sp as a3,np as a4,Nt as a5,ee as a6,gm as a7,wn as a8,fn as a9,Xp as aA,Ce as aB,In as aC,nh as aD,Em as aE,Nn as aF,We as aG,Zp as aH,Tm as aI,Yn as aJ,Gp as aK,sm as aL,xn as aM,Mm as aN,Jm as aO,fa as aP,Oi as aQ,op as aR,Vn as aS,Ue as aT,yu as aU,m as aV,um as aW,Dm as aX,ft as aY,ei as aZ,ba as a_,kn as aa,yn as ab,$e as ac,Yt as ad,wh as ae,ut as af,F as ag,Ct as ah,ea as ai,oa as aj,re as ak,Pn as al,ct as am,ka as an,se as ao,Pm as ap,Nm as aq,X as ar,Ei as as,Ip as at,Mn as au,Gi as av,Ep as aw,$m as ax,Ie as ay,Sn as az,mn as b,Pt as b0,hp as b1,vp as b2,Jl as b3,da as b4,mh as b5,ti as b6,Jt as b7,Ke as b8,l as b9,wp as ba,fp as bb,Gl as bc,Ml as bd,Ii as be,kp as bf,yp as bg,Bi as bh,gi as c,be as d,k as e,la as f,wt as g,oe as h,wa as i,tm as j,Pi as k,Wl as l,Qt as m,Fm as n,Lm as o,K as p,im as q,Ve as r,Y as s,qm as t,vm as u,I as v,ce as w,Im as x,je as y,wm as z};
|