@orangelogic/orange-dam-content-browser-sdk 2.2.0-beta-77 → 2.2.0-figma-beta-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.
@@ -653,7 +653,7 @@
653
653
  .version__item__editor {
654
654
  color: var(--cx-color-primary);
655
655
  }
656
- `;var nr=n(3943);const rr=e=>{let{src:t,alt:n}=e;const[r,o]=(0,wt.useState)("horizontal"),i=(0,wt.useRef)(null),a=(0,wt.useCallback)((()=>{if(i.current){const{naturalWidth:e,naturalHeight:t}=i.current;o(e>t?"horizontal":"vertical")}}),[]);return(0,Vt.jsx)("div",{className:`version__item__preview version__item__preview--${r}`,children:(0,Vt.jsx)("img",{ref:i,src:t,alt:n,onLoad:a})})},or=e=>{let{src:t}=e;const[n,r]=(0,wt.useState)("horizontal"),o=(0,wt.useRef)(null),i=(0,wt.useCallback)((()=>{if(o.current){const{videoWidth:e,videoHeight:t}=o.current;r(e>t?"horizontal":"vertical")}}),[]);return(0,Vt.jsx)("div",{className:`version__item__preview version__item__preview--${n}`,children:(0,Vt.jsx)("video",{ref:o,src:t,onLoadedMetadata:i,controls:!0})})},ir=e=>{var t;let{assetId:n}=e;const{data:r,isFetching:o,isLoading:i}=(0,nr.cP)(n?{assetId:n}:Ft.hT);return o||i?(0,Vt.jsx)(tr,{children:(0,Vt.jsx)("cx-spinner",{})}):(0,Vt.jsx)(tr,{children:(0,Vt.jsx)("cx-menu",{children:null===r||void 0===r||null===(t=r.versions)||void 0===t?void 0:t.map(((e,t)=>(0,Vt.jsx)("cx-menu-item",{className:"version__item",readonly:!0,children:(0,Vt.jsxs)("cx-grid",{columns:5,spacing:"12px",children:[(0,Vt.jsx)("cx-grid-item",{xs:"2",sm:"2",children:(0,Vt.jsxs)("cx-space",{direction:"horizontal","align-items":"center",wrap:"nowrap",children:[(0,Vt.jsx)("div",{className:"version__item__number",children:(0,Vt.jsx)($t,{lines:1,children:e.versionNumberDisplay})}),e.scrubUrl?(0,Vt.jsx)(or,{src:e.scrubUrl}):(0,Vt.jsx)(rr,{src:e.versionFileUrl,alt:e.versionFileName})]})}),(0,Vt.jsx)("cx-grid-item",{xs:"2",sm:"3",children:(0,Vt.jsxs)("cx-space",{direction:"vertical",spacing:"2x-small",children:[(0,Vt.jsx)($t,{lines:1,children:(0,Vt.jsx)("cx-typography",{variant:"body3",className:"version__item__name",children:e.versionFileName})}),(0,Vt.jsx)($t,{lines:1,children:(0,Vt.jsx)("cx-typography",{variant:"body3",children:e.createByEmail})}),(0,Vt.jsxs)("cx-typography",{variant:"body3",children:[e.versionCreateDate.split(" ")[0],0===t&&(0,Vt.jsx)("span",{className:"version__item__latest",children:"Current version"})]})]})})]})},e.versionNumber)))})})},ar=CSS.supports("(overlay: auto)")&&"showPopover"in document.createElement("div"),sr={previewLoadable:!1,defaultSize:{width:0,height:0},selectedProxy:"",defaultSelectedProxy:"",selectedFormat:{url:"",originalUrl:"",width:0,height:0,x:0,y:0,extension:"",rotation:0},defaultSelectedFormat:{url:"",originalUrl:"",width:0,height:0,x:0,y:0,extension:"",rotation:0},resizeSize:{width:0,height:0,unit:dn.Nf.Pixel},lastResizeSize:{[dn.Nf.AspectRatio]:{width:0,height:0,unit:dn.Nf.AspectRatio},[dn.Nf.Pixel]:{width:0,height:0,unit:dn.Nf.Pixel}},cropSize:{width:0,height:0,percentageWidth:0,percentageHeight:0,x:0,y:0,unit:dn.Nf.Pixel},lastCropSize:{[dn.Nf.AspectRatio]:{width:0,height:0,percentageWidth:0,percentageHeight:0,x:0,y:0,unit:dn.Nf.AspectRatio},[dn.Nf.Pixel]:{width:0,height:0,percentageWidth:0,percentageHeight:0,x:0,y:0,unit:dn.Nf.Pixel}},isLoadingConfirm:!1,isLoadingFavorites:!1,rotation:0,quality:100,keepMetadata:!1,transformations:[],confirmedTransformations:[],enabledTracking:!1,trackingParameters:[{key:"UTM_source",value:""},{key:"UTM_campaign",value:""},{key:"UTM_description",value:""}],showCustomRendition:!1,showVersionHistory:!1,useCustomRendition:!1,useRepresentative:!1,activeSetting:"format",isLoading:!1},lr=(e,t)=>{switch(t.type){case"CANCEL_USE_CUSTOM_RENDITION":return{...e,cropSize:{...e.cropSize,width:t.payload.width,height:t.payload.height},resizeSize:{...e.resizeSize,width:t.payload.width,height:t.payload.height},selectedFormat:{...e.selectedFormat,...t.payload,rotation:0,x:0,y:0},rotation:0,transformations:e.useCustomRendition?e.confirmedTransformations:[],showCustomRendition:!1,activeSetting:"format",selectedProxy:t.payload.selectedProxy};case"CONFIRM_USE_CUSTOM_RENDITION":return{...e,confirmedTransformations:e.transformations,cropSize:{...e.cropSize,width:e.selectedFormat.width,height:e.selectedFormat.height},resizeSize:{...e.resizeSize,width:e.selectedFormat.width,height:e.selectedFormat.height},rotation:0,activeSetting:"format",showCustomRendition:!1,useCustomRendition:!0,defaultSelectedFormat:{...e.selectedFormat},defaultSelectedProxy:e.selectedProxy};case"SET_DEFAULT_SIZE":return{...e,defaultSize:{...e.defaultSize,...t.payload}};case"RESET_DATA":return sr;case"SET_ACTIVE_SETTING":return{...e,activeSetting:t.payload};case"SET_CROP_SIZE":return{...e,cropSize:{...e.cropSize,...t.payload}};case"SET_ENABLED_TRACKING":return{...e,enabledTracking:t.payload};case"SET_KEEP_METADATA":return{...e,keepMetadata:t.payload};case"SET_LAST_CROP_SIZE":return{...e,lastCropSize:{...e.lastCropSize,...t.payload}};case"SET_LAST_RESIZE_SIZE":return{...e,lastResizeSize:{...e.lastResizeSize,...t.payload}};case"SET_LOADING":return{...e,isLoading:t.payload};case"SET_LOADING_CONFIRM":return{...e,isLoadingConfirm:t.payload};case"SET_LOADING_FAVORITES":return{...e,isLoadingFavorites:t.payload};case"SET_PREVIEW_LOADABLE":return{...e,previewLoadable:t.payload};case"SET_QUALITY":return{...e,quality:t.payload};case"SET_RESIZE_SIZE":return{...e,resizeSize:{...e.resizeSize,...t.payload}};case"SET_ROTATION":return{...e,rotation:t.payload};case"SET_SELECTED_FORMAT":return{...e,selectedFormat:{...e.selectedFormat,...t.payload}};case"SET_SELECTED_PROXY":return t.payload?"string"===typeof t.payload?{...e,selectedProxy:t.payload,useCustomRendition:!1,useRepresentative:!1}:{...e,selectedProxy:t.payload.proxy,useCustomRendition:Boolean(t.payload.useCustomRendition),useRepresentative:!1}:{...e,selectedProxy:"",useCustomRendition:!1,useRepresentative:!1};case"SET_SHOW_CUSTOM_RENDITION":return{...e,showCustomRendition:t.payload};case"SET_SHOW_VERSION_HISTORY":return{...e,showVersionHistory:t.payload};case"SET_TRACKING_PARAMETERS":return{...e,trackingParameters:t.payload};case"SET_TRANSFORMATIONS":return{...e,transformations:[...e.transformations,t.payload]};case"SET_USE_REPRESENTATIVE":return{...e,selectedProxy:t.payload?"":e.selectedProxy,useRepresentative:t.payload};default:return e}},cr=e=>{let{allowCustomFormat:t,allowFavorites:n,allowProxy:r,allowTracking:o,allowedExtensions:i,appendAutoExtension:a,autoExtension:s,availableExtensions:l,availableProxies:c,ctaText:u="Insert",extensions:d,isFavorite:h,maxHeight:p,open:f,previewUrl:m,selectedAsset:g,showVersions:v,supportedRepresentativeSubtypes:b,variant:y="dialog",boundary:x,onClose:w,onFavorite:S,onProxyConfirm:k,onFormatConfirm:_,onUnFavorite:C}=e;const[E,A]=(0,wt.useReducer)(lr,sr),[T,O]=(0,wt.useState)(!1),P=(0,wt.useRef)(null),z=(0,wt.useRef)(null),D=(0,wt.useRef)(null),R=(0,wt.useMemo)((()=>i?c?c.filter((e=>{if(!e.extension&&g){return!!(null===i||void 0===i?void 0:i.some((e=>e===g.extension.replace(/^\./,""))))}return!0})):[]:c),[c,i,g]),j=(0,wt.useCallback)((()=>{if(!g)return;const e=hn(E.defaultSize.width,E.defaultSize.height);A({type:"SET_RESIZE_SIZE",payload:{...sr.resizeSize,width:E.defaultSize.width,height:E.defaultSize.height}}),A({type:"SET_CROP_SIZE",payload:{...sr.cropSize,width:E.defaultSize.width,height:E.defaultSize.height,percentageHeight:100,percentageWidth:100}}),A({type:"SET_ROTATION",payload:0}),A({type:"SET_LAST_CROP_SIZE",payload:{...sr.lastCropSize,[dn.Nf.Pixel]:{width:E.defaultSize.width,height:E.defaultSize.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:e.width,height:e.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.AspectRatio}}}),A({type:"SET_LAST_RESIZE_SIZE",payload:{[dn.Nf.Pixel]:{width:E.defaultSize.width,height:E.defaultSize.height,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:e.width,height:e.height,unit:dn.Nf.AspectRatio}}});let t=g.extension;if(a)t=s;else if(g.docType){var n,r,o,i;if(null!==l&&void 0!==l&&null!==(n=l[g.docType])&&void 0!==n&&n.map((e=>e.value)).includes(g.extension))t=g.extension;else t=null!==(r=null===l||void 0===l||null===(o=l[g.docType])||void 0===o||null===(i=o[0])||void 0===i?void 0:i.value)&&void 0!==r?r:""}var c;R&&R.length>0?(A({type:"SET_SELECTED_PROXY",payload:null===(c=R[0])||void 0===c?void 0:c.id}),A({type:"SET_SELECTED_FORMAT",payload:{...sr.selectedFormat,url:g.imageUrl,originalUrl:g.originalUrl,extension:t,width:R[0].formatWidth||E.defaultSize.width,height:R[0].formatHeight||E.defaultSize.height}})):A({type:"SET_SELECTED_FORMAT",payload:{...sr.selectedFormat,url:g.imageUrl,originalUrl:g.originalUrl,extension:t,width:E.defaultSize.width,height:E.defaultSize.height}})}),[s,R,g,E.defaultSize.height,E.defaultSize.width,a,l]);(0,wt.useEffect)((()=>{null!==g&&void 0!==g&&g.width&&null!==g&&void 0!==g&&g.height&&A({type:"SET_DEFAULT_SIZE",payload:{width:parseInt(g.width,10),height:parseInt(g.height,10)}})}),[null===g||void 0===g?void 0:g.width,null===g||void 0===g?void 0:g.height]),(0,wt.useEffect)((()=>{Promise.all([customElements.whenDefined("cx-dialog"),customElements.whenDefined("cx-drawer"),customElements.whenDefined("cx-dropdown")]).then((()=>{O(!0)}))}),[]),(0,wt.useEffect)((()=>{const e=e=>{E.isLoadingFavorites?e.preventDefault():E.showVersionHistory?(e.preventDefault(),A({type:"SET_SHOW_VERSION_HISTORY",payload:!1})):(A({type:"SET_PREVIEW_LOADABLE",payload:!1}),A({type:"RESET_DATA"}),w())},t=P.current,n=z.current;return null===t||void 0===t||t.addEventListener("cx-request-close",e),null===n||void 0===n||n.addEventListener("cx-request-close",e),()=>{null===t||void 0===t||t.removeEventListener("cx-request-close",e),null===n||void 0===n||n.removeEventListener("cx-request-close",e)}}),[x,T,w,E.isLoadingFavorites,E.showVersionHistory]),(0,wt.useEffect)((()=>{const e=P.current;e&&x&&(e.boundary=x)})),(0,wt.useEffect)((()=>{const e=()=>{A({type:"SET_PREVIEW_LOADABLE",payload:!0})},t=P.current,n=z.current;return null===t||void 0===t||t.addEventListener("cx-after-show",e),null===n||void 0===n||n.addEventListener("cx-after-show",e),()=>{null===t||void 0===t||t.removeEventListener("cx-after-show",e),null===n||void 0===n||n.removeEventListener("cx-after-show",e)}}),[T,E.showCustomRendition,y]),(0,wt.useEffect)((()=>{const e=e=>{const t=e.detail.item.value;if("custom"===t)return A({type:"SET_SHOW_CUSTOM_RENDITION",payload:!0}),void(E.useCustomRendition||j());if("tracking"!==t)if("use-representative"!==t){if(t&&R){if(!R.map((e=>e.id)).includes(t))return;A({type:"SET_SELECTED_PROXY",payload:t})}}else A({type:"SET_USE_REPRESENTATIVE",payload:!E.useRepresentative});else A({type:"SET_ENABLED_TRACKING",payload:!E.enabledTracking})},t=P.current,n=z.current;return null===t||void 0===t||t.addEventListener("cx-select",e),null===n||void 0===n||n.addEventListener("cx-select",e),()=>{null===t||void 0===t||t.removeEventListener("cx-select",e),null===n||void 0===n||n.removeEventListener("cx-select",e)}}),[T,E.enabledTracking,E.useCustomRendition,E.useRepresentative,j,R,null===g||void 0===g?void 0:g.extension]),(0,wt.useEffect)((()=>{j()}),[j]);const N=(0,wt.useMemo)((()=>{var e;return(null===b||void 0===b?void 0:b.includes(null!==(e=null===g||void 0===g?void 0:g.docSubType)&&void 0!==e?e:""))&&(null===g||void 0===g?void 0:g.imageUrl)}),[g,b]),I=(0,wt.useCallback)((e=>{A({type:"SET_LOADING",payload:e})}),[]),M=(0,wt.useCallback)((async(e,t,n,r)=>{if(!g)return;const o=E.selectedFormat.width||E.defaultSize.width,i=E.selectedFormat.height||E.defaultSize.height;if(A({type:"SET_RESIZE_SIZE",payload:{width:e,height:t,unit:n}}),r){var a;let r=e,s=t;E.resizeSize.unit!==n?(r=o,s=i):n===dn.Nf.AspectRatio&&(r=Math.round(e/t*i),s=i);const l=await(null===(a=D.current)||void 0===a?void 0:a.applyResize());A({type:"SET_SELECTED_FORMAT",payload:{url:l,width:r,height:s}}),A({type:"SET_TRANSFORMATIONS",payload:{key:dn.YQ.Resize,value:{width:r,height:s}}}),A({type:"SET_CROP_SIZE",payload:{width:r,height:s}});const c=hn(r,s);A({type:"SET_LAST_RESIZE_SIZE",payload:{[dn.Nf.Pixel]:{width:r,height:s,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:n===dn.Nf.AspectRatio?e:c.width,height:n===dn.Nf.AspectRatio?t:c.height,unit:dn.Nf.AspectRatio}}}),A({type:"SET_LAST_CROP_SIZE",payload:{[dn.Nf.Pixel]:{width:r,height:s,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:n===dn.Nf.AspectRatio?e:c.width,height:n===dn.Nf.AspectRatio?t:c.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.AspectRatio}}})}}),[g,E.defaultSize.height,E.defaultSize.width,E.resizeSize.unit,E.selectedFormat.height,E.selectedFormat.width]),F=(0,wt.useCallback)((async(e,t,n,r)=>{var o,i;if(!g)return;const a=E.cropSize.unit,s=D.current;if(s&&null!==(o=E.selectedFormat)&&void 0!==o&&o.width&&null!==(i=E.selectedFormat)&&void 0!==i&&i.height){if(n===a&&n===dn.Nf.Pixel){const n=Math.max(e/E.selectedFormat.width,t/E.selectedFormat.height);s.setZoom(1/n)}n!==a&&s.setZoom(1)}if(A({type:"SET_CROP_SIZE",payload:{width:e,height:t,unit:n}}),r){var l;const r=await(null===(l=D.current)||void 0===l?void 0:l.applyCrop());let o=e,i=t;n===dn.Nf.AspectRatio&&(o=Math.round(E.cropSize.percentageWidth*E.selectedFormat.width/100),i=Math.round(E.cropSize.percentageHeight*E.selectedFormat.height/100)),null===s||void 0===s||s.setZoom(1);const a=Number((E.cropSize.x/100*E.selectedFormat.width).toFixed(0)),c=Number((E.cropSize.y/100*E.selectedFormat.height).toFixed(0));A({type:"SET_SELECTED_FORMAT",payload:{url:r,width:o,height:i}}),A({type:"SET_RESIZE_SIZE",payload:{width:o,height:i,unit:dn.Nf.Pixel}}),A({type:"SET_TRANSFORMATIONS",payload:{key:dn.YQ.Crop,value:{width:Number(o.toFixed(0)),height:Number(i.toFixed(0)),x:a,y:c}}});const u=hn(o,i);A({type:"SET_LAST_CROP_SIZE",payload:{[dn.Nf.Pixel]:{width:Math.round(o),height:Math.round(i),percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:n===dn.Nf.AspectRatio?e:u.width,height:n===dn.Nf.AspectRatio?t:u.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.AspectRatio}}}),A({type:"SET_LAST_RESIZE_SIZE",payload:{[dn.Nf.Pixel]:{width:o,height:i,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:n===dn.Nf.AspectRatio?e:u.width,height:n===dn.Nf.AspectRatio?t:u.height,unit:dn.Nf.AspectRatio}}})}}),[g,E.cropSize,E.selectedFormat.height,E.selectedFormat.width]),L=(0,wt.useCallback)((async(e,t)=>{if(A({type:"SET_ROTATION",payload:t?0:e}),t){var n;const{width:t,height:r}=pn(E.selectedFormat.width,E.selectedFormat.height,e),o=await(null===(n=D.current)||void 0===n?void 0:n.applyRotation());A({type:"SET_SELECTED_FORMAT",payload:{rotation:e,url:o,width:t,height:r}}),A({type:"SET_TRANSFORMATIONS",payload:{key:dn.YQ.Rotate,value:{rotation:e}}}),A({type:"SET_CROP_SIZE",payload:{width:t,height:r}}),A({type:"SET_RESIZE_SIZE",payload:{width:t,height:r,unit:dn.Nf.Pixel}});const i=hn(t,r);A({type:"SET_LAST_CROP_SIZE",payload:{[dn.Nf.Pixel]:{width:t,height:r,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:i.width,height:i.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.AspectRatio}}}),A({type:"SET_LAST_RESIZE_SIZE",payload:{[dn.Nf.Pixel]:{width:t,height:r,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:i.width,height:i.height,unit:dn.Nf.AspectRatio}}})}}),[E.selectedFormat]),B=(0,wt.useCallback)((e=>{A({type:"SET_SELECTED_FORMAT",payload:{extension:e}})}),[]),U=(0,wt.useCallback)((e=>{A({type:"SET_CROP_SIZE",payload:{width:E.selectedFormat.width,height:E.selectedFormat.height,unit:dn.Nf.Pixel}}),A({type:"SET_RESIZE_SIZE",payload:{width:E.selectedFormat.width,height:E.selectedFormat.height,unit:dn.Nf.Pixel}}),A({type:"SET_ROTATION",payload:0}),A({type:"SET_ACTIVE_SETTING",payload:e})}),[E.selectedFormat]),V=(0,wt.useCallback)((()=>{A({type:"SET_SHOW_VERSION_HISTORY",payload:!0})}),[]),q=(0,wt.useCallback)((e=>{let t=e.formatWidth,n=e.formatHeight;"TRX"===e.proxyName&&g&&(t=Number(g.width),n=Number(g.height)),A({type:"SET_SELECTED_PROXY",payload:{proxy:e.id,useCustomRendition:!0}}),A({type:"SET_SELECTED_FORMAT",payload:{url:null===g||void 0===g?void 0:g.imageUrl,width:t,height:n}}),A({type:"SET_RESIZE_SIZE",payload:{width:t,height:n,unit:dn.Nf.Pixel}}),A({type:"SET_CROP_SIZE",payload:{width:t,height:n,percentageWidth:100,percentageHeight:100,x:0,y:0,unit:dn.Nf.Pixel}});const r=hn(t,n);A({type:"SET_LAST_CROP_SIZE",payload:{[dn.Nf.Pixel]:{width:Math.round(t),height:Math.round(n),percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:r.width,height:r.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.AspectRatio}}}),A({type:"SET_LAST_RESIZE_SIZE",payload:{[dn.Nf.Pixel]:{width:t,height:n,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:r.width,height:r.height,unit:dn.Nf.AspectRatio}}})}),[g]),H=(0,wt.useCallback)((e=>{A({type:"SET_QUALITY",payload:e}),A({type:"SET_TRANSFORMATIONS",payload:{key:dn.YQ.Quality,value:{quality:e}}})}),[]),W=(0,wt.useCallback)((e=>{A({type:"SET_KEEP_METADATA",payload:e}),A({type:"SET_TRANSFORMATIONS",payload:{key:dn.YQ.KeepMetadata,value:{keepMetadata:e}}})}),[]);(0,wt.useEffect)((()=>{R&&0!==R.length?A({type:"SET_SELECTED_PROXY",payload:R[0].id}):A({type:"SET_SELECTED_PROXY",payload:""})}),[R,g]);const K=(0,wt.useCallback)((()=>{const e=E.isLoading||!E.selectedProxy&&!E.useCustomRendition&&!E.useRepresentative,i=(l&&null!==g&&void 0!==g&&g.docType?(0,tn.A)([...l[g.docType],{displayName:"Automatic",value:s}],"value"):[{displayName:"Automatic",value:s}]).filter((e=>a||e.value!==s)),c=t&&i.length>0&&d.includes(g?g.extension:""),p=R&&Object.values(R).flat().length>0,f=Boolean(E.selectedFormat.width&&E.selectedFormat.height&&E.useCustomRendition);return(0,Vt.jsxs)(Vt.Fragment,{children:[E.showVersionHistory?(0,Vt.jsx)("cx-space",{slot:"label","justify-content":"space-between","align-items":"center",children:(0,Vt.jsxs)("cx-space",{direction:"vertical",spacing:"2x-small",style:{flex:"1"},children:[(0,Vt.jsx)("cx-typography",{variant:"h4",children:"Version history"}),(0,Vt.jsx)("cx-typography",{variant:"body3",className:"asset-name",children:(0,Vt.jsx)($t,{lines:1,children:null===g||void 0===g?void 0:g.name})})]})}):(0,Vt.jsxs)(Vt.Fragment,{children:[(0,Vt.jsx)("cx-space",{slot:"label","justify-content":"space-between","align-items":"center",children:(0,Vt.jsxs)("cx-space",{direction:"vertical",spacing:"2x-small",style:{flex:"1"},children:[(0,Vt.jsx)("cx-typography",{variant:"h4",children:r?"Custom format":"Preview"}),(0,Vt.jsx)("cx-typography",{variant:"body3",className:"asset-name",children:(0,Vt.jsx)($t,{lines:1,children:null===g||void 0===g?void 0:g.name})})]})}),n&&(0,Vt.jsx)("cx-tooltip",{slot:"header-actions",content:h?"Unfavorite":"Favorite",placement:"bottom",children:E.isLoadingFavorites?(0,Vt.jsx)("cx-space",{"align-items":"center","justify-content":"center",style:{width:"32px",height:"32px"},children:(0,Vt.jsx)("cx-spinner",{})}):(0,Vt.jsx)("cx-icon-button",{name:h?"star":"star_outline",style:{color:h?"var(--cx-color-warning)":"var(--cx-color-text)"},onClick:async()=>{E.isLoadingFavorites||(A({type:"SET_LOADING_FAVORITES",payload:!0}),h?await C():await S(),A({type:"SET_LOADING_FAVORITES",payload:!1}))}})}),v&&(0,Vt.jsx)("cx-tooltip",{slot:"header-actions",content:"Version history",placement:"bottom",children:(0,Vt.jsx)("cx-icon-button",{name:"history",onClick:V})})]}),(()=>{let e=null,t=null;if(e=E.selectedFormat.width&&E.selectedFormat.height&&(null===g||void 0===g?void 0:g.docType)===Yt.zu.Image?(0,Vt.jsx)(Dn,{ref:D,loadable:E.previewLoadable,image:E.selectedFormat,selectedProxy:E.selectedProxy,resizer:E.resizeSize,cropper:E.cropSize,rotation:E.rotation,disabled:"crop"!==E.activeSetting||!E.showCustomRendition,onCropComplete:e=>{A({type:"SET_CROP_SIZE",payload:{percentageWidth:e.width,percentageHeight:e.height,x:e.x,y:e.y}})},onLoadingChange:I}):(0,Vt.jsx)(Zn,{loadable:E.previewLoadable,asset:{docType:null===g||void 0===g?void 0:g.docType,imageUrl:null===g||void 0===g?void 0:g.imageUrl,videoUrl:m,extension:null===g||void 0===g?void 0:g.extension},onLoad:e=>{if(null!==g&&void 0!==g&&g.width&&null!==g&&void 0!==g&&g.height||null===g||void 0===g||!g.imageUrl)return;const t=null!==g&&void 0!==g&&g.width?parseInt(g.width,10):e.width,n=null!==g&&void 0!==g&&g.height?parseInt(g.height,10):e.height;A({type:"SET_DEFAULT_SIZE",payload:{width:t,height:n}})}}),E.showVersionHistory)return(0,Vt.jsx)(ir,{assetId:null===g||void 0===g?void 0:g.id});if(!r)return e;var n;E.showCustomRendition&&R?t=(0,Vt.jsx)(Kn,{activeSetting:E.activeSetting,extensions:i,availableProxies:R,imageSize:{width:E.selectedFormat.width?E.selectedFormat.width:1/0,height:E.selectedFormat.height?E.selectedFormat.height:1/0},resize:{width:E.resizeSize.width,height:E.resizeSize.height,unit:E.resizeSize.unit},crop:E.cropSize,keepMetadata:E.keepMetadata,lastAppliedCrop:E.lastCropSize,lastAppliedResize:E.lastResizeSize,proxy:E.selectedProxy,quality:E.quality,rotation:E.rotation,extension:E.selectedFormat.extension,onCropChange:F,onExtensionChange:B,onFormatChange:q,onKeepMetadataChange:W,onQualityChange:H,onResizeChange:M,onRotateChange:L,onViewChange:U}):t=(0,Vt.jsx)("cx-space",{direction:"vertical",spacing:"small",children:p||c?(0,Vt.jsxs)("div",{style:{width:"100%"},children:[p&&(0,Vt.jsx)(Jn,{items:null===R||void 0===R?void 0:R.map((e=>{var t;return"TRX"===e.proxyName&&g?{value:e.id,name:e.proxyLabel,cdnName:e.cdnName,width:g.width,height:g.height,extension:g.extension,docType:g.docType}:{value:e.id,name:e.proxyLabel,cdnName:e.cdnName,width:String(e.formatWidth),height:String(e.formatHeight),extension:null!==(t=e.extension)&&void 0!==t?t:void 0,docType:null===g||void 0===g?void 0:g.docType}})),selectedDisabled:E.useCustomRendition,selectedItem:E.selectedProxy,children:N&&(0,Vt.jsxs)("cx-menu-item",{value:"use-representative",children:[(0,Vt.jsx)("cx-typography",{variant:"body3",className:"proxy__name "+(E.useRepresentative?"selected":""),children:"Representative image"}),(0,Vt.jsx)("cx-icon",{slot:"suffix",name:E.useRepresentative?"check":""})]})}),c&&(0,Vt.jsx)(Jn,{items:[],selectedItem:E.selectedProxy,style:{borderTopWidth:"0"},children:(0,Vt.jsxs)("cx-menu-item",{value:"custom","data-cy":"custom-rendition-menu-item",children:[(0,Vt.jsx)("cx-icon",{slot:"prefix",name:"crop_rotate",className:"icon--large"}),(0,Vt.jsxs)("div",{children:[(0,Vt.jsx)("cx-typography",{variant:"body3",className:"proxy__name "+(E.useCustomRendition?"selected":""),children:"Custom format"}),f?(0,Vt.jsxs)("cx-typography",{variant:"body3",className:"proxy__details",children:[E.selectedFormat.width," x"," ",E.selectedFormat.height,E.selectedFormat.extension&&(0,Vt.jsx)("div",{className:"proxy__extension-dot"}),null===(n=E.selectedFormat.extension)||void 0===n?void 0:n.replace(/^\./,"").toUpperCase()]}):null]}),(0,Vt.jsx)("cx-icon",{slot:"suffix",name:E.useCustomRendition?"edit":"",className:"icon--large"}),(0,Vt.jsx)("cx-icon",{slot:"suffix",name:E.useCustomRendition?"check":"",className:"icon--large icon--primary"})]})}),o&&(0,Vt.jsxs)("div",{style:{backgroundColor:"var(--cx-color-neutral-0)",width:"100%"},children:[(0,Vt.jsx)(Jn,{children:(0,Vt.jsxs)("cx-menu-item",{value:"tracking",className:"proxy--switch",children:[(0,Vt.jsx)("cx-typography",{variant:"body3",className:"proxy__name",children:"Tracking parameters"}),(0,Vt.jsx)("cx-switch",{checked:E.enabledTracking,onClick:e=>e.preventDefault()})]})}),E.enabledTracking&&(0,Vt.jsx)(er,{values:E.trackingParameters,onChange:e=>A({type:"SET_TRACKING_PARAMETERS",payload:e})})]})]}):(0,Vt.jsxs)("cx-space",{"align-items":"center",spacing:"large",wrap:"nowrap",style:{backgroundColor:"var(--cx-color-neutral-0)",width:"100%",padding:"var(--cx-spacing-medium)",gap:"20px"},children:[(0,Vt.jsx)("cx-icon",{style:{color:"var(--cx-color-warning)"},name:"warning",className:"ic_warning_amber"}),(0,Vt.jsx)("cx-typography",{variant:"body3",className:"proxy__name",children:"There are no available options for this asset. This might be due to your permissions or the application's settings."})]})});return(0,Vt.jsxs)(Vt.Fragment,{children:[e,t]})})(),(()=>{if(E.showVersionHistory)return null;let t=null;return t=r?E.showCustomRendition?(0,Vt.jsxs)("cx-space",{spacing:"small",style:{width:"fit-content"},children:[(0,Vt.jsx)("cx-button",{variant:"default",onClick:()=>{var e,t,n,r,o;E.useCustomRendition?A({type:"CANCEL_USE_CUSTOM_RENDITION",payload:{url:E.defaultSelectedFormat.url,originalUrl:E.defaultSelectedFormat.originalUrl,width:E.defaultSelectedFormat.width,height:E.defaultSelectedFormat.height,extension:E.defaultSelectedFormat.extension,selectedProxy:E.defaultSelectedProxy,useCustomRendition:!0}}):A({type:"CANCEL_USE_CUSTOM_RENDITION",payload:{url:null!==(e=null===g||void 0===g?void 0:g.imageUrl)&&void 0!==e?e:"",originalUrl:null!==(t=null===g||void 0===g?void 0:g.originalUrl)&&void 0!==t?t:"",width:parseInt(null!==(n=null===g||void 0===g?void 0:g.width)&&void 0!==n?n:"0",10),height:parseInt(null!==(r=null===g||void 0===g?void 0:g.height)&&void 0!==r?r:"0",10),extension:null!==(o=null===g||void 0===g?void 0:g.extension)&&void 0!==o?o:"",useCustomRendition:!1,selectedProxy:""}})},children:"Cancel"}),(0,Vt.jsx)("cx-button",{variant:"primary",onClick:()=>{A({type:"CONFIRM_USE_CUSTOM_RENDITION"})},children:"Done"})]}):(0,Vt.jsx)("cx-button",{className:"dialog__footer__button",disabled:e,loading:E.isLoadingConfirm,variant:"primary",style:{flex:1},onClick:async()=>{const e=null===R||void 0===R?void 0:R.find((e=>e.id===E.selectedProxy));if(E.useCustomRendition){var t,n,r,o,i,a,s,l,c,u,d,h,p,f,m;if(null===g||void 0===g||!g.docType)return;A({type:"SET_LOADING_CONFIRM",payload:!0}),await _({value:E.transformations,parameters:E.enabledTracking?E.trackingParameters:void 0,proxiesPreference:null===e||void 0===e?void 0:e.proxyName,extension:E.selectedFormat.extension,sourceProxyMetadata:{cdnName:null!==(t=null===e||void 0===e?void 0:e.cdnName)&&void 0!==t?t:null,extension:"TRX"===(null===e||void 0===e?void 0:e.proxyName)?g.extension:null!==(n=null===e||void 0===e?void 0:e.extension)&&void 0!==n?n:null,isCustomFormat:null,width:"TRX"===(null===e||void 0===e?void 0:e.proxyName)?parseInt(null!==(r=g.width)&&void 0!==r?r:"0",10):null!==(o=null===e||void 0===e?void 0:e.formatWidth)&&void 0!==o?o:null,height:"TRX"===(null===e||void 0===e?void 0:e.proxyName)?parseInt(null!==(i=g.height)&&void 0!==i?i:"0",10):null!==(a=null===e||void 0===e?void 0:e.formatHeight)&&void 0!==a?a:null,permanentLink:null!==(s=null===e||void 0===e?void 0:e.permanentLink)&&void 0!==s?s:null,proxyLabel:null!==(l=null===e||void 0===e?void 0:e.proxyLabel)&&void 0!==l?l:null,proxyName:null!==(c=null===e||void 0===e?void 0:e.proxyName)&&void 0!==c?c:null},transformedAssetMetadata:{extension:null!==(u=null===(d=E.selectedFormat)||void 0===d?void 0:d.extension)&&void 0!==u?u:null,isCustomFormat:!0,height:null!==(h=null===(p=E.selectedFormat)||void 0===p?void 0:p.height)&&void 0!==h?h:null,width:null!==(f=null===(m=E.selectedFormat)||void 0===m?void 0:m.width)&&void 0!==f?f:null,permanentLink:null}}),A({type:"SET_LOADING_CONFIRM",payload:!1})}else{var v,b,y,x,S,C,T,O,P,z,D,j;if(null===g||void 0===g||!g.docType)return;if(!e&&!E.useRepresentative)return;A({type:"SET_LOADING_CONFIRM",payload:!0}),await k({extension:null!==(v=null===e||void 0===e?void 0:e.extension)&&void 0!==v?v:g.extension,value:null!==(b=null===e||void 0===e?void 0:e.proxyName)&&void 0!==b?b:"",permanentLink:null!==(y=null===e||void 0===e?void 0:e.permanentLink)&&void 0!==y?y:void 0,parameters:E.enabledTracking?E.trackingParameters:void 0,useRepresentative:E.useRepresentative,selectedProxyMetadata:{cdnName:null!==(x=null===e||void 0===e?void 0:e.cdnName)&&void 0!==x?x:null,extension:"TRX"===(null===e||void 0===e?void 0:e.proxyName)?g.extension:null!==(S=null===e||void 0===e?void 0:e.extension)&&void 0!==S?S:null,isCustomFormat:!1,width:"TRX"===(null===e||void 0===e?void 0:e.proxyName)?parseInt(null!==(C=g.width)&&void 0!==C?C:"0",10):null!==(T=null===e||void 0===e?void 0:e.formatWidth)&&void 0!==T?T:null,height:"TRX"===(null===e||void 0===e?void 0:e.proxyName)?parseInt(null!==(O=g.height)&&void 0!==O?O:"0",10):null!==(P=null===e||void 0===e?void 0:e.formatHeight)&&void 0!==P?P:null,permanentLink:null!==(z=null===e||void 0===e?void 0:e.permanentLink)&&void 0!==z?z:null,proxyLabel:null!==(D=null===e||void 0===e?void 0:e.proxyLabel)&&void 0!==D?D:null,proxyName:null!==(j=null===e||void 0===e?void 0:e.proxyName)&&void 0!==j?j:null}}),A({type:"SET_LOADING_CONFIRM",payload:!1})}A({type:"RESET_DATA"}),w()},children:null!==u&&void 0!==u?u:"Insert"}):(0,Vt.jsxs)("cx-button",{className:"dialog__footer__button",loading:E.isLoadingConfirm,onClick:async()=>{null!==g&&void 0!==g&&g.docType&&(A({type:"SET_LOADING_CONFIRM",payload:!0}),await k({extension:g.extension,useRepresentative:!0,value:""}),A({type:"SET_LOADING_CONFIRM",payload:!1}))},variant:"primary",children:[(0,Vt.jsx)("cx-icon",{slot:"prefix",name:"folder"}),u]}),(0,Vt.jsx)("div",{slot:"footer",className:"dialog__footer",children:t})})()]})}),[t,n,r,o,a,s,l,u,d,R,V,h,m,g,v,E,N,w,F,B,S,q,_,W,I,k,H,M,L,C,U]);return"drawer"===y?(0,Vt.jsx)(Qn,{ref:z,className:"dialog",label:"Drawer",placement:"bottom",contained:!0,open:f,children:K()}):(0,Vt.jsx)($n,{ref:P,className:"dialog",open:f,"use-overlay-scrollbar":ar||void 0,style:{"--max-height":`${p}px`,"--max-width":E.showVersionHistory?"600px":"520px"},children:K()})};var ur=n(5650);const dr=(0,Lt.Ay)("cx-space")`
656
+ `;var nr=n(3943);const rr=e=>{let{src:t,alt:n}=e;const[r,o]=(0,wt.useState)("horizontal"),i=(0,wt.useRef)(null),a=(0,wt.useCallback)((()=>{if(i.current){const{naturalWidth:e,naturalHeight:t}=i.current;o(e>t?"horizontal":"vertical")}}),[]);return(0,Vt.jsx)("div",{className:`version__item__preview version__item__preview--${r}`,children:(0,Vt.jsx)("img",{ref:i,src:t,alt:n,onLoad:a})})},or=e=>{let{src:t}=e;const[n,r]=(0,wt.useState)("horizontal"),o=(0,wt.useRef)(null),i=(0,wt.useCallback)((()=>{if(o.current){const{videoWidth:e,videoHeight:t}=o.current;r(e>t?"horizontal":"vertical")}}),[]);return(0,Vt.jsx)("div",{className:`version__item__preview version__item__preview--${n}`,children:(0,Vt.jsx)("video",{ref:o,src:t,onLoadedMetadata:i,controls:!0})})},ir=e=>{var t;let{assetId:n}=e;const{data:r,isFetching:o,isLoading:i}=(0,nr.cP)(n?{assetId:n}:Ft.hT);return o||i?(0,Vt.jsx)(tr,{children:(0,Vt.jsx)("cx-spinner",{})}):(0,Vt.jsx)(tr,{children:(0,Vt.jsx)("cx-menu",{children:null===r||void 0===r||null===(t=r.versions)||void 0===t?void 0:t.map(((e,t)=>(0,Vt.jsx)("cx-menu-item",{className:"version__item",readonly:!0,children:(0,Vt.jsxs)("cx-grid",{columns:5,spacing:"12px",children:[(0,Vt.jsx)("cx-grid-item",{xs:"2",sm:"2",children:(0,Vt.jsxs)("cx-space",{direction:"horizontal","align-items":"center",wrap:"nowrap",children:[(0,Vt.jsx)("div",{className:"version__item__number",children:(0,Vt.jsx)($t,{lines:1,children:e.versionNumberDisplay})}),e.scrubUrl?(0,Vt.jsx)(or,{src:e.scrubUrl}):(0,Vt.jsx)(rr,{src:e.versionFileUrl,alt:e.versionFileName})]})}),(0,Vt.jsx)("cx-grid-item",{xs:"2",sm:"3",children:(0,Vt.jsxs)("cx-space",{direction:"vertical",spacing:"2x-small",children:[(0,Vt.jsx)($t,{lines:1,children:(0,Vt.jsx)("cx-typography",{variant:"body3",className:"version__item__name",children:e.versionFileName})}),(0,Vt.jsx)($t,{lines:1,children:(0,Vt.jsx)("cx-typography",{variant:"body3",children:e.createByEmail})}),(0,Vt.jsxs)("cx-typography",{variant:"body3",children:[e.versionCreateDate.split(" ")[0],0===t&&(0,Vt.jsx)("span",{className:"version__item__latest",children:"Current version"})]})]})})]})},e.versionNumber)))})})},ar=CSS.supports("(overlay: auto)")&&"showPopover"in document.createElement("div"),sr={previewLoadable:!1,defaultSize:{width:0,height:0},selectedProxy:"",defaultSelectedProxy:"",selectedFormat:{url:"",originalUrl:"",width:0,height:0,x:0,y:0,extension:"",rotation:0},defaultSelectedFormat:{url:"",originalUrl:"",width:0,height:0,x:0,y:0,extension:"",rotation:0},resizeSize:{width:0,height:0,unit:dn.Nf.Pixel},lastResizeSize:{[dn.Nf.AspectRatio]:{width:0,height:0,unit:dn.Nf.AspectRatio},[dn.Nf.Pixel]:{width:0,height:0,unit:dn.Nf.Pixel}},cropSize:{width:0,height:0,percentageWidth:0,percentageHeight:0,x:0,y:0,unit:dn.Nf.Pixel},lastCropSize:{[dn.Nf.AspectRatio]:{width:0,height:0,percentageWidth:0,percentageHeight:0,x:0,y:0,unit:dn.Nf.AspectRatio},[dn.Nf.Pixel]:{width:0,height:0,percentageWidth:0,percentageHeight:0,x:0,y:0,unit:dn.Nf.Pixel}},isLoadingConfirm:!1,isLoadingFavorites:!1,rotation:0,quality:100,keepMetadata:!1,transformations:[],confirmedTransformations:[],enabledTracking:!1,trackingParameters:[{key:"UTM_source",value:""},{key:"UTM_campaign",value:""},{key:"UTM_description",value:""}],showCustomRendition:!1,showVersionHistory:!1,useCustomRendition:!1,useRepresentative:!1,activeSetting:"format",isLoading:!1},lr=(e,t)=>{switch(t.type){case"CANCEL_USE_CUSTOM_RENDITION":return{...e,cropSize:{...e.cropSize,width:t.payload.width,height:t.payload.height},resizeSize:{...e.resizeSize,width:t.payload.width,height:t.payload.height},selectedFormat:{...e.selectedFormat,...t.payload,rotation:0,x:0,y:0},rotation:0,transformations:e.useCustomRendition?e.confirmedTransformations:[],showCustomRendition:!1,activeSetting:"format",selectedProxy:t.payload.selectedProxy};case"CONFIRM_USE_CUSTOM_RENDITION":return{...e,confirmedTransformations:e.transformations,cropSize:{...e.cropSize,width:e.selectedFormat.width,height:e.selectedFormat.height},resizeSize:{...e.resizeSize,width:e.selectedFormat.width,height:e.selectedFormat.height},rotation:0,activeSetting:"format",showCustomRendition:!1,useCustomRendition:!0,defaultSelectedFormat:{...e.selectedFormat},defaultSelectedProxy:e.selectedProxy};case"SET_DEFAULT_SIZE":return{...e,defaultSize:{...e.defaultSize,...t.payload}};case"RESET_DATA":return sr;case"SET_ACTIVE_SETTING":return{...e,activeSetting:t.payload};case"SET_CROP_SIZE":return{...e,cropSize:{...e.cropSize,...t.payload}};case"SET_ENABLED_TRACKING":return{...e,enabledTracking:t.payload};case"SET_KEEP_METADATA":return{...e,keepMetadata:t.payload};case"SET_LAST_CROP_SIZE":return{...e,lastCropSize:{...e.lastCropSize,...t.payload}};case"SET_LAST_RESIZE_SIZE":return{...e,lastResizeSize:{...e.lastResizeSize,...t.payload}};case"SET_LOADING":return{...e,isLoading:t.payload};case"SET_LOADING_CONFIRM":return{...e,isLoadingConfirm:t.payload};case"SET_LOADING_FAVORITES":return{...e,isLoadingFavorites:t.payload};case"SET_PREVIEW_LOADABLE":return{...e,previewLoadable:t.payload};case"SET_QUALITY":return{...e,quality:t.payload};case"SET_RESIZE_SIZE":return{...e,resizeSize:{...e.resizeSize,...t.payload}};case"SET_ROTATION":return{...e,rotation:t.payload};case"SET_SELECTED_FORMAT":return{...e,selectedFormat:{...e.selectedFormat,...t.payload}};case"SET_SELECTED_PROXY":return t.payload?"string"===typeof t.payload?{...e,selectedProxy:t.payload,useCustomRendition:!1,useRepresentative:!1}:{...e,selectedProxy:t.payload.proxy,useCustomRendition:Boolean(t.payload.useCustomRendition),useRepresentative:!1}:{...e,selectedProxy:"",useCustomRendition:!1,useRepresentative:!1};case"SET_SHOW_CUSTOM_RENDITION":return{...e,showCustomRendition:t.payload};case"SET_SHOW_VERSION_HISTORY":return{...e,showVersionHistory:t.payload};case"SET_TRACKING_PARAMETERS":return{...e,trackingParameters:t.payload};case"SET_TRANSFORMATIONS":return{...e,transformations:[...e.transformations,t.payload]};case"SET_USE_REPRESENTATIVE":return{...e,selectedProxy:t.payload?"":e.selectedProxy,useRepresentative:t.payload};default:return e}},cr=e=>{let{allowCustomFormat:t,allowFavorites:n,allowProxy:r,allowTracking:o,allowedExtensions:i,appendAutoExtension:a,autoExtension:s,availableExtensions:l,availableProxies:c,ctaText:u="Insert",extensions:d,isFavorite:h,maxHeight:p,open:f,previewUrl:m,selectedAsset:g,showVersions:v,supportedRepresentativeSubtypes:b,variant:y="dialog",boundary:x,onClose:w,onFavorite:S,onProxyConfirm:k,onFormatConfirm:_,onUnFavorite:C}=e;const[E,A]=(0,wt.useReducer)(lr,sr),[T,O]=(0,wt.useState)(!1),P=(0,wt.useRef)(null),z=(0,wt.useRef)(null),D=(0,wt.useRef)(null),R=(0,wt.useMemo)((()=>i?c?c.filter((e=>{if(!e.extension&&g){return!!(null===i||void 0===i?void 0:i.some((e=>e===g.extension.replace(/^\./,""))))}return!0})):[]:c),[c,i,g]),j=(0,wt.useCallback)((()=>{if(!g)return;const e=hn(E.defaultSize.width,E.defaultSize.height);A({type:"SET_RESIZE_SIZE",payload:{...sr.resizeSize,width:E.defaultSize.width,height:E.defaultSize.height}}),A({type:"SET_CROP_SIZE",payload:{...sr.cropSize,width:E.defaultSize.width,height:E.defaultSize.height,percentageHeight:100,percentageWidth:100}}),A({type:"SET_ROTATION",payload:0}),A({type:"SET_LAST_CROP_SIZE",payload:{...sr.lastCropSize,[dn.Nf.Pixel]:{width:E.defaultSize.width,height:E.defaultSize.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:e.width,height:e.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.AspectRatio}}}),A({type:"SET_LAST_RESIZE_SIZE",payload:{[dn.Nf.Pixel]:{width:E.defaultSize.width,height:E.defaultSize.height,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:e.width,height:e.height,unit:dn.Nf.AspectRatio}}});let t=g.extension;if(a)t=s;else if(g.docType){var n,r,o,i;if(null!==l&&void 0!==l&&null!==(n=l[g.docType])&&void 0!==n&&n.map((e=>e.value)).includes(g.extension))t=g.extension;else t=null!==(r=null===l||void 0===l||null===(o=l[g.docType])||void 0===o||null===(i=o[0])||void 0===i?void 0:i.value)&&void 0!==r?r:""}var c;R&&R.length>0?(A({type:"SET_SELECTED_PROXY",payload:null===(c=R[0])||void 0===c?void 0:c.id}),A({type:"SET_SELECTED_FORMAT",payload:{...sr.selectedFormat,url:g.imageUrl,originalUrl:g.originalUrl,extension:t,width:R[0].formatWidth||E.defaultSize.width,height:R[0].formatHeight||E.defaultSize.height}})):A({type:"SET_SELECTED_FORMAT",payload:{...sr.selectedFormat,url:g.imageUrl,originalUrl:g.originalUrl,extension:t,width:E.defaultSize.width,height:E.defaultSize.height}})}),[s,R,g,E.defaultSize.height,E.defaultSize.width,a,l]);(0,wt.useEffect)((()=>{null!==g&&void 0!==g&&g.width&&null!==g&&void 0!==g&&g.height&&A({type:"SET_DEFAULT_SIZE",payload:{width:parseInt(g.width,10),height:parseInt(g.height,10)}})}),[null===g||void 0===g?void 0:g.width,null===g||void 0===g?void 0:g.height]),(0,wt.useEffect)((()=>{Promise.all([customElements.whenDefined("cx-dialog"),customElements.whenDefined("cx-drawer"),customElements.whenDefined("cx-dropdown")]).then((()=>{O(!0)}))}),[]),(0,wt.useEffect)((()=>{const e=e=>{E.isLoadingFavorites?e.preventDefault():E.showVersionHistory?(e.preventDefault(),A({type:"SET_SHOW_VERSION_HISTORY",payload:!1})):(A({type:"SET_PREVIEW_LOADABLE",payload:!1}),A({type:"RESET_DATA"}),w())},t=P.current,n=z.current;return null===t||void 0===t||t.addEventListener("cx-request-close",e),null===n||void 0===n||n.addEventListener("cx-request-close",e),()=>{null===t||void 0===t||t.removeEventListener("cx-request-close",e),null===n||void 0===n||n.removeEventListener("cx-request-close",e)}}),[x,T,w,E.isLoadingFavorites,E.showVersionHistory]),(0,wt.useEffect)((()=>{const e=P.current;e&&x&&(e.boundary=x)})),(0,wt.useEffect)((()=>{const e=()=>{A({type:"SET_PREVIEW_LOADABLE",payload:!0})},t=P.current,n=z.current;return null===t||void 0===t||t.addEventListener("cx-after-show",e),null===n||void 0===n||n.addEventListener("cx-after-show",e),()=>{null===t||void 0===t||t.removeEventListener("cx-after-show",e),null===n||void 0===n||n.removeEventListener("cx-after-show",e)}}),[T,E.showCustomRendition,y]),(0,wt.useEffect)((()=>{const e=e=>{const t=e.detail.item.value;if("custom"===t)return A({type:"SET_SHOW_CUSTOM_RENDITION",payload:!0}),void(E.useCustomRendition||j());if("tracking"!==t)if("use-representative"!==t){if(t&&R){if(!R.map((e=>e.id)).includes(t))return;A({type:"SET_SELECTED_PROXY",payload:t})}}else A({type:"SET_USE_REPRESENTATIVE",payload:!E.useRepresentative});else A({type:"SET_ENABLED_TRACKING",payload:!E.enabledTracking})},t=P.current,n=z.current;return null===t||void 0===t||t.addEventListener("cx-select",e),null===n||void 0===n||n.addEventListener("cx-select",e),()=>{null===t||void 0===t||t.removeEventListener("cx-select",e),null===n||void 0===n||n.removeEventListener("cx-select",e)}}),[T,E.enabledTracking,E.useCustomRendition,E.useRepresentative,j,R,null===g||void 0===g?void 0:g.extension]),(0,wt.useEffect)((()=>{j()}),[j]);const N=(0,wt.useMemo)((()=>{var e;return(null===b||void 0===b?void 0:b.includes(null!==(e=null===g||void 0===g?void 0:g.docSubType)&&void 0!==e?e:""))&&(null===g||void 0===g?void 0:g.imageUrl)}),[g,b]),I=(0,wt.useCallback)((e=>{A({type:"SET_LOADING",payload:e})}),[]),M=(0,wt.useCallback)((async(e,t,n,r)=>{if(!g)return;const o=E.selectedFormat.width||E.defaultSize.width,i=E.selectedFormat.height||E.defaultSize.height;if(A({type:"SET_RESIZE_SIZE",payload:{width:e,height:t,unit:n}}),r){var a;let r=e,s=t;E.resizeSize.unit!==n?(r=o,s=i):n===dn.Nf.AspectRatio&&(r=Math.round(e/t*i),s=i);const l=await(null===(a=D.current)||void 0===a?void 0:a.applyResize());A({type:"SET_SELECTED_FORMAT",payload:{url:l,width:r,height:s}}),A({type:"SET_TRANSFORMATIONS",payload:{key:dn.YQ.Resize,value:{width:r,height:s}}}),A({type:"SET_CROP_SIZE",payload:{width:r,height:s}});const c=hn(r,s);A({type:"SET_LAST_RESIZE_SIZE",payload:{[dn.Nf.Pixel]:{width:r,height:s,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:n===dn.Nf.AspectRatio?e:c.width,height:n===dn.Nf.AspectRatio?t:c.height,unit:dn.Nf.AspectRatio}}}),A({type:"SET_LAST_CROP_SIZE",payload:{[dn.Nf.Pixel]:{width:r,height:s,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:n===dn.Nf.AspectRatio?e:c.width,height:n===dn.Nf.AspectRatio?t:c.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.AspectRatio}}})}}),[g,E.defaultSize.height,E.defaultSize.width,E.resizeSize.unit,E.selectedFormat.height,E.selectedFormat.width]),F=(0,wt.useCallback)((async(e,t,n,r)=>{var o,i;if(!g)return;const a=E.cropSize.unit,s=D.current;if(s&&null!==(o=E.selectedFormat)&&void 0!==o&&o.width&&null!==(i=E.selectedFormat)&&void 0!==i&&i.height){if(n===a&&n===dn.Nf.Pixel){const n=Math.max(e/E.selectedFormat.width,t/E.selectedFormat.height);s.setZoom(1/n)}n!==a&&s.setZoom(1)}if(A({type:"SET_CROP_SIZE",payload:{width:e,height:t,unit:n}}),r){var l;const r=await(null===(l=D.current)||void 0===l?void 0:l.applyCrop());let o=e,i=t;n===dn.Nf.AspectRatio&&(o=Math.round(E.cropSize.percentageWidth*E.selectedFormat.width/100),i=Math.round(E.cropSize.percentageHeight*E.selectedFormat.height/100)),null===s||void 0===s||s.setZoom(1);const a=Number((E.cropSize.x/100*E.selectedFormat.width).toFixed(0)),c=Number((E.cropSize.y/100*E.selectedFormat.height).toFixed(0));A({type:"SET_SELECTED_FORMAT",payload:{url:r,width:o,height:i}}),A({type:"SET_RESIZE_SIZE",payload:{width:o,height:i,unit:dn.Nf.Pixel}}),A({type:"SET_TRANSFORMATIONS",payload:{key:dn.YQ.Crop,value:{width:Number(o.toFixed(0)),height:Number(i.toFixed(0)),x:a,y:c}}});const u=hn(o,i);A({type:"SET_LAST_CROP_SIZE",payload:{[dn.Nf.Pixel]:{width:Math.round(o),height:Math.round(i),percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:n===dn.Nf.AspectRatio?e:u.width,height:n===dn.Nf.AspectRatio?t:u.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.AspectRatio}}}),A({type:"SET_LAST_RESIZE_SIZE",payload:{[dn.Nf.Pixel]:{width:o,height:i,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:n===dn.Nf.AspectRatio?e:u.width,height:n===dn.Nf.AspectRatio?t:u.height,unit:dn.Nf.AspectRatio}}})}}),[g,E.cropSize,E.selectedFormat.height,E.selectedFormat.width]),L=(0,wt.useCallback)((async(e,t)=>{if(A({type:"SET_ROTATION",payload:t?0:e}),t){var n;const{width:t,height:r}=pn(E.selectedFormat.width,E.selectedFormat.height,e),o=await(null===(n=D.current)||void 0===n?void 0:n.applyRotation());A({type:"SET_SELECTED_FORMAT",payload:{rotation:e,url:o,width:t,height:r}}),A({type:"SET_TRANSFORMATIONS",payload:{key:dn.YQ.Rotate,value:{rotation:e}}}),A({type:"SET_CROP_SIZE",payload:{width:t,height:r}}),A({type:"SET_RESIZE_SIZE",payload:{width:t,height:r,unit:dn.Nf.Pixel}});const i=hn(t,r);A({type:"SET_LAST_CROP_SIZE",payload:{[dn.Nf.Pixel]:{width:t,height:r,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:i.width,height:i.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.AspectRatio}}}),A({type:"SET_LAST_RESIZE_SIZE",payload:{[dn.Nf.Pixel]:{width:t,height:r,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:i.width,height:i.height,unit:dn.Nf.AspectRatio}}})}}),[E.selectedFormat]),B=(0,wt.useCallback)((e=>{A({type:"SET_SELECTED_FORMAT",payload:{extension:e}})}),[]),U=(0,wt.useCallback)((e=>{A({type:"SET_CROP_SIZE",payload:{width:E.selectedFormat.width,height:E.selectedFormat.height,unit:dn.Nf.Pixel}}),A({type:"SET_RESIZE_SIZE",payload:{width:E.selectedFormat.width,height:E.selectedFormat.height,unit:dn.Nf.Pixel}}),A({type:"SET_ROTATION",payload:0}),A({type:"SET_ACTIVE_SETTING",payload:e})}),[E.selectedFormat]),V=(0,wt.useCallback)((()=>{A({type:"SET_SHOW_VERSION_HISTORY",payload:!0})}),[]),q=(0,wt.useCallback)((e=>{let t=e.formatWidth,n=e.formatHeight;"TRX"===e.proxyName&&g&&(t=Number(g.width),n=Number(g.height)),A({type:"SET_SELECTED_PROXY",payload:{proxy:e.id,useCustomRendition:!0}}),A({type:"SET_SELECTED_FORMAT",payload:{url:null===g||void 0===g?void 0:g.imageUrl,width:t,height:n}}),A({type:"SET_RESIZE_SIZE",payload:{width:t,height:n,unit:dn.Nf.Pixel}}),A({type:"SET_CROP_SIZE",payload:{width:t,height:n,percentageWidth:100,percentageHeight:100,x:0,y:0,unit:dn.Nf.Pixel}});const r=hn(t,n);A({type:"SET_LAST_CROP_SIZE",payload:{[dn.Nf.Pixel]:{width:Math.round(t),height:Math.round(n),percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:r.width,height:r.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:dn.Nf.AspectRatio}}}),A({type:"SET_LAST_RESIZE_SIZE",payload:{[dn.Nf.Pixel]:{width:t,height:n,unit:dn.Nf.Pixel},[dn.Nf.AspectRatio]:{width:r.width,height:r.height,unit:dn.Nf.AspectRatio}}})}),[g]),H=(0,wt.useCallback)((e=>{A({type:"SET_QUALITY",payload:e}),A({type:"SET_TRANSFORMATIONS",payload:{key:dn.YQ.Quality,value:{quality:e}}})}),[]),W=(0,wt.useCallback)((e=>{A({type:"SET_KEEP_METADATA",payload:e}),A({type:"SET_TRANSFORMATIONS",payload:{key:dn.YQ.KeepMetadata,value:{keepMetadata:e}}})}),[]);(0,wt.useEffect)((()=>{R&&0!==R.length?A({type:"SET_SELECTED_PROXY",payload:R[0].id}):A({type:"SET_SELECTED_PROXY",payload:""})}),[R,g]);const K=(0,wt.useCallback)((()=>{const e=E.isLoading||!E.selectedProxy&&!E.useCustomRendition&&!E.useRepresentative,i=(l&&null!==g&&void 0!==g&&g.docType?(0,tn.A)([...l[g.docType],{displayName:"Automatic",value:s}],"value"):[{displayName:"Automatic",value:s}]).filter((e=>a||e.value!==s)),c=t&&i.length>0&&d.includes(g?g.extension:""),p=R&&Object.values(R).flat().length>0,f=Boolean(E.selectedFormat.width&&E.selectedFormat.height&&E.useCustomRendition);return(0,Vt.jsxs)(Vt.Fragment,{children:[E.showVersionHistory?(0,Vt.jsx)("cx-space",{slot:"label","justify-content":"space-between","align-items":"center",children:(0,Vt.jsxs)("cx-space",{direction:"vertical",spacing:"2x-small",style:{flex:"1"},children:[(0,Vt.jsx)("cx-typography",{variant:"h4",children:"Version history"}),(0,Vt.jsx)("cx-typography",{variant:"body3",className:"asset-name",children:(0,Vt.jsx)($t,{lines:1,children:null===g||void 0===g?void 0:g.name})})]})}):(0,Vt.jsxs)(Vt.Fragment,{children:[(0,Vt.jsx)("cx-space",{slot:"label","justify-content":"space-between","align-items":"center",children:(0,Vt.jsxs)("cx-space",{direction:"vertical",spacing:"2x-small",style:{flex:"1"},children:[(0,Vt.jsx)("cx-typography",{variant:"h4",children:r?"Custom format":"Preview"}),(0,Vt.jsx)("cx-typography",{variant:"body3",className:"asset-name",children:(0,Vt.jsx)($t,{lines:1,children:null===g||void 0===g?void 0:g.name})})]})}),n&&(0,Vt.jsx)("cx-tooltip",{slot:"header-actions",content:h?"Unfavorite":"Favorite",placement:"bottom",children:E.isLoadingFavorites?(0,Vt.jsx)("cx-space",{"align-items":"center","justify-content":"center",style:{width:"32px",height:"32px"},children:(0,Vt.jsx)("cx-spinner",{})}):(0,Vt.jsx)("cx-icon-button",{name:h?"star":"star_outline",style:{color:h?"var(--cx-color-warning)":"var(--cx-color-text)"},onClick:async()=>{E.isLoadingFavorites||(A({type:"SET_LOADING_FAVORITES",payload:!0}),h?await C():await S(),A({type:"SET_LOADING_FAVORITES",payload:!1}))}})}),v&&(0,Vt.jsx)("cx-tooltip",{slot:"header-actions",content:"Version history",placement:"bottom",children:(0,Vt.jsx)("cx-icon-button",{name:"history",onClick:V})})]}),(()=>{let e=null,t=null;if(e=E.selectedFormat.width&&E.selectedFormat.height&&(null===g||void 0===g?void 0:g.docType)===Yt.zu.Image?(0,Vt.jsx)(Dn,{ref:D,loadable:E.previewLoadable,image:E.selectedFormat,selectedProxy:E.selectedProxy,resizer:E.resizeSize,cropper:E.cropSize,rotation:E.rotation,disabled:"crop"!==E.activeSetting||!E.showCustomRendition,onCropComplete:e=>{A({type:"SET_CROP_SIZE",payload:{percentageWidth:e.width,percentageHeight:e.height,x:e.x,y:e.y}})},onLoadingChange:I}):(0,Vt.jsx)(Zn,{loadable:E.previewLoadable,asset:{docType:null===g||void 0===g?void 0:g.docType,imageUrl:null===g||void 0===g?void 0:g.imageUrl,videoUrl:m,extension:null===g||void 0===g?void 0:g.extension},onLoad:e=>{if(null!==g&&void 0!==g&&g.width&&null!==g&&void 0!==g&&g.height||null===g||void 0===g||!g.imageUrl)return;const t=null!==g&&void 0!==g&&g.width?parseInt(g.width,10):e.width,n=null!==g&&void 0!==g&&g.height?parseInt(g.height,10):e.height;A({type:"SET_DEFAULT_SIZE",payload:{width:t,height:n}})}}),E.showVersionHistory)return(0,Vt.jsx)(ir,{assetId:null===g||void 0===g?void 0:g.id});if(!r)return e;var n;E.showCustomRendition&&R?t=(0,Vt.jsx)(Kn,{activeSetting:E.activeSetting,extensions:i,availableProxies:R,imageSize:{width:E.selectedFormat.width?E.selectedFormat.width:1/0,height:E.selectedFormat.height?E.selectedFormat.height:1/0},resize:{width:E.resizeSize.width,height:E.resizeSize.height,unit:E.resizeSize.unit},crop:E.cropSize,keepMetadata:E.keepMetadata,lastAppliedCrop:E.lastCropSize,lastAppliedResize:E.lastResizeSize,proxy:E.selectedProxy,quality:E.quality,rotation:E.rotation,extension:E.selectedFormat.extension,onCropChange:F,onExtensionChange:B,onFormatChange:q,onKeepMetadataChange:W,onQualityChange:H,onResizeChange:M,onRotateChange:L,onViewChange:U}):t=(0,Vt.jsx)("cx-space",{direction:"vertical",spacing:"small",children:p||c?(0,Vt.jsxs)("div",{style:{width:"100%"},children:[p&&(0,Vt.jsx)(Jn,{items:null===R||void 0===R?void 0:R.map((e=>{var t;return"TRX"===e.proxyName&&g?{value:e.id,name:e.proxyLabel,cdnName:e.cdnName,width:g.width,height:g.height,extension:g.extension,docType:g.docType}:{value:e.id,name:e.proxyLabel,cdnName:e.cdnName,width:String(e.formatWidth),height:String(e.formatHeight),extension:null!==(t=e.extension)&&void 0!==t?t:void 0,docType:null===g||void 0===g?void 0:g.docType}})),selectedDisabled:E.useCustomRendition,selectedItem:E.selectedProxy,children:N&&(0,Vt.jsxs)("cx-menu-item",{value:"use-representative",children:[(0,Vt.jsx)("cx-typography",{variant:"body3",className:"proxy__name "+(E.useRepresentative?"selected":""),children:"Representative image"}),(0,Vt.jsx)("cx-icon",{slot:"suffix",name:E.useRepresentative?"check":""})]})}),c&&(0,Vt.jsx)(Jn,{items:[],selectedItem:E.selectedProxy,style:{borderTopWidth:"0"},children:(0,Vt.jsxs)("cx-menu-item",{value:"custom","data-cy":"custom-rendition-menu-item",children:[(0,Vt.jsx)("cx-icon",{slot:"prefix",name:"crop_rotate",className:"icon--large"}),(0,Vt.jsxs)("div",{children:[(0,Vt.jsx)("cx-typography",{variant:"body3",className:"proxy__name "+(E.useCustomRendition?"selected":""),children:"Custom format"}),f?(0,Vt.jsxs)("cx-typography",{variant:"body3",className:"proxy__details",children:[E.selectedFormat.width," x"," ",E.selectedFormat.height,E.selectedFormat.extension&&(0,Vt.jsx)("div",{className:"proxy__extension-dot"}),null===(n=E.selectedFormat.extension)||void 0===n?void 0:n.replace(/^\./,"").toUpperCase()]}):null]}),(0,Vt.jsx)("cx-icon",{slot:"suffix",name:E.useCustomRendition?"edit":"",className:"icon--large"}),(0,Vt.jsx)("cx-icon",{slot:"suffix",name:E.useCustomRendition?"check":"",className:"icon--large icon--primary"})]})}),o&&(0,Vt.jsxs)("div",{style:{backgroundColor:"var(--cx-color-neutral-0)",width:"100%"},children:[(0,Vt.jsx)(Jn,{children:(0,Vt.jsxs)("cx-menu-item",{value:"tracking",className:"proxy--switch",children:[(0,Vt.jsx)("cx-typography",{variant:"body3",className:"proxy__name",children:"Tracking parameters"}),(0,Vt.jsx)("cx-switch",{checked:E.enabledTracking,onClick:e=>e.preventDefault()})]})}),E.enabledTracking&&(0,Vt.jsx)(er,{values:E.trackingParameters,onChange:e=>A({type:"SET_TRACKING_PARAMETERS",payload:e})})]})]}):(0,Vt.jsxs)("cx-space",{"align-items":"center",spacing:"large",wrap:"nowrap",style:{backgroundColor:"var(--cx-color-neutral-0)",width:"100%",padding:"var(--cx-spacing-medium)",gap:"20px"},children:[(0,Vt.jsx)("cx-icon",{style:{color:"var(--cx-color-warning)"},name:"warning",className:"ic_warning_amber"}),(0,Vt.jsx)("cx-typography",{variant:"body3",className:"proxy__name",children:"There are no available options for this asset. This might be due to your permissions or the application's settings."})]})});return(0,Vt.jsxs)(Vt.Fragment,{children:[e,t]})})(),(()=>{if(E.showVersionHistory)return null;let t=null;return t=r?E.showCustomRendition?(0,Vt.jsxs)("cx-space",{spacing:"small",style:{width:"fit-content"},children:[(0,Vt.jsx)("cx-button",{variant:"default",onClick:()=>{var e,t,n,r,o;E.useCustomRendition?A({type:"CANCEL_USE_CUSTOM_RENDITION",payload:{url:E.defaultSelectedFormat.url,originalUrl:E.defaultSelectedFormat.originalUrl,width:E.defaultSelectedFormat.width,height:E.defaultSelectedFormat.height,extension:E.defaultSelectedFormat.extension,selectedProxy:E.defaultSelectedProxy,useCustomRendition:!0}}):A({type:"CANCEL_USE_CUSTOM_RENDITION",payload:{url:null!==(e=null===g||void 0===g?void 0:g.imageUrl)&&void 0!==e?e:"",originalUrl:null!==(t=null===g||void 0===g?void 0:g.originalUrl)&&void 0!==t?t:"",width:parseInt(null!==(n=null===g||void 0===g?void 0:g.width)&&void 0!==n?n:"0",10),height:parseInt(null!==(r=null===g||void 0===g?void 0:g.height)&&void 0!==r?r:"0",10),extension:null!==(o=null===g||void 0===g?void 0:g.extension)&&void 0!==o?o:"",useCustomRendition:!1,selectedProxy:""}})},children:"Cancel"}),(0,Vt.jsx)("cx-button",{variant:"primary",onClick:()=>{A({type:"CONFIRM_USE_CUSTOM_RENDITION"})},children:"Done"})]}):(0,Vt.jsx)("cx-button",{className:"dialog__footer__button",disabled:e,loading:E.isLoadingConfirm,variant:"primary",style:{flex:1},onClick:async()=>{let e=!1;const t=null===R||void 0===R?void 0:R.find((e=>e.id===E.selectedProxy));if(E.useCustomRendition){var n,r,o,i,a,s,l,c,u,d,h,p,f,m,v;if(null===g||void 0===g||!g.docType)return;A({type:"SET_LOADING_CONFIRM",payload:!0}),e=await _({value:E.transformations,parameters:E.enabledTracking?E.trackingParameters:void 0,proxiesPreference:null===t||void 0===t?void 0:t.proxyName,extension:E.selectedFormat.extension,sourceProxyMetadata:{cdnName:null!==(n=null===t||void 0===t?void 0:t.cdnName)&&void 0!==n?n:null,extension:"TRX"===(null===t||void 0===t?void 0:t.proxyName)?g.extension:null!==(r=null===t||void 0===t?void 0:t.extension)&&void 0!==r?r:null,isCustomFormat:null,width:"TRX"===(null===t||void 0===t?void 0:t.proxyName)?parseInt(null!==(o=g.width)&&void 0!==o?o:"0",10):null!==(i=null===t||void 0===t?void 0:t.formatWidth)&&void 0!==i?i:null,height:"TRX"===(null===t||void 0===t?void 0:t.proxyName)?parseInt(null!==(a=g.height)&&void 0!==a?a:"0",10):null!==(s=null===t||void 0===t?void 0:t.formatHeight)&&void 0!==s?s:null,permanentLink:null!==(l=null===t||void 0===t?void 0:t.permanentLink)&&void 0!==l?l:null,proxyLabel:null!==(c=null===t||void 0===t?void 0:t.proxyLabel)&&void 0!==c?c:null,proxyName:null!==(u=null===t||void 0===t?void 0:t.proxyName)&&void 0!==u?u:null},transformedAssetMetadata:{extension:null!==(d=null===(h=E.selectedFormat)||void 0===h?void 0:h.extension)&&void 0!==d?d:null,isCustomFormat:!0,height:null!==(p=null===(f=E.selectedFormat)||void 0===f?void 0:f.height)&&void 0!==p?p:null,width:null!==(m=null===(v=E.selectedFormat)||void 0===v?void 0:v.width)&&void 0!==m?m:null,permanentLink:null}}),A({type:"SET_LOADING_CONFIRM",payload:!1})}else{var b,y,x,S,C,T,O,P,z,D,j,N;if(null===g||void 0===g||!g.docType)return;if(!t&&!E.useRepresentative)return;A({type:"SET_LOADING_CONFIRM",payload:!0}),e=await k({extension:null!==(b=null===t||void 0===t?void 0:t.extension)&&void 0!==b?b:g.extension,value:null!==(y=null===t||void 0===t?void 0:t.proxyName)&&void 0!==y?y:"",permanentLink:null!==(x=null===t||void 0===t?void 0:t.permanentLink)&&void 0!==x?x:void 0,parameters:E.enabledTracking?E.trackingParameters:void 0,useRepresentative:E.useRepresentative,selectedProxyMetadata:{cdnName:null!==(S=null===t||void 0===t?void 0:t.cdnName)&&void 0!==S?S:null,extension:"TRX"===(null===t||void 0===t?void 0:t.proxyName)?g.extension:null!==(C=null===t||void 0===t?void 0:t.extension)&&void 0!==C?C:null,isCustomFormat:!1,width:"TRX"===(null===t||void 0===t?void 0:t.proxyName)?parseInt(null!==(T=g.width)&&void 0!==T?T:"0",10):null!==(O=null===t||void 0===t?void 0:t.formatWidth)&&void 0!==O?O:null,height:"TRX"===(null===t||void 0===t?void 0:t.proxyName)?parseInt(null!==(P=g.height)&&void 0!==P?P:"0",10):null!==(z=null===t||void 0===t?void 0:t.formatHeight)&&void 0!==z?z:null,permanentLink:null!==(D=null===t||void 0===t?void 0:t.permanentLink)&&void 0!==D?D:null,proxyLabel:null!==(j=null===t||void 0===t?void 0:t.proxyLabel)&&void 0!==j?j:null,proxyName:null!==(N=null===t||void 0===t?void 0:t.proxyName)&&void 0!==N?N:null}}),A({type:"SET_LOADING_CONFIRM",payload:!1})}e&&(A({type:"RESET_DATA"}),w())},children:null!==u&&void 0!==u?u:"Insert"}):(0,Vt.jsxs)("cx-button",{className:"dialog__footer__button",loading:E.isLoadingConfirm,onClick:async()=>{null!==g&&void 0!==g&&g.docType&&(A({type:"SET_LOADING_CONFIRM",payload:!0}),await k({extension:g.extension,useRepresentative:!0,value:""}),A({type:"SET_LOADING_CONFIRM",payload:!1}))},variant:"primary",children:[(0,Vt.jsx)("cx-icon",{slot:"prefix",name:"folder"}),u]}),(0,Vt.jsx)("div",{slot:"footer",className:"dialog__footer",children:t})})()]})}),[t,n,r,o,a,s,l,u,d,R,V,h,m,g,v,E,N,w,F,B,S,q,_,W,I,k,H,M,L,C,U]);return"drawer"===y?(0,Vt.jsx)(Qn,{ref:z,className:"dialog",label:"Drawer",placement:"bottom",contained:!0,open:f,children:K()}):(0,Vt.jsx)($n,{ref:P,className:"dialog",open:f,"use-overlay-scrollbar":ar||void 0,style:{"--max-height":`${p}px`,"--max-width":E.showVersionHistory?"600px":"520px"},children:K()})};var ur=n(5650);const dr=(0,Lt.Ay)("cx-space")`
657
657
  border-bottom: ${e=>{let{bordered:t}=e;return t?"1px solid var(--cx-color-neutral-300)":"none"}};
