@orangelogic/orange-dam-content-browser-sdk 2.1.60 → 2.1.62
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.
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
left: 50%;
|
|
217
217
|
transform: translate(-50%, -50%);
|
|
218
218
|
}
|
|
219
|
-
`,Tn=(0,wt.forwardRef)(((e,t)=>{var n;let{disabled:r,loadable:o,image:i,resizer:a,cropper:s,rotation:l,selectedProxy:c,onCropComplete:u,onLoadingChange:d}=e;const[h,p]=(0,wt.useState)(!0),[f,m]=(0,wt.useState)({x:0,y:0}),[g,v]=(0,wt.useState)(1),[b,y]=(0,wt.useState)(null!==(n=null===i||void 0===i?void 0:i.url)&&void 0!==n?n:""),x=(0,wt.useRef)(null),[w,S]=(0,wt.useState)({width:0,height:0});(0,wt.useEffect)((()=>{const{url:e,originalUrl:t,extension:n}=i,{width:r,height:s}=a,l=ke((async()=>{if(o){var a,l;d(!0);const{width:o,height:c}=En(i.width,i.height,r,s),{url:u}=await((e,t,n,r,o)=>{const i=new Image;return i.src=e,i.crossOrigin="anonymous",new Promise((a=>{i.onload=()=>{const s=document.createElement("canvas");if(t>r||n>o){const e=r/t,i=o/n,a=Math.min(e,i);a>0?(s.width=t*a,s.height=n*a):(s.width=t,s.height=n)}else s.width=t,s.height=n;const l=s.getContext("2d");l?(l.drawImage(i,0,0,s.width,s.height),a({url:s.toDataURL("image/jpeg"),width:s.width,height:s.height})):a({url:e,width:t,height:n})},i.onerror=()=>{a({url:e,width:t,height:n})}}))})(e,o,c,null!==(a=null===(l=x.current)||void 0===l?void 0:l.clientWidth)&&void 0!==a?a:window.innerWidth,Ut.uS);y("gif"===n?t:u),d(!1)}else y(e)}),300,{leading:!0});l()}),[i,o,d,a,c]),(0,wt.useEffect)((()=>{const e=x.current;if(!e)return;const t=new ResizeObserver((e=>{for(const t of e){const{width:e,height:n}=t.contentRect;S({width:e,height:n})}}));return t.observe(e),()=>{t.disconnect()}}),[]);const k=(0,wt.useCallback)((async()=>b),[b]),_=(0,wt.useCallback)((async()=>{const{width:e,height:t,x:n,y:r,unit:a}=s,l={x:n,y:r,width:e,height:t};if(l.x=n/100*i.width,l.y=r/100*i.height,o){if(d(!0),a===sn.Nf.AspectRatio){const{width:n,height:r}=En(i.width,i.height,e,t);l.width=n/g,l.height=r/g}const n=await((e,t)=>{const n=new Image;return n.src=e.url,n.crossOrigin="anonymous",new Promise((r=>{n.onload=()=>{const o=document.createElement("canvas");o.width=t.width,o.height=t.height;const i=o.getContext("2d");i?(i.drawImage(n,-t.x,-t.y,e.width,e.height),r(o.toDataURL("image/jpeg"))):r(e.url)},n.onerror=()=>{r(e.url)}}))})({url:i.url,width:i.width,height:i.height},l);return d(!1),n}return Promise.resolve(i.url)}),[s,i.width,i.height,i.url,o,d,g]),C=(0,wt.useCallback)((async()=>{if(o){d(!0);const e=await((e,t)=>{const n=new Image;return n.src=e.url,n.crossOrigin="anonymous",new Promise((r=>{n.onload=()=>{const{width:o,height:i}=cn(e.width,e.height,t),a=document.createElement("canvas");a.width=o,a.height=i;const s=a.getContext("2d");s?(s.fillStyle="white",s.fillRect(0,0,o,i),s.translate(o/2,i/2),s.rotate(t*Math.PI/180),s.drawImage(n,-e.width/2,-e.height/2,e.width,e.height),s.rotate(-t*Math.PI/180),s.translate(-o/2,-i/2),r(a.toDataURL("image/jpeg"))):r(e.url)},n.onerror=()=>{r(e.url)}}))})({url:i.url,width:i.width,height:i.height},l);return d(!1),e}return Promise.resolve(i.url)}),[i.height,i.url,i.width,o,d,l]);(0,wt.useImperativeHandle)(t,(()=>({applyResize:k,applyCrop:_,applyRotation:C,setZoom:v})));const E=(0,wt.useCallback)((()=>{m({x:0,y:0}),v(1)}),[]),A=(0,wt.useCallback)((e=>{r||m(e)}),[r]),T=(0,wt.useCallback)((()=>{p(!1)}),[]);(0,wt.useEffect)((()=>{E()}),[r,E]);const O=(0,wt.useMemo)((()=>{if(!x.current||h)return"contain";const e=a.width/a.height,t=w.height||Ut.uS;return e>w.width/t?"horizontal-cover":"vertical-cover"}),[h,a,w]);return(0,Vt.jsxs)(An,{ref:x,style:{height:`${Ut.uS}px`},children:[o&&(0,Vt.jsx)(Cn,{image:b,crop:f,zoom:g,aspect:s.width/s.height,rotation:l,objectFit:O,onCropChange:A,onCropComplete:u,onMediaLoaded:T,onZoomChange:v,zoomWithScroll:s.unit===sn.Nf.AspectRatio,style:{containerStyle:{cursor:r?"default":"move",pointerEvents:r?"none":"auto"},cropAreaStyle:{display:r?"none":"block"},mediaStyle:{opacity:h?0:1}}}),h&&(0,Vt.jsxs)("div",{className:"loading",children:[(0,Vt.jsx)("cx-skeleton",{className:"loading__skeleton"}),(0,Vt.jsx)("cx-spinner",{className:"loading__spinner"})]})]})}));var On=n(7032);const Pn=function(e,t,n){var r=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===r?(0,On.A)(e,t,void 0,n):!!r},zn=Ft.Ay.div`
|
|
219
|
+
`,Tn=(0,wt.forwardRef)(((e,t)=>{var n;let{disabled:r,loadable:o,image:i,resizer:a,cropper:s,rotation:l,selectedProxy:c,onCropComplete:u,onLoadingChange:d}=e;const[h,p]=(0,wt.useState)(!0),[f,m]=(0,wt.useState)({x:0,y:0}),[g,v]=(0,wt.useState)(1),[b,y]=(0,wt.useState)(null!==(n=null===i||void 0===i?void 0:i.url)&&void 0!==n?n:""),x=(0,wt.useRef)(null),[w,S]=(0,wt.useState)({width:0,height:0});(0,wt.useEffect)((()=>{const{url:e,originalUrl:t,extension:n}=i,{width:r,height:s}=a,l=ke((async()=>{if(o){var a,l;d(!0);const{width:o,height:c}=En(i.width,i.height,r,s),{url:u}=await((e,t,n,r,o)=>{const i=new Image;return i.src=e,i.crossOrigin="anonymous",new Promise((a=>{i.onload=()=>{const s=document.createElement("canvas");if(t>r||n>o){const e=r/t,i=o/n,a=Math.min(e,i);a>0?(s.width=t*a,s.height=n*a):(s.width=t,s.height=n)}else s.width=t,s.height=n;const l=s.getContext("2d");l?(l.drawImage(i,0,0,s.width,s.height),a({url:s.toDataURL("image/jpeg"),width:s.width,height:s.height})):a({url:e,width:t,height:n})},i.onerror=()=>{a({url:e,width:t,height:n})}}))})(e,o,c,null!==(a=null===(l=x.current)||void 0===l?void 0:l.clientWidth)&&void 0!==a?a:window.innerWidth,Ut.uS);y(".gif"===n?t:u),d(!1)}else y(e)}),300,{leading:!0});l()}),[i,o,d,a,c]),(0,wt.useEffect)((()=>{const e=x.current;if(!e)return;const t=new ResizeObserver((e=>{for(const t of e){const{width:e,height:n}=t.contentRect;S({width:e,height:n})}}));return t.observe(e),()=>{t.disconnect()}}),[]);const k=(0,wt.useCallback)((async()=>b),[b]),_=(0,wt.useCallback)((async()=>{const{width:e,height:t,x:n,y:r,unit:a}=s,l={x:n,y:r,width:e,height:t};if(l.x=n/100*i.width,l.y=r/100*i.height,o){if(d(!0),a===sn.Nf.AspectRatio){const{width:n,height:r}=En(i.width,i.height,e,t);l.width=n/g,l.height=r/g}const n=await((e,t)=>{const n=new Image;return n.src=e.url,n.crossOrigin="anonymous",new Promise((r=>{n.onload=()=>{const o=document.createElement("canvas");o.width=t.width,o.height=t.height;const i=o.getContext("2d");i?(i.drawImage(n,-t.x,-t.y,e.width,e.height),r(o.toDataURL("image/jpeg"))):r(e.url)},n.onerror=()=>{r(e.url)}}))})({url:i.url,width:i.width,height:i.height},l);return d(!1),n}return Promise.resolve(i.url)}),[s,i.width,i.height,i.url,o,d,g]),C=(0,wt.useCallback)((async()=>{if(o){d(!0);const e=await((e,t)=>{const n=new Image;return n.src=e.url,n.crossOrigin="anonymous",new Promise((r=>{n.onload=()=>{const{width:o,height:i}=cn(e.width,e.height,t),a=document.createElement("canvas");a.width=o,a.height=i;const s=a.getContext("2d");s?(s.fillStyle="white",s.fillRect(0,0,o,i),s.translate(o/2,i/2),s.rotate(t*Math.PI/180),s.drawImage(n,-e.width/2,-e.height/2,e.width,e.height),s.rotate(-t*Math.PI/180),s.translate(-o/2,-i/2),r(a.toDataURL("image/jpeg"))):r(e.url)},n.onerror=()=>{r(e.url)}}))})({url:i.url,width:i.width,height:i.height},l);return d(!1),e}return Promise.resolve(i.url)}),[i.height,i.url,i.width,o,d,l]);(0,wt.useImperativeHandle)(t,(()=>({applyResize:k,applyCrop:_,applyRotation:C,setZoom:v})));const E=(0,wt.useCallback)((()=>{m({x:0,y:0}),v(1)}),[]),A=(0,wt.useCallback)((e=>{r||m(e)}),[r]),T=(0,wt.useCallback)((()=>{p(!1)}),[]);(0,wt.useEffect)((()=>{E()}),[r,E]);const O=(0,wt.useMemo)((()=>{if(!x.current||h)return"contain";const e=a.width/a.height,t=w.height||Ut.uS;return e>w.width/t?"horizontal-cover":"vertical-cover"}),[h,a,w]);return(0,Vt.jsxs)(An,{ref:x,style:{height:`${Ut.uS}px`},children:[o&&(0,Vt.jsx)(Cn,{image:b,crop:f,zoom:g,aspect:s.width/s.height,rotation:l,objectFit:O,onCropChange:A,onCropComplete:u,onMediaLoaded:T,onZoomChange:v,zoomWithScroll:s.unit===sn.Nf.AspectRatio,style:{containerStyle:{cursor:r?"default":"move",pointerEvents:r?"none":"auto"},cropAreaStyle:{display:r?"none":"block"},mediaStyle:{opacity:h?0:1}}}),h&&(0,Vt.jsxs)("div",{className:"loading",children:[(0,Vt.jsx)("cx-skeleton",{className:"loading__skeleton"}),(0,Vt.jsx)("cx-spinner",{className:"loading__spinner"})]})]})}));var On=n(7032);const Pn=function(e,t,n){var r=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===r?(0,On.A)(e,t,void 0,n):!!r},zn=Ft.Ay.div`
|
|
220
220
|
.details__summary__icon {
|
|
221
221
|
width: var(--cx-font-size-3x-large);
|
|
222
222
|
height: var(--cx-font-size-3x-large);
|
|
@@ -267,6 +267,10 @@
|
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
+
cx-details {
|
|
271
|
+
--details-background-color: var(--cx-color-neutral-0);
|
|
272
|
+
}
|
|
273
|
+
|
|
270
274
|
cx-details:not(:last-child)::part(base) {
|
|
271
275
|
border-bottom-width: 0;
|
|
272
276
|
}
|
|
@@ -621,7 +625,7 @@
|
|
|
621
625
|
.version__item__editor {
|
|
622
626
|
color: var(--cx-color-primary);
|
|
623
627
|
}
|
|
624
|
-
`;var Yn=n(3943);const Jn=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})})},er=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})})},tr=e=>{var t;let{assetId:n}=e;const{data:r,isFetching:o,isLoading:i}=(0,Yn.cP)(n?{assetId:n}:Lt.hT);return o||i?(0,Vt.jsx)(Zn,{children:(0,Vt.jsx)("cx-spinner",{})}):(0,Vt.jsx)(Zn,{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)("cx-line-clamp",{lines:1,children:e.versionNumberDisplay})}),e.scrubUrl?(0,Vt.jsx)(er,{src:e.scrubUrl}):(0,Vt.jsx)(Jn,{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)("cx-line-clamp",{lines:1,children:(0,Vt.jsx)("cx-typography",{variant:"body3",className:"version__item__name",children:e.versionFileName})}),(0,Vt.jsx)("cx-line-clamp",{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)))})})},nr={previewLoadable:!1,defaultSize:{width:0,height:0},selectedProxy:"",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:sn.Nf.Pixel},lastResizeSize:{[sn.Nf.AspectRatio]:{width:0,height:0,unit:sn.Nf.AspectRatio},[sn.Nf.Pixel]:{width:0,height:0,unit:sn.Nf.Pixel}},cropSize:{width:0,height:0,percentageWidth:0,percentageHeight:0,x:0,y:0,unit:sn.Nf.Pixel},lastCropSize:{[sn.Nf.AspectRatio]:{width:0,height:0,percentageWidth:0,percentageHeight:0,x:0,y:0,unit:sn.Nf.AspectRatio},[sn.Nf.Pixel]:{width:0,height:0,percentageWidth:0,percentageHeight:0,x:0,y:0,unit:sn.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},rr=(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"};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}};case"SET_DEFAULT_SIZE":return{...e,defaultSize:{...e.defaultSize,...t.payload}};case"RESET_DATA":return nr;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,selectedProxy:"",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}},or=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)(rr,nr),[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)((()=>{var e,t;if(!g)return;const n=ln(E.defaultSize.width,E.defaultSize.height);A({type:"SET_RESIZE_SIZE",payload:{...nr.resizeSize,width:E.defaultSize.width,height:E.defaultSize.height}}),A({type:"SET_CROP_SIZE",payload:{...nr.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:{...nr.lastCropSize,[sn.Nf.Pixel]:{width:E.defaultSize.width,height:E.defaultSize.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:n.width,height:n.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.AspectRatio}}}),A({type:"SET_LAST_RESIZE_SIZE",payload:{[sn.Nf.Pixel]:{width:E.defaultSize.width,height:E.defaultSize.height,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:n.width,height:n.height,unit:sn.Nf.AspectRatio}}});const r=a?s:g.docType?null===l||void 0===l||null===(e=l[g.docType])||void 0===e||null===(t=e[0])||void 0===t?void 0:t.value:g.extension;var o;R&&R.length>0?(A({type:"SET_SELECTED_PROXY",payload:null===(o=R[0])||void 0===o?void 0:o.id}),A({type:"SET_SELECTED_FORMAT",payload:{...nr.selectedFormat,url:g.imageUrl,originalUrl:g.originalUrl,extension:r,width:R[0].formatWidth||E.defaultSize.width,height:R[0].formatHeight||E.defaultSize.height}})):A({type:"SET_SELECTED_FORMAT",payload:{...nr.selectedFormat,url:g.imageUrl,originalUrl:g.originalUrl,extension:r,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===sn.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:sn.YQ.Resize,value:{width:r,height:s}}}),A({type:"SET_CROP_SIZE",payload:{width:r,height:s}});const c=ln(r,s);A({type:"SET_LAST_RESIZE_SIZE",payload:{[sn.Nf.Pixel]:{width:r,height:s,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:n===sn.Nf.AspectRatio?e:c.width,height:n===sn.Nf.AspectRatio?t:c.height,unit:sn.Nf.AspectRatio}}}),A({type:"SET_LAST_CROP_SIZE",payload:{[sn.Nf.Pixel]:{width:r,height:s,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:n===sn.Nf.AspectRatio?e:c.width,height:n===sn.Nf.AspectRatio?t:c.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.AspectRatio}}})}}),[g,E.defaultSize.height,E.defaultSize.width,E.resizeSize.unit,E.selectedFormat.height,E.selectedFormat.width]),L=(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===sn.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===sn.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:sn.Nf.Pixel}}),A({type:"SET_TRANSFORMATIONS",payload:{key:sn.YQ.Crop,value:{width:Number(o.toFixed(0)),height:Number(i.toFixed(0)),x:a,y:c}}});const u=ln(o,i);A({type:"SET_LAST_CROP_SIZE",payload:{[sn.Nf.Pixel]:{width:Math.round(o),height:Math.round(i),percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:n===sn.Nf.AspectRatio?e:u.width,height:n===sn.Nf.AspectRatio?t:u.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.AspectRatio}}}),A({type:"SET_LAST_RESIZE_SIZE",payload:{[sn.Nf.Pixel]:{width:o,height:i,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:n===sn.Nf.AspectRatio?e:u.width,height:n===sn.Nf.AspectRatio?t:u.height,unit:sn.Nf.AspectRatio}}})}}),[g,E.cropSize,E.selectedFormat.height,E.selectedFormat.width]),F=(0,wt.useCallback)((async(e,t)=>{if(A({type:"SET_ROTATION",payload:t?0:e}),t){var n;const{width:t,height:r}=cn(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:sn.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:sn.Nf.Pixel}});const i=ln(t,r);A({type:"SET_LAST_CROP_SIZE",payload:{[sn.Nf.Pixel]:{width:t,height:r,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:i.width,height:i.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.AspectRatio}}}),A({type:"SET_LAST_RESIZE_SIZE",payload:{[sn.Nf.Pixel]:{width:t,height:r,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:i.width,height:i.height,unit:sn.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:sn.Nf.Pixel}}),A({type:"SET_RESIZE_SIZE",payload:{width:E.selectedFormat.width,height:E.selectedFormat.height,unit:sn.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:{width:t,height:n}}),A({type:"SET_RESIZE_SIZE",payload:{width:t,height:n,unit:sn.Nf.Pixel}}),A({type:"SET_CROP_SIZE",payload:{width:t,height:n,percentageWidth:100,percentageHeight:100,x:0,y:0,unit:sn.Nf.Pixel}});const r=ln(t,n);A({type:"SET_LAST_CROP_SIZE",payload:{[sn.Nf.Pixel]:{width:Math.round(t),height:Math.round(n),percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:r.width,height:r.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.AspectRatio}}}),A({type:"SET_LAST_RESIZE_SIZE",payload:{[sn.Nf.Pixel]:{width:t,height:n,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:r.width,height:r.height,unit:sn.Nf.AspectRatio}}})}),[g]),H=(0,wt.useCallback)((e=>{A({type:"SET_QUALITY",payload:e}),A({type:"SET_TRANSFORMATIONS",payload:{key:sn.YQ.Quality,value:{quality:e}}})}),[]),W=(0,wt.useCallback)((e=>{A({type:"SET_KEEP_METADATA",payload:e}),A({type:"SET_TRANSFORMATIONS",payload:{key:sn.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,an.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)("cx-line-clamp",{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)("cx-line-clamp",{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)!==Qt.zu.Video?(0,Vt.jsx)(Tn,{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)($n,{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)(tr,{assetId:null===g||void 0===g?void 0:g.id});if(!r)return e;var n;E.showCustomRendition&&R?t=(0,Vt.jsx)(Vn,{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:L,onExtensionChange:B,onFormatChange:q,onKeepMetadataChange:W,onQualityChange:H,onResizeChange:M,onRotateChange:F,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)(Xn,{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)(Xn,{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)(Xn,{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)(Gn,{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,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}})},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,L,B,S,q,_,W,I,k,H,M,F,C,U]);return"drawer"===y?(0,Vt.jsx)(Hn,{ref:z,className:"dialog",label:"Drawer",placement:"bottom",contained:!0,open:f,children:K()}):(0,Vt.jsx)(qn,{ref:P,className:"dialog",open:f,"use-overlay-scrollbar":!0,style:{"--max-height":`${p}px`,"--max-width":E.showVersionHistory?"600px":"520px"},children:K()})};var ir=n(5650);const ar=(0,Ft.Ay)("cx-space")`
|
|
628
|
+
`;var Yn=n(3943);const Jn=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})})},er=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})})},tr=e=>{var t;let{assetId:n}=e;const{data:r,isFetching:o,isLoading:i}=(0,Yn.cP)(n?{assetId:n}:Lt.hT);return o||i?(0,Vt.jsx)(Zn,{children:(0,Vt.jsx)("cx-spinner",{})}):(0,Vt.jsx)(Zn,{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)("cx-line-clamp",{lines:1,children:e.versionNumberDisplay})}),e.scrubUrl?(0,Vt.jsx)(er,{src:e.scrubUrl}):(0,Vt.jsx)(Jn,{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)("cx-line-clamp",{lines:1,children:(0,Vt.jsx)("cx-typography",{variant:"body3",className:"version__item__name",children:e.versionFileName})}),(0,Vt.jsx)("cx-line-clamp",{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)))})})},nr={previewLoadable:!1,defaultSize:{width:0,height:0},selectedProxy:"",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:sn.Nf.Pixel},lastResizeSize:{[sn.Nf.AspectRatio]:{width:0,height:0,unit:sn.Nf.AspectRatio},[sn.Nf.Pixel]:{width:0,height:0,unit:sn.Nf.Pixel}},cropSize:{width:0,height:0,percentageWidth:0,percentageHeight:0,x:0,y:0,unit:sn.Nf.Pixel},lastCropSize:{[sn.Nf.AspectRatio]:{width:0,height:0,percentageWidth:0,percentageHeight:0,x:0,y:0,unit:sn.Nf.AspectRatio},[sn.Nf.Pixel]:{width:0,height:0,percentageWidth:0,percentageHeight:0,x:0,y:0,unit:sn.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},rr=(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"};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}};case"SET_DEFAULT_SIZE":return{...e,defaultSize:{...e.defaultSize,...t.payload}};case"RESET_DATA":return nr;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,selectedProxy:"",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}},or=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)(rr,nr),[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=ln(E.defaultSize.width,E.defaultSize.height);A({type:"SET_RESIZE_SIZE",payload:{...nr.resizeSize,width:E.defaultSize.width,height:E.defaultSize.height}}),A({type:"SET_CROP_SIZE",payload:{...nr.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:{...nr.lastCropSize,[sn.Nf.Pixel]:{width:E.defaultSize.width,height:E.defaultSize.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:e.width,height:e.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.AspectRatio}}}),A({type:"SET_LAST_RESIZE_SIZE",payload:{[sn.Nf.Pixel]:{width:E.defaultSize.width,height:E.defaultSize.height,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:e.width,height:e.height,unit:sn.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:{...nr.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:{...nr.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===sn.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:sn.YQ.Resize,value:{width:r,height:s}}}),A({type:"SET_CROP_SIZE",payload:{width:r,height:s}});const c=ln(r,s);A({type:"SET_LAST_RESIZE_SIZE",payload:{[sn.Nf.Pixel]:{width:r,height:s,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:n===sn.Nf.AspectRatio?e:c.width,height:n===sn.Nf.AspectRatio?t:c.height,unit:sn.Nf.AspectRatio}}}),A({type:"SET_LAST_CROP_SIZE",payload:{[sn.Nf.Pixel]:{width:r,height:s,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:n===sn.Nf.AspectRatio?e:c.width,height:n===sn.Nf.AspectRatio?t:c.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.AspectRatio}}})}}),[g,E.defaultSize.height,E.defaultSize.width,E.resizeSize.unit,E.selectedFormat.height,E.selectedFormat.width]),L=(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===sn.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===sn.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:sn.Nf.Pixel}}),A({type:"SET_TRANSFORMATIONS",payload:{key:sn.YQ.Crop,value:{width:Number(o.toFixed(0)),height:Number(i.toFixed(0)),x:a,y:c}}});const u=ln(o,i);A({type:"SET_LAST_CROP_SIZE",payload:{[sn.Nf.Pixel]:{width:Math.round(o),height:Math.round(i),percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:n===sn.Nf.AspectRatio?e:u.width,height:n===sn.Nf.AspectRatio?t:u.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.AspectRatio}}}),A({type:"SET_LAST_RESIZE_SIZE",payload:{[sn.Nf.Pixel]:{width:o,height:i,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:n===sn.Nf.AspectRatio?e:u.width,height:n===sn.Nf.AspectRatio?t:u.height,unit:sn.Nf.AspectRatio}}})}}),[g,E.cropSize,E.selectedFormat.height,E.selectedFormat.width]),F=(0,wt.useCallback)((async(e,t)=>{if(A({type:"SET_ROTATION",payload:t?0:e}),t){var n;const{width:t,height:r}=cn(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:sn.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:sn.Nf.Pixel}});const i=ln(t,r);A({type:"SET_LAST_CROP_SIZE",payload:{[sn.Nf.Pixel]:{width:t,height:r,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:i.width,height:i.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.AspectRatio}}}),A({type:"SET_LAST_RESIZE_SIZE",payload:{[sn.Nf.Pixel]:{width:t,height:r,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:i.width,height:i.height,unit:sn.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:sn.Nf.Pixel}}),A({type:"SET_RESIZE_SIZE",payload:{width:E.selectedFormat.width,height:E.selectedFormat.height,unit:sn.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:{width:t,height:n}}),A({type:"SET_RESIZE_SIZE",payload:{width:t,height:n,unit:sn.Nf.Pixel}}),A({type:"SET_CROP_SIZE",payload:{width:t,height:n,percentageWidth:100,percentageHeight:100,x:0,y:0,unit:sn.Nf.Pixel}});const r=ln(t,n);A({type:"SET_LAST_CROP_SIZE",payload:{[sn.Nf.Pixel]:{width:Math.round(t),height:Math.round(n),percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:r.width,height:r.height,percentageHeight:100,percentageWidth:100,x:0,y:0,unit:sn.Nf.AspectRatio}}}),A({type:"SET_LAST_RESIZE_SIZE",payload:{[sn.Nf.Pixel]:{width:t,height:n,unit:sn.Nf.Pixel},[sn.Nf.AspectRatio]:{width:r.width,height:r.height,unit:sn.Nf.AspectRatio}}})}),[g]),H=(0,wt.useCallback)((e=>{A({type:"SET_QUALITY",payload:e}),A({type:"SET_TRANSFORMATIONS",payload:{key:sn.YQ.Quality,value:{quality:e}}})}),[]),W=(0,wt.useCallback)((e=>{A({type:"SET_KEEP_METADATA",payload:e}),A({type:"SET_TRANSFORMATIONS",payload:{key:sn.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,an.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)("cx-line-clamp",{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)("cx-line-clamp",{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)!==Qt.zu.Video?(0,Vt.jsx)(Tn,{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)($n,{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)(tr,{assetId:null===g||void 0===g?void 0:g.id});if(!r)return e;var n;E.showCustomRendition&&R?t=(0,Vt.jsx)(Vn,{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:L,onExtensionChange:B,onFormatChange:q,onKeepMetadataChange:W,onQualityChange:H,onResizeChange:M,onRotateChange:F,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)(Xn,{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)(Xn,{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)(Xn,{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)(Gn,{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,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}})},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,L,B,S,q,_,W,I,k,H,M,F,C,U]);return"drawer"===y?(0,Vt.jsx)(Hn,{ref:z,className:"dialog",label:"Drawer",placement:"bottom",contained:!0,open:f,children:K()}):(0,Vt.jsx)(qn,{ref:P,className:"dialog",open:f,"use-overlay-scrollbar":!0,style:{"--max-height":`${p}px`,"--max-width":E.showVersionHistory?"600px":"520px"},children:K()})};var ir=n(5650);const ar=(0,Ft.Ay)("cx-space")`
|
|
625
629
|
border-bottom: ${e=>{let{bordered:t}=e;return t?"1px solid var(--cx-color-neutral-300)":"none"}};
|
|
626
630
|
padding: var(--cx-spacing-medium);
|
|
627
631
|
|
|
@@ -813,7 +817,7 @@
|
|
|
813
817
|
transition: none;
|
|
814
818
|
}
|
|
815
819
|
}
|
|
816
|
-
`,Or=e=>{let{alt:t,url:n,loaded:r,originalUrl:o,onError:i,onLoaded:a}=e;return(0,Vt.jsxs)("div",{className:o&&r?"asset-preview__representative-container":void 0,children:[(0,Vt.jsx)("img",{className:"asset-preview__representative",src:n,alt:t,onLoad:a,onError:i}),o&&(0,Vt.jsx)("img",{className:"asset-preview__representative asset-preview__representative--animated",src:o,alt:t,onLoad:a,onError:i})]})},Pr=e=>{let{url:t,thumbnailOnly:n,thumbnailUrl:r,onError:o,loaded:i,onLoaded:a}=e;const[s,l]=(0,wt.useState)("horizontal"),c=(0,wt.useRef)(null),u=(0,wt.useRef)(null),d=(0,wt.useRef)(null),h=(0,wt.useRef)(null);(0,wt.useEffect)((()=>{var e;if(n)return;const t=null===(e=c.current)||void 0===e?void 0:e.parentElement,r=d.current,o=h.current;if(!t||!r||!o)return;const i=e=>{r.duration&&e.currentTarget===t&&(o.value=e.offsetX/t.offsetWidth*100,r.currentTime=e.offsetX/t.offsetWidth*r.duration)},a=e=>{e.stopImmediatePropagation(),i(e)},s=e=>{e.stopImmediatePropagation(),o.value=0,r.currentTime=0,r.pause()},l=e=>{e.stopImmediatePropagation(),i(e)};return t.addEventListener("mouseenter",a),t.addEventListener("mouseleave",s),t.addEventListener("mousemove",l),()=>{t.removeEventListener("mouseenter",a),t.removeEventListener("mouseleave",s),t.removeEventListener("mousemove",l)}}),[n,r]);const p=(0,wt.useCallback)((()=>{if(a(),d.current){const{videoWidth:e,videoHeight:t}=d.current;l(e>t?"horizontal":"vertical")}if(u.current){const{naturalWidth:e,naturalHeight:t}=u.current;l(e>t?"horizontal":"vertical")}}),[a]);return(0,Vt.jsxs)(Vt.Fragment,{children:[(0,Vt.jsxs)("div",{className:`asset-preview__representative asset-preview__representative--${s}`,children:[t&&!n?(0,Vt.jsx)("video",{ref:d,src:t,poster:r,onLoadedMetadata:p,onError:()=>{o()},children:(0,Vt.jsx)("track",{default:!0,kind:"captions",srcLang:"en"})}):(0,Vt.jsx)("img",{ref:u,src:r,alt:"Asset preview",onLoad:p,onError:o}),(0,Vt.jsx)("div",{className:"asset-preview__video-icon",hidden:!i,children:(0,Vt.jsx)("cx-icon",{name:"play_arrow",variant:"filled"})})]}),!n&&(0,Vt.jsx)("cx-progress-bar",{ref:h,className:"asset-preview__progress-bar"}),(0,Vt.jsx)("div",{ref:c,className:"asset-preview__representative-overlay"})]})},zr=e=>{let{asset:t,imageLoaded:n,slot:r,thumbnailOnly:o,onLoaded:i}=e;const[a,s]=(0,wt.useState)(!1),l=(0,wt.useCallback)((()=>{const e="string"===typeof t.imageUrl&&t.imageUrl.length>0;var r;return a||!e?(0,Vt.jsx)(Kn,{type:t.docType,children:(null===(r=t.extension)||void 0===r?void 0:r.toUpperCase())||t.docType}):t.docType===Qt.zu.Video?(0,Vt.jsx)(Pr,{url:t.scrubUrl,thumbnailOnly:o,thumbnailUrl:t.imageUrl,loaded:n,onLoaded:i,onError:()=>s(!0)}):(0,Vt.jsx)(Or,{alt:t.name,url:t.imageUrl,originalUrl:"gif"===t.extension&&t.originalUrl?t.originalUrl:void 0,loaded:n,onLoaded:i,onError:()=>s(!0)})}),[t,a,i,o,n]);return(0,Vt.jsxs)(Tr,{slot:r,className:"asset-preview",children:[!n&&(0,Vt.jsx)("cx-skeleton",{slot:"image",className:"asset-preview__image-skeleton"}),l()]})},Dr={[Qt.gf.Small]:{minWidth:130,maxWidth:178},[Qt.gf.Medium]:{minWidth:190,maxWidth:292},[Qt.gf.Large]:{minWidth:302,maxWidth:456}},Rr=(0,Ft.Ay)("cx-card")`
|
|
820
|
+
`,Or=e=>{let{alt:t,url:n,loaded:r,originalUrl:o,onError:i,onLoaded:a}=e;return(0,Vt.jsxs)("div",{className:o&&r?"asset-preview__representative-container":void 0,children:[(0,Vt.jsx)("img",{className:"asset-preview__representative",src:n,alt:t,onLoad:a,onError:i}),o&&(0,Vt.jsx)("img",{className:"asset-preview__representative asset-preview__representative--animated",src:o,alt:t,onLoad:a,onError:i})]})},Pr=e=>{let{url:t,thumbnailOnly:n,thumbnailUrl:r,onError:o,loaded:i,onLoaded:a}=e;const[s,l]=(0,wt.useState)("horizontal"),c=(0,wt.useRef)(null),u=(0,wt.useRef)(null),d=(0,wt.useRef)(null),h=(0,wt.useRef)(null);(0,wt.useEffect)((()=>{var e;if(n)return;const t=null===(e=c.current)||void 0===e?void 0:e.parentElement,r=d.current,o=h.current;if(!t||!r||!o)return;const i=e=>{r.duration&&e.currentTarget===t&&(o.value=e.offsetX/t.offsetWidth*100,r.currentTime=e.offsetX/t.offsetWidth*r.duration)},a=e=>{e.stopImmediatePropagation(),i(e)},s=e=>{e.stopImmediatePropagation(),o.value=0,r.currentTime=0,r.pause()},l=e=>{e.stopImmediatePropagation(),i(e)};return t.addEventListener("mouseenter",a),t.addEventListener("mouseleave",s),t.addEventListener("mousemove",l),()=>{t.removeEventListener("mouseenter",a),t.removeEventListener("mouseleave",s),t.removeEventListener("mousemove",l)}}),[n,r]);const p=(0,wt.useCallback)((()=>{if(a(),d.current){const{videoWidth:e,videoHeight:t}=d.current;l(e>t?"horizontal":"vertical")}if(u.current){const{naturalWidth:e,naturalHeight:t}=u.current;l(e>t?"horizontal":"vertical")}}),[a]);return(0,Vt.jsxs)(Vt.Fragment,{children:[(0,Vt.jsxs)("div",{className:`asset-preview__representative asset-preview__representative--${s}`,children:[t&&!n?(0,Vt.jsx)("video",{ref:d,src:t,poster:r,onLoadedMetadata:p,onError:()=>{o()},children:(0,Vt.jsx)("track",{default:!0,kind:"captions",srcLang:"en"})}):(0,Vt.jsx)("img",{ref:u,src:r,alt:"Asset preview",onLoad:p,onError:o}),(0,Vt.jsx)("div",{className:"asset-preview__video-icon",hidden:!i,children:(0,Vt.jsx)("cx-icon",{name:"play_arrow",variant:"filled"})})]}),!n&&(0,Vt.jsx)("cx-progress-bar",{ref:h,className:"asset-preview__progress-bar"}),(0,Vt.jsx)("div",{ref:c,className:"asset-preview__representative-overlay"})]})},zr=e=>{let{asset:t,imageLoaded:n,slot:r,thumbnailOnly:o,onLoaded:i}=e;const[a,s]=(0,wt.useState)(!1),l=(0,wt.useCallback)((()=>{const e="string"===typeof t.imageUrl&&t.imageUrl.length>0;var r;return a||!e?(0,Vt.jsx)(Kn,{type:t.docType,children:(null===(r=t.extension)||void 0===r?void 0:r.toUpperCase())||t.docType}):t.docType===Qt.zu.Video?(0,Vt.jsx)(Pr,{url:t.scrubUrl,thumbnailOnly:o,thumbnailUrl:t.imageUrl,loaded:n,onLoaded:i,onError:()=>s(!0)}):(0,Vt.jsx)(Or,{alt:t.name,url:t.imageUrl,originalUrl:".gif"===t.extension&&t.originalUrl?t.originalUrl:void 0,loaded:n,onLoaded:i,onError:()=>s(!0)})}),[t,a,i,o,n]);return(0,Vt.jsxs)(Tr,{slot:r,className:"asset-preview",children:[!n&&(0,Vt.jsx)("cx-skeleton",{slot:"image",className:"asset-preview__image-skeleton"}),l()]})},Dr={[Qt.gf.Small]:{minWidth:130,maxWidth:178},[Qt.gf.Medium]:{minWidth:190,maxWidth:292},[Qt.gf.Large]:{minWidth:302,maxWidth:456}},Rr=(0,Ft.Ay)("cx-card")`
|
|
817
821
|
&.asset-card {
|
|
818
822
|
--border-color: transparent;
|
|
819
823
|
--border-radius: 0;
|
|
@@ -928,7 +932,7 @@
|
|
|
928
932
|
visibility: hidden;
|
|
929
933
|
}
|
|
930
934
|
}
|
|
931
|
-
`,jr=e=>{let{id:t,asset:n,displayInfo:r,isSelected:o,view:i,onItemSelect:a,onMount:s,onLoaded:l}=e;const[c,u]=(0,wt.useState)(!1),[d,h]=(0,wt.useState)(!1),p=(0,wt.useRef)(null),f=c||n.docType!==Qt.zu.Image&&n.docType!==Qt.zu.Video,m=(0,wt.useCallback)((()=>{u(!0),l&&l(t)}),[t,l]);(0,wt.useEffect)((()=>{s&&s(t)}),[s,t]);const g=(0,wt.useMemo)((()=>(null===n||void 0===n?void 0:n.tags.length)>0?null===n||void 0===n?void 0:n.tags.split(",").map((e=>e.trim())):[]),[null===n||void 0===n?void 0:n.tags]),v=(0,wt.useCallback)((e=>r.tags&&g&&g[e]||""),[r.tags,g]),b=(0,wt.useMemo)((()=>{const e={"asset-card":!0,selected:o,"asset-card--small":i===Qt.gf.Small,"asset-card--medium":i===Qt.gf.Medium,"asset-card--large":i===Qt.gf.Large};return Object.keys(e).filter((t=>e[t])).join(" ")}),[o,i]);return(0,wt.useEffect)((()=>{const e=p.current;if(!e)return;const t=new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting?h(!0):h(!1)}))}));return t.observe(e),()=>{t.unobserve(e)}}),[]),(0,Vt.jsxs)(Rr,{ref:p,className:b,onClick:()=>{a(n)},children:[(0,Vt.jsx)(zr,{slot:"image",asset:n,imageLoaded:f,thumbnailOnly:i===Qt.gf.Small||!d,onLoaded:m}),o&&(0,Vt.jsx)("div",{slot:"image",className:"asset-card__checkbox",children:(0,Vt.jsx)("cx-checkbox",{checked:!0})}),(0,Vt.jsx)("cx-space",{spacing:"small","align-items":"center",wrap:"nowrap",className:"asset-card__info",children:r.title&&n.name?(0,Vt.jsx)("cx-line-clamp",{lines:1,className:"asset-card__name",children:n.name}):(0,Vt.jsx)("cx-typography",{variant:"small",className:"asset-card__placeholder",children:(0,Vt.jsx)("span",{children:"empty"})})}),r.tags&&g.length>0&&(0,Vt.jsx)(Er,{className:"asset-card__tags",separator:" ",tooltipSeparator:", ",getChildString:v,children:null===g||void 0===g?void 0:g.filter((e=>!(0,Ar.o)(e))).slice(0,5).map((e=>(0,Vt.jsx)("cx-tag",{size:"small",variant:"neutral",pill:!0,children:(0,Vt.jsx)("cx-line-clamp",{lines:1,children:e})},e.toLowerCase())))}),(r.dimension||r.fileSize)&&(0,Vt.jsxs)("cx-space",{spacing:"small","align-items":"center",wrap:"nowrap",className:"asset-card__info",children:[r.dimension&&Boolean(Number(n.width))&&Boolean(Number(n.height))&&(0,Vt.jsx)("cx-line-clamp",{lines:1,className:"asset-card__name",children:(0,Vt.jsxs)("cx-typography",{variant:"small",children:[(0,Vt.jsx)("span",{children:n.width})," x ",(0,Vt.jsx)("span",{children:n.height})]})}),r.fileSize&&(0,Vt.jsx)("cx-line-clamp",{lines:1,className:"asset-card__name asset-card__name--right",children:(0,Vt.jsx)("cx-typography",{variant:"small",children:n.size})}),!(r.dimension&&Boolean(Number(n.width))&&Boolean(Number(n.height))||r.fileSize)&&(0,Vt.jsx)("cx-typography",{variant:"small",className:"asset-card__placeholder",children:(0,Vt.jsx)("span",{children:"empty"})})]}),r.tags&&0===g.length&&(0,Vt.jsx)(Er,{className:"asset-card__tags",separator:" ",tooltipSeparator:", ",getChildString:v,children:(0,Vt.jsx)("span",{})})]})},Nr=Ft.Ay.div`
|
|
935
|
+
`,jr=e=>{let{id:t,asset:n,displayInfo:r,isSelected:o,view:i,onItemSelect:a,onMount:s,onLoaded:l}=e;const[c,u]=(0,wt.useState)(!1),[d,h]=(0,wt.useState)(!1),p=(0,wt.useRef)(null),f=c||n.docType!==Qt.zu.Image&&n.docType!==Qt.zu.Video,m=(0,wt.useCallback)((()=>{u(!0),l&&l(t)}),[t,l]);(0,wt.useEffect)((()=>{s&&s(t)}),[s,t]);const g=(0,wt.useMemo)((()=>(null===n||void 0===n?void 0:n.tags.length)>0?null===n||void 0===n?void 0:n.tags.split(",").map((e=>e.trim())):[]),[null===n||void 0===n?void 0:n.tags]),v=(0,wt.useCallback)((e=>r.tags&&g&&g[e]||""),[r.tags,g]),b=(0,wt.useMemo)((()=>{const e={"asset-card":!0,selected:o,"asset-card--small":i===Qt.gf.Small,"asset-card--medium":i===Qt.gf.Medium,"asset-card--large":i===Qt.gf.Large};return Object.keys(e).filter((t=>e[t])).join(" ")}),[o,i]);return(0,wt.useEffect)((()=>{const e=p.current;if(!e)return;const t=new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting?h(!0):h(!1)}))}));return t.observe(e),()=>{t.unobserve(e)}}),[]),(0,Vt.jsxs)(Rr,{ref:p,className:b,onClick:()=>{a(n)},children:[(0,Vt.jsx)(zr,{slot:"image",asset:n,imageLoaded:f,thumbnailOnly:i===Qt.gf.Small||!d,onLoaded:m}),o&&(0,Vt.jsx)("div",{slot:"image",className:"asset-card__checkbox",children:(0,Vt.jsx)("cx-checkbox",{checked:!0})}),(0,Vt.jsx)("cx-space",{spacing:"small","align-items":"center",wrap:"nowrap",className:"asset-card__info",children:r.title&&n.name?(0,Vt.jsx)("cx-line-clamp",{lines:1,className:"asset-card__name",children:(0,Vt.jsx)("cx-typography",{variant:"body3",children:n.name})}):(0,Vt.jsx)("cx-typography",{variant:"small",className:"asset-card__placeholder",children:(0,Vt.jsx)("span",{children:"empty"})})}),r.tags&&g.length>0&&(0,Vt.jsx)(Er,{className:"asset-card__tags",separator:" ",tooltipSeparator:", ",getChildString:v,children:null===g||void 0===g?void 0:g.filter((e=>!(0,Ar.o)(e))).slice(0,5).map((e=>(0,Vt.jsx)("cx-tag",{size:"small",variant:"neutral",pill:!0,children:(0,Vt.jsx)("cx-line-clamp",{lines:1,children:e})},e.toLowerCase())))}),(r.dimension||r.fileSize)&&(0,Vt.jsxs)("cx-space",{spacing:"small","align-items":"center",wrap:"nowrap",className:"asset-card__info",children:[r.dimension&&Boolean(Number(n.width))&&Boolean(Number(n.height))&&(0,Vt.jsx)("cx-line-clamp",{lines:1,className:"asset-card__name",children:(0,Vt.jsxs)("cx-typography",{variant:"small",children:[(0,Vt.jsx)("span",{children:n.width})," x ",(0,Vt.jsx)("span",{children:n.height})]})}),r.fileSize&&(0,Vt.jsx)("cx-line-clamp",{lines:1,className:"asset-card__name asset-card__name--right",children:(0,Vt.jsx)("cx-typography",{variant:"small",children:n.size})}),!(r.dimension&&Boolean(Number(n.width))&&Boolean(Number(n.height))||r.fileSize)&&(0,Vt.jsx)("cx-typography",{variant:"small",className:"asset-card__placeholder",children:(0,Vt.jsx)("span",{children:"empty"})})]}),r.tags&&0===g.length&&(0,Vt.jsx)(Er,{className:"asset-card__tags",separator:" ",tooltipSeparator:", ",getChildString:v,children:(0,Vt.jsx)("span",{})})]})},Nr=Ft.Ay.div`
|
|
932
936
|
position: relative;
|
|
933
937
|
|
|
934
938
|
.wrapper__progress-bar {
|
|
@@ -1007,7 +1011,7 @@
|
|
|
1007
1011
|
height: 100%;
|
|
1008
1012
|
display: flex;
|
|
1009
1013
|
flex-direction: column;
|
|
1010
|
-
`,qr={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:Qt.gf.Medium},Hr=(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 Qt.gf.Large:n=15;break;case Qt.gf.Medium:n=20;break;case Qt.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}},Wr=()=>{var e;const[t,n]=(0,wt.useReducer)(Hr,qr),r=(0,Mr.GV)(Fr.jT),o=(0,Mr.GV)(Fr.wL),i=(0,Mr.GV)(Lr.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)(ir.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}:Lt.hT),T=(0,wt.useMemo)((()=>C&&i&&C.recordId===i?C:null),[C,i]),{data:O,isFetching:P,isLoading:z,refetch:D}=(0,Br.X)({});(0,wt.useEffect)((()=>{r&&D()}),[r,D]);const{data:R,isFetching:j,isError:N}=(0,Yn.t$)(T?{assetImages:T?[T]:[],useSession:o}:Lt.hT),{data:I}=(0,Yn.jS)({useSession:o}),{data:M}=(0,Yn.M$)({useSession:o}),{ATSEnabled:L,autoExtension:F=".auto",collectionPath:B,supportedExtensions:U,supportedRepresentativeSubtypes:V}=M||{},{data:q}=(0,Yn.ZP)({useSession:o}),{data:H}=(0,Yn.nb)({useSession:o}),{data:W,refetch:K}=(0,Rt.E7)(T&&l?{recordId:T.id}:Lt.hT),[$,Q]=(0,wt.useState)(!1),[X,G]=(0,wt.useState)(!1),[Z,Y]=(0,wt.useState)(sn.EI.Hide),[J,ee]=(0,wt.useState)(0),[te,ne]=(0,wt.useState)(!1),re=(0,wt.useRef)($),oe=(0,wt.useRef)(null),ie=(0,wt.useRef)(null),ae=(0,wt.useRef)(null),le=(0,wt.useRef)(!1),ce=(0,wt.useRef)([]),ue=(0,Mr.jL)(),de=(0,wt.useRef)(t.pageSize),he=(0,wt.useRef)(t.view),pe=(0,wt.useRef)(!1),fe=(0,wt.useRef)(null);re.current=$,ce.current=t.facets,he.current=t.view,de.current=t.pageSize;const me=(0,wt.useRef)(null),ge=(0,wt.useMemo)((()=>t.selectedFacets.Types&&t.selectedFacets.Types.length>0?t.selectedFacets.Types:["*"]),[t.selectedFacets]),ve=(0,wt.useMemo)((()=>!(null!==ge&&void 0!==ge&&ge.length)||0===ge.length),[ge]),be=(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]),ye=(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]),xe=(0,wt.useMemo)((()=>X&&q&&(null===ge||void 0===ge?void 0:ge.length)&&$),[X,q,ge,$]),{data:we,isFetching:Se,isError:_e,refetch:Ce}=(0,Rt.pf)(xe?{folderID:t.currentFolder.id,isSeeThrough:t.isSeeThrough,limitedToDocTypes:h,pageSize:t.pageSize,searchText:t.searchText,selectedFacets:t.selectedFacets,sortOrder:null===be||void 0===be?void 0:be.id,start:t.start,useSession:o}:Lt.hT);(0,wt.useEffect)((()=>{var e;ee(null!==(e=null===we||void 0===we?void 0:we.items.length)&&void 0!==e?e:0)}),[null===we||void 0===we?void 0:we.items.length]),(0,wt.useEffect)((()=>{A&&ue((0,Lr.DM)(null))}),[ue,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 Se?n({type:"SET_IS_LOADING",payload:!0}):e=setTimeout((()=>{n({type:"SET_IS_LOADING",payload:Se})}),200),()=>{e&&clearTimeout(e)}}),[Se]),(0,wt.useEffect)((()=>{r&&(ue((0,Lr.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(Qt.gf).includes(o)?n({type:"SET_VIEW",payload:o}):n({type:"SET_VIEW",payload:Qt.gf.Medium})),m){if(i){const e=JSON.parse(i);(0,Xe.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,Xe.A)}:{type:"SET_FILTERS",payload:{}})}s&&n({type:"SET_IS_SEE_THROUGH",payload:"true"===s}),l&&n({type:"SET_SEARCH_TEXT",payload:l})}le.current=!0})))}),[ue,r,m,x]),(0,wt.useEffect)((()=>{let e=null;const t=oe.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=ae.current;if(!e)return;const t=e=>{const t=e.detail.entries;window.requestAnimationFrame((()=>{Array.isArray(t)&&t.length&&t[0].target===oe.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)}}),[]),(0,wt.useEffect)((()=>{!be&&le.current&&n({type:"SET_SORT_ORDER",payload:qr.sortOrder})}),[be,q]),(0,wt.useEffect)((()=>{le.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 Ee=t.containerSize.width<=Ut.Pm,Ae=e=>{ue((0,Lr.DM)(e.recordId))},Te=(0,wt.useCallback)((e=>{ue((0,Lr.DM)(null)),n({type:"SET_SEARCH_TEXT",payload:e})}),[ue]),Oe=(0,wt.useRef)(0),Pe=(0,wt.useRef)(0),ze=(0,wt.useRef)(t.defaultPageSize);ze.current=t.defaultPageSize;const De=(0,wt.useCallback)(((e,t)=>{var r;const{width:o,height:i}=e,a=o||0,s=i||0;if(a*s===0||!le.current)return;const l=Oe.current,c=Pe.current;if(Math.abs(l-s)<10&&Math.abs(c-a)<10&&(null===t||void 0===t||!t.force))return;Oe.current=s,Pe.current=a;const u=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--cx-spacing-medium")||"16",10),d=(null===(r=Dr[he.current])||void 0===r?void 0:r.minWidth)||Dr[Qt.gf.Large].minWidth,h=Math.max(1,Math.floor((a+u)/(d+u))),p=Math.ceil(s/(d+u)),f=Math.ceil(p*h/ze.current+1)*ze.current;G(!0),f!==de.current&&0!==f&&n({type:"SET_PAGE_SIZE",payload:{pageSize:f,returnToFirstPage:!(null===t||void 0===t||!t.returnToFirstPage)}})}),[]),Re=(0,wt.useMemo)((()=>ke(De,Ut.h,{leading:!1})),[De]);(0,wt.useEffect)((()=>{if(le.current){const e=ie.current;he.current=t.view,e&&Re({width:e.clientWidth,height:e.clientHeight},{returnToFirstPage:!0,force:!0})}}),[Re,t.view]);const je=(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})}}),[]),Ne=(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})}),[]),Ie=(0,wt.useCallback)((async e=>{re.current||Q(!0);const t=await ue(It(e));It.fulfilled.match(t)&&(n({type:"SET_CURRENT_FOLDER",payload:{folder:e,shouldResetFilters:re.current}}),te||n({type:"SET_OPEN_BROWSER",payload:!1}),ue((0,Lr.DM)(null)),(0,Mt.yt)("lastLocation",JSON.stringify(e)))}),[ue,te]),Me=(0,wt.useCallback)((()=>{pe.current?pe.current=!1:n({type:"SET_START",payload:null!==J&&void 0!==J?J:0})}),[J]),Le=(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})}),[]),Fe=(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]),Be=(0,wt.useMemo)((()=>!!we&&t.start+t.pageSize<t.totalCount),[we,t.pageSize,t.start,t.totalCount]);(0,wt.useEffect)((()=>{var e,t,n,r;Ne&&Ne({currentCount:null!==(e=null===we||void 0===we?void 0:we.items.length)&&void 0!==e?e:0,items:null!==(t=null===we||void 0===we?void 0:we.items)&&void 0!==t?t:[],facets:null!==(n=null===we||void 0===we?void 0:we.facets)&&void 0!==n?n:[],totalCount:null!==(r=null===we||void 0===we?void 0:we.totalCount)&&void 0!==r?r:0})}),[we,Ne]),(0,wt.useEffect)((()=>{const e=()=>{pe.current=!0,fe.current&&clearTimeout(fe.current),fe.current=setTimeout((()=>{pe.current=!1}),Ut.h)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),(0,wt.useEffect)((()=>{const e=me.current,t=()=>{e&&window.clearTimeout(e)};return t(),E||j?(Y(sn.EI.Hide),me.current=window.setTimeout((()=>{Y(sn.EI.ShowLoader)}),800)):E||j||!(null!==R&&void 0!==R&&R.proxies||N)||me.current&&(t(),Y(sn.EI.ShowDialog)),()=>{t()}}),[R,N,j,E]),(0,wt.useEffect)((()=>{T||Y(sn.EI.ShowDialog)}),[T]);const Ue=(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]),Ve=t.containerSize.width<650;return(0,Vt.jsx)("cx-resize-observer",{ref:ae,children:(0,Vt.jsxs)(Ur,{ref:oe,children:[(0,Vt.jsx)(Yt,{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:Ie,onClose:()=>n({type:"SET_OPEN_BROWSER",payload:!1}),isPersistent:te,onChangePersistent:ne,forceOverlay:Ve}),(0,Vt.jsxs)(Vr,{children:[(0,Vt.jsx)(sr,{bordered:t.hasScrolled,currentFolder:t.currentFolder,isFetching:P,isLoading:z,userInfo:O,onMenuClick:()=>n({type:"SET_OPEN_BROWSER",payload:!0}),onLogout:()=>{ue((0,Fr.ri)()),ue((0,Lr.DM)(null)),n({type:"RESET_SEARCH"})},children:(0,Vt.jsx)(on,{allowSorting:"Mono"!==(null===be||void 0===be?void 0:be.sortDirection)&&!!be,availableFacets:null!==H&&void 0!==H?H:[],currentCount:t.currentCount,facets:t.facets,isMobile:Ee,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:Te,onSettingChange:je})}),(0,Vt.jsx)("div",{style:{flex:1,minHeight:"320px",padding:"0 var(--cx-spacing-medium)",position:"relative"},children:(0,Vt.jsx)(Pt,{onResize:Re,children:e=>{let{height:n,width:r}=e;return(0,Vt.jsx)("div",{style:{height:n+"px",width:r+"px"},children:(0,Vt.jsx)(Ir,{ref:ie,isError:_e,isConfigError:ve,hasNextPage:Be,height:n,isLoadingData:t.isLoading||!we,isFetched:!!we||ve,items:(null===we||void 0===we?void 0:we.items)||[],selectedAsset:null!==T&&void 0!==T?T:null,view:t.view,width:r,onItemSelect:Ae,onLoadMore:Me,onScroll:Le},t.currentFolder.id+t.searchText+Object.values(t.selectedFacets).join("+")+t.isSeeThrough+t.view)})}})}),Z===sn.EI.ShowLoader&&(0,Vt.jsx)("cx-space",{className:"format-loader",children:(0,Vt.jsx)("cx-spinner",{})}),(0,Vt.jsx)(or,{allowCustomFormat:!!L&&!(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(F))&&void 0!==e&&e,autoExtension:F,availableExtensions:Ue,availableProxies:N?[]:j?void 0:ye,ctaText:f,extensions:null!==U&&void 0!==U?U:[],isFavorite:!!W,maxHeight:t.containerSize.height,open:!!T&&Z===sn.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:Ee?"drawer":"dialog",boundary:oe.current,onClose:()=>{ue((0,Lr.DM)(null)),S("unselect","")},onFavorite:async()=>{if(!T)return!1;const e=await ue((0,Lr.P1)({recordId:T.recordId}));return Lr.P1.fulfilled.match(e)&&(S&&S("favorite",T.recordId),await K(),t.currentFolder.id===(null===O||void 0===O?void 0:O.favoriteFolderRecordID)&&(0===t.start?Ce():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 ue((0,Lr.Tp)({extension:t,extraFields:w,parameters:i,permanentLink:r,proxiesPreference:n,selectedAsset:T,useRepresentative:a,useSession:o}));Lr.Tp.fulfilled.match(l)&&await Fe(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 ue((0,Lr.Tp)({extraFields:w,extension:i,maxHeight:c,maxWidth:l,parameters:n,proxiesPreference:r,selectedAsset:T,useSession:o,transformations:t}));Lr.Tp.fulfilled.match(u)&&await Fe(u.payload,a,s)},onUnFavorite:async()=>{if(!T)return!1;const e=await ue((0,Lr.BZ)({recordId:T.recordId}));return Lr.BZ.fulfilled.match(e)&&(S&&S("unfavorite",T.recordId),await K(),t.currentFolder.id===(null===O||void 0===O?void 0:O.favoriteFolderRecordID)&&(0===t.start?Ce():n({type:"SET_CURRENT_FOLDER",payload:{folder:t.currentFolder,shouldResetFilters:!0}}))),!!e||e}})]})]})})}},9989:e=>{"use strict";var t=!("undefined"===typeof window||!window.document||!window.document.createElement),n={canUseDOM:t,canUseWorkers:"undefined"!==typeof Worker,canUseEventListeners:t&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:t&&!!window.screen,isInWorker:!t};e.exports=n},9993:(e,t,n)=>{"use strict";n.d(t,{A:()=>m});var r=n(4802),o=n(3903),i=n(3239),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1;const s=function(e){return(0,i.A)(e)&&(0,o.A)(e.length)&&!!a[(0,r.A)(e)]};var l=n(7328),c=n(8187),u="object"==typeof exports&&exports&&!exports.nodeType&&exports,d=u&&"object"==typeof module&&module&&!module.nodeType&&module,h=d&&d.exports===u&&c.A.process,p=function(){try{var e=d&&d.require&&d.require("util").types;return e||h&&h.binding&&h.binding("util")}catch(t){}}();var f=p&&p.isTypedArray;const m=f?(0,l.A)(f):s}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0;var r={};return(()=>{"use strict";n.d(r,{default:()=>Mv});var e=n(4391),t=n(5137);const o=globalThis,i=o.ShadowRoot&&(void 0===o.ShadyCSS||o.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),s=new WeakMap;let l=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(i&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=s.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&s.set(t,e))}return e}toString(){return this.cssText}};const c=e=>new l("string"==typeof e?e:e+"",void 0,a),u=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];const o=1===e.length?e[0]:n.reduce(((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[r+1]),e[0]);return new l(o,e,a)},d=i?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return c(t)})(e):e,{is:h,defineProperty:p,getOwnPropertyDescriptor:f,getOwnPropertyNames:m,getOwnPropertySymbols:g,getPrototypeOf:v}=Object,b=globalThis,y=b.trustedTypes,x=y?y.emptyScript:"",w=b.reactiveElementPolyfillSupport,S=(e,t)=>e,k={toAttribute(e,t){switch(t){case Boolean:e=e?x:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},_=(e,t)=>!h(e,t),C={attribute:!0,type:String,converter:k,reflect:!1,useDefault:!1,hasChanged:_};Symbol.metadata??=Symbol("metadata"),b.litPropertyMetadata??=new WeakMap;let E=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:C;if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),r=this.getPropertyDescriptor(e,n,t);void 0!==r&&p(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){const{get:r,set:o}=f(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){const i=r?.call(this);o?.call(this,t),this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(S("elementProperties")))return;const e=v(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(S("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(S("properties"))){const e=this.properties,t=[...m(e),...g(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const e=this._$Eu(t,n);void 0!==e&&this._$Eh.set(e,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(d(e))}else void 0!==e&&t.push(d(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(i)e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of t){const t=document.createElement("style"),r=o.litNonce;void 0!==r&&t.setAttribute("nonce",r),t.textContent=n.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(void 0!==r&&!0===n.reflect){const o=(void 0!==n.converter?.toAttribute?n.converter:k).toAttribute(t,n.type);this._$Em=e,null==o?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,t){const n=this.constructor,r=n._$Eh.get(e);if(void 0!==r&&this._$Em!==r){const e=n.getPropertyOptions(r),o="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:k;this._$Em=r;const i=o.fromAttribute(t,e.type);this[r]=i??this._$Ej?.get(r)??i,this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){const r=this.constructor,o=this[e];if(n??=r.getPropertyOptions(e),!((n.hasChanged??_)(o,t)||n.useDefault&&n.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,n,r){let{useDefault:o,reflect:i,wrapped:a}=n;o&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,r??t??this[e]),!0!==a||void 0!==r)||(this._$AL.has(e)||(this.hasUpdated||o||(t=void 0),this._$AL.set(e,t)),!0===i&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e){const{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||void 0===r||this.C(t,void 0,n,r)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EM()}catch(Oe){throw e=!1,this._$EM(),Oe}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(e){}firstUpdated(e){}};E.elementStyles=[],E.shadowRootOptions={mode:"open"},E[S("elementProperties")]=new Map,E[S("finalized")]=new Map,w?.({ReactiveElement:E}),(b.reactiveElementVersions??=[]).push("2.1.1");const A=globalThis,T=A.trustedTypes,O=T?T.createPolicy("lit-html",{createHTML:e=>e}):void 0,P="$lit$",z=`lit$${Math.random().toFixed(9).slice(2)}$`,D="?"+z,R=`<${D}>`,j=document,N=()=>j.createComment(""),I=e=>null===e||"object"!=typeof e&&"function"!=typeof e,M=Array.isArray,L="[ \t\n\f\r]",F=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,B=/-->/g,U=/>/g,V=RegExp(`>|${L}(?:([^\\s"'>=/]+)(${L}*=${L}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),q=/'/g,H=/"/g,W=/^(?:script|style|textarea|title)$/i,K=e=>function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return{_$litType$:e,strings:t,values:r}},$=K(1),Q=(K(2),Symbol.for("lit-noChange")),X=Symbol.for("lit-nothing"),G=new WeakMap,Z=j.createTreeWalker(j,129);function Y(e,t){if(!M(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==O?O.createHTML(t):t}class J{constructor(e,t){let n,{strings:r,_$litType$:o}=e;this.parts=[];let i=0,a=0;const s=r.length-1,l=this.parts,[c,u]=((e,t)=>{const n=e.length-1,r=[];let o,i=2===t?"<svg>":3===t?"<math>":"",a=F;for(let s=0;s<n;s++){const t=e[s];let n,l,c=-1,u=0;for(;u<t.length&&(a.lastIndex=u,l=a.exec(t),null!==l);)u=a.lastIndex,a===F?"!--"===l[1]?a=B:void 0!==l[1]?a=U:void 0!==l[2]?(W.test(l[2])&&(o=RegExp("</"+l[2],"g")),a=V):void 0!==l[3]&&(a=V):a===V?">"===l[0]?(a=o??F,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,n=l[1],a=void 0===l[3]?V:'"'===l[3]?H:q):a===H||a===q?a=V:a===B||a===U?a=F:(a=V,o=void 0);const d=a===V&&e[s+1].startsWith("/>")?" ":"";i+=a===F?t+R:c>=0?(r.push(n),t.slice(0,c)+P+t.slice(c)+z+d):t+z+(-2===c?s:d)}return[Y(e,i+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),r]})(r,o);if(this.el=J.createElement(c,t),Z.currentNode=this.el.content,2===o||3===o){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(n=Z.nextNode())&&l.length<s;){if(1===n.nodeType){if(n.hasAttributes())for(const e of n.getAttributeNames())if(e.endsWith(P)){const t=u[a++],r=n.getAttribute(e).split(z),o=/([.?@])?(.*)/.exec(t);l.push({type:1,index:i,name:o[2],strings:r,ctor:"."===o[1]?oe:"?"===o[1]?ie:"@"===o[1]?ae:re}),n.removeAttribute(e)}else e.startsWith(z)&&(l.push({type:6,index:i}),n.removeAttribute(e));if(W.test(n.tagName)){const e=n.textContent.split(z),t=e.length-1;if(t>0){n.textContent=T?T.emptyScript:"";for(let r=0;r<t;r++)n.append(e[r],N()),Z.nextNode(),l.push({type:2,index:++i});n.append(e[t],N())}}}else if(8===n.nodeType)if(n.data===D)l.push({type:2,index:i});else{let e=-1;for(;-1!==(e=n.data.indexOf(z,e+1));)l.push({type:7,index:i}),e+=z.length-1}i++}}static createElement(e,t){const n=j.createElement("template");return n.innerHTML=e,n}}function ee(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3?arguments[3]:void 0;if(t===Q)return t;let o=void 0!==r?n._$Co?.[r]:n._$Cl;const i=I(t)?void 0:t._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),void 0===i?o=void 0:(o=new i(e),o._$AT(e,n,r)),void 0!==r?(n._$Co??=[])[r]=o:n._$Cl=o),void 0!==o&&(t=ee(e,o._$AS(e,t.values),o,r)),t}class te{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??j).importNode(t,!0);Z.currentNode=r;let o=Z.nextNode(),i=0,a=0,s=n[0];for(;void 0!==s;){if(i===s.index){let t;2===s.type?t=new ne(o,o.nextSibling,this,e):1===s.type?t=new s.ctor(o,s.name,s.strings,this,e):6===s.type&&(t=new se(o,this,e)),this._$AV.push(t),s=n[++a]}i!==s?.index&&(o=Z.nextNode(),i++)}return Z.currentNode=j,r}p(e){let t=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class ne{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=X,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e){e=ee(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this),I(e)?e===X||null==e||""===e?(this._$AH!==X&&this._$AR(),this._$AH=X):e!==this._$AH&&e!==Q&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>M(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==X&&I(this._$AH)?this._$AA.nextSibling.data=e:this.T(j.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,r="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=J.createElement(Y(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{const e=new te(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=G.get(e.strings);return void 0===t&&G.set(e.strings,t=new J(e)),t}k(e){M(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,r=0;for(const o of e)r===t.length?t.push(n=new ne(this.O(N()),this.O(N()),this,this.options)):n=t[r],n._$AI(o),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._$AA.nextSibling,t=arguments.length>1?arguments[1]:void 0;for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class re{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,o){this.type=1,this._$AH=X,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=o,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=X}_$AI(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;const o=this.strings;let i=!1;if(void 0===o)e=ee(this,e,t,0),i=!I(e)||e!==this._$AH&&e!==Q,i&&(this._$AH=e);else{const r=e;let a,s;for(e=o[0],a=0;a<o.length-1;a++)s=ee(this,r[n+a],t,a),s===Q&&(s=this._$AH[a]),i||=!I(s)||s!==this._$AH[a],s===X?e=X:e!==X&&(e+=(s??"")+o[a+1]),this._$AH[a]=s}i&&!r&&this.j(e)}j(e){e===X?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class oe extends re{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===X?void 0:e}}class ie extends re{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==X)}}class ae extends re{constructor(e,t,n,r,o){super(e,t,n,r,o),this.type=5}_$AI(e){if((e=ee(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,0)??X)===Q)return;const t=this._$AH,n=e===X&&t!==X||e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive,r=e!==X&&(t===X||n);n&&this.element.removeEventListener(this.name,this,t),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class se{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){ee(this,e)}}const le={I:ne},ce=A.litHtmlPolyfillSupport;ce?.(J,ne),(A.litHtmlVersions??=[]).push("3.3.1");const ue=globalThis;class de extends E{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{const r=n?.renderBefore??t;let o=r._$litPart$;if(void 0===o){const e=n?.renderBefore??null;r._$litPart$=o=new ne(t.insertBefore(N(),e),e,void 0,n??{})}return o._$AI(e),o})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Q}}de._$litElement$=!0,de.finalized=!0,ue.litElementHydrateSupport?.({LitElement:de});const he=ue.litElementPolyfillSupport;he?.({LitElement:de}),(ue.litElementVersions??=[]).push("4.2.1");const pe={attribute:!0,type:String,converter:k,reflect:!1,hasChanged:_};function fe(e){return(t,n)=>"object"==typeof n?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pe,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;const{kind:r,metadata:o}=n;let i=globalThis.litPropertyMetadata.get(o);if(void 0===i&&globalThis.litPropertyMetadata.set(o,i=new Map),"setter"===r&&((e=Object.create(e)).wrapped=!0),i.set(n.name,e),"accessor"===r){const{name:r}=n;return{set(n){const o=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,o,e)},init(t){return void 0!==t&&this.C(r,void 0,e,t),t}}}if("setter"===r){const{name:r}=n;return function(n){const o=this[r];t.call(this,n),this.requestUpdate(r,o,e)}}throw Error("Unsupported decorator location: "+r)}(e,t,n):((e,t,n)=>{const r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}var me=Object.defineProperty,ge=(e,t,n,r)=>{for(var o,i=void 0,a=e.length-1;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&me(t,n,i),i};const ve=class extends de{constructor(){super(),this.preRender=!1,Object.entries(this.constructor.dependencies).forEach((e=>{let[t,n]=e;this.constructor.define(t,n)}))}emit(e,t){const n=new CustomEvent(e,{bubbles:!0,cancelable:!1,composed:!0,detail:{},...t});return this.dispatchEvent(n),n}static define(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=customElements.get(e);if(!r){try{customElements.define(e,t,n)}catch{customElements.define(e,class extends t{},n)}return}let o=" (unknown version)",i=o;"version"in t&&t.version&&(o=" v"+t.version),"version"in r&&r.version&&(i=" v"+r.version),(!o||!i||o!==i)&&console.warn(`Attempted to register <${e}>${o}, but <${e}>${i} has already been registered.`)}static createProperty(e,t){super.createProperty(e,t),t?.attribute&&"string"==typeof t.attribute&&!Object.prototype.hasOwnProperty.call(this.prototype,t.attribute)&&Object.prototype.hasOwnProperty.call(this.prototype,e)&&Object.defineProperty(this.prototype,t.attribute,{get(){return this[e]},set(t){this[e]=t}})}firstUpdated(e){super.firstUpdated(e),!this.preRender&&this.runFirstUpdated(e)}runFirstUpdated(e){}adoptedCallback(){ye(this)}disconnectedCallback(){super.disconnectedCallback(),ye(this)}};ve.version="1",ve.dependencies={};let be=ve;function ye(e){if(e instanceof be)return;const t=e.localName||e.tagName,n=customElements.get(t.toLowerCase());n&&Object.setPrototypeOf(e,n.prototype)}ge([fe()],be.prototype,"dir"),ge([fe()],be.prototype,"lang"),ge([fe({attribute:"pre-render",type:Boolean})],be.prototype,"preRender");const xe=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.get(e)||window.customElements.define(e,t),t))(e,t):((e,t)=>{const{elements:n,kind:r}=t;return{elements:n,finisher(t){window.customElements.get(e)||window.customElements.define(e,t)},kind:r}})(e,t),we=u`
|
|
1014
|
+
`,qr={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:Qt.gf.Medium},Hr=(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 Qt.gf.Large:n=15;break;case Qt.gf.Medium:n=20;break;case Qt.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}},Wr=()=>{var e;const[t,n]=(0,wt.useReducer)(Hr,qr),r=(0,Mr.GV)(Fr.jT),o=(0,Mr.GV)(Fr.wL),i=(0,Mr.GV)(Lr.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)(ir.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}:Lt.hT),T=(0,wt.useMemo)((()=>C&&i&&C.recordId===i?C:null),[C,i]),{data:O,isFetching:P,isLoading:z,refetch:D}=(0,Br.X)({});(0,wt.useEffect)((()=>{r&&D()}),[r,D]);const{data:R,isFetching:j,isError:N}=(0,Yn.t$)(T?{assetImages:T?[T]:[],useSession:o}:Lt.hT),{data:I}=(0,Yn.jS)({useSession:o}),{data:M}=(0,Yn.M$)({useSession:o}),{ATSEnabled:L,autoExtension:F=".auto",collectionPath:B,supportedExtensions:U,supportedRepresentativeSubtypes:V}=M||{},{data:q}=(0,Yn.ZP)({useSession:o}),{data:H}=(0,Yn.nb)({useSession:o}),{data:W,refetch:K}=(0,Rt.E7)(T&&l?{recordId:T.id}:Lt.hT),[$,Q]=(0,wt.useState)(!1),[X,G]=(0,wt.useState)(!1),[Z,Y]=(0,wt.useState)(sn.EI.Hide),[J,ee]=(0,wt.useState)(0),[te,ne]=(0,wt.useState)(!1),re=(0,wt.useRef)($),oe=(0,wt.useRef)(null),ie=(0,wt.useRef)(null),ae=(0,wt.useRef)(null),le=(0,wt.useRef)(!1),ce=(0,wt.useRef)([]),ue=(0,wt.useRef)({}),de=(0,Mr.jL)(),he=(0,wt.useRef)(t.pageSize),pe=(0,wt.useRef)(t.view),fe=(0,wt.useRef)(!1),me=(0,wt.useRef)(null);re.current=$,ce.current=t.facets,ue.current=t.selectedFacets,pe.current=t.view,he.current=t.pageSize;const ge=(0,wt.useRef)(null),ve=(0,wt.useMemo)((()=>t.selectedFacets.Types&&t.selectedFacets.Types.length>0?t.selectedFacets.Types:["*"]),[t.selectedFacets]),be=(0,wt.useMemo)((()=>!(null!==ve&&void 0!==ve&&ve.length)||0===ve.length),[ve]),ye=(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]),xe=(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]),we=(0,wt.useMemo)((()=>X&&q&&(null===ve||void 0===ve?void 0:ve.length)&&$),[X,q,ve,$]),{data:Se,isFetching:_e,isError:Ce,refetch:Ee}=(0,Rt.pf)(we?{folderID:t.currentFolder.id,isSeeThrough:t.isSeeThrough,limitedToDocTypes:h,pageSize:t.pageSize,searchText:t.searchText,selectedFacets:t.selectedFacets,sortOrder:null===ye||void 0===ye?void 0:ye.id,start:t.start,useSession:o}:Lt.hT);(0,wt.useEffect)((()=>{var e;ee(null!==(e=null===Se||void 0===Se?void 0:Se.items.length)&&void 0!==e?e:0)}),[null===Se||void 0===Se?void 0:Se.items.length]),(0,wt.useEffect)((()=>{A&&de((0,Lr.DM)(null))}),[de,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 _e?n({type:"SET_IS_LOADING",payload:!0}):e=setTimeout((()=>{n({type:"SET_IS_LOADING",payload:_e})}),200),()=>{e&&clearTimeout(e)}}),[_e]),(0,wt.useEffect)((()=>{r&&(de((0,Lr.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(Qt.gf).includes(o)?n({type:"SET_VIEW",payload:o}):n({type:"SET_VIEW",payload:Qt.gf.Medium})),m){if(i){const e=JSON.parse(i);(0,Xe.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,Xe.A)}:{type:"SET_FILTERS",payload:{}})}s&&n({type:"SET_IS_SEE_THROUGH",payload:"true"===s}),l&&n({type:"SET_SEARCH_TEXT",payload:l})}le.current=!0})))}),[de,r,m,x]),(0,wt.useEffect)((()=>{let e=null;const t=oe.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=ae.current;if(!e)return;const t=e=>{const t=e.detail.entries;window.requestAnimationFrame((()=>{Array.isArray(t)&&t.length&&t[0].target===oe.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)}}),[]),(0,wt.useEffect)((()=>{!ye&&le.current&&n({type:"SET_SORT_ORDER",payload:qr.sortOrder})}),[ye,q]),(0,wt.useEffect)((()=>{le.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 Ae=t.containerSize.width<=Ut.Pm,Te=e=>{de((0,Lr.DM)(e.recordId))},Oe=(0,wt.useCallback)((e=>{de((0,Lr.DM)(null)),n({type:"SET_SEARCH_TEXT",payload:e})}),[de]),Pe=(0,wt.useRef)(0),ze=(0,wt.useRef)(0),De=(0,wt.useRef)(t.defaultPageSize);De.current=t.defaultPageSize;const Re=(0,wt.useCallback)(((e,t)=>{var r;const{width:o,height:i}=e,a=o||0,s=i||0;if(a*s===0||!le.current)return;const l=Pe.current,c=ze.current;if(Math.abs(l-s)<10&&Math.abs(c-a)<10&&(null===t||void 0===t||!t.force))return;Pe.current=s,ze.current=a;const u=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--cx-spacing-medium")||"16",10),d=(null===(r=Dr[pe.current])||void 0===r?void 0:r.minWidth)||Dr[Qt.gf.Large].minWidth,h=Math.max(1,Math.floor((a+u)/(d+u))),p=Math.ceil(s/(d+u)),f=Math.ceil(p*h/De.current+1)*De.current;G(!0),f!==he.current&&0!==f&&n({type:"SET_PAGE_SIZE",payload:{pageSize:f,returnToFirstPage:!(null===t||void 0===t||!t.returnToFirstPage)}})}),[]),je=(0,wt.useMemo)((()=>ke(Re,Ut.h,{leading:!1})),[Re]);(0,wt.useEffect)((()=>{if(le.current){const e=ie.current;pe.current=t.view,e&&je({width:e.clientWidth,height:e.clientHeight},{returnToFirstPage:!0,force:!0})}}),[je,t.view]);const Ne=(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})}}),[]),Ie=(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})}),[]),Me=(0,wt.useCallback)((async e=>{re.current||Q(!0);const t=await de(It(e));It.fulfilled.match(t)&&(n({type:"SET_CURRENT_FOLDER",payload:{folder:e,shouldResetFilters:re.current}}),te||n({type:"SET_OPEN_BROWSER",payload:!1}),de((0,Lr.DM)(null)),(0,Mt.yt)("lastLocation",JSON.stringify(e)))}),[de,te]),Le=(0,wt.useCallback)((()=>{fe.current?fe.current=!1:n({type:"SET_START",payload:null!==J&&void 0!==J?J:0})}),[J]),Fe=(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})}),[]),Be=(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]),Ue=(0,wt.useMemo)((()=>!!Se&&t.start+t.pageSize<t.totalCount),[Se,t.pageSize,t.start,t.totalCount]);(0,wt.useEffect)((()=>{if(Ie){var e,t,n,r,o;const i=new Map(ce.current.map((e=>[`${e.facetDetails.facetFieldName}|${e.facetDetails.displayName}`,{...e,values:e.values.reduce(((t,n)=>{var r;return(null===(r=ue.current[e.facetDetails.facetFieldName])||void 0===r?void 0:r.find((e=>e===n.value)))&&t.push({...n,count:0}),t}),[])}])));(null!==(e=null===Se||void 0===Se||null===(t=Se.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})})),Ie({currentCount:null!==(n=null===Se||void 0===Se?void 0:Se.items.length)&&void 0!==n?n:0,items:null!==(r=null===Se||void 0===Se?void 0:Se.items)&&void 0!==r?r:[],facets:Array.from(i.values()),totalCount:null!==(o=null===Se||void 0===Se?void 0:Se.totalCount)&&void 0!==o?o:0})}}),[Se,Ie]),(0,wt.useEffect)((()=>{const e=()=>{fe.current=!0,me.current&&clearTimeout(me.current),me.current=setTimeout((()=>{fe.current=!1}),Ut.h)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),(0,wt.useEffect)((()=>{const e=ge.current,t=()=>{e&&window.clearTimeout(e)};return t(),E||j?(Y(sn.EI.Hide),ge.current=window.setTimeout((()=>{Y(sn.EI.ShowLoader)}),800)):E||j||!(null!==R&&void 0!==R&&R.proxies||N)||ge.current&&(t(),Y(sn.EI.ShowDialog)),()=>{t()}}),[R,N,j,E]),(0,wt.useEffect)((()=>{T||Y(sn.EI.ShowDialog)}),[T]);const Ve=(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]),qe=t.containerSize.width<650;return(0,Vt.jsx)("cx-resize-observer",{ref:ae,children:(0,Vt.jsxs)(Ur,{ref:oe,children:[(0,Vt.jsx)(Yt,{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:Me,onClose:()=>n({type:"SET_OPEN_BROWSER",payload:!1}),isPersistent:te,onChangePersistent:ne,forceOverlay:qe}),(0,Vt.jsxs)(Vr,{children:[(0,Vt.jsx)(sr,{bordered:t.hasScrolled,currentFolder:t.currentFolder,isFetching:P,isLoading:z,userInfo:O,onMenuClick:()=>n({type:"SET_OPEN_BROWSER",payload:!0}),onLogout:()=>{de((0,Fr.ri)()),de((0,Lr.DM)(null)),n({type:"RESET_SEARCH"})},children:(0,Vt.jsx)(on,{allowSorting:"Mono"!==(null===ye||void 0===ye?void 0:ye.sortDirection)&&!!ye,availableFacets:null!==H&&void 0!==H?H:[],currentCount:t.currentCount,facets:t.facets,isMobile:Ae,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:Oe,onSettingChange:Ne})}),(0,Vt.jsx)("div",{style:{flex:1,minHeight:"320px",padding:"0 var(--cx-spacing-medium)",position:"relative"},children:(0,Vt.jsx)(Pt,{onResize:je,children:e=>{let{height:n,width:r}=e;return(0,Vt.jsx)("div",{style:{height:n+"px",width:r+"px"},children:(0,Vt.jsx)(Ir,{ref:ie,isError:Ce,isConfigError:be,hasNextPage:Ue,height:n,isLoadingData:t.isLoading||!Se,isFetched:!!Se||be,items:(null===Se||void 0===Se?void 0:Se.items)||[],selectedAsset:null!==T&&void 0!==T?T:null,view:t.view,width:r,onItemSelect:Te,onLoadMore:Le,onScroll:Fe},t.currentFolder.id+t.searchText+Object.values(t.selectedFacets).join("+")+t.isSeeThrough+t.view)})}})}),Z===sn.EI.ShowLoader&&(0,Vt.jsx)("cx-space",{className:"format-loader",children:(0,Vt.jsx)("cx-spinner",{})}),(0,Vt.jsx)(or,{allowCustomFormat:!!L&&!(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(F))&&void 0!==e&&e,autoExtension:F,availableExtensions:Ve,availableProxies:N?[]:j?void 0:xe,ctaText:f,extensions:null!==U&&void 0!==U?U:[],isFavorite:!!W,maxHeight:t.containerSize.height,open:!!T&&Z===sn.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:Ae?"drawer":"dialog",boundary:oe.current,onClose:()=>{de((0,Lr.DM)(null)),S("unselect","")},onFavorite:async()=>{if(!T)return!1;const e=await de((0,Lr.P1)({recordId:T.recordId}));return Lr.P1.fulfilled.match(e)&&(S&&S("favorite",T.recordId),await K(),t.currentFolder.id===(null===O||void 0===O?void 0:O.favoriteFolderRecordID)&&(0===t.start?Ee():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 de((0,Lr.Tp)({extension:t,extraFields:w,parameters:i,permanentLink:r,proxiesPreference:n,selectedAsset:T,useRepresentative:a,useSession:o}));Lr.Tp.fulfilled.match(l)&&await Be(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 de((0,Lr.Tp)({extraFields:w,extension:i,maxHeight:c,maxWidth:l,parameters:n,proxiesPreference:r,selectedAsset:T,useSession:o,transformations:t}));Lr.Tp.fulfilled.match(u)&&await Be(u.payload,a,s)},onUnFavorite:async()=>{if(!T)return!1;const e=await de((0,Lr.BZ)({recordId:T.recordId}));return Lr.BZ.fulfilled.match(e)&&(S&&S("unfavorite",T.recordId),await K(),t.currentFolder.id===(null===O||void 0===O?void 0:O.favoriteFolderRecordID)&&(0===t.start?Ee():n({type:"SET_CURRENT_FOLDER",payload:{folder:t.currentFolder,shouldResetFilters:!0}}))),!!e||e}})]})]})})}},9989:e=>{"use strict";var t=!("undefined"===typeof window||!window.document||!window.document.createElement),n={canUseDOM:t,canUseWorkers:"undefined"!==typeof Worker,canUseEventListeners:t&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:t&&!!window.screen,isInWorker:!t};e.exports=n},9993:(e,t,n)=>{"use strict";n.d(t,{A:()=>m});var r=n(4802),o=n(3903),i=n(3239),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1;const s=function(e){return(0,i.A)(e)&&(0,o.A)(e.length)&&!!a[(0,r.A)(e)]};var l=n(7328),c=n(8187),u="object"==typeof exports&&exports&&!exports.nodeType&&exports,d=u&&"object"==typeof module&&module&&!module.nodeType&&module,h=d&&d.exports===u&&c.A.process,p=function(){try{var e=d&&d.require&&d.require("util").types;return e||h&&h.binding&&h.binding("util")}catch(t){}}();var f=p&&p.isTypedArray;const m=f?(0,l.A)(f):s}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0;var r={};return(()=>{"use strict";n.d(r,{default:()=>Mv});var e=n(4391),t=n(5137);const o=globalThis,i=o.ShadowRoot&&(void 0===o.ShadyCSS||o.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),s=new WeakMap;let l=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(i&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=s.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&s.set(t,e))}return e}toString(){return this.cssText}};const c=e=>new l("string"==typeof e?e:e+"",void 0,a),u=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];const o=1===e.length?e[0]:n.reduce(((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[r+1]),e[0]);return new l(o,e,a)},d=i?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return c(t)})(e):e,{is:h,defineProperty:p,getOwnPropertyDescriptor:f,getOwnPropertyNames:m,getOwnPropertySymbols:g,getPrototypeOf:v}=Object,b=globalThis,y=b.trustedTypes,x=y?y.emptyScript:"",w=b.reactiveElementPolyfillSupport,S=(e,t)=>e,k={toAttribute(e,t){switch(t){case Boolean:e=e?x:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},_=(e,t)=>!h(e,t),C={attribute:!0,type:String,converter:k,reflect:!1,useDefault:!1,hasChanged:_};Symbol.metadata??=Symbol("metadata"),b.litPropertyMetadata??=new WeakMap;let E=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:C;if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),r=this.getPropertyDescriptor(e,n,t);void 0!==r&&p(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){const{get:r,set:o}=f(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){const i=r?.call(this);o?.call(this,t),this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(S("elementProperties")))return;const e=v(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(S("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(S("properties"))){const e=this.properties,t=[...m(e),...g(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const e=this._$Eu(t,n);void 0!==e&&this._$Eh.set(e,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(d(e))}else void 0!==e&&t.push(d(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(i)e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of t){const t=document.createElement("style"),r=o.litNonce;void 0!==r&&t.setAttribute("nonce",r),t.textContent=n.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(void 0!==r&&!0===n.reflect){const o=(void 0!==n.converter?.toAttribute?n.converter:k).toAttribute(t,n.type);this._$Em=e,null==o?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,t){const n=this.constructor,r=n._$Eh.get(e);if(void 0!==r&&this._$Em!==r){const e=n.getPropertyOptions(r),o="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:k;this._$Em=r;const i=o.fromAttribute(t,e.type);this[r]=i??this._$Ej?.get(r)??i,this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){const r=this.constructor,o=this[e];if(n??=r.getPropertyOptions(e),!((n.hasChanged??_)(o,t)||n.useDefault&&n.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,n,r){let{useDefault:o,reflect:i,wrapped:a}=n;o&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,r??t??this[e]),!0!==a||void 0!==r)||(this._$AL.has(e)||(this.hasUpdated||o||(t=void 0),this._$AL.set(e,t)),!0===i&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e){const{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||void 0===r||this.C(t,void 0,n,r)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EM()}catch(Oe){throw e=!1,this._$EM(),Oe}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(e){}firstUpdated(e){}};E.elementStyles=[],E.shadowRootOptions={mode:"open"},E[S("elementProperties")]=new Map,E[S("finalized")]=new Map,w?.({ReactiveElement:E}),(b.reactiveElementVersions??=[]).push("2.1.1");const A=globalThis,T=A.trustedTypes,O=T?T.createPolicy("lit-html",{createHTML:e=>e}):void 0,P="$lit$",z=`lit$${Math.random().toFixed(9).slice(2)}$`,D="?"+z,R=`<${D}>`,j=document,N=()=>j.createComment(""),I=e=>null===e||"object"!=typeof e&&"function"!=typeof e,M=Array.isArray,L="[ \t\n\f\r]",F=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,B=/-->/g,U=/>/g,V=RegExp(`>|${L}(?:([^\\s"'>=/]+)(${L}*=${L}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),q=/'/g,H=/"/g,W=/^(?:script|style|textarea|title)$/i,K=e=>function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return{_$litType$:e,strings:t,values:r}},$=K(1),Q=(K(2),Symbol.for("lit-noChange")),X=Symbol.for("lit-nothing"),G=new WeakMap,Z=j.createTreeWalker(j,129);function Y(e,t){if(!M(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==O?O.createHTML(t):t}class J{constructor(e,t){let n,{strings:r,_$litType$:o}=e;this.parts=[];let i=0,a=0;const s=r.length-1,l=this.parts,[c,u]=((e,t)=>{const n=e.length-1,r=[];let o,i=2===t?"<svg>":3===t?"<math>":"",a=F;for(let s=0;s<n;s++){const t=e[s];let n,l,c=-1,u=0;for(;u<t.length&&(a.lastIndex=u,l=a.exec(t),null!==l);)u=a.lastIndex,a===F?"!--"===l[1]?a=B:void 0!==l[1]?a=U:void 0!==l[2]?(W.test(l[2])&&(o=RegExp("</"+l[2],"g")),a=V):void 0!==l[3]&&(a=V):a===V?">"===l[0]?(a=o??F,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,n=l[1],a=void 0===l[3]?V:'"'===l[3]?H:q):a===H||a===q?a=V:a===B||a===U?a=F:(a=V,o=void 0);const d=a===V&&e[s+1].startsWith("/>")?" ":"";i+=a===F?t+R:c>=0?(r.push(n),t.slice(0,c)+P+t.slice(c)+z+d):t+z+(-2===c?s:d)}return[Y(e,i+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),r]})(r,o);if(this.el=J.createElement(c,t),Z.currentNode=this.el.content,2===o||3===o){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(n=Z.nextNode())&&l.length<s;){if(1===n.nodeType){if(n.hasAttributes())for(const e of n.getAttributeNames())if(e.endsWith(P)){const t=u[a++],r=n.getAttribute(e).split(z),o=/([.?@])?(.*)/.exec(t);l.push({type:1,index:i,name:o[2],strings:r,ctor:"."===o[1]?oe:"?"===o[1]?ie:"@"===o[1]?ae:re}),n.removeAttribute(e)}else e.startsWith(z)&&(l.push({type:6,index:i}),n.removeAttribute(e));if(W.test(n.tagName)){const e=n.textContent.split(z),t=e.length-1;if(t>0){n.textContent=T?T.emptyScript:"";for(let r=0;r<t;r++)n.append(e[r],N()),Z.nextNode(),l.push({type:2,index:++i});n.append(e[t],N())}}}else if(8===n.nodeType)if(n.data===D)l.push({type:2,index:i});else{let e=-1;for(;-1!==(e=n.data.indexOf(z,e+1));)l.push({type:7,index:i}),e+=z.length-1}i++}}static createElement(e,t){const n=j.createElement("template");return n.innerHTML=e,n}}function ee(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3?arguments[3]:void 0;if(t===Q)return t;let o=void 0!==r?n._$Co?.[r]:n._$Cl;const i=I(t)?void 0:t._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),void 0===i?o=void 0:(o=new i(e),o._$AT(e,n,r)),void 0!==r?(n._$Co??=[])[r]=o:n._$Cl=o),void 0!==o&&(t=ee(e,o._$AS(e,t.values),o,r)),t}class te{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??j).importNode(t,!0);Z.currentNode=r;let o=Z.nextNode(),i=0,a=0,s=n[0];for(;void 0!==s;){if(i===s.index){let t;2===s.type?t=new ne(o,o.nextSibling,this,e):1===s.type?t=new s.ctor(o,s.name,s.strings,this,e):6===s.type&&(t=new se(o,this,e)),this._$AV.push(t),s=n[++a]}i!==s?.index&&(o=Z.nextNode(),i++)}return Z.currentNode=j,r}p(e){let t=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class ne{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=X,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e){e=ee(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this),I(e)?e===X||null==e||""===e?(this._$AH!==X&&this._$AR(),this._$AH=X):e!==this._$AH&&e!==Q&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>M(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==X&&I(this._$AH)?this._$AA.nextSibling.data=e:this.T(j.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,r="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=J.createElement(Y(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{const e=new te(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=G.get(e.strings);return void 0===t&&G.set(e.strings,t=new J(e)),t}k(e){M(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,r=0;for(const o of e)r===t.length?t.push(n=new ne(this.O(N()),this.O(N()),this,this.options)):n=t[r],n._$AI(o),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._$AA.nextSibling,t=arguments.length>1?arguments[1]:void 0;for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class re{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,o){this.type=1,this._$AH=X,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=o,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=X}_$AI(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;const o=this.strings;let i=!1;if(void 0===o)e=ee(this,e,t,0),i=!I(e)||e!==this._$AH&&e!==Q,i&&(this._$AH=e);else{const r=e;let a,s;for(e=o[0],a=0;a<o.length-1;a++)s=ee(this,r[n+a],t,a),s===Q&&(s=this._$AH[a]),i||=!I(s)||s!==this._$AH[a],s===X?e=X:e!==X&&(e+=(s??"")+o[a+1]),this._$AH[a]=s}i&&!r&&this.j(e)}j(e){e===X?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class oe extends re{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===X?void 0:e}}class ie extends re{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==X)}}class ae extends re{constructor(e,t,n,r,o){super(e,t,n,r,o),this.type=5}_$AI(e){if((e=ee(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,0)??X)===Q)return;const t=this._$AH,n=e===X&&t!==X||e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive,r=e!==X&&(t===X||n);n&&this.element.removeEventListener(this.name,this,t),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class se{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){ee(this,e)}}const le={I:ne},ce=A.litHtmlPolyfillSupport;ce?.(J,ne),(A.litHtmlVersions??=[]).push("3.3.1");const ue=globalThis;class de extends E{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{const r=n?.renderBefore??t;let o=r._$litPart$;if(void 0===o){const e=n?.renderBefore??null;r._$litPart$=o=new ne(t.insertBefore(N(),e),e,void 0,n??{})}return o._$AI(e),o})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Q}}de._$litElement$=!0,de.finalized=!0,ue.litElementHydrateSupport?.({LitElement:de});const he=ue.litElementPolyfillSupport;he?.({LitElement:de}),(ue.litElementVersions??=[]).push("4.2.1");const pe={attribute:!0,type:String,converter:k,reflect:!1,hasChanged:_};function fe(e){return(t,n)=>"object"==typeof n?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pe,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;const{kind:r,metadata:o}=n;let i=globalThis.litPropertyMetadata.get(o);if(void 0===i&&globalThis.litPropertyMetadata.set(o,i=new Map),"setter"===r&&((e=Object.create(e)).wrapped=!0),i.set(n.name,e),"accessor"===r){const{name:r}=n;return{set(n){const o=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,o,e)},init(t){return void 0!==t&&this.C(r,void 0,e,t),t}}}if("setter"===r){const{name:r}=n;return function(n){const o=this[r];t.call(this,n),this.requestUpdate(r,o,e)}}throw Error("Unsupported decorator location: "+r)}(e,t,n):((e,t,n)=>{const r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}var me=Object.defineProperty,ge=(e,t,n,r)=>{for(var o,i=void 0,a=e.length-1;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&me(t,n,i),i};const ve=class extends de{constructor(){super(),this.preRender=!1,Object.entries(this.constructor.dependencies).forEach((e=>{let[t,n]=e;this.constructor.define(t,n)}))}emit(e,t){const n=new CustomEvent(e,{bubbles:!0,cancelable:!1,composed:!0,detail:{},...t});return this.dispatchEvent(n),n}static define(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=customElements.get(e);if(!r){try{customElements.define(e,t,n)}catch{customElements.define(e,class extends t{},n)}return}let o=" (unknown version)",i=o;"version"in t&&t.version&&(o=" v"+t.version),"version"in r&&r.version&&(i=" v"+r.version),(!o||!i||o!==i)&&console.warn(`Attempted to register <${e}>${o}, but <${e}>${i} has already been registered.`)}static createProperty(e,t){super.createProperty(e,t),t?.attribute&&"string"==typeof t.attribute&&!Object.prototype.hasOwnProperty.call(this.prototype,t.attribute)&&Object.prototype.hasOwnProperty.call(this.prototype,e)&&Object.defineProperty(this.prototype,t.attribute,{get(){return this[e]},set(t){this[e]=t}})}firstUpdated(e){super.firstUpdated(e),!this.preRender&&this.runFirstUpdated(e)}runFirstUpdated(e){}adoptedCallback(){ye(this)}disconnectedCallback(){super.disconnectedCallback(),ye(this)}};ve.version="1",ve.dependencies={};let be=ve;function ye(e){if(e instanceof be)return;const t=e.localName||e.tagName,n=customElements.get(t.toLowerCase());n&&Object.setPrototypeOf(e,n.prototype)}ge([fe()],be.prototype,"dir"),ge([fe()],be.prototype,"lang"),ge([fe({attribute:"pre-render",type:Boolean})],be.prototype,"preRender");const xe=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.get(e)||window.customElements.define(e,t),t))(e,t):((e,t)=>{const{elements:n,kind:r}=t;return{elements:n,finisher(t){window.customElements.get(e)||window.customElements.define(e,t)},kind:r}})(e,t),we=u`
|
|
1011
1015
|
:host {
|
|
1012
1016
|
box-sizing: border-box;
|
|
1013
1017
|
}
|