658
658
  padding: var(--cx-spacing-medium);
659
659
 
@@ -1039,7 +1039,7 @@
1039
1039
  height: 100%;
1040
1040
  display: flex;
1041
1041
  flex-direction: column;
1042
- `;var Qr=n(2246);const Gr={containerSize:{width:0,height:0},currentCount:0,currentFolder:Nt,defaultPageSize:Ut.md,facets:[],hasScrolled:!1,isLoading:!1,isSeeThrough:!0,openBrowser:!1,start:0,pageSize:0,maxPageSize:0,searchText:"",selectedFacets:{},shouldResetFilters:!0,sortDirection:void 0,sortOrder:"",totalCount:0,view:Yt.gf.Medium},Xr=(e,t)=>{const n={start:0,pageSize:e.maxPageSize};switch(t.type){case"SET_CONTAINER_SIZE":return{...e,containerSize:t.payload};case"SET_CURRENT_COUNT":return{...e,currentCount:t.payload};case"SET_CURRENT_FOLDER":return{...e,currentFolder:t.payload.folder,shouldResetFilters:!!t.payload.shouldResetFilters,...n};case"SET_FACETS":return{...e,facets:t.payload};case"SET_FILTERS":return{...e,selectedFacets:t.payload,shouldResetFilters:!1,...n};case"SET_HAS_SCROLLED":return{...e,hasScrolled:t.payload};case"SET_IS_LOADING":return{...e,isLoading:t.payload};case"SET_IS_SEE_THROUGH":return{...e,isSeeThrough:t.payload,...n};case"SET_OPEN_BROWSER":return{...e,openBrowser:t.payload};case"SET_START":return{...e,start:t.payload,pageSize:e.defaultPageSize};case"SET_PAGE_SIZE":{const n={...e,pageSize:t.payload.pageSize,maxPageSize:t.payload.pageSize};return t.payload.returnToFirstPage&&(n.start=0),n}case"SET_SEARCH_TEXT":return{...e,...n,searchText:t.payload};case"SET_SORT_DIRECTION":return{...e,...n,sortDirection:t.payload};case"SET_SORT_ORDER":return{...e,...n,sortOrder:t.payload};case"SET_TOTAL_COUNT":return{...e,totalCount:t.payload};case"SET_VIEW":{let n=Ut.md;switch(t.payload){case Yt.gf.Large:n=15;break;case Yt.gf.Medium:n=20;break;case Yt.gf.Small:n=30}return{...e,view:t.payload,defaultPageSize:n}}case"RESET_SEARCH":return{...e,currentCount:0,currentFolder:Nt,searchText:"",totalCount:0};default:return e}},Zr=()=>{var e;const[t,n]=(0,wt.useReducer)(Xr,Gr),r=(0,Vr.GV)(Hr.jT),o=(0,Vr.GV)(Hr.wL),i=(0,Vr.GV)(qr.OC),{allowedExtensions:a,allowedFolders:s,allowFavorites:l,allowPin:c,allowProxy:u,allowTracking:d,availableDocTypes:h,availableRepresentativeSubtypes:p,ctaText:f,lastLocationMode:m,persistMode:g,showCollections:v,showFavoriteFolder:b,showVersions:y,defaultGridView:x}=(0,wt.useContext)(ur.t),{extraFields:w,onAssetAction:S,onAssetSelected:k,onClose:_}=(0,wt.useContext)(zt.B),{data:C,isFetching:E,isError:A}=(0,Rt.aM)(i?{id:i,useSession:o}:Ft.hT),T=(0,wt.useMemo)((()=>C&&i&&C.recordId===i?C:null),[C,i]),{data:O,isFetching:P,isLoading:z,refetch:D}=(0,Wr.X)({});(0,wt.useEffect)((()=>{r&&D()}),[r,D]);const{data:R,isFetching:j,isError:N}=(0,nr.t$)(T?{assetImages:T?[T]:[],useSession:o}:Ft.hT),{data:I}=(0,nr.jS)({useSession:o}),{data:M}=(0,nr.M$)({useSession:o}),{ATSEnabled:F,autoExtension:L=".auto",collectionPath:B,supportedExtensions:U,supportedRepresentativeSubtypes:V}=M||{},{data:q}=(0,nr.ZP)({useSession:o}),{data:H}=(0,nr.nb)({useSession:o}),{data:W,refetch:K}=(0,Rt.E7)(T&&l?{recordId:T.id}:Ft.hT),[$,Q]=(0,wt.useState)(!1),[G,X]=(0,wt.useState)(!1),[Z,Y]=(0,wt.useState)(dn.EI.Hide),[J,ee]=(0,wt.useState)(0),[te,ne]=(0,wt.useState)(!1),[re,oe]=(0,wt.useState)(!1),ie=(0,wt.useRef)($),ae=(0,wt.useRef)(null),le=(0,wt.useRef)(null),ce=(0,wt.useRef)(null),ue=(0,wt.useRef)(!1),de=(0,wt.useRef)([]),he=(0,wt.useRef)({}),pe=(0,Vr.jL)(),fe=(0,wt.useRef)(t.pageSize),me=(0,wt.useRef)(t.view),ge=(0,wt.useRef)(!1),ve=(0,wt.useRef)(null);ie.current=$,de.current=t.facets,he.current=t.selectedFacets,me.current=t.view,fe.current=t.pageSize;const be=(0,wt.useRef)(null),ye=(0,wt.useMemo)((()=>t.selectedFacets.Types&&t.selectedFacets.Types.length>0?t.selectedFacets.Types:["*"]),[t.selectedFacets]),xe=(0,wt.useMemo)((()=>!(null!==ye&&void 0!==ye&&ye.length)||0===ye.length),[ye]),we=(0,wt.useMemo)((()=>{var e;if(!q)return;const r=null===(e=Object.values(q).find((e=>e.some((e=>e.isDefault)))))||void 0===e?void 0:e[0];return t.sortOrder&&q[t.sortOrder]&&0!==q[t.sortOrder].length?1===q[t.sortOrder].length?q[t.sortOrder][0]:q[t.sortOrder].find((e=>{let{sortDirection:n}=e;return n.toLowerCase()===t.sortDirection})):(r&&(n({type:"SET_SORT_DIRECTION",payload:r.sortDirection.toLowerCase()}),n({type:"SET_SORT_ORDER",payload:r.sortDirectionGroupKey.toLowerCase()})),r)}),[q,t.sortDirection,t.sortOrder]),Se=(0,wt.useMemo)((()=>null===R||void 0===R?void 0:R.proxies.filter((e=>{if(!a||0===a.length)return!0;let t="";if(e.extension)t=e.extension.replace(".","");else{var n;const r=null===(n=e.permanentLink)||void 0===n?void 0:n.split(".").at(-1);t=null!==r&&void 0!==r?r:""}return a.some((e=>!!t&&t.toLowerCase()===e.toLowerCase()))}))),[R,a]),_e=(0,wt.useMemo)((()=>G&&q&&(null===ye||void 0===ye?void 0:ye.length)&&$),[G,q,ye,$]),{data:Ce,isFetching:Ee,isError:Ae,refetch:Te}=(0,Rt.pf)(_e?{folderID:t.currentFolder.id,isSeeThrough:t.isSeeThrough,limitedToDocTypes:h,pageSize:t.pageSize,searchText:t.searchText,selectedFacets:t.selectedFacets,sortOrder:null===we||void 0===we?void 0:we.id,start:t.start,useSession:o}:Ft.hT);(0,wt.useEffect)((()=>{var e;ee(null!==(e=null===Ce||void 0===Ce?void 0:Ce.items.length)&&void 0!==e?e:0)}),[null===Ce||void 0===Ce?void 0:Ce.items.length]),(0,wt.useEffect)((()=>{A&&pe((0,qr.DM)(null))}),[pe,A]),(0,wt.useEffect)((()=>{S&&null!==T&&void 0!==T&&T.recordId&&S("select",T.recordId)}),[S,T]),(0,wt.useEffect)((()=>{let e=null;return Ee?n({type:"SET_IS_LOADING",payload:!0}):e=setTimeout((()=>{n({type:"SET_IS_LOADING",payload:Ee})}),200),()=>{e&&clearTimeout(e)}}),[Ee]),(0,wt.useEffect)((()=>{r&&(pe((0,qr.DM)(null)),n({type:"RESET_SEARCH"}),Promise.all([(0,Mt.bQ)("selectedSortOrder"),(0,Mt.bQ)("selectedSortDirection"),(0,Mt.bQ)("selectedView"),(0,Mt.bQ)("newFacets"),(0,Mt.bQ)("selectedFilter"),(0,Mt.bQ)("selectedIsSeeThrough"),(0,Mt.bQ)("searchText")]).then((e=>{let[t,r,o,i,a,s,l]=e;if(t&&n({type:"SET_SORT_ORDER",payload:t}),"ascending"!==r&&"descending"!==r||n({type:"SET_SORT_DIRECTION",payload:r}),null===o&&(o=x),"string"===typeof o&&(Object.values(Yt.gf).includes(o)?n({type:"SET_VIEW",payload:o}):n({type:"SET_VIEW",payload:Yt.gf.Medium})),m){if(i){const e=JSON.parse(i);(0,Ge.A)(e)?n({type:"SET_FACETS",payload:e}):n({type:"SET_FACETS",payload:[]})}if(a){const e=JSON.parse(a);n(e?{type:"SET_FILTERS",payload:xt(e,Ge.A)}:{type:"SET_FILTERS",payload:{}})}s&&n({type:"SET_IS_SEE_THROUGH",payload:"true"===s}),l&&n({type:"SET_SEARCH_TEXT",payload:l})}ue.current=!0,oe(!0)})))}),[pe,r,m,x]),(0,wt.useEffect)((()=>{let e=null;const t=ae.current;if(!t)return;const n=t.offsetWidth;return t.style.width=n-1+"px",e=setTimeout((()=>{t.style.width="100%"}),50),()=>{e&&clearTimeout(e)}}),[r]),(0,wt.useEffect)((()=>{const e=ce.current;if(!e)return;ae.current&&n({type:"SET_CONTAINER_SIZE",payload:{width:ae.current.offsetWidth,height:ae.current.offsetHeight}});const t=e=>{const t=e.detail.entries;window.requestAnimationFrame((()=>{Array.isArray(t)&&t.length&&t[0].target===ae.current&&n({type:"SET_CONTAINER_SIZE",payload:{width:t[0].contentRect.width,height:t[0].contentRect.height}})}))};return e.addEventListener("cx-resize",t),()=>{e.removeEventListener("cx-resize",t)}}),[re]),(0,wt.useEffect)((()=>{!we&&ue.current&&n({type:"SET_SORT_ORDER",payload:Gr.sortOrder})}),[we,q]),(0,wt.useEffect)((()=>{ue.current&&((0,Mt.yt)("selectedSortOrder",t.sortOrder),t.sortDirection&&(0,Mt.yt)("selectedSortDirection",t.sortDirection),(0,Mt.yt)("selectedView",t.view),(0,Mt.yt)("newFacets",JSON.stringify(t.facets)),(0,Mt.yt)("selectedFilter",JSON.stringify(t.selectedFacets)),(0,Mt.yt)("selectedIsSeeThrough",t.isSeeThrough.toString()),(0,Mt.yt)("searchText",t.searchText))}),[t.currentFolder,t.facets,t.isSeeThrough,t.sortDirection,t.sortOrder,t.searchText,t.view,t.selectedFacets]);const Oe=t.containerSize.width>0&&t.containerSize.width<=Ut.Pm,Pe=e=>{pe((0,qr.DM)(e.recordId))},ze=(0,wt.useCallback)((e=>{pe((0,qr.DM)(null)),n({type:"SET_SEARCH_TEXT",payload:e})}),[pe]),De=(0,wt.useRef)(0),Re=(0,wt.useRef)(0),je=(0,wt.useRef)(t.defaultPageSize);je.current=t.defaultPageSize;const Ne=(0,wt.useCallback)(((e,t)=>{var r;const{width:o,height:i}=e,a=o||0,s=i||0;if(a*s===0||!ue.current)return;const l=De.current,c=Re.current;if(Math.abs(l-s)<10&&Math.abs(c-a)<10&&(null===t||void 0===t||!t.force))return;De.current=s,Re.current=a;const u=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--cx-spacing-medium")||"16",10),d=(null===(r=Mr[me.current])||void 0===r?void 0:r.minWidth)||Mr[Yt.gf.Large].minWidth,h=Math.max(1,Math.floor((a+u)/(d+u))),p=Math.ceil(s/(d+u)),f=Math.ceil(p*h/je.current+1)*je.current;X(!0),f!==fe.current&&0!==f&&n({type:"SET_PAGE_SIZE",payload:{pageSize:f,returnToFirstPage:!(null===t||void 0===t||!t.returnToFirstPage)}})}),[]),Ie=(0,wt.useMemo)((()=>ke(Ne,Ut.h,{leading:!1})),[Ne]);(0,wt.useEffect)((()=>{if(ue.current){const e=le.current;me.current=t.view,e&&Ie({width:e.clientWidth,height:e.clientHeight},{returnToFirstPage:!0,force:!0})}}),[Ie,t.view]);const Me=(0,wt.useCallback)(((e,t)=>{switch(e){case"view":n({type:"SET_VIEW",payload:t});break;case"sortDirection":n({type:"SET_SORT_DIRECTION",payload:t});break;case"sortOrder":n({type:"SET_SORT_ORDER",payload:t.toString()});break;case"isSeeThrough":n({type:"SET_IS_SEE_THROUGH",payload:Boolean(t)});break;case"filter":n({type:"SET_FILTERS",payload:t})}}),[]),Fe=(0,wt.useCallback)((e=>{n({type:"SET_CURRENT_COUNT",payload:e.currentCount}),n({type:"SET_TOTAL_COUNT",payload:e.totalCount}),n({type:"SET_FACETS",payload:e.facets})}),[]),Le=(0,wt.useCallback)((async e=>{ie.current||Q(!0);const t=await pe(It(e));It.fulfilled.match(t)&&(n({type:"SET_CURRENT_FOLDER",payload:{folder:e,shouldResetFilters:ie.current}}),te||n({type:"SET_OPEN_BROWSER",payload:!1}),pe((0,qr.DM)(null)),(0,Mt.yt)("lastLocation",JSON.stringify(e)))}),[pe,te]),Be=(0,wt.useCallback)((()=>{ge.current?ge.current=!1:n({type:"SET_START",payload:null!==J&&void 0!==J?J:0})}),[J]),Ue=(0,wt.useCallback)((e=>{if(!e.target)return;const t=e.target.scrollTop;n(0===t?{type:"SET_HAS_SCROLLED",payload:!1}:{type:"SET_HAS_SCROLLED",payload:!0})}),[]),Ve=(0,wt.useCallback)((async(e,t,n)=>{const r=[...e];Dt.Yq.forEach((e=>{const o=se(e);var i,a,s,l,c,u,d,h,p,f;T&&null!==w&&void 0!==w&&w.includes(e)&&(r[0]={...r[0],extraFields:{...(null===(i=r[0])||void 0===i?void 0:i.extraFields)||{},[e]:T[o]}});n?r[0]={...r[0],assetTransformationSource:t,assetLinkInfo:{extension:n.extension,isCustomFormat:null===(a=n.isCustomFormat)||void 0===a||a,permanentLink:r[0].imageUrl,width:n.width,height:n.height}}:r[0]={...r[0],assetLinkInfo:{cdnName:null!==(s=null===t||void 0===t?void 0:t.cdnName)&&void 0!==s?s:null,extension:null!==(l=null===t||void 0===t?void 0:t.extension)&&void 0!==l?l:null,isCustomFormat:null!==(c=null===t||void 0===t?void 0:t.isCustomFormat)&&void 0!==c&&c,permanentLink:null!==(u=r[0].imageUrl)&&void 0!==u?u:null,proxyLabel:null!==(d=null===t||void 0===t?void 0:t.proxyLabel)&&void 0!==d?d:null,proxyName:null!==(h=null===t||void 0===t?void 0:t.proxyName)&&void 0!==h?h:null,width:null!==(p=null===t||void 0===t?void 0:t.width)&&void 0!==p?p:null,height:null!==(f=null===t||void 0===t?void 0:t.height)&&void 0!==f?f:null}}}));const o=k(r);if("object"===typeof(i=o)&&null!==i&&"function"===typeof i.then)try{await o}catch(a){return void console.error("Error in onAssetSelected:",a)}var i;g||null===_||void 0===_||_()}),[w,k,_,g,T]),qe=(0,wt.useMemo)((()=>!!Ce&&t.start+t.pageSize<t.totalCount),[Ce,t.pageSize,t.start,t.totalCount]);(0,wt.useEffect)((()=>{if(Fe){var e,t,n,r,o;const i=new Map(de.current.map((e=>[`${e.facetDetails.facetFieldName}|${e.facetDetails.displayName}`,{...e,values:e.values.reduce(((t,n)=>{var r;return(null===(r=he.current[e.facetDetails.facetFieldName])||void 0===r?void 0:r.find((e=>e===n.value)))&&t.push({...n,count:0}),t}),[])}])));(null!==(e=null===Ce||void 0===Ce||null===(t=Ce.facets)||void 0===t?void 0:t.filter((e=>e.values.length>0)))&&void 0!==e?e:[]).forEach((e=>{var t;const n=i.get(`${e.facetDetails.facetFieldName}|${e.facetDetails.displayName}`),r=[...e.values,...null!==(t=null===n||void 0===n?void 0:n.values.filter((t=>!(null!==e&&void 0!==e&&e.values.find((e=>t.value===e.value&&t.displayValue===e.displayValue))))))&&void 0!==t?t:[]];i.set(`${e.facetDetails.facetFieldName}|${e.facetDetails.displayName}`,{...e,values:r})})),Fe({currentCount:null!==(n=null===Ce||void 0===Ce?void 0:Ce.items.length)&&void 0!==n?n:0,items:null!==(r=null===Ce||void 0===Ce?void 0:Ce.items)&&void 0!==r?r:[],facets:Array.from(i.values()),totalCount:null!==(o=null===Ce||void 0===Ce?void 0:Ce.totalCount)&&void 0!==o?o:0})}}),[Ce,Fe]),(0,wt.useEffect)((()=>{const e=()=>{ge.current=!0,ve.current&&clearTimeout(ve.current),ve.current=setTimeout((()=>{ge.current=!1}),Ut.h)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),(0,wt.useEffect)((()=>{const e=be.current,t=()=>{e&&window.clearTimeout(e)};return t(),E||j?(Y(dn.EI.Hide),be.current=window.setTimeout((()=>{Y(dn.EI.ShowLoader)}),800)):E||j||!(null!==R&&void 0!==R&&R.proxies||N)||be.current&&(t(),Y(dn.EI.ShowDialog)),()=>{t()}}),[R,N,j,E]),(0,wt.useEffect)((()=>{T||Y(dn.EI.ShowDialog)}),[T]);const He=(0,wt.useMemo)((()=>I&&a&&0!==a.length?Object.entries(I).reduce(((e,t)=>{let[n,r]=t;return{...e,[n]:r.filter((e=>!a||0===a.length||a.some((t=>e.value.toLowerCase()===`.${t.toLowerCase()}`))))}}),I):I),[I,a]),We=t.containerSize.width<650;return re?(0,Vt.jsx)("cx-resize-observer",{ref:ce,children:(0,Vt.jsxs)(Kr,{ref:ae,className:"cbsdk__home",children:[(0,Vt.jsx)(rn,{allowedFolders:s,allowPin:c,collectionPath:B,currentFolder:t.currentFolder,favoriteFolderId:null===O||void 0===O?void 0:O.favoriteFolderRecordID,lastLocationMode:m,open:t.openBrowser,showCollections:v,showFavoriteFolder:b,useSession:o,onFolderSelect:Le,onClose:()=>n({type:"SET_OPEN_BROWSER",payload:!1}),isPersistent:te,onChangePersistent:ne,forceOverlay:We,damViewSeeThru:t.isSeeThrough}),(0,Vt.jsxs)($r,{children:[(0,Vt.jsx)(hr,{bordered:t.hasScrolled,currentFolder:t.currentFolder,isFetching:P,isLoading:z,userInfo:O,showMenu:!te,onMenuClick:()=>n({type:"SET_OPEN_BROWSER",payload:!0}),onLogout:()=>{pe((0,Hr.ri)()),pe((0,qr.DM)(null)),n({type:"RESET_SEARCH"})},children:(0,Vt.jsx)(un,{allowSorting:"Mono"!==(null===we||void 0===we?void 0:we.sortDirection)&&!!we,availableFacets:null!==H&&void 0!==H?H:[],currentCount:t.currentCount,facets:t.facets,isMobile:Oe,isSeeThrough:t.isSeeThrough,loading:t.isLoading,searchValue:t.searchText,selectedFacets:t.selectedFacets,sortDirection:t.sortDirection,sortOrder:t.sortOrder,sortOrders:q,totalCount:t.totalCount,view:t.view,onSearchChange:ze,onSettingChange:Me})}),(0,Vt.jsx)("div",{style:{flex:1,minHeight:"320px",padding:"0 var(--cx-spacing-medium)",position:"relative"},children:(0,Vt.jsx)(Pt,{onResize:Ie,children:e=>{let{height:n,width:r}=e;return(0,Vt.jsx)("div",{style:{height:n+"px",width:r+"px"},children:(0,Vt.jsx)(Ur,{ref:le,isError:Ae,isConfigError:xe,hasNextPage:qe,height:n,isLoadingData:t.isLoading||!Ce,isFetched:!!Ce||xe,items:(null===Ce||void 0===Ce?void 0:Ce.items)||[],selectedAsset:null!==T&&void 0!==T?T:null,view:t.view,width:r,onItemSelect:Pe,onLoadMore:Be,onScroll:Ue},t.currentFolder.id+t.searchText+Object.values(t.selectedFacets).join("+")+t.isSeeThrough+t.view)})}})}),Z===dn.EI.ShowLoader&&(0,Vt.jsx)("cx-space",{className:"format-loader",children:(0,Vt.jsx)("cx-spinner",{})}),(0,Vt.jsx)(cr,{allowCustomFormat:!!F&&!(null===T||void 0===T||!T.allowATSLink),allowFavorites:l,allowProxy:u,allowTracking:d,allowedExtensions:a,appendAutoExtension:null!==(e=null===a||void 0===a?void 0:a.includes(L))&&void 0!==e&&e,autoExtension:L,availableExtensions:He,availableProxies:N?[]:j?void 0:Se,ctaText:f,extensions:null!==U&&void 0!==U?U:[],isFavorite:!!W,maxHeight:t.containerSize.height,open:!!T&&Z===dn.EI.ShowDialog,previewUrl:N||j||null===R||void 0===R?void 0:R.previewUrl,selectedAsset:null!==T&&void 0!==T?T:null,showVersions:y,supportedRepresentativeSubtypes:null!==p&&void 0!==p&&p.length?Qe(p,V):V,variant:Oe?"drawer":"dialog",boundary:ae.current,onClose:()=>{pe((0,qr.DM)(null)),S("unselect","")},onFavorite:async()=>{if(!T)return!1;const e=await pe((0,qr.P1)({recordId:T.recordId}));return qr.P1.fulfilled.match(e)&&(S&&S("favorite",T.recordId),await K(),S&&S("afterFavorite",T.recordId),t.currentFolder.id===(null===O||void 0===O?void 0:O.favoriteFolderRecordID)&&(0===t.start?Te():n({type:"SET_CURRENT_FOLDER",payload:{folder:t.currentFolder,shouldResetFilters:!0}}))),!!e||e},onProxyConfirm:async e=>{let{extension:t,value:n,permanentLink:r,parameters:i,useRepresentative:a,selectedProxyMetadata:s}=e;if(!T)return;const l=await pe((0,qr.Tp)({extension:t,extraFields:w,parameters:i,permanentLink:r,proxiesPreference:n,selectedAsset:T,useRepresentative:a,useSession:o}));qr.Tp.fulfilled.match(l)&&await Ve(l.payload,s)},onFormatConfirm:async e=>{let{value:t,parameters:n,proxiesPreference:r,extension:i,sourceProxyMetadata:a,transformedAssetMetadata:s}=e;if(!T)return;const l=null!==T&&void 0!==T&&T.width?parseInt(T.width,10):0,c=null!==T&&void 0!==T&&T.height?parseInt(T.height,10):0,u=await pe((0,qr.Tp)({extraFields:w,extension:i,maxHeight:c,maxWidth:l,parameters:n,proxiesPreference:r,selectedAsset:T,useSession:o,transformations:t}));qr.Tp.fulfilled.match(u)&&await Ve(u.payload,a,s)},onUnFavorite:async()=>{if(!T)return!1;const e=await pe((0,qr.BZ)({recordId:T.recordId}));return qr.BZ.fulfilled.match(e)&&(S&&S("unfavorite",T.recordId),await K(),S&&S("afterUnfavorite",T.recordId),t.currentFolder.id===(null===O||void 0===O?void 0:O.favoriteFolderRecordID)&&(0===t.start?Te():n({type:"SET_CURRENT_FOLDER",payload:{folder:t.currentFolder,shouldResetFilters:!0}}))),!!e||e}})]})]})}):(0,Vt.jsx)(Qr.A,{})}},1158:(e,t,n)=>{"use strict";n.d(t,{gf:()=>o,zu:()=>r});let r=function(e){return e.Album="Album",e.Audio="Audio",e.Image="Image",e.Multimedia="Multimedia",e.Story="Story",e.Video="Video",e.Widget="Widget",e}({}),o=function(e){return e.Small="small",e.Medium="medium",e.Large="large",e}({})},1185:(e,t,n)=>{e.exports=n(9392)},1218:e=>{var t,n,r,o,i,a,s,l,c,u,d,h,p,f,m,g=!1;function v(){if(!g){g=!0;var e=navigator.userAgent,v=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),b=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(h=/\b(iPhone|iP[ao]d)/.exec(e),p=/\b(iP[ao]d)/.exec(e),u=/Android/i.exec(e),f=/FBAN\/\w+;/i.exec(e),m=/Mobile/i.exec(e),d=!!/Win64/.exec(e),v){(t=v[1]?parseFloat(v[1]):v[5]?parseFloat(v[5]):NaN)&&document&&document.documentMode&&(t=document.documentMode);var y=/(?:Trident\/(\d+.\d+))/.exec(e);a=y?parseFloat(y[1])+4:t,n=v[2]?parseFloat(v[2]):NaN,r=v[3]?parseFloat(v[3]):NaN,(o=v[4]?parseFloat(v[4]):NaN)?(v=/(?:Chrome\/(\d+\.\d+))/.exec(e),i=v&&v[1]?parseFloat(v[1]):NaN):i=NaN}else t=n=r=i=o=NaN;if(b){if(b[1]){var x=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);s=!x||parseFloat(x[1].replace("_","."))}else s=!1;l=!!b[2],c=!!b[3]}else s=l=c=!1}}var b={ie:function(){return v()||t},ieCompatibilityMode:function(){return v()||a>t},ie64:function(){return b.ie()&&d},firefox:function(){return v()||n},opera:function(){return v()||r},webkit:function(){return v()||o},safari:function(){return b.webkit()},chrome:function(){return v()||i},windows:function(){return v()||l},osx:function(){return v()||s},linux:function(){return v()||c},iphone:function(){return v()||h},mobile:function(){return v()||h||p||u||m},nativeApp:function(){return v()||f},android:function(){return v()||u},ipad:function(){return v()||p}};e.exports=b},1375:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var r=n(4306);const o=function(){return!1};var i="object"==typeof exports&&exports&&!exports.nodeType&&exports,a=i&&"object"==typeof module&&module&&!module.nodeType&&module,s=a&&a.exports===i?r.A.Buffer:void 0;const l=(s?s.isBuffer:void 0)||o},1672:(e,t,n)=>{var r;!function(){function o(e,t,n){return e.call.apply(e.bind,arguments)}function i(e,t,n){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function a(e,t,n){return(a=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?o:i).apply(null,arguments)}var s=Date.now||function(){return+new Date};function l(e,t){this.a=e,this.o=t||e,this.c=this.o.document}var c=!!window.FontFace;function u(e,t,n,r){if(t=e.c.createElement(t),n)for(var o in n)n.hasOwnProperty(o)&&("style"==o?t.style.cssText=n[o]:t.setAttribute(o,n[o]));return r&&t.appendChild(e.c.createTextNode(r)),t}function d(e,t,n){(e=e.c.getElementsByTagName(t)[0])||(e=document.documentElement),e.insertBefore(n,e.lastChild)}function h(e){e.parentNode&&e.parentNode.removeChild(e)}function p(e,t,n){t=t||[],n=n||[];for(var r=e.className.split(/\s+/),o=0;o<t.length;o+=1){for(var i=!1,a=0;a<r.length;a+=1)if(t[o]===r[a]){i=!0;break}i||r.push(t[o])}for(t=[],o=0;o<r.length;o+=1){for(i=!1,a=0;a<n.length;a+=1)if(r[o]===n[a]){i=!0;break}i||t.push(r[o])}e.className=t.join(" ").replace(/\s+/g," ").replace(/^\s+|\s+$/,"")}function f(e,t){for(var n=e.className.split(/\s+/),r=0,o=n.length;r<o;r++)if(n[r]==t)return!0;return!1}function m(e,t,n){function r(){s&&o&&i&&(s(a),s=null)}t=u(e,"link",{rel:"stylesheet",href:t,media:"all"});var o=!1,i=!0,a=null,s=n||null;c?(t.onload=function(){o=!0,r()},t.onerror=function(){o=!0,a=Error("Stylesheet failed to load"),r()}):setTimeout((function(){o=!0,r()}),0),d(e,"head",t)}function g(e,t,n,r){var o=e.c.getElementsByTagName("head")[0];if(o){var i=u(e,"script",{src:t}),a=!1;return i.onload=i.onreadystatechange=function(){a||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(a=!0,n&&n(null),i.onload=i.onreadystatechange=null,"HEAD"==i.parentNode.tagName&&o.removeChild(i))},o.appendChild(i),setTimeout((function(){a||(a=!0,n&&n(Error("Script load timeout")))}),r||5e3),i}return null}function v(){this.a=0,this.c=null}function b(e){return e.a++,function(){e.a--,x(e)}}function y(e,t){e.c=t,x(e)}function x(e){0==e.a&&e.c&&(e.c(),e.c=null)}function w(e){this.a=e||"-"}function S(e,t){this.c=e,this.f=4,this.a="n";var n=(t||"n4").match(/^([nio])([1-9])$/i);n&&(this.a=n[1],this.f=parseInt(n[2],10))}function k(e){var t=[];e=e.split(/,\s*/);for(var n=0;n<e.length;n++){var r=e[n].replace(/['"]/g,"");-1!=r.indexOf(" ")||/^\d/.test(r)?t.push("'"+r+"'"):t.push(r)}return t.join(",")}function _(e){return e.a+e.f}function C(e){var t="normal";return"o"===e.a?t="oblique":"i"===e.a&&(t="italic"),t}function E(e){var t=4,n="n",r=null;return e&&((r=e.match(/(normal|oblique|italic)/i))&&r[1]&&(n=r[1].substr(0,1).toLowerCase()),(r=e.match(/([1-9]00|normal|bold)/i))&&r[1]&&(/bold/i.test(r[1])?t=7:/[1-9]00/.test(r[1])&&(t=parseInt(r[1].substr(0,1),10)))),n+t}function A(e,t){this.c=e,this.f=e.o.document.documentElement,this.h=t,this.a=new w("-"),this.j=!1!==t.events,this.g=!1!==t.classes}function T(e){if(e.g){var t=f(e.f,e.a.c("wf","active")),n=[],r=[e.a.c("wf","loading")];t||n.push(e.a.c("wf","inactive")),p(e.f,n,r)}O(e,"inactive")}function O(e,t,n){e.j&&e.h[t]&&(n?e.h[t](n.c,_(n)):e.h[t]())}function P(){this.c={}}function z(e,t){this.c=e,this.f=t,this.a=u(this.c,"span",{"aria-hidden":"true"},this.f)}function D(e){d(e.c,"body",e.a)}function R(e){return"display:block;position:absolute;top:-9999px;left:-9999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:"+k(e.c)+";font-style:"+C(e)+";font-weight:"+e.f+"00;"}function j(e,t,n,r,o,i){this.g=e,this.j=t,this.a=r,this.c=n,this.f=o||3e3,this.h=i||void 0}function N(e,t,n,r,o,i,a){this.v=e,this.B=t,this.c=n,this.a=r,this.s=a||"BESbswy",this.f={},this.w=o||3e3,this.u=i||null,this.m=this.j=this.h=this.g=null,this.g=new z(this.c,this.s),this.h=new z(this.c,this.s),this.j=new z(this.c,this.s),this.m=new z(this.c,this.s),e=R(e=new S(this.a.c+",serif",_(this.a))),this.g.a.style.cssText=e,e=R(e=new S(this.a.c+",sans-serif",_(this.a))),this.h.a.style.cssText=e,e=R(e=new S("serif",_(this.a))),this.j.a.style.cssText=e,e=R(e=new S("sans-serif",_(this.a))),this.m.a.style.cssText=e,D(this.g),D(this.h),D(this.j),D(this.m)}w.prototype.c=function(e){for(var t=[],n=0;n<arguments.length;n++)t.push(arguments[n].replace(/[\W_]+/g,"").toLowerCase());return t.join(this.a)},j.prototype.start=function(){var e=this.c.o.document,t=this,n=s(),r=new Promise((function(r,o){!function i(){s()-n>=t.f?o():e.fonts.load(function(e){return C(e)+" "+e.f+"00 300px "+k(e.c)}(t.a),t.h).then((function(e){1<=e.length?r():setTimeout(i,25)}),(function(){o()}))}()})),o=null,i=new Promise((function(e,n){o=setTimeout(n,t.f)}));Promise.race([i,r]).then((function(){o&&(clearTimeout(o),o=null),t.g(t.a)}),(function(){t.j(t.a)}))};var I={D:"serif",C:"sans-serif"},M=null;function F(){if(null===M){var e=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);M=!!e&&(536>parseInt(e[1],10)||536===parseInt(e[1],10)&&11>=parseInt(e[2],10))}return M}function L(e,t,n){for(var r in I)if(I.hasOwnProperty(r)&&t===e.f[I[r]]&&n===e.f[I[r]])return!0;return!1}function B(e){var t,n=e.g.a.offsetWidth,r=e.h.a.offsetWidth;(t=n===e.f.serif&&r===e.f["sans-serif"])||(t=F()&&L(e,n,r)),t?s()-e.A>=e.w?F()&&L(e,n,r)&&(null===e.u||e.u.hasOwnProperty(e.a.c))?U(e,e.v):U(e,e.B):function(e){setTimeout(a((function(){B(this)}),e),50)}(e):U(e,e.v)}function U(e,t){setTimeout(a((function(){h(this.g.a),h(this.h.a),h(this.j.a),h(this.m.a),t(this.a)}),e),0)}function V(e,t,n){this.c=e,this.a=t,this.f=0,this.m=this.j=!1,this.s=n}N.prototype.start=function(){this.f.serif=this.j.a.offsetWidth,this.f["sans-serif"]=this.m.a.offsetWidth,this.A=s(),B(this)};var q=null;function H(e){0==--e.f&&e.j&&(e.m?((e=e.a).g&&p(e.f,[e.a.c("wf","active")],[e.a.c("wf","loading"),e.a.c("wf","inactive")]),O(e,"active")):T(e.a))}function W(e){this.j=e,this.a=new P,this.h=0,this.f=this.g=!0}function K(e,t,n,r,o){var i=0==--e.h;(e.f||e.g)&&setTimeout((function(){var e=o||null,s=r||{};if(0===n.length&&i)T(t.a);else{t.f+=n.length,i&&(t.j=i);var l,c=[];for(l=0;l<n.length;l++){var u=n[l],d=s[u.c],h=t.a,f=u;if(h.g&&p(h.f,[h.a.c("wf",f.c,_(f).toString(),"loading")]),O(h,"fontloading",f),h=null,null===q)if(window.FontFace){f=/Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent);var m=/OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent)&&/Apple/.exec(window.navigator.vendor);q=f?42<parseInt(f[1],10):!m}else q=!1;h=q?new j(a(t.g,t),a(t.h,t),t.c,u,t.s,d):new N(a(t.g,t),a(t.h,t),t.c,u,t.s,e,d),c.push(h)}for(l=0;l<c.length;l++)c[l].start()}}),0)}function $(e,t){this.c=e,this.a=t}function Q(e,t){this.c=e,this.a=t}function G(e,t){this.c=e||X,this.a=[],this.f=[],this.g=t||""}V.prototype.g=function(e){var t=this.a;t.g&&p(t.f,[t.a.c("wf",e.c,_(e).toString(),"active")],[t.a.c("wf",e.c,_(e).toString(),"loading"),t.a.c("wf",e.c,_(e).toString(),"inactive")]),O(t,"fontactive",e),this.m=!0,H(this)},V.prototype.h=function(e){var t=this.a;if(t.g){var n=f(t.f,t.a.c("wf",e.c,_(e).toString(),"active")),r=[],o=[t.a.c("wf",e.c,_(e).toString(),"loading")];n||r.push(t.a.c("wf",e.c,_(e).toString(),"inactive")),p(t.f,r,o)}O(t,"fontinactive",e),H(this)},W.prototype.load=function(e){this.c=new l(this.j,e.context||this.j),this.g=!1!==e.events,this.f=!1!==e.classes,function(e,t,n){var r=[],o=n.timeout;!function(e){e.g&&p(e.f,[e.a.c("wf","loading")]),O(e,"loading")}(t);r=function(e,t,n){var r,o=[];for(r in t)if(t.hasOwnProperty(r)){var i=e.c[r];i&&o.push(i(t[r],n))}return o}(e.a,n,e.c);var i=new V(e.c,t,o);for(e.h=r.length,t=0,n=r.length;t<n;t++)r[t].load((function(t,n,r){K(e,i,t,n,r)}))}(this,new A(this.c,e),e)},$.prototype.load=function(e){function t(){if(i["__mti_fntLst"+r]){var n,o=i["__mti_fntLst"+r](),a=[];if(o)for(var s=0;s<o.length;s++){var l=o[s].fontfamily;void 0!=o[s].fontStyle&&void 0!=o[s].fontWeight?(n=o[s].fontStyle+o[s].fontWeight,a.push(new S(l,n))):a.push(new S(l))}e(a)}else setTimeout((function(){t()}),50)}var n=this,r=n.a.projectId,o=n.a.version;if(r){var i=n.c.o;g(this.c,(n.a.api||"https://fast.fonts.net/jsapi")+"/"+r+".js"+(o?"?v="+o:""),(function(o){o?e([]):(i["__MonotypeConfiguration__"+r]=function(){return n.a},t())})).id="__MonotypeAPIScript__"+r}else e([])},Q.prototype.load=function(e){var t,n,r=this.a.urls||[],o=this.a.families||[],i=this.a.testStrings||{},a=new v;for(t=0,n=r.length;t<n;t++)m(this.c,r[t],b(a));var s=[];for(t=0,n=o.length;t<n;t++)if((r=o[t].split(":"))[1])for(var l=r[1].split(","),c=0;c<l.length;c+=1)s.push(new S(r[0],l[c]));else s.push(new S(r[0]));y(a,(function(){e(s,i)}))};var X="https://fonts.googleapis.com/css";function Z(e){this.f=e,this.a=[],this.c={}}var Y={latin:"BESbswy","latin-ext":"\xe7\xf6\xfc\u011f\u015f",cyrillic:"\u0439\u044f\u0416",greek:"\u03b1\u03b2\u03a3",khmer:"\u1780\u1781\u1782",Hanuman:"\u1780\u1781\u1782"},J={thin:"1",extralight:"2","extra-light":"2",ultralight:"2","ultra-light":"2",light:"3",regular:"4",book:"4",medium:"5","semi-bold":"6",semibold:"6","demi-bold":"6",demibold:"6",bold:"7","extra-bold":"8",extrabold:"8","ultra-bold":"8",ultrabold:"8",black:"9",heavy:"9",l:"3",r:"4",b:"7"},ee={i:"i",italic:"i",n:"n",normal:"n"},te=/^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$/;function ne(e,t){this.c=e,this.a=t}var re={Arimo:!0,Cousine:!0,Tinos:!0};function oe(e,t){this.c=e,this.a=t}function ie(e,t){this.c=e,this.f=t,this.a=[]}ne.prototype.load=function(e){var t=new v,n=this.c,r=new G(this.a.api,this.a.text),o=this.a.families;!function(e,t){for(var n=t.length,r=0;r<n;r++){var o=t[r].split(":");3==o.length&&e.f.push(o.pop());var i="";2==o.length&&""!=o[1]&&(i=":"),e.a.push(o.join(i))}}(r,o);var i=new Z(o);!function(e){for(var t=e.f.length,n=0;n<t;n++){var r=e.f[n].split(":"),o=r[0].replace(/\+/g," "),i=["n4"];if(2<=r.length){var a;if(a=[],s=r[1])for(var s,l=(s=s.split(",")).length,c=0;c<l;c++){var u;if((u=s[c]).match(/^[\w-]+$/))if(null==(d=te.exec(u.toLowerCase())))u="";else{if(u=null==(u=d[2])||""==u?"n":ee[u],null==(d=d[1])||""==d)d="4";else var d=J[d]||(isNaN(d)?"4":d.substr(0,1));u=[u,d].join("")}else u="";u&&a.push(u)}0<a.length&&(i=a),3==r.length&&(a=[],0<(r=(r=r[2])?r.split(","):a).length&&(r=Y[r[0]])&&(e.c[o]=r))}for(e.c[o]||(r=Y[o])&&(e.c[o]=r),r=0;r<i.length;r+=1)e.a.push(new S(o,i[r]))}}(i),m(n,function(e){if(0==e.a.length)throw Error("No fonts to load!");if(-1!=e.c.indexOf("kit="))return e.c;for(var t=e.a.length,n=[],r=0;r<t;r++)n.push(e.a[r].replace(/ /g,"+"));return t=e.c+"?family="+n.join("%7C"),0<e.f.length&&(t+="&subset="+e.f.join(",")),0<e.g.length&&(t+="&text="+encodeURIComponent(e.g)),t}(r),b(t)),y(t,(function(){e(i.a,i.c,re)}))},oe.prototype.load=function(e){var t=this.a.id,n=this.c.o;t?g(this.c,(this.a.api||"https://use.typekit.net")+"/"+t+".js",(function(t){if(t)e([]);else if(n.Typekit&&n.Typekit.config&&n.Typekit.config.fn){t=n.Typekit.config.fn;for(var r=[],o=0;o<t.length;o+=2)for(var i=t[o],a=t[o+1],s=0;s<a.length;s++)r.push(new S(i,a[s]));try{n.Typekit.load({events:!1,classes:!1,async:!0})}catch(l){}e(r)}}),2e3):e([])},ie.prototype.load=function(e){var t=this.f.id,n=this.c.o,r=this;t?(n.__webfontfontdeckmodule__||(n.__webfontfontdeckmodule__={}),n.__webfontfontdeckmodule__[t]=function(t,n){for(var o=0,i=n.fonts.length;o<i;++o){var a=n.fonts[o];r.a.push(new S(a.name,E("font-weight:"+a.weight+";font-style:"+a.style)))}e(r.a)},g(this.c,(this.f.api||"https://f.fontdeck.com/s/css/js/")+function(e){return e.o.location.hostname||e.a.location.hostname}(this.c)+"/"+t+".js",(function(t){t&&e([])}))):e([])};var ae=new W(window);ae.a.c.custom=function(e,t){return new Q(t,e)},ae.a.c.fontdeck=function(e,t){return new ie(t,e)},ae.a.c.monotype=function(e,t){return new $(t,e)},ae.a.c.typekit=function(e,t){return new oe(t,e)},ae.a.c.google=function(e,t){return new ne(t,e)};var se={load:a(ae.load,ae)};void 0===(r=function(){return se}.call(t,n,t,e))||(e.exports=r)}()},2041:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});const r=function(e){return e}},2222:(e,t,n)=>{"use strict";n.r(t),n.d(t,{createSelector:()=>i,createSelectorCreator:()=>o,createStructuredSelector:()=>a,defaultEqualityCheck:()=>r.Ig,defaultMemoize:()=>r.UI});var r=n(19);function o(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];var i,a=0,s={memoizeOptions:void 0},l=r.pop();if("object"===typeof l&&(s=l,l=r.pop()),"function"!==typeof l)throw new Error("createSelector expects an output function after the inputs, but received: ["+typeof l+"]");var c=s.memoizeOptions,u=void 0===c?n:c,d=Array.isArray(u)?u:[u],h=function(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"===typeof e}))){var n=t.map((function(e){return"function"===typeof e?"function "+(e.name||"unnamed")+"()":typeof e})).join(", ");throw new Error("createSelector expects all input-selectors to be functions, but received the following types: ["+n+"]")}return t}(r),p=e.apply(void 0,[function(){return a++,l.apply(null,arguments)}].concat(d)),f=e((function(){for(var e=[],t=h.length,n=0;n<t;n++)e.push(h[n].apply(null,arguments));return i=p.apply(null,e)}));return Object.assign(f,{resultFunc:l,memoizedResultFunc:p,dependencies:h,lastResult:function(){return i},recomputations:function(){return a},resetRecomputations:function(){return a=0}}),f}}var i=o(r.UI),a=function(e,t){if(void 0===t&&(t=i),"object"!==typeof e)throw new Error("createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);var n=Object.keys(e),r=t(n.map((function(t){return e[t]})),(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.reduce((function(e,t,r){return e[n[r]]=t,e}),{})}));return r}},2246:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(4951),o=n(579);const i=e=>{let{message:t,children:n}=e;return(0,o.jsxs)("cx-space",{direction:"vertical","align-items":"center",children:[(0,o.jsx)("cx-spinner",{style:{"--track-width":"0.2rem",fontSize:"var(--cx-font-size-3x-large)"}}),null===t||void 0===t?void 0:t.split(r.ag).map(((e,t)=>-1!==e.indexOf("http")?(0,o.jsx)("cx-button",{href:e,target:"_blank",children:e},t):(0,o.jsx)("cx-typography",{variant:"body2",children:e},t))),n]})}},2272:(e,t,n)=>{"use strict";function r(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function o(e){return!!e&&!!e[G]}function i(e){var t;return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===X}(e)||Array.isArray(e)||!!e[Q]||!!(null===(t=e.constructor)||void 0===t?void 0:t[Q])||p(e)||f(e))}function a(e){return o(e)||r(23,e),e[G].t}function s(e,t,n){void 0===n&&(n=!1),0===l(e)?(n?Object.keys:Z)(e).forEach((function(r){n&&"symbol"==typeof r||t(r,e[r],e)})):e.forEach((function(n,r){return t(r,n,e)}))}function l(e){var t=e[G];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:p(e)?2:f(e)?3:0}function c(e,t){return 2===l(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function u(e,t){return 2===l(e)?e.get(t):e[t]}function d(e,t,n){var r=l(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function h(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function p(e){return H&&e instanceof Map}function f(e){return W&&e instanceof Set}function m(e){return e.o||e.t}function g(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Y(e);delete t[G];for(var n=Z(t),r=0;r<n.length;r++){var o=n[r],i=t[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function v(e,t){return void 0===t&&(t=!1),y(e)||o(e)||!i(e)||(l(e)>1&&(e.set=e.add=e.clear=e.delete=b),Object.freeze(e),t&&s(e,(function(e,t){return v(t,!0)}),!0)),e}function b(){r(2)}function y(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function x(e){var t=J[e];return t||r(18,e),t}function w(e,t){J[e]||(J[e]=t)}function S(){return V}function k(e,t){t&&(x("Patches"),e.u=[],e.s=[],e.v=t)}function _(e){C(e),e.p.forEach(A),e.p=null}function C(e){e===V&&(V=e.l)}function E(e){return V={p:[],l:V,h:e,m:!0,_:0}}function A(e){var t=e[G];0===t.i||1===t.i?t.j():t.g=!0}function T(e,t){t._=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.O||x("ES5").S(t,e,o),o?(n[G].P&&(_(t),r(4)),i(e)&&(e=O(t,e),t.l||z(t,e)),t.u&&x("Patches").M(n[G].t,e,t.u,t.s)):e=O(t,n,[]),_(t),t.u&&t.v(t.u,t.s),e!==$?e:void 0}function O(e,t,n){if(y(t))return t;var r=t[G];if(!r)return s(t,(function(o,i){return P(e,r,t,o,i,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return z(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var o=4===r.i||5===r.i?r.o=g(r.k):r.o,i=o,a=!1;3===r.i&&(i=new Set(o),o.clear(),a=!0),s(i,(function(t,i){return P(e,r,o,t,i,n,a)})),z(e,o,!1),n&&e.u&&x("Patches").N(r,n,e.u,e.s)}return r.o}function P(e,t,n,r,a,s,l){if(o(a)){var u=O(e,a,s&&t&&3!==t.i&&!c(t.R,r)?s.concat(r):void 0);if(d(n,r,u),!o(u))return;e.m=!1}else l&&n.add(a);if(i(a)&&!y(a)){if(!e.h.D&&e._<1)return;O(e,a),t&&t.A.l||z(e,a)}}function z(e,t,n){void 0===n&&(n=!1),!e.l&&e.h.D&&e.m&&v(t,n)}function D(e,t){var n=e[G];return(n?m(n):e)[t]}function R(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function j(e){e.P||(e.P=!0,e.l&&j(e.l))}function N(e){e.o||(e.o=g(e.t))}function I(e,t,n){var r=p(t)?x("MapSet").F(t,n):f(t)?x("MapSet").T(t,n):e.O?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:S(),P:!1,I:!1,R:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=r,i=ee;n&&(o=[r],i=te);var a=Proxy.revocable(o,i),s=a.revoke,l=a.proxy;return r.k=l,r.j=s,l}(t,n):x("ES5").J(t,n);return(n?n.A:S()).p.push(r),r}function M(e){return o(e)||r(22,e),function e(t){if(!i(t))return t;var n,r=t[G],o=l(t);if(r){if(!r.P&&(r.i<4||!x("ES5").K(r)))return r.t;r.I=!0,n=F(t,o),r.I=!1}else n=F(t,o);return s(n,(function(t,o){r&&u(r.t,t)===o||d(n,t,e(o))})),3===o?new Set(n):n}(e)}function F(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return g(e)}function L(){function e(e,t){var n=i[e];return n?n.enumerable=t:i[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[G];return ee.get(t,e)},set:function(t){var n=this[G];ee.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][G];if(!o.P)switch(o.i){case 5:r(o)&&j(o);break;case 4:n(o)&&j(o)}}}function n(e){for(var t=e.t,n=e.k,r=Z(n),o=r.length-1;o>=0;o--){var i=r[o];if(i!==G){var a=t[i];if(void 0===a&&!c(t,i))return!0;var s=n[i],l=s&&s[G];if(l?l.t!==a:!h(s,a))return!0}}var u=!!t[G];return r.length!==Z(t).length+(u?0:1)}function r(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var r=0;r<t.length;r++)if(!t.hasOwnProperty(r))return!0;return!1}var i={};w("ES5",{J:function(t,n){var r=Array.isArray(t),o=function(t,n){if(t){for(var r=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(r,""+o,e(o,!0));return r}var i=Y(n);delete i[G];for(var a=Z(i),s=0;s<a.length;s++){var l=a[s];i[l]=e(l,t||!!i[l].enumerable)}return Object.create(Object.getPrototypeOf(n),i)}(r,t),i={i:r?5:4,A:n?n.A:S(),P:!1,I:!1,R:{},l:n,t:t,k:o,o:null,g:!1,C:!1};return Object.defineProperty(o,G,{value:i,writable:!0}),o},S:function(e,n,i){i?o(n)&&n[G].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[G];if(n){var o=n.t,i=n.k,a=n.R,l=n.i;if(4===l)s(i,(function(t){t!==G&&(void 0!==o[t]||c(o,t)?a[t]||e(i[t]):(a[t]=!0,j(n)))})),s(o,(function(e){void 0!==i[e]||c(i,e)||(a[e]=!1,j(n))}));else if(5===l){if(r(n)&&(j(n),a.length=!0),i.length<o.length)for(var u=i.length;u<o.length;u++)a[u]=!1;else for(var d=o.length;d<i.length;d++)a[d]=!0;for(var h=Math.min(i.length,o.length),p=0;p<h;p++)i.hasOwnProperty(p)||(a[p]=!0),void 0===a[p]&&e(i[p])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):r(e)}})}function B(){function e(t){if(!i(t))return t;if(Array.isArray(t))return t.map(e);if(p(t))return new Map(Array.from(t.entries()).map((function(t){return[t[0],e(t[1])]})));if(f(t))return new Set(Array.from(t).map(e));var n=Object.create(Object.getPrototypeOf(t));for(var r in t)n[r]=e(t[r]);return c(t,Q)&&(n[Q]=t[Q]),n}function t(t){return o(t)?e(t):t}var n="add";w("Patches",{$:function(t,o){return o.forEach((function(o){for(var i=o.path,a=o.op,s=t,c=0;c<i.length-1;c++){var d=l(s),h=i[c];"string"!=typeof h&&"number"!=typeof h&&(h=""+h),0!==d&&1!==d||"__proto__"!==h&&"constructor"!==h||r(24),"function"==typeof s&&"prototype"===h&&r(24),"object"!=typeof(s=u(s,h))&&r(15,i.join("/"))}var p=l(s),f=e(o.value),m=i[i.length-1];switch(a){case"replace":switch(p){case 2:return s.set(m,f);case 3:r(16);default:return s[m]=f}case n:switch(p){case 1:return"-"===m?s.push(f):s.splice(m,0,f);case 2:return s.set(m,f);case 3:return s.add(f);default:return s[m]=f}case"remove":switch(p){case 1:return s.splice(m,1);case 2:return s.delete(m);case 3:return s.delete(o.value);default:return delete s[m]}default:r(17,a)}})),t},N:function(e,r,o,i){switch(e.i){case 0:case 4:case 2:return function(e,r,o,i){var a=e.t,l=e.o;s(e.R,(function(e,s){var d=u(a,e),h=u(l,e),p=s?c(a,e)?"replace":n:"remove";if(d!==h||"replace"!==p){var f=r.concat(e);o.push("remove"===p?{op:p,path:f}:{op:p,path:f,value:h}),i.push(p===n?{op:"remove",path:f}:"remove"===p?{op:n,path:f,value:t(d)}:{op:"replace",path:f,value:t(d)})}}))}(e,r,o,i);case 5:case 1:return function(e,r,o,i){var a=e.t,s=e.R,l=e.o;if(l.length<a.length){var c=[l,a];a=c[0],l=c[1];var u=[i,o];o=u[0],i=u[1]}for(var d=0;d<a.length;d++)if(s[d]&&l[d]!==a[d]){var h=r.concat([d]);o.push({op:"replace",path:h,value:t(l[d])}),i.push({op:"replace",path:h,value:t(a[d])})}for(var p=a.length;p<l.length;p++){var f=r.concat([p]);o.push({op:n,path:f,value:t(l[p])})}a.length<l.length&&i.push({op:"replace",path:r.concat(["length"]),value:a.length})}(e,r,o,i);case 3:return function(e,t,r,o){var i=e.t,a=e.o,s=0;i.forEach((function(e){if(!a.has(e)){var i=t.concat([s]);r.push({op:"remove",path:i,value:e}),o.unshift({op:n,path:i,value:e})}s++})),s=0,a.forEach((function(e){if(!i.has(e)){var a=t.concat([s]);r.push({op:n,path:a,value:e}),o.unshift({op:"remove",path:a,value:e})}s++}))}(e,r,o,i)}},M:function(e,t,n,r){n.push({op:"replace",path:[],value:t===$?void 0:t}),r.push({op:"replace",path:[],value:e})}})}n.d(t,{$i:()=>ae,Ay:()=>se,CN:()=>v,Qx:()=>o,YT:()=>B,a6:()=>i,c2:()=>a,rF:()=>L,ss:()=>M,vI:()=>ie});var U,V,q="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),H="undefined"!=typeof Map,W="undefined"!=typeof Set,K="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,$=q?Symbol.for("immer-nothing"):((U={})["immer-nothing"]=!0,U),Q=q?Symbol.for("immer-draftable"):"__$immer_draftable",G=q?Symbol.for("immer-state"):"__$immer_state",X=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Z="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Y=Object.getOwnPropertyDescriptors||function(e){var t={};return Z(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},J={},ee={get:function(e,t){if(t===G)return e;var n=m(e);if(!c(n,t))return function(e,t,n){var r,o=R(t,n);return o?"value"in o?o.value:null===(r=o.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!i(r)?r:r===D(e.t,t)?(N(e),e.o[t]=I(e.A.h,r,e)):r},has:function(e,t){return t in m(e)},ownKeys:function(e){return Reflect.ownKeys(m(e))},set:function(e,t,n){var r=R(m(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var o=D(m(e),t),i=null==o?void 0:o[G];if(i&&i.t===n)return e.o[t]=n,e.R[t]=!1,!0;if(h(n,o)&&(void 0!==n||c(e.t,t)))return!0;N(e),j(e)}return e.o[t]===n&&(void 0!==n||t in e.o)||Number.isNaN(n)&&Number.isNaN(e.o[t])||(e.o[t]=n,e.R[t]=!0),!0},deleteProperty:function(e,t){return void 0!==D(e.t,t)||t in e.t?(e.R[t]=!1,N(e),j(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=m(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){r(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){r(12)}},te={};s(ee,(function(e,t){te[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),te.deleteProperty=function(e,t){return te.set.call(this,e,t,void 0)},te.set=function(e,t,n){return ee.set.call(this,e[0],t,n,e[0])};var ne=function(){function e(e){var t=this;this.O=K,this.D=!0,this.produce=function(e,n,o){if("function"==typeof e&&"function"!=typeof n){var a=n;n=e;var s=t;return function(e){var t=this;void 0===e&&(e=a);for(var r=arguments.length,o=Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return s.produce(e,(function(e){var r;return(r=n).call.apply(r,[t,e].concat(o))}))}}var l;if("function"!=typeof n&&r(6),void 0!==o&&"function"!=typeof o&&r(7),i(e)){var c=E(t),u=I(t,e,void 0),d=!0;try{l=n(u),d=!1}finally{d?_(c):C(c)}return"undefined"!=typeof Promise&&l instanceof Promise?l.then((function(e){return k(c,o),T(e,c)}),(function(e){throw _(c),e})):(k(c,o),T(l,c))}if(!e||"object"!=typeof e){if(void 0===(l=n(e))&&(l=e),l===$&&(l=void 0),t.D&&v(l,!0),o){var h=[],p=[];x("Patches").M(e,l,h,p),o(h,p)}return l}r(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var r=arguments.length,o=Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var r,o,i=t.produce(e,n,(function(e,t){r=e,o=t}));return"undefined"!=typeof Promise&&i instanceof Promise?i.then((function(e){return[e,r,o]})):[i,r,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){i(e)||r(8),o(e)&&(e=M(e));var t=E(this),n=I(this,e,void 0);return n[G].C=!0,C(t),n},t.finishDraft=function(e,t){var n=(e&&e[G]).A;return k(n,t),T(void 0,n)},t.setAutoFreeze=function(e){this.D=e},t.setUseProxies=function(e){e&&!K&&r(20),this.O=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));var i=x("Patches").$;return o(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),re=new ne,oe=re.produce,ie=re.produceWithPatches.bind(re),ae=(re.setAutoFreeze.bind(re),re.setUseProxies.bind(re),re.applyPatches.bind(re));re.createDraft.bind(re),re.finishDraft.bind(re);const se=oe},2330:(e,t,n)=>{"use strict";var r=n(5043);var o="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t},i=r.useState,a=r.useEffect,s=r.useLayoutEffect,l=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(r){return!0}}var u="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),o=r[0].inst,u=r[1];return s((function(){o.value=n,o.getSnapshot=t,c(o)&&u({inst:o})}),[e,n,t]),a((function(){return c(o)&&u({inst:o}),e((function(){c(o)&&u({inst:o})}))}),[e]),l(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},2404:(e,t,n)=>{"use strict";n.d(t,{J8:()=>c,VL:()=>l,gc:()=>a,gw:()=>o,q2:()=>s,z_:()=>i});var r=n(8024);const o="Authentication cancelled",i={controller:new AbortController},a=()=>{i.controller.abort(o),i.controller=new AbortController},s=async e=>{const t=await(0,r.uK)("webapi/extensibility/integrations/gab/authorization/requestauthorize_4bu_v1",{method:"POST",body:JSON.stringify({Nonce:e}),headers:{"Content-Type":"application/json"}});return{...await t.json(),nonce:e}},l=async e=>{i.controller=new AbortController;let t,n=0;for(;n<10;){const o=await(0,r.uK)("webapi/extensibility/integrations/gab/authorization/getaccesskey_4bv_v1",{signal:i.controller.signal,method:"POST",body:JSON.stringify({RequestID:e}),headers:{"Content-Type":"application/json"}});if(t=await o.json(),t.code&&"RepeatRequest"!==t.code)return t;n++}throw new Error("Unable to get Access Key: Max retries exceeded.")},c=async e=>(await(0,r.uK)("webapi/extensibility/integrations/gab/authorization/getaccesstoken_4bt_v1",{method:"POST",body:JSON.stringify({AccessKey:e}),headers:{"Content-Type":"application/json"}})).json()},2476:(e,t,n)=>{"use strict";n.d(t,{A:()=>h});const r=function(){this.__data__=[],this.size=0};var o=n(5009);const i=function(e,t){for(var n=e.length;n--;)if((0,o.A)(e[n][0],t))return n;return-1};var a=Array.prototype.splice;const s=function(e){var t=this.__data__,n=i(t,e);return!(n<0)&&(n==t.length-1?t.pop():a.call(t,n,1),--this.size,!0)};const l=function(e){var t=this.__data__,n=i(t,e);return n<0?void 0:t[n][1]};const c=function(e){return i(this.__data__,e)>-1};const u=function(e,t){var n=this.__data__,r=i(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function d(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}d.prototype.clear=r,d.prototype.delete=s,d.prototype.get=l,d.prototype.has=c,d.prototype.set=u;const h=d},2706:(e,t,n)=>{"use strict";n(7358)},2743:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>y});var r=n(5043),o=n(5650),i=n(416),a=n(6047),s=n(449),l=n(5137),c=n(6),u=n(8024),d=n(4413);var h=n(579);const p=()=>{const{onClose:e,onConnectClicked:t}=(0,r.useContext)(c.B),n=(0,l.wA)(),i=(0,l.d4)(a.KL),s=(0,l.d4)(a.uT),{isContentBrowserPopedup:p,pluginInfo:f,useSession:m}=(0,r.useContext)(o.t),[g,v]=(0,r.useState)(!1),[b,y]=(0,r.useState)(i),[x,w]=(0,r.useState)(null),[S,k]=function(e,t){const[n,o]=(0,r.useState)(e),i=(0,r.useRef)(null),a=()=>{i.current&&(clearTimeout(i.current),i.current=null)};(0,r.useEffect)((()=>()=>a()),[]);const s=(0,r.useCallback)((function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&a(),null===i.current?(o(e),i.current=setTimeout((()=>{i.current=null}),t)):(a(),i.current=setTimeout((()=>{i.current=null,o(e)}),t))}),[t]);return[n,s]}(!1,1e3),[_,C]=(0,r.useState)(!1),[E,A]=(0,r.useState)(m),T=(0,r.useRef)(null),O=(0,r.useRef)(null),P=(0,r.useRef)(null);(0,r.useEffect)((()=>{Promise.all([customElements.whenDefined("cx-input")]).then((()=>{v(!0)}))}),[]),(0,r.useEffect)((()=>{const e=T.current;if(!e||!g)return;const t=e=>{y(e.target.value),w(null)};return e.addEventListener("cx-input",t),()=>{e.removeEventListener("cx-input",t)}}),[g]),(0,r.useEffect)((()=>{const e=O.current;if(!e||!g)return;const t=e=>{A(e.target.value)};return e.addEventListener("cx-input",t),()=>{e.removeEventListener("cx-input",t)}}),[n,g,_]);const z=(0,r.useCallback)((()=>{k(!0,!0);const e=-1===b.indexOf("://")?`https://${b}`:b;(0,u.ps)(e).then((()=>{n((0,a.Wk)({siteUrl:e,callbackFn:t})),E&&n((0,a.I4)(E))})).catch((()=>{w("The site is currently not available. Please verify your Site URL and check your Internet connection.")})).finally((()=>k(!1)))}),[n,E,k,b,t]),D=(0,r.useCallback)((()=>{k(!1,!0),w(null)}),[k]);(0,r.useEffect)((()=>{if(_)return;let e=0,t=null;const n=()=>{if(e++,5===e)return C(!0),void(t&&clearTimeout(t));t&&clearTimeout(t),t=setTimeout((()=>{e=0}),2e3)},r=P.current;return r&&r.addEventListener("click",n),()=>{r&&r.removeEventListener("click",n),t&&clearTimeout(t)}}),[_]);let R="Connect";return S?R="Connecting...":x&&(R="Retry"),(0,h.jsxs)("div",{style:{background:`url(${d.gR})`,backgroundPositionX:"center",backgroundPositionY:"top",backgroundRepeat:"no-repeat",backgroundSize:"contain",display:"flex",inset:0,padding:"var(--cx-spacing-x-small)",position:"absolute"},children:[p&&(0,h.jsx)("cx-icon-button",{name:"close",label:"Close",onClick:e,style:{position:"fixed",top:"var(--cx-spacing-x-small)",right:"var(--cx-spacing-x-small)",zIndex:1e3}}),(0,h.jsx)("cx-space",{"align-items":"center","justify-content":"center",style:{height:"100%",textAlign:"center",width:"100%"},children:(0,h.jsxs)("cx-space",{direction:"vertical",spacing:"medium","align-items":"center",onKeyDown:e=>{"Enter"===e.key&&z()},children:[f.pluginName&&(0,h.jsxs)("cx-typography",{variant:"h2",children:["Welcome to the ",f.pluginName]}),f.publicApplicationName&&(0,h.jsxs)("cx-typography",{variant:"h4",children:["for ",f.publicApplicationName]}),s&&(0,h.jsxs)("cx-alert",{open:!0,variant:"danger",children:[(0,h.jsx)("cx-icon",{slot:"icon",name:"error"}),s]}),(0,h.jsx)("cx-input",{ref:T,label:"Site URL",placeholder:"Enter your site URL",value:b,"help-text":null!==x&&void 0!==x?x:void 0,style:{width:"100%"}}),_&&(0,h.jsx)("cx-input",{ref:O,label:"Session ID",placeholder:"Enter your session ID",value:m,style:{width:"100%"}}),(0,h.jsx)("cx-space",{"justify-content":"flex-end",style:{width:"100%"},children:(0,h.jsxs)("cx-space",{spacing:"small",wrap:"nowrap",children:[S&&(0,h.jsx)("cx-button",{variant:"default",onClick:D,children:"Cancel"}),(0,h.jsx)("cx-button",{disabled:""===b||S,variant:"primary","data-cy":"submit-button",style:{width:"100%"},onClick:z,children:R})]})})]})}),(0,h.jsx)("button",{ref:P,tabIndex:-1,style:{position:"absolute",left:0,bottom:0,opacity:0,width:"32px",height:"32px"}})]})},f=e=>{let{children:t,footer:n,onCancel:r}=e;return(0,h.jsxs)("cx-space",{direction:"vertical",spacing:"large","align-items":"center","justify-content":"center",block:!0,style:{containerType:"inline-size",containerName:"connecting-background",width:"100%",height:"100%",overflowY:"auto",padding:"var(--cx-spacing-2x-large)",textAlign:"center"},children:[t,(0,h.jsx)("div",{children:(0,h.jsxs)("cx-space",{direction:"vertical","align-items":"center",children:[(0,h.jsx)("cx-spinner",{style:{"--track-width":"0.2rem",fontSize:"var(--cx-font-size-3x-large)"}}),(0,h.jsx)("cx-typography",{variant:"body3",children:"Waiting to connect"}),(0,h.jsx)("cx-button",{onClick:r,children:"Cancel"})]})}),n]})};const m=(0,n(5464).Ay)("cx-typography")`
1042
+ `;var Qr=n(2246);const Gr={containerSize:{width:0,height:0},currentCount:0,currentFolder:Nt,defaultPageSize:Ut.md,facets:[],hasScrolled:!1,isLoading:!1,isSeeThrough:!0,openBrowser:!1,start:0,pageSize:0,maxPageSize:0,searchText:"",selectedFacets:{},shouldResetFilters:!0,sortDirection:void 0,sortOrder:"",totalCount:0,view:Yt.gf.Medium},Xr=(e,t)=>{const n={start:0,pageSize:e.maxPageSize};switch(t.type){case"SET_CONTAINER_SIZE":return{...e,containerSize:t.payload};case"SET_CURRENT_COUNT":return{...e,currentCount:t.payload};case"SET_CURRENT_FOLDER":return{...e,currentFolder:t.payload.folder,shouldResetFilters:!!t.payload.shouldResetFilters,...n};case"SET_FACETS":return{...e,facets:t.payload};case"SET_FILTERS":return{...e,selectedFacets:t.payload,shouldResetFilters:!1,...n};case"SET_HAS_SCROLLED":return{...e,hasScrolled:t.payload};case"SET_IS_LOADING":return{...e,isLoading:t.payload};case"SET_IS_SEE_THROUGH":return{...e,isSeeThrough:t.payload,...n};case"SET_OPEN_BROWSER":return{...e,openBrowser:t.payload};case"SET_START":return{...e,start:t.payload,pageSize:e.defaultPageSize};case"SET_PAGE_SIZE":{const n={...e,pageSize:t.payload.pageSize,maxPageSize:t.payload.pageSize};return t.payload.returnToFirstPage&&(n.start=0),n}case"SET_SEARCH_TEXT":return{...e,...n,searchText:t.payload};case"SET_SORT_DIRECTION":return{...e,...n,sortDirection:t.payload};case"SET_SORT_ORDER":return{...e,...n,sortOrder:t.payload};case"SET_TOTAL_COUNT":return{...e,totalCount:t.payload};case"SET_VIEW":{let n=Ut.md;switch(t.payload){case Yt.gf.Large:n=15;break;case Yt.gf.Medium:n=20;break;case Yt.gf.Small:n=30}return{...e,view:t.payload,defaultPageSize:n}}case"RESET_SEARCH":return{...e,currentCount:0,currentFolder:Nt,searchText:"",totalCount:0};default:return e}},Zr=()=>{var e;const[t,n]=(0,wt.useReducer)(Xr,Gr),r=(0,Vr.GV)(Hr.jT),o=(0,Vr.GV)(Hr.wL),i=(0,Vr.GV)(qr.OC),{allowedExtensions:a,allowedFolders:s,allowFavorites:l,allowPin:c,allowProxy:u,allowTracking:d,availableDocTypes:h,availableRepresentativeSubtypes:p,ctaText:f,lastLocationMode:m,persistMode:g,showCollections:v,showFavoriteFolder:b,showVersions:y,defaultGridView:x}=(0,wt.useContext)(ur.t),{extraFields:w,onAssetAction:S,onAssetSelected:k,onClose:_}=(0,wt.useContext)(zt.B),{data:C,isFetching:E,isError:A}=(0,Rt.aM)(i?{id:i,useSession:o}:Ft.hT),T=(0,wt.useMemo)((()=>C&&i&&C.recordId===i?C:null),[C,i]),{data:O,isFetching:P,isLoading:z,refetch:D}=(0,Wr.X)({});(0,wt.useEffect)((()=>{r&&D()}),[r,D]);const{data:R,isFetching:j,isError:N}=(0,nr.t$)(T?{assetImages:T?[T]:[],useSession:o}:Ft.hT),{data:I}=(0,nr.jS)({useSession:o}),{data:M}=(0,nr.M$)({useSession:o}),{ATSEnabled:F,autoExtension:L=".auto",collectionPath:B,supportedExtensions:U,supportedRepresentativeSubtypes:V}=M||{},{data:q}=(0,nr.ZP)({useSession:o}),{data:H}=(0,nr.nb)({useSession:o}),{data:W,refetch:K}=(0,Rt.E7)(T&&l?{recordId:T.id}:Ft.hT),[$,Q]=(0,wt.useState)(!1),[G,X]=(0,wt.useState)(!1),[Z,Y]=(0,wt.useState)(dn.EI.Hide),[J,ee]=(0,wt.useState)(0),[te,ne]=(0,wt.useState)(!1),[re,oe]=(0,wt.useState)(!1),ie=(0,wt.useRef)($),ae=(0,wt.useRef)(null),le=(0,wt.useRef)(null),ce=(0,wt.useRef)(null),ue=(0,wt.useRef)(!1),de=(0,wt.useRef)([]),he=(0,wt.useRef)({}),pe=(0,Vr.jL)(),fe=(0,wt.useRef)(t.pageSize),me=(0,wt.useRef)(t.view),ge=(0,wt.useRef)(!1),ve=(0,wt.useRef)(null);ie.current=$,de.current=t.facets,he.current=t.selectedFacets,me.current=t.view,fe.current=t.pageSize;const be=(0,wt.useRef)(null),ye=(0,wt.useMemo)((()=>t.selectedFacets.Types&&t.selectedFacets.Types.length>0?t.selectedFacets.Types:["*"]),[t.selectedFacets]),xe=(0,wt.useMemo)((()=>!(null!==ye&&void 0!==ye&&ye.length)||0===ye.length),[ye]),we=(0,wt.useMemo)((()=>{var e;if(!q)return;const r=null===(e=Object.values(q).find((e=>e.some((e=>e.isDefault)))))||void 0===e?void 0:e[0];return t.sortOrder&&q[t.sortOrder]&&0!==q[t.sortOrder].length?1===q[t.sortOrder].length?q[t.sortOrder][0]:q[t.sortOrder].find((e=>{let{sortDirection:n}=e;return n.toLowerCase()===t.sortDirection})):(r&&(n({type:"SET_SORT_DIRECTION",payload:r.sortDirection.toLowerCase()}),n({type:"SET_SORT_ORDER",payload:r.sortDirectionGroupKey.toLowerCase()})),r)}),[q,t.sortDirection,t.sortOrder]),Se=(0,wt.useMemo)((()=>null===R||void 0===R?void 0:R.proxies.filter((e=>{if(!a||0===a.length)return!0;let t="";if(e.extension)t=e.extension.replace(".","");else{var n;const r=null===(n=e.permanentLink)||void 0===n?void 0:n.split(".").at(-1);t=null!==r&&void 0!==r?r:""}return a.some((e=>!!t&&t.toLowerCase()===e.toLowerCase()))}))),[R,a]),_e=(0,wt.useMemo)((()=>G&&q&&(null===ye||void 0===ye?void 0:ye.length)&&$),[G,q,ye,$]),{data:Ce,isFetching:Ee,isError:Ae,refetch:Te}=(0,Rt.pf)(_e?{folderID:t.currentFolder.id,isSeeThrough:t.isSeeThrough,limitedToDocTypes:h,pageSize:t.pageSize,searchText:t.searchText,selectedFacets:t.selectedFacets,sortOrder:null===we||void 0===we?void 0:we.id,start:t.start,useSession:o}:Ft.hT);(0,wt.useEffect)((()=>{var e;ee(null!==(e=null===Ce||void 0===Ce?void 0:Ce.items.length)&&void 0!==e?e:0)}),[null===Ce||void 0===Ce?void 0:Ce.items.length]),(0,wt.useEffect)((()=>{A&&pe((0,qr.DM)(null))}),[pe,A]),(0,wt.useEffect)((()=>{S&&null!==T&&void 0!==T&&T.recordId&&S("select",T.recordId)}),[S,T]),(0,wt.useEffect)((()=>{let e=null;return Ee?n({type:"SET_IS_LOADING",payload:!0}):e=setTimeout((()=>{n({type:"SET_IS_LOADING",payload:Ee})}),200),()=>{e&&clearTimeout(e)}}),[Ee]),(0,wt.useEffect)((()=>{r&&(pe((0,qr.DM)(null)),n({type:"RESET_SEARCH"}),Promise.all([(0,Mt.bQ)("selectedSortOrder"),(0,Mt.bQ)("selectedSortDirection"),(0,Mt.bQ)("selectedView"),(0,Mt.bQ)("newFacets"),(0,Mt.bQ)("selectedFilter"),(0,Mt.bQ)("selectedIsSeeThrough"),(0,Mt.bQ)("searchText")]).then((e=>{let[t,r,o,i,a,s,l]=e;if(t&&n({type:"SET_SORT_ORDER",payload:t}),"ascending"!==r&&"descending"!==r||n({type:"SET_SORT_DIRECTION",payload:r}),null===o&&(o=x),"string"===typeof o&&(Object.values(Yt.gf).includes(o)?n({type:"SET_VIEW",payload:o}):n({type:"SET_VIEW",payload:Yt.gf.Medium})),m){if(i){const e=JSON.parse(i);(0,Ge.A)(e)?n({type:"SET_FACETS",payload:e}):n({type:"SET_FACETS",payload:[]})}if(a){const e=JSON.parse(a);n(e?{type:"SET_FILTERS",payload:xt(e,Ge.A)}:{type:"SET_FILTERS",payload:{}})}s&&n({type:"SET_IS_SEE_THROUGH",payload:"true"===s}),l&&n({type:"SET_SEARCH_TEXT",payload:l})}ue.current=!0,oe(!0)})))}),[pe,r,m,x]),(0,wt.useEffect)((()=>{let e=null;const t=ae.current;if(!t)return;const n=t.offsetWidth;return t.style.width=n-1+"px",e=setTimeout((()=>{t.style.width="100%"}),50),()=>{e&&clearTimeout(e)}}),[r]),(0,wt.useEffect)((()=>{const e=ce.current;if(!e)return;ae.current&&n({type:"SET_CONTAINER_SIZE",payload:{width:ae.current.offsetWidth,height:ae.current.offsetHeight}});const t=e=>{const t=e.detail.entries;window.requestAnimationFrame((()=>{Array.isArray(t)&&t.length&&t[0].target===ae.current&&n({type:"SET_CONTAINER_SIZE",payload:{width:t[0].contentRect.width,height:t[0].contentRect.height}})}))};return e.addEventListener("cx-resize",t),()=>{e.removeEventListener("cx-resize",t)}}),[re]),(0,wt.useEffect)((()=>{!we&&ue.current&&n({type:"SET_SORT_ORDER",payload:Gr.sortOrder})}),[we,q]),(0,wt.useEffect)((()=>{ue.current&&((0,Mt.yt)("selectedSortOrder",t.sortOrder),t.sortDirection&&(0,Mt.yt)("selectedSortDirection",t.sortDirection),(0,Mt.yt)("selectedView",t.view),(0,Mt.yt)("newFacets",JSON.stringify(t.facets)),(0,Mt.yt)("selectedFilter",JSON.stringify(t.selectedFacets)),(0,Mt.yt)("selectedIsSeeThrough",t.isSeeThrough.toString()),(0,Mt.yt)("searchText",t.searchText))}),[t.currentFolder,t.facets,t.isSeeThrough,t.sortDirection,t.sortOrder,t.searchText,t.view,t.selectedFacets]);const Oe=t.containerSize.width>0&&t.containerSize.width<=Ut.Pm,Pe=e=>{pe((0,qr.DM)(e.recordId))},ze=(0,wt.useCallback)((e=>{pe((0,qr.DM)(null)),n({type:"SET_SEARCH_TEXT",payload:e})}),[pe]),De=(0,wt.useRef)(0),Re=(0,wt.useRef)(0),je=(0,wt.useRef)(t.defaultPageSize);je.current=t.defaultPageSize;const Ne=(0,wt.useCallback)(((e,t)=>{var r;const{width:o,height:i}=e,a=o||0,s=i||0;if(a*s===0||!ue.current)return;const l=De.current,c=Re.current;if(Math.abs(l-s)<10&&Math.abs(c-a)<10&&(null===t||void 0===t||!t.force))return;De.current=s,Re.current=a;const u=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--cx-spacing-medium")||"16",10),d=(null===(r=Mr[me.current])||void 0===r?void 0:r.minWidth)||Mr[Yt.gf.Large].minWidth,h=Math.max(1,Math.floor((a+u)/(d+u))),p=Math.ceil(s/(d+u)),f=Math.ceil(p*h/je.current+1)*je.current;X(!0),f!==fe.current&&0!==f&&n({type:"SET_PAGE_SIZE",payload:{pageSize:f,returnToFirstPage:!(null===t||void 0===t||!t.returnToFirstPage)}})}),[]),Ie=(0,wt.useMemo)((()=>ke(Ne,Ut.h,{leading:!1})),[Ne]);(0,wt.useEffect)((()=>{if(ue.current){const e=le.current;me.current=t.view,e&&Ie({width:e.clientWidth,height:e.clientHeight},{returnToFirstPage:!0,force:!0})}}),[Ie,t.view]);const Me=(0,wt.useCallback)(((e,t)=>{switch(e){case"view":n({type:"SET_VIEW",payload:t});break;case"sortDirection":n({type:"SET_SORT_DIRECTION",payload:t});break;case"sortOrder":n({type:"SET_SORT_ORDER",payload:t.toString()});break;case"isSeeThrough":n({type:"SET_IS_SEE_THROUGH",payload:Boolean(t)});break;case"filter":n({type:"SET_FILTERS",payload:t})}}),[]),Fe=(0,wt.useCallback)((e=>{n({type:"SET_CURRENT_COUNT",payload:e.currentCount}),n({type:"SET_TOTAL_COUNT",payload:e.totalCount}),n({type:"SET_FACETS",payload:e.facets})}),[]),Le=(0,wt.useCallback)((async e=>{ie.current||Q(!0);const t=await pe(It(e));It.fulfilled.match(t)&&(n({type:"SET_CURRENT_FOLDER",payload:{folder:e,shouldResetFilters:ie.current}}),te||n({type:"SET_OPEN_BROWSER",payload:!1}),pe((0,qr.DM)(null)),(0,Mt.yt)("lastLocation",JSON.stringify(e)))}),[pe,te]),Be=(0,wt.useCallback)((()=>{ge.current?ge.current=!1:n({type:"SET_START",payload:null!==J&&void 0!==J?J:0})}),[J]),Ue=(0,wt.useCallback)((e=>{if(!e.target)return;const t=e.target.scrollTop;n(0===t?{type:"SET_HAS_SCROLLED",payload:!1}:{type:"SET_HAS_SCROLLED",payload:!0})}),[]),Ve=(0,wt.useCallback)((async(e,t,n)=>{const r=[...e];Dt.Yq.forEach((e=>{const o=se(e);var i,a,s,l,c,u,d,h,p,f;T&&null!==w&&void 0!==w&&w.includes(e)&&(r[0]={...r[0],extraFields:{...(null===(i=r[0])||void 0===i?void 0:i.extraFields)||{},[e]:T[o]}});n?r[0]={...r[0],assetTransformationSource:t,assetLinkInfo:{extension:n.extension,isCustomFormat:null===(a=n.isCustomFormat)||void 0===a||a,permanentLink:r[0].imageUrl,width:n.width,height:n.height}}:r[0]={...r[0],assetLinkInfo:{cdnName:null!==(s=null===t||void 0===t?void 0:t.cdnName)&&void 0!==s?s:null,extension:null!==(l=null===t||void 0===t?void 0:t.extension)&&void 0!==l?l:null,isCustomFormat:null!==(c=null===t||void 0===t?void 0:t.isCustomFormat)&&void 0!==c&&c,permanentLink:null!==(u=r[0].imageUrl)&&void 0!==u?u:null,proxyLabel:null!==(d=null===t||void 0===t?void 0:t.proxyLabel)&&void 0!==d?d:null,proxyName:null!==(h=null===t||void 0===t?void 0:t.proxyName)&&void 0!==h?h:null,width:null!==(p=null===t||void 0===t?void 0:t.width)&&void 0!==p?p:null,height:null!==(f=null===t||void 0===t?void 0:t.height)&&void 0!==f?f:null}}}));const o=k(r);if("object"===typeof(i=o)&&null!==i&&"function"===typeof i.then)try{await o}catch(a){return console.error("Error in onAssetSelected:",a),!1}var i;return g||null===_||void 0===_||_(),!0}),[w,k,_,g,T]),qe=(0,wt.useMemo)((()=>!!Ce&&t.start+t.pageSize<t.totalCount),[Ce,t.pageSize,t.start,t.totalCount]);(0,wt.useEffect)((()=>{if(Fe){var e,t,n,r,o;const i=new Map(de.current.map((e=>[`${e.facetDetails.facetFieldName}|${e.facetDetails.displayName}`,{...e,values:e.values.reduce(((t,n)=>{var r;return(null===(r=he.current[e.facetDetails.facetFieldName])||void 0===r?void 0:r.find((e=>e===n.value)))&&t.push({...n,count:0}),t}),[])}])));(null!==(e=null===Ce||void 0===Ce||null===(t=Ce.facets)||void 0===t?void 0:t.filter((e=>e.values.length>0)))&&void 0!==e?e:[]).forEach((e=>{var t;const n=i.get(`${e.facetDetails.facetFieldName}|${e.facetDetails.displayName}`),r=[...e.values,...null!==(t=null===n||void 0===n?void 0:n.values.filter((t=>!(null!==e&&void 0!==e&&e.values.find((e=>t.value===e.value&&t.displayValue===e.displayValue))))))&&void 0!==t?t:[]];i.set(`${e.facetDetails.facetFieldName}|${e.facetDetails.displayName}`,{...e,values:r})})),Fe({currentCount:null!==(n=null===Ce||void 0===Ce?void 0:Ce.items.length)&&void 0!==n?n:0,items:null!==(r=null===Ce||void 0===Ce?void 0:Ce.items)&&void 0!==r?r:[],facets:Array.from(i.values()),totalCount:null!==(o=null===Ce||void 0===Ce?void 0:Ce.totalCount)&&void 0!==o?o:0})}}),[Ce,Fe]),(0,wt.useEffect)((()=>{const e=()=>{ge.current=!0,ve.current&&clearTimeout(ve.current),ve.current=setTimeout((()=>{ge.current=!1}),Ut.h)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),(0,wt.useEffect)((()=>{const e=be.current,t=()=>{e&&window.clearTimeout(e)};return t(),E||j?(Y(dn.EI.Hide),be.current=window.setTimeout((()=>{Y(dn.EI.ShowLoader)}),800)):E||j||!(null!==R&&void 0!==R&&R.proxies||N)||be.current&&(t(),Y(dn.EI.ShowDialog)),()=>{t()}}),[R,N,j,E]),(0,wt.useEffect)((()=>{T||Y(dn.EI.ShowDialog)}),[T]);const He=(0,wt.useMemo)((()=>I&&a&&0!==a.length?Object.entries(I).reduce(((e,t)=>{let[n,r]=t;return{...e,[n]:r.filter((e=>!a||0===a.length||a.some((t=>e.value.toLowerCase()===`.${t.toLowerCase()}`))))}}),I):I),[I,a]),We=t.containerSize.width<650;return re?(0,Vt.jsx)("cx-resize-observer",{ref:ce,children:(0,Vt.jsxs)(Kr,{ref:ae,className:"cbsdk__home",children:[(0,Vt.jsx)(rn,{allowedFolders:s,allowPin:c,collectionPath:B,currentFolder:t.currentFolder,favoriteFolderId:null===O||void 0===O?void 0:O.favoriteFolderRecordID,lastLocationMode:m,open:t.openBrowser,showCollections:v,showFavoriteFolder:b,useSession:o,onFolderSelect:Le,onClose:()=>n({type:"SET_OPEN_BROWSER",payload:!1}),isPersistent:te,onChangePersistent:ne,forceOverlay:We,damViewSeeThru:t.isSeeThrough}),(0,Vt.jsxs)($r,{children:[(0,Vt.jsx)(hr,{bordered:t.hasScrolled,currentFolder:t.currentFolder,isFetching:P,isLoading:z,userInfo:O,showMenu:!te,onMenuClick:()=>n({type:"SET_OPEN_BROWSER",payload:!0}),onLogout:()=>{pe((0,Hr.ri)()),pe((0,qr.DM)(null)),n({type:"RESET_SEARCH"})},children:(0,Vt.jsx)(un,{allowSorting:"Mono"!==(null===we||void 0===we?void 0:we.sortDirection)&&!!we,availableFacets:null!==H&&void 0!==H?H:[],currentCount:t.currentCount,facets:t.facets,isMobile:Oe,isSeeThrough:t.isSeeThrough,loading:t.isLoading,searchValue:t.searchText,selectedFacets:t.selectedFacets,sortDirection:t.sortDirection,sortOrder:t.sortOrder,sortOrders:q,totalCount:t.totalCount,view:t.view,onSearchChange:ze,onSettingChange:Me})}),(0,Vt.jsx)("div",{style:{flex:1,minHeight:"320px",padding:"0 var(--cx-spacing-medium)",position:"relative"},children:(0,Vt.jsx)(Pt,{onResize:Ie,children:e=>{let{height:n,width:r}=e;return(0,Vt.jsx)("div",{style:{height:n+"px",width:r+"px"},children:(0,Vt.jsx)(Ur,{ref:le,isError:Ae,isConfigError:xe,hasNextPage:qe,height:n,isLoadingData:t.isLoading||!Ce,isFetched:!!Ce||xe,items:(null===Ce||void 0===Ce?void 0:Ce.items)||[],selectedAsset:null!==T&&void 0!==T?T:null,view:t.view,width:r,onItemSelect:Pe,onLoadMore:Be,onScroll:Ue},t.currentFolder.id+t.searchText+Object.values(t.selectedFacets).join("+")+t.isSeeThrough+t.view)})}})}),Z===dn.EI.ShowLoader&&(0,Vt.jsx)("cx-space",{className:"format-loader",children:(0,Vt.jsx)("cx-spinner",{})}),(0,Vt.jsx)(cr,{allowCustomFormat:!!F&&!(null===T||void 0===T||!T.allowATSLink),allowFavorites:l,allowProxy:u,allowTracking:d,allowedExtensions:a,appendAutoExtension:null!==(e=null===a||void 0===a?void 0:a.includes(L))&&void 0!==e&&e,autoExtension:L,availableExtensions:He,availableProxies:N?[]:j?void 0:Se,ctaText:f,extensions:null!==U&&void 0!==U?U:[],isFavorite:!!W,maxHeight:t.containerSize.height,open:!!T&&Z===dn.EI.ShowDialog,previewUrl:N||j||null===R||void 0===R?void 0:R.previewUrl,selectedAsset:null!==T&&void 0!==T?T:null,showVersions:y,supportedRepresentativeSubtypes:null!==p&&void 0!==p&&p.length?Qe(p,V):V,variant:Oe?"drawer":"dialog",boundary:ae.current,onClose:()=>{pe((0,qr.DM)(null)),S("unselect","")},onFavorite:async()=>{if(!T)return!1;const e=await pe((0,qr.P1)({recordId:T.recordId}));return qr.P1.fulfilled.match(e)&&(S&&S("favorite",T.recordId),await K(),S&&S("afterFavorite",T.recordId),t.currentFolder.id===(null===O||void 0===O?void 0:O.favoriteFolderRecordID)&&(0===t.start?Te():n({type:"SET_CURRENT_FOLDER",payload:{folder:t.currentFolder,shouldResetFilters:!0}}))),!!e||e},onProxyConfirm:async e=>{let{extension:t,value:n,permanentLink:r,parameters:i,useRepresentative:a,selectedProxyMetadata:s}=e;if(!T)return!1;const l=await pe((0,qr.Tp)({extension:t,extraFields:w,parameters:i,permanentLink:r,proxiesPreference:n,selectedAsset:T,useRepresentative:a,useSession:o}));let c=!1;return qr.Tp.fulfilled.match(l)&&(c=await Ve(l.payload,s)),c},onFormatConfirm:async e=>{let{value:t,parameters:n,proxiesPreference:r,extension:i,sourceProxyMetadata:a,transformedAssetMetadata:s}=e;if(!T)return!1;const l=null!==T&&void 0!==T&&T.width?parseInt(T.width,10):0,c=null!==T&&void 0!==T&&T.height?parseInt(T.height,10):0,u=await pe((0,qr.Tp)({extraFields:w,extension:i,maxHeight:c,maxWidth:l,parameters:n,proxiesPreference:r,selectedAsset:T,useSession:o,transformations:t}));let d=!1;return qr.Tp.fulfilled.match(u)&&(d=await Ve(u.payload,a,s)),d},onUnFavorite:async()=>{if(!T)return!1;const e=await pe((0,qr.BZ)({recordId:T.recordId}));return qr.BZ.fulfilled.match(e)&&(S&&S("unfavorite",T.recordId),await K(),S&&S("afterUnfavorite",T.recordId),t.currentFolder.id===(null===O||void 0===O?void 0:O.favoriteFolderRecordID)&&(0===t.start?Te():n({type:"SET_CURRENT_FOLDER",payload:{folder:t.currentFolder,shouldResetFilters:!0}}))),!!e||e}})]})]})}):(0,Vt.jsx)(Qr.A,{})}},1158:(e,t,n)=>{"use strict";n.d(t,{gf:()=>o,zu:()=>r});let r=function(e){return e.Album="Album",e.Audio="Audio",e.Image="Image",e.Multimedia="Multimedia",e.Story="Story",e.Video="Video",e.Widget="Widget",e}({}),o=function(e){return e.Small="small",e.Medium="medium",e.Large="large",e}({})},1185:(e,t,n)=>{e.exports=n(9392)},1218:e=>{var t,n,r,o,i,a,s,l,c,u,d,h,p,f,m,g=!1;function v(){if(!g){g=!0;var e=navigator.userAgent,v=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),b=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(h=/\b(iPhone|iP[ao]d)/.exec(e),p=/\b(iP[ao]d)/.exec(e),u=/Android/i.exec(e),f=/FBAN\/\w+;/i.exec(e),m=/Mobile/i.exec(e),d=!!/Win64/.exec(e),v){(t=v[1]?parseFloat(v[1]):v[5]?parseFloat(v[5]):NaN)&&document&&document.documentMode&&(t=document.documentMode);var y=/(?:Trident\/(\d+.\d+))/.exec(e);a=y?parseFloat(y[1])+4:t,n=v[2]?parseFloat(v[2]):NaN,r=v[3]?parseFloat(v[3]):NaN,(o=v[4]?parseFloat(v[4]):NaN)?(v=/(?:Chrome\/(\d+\.\d+))/.exec(e),i=v&&v[1]?parseFloat(v[1]):NaN):i=NaN}else t=n=r=i=o=NaN;if(b){if(b[1]){var x=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);s=!x||parseFloat(x[1].replace("_","."))}else s=!1;l=!!b[2],c=!!b[3]}else s=l=c=!1}}var b={ie:function(){return v()||t},ieCompatibilityMode:function(){return v()||a>t},ie64:function(){return b.ie()&&d},firefox:function(){return v()||n},opera:function(){return v()||r},webkit:function(){return v()||o},safari:function(){return b.webkit()},chrome:function(){return v()||i},windows:function(){return v()||l},osx:function(){return v()||s},linux:function(){return v()||c},iphone:function(){return v()||h},mobile:function(){return v()||h||p||u||m},nativeApp:function(){return v()||f},android:function(){return v()||u},ipad:function(){return v()||p}};e.exports=b},1375:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var r=n(4306);const o=function(){return!1};var i="object"==typeof exports&&exports&&!exports.nodeType&&exports,a=i&&"object"==typeof module&&module&&!module.nodeType&&module,s=a&&a.exports===i?r.A.Buffer:void 0;const l=(s?s.isBuffer:void 0)||o},1672:(e,t,n)=>{var r;!function(){function o(e,t,n){return e.call.apply(e.bind,arguments)}function i(e,t,n){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function a(e,t,n){return(a=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?o:i).apply(null,arguments)}var s=Date.now||function(){return+new Date};function l(e,t){this.a=e,this.o=t||e,this.c=this.o.document}var c=!!window.FontFace;function u(e,t,n,r){if(t=e.c.createElement(t),n)for(var o in n)n.hasOwnProperty(o)&&("style"==o?t.style.cssText=n[o]:t.setAttribute(o,n[o]));return r&&t.appendChild(e.c.createTextNode(r)),t}function d(e,t,n){(e=e.c.getElementsByTagName(t)[0])||(e=document.documentElement),e.insertBefore(n,e.lastChild)}function h(e){e.parentNode&&e.parentNode.removeChild(e)}function p(e,t,n){t=t||[],n=n||[];for(var r=e.className.split(/\s+/),o=0;o<t.length;o+=1){for(var i=!1,a=0;a<r.length;a+=1)if(t[o]===r[a]){i=!0;break}i||r.push(t[o])}for(t=[],o=0;o<r.length;o+=1){for(i=!1,a=0;a<n.length;a+=1)if(r[o]===n[a]){i=!0;break}i||t.push(r[o])}e.className=t.join(" ").replace(/\s+/g," ").replace(/^\s+|\s+$/,"")}function f(e,t){for(var n=e.className.split(/\s+/),r=0,o=n.length;r<o;r++)if(n[r]==t)return!0;return!1}function m(e,t,n){function r(){s&&o&&i&&(s(a),s=null)}t=u(e,"link",{rel:"stylesheet",href:t,media:"all"});var o=!1,i=!0,a=null,s=n||null;c?(t.onload=function(){o=!0,r()},t.onerror=function(){o=!0,a=Error("Stylesheet failed to load"),r()}):setTimeout((function(){o=!0,r()}),0),d(e,"head",t)}function g(e,t,n,r){var o=e.c.getElementsByTagName("head")[0];if(o){var i=u(e,"script",{src:t}),a=!1;return i.onload=i.onreadystatechange=function(){a||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(a=!0,n&&n(null),i.onload=i.onreadystatechange=null,"HEAD"==i.parentNode.tagName&&o.removeChild(i))},o.appendChild(i),setTimeout((function(){a||(a=!0,n&&n(Error("Script load timeout")))}),r||5e3),i}return null}function v(){this.a=0,this.c=null}function b(e){return e.a++,function(){e.a--,x(e)}}function y(e,t){e.c=t,x(e)}function x(e){0==e.a&&e.c&&(e.c(),e.c=null)}function w(e){this.a=e||"-"}function S(e,t){this.c=e,this.f=4,this.a="n";var n=(t||"n4").match(/^([nio])([1-9])$/i);n&&(this.a=n[1],this.f=parseInt(n[2],10))}function k(e){var t=[];e=e.split(/,\s*/);for(var n=0;n<e.length;n++){var r=e[n].replace(/['"]/g,"");-1!=r.indexOf(" ")||/^\d/.test(r)?t.push("'"+r+"'"):t.push(r)}return t.join(",")}function _(e){return e.a+e.f}function C(e){var t="normal";return"o"===e.a?t="oblique":"i"===e.a&&(t="italic"),t}function E(e){var t=4,n="n",r=null;return e&&((r=e.match(/(normal|oblique|italic)/i))&&r[1]&&(n=r[1].substr(0,1).toLowerCase()),(r=e.match(/([1-9]00|normal|bold)/i))&&r[1]&&(/bold/i.test(r[1])?t=7:/[1-9]00/.test(r[1])&&(t=parseInt(r[1].substr(0,1),10)))),n+t}function A(e,t){this.c=e,this.f=e.o.document.documentElement,this.h=t,this.a=new w("-"),this.j=!1!==t.events,this.g=!1!==t.classes}function T(e){if(e.g){var t=f(e.f,e.a.c("wf","active")),n=[],r=[e.a.c("wf","loading")];t||n.push(e.a.c("wf","inactive")),p(e.f,n,r)}O(e,"inactive")}function O(e,t,n){e.j&&e.h[t]&&(n?e.h[t](n.c,_(n)):e.h[t]())}function P(){this.c={}}function z(e,t){this.c=e,this.f=t,this.a=u(this.c,"span",{"aria-hidden":"true"},this.f)}function D(e){d(e.c,"body",e.a)}function R(e){return"display:block;position:absolute;top:-9999px;left:-9999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:"+k(e.c)+";font-style:"+C(e)+";font-weight:"+e.f+"00;"}function j(e,t,n,r,o,i){this.g=e,this.j=t,this.a=r,this.c=n,this.f=o||3e3,this.h=i||void 0}function N(e,t,n,r,o,i,a){this.v=e,this.B=t,this.c=n,this.a=r,this.s=a||"BESbswy",this.f={},this.w=o||3e3,this.u=i||null,this.m=this.j=this.h=this.g=null,this.g=new z(this.c,this.s),this.h=new z(this.c,this.s),this.j=new z(this.c,this.s),this.m=new z(this.c,this.s),e=R(e=new S(this.a.c+",serif",_(this.a))),this.g.a.style.cssText=e,e=R(e=new S(this.a.c+",sans-serif",_(this.a))),this.h.a.style.cssText=e,e=R(e=new S("serif",_(this.a))),this.j.a.style.cssText=e,e=R(e=new S("sans-serif",_(this.a))),this.m.a.style.cssText=e,D(this.g),D(this.h),D(this.j),D(this.m)}w.prototype.c=function(e){for(var t=[],n=0;n<arguments.length;n++)t.push(arguments[n].replace(/[\W_]+/g,"").toLowerCase());return t.join(this.a)},j.prototype.start=function(){var e=this.c.o.document,t=this,n=s(),r=new Promise((function(r,o){!function i(){s()-n>=t.f?o():e.fonts.load(function(e){return C(e)+" "+e.f+"00 300px "+k(e.c)}(t.a),t.h).then((function(e){1<=e.length?r():setTimeout(i,25)}),(function(){o()}))}()})),o=null,i=new Promise((function(e,n){o=setTimeout(n,t.f)}));Promise.race([i,r]).then((function(){o&&(clearTimeout(o),o=null),t.g(t.a)}),(function(){t.j(t.a)}))};var I={D:"serif",C:"sans-serif"},M=null;function F(){if(null===M){var e=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);M=!!e&&(536>parseInt(e[1],10)||536===parseInt(e[1],10)&&11>=parseInt(e[2],10))}return M}function L(e,t,n){for(var r in I)if(I.hasOwnProperty(r)&&t===e.f[I[r]]&&n===e.f[I[r]])return!0;return!1}function B(e){var t,n=e.g.a.offsetWidth,r=e.h.a.offsetWidth;(t=n===e.f.serif&&r===e.f["sans-serif"])||(t=F()&&L(e,n,r)),t?s()-e.A>=e.w?F()&&L(e,n,r)&&(null===e.u||e.u.hasOwnProperty(e.a.c))?U(e,e.v):U(e,e.B):function(e){setTimeout(a((function(){B(this)}),e),50)}(e):U(e,e.v)}function U(e,t){setTimeout(a((function(){h(this.g.a),h(this.h.a),h(this.j.a),h(this.m.a),t(this.a)}),e),0)}function V(e,t,n){this.c=e,this.a=t,this.f=0,this.m=this.j=!1,this.s=n}N.prototype.start=function(){this.f.serif=this.j.a.offsetWidth,this.f["sans-serif"]=this.m.a.offsetWidth,this.A=s(),B(this)};var q=null;function H(e){0==--e.f&&e.j&&(e.m?((e=e.a).g&&p(e.f,[e.a.c("wf","active")],[e.a.c("wf","loading"),e.a.c("wf","inactive")]),O(e,"active")):T(e.a))}function W(e){this.j=e,this.a=new P,this.h=0,this.f=this.g=!0}function K(e,t,n,r,o){var i=0==--e.h;(e.f||e.g)&&setTimeout((function(){var e=o||null,s=r||{};if(0===n.length&&i)T(t.a);else{t.f+=n.length,i&&(t.j=i);var l,c=[];for(l=0;l<n.length;l++){var u=n[l],d=s[u.c],h=t.a,f=u;if(h.g&&p(h.f,[h.a.c("wf",f.c,_(f).toString(),"loading")]),O(h,"fontloading",f),h=null,null===q)if(window.FontFace){f=/Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent);var m=/OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent)&&/Apple/.exec(window.navigator.vendor);q=f?42<parseInt(f[1],10):!m}else q=!1;h=q?new j(a(t.g,t),a(t.h,t),t.c,u,t.s,d):new N(a(t.g,t),a(t.h,t),t.c,u,t.s,e,d),c.push(h)}for(l=0;l<c.length;l++)c[l].start()}}),0)}function $(e,t){this.c=e,this.a=t}function Q(e,t){this.c=e,this.a=t}function G(e,t){this.c=e||X,this.a=[],this.f=[],this.g=t||""}V.prototype.g=function(e){var t=this.a;t.g&&p(t.f,[t.a.c("wf",e.c,_(e).toString(),"active")],[t.a.c("wf",e.c,_(e).toString(),"loading"),t.a.c("wf",e.c,_(e).toString(),"inactive")]),O(t,"fontactive",e),this.m=!0,H(this)},V.prototype.h=function(e){var t=this.a;if(t.g){var n=f(t.f,t.a.c("wf",e.c,_(e).toString(),"active")),r=[],o=[t.a.c("wf",e.c,_(e).toString(),"loading")];n||r.push(t.a.c("wf",e.c,_(e).toString(),"inactive")),p(t.f,r,o)}O(t,"fontinactive",e),H(this)},W.prototype.load=function(e){this.c=new l(this.j,e.context||this.j),this.g=!1!==e.events,this.f=!1!==e.classes,function(e,t,n){var r=[],o=n.timeout;!function(e){e.g&&p(e.f,[e.a.c("wf","loading")]),O(e,"loading")}(t);r=function(e,t,n){var r,o=[];for(r in t)if(t.hasOwnProperty(r)){var i=e.c[r];i&&o.push(i(t[r],n))}return o}(e.a,n,e.c);var i=new V(e.c,t,o);for(e.h=r.length,t=0,n=r.length;t<n;t++)r[t].load((function(t,n,r){K(e,i,t,n,r)}))}(this,new A(this.c,e),e)},$.prototype.load=function(e){function t(){if(i["__mti_fntLst"+r]){var n,o=i["__mti_fntLst"+r](),a=[];if(o)for(var s=0;s<o.length;s++){var l=o[s].fontfamily;void 0!=o[s].fontStyle&&void 0!=o[s].fontWeight?(n=o[s].fontStyle+o[s].fontWeight,a.push(new S(l,n))):a.push(new S(l))}e(a)}else setTimeout((function(){t()}),50)}var n=this,r=n.a.projectId,o=n.a.version;if(r){var i=n.c.o;g(this.c,(n.a.api||"https://fast.fonts.net/jsapi")+"/"+r+".js"+(o?"?v="+o:""),(function(o){o?e([]):(i["__MonotypeConfiguration__"+r]=function(){return n.a},t())})).id="__MonotypeAPIScript__"+r}else e([])},Q.prototype.load=function(e){var t,n,r=this.a.urls||[],o=this.a.families||[],i=this.a.testStrings||{},a=new v;for(t=0,n=r.length;t<n;t++)m(this.c,r[t],b(a));var s=[];for(t=0,n=o.length;t<n;t++)if((r=o[t].split(":"))[1])for(var l=r[1].split(","),c=0;c<l.length;c+=1)s.push(new S(r[0],l[c]));else s.push(new S(r[0]));y(a,(function(){e(s,i)}))};var X="https://fonts.googleapis.com/css";function Z(e){this.f=e,this.a=[],this.c={}}var Y={latin:"BESbswy","latin-ext":"\xe7\xf6\xfc\u011f\u015f",cyrillic:"\u0439\u044f\u0416",greek:"\u03b1\u03b2\u03a3",khmer:"\u1780\u1781\u1782",Hanuman:"\u1780\u1781\u1782"},J={thin:"1",extralight:"2","extra-light":"2",ultralight:"2","ultra-light":"2",light:"3",regular:"4",book:"4",medium:"5","semi-bold":"6",semibold:"6","demi-bold":"6",demibold:"6",bold:"7","extra-bold":"8",extrabold:"8","ultra-bold":"8",ultrabold:"8",black:"9",heavy:"9",l:"3",r:"4",b:"7"},ee={i:"i",italic:"i",n:"n",normal:"n"},te=/^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$/;function ne(e,t){this.c=e,this.a=t}var re={Arimo:!0,Cousine:!0,Tinos:!0};function oe(e,t){this.c=e,this.a=t}function ie(e,t){this.c=e,this.f=t,this.a=[]}ne.prototype.load=function(e){var t=new v,n=this.c,r=new G(this.a.api,this.a.text),o=this.a.families;!function(e,t){for(var n=t.length,r=0;r<n;r++){var o=t[r].split(":");3==o.length&&e.f.push(o.pop());var i="";2==o.length&&""!=o[1]&&(i=":"),e.a.push(o.join(i))}}(r,o);var i=new Z(o);!function(e){for(var t=e.f.length,n=0;n<t;n++){var r=e.f[n].split(":"),o=r[0].replace(/\+/g," "),i=["n4"];if(2<=r.length){var a;if(a=[],s=r[1])for(var s,l=(s=s.split(",")).length,c=0;c<l;c++){var u;if((u=s[c]).match(/^[\w-]+$/))if(null==(d=te.exec(u.toLowerCase())))u="";else{if(u=null==(u=d[2])||""==u?"n":ee[u],null==(d=d[1])||""==d)d="4";else var d=J[d]||(isNaN(d)?"4":d.substr(0,1));u=[u,d].join("")}else u="";u&&a.push(u)}0<a.length&&(i=a),3==r.length&&(a=[],0<(r=(r=r[2])?r.split(","):a).length&&(r=Y[r[0]])&&(e.c[o]=r))}for(e.c[o]||(r=Y[o])&&(e.c[o]=r),r=0;r<i.length;r+=1)e.a.push(new S(o,i[r]))}}(i),m(n,function(e){if(0==e.a.length)throw Error("No fonts to load!");if(-1!=e.c.indexOf("kit="))return e.c;for(var t=e.a.length,n=[],r=0;r<t;r++)n.push(e.a[r].replace(/ /g,"+"));return t=e.c+"?family="+n.join("%7C"),0<e.f.length&&(t+="&subset="+e.f.join(",")),0<e.g.length&&(t+="&text="+encodeURIComponent(e.g)),t}(r),b(t)),y(t,(function(){e(i.a,i.c,re)}))},oe.prototype.load=function(e){var t=this.a.id,n=this.c.o;t?g(this.c,(this.a.api||"https://use.typekit.net")+"/"+t+".js",(function(t){if(t)e([]);else if(n.Typekit&&n.Typekit.config&&n.Typekit.config.fn){t=n.Typekit.config.fn;for(var r=[],o=0;o<t.length;o+=2)for(var i=t[o],a=t[o+1],s=0;s<a.length;s++)r.push(new S(i,a[s]));try{n.Typekit.load({events:!1,classes:!1,async:!0})}catch(l){}e(r)}}),2e3):e([])},ie.prototype.load=function(e){var t=this.f.id,n=this.c.o,r=this;t?(n.__webfontfontdeckmodule__||(n.__webfontfontdeckmodule__={}),n.__webfontfontdeckmodule__[t]=function(t,n){for(var o=0,i=n.fonts.length;o<i;++o){var a=n.fonts[o];r.a.push(new S(a.name,E("font-weight:"+a.weight+";font-style:"+a.style)))}e(r.a)},g(this.c,(this.f.api||"https://f.fontdeck.com/s/css/js/")+function(e){return e.o.location.hostname||e.a.location.hostname}(this.c)+"/"+t+".js",(function(t){t&&e([])}))):e([])};var ae=new W(window);ae.a.c.custom=function(e,t){return new Q(t,e)},ae.a.c.fontdeck=function(e,t){return new ie(t,e)},ae.a.c.monotype=function(e,t){return new $(t,e)},ae.a.c.typekit=function(e,t){return new oe(t,e)},ae.a.c.google=function(e,t){return new ne(t,e)};var se={load:a(ae.load,ae)};void 0===(r=function(){return se}.call(t,n,t,e))||(e.exports=r)}()},2041:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});const r=function(e){return e}},2222:(e,t,n)=>{"use strict";n.r(t),n.d(t,{createSelector:()=>i,createSelectorCreator:()=>o,createStructuredSelector:()=>a,defaultEqualityCheck:()=>r.Ig,defaultMemoize:()=>r.UI});var r=n(19);function o(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];var i,a=0,s={memoizeOptions:void 0},l=r.pop();if("object"===typeof l&&(s=l,l=r.pop()),"function"!==typeof l)throw new Error("createSelector expects an output function after the inputs, but received: ["+typeof l+"]");var c=s.memoizeOptions,u=void 0===c?n:c,d=Array.isArray(u)?u:[u],h=function(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"===typeof e}))){var n=t.map((function(e){return"function"===typeof e?"function "+(e.name||"unnamed")+"()":typeof e})).join(", ");throw new Error("createSelector expects all input-selectors to be functions, but received the following types: ["+n+"]")}return t}(r),p=e.apply(void 0,[function(){return a++,l.apply(null,arguments)}].concat(d)),f=e((function(){for(var e=[],t=h.length,n=0;n<t;n++)e.push(h[n].apply(null,arguments));return i=p.apply(null,e)}));return Object.assign(f,{resultFunc:l,memoizedResultFunc:p,dependencies:h,lastResult:function(){return i},recomputations:function(){return a},resetRecomputations:function(){return a=0}}),f}}var i=o(r.UI),a=function(e,t){if(void 0===t&&(t=i),"object"!==typeof e)throw new Error("createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);var n=Object.keys(e),r=t(n.map((function(t){return e[t]})),(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.reduce((function(e,t,r){return e[n[r]]=t,e}),{})}));return r}},2246:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(4951),o=n(579);const i=e=>{let{message:t,children:n}=e;return(0,o.jsxs)("cx-space",{direction:"vertical","align-items":"center",children:[(0,o.jsx)("cx-spinner",{style:{"--track-width":"0.2rem",fontSize:"var(--cx-font-size-3x-large)"}}),null===t||void 0===t?void 0:t.split(r.ag).map(((e,t)=>-1!==e.indexOf("http")?(0,o.jsx)("cx-button",{href:e,target:"_blank",children:e},t):(0,o.jsx)("cx-typography",{variant:"body2",children:e},t))),n]})}},2272:(e,t,n)=>{"use strict";function r(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function o(e){return!!e&&!!e[G]}function i(e){var t;return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===X}(e)||Array.isArray(e)||!!e[Q]||!!(null===(t=e.constructor)||void 0===t?void 0:t[Q])||p(e)||f(e))}function a(e){return o(e)||r(23,e),e[G].t}function s(e,t,n){void 0===n&&(n=!1),0===l(e)?(n?Object.keys:Z)(e).forEach((function(r){n&&"symbol"==typeof r||t(r,e[r],e)})):e.forEach((function(n,r){return t(r,n,e)}))}function l(e){var t=e[G];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:p(e)?2:f(e)?3:0}function c(e,t){return 2===l(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function u(e,t){return 2===l(e)?e.get(t):e[t]}function d(e,t,n){var r=l(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function h(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function p(e){return H&&e instanceof Map}function f(e){return W&&e instanceof Set}function m(e){return e.o||e.t}function g(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Y(e);delete t[G];for(var n=Z(t),r=0;r<n.length;r++){var o=n[r],i=t[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function v(e,t){return void 0===t&&(t=!1),y(e)||o(e)||!i(e)||(l(e)>1&&(e.set=e.add=e.clear=e.delete=b),Object.freeze(e),t&&s(e,(function(e,t){return v(t,!0)}),!0)),e}function b(){r(2)}function y(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function x(e){var t=J[e];return t||r(18,e),t}function w(e,t){J[e]||(J[e]=t)}function S(){return V}function k(e,t){t&&(x("Patches"),e.u=[],e.s=[],e.v=t)}function _(e){C(e),e.p.forEach(A),e.p=null}function C(e){e===V&&(V=e.l)}function E(e){return V={p:[],l:V,h:e,m:!0,_:0}}function A(e){var t=e[G];0===t.i||1===t.i?t.j():t.g=!0}function T(e,t){t._=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.O||x("ES5").S(t,e,o),o?(n[G].P&&(_(t),r(4)),i(e)&&(e=O(t,e),t.l||z(t,e)),t.u&&x("Patches").M(n[G].t,e,t.u,t.s)):e=O(t,n,[]),_(t),t.u&&t.v(t.u,t.s),e!==$?e:void 0}function O(e,t,n){if(y(t))return t;var r=t[G];if(!r)return s(t,(function(o,i){return P(e,r,t,o,i,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return z(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var o=4===r.i||5===r.i?r.o=g(r.k):r.o,i=o,a=!1;3===r.i&&(i=new Set(o),o.clear(),a=!0),s(i,(function(t,i){return P(e,r,o,t,i,n,a)})),z(e,o,!1),n&&e.u&&x("Patches").N(r,n,e.u,e.s)}return r.o}function P(e,t,n,r,a,s,l){if(o(a)){var u=O(e,a,s&&t&&3!==t.i&&!c(t.R,r)?s.concat(r):void 0);if(d(n,r,u),!o(u))return;e.m=!1}else l&&n.add(a);if(i(a)&&!y(a)){if(!e.h.D&&e._<1)return;O(e,a),t&&t.A.l||z(e,a)}}function z(e,t,n){void 0===n&&(n=!1),!e.l&&e.h.D&&e.m&&v(t,n)}function D(e,t){var n=e[G];return(n?m(n):e)[t]}function R(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function j(e){e.P||(e.P=!0,e.l&&j(e.l))}function N(e){e.o||(e.o=g(e.t))}function I(e,t,n){var r=p(t)?x("MapSet").F(t,n):f(t)?x("MapSet").T(t,n):e.O?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:S(),P:!1,I:!1,R:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=r,i=ee;n&&(o=[r],i=te);var a=Proxy.revocable(o,i),s=a.revoke,l=a.proxy;return r.k=l,r.j=s,l}(t,n):x("ES5").J(t,n);return(n?n.A:S()).p.push(r),r}function M(e){return o(e)||r(22,e),function e(t){if(!i(t))return t;var n,r=t[G],o=l(t);if(r){if(!r.P&&(r.i<4||!x("ES5").K(r)))return r.t;r.I=!0,n=F(t,o),r.I=!1}else n=F(t,o);return s(n,(function(t,o){r&&u(r.t,t)===o||d(n,t,e(o))})),3===o?new Set(n):n}(e)}function F(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return g(e)}function L(){function e(e,t){var n=i[e];return n?n.enumerable=t:i[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[G];return ee.get(t,e)},set:function(t){var n=this[G];ee.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][G];if(!o.P)switch(o.i){case 5:r(o)&&j(o);break;case 4:n(o)&&j(o)}}}function n(e){for(var t=e.t,n=e.k,r=Z(n),o=r.length-1;o>=0;o--){var i=r[o];if(i!==G){var a=t[i];if(void 0===a&&!c(t,i))return!0;var s=n[i],l=s&&s[G];if(l?l.t!==a:!h(s,a))return!0}}var u=!!t[G];return r.length!==Z(t).length+(u?0:1)}function r(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var r=0;r<t.length;r++)if(!t.hasOwnProperty(r))return!0;return!1}var i={};w("ES5",{J:function(t,n){var r=Array.isArray(t),o=function(t,n){if(t){for(var r=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(r,""+o,e(o,!0));return r}var i=Y(n);delete i[G];for(var a=Z(i),s=0;s<a.length;s++){var l=a[s];i[l]=e(l,t||!!i[l].enumerable)}return Object.create(Object.getPrototypeOf(n),i)}(r,t),i={i:r?5:4,A:n?n.A:S(),P:!1,I:!1,R:{},l:n,t:t,k:o,o:null,g:!1,C:!1};return Object.defineProperty(o,G,{value:i,writable:!0}),o},S:function(e,n,i){i?o(n)&&n[G].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[G];if(n){var o=n.t,i=n.k,a=n.R,l=n.i;if(4===l)s(i,(function(t){t!==G&&(void 0!==o[t]||c(o,t)?a[t]||e(i[t]):(a[t]=!0,j(n)))})),s(o,(function(e){void 0!==i[e]||c(i,e)||(a[e]=!1,j(n))}));else if(5===l){if(r(n)&&(j(n),a.length=!0),i.length<o.length)for(var u=i.length;u<o.length;u++)a[u]=!1;else for(var d=o.length;d<i.length;d++)a[d]=!0;for(var h=Math.min(i.length,o.length),p=0;p<h;p++)i.hasOwnProperty(p)||(a[p]=!0),void 0===a[p]&&e(i[p])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):r(e)}})}function B(){function e(t){if(!i(t))return t;if(Array.isArray(t))return t.map(e);if(p(t))return new Map(Array.from(t.entries()).map((function(t){return[t[0],e(t[1])]})));if(f(t))return new Set(Array.from(t).map(e));var n=Object.create(Object.getPrototypeOf(t));for(var r in t)n[r]=e(t[r]);return c(t,Q)&&(n[Q]=t[Q]),n}function t(t){return o(t)?e(t):t}var n="add";w("Patches",{$:function(t,o){return o.forEach((function(o){for(var i=o.path,a=o.op,s=t,c=0;c<i.length-1;c++){var d=l(s),h=i[c];"string"!=typeof h&&"number"!=typeof h&&(h=""+h),0!==d&&1!==d||"__proto__"!==h&&"constructor"!==h||r(24),"function"==typeof s&&"prototype"===h&&r(24),"object"!=typeof(s=u(s,h))&&r(15,i.join("/"))}var p=l(s),f=e(o.value),m=i[i.length-1];switch(a){case"replace":switch(p){case 2:return s.set(m,f);case 3:r(16);default:return s[m]=f}case n:switch(p){case 1:return"-"===m?s.push(f):s.splice(m,0,f);case 2:return s.set(m,f);case 3:return s.add(f);default:return s[m]=f}case"remove":switch(p){case 1:return s.splice(m,1);case 2:return s.delete(m);case 3:return s.delete(o.value);default:return delete s[m]}default:r(17,a)}})),t},N:function(e,r,o,i){switch(e.i){case 0:case 4:case 2:return function(e,r,o,i){var a=e.t,l=e.o;s(e.R,(function(e,s){var d=u(a,e),h=u(l,e),p=s?c(a,e)?"replace":n:"remove";if(d!==h||"replace"!==p){var f=r.concat(e);o.push("remove"===p?{op:p,path:f}:{op:p,path:f,value:h}),i.push(p===n?{op:"remove",path:f}:"remove"===p?{op:n,path:f,value:t(d)}:{op:"replace",path:f,value:t(d)})}}))}(e,r,o,i);case 5:case 1:return function(e,r,o,i){var a=e.t,s=e.R,l=e.o;if(l.length<a.length){var c=[l,a];a=c[0],l=c[1];var u=[i,o];o=u[0],i=u[1]}for(var d=0;d<a.length;d++)if(s[d]&&l[d]!==a[d]){var h=r.concat([d]);o.push({op:"replace",path:h,value:t(l[d])}),i.push({op:"replace",path:h,value:t(a[d])})}for(var p=a.length;p<l.length;p++){var f=r.concat([p]);o.push({op:n,path:f,value:t(l[p])})}a.length<l.length&&i.push({op:"replace",path:r.concat(["length"]),value:a.length})}(e,r,o,i);case 3:return function(e,t,r,o){var i=e.t,a=e.o,s=0;i.forEach((function(e){if(!a.has(e)){var i=t.concat([s]);r.push({op:"remove",path:i,value:e}),o.unshift({op:n,path:i,value:e})}s++})),s=0,a.forEach((function(e){if(!i.has(e)){var a=t.concat([s]);r.push({op:n,path:a,value:e}),o.unshift({op:"remove",path:a,value:e})}s++}))}(e,r,o,i)}},M:function(e,t,n,r){n.push({op:"replace",path:[],value:t===$?void 0:t}),r.push({op:"replace",path:[],value:e})}})}n.d(t,{$i:()=>ae,Ay:()=>se,CN:()=>v,Qx:()=>o,YT:()=>B,a6:()=>i,c2:()=>a,rF:()=>L,ss:()=>M,vI:()=>ie});var U,V,q="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),H="undefined"!=typeof Map,W="undefined"!=typeof Set,K="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,$=q?Symbol.for("immer-nothing"):((U={})["immer-nothing"]=!0,U),Q=q?Symbol.for("immer-draftable"):"__$immer_draftable",G=q?Symbol.for("immer-state"):"__$immer_state",X=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Z="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Y=Object.getOwnPropertyDescriptors||function(e){var t={};return Z(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},J={},ee={get:function(e,t){if(t===G)return e;var n=m(e);if(!c(n,t))return function(e,t,n){var r,o=R(t,n);return o?"value"in o?o.value:null===(r=o.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!i(r)?r:r===D(e.t,t)?(N(e),e.o[t]=I(e.A.h,r,e)):r},has:function(e,t){return t in m(e)},ownKeys:function(e){return Reflect.ownKeys(m(e))},set:function(e,t,n){var r=R(m(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var o=D(m(e),t),i=null==o?void 0:o[G];if(i&&i.t===n)return e.o[t]=n,e.R[t]=!1,!0;if(h(n,o)&&(void 0!==n||c(e.t,t)))return!0;N(e),j(e)}return e.o[t]===n&&(void 0!==n||t in e.o)||Number.isNaN(n)&&Number.isNaN(e.o[t])||(e.o[t]=n,e.R[t]=!0),!0},deleteProperty:function(e,t){return void 0!==D(e.t,t)||t in e.t?(e.R[t]=!1,N(e),j(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=m(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){r(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){r(12)}},te={};s(ee,(function(e,t){te[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),te.deleteProperty=function(e,t){return te.set.call(this,e,t,void 0)},te.set=function(e,t,n){return ee.set.call(this,e[0],t,n,e[0])};var ne=function(){function e(e){var t=this;this.O=K,this.D=!0,this.produce=function(e,n,o){if("function"==typeof e&&"function"!=typeof n){var a=n;n=e;var s=t;return function(e){var t=this;void 0===e&&(e=a);for(var r=arguments.length,o=Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return s.produce(e,(function(e){var r;return(r=n).call.apply(r,[t,e].concat(o))}))}}var l;if("function"!=typeof n&&r(6),void 0!==o&&"function"!=typeof o&&r(7),i(e)){var c=E(t),u=I(t,e,void 0),d=!0;try{l=n(u),d=!1}finally{d?_(c):C(c)}return"undefined"!=typeof Promise&&l instanceof Promise?l.then((function(e){return k(c,o),T(e,c)}),(function(e){throw _(c),e})):(k(c,o),T(l,c))}if(!e||"object"!=typeof e){if(void 0===(l=n(e))&&(l=e),l===$&&(l=void 0),t.D&&v(l,!0),o){var h=[],p=[];x("Patches").M(e,l,h,p),o(h,p)}return l}r(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var r=arguments.length,o=Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var r,o,i=t.produce(e,n,(function(e,t){r=e,o=t}));return"undefined"!=typeof Promise&&i instanceof Promise?i.then((function(e){return[e,r,o]})):[i,r,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){i(e)||r(8),o(e)&&(e=M(e));var t=E(this),n=I(this,e,void 0);return n[G].C=!0,C(t),n},t.finishDraft=function(e,t){var n=(e&&e[G]).A;return k(n,t),T(void 0,n)},t.setAutoFreeze=function(e){this.D=e},t.setUseProxies=function(e){e&&!K&&r(20),this.O=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));var i=x("Patches").$;return o(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),re=new ne,oe=re.produce,ie=re.produceWithPatches.bind(re),ae=(re.setAutoFreeze.bind(re),re.setUseProxies.bind(re),re.applyPatches.bind(re));re.createDraft.bind(re),re.finishDraft.bind(re);const se=oe},2330:(e,t,n)=>{"use strict";var r=n(5043);var o="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t},i=r.useState,a=r.useEffect,s=r.useLayoutEffect,l=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(r){return!0}}var u="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),o=r[0].inst,u=r[1];return s((function(){o.value=n,o.getSnapshot=t,c(o)&&u({inst:o})}),[e,n,t]),a((function(){return c(o)&&u({inst:o}),e((function(){c(o)&&u({inst:o})}))}),[e]),l(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},2404:(e,t,n)=>{"use strict";n.d(t,{J8:()=>c,VL:()=>l,gc:()=>a,gw:()=>o,q2:()=>s,z_:()=>i});var r=n(8024);const o="Authentication cancelled",i={controller:new AbortController},a=()=>{i.controller.abort(o),i.controller=new AbortController},s=async e=>{const t=await(0,r.uK)("webapi/extensibility/integrations/gab/authorization/requestauthorize_4bu_v1",{method:"POST",body:JSON.stringify({Nonce:e}),headers:{"Content-Type":"application/json"}});return{...await t.json(),nonce:e}},l=async e=>{i.controller=new AbortController;let t,n=0;for(;n<10;){const o=await(0,r.uK)("webapi/extensibility/integrations/gab/authorization/getaccesskey_4bv_v1",{signal:i.controller.signal,method:"POST",body:JSON.stringify({RequestID:e}),headers:{"Content-Type":"application/json"}});if(t=await o.json(),t.code&&"RepeatRequest"!==t.code)return t;n++}throw new Error("Unable to get Access Key: Max retries exceeded.")},c=async e=>(await(0,r.uK)("webapi/extensibility/integrations/gab/authorization/getaccesstoken_4bt_v1",{method:"POST",body:JSON.stringify({AccessKey:e}),headers:{"Content-Type":"application/json"}})).json()},2476:(e,t,n)=>{"use strict";n.d(t,{A:()=>h});const r=function(){this.__data__=[],this.size=0};var o=n(5009);const i=function(e,t){for(var n=e.length;n--;)if((0,o.A)(e[n][0],t))return n;return-1};var a=Array.prototype.splice;const s=function(e){var t=this.__data__,n=i(t,e);return!(n<0)&&(n==t.length-1?t.pop():a.call(t,n,1),--this.size,!0)};const l=function(e){var t=this.__data__,n=i(t,e);return n<0?void 0:t[n][1]};const c=function(e){return i(this.__data__,e)>-1};const u=function(e,t){var n=this.__data__,r=i(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function d(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}d.prototype.clear=r,d.prototype.delete=s,d.prototype.get=l,d.prototype.has=c,d.prototype.set=u;const h=d},2706:(e,t,n)=>{"use strict";n(7358)},2743:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>y});var r=n(5043),o=n(5650),i=n(416),a=n(6047),s=n(449),l=n(5137),c=n(6),u=n(8024),d=n(4413);var h=n(579);const p=()=>{const{onClose:e,onConnectClicked:t}=(0,r.useContext)(c.B),n=(0,l.wA)(),i=(0,l.d4)(a.KL),s=(0,l.d4)(a.uT),{isContentBrowserPopedup:p,pluginInfo:f,useSession:m}=(0,r.useContext)(o.t),[g,v]=(0,r.useState)(!1),[b,y]=(0,r.useState)(i),[x,w]=(0,r.useState)(null),[S,k]=function(e,t){const[n,o]=(0,r.useState)(e),i=(0,r.useRef)(null),a=()=>{i.current&&(clearTimeout(i.current),i.current=null)};(0,r.useEffect)((()=>()=>a()),[]);const s=(0,r.useCallback)((function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&a(),null===i.current?(o(e),i.current=setTimeout((()=>{i.current=null}),t)):(a(),i.current=setTimeout((()=>{i.current=null,o(e)}),t))}),[t]);return[n,s]}(!1,1e3),[_,C]=(0,r.useState)(!1),[E,A]=(0,r.useState)(m),T=(0,r.useRef)(null),O=(0,r.useRef)(null),P=(0,r.useRef)(null);(0,r.useEffect)((()=>{Promise.all([customElements.whenDefined("cx-input")]).then((()=>{v(!0)}))}),[]),(0,r.useEffect)((()=>{const e=T.current;if(!e||!g)return;const t=e=>{y(e.target.value),w(null)};return e.addEventListener("cx-input",t),()=>{e.removeEventListener("cx-input",t)}}),[g]),(0,r.useEffect)((()=>{const e=O.current;if(!e||!g)return;const t=e=>{A(e.target.value)};return e.addEventListener("cx-input",t),()=>{e.removeEventListener("cx-input",t)}}),[n,g,_]);const z=(0,r.useCallback)((()=>{k(!0,!0);const e=-1===b.indexOf("://")?`https://${b}`:b;(0,u.ps)(e).then((()=>{n((0,a.Wk)({siteUrl:e,callbackFn:t})),E&&n((0,a.I4)(E))})).catch((()=>{w("The site is currently not available. Please verify your Site URL and check your Internet connection.")})).finally((()=>k(!1)))}),[n,E,k,b,t]),D=(0,r.useCallback)((()=>{k(!1,!0),w(null)}),[k]);(0,r.useEffect)((()=>{if(_)return;let e=0,t=null;const n=()=>{if(e++,5===e)return C(!0),void(t&&clearTimeout(t));t&&clearTimeout(t),t=setTimeout((()=>{e=0}),2e3)},r=P.current;return r&&r.addEventListener("click",n),()=>{r&&r.removeEventListener("click",n),t&&clearTimeout(t)}}),[_]);let R="Connect";return S?R="Connecting...":x&&(R="Retry"),(0,h.jsxs)("div",{style:{background:`url(${d.gR})`,backgroundPositionX:"center",backgroundPositionY:"top",backgroundRepeat:"no-repeat",backgroundSize:"contain",display:"flex",inset:0,padding:"var(--cx-spacing-x-small)",position:"absolute"},children:[p&&(0,h.jsx)("cx-icon-button",{name:"close",label:"Close",onClick:e,style:{position:"fixed",top:"var(--cx-spacing-x-small)",right:"var(--cx-spacing-x-small)",zIndex:1e3}}),(0,h.jsx)("cx-space",{"align-items":"center","justify-content":"center",style:{height:"100%",textAlign:"center",width:"100%"},children:(0,h.jsxs)("cx-space",{direction:"vertical",spacing:"medium","align-items":"center",onKeyDown:e=>{"Enter"===e.key&&z()},children:[f.pluginName&&(0,h.jsxs)("cx-typography",{variant:"h2",children:["Welcome to the ",f.pluginName]}),f.publicApplicationName&&(0,h.jsxs)("cx-typography",{variant:"h4",children:["for ",f.publicApplicationName]}),s&&(0,h.jsxs)("cx-alert",{open:!0,variant:"danger",children:[(0,h.jsx)("cx-icon",{slot:"icon",name:"error"}),s]}),(0,h.jsx)("cx-input",{ref:T,label:"Site URL",placeholder:"Enter your site URL",value:b,"help-text":null!==x&&void 0!==x?x:void 0,style:{width:"100%"}}),_&&(0,h.jsx)("cx-input",{ref:O,label:"Session ID",placeholder:"Enter your session ID",value:m,style:{width:"100%"}}),(0,h.jsx)("cx-space",{"justify-content":"flex-end",style:{width:"100%"},children:(0,h.jsxs)("cx-space",{spacing:"small",wrap:"nowrap",children:[S&&(0,h.jsx)("cx-button",{variant:"default",onClick:D,children:"Cancel"}),(0,h.jsx)("cx-button",{disabled:""===b||S,variant:"primary","data-cy":"submit-button",style:{width:"100%"},onClick:z,children:R})]})})]})}),(0,h.jsx)("button",{ref:P,tabIndex:-1,style:{position:"absolute",left:0,bottom:0,opacity:0,width:"32px",height:"32px"}})]})},f=e=>{let{children:t,footer:n,onCancel:r}=e;return(0,h.jsxs)("cx-space",{direction:"vertical",spacing:"large","align-items":"center","justify-content":"center",block:!0,style:{containerType:"inline-size",containerName:"connecting-background",width:"100%",height:"100%",overflowY:"auto",padding:"var(--cx-spacing-2x-large)",textAlign:"center"},children:[t,(0,h.jsx)("div",{children:(0,h.jsxs)("cx-space",{direction:"vertical","align-items":"center",children:[(0,h.jsx)("cx-spinner",{style:{"--track-width":"0.2rem",fontSize:"var(--cx-font-size-3x-large)"}}),(0,h.jsx)("cx-typography",{variant:"body3",children:"Waiting to connect"}),(0,h.jsx)("cx-button",{onClick:r,children:"Cancel"})]})}),n]})};const m=(0,n(5464).Ay)("cx-typography")`
1043
1043
  @container connecting-background (min-width: 0px) {
1044
1044
  &::part(base) {
1045
1045
  font-size: clamp(1rem, 2cqw, 3rem